@typicalday/firegraph 0.14.0 → 0.15.0

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.
Files changed (74) hide show
  1. package/README.md +23 -3
  2. package/dist/{backend-DuvHGgK1.d.cts → backend-BpYLdwCW.d.cts} +1 -1
  3. package/dist/{backend-DuvHGgK1.d.ts → backend-BpYLdwCW.d.ts} +1 -1
  4. package/dist/backend-CvImIwTY.d.cts +137 -0
  5. package/dist/backend-YH5HtawN.d.ts +137 -0
  6. package/dist/backend.cjs +2 -3
  7. package/dist/backend.cjs.map +1 -1
  8. package/dist/backend.d.cts +2 -2
  9. package/dist/backend.d.ts +2 -2
  10. package/dist/backend.js +1 -1
  11. package/dist/{chunk-WRTFC5NG.js → chunk-5HIRYV2S.js} +13 -36
  12. package/dist/chunk-5HIRYV2S.js.map +1 -0
  13. package/dist/{chunk-PAD7WFFU.js → chunk-7IEZ6IYY.js} +36 -10
  14. package/dist/chunk-7IEZ6IYY.js.map +1 -0
  15. package/dist/chunk-FODIMIWY.js +721 -0
  16. package/dist/chunk-FODIMIWY.js.map +1 -0
  17. package/dist/chunk-NGAJCALM.js +34 -0
  18. package/dist/chunk-NGAJCALM.js.map +1 -0
  19. package/dist/{chunk-TK64DNVK.js → chunk-SIHE4UY4.js} +3 -4
  20. package/dist/chunk-SIHE4UY4.js.map +1 -0
  21. package/dist/chunk-ULRDQ6HZ.js +862 -0
  22. package/dist/chunk-ULRDQ6HZ.js.map +1 -0
  23. package/dist/{client-BKi3vk0Q.d.ts → client-B5o39X79.d.ts} +1 -1
  24. package/dist/{client-BrsaXtDV.d.cts → client-BGHwxwPg.d.cts} +1 -1
  25. package/dist/{client-Bk2Cm6xv.d.cts → client-DoyEdJ5w.d.cts} +1 -1
  26. package/dist/{client-Bk2Cm6xv.d.ts → client-DoyEdJ5w.d.ts} +1 -1
  27. package/dist/cloudflare/index.cjs +155 -165
  28. package/dist/cloudflare/index.cjs.map +1 -1
  29. package/dist/cloudflare/index.d.cts +73 -70
  30. package/dist/cloudflare/index.d.ts +73 -70
  31. package/dist/cloudflare/index.js +54 -589
  32. package/dist/cloudflare/index.js.map +1 -1
  33. package/dist/codegen/index.d.cts +1 -1
  34. package/dist/codegen/index.d.ts +1 -1
  35. package/dist/firestore-enterprise/index.cjs +42 -40
  36. package/dist/firestore-enterprise/index.cjs.map +1 -1
  37. package/dist/firestore-enterprise/index.d.cts +3 -3
  38. package/dist/firestore-enterprise/index.d.ts +3 -3
  39. package/dist/firestore-enterprise/index.js +19 -35
  40. package/dist/firestore-enterprise/index.js.map +1 -1
  41. package/dist/firestore-standard/index.cjs +34 -37
  42. package/dist/firestore-standard/index.cjs.map +1 -1
  43. package/dist/firestore-standard/index.d.cts +3 -3
  44. package/dist/firestore-standard/index.d.ts +3 -3
  45. package/dist/firestore-standard/index.js +10 -34
  46. package/dist/firestore-standard/index.js.map +1 -1
  47. package/dist/index.cjs +2 -3
  48. package/dist/index.cjs.map +1 -1
  49. package/dist/index.d.cts +5 -5
  50. package/dist/index.d.ts +5 -5
  51. package/dist/index.js +7 -5
  52. package/dist/index.js.map +1 -1
  53. package/dist/query-client/index.d.cts +2 -2
  54. package/dist/query-client/index.d.ts +2 -2
  55. package/dist/{registry-Bc7h6WTM.d.cts → registry-BGh7Jqpb.d.cts} +2 -2
  56. package/dist/{registry-C2KUPVZj.d.ts → registry-tKTb5Kx1.d.ts} +2 -2
  57. package/dist/sqlite/index.cjs +585 -378
  58. package/dist/sqlite/index.cjs.map +1 -1
  59. package/dist/sqlite/index.d.cts +4 -110
  60. package/dist/sqlite/index.d.ts +4 -110
  61. package/dist/sqlite/index.js +7 -1144
  62. package/dist/sqlite/index.js.map +1 -1
  63. package/dist/sqlite/local.cjs +1835 -0
  64. package/dist/sqlite/local.cjs.map +1 -0
  65. package/dist/sqlite/local.d.cts +83 -0
  66. package/dist/sqlite/local.d.ts +83 -0
  67. package/dist/sqlite/local.js +121 -0
  68. package/dist/sqlite/local.js.map +1 -0
  69. package/package.json +15 -1
  70. package/dist/chunk-4MMQ5W74.js +0 -288
  71. package/dist/chunk-4MMQ5W74.js.map +0 -1
  72. package/dist/chunk-PAD7WFFU.js.map +0 -1
  73. package/dist/chunk-TK64DNVK.js.map +0 -1
  74. package/dist/chunk-WRTFC5NG.js.map +0 -1
