ga4-export-fixer 0.4.7-dev.1 → 0.4.7-dev.3

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ga4-export-fixer",
3
- "version": "0.4.7-dev.1",
3
+ "version": "0.4.7-dev.3",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -17,11 +17,14 @@
17
17
  "createTable.js"
18
18
  ],
19
19
  "scripts": {
20
- "test": "node tests/ga4EventsEnhanced.test.js && node tests/mergeSQLConfigurations.test.js && node tests/preOperations.test.js && node tests/documentation.test.js",
20
+ "test": "node tests/ga4EventsEnhanced.test.js && node tests/mergeSQLConfigurations.test.js && node tests/preOperations.test.js && node tests/documentation.test.js && node tests/inputValidation.test.js && node tests/createTable.test.js",
21
+ "test:summary": "node tests/testRunner.js",
21
22
  "test:docs": "node tests/documentation.test.js",
22
23
  "test:preops": "node tests/preOperations.test.js",
23
24
  "test:events": "node tests/ga4EventsEnhanced.test.js",
24
25
  "test:merge": "node tests/mergeSQLConfigurations.test.js",
26
+ "test:validation": "node tests/inputValidation.test.js",
27
+ "test:createTable": "node tests/createTable.test.js",
25
28
  "test:integration": "node tests/integration/integration.test.js",
26
29
  "readme": "node scripts/updateReadme.js",
27
30
  "prepublishOnly": "node scripts/updateReadme.js"
@@ -157,7 +157,7 @@ const getFinalColumnOrder = (eventDataStep, sessionDataStep) => {
157
157
  */
158
158
  const _generateEnhancedEventsSQL = (mergedConfig) => {
159
159
  // the most accurate available timestamp column
160
- const mainTimestampColumn = mergedConfig.customTimestampParam ? 'event_custom_timestamp' : 'event_timestamp';
160
+ const timestampColumn = mergedConfig.customTimestampParam ? 'event_custom_timestamp' : 'event_timestamp';
161
161
 
162
162
  // exlude these events from the table
163
163
  const excludedEvents = mergedConfig.excludedEvents;
@@ -236,12 +236,12 @@ ${excludedEventsSQL}`,
236
236
  name: 'session_data',
237
237
  columns: {
238
238
  session_id: 'session_id',
239
- user_id: helpers.aggregateValue('user_id', 'last', mainTimestampColumn),
240
- merged_user_id: `ifnull(${helpers.aggregateValue('user_id', 'last', mainTimestampColumn)}, any_value(user_pseudo_id))`,
241
- session_params: helpers.aggregateSessionParams(mergedConfig.sessionParams, 'session_params_prep', mainTimestampColumn),
242
- session_traffic_source_last_click: helpers.aggregateValue('session_traffic_source_last_click', 'first', mainTimestampColumn),
243
- session_first_traffic_source: `array_agg(collected_traffic_source order by ${mainTimestampColumn} limit 1)[safe_offset(0)]`, // don't ignore nulls
244
- landing_page: helpers.aggregateValue(`if(entrances > 0, page, null)`, 'first', mainTimestampColumn),
239
+ user_id: helpers.aggregateValue('user_id', 'last', timestampColumn),
240
+ merged_user_id: `ifnull(${helpers.aggregateValue('user_id', 'last', timestampColumn)}, any_value(user_pseudo_id))`,
241
+ session_params: helpers.aggregateSessionParams(mergedConfig.sessionParams, 'session_params_prep', timestampColumn),
242
+ session_traffic_source_last_click: helpers.aggregateValue('session_traffic_source_last_click', 'first', timestampColumn),
243
+ session_first_traffic_source: `array_agg(collected_traffic_source order by ${timestampColumn} limit 1)[safe_offset(0)]`, // don't ignore nulls
244
+ landing_page: helpers.aggregateValue(`if(entrances > 0, page, null)`, 'first', timestampColumn),
245
245
  },
246
246
  from: 'event_data',
247
247
  where: `session_id is not null`,
@@ -346,8 +346,20 @@ const setPreOperations = (config) => {
346
346
  return preOperations.setPreOperations(mergedConfig);
347
347
  };
348
348
 
349
+ const getColumnDescriptions = (config) => {
350
+ const mergedConfig = utils.mergeSQLConfigurations(defaultConfig, config);
351
+ return documentation.getColumnDescriptions(mergedConfig, columnMetadata);
352
+ };
353
+
354
+ const getTableDescription = (config) => {
355
+ const mergedConfig = utils.mergeSQLConfigurations(defaultConfig, config);
356
+ return documentation.buildTableDescription(mergedConfig, getTableDescriptionSections(mergedConfig));
357
+ };
358
+
349
359
  module.exports = {
350
- generateSql: generateEnhancedEventsSQL,
351
360
  createTable: createEnhancedEventsTable,
352
- setPreOperations: setPreOperations
361
+ generateSql: generateEnhancedEventsSQL,
362
+ setPreOperations: setPreOperations,
363
+ getColumnDescriptions: getColumnDescriptions,
364
+ getTableDescription: getTableDescription
353
365
  }