@firebase-function-kits/firestore-bigquery-export 0.0.2-rc.1 → 0.0.2-rc.10
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/CHANGELOG.md +4 -0
- package/README.md +236 -84
- package/lib/config.d.ts +3 -2
- package/lib/config.d.ts.map +1 -1
- package/lib/config.js +58 -57
- package/lib/config.js.map +1 -1
- package/lib/events.d.ts.map +1 -1
- package/lib/events.js.map +1 -1
- package/lib/export-config.d.ts +19 -5
- package/lib/export-config.d.ts.map +1 -1
- package/lib/export-config.js +6 -1
- package/lib/export-config.js.map +1 -1
- package/lib/handlers.d.ts +38 -6
- package/lib/handlers.d.ts.map +1 -1
- package/lib/handlers.js +63 -18
- package/lib/handlers.js.map +1 -1
- package/lib/index.d.ts +13 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +51 -12
- package/lib/index.js.map +1 -1
- package/lib/init.d.ts +1 -1
- package/lib/init.js +1 -1
- package/lib/init.js.map +1 -1
- package/lib/lib.d.ts +1 -1
- package/lib/lib.d.ts.map +1 -1
- package/lib/lib.js +2 -1
- package/lib/lib.js.map +1 -1
- package/lib/logs.d.ts +2 -2
- package/lib/logs.d.ts.map +1 -1
- package/lib/logs.js +4 -3
- package/lib/logs.js.map +1 -1
- package/lib/region.d.ts +7 -0
- package/lib/region.d.ts.map +1 -0
- package/lib/region.js +37 -0
- package/lib/region.js.map +1 -0
- package/lib/tasks.d.ts +40 -0
- package/lib/tasks.d.ts.map +1 -0
- package/lib/tasks.js +107 -0
- package/lib/tasks.js.map +1 -0
- package/lib/util.d.ts.map +1 -1
- package/lib/util.js.map +1 -1
- package/npm-shrinkwrap.json +160 -780
- package/package.json +10 -4
- package/src/config.ts +70 -59
- package/src/export-config.ts +26 -6
- package/src/handlers.ts +96 -27
- package/src/index.ts +71 -13
- package/src/init.ts +1 -1
- package/src/lib.ts +2 -0
- package/src/logs.ts +5 -3
- package/src/region.ts +37 -0
- package/src/tasks.ts +126 -0
- package/tests/config.test.ts +101 -14
- package/tests/export-config.test.ts +10 -4
- package/tests/handlers.test.ts +139 -10
- package/tests/index.test.ts +162 -0
- package/tests/region.test.ts +44 -0
- package/tests/required-apis.test.ts +55 -0
- package/tests/tasks.emulator.test.ts +131 -0
- package/tests/tasks.test.ts +229 -0
- package/tsconfig.tsbuildinfo +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -1,10 +1,21 @@
|
|
|
1
|
+
import { type SerializedDocumentChange } from "./handlers";
|
|
1
2
|
export * from "./lib";
|
|
2
3
|
/**
|
|
3
4
|
* Firestore trigger: streams document writes on the watched collection into the
|
|
4
|
-
* BigQuery changelog table.
|
|
5
|
-
*
|
|
5
|
+
* BigQuery changelog table. A failed inline write buffers through the
|
|
6
|
+
* `syncBigQuery` queue and the execution still succeeds. No runtime retry
|
|
7
|
+
* policy, as in the extension: a failure before the write is attempted fails
|
|
8
|
+
* the execution once, and a failed enqueue is logged and dropped.
|
|
6
9
|
*/
|
|
7
10
|
export declare const fsexportbigquery: import("firebase-functions/core").CloudFunction<import("firebase-functions/firestore").FirestoreEvent<import("firebase-functions/firestore").Change<import("firebase-functions/firestore").DocumentSnapshot>, Record<string, string>>>;
|
|
11
|
+
/**
|
|
12
|
+
* Write-buffer task queue: re-attempts writes that failed inline, on Cloud
|
|
13
|
+
* Tasks' schedule (5 attempts, 60s minimum backoff, dispatch-throttled by
|
|
14
|
+
* `MAX_DISPATCHES_PER_SECOND`). After the last attempt the task is dropped;
|
|
15
|
+
* by then the tracker has written the row to `BACKUP_COLLECTION` on every
|
|
16
|
+
* terminal insert failure, when that collection is configured.
|
|
17
|
+
*/
|
|
18
|
+
export declare const syncBigQuery: import("firebase-functions/tasks").TaskQueueFunction<SerializedDocumentChange>;
|
|
8
19
|
/**
|
|
9
20
|
* First-deploy provisioning task (`afterFirstDeploy`). Runs in the function's
|
|
10
21
|
* own identity, so it has the runtime service account and bound secrets that
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA+CA,OAAO,EAEL,KAAK,wBAAwB,EAG9B,MAAM,YAAY,CAAC;AAOpB,cAAc,OAAO,CAAC;AA+FtB;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,wOAO5B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,gFAgBxB,CAAC;AAWF;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,2DAM5B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,2DAM7B,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -51,12 +51,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
51
51
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
52
52
|
};
|
|
53
53
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
-
exports.setupBigQuerySync = exports.initBigQuerySync = exports.fsexportbigquery = void 0;
|
|
54
|
+
exports.setupBigQuerySync = exports.initBigQuerySync = exports.syncBigQuery = exports.fsexportbigquery = void 0;
|
|
55
55
|
/**
|
|
56
56
|
* Main entry point. Exports the wired functions with deploy-time param
|
|
57
57
|
* expressions, then resolves concrete config lazily at runtime. Re-export
|
|
58
|
-
* `fsexportbigquery` and `initBigQuerySync` from your own
|
|
59
|
-
* entry; configuration comes from a `.env` (or
|
|
58
|
+
* `fsexportbigquery`, `syncBigQuery`, and `initBigQuerySync` from your own
|
|
59
|
+
* functions codebase entry; configuration comes from a `.env` (or
|
|
60
60
|
* `.env.<projectId>`), which the Firebase CLI loads at deploy.
|
|
61
61
|
*
|
|
62
62
|
* Because this module initializes runtime dependencies lazily, deploy discovery
|
|
@@ -77,6 +77,8 @@ const export_config_1 = require("./export-config");
|
|
|
77
77
|
const handlers_1 = require("./handlers");
|
|
78
78
|
const init_1 = require("./init");
|
|
79
79
|
const logs = __importStar(require("./logs"));
|
|
80
|
+
const region_1 = require("./region");
|
|
81
|
+
const tasks_2 = require("./tasks");
|
|
80
82
|
// Re-export the side-effect-free library surface (handlers and config types).
|
|
81
83
|
__exportStar(require("./lib"), exports);
|
|
82
84
|
const INIT_BIGQUERY_SYNC_FUNCTION = "initBigQuerySync";
|
|
@@ -85,6 +87,11 @@ const LIFECYCLE_RETRY_CONFIG = {
|
|
|
85
87
|
maxAttempts: 15,
|
|
86
88
|
minBackoffSeconds: 60,
|
|
87
89
|
};
|
|
90
|
+
const SYNC_RETRY_CONFIG = {
|
|
91
|
+
maxAttempts: 5,
|
|
92
|
+
minBackoffSeconds: 60,
|
|
93
|
+
};
|
|
94
|
+
const SYNC_MAX_CONCURRENT_DISPATCHES = 500;
|
|
88
95
|
const REQUIRED_ROLES = [
|
|
89
96
|
"roles/bigquery.dataEditor",
|
|
90
97
|
"roles/datastore.user",
|
|
@@ -92,8 +99,14 @@ const REQUIRED_ROLES = [
|
|
|
92
99
|
// Gen2 Firestore triggers need Eventarc receive and run.invoker on the function SA.
|
|
93
100
|
"roles/eventarc.eventReceiver",
|
|
94
101
|
"roles/run.invoker",
|
|
102
|
+
// The trigger enqueues failed writes onto its own syncBigQuery task queue.
|
|
103
|
+
"roles/cloudtasks.enqueuer",
|
|
95
104
|
];
|
|
96
105
|
const REQUIRED_APIS = [
|
|
106
|
+
{
|
|
107
|
+
api: "firestore.googleapis.com",
|
|
108
|
+
reason: "Receives document change events from Cloud Firestore.",
|
|
109
|
+
},
|
|
97
110
|
{
|
|
98
111
|
api: "bigquery.googleapis.com",
|
|
99
112
|
reason: "Mirrors data from your Cloud Firestore collection in BigQuery.",
|
|
@@ -129,23 +142,49 @@ function getHandlerContext() {
|
|
|
129
142
|
tracker,
|
|
130
143
|
config,
|
|
131
144
|
ensureInitialized,
|
|
145
|
+
enqueue: (change) => (0, tasks_2.enqueueSyncTask)(change, config.maxEnqueueAttempts),
|
|
132
146
|
};
|
|
133
147
|
return ctx;
|
|
134
148
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
149
|
+
/*
|
|
150
|
+
* Read at module load: the CLI populates `.env` values into the discovery
|
|
151
|
+
* process env (firebase-tools >= 15.28.0), and the region option cannot be a
|
|
152
|
+
* param expression. When unset, no function declares a region and the CLI
|
|
153
|
+
* falls back to its default. The Eventarc trigger region needs no handling:
|
|
154
|
+
* the CLI pins it to the database's own region regardless of where the
|
|
155
|
+
* function runs.
|
|
156
|
+
*/
|
|
157
|
+
const functionRegion = (0, region_1.firestoreLocationToFunctionRegion)(process.env.DATABASE_REGION);
|
|
138
158
|
/**
|
|
139
159
|
* Firestore trigger: streams document writes on the watched collection into the
|
|
140
|
-
* BigQuery changelog table.
|
|
141
|
-
*
|
|
160
|
+
* BigQuery changelog table. A failed inline write buffers through the
|
|
161
|
+
* `syncBigQuery` queue and the execution still succeeds. No runtime retry
|
|
162
|
+
* policy, as in the extension: a failure before the write is attempted fails
|
|
163
|
+
* the execution once, and a failed enqueue is logged and dropped.
|
|
142
164
|
*/
|
|
143
165
|
exports.fsexportbigquery = (0, firestore_1.onDocumentWritten)({
|
|
144
|
-
...
|
|
166
|
+
...(functionRegion ? { region: functionRegion } : {}),
|
|
145
167
|
document: (0, params_1.expr) `${config_1.CONFIG_EXPRESSIONS.collectionPath}/{documentId}`,
|
|
146
168
|
database: config_1.CONFIG_EXPRESSIONS.database,
|
|
147
|
-
retry: true,
|
|
148
169
|
}, (event) => (0, handlers_1.handleDocumentWrite)(event, getHandlerContext()));
|
|
170
|
+
/**
|
|
171
|
+
* Write-buffer task queue: re-attempts writes that failed inline, on Cloud
|
|
172
|
+
* Tasks' schedule (5 attempts, 60s minimum backoff, dispatch-throttled by
|
|
173
|
+
* `MAX_DISPATCHES_PER_SECOND`). After the last attempt the task is dropped;
|
|
174
|
+
* by then the tracker has written the row to `BACKUP_COLLECTION` on every
|
|
175
|
+
* terminal insert failure, when that collection is configured.
|
|
176
|
+
*/
|
|
177
|
+
exports.syncBigQuery = (0, tasks_1.onTaskDispatched)({
|
|
178
|
+
...(functionRegion ? { region: functionRegion } : {}),
|
|
179
|
+
retryConfig: SYNC_RETRY_CONFIG,
|
|
180
|
+
rateLimits: {
|
|
181
|
+
maxConcurrentDispatches: SYNC_MAX_CONCURRENT_DISPATCHES, // A blank .env value reaches this deploy-time expression as 0, which
|
|
182
|
+
// Cloud Tasks would not accept; runtime falls back to the same default.
|
|
183
|
+
maxDispatchesPerSecond: config_1.CONFIG_EXPRESSIONS.maxDispatchesPerSecond
|
|
184
|
+
.lessThan(1)
|
|
185
|
+
.thenElse(export_config_1.DEFAULT_MAX_DISPATCHES_PER_SECOND, config_1.CONFIG_EXPRESSIONS.maxDispatchesPerSecond),
|
|
186
|
+
},
|
|
187
|
+
}, (req) => (0, handlers_1.handleSyncBigQueryTask)(req, getHandlerContext()));
|
|
149
188
|
async function handleBigQuerySyncInitialization() {
|
|
150
189
|
try {
|
|
151
190
|
await getHandlerContext().ensureInitialized();
|
|
@@ -165,7 +204,7 @@ async function handleBigQuerySyncInitialization() {
|
|
|
165
204
|
* authenticated HTTP POST, without queue retries.
|
|
166
205
|
*/
|
|
167
206
|
exports.initBigQuerySync = (0, tasks_1.onTaskDispatched)({
|
|
168
|
-
...
|
|
207
|
+
...(functionRegion ? { region: functionRegion } : {}),
|
|
169
208
|
retryConfig: LIFECYCLE_RETRY_CONFIG,
|
|
170
209
|
}, handleBigQuerySyncInitialization);
|
|
171
210
|
/**
|
|
@@ -173,7 +212,7 @@ exports.initBigQuerySync = (0, tasks_1.onTaskDispatched)({
|
|
|
173
212
|
* so BigQuery resources are reconciled after parameter changes.
|
|
174
213
|
*/
|
|
175
214
|
exports.setupBigQuerySync = (0, tasks_1.onTaskDispatched)({
|
|
176
|
-
...
|
|
215
|
+
...(functionRegion ? { region: functionRegion } : {}),
|
|
177
216
|
retryConfig: LIFECYCLE_RETRY_CONFIG,
|
|
178
217
|
}, handleBigQuerySyncInitialization);
|
|
179
218
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH;;;;;;;;;;;GAWG;AAEH,6GAA6G;AAC7G,4CAA4D;AAC5D,4DAAiE;AACjE,sDAAiD;AACjD,oDAA4D;AAE5D,8CAAkE;AAClE,+DAGyC;AACzC,qCAA6D;AAC7D,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH;;;;;;;;;;;GAWG;AAEH,6GAA6G;AAC7G,4CAA4D;AAC5D,4DAAiE;AACjE,sDAAiD;AACjD,oDAA4D;AAE5D,8CAAkE;AAClE,+DAGyC;AACzC,qCAA6D;AAC7D,iDAAmC;AACnC,mDAIyB;AACzB,yCAKoB;AACpB,iCAAiD;AACjD,6CAA+B;AAC/B,qCAA6D;AAC7D,mCAA0C;AAE1C,8EAA8E;AAC9E,wCAAsB;AAEtB,MAAM,2BAA2B,GAAG,kBAAkB,CAAC;AACvD,MAAM,4BAA4B,GAAG,mBAAmB,CAAC;AACzD,MAAM,sBAAsB,GAAG;IAC7B,WAAW,EAAE,EAAE;IACf,iBAAiB,EAAE,EAAE;CACb,CAAC;AACX,MAAM,iBAAiB,GAAG;IACxB,WAAW,EAAE,CAAC;IACd,iBAAiB,EAAE,EAAE;CACb,CAAC;AACX,MAAM,8BAA8B,GAAG,GAAG,CAAC;AAC3C,MAAM,cAAc,GAAwB;IAC1C,2BAA2B;IAC3B,sBAAsB;IACtB,qBAAqB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AAkB,CAAC,sBAAsB,CAC1C;KACJ;CACF,EACD,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,iCAAsB,EAAC,GAAG,EAAE,iBAAiB,EAAE,CAAC,CAC1D,CAAC;AAEF,KAAK,UAAU,gCAAgC;IAC7C,IAAI,CAAC;QACH,MAAM,iBAAiB,EAAE,CAAC,iBAAiB,EAAE,CAAC;IAChD,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,yCAAyC,EAAE,GAAG,CAAC,CAAC;QAClE,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC;AAED;;;;;;;;GAQG;AACU,QAAA,gBAAgB,GAAG,IAAA,wBAAgB,EAC9C;IACE,GAAG,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACrD,WAAW,EAAE,sBAAsB;CACpC,EACD,gCAAgC,CACjC,CAAC;AAEF;;;GAGG;AACU,QAAA,iBAAiB,GAAG,IAAA,wBAAgB,EAC/C;IACE,GAAG,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACrD,WAAW,EAAE,sBAAsB;CACpC,EACD,gCAAgC,CACjC,CAAC"}
|
package/lib/init.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { FirestoreBigQueryEventHistoryTracker } from "@firebaseextensions/firestore-bigquery-change-tracker";
|
|
2
2
|
/**
|
|
3
3
|
* Builds the provisioning guard used by the `initBigQuerySync` endpoint and the
|
|
4
|
-
*
|
|
4
|
+
* lifecycle tasks. The write paths never call it.
|
|
5
5
|
*
|
|
6
6
|
* The returned function runs `tracker.initialize()` at most once per instance:
|
|
7
7
|
* concurrent invocations on a cold instance share a single in-flight promise. A
|
package/lib/init.js
CHANGED
|
@@ -18,7 +18,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
18
18
|
exports.createEnsureInitialized = createEnsureInitialized;
|
|
19
19
|
/**
|
|
20
20
|
* Builds the provisioning guard used by the `initBigQuerySync` endpoint and the
|
|
21
|
-
*
|
|
21
|
+
* lifecycle tasks. The write paths never call it.
|
|
22
22
|
*
|
|
23
23
|
* The returned function runs `tracker.initialize()` at most once per instance:
|
|
24
24
|
* concurrent invocations on a cold instance share a single in-flight promise. A
|
package/lib/init.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;AAiBH,0DAaC;AA1BD;;;;;;;;;;;;GAYG;AACH,SAAgB,uBAAuB,CACrC,OAA6C;IAE7C,IAAI,cAAc,GAAyB,IAAI,CAAC;IAChD,OAAO,GAAG,EAAE;QACV,IAAI,CAAC,cAAc,EAAE,CAAC;YACpB,cAAc,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;gBAClD,cAAc,GAAG,IAAI,CAAC;gBACtB,MAAM,GAAG,CAAC;YACZ,CAAC,CAAC,CAAC;QACL,CAAC;QACD,OAAO,cAAc,CAAC;IACxB,CAAC,CAAC;AACJ,CAAC"}
|
package/lib/lib.d.ts
CHANGED
|
@@ -16,5 +16,5 @@
|
|
|
16
16
|
*/
|
|
17
17
|
export { type ChangeTrackerConfig, ChangeType, type FirestoreBigQueryEventHistoryTracker, } from "@firebaseextensions/firestore-bigquery-change-tracker";
|
|
18
18
|
export { type ExportConfig, type ResolvedExportConfig, resolveExportConfig, toTrackerConfig, type ViewType, } from "./export-config";
|
|
19
|
-
export { type DocumentWriteEvent, type HandlerContext, handleDocumentWrite, } from "./handlers";
|
|
19
|
+
export { type DocumentWriteEvent, type HandlerContext, type SerializedDocumentChange, handleDocumentWrite, handleSyncBigQueryTask, } from "./handlers";
|
|
20
20
|
//# sourceMappingURL=lib.d.ts.map
|
package/lib/lib.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../src/lib.ts"],"names":[],"mappings":"AAgBA;;;;;;;;;;;;;;;GAeG;AAKH,OAAO,EACL,KAAK,mBAAmB,EACxB,UAAU,EACV,KAAK,oCAAoC,GAC1C,MAAM,uDAAuD,CAAC;AAE/D,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,oBAAoB,EACzB,mBAAmB,EACnB,eAAe,EACf,KAAK,QAAQ,GACd,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,mBAAmB,
|
|
1
|
+
{"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../src/lib.ts"],"names":[],"mappings":"AAgBA;;;;;;;;;;;;;;;GAeG;AAKH,OAAO,EACL,KAAK,mBAAmB,EACxB,UAAU,EACV,KAAK,oCAAoC,GAC1C,MAAM,uDAAuD,CAAC;AAE/D,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,oBAAoB,EACzB,mBAAmB,EACnB,eAAe,EACf,KAAK,QAAQ,GACd,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,wBAAwB,EAC7B,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,YAAY,CAAC"}
|
package/lib/lib.js
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.handleDocumentWrite = exports.toTrackerConfig = exports.resolveExportConfig = exports.ChangeType = void 0;
|
|
18
|
+
exports.handleSyncBigQueryTask = exports.handleDocumentWrite = exports.toTrackerConfig = exports.resolveExportConfig = exports.ChangeType = void 0;
|
|
19
19
|
/**
|
|
20
20
|
* Side-effect-free library surface:
|
|
21
21
|
*
|
|
@@ -44,4 +44,5 @@ Object.defineProperty(exports, "toTrackerConfig", { enumerable: true, get: funct
|
|
|
44
44
|
// Handlers
|
|
45
45
|
var handlers_1 = require("./handlers");
|
|
46
46
|
Object.defineProperty(exports, "handleDocumentWrite", { enumerable: true, get: function () { return handlers_1.handleDocumentWrite; } });
|
|
47
|
+
Object.defineProperty(exports, "handleSyncBigQueryTask", { enumerable: true, get: function () { return handlers_1.handleSyncBigQueryTask; } });
|
|
47
48
|
//# sourceMappingURL=lib.js.map
|
package/lib/lib.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lib.js","sourceRoot":"","sources":["../src/lib.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH;;;;;;;;;;;;;;;GAeG;AAEH,4EAA4E;AAC5E,gFAAgF;AAChF,2DAA2D;AAC3D,2GAI+D;AAF7D,+HAAA,UAAU,OAAA;AAGZ,2BAA2B;AAC3B,iDAMyB;AAHvB,oHAAA,mBAAmB,OAAA;AACnB,gHAAA,eAAe,OAAA;AAGjB,WAAW;AACX,
|
|
1
|
+
{"version":3,"file":"lib.js","sourceRoot":"","sources":["../src/lib.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH;;;;;;;;;;;;;;;GAeG;AAEH,4EAA4E;AAC5E,gFAAgF;AAChF,2DAA2D;AAC3D,2GAI+D;AAF7D,+HAAA,UAAU,OAAA;AAGZ,2BAA2B;AAC3B,iDAMyB;AAHvB,oHAAA,mBAAmB,OAAA;AACnB,gHAAA,eAAe,OAAA;AAGjB,WAAW;AACX,uCAMoB;AAFlB,+GAAA,mBAAmB,OAAA;AACnB,kHAAA,sBAAsB,OAAA"}
|
package/lib/logs.d.ts
CHANGED
|
@@ -31,9 +31,9 @@ export declare const dataTypeInvalid: (fieldName: string, fieldType: string, dat
|
|
|
31
31
|
export declare const error: (includeEvent: boolean, message: string, err: Error, event?: any, // Made optional, as it is not always required
|
|
32
32
|
eventTrackerConfig?: any) => void;
|
|
33
33
|
export declare const init: (config?: unknown) => void;
|
|
34
|
-
export declare const start: (
|
|
34
|
+
export declare const start: () => void;
|
|
35
35
|
export declare const timestampMissingValue: (fieldName: string) => void;
|
|
36
36
|
export declare const logEventAction: (action: string, document_name: string, event_id: string, operation: ChangeType) => void;
|
|
37
|
-
export declare const logFailedEventAction: (action: string, document_name: string, event_id: string, operation: ChangeType, error: Error) => void;
|
|
37
|
+
export declare const logFailedEventAction: (action: string, document_name: string, event_id: string, operation: ChangeType, error: Error, retry_count?: number) => void;
|
|
38
38
|
export declare const failedToWriteToBigQueryImmediately: (error: Error) => void;
|
|
39
39
|
//# sourceMappingURL=logs.d.ts.map
|
package/lib/logs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logs.d.ts","sourceRoot":"","sources":["../src/logs.ts"],"names":[],"mappings":"AAgBA,OAAO,EACL,KAAK,UAAU,EACf,MAAM,EACP,MAAM,uDAAuD,CAAC;AAE/D,eAAO,MAAM,MAAM,QAAe,CAAC;AAEnC,eAAO,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"logs.d.ts","sourceRoot":"","sources":["../src/logs.ts"],"names":[],"mappings":"AAgBA,OAAO,EACL,KAAK,UAAU,EACf,MAAM,EACP,MAAM,uDAAuD,CAAC;AAE/D,eAAO,MAAM,MAAM,QAAe,CAAC;AAEnC,eAAO,MAAM,iBAAiB,GAAI,WAAW,MAAM,SAElD,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,WAAW,MAAM,SAEvD,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,WAAW,MAAM,SAExD,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,WAAW,MAAM,SAEtD,CAAC;AAEF,eAAO,MAAM,oCAAoC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AAI,UAAU,MAAM,SAE5C,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,UAAU,MAAM,SAE7C,CAAC;AAEF,eAAO,MAAM,eAAe,GAC1B,WAAW,MAAM,EACjB,WAAW,MAAM,EACjB,UAAU,MAAM,SAKjB,CAAC;AAEF,eAAO,MAAM,KAAK,GAChB,cAAc,OAAO,EACrB,SAAS,MAAM,EACf,KAAK,KAAK,EACV,QAAQ,GAAG,EAAE,8CAA8C;AAC3D,qBAAqB,GAAG,SAazB,CAAC;AAEF,eAAO,MAAM,IAAI,GAAI,SAAS,OAAO,SAEpC,CAAC;AAEF,eAAO,MAAM,KAAK,YAEjB,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,WAAW,MAAM,SAItD,CAAC;AAEF,eAAO,MAAM,cAAc,GACzB,QAAQ,MAAM,EACd,eAAe,MAAM,EACrB,UAAU,MAAM,EAChB,WAAW,UAAU,SAOtB,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAC/B,QAAQ,MAAM,EACd,eAAe,MAAM,EACrB,UAAU,MAAM,EAChB,WAAW,UAAU,EACrB,OAAO,KAAK,EACZ,cAAc,MAAM,SAgBrB,CAAC;AAEF,eAAO,MAAM,kCAAkC,GAAI,OAAO,KAAK,SAK9D,CAAC"}
|
package/lib/logs.js
CHANGED
|
@@ -148,8 +148,8 @@ const init = (config) => {
|
|
|
148
148
|
exports.logger.info("Initializing with configuration", config);
|
|
149
149
|
};
|
|
150
150
|
exports.init = init;
|
|
151
|
-
const start = (
|
|
152
|
-
exports.logger.info("Started execution
|
|
151
|
+
const start = () => {
|
|
152
|
+
exports.logger.info("Started execution of extension");
|
|
153
153
|
};
|
|
154
154
|
exports.start = start;
|
|
155
155
|
const timestampMissingValue = (fieldName) => {
|
|
@@ -164,7 +164,7 @@ const logEventAction = (action, document_name, event_id, operation) => {
|
|
|
164
164
|
});
|
|
165
165
|
};
|
|
166
166
|
exports.logEventAction = logEventAction;
|
|
167
|
-
const logFailedEventAction = (action, document_name, event_id, operation, error) => {
|
|
167
|
+
const logFailedEventAction = (action, document_name, event_id, operation, error, retry_count) => {
|
|
168
168
|
const changeTypeMap = {
|
|
169
169
|
0: "CREATE",
|
|
170
170
|
1: "DELETE",
|
|
@@ -176,6 +176,7 @@ const logFailedEventAction = (action, document_name, event_id, operation, error)
|
|
|
176
176
|
event_id,
|
|
177
177
|
operation: changeTypeMap[operation],
|
|
178
178
|
error,
|
|
179
|
+
...(retry_count === undefined ? {} : { retry_count }),
|
|
179
180
|
});
|
|
180
181
|
};
|
|
181
182
|
exports.logFailedEventAction = logFailedEventAction;
|
package/lib/logs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logs.js","sourceRoot":"","sources":["../src/logs.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,6GAG+D;AAElD,QAAA,MAAM,GAAG,IAAI,0CAAM,EAAE,CAAC;AAE5B,MAAM,iBAAiB,GAAG,CAAC,SAAiB,EAAE,EAAE;IACrD,
|
|
1
|
+
{"version":3,"file":"logs.js","sourceRoot":"","sources":["../src/logs.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,6GAG+D;AAElD,QAAA,MAAM,GAAG,IAAI,0CAAM,EAAE,CAAC;AAE5B,MAAM,iBAAiB,GAAG,CAAC,SAAiB,EAAE,EAAE;IACrD,cAAM,CAAC,IAAI,CAAC,gBAAgB,SAAS,uCAAuC,CAAC,CAAC;AAChF,CAAC,CAAC;AAFW,QAAA,iBAAiB,qBAE5B;AAEK,MAAM,sBAAsB,GAAG,CAAC,SAAiB,EAAE,EAAE;IAC1D,cAAM,CAAC,IAAI,CAAC,6BAA6B,SAAS,EAAE,CAAC,CAAC;AACxD,CAAC,CAAC;AAFW,QAAA,sBAAsB,0BAEjC;AAEK,MAAM,uBAAuB,GAAG,CAAC,SAAiB,EAAE,EAAE;IAC3D,cAAM,CAAC,KAAK,CAAC,8BAA8B,SAAS,E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loud Run region the functions
|
|
3
|
+
* should deploy to. Regional locations pass through unchanged; an unset or
|
|
4
|
+
* empty location returns `undefined`, meaning the functions declare no region.
|
|
5
|
+
*/
|
|
6
|
+
export declare function firestoreLocationToFunctionRegion(location: string | undefined): string | undefined;
|
|
7
|
+
//# sourceMappingURL=region.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"region.d.ts","sourceRoot":"","sources":["../src/region.ts"],"names":[],"mappings":"AAwBA;;;;GAIG;AACH,wBAAgB,iCAAiC,CAC/C,QAAQ,EAAE,MAAM,GAAG,SAAS,GAC3B,MAAM,GAAG,SAAS,CAKpB"}
|
package/lib/region.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2019 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.firestoreLocationToFunctionRegion = firestoreLocationToFunctionRegion;
|
|
19
|
+
// Firestore multi-region locations are not Cloud Run regions; deploying a
|
|
20
|
+
// function to one hard-fails, so they map to a region inside the multi-region.
|
|
21
|
+
const MULTI_REGION_TO_FUNCTION_REGION = {
|
|
22
|
+
nam5: "us-central1",
|
|
23
|
+
nam7: "us-central1",
|
|
24
|
+
eur3: "europe-west1",
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Maps a Firestore database location to the Cloud Run region the functions
|
|
28
|
+
* should deploy to. Regional locations pass through unchanged; an unset or
|
|
29
|
+
* empty location returns `undefined`, meaning the functions declare no region.
|
|
30
|
+
*/
|
|
31
|
+
function firestoreLocationToFunctionRegion(location) {
|
|
32
|
+
if (!location) {
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
return MULTI_REGION_TO_FUNCTION_REGION[location] ?? location;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=region.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"region.js","sourceRoot":"","sources":["../src/region.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;AAeH,8EAOC;AApBD,0EAA0E;AAC1E,+EAA+E;AAC/E,MAAM,+BAA+B,GAA2B;IAC9D,IAAI,EAAE,aAAa;IACnB,IAAI,EAAE,aAAa;IACnB,IAAI,EAAE,cAAc;CACrB,CAAC;AAEF;;;;GAIG;AACH,SAAgB,iCAAiC,CAC/C,QAA4B;IAE5B,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,+BAA+B,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC;AAC/D,CAAC"}
|
package/lib/tasks.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { SerializedDocumentChange } from "./handlers";
|
|
2
|
+
/** Export name of the write-buffer task function. */
|
|
3
|
+
export declare const SYNC_BIGQUERY_FUNCTION = "syncBigQuery";
|
|
4
|
+
/**
|
|
5
|
+
* Resolves the queue resource path for a task function of this kit instance.
|
|
6
|
+
*
|
|
7
|
+
* The name is deliberately unprefixed: firebase-admin >= 14.2.0 resolves the
|
|
8
|
+
* deployed `kit-<instance id>-` prefix itself from the
|
|
9
|
+
* `FIREBASE_KIT_INSTANCE_ID` env var, which the CLI sets on every deployed kit
|
|
10
|
+
* function. All functions of a kit instance deploy to one region, so the
|
|
11
|
+
* enqueuing function's own region is the queue's region.
|
|
12
|
+
*
|
|
13
|
+
* The CLI-set `FUNCTION_REGION` wins because it is the region the function
|
|
14
|
+
* was actually deployed to; a `DATABASE_REGION`-derived region can disagree
|
|
15
|
+
* with it on a first deploy or when the variable is unset, and is only the
|
|
16
|
+
* fallback for local runs where the CLI has not populated the environment.
|
|
17
|
+
* With neither set, the bare function name is returned and the Admin SDK
|
|
18
|
+
* applies its default location, `us-central1`, which is also where the CLI
|
|
19
|
+
* places functions that declare no region.
|
|
20
|
+
*
|
|
21
|
+
* @param functionName - The export name of the task function.
|
|
22
|
+
* @returns The queue resource path, `locations/<region>/functions/<name>`,
|
|
23
|
+
* or the bare `<name>` when no region is known.
|
|
24
|
+
*/
|
|
25
|
+
export declare function syncQueuePath(functionName?: string): string;
|
|
26
|
+
/**
|
|
27
|
+
* Enqueues a payload onto the `syncBigQuery` queue, retrying transient enqueue
|
|
28
|
+
* failures in-process with exponential backoff and jitter.
|
|
29
|
+
*
|
|
30
|
+
* The task id is derived from the event id, so a retried enqueue of an event
|
|
31
|
+
* that already reached Cloud Tasks is rejected rather than buffered twice.
|
|
32
|
+
*
|
|
33
|
+
* @param payload - The serialized change to enqueue.
|
|
34
|
+
* @param maxAttempts - How many enqueue attempts to make before giving up.
|
|
35
|
+
* Anything but a positive integer means a single attempt: resolving without
|
|
36
|
+
* an enqueue would report success for an event that was never buffered.
|
|
37
|
+
* @throws The last enqueue error, once every attempt has failed.
|
|
38
|
+
*/
|
|
39
|
+
export declare function enqueueSyncTask(payload: SerializedDocumentChange, maxAttempts: number): Promise<void>;
|
|
40
|
+
//# sourceMappingURL=tasks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tasks.d.ts","sourceRoot":"","sources":["../src/tasks.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAG3D,qDAAqD;AACrD,eAAO,MAAM,sBAAsB,iBAAiB,CAAC;AAYrD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,aAAa,CAC3B,YAAY,GAAE,MAA+B,GAC5C,MAAM,CAQR;AAQD;;;;;;;;;;;;GAYG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,wBAAwB,EACjC,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,IAAI,CAAC,CAoCf"}
|
package/lib/tasks.js
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2019 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.SYNC_BIGQUERY_FUNCTION = void 0;
|
|
19
|
+
exports.syncQueuePath = syncQueuePath;
|
|
20
|
+
exports.enqueueSyncTask = enqueueSyncTask;
|
|
21
|
+
const node_crypto_1 = require("node:crypto");
|
|
22
|
+
const functions_1 = require("firebase-admin/functions");
|
|
23
|
+
const region_1 = require("./region");
|
|
24
|
+
/** Export name of the write-buffer task function. */
|
|
25
|
+
exports.SYNC_BIGQUERY_FUNCTION = "syncBigQuery";
|
|
26
|
+
const MAX_BACKOFF_MS = 5000;
|
|
27
|
+
const BACKOFF_BASE_MS = 100;
|
|
28
|
+
const JITTER_MS = 100;
|
|
29
|
+
// Hashed rather than sanitized: a lossy mapping could collapse two event ids
|
|
30
|
+
// into one task id, and Cloud Tasks wants ids uniformly distributed.
|
|
31
|
+
function taskIdFor(change) {
|
|
32
|
+
return (0, node_crypto_1.createHash)("sha256").update(change.eventId).digest("hex");
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Resolves the queue resource path for a task function of this kit instance.
|
|
36
|
+
*
|
|
37
|
+
* The name is deliberately unprefixed: firebase-admin >= 14.2.0 resolves the
|
|
38
|
+
* deployed `kit-<instance id>-` prefix itself from the
|
|
39
|
+
* `FIREBASE_KIT_INSTANCE_ID` env var, which the CLI sets on every deployed kit
|
|
40
|
+
* function. All functions of a kit instance deploy to one region, so the
|
|
41
|
+
* enqueuing function's own region is the queue's region.
|
|
42
|
+
*
|
|
43
|
+
* The CLI-set `FUNCTION_REGION` wins because it is the region the function
|
|
44
|
+
* was actually deployed to; a `DATABASE_REGION`-derived region can disagree
|
|
45
|
+
* with it on a first deploy or when the variable is unset, and is only the
|
|
46
|
+
* fallback for local runs where the CLI has not populated the environment.
|
|
47
|
+
* With neither set, the bare function name is returned and the Admin SDK
|
|
48
|
+
* applies its default location, `us-central1`, which is also where the CLI
|
|
49
|
+
* places functions that declare no region.
|
|
50
|
+
*
|
|
51
|
+
* @param functionName - The export name of the task function.
|
|
52
|
+
* @returns The queue resource path, `locations/<region>/functions/<name>`,
|
|
53
|
+
* or the bare `<name>` when no region is known.
|
|
54
|
+
*/
|
|
55
|
+
function syncQueuePath(functionName = exports.SYNC_BIGQUERY_FUNCTION) {
|
|
56
|
+
const region = process.env.FUNCTION_REGION ||
|
|
57
|
+
(0, region_1.firestoreLocationToFunctionRegion)(process.env.DATABASE_REGION);
|
|
58
|
+
return region
|
|
59
|
+
? `locations/${region}/functions/${functionName}`
|
|
60
|
+
: functionName;
|
|
61
|
+
}
|
|
62
|
+
function backoffMs(attempt, jitter) {
|
|
63
|
+
return (Math.min(Math.pow(2, attempt) * BACKOFF_BASE_MS, MAX_BACKOFF_MS) + jitter);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Enqueues a payload onto the `syncBigQuery` queue, retrying transient enqueue
|
|
67
|
+
* failures in-process with exponential backoff and jitter.
|
|
68
|
+
*
|
|
69
|
+
* The task id is derived from the event id, so a retried enqueue of an event
|
|
70
|
+
* that already reached Cloud Tasks is rejected rather than buffered twice.
|
|
71
|
+
*
|
|
72
|
+
* @param payload - The serialized change to enqueue.
|
|
73
|
+
* @param maxAttempts - How many enqueue attempts to make before giving up.
|
|
74
|
+
* Anything but a positive integer means a single attempt: resolving without
|
|
75
|
+
* an enqueue would report success for an event that was never buffered.
|
|
76
|
+
* @throws The last enqueue error, once every attempt has failed.
|
|
77
|
+
*/
|
|
78
|
+
async function enqueueSyncTask(payload, maxAttempts) {
|
|
79
|
+
const queue = (0, functions_1.getFunctions)().taskQueue(syncQueuePath());
|
|
80
|
+
const id = taskIdFor(payload);
|
|
81
|
+
// Math.max(1, NaN) is NaN and would skip the loop entirely.
|
|
82
|
+
const attemptBudget = Number.isInteger(maxAttempts) && maxAttempts >= 1 ? maxAttempts : 1;
|
|
83
|
+
const jitter = Math.random() * JITTER_MS;
|
|
84
|
+
let attempts = 0;
|
|
85
|
+
while (attempts < attemptBudget) {
|
|
86
|
+
if (attempts > 0) {
|
|
87
|
+
await new Promise((resolve) => setTimeout(resolve, backoffMs(attempts, jitter)));
|
|
88
|
+
}
|
|
89
|
+
attempts++;
|
|
90
|
+
try {
|
|
91
|
+
await queue.enqueue(payload, { id });
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
catch (enqueueErr) {
|
|
95
|
+
// The event is already buffered; a second task would double-write the row.
|
|
96
|
+
// firebase-admin prefixes its codes: `functions/task-already-exists`.
|
|
97
|
+
if (enqueueErr?.code ===
|
|
98
|
+
"functions/task-already-exists") {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
if (attempts >= attemptBudget) {
|
|
102
|
+
throw enqueueErr;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=tasks.js.map
|
package/lib/tasks.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tasks.js","sourceRoot":"","sources":["../src/tasks.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAyCH,sCAUC;AAqBD,0CAuCC;AA7GD,6CAAyC;AACzC,wDAAwD;AAExD,qCAA6D;AAE7D,qDAAqD;AACxC,QAAA,sBAAsB,GAAG,cAAc,CAAC;AAErD,MAAM,cAAc,GAAG,IAAI,CAAC;AAC5B,MAAM,eAAe,GAAG,GAAG,CAAC;AAC5B,MAAM,SAAS,GAAG,GAAG,CAAC;AAEtB,6EAA6E;AAC7E,qEAAqE;AACrE,SAAS,SAAS,CAAC,MAAgC;IACjD,OAAO,IAAA,wBAAU,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACnE,CAAC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAgB,aAAa,CAC3B,eAAuB,8BAAsB;IAE7C,MAAM,MAAM,GACV,OAAO,CAAC,GAAG,CAAC,eAAe;QAC3B,IAAA,0CAAiC,EAAC,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;IAEjE,OAAO,MAAM;QACX,CAAC,CAAC,aAAa,MAAM,cAAc,YAAY,EAAE;QACjD,CAAC,CAAC,YAAY,CAAC;AACnB,CAAC;AAED,SAAS,SAAS,CAAC,OAAe,EAAE,MAAc;IAChD,OAAO,CACL,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG,eAAe,EAAE,cAAc,CAAC,GAAG,MAAM,CAC1E,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;GAYG;AACI,KAAK,UAAU,eAAe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AC;AACnF,OAAO,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAE7E;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,gBAAgB,CAAC,GAAG,UAAU,CAQ1E;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,gBAAgB,CAAC,GAAG,MAAM,CAKtE;AAED;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,UAAU,EAAE,MAAM,uDAAuD,CAAC;AACnF,OAAO,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAE7E;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,gBAAgB,CAAC,GAAG,UAAU,CAQ1E;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,gBAAgB,CAAC,GAAG,MAAM,CAKtE;AAED;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,GAAI,UAAU,MAAM,EAAE,MAAM,MAAM,OAUhE,CAAC"}
|
package/lib/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAUH,sCAQC;AAOD,sCAKC;AA5BD,6GAAmF;AAGnF;;;;GAIG;AACH,SAAgB,aAAa,CAAC,MAAgC;IAC5D,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;QACzB,OAAO,8CAAU,CAAC,MAAM,CAAC;IA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