@firebaseextensions/firestore-bigquery-change-tracker 1.1.41 → 1.1.42

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.
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Partitioning = void 0;
4
+ const __1 = require("..");
4
5
  const firebase = require("firebase-admin");
5
6
  const logs = require("../logs");
6
7
  const functions = require("firebase-functions");
@@ -143,11 +144,15 @@ class Partitioning {
143
144
  Delete changes events have no data, return early as cannot partition on empty data.
144
145
  **/
145
146
  getPartitionValue(event) {
146
- if (!event.data)
147
+ // When old data is disabled and the operation is delete
148
+ // the data and old data will be null
149
+ if (event.data == null && event.oldData == null)
147
150
  return {};
148
151
  const firestoreFieldName = this.config.timePartitioningFirestoreField;
149
152
  const fieldName = this.config.timePartitioningField;
150
- const fieldValue = event.data[firestoreFieldName];
153
+ const fieldValue = event.operation === __1.ChangeType.DELETE
154
+ ? event.oldData[firestoreFieldName]
155
+ : event.data[firestoreFieldName];
151
156
  if (!fieldName || !fieldValue) {
152
157
  return {};
153
158
  }
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "url": "github.com/firebase/extensions.git",
6
6
  "directory": "firestore-bigquery-export/firestore-bigquery-change-tracker"
7
7
  },
8
- "version": "1.1.41",
8
+ "version": "1.1.42",
9
9
  "description": "Core change-tracker library for Cloud Firestore Collection BigQuery Exports",
10
10
  "main": "./lib/index.js",
11
11
  "scripts": {