@contrail/cli 1.0.0 → 1.0.5

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.
Files changed (74) hide show
  1. package/.vscode/settings.json +5 -5
  2. package/bin/init +3 -3
  3. package/lib/{create-app → apps/create-app}/create.d.ts +1 -1
  4. package/lib/apps/create-app/create.js +59 -0
  5. package/lib/apps/create-app/setup-template.d.ts +1 -0
  6. package/lib/apps/create-app/setup-template.js +34 -0
  7. package/lib/{deploy-app → apps/deploy-app}/actions-deployer.d.ts +10 -10
  8. package/lib/{deploy-app → apps/deploy-app}/actions-deployer.js +97 -78
  9. package/lib/apps/deploy-app/app-deployer.d.ts +8 -0
  10. package/lib/{deploy-app → apps/deploy-app}/app-deployer.js +79 -58
  11. package/lib/apps/deploy-app/app-template-parsers.d.ts +7 -0
  12. package/lib/apps/deploy-app/app-template-parsers.js +37 -0
  13. package/lib/{deploy-app → apps/deploy-app}/deploy.d.ts +2 -2
  14. package/lib/apps/deploy-app/deploy.js +58 -0
  15. package/lib/apps/deploy-app/interfaces.d.ts +74 -0
  16. package/lib/apps/deploy-app/interfaces.js +4 -0
  17. package/lib/auth/auth.d.ts +9 -0
  18. package/lib/auth/auth.js +2 -0
  19. package/lib/auth/login.d.ts +2 -1
  20. package/lib/auth/login.js +113 -79
  21. package/lib/cli.d.ts +5 -5
  22. package/lib/cli.js +36 -30
  23. package/lib/common.d.ts +1 -0
  24. package/lib/common.js +5 -0
  25. package/lib/types/interfaces.d.ts +51 -0
  26. package/lib/{deploy-app → types}/interfaces.js +0 -0
  27. package/lib/types/option-set-uploader.d.ts +1 -0
  28. package/lib/types/option-set-uploader.js +75 -0
  29. package/lib/types/types-extractor.d.ts +1 -0
  30. package/lib/types/types-extractor.js +93 -0
  31. package/lib/types/types-uploader.d.ts +1 -0
  32. package/lib/types/types-uploader.js +171 -0
  33. package/package.json +63 -63
  34. package/publish.sh +5 -0
  35. package/src/apps/create-app/create.ts +73 -0
  36. package/src/apps/create-app/setup-template.ts +38 -0
  37. package/src/{deploy-app → apps/deploy-app}/actions-deployer.ts +122 -87
  38. package/src/{deploy-app → apps/deploy-app}/app-deployer.ts +86 -63
  39. package/src/apps/deploy-app/app-template-parsers.ts +43 -0
  40. package/src/apps/deploy-app/deploy.ts +67 -0
  41. package/src/apps/deploy-app/interfaces.ts +78 -0
  42. package/src/auth/auth.ts +10 -0
  43. package/src/auth/login.ts +127 -89
  44. package/src/cli.ts +38 -33
  45. package/src/common.ts +5 -0
  46. package/src/types/interfaces.ts +54 -0
  47. package/src/types/option-set-uploader.ts +83 -0
  48. package/src/types/types-extractor.ts +116 -0
  49. package/src/types/types-uploader.ts +198 -0
  50. package/templates/javascript/actions/example/action.js +37 -37
  51. package/templates/javascript/app.yml +54 -42
  52. package/templates/javascript/package.json +23 -23
  53. package/templates/typescript/actions/exampleAction.ts +38 -0
  54. package/templates/typescript/app.yml +56 -0
  55. package/templates/typescript/package.json +24 -0
  56. package/templates/typescript/tsconfig.json +31 -0
  57. package/tsconfig.json +30 -22
  58. package/tslint.json +57 -57
  59. package/lib/create-app/create.js +0 -48
  60. package/lib/create-app/setup-template.d.ts +0 -1
  61. package/lib/create-app/setup-template.js +0 -48
  62. package/lib/deploy-app/actions.d.ts +0 -5
  63. package/lib/deploy-app/actions.js +0 -17
  64. package/lib/deploy-app/app-declaration.d.ts +0 -20
  65. package/lib/deploy-app/app-declaration.js +0 -0
  66. package/lib/deploy-app/app-deployer.d.ts +0 -9
  67. package/lib/deploy-app/app.d.ts +0 -8
  68. package/lib/deploy-app/app.js +0 -56
  69. package/lib/deploy-app/deploy.js +0 -30
  70. package/lib/deploy-app/interfaces.d.ts +0 -34
  71. package/src/create-app/create.ts +0 -58
  72. package/src/create-app/setup-template.ts +0 -61
  73. package/src/deploy-app/deploy.ts +0 -34
  74. package/src/deploy-app/interfaces.ts +0 -35
