mcdev 7.0.1 → 7.0.3
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/.github/ISSUE_TEMPLATE/bug.yml +2 -0
- package/.github/workflows/coverage-base-update.yml +2 -2
- package/.github/workflows/coverage.yml +1 -1
- package/@types/lib/index.d.ts.map +1 -1
- package/@types/lib/metadataTypes/Asset.d.ts +11 -10
- package/@types/lib/metadataTypes/Asset.d.ts.map +1 -1
- package/@types/lib/metadataTypes/Automation.d.ts +0 -6
- package/@types/lib/metadataTypes/Automation.d.ts.map +1 -1
- package/@types/lib/metadataTypes/DataExtension.d.ts.map +1 -1
- package/@types/lib/metadataTypes/Folder.d.ts +1 -0
- package/@types/lib/metadataTypes/Folder.d.ts.map +1 -1
- package/@types/lib/metadataTypes/Journey.d.ts +14 -8
- package/@types/lib/metadataTypes/Journey.d.ts.map +1 -1
- package/@types/lib/metadataTypes/MetadataType.d.ts +2 -2
- package/@types/lib/metadataTypes/MetadataType.d.ts.map +1 -1
- package/@types/lib/metadataTypes/definitions/Folder.definition.d.ts +1 -0
- package/@types/lib/util/init.config.d.ts +20 -4
- package/@types/lib/util/init.config.d.ts.map +1 -1
- package/@types/lib/util/init.npm.d.ts.map +1 -1
- package/@types/lib/util/replaceContentBlockReference.d.ts +7 -6
- package/@types/lib/util/replaceContentBlockReference.d.ts.map +1 -1
- package/boilerplate/files/eslint.config.js +82 -0
- package/boilerplate/forcedUpdates.json +5 -0
- package/boilerplate/npm-dependencies.json +2 -0
- package/eslint.config.js +143 -0
- package/lib/index.js +5 -2
- package/lib/metadataTypes/Asset.js +11 -5
- package/lib/metadataTypes/Automation.js +27 -46
- package/lib/metadataTypes/DataExtension.js +9 -7
- package/lib/metadataTypes/Folder.js +33 -20
- package/lib/metadataTypes/Journey.js +2 -5
- package/lib/metadataTypes/MetadataType.js +6 -1
- package/lib/metadataTypes/definitions/Automation.definition.js +1 -0
- package/lib/metadataTypes/definitions/Folder.definition.js +2 -0
- package/lib/util/init.config.js +79 -32
- package/lib/util/init.npm.js +8 -0
- package/lib/util/replaceContentBlockReference.js +2 -2
- package/package.json +8 -6
- package/test/mockRoot/.mcdevrc.json +1 -1
- package/test/resources/9999999/automation/create-callout-expected.json +66 -0
- package/test/resources/9999999/automation/update-callout-expected.json +68 -0
- package/test/resources/9999999/automation/v1/automations/08afb0e2-b00a-4c88-ad2e-1f7f8788c560/get-response.json +7 -7
- package/test/type.automation.test.js +46 -0
- package/test/utils.js +28 -3
- package/.eslintignore +0 -3
- package/.eslintrc.json +0 -116
- package/boilerplate/files/.eslintignore +0 -5
- package/boilerplate/files/.eslintrc +0 -37
package/lib/util/init.config.js
CHANGED
|
@@ -240,7 +240,9 @@ const Init = {
|
|
|
240
240
|
const creationLog = [];
|
|
241
241
|
await File.ensureDir('deploy/');
|
|
242
242
|
await File.ensureDir('src/cloudPages');
|
|
243
|
-
const
|
|
243
|
+
const relevantForced = await this._getForcedUpdateList(versionBeforeUpgrade);
|
|
244
|
+
|
|
245
|
+
await this._removeIdeConfigFiles(relevantForced);
|
|
244
246
|
|
|
245
247
|
// copy in .gitignore (cant be retrieved via npm install directly)
|
|
246
248
|
const gitignoreFileName = path.resolve(
|
|
@@ -253,7 +255,7 @@ const Init = {
|
|
|
253
255
|
creationLog.push(
|
|
254
256
|
await this._createIdeConfigFile(
|
|
255
257
|
['.' + path.sep, '', '.gitignore'],
|
|
256
|
-
|
|
258
|
+
relevantForced,
|
|
257
259
|
fileContent
|
|
258
260
|
)
|
|
259
261
|
);
|
|
@@ -280,7 +282,7 @@ const Init = {
|
|
|
280
282
|
creationLog.push(
|
|
281
283
|
await this._createIdeConfigFile(
|
|
282
284
|
[subdir + path.sep, fileArr.join('.'), ext],
|
|
283
|
-
|
|
285
|
+
relevantForced
|
|
284
286
|
)
|
|
285
287
|
);
|
|
286
288
|
}
|
|
@@ -328,12 +330,13 @@ const Init = {
|
|
|
328
330
|
* returns list of files that need to be updated
|
|
329
331
|
*
|
|
330
332
|
* @param {string} projectVersion version found in config file of the current project
|
|
331
|
-
* @returns {Promise.<string[]>} relevant files with path that need to be updated
|
|
333
|
+
* @returns {Promise.<{updates:string[],deletes:string[]}>} relevant files with path that need to be updated
|
|
332
334
|
*/
|
|
333
335
|
async _getForcedUpdateList(projectVersion) {
|
|
334
336
|
// list of files that absolutely need to get overwritten, no questions asked, when upgrading from a version lower than the given.
|
|
335
337
|
let forceIdeConfigUpdate;
|
|
336
|
-
const
|
|
338
|
+
const updates = [];
|
|
339
|
+
const deletes = [];
|
|
337
340
|
if (await File.pathExists(Util.configFileName)) {
|
|
338
341
|
forceIdeConfigUpdate = await File.readJSON(
|
|
339
342
|
path.resolve(__dirname, Util.boilerplateDirectory, 'forcedUpdates.json')
|
|
@@ -341,27 +344,33 @@ const Init = {
|
|
|
341
344
|
// return all if no project version was found or only changes from "newer" versions otherwise
|
|
342
345
|
for (const element of forceIdeConfigUpdate) {
|
|
343
346
|
if (!projectVersion || semver.gt(element.version, projectVersion)) {
|
|
344
|
-
|
|
347
|
+
updates.push(
|
|
345
348
|
// adapt it for local file systems
|
|
346
349
|
...element.files.map((item) => path.normalize(item))
|
|
347
350
|
);
|
|
351
|
+
if (element.filesRemove) {
|
|
352
|
+
deletes.push(
|
|
353
|
+
// adapt it for local file systems
|
|
354
|
+
...element.filesRemove.map((item) => path.normalize(item))
|
|
355
|
+
);
|
|
356
|
+
}
|
|
348
357
|
} else {
|
|
349
358
|
continue;
|
|
350
359
|
}
|
|
351
360
|
}
|
|
352
361
|
}
|
|
353
362
|
|
|
354
|
-
return
|
|
363
|
+
return { updates, deletes };
|
|
355
364
|
},
|
|
356
365
|
/**
|
|
357
366
|
* handles creation/update of one config file from the boilerplate at a time
|
|
358
367
|
*
|
|
359
368
|
* @param {string[]} fileNameArr 0: path, 1: filename, 2: extension with dot
|
|
360
|
-
* @param {string[]}
|
|
369
|
+
* @param {{updates:string[],deletes:string[]}} relevantForced if fileNameArr is in this list we require an override
|
|
361
370
|
* @param {string} [boilerplateFileContent] in case we cannot copy files 1:1 this can be used to pass in content
|
|
362
371
|
* @returns {Promise.<boolean>} install successful or error occured
|
|
363
372
|
*/
|
|
364
|
-
async _createIdeConfigFile(fileNameArr,
|
|
373
|
+
async _createIdeConfigFile(fileNameArr, relevantForced, boilerplateFileContent) {
|
|
365
374
|
let update = false;
|
|
366
375
|
const fileName = fileNameArr.join('');
|
|
367
376
|
const boilerplateFileName = path.resolve(
|
|
@@ -372,16 +381,27 @@ const Init = {
|
|
|
372
381
|
);
|
|
373
382
|
boilerplateFileContent ||= await File.readFile(boilerplateFileName, 'utf8');
|
|
374
383
|
|
|
384
|
+
let todo = null;
|
|
385
|
+
|
|
375
386
|
if (await File.pathExists(fileName)) {
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
387
|
+
if (relevantForced.deletes.includes(path.normalize(fileName))) {
|
|
388
|
+
Util.logger.info(
|
|
389
|
+
`- ✋ ${fileName} found but it is required to delete it. Commencing rename instead for your convenience:`
|
|
390
|
+
);
|
|
391
|
+
todo = 'delete';
|
|
392
|
+
} else {
|
|
393
|
+
const existingFileContent = await File.readFile(fileName, 'utf8');
|
|
394
|
+
if (existingFileContent === boilerplateFileContent) {
|
|
395
|
+
Util.logger.info(`- ✔️ ${fileName} found. No update needed`);
|
|
396
|
+
return true;
|
|
397
|
+
}
|
|
380
398
|
}
|
|
381
|
-
|
|
399
|
+
|
|
400
|
+
if (relevantForced.updates.includes(path.normalize(fileName))) {
|
|
382
401
|
Util.logger.info(
|
|
383
402
|
`- ✋ ${fileName} found but an update is required. Commencing with override:`
|
|
384
403
|
);
|
|
404
|
+
todo = 'update';
|
|
385
405
|
} else {
|
|
386
406
|
Util.logger.info(
|
|
387
407
|
`- ✋ ${fileName} found with differences to the new standard version. We recommend updating it.`
|
|
@@ -400,33 +420,60 @@ const Init = {
|
|
|
400
420
|
return true;
|
|
401
421
|
}
|
|
402
422
|
}
|
|
423
|
+
update = true;
|
|
403
424
|
}
|
|
404
|
-
update = true;
|
|
405
425
|
|
|
406
426
|
// ensure our update is not leading to data loss in case config files were not versioned correctly by the user
|
|
407
427
|
await File.rename(fileName, fileName + '.BAK');
|
|
428
|
+
} else if (!relevantForced.deletes.includes(path.normalize(fileName))) {
|
|
429
|
+
todo = 'create';
|
|
408
430
|
}
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
if (saveStatus) {
|
|
417
|
-
Util.logger.info(
|
|
418
|
-
`- ✔️ ${fileName} ${
|
|
419
|
-
update
|
|
420
|
-
? `updated (we created a backup of the old file under ${fileName + '.BAK'})`
|
|
421
|
-
: 'created'
|
|
422
|
-
}`
|
|
431
|
+
if (todo === 'create' || todo === 'update') {
|
|
432
|
+
const saveStatus = await File.writeToFile(
|
|
433
|
+
fileNameArr[0],
|
|
434
|
+
fileNameArr[1],
|
|
435
|
+
fileNameArr[2].slice(1),
|
|
436
|
+
boilerplateFileContent
|
|
423
437
|
);
|
|
438
|
+
|
|
439
|
+
if (saveStatus) {
|
|
440
|
+
Util.logger.info(
|
|
441
|
+
`- ✔️ ${fileName} ${
|
|
442
|
+
update
|
|
443
|
+
? `updated (we created a backup of the old file under ${fileName + '.BAK'})`
|
|
444
|
+
: 'created'
|
|
445
|
+
}`
|
|
446
|
+
);
|
|
447
|
+
return true;
|
|
448
|
+
} else {
|
|
449
|
+
Util.logger.warn(`- ❌ ${fileName} ${update ? 'update' : 'creation'} failed`);
|
|
450
|
+
return false;
|
|
451
|
+
}
|
|
452
|
+
} else if (todo === 'delete') {
|
|
453
|
+
await File.rename(fileName, fileName + '.BAK');
|
|
454
|
+
Util.logger.info(`- ✔️ ${fileName} removed (renamed to ${fileName + '.BAK'})`);
|
|
424
455
|
return true;
|
|
425
|
-
} else {
|
|
426
|
-
Util.logger.warn(`- ❌ ${fileName} ${update ? 'update' : 'creation'} failed`);
|
|
427
|
-
return false;
|
|
428
456
|
}
|
|
429
457
|
},
|
|
458
|
+
/**
|
|
459
|
+
* handles deletion of no longer needed config files
|
|
460
|
+
*
|
|
461
|
+
* @param {{updates:string[],deletes:string[]}} relevantForced if file is in .deletes, we require deleting/renaming it
|
|
462
|
+
* @returns {Promise.<boolean>} deletion successful or error occured
|
|
463
|
+
*/
|
|
464
|
+
async _removeIdeConfigFiles(relevantForced) {
|
|
465
|
+
for (const fileName of relevantForced.deletes) {
|
|
466
|
+
if (await File.pathExists(fileName)) {
|
|
467
|
+
Util.logger.info(
|
|
468
|
+
`- ✋ ${fileName} found but it is required to delete it. Commencing rename instead for your convenience:`
|
|
469
|
+
);
|
|
470
|
+
|
|
471
|
+
await File.rename(fileName, fileName + '.BAK');
|
|
472
|
+
Util.logger.info(`- ✔️ ${fileName} removed (renamed to ${fileName + '.BAK'})`);
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
return true;
|
|
476
|
+
},
|
|
430
477
|
/**
|
|
431
478
|
* helper method for this.upgradeProject that upgrades project config if needed
|
|
432
479
|
*
|
package/lib/util/init.npm.js
CHANGED
|
@@ -57,6 +57,8 @@ const Init = {
|
|
|
57
57
|
if (fileContent) {
|
|
58
58
|
projectPackageJson = JSON.parse(fileContent);
|
|
59
59
|
}
|
|
60
|
+
// type="module" is solely required for the new flat configs of ESLint >=9
|
|
61
|
+
Util.execSync('npm', ['pkg', 'set', 'type="module"'], true);
|
|
60
62
|
Util.logger.info('✔️ package.json created');
|
|
61
63
|
} catch {
|
|
62
64
|
Util.logger.error('No package.json found. Please run "npm init" manually');
|
|
@@ -105,6 +107,8 @@ const Init = {
|
|
|
105
107
|
!projectPackageJson.devDependencies ||
|
|
106
108
|
!projectPackageJson.devDependencies[name] ||
|
|
107
109
|
versionsDefault[name] == 'latest' ||
|
|
110
|
+
// filters out file:.. references instead of versions that would otherwise lead to an error in semver.gt()
|
|
111
|
+
!semver.valid(versionsProject[name]) ||
|
|
108
112
|
semver.gt(versionsDefault[name], versionsProject[name])
|
|
109
113
|
);
|
|
110
114
|
if (loadDependencies.length) {
|
|
@@ -152,6 +156,10 @@ const Init = {
|
|
|
152
156
|
if (!currentContent.license || currentContent.license === 'ISC') {
|
|
153
157
|
currentContent.license = 'UNLICENSED';
|
|
154
158
|
}
|
|
159
|
+
if (!currentContent.type || currentContent.type !== 'module') {
|
|
160
|
+
// type="module" is solely required for the new flat configs of ESLint >=9
|
|
161
|
+
currentContent.type = 'module';
|
|
162
|
+
}
|
|
155
163
|
return currentContent;
|
|
156
164
|
},
|
|
157
165
|
};
|
|
@@ -45,7 +45,7 @@ export default class ReplaceContentBlockReference {
|
|
|
45
45
|
key: {},
|
|
46
46
|
name: {},
|
|
47
47
|
};
|
|
48
|
-
/** @type {{id: RegExp[], key: RegExp[], name: RegExp[]}} */
|
|
48
|
+
/** @type {Object.<string, {id: RegExp[], key: RegExp[], name: RegExp[]}>} */
|
|
49
49
|
static #regexBy = {
|
|
50
50
|
// TODO: handle cases in which variables or functions are passed into ContentBlockByX
|
|
51
51
|
|
|
@@ -140,7 +140,6 @@ export default class ReplaceContentBlockReference {
|
|
|
140
140
|
}
|
|
141
141
|
/**
|
|
142
142
|
*
|
|
143
|
-
* @private
|
|
144
143
|
* @param {ContentBlockConversionTypes} from replace with
|
|
145
144
|
* @param {string|number} identifier id, key or name of asset
|
|
146
145
|
* @param {string} parentName name of the object that was passed in; used in error message only
|
|
@@ -250,6 +249,7 @@ saved
|
|
|
250
249
|
const resultAssetShared = await Asset.retrieveForCache(
|
|
251
250
|
undefined,
|
|
252
251
|
['asset', 'code', 'textfile', 'block', 'other'],
|
|
252
|
+
undefined,
|
|
253
253
|
true
|
|
254
254
|
);
|
|
255
255
|
for (const element of Object.values(resultAssetShared.metadata)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcdev",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.3",
|
|
4
4
|
"description": "Accenture Salesforce Marketing Cloud DevTools",
|
|
5
5
|
"author": "Accenture: joern.berkefeld, douglas.midgley, robert.zimmermann, maciej.barnas",
|
|
6
6
|
"license": "MIT",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"beauty-amp-core2": "0.4.9",
|
|
68
68
|
"cli-progress": "3.12.0",
|
|
69
69
|
"command-exists": "1.2.9",
|
|
70
|
-
"conf": "
|
|
70
|
+
"conf": "13.0.1",
|
|
71
71
|
"console.table": "0.10.0",
|
|
72
72
|
"deep-equal": "2.2.3",
|
|
73
73
|
"fs-extra": "11.2.0",
|
|
@@ -86,23 +86,25 @@
|
|
|
86
86
|
"yargs": "17.7.2"
|
|
87
87
|
},
|
|
88
88
|
"devDependencies": {
|
|
89
|
+
"@eslint/js": "9.6.0",
|
|
89
90
|
"@types/mocha": "10.0.6",
|
|
90
|
-
"@types/node": "20.14.
|
|
91
|
+
"@types/node": "20.14.9",
|
|
91
92
|
"assert": "2.1.0",
|
|
92
93
|
"axios-mock-adapter": "1.22.0",
|
|
93
94
|
"c8": "10.0.0",
|
|
94
95
|
"chai": "5.1.1",
|
|
95
96
|
"chai-files": "1.4.0",
|
|
96
|
-
"eslint": "
|
|
97
|
+
"eslint": "9.6.0",
|
|
97
98
|
"eslint-config-prettier": "9.1.0",
|
|
98
|
-
"eslint-config-ssjs": "
|
|
99
|
+
"eslint-config-ssjs": "2.0.0",
|
|
99
100
|
"eslint-plugin-jsdoc": "48.2.7",
|
|
100
101
|
"eslint-plugin-mocha": "10.4.3",
|
|
101
102
|
"eslint-plugin-prettier": "5.1.2",
|
|
102
103
|
"eslint-plugin-unicorn": "53.0.0",
|
|
103
104
|
"fast-xml-parser": "4.4.0",
|
|
105
|
+
"globals": "15.6.0",
|
|
104
106
|
"husky": "9.0.11",
|
|
105
|
-
"lint-staged": "15.2.
|
|
107
|
+
"lint-staged": "15.2.7",
|
|
106
108
|
"mocha": "10.4.0",
|
|
107
109
|
"mock-fs": "5.2.0",
|
|
108
110
|
"npm-run-all": "4.1.5",
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "created on deploy",
|
|
3
|
+
"key": "testNew_automation",
|
|
4
|
+
"name": "testNew_automation",
|
|
5
|
+
"status": "Scheduled",
|
|
6
|
+
"steps": [
|
|
7
|
+
{
|
|
8
|
+
"activities": [
|
|
9
|
+
{
|
|
10
|
+
"displayOrder": 1,
|
|
11
|
+
"activityObjectId": "56c5370a-f988-4f36-b0ee-0f876573f6d7",
|
|
12
|
+
"name": "testExisting_dataExtract",
|
|
13
|
+
"objectTypeId": 73
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"displayOrder": 2,
|
|
17
|
+
"activityObjectId": "9b1c7bf9-4964-ed11-b849-48df37d1de8b",
|
|
18
|
+
"name": "testExisting_emailSend",
|
|
19
|
+
"objectTypeId": 42
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"displayOrder": 3,
|
|
23
|
+
"activityObjectId": "72c328ac-f5b0-4e37-91d3-a775666f15a6",
|
|
24
|
+
"name": "testExisting_fileTransfer",
|
|
25
|
+
"objectTypeId": 53
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"displayOrder": 4,
|
|
29
|
+
"activityObjectId": "9d16f42c-2260-ed11-b849-48df37d1de8b",
|
|
30
|
+
"name": "testExisting_importFile",
|
|
31
|
+
"objectTypeId": 43
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"displayOrder": 5,
|
|
35
|
+
"activityObjectId": "549f0568-607c-4940-afef-437965094dat",
|
|
36
|
+
"name": "testExisting_query",
|
|
37
|
+
"objectTypeId": 300
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"displayOrder": 6,
|
|
41
|
+
"activityObjectId": "39f6a488-20eb-4ba0-b0b9-023725b574e4",
|
|
42
|
+
"name": "testExisting_script",
|
|
43
|
+
"objectTypeId": 423
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"displayOrder": 7,
|
|
47
|
+
"activityObjectId": "testNew_RANDOM_NEW_GUID",
|
|
48
|
+
"name": "testNew_RANDOM_NEW_GUID",
|
|
49
|
+
"objectTypeId": 1000
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
"annotation": "",
|
|
53
|
+
"stepNumber": 0
|
|
54
|
+
}
|
|
55
|
+
],
|
|
56
|
+
"categoryId": 290937,
|
|
57
|
+
"startSource": {
|
|
58
|
+
"schedule": {
|
|
59
|
+
"startDate": "2020-05-14T02:30:32.11",
|
|
60
|
+
"endDate": "2079-06-06T21:00:00",
|
|
61
|
+
"icalRecur": "FREQ=MINUTELY;UNTIL=20790607T050000;INTERVAL=5",
|
|
62
|
+
"timezoneId": 5
|
|
63
|
+
},
|
|
64
|
+
"typeId": 1
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "updated on deploy",
|
|
3
|
+
"key": "testExisting_automation",
|
|
4
|
+
"name": "testExisting_automation",
|
|
5
|
+
"status": "PausedSchedule",
|
|
6
|
+
"steps": [
|
|
7
|
+
{
|
|
8
|
+
"activities": [
|
|
9
|
+
{
|
|
10
|
+
"displayOrder": 1,
|
|
11
|
+
"activityObjectId": "56c5370a-f988-4f36-b0ee-0f876573f6d7",
|
|
12
|
+
"name": "testExisting_dataExtract",
|
|
13
|
+
"objectTypeId": 73
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"displayOrder": 2,
|
|
17
|
+
"activityObjectId": "9b1c7bf9-4964-ed11-b849-48df37d1de8b",
|
|
18
|
+
"name": "testExisting_emailSend",
|
|
19
|
+
"objectTypeId": 42
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"displayOrder": 3,
|
|
23
|
+
"activityObjectId": "72c328ac-f5b0-4e37-91d3-a775666f15a6",
|
|
24
|
+
"name": "testExisting_fileTransfer",
|
|
25
|
+
"objectTypeId": 53
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"displayOrder": 4,
|
|
29
|
+
"activityObjectId": "9d16f42c-2260-ed11-b849-48df37d1de8b",
|
|
30
|
+
"name": "testExisting_importFile",
|
|
31
|
+
"objectTypeId": 43
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"displayOrder": 5,
|
|
35
|
+
"activityObjectId": "549f0568-607c-4940-afef-437965094dat",
|
|
36
|
+
"name": "testExisting_query",
|
|
37
|
+
"objectTypeId": 300
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"displayOrder": 6,
|
|
41
|
+
"activityObjectId": "39f6a488-20eb-4ba0-b0b9-023725b574e4",
|
|
42
|
+
"name": "testExisting_script",
|
|
43
|
+
"objectTypeId": 423
|
|
44
|
+
}
|
|
45
|
+
],
|
|
46
|
+
"annotation": "",
|
|
47
|
+
"stepNumber": 0
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
"notifications": [
|
|
51
|
+
{
|
|
52
|
+
"email": ["error-updated@test.accenture.com"],
|
|
53
|
+
"message": "test updated",
|
|
54
|
+
"type": "Error"
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
"categoryId": 290937,
|
|
58
|
+
"startSource": {
|
|
59
|
+
"schedule": {
|
|
60
|
+
"endDate": "2022-07-30T00:00:00",
|
|
61
|
+
"icalRecur": "FREQ=DAILY;COUNT=1;INTERVAL=1",
|
|
62
|
+
"startDate": "2022-07-30T00:00:00",
|
|
63
|
+
"timezoneId": 5
|
|
64
|
+
},
|
|
65
|
+
"typeId": 1
|
|
66
|
+
},
|
|
67
|
+
"id": "08afb0e2-b00a-4c88-ad2e-1f7f8788c560"
|
|
68
|
+
}
|
|
@@ -28,13 +28,6 @@
|
|
|
28
28
|
"name": "",
|
|
29
29
|
"step": 1,
|
|
30
30
|
"activities": [
|
|
31
|
-
{
|
|
32
|
-
"id": "8081a992-a27d-4a43-984a-d60114ea1025",
|
|
33
|
-
"name": "testExisting_dataExtract",
|
|
34
|
-
"activityObjectId": "56c5370a-f988-4f36-b0ee-0f876573f6d7",
|
|
35
|
-
"objectTypeId": 73,
|
|
36
|
-
"displayOrder": 1
|
|
37
|
-
},
|
|
38
31
|
{
|
|
39
32
|
"id": "d3774dc2-a271-4a44-8cbe-f630a6d6545e",
|
|
40
33
|
"name": "testExisting_emailSend",
|
|
@@ -42,6 +35,13 @@
|
|
|
42
35
|
"objectTypeId": 42,
|
|
43
36
|
"displayOrder": 2
|
|
44
37
|
},
|
|
38
|
+
{
|
|
39
|
+
"id": "8081a992-a27d-4a43-984a-d60114ea1025",
|
|
40
|
+
"name": "testExisting_dataExtract",
|
|
41
|
+
"activityObjectId": "56c5370a-f988-4f36-b0ee-0f876573f6d7",
|
|
42
|
+
"objectTypeId": 73,
|
|
43
|
+
"displayOrder": 1
|
|
44
|
+
},
|
|
45
45
|
{
|
|
46
46
|
"id": "2c77fc42-85eb-4611-98f9-223d29d89d72",
|
|
47
47
|
"name": "testExisting_fileTransfer",
|
|
@@ -85,13 +85,27 @@ describe('type: automation', () => {
|
|
|
85
85
|
5,
|
|
86
86
|
'three automations expected'
|
|
87
87
|
);
|
|
88
|
+
// get what was sent to the server API
|
|
89
|
+
const createCallout = testUtils.getRestCallout('post', '/automation/v1/automations/%');
|
|
90
|
+
const updateCallout = testUtils.getRestCallout('patch', '/automation/v1/automations/%');
|
|
91
|
+
|
|
88
92
|
// insert
|
|
93
|
+
assert.deepEqual(
|
|
94
|
+
createCallout,
|
|
95
|
+
await testUtils.getExpectedJson('9999999', 'automation', 'create-callout'),
|
|
96
|
+
'sent metadata was not equal expected for create'
|
|
97
|
+
);
|
|
89
98
|
assert.deepEqual(
|
|
90
99
|
await testUtils.getActualJson('testNew_automation', 'automation'),
|
|
91
100
|
await testUtils.getExpectedJson('9999999', 'automation', 'create'),
|
|
92
101
|
'returned metadata was not equal expected for create'
|
|
93
102
|
);
|
|
94
103
|
// update
|
|
104
|
+
assert.deepEqual(
|
|
105
|
+
updateCallout,
|
|
106
|
+
await testUtils.getExpectedJson('9999999', 'automation', 'update-callout'),
|
|
107
|
+
'sent metadata was not equal expected for create'
|
|
108
|
+
);
|
|
95
109
|
assert.deepEqual(
|
|
96
110
|
await testUtils.getActualJson('testExisting_automation', 'automation'),
|
|
97
111
|
await testUtils.getExpectedJson('9999999', 'automation', 'update'),
|
|
@@ -147,6 +161,13 @@ describe('type: automation', () => {
|
|
|
147
161
|
5,
|
|
148
162
|
'five cached automation expected'
|
|
149
163
|
);
|
|
164
|
+
|
|
165
|
+
// const scheduleCalloutList = testUtils.getSoapCallout('Schedule');
|
|
166
|
+
// const objectIds = {
|
|
167
|
+
// testNew_automation: 'a8afb0e2-b00a-4c88-ad2e-1f7f8788c560',
|
|
168
|
+
// testExisting_automation: '08afb0e2-b00a-4c88-ad2e-1f7f8788c560',
|
|
169
|
+
// };
|
|
170
|
+
|
|
150
171
|
assert.equal(
|
|
151
172
|
deployed['testInstance/testBU'].automation
|
|
152
173
|
? Object.keys(deployed['testInstance/testBU'].automation).length
|
|
@@ -169,7 +190,32 @@ describe('type: automation', () => {
|
|
|
169
190
|
'expected specific automation to have been deployed'
|
|
170
191
|
);
|
|
171
192
|
|
|
193
|
+
// insert
|
|
194
|
+
// assert.equal(
|
|
195
|
+
// scheduleCalloutList.find((item) => item.includes(objectIds['testNew_automation'])),
|
|
196
|
+
// await testUtils.getExpectedFile(
|
|
197
|
+
// '9999999',
|
|
198
|
+
// 'automation',
|
|
199
|
+
// 'schedule-callout-new',
|
|
200
|
+
// 'xml'
|
|
201
|
+
// ),
|
|
202
|
+
// 'sent metadata was not equal expected for create'
|
|
203
|
+
// );
|
|
204
|
+
|
|
172
205
|
// update
|
|
206
|
+
// assert.deepEqual(
|
|
207
|
+
// scheduleCalloutList.find((item) =>
|
|
208
|
+
// item.includes(objectIds['testExisting_automation'])
|
|
209
|
+
// ),
|
|
210
|
+
// await testUtils.getExpectedFile(
|
|
211
|
+
// '9999999',
|
|
212
|
+
// 'automation',
|
|
213
|
+
// 'schedule-callout-existing',
|
|
214
|
+
// 'xml'
|
|
215
|
+
// ),
|
|
216
|
+
// 'sent metadata was not equal expected for create'
|
|
217
|
+
// );
|
|
218
|
+
|
|
173
219
|
assert.deepEqual(
|
|
174
220
|
await testUtils.getActualJson('testExisting_automation', 'automation'),
|
|
175
221
|
await testUtils.getExpectedJson('9999999', 'automation', 'update'),
|
package/test/utils.js
CHANGED
|
@@ -9,7 +9,7 @@ import { fileURLToPath } from 'node:url';
|
|
|
9
9
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
10
10
|
|
|
11
11
|
// for some reason doesnt realize below reference
|
|
12
|
-
|
|
12
|
+
|
|
13
13
|
import fsmock from 'mock-fs';
|
|
14
14
|
|
|
15
15
|
let apimock;
|
|
@@ -184,8 +184,9 @@ export function mockSetup(isDeploy) {
|
|
|
184
184
|
path.resolve(__dirname, '../boilerplate/files/.beautyamp.json')
|
|
185
185
|
),
|
|
186
186
|
'.prettierrc': fsmock.load(path.resolve(__dirname, '../boilerplate/files/.prettierrc')),
|
|
187
|
-
'.
|
|
188
|
-
|
|
187
|
+
'eslint.config.js': fsmock.load(
|
|
188
|
+
path.resolve(__dirname, '../boilerplate/files/eslint.config.js')
|
|
189
|
+
),
|
|
189
190
|
'.mcdevrc.json': fsmock.load(path.resolve(__dirname, 'mockRoot/.mcdevrc.json')),
|
|
190
191
|
'.mcdev-auth.json': fsmock.load(path.resolve(__dirname, 'mockRoot/.mcdev-auth.json')),
|
|
191
192
|
'boilerplate/config.json': fsmock.load(
|
|
@@ -273,6 +274,30 @@ export function getRestCallout(method, url) {
|
|
|
273
274
|
);
|
|
274
275
|
return JSON.parse(myCallout.data);
|
|
275
276
|
}
|
|
277
|
+
/**
|
|
278
|
+
*
|
|
279
|
+
* @param {'Schedule'|'Retrieve'|'Create'|'Update'|'Delete'|'Describe'|'Execute'} requestAction soap request types
|
|
280
|
+
* @param {string} [objectType] optionall filter requests by object
|
|
281
|
+
* @returns {object[]} json payload of the requests
|
|
282
|
+
*/
|
|
283
|
+
export function getSoapCallout(requestAction, objectType) {
|
|
284
|
+
const method = 'post';
|
|
285
|
+
const url = '/Service.asmx';
|
|
286
|
+
const subset = apimock.history[method];
|
|
287
|
+
const myCallout = subset
|
|
288
|
+
// find soap requests
|
|
289
|
+
.filter((item) => item.url === url)
|
|
290
|
+
// find soap requestst of the correct request type
|
|
291
|
+
.filter((item) => item.headers.SOAPAction === requestAction)
|
|
292
|
+
// find soap requestst of the correct request type
|
|
293
|
+
.filter(
|
|
294
|
+
(item) =>
|
|
295
|
+
!objectType ||
|
|
296
|
+
item.data.split('<ObjectType>')[1].split('</ObjectType>')[0] === objectType
|
|
297
|
+
)
|
|
298
|
+
.map((item) => item.data);
|
|
299
|
+
return myCallout;
|
|
300
|
+
}
|
|
276
301
|
/**
|
|
277
302
|
* helper to return most important fields for each api call
|
|
278
303
|
*
|
package/.eslintignore
DELETED