ga4-export-fixer 0.4.3-dev.0 → 0.4.3-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/documentation.js +8 -6
- package/package.json +1 -1
- package/tables/ga4EventsEnhanced.js +16 -11
package/documentation.js
CHANGED
|
@@ -282,13 +282,15 @@ const getTableDescription = (config) => {
|
|
|
282
282
|
sections.push(`${constants.TABLE_DESCRIPTION_SUFFIX}\n${constants.TABLE_DESCRIPTION_DOCUMENTATION_LINK}`);
|
|
283
283
|
|
|
284
284
|
// 8. Config JSON dump
|
|
285
|
-
const
|
|
286
|
-
Object.
|
|
287
|
-
Object.entries(config).filter(([key]) => !key.startsWith('default') && key !== 'dataformTableConfig')
|
|
288
|
-
),
|
|
289
|
-
null,
|
|
290
|
-
2
|
|
285
|
+
const configForDump = Object.fromEntries(
|
|
286
|
+
Object.entries(config).filter(([key]) => !key.startsWith('default'))
|
|
291
287
|
);
|
|
288
|
+
// Strip description and columns from dataformTableConfig to avoid circular reference and bloat
|
|
289
|
+
if (configForDump.dataformTableConfig) {
|
|
290
|
+
const { description, columns, ...rest } = configForDump.dataformTableConfig;
|
|
291
|
+
configForDump.dataformTableConfig = rest;
|
|
292
|
+
}
|
|
293
|
+
const configJson = JSON.stringify(configForDump, null, 2);
|
|
292
294
|
sections.push(`The last full table refresh was done using this configuration:\n${configJson}`);
|
|
293
295
|
|
|
294
296
|
return sections.join('\n\n');
|
package/package.json
CHANGED
|
@@ -327,8 +327,6 @@ const createEnhancedEventsTable = (dataformPublish, config) => {
|
|
|
327
327
|
|
|
328
328
|
const mergedConfig = utils.mergeSQLConfigurations(defaultConfig, sqlConfig);
|
|
329
329
|
|
|
330
|
-
const tableDescription = documentation.getTableDescription(mergedConfig);
|
|
331
|
-
|
|
332
330
|
// Static defaults from defaultConfig.js (via mergedConfig, without user overrides)
|
|
333
331
|
const staticDefaults = mergedConfig.dataformTableConfig || {};
|
|
334
332
|
|
|
@@ -345,19 +343,26 @@ const createEnhancedEventsTable = (dataformPublish, config) => {
|
|
|
345
343
|
|
|
346
344
|
const dataset = getDatasetName(mergedConfig.sourceTable);
|
|
347
345
|
|
|
348
|
-
|
|
349
|
-
name: `${constants.DEFAULT_EVENTS_TABLE_NAME}_${dataset.replace('analytics_', '')}`,
|
|
350
|
-
schema: dataset,
|
|
351
|
-
description: tableDescription,
|
|
352
|
-
columns: documentation.getColumnDescriptions(mergedConfig),
|
|
353
|
-
};
|
|
354
|
-
|
|
355
|
-
// Merge: static defaults → dynamic fields → user overrides
|
|
346
|
+
// Merge: static defaults → dynamic fields (except description) → user overrides
|
|
356
347
|
const dataformTableConfig = utils.mergeDataformTableConfigurations(
|
|
357
|
-
{
|
|
348
|
+
{
|
|
349
|
+
...staticDefaults,
|
|
350
|
+
name: `${constants.DEFAULT_EVENTS_TABLE_NAME}_${dataset.replace('analytics_', '')}`,
|
|
351
|
+
schema: dataset,
|
|
352
|
+
columns: documentation.getColumnDescriptions(mergedConfig),
|
|
353
|
+
},
|
|
358
354
|
userDataformTableConfig
|
|
359
355
|
);
|
|
360
356
|
|
|
357
|
+
// Include the final dataformTableConfig in mergedConfig for the description's config dump
|
|
358
|
+
mergedConfig.dataformTableConfig = dataformTableConfig;
|
|
359
|
+
const tableDescription = documentation.getTableDescription(mergedConfig);
|
|
360
|
+
|
|
361
|
+
// Set description (user override from the merge wins if provided)
|
|
362
|
+
if (!dataformTableConfig.description) {
|
|
363
|
+
dataformTableConfig.description = tableDescription;
|
|
364
|
+
}
|
|
365
|
+
|
|
361
366
|
// create the table using Dataform publish()
|
|
362
367
|
return dataformPublish(dataformTableConfig.name, dataformTableConfig).preOps(ctx => {
|
|
363
368
|
return preOperations.setPreOperations(utils.setDataformContext(ctx, mergedConfig));
|