diff --git a/schema/app.config.yaml.schema.json b/schema/app.config.yaml.schema.json index 576c622..4b764b5 100644 --- a/schema/app.config.yaml.schema.json +++ b/schema/app.config.yaml.schema.json @@ -129,10 +129,17 @@ "type": "object", "properties": { "function": { "type": "string" }, - "web": { "type": "string" }, + "web": { + "anyOf" : [ + {"type": "string" }, + {"type": "boolean" } + ] + }, "runtime": { "type": "string" }, "inputs": { "$ref": "#/definitions/inputs" }, - "annotations": { "$ref": "#/definitions/annotations" } + "annotations": { "$ref": "#/definitions/annotations" }, + "web-export": { "not": {} }, + "raw-http": { "not": {} } }, "required": [] }, diff --git a/test/__fixtures__/app-exc-nui/app.config.yaml b/test/__fixtures__/app-exc-nui/app.config.yaml index 99e1b0e..d242be9 100644 --- a/test/__fixtures__/app-exc-nui/app.config.yaml +++ b/test/__fixtures__/app-exc-nui/app.config.yaml @@ -26,12 +26,12 @@ application: concurrency: 189 'action-zip': function: 'myactions/action-zip' - web: 'yes' + web: 'true' runtime: 'nodejs:14' sequences: 'action-sequence': actions: 'action, action-zip' - web: 'yes' + web: true triggers: trigger1: null rules: diff --git a/test/__fixtures__/app/app.config.yaml b/test/__fixtures__/app/app.config.yaml index d27bec4..f9d23f4 100644 --- a/test/__fixtures__/app/app.config.yaml +++ b/test/__fixtures__/app/app.config.yaml @@ -26,12 +26,12 @@ application: concurrency: 189 'action-zip': function: 'myactions/action-zip' - web: 'yes' + web: 'true' runtime: 'nodejs:14' sequences: 'action-sequence': actions: 'action, action-zip' - web: 'yes' + web: true triggers: trigger1: null rules: diff --git a/test/__fixtures__/legacy-app/manifest.yml b/test/__fixtures__/legacy-app/manifest.yml index 7a4f360..375db21 100644 --- a/test/__fixtures__/legacy-app/manifest.yml +++ b/test/__fixtures__/legacy-app/manifest.yml @@ -21,12 +21,12 @@ packages: concurrency: 189 'action-zip': function: 'myactions/action-zip' - web: 'yes' + web: 'true' runtime: 'nodejs:14' sequences: 'action-sequence': actions: 'action, action-zip' - web: 'yes' + web: true triggers: trigger1: null rules: diff --git a/test/data-mocks/config-loader.js b/test/data-mocks/config-loader.js index 6308368..6eb135c 100644 --- a/test/data-mocks/config-loader.js +++ b/test/data-mocks/config-loader.js @@ -65,14 +65,14 @@ function fullFakeRuntimeManifest (pathToActionFolder, pkgName1) { }, 'action-zip': { function: winCompat(`${pathToActionFolder}/action-zip`), - web: 'yes', + web: 'true', runtime: 'nodejs:14' } }, sequences: { 'action-sequence': { actions: 'action, action-zip', - web: 'yes' + web: true } }, triggers: { diff --git a/test/index.test.js b/test/index.test.js index 6a10fc1..116ca01 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -62,7 +62,51 @@ describe('load config', () => { test('exc with events config', async () => { global.loadFixtureApp('exc-with-events') config = await appConfig.load({}) - 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' } } } })) + const eventObj = { + 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' + } + } + } + } + expect(config.all['dx/excshell/1']).toEqual(expect.objectContaining(eventObj)) }) test('standalone app, exc and nui extension config', async () => { @@ -287,6 +331,44 @@ extensions: expect(config.implements).toEqual(['application']) }) + test('action config with web-export not in annotations', async () => { + global.fakeFileSystem.addJson({ + '/package.json': '{}', + '/app.config.yaml': +` +application: + runtimeManifest: + packages: + myapp: + actions: + generic: + function: actions/generic/index.js + runtime: nodejs:18 + web-export: raw +` + }) + await expect(appConfig.load({})).rejects.toThrow('Missing or invalid keys in app.config.yaml:') + }) + + test('action config with raw-http not in annotations', async () => { + global.fakeFileSystem.addJson({ + '/package.json': '{}', + '/app.config.yaml': +` +application: + runtimeManifest: + packages: + myapp: + actions: + generic: + function: actions/generic/index.js + runtime: nodejs:18 + raw-http: true +` + }) + await expect(appConfig.load({})).rejects.toThrow('Missing or invalid keys in app.config.yaml:') + }) + // options test('standalone app config - ignoreAioConfig=true', async () => { global.loadFixtureApp('app')