mcdev 7.5.0 → 7.6.0

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 (34) hide show
  1. package/.github/ISSUE_TEMPLATE/bug.yml +1 -0
  2. package/@types/lib/index.d.ts +12 -8
  3. package/@types/lib/index.d.ts.map +1 -1
  4. package/@types/lib/metadataTypes/AttributeSet.d.ts.map +1 -1
  5. package/@types/lib/metadataTypes/DataExtension.d.ts +3 -1
  6. package/@types/lib/metadataTypes/DataExtension.d.ts.map +1 -1
  7. package/@types/lib/metadataTypes/Event.d.ts +2 -2
  8. package/@types/lib/metadataTypes/Event.d.ts.map +1 -1
  9. package/@types/lib/metadataTypes/Journey.d.ts +16 -0
  10. package/@types/lib/metadataTypes/Journey.d.ts.map +1 -1
  11. package/@types/lib/metadataTypes/MetadataType.d.ts +4 -2
  12. package/@types/lib/metadataTypes/MetadataType.d.ts.map +1 -1
  13. package/@types/lib/metadataTypes/TransactionalEmail.d.ts +1 -0
  14. package/@types/lib/metadataTypes/TransactionalEmail.d.ts.map +1 -1
  15. package/@types/lib/metadataTypes/TriggeredSend.d.ts +0 -8
  16. package/@types/lib/metadataTypes/TriggeredSend.d.ts.map +1 -1
  17. package/@types/lib/metadataTypes/definitions/Journey.definition.d.ts +1 -0
  18. package/@types/lib/metadataTypes/definitions/TransactionalEmail.definition.d.ts +1 -0
  19. package/@types/lib/util/replaceContentBlockReference.d.ts.map +1 -1
  20. package/@types/lib/util/util.d.ts.map +1 -1
  21. package/@types/types/mcdev.d.d.ts +15 -7
  22. package/@types/types/mcdev.d.d.ts.map +1 -1
  23. package/lib/cli.js +13 -2
  24. package/lib/index.js +46 -42
  25. package/lib/metadataTypes/Event.js +4 -1
  26. package/lib/metadataTypes/Journey.js +456 -90
  27. package/lib/metadataTypes/MetadataType.js +8 -4
  28. package/lib/metadataTypes/TriggeredSend.js +21 -12
  29. package/lib/metadataTypes/definitions/Journey.definition.js +1 -0
  30. package/lib/metadataTypes/definitions/TransactionalEmail.definition.js +1 -0
  31. package/package.json +15 -15
  32. package/test/mockRoot/.mcdevrc.json +1 -1
  33. package/test/resources/9999999/interaction/v1/interactions/dsfdsafdsa-922c-4568-85a5-e5cc77efc3be/delete-response.txt +1 -0
  34. package/test/type.journey.test.js +6 -5
