@pumped-fn/lite 0.1.0
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/CHANGELOG.md +25 -0
- package/LICENSE +21 -0
- package/README.md +250 -0
- package/dist/index.cjs +647 -0
- package/dist/index.d.cts +411 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +411 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +625 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +60 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["atomSymbol: unique symbol","flowSymbol: unique symbol","tagSymbol: unique symbol","taggedSymbol: unique symbol","controllerDepSymbol: unique symbol","presetSymbol: unique symbol","controllerSymbol: unique symbol","tagExecutorSymbol: unique symbol","tags","result: T[]","atom: Lite.Atom<T>","scope: ScopeImpl","atom","ctx: Lite.ResolveContext","result: Record<string, unknown>","tags","flow"],"sources":["../src/symbols.ts","../src/tag.ts","../src/atom.ts","../src/flow.ts","../src/preset.ts","../src/scope.ts","../src/index.ts"],"sourcesContent":["export const atomSymbol: unique symbol = Symbol.for(\"@pumped-fn/lite/atom\")\nexport const flowSymbol: unique symbol = Symbol.for(\"@pumped-fn/lite/flow\")\nexport const tagSymbol: unique symbol = Symbol.for(\"@pumped-fn/lite/tag\")\nexport const taggedSymbol: unique symbol = Symbol.for(\"@pumped-fn/lite/tagged\")\nexport const controllerDepSymbol: unique symbol = Symbol.for(\"@pumped-fn/lite/controller-dep\")\nexport const presetSymbol: unique symbol = Symbol.for(\"@pumped-fn/lite/preset\")\nexport const controllerSymbol: unique symbol = Symbol.for(\"@pumped-fn/lite/controller\")\nexport const tagExecutorSymbol: unique symbol = Symbol.for(\"@pumped-fn/lite/tag-executor\")\n","import { tagSymbol, taggedSymbol, tagExecutorSymbol } from \"./symbols\"\nimport type { Lite } from \"./types\"\n\nexport interface TagOptions<T, HasDefault extends boolean> {\n label: string\n default?: HasDefault extends true ? T : never\n}\n\n/**\n * Creates a metadata tag for attaching and retrieving typed values from Atoms and Flows.\n *\n * @param options - Configuration object with label and optional default value\n * @returns A Tag instance that can create tagged values and query them from sources\n *\n * @example\n * ```typescript\n * const nameTag = tag<string>({ label: \"name\" })\n * const myAtom = atom({\n * factory: (ctx) => \"value\",\n * tags: [nameTag(\"MyAtom\")]\n * })\n * ```\n */\nexport function tag<T>(options: { label: string }): Lite.Tag<T, false>\nexport function tag<T>(options: {\n label: string\n default: T\n}): Lite.Tag<T, true>\nexport function tag<T>(options: TagOptions<T, boolean>): Lite.Tag<T, boolean> {\n const key = Symbol.for(`@pumped-fn/lite/tag/${options.label}`)\n const hasDefault = \"default\" in options\n const defaultValue = hasDefault ? options.default : undefined\n\n function createTagged(value: T): Lite.Tagged<T> {\n return {\n [taggedSymbol]: true,\n key,\n value,\n }\n }\n\n function get(source: Lite.TagSource): T {\n const tags = Array.isArray(source) ? source : source.tags ?? []\n for (let i = 0; i < tags.length; i++) {\n if (tags[i]!.key === key) return tags[i]!.value as unknown as T\n }\n if (hasDefault) return defaultValue as unknown as T\n throw new Error(`Tag \"${options.label}\" not found and has no default`)\n }\n\n function find(source: Lite.TagSource): T | undefined {\n const tags = Array.isArray(source) ? source : source.tags ?? []\n for (let i = 0; i < tags.length; i++) {\n if (tags[i]!.key === key) return tags[i]!.value as unknown as T\n }\n if (hasDefault) return defaultValue as unknown as T\n return undefined\n }\n\n function collect(source: Lite.TagSource): T[] {\n const tags = Array.isArray(source) ? source : source.tags ?? []\n const result: T[] = []\n for (let i = 0; i < tags.length; i++) {\n if (tags[i]!.key === key) result.push(tags[i]!.value as unknown as T)\n }\n return result\n }\n\n return Object.assign(createTagged, {\n [tagSymbol]: true as const,\n key,\n label: options.label,\n hasDefault,\n defaultValue,\n get,\n find,\n collect,\n }) as unknown as Lite.Tag<T, boolean>\n}\n\n/**\n * Type guard to check if a value is a Tag.\n *\n * @param value - The value to check\n * @returns True if the value is a Tag, false otherwise\n *\n * @example\n * ```typescript\n * if (isTag(value)) {\n * const tagged = value(\"myValue\")\n * }\n * ```\n */\nexport function isTag(value: unknown): value is Lite.Tag<unknown, boolean> {\n return (\n typeof value === \"function\" &&\n (value as unknown as Record<symbol, unknown>)[tagSymbol] === true\n )\n}\n\n/**\n * Type guard to check if a value is a Tagged value.\n *\n * @param value - The value to check\n * @returns True if the value is a Tagged value, false otherwise\n *\n * @example\n * ```typescript\n * if (isTagged(value)) {\n * console.log(value.key, value.value)\n * }\n * ```\n */\nexport function isTagged(value: unknown): value is Lite.Tagged<unknown> {\n return (\n typeof value === \"object\" &&\n value !== null &&\n (value as Record<symbol, unknown>)[taggedSymbol] === true\n )\n}\n\n/**\n * Tag execution helpers for declaring how tags should be resolved from dependency sources.\n */\nexport const tags = {\n /**\n * Creates a required tag executor that throws if the tag is not found.\n *\n * @param tag - The tag to execute\n * @returns A tag executor that requires the tag to be present\n *\n * @example\n * ```typescript\n * const myAtom = atom({\n * deps: { name: tags.required(nameTag) },\n * factory: (ctx, { name }) => `Hello ${name}`\n * })\n * ```\n */\n required<T>(tag: Lite.Tag<T, boolean>): Lite.TagExecutor<T, T> {\n return { [tagExecutorSymbol]: true, tag, mode: \"required\" }\n },\n\n /**\n * Creates an optional tag executor that returns undefined if the tag is not found.\n *\n * @param tag - The tag to execute\n * @returns A tag executor that allows the tag to be absent\n *\n * @example\n * ```typescript\n * const myAtom = atom({\n * deps: { name: tags.optional(nameTag) },\n * factory: (ctx, { name }) => name ?? \"Anonymous\"\n * })\n * ```\n */\n optional<T>(tag: Lite.Tag<T, boolean>): Lite.TagExecutor<T | undefined, T> {\n return { [tagExecutorSymbol]: true, tag, mode: \"optional\" }\n },\n\n /**\n * Creates a tag executor that collects all values for the given tag.\n *\n * @param tag - The tag to execute\n * @returns A tag executor that returns an array of all matching tag values\n *\n * @example\n * ```typescript\n * const myAtom = atom({\n * deps: { names: tags.all(nameTag) },\n * factory: (ctx, { names }) => names.join(\", \")\n * })\n * ```\n */\n all<T>(tag: Lite.Tag<T, boolean>): Lite.TagExecutor<T[], T> {\n return { [tagExecutorSymbol]: true, tag, mode: \"all\" }\n },\n}\n\n/**\n * Type guard to check if a value is a TagExecutor.\n *\n * @param value - The value to check\n * @returns True if the value is a TagExecutor, false otherwise\n *\n * @example\n * ```typescript\n * if (isTagExecutor(value)) {\n * console.log(value.mode, value.tag)\n * }\n * ```\n */\nexport function isTagExecutor(value: unknown): value is Lite.TagExecutor<unknown> {\n return (\n typeof value === \"object\" &&\n value !== null &&\n tagExecutorSymbol in value\n )\n}\n","import { atomSymbol, controllerDepSymbol } from \"./symbols\"\nimport type { Lite, MaybePromise } from \"./types\"\n\nexport interface AtomConfig<T, D extends Record<string, Lite.Dependency>> {\n deps?: D\n factory: Lite.AtomFactory<T, D>\n tags?: Lite.Tagged<unknown>[]\n}\n\n/**\n * Creates a long-lived dependency that can be resolved and reused within a scope.\n *\n * @param config - Configuration object containing factory function, optional dependencies, and tags\n * @returns An Atom instance that can be resolved to produce a value of type T\n *\n * @example\n * ```typescript\n * const dbAtom = atom({\n * factory: async (ctx) => createDatabase()\n * })\n * ```\n */\nexport function atom<T>(config: {\n deps?: undefined\n factory: (ctx: Lite.ResolveContext) => MaybePromise<T>\n tags?: Lite.Tagged<unknown>[]\n}): Lite.Atom<T>\n\nexport function atom<\n T,\n const D extends Record<string, Lite.Atom<unknown> | Lite.ControllerDep<unknown> | { mode: string }>,\n>(config: {\n deps: D\n factory: (ctx: Lite.ResolveContext, deps: Lite.InferDeps<D>) => MaybePromise<T>\n tags?: Lite.Tagged<unknown>[]\n}): Lite.Atom<T>\n\nexport function atom<T, D extends Record<string, Lite.Dependency>>(\n config: AtomConfig<T, D>\n): Lite.Atom<T> {\n return {\n [atomSymbol]: true,\n factory: config.factory as unknown as Lite.AtomFactory<T, Record<string, Lite.Dependency>>,\n deps: config.deps as unknown as Record<string, Lite.Dependency> | undefined,\n tags: config.tags,\n }\n}\n\n/**\n * Type guard to check if a value is an Atom.\n *\n * @param value - The value to check\n * @returns True if the value is an Atom, false otherwise\n *\n * @example\n * ```typescript\n * if (isAtom(value)) {\n * await scope.resolve(value)\n * }\n * ```\n */\nexport function isAtom(value: unknown): value is Lite.Atom<unknown> {\n return (\n typeof value === \"object\" &&\n value !== null &&\n (value as Record<symbol, unknown>)[atomSymbol] === true\n )\n}\n\n/**\n * Wraps an Atom to receive a Controller instead of the resolved value.\n * The Controller provides full lifecycle control: get, resolve, release, invalidate, and subscribe.\n *\n * @param atom - The Atom to wrap\n * @returns A ControllerDep that resolves to a Controller for the Atom\n *\n * @example\n * ```typescript\n * const configAtom = atom({ factory: () => fetchConfig() })\n * const serverAtom = atom({\n * deps: { config: controller(configAtom) },\n * factory: (ctx, { config }) => {\n * const unsub = config.on(() => ctx.invalidate())\n * ctx.cleanup(unsub)\n * return createServer(config.get().port)\n * }\n * })\n * ```\n */\nexport function controller<T>(atom: Lite.Atom<T>): Lite.ControllerDep<T> {\n return {\n [controllerDepSymbol]: true,\n atom,\n }\n}\n\n/**\n * Type guard to check if a value is a ControllerDep wrapper.\n *\n * @param value - The value to check\n * @returns True if the value is a ControllerDep wrapper, false otherwise\n *\n * @example\n * ```typescript\n * if (isControllerDep(dep)) {\n * const ctrl = scope.controller(dep.atom)\n * }\n * ```\n */\nexport function isControllerDep(value: unknown): value is Lite.ControllerDep<unknown> {\n return (\n typeof value === \"object\" &&\n value !== null &&\n (value as Record<symbol, unknown>)[controllerDepSymbol] === true\n )\n}\n","import { flowSymbol } from \"./symbols\"\nimport type { Lite, MaybePromise } from \"./types\"\n\nexport interface FlowConfig<\n TOutput,\n TInput,\n D extends Record<string, Lite.Dependency>,\n> {\n deps?: D\n factory: Lite.FlowFactory<TOutput, TInput, D>\n tags?: Lite.Tagged<unknown>[]\n}\n\n/**\n * Creates a short-lived execution unit that processes input and produces output.\n *\n * @param config - Configuration object containing factory function, optional dependencies, and tags\n * @returns A Flow instance that can be executed within an execution context\n *\n * @example\n * ```typescript\n * const processUser = flow({\n * factory: async (ctx) => {\n * const userId = ctx.input\n * return await fetchUser(userId)\n * }\n * })\n * ```\n */\nexport function flow<TOutput, TInput = unknown>(config: {\n deps?: undefined\n factory: (ctx: Lite.ExecutionContext) => MaybePromise<TOutput>\n tags?: Lite.Tagged<unknown>[]\n}): Lite.Flow<TOutput, TInput>\n\nexport function flow<\n TOutput,\n TInput,\n const D extends Record<string, Lite.Atom<unknown> | Lite.ControllerDep<unknown> | { mode: string }>,\n>(config: {\n deps: D\n factory: (ctx: Lite.ExecutionContext, deps: Lite.InferDeps<D>) => MaybePromise<TOutput>\n tags?: Lite.Tagged<unknown>[]\n}): Lite.Flow<TOutput, TInput>\n\nexport function flow<\n TOutput,\n TInput,\n D extends Record<string, Lite.Dependency>,\n>(config: FlowConfig<TOutput, TInput, D>): Lite.Flow<TOutput, TInput> {\n return {\n [flowSymbol]: true,\n factory: config.factory as unknown as Lite.FlowFactory<\n TOutput,\n TInput,\n Record<string, Lite.Dependency>\n >,\n deps: config.deps as unknown as Record<string, Lite.Dependency> | undefined,\n tags: config.tags,\n }\n}\n\n/**\n * Type guard to check if a value is a Flow.\n *\n * @param value - The value to check\n * @returns True if the value is a Flow, false otherwise\n *\n * @example\n * ```typescript\n * if (isFlow(value)) {\n * await ctx.exec({ flow: value, input: data })\n * }\n * ```\n */\nexport function isFlow(value: unknown): value is Lite.Flow<unknown, unknown> {\n return (\n typeof value === \"object\" &&\n value !== null &&\n (value as Record<symbol, unknown>)[flowSymbol] === true\n )\n}\n","import { presetSymbol } from \"./symbols\"\nimport type { Lite } from \"./types\"\n\n/**\n * Creates a preset value for an Atom, overriding its factory within a scope.\n *\n * @param atom - The Atom to preset\n * @param value - The preset value (can be a direct value or another Atom)\n * @returns A Preset instance to be used in scope configuration\n *\n * @example\n * ```typescript\n * const scope = await createScope({\n * presets: [preset(dbAtom, mockDatabase)]\n * })\n * ```\n */\nexport function preset<T>(\n atom: Lite.Atom<T>,\n value: T | Lite.Atom<T>\n): Lite.Preset<T> {\n return {\n [presetSymbol]: true,\n atom,\n value,\n }\n}\n\n/**\n * Type guard to check if a value is a Preset.\n *\n * @param value - The value to check\n * @returns True if the value is a Preset, false otherwise\n *\n * @example\n * ```typescript\n * if (isPreset(value)) {\n * console.log(value.atom, value.value)\n * }\n * ```\n */\nexport function isPreset(value: unknown): value is Lite.Preset<unknown> {\n return (\n typeof value === \"object\" &&\n value !== null &&\n (value as Record<symbol, unknown>)[presetSymbol] === true\n )\n}\n","import { controllerSymbol, tagExecutorSymbol } from \"./symbols\"\nimport type { Lite, MaybePromise, AtomState } from \"./types\"\nimport { isAtom, isControllerDep } from \"./atom\"\n\ninterface AtomEntry<T> {\n state: AtomState\n value?: T\n hasValue: boolean\n error?: Error\n cleanups: (() => MaybePromise<void>)[]\n listeners: Set<() => void>\n pendingInvalidate: boolean\n}\n\nclass ControllerImpl<T> implements Lite.Controller<T> {\n readonly [controllerSymbol] = true\n\n constructor(\n private atom: Lite.Atom<T>,\n private scope: ScopeImpl\n ) {}\n\n get state(): AtomState {\n const entry = this.scope.getEntry(this.atom)\n return entry?.state ?? 'idle'\n }\n\n get(): T {\n const entry = this.scope.getEntry(this.atom)\n if (!entry || entry.state === 'idle') {\n throw new Error(\"Atom not resolved\")\n }\n if (entry.state === 'failed' && entry.error) {\n throw entry.error\n }\n if (entry.state === 'resolving' && entry.hasValue) {\n return entry.value as T\n }\n if (entry.state === 'resolved' && entry.hasValue) {\n return entry.value as T\n }\n throw new Error(\"Atom not resolved\")\n }\n\n async resolve(): Promise<T> {\n return this.scope.resolve(this.atom)\n }\n\n async release(): Promise<void> {\n return this.scope.release(this.atom)\n }\n\n invalidate(): void {\n this.scope.invalidate(this.atom)\n }\n\n on(listener: () => void): () => void {\n return this.scope.addListener(this.atom, listener)\n }\n}\n\nclass ScopeImpl implements Lite.Scope {\n private cache = new Map<Lite.Atom<unknown>, AtomEntry<unknown>>()\n private presets = new Map<Lite.Atom<unknown>, unknown | Lite.Atom<unknown>>()\n private resolving = new Set<Lite.Atom<unknown>>()\n private pending = new Map<Lite.Atom<unknown>, Promise<unknown>>()\n private stateListeners = new Map<AtomState, Map<Lite.Atom<unknown>, Set<() => void>>>()\n private invalidationQueue = new Set<Lite.Atom<unknown>>()\n private invalidationScheduled = false\n readonly extensions: Lite.Extension[]\n readonly tags: Lite.Tagged<unknown>[]\n\n private scheduleInvalidation<T>(atom: Lite.Atom<T>): void {\n this.invalidationQueue.add(atom)\n if (!this.invalidationScheduled) {\n this.invalidationScheduled = true\n queueMicrotask(() => this.flushInvalidations())\n }\n }\n\n private flushInvalidations(): void {\n this.invalidationScheduled = false\n const atoms = [...this.invalidationQueue]\n this.invalidationQueue.clear()\n for (const atom of atoms) {\n this.invalidate(atom)\n }\n }\n\n constructor(options?: Lite.ScopeOptions) {\n this.extensions = options?.extensions ?? []\n this.tags = options?.tags ?? []\n\n for (const p of options?.presets ?? []) {\n this.presets.set(p.atom, p.value)\n }\n }\n\n async init(): Promise<void> {\n for (const ext of this.extensions) {\n if (ext.init) {\n await ext.init(this)\n }\n }\n }\n\n getEntry<T>(atom: Lite.Atom<T>): AtomEntry<T> | undefined {\n return this.cache.get(atom) as AtomEntry<T> | undefined\n }\n\n private getOrCreateEntry<T>(atom: Lite.Atom<T>): AtomEntry<T> {\n let entry = this.cache.get(atom) as AtomEntry<T> | undefined\n if (!entry) {\n entry = {\n state: 'idle',\n hasValue: false,\n cleanups: [],\n listeners: new Set(),\n pendingInvalidate: false,\n }\n this.cache.set(atom, entry as AtomEntry<unknown>)\n }\n return entry\n }\n\n addListener<T>(atom: Lite.Atom<T>, listener: () => void): () => void {\n const entry = this.getOrCreateEntry(atom)\n entry.listeners.add(listener)\n return () => {\n entry.listeners.delete(listener)\n }\n }\n\n private notifyListeners<T>(atom: Lite.Atom<T>): void {\n const entry = this.cache.get(atom)\n if (entry) {\n for (const listener of entry.listeners) {\n listener()\n }\n }\n }\n\n private emitStateChange(state: AtomState, atom: Lite.Atom<unknown>): void {\n const stateMap = this.stateListeners.get(state)\n if (stateMap) {\n const listeners = stateMap.get(atom)\n if (listeners) {\n for (const listener of listeners) {\n listener()\n }\n }\n }\n }\n\n on(event: AtomState, atom: Lite.Atom<unknown>, listener: () => void): () => void {\n let stateMap = this.stateListeners.get(event)\n if (!stateMap) {\n stateMap = new Map()\n this.stateListeners.set(event, stateMap)\n }\n let listeners = stateMap.get(atom)\n if (!listeners) {\n listeners = new Set()\n stateMap.set(atom, listeners)\n }\n listeners.add(listener)\n\n const capturedStateMap = stateMap\n const capturedListeners = listeners\n\n return () => {\n capturedListeners.delete(listener)\n if (capturedListeners.size === 0) {\n capturedStateMap.delete(atom)\n if (capturedStateMap.size === 0) {\n this.stateListeners.delete(event)\n }\n }\n }\n }\n\n async resolve<T>(atom: Lite.Atom<T>): Promise<T> {\n const entry = this.cache.get(atom) as AtomEntry<T> | undefined\n if (entry?.state === 'resolved') {\n return entry.value as T\n }\n\n const pendingPromise = this.pending.get(atom)\n if (pendingPromise) {\n return pendingPromise as Promise<T>\n }\n\n if (this.resolving.has(atom)) {\n throw new Error(\"Circular dependency detected\")\n }\n\n const presetValue = this.presets.get(atom)\n if (presetValue !== undefined) {\n if (isAtom(presetValue)) {\n return this.resolve(presetValue as Lite.Atom<T>)\n }\n const newEntry = this.getOrCreateEntry(atom)\n newEntry.state = 'resolved'\n newEntry.value = presetValue as T\n newEntry.hasValue = true\n this.emitStateChange('resolved', atom)\n this.notifyListeners(atom)\n return newEntry.value\n }\n\n this.resolving.add(atom)\n\n const promise = this.doResolve(atom)\n this.pending.set(atom, promise as Promise<unknown>)\n\n try {\n return await promise\n } finally {\n this.resolving.delete(atom)\n this.pending.delete(atom)\n }\n }\n\n private async doResolve<T>(atom: Lite.Atom<T>): Promise<T> {\n const entry = this.getOrCreateEntry(atom)\n entry.state = 'resolving'\n this.emitStateChange('resolving', atom)\n this.notifyListeners(atom)\n\n const resolvedDeps = await this.resolveDeps(atom.deps)\n\n const ctx: Lite.ResolveContext = {\n cleanup: (fn) => entry.cleanups.push(fn),\n invalidate: () => {\n this.scheduleInvalidation(atom)\n },\n scope: this,\n }\n\n const factory = atom.factory as (\n ctx: Lite.ResolveContext,\n deps?: Record<string, unknown>\n ) => MaybePromise<T>\n\n const doResolve = async () => {\n if (atom.deps && Object.keys(atom.deps).length > 0) {\n return factory(ctx, resolvedDeps)\n } else {\n return factory(ctx)\n }\n }\n\n try {\n const value = await this.applyResolveExtensions(atom, doResolve)\n entry.state = 'resolved'\n entry.value = value\n entry.hasValue = true\n entry.error = undefined\n this.emitStateChange('resolved', atom)\n this.notifyListeners(atom)\n\n if (entry.pendingInvalidate) {\n entry.pendingInvalidate = false\n this.scheduleInvalidation(atom)\n }\n\n return value\n } catch (err) {\n entry.state = 'failed'\n entry.error = err instanceof Error ? err : new Error(String(err))\n entry.value = undefined\n entry.hasValue = false\n this.emitStateChange('failed', atom)\n this.notifyListeners(atom)\n\n if (entry.pendingInvalidate) {\n entry.pendingInvalidate = false\n this.scheduleInvalidation(atom)\n }\n\n throw entry.error\n }\n }\n\n private async applyResolveExtensions<T>(\n atom: Lite.Atom<T>,\n doResolve: () => Promise<T>\n ): Promise<T> {\n let next = doResolve\n\n for (let i = this.extensions.length - 1; i >= 0; i--) {\n const ext = this.extensions[i]\n if (ext?.wrapResolve) {\n const currentNext = next\n next = ext.wrapResolve.bind(ext, currentNext, atom, this) as () => Promise<T>\n }\n }\n\n return next()\n }\n\n async resolveDeps(\n deps: Record<string, Lite.Dependency> | undefined,\n tagSource?: Lite.Tagged<unknown>[]\n ): Promise<Record<string, unknown>> {\n if (!deps) return {}\n\n const result: Record<string, unknown> = {}\n const tags = tagSource ?? this.tags\n\n for (const [key, dep] of Object.entries(deps)) {\n if (isAtom(dep)) {\n result[key] = await this.resolve(dep)\n } else if (isControllerDep(dep)) {\n result[key] = new ControllerImpl(dep.atom, this)\n } else if (tagExecutorSymbol in (dep as object)) {\n const tagExecutor = dep as Lite.TagExecutor<unknown, boolean>\n\n switch (tagExecutor.mode) {\n case \"required\":\n result[key] = tagExecutor.tag.get(tags)\n break\n case \"optional\":\n result[key] = tagExecutor.tag.find(tags)\n break\n case \"all\":\n result[key] = tagExecutor.tag.collect(tags)\n break\n }\n }\n }\n\n return result\n }\n\n controller<T>(atom: Lite.Atom<T>): Lite.Controller<T> {\n return new ControllerImpl(atom, this)\n }\n\n invalidate<T>(atom: Lite.Atom<T>): void {\n const entry = this.cache.get(atom)\n if (!entry) return\n\n if (entry.state === 'idle') return\n\n if (entry.state === 'resolving') {\n entry.pendingInvalidate = true\n return\n }\n\n this.doInvalidate(atom, entry as AtomEntry<T>)\n }\n\n private async doInvalidate<T>(atom: Lite.Atom<T>, entry: AtomEntry<T>): Promise<void> {\n const previousValue = entry.value\n for (let i = entry.cleanups.length - 1; i >= 0; i--) {\n const cleanup = entry.cleanups[i]\n if (cleanup) await cleanup()\n }\n entry.cleanups = []\n entry.state = 'resolving'\n entry.value = previousValue\n entry.error = undefined\n entry.pendingInvalidate = false\n this.pending.delete(atom)\n this.resolving.delete(atom)\n this.emitStateChange('resolving', atom)\n this.notifyListeners(atom)\n\n this.resolve(atom).catch(() => {})\n }\n\n async release<T>(atom: Lite.Atom<T>): Promise<void> {\n const entry = this.cache.get(atom)\n if (!entry) return\n\n for (let i = entry.cleanups.length - 1; i >= 0; i--) {\n const cleanup = entry.cleanups[i]\n if (cleanup) await cleanup()\n }\n\n this.cache.delete(atom)\n }\n\n async dispose(): Promise<void> {\n for (const ext of this.extensions) {\n if (ext.dispose) {\n await ext.dispose(this)\n }\n }\n\n const atoms = Array.from(this.cache.keys())\n for (const atom of atoms) {\n await this.release(atom as Lite.Atom<unknown>)\n }\n }\n\n createContext(options?: Lite.CreateContextOptions): Lite.ExecutionContext {\n return new ExecutionContextImpl(this, options)\n }\n}\n\nclass ExecutionContextImpl implements Lite.ExecutionContext {\n private cleanups: (() => MaybePromise<void>)[] = []\n private closed = false\n private _input: unknown = undefined\n private readonly baseTags: Lite.Tagged<unknown>[]\n\n constructor(\n readonly scope: ScopeImpl,\n options?: Lite.CreateContextOptions\n ) {\n const ctxTags = options?.tags\n this.baseTags = ctxTags?.length\n ? [...ctxTags, ...scope.tags]\n : scope.tags\n }\n\n get input(): unknown {\n return this._input\n }\n\n async exec<T>(options: Lite.ExecFlowOptions<T> | Lite.ExecFnOptions<T>): Promise<T> {\n if (this.closed) {\n throw new Error(\"ExecutionContext is closed\")\n }\n\n if (\"flow\" in options) {\n return this.execFlow(options)\n } else {\n return this.execFn(options)\n }\n }\n\n private async execFlow<T>(options: Lite.ExecFlowOptions<T>): Promise<T> {\n const { flow, input, tags: execTags } = options\n\n const hasExtraTags = (execTags?.length ?? 0) > 0 || (flow.tags?.length ?? 0) > 0\n const allTags = hasExtraTags\n ? [...(execTags ?? []), ...this.baseTags, ...(flow.tags ?? [])]\n : this.baseTags\n\n const resolvedDeps = await this.scope.resolveDeps(flow.deps, allTags)\n\n this._input = input\n\n const factory = flow.factory as unknown as (\n ctx: Lite.ExecutionContext,\n deps?: Record<string, unknown>\n ) => MaybePromise<T>\n\n const doExec = async (): Promise<T> => {\n if (flow.deps && Object.keys(flow.deps).length > 0) {\n return factory(this, resolvedDeps)\n } else {\n return factory(this)\n }\n }\n\n return this.applyExecExtensions(flow, doExec)\n }\n\n private execFn<T>(options: Lite.ExecFnOptions<T>): Promise<T> {\n const { fn, params } = options\n const doExec = () => Promise.resolve(fn(...params))\n return this.applyExecExtensions(fn, doExec)\n }\n\n private async applyExecExtensions<T>(\n target: Lite.Flow<T, unknown> | ((...args: unknown[]) => MaybePromise<T>),\n doExec: () => Promise<T>\n ): Promise<T> {\n let next = doExec\n\n for (let i = this.scope.extensions.length - 1; i >= 0; i--) {\n const ext = this.scope.extensions[i]\n if (ext?.wrapExec) {\n const currentNext = next\n next = ext.wrapExec.bind(ext, currentNext, target, this) as () => Promise<T>\n }\n }\n\n return next()\n }\n\n onClose(fn: () => MaybePromise<void>): void {\n this.cleanups.push(fn)\n }\n\n async close(): Promise<void> {\n if (this.closed) return\n\n this.closed = true\n\n for (let i = this.cleanups.length - 1; i >= 0; i--) {\n const cleanup = this.cleanups[i]\n if (cleanup) await cleanup()\n }\n }\n}\n\n/**\n * Creates a DI container that manages Atom resolution, caching, and lifecycle.\n *\n * @param options - Optional configuration for extensions, presets, and tags\n * @returns A Promise that resolves to a Scope instance\n *\n * @example\n * ```typescript\n * const scope = await createScope({\n * extensions: [loggingExtension],\n * presets: [preset(dbAtom, testDb)]\n * })\n * const db = await scope.resolve(dbAtom)\n * ```\n */\nexport async function createScope(\n options?: Lite.ScopeOptions\n): Promise<Lite.Scope> {\n const scope = new ScopeImpl(options)\n await scope.init()\n return scope\n}\n","export type { Lite, AtomState } from \"./types\"\nexport {\n atomSymbol,\n flowSymbol,\n tagSymbol,\n taggedSymbol,\n controllerDepSymbol,\n presetSymbol,\n controllerSymbol,\n tagExecutorSymbol,\n} from \"./symbols\"\nexport { tag, tags, isTag, isTagged, isTagExecutor } from \"./tag\"\nexport { atom, isAtom, controller, isControllerDep } from \"./atom\"\nexport { flow, isFlow } from \"./flow\"\nexport { preset, isPreset } from \"./preset\"\nexport { createScope } from \"./scope\"\n\nexport const VERSION = \"0.0.1\"\n"],"mappings":";AAAA,MAAaA,aAA4B,OAAO,IAAI,uBAAuB;AAC3E,MAAaC,aAA4B,OAAO,IAAI,uBAAuB;AAC3E,MAAaC,YAA2B,OAAO,IAAI,sBAAsB;AACzE,MAAaC,eAA8B,OAAO,IAAI,yBAAyB;AAC/E,MAAaC,sBAAqC,OAAO,IAAI,iCAAiC;AAC9F,MAAaC,eAA8B,OAAO,IAAI,yBAAyB;AAC/E,MAAaC,mBAAkC,OAAO,IAAI,6BAA6B;AACvF,MAAaC,oBAAmC,OAAO,IAAI,+BAA+B;;;;ACqB1F,SAAgB,IAAO,SAAuD;CAC5E,MAAM,MAAM,OAAO,IAAI,uBAAuB,QAAQ,QAAQ;CAC9D,MAAM,aAAa,aAAa;CAChC,MAAM,eAAe,aAAa,QAAQ,UAAU;CAEpD,SAAS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",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Lightweight dependency injection with minimal reactivity",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.mjs",
|
|
8
|
+
"types": "./dist/index.d.cts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": {
|
|
12
|
+
"types": "./dist/index.d.mts",
|
|
13
|
+
"default": "./dist/index.mjs"
|
|
14
|
+
},
|
|
15
|
+
"require": {
|
|
16
|
+
"types": "./dist/index.d.cts",
|
|
17
|
+
"default": "./dist/index.cjs"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"dist",
|
|
23
|
+
"README.md",
|
|
24
|
+
"LICENSE",
|
|
25
|
+
"CHANGELOG.md"
|
|
26
|
+
],
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"tsdown": "^0.16.5",
|
|
29
|
+
"typescript": "^5.9.3",
|
|
30
|
+
"vitest": "^4.0.5"
|
|
31
|
+
},
|
|
32
|
+
"engines": {
|
|
33
|
+
"node": ">=18"
|
|
34
|
+
},
|
|
35
|
+
"publishConfig": {
|
|
36
|
+
"access": "public"
|
|
37
|
+
},
|
|
38
|
+
"repository": {
|
|
39
|
+
"type": "git",
|
|
40
|
+
"directory": "packages/lite",
|
|
41
|
+
"url": "git+https://github.com/pumped-fn/pumped-fn.git"
|
|
42
|
+
},
|
|
43
|
+
"keywords": [
|
|
44
|
+
"dependency-injection",
|
|
45
|
+
"di",
|
|
46
|
+
"lite",
|
|
47
|
+
"reactivity",
|
|
48
|
+
"typescript",
|
|
49
|
+
"ioc",
|
|
50
|
+
"inversion-of-control"
|
|
51
|
+
],
|
|
52
|
+
"license": "MIT",
|
|
53
|
+
"scripts": {
|
|
54
|
+
"build": "tsdown",
|
|
55
|
+
"typecheck": "tsc --noEmit",
|
|
56
|
+
"typecheck:full": "tsc --noEmit -p tsconfig.test.json",
|
|
57
|
+
"test": "vitest run",
|
|
58
|
+
"test:watch": "vitest"
|
|
59
|
+
}
|
|
60
|
+
}
|