ga4-export-fixer 0.2.1-dev.0 → 0.2.1-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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/utils.js +12 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ga4-export-fixer",
3
- "version": "0.2.1-dev.0",
3
+ "version": "0.2.1-dev.1",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "files": [
package/utils.js CHANGED
@@ -123,16 +123,9 @@ const mergeSQLConfigurations = (defaultConfig, inputConfig = {}) => {
123
123
  continue;
124
124
  }
125
125
 
126
- // Handle arrays: merge with default counterpart if one exists, otherwise overwrite
126
+ // Handle arrays: overwrite with input value (default counterpart merging happens post-loop)
127
127
  if (Array.isArray(defaultValue) && Array.isArray(inputValue)) {
128
- // check if the array has a "default" counterpart
129
- // for example, excludedEvents and defaultExcludedEvents
130
- const defaultKey = 'default' + key.charAt(0).toUpperCase() + key.slice(1);
131
- if (!key.startsWith('default') && defaultKey in result) {
132
- result[key] = mergeUniqueArrays(inputValue, result[defaultKey]);
133
- } else {
134
- result[key] = inputValue;
135
- }
128
+ result[key] = inputValue;
136
129
  continue;
137
130
  }
138
131
 
@@ -153,6 +146,16 @@ const mergeSQLConfigurations = (defaultConfig, inputConfig = {}) => {
153
146
  result[key] = inputValue;
154
147
  }
155
148
 
149
+ // Merge arrays with their default counterparts (e.g. excludedEvents + defaultExcludedEvents)
150
+ // This runs regardless of whether the user provided the array in inputConfig
151
+ for (const key in result) {
152
+ if (!result.hasOwnProperty(key) || key.startsWith('default')) continue;
153
+ const defaultKey = 'default' + key.charAt(0).toUpperCase() + key.slice(1);
154
+ if (defaultKey in result && Array.isArray(result[key]) && Array.isArray(result[defaultKey])) {
155
+ result[key] = mergeUniqueArrays(result[key], result[defaultKey]);
156
+ }
157
+ }
158
+
156
159
  // process configuration date fields
157
160
  // BigQuery SQL statements are excepted
158
161
  // string dates such as '20260101' or '2026-01-01' are processed