@firebase-function-kits/firestore-bigquery-export 0.0.2-rc.12 → 0.0.2-rc.14
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 +7 -0
- package/README.md +194 -26
- package/lib/config.d.ts +9 -0
- package/lib/config.d.ts.map +1 -1
- package/lib/config.js +44 -3
- package/lib/config.js.map +1 -1
- package/lib/events.d.ts +8 -8
- package/lib/events.d.ts.map +1 -1
- package/lib/events.js +25 -16
- package/lib/events.js.map +1 -1
- package/lib/handlers.d.ts.map +1 -1
- package/lib/handlers.js +20 -35
- package/lib/handlers.js.map +1 -1
- package/lib/index.d.ts +3 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +39 -13
- package/lib/index.js.map +1 -1
- package/lib/region.d.ts +4 -2
- package/lib/region.d.ts.map +1 -1
- package/lib/region.js +7 -4
- package/lib/region.js.map +1 -1
- package/npm-shrinkwrap.json +49 -1649
- package/package.json +3 -12
- package/src/config.ts +50 -3
- package/src/events.ts +29 -20
- package/src/handlers.ts +20 -33
- package/src/index.ts +48 -14
- package/src/region.ts +7 -4
- package/tests/config-runtime.test.ts +43 -0
- package/tests/eventarc-outage.test.ts +119 -0
- package/tests/events.test.ts +28 -0
- package/tests/handlers.test.ts +0 -14
- package/tests/index.test.ts +91 -19
- package/tests/region.test.ts +18 -0
- package/tests/required-apis.test.ts +6 -2
- package/tests/required-params.test.ts +138 -0
package/lib/handlers.js
CHANGED
|
@@ -87,8 +87,6 @@ async function enqueueForSync(change, ctx) {
|
|
|
87
87
|
await ctx.enqueue(change);
|
|
88
88
|
}
|
|
89
89
|
catch (enqueueErr) {
|
|
90
|
-
// Log before publishing: the log line is the only trace of the dropped
|
|
91
|
-
// row, and the event publish can itself reject.
|
|
92
90
|
logs.logFailedEventAction("Failed to enqueue event to Cloud Tasks from onWrite handler", change.fullResourceName, change.eventId, change.changeType, enqueueErr);
|
|
93
91
|
await events.recordErrorEvent(enqueueErr);
|
|
94
92
|
}
|
|
@@ -132,19 +130,13 @@ async function handleDocumentWrite(event, ctx) {
|
|
|
132
130
|
logs.logFailedEventAction("Failed to serialize data", fullResourceName, eventId, operation, err);
|
|
133
131
|
throw err;
|
|
134
132
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
catch (err) {
|
|
145
|
-
logs.error(false, "Failed to record start event", err);
|
|
146
|
-
throw err;
|
|
147
|
-
}
|
|
133
|
+
await events.recordStartEvent({
|
|
134
|
+
documentId,
|
|
135
|
+
changeType,
|
|
136
|
+
before: { data: data.before.data() },
|
|
137
|
+
after: { data: data.after.data() },
|
|
138
|
+
context,
|
|
139
|
+
});
|
|
148
140
|
const change = {
|
|
149
141
|
timestamp: context.time,
|
|
150
142
|
eventId: context.id,
|
|
@@ -185,26 +177,19 @@ async function handleSyncBigQueryTask(req, ctx) {
|
|
|
185
177
|
logs.logFailedEventAction("Failed to write event to BigQuery from onDispatch handler", change.fullResourceName, change.eventId, change.changeType, err, req.retryCount);
|
|
186
178
|
throw err;
|
|
187
179
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
catch (err) {
|
|
204
|
-
// The row is already in BigQuery. Rethrowing would have Cloud Tasks retry
|
|
205
|
-
// the insert past the dedupe window and duplicate it.
|
|
206
|
-
logs.error(false, "Failed to record success event", err);
|
|
207
|
-
}
|
|
180
|
+
await events.recordSuccessEvent({
|
|
181
|
+
subject: change.documentId,
|
|
182
|
+
data: {
|
|
183
|
+
timestamp: change.timestamp,
|
|
184
|
+
operation: change.changeType,
|
|
185
|
+
documentName: change.fullResourceName,
|
|
186
|
+
documentId: change.documentId,
|
|
187
|
+
pathParams: change.params,
|
|
188
|
+
eventId: change.eventId,
|
|
189
|
+
data: change.data,
|
|
190
|
+
oldData: change.oldData,
|
|
191
|
+
},
|
|
192
|
+
});
|
|
208
193
|
logs.complete();
|
|
209
194
|
}
|
|
210
195
|
//# sourceMappingURL=handlers.js.map
|
package/lib/handlers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handlers.js","sourceRoot":"","sources":["../src/handlers.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"handlers.js","sourceRoot":"","sources":["../src/handlers.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsHH,kDA8EC;AAaD,wDA2CC;AA1PD,6GAI+D;AAO/D,iDAAmC;AAEnC,6CAA+B;AAC/B,iCAAsD;AA2CtD;;;;;GAKG;AACH,KAAK,UAAU,qBAAqB,CAClC,MAAgC,EAChC,OAA6C;IAE7C,MAAM,KAAK,GAAiC;QAC1C,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,SAAS,EAAE,MAAM,CAAC,UAAU;QAC5B,YAAY,EAAE,MAAM,CAAC,gBAAgB;QACrC,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,UAAU,EAAE,MAAM,CAAC,MAAM;QACzB,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,OAAO,EAAE,MAAM,CAAC,OAAO;KACxB,CAAC;IAEF,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;AAChC,CAAC;AAED;;;;;;;;GAQG;AACH,KAAK,UAAU,cAAc,CAC3B,MAAgC,EAChC,GAAmB;IAEnB,IAAI,CAAC;QACH,MAA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C;IAEH,IAAI,CAAC,QAAQ,EAAE,CAAC;AAClB,CAAC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -13,7 +13,9 @@ export declare const fsexportbigquery: import("firebase-functions/core").CloudFu
|
|
|
13
13
|
* Tasks' schedule (5 attempts, 60s minimum backoff, dispatch-throttled by
|
|
14
14
|
* `MAX_DISPATCHES_PER_SECOND`). After the last attempt the task is dropped;
|
|
15
15
|
* by then the tracker has written the row to `BACKUP_COLLECTION` on every
|
|
16
|
-
* terminal insert failure, when that collection is configured.
|
|
16
|
+
* terminal insert failure, when that collection is configured. A task refused
|
|
17
|
+
* with 429s at the instance ceiling never runs the handler, so no backup row
|
|
18
|
+
* is written for it.
|
|
17
19
|
*/
|
|
18
20
|
export declare const syncBigQuery: import("firebase-functions/tasks").TaskQueueFunction<SerializedDocumentChange>;
|
|
19
21
|
/**
|
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":"AAmDA,OAAO,EAEL,KAAK,wBAAwB,EAG9B,MAAM,YAAY,CAAC;AAQpB,cAAc,OAAO,CAAC;AAoItB;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,wOAO5B,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,gFAiBxB,CAAC;AAWF;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,2DAG5B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,2DAG7B,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -79,6 +79,7 @@ const init_1 = require("./init");
|
|
|
79
79
|
const logs = __importStar(require("./logs"));
|
|
80
80
|
const region_1 = require("./region");
|
|
81
81
|
const tasks_2 = require("./tasks");
|
|
82
|
+
(0, config_1.assertRequiredParams)();
|
|
82
83
|
// Re-export the side-effect-free library surface (handlers and config types).
|
|
83
84
|
__exportStar(require("./lib"), exports);
|
|
84
85
|
const INIT_BIGQUERY_SYNC_FUNCTION = "initBigQuerySync";
|
|
@@ -116,6 +117,10 @@ const REQUIRED_APIS = [
|
|
|
116
117
|
api: "bigquery.googleapis.com",
|
|
117
118
|
reason: "Mirrors data from your Cloud Firestore collection in BigQuery.",
|
|
118
119
|
},
|
|
120
|
+
{
|
|
121
|
+
api: "eventarcpublishing.googleapis.com",
|
|
122
|
+
reason: "Publishes the extension's custom events to its Eventarc channel.",
|
|
123
|
+
},
|
|
119
124
|
];
|
|
120
125
|
for (const role of REQUIRED_ROLES) {
|
|
121
126
|
(0, v2_1.requiresRole)(role);
|
|
@@ -153,13 +158,37 @@ function getHandlerContext() {
|
|
|
153
158
|
}
|
|
154
159
|
/*
|
|
155
160
|
* Read at module load: the CLI populates `.env` values into the discovery
|
|
156
|
-
* process env (firebase-tools >= 15.28.0), and the
|
|
157
|
-
*
|
|
161
|
+
* process env (firebase-tools >= 15.28.0), and the location to Cloud Run region
|
|
162
|
+
* lookup needs a nested ternary the CLI's CEL subset cannot express. When
|
|
163
|
+
* unset, no function declares a region and the CLI
|
|
158
164
|
* falls back to its default. The Eventarc trigger region needs no handling:
|
|
159
165
|
* the CLI pins it to the database's own region regardless of where the
|
|
160
166
|
* function runs.
|
|
161
167
|
*/
|
|
162
168
|
const functionRegion = (0, region_1.firestoreLocationToFunctionRegion)(process.env.DATABASE_REGION);
|
|
169
|
+
/** Region placement shared by every function; empty when `DATABASE_REGION` is unset. */
|
|
170
|
+
const REGION_OPTION = functionRegion
|
|
171
|
+
? { region: functionRegion }
|
|
172
|
+
: {};
|
|
173
|
+
/** Options of the Firestore trigger, matching the extension's deployed trigger. */
|
|
174
|
+
const EVENT_FUNCTION_OPTIONS = {
|
|
175
|
+
...REGION_OPTION,
|
|
176
|
+
concurrency: 1,
|
|
177
|
+
cpu: "gcf_gen1",
|
|
178
|
+
ingressSettings: "ALLOW_INTERNAL_ONLY",
|
|
179
|
+
};
|
|
180
|
+
/** Options shared by the task-queue functions, matching the extension's 1st gen task functions. */
|
|
181
|
+
const TASK_FUNCTION_OPTIONS = {
|
|
182
|
+
...REGION_OPTION,
|
|
183
|
+
concurrency: 1,
|
|
184
|
+
cpu: "gcf_gen1",
|
|
185
|
+
timeoutSeconds: 540,
|
|
186
|
+
};
|
|
187
|
+
/** Options of the two lifecycle tasks, which share one retry config. */
|
|
188
|
+
const LIFECYCLE_TASK_OPTIONS = {
|
|
189
|
+
...TASK_FUNCTION_OPTIONS,
|
|
190
|
+
retryConfig: LIFECYCLE_RETRY_CONFIG,
|
|
191
|
+
};
|
|
163
192
|
/**
|
|
164
193
|
* Firestore trigger: streams document writes on the watched collection into the
|
|
165
194
|
* BigQuery changelog table. A failed inline write buffers through the
|
|
@@ -168,7 +197,7 @@ const functionRegion = (0, region_1.firestoreLocationToFunctionRegion)(process.e
|
|
|
168
197
|
* the execution once, and a failed enqueue is logged and dropped.
|
|
169
198
|
*/
|
|
170
199
|
exports.fsexportbigquery = (0, firestore_1.onDocumentWritten)({
|
|
171
|
-
...
|
|
200
|
+
...EVENT_FUNCTION_OPTIONS,
|
|
172
201
|
document: (0, params_1.expr) `${config_1.CONFIG_EXPRESSIONS.collectionPath}/{documentId}`,
|
|
173
202
|
database: config_1.CONFIG_EXPRESSIONS.database,
|
|
174
203
|
}, (event) => (0, handlers_1.handleDocumentWrite)(event, getHandlerContext()));
|
|
@@ -177,11 +206,14 @@ exports.fsexportbigquery = (0, firestore_1.onDocumentWritten)({
|
|
|
177
206
|
* Tasks' schedule (5 attempts, 60s minimum backoff, dispatch-throttled by
|
|
178
207
|
* `MAX_DISPATCHES_PER_SECOND`). After the last attempt the task is dropped;
|
|
179
208
|
* by then the tracker has written the row to `BACKUP_COLLECTION` on every
|
|
180
|
-
* terminal insert failure, when that collection is configured.
|
|
209
|
+
* terminal insert failure, when that collection is configured. A task refused
|
|
210
|
+
* with 429s at the instance ceiling never runs the handler, so no backup row
|
|
211
|
+
* is written for it.
|
|
181
212
|
*/
|
|
182
213
|
exports.syncBigQuery = (0, tasks_1.onTaskDispatched)({
|
|
183
|
-
...
|
|
214
|
+
...TASK_FUNCTION_OPTIONS,
|
|
184
215
|
retryConfig: SYNC_RETRY_CONFIG,
|
|
216
|
+
maxInstances: SYNC_MAX_CONCURRENT_DISPATCHES,
|
|
185
217
|
rateLimits: {
|
|
186
218
|
maxConcurrentDispatches: SYNC_MAX_CONCURRENT_DISPATCHES, // A blank .env value reaches this deploy-time expression as 0, which
|
|
187
219
|
// Cloud Tasks would not accept; runtime falls back to the same default.
|
|
@@ -208,16 +240,10 @@ async function handleBigQuerySyncInitialization() {
|
|
|
208
240
|
* no-ops when resources already exist) and can also be invoked directly as an
|
|
209
241
|
* authenticated HTTP POST, without queue retries.
|
|
210
242
|
*/
|
|
211
|
-
exports.initBigQuerySync = (0, tasks_1.onTaskDispatched)(
|
|
212
|
-
...(functionRegion ? { region: functionRegion } : {}),
|
|
213
|
-
retryConfig: LIFECYCLE_RETRY_CONFIG,
|
|
214
|
-
}, handleBigQuerySyncInitialization);
|
|
243
|
+
exports.initBigQuerySync = (0, tasks_1.onTaskDispatched)(LIFECYCLE_TASK_OPTIONS, handleBigQuerySyncInitialization);
|
|
215
244
|
/**
|
|
216
245
|
* Update/configure lifecycle task. Uses the same idempotent provisioning path
|
|
217
246
|
* so BigQuery resources are reconciled after parameter changes.
|
|
218
247
|
*/
|
|
219
|
-
exports.setupBigQuerySync = (0, tasks_1.onTaskDispatched)(
|
|
220
|
-
...(functionRegion ? { region: functionRegion } : {}),
|
|
221
|
-
retryConfig: LIFECYCLE_RETRY_CONFIG,
|
|
222
|
-
}, handleBigQuerySyncInitialization);
|
|
248
|
+
exports.setupBigQuerySync = (0, tasks_1.onTaskDispatched)(LIFECYCLE_TASK_OPTIONS, handleBigQuerySyncInitialization);
|
|
223
249
|
//# 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,
|
|
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,qCAIkB;AAClB,iDAAmC;AACnC,mDAIyB;AACzB,yCAKoB;AACpB,iCAAiD;AACjD,6CAA+B;AAC/B,qCAA6D;AAC7D,mCAA0C;AAE1C,IAAA,6BAAoB,GAAE,CAAC;AACvB,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;IACrB,oFAAoF;IACpF,8BAA8B;IAC9B,mBAAmB;IACnB,6EAA6E;IAC7E,4EAA4E;IAC5E,6EAA6E;IAC7E,2DAA2D;IAC3D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AAE,EAAE,CAAC,IAAA,8BAAmB,EAAC,KAAK,EAAE,iBAAiB,EAAE,CAAC,CAC3D,CAAC;AAEF;;;;;;;;GAQG;AACU,QAAA,YAAY,GAAG,IAAA,wBAAgB,EAC1C;IACE,GAAG,qBAAqB;IACxB,WAAW,EAAE,iBAAiB;IAC9B,YAAY,EAAE,8BAA8B;IAC5C,UAAU,EAAE;QACV,uBAAuB,EAAE,8BAA8B,EAAE,qEAAqE;QAC9H,wEAAwE;QACxE,sBAAsB,EAAE,2BAAkB,CAAC,sBAAsB;aAC9D,QAAQ,CAAC,CAAC,CAAC;aACX,QAAQ,CACP,iDAAiC,EACjC,2BAAkB,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,sBAAsB,EACtB,gCAAgC,CACjC,CAAC;AAEF;;;GAGG;AACU,QAAA,iBAAiB,GAAG,IAAA,wBAAgB,EAC/C,sBAAsB,EACtB,gCAAgC,CACjC,CAAC"}
|
package/lib/region.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Maps a Firestore database location to the Cloud Run region the functions
|
|
3
|
-
* should deploy to.
|
|
4
|
-
*
|
|
3
|
+
* should deploy to. The lookup is case-insensitive and ignores surrounding
|
|
4
|
+
* whitespace, as the CLI's own region handling is. Regional locations pass
|
|
5
|
+
* through lowercased; an unset or blank location returns `undefined`, meaning
|
|
6
|
+
* the functions declare no region.
|
|
5
7
|
*/
|
|
6
8
|
export declare function firestoreLocationToFunctionRegion(location: string | undefined): string | undefined;
|
|
7
9
|
//# sourceMappingURL=region.d.ts.map
|
package/lib/region.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"region.d.ts","sourceRoot":"","sources":["../src/region.ts"],"names":[],"mappings":"AAwBA
|
|
1
|
+
{"version":3,"file":"region.d.ts","sourceRoot":"","sources":["../src/region.ts"],"names":[],"mappings":"AAwBA;;;;;;GAMG;AACH,wBAAgB,iCAAiC,CAC/C,QAAQ,EAAE,MAAM,GAAG,SAAS,GAC3B,MAAM,GAAG,SAAS,CAMpB"}
|
package/lib/region.js
CHANGED
|
@@ -25,13 +25,16 @@ const MULTI_REGION_TO_FUNCTION_REGION = {
|
|
|
25
25
|
};
|
|
26
26
|
/**
|
|
27
27
|
* Maps a Firestore database location to the Cloud Run region the functions
|
|
28
|
-
* should deploy to.
|
|
29
|
-
*
|
|
28
|
+
* should deploy to. The lookup is case-insensitive and ignores surrounding
|
|
29
|
+
* whitespace, as the CLI's own region handling is. Regional locations pass
|
|
30
|
+
* through lowercased; an unset or blank location returns `undefined`, meaning
|
|
31
|
+
* the functions declare no region.
|
|
30
32
|
*/
|
|
31
33
|
function firestoreLocationToFunctionRegion(location) {
|
|
32
|
-
|
|
34
|
+
const normalized = location?.trim().toLowerCase();
|
|
35
|
+
if (!normalized) {
|
|
33
36
|
return undefined;
|
|
34
37
|
}
|
|
35
|
-
return MULTI_REGION_TO_FUNCTION_REGION[
|
|
38
|
+
return MULTI_REGION_TO_FUNCTION_REGION[normalized] ?? normalized;
|
|
36
39
|
}
|
|
37
40
|
//# sourceMappingURL=region.js.map
|
package/lib/region.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"region.js","sourceRoot":"","sources":["../src/region.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;
|
|
1
|
+
{"version":3,"file":"region.js","sourceRoot":"","sources":["../src/region.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;AAiBH,8EAQC;AAvBD,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;;;;;;GAMG;AACH,SAAgB,iCAAiC,CAC/C,QAA4B;IAE5B,MAAM,UAAU,GAAG,QAAQ,EAAE,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAClD,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,+BAA+B,CAAC,UAAU,CAAC,IAAI,UAAU,CAAC;AACnE,CAAC"}
|