@@ -1,7 +1,7 @@
1
- export { c as createGraphClient } from '../client-BrsaXtDV.cjs';
2
- export { M as META_EDGE_TYPE, a as META_NODE_TYPE, b as createMergedRegistry, d as createRegistry, f as generateId } from '../registry-Bc7h6WTM.cjs';
1
+ export { c as createGraphClient } from '../client-BGHwxwPg.cjs';
2
+ export { M as META_EDGE_TYPE, a as META_NODE_TYPE, c as createMergedRegistry, b as createRegistry, g as generateId } from '../registry-BGh7Jqpb.cjs';
3
3
  import { Firestore } from '@google-cloud/firestore';
4
- import { S as StorageBackend } from '../backend-DuvHGgK1.cjs';
4
+ import { S as StorageBackend } from '../backend-BpYLdwCW.cjs';
5
5
 
6
6
  /**
7
7
  * Firestore Enterprise edition `StorageBackend`.
@@ -1,7 +1,7 @@
1
- export { c as createGraphClient } from '../client-BKi3vk0Q.js';
2
- export { M as META_EDGE_TYPE, a as META_NODE_TYPE, b as createMergedRegistry, d as createRegistry, f as generateId } from '../registry-C2KUPVZj.js';
1
+ export { c as createGraphClient } from '../client-B5o39X79.js';
2
+ export { M as META_EDGE_TYPE, a as META_NODE_TYPE, c as createMergedRegistry, b as createRegistry, g as generateId } from '../registry-tKTb5Kx1.js';
3
3
  import { Firestore } from '@google-cloud/firestore';
4
- import { S as StorageBackend } from '../backend-DuvHGgK1.js';
4
+ import { S as StorageBackend } from '../backend-BpYLdwCW.js';
5
5
 
6
6
  /**
7
7
  * Firestore Enterprise edition `StorageBackend`.
@@ -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,29 +12,27 @@ import {
11
12
  runFirestoreClassicExpand,
12
13
  runFirestoreFindEdgesProjected,
13
14
  runFirestoreFindNearest
14
- } from "../chunk-PAD7WFFU.js";
15
- import {
16
- deserializeFirestoreTypes
17
- } from "../chunk-C2QMD7RY.js";
15
+ } from "../chunk-7IEZ6IYY.js";
16
+ import "../chunk-C2QMD7RY.js";
18
17
  import {
19
18
  createCapabilities
20
19
  } from "../chunk-N5HFDWQX.js";
21
20
  import {
22
21
  META_EDGE_TYPE,
23
22
  META_NODE_TYPE,
24
- NODE_RELATION,
25
23
  buildEdgeQueryPlan,
26
24
  createGraphClient,
27
25
  createMergedRegistry,
28
26
  createRegistry,
29
27
  generateId
30
- } from "../chunk-WRTFC5NG.js";
28
+ } from "../chunk-5HIRYV2S.js";
29
+ import {
30
+ NODE_RELATION
31
+ } from "../chunk-NGAJCALM.js";
31
32
  import {
32
33
  FiregraphError,
33
- assertSafePath,
34
- assertUpdatePayloadExclusive,
35
34
  flattenPatch
36
- } from "../chunk-TK64DNVK.js";
35
+ } from "../chunk-SIHE4UY4.js";
37
36
  import "../chunk-EQJUUVFG.js";
38
37
 
39
38
  // src/firestore-enterprise/backend.ts
@@ -50,6 +49,13 @@ async function getFirestoreSurface() {
50
49
  }
51
50
  return { P: _Pipelines, Ts: _Timestamp };
52
51
  }
52
+ var UNESCAPED_FIELD_NAME_RE = /^[_A-Za-z][_A-Za-z0-9]*$/;
53
+ function buildDataPathAlias(segments) {
54
+ const encoded = segments.map(
55
+ (seg) => UNESCAPED_FIELD_NAME_RE.test(seg) ? seg : "`" + seg.replace(/\\/g, "\\\\").replace(/`/g, "\\`") + "`"
56
+ );
57
+ return ["data", ...encoded].join(".");
58
+ }
53
59
  function buildFilterExpression(P, filter) {
54
60
  const { field: fieldName, op, value } = filter;
55
61
  switch (op) {
@@ -127,7 +133,7 @@ async function runFirestorePipelineUpdate(db, collectionPath, filters, patch, _o
127
133
  }
128
134
  const { P, Ts } = await getFirestoreSurface();
129
135
  const transforms = ops.map((op) => {
130
- const alias = `data.${op.path.join(".")}`;
136
+ const alias = buildDataPathAlias(op.path);
131
137
  return P.constant(op.value).as(alias);
132
138
  });
133
139
  transforms.push(P.constant(Ts.now()).as("updatedAt"));
@@ -585,28 +591,6 @@ var ENTERPRISE_BASE_CAPS = /* @__PURE__ */ new Set([
585
591
  var _emulatorFallbackWarned = false;
586
592
  var _classicInProductionWarned = false;
587
593
  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
594
  function stampWritableRecord(record) {
611
595
  const now = FieldValue.serverTimestamp();
612
596
  const out = {
@@ -641,7 +625,7 @@ var FirestoreEnterpriseTransactionBackend = class {
641
625
  );
642
626
  }
643
627
  async updateDoc(docId, update) {
644
- this.adapter.updateDoc(docId, buildFirestoreUpdate(update, this.db));
628
+ this.adapter.updateDoc(docId, buildFirestoreUpdateArgs(update, this.db));
645
629
  }
646
630
  async deleteDoc(docId) {
647
631
  this.adapter.deleteDoc(docId);
@@ -660,7 +644,7 @@ var FirestoreEnterpriseBatchBackend = class {
660
644
  );
661
645
  }
662
646
  updateDoc(docId, update) {
663
- this.adapter.updateDoc(docId, buildFirestoreUpdate(update, this.db));
647
+ this.adapter.updateDoc(docId, buildFirestoreUpdateArgs(update, this.db));
664
648
  }
665
649
  deleteDoc(docId) {
666
650
  this.adapter.deleteDoc(docId);
@@ -708,7 +692,7 @@ var FirestoreEnterpriseBackendImpl = class _FirestoreEnterpriseBackendImpl {
708
692
  );
709
693
  }
710
694
  updateDoc(docId, update) {
711
- return this.adapter.updateDoc(docId, buildFirestoreUpdate(update, this.db));
695
+ return this.adapter.updateDoc(docId, buildFirestoreUpdateArgs(update, this.db));
712
696
  }
713
697
  deleteDoc(docId) {
714
698
  return this.adapter.deleteDoc(docId);