@rocicorp/zero 0.25.0-canary.10 → 0.25.0-canary.12
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/analyze-query/src/run-ast.d.ts.map +1 -1
- package/out/analyze-query/src/run-ast.js +3 -7
- package/out/analyze-query/src/run-ast.js.map +1 -1
- package/out/shared/src/iterables.d.ts +0 -1
- package/out/shared/src/iterables.d.ts.map +1 -1
- package/out/shared/src/iterables.js +0 -34
- package/out/shared/src/iterables.js.map +1 -1
- package/out/zero/package.json.js +1 -1
- package/out/zero-cache/src/db/transaction-pool.d.ts.map +1 -1
- package/out/zero-cache/src/db/transaction-pool.js +3 -6
- package/out/zero-cache/src/db/transaction-pool.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 +50 -37
- package/out/zero-cache/src/services/analyze.js.map +1 -1
- package/out/zero-cache/src/services/run-ast.d.ts +1 -1
- package/out/zero-cache/src/services/run-ast.d.ts.map +1 -1
- package/out/zero-cache/src/services/run-ast.js +5 -1
- package/out/zero-cache/src/services/run-ast.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/pipeline-driver.d.ts +6 -4
- 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 +71 -23
- package/out/zero-cache/src/services/view-syncer/pipeline-driver.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/view-syncer.d.ts +1 -1
- 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 +10 -6
- package/out/zero-cache/src/services/view-syncer/view-syncer.js.map +1 -1
- package/out/zero-client/src/client/bindings.d.ts +2 -3
- package/out/zero-client/src/client/bindings.d.ts.map +1 -1
- package/out/zero-client/src/client/bindings.js.map +1 -1
- package/out/zero-client/src/client/make-mutate-property.d.ts +2 -2
- package/out/zero-client/src/client/make-mutate-property.d.ts.map +1 -1
- package/out/zero-client/src/client/make-mutate-property.js.map +1 -1
- package/out/zero-client/src/client/make-replicache-mutators.js.map +1 -1
- package/out/zero-client/src/client/options.d.ts +3 -3
- package/out/zero-client/src/client/options.d.ts.map +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 -2
- package/out/zero-client/src/client/zero.d.ts.map +1 -1
- package/out/zero-client/src/client/zero.js +6 -2
- package/out/zero-client/src/client/zero.js.map +1 -1
- package/out/zero-client/src/mod.d.ts +5 -7
- package/out/zero-client/src/mod.d.ts.map +1 -1
- package/out/zero-react/src/components/inspector.d.ts +1 -2
- package/out/zero-react/src/components/inspector.d.ts.map +1 -1
- package/out/zero-react/src/components/inspector.js.map +1 -1
- package/out/zero-react/src/components/zero-inspector.d.ts +1 -2
- package/out/zero-react/src/components/zero-inspector.d.ts.map +1 -1
- package/out/zero-react/src/components/zero-inspector.js.map +1 -1
- package/out/zero-react/src/use-query.d.ts +1 -2
- package/out/zero-react/src/use-query.d.ts.map +1 -1
- package/out/zero-react/src/use-query.js.map +1 -1
- package/out/zero-react/src/zero-provider.d.ts +4 -5
- package/out/zero-react/src/zero-provider.d.ts.map +1 -1
- package/out/zero-react/src/zero-provider.js.map +1 -1
- package/out/zero-solid/src/solid-view.d.ts.map +1 -1
- package/out/zero-solid/src/solid-view.js +4 -3
- package/out/zero-solid/src/solid-view.js.map +1 -1
- package/out/zero-solid/src/use-zero.d.ts +4 -5
- package/out/zero-solid/src/use-zero.d.ts.map +1 -1
- package/out/zero-solid/src/use-zero.js.map +1 -1
- package/out/zero-types/src/default-types.d.ts +2 -2
- package/out/zero-types/src/default-types.d.ts.map +1 -1
- package/out/zql/src/builder/builder.d.ts.map +1 -1
- package/out/zql/src/builder/builder.js +0 -1
- package/out/zql/src/builder/builder.js.map +1 -1
- package/out/zql/src/ivm/array-view.d.ts +1 -1
- package/out/zql/src/ivm/array-view.d.ts.map +1 -1
- package/out/zql/src/ivm/array-view.js +2 -1
- package/out/zql/src/ivm/array-view.js.map +1 -1
- package/out/zql/src/ivm/data.d.ts +7 -2
- package/out/zql/src/ivm/data.d.ts.map +1 -1
- package/out/zql/src/ivm/data.js +3 -0
- package/out/zql/src/ivm/data.js.map +1 -1
- package/out/zql/src/ivm/exists.d.ts +3 -2
- package/out/zql/src/ivm/exists.d.ts.map +1 -1
- package/out/zql/src/ivm/exists.js +29 -76
- package/out/zql/src/ivm/exists.js.map +1 -1
- package/out/zql/src/ivm/fan-in.d.ts +2 -0
- package/out/zql/src/ivm/fan-in.d.ts.map +1 -1
- package/out/zql/src/ivm/fan-in.js +4 -0
- package/out/zql/src/ivm/fan-in.js.map +1 -1
- package/out/zql/src/ivm/fan-out.d.ts +2 -0
- package/out/zql/src/ivm/fan-out.d.ts.map +1 -1
- package/out/zql/src/ivm/fan-out.js +4 -0
- package/out/zql/src/ivm/fan-out.js.map +1 -1
- package/out/zql/src/ivm/filter-operators.d.ts +6 -2
- package/out/zql/src/ivm/filter-operators.d.ts.map +1 -1
- package/out/zql/src/ivm/filter-operators.js +16 -0
- package/out/zql/src/ivm/filter-operators.js.map +1 -1
- package/out/zql/src/ivm/filter.d.ts +2 -0
- package/out/zql/src/ivm/filter.d.ts.map +1 -1
- package/out/zql/src/ivm/filter.js +4 -0
- package/out/zql/src/ivm/filter.js.map +1 -1
- package/out/zql/src/ivm/flipped-join.d.ts +1 -1
- package/out/zql/src/ivm/flipped-join.d.ts.map +1 -1
- package/out/zql/src/ivm/flipped-join.js +26 -13
- package/out/zql/src/ivm/flipped-join.js.map +1 -1
- package/out/zql/src/ivm/join-utils.d.ts +2 -1
- package/out/zql/src/ivm/join-utils.d.ts.map +1 -1
- package/out/zql/src/ivm/join-utils.js +8 -0
- package/out/zql/src/ivm/join-utils.js.map +1 -1
- package/out/zql/src/ivm/join.d.ts +1 -1
- package/out/zql/src/ivm/join.d.ts.map +1 -1
- package/out/zql/src/ivm/join.js +15 -6
- package/out/zql/src/ivm/join.js.map +1 -1
- package/out/zql/src/ivm/memory-source.d.ts +1 -1
- package/out/zql/src/ivm/memory-source.d.ts.map +1 -1
- package/out/zql/src/ivm/memory-source.js +8 -1
- package/out/zql/src/ivm/memory-source.js.map +1 -1
- package/out/zql/src/ivm/operator.d.ts +9 -1
- package/out/zql/src/ivm/operator.d.ts.map +1 -1
- package/out/zql/src/ivm/operator.js +8 -0
- package/out/zql/src/ivm/operator.js.map +1 -1
- package/out/zql/src/ivm/push-accumulated.d.ts +1 -1
- package/out/zql/src/ivm/push-accumulated.d.ts.map +1 -1
- package/out/zql/src/ivm/push-accumulated.js.map +1 -1
- package/out/zql/src/ivm/skip.d.ts +1 -1
- package/out/zql/src/ivm/skip.d.ts.map +1 -1
- package/out/zql/src/ivm/skip.js +7 -1
- package/out/zql/src/ivm/skip.js.map +1 -1
- package/out/zql/src/ivm/take.d.ts +1 -1
- package/out/zql/src/ivm/take.d.ts.map +1 -1
- package/out/zql/src/ivm/take.js +87 -59
- package/out/zql/src/ivm/take.js.map +1 -1
- package/out/zql/src/ivm/union-fan-in.d.ts +2 -1
- package/out/zql/src/ivm/union-fan-in.d.ts.map +1 -1
- package/out/zql/src/ivm/union-fan-in.js +67 -5
- package/out/zql/src/ivm/union-fan-in.js.map +1 -1
- package/out/zql/src/ivm/union-fan-out.d.ts +1 -1
- package/out/zql/src/ivm/union-fan-out.d.ts.map +1 -1
- package/out/zql/src/ivm/union-fan-out.js.map +1 -1
- package/out/zql/src/ivm/view-apply-change.d.ts.map +1 -1
- package/out/zql/src/ivm/view-apply-change.js +3 -2
- package/out/zql/src/ivm/view-apply-change.js.map +1 -1
- package/out/zql/src/mutate/custom.d.ts +2 -2
- 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 +33 -15
- package/out/zql/src/mutate/mutator-registry.d.ts.map +1 -1
- package/out/zql/src/mutate/mutator-registry.js +2 -8
- package/out/zql/src/mutate/mutator-registry.js.map +1 -1
- package/out/zql/src/mutate/mutator.d.ts +50 -25
- package/out/zql/src/mutate/mutator.d.ts.map +1 -1
- package/out/zql/src/mutate/mutator.js +2 -3
- package/out/zql/src/mutate/mutator.js.map +1 -1
- package/out/zql/src/query/abstract-query.d.ts +43 -0
- package/out/zql/src/query/abstract-query.d.ts.map +1 -0
- package/out/zql/src/query/abstract-query.js +408 -0
- package/out/zql/src/query/abstract-query.js.map +1 -0
- package/out/zql/src/query/create-builder.d.ts +2 -0
- package/out/zql/src/query/create-builder.d.ts.map +1 -1
- package/out/zql/src/query/create-builder.js +7 -2
- package/out/zql/src/query/create-builder.js.map +1 -1
- package/out/zql/src/query/measure-push-operator.d.ts +1 -1
- package/out/zql/src/query/measure-push-operator.d.ts.map +1 -1
- package/out/zql/src/query/measure-push-operator.js.map +1 -1
- package/out/zql/src/query/query-delegate-base.d.ts +7 -1
- package/out/zql/src/query/query-delegate-base.d.ts.map +1 -1
- package/out/zql/src/query/query-delegate-base.js +132 -2
- package/out/zql/src/query/query-delegate-base.js.map +1 -1
- package/out/zql/src/query/query-impl.d.ts +5 -39
- package/out/zql/src/query/query-impl.d.ts.map +1 -1
- package/out/zql/src/query/query-impl.js +3 -521
- package/out/zql/src/query/query-impl.js.map +1 -1
- package/out/zql/src/query/query-internals.d.ts.map +1 -1
- package/out/zql/src/query/query-internals.js +2 -2
- package/out/zql/src/query/query-internals.js.map +1 -1
- package/out/zql/src/query/query-registry.d.ts +126 -58
- package/out/zql/src/query/query-registry.d.ts.map +1 -1
- package/out/zql/src/query/query-registry.js +13 -21
- package/out/zql/src/query/query-registry.js.map +1 -1
- package/out/zql/src/query/query.d.ts +21 -0
- package/out/zql/src/query/query.d.ts.map +1 -1
- package/out/zql/src/query/runnable-query-impl.d.ts +22 -0
- package/out/zql/src/query/runnable-query-impl.d.ts.map +1 -0
- package/out/zql/src/query/runnable-query-impl.js +60 -0
- package/out/zql/src/query/runnable-query-impl.js.map +1 -0
- package/out/zql/src/query/static-query.d.ts +1 -1
- package/out/zql/src/query/static-query.d.ts.map +1 -1
- package/out/zql/src/query/static-query.js +1 -1
- package/out/zql/src/query/static-query.js.map +1 -1
- package/out/zqlite/src/table-source.d.ts +7 -1
- package/out/zqlite/src/table-source.d.ts.map +1 -1
- package/out/zqlite/src/table-source.js +34 -14
- package/out/zqlite/src/table-source.js.map +1 -1
- package/package.json +1 -1
|
@@ -36,8 +36,8 @@ export declare function makeMutateProperty(mutators: AnyMutatorRegistry | Custom
|
|
|
36
36
|
* or a namespace containing more mutators.
|
|
37
37
|
*/
|
|
38
38
|
type MakeFromMutatorDefinitions<S extends Schema, MD extends AnyMutatorRegistry | CustomMutatorDefs, C> = {
|
|
39
|
-
readonly [K in keyof MD]: MD[K] extends MutatorDefinition<infer TInput, any,
|
|
39
|
+
readonly [K in keyof MD]: MD[K] extends MutatorDefinition<infer TInput, any, C, any> ? [TInput] extends [undefined] ? () => MutatorResult : undefined extends TInput ? (args?: TInput) => MutatorResult : (args: TInput) => MutatorResult : MD[K] extends (tx: Transaction<S>, ...args: infer Args) => Promise<void> ? (...args: Args) => MutatorResult : MD[K] extends AnyMutatorRegistry | CustomMutatorDefs ? MakeFromMutatorDefinitions<S, MD[K], C> : never;
|
|
40
40
|
};
|
|
41
|
-
export type MakeMutatePropertyType<S extends Schema, MD extends
|
|
41
|
+
export type MakeMutatePropertyType<S extends Schema, MD extends CustomMutatorDefs | undefined, C> = MD extends AnyMutatorRegistry ? {} : MD extends AnyMutatorRegistry | CustomMutatorDefs ? S['enableLegacyMutators'] extends false ? MakeFromMutatorDefinitions<S, MD, C> : DeepMerge<DBMutator<S>, MakeFromMutatorDefinitions<S, MD, C>> : DBMutator<S>;
|
|
42
42
|
export {};
|
|
43
43
|
//# sourceMappingURL=make-mutate-property.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"make-mutate-property.d.ts","sourceRoot":"","sources":["../../../../../zero-client/src/client/make-mutate-property.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,mCAAmC,CAAC;AAEjE,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,mCAAmC,CAAC;AAC9D,OAAO,EAEL,KAAK,WAAW,EACjB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,6CAA6C,CAAC;AACpF,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAC,iBAAiB,EAAE,aAAa,EAAC,MAAM,aAAa,CAAC;AAClE,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,kBAAkB,GAAG,iBAAiB,EAChD,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACrC,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACxC,IAAI,CAwCN;AAED;;;;GAIG;AACH,KAAK,0BAA0B,CAC7B,CAAC,SAAS,MAAM,EAChB,EAAE,SAAS,kBAAkB,GAAG,iBAAiB,EACjD,CAAC,IACC;IACF,QAAQ,EAAE,CAAC,IAAI,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,SAAS,iBAAiB,CACvD,MAAM,MAAM,EAEZ,GAAG,EACH,CAAC,
|
|
1
|
+
{"version":3,"file":"make-mutate-property.d.ts","sourceRoot":"","sources":["../../../../../zero-client/src/client/make-mutate-property.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,mCAAmC,CAAC;AAEjE,OAAO,KAAK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AI,CAAC,GACtE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,aAAa,GAChC,EAAE,CAAC,CAAC,CAAC,SAAS,kBAAkB,GAAG,iBAAiB,GAClD,0BAA0B,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GACvC,KAAK;CACd,CAAC;AAEF,MAAM,MAAM,sBAAsB,CAChC,CAAC,SAAS,MAAM,EAChB,EAAE,SAAS,iBAAiB,GAAG,SAAS,EACxC,CAAC,IACC,EAAE,SAAS,kBAAkB,GAE7B,EAAE,GACF,EAAE,SAAS,kBAAkB,GAAG,iBAAiB,GAC/C,CAAC,CAAC,sBAAsB,CAAC,SAAS,KAAK,GACrC,0BAA0B,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,GACpC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,0BAA0B,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,GAC/D,SAAS,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"make-mutate-property.js","sources":["../../../../../zero-client/src/client/make-mutate-property.ts"],"sourcesContent":["import type {DeepMerge} from '../../../shared/src/deep-merge.ts';\nimport {must} from '../../../shared/src/must.ts';\nimport type {Schema} from '../../../zero-types/src/schema.ts';\nimport {\n customMutatorKey,\n type Transaction,\n} from '../../../zql/src/mutate/custom.ts';\nimport type {AnyMutatorRegistry} from '../../../zql/src/mutate/mutator-registry.ts';\nimport {\n isMutator,\n type MutatorDefinition,\n} from '../../../zql/src/mutate/mutator.ts';\nimport type {DBMutator} from './crud.ts';\nimport type {CustomMutatorDefs, MutatorResult} from './custom.ts';\nimport type {MutatorProxy} from './mutator-proxy.ts';\n\n/**\n * Creates and populates a mutate property object by processing mutator definitions recursively.\n *\n * This function traverses through mutator definitions (either schema-based or custom) and builds\n * a corresponding object structure where each mutator is wrapped by the mutator proxy. It handles\n * both flat mutator functions and nested mutator definition objects.\n *\n * @template S - The schema type that defines the structure of the data\n * @template C - The context type used by mutators, defaults to unknown\n *\n * @param mutators - The mutator definitions to process, can be schema-based or custom mutator definitions\n * @param mutatorProxy - The proxy object responsible for wrapping mutators with additional functionality\n * @param mutateObject - The target object to populate with wrapped mutators\n * @param replicacheMutate - The source object containing the actual mutator implementations to wrap\n *\n * @returns void - This function mutates the mutateObject parameter directly\n *\n * @remarks\n * The function recursively processes nested mutator structures, creating corresponding nested objects\n * in the mutateObject. For leaf mutators (functions or mutator definitions), it generates a full key\n * using different separators ('.' for mutator definitions, '|' for custom functions) and wraps them\n * using the mutator proxy.\n */\nexport function makeMutateProperty(\n mutators: AnyMutatorRegistry | CustomMutatorDefs,\n mutatorProxy: MutatorProxy,\n mutateObject: Record<string, unknown>,\n replicacheMutate: Record<string, unknown>,\n): void {\n const processMutators = (\n mutators: AnyMutatorRegistry | CustomMutatorDefs,\n path: string[],\n mutateObject: Record<string, unknown>,\n ) => {\n for (const [key, mutator] of Object.entries(mutators)) {\n path.push(key);\n let fullKey: string | undefined;\n if (isMutator(mutator)) {\n fullKey = customMutatorKey('.', path);\n } else if (typeof mutator === 'function') {\n // Legacy CustomMutatorImpl\n fullKey = customMutatorKey('|', path);\n }\n\n if (fullKey) {\n mutateObject[key] = mutatorProxy.wrapCustomMutator(\n must(replicacheMutate[fullKey]) as unknown as (\n ...args: unknown[]\n ) => MutatorResult,\n );\n } else {\n // recursive build and process.\n let existing = mutateObject[key];\n if (existing === undefined) {\n existing = {};\n mutateObject[key] = existing;\n }\n processMutators(\n mutator as AnyMutatorRegistry | CustomMutatorDefs,\n path,\n existing as Record<string, unknown>,\n );\n }\n path.pop();\n }\n };\n\n processMutators(mutators, [], mutateObject);\n}\n\n/**\n * Builds the mutate type from mutator definitions, handling arbitrary nesting.\n * Each node can be either a MutatorDefinition or a CustomMutatorImpl function,\n * or a namespace containing more mutators.\n */\ntype MakeFromMutatorDefinitions<\n S extends Schema,\n MD extends AnyMutatorRegistry | CustomMutatorDefs,\n C,\n> = {\n readonly [K in keyof MD]: MD[K] extends MutatorDefinition<\n infer TInput,\n // oxlint-disable-next-line no-explicit-any\n any,\n
|
|
1
|
+
{"version":3,"file":"make-mutate-property.js","sources":["../../../../../zero-client/src/client/make-mutate-property.ts"],"sourcesContent":["import type {DeepMerge} from '../../../shared/src/deep-merge.ts';\nimport {must} from '../../../shared/src/must.ts';\nimport type {Schema} from '../../../zero-types/src/schema.ts';\nimport {\n customMutatorKey,\n type Transaction,\n} from '../../../zql/src/mutate/custom.ts';\nimport type {AnyMutatorRegistry} from '../../../zql/src/mutate/mutator-registry.ts';\nimport {\n isMutator,\n type MutatorDefinition,\n} from '../../../zql/src/mutate/mutator.ts';\nimport type {DBMutator} from './crud.ts';\nimport type {CustomMutatorDefs, MutatorResult} from './custom.ts';\nimport type {MutatorProxy} from './mutator-proxy.ts';\n\n/**\n * Creates and populates a mutate property object by processing mutator definitions recursively.\n *\n * This function traverses through mutator definitions (either schema-based or custom) and builds\n * a corresponding object structure where each mutator is wrapped by the mutator proxy. It handles\n * both flat mutator functions and nested mutator definition objects.\n *\n * @template S - The schema type that defines the structure of the data\n * @template C - The context type used by mutators, defaults to unknown\n *\n * @param mutators - The mutator definitions to process, can be schema-based or custom mutator definitions\n * @param mutatorProxy - The proxy object responsible for wrapping mutators with additional functionality\n * @param mutateObject - The target object to populate with wrapped mutators\n * @param replicacheMutate - The source object containing the actual mutator implementations to wrap\n *\n * @returns void - This function mutates the mutateObject parameter directly\n *\n * @remarks\n * The function recursively processes nested mutator structures, creating corresponding nested objects\n * in the mutateObject. For leaf mutators (functions or mutator definitions), it generates a full key\n * using different separators ('.' for mutator definitions, '|' for custom functions) and wraps them\n * using the mutator proxy.\n */\nexport function makeMutateProperty(\n mutators: AnyMutatorRegistry | CustomMutatorDefs,\n mutatorProxy: MutatorProxy,\n mutateObject: Record<string, unknown>,\n replicacheMutate: Record<string, unknown>,\n): void {\n const processMutators = (\n mutators: AnyMutatorRegistry | CustomMutatorDefs,\n path: string[],\n mutateObject: Record<string, unknown>,\n ) => {\n for (const [key, mutator] of Object.entries(mutators)) {\n path.push(key);\n let fullKey: string | undefined;\n if (isMutator(mutator)) {\n fullKey = customMutatorKey('.', path);\n } else if (typeof mutator === 'function') {\n // Legacy CustomMutatorImpl\n fullKey = customMutatorKey('|', path);\n }\n\n if (fullKey) {\n mutateObject[key] = mutatorProxy.wrapCustomMutator(\n must(replicacheMutate[fullKey]) as unknown as (\n ...args: unknown[]\n ) => MutatorResult,\n );\n } else {\n // recursive build and process.\n let existing = mutateObject[key];\n if (existing === undefined) {\n existing = {};\n mutateObject[key] = existing;\n }\n processMutators(\n mutator as AnyMutatorRegistry | CustomMutatorDefs,\n path,\n existing as Record<string, unknown>,\n );\n }\n path.pop();\n }\n };\n\n processMutators(mutators, [], mutateObject);\n}\n\n/**\n * Builds the mutate type from mutator definitions, handling arbitrary nesting.\n * Each node can be either a MutatorDefinition or a CustomMutatorImpl function,\n * or a namespace containing more mutators.\n */\ntype MakeFromMutatorDefinitions<\n S extends Schema,\n MD extends AnyMutatorRegistry | CustomMutatorDefs,\n C,\n> = {\n readonly [K in keyof MD]: MD[K] extends MutatorDefinition<\n infer TInput,\n // oxlint-disable-next-line no-explicit-any\n any,\n C,\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n any\n >\n ? [TInput] extends [undefined]\n ? () => MutatorResult\n : undefined extends TInput\n ? (args?: TInput) => MutatorResult\n : (args: TInput) => MutatorResult\n : MD[K] extends (tx: Transaction<S>, ...args: infer Args) => Promise<void>\n ? (...args: Args) => MutatorResult\n : MD[K] extends AnyMutatorRegistry | CustomMutatorDefs\n ? MakeFromMutatorDefinitions<S, MD[K], C>\n : never;\n};\n\nexport type MakeMutatePropertyType<\n S extends Schema,\n MD extends CustomMutatorDefs | undefined,\n C,\n> = MD extends AnyMutatorRegistry\n ? // MutatorRegistry: no property tree, user calls zero.mutate(mr) directly\n {}\n : MD extends AnyMutatorRegistry | CustomMutatorDefs\n ? S['enableLegacyMutators'] extends false\n ? MakeFromMutatorDefinitions<S, MD, C>\n : DeepMerge<DBMutator<S>, MakeFromMutatorDefinitions<S, MD, C>>\n : DBMutator<S>;\n"],"names":["mutators","mutateObject"],"mappings":";;;AAuCO,SAAS,mBACd,UACA,cACA,cACA,kBACM;AACN,QAAM,kBAAkB,CACtBA,WACA,MACAC,kBACG;AACH,eAAW,CAAC,KAAK,OAAO,KAAK,OAAO,QAAQD,SAAQ,GAAG;AACrD,WAAK,KAAK,GAAG;AACb,UAAI;AACJ,UAAI,UAAU,OAAO,GAAG;AACtB,kBAAU,iBAAiB,KAAK,IAAI;AAAA,MACtC,WAAW,OAAO,YAAY,YAAY;AAExC,kBAAU,iBAAiB,KAAK,IAAI;AAAA,MACtC;AAEA,UAAI,SAAS;AACXC,sBAAa,GAAG,IAAI,aAAa;AAAA,UAC/B,KAAK,iBAAiB,OAAO,CAAC;AAAA,QAAA;AAAA,MAIlC,OAAO;AAEL,YAAI,WAAWA,cAAa,GAAG;AAC/B,YAAI,aAAa,QAAW;AAC1B,qBAAW,CAAA;AACXA,wBAAa,GAAG,IAAI;AAAA,QACtB;AACA;AAAA,UACE;AAAA,UACA;AAAA,UACA;AAAA,QAAA;AAAA,MAEJ;AACA,WAAK,IAAA;AAAA,IACP;AAAA,EACF;AAEA,kBAAgB,UAAU,CAAA,GAAI,YAAY;AAC5C;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"make-replicache-mutators.js","sources":["../../../../../zero-client/src/client/make-replicache-mutators.ts"],"sourcesContent":["import type {LogContext} from '@rocicorp/logger';\nimport type {MutatorDefs} from '../../../replicache/src/types.ts';\nimport type {ReadonlyJSONValue} from '../../../shared/src/json.ts';\nimport {CRUD_MUTATION_NAME} from '../../../zero-protocol/src/push.ts';\nimport type {Schema} from '../../../zero-types/src/schema.ts';\nimport {customMutatorKey} from '../../../zql/src/mutate/custom.ts';\nimport {\n isMutatorRegistry,\n type AnyMutatorRegistry,\n} from '../../../zql/src/mutate/mutator-registry.ts';\nimport {type Mutator} from '../../../zql/src/mutate/mutator.ts';\nimport {ClientErrorKind} from './client-error-kind.ts';\nimport {makeCRUDMutator, type CRUDMutator} from './crud.ts';\nimport type {CustomMutatorDefs, CustomMutatorImpl} from './custom.ts';\nimport {\n makeReplicacheMutator as makeReplicacheMutatorLegacy,\n TransactionImpl,\n} from './custom.ts';\nimport {ClientError} from './error.ts';\nimport type {WriteTransaction} from './replicache-types.ts';\n\nexport function extendReplicacheMutators<S extends Schema, C>(\n lc: LogContext,\n context: C,\n mutators: AnyMutatorRegistry | CustomMutatorDefs,\n schema: S,\n mutateObject: Record<string, unknown>,\n): void {\n // Recursively process mutator definitions at arbitrary depth\n const processMutators = (mutators: object, path: string[]) => {\n for (const [key, mutator] of Object.entries(mutators)) {\n path.push(key);\n if (isMutator(mutator)) {\n const fullKey = customMutatorKey('.', path);\n mutateObject[fullKey] = makeReplicacheMutator(\n lc,\n mutator,\n schema,\n context,\n );\n } else if (typeof mutator === 'function') {\n const fullKey = customMutatorKey('|', path);\n mutateObject[fullKey] = makeReplicacheMutatorLegacy(\n lc,\n // oxlint-disable-next-line no-explicit-any\n mutator as CustomMutatorImpl<any>,\n schema,\n context,\n );\n } else {\n processMutators(mutator, path);\n }\n path.pop();\n }\n };\n\n processMutators(mutators, []);\n}\n\nfunction makeReplicacheMutator<\n TArgs extends ReadonlyJSONValue | undefined,\n TSchema extends Schema,\n TContext,\n TWrappedTransaction,\n>(\n lc: LogContext,\n mutator: Mutator<TArgs, TSchema, TContext, TWrappedTransaction>,\n schema: TSchema,\n context: TContext,\n): (repTx: WriteTransaction, args: ReadonlyJSONValue) => Promise<void> {\n return async (\n repTx: WriteTransaction,\n args: ReadonlyJSONValue,\n ): Promise<void> => {\n const tx = new TransactionImpl(lc, repTx, schema);\n // fn does input validation internally\n await mutator.fn({\n args: args as TArgs,\n ctx: context,\n tx: tx,\n });\n };\n}\n\n/**\n * Creates Replicache mutators from mutator definitions.\n *\n * This function processes mutator definitions at arbitrary depth, supporting both\n * new-style mutator definitions and legacy custom mutator implementations. It creates\n * a mutator object with the CRUD mutator and any provided custom mutators, with keys\n * generated based on their path in the mutator definition hierarchy.\n *\n * @template S - The schema type that defines the structure of the data\n * @template C - The type of the context object passed to mutators\n *\n * @param schema - The schema instance used for validation and type checking\n * @param mutators - The mutator definitions to process, can be nested objects or custom mutator definitions\n * @param context - The context to be passed to mutators\n * @param lc - The log context used for logging operations\n *\n * @returns A mutator definitions object containing the CRUD mutator and any custom mutators\n *\n * @remarks\n * - New-style mutator definitions use '.' as a separator in their keys\n * - Legacy custom mutator implementations use '|' as a separator in their keys\n * - The CRUD mutator can be disabled by setting `enableLegacyMutators: false` in the schema\n */\nexport function makeReplicacheMutators<const S extends Schema, C>(\n schema: S,\n mutators: AnyMutatorRegistry | CustomMutatorDefs | undefined,\n context: C,\n lc: LogContext,\n): MutatorDefs & {_zero_crud: CRUDMutator} {\n const {enableLegacyMutators = true} = schema;\n\n const replicacheMutators = {\n [CRUD_MUTATION_NAME]: enableLegacyMutators\n ? makeCRUDMutator(schema)\n : () =>\n Promise.reject(\n new ClientError({\n kind: ClientErrorKind.Internal,\n message: 'Zero CRUD mutators are not enabled.',\n }),\n ),\n };\n\n if (mutators) {\n if (isMutatorRegistry(mutators)) {\n extendFromMutatorRegistry(\n lc,\n context,\n mutators,\n schema,\n replicacheMutators,\n );\n } else {\n extendReplicacheMutators(\n lc,\n context,\n mutators as CustomMutatorDefs,\n schema,\n replicacheMutators,\n );\n }\n }\n\n return replicacheMutators;\n}\n\n/**\n * Checks if a value is a Mutator (from MutatorRegistry).\n * Mutators have `mutatorName` and `fn` properties.\n */\nfunction isMutator(\n value: unknown,\n // oxlint-disable-next-line no-explicit-any\n): value is Mutator<any, any, any
|
|
1
|
+
{"version":3,"file":"make-replicache-mutators.js","sources":["../../../../../zero-client/src/client/make-replicache-mutators.ts"],"sourcesContent":["import type {LogContext} from '@rocicorp/logger';\nimport type {MutatorDefs} from '../../../replicache/src/types.ts';\nimport type {ReadonlyJSONValue} from '../../../shared/src/json.ts';\nimport {CRUD_MUTATION_NAME} from '../../../zero-protocol/src/push.ts';\nimport type {Schema} from '../../../zero-types/src/schema.ts';\nimport {customMutatorKey} from '../../../zql/src/mutate/custom.ts';\nimport {\n isMutatorRegistry,\n type AnyMutatorRegistry,\n} from '../../../zql/src/mutate/mutator-registry.ts';\nimport {type Mutator} from '../../../zql/src/mutate/mutator.ts';\nimport {ClientErrorKind} from './client-error-kind.ts';\nimport {makeCRUDMutator, type CRUDMutator} from './crud.ts';\nimport type {CustomMutatorDefs, CustomMutatorImpl} from './custom.ts';\nimport {\n makeReplicacheMutator as makeReplicacheMutatorLegacy,\n TransactionImpl,\n} from './custom.ts';\nimport {ClientError} from './error.ts';\nimport type {WriteTransaction} from './replicache-types.ts';\n\nexport function extendReplicacheMutators<S extends Schema, C>(\n lc: LogContext,\n context: C,\n mutators: AnyMutatorRegistry | CustomMutatorDefs,\n schema: S,\n mutateObject: Record<string, unknown>,\n): void {\n // Recursively process mutator definitions at arbitrary depth\n const processMutators = (mutators: object, path: string[]) => {\n for (const [key, mutator] of Object.entries(mutators)) {\n path.push(key);\n if (isMutator(mutator)) {\n const fullKey = customMutatorKey('.', path);\n mutateObject[fullKey] = makeReplicacheMutator(\n lc,\n mutator,\n schema,\n context,\n );\n } else if (typeof mutator === 'function') {\n const fullKey = customMutatorKey('|', path);\n mutateObject[fullKey] = makeReplicacheMutatorLegacy(\n lc,\n // oxlint-disable-next-line no-explicit-any\n mutator as CustomMutatorImpl<any>,\n schema,\n context,\n );\n } else {\n processMutators(mutator, path);\n }\n path.pop();\n }\n };\n\n processMutators(mutators, []);\n}\n\nfunction makeReplicacheMutator<\n TArgs extends ReadonlyJSONValue | undefined,\n TSchema extends Schema,\n TContext,\n TWrappedTransaction,\n>(\n lc: LogContext,\n mutator: Mutator<TArgs, TSchema, TContext, TWrappedTransaction>,\n schema: TSchema,\n context: TContext,\n): (repTx: WriteTransaction, args: ReadonlyJSONValue) => Promise<void> {\n return async (\n repTx: WriteTransaction,\n args: ReadonlyJSONValue,\n ): Promise<void> => {\n const tx = new TransactionImpl(lc, repTx, schema);\n // fn does input validation internally\n await mutator.fn({\n args: args as TArgs,\n ctx: context,\n tx: tx,\n });\n };\n}\n\n/**\n * Creates Replicache mutators from mutator definitions.\n *\n * This function processes mutator definitions at arbitrary depth, supporting both\n * new-style mutator definitions and legacy custom mutator implementations. It creates\n * a mutator object with the CRUD mutator and any provided custom mutators, with keys\n * generated based on their path in the mutator definition hierarchy.\n *\n * @template S - The schema type that defines the structure of the data\n * @template C - The type of the context object passed to mutators\n *\n * @param schema - The schema instance used for validation and type checking\n * @param mutators - The mutator definitions to process, can be nested objects or custom mutator definitions\n * @param context - The context to be passed to mutators\n * @param lc - The log context used for logging operations\n *\n * @returns A mutator definitions object containing the CRUD mutator and any custom mutators\n *\n * @remarks\n * - New-style mutator definitions use '.' as a separator in their keys\n * - Legacy custom mutator implementations use '|' as a separator in their keys\n * - The CRUD mutator can be disabled by setting `enableLegacyMutators: false` in the schema\n */\nexport function makeReplicacheMutators<const S extends Schema, C>(\n schema: S,\n mutators: AnyMutatorRegistry | CustomMutatorDefs | undefined,\n context: C,\n lc: LogContext,\n): MutatorDefs & {_zero_crud: CRUDMutator} {\n const {enableLegacyMutators = true} = schema;\n\n const replicacheMutators = {\n [CRUD_MUTATION_NAME]: enableLegacyMutators\n ? makeCRUDMutator(schema)\n : () =>\n Promise.reject(\n new ClientError({\n kind: ClientErrorKind.Internal,\n message: 'Zero CRUD mutators are not enabled.',\n }),\n ),\n };\n\n if (mutators) {\n if (isMutatorRegistry(mutators)) {\n extendFromMutatorRegistry(\n lc,\n context,\n mutators,\n schema,\n replicacheMutators,\n );\n } else {\n extendReplicacheMutators(\n lc,\n context,\n mutators as CustomMutatorDefs,\n schema,\n replicacheMutators,\n );\n }\n }\n\n return replicacheMutators;\n}\n\n/**\n * Checks if a value is a Mutator (from MutatorRegistry).\n * Mutators have `mutatorName` and `fn` properties.\n */\nfunction isMutator(\n value: unknown,\n // oxlint-disable-next-line no-explicit-any\n): value is Mutator<any, any, any> {\n return (\n typeof value === 'function' &&\n 'mutatorName' in value &&\n typeof value.mutatorName === 'string' &&\n 'fn' in value &&\n typeof value.fn === 'function'\n );\n}\n\n/**\n * Extends replicache mutators from a MutatorRegistry.\n * Walks the registry tree and wraps each Mutator.fn for Replicache.\n */\nfunction extendFromMutatorRegistry<S extends Schema, C>(\n lc: LogContext,\n context: C,\n registry: AnyMutatorRegistry,\n schema: S,\n mutateObject: Record<string, unknown>,\n): void {\n const walk = (node: unknown) => {\n if (typeof node !== 'object' || node === null) {\n return;\n }\n for (const value of Object.values(node)) {\n if (isMutator(value)) {\n // Mutator.fn already handles validation internally\n mutateObject[value.mutatorName] = (\n repTx: WriteTransaction,\n args: ReadonlyJSONValue,\n ): Promise<void> => {\n const tx = new TransactionImpl(lc, repTx, schema);\n return value.fn({args, ctx: context, tx});\n };\n } else if (typeof value === 'object' && value !== null) {\n // Nested namespace\n walk(value);\n }\n }\n };\n walk(registry);\n}\n"],"names":["mutators","makeReplicacheMutatorLegacy","ClientErrorKind.Internal"],"mappings":";;;;;;;AAqBO,SAAS,yBACd,IACA,SACA,UACA,QACA,cACM;AAEN,QAAM,kBAAkB,CAACA,WAAkB,SAAmB;AAC5D,eAAW,CAAC,KAAK,OAAO,KAAK,OAAO,QAAQA,SAAQ,GAAG;AACrD,WAAK,KAAK,GAAG;AACb,UAAI,UAAU,OAAO,GAAG;AACtB,cAAM,UAAU,iBAAiB,KAAK,IAAI;AAC1C,qBAAa,OAAO,IAAI;AAAA,UACtB;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QAAA;AAAA,MAEJ,WAAW,OAAO,YAAY,YAAY;AACxC,cAAM,UAAU,iBAAiB,KAAK,IAAI;AAC1C,qBAAa,OAAO,IAAIC;AAAAA,UACtB;AAAA;AAAA,UAEA;AAAA,UACA;AA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EpB,qBAAa,MAAM,WAAW,IAAI,CAChC,OACA,SACkB;AAClB,gBAAM,KAAK,IAAI,gBAAgB,IAAI,OAAO,MAAM;AAChD,iBAAO,MAAM,GAAG,EAAC,MAAM,KAAK,SAAS,IAAG;AAAA,QAC1C;AAAA,MACF,WAAW,OAAO,UAAU,YAAY,UAAU,MAAM;AAEtD,aAAK,KAAK;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AACA,OAAK,QAAQ;AACf;"}
|
|
@@ -9,7 +9,7 @@ import { UpdateNeededReasonType } from './update-needed-reason-type.ts';
|
|
|
9
9
|
/**
|
|
10
10
|
* Configuration for {@linkcode Zero}.
|
|
11
11
|
*/
|
|
12
|
-
export interface ZeroOptions<S extends Schema = DefaultSchema, MD extends
|
|
12
|
+
export interface ZeroOptions<S extends Schema = DefaultSchema, MD extends CustomMutatorDefs | undefined = undefined, C = DefaultContext> {
|
|
13
13
|
/**
|
|
14
14
|
* URL to the zero-cache. This can be a simple hostname, e.g.
|
|
15
15
|
* - "https://myapp-myteam.zero.ms"
|
|
@@ -113,7 +113,7 @@ export interface ZeroOptions<S extends Schema = DefaultSchema, MD extends AnyMut
|
|
|
113
113
|
* await z.mutate.issues.close({id: 'issue-123'}).client;
|
|
114
114
|
* ```
|
|
115
115
|
*/
|
|
116
|
-
mutators?: MD | undefined;
|
|
116
|
+
mutators?: MD extends CustomMutatorDefs ? MD : AnyMutatorRegistry | undefined;
|
|
117
117
|
/**
|
|
118
118
|
* Custom URL for mutation requests sent to your API server.
|
|
119
119
|
* If not provided, uses the default configured in zero-cache.
|
|
@@ -279,7 +279,7 @@ export interface ZeroOptions<S extends Schema = DefaultSchema, MD extends AnyMut
|
|
|
279
279
|
/**
|
|
280
280
|
* @deprecated Use {@link ZeroOptions} instead.
|
|
281
281
|
*/
|
|
282
|
-
export interface ZeroAdvancedOptions<S extends Schema, MD extends
|
|
282
|
+
export interface ZeroAdvancedOptions<S extends Schema, MD extends CustomMutatorDefs | undefined, Context> extends ZeroOptions<S, MD, Context> {
|
|
283
283
|
}
|
|
284
284
|
type UpdateNeededReasonBase = {
|
|
285
285
|
message?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../../../zero-client/src/client/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,qCAAqC,CAAC;AACvE,OAAO,KAAK,CAAC,MAAM,+BAA+B,CAAC;AACnD,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACd,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,mCAAmC,CAAC;AAC9D,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,6CAA6C,CAAC;AACpF,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,aAAa,CAAC;AACnD,OAAO,EAAC,sBAAsB,EAAC,MAAM,gCAAgC,CAAC;AAEtE;;GAEG;AACH,MAAM,WAAW,WAAW,CAC1B,CAAC,SAAS,MAAM,GAAG,aAAa,EAChC,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../../../zero-client/src/client/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,qCAAqC,CAAC;AACvE,OAAO,KAAK,CAAC,MAAM,+BAA+B,CAAC;AACnD,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACd,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,mCAAmC,CAAC;AAC9D,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,6CAA6C,CAAC;AACpF,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,aAAa,CAAC;AACnD,OAAO,E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sB,CAAC,GACxE,CAAC;IACC,IAAI,EAAE,sBAAsB,CAAC,mBAAmB,CAAC;CAClD,GAAG,sBAAsB,CAAC,GAC3B,CAAC;IACC,IAAI,EAAE,sBAAsB,CAAC,yBAAyB,CAAC;CACxD,GAAG,sBAAsB,CAAC,CAAC;AAEhC,eAAO,MAAM,4BAA4B,EAAE,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAKzE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.js","sources":["../../../../../zero-client/src/client/options.ts"],"sourcesContent":["import type {LogLevel} from '@rocicorp/logger';\nimport type {StoreProvider} from '../../../replicache/src/kv/store.ts';\nimport * as v from '../../../shared/src/valita.ts';\nimport type {\n DefaultContext,\n DefaultSchema,\n} from '../../../zero-types/src/default-types.ts';\nimport type {Schema} from '../../../zero-types/src/schema.ts';\nimport type {AnyMutatorRegistry} from '../../../zql/src/mutate/mutator-registry.ts';\nimport type {CustomMutatorDefs} from './custom.ts';\nimport {UpdateNeededReasonType} from './update-needed-reason-type.ts';\n\n/**\n * Configuration for {@linkcode Zero}.\n */\nexport interface ZeroOptions<\n S extends Schema = DefaultSchema,\n MD extends AnyMutatorRegistry | CustomMutatorDefs | undefined = undefined,\n C = DefaultContext,\n> {\n /**\n * URL to the zero-cache. This can be a simple hostname, e.g.\n * - \"https://myapp-myteam.zero.ms\"\n * or a prefix with a single path component, e.g.\n * - \"https://myapp-myteam.zero.ms/zero\"\n * - \"https://myapp-myteam.zero.ms/db\"\n *\n * The latter is useful for configuring routing rules (e.g. \"/zero/\\*\") when\n * the zero-cache is hosted on the same domain as the application. **Note that\n * only a single path segment is allowed (e.g. it cannot be \"/proxy/zero/\\*\")**.\n */\n cacheURL?: string | null | undefined;\n\n /**\n * @deprecated Use {@linkcode cacheURL} instead.\n */\n server?: string | null | undefined;\n\n /**\n * A token to identify and authenticate the user.\n *\n * Set `auth` to `null` or `undefined` if there is no logged in user.\n *\n * When a 401 or 403 HTTP status code is received from your server, Zero will\n * transition to the `needs-auth` connection state. The app should call\n * `zero.connection.connect({auth: newToken})` with a new token to reconnect.\n *\n * The call to `connect` is handled automatically by the ZeroProvider component\n * for React and SolidJS when the `auth` prop changes.\n */\n auth?: string | null | undefined;\n\n /**\n * A unique identifier for the user. Must be non-empty.\n *\n * Each userID gets its own client-side storage so that the app can switch\n * between users without losing state.\n *\n * This must match the `sub` claim of the `auth` token if\n * `auth` is provided.\n */\n userID: string;\n\n /**\n * Distinguishes the storage used by this Zero instance from that of other\n * instances with the same userID. Useful in the case where the app wants to\n * have multiple Zero instances for the same user for different parts of the\n * app.\n */\n storageKey?: string | undefined;\n\n /**\n * Determines the level of detail at which Zero logs messages about\n * its operation. Messages are logged to the `console`.\n *\n * When this is set to `'debug'`, `'info'` and `'error'` messages are also\n * logged. When set to `'info'`, `'info'` and `'error'` but not\n * `'debug'` messages are logged. When set to `'error'` only `'error'`\n * messages are logged.\n *\n * Default is `'error'`.\n */\n logLevel?: LogLevel | undefined;\n\n /**\n * This defines the schema of the tables used in Zero and their relationships\n * to one another.\n */\n schema: S;\n\n /**\n * `mutators` is a map of custom mutator definitions. The keys are\n * namespaces or names of the mutators. The values are the mutator\n * implementations. Client side mutators must be idempotent as a\n * mutation can be rebased multiple times when folding in authoritative\n * changes from the server to the client.\n *\n * Define mutators using the `defineMutator` function to create type-safe,\n * parameterized mutations. Mutators can be top-level or grouped in namespaces.\n *\n * @example\n * ```ts\n * import {defineMutator} from '@rocicorp/zero';\n *\n * const z = new Zero({\n * schema,\n * userID,\n * mutators: {\n * // Top-level mutator\n * increment: defineMutator(({tx, args}: {tx: Transaction<Schema>, args: {id: string}}) =>\n * tx.mutate.counter.update({id: args.id, value: tx.query.counter.where('id', '=', args.id).value + 1})\n * ),\n * // Namespace with multiple mutators\n * issues: {\n * create: defineMutator(({tx, args}: {tx: Transaction<Schema>, args: {title: string}}) =>\n * tx.mutate.issues.insert({id: nanoid(), title: args.title, status: 'open'})\n * ),\n * close: defineMutator(({tx, args}: {tx: Transaction<Schema>, args: {id: string}}) =>\n * tx.mutate.issues.update({id: args.id, status: 'closed'})\n * ),\n * },\n * },\n * });\n *\n * // Usage\n * await z.mutate.increment({id: 'counter-1'}).client;\n * await z.mutate.issues.create({title: 'New issue'}).client;\n * await z.mutate.issues.close({id: 'issue-123'}).client;\n * ```\n */\n mutators?: MD | undefined;\n\n /**\n * Custom URL for mutation requests sent to your API server.\n * If not provided, uses the default configured in zero-cache.\n */\n mutateURL?: string | undefined;\n\n /**\n * Custom URL for query requests sent to your API server.\n * If not provided, uses the default configured in zero-cache.\n *\n * @deprecated Use {@linkcode queryURL} instead.\n */\n getQueriesURL?: string | undefined;\n\n /**\n * Custom URL for query requests sent to your API server.\n * If not provided, uses the default configured in zero-cache.\n */\n queryURL?: string | undefined;\n\n /**\n * `onOnlineChange` is called when the Zero instance's online status changes.\n *\n * @deprecated Use {@linkcode Connection.state.subscribe} on the Zero instance instead. e.g.\n * ```ts\n * const zero = new Zero({...});\n * zero.connection.state.subscribe((state) => {\n * console.log('Connection state:', state.name);\n * });\n * ```\n *\n * Or use a hook like {@linkcode useZeroConnectionState} to subscribe to state changes.\n */\n onOnlineChange?: ((online: boolean) => void) | undefined;\n\n /**\n * `onUpdateNeeded` is called when a client code update is needed.\n *\n * See {@link UpdateNeededReason} for why updates can be needed.\n *\n * The default behavior is to reload the page (using `location.reload()`).\n * Provide your own function to prevent the page from\n * reloading automatically. You may want to display a toast to inform the end\n * user there is a new version of your app available and prompt them to\n * refresh.\n */\n onUpdateNeeded?: ((reason: UpdateNeededReason) => void) | undefined;\n\n /**\n * `onClientStateNotFound` is called when this client is no longer able\n * to sync with the zero-cache due to missing synchronization state. This\n * can be because:\n * - the local persistent synchronization state has been garbage collected.\n * This can happen if the client has no pending mutations and has not been\n * used for a while (e.g. the client's tab has been hidden for a long time).\n * - the zero-cache fails to find the server side synchronization state for\n * this client.\n *\n * The default behavior is to reload the page (using `location.reload()`).\n * Provide your own function to prevent the page from reloading automatically.\n */\n onClientStateNotFound?: (() => void) | undefined;\n\n /**\n * The number of milliseconds to wait before disconnecting a Zero\n * instance whose tab has become hidden.\n *\n * Instances in hidden tabs are disconnected to save resources.\n *\n * Default is 5_000.\n */\n hiddenTabDisconnectDelay?: number | undefined;\n\n /**\n * The number of milliseconds to wait before disconnecting a Zero\n * instance when the connection to the server has timed out.\n *\n * Default is 5 minutes.\n */\n disconnectTimeoutMs?: number | undefined;\n\n /**\n * The timeout in milliseconds for ping operations. This value is used for:\n * - How long to wait in idle before sending a ping to the server\n * - How long to wait for a pong response after sending a ping\n *\n * Total time to detect a dead connection is 2 × pingTimeoutMs.\n *\n * Default is 5_000.\n */\n pingTimeoutMs?: number | undefined;\n\n /**\n * Determines what kind of storage implementation to use on the client.\n *\n * Defaults to `'idb'` which means that Zero uses an IndexedDB storage\n * implementation. This allows the data to be persisted on the client and\n * enables faster syncs between application restarts.\n *\n * By setting this to `'mem'`, Zero uses an in memory storage and\n * the data is not persisted on the client.\n *\n * You can also set this to a function that is used to create new KV stores,\n * allowing a custom implementation of the underlying storage layer.\n */\n kvStore?: 'mem' | 'idb' | StoreProvider | undefined;\n\n /**\n * The maximum number of bytes to allow in a single header.\n *\n * Zero adds some extra information to headers on initialization if possible.\n * This speeds up data synchronization. This number should be kept less than\n * or equal to the maximum header size allowed by the zero-cache and any load\n * balancers.\n *\n * Default value: 8kb.\n */\n maxHeaderLength?: number | undefined;\n\n /**\n * The maximum amount of milliseconds to wait for a materialization to\n * complete (including network/server time) before printing a warning to the\n * console.\n *\n * Default value: 5_000.\n */\n slowMaterializeThreshold?: number | undefined;\n\n /**\n * UI rendering libraries will often provide a utility for batching multiple\n * state updates into a single render. Some examples are React's\n * `unstable_batchedUpdates`, and solid-js's `batch`.\n *\n * This option enables integrating these batch utilities with Zero.\n *\n * When `batchViewUpdates` is provided, Zero will call it whenever\n * it updates query view state with an `applyViewUpdates` function\n * that performs the actual state updates.\n *\n * Zero updates query view state when:\n * 1. creating a new view\n * 2. updating all existing queries' views to a new consistent state\n *\n * When creating a new view, that single view's creation will be wrapped\n * in a `batchViewUpdates` call.\n *\n * When updating existing queries, all queries will be updated in a single\n * `batchViewUpdates` call, so that the transition to the new consistent\n * state can be done in a single render.\n *\n * Implementations must always call `applyViewUpdates` synchronously.\n */\n batchViewUpdates?: ((applyViewUpdates: () => void) => void) | undefined;\n\n /**\n * The maximum number of recent queries, no longer subscribed to by a preload\n * or view, to continue syncing.\n *\n * Defaults is 0.\n *\n * @deprecated Use ttl instead\n */\n maxRecentQueries?: number | undefined;\n\n /**\n * Changes to queries are sent to server in batches. This option controls\n * the number of milliseconds to wait before sending the next batch.\n *\n * Defaults is 10.\n */\n queryChangeThrottleMs?: number | undefined;\n\n /**\n * Context is passed to Synced Queries when they are executed\n */\n // TODO(arv): Mutators should also get context.\n context?: C | undefined;\n}\n\n/**\n * @deprecated Use {@link ZeroOptions} instead.\n */\nexport interface ZeroAdvancedOptions<\n S extends Schema,\n MD extends AnyMutatorRegistry | CustomMutatorDefs | undefined,\n Context,\n> extends ZeroOptions<S, MD, Context> {}\n\ntype UpdateNeededReasonBase = {\n message?: string;\n};\n\nexport type UpdateNeededReason =\n | ({type: UpdateNeededReasonType.NewClientGroup} & UpdateNeededReasonBase)\n | ({\n type: UpdateNeededReasonType.VersionNotSupported;\n } & UpdateNeededReasonBase)\n | ({\n type: UpdateNeededReasonType.SchemaVersionNotSupported;\n } & UpdateNeededReasonBase);\n\nexport const updateNeededReasonTypeSchema: v.Type<UpdateNeededReason['type']> =\n v.literalUnion(\n UpdateNeededReasonType.NewClientGroup,\n UpdateNeededReasonType.VersionNotSupported,\n UpdateNeededReasonType.SchemaVersionNotSupported,\n );\n"],"names":["v.literalUnion","UpdateNeededReasonType.NewClientGroup","UpdateNeededReasonType.VersionNotSupported","UpdateNeededReasonType.SchemaVersionNotSupported"],"mappings":";;AA6UO,MAAM,+BACXA;AAAAA,EACEC;AAAAA,EACAC;AAAAA,EACAC;AACF;"}
|
|
1
|
+
{"version":3,"file":"options.js","sources":["../../../../../zero-client/src/client/options.ts"],"sourcesContent":["import type {LogLevel} from '@rocicorp/logger';\nimport type {StoreProvider} from '../../../replicache/src/kv/store.ts';\nimport * as v from '../../../shared/src/valita.ts';\nimport type {\n DefaultContext,\n DefaultSchema,\n} from '../../../zero-types/src/default-types.ts';\nimport type {Schema} from '../../../zero-types/src/schema.ts';\nimport type {AnyMutatorRegistry} from '../../../zql/src/mutate/mutator-registry.ts';\nimport type {CustomMutatorDefs} from './custom.ts';\nimport {UpdateNeededReasonType} from './update-needed-reason-type.ts';\n\n/**\n * Configuration for {@linkcode Zero}.\n */\nexport interface ZeroOptions<\n S extends Schema = DefaultSchema,\n MD extends CustomMutatorDefs | undefined = undefined,\n C = DefaultContext,\n> {\n /**\n * URL to the zero-cache. This can be a simple hostname, e.g.\n * - \"https://myapp-myteam.zero.ms\"\n * or a prefix with a single path component, e.g.\n * - \"https://myapp-myteam.zero.ms/zero\"\n * - \"https://myapp-myteam.zero.ms/db\"\n *\n * The latter is useful for configuring routing rules (e.g. \"/zero/\\*\") when\n * the zero-cache is hosted on the same domain as the application. **Note that\n * only a single path segment is allowed (e.g. it cannot be \"/proxy/zero/\\*\")**.\n */\n cacheURL?: string | null | undefined;\n\n /**\n * @deprecated Use {@linkcode cacheURL} instead.\n */\n server?: string | null | undefined;\n\n /**\n * A token to identify and authenticate the user.\n *\n * Set `auth` to `null` or `undefined` if there is no logged in user.\n *\n * When a 401 or 403 HTTP status code is received from your server, Zero will\n * transition to the `needs-auth` connection state. The app should call\n * `zero.connection.connect({auth: newToken})` with a new token to reconnect.\n *\n * The call to `connect` is handled automatically by the ZeroProvider component\n * for React and SolidJS when the `auth` prop changes.\n */\n auth?: string | null | undefined;\n\n /**\n * A unique identifier for the user. Must be non-empty.\n *\n * Each userID gets its own client-side storage so that the app can switch\n * between users without losing state.\n *\n * This must match the `sub` claim of the `auth` token if\n * `auth` is provided.\n */\n userID: string;\n\n /**\n * Distinguishes the storage used by this Zero instance from that of other\n * instances with the same userID. Useful in the case where the app wants to\n * have multiple Zero instances for the same user for different parts of the\n * app.\n */\n storageKey?: string | undefined;\n\n /**\n * Determines the level of detail at which Zero logs messages about\n * its operation. Messages are logged to the `console`.\n *\n * When this is set to `'debug'`, `'info'` and `'error'` messages are also\n * logged. When set to `'info'`, `'info'` and `'error'` but not\n * `'debug'` messages are logged. When set to `'error'` only `'error'`\n * messages are logged.\n *\n * Default is `'error'`.\n */\n logLevel?: LogLevel | undefined;\n\n /**\n * This defines the schema of the tables used in Zero and their relationships\n * to one another.\n */\n schema: S;\n\n /**\n * `mutators` is a map of custom mutator definitions. The keys are\n * namespaces or names of the mutators. The values are the mutator\n * implementations. Client side mutators must be idempotent as a\n * mutation can be rebased multiple times when folding in authoritative\n * changes from the server to the client.\n *\n * Define mutators using the `defineMutator` function to create type-safe,\n * parameterized mutations. Mutators can be top-level or grouped in namespaces.\n *\n * @example\n * ```ts\n * import {defineMutator} from '@rocicorp/zero';\n *\n * const z = new Zero({\n * schema,\n * userID,\n * mutators: {\n * // Top-level mutator\n * increment: defineMutator(({tx, args}: {tx: Transaction<Schema>, args: {id: string}}) =>\n * tx.mutate.counter.update({id: args.id, value: tx.query.counter.where('id', '=', args.id).value + 1})\n * ),\n * // Namespace with multiple mutators\n * issues: {\n * create: defineMutator(({tx, args}: {tx: Transaction<Schema>, args: {title: string}}) =>\n * tx.mutate.issues.insert({id: nanoid(), title: args.title, status: 'open'})\n * ),\n * close: defineMutator(({tx, args}: {tx: Transaction<Schema>, args: {id: string}}) =>\n * tx.mutate.issues.update({id: args.id, status: 'closed'})\n * ),\n * },\n * },\n * });\n *\n * // Usage\n * await z.mutate.increment({id: 'counter-1'}).client;\n * await z.mutate.issues.create({title: 'New issue'}).client;\n * await z.mutate.issues.close({id: 'issue-123'}).client;\n * ```\n */\n mutators?: MD extends CustomMutatorDefs ? MD : AnyMutatorRegistry | undefined;\n\n /**\n * Custom URL for mutation requests sent to your API server.\n * If not provided, uses the default configured in zero-cache.\n */\n mutateURL?: string | undefined;\n\n /**\n * Custom URL for query requests sent to your API server.\n * If not provided, uses the default configured in zero-cache.\n *\n * @deprecated Use {@linkcode queryURL} instead.\n */\n getQueriesURL?: string | undefined;\n\n /**\n * Custom URL for query requests sent to your API server.\n * If not provided, uses the default configured in zero-cache.\n */\n queryURL?: string | undefined;\n\n /**\n * `onOnlineChange` is called when the Zero instance's online status changes.\n *\n * @deprecated Use {@linkcode Connection.state.subscribe} on the Zero instance instead. e.g.\n * ```ts\n * const zero = new Zero({...});\n * zero.connection.state.subscribe((state) => {\n * console.log('Connection state:', state.name);\n * });\n * ```\n *\n * Or use a hook like {@linkcode useZeroConnectionState} to subscribe to state changes.\n */\n onOnlineChange?: ((online: boolean) => void) | undefined;\n\n /**\n * `onUpdateNeeded` is called when a client code update is needed.\n *\n * See {@link UpdateNeededReason} for why updates can be needed.\n *\n * The default behavior is to reload the page (using `location.reload()`).\n * Provide your own function to prevent the page from\n * reloading automatically. You may want to display a toast to inform the end\n * user there is a new version of your app available and prompt them to\n * refresh.\n */\n onUpdateNeeded?: ((reason: UpdateNeededReason) => void) | undefined;\n\n /**\n * `onClientStateNotFound` is called when this client is no longer able\n * to sync with the zero-cache due to missing synchronization state. This\n * can be because:\n * - the local persistent synchronization state has been garbage collected.\n * This can happen if the client has no pending mutations and has not been\n * used for a while (e.g. the client's tab has been hidden for a long time).\n * - the zero-cache fails to find the server side synchronization state for\n * this client.\n *\n * The default behavior is to reload the page (using `location.reload()`).\n * Provide your own function to prevent the page from reloading automatically.\n */\n onClientStateNotFound?: (() => void) | undefined;\n\n /**\n * The number of milliseconds to wait before disconnecting a Zero\n * instance whose tab has become hidden.\n *\n * Instances in hidden tabs are disconnected to save resources.\n *\n * Default is 5_000.\n */\n hiddenTabDisconnectDelay?: number | undefined;\n\n /**\n * The number of milliseconds to wait before disconnecting a Zero\n * instance when the connection to the server has timed out.\n *\n * Default is 5 minutes.\n */\n disconnectTimeoutMs?: number | undefined;\n\n /**\n * The timeout in milliseconds for ping operations. This value is used for:\n * - How long to wait in idle before sending a ping to the server\n * - How long to wait for a pong response after sending a ping\n *\n * Total time to detect a dead connection is 2 × pingTimeoutMs.\n *\n * Default is 5_000.\n */\n pingTimeoutMs?: number | undefined;\n\n /**\n * Determines what kind of storage implementation to use on the client.\n *\n * Defaults to `'idb'` which means that Zero uses an IndexedDB storage\n * implementation. This allows the data to be persisted on the client and\n * enables faster syncs between application restarts.\n *\n * By setting this to `'mem'`, Zero uses an in memory storage and\n * the data is not persisted on the client.\n *\n * You can also set this to a function that is used to create new KV stores,\n * allowing a custom implementation of the underlying storage layer.\n */\n kvStore?: 'mem' | 'idb' | StoreProvider | undefined;\n\n /**\n * The maximum number of bytes to allow in a single header.\n *\n * Zero adds some extra information to headers on initialization if possible.\n * This speeds up data synchronization. This number should be kept less than\n * or equal to the maximum header size allowed by the zero-cache and any load\n * balancers.\n *\n * Default value: 8kb.\n */\n maxHeaderLength?: number | undefined;\n\n /**\n * The maximum amount of milliseconds to wait for a materialization to\n * complete (including network/server time) before printing a warning to the\n * console.\n *\n * Default value: 5_000.\n */\n slowMaterializeThreshold?: number | undefined;\n\n /**\n * UI rendering libraries will often provide a utility for batching multiple\n * state updates into a single render. Some examples are React's\n * `unstable_batchedUpdates`, and solid-js's `batch`.\n *\n * This option enables integrating these batch utilities with Zero.\n *\n * When `batchViewUpdates` is provided, Zero will call it whenever\n * it updates query view state with an `applyViewUpdates` function\n * that performs the actual state updates.\n *\n * Zero updates query view state when:\n * 1. creating a new view\n * 2. updating all existing queries' views to a new consistent state\n *\n * When creating a new view, that single view's creation will be wrapped\n * in a `batchViewUpdates` call.\n *\n * When updating existing queries, all queries will be updated in a single\n * `batchViewUpdates` call, so that the transition to the new consistent\n * state can be done in a single render.\n *\n * Implementations must always call `applyViewUpdates` synchronously.\n */\n batchViewUpdates?: ((applyViewUpdates: () => void) => void) | undefined;\n\n /**\n * The maximum number of recent queries, no longer subscribed to by a preload\n * or view, to continue syncing.\n *\n * Defaults is 0.\n *\n * @deprecated Use ttl instead\n */\n maxRecentQueries?: number | undefined;\n\n /**\n * Changes to queries are sent to server in batches. This option controls\n * the number of milliseconds to wait before sending the next batch.\n *\n * Defaults is 10.\n */\n queryChangeThrottleMs?: number | undefined;\n\n /**\n * Context is passed to Synced Queries when they are executed\n */\n // TODO(arv): Mutators should also get context.\n context?: C | undefined;\n}\n\n/**\n * @deprecated Use {@link ZeroOptions} instead.\n */\nexport interface ZeroAdvancedOptions<\n S extends Schema,\n MD extends CustomMutatorDefs | undefined,\n Context,\n> extends ZeroOptions<S, MD, Context> {}\n\ntype UpdateNeededReasonBase = {\n message?: string;\n};\n\nexport type UpdateNeededReason =\n | ({type: UpdateNeededReasonType.NewClientGroup} & UpdateNeededReasonBase)\n | ({\n type: UpdateNeededReasonType.VersionNotSupported;\n } & UpdateNeededReasonBase)\n | ({\n type: UpdateNeededReasonType.SchemaVersionNotSupported;\n } & UpdateNeededReasonBase);\n\nexport const updateNeededReasonTypeSchema: v.Type<UpdateNeededReason['type']> =\n v.literalUnion(\n UpdateNeededReasonType.NewClientGroup,\n UpdateNeededReasonType.VersionNotSupported,\n UpdateNeededReasonType.SchemaVersionNotSupported,\n );\n"],"names":["v.literalUnion","UpdateNeededReasonType.NewClientGroup","UpdateNeededReasonType.VersionNotSupported","UpdateNeededReasonType.SchemaVersionNotSupported"],"mappings":";;AA6UO,MAAM,+BACXA;AAAAA,EACEC;AAAAA,EACAC;AAAAA,EACAC;AACF;"}
|
|
@@ -13,7 +13,6 @@ import type { NullableVersion } from '../../../zero-protocol/src/version.ts';
|
|
|
13
13
|
import type { DefaultContext, DefaultSchema } from '../../../zero-types/src/default-types.ts';
|
|
14
14
|
import type { Schema } from '../../../zero-types/src/schema.ts';
|
|
15
15
|
import type { ViewFactory } from '../../../zql/src/ivm/view.ts';
|
|
16
|
-
import { type AnyMutatorRegistry } from '../../../zql/src/mutate/mutator-registry.ts';
|
|
17
16
|
import type { MutationRequest } from '../../../zql/src/mutate/mutator.ts';
|
|
18
17
|
import type { QueryDelegate } from '../../../zql/src/query/query-delegate.ts';
|
|
19
18
|
import { type HumanReadable, type MaterializeOptions, type PreloadOptions, type PullRow, type RunOptions, type ToQuery } from '../../../zql/src/query/query.ts';
|
|
@@ -73,7 +72,7 @@ export interface ReplicacheInternalAPI {
|
|
|
73
72
|
lastMutationID(): number;
|
|
74
73
|
}
|
|
75
74
|
export declare function getInternalReplicacheImplForTesting(z: object): ReplicacheImpl<MutatorDefs>;
|
|
76
|
-
export declare class Zero<const S extends Schema = DefaultSchema, MD extends
|
|
75
|
+
export declare class Zero<const S extends Schema = DefaultSchema, MD extends CustomMutatorDefs | undefined = undefined, C = DefaultContext> {
|
|
77
76
|
#private;
|
|
78
77
|
readonly version: string;
|
|
79
78
|
readonly userID: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zero.d.ts","sourceRoot":"","sources":["../../../../../zero-client/src/client/zero.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAgB,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAC,KAAK,QAAQ,EAAW,MAAM,oBAAoB,CAAC;AAE3D,OAAO,EACL,cAAc,EAEf,MAAM,iCAAiC,CAAC;AAEzC,OAAO,KAAK,EAAC,MAAM,EAAe,MAAM,mCAAmC,CAAC;AAC5E,OAAO,KAAK,EAAC,MAAM,EAAe,MAAM,mCAAmC,CAAC;AAE5E,OAAO,KAAK,EACV,aAAa,EACb,QAAQ,EACT,MAAM,qCAAqC,CAAC;AAG7C,OAAO,KAAK,EACV,WAAW,EAEZ,MAAM,kCAAkC,CAAC;AAc1C,OAAO,EAAC,YAAY,EAAC,MAAM,qCAAqC,CAAC;AAGjE,OAAO,EAAC,KAAK,YAAY,EAAC,MAAM,6CAA6C,CAAC;AAG9E,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,8CAA8C,CAAC;AA6BpF,OAAO,K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Y,CAChC,GAAG,EAAE,cAAc,EACnB,YAAY,EAAE,YAAY,EAC1B,oBAAoB,EAAE,oBAAoB,EAC1C,YAAY,EAAE,QAAQ,EACtB,UAAU,EAAE,eAAe,EAC3B,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,EACrB,YAAY,EAAE,YAAY,EAC1B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,OAAO,EAClB,EAAE,EAAE,UAAU,EACd,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,YAAY,EAAE,MAAM,GAAG,SAAS,EAChC,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,EAC3D,oBAAoB,EAAE,IAAI,CAAC,oBAAoB,EAAE,eAAe,CAAC,EACjE,eAAe,SAAW,GACzB,OAAO,CACR;IACE,SAAS;IACT,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,GAAG,SAAS;IACzC,iBAAiB,GAAG,SAAS;CAC9B,CACF,CA+EA"}
|
|
@@ -27,9 +27,10 @@ import { nullableVersionSchema } from "../../../zero-protocol/src/version.js";
|
|
|
27
27
|
import { clientSchemaFrom } from "../../../zero-schema/src/builder/schema-builder.js";
|
|
28
28
|
import { clientToServer } from "../../../zero-schema/src/name-mapper.js";
|
|
29
29
|
import { iterateMutators, isMutatorRegistry } from "../../../zql/src/mutate/mutator-registry.js";
|
|
30
|
-
import {
|
|
30
|
+
import { createBuilderWithQueryFactory } from "../../../zql/src/query/create-builder.js";
|
|
31
31
|
import { isClientMetric } from "../../../zql/src/query/metrics-delegate.js";
|
|
32
32
|
import "../../../zero-protocol/src/ast.js";
|
|
33
|
+
import { newRunnableQuery } from "../../../zql/src/query/runnable-query-impl.js";
|
|
33
34
|
import { nanoid } from "../util/nanoid.js";
|
|
34
35
|
import { send } from "../util/socket.js";
|
|
35
36
|
import { ActiveClientsManager } from "./active-clients-manager.js";
|
|
@@ -247,7 +248,10 @@ class Zero {
|
|
|
247
248
|
this.#onlineManager.subscribe(onOnlineChange);
|
|
248
249
|
}
|
|
249
250
|
this.#options = options;
|
|
250
|
-
this.query =
|
|
251
|
+
this.query = createBuilderWithQueryFactory(
|
|
252
|
+
schema,
|
|
253
|
+
(table) => newRunnableQuery(this.#zeroContext, schema, table)
|
|
254
|
+
);
|
|
251
255
|
this.#logOptions = this.#createLogOptions({
|
|
252
256
|
consoleLogLevel: options.logLevel ?? "warn",
|
|
253
257
|
server: null,
|