@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
|
@@ -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-standard/backend.ts
|
|
2305
|
-
var
|
|
2304
|
+
var import_firestore4 = require("@google-cloud/firestore");
|
|
2306
2305
|
|
|
2307
2306
|
// src/bulk.ts
|
|
2308
2307
|
var MAX_BATCH_SIZE = 500;
|
|
@@ -2533,8 +2532,8 @@ function createFirestoreAdapter(db, collectionPath) {
|
|
|
2533
2532
|
await collectionRef.doc(docId).set(data);
|
|
2534
2533
|
}
|
|
2535
2534
|
},
|
|
2536
|
-
async updateDoc(docId,
|
|
2537
|
-
await collectionRef.doc(docId).update(
|
|
2535
|
+
async updateDoc(docId, args) {
|
|
2536
|
+
await collectionRef.doc(docId).update(...args);
|
|
2538
2537
|
},
|
|
2539
2538
|
async deleteDoc(docId) {
|
|
2540
2539
|
await collectionRef.doc(docId).delete();
|
|
@@ -2570,8 +2569,8 @@ function createTransactionAdapter(db, collectionPath, tx) {
|
|
|
2570
2569
|
tx.set(collectionRef.doc(docId), data);
|
|
2571
2570
|
}
|
|
2572
2571
|
},
|
|
2573
|
-
updateDoc(docId,
|
|
2574
|
-
tx.update(collectionRef.doc(docId),
|
|
2572
|
+
updateDoc(docId, args) {
|
|
2573
|
+
tx.update(collectionRef.doc(docId), ...args);
|
|
2575
2574
|
},
|
|
2576
2575
|
deleteDoc(docId) {
|
|
2577
2576
|
tx.delete(collectionRef.doc(docId));
|
|
@@ -2603,8 +2602,8 @@ function createBatchAdapter(db, collectionPath) {
|
|
|
2603
2602
|
batch.set(collectionRef.doc(docId), data);
|
|
2604
2603
|
}
|
|
2605
2604
|
},
|
|
2606
|
-
updateDoc(docId,
|
|
2607
|
-
batch.update(collectionRef.doc(docId),
|
|
2605
|
+
updateDoc(docId, args) {
|
|
2606
|
+
batch.update(collectionRef.doc(docId), ...args);
|
|
2608
2607
|
},
|
|
2609
2608
|
deleteDoc(docId) {
|
|
2610
2609
|
batch.delete(collectionRef.doc(docId));
|
|
@@ -2796,6 +2795,27 @@ async function runFirestoreFindEdgesProjected(base, select, filters, options) {
|
|
|
2796
2795
|
});
|
|
2797
2796
|
}
|
|
2798
2797
|
|
|
2798
|
+
// src/internal/firestore-update.ts
|
|
2799
|
+
var import_firestore3 = require("@google-cloud/firestore");
|
|
2800
|
+
init_serialization();
|
|
2801
|
+
function buildFirestoreUpdateArgs(update, db) {
|
|
2802
|
+
assertUpdatePayloadExclusive(update);
|
|
2803
|
+
const args = [];
|
|
2804
|
+
if (update.replaceData) {
|
|
2805
|
+
args.push("data", deserializeFirestoreTypes(update.replaceData, db));
|
|
2806
|
+
} else if (update.dataOps) {
|
|
2807
|
+
for (const op of update.dataOps) {
|
|
2808
|
+
assertSafePath(op.path);
|
|
2809
|
+
args.push(new import_firestore3.FieldPath("data", ...op.path), op.delete ? import_firestore3.FieldValue.delete() : op.value);
|
|
2810
|
+
}
|
|
2811
|
+
}
|
|
2812
|
+
args.push("updatedAt", import_firestore3.FieldValue.serverTimestamp());
|
|
2813
|
+
if (update.v !== void 0) {
|
|
2814
|
+
args.push("v", update.v);
|
|
2815
|
+
}
|
|
2816
|
+
return args;
|
|
2817
|
+
}
|
|
2818
|
+
|
|
2799
2819
|
// src/internal/firestore-vector.ts
|
|
2800
2820
|
var ENVELOPE_FIELDS = /* @__PURE__ */ new Set([
|
|
2801
2821
|
"aType",
|
|
@@ -2865,7 +2885,6 @@ async function runFirestoreFindNearest(base, params) {
|
|
|
2865
2885
|
}
|
|
2866
2886
|
|
|
2867
2887
|
// src/firestore-standard/backend.ts
|
|
2868
|
-
init_serialization();
|
|
2869
2888
|
var STANDARD_CAPS = /* @__PURE__ */ new Set([
|
|
2870
2889
|
"core.read",
|
|
2871
2890
|
"core.write",
|
|
@@ -2878,30 +2897,8 @@ var STANDARD_CAPS = /* @__PURE__ */ new Set([
|
|
|
2878
2897
|
"search.vector",
|
|
2879
2898
|
"raw.firestore"
|
|
2880
2899
|
]);
|
|
2881
|
-
function dottedDataPath(op) {
|
|
2882
|
-
assertSafePath(op.path);
|
|
2883
|
-
return `data.${op.path.join(".")}`;
|
|
2884
|
-
}
|
|
2885
|
-
function buildFirestoreUpdate(update, db) {
|
|
2886
|
-
assertUpdatePayloadExclusive(update);
|
|
2887
|
-
const out = {
|
|
2888
|
-
updatedAt: import_firestore3.FieldValue.serverTimestamp()
|
|
2889
|
-
};
|
|
2890
|
-
if (update.replaceData) {
|
|
2891
|
-
out.data = deserializeFirestoreTypes(update.replaceData, db);
|
|
2892
|
-
} else if (update.dataOps) {
|
|
2893
|
-
for (const op of update.dataOps) {
|
|
2894
|
-
const key = dottedDataPath(op);
|
|
2895
|
-
out[key] = op.delete ? import_firestore3.FieldValue.delete() : op.value;
|
|
2896
|
-
}
|
|
2897
|
-
}
|
|
2898
|
-
if (update.v !== void 0) {
|
|
2899
|
-
out.v = update.v;
|
|
2900
|
-
}
|
|
2901
|
-
return out;
|
|
2902
|
-
}
|
|
2903
2900
|
function stampWritableRecord(record) {
|
|
2904
|
-
const now =
|
|
2901
|
+
const now = import_firestore4.FieldValue.serverTimestamp();
|
|
2905
2902
|
const out = {
|
|
2906
2903
|
aType: record.aType,
|
|
2907
2904
|
aUid: record.aUid,
|
|
@@ -2934,7 +2931,7 @@ var FirestoreStandardTransactionBackend = class {
|
|
|
2934
2931
|
);
|
|
2935
2932
|
}
|
|
2936
2933
|
async updateDoc(docId, update) {
|
|
2937
|
-
this.adapter.updateDoc(docId,
|
|
2934
|
+
this.adapter.updateDoc(docId, buildFirestoreUpdateArgs(update, this.db));
|
|
2938
2935
|
}
|
|
2939
2936
|
async deleteDoc(docId) {
|
|
2940
2937
|
this.adapter.deleteDoc(docId);
|
|
@@ -2953,7 +2950,7 @@ var FirestoreStandardBatchBackend = class {
|
|
|
2953
2950
|
);
|
|
2954
2951
|
}
|
|
2955
2952
|
updateDoc(docId, update) {
|
|
2956
|
-
this.adapter.updateDoc(docId,
|
|
2953
|
+
this.adapter.updateDoc(docId, buildFirestoreUpdateArgs(update, this.db));
|
|
2957
2954
|
}
|
|
2958
2955
|
deleteDoc(docId) {
|
|
2959
2956
|
this.adapter.deleteDoc(docId);
|
|
@@ -2989,7 +2986,7 @@ var FirestoreStandardBackendImpl = class _FirestoreStandardBackendImpl {
|
|
|
2989
2986
|
);
|
|
2990
2987
|
}
|
|
2991
2988
|
updateDoc(docId, update) {
|
|
2992
|
-
return this.adapter.updateDoc(docId,
|
|
2989
|
+
return this.adapter.updateDoc(docId, buildFirestoreUpdateArgs(update, this.db));
|
|
2993
2990
|
}
|
|
2994
2991
|
deleteDoc(docId) {
|
|
2995
2992
|
return this.adapter.deleteDoc(docId);
|