ga4-export-fixer 0.1.3 → 0.1.4-dev.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/package.json +1 -1
- package/tables/ga4EventsEnhanced.js +14 -9
package/package.json
CHANGED
|
@@ -419,15 +419,20 @@ Created by the ga4-export-fixer package.`;
|
|
|
419
419
|
|
|
420
420
|
// set the default values for table name and dataset, if not provided in the config
|
|
421
421
|
const setDefaults = () => {
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
}
|
|
422
|
+
const getDatasetName = (sourceTable) => {
|
|
423
|
+
if (utils.isDataformTableReferenceObject(sourceTable)) {
|
|
424
|
+
return sourceTable.dataset || sourceTable.schema;
|
|
425
|
+
}
|
|
426
|
+
if (typeof sourceTable === 'string' && /^`[^\.]+\.[^\.]+\.[^\.]+`$/.test(sourceTable)) {
|
|
427
|
+
return sourceTable.split('.')[1];
|
|
428
|
+
}
|
|
429
|
+
throw new Error(`Unable to extract the dataset name from sourceTable, received: ${JSON.stringify(sourceTable)}`);
|
|
430
|
+
};
|
|
431
|
+
|
|
432
|
+
const dataset = getDatasetName(mergedConfig.sourceTable);
|
|
433
|
+
|
|
434
|
+
defaultDataformTableConfig.name = `${constants.DEFAULT_EVENTS_TABLE_NAME}_${dataset.replace('analytics_', '')}`;
|
|
435
|
+
defaultDataformTableConfig.schema = dataset;
|
|
431
436
|
};
|
|
432
437
|
|
|
433
438
|
setDefaults();
|