@typicalday/firegraph 0.13.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.
Files changed (35) hide show
  1. package/README.md +57 -1
  2. package/dist/backend.cjs +2 -3
  3. package/dist/backend.cjs.map +1 -1
  4. package/dist/backend.js +1 -1
  5. package/dist/{chunk-WRTFC5NG.js → chunk-3AHHXMWX.js} +2 -2
  6. package/dist/{chunk-PAD7WFFU.js → chunk-DJI3VXXA.js} +36 -10
  7. package/dist/chunk-DJI3VXXA.js.map +1 -0
  8. package/dist/{chunk-4MMQ5W74.js → chunk-NNBSUOOF.js} +7 -6
  9. package/dist/chunk-NNBSUOOF.js.map +1 -0
  10. package/dist/{chunk-TK64DNVK.js → chunk-SIHE4UY4.js} +3 -4
  11. package/dist/chunk-SIHE4UY4.js.map +1 -0
  12. package/dist/cloudflare/index.cjs +7 -7
  13. package/dist/cloudflare/index.cjs.map +1 -1
  14. package/dist/cloudflare/index.js +3 -3
  15. package/dist/firestore-enterprise/index.cjs +57 -48
  16. package/dist/firestore-enterprise/index.cjs.map +1 -1
  17. package/dist/firestore-enterprise/index.d.cts +41 -11
  18. package/dist/firestore-enterprise/index.d.ts +41 -11
  19. package/dist/firestore-enterprise/index.js +31 -42
  20. package/dist/firestore-enterprise/index.js.map +1 -1
  21. package/dist/firestore-standard/index.cjs +34 -37
  22. package/dist/firestore-standard/index.cjs.map +1 -1
  23. package/dist/firestore-standard/index.js +9 -34
  24. package/dist/firestore-standard/index.js.map +1 -1
  25. package/dist/index.cjs +2 -3
  26. package/dist/index.cjs.map +1 -1
  27. package/dist/index.js +2 -2
  28. package/dist/sqlite/index.cjs +7 -7
  29. package/dist/sqlite/index.cjs.map +1 -1
  30. package/dist/sqlite/index.js +3 -3
  31. package/package.json +1 -1
  32. package/dist/chunk-4MMQ5W74.js.map +0 -1
  33. package/dist/chunk-PAD7WFFU.js.map +0 -1
  34. package/dist/chunk-TK64DNVK.js.map +0 -1
  35. /package/dist/{chunk-WRTFC5NG.js.map → chunk-3AHHXMWX.js.map} +0 -0
package/dist/index.js CHANGED
@@ -54,7 +54,7 @@ import {
54
54
  migrateRecords,
55
55
  precompileSource,
56
56
  validateMigrationChain
57
- } from "./chunk-WRTFC5NG.js";
57
+ } from "./chunk-3AHHXMWX.js";
58
58
  import {
59
59
  CapabilityNotSupportedError,
60
60
  CrossBackendTransactionError,
@@ -70,7 +70,7 @@ import {
70
70
  TraversalError,
71
71
  ValidationError,
72
72
  deleteField
73
- } from "./chunk-TK64DNVK.js";
73
+ } from "./chunk-SIHE4UY4.js";
74
74
  import {
75
75
  SERIALIZATION_TAG,
76
76
  isTaggedValue
@@ -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 (!SAFE_KEY_RE.test(seg)) {
276
+ if (seg === "") {
278
277
  throw new Error(
279
- `firegraph: unsafe object key ${JSON.stringify(seg)} at path ${path.map((p) => JSON.stringify(p)).join(" > ")}. Keys used inside update payloads must match /^[A-Za-z_][A-Za-z0-9_-]*$/ so they can be embedded safely in SQLite JSON paths.`
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
  }
@@ -2337,6 +2336,9 @@ function validateJsonPathKey(key, backendLabel) {
2337
2336
  );
2338
2337
  }
2339
2338
  }
2339
+ function buildJsonPath(segments) {
2340
+ return "$" + segments.map((seg) => "." + JSON.stringify(seg)).join("");
2341
+ }
2340
2342
  function jsonBind(value, backendLabel) {
2341
2343
  if (value === void 0) return "null";
2342
2344
  if (value !== null && typeof value === "object") {
@@ -2360,16 +2362,14 @@ function compileDataOpsExpr(ops, base, params, backendLabel) {
2360
2362
  const placeholders = deletes.map(() => "?").join(", ");
2361
2363
  expr = `json_remove(${expr}, ${placeholders})`;
2362
2364
  for (const op of deletes) {
2363
- for (const seg of op.path) validateJsonPathKey(seg, backendLabel);
2364
- params.push(`$.${op.path.join(".")}`);
2365
+ params.push(buildJsonPath(op.path));
2365
2366
  }
2366
2367
  }
2367
2368
  if (sets.length > 0) {
2368
2369
  const pieces = sets.map(() => "?, json(?)").join(", ");
2369
2370
  expr = `json_set(${expr}, ${pieces})`;
2370
2371
  for (const op of sets) {
2371
- for (const seg of op.path) validateJsonPathKey(seg, backendLabel);
2372
- params.push(`$.${op.path.join(".")}`);
2372
+ params.push(buildJsonPath(op.path));
2373
2373
  params.push(jsonBind(op.value, backendLabel));
2374
2374
  }
2375
2375
  }