@rocicorp/zero 1.11.0-canary.0 → 1.11.0-canary.2
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.
- package/out/replicache/src/btree/read.d.ts +12 -1
- package/out/replicache/src/btree/read.d.ts.map +1 -1
- package/out/replicache/src/btree/read.js +24 -12
- package/out/replicache/src/btree/read.js.map +1 -1
- package/out/replicache/src/db/write.js.map +1 -1
- package/out/replicache/src/replicache-impl.d.ts.map +1 -1
- package/out/replicache/src/replicache-impl.js +10 -0
- package/out/replicache/src/replicache-impl.js.map +1 -1
- package/out/replicache/src/transactions.d.ts.map +1 -1
- package/out/replicache/src/transactions.js +1 -1
- package/out/replicache/src/transactions.js.map +1 -1
- package/out/zero/package.js +1 -1
- package/out/zero/package.js.map +1 -1
- package/out/zero-cache/src/config/zero-config.d.ts +17 -2
- package/out/zero-cache/src/config/zero-config.d.ts.map +1 -1
- package/out/zero-cache/src/config/zero-config.js +86 -26
- package/out/zero-cache/src/config/zero-config.js.map +1 -1
- package/out/zero-cache/src/server/replicator.d.ts.map +1 -1
- package/out/zero-cache/src/server/replicator.js +6 -2
- package/out/zero-cache/src/server/replicator.js.map +1 -1
- package/out/zero-cache/src/server/runner/run-worker.js +1 -1
- package/out/zero-cache/src/services/change-source/common/replica-schema.d.ts.map +1 -1
- package/out/zero-cache/src/services/change-source/common/replica-schema.js +2 -39
- package/out/zero-cache/src/services/change-source/common/replica-schema.js.map +1 -1
- package/out/zero-cache/src/services/change-streamer/change-streamer-http.d.ts +2 -2
- package/out/zero-cache/src/services/change-streamer/change-streamer-http.d.ts.map +1 -1
- package/out/zero-cache/src/services/change-streamer/change-streamer-http.js +2 -2
- package/out/zero-cache/src/services/change-streamer/change-streamer-http.js.map +1 -1
- package/out/zero-cache/src/services/change-streamer/change-streamer.d.ts +6 -6
- package/out/zero-cache/src/services/change-streamer/change-streamer.d.ts.map +1 -1
- package/out/zero-cache/src/services/change-streamer/change-streamer.js.map +1 -1
- package/out/zero-cache/src/services/litestream/commands.d.ts.map +1 -1
- package/out/zero-cache/src/services/litestream/commands.js +8 -3
- package/out/zero-cache/src/services/litestream/commands.js.map +1 -1
- package/out/zero-cache/src/services/litestream/config-v5.yml +13 -1
- package/out/zero-cache/src/services/litestream/litestream-checkpointer.js +104 -0
- package/out/zero-cache/src/services/litestream/litestream-checkpointer.js.map +1 -0
- package/out/zero-cache/src/services/litestream/litestream-controller.d.ts +70 -0
- package/out/zero-cache/src/services/litestream/litestream-controller.d.ts.map +1 -0
- package/out/zero-cache/src/services/litestream/litestream-controller.js +101 -0
- package/out/zero-cache/src/services/litestream/litestream-controller.js.map +1 -0
- package/out/zero-cache/src/services/replicator/change-log-db.js.map +1 -1
- package/out/zero-cache/src/services/replicator/incremental-sync.d.ts.map +1 -1
- package/out/zero-cache/src/services/replicator/incremental-sync.js +23 -5
- package/out/zero-cache/src/services/replicator/incremental-sync.js.map +1 -1
- package/out/zero-cache/src/services/replicator/replicator.js.map +1 -1
- package/out/zero-cache/src/services/replicator/write-worker-client.d.ts +31 -6
- package/out/zero-cache/src/services/replicator/write-worker-client.d.ts.map +1 -1
- package/out/zero-cache/src/services/replicator/write-worker-client.js +5 -4
- package/out/zero-cache/src/services/replicator/write-worker-client.js.map +1 -1
- package/out/zero-cache/src/services/replicator/write-worker.js +30 -5
- package/out/zero-cache/src/services/replicator/write-worker.js.map +1 -1
- package/out/zero-cache/src/types/streams.d.ts +6 -6
- package/out/zero-cache/src/types/streams.d.ts.map +1 -1
- package/out/zero-cache/src/types/streams.js +6 -11
- package/out/zero-cache/src/types/streams.js.map +1 -1
- package/out/zero-cache/src/workers/connection.js +2 -2
- package/out/zero-cache/src/workers/replicator.d.ts +1 -0
- package/out/zero-cache/src/workers/replicator.d.ts.map +1 -1
- package/out/zero-cache/src/workers/replicator.js +4 -2
- package/out/zero-cache/src/workers/replicator.js.map +1 -1
- package/out/zero-client/src/client/context.d.ts +15 -0
- package/out/zero-client/src/client/context.d.ts.map +1 -1
- package/out/zero-client/src/client/context.js +44 -0
- package/out/zero-client/src/client/context.js.map +1 -1
- package/out/zero-client/src/client/inspector/lazy-inspector.js +2 -2
- package/out/zero-client/src/client/inspector/lazy-inspector.js.map +1 -1
- package/out/zero-client/src/client/ivm-branch.js.map +1 -1
- package/out/zero-client/src/client/version.js +1 -1
- package/out/zero-client/src/client/zero-rep.d.ts.map +1 -1
- package/out/zero-client/src/client/zero-rep.js +2 -1
- package/out/zero-client/src/client/zero-rep.js.map +1 -1
- package/out/zero-client/src/client/zero.d.ts.map +1 -1
- package/out/zero-client/src/client/zero.js +50 -13
- package/out/zero-client/src/client/zero.js.map +1 -1
- package/out/zero-protocol/src/analyze-query-result.d.ts +5 -5
- package/out/zero-protocol/src/analyze-query-result.d.ts.map +1 -1
- package/out/zero-protocol/src/analyze-query-result.js +1 -1
- package/out/zero-protocol/src/analyze-query-result.js.map +1 -1
- package/out/zero-protocol/src/down.d.ts +30 -30
- package/out/zero-protocol/src/inspect-down.d.ts +6 -6
- package/out/zero-protocol/src/protocol-version.d.ts +1 -1
- package/out/zero-protocol/src/protocol-version.d.ts.map +1 -1
- package/out/zero-protocol/src/protocol-version.js.map +1 -1
- package/out/zero-react/src/use-query.d.ts.map +1 -1
- package/out/zero-react/src/use-query.js +24 -5
- package/out/zero-react/src/use-query.js.map +1 -1
- package/out/zero-solid/src/use-query.js +4 -1
- package/out/zero-solid/src/use-query.js.map +1 -1
- package/out/zql/src/builder/builder.d.ts.map +1 -1
- package/out/zql/src/builder/builder.js +16 -10
- package/out/zql/src/builder/builder.js.map +1 -1
- package/out/zql/src/ivm/array-view.d.ts.map +1 -1
- package/out/zql/src/ivm/array-view.js +5 -3
- package/out/zql/src/ivm/array-view.js.map +1 -1
- package/out/zql/src/ivm/deferred-input.d.ts +44 -0
- package/out/zql/src/ivm/deferred-input.d.ts.map +1 -0
- package/out/zql/src/ivm/deferred-input.js +88 -0
- package/out/zql/src/ivm/deferred-input.js.map +1 -0
- package/out/zql/src/ivm/filter-operators.d.ts +3 -2
- package/out/zql/src/ivm/filter-operators.d.ts.map +1 -1
- package/out/zql/src/ivm/filter-operators.js +19 -4
- package/out/zql/src/ivm/filter-operators.js.map +1 -1
- package/out/zql/src/ivm/memory-source.d.ts.map +1 -1
- package/out/zql/src/ivm/memory-source.js +22 -14
- package/out/zql/src/ivm/memory-source.js.map +1 -1
- package/out/zql/src/ivm/operator.d.ts +40 -0
- package/out/zql/src/ivm/operator.d.ts.map +1 -1
- package/out/zql/src/ivm/operator.js.map +1 -1
- package/out/zql/src/planner/planner-builder.d.ts.map +1 -1
- package/out/zql/src/planner/planner-builder.js +14 -4
- package/out/zql/src/planner/planner-builder.js.map +1 -1
- package/out/zql/src/planner/planner-connection.d.ts +13 -0
- package/out/zql/src/planner/planner-connection.d.ts.map +1 -1
- package/out/zql/src/planner/planner-connection.js +42 -7
- package/out/zql/src/planner/planner-connection.js.map +1 -1
- package/out/zql/src/planner/planner-debug.d.ts +1 -1
- package/out/zql/src/planner/planner-debug.d.ts.map +1 -1
- package/out/zql/src/planner/planner-debug.js.map +1 -1
- package/out/zql/src/planner/planner-fan-out.d.ts +1 -0
- package/out/zql/src/planner/planner-fan-out.d.ts.map +1 -1
- package/out/zql/src/planner/planner-fan-out.js +3 -0
- package/out/zql/src/planner/planner-fan-out.js.map +1 -1
- package/out/zql/src/planner/planner-filter.d.ts +59 -0
- package/out/zql/src/planner/planner-filter.d.ts.map +1 -0
- package/out/zql/src/planner/planner-filter.js +116 -0
- package/out/zql/src/planner/planner-filter.js.map +1 -0
- package/out/zql/src/planner/planner-graph.d.ts +2 -0
- package/out/zql/src/planner/planner-graph.d.ts.map +1 -1
- package/out/zql/src/planner/planner-graph.js +2 -0
- package/out/zql/src/planner/planner-graph.js.map +1 -1
- package/out/zql/src/planner/planner-join.d.ts +2 -0
- package/out/zql/src/planner/planner-join.d.ts.map +1 -1
- package/out/zql/src/planner/planner-join.js +7 -0
- package/out/zql/src/planner/planner-join.js.map +1 -1
- package/out/zql/src/planner/planner-node.d.ts +2 -1
- package/out/zql/src/planner/planner-node.d.ts.map +1 -1
- package/out/zql/src/planner/planner-node.js.map +1 -1
- package/out/zql/src/query/query-delegate-base.d.ts +6 -0
- package/out/zql/src/query/query-delegate-base.d.ts.map +1 -1
- package/out/zql/src/query/query-delegate-base.js +73 -10
- package/out/zql/src/query/query-delegate-base.js.map +1 -1
- package/out/zql/src/query/query-delegate.d.ts +22 -0
- package/out/zql/src/query/query-delegate.d.ts.map +1 -1
- package/out/zql/src/query/query-impl.d.ts +12 -11
- package/out/zql/src/query/query-impl.d.ts.map +1 -1
- package/out/zql/src/query/query-impl.js +383 -60
- package/out/zql/src/query/query-impl.js.map +1 -1
- package/out/zql/src/query/query-transitions.d.ts +171 -0
- package/out/zql/src/query/query-transitions.d.ts.map +1 -0
- package/out/zql/src/query/query-transitions.js +207 -0
- package/out/zql/src/query/query-transitions.js.map +1 -0
- package/out/zql/src/query/runnable-query-impl.d.ts.map +1 -1
- package/out/zql/src/query/runnable-query-impl.js +21 -1
- package/out/zql/src/query/runnable-query-impl.js.map +1 -1
- package/out/zqlite/src/query-builder.d.ts +1 -1
- package/out/zqlite/src/query-builder.d.ts.map +1 -1
- package/out/zqlite/src/query-builder.js +2 -1
- package/out/zqlite/src/query-builder.js.map +1 -1
- package/out/zqlite/src/sqlite-cost-model.d.ts.map +1 -1
- package/out/zqlite/src/sqlite-cost-model.js +2 -30
- package/out/zqlite/src/sqlite-cost-model.js.map +1 -1
- package/out/zqlite/src/table-source.d.ts.map +1 -1
- package/out/zqlite/src/table-source.js +10 -3
- package/out/zqlite/src/table-source.js.map +1 -1
- package/package.json +1 -1
|
@@ -37,7 +37,7 @@ declare const bestPlanSelectedEventJSONSchema: v.ObjectType<{
|
|
|
37
37
|
declare const nodeConstraintEventJSONSchema: v.ObjectType<{
|
|
38
38
|
type: v.Type<"node-constraint">;
|
|
39
39
|
attemptNumber: v.Optional<number>;
|
|
40
|
-
nodeType: v.UnionType<[v.Type<"connection">, v.Type<"join">, v.Type<"fan-out">, v.Type<"fan-in">, v.Type<"terminus">]>;
|
|
40
|
+
nodeType: v.UnionType<[v.Type<"connection">, v.Type<"join">, v.Type<"fan-out">, v.Type<"fan-in">, v.Type<"filter">, v.Type<"terminus">]>;
|
|
41
41
|
node: v.Type<string>;
|
|
42
42
|
branchPattern: v.ArrayType<v.Type<number>>;
|
|
43
43
|
constraint: v.Optional<Record<string, unknown> | null>;
|
|
@@ -118,7 +118,7 @@ declare const planDebugEventJSONSchema: v.UnionType<[v.ObjectType<{
|
|
|
118
118
|
}, undefined>, v.ObjectType<{
|
|
119
119
|
type: v.Type<"node-cost">;
|
|
120
120
|
attemptNumber: v.Optional<number>;
|
|
121
|
-
nodeType: v.UnionType<[v.Type<"connection">, v.Type<"join">, v.Type<"fan-out">, v.Type<"fan-in">, v.Type<"terminus">]>;
|
|
121
|
+
nodeType: v.UnionType<[v.Type<"connection">, v.Type<"join">, v.Type<"fan-out">, v.Type<"fan-in">, v.Type<"filter">, v.Type<"terminus">]>;
|
|
122
122
|
node: v.Type<string>;
|
|
123
123
|
branchPattern: v.ArrayType<v.Type<number>>;
|
|
124
124
|
downstreamChildSelectivity: v.Type<number>;
|
|
@@ -136,7 +136,7 @@ declare const planDebugEventJSONSchema: v.UnionType<[v.ObjectType<{
|
|
|
136
136
|
}, undefined>, v.ObjectType<{
|
|
137
137
|
type: v.Type<"node-constraint">;
|
|
138
138
|
attemptNumber: v.Optional<number>;
|
|
139
|
-
nodeType: v.UnionType<[v.Type<"connection">, v.Type<"join">, v.Type<"fan-out">, v.Type<"fan-in">, v.Type<"terminus">]>;
|
|
139
|
+
nodeType: v.UnionType<[v.Type<"connection">, v.Type<"join">, v.Type<"fan-out">, v.Type<"fan-in">, v.Type<"filter">, v.Type<"terminus">]>;
|
|
140
140
|
node: v.Type<string>;
|
|
141
141
|
branchPattern: v.ArrayType<v.Type<number>>;
|
|
142
142
|
constraint: v.Optional<Record<string, unknown> | null>;
|
|
@@ -237,7 +237,7 @@ export declare const analyzeQueryResultSchema: v.ObjectType<{
|
|
|
237
237
|
} | {
|
|
238
238
|
type: "node-cost";
|
|
239
239
|
attemptNumber?: number | undefined;
|
|
240
|
-
nodeType: "connection" | "fan-in" | "fan-out" | "join" | "terminus";
|
|
240
|
+
nodeType: "connection" | "fan-in" | "fan-out" | "filter" | "join" | "terminus";
|
|
241
241
|
node: string;
|
|
242
242
|
branchPattern: number[];
|
|
243
243
|
downstreamChildSelectivity: number;
|
|
@@ -255,7 +255,7 @@ export declare const analyzeQueryResultSchema: v.ObjectType<{
|
|
|
255
255
|
} | {
|
|
256
256
|
type: "node-constraint";
|
|
257
257
|
attemptNumber?: number | undefined;
|
|
258
|
-
nodeType: "connection" | "fan-in" | "fan-out" | "join" | "terminus";
|
|
258
|
+
nodeType: "connection" | "fan-in" | "fan-out" | "filter" | "join" | "terminus";
|
|
259
259
|
node: string;
|
|
260
260
|
branchPattern: number[];
|
|
261
261
|
constraint?: Record<string, unknown> | null | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analyze-query-result.d.ts","sourceRoot":"","sources":["../../../../zero-protocol/src/analyze-query-result.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,4BAA4B,CAAC;AAKhD,eAAO,MAAM,sBAAsB,gCAAuB,CAAC;AAC3D,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE,eAAO,MAAM,uBAAuB,gDAAmC,CAAC;AACxE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE,eAAO,MAAM,iBAAiB,+EAA+B,CAAC;AAC9D,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,eAAO,MAAM,kBAAkB,+FAA8B,CAAC;AAC9D,MAAM,MAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAU7B,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,OAAO,EACL,2BAA2B,EAC3B,iCAAiC,EACjC,yBAAyB,EACzB,+BAA+B,EAC/B,6BAA6B,GAC9B,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;;;IAKnC,8CAA8C;;;;IAI9C,2CAA2C;;IAE3C,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAQ/B,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
|
|
@@ -74,7 +74,7 @@ var bestPlanSelectedEventJSONSchema = valita_exports.object({
|
|
|
74
74
|
type: joinTypeSchema
|
|
75
75
|
}))
|
|
76
76
|
});
|
|
77
|
-
var nodeTypeSchema = valita_exports.union(valita_exports.literal("connection"), valita_exports.literal("join"), valita_exports.literal("fan-out"), valita_exports.literal("fan-in"), valita_exports.literal("terminus"));
|
|
77
|
+
var nodeTypeSchema = valita_exports.union(valita_exports.literal("connection"), valita_exports.literal("join"), valita_exports.literal("fan-out"), valita_exports.literal("fan-in"), valita_exports.literal("filter"), valita_exports.literal("terminus"));
|
|
78
78
|
var nodeCostEventJSONSchema = valita_exports.object({
|
|
79
79
|
type: valita_exports.literal("node-cost"),
|
|
80
80
|
attemptNumber: valita_exports.number().optional(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analyze-query-result.js","names":[],"sources":["../../../../zero-protocol/src/analyze-query-result.ts"],"sourcesContent":["import * as v from '../../shared/src/valita.ts';\n\nimport {conditionSchema, orderingSchema} from './ast.ts';\nimport {rowSchema} from './data.ts';\n\nexport const rowCountsByQuerySchema = v.record(v.number());\nexport type RowCountsByQuery = v.Infer<typeof rowCountsByQuerySchema>;\n\nexport const rowCountsBySourceSchema = v.record(rowCountsByQuerySchema);\nexport type RowCountsBySource = v.Infer<typeof rowCountsBySourceSchema>;\n\nexport const rowsByQuerySchema = v.record(v.array(rowSchema));\nexport type RowsByQuery = v.Infer<typeof rowsByQuerySchema>;\n\nexport const rowsBySourceSchema = v.record(rowsByQuerySchema);\nexport type RowsBySource = v.Infer<typeof rowsBySourceSchema>;\n\n// Planner debug event schemas\n\nconst costEstimateJSONSchema = v.object({\n startupCost: v.number(),\n scanEst: v.number(),\n cost: v.number(),\n returnedRows: v.number(),\n selectivity: v.number(),\n limit: v.number().optional(),\n});\n\nconst plannerConstraintSchema = v.record(v.union(v.unknown(), v.null()));\n\nconst attemptStartEventJSONSchema = v.object({\n type: v.literal('attempt-start'),\n attemptNumber: v.number(),\n totalAttempts: v.number(),\n});\n\nconst connectionCostsEventJSONSchema = v.object({\n type: v.literal('connection-costs'),\n attemptNumber: v.number(),\n costs: v.array(\n v.object({\n connection: v.string(),\n cost: v.number(),\n costEstimate: costEstimateJSONSchema,\n pinned: v.boolean(),\n constraints: v.record(v.union(plannerConstraintSchema, v.null())),\n constraintCosts: v.record(costEstimateJSONSchema),\n }),\n ),\n});\n\nconst connectionSelectedEventJSONSchema = v.object({\n type: v.literal('connection-selected'),\n attemptNumber: v.number(),\n connection: v.string(),\n cost: v.number(),\n isRoot: v.boolean(),\n});\n\nconst constraintsPropagatedEventJSONSchema = v.object({\n type: v.literal('constraints-propagated'),\n attemptNumber: v.number(),\n connectionConstraints: v.array(\n v.object({\n connection: v.string(),\n constraints: v.record(v.union(plannerConstraintSchema, v.null())),\n constraintCosts: v.record(costEstimateJSONSchema),\n }),\n ),\n});\n\nconst joinTypeSchema = v.union(\n v.literal('semi'),\n v.literal('flipped'),\n v.literal('unflippable'),\n);\n\nconst planCompleteEventJSONSchema = v.object({\n type: v.literal('plan-complete'),\n attemptNumber: v.number(),\n totalCost: v.number(),\n flipPattern: v.number(),\n joinStates: v.array(\n v.object({\n join: v.string(),\n type: joinTypeSchema,\n }),\n ),\n});\n\nconst planFailedEventJSONSchema = v.object({\n type: v.literal('plan-failed'),\n attemptNumber: v.number(),\n reason: v.string(),\n});\n\nconst bestPlanSelectedEventJSONSchema = v.object({\n type: v.literal('best-plan-selected'),\n bestAttemptNumber: v.number(),\n totalCost: v.number(),\n flipPattern: v.number(),\n joinStates: v.array(\n v.object({\n join: v.string(),\n type: joinTypeSchema,\n }),\n ),\n});\n\nconst nodeTypeSchema = v.union(\n v.literal('connection'),\n v.literal('join'),\n v.literal('fan-out'),\n v.literal('fan-in'),\n v.literal('terminus'),\n);\n\nconst nodeCostEventJSONSchema = v.object({\n type: v.literal('node-cost'),\n attemptNumber: v.number().optional(),\n nodeType: nodeTypeSchema,\n node: v.string(),\n branchPattern: v.array(v.number()),\n downstreamChildSelectivity: v.number(),\n costEstimate: costEstimateJSONSchema,\n filters: conditionSchema.optional(),\n ordering: orderingSchema.optional(),\n joinType: joinTypeSchema.optional(),\n});\n\nconst nodeConstraintEventJSONSchema = v.object({\n type: v.literal('node-constraint'),\n attemptNumber: v.number().optional(),\n nodeType: nodeTypeSchema,\n node: v.string(),\n branchPattern: v.array(v.number()),\n constraint: v.union(plannerConstraintSchema, v.null()).optional(),\n from: v.string(),\n});\n\nconst planDebugEventJSONSchema = v.union(\n attemptStartEventJSONSchema,\n connectionCostsEventJSONSchema,\n connectionSelectedEventJSONSchema,\n constraintsPropagatedEventJSONSchema,\n planCompleteEventJSONSchema,\n planFailedEventJSONSchema,\n bestPlanSelectedEventJSONSchema,\n nodeCostEventJSONSchema,\n nodeConstraintEventJSONSchema,\n);\n\nexport type PlanDebugEventJSON = v.Infer<typeof planDebugEventJSONSchema>;\n\nexport {\n attemptStartEventJSONSchema,\n connectionSelectedEventJSONSchema,\n planFailedEventJSONSchema,\n bestPlanSelectedEventJSONSchema,\n nodeConstraintEventJSONSchema,\n};\n\nexport const analyzeQueryResultSchema = v.object({\n warnings: v.array(v.string()),\n syncedRows: v.record(v.array(rowSchema)).optional(),\n syncedRowCount: v.number(),\n start: v.number(),\n /** @deprecated Use start + elapsed instead */\n end: v.number(),\n elapsed: v.number().optional(),\n afterPermissions: v.string().optional(),\n /** @deprecated Use readRowCountsByQuery */\n vendedRowCounts: rowCountsBySourceSchema.optional(),\n /** @deprecated Use readRows */\n vendedRows: rowsBySourceSchema.optional(),\n sqlitePlans: v.record(v.array(v.string())).optional(),\n readRows: rowsBySourceSchema.optional(),\n readRowCountsByQuery: rowCountsBySourceSchema.optional(),\n readRowCount: v.number().optional(),\n dbScansByQuery: rowCountsBySourceSchema.optional(),\n joinPlans: v.array(planDebugEventJSONSchema).optional(),\n});\n\nexport type AnalyzeQueryResult = v.Infer<typeof analyzeQueryResultSchema>;\n"],"mappings":";;;;AAKA,IAAa,yBAAyB,eAAE,OAAO,eAAE,OAAO,CAAC;AAGzD,IAAa,0BAA0B,eAAE,OAAO,sBAAsB;AAGtE,IAAa,oBAAoB,eAAE,OAAO,eAAE,MAAM,SAAS,CAAC;AAG5D,IAAa,qBAAqB,eAAE,OAAO,iBAAiB;AAK5D,IAAM,yBAAyB,eAAE,OAAO;CACtC,aAAa,eAAE,OAAO;CACtB,SAAS,eAAE,OAAO;CAClB,MAAM,eAAE,OAAO;CACf,cAAc,eAAE,OAAO;CACvB,aAAa,eAAE,OAAO;CACtB,OAAO,eAAE,OAAO,EAAE,SAAS;AAC7B,CAAC;AAED,IAAM,0BAA0B,eAAE,OAAO,eAAE,MAAM,eAAE,QAAQ,GAAG,eAAE,KAAK,CAAC,CAAC;AAEvE,IAAM,8BAA8B,eAAE,OAAO;CAC3C,MAAM,eAAE,QAAQ,eAAe;CAC/B,eAAe,eAAE,OAAO;CACxB,eAAe,eAAE,OAAO;AAC1B,CAAC;AAED,IAAM,iCAAiC,eAAE,OAAO;CAC9C,MAAM,eAAE,QAAQ,kBAAkB;CAClC,eAAe,eAAE,OAA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,OAAO,EAAE,SAAS;CAC7B,kBAAkB,eAAE,OAAO,EAAE,SAAS;;CAEtC,iBAAiB,wBAAwB,SAAS;;CAElD,YAAY,mBAAmB,SAAS;CACxC,aAAa,eAAE,OAAO,eAAE,MAAM,eAAE,OAAO,CAAC,CAAC,EAAE,SAAS;CACpD,UAAU,mBAAmB,SAAS;CACtC,sBAAsB,wBAAwB,SAAS;CACvD,cAAc,eAAE,OAAO,EAAE,SAAS;CAClC,gBAAgB,wBAAwB,SAAS;CACjD,WAAW,eAAE,MAAM,wBAAwB,EAAE,SAAS;AACxD,CAAC"}
|
|
1
|
+
{"version":3,"file":"analyze-query-result.js","names":[],"sources":["../../../../zero-protocol/src/analyze-query-result.ts"],"sourcesContent":["import * as v from '../../shared/src/valita.ts';\n\nimport {conditionSchema, orderingSchema} from './ast.ts';\nimport {rowSchema} from './data.ts';\n\nexport const rowCountsByQuerySchema = v.record(v.number());\nexport type RowCountsByQuery = v.Infer<typeof rowCountsByQuerySchema>;\n\nexport const rowCountsBySourceSchema = v.record(rowCountsByQuerySchema);\nexport type RowCountsBySource = v.Infer<typeof rowCountsBySourceSchema>;\n\nexport const rowsByQuerySchema = v.record(v.array(rowSchema));\nexport type RowsByQuery = v.Infer<typeof rowsByQuerySchema>;\n\nexport const rowsBySourceSchema = v.record(rowsByQuerySchema);\nexport type RowsBySource = v.Infer<typeof rowsBySourceSchema>;\n\n// Planner debug event schemas\n\nconst costEstimateJSONSchema = v.object({\n startupCost: v.number(),\n scanEst: v.number(),\n cost: v.number(),\n returnedRows: v.number(),\n selectivity: v.number(),\n limit: v.number().optional(),\n});\n\nconst plannerConstraintSchema = v.record(v.union(v.unknown(), v.null()));\n\nconst attemptStartEventJSONSchema = v.object({\n type: v.literal('attempt-start'),\n attemptNumber: v.number(),\n totalAttempts: v.number(),\n});\n\nconst connectionCostsEventJSONSchema = v.object({\n type: v.literal('connection-costs'),\n attemptNumber: v.number(),\n costs: v.array(\n v.object({\n connection: v.string(),\n cost: v.number(),\n costEstimate: costEstimateJSONSchema,\n pinned: v.boolean(),\n constraints: v.record(v.union(plannerConstraintSchema, v.null())),\n constraintCosts: v.record(costEstimateJSONSchema),\n }),\n ),\n});\n\nconst connectionSelectedEventJSONSchema = v.object({\n type: v.literal('connection-selected'),\n attemptNumber: v.number(),\n connection: v.string(),\n cost: v.number(),\n isRoot: v.boolean(),\n});\n\nconst constraintsPropagatedEventJSONSchema = v.object({\n type: v.literal('constraints-propagated'),\n attemptNumber: v.number(),\n connectionConstraints: v.array(\n v.object({\n connection: v.string(),\n constraints: v.record(v.union(plannerConstraintSchema, v.null())),\n constraintCosts: v.record(costEstimateJSONSchema),\n }),\n ),\n});\n\nconst joinTypeSchema = v.union(\n v.literal('semi'),\n v.literal('flipped'),\n v.literal('unflippable'),\n);\n\nconst planCompleteEventJSONSchema = v.object({\n type: v.literal('plan-complete'),\n attemptNumber: v.number(),\n totalCost: v.number(),\n flipPattern: v.number(),\n joinStates: v.array(\n v.object({\n join: v.string(),\n type: joinTypeSchema,\n }),\n ),\n});\n\nconst planFailedEventJSONSchema = v.object({\n type: v.literal('plan-failed'),\n attemptNumber: v.number(),\n reason: v.string(),\n});\n\nconst bestPlanSelectedEventJSONSchema = v.object({\n type: v.literal('best-plan-selected'),\n bestAttemptNumber: v.number(),\n totalCost: v.number(),\n flipPattern: v.number(),\n joinStates: v.array(\n v.object({\n join: v.string(),\n type: joinTypeSchema,\n }),\n ),\n});\n\nconst nodeTypeSchema = v.union(\n v.literal('connection'),\n v.literal('join'),\n v.literal('fan-out'),\n v.literal('fan-in'),\n v.literal('filter'),\n v.literal('terminus'),\n);\n\nconst nodeCostEventJSONSchema = v.object({\n type: v.literal('node-cost'),\n attemptNumber: v.number().optional(),\n nodeType: nodeTypeSchema,\n node: v.string(),\n branchPattern: v.array(v.number()),\n downstreamChildSelectivity: v.number(),\n costEstimate: costEstimateJSONSchema,\n filters: conditionSchema.optional(),\n ordering: orderingSchema.optional(),\n joinType: joinTypeSchema.optional(),\n});\n\nconst nodeConstraintEventJSONSchema = v.object({\n type: v.literal('node-constraint'),\n attemptNumber: v.number().optional(),\n nodeType: nodeTypeSchema,\n node: v.string(),\n branchPattern: v.array(v.number()),\n constraint: v.union(plannerConstraintSchema, v.null()).optional(),\n from: v.string(),\n});\n\nconst planDebugEventJSONSchema = v.union(\n attemptStartEventJSONSchema,\n connectionCostsEventJSONSchema,\n connectionSelectedEventJSONSchema,\n constraintsPropagatedEventJSONSchema,\n planCompleteEventJSONSchema,\n planFailedEventJSONSchema,\n bestPlanSelectedEventJSONSchema,\n nodeCostEventJSONSchema,\n nodeConstraintEventJSONSchema,\n);\n\nexport type PlanDebugEventJSON = v.Infer<typeof planDebugEventJSONSchema>;\n\nexport {\n attemptStartEventJSONSchema,\n connectionSelectedEventJSONSchema,\n planFailedEventJSONSchema,\n bestPlanSelectedEventJSONSchema,\n nodeConstraintEventJSONSchema,\n};\n\nexport const analyzeQueryResultSchema = v.object({\n warnings: v.array(v.string()),\n syncedRows: v.record(v.array(rowSchema)).optional(),\n syncedRowCount: v.number(),\n start: v.number(),\n /** @deprecated Use start + elapsed instead */\n end: v.number(),\n elapsed: v.number().optional(),\n afterPermissions: v.string().optional(),\n /** @deprecated Use readRowCountsByQuery */\n vendedRowCounts: rowCountsBySourceSchema.optional(),\n /** @deprecated Use readRows */\n vendedRows: rowsBySourceSchema.optional(),\n sqlitePlans: v.record(v.array(v.string())).optional(),\n readRows: rowsBySourceSchema.optional(),\n readRowCountsByQuery: rowCountsBySourceSchema.optional(),\n readRowCount: v.number().optional(),\n dbScansByQuery: rowCountsBySourceSchema.optional(),\n joinPlans: v.array(planDebugEventJSONSchema).optional(),\n});\n\nexport type AnalyzeQueryResult = v.Infer<typeof analyzeQueryResultSchema>;\n"],"mappings":";;;;AAKA,IAAa,yBAAyB,eAAE,OAAO,eAAE,OAAO,CAAC;AAGzD,IAAa,0BAA0B,eAAE,OAAO,sBAAsB;AAGtE,IAAa,oBAAoB,eAAE,OAAO,eA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AC;AAED,IAAM,gCAAgC,eAAE,OAAO;CAC7C,MAAM,eAAE,QAAQ,iBAAiB;CACjC,eAAe,eAAE,OAAO,EAAE,SAAS;CACnC,UAAU;CACV,MAAM,eAAE,OAAO;CACf,eAAe,eAAE,MAAM,eAAE,OAAO,CAAC;CACjC,YAAY,eAAE,MAAM,yBAAyB,eAAE,KAAK,CAAC,EAAE,SAAS;CAChE,MAAM,eAAE,OAAO;AACjB,CAAC;AAED,IAAM,2BAA2B,eAAE,MACjC,6BACA,gCACA,mCACA,sCACA,6BACA,2BACA,iCACA,yBACA,6BACF;AAYA,IAAa,2BAA2B,eAAE,OAAO;CAC/C,UAAU,eAAE,MAAM,eAAE,OAAO,CAAC;CAC5B,YAAY,eAAE,OAAO,eAAE,MAAM,SAAS,CAAC,EAAE,SAAS;CAClD,gBAAgB,eAAE,OAAO;CACzB,OAAO,eAAE,OAAO;;CAEhB,KAAK,eAAE,OAAO;CACd,SAAS,eAAE,OAAO,EAAE,SAAS;CAC7B,kBAAkB,eAAE,OAAO,EAAE,SAAS;;CAEtC,iBAAiB,wBAAwB,SAAS;;CAElD,YAAY,mBAAmB,SAAS;CACxC,aAAa,eAAE,OAAO,eAAE,MAAM,eAAE,OAAO,CAAC,CAAC,EAAE,SAAS;CACpD,UAAU,mBAAmB,SAAS;CACtC,sBAAsB,wBAAwB,SAAS;CACvD,cAAc,eAAE,OAAO,EAAE,SAAS;CAClC,gBAAgB,wBAAwB,SAAS;CACjD,WAAW,eAAE,MAAM,wBAAwB,EAAE,SAAS;AACxD,CAAC"}
|
|
@@ -57,14 +57,14 @@ export declare const downstreamSchema: v.UnionType<[v.TupleType<[v.Type<"connect
|
|
|
57
57
|
clientID: string;
|
|
58
58
|
};
|
|
59
59
|
result: {
|
|
60
|
-
data?: import("../../shared/src/json.ts").ReadonlyJSONValue | undefined;
|
|
61
|
-
} | {
|
|
62
60
|
error: "app";
|
|
63
61
|
message?: string | undefined;
|
|
64
62
|
details?: import("../../shared/src/json.ts").ReadonlyJSONValue | undefined;
|
|
65
63
|
} | {
|
|
66
64
|
error: "alreadyProcessed" | "oooMutation";
|
|
67
65
|
details?: import("../../shared/src/json.ts").ReadonlyJSONValue | undefined;
|
|
66
|
+
} | {
|
|
67
|
+
data?: import("../../shared/src/json.ts").ReadonlyJSONValue | undefined;
|
|
68
68
|
};
|
|
69
69
|
};
|
|
70
70
|
} | {
|
|
@@ -191,33 +191,6 @@ export declare const downstreamSchema: v.UnionType<[v.TupleType<[v.Type<"connect
|
|
|
191
191
|
type: "attempt-start";
|
|
192
192
|
attemptNumber: number;
|
|
193
193
|
totalAttempts: number;
|
|
194
|
-
} | {
|
|
195
|
-
type: "connection-selected";
|
|
196
|
-
attemptNumber: number;
|
|
197
|
-
connection: string;
|
|
198
|
-
cost: number;
|
|
199
|
-
isRoot: boolean;
|
|
200
|
-
} | {
|
|
201
|
-
type: "plan-failed";
|
|
202
|
-
attemptNumber: number;
|
|
203
|
-
reason: string;
|
|
204
|
-
} | {
|
|
205
|
-
type: "best-plan-selected";
|
|
206
|
-
bestAttemptNumber: number;
|
|
207
|
-
totalCost: number;
|
|
208
|
-
flipPattern: number;
|
|
209
|
-
joinStates: {
|
|
210
|
-
join: string;
|
|
211
|
-
type: "flipped" | "semi" | "unflippable";
|
|
212
|
-
}[];
|
|
213
|
-
} | {
|
|
214
|
-
type: "node-constraint";
|
|
215
|
-
attemptNumber?: number | undefined;
|
|
216
|
-
nodeType: "connection" | "fan-in" | "fan-out" | "join" | "terminus";
|
|
217
|
-
node: string;
|
|
218
|
-
branchPattern: number[];
|
|
219
|
-
constraint?: Record<string, unknown> | null | undefined;
|
|
220
|
-
from: string;
|
|
221
194
|
} | {
|
|
222
195
|
type: "connection-costs";
|
|
223
196
|
attemptNumber: number;
|
|
@@ -243,6 +216,12 @@ export declare const downstreamSchema: v.UnionType<[v.TupleType<[v.Type<"connect
|
|
|
243
216
|
limit?: number | undefined;
|
|
244
217
|
}>;
|
|
245
218
|
}[];
|
|
219
|
+
} | {
|
|
220
|
+
type: "connection-selected";
|
|
221
|
+
attemptNumber: number;
|
|
222
|
+
connection: string;
|
|
223
|
+
cost: number;
|
|
224
|
+
isRoot: boolean;
|
|
246
225
|
} | {
|
|
247
226
|
type: "constraints-propagated";
|
|
248
227
|
attemptNumber: number;
|
|
@@ -267,10 +246,23 @@ export declare const downstreamSchema: v.UnionType<[v.TupleType<[v.Type<"connect
|
|
|
267
246
|
join: string;
|
|
268
247
|
type: "flipped" | "semi" | "unflippable";
|
|
269
248
|
}[];
|
|
249
|
+
} | {
|
|
250
|
+
type: "plan-failed";
|
|
251
|
+
attemptNumber: number;
|
|
252
|
+
reason: string;
|
|
253
|
+
} | {
|
|
254
|
+
type: "best-plan-selected";
|
|
255
|
+
bestAttemptNumber: number;
|
|
256
|
+
totalCost: number;
|
|
257
|
+
flipPattern: number;
|
|
258
|
+
joinStates: {
|
|
259
|
+
join: string;
|
|
260
|
+
type: "flipped" | "semi" | "unflippable";
|
|
261
|
+
}[];
|
|
270
262
|
} | {
|
|
271
263
|
type: "node-cost";
|
|
272
264
|
attemptNumber?: number | undefined;
|
|
273
|
-
nodeType: "connection" | "fan-in" | "fan-out" | "join" | "terminus";
|
|
265
|
+
nodeType: "connection" | "fan-in" | "fan-out" | "filter" | "join" | "terminus";
|
|
274
266
|
node: string;
|
|
275
267
|
branchPattern: number[];
|
|
276
268
|
downstreamChildSelectivity: number;
|
|
@@ -285,6 +277,14 @@ export declare const downstreamSchema: v.UnionType<[v.TupleType<[v.Type<"connect
|
|
|
285
277
|
filters?: import("./ast.ts").Condition | undefined;
|
|
286
278
|
ordering?: readonly (readonly [string, "asc" | "desc"])[] | undefined;
|
|
287
279
|
joinType?: "flipped" | "semi" | "unflippable" | undefined;
|
|
280
|
+
} | {
|
|
281
|
+
type: "node-constraint";
|
|
282
|
+
attemptNumber?: number | undefined;
|
|
283
|
+
nodeType: "connection" | "fan-in" | "fan-out" | "filter" | "join" | "terminus";
|
|
284
|
+
node: string;
|
|
285
|
+
branchPattern: number[];
|
|
286
|
+
constraint?: Record<string, unknown> | null | undefined;
|
|
287
|
+
from: string;
|
|
288
288
|
})[]>;
|
|
289
289
|
}, undefined>;
|
|
290
290
|
}, undefined>, v.ObjectType<Omit<{
|
|
@@ -122,7 +122,7 @@ export declare const inspectAnalyzeQueryDownSchema: v.ObjectType<Omit<{
|
|
|
122
122
|
} | {
|
|
123
123
|
type: "node-constraint";
|
|
124
124
|
attemptNumber?: number | undefined;
|
|
125
|
-
nodeType: "connection" | "fan-in" | "fan-out" | "join" | "terminus";
|
|
125
|
+
nodeType: "connection" | "fan-in" | "fan-out" | "filter" | "join" | "terminus";
|
|
126
126
|
node: string;
|
|
127
127
|
branchPattern: number[];
|
|
128
128
|
constraint?: Record<string, unknown> | null | undefined;
|
|
@@ -179,7 +179,7 @@ export declare const inspectAnalyzeQueryDownSchema: v.ObjectType<Omit<{
|
|
|
179
179
|
} | {
|
|
180
180
|
type: "node-cost";
|
|
181
181
|
attemptNumber?: number | undefined;
|
|
182
|
-
nodeType: "connection" | "fan-in" | "fan-out" | "join" | "terminus";
|
|
182
|
+
nodeType: "connection" | "fan-in" | "fan-out" | "filter" | "join" | "terminus";
|
|
183
183
|
node: string;
|
|
184
184
|
branchPattern: number[];
|
|
185
185
|
downstreamChildSelectivity: number;
|
|
@@ -288,7 +288,7 @@ export declare const inspectDownBodySchema: v.UnionType<[v.ObjectType<Omit<{
|
|
|
288
288
|
} | {
|
|
289
289
|
type: "node-constraint";
|
|
290
290
|
attemptNumber?: number | undefined;
|
|
291
|
-
nodeType: "connection" | "fan-in" | "fan-out" | "join" | "terminus";
|
|
291
|
+
nodeType: "connection" | "fan-in" | "fan-out" | "filter" | "join" | "terminus";
|
|
292
292
|
node: string;
|
|
293
293
|
branchPattern: number[];
|
|
294
294
|
constraint?: Record<string, unknown> | null | undefined;
|
|
@@ -345,7 +345,7 @@ export declare const inspectDownBodySchema: v.UnionType<[v.ObjectType<Omit<{
|
|
|
345
345
|
} | {
|
|
346
346
|
type: "node-cost";
|
|
347
347
|
attemptNumber?: number | undefined;
|
|
348
|
-
nodeType: "connection" | "fan-in" | "fan-out" | "join" | "terminus";
|
|
348
|
+
nodeType: "connection" | "fan-in" | "fan-out" | "filter" | "join" | "terminus";
|
|
349
349
|
node: string;
|
|
350
350
|
branchPattern: number[];
|
|
351
351
|
downstreamChildSelectivity: number;
|
|
@@ -451,7 +451,7 @@ export declare const inspectDownMessageSchema: v.TupleType<[v.Type<"inspect">, v
|
|
|
451
451
|
} | {
|
|
452
452
|
type: "node-constraint";
|
|
453
453
|
attemptNumber?: number | undefined;
|
|
454
|
-
nodeType: "connection" | "fan-in" | "fan-out" | "join" | "terminus";
|
|
454
|
+
nodeType: "connection" | "fan-in" | "fan-out" | "filter" | "join" | "terminus";
|
|
455
455
|
node: string;
|
|
456
456
|
branchPattern: number[];
|
|
457
457
|
constraint?: Record<string, unknown> | null | undefined;
|
|
@@ -508,7 +508,7 @@ export declare const inspectDownMessageSchema: v.TupleType<[v.Type<"inspect">, v
|
|
|
508
508
|
} | {
|
|
509
509
|
type: "node-cost";
|
|
510
510
|
attemptNumber?: number | undefined;
|
|
511
|
-
nodeType: "connection" | "fan-in" | "fan-out" | "join" | "terminus";
|
|
511
|
+
nodeType: "connection" | "fan-in" | "fan-out" | "filter" | "join" | "terminus";
|
|
512
512
|
node: string;
|
|
513
513
|
branchPattern: number[];
|
|
514
514
|
downstreamChildSelectivity: number;
|
|
@@ -10,7 +10,7 @@
|
|
|
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 =
|
|
13
|
+
export declare const PROTOCOL_VERSION = 53;
|
|
14
14
|
/**
|
|
15
15
|
* The minimum server-supported sync protocol version (i.e. the version
|
|
16
16
|
* declared in the "/sync/v{#}/connect" URL).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol-version.d.ts","sourceRoot":"","sources":["../../../../zero-protocol/src/protocol-version.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;
|
|
1
|
+
{"version":3,"file":"protocol-version.d.ts","sourceRoot":"","sources":["../../../../zero-protocol/src/protocol-version.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AAiDH,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\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 =
|
|
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.\n// -- version 53 adds 'filter' node type to AnalyzeQueryResult\nexport const PROTOCOL_VERSION = 53;\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":";AAiFA,OAAA,MAEE,uEACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-query.d.ts","sourceRoot":"","sources":["../../../../zero-react/src/use-query.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAEV,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,aAAa,EAEb,KAAK,EACL,aAAa,EACb,OAAO,EACP,KAAK,EAEL,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EAEjB,GAAG,EAEH,IAAI,EACL,MAAM,WAAW,CAAC;AAEnB,MAAM,MAAM,WAAW,CAAC,OAAO,IAAI,SAAS;IAC1C,aAAa,CAAC,OAAO,CAAC;IACtB,kBAAkB,GAAG,EAAE;CACxB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,gBAAgB,CAAC,OAAO,IAAI,SAAS;IAC/C,aAAa,CAAC,OAAO,CAAC,GAAG,SAAS;IAClC,kBAAkB,GAAG,EAAE;CACxB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B;;;;OAIG;IACH,GAAG,CAAC,EAAE,GAAG,GAAG,SAAS,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,eAAe,GAAG;IACtD;;;;;;;;;;;OAWG;IACH,YAAY,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;CACvC,CAAC;AAUF,wB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,MAAM,SAAS,MAAM,OAAO,CAAC,QAAQ,CAAC,GAAG,MAAM,EAC/C,OAAO,SAAS,iBAAiB,EACjC,OAAO,EACP,EAAE,SAAS,iBAAiB,GAAG,SAAS,EACxC,QAAQ,SAAS,kBAAkB,EAEnC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,EAAE,QAAQ,CAAC,EACjC,CAAC,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,EAClC,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,GAAG,GACP;QACD,WAAW,EAAE,MAAM,WAAW,CAAC,OAAO,CAAC,CAAC;QACxC,uBAAuB,EAAE,CAAC,SAAS,EAAE,MAAM,IAAI,KAAK,MAAM,IAAI,CAAC;QAC/D,SAAS,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,CAAC;QAC9B,eAAe,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;QACrC,eAAe,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;QACrC,QAAQ,EAAE,OAAO,CAAC;QAClB,QAAQ,EAAE,OAAO,CAAC;KACnB,CA2CA;CACF"}
|
|
@@ -146,6 +146,17 @@ function makeError(retry, error) {
|
|
|
146
146
|
* Swapping `useState` to `useRef` has similar problems.
|
|
147
147
|
*/
|
|
148
148
|
var ViewStore = class {
|
|
149
|
+
/**
|
|
150
|
+
* Client id, then query hash.
|
|
151
|
+
*
|
|
152
|
+
* Nested rather than keyed by the two joined together, because this is
|
|
153
|
+
* looked up on every render of every `useQuery`. Joining them builds a
|
|
154
|
+
* string that V8 has to hash from scratch, where both halves on their own
|
|
155
|
+
* are strings it has already hashed and cached -- `hash()` is memoized on an
|
|
156
|
+
* interned query, so the same string comes back each render. Measured over a
|
|
157
|
+
* rebuild-and-look-up of one chain, that is the difference between 202ns and
|
|
158
|
+
* 123ns; the join cost more than rebuilding and hashing the whole query.
|
|
159
|
+
*/
|
|
149
160
|
#views = /* @__PURE__ */ new Map();
|
|
150
161
|
constructor() {}
|
|
151
162
|
getView(zero, q, enabled, ttl) {
|
|
@@ -159,15 +170,23 @@ var ViewStore = class {
|
|
|
159
170
|
complete: false,
|
|
160
171
|
nonEmpty: false
|
|
161
172
|
};
|
|
162
|
-
const
|
|
163
|
-
|
|
173
|
+
const { clientID } = zero;
|
|
174
|
+
const hash = qi.hash();
|
|
175
|
+
let byHash = this.#views.get(clientID);
|
|
176
|
+
let existing = byHash?.get(hash);
|
|
164
177
|
if (!existing) {
|
|
165
178
|
existing = new ViewWrapper(q, zero, ttl, (view) => {
|
|
166
|
-
const
|
|
179
|
+
const views = this.#views.get(clientID);
|
|
180
|
+
const currentView = views?.get(hash);
|
|
167
181
|
if (currentView && currentView !== view) return;
|
|
168
|
-
|
|
182
|
+
views?.delete(hash);
|
|
183
|
+
if (views?.size === 0) this.#views.delete(clientID);
|
|
169
184
|
});
|
|
170
|
-
|
|
185
|
+
if (!byHash) {
|
|
186
|
+
byHash = /* @__PURE__ */ new Map();
|
|
187
|
+
this.#views.set(clientID, byHash);
|
|
188
|
+
}
|
|
189
|
+
byHash.set(hash, existing);
|
|
171
190
|
} else existing.updateTTL(ttl);
|
|
172
191
|
return existing;
|
|
173
192
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-query.js","names":["#views","#onDematerialized","#query","#reactInternals","#zero","#singular","#ttl","#snapshot","#materializeIfNeeded","#retry","#complete","#completeResolver","#nonEmpty","#nonEmptyResolver","#view","#onData","#destroyTimer"],"sources":["../../../../zero-react/src/use-query.tsx"],"sourcesContent":["import {resolver} from '@rocicorp/resolver';\nimport React, {useSyncExternalStore} from 'react';\nimport {TESTING} from '../../shared/src/testing.ts';\nimport {\n type Immutable,\n addContextToQuery,\n asQueryInternals,\n DEFAULT_TTL_MS,\n} from './bindings.ts';\nimport {useZero} from './zero-provider.tsx';\nimport type {\n AnyMutatorRegistry,\n BaseDefaultContext,\n BaseDefaultSchema,\n CustomMutatorDefs,\n DefaultContext,\n DefaultSchema,\n ErroredQuery,\n Falsy,\n HumanReadable,\n PullRow,\n Query,\n QueryErrorDetails,\n QueryOrQueryRequest,\n QueryResultDetails,\n ReadonlyJSONValue,\n ResultType,\n TTL,\n TypedView,\n Zero,\n} from './zero.ts';\n\nexport type QueryResult<TReturn> = readonly [\n HumanReadable<TReturn>,\n QueryResultDetails & {},\n];\n\n/**\n * Result type for \"maybe queries\" - queries that may be falsy.\n * The data value can be undefined when the query is falsy/disabled.\n */\nexport type MaybeQueryResult<TReturn> = readonly [\n HumanReadable<TReturn> | undefined,\n QueryResultDetails & {},\n];\n\nexport type UseQueryOptions = {\n enabled?: boolean | undefined;\n /**\n * Time to live (TTL) in seconds. Controls how long query results are cached\n * after the query is removed. During this time, Zero continues to sync the query.\n * Default is 'never'.\n */\n ttl?: TTL | undefined;\n};\n\nexport type UseSuspenseQueryOptions = UseQueryOptions & {\n /**\n * Whether to suspend until:\n * - 'partial': the query has partial results (partial array or defined\n * value for singular results) which may be of result type 'unknown',\n * or the query result type is 'complete' (in which case results may be\n * empty). This is useful for suspending until there are partial\n * optimistic local results, or the query has completed loading from the\n * server.\n * - 'complete': the query result type is 'complete'.\n *\n * Default is 'partial'.\n */\n suspendUntil?: 'complete' | 'partial';\n};\n\nconst reactUse = (React as {use?: (p: Promise<unknown>) => void}).use;\nconst suspend: (p: Promise<unknown>) => void = reactUse\n ? reactUse\n : p => {\n throw p;\n };\n\n// Overload 1: Query\nexport function useQuery<\n TTable extends keyof TSchema['tables'] & string,\n TInput extends ReadonlyJSONValue | undefined,\n TOutput extends ReadonlyJSONValue | undefined,\n TSchema extends BaseDefaultSchema = DefaultSchema,\n TReturn = PullRow<TTable, TSchema>,\n TContext extends BaseDefaultContext = DefaultContext,\n>(\n query: QueryOrQueryRequest<\n TTable,\n TInput,\n TOutput,\n TSchema,\n TReturn,\n TContext\n >,\n options?: UseQueryOptions | boolean,\n): QueryResult<TReturn>;\n\n// Overload 2: Maybe query\nexport function useQuery<\n TTable extends keyof TSchema['tables'] & string,\n TInput extends ReadonlyJSONValue | undefined,\n TOutput extends ReadonlyJSONValue | undefined,\n TSchema extends BaseDefaultSchema = DefaultSchema,\n TReturn = PullRow<TTable, TSchema>,\n TContext extends BaseDefaultContext = DefaultContext,\n>(\n query:\n | QueryOrQueryRequest<TTable, TInput, TOutput, TSchema, TReturn, TContext>\n | Falsy,\n options?: UseQueryOptions | boolean,\n): MaybeQueryResult<TReturn>;\n\n// Implementation\nexport function useQuery<\n TTable extends keyof TSchema['tables'] & string,\n TInput extends ReadonlyJSONValue | undefined,\n TOutput extends ReadonlyJSONValue | undefined,\n TSchema extends BaseDefaultSchema = DefaultSchema,\n TReturn = PullRow<TTable, TSchema>,\n TContext extends BaseDefaultContext = DefaultContext,\n>(\n query:\n | QueryOrQueryRequest<TTable, TInput, TOutput, TSchema, TReturn, TContext>\n | Falsy,\n options?: UseQueryOptions | boolean,\n): QueryResult<TReturn> | MaybeQueryResult<TReturn> {\n let enabled = true;\n let ttl: TTL = DEFAULT_TTL_MS;\n if (typeof options === 'boolean') {\n enabled = options;\n } else if (options) {\n ({enabled = true, ttl = DEFAULT_TTL_MS} = options);\n }\n\n const zero = useZero<TSchema, undefined, TContext>();\n\n // When query is falsy, use disabled subscriber/snapshot to maintain hook order\n const q = query ? addContextToQuery(query, zero.context) : undefined;\n const view = q ? viewStore.getView(zero, q, enabled, ttl) : undefined;\n\n // https://react.dev/reference/react/useSyncExternalStore\n // Always call useSyncExternalStore to maintain consistent hook order\n return useSyncExternalStore(\n view?.subscribeReactInternals ?? disabledSubscriber,\n view?.getSnapshot ??\n (getDisabledSnapshot as () => MaybeQueryResult<TReturn>),\n view?.getSnapshot ??\n (getDisabledSnapshot as () => MaybeQueryResult<TReturn>),\n );\n}\n\n// Overload 1: Query\nexport function useSuspenseQuery<\n TTable extends keyof TSchema['tables'] & string,\n TInput extends ReadonlyJSONValue | undefined,\n TOutput extends ReadonlyJSONValue | undefined,\n TSchema extends BaseDefaultSchema = DefaultSchema,\n TReturn = PullRow<TTable, TSchema>,\n TContext extends BaseDefaultContext = DefaultContext,\n>(\n query: QueryOrQueryRequest<\n TTable,\n TInput,\n TOutput,\n TSchema,\n TReturn,\n TContext\n >,\n options?: UseSuspenseQueryOptions | boolean,\n): QueryResult<TReturn>;\n\n// Overload 2: Maybe query\nexport function useSuspenseQuery<\n TTable extends keyof TSchema['tables'] & string,\n TInput extends ReadonlyJSONValue | undefined,\n TOutput extends ReadonlyJSONValue | undefined,\n TSchema extends BaseDefaultSchema = DefaultSchema,\n TReturn = PullRow<TTable, TSchema>,\n TContext extends BaseDefaultContext = DefaultContext,\n>(\n query:\n | QueryOrQueryRequest<TTable, TInput, TOutput, TSchema, TReturn, TContext>\n | Falsy,\n options?: UseSuspenseQueryOptions | boolean,\n): MaybeQueryResult<TReturn>;\n\n// Implementation\nexport function useSuspenseQuery<\n TTable extends keyof TSchema['tables'] & string,\n TInput extends ReadonlyJSONValue | undefined,\n TOutput extends ReadonlyJSONValue | undefined,\n TSchema extends BaseDefaultSchema = DefaultSchema,\n TReturn = PullRow<TTable, TSchema>,\n TContext extends BaseDefaultContext = DefaultContext,\n>(\n query:\n | QueryOrQueryRequest<TTable, TInput, TOutput, TSchema, TReturn, TContext>\n | Falsy,\n options?: UseSuspenseQueryOptions | boolean,\n): QueryResult<TReturn> | MaybeQueryResult<TReturn> {\n let enabled = true;\n let ttl: TTL = DEFAULT_TTL_MS;\n let suspendUntil: 'complete' | 'partial' = 'partial';\n if (typeof options === 'boolean') {\n enabled = options;\n } else if (options) {\n ({\n enabled = true,\n ttl = DEFAULT_TTL_MS,\n suspendUntil = 'complete',\n } = options);\n }\n\n const zero = useZero<TSchema, undefined, TContext>();\n\n // When query is falsy, use disabled subscriber/snapshot to maintain hook order\n const q = query ? addContextToQuery(query, zero.context) : undefined;\n const view = q ? viewStore.getView(zero, q, enabled, ttl) : undefined;\n\n // https://react.dev/reference/react/useSyncExternalStore\n // Always call useSyncExternalStore to maintain consistent hook order\n const snapshot = useSyncExternalStore(\n view?.subscribeReactInternals ?? disabledSubscriber,\n view?.getSnapshot ??\n (getDisabledSnapshot as () => MaybeQueryResult<TReturn>),\n view?.getSnapshot ??\n (getDisabledSnapshot as () => MaybeQueryResult<TReturn>),\n );\n\n if (view && enabled) {\n if (suspendUntil === 'complete' && !view.complete) {\n suspend(view.waitForComplete());\n }\n\n if (suspendUntil === 'partial' && !view.nonEmpty) {\n suspend(view.waitForNonEmpty());\n }\n }\n\n return snapshot;\n}\n\nconst emptyArray: unknown[] = [];\nconst disabledSubscriber = () => () => {};\n\nconst resultTypeUnknown = {type: 'unknown'} as const;\nconst resultTypeComplete = {type: 'complete'} as const;\nconst resultTypeError = {type: 'error'} as const;\n\nconst disabledQuerySnapshot = [undefined, resultTypeUnknown] as const;\nconst getDisabledSnapshot = () => disabledQuerySnapshot;\n\nconst emptySnapshotSingularUnknown = [undefined, resultTypeUnknown] as const;\nconst emptySnapshotSingularComplete = [undefined, resultTypeComplete] as const;\nconst emptySnapshotSingularErrorUnknown = [undefined, resultTypeError] as const;\nconst emptySnapshotPluralUnknown = [emptyArray, resultTypeUnknown] as const;\nconst emptySnapshotPluralComplete = [emptyArray, resultTypeComplete] as const;\nconst emptySnapshotErrorUnknown = [emptyArray, resultTypeError] as const;\n\nfunction getDefaultSnapshot<TReturn>(singular: boolean): QueryResult<TReturn> {\n return (\n singular ? emptySnapshotSingularUnknown : emptySnapshotPluralUnknown\n ) as QueryResult<TReturn>;\n}\n\n/**\n * Returns a new snapshot or one of the empty predefined ones. Returning the\n * predefined ones is important to prevent unnecessary re-renders in React.\n */\nfunction getSnapshot<TReturn>(\n singular: boolean,\n data: HumanReadable<TReturn>,\n resultType: ResultType,\n retryFn: () => void,\n error?: ErroredQuery,\n): QueryResult<TReturn> {\n if (singular && data === undefined) {\n switch (resultType) {\n case 'error':\n if (error) {\n return [\n undefined,\n makeError(retryFn, error),\n ] as unknown as QueryResult<TReturn>;\n }\n return emptySnapshotSingularErrorUnknown as unknown as QueryResult<TReturn>;\n case 'complete':\n return emptySnapshotSingularComplete as unknown as QueryResult<TReturn>;\n case 'unknown':\n return emptySnapshotSingularUnknown as unknown as QueryResult<TReturn>;\n }\n }\n\n if (!singular && (data as unknown[]).length === 0) {\n switch (resultType) {\n case 'error':\n if (error) {\n return [\n emptyArray,\n makeError(retryFn, error),\n ] as unknown as QueryResult<TReturn>;\n }\n return emptySnapshotErrorUnknown as unknown as QueryResult<TReturn>;\n case 'complete':\n return emptySnapshotPluralComplete as unknown as QueryResult<TReturn>;\n case 'unknown':\n return emptySnapshotPluralUnknown as unknown as QueryResult<TReturn>;\n }\n }\n\n switch (resultType) {\n case 'error':\n if (error) {\n return [data, makeError(retryFn, error)];\n }\n return [\n data,\n makeError(retryFn, {\n error: 'app',\n id: 'unknown',\n name: 'unknown',\n message: 'An unknown error occurred',\n }),\n ];\n case 'complete':\n return [data, resultTypeComplete];\n case 'unknown':\n return [data, resultTypeUnknown];\n }\n}\n\nfunction makeError(retry: () => void, error: ErroredQuery): QueryErrorDetails {\n const message = error.message ?? 'An unknown error occurred';\n return {\n type: 'error',\n retry,\n refetch: retry,\n error: {\n type: error.error,\n message,\n ...(error.details ? {details: error.details} : {}),\n },\n };\n}\n\n// oxlint-disable-next-line @typescript-eslint/no-explicit-any\ntype AnyViewWrapper = ViewWrapper<any, any, any, any, any>;\n\nconst allViews = new WeakMap<ViewStore, Map<string, AnyViewWrapper>>();\n\nexport function getAllViewsSizeForTesting(store: ViewStore): number {\n if (TESTING) {\n return allViews.get(store)?.size ?? 0;\n }\n return 0;\n}\n\n/**\n * A global store of all active views.\n *\n * React subscribes and unsubscribes to these views\n * via `useSyncExternalStore`.\n *\n * Managing views through `useEffect` or `useLayoutEffect` causes\n * inconsistencies because effects run after render.\n *\n * For example, if useQuery used use*Effect in the component below:\n * ```ts\n * function Foo({issueID}) {\n * const issue = useQuery(z.query.issue.where('id', issueID).one());\n * if (issue?.id !== undefined && issue.id !== issueID) {\n * console.log('MISMATCH!', issue.id, issueID);\n * }\n * }\n * ```\n *\n * `MISMATCH` will be printed whenever the `issueID` prop changes.\n *\n * This is because the component will render once with\n * the old state returned from `useQuery`. Then the effect inside\n * `useQuery` will run. The component will render again with the new\n * state. This inconsistent transition can cause unexpected results.\n *\n * Emulating `useEffect` via `useState` and `if` causes resource leaks.\n * That is:\n *\n * ```ts\n * function useQuery(q) {\n * const [oldHash, setOldHash] = useState();\n * if (hash(q) !== oldHash) {\n * // make new view\n * }\n *\n * useEffect(() => {\n * return () => view.destroy();\n * }, []);\n * }\n * ```\n *\n * I'm not sure why but in strict mode the cleanup function\n * fails to be called for the first instance of the view and only\n * cleans up later instances.\n *\n * Swapping `useState` to `useRef` has similar problems.\n */\nexport class ViewStore {\n #views = new Map<string, AnyViewWrapper>();\n\n constructor() {\n if (TESTING) {\n allViews.set(this, this.#views);\n }\n }\n\n getView<\n TTable extends keyof TSchema['tables'] & string,\n TSchema extends BaseDefaultSchema,\n TReturn,\n MD extends CustomMutatorDefs | undefined,\n TContext extends BaseDefaultContext,\n >(\n zero: Zero<TSchema, MD, TContext>,\n q: Query<TTable, TSchema, TReturn>,\n enabled: boolean,\n ttl: TTL,\n ): {\n getSnapshot: () => QueryResult<TReturn>;\n subscribeReactInternals: (internals: () => void) => () => void;\n updateTTL: (ttl: TTL) => void;\n waitForComplete: () => Promise<void>;\n waitForNonEmpty: () => Promise<void>;\n complete: boolean;\n nonEmpty: boolean;\n } {\n const qi = asQueryInternals(q);\n\n if (!enabled) {\n return {\n getSnapshot: () => getDefaultSnapshot(qi.format.singular),\n subscribeReactInternals: disabledSubscriber,\n updateTTL: () => {},\n waitForComplete: () => Promise.resolve(),\n waitForNonEmpty: () => Promise.resolve(),\n complete: false,\n nonEmpty: false,\n };\n }\n\n const hash = qi.hash() + zero.clientID;\n let existing = this.#views.get(hash);\n if (!existing) {\n existing = new ViewWrapper(q, zero, ttl, view => {\n const currentView = this.#views.get(hash);\n if (currentView && currentView !== view) {\n // we replaced the view with a new one already.\n return;\n }\n this.#views.delete(hash);\n });\n this.#views.set(hash, existing);\n } else {\n existing.updateTTL(ttl);\n }\n return existing as ViewWrapper<TTable, TSchema, TReturn, MD, TContext>;\n }\n}\n\nconst viewStore = new ViewStore();\n\n/**\n * This wraps and ref counts a view.\n *\n * The only signal we have from React as to whether or not it is\n * done with a view is when it calls `unsubscribe`.\n *\n * In non-strict-mode we can clean up the view as soon\n * as the listener count goes to 0.\n *\n * In strict-mode, the listener count will go to 0 then a\n * new listener for the same view is immediately added back.\n *\n * This is why the `onMaterialized` and `onDematerialized` callbacks exist --\n * they allow a view which React is still referencing to be added\n * back into the store when React re-subscribes to it.\n *\n * This wrapper also exists to deal with the various\n * `useSyncExternalStore` caveats that cause excessive\n * re-renders and materializations.\n *\n * See: https://react.dev/reference/react/useSyncExternalStore#caveats\n * Especially:\n * 1. The store snapshot returned by getSnapshot must be immutable. If the underlying store has mutable data, return a new immutable snapshot if the data has changed. Otherwise, return a cached last snapshot.\n * 2. If a different subscribe function is passed during a re-render, React will re-subscribe to the store using the newly passed subscribe function. You can prevent this by declaring subscribe outside the component.\n */\nclass ViewWrapper<\n TTable extends keyof TSchema['tables'] & string,\n TSchema extends BaseDefaultSchema,\n TReturn,\n MD extends AnyMutatorRegistry | CustomMutatorDefs | undefined,\n TContext extends BaseDefaultContext,\n> {\n #view: TypedView<HumanReadable<TReturn>> | undefined;\n readonly #onDematerialized;\n readonly #query: Query<TTable, TSchema, TReturn>;\n #snapshot: QueryResult<TReturn>;\n readonly #reactInternals: Set<() => void> = new Set();\n #ttl: TTL;\n #complete = false;\n #completeResolver = resolver<void>();\n #nonEmpty = false;\n #nonEmptyResolver = resolver<void>();\n readonly #zero: Pick<Zero<TSchema, undefined, TContext>, 'materialize'>;\n readonly #singular: boolean;\n #destroyTimer: ReturnType<typeof setTimeout> | undefined;\n\n constructor(\n query: Query<TTable, TSchema, TReturn>,\n zero: Pick<Zero<TSchema, undefined, TContext>, 'materialize'>,\n ttl: TTL,\n onDematerialized: (\n view: ViewWrapper<TTable, TSchema, TReturn, MD, TContext>,\n ) => void,\n ) {\n this.#query = query;\n this.#zero = zero;\n this.#ttl = ttl;\n this.#onDematerialized = onDematerialized;\n const {singular} = asQueryInternals(query).format;\n this.#singular = singular;\n this.#snapshot = getDefaultSnapshot(singular);\n this.#materializeIfNeeded();\n }\n\n #onData = (\n snap: Immutable<HumanReadable<TReturn>>,\n resultType: ResultType,\n error?: ErroredQuery,\n ) => {\n // applyChange now returns immutable data structures, so no deep clone needed.\n // Unchanged rows preserve their object identity for React.memo optimization.\n const data = snap as HumanReadable<TReturn>;\n this.#snapshot = getSnapshot(\n this.#singular,\n data,\n resultType,\n this.#retry,\n error,\n );\n if (resultType === 'complete' || resultType === 'error') {\n this.#complete = true;\n this.#completeResolver.resolve();\n this.#nonEmpty = true;\n this.#nonEmptyResolver.resolve();\n }\n\n if (\n this.#singular\n ? this.#snapshot[0] !== undefined\n : (this.#snapshot[0] as unknown[]).length !== 0\n ) {\n this.#nonEmpty = true;\n this.#nonEmptyResolver.resolve();\n }\n\n for (const internals of this.#reactInternals) {\n internals();\n }\n };\n\n /**\n * Called by the user to force a retry of the query\n * in the case the query errored.\n */\n #retry = () => {\n this.#view?.destroy();\n this.#view = undefined;\n this.#materializeIfNeeded();\n };\n\n #materializeIfNeeded = () => {\n if (this.#view) {\n return;\n }\n this.#view = this.#zero.materialize(this.#query, {\n ttl: this.#ttl,\n });\n this.#view.addListener(this.#onData);\n };\n\n getSnapshot = () => this.#snapshot;\n\n subscribeReactInternals = (internals: () => void): (() => void) => {\n this.#reactInternals.add(internals);\n // Cancel any pending destroy timer from a previous unsubscribe.\n // Without this, rapid unsub/resub cycles accumulate stale timers\n // that can fire during a gap between unsubscribe and resubscribe,\n // destroying the view even though it was actively used.\n if (this.#destroyTimer !== undefined) {\n clearTimeout(this.#destroyTimer);\n this.#destroyTimer = undefined;\n }\n this.#materializeIfNeeded();\n return () => {\n this.#reactInternals.delete(internals);\n\n // only schedule a cleanup task if we have no listeners left\n if (this.#reactInternals.size === 0) {\n this.#destroyTimer = setTimeout(() => {\n this.#destroyTimer = undefined;\n\n // We already destroyed the view\n if (this.#view === undefined) {\n return;\n }\n\n // Someone re-registered a listener on this view before the timeout elapsed.\n // This happens often in strict-mode which forces a component\n // to mount, unmount, remount.\n if (this.#reactInternals.size > 0) {\n return;\n }\n\n this.#view.destroy();\n this.#view = undefined;\n this.#complete = false;\n this.#completeResolver = resolver();\n this.#nonEmpty = false;\n this.#nonEmptyResolver = resolver();\n this.#onDematerialized(this);\n }, 10);\n }\n };\n };\n\n updateTTL(ttl: TTL): void {\n this.#ttl = ttl;\n this.#view?.updateTTL(ttl);\n }\n\n get complete() {\n return this.#complete;\n }\n\n waitForComplete(): Promise<void> {\n return this.#completeResolver.promise;\n }\n\n get nonEmpty() {\n return this.#nonEmpty;\n }\n\n waitForNonEmpty(): Promise<void> {\n return this.#nonEmptyResolver.promise;\n }\n}\n"],"mappings":";;;;;;;;AAwEA,IAAM,WAAY,MAAgD;AAClE,IAAM,UAAyC,WAC3C,YACA,MAAK;CACH,MAAM;AACR;AAsCJ,SAAgB,SAQd,OAGA,SACkD;CAClD,IAAI,UAAU;CACd,IAAI,MAAW;CACf,IAAI,OAAO,YAAY,WACrB,UAAU;MACL,IAAI,SACT,CAAC,CAAC,UAAU,MAAM,MAAM,kBAAkB;CAG5C,MAAM,OAAO,QAAsC;CAGnD,MAAM,IAAI,QAAQ,kBAAkB,OAAO,KAAK,OAAO,IAAI,KAAA;CAC3D,MAAM,OAAO,IAAI,UAAU,QAAQ,MAAM,GAAG,SAAS,GAAG,IAAI,KAAA;CAI5D,OAAO,qBACL,MAAM,2BAA2B,oBACjC,MAAM,eACH,qBACH,MAAM,eACH,mBACL;AACF;AAsCA,SAAgB,iBAQd,OAGA,SACkD;CAClD,IAAI,UAAU;CACd,IAAI,MAAW;CACf,IAAI,eAAuC;CAC3C,IAAI,OAAO,YAAY,WACrB,UA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AqB;CAC5B;CAEA,6BAA6B;EAC3B,IAAI,KAAKM,OACP;EAEF,KAAKA,QAAQ,KAAKV,MAAM,YAAY,KAAKF,QAAQ,EAC/C,KAAK,KAAKI,KACZ,CAAC;EACD,KAAKQ,MAAM,YAAY,KAAKC,OAAO;CACrC;CAEA,oBAAoB,KAAKR;CAEzB,2BAA2B,cAAwC;EACjE,KAAKJ,gBAAgB,IAAI,SAAS;EAKlC,IAAI,KAAKa,kBAAkB,KAAA,GAAW;GACpC,aAAa,KAAKA,aAAa;GAC/B,KAAKA,gBAAgB,KAAA;EACvB;EACA,KAAKR,qBAAqB;EAC1B,aAAa;GACX,KAAKL,gBAAgB,OAAO,SAAS;GAGrC,IAAI,KAAKA,gBAAgB,SAAS,GAChC,KAAKa,gBAAgB,iBAAiB;IACpC,KAAKA,gBAAgB,KAAA;IAGrB,IAAI,KAAKF,UAAU,KAAA,GACjB;IAMF,IAAI,KAAKX,gBAAgB,OAAO,GAC9B;IAGF,KAAKW,MAAM,QAAQ;IACnB,KAAKA,QAAQ,KAAA;IACb,KAAKJ,YAAY;IACjB,KAAKC,oBAAoB,SAAS;IAClC,KAAKC,YAAY;IACjB,KAAKC,oBAAoB,SAAS;IAClC,KAAKZ,kBAAkB,IAAI;GAC7B,GAAG,EAAE;EAET;CACF;CAEA,UAAU,KAAgB;EACxB,KAAKK,OAAO;EACZ,KAAKQ,OAAO,UAAU,GAAG;CAC3B;CAEA,IAAI,WAAW;EACb,OAAO,KAAKJ;CACd;CAEA,kBAAiC;EAC/B,OAAO,KAAKC,kBAAkB;CAChC;CAEA,IAAI,WAAW;EACb,OAAO,KAAKC;CACd;CAEA,kBAAiC;EAC/B,OAAO,KAAKC,kBAAkB;CAChC;AACF"}
|
|
1
|
+
{"version":3,"file":"use-query.js","names":["#views","#onDematerialized","#query","#reactInternals","#zero","#singular","#ttl","#snapshot","#materializeIfNeeded","#retry","#complete","#completeResolver","#nonEmpty","#nonEmptyResolver","#view","#onData","#destroyTimer"],"sources":["../../../../zero-react/src/use-query.tsx"],"sourcesContent":["import {resolver} from '@rocicorp/resolver';\nimport React, {useSyncExternalStore} from 'react';\nimport {TESTING} from '../../shared/src/testing.ts';\nimport {\n type Immutable,\n addContextToQuery,\n asQueryInternals,\n DEFAULT_TTL_MS,\n} from './bindings.ts';\nimport {useZero} from './zero-provider.tsx';\nimport type {\n AnyMutatorRegistry,\n BaseDefaultContext,\n BaseDefaultSchema,\n CustomMutatorDefs,\n DefaultContext,\n DefaultSchema,\n ErroredQuery,\n Falsy,\n HumanReadable,\n PullRow,\n Query,\n QueryErrorDetails,\n QueryOrQueryRequest,\n QueryResultDetails,\n ReadonlyJSONValue,\n ResultType,\n TTL,\n TypedView,\n Zero,\n} from './zero.ts';\n\nexport type QueryResult<TReturn> = readonly [\n HumanReadable<TReturn>,\n QueryResultDetails & {},\n];\n\n/**\n * Result type for \"maybe queries\" - queries that may be falsy.\n * The data value can be undefined when the query is falsy/disabled.\n */\nexport type MaybeQueryResult<TReturn> = readonly [\n HumanReadable<TReturn> | undefined,\n QueryResultDetails & {},\n];\n\nexport type UseQueryOptions = {\n enabled?: boolean | undefined;\n /**\n * Time to live (TTL) in seconds. Controls how long query results are cached\n * after the query is removed. During this time, Zero continues to sync the query.\n * Default is 'never'.\n */\n ttl?: TTL | undefined;\n};\n\nexport type UseSuspenseQueryOptions = UseQueryOptions & {\n /**\n * Whether to suspend until:\n * - 'partial': the query has partial results (partial array or defined\n * value for singular results) which may be of result type 'unknown',\n * or the query result type is 'complete' (in which case results may be\n * empty). This is useful for suspending until there are partial\n * optimistic local results, or the query has completed loading from the\n * server.\n * - 'complete': the query result type is 'complete'.\n *\n * Default is 'partial'.\n */\n suspendUntil?: 'complete' | 'partial';\n};\n\nconst reactUse = (React as {use?: (p: Promise<unknown>) => void}).use;\nconst suspend: (p: Promise<unknown>) => void = reactUse\n ? reactUse\n : p => {\n throw p;\n };\n\n// Overload 1: Query\nexport function useQuery<\n TTable extends keyof TSchema['tables'] & string,\n TInput extends ReadonlyJSONValue | undefined,\n TOutput extends ReadonlyJSONValue | undefined,\n TSchema extends BaseDefaultSchema = DefaultSchema,\n TReturn = PullRow<TTable, TSchema>,\n TContext extends BaseDefaultContext = DefaultContext,\n>(\n query: QueryOrQueryRequest<\n TTable,\n TInput,\n TOutput,\n TSchema,\n TReturn,\n TContext\n >,\n options?: UseQueryOptions | boolean,\n): QueryResult<TReturn>;\n\n// Overload 2: Maybe query\nexport function useQuery<\n TTable extends keyof TSchema['tables'] & string,\n TInput extends ReadonlyJSONValue | undefined,\n TOutput extends ReadonlyJSONValue | undefined,\n TSchema extends BaseDefaultSchema = DefaultSchema,\n TReturn = PullRow<TTable, TSchema>,\n TContext extends BaseDefaultContext = DefaultContext,\n>(\n query:\n | QueryOrQueryRequest<TTable, TInput, TOutput, TSchema, TReturn, TContext>\n | Falsy,\n options?: UseQueryOptions | boolean,\n): MaybeQueryResult<TReturn>;\n\n// Implementation\nexport function useQuery<\n TTable extends keyof TSchema['tables'] & string,\n TInput extends ReadonlyJSONValue | undefined,\n TOutput extends ReadonlyJSONValue | undefined,\n TSchema extends BaseDefaultSchema = DefaultSchema,\n TReturn = PullRow<TTable, TSchema>,\n TContext extends BaseDefaultContext = DefaultContext,\n>(\n query:\n | QueryOrQueryRequest<TTable, TInput, TOutput, TSchema, TReturn, TContext>\n | Falsy,\n options?: UseQueryOptions | boolean,\n): QueryResult<TReturn> | MaybeQueryResult<TReturn> {\n let enabled = true;\n let ttl: TTL = DEFAULT_TTL_MS;\n if (typeof options === 'boolean') {\n enabled = options;\n } else if (options) {\n ({enabled = true, ttl = DEFAULT_TTL_MS} = options);\n }\n\n const zero = useZero<TSchema, undefined, TContext>();\n\n // When query is falsy, use disabled subscriber/snapshot to maintain hook order\n const q = query ? addContextToQuery(query, zero.context) : undefined;\n const view = q ? viewStore.getView(zero, q, enabled, ttl) : undefined;\n\n // https://react.dev/reference/react/useSyncExternalStore\n // Always call useSyncExternalStore to maintain consistent hook order\n return useSyncExternalStore(\n view?.subscribeReactInternals ?? disabledSubscriber,\n view?.getSnapshot ??\n (getDisabledSnapshot as () => MaybeQueryResult<TReturn>),\n view?.getSnapshot ??\n (getDisabledSnapshot as () => MaybeQueryResult<TReturn>),\n );\n}\n\n// Overload 1: Query\nexport function useSuspenseQuery<\n TTable extends keyof TSchema['tables'] & string,\n TInput extends ReadonlyJSONValue | undefined,\n TOutput extends ReadonlyJSONValue | undefined,\n TSchema extends BaseDefaultSchema = DefaultSchema,\n TReturn = PullRow<TTable, TSchema>,\n TContext extends BaseDefaultContext = DefaultContext,\n>(\n query: QueryOrQueryRequest<\n TTable,\n TInput,\n TOutput,\n TSchema,\n TReturn,\n TContext\n >,\n options?: UseSuspenseQueryOptions | boolean,\n): QueryResult<TReturn>;\n\n// Overload 2: Maybe query\nexport function useSuspenseQuery<\n TTable extends keyof TSchema['tables'] & string,\n TInput extends ReadonlyJSONValue | undefined,\n TOutput extends ReadonlyJSONValue | undefined,\n TSchema extends BaseDefaultSchema = DefaultSchema,\n TReturn = PullRow<TTable, TSchema>,\n TContext extends BaseDefaultContext = DefaultContext,\n>(\n query:\n | QueryOrQueryRequest<TTable, TInput, TOutput, TSchema, TReturn, TContext>\n | Falsy,\n options?: UseSuspenseQueryOptions | boolean,\n): MaybeQueryResult<TReturn>;\n\n// Implementation\nexport function useSuspenseQuery<\n TTable extends keyof TSchema['tables'] & string,\n TInput extends ReadonlyJSONValue | undefined,\n TOutput extends ReadonlyJSONValue | undefined,\n TSchema extends BaseDefaultSchema = DefaultSchema,\n TReturn = PullRow<TTable, TSchema>,\n TContext extends BaseDefaultContext = DefaultContext,\n>(\n query:\n | QueryOrQueryRequest<TTable, TInput, TOutput, TSchema, TReturn, TContext>\n | Falsy,\n options?: UseSuspenseQueryOptions | boolean,\n): QueryResult<TReturn> | MaybeQueryResult<TReturn> {\n let enabled = true;\n let ttl: TTL = DEFAULT_TTL_MS;\n let suspendUntil: 'complete' | 'partial' = 'partial';\n if (typeof options === 'boolean') {\n enabled = options;\n } else if (options) {\n ({\n enabled = true,\n ttl = DEFAULT_TTL_MS,\n suspendUntil = 'complete',\n } = options);\n }\n\n const zero = useZero<TSchema, undefined, TContext>();\n\n // When query is falsy, use disabled subscriber/snapshot to maintain hook order\n const q = query ? addContextToQuery(query, zero.context) : undefined;\n const view = q ? viewStore.getView(zero, q, enabled, ttl) : undefined;\n\n // https://react.dev/reference/react/useSyncExternalStore\n // Always call useSyncExternalStore to maintain consistent hook order\n const snapshot = useSyncExternalStore(\n view?.subscribeReactInternals ?? disabledSubscriber,\n view?.getSnapshot ??\n (getDisabledSnapshot as () => MaybeQueryResult<TReturn>),\n view?.getSnapshot ??\n (getDisabledSnapshot as () => MaybeQueryResult<TReturn>),\n );\n\n if (view && enabled) {\n if (suspendUntil === 'complete' && !view.complete) {\n suspend(view.waitForComplete());\n }\n\n if (suspendUntil === 'partial' && !view.nonEmpty) {\n suspend(view.waitForNonEmpty());\n }\n }\n\n return snapshot;\n}\n\nconst emptyArray: unknown[] = [];\nconst disabledSubscriber = () => () => {};\n\nconst resultTypeUnknown = {type: 'unknown'} as const;\nconst resultTypeComplete = {type: 'complete'} as const;\nconst resultTypeError = {type: 'error'} as const;\n\nconst disabledQuerySnapshot = [undefined, resultTypeUnknown] as const;\nconst getDisabledSnapshot = () => disabledQuerySnapshot;\n\nconst emptySnapshotSingularUnknown = [undefined, resultTypeUnknown] as const;\nconst emptySnapshotSingularComplete = [undefined, resultTypeComplete] as const;\nconst emptySnapshotSingularErrorUnknown = [undefined, resultTypeError] as const;\nconst emptySnapshotPluralUnknown = [emptyArray, resultTypeUnknown] as const;\nconst emptySnapshotPluralComplete = [emptyArray, resultTypeComplete] as const;\nconst emptySnapshotErrorUnknown = [emptyArray, resultTypeError] as const;\n\nfunction getDefaultSnapshot<TReturn>(singular: boolean): QueryResult<TReturn> {\n return (\n singular ? emptySnapshotSingularUnknown : emptySnapshotPluralUnknown\n ) as QueryResult<TReturn>;\n}\n\n/**\n * Returns a new snapshot or one of the empty predefined ones. Returning the\n * predefined ones is important to prevent unnecessary re-renders in React.\n */\nfunction getSnapshot<TReturn>(\n singular: boolean,\n data: HumanReadable<TReturn>,\n resultType: ResultType,\n retryFn: () => void,\n error?: ErroredQuery,\n): QueryResult<TReturn> {\n if (singular && data === undefined) {\n switch (resultType) {\n case 'error':\n if (error) {\n return [\n undefined,\n makeError(retryFn, error),\n ] as unknown as QueryResult<TReturn>;\n }\n return emptySnapshotSingularErrorUnknown as unknown as QueryResult<TReturn>;\n case 'complete':\n return emptySnapshotSingularComplete as unknown as QueryResult<TReturn>;\n case 'unknown':\n return emptySnapshotSingularUnknown as unknown as QueryResult<TReturn>;\n }\n }\n\n if (!singular && (data as unknown[]).length === 0) {\n switch (resultType) {\n case 'error':\n if (error) {\n return [\n emptyArray,\n makeError(retryFn, error),\n ] as unknown as QueryResult<TReturn>;\n }\n return emptySnapshotErrorUnknown as unknown as QueryResult<TReturn>;\n case 'complete':\n return emptySnapshotPluralComplete as unknown as QueryResult<TReturn>;\n case 'unknown':\n return emptySnapshotPluralUnknown as unknown as QueryResult<TReturn>;\n }\n }\n\n switch (resultType) {\n case 'error':\n if (error) {\n return [data, makeError(retryFn, error)];\n }\n return [\n data,\n makeError(retryFn, {\n error: 'app',\n id: 'unknown',\n name: 'unknown',\n message: 'An unknown error occurred',\n }),\n ];\n case 'complete':\n return [data, resultTypeComplete];\n case 'unknown':\n return [data, resultTypeUnknown];\n }\n}\n\nfunction makeError(retry: () => void, error: ErroredQuery): QueryErrorDetails {\n const message = error.message ?? 'An unknown error occurred';\n return {\n type: 'error',\n retry,\n refetch: retry,\n error: {\n type: error.error,\n message,\n ...(error.details ? {details: error.details} : {}),\n },\n };\n}\n\n// oxlint-disable-next-line @typescript-eslint/no-explicit-any\ntype AnyViewWrapper = ViewWrapper<any, any, any, any, any>;\n\nconst allViews = new WeakMap<\n ViewStore,\n Map<string, Map<string, AnyViewWrapper>>\n>();\n\nexport function getAllViewsSizeForTesting(store: ViewStore): number {\n if (TESTING) {\n let size = 0;\n for (const byHash of allViews.get(store)?.values() ?? []) {\n size += byHash.size;\n }\n return size;\n }\n return 0;\n}\n\n/**\n * A global store of all active views.\n *\n * React subscribes and unsubscribes to these views\n * via `useSyncExternalStore`.\n *\n * Managing views through `useEffect` or `useLayoutEffect` causes\n * inconsistencies because effects run after render.\n *\n * For example, if useQuery used use*Effect in the component below:\n * ```ts\n * function Foo({issueID}) {\n * const issue = useQuery(z.query.issue.where('id', issueID).one());\n * if (issue?.id !== undefined && issue.id !== issueID) {\n * console.log('MISMATCH!', issue.id, issueID);\n * }\n * }\n * ```\n *\n * `MISMATCH` will be printed whenever the `issueID` prop changes.\n *\n * This is because the component will render once with\n * the old state returned from `useQuery`. Then the effect inside\n * `useQuery` will run. The component will render again with the new\n * state. This inconsistent transition can cause unexpected results.\n *\n * Emulating `useEffect` via `useState` and `if` causes resource leaks.\n * That is:\n *\n * ```ts\n * function useQuery(q) {\n * const [oldHash, setOldHash] = useState();\n * if (hash(q) !== oldHash) {\n * // make new view\n * }\n *\n * useEffect(() => {\n * return () => view.destroy();\n * }, []);\n * }\n * ```\n *\n * I'm not sure why but in strict mode the cleanup function\n * fails to be called for the first instance of the view and only\n * cleans up later instances.\n *\n * Swapping `useState` to `useRef` has similar problems.\n */\nexport class ViewStore {\n /**\n * Client id, then query hash.\n *\n * Nested rather than keyed by the two joined together, because this is\n * looked up on every render of every `useQuery`. Joining them builds a\n * string that V8 has to hash from scratch, where both halves on their own\n * are strings it has already hashed and cached -- `hash()` is memoized on an\n * interned query, so the same string comes back each render. Measured over a\n * rebuild-and-look-up of one chain, that is the difference between 202ns and\n * 123ns; the join cost more than rebuilding and hashing the whole query.\n */\n #views = new Map<string, Map<string, AnyViewWrapper>>();\n\n constructor() {\n if (TESTING) {\n allViews.set(this, this.#views);\n }\n }\n\n getView<\n TTable extends keyof TSchema['tables'] & string,\n TSchema extends BaseDefaultSchema,\n TReturn,\n MD extends CustomMutatorDefs | undefined,\n TContext extends BaseDefaultContext,\n >(\n zero: Zero<TSchema, MD, TContext>,\n q: Query<TTable, TSchema, TReturn>,\n enabled: boolean,\n ttl: TTL,\n ): {\n getSnapshot: () => QueryResult<TReturn>;\n subscribeReactInternals: (internals: () => void) => () => void;\n updateTTL: (ttl: TTL) => void;\n waitForComplete: () => Promise<void>;\n waitForNonEmpty: () => Promise<void>;\n complete: boolean;\n nonEmpty: boolean;\n } {\n const qi = asQueryInternals(q);\n\n if (!enabled) {\n return {\n getSnapshot: () => getDefaultSnapshot(qi.format.singular),\n subscribeReactInternals: disabledSubscriber,\n updateTTL: () => {},\n waitForComplete: () => Promise.resolve(),\n waitForNonEmpty: () => Promise.resolve(),\n complete: false,\n nonEmpty: false,\n };\n }\n\n const {clientID} = zero;\n const hash = qi.hash();\n let byHash = this.#views.get(clientID);\n let existing = byHash?.get(hash);\n if (!existing) {\n existing = new ViewWrapper(q, zero, ttl, view => {\n const views = this.#views.get(clientID);\n const currentView = views?.get(hash);\n if (currentView && currentView !== view) {\n // we replaced the view with a new one already.\n return;\n }\n views?.delete(hash);\n if (views?.size === 0) {\n // Nothing is left for this client, so drop its map rather than\n // keeping one per client id the page has ever seen.\n this.#views.delete(clientID);\n }\n });\n if (!byHash) {\n byHash = new Map();\n this.#views.set(clientID, byHash);\n }\n byHash.set(hash, existing);\n } else {\n existing.updateTTL(ttl);\n }\n return existing as ViewWrapper<TTable, TSchema, TReturn, MD, TContext>;\n }\n}\n\nconst viewStore = new ViewStore();\n\n/**\n * This wraps and ref counts a view.\n *\n * The only signal we have from React as to whether or not it is\n * done with a view is when it calls `unsubscribe`.\n *\n * In non-strict-mode we can clean up the view as soon\n * as the listener count goes to 0.\n *\n * In strict-mode, the listener count will go to 0 then a\n * new listener for the same view is immediately added back.\n *\n * This is why the `onMaterialized` and `onDematerialized` callbacks exist --\n * they allow a view which React is still referencing to be added\n * back into the store when React re-subscribes to it.\n *\n * This wrapper also exists to deal with the various\n * `useSyncExternalStore` caveats that cause excessive\n * re-renders and materializations.\n *\n * See: https://react.dev/reference/react/useSyncExternalStore#caveats\n * Especially:\n * 1. The store snapshot returned by getSnapshot must be immutable. If the underlying store has mutable data, return a new immutable snapshot if the data has changed. Otherwise, return a cached last snapshot.\n * 2. If a different subscribe function is passed during a re-render, React will re-subscribe to the store using the newly passed subscribe function. You can prevent this by declaring subscribe outside the component.\n */\nclass ViewWrapper<\n TTable extends keyof TSchema['tables'] & string,\n TSchema extends BaseDefaultSchema,\n TReturn,\n MD extends AnyMutatorRegistry | CustomMutatorDefs | undefined,\n TContext extends BaseDefaultContext,\n> {\n #view: TypedView<HumanReadable<TReturn>> | undefined;\n readonly #onDematerialized;\n readonly #query: Query<TTable, TSchema, TReturn>;\n #snapshot: QueryResult<TReturn>;\n readonly #reactInternals: Set<() => void> = new Set();\n #ttl: TTL;\n #complete = false;\n #completeResolver = resolver<void>();\n #nonEmpty = false;\n #nonEmptyResolver = resolver<void>();\n readonly #zero: Pick<Zero<TSchema, undefined, TContext>, 'materialize'>;\n readonly #singular: boolean;\n #destroyTimer: ReturnType<typeof setTimeout> | undefined;\n\n constructor(\n query: Query<TTable, TSchema, TReturn>,\n zero: Pick<Zero<TSchema, undefined, TContext>, 'materialize'>,\n ttl: TTL,\n onDematerialized: (\n view: ViewWrapper<TTable, TSchema, TReturn, MD, TContext>,\n ) => void,\n ) {\n this.#query = query;\n this.#zero = zero;\n this.#ttl = ttl;\n this.#onDematerialized = onDematerialized;\n const {singular} = asQueryInternals(query).format;\n this.#singular = singular;\n this.#snapshot = getDefaultSnapshot(singular);\n this.#materializeIfNeeded();\n }\n\n #onData = (\n snap: Immutable<HumanReadable<TReturn>>,\n resultType: ResultType,\n error?: ErroredQuery,\n ) => {\n // applyChange now returns immutable data structures, so no deep clone needed.\n // Unchanged rows preserve their object identity for React.memo optimization.\n const data = snap as HumanReadable<TReturn>;\n this.#snapshot = getSnapshot(\n this.#singular,\n data,\n resultType,\n this.#retry,\n error,\n );\n if (resultType === 'complete' || resultType === 'error') {\n this.#complete = true;\n this.#completeResolver.resolve();\n this.#nonEmpty = true;\n this.#nonEmptyResolver.resolve();\n }\n\n if (\n this.#singular\n ? this.#snapshot[0] !== undefined\n : (this.#snapshot[0] as unknown[]).length !== 0\n ) {\n this.#nonEmpty = true;\n this.#nonEmptyResolver.resolve();\n }\n\n for (const internals of this.#reactInternals) {\n internals();\n }\n };\n\n /**\n * Called by the user to force a retry of the query\n * in the case the query errored.\n */\n #retry = () => {\n this.#view?.destroy();\n this.#view = undefined;\n this.#materializeIfNeeded();\n };\n\n #materializeIfNeeded = () => {\n if (this.#view) {\n return;\n }\n this.#view = this.#zero.materialize(this.#query, {\n ttl: this.#ttl,\n });\n this.#view.addListener(this.#onData);\n };\n\n getSnapshot = () => this.#snapshot;\n\n subscribeReactInternals = (internals: () => void): (() => void) => {\n this.#reactInternals.add(internals);\n // Cancel any pending destroy timer from a previous unsubscribe.\n // Without this, rapid unsub/resub cycles accumulate stale timers\n // that can fire during a gap between unsubscribe and resubscribe,\n // destroying the view even though it was actively used.\n if (this.#destroyTimer !== undefined) {\n clearTimeout(this.#destroyTimer);\n this.#destroyTimer = undefined;\n }\n this.#materializeIfNeeded();\n return () => {\n this.#reactInternals.delete(internals);\n\n // only schedule a cleanup task if we have no listeners left\n if (this.#reactInternals.size === 0) {\n this.#destroyTimer = setTimeout(() => {\n this.#destroyTimer = undefined;\n\n // We already destroyed the view\n if (this.#view === undefined) {\n return;\n }\n\n // Someone re-registered a listener on this view before the timeout elapsed.\n // This happens often in strict-mode which forces a component\n // to mount, unmount, remount.\n if (this.#reactInternals.size > 0) {\n return;\n }\n\n this.#view.destroy();\n this.#view = undefined;\n this.#complete = false;\n this.#completeResolver = resolver();\n this.#nonEmpty = false;\n this.#nonEmptyResolver = resolver();\n this.#onDematerialized(this);\n }, 10);\n }\n };\n };\n\n updateTTL(ttl: TTL): void {\n this.#ttl = ttl;\n this.#view?.updateTTL(ttl);\n }\n\n get complete() {\n return this.#complete;\n }\n\n waitForComplete(): Promise<void> {\n return this.#completeResolver.promise;\n }\n\n get nonEmpty() {\n return this.#nonEmpty;\n }\n\n waitForNonEmpty(): Promise<void> {\n return this.#nonEmptyResolver.promise;\n }\n}\n"],"mappings":";;;;;;;;AAwEA,IAAM,WAAY,MAAgD;AAClE,IAAM,UAAyC,WAC3C,YACA,MAAK;CACH,MAAM;AACR;AAsCJ,SAAgB,SAQd,OAGA,SACkD;CAClD,IAAI,UAAU;CACd,IAAI,MAAW;CACf,IAAI,OAAO,YAAY,WACrB,UAAU;MACL,IAAI,SACT,CAAC,CAAC,UAAU,MAAM,MAAM,kBAAkB;CAG5C,MAAM,OAAO,QAAsC;CAGnD,MAAM,IAAI,QAAQ,kBAAkB,OAAO,KAAK,OAAO,IAAI,KAAA;CAC3D,MAAM,OAAO,IAAI,UAAU,QAAQ,MAAM,GAAG,SAAS,GAAG,IAAI,KAAA;CAI5D,OAAO,qBACL,MAAM,2BAA2B,oBACjC,MAAM,eACH,qBACH,MAAM,eACH,mBACL;AACF;AAsCA,SAAgB,iBAQd,OAGA,SACkD;CAClD,IAAI,UAAU;CACd,IAAI,MAAW;CACf,IAAI,eAAuC;CAC3C,IAAI,OAAO,YAAY,WACrB,UAAU;MACL,IAAI,SACT,CAAC,CACC,UAAU,MACV,MAAM,gBACN,eAAe,cACb;CAGN,MAAM,OAAO,QAAsC;CAGnD,MAAM,IAAI,QAAQ,kBAAkB,OAAO,KAAK,OAAO,IAAI,KAAA;CAC3D,MAAM,OAAO,IAAI,UAAU,QAAQ,MAAM,GAAG,SAAS,GAAG,IAAI,KAAA;CAI5D,MAAM,WAAW,qBACf,MAAM,2BAA2B,oBACjC,MAAM,eACH,qBACH,MAAM,eACH,mBACL;CAEA,IAAI,QAAQ,SAAS;EACnB,IAAI,iBAAiB,cAAc,CAAC,KAAK,UACvC,QAAQ,KAAK,gBAAgB,CAAC;EAGhC,IAAI,iBAAiB,aAAa,CAAC,KAAK,UACtC,QAAQ,KAAK,gBAAgB,CAAC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J,gBAAgB,IAAI,SAAS;EAKlC,IAAI,KAAKa,kBAAkB,KAAA,GAAW;GACpC,aAAa,KAAKA,aAAa;GAC/B,KAAKA,gBAAgB,KAAA;EACvB;EACA,KAAKR,qBAAqB;EAC1B,aAAa;GACX,KAAKL,gBAAgB,OAAO,SAAS;GAGrC,IAAI,KAAKA,gBAAgB,SAAS,GAChC,KAAKa,gBAAgB,iBAAiB;IACpC,KAAKA,gBAAgB,KAAA;IAGrB,IAAI,KAAKF,UAAU,KAAA,GACjB;IAMF,IAAI,KAAKX,gBAAgB,OAAO,GAC9B;IAGF,KAAKW,MAAM,QAAQ;IACnB,KAAKA,QAAQ,KAAA;IACb,KAAKJ,YAAY;IACjB,KAAKC,oBAAoB,SAAS;IAClC,KAAKC,YAAY;IACjB,KAAKC,oBAAoB,SAAS;IAClC,KAAKZ,kBAAkB,IAAI;GAC7B,GAAG,EAAE;EAET;CACF;CAEA,UAAU,KAAgB;EACxB,KAAKK,OAAO;EACZ,KAAKQ,OAAO,UAAU,GAAG;CAC3B;CAEA,IAAI,WAAW;EACb,OAAO,KAAKJ;CACd;CAEA,kBAAiC;EAC/B,OAAO,KAAKC,kBAAkB;CAChC;CAEA,IAAI,WAAW;EACb,OAAO,KAAKC;CACd;CAEA,kBAAiC;EAC/B,OAAO,KAAKC,kBAAkB;CAChC;AACF"}
|
|
@@ -31,7 +31,10 @@ function useQuery(querySignal, options) {
|
|
|
31
31
|
if (!query) return void 0;
|
|
32
32
|
return asQueryInternals(query);
|
|
33
33
|
});
|
|
34
|
-
const hash = createMemo(() =>
|
|
34
|
+
const hash = createMemo(() => {
|
|
35
|
+
const internals = qi();
|
|
36
|
+
return internals === void 0 ? void 0 : internals.hash() + zero().clientID;
|
|
37
|
+
});
|
|
35
38
|
const ttl = createMemo(() => normalize(options)?.ttl ?? 3e5);
|
|
36
39
|
const initialTTL = ttl();
|
|
37
40
|
const view = createMemo(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-query.js","names":[],"sources":["../../../../zero-solid/src/use-query.ts"],"sourcesContent":["import {\n createEffect,\n createMemo,\n createSignal,\n on,\n onCleanup,\n untrack,\n type Accessor,\n} from 'solid-js';\nimport {createStore} from 'solid-js/store';\nimport {\n addContextToQuery,\n asQueryInternals,\n DEFAULT_TTL_MS,\n} from './bindings.ts';\nimport {createSolidViewFactory, UNKNOWN, type State} from './solid-view.ts';\nimport {useZero} from './use-zero.ts';\nimport {\n type BaseDefaultContext,\n type BaseDefaultSchema,\n type DefaultContext,\n type DefaultSchema,\n type Falsy,\n type HumanReadable,\n type PullRow,\n type QueryOrQueryRequest,\n type QueryResultDetails,\n type ReadonlyJSONValue,\n type TTL,\n} from './zero.ts';\n\nexport type QueryResult<TReturn> = readonly [\n Accessor<HumanReadable<TReturn>>,\n Accessor<QueryResultDetails & {}>,\n];\n\n/**\n * Result type for \"maybe queries\" - queries that may be falsy.\n * The data value can be undefined when the query is falsy/disabled.\n */\nexport type MaybeQueryResult<TReturn> = readonly [\n Accessor<HumanReadable<TReturn> | undefined>,\n Accessor<QueryResultDetails & {}>,\n];\n\n// Deprecated in 0.22\n/**\n * @deprecated Use {@linkcode UseQueryOptions} instead.\n */\nexport type CreateQueryOptions = {\n ttl?: TTL | undefined;\n};\n\nexport type UseQueryOptions = {\n ttl?: TTL | undefined;\n};\n\n// Deprecated in 0.22\n/**\n * @deprecated Use {@linkcode useQuery} instead.\n */\nexport function createQuery<\n TTable extends keyof TSchema['tables'] & string,\n TInput extends ReadonlyJSONValue | undefined,\n TOutput extends ReadonlyJSONValue | undefined,\n TSchema extends BaseDefaultSchema = DefaultSchema,\n TReturn = PullRow<TTable, TSchema>,\n TContext extends BaseDefaultContext = DefaultContext,\n>(\n querySignal: Accessor<\n QueryOrQueryRequest<TTable, TInput, TOutput, TSchema, TReturn, TContext>\n >,\n options?: CreateQueryOptions | Accessor<CreateQueryOptions>,\n): QueryResult<TReturn> {\n return useQuery(querySignal, options);\n}\n\n// Overload 1: Query - returns QueryResult<TReturn>\nexport function useQuery<\n TTable extends keyof TSchema['tables'] & string,\n TInput extends ReadonlyJSONValue | undefined,\n TOutput extends ReadonlyJSONValue | undefined,\n TSchema extends BaseDefaultSchema = DefaultSchema,\n TReturn = PullRow<TTable, TSchema>,\n TContext extends BaseDefaultContext = DefaultContext,\n>(\n querySignal: Accessor<\n QueryOrQueryRequest<TTable, TInput, TOutput, TSchema, TReturn, TContext>\n >,\n options?: UseQueryOptions | Accessor<UseQueryOptions>,\n): QueryResult<TReturn>;\n\n// Overload 2: Maybe query\nexport function useQuery<\n TTable extends keyof TSchema['tables'] & string,\n TInput extends ReadonlyJSONValue | undefined,\n TOutput extends ReadonlyJSONValue | undefined,\n TSchema extends BaseDefaultSchema = DefaultSchema,\n TReturn = PullRow<TTable, TSchema>,\n TContext extends BaseDefaultContext = DefaultContext,\n>(\n querySignal: Accessor<\n | QueryOrQueryRequest<TTable, TInput, TOutput, TSchema, TReturn, TContext>\n | Falsy\n >,\n options?: UseQueryOptions | Accessor<UseQueryOptions>,\n): MaybeQueryResult<TReturn>;\n\n// Implementation\nexport function useQuery<\n TTable extends keyof TSchema['tables'] & string,\n TInput extends ReadonlyJSONValue | undefined,\n TOutput extends ReadonlyJSONValue | undefined,\n TSchema extends BaseDefaultSchema = DefaultSchema,\n TReturn = PullRow<TTable, TSchema>,\n TContext extends BaseDefaultContext = DefaultContext,\n>(\n querySignal: Accessor<\n | QueryOrQueryRequest<TTable, TInput, TOutput, TSchema, TReturn, TContext>\n | Falsy\n >,\n options?: UseQueryOptions | Accessor<UseQueryOptions>,\n): QueryResult<TReturn> | MaybeQueryResult<TReturn> {\n const [state, setState] = createStore<State>([\n {\n '': undefined,\n },\n UNKNOWN,\n ]);\n const initialRefetchKey = 0;\n const [refetchKey, setRefetchKey] = createSignal(initialRefetchKey);\n\n const refetch = () => {\n setRefetchKey(k => k + 1);\n };\n\n const zero = useZero<TSchema, undefined, TContext>();\n\n // Handle possibly falsy queries\n const q = createMemo(() => {\n const query = querySignal();\n if (!query) return undefined;\n return addContextToQuery(query, zero().context);\n });\n\n const qi = createMemo(() => {\n const query = q();\n if (!query) return undefined;\n return asQueryInternals(query);\n });\n\n const hash = createMemo(() => qi()
|
|
1
|
+
{"version":3,"file":"use-query.js","names":[],"sources":["../../../../zero-solid/src/use-query.ts"],"sourcesContent":["import {\n createEffect,\n createMemo,\n createSignal,\n on,\n onCleanup,\n untrack,\n type Accessor,\n} from 'solid-js';\nimport {createStore} from 'solid-js/store';\nimport {\n addContextToQuery,\n asQueryInternals,\n DEFAULT_TTL_MS,\n} from './bindings.ts';\nimport {createSolidViewFactory, UNKNOWN, type State} from './solid-view.ts';\nimport {useZero} from './use-zero.ts';\nimport {\n type BaseDefaultContext,\n type BaseDefaultSchema,\n type DefaultContext,\n type DefaultSchema,\n type Falsy,\n type HumanReadable,\n type PullRow,\n type QueryOrQueryRequest,\n type QueryResultDetails,\n type ReadonlyJSONValue,\n type TTL,\n} from './zero.ts';\n\nexport type QueryResult<TReturn> = readonly [\n Accessor<HumanReadable<TReturn>>,\n Accessor<QueryResultDetails & {}>,\n];\n\n/**\n * Result type for \"maybe queries\" - queries that may be falsy.\n * The data value can be undefined when the query is falsy/disabled.\n */\nexport type MaybeQueryResult<TReturn> = readonly [\n Accessor<HumanReadable<TReturn> | undefined>,\n Accessor<QueryResultDetails & {}>,\n];\n\n// Deprecated in 0.22\n/**\n * @deprecated Use {@linkcode UseQueryOptions} instead.\n */\nexport type CreateQueryOptions = {\n ttl?: TTL | undefined;\n};\n\nexport type UseQueryOptions = {\n ttl?: TTL | undefined;\n};\n\n// Deprecated in 0.22\n/**\n * @deprecated Use {@linkcode useQuery} instead.\n */\nexport function createQuery<\n TTable extends keyof TSchema['tables'] & string,\n TInput extends ReadonlyJSONValue | undefined,\n TOutput extends ReadonlyJSONValue | undefined,\n TSchema extends BaseDefaultSchema = DefaultSchema,\n TReturn = PullRow<TTable, TSchema>,\n TContext extends BaseDefaultContext = DefaultContext,\n>(\n querySignal: Accessor<\n QueryOrQueryRequest<TTable, TInput, TOutput, TSchema, TReturn, TContext>\n >,\n options?: CreateQueryOptions | Accessor<CreateQueryOptions>,\n): QueryResult<TReturn> {\n return useQuery(querySignal, options);\n}\n\n// Overload 1: Query - returns QueryResult<TReturn>\nexport function useQuery<\n TTable extends keyof TSchema['tables'] & string,\n TInput extends ReadonlyJSONValue | undefined,\n TOutput extends ReadonlyJSONValue | undefined,\n TSchema extends BaseDefaultSchema = DefaultSchema,\n TReturn = PullRow<TTable, TSchema>,\n TContext extends BaseDefaultContext = DefaultContext,\n>(\n querySignal: Accessor<\n QueryOrQueryRequest<TTable, TInput, TOutput, TSchema, TReturn, TContext>\n >,\n options?: UseQueryOptions | Accessor<UseQueryOptions>,\n): QueryResult<TReturn>;\n\n// Overload 2: Maybe query\nexport function useQuery<\n TTable extends keyof TSchema['tables'] & string,\n TInput extends ReadonlyJSONValue | undefined,\n TOutput extends ReadonlyJSONValue | undefined,\n TSchema extends BaseDefaultSchema = DefaultSchema,\n TReturn = PullRow<TTable, TSchema>,\n TContext extends BaseDefaultContext = DefaultContext,\n>(\n querySignal: Accessor<\n | QueryOrQueryRequest<TTable, TInput, TOutput, TSchema, TReturn, TContext>\n | Falsy\n >,\n options?: UseQueryOptions | Accessor<UseQueryOptions>,\n): MaybeQueryResult<TReturn>;\n\n// Implementation\nexport function useQuery<\n TTable extends keyof TSchema['tables'] & string,\n TInput extends ReadonlyJSONValue | undefined,\n TOutput extends ReadonlyJSONValue | undefined,\n TSchema extends BaseDefaultSchema = DefaultSchema,\n TReturn = PullRow<TTable, TSchema>,\n TContext extends BaseDefaultContext = DefaultContext,\n>(\n querySignal: Accessor<\n | QueryOrQueryRequest<TTable, TInput, TOutput, TSchema, TReturn, TContext>\n | Falsy\n >,\n options?: UseQueryOptions | Accessor<UseQueryOptions>,\n): QueryResult<TReturn> | MaybeQueryResult<TReturn> {\n const [state, setState] = createStore<State>([\n {\n '': undefined,\n },\n UNKNOWN,\n ]);\n const initialRefetchKey = 0;\n const [refetchKey, setRefetchKey] = createSignal(initialRefetchKey);\n\n const refetch = () => {\n setRefetchKey(k => k + 1);\n };\n\n const zero = useZero<TSchema, undefined, TContext>();\n\n // Handle possibly falsy queries\n const q = createMemo(() => {\n const query = querySignal();\n if (!query) return undefined;\n return addContextToQuery(query, zero().context);\n });\n\n const qi = createMemo(() => {\n const query = q();\n if (!query) return undefined;\n return asQueryInternals(query);\n });\n\n // Undefined rather than the string `undefined` + the client id: this feeds\n // the guard below, and concatenating a missing hash produced a string that\n // was never equal to undefined, leaving that guard unreachable.\n const hash = createMemo(() => {\n const internals = qi();\n return internals === undefined\n ? undefined\n : internals.hash() + zero().clientID;\n });\n const ttl = createMemo(() => normalize(options)?.ttl ?? DEFAULT_TTL_MS);\n\n const initialTTL = ttl();\n\n const view = createMemo(() => {\n // Depend on hash instead of query to avoid recreating the view when the\n // query object changes but the hash is the same.\n const currentHash = hash();\n refetchKey();\n\n // If query is falsy, don't create a view and reset state to undefined\n if (currentHash === undefined) {\n setState([{'': undefined}, UNKNOWN]);\n return undefined;\n }\n\n const untrackedQuery = untrack(q);\n if (!untrackedQuery) {\n setState([{'': undefined}, UNKNOWN]);\n return undefined;\n }\n\n const v = zero().materialize(\n untrackedQuery,\n createSolidViewFactory(setState, refetch),\n {\n ttl: initialTTL,\n },\n );\n\n onCleanup(() => v.destroy());\n\n return v;\n });\n\n // Update TTL on existing view when it changes.\n createEffect(\n on(\n ttl,\n currentTTL => {\n view()?.updateTTL(currentTTL);\n },\n {defer: true},\n ),\n );\n\n return [() => state[0][''] as HumanReadable<TReturn>, () => state[1]];\n}\n\nfunction normalize<T>(options?: T | Accessor<T | undefined>): T | undefined {\n return typeof options === 'function' ? (options as Accessor<T>)() : options;\n}\n"],"mappings":";;;;;;;;;;;;;AA6DA,SAAgB,YAQd,aAGA,SACsB;CACtB,OAAO,SAAS,aAAa,OAAO;AACtC;AAkCA,SAAgB,SAQd,aAIA,SACkD;CAClD,M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ACF;CAEA,OAAO,OAAO,MAAM,GAAG,WAAqC,MAAM,EAAE;AACtE;AAEA,SAAS,UAAa,SAAsD;CAC1E,OAAO,OAAO,YAAY,aAAc,QAAwB,IAAI;AACtE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../../../../zql/src/builder/builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAEjD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,6BAA6B,CAAC;AAE3D,OAAO,KAAK,EACV,GAAG,EAGH,SAAS,EAIT,WAAW,EAEX,QAAQ,EAIT,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAC,GAAG,EAAC,MAAM,oCAAoC,CAAC;AAC5D,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,2CAA2C,CAAC;AAK1E,OAAO,EAEL,KAAK,WAAW,EACjB,MAAM,4BAA4B,CAAC;AAIpC,OAAO,KAAK,EAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAC,MAAM,oBAAoB,CAAC;AAElE,OAAO,KAAK,EAAC,MAAM,EAAE,WAAW,EAAC,MAAM,kBAAkB,CAAC;AAK1D,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,kCAAkC,CAAC;AAC1E,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,6BAA6B,CAAC;AAE9D,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,qBAAqB,CAAC;AACvD,OAAO,
|
|
1
|
+
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../../../../zql/src/builder/builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAEjD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,6BAA6B,CAAC;AAE3D,OAAO,KAAK,EACV,GAAG,EAGH,SAAS,EAIT,WAAW,EAEX,QAAQ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