ga4-export-fixer 0.1.5 → 0.1.6-dev.0

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/index.js CHANGED
@@ -1,7 +1,26 @@
1
1
  const helpers = require('./helpers.js');
2
2
  const ga4EventsEnhanced = require('./tables/ga4EventsEnhanced.js');
3
+ const preOperations = require('./preOperations.js');
4
+
5
+ // export setPreOperations with default configuration for usage with downstream tables
6
+ const setPreOperations = (self, incremental, preOperationsConfig) => {
7
+ const defaultPreOperationsConfig = {
8
+ dateRangeStartFullRefresh: 'date(2000, 1, 1)',
9
+ dateRangeEnd: 'current_date()',
10
+ numberOfPreviousDaysToScan: 10,
11
+ };
12
+
13
+ const config = {
14
+ self,
15
+ incremental,
16
+ preOperations: {...defaultPreOperationsConfig, ...preOperationsConfig}
17
+ };
18
+
19
+ return preOperations.setPreOperations(config);
20
+ };
3
21
 
4
22
  module.exports = {
5
23
  helpers,
6
- ga4EventsEnhanced
24
+ ga4EventsEnhanced,
25
+ setPreOperations
7
26
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ga4-export-fixer",
3
- "version": "0.1.5",
3
+ "version": "0.1.6-dev.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "files": [
package/preOperations.js CHANGED
@@ -141,7 +141,7 @@ const setPreOperations = (config) => {
141
141
  type: 'variable',
142
142
  name: constants.INTRADAY_DATE_RANGE_START_VARIABLE,
143
143
  // variable only needed if intraday export tables are included together with daily export tables
144
- value: config.includedExportTypes.intraday && config.includedExportTypes.daily ? getDateRangeStartIntraday(config) : undefined,
144
+ value: config.sourceTableType === 'GA4_EXPORT' && config.includedExportTypes.intraday && config.includedExportTypes.daily ? getDateRangeStartIntraday(config) : undefined,
145
145
  comment: 'Define the date range start for intraday export tables. Avoid returning intraday data if it overlaps with daily export data. Only needed if intraday export tables are included together with daily export tables.',
146
146
  },
147
147
  {
@@ -160,7 +160,7 @@ const setPreOperations = (config) => {
160
160
  {
161
161
  type: 'create',
162
162
  // create table statement only needed with schema lock
163
- value: config.schemaLock ? createSchemaLockTable(config) : undefined,
163
+ value: config.sourceTableType === 'GA4_EXPORT' && config.schemaLock ? createSchemaLockTable(config) : undefined,
164
164
  comment: 'Lock the schema to a specific version by creating a table copy from the selected day\'s export.'
165
165
  },
166
166
  ];
@@ -7,6 +7,7 @@ const preOperations = require('../preOperations.js');
7
7
  const defaultConfig = {
8
8
  // required
9
9
  sourceTable: undefined,
10
+ sourceTableType: 'GA4_EXPORT', // used with pre operations to detect if ga4 export specific pre operations are needed
10
11
  self: undefined,
11
12
  incremental: undefined,
12
13
  // optional but recommended