mcdev 7.0.2 → 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 +1 -0
- 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/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/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/Journey.js +2 -5
- package/lib/metadataTypes/MetadataType.js +6 -1
- package/lib/metadataTypes/definitions/Automation.definition.js +1 -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 +5 -3
- 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
|
@@ -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
package/.eslintrc.json
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"env": {
|
|
3
|
-
"es6": true,
|
|
4
|
-
"node": true
|
|
5
|
-
},
|
|
6
|
-
"extends": [
|
|
7
|
-
"eslint:recommended",
|
|
8
|
-
"ssjs",
|
|
9
|
-
"plugin:jsdoc/recommended",
|
|
10
|
-
"plugin:prettier/recommended",
|
|
11
|
-
"plugin:unicorn/recommended"
|
|
12
|
-
],
|
|
13
|
-
"plugins": ["prettier"],
|
|
14
|
-
"globals": {
|
|
15
|
-
"Atomics": "readonly",
|
|
16
|
-
"SharedArrayBuffer": "readonly"
|
|
17
|
-
},
|
|
18
|
-
"parserOptions": {
|
|
19
|
-
"ecmaVersion": 2022,
|
|
20
|
-
"sourceType": "module"
|
|
21
|
-
},
|
|
22
|
-
"root": true,
|
|
23
|
-
"settings": {
|
|
24
|
-
"jsdoc": {
|
|
25
|
-
"mode": "typescript",
|
|
26
|
-
"preferredTypes": {
|
|
27
|
-
"array": "Array",
|
|
28
|
-
"array.<>": "[]",
|
|
29
|
-
"Array.<>": "[]",
|
|
30
|
-
"array<>": "[]",
|
|
31
|
-
"Array<>": "[]",
|
|
32
|
-
"Object": "object",
|
|
33
|
-
"object.<>": "Object.<>",
|
|
34
|
-
"object<>": "Object.<>",
|
|
35
|
-
"Object<>": "Object.<>",
|
|
36
|
-
"set": "Set",
|
|
37
|
-
"set.<>": "Set.<>",
|
|
38
|
-
"set<>": "Set.<>",
|
|
39
|
-
"Set<>": "Set.<>",
|
|
40
|
-
"promise": "Promise",
|
|
41
|
-
"promise.<>": "Promise.<>",
|
|
42
|
-
"promise<>": "Promise.<>",
|
|
43
|
-
"Promise<>": "Promise.<>"
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
"rules": {
|
|
48
|
-
"logical-assignment-operators": ["error", "always"],
|
|
49
|
-
"unicorn/better-regex": "off",
|
|
50
|
-
"unicorn/catch-error-name": [
|
|
51
|
-
"error",
|
|
52
|
-
{
|
|
53
|
-
"name": "ex"
|
|
54
|
-
}
|
|
55
|
-
],
|
|
56
|
-
"unicorn/explicit-length-check": "off",
|
|
57
|
-
"unicorn/no-null": "off",
|
|
58
|
-
"unicorn/prefer-module": "off",
|
|
59
|
-
"unicorn/prevent-abbreviations": "off",
|
|
60
|
-
"unicorn/filename-case": "off",
|
|
61
|
-
"unicorn/no-array-callback-reference": "off",
|
|
62
|
-
"unicorn/no-array-reduce": "off",
|
|
63
|
-
"unicorn/no-await-expression-member": "off",
|
|
64
|
-
"unicorn/no-hex-escape": "off",
|
|
65
|
-
"unicorn/no-nested-ternary": "off",
|
|
66
|
-
"unicorn/no-static-only-class": "off",
|
|
67
|
-
"unicorn/no-unused-properties": "warn",
|
|
68
|
-
"unicorn/numeric-separators-style": "off",
|
|
69
|
-
"unicorn/prefer-array-some": "off",
|
|
70
|
-
"unicorn/prefer-set-has": "off",
|
|
71
|
-
"unicorn/prefer-spread": "off",
|
|
72
|
-
"unicorn/prefer-string-replace-all": "error",
|
|
73
|
-
"arrow-body-style": ["error", "as-needed"],
|
|
74
|
-
"curly": "error",
|
|
75
|
-
"no-console": "error",
|
|
76
|
-
"jsdoc/check-line-alignment": 2,
|
|
77
|
-
"jsdoc/require-jsdoc": [
|
|
78
|
-
"warn",
|
|
79
|
-
{
|
|
80
|
-
"require": {
|
|
81
|
-
"FunctionDeclaration": true,
|
|
82
|
-
"MethodDefinition": true,
|
|
83
|
-
"ClassDeclaration": true,
|
|
84
|
-
"ArrowFunctionExpression": false,
|
|
85
|
-
"FunctionExpression": true
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
],
|
|
89
|
-
"jsdoc/require-param-type": "error",
|
|
90
|
-
"jsdoc/tag-lines": ["warn", "any", { "startLines": 1 }],
|
|
91
|
-
"jsdoc/no-undefined-types": "error",
|
|
92
|
-
"valid-jsdoc": "off",
|
|
93
|
-
"spaced-comment": ["warn", "always", { "block": { "exceptions": ["*"], "balanced": true } }]
|
|
94
|
-
},
|
|
95
|
-
"overrides": [
|
|
96
|
-
{
|
|
97
|
-
"files": ["*.js"],
|
|
98
|
-
"rules": {
|
|
99
|
-
"no-var": "error",
|
|
100
|
-
"prefer-const": "error",
|
|
101
|
-
"prettier/prettier": "warn",
|
|
102
|
-
"prefer-arrow-callback": "warn"
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
"files": ["test/*.js"],
|
|
107
|
-
|
|
108
|
-
"extends": ["plugin:mocha/recommended"],
|
|
109
|
-
"plugins": ["mocha"],
|
|
110
|
-
"rules": {
|
|
111
|
-
"mocha/no-mocha-arrows": "off",
|
|
112
|
-
"mocha/no-pending-tests": "off"
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
]
|
|
116
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": ["eslint:recommended", "prettier", "ssjs"],
|
|
3
|
-
"plugins": ["jsdoc", "prettier"],
|
|
4
|
-
"rules": {
|
|
5
|
-
"padded-blocks": "off",
|
|
6
|
-
"prefer-rest-params": "off",
|
|
7
|
-
"prefer-spread": "off",
|
|
8
|
-
"require-jsdoc": [
|
|
9
|
-
"warn",
|
|
10
|
-
{
|
|
11
|
-
"require": {
|
|
12
|
-
"FunctionDeclaration": true,
|
|
13
|
-
"MethodDefinition": true,
|
|
14
|
-
"ClassDeclaration": true,
|
|
15
|
-
"ArrowFunctionExpression": false,
|
|
16
|
-
"FunctionExpression": true
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
],
|
|
20
|
-
"valid-jsdoc": "warn",
|
|
21
|
-
"spaced-comment": ["warn", "always", { "block": { "exceptions": ["*"], "balanced": true } }]
|
|
22
|
-
},
|
|
23
|
-
"overrides": [
|
|
24
|
-
{
|
|
25
|
-
"files": ["*.js"],
|
|
26
|
-
"env": { "es6": true },
|
|
27
|
-
"parserOptions": {
|
|
28
|
-
"ecmaVersion": 2018
|
|
29
|
-
},
|
|
30
|
-
"rules": {
|
|
31
|
-
"no-var": "error",
|
|
32
|
-
"prefer-const": "error",
|
|
33
|
-
"prettier/prettier": "warn"
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
]
|
|
37
|
-
}
|