@rocicorp/zero 1.11.0-canary.37 → 1.11.0-canary.39

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 (76) hide show
  1. package/out/shared/src/valita.d.ts +75 -0
  2. package/out/shared/src/valita.d.ts.map +1 -1
  3. package/out/shared/src/valita.js +119 -1
  4. package/out/shared/src/valita.js.map +1 -1
  5. package/out/zero/package.js +1 -1
  6. package/out/zero/package.js.map +1 -1
  7. package/out/zero-cache/src/services/view-syncer/inspect-handler.d.ts +12 -2
  8. package/out/zero-cache/src/services/view-syncer/inspect-handler.d.ts.map +1 -1
  9. package/out/zero-cache/src/services/view-syncer/inspect-handler.js +27 -3
  10. package/out/zero-cache/src/services/view-syncer/inspect-handler.js.map +1 -1
  11. package/out/zero-cache/src/services/view-syncer/view-syncer.d.ts.map +1 -1
  12. package/out/zero-cache/src/services/view-syncer/view-syncer.js.map +1 -1
  13. package/out/zero-cache/src/workers/connection.d.ts +2 -1
  14. package/out/zero-cache/src/workers/connection.d.ts.map +1 -1
  15. package/out/zero-cache/src/workers/connection.js +9 -1
  16. package/out/zero-cache/src/workers/connection.js.map +1 -1
  17. package/out/zero-client/src/client/storage-version.d.ts +23 -0
  18. package/out/zero-client/src/client/storage-version.d.ts.map +1 -0
  19. package/out/zero-client/src/client/version.js +1 -1
  20. package/out/zero-client/src/client/zero.d.ts.map +1 -1
  21. package/out/zero-client/src/client/zero.js +1 -1
  22. package/out/zero-client/src/client/zero.js.map +1 -1
  23. package/out/zero-protocol/src/analyze-query-result.d.ts +12 -12
  24. package/out/zero-protocol/src/analyze-query-result.d.ts.map +1 -1
  25. package/out/zero-protocol/src/analyze-query-result.js +3 -3
  26. package/out/zero-protocol/src/analyze-query-result.js.map +1 -1
  27. package/out/zero-protocol/src/ast.d.ts +24 -0
  28. package/out/zero-protocol/src/ast.d.ts.map +1 -1
  29. package/out/zero-protocol/src/ast.js +26 -2
  30. package/out/zero-protocol/src/ast.js.map +1 -1
  31. package/out/zero-protocol/src/down.d.ts +5 -5
  32. package/out/zero-protocol/src/inspect-down.d.ts +15 -15
  33. package/out/zero-protocol/src/inspect-up.d.ts +158 -61
  34. package/out/zero-protocol/src/inspect-up.d.ts.map +1 -1
  35. package/out/zero-protocol/src/inspect-up.js +12 -6
  36. package/out/zero-protocol/src/inspect-up.js.map +1 -1
  37. package/out/zero-protocol/src/protocol-version.d.ts +4 -1
  38. package/out/zero-protocol/src/protocol-version.d.ts.map +1 -1
  39. package/out/zero-protocol/src/protocol-version.js.map +1 -1
  40. package/out/zero-protocol/src/queries-patch.js +2 -2
  41. package/out/zero-protocol/src/queries-patch.js.map +1 -1
  42. package/out/zero-protocol/src/up.d.ts +766 -256
  43. package/out/zero-protocol/src/up.d.ts.map +1 -1
  44. package/out/zero-protocol/src/up.js +25 -3
  45. package/out/zero-protocol/src/up.js.map +1 -1
  46. package/out/zero-server/src/adapters/drizzle.d.ts +14 -3
  47. package/out/zero-server/src/adapters/drizzle.d.ts.map +1 -1
  48. package/out/zero-server/src/adapters/drizzle.js +7 -4
  49. package/out/zero-server/src/adapters/drizzle.js.map +1 -1
  50. package/out/zero-server/src/adapters/kysely.d.ts +4 -2
  51. package/out/zero-server/src/adapters/kysely.d.ts.map +1 -1
  52. package/out/zero-server/src/adapters/kysely.js +8 -4
  53. package/out/zero-server/src/adapters/kysely.js.map +1 -1
  54. package/out/zero-server/src/adapters/pg.d.ts +3 -2
  55. package/out/zero-server/src/adapters/pg.d.ts.map +1 -1
  56. package/out/zero-server/src/adapters/pg.js +7 -4
  57. package/out/zero-server/src/adapters/pg.js.map +1 -1
  58. package/out/zero-server/src/adapters/postgresjs.d.ts +3 -2
  59. package/out/zero-server/src/adapters/postgresjs.d.ts.map +1 -1
  60. package/out/zero-server/src/adapters/postgresjs.js +8 -4
  61. package/out/zero-server/src/adapters/postgresjs.js.map +1 -1
  62. package/out/zero-server/src/adapters/prisma.d.ts +14 -3
  63. package/out/zero-server/src/adapters/prisma.d.ts.map +1 -1
  64. package/out/zero-server/src/adapters/prisma.js +12 -4
  65. package/out/zero-server/src/adapters/prisma.js.map +1 -1
  66. package/out/zero-server/src/mod.d.ts +1 -0
  67. package/out/zero-server/src/mod.d.ts.map +1 -1
  68. package/out/zero-server/src/transaction-options.d.ts +24 -0
  69. package/out/zero-server/src/transaction-options.d.ts.map +1 -0
  70. package/out/zero-server/src/transaction-options.js +11 -0
  71. package/out/zero-server/src/transaction-options.js.map +1 -0
  72. package/out/zql/src/query/query-registry.js +1 -1
  73. package/out/zqlite/src/sqlite-cost-model.d.ts.map +1 -1
  74. package/out/zqlite/src/sqlite-cost-model.js +1 -0
  75. package/out/zqlite/src/sqlite-cost-model.js.map +1 -1
  76. package/package.json +1 -1