@@ -508,13 +508,15 @@ class MetadataType {
508
508
  /**
509
509
  * Abstract refresh method that needs to be implemented in child metadata type
510
510
  *
511
- * @returns {void}
511
+ * @param {string[]} [keyArr] metadata keys
512
+ * @param {boolean} [checkKey] whether to check if the key is valid
513
+ * @returns {Promise.<string[]>} Returns list of keys that were refreshed
512
514
  */
513
- static refresh() {
515
+ static async refresh(keyArr, checkKey = true) {
514
516
  Util.logger.error(
515
517
  ` ☇ skipping ${this.definition.type}: refresh is not supported yet for ${this.definition.type}`
516
518
  );
517
- return;
519
+ return [];
518
520
  }
519
521
 
520
522
  /**
@@ -2466,7 +2468,9 @@ class MetadataType {
2466
2468
  } else {
2467
2469
  const errorMsg = ex?.results?.length
2468
2470
  ? `${ex.results[0].StatusMessage} (Code ${ex.results[0].ErrorCode})`
2469
- : ex.message;
2471
+ : ex?.json?.Results?.length
2472
+ ? `${ex.json.Results[0].StatusMessage} (Code ${ex.json.Results[0].ErrorCode})`
2473
+ : ex.message;
2470
2474
  Util.logger.error(
2471
2475
  ` - Deleting ${this.definition.type} '${customerKey}' failed: ${errorMsg}`
2472
2476
  );
@@ -7,6 +7,7 @@ import asset from './Asset.js';
7
7
  import folder from './Folder.js';
8
8
  import list from './List.js';
9
9
  import ReplaceCbReference from '../util/replaceContentBlockReference.js';
10
+ import pLimit from 'p-limit';
10
11
 
11
12
  /**
12
13
  * @typedef {import('../../types/mcdev.d.js').BuObject} BuObject
@@ -303,24 +304,32 @@ class TriggeredSend extends MetadataType {
303
304
  *
304
305
  * @param {string[]} [keyArr] metadata keys
305
306
  * @param {boolean} [checkKey] whether to check if the key is valid
306
- * @returns {Promise.<void>} -
307
+ * @returns {Promise.<string[]>} Returns list of keys that were refreshed
307
308
  */
308
309
  static async refresh(keyArr, checkKey = true) {
309
- console.time('Time'); // eslint-disable-line no-console
310
310
  if (!keyArr) {
311
311
  keyArr = await this.getKeysForValidTSDs((await this.findRefreshableItems()).metadata);
312
312
  checkKey = false;
313
313
  }
314
314
  // then executes pause, publish, start on them.
315
- const refreshList = [];
316
315
  Util.logger.info(`Refreshing ${keyArr.length} ${this.definition.typeName}...`);
317
316
  Util.logger.debug(`Refreshing keys: ${keyArr.join(', ')}`);
318
- for (const key of keyArr) {
319
- refreshList.push(this._refreshItem(key, checkKey));
320
- }
321
- const successCounter = (await Promise.all(refreshList)).filter(Boolean).length;
322
- Util.logger.info(`Refreshed ${successCounter} of ${keyArr.length}`);
323
- console.timeEnd('Time'); // eslint-disable-line no-console
317
+ const refreshedKeyArr = [];
318
+ const rateLimit = pLimit(10);
319
+ await Promise.all(
320
+ keyArr.map((key) =>
321
+ rateLimit(async () => {
322
+ const result = await this._refreshItem(key, checkKey);
323
+ if (result) {
324
+ refreshedKeyArr.push(key);
325
+ }
326
+ })
327
+ )
328
+ );
329
+ Util.logger.info(
330
+ `Refreshed ${refreshedKeyArr.length} of ${keyArr.length} ${this.definition.type}`
331
+ );
332
+ return refreshedKeyArr;
324
333
  }
325
334
 
326
335
  /**
@@ -452,7 +461,7 @@ class TriggeredSend extends MetadataType {
452
461
  throw new Error(test.Results[0].StatusMessage);
453
462
  }
454
463
  delete item.TriggeredSendStatus;
455
- Util.logger.info(` - paused ${this.definition.typeName}: ${key}`);
464
+ Util.logger.info(` - 🛑 paused ${this.definition.typeName}: ${key}`);
456
465
  } catch (ex) {
457
466
  const errorMsg = super.getSOAPErrorMsg(ex);
458
467
 
@@ -470,7 +479,7 @@ class TriggeredSend extends MetadataType {
470
479
  throw new Error(test.Results[0].StatusMessage);
471
480
  }
472
481
  delete item.RefreshContent;
473
- Util.logger.info(` - published ${this.definition.typeName}: ${key}`);
482
+ Util.logger.info(` - 🔃 published ${this.definition.typeName}: ${key}`);
474
483
  } catch (ex) {
475
484
  const errorMsg = super.getSOAPErrorMsg(ex);
476
485
  Util.logger.error(
@@ -487,7 +496,7 @@ class TriggeredSend extends MetadataType {
487
496
  throw new Error(test.Results[0].StatusMessage);
488
497
  }
489
498
  delete item.RefreshContent;
490
- Util.logger.info(` - started ${this.definition.typeName}: ${key}`);
499
+ Util.logger.info(` - started ${this.definition.typeName}: ${key}`);
491
500
  } catch (ex) {
492
501
  const errorMsg = super.getSOAPErrorMsg(ex);
493
502
  Util.logger.error(
@@ -60,6 +60,7 @@ export default {
60
60
  lastmodNameField: null,
61
61
  restPagination: true,
62
62
  restPageSize: 500,
63
+ maxKeyLength: 200, // confirmed max length
63
64
  type: 'journey',
64
65
  typeDescription: 'Journey (internally called "Interaction").',
65
66
  typeRetrieveByDefault: true,
@@ -20,6 +20,7 @@ export default {
20
20
  lastmodNameField: null,
21
21
  restPagination: true,
22
22
  restPageSize: 100,
23
+ maxKeyLength: 36, // confirmed max length
23
24
  type: 'transactionalEmail',
24
25
  typeDescription: 'Lets you send immediate Email messages via API events',
25
26
  typeRetrieveByDefault: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcdev",
3
- "version": "7.5.0",
3
+ "version": "7.6.0",
4
4
  "description": "Accenture Salesforce Marketing Cloud DevTools",
5
5
  "author": "Accenture: joern.berkefeld, douglas.midgley, robert.zimmermann, maciej.barnas",
6
6
  "license": "MIT",
@@ -71,7 +71,7 @@
71
71
  "beauty-amp-core2": "0.4.9",
72
72
  "cli-progress": "3.12.0",
73
73
  "command-exists": "1.2.9",
74
- "conf": "13.0.1",
74
+ "conf": "13.1.0",
75
75
  "console.table": "0.10.0",
76
76
  "deep-equal": "2.2.3",
77
77
  "fs-extra": "11.2.0",
@@ -79,45 +79,45 @@
79
79
  "json-to-table": "4.2.1",
80
80
  "mustache": "4.2.0",
81
81
  "p-limit": "6.1.0",
82
- "prettier": "3.3.3",
82
+ "prettier": "3.4.2",
83
83
  "prettier-plugin-sql": "0.18.1",
84
84
  "semver": "7.6.3",
85
85
  "sfmc-sdk": "2.1.2",
86
86
  "simple-git": "3.27.0",
87
87
  "toposort": "2.0.2",
88
88
  "update-notifier": "7.3.1",
89
- "winston": "3.15.0",
89
+ "winston": "3.17.0",
90
90
  "yargs": "17.7.2",
91
91
  "yocto-spinner": "0.1.1"
92
92
  },
93
93
  "devDependencies": {
94
- "@eslint/js": "9.10.0",
94
+ "@eslint/js": "9.17.0",
95
95
  "@types/fs-extra": "11.0.4",
96
96
  "@types/inquirer": "9.0.7",
97
97
  "@types/mocha": "10.0.8",
98
- "@types/node": "22.9.0",
98
+ "@types/node": "22.10.2",
99
99
  "@types/yargs": "17.0.33",
100
100
  "assert": "2.1.0",
101
- "axios-mock-adapter": "2.1.0",
101
+ "axios-mock-adapter": "2.0.0",
102
102
  "c8": "10.0.0",
103
- "chai": "5.1.1",
103
+ "chai": "5.1.2",
104
104
  "chai-files": "1.4.0",
105
- "eslint": "9.10.0",
105
+ "eslint": "9.17.0",
106
106
  "eslint-config-prettier": "9.1.0",
107
107
  "eslint-config-ssjs": "2.0.0",
108
- "eslint-plugin-jsdoc": "50.5.0",
108
+ "eslint-plugin-jsdoc": "50.6.1",
109
109
  "eslint-plugin-mocha": "10.5.0",
110
110
  "eslint-plugin-prettier": "5.2.1",
111
- "eslint-plugin-unicorn": "56.0.0",
111
+ "eslint-plugin-unicorn": "56.0.1",
112
112
  "fast-xml-parser": "4.4.1",
113
- "globals": "15.12.0",
114
- "husky": "9.1.6",
113
+ "globals": "15.14.0",
114
+ "husky": "9.1.7",
115
115
  "lint-staged": "15.2.10",
116
- "mocha": "10.7.3",
116
+ "mocha": "11.0.1",
117
117
  "mock-fs": "5.3.0",
118
118
  "npm-run-all": "4.1.5",
119
119
  "prettier-eslint": "16.3.0",
120
- "typescript": "5.6.3"
120
+ "typescript": "5.7.2"
121
121
  },
122
122
  "optionalDependencies": {
123
123
  "fsevents": "*"
@@ -126,5 +126,5 @@
126
126
  "verification"
127
127
  ]
128
128
  },
129
- "version": "7.5.0"
129
+ "version": "7.6.0"
130
130
  }
@@ -350,7 +350,7 @@ describe('type: journey', () => {
350
350
  const isDeleted = await handler.deleteByKey(
351
351
  'testInstance/testBU',
352
352
  'journey',
353
- 'testExisting_journey_Quicksend'
353
+ 'testExisting_journey_Multistep'
354
354
  );
355
355
  // THEN
356
356
  assert.equal(process.exitCode, 1, 'delete should have thrown an error');
@@ -364,7 +364,7 @@ describe('type: journey', () => {
364
364
  const isDeleted = await handler.deleteByKey(
365
365
  'testInstance/testBU',
366
366
  'journey',
367
- 'testExisting_journey_Quicksend/2'
367
+ 'testExisting_journey_Multistep/2'
368
368
  );
369
369
  // THEN
370
370
  assert.equal(process.exitCode, 1, 'delete should have thrown an error');
@@ -378,7 +378,7 @@ describe('type: journey', () => {
378
378
  const isDeleted = await handler.deleteByKey(
379
379
  'testInstance/testBU',
380
380
  'journey',
381
- 'testExisting_journey_Quicksend/1'
381
+ 'testExisting_journey_Multistep/1'
382
382
  );
383
383
  // THEN
384
384
  assert.equal(process.exitCode, 0, 'delete should not have thrown an error');
@@ -392,7 +392,7 @@ describe('type: journey', () => {
392
392
  const isDeleted = await handler.deleteByKey(
393
393
  'testInstance/testBU',
394
394
  'journey',
395
- 'testExisting_journey_Quicksend/*'
395
+ 'testExisting_journey_Multistep/*'
396
396
  );
397
397
  // THEN
398
398
  assert.equal(process.exitCode, 0, 'delete should not have thrown an error');
@@ -404,7 +404,8 @@ describe('type: journey', () => {
404
404
  it('Should delete 2 items with exact version', async () => {
405
405
  // WHEN
406
406
  const isDeleted = await handler.deleteByKey('testInstance/testBU', 'journey', [
407
- 'testExisting_journey_Quicksend/1',
407
+ 'testExisting_journey_Quicksend',
408
+ 'testExisting_temail',
408
409
  'testExisting_journey_Multistep/1',
409
410
  ]);
410
411
  // THEN