@typicalday/firegraph 0.14.0 → 0.14.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.
- package/dist/backend.cjs +2 -3
- package/dist/backend.cjs.map +1 -1
- package/dist/backend.js +1 -1
- package/dist/{chunk-WRTFC5NG.js → chunk-3AHHXMWX.js} +2 -2
- package/dist/{chunk-PAD7WFFU.js → chunk-DJI3VXXA.js} +36 -10
- package/dist/chunk-DJI3VXXA.js.map +1 -0
- package/dist/{chunk-4MMQ5W74.js → chunk-NNBSUOOF.js} +7 -6
- package/dist/chunk-NNBSUOOF.js.map +1 -0
- package/dist/{chunk-TK64DNVK.js → chunk-SIHE4UY4.js} +3 -4
- package/dist/chunk-SIHE4UY4.js.map +1 -0
- package/dist/cloudflare/index.cjs +7 -7
- package/dist/cloudflare/index.cjs.map +1 -1
- package/dist/cloudflare/index.js +3 -3
- package/dist/firestore-enterprise/index.cjs +42 -40
- package/dist/firestore-enterprise/index.cjs.map +1 -1
- package/dist/firestore-enterprise/index.js +16 -34
- package/dist/firestore-enterprise/index.js.map +1 -1
- package/dist/firestore-standard/index.cjs +34 -37
- package/dist/firestore-standard/index.cjs.map +1 -1
- package/dist/firestore-standard/index.js +9 -34
- package/dist/firestore-standard/index.js.map +1 -1
- package/dist/index.cjs +2 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/sqlite/index.cjs +7 -7
- package/dist/sqlite/index.cjs.map +1 -1
- package/dist/sqlite/index.js +3 -3
- package/package.json +1 -1
- package/dist/chunk-4MMQ5W74.js.map +0 -1
- package/dist/chunk-PAD7WFFU.js.map +0 -1
- package/dist/chunk-TK64DNVK.js.map +0 -1
- /package/dist/{chunk-WRTFC5NG.js.map → chunk-3AHHXMWX.js.map} +0 -0
package/dist/cloudflare/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
dedupeIndexSpecs,
|
|
7
7
|
isFirestoreSpecialType,
|
|
8
8
|
validateJsonPathKey
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-NNBSUOOF.js";
|
|
10
10
|
import {
|
|
11
11
|
DEFAULT_CORE_INDEXES
|
|
12
12
|
} from "../chunk-2DHMNTV6.js";
|
|
@@ -25,14 +25,14 @@ import {
|
|
|
25
25
|
createMergedRegistry,
|
|
26
26
|
createRegistry,
|
|
27
27
|
generateId
|
|
28
|
-
} from "../chunk-
|
|
28
|
+
} from "../chunk-3AHHXMWX.js";
|
|
29
29
|
import {
|
|
30
30
|
CapabilityNotSupportedError,
|
|
31
31
|
FiregraphError,
|
|
32
32
|
assertUpdatePayloadExclusive,
|
|
33
33
|
deleteField,
|
|
34
34
|
flattenPatch
|
|
35
|
-
} from "../chunk-
|
|
35
|
+
} from "../chunk-SIHE4UY4.js";
|
|
36
36
|
import "../chunk-EQJUUVFG.js";
|
|
37
37
|
|
|
38
38
|
// src/cloudflare/schema.ts
|
|
@@ -235,7 +235,6 @@ function isTerminalValue(value) {
|
|
|
235
235
|
if (ctor && typeof ctor.name === "string" && FIRESTORE_TERMINAL_CTOR.has(ctor.name)) return true;
|
|
236
236
|
return true;
|
|
237
237
|
}
|
|
238
|
-
var SAFE_KEY_RE = /^[A-Za-z_][A-Za-z0-9_-]*$/;
|
|
239
238
|
function assertUpdatePayloadExclusive(update) {
|
|
240
239
|
if (update.replaceData !== void 0 && update.dataOps !== void 0) {
|
|
241
240
|
throw new Error(
|
|
@@ -274,9 +273,9 @@ function walkForDeleteSentinels(node, path, parent, visit) {
|
|
|
274
273
|
}
|
|
275
274
|
function assertSafePath(path) {
|
|
276
275
|
for (const seg of path) {
|
|
277
|
-
if (
|
|
276
|
+
if (seg === "") {
|
|
278
277
|
throw new Error(
|
|
279
|
-
`firegraph:
|
|
278
|
+
`firegraph: empty object key at path ${path.map((p) => JSON.stringify(p)).join(" > ")}. Object keys in update payloads must be non-empty.`
|
|
280
279
|
);
|
|
281
280
|
}
|
|
282
281
|
}
|
|
@@ -2302,7 +2301,7 @@ function generateId() {
|
|
|
2302
2301
|
}
|
|
2303
2302
|
|
|
2304
2303
|
// src/firestore-enterprise/backend.ts
|
|
2305
|
-
var
|
|
2304
|
+
var import_firestore5 = require("@google-cloud/firestore");
|
|
2306
2305
|
|
|
2307
2306
|
// src/bulk.ts
|
|
2308
2307
|
var MAX_BATCH_SIZE = 500;
|
|
@@ -2527,6 +2526,13 @@ async function getFirestoreSurface() {
|
|
|
2527
2526
|
}
|
|
2528
2527
|
return { P: _Pipelines, Ts: _Timestamp };
|
|
2529
2528
|
}
|
|
2529
|
+
var UNESCAPED_FIELD_NAME_RE = /^[_A-Za-z][_A-Za-z0-9]*$/;
|
|
2530
|
+
function buildDataPathAlias(segments) {
|
|
2531
|
+
const encoded = segments.map(
|
|
2532
|
+
(seg) => UNESCAPED_FIELD_NAME_RE.test(seg) ? seg : "`" + seg.replace(/\\/g, "\\\\").replace(/`/g, "\\`") + "`"
|
|
2533
|
+
);
|
|
2534
|
+
return ["data", ...encoded].join(".");
|
|
2535
|
+
}
|
|
2530
2536
|
function buildFilterExpression(P, filter) {
|
|
2531
2537
|
const { field: fieldName, op, value } = filter;
|
|
2532
2538
|
switch (op) {
|
|
@@ -2604,7 +2610,7 @@ async function runFirestorePipelineUpdate(db, collectionPath, filters, patch, _o
|
|
|
2604
2610
|
}
|
|
2605
2611
|
const { P, Ts } = await getFirestoreSurface();
|
|
2606
2612
|
const transforms = ops.map((op) => {
|
|
2607
|
-
const alias =
|
|
2613
|
+
const alias = buildDataPathAlias(op.path);
|
|
2608
2614
|
return P.constant(op.value).as(alias);
|
|
2609
2615
|
});
|
|
2610
2616
|
transforms.push(P.constant(Ts.now()).as("updatedAt"));
|
|
@@ -2635,8 +2641,8 @@ function createFirestoreAdapter(db, collectionPath) {
|
|
|
2635
2641
|
await collectionRef.doc(docId).set(data);
|
|
2636
2642
|
}
|
|
2637
2643
|
},
|
|
2638
|
-
async updateDoc(docId,
|
|
2639
|
-
await collectionRef.doc(docId).update(
|
|
2644
|
+
async updateDoc(docId, args) {
|
|
2645
|
+
await collectionRef.doc(docId).update(...args);
|
|
2640
2646
|
},
|
|
2641
2647
|
async deleteDoc(docId) {
|
|
2642
2648
|
await collectionRef.doc(docId).delete();
|
|
@@ -2672,8 +2678,8 @@ function createTransactionAdapter(db, collectionPath, tx) {
|
|
|
2672
2678
|
tx.set(collectionRef.doc(docId), data);
|
|
2673
2679
|
}
|
|
2674
2680
|
},
|
|
2675
|
-
updateDoc(docId,
|
|
2676
|
-
tx.update(collectionRef.doc(docId),
|
|
2681
|
+
updateDoc(docId, args) {
|
|
2682
|
+
tx.update(collectionRef.doc(docId), ...args);
|
|
2677
2683
|
},
|
|
2678
2684
|
deleteDoc(docId) {
|
|
2679
2685
|
tx.delete(collectionRef.doc(docId));
|
|
@@ -2705,8 +2711,8 @@ function createBatchAdapter(db, collectionPath) {
|
|
|
2705
2711
|
batch.set(collectionRef.doc(docId), data);
|
|
2706
2712
|
}
|
|
2707
2713
|
},
|
|
2708
|
-
updateDoc(docId,
|
|
2709
|
-
batch.update(collectionRef.doc(docId),
|
|
2714
|
+
updateDoc(docId, args) {
|
|
2715
|
+
batch.update(collectionRef.doc(docId), ...args);
|
|
2710
2716
|
},
|
|
2711
2717
|
deleteDoc(docId) {
|
|
2712
2718
|
batch.delete(collectionRef.doc(docId));
|
|
@@ -3325,6 +3331,27 @@ async function runFirestoreEngineTraversal(db, collectionPath, params) {
|
|
|
3325
3331
|
return result;
|
|
3326
3332
|
}
|
|
3327
3333
|
|
|
3334
|
+
// src/internal/firestore-update.ts
|
|
3335
|
+
var import_firestore4 = require("@google-cloud/firestore");
|
|
3336
|
+
init_serialization();
|
|
3337
|
+
function buildFirestoreUpdateArgs(update, db) {
|
|
3338
|
+
assertUpdatePayloadExclusive(update);
|
|
3339
|
+
const args = [];
|
|
3340
|
+
if (update.replaceData) {
|
|
3341
|
+
args.push("data", deserializeFirestoreTypes(update.replaceData, db));
|
|
3342
|
+
} else if (update.dataOps) {
|
|
3343
|
+
for (const op of update.dataOps) {
|
|
3344
|
+
assertSafePath(op.path);
|
|
3345
|
+
args.push(new import_firestore4.FieldPath("data", ...op.path), op.delete ? import_firestore4.FieldValue.delete() : op.value);
|
|
3346
|
+
}
|
|
3347
|
+
}
|
|
3348
|
+
args.push("updatedAt", import_firestore4.FieldValue.serverTimestamp());
|
|
3349
|
+
if (update.v !== void 0) {
|
|
3350
|
+
args.push("v", update.v);
|
|
3351
|
+
}
|
|
3352
|
+
return args;
|
|
3353
|
+
}
|
|
3354
|
+
|
|
3328
3355
|
// src/internal/firestore-vector.ts
|
|
3329
3356
|
var ENVELOPE_FIELDS3 = /* @__PURE__ */ new Set([
|
|
3330
3357
|
"aType",
|
|
@@ -3393,9 +3420,6 @@ async function runFirestoreFindNearest(base, params) {
|
|
|
3393
3420
|
return snap.docs.map((doc) => doc.data());
|
|
3394
3421
|
}
|
|
3395
3422
|
|
|
3396
|
-
// src/firestore-enterprise/backend.ts
|
|
3397
|
-
init_serialization();
|
|
3398
|
-
|
|
3399
3423
|
// src/firestore-enterprise/pipeline-adapter.ts
|
|
3400
3424
|
var _Pipelines6 = null;
|
|
3401
3425
|
async function getPipelines5() {
|
|
@@ -3476,30 +3500,8 @@ var ENTERPRISE_BASE_CAPS = /* @__PURE__ */ new Set([
|
|
|
3476
3500
|
var _emulatorFallbackWarned = false;
|
|
3477
3501
|
var _classicInProductionWarned = false;
|
|
3478
3502
|
var _previewDmlWarned = false;
|
|
3479
|
-
function dottedDataPath(op) {
|
|
3480
|
-
assertSafePath(op.path);
|
|
3481
|
-
return `data.${op.path.join(".")}`;
|
|
3482
|
-
}
|
|
3483
|
-
function buildFirestoreUpdate(update, db) {
|
|
3484
|
-
assertUpdatePayloadExclusive(update);
|
|
3485
|
-
const out = {
|
|
3486
|
-
updatedAt: import_firestore4.FieldValue.serverTimestamp()
|
|
3487
|
-
};
|
|
3488
|
-
if (update.replaceData) {
|
|
3489
|
-
out.data = deserializeFirestoreTypes(update.replaceData, db);
|
|
3490
|
-
} else if (update.dataOps) {
|
|
3491
|
-
for (const op of update.dataOps) {
|
|
3492
|
-
const key = dottedDataPath(op);
|
|
3493
|
-
out[key] = op.delete ? import_firestore4.FieldValue.delete() : op.value;
|
|
3494
|
-
}
|
|
3495
|
-
}
|
|
3496
|
-
if (update.v !== void 0) {
|
|
3497
|
-
out.v = update.v;
|
|
3498
|
-
}
|
|
3499
|
-
return out;
|
|
3500
|
-
}
|
|
3501
3503
|
function stampWritableRecord(record) {
|
|
3502
|
-
const now =
|
|
3504
|
+
const now = import_firestore5.FieldValue.serverTimestamp();
|
|
3503
3505
|
const out = {
|
|
3504
3506
|
aType: record.aType,
|
|
3505
3507
|
aUid: record.aUid,
|
|
@@ -3532,7 +3534,7 @@ var FirestoreEnterpriseTransactionBackend = class {
|
|
|
3532
3534
|
);
|
|
3533
3535
|
}
|
|
3534
3536
|
async updateDoc(docId, update) {
|
|
3535
|
-
this.adapter.updateDoc(docId,
|
|
3537
|
+
this.adapter.updateDoc(docId, buildFirestoreUpdateArgs(update, this.db));
|
|
3536
3538
|
}
|
|
3537
3539
|
async deleteDoc(docId) {
|
|
3538
3540
|
this.adapter.deleteDoc(docId);
|
|
@@ -3551,7 +3553,7 @@ var FirestoreEnterpriseBatchBackend = class {
|
|
|
3551
3553
|
);
|
|
3552
3554
|
}
|
|
3553
3555
|
updateDoc(docId, update) {
|
|
3554
|
-
this.adapter.updateDoc(docId,
|
|
3556
|
+
this.adapter.updateDoc(docId, buildFirestoreUpdateArgs(update, this.db));
|
|
3555
3557
|
}
|
|
3556
3558
|
deleteDoc(docId) {
|
|
3557
3559
|
this.adapter.deleteDoc(docId);
|
|
@@ -3599,7 +3601,7 @@ var FirestoreEnterpriseBackendImpl = class _FirestoreEnterpriseBackendImpl {
|
|
|
3599
3601
|
);
|
|
3600
3602
|
}
|
|
3601
3603
|
updateDoc(docId, update) {
|
|
3602
|
-
return this.adapter.updateDoc(docId,
|
|
3604
|
+
return this.adapter.updateDoc(docId, buildFirestoreUpdateArgs(update, this.db));
|
|
3603
3605
|
}
|
|
3604
3606
|
deleteDoc(docId) {
|
|
3605
3607
|
return this.adapter.deleteDoc(docId);
|