@@ -23,6 +23,15 @@ export declare function test<T>(value: unknown, schema: v.Type<T>, mode?: ParseO
23
23
  * to operate directly on an Optional field.
24
24
  */
25
25
  export declare function testOptional<T>(value: unknown, schema: v.Type<T> | v.Optional<T>, mode?: ParseOptionsMode): Result<T | undefined>;
26
+ /**
27
+ * Parses `schema` in strict mode, whatever mode the enclosing parse uses. Use
28
+ * it for the parts of a message that a reader must not silently ignore inside
29
+ * a lenient parse.
30
+ *
31
+ * Wrap a field, not a union variant: a union sees the wrapped type as
32
+ * `unknown`, so it can no longer pick the variant by its literal fields.
33
+ */
34
+ export declare function strict<T>(schema: v.Type<T>): v.Type<T>;
26
35
  /**
27
36
  * Shallowly marks the schema as readonly.
28
37
  */
@@ -53,4 +62,70 @@ type ObjectShape = Record<string, typeof AbstractType>;
53
62
  export declare function deepPartial<Shape extends ObjectShape>(s: v.ObjectType<Shape, undefined>): v.ObjectType<{ [K in keyof Shape]: v.Optional<v.Infer<Shape[K]>>; }, undefined>;
54
63
  type Literal = string | number | bigint | boolean;
55
64
  export declare function literalUnion<T extends [...Literal[]]>(...literals: T): v.Type<T[number]>;
65
+ declare const unrecognized: unique symbol;
66
+ /** A value of an open enum that this build doesn't know. Keeps the raw value. */
67
+ export type Unrecognized<T extends Literal = string> = T & {
68
+ readonly [unrecognized]: true;
69
+ };
70
+ /**
71
+ * Like {@link literalUnion}, but any string parses, so a reader accepts values
72
+ * that a newer writer added. Unknown values keep their raw string and are typed
73
+ * as {@link Unrecognized}.
74
+ *
75
+ * Use it only where a reader can ignore or display an unknown value. Never use
76
+ * it for a value that changes what the reader computes, or for the
77
+ * discriminator of a union.
78
+ */
79
+ export declare function openLiteralUnion<T extends [string, ...string[]]>(..._literals: T): v.Type<T[number] | Unrecognized>;
80
+ /**
81
+ * Call in the `default` case of a `switch` over an open enum, so that a known
82
+ * value without a `case` fails to compile.
83
+ */
84
+ export declare function assertUnrecognized(_value: Unrecognized): void;
85
+ /** A tuple whose first element, its tag, is a literal. */
86
+ type TaggedTuple = v.TupleType<[v.Type<Literal>, ...v.Type[]]>;
87
+ /** A tuple with a tag this build doesn't know, as {@link taggedTupleUnion} parses it. */
88
+ export type UnrecognizedTuple = [
89
+ tag: Unrecognized<Literal>,
90
+ ...rest: unknown[]
91
+ ];
92
+ /**
93
+ * A union of tuples tagged by a literal in their first element, such as
94
+ * `['ping', {}]`. Unlike `union`, it picks the tuple by its tag instead of
95
+ * trying each in turn.
96
+ *
97
+ * With `open`, a tuple whose tag it doesn't know, but of the same type as a
98
+ * known tag, parses as is, typed as {@link UnrecognizedTuple}, so a reader can
99
+ * skip kinds a newer writer added. Use `isKnown` to tell them apart:
100
+ * TypeScript can't narrow the union by comparing the tag, because a tag
101
+ * literal is comparable to `Unrecognized`. A closed union is not implemented
102
+ * yet.
103
+ */
104
+ export declare function taggedTupleUnion<T extends TaggedTuple[]>(tuples: T, options: {
105
+ readonly open: boolean;
106
+ }): v.Type<v.Infer<T[number]> | UnrecognizedTuple> & {
107
+ isKnown(value: v.Infer<T[number]> | UnrecognizedTuple): value is v.Infer<T[number]>;
108
+ };
109
+ /** An object with a tag this build doesn't know, as {@link taggedObjectUnion} parses it. */
110
+ export type UnrecognizedObject<K extends string> = {
111
+ readonly [P in K]: Unrecognized<Literal>;
112
+ } & {
113
+ readonly [key: string]: unknown;
114
+ };
115
+ /**
116
+ * A union of objects told apart by a literal in their `key` property, their
117
+ * tag, such as `{op: 'queries', id: '1'}`. Unlike `union`, it picks the object
118
+ * by its tag instead of trying each in turn, so a bad object of a known kind
119
+ * fails with that kind's error.
120
+ *
121
+ * With `open`, an object whose tag it doesn't know, but of the same type as a
122
+ * known tag, parses as is, typed as {@link UnrecognizedObject}, so a reader
123
+ * can answer or skip kinds a newer writer added. Use `isKnown` to tell them
124
+ * apart. A closed union is not implemented yet.
125
+ */
126
+ export declare function taggedObjectUnion<K extends string, T extends v.ObjectType[]>(key: K, objects: T, options: {
127
+ readonly open: boolean;
128
+ }): v.Type<v.Infer<T[number]> | UnrecognizedObject<K>> & {
129
+ isKnown(value: v.Infer<T[number]> | UnrecognizedObject<K>): value is v.Infer<T[number]>;
130
+ };
56
131
  //# sourceMappingURL=valita.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"valita.d.ts","sourceRoot":"","sources":["../../../../shared/src/valita.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AAEpC,cAAc,gBAAgB,CAAC;AAwK/B;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG,QAAQ,GAAG,OAAO,CAAC;AAElE,wBAAgB,KAAK,CAAC,CAAC,EACrB,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EACjB,IAAI,CAAC,EAAE,gBAAgB,GACtB,CAAC,CAMH;AAED,wBAAgB,EAAE,CAAC,CAAC,EAClB,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EACjB,IAAI,CAAC,EAAE,gBAAgB,GACtB,KAAK,IAAI,CAAC,CAEZ;AAED,wBAAgB,MAAM,CAAC,CAAC,EACtB,KAAK,EAAE,OAAO,EACd,MAAM,EA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EAAE,CAAC,EACN,OAAO,EAAE,CAAC,EACV,OAAO,EAAE;IAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CAAC,GAChC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAAC,GAAG;IACtD,OAAO,CACL,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,kBAAkB,CAAC,CAAC,CAAC,GAChD,KAAK,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;CAChC,CAgDA"}
@@ -4,15 +4,20 @@ export * from "@badrap/valita";
4
4
  //#region ../shared/src/valita.ts
5
5
  var valita_exports = /* @__PURE__ */ __exportAll({
6
6
  assert: () => assert,
7
+ assertUnrecognized: () => assertUnrecognized,
7
8
  deepPartial: () => deepPartial,
8
9
  instanceOfAbstractType: () => instanceOfAbstractType,
9
10
  is: () => is,
10
11
  literalUnion: () => literalUnion,
12
+ openLiteralUnion: () => openLiteralUnion,
11
13
  parse: () => parse,
12
14
  readonly: () => readonly,
13
15
  readonlyArray: () => readonlyArray,
14
16
  readonlyObject: () => readonlyObject,
15
17
  readonlyRecord: () => readonlyRecord,
18
+ strict: () => strict,
19
+ taggedObjectUnion: () => taggedObjectUnion,
20
+ taggedTupleUnion: () => taggedTupleUnion,
16
21
  test: () => test,
17
22
  testOptional: () => testOptional,
18
23
  toTerminals: () => toTerminals
@@ -120,6 +125,19 @@ function testOptional(value, schema, mode) {
120
125
  };
121
126
  return res;
122
127
  }
128
+ var STRICT = { mode: "strict" };
129
+ /**
130
+ * Parses `schema` in strict mode, whatever mode the enclosing parse uses. Use
131
+ * it for the parts of a message that a reader must not silently ignore inside
132
+ * a lenient parse.
133
+ *
134
+ * Wrap a field, not a union variant: a union sees the wrapped type as
135
+ * `unknown`, so it can no longer pick the variant by its literal fields.
136
+ */
137
+ function strict(schema) {
138
+ const type = v.unknown().chain((value) => schema.try(value, STRICT));
139
+ return Object.assign(type, { strict: schema });
140
+ }
123
141
  /**
124
142
  * Shallowly marks the schema as readonly.
125
143
  */
@@ -166,7 +184,107 @@ function deepPartial(s) {
166
184
  function literalUnion(...literals) {
167
185
  return v.union(...literals.map(v.literal));
168
186
  }
187
+ /**
188
+ * Like {@link literalUnion}, but any string parses, so a reader accepts values
189
+ * that a newer writer added. Unknown values keep their raw string and are typed
190
+ * as {@link Unrecognized}.
191
+ *
192
+ * Use it only where a reader can ignore or display an unknown value. Never use
193
+ * it for a value that changes what the reader computes, or for the
194
+ * discriminator of a union.
195
+ */
196
+ function openLiteralUnion(..._literals) {
197
+ return v.string();
198
+ }
199
+ /**
200
+ * Call in the `default` case of a `switch` over an open enum, so that a known
201
+ * value without a `case` fails to compile.
202
+ */
203
+ function assertUnrecognized(_value) {}
204
+ /**
205
+ * A union of tuples tagged by a literal in their first element, such as
206
+ * `['ping', {}]`. Unlike `union`, it picks the tuple by its tag instead of
207
+ * trying each in turn.
208
+ *
209
+ * With `open`, a tuple whose tag it doesn't know, but of the same type as a
210
+ * known tag, parses as is, typed as {@link UnrecognizedTuple}, so a reader can
211
+ * skip kinds a newer writer added. Use `isKnown` to tell them apart:
212
+ * TypeScript can't narrow the union by comparing the tag, because a tag
213
+ * literal is comparable to `Unrecognized`. A closed union is not implemented
214
+ * yet.
215
+ */
216
+ function taggedTupleUnion(tuples, options) {
217
+ if (!options.open) throw new Error("A closed taggedTupleUnion is not implemented");
218
+ const byTag = /* @__PURE__ */ new Map();
219
+ const tagTypes = /* @__PURE__ */ new Set();
220
+ for (const tuple of tuples) toTerminals(tuple.prefix[0], (t) => {
221
+ if (t.name !== "literal") throw new Error("Expected every tag to be a literal");
222
+ if (byTag.has(t.value)) throw new Error(`Duplicate tag ${toDisplay(t.value)}`);
223
+ byTag.set(t.value, tuple);
224
+ tagTypes.add(typeof t.value);
225
+ });
226
+ const expectedTag = `Expected ${displayList("or", [...tagTypes])}`;
227
+ const type = v.unknown().chain((value, options) => {
228
+ if (!Array.isArray(value)) return v.err("Expected array");
229
+ const [tag] = value;
230
+ const tuple = byTag.get(tag);
231
+ if (tuple) return tuple.try(value, options);
232
+ return tagTypes.has(typeof tag) ? v.ok(value) : v.err({
233
+ message: expectedTag,
234
+ path: [0]
235
+ });
236
+ });
237
+ return Object.assign(type, {
238
+ taggedTupleUnion: tuples,
239
+ isKnown: (value) => byTag.has(value[0])
240
+ });
241
+ }
242
+ /**
243
+ * A union of objects told apart by a literal in their `key` property, their
244
+ * tag, such as `{op: 'queries', id: '1'}`. Unlike `union`, it picks the object
245
+ * by its tag instead of trying each in turn, so a bad object of a known kind
246
+ * fails with that kind's error.
247
+ *
248
+ * With `open`, an object whose tag it doesn't know, but of the same type as a
249
+ * known tag, parses as is, typed as {@link UnrecognizedObject}, so a reader
250
+ * can answer or skip kinds a newer writer added. Use `isKnown` to tell them
251
+ * apart. A closed union is not implemented yet.
252
+ */
253
+ function taggedObjectUnion(key, objects, options) {
254
+ if (!options.open) throw new Error("A closed taggedObjectUnion is not implemented");
255
+ const byTag = /* @__PURE__ */ new Map();
256
+ const tagTypes = /* @__PURE__ */ new Set();
257
+ for (const object of objects) {
258
+ const tag = object.shape[key];
259
+ if (tag === void 0) throw new Error(`Expected every object to have ${key}`);
260
+ toTerminals(tag, (t) => {
261
+ if (t.name !== "literal") throw new Error("Expected every tag to be a literal");
262
+ if (byTag.has(t.value)) throw new Error(`Duplicate tag ${toDisplay(t.value)}`);
263
+ byTag.set(t.value, object);
264
+ tagTypes.add(typeof t.value);
265
+ });
266
+ }
267
+ const expectedTag = `Expected ${displayList("or", [...tagTypes])}`;
268
+ const tagOf = (value) => Object.hasOwn(value, key) ? value[key] : void 0;
269
+ const type = v.unknown().chain((value, options) => {
270
+ if (typeof value !== "object" || value === null || Array.isArray(value)) return v.err("Expected object");
271
+ const tag = tagOf(value);
272
+ const object = byTag.get(tag);
273
+ if (object) return object.try(value, options);
274
+ return tagTypes.has(typeof tag) ? v.ok(value) : v.err({
275
+ message: expectedTag,
276
+ path: [key]
277
+ });
278
+ });
279
+ return Object.assign(type, {
280
+ taggedObjectUnion: {
281
+ key,
282
+ objects
283
+ },
284
+ isKnown: (value) => byTag.has(tagOf(value))
285
+ });
286
+ }
169
287
  //#endregion
170
- export { assert, deepPartial, instanceOfAbstractType, literalUnion, parse, readonly, readonlyArray, readonlyObject, readonlyRecord, test, testOptional, toTerminals, valita_exports };
288
+ export { assert, deepPartial, instanceOfAbstractType, literalUnion, openLiteralUnion, parse, readonly, readonlyArray, readonlyObject, readonlyRecord, strict, taggedObjectUnion, taggedTupleUnion, test, testOptional, toTerminals, valita_exports };
171
289
 
172
290
  //# sourceMappingURL=valita.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"valita.js","names":[],"sources":["../../../../shared/src/valita.ts"],"sourcesContent":["import * as v from '@badrap/valita';\n\nexport * from '@badrap/valita';\n\nfunction toDisplay(value: unknown): string {\n switch (typeof value) {\n case 'string':\n case 'number':\n case 'boolean':\n return JSON.stringify(value);\n case 'undefined':\n return 'undefined';\n case 'bigint':\n return value.toString() + 'n';\n default:\n if (value === null) {\n return 'null';\n }\n if (Array.isArray(value)) {\n return 'array';\n }\n return typeof value;\n }\n}\n\ntype Key = string | number;\n\nfunction toDisplayAtPath(v: unknown, path: Key[] | undefined): string {\n if (!path?.length) {\n return toDisplay(v);\n }\n\n let cur = v;\n for (const p of path) {\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n cur = (cur as any)[p];\n }\n return toDisplay(cur);\n}\n\nfunction displayList<T>(\n word: string,\n expected: T[],\n toDisplay: (x: T) => string | number = x => String(x),\n): string | number {\n if (expected.length === 1) {\n return toDisplay(expected[0]);\n }\n\n const suffix = `${toDisplay(\n expected[expected.length - 2],\n // oxlint-disable-next-line typescript/no-non-null-assertion\n )} ${word} ${toDisplay(expected.at(-1)!)}`;\n if (expected.length === 2) {\n return suffix;\n }\n return `${expected.slice(0, -2).map(toDisplay).join(', ')}, ${suffix}`;\n}\n\nfunction getMessage(\n err: v.Err,\n v: unknown,\n schema: v.Type | v.Optional,\n mode: ParseOptionsMode | undefined,\n): string {\n const firstIssue = err.issues[0];\n const {path} = firstIssue;\n const atPath = path?.length ? ` at ${path.join('.')}` : '';\n\n switch (firstIssue.code) {\n case 'invalid_type':\n return `Expected ${displayList(\n 'or',\n firstIssue.expected,\n )}${atPath}. Got ${toDisplayAtPath(v, path)}`;\n case 'missing_value': {\n const atPath =\n path && path.length > 1 ? ` at ${path.slice(0, -1).join('.')}` : '';\n\n if (firstIssue.path?.length) {\n return `Missing property ${firstIssue.path.at(-1)}${atPath}`;\n }\n return `TODO Unknown missing property${atPath}`;\n }\n\n case 'invalid_literal':\n return `Expected literal value ${displayList(\n 'or',\n firstIssue.expected,\n toDisplay,\n )}${atPath} Got ${toDisplayAtPath(v, path)}`;\n\n case 'invalid_length': {\n return `Expected array with length ${\n firstIssue.minLength === firstIssue.maxLength\n ? firstIssue.minLength\n : `between ${firstIssue.minLength} and ${firstIssue.maxLength}`\n }${atPath}. Got array with length ${(v as {length: number}).length}`;\n }\n\n case 'unrecognized_keys':\n if (firstIssue.keys.length === 1) {\n return `Unexpected property ${firstIssue.keys[0]}${atPath}`;\n }\n return `Unexpected properties ${displayList(\n 'and',\n firstIssue.keys,\n )}${atPath}`;\n\n case 'invalid_union':\n return schema.name === 'union'\n ? getDeepestUnionParseError(v, schema as v.UnionType, mode ?? 'strict')\n : `Invalid union value${atPath}`;\n\n case 'custom_error':\n return `${firstIssue.message}${atPath}. Got ${toDisplayAtPath(v, path)}`;\n }\n}\n\ntype FailedType = {type: v.Type; err: v.Err};\n\nfunction getDeepestUnionParseError(\n value: unknown,\n schema: v.UnionType,\n mode: ParseOptionsMode,\n): string {\n const failures: FailedType[] = [];\n for (const type of schema.options) {\n const r = type.try(value, {mode});\n if (!r.ok) {\n failures.push({type, err: r});\n }\n }\n if (failures.length) {\n // compare the first and second longest-path errors\n failures.sort(pathCmp);\n if (failures.length === 1 || pathCmp(failures[0], failures[1]) < 0) {\n return getMessage(failures[0].err, value, failures[0].type, mode);\n }\n }\n // paths are equivalent\n try {\n const str = JSON.stringify(value);\n return `Invalid union value: ${str}`;\n } catch {\n // fallback if the value could not be stringified\n return `Invalid union value`;\n }\n}\n\n// Descending-order comparison of Issue paths.\n// * [1, 'a'] sorts before [1]\n// * [1] sorts before [0] (i.e. errors later in the tuple sort before earlier errors)\nfunction pathCmp(a: FailedType, b: FailedType) {\n const aPath = a.err.issues[0].path;\n const bPath = b.err.issues[0].path;\n if (aPath.length !== bPath.length) {\n return bPath.length - aPath.length;\n }\n for (let i = 0; i < aPath.length; i++) {\n if (bPath[i] > aPath[i]) {\n return -1;\n }\n if (bPath[i] < aPath[i]) {\n return 1;\n }\n }\n return 0;\n}\n\n/**\n * 'strip' allows unknown properties and removes unknown properties.\n * 'strict' errors if there are unknown properties.\n * 'passthrough' allows unknown properties.\n */\nexport type ParseOptionsMode = 'passthrough' | 'strict' | 'strip';\n\nexport function parse<T>(\n value: unknown,\n schema: v.Type<T>,\n mode?: ParseOptionsMode,\n): T {\n const res = test(value, schema, mode);\n if (!res.ok) {\n throw new TypeError(res.error);\n }\n return res.value;\n}\n\nexport function is<T>(\n value: unknown,\n schema: v.Type<T>,\n mode?: ParseOptionsMode,\n): value is T {\n return test(value, schema, mode).ok;\n}\n\nexport function assert<T>(\n value: unknown,\n schema: v.Type<T>,\n mode?: ParseOptionsMode,\n): asserts value is T {\n parse(value, schema, mode);\n}\n\ntype Result<T> = {ok: true; value: T} | {ok: false; error: string};\n\nexport function test<T>(\n value: unknown,\n schema: v.Type<T>,\n mode?: ParseOptionsMode,\n): Result<T> {\n // A Type<T> only yields undefined if T includes it.\n return testOptional(value, schema, mode) as Result<T>;\n}\n\n/**\n * Similar to {@link test} but works for AbstractTypes such as Optional.\n * This is for advanced usage. Prefer {@link test} unless you really need\n * to operate directly on an Optional field.\n */\nexport function testOptional<T>(\n value: unknown,\n schema: v.Type<T> | v.Optional<T>,\n mode?: ParseOptionsMode,\n): Result<T | undefined> {\n const res = schema.try(value, mode ? {mode} : undefined);\n if (!res.ok) {\n return {ok: false, error: getMessage(res, value, schema, mode)};\n }\n return res;\n}\n\n/**\n * Shallowly marks the schema as readonly.\n */\nexport function readonly<T extends v.Type>(t: T): v.Type<Readonly<v.Infer<T>>> {\n return t as v.Type<Readonly<v.Infer<T>>>;\n}\n\nexport function readonlyObject<T extends Record<string, v.Type | v.Optional>>(\n t: T,\n): v.ObjectType<Readonly<T>, undefined> {\n return v.object(t);\n}\n\nexport function readonlyArray<T extends v.Type>(\n t: T,\n): v.Type<readonly v.Infer<T>[]> {\n return v.array(t);\n}\n\nexport function readonlyRecord<T extends v.Type>(\n t: T,\n): v.Type<Readonly<Record<string, v.Infer<T>>>> {\n return v.record(t);\n}\n\nconst AbstractType = Object.getPrototypeOf(\n Object.getPrototypeOf(v.string().optional()),\n).constructor;\n\nexport function instanceOfAbstractType<T = unknown>(\n obj: unknown,\n): obj is v.Type<T> | v.Optional<T> {\n return obj instanceof AbstractType;\n}\n\n// valita does not export TerminalType.\nexport type TerminalType = Parameters<Parameters<v.Type['_toTerminals']>[0]>[0];\n\n/**\n * Calls `func` for each terminal type that `type` is composed of, looking\n * through unions, optionals and the transforms created by\n * `.optional(() => x)`, `.assert()`, `.map()` and `.chain()`.\n *\n * This is the only use of valita's internal `_toTerminals`. The public API\n * has no way to look inside a transform, so there is no alternative. The\n * `toTerminals` test in valita.test.ts pins the behavior options.ts depends\n * on, so a valita upgrade that changes it fails there instead of misparsing\n * flags.\n */\nexport function toTerminals(\n type: v.Type | v.Optional,\n func: (t: TerminalType) => void,\n): void {\n type._toTerminals(func);\n}\n\ntype ObjectShape = Record<string, typeof AbstractType>;\n\n/**\n * Similar to `ObjectType.partial()` except it recurses into nested objects.\n * Rest types are not supported.\n */\nexport function deepPartial<Shape extends ObjectShape>(\n s: v.ObjectType<Shape, undefined>,\n) {\n const shape = {} as Record<string, unknown>;\n for (const [key, type] of Object.entries(s.shape)) {\n if (type.name === 'object') {\n shape[key] = deepPartial(\n type as v.ObjectType<ObjectShape, undefined>,\n ).optional();\n } else {\n shape[key] = type.optional();\n }\n }\n return v.object(shape as {[K in keyof Shape]: v.Optional<v.Infer<Shape[K]>>});\n}\n\ntype Literal = string | number | bigint | boolean;\n\nexport function literalUnion<T extends [...Literal[]]>(\n ...literals: T\n): v.Type<T[number]> {\n return v.union(...literals.map(v.literal));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAIA,SAAS,UAAU,OAAwB;CACzC,QAAQ,OAAO,OAAf;EACE,KAAK;EACL,KAAK;EACL,KAAK,WACH,OAAO,KAAK,UAAU,KAAK;EAC7B,KAAK,aACH,OAAO;EACT,KAAK,UACH,OAAO,MAAM,SAAS,IAAI;EAC5B;GACE,IAAI,UAAU,MACZ,OAAO;GAET,IAAI,MAAM,QAAQ,KAAK,GACrB,OAAO;GAET,OAAO,OAAO;CAClB;AACF;AAIA,SAAS,gBAAgB,GAAY,MAAiC;CACpE,IAAI,CAAC,MAAM,QACT,OAAO,UAAU,CAAC;CAGpB,IAAI,MAAM;CACV,KAAK,MAAM,KAAK,MAEd,MAAO,IAAY;CAErB,OAAO,UAAU,GAAG;AACtB;AAEA,SAAS,YACP,MACA,UACA,aAAuC,MAAK,OAAO,CAAC,GACnC;CACjB,IAAI,SAAS,WAAW,GACtB,OAAO,UAAU,SAAS,EAAE;CAG9B,MAAM,SAAS,GAAG,UAChB,SAAS,SAAS,SAAS,EAE7B,EAAE,GAAG,KAAK,GAAG,UAAU,SAAS,GAAG,EAAE,CAAE;CACvC,IAAI,SAAS,WAAW,GACtB,OAAO;CAET,OAAO,GAAG,SAAS,MAAM,GAAG,EAAE,EAAE,IAAI,SAAS,EAAE,KAAK,IAAI,EAAE,IAAI;AAChE;AAEA,SAAS,WACP,KACA,GACA,QACA,MACQ;CACR,MAAM,aAAa,IAAI,OA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ACT;AAEA,SAAgB,eACd,GACsC;CACtC,OAAO,EAAE,OAAO,CAAC;AACnB;AAEA,SAAgB,cACd,GAC+B;CAC/B,OAAO,EAAE,MAAM,CAAC;AAClB;AAEA,SAAgB,eACd,GAC8C;CAC9C,OAAO,EAAE,OAAO,CAAC;AACnB;AAEA,IAAM,eAAe,OAAO,eAC1B,OAAO,eAAe,EAAE,OAAO,EAAE,SAAS,CAAC,CAC7C,EAAE;AAEF,SAAgB,uBACd,KACkC;CAClC,OAAO,eAAe;AACxB;;;;;;;;;;;;AAgBA,SAAgB,YACd,MACA,MACM;CACN,KAAK,aAAa,IAAI;AACxB;;;;;AAQA,SAAgB,YACd,GACA;CACA,MAAM,QAAQ,CAAC;CACf,KAAK,MAAM,CAAC,KAAK,SAAS,OAAO,QAAQ,EAAE,KAAK,GAC9C,IAAI,KAAK,SAAS,UAChB,MAAM,OAAO,YACX,IACF,EAAE,SAAS;MAEX,MAAM,OAAO,KAAK,SAAS;CAG/B,OAAO,EAAE,OAAO,KAA4D;AAC9E;AAIA,SAAgB,aACd,GAAG,UACgB;CACnB,OAAO,EAAE,MAAM,GAAG,SAAS,IAAI,EAAE,OAAO,CAAC;AAC3C"}
1
+ {"version":3,"file":"valita.js","names":[],"sources":["../../../../shared/src/valita.ts"],"sourcesContent":["import * as v from '@badrap/valita';\n\nexport * from '@badrap/valita';\n\nfunction toDisplay(value: unknown): string {\n switch (typeof value) {\n case 'string':\n case 'number':\n case 'boolean':\n return JSON.stringify(value);\n case 'undefined':\n return 'undefined';\n case 'bigint':\n return value.toString() + 'n';\n default:\n if (value === null) {\n return 'null';\n }\n if (Array.isArray(value)) {\n return 'array';\n }\n return typeof value;\n }\n}\n\ntype Key = string | number;\n\nfunction toDisplayAtPath(v: unknown, path: Key[] | undefined): string {\n if (!path?.length) {\n return toDisplay(v);\n }\n\n let cur = v;\n for (const p of path) {\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n cur = (cur as any)[p];\n }\n return toDisplay(cur);\n}\n\nfunction displayList<T>(\n word: string,\n expected: T[],\n toDisplay: (x: T) => string | number = x => String(x),\n): string | number {\n if (expected.length === 1) {\n return toDisplay(expected[0]);\n }\n\n const suffix = `${toDisplay(\n expected[expected.length - 2],\n // oxlint-disable-next-line typescript/no-non-null-assertion\n )} ${word} ${toDisplay(expected.at(-1)!)}`;\n if (expected.length === 2) {\n return suffix;\n }\n return `${expected.slice(0, -2).map(toDisplay).join(', ')}, ${suffix}`;\n}\n\nfunction getMessage(\n err: v.Err,\n v: unknown,\n schema: v.Type | v.Optional,\n mode: ParseOptionsMode | undefined,\n): string {\n const firstIssue = err.issues[0];\n const {path} = firstIssue;\n const atPath = path?.length ? ` at ${path.join('.')}` : '';\n\n switch (firstIssue.code) {\n case 'invalid_type':\n return `Expected ${displayList(\n 'or',\n firstIssue.expected,\n )}${atPath}. Got ${toDisplayAtPath(v, path)}`;\n case 'missing_value': {\n const atPath =\n path && path.length > 1 ? ` at ${path.slice(0, -1).join('.')}` : '';\n\n if (firstIssue.path?.length) {\n return `Missing property ${firstIssue.path.at(-1)}${atPath}`;\n }\n return `TODO Unknown missing property${atPath}`;\n }\n\n case 'invalid_literal':\n return `Expected literal value ${displayList(\n 'or',\n firstIssue.expected,\n toDisplay,\n )}${atPath} Got ${toDisplayAtPath(v, path)}`;\n\n case 'invalid_length': {\n return `Expected array with length ${\n firstIssue.minLength === firstIssue.maxLength\n ? firstIssue.minLength\n : `between ${firstIssue.minLength} and ${firstIssue.maxLength}`\n }${atPath}. Got array with length ${(v as {length: number}).length}`;\n }\n\n case 'unrecognized_keys':\n if (firstIssue.keys.length === 1) {\n return `Unexpected property ${firstIssue.keys[0]}${atPath}`;\n }\n return `Unexpected properties ${displayList(\n 'and',\n firstIssue.keys,\n )}${atPath}`;\n\n case 'invalid_union':\n return schema.name === 'union'\n ? getDeepestUnionParseError(v, schema as v.UnionType, mode ?? 'strict')\n : `Invalid union value${atPath}`;\n\n case 'custom_error':\n return `${firstIssue.message}${atPath}. Got ${toDisplayAtPath(v, path)}`;\n }\n}\n\ntype FailedType = {type: v.Type; err: v.Err};\n\nfunction getDeepestUnionParseError(\n value: unknown,\n schema: v.UnionType,\n mode: ParseOptionsMode,\n): string {\n const failures: FailedType[] = [];\n for (const type of schema.options) {\n const r = type.try(value, {mode});\n if (!r.ok) {\n failures.push({type, err: r});\n }\n }\n if (failures.length) {\n // compare the first and second longest-path errors\n failures.sort(pathCmp);\n if (failures.length === 1 || pathCmp(failures[0], failures[1]) < 0) {\n return getMessage(failures[0].err, value, failures[0].type, mode);\n }\n }\n // paths are equivalent\n try {\n const str = JSON.stringify(value);\n return `Invalid union value: ${str}`;\n } catch {\n // fallback if the value could not be stringified\n return `Invalid union value`;\n }\n}\n\n// Descending-order comparison of Issue paths.\n// * [1, 'a'] sorts before [1]\n// * [1] sorts before [0] (i.e. errors later in the tuple sort before earlier errors)\nfunction pathCmp(a: FailedType, b: FailedType) {\n const aPath = a.err.issues[0].path;\n const bPath = b.err.issues[0].path;\n if (aPath.length !== bPath.length) {\n return bPath.length - aPath.length;\n }\n for (let i = 0; i < aPath.length; i++) {\n if (bPath[i] > aPath[i]) {\n return -1;\n }\n if (bPath[i] < aPath[i]) {\n return 1;\n }\n }\n return 0;\n}\n\n/**\n * 'strip' allows unknown properties and removes unknown properties.\n * 'strict' errors if there are unknown properties.\n * 'passthrough' allows unknown properties.\n */\nexport type ParseOptionsMode = 'passthrough' | 'strict' | 'strip';\n\nexport function parse<T>(\n value: unknown,\n schema: v.Type<T>,\n mode?: ParseOptionsMode,\n): T {\n const res = test(value, schema, mode);\n if (!res.ok) {\n throw new TypeError(res.error);\n }\n return res.value;\n}\n\nexport function is<T>(\n value: unknown,\n schema: v.Type<T>,\n mode?: ParseOptionsMode,\n): value is T {\n return test(value, schema, mode).ok;\n}\n\nexport function assert<T>(\n value: unknown,\n schema: v.Type<T>,\n mode?: ParseOptionsMode,\n): asserts value is T {\n parse(value, schema, mode);\n}\n\ntype Result<T> = {ok: true; value: T} | {ok: false; error: string};\n\nexport function test<T>(\n value: unknown,\n schema: v.Type<T>,\n mode?: ParseOptionsMode,\n): Result<T> {\n // A Type<T> only yields undefined if T includes it.\n return testOptional(value, schema, mode) as Result<T>;\n}\n\n/**\n * Similar to {@link test} but works for AbstractTypes such as Optional.\n * This is for advanced usage. Prefer {@link test} unless you really need\n * to operate directly on an Optional field.\n */\nexport function testOptional<T>(\n value: unknown,\n schema: v.Type<T> | v.Optional<T>,\n mode?: ParseOptionsMode,\n): Result<T | undefined> {\n const res = schema.try(value, mode ? {mode} : undefined);\n if (!res.ok) {\n return {ok: false, error: getMessage(res, value, schema, mode)};\n }\n return res;\n}\n\nconst STRICT = {mode: 'strict'} as const;\n\n/**\n * Parses `schema` in strict mode, whatever mode the enclosing parse uses. Use\n * it for the parts of a message that a reader must not silently ignore inside\n * a lenient parse.\n *\n * Wrap a field, not a union variant: a union sees the wrapped type as\n * `unknown`, so it can no longer pick the variant by its literal fields.\n */\nexport function strict<T>(schema: v.Type<T>): v.Type<T> {\n const type = v.unknown().chain(value => schema.try(value, STRICT));\n // A transform serializes as just its name. Show the wrapped schema too, so a\n // change to it still changes the hash in protocol-version.test.ts.\n return Object.assign(type, {strict: schema});\n}\n\n/**\n * Shallowly marks the schema as readonly.\n */\nexport function readonly<T extends v.Type>(t: T): v.Type<Readonly<v.Infer<T>>> {\n return t as v.Type<Readonly<v.Infer<T>>>;\n}\n\nexport function readonlyObject<T extends Record<string, v.Type | v.Optional>>(\n t: T,\n): v.ObjectType<Readonly<T>, undefined> {\n return v.object(t);\n}\n\nexport function readonlyArray<T extends v.Type>(\n t: T,\n): v.Type<readonly v.Infer<T>[]> {\n return v.array(t);\n}\n\nexport function readonlyRecord<T extends v.Type>(\n t: T,\n): v.Type<Readonly<Record<string, v.Infer<T>>>> {\n return v.record(t);\n}\n\nconst AbstractType = Object.getPrototypeOf(\n Object.getPrototypeOf(v.string().optional()),\n).constructor;\n\nexport function instanceOfAbstractType<T = unknown>(\n obj: unknown,\n): obj is v.Type<T> | v.Optional<T> {\n return obj instanceof AbstractType;\n}\n\n// valita does not export TerminalType.\nexport type TerminalType = Parameters<Parameters<v.Type['_toTerminals']>[0]>[0];\n\n/**\n * Calls `func` for each terminal type that `type` is composed of, looking\n * through unions, optionals and the transforms created by\n * `.optional(() => x)`, `.assert()`, `.map()` and `.chain()`.\n *\n * This is the only use of valita's internal `_toTerminals`. The public API\n * has no way to look inside a transform, so there is no alternative. The\n * `toTerminals` test in valita.test.ts pins the behavior options.ts depends\n * on, so a valita upgrade that changes it fails there instead of misparsing\n * flags.\n */\nexport function toTerminals(\n type: v.Type | v.Optional,\n func: (t: TerminalType) => void,\n): void {\n type._toTerminals(func);\n}\n\ntype ObjectShape = Record<string, typeof AbstractType>;\n\n/**\n * Similar to `ObjectType.partial()` except it recurses into nested objects.\n * Rest types are not supported.\n */\nexport function deepPartial<Shape extends ObjectShape>(\n s: v.ObjectType<Shape, undefined>,\n) {\n const shape = {} as Record<string, unknown>;\n for (const [key, type] of Object.entries(s.shape)) {\n if (type.name === 'object') {\n shape[key] = deepPartial(\n type as v.ObjectType<ObjectShape, undefined>,\n ).optional();\n } else {\n shape[key] = type.optional();\n }\n }\n return v.object(shape as {[K in keyof Shape]: v.Optional<v.Infer<Shape[K]>>});\n}\n\ntype Literal = string | number | bigint | boolean;\n\nexport function literalUnion<T extends [...Literal[]]>(\n ...literals: T\n): v.Type<T[number]> {\n return v.union(...literals.map(v.literal));\n}\n\ndeclare const unrecognized: unique symbol;\n\n/** A value of an open enum that this build doesn't know. Keeps the raw value. */\nexport type Unrecognized<T extends Literal = string> = T & {\n readonly [unrecognized]: true;\n};\n\n/**\n * Like {@link literalUnion}, but any string parses, so a reader accepts values\n * that a newer writer added. Unknown values keep their raw string and are typed\n * as {@link Unrecognized}.\n *\n * Use it only where a reader can ignore or display an unknown value. Never use\n * it for a value that changes what the reader computes, or for the\n * discriminator of a union.\n */\nexport function openLiteralUnion<T extends [string, ...string[]]>(\n ..._literals: T\n): v.Type<T[number] | Unrecognized> {\n return v.string() as v.Type<T[number] | Unrecognized>;\n}\n\n/**\n * Call in the `default` case of a `switch` over an open enum, so that a known\n * value without a `case` fails to compile.\n */\nexport function assertUnrecognized(_value: Unrecognized): void {}\n\n/** A tuple whose first element, its tag, is a literal. */\ntype TaggedTuple = v.TupleType<[v.Type<Literal>, ...v.Type[]]>;\n\n/** A tuple with a tag this build doesn't know, as {@link taggedTupleUnion} parses it. */\nexport type UnrecognizedTuple = [\n tag: Unrecognized<Literal>,\n ...rest: unknown[],\n];\n\n/**\n * A union of tuples tagged by a literal in their first element, such as\n * `['ping', {}]`. Unlike `union`, it picks the tuple by its tag instead of\n * trying each in turn.\n *\n * With `open`, a tuple whose tag it doesn't know, but of the same type as a\n * known tag, parses as is, typed as {@link UnrecognizedTuple}, so a reader can\n * skip kinds a newer writer added. Use `isKnown` to tell them apart:\n * TypeScript can't narrow the union by comparing the tag, because a tag\n * literal is comparable to `Unrecognized`. A closed union is not implemented\n * yet.\n */\nexport function taggedTupleUnion<T extends TaggedTuple[]>(\n tuples: T,\n options: {readonly open: boolean},\n): v.Type<v.Infer<T[number]> | UnrecognizedTuple> & {\n isKnown(\n value: v.Infer<T[number]> | UnrecognizedTuple,\n ): value is v.Infer<T[number]>;\n} {\n if (!options.open) {\n throw new Error('A closed taggedTupleUnion is not implemented');\n }\n type Known = v.Infer<T[number]>;\n const byTag = new Map<unknown, v.Type>();\n const tagTypes = new Set<string>();\n for (const tuple of tuples) {\n toTerminals(tuple.prefix[0], t => {\n if (t.name !== 'literal') {\n throw new Error('Expected every tag to be a literal');\n }\n if (byTag.has(t.value)) {\n throw new Error(`Duplicate tag ${toDisplay(t.value)}`);\n }\n byTag.set(t.value, tuple);\n tagTypes.add(typeof t.value);\n });\n }\n const expectedTag = `Expected ${displayList('or', [...tagTypes])}`;\n const type = v\n .unknown()\n .chain((value, options): v.ValitaResult<Known | UnrecognizedTuple> => {\n if (!Array.isArray(value)) {\n return v.err('Expected array');\n }\n const [tag] = value;\n const tuple = byTag.get(tag);\n if (tuple) {\n return tuple.try(value, options) as v.ValitaResult<Known>;\n }\n return tagTypes.has(typeof tag)\n ? v.ok(value as UnrecognizedTuple)\n : v.err({message: expectedTag, path: [0]});\n });\n return Object.assign(type, {\n // A transform serializes as just its name. Show the tuples too, so a\n // change to them still changes the hash in protocol-version.test.ts.\n taggedTupleUnion: tuples,\n isKnown: (value: Known | UnrecognizedTuple): value is Known =>\n byTag.has(value[0]),\n });\n}\n\n/** An object with a tag this build doesn't know, as {@link taggedObjectUnion} parses it. */\nexport type UnrecognizedObject<K extends string> = {\n readonly [P in K]: Unrecognized<Literal>;\n} & {readonly [key: string]: unknown};\n\n/**\n * A union of objects told apart by a literal in their `key` property, their\n * tag, such as `{op: 'queries', id: '1'}`. Unlike `union`, it picks the object\n * by its tag instead of trying each in turn, so a bad object of a known kind\n * fails with that kind's error.\n *\n * With `open`, an object whose tag it doesn't know, but of the same type as a\n * known tag, parses as is, typed as {@link UnrecognizedObject}, so a reader\n * can answer or skip kinds a newer writer added. Use `isKnown` to tell them\n * apart. A closed union is not implemented yet.\n */\nexport function taggedObjectUnion<K extends string, T extends v.ObjectType[]>(\n key: K,\n objects: T,\n options: {readonly open: boolean},\n): v.Type<v.Infer<T[number]> | UnrecognizedObject<K>> & {\n isKnown(\n value: v.Infer<T[number]> | UnrecognizedObject<K>,\n ): value is v.Infer<T[number]>;\n} {\n if (!options.open) {\n throw new Error('A closed taggedObjectUnion is not implemented');\n }\n type Known = v.Infer<T[number]>;\n const byTag = new Map<unknown, v.Type>();\n const tagTypes = new Set<string>();\n for (const object of objects) {\n const tag = object.shape[key] as v.Type | v.Optional | undefined;\n if (tag === undefined) {\n throw new Error(`Expected every object to have ${key}`);\n }\n toTerminals(tag, t => {\n if (t.name !== 'literal') {\n throw new Error('Expected every tag to be a literal');\n }\n if (byTag.has(t.value)) {\n throw new Error(`Duplicate tag ${toDisplay(t.value)}`);\n }\n byTag.set(t.value, object);\n tagTypes.add(typeof t.value);\n });\n }\n const expectedTag = `Expected ${displayList('or', [...tagTypes])}`;\n const tagOf = (value: object): unknown =>\n Object.hasOwn(value, key) ? (value as Record<K, unknown>)[key] : undefined;\n const type = v\n .unknown()\n .chain((value, options): v.ValitaResult<Known | UnrecognizedObject<K>> => {\n if (typeof value !== 'object' || value === null || Array.isArray(value)) {\n return v.err('Expected object');\n }\n const tag = tagOf(value);\n const object = byTag.get(tag);\n if (object) {\n return object.try(value, options) as v.ValitaResult<Known>;\n }\n return tagTypes.has(typeof tag)\n ? v.ok(value as UnrecognizedObject<K>)\n : v.err({message: expectedTag, path: [key]});\n });\n return Object.assign(type, {\n // A transform serializes as just its name. Show the objects too, so a\n // change to them still changes the hash in protocol-version.test.ts.\n taggedObjectUnion: {key, objects},\n isKnown: (value: Known | UnrecognizedObject<K>): value is Known =>\n byTag.has(tagOf(value)),\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,SAAS,UAAU,OAAwB;CACzC,QAAQ,OAAO,OAAf;EACE,KAAK;EACL,KAAK;EACL,KAAK,WACH,OAAO,KAAK,UAAU,KAAK;EAC7B,KAAK,aACH,OAAO;EACT,KAAK,UACH,OAAO,MAAM,SAAS,IAAI;EAC5B;GACE,IAAI,UAAU,MACZ,OAAO;GAET,IAAI,MAAM,QAAQ,KAAK,GACrB,OAAO;GAET,OAAO,OAAO;CAClB;AACF;AAIA,SAAS,gBAAgB,GAAY,MAAiC;CACpE,IAAI,CAAC,MAAM,QACT,OAAO,UAAU,CAAC;CAGpB,IAAI,MAAM;CACV,KAAK,MAAM,KAAK,MAEd,MAAO,IAAY;CAErB,OAAO,UAAU,GAAG;AACtB;AAEA,SAAS,YACP,MACA,UACA,aAAuC,MAAK,OAAO,CAAC,GACnC;CACjB,IAAI,SAAS,WAAW,GACtB,OAAO,UAAU,SAAS,EAAE;CAG9B,MAAM,SAAS,GAAG,UAChB,SAAS,SAAS,SAAS,EAE7B,EAAE,GAAG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AM,2BAAW,IAAI,IAAY;CACjC,KAAK,MAAM,UAAU,SAAS;EAC5B,MAAM,MAAM,OAAO,MAAM;EACzB,IAAI,QAAQ,KAAA,GACV,MAAM,IAAI,MAAM,iCAAiC,KAAK;EAExD,YAAY,MAAK,MAAK;GACpB,IAAI,EAAE,SAAS,WACb,MAAM,IAAI,MAAM,oCAAoC;GAEtD,IAAI,MAAM,IAAI,EAAE,KAAK,GACnB,MAAM,IAAI,MAAM,iBAAiB,UAAU,EAAE,KAAK,GAAG;GAEvD,MAAM,IAAI,EAAE,OAAO,MAAM;GACzB,SAAS,IAAI,OAAO,EAAE,KAAK;EAC7B,CAAC;CACH;CACA,MAAM,cAAc,YAAY,YAAY,MAAM,CAAC,GAAG,QAAQ,CAAC;CAC/D,MAAM,SAAS,UACb,OAAO,OAAO,OAAO,GAAG,IAAK,MAA6B,OAAO,KAAA;CACnE,MAAM,OAAO,EACV,QAAQ,EACR,OAAO,OAAO,YAA2D;EACxE,IAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,MAAM,QAAQ,KAAK,GACpE,OAAO,EAAE,IAAI,iBAAiB;EAEhC,MAAM,MAAM,MAAM,KAAK;EACvB,MAAM,SAAS,MAAM,IAAI,GAAG;EAC5B,IAAI,QACF,OAAO,OAAO,IAAI,OAAO,OAAO;EAElC,OAAO,SAAS,IAAI,OAAO,GAAG,IAC1B,EAAE,GAAG,KAA8B,IACnC,EAAE,IAAI;GAAC,SAAS;GAAa,MAAM,CAAC,GAAG;EAAC,CAAC;CAC/C,CAAC;CACH,OAAO,OAAO,OAAO,MAAM;EAGzB,mBAAmB;GAAC;GAAK;EAAO;EAChC,UAAU,UACR,MAAM,IAAI,MAAM,KAAK,CAAC;CAC1B,CAAC;AACH"}
@@ -1,6 +1,6 @@
1
1
  var package_default = {
2
2
  name: "@rocicorp/zero",
3
- version: "1.11.0-canary.37",
3
+ version: "1.11.0-canary.39",
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" },
@@ -1 +1 @@
1
- {"version":3,"file":"package.js","names":[],"sources":["../../package.json"],"sourcesContent":["{\n \"name\": \"@rocicorp/zero\",\n \"version\": \"1.11.0-canary.37\",\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.5.5\",\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.5\",\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.3\",\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 \"json-custom-numbers\": \"^3.1.1\",\n \"kasi\": \"^1.1.0\",\n \"nanoid\": \"^5.1.2\",\n \"oxfmt\": \"^0.65.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 \"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 \"typescript\": \"~7.0.2\",\n \"vite\": \"^8.0.13\",\n \"vitest\": \"^5.0.0\",\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.11.0\"\n}\n"],"mappings":""}
1
+ {"version":3,"file":"package.js","names":[],"sources":["../../package.json"],"sourcesContent":["{\n \"name\": \"@rocicorp/zero\",\n \"version\": \"1.11.0-canary.39\",\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.5.5\",\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.5\",\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.3\",\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 \"json-custom-numbers\": \"^3.1.1\",\n \"kasi\": \"^1.1.0\",\n \"nanoid\": \"^5.1.2\",\n \"oxfmt\": \"^0.65.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 \"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 \"typescript\": \"~7.0.2\",\n \"vite\": \"^8.0.13\",\n \"vitest\": \"^5.0.0\",\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.11.0\"\n}\n"],"mappings":""}
@@ -1,13 +1,23 @@
1
1
  import type { LogContext } from '@rocicorp/logger';
2
+ import type { AnalyzeQueryResult } from '../../../../zero-protocol/src/analyze-query-result.ts';
2
3
  import type { QueryServerMetrics } from '../../../../zero-protocol/src/inspect-down.ts';
3
- import { type UnparsedInspectUpBody } from '../../../../zero-protocol/src/inspect-up.ts';
4
+ import { type UnparsedInspectUpMessage } from '../../../../zero-protocol/src/inspect-up.ts';
4
5
  import type { NormalizedZeroConfig } from '../../config/normalize.ts';
5
6
  import type { InspectorDelegate } from '../../server/inspector-delegate.ts';
6
7
  import type { ClientHandler } from './client-handler.ts';
7
8
  import type { ConnectionContext } from './connection-context-manager.ts';
8
9
  import type { CVRStore } from './cvr-store.ts';
9
10
  import type { CVRSnapshot } from './cvr.ts';
10
- export declare function handleInspect(lc: LogContext, body: UnparsedInspectUpBody, cvr: CVRSnapshot, client: ClientHandler, inspectorDelegate: InspectorDelegate, clientGroupID: string, authOwner: object, cvrStore: CVRStore, config: NormalizedZeroConfig, ctx: ConnectionContext): Promise<void>;
11
+ export declare function handleInspect(lc: LogContext, body: UnparsedInspectUpMessage[1], cvr: CVRSnapshot, client: ClientHandler, inspectorDelegate: InspectorDelegate, clientGroupID: string, authOwner: object, cvrStore: CVRStore, config: NormalizedZeroConfig, ctx: ConnectionContext): Promise<void>;
12
+ /**
13
+ * Removes the planner's `filter` nodes from `joinPlans` for clients before
14
+ * protocol 53, which added that node type. 1.9 and 1.10 clients fail to parse
15
+ * a node type they don't know, and the failed parse puts the client in its
16
+ * error state.
17
+ *
18
+ * @visibleForTesting
19
+ */
20
+ export declare function analyzeResultForProtocol(result: AnalyzeQueryResult, protocolVersion: number): AnalyzeQueryResult;
11
21
  /**
12
22
  * Converts per-query server metrics to the appropriate wire format based on the
13
23
  * client's protocol version.
@@ -1 +1 @@
1
- {"version":3,"file":"inspect-handler.d.ts","sourceRoot":"","sources":["../../../../../../zero-cache/src/services/view-syncer/inspect-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAKjD,OAAO,KAAK,EACV,kBAAkB,EAEnB,MAAM,+CAA+C,CAAC;AACvD,OAAO,EAEL,KAAK,qBAAqB,EAC3B,MAAM,6CAA6C,CAAC;AAGrD,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,2BAA2B,CAAC;AAMpE,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,oCAAoC,CAAC;AAE1E,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,iCAAiC,CAAC;AACvE,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,UAAU,CAAC;AAE1C,wBAAsB,aAAa,CACjC,EAAE,EAAE,UAAU,EACd,IAAI,EAAE,qBAAqB,EAC3B,GAAG,EAAE,WAAW,EAChB,MAAM,EAAE,aAAa,EACrB,iBAAiB,EAAE,iBAAiB,EACpC,aAAa,EAAE,MAAM,EAGrB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,oBAAoB,EAC5B,GAAG,EAAE,iBAAiB,GACrB,OAAO,CAAC,IAAI,CAAC,CAiJf;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,kBAAkB,GAAG,IAAI,EAClC,eAAe,EAAE,MAAM,GACtB,kBAAkB,GAAG,IAAI,CAmB3B"}
1
+ {"version":3,"file":"inspect-handler.d.ts","sourceRoot":"","sources":["../../../../../../zero-cache/src/services/view-syncer/inspect-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAKjD,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,uDAAuD,CAAC;AAC9F,OAAO,KAAK,EACV,kBAAkB,EAEnB,MAAM,+CAA+C,CAAC;AACvD,OAAO,EAGL,KAAK,wBAAwB,EAC9B,MAAM,6CAA6C,CAAC;AAGrD,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,2BAA2B,CAAC;AAMpE,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,oCAAoC,CAAC;AAE1E,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,iCAAiC,CAAC;AACvE,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,UAAU,CAAC;AAE1C,wBAAsB,aAAa,CACjC,EAAE,EAAE,UAAU,EACd,IAAI,EAAE,wBAAwB,CAAC,CAAC,CAAC,EACjC,GAAG,EAAE,WAAW,EAChB,MAAM,EAAE,aAAa,EACrB,iBAAiB,EAAE,iBAAiB,EACpC,aAAa,EAAE,MAAM,EAGrB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,oBAAoB,EAC5B,GAAG,EAAE,iBAAiB,GACrB,OAAO,CAAC,IAAI,CAAC,CA+Jf;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,kBAAkB,EAC1B,eAAe,EAAE,MAAM,GACtB,kBAAkB,CAUpB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,kBAAkB,GAAG,IAAI,EAClC,eAAe,EAAE,MAAM,GACtB,kBAAkB,GAAG,IAAI,CAmB3B"}
@@ -7,10 +7,19 @@ import { Database } from "../../../../zqlite/src/db.js";
7
7
  import { loadPermissions } from "../../auth/load-permissions.js";
8
8
  import { StatementRunner } from "../../db/statements.js";
9
9
  import { _usingCtx } from "../../../../_virtual/_@oxc-project_runtime@0.130.0/helpers/usingCtx.js";
10
- import { inspectAnalyzeQueryUpSchema } from "../../../../zero-protocol/src/inspect-up.js";
10
+ import { inspectAnalyzeQueryUpSchema, unparsedInspectUpBodySchema } from "../../../../zero-protocol/src/inspect-up.js";
11
11
  import { analyzeQuery } from "../analyze.js";
12
12
  //#region ../zero-cache/src/services/view-syncer/inspect-handler.ts
13
13
  async function handleInspect(lc, body, cvr, client, inspectorDelegate, clientGroupID, authOwner, cvrStore, config, ctx) {
14
+ if (!unparsedInspectUpBodySchema.isKnown(body)) {
15
+ const { id } = body;
16
+ if (typeof id === "string") client.sendInspectResponse(lc, {
17
+ op: "error",
18
+ id,
19
+ value: `Unknown inspector op: ${String(body.op)}`
20
+ });
21
+ return;
22
+ }
14
23
  if (body.op !== "authenticate" && !inspectorDelegate.isAuthenticated(clientGroupID)) {
15
24
  lc.info?.("Client not authenticated to access the inspector protocol. Sending authentication challenge");
16
25
  client.sendInspectResponse(lc, {
@@ -62,7 +71,7 @@ async function handleInspect(lc, body, cvr, client, inspectorDelegate, clientGro
62
71
  break;
63
72
  }
64
73
  case "analyze-query": {
65
- const parsedBody = parse(body, inspectAnalyzeQueryUpSchema);
74
+ const parsedBody = parse(body, inspectAnalyzeQueryUpSchema, "strip");
66
75
  let ast = parsedBody.ast ?? parsedBody.value;
67
76
  let legacyQuery = true;
68
77
  if (parsedBody.name && parsedBody.args) {
@@ -85,7 +94,7 @@ async function handleInspect(lc, body, cvr, client, inspectorDelegate, clientGro
85
94
  client.sendInspectResponse(lc, {
86
95
  op: "analyze-query",
87
96
  id: body.id,
88
- value: result
97
+ value: analyzeResultForProtocol(result, ctx.protocolVersion)
89
98
  });
90
99
  break;
91
100
  }
@@ -101,6 +110,21 @@ async function handleInspect(lc, body, cvr, client, inspectorDelegate, clientGro
101
110
  }
102
111
  }
103
112
  /**
113
+ * Removes the planner's `filter` nodes from `joinPlans` for clients before
114
+ * protocol 53, which added that node type. 1.9 and 1.10 clients fail to parse
115
+ * a node type they don't know, and the failed parse puts the client in its
116
+ * error state.
117
+ *
118
+ * @visibleForTesting
119
+ */
120
+ function analyzeResultForProtocol(result, protocolVersion) {
121
+ if (protocolVersion >= 53 || result.joinPlans === void 0) return result;
122
+ return {
123
+ ...result,
124
+ joinPlans: result.joinPlans.filter((event) => !("nodeType" in event && event.nodeType === "filter"))
125
+ };
126
+ }
127
+ /**
104
128
  * Converts per-query server metrics to the appropriate wire format based on the
105
129
  * client's protocol version.
106
130
  *
@@ -1 +1 @@
1
- {"version":3,"file":"inspect-handler.js","names":[],"sources":["../../../../../../zero-cache/src/services/view-syncer/inspect-handler.ts"],"sourcesContent":["import type {LogContext} from '@rocicorp/logger';\nimport {unreachable} from '../../../../shared/src/asserts.ts';\nimport {must} from '../../../../shared/src/must.ts';\nimport {TDigest} from '../../../../shared/src/tdigest.ts';\nimport * as v from '../../../../shared/src/valita.ts';\nimport type {\n QueryServerMetrics,\n ServerMetrics,\n} from '../../../../zero-protocol/src/inspect-down.ts';\nimport {\n inspectAnalyzeQueryUpSchema,\n type UnparsedInspectUpBody,\n} from '../../../../zero-protocol/src/inspect-up.ts';\nimport {Database} from '../../../../zqlite/src/db.ts';\nimport {loadPermissions} from '../../auth/load-permissions.ts';\nimport type {NormalizedZeroConfig} from '../../config/normalize.ts';\nimport {\n getServerVersion,\n isAdminPasswordValid,\n} from '../../config/zero-config.ts';\nimport {StatementRunner} from '../../db/statements.ts';\nimport type {InspectorDelegate} from '../../server/inspector-delegate.ts';\nimport {analyzeQuery} from '../analyze.ts';\nimport type {ClientHandler} from './client-handler.ts';\nimport type {ConnectionContext} from './connection-context-manager.ts';\nimport type {CVRStore} from './cvr-store.ts';\nimport type {CVRSnapshot} from './cvr.ts';\n\nexport async function handleInspect(\n lc: LogContext,\n body: UnparsedInspectUpBody,\n cvr: CVRSnapshot,\n client: ClientHandler,\n inspectorDelegate: InspectorDelegate,\n clientGroupID: string,\n // The service handling the request, on whose behalf authentication is\n // recorded (see InspectorDelegate.clearAuthenticated).\n authOwner: object,\n cvrStore: CVRStore,\n config: NormalizedZeroConfig,\n ctx: ConnectionContext,\n): Promise<void> {\n // Check if the client is already authenticated. We only authenticate the clientGroup\n // once per \"worker\".\n if (\n body.op !== 'authenticate' &&\n !inspectorDelegate.isAuthenticated(clientGroupID)\n ) {\n lc.info?.(\n 'Client not authenticated to access the inspector protocol. Sending authentication challenge',\n );\n client.sendInspectResponse(lc, {\n op: 'authenticated',\n id: body.id,\n value: false,\n });\n return;\n }\n\n try {\n switch (body.op) {\n case 'queries': {\n const queryRows = await cvrStore.inspectQueries(\n lc,\n cvr.ttlClock,\n body.clientID,\n );\n\n // Enhance query rows with server-side materialization metrics\n const enhancedRows = queryRows.map(row => ({\n ...row,\n ast: row.ast ?? inspectorDelegate.getASTForQuery(row.queryID) ?? null,\n metrics: metricsForProtocol(\n inspectorDelegate.getMetricsJSONForQuery(row.queryID),\n ctx.protocolVersion,\n ),\n }));\n\n client.sendInspectResponse(lc, {\n op: 'queries',\n id: body.id,\n value: enhancedRows,\n });\n break;\n }\n\n case 'metrics': {\n client.sendInspectResponse(lc, {\n op: 'metrics',\n id: body.id,\n value: inspectorDelegate.getMetricsJSON(),\n });\n break;\n }\n\n case 'version':\n client.sendInspectResponse(lc, {\n op: 'version',\n id: body.id,\n value: getServerVersion(config),\n });\n break;\n\n case 'authenticate': {\n const password = body.value;\n const ok = isAdminPasswordValid(lc, config, password);\n if (ok) {\n inspectorDelegate.setAuthenticated(clientGroupID, authOwner);\n } else {\n inspectorDelegate.clearAuthenticated(clientGroupID);\n }\n\n client.sendInspectResponse(lc, {\n op: 'authenticated',\n id: body.id,\n value: ok,\n });\n\n break;\n }\n\n case 'analyze-query': {\n const parsedBody = v.parse(body, inspectAnalyzeQueryUpSchema);\n let ast = parsedBody.ast ?? parsedBody.value;\n let legacyQuery = true;\n\n if (parsedBody.name && parsedBody.args) {\n // Get the AST from the API server by transforming the named query\n ast = await inspectorDelegate.transformCustomQuery(\n parsedBody.name,\n parsedBody.args,\n ctx,\n );\n legacyQuery = false;\n }\n\n if (ast === undefined) {\n throw new Error(\n 'AST is required for analyze-query operation. Either provide an AST directly or ensure custom query transformation is configured.',\n );\n }\n\n let permissions;\n if (legacyQuery) {\n using db = new Database(lc, config.replica.file);\n const dbRunner = new StatementRunner(db);\n const loaded = loadPermissions(lc, dbRunner, config.app.id, config);\n if (loaded.permissions) {\n permissions = loaded.permissions;\n } else {\n lc.info?.(\n 'No permissions loaded; analyze-query will run without applying permissions.',\n );\n }\n }\n\n const result = await analyzeQuery(\n lc,\n config,\n must(cvr.clientSchema),\n ast,\n parsedBody.options?.syncedRows,\n parsedBody.options?.vendedRows,\n permissions,\n ctx.auth?.type === 'jwt' ? ctx.auth : undefined,\n parsedBody.options?.joinPlans,\n );\n client.sendInspectResponse(lc, {\n op: 'analyze-query',\n id: body.id,\n value: result,\n });\n break;\n }\n\n default:\n unreachable(body);\n }\n } catch (e) {\n lc.warn?.('Error handling inspect message', e);\n client.sendInspectResponse(lc, {\n op: 'error',\n id: body.id,\n value: (e as Error).message,\n });\n }\n}\n\n/**\n * Converts per-query server metrics to the appropriate wire format based on the\n * client's protocol version.\n *\n * Protocol >= 51: new format — `query-hydration-server-ms` (plain number) +\n * `query-update-server` (TDigest).\n * Protocol < 51: old format — `query-materialization-server` (TDigest) +\n * `query-update-server` (TDigest). The scalar hydration time is wrapped into a\n * one-point TDigest for backward compatibility.\n *\n * @visibleForTesting\n */\nexport function metricsForProtocol(\n metrics: QueryServerMetrics | null,\n protocolVersion: number,\n): QueryServerMetrics | null {\n if (protocolVersion >= 51 || metrics === null) {\n return metrics;\n }\n // Backward compat: wrap the scalar hydration ms into a one-point TDigest\n // under the old field name so that 1.5 clients can parse the response.\n const hydrateDigest = new TDigest();\n const hydrateMs = metrics['query-hydration-server-ms'];\n if (hydrateMs !== undefined) {\n hydrateDigest.add(hydrateMs);\n }\n const legacyMetrics: ServerMetrics = {\n 'query-materialization-server': hydrateDigest.toJSON(),\n 'query-update-server': metrics['query-update-server'],\n };\n // Cast to QueryServerMetrics: this is intentional — for old-protocol clients\n // we send the legacy ServerMetrics wire shape under the QueryServerMetrics type\n // to satisfy TypeScript while preserving backward compatibility.\n return legacyMetrics as unknown as QueryServerMetrics;\n}\n"],"mappings":";;;;;;;;;;;;AA4BA,eAAsB,cACpB,IACA,MACA,KACA,QACA,mBACA,eAGA,WACA,UACA,QACA,KACe;CAGf,IACE,K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,cAAc;IAChB;IAEA,IAAI,QAAQ,KAAA,GACV,MAAM,IAAI,MACR,kIACF;IAGF,IAAI;IACJ,IAAI,aAAa,IAAA;;KAGf,MAAM,SAAS,gBAAgB,IAAI,IADd,gBAAA,YAAA,EADV,IAAI,SAAS,IAAI,OAAO,QAAQ,IAAI,CACV,CACF,GAAU,OAAO,IAAI,IAAI,MAAM;KAClE,IAAI,OAAO,aACT,cAAc,OAAO;UAErB,GAAG,OACD,6EACF;;;;;;IAIJ,MAAM,SAAS,MAAM,aACnB,IACA,QACA,KAAK,IAAI,YAAY,GACrB,KACA,WAAW,SAAS,YACpB,WAAW,SAAS,YACpB,aACA,IAAI,MAAM,SAAS,QAAQ,IAAI,OAAO,KAAA,GACtC,WAAW,SAAS,SACtB;IACA,OAAO,oBAAoB,IAAI;KAC7B,IAAI;KACJ,IAAI,KAAK;KACT,OAAO;IACT,CAAC;IACD;GACF;GAEA,SACE,YAAY,IAAI;EACpB;CACF,SAAS,GAAG;EACV,GAAG,OAAO,kCAAkC,CAAC;EAC7C,OAAO,oBAAoB,IAAI;GAC7B,IAAI;GACJ,IAAI,KAAK;GACT,OAAQ,EAAY;EACtB,CAAC;CACH;AACF;;;;;;;;;;;;;AAcA,SAAgB,mBACd,SACA,iBAC2B;CAC3B,IAAI,mBAAmB,MAAM,YAAY,MACvC,OAAO;CAIT,MAAM,gBAAgB,IAAI,QAAQ;CAClC,MAAM,YAAY,QAAQ;CAC1B,IAAI,cAAc,KAAA,GAChB,cAAc,IAAI,SAAS;CAS7B,OAAO;EANL,gCAAgC,cAAc,OAAO;EACrD,uBAAuB,QAAQ;CAK1B;AACT"}
1
+ {"version":3,"file":"inspect-handler.js","names":[],"sources":["../../../../../../zero-cache/src/services/view-syncer/inspect-handler.ts"],"sourcesContent":["import type {LogContext} from '@rocicorp/logger';\nimport {unreachable} from '../../../../shared/src/asserts.ts';\nimport {must} from '../../../../shared/src/must.ts';\nimport {TDigest} from '../../../../shared/src/tdigest.ts';\nimport * as v from '../../../../shared/src/valita.ts';\nimport type {AnalyzeQueryResult} from '../../../../zero-protocol/src/analyze-query-result.ts';\nimport type {\n QueryServerMetrics,\n ServerMetrics,\n} from '../../../../zero-protocol/src/inspect-down.ts';\nimport {\n inspectAnalyzeQueryUpSchema,\n unparsedInspectUpBodySchema,\n type UnparsedInspectUpMessage,\n} from '../../../../zero-protocol/src/inspect-up.ts';\nimport {Database} from '../../../../zqlite/src/db.ts';\nimport {loadPermissions} from '../../auth/load-permissions.ts';\nimport type {NormalizedZeroConfig} from '../../config/normalize.ts';\nimport {\n getServerVersion,\n isAdminPasswordValid,\n} from '../../config/zero-config.ts';\nimport {StatementRunner} from '../../db/statements.ts';\nimport type {InspectorDelegate} from '../../server/inspector-delegate.ts';\nimport {analyzeQuery} from '../analyze.ts';\nimport type {ClientHandler} from './client-handler.ts';\nimport type {ConnectionContext} from './connection-context-manager.ts';\nimport type {CVRStore} from './cvr-store.ts';\nimport type {CVRSnapshot} from './cvr.ts';\n\nexport async function handleInspect(\n lc: LogContext,\n body: UnparsedInspectUpMessage[1],\n cvr: CVRSnapshot,\n client: ClientHandler,\n inspectorDelegate: InspectorDelegate,\n clientGroupID: string,\n // The service handling the request, on whose behalf authentication is\n // recorded (see InspectorDelegate.clearAuthenticated).\n authOwner: object,\n cvrStore: CVRStore,\n config: NormalizedZeroConfig,\n ctx: ConnectionContext,\n): Promise<void> {\n if (!unparsedInspectUpBodySchema.isKnown(body)) {\n // An op from a newer client. Answer this request only, so the connection\n // stays up. Nothing is computed for it, so it needs no authentication.\n const {id} = body;\n if (typeof id === 'string') {\n client.sendInspectResponse(lc, {\n op: 'error',\n id,\n value: `Unknown inspector op: ${String(body.op)}`,\n });\n }\n return;\n }\n\n // Check if the client is already authenticated. We only authenticate the clientGroup\n // once per \"worker\".\n if (\n body.op !== 'authenticate' &&\n !inspectorDelegate.isAuthenticated(clientGroupID)\n ) {\n lc.info?.(\n 'Client not authenticated to access the inspector protocol. Sending authentication challenge',\n );\n client.sendInspectResponse(lc, {\n op: 'authenticated',\n id: body.id,\n value: false,\n });\n return;\n }\n\n try {\n switch (body.op) {\n case 'queries': {\n const queryRows = await cvrStore.inspectQueries(\n lc,\n cvr.ttlClock,\n body.clientID,\n );\n\n // Enhance query rows with server-side materialization metrics\n const enhancedRows = queryRows.map(row => ({\n ...row,\n ast: row.ast ?? inspectorDelegate.getASTForQuery(row.queryID) ?? null,\n metrics: metricsForProtocol(\n inspectorDelegate.getMetricsJSONForQuery(row.queryID),\n ctx.protocolVersion,\n ),\n }));\n\n client.sendInspectResponse(lc, {\n op: 'queries',\n id: body.id,\n value: enhancedRows,\n });\n break;\n }\n\n case 'metrics': {\n client.sendInspectResponse(lc, {\n op: 'metrics',\n id: body.id,\n value: inspectorDelegate.getMetricsJSON(),\n });\n break;\n }\n\n case 'version':\n client.sendInspectResponse(lc, {\n op: 'version',\n id: body.id,\n value: getServerVersion(config),\n });\n break;\n\n case 'authenticate': {\n const password = body.value;\n const ok = isAdminPasswordValid(lc, config, password);\n if (ok) {\n inspectorDelegate.setAuthenticated(clientGroupID, authOwner);\n } else {\n inspectorDelegate.clearAuthenticated(clientGroupID);\n }\n\n client.sendInspectResponse(lc, {\n op: 'authenticated',\n id: body.id,\n value: ok,\n });\n\n break;\n }\n\n case 'analyze-query': {\n const parsedBody = v.parse(body, inspectAnalyzeQueryUpSchema, 'strip');\n let ast = parsedBody.ast ?? parsedBody.value;\n let legacyQuery = true;\n\n if (parsedBody.name && parsedBody.args) {\n // Get the AST from the API server by transforming the named query\n ast = await inspectorDelegate.transformCustomQuery(\n parsedBody.name,\n parsedBody.args,\n ctx,\n );\n legacyQuery = false;\n }\n\n if (ast === undefined) {\n throw new Error(\n 'AST is required for analyze-query operation. Either provide an AST directly or ensure custom query transformation is configured.',\n );\n }\n\n let permissions;\n if (legacyQuery) {\n using db = new Database(lc, config.replica.file);\n const dbRunner = new StatementRunner(db);\n const loaded = loadPermissions(lc, dbRunner, config.app.id, config);\n if (loaded.permissions) {\n permissions = loaded.permissions;\n } else {\n lc.info?.(\n 'No permissions loaded; analyze-query will run without applying permissions.',\n );\n }\n }\n\n const result = await analyzeQuery(\n lc,\n config,\n must(cvr.clientSchema),\n ast,\n parsedBody.options?.syncedRows,\n parsedBody.options?.vendedRows,\n permissions,\n ctx.auth?.type === 'jwt' ? ctx.auth : undefined,\n parsedBody.options?.joinPlans,\n );\n client.sendInspectResponse(lc, {\n op: 'analyze-query',\n id: body.id,\n value: analyzeResultForProtocol(result, ctx.protocolVersion),\n });\n break;\n }\n\n default:\n unreachable(body);\n }\n } catch (e) {\n lc.warn?.('Error handling inspect message', e);\n client.sendInspectResponse(lc, {\n op: 'error',\n id: body.id,\n value: (e as Error).message,\n });\n }\n}\n\n/**\n * Removes the planner's `filter` nodes from `joinPlans` for clients before\n * protocol 53, which added that node type. 1.9 and 1.10 clients fail to parse\n * a node type they don't know, and the failed parse puts the client in its\n * error state.\n *\n * @visibleForTesting\n */\nexport function analyzeResultForProtocol(\n result: AnalyzeQueryResult,\n protocolVersion: number,\n): AnalyzeQueryResult {\n if (protocolVersion >= 53 || result.joinPlans === undefined) {\n return result;\n }\n return {\n ...result,\n joinPlans: result.joinPlans.filter(\n event => !('nodeType' in event && event.nodeType === 'filter'),\n ),\n };\n}\n\n/**\n * Converts per-query server metrics to the appropriate wire format based on the\n * client's protocol version.\n *\n * Protocol >= 51: new format — `query-hydration-server-ms` (plain number) +\n * `query-update-server` (TDigest).\n * Protocol < 51: old format — `query-materialization-server` (TDigest) +\n * `query-update-server` (TDigest). The scalar hydration time is wrapped into a\n * one-point TDigest for backward compatibility.\n *\n * @visibleForTesting\n */\nexport function metricsForProtocol(\n metrics: QueryServerMetrics | null,\n protocolVersion: number,\n): QueryServerMetrics | null {\n if (protocolVersion >= 51 || metrics === null) {\n return metrics;\n }\n // Backward compat: wrap the scalar hydration ms into a one-point TDigest\n // under the old field name so that 1.5 clients can parse the response.\n const hydrateDigest = new TDigest();\n const hydrateMs = metrics['query-hydration-server-ms'];\n if (hydrateMs !== undefined) {\n hydrateDigest.add(hydrateMs);\n }\n const legacyMetrics: ServerMetrics = {\n 'query-materialization-server': hydrateDigest.toJSON(),\n 'query-update-server': metrics['query-update-server'],\n };\n // Cast to QueryServerMetrics: this is intentional — for old-protocol clients\n // we send the legacy ServerMetrics wire shape under the QueryServerMetrics type\n // to satisfy TypeScript while preserving backward compatibility.\n return legacyMetrics as unknown as QueryServerMetrics;\n}\n"],"mappings":";;;;;;;;;;;;AA8BA,eAAsB,cACpB,IACA,MACA,KACA,QACA,mBACA,eAGA,WACA,UACA,QACA,KACe;CACf,IAAI,CAAC,4BAA4B,QAAQ,IAAI,GAAG;EAG9C,MAAM,EAAC,OAAM;EACb,IAAI,OAAO,OAAO,UAChB,OAAO,oBAAoB,IAAI;GAC7B,IAAI;GACJ;GACA,OAAO,yBAAyB,OAAO,KAAK,EAAE;EAChD,CAAC;EAEH;CACF;CAIA,IACE,KAAK,OAAO,kBACZ,CAAC,kBAAkB,gBAAgB,aAAa,GAChD;EACA,GAAG,OACD,6FACF;EACA,OAAO,oBAAoB,IAAI;GAC7B,IAAI;GACJ,IAAI,KAAK;GACT,OAAO;EACT,CAAC;EACD;CACF;CAEA,IAAI;EACF,QAAQ,KAAK,IAAb;GACE,KAAK,WAAW;IAQd,MAAM,gBAAe,MAPG,SAAS,eAC/B,IACA,IAAI,UACJ,KAAK,QACP,GAG+B,KAAI,SAAQ;KACzC,GAAG;KACH,KAAK,IAAI,OAAO,kBAAkB,eAAe,IAAI,OAAO,KAAK;KACjE,SAAS,mBACP,kBAAkB,uBAAuB,IAAI,OAAO,GACpD,IAAI,eACN;IACF,EAAE;IAEF,OAAO,oBAAoB,IAAI;KAC7B,IAAI;KACJ,IAAI,KAAK;KACT,OAAO;IACT,CAAC;IACD;GACF;GAEA,KAAK;IACH,OAAO,oBAAoB,IAAI;KAC7B,IAAI;KACJ,IAAI,KAAK;KACT,OAAO,kBAAkB,eAAe;IAC1C,CAAC;IACD;GA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ACV,GAAG,OAAO,kCAAkC,CAAC;EAC7C,OAAO,oBAAoB,IAAI;GAC7B,IAAI;GACJ,IAAI,KAAK;GACT,OAAQ,EAAY;EACtB,CAAC;CACH;AACF;;;;;;;;;AAUA,SAAgB,yBACd,QACA,iBACoB;CACpB,IAAI,mBAAmB,MAAM,OAAO,cAAc,KAAA,GAChD,OAAO;CAET,OAAO;EACL,GAAG;EACH,WAAW,OAAO,UAAU,QAC1B,UAAS,EAAE,cAAc,SAAS,MAAM,aAAa,SACvD;CACF;AACF;;;;;;;;;;;;;AAcA,SAAgB,mBACd,SACA,iBAC2B;CAC3B,IAAI,mBAAmB,MAAM,YAAY,MACvC,OAAO;CAIT,MAAM,gBAAgB,IAAI,QAAQ;CAClC,MAAM,YAAY,QAAQ;CAC1B,IAAI,cAAc,KAAA,GAChB,cAAc,IAAI,SAAS;CAS7B,OAAO;EANL,gCAAgC,cAAc,OAAO;EACrD,uBAAuB,QAAQ;CAK1B;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"view-syncer.d.ts","sourceRoot":"","sources":["../../../../../../zero-cache/src/services/view-syncer/view-syncer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAgBjD,OAAO,KAAK,EAAC,2BAA2B,EAAC,MAAM,yDAAyD,CAAC;AAKzG,OAAO,KAAK,EAEV,qBAAqB,EACtB,MAAM,0CAA0C,CAAC;AAElD,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,iDAAiD,CAAC;AAQ1F,OAAO,KAAK,EAEV,wBAAwB,EACzB,MAAM,6CAA6C,CAAC;AACrD,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,8CAA8C,CAAC;AAGpF,OAAO,EAAkB,KAAK,IAAI,EAAC,MAAM,oBAAoB,CAAC;AAK9D,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EACV,sBAAsB,EAEvB,MA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