@owox/connectors 0.16.0-next-20251225011133 → 0.16.0-next-20251231124015
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/dist/index.cjs +46 -19
- package/dist/index.js +46 -19
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1257,6 +1257,14 @@ var FormatUtils = {
|
|
|
1257
1257
|
(acc[key] = acc[key] || []).push(value.trim());
|
|
1258
1258
|
return acc;
|
|
1259
1259
|
}, {});
|
|
1260
|
+
},
|
|
1261
|
+
/**
|
|
1262
|
+
* Parse account IDs from a comma/semicolon separated string
|
|
1263
|
+
* @param {string} accountIdsString - Comma/semicolon separated list of account IDs
|
|
1264
|
+
* @return {Array<string>} Array of trimmed account IDs (non-empty strings)
|
|
1265
|
+
*/
|
|
1266
|
+
parseAccountIds: function(accountIdsString) {
|
|
1267
|
+
return String(accountIdsString).split(/[,;]\s*/).filter((id) => id.trim().length > 0);
|
|
1260
1268
|
}
|
|
1261
1269
|
};
|
|
1262
1270
|
var FileUtils = class FileUtils2 {
|
|
@@ -1296,6 +1304,20 @@ var DateUtils = class DateUtils2 {
|
|
|
1296
1304
|
* @param {Date} date - The date to format.
|
|
1297
1305
|
* @returns {string} ISO formatted date (YYYY-MM-DD)
|
|
1298
1306
|
*/
|
|
1307
|
+
/**
|
|
1308
|
+
* Parse input into a valid Date object or return null.
|
|
1309
|
+
* Handles Unix timestamps (numeric strings/numbers) and ISO strings.
|
|
1310
|
+
*
|
|
1311
|
+
* @param {string|number|null} value - The value to parse
|
|
1312
|
+
* @returns {Date|null} Date object or null if invalid/empty
|
|
1313
|
+
*/
|
|
1314
|
+
static parseDate(value) {
|
|
1315
|
+
if (!value) {
|
|
1316
|
+
return null;
|
|
1317
|
+
}
|
|
1318
|
+
const date = new Date(value);
|
|
1319
|
+
return isNaN(date.getTime()) ? null : date;
|
|
1320
|
+
}
|
|
1299
1321
|
static formatDate(date) {
|
|
1300
1322
|
return date.toISOString().split("T")[0];
|
|
1301
1323
|
}
|
|
@@ -14332,11 +14354,11 @@ API Response: ${JSON.stringify(statusResult, null, 2)}`);
|
|
|
14332
14354
|
description: "Your Microsoft Ads API Refresh Token",
|
|
14333
14355
|
attributes: [CONFIG_ATTRIBUTES2.SECRET]
|
|
14334
14356
|
},
|
|
14335
|
-
|
|
14357
|
+
AccountIDs: {
|
|
14336
14358
|
isRequired: true,
|
|
14337
14359
|
requiredType: "string",
|
|
14338
|
-
label: "Account ID",
|
|
14339
|
-
description: "Your Microsoft Ads Account
|
|
14360
|
+
label: "Account ID(s)",
|
|
14361
|
+
description: "Your Microsoft Ads Account IDs (comma separated)"
|
|
14340
14362
|
},
|
|
14341
14363
|
CustomerID: {
|
|
14342
14364
|
isRequired: true,
|
|
@@ -14796,13 +14818,18 @@ API Response: ${JSON.stringify(statusResult, null, 2)}`);
|
|
|
14796
14818
|
* Processes all nodes defined in the fields configuration
|
|
14797
14819
|
*/
|
|
14798
14820
|
async startImportProcess() {
|
|
14821
|
+
const accountIds = FormatUtils.parseAccountIds(this.config.AccountIDs.value);
|
|
14799
14822
|
const fields = MicrosoftAdsHelper.parseFields(this.config.Fields.value);
|
|
14800
|
-
for (const
|
|
14801
|
-
|
|
14802
|
-
|
|
14803
|
-
|
|
14804
|
-
|
|
14805
|
-
|
|
14823
|
+
for (const rawAccountId of accountIds) {
|
|
14824
|
+
const accountId = rawAccountId.trim();
|
|
14825
|
+
this.config.logMessage(`Starting import process for Account ID: ${accountId}`);
|
|
14826
|
+
for (const nodeName in fields) {
|
|
14827
|
+
await this.processNode({
|
|
14828
|
+
nodeName,
|
|
14829
|
+
accountId,
|
|
14830
|
+
fields: fields[nodeName] || []
|
|
14831
|
+
});
|
|
14832
|
+
}
|
|
14806
14833
|
}
|
|
14807
14834
|
}
|
|
14808
14835
|
/**
|
|
@@ -22835,8 +22862,8 @@ const FacebookMarketing = (function() {
|
|
|
22835
22862
|
"limit": 500
|
|
22836
22863
|
},
|
|
22837
22864
|
"ad-group": {
|
|
22838
|
-
"overview": "Ad",
|
|
22839
|
-
"description": "
|
|
22865
|
+
"overview": "Ad Object (formerly Ad Group)",
|
|
22866
|
+
"description": "Represents an Ad object (historically called 'Ad Group'). This is the entity for individual ads in Facebook's API.",
|
|
22840
22867
|
"documentation": "https://developers.facebook.com/docs/marketing-api/reference/adgroup/",
|
|
22841
22868
|
"fields": adGroupFields,
|
|
22842
22869
|
"uniqueKeys": ["id"],
|
|
@@ -23170,14 +23197,14 @@ const FacebookMarketing = (function() {
|
|
|
23170
23197
|
}
|
|
23171
23198
|
//---- fetchData -------------------------------------------------
|
|
23172
23199
|
/*
|
|
23173
|
-
|
|
23174
|
-
|
|
23175
|
-
|
|
23176
|
-
|
|
23200
|
+
@param nodeName string
|
|
23201
|
+
@param accountId string
|
|
23202
|
+
@param fields array
|
|
23203
|
+
@param startDate date
|
|
23177
23204
|
|
|
23178
|
-
|
|
23205
|
+
@return data array
|
|
23179
23206
|
|
|
23180
|
-
|
|
23207
|
+
*/
|
|
23181
23208
|
async fetchData(nodeName, accountId, fields, startDate = null) {
|
|
23182
23209
|
let url = "https://graph.facebook.com/v23.0/";
|
|
23183
23210
|
let formattedDate = null;
|
|
@@ -23234,7 +23261,7 @@ const FacebookMarketing = (function() {
|
|
|
23234
23261
|
let type = this.fieldsSchema[nodeName]["fields"][field]["type"];
|
|
23235
23262
|
switch (true) {
|
|
23236
23263
|
case (type == "string" && field.slice(0, 5) == "date_"):
|
|
23237
|
-
record[field] =
|
|
23264
|
+
record[field] = DateUtils3.parseDate(record[field] ? record[field] + "T00:00:00Z" : null);
|
|
23238
23265
|
break;
|
|
23239
23266
|
case (type == "numeric string" && (field.slice(-3) == "_id" || field == "id")):
|
|
23240
23267
|
record[field] = String(record[field]);
|
|
@@ -23255,7 +23282,7 @@ const FacebookMarketing = (function() {
|
|
|
23255
23282
|
record[field] = Boolean(record[field]);
|
|
23256
23283
|
break;
|
|
23257
23284
|
case type == "datetime":
|
|
23258
|
-
record[field] =
|
|
23285
|
+
record[field] = DateUtils3.parseDate(record[field]);
|
|
23259
23286
|
break;
|
|
23260
23287
|
case type == "int32":
|
|
23261
23288
|
record[field] = parseInt(record[field]);
|
package/dist/index.js
CHANGED
|
@@ -1255,6 +1255,14 @@ var FormatUtils = {
|
|
|
1255
1255
|
(acc[key] = acc[key] || []).push(value.trim());
|
|
1256
1256
|
return acc;
|
|
1257
1257
|
}, {});
|
|
1258
|
+
},
|
|
1259
|
+
/**
|
|
1260
|
+
* Parse account IDs from a comma/semicolon separated string
|
|
1261
|
+
* @param {string} accountIdsString - Comma/semicolon separated list of account IDs
|
|
1262
|
+
* @return {Array<string>} Array of trimmed account IDs (non-empty strings)
|
|
1263
|
+
*/
|
|
1264
|
+
parseAccountIds: function(accountIdsString) {
|
|
1265
|
+
return String(accountIdsString).split(/[,;]\s*/).filter((id) => id.trim().length > 0);
|
|
1258
1266
|
}
|
|
1259
1267
|
};
|
|
1260
1268
|
var FileUtils = class FileUtils2 {
|
|
@@ -1294,6 +1302,20 @@ var DateUtils = class DateUtils2 {
|
|
|
1294
1302
|
* @param {Date} date - The date to format.
|
|
1295
1303
|
* @returns {string} ISO formatted date (YYYY-MM-DD)
|
|
1296
1304
|
*/
|
|
1305
|
+
/**
|
|
1306
|
+
* Parse input into a valid Date object or return null.
|
|
1307
|
+
* Handles Unix timestamps (numeric strings/numbers) and ISO strings.
|
|
1308
|
+
*
|
|
1309
|
+
* @param {string|number|null} value - The value to parse
|
|
1310
|
+
* @returns {Date|null} Date object or null if invalid/empty
|
|
1311
|
+
*/
|
|
1312
|
+
static parseDate(value) {
|
|
1313
|
+
if (!value) {
|
|
1314
|
+
return null;
|
|
1315
|
+
}
|
|
1316
|
+
const date = new Date(value);
|
|
1317
|
+
return isNaN(date.getTime()) ? null : date;
|
|
1318
|
+
}
|
|
1297
1319
|
static formatDate(date) {
|
|
1298
1320
|
return date.toISOString().split("T")[0];
|
|
1299
1321
|
}
|
|
@@ -14330,11 +14352,11 @@ API Response: ${JSON.stringify(statusResult, null, 2)}`);
|
|
|
14330
14352
|
description: "Your Microsoft Ads API Refresh Token",
|
|
14331
14353
|
attributes: [CONFIG_ATTRIBUTES2.SECRET]
|
|
14332
14354
|
},
|
|
14333
|
-
|
|
14355
|
+
AccountIDs: {
|
|
14334
14356
|
isRequired: true,
|
|
14335
14357
|
requiredType: "string",
|
|
14336
|
-
label: "Account ID",
|
|
14337
|
-
description: "Your Microsoft Ads Account
|
|
14358
|
+
label: "Account ID(s)",
|
|
14359
|
+
description: "Your Microsoft Ads Account IDs (comma separated)"
|
|
14338
14360
|
},
|
|
14339
14361
|
CustomerID: {
|
|
14340
14362
|
isRequired: true,
|
|
@@ -14794,13 +14816,18 @@ API Response: ${JSON.stringify(statusResult, null, 2)}`);
|
|
|
14794
14816
|
* Processes all nodes defined in the fields configuration
|
|
14795
14817
|
*/
|
|
14796
14818
|
async startImportProcess() {
|
|
14819
|
+
const accountIds = FormatUtils.parseAccountIds(this.config.AccountIDs.value);
|
|
14797
14820
|
const fields = MicrosoftAdsHelper.parseFields(this.config.Fields.value);
|
|
14798
|
-
for (const
|
|
14799
|
-
|
|
14800
|
-
|
|
14801
|
-
|
|
14802
|
-
|
|
14803
|
-
|
|
14821
|
+
for (const rawAccountId of accountIds) {
|
|
14822
|
+
const accountId = rawAccountId.trim();
|
|
14823
|
+
this.config.logMessage(`Starting import process for Account ID: ${accountId}`);
|
|
14824
|
+
for (const nodeName in fields) {
|
|
14825
|
+
await this.processNode({
|
|
14826
|
+
nodeName,
|
|
14827
|
+
accountId,
|
|
14828
|
+
fields: fields[nodeName] || []
|
|
14829
|
+
});
|
|
14830
|
+
}
|
|
14804
14831
|
}
|
|
14805
14832
|
}
|
|
14806
14833
|
/**
|
|
@@ -22833,8 +22860,8 @@ const FacebookMarketing = (function() {
|
|
|
22833
22860
|
"limit": 500
|
|
22834
22861
|
},
|
|
22835
22862
|
"ad-group": {
|
|
22836
|
-
"overview": "Ad",
|
|
22837
|
-
"description": "
|
|
22863
|
+
"overview": "Ad Object (formerly Ad Group)",
|
|
22864
|
+
"description": "Represents an Ad object (historically called 'Ad Group'). This is the entity for individual ads in Facebook's API.",
|
|
22838
22865
|
"documentation": "https://developers.facebook.com/docs/marketing-api/reference/adgroup/",
|
|
22839
22866
|
"fields": adGroupFields,
|
|
22840
22867
|
"uniqueKeys": ["id"],
|
|
@@ -23168,14 +23195,14 @@ const FacebookMarketing = (function() {
|
|
|
23168
23195
|
}
|
|
23169
23196
|
//---- fetchData -------------------------------------------------
|
|
23170
23197
|
/*
|
|
23171
|
-
|
|
23172
|
-
|
|
23173
|
-
|
|
23174
|
-
|
|
23198
|
+
@param nodeName string
|
|
23199
|
+
@param accountId string
|
|
23200
|
+
@param fields array
|
|
23201
|
+
@param startDate date
|
|
23175
23202
|
|
|
23176
|
-
|
|
23203
|
+
@return data array
|
|
23177
23204
|
|
|
23178
|
-
|
|
23205
|
+
*/
|
|
23179
23206
|
async fetchData(nodeName, accountId, fields, startDate = null) {
|
|
23180
23207
|
let url = "https://graph.facebook.com/v23.0/";
|
|
23181
23208
|
let formattedDate = null;
|
|
@@ -23232,7 +23259,7 @@ const FacebookMarketing = (function() {
|
|
|
23232
23259
|
let type = this.fieldsSchema[nodeName]["fields"][field]["type"];
|
|
23233
23260
|
switch (true) {
|
|
23234
23261
|
case (type == "string" && field.slice(0, 5) == "date_"):
|
|
23235
|
-
record[field] =
|
|
23262
|
+
record[field] = DateUtils3.parseDate(record[field] ? record[field] + "T00:00:00Z" : null);
|
|
23236
23263
|
break;
|
|
23237
23264
|
case (type == "numeric string" && (field.slice(-3) == "_id" || field == "id")):
|
|
23238
23265
|
record[field] = String(record[field]);
|
|
@@ -23253,7 +23280,7 @@ const FacebookMarketing = (function() {
|
|
|
23253
23280
|
record[field] = Boolean(record[field]);
|
|
23254
23281
|
break;
|
|
23255
23282
|
case type == "datetime":
|
|
23256
|
-
record[field] =
|
|
23283
|
+
record[field] = DateUtils3.parseDate(record[field]);
|
|
23257
23284
|
break;
|
|
23258
23285
|
case type == "int32":
|
|
23259
23286
|
record[field] = parseInt(record[field]);
|