mcdev 7.6.3 → 7.7.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/.github/ISSUE_TEMPLATE/bug.yml +2 -0
- package/.github/ISSUE_TEMPLATE/task.md +1 -1
- package/.github/workflows/coverage-base-update.yml +2 -2
- package/.github/workflows/coverage-develop-branch.yml +3 -1
- package/.github/workflows/coverage-main-branch.yml +3 -1
- package/.github/workflows/coverage.yml +5 -3
- package/.mcdev-validations.js +0 -0
- package/@types/lib/Builder.d.ts +14 -0
- package/@types/lib/Builder.d.ts.map +1 -1
- package/@types/lib/MetadataTypeDefinitions.d.ts +2 -0
- package/@types/lib/MetadataTypeDefinitions.d.ts.map +1 -1
- package/@types/lib/MetadataTypeInfo.d.ts +2 -0
- package/@types/lib/MetadataTypeInfo.d.ts.map +1 -1
- package/@types/lib/index.d.ts +17 -8
- package/@types/lib/index.d.ts.map +1 -1
- package/@types/lib/metadataTypes/Asset.d.ts +11 -3
- package/@types/lib/metadataTypes/Asset.d.ts.map +1 -1
- package/@types/lib/metadataTypes/DataExtension.d.ts.map +1 -1
- package/@types/lib/metadataTypes/DomainVerification.d.ts +180 -0
- package/@types/lib/metadataTypes/DomainVerification.d.ts.map +1 -0
- package/@types/lib/metadataTypes/Event.d.ts.map +1 -1
- package/@types/lib/metadataTypes/Journey.d.ts +7 -4
- package/@types/lib/metadataTypes/Journey.d.ts.map +1 -1
- package/@types/lib/metadataTypes/MetadataType.d.ts +15 -7
- package/@types/lib/metadataTypes/MetadataType.d.ts.map +1 -1
- package/@types/lib/metadataTypes/MobileKeyword.d.ts +2 -10
- package/@types/lib/metadataTypes/MobileKeyword.d.ts.map +1 -1
- package/@types/lib/metadataTypes/MobileMessage.d.ts +2 -10
- package/@types/lib/metadataTypes/MobileMessage.d.ts.map +1 -1
- package/@types/lib/metadataTypes/SendClassification.d.ts.map +1 -1
- package/@types/lib/metadataTypes/SenderProfile.d.ts +7 -0
- package/@types/lib/metadataTypes/SenderProfile.d.ts.map +1 -1
- package/@types/lib/metadataTypes/TransactionalEmail.d.ts +2 -2
- package/@types/lib/metadataTypes/TransactionalEmail.d.ts.map +1 -1
- package/@types/lib/metadataTypes/TriggeredSend.d.ts +8 -0
- package/@types/lib/metadataTypes/TriggeredSend.d.ts.map +1 -1
- package/@types/lib/metadataTypes/Verification.d.ts +0 -9
- package/@types/lib/metadataTypes/Verification.d.ts.map +1 -1
- package/@types/lib/metadataTypes/definitions/DomainVerification.definition.d.ts +100 -0
- package/@types/lib/metadataTypes/definitions/DomainVerification.definition.d.ts.map +1 -0
- package/@types/lib/metadataTypes/definitions/Journey.definition.d.ts +1 -1
- package/@types/lib/util/devops.d.ts.map +1 -1
- package/@types/lib/util/replaceContentBlockReference.d.ts +2 -1
- package/@types/lib/util/replaceContentBlockReference.d.ts.map +1 -1
- package/@types/lib/util/util.d.ts +42 -1
- package/@types/lib/util/util.d.ts.map +1 -1
- package/@types/lib/util/validations.d.ts.map +1 -1
- package/@types/types/mcdev.d.d.ts +34 -0
- package/@types/types/mcdev.d.d.ts.map +1 -1
- package/boilerplate/config.json +11 -0
- package/boilerplate/files/eslint.config.js +98 -3
- package/boilerplate/forcedUpdates.json +4 -0
- package/boilerplate/gitignore-template +1 -1
- package/boilerplate/npm-dependencies.json +1 -0
- package/eslint.config.js +4 -3
- package/lib/Builder.js +114 -54
- package/lib/Deployer.js +2 -2
- package/lib/MetadataTypeDefinitions.js +2 -0
- package/lib/MetadataTypeInfo.js +2 -0
- package/lib/cli.js +127 -3
- package/lib/index.js +217 -164
- package/lib/metadataTypes/Asset.js +76 -22
- package/lib/metadataTypes/DataExtension.js +10 -2
- package/lib/metadataTypes/DomainVerification.js +246 -0
- package/lib/metadataTypes/Event.js +21 -9
- package/lib/metadataTypes/Journey.js +339 -223
- package/lib/metadataTypes/MetadataType.js +153 -106
- package/lib/metadataTypes/MobileKeyword.js +5 -2
- package/lib/metadataTypes/MobileMessage.js +5 -2
- package/lib/metadataTypes/SendClassification.js +5 -0
- package/lib/metadataTypes/SenderProfile.js +102 -3
- package/lib/metadataTypes/TransactionalEmail.js +3 -1
- package/lib/metadataTypes/Verification.js +3 -1
- package/lib/metadataTypes/definitions/DomainVerification.definition.js +71 -0
- package/lib/metadataTypes/definitions/Journey.definition.js +7 -1
- package/lib/metadataTypes/definitions/SendClassification.definition.js +2 -2
- package/lib/metadataTypes/definitions/SenderProfile.definition.js +1 -1
- package/lib/util/config.js +6 -0
- package/lib/util/devops.js +130 -154
- package/lib/util/file.js +3 -3
- package/lib/util/replaceContentBlockReference.js +10 -3
- package/lib/util/util.js +96 -14
- package/lib/util/validations.js +34 -14
- package/package.json +10 -10
- package/test/general.test.js +339 -96
- package/test/mockRoot/.mcdev-validations.js +66 -0
- package/test/mockRoot/.mcdevrc.json +30 -2
- package/test/mockRoot/deploy/testInstance/testBU/asset/block/testNew_asset_htmlblock.asset-block-meta.html +1 -0
- package/test/mockRoot/deploy/testInstance/testBU/asset/block/testNew_asset_htmlblock.asset-block-meta.json +39 -0
- package/test/mockRoot/deploy/testInstance/testBU/asset/block/testNew_asset_withCBBK_notexisting.asset-block-meta.html +4 -0
- package/test/mockRoot/deploy/testInstance/testBU/asset/block/testNew_asset_withCBBK_notexisting.asset-block-meta.json +39 -0
- package/test/mockRoot/deploy/testInstance/testBU/asset/block/testNew_asset_withCBBK_preexisting.asset-block-meta.html +4 -0
- package/test/mockRoot/deploy/testInstance/testBU/asset/block/testNew_asset_withCBBK_preexisting.asset-block-meta.json +39 -0
- package/test/mockRoot/deploy/testInstance/testBU/asset/message/testNew_assetMessage/testNew_assetMessage.asset-message-meta.json +435 -0
- package/test/mockRoot/deploy/testInstance/testBU/asset/message/testNew_assetMessage/views.html.content.asset-message-meta.html +150 -0
- package/test/mockRoot/deploy/testInstance/testBU/asset/message/testNew_asset_templatebasedemail/testNew_asset_templatebasedemail.asset-message-meta.json +305 -0
- package/test/mockRoot/deploy/testInstance/testBU/asset/message/testNew_asset_templatebasedemail/views.html.content.asset-message-meta.html +150 -0
- package/test/mockRoot/deploy/testInstance/testBU/asset/template/testNew_asset_template/content.asset-template-meta.html +150 -0
- package/test/mockRoot/deploy/testInstance/testBU/asset/template/testNew_asset_template/testNew_asset_template.asset-template-meta.json +116 -0
- package/test/mockRoot/deploy/testInstance/testBU/domainVerification/joern.berkefeld.New@accenture.com.domainVerification-meta.json +6 -0
- package/test/mockRoot/deploy/testInstance/testBU/domainVerification/joern.berkefeld@accenture.com.domainVerification-meta.json +6 -0
- package/test/mockRoot/deploy/testInstance/testBU/domainVerification/mcdev.accenture.com.domainVerification-meta.json +6 -0
- package/test/mockRoot/deploy/testInstance/testBU/journey/testNew_temail_notPublished.journey-meta.json +213 -0
- package/test/mockRoot/deploy/testInstance/testBU/senderProfile/testExisting_senderProfile.senderProfile-meta.json +1 -0
- package/test/mockRoot/deploy/testInstance/testBU/senderProfile/testNew_senderProfile.senderProfile-meta.json +1 -0
- package/test/resourceFactory.js +7 -24
- package/test/resources/9999999/asset/v1/content/assets/post-response-key=testNew_assetMessage.json +441 -0
- package/test/resources/9999999/asset/v1/content/assets/post-response-key=testNew_asset_htmlblock.json +59 -0
- package/test/resources/9999999/asset/v1/content/assets/post-response-key=testNew_asset_template.json +147 -0
- package/test/resources/9999999/asset/v1/content/assets/post-response-key=testNew_asset_templatebasedemail.json +322 -0
- package/test/resources/9999999/asset/v1/content/assets/post-response-key=testNew_asset_withCBBK_notexisting.json +59 -0
- package/test/resources/9999999/asset/v1/content/assets/post-response-key=testNew_asset_withCBBK_preexisting.json +59 -0
- package/test/resources/9999999/asset-deploy2/block/testBlacklist_asset_htmlblock.asset-block-meta.html +1 -0
- package/test/resources/9999999/asset-deploy2/block/testBlacklist_asset_htmlblock.asset-block-meta.json +39 -0
- package/test/resources/9999999/automation/clone-expected.json +61 -0
- package/test/resources/9999999/dataExtension/retrieve-CustomerKey=testExisting_dataExtension-response.xml +52 -0
- package/test/resources/9999999/dataExtension-deploy/testBlacklist_dataExtension.dataExtension-meta.json +20 -0
- package/test/resources/9999999/dataFolder/retrieve-ContentTypeINasset,asset-shared,dataextension,hidden,salesforcedataextension,shared_data,shared_dataextension,shared_salesforcedataextension,synchronizeddataextension-response.xml +137 -0
- package/test/resources/9999999/domainVerification/create-expected.json +3 -0
- package/test/resources/9999999/domainVerification/get-sap-expected.json +6 -0
- package/test/resources/9999999/domainVerification/update-expected.json +6 -0
- package/test/resources/9999999/interaction/v1/interactions/key_testExisting_temail/put-response-paused.json +219 -0
- package/test/resources/9999999/interaction/v1/interactions/key_testNew_temail_notPublished/get-response.json +218 -0
- package/test/resources/9999999/interaction/v1/interactions/post-response.json +216 -0
- package/test/resources/9999999/journey/create-transactionaEmail-publish-expected.json +217 -0
- package/test/resources/9999999/messaging/v1/domainverification/delete/post-response.txt +1 -0
- package/test/resources/9999999/messaging/v1/domainverification/get-response.json +43 -0
- package/test/resources/9999999/messaging/v1/domainverification/post-response.txt +1 -0
- package/test/resources/9999999/messaging/v1/domainverification/update/post-response.txt +1 -0
- package/test/resources/9999999/messaging/v1/email/definitions/get-response.json +7 -0
- package/test/resources/9999999/messaging/v1/email/definitions/testNew_temail_notPublished/get-response.json +26 -0
- package/test/resources/9999999/query/clone-expected.json +8 -0
- package/test/resources/9999999/query/clone-expected.sql +7 -0
- package/test/resources/9999999/senderProfile/create-response.xml +1 -1
- package/test/resources/9999999/senderProfile/post-expected.json +1 -1
- package/test/resources/9999999/transactionalEmail/create-publish-expected.json +20 -0
- package/test/type.asset.test.js +216 -9
- package/test/type.automation.test.js +1 -1
- package/test/type.domainVerification.test.js +169 -0
- package/test/type.journey.test.js +107 -21
- package/test/type.script.test.js +1 -1
- package/test/type.sendClassification.test.js +3 -3
- package/test/type.senderProfile.test.js +26 -6
- package/test/type.transactionalEmail.test.js +5 -5
- package/test/type.triggeredSend.test.js +1 -1
- package/test/utils.js +8 -0
- package/types/mcdev.d.js +12 -0
package/boilerplate/config.json
CHANGED
|
@@ -13,6 +13,17 @@
|
|
|
13
13
|
"sourceTargetMapping": {
|
|
14
14
|
"deployment-source": "deployment-target"
|
|
15
15
|
},
|
|
16
|
+
"branchSourceTargetMapping": {
|
|
17
|
+
"sit": {
|
|
18
|
+
"deployment-sit-source": "deployment-sit-target"
|
|
19
|
+
},
|
|
20
|
+
"uat": {
|
|
21
|
+
"deployment-uat-source": "deployment-uat-target"
|
|
22
|
+
},
|
|
23
|
+
"prod": {
|
|
24
|
+
"deployment-prod-source": "deployment-prod-target"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
16
27
|
"targetBranchBuMapping": {
|
|
17
28
|
"release/*": "MySandbox/QA-DE",
|
|
18
29
|
"master": ["MyProduction/PROD-DE", "MyProduction/PROD-NL"]
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
|
|
2
|
+
import eslintPluginUnicorn from 'eslint-plugin-unicorn';
|
|
3
|
+
import globals from 'globals';
|
|
2
4
|
import jsdoc from 'eslint-plugin-jsdoc';
|
|
3
5
|
import js from '@eslint/js';
|
|
4
6
|
import sfmcSsjs from 'eslint-config-ssjs';
|
|
5
|
-
import globals from 'globals';
|
|
6
7
|
|
|
7
8
|
export default [
|
|
8
9
|
{
|
|
9
10
|
ignores: ['deploy/**/*', 'docs/**/*', 'logs/**/*', 'node_modules/**/*', 'template/**/*']
|
|
10
11
|
},
|
|
11
|
-
js.configs
|
|
12
|
+
js.configs.recommended,
|
|
12
13
|
eslintPluginPrettierRecommended,
|
|
13
14
|
jsdoc.configs['flat/recommended'],
|
|
15
|
+
eslintPluginUnicorn.configs['flat/recommended'],
|
|
14
16
|
{
|
|
15
17
|
plugins: { jsdoc },
|
|
16
18
|
rules: {
|
|
@@ -66,7 +68,7 @@ export default [
|
|
|
66
68
|
}
|
|
67
69
|
},
|
|
68
70
|
{
|
|
69
|
-
files: ['.mcdev-validations.js'],
|
|
71
|
+
files: ['lib/**.js', '.mcdev-validations.js'],
|
|
70
72
|
|
|
71
73
|
languageOptions: {
|
|
72
74
|
globals: {
|
|
@@ -76,8 +78,101 @@ export default [
|
|
|
76
78
|
ecmaVersion: 2022,
|
|
77
79
|
sourceType: 'module'
|
|
78
80
|
},
|
|
81
|
+
settings: {
|
|
82
|
+
jsdoc: {
|
|
83
|
+
mode: 'typescript',
|
|
84
|
+
|
|
85
|
+
preferredTypes: {
|
|
86
|
+
array: 'Array',
|
|
87
|
+
'array.<>': '[]',
|
|
88
|
+
'Array.<>': '[]',
|
|
89
|
+
'array<>': '[]',
|
|
90
|
+
'Array<>': '[]',
|
|
91
|
+
Object: 'object',
|
|
92
|
+
'object.<>': 'Object.<>',
|
|
93
|
+
'object<>': 'Object.<>',
|
|
94
|
+
'Object<>': 'Object.<>',
|
|
95
|
+
set: 'Set',
|
|
96
|
+
'set.<>': 'Set.<>',
|
|
97
|
+
'set<>': 'Set.<>',
|
|
98
|
+
'Set<>': 'Set.<>',
|
|
99
|
+
promise: 'Promise',
|
|
100
|
+
'promise.<>': 'Promise.<>',
|
|
101
|
+
'promise<>': 'Promise.<>',
|
|
102
|
+
'Promise<>': 'Promise.<>'
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
},
|
|
79
106
|
|
|
80
107
|
rules: {
|
|
108
|
+
'logical-assignment-operators': ['error', 'always'],
|
|
109
|
+
'unicorn/better-regex': 'off',
|
|
110
|
+
|
|
111
|
+
'unicorn/catch-error-name': [
|
|
112
|
+
'error',
|
|
113
|
+
{
|
|
114
|
+
name: 'ex'
|
|
115
|
+
}
|
|
116
|
+
],
|
|
117
|
+
|
|
118
|
+
'unicorn/explicit-length-check': 'off',
|
|
119
|
+
'unicorn/no-null': 'off',
|
|
120
|
+
'unicorn/prefer-module': 'off',
|
|
121
|
+
'unicorn/prevent-abbreviations': 'off',
|
|
122
|
+
'unicorn/filename-case': 'off',
|
|
123
|
+
'unicorn/no-array-callback-reference': 'off',
|
|
124
|
+
'unicorn/no-array-reduce': 'off',
|
|
125
|
+
'unicorn/no-await-expression-member': 'off',
|
|
126
|
+
'unicorn/no-hex-escape': 'off',
|
|
127
|
+
'unicorn/no-nested-ternary': 'off',
|
|
128
|
+
'unicorn/no-static-only-class': 'off',
|
|
129
|
+
'unicorn/no-unused-properties': 'warn',
|
|
130
|
+
'unicorn/numeric-separators-style': 'off',
|
|
131
|
+
'unicorn/prefer-array-some': 'off',
|
|
132
|
+
'unicorn/prefer-set-has': 'off',
|
|
133
|
+
'unicorn/prefer-spread': 'off',
|
|
134
|
+
'unicorn/prefer-string-replace-all': 'error',
|
|
135
|
+
'arrow-body-style': ['error', 'as-needed'],
|
|
136
|
+
curly: 'error',
|
|
137
|
+
|
|
138
|
+
'jsdoc/check-line-alignment': 2,
|
|
139
|
+
|
|
140
|
+
'jsdoc/require-jsdoc': [
|
|
141
|
+
'warn',
|
|
142
|
+
{
|
|
143
|
+
require: {
|
|
144
|
+
FunctionDeclaration: true,
|
|
145
|
+
MethodDefinition: true,
|
|
146
|
+
ClassDeclaration: true,
|
|
147
|
+
ArrowFunctionExpression: false,
|
|
148
|
+
FunctionExpression: true
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
],
|
|
152
|
+
|
|
153
|
+
'jsdoc/require-param-type': 'error',
|
|
154
|
+
|
|
155
|
+
'jsdoc/tag-lines': [
|
|
156
|
+
'warn',
|
|
157
|
+
'any',
|
|
158
|
+
{
|
|
159
|
+
startLines: 1
|
|
160
|
+
}
|
|
161
|
+
],
|
|
162
|
+
|
|
163
|
+
'jsdoc/no-undefined-types': 'off',
|
|
164
|
+
'jsdoc/valid-types': 'off',
|
|
165
|
+
|
|
166
|
+
'spaced-comment': [
|
|
167
|
+
'warn',
|
|
168
|
+
'always',
|
|
169
|
+
{
|
|
170
|
+
block: {
|
|
171
|
+
exceptions: ['*'],
|
|
172
|
+
balanced: true
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
],
|
|
81
176
|
'no-var': 'error',
|
|
82
177
|
'prefer-const': 'error',
|
|
83
178
|
'prettier/prettier': 'warn'
|
package/eslint.config.js
CHANGED
|
@@ -64,22 +64,23 @@ export default [
|
|
|
64
64
|
],
|
|
65
65
|
|
|
66
66
|
'unicorn/explicit-length-check': 'off',
|
|
67
|
-
'unicorn/no-null': 'off',
|
|
68
|
-
'unicorn/prefer-module': 'off',
|
|
69
|
-
'unicorn/prevent-abbreviations': 'off',
|
|
70
67
|
'unicorn/filename-case': 'off',
|
|
71
68
|
'unicorn/no-array-callback-reference': 'off',
|
|
72
69
|
'unicorn/no-array-reduce': 'off',
|
|
73
70
|
'unicorn/no-await-expression-member': 'off',
|
|
71
|
+
'unicorn/no-empty-file': 'off',
|
|
74
72
|
'unicorn/no-hex-escape': 'off',
|
|
75
73
|
'unicorn/no-nested-ternary': 'off',
|
|
74
|
+
'unicorn/no-null': 'off',
|
|
76
75
|
'unicorn/no-static-only-class': 'off',
|
|
77
76
|
'unicorn/no-unused-properties': 'warn',
|
|
78
77
|
'unicorn/numeric-separators-style': 'off',
|
|
79
78
|
'unicorn/prefer-array-some': 'off',
|
|
79
|
+
'unicorn/prefer-module': 'off',
|
|
80
80
|
'unicorn/prefer-set-has': 'off',
|
|
81
81
|
'unicorn/prefer-spread': 'off',
|
|
82
82
|
'unicorn/prefer-string-replace-all': 'error',
|
|
83
|
+
'unicorn/prevent-abbreviations': 'off',
|
|
83
84
|
'arrow-body-style': ['error', 'as-needed'],
|
|
84
85
|
curly: 'error',
|
|
85
86
|
'no-console': 'error',
|
package/lib/Builder.js
CHANGED
|
@@ -72,26 +72,28 @@ saved
|
|
|
72
72
|
async _buildDefinition(metadataType, nameArr, templateVariables) {
|
|
73
73
|
const type = metadataType;
|
|
74
74
|
try {
|
|
75
|
-
const result =
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
75
|
+
const result = (
|
|
76
|
+
await Promise.all(
|
|
77
|
+
nameArr.map((name) => {
|
|
78
|
+
// with npx and powershell spaces are not parsed correctly as part of a string
|
|
79
|
+
// we hence require users to put %20 in their stead and have to convert that back
|
|
80
|
+
name = name.split('%20').join(' ');
|
|
80
81
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
82
|
+
MetadataTypeInfo[type].client = auth.getSDK(this.buObject);
|
|
83
|
+
MetadataTypeInfo[type].properties = this.properties;
|
|
84
|
+
MetadataTypeInfo[type].buObject = this.buObject;
|
|
85
|
+
return MetadataTypeInfo[type].buildDefinition(
|
|
86
|
+
this.templateDir,
|
|
87
|
+
this.targetDir,
|
|
88
|
+
name,
|
|
89
|
+
templateVariables
|
|
90
|
+
);
|
|
91
|
+
})
|
|
92
|
+
)
|
|
93
|
+
).filter(Boolean);
|
|
92
94
|
if (result && type === result[0]?.type) {
|
|
93
95
|
// result elements can be undefined for each key that we did not find
|
|
94
|
-
this.metadata[type] = result.
|
|
96
|
+
this.metadata[type] = result.map((element) => element.metadata);
|
|
95
97
|
}
|
|
96
98
|
} catch (ex) {
|
|
97
99
|
Util.logger.errorStack(ex, 'mcdev.buildDefinition');
|
|
@@ -110,8 +112,8 @@ saved
|
|
|
110
112
|
*/
|
|
111
113
|
static async buildTemplate(businessUnit, selectedType, keyArr, marketArr) {
|
|
112
114
|
const properties = await config.getProperties();
|
|
113
|
-
if (!
|
|
114
|
-
return
|
|
115
|
+
if (!properties) {
|
|
116
|
+
return;
|
|
115
117
|
}
|
|
116
118
|
if (!Util._isValidType(selectedType)) {
|
|
117
119
|
return;
|
|
@@ -124,12 +126,15 @@ saved
|
|
|
124
126
|
}
|
|
125
127
|
/** @type {TemplateMap} */
|
|
126
128
|
const templateVariables = {};
|
|
127
|
-
|
|
128
|
-
if
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
129
|
+
if (marketArr[0] !== '__clone__') {
|
|
130
|
+
// if __clone__ is passed, we don't want to actually change anything but simply clone the metadata as-is
|
|
131
|
+
for (const market of marketArr) {
|
|
132
|
+
if (Util.checkMarket(market, properties)) {
|
|
133
|
+
Object.assign(templateVariables, properties.markets[market]);
|
|
134
|
+
} else {
|
|
135
|
+
// do not execute the rest of this method if a market was invalid
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
133
138
|
}
|
|
134
139
|
}
|
|
135
140
|
const buObject = await Cli.getCredentialObject(properties, businessUnit);
|
|
@@ -151,28 +156,30 @@ saved
|
|
|
151
156
|
const type = metadataType;
|
|
152
157
|
try {
|
|
153
158
|
/** @type {MetadataTypeItemObj[]} */
|
|
154
|
-
const result =
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
159
|
+
const result = (
|
|
160
|
+
await Promise.all(
|
|
161
|
+
keyArr.map(async (key) => {
|
|
162
|
+
MetadataTypeInfo[type].properties = this.properties;
|
|
163
|
+
MetadataTypeInfo[type].buObject = this.buObject;
|
|
158
164
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
165
|
+
try {
|
|
166
|
+
/** @type {MetadataTypeItemObj} */
|
|
167
|
+
const response = await MetadataTypeInfo[type].buildTemplate(
|
|
168
|
+
this.retrieveDir,
|
|
169
|
+
this.templateDir,
|
|
170
|
+
key,
|
|
171
|
+
templateVariables
|
|
172
|
+
);
|
|
173
|
+
return response;
|
|
174
|
+
} catch (ex) {
|
|
175
|
+
Util.logger.errorStack(ex, ` ☇ skipping template asset: ${key}`);
|
|
176
|
+
}
|
|
177
|
+
})
|
|
178
|
+
)
|
|
179
|
+
).filter(Boolean);
|
|
173
180
|
if (result && type === result[0]?.type) {
|
|
174
181
|
// result elements can be undefined for each key that we did not find
|
|
175
|
-
this.metadata[type] = result.
|
|
182
|
+
this.metadata[type] = result.map((element) => element.metadata);
|
|
176
183
|
}
|
|
177
184
|
} catch (ex) {
|
|
178
185
|
Util.logger.errorStack(ex, 'mcdev.buildTemplate');
|
|
@@ -191,8 +198,8 @@ saved
|
|
|
191
198
|
*/
|
|
192
199
|
static async buildDefinition(businessUnit, selectedType, nameArr, marketArr) {
|
|
193
200
|
const properties = await config.getProperties();
|
|
194
|
-
if (!
|
|
195
|
-
return
|
|
201
|
+
if (!properties) {
|
|
202
|
+
return;
|
|
196
203
|
}
|
|
197
204
|
if (!Util._isValidType(selectedType)) {
|
|
198
205
|
return;
|
|
@@ -205,12 +212,15 @@ saved
|
|
|
205
212
|
}
|
|
206
213
|
/** @type {TemplateMap} */
|
|
207
214
|
const templateVariables = {};
|
|
208
|
-
|
|
209
|
-
if
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
215
|
+
if (marketArr[0] !== '__clone__') {
|
|
216
|
+
// if __clone__ is passed, we don't want to actually change anything but simply clone the metadata as-is
|
|
217
|
+
for (const market of marketArr) {
|
|
218
|
+
if (Util.checkMarket(market, properties)) {
|
|
219
|
+
Object.assign(templateVariables, properties.markets[market]);
|
|
220
|
+
} else {
|
|
221
|
+
// do not execute the rest of this method if a market was invalid
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
214
224
|
}
|
|
215
225
|
}
|
|
216
226
|
const buObject = await Cli.getCredentialObject(properties, businessUnit);
|
|
@@ -231,8 +241,8 @@ saved
|
|
|
231
241
|
*/
|
|
232
242
|
static async buildDefinitionBulk(listName, type, nameArr) {
|
|
233
243
|
const properties = await config.getProperties();
|
|
234
|
-
if (!
|
|
235
|
-
return
|
|
244
|
+
if (!properties) {
|
|
245
|
+
return;
|
|
236
246
|
}
|
|
237
247
|
try {
|
|
238
248
|
Util.verifyMarketList(listName, properties);
|
|
@@ -283,6 +293,56 @@ saved
|
|
|
283
293
|
}
|
|
284
294
|
return responseObj;
|
|
285
295
|
}
|
|
296
|
+
/**
|
|
297
|
+
* helper for buildDefinitionBulk, createDeltaPkg
|
|
298
|
+
*
|
|
299
|
+
* @param {string} listName market list name
|
|
300
|
+
* @returns {Promise.<void>} -
|
|
301
|
+
*/
|
|
302
|
+
static async purgeDeployFolderList(listName) {
|
|
303
|
+
const properties = await config.getProperties();
|
|
304
|
+
if (!properties) {
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
for (const businessUnit in properties.marketList[listName]) {
|
|
308
|
+
if (businessUnit === 'description') {
|
|
309
|
+
// skip, it's just a metadata on this list and not a BU
|
|
310
|
+
continue;
|
|
311
|
+
}
|
|
312
|
+
if (!Util.isValidBU(properties, businessUnit, true)) {
|
|
313
|
+
throw new Error(`'${businessUnit}' in Market ${listName} is not defined.`);
|
|
314
|
+
}
|
|
315
|
+
await this.purgeDeployFolder(businessUnit);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* helper for buildDefiniton, purgeDeployFolderList
|
|
320
|
+
*
|
|
321
|
+
* @param {string} businessUnit cred/bu combo
|
|
322
|
+
* @returns {Promise.<void>} -
|
|
323
|
+
*/
|
|
324
|
+
static async purgeDeployFolder(businessUnit) {
|
|
325
|
+
const properties = await config.getProperties();
|
|
326
|
+
if (!properties) {
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
if (!Util.isValidBU(properties, businessUnit, true)) {
|
|
330
|
+
throw new Error(`'${businessUnit}' does not exist.`);
|
|
331
|
+
}
|
|
332
|
+
const deployDir = File.normalizePath([
|
|
333
|
+
properties.directories.deploy,
|
|
334
|
+
...businessUnit.split('/'),
|
|
335
|
+
]);
|
|
336
|
+
// Clear output folder structure for selected sub-type
|
|
337
|
+
// only run this if the standard deploy folder is a target of buildDefinition (which technically could be changed)
|
|
338
|
+
Util.logger.info(` - 🚮 purging folder ${deployDir}`);
|
|
339
|
+
try {
|
|
340
|
+
await File.remove(deployDir);
|
|
341
|
+
} catch {
|
|
342
|
+
// sometimes the first attempt is not successful for some operating system reason. Trying again mostly solves this
|
|
343
|
+
await File.remove(deployDir);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
286
346
|
}
|
|
287
347
|
|
|
288
348
|
export default Builder;
|
package/lib/Deployer.js
CHANGED
|
@@ -71,8 +71,8 @@ class Deployer {
|
|
|
71
71
|
/** @type {Object.<string, MultiMetadataTypeMap>} */
|
|
72
72
|
const buMultiMetadataTypeMap = {};
|
|
73
73
|
const properties = await config.getProperties();
|
|
74
|
-
if (!
|
|
75
|
-
return
|
|
74
|
+
if (!properties) {
|
|
75
|
+
return;
|
|
76
76
|
}
|
|
77
77
|
const deployDirBak = properties.directories.deploy;
|
|
78
78
|
if (Util.OPTIONS.fromRetrieve) {
|
|
@@ -13,6 +13,7 @@ import dataExtract from './metadataTypes/definitions/DataExtract.definition.js';
|
|
|
13
13
|
import dataExtractType from './metadataTypes/definitions/DataExtractType.definition.js';
|
|
14
14
|
import deliveryProfile from './metadataTypes/definitions/DeliveryProfile.definition.js';
|
|
15
15
|
import discovery from './metadataTypes/definitions/Discovery.definition.js';
|
|
16
|
+
import domainVerification from './metadataTypes/definitions/DomainVerification.definition.js';
|
|
16
17
|
import email from './metadataTypes/definitions/Email.definition.js';
|
|
17
18
|
import emailSend from './metadataTypes/definitions/EmailSend.definition.js';
|
|
18
19
|
import event from './metadataTypes/definitions/Event.definition.js';
|
|
@@ -56,6 +57,7 @@ export default {
|
|
|
56
57
|
dataExtractType,
|
|
57
58
|
deliveryProfile,
|
|
58
59
|
discovery,
|
|
60
|
+
domainVerification,
|
|
59
61
|
email,
|
|
60
62
|
emailSend,
|
|
61
63
|
event,
|
package/lib/MetadataTypeInfo.js
CHANGED
|
@@ -13,6 +13,7 @@ import dataExtract from './metadataTypes/DataExtract.js';
|
|
|
13
13
|
import dataExtractType from './metadataTypes/DataExtractType.js';
|
|
14
14
|
import deliveryProfile from './metadataTypes/DeliveryProfile.js';
|
|
15
15
|
import discovery from './metadataTypes/Discovery.js';
|
|
16
|
+
import domainVerification from './metadataTypes/DomainVerification.js';
|
|
16
17
|
import email from './metadataTypes/Email.js';
|
|
17
18
|
import emailSend from './metadataTypes/EmailSend.js';
|
|
18
19
|
import event from './metadataTypes/Event.js';
|
|
@@ -55,6 +56,7 @@ export default {
|
|
|
55
56
|
dataExtractType,
|
|
56
57
|
deliveryProfile,
|
|
57
58
|
discovery,
|
|
59
|
+
domainVerification,
|
|
58
60
|
email,
|
|
59
61
|
emailSend,
|
|
60
62
|
event,
|