Skip to content

Commit ccc67a9

Browse files
authored
fix: ACNA-3397 - exclude web-export and raw-http properties in action, allow web property to be boolean (#38)
* fix(tech-debt): formatted extra-long object parameter * fix: action.web property can also be a boolean value
1 parent 002f3a3 commit ccc67a9

File tree

6 files changed

+100
-11
lines changed

6 files changed

+100
-11
lines changed

schema/app.config.yaml.schema.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,17 @@
129129
"type": "object",
130130
"properties": {
131131
"function": { "type": "string" },
132-
"web": { "type": "string" },
132+
"web": {
133+
"anyOf" : [
134+
{"type": "string" },
135+
{"type": "boolean" }
136+
]
137+
},
133138
"runtime": { "type": "string" },
134139
"inputs": { "$ref": "#/definitions/inputs" },
135-
"annotations": { "$ref": "#/definitions/annotations" }
140+
"annotations": { "$ref": "#/definitions/annotations" },
141+
"web-export": { "not": {} },
142+
"raw-http": { "not": {} }
136143
},
137144
"required": []
138145
},

test/__fixtures__/app-exc-nui/app.config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ application:
2626
concurrency: 189
2727
'action-zip':
2828
function: 'myactions/action-zip'
29-
web: 'yes'
29+
web: 'true'
3030
runtime: 'nodejs:14'
3131
sequences:
3232
'action-sequence':
3333
actions: 'action, action-zip'
34-
web: 'yes'
34+
web: true
3535
triggers:
3636
trigger1: null
3737
rules:

test/__fixtures__/app/app.config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ application:
2626
concurrency: 189
2727
'action-zip':
2828
function: 'myactions/action-zip'
29-
web: 'yes'
29+
web: 'true'
3030
runtime: 'nodejs:14'
3131
sequences:
3232
'action-sequence':
3333
actions: 'action, action-zip'
34-
web: 'yes'
34+
web: true
3535
triggers:
3636
trigger1: null
3737
rules:

test/__fixtures__/legacy-app/manifest.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ packages:
2121
concurrency: 189
2222
'action-zip':
2323
function: 'myactions/action-zip'
24-
web: 'yes'
24+
web: 'true'
2525
runtime: 'nodejs:14'
2626
sequences:
2727
'action-sequence':
2828
actions: 'action, action-zip'
29-
web: 'yes'
29+
web: true
3030
triggers:
3131
trigger1: null
3232
rules:

test/data-mocks/config-loader.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,14 @@ function fullFakeRuntimeManifest (pathToActionFolder, pkgName1) {
6565
},
6666
'action-zip': {
6767
function: winCompat(`${pathToActionFolder}/action-zip`),
68-
web: 'yes',
68+
web: 'true',
6969
runtime: 'nodejs:14'
7070
}
7171
},
7272
sequences: {
7373
'action-sequence': {
7474
actions: 'action, action-zip',
75-
web: 'yes'
75+
web: true
7676
}
7777
},
7878
triggers: {

test/index.test.js

Lines changed: 83 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,51 @@ describe('load config', () => {
6262
test('exc with events config', async () => {
6363
global.loadFixtureApp('exc-with-events')
6464
config = await appConfig.load({})
65-
expect(config.all['dx/excshell/1']).toEqual(expect.objectContaining({ events: { registrations: { 'Demo name': { description: 'Demo description', events_of_interest: [{ event_codes: ['com.adobe.platform.gdpr.joberror', 'com.adobe.platform.gdpr.producterror'], provider_metadata: 'gdpr_events' }, { event_codes: ['test-code-skrishna', 'card_abandonment'], provider_metadata: 'aem' }], runtime_action: 'my-exc-package/action' }, 'Event Registration Default': { description: 'Registration for IO Events', events_of_interest: [{ event_codes: ['com.adobe.platform.gdpr.joberror', 'com.adobe.platform.gdpr.producterror'], provider_metadata: 'gdpr_events' }], runtime_action: 'my-exc-package/action' } } } }))
65+
const eventObj = {
66+
events:
67+
{
68+
registrations:
69+
{
70+
'Demo name':
71+
{
72+
description: 'Demo description',
73+
events_of_interest:
74+
[
75+
{
76+
event_codes:
77+
[
78+
'com.adobe.platform.gdpr.joberror',
79+
'com.adobe.platform.gdpr.producterror'
80+
],
81+
provider_metadata: 'gdpr_events'
82+
},
83+
{
84+
event_codes: ['test-code-skrishna', 'card_abandonment'],
85+
provider_metadata: 'aem'
86+
}
87+
],
88+
runtime_action: 'my-exc-package/action'
89+
},
90+
'Event Registration Default':
91+
{
92+
description: 'Registration for IO Events',
93+
events_of_interest:
94+
[
95+
{
96+
event_codes:
97+
[
98+
'com.adobe.platform.gdpr.joberror',
99+
'com.adobe.platform.gdpr.producterror'
100+
],
101+
provider_metadata: 'gdpr_events'
102+
}
103+
],
104+
runtime_action: 'my-exc-package/action'
105+
}
106+
}
107+
}
108+
}
109+
expect(config.all['dx/excshell/1']).toEqual(expect.objectContaining(eventObj))
66110
})
67111

68112
test('standalone app, exc and nui extension config', async () => {
@@ -287,6 +331,44 @@ extensions:
287331
expect(config.implements).toEqual(['application'])
288332
})
289333

334+
test('action config with web-export not in annotations', async () => {
335+
global.fakeFileSystem.addJson({
336+
'/package.json': '{}',
337+
'/app.config.yaml':
338+
`
339+
application:
340+
runtimeManifest:
341+
packages:
342+
myapp:
343+
actions:
344+
generic:
345+
function: actions/generic/index.js
346+
runtime: nodejs:18
347+
web-export: raw
348+
`
349+
})
350+
await expect(appConfig.load({})).rejects.toThrow('Missing or invalid keys in app.config.yaml:')
351+
})
352+
353+
test('action config with raw-http not in annotations', async () => {
354+
global.fakeFileSystem.addJson({
355+
'/package.json': '{}',
356+
'/app.config.yaml':
357+
`
358+
application:
359+
runtimeManifest:
360+
packages:
361+
myapp:
362+
actions:
363+
generic:
364+
function: actions/generic/index.js
365+
runtime: nodejs:18
366+
raw-http: true
367+
`
368+
})
369+
await expect(appConfig.load({})).rejects.toThrow('Missing or invalid keys in app.config.yaml:')
370+
})
371+
290372
// options
291373
test('standalone app config - ignoreAioConfig=true', async () => {
292374
global.loadFixtureApp('app')

0 commit comments

Comments
 (0)