@rocicorp/zero 0.25.0-canary.18 → 0.25.0-canary.21
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/persist/idb-databases-store.d.ts +1 -0
- package/out/replicache/src/persist/idb-databases-store.d.ts.map +1 -1
- package/out/replicache/src/persist/idb-databases-store.js +13 -2
- package/out/replicache/src/persist/idb-databases-store.js.map +1 -1
- package/out/zero/package.json.js +1 -1
- package/out/zero/src/adapters/drizzle.d.ts +1 -1
- package/out/zero/src/adapters/drizzle.d.ts.map +1 -1
- package/out/zero/src/adapters/drizzle.js +4 -1
- package/out/zero/src/bindings.d.ts +2 -0
- package/out/zero/src/bindings.d.ts.map +1 -0
- package/out/zero/src/bindings.js +27 -0
- package/out/zero/src/bindings.js.map +1 -0
- package/out/zero/src/react.js +2 -4
- package/out/zero/src/react.js.map +1 -1
- package/out/zero/src/solid.js +2 -2
- package/out/zero/src/zero.js +3 -5
- package/out/zero-cache/src/auth/read-authorizer.d.ts +1 -1
- package/out/zero-cache/src/auth/read-authorizer.d.ts.map +1 -1
- package/out/zero-cache/src/auth/read-authorizer.js.map +1 -1
- package/out/zero-cache/src/auth/write-authorizer.d.ts.map +1 -1
- package/out/zero-cache/src/auth/write-authorizer.js +5 -4
- package/out/zero-cache/src/auth/write-authorizer.js.map +1 -1
- package/out/zero-cache/src/config/zero-config.d.ts +24 -0
- package/out/zero-cache/src/config/zero-config.d.ts.map +1 -1
- package/out/zero-cache/src/config/zero-config.js +23 -4
- package/out/zero-cache/src/config/zero-config.js.map +1 -1
- package/out/zero-cache/src/server/anonymous-otel-start.d.ts +10 -1
- package/out/zero-cache/src/server/anonymous-otel-start.d.ts.map +1 -1
- package/out/zero-cache/src/server/anonymous-otel-start.js +34 -18
- package/out/zero-cache/src/server/anonymous-otel-start.js.map +1 -1
- package/out/zero-cache/src/server/syncer.d.ts.map +1 -1
- package/out/zero-cache/src/server/syncer.js +1 -0
- package/out/zero-cache/src/server/syncer.js.map +1 -1
- package/out/zero-cache/src/services/analyze.d.ts +1 -1
- package/out/zero-cache/src/services/analyze.d.ts.map +1 -1
- package/out/zero-cache/src/services/analyze.js +5 -5
- package/out/zero-cache/src/services/analyze.js.map +1 -1
- package/out/zero-cache/src/services/mutagen/pusher.d.ts +4 -4
- package/out/zero-cache/src/services/view-syncer/active-users-gauge.d.ts +2 -1
- package/out/zero-cache/src/services/view-syncer/active-users-gauge.d.ts.map +1 -1
- package/out/zero-cache/src/services/view-syncer/active-users-gauge.js +26 -13
- package/out/zero-cache/src/services/view-syncer/active-users-gauge.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/cvr-purger.d.ts +1 -1
- package/out/zero-cache/src/services/view-syncer/cvr-purger.d.ts.map +1 -1
- package/out/zero-cache/src/services/view-syncer/cvr-purger.js +39 -15
- package/out/zero-cache/src/services/view-syncer/cvr-purger.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/cvr-store.d.ts +4 -1
- package/out/zero-cache/src/services/view-syncer/cvr-store.d.ts.map +1 -1
- package/out/zero-cache/src/services/view-syncer/cvr-store.js +31 -9
- package/out/zero-cache/src/services/view-syncer/cvr-store.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/cvr.d.ts +3 -0
- package/out/zero-cache/src/services/view-syncer/cvr.d.ts.map +1 -1
- package/out/zero-cache/src/services/view-syncer/cvr.js +11 -0
- package/out/zero-cache/src/services/view-syncer/cvr.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/inspect-handler.js +1 -1
- package/out/zero-cache/src/services/view-syncer/inspect-handler.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/pipeline-driver.d.ts +1 -2
- package/out/zero-cache/src/services/view-syncer/pipeline-driver.d.ts.map +1 -1
- package/out/zero-cache/src/services/view-syncer/pipeline-driver.js +6 -6
- package/out/zero-cache/src/services/view-syncer/pipeline-driver.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/schema/cvr.d.ts +1 -0
- package/out/zero-cache/src/services/view-syncer/schema/cvr.d.ts.map +1 -1
- package/out/zero-cache/src/services/view-syncer/schema/cvr.js +23 -10
- package/out/zero-cache/src/services/view-syncer/schema/cvr.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/schema/init.d.ts.map +1 -1
- package/out/zero-cache/src/services/view-syncer/schema/init.js +31 -1
- package/out/zero-cache/src/services/view-syncer/schema/init.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/view-syncer.d.ts +1 -0
- package/out/zero-cache/src/services/view-syncer/view-syncer.d.ts.map +1 -1
- package/out/zero-cache/src/services/view-syncer/view-syncer.js +20 -16
- package/out/zero-cache/src/services/view-syncer/view-syncer.js.map +1 -1
- package/out/zero-cache/src/workers/connect-params.d.ts +1 -0
- package/out/zero-cache/src/workers/connect-params.d.ts.map +1 -1
- package/out/zero-cache/src/workers/connect-params.js +2 -0
- package/out/zero-cache/src/workers/connect-params.js.map +1 -1
- package/out/zero-cache/src/workers/syncer-ws-message-handler.d.ts.map +1 -1
- package/out/zero-cache/src/workers/syncer-ws-message-handler.js +2 -0
- package/out/zero-cache/src/workers/syncer-ws-message-handler.js.map +1 -1
- package/out/zero-client/src/client/bindings.d.ts +12 -41
- package/out/zero-client/src/client/bindings.d.ts.map +1 -1
- package/out/zero-client/src/client/custom.d.ts +3 -0
- package/out/zero-client/src/client/custom.d.ts.map +1 -1
- package/out/zero-client/src/client/custom.js +3 -0
- package/out/zero-client/src/client/custom.js.map +1 -1
- package/out/zero-client/src/client/delete-clients-manager.d.ts +1 -1
- package/out/zero-client/src/client/delete-clients-manager.d.ts.map +1 -1
- package/out/zero-client/src/client/delete-clients-manager.js +30 -3
- package/out/zero-client/src/client/delete-clients-manager.js.map +1 -1
- package/out/zero-client/src/client/make-replicache-mutators.js +1 -3
- package/out/zero-client/src/client/make-replicache-mutators.js.map +1 -1
- package/out/zero-client/src/client/options.d.ts +1 -1
- package/out/zero-client/src/client/options.js.map +1 -1
- package/out/zero-client/src/client/version.js +1 -1
- package/out/zero-client/src/client/zero.d.ts +1 -0
- package/out/zero-client/src/client/zero.d.ts.map +1 -1
- package/out/zero-client/src/client/zero.js +43 -26
- package/out/zero-client/src/client/zero.js.map +1 -1
- package/out/zero-client/src/mod.d.ts +6 -4
- package/out/zero-client/src/mod.d.ts.map +1 -1
- package/out/zero-protocol/src/analyze-query-result.d.ts +2 -2
- package/out/zero-protocol/src/analyze-query-result.js +2 -2
- package/out/zero-protocol/src/analyze-query-result.js.map +1 -1
- package/out/zero-protocol/src/down.d.ts +2 -2
- package/out/zero-protocol/src/inspect-down.d.ts +6 -6
- package/out/zero-protocol/src/inspect-up.d.ts +4 -4
- package/out/zero-protocol/src/inspect-up.js +1 -1
- package/out/zero-protocol/src/inspect-up.js.map +1 -1
- 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 +1 -1
- package/out/zero-protocol/src/protocol-version.js.map +1 -1
- package/out/zero-protocol/src/up.d.ts +1 -1
- package/out/zero-react/src/bindings.d.ts +2 -0
- package/out/zero-react/src/bindings.d.ts.map +1 -0
- package/out/zero-react/src/mod.d.ts +1 -10
- package/out/zero-react/src/mod.d.ts.map +1 -1
- package/out/zero-react/src/{use-zero-connection-state.d.ts → use-connection-state.d.ts} +3 -3
- package/out/zero-react/src/use-connection-state.d.ts.map +1 -0
- package/out/zero-react/src/{use-zero-connection-state.js → use-connection-state.js} +3 -3
- package/out/zero-react/src/use-connection-state.js.map +1 -0
- package/out/zero-react/src/use-query.d.ts +2 -10
- package/out/zero-react/src/use-query.d.ts.map +1 -1
- package/out/zero-react/src/use-query.js +24 -22
- package/out/zero-react/src/use-query.js.map +1 -1
- package/out/zero-react/src/use-zero-online.d.ts +1 -1
- package/out/zero-react/src/use-zero-online.js.map +1 -1
- package/out/zero-react/src/zero-provider.d.ts +1 -5
- package/out/zero-react/src/zero-provider.d.ts.map +1 -1
- package/out/zero-react/src/zero-provider.js +16 -0
- package/out/zero-react/src/zero-provider.js.map +1 -1
- package/out/zero-react/src/zero.d.ts +2 -0
- package/out/zero-react/src/zero.d.ts.map +1 -0
- package/out/zero-schema/src/permissions.d.ts.map +1 -1
- package/out/zero-schema/src/permissions.js +2 -8
- package/out/zero-schema/src/permissions.js.map +1 -1
- package/out/zero-server/src/custom.d.ts +3 -0
- package/out/zero-server/src/custom.d.ts.map +1 -1
- package/out/zero-server/src/custom.js +3 -0
- package/out/zero-server/src/custom.js.map +1 -1
- package/out/zero-solid/src/bindings.d.ts +2 -0
- package/out/zero-solid/src/bindings.d.ts.map +1 -0
- package/out/zero-solid/src/mod.d.ts +1 -8
- package/out/zero-solid/src/mod.d.ts.map +1 -1
- package/out/zero-solid/src/solid-view.d.ts +1 -8
- package/out/zero-solid/src/solid-view.d.ts.map +1 -1
- package/out/zero-solid/src/solid-view.js +31 -0
- package/out/zero-solid/src/solid-view.js.map +1 -1
- package/out/zero-solid/src/{use-zero-connection-state.d.ts → use-connection-state.d.ts} +3 -3
- package/out/zero-solid/src/use-connection-state.d.ts.map +1 -0
- package/out/zero-solid/src/{use-zero-connection-state.js → use-connection-state.js} +3 -3
- package/out/zero-solid/src/use-connection-state.js.map +1 -0
- package/out/zero-solid/src/use-query.d.ts +1 -7
- package/out/zero-solid/src/use-query.d.ts.map +1 -1
- package/out/zero-solid/src/use-query.js +43 -12
- package/out/zero-solid/src/use-query.js.map +1 -1
- package/out/zero-solid/src/use-zero-online.d.ts +1 -1
- package/out/zero-solid/src/use-zero-online.js.map +1 -1
- package/out/zero-solid/src/use-zero.d.ts +1 -5
- package/out/zero-solid/src/use-zero.d.ts.map +1 -1
- package/out/zero-solid/src/use-zero.js +16 -0
- package/out/zero-solid/src/use-zero.js.map +1 -1
- package/out/zero-solid/src/zero.d.ts +2 -0
- package/out/zero-solid/src/zero.d.ts.map +1 -0
- package/out/zql/src/ivm/flipped-join.d.ts.map +1 -1
- package/out/zql/src/ivm/flipped-join.js +29 -27
- package/out/zql/src/ivm/flipped-join.js.map +1 -1
- package/out/zql/src/ivm/join-utils.d.ts +7 -1
- package/out/zql/src/ivm/join-utils.d.ts.map +1 -1
- package/out/zql/src/ivm/join-utils.js +12 -0
- package/out/zql/src/ivm/join-utils.js.map +1 -1
- package/out/zql/src/ivm/join.d.ts.map +1 -1
- package/out/zql/src/ivm/join.js +11 -25
- package/out/zql/src/ivm/join.js.map +1 -1
- package/out/zql/src/mutate/custom.d.ts +3 -0
- package/out/zql/src/mutate/custom.d.ts.map +1 -1
- package/out/zql/src/mutate/custom.js.map +1 -1
- package/out/zql/src/mutate/mutator-registry.d.ts +2 -2
- package/out/zql/src/mutate/mutator-registry.d.ts.map +1 -1
- package/out/zql/src/mutate/mutator-registry.js.map +1 -1
- package/out/zql/src/mutate/mutator.d.ts +1 -1
- package/out/zql/src/mutate/mutator.d.ts.map +1 -1
- package/out/zql/src/mutate/mutator.js.map +1 -1
- package/out/zql/src/planner/planner-debug.d.ts +3 -3
- package/out/zql/src/planner/planner-debug.js.map +1 -1
- package/out/zql/src/query/create-builder.d.ts +2 -1
- package/out/zql/src/query/create-builder.d.ts.map +1 -1
- package/out/zql/src/query/create-builder.js +3 -0
- package/out/zql/src/query/create-builder.js.map +1 -1
- package/out/zql/src/query/query-impl.d.ts +39 -6
- package/out/zql/src/query/query-impl.d.ts.map +1 -1
- package/out/zql/src/query/query-impl.js +414 -23
- package/out/zql/src/query/query-impl.js.map +1 -1
- package/out/zql/src/query/query-registry.d.ts +2 -2
- package/out/zql/src/query/query-registry.d.ts.map +1 -1
- package/out/zql/src/query/query-registry.js.map +1 -1
- package/out/zql/src/query/runnable-query-impl.d.ts +2 -2
- package/out/zql/src/query/runnable-query-impl.d.ts.map +1 -1
- package/out/zql/src/query/runnable-query-impl.js +2 -2
- package/out/zql/src/query/runnable-query-impl.js.map +1 -1
- package/out/zql/src/query/schema-query.d.ts +4 -2
- package/out/zql/src/query/schema-query.d.ts.map +1 -1
- package/out/zql/src/query/static-query.d.ts +2 -16
- package/out/zql/src/query/static-query.d.ts.map +1 -1
- package/out/zql/src/query/static-query.js +10 -37
- package/out/zql/src/query/static-query.js.map +1 -1
- package/package.json +7 -3
- package/out/zero-client/src/client/bindings.js +0 -33
- package/out/zero-client/src/client/bindings.js.map +0 -1
- package/out/zero-react/src/components/inspector.d.ts +0 -9
- package/out/zero-react/src/components/inspector.d.ts.map +0 -1
- package/out/zero-react/src/components/inspector.js +0 -38
- package/out/zero-react/src/components/inspector.js.map +0 -1
- package/out/zero-react/src/components/mark-icon.d.ts +0 -3
- package/out/zero-react/src/components/mark-icon.d.ts.map +0 -1
- package/out/zero-react/src/components/mark-icon.js +0 -28
- package/out/zero-react/src/components/mark-icon.js.map +0 -1
- package/out/zero-react/src/components/zero-inspector.d.ts +0 -8
- package/out/zero-react/src/components/zero-inspector.d.ts.map +0 -1
- package/out/zero-react/src/components/zero-inspector.js +0 -44
- package/out/zero-react/src/components/zero-inspector.js.map +0 -1
- package/out/zero-react/src/use-zero-connection-state.d.ts.map +0 -1
- package/out/zero-react/src/use-zero-connection-state.js.map +0 -1
- package/out/zero-solid/src/use-zero-connection-state.d.ts.map +0 -1
- package/out/zero-solid/src/use-zero-connection-state.js.map +0 -1
- package/out/zql/src/query/abstract-query.d.ts +0 -42
- package/out/zql/src/query/abstract-query.d.ts.map +0 -1
- package/out/zql/src/query/abstract-query.js +0 -405
- package/out/zql/src/query/abstract-query.js.map +0 -1
|
@@ -7,13 +7,15 @@ export { makeIDBName } from '../../replicache/src/make-idb-name.ts';
|
|
|
7
7
|
export { dropAllDatabases, dropDatabase, } from '../../replicache/src/persist/collect-idb-databases.ts';
|
|
8
8
|
export type { ClientGroupID, ClientID } from '../../replicache/src/sync/ids.ts';
|
|
9
9
|
export { TransactionClosedError } from '../../replicache/src/transaction-closed-error.ts';
|
|
10
|
+
export type { Expand } from '../../shared/src/expand.ts';
|
|
10
11
|
export type { JSONObject, JSONValue, ReadonlyJSONObject, ReadonlyJSONValue, } from '../../shared/src/json.ts';
|
|
11
12
|
export type { MaybePromise } from '../../shared/src/types.ts';
|
|
12
13
|
export type { AnalyzeQueryResult, PlanDebugEventJSON, } from '../../zero-protocol/src/analyze-query-result.ts';
|
|
13
14
|
export { ApplicationError } from '../../zero-protocol/src/application-error.ts';
|
|
14
15
|
export type { ApplicationErrorOptions } from '../../zero-protocol/src/application-error.ts';
|
|
15
16
|
export type { AST, Bound, ColumnReference, CompoundKey, Condition, Conjunction, CorrelatedSubquery, CorrelatedSubqueryCondition, CorrelatedSubqueryConditionOperator, Disjunction, EqualityOps, InOps, LikeOps, LiteralReference, LiteralValue, Ordering, OrderOps, OrderPart, Parameter, SimpleCondition, SimpleOperator, ValuePosition, } from '../../zero-protocol/src/ast.ts';
|
|
16
|
-
export { transformRequestMessageSchema, transformResponseMessageSchema, type TransformRequestBody, type TransformRequestMessage, type TransformResponseBody, type TransformResponseMessage, } from '../../zero-protocol/src/custom-queries.ts';
|
|
17
|
+
export { transformRequestMessageSchema, transformResponseMessageSchema, type ErroredQuery, type TransformRequestBody, type TransformRequestMessage, type TransformResponseBody, type TransformResponseMessage, } from '../../zero-protocol/src/custom-queries.ts';
|
|
18
|
+
export type { PrimaryKey } from '../../zero-protocol/src/primary-key.ts';
|
|
17
19
|
export { relationships } from '../../zero-schema/src/builder/relationship-builder.ts';
|
|
18
20
|
export { createSchema } from '../../zero-schema/src/builder/schema-builder.ts';
|
|
19
21
|
export { boolean, enumeration, json, number, string, table, type ColumnBuilder, type TableBuilderWithColumns, } from '../../zero-schema/src/builder/table-builder.ts';
|
|
@@ -28,8 +30,7 @@ export type { Change } from '../../zql/src/ivm/change.ts';
|
|
|
28
30
|
export type { Node } from '../../zql/src/ivm/data.ts';
|
|
29
31
|
export type { Input, Output } from '../../zql/src/ivm/operator.ts';
|
|
30
32
|
export type { Stream } from '../../zql/src/ivm/stream.ts';
|
|
31
|
-
export {
|
|
32
|
-
export type { AnyViewFactory, Entry, Format, View, ViewFactory, } from '../../zql/src/ivm/view.ts';
|
|
33
|
+
export type { AnyViewFactory, Entry, EntryList, Format, View, ViewFactory, } from '../../zql/src/ivm/view.ts';
|
|
33
34
|
export { createCRUDBuilder } from '../../zql/src/mutate/crud.ts';
|
|
34
35
|
export type { CRUDMutator, SchemaCRUDMutators, TableCRUDMutators, TableMutator, } from '../../zql/src/mutate/crud.ts';
|
|
35
36
|
export type { AnyTransaction, DeleteID, InsertValue, Location, ServerTransaction, Transaction, TransactionReason, UpdateValue, UpsertValue, } from '../../zql/src/mutate/custom.ts';
|
|
@@ -41,11 +42,12 @@ export type { ExpressionBuilder, ExpressionFactory, } from '../../zql/src/query/
|
|
|
41
42
|
export { syncedQuery, syncedQueryWithContext, withValidation, type CustomQueryID, type HasParseFn, type ParseFn, type Parser, type QueryFn, type SyncedQuery, } from '../../zql/src/query/named.ts';
|
|
42
43
|
export type { QueryInternals } from '../../zql/src/query/query-internals.ts';
|
|
43
44
|
export { defineQueries, defineQueriesWithType, defineQuery, defineQueryWithType, getQuery, isQuery, isQueryDefinition, isQueryRegistry, mustGetQuery, type AnyCustomQuery, type AnyQueryDefinition, type AnyQueryRegistry, type CustomQuery, type FromQueryTree, type QueryDefinition, type QueryDefinitions, type QueryOrQueryRequest, type QueryRegistry, type QueryRequest, } from '../../zql/src/query/query-registry.ts';
|
|
45
|
+
export { type MaterializeOptions } from '../../zql/src/query/query.ts';
|
|
44
46
|
export type { AnyQuery, HumanReadable, PullRow, Query, QueryResultType, QueryRowType, Row, RunOptions, ZeRow, } from '../../zql/src/query/query.ts';
|
|
45
47
|
export type { SchemaQuery } from '../../zql/src/query/schema-query.ts';
|
|
46
48
|
export { type TTL } from '../../zql/src/query/ttl.ts';
|
|
47
49
|
export type { ResultType, TypedView } from '../../zql/src/query/typed-view.ts';
|
|
48
|
-
export {
|
|
50
|
+
export { ConnectionStatus } from './client/connection-status.ts';
|
|
49
51
|
export type { Connection, ConnectionSource, ConnectionState, Source, } from './client/connection.ts';
|
|
50
52
|
export type { BatchMutator, DBMutator } from './client/crud.ts';
|
|
51
53
|
export type { CustomMutatorDefs, CustomMutatorImpl, MakeCustomMutatorInterface, MakeCustomMutatorInterfaces, MutatorResultDetails, MutatorResultErrorDetails, MutatorResultSuccessDetails, MutatorResult as PromiseWithServerResult, } from './client/custom.ts';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../../zero-client/src/mod.ts"],"names":[],"mappings":"AAAA,YAAY,EAAC,2BAA2B,EAAC,MAAM,yCAAyC,CAAC;AACzF,OAAO,EAAC,gBAAgB,EAAC,MAAM,4CAA4C,CAAC;AAC5E,YAAY,EAAC,eAAe,EAAC,MAAM,2CAA2C,CAAC;AAC/E,OAAO,EAAC,gBAAgB,EAAC,MAAM,sCAAsC,CAAC;AACtE,YAAY,EACV,WAAW,IAAI,aAAa,EAC5B,IAAI,IAAI,MAAM,EACd,KAAK,IAAI,OAAO,EAChB,KAAK,IAAI,OAAO,GACjB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAC,WAAW,EAAC,MAAM,uCAAuC,CAAC;AAClE,OAAO,EACL,gBAAgB,EAChB,YAAY,GACb,MAAM,uDAAuD,CAAC;AAC/D,YAAY,EAAC,aAAa,EAAE,QAAQ,EAAC,MAAM,kCAAkC,CAAC;AAC9E,OAAO,EAAC,sBAAsB,EAAC,MAAM,kDAAkD,CAAC;AACxF,YAAY,EACV,UAAU,EACV,SAAS,EACT,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,0BAA0B,CAAC;AAClC,YAAY,EAAC,YAAY,EAAC,MAAM,2BAA2B,CAAC;AAC5D,YAAY,EACV,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,iDAAiD,CAAC;AACzD,OAAO,EAAC,gBAAgB,EAAC,MAAM,8CAA8C,CAAC;AAC9E,YAAY,EAAC,uBAAuB,EAAC,MAAM,8CAA8C,CAAC;AAC1F,YAAY,EACV,GAAG,EACH,KAAK,EACL,eAAe,EACf,WAAW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,EAC1B,2BAA2B,EAC3B,oBAAoB,EACpB,yBAAyB,EACzB,2BAA2B,EAC3B,aAAa,IAAI,uBAAuB,GACzC,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAC,WAAW,IAAI,oBAAoB,EAAC,MAAM,oCAAoC,CAAC;AAC5F,YAAY,EAAC,MAAM,IAAI,eAAe,EAAC,MAAM,8BAA8B,CAAC;AAC5E,YAAY,EAAC,SAAS,EAAC,MAAM,iCAAiC,CAAC;AAC/D,YAAY,EAAC,KAAK,IAAI,cAAc,EAAC,MAAM,6BAA6B,CAAC;AACzE,YAAY,EAAC,kBAAkB,EAAE,WAAW,EAAC,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAC,sBAAsB,EAAC,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAC,IAAI,EAAC,MAAM,kBAAkB,CAAC;AACtC,YAAY,EACV,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,yBAAyB,CAAC"}
|
|
@@ -157,12 +157,12 @@ export declare const analyzeQueryResultSchema: v.ObjectType<{
|
|
|
157
157
|
vendedRowCounts: v.Optional<Record<string, Record<string, number>>>;
|
|
158
158
|
/** @deprecated Use readRows */
|
|
159
159
|
vendedRows: v.Optional<Record<string, Record<string, Readonly<Record<string, import("../../shared/src/json.ts").ReadonlyJSONValue | undefined>>[]>>>;
|
|
160
|
-
|
|
160
|
+
sqlitePlans: v.Optional<Record<string, string[]>>;
|
|
161
161
|
readRows: v.Optional<Record<string, Record<string, Readonly<Record<string, import("../../shared/src/json.ts").ReadonlyJSONValue | undefined>>[]>>>;
|
|
162
162
|
readRowCountsByQuery: v.Optional<Record<string, Record<string, number>>>;
|
|
163
163
|
readRowCount: v.Optional<number>;
|
|
164
164
|
dbScansByQuery: v.Optional<Record<string, Record<string, number>>>;
|
|
165
|
-
|
|
165
|
+
joinPlans: v.Optional<({
|
|
166
166
|
type: "attempt-start";
|
|
167
167
|
attemptNumber: number;
|
|
168
168
|
totalAttempts: number;
|
|
@@ -138,12 +138,12 @@ const analyzeQueryResultSchema = object({
|
|
|
138
138
|
vendedRowCounts: rowCountsBySourceSchema.optional(),
|
|
139
139
|
/** @deprecated Use readRows */
|
|
140
140
|
vendedRows: rowsBySourceSchema.optional(),
|
|
141
|
-
|
|
141
|
+
sqlitePlans: record(array(string())).optional(),
|
|
142
142
|
readRows: rowsBySourceSchema.optional(),
|
|
143
143
|
readRowCountsByQuery: rowCountsBySourceSchema.optional(),
|
|
144
144
|
readRowCount: number().optional(),
|
|
145
145
|
dbScansByQuery: rowCountsBySourceSchema.optional(),
|
|
146
|
-
|
|
146
|
+
joinPlans: array(planDebugEventJSONSchema).optional()
|
|
147
147
|
});
|
|
148
148
|
export {
|
|
149
149
|
analyzeQueryResultSchema,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analyze-query-result.js","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
|
|
1
|
+
{"version":3,"file":"analyze-query-result.js","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"],"names":["v.record","v.number","v.array","v.object","v.union","v.unknown","v.null","v.literal","v.string","v.boolean"],"mappings":";;;;AAKO,MAAM,yBAAyBA,OAASC,QAAU;AAGlD,MAAM,0BAA0BD,OAAS,sBAAsB;AAG/D,MAAM,oBAAoBA,OAASE,MAAQ,SAAS,CAAC;AAGrD,MAAM,qBAAqBF,OAAS,iBAAiB;AAK5D,MAAM,yBAAyBG,OAAS;AAAA,EACtC,aAAaF,OAAE;AAAA,EACf,SAASA,OAAE;AAAA,EACX,MAAMA,OAAE;AAAA,EACR,cAAcA,OAAE;AAAA,EAChB,aAAaA,OAAE;AAAA,EACf,OAAOA,OAAE,EAAS,SAAA;AACpB,CAAC;AAED,MAAM,0BAA0BD,OAASI,MAAQC,QAAE,GAAWC,MAAE,CAAM,CAAC;AAEvE,MAAM,8BAA8BH,OAAS;AAAA,EAC3C,MAAMI,QAAU,eAAe;AAAA,EAC/B,eAAeN,OAAE;AAAA,EACjB,eAAeA,OAAE;AACnB,CAAC;AAED,MAAM,iCAAiCE,OAAS;AAAA,EAC9C,MAAMI,QAAU,kBAAkB;AAAA,EAClC,eAAeN,OAAE;AAAA,EACjB,OAAOC;AAAAA,IACLC,OAAS;AAAA,MACP,YAAYK,OAAE;AAAA,MACd,MAAMP,OAAE;AAAA,MACR,c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AAE,EAAS,SAAA;AAAA,EACpB,kBAAkBO,OAAE,EAAS,SAAA;AAAA;AAAA,EAE7B,iBAAiB,wBAAwB,SAAA;AAAA;AAAA,EAEzC,YAAY,mBAAmB,SAAA;AAAA,EAC/B,aAAaR,OAASE,MAAQM,OAAE,CAAQ,CAAC,EAAE,SAAA;AAAA,EAC3C,UAAU,mBAAmB,SAAA;AAAA,EAC7B,sBAAsB,wBAAwB,SAAA;AAAA,EAC9C,cAAcP,OAAE,EAAS,SAAA;AAAA,EACzB,gBAAgB,wBAAwB,SAAA;AAAA,EACxC,WAAWC,MAAQ,wBAAwB,EAAE,SAAA;AAC/C,CAAC;"}
|
|
@@ -182,12 +182,12 @@ export declare const downstreamSchema: v.UnionType<[v.TupleType<[v.Type<"connect
|
|
|
182
182
|
afterPermissions: v.Optional<string>;
|
|
183
183
|
vendedRowCounts: v.Optional<Record<string, Record<string, number>>>;
|
|
184
184
|
vendedRows: v.Optional<Record<string, Record<string, Readonly<Record<string, import("../../shared/src/json.ts").ReadonlyJSONValue | undefined>>[]>>>;
|
|
185
|
-
|
|
185
|
+
sqlitePlans: v.Optional<Record<string, string[]>>;
|
|
186
186
|
readRows: v.Optional<Record<string, Record<string, Readonly<Record<string, import("../../shared/src/json.ts").ReadonlyJSONValue | undefined>>[]>>>;
|
|
187
187
|
readRowCountsByQuery: v.Optional<Record<string, Record<string, number>>>;
|
|
188
188
|
readRowCount: v.Optional<number>;
|
|
189
189
|
dbScansByQuery: v.Optional<Record<string, Record<string, number>>>;
|
|
190
|
-
|
|
190
|
+
joinPlans: v.Optional<({
|
|
191
191
|
type: "attempt-start";
|
|
192
192
|
attemptNumber: number;
|
|
193
193
|
totalAttempts: number;
|
|
@@ -80,12 +80,12 @@ export declare const inspectAnalyzeQueryDownSchema: v.ObjectType<Omit<{
|
|
|
80
80
|
afterPermissions: v.Optional<string>;
|
|
81
81
|
vendedRowCounts: v.Optional<Record<string, Record<string, number>>>;
|
|
82
82
|
vendedRows: v.Optional<Record<string, Record<string, Readonly<Record<string, import("../../shared/src/json.ts").ReadonlyJSONValue | undefined>>[]>>>;
|
|
83
|
-
|
|
83
|
+
sqlitePlans: v.Optional<Record<string, string[]>>;
|
|
84
84
|
readRows: v.Optional<Record<string, Record<string, Readonly<Record<string, import("../../shared/src/json.ts").ReadonlyJSONValue | undefined>>[]>>>;
|
|
85
85
|
readRowCountsByQuery: v.Optional<Record<string, Record<string, number>>>;
|
|
86
86
|
readRowCount: v.Optional<number>;
|
|
87
87
|
dbScansByQuery: v.Optional<Record<string, Record<string, number>>>;
|
|
88
|
-
|
|
88
|
+
joinPlans: v.Optional<({
|
|
89
89
|
type: "attempt-start";
|
|
90
90
|
attemptNumber: number;
|
|
91
91
|
totalAttempts: number;
|
|
@@ -246,12 +246,12 @@ export declare const inspectDownBodySchema: v.UnionType<[v.ObjectType<Omit<{
|
|
|
246
246
|
afterPermissions: v.Optional<string>;
|
|
247
247
|
vendedRowCounts: v.Optional<Record<string, Record<string, number>>>;
|
|
248
248
|
vendedRows: v.Optional<Record<string, Record<string, Readonly<Record<string, import("../../shared/src/json.ts").ReadonlyJSONValue | undefined>>[]>>>;
|
|
249
|
-
|
|
249
|
+
sqlitePlans: v.Optional<Record<string, string[]>>;
|
|
250
250
|
readRows: v.Optional<Record<string, Record<string, Readonly<Record<string, import("../../shared/src/json.ts").ReadonlyJSONValue | undefined>>[]>>>;
|
|
251
251
|
readRowCountsByQuery: v.Optional<Record<string, Record<string, number>>>;
|
|
252
252
|
readRowCount: v.Optional<number>;
|
|
253
253
|
dbScansByQuery: v.Optional<Record<string, Record<string, number>>>;
|
|
254
|
-
|
|
254
|
+
joinPlans: v.Optional<({
|
|
255
255
|
type: "attempt-start";
|
|
256
256
|
attemptNumber: number;
|
|
257
257
|
totalAttempts: number;
|
|
@@ -409,12 +409,12 @@ export declare const inspectDownMessageSchema: v.TupleType<[v.Type<"inspect">, v
|
|
|
409
409
|
afterPermissions: v.Optional<string>;
|
|
410
410
|
vendedRowCounts: v.Optional<Record<string, Record<string, number>>>;
|
|
411
411
|
vendedRows: v.Optional<Record<string, Record<string, Readonly<Record<string, import("../../shared/src/json.ts").ReadonlyJSONValue | undefined>>[]>>>;
|
|
412
|
-
|
|
412
|
+
sqlitePlans: v.Optional<Record<string, string[]>>;
|
|
413
413
|
readRows: v.Optional<Record<string, Record<string, Readonly<Record<string, import("../../shared/src/json.ts").ReadonlyJSONValue | undefined>>[]>>>;
|
|
414
414
|
readRowCountsByQuery: v.Optional<Record<string, Record<string, number>>>;
|
|
415
415
|
readRowCount: v.Optional<number>;
|
|
416
416
|
dbScansByQuery: v.Optional<Record<string, Record<string, number>>>;
|
|
417
|
-
|
|
417
|
+
joinPlans: v.Optional<({
|
|
418
418
|
type: "attempt-start";
|
|
419
419
|
attemptNumber: number;
|
|
420
420
|
totalAttempts: number;
|
|
@@ -28,7 +28,7 @@ export type InspectAuthenticateUpBody = v.Infer<typeof inspectAuthenticateUpSche
|
|
|
28
28
|
declare const analyzeQueryOptionsSchema: v.ObjectType<{
|
|
29
29
|
vendedRows: v.Optional<boolean>;
|
|
30
30
|
syncedRows: v.Optional<boolean>;
|
|
31
|
-
|
|
31
|
+
joinPlans: v.Optional<boolean>;
|
|
32
32
|
}, undefined>;
|
|
33
33
|
export type AnalyzeQueryOptions = v.Infer<typeof analyzeQueryOptionsSchema>;
|
|
34
34
|
export declare const inspectAnalyzeQueryUpSchema: v.ObjectType<Omit<{
|
|
@@ -40,7 +40,7 @@ export declare const inspectAnalyzeQueryUpSchema: v.ObjectType<Omit<{
|
|
|
40
40
|
options: v.Optional<{
|
|
41
41
|
vendedRows?: boolean | undefined;
|
|
42
42
|
syncedRows?: boolean | undefined;
|
|
43
|
-
|
|
43
|
+
joinPlans?: boolean | undefined;
|
|
44
44
|
}>;
|
|
45
45
|
ast: v.Optional<import("./ast.ts").AST>;
|
|
46
46
|
name: v.Optional<string>;
|
|
@@ -74,7 +74,7 @@ declare const inspectUpBodySchema: v.UnionType<[v.ObjectType<Omit<{
|
|
|
74
74
|
options: v.Optional<{
|
|
75
75
|
vendedRows?: boolean | undefined;
|
|
76
76
|
syncedRows?: boolean | undefined;
|
|
77
|
-
|
|
77
|
+
joinPlans?: boolean | undefined;
|
|
78
78
|
}>;
|
|
79
79
|
ast: v.Optional<import("./ast.ts").AST>;
|
|
80
80
|
name: v.Optional<string>;
|
|
@@ -107,7 +107,7 @@ export declare const inspectUpMessageSchema: v.TupleType<[v.Type<"inspect">, v.U
|
|
|
107
107
|
options: v.Optional<{
|
|
108
108
|
vendedRows?: boolean | undefined;
|
|
109
109
|
syncedRows?: boolean | undefined;
|
|
110
|
-
|
|
110
|
+
joinPlans?: boolean | undefined;
|
|
111
111
|
}>;
|
|
112
112
|
ast: v.Optional<import("./ast.ts").AST>;
|
|
113
113
|
name: v.Optional<string>;
|
|
@@ -22,7 +22,7 @@ const inspectAuthenticateUpSchema = inspectUpBase.extend({
|
|
|
22
22
|
const analyzeQueryOptionsSchema = object({
|
|
23
23
|
vendedRows: boolean().optional(),
|
|
24
24
|
syncedRows: boolean().optional(),
|
|
25
|
-
|
|
25
|
+
joinPlans: boolean().optional()
|
|
26
26
|
});
|
|
27
27
|
const inspectAnalyzeQueryUpSchema = inspectUpBase.extend({
|
|
28
28
|
op: literal("analyze-query"),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inspect-up.js","sources":["../../../../zero-protocol/src/inspect-up.ts"],"sourcesContent":["import {jsonSchema} from '../../shared/src/json-schema.ts';\nimport * as v from '../../shared/src/valita.ts';\nimport {astSchema} from './ast.ts';\n\nconst inspectUpBase = v.object({\n id: v.string(),\n});\n\nconst inspectQueriesUpBodySchema = inspectUpBase.extend({\n op: v.literal('queries'),\n clientID: v.string().optional(),\n});\n\nexport type InspectQueriesUpBody = v.Infer<typeof inspectQueriesUpBodySchema>;\n\nconst inspectMetricsUpSchema = inspectUpBase.extend({\n op: v.literal('metrics'),\n});\n\nexport type InspectMetricsUpBody = v.Infer<typeof inspectMetricsUpSchema>;\n\nconst inspectVersionUpSchema = inspectUpBase.extend({\n op: v.literal('version'),\n});\n\nexport type InspectVersionUpBody = v.Infer<typeof inspectVersionUpSchema>;\n\nexport const inspectAuthenticateUpSchema = inspectUpBase.extend({\n op: v.literal('authenticate'),\n value: v.string(),\n});\n\nexport type InspectAuthenticateUpBody = v.Infer<\n typeof inspectAuthenticateUpSchema\n>;\n\nconst analyzeQueryOptionsSchema = v.object({\n vendedRows: v.boolean().optional(),\n syncedRows: v.boolean().optional(),\n
|
|
1
|
+
{"version":3,"file":"inspect-up.js","sources":["../../../../zero-protocol/src/inspect-up.ts"],"sourcesContent":["import {jsonSchema} from '../../shared/src/json-schema.ts';\nimport * as v from '../../shared/src/valita.ts';\nimport {astSchema} from './ast.ts';\n\nconst inspectUpBase = v.object({\n id: v.string(),\n});\n\nconst inspectQueriesUpBodySchema = inspectUpBase.extend({\n op: v.literal('queries'),\n clientID: v.string().optional(),\n});\n\nexport type InspectQueriesUpBody = v.Infer<typeof inspectQueriesUpBodySchema>;\n\nconst inspectMetricsUpSchema = inspectUpBase.extend({\n op: v.literal('metrics'),\n});\n\nexport type InspectMetricsUpBody = v.Infer<typeof inspectMetricsUpSchema>;\n\nconst inspectVersionUpSchema = inspectUpBase.extend({\n op: v.literal('version'),\n});\n\nexport type InspectVersionUpBody = v.Infer<typeof inspectVersionUpSchema>;\n\nexport const inspectAuthenticateUpSchema = inspectUpBase.extend({\n op: v.literal('authenticate'),\n value: v.string(),\n});\n\nexport type InspectAuthenticateUpBody = v.Infer<\n typeof inspectAuthenticateUpSchema\n>;\n\nconst analyzeQueryOptionsSchema = v.object({\n vendedRows: v.boolean().optional(),\n syncedRows: v.boolean().optional(),\n joinPlans: v.boolean().optional(),\n});\n\nexport type AnalyzeQueryOptions = v.Infer<typeof analyzeQueryOptionsSchema>;\n\nexport const inspectAnalyzeQueryUpSchema = inspectUpBase.extend({\n op: v.literal('analyze-query'),\n /** @deprecated Use {@linkcode ast} instead */\n value: astSchema.optional(),\n options: analyzeQueryOptionsSchema.optional(),\n ast: astSchema.optional(),\n name: v.string().optional(),\n args: v.readonlyArray(jsonSchema).optional(),\n});\n\nexport type InspectAnalyzeQueryUpBody = v.Infer<\n typeof inspectAnalyzeQueryUpSchema\n>;\n\nconst inspectUpBodySchema = v.union(\n inspectQueriesUpBodySchema,\n inspectMetricsUpSchema,\n inspectVersionUpSchema,\n inspectAuthenticateUpSchema,\n inspectAnalyzeQueryUpSchema,\n);\n\nexport const inspectUpMessageSchema = v.tuple([\n v.literal('inspect'),\n inspectUpBodySchema,\n]);\n\nexport type InspectUpMessage = v.Infer<typeof inspectUpMessageSchema>;\n\nexport type InspectUpBody = v.Infer<typeof inspectUpBodySchema>;\n"],"names":["v.object","v.string","v.literal","v.boolean","v.readonlyArray","v.union","v.tuple"],"mappings":";;;;AAIA,MAAM,gBAAgBA,OAAS;AAAA,EAC7B,IAAIC,OAAE;AACR,CAAC;AAED,MAAM,6BAA6B,cAAc,OAAO;AAAA,EACtD,IAAIC,QAAU,SAAS;AAAA,EACvB,UAAUD,OAAE,EAAS,SAAA;AACvB,CAAC;AAID,MAAM,yBAAyB,cAAc,OAAO;AAAA,EAClD,IAAIC,QAAU,SAAS;AACzB,CAAC;AAID,MAAM,yBAAyB,cAAc,OAAO;AAAA,EAClD,IAAIA,QAAU,SAAS;AACzB,CAAC;AAIM,MAAM,8BAA8B,cAAc,OAAO;AAAA,EAC9D,IAAIA,QAAU,cAAc;AAAA,EAC5B,OAAOD,OAAE;AACX,CAAC;AAMD,MAAM,4BAA4BD,OAAS;AAAA,EACzC,YAAYG,QAAE,EAAU,SAAA;AAAA,EACxB,YAAYA,QAAE,EAAU,SAAA;AAAA,EACxB,WAAWA,QAAE,EAAU,SAAA;AACzB,CAAC;AAIM,MAAM,8BAA8B,cAAc,OAAO;AAAA,EAC9D,IAAID,QAAU,eAAe;AAAA;AAAA,EAE7B,OAAO,UAAU,SAAA;AAAA,EACjB,SAAS,0BAA0B,SAAA;AAAA,EACnC,KAAK,UAAU,SAAA;AAAA,EACf,MAAMD,OAAE,EAAS,SAAA;AAAA,EACjB,MAAMG,cAAgB,UAAU,EAAE,SAAA;AACpC,CAAC;AAMD,MAAM,sBAAsBC;AAAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,MAAM,yBAAyBC,MAAQ;AAAA,EAC5CJ,QAAU,SAAS;AAAA,EACnB;AACF,CAAC;"}
|
|
@@ -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 = 44;
|
|
14
14
|
/**
|
|
15
15
|
* The minimum server-supported sync protocol version (i.e. the version
|
|
16
16
|
* declared in the "/sync/v{#}/connect" URL). The contract for
|
|
@@ -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;AAuCH,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAEnC;;;;;;;;;GASG;AACH,eAAO,MAAM,kCAAkC,KAAK,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol-version.js","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)\nexport const PROTOCOL_VERSION =
|
|
1
|
+
{"version":3,"file":"protocol-version.js","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)\nexport const PROTOCOL_VERSION = 44;\n\n/**\n * The minimum server-supported sync protocol version (i.e. the version\n * declared in the \"/sync/v{#}/connect\" URL). The contract for\n * backwards compatibility is that a `zero-cache` supports the current\n * `PROTOCOL_VERSION` and at least the previous one (i.e. `PROTOCOL_VERSION - 1`)\n * if not earlier ones as well. This corresponds to supporting clients running\n * the current release and the previous (major) release. Any client connections\n * from protocol versions before `MIN_SERVER_SUPPORTED_PROTOCOL_VERSION` are\n * closed with a `VersionNotSupported` error.\n */\nexport const MIN_SERVER_SUPPORTED_SYNC_PROTOCOL = 30;\n\nassert(MIN_SERVER_SUPPORTED_SYNC_PROTOCOL < PROTOCOL_VERSION);\n"],"names":[],"mappings":";AAoDO,MAAM,mBAAmB;AAYzB,MAAM,qCAAqC;AAElD,OAAO,qCAAqC,gBAAgB;"}
|
|
@@ -120,7 +120,7 @@ export declare const upstreamSchema: v.UnionType<[v.TupleType<[v.Type<"initConne
|
|
|
120
120
|
options: v.Optional<{
|
|
121
121
|
vendedRows?: boolean | undefined;
|
|
122
122
|
syncedRows?: boolean | undefined;
|
|
123
|
-
|
|
123
|
+
joinPlans?: boolean | undefined;
|
|
124
124
|
}>;
|
|
125
125
|
ast: v.Optional<import("./ast.ts").AST>;
|
|
126
126
|
name: v.Optional<string>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bindings.d.ts","sourceRoot":"","sources":["../../../../zero-react/src/bindings.ts"],"names":[],"mappings":"AAAA,cAAc,0CAA0C,CAAC"}
|
|
@@ -1,14 +1,5 @@
|
|
|
1
|
-
export
|
|
2
|
-
export type { ConnectionState } from '../../zero-client/src/client/connection.ts';
|
|
3
|
-
export type { QueryResultDetails } from '../../zero-client/src/types/query-result.ts';
|
|
4
|
-
export type { PrimaryKey } from '../../zero-protocol/src/primary-key.ts';
|
|
5
|
-
export type { RelationshipsSchema, SchemaValue, TableSchema, } from '../../zero-schema/src/table-schema.ts';
|
|
6
|
-
export type { Schema } from '../../zero-types/src/schema.ts';
|
|
7
|
-
export type { HumanReadable } from '../../zql/src/query/query.ts';
|
|
8
|
-
export type { ResultType } from '../../zql/src/query/typed-view.ts';
|
|
9
|
-
export { ZeroInspector } from './components/zero-inspector.tsx';
|
|
1
|
+
export { useConnectionState } from './use-connection-state.tsx';
|
|
10
2
|
export { useQuery, useSuspenseQuery, type QueryResult, type UseQueryOptions, } from './use-query.tsx';
|
|
11
|
-
export { useZeroConnectionState } from './use-zero-connection-state.tsx';
|
|
12
3
|
export { useZeroOnline } from './use-zero-online.tsx';
|
|
13
4
|
export { createUseZero, useZero, ZeroContext, ZeroProvider, type ZeroProviderProps, } from './zero-provider.tsx';
|
|
14
5
|
//# sourceMappingURL=mod.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../../zero-react/src/mod.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../../zero-react/src/mod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAC,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,KAAK,WAAW,EAChB,KAAK,eAAe,GACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAC,aAAa,EAAC,MAAM,uBAAuB,CAAC;AACpD,OAAO,EACL,aAAa,EACb,OAAO,EACP,WAAW,EACX,YAAY,EACZ,KAAK,iBAAiB,GACvB,MAAM,qBAAqB,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { ConnectionState } from '
|
|
1
|
+
import type { ConnectionState } from './zero.ts';
|
|
2
2
|
/**
|
|
3
3
|
* Hook to subscribe to the connection status of the Zero instance.
|
|
4
4
|
*
|
|
5
5
|
* @returns The connection status of the Zero instance.
|
|
6
6
|
* @see {@link ConnectionState} for more details on the connection state.
|
|
7
7
|
*/
|
|
8
|
-
export declare function
|
|
9
|
-
//# sourceMappingURL=use-
|
|
8
|
+
export declare function useConnectionState(): ConnectionState;
|
|
9
|
+
//# sourceMappingURL=use-connection-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-connection-state.d.ts","sourceRoot":"","sources":["../../../../zero-react/src/use-connection-state.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,WAAW,CAAC;AAE/C;;;;;GAKG;AACH,wBAAgB,kBAAkB,IAAI,eAAe,CAOpD"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useSyncExternalStore } from "react";
|
|
2
2
|
import { useZero } from "./zero-provider.js";
|
|
3
|
-
function
|
|
3
|
+
function useConnectionState() {
|
|
4
4
|
const zero = useZero();
|
|
5
5
|
return useSyncExternalStore(
|
|
6
6
|
zero.connection.state.subscribe,
|
|
@@ -9,6 +9,6 @@ function useZeroConnectionState() {
|
|
|
9
9
|
);
|
|
10
10
|
}
|
|
11
11
|
export {
|
|
12
|
-
|
|
12
|
+
useConnectionState
|
|
13
13
|
};
|
|
14
|
-
//# sourceMappingURL=use-
|
|
14
|
+
//# sourceMappingURL=use-connection-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-connection-state.js","sources":["../../../../zero-react/src/use-connection-state.tsx"],"sourcesContent":["import {useSyncExternalStore} from 'react';\nimport {useZero} from './zero-provider.tsx';\nimport type {ConnectionState} from './zero.ts';\n\n/**\n * Hook to subscribe to the connection status of the Zero instance.\n *\n * @returns The connection status of the Zero instance.\n * @see {@link ConnectionState} for more details on the connection state.\n */\nexport function useConnectionState(): ConnectionState {\n const zero = useZero();\n return useSyncExternalStore(\n zero.connection.state.subscribe,\n () => zero.connection.state.current,\n () => zero.connection.state.current,\n );\n}\n"],"names":[],"mappings":";;AAUO,SAAS,qBAAsC;AACpD,QAAM,OAAO,QAAA;AACb,SAAO;AAAA,IACL,KAAK,WAAW,MAAM;AAAA,IACtB,MAAM,KAAK,WAAW,MAAM;AAAA,IAC5B,MAAM,KAAK,WAAW,MAAM;AAAA,EAAA;AAEhC;"}
|
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
import type { ReadonlyJSONValue } from '
|
|
2
|
-
import type { CustomMutatorDefs } from '../../zero-client/src/client/custom.ts';
|
|
3
|
-
import type { Zero } from '../../zero-client/src/client/zero.ts';
|
|
4
|
-
import type { QueryResultDetails } from '../../zero-client/src/types/query-result.ts';
|
|
5
|
-
import type { DefaultContext, DefaultSchema } from '../../zero-types/src/default-types.ts';
|
|
6
|
-
import type { Schema } from '../../zero-types/src/schema.ts';
|
|
7
|
-
import { type QueryOrQueryRequest } from '../../zql/src/query/query-registry.ts';
|
|
8
|
-
import { type HumanReadable, type PullRow } from '../../zql/src/query/query.ts';
|
|
9
|
-
import { type TTL } from '../../zql/src/query/ttl.ts';
|
|
1
|
+
import type { CustomMutatorDefs, DefaultContext, DefaultSchema, HumanReadable, PullRow, Query, QueryOrQueryRequest, QueryResultDetails, ReadonlyJSONValue, Schema, TTL, Zero } from './zero.ts';
|
|
10
2
|
export type QueryResult<TReturn> = readonly [
|
|
11
3
|
HumanReadable<TReturn>,
|
|
12
4
|
QueryResultDetails & {}
|
|
@@ -89,7 +81,7 @@ export declare function getAllViewsSizeForTesting(store: ViewStore): number;
|
|
|
89
81
|
export declare class ViewStore {
|
|
90
82
|
#private;
|
|
91
83
|
constructor();
|
|
92
|
-
getView<TTable extends keyof TSchema['tables'] & string, TSchema extends Schema,
|
|
84
|
+
getView<TTable extends keyof TSchema['tables'] & string, TSchema extends Schema, TReturn, MD extends CustomMutatorDefs | undefined, TContext>(zero: Zero<TSchema, MD, TContext>, q: Query<TTable, TSchema, TReturn>, enabled: boolean, ttl: TTL): {
|
|
93
85
|
getSnapshot: () => QueryResult<TReturn>;
|
|
94
86
|
subscribeReactInternals: (internals: () => void) => () => void;
|
|
95
87
|
updateTTL: (ttl: TTL) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-query.d.ts","sourceRoot":"","sources":["../../../../zero-react/src/use-query.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-query.d.ts","sourceRoot":"","sources":["../../../../zero-react/src/use-query.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAEV,iBAAiB,EACjB,cAAc,EACd,aAAa,EAEb,aAAa,EACb,OAAO,EACP,KAAK,EAEL,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EAEjB,MA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,MAAM,EACN,OAAO,EACP,OAAO,EACP,OAAO,EACP,QAAQ,CACT,EACD,OAAO,CAAC,EAAE,uBAAuB,GAAG,OAAO,GAC1C,WAAW,CAAC,OAAO,CAAC,CAoCtB;AA6GD,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAKlE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,qBAAa,SAAS;;;IASpB,OAAO,CACL,MAAM,SAAS,MAAM,OAAO,CAAC,QAAQ,CAAC,GAAG,MAAM,EAC/C,OAAO,SAAS,MAAM,EACtB,OAAO,EACP,EAAE,SAAS,iBAAiB,GAAG,SAAS,EACxC,QAAQ,EAER,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;CAgCF"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { resolver } from "@rocicorp/resolver";
|
|
2
2
|
import React, { useSyncExternalStore } from "react";
|
|
3
3
|
import { deepClone } from "../../shared/src/deep-clone.js";
|
|
4
|
-
import
|
|
5
|
-
import { addContextToQuery } from "../../zql/src/query/query-registry.js";
|
|
4
|
+
import "compare-utf8";
|
|
6
5
|
import "../../zero-protocol/src/ast.js";
|
|
6
|
+
import "js-xxhash";
|
|
7
|
+
import { asQueryInternals } from "../../zql/src/query/query-internals.js";
|
|
8
|
+
import { addContextToQuery } from "../../zql/src/query/query-registry.js";
|
|
7
9
|
import { DEFAULT_TTL_MS } from "../../zql/src/query/ttl.js";
|
|
8
10
|
import { useZero } from "./zero-provider.js";
|
|
9
11
|
const reactUse = React.use;
|
|
@@ -19,7 +21,8 @@ function useQuery(query, options) {
|
|
|
19
21
|
({ enabled = true, ttl = DEFAULT_TTL_MS } = options);
|
|
20
22
|
}
|
|
21
23
|
const zero = useZero();
|
|
22
|
-
const
|
|
24
|
+
const q = addContextToQuery(query, zero.context);
|
|
25
|
+
const view = viewStore.getView(zero, q, enabled, ttl);
|
|
23
26
|
return useSyncExternalStore(
|
|
24
27
|
view.subscribeReactInternals,
|
|
25
28
|
view.getSnapshot,
|
|
@@ -40,7 +43,8 @@ function useSuspenseQuery(query, options) {
|
|
|
40
43
|
} = options);
|
|
41
44
|
}
|
|
42
45
|
const zero = useZero();
|
|
43
|
-
const
|
|
46
|
+
const q = addContextToQuery(query, zero.context);
|
|
47
|
+
const view = viewStore.getView(zero, q, enabled, ttl);
|
|
44
48
|
const snapshot = useSyncExternalStore(
|
|
45
49
|
view.subscribeReactInternals,
|
|
46
50
|
view.getSnapshot,
|
|
@@ -139,13 +143,11 @@ class ViewStore {
|
|
|
139
143
|
#views = /* @__PURE__ */ new Map();
|
|
140
144
|
constructor() {
|
|
141
145
|
}
|
|
142
|
-
getView(zero,
|
|
143
|
-
const
|
|
144
|
-
const bindings = bindingsForZero(zero);
|
|
145
|
-
const format = bindings.format(q);
|
|
146
|
+
getView(zero, q, enabled, ttl) {
|
|
147
|
+
const qi = asQueryInternals(q);
|
|
146
148
|
if (!enabled) {
|
|
147
149
|
return {
|
|
148
|
-
getSnapshot: () => getDefaultSnapshot(format.singular),
|
|
150
|
+
getSnapshot: () => getDefaultSnapshot(qi.format.singular),
|
|
149
151
|
subscribeReactInternals: disabledSubscriber,
|
|
150
152
|
updateTTL: () => {
|
|
151
153
|
},
|
|
@@ -155,10 +157,10 @@ class ViewStore {
|
|
|
155
157
|
nonEmpty: false
|
|
156
158
|
};
|
|
157
159
|
}
|
|
158
|
-
const hash =
|
|
160
|
+
const hash = qi.hash() + zero.clientID;
|
|
159
161
|
let existing = this.#views.get(hash);
|
|
160
162
|
if (!existing) {
|
|
161
|
-
existing = new ViewWrapper(
|
|
163
|
+
existing = new ViewWrapper(q, zero, ttl, (view) => {
|
|
162
164
|
const currentView = this.#views.get(hash);
|
|
163
165
|
if (currentView && currentView !== view) {
|
|
164
166
|
return;
|
|
@@ -177,29 +179,29 @@ class ViewWrapper {
|
|
|
177
179
|
#view;
|
|
178
180
|
#onDematerialized;
|
|
179
181
|
#query;
|
|
180
|
-
#format;
|
|
181
182
|
#snapshot;
|
|
182
|
-
#reactInternals;
|
|
183
|
+
#reactInternals = /* @__PURE__ */ new Set();
|
|
183
184
|
#ttl;
|
|
184
185
|
#complete = false;
|
|
185
186
|
#completeResolver = resolver();
|
|
186
187
|
#nonEmpty = false;
|
|
187
188
|
#nonEmptyResolver = resolver();
|
|
188
|
-
#
|
|
189
|
-
|
|
190
|
-
|
|
189
|
+
#zero;
|
|
190
|
+
#singular;
|
|
191
|
+
constructor(query, zero, ttl, onDematerialized) {
|
|
191
192
|
this.#query = query;
|
|
192
|
-
this.#
|
|
193
|
+
this.#zero = zero;
|
|
193
194
|
this.#ttl = ttl;
|
|
194
195
|
this.#onDematerialized = onDematerialized;
|
|
195
|
-
|
|
196
|
-
this.#
|
|
196
|
+
const { singular } = asQueryInternals(query).format;
|
|
197
|
+
this.#singular = singular;
|
|
198
|
+
this.#snapshot = getDefaultSnapshot(singular);
|
|
197
199
|
this.#materializeIfNeeded();
|
|
198
200
|
}
|
|
199
201
|
#onData = (snap, resultType, error) => {
|
|
200
202
|
const data = snap === void 0 ? snap : deepClone(snap);
|
|
201
203
|
this.#snapshot = getSnapshot(
|
|
202
|
-
this.#
|
|
204
|
+
this.#singular,
|
|
203
205
|
data,
|
|
204
206
|
resultType,
|
|
205
207
|
this.#retry,
|
|
@@ -211,7 +213,7 @@ class ViewWrapper {
|
|
|
211
213
|
this.#nonEmpty = true;
|
|
212
214
|
this.#nonEmptyResolver.resolve();
|
|
213
215
|
}
|
|
214
|
-
if (this.#
|
|
216
|
+
if (this.#singular ? this.#snapshot[0] !== void 0 : this.#snapshot[0].length !== 0) {
|
|
215
217
|
this.#nonEmpty = true;
|
|
216
218
|
this.#nonEmptyResolver.resolve();
|
|
217
219
|
}
|
|
@@ -232,7 +234,7 @@ class ViewWrapper {
|
|
|
232
234
|
if (this.#view) {
|
|
233
235
|
return;
|
|
234
236
|
}
|
|
235
|
-
this.#view = this.#
|
|
237
|
+
this.#view = this.#zero.materialize(this.#query, {
|
|
236
238
|
ttl: this.#ttl
|
|
237
239
|
});
|
|
238
240
|
this.#view.addListener(this.#onData);
|