@contrail/cli 1.0.10 → 1.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,39 @@
1
+ export { } // Leave empty export - This allows for multiple files with a function named execute.
2
+ async function execute(config, event, Functions) {
3
+ const getBodyFromEvent = (config, event) => {
4
+ let body = Functions.stringUtil.parseVariables(config.message, event);
5
+ console.log('body: ', body);
6
+ if (config.sendDetails) {
7
+ const data = event;
8
+ const properties = {};
9
+ let addedProperty = false;
10
+ for (const property of config.fieldsToForward) {
11
+ const variableLevels = property.split('.');
12
+ let replacementValue = data;
13
+ for (let i = 0; i < variableLevels.length; i++) {
14
+ replacementValue = replacementValue[variableLevels[i]];
15
+ }
16
+ properties[property] = replacementValue;
17
+ addedProperty = true;
18
+ }
19
+ if (addedProperty) {
20
+ body = body + ' Properties: ' + JSON.stringify(properties) + '.';
21
+ }
22
+ }
23
+ return JSON.stringify({ text: body });
24
+ };
25
+ const body = getBodyFromEvent(config, event);
26
+ console.log('Sending message: ', body);
27
+ const response = await Functions.fetch(config.url, {
28
+ method: 'POST',
29
+ body: body,
30
+ headers: { 'Content-Type': 'application/json' }
31
+ });
32
+ if (!response.ok) {
33
+ console.log('Webhook event failed to publish');
34
+ console.log('Response: ', JSON.stringify(response));
35
+ }
36
+ else {
37
+ console.log('Published!');
38
+ }
39
+ }
package/test/app.yml ADDED
@@ -0,0 +1,46 @@
1
+ appIdentifier: "@vibe/kamaltest"
2
+ appName: "kamal's test app"
3
+ appDescription: "just a hello world app"
4
+ visibility: private
5
+ publisher: "vibeiq kamal"
6
+ version: 1.0
7
+
8
+ # eventWorkflowTriggerKeyMapping will be used to parse an incoming event into a key that can trigger workflows
9
+ # {} indicates a field on the event. You can use nested fields by separating the levels with a '.'
10
+ # i.e. an event {details: {eventType: 'apparel'}, actionType: 'create'} can be parsed to apparel|create with the following
11
+ eventWorkflowTriggerKeyMapping: "{details.eventType}|{actionType}"
12
+
13
+
14
+ # Actions can be written in .ts but must be compiled to .js before deployment.
15
+ # Ensure the handler points to a .js file
16
+ actions:
17
+ updateProduct:
18
+ handler: actions/exampleAction.js
19
+ name: "Update Product"
20
+ description: "Updates a product in the destination system."
21
+ actionConfiguration:
22
+ email:
23
+ label: "Email Address"
24
+ propertyType: "string"
25
+
26
+ triggers:
27
+ trigger1:
28
+ key: product|create
29
+ name: "External Product Created"
30
+ external: true
31
+ description: "Triggers on externally created products"
32
+
33
+ # TODO - This is not read
34
+ workflows:
35
+ workflow1:
36
+ name: "Update item on product creation"
37
+ triggerKey: product|create
38
+ paths:
39
+ path1:
40
+ conditional: "{retailPrice} > 10"
41
+ actions:
42
+ updateItem:
43
+ actionId: updateItem
44
+ configuration:
45
+
46
+
@@ -0,0 +1,15 @@
1
+ optionSets:
2
+ - name: Collection
3
+ isArchived: false
4
+ optionSet:
5
+ - value: collection_1
6
+ display: Collection 1
7
+ - value: collection_2
8
+ display: Collection 2
9
+ - name: Gender
10
+ isArchived: false
11
+ optionSet:
12
+ - value: womens
13
+ display: Women's
14
+ - value: mens
15
+ display: Men's
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "test-app",
3
+ "version": "1.0.0",
4
+ "lockfileVersion": 1,
5
+ "requires": true,
6
+ "dependencies": {
7
+ "ansi-styles": {
8
+ "version": "4.3.0",
9
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
10
+ "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
11
+ "requires": {
12
+ "color-convert": "^2.0.1"
13
+ }
14
+ },
15
+ "chalk": {
16
+ "version": "4.1.2",
17
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
18
+ "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
19
+ "requires": {
20
+ "ansi-styles": "^4.1.0",
21
+ "supports-color": "^7.1.0"
22
+ }
23
+ },
24
+ "color-convert": {
25
+ "version": "2.0.1",
26
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
27
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
28
+ "requires": {
29
+ "color-name": "~1.1.4"
30
+ }
31
+ },
32
+ "color-name": {
33
+ "version": "1.1.4",
34
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
35
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
36
+ },
37
+ "has-flag": {
38
+ "version": "4.0.0",
39
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
40
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="
41
+ },
42
+ "supports-color": {
43
+ "version": "7.2.0",
44
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
45
+ "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
46
+ "requires": {
47
+ "has-flag": "^4.0.0"
48
+ }
49
+ },
50
+ "typescript": {
51
+ "version": "4.7.4",
52
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz",
53
+ "integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==",
54
+ "dev": true
55
+ }
56
+ }
57
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "test-app",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "bin": {
7
+ "@contrail/contrail-cli": "bin/init",
8
+ "contrail": "bin/init"
9
+ },
10
+ "publishConfig": {
11
+ "access": "public"
12
+ },
13
+ "scripts": {
14
+ "build": "tsc",
15
+ "test": "echo \"Error: no test specified\" && exit 1"
16
+ },
17
+ "keywords": [],
18
+ "author": "",
19
+ "license": "ISC",
20
+ "dependencies": {
21
+ "chalk": "^4.0.0"
22
+ },
23
+ "devDependencies": {
24
+ "typescript": "^4.7.4"
25
+ }
26
+ }
@@ -0,0 +1,31 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es2017",
4
+ "module": "commonjs",
5
+ "declaration": true,
6
+ "esModuleInterop": true,
7
+ "outDir": "./actions",
8
+ "strict": false,
9
+ "experimentalDecorators": true,
10
+ "strictPropertyInitialization": false,
11
+ "noImplicitAny": false,
12
+ "emitDecoratorMetadata": true,
13
+ "skipLibCheck": true,
14
+ "moduleResolution": "node",
15
+ "lib": [
16
+ "es5",
17
+ "ES2015",
18
+ "ES2016",
19
+ "ES2017",
20
+ "dom",
21
+ "esnext.asynciterable"
22
+ ],
23
+ },
24
+ "include": [
25
+ "actions"
26
+ ],
27
+ "exclude": [
28
+ "node_modules",
29
+ "**/__tests__/*"
30
+ ]
31
+ }