@app-compose/core 3.0.0-beta.10

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/runnable/definition.ts","../src/computable/definition.ts","../src/computable/build.ts","../src/shared.ts","../src/computable/computer.ts","../src/computable/literal.ts","../src/computable/lens.ts","../src/computable/optional.ts","../src/computable/reference.ts","../src/computable/shape.ts","../src/runnable/task.ts","../src/is.ts","../src/runnable/wire.ts","../src/compose/resolver.ts","../src/compose/analyze.ts","../src/compose/graph.ts","../src/compose/guard.ts","../src/compose/observer.ts","../src/compose/scope.ts","../src/compose/runner.ts","../src/compose/compose.ts"],"sourcesContent":["import type { SpotInternal } from \"@computable\"\nimport type { Eventual } from \"@shared\"\n\nconst Context$ = Symbol(\"$context\")\nconst Execute$ = Symbol(\"$execute\")\nconst Dispatch$ = Symbol(\"$dispatch\")\n\ntype Runnable<T extends string = string> = { readonly [Execute$]: unknown; readonly kind: T }\n\ntype RunnableInternal<T = unknown> = {\n [Context$]: SpotInternal<unknown>\n [Execute$]: (ctx: unknown) => Eventual<T>\n [Dispatch$]: Record<symbol, (value: T) => unknown>\n}\n\nexport { Context$, Dispatch$, Execute$ }\nexport type { Runnable, RunnableInternal }\n","const Spot$ = Symbol(\"$spot\")\nconst Phantom$ = Symbol(\"$T\")\n\nconst Read$ = Symbol(\"$read\")\nconst Build$ = Symbol(\"$build\")\nconst Literal$ = Symbol(\"$literal\")\n\nconst Compute$ = Symbol(\"$compute\")\n\nconst Missing$ = Symbol(\"$missing\")\nconst Optional$ = Symbol(\"$optional\")\n\ntype Spot<T> = { [Spot$]: true; [Phantom$]?: T }\ntype SpotValue<T extends Spot<any>> = T extends Spot<infer V> ? V : never\n\ntype ComputeStep = (source: unknown) => unknown\n\ntype Compute = { [Compute$]: ComputeStep[] }\ntype Optional = { [Optional$]: boolean }\n\n// Spot Flavors\ntype Literal = { [Literal$]: unknown }\ntype Build = { [Build$]: unknown }\ntype Read = { [Read$]: symbol }\n\ntype SpotInternal<T = unknown> = (Literal | Read | Build) & Compute & Optional & Spot<T>\n\nexport { Build$, Compute$, Literal$, Missing$, Optional$, Read$, Spot$ }\nexport type { ComputeStep, Spot, SpotInternal, SpotValue }\n","import { Build$, Compute$, Optional$, Spot$, type SpotInternal } from \"./definition\"\n\n/**\n * Creates a build context from a shape\n *\n * @internal\n */\nconst build = <T = unknown>(context: unknown): SpotInternal<T> => {\n return { [Spot$]: true, [Build$]: context, [Compute$]: [], [Optional$]: false }\n}\n\nexport { build }\n","type AnyShape = Record<string, unknown>\ntype Eventual<T> = Promise<T> | T\n\ntype BuiltInObject =\n | null\n | undefined\n | boolean\n | string\n | number\n | Error\n | Date\n | RegExp\n | Int8Array\n | Uint8Array\n | Uint8ClampedArray\n | Int16Array\n | Uint16Array\n | Int32Array\n | Uint32Array\n | Float32Array\n | Float64Array\n | ReadonlyMap<unknown, unknown>\n | ReadonlySet<unknown>\n | WeakMap<object, unknown>\n | WeakSet<object>\n | ArrayBuffer\n | DataView\n | Function\n | Promise<unknown>\n | Generator\n | { readonly [Symbol.toStringTag]: string }\n\nconst LIBRARY_NAME = \"[app-compose]\"\n\nconst isObject = (x: unknown): x is object => Object.prototype.toString.call(x) === \"[object Object]\"\n\nconst identity = <T>(x: T): T => x\nconst T = (): true => true\n\nexport { LIBRARY_NAME, T, identity, isObject }\nexport type { AnyShape, BuiltInObject, Eventual }\n","import { isObject, LIBRARY_NAME } from \"@shared\"\nimport { Build$, Compute$, Literal$, Missing$, Optional$, Read$, Spot$, type SpotInternal } from \"./definition\"\n\ntype Computer = {\n compute: <T = unknown>(spot: SpotInternal<T>) => T | typeof Missing$\n computeSafe: <T = unknown>(spot: SpotInternal<T>) => T | undefined\n}\n\nconst createComputer = (registry: Map<symbol, unknown>): Computer => {\n const context = (value: unknown): unknown | typeof Missing$ => {\n if (isObject(value))\n if (Spot$ in value) return compute(value as SpotInternal)\n else {\n let out: Record<string, unknown> = {}\n\n for (const key of Object.keys(value))\n if ((out[key] = context(value[key as keyof typeof value])) === Missing$) return Missing$\n\n return out\n }\n else if (Array.isArray(value)) {\n const out: unknown[] = Array.from({ length: value.length })\n\n for (let i = 0; i < value.length; i++) if ((out[i] = context(value[i])) === Missing$) return Missing$\n\n return out\n } else throw new Error(`${LIBRARY_NAME} Literal value found in context: ${String(value)}.`)\n }\n\n /**\n * `compute` - resolve a `Spot` to its final value.\n *\n * Resolves the spot's underlying value (`Build$`, `Literal$`, or `Read$`),\n * then applies all `Compute$` transformations in order.\n *\n * `Missing$` flow is three-step `read -> compute -> optional`\n *\n * 1. Read `source` value (either literal, built, or from registry) as-is\n * 2. Map the `source` value through the `Compute$` pipeline, preserving `Missing$` and delegating to internal-land\n * 3. Guard `Missing$` according to `Optional$`, coercing to `undefined` if optional, or propagating as-is if not\n *\n * @param spot The `Spot` to evaluate\n * @returns The resolved value, or `Missing$` when non-optional spot resolution fails\n */\n const compute = <T = unknown>(spot: SpotInternal<T>): T | typeof Missing$ => {\n let resolved: unknown\n\n if (Build$ in spot) resolved = context(spot[Build$])\n else if (Literal$ in spot) resolved = spot[Literal$]\n else if (Read$ in spot) resolved = registry.has(spot[Read$]) ? registry.get(spot[Read$]) : Missing$\n else throw /* unknown unit */ new Error(`${LIBRARY_NAME} Invalid Unit.`)\n\n for (const step of spot[Compute$]) resolved = step(resolved)\n\n if (resolved === Missing$ && spot[Optional$]) return undefined as T\n else return resolved as T\n }\n\n const computeSafe = <T = unknown>(spot: SpotInternal<T>): T | undefined => {\n const result = compute(spot)\n return result === Missing$ ? undefined : result\n }\n\n return { compute, computeSafe }\n}\n\nexport { createComputer, type Computer }\n","import { type Spot, type SpotInternal, Compute$, Literal$, Optional$, Spot$ } from \"./definition\"\n\nconst literal = <const T>(value: T): Spot<T> => {\n const spot: SpotInternal<T> = { [Spot$]: true, [Literal$]: value, [Compute$]: [], [Optional$]: false }\n\n return spot\n}\n\nexport { literal }\n","import { LIBRARY_NAME } from \"@shared\"\nimport { Compute$, Missing$, type SpotInternal } from \"./definition\"\n\nconst Self$ = Symbol(/* internal */)\n\nconst raise = () => {\n throw new Error(`${LIBRARY_NAME} Modifying a Reference is not allowed.`)\n}\n\nconst reader = (property: string) => (value: any) => (value === Missing$ ? Missing$ : value?.[property])\n\nconst get: ProxyHandler<SpotInternal>[\"get\"] = (target, property, recv) =>\n typeof property === \"string\"\n ? proxy({ ...target, [Compute$]: target[Compute$].concat(reader(property)) })\n : property === Self$\n ? target\n : Reflect.get(target, property, recv)\n\nconst set: ProxyHandler<SpotInternal>[\"set\"] = () => raise()\n\nexport const proxy = <T extends SpotInternal>(ref: T): T => new Proxy<T>(ref, { get, set })\n\nproxy.self = <T extends SpotInternal>(lensable: T): T => (lensable as any)[Self$] ?? lensable\n","import { Optional$, type Spot, type SpotInternal } from \"./definition\"\nimport { proxy } from \"./lens\"\n\n/**\n * Mark a `Spot` as optional.\n */\nconst optional = <T>(spot: Spot<T>): Spot<T | undefined> => {\n const self = proxy.self(spot as SpotInternal<T>)\n const updated: SpotInternal<T | undefined> = { ...self, [Optional$]: true }\n\n return updated\n}\n\nexport { optional }\n","import type { AnyShape } from \"@shared\"\nimport { Compute$, Optional$, Read$, Spot$, type Spot, type SpotInternal } from \"./definition\"\nimport { proxy } from \"./lens\"\n\ntype SpotProvider<T> = [T] extends [AnyShape] ? { readonly [Key in keyof T]: SpotProvider<T[Key]> } & Spot<T> : Spot<T>\n\nconst reference = <T>(id: symbol): Spot<T> => {\n const spot: SpotInternal<T> = { [Spot$]: true, [Read$]: id, [Compute$]: [], [Optional$]: false }\n\n return spot\n}\n\nreference.lensed = <T>(id: symbol): SpotProvider<T> => {\n const spot: SpotInternal<T> = { [Spot$]: true, [Read$]: id, [Compute$]: [], [Optional$]: false }\n\n return proxy(spot) as SpotProvider<T>\n}\n\nexport { reference, type SpotProvider }\n","import type { ContextToSpot } from \"./context\"\nimport { build } from \"./build\"\nimport { Compute$, Missing$, type ComputeStep, type Spot } from \"./definition\"\n\nconst safe =\n <Fn extends (value: any) => any>(fn: Fn): ComputeStep =>\n (value) => {\n try {\n return value === Missing$ ? Missing$ : /* USERLAND */ fn(value)\n } catch {\n return Missing$\n }\n }\n\nfunction shape<S, T>(spot: Spot<S>, fn: (from: S) => T): Spot<T>\n\nfunction shape<T>(ctx: ContextToSpot<T>): Spot<T>\nfunction shape<S, T>(ctx: ContextToSpot<S>, fn: (from: NoInfer<S>) => T): Spot<T>\n\nfunction shape<S, T>(ctxOrSpot: ContextToSpot<S> | Spot<S>, fn?: (from: NoInfer<S>) => T): Spot<T> {\n const spot = build<S>(ctxOrSpot)\n\n if (fn) spot[Compute$].push(safe(fn))\n\n return spot as Spot<T>\n}\n\nexport { shape }\n","import type { IsSpot, SpotToContext } from \"@computable\"\nimport { build, literal, Missing$, reference, type Spot, type SpotProvider } from \"@computable\"\nimport { T, type Eventual } from \"@shared\"\nimport { Context$, Dispatch$, Execute$, type Runnable, type RunnableInternal } from \"./definition\"\n\ntype WithContext<Context, Return> = Context extends void\n ? { fn: () => Eventual<Return>; context?: never }\n : IsSpot<Context> extends true\n ? { fn: (ctx: NoInfer<SpotToContext<Context>>) => Eventual<Return>; context: Context }\n : { fn: (ctx: unknown) => Eventual<Return>; context: never }\n\ntype TaskConfig<Result, RunContext, EnabledContext> = {\n name: string\n run: WithContext<RunContext, Result>\n enabled?: WithContext<EnabledContext, boolean>\n}\n\ntype Task<R> = {\n readonly name: string\n\n readonly result: SpotProvider<R>\n readonly status: Spot<TaskStatus>\n readonly error: Spot<unknown>\n} & Runnable<\"task\">\n\ntype TaskResult<T> = T extends Task<infer R> ? R : never\ntype TaskStatus = \"done\" | \"fail\" | \"skip\"\ntype TaskExecutionValue<R> = { status: \"done\"; value: R } | { status: \"fail\"; error: unknown } | { status: \"skip\" }\n\nconst dispatch = {\n result: <R>(result: TaskExecutionValue<R>) => (result.status === \"done\" ? result.value : Missing$),\n status: <R>(result: TaskExecutionValue<R>) => result.status,\n error: <R>(result: TaskExecutionValue<R>) => (result.status === \"fail\" ? result.error : Missing$),\n}\n\nconst createTask = <Result, RunContext = void, EnabledContext = void>(\n config: TaskConfig<Result, RunContext, EnabledContext>,\n): Task<Result> => {\n const id = {\n result: Symbol(`Task[${config.name}]::result`),\n status: Symbol(`Task[${config.name}]::status`),\n error: Symbol(`Task[${config.name}]::error`),\n }\n\n const context = {\n run: config.run.context ?? literal(undefined),\n enabled: config.enabled?.context ?? literal(undefined),\n }\n\n type ExecutionResult = TaskExecutionValue<Result>\n type ExecutionContext = { run: SpotToContext<RunContext>; enabled: SpotToContext<EnabledContext> } | typeof Missing$\n\n const runnable: RunnableInternal<ExecutionResult> & Task<Result> = {\n name: config.name,\n kind: \"task\",\n\n result: reference.lensed<Result>(id.result),\n status: reference<TaskStatus>(id.status),\n error: reference<unknown>(id.error),\n\n [Context$]: build(context),\n [Execute$]: async (built: unknown) => {\n const ctx = built as ExecutionContext\n if (ctx === Missing$) return { status: \"skip\" }\n\n try {\n const enabled = await /* USERLAND */ (config.enabled?.fn ?? T)(ctx.enabled)\n if (!enabled) return { status: \"skip\" }\n } catch (error) {\n return { status: \"fail\", error }\n }\n\n try {\n const value = await /* USERLAND */ config.run.fn(ctx.run)\n return { status: \"done\", value }\n } catch (error) {\n return { status: \"fail\", error }\n }\n },\n [Dispatch$]: { [id.result]: dispatch.result, [id.status]: dispatch.status, [id.error]: dispatch.error },\n }\n\n return runnable\n}\n\nexport { createTask, type Task, type TaskResult, type TaskStatus }\n","import { Spot$, type Spot } from \"@computable\"\nimport { Execute$, type Runnable, type Tag, Tag$, type Task, type Wire } from \"@runnable\"\nimport { isObject } from \"@shared\"\n\nconst is = {\n spot: (x: unknown): x is Spot<unknown> => isObject(x) && Spot$ in x,\n\n tag: (x: unknown): x is Tag<unknown> => isObject(x) && Tag$ in x,\n\n runnable: (x: unknown): x is Runnable => isObject(x) && Execute$ in x,\n\n task: (x: unknown): x is Task<unknown> => is.runnable(x) && x.kind === \"task\",\n wire: (x: unknown): x is Wire => is.runnable(x) && x.kind === \"wire\",\n}\n\nexport { is }\n","import type { ContextToSpot } from \"@computable\"\nimport { build, reference, type SpotProvider } from \"@computable\"\nimport { is } from \"@is\"\nimport { identity, isObject, LIBRARY_NAME } from \"@shared\"\nimport { Context$, Dispatch$, Execute$, type Runnable, type RunnableInternal } from \"./definition\"\n\nconst Tag$ = Symbol(\"$tag\")\n\ntype Tag<T> = { [Tag$]: symbol; readonly name: string; readonly value: SpotProvider<T> }\n\nconst tag = <T = never>(name: string): Tag<T> => {\n const id = Symbol(`Tag[${name}]`)\n\n return { [Tag$]: id, name, value: reference.lensed<T>(id) }\n}\n\ntype Wire = { readonly name: string } & Runnable<\"wire\">\n\ntype TagShape<T> =\n T extends Tag<unknown>\n ? T\n : T extends readonly unknown[]\n ? { [K in keyof T & number]: TagShape<T[K]> }\n : T extends Record<string, unknown>\n ? { [K in keyof T & string]: TagShape<T[K]> }\n : Tag<unknown>\n\ntype TagShapeToValue<S> = [S] extends [Tag<infer V>]\n ? V\n : S extends Record<string, unknown> | readonly unknown[]\n ? { [K in keyof S]: TagShapeToValue<S[K]> }\n : never\n\ntype WireConfig<S> = { from: NoInfer<ContextToSpot<TagShapeToValue<S>>>; to: S & TagShape<S> }\n\ntype WireEntry = { tag: Tag<unknown>; fn: (v: unknown) => unknown }\n\nconst pluck =\n (path: PropertyKey[]) =>\n (value: any): unknown =>\n path.reduce((acc, key) => acc?.[key], value)\n\nfunction* walk(shape: unknown, path: PropertyKey[] = []): Generator<WireEntry> {\n if (is.tag(shape)) yield { tag: shape, fn: pluck(path) }\n else if (Array.isArray(shape))\n for (let index = 0; index < shape.length; index++) yield* walk(shape[index], [...path, index])\n else if (isObject(shape))\n for (const key of Object.keys(shape)) yield* walk(shape[key as keyof typeof shape], [...path, key])\n else throw new Error(`${LIBRARY_NAME} Invalid shape ${String(shape)} provided to Wire at path \"${path.join(\".\")}\".`)\n}\n\nconst createWire = <const S>(config: WireConfig<S>): Wire => {\n const tags: Set<Tag<unknown>> = new Set()\n const dispatch: RunnableInternal[typeof Dispatch$] = {}\n\n for (const entry of walk(config.to))\n if (tags.has(entry.tag))\n throw new Error(`${LIBRARY_NAME} Duplicate tag \"${entry.tag.name}\" found in Wire destination.`)\n else void (tags.add(entry.tag), (dispatch[entry.tag[Tag$]] = entry.fn))\n\n const name = Array.from(tags)\n .map((tag) => tag.name)\n .join(\" + \")\n\n return {\n name,\n kind: \"wire\",\n\n [Context$]: build(config.from),\n [Execute$]: identity,\n [Dispatch$]: dispatch,\n } as RunnableInternal & Wire\n}\n\nexport { createWire, tag, Tag$, type Tag, type Wire }\n","import { Build$, Literal$, Optional$, Read$, Spot$, type SpotInternal } from \"@computable\"\nimport { isObject, LIBRARY_NAME } from \"@shared\"\n\ntype Dependency = { required: Set<symbol>; optional: Set<symbol> }\ntype DependencyEntry = { id: symbol; optional: boolean }\n\nfunction* scanShape(shape: unknown): Generator<DependencyEntry, void, void> {\n if (isObject(shape))\n if (Spot$ in shape) yield* scanSpot(shape as SpotInternal)\n else for (const key of Object.keys(shape)) yield* scanShape(shape[key as keyof typeof shape])\n else if (Array.isArray(shape)) for (const item of shape) yield* scanShape(item)\n else throw new Error(`${LIBRARY_NAME} Literal value found in context: ${String(shape)}.`)\n}\n\nfunction* scanSpot(spot: SpotInternal): Generator<DependencyEntry, void, void> {\n if (Literal$ in spot) return\n else if (Read$ in spot) return yield { id: spot[Read$], optional: spot[Optional$] }\n else if (Build$ in spot)\n for (const entry of scanShape(spot[Build$])) yield { id: entry.id, optional: entry.optional || spot[Optional$] }\n else throw /* unknown unit */ new Error(`${LIBRARY_NAME} Invalid Unit.`)\n}\n\nfunction resolve(spot: SpotInternal): Dependency {\n const required = new Set<symbol>()\n const optional = new Set<symbol>()\n\n for (const entry of scanSpot(spot))\n if (entry.optional) optional.add(entry.id)\n else required.add(entry.id)\n\n return { required, optional }\n}\n\nexport { resolve, type Dependency }\n","import { Context$, Dispatch$, type Runnable, type RunnableInternal } from \"@runnable\"\nimport type { ComposableKind, KnownRunnable } from \"./definition\"\nimport { resolve, type Dependency } from \"./resolver\"\n\ntype RunnableMeta = { type: ComposableKind; display: { name: string }; writes: symbol[]; dependencies: Dependency }\n\ntype RunnableRepr = Runnable | RunnableInternal\ntype ComposeAnalyzer = { get: (runnable: RunnableRepr) => RunnableMeta }\n\nconst analyze = (runnable: RunnableRepr): RunnableMeta => {\n const internal = runnable as RunnableInternal & KnownRunnable\n\n const writes = Object.getOwnPropertySymbols(internal[Dispatch$])\n const dependencies = resolve(internal[Context$])\n\n return { type: internal.kind, display: { name: internal.name }, writes, dependencies }\n}\n\nconst createAnalyzer = (): ComposeAnalyzer => {\n const cache = new WeakMap<RunnableRepr, RunnableMeta>()\n\n const get = (runnable: RunnableRepr): RunnableMeta => {\n const analysis = cache.get(runnable) ?? analyze(runnable)\n return (cache.set(runnable, analysis), analysis)\n }\n\n return { get }\n}\n\nexport { createAnalyzer }\n","import type { ComposableKind, ComposeNode } from \"./definition\"\nimport { createAnalyzer } from \"./analyze\"\n\ntype EntryID = number\n\ntype Scope = Map<symbol, EntryID>\nconst Scope = Map<symbol, EntryID>\n\ntype GraphExecutionMeta = { name?: string }\ntype GraphRunMeta = { name: string; kind: ComposableKind }\ntype GraphRunDeps = { required: EntryID[]; optional: EntryID[] }\n\ntype GraphNode =\n | { type: \"con\"; meta: GraphExecutionMeta; children: GraphNode[] }\n | { type: \"seq\"; meta: GraphExecutionMeta; children: GraphNode[] }\n | { type: \"run\"; meta: GraphRunMeta; id: EntryID; dependencies: GraphRunDeps }\n\ntype GraphState = { node: GraphNode; wrote: Scope }\n\nconst graph = (root: ComposeNode): GraphNode => {\n let entryID = 0\n\n const analyzer = createAnalyzer()\n\n const toRun = (current: Extract<ComposeNode, { type: \"run\" }>, outer: Scope): GraphState => {\n const { type, display, writes, dependencies } = analyzer.get(current.value)\n\n const wrote = writes.reduce((acc, sym) => acc.set(sym, entryID), new Scope())\n\n const node: GraphNode = {\n type: \"run\",\n meta: { name: display.name, kind: type },\n id: entryID++,\n dependencies: {\n required: Array.from(dependencies.required, (id) => outer.get(id) ?? -1),\n optional: Array.from(dependencies.optional, (id) => outer.get(id)).filter((id) => id !== undefined),\n },\n }\n\n return { node, wrote }\n }\n\n const toCon = (current: Extract<ComposeNode, { type: \"con\" }>, outer: Scope): GraphState => {\n const wrote = new Scope()\n\n const visit = visitorOn(outer, [wrote]) // run isolated, on outer only\n const children = current.children.map(visit)\n\n return { node: { type: \"con\", meta: { name: current.meta?.name }, children }, wrote }\n }\n\n const toSeq = (current: Extract<ComposeNode, { type: \"seq\" }>, outer: Scope): GraphState => {\n const wrote = new Scope(),\n local = new Scope(outer)\n\n const visit = visitorOn(local, [local, wrote]) // run on shared local scope\n const children = current.children.map(visit)\n\n return { node: { type: \"seq\", meta: { name: current.meta?.name }, children }, wrote }\n }\n\n /** using `local`, traverse `node` and update `into` scopes */\n const visitorOn = (local: Scope, into: readonly Scope[]) => (node: ComposeNode) => {\n const step = traverse(node, local)\n for (const target of into) step.wrote.forEach((id, sym) => target.set(sym, id))\n return step.node\n }\n\n const traverse = (current: ComposeNode, outer: Scope): GraphState => {\n switch (current.type) {\n case \"run\":\n return toRun(current, outer)\n case \"con\":\n return toCon(current, outer)\n case \"seq\":\n return toSeq(current, outer)\n }\n }\n\n return traverse(root, new Scope()).node\n}\n\nexport { graph, type GraphNode }\n","import type { ComposableKind, ComposeMeta, ComposeNode } from \"./definition\"\nimport { createAnalyzer } from \"./analyze\"\n\ntype NotifyEntry = { index?: number; node: ComposeNode }\n\ntype NotifyContext = { type: ComposableKind; name: string; stack: NotifyEntry[] }\ntype GuardHandler = Record<\"warn\" | \"error\", (message: string) => void>\n\nconst UNKNOWN_NAME = \"<unknown>\"\n\nconst TypeMap = { task: \"Task\", wire: \"Wire\" } satisfies Record<ComposableKind, string>\n\nconst metaOf = <const K extends keyof ComposeMeta>(node: ComposeNode, key: K): ComposeMeta[K] =>\n \"meta\" in node && node.meta?.[key] ? node.meta[key] : undefined\n\nconst stackToName = (stack: NotifyEntry[]): string =>\n stack\n .map(({ node, index }) => {\n const name = metaOf(node, \"name\")\n if (index !== undefined) return name ? `#${index + 1} (${name})` : `#${index + 1}`\n else return name ?? \"root\"\n })\n .join(\" > \")\n\nconst createNotify = (handler: GuardHandler) => ({\n duplicate: ({ type, name, stack }: NotifyContext) => {\n const message = `A duplicate ${TypeMap[type]} found with name ${TypeMap[type]}[${name}] in step ${stackToName(stack)}.`\n\n handler.error(message)\n },\n\n notSatisfied: ({ type, name, stack, missing: set }: NotifyContext & { missing: Set<symbol> }) => {\n const list = Array.from(set, (id) => id.description ?? UNKNOWN_NAME).join(\", \")\n const message = `Unsatisfied dependencies found for ${TypeMap[type]} with name ${TypeMap[type]}[${name}] in step ${stackToName(stack)}: missing ${list}.`\n\n handler.error(message)\n },\n\n unused: ({ type, name, stack, id }: NotifyContext & { id: symbol }) => {\n const target = `${TypeMap[type]}[${name}] for ${id.description ?? UNKNOWN_NAME}`\n const message = `Unused ${TypeMap[type]} found with name ${target} in step ${stackToName(stack)}.`\n\n handler.warn(message)\n },\n})\n\ntype GuardConfig = { handler: GuardHandler }\n\nconst createGuard = ({ handler }: GuardConfig) => {\n const notify = createNotify(handler)\n const analyzer = createAnalyzer()\n\n const duplicate = (root: ComposeNode) => {\n const seen = new Set<symbol>()\n\n const traverse = (stack: NotifyEntry[]) => {\n const { node: current } = stack.at(-1)!\n\n if (current.type === \"con\" || current.type === \"seq\")\n return current.children.forEach((node, index) => traverse([...stack, { node, index }]))\n\n if (current.type === \"run\") {\n const { type, display, writes } = analyzer.get(current.value)\n\n if (writes.some((write) => seen.has(write))) notify.duplicate({ type, name: display.name, stack })\n\n writes.forEach((w) => seen.add(w))\n }\n }\n\n traverse([{ node: root }])\n }\n\n const unused = (root: ComposeNode) => {\n const candidates: Map<symbol, NotifyContext & { id: symbol }> = new Map()\n\n const traverse = (stack: NotifyEntry[]) => {\n const { node: current } = stack.at(-1)!\n\n if (current.type === \"con\" || current.type === \"seq\")\n return current.children.forEach((node, index) => traverse([...stack, { node, index }]))\n\n if (current.type === \"run\") {\n const { type, display, writes, dependencies } = analyzer.get(current.value)\n\n if (type === \"wire\") writes.forEach((id) => candidates.set(id, { id, type, name: display.name, stack }))\n\n dependencies.required.forEach((id) => candidates.delete(id))\n dependencies.optional.forEach((id) => candidates.delete(id))\n }\n }\n\n traverse([{ node: root }])\n\n for (const context of candidates.values()) notify.unused(context)\n }\n\n const unsatisfied = (root: ComposeNode) => {\n const traverse = (stack: NotifyEntry[], available: Set<symbol>): Set<symbol> => {\n const { node: current } = stack.at(-1)!\n\n switch (current.type) {\n case \"run\":\n const { type, display, writes, dependencies } = analyzer.get(current.value)\n\n const missing = new Set<symbol>()\n for (const id of dependencies.required) if (!available.has(id)) missing.add(id)\n\n if (missing.size > 0) notify.notSatisfied({ type, name: display.name, stack, missing })\n\n return new Set(writes)\n\n // all concurrent steps are isolated\n case \"con\": {\n const wrote = new Set<symbol>()\n\n for (const [index, node] of current.children.entries())\n traverse([...stack, { node, index }], available).forEach((item) => wrote.add(item))\n\n return wrote\n }\n\n // sequential steps share the context of previous steps\n case \"seq\": {\n const wrote = new Set<symbol>(),\n local = new Set<symbol>(available)\n\n for (const [index, node] of current.children.entries())\n traverse([...stack, { node, index }], local).forEach((item) => (wrote.add(item), local.add(item)))\n\n return wrote\n }\n }\n }\n\n traverse([{ node: root }], new Set())\n }\n\n return (root: ComposeNode) => (duplicate(root), unsatisfied(root), unused(root))\n}\n\nexport { createGuard, type GuardHandler }\n","import { LIBRARY_NAME } from \"@shared\"\nimport type { ComposeMeta, ComposeNode, KnownRunnable, Scope } from \"./definition\"\n\ntype ComposePhase = \"enter\" | \"exit\"\n\ntype ReadonlyMeta = Readonly<ComposeMeta>\n\ntype ComposeEvent =\n | { node: \"seq\"; scope: Scope; phase: \"enter\"; meta?: ReadonlyMeta }\n | { node: \"seq\"; scope: Scope; phase: \"exit\"; meta?: ReadonlyMeta }\n | { node: \"con\"; scope: Scope; phase: \"enter\"; meta?: ReadonlyMeta }\n | { node: \"con\"; scope: Scope; phase: \"exit\"; meta?: ReadonlyMeta }\n | { node: \"run\"; scope: Scope; phase: \"enter\"; runnable: KnownRunnable }\n | { node: \"run\"; scope: Scope; phase: \"exit\"; runnable: KnownRunnable }\n\ntype Dispatch = (stack: ComposeNode[], phase: ComposePhase) => void\ntype ComposeObserver = (event: ComposeEvent, path: readonly ReadonlyMeta[]) => void\n\nconst toEvent = (node: ComposeNode, scope: Scope, phase: ComposePhase): ComposeEvent => {\n switch (node.type) {\n case \"seq\":\n return { node: \"seq\", scope, phase, meta: node.meta }\n case \"con\":\n return { node: \"con\", scope, phase, meta: node.meta }\n case \"run\":\n return { node: \"run\", scope, phase, runnable: node.value as KnownRunnable }\n }\n}\n\nconst notify = (observe: ComposeObserver, event: ComposeEvent, path: readonly ReadonlyMeta[]): void =>\n void Promise.resolve()\n .then(() => /* USERLAND */ observe(event, path))\n .catch((error) => console.error(LIBRARY_NAME, error))\n\nconst createObserver =\n (scope: Scope): Dispatch =>\n (stack, phase): void => {\n const event = toEvent(stack.at(-1)!, scope, phase)\n const path: ReadonlyMeta[] = []\n\n for (const node of [...stack].reverse()) {\n const meta = \"meta\" in node ? node.meta : undefined\n\n if (meta) path.push(meta)\n if (meta?.observe) notify(meta.observe, event, /* copy, since we mutate */ [...path])\n }\n }\n\nexport { createObserver, type ComposeEvent, type ComposeObserver, type Dispatch }\n","import type { Computer, Spot, SpotInternal } from \"@computable\"\nimport type { Scope } from \"./definition\"\n\nconst createScope = (computer: Computer): Scope => {\n return {\n get: <T>(spot: Spot<T>): T | undefined => computer.computeSafe(spot as SpotInternal<T>),\n }\n}\n\nexport { createScope }\n","import { createComputer, type Computer } from \"@computable\"\nimport { Context$, Dispatch$, Execute$, type RunnableInternal } from \"@runnable\"\nimport type { ComposeNode, Registry, Scope } from \"./definition\"\nimport { createObserver, type Dispatch } from \"./observer\"\nimport { createScope } from \"./scope\"\n\ntype Context = { computer: Computer; registry: Registry; dispatch: Dispatch }\n\nconst execute = (ctx: Context, runnable: RunnableInternal): Promise<unknown> =>\n Promise.resolve()\n .then(() => ctx.computer.compute(runnable[Context$]))\n .then((value) => runnable[Execute$](value))\n .then((value) => {\n for (const key of Object.getOwnPropertySymbols(runnable[Dispatch$]))\n ctx.registry.set(key, runnable[Dispatch$][key]!(value))\n return value\n })\n\nconst traverse = async (ctx: Context, stack: ComposeNode[]) => {\n const current = stack.at(-1)!\n\n ctx.dispatch(stack, \"enter\")\n\n switch (current.type) {\n case \"seq\":\n for (const child of current.children) await traverse(ctx, [...stack, child])\n break\n\n case \"con\":\n await Promise.all(current.children.map((child) => traverse(ctx, [...stack, child])))\n break\n\n case \"run\":\n await execute(ctx, current.value as unknown as RunnableInternal) // safety: Execute$\n break\n }\n\n ctx.dispatch(stack, \"exit\")\n}\n\nconst run = async (node: ComposeNode): Promise<Scope> => {\n const registry: Registry = new Map()\n\n const computer = createComputer(registry)\n const scope = createScope(computer)\n const dispatch = createObserver(scope)\n\n const ctx: Context = { computer, registry, dispatch }\n\n await traverse(ctx, [node])\n\n return scope\n}\n\nexport { run }\n","import { Execute$, type Runnable } from \"@runnable\"\nimport { LIBRARY_NAME } from \"@shared\"\nimport type { ComposeInner, ComposeMeta, ComposeNode, Scope } from \"./definition\"\nimport { graph, type GraphNode } from \"./graph\"\nimport { createGuard, type GuardHandler } from \"./guard\"\nimport { run } from \"./runner\"\n\nconst Node$ = Symbol(\"$node\")\n\ntype Composable = Composer | Runnable\n\ntype Composer = {\n /**\n * Execution Graph Node\n * @private\n * @internal\n */\n [Node$]: ComposeInner\n\n run: () => Promise<Scope>\n guard: () => void\n graph: () => GraphNode\n\n meta: (meta: Partial<ComposeMeta>) => Composer\n step: (compose: Composable | Composable[]) => Composer\n}\n\nconst normalize = (arg: Composable): ComposeNode => {\n if (Node$ in arg) return arg[Node$]\n else if (Execute$ in arg) return { type: \"run\", value: arg }\n else throw new Error(`${LIBRARY_NAME} Invalid argument passed to step.`)\n}\n\nconst raiseOnGuard = (message: string): never => {\n throw new Error(message)\n}\n\nconst builder = (node: ComposeInner): Composer => {\n return {\n [Node$]: node,\n\n meta: (meta) => builder({ ...node, meta: { ...node.meta, ...meta } }),\n\n step: (arg) => {\n if (Array.isArray(arg))\n return builder({ ...node, children: [...node.children, { type: \"con\", children: arg.map(normalize) }] })\n else return builder({ ...node, children: [...node.children, normalize(arg)] })\n },\n\n run: () => {\n const handler: GuardHandler = { warn: (message) => console.warn(LIBRARY_NAME, message), error: raiseOnGuard }\n const guard = createGuard({ handler })\n\n return (guard(node), run(node))\n },\n\n guard: () => {\n const handler: GuardHandler = { warn: raiseOnGuard, error: raiseOnGuard }\n const guard = createGuard({ handler })\n\n return guard(node)\n },\n\n graph: () => graph(node),\n }\n}\n\nconst compose = (): Composer => {\n const root: ComposeNode = { type: \"seq\", children: [] }\n\n return builder(root)\n}\n\nexport { compose, Node$, type Composer }\n"],"mappings":";AAGA,MAAM,WAAW,OAAO,UAAU;AAClC,MAAM,WAAW,OAAO,UAAU;AAClC,MAAM,YAAY,OAAO,WAAW;;ACLpC,MAAM,QAAQ,OAAO,OAAO;AAG5B,MAAM,QAAQ,OAAO,OAAO;AAC5B,MAAM,SAAS,OAAO,QAAQ;AAC9B,MAAM,WAAW,OAAO,UAAU;AAElC,MAAM,WAAW,OAAO,UAAU;AAElC,MAAM,WAAW,OAAO,UAAU;AAClC,MAAM,YAAY,OAAO,WAAW;;;;;;;ACHpC,MAAM,SAAsB,YAAsC;CAChE,OAAO;GAAG,QAAQ;GAAO,SAAS;GAAU,WAAW,CAAC;GAAI,YAAY;CAAM;AAChF;;ACuBA,MAAM,eAAe;AAErB,MAAM,YAAY,MAA4B,OAAO,UAAU,SAAS,KAAK,CAAC,MAAM;AAEpF,MAAM,YAAe,MAAY;AACjC,MAAM,UAAgB;;AC7BtB,MAAM,kBAAkB,aAA6C;CACnE,MAAM,WAAW,UAA8C;EAC7D,IAAI,SAAS,KAA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D,IAAI,SAAS,KAAK,OAAO,IAAI;MACxB,IAAI,YAAY,KAAK,OAAO;EAAE,MAAM;EAAO,OAAO;CAAI;MACtD,MAAM,IAAI,MAAM,GAAG,aAAa,kCAAkC;AACzE;AAEA,MAAM,gBAAgB,YAA2B;CAC/C,MAAM,IAAI,MAAM,OAAO;AACzB;AAEA,MAAM,WAAW,SAAiC;CAChD,OAAO;GACJ,QAAQ;EAET,OAAO,SAAS,QAAQ;GAAE,GAAG;GAAM,MAAM;IAAE,GAAG,KAAK;IAAM,GAAG;GAAK;EAAE,CAAC;EAEpE,OAAO,QAAQ;GACb,IAAI,MAAM,QAAQ,GAAG,GACnB,OAAO,QAAQ;IAAE,GAAG;IAAM,UAAU,CAAC,GAAG,KAAK,UAAU;KAAE,MAAM;KAAO,UAAU,IAAI,IAAI,SAAS;IAAE,CAAC;GAAE,CAAC;QACpG,OAAO,QAAQ;IAAE,GAAG;IAAM,UAAU,CAAC,GAAG,KAAK,UAAU,UAAU,GAAG,CAAC;GAAE,CAAC;EAC/E;EAEA,WAAW;GAIT,OAFc,YAAY,EAAE,SAAA;IADI,OAAO,YAAY,QAAQ,KAAK,cAAc,OAAO;IAAG,OAAO;GAC7D,EAAE,CAExB,CAAC,CAAC,IAAI,GAAG,IAAI,IAAI;EAC/B;EAEA,aAAa;GAIX,OAFc,YAAY,EAAE,SAAA;IADI,MAAM;IAAc,OAAO;GACzB,EAAE,CAEzB,CAAC,CAAC,IAAI;EACnB;EAEA,aAAa,MAAM,IAAI;CACzB;AACF;AAEA,MAAM,gBAA0B;CAG9B,OAAO,QAAQ;EAFa,MAAM;EAAO,UAAU,CAAC;CAElC,CAAC;AACrB"}
package/package.json ADDED
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "@app-compose/core",
3
+ "version": "3.0.0-beta.10",
4
+ "private": false,
5
+ "description": "Build front-end applications from isolated tasks with explicit dependencies and predictable execution order—without containers, decorators, or framework-specific APIs.",
6
+ "keywords": [
7
+ "app-compose",
8
+ "appcompose",
9
+ "composition",
10
+ "dependency-injection",
11
+ "di",
12
+ "feature-composition",
13
+ "frontend",
14
+ "grlt-hub",
15
+ "inversion-of-control",
16
+ "ioc",
17
+ "modular",
18
+ "task-orchestration",
19
+ "typescript"
20
+ ],
21
+ "homepage": "https://app-compose.dev",
22
+ "license": "MIT",
23
+ "contributors": [
24
+ {
25
+ "name": "Mikhail Kireev",
26
+ "url": "https://github.com/kireevmp"
27
+ },
28
+ {
29
+ "name": "Viktor Pasynok",
30
+ "url": "https://github.com/binjospookie"
31
+ }
32
+ ],
33
+ "repository": {
34
+ "type": "git",
35
+ "url": "git+https://github.com/grlt-hub/app-compose.git"
36
+ },
37
+ "files": [
38
+ "dist"
39
+ ],
40
+ "type": "module",
41
+ "main": "./dist/index.cjs",
42
+ "module": "./dist/index.js",
43
+ "types": "./dist/index.d.ts",
44
+ "exports": {
45
+ ".": {
46
+ "import": {
47
+ "types": "./dist/index.d.ts",
48
+ "default": "./dist/index.js"
49
+ },
50
+ "require": {
51
+ "types": "./dist/index.d.cts",
52
+ "default": "./dist/index.cjs"
53
+ }
54
+ },
55
+ "./package.json": "./package.json"
56
+ },
57
+ "publishConfig": {
58
+ "access": "public"
59
+ },
60
+ "scripts": {
61
+ "build": "pnpm typecheck && tsdown",
62
+ "typecheck": "tsgo --noEmit -p tsconfig.json",
63
+ "dev": "tsdown --watch",
64
+ "bench": "vitest bench --reporter=tree",
65
+ "test": "vitest run",
66
+ "lint": "knip && oxlint ./src",
67
+ "lint:fix": "oxlint --fix ./src"
68
+ }
69
+ }