@rocicorp/zero 1.8.0 → 1.9.0-canary.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 (157) hide show
  1. package/out/shared/src/cache.d.ts +8 -1
  2. package/out/shared/src/cache.d.ts.map +1 -1
  3. package/out/shared/src/cache.js +25 -9
  4. package/out/shared/src/cache.js.map +1 -1
  5. package/out/shared/src/objects.d.ts +6 -1
  6. package/out/shared/src/objects.d.ts.map +1 -1
  7. package/out/shared/src/objects.js +19 -4
  8. package/out/shared/src/objects.js.map +1 -1
  9. package/out/zero/package.js +2 -19
  10. package/out/zero/package.js.map +1 -1
  11. package/out/zero-cache/src/config/zero-config.d.ts +4 -0
  12. package/out/zero-cache/src/config/zero-config.d.ts.map +1 -1
  13. package/out/zero-cache/src/config/zero-config.js +21 -6
  14. package/out/zero-cache/src/config/zero-config.js.map +1 -1
  15. package/out/zero-cache/src/custom-queries/transform-query.d.ts +6 -0
  16. package/out/zero-cache/src/custom-queries/transform-query.d.ts.map +1 -1
  17. package/out/zero-cache/src/custom-queries/transform-query.js +8 -0
  18. package/out/zero-cache/src/custom-queries/transform-query.js.map +1 -1
  19. package/out/zero-cache/src/db/migration-lite.d.ts.map +1 -1
  20. package/out/zero-cache/src/db/migration-lite.js +5 -2
  21. package/out/zero-cache/src/db/migration-lite.js.map +1 -1
  22. package/out/zero-cache/src/db/migration.d.ts.map +1 -1
  23. package/out/zero-cache/src/db/migration.js +3 -1
  24. package/out/zero-cache/src/db/migration.js.map +1 -1
  25. package/out/zero-cache/src/db/sqlite-corruption.d.ts +11 -0
  26. package/out/zero-cache/src/db/sqlite-corruption.d.ts.map +1 -0
  27. package/out/zero-cache/src/db/sqlite-corruption.js +191 -0
  28. package/out/zero-cache/src/db/sqlite-corruption.js.map +1 -0
  29. package/out/zero-cache/src/server/anonymous-otel-start.d.ts +1 -1
  30. package/out/zero-cache/src/server/anonymous-otel-start.js.map +1 -1
  31. package/out/zero-cache/src/server/backup-watermark-reader.js +1 -1
  32. package/out/zero-cache/src/server/backup-watermark-reader.js.map +1 -1
  33. package/out/zero-cache/src/server/change-streamer.d.ts.map +1 -1
  34. package/out/zero-cache/src/server/change-streamer.js +7 -2
  35. package/out/zero-cache/src/server/change-streamer.js.map +1 -1
  36. package/out/zero-cache/src/server/logging.d.ts +8 -0
  37. package/out/zero-cache/src/server/logging.d.ts.map +1 -1
  38. package/out/zero-cache/src/server/logging.js +27 -5
  39. package/out/zero-cache/src/server/logging.js.map +1 -1
  40. package/out/zero-cache/src/server/main.d.ts.map +1 -1
  41. package/out/zero-cache/src/server/main.js +6 -1
  42. package/out/zero-cache/src/server/main.js.map +1 -1
  43. package/out/zero-cache/src/server/mutator.js +1 -1
  44. package/out/zero-cache/src/server/mutator.js.map +1 -1
  45. package/out/zero-cache/src/server/otel-log-sink.d.ts +7 -1
  46. package/out/zero-cache/src/server/otel-log-sink.d.ts.map +1 -1
  47. package/out/zero-cache/src/server/otel-log-sink.js +7 -2
  48. package/out/zero-cache/src/server/otel-log-sink.js.map +1 -1
  49. package/out/zero-cache/src/server/reaper.js +1 -1
  50. package/out/zero-cache/src/server/reaper.js.map +1 -1
  51. package/out/zero-cache/src/server/replicator.d.ts.map +1 -1
  52. package/out/zero-cache/src/server/replicator.js +11 -1
  53. package/out/zero-cache/src/server/replicator.js.map +1 -1
  54. package/out/zero-cache/src/server/shadow-syncer.js +1 -1
  55. package/out/zero-cache/src/server/shadow-syncer.js.map +1 -1
  56. package/out/zero-cache/src/server/syncer.d.ts.map +1 -1
  57. package/out/zero-cache/src/server/syncer.js +6 -1
  58. package/out/zero-cache/src/server/syncer.js.map +1 -1
  59. package/out/zero-cache/src/services/change-source/common/replica-schema.d.ts.map +1 -1
  60. package/out/zero-cache/src/services/change-source/common/replica-schema.js +8 -5
  61. package/out/zero-cache/src/services/change-source/common/replica-schema.js.map +1 -1
  62. package/out/zero-cache/src/services/change-source/pg/change-source.d.ts +36 -2
  63. package/out/zero-cache/src/services/change-source/pg/change-source.d.ts.map +1 -1
  64. package/out/zero-cache/src/services/change-source/pg/change-source.js +76 -33
  65. package/out/zero-cache/src/services/change-source/pg/change-source.js.map +1 -1
  66. package/out/zero-cache/src/services/change-source/pg/initial-sync.d.ts +15 -0
  67. package/out/zero-cache/src/services/change-source/pg/initial-sync.d.ts.map +1 -1
  68. package/out/zero-cache/src/services/change-source/pg/initial-sync.js +41 -10
  69. package/out/zero-cache/src/services/change-source/pg/initial-sync.js.map +1 -1
  70. package/out/zero-cache/src/services/change-source/pg/logical-replication/stream.d.ts +21 -0
  71. package/out/zero-cache/src/services/change-source/pg/logical-replication/stream.d.ts.map +1 -1
  72. package/out/zero-cache/src/services/change-source/pg/logical-replication/stream.js +34 -5
  73. package/out/zero-cache/src/services/change-source/pg/logical-replication/stream.js.map +1 -1
  74. package/out/zero-cache/src/services/change-source/pg/replication-slots.d.ts +2 -2
  75. package/out/zero-cache/src/services/change-source/pg/replication-slots.d.ts.map +1 -1
  76. package/out/zero-cache/src/services/change-source/pg/replication-slots.js.map +1 -1
  77. package/out/zero-cache/src/services/change-source/pg/schema/ddl.d.ts +61 -87
  78. package/out/zero-cache/src/services/change-source/pg/schema/ddl.d.ts.map +1 -1
  79. package/out/zero-cache/src/services/change-source/pg/schema/ddl.js +17 -12
  80. package/out/zero-cache/src/services/change-source/pg/schema/ddl.js.map +1 -1
  81. package/out/zero-cache/src/services/life-cycle.d.ts +1 -1
  82. package/out/zero-cache/src/services/life-cycle.d.ts.map +1 -1
  83. package/out/zero-cache/src/services/life-cycle.js +15 -3
  84. package/out/zero-cache/src/services/life-cycle.js.map +1 -1
  85. package/out/zero-cache/src/services/litestream/commands.d.ts.map +1 -1
  86. package/out/zero-cache/src/services/litestream/commands.js +20 -3
  87. package/out/zero-cache/src/services/litestream/commands.js.map +1 -1
  88. package/out/zero-cache/src/services/litestream/vfs-watermark-reader.js +2 -2
  89. package/out/zero-cache/src/services/mutagen/mutagen.d.ts.map +1 -1
  90. package/out/zero-cache/src/services/mutagen/mutagen.js +4 -1
  91. package/out/zero-cache/src/services/mutagen/mutagen.js.map +1 -1
  92. package/out/zero-cache/src/services/replicator/change-processor.d.ts.map +1 -1
  93. package/out/zero-cache/src/services/replicator/change-processor.js +28 -15
  94. package/out/zero-cache/src/services/replicator/change-processor.js.map +1 -1
  95. package/out/zero-cache/src/services/replicator/reporter/recorder.d.ts +1 -1
  96. package/out/zero-cache/src/services/replicator/reporter/recorder.d.ts.map +1 -1
  97. package/out/zero-cache/src/services/replicator/reporter/recorder.js +5 -12
  98. package/out/zero-cache/src/services/replicator/reporter/recorder.js.map +1 -1
  99. package/out/zero-cache/src/services/replicator/write-worker.js +38 -7
  100. package/out/zero-cache/src/services/replicator/write-worker.js.map +1 -1
  101. package/out/zero-cache/src/services/view-syncer/cvr.d.ts.map +1 -1
  102. package/out/zero-cache/src/services/view-syncer/cvr.js +8 -1
  103. package/out/zero-cache/src/services/view-syncer/cvr.js.map +1 -1
  104. package/out/zero-cache/src/services/view-syncer/pipeline-driver.d.ts.map +1 -1
  105. package/out/zero-cache/src/services/view-syncer/pipeline-driver.js +66 -26
  106. package/out/zero-cache/src/services/view-syncer/pipeline-driver.js.map +1 -1
  107. package/out/zero-cache/src/services/view-syncer/query-covering.d.ts +28 -0
  108. package/out/zero-cache/src/services/view-syncer/query-covering.d.ts.map +1 -0
  109. package/out/zero-cache/src/services/view-syncer/query-covering.js +159 -0
  110. package/out/zero-cache/src/services/view-syncer/query-covering.js.map +1 -0
  111. package/out/zero-cache/src/services/view-syncer/view-syncer.d.ts +2 -0
  112. package/out/zero-cache/src/services/view-syncer/view-syncer.d.ts.map +1 -1
  113. package/out/zero-cache/src/services/view-syncer/view-syncer.js +71 -1
  114. package/out/zero-cache/src/services/view-syncer/view-syncer.js.map +1 -1
  115. package/out/zero-cache/src/types/lite.d.ts.map +1 -1
  116. package/out/zero-cache/src/types/lite.js +4 -1
  117. package/out/zero-cache/src/types/lite.js.map +1 -1
  118. package/out/zero-cache/src/types/pg.d.ts +18 -0
  119. package/out/zero-cache/src/types/pg.d.ts.map +1 -1
  120. package/out/zero-cache/src/types/pg.js +50 -0
  121. package/out/zero-cache/src/types/pg.js.map +1 -1
  122. package/out/zero-cache/src/workers/syncer.d.ts +1 -1
  123. package/out/zero-cache/src/workers/syncer.d.ts.map +1 -1
  124. package/out/zero-cache/src/workers/syncer.js +1 -0
  125. package/out/zero-cache/src/workers/syncer.js.map +1 -1
  126. package/out/zero-client/src/client/crud.d.ts.map +1 -1
  127. package/out/zero-client/src/client/crud.js +3 -4
  128. package/out/zero-client/src/client/crud.js.map +1 -1
  129. package/out/zero-client/src/client/version.js +1 -1
  130. package/out/zero-schema/src/builder/relationship-builder.d.ts.map +1 -1
  131. package/out/zero-schema/src/builder/relationship-builder.js +3 -2
  132. package/out/zero-schema/src/builder/relationship-builder.js.map +1 -1
  133. package/out/zero-schema/src/builder/schema-builder.d.ts.map +1 -1
  134. package/out/zero-schema/src/builder/schema-builder.js +7 -7
  135. package/out/zero-schema/src/builder/schema-builder.js.map +1 -1
  136. package/out/zero-schema/src/builder/table-builder.d.ts.map +1 -1
  137. package/out/zero-schema/src/builder/table-builder.js +2 -1
  138. package/out/zero-schema/src/builder/table-builder.js.map +1 -1
  139. package/out/zero-server/src/custom.js +2 -1
  140. package/out/zero-server/src/custom.js.map +1 -1
  141. package/out/zql/src/ivm/view-apply-change.d.ts.map +1 -1
  142. package/out/zql/src/ivm/view-apply-change.js +2 -1
  143. package/out/zql/src/ivm/view-apply-change.js.map +1 -1
  144. package/out/zql/src/mutate/crud.d.ts +10 -8
  145. package/out/zql/src/mutate/crud.d.ts.map +1 -1
  146. package/out/zql/src/mutate/crud.js +3 -4
  147. package/out/zql/src/mutate/crud.js.map +1 -1
  148. package/out/zqlite/src/db.js +2 -2
  149. package/out/zqlite/src/internal/statement-cache.d.ts +25 -1
  150. package/out/zqlite/src/internal/statement-cache.d.ts.map +1 -1
  151. package/out/zqlite/src/internal/statement-cache.js +48 -18
  152. package/out/zqlite/src/internal/statement-cache.js.map +1 -1
  153. package/out/zqlite/src/query-builder.js +3 -3
  154. package/out/zqlite/src/query-builder.js.map +1 -1
  155. package/out/zqlite/src/sqlite-cost-model.js +5 -5
  156. package/out/zqlite/src/table-source.js +3 -3
  157. package/package.json +2 -33
