@rocicorp/zero 1.10.0-canary.1 → 1.10.0-canary.3

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 (180) hide show
  1. package/out/zero/package.js +1 -1
  2. package/out/zero/package.js.map +1 -1
  3. package/out/zero-cache/src/auth/write-authorizer.d.ts.map +1 -1
  4. package/out/zero-cache/src/auth/write-authorizer.js +8 -1
  5. package/out/zero-cache/src/auth/write-authorizer.js.map +1 -1
  6. package/out/zero-cache/src/config/normalize.d.ts.map +1 -1
  7. package/out/zero-cache/src/config/normalize.js +7 -2
  8. package/out/zero-cache/src/config/normalize.js.map +1 -1
  9. package/out/zero-cache/src/config/zero-config.d.ts +14 -4
  10. package/out/zero-cache/src/config/zero-config.d.ts.map +1 -1
  11. package/out/zero-cache/src/config/zero-config.js +26 -8
  12. package/out/zero-cache/src/config/zero-config.js.map +1 -1
  13. package/out/zero-cache/src/db/transaction-pool.d.ts +5 -2
  14. package/out/zero-cache/src/db/transaction-pool.d.ts.map +1 -1
  15. package/out/zero-cache/src/db/transaction-pool.js +5 -3
  16. package/out/zero-cache/src/db/transaction-pool.js.map +1 -1
  17. package/out/zero-cache/src/server/change-streamer.d.ts.map +1 -1
  18. package/out/zero-cache/src/server/change-streamer.js +24 -13
  19. package/out/zero-cache/src/server/change-streamer.js.map +1 -1
  20. package/out/zero-cache/src/server/runner/run-worker.js +1 -1
  21. package/out/zero-cache/src/server/worker-urls.d.ts +0 -1
  22. package/out/zero-cache/src/server/worker-urls.d.ts.map +1 -1
  23. package/out/zero-cache/src/server/worker-urls.js +1 -2
  24. package/out/zero-cache/src/server/worker-urls.js.map +1 -1
  25. package/out/zero-cache/src/services/change-source/pg/backfill-stream.js +1 -1
  26. package/out/zero-cache/src/services/change-source/pg/backfill-stream.js.map +1 -1
  27. package/out/zero-cache/src/services/change-source/pg/change-source.js +1 -1
  28. package/out/zero-cache/src/services/change-source/pg/decommission.d.ts.map +1 -1
  29. package/out/zero-cache/src/services/change-source/pg/decommission.js +20 -11
  30. package/out/zero-cache/src/services/change-source/pg/decommission.js.map +1 -1
  31. package/out/zero-cache/src/services/change-source/pg/initial-sync.d.ts.map +1 -1
  32. package/out/zero-cache/src/services/change-source/pg/initial-sync.js +51 -74
  33. package/out/zero-cache/src/services/change-source/pg/initial-sync.js.map +1 -1
  34. package/out/zero-cache/src/services/change-source/pg/logical-replication/stream.d.ts +20 -0
  35. package/out/zero-cache/src/services/change-source/pg/logical-replication/stream.d.ts.map +1 -1
  36. package/out/zero-cache/src/services/change-source/pg/logical-replication/stream.js +43 -3
  37. package/out/zero-cache/src/services/change-source/pg/logical-replication/stream.js.map +1 -1
  38. package/out/zero-cache/src/services/change-source/pg/replication-slots.d.ts +24 -1
  39. package/out/zero-cache/src/services/change-source/pg/replication-slots.d.ts.map +1 -1
  40. package/out/zero-cache/src/services/change-source/pg/replication-slots.js +35 -5
  41. package/out/zero-cache/src/services/change-source/pg/replication-slots.js.map +1 -1
  42. package/out/zero-cache/src/services/change-streamer/backup-cleanup-monitor-factory.d.ts +1 -4
  43. package/out/zero-cache/src/services/change-streamer/backup-cleanup-monitor-factory.d.ts.map +1 -1
  44. package/out/zero-cache/src/services/change-streamer/backup-cleanup-monitor-factory.js +11 -18
  45. package/out/zero-cache/src/services/change-streamer/backup-cleanup-monitor-factory.js.map +1 -1
  46. package/out/zero-cache/src/services/change-streamer/backup-monitor.d.ts.map +1 -1
  47. package/out/zero-cache/src/services/change-streamer/backup-monitor.js +8 -3
  48. package/out/zero-cache/src/services/change-streamer/backup-monitor.js.map +1 -1
  49. package/out/zero-cache/src/services/change-streamer/change-log-compare-digest.d.ts +34 -0
  50. package/out/zero-cache/src/services/change-streamer/change-log-compare-digest.d.ts.map +1 -0
  51. package/out/zero-cache/src/services/change-streamer/change-log-compare-digest.js +67 -0
  52. package/out/zero-cache/src/services/change-streamer/change-log-compare-digest.js.map +1 -0
  53. package/out/zero-cache/src/services/change-streamer/change-streamer-http.d.ts +2 -4
  54. package/out/zero-cache/src/services/change-streamer/change-streamer-http.d.ts.map +1 -1
  55. package/out/zero-cache/src/services/change-streamer/change-streamer-http.js +8 -2
  56. package/out/zero-cache/src/services/change-streamer/change-streamer-http.js.map +1 -1
  57. package/out/zero-cache/src/services/change-streamer/change-streamer-service.d.ts +34 -13
  58. package/out/zero-cache/src/services/change-streamer/change-streamer-service.d.ts.map +1 -1
  59. package/out/zero-cache/src/services/change-streamer/change-streamer-service.js +149 -27
  60. package/out/zero-cache/src/services/change-streamer/change-streamer-service.js.map +1 -1
  61. package/out/zero-cache/src/services/change-streamer/change-streamer.d.ts +3 -9
  62. package/out/zero-cache/src/services/change-streamer/change-streamer.d.ts.map +1 -1
  63. package/out/zero-cache/src/services/change-streamer/change-streamer.js.map +1 -1
  64. package/out/zero-cache/src/services/change-streamer/shard-sampling.d.ts +11 -0
  65. package/out/zero-cache/src/services/change-streamer/shard-sampling.d.ts.map +1 -0
  66. package/out/zero-cache/src/services/change-streamer/shard-sampling.js +19 -0
  67. package/out/zero-cache/src/services/change-streamer/shard-sampling.js.map +1 -0
  68. package/out/zero-cache/src/services/change-streamer/snapshot-reservations.d.ts +11 -1
  69. package/out/zero-cache/src/services/change-streamer/snapshot-reservations.d.ts.map +1 -1
  70. package/out/zero-cache/src/services/change-streamer/snapshot-reservations.js +38 -5
  71. package/out/zero-cache/src/services/change-streamer/snapshot-reservations.js.map +1 -1
  72. package/out/zero-cache/src/services/change-streamer/sqlite-change-log-catchup.d.ts +25 -1
  73. package/out/zero-cache/src/services/change-streamer/sqlite-change-log-catchup.d.ts.map +1 -1
  74. package/out/zero-cache/src/services/change-streamer/sqlite-change-log-catchup.js +95 -12
  75. package/out/zero-cache/src/services/change-streamer/sqlite-change-log-catchup.js.map +1 -1
  76. package/out/zero-cache/src/services/change-streamer/sqlite-change-log-comparator.d.ts +83 -0
  77. package/out/zero-cache/src/services/change-streamer/sqlite-change-log-comparator.d.ts.map +1 -0
  78. package/out/zero-cache/src/services/change-streamer/sqlite-change-log-comparator.js +417 -0
  79. package/out/zero-cache/src/services/change-streamer/sqlite-change-log-comparator.js.map +1 -0
  80. package/out/zero-cache/src/services/change-streamer/sqlite-change-log-read-router.d.ts +73 -0
  81. package/out/zero-cache/src/services/change-streamer/sqlite-change-log-read-router.d.ts.map +1 -0
  82. package/out/zero-cache/src/services/change-streamer/sqlite-change-log-read-router.js +157 -0
  83. package/out/zero-cache/src/services/change-streamer/sqlite-change-log-read-router.js.map +1 -0
  84. package/out/zero-cache/src/services/change-streamer/sqlite-change-log-reader.d.ts +1 -1
  85. package/out/zero-cache/src/services/change-streamer/sqlite-change-log-reader.d.ts.map +1 -1
  86. package/out/zero-cache/src/services/change-streamer/sqlite-change-log-reader.js +8 -3
  87. package/out/zero-cache/src/services/change-streamer/sqlite-change-log-reader.js.map +1 -1
  88. package/out/zero-cache/src/services/change-streamer/storer.d.ts +23 -0
  89. package/out/zero-cache/src/services/change-streamer/storer.d.ts.map +1 -1
  90. package/out/zero-cache/src/services/change-streamer/storer.js +40 -0
  91. package/out/zero-cache/src/services/change-streamer/storer.js.map +1 -1
  92. package/out/zero-cache/src/services/change-streamer/vfs-watermark-poller.d.ts +29 -0
  93. package/out/zero-cache/src/services/change-streamer/vfs-watermark-poller.d.ts.map +1 -0
  94. package/out/zero-cache/src/services/change-streamer/vfs-watermark-poller.js +154 -0
  95. package/out/zero-cache/src/services/change-streamer/vfs-watermark-poller.js.map +1 -0
  96. package/out/zero-cache/src/services/http-service.d.ts +1 -0
  97. package/out/zero-cache/src/services/http-service.d.ts.map +1 -1
  98. package/out/zero-cache/src/services/http-service.js +7 -3
  99. package/out/zero-cache/src/services/http-service.js.map +1 -1
  100. package/out/zero-cache/src/services/litestream/metrics.d.ts +1 -0
  101. package/out/zero-cache/src/services/litestream/metrics.d.ts.map +1 -1
  102. package/out/zero-cache/src/services/litestream/metrics.js +4 -1
  103. package/out/zero-cache/src/services/litestream/metrics.js.map +1 -1
  104. package/out/zero-cache/src/services/mutagen/mutagen.d.ts.map +1 -1
  105. package/out/zero-cache/src/services/mutagen/mutagen.js +1 -1
  106. package/out/zero-cache/src/services/mutagen/mutagen.js.map +1 -1
  107. package/out/zero-cache/src/services/replicator/change-log-db.d.ts +10 -0
  108. package/out/zero-cache/src/services/replicator/change-log-db.d.ts.map +1 -1
  109. package/out/zero-cache/src/services/replicator/change-log-db.js +15 -1
  110. package/out/zero-cache/src/services/replicator/change-log-db.js.map +1 -1
  111. package/out/zero-cache/src/services/replicator/sqlite-change-log-observability.d.ts +3 -2
  112. package/out/zero-cache/src/services/replicator/sqlite-change-log-observability.d.ts.map +1 -1
  113. package/out/zero-cache/src/services/replicator/sqlite-change-log-observability.js +8 -6
  114. package/out/zero-cache/src/services/replicator/sqlite-change-log-observability.js.map +1 -1
  115. package/out/zero-cache/src/services/view-syncer/client-handler.d.ts +3 -2
  116. package/out/zero-cache/src/services/view-syncer/client-handler.d.ts.map +1 -1
  117. package/out/zero-cache/src/services/view-syncer/client-handler.js +25 -17
  118. package/out/zero-cache/src/services/view-syncer/client-handler.js.map +1 -1
  119. package/out/zero-cache/src/services/view-syncer/cvr-store.d.ts.map +1 -1
  120. package/out/zero-cache/src/services/view-syncer/cvr-store.js +14 -1
  121. package/out/zero-cache/src/services/view-syncer/cvr-store.js.map +1 -1
  122. package/out/zero-cache/src/services/view-syncer/view-syncer.d.ts +3 -3
  123. package/out/zero-cache/src/services/view-syncer/view-syncer.d.ts.map +1 -1
  124. package/out/zero-cache/src/services/view-syncer/view-syncer.js +6 -2
  125. package/out/zero-cache/src/services/view-syncer/view-syncer.js.map +1 -1
  126. package/out/zero-cache/src/types/downstream.d.ts +11 -0
  127. package/out/zero-cache/src/types/downstream.d.ts.map +1 -0
  128. package/out/zero-cache/src/types/pg.d.ts.map +1 -1
  129. package/out/zero-cache/src/types/pg.js +14 -4
  130. package/out/zero-cache/src/types/pg.js.map +1 -1
  131. package/out/zero-cache/src/types/poke-chunk.d.ts +18 -0
  132. package/out/zero-cache/src/types/poke-chunk.d.ts.map +1 -0
  133. package/out/zero-cache/src/types/poke-chunk.js +57 -0
  134. package/out/zero-cache/src/types/poke-chunk.js.map +1 -0
  135. package/out/zero-cache/src/types/processes.js +1 -4
  136. package/out/zero-cache/src/types/processes.js.map +1 -1
  137. package/out/zero-cache/src/workers/connection.d.ts +22 -4
  138. package/out/zero-cache/src/workers/connection.d.ts.map +1 -1
  139. package/out/zero-cache/src/workers/connection.js +112 -14
  140. package/out/zero-cache/src/workers/connection.js.map +1 -1
  141. package/out/zero-client/src/client/version.js +1 -1
  142. package/out/zero-client/src/client/zero-poke-handler.d.ts +7 -2
  143. package/out/zero-client/src/client/zero-poke-handler.d.ts.map +1 -1
  144. package/out/zero-client/src/client/zero-poke-handler.js +52 -2
  145. package/out/zero-client/src/client/zero-poke-handler.js.map +1 -1
  146. package/out/zero-client/src/client/zero.d.ts.map +1 -1
  147. package/out/zero-client/src/client/zero.js +38 -6
  148. package/out/zero-client/src/client/zero.js.map +1 -1
  149. package/out/zero-protocol/src/down.d.ts +1 -1
  150. package/out/zero-protocol/src/poke.d.ts +89 -7
  151. package/out/zero-protocol/src/poke.d.ts.map +1 -1
  152. package/out/zero-protocol/src/poke.js +16 -8
  153. package/out/zero-protocol/src/poke.js.map +1 -1
  154. package/out/zero-protocol/src/protocol-version.d.ts +12 -7
  155. package/out/zero-protocol/src/protocol-version.d.ts.map +1 -1
  156. package/out/zero-protocol/src/protocol-version.js.map +1 -1
  157. package/out/zql/src/ivm/memory-source.d.ts +10 -2
  158. package/out/zql/src/ivm/memory-source.d.ts.map +1 -1
  159. package/out/zql/src/ivm/memory-source.js +14 -6
  160. package/out/zql/src/ivm/memory-source.js.map +1 -1
  161. package/out/zql/src/ivm/stream.d.ts +0 -1
  162. package/out/zql/src/ivm/stream.d.ts.map +1 -1
  163. package/out/zql/src/ivm/stream.js +1 -7
  164. package/out/zql/src/ivm/stream.js.map +1 -1
  165. package/out/zql/src/ivm/union-fan-in.d.ts +1 -1
  166. package/out/zql/src/ivm/union-fan-in.d.ts.map +1 -1
  167. package/out/zql/src/ivm/union-fan-in.js +11 -2
  168. package/out/zql/src/ivm/union-fan-in.js.map +1 -1
  169. package/out/zqlite/src/db.js +2 -2
  170. package/out/zqlite/src/sqlite-cost-model.js +5 -5
  171. package/out/zqlite/src/table-source.d.ts.map +1 -1
  172. package/out/zqlite/src/table-source.js +4 -4
  173. package/out/zqlite/src/table-source.js.map +1 -1
  174. package/package.json +1 -1
  175. package/out/zero-cache/src/server/backup-watermark-poller.js +0 -31
  176. package/out/zero-cache/src/server/backup-watermark-poller.js.map +0 -1
  177. package/out/zero-cache/src/services/litestream/vfs-watermark-poller.d.ts +0 -57
  178. package/out/zero-cache/src/services/litestream/vfs-watermark-poller.d.ts.map +0 -1
  179. package/out/zero-cache/src/services/litestream/vfs-watermark-poller.js +0 -137
  180. package/out/zero-cache/src/services/litestream/vfs-watermark-poller.js.map +0 -1
