@contrail/cli 2.4.0 → 3.0.1
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.
- package/README.md +550 -196
- package/dist/auth/login.d.ts +1 -0
- package/dist/auth/login.js +119 -48
- package/dist/auth/login.spec.d.ts +1 -0
- package/dist/auth/login.spec.js +10 -0
- package/dist/baseFlags.d.ts +10 -0
- package/dist/baseFlags.js +25 -0
- package/dist/basecommand.d.ts +5 -2
- package/dist/basecommand.js +51 -47
- package/dist/commands/app/create.d.ts +2 -2
- package/dist/commands/app/create.js +1 -1
- package/dist/commands/app/delete.d.ts +4 -0
- package/dist/commands/app/delete.js +3 -0
- package/dist/commands/app/getApiKey.d.ts +2 -0
- package/dist/commands/app/getApiKey.js +3 -3
- package/dist/commands/app/init.d.ts +5 -1
- package/dist/commands/app/init.js +6 -3
- package/dist/commands/app/install.d.ts +1 -1
- package/dist/commands/app/install.js +10 -11
- package/dist/commands/app/publish.d.ts +2 -0
- package/dist/commands/app/publish.js +3 -3
- package/dist/commands/app/uninstall.d.ts +2 -0
- package/dist/commands/app/uninstall.js +5 -5
- package/dist/commands/app/upgrade.d.ts +2 -0
- package/dist/commands/app/upgrade.js +8 -8
- package/dist/commands/app/version/major.d.ts +4 -0
- package/dist/commands/app/version/major.js +3 -0
- package/dist/commands/app/version/minor.d.ts +4 -0
- package/dist/commands/app/version/minor.js +3 -0
- package/dist/commands/app/version/patch.d.ts +4 -0
- package/dist/commands/app/version/patch.js +3 -0
- package/dist/commands/config/create.d.ts +12 -0
- package/dist/commands/config/create.js +27 -0
- package/dist/commands/config/describe.d.ts +14 -0
- package/dist/commands/config/describe.js +46 -0
- package/dist/commands/config/list.d.ts +4 -0
- package/dist/commands/config/list.js +5 -1
- package/dist/commands/config/set.d.ts +3 -2
- package/dist/commands/config/set.js +17 -13
- package/dist/commands/config/use.d.ts +14 -0
- package/dist/commands/config/use.js +47 -0
- package/dist/commands/file/upload.d.ts +15 -0
- package/dist/commands/file/upload.js +69 -0
- package/dist/commands/groups/export.d.ts +2 -0
- package/dist/commands/groups/export.js +2 -2
- package/dist/commands/groups/{upload.d.ts → import.d.ts} +4 -0
- package/dist/commands/groups/{upload.js → import.js} +60 -23
- package/dist/commands/instance/export.d.ts +2 -0
- package/dist/commands/instance/export.js +4 -4
- package/dist/commands/instance/import.d.ts +2 -0
- package/dist/commands/instance/import.js +8 -8
- package/dist/commands/load/colors.d.ts +14 -0
- package/dist/commands/load/colors.js +53 -0
- package/dist/commands/load/custom-entity.d.ts +14 -0
- package/dist/commands/load/custom-entity.js +55 -0
- package/dist/commands/load/line-sheet.d.ts +14 -0
- package/dist/commands/load/line-sheet.js +55 -0
- package/dist/commands/{loader-process → load}/upload-and-load.d.ts +4 -0
- package/dist/commands/{loader-process → load}/upload-and-load.js +6 -4
- package/dist/commands/projects/export.d.ts +4 -1
- package/dist/commands/projects/export.js +4 -3
- package/dist/commands/projects/list.d.ts +4 -0
- package/dist/commands/projects/list.js +3 -0
- package/dist/commands/projects/load.d.ts +4 -0
- package/dist/commands/projects/load.js +5 -3
- package/dist/commands/types/exportOptionSetHierarchies.d.ts +4 -0
- package/dist/commands/types/exportOptionSetHierarchies.js +3 -0
- package/dist/commands/types/getAll.d.ts +9 -27
- package/dist/commands/types/getAll.js +6 -313
- package/dist/commands/types/getOptionSets.d.ts +16 -0
- package/dist/commands/types/getOptionSets.js +171 -0
- package/dist/commands/types/loadAll.d.ts +2 -0
- package/dist/commands/types/loadAll.js +2 -2
- package/dist/commands/types/mergeOptionSets.d.ts +4 -0
- package/dist/commands/types/mergeOptionSets.js +5 -3
- package/dist/commands/types/mergeTypeProperties.d.ts +4 -0
- package/dist/commands/types/mergeTypeProperties.js +11 -9
- package/dist/commands/types/parseOptionSetsHierarchyLocalFile.d.ts +4 -0
- package/dist/commands/types/parseOptionSetsHierarchyLocalFile.js +4 -2
- package/dist/commands/types/parseOptionSetsHierarchyValuesToKeysLocalFile.d.ts +4 -0
- package/dist/commands/types/parseOptionSetsHierarchyValuesToKeysLocalFile.js +4 -2
- package/dist/commands/types/parseOptionSetsLocalFiles.d.ts +2 -0
- package/dist/commands/types/parseOptionSetsLocalFiles.js +4 -4
- package/dist/commands/types/parseOptionSetsToFolderStructure.d.ts +4 -0
- package/dist/commands/types/parseOptionSetsToFolderStructure.js +6 -4
- package/dist/commands/types/parseTypesFromFiles.d.ts +4 -0
- package/dist/commands/types/parseTypesFromFiles.js +4 -2
- package/dist/commands/types/parseTypesFromLocalFiles.d.ts +4 -0
- package/dist/commands/types/parseTypesFromLocalFiles.js +4 -2
- package/dist/commands/types/parseTypesFromTemplateAndDataFromLocalFiles.d.ts +4 -0
- package/dist/commands/types/parseTypesFromTemplateAndDataFromLocalFiles.js +5 -3
- package/dist/commands/types/parseTypesFromTemplateFromLocalFiles.d.ts +4 -0
- package/dist/commands/types/parseTypesFromTemplateFromLocalFiles.js +5 -3
- package/dist/commands/types/uploadOptionSetHierarchies.d.ts +2 -0
- package/dist/commands/types/uploadOptionSetHierarchies.js +2 -2
- package/dist/commands/types/uploadOptionSets.d.ts +2 -0
- package/dist/commands/types/uploadOptionSets.js +2 -2
- package/dist/commands/types/uploadOptionSetsHierarchyLocalFile.d.ts +4 -0
- package/dist/commands/types/uploadOptionSetsHierarchyLocalFile.js +4 -2
- package/dist/commands/types/uploadRuleSets.d.ts +2 -0
- package/dist/commands/types/uploadRuleSets.js +2 -2
- package/dist/commands/types/uploadTypePolicies.d.ts +2 -0
- package/dist/commands/types/uploadTypePolicies.js +2 -2
- package/dist/commands/types/uploadTypePropertyPolicies.d.ts +2 -0
- package/dist/commands/types/uploadTypePropertyPolicies.js +2 -2
- package/dist/commands/types/uploadTypes.d.ts +2 -0
- package/dist/commands/types/uploadTypes.js +2 -2
- package/dist/commands/types/uploadUsageInfo.d.ts +2 -0
- package/dist/commands/types/uploadUsageInfo.js +2 -2
- package/dist/commands/users/export.d.ts +2 -0
- package/dist/commands/users/export.js +2 -2
- package/dist/commands/users/{upload.d.ts → import.d.ts} +4 -0
- package/dist/commands/users/{upload.js → import.js} +4 -2
- package/dist/commands/webhooks/create.d.ts +2 -0
- package/dist/commands/webhooks/create.js +2 -2
- package/dist/commands/webhooks/delete.d.ts +2 -0
- package/dist/commands/webhooks/delete.js +5 -5
- package/dist/commands/webhooks/getWebhookTrigger.d.ts +4 -0
- package/dist/commands/webhooks/getWebhookTrigger.js +6 -4
- package/dist/commands/webhooks/list.d.ts +2 -0
- package/dist/commands/webhooks/list.js +2 -2
- package/dist/commands/workflow-template-definitions/install.d.ts +4 -0
- package/dist/commands/workflow-template-definitions/install.js +3 -0
- package/dist/commands/workflow-template-definitions/list.d.ts +4 -0
- package/dist/commands/workflow-template-definitions/list.js +3 -0
- package/dist/commands/workflow-templates/delete.d.ts +4 -0
- package/dist/commands/workflow-templates/delete.js +3 -0
- package/dist/commands/workflow-templates/export.d.ts +2 -0
- package/dist/commands/workflow-templates/export.js +4 -2
- package/dist/commands/workflow-templates/list.d.ts +4 -0
- package/dist/commands/workflow-templates/list.js +3 -0
- package/dist/commands/workflow-templates/load.d.ts +4 -0
- package/dist/commands/workflow-templates/load.js +4 -2
- package/dist/helpers/app/app-template-parsers.d.ts +1 -1
- package/dist/helpers/app/app-template-parsers.js +3 -4
- package/dist/helpers/config/config.d.ts +12 -2
- package/dist/helpers/config/config.js +158 -16
- package/dist/helpers/file-helpers.d.ts +1 -0
- package/dist/helpers/file-helpers.js +11 -1
- package/dist/helpers/load/helpers.d.ts +20 -0
- package/dist/helpers/load/helpers.js +141 -0
- package/dist/helpers/load/helpers.spec.d.ts +1 -0
- package/dist/helpers/load/helpers.spec.js +62 -0
- package/dist/helpers/load/validators.d.ts +14 -0
- package/dist/helpers/load/validators.js +182 -0
- package/dist/helpers/load/validators.spec.d.ts +1 -0
- package/dist/helpers/load/validators.spec.js +450 -0
- package/dist/helpers/types/type-uploader.js +11 -3
- package/dist/helpers/workflow-template-definitions/workflow-template-definition-deployer.js +1 -1
- package/dist/helpers/workflow-templates/helper.js +0 -4
- package/dist/interfaces.d.ts +1 -0
- package/dist/templates/typescript/app.yml +17 -19
- package/dist/templates/typescript/package.json +14 -0
- package/dist/templates/typescript/src/actions/logItem.ts +1 -2
- package/oclif.manifest.json +1955 -250
- package/package.json +4 -2
- package/dist/commands/colors/deleteAll.d.ts +0 -6
- package/dist/commands/colors/deleteAll.js +0 -31
- package/dist/commands/colors/load.d.ts +0 -6
- package/dist/commands/colors/load.js +0 -30
- package/dist/commands/config/environments/list.d.ts +0 -7
- package/dist/commands/config/environments/list.js +0 -19
- package/dist/commands/config/environments/remove.d.ts +0 -12
- package/dist/commands/config/environments/remove.js +0 -36
- package/dist/commands/config/environments/set.d.ts +0 -12
- package/dist/commands/config/environments/set.js +0 -29
- package/dist/commands/config/remove.d.ts +0 -15
- package/dist/commands/config/remove.js +0 -28
- package/dist/commands/loader-process/load.d.ts +0 -9
- package/dist/commands/loader-process/load.js +0 -39
- package/dist/helpers/loader-process/helpers.d.ts +0 -2
- package/dist/helpers/loader-process/helpers.js +0 -99
|
@@ -0,0 +1,450 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const validators_1 = require("./validators");
|
|
4
|
+
describe('LoadValidators', () => {
|
|
5
|
+
describe('ValidateColorsLoadFile', () => {
|
|
6
|
+
it('should return errors if Federated ID is missing in the config file', () => {
|
|
7
|
+
const colorsData = [{ id: 1, name: 'Red', hex: '#FF0000' }];
|
|
8
|
+
const config = {
|
|
9
|
+
federatedMappings: { name: 'Colors' },
|
|
10
|
+
loadType: ['COLOR'],
|
|
11
|
+
conditionalColumns: [{ toProperty: 'typePath', default: 'color' }],
|
|
12
|
+
};
|
|
13
|
+
const result = validators_1.LoadValidators.ValidateColorsLoadFile(colorsData, config);
|
|
14
|
+
expect(result.errors).toContain('"federatedId" is required in the config file');
|
|
15
|
+
});
|
|
16
|
+
it('should return errors if Name is missing in the config file', () => {
|
|
17
|
+
const colorsData = [{ id: 1, name: 'Red', hex: '#FF0000' }];
|
|
18
|
+
const config = {
|
|
19
|
+
federatedMappings: { federatedId: 'id' },
|
|
20
|
+
loadType: ['COLOR'],
|
|
21
|
+
conditionalColumns: [{ toProperty: 'typePath', default: 'color' }],
|
|
22
|
+
};
|
|
23
|
+
const result = validators_1.LoadValidators.ValidateColorsLoadFile(colorsData, config);
|
|
24
|
+
expect(result.errors).toContain('"name" is required in the config file');
|
|
25
|
+
});
|
|
26
|
+
it('should return errors if Name column is not found in the CSV file', () => {
|
|
27
|
+
const colorsData = [{ id: 1, name: 'Red', hex: '#FF0000' }];
|
|
28
|
+
const config = {
|
|
29
|
+
federatedMappings: { federatedId: 'id', name: 'Colors' },
|
|
30
|
+
loadType: ['COLOR'],
|
|
31
|
+
conditionalColumns: [{ toProperty: 'typePath', default: 'color' }],
|
|
32
|
+
};
|
|
33
|
+
const result = validators_1.LoadValidators.ValidateColorsLoadFile(colorsData, config);
|
|
34
|
+
expect(result.errors).toContain('Name column (Colors) not found in the CSV file');
|
|
35
|
+
});
|
|
36
|
+
it('should return errors if Federated ID is not found in the CSV file', () => {
|
|
37
|
+
const colorsData = [{ Colors: 'Red', hex: '#FF0000' }];
|
|
38
|
+
const config = {
|
|
39
|
+
federatedMappings: { name: 'Colors', federatedId: 'id' },
|
|
40
|
+
loadType: ['COLOR'],
|
|
41
|
+
conditionalColumns: [{ toProperty: 'typePath', default: 'color' }],
|
|
42
|
+
};
|
|
43
|
+
const result = validators_1.LoadValidators.ValidateColorsLoadFile(colorsData, config);
|
|
44
|
+
expect(result.errors).toContain('Federated ID column (id) not found in the CSV file');
|
|
45
|
+
});
|
|
46
|
+
it('should return multiple errors', () => {
|
|
47
|
+
const colorsData = [{ hex: '#FF0000' }];
|
|
48
|
+
const config = {
|
|
49
|
+
federatedMappings: { name: 'Colors', federatedId: 'id' },
|
|
50
|
+
loadType: ['COLOR'],
|
|
51
|
+
conditionalColumns: [{ toProperty: 'typePath', default: 'color' }],
|
|
52
|
+
};
|
|
53
|
+
const result = validators_1.LoadValidators.ValidateColorsLoadFile(colorsData, config);
|
|
54
|
+
expect(result.errors).toContain('Name column (Colors) not found in the CSV file');
|
|
55
|
+
expect(result.errors).toContain('Federated ID column (id) not found in the CSV file');
|
|
56
|
+
});
|
|
57
|
+
it('should return warnings if Hex is ignored when red, green, and blue columns are present', () => {
|
|
58
|
+
const colorsData = [{ id: 1, name: 'Red', red: 255, green: 0, blue: 0, hex: '#FF0000' }];
|
|
59
|
+
const config = {
|
|
60
|
+
loadType: ['COLOR'],
|
|
61
|
+
conditionalColumns: [{ toProperty: 'typePath', default: 'color' }],
|
|
62
|
+
federatedMappings: {
|
|
63
|
+
red: 'red',
|
|
64
|
+
green: 'green',
|
|
65
|
+
blue: 'blue',
|
|
66
|
+
hex: 'hex',
|
|
67
|
+
name: 'Colors',
|
|
68
|
+
federatedId: 'id',
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
const result = validators_1.LoadValidators.ValidateColorsLoadFile(colorsData, config);
|
|
72
|
+
expect(result.warnings).toContain('"Hex" is ignored when red, green, and blue columns are present');
|
|
73
|
+
});
|
|
74
|
+
it('should return empty errors and warnings if all validations pass', () => {
|
|
75
|
+
const colorsData = [{ id: 1, Colors: 'Red', red: 255, green: 0, blue: 0 }];
|
|
76
|
+
const config = {
|
|
77
|
+
loadType: ['COLOR'],
|
|
78
|
+
conditionalColumns: [{ toProperty: 'typePath', default: 'color' }],
|
|
79
|
+
federatedMappings: {
|
|
80
|
+
red: 'red',
|
|
81
|
+
green: 'green',
|
|
82
|
+
blue: 'blue',
|
|
83
|
+
name: 'Colors',
|
|
84
|
+
federatedId: 'id',
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
const result = validators_1.LoadValidators.ValidateColorsLoadFile(colorsData, config);
|
|
88
|
+
expect(result.errors).toEqual([]);
|
|
89
|
+
expect(result.warnings).toEqual([]);
|
|
90
|
+
});
|
|
91
|
+
it('should return error if duplicate federatedId is found', () => {
|
|
92
|
+
const colorsData = [
|
|
93
|
+
{ id: 1, Colors: 'Red', red: 255, green: 0, blue: 0 },
|
|
94
|
+
{ id: 1, Colors: 'Green', red: 0, green: 255, blue: 0 },
|
|
95
|
+
{ id: 2, Colors: 'Blue', red: 0, green: 0, blue: 255 },
|
|
96
|
+
];
|
|
97
|
+
const config = {
|
|
98
|
+
loadType: ['COLOR'],
|
|
99
|
+
conditionalColumns: [{ toProperty: 'typePath', default: 'color' }],
|
|
100
|
+
federatedMappings: {
|
|
101
|
+
red: 'red',
|
|
102
|
+
green: 'green',
|
|
103
|
+
blue: 'blue',
|
|
104
|
+
name: 'Colors',
|
|
105
|
+
federatedId: 'id',
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
const result = validators_1.LoadValidators.ValidateColorsLoadFile(colorsData, config);
|
|
109
|
+
expect(result.errors).toContain('Duplicate FederatedIds found: 1');
|
|
110
|
+
});
|
|
111
|
+
it('should throw error if typePath is present in the csv header but have incorrect typePath', () => {
|
|
112
|
+
const colorsData = [{ name: 'color1', typePath: 'color1' }];
|
|
113
|
+
const config = {
|
|
114
|
+
loadType: ['COLOR'],
|
|
115
|
+
conditionalColumns: [],
|
|
116
|
+
federatedMappings: {
|
|
117
|
+
red: 'red',
|
|
118
|
+
green: 'green',
|
|
119
|
+
blue: 'blue',
|
|
120
|
+
name: 'Colors',
|
|
121
|
+
federatedId: 'id',
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
const result = validators_1.LoadValidators.ValidateColorsLoadFile(colorsData, config);
|
|
125
|
+
expect(result.errors).toContain('"typePath" must be "color" in each row in the csv file');
|
|
126
|
+
});
|
|
127
|
+
it('should not throw error if typepath is present in the csv header and have correct typePath', () => {
|
|
128
|
+
const colorsData = [{ name: 'color1', typePath: 'color' }];
|
|
129
|
+
const config = {
|
|
130
|
+
loadType: ['COLOR'],
|
|
131
|
+
conditionalColumns: [],
|
|
132
|
+
federatedMappings: {
|
|
133
|
+
red: 'red',
|
|
134
|
+
green: 'green',
|
|
135
|
+
blue: 'blue',
|
|
136
|
+
name: 'name',
|
|
137
|
+
federatedId: 'name',
|
|
138
|
+
},
|
|
139
|
+
};
|
|
140
|
+
const result = validators_1.LoadValidators.ValidateColorsLoadFile(colorsData, config);
|
|
141
|
+
expect(result.errors).toHaveLength(0);
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
describe('ValidateCustomEntityLoadFile', () => {
|
|
145
|
+
it('should return error if config is null', () => {
|
|
146
|
+
const customEntityData = [{ id: 1, name: 'Test' }];
|
|
147
|
+
const result = validators_1.LoadValidators.ValidateCustomEntityLoadFile(customEntityData, null);
|
|
148
|
+
expect(result.errors).toContain('Config file is empty');
|
|
149
|
+
});
|
|
150
|
+
it('should return error if loadType is missing in config', () => {
|
|
151
|
+
const customEntityData = [{ id: 1, name: 'Test' }];
|
|
152
|
+
const config = {};
|
|
153
|
+
const result = validators_1.LoadValidators.ValidateCustomEntityLoadFile(customEntityData, config);
|
|
154
|
+
expect(result.errors).toContain('"loadType" is required in the config file');
|
|
155
|
+
});
|
|
156
|
+
it('should return error if loadType is not CUSTOM_ENTITY', () => {
|
|
157
|
+
const customEntityData = [{ id: 1, name: 'Test' }];
|
|
158
|
+
const config = { loadType: ['OTHER_TYPE'] };
|
|
159
|
+
const result = validators_1.LoadValidators.ValidateCustomEntityLoadFile(customEntityData, config);
|
|
160
|
+
expect(result.errors).toContain('"loadType" must be must be single value "CUSTOM_ENTITY" in the config file');
|
|
161
|
+
});
|
|
162
|
+
it('should return error if federatedMappings.federatedId is missing in config', () => {
|
|
163
|
+
const customEntityData = [{ id: 1, name: 'Test' }];
|
|
164
|
+
const config = { loadType: ['CUSTOM_ENTITY'] };
|
|
165
|
+
const result = validators_1.LoadValidators.ValidateCustomEntityLoadFile(customEntityData, config);
|
|
166
|
+
expect(result.errors).toContain('"federatedId" is required in the config file');
|
|
167
|
+
});
|
|
168
|
+
it('should return error if federatedMappings.name is missing in config', () => {
|
|
169
|
+
const customEntityData = [{ id: 1, name: 'Test' }];
|
|
170
|
+
const config = {
|
|
171
|
+
loadType: ['CUSTOM_ENTITY'],
|
|
172
|
+
federatedMappings: { federatedId: 'id' },
|
|
173
|
+
};
|
|
174
|
+
const result = validators_1.LoadValidators.ValidateCustomEntityLoadFile(customEntityData, config);
|
|
175
|
+
expect(result.errors).toContain('"name" is required in the config file');
|
|
176
|
+
});
|
|
177
|
+
it('should return error if federatedId column is missing in CSV', () => {
|
|
178
|
+
const customEntityData = [{ name: 'Test' }];
|
|
179
|
+
const config = {
|
|
180
|
+
loadType: ['CUSTOM_ENTITY'],
|
|
181
|
+
federatedMappings: { federatedId: 'id', name: 'name' },
|
|
182
|
+
conditionalColumns: ['typePath'],
|
|
183
|
+
};
|
|
184
|
+
const result = validators_1.LoadValidators.ValidateCustomEntityLoadFile(customEntityData, config);
|
|
185
|
+
expect(result.errors).toContain('Federated ID column (id) not found in the CSV file');
|
|
186
|
+
});
|
|
187
|
+
it('should return error if conditionalColumns is missing in config', () => {
|
|
188
|
+
const customEntityData = [{ id: 1, name: 'Test' }];
|
|
189
|
+
const config = {
|
|
190
|
+
loadType: ['CUSTOM_ENTITY'],
|
|
191
|
+
federatedMappings: { federatedId: 'id', name: 'name' },
|
|
192
|
+
};
|
|
193
|
+
const result = validators_1.LoadValidators.ValidateCustomEntityLoadFile(customEntityData, config);
|
|
194
|
+
expect(result.errors).toContain('Missing "typePath" column in the csv file or config file');
|
|
195
|
+
});
|
|
196
|
+
it('should return error if name column is missing in CSV', () => {
|
|
197
|
+
const customEntityData = [{ id: 1 }];
|
|
198
|
+
const config = {
|
|
199
|
+
loadType: ['CUSTOM_ENTITY'],
|
|
200
|
+
federatedMappings: { federatedId: 'id', name: 'name' },
|
|
201
|
+
conditionalColumns: ['typePath'],
|
|
202
|
+
};
|
|
203
|
+
const result = validators_1.LoadValidators.ValidateCustomEntityLoadFile(customEntityData, config);
|
|
204
|
+
expect(result.errors).toContain('Name column not found in the CSV file');
|
|
205
|
+
});
|
|
206
|
+
it('should not return errors if all conditions are met', () => {
|
|
207
|
+
const customEntityData = [{ id: 1, name: 'Test' }];
|
|
208
|
+
const config = {
|
|
209
|
+
loadType: ['CUSTOM_ENTITY'],
|
|
210
|
+
federatedMappings: { federatedId: 'id', name: 'name' },
|
|
211
|
+
conditionalColumns: [{ toProperty: 'typePath', default: 'custom-entity:material' }],
|
|
212
|
+
};
|
|
213
|
+
const result = validators_1.LoadValidators.ValidateCustomEntityLoadFile(customEntityData, config);
|
|
214
|
+
expect(result.errors).toHaveLength(0);
|
|
215
|
+
});
|
|
216
|
+
it('should return error if duplicate federatedId is found', () => {
|
|
217
|
+
const customEntityData = [
|
|
218
|
+
{ id: 1, name: 'Test' },
|
|
219
|
+
{ id: 2, name: 'Test2' },
|
|
220
|
+
{ id: 1, name: 'Test3' },
|
|
221
|
+
];
|
|
222
|
+
const config = {
|
|
223
|
+
loadType: ['CUSTOM_ENTITY'],
|
|
224
|
+
federatedMappings: { federatedId: 'id', name: 'name' },
|
|
225
|
+
conditionalColumns: [{ toProperty: 'typePath', default: 'custom-entity' }],
|
|
226
|
+
};
|
|
227
|
+
const result = validators_1.LoadValidators.ValidateCustomEntityLoadFile(customEntityData, config);
|
|
228
|
+
expect(result.errors).toContain('Duplicate FederatedIds found: 1');
|
|
229
|
+
});
|
|
230
|
+
it('should throw error if typepath is present in the csv header but have incorrect typePath', () => {
|
|
231
|
+
const customEntityData = [{ name: 'custom-entity1', typePath: 'custom-entity1' }];
|
|
232
|
+
const config = {
|
|
233
|
+
loadType: ['CUSTOM_ENTITY'],
|
|
234
|
+
federatedMappings: { federatedId: 'name', name: 'name' },
|
|
235
|
+
conditionalColumns: [],
|
|
236
|
+
};
|
|
237
|
+
const result = validators_1.LoadValidators.ValidateCustomEntityLoadFile(customEntityData, config);
|
|
238
|
+
expect(result.errors).toContain('"typePath" must be "custom-entity:<subtypepath>" in each row in the csv file');
|
|
239
|
+
});
|
|
240
|
+
it('should not throw error if typepath is present in the csv header but have correct typePath', () => {
|
|
241
|
+
const customEntityData = [{ name: 'custom-entity1', typePath: 'custom-entity:material' }];
|
|
242
|
+
const config = {
|
|
243
|
+
loadType: ['CUSTOM_ENTITY'],
|
|
244
|
+
federatedMappings: { federatedId: 'name', name: 'name' },
|
|
245
|
+
conditionalColumns: [],
|
|
246
|
+
};
|
|
247
|
+
const result = validators_1.LoadValidators.ValidateCustomEntityLoadFile(customEntityData, config);
|
|
248
|
+
expect(result.errors).toHaveLength(0);
|
|
249
|
+
});
|
|
250
|
+
});
|
|
251
|
+
describe('ValidateLineSheetLoadFile', () => {
|
|
252
|
+
it('should return an error if config is empty', () => {
|
|
253
|
+
const lineSheetData = [{ header1: 'value1' }];
|
|
254
|
+
const config = null;
|
|
255
|
+
const result = validators_1.LoadValidators.ValidateLineSheetLoadFile(lineSheetData, config);
|
|
256
|
+
expect(result.errors).toContain('Config file is empty');
|
|
257
|
+
expect(result.warnings).toHaveLength(0);
|
|
258
|
+
});
|
|
259
|
+
it('should return an error if load type is missing', () => {
|
|
260
|
+
const lineSheetData = [{ header1: 'value1' }];
|
|
261
|
+
const config = { loadType: '', federatedMappings: {} };
|
|
262
|
+
const result = validators_1.LoadValidators.ValidateLineSheetLoadFile(lineSheetData, config);
|
|
263
|
+
expect(result.errors).toContain('"loadType" is required in the config file');
|
|
264
|
+
});
|
|
265
|
+
it('should return an error if load type is invalid', () => {
|
|
266
|
+
const lineSheetData = [{ header1: 'value1' }];
|
|
267
|
+
const config = { loadType: ['INVALID'], federatedMappings: {} };
|
|
268
|
+
const result = validators_1.LoadValidators.ValidateLineSheetLoadFile(lineSheetData, config);
|
|
269
|
+
expect(result.errors).toContain('"loadType" must be either of values ["ITEM", "PROJECT_ITEM", "ASSORTMENT"] in the config file');
|
|
270
|
+
});
|
|
271
|
+
it('should return an error if name is not mapped in federatedMappings', () => {
|
|
272
|
+
const lineSheetData = [{ header1: 'value1' }];
|
|
273
|
+
const config = { loadType: ['ITEM'], federatedMappings: {} };
|
|
274
|
+
const result = validators_1.LoadValidators.ValidateLineSheetLoadFile(lineSheetData, config);
|
|
275
|
+
expect(result.errors).toContain('"name" is required in the config file and must be mapped to Item Family Name');
|
|
276
|
+
});
|
|
277
|
+
it('should return a warning if optionName is not mapped in federatedMappings', () => {
|
|
278
|
+
const lineSheetData = [{ header1: 'value1' }];
|
|
279
|
+
const config = {
|
|
280
|
+
loadType: ['ITEM'],
|
|
281
|
+
federatedMappings: {
|
|
282
|
+
name: 'header1',
|
|
283
|
+
itemFamilyFederatedId: 'someId',
|
|
284
|
+
},
|
|
285
|
+
};
|
|
286
|
+
const result = validators_1.LoadValidators.ValidateLineSheetLoadFile(lineSheetData, config);
|
|
287
|
+
expect(result.warnings).toContain('"optionName" is not mapped in the config file');
|
|
288
|
+
});
|
|
289
|
+
it('should return an error if itemFamilyFederatedId is not mapped in federatedMappings', () => {
|
|
290
|
+
const lineSheetData = [{ header1: 'value1' }];
|
|
291
|
+
const config = {
|
|
292
|
+
loadType: ['ITEM'],
|
|
293
|
+
federatedMappings: {
|
|
294
|
+
name: 'header1',
|
|
295
|
+
},
|
|
296
|
+
};
|
|
297
|
+
const result = validators_1.LoadValidators.ValidateLineSheetLoadFile(lineSheetData, config);
|
|
298
|
+
expect(result.errors).toContain('"itemFamilyFederatedId" is required in the config file');
|
|
299
|
+
});
|
|
300
|
+
it('should return a warning if itemOptionFederatedId is not mapped in federatedMappings', () => {
|
|
301
|
+
const lineSheetData = [{ header1: 'value1' }];
|
|
302
|
+
const config = {
|
|
303
|
+
loadType: ['ITEM'],
|
|
304
|
+
federatedMappings: {
|
|
305
|
+
name: 'header1',
|
|
306
|
+
itemFamilyFederatedId: 'someId',
|
|
307
|
+
},
|
|
308
|
+
};
|
|
309
|
+
const result = validators_1.LoadValidators.ValidateLineSheetLoadFile(lineSheetData, config);
|
|
310
|
+
expect(result.warnings).toContain('"itemOptionFederatedId" is not mapped in the config file');
|
|
311
|
+
});
|
|
312
|
+
it('should return an error if itemFamilyFederatedId is missing in the CSV file', () => {
|
|
313
|
+
const lineSheetData = [{ header1: 'value1', itemFamilyFederatedId: 'someId' }];
|
|
314
|
+
const config = {
|
|
315
|
+
loadType: ['ITEM'],
|
|
316
|
+
federatedMappings: {
|
|
317
|
+
name: 'header1',
|
|
318
|
+
itemFamilyFederatedId: null,
|
|
319
|
+
},
|
|
320
|
+
};
|
|
321
|
+
const result = validators_1.LoadValidators.ValidateLineSheetLoadFile(lineSheetData, config);
|
|
322
|
+
expect(result.errors).toContain(`itemFamilyFederatedId column (${config?.federatedMappings?.itemFamilyFederatedId}) not found in the CSV file`);
|
|
323
|
+
});
|
|
324
|
+
it('should return an error if itemFamilyFederatedId is null or undefined or empty in lineSheetData', () => {
|
|
325
|
+
const lineSheetData = [
|
|
326
|
+
{ header1: 'value1', itemFamilyFederatedId: null },
|
|
327
|
+
{ header1: 'value2', itemFamilyFederatedId: undefined },
|
|
328
|
+
{ header1: 'value3', itemFamilyFederatedId: 'valid' },
|
|
329
|
+
{ header1: 'value4', itemFamilyFederatedId: '' },
|
|
330
|
+
];
|
|
331
|
+
const config = {
|
|
332
|
+
loadType: ['ITEM'],
|
|
333
|
+
federatedMappings: {
|
|
334
|
+
name: 'header1',
|
|
335
|
+
itemFamilyFederatedId: 'itemFamilyFederatedId',
|
|
336
|
+
},
|
|
337
|
+
};
|
|
338
|
+
const result = validators_1.LoadValidators.ValidateLineSheetLoadFile(lineSheetData, config);
|
|
339
|
+
expect(result.errors).toContain('some rows contain itemFamilyFederatedId is null or undefined or empty in the CSV file (rows 0,1,3)');
|
|
340
|
+
});
|
|
341
|
+
it('should return errors if duplicate itemFamilyFederatedId is found in lineSheetData', () => {
|
|
342
|
+
const lineSheetData = [
|
|
343
|
+
{
|
|
344
|
+
header1: 'value1',
|
|
345
|
+
itemFamilyFederatedId: '1',
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
header1: 'value2',
|
|
349
|
+
itemFamilyFederatedId: '1',
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
header1: 'value3',
|
|
353
|
+
itemFamilyFederatedId: '2',
|
|
354
|
+
},
|
|
355
|
+
];
|
|
356
|
+
const config = {
|
|
357
|
+
loadType: ['ITEM'],
|
|
358
|
+
federatedMappings: {
|
|
359
|
+
name: 'header1',
|
|
360
|
+
itemFamilyFederatedId: 'itemFamilyFederatedId',
|
|
361
|
+
},
|
|
362
|
+
};
|
|
363
|
+
const result = validators_1.LoadValidators.ValidateLineSheetLoadFile(lineSheetData, config);
|
|
364
|
+
expect(result.errors).toContain('Found conflicting fields for family federated Ids: (1: (value1, value2))');
|
|
365
|
+
});
|
|
366
|
+
it('should allow for the same itemFamilyFederatedId if the names are the same', () => {
|
|
367
|
+
const lineSheetData = [
|
|
368
|
+
{
|
|
369
|
+
itemName: 'foo',
|
|
370
|
+
itemFamilyFederatedId: '1',
|
|
371
|
+
},
|
|
372
|
+
{
|
|
373
|
+
itemName: 'foo',
|
|
374
|
+
itemFamilyFederatedId: '1',
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
itemName: 'bar',
|
|
378
|
+
itemFamilyFederatedId: '2',
|
|
379
|
+
},
|
|
380
|
+
];
|
|
381
|
+
const config = {
|
|
382
|
+
loadType: ['ITEM'],
|
|
383
|
+
federatedMappings: {
|
|
384
|
+
name: 'itemName',
|
|
385
|
+
itemFamilyFederatedId: 'itemFamilyFederatedId',
|
|
386
|
+
},
|
|
387
|
+
};
|
|
388
|
+
const result = validators_1.LoadValidators.ValidateLineSheetLoadFile(lineSheetData, config);
|
|
389
|
+
expect(result.errors.length).toBe(0);
|
|
390
|
+
});
|
|
391
|
+
it('should find error if itemFamilyFederatedId is duplicated across different names', () => {
|
|
392
|
+
const lineSheetData = [
|
|
393
|
+
{
|
|
394
|
+
itemName: 'foo',
|
|
395
|
+
itemFamilyFederatedId: '1',
|
|
396
|
+
},
|
|
397
|
+
{
|
|
398
|
+
itemName: 'bar',
|
|
399
|
+
itemFamilyFederatedId: '1',
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
itemName: 'baz',
|
|
403
|
+
itemFamilyFederatedId: '2',
|
|
404
|
+
},
|
|
405
|
+
];
|
|
406
|
+
const config = {
|
|
407
|
+
loadType: ['ITEM'],
|
|
408
|
+
federatedMappings: {
|
|
409
|
+
name: 'itemName',
|
|
410
|
+
itemFamilyFederatedId: 'itemFamilyFederatedId',
|
|
411
|
+
},
|
|
412
|
+
};
|
|
413
|
+
const result = validators_1.LoadValidators.ValidateLineSheetLoadFile(lineSheetData, config);
|
|
414
|
+
expect(result.errors).toContain('Found conflicting fields for family federated Ids: (1: (foo, bar))');
|
|
415
|
+
});
|
|
416
|
+
it('should return warnings if duplicate itemOptionFederatedId is found in lineSheetData', () => {
|
|
417
|
+
const lineSheetData = [
|
|
418
|
+
{
|
|
419
|
+
header1: 'value1',
|
|
420
|
+
itemFamilyFederatedId: '1',
|
|
421
|
+
itemOptionFederatedId: '1',
|
|
422
|
+
optionName: 'option1',
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
header1: 'value2',
|
|
426
|
+
itemFamilyFederatedId: '2',
|
|
427
|
+
itemOptionFederatedId: '1',
|
|
428
|
+
optionName: 'option2',
|
|
429
|
+
},
|
|
430
|
+
{
|
|
431
|
+
header1: 'value3',
|
|
432
|
+
itemFamilyFederatedId: '3',
|
|
433
|
+
itemOptionFederatedId: '2',
|
|
434
|
+
optionName: 'option3',
|
|
435
|
+
},
|
|
436
|
+
];
|
|
437
|
+
const config = {
|
|
438
|
+
loadType: ['ITEM'],
|
|
439
|
+
federatedMappings: {
|
|
440
|
+
name: 'header1',
|
|
441
|
+
itemFamilyFederatedId: 'itemFamilyFederatedId',
|
|
442
|
+
itemOptionFederatedId: 'itemOptionFederatedId',
|
|
443
|
+
optionName: 'optionName',
|
|
444
|
+
},
|
|
445
|
+
};
|
|
446
|
+
const result = validators_1.LoadValidators.ValidateLineSheetLoadFile(lineSheetData, config);
|
|
447
|
+
expect(result.errors).toContain('Duplicate itemOptionFederatedId found: 1');
|
|
448
|
+
});
|
|
449
|
+
});
|
|
450
|
+
});
|
|
@@ -13,7 +13,7 @@ const logger_1 = tslib_1.__importDefault(require("../../logger"));
|
|
|
13
13
|
async function uploadTypes(dir) {
|
|
14
14
|
try {
|
|
15
15
|
const userConfig = await (0, login_1.authUser)();
|
|
16
|
-
logger_1.default.info(`START Getting all types for
|
|
16
|
+
logger_1.default.info(`START Getting all types for org ${userConfig.orgSlug}`);
|
|
17
17
|
logger_1.default.info('TYPES Uploading ');
|
|
18
18
|
await uploadReducedTypes(dir);
|
|
19
19
|
logger_1.default.info(`${chalk_1.default.yellow.bold('TYPES')} Uploaded`);
|
|
@@ -149,8 +149,16 @@ async function uploadReducedTypeProperties(type, currentPropertyTypes, newProper
|
|
|
149
149
|
for (const optionSet of optionSets) {
|
|
150
150
|
optionSetIdBySlug[optionSet.slug] = optionSet.id;
|
|
151
151
|
}
|
|
152
|
+
const sets = await new sdk_1.Entities().get({ entityName: 'user-list' });
|
|
152
153
|
for (const newPropertyType of newPropertyTypes) {
|
|
154
|
+
let typePropertyUserListId = null;
|
|
153
155
|
try {
|
|
156
|
+
if (newPropertyType.typePropertyUserListName) {
|
|
157
|
+
const userList = sets.find((s) => s.name === newPropertyType.typePropertyUserListName);
|
|
158
|
+
if (userList) {
|
|
159
|
+
typePropertyUserListId = userList.id;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
154
162
|
const found = currentPropertyTypeBySlug[newPropertyType.slug];
|
|
155
163
|
if (!found) {
|
|
156
164
|
logger_1.default.info(`Creating Type-Property: ${newPropertyType.slug}`);
|
|
@@ -171,7 +179,7 @@ async function uploadReducedTypeProperties(type, currentPropertyTypes, newProper
|
|
|
171
179
|
carryOverDefault: newPropertyType.carryOverDefault,
|
|
172
180
|
referencedTypeRootSlug: newPropertyType.referencedTypeRootSlug,
|
|
173
181
|
defaultValue: newPropertyType.defaultValue,
|
|
174
|
-
typePropertyUserListId
|
|
182
|
+
typePropertyUserListId,
|
|
175
183
|
referencedTypeRole: newPropertyType.referencedTypeRole,
|
|
176
184
|
isUniqueProperty: newPropertyType.isUniqueProperty,
|
|
177
185
|
isUniquePropertyInFamily: newPropertyType.isUniquePropertyInFamily,
|
|
@@ -207,7 +215,7 @@ async function uploadReducedTypeProperties(type, currentPropertyTypes, newProper
|
|
|
207
215
|
referencedTypeRootSlug: newPropertyType.referencedTypeRootSlug ?? null,
|
|
208
216
|
defaultValue: newPropertyType.defaultValue ?? null,
|
|
209
217
|
propertyLevel: newPropertyType.propertyLevel ?? null,
|
|
210
|
-
typePropertyUserListId
|
|
218
|
+
typePropertyUserListId,
|
|
211
219
|
referencedTypeRole: newPropertyType.referencedTypeRole ?? null,
|
|
212
220
|
isUniqueProperty: newPropertyType.isUniqueProperty ?? null,
|
|
213
221
|
isUniquePropertyInFamily: newPropertyType.isUniquePropertyInFamily ?? null,
|
|
@@ -44,8 +44,6 @@ class LocalWorkflowTemplateDeployer {
|
|
|
44
44
|
isActive: workflowTemplate.isActive,
|
|
45
45
|
supportingAppId: workflowTemplate.supportingAppId,
|
|
46
46
|
messageGroupId: workflowTemplate.messageGroupId,
|
|
47
|
-
messageGroup: workflowTemplate.messageGroup,
|
|
48
|
-
dynamicMessageGroupId: workflowTemplate.dynamicMessageGroupId,
|
|
49
47
|
parallelWorkerCount: workflowTemplate.parallelWorkerCount,
|
|
50
48
|
};
|
|
51
49
|
const newWorkflowTemplate = await (0, event_workflow_templates_1.createWorkflowTemplate)(newObject);
|
|
@@ -160,8 +158,6 @@ class LocalWorkflowTemplateDeployer {
|
|
|
160
158
|
triggerKey: workflowTemplate.triggerKey,
|
|
161
159
|
builtIn: workflowTemplate.builtIn,
|
|
162
160
|
workflowDefinition: workflowTemplate.workflowDefinition,
|
|
163
|
-
messageGroupId: workflowTemplate.messageGroupId ?? existingWorkflowTemplate.messageGroupId,
|
|
164
|
-
messageGroup: workflowTemplate.messageGroup ?? existingWorkflowTemplate.messageGroup,
|
|
165
161
|
dynamicMessageGroupId: workflowTemplate.dynamicMessageGroupId ?? existingWorkflowTemplate.dynamicMessageGroupId,
|
|
166
162
|
parallelWorkerCount: workflowTemplate.parallelWorkerCount ?? existingWorkflowTemplate.parallelWorkerCount,
|
|
167
163
|
});
|
package/dist/interfaces.d.ts
CHANGED
|
@@ -355,6 +355,7 @@ export interface ReducedTypeProperty {
|
|
|
355
355
|
referencedTypePath: string;
|
|
356
356
|
referencedTypeRole: string;
|
|
357
357
|
typePropertyUserListId: string;
|
|
358
|
+
typePropertyUserListName?: string;
|
|
358
359
|
isUniqueProperty: boolean;
|
|
359
360
|
isUniquePropertyInFamily: boolean;
|
|
360
361
|
referencedTypeRootSlug: string;
|
|
@@ -1,60 +1,58 @@
|
|
|
1
|
-
appIdentifier:
|
|
2
|
-
appName:
|
|
3
|
-
appDescription:
|
|
4
|
-
visibility: private
|
|
1
|
+
appIdentifier: 'APP_IDENTIFIER_STUB' # Change to be your company root domain and the name of the app
|
|
2
|
+
appName: 'APP_NAME_STUB' # Give your app a name
|
|
3
|
+
appDescription: 'APP_DESCRIPTION_STUB' # Give your app a description
|
|
4
|
+
visibility: private # This should be private unless you want to develop an app for all VibeIQ customers to use
|
|
5
5
|
# Access Grants
|
|
6
6
|
# Use this section to share this app with other organizations.
|
|
7
7
|
# accessGrants:
|
|
8
8
|
# - orgSlug: "ORG_SLUG"
|
|
9
9
|
# permissions:
|
|
10
10
|
# - install
|
|
11
|
-
publisher:
|
|
12
|
-
version:
|
|
11
|
+
publisher: 'APP_PUBLISHER_STUB' # Your company name, used for public apps
|
|
12
|
+
version: '1.0.0'
|
|
13
13
|
|
|
14
14
|
# Properties you can configure when you install the app.
|
|
15
15
|
# These property values will be available to all of your actions when they run
|
|
16
16
|
appConfiguration:
|
|
17
17
|
apiHost:
|
|
18
|
-
label:
|
|
19
|
-
propertyType:
|
|
20
|
-
|
|
18
|
+
label: 'API Host'
|
|
19
|
+
propertyType: 'string'
|
|
21
20
|
|
|
22
21
|
# Action declarations. You define actions here. The 'slug' for the action
|
|
23
22
|
# should match the name of a 'handler' in the /actions folder.
|
|
24
23
|
# See documentation on how to implement actions.
|
|
25
24
|
actions:
|
|
26
25
|
logItem:
|
|
27
|
-
name:
|
|
28
|
-
description:
|
|
26
|
+
name: 'Log Item'
|
|
27
|
+
description: 'Fetches an item from the API and returns it to the log.'
|
|
29
28
|
async: false
|
|
30
29
|
actionConfiguration:
|
|
31
30
|
message:
|
|
32
|
-
label:
|
|
33
|
-
propertyType:
|
|
31
|
+
label: 'Additional message to log.'
|
|
32
|
+
propertyType: 'string'
|
|
34
33
|
|
|
35
34
|
workflows:
|
|
36
35
|
logItemUpdate:
|
|
37
|
-
identifier:
|
|
38
|
-
name:
|
|
36
|
+
identifier: 'logItemUpdate'
|
|
37
|
+
name: 'Item Update -> Log'
|
|
39
38
|
triggerKey: item|update
|
|
40
39
|
isActive: true
|
|
41
40
|
public: true
|
|
42
|
-
parallelWorkerCount: 5
|
|
41
|
+
parallelWorkerCount: 5 # The maximum number of concurrent jobs to run for this workflow (Range 1-30). Defaults to 5
|
|
43
42
|
messageGroupId: # Optional. Used to group jobs in a specific queue. Allows multiple workflows to use the same queue. Not to be used with dynamicMessageGroupId
|
|
44
43
|
messageGroup: # Optional. Used with dynamicMessageGroupId to allow for dynamic queue assignment and allows for multiple workflows to use the same queue
|
|
45
44
|
dynamicMessageGroupId: # Optional. Allows for dynamic queue assignment based on the event data. Example usage: 'family-queue-{newData.itemFamilyId}'
|
|
46
45
|
workflowDefinition:
|
|
47
46
|
paths:
|
|
48
|
-
- conditional:
|
|
47
|
+
- conditional: 'true'
|
|
49
48
|
actionDefinitionConfigs:
|
|
50
49
|
- action: logItem
|
|
51
50
|
name: Log Item
|
|
52
51
|
|
|
53
|
-
|
|
54
52
|
# This is an advanced feature that can 'derive' a trigger key for external events.
|
|
55
53
|
# External events are events sent to the VibeIQ API's /external-events end point from another system
|
|
56
54
|
# Here, you can define a string based on properties from the event payloads (which are custom to your payload)
|
|
57
55
|
# i.e. an event {details: {eventType: 'apparel'}, actionType: 'create'} can be parsed to apparel|create with the following
|
|
58
56
|
# When this is defined, any event coming from your app's credentials will define a trigger key using this logic.
|
|
59
57
|
# You can then define workflows to run based on those external events, based on this trigger key definition.
|
|
60
|
-
eventWorkflowTriggerKeyMapping:
|
|
58
|
+
eventWorkflowTriggerKeyMapping: '{details.eventType}|{actionType}'
|
|
@@ -28,6 +28,20 @@
|
|
|
28
28
|
"chalk": "^4.0.0",
|
|
29
29
|
"js-yaml": "^4.1.0"
|
|
30
30
|
},
|
|
31
|
+
"jest": {
|
|
32
|
+
"moduleFileExtensions": [
|
|
33
|
+
"js",
|
|
34
|
+
"json",
|
|
35
|
+
"ts"
|
|
36
|
+
],
|
|
37
|
+
"rootDir": "",
|
|
38
|
+
"testRegex": ".spec.ts$",
|
|
39
|
+
"transform": {
|
|
40
|
+
"^.+\\.(t|j)s$": "ts-jest"
|
|
41
|
+
},
|
|
42
|
+
"coverageDirectory": "../coverage",
|
|
43
|
+
"testEnvironment": "node"
|
|
44
|
+
},
|
|
31
45
|
"devDependencies": {
|
|
32
46
|
"@types/node": "^18.14.6",
|
|
33
47
|
"body-parser": "^1.20.2",
|
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
AppAction,
|
|
5
5
|
AppActionCallBack,
|
|
6
6
|
AppActionCallbackStatus,
|
|
7
|
-
Logger,
|
|
8
7
|
} from '@contrail/app-framework';
|
|
9
8
|
|
|
10
9
|
export class LogItemAction implements AppAction {
|
|
@@ -17,7 +16,7 @@ export class LogItemAction implements AppAction {
|
|
|
17
16
|
entityName: 'item',
|
|
18
17
|
id: event.id,
|
|
19
18
|
});
|
|
20
|
-
console.log('Got item: ',
|
|
19
|
+
console.log('Got item: ', item);
|
|
21
20
|
|
|
22
21
|
return {
|
|
23
22
|
output: {
|