@@ -0,0 +1,54 @@
1
+ export interface ReducedType {
2
+ slug: string;
3
+ label: string;
4
+ typePath: string;
5
+ isArchived: boolean;
6
+ typeProperties: ReducedType[];
7
+ }
8
+
9
+ export interface ReducedTypeProperties {
10
+ id: string;
11
+ isArchived: boolean;
12
+ propertyType: PropertyType;
13
+ slug: string;
14
+ label: string;
15
+ editable: boolean;
16
+ core: boolean;
17
+ typePropertyOptionSetId: string;
18
+ formula: string;
19
+ referencedTypeRootSlug: string;
20
+ defaultValue: string;
21
+ propertyLevel: string;
22
+ inherited: boolean;
23
+ }
24
+
25
+ export interface ReducedOptionSet {
26
+ id: string;
27
+ name: string;
28
+ isArchived: boolean;
29
+ optionSet: any[];
30
+ }
31
+
32
+ export declare enum PropertyType {
33
+ Text = 'text',
34
+ String = 'string',
35
+ Number = 'number',
36
+ Date = 'date',
37
+ Boolean = 'boolean',
38
+ MultiSelect = 'multi_select',
39
+ SingleSelect = 'choice',
40
+ Url = 'url',
41
+ Currency = 'currency',
42
+ Percent = 'percent',
43
+ Rating = 'rating',
44
+ Formula = 'formula',
45
+ ObjectReference = 'object_reference',
46
+ ObjectReferenceList = 'object_ref_list',
47
+ DataGrid = 'data_grid',
48
+ CascadingSelect = 'cascading_select',
49
+ Sequence = 'sequence',
50
+ Constant = 'constant',
51
+ Composite = 'composite',
52
+ UserList = 'userList',
53
+ Image = 'image',
54
+ }
@@ -0,0 +1,83 @@
1
+ import { Entities } from '@contrail/sdk';
2
+ import { ReducedOptionSet } from './interfaces';
3
+ import fs from 'fs';
4
+ import { getSeparatorByPlatform } from '../common';
5
+
6
+ const yaml = require('js-yaml');
7
+
8
+ function loadOptionSets(){
9
+ const TARGET_DIR = process.cwd();
10
+ try {
11
+ const separator = getSeparatorByPlatform();
12
+ const doc = yaml.load(fs.readFileSync(TARGET_DIR + separator + 'option_sets.yml', 'utf8'));
13
+ return doc.optionSets;
14
+ } catch (e) {
15
+ throw new Error(`ERROR PARSING YAML: ${e}`);
16
+ }
17
+ }
18
+
19
+ export async function uploadOptionSets() {
20
+ const optionSets: ReducedOptionSet[] = loadOptionSets();
21
+
22
+ const currentOptionSets = await new Entities().get({
23
+ entityName: 'type-property-option-set',
24
+ });
25
+
26
+ const currentOptionSetsByName = {};
27
+ for (const currentOptionSet of currentOptionSets) {
28
+ currentOptionSetsByName[currentOptionSet.name] = currentOptionSet;
29
+ }
30
+
31
+ const newOptionSetsByName = {};
32
+ for (const optionSet of optionSets) {
33
+ newOptionSetsByName[optionSet.name] = optionSet;
34
+ }
35
+
36
+ for (const optionSet of optionSets) {
37
+ try {
38
+ const found = currentOptionSetsByName[optionSet.name];
39
+ if (!found) {
40
+ console.log('Creating: ', optionSet.name);
41
+ await new Entities().create({
42
+ entityName: 'type-property-option-set',
43
+ object: {
44
+ name: optionSet.name,
45
+ optionSet: optionSet.optionSet,
46
+ isArchived: optionSet.isArchived,
47
+ },
48
+ });
49
+ }
50
+ else
51
+ {
52
+ console.log('Updating: ', optionSet.name);
53
+ await new Entities().update({
54
+ entityName: 'type-property-option-set',
55
+ id: found.id,
56
+ object: {
57
+ name: optionSet.name,
58
+ optionSet: optionSet.optionSet,
59
+ isArchived: optionSet.isArchived,
60
+ },
61
+ });
62
+ }
63
+ } catch (err) {
64
+ throw new Error(`Error Uploading OptionSets: ${err}`);
65
+ }
66
+ }
67
+
68
+ for (const currentOptionSet of currentOptionSets) {
69
+ try {
70
+ const found = newOptionSetsByName[currentOptionSet.name];
71
+ if (!found) {
72
+ console.log('Deleting: ', currentOptionSet.name);
73
+ await new Entities().delete({
74
+ entityName: 'type-property-option-set',
75
+ id: currentOptionSet.id,
76
+ });
77
+ }
78
+ } catch (err) {
79
+ throw new Error(`Error Deleting OptionSets: ${err}`);
80
+ }
81
+ }
82
+
83
+ }
@@ -0,0 +1,116 @@
1
+ import { Entities } from '@contrail/sdk';
2
+ import { ReducedType, ReducedOptionSet, ReducedTypeProperties } from './interfaces';
3
+ import chalk from 'chalk';
4
+ import fs from 'fs';
5
+ import { authUser } from '../auth/login';
6
+ import { getSeparatorByPlatform } from '../common';
7
+
8
+ const yaml = require('js-yaml');
9
+
10
+ export async function getTypes(args) {
11
+ try {
12
+ const userConfig = await authUser();
13
+ console.log(`%s Getting all types for orgId: ${userConfig.orgId}`, chalk.blue.bold('START'));
14
+
15
+ console.log(`%s Retrieving`, chalk.yellow.bold('OPTION SETS'));
16
+ await getOptionSets();
17
+ console.log(`%s Retrieved`, chalk.yellow.bold('OPTION SETS'));
18
+
19
+ console.log(`%s Retrieving`, chalk.yellow.bold('TYPES'));
20
+ await getReducedTypes();
21
+ console.log(`%s Retrieved`, chalk.yellow.bold('TYPES'));
22
+
23
+ }
24
+ catch (e) {
25
+ console.log(`%s Types Retrieval Failed. ${e}`, chalk.red.bold('FAIL'));
26
+ return;
27
+ }
28
+
29
+ console.log('%s Types Retrieval Complete.', chalk.green.bold('COMPLETE'));
30
+ }
31
+
32
+ async function getOptionSets() {
33
+ const optionSets = await new Entities().get({
34
+ entityName: 'type-property-option-set',
35
+ });
36
+
37
+ const reducedOptionSets = [];
38
+ for (const optionSet of optionSets) {
39
+ const reducedOptionSet: ReducedOptionSet = {
40
+ id: optionSet.id,
41
+ name: optionSet.name,
42
+ isArchived: optionSet.isArchived,
43
+ optionSet: optionSet.optionSet,
44
+ };
45
+
46
+ reducedOptionSets.push(reducedOptionSet);
47
+ }
48
+
49
+ const optionSetsHolder = {
50
+ optionSets: reducedOptionSets,
51
+ };
52
+
53
+ const CURRENT_DIR = process.cwd();
54
+ const separator = getSeparatorByPlatform();
55
+
56
+ const yamlStr = yaml.dump(optionSetsHolder);
57
+ fs.writeFileSync(CURRENT_DIR + separator + 'option_sets.yml', yamlStr, 'utf8');
58
+ }
59
+
60
+ async function getReducedTypes() {
61
+ const types = await new Entities().get({
62
+ entityName: 'type',
63
+ });
64
+
65
+ console.log('Found types: ', types.length);
66
+
67
+ const reducedTypes = [];
68
+ for (const type of types) {
69
+ const typeWithProperties = await new Entities().get({
70
+ entityName: 'type',
71
+ id: type.id,
72
+ relations: ['typeProperties'],
73
+ });
74
+
75
+ const reducedTypeProperties = [];
76
+ for (const typeProperty of typeWithProperties.typeProperties) {
77
+ const reducedTypeProperty: ReducedTypeProperties = {
78
+ id: typeProperty.id,
79
+ isArchived: typeProperty.isArchived,
80
+ propertyType: typeProperty.propertyType,
81
+ slug: typeProperty.slug,
82
+ label: typeProperty.label,
83
+ editable: typeProperty.editable,
84
+ core: typeProperty.core,
85
+ typePropertyOptionSetId: typeProperty.typePropertyOptionSetId,
86
+ formula: typeProperty.formula,
87
+ referencedTypeRootSlug: typeProperty.referencedTypeRootSlug,
88
+ defaultValue: typeProperty.defaultValue,
89
+ propertyLevel: typeProperty.propertyLevel,
90
+ inherited: typeProperty.inherited,
91
+ };
92
+
93
+ reducedTypeProperties.push(reducedTypeProperty);
94
+ }
95
+
96
+ const reducedType: ReducedType = {
97
+ slug: typeWithProperties.slug,
98
+ label: typeWithProperties.label,
99
+ typePath: typeWithProperties.typePath,
100
+ isArchived: typeWithProperties.isArchived,
101
+ typeProperties: reducedTypeProperties,
102
+ };
103
+
104
+ reducedTypes.push(reducedType);
105
+ }
106
+
107
+ const typesHolder = {
108
+ types: reducedTypes,
109
+ };
110
+
111
+ const CURRENT_DIR = process.cwd();
112
+ const separator = getSeparatorByPlatform();
113
+
114
+ const yamlStr = yaml.dump(typesHolder);
115
+ fs.writeFileSync(CURRENT_DIR + separator + 'types.yml', yamlStr, 'utf8');
116
+ }
@@ -0,0 +1,198 @@
1
+ import { Entities, Request } from '@contrail/sdk';
2
+ import { ReducedType, ReducedTypeProperties } from './interfaces';
3
+ import { uploadOptionSets } from './option-set-uploader';
4
+ import chalk from 'chalk';
5
+ import fs from 'fs';
6
+ import { authUser } from '../auth/login';
7
+ import { getSeparatorByPlatform } from '../common';
8
+
9
+ const yaml = require('js-yaml');
10
+
11
+ export async function uploadTypes(args) {
12
+ try {
13
+ const userConfig = await authUser();
14
+ console.log(`%s Getting all types for orgId: ${userConfig.orgId}`, chalk.blue.bold('START'));
15
+
16
+ console.log(`%s Uploading`, chalk.yellow.bold('OPTION SETS'));
17
+ await uploadOptionSets();
18
+ console.log(`%s Uploaded`, chalk.yellow.bold('OPTION SETS'));
19
+
20
+ console.log(`%s Uploading`, chalk.yellow.bold('TYPES'));
21
+ await uploadReducedTypes();
22
+ console.log(`%s Uploaded`, chalk.yellow.bold('TYPES'));
23
+
24
+ }
25
+ catch (e) {
26
+ console.log(`%s Types Upload Failed. ${e}`, chalk.red.bold('FAIL'));
27
+ return;
28
+ }
29
+
30
+ console.log('%s Types Upload Complete.', chalk.green.bold('COMPLETE'));
31
+ }
32
+
33
+ function loadReducedTypes(){
34
+ const TARGET_DIR = process.cwd();
35
+ try {
36
+ const separator = getSeparatorByPlatform();
37
+ const doc = yaml.load(fs.readFileSync(TARGET_DIR + separator + 'types.yml', 'utf8'));
38
+ return doc.types;
39
+ } catch (e) {
40
+ throw new Error(`ERROR PARSING YAML: ${e}`);
41
+ }
42
+ }
43
+
44
+ async function uploadReducedTypes() {
45
+ const types: ReducedType[] = loadReducedTypes();
46
+
47
+ const currentTypesWithoutProperties = await new Entities().get({
48
+ entityName: 'type',
49
+ });
50
+
51
+ const currentTypes = [];
52
+ for (const currentTypeWithoutProperties of currentTypesWithoutProperties) {
53
+ const typeWithProperties = await new Entities().get({
54
+ entityName: 'type',
55
+ id: currentTypeWithoutProperties.id,
56
+ relations: ['typeProperties'],
57
+ });
58
+ currentTypes.push(typeWithProperties);
59
+ }
60
+
61
+ const currentTypesBySlug = {};
62
+ for (const currentType of currentTypes) {
63
+ currentTypesBySlug[currentType.slug] = currentType;
64
+ }
65
+
66
+ const newTypesBySlug = {};
67
+ for (const type of types) {
68
+ newTypesBySlug[type.slug] = type;
69
+ }
70
+
71
+ for (const type of types) {
72
+ try {
73
+ const found = currentTypesBySlug[type.slug];
74
+ if (!found) {
75
+ if (!type.typePath.includes(':')) {
76
+ console.log('Cannot create a base type. Skipping: ', type.slug);
77
+ continue;
78
+ }
79
+
80
+ console.log('Creating Type: ', type.slug);
81
+
82
+ const createdType = await new Entities().create({
83
+ entityName: 'type',
84
+ object: {
85
+ slug: type.slug,
86
+ label: type.label,
87
+ typePath: type.typePath,
88
+ isArchived: type.isArchived,
89
+ },
90
+ });
91
+
92
+ await uploadReducedTypeProperties(createdType, [], type.typeProperties);
93
+ }
94
+ else
95
+ {
96
+ console.log('Updating Type: ', type.slug);
97
+ const updatedType = await new Entities().update({
98
+ entityName: 'type',
99
+ id: found.id,
100
+ object: {
101
+ slug: type.slug,
102
+ label: type.label,
103
+ typePath: type.typePath,
104
+ isArchived: type.isArchived,
105
+ },
106
+ });
107
+
108
+ await uploadReducedTypeProperties(updatedType, found.typeProperties, type.typeProperties);
109
+ }
110
+
111
+ } catch (err) {
112
+ console.log('Error Uploading Types: ', err);
113
+ }
114
+ }
115
+
116
+ for (const currentType of currentTypes) {
117
+ try {
118
+ const found = newTypesBySlug[currentType.slug];
119
+ if (!found) {
120
+ console.log('Deleting Type: ', currentType.slug);
121
+ await new Entities().delete({
122
+ entityName: 'type',
123
+ id: currentType.id,
124
+ });
125
+ }
126
+ } catch (err) {
127
+ throw new Error(`Error Deleting Types: ${err}`);
128
+ }
129
+ }
130
+
131
+ }
132
+
133
+ async function uploadReducedTypeProperties(type, currentPropertyTypes, newPropertyTypes) {
134
+ const currentPropertyTypeBySlug = {};
135
+ for (const currentPropertyType of currentPropertyTypes) {
136
+ currentPropertyTypeBySlug[currentPropertyType.slug] = currentPropertyType;
137
+ }
138
+
139
+ const newPropertyTypesBySlug = {};
140
+ for (const newPropertyType of newPropertyTypes) {
141
+ newPropertyTypesBySlug[newPropertyType.slug] = newPropertyType;
142
+ }
143
+
144
+ for (const newPropertyType of newPropertyTypes) {
145
+ try {
146
+ const found = currentPropertyTypeBySlug[newPropertyType.slug];
147
+ if (!found && !newPropertyType.inherited) {
148
+ console.log('Creating Type-Property: ', newPropertyType.slug);
149
+
150
+ await Request.request(
151
+ `/types/${type.id}/type-properties`,
152
+ {
153
+ method: 'POST',
154
+ body: JSON.stringify({
155
+ isArchived: newPropertyType.isArchived,
156
+ propertyType: newPropertyType.propertyType,
157
+ slug: newPropertyType.slug,
158
+ label: newPropertyType.label,
159
+ editable: newPropertyType.editable,
160
+ core: newPropertyType.core,
161
+ typePropertyOptionSetId: newPropertyType.typePropertyOptionSetId,
162
+ formula: newPropertyType.formula,
163
+ referencedTypeRootSlug: newPropertyType.referencedTypeRootSlug,
164
+ defaultValue: newPropertyType.defaultValue,
165
+ propertyLevel: newPropertyType.propertyLevel,
166
+ }),
167
+ headers: {
168
+ 'Accept': 'application/json',
169
+ 'Content-Type': 'application/json',
170
+ },
171
+ });
172
+ }
173
+
174
+ } catch (err) {
175
+ console.log('Error Creating Properties: ', err);
176
+ }
177
+ }
178
+
179
+ for (const currentPropertyType of currentPropertyTypes) {
180
+ try {
181
+ const found = newPropertyTypesBySlug[currentPropertyType.slug];
182
+ if (!found && !currentPropertyType.inherited) {
183
+ console.log('Deleting Type-Property: ', currentPropertyType.slug);
184
+ await Request.request(
185
+ `/types/${type.id}/type-properties/${currentPropertyType.id}`,
186
+ {
187
+ method: 'DELETE',
188
+ headers: {
189
+ 'Accept': 'application/json',
190
+ 'Content-Type': 'application/json',
191
+ },
192
+ });
193
+ }
194
+ } catch (err) {
195
+ throw new Error(`Error Deleting Properties: ${err}`);
196
+ }
197
+ }
198
+ }
@@ -1,38 +1,38 @@
1
- async function execute(config, event, Functions) {
2
- const getBodyFromEvent = (config, event) => {
3
- let body = Functions.StringUtil.parseVariables(config.message, event);
4
- console.log('body: ', body);
5
- if (config.sendDetails) {
6
- const data = event;
7
- const properties = {};
8
- let addedProperty = false;
9
- for (const property of config.fieldsToForward) {
10
- const variableLevels = property.split('.');
11
- let replacementValue = data;
12
- for (let i = 0; i < variableLevels.length; i++) {
13
- replacementValue = replacementValue[variableLevels[i]];
14
- }
15
- properties[property] = replacementValue;
16
- addedProperty = true;
17
- }
18
- if (addedProperty) {
19
- body = body + ' Properties: ' + JSON.stringify(properties) + '.';
20
- }
21
- }
22
- return JSON.stringify({ text: body });
23
- };
24
- const body = getBodyFromEvent(config, event);
25
- console.log('Sending message: ', body);
26
- const response = await Functions.fetch(config.url, {
27
- method: 'POST',
28
- body: body,
29
- headers: { 'Content-Type': 'application/json' }
30
- });
31
- if (!response.ok) {
32
- console.log('Webhook event failed to publish');
33
- console.log('Response: ', JSON.stringify(response));
34
- }
35
- else {
36
- console.log('Published!');
37
- }
1
+ async function execute(config, event, Functions) {
2
+ const getBodyFromEvent = (config, event) => {
3
+ let body = Functions.stringUtil.parseVariables(config.message, event);
4
+ console.log('body: ', body);
5
+ if (config.sendDetails) {
6
+ const data = event;
7
+ const properties = {};
8
+ let addedProperty = false;
9
+ for (const property of config.fieldsToForward) {
10
+ const variableLevels = property.split('.');
11
+ let replacementValue = data;
12
+ for (let i = 0; i < variableLevels.length; i++) {
13
+ replacementValue = replacementValue[variableLevels[i]];
14
+ }
15
+ properties[property] = replacementValue;
16
+ addedProperty = true;
17
+ }
18
+ if (addedProperty) {
19
+ body = body + ' Properties: ' + JSON.stringify(properties) + '.';
20
+ }
21
+ }
22
+ return JSON.stringify({ text: body });
23
+ };
24
+ const body = getBodyFromEvent(config, event);
25
+ console.log('Sending message: ', body);
26
+ const response = await Functions.fetch(config.url, {
27
+ method: 'POST',
28
+ body: body,
29
+ headers: { 'Content-Type': 'application/json' }
30
+ });
31
+ if (!response.ok) {
32
+ console.log('Webhook event failed to publish');
33
+ console.log('Response: ', JSON.stringify(response));
34
+ }
35
+ else {
36
+ console.log('Published!');
37
+ }
38
38
  }
@@ -1,42 +1,54 @@
1
- appIdentifier: "@your-co/app-name"
2
- appName: "Your App Name"
3
- appDescription: "Your app description."
4
- visibility: public
5
- publisher: "Your company name"
6
- version: 1.0
7
-
8
- appConfiguration:
9
- apiHost:
10
- label: "API Host"
11
- propertyType: "string"
12
- userName:
13
- label: "User Name"
14
- propertyType: "string"
15
- password:
16
- label: "Password"
17
- propertyType: "string"
18
-
19
- actions:
20
- updateProduct:
21
- handler: actions/example/action.js
22
- name: "Update Product"
23
- description: "Updates a product in the destination system."
24
-
25
- triggers:
26
- trigger1:
27
- key: product|create
28
- name: "Produt Created"
29
-
30
- workflows:
31
- workflow1:
32
- name: "Update item on product creation"
33
- triggerKey: product|create
34
- paths:
35
- path1:
36
- conditional: "{retailPrice} > 10"
37
- actions:
38
- updateItem:
39
- actionId: updateItem
40
- configuration:
41
-
42
-
1
+ appIdentifier: "@your-co/app-name"
2
+ appName: "Your App Name"
3
+ appDescription: "Your app description."
4
+ visibility: public
5
+ publisher: "Your company name"
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
+ appConfiguration:
14
+ apiHost:
15
+ label: "API Host"
16
+ propertyType: "string"
17
+ userName:
18
+ label: "User Name"
19
+ propertyType: "string"
20
+ password:
21
+ label: "Password"
22
+ propertyType: "string"
23
+
24
+ actions:
25
+ updateProduct:
26
+ handler: actions/example/action.js
27
+ name: "Update Product"
28
+ description: "Updates a product in the destination system."
29
+ actionConfiguration:
30
+ email:
31
+ label: "Email Address"
32
+ propertyType: "string"
33
+
34
+ triggers:
35
+ trigger1:
36
+ key: product|create
37
+ name: "External Product Created"
38
+ external: true
39
+ description: "Triggers on externally created products"
40
+
41
+ # TODO - This is not read
42
+ workflows:
43
+ workflow1:
44
+ name: "Update item on product creation"
45
+ triggerKey: product|create
46
+ paths:
47
+ path1:
48
+ conditional: "{retailPrice} > 10"
49
+ actions:
50
+ updateItem:
51
+ actionId: updateItem
52
+ configuration:
53
+
54
+
@@ -1,23 +1,23 @@
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
- "test": "echo \"Error: no test specified\" && exit 1"
15
- },
16
- "keywords": [
17
- ],
18
- "author": "",
19
- "license": "ISC",
20
- "dependencies": {
21
- "chalk": "^4.0.0"
22
- }
23
- }
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
+ "test": "echo \"Error: no test specified\" && exit 1"
15
+ },
16
+ "keywords": [
17
+ ],
18
+ "author": "",
19
+ "license": "ISC",
20
+ "dependencies": {
21
+ "chalk": "^4.0.0"
22
+ }
23
+ }