@@ -11,7 +11,6 @@ export declare const downstreamSchema: v.UnionType<[v.TupleType<[v.Type<"connect
11
11
  }>;
12
12
  timestamp: v.Optional<number>;
13
13
  }, undefined>]>, v.TupleType<[v.Type<"pokePart">, v.ObjectType<{
14
- pokeID: v.Type<string>;
15
14
  lastMutationIDChanges: v.Optional<Record<string, number>>;
16
15
  desiredQueriesPatches: v.Optional<Record<string, ({
17
16
  ttl?: number | undefined;
@@ -75,6 +74,7 @@ export declare const downstreamSchema: v.UnionType<[v.TupleType<[v.Type<"connect
75
74
  clientID: string;
76
75
  };
77
76
  })[]>;
77
+ pokeID: v.Type<string>;
78
78
  }, undefined>]>, v.TupleType<[v.Type<"pokeEnd">, v.ObjectType<{
79
79
  pokeID: v.Type<string>;
80
80
  cookie: v.Type<string>;
@@ -11,12 +11,14 @@ import * as v from '../../shared/src/valita.ts';
11
11
  * A poke begins with a `poke-start` message which contains the `baseCookie`
12
12
  * the poke is updating from and the `cookie` the poke is updating to.
13
13
  *
14
- * The poke continues with zero to many `poke-part` messages, each of which
15
- * can contain patch parts. These patch parts should be merged in the order
16
- * received.
14
+ * Through protocol version 51, the poke continues with zero to many
15
+ * `poke-part` JSON messages. Starting in version 52, it continues with zero to
16
+ * many binary `pokeChunk` messages. Each binary message starts with a message
17
+ * type byte. Concatenating and decoding the payload after that byte produces a
18
+ * PokePartBody array. pokeChunk boundaries have no semantic meaning.
17
19
  *
18
- * Finally, the poke ends with a `poke-end` message. The merged `poke-parts`
19
- * can now be applied as a whole to update from `baseCookie` to `cookie`.
20
+ * Finally, the poke ends with a `poke-end` message. The decoded patches can
21
+ * now be applied as a whole to update from `baseCookie` to `cookie`.
20
22
  *
21
23
  * Poke messages can be intermingled with other `down` messages, but cannot be
22
24
  * intermingled with poke messages for a different `pokeID`. If this is
@@ -37,7 +39,6 @@ export declare const pokeStartBodySchema: v.ObjectType<{
37
39
  timestamp: v.Optional<number>;
38
40
  }, undefined>;
39
41
  export declare const pokePartBodySchema: v.ObjectType<{
40
- pokeID: v.Type<string>;
41
42
  lastMutationIDChanges: v.Optional<Record<string, number>>;
42
43
  desiredQueriesPatches: v.Optional<Record<string, ({
43
44
  ttl?: number | undefined;
@@ -101,7 +102,79 @@ export declare const pokePartBodySchema: v.ObjectType<{
101
102
  clientID: string;
102
103
  };
103
104
  })[]>;
105
+ pokeID: v.Type<string>;
104
106
  }, undefined>;
107
+ /**
108
+ * The logical payload carried by binary poke chunks. Chunk boundaries are
109
+ * arbitrary; concatenating and decoding all chunks for a poke produces this
110
+ * array.
111
+ */
112
+ export declare const pokePartsSchema: v.ArrayType<v.ObjectType<{
113
+ lastMutationIDChanges: v.Optional<Record<string, number>>;
114
+ desiredQueriesPatches: v.Optional<Record<string, ({
115
+ ttl?: number | undefined;
116
+ op: "put";
117
+ hash: string;
118
+ } | {
119
+ op: "del";
120
+ hash: string;
121
+ } | {
122
+ op: "clear";
123
+ })[]>>;
124
+ gotQueriesPatch: v.Optional<({
125
+ ttl?: number | undefined;
126
+ op: "put";
127
+ hash: string;
128
+ } | {
129
+ op: "del";
130
+ hash: string;
131
+ } | {
132
+ op: "clear";
133
+ })[]>;
134
+ rowsPatch: v.Optional<({
135
+ op: "put";
136
+ tableName: string;
137
+ value: Readonly<Record<string, import("../../shared/src/json.ts").ReadonlyJSONValue | undefined>>;
138
+ } | {
139
+ merge?: import("../../shared/src/json.ts").ReadonlyJSONObject | undefined;
140
+ constrain?: string[] | undefined;
141
+ op: "update";
142
+ tableName: string;
143
+ id: Readonly<Record<string, string | number | boolean>>;
144
+ } | {
145
+ op: "del";
146
+ tableName: string;
147
+ id: Readonly<Record<string, string | number | boolean>>;
148
+ } | {
149
+ op: "clear";
150
+ })[]>;
151
+ mutationsPatch: v.Optional<({
152
+ op: "put";
153
+ mutation: {
154
+ id: {
155
+ id: number;
156
+ clientID: string;
157
+ };
158
+ result: {
159
+ message?: string | undefined;
160
+ details?: import("../../shared/src/json.ts").ReadonlyJSONValue | undefined;
161
+ error: "app";
162
+ } | {
163
+ details?: import("../../shared/src/json.ts").ReadonlyJSONValue | undefined;
164
+ error: "oooMutation" | "alreadyProcessed";
165
+ } | {
166
+ data?: import("../../shared/src/json.ts").ReadonlyJSONValue | undefined;
167
+ };
168
+ };
169
+ } | {
170
+ op: "del";
171
+ id: {
172
+ id: number;
173
+ clientID: string;
174
+ };
175
+ })[]>;
176
+ pokeID: v.Type<string>;
177
+ }, undefined>>;
105
178
  export declare const pokeEndBodySchema: v.ObjectType<{
106
179
  pokeID: v.Type<string>;
107
180
  cookie: v.Type<string>;
@@ -121,7 +194,6 @@ export declare const pokeStartMessageSchema: v.TupleType<[v.Type<"pokeStart">, v
121
194
  timestamp: v.Optional<number>;
122
195
  }, undefined>]>;
123
196
  export declare const pokePartMessageSchema: v.TupleType<[v.Type<"pokePart">, v.ObjectType<{
124
- pokeID: v.Type<string>;
125
197
  lastMutationIDChanges: v.Optional<Record<string, number>>;
126
198
  desiredQueriesPatches: v.Optional<Record<string, ({
127
199
  ttl?: number | undefined;
@@ -185,6 +257,7 @@ export declare const pokePartMessageSchema: v.TupleType<[v.Type<"pokePart">, v.O
185
257
  clientID: string;
186
258
  };
187
259
  })[]>;
260
+ pokeID: v.Type<string>;
188
261
  }, undefined>]>;
189
262
  export declare const pokeEndMessageSchema: v.TupleType<[v.Type<"pokeEnd">, v.ObjectType<{
190
263
  pokeID: v.Type<string>;
@@ -193,7 +266,16 @@ export declare const pokeEndMessageSchema: v.TupleType<[v.Type<"pokeEnd">, v.Obj
193
266
  }, undefined>]>;
194
267
  export type PokeStartBody = v.Infer<typeof pokeStartBodySchema>;
195
268
  export type PokePartBody = v.Infer<typeof pokePartBodySchema>;
269
+ export type PokeParts = v.Infer<typeof pokePartsSchema>;
196
270
  export type PokeEndBody = v.Infer<typeof pokeEndBodySchema>;
271
+ /** The first byte identifying a binary WebSocket message as a poke chunk. */
272
+ export declare const POKE_CHUNK_MESSAGE_TYPE = 0;
273
+ /** The first protocol version that receives binary poke chunks. */
274
+ export declare const POKE_CHUNK_PROTOCOL_VERSION = 52;
275
+ /** The last protocol version that receives JSON pokePart messages. */
276
+ export declare const LAST_POKE_PART_PROTOCOL_VERSION = 51;
277
+ /** A tagged binary poke chunk WebSocket message. */
278
+ export type PokeChunk = Uint8Array;
197
279
  export type PokeStartMessage = v.Infer<typeof pokeStartMessageSchema>;
198
280
  export type PokePartMessage = v.Infer<typeof pokePartMessageSchema>;
199
281
  export type PokeEndMessage = v.Infer<typeof pokeEndMessageSchema>;
@@ -1 +1 @@
1
- {"version":3,"file":"poke.d.ts","sourceRoot":"","sources":["../../../../zero-protocol/src/poke.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,4BAA4B,CAAC;AAMhD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,eAAO,MAAM,mBAAmB;;;IAM9B;;;OAGG;;;;;;aAQH,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAa7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,CAAC;AAE3D,eAAO,MAAM,iBAAiB;;;;aAO5B,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;IA5CjC;;;OAGG;;;;;;eA4CH,CAAC;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAGhC,CAAC;AACH,eAAO,MAAM,oBAAoB;;;;eAG/B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAChE,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC9D,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AACxD,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,6EAA6E;AAC7E,eAAO,MAAM,uBAAuB,IAAO,CAAC;AAE5C,mEAAmE;AACnE,eAAO,MAAM,2BAA2B,KAAK,CAAC;AAE9C,sEAAsE;AACtE,eAAO,MAAM,+BAA+B,KAAK,CAAC;AAElD,oDAAoD;AACpD,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC;AAEnC,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACtE,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACpE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -16,12 +16,14 @@ import { nullableVersionSchema, versionSchema } from "./version.js";
16
16
  * A poke begins with a `poke-start` message which contains the `baseCookie`
17
17
  * the poke is updating from and the `cookie` the poke is updating to.
18
18
  *
19
- * The poke continues with zero to many `poke-part` messages, each of which
20
- * can contain patch parts. These patch parts should be merged in the order
21
- * received.
19
+ * Through protocol version 51, the poke continues with zero to many
20
+ * `poke-part` JSON messages. Starting in version 52, it continues with zero to
21
+ * many binary `pokeChunk` messages. Each binary message starts with a message
22
+ * type byte. Concatenating and decoding the payload after that byte produces a
23
+ * PokePartBody array. pokeChunk boundaries have no semantic meaning.
22
24
  *
23
- * Finally, the poke ends with a `poke-end` message. The merged `poke-parts`
24
- * can now be applied as a whole to update from `baseCookie` to `cookie`.
25
+ * Finally, the poke ends with a `poke-end` message. The decoded patches can
26
+ * now be applied as a whole to update from `baseCookie` to `cookie`.
25
27
  *
26
28
  * Poke messages can be intermingled with other `down` messages, but cannot be
27
29
  * intermingled with poke messages for a different `pokeID`. If this is
@@ -42,13 +44,19 @@ var pokeStartBodySchema = valita_exports.object({
42
44
  timestamp: valita_exports.number().optional()
43
45
  });
44
46
  var pokePartBodySchema = valita_exports.object({
45
- pokeID: valita_exports.string(),
46
47
  lastMutationIDChanges: valita_exports.record(valita_exports.number()).optional(),
47
48
  desiredQueriesPatches: valita_exports.record(queriesPatchSchema).optional(),
48
49
  gotQueriesPatch: queriesPatchSchema.optional(),
49
50
  rowsPatch: rowsPatchSchema.optional(),
50
- mutationsPatch: mutationsPatchSchema.optional()
51
+ mutationsPatch: mutationsPatchSchema.optional(),
52
+ pokeID: valita_exports.string()
51
53
  });
54
+ /**
55
+ * The logical payload carried by binary poke chunks. Chunk boundaries are
56
+ * arbitrary; concatenating and decoding all chunks for a poke produces this
57
+ * array.
58
+ */
59
+ var pokePartsSchema = valita_exports.array(pokePartBodySchema);
52
60
  var pokeEndBodySchema = valita_exports.object({
53
61
  pokeID: valita_exports.string(),
54
62
  cookie: versionSchema,
@@ -58,6 +66,6 @@ var pokeStartMessageSchema = valita_exports.tuple([valita_exports.literal("pokeS
58
66
  var pokePartMessageSchema = valita_exports.tuple([valita_exports.literal("pokePart"), pokePartBodySchema]);
59
67
  var pokeEndMessageSchema = valita_exports.tuple([valita_exports.literal("pokeEnd"), pokeEndBodySchema]);
60
68
  //#endregion
61
- export { pokeEndMessageSchema, pokePartMessageSchema, pokeStartMessageSchema };
69
+ export { pokeEndMessageSchema, pokePartMessageSchema, pokePartsSchema, pokeStartMessageSchema };
62
70
 
63
71
  //# sourceMappingURL=poke.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"poke.js","names":[],"sources":["../../../../zero-protocol/src/poke.ts"],"sourcesContent":["import * as v from '../../shared/src/valita.ts';\nimport {mutationsPatchSchema} from './mutations-patch.ts';\nimport {queriesPatchSchema} from './queries-patch.ts';\nimport {rowsPatchSchema} from './row-patch.ts';\nimport {nullableVersionSchema, versionSchema} from './version.ts';\n\n/**\n * Pokes use a multi-part format. Pokes send entity data to the client and can\n * be multiple mega-bytes in size. Using a multi-part format allows the server\n * to avoid having to have the full poke in memory at one time.\n *\n * Each poke is assigned a `pokeID`, a unique id (within the context of the\n * connection) for identifying the poke. All messages for a poke will have the\n * same `pokeID`.\n *\n * A poke begins with a `poke-start` message which contains the `baseCookie`\n * the poke is updating from and the `cookie` the poke is updating to.\n *\n * The poke continues with zero to many `poke-part` messages, each of which\n * can contain patch parts. These patch parts should be merged in the order\n * received.\n *\n * Finally, the poke ends with a `poke-end` message. The merged `poke-parts`\n * can now be applied as a whole to update from `baseCookie` to `cookie`.\n *\n * Poke messages can be intermingled with other `down` messages, but cannot be\n * intermingled with poke messages for a different `pokeID`. If this is\n * observed it is an unexpected error; the client should ignore both pokes,\n * disconnect, and reconnect.\n */\n\nexport const pokeStartBodySchema = v.object({\n pokeID: v.string(),\n // We always specify a Version as our cookie, but Replicache starts clients\n // with initial cookie `null`, before the first request. So we have to be\n // able to send a base cookie with value `null` to match that state.\n baseCookie: nullableVersionSchema,\n /**\n * This field is always set if the poke contains a `rowsPatch`.\n * It may be absent for patches that only update clients and queries.\n */\n schemaVersions: v\n .object({\n minSupportedVersion: v.number(),\n maxSupportedVersion: v.number(),\n })\n .optional(),\n timestamp: v.number().optional(),\n});\n\nexport const pokePartBodySchema = v.object({\n pokeID: v.string(),\n // Changes to last mutation id by client id.\n lastMutationIDChanges: v.record(v.number()).optional(),\n // Patches to the desired query sets by client id.\n desiredQueriesPatches: v.record(queriesPatchSchema).optional(),\n // Patches to the set of queries for which entities are sync'd in\n // rowsPatch.\n gotQueriesPatch: queriesPatchSchema.optional(),\n // Patches to the rows set.\n rowsPatch: rowsPatchSchema.optional(),\n // Mutation results patch\n mutationsPatch: mutationsPatchSchema.optional(),\n});\n\nexport const pokeEndBodySchema = v.object({\n pokeID: v.string(),\n // Note: This should be ignored (and may be empty) if cancel === `true`.\n cookie: versionSchema,\n // If `true`, the poke with id `pokeID` should be discarded without\n // applying it.\n cancel: v.boolean().optional(),\n});\n\nexport const pokeStartMessageSchema = v.tuple([\n v.literal('pokeStart'),\n pokeStartBodySchema,\n]);\nexport const pokePartMessageSchema = v.tuple([\n v.literal('pokePart'),\n pokePartBodySchema,\n]);\nexport const pokeEndMessageSchema = v.tuple([\n v.literal('pokeEnd'),\n pokeEndBodySchema,\n]);\n\nexport type PokeStartBody = v.Infer<typeof pokeStartBodySchema>;\nexport type PokePartBody = v.Infer<typeof pokePartBodySchema>;\nexport type PokeEndBody = v.Infer<typeof pokeEndBodySchema>;\n\nexport type PokeStartMessage = v.Infer<typeof pokeStartMessageSchema>;\nexport type PokePartMessage = v.Infer<typeof pokePartMessageSchema>;\nexport type PokeEndMessage = v.Infer<typeof pokeEndMessageSchema>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,IAAa,sBAAsB,eAAE,OAAO;CAC1C,QAAQ,eAAE,OAAO;CAIjB,YAAY;;;;;CAKZ,gBAAgB,eACb,OAAO;EACN,qBAAqB,eAAE,OAAO;EAC9B,qBAAqB,eAAE,OAAO;CAChC,CAAC,EACA,SAAS;CACZ,WAAW,eAAE,OAAO,EAAE,SAAS;AACjC,CAAC;AAED,IAAa,qBAAqB,eAAE,OAAO;CACzC,QAAQ,eAAE,OAAO;CAEjB,uBAAuB,eAAE,OAAO,eAAE,OAAO,CAAC,EAAE,SAAS;CAErD,uBAAuB,eAAE,OAAO,kBAAkB,EAAE,SAAS;CAG7D,iBAAiB,mBAAmB,SAAS;CAE7C,WAAW,gBAAgB,SAAS;CAEpC,gBAAgB,qBAAqB,SAAS;AAChD,CAAC;AAED,IAAa,oBAAoB,eAAE,OAAO;CACxC,QAAQ,eAAE,OAAO;CAEjB,QAAQ;CAGR,QAAQ,eAAE,QAAQ,EAAE,SAAS;AAC/B,CAAC;AAED,IAAa,yBAAyB,eAAE,MAAM,CAC5C,eAAE,QAAQ,WAAW,GACrB,mBACF,CAAC;AACD,IAAa,wBAAwB,eAAE,MAAM,CAC3C,eAAE,QAAQ,UAAU,GACpB,kBACF,CAAC;AACD,IAAa,uBAAuB,eAAE,MAAM,CAC1C,eAAE,QAAQ,SAAS,GACnB,iBACF,CAAC"}
1
+ {"version":3,"file":"poke.js","names":[],"sources":["../../../../zero-protocol/src/poke.ts"],"sourcesContent":["import * as v from '../../shared/src/valita.ts';\nimport {mutationsPatchSchema} from './mutations-patch.ts';\nimport {queriesPatchSchema} from './queries-patch.ts';\nimport {rowsPatchSchema} from './row-patch.ts';\nimport {nullableVersionSchema, versionSchema} from './version.ts';\n\n/**\n * Pokes use a multi-part format. Pokes send entity data to the client and can\n * be multiple mega-bytes in size. Using a multi-part format allows the server\n * to avoid having to have the full poke in memory at one time.\n *\n * Each poke is assigned a `pokeID`, a unique id (within the context of the\n * connection) for identifying the poke. All messages for a poke will have the\n * same `pokeID`.\n *\n * A poke begins with a `poke-start` message which contains the `baseCookie`\n * the poke is updating from and the `cookie` the poke is updating to.\n *\n * Through protocol version 51, the poke continues with zero to many\n * `poke-part` JSON messages. Starting in version 52, it continues with zero to\n * many binary `pokeChunk` messages. Each binary message starts with a message\n * type byte. Concatenating and decoding the payload after that byte produces a\n * PokePartBody array. pokeChunk boundaries have no semantic meaning.\n *\n * Finally, the poke ends with a `poke-end` message. The decoded patches can\n * now be applied as a whole to update from `baseCookie` to `cookie`.\n *\n * Poke messages can be intermingled with other `down` messages, but cannot be\n * intermingled with poke messages for a different `pokeID`. If this is\n * observed it is an unexpected error; the client should ignore both pokes,\n * disconnect, and reconnect.\n */\n\nexport const pokeStartBodySchema = v.object({\n pokeID: v.string(),\n // We always specify a Version as our cookie, but Replicache starts clients\n // with initial cookie `null`, before the first request. So we have to be\n // able to send a base cookie with value `null` to match that state.\n baseCookie: nullableVersionSchema,\n /**\n * This field is always set if the poke contains a `rowsPatch`.\n * It may be absent for patches that only update clients and queries.\n */\n schemaVersions: v\n .object({\n minSupportedVersion: v.number(),\n maxSupportedVersion: v.number(),\n })\n .optional(),\n timestamp: v.number().optional(),\n});\n\nexport const pokePartBodySchema = v.object({\n // Changes to last mutation id by client id.\n lastMutationIDChanges: v.record(v.number()).optional(),\n // Patches to the desired query sets by client id.\n desiredQueriesPatches: v.record(queriesPatchSchema).optional(),\n // Patches to the set of queries for which entities are sync'd in\n // rowsPatch.\n gotQueriesPatch: queriesPatchSchema.optional(),\n // Patches to the rows set.\n rowsPatch: rowsPatchSchema.optional(),\n // Mutation results patch\n mutationsPatch: mutationsPatchSchema.optional(),\n pokeID: v.string(),\n});\n\n/**\n * The logical payload carried by binary poke chunks. Chunk boundaries are\n * arbitrary; concatenating and decoding all chunks for a poke produces this\n * array.\n */\nexport const pokePartsSchema = v.array(pokePartBodySchema);\n\nexport const pokeEndBodySchema = v.object({\n pokeID: v.string(),\n // Note: This should be ignored (and may be empty) if cancel === `true`.\n cookie: versionSchema,\n // If `true`, the poke with id `pokeID` should be discarded without\n // applying it.\n cancel: v.boolean().optional(),\n});\n\nexport const pokeStartMessageSchema = v.tuple([\n v.literal('pokeStart'),\n pokeStartBodySchema,\n]);\nexport const pokePartMessageSchema = v.tuple([\n v.literal('pokePart'),\n pokePartBodySchema,\n]);\nexport const pokeEndMessageSchema = v.tuple([\n v.literal('pokeEnd'),\n pokeEndBodySchema,\n]);\n\nexport type PokeStartBody = v.Infer<typeof pokeStartBodySchema>;\nexport type PokePartBody = v.Infer<typeof pokePartBodySchema>;\nexport type PokeParts = v.Infer<typeof pokePartsSchema>;\nexport type PokeEndBody = v.Infer<typeof pokeEndBodySchema>;\n\n/** The first byte identifying a binary WebSocket message as a poke chunk. */\nexport const POKE_CHUNK_MESSAGE_TYPE = 0x00;\n\n/** The first protocol version that receives binary poke chunks. */\nexport const POKE_CHUNK_PROTOCOL_VERSION = 52;\n\n/** The last protocol version that receives JSON pokePart messages. */\nexport const LAST_POKE_PART_PROTOCOL_VERSION = 51;\n\n/** A tagged binary poke chunk WebSocket message. */\nexport type PokeChunk = Uint8Array;\n\nexport type PokeStartMessage = v.Infer<typeof pokeStartMessageSchema>;\nexport type PokePartMessage = v.Infer<typeof pokePartMessageSchema>;\nexport type PokeEndMessage = v.Infer<typeof pokeEndMessageSchema>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,IAAa,sBAAsB,eAAE,OAAO;CAC1C,QAAQ,eAAE,OAAO;CAIjB,YAAY;;;;;CAKZ,gBAAgB,eACb,OAAO;EACN,qBAAqB,eAAE,OAAO;EAC9B,qBAAqB,eAAE,OAAO;CAChC,CAAC,EACA,SAAS;CACZ,WAAW,eAAE,OAAO,EAAE,SAAS;AACjC,CAAC;AAED,IAAa,qBAAqB,eAAE,OAAO;CAEzC,uBAAuB,eAAE,OAAO,eAAE,OAAO,CAAC,EAAE,SAAS;CAErD,uBAAuB,eAAE,OAAO,kBAAkB,EAAE,SAAS;CAG7D,iBAAiB,mBAAmB,SAAS;CAE7C,WAAW,gBAAgB,SAAS;CAEpC,gBAAgB,qBAAqB,SAAS;CAC9C,QAAQ,eAAE,OAAO;AACnB,CAAC;;;;;;AAOD,IAAa,kBAAkB,eAAE,MAAM,kBAAkB;AAEzD,IAAa,oBAAoB,eAAE,OAAO;CACxC,QAAQ,eAAE,OAAO;CAEjB,QAAQ;CAGR,QAAQ,eAAE,QAAQ,EAAE,SAAS;AAC/B,CAAC;AAED,IAAa,yBAAyB,eAAE,MAAM,CAC5C,eAAE,QAAQ,WAAW,GACrB,mBACF,CAAC;AACD,IAAa,wBAAwB,eAAE,MAAM,CAC3C,eAAE,QAAQ,UAAU,GACpB,kBACF,CAAC;AACD,IAAa,uBAAuB,eAAE,MAAM,CAC1C,eAAE,QAAQ,SAAS,GACnB,iBACF,CAAC"}
@@ -10,15 +10,20 @@
10
10
  * release. The server (`zero-cache`) must be deployed before clients start
11
11
  * running the new code.
12
12
  */
13
- export declare const PROTOCOL_VERSION = 51;
13
+ export declare const PROTOCOL_VERSION = 52;
14
14
  /**
15
15
  * The minimum server-supported sync protocol version (i.e. the version
16
- * declared in the "/sync/v{#}/connect" URL). The contract for
17
- * backwards compatibility is that a `zero-cache` supports the current
18
- * `PROTOCOL_VERSION` and at least the previous one (i.e. `PROTOCOL_VERSION - 1`)
19
- * if not earlier ones as well. This corresponds to supporting clients running
20
- * the current release and the previous (major) release. Any client connections
21
- * from protocol versions before `MIN_SERVER_SUPPORTED_PROTOCOL_VERSION` are
16
+ * declared in the "/sync/v{#}/connect" URL).
17
+ *
18
+ * CloudZero can serve applications running old client releases indefinitely.
19
+ * Consequently, this value must never be increased: `zero-cache` must continue
20
+ * to support every sync protocol from this version through `PROTOCOL_VERSION`.
21
+ * A wire change that an old client cannot ignore must branch on the client's
22
+ * protocol version and retain the old behavior. Keep each compatibility fork
23
+ * isolated at the boundary that owns the changed behavior and test both sides
24
+ * of its version cutoff.
25
+ *
26
+ * Client connections from protocol versions before this historical floor are
22
27
  * closed with a `VersionNotSupported` error.
23
28
  */
24
29
  export declare const MIN_SERVER_SUPPORTED_SYNC_PROTOCOL = 30;
@@ -1 +1 @@
1
- {"version":3,"file":"protocol-version.d.ts","sourceRoot":"","sources":["../../../../zero-protocol/src/protocol-version.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AA8CH,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAEnC;;;;;;;;;GASG;AACH,eAAO,MAAM,kCAAkC,KAAK,CAAC"}
1
+ {"version":3,"file":"protocol-version.d.ts","sourceRoot":"","sources":["../../../../zero-protocol/src/protocol-version.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AAgDH,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAEnC;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,kCAAkC,KAAK,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"protocol-version.js","names":[],"sources":["../../../../zero-protocol/src/protocol-version.ts"],"sourcesContent":["import {assert} from '../../shared/src/asserts.ts';\n\n/**\n * The current `PROTOCOL_VERSION` of the code.\n *\n * The `PROTOCOL_VERSION` encompasses both the wire-protocol of the `/sync/...`\n * connection between the browser and `zero-cache`, as well as the format of\n * the `AST` objects stored in both components (i.e. IDB and CVR).\n *\n * A change in the `AST` schema (e.g. new functionality added) must be\n * accompanied by an increment of the `PROTOCOL_VERSION` and a new major\n * release. The server (`zero-cache`) must be deployed before clients start\n * running the new code.\n */\n// History:\n// -- Version 5 adds support for `pokeEnd.cookie`. (0.14)\n// -- Version 6 makes `pokeStart.cookie` optional. (0.16)\n// -- Version 7 introduces the initConnection.clientSchema field. (0.17)\n// -- Version 8 drops support for Version 5 (0.18).\n// -- Version 11 adds inspect queries. (0.18)\n// -- Version 12 adds 'timestamp' and 'date' types to the ClientSchema ValueType. (not shipped, reversed by version 14)\n// -- Version 14 removes 'timestamp' and 'date' types from the ClientSchema ValueType. (0.18)\n// -- Version 15 adds a `userPushParams` field to `initConnection` (0.19)\n// -- Version 16 adds a new error type (alreadyProcessed) to mutation responses (0.19)\n// -- Version 17 deprecates `AST` in downstream query puts. It was never used anyway. (0.21)\n// -- Version 18 adds `name` and `args` to the `queries-patch` protocol (0.21)\n// -- Version 19 adds `activeClients` to the `initConnection` protocol (0.22)\n// -- Version 20 changes inspector down message (0.22)\n// -- Version 21 removes `AST` in downstream query puts which was deprecated in Version 17, removes support for versions < 18 (0.22)\n// -- Version 22 adds an optional 'userQueryParams' field to `initConnection` (0.22)\n// -- Version 23 add `mutationResults` to poke (0.22)\n// -- Version 24 adds `ackMutationResults` to upstream (0.22).\n// -- version 25 modifies `mutationsResults` to include `del` patches (0.22)\n// -- version 26 adds inspect/metrics and adds metrics to inspect/query (0.23)\n// -- version 27 adds inspect/version (0.23)\n// -- version 28 adds more inspect/metrics (0.23)\n// -- version 29 adds error responses for custom queries (0.23)\n// -- version 30 adds an optional primaryKey to the ClientSchema (0.24)\n// -- version 31 adds admin password authentication to inspector RPC calls (0.24)\n// -- version 32 adds analyze-query to the inspector RPC calls (0.24)\n// -- version 33 adds `flip` to CorrelatedSubquery (0.25)\n// -- version 34 moves `flip` from CorrelatedSubquery to CorrelatedSubqueryCondition (0.25)\n// -- version 35 adds `readRows`, `readRowCountsByQuery` and `readRowCount` to analyze-query result (0.25)\n// -- version 36 changes inspector analyze-query and adds error response to RPC (0.25)\n// -- version 37 adds `elapsed` to AnalyzeQueryResult (0.25)\n// -- version 38 adds structured push/transform error responses (0.25)\n// -- version 39 removes per-transform error types and adds `message` to app error (0.25)\n// -- version 40 adds `dbRowScansByQuery` to AnalyzeQueryResult (0.25)\n// -- version 41 makes ClientSchema.primaryKey required (0.25)\n// -- version 42 adds planner events to AnalyzeQueryResult (0.25)\n// -- version 43 renames `plans` to `sqlitePlans`, `plannerEvents` to `joinPlans`, and `plannerDebug` option to `joinPlans` (0.25)\n// -- version 44 adds profileID to connection URL (0.25)\n// -- version 45 adds userPushHeaders and userQueryHeaders to initConnection (0.25)\n// -- version 46 adds scalarSubquery condition type to AST\n// -- version 47 adds optional auth token to push body\n// -- version 48 adds updateAuth\n// -- version 49 adds `scalar` to CorrelatedSubqueryCondition, removes scalarSubquery\n// -- version 50 adds OTEL headers to push and query messages\n// -- version 51 changes inspector metrics fields\nexport const PROTOCOL_VERSION = 51;\n\n/**\n * The minimum server-supported sync protocol version (i.e. the version\n * declared in the \"/sync/v{#}/connect\" URL). The contract for\n * backwards compatibility is that a `zero-cache` supports the current\n * `PROTOCOL_VERSION` and at least the previous one (i.e. `PROTOCOL_VERSION - 1`)\n * if not earlier ones as well. This corresponds to supporting clients running\n * the current release and the previous (major) release. Any client connections\n * from protocol versions before `MIN_SERVER_SUPPORTED_PROTOCOL_VERSION` are\n * closed with a `VersionNotSupported` error.\n */\nexport const MIN_SERVER_SUPPORTED_SYNC_PROTOCOL = 30;\n\nassert(\n MIN_SERVER_SUPPORTED_SYNC_PROTOCOL < PROTOCOL_VERSION,\n 'MIN_SERVER_SUPPORTED_SYNC_PROTOCOL must be less than PROTOCOL_VERSION',\n);\n"],"mappings":";AAyEA,OAAA,MAEE,uEACF"}
1
+ {"version":3,"file":"protocol-version.js","names":[],"sources":["../../../../zero-protocol/src/protocol-version.ts"],"sourcesContent":["import {assert} from '../../shared/src/asserts.ts';\n\n/**\n * The current `PROTOCOL_VERSION` of the code.\n *\n * The `PROTOCOL_VERSION` encompasses both the wire-protocol of the `/sync/...`\n * connection between the browser and `zero-cache`, as well as the format of\n * the `AST` objects stored in both components (i.e. IDB and CVR).\n *\n * A change in the `AST` schema (e.g. new functionality added) must be\n * accompanied by an increment of the `PROTOCOL_VERSION` and a new major\n * release. The server (`zero-cache`) must be deployed before clients start\n * running the new code.\n */\n// History:\n// -- Version 5 adds support for `pokeEnd.cookie`. (0.14)\n// -- Version 6 makes `pokeStart.cookie` optional. (0.16)\n// -- Version 7 introduces the initConnection.clientSchema field. (0.17)\n// -- Version 8 drops support for Version 5 (0.18).\n// -- Version 11 adds inspect queries. (0.18)\n// -- Version 12 adds 'timestamp' and 'date' types to the ClientSchema ValueType. (not shipped, reversed by version 14)\n// -- Version 14 removes 'timestamp' and 'date' types from the ClientSchema ValueType. (0.18)\n// -- Version 15 adds a `userPushParams` field to `initConnection` (0.19)\n// -- Version 16 adds a new error type (alreadyProcessed) to mutation responses (0.19)\n// -- Version 17 deprecates `AST` in downstream query puts. It was never used anyway. (0.21)\n// -- Version 18 adds `name` and `args` to the `queries-patch` protocol (0.21)\n// -- Version 19 adds `activeClients` to the `initConnection` protocol (0.22)\n// -- Version 20 changes inspector down message (0.22)\n// -- Version 21 removes `AST` in downstream query puts which was deprecated in Version 17, removes support for versions < 18 (0.22)\n// -- Version 22 adds an optional 'userQueryParams' field to `initConnection` (0.22)\n// -- Version 23 add `mutationResults` to poke (0.22)\n// -- Version 24 adds `ackMutationResults` to upstream (0.22).\n// -- version 25 modifies `mutationsResults` to include `del` patches (0.22)\n// -- version 26 adds inspect/metrics and adds metrics to inspect/query (0.23)\n// -- version 27 adds inspect/version (0.23)\n// -- version 28 adds more inspect/metrics (0.23)\n// -- version 29 adds error responses for custom queries (0.23)\n// -- version 30 adds an optional primaryKey to the ClientSchema (0.24)\n// -- version 31 adds admin password authentication to inspector RPC calls (0.24)\n// -- version 32 adds analyze-query to the inspector RPC calls (0.24)\n// -- version 33 adds `flip` to CorrelatedSubquery (0.25)\n// -- version 34 moves `flip` from CorrelatedSubquery to CorrelatedSubqueryCondition (0.25)\n// -- version 35 adds `readRows`, `readRowCountsByQuery` and `readRowCount` to analyze-query result (0.25)\n// -- version 36 changes inspector analyze-query and adds error response to RPC (0.25)\n// -- version 37 adds `elapsed` to AnalyzeQueryResult (0.25)\n// -- version 38 adds structured push/transform error responses (0.25)\n// -- version 39 removes per-transform error types and adds `message` to app error (0.25)\n// -- version 40 adds `dbRowScansByQuery` to AnalyzeQueryResult (0.25)\n// -- version 41 makes ClientSchema.primaryKey required (0.25)\n// -- version 42 adds planner events to AnalyzeQueryResult (0.25)\n// -- version 43 renames `plans` to `sqlitePlans`, `plannerEvents` to `joinPlans`, and `plannerDebug` option to `joinPlans` (0.25)\n// -- version 44 adds profileID to connection URL (0.25)\n// -- version 45 adds userPushHeaders and userQueryHeaders to initConnection (0.25)\n// -- version 46 adds scalarSubquery condition type to AST\n// -- version 47 adds optional auth token to push body\n// -- version 48 adds updateAuth\n// -- version 49 adds `scalar` to CorrelatedSubqueryCondition, removes scalarSubquery\n// -- version 50 adds OTEL headers to push and query messages\n// -- version 51 changes inspector metrics fields\n// -- version 52 replaces JSON pokePart messages with binary poke chunks for\n// clients using protocol version 52 or newer. Older clients retain pokePart.\nexport const PROTOCOL_VERSION = 52;\n\n/**\n * The minimum server-supported sync protocol version (i.e. the version\n * declared in the \"/sync/v{#}/connect\" URL).\n *\n * CloudZero can serve applications running old client releases indefinitely.\n * Consequently, this value must never be increased: `zero-cache` must continue\n * to support every sync protocol from this version through `PROTOCOL_VERSION`.\n * A wire change that an old client cannot ignore must branch on the client's\n * protocol version and retain the old behavior. Keep each compatibility fork\n * isolated at the boundary that owns the changed behavior and test both sides\n * of its version cutoff.\n *\n * Client connections from protocol versions before this historical floor are\n * closed with a `VersionNotSupported` error.\n */\nexport const MIN_SERVER_SUPPORTED_SYNC_PROTOCOL = 30;\n\nassert(\n MIN_SERVER_SUPPORTED_SYNC_PROTOCOL < PROTOCOL_VERSION,\n 'MIN_SERVER_SUPPORTED_SYNC_PROTOCOL must be less than PROTOCOL_VERSION',\n);\n"],"mappings":";AAgFA,OAAA,MAEE,uEACF"}
@@ -65,9 +65,17 @@ export declare function generateWithStart(nodes: Iterable<Node | 'yield'>, start
65
65
  * @param constraint - constraint that was applied to the rowIterator and should
66
66
  * also be applied to the overlay.
67
67
  * @param overlay - the overlay values to splice in
68
- * @param compare - the comparator to use to find the position for the overlay
68
+ * @param compare - the comparator to use to find the position for the overlay.
69
+ * Must order rows the same way `rows` is ordered. For `MemorySource` that is
70
+ * *index* order, which leads with the constraint keys.
71
+ * @param startAtCompare - the comparator for `startAt`, which is a bound in the
72
+ * *connection's* sort order. Only the same as `compare` when the stream's order
73
+ * happens to be the connection's -- true for `TableSource` (SQL does the
74
+ * ordering) but not for a constrained `MemorySource` fetch. Conflating the two
75
+ * is what #4926 fixed for `generateWithStart`; this parameter is the same
76
+ * distinction for the overlay's own `startAt` pruning.
69
77
  */
70
- export declare function generateWithOverlay(startAt: Row | undefined, rows: Iterable<Row>, constraint: Constraint | undefined, overlay: Overlay | undefined, lastPushedEpoch: number, compare: Comparator, filterPredicate?: (row: Row) => boolean | undefined, multiConstraints?: readonly MultiConstraint[] | undefined): Generator<{
78
+ export declare function generateWithOverlay(startAt: Row | undefined, rows: Iterable<Row>, constraint: Constraint | undefined, overlay: Overlay | undefined, lastPushedEpoch: number, compare: Comparator, startAtCompare: Comparator, filterPredicate?: (row: Row) => boolean | undefined, multiConstraints?: readonly MultiConstraint[] | undefined): Generator<{
71
79
  row: Readonly<Record<string, import("../../../shared/src/json.ts").ReadonlyJSONValue | undefined>>;
72
80
  relationships: {};
73
81
  }, void, unknown>;
@@ -1 +1 @@
1
- {"version":3,"file":"memory-source.d.ts","sourceRoot":"","sources":["../../../../../zql/src/ivm/memory-source.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAC,MAAM,kCAAkC,CAAC;AAI1D,OAAO,KAAK,EACV,SAAS,EACT,QAAQ,EAET,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAC,GAAG,EAAQ,MAAM,oCAAoC,CAAC;AACnE,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,2CAA2C,CAAC;AAC1E,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAGL,KAAK,mBAAmB,EACzB,MAAM,sBAAsB,CAAC;AAK9B,OAAO,EAIL,KAAK,UAAU,EAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAIL,KAAK,UAAU,EACf,KAAK,IAAI,EACV,MAAM,WAAW,CAAC;AAEnB,OAAO,EAGL,KAAK,KAAK,EACV,KAAK,eAAe,EACpB,KAAK,MAAM,EACX,KAAK,KAAK,EACX,MAAM,eAAe,CAAC;AAGvB,OAAO,KAAK,EACV,MAAM,EACN,YAAY,EAIZ,WAAW,EACZ,MAAM,aAAa,CAAC;AAErB,OAAO,KAAK,EAAC,MAAM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,QAAQ,CAUV;AAeD,wBAAiB,wBAAwB,CACvC,WAAW,EAAE,QAAQ,CAAC,GAAG,CAAC,EAC1B,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,KAAK,MAAM;;;kBA0BtC;AAED;;;;GAIG;AACH,wBAAiB,4BAA4B,CAC3C,IAAI,EAAE,QAAQ,CAAC,GAAG,CAAC,EACnB,UAAU,EAAE,UAAU,GAAG,SAAS,EAClC,OAAO,EAAE,OAAO,GAAG,SAAS,EAC5B,eAAe,EAAE,MAAM,EACvB,UAAU,EAAE,UAAU,EACtB,eAAe,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,OAAO,EACvC,gBAAgB,CAAC,EAAE,SAAS,eAAe,EAAE,GAAG,SAAS;;;kBAmC1D;AAED,wBAAiB,iCAAiC,CAChD,WAAW,EAAE,QAAQ,CAAC,GAAG,CAAC,EAC1B,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,UAAU;;;kBAmBvB;AA4ED,wBAAgB,SAAS,CAAC,MAAM,EAAE,YAAY,UAI7C;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAiB,kBAAkB,CACjC,OAAO,EAAE,SAAS,MAAM,CAAC,IAAI,GAAG,OAAO,CAAC,EAAE,EAC1C,OAAO,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,KAAK,MAAM,GACpC,MAAM,CAAC,IAAI,GAAG,OAAO,CAAC,CAuGxB"}
@@ -163,7 +163,7 @@ var MemorySource = class MemorySource {
163
163
  }
164
164
  return;
165
165
  }
166
- const withConstraint = generateWithConstraint(skipYields(generateWithStart(generateWithOverlay(startAt, pkConstraint ? once(rowsIterable) : rowsIterable, req.constraint, this.#overlay, conn.lastPushedEpoch, indexComparator, conn.filters?.predicate), req.start, connectionComparator)), req.constraint);
166
+ const withConstraint = generateWithConstraint(skipYields(generateWithStart(generateWithOverlay(startAt, pkConstraint ? once(rowsIterable) : rowsIterable, req.constraint, this.#overlay, conn.lastPushedEpoch, indexComparator, connectionComparator, conn.filters?.predicate), req.start, connectionComparator)), req.constraint);
167
167
  yield* conn.filters ? generateWithFilter(withConstraint, conn.filters.predicate) : withConstraint;
168
168
  }
169
169
  *#fetchMulti(req, conn) {
@@ -330,14 +330,22 @@ function* generateWithStart(nodes, start, compare) {
330
330
  * @param constraint - constraint that was applied to the rowIterator and should
331
331
  * also be applied to the overlay.
332
332
  * @param overlay - the overlay values to splice in
333
- * @param compare - the comparator to use to find the position for the overlay
333
+ * @param compare - the comparator to use to find the position for the overlay.
334
+ * Must order rows the same way `rows` is ordered. For `MemorySource` that is
335
+ * *index* order, which leads with the constraint keys.
336
+ * @param startAtCompare - the comparator for `startAt`, which is a bound in the
337
+ * *connection's* sort order. Only the same as `compare` when the stream's order
338
+ * happens to be the connection's -- true for `TableSource` (SQL does the
339
+ * ordering) but not for a constrained `MemorySource` fetch. Conflating the two
340
+ * is what #4926 fixed for `generateWithStart`; this parameter is the same
341
+ * distinction for the overlay's own `startAt` pruning.
334
342
  */
335
- function* generateWithOverlay(startAt, rows, constraint, overlay, lastPushedEpoch, compare, filterPredicate, multiConstraints) {
343
+ function* generateWithOverlay(startAt, rows, constraint, overlay, lastPushedEpoch, compare, startAtCompare, filterPredicate, multiConstraints) {
336
344
  let overlayToApply = void 0;
337
345
  if (overlay && lastPushedEpoch >= overlay.epoch) overlayToApply = overlay;
338
- yield* generateWithOverlayInner(rows, computeOverlays(startAt, constraint, overlayToApply, compare, filterPredicate, multiConstraints), compare);
346
+ yield* generateWithOverlayInner(rows, computeOverlays(startAt, constraint, overlayToApply, startAtCompare, filterPredicate, multiConstraints), compare);
339
347
  }
340
- function computeOverlays(startAt, constraint, overlay, compare, filterPredicate, multiConstraints) {
348
+ function computeOverlays(startAt, constraint, overlay, startAtCompare, filterPredicate, multiConstraints) {
341
349
  let overlays = {
342
350
  add: void 0,
343
351
  remove: void 0
@@ -362,7 +370,7 @@ function computeOverlays(startAt, constraint, overlay, compare, filterPredicate,
362
370
  };
363
371
  break;
364
372
  }
365
- if (startAt) overlays = overlaysForStartAt(overlays, startAt, compare);
373
+ if (startAt) overlays = overlaysForStartAt(overlays, startAt, startAtCompare);
366
374
  if (constraint) overlays = overlaysForConstraint(overlays, constraint);
367
375
  overlays = applyMultiConstraintsToOverlays(overlays, multiConstraints);
368
376
  if (filterPredicate) overlays = overlaysForFilterPredicate(overlays, filterPredicate);