sfmc-dataloader 2.6.0 → 2.6.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/lib/business-units.mjs +12 -1
- package/lib/config.mjs +24 -1
- package/package.json +1 -1
package/lib/business-units.mjs
CHANGED
|
@@ -46,7 +46,18 @@ export function processBusinessUnitResults(results, enterpriseId) {
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
/** @type {Record<string, number>} */
|
|
50
|
+
const sorted = {};
|
|
51
|
+
if (Object.hasOwn(businessUnits, '_ParentBU_')) {
|
|
52
|
+
sorted['_ParentBU_'] = businessUnits['_ParentBU_'];
|
|
53
|
+
}
|
|
54
|
+
for (const key of Object.keys(businessUnits)
|
|
55
|
+
.filter((k) => k !== '_ParentBU_')
|
|
56
|
+
.toSorted((a, b) => a.localeCompare(b, undefined, { sensitivity: 'base' }))) {
|
|
57
|
+
sorted[key] = businessUnits[key];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return { eid, businessUnits: sorted };
|
|
50
61
|
}
|
|
51
62
|
|
|
52
63
|
/**
|
package/lib/config.mjs
CHANGED
|
@@ -170,9 +170,32 @@ export function buildSdkAuthObject(authCred, mid) {
|
|
|
170
170
|
*/
|
|
171
171
|
export function buildSdkOptions(logger = null) {
|
|
172
172
|
/** @type {import('sfmc-sdk').SdkOptions} */
|
|
173
|
-
const options = {
|
|
173
|
+
const options = {
|
|
174
|
+
requestAttempts: 3,
|
|
175
|
+
retryOnConnectionError: true,
|
|
176
|
+
eventHandlers: {
|
|
177
|
+
onLoop: (_type, accumulator) => {
|
|
178
|
+
process.stdout.write(
|
|
179
|
+
` - Requesting next batch (currently ${accumulator?.length ?? 0} records)\n`,
|
|
180
|
+
);
|
|
181
|
+
},
|
|
182
|
+
onConnectionError: (ex, remainingAttempts) => {
|
|
183
|
+
const endpointStr = ex.endpoint ? String(ex.endpoint) : '';
|
|
184
|
+
const endpointSuffix = endpointStr
|
|
185
|
+
? ` - ${endpointStr.split('rest.marketingcloudapis.com')[1] ?? endpointStr}`
|
|
186
|
+
: '';
|
|
187
|
+
process.stdout.write(
|
|
188
|
+
` - Connection problem (Code: ${ex.code}). Retrying ${remainingAttempts} time${
|
|
189
|
+
remainingAttempts > 1 ? 's' : ''
|
|
190
|
+
}${endpointSuffix}\n`,
|
|
191
|
+
);
|
|
192
|
+
console.error(ex);
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
};
|
|
174
196
|
if (logger) {
|
|
175
197
|
options.eventHandlers = {
|
|
198
|
+
...options.eventHandlers,
|
|
176
199
|
logRequest: (req) => {
|
|
177
200
|
const msg = structuredClone(req);
|
|
178
201
|
if (msg.headers?.Authorization) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sfmc-dataloader",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.1",
|
|
4
4
|
"description": "SFMC Data Loader CLI (mcdata) — standalone export/import of Marketing Cloud Data Extension rows; optional mcdev integration",
|
|
5
5
|
"author": "Jörn Berkefeld <joern.berkefeld@gmail.com>",
|
|
6
6
|
"license": "MIT",
|