doxum 0.1.23 → 0.1.26
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/README.md +208 -102
- package/dist/advanced.cjs +237 -2
- package/dist/advanced.cjs.map +1 -0
- package/dist/advanced.d.cts +90 -2
- package/dist/advanced.d.ts +90 -2
- package/dist/advanced.js +236 -1
- package/dist/advanced.js.map +1 -0
- package/dist/{contract-ULPQmiEs.d.ts → contract-CNR6BS75.d.cts} +216 -30
- package/dist/{contract-SYJFP0lM.d.cts → contract-COgxO5sv.d.ts} +216 -30
- package/dist/definition-CDOuvb5C.d.cts +111 -0
- package/dist/definition-xgk3YNBp.d.ts +111 -0
- package/dist/{driver-yFfvDMX5.js → driver-B5vdPohL.js} +59 -3
- package/dist/driver-B5vdPohL.js.map +1 -0
- package/dist/{driver-BD3DQOW6.cjs → driver-BL91gn7_.cjs} +107 -9
- package/dist/driver-BL91gn7_.cjs.map +1 -0
- package/dist/index.cjs +1637 -703
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +65 -33
- package/dist/index.d.ts +65 -33
- package/dist/index.js +1432 -497
- package/dist/index.js.map +1 -1
- package/dist/local-sync.cjs +69 -103
- package/dist/local-sync.cjs.map +1 -1
- package/dist/local-sync.d.cts +14 -26
- package/dist/local-sync.d.ts +14 -26
- package/dist/local-sync.js +68 -96
- package/dist/local-sync.js.map +1 -1
- package/dist/react.cjs +4 -5
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +6 -8
- package/dist/react.d.ts +6 -8
- package/dist/react.js +4 -5
- package/dist/react.js.map +1 -1
- package/dist/record-B2yRhYsc.js +28 -0
- package/dist/record-B2yRhYsc.js.map +1 -0
- package/dist/record-ChYUi8PP.cjs +45 -0
- package/dist/record-ChYUi8PP.cjs.map +1 -0
- package/dist/scheduler--137L3j-.js +500 -0
- package/dist/scheduler--137L3j-.js.map +1 -0
- package/dist/scheduler-D4VthaaK.cjs +589 -0
- package/dist/scheduler-D4VthaaK.cjs.map +1 -0
- package/package.json +6 -3
- package/skills/doxum-runtime/SKILL.md +32 -7
- package/skills/doxum-runtime/agents/openai.yaml +1 -1
- package/skills/doxum-runtime/references/api.en.md +249 -0
- package/skills/doxum-runtime/references/api.zh-CN.md +242 -0
- package/skills/doxum-runtime/references/guide.en.md +18 -8
- package/skills/doxum-runtime/references/guide.zh-CN.md +14 -6
- package/skills/doxum-runtime/references/invariants.en.md +29 -5
- package/skills/doxum-runtime/references/invariants.zh-CN.md +24 -6
- package/skills/doxum-runtime/references/patterns.en.md +78 -18
- package/skills/doxum-runtime/references/patterns.zh-CN.md +76 -18
- package/skills/doxum-runtime/references/projections.en.md +209 -119
- package/skills/doxum-runtime/references/projections.zh-CN.md +200 -101
- package/dist/advanced-CLJCWkHa.d.cts +0 -176
- package/dist/advanced-CRNHfJBu.js +0 -1224
- package/dist/advanced-CRNHfJBu.js.map +0 -1
- package/dist/advanced-Cle5g3B4.cjs +0 -1517
- package/dist/advanced-Cle5g3B4.cjs.map +0 -1
- package/dist/advanced-d6J61er9.d.ts +0 -176
- package/dist/context-BcLKGfq8.cjs +0 -149
- package/dist/context-BcLKGfq8.cjs.map +0 -1
- package/dist/context-DFEaDUv5.js +0 -84
- package/dist/context-DFEaDUv5.js.map +0 -1
- package/dist/driver-BD3DQOW6.cjs.map +0 -1
- package/dist/driver-yFfvDMX5.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"advanced.cjs","names":["collectionView","isPlainObject","isProjection","defineProcessor"],"sources":["../core/src/projection/advanced.ts"],"sourcesContent":["import { collectionView } from './collection/view';\nimport type { CollectionChange, CollectionDraft, CollectionRead, SourceContext } from './contract';\nimport type {\n KeyedProjection,\n OutputDefinition,\n OutputEvaluation,\n Projection,\n ProjectionChange,\n} from './definition';\nimport { defineProcessor, isProjection, projectionRef } from './definition';\nimport { assertSynchronous } from './graph/scheduler';\nimport { isPlainObject } from '../value/record';\n\ntype ProjectionDependencies = Readonly<Record<string, Projection<unknown>>>;\n\ntype ProjectionValues<D extends ProjectionDependencies> = {\n readonly [K in keyof D]: D[K] extends Projection<infer T> ? T : never;\n};\n\ntype ProjectionChanges<D extends ProjectionDependencies> = {\n readonly [K in keyof D]: ProjectionChange<D[K]> extends undefined\n ? undefined\n : ProjectionChange<D[K]> | undefined;\n};\n\ntype RetainedStateContext<State> = [State] extends [never] ? {} : { readonly state: State };\ntype RetainedStateDefinition<State> = [State] extends [never]\n ? { readonly state?: never }\n : { readonly state: () => State };\n\nexport type IncrementalValueContext<D extends ProjectionDependencies, T, State = never> = {\n readonly values: ProjectionValues<D>;\n readonly changes: ProjectionChanges<D>;\n readonly previous: T | undefined;\n readonly reset: boolean;\n readonly cause: unknown;\n} & RetainedStateContext<State>;\n\nexport type IncrementalValueDefinition<D extends ProjectionDependencies, T, State = never> = {\n readonly process: (context: IncrementalValueContext<D, T, State>) => T;\n} & RetainedStateDefinition<State>;\n\nexport type IncrementalCollectionContext<\n D extends ProjectionDependencies,\n K extends string,\n V,\n State = never,\n> = {\n readonly values: ProjectionValues<D>;\n readonly changes: ProjectionChanges<D>;\n readonly previous: CollectionRead<K, V>;\n readonly next: CollectionRead<K, V>;\n readonly reset: boolean;\n readonly cause: unknown;\n readonly output: CollectionDraft<K, V>;\n} & RetainedStateContext<State>;\n\nexport type IncrementalCollectionDefinition<\n D extends ProjectionDependencies,\n K extends string,\n V,\n State = never,\n> = {\n readonly process: (context: IncrementalCollectionContext<D, K, V, State>) => void;\n} & RetainedStateDefinition<State>;\n\ndeclare const groupOutput: unique symbol;\n\n/** Type-only declaration token used by incremental.group output builders. */\nexport type IncrementalGroupOutput<P extends Projection<unknown>> = {\n readonly [groupOutput]: P;\n};\n\ntype GroupOutputShape = {\n readonly [name: string]: IncrementalGroupOutput<Projection<unknown>> | GroupOutputShape;\n};\n\ntype GroupOutputBuilder = {\n collection<K extends string, V>(\n equality?: (previous: V, next: V) => boolean\n ): IncrementalGroupOutput<KeyedProjection<K, V>>;\n value<T>(equality?: (previous: T, next: T) => boolean): IncrementalGroupOutput<Projection<T>>;\n};\n\n/** Portable projection tree returned from an incremental.group declaration. */\nexport type IncrementalGroupResult<O> =\n O extends IncrementalGroupOutput<infer P>\n ? P\n : O extends Readonly<Record<string, unknown>>\n ? { readonly [K in keyof O]: IncrementalGroupResult<O[K]> }\n : never;\n\ntype GroupReads<O> =\n O extends IncrementalGroupOutput<infer P>\n ? P extends KeyedProjection<infer K, infer V>\n ? CollectionRead<K, V>\n : P extends Projection<infer T>\n ? T | undefined\n : never\n : { readonly [K in keyof O]: GroupReads<O[K]> };\n\ntype GroupDrafts<O> =\n O extends IncrementalGroupOutput<infer P>\n ? P extends KeyedProjection<infer K, infer V>\n ? CollectionDraft<K, V>\n : P extends Projection<infer T>\n ? { set(value: T): void }\n : never\n : { readonly [K in keyof O]: GroupDrafts<O[K]> };\n\nexport type IncrementalGroupContext<\n D extends ProjectionDependencies,\n O extends GroupOutputShape,\n State = never,\n> = {\n readonly values: ProjectionValues<D>;\n readonly changes: ProjectionChanges<D>;\n readonly previous: GroupReads<O>;\n readonly next: GroupReads<O>;\n readonly output: GroupDrafts<O>;\n readonly reset: boolean;\n readonly cause: unknown;\n} & RetainedStateContext<State>;\n\ntype IncrementalGroupDefinition<\n D extends ProjectionDependencies,\n O extends GroupOutputShape,\n State = never,\n> = {\n readonly output: (define: GroupOutputBuilder) => O;\n readonly process: (context: IncrementalGroupContext<D, O, State>) => void;\n} & RetainedStateDefinition<State>;\n\nconst resetCollectionChange = Object.freeze({ kind: 'reset' as const });\n\nconst publicValue = (source: SourceContext): unknown =>\n source.kind === 'value' ? source.value : collectionView(source.read);\n\nconst compileDependencies = <D extends ProjectionDependencies>(dependencies: D) => {\n if (!isPlainObject(dependencies) || isProjection(dependencies))\n throw new TypeError('Incremental dependencies must be a plain object.');\n const names: string[] = [];\n const projections: Projection<unknown>[] = [];\n for (const key of Reflect.ownKeys(dependencies)) {\n if (typeof key !== 'string')\n throw new TypeError('Incremental dependency names must be strings.');\n const descriptor = Object.getOwnPropertyDescriptor(dependencies, key);\n if (!descriptor?.enumerable || !('value' in descriptor))\n throw new TypeError('Incremental dependencies must be enumerable data properties.');\n projectionRef(descriptor.value as Projection<unknown>);\n names.push(key);\n projections.push(descriptor.value as Projection<unknown>);\n }\n return Object.freeze({ names: Object.freeze(names), projections: Object.freeze(projections) });\n};\n\nconst publicInputs = (\n sources: readonly SourceContext[],\n names: readonly string[],\n reset: boolean\n): {\n readonly values: Readonly<Record<string, unknown>>;\n readonly changes: Readonly<Record<string, unknown>>;\n} => {\n const values: Record<string, unknown> = Object.create(null) as Record<string, unknown>;\n const changes: Record<string, unknown> = Object.create(null) as Record<string, unknown>;\n for (let index = 0; index < names.length; index++) {\n const source = sources[index];\n values[names[index]] = publicValue(source);\n changes[names[index]] =\n source.kind === 'collection' ? (reset ? resetCollectionChange : source.change) : undefined;\n }\n return Object.freeze({ values: Object.freeze(values), changes: Object.freeze(changes) });\n};\n\nfunction validateDefinition(\n definition: unknown,\n allowed: readonly string[],\n label: string\n): asserts definition is Record<string, unknown> {\n if (!isPlainObject(definition))\n throw new TypeError(`${label} definition must be a plain object.`);\n const allowedKeys = new Set(allowed);\n for (const key of Reflect.ownKeys(definition)) {\n if (typeof key !== 'string' || !allowedKeys.has(key))\n throw new TypeError(`${label} definition contains an unknown property.`);\n const descriptor = Object.getOwnPropertyDescriptor(definition, key);\n if (!descriptor?.enumerable || !('value' in descriptor))\n throw new TypeError(`${label} definition must contain enumerable data properties.`);\n }\n}\n\nconst validateRetainedState = (definition: Record<string, unknown>, label: string): void => {\n if (\n Object.prototype.hasOwnProperty.call(definition, 'state') &&\n typeof definition.state !== 'function'\n )\n throw new TypeError(`${label} state must be a function when provided.`);\n};\n\nconst initializeRetainedState = (definition: {\n readonly state?: () => unknown;\n}): Readonly<Record<string, unknown>> => {\n if (definition.state === undefined) return Object.freeze({});\n const state = definition.state();\n assertSynchronous(state);\n return Object.freeze({ state });\n};\n\ntype RuntimeIncrementalDefinition<Result> = {\n readonly state?: () => unknown;\n readonly process: (context: never) => Result;\n};\n\nfunction createIncrementalValue<const D extends ProjectionDependencies, T>(\n dependencies: D,\n definition: IncrementalValueDefinition<D, T>\n): Projection<T>;\nfunction createIncrementalValue<const D extends ProjectionDependencies, T, State>(\n dependencies: D,\n definition: {\n readonly state: () => State;\n readonly process: (context: IncrementalValueContext<D, T, State>) => T;\n }\n): Projection<T>;\nfunction createIncrementalValue<const D extends ProjectionDependencies, T>(\n dependencies: D,\n definition: RuntimeIncrementalDefinition<T>\n): Projection<T> {\n const compiled = compileDependencies(dependencies);\n validateDefinition(definition, ['state', 'process'], 'Incremental value');\n validateRetainedState(definition, 'Incremental value');\n if (typeof definition.process !== 'function')\n throw new TypeError('Incremental value definition requires a process function.');\n const [projection] = defineProcessor({\n dependencies: compiled.projections,\n outputs: [{ kind: 'value', equality: Object.is }],\n create: () => {\n const state = initializeRetainedState(definition);\n return {\n evaluate: evaluation => {\n const output = evaluation.outputs[0];\n if (output.kind !== 'value') throw new Error('Incremental value output is invalid.');\n const publicInput = publicInputs(evaluation.sources, compiled.names, evaluation.reset);\n const result = definition.process({\n values: publicInput.values as ProjectionValues<D>,\n changes: publicInput.changes as ProjectionChanges<D>,\n previous: output.previous as T | undefined,\n reset: evaluation.reset,\n cause: evaluation.cause,\n ...state,\n } as never);\n assertSynchronous(result);\n output.output.set(result);\n },\n };\n },\n });\n return projection as Projection<T>;\n}\n\nfunction createIncrementalCollection<const D extends ProjectionDependencies, K extends string, V>(\n dependencies: D,\n definition: IncrementalCollectionDefinition<D, K, V>\n): KeyedProjection<K, V>;\nfunction createIncrementalCollection<\n const D extends ProjectionDependencies,\n K extends string,\n V,\n State,\n>(\n dependencies: D,\n definition: {\n readonly state: () => State;\n readonly process: (context: IncrementalCollectionContext<D, K, V, State>) => void;\n }\n): KeyedProjection<K, V>;\nfunction createIncrementalCollection<const D extends ProjectionDependencies, K extends string, V>(\n dependencies: D,\n definition: RuntimeIncrementalDefinition<void>\n): KeyedProjection<K, V> {\n const compiled = compileDependencies(dependencies);\n validateDefinition(definition, ['state', 'process'], 'Incremental collection');\n validateRetainedState(definition, 'Incremental collection');\n if (typeof definition.process !== 'function')\n throw new TypeError('Incremental collection definition requires a process function.');\n const [projection] = defineProcessor({\n dependencies: compiled.projections,\n outputs: [{ kind: 'collection', equality: Object.is }],\n create: () => {\n const state = initializeRetainedState(definition);\n return {\n evaluate: evaluation => {\n const output = evaluation.outputs[0];\n if (output.kind !== 'collection')\n throw new Error('Incremental collection output is invalid.');\n const publicInput = publicInputs(evaluation.sources, compiled.names, evaluation.reset);\n const result = definition.process({\n values: publicInput.values as ProjectionValues<D>,\n changes: publicInput.changes as ProjectionChanges<D>,\n previous: output.previous as CollectionRead<K, V>,\n next: output.next as CollectionRead<K, V>,\n reset: evaluation.reset,\n cause: evaluation.cause,\n output: output.output as CollectionDraft<K, V>,\n ...state,\n } as never);\n assertSynchronous(result);\n },\n };\n },\n });\n return projection as KeyedProjection<K, V>;\n}\n\ntype GroupShape = number | { readonly [key: string]: GroupShape };\ntype GroupOutputMetadata = {\n readonly kind: OutputDefinition['kind'];\n readonly equality: (a: unknown, b: unknown) => boolean;\n};\n\nconst isPlainGroupNamespace = (\n value: unknown,\n metadata: ReadonlyMap<object, GroupOutputMetadata>\n): value is Record<string, unknown> => isPlainObject(value) && !metadata.has(value);\n\nconst compileGroupShape = (\n value: unknown,\n path: readonly string[],\n metadata: ReadonlyMap<object, GroupOutputMetadata>,\n used: Set<object>,\n outputs: OutputDefinition[]\n): GroupShape => {\n if (value !== null && typeof value === 'object') {\n const output = metadata.get(value);\n if (output) {\n if (used.has(value)) throw new TypeError('An incremental group output cannot be reused.');\n used.add(value);\n const index = outputs.length;\n outputs.push({\n kind: output.kind,\n equality: output.equality,\n path: Object.freeze([...path]),\n });\n return index;\n }\n }\n if (!isPlainGroupNamespace(value, metadata))\n throw new TypeError('Incremental group outputs must be a static object tree.');\n for (const key of Reflect.ownKeys(value)) {\n if (typeof key !== 'string')\n throw new TypeError('Incremental group output names must be strings.');\n if (!Object.prototype.propertyIsEnumerable.call(value, key))\n throw new TypeError('Incremental group namespaces must contain enumerable properties.');\n }\n const keys = Object.keys(value);\n if (!keys.length) throw new TypeError('Incremental group namespaces cannot be empty.');\n const result: Record<string, GroupShape> = Object.create(null) as Record<string, GroupShape>;\n for (const key of keys) {\n if (key === '__proto__' || key === 'prototype' || key === 'constructor')\n throw new TypeError(`Invalid incremental group output name: ${key}`);\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n if (!descriptor || !('value' in descriptor))\n throw new TypeError('Incremental group namespaces cannot contain accessors.');\n result[key] = compileGroupShape(descriptor.value, [...path, key], metadata, used, outputs);\n }\n return Object.freeze(result);\n};\n\nconst hydrateGroupShape = <T>(shape: GroupShape, values: readonly T[]): unknown => {\n if (typeof shape === 'number') return values[shape];\n const result: Record<string, unknown> = {};\n for (const [key, child] of Object.entries(shape)) result[key] = hydrateGroupShape(child, values);\n return Object.freeze(result);\n};\n\nconst hydrateGroupReads = (\n shape: GroupShape,\n outputs: readonly OutputEvaluation[],\n next: boolean\n): unknown => {\n if (typeof shape === 'number') {\n const output = outputs[shape];\n return next && output.kind === 'value' ? output.next() : next ? output.next : output.previous;\n }\n const result: Record<string, unknown> = {};\n for (const [key, child] of Object.entries(shape)) {\n if (typeof child === 'number' && next && outputs[child].kind === 'value') {\n Object.defineProperty(result, key, {\n enumerable: true,\n configurable: false,\n get: () => (outputs[child] as Extract<OutputEvaluation, { kind: 'value' }>).next(),\n });\n } else result[key] = hydrateGroupReads(child, outputs, next);\n }\n return Object.freeze(result);\n};\n\nfunction createIncrementalGroup<\n const D extends ProjectionDependencies,\n const O extends GroupOutputShape,\n>(dependencies: D, definition: IncrementalGroupDefinition<D, O>): IncrementalGroupResult<O>;\nfunction createIncrementalGroup<\n const D extends ProjectionDependencies,\n const O extends GroupOutputShape,\n State,\n>(\n dependencies: D,\n definition: {\n readonly output: (define: GroupOutputBuilder) => O;\n readonly state: () => State;\n readonly process: (context: IncrementalGroupContext<D, O, State>) => void;\n }\n): IncrementalGroupResult<O>;\nfunction createIncrementalGroup<\n const D extends ProjectionDependencies,\n const O extends GroupOutputShape,\n>(\n dependencies: D,\n definition: RuntimeIncrementalDefinition<void> & {\n readonly output: (define: GroupOutputBuilder) => O;\n }\n): IncrementalGroupResult<O> {\n const compiled = compileDependencies(dependencies);\n validateDefinition(definition, ['output', 'state', 'process'], 'Incremental group');\n validateRetainedState(definition, 'Incremental group');\n if (typeof definition.output !== 'function' || typeof definition.process !== 'function')\n throw new TypeError('Incremental group definition requires output and process functions.');\n\n let active = true;\n const metadata = new Map<object, GroupOutputMetadata>();\n const defineOutput: GroupOutputBuilder = {\n collection: <K extends string, V>(equality: (previous: V, next: V) => boolean = Object.is) => {\n if (!active) throw new TypeError('Incremental group output declarations are synchronous.');\n const descriptor = Object.freeze({});\n metadata.set(descriptor, {\n kind: 'collection',\n equality: equality as (a: unknown, b: unknown) => boolean,\n });\n return descriptor as IncrementalGroupOutput<KeyedProjection<K, V>>;\n },\n value: <T>(equality: (previous: T, next: T) => boolean = Object.is) => {\n if (!active) throw new TypeError('Incremental group output declarations are synchronous.');\n const descriptor = Object.freeze({});\n metadata.set(descriptor, {\n kind: 'value',\n equality: equality as (a: unknown, b: unknown) => boolean,\n });\n return descriptor as IncrementalGroupOutput<Projection<T>>;\n },\n };\n const declared = definition.output(defineOutput);\n assertSynchronous(declared);\n active = false;\n const outputs: OutputDefinition[] = [];\n const used = new Set<object>();\n const shape = compileGroupShape(declared, [], metadata, used, outputs);\n if (typeof shape === 'number')\n throw new TypeError('Incremental group declarations must return an output namespace.');\n if (used.size === 0 || used.size !== metadata.size)\n throw new TypeError('Every incremental group output must be returned by the declaration.');\n\n const projections = defineProcessor({\n dependencies: compiled.projections,\n outputs,\n create: () => {\n const state = initializeRetainedState(definition);\n return {\n evaluate: evaluation => {\n const publicInput = publicInputs(evaluation.sources, compiled.names, evaluation.reset);\n const result = definition.process({\n values: publicInput.values as ProjectionValues<D>,\n changes: publicInput.changes as ProjectionChanges<D>,\n previous: hydrateGroupReads(shape, evaluation.outputs, false) as GroupReads<O>,\n next: hydrateGroupReads(shape, evaluation.outputs, true) as GroupReads<O>,\n output: hydrateGroupShape(\n shape,\n evaluation.outputs.map(output => output.output)\n ) as GroupDrafts<O>,\n reset: evaluation.reset,\n cause: evaluation.cause,\n ...state,\n } as never);\n assertSynchronous(result);\n },\n };\n },\n name: `processor-group:${outputs.map(output => output.path?.join('.') ?? '').join(',')}`,\n });\n return hydrateGroupShape(shape, projections) as IncrementalGroupResult<O>;\n}\n\nexport const incremental = Object.assign(createIncrementalValue, {\n collection: createIncrementalCollection,\n group: createIncrementalGroup,\n});\n\nexport type { CollectionChange } from './contract';\n"],"mappings":";;;;AAqIA,MAAM,wBAAwB,OAAO,OAAO,EAAE,MAAM,SAAkB,CAAC;AAEvE,MAAM,eAAe,WACnB,OAAO,SAAS,UAAU,OAAO,QAAQA,kBAAAA,eAAe,OAAO,KAAK;AAEtE,MAAM,uBAAyD,iBAAoB;AACjF,KAAI,CAACC,eAAAA,cAAc,aAAa,IAAIC,kBAAAA,aAAa,aAAa,CAC5D,OAAM,IAAI,UAAU,mDAAmD;CACzE,MAAM,QAAkB,EAAE;CAC1B,MAAM,cAAqC,EAAE;AAC7C,MAAK,MAAM,OAAO,QAAQ,QAAQ,aAAa,EAAE;AAC/C,MAAI,OAAO,QAAQ,SACjB,OAAM,IAAI,UAAU,gDAAgD;EACtE,MAAM,aAAa,OAAO,yBAAyB,cAAc,IAAI;AACrE,MAAI,CAAC,YAAY,cAAc,EAAE,WAAW,YAC1C,OAAM,IAAI,UAAU,+DAA+D;AACrF,oBAAA,cAAc,WAAW,MAA6B;AACtD,QAAM,KAAK,IAAI;AACf,cAAY,KAAK,WAAW,MAA6B;;AAE3D,QAAO,OAAO,OAAO;EAAE,OAAO,OAAO,OAAO,MAAM;EAAE,aAAa,OAAO,OAAO,YAA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,WAAU,OAAO,OAAO,CAChD;KACD,OAAO,WAAW;KAClB,OAAO,WAAW;KAClB,GAAG;KACJ,CACuB,CAAC;MAE5B;;EAEH,MAAM,mBAAmB,QAAQ,KAAI,WAAU,OAAO,MAAM,KAAK,IAAI,IAAI,GAAG,CAAC,KAAK,IAAI;EACvF,CAC0C,CAAC;;AAG9C,MAAa,cAAc,OAAO,OAAO,wBAAwB;CAC/D,YAAY;CACZ,OAAO;CACR,CAAC"}
|
package/dist/advanced.d.cts
CHANGED
|
@@ -1,2 +1,90 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
|
|
1
|
+
import { a as Projection, c as CollectionDraft, i as KeyedProjection, l as CollectionRead, o as ProjectionChange, s as CollectionChange } from "./definition-CDOuvb5C.cjs";
|
|
2
|
+
|
|
3
|
+
//#region core/src/projection/advanced.d.ts
|
|
4
|
+
type ProjectionDependencies = Readonly<Record<string, Projection<unknown>>>;
|
|
5
|
+
type ProjectionValues<D extends ProjectionDependencies> = { readonly [K in keyof D]: D[K] extends Projection<infer T> ? T : never };
|
|
6
|
+
type ProjectionChanges<D extends ProjectionDependencies> = { readonly [K in keyof D]: ProjectionChange<D[K]> extends undefined ? undefined : ProjectionChange<D[K]> | undefined };
|
|
7
|
+
type RetainedStateContext<State> = [State] extends [never] ? {} : {
|
|
8
|
+
readonly state: State;
|
|
9
|
+
};
|
|
10
|
+
type RetainedStateDefinition<State> = [State] extends [never] ? {
|
|
11
|
+
readonly state?: never;
|
|
12
|
+
} : {
|
|
13
|
+
readonly state: () => State;
|
|
14
|
+
};
|
|
15
|
+
type IncrementalValueContext<D extends ProjectionDependencies, T, State = never> = {
|
|
16
|
+
readonly values: ProjectionValues<D>;
|
|
17
|
+
readonly changes: ProjectionChanges<D>;
|
|
18
|
+
readonly previous: T | undefined;
|
|
19
|
+
readonly reset: boolean;
|
|
20
|
+
readonly cause: unknown;
|
|
21
|
+
} & RetainedStateContext<State>;
|
|
22
|
+
type IncrementalValueDefinition<D extends ProjectionDependencies, T, State = never> = {
|
|
23
|
+
readonly process: (context: IncrementalValueContext<D, T, State>) => T;
|
|
24
|
+
} & RetainedStateDefinition<State>;
|
|
25
|
+
type IncrementalCollectionContext<D extends ProjectionDependencies, K extends string, V, State = never> = {
|
|
26
|
+
readonly values: ProjectionValues<D>;
|
|
27
|
+
readonly changes: ProjectionChanges<D>;
|
|
28
|
+
readonly previous: CollectionRead<K, V>;
|
|
29
|
+
readonly next: CollectionRead<K, V>;
|
|
30
|
+
readonly reset: boolean;
|
|
31
|
+
readonly cause: unknown;
|
|
32
|
+
readonly output: CollectionDraft<K, V>;
|
|
33
|
+
} & RetainedStateContext<State>;
|
|
34
|
+
type IncrementalCollectionDefinition<D extends ProjectionDependencies, K extends string, V, State = never> = {
|
|
35
|
+
readonly process: (context: IncrementalCollectionContext<D, K, V, State>) => void;
|
|
36
|
+
} & RetainedStateDefinition<State>;
|
|
37
|
+
declare const groupOutput: unique symbol;
|
|
38
|
+
/** Type-only declaration token used by incremental.group output builders. */
|
|
39
|
+
type IncrementalGroupOutput<P extends Projection<unknown>> = {
|
|
40
|
+
readonly [groupOutput]: P;
|
|
41
|
+
};
|
|
42
|
+
type GroupOutputShape = {
|
|
43
|
+
readonly [name: string]: IncrementalGroupOutput<Projection<unknown>> | GroupOutputShape;
|
|
44
|
+
};
|
|
45
|
+
type GroupOutputBuilder = {
|
|
46
|
+
collection<K extends string, V>(equality?: (previous: V, next: V) => boolean): IncrementalGroupOutput<KeyedProjection<K, V>>;
|
|
47
|
+
value<T>(equality?: (previous: T, next: T) => boolean): IncrementalGroupOutput<Projection<T>>;
|
|
48
|
+
};
|
|
49
|
+
/** Portable projection tree returned from an incremental.group declaration. */
|
|
50
|
+
type IncrementalGroupResult<O> = O extends IncrementalGroupOutput<infer P> ? P : O extends Readonly<Record<string, unknown>> ? { readonly [K in keyof O]: IncrementalGroupResult<O[K]> } : never;
|
|
51
|
+
type GroupReads<O> = O extends IncrementalGroupOutput<infer P> ? P extends KeyedProjection<infer K, infer V> ? CollectionRead<K, V> : P extends Projection<infer T> ? T | undefined : never : { readonly [K in keyof O]: GroupReads<O[K]> };
|
|
52
|
+
type GroupDrafts<O> = O extends IncrementalGroupOutput<infer P> ? P extends KeyedProjection<infer K, infer V> ? CollectionDraft<K, V> : P extends Projection<infer T> ? {
|
|
53
|
+
set(value: T): void;
|
|
54
|
+
} : never : { readonly [K in keyof O]: GroupDrafts<O[K]> };
|
|
55
|
+
type IncrementalGroupContext<D extends ProjectionDependencies, O extends GroupOutputShape, State = never> = {
|
|
56
|
+
readonly values: ProjectionValues<D>;
|
|
57
|
+
readonly changes: ProjectionChanges<D>;
|
|
58
|
+
readonly previous: GroupReads<O>;
|
|
59
|
+
readonly next: GroupReads<O>;
|
|
60
|
+
readonly output: GroupDrafts<O>;
|
|
61
|
+
readonly reset: boolean;
|
|
62
|
+
readonly cause: unknown;
|
|
63
|
+
} & RetainedStateContext<State>;
|
|
64
|
+
type IncrementalGroupDefinition<D extends ProjectionDependencies, O extends GroupOutputShape, State = never> = {
|
|
65
|
+
readonly output: (define: GroupOutputBuilder) => O;
|
|
66
|
+
readonly process: (context: IncrementalGroupContext<D, O, State>) => void;
|
|
67
|
+
} & RetainedStateDefinition<State>;
|
|
68
|
+
declare function createIncrementalValue<const D extends ProjectionDependencies, T>(dependencies: D, definition: IncrementalValueDefinition<D, T>): Projection<T>;
|
|
69
|
+
declare function createIncrementalValue<const D extends ProjectionDependencies, T, State>(dependencies: D, definition: {
|
|
70
|
+
readonly state: () => State;
|
|
71
|
+
readonly process: (context: IncrementalValueContext<D, T, State>) => T;
|
|
72
|
+
}): Projection<T>;
|
|
73
|
+
declare function createIncrementalCollection<const D extends ProjectionDependencies, K extends string, V>(dependencies: D, definition: IncrementalCollectionDefinition<D, K, V>): KeyedProjection<K, V>;
|
|
74
|
+
declare function createIncrementalCollection<const D extends ProjectionDependencies, K extends string, V, State>(dependencies: D, definition: {
|
|
75
|
+
readonly state: () => State;
|
|
76
|
+
readonly process: (context: IncrementalCollectionContext<D, K, V, State>) => void;
|
|
77
|
+
}): KeyedProjection<K, V>;
|
|
78
|
+
declare function createIncrementalGroup<const D extends ProjectionDependencies, const O extends GroupOutputShape>(dependencies: D, definition: IncrementalGroupDefinition<D, O>): IncrementalGroupResult<O>;
|
|
79
|
+
declare function createIncrementalGroup<const D extends ProjectionDependencies, const O extends GroupOutputShape, State>(dependencies: D, definition: {
|
|
80
|
+
readonly output: (define: GroupOutputBuilder) => O;
|
|
81
|
+
readonly state: () => State;
|
|
82
|
+
readonly process: (context: IncrementalGroupContext<D, O, State>) => void;
|
|
83
|
+
}): IncrementalGroupResult<O>;
|
|
84
|
+
declare const incremental: typeof createIncrementalValue & {
|
|
85
|
+
collection: typeof createIncrementalCollection;
|
|
86
|
+
group: typeof createIncrementalGroup;
|
|
87
|
+
};
|
|
88
|
+
//#endregion
|
|
89
|
+
export { type CollectionChange, IncrementalCollectionContext, IncrementalCollectionDefinition, IncrementalGroupContext, IncrementalGroupOutput, IncrementalGroupResult, IncrementalValueContext, IncrementalValueDefinition, incremental };
|
|
90
|
+
//# sourceMappingURL=advanced.d.cts.map
|
package/dist/advanced.d.ts
CHANGED
|
@@ -1,2 +1,90 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
|
|
1
|
+
import { a as Projection, c as CollectionDraft, i as KeyedProjection, l as CollectionRead, o as ProjectionChange, s as CollectionChange } from "./definition-xgk3YNBp.js";
|
|
2
|
+
|
|
3
|
+
//#region core/src/projection/advanced.d.ts
|
|
4
|
+
type ProjectionDependencies = Readonly<Record<string, Projection<unknown>>>;
|
|
5
|
+
type ProjectionValues<D extends ProjectionDependencies> = { readonly [K in keyof D]: D[K] extends Projection<infer T> ? T : never };
|
|
6
|
+
type ProjectionChanges<D extends ProjectionDependencies> = { readonly [K in keyof D]: ProjectionChange<D[K]> extends undefined ? undefined : ProjectionChange<D[K]> | undefined };
|
|
7
|
+
type RetainedStateContext<State> = [State] extends [never] ? {} : {
|
|
8
|
+
readonly state: State;
|
|
9
|
+
};
|
|
10
|
+
type RetainedStateDefinition<State> = [State] extends [never] ? {
|
|
11
|
+
readonly state?: never;
|
|
12
|
+
} : {
|
|
13
|
+
readonly state: () => State;
|
|
14
|
+
};
|
|
15
|
+
type IncrementalValueContext<D extends ProjectionDependencies, T, State = never> = {
|
|
16
|
+
readonly values: ProjectionValues<D>;
|
|
17
|
+
readonly changes: ProjectionChanges<D>;
|
|
18
|
+
readonly previous: T | undefined;
|
|
19
|
+
readonly reset: boolean;
|
|
20
|
+
readonly cause: unknown;
|
|
21
|
+
} & RetainedStateContext<State>;
|
|
22
|
+
type IncrementalValueDefinition<D extends ProjectionDependencies, T, State = never> = {
|
|
23
|
+
readonly process: (context: IncrementalValueContext<D, T, State>) => T;
|
|
24
|
+
} & RetainedStateDefinition<State>;
|
|
25
|
+
type IncrementalCollectionContext<D extends ProjectionDependencies, K extends string, V, State = never> = {
|
|
26
|
+
readonly values: ProjectionValues<D>;
|
|
27
|
+
readonly changes: ProjectionChanges<D>;
|
|
28
|
+
readonly previous: CollectionRead<K, V>;
|
|
29
|
+
readonly next: CollectionRead<K, V>;
|
|
30
|
+
readonly reset: boolean;
|
|
31
|
+
readonly cause: unknown;
|
|
32
|
+
readonly output: CollectionDraft<K, V>;
|
|
33
|
+
} & RetainedStateContext<State>;
|
|
34
|
+
type IncrementalCollectionDefinition<D extends ProjectionDependencies, K extends string, V, State = never> = {
|
|
35
|
+
readonly process: (context: IncrementalCollectionContext<D, K, V, State>) => void;
|
|
36
|
+
} & RetainedStateDefinition<State>;
|
|
37
|
+
declare const groupOutput: unique symbol;
|
|
38
|
+
/** Type-only declaration token used by incremental.group output builders. */
|
|
39
|
+
type IncrementalGroupOutput<P extends Projection<unknown>> = {
|
|
40
|
+
readonly [groupOutput]: P;
|
|
41
|
+
};
|
|
42
|
+
type GroupOutputShape = {
|
|
43
|
+
readonly [name: string]: IncrementalGroupOutput<Projection<unknown>> | GroupOutputShape;
|
|
44
|
+
};
|
|
45
|
+
type GroupOutputBuilder = {
|
|
46
|
+
collection<K extends string, V>(equality?: (previous: V, next: V) => boolean): IncrementalGroupOutput<KeyedProjection<K, V>>;
|
|
47
|
+
value<T>(equality?: (previous: T, next: T) => boolean): IncrementalGroupOutput<Projection<T>>;
|
|
48
|
+
};
|
|
49
|
+
/** Portable projection tree returned from an incremental.group declaration. */
|
|
50
|
+
type IncrementalGroupResult<O> = O extends IncrementalGroupOutput<infer P> ? P : O extends Readonly<Record<string, unknown>> ? { readonly [K in keyof O]: IncrementalGroupResult<O[K]> } : never;
|
|
51
|
+
type GroupReads<O> = O extends IncrementalGroupOutput<infer P> ? P extends KeyedProjection<infer K, infer V> ? CollectionRead<K, V> : P extends Projection<infer T> ? T | undefined : never : { readonly [K in keyof O]: GroupReads<O[K]> };
|
|
52
|
+
type GroupDrafts<O> = O extends IncrementalGroupOutput<infer P> ? P extends KeyedProjection<infer K, infer V> ? CollectionDraft<K, V> : P extends Projection<infer T> ? {
|
|
53
|
+
set(value: T): void;
|
|
54
|
+
} : never : { readonly [K in keyof O]: GroupDrafts<O[K]> };
|
|
55
|
+
type IncrementalGroupContext<D extends ProjectionDependencies, O extends GroupOutputShape, State = never> = {
|
|
56
|
+
readonly values: ProjectionValues<D>;
|
|
57
|
+
readonly changes: ProjectionChanges<D>;
|
|
58
|
+
readonly previous: GroupReads<O>;
|
|
59
|
+
readonly next: GroupReads<O>;
|
|
60
|
+
readonly output: GroupDrafts<O>;
|
|
61
|
+
readonly reset: boolean;
|
|
62
|
+
readonly cause: unknown;
|
|
63
|
+
} & RetainedStateContext<State>;
|
|
64
|
+
type IncrementalGroupDefinition<D extends ProjectionDependencies, O extends GroupOutputShape, State = never> = {
|
|
65
|
+
readonly output: (define: GroupOutputBuilder) => O;
|
|
66
|
+
readonly process: (context: IncrementalGroupContext<D, O, State>) => void;
|
|
67
|
+
} & RetainedStateDefinition<State>;
|
|
68
|
+
declare function createIncrementalValue<const D extends ProjectionDependencies, T>(dependencies: D, definition: IncrementalValueDefinition<D, T>): Projection<T>;
|
|
69
|
+
declare function createIncrementalValue<const D extends ProjectionDependencies, T, State>(dependencies: D, definition: {
|
|
70
|
+
readonly state: () => State;
|
|
71
|
+
readonly process: (context: IncrementalValueContext<D, T, State>) => T;
|
|
72
|
+
}): Projection<T>;
|
|
73
|
+
declare function createIncrementalCollection<const D extends ProjectionDependencies, K extends string, V>(dependencies: D, definition: IncrementalCollectionDefinition<D, K, V>): KeyedProjection<K, V>;
|
|
74
|
+
declare function createIncrementalCollection<const D extends ProjectionDependencies, K extends string, V, State>(dependencies: D, definition: {
|
|
75
|
+
readonly state: () => State;
|
|
76
|
+
readonly process: (context: IncrementalCollectionContext<D, K, V, State>) => void;
|
|
77
|
+
}): KeyedProjection<K, V>;
|
|
78
|
+
declare function createIncrementalGroup<const D extends ProjectionDependencies, const O extends GroupOutputShape>(dependencies: D, definition: IncrementalGroupDefinition<D, O>): IncrementalGroupResult<O>;
|
|
79
|
+
declare function createIncrementalGroup<const D extends ProjectionDependencies, const O extends GroupOutputShape, State>(dependencies: D, definition: {
|
|
80
|
+
readonly output: (define: GroupOutputBuilder) => O;
|
|
81
|
+
readonly state: () => State;
|
|
82
|
+
readonly process: (context: IncrementalGroupContext<D, O, State>) => void;
|
|
83
|
+
}): IncrementalGroupResult<O>;
|
|
84
|
+
declare const incremental: typeof createIncrementalValue & {
|
|
85
|
+
collection: typeof createIncrementalCollection;
|
|
86
|
+
group: typeof createIncrementalGroup;
|
|
87
|
+
};
|
|
88
|
+
//#endregion
|
|
89
|
+
export { type CollectionChange, IncrementalCollectionContext, IncrementalCollectionDefinition, IncrementalGroupContext, IncrementalGroupOutput, IncrementalGroupResult, IncrementalValueContext, IncrementalValueDefinition, incremental };
|
|
90
|
+
//# sourceMappingURL=advanced.d.ts.map
|
package/dist/advanced.js
CHANGED
|
@@ -1,2 +1,237 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { d as isProjection, l as defineProcessor, m as projectionRef, n as assertSynchronous, o as collectionView } from "./scheduler--137L3j-.js";
|
|
2
|
+
import { n as isPlainObject } from "./record-B2yRhYsc.js";
|
|
3
|
+
//#region core/src/projection/advanced.ts
|
|
4
|
+
const resetCollectionChange = Object.freeze({ kind: "reset" });
|
|
5
|
+
const publicValue = (source) => source.kind === "value" ? source.value : collectionView(source.read);
|
|
6
|
+
const compileDependencies = (dependencies) => {
|
|
7
|
+
if (!isPlainObject(dependencies) || isProjection(dependencies)) throw new TypeError("Incremental dependencies must be a plain object.");
|
|
8
|
+
const names = [];
|
|
9
|
+
const projections = [];
|
|
10
|
+
for (const key of Reflect.ownKeys(dependencies)) {
|
|
11
|
+
if (typeof key !== "string") throw new TypeError("Incremental dependency names must be strings.");
|
|
12
|
+
const descriptor = Object.getOwnPropertyDescriptor(dependencies, key);
|
|
13
|
+
if (!descriptor?.enumerable || !("value" in descriptor)) throw new TypeError("Incremental dependencies must be enumerable data properties.");
|
|
14
|
+
projectionRef(descriptor.value);
|
|
15
|
+
names.push(key);
|
|
16
|
+
projections.push(descriptor.value);
|
|
17
|
+
}
|
|
18
|
+
return Object.freeze({
|
|
19
|
+
names: Object.freeze(names),
|
|
20
|
+
projections: Object.freeze(projections)
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
const publicInputs = (sources, names, reset) => {
|
|
24
|
+
const values = Object.create(null);
|
|
25
|
+
const changes = Object.create(null);
|
|
26
|
+
for (let index = 0; index < names.length; index++) {
|
|
27
|
+
const source = sources[index];
|
|
28
|
+
values[names[index]] = publicValue(source);
|
|
29
|
+
changes[names[index]] = source.kind === "collection" ? reset ? resetCollectionChange : source.change : void 0;
|
|
30
|
+
}
|
|
31
|
+
return Object.freeze({
|
|
32
|
+
values: Object.freeze(values),
|
|
33
|
+
changes: Object.freeze(changes)
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
function validateDefinition(definition, allowed, label) {
|
|
37
|
+
if (!isPlainObject(definition)) throw new TypeError(`${label} definition must be a plain object.`);
|
|
38
|
+
const allowedKeys = new Set(allowed);
|
|
39
|
+
for (const key of Reflect.ownKeys(definition)) {
|
|
40
|
+
if (typeof key !== "string" || !allowedKeys.has(key)) throw new TypeError(`${label} definition contains an unknown property.`);
|
|
41
|
+
const descriptor = Object.getOwnPropertyDescriptor(definition, key);
|
|
42
|
+
if (!descriptor?.enumerable || !("value" in descriptor)) throw new TypeError(`${label} definition must contain enumerable data properties.`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
const validateRetainedState = (definition, label) => {
|
|
46
|
+
if (Object.prototype.hasOwnProperty.call(definition, "state") && typeof definition.state !== "function") throw new TypeError(`${label} state must be a function when provided.`);
|
|
47
|
+
};
|
|
48
|
+
const initializeRetainedState = (definition) => {
|
|
49
|
+
if (definition.state === void 0) return Object.freeze({});
|
|
50
|
+
const state = definition.state();
|
|
51
|
+
assertSynchronous(state);
|
|
52
|
+
return Object.freeze({ state });
|
|
53
|
+
};
|
|
54
|
+
function createIncrementalValue(dependencies, definition) {
|
|
55
|
+
const compiled = compileDependencies(dependencies);
|
|
56
|
+
validateDefinition(definition, ["state", "process"], "Incremental value");
|
|
57
|
+
validateRetainedState(definition, "Incremental value");
|
|
58
|
+
if (typeof definition.process !== "function") throw new TypeError("Incremental value definition requires a process function.");
|
|
59
|
+
const [projection] = defineProcessor({
|
|
60
|
+
dependencies: compiled.projections,
|
|
61
|
+
outputs: [{
|
|
62
|
+
kind: "value",
|
|
63
|
+
equality: Object.is
|
|
64
|
+
}],
|
|
65
|
+
create: () => {
|
|
66
|
+
const state = initializeRetainedState(definition);
|
|
67
|
+
return { evaluate: (evaluation) => {
|
|
68
|
+
const output = evaluation.outputs[0];
|
|
69
|
+
if (output.kind !== "value") throw new Error("Incremental value output is invalid.");
|
|
70
|
+
const publicInput = publicInputs(evaluation.sources, compiled.names, evaluation.reset);
|
|
71
|
+
const result = definition.process({
|
|
72
|
+
values: publicInput.values,
|
|
73
|
+
changes: publicInput.changes,
|
|
74
|
+
previous: output.previous,
|
|
75
|
+
reset: evaluation.reset,
|
|
76
|
+
cause: evaluation.cause,
|
|
77
|
+
...state
|
|
78
|
+
});
|
|
79
|
+
assertSynchronous(result);
|
|
80
|
+
output.output.set(result);
|
|
81
|
+
} };
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
return projection;
|
|
85
|
+
}
|
|
86
|
+
function createIncrementalCollection(dependencies, definition) {
|
|
87
|
+
const compiled = compileDependencies(dependencies);
|
|
88
|
+
validateDefinition(definition, ["state", "process"], "Incremental collection");
|
|
89
|
+
validateRetainedState(definition, "Incremental collection");
|
|
90
|
+
if (typeof definition.process !== "function") throw new TypeError("Incremental collection definition requires a process function.");
|
|
91
|
+
const [projection] = defineProcessor({
|
|
92
|
+
dependencies: compiled.projections,
|
|
93
|
+
outputs: [{
|
|
94
|
+
kind: "collection",
|
|
95
|
+
equality: Object.is
|
|
96
|
+
}],
|
|
97
|
+
create: () => {
|
|
98
|
+
const state = initializeRetainedState(definition);
|
|
99
|
+
return { evaluate: (evaluation) => {
|
|
100
|
+
const output = evaluation.outputs[0];
|
|
101
|
+
if (output.kind !== "collection") throw new Error("Incremental collection output is invalid.");
|
|
102
|
+
const publicInput = publicInputs(evaluation.sources, compiled.names, evaluation.reset);
|
|
103
|
+
assertSynchronous(definition.process({
|
|
104
|
+
values: publicInput.values,
|
|
105
|
+
changes: publicInput.changes,
|
|
106
|
+
previous: output.previous,
|
|
107
|
+
next: output.next,
|
|
108
|
+
reset: evaluation.reset,
|
|
109
|
+
cause: evaluation.cause,
|
|
110
|
+
output: output.output,
|
|
111
|
+
...state
|
|
112
|
+
}));
|
|
113
|
+
} };
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
return projection;
|
|
117
|
+
}
|
|
118
|
+
const isPlainGroupNamespace = (value, metadata) => isPlainObject(value) && !metadata.has(value);
|
|
119
|
+
const compileGroupShape = (value, path, metadata, used, outputs) => {
|
|
120
|
+
if (value !== null && typeof value === "object") {
|
|
121
|
+
const output = metadata.get(value);
|
|
122
|
+
if (output) {
|
|
123
|
+
if (used.has(value)) throw new TypeError("An incremental group output cannot be reused.");
|
|
124
|
+
used.add(value);
|
|
125
|
+
const index = outputs.length;
|
|
126
|
+
outputs.push({
|
|
127
|
+
kind: output.kind,
|
|
128
|
+
equality: output.equality,
|
|
129
|
+
path: Object.freeze([...path])
|
|
130
|
+
});
|
|
131
|
+
return index;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
if (!isPlainGroupNamespace(value, metadata)) throw new TypeError("Incremental group outputs must be a static object tree.");
|
|
135
|
+
for (const key of Reflect.ownKeys(value)) {
|
|
136
|
+
if (typeof key !== "string") throw new TypeError("Incremental group output names must be strings.");
|
|
137
|
+
if (!Object.prototype.propertyIsEnumerable.call(value, key)) throw new TypeError("Incremental group namespaces must contain enumerable properties.");
|
|
138
|
+
}
|
|
139
|
+
const keys = Object.keys(value);
|
|
140
|
+
if (!keys.length) throw new TypeError("Incremental group namespaces cannot be empty.");
|
|
141
|
+
const result = Object.create(null);
|
|
142
|
+
for (const key of keys) {
|
|
143
|
+
if (key === "__proto__" || key === "prototype" || key === "constructor") throw new TypeError(`Invalid incremental group output name: ${key}`);
|
|
144
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
145
|
+
if (!descriptor || !("value" in descriptor)) throw new TypeError("Incremental group namespaces cannot contain accessors.");
|
|
146
|
+
result[key] = compileGroupShape(descriptor.value, [...path, key], metadata, used, outputs);
|
|
147
|
+
}
|
|
148
|
+
return Object.freeze(result);
|
|
149
|
+
};
|
|
150
|
+
const hydrateGroupShape = (shape, values) => {
|
|
151
|
+
if (typeof shape === "number") return values[shape];
|
|
152
|
+
const result = {};
|
|
153
|
+
for (const [key, child] of Object.entries(shape)) result[key] = hydrateGroupShape(child, values);
|
|
154
|
+
return Object.freeze(result);
|
|
155
|
+
};
|
|
156
|
+
const hydrateGroupReads = (shape, outputs, next) => {
|
|
157
|
+
if (typeof shape === "number") {
|
|
158
|
+
const output = outputs[shape];
|
|
159
|
+
return next && output.kind === "value" ? output.next() : next ? output.next : output.previous;
|
|
160
|
+
}
|
|
161
|
+
const result = {};
|
|
162
|
+
for (const [key, child] of Object.entries(shape)) if (typeof child === "number" && next && outputs[child].kind === "value") Object.defineProperty(result, key, {
|
|
163
|
+
enumerable: true,
|
|
164
|
+
configurable: false,
|
|
165
|
+
get: () => outputs[child].next()
|
|
166
|
+
});
|
|
167
|
+
else result[key] = hydrateGroupReads(child, outputs, next);
|
|
168
|
+
return Object.freeze(result);
|
|
169
|
+
};
|
|
170
|
+
function createIncrementalGroup(dependencies, definition) {
|
|
171
|
+
const compiled = compileDependencies(dependencies);
|
|
172
|
+
validateDefinition(definition, [
|
|
173
|
+
"output",
|
|
174
|
+
"state",
|
|
175
|
+
"process"
|
|
176
|
+
], "Incremental group");
|
|
177
|
+
validateRetainedState(definition, "Incremental group");
|
|
178
|
+
if (typeof definition.output !== "function" || typeof definition.process !== "function") throw new TypeError("Incremental group definition requires output and process functions.");
|
|
179
|
+
let active = true;
|
|
180
|
+
const metadata = /* @__PURE__ */ new Map();
|
|
181
|
+
const declared = definition.output({
|
|
182
|
+
collection: (equality = Object.is) => {
|
|
183
|
+
if (!active) throw new TypeError("Incremental group output declarations are synchronous.");
|
|
184
|
+
const descriptor = Object.freeze({});
|
|
185
|
+
metadata.set(descriptor, {
|
|
186
|
+
kind: "collection",
|
|
187
|
+
equality
|
|
188
|
+
});
|
|
189
|
+
return descriptor;
|
|
190
|
+
},
|
|
191
|
+
value: (equality = Object.is) => {
|
|
192
|
+
if (!active) throw new TypeError("Incremental group output declarations are synchronous.");
|
|
193
|
+
const descriptor = Object.freeze({});
|
|
194
|
+
metadata.set(descriptor, {
|
|
195
|
+
kind: "value",
|
|
196
|
+
equality
|
|
197
|
+
});
|
|
198
|
+
return descriptor;
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
assertSynchronous(declared);
|
|
202
|
+
active = false;
|
|
203
|
+
const outputs = [];
|
|
204
|
+
const used = /* @__PURE__ */ new Set();
|
|
205
|
+
const shape = compileGroupShape(declared, [], metadata, used, outputs);
|
|
206
|
+
if (typeof shape === "number") throw new TypeError("Incremental group declarations must return an output namespace.");
|
|
207
|
+
if (used.size === 0 || used.size !== metadata.size) throw new TypeError("Every incremental group output must be returned by the declaration.");
|
|
208
|
+
return hydrateGroupShape(shape, defineProcessor({
|
|
209
|
+
dependencies: compiled.projections,
|
|
210
|
+
outputs,
|
|
211
|
+
create: () => {
|
|
212
|
+
const state = initializeRetainedState(definition);
|
|
213
|
+
return { evaluate: (evaluation) => {
|
|
214
|
+
const publicInput = publicInputs(evaluation.sources, compiled.names, evaluation.reset);
|
|
215
|
+
assertSynchronous(definition.process({
|
|
216
|
+
values: publicInput.values,
|
|
217
|
+
changes: publicInput.changes,
|
|
218
|
+
previous: hydrateGroupReads(shape, evaluation.outputs, false),
|
|
219
|
+
next: hydrateGroupReads(shape, evaluation.outputs, true),
|
|
220
|
+
output: hydrateGroupShape(shape, evaluation.outputs.map((output) => output.output)),
|
|
221
|
+
reset: evaluation.reset,
|
|
222
|
+
cause: evaluation.cause,
|
|
223
|
+
...state
|
|
224
|
+
}));
|
|
225
|
+
} };
|
|
226
|
+
},
|
|
227
|
+
name: `processor-group:${outputs.map((output) => output.path?.join(".") ?? "").join(",")}`
|
|
228
|
+
}));
|
|
229
|
+
}
|
|
230
|
+
const incremental = Object.assign(createIncrementalValue, {
|
|
231
|
+
collection: createIncrementalCollection,
|
|
232
|
+
group: createIncrementalGroup
|
|
233
|
+
});
|
|
234
|
+
//#endregion
|
|
2
235
|
export { incremental };
|
|
236
|
+
|
|
237
|
+
//# sourceMappingURL=advanced.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"advanced.js","names":[],"sources":["../core/src/projection/advanced.ts"],"sourcesContent":["import { collectionView } from './collection/view';\nimport type { CollectionChange, CollectionDraft, CollectionRead, SourceContext } from './contract';\nimport type {\n KeyedProjection,\n OutputDefinition,\n OutputEvaluation,\n Projection,\n ProjectionChange,\n} from './definition';\nimport { defineProcessor, isProjection, projectionRef } from './definition';\nimport { assertSynchronous } from './graph/scheduler';\nimport { isPlainObject } from '../value/record';\n\ntype ProjectionDependencies = Readonly<Record<string, Projection<unknown>>>;\n\ntype ProjectionValues<D extends ProjectionDependencies> = {\n readonly [K in keyof D]: D[K] extends Projection<infer T> ? T : never;\n};\n\ntype ProjectionChanges<D extends ProjectionDependencies> = {\n readonly [K in keyof D]: ProjectionChange<D[K]> extends undefined\n ? undefined\n : ProjectionChange<D[K]> | undefined;\n};\n\ntype RetainedStateContext<State> = [State] extends [never] ? {} : { readonly state: State };\ntype RetainedStateDefinition<State> = [State] extends [never]\n ? { readonly state?: never }\n : { readonly state: () => State };\n\nexport type IncrementalValueContext<D extends ProjectionDependencies, T, State = never> = {\n readonly values: ProjectionValues<D>;\n readonly changes: ProjectionChanges<D>;\n readonly previous: T | undefined;\n readonly reset: boolean;\n readonly cause: unknown;\n} & RetainedStateContext<State>;\n\nexport type IncrementalValueDefinition<D extends ProjectionDependencies, T, State = never> = {\n readonly process: (context: IncrementalValueContext<D, T, State>) => T;\n} & RetainedStateDefinition<State>;\n\nexport type IncrementalCollectionContext<\n D extends ProjectionDependencies,\n K extends string,\n V,\n State = never,\n> = {\n readonly values: ProjectionValues<D>;\n readonly changes: ProjectionChanges<D>;\n readonly previous: CollectionRead<K, V>;\n readonly next: CollectionRead<K, V>;\n readonly reset: boolean;\n readonly cause: unknown;\n readonly output: CollectionDraft<K, V>;\n} & RetainedStateContext<State>;\n\nexport type IncrementalCollectionDefinition<\n D extends ProjectionDependencies,\n K extends string,\n V,\n State = never,\n> = {\n readonly process: (context: IncrementalCollectionContext<D, K, V, State>) => void;\n} & RetainedStateDefinition<State>;\n\ndeclare const groupOutput: unique symbol;\n\n/** Type-only declaration token used by incremental.group output builders. */\nexport type IncrementalGroupOutput<P extends Projection<unknown>> = {\n readonly [groupOutput]: P;\n};\n\ntype GroupOutputShape = {\n readonly [name: string]: IncrementalGroupOutput<Projection<unknown>> | GroupOutputShape;\n};\n\ntype GroupOutputBuilder = {\n collection<K extends string, V>(\n equality?: (previous: V, next: V) => boolean\n ): IncrementalGroupOutput<KeyedProjection<K, V>>;\n value<T>(equality?: (previous: T, next: T) => boolean): IncrementalGroupOutput<Projection<T>>;\n};\n\n/** Portable projection tree returned from an incremental.group declaration. */\nexport type IncrementalGroupResult<O> =\n O extends IncrementalGroupOutput<infer P>\n ? P\n : O extends Readonly<Record<string, unknown>>\n ? { readonly [K in keyof O]: IncrementalGroupResult<O[K]> }\n : never;\n\ntype GroupReads<O> =\n O extends IncrementalGroupOutput<infer P>\n ? P extends KeyedProjection<infer K, infer V>\n ? CollectionRead<K, V>\n : P extends Projection<infer T>\n ? T | undefined\n : never\n : { readonly [K in keyof O]: GroupReads<O[K]> };\n\ntype GroupDrafts<O> =\n O extends IncrementalGroupOutput<infer P>\n ? P extends KeyedProjection<infer K, infer V>\n ? CollectionDraft<K, V>\n : P extends Projection<infer T>\n ? { set(value: T): void }\n : never\n : { readonly [K in keyof O]: GroupDrafts<O[K]> };\n\nexport type IncrementalGroupContext<\n D extends ProjectionDependencies,\n O extends GroupOutputShape,\n State = never,\n> = {\n readonly values: ProjectionValues<D>;\n readonly changes: ProjectionChanges<D>;\n readonly previous: GroupReads<O>;\n readonly next: GroupReads<O>;\n readonly output: GroupDrafts<O>;\n readonly reset: boolean;\n readonly cause: unknown;\n} & RetainedStateContext<State>;\n\ntype IncrementalGroupDefinition<\n D extends ProjectionDependencies,\n O extends GroupOutputShape,\n State = never,\n> = {\n readonly output: (define: GroupOutputBuilder) => O;\n readonly process: (context: IncrementalGroupContext<D, O, State>) => void;\n} & RetainedStateDefinition<State>;\n\nconst resetCollectionChange = Object.freeze({ kind: 'reset' as const });\n\nconst publicValue = (source: SourceContext): unknown =>\n source.kind === 'value' ? source.value : collectionView(source.read);\n\nconst compileDependencies = <D extends ProjectionDependencies>(dependencies: D) => {\n if (!isPlainObject(dependencies) || isProjection(dependencies))\n throw new TypeError('Incremental dependencies must be a plain object.');\n const names: string[] = [];\n const projections: Projection<unknown>[] = [];\n for (const key of Reflect.ownKeys(dependencies)) {\n if (typeof key !== 'string')\n throw new TypeError('Incremental dependency names must be strings.');\n const descriptor = Object.getOwnPropertyDescriptor(dependencies, key);\n if (!descriptor?.enumerable || !('value' in descriptor))\n throw new TypeError('Incremental dependencies must be enumerable data properties.');\n projectionRef(descriptor.value as Projection<unknown>);\n names.push(key);\n projections.push(descriptor.value as Projection<unknown>);\n }\n return Object.freeze({ names: Object.freeze(names), projections: Object.freeze(projections) });\n};\n\nconst publicInputs = (\n sources: readonly SourceContext[],\n names: readonly string[],\n reset: boolean\n): {\n readonly values: Readonly<Record<string, unknown>>;\n readonly changes: Readonly<Record<string, unknown>>;\n} => {\n const values: Record<string, unknown> = Object.create(null) as Record<string, unknown>;\n const changes: Record<string, unknown> = Object.create(null) as Record<string, unknown>;\n for (let index = 0; index < names.length; index++) {\n const source = sources[index];\n values[names[index]] = publicValue(source);\n changes[names[index]] =\n source.kind === 'collection' ? (reset ? resetCollectionChange : source.change) : undefined;\n }\n return Object.freeze({ values: Object.freeze(values), changes: Object.freeze(changes) });\n};\n\nfunction validateDefinition(\n definition: unknown,\n allowed: readonly string[],\n label: string\n): asserts definition is Record<string, unknown> {\n if (!isPlainObject(definition))\n throw new TypeError(`${label} definition must be a plain object.`);\n const allowedKeys = new Set(allowed);\n for (const key of Reflect.ownKeys(definition)) {\n if (typeof key !== 'string' || !allowedKeys.has(key))\n throw new TypeError(`${label} definition contains an unknown property.`);\n const descriptor = Object.getOwnPropertyDescriptor(definition, key);\n if (!descriptor?.enumerable || !('value' in descriptor))\n throw new TypeError(`${label} definition must contain enumerable data properties.`);\n }\n}\n\nconst validateRetainedState = (definition: Record<string, unknown>, label: string): void => {\n if (\n Object.prototype.hasOwnProperty.call(definition, 'state') &&\n typeof definition.state !== 'function'\n )\n throw new TypeError(`${label} state must be a function when provided.`);\n};\n\nconst initializeRetainedState = (definition: {\n readonly state?: () => unknown;\n}): Readonly<Record<string, unknown>> => {\n if (definition.state === undefined) return Object.freeze({});\n const state = definition.state();\n assertSynchronous(state);\n return Object.freeze({ state });\n};\n\ntype RuntimeIncrementalDefinition<Result> = {\n readonly state?: () => unknown;\n readonly process: (context: never) => Result;\n};\n\nfunction createIncrementalValue<const D extends ProjectionDependencies, T>(\n dependencies: D,\n definition: IncrementalValueDefinition<D, T>\n): Projection<T>;\nfunction createIncrementalValue<const D extends ProjectionDependencies, T, State>(\n dependencies: D,\n definition: {\n readonly state: () => State;\n readonly process: (context: IncrementalValueContext<D, T, State>) => T;\n }\n): Projection<T>;\nfunction createIncrementalValue<const D extends ProjectionDependencies, T>(\n dependencies: D,\n definition: RuntimeIncrementalDefinition<T>\n): Projection<T> {\n const compiled = compileDependencies(dependencies);\n validateDefinition(definition, ['state', 'process'], 'Incremental value');\n validateRetainedState(definition, 'Incremental value');\n if (typeof definition.process !== 'function')\n throw new TypeError('Incremental value definition requires a process function.');\n const [projection] = defineProcessor({\n dependencies: compiled.projections,\n outputs: [{ kind: 'value', equality: Object.is }],\n create: () => {\n const state = initializeRetainedState(definition);\n return {\n evaluate: evaluation => {\n const output = evaluation.outputs[0];\n if (output.kind !== 'value') throw new Error('Incremental value output is invalid.');\n const publicInput = publicInputs(evaluation.sources, compiled.names, evaluation.reset);\n const result = definition.process({\n values: publicInput.values as ProjectionValues<D>,\n changes: publicInput.changes as ProjectionChanges<D>,\n previous: output.previous as T | undefined,\n reset: evaluation.reset,\n cause: evaluation.cause,\n ...state,\n } as never);\n assertSynchronous(result);\n output.output.set(result);\n },\n };\n },\n });\n return projection as Projection<T>;\n}\n\nfunction createIncrementalCollection<const D extends ProjectionDependencies, K extends string, V>(\n dependencies: D,\n definition: IncrementalCollectionDefinition<D, K, V>\n): KeyedProjection<K, V>;\nfunction createIncrementalCollection<\n const D extends ProjectionDependencies,\n K extends string,\n V,\n State,\n>(\n dependencies: D,\n definition: {\n readonly state: () => State;\n readonly process: (context: IncrementalCollectionContext<D, K, V, State>) => void;\n }\n): KeyedProjection<K, V>;\nfunction createIncrementalCollection<const D extends ProjectionDependencies, K extends string, V>(\n dependencies: D,\n definition: RuntimeIncrementalDefinition<void>\n): KeyedProjection<K, V> {\n const compiled = compileDependencies(dependencies);\n validateDefinition(definition, ['state', 'process'], 'Incremental collection');\n validateRetainedState(definition, 'Incremental collection');\n if (typeof definition.process !== 'function')\n throw new TypeError('Incremental collection definition requires a process function.');\n const [projection] = defineProcessor({\n dependencies: compiled.projections,\n outputs: [{ kind: 'collection', equality: Object.is }],\n create: () => {\n const state = initializeRetainedState(definition);\n return {\n evaluate: evaluation => {\n const output = evaluation.outputs[0];\n if (output.kind !== 'collection')\n throw new Error('Incremental collection output is invalid.');\n const publicInput = publicInputs(evaluation.sources, compiled.names, evaluation.reset);\n const result = definition.process({\n values: publicInput.values as ProjectionValues<D>,\n changes: publicInput.changes as ProjectionChanges<D>,\n previous: output.previous as CollectionRead<K, V>,\n next: output.next as CollectionRead<K, V>,\n reset: evaluation.reset,\n cause: evaluation.cause,\n output: output.output as CollectionDraft<K, V>,\n ...state,\n } as never);\n assertSynchronous(result);\n },\n };\n },\n });\n return projection as KeyedProjection<K, V>;\n}\n\ntype GroupShape = number | { readonly [key: string]: GroupShape };\ntype GroupOutputMetadata = {\n readonly kind: OutputDefinition['kind'];\n readonly equality: (a: unknown, b: unknown) => boolean;\n};\n\nconst isPlainGroupNamespace = (\n value: unknown,\n metadata: ReadonlyMap<object, GroupOutputMetadata>\n): value is Record<string, unknown> => isPlainObject(value) && !metadata.has(value);\n\nconst compileGroupShape = (\n value: unknown,\n path: readonly string[],\n metadata: ReadonlyMap<object, GroupOutputMetadata>,\n used: Set<object>,\n outputs: OutputDefinition[]\n): GroupShape => {\n if (value !== null && typeof value === 'object') {\n const output = metadata.get(value);\n if (output) {\n if (used.has(value)) throw new TypeError('An incremental group output cannot be reused.');\n used.add(value);\n const index = outputs.length;\n outputs.push({\n kind: output.kind,\n equality: output.equality,\n path: Object.freeze([...path]),\n });\n return index;\n }\n }\n if (!isPlainGroupNamespace(value, metadata))\n throw new TypeError('Incremental group outputs must be a static object tree.');\n for (const key of Reflect.ownKeys(value)) {\n if (typeof key !== 'string')\n throw new TypeError('Incremental group output names must be strings.');\n if (!Object.prototype.propertyIsEnumerable.call(value, key))\n throw new TypeError('Incremental group namespaces must contain enumerable properties.');\n }\n const keys = Object.keys(value);\n if (!keys.length) throw new TypeError('Incremental group namespaces cannot be empty.');\n const result: Record<string, GroupShape> = Object.create(null) as Record<string, GroupShape>;\n for (const key of keys) {\n if (key === '__proto__' || key === 'prototype' || key === 'constructor')\n throw new TypeError(`Invalid incremental group output name: ${key}`);\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n if (!descriptor || !('value' in descriptor))\n throw new TypeError('Incremental group namespaces cannot contain accessors.');\n result[key] = compileGroupShape(descriptor.value, [...path, key], metadata, used, outputs);\n }\n return Object.freeze(result);\n};\n\nconst hydrateGroupShape = <T>(shape: GroupShape, values: readonly T[]): unknown => {\n if (typeof shape === 'number') return values[shape];\n const result: Record<string, unknown> = {};\n for (const [key, child] of Object.entries(shape)) result[key] = hydrateGroupShape(child, values);\n return Object.freeze(result);\n};\n\nconst hydrateGroupReads = (\n shape: GroupShape,\n outputs: readonly OutputEvaluation[],\n next: boolean\n): unknown => {\n if (typeof shape === 'number') {\n const output = outputs[shape];\n return next && output.kind === 'value' ? output.next() : next ? output.next : output.previous;\n }\n const result: Record<string, unknown> = {};\n for (const [key, child] of Object.entries(shape)) {\n if (typeof child === 'number' && next && outputs[child].kind === 'value') {\n Object.defineProperty(result, key, {\n enumerable: true,\n configurable: false,\n get: () => (outputs[child] as Extract<OutputEvaluation, { kind: 'value' }>).next(),\n });\n } else result[key] = hydrateGroupReads(child, outputs, next);\n }\n return Object.freeze(result);\n};\n\nfunction createIncrementalGroup<\n const D extends ProjectionDependencies,\n const O extends GroupOutputShape,\n>(dependencies: D, definition: IncrementalGroupDefinition<D, O>): IncrementalGroupResult<O>;\nfunction createIncrementalGroup<\n const D extends ProjectionDependencies,\n const O extends GroupOutputShape,\n State,\n>(\n dependencies: D,\n definition: {\n readonly output: (define: GroupOutputBuilder) => O;\n readonly state: () => State;\n readonly process: (context: IncrementalGroupContext<D, O, State>) => void;\n }\n): IncrementalGroupResult<O>;\nfunction createIncrementalGroup<\n const D extends ProjectionDependencies,\n const O extends GroupOutputShape,\n>(\n dependencies: D,\n definition: RuntimeIncrementalDefinition<void> & {\n readonly output: (define: GroupOutputBuilder) => O;\n }\n): IncrementalGroupResult<O> {\n const compiled = compileDependencies(dependencies);\n validateDefinition(definition, ['output', 'state', 'process'], 'Incremental group');\n validateRetainedState(definition, 'Incremental group');\n if (typeof definition.output !== 'function' || typeof definition.process !== 'function')\n throw new TypeError('Incremental group definition requires output and process functions.');\n\n let active = true;\n const metadata = new Map<object, GroupOutputMetadata>();\n const defineOutput: GroupOutputBuilder = {\n collection: <K extends string, V>(equality: (previous: V, next: V) => boolean = Object.is) => {\n if (!active) throw new TypeError('Incremental group output declarations are synchronous.');\n const descriptor = Object.freeze({});\n metadata.set(descriptor, {\n kind: 'collection',\n equality: equality as (a: unknown, b: unknown) => boolean,\n });\n return descriptor as IncrementalGroupOutput<KeyedProjection<K, V>>;\n },\n value: <T>(equality: (previous: T, next: T) => boolean = Object.is) => {\n if (!active) throw new TypeError('Incremental group output declarations are synchronous.');\n const descriptor = Object.freeze({});\n metadata.set(descriptor, {\n kind: 'value',\n equality: equality as (a: unknown, b: unknown) => boolean,\n });\n return descriptor as IncrementalGroupOutput<Projection<T>>;\n },\n };\n const declared = definition.output(defineOutput);\n assertSynchronous(declared);\n active = false;\n const outputs: OutputDefinition[] = [];\n const used = new Set<object>();\n const shape = compileGroupShape(declared, [], metadata, used, outputs);\n if (typeof shape === 'number')\n throw new TypeError('Incremental group declarations must return an output namespace.');\n if (used.size === 0 || used.size !== metadata.size)\n throw new TypeError('Every incremental group output must be returned by the declaration.');\n\n const projections = defineProcessor({\n dependencies: compiled.projections,\n outputs,\n create: () => {\n const state = initializeRetainedState(definition);\n return {\n evaluate: evaluation => {\n const publicInput = publicInputs(evaluation.sources, compiled.names, evaluation.reset);\n const result = definition.process({\n values: publicInput.values as ProjectionValues<D>,\n changes: publicInput.changes as ProjectionChanges<D>,\n previous: hydrateGroupReads(shape, evaluation.outputs, false) as GroupReads<O>,\n next: hydrateGroupReads(shape, evaluation.outputs, true) as GroupReads<O>,\n output: hydrateGroupShape(\n shape,\n evaluation.outputs.map(output => output.output)\n ) as GroupDrafts<O>,\n reset: evaluation.reset,\n cause: evaluation.cause,\n ...state,\n } as never);\n assertSynchronous(result);\n },\n };\n },\n name: `processor-group:${outputs.map(output => output.path?.join('.') ?? '').join(',')}`,\n });\n return hydrateGroupShape(shape, projections) as IncrementalGroupResult<O>;\n}\n\nexport const incremental = Object.assign(createIncrementalValue, {\n collection: createIncrementalCollection,\n group: createIncrementalGroup,\n});\n\nexport type { CollectionChange } from './contract';\n"],"mappings":";;;AAqIA,MAAM,wBAAwB,OAAO,OAAO,EAAE,MAAM,SAAkB,CAAC;AAEvE,MAAM,eAAe,WACnB,OAAO,SAAS,UAAU,OAAO,QAAQ,eAAe,OAAO,KAAK;AAEtE,MAAM,uBAAyD,iBAAoB;AACjF,KAAI,CAAC,cAAc,aAAa,IAAI,aAAa,aAAa,CAC5D,OAAM,IAAI,UAAU,mDAAmD;CACzE,MAAM,QAAkB,EAAE;CAC1B,MAAM,cAAqC,EAAE;AAC7C,MAAK,MAAM,OAAO,QAAQ,QAAQ,aAAa,EAAE;AAC/C,MAAI,OAAO,QAAQ,SACjB,OAAM,IAAI,UAAU,gDAAgD;EACtE,MAAM,aAAa,OAAO,yBAAyB,cAAc,IAAI;AACrE,MAAI,CAAC,YAAY,cAAc,EAAE,WAAW,YAC1C,OAAM,IAAI,UAAU,+DAA+D;AACrF,gBAAc,WAAW,MAA6B;AACtD,QAAM,KAAK,IAAI;AACf,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