@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
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
compileEngineTraversal
|
|
3
3
|
} from "../chunk-D4J7Z4FE.js";
|
|
4
4
|
import {
|
|
5
|
+
buildFirestoreUpdateArgs,
|
|
5
6
|
bulkRemoveEdges,
|
|
6
7
|
createBatchAdapter,
|
|
7
8
|
createFirestoreAdapter,
|
|
@@ -11,10 +12,8 @@ import {
|
|
|
11
12
|
runFirestoreClassicExpand,
|
|
12
13
|
runFirestoreFindEdgesProjected,
|
|
13
14
|
runFirestoreFindNearest
|
|
14
|
-
} from "../chunk-
|
|
15
|
-
import
|
|
16
|
-
deserializeFirestoreTypes
|
|
17
|
-
} from "../chunk-C2QMD7RY.js";
|
|
15
|
+
} from "../chunk-DJI3VXXA.js";
|
|
16
|
+
import "../chunk-C2QMD7RY.js";
|
|
18
17
|
import {
|
|
19
18
|
createCapabilities
|
|
20
19
|
} from "../chunk-N5HFDWQX.js";
|
|
@@ -27,13 +26,11 @@ import {
|
|
|
27
26
|
createMergedRegistry,
|
|
28
27
|
createRegistry,
|
|
29
28
|
generateId
|
|
30
|
-
} from "../chunk-
|
|
29
|
+
} from "../chunk-3AHHXMWX.js";
|
|
31
30
|
import {
|
|
32
31
|
FiregraphError,
|
|
33
|
-
assertSafePath,
|
|
34
|
-
assertUpdatePayloadExclusive,
|
|
35
32
|
flattenPatch
|
|
36
|
-
} from "../chunk-
|
|
33
|
+
} from "../chunk-SIHE4UY4.js";
|
|
37
34
|
import "../chunk-EQJUUVFG.js";
|
|
38
35
|
|
|
39
36
|
// src/firestore-enterprise/backend.ts
|
|
@@ -50,6 +47,13 @@ async function getFirestoreSurface() {
|
|
|
50
47
|
}
|
|
51
48
|
return { P: _Pipelines, Ts: _Timestamp };
|
|
52
49
|
}
|
|
50
|
+
var UNESCAPED_FIELD_NAME_RE = /^[_A-Za-z][_A-Za-z0-9]*$/;
|
|
51
|
+
function buildDataPathAlias(segments) {
|
|
52
|
+
const encoded = segments.map(
|
|
53
|
+
(seg) => UNESCAPED_FIELD_NAME_RE.test(seg) ? seg : "`" + seg.replace(/\\/g, "\\\\").replace(/`/g, "\\`") + "`"
|
|
54
|
+
);
|
|
55
|
+
return ["data", ...encoded].join(".");
|
|
56
|
+
}
|
|
53
57
|
function buildFilterExpression(P, filter) {
|
|
54
58
|
const { field: fieldName, op, value } = filter;
|
|
55
59
|
switch (op) {
|
|
@@ -127,7 +131,7 @@ async function runFirestorePipelineUpdate(db, collectionPath, filters, patch, _o
|
|
|
127
131
|
}
|
|
128
132
|
const { P, Ts } = await getFirestoreSurface();
|
|
129
133
|
const transforms = ops.map((op) => {
|
|
130
|
-
const alias =
|
|
134
|
+
const alias = buildDataPathAlias(op.path);
|
|
131
135
|
return P.constant(op.value).as(alias);
|
|
132
136
|
});
|
|
133
137
|
transforms.push(P.constant(Ts.now()).as("updatedAt"));
|
|
@@ -585,28 +589,6 @@ var ENTERPRISE_BASE_CAPS = /* @__PURE__ */ new Set([
|
|
|
585
589
|
var _emulatorFallbackWarned = false;
|
|
586
590
|
var _classicInProductionWarned = false;
|
|
587
591
|
var _previewDmlWarned = false;
|
|
588
|
-
function dottedDataPath(op) {
|
|
589
|
-
assertSafePath(op.path);
|
|
590
|
-
return `data.${op.path.join(".")}`;
|
|
591
|
-
}
|
|
592
|
-
function buildFirestoreUpdate(update, db) {
|
|
593
|
-
assertUpdatePayloadExclusive(update);
|
|
594
|
-
const out = {
|
|
595
|
-
updatedAt: FieldValue.serverTimestamp()
|
|
596
|
-
};
|
|
597
|
-
if (update.replaceData) {
|
|
598
|
-
out.data = deserializeFirestoreTypes(update.replaceData, db);
|
|
599
|
-
} else if (update.dataOps) {
|
|
600
|
-
for (const op of update.dataOps) {
|
|
601
|
-
const key = dottedDataPath(op);
|
|
602
|
-
out[key] = op.delete ? FieldValue.delete() : op.value;
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
if (update.v !== void 0) {
|
|
606
|
-
out.v = update.v;
|
|
607
|
-
}
|
|
608
|
-
return out;
|
|
609
|
-
}
|
|
610
592
|
function stampWritableRecord(record) {
|
|
611
593
|
const now = FieldValue.serverTimestamp();
|
|
612
594
|
const out = {
|
|
@@ -641,7 +623,7 @@ var FirestoreEnterpriseTransactionBackend = class {
|
|
|
641
623
|
);
|
|
642
624
|
}
|
|
643
625
|
async updateDoc(docId, update) {
|
|
644
|
-
this.adapter.updateDoc(docId,
|
|
626
|
+
this.adapter.updateDoc(docId, buildFirestoreUpdateArgs(update, this.db));
|
|
645
627
|
}
|
|
646
628
|
async deleteDoc(docId) {
|
|
647
629
|
this.adapter.deleteDoc(docId);
|
|
@@ -660,7 +642,7 @@ var FirestoreEnterpriseBatchBackend = class {
|
|
|
660
642
|
);
|
|
661
643
|
}
|
|
662
644
|
updateDoc(docId, update) {
|
|
663
|
-
this.adapter.updateDoc(docId,
|
|
645
|
+
this.adapter.updateDoc(docId, buildFirestoreUpdateArgs(update, this.db));
|
|
664
646
|
}
|
|
665
647
|
deleteDoc(docId) {
|
|
666
648
|
this.adapter.deleteDoc(docId);
|
|
@@ -708,7 +690,7 @@ var FirestoreEnterpriseBackendImpl = class _FirestoreEnterpriseBackendImpl {
|
|
|
708
690
|
);
|
|
709
691
|
}
|
|
710
692
|
updateDoc(docId, update) {
|
|
711
|
-
return this.adapter.updateDoc(docId,
|
|
693
|
+
return this.adapter.updateDoc(docId, buildFirestoreUpdateArgs(update, this.db));
|
|
712
694
|
}
|
|
713
695
|
deleteDoc(docId) {
|
|
714
696
|
return this.adapter.deleteDoc(docId);
|