@@ -3,7 +3,14 @@
3
3
  * Does not update the expiration time on retrieval.
4
4
  * Values are automatically removed from the cache after the TTL expires.
5
5
  * The cache is cleaned up periodically based on the TTL so it does
6
- * not grow indefinitely.
6
+ * not grow indefinitely. The cleanup interval is started lazily on the
7
+ * first `set()` and is `unref`ed (where supported) so it never keeps
8
+ * the process alive.
9
+ *
10
+ * Call `destroy()` to stop the cleanup interval and release the cached
11
+ * values. `destroy()` is idempotent, and a destroyed cache is inert:
12
+ * `get()` always misses, `set()` is a no-op, and the cleanup interval
13
+ * is never restarted.
7
14
  */
8
15
  export declare class TimedCache<T> {
9
16
  #private;
@@ -1 +1 @@
1
- {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../../shared/src/cache.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,qBAAa,UAAU,CAAC,CAAC;;gBAKX,KAAK,EAAE,MAAM;IAazB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI;IAKhC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAS/B,OAAO,IAAI,IAAI;CAIhB"}
1
+ {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../../shared/src/cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,qBAAa,UAAU,CAAC,CAAC;;gBAMX,KAAK,EAAE,MAAM;IAKzB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI;IAehC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAkB/B,OAAO,IAAI,IAAI;CAQhB"}
@@ -4,26 +4,34 @@
4
4
  * Does not update the expiration time on retrieval.
5
5
  * Values are automatically removed from the cache after the TTL expires.
6
6
  * The cache is cleaned up periodically based on the TTL so it does
7
- * not grow indefinitely.
7
+ * not grow indefinitely. The cleanup interval is started lazily on the
8
+ * first `set()` and is `unref`ed (where supported) so it never keeps
9
+ * the process alive.
10
+ *
11
+ * Call `destroy()` to stop the cleanup interval and release the cached
12
+ * values. `destroy()` is idempotent, and a destroyed cache is inert:
13
+ * `get()` always misses, `set()` is a no-op, and the cleanup interval
14
+ * is never restarted.
8
15
  */
9
16
  var TimedCache = class {
10
17
  #cache;
11
18
  #ttlMs;
12
19
  #intervalHandle;
20
+ #destroyed = false;
13
21
  constructor(ttlMs) {
14
22
  this.#cache = /* @__PURE__ */ new Map();
15
23
  this.#ttlMs = ttlMs;
16
- this.#intervalHandle = setInterval(() => {
17
- const now = Date.now();
18
- for (const [key, entry] of this.#cache.entries()) if (entry.expiresAt < now) this.#cache.delete(key);
19
- }, ttlMs * 2);
20
24
  }
21
25
  set(key, value) {
22
- const entry = {
26
+ if (this.#destroyed) return;
27
+ if (this.#intervalHandle === void 0) {
28
+ this.#intervalHandle = setInterval(() => this.#removeExpired(), this.#ttlMs * 2);
29
+ this.#intervalHandle.unref?.();
30
+ }
31
+ this.#cache.set(key, {
23
32
  value,
24
33
  expiresAt: Date.now() + this.#ttlMs
25
- };
26
- this.#cache.set(key, entry);
34
+ });
27
35
  }
28
36
  get(key) {
29
37
  const entry = this.#cache.get(key);
@@ -33,8 +41,16 @@ var TimedCache = class {
33
41
  }
34
42
  return entry.value;
35
43
  }
44
+ #removeExpired() {
45
+ const now = Date.now();
46
+ for (const [key, entry] of this.#cache.entries()) if (entry.expiresAt < now) this.#cache.delete(key);
47
+ }
36
48
  destroy() {
37
- clearInterval(this.#intervalHandle);
49
+ this.#destroyed = true;
50
+ if (this.#intervalHandle !== void 0) {
51
+ clearInterval(this.#intervalHandle);
52
+ this.#intervalHandle = void 0;
53
+ }
38
54
  this.#cache.clear();
39
55
  }
40
56
  };
@@ -1 +1 @@
1
- {"version":3,"file":"cache.js","names":["#cache","#ttlMs","#intervalHandle"],"sources":["../../../../shared/src/cache.ts"],"sourcesContent":["/**\n * Stores values with an expiration time at time of insertion.\n * Does not update the expiration time on retrieval.\n * Values are automatically removed from the cache after the TTL expires.\n * The cache is cleaned up periodically based on the TTL so it does\n * not grow indefinitely.\n */\nexport class TimedCache<T> {\n readonly #cache: Map<string, {value: T; expiresAt: number}>;\n readonly #ttlMs: number;\n readonly #intervalHandle: NodeJS.Timeout;\n\n constructor(ttlMs: number) {\n this.#cache = new Map();\n this.#ttlMs = ttlMs;\n this.#intervalHandle = setInterval(() => {\n const now = Date.now();\n for (const [key, entry] of this.#cache.entries()) {\n if (entry.expiresAt < now) {\n this.#cache.delete(key);\n }\n }\n }, ttlMs * 2);\n }\n\n set(key: string, value: T): void {\n const entry = {value, expiresAt: Date.now() + this.#ttlMs};\n this.#cache.set(key, entry);\n }\n\n get(key: string): T | undefined {\n const entry = this.#cache.get(key);\n if (entry === undefined || entry.expiresAt < Date.now()) {\n this.#cache.delete(key);\n return undefined;\n }\n return entry.value;\n }\n\n destroy(): void {\n clearInterval(this.#intervalHandle);\n this.#cache.clear();\n }\n}\n"],"mappings":";;;;;;;;AAOA,IAAa,aAAb,MAA2B;CACzB;CACA;CACA;CAEA,YAAY,OAAe;EACzB,KAAKA,yBAAS,IAAI,IAAI;EACtB,KAAKC,SAAS;EACd,KAAKC,kBAAkB,kBAAkB;GACvC,MAAM,MAAM,KAAK,IAAI;GACrB,KAAK,MAAM,CAAC,KAAK,UAAU,KAAKF,OAAO,QAAQ,GAC7C,IAAI,MAAM,YAAY,KACpB,KAAKA,OAAO,OAAO,GAAG;EAG5B,GAAG,QAAQ,CAAC;CACd;CAEA,IAAI,KAAa,OAAgB;EAC/B,MAAM,QAAQ;GAAC;GAAO,WAAW,KAAK,IAAI,IAAI,KAAKC;EAAM;EACzD,KAAKD,OAAO,IAAI,KAAK,KAAK;CAC5B;CAEA,IAAI,KAA4B;EAC9B,MAAM,QAAQ,KAAKA,OAAO,IAAI,GAAG;EACjC,IAAI,UAAU,KAAA,KAAa,MAAM,YAAY,KAAK,IAAI,GAAG;GACvD,KAAKA,OAAO,OAAO,GAAG;GACtB;EACF;EACA,OAAO,MAAM;CACf;CAEA,UAAgB;EACd,cAAc,KAAKE,eAAe;EAClC,KAAKF,OAAO,MAAM;CACpB;AACF"}
1
+ {"version":3,"file":"cache.js","names":["#cache","#ttlMs","#destroyed","#intervalHandle","#removeExpired"],"sources":["../../../../shared/src/cache.ts"],"sourcesContent":["/**\n * Stores values with an expiration time at time of insertion.\n * Does not update the expiration time on retrieval.\n * Values are automatically removed from the cache after the TTL expires.\n * The cache is cleaned up periodically based on the TTL so it does\n * not grow indefinitely. The cleanup interval is started lazily on the\n * first `set()` and is `unref`ed (where supported) so it never keeps\n * the process alive.\n *\n * Call `destroy()` to stop the cleanup interval and release the cached\n * values. `destroy()` is idempotent, and a destroyed cache is inert:\n * `get()` always misses, `set()` is a no-op, and the cleanup interval\n * is never restarted.\n */\nexport class TimedCache<T> {\n readonly #cache: Map<string, {value: T; expiresAt: number}>;\n readonly #ttlMs: number;\n #intervalHandle: ReturnType<typeof setInterval> | undefined;\n #destroyed = false;\n\n constructor(ttlMs: number) {\n this.#cache = new Map();\n this.#ttlMs = ttlMs;\n }\n\n set(key: string, value: T): void {\n if (this.#destroyed) {\n return;\n }\n if (this.#intervalHandle === undefined) {\n this.#intervalHandle = setInterval(\n () => this.#removeExpired(),\n this.#ttlMs * 2,\n );\n // In browsers setInterval returns a number, which has no unref.\n this.#intervalHandle.unref?.();\n }\n this.#cache.set(key, {value, expiresAt: Date.now() + this.#ttlMs});\n }\n\n get(key: string): T | undefined {\n const entry = this.#cache.get(key);\n if (entry === undefined || entry.expiresAt < Date.now()) {\n this.#cache.delete(key);\n return undefined;\n }\n return entry.value;\n }\n\n #removeExpired(): void {\n const now = Date.now();\n for (const [key, entry] of this.#cache.entries()) {\n if (entry.expiresAt < now) {\n this.#cache.delete(key);\n }\n }\n }\n\n destroy(): void {\n this.#destroyed = true;\n if (this.#intervalHandle !== undefined) {\n clearInterval(this.#intervalHandle);\n this.#intervalHandle = undefined;\n }\n this.#cache.clear();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAcA,IAAa,aAAb,MAA2B;CACzB;CACA;CACA;CACA,aAAa;CAEb,YAAY,OAAe;EACzB,KAAKA,yBAAS,IAAI,IAAI;EACtB,KAAKC,SAAS;CAChB;CAEA,IAAI,KAAa,OAAgB;EAC/B,IAAI,KAAKC,YACP;EAEF,IAAI,KAAKC,oBAAoB,KAAA,GAAW;GACtC,KAAKA,kBAAkB,kBACf,KAAKC,eAAe,GAC1B,KAAKH,SAAS,CAChB;GAEA,KAAKE,gBAAgB,QAAQ;EAC/B;EACA,KAAKH,OAAO,IAAI,KAAK;GAAC;GAAO,WAAW,KAAK,IAAI,IAAI,KAAKC;EAAM,CAAC;CACnE;CAEA,IAAI,KAA4B;EAC9B,MAAM,QAAQ,KAAKD,OAAO,IAAI,GAAG;EACjC,IAAI,UAAU,KAAA,KAAa,MAAM,YAAY,KAAK,IAAI,GAAG;GACvD,KAAKA,OAAO,OAAO,GAAG;GACtB;EACF;EACA,OAAO,MAAM;CACf;CAEA,iBAAuB;EACrB,MAAM,MAAM,KAAK,IAAI;EACrB,KAAK,MAAM,CAAC,KAAK,UAAU,KAAKA,OAAO,QAAQ,GAC7C,IAAI,MAAM,YAAY,KACpB,KAAKA,OAAO,OAAO,GAAG;CAG5B;CAEA,UAAgB;EACd,KAAKE,aAAa;EAClB,IAAI,KAAKC,oBAAoB,KAAA,GAAW;GACtC,cAAc,KAAKA,eAAe;GAClC,KAAKA,kBAAkB,KAAA;EACzB;EACA,KAAKH,OAAO,MAAM;CACpB;AACF"}
@@ -1,6 +1,11 @@
1
- export declare function mapValues<T extends Record<string, unknown>, U>(input: T, mapper: (value: T[keyof T]) => U): {
1
+ export declare function mapValues<T extends Record<string, unknown>, U>(input: T, mapper: (value: T[keyof T], key: keyof T & string) => U): {
2
2
  [K in keyof T]: U;
3
3
  };
4
+ /**
5
+ * Safe function of `[[Set]]`/assign that prevents invoking the legacy
6
+ * `__proto__` setter. This is used to avoid prototype pollution attacks.
7
+ */
8
+ export declare function assignProperty<K extends string | number | symbol, T>(object: Record<K, T>, key: K, value: T): void;
4
9
  export declare function mapEntries<T, U>(input: Record<string, T>, mapper: (key: string, val: T) => [key: string, val: U]): Record<string, U>;
5
10
  export declare function mapAllEntries<T, U>(input: Record<string, T>, mapper: (entries: [key: string, val: T][]) => [key: string, val: U][]): Record<string, U>;
6
11
  //# sourceMappingURL=objects.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"objects.d.ts","sourceRoot":"","sources":["../../../../shared/src/objects.ts"],"names":[],"mappings":"AAAA,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,EAC5D,KAAK,EAAE,CAAC,EACR,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,GAC/B;KAAE,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC;CAAC,CAIrB;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,CAAC,EAC7B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,EACxB,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,GACrD,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAYnB;AAED,wBAAgB,aAAa,CAAC,CAAC,EAAE,CAAC,EAChC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,EACxB,MAAM,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG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AE,CAAC,CAAC,EAAE,GACpE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAQnB"}
@@ -1,21 +1,36 @@
1
1
  //#region ../shared/src/objects.ts
2
2
  function mapValues(input, mapper) {
3
- return mapEntries(input, (k, v) => [k, mapper(v)]);
3
+ const output = {};
4
+ for (const entry of Object.entries(input)) assignProperty(output, entry[0], mapper(entry[1], entry[0]));
5
+ return output;
6
+ }
7
+ /**
8
+ * Safe function of `[[Set]]`/assign that prevents invoking the legacy
9
+ * `__proto__` setter. This is used to avoid prototype pollution attacks.
10
+ */
11
+ function assignProperty(object, key, value) {
12
+ if (key === "__proto__") Object.defineProperty(object, key, {
13
+ value,
14
+ writable: true,
15
+ enumerable: true,
16
+ configurable: true
17
+ });
18
+ object[key] = value;
4
19
  }
5
20
  function mapEntries(input, mapper) {
6
21
  const output = {};
7
22
  for (const entry of Object.entries(input)) {
8
23
  const mapped = mapper(entry[0], entry[1]);
9
- output[mapped[0]] = mapped[1];
24
+ assignProperty(output, mapped[0], mapped[1]);
10
25
  }
11
26
  return output;
12
27
  }
13
28
  function mapAllEntries(input, mapper) {
14
29
  const output = {};
15
- for (const mapped of mapper(Object.entries(input))) output[mapped[0]] = mapped[1];
30
+ for (const [key, val] of mapper(Object.entries(input))) assignProperty(output, key, val);
16
31
  return output;
17
32
  }
18
33
  //#endregion
19
- export { mapAllEntries, mapEntries, mapValues };
34
+ export { assignProperty, mapAllEntries, mapEntries, mapValues };
20
35
 
21
36
  //# sourceMappingURL=objects.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"objects.js","names":[],"sources":["../../../../shared/src/objects.ts"],"sourcesContent":["export function mapValues<T extends Record<string, unknown>, U>(\n input: T,\n mapper: (value: T[keyof T]) => U,\n): {[K in keyof T]: U} {\n return mapEntries(input, (k, v) => [k, mapper(v as T[keyof T])]) as {\n [K in keyof T]: U;\n };\n}\n\nexport function mapEntries<T, U>(\n input: Record<string, T>,\n mapper: (key: string, val: T) => [key: string, val: U],\n): Record<string, U> {\n // Direct assignment is faster than Object.fromEntries()\n // https://github.com/rocicorp/mono/pull/3927#issuecomment-2706059475\n const output: Record<string, U> = {};\n\n // In chrome Object.entries is faster than for-in (13x) or Object.keys (15x)\n // https://gist.github.com/arv/1b4e113724f6a14e2d4742bcc760d1fa\n for (const entry of Object.entries(input)) {\n const mapped = mapper(entry[0], entry[1]);\n output[mapped[0]] = mapped[1];\n }\n return output;\n}\n\nexport function mapAllEntries<T, U>(\n input: Record<string, T>,\n mapper: (entries: [key: string, val: T][]) => [key: string, val: U][],\n): Record<string, U> {\n // Direct assignment is faster than Object.fromEntries()\n // https://github.com/rocicorp/mono/pull/3927#issuecomment-2706059475\n const output: Record<string, U> = {};\n for (const mapped of mapper(Object.entries(input))) {\n output[mapped[0]] = mapped[1];\n }\n return output;\n}\n"],"mappings":";AAAA,SAAgB,UACd,OACA,QACqB;CACrB,OAAO,WAAW,QAAQ,GAAG,MAAM,CAAC,GAAG,OAAO,CAAe,CAAC,CAAC;AAGjE;AAEA,SAAgB,WACd,OACA,QACmB;CAGnB,MAAM,SAA4B,CAAC;CAInC,KAAK,MAAM,SAAS,OAAO,QAAQ,KAAK,GAAG;EACzC,MAAM,SAAS,OAAO,MAAM,IAAI,MAAM,EAAE;EACxC,OAAO,OAAO,MAAM,OAAO;CAC7B;CACA,OAAO;AACT;AAEA,SAAgB,cACd,OACA,QACmB;CAGnB,MAAM,SAA4B,CAAC;CACnC,KAAK,MAAM,UAAU,OAAO,OAAO,QAAQ,KAAK,CAAC,GAC/C,OAAO,OAAO,MAAM,OAAO;CAE7B,OAAO;AACT"}
1
+ {"version":3,"file":"objects.js","names":[],"sources":["../../../../shared/src/objects.ts"],"sourcesContent":["export function mapValues<T extends Record<string, unknown>, U>(\n input: T,\n mapper: (value: T[keyof T], key: keyof T & string) => U,\n): {[K in keyof T]: U} {\n const output = {} as {[K in keyof T]: U};\n\n for (const entry of Object.entries(input) as [\n keyof T & string,\n T[keyof T],\n ][]) {\n assignProperty(output, entry[0], mapper(entry[1], entry[0]));\n }\n\n return output;\n}\n\n/**\n * Safe function of `[[Set]]`/assign that prevents invoking the legacy\n * `__proto__` setter. This is used to avoid prototype pollution attacks.\n */\nexport function assignProperty<K extends string | number | symbol, T>(\n object: Record<K, T>,\n key: K,\n value: T,\n): void {\n if (key === '__proto__') {\n // Shadow the `__proto__` property on the object to prevent prototype\n // pollution.\n Object.defineProperty(object, key, {\n value,\n writable: true,\n enumerable: true,\n configurable: true,\n });\n // fall through to the normal assignment to ensure that potentional Proxy\n // traps are invoked.\n }\n\n object[key] = value;\n}\n\nexport function mapEntries<T, U>(\n input: Record<string, T>,\n mapper: (key: string, val: T) => [key: string, val: U],\n): Record<string, U> {\n const output: Record<string, U> = {};\n\n for (const entry of Object.entries(input)) {\n const mapped = mapper(entry[0], entry[1]);\n assignProperty(output, mapped[0], mapped[1]);\n }\n\n return output;\n}\n\nexport function mapAllEntries<T, U>(\n input: Record<string, T>,\n mapper: (entries: [key: string, val: T][]) => [key: string, val: U][],\n): Record<string, U> {\n const output: Record<string, U> = {};\n\n for (const [key, val] of mapper(Object.entries(input))) {\n assignProperty(output, key, val);\n }\n\n return output;\n}\n"],"mappings":";AAAA,SAAgB,UACd,OACA,QACqB;CACrB,MAAM,SAAS,CAAC;CAEhB,KAAK,MAAM,SAAS,OAAO,QAAQ,KAAK,GAItC,eAAe,QAAQ,MAAM,IAAI,OAAO,MAAM,IAAI,MAAM,EAAE,CAAC;CAG7D,OAAO;AACT;;;;;AAMA,SAAgB,eACd,QACA,KACA,OACM;CACN,IAAI,QAAQ,aAGV,OAAO,eAAe,QAAQ,KAAK;EACjC;EACA,UAAU;EACV,YAAY;EACZ,cAAc;CAChB,CAAC;CAKH,OAAO,OAAO;AAChB;AAEA,SAAgB,WACd,OACA,QACmB;CACnB,MAAM,SAA4B,CAAC;CAEnC,KAAK,MAAM,SAAS,OAAO,QAAQ,KAAK,GAAG;EACzC,MAAM,SAAS,OAAO,MAAM,IAAI,MAAM,EAAE;EACxC,eAAe,QAAQ,OAAO,IAAI,OAAO,EAAE;CAC7C;CAEA,OAAO;AACT;AAEA,SAAgB,cACd,OACA,QACmB;CACnB,MAAM,SAA4B,CAAC;CAEnC,KAAK,MAAM,CAAC,KAAK,QAAQ,OAAO,OAAO,QAAQ,KAAK,CAAC,GACnD,eAAe,QAAQ,KAAK,GAAG;CAGjC,OAAO;AACT"}
@@ -1,6 +1,6 @@
1
1
  var package_default = {
2
2
  name: "@rocicorp/zero",
3
- version: "1.8.0",
3
+ version: "1.9.0-canary.0",
4
4
  description: "Zero is a web framework for serverless web development.",
5
5
  homepage: "https://zero.rocicorp.dev",
6
6
  bugs: { "url": "https://bugs.rocicorp.dev" },
@@ -171,6 +171,7 @@ var package_default = {
171
171
  "analyze-query": "workspace:*",
172
172
  "ast-to-zql": "workspace:*",
173
173
  "expo-sqlite": ">=15",
174
+ "oxc-parser": "^0.129.0",
174
175
  "replicache": "workspace:*",
175
176
  "shared": "workspace:*",
176
177
  "syncpack": "^14.3.0",
@@ -187,24 +188,6 @@ var package_default = {
187
188
  "zero-solid": "workspace:*",
188
189
  "zqlite": "workspace:*"
189
190
  },
190
- peerDependencies: {
191
- "@op-engineering/op-sqlite": ">=15",
192
- "drizzle-orm": "^0.45.2",
193
- "expo-sqlite": ">=15",
194
- "kysely": "^0.28.17",
195
- "pg": "^8.16.3",
196
- "react": "^19.2.6",
197
- "solid-js": "^1.9.4"
198
- },
199
- peerDependenciesMeta: {
200
- "@op-engineering/op-sqlite": { "optional": true },
201
- "drizzle-orm": { "optional": true },
202
- "expo-sqlite": { "optional": true },
203
- "kysely": { "optional": true },
204
- "pg": { "optional": true },
205
- "react": { "optional": true },
206
- "solid-js": { "optional": true }
207
- },
208
191
  engines: { "node": ">=22" },
209
192
  packageManager: "pnpm@11.5.3"
210
193
  };
@@ -1 +1 @@
1
- {"version":3,"file":"package.js","names":[],"sources":["../../package.json"],"sourcesContent":["{\n \"name\": \"@rocicorp/zero\",\n \"version\": \"1.8.0\",\n \"description\": \"Zero is a web framework for serverless web development.\",\n \"homepage\": \"https://zero.rocicorp.dev\",\n \"bugs\": {\n \"url\": \"https://bugs.rocicorp.dev\"\n },\n \"license\": \"Apache-2.0\",\n \"author\": \"Rocicorp, Inc.\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/rocicorp/mono.git\",\n \"directory\": \"packages/zero\"\n },\n \"bin\": {\n \"analyze-query\": \"./out/zero/src/analyze-query.js\",\n \"ast-to-zql\": \"./out/zero/src/ast-to-zql.js\",\n \"transform-query\": \"./out/zero/src/transform-query.js\",\n \"zero-build-schema\": \"./out/zero/src/build-schema.js\",\n \"zero-cache\": \"./out/zero/src/cli.js\",\n \"zero-cache-dev\": \"./out/zero/src/zero-cache-dev.js\",\n \"zero-deploy-permissions\": \"./out/zero/src/deploy-permissions.js\",\n \"zero-out\": \"./out/zero/src/zero-out.js\"\n },\n \"files\": [\n \"out\",\n \"!*.tsbuildinfo\"\n ],\n \"type\": \"module\",\n \"main\": \"out/zero/src/zero.js\",\n \"module\": \"out/zero/src/zero.js\",\n \"types\": \"out/zero/src/zero.d.ts\",\n \"exports\": {\n \".\": {\n \"types\": \"./out/zero/src/zero.d.ts\",\n \"default\": \"./out/zero/src/zero.js\"\n },\n \"./analyze\": {\n \"types\": \"./out/zero/src/analyze.d.ts\",\n \"default\": \"./out/zero/src/analyze.js\"\n },\n \"./bindings\": {\n \"types\": \"./out/zero/src/bindings.d.ts\",\n \"default\": \"./out/zero/src/bindings.js\"\n },\n \"./change-protocol/v0\": {\n \"types\": \"./out/zero/src/change-protocol/v0.d.ts\",\n \"default\": \"./out/zero/src/change-protocol/v0.js\"\n },\n \"./expo-sqlite\": {\n \"types\": \"./out/zero/src/expo-sqlite.d.ts\",\n \"default\": \"./out/zero/src/expo-sqlite.js\"\n },\n \"./op-sqlite\": {\n \"types\": \"./out/zero/src/op-sqlite.d.ts\",\n \"default\": \"./out/zero/src/op-sqlite.js\"\n },\n \"./pg\": {\n \"types\": \"./out/zero/src/pg.d.ts\",\n \"default\": \"./out/zero/src/pg.js\"\n },\n \"./react\": {\n \"types\": \"./out/zero/src/react.d.ts\",\n \"default\": \"./out/zero/src/react.js\"\n },\n \"./react-native\": {\n \"types\": \"./out/zero/src/react-native.d.ts\",\n \"default\": \"./out/zero/src/react-native.js\"\n },\n \"./server\": {\n \"types\": \"./out/zero/src/server.d.ts\",\n \"default\": \"./out/zero/src/server.js\"\n },\n \"./server/adapters/drizzle\": {\n \"types\": \"./out/zero/src/adapters/drizzle.d.ts\",\n \"default\": \"./out/zero/src/adapters/drizzle.js\"\n },\n \"./server/adapters/kysely\": {\n \"types\": \"./out/zero/src/adapters/kysely.d.ts\",\n \"default\": \"./out/zero/src/adapters/kysely.js\"\n },\n \"./server/adapters/prisma\": {\n \"types\": \"./out/zero/src/adapters/prisma.d.ts\",\n \"default\": \"./out/zero/src/adapters/prisma.js\"\n },\n \"./server/adapters/pg\": {\n \"types\": \"./out/zero/src/adapters/pg.d.ts\",\n \"default\": \"./out/zero/src/adapters/pg.js\"\n },\n \"./server/adapters/postgresjs\": {\n \"types\": \"./out/zero/src/adapters/postgresjs.d.ts\",\n \"default\": \"./out/zero/src/adapters/postgresjs.js\"\n },\n \"./solid\": {\n \"types\": \"./out/zero/src/solid.d.ts\",\n \"default\": \"./out/zero/src/solid.js\"\n },\n \"./sqlite\": {\n \"types\": \"./out/zero/src/sqlite.d.ts\",\n \"default\": \"./out/zero/src/sqlite.js\"\n },\n \"./zqlite\": {\n \"types\": \"./out/zero/src/zqlite.d.ts\",\n \"default\": \"./out/zero/src/zqlite.js\"\n }\n },\n \"scripts\": {\n \"build\": \"node --experimental-strip-types --no-warnings tool/build.ts\",\n \"build:watch\": \"node --experimental-strip-types --no-warnings tool/build.ts --watch\",\n \"check-types\": \"tsc -p tsconfig.client.json && tsc -p tsconfig.server.json\",\n \"check-types:client:watch\": \"tsc -p tsconfig.client.json --watch\",\n \"check-types:server:watch\": \"tsc -p tsconfig.server.json --watch\",\n \"format\": \"oxfmt .\",\n \"check-format\": \"oxfmt --check .\",\n \"lint\": \"oxlint --quiet --config ../../oxlint.config.ts src/\",\n \"docs\": \"node --experimental-strip-types --no-warnings tool/generate-docs.ts\",\n \"docs:server\": \"node --watch --experimental-strip-types --no-warnings tool/generate-docs.ts --server\",\n \"fmt\": \"oxfmt .\",\n \"check-fmt\": \"oxfmt --check .\"\n },\n \"dependencies\": {\n \"@badrap/valita\": \"0.3.11\",\n \"@databases/escape-identifier\": \"^1.0.3\",\n \"@databases/sql\": \"^3.3.0\",\n \"@dotenvx/dotenvx\": \"^1.39.0\",\n \"@drdgvhbh/postgres-error-codes\": \"^0.0.6\",\n \"@fastify/cors\": \"^10.0.0\",\n \"@fastify/websocket\": \"^11.0.0\",\n \"@google-cloud/precise-date\": \"^4.0.0\",\n \"@opentelemetry/api\": \"^1.9.0\",\n \"@opentelemetry/api-logs\": \"^0.218.0\",\n \"@opentelemetry/auto-instrumentations-node\": \"^0.76.0\",\n \"@opentelemetry/exporter-metrics-otlp-http\": \"^0.218.0\",\n \"@opentelemetry/resources\": \"^2.7.1\",\n \"@opentelemetry/sdk-metrics\": \"^2.7.1\",\n \"@opentelemetry/sdk-node\": \"^0.218.0\",\n \"@opentelemetry/sdk-trace-node\": \"^2.7.1\",\n \"@opentelemetry/semantic-conventions\": \"^1.41.1\",\n \"@postgresql-typed/oids\": \"^0.2.0\",\n \"@rocicorp/lock\": \"^1.0.4\",\n \"@rocicorp/logger\": \"^6.1.0\",\n \"@rocicorp/resolver\": \"^1.0.2\",\n \"@rocicorp/zero-sqlite3\": \"^1.1.2\",\n \"@standard-schema/spec\": \"^1.0.0\",\n \"@types/basic-auth\": \"^1.1.8\",\n \"@types/ws\": \"^8.5.12\",\n \"basic-auth\": \"^2.0.1\",\n \"chalk-template\": \"^1.1.0\",\n \"chokidar\": \"^4.0.1\",\n \"cloudevents\": \"^10.0.0\",\n \"command-line-args\": \"^6.0.1\",\n \"command-line-usage\": \"^7.0.3\",\n \"compare-utf8\": \"^0.2.0\",\n \"defu\": \"^6.1.4\",\n \"eventemitter3\": \"^5.0.1\",\n \"fastify\": \"^5.0.0\",\n \"is-in-subnet\": \"^4.0.1\",\n \"jose\": \"^5.9.3\",\n \"js-xxhash\": \"^4.0.0\",\n \"json-custom-numbers\": \"^3.1.1\",\n \"kasi\": \"^1.1.0\",\n \"nanoid\": \"^5.1.2\",\n \"oxfmt\": \"^0.45.0\",\n \"parse-prometheus-text-format\": \"^1.1.1\",\n \"pg-format\": \"npm:pg-format-fix@^1.0.5\",\n \"postgres\": \"3.4.7\",\n \"semver\": \"^7.5.4\",\n \"url-pattern\": \"^1.0.3\",\n \"urlpattern-polyfill\": \"^10.1.0\",\n \"ws\": \"^8.18.1\"\n },\n \"devDependencies\": {\n \"@op-engineering/op-sqlite\": \">=15\",\n \"@vitest/runner\": \"^4.1.6\",\n \"analyze-query\": \"workspace:*\",\n \"ast-to-zql\": \"workspace:*\",\n \"expo-sqlite\": \">=15\",\n \"replicache\": \"workspace:*\",\n \"shared\": \"workspace:*\",\n \"syncpack\": \"^14.3.0\",\n \"typedoc\": \"^0.28.17\",\n \"typedoc-plugin-markdown\": \"^4.10.0\",\n \"typescript\": \"~6.0.2\",\n \"vite\": \"^8.0.13\",\n \"vitest\": \"^4.1.6\",\n \"zero-cache\": \"workspace:*\",\n \"zero-client\": \"workspace:*\",\n \"zero-pg\": \"workspace:*\",\n \"zero-react\": \"workspace:*\",\n \"zero-server\": \"workspace:*\",\n \"zero-solid\": \"workspace:*\",\n \"zqlite\": \"workspace:*\"\n },\n \"peerDependencies\": {\n \"@op-engineering/op-sqlite\": \">=15\",\n \"drizzle-orm\": \"^0.45.2\",\n \"expo-sqlite\": \">=15\",\n \"kysely\": \"^0.28.17\",\n \"pg\": \"^8.16.3\",\n \"react\": \"^19.2.6\",\n \"solid-js\": \"^1.9.4\"\n },\n \"peerDependenciesMeta\": {\n \"@op-engineering/op-sqlite\": {\n \"optional\": true\n },\n \"drizzle-orm\": {\n \"optional\": true\n },\n \"expo-sqlite\": {\n \"optional\": true\n },\n \"kysely\": {\n \"optional\": true\n },\n \"pg\": {\n \"optional\": true\n },\n \"react\": {\n \"optional\": true\n },\n \"solid-js\": {\n \"optional\": true\n }\n },\n \"engines\": {\n \"node\": \">=22\"\n },\n \"packageManager\": \"pnpm@11.5.3\"\n}\n"],"mappings":""}
1
+ {"version":3,"file":"package.js","names":[],"sources":["../../package.json"],"sourcesContent":["{\n \"name\": \"@rocicorp/zero\",\n \"version\": \"1.9.0-canary.0\",\n \"description\": \"Zero is a web framework for serverless web development.\",\n \"homepage\": \"https://zero.rocicorp.dev\",\n \"bugs\": {\n \"url\": \"https://bugs.rocicorp.dev\"\n },\n \"license\": \"Apache-2.0\",\n \"author\": \"Rocicorp, Inc.\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/rocicorp/mono.git\",\n \"directory\": \"packages/zero\"\n },\n \"bin\": {\n \"analyze-query\": \"./out/zero/src/analyze-query.js\",\n \"ast-to-zql\": \"./out/zero/src/ast-to-zql.js\",\n \"transform-query\": \"./out/zero/src/transform-query.js\",\n \"zero-build-schema\": \"./out/zero/src/build-schema.js\",\n \"zero-cache\": \"./out/zero/src/cli.js\",\n \"zero-cache-dev\": \"./out/zero/src/zero-cache-dev.js\",\n \"zero-deploy-permissions\": \"./out/zero/src/deploy-permissions.js\",\n \"zero-out\": \"./out/zero/src/zero-out.js\"\n },\n \"files\": [\n \"out\",\n \"!*.tsbuildinfo\"\n ],\n \"type\": \"module\",\n \"main\": \"out/zero/src/zero.js\",\n \"module\": \"out/zero/src/zero.js\",\n \"types\": \"out/zero/src/zero.d.ts\",\n \"exports\": {\n \".\": {\n \"types\": \"./out/zero/src/zero.d.ts\",\n \"default\": \"./out/zero/src/zero.js\"\n },\n \"./analyze\": {\n \"types\": \"./out/zero/src/analyze.d.ts\",\n \"default\": \"./out/zero/src/analyze.js\"\n },\n \"./bindings\": {\n \"types\": \"./out/zero/src/bindings.d.ts\",\n \"default\": \"./out/zero/src/bindings.js\"\n },\n \"./change-protocol/v0\": {\n \"types\": \"./out/zero/src/change-protocol/v0.d.ts\",\n \"default\": \"./out/zero/src/change-protocol/v0.js\"\n },\n \"./expo-sqlite\": {\n \"types\": \"./out/zero/src/expo-sqlite.d.ts\",\n \"default\": \"./out/zero/src/expo-sqlite.js\"\n },\n \"./op-sqlite\": {\n \"types\": \"./out/zero/src/op-sqlite.d.ts\",\n \"default\": \"./out/zero/src/op-sqlite.js\"\n },\n \"./pg\": {\n \"types\": \"./out/zero/src/pg.d.ts\",\n \"default\": \"./out/zero/src/pg.js\"\n },\n \"./react\": {\n \"types\": \"./out/zero/src/react.d.ts\",\n \"default\": \"./out/zero/src/react.js\"\n },\n \"./react-native\": {\n \"types\": \"./out/zero/src/react-native.d.ts\",\n \"default\": \"./out/zero/src/react-native.js\"\n },\n \"./server\": {\n \"types\": \"./out/zero/src/server.d.ts\",\n \"default\": \"./out/zero/src/server.js\"\n },\n \"./server/adapters/drizzle\": {\n \"types\": \"./out/zero/src/adapters/drizzle.d.ts\",\n \"default\": \"./out/zero/src/adapters/drizzle.js\"\n },\n \"./server/adapters/kysely\": {\n \"types\": \"./out/zero/src/adapters/kysely.d.ts\",\n \"default\": \"./out/zero/src/adapters/kysely.js\"\n },\n \"./server/adapters/prisma\": {\n \"types\": \"./out/zero/src/adapters/prisma.d.ts\",\n \"default\": \"./out/zero/src/adapters/prisma.js\"\n },\n \"./server/adapters/pg\": {\n \"types\": \"./out/zero/src/adapters/pg.d.ts\",\n \"default\": \"./out/zero/src/adapters/pg.js\"\n },\n \"./server/adapters/postgresjs\": {\n \"types\": \"./out/zero/src/adapters/postgresjs.d.ts\",\n \"default\": \"./out/zero/src/adapters/postgresjs.js\"\n },\n \"./solid\": {\n \"types\": \"./out/zero/src/solid.d.ts\",\n \"default\": \"./out/zero/src/solid.js\"\n },\n \"./sqlite\": {\n \"types\": \"./out/zero/src/sqlite.d.ts\",\n \"default\": \"./out/zero/src/sqlite.js\"\n },\n \"./zqlite\": {\n \"types\": \"./out/zero/src/zqlite.d.ts\",\n \"default\": \"./out/zero/src/zqlite.js\"\n }\n },\n \"scripts\": {\n \"build\": \"node --experimental-strip-types --no-warnings tool/build.ts\",\n \"build:watch\": \"node --experimental-strip-types --no-warnings tool/build.ts --watch\",\n \"check-types\": \"tsc -p tsconfig.client.json && tsc -p tsconfig.server.json\",\n \"check-types:client:watch\": \"tsc -p tsconfig.client.json --watch\",\n \"check-types:server:watch\": \"tsc -p tsconfig.server.json --watch\",\n \"format\": \"oxfmt .\",\n \"check-format\": \"oxfmt --check .\",\n \"lint\": \"oxlint --quiet --config ../../oxlint.config.ts src/\",\n \"docs\": \"node --experimental-strip-types --no-warnings tool/generate-docs.ts\",\n \"docs:server\": \"node --watch --experimental-strip-types --no-warnings tool/generate-docs.ts --server\",\n \"fmt\": \"oxfmt .\",\n \"check-fmt\": \"oxfmt --check .\"\n },\n \"dependencies\": {\n \"@badrap/valita\": \"0.3.11\",\n \"@databases/escape-identifier\": \"^1.0.3\",\n \"@databases/sql\": \"^3.3.0\",\n \"@dotenvx/dotenvx\": \"^1.39.0\",\n \"@drdgvhbh/postgres-error-codes\": \"^0.0.6\",\n \"@fastify/cors\": \"^10.0.0\",\n \"@fastify/websocket\": \"^11.0.0\",\n \"@google-cloud/precise-date\": \"^4.0.0\",\n \"@opentelemetry/api\": \"^1.9.0\",\n \"@opentelemetry/api-logs\": \"^0.218.0\",\n \"@opentelemetry/auto-instrumentations-node\": \"^0.76.0\",\n \"@opentelemetry/exporter-metrics-otlp-http\": \"^0.218.0\",\n \"@opentelemetry/resources\": \"^2.7.1\",\n \"@opentelemetry/sdk-metrics\": \"^2.7.1\",\n \"@opentelemetry/sdk-node\": \"^0.218.0\",\n \"@opentelemetry/sdk-trace-node\": \"^2.7.1\",\n \"@opentelemetry/semantic-conventions\": \"^1.41.1\",\n \"@postgresql-typed/oids\": \"^0.2.0\",\n \"@rocicorp/lock\": \"^1.0.4\",\n \"@rocicorp/logger\": \"^6.1.0\",\n \"@rocicorp/resolver\": \"^1.0.2\",\n \"@rocicorp/zero-sqlite3\": \"^1.1.2\",\n \"@standard-schema/spec\": \"^1.0.0\",\n \"@types/basic-auth\": \"^1.1.8\",\n \"@types/ws\": \"^8.5.12\",\n \"basic-auth\": \"^2.0.1\",\n \"chalk-template\": \"^1.1.0\",\n \"chokidar\": \"^4.0.1\",\n \"cloudevents\": \"^10.0.0\",\n \"command-line-args\": \"^6.0.1\",\n \"command-line-usage\": \"^7.0.3\",\n \"compare-utf8\": \"^0.2.0\",\n \"defu\": \"^6.1.4\",\n \"eventemitter3\": \"^5.0.1\",\n \"fastify\": \"^5.0.0\",\n \"is-in-subnet\": \"^4.0.1\",\n \"jose\": \"^5.9.3\",\n \"js-xxhash\": \"^4.0.0\",\n \"json-custom-numbers\": \"^3.1.1\",\n \"kasi\": \"^1.1.0\",\n \"nanoid\": \"^5.1.2\",\n \"oxfmt\": \"^0.45.0\",\n \"parse-prometheus-text-format\": \"^1.1.1\",\n \"pg-format\": \"npm:pg-format-fix@^1.0.5\",\n \"postgres\": \"3.4.7\",\n \"semver\": \"^7.5.4\",\n \"url-pattern\": \"^1.0.3\",\n \"urlpattern-polyfill\": \"^10.1.0\",\n \"ws\": \"^8.18.1\"\n },\n \"devDependencies\": {\n \"@op-engineering/op-sqlite\": \">=15\",\n \"@vitest/runner\": \"^4.1.6\",\n \"analyze-query\": \"workspace:*\",\n \"ast-to-zql\": \"workspace:*\",\n \"expo-sqlite\": \">=15\",\n \"oxc-parser\": \"^0.129.0\",\n \"replicache\": \"workspace:*\",\n \"shared\": \"workspace:*\",\n \"syncpack\": \"^14.3.0\",\n \"typedoc\": \"^0.28.17\",\n \"typedoc-plugin-markdown\": \"^4.10.0\",\n \"typescript\": \"~6.0.2\",\n \"vite\": \"^8.0.13\",\n \"vitest\": \"^4.1.6\",\n \"zero-cache\": \"workspace:*\",\n \"zero-client\": \"workspace:*\",\n \"zero-pg\": \"workspace:*\",\n \"zero-react\": \"workspace:*\",\n \"zero-server\": \"workspace:*\",\n \"zero-solid\": \"workspace:*\",\n \"zqlite\": \"workspace:*\"\n },\n \"engines\": {\n \"node\": \">=22\"\n },\n \"packageManager\": \"pnpm@11.5.3\"\n}\n"],"mappings":""}
@@ -260,6 +260,10 @@ export declare const zeroOptions: {
260
260
  type: v.Type<boolean>;
261
261
  desc: string[];
262
262
  };
263
+ enableQueryCovering: {
264
+ type: v.Type<boolean>;
265
+ desc: string[];
266
+ };
263
267
  yieldThresholdMs: {
264
268
  type: v.Type<number>;
265
269
  desc: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"zero-config.d.ts","sourceRoot":"","sources":["../../../../../zero-cache/src/config/zero-config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAGL,KAAK,MAAM,EACX,KAAK,YAAY,EAClB,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,CAAC,MAAM,+BAA+B,CAAC;AAUnD,OAAO,EAGL,KAAK,oBAAoB,EAC1B,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAC,SAAS,EAAC,MAAM,kCAAkC,CAAC;AAEhE,eAAO,MAAM,mBAAmB,UAAU,CAAC;AAE3C,eAAO,MAAM,UAAU;;;;;;;;;CA+CtB,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;;CAwBxB,CAAC;AAEF,QAAA,MAAM,cAAc;;;;;;;;;CAmBnB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,OAAO,cAAc,CAAC,CAAC;AAE3D,QAAA,MAAM,oBAAoB;;;;;;;;;CAczB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAE5D,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA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e,CAAC,GAAG,SAAS,GACpD,MAAM,CAER;AAED,wBAAgB,oBAAoB,CAClC,EAAE,EAAE,UAAU,EACd,MAAM,EAAE,IAAI,CAAC,oBAAoB,EAAE,eAAe,CAAC,EACnD,QAAQ,EAAE,MAAM,GAAG,SAAS,WAwC7B;AAYD,wBAAgB,kBAAkB,SAEjC"}
@@ -358,6 +358,17 @@ var zeroOptions = {
358
358
  `You can disable the planner if it is picking bad strategies.`
359
359
  ]
360
360
  },
361
+ enableQueryCovering: {
362
+ type: valita_exports.boolean().default(true),
363
+ desc: [
364
+ `Enable shadow-mode query covering detection during query hydration.`,
365
+ ``,
366
+ `When enabled, view-syncers compare newly hydrated queries against running`,
367
+ `queries with the same root table and log aggregate coverage stats.`,
368
+ ``,
369
+ `You can disable this if covering detection adds too much CPU overhead.`
370
+ ]
371
+ },
361
372
  yieldThresholdMs: {
362
373
  type: valita_exports.number().default(10),
363
374
  desc: [
@@ -583,10 +594,10 @@ var zeroOptions = {
583
594
  type: valita_exports.number().default(3e4),
584
595
  desc: [
585
596
  `The minimum interval at which replication lag reports are written upstream and`,
586
- `reported via the {bold zero.replication.total_lag} opentelemetry metric. Because`,
587
- `replication lag reports are only issued after the previous one was received, the`,
588
- `actual interval between reports may be longer when there is a backlog in the`,
589
- `replication stream. A negative or 0 value disables lag reporting.`,
597
+ `reported via the {bold zero.replication.total_lag} opentelemetry metric. If`,
598
+ `an expected report is not received before the next interval, Zero retries with`,
599
+ `a new report and increments {bold zero.replication.lag_report_retries}. A`,
600
+ `negative or 0 value disables lag reporting.`,
590
601
  ``,
591
602
  `This monitoring feature is only support on the postgres upstream type.`
592
603
  ]
@@ -652,8 +663,12 @@ var zeroOptions = {
652
663
  ]
653
664
  },
654
665
  restoreUsingV5: {
655
- type: valita_exports.boolean().default(false),
656
- desc: [`Restores the backup using the {bold ZERO_LITESTREAM_EXECUTABLE_V5} if specified.`]
666
+ type: valita_exports.boolean().default(true),
667
+ desc: [
668
+ `Restores the backup using the {bold ZERO_LITESTREAM_EXECUTABLE_V5} if specified.`,
669
+ `This provides a recovery path if rolling back from {bold ZERO_LITESTREAM_BACKUP_USING_V5}`,
670
+ `as v5 restores from both v3 and v5 backups (whichever is more recent).`
671
+ ]
657
672
  },
658
673
  backupUsingV5: {
659
674
  type: valita_exports.boolean().default(false),