silentium 0.0.52 → 0.0.53
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 +7 -0
- package/dist/silentium.cjs +3 -0
- package/dist/silentium.cjs.map +1 -1
- package/dist/silentium.d.ts +4 -3
- package/dist/silentium.js +3 -0
- package/dist/silentium.js.map +1 -1
- package/dist/silentium.min.js +1 -1
- package/dist/silentium.min.mjs +1 -1
- package/dist/silentium.min.mjs.map +1 -1
- package/dist/silentium.mjs +3 -0
- package/dist/silentium.mjs.map +1 -1
- package/package.json +1 -1
- package/src/Owner/OwnerSync._of.test.ts +1 -0
- package/src/Owner/OwnerSync.test.ts +1 -0
- package/src/Owner/OwnerSync.ts +6 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [0.0.53](https://github.com/silentium-lab/silentium/compare/v0.0.52...v0.0.53) (2025-07-03)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **main:** ownerSync filled method ([06df6c0](https://github.com/silentium-lab/silentium/commit/06df6c02b50d979936e7b86b1b3a127057b176d7))
|
|
11
|
+
|
|
5
12
|
### [0.0.52](https://github.com/silentium-lab/silentium/compare/v0.0.51...v0.0.52) (2025-07-02)
|
|
6
13
|
|
|
7
14
|
|
package/dist/silentium.cjs
CHANGED
package/dist/silentium.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"silentium.cjs","sources":["../src/Information/Information.ts","../src/Owner/Owner.ts","../src/Information/All.ts","../src/Information/Any.ts","../src/Information/Chain.ts","../src/Information/ExecutorApplied.ts","../src/Information/Applied.ts","../src/Information/Filtered.ts","../src/Owner/OwnerApplied.ts","../src/Owner/OwnerExecutorApplied.ts","../src/Owner/OwnerSync.ts","../src/Information/Lazy.ts","../src/Information/Map.ts","../src/Information/Of.ts","../src/Information/Once.ts","../src/utils/OwnerPool.ts","../src/Information/Pool.ts","../src/Information/Sequence.ts","../src/Information/Stream.ts","../src/Information/FromCallback.ts","../src/Information/FromEvent.ts","../src/Information/FromPromise.ts","../src/utils/Lazy.ts","../src/utils/LazyClass.ts"],"sourcesContent":["import { Owner } from \"../Owner/Owner\";\nimport { InformationDataType } from \"../types/InformationType\";\n\ntype InfoExecutorType<T> = (g: Owner<T>) => (() => void | undefined) | void;\ntype InfoObjectType<T> = {\n value: InfoExecutorType<T>;\n};\n\ntype InformationExecutedCb<T> = (g: Owner<T>) => void;\n\n/**\n * Main information representation\n * https://silentium-lab.github.io/silentium/#/en/information\n */\nexport class Information<T = any> {\n private static instances = 0;\n private theSubInfos: Information<unknown>[] = [];\n private destructor?: () => void;\n private owner?: Owner<T>;\n private executedCbs?: InformationExecutedCb<T>[];\n private alreadyExecuted = false;\n\n public constructor(\n private info?:\n | InfoObjectType<T>\n | InfoExecutorType<T>\n | InformationDataType<T>,\n private theName = \"unknown\",\n private onlyOneOwner = true,\n ) {\n Information.instances += 1;\n }\n\n /**\n * Следующее значение источника\n */\n private next(value: T) {\n if (this.owner !== undefined) {\n this.owner.give(value);\n }\n return this;\n }\n\n /**\n * Возможность гостю получить информацию от источника\n */\n public value(owner: Owner<T>) {\n if (this.onlyOneOwner && this.owner !== undefined) {\n throw new Error(`owner already connected to info ${this.name()}`);\n }\n\n this.owner = owner;\n if (this.executedCbs !== undefined && !this.alreadyExecuted) {\n this.executedCbs.forEach((cb) => cb(owner));\n this.alreadyExecuted = true;\n }\n\n if (this.info === undefined) {\n return this;\n }\n\n if (typeof this.info === \"function\") {\n const mbDestructor = this.info(owner);\n if (\n this.destructor === undefined &&\n mbDestructor !== undefined &&\n this.info !== mbDestructor &&\n typeof mbDestructor === \"function\"\n ) {\n this.destructor = mbDestructor as () => void;\n }\n } else if (\n typeof this.info === \"object\" &&\n this.info !== null &&\n \"value\" in this.info &&\n typeof this.info.value === \"function\"\n ) {\n this.info.value(owner);\n } else {\n this.next(this.info as T);\n }\n\n return this;\n }\n\n /**\n * Ability to destroy the information info\n */\n public destroy() {\n while (this.theSubInfos.length > 0) {\n const subInfo = this.theSubInfos.shift();\n subInfo?.destroy();\n }\n if (this.destructor) {\n this.destructor();\n }\n this.owner = undefined;\n this.executedCbs = undefined;\n this.destructor = undefined;\n return this;\n }\n\n /**\n * The ability to link another info to the current info\n */\n public subInfo(info: Information<any>) {\n this.theSubInfos.push(info);\n return this;\n }\n\n public subInfos() {\n return this.theSubInfos;\n }\n\n public name() {\n return `#info_${this.theName}_${Information.instances}`;\n }\n\n public executed(cb: InformationExecutedCb<T>) {\n if (!this.executedCbs) {\n this.executedCbs = [];\n }\n this.executedCbs.push(cb);\n if (this.alreadyExecuted && this.owner !== undefined) {\n cb(this.owner);\n }\n return this;\n }\n\n public hasOwner(): boolean {\n return !!this.owner;\n }\n}\n\nexport const I = <T>(\n info?: InfoObjectType<T> | InfoExecutorType<T> | InformationDataType<T>,\n theName = \"unknown\",\n onlyOneOwner = true,\n) => new Information(info, theName, onlyOneOwner);\n","import { OwnerExecutorType } from \"../types/OwnerType\";\n\n/**\n * Information owner, if information\n * has owner than information executed\n * https://silentium-lab.github.io/silentium/#/en/owner\n */\nexport class Owner<T = any> {\n public constructor(\n private ownerFn: OwnerExecutorType<T>,\n private errorFn?: (cause: unknown) => void,\n private disposedFn?: () => boolean,\n ) {}\n\n public give(value: T) {\n if (!this.disposed()) {\n this.ownerFn(value);\n }\n return this;\n }\n\n public error(cause: unknown) {\n if (this.errorFn !== undefined) {\n this.errorFn(cause);\n }\n\n return this;\n }\n\n public disposed() {\n return this.disposedFn !== undefined ? this.disposedFn() : false;\n }\n}\n\nexport const O = <T>(ownerFn: OwnerExecutorType<T>) => new Owner(ownerFn);\n","import { Owner } from \"../Owner/Owner\";\nimport { InformationType } from \"../types/InformationType\";\nimport { Information } from \"./Information\";\n\ntype ExtractType<T> = T extends InformationType<infer U> ? U : never;\ntype ExtractTypeS<T> = T extends Information<infer U> ? U : never;\n\nexport type ExtractTypesFromArray<T extends InformationType<any>[]> = {\n [K in keyof T]: ExtractType<T[K]>;\n};\n\nexport type ExtractTypesFromArrayS<T extends Information<any>[]> = {\n [K in keyof T]: ExtractTypeS<T[K]>;\n};\n\n/**\n * Combines multiple information sources into a single unified source\n * represented as an array containing values from all sources\n * https://silentium-lab.github.io/silentium/#/en/information/all\n */\nexport const all = <const T extends Information[]>(...infos: T) => {\n const i = new Information<ExtractTypesFromArrayS<T>>((g) => {\n const keysKnown = new Set<string>(Object.keys(infos));\n const keysFilled = new Set();\n const isAllFilled = () => {\n return keysFilled.size > 0 && keysFilled.size === keysKnown.size;\n };\n const result: Record<string, unknown> = {};\n\n Object.entries(infos).forEach(([key, info]) => {\n i.subInfo(info);\n keysKnown.add(key);\n info.value(\n new Owner((v) => {\n keysFilled.add(key);\n result[key] = v;\n if (isAllFilled()) {\n g.give(Object.values(result) as ExtractTypesFromArrayS<T>);\n }\n }),\n );\n });\n });\n\n return i;\n};\n","import { I, Information } from \"./Information\";\n\n/**\n * From a set of information sources we get\n * a common response from any source for a single owner\n * https://silentium-lab.github.io/silentium/#/en/information/any\n */\nexport const any = <T>(...infos: Information<T>[]) => {\n const info = I((g) => {\n infos.forEach((info) => {\n info.value(g);\n info.subInfo(info);\n });\n });\n\n return info;\n};\n","import { O, Owner } from \"../Owner/Owner\";\nimport { I, Information } from \"./Information\";\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\ntype Last<T extends any[]> = T extends [...infer U, infer L] ? L : never;\n\n/**\n * The set of information sources forms a sequential chain where each source provides\n * an answer. The final answer will be the output result. If any source in the chain\n * provides a new answer, the component's overall response will be repeated.\n * https://silentium-lab.github.io/silentium/#/en/information/applied\n */\nexport const chain = <T extends Information[]>(\n ...infos: T\n): Information<Last<T>> => {\n let theOwner: Owner<Last<T>> | undefined;\n let lastValue: Last<T> | undefined;\n const respondedI = new WeakMap();\n\n const handleI = (index: number) => {\n const info = infos[index];\n const nextI = infos[index + 1];\n\n info.value(\n O((v) => {\n if (!nextI) {\n lastValue = v;\n theOwner?.give(v);\n }\n\n if (nextI && lastValue !== undefined && theOwner !== undefined) {\n theOwner.give(lastValue);\n }\n\n if (nextI && !respondedI.has(info)) {\n handleI(index + 1);\n }\n\n respondedI.set(info, 1);\n }),\n );\n };\n\n const info = I<Last<T>>((g) => {\n theOwner = g;\n });\n\n info.executed(() => {\n handleI(0);\n });\n\n return info;\n};\n","import { Owner } from \"../Owner/Owner\";\nimport { Information } from \"./Information\";\n\n/**\n * Information to which a function is applied in order\n * to control the value passing process\n * https://silentium-lab.github.io/silentium/#/en/information/applied\n */\nexport const executorApplied = <T>(\n base: Information<T>,\n applier: (executor: Owner<T>) => Owner<T>,\n) => {\n const i = new Information<T>((g) => {\n base.value(applier(g));\n });\n i.subInfo(base);\n\n return i;\n};\n","import { O } from \"../Owner/Owner\";\nimport { I, Information } from \"./Information\";\n\n/**\n * Information to which the function was applied to change the value\n * https://silentium-lab.github.io/silentium/#/en/information/applied\n */\nexport const applied = <T, R>(base: Information<T>, applier: (v: T) => R) => {\n const info = I((g) => {\n base.value(\n O((v) => {\n g.give(applier(v));\n }),\n );\n });\n info.subInfo(base);\n\n return info;\n};\n","import { O } from \"../Owner/Owner\";\nimport { Information } from \"./Information\";\n\n/**\n * Information whose value is being validated\n * via a predicate; if the predicate returns true, the value\n * can be passed to the output\n * https://silentium-lab.github.io/silentium/#/en/information/filtered\n */\nexport const filtered = <T>(\n base: Information<T>,\n predicate: (v: T) => boolean,\n defaultValue?: T,\n) => {\n return new Information<T>((g) => {\n base.value(\n O((v) => {\n if (predicate(v)) {\n g.give(v);\n } else if (defaultValue !== undefined) {\n g.give(defaultValue);\n }\n }),\n );\n }).subInfo(base);\n};\n","import { Owner } from \"./Owner\";\n\n/**\n * Owner to which a function is applied that modifies the incoming\n * value it receives\n * https://silentium-lab.github.io/silentium/#/en/owner/applied\n */\nexport const ownerApplied = <T, R>(\n base: Owner<R>,\n applier: (value: T) => R,\n) => {\n return new Owner<T>(\n (v) => {\n base.give(applier(v));\n },\n (cause) => {\n base.error(cause);\n },\n () => base.disposed(),\n );\n};\n","import { Owner } from \"./Owner\";\n\n/**\n * Owner to which the function is applied that\n * controls the conditions for passing the value\n * https://silentium-lab.github.io/silentium/#/en/owner/executor-applied\n */\nexport const ownerExecutorApplied = <T>(\n base: Owner<T>,\n applier: (ge: (v: T) => void) => (v: T) => void,\n) => {\n const executor = applier((v) => base.give(v));\n return new Owner<T>((v) => {\n executor(v);\n });\n};\n","import { Information } from \"../Information\";\nimport { O } from \".\";\n\nexport interface infoSync<T> {\n syncValue(): T;\n}\n\n/**\n * Owner that can return a synchronous value\n * from the information passed to it. If there is no value and no\n * defaultValue, an error will occur\n * https://silentium-lab.github.io/silentium/#/en/owner/sync\n */\nexport const ownerSync = <T>(\n base: Information<T>,\n defaultValue?: T,\n): infoSync<T> => {\n let lastValue: T | undefined;\n\n base.value(\n O((v) => {\n lastValue = v;\n }),\n );\n\n return {\n syncValue() {\n if (lastValue === undefined && defaultValue === undefined) {\n throw new Error(\"info sync is empty\");\n }\n return (lastValue ?? defaultValue) as T;\n },\n };\n};\n","import { O } from \"../Owner\";\nimport { LazyType } from \"../types/LazyType\";\nimport { Information } from \"./Information\";\n\n/**\n * Helps in the process of executing information to create\n * a new information object and also destroy it if\n * destruction information is received\n * https://silentium-lab.github.io/silentium/#/en/information/lazy\n */\nexport const lazyS = <T>(\n lazyI: LazyType<Information<T>>,\n destroyI?: Information<unknown>,\n) => {\n const info = new Information<T>((g) => {\n const instance = lazyI.get();\n info.subInfo(instance);\n instance.value(g);\n });\n\n if (destroyI) {\n info.subInfo(destroyI);\n destroyI.value(\n O(() => {\n info.destroy();\n }),\n );\n }\n\n return info;\n};\n","import { InformationDataType } from \"../types\";\nimport { O } from \"../Owner/Owner\";\nimport { LazyType } from \"../types/LazyType\";\nimport { all } from \"./All\";\nimport { I, Information } from \"./Information\";\n\n/**\n * Component that applies an info object constructor to each data item,\n * producing an information source with new values\n * https://silentium-lab.github.io/silentium/#/en/information/map\n */\nexport const map = <T, TG>(\n base: Information<T[]>,\n targetI: LazyType<Information<TG>>,\n) => {\n const i = new Information<TG[]>((g) => {\n base.value(\n O((v) => {\n const infos: Information<TG>[] = [];\n v.forEach((val) => {\n let valInfo: Information<T> | T = val;\n if (!(valInfo instanceof Information)) {\n valInfo = I(val as InformationDataType<T>);\n }\n const info = targetI.get(valInfo);\n infos.push(info);\n });\n const allI = all(...infos).value(g);\n i.subInfo(allI);\n }),\n );\n });\n i.subInfo(base);\n\n return i;\n};\n","import { Owner } from \"../Owner\";\nimport { Information } from \"./Information\";\nimport { InformationDataType } from \"../types/InformationType\";\n\n/**\n * A component that allows creating linked objects of information and its owner\n * in such a way that if a new value is assigned to the owner, this value\n * will become the value of the linked information source\n * https://silentium-lab.github.io/silentium/#/en/information/of\n */\nexport const of = <T>(incomeI?: InformationDataType<T>) => {\n let sharedValue = incomeI as T;\n let relatedO: Owner<T> | undefined;\n\n const notifyO = () => {\n if (relatedO !== undefined) {\n relatedO.give(sharedValue);\n }\n };\n\n const info = new Information<T>((g) => {\n relatedO = g;\n if (sharedValue !== undefined && sharedValue !== null) {\n notifyO();\n }\n }, \"of\");\n\n return [\n info,\n new Owner<T>((v) => {\n sharedValue = v;\n notifyO();\n }),\n ] as const;\n};\n","import { O } from \"../Owner\";\nimport { Information } from \"./Information\";\n\n/**\n * Limits the number of values from the information source\n * to a single value - once the first value is emitted, no more\n * values are delivered from the source\n * https://silentium-lab.github.io/silentium/#/en/information/once\n */\nexport const once = <T>(base: Information<T>) => {\n const info = new Information<T>((g) => {\n let isFilled = false;\n base.value(\n O((v) => {\n if (!isFilled) {\n isFilled = true;\n g.give(v);\n }\n }),\n );\n });\n info.subInfo(base);\n\n return info;\n};\n","import { Owner } from \"../Owner\";\n\n/**\n * Helps maintain an owner list allowing different\n * owners to get information from a common source\n * https://silentium-lab.github.io/silentium/#/en/utils/owner-pool\n */\nexport class OwnerPool<T> {\n private owners: Set<Owner<T>>;\n private innerOwner: Owner<T>;\n\n public constructor() {\n this.owners = new Set<Owner<T>>();\n this.innerOwner = new Owner(\n (v) => {\n this.owners.forEach((g) => {\n g.give(v);\n });\n },\n (cause) => {\n this.owners.forEach((g) => {\n g.error(cause);\n });\n },\n );\n }\n\n public owner() {\n return this.innerOwner;\n }\n\n public size(): number {\n return this.owners.size;\n }\n\n public has(owner: Owner<T>): boolean {\n return this.owners.has(owner);\n }\n\n public add(shouldBePatron: Owner<T>) {\n this.owners.add(shouldBePatron);\n return this;\n }\n\n public remove(g: Owner<T>) {\n this.owners.delete(g);\n return this;\n }\n\n public destroy() {\n this.owners.forEach((g) => {\n this.remove(g);\n });\n return this;\n }\n}\n","import { Owner } from \"../Owner\";\nimport { Information } from \"./Information\";\nimport { OwnerPool } from \"../utils/OwnerPool\";\n\n/**\n * An information object that helps multiple owners access\n * a single another information object\n * https://silentium-lab.github.io/silentium/#/en/information/pool\n */\nexport const pool = <T>(base: Information<T>) => {\n const ownersPool = new OwnerPool<T>();\n let lastValue: T | undefined;\n\n const i = new Information<T>(\n (g) => {\n if (lastValue !== undefined && !ownersPool.has(g)) {\n g.give(lastValue);\n }\n ownersPool.add(g);\n\n return () => {\n ownersPool.destroy();\n };\n },\n \"pool\",\n false,\n );\n i.subInfo(base);\n\n i.executed(() => {\n const gp = ownersPool.owner();\n base.value(\n new Owner((v) => {\n gp.give(v);\n lastValue = v;\n }),\n );\n });\n\n return [i, ownersPool] as const;\n};\n\nexport const poolStateless = <T>(base: Information<T>) => {\n const ownersPool = new OwnerPool<T>();\n\n const i = new Information<T>(\n (g) => {\n ownersPool.add(g);\n\n return () => {\n ownersPool.destroy();\n };\n },\n \"pool\",\n false,\n );\n i.subInfo(base);\n\n i.executed((g) => {\n ownersPool.add(g);\n base.value(ownersPool.owner());\n });\n\n return [i, ownersPool] as const;\n};\n","import { I, Information } from \"../Information\";\nimport { O } from \"../Owner\";\n\n/**\n * A component that takes one value at a time and returns an array\n * https://silentium-lab.github.io/silentium/#/en/information/sequence\n */\nexport const sequence = <T>(base: Information<T>): Information<T[]> => {\n const i = I<T[]>((o) => {\n const result: T[] = [];\n\n base.value(\n O((v) => {\n result.push(v);\n o.give(result);\n }),\n );\n });\n i.subInfo(base);\n\n return i;\n};\n","import { I, Information } from \"../Information\";\nimport { O } from \"../Owner\";\n\n/**\n * Component that receives a data array and yields values one by one\n * https://silentium-lab.github.io/silentium/#/en/information/stream\n */\nexport const stream = <T>(base: Information<T[]>): Information<T> => {\n const i = I<T>((o) => {\n base.value(\n O((v) => {\n v.forEach((cv) => {\n o.give(cv);\n });\n }),\n );\n });\n\n return i;\n};\n","import { I } from \"../Information\";\n\n/**\n * When receiving a reference to a function expecting a callback, the component\n * creates its own callback, and the data received in this callback\n * will become the value of the information object\n * https://silentium-lab.github.io/silentium/#/en/information/from-callback\n */\nexport const fromCallback = <T>(waitForCb: (cb: (v: T) => any) => unknown) => {\n return I((o) => {\n waitForCb((v) => {\n o.give(v);\n });\n });\n};\n","import { I } from \"../Information\";\n\n/**\n * A component that receives data from an event and\n * presents it as an information object\n * https://silentium-lab.github.io/silentium/#/en/information/from-event\n */\nexport const fromEvent = <T extends []>(\n emitter: any,\n eventName: string,\n subscribeMethod: string,\n unsubscribeMethod?: string,\n) => {\n return I((o) => {\n const handler = (...args: T) => {\n o.give(args);\n };\n emitter[subscribeMethod](eventName, handler);\n return () => {\n if (unsubscribeMethod !== undefined) {\n emitter[unsubscribeMethod](eventName, handler);\n }\n };\n });\n};\n","import { I, Information } from \"../Information/Information\";\n\n/**\n * Component that gets a value from a promise and\n * presents it as information\n * https://silentium-lab.github.io/silentium/#/en/information/from-promise\n */\nexport const fromPromise = <T>(p: Promise<T>): Information<T> => {\n return I((o) => {\n p.then((v) => {\n o.give(v);\n }).catch((e) => {\n o.error(e);\n });\n });\n};\n","import { LazyType } from \"../types/LazyType\";\n\n/**\n * Helps to get lazy instance of dependency\n * @url https://silentium-lab.github.io/silentium/#/utils/lazy\n */\nexport const lazy = <T>(buildingFn: (...args: any[]) => T): LazyType<T> => {\n if (buildingFn === undefined) {\n throw new Error(\"lazy didn't receive buildingFn argument\");\n }\n\n return {\n get<R extends unknown[], CT = null>(...args: R): CT extends null ? T : CT {\n return buildingFn(...args) as CT extends null ? T : CT;\n },\n };\n};\n","import { LazyType } from \"../types/LazyType\";\n\ninterface Constructable<T> {\n new (...args: unknown[]): T;\n}\n\ninterface Prototyped<T> {\n prototype: T;\n}\n\n/**\n * Helps create an object from a class\n * https://silentium-lab.github.io/silentium/#/en/utils/lazy-class\n */\nexport const lazyClass = <T>(\n constructorFn: Prototyped<T>,\n modules: Record<string, unknown> = {},\n): LazyType<T> => {\n if (constructorFn === undefined) {\n throw new Error(\"PrivateClass didn't receive constructorFn argument\");\n }\n\n return {\n get<R extends unknown[], CT = null>(...args: R): CT extends null ? T : CT {\n return new (constructorFn as Constructable<T>)(\n ...args,\n modules,\n ) as CT extends null ? T : CT;\n },\n };\n};\n"],"names":["__publicField","info"],"mappings":";;;;;AAcO,MAAM,YAAA,GAAN,MAAM,YAAqB,CAAA;AAAA,EAQzB,WACG,CAAA,IAAA,EAIA,OAAU,GAAA,SAAA,EACV,eAAe,IACvB,EAAA;AANQ,IAAA,IAAA,CAAA,IAAA,GAAA,IAAA;AAIA,IAAA,IAAA,CAAA,OAAA,GAAA,OAAA;AACA,IAAA,IAAA,CAAA,YAAA,GAAA,YAAA;AAZV,IAAAA,eAAA,CAAA,IAAA,EAAQ,eAAsC,EAAC,CAAA;AAC/C,IAAQA,eAAA,CAAA,IAAA,EAAA,YAAA,CAAA;AACR,IAAQA,eAAA,CAAA,IAAA,EAAA,OAAA,CAAA;AACR,IAAQA,eAAA,CAAA,IAAA,EAAA,aAAA,CAAA;AACR,IAAAA,eAAA,CAAA,IAAA,EAAQ,iBAAkB,EAAA,KAAA,CAAA;A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AA,IAAA,GAAO,CAAI,UAAmD,KAAA;AACzE,EAAA,IAAI,eAAe,MAAW,EAAA;AAC5B,IAAM,MAAA,IAAI,MAAM,yCAAyC,CAAA;AAAA;AAG3D,EAAO,OAAA;AAAA,IACL,OAAuC,IAAmC,EAAA;AACxE,MAAO,OAAA,UAAA,CAAW,GAAG,IAAI,CAAA;AAAA;AAC3B,GACF;AACF;;ACFO,MAAM,SAAY,GAAA,CACvB,aACA,EAAA,OAAA,GAAmC,EACnB,KAAA;AAChB,EAAA,IAAI,kBAAkB,MAAW,EAAA;AAC/B,IAAM,MAAA,IAAI,MAAM,oDAAoD,CAAA;AAAA;AAGtE,EAAO,OAAA;AAAA,IACL,OAAuC,IAAmC,EAAA;AACxE,MAAA,OAAO,IAAK,aAAA;AAAA,QACV,GAAG,IAAA;AAAA,QACH;AAAA,OACF;AAAA;AACF,GACF;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"silentium.cjs","sources":["../src/Information/Information.ts","../src/Owner/Owner.ts","../src/Information/All.ts","../src/Information/Any.ts","../src/Information/Chain.ts","../src/Information/ExecutorApplied.ts","../src/Information/Applied.ts","../src/Information/Filtered.ts","../src/Owner/OwnerApplied.ts","../src/Owner/OwnerExecutorApplied.ts","../src/Owner/OwnerSync.ts","../src/Information/Lazy.ts","../src/Information/Map.ts","../src/Information/Of.ts","../src/Information/Once.ts","../src/utils/OwnerPool.ts","../src/Information/Pool.ts","../src/Information/Sequence.ts","../src/Information/Stream.ts","../src/Information/FromCallback.ts","../src/Information/FromEvent.ts","../src/Information/FromPromise.ts","../src/utils/Lazy.ts","../src/utils/LazyClass.ts"],"sourcesContent":["import { Owner } from \"../Owner/Owner\";\nimport { InformationDataType } from \"../types/InformationType\";\n\ntype InfoExecutorType<T> = (g: Owner<T>) => (() => void | undefined) | void;\ntype InfoObjectType<T> = {\n value: InfoExecutorType<T>;\n};\n\ntype InformationExecutedCb<T> = (g: Owner<T>) => void;\n\n/**\n * Main information representation\n * https://silentium-lab.github.io/silentium/#/en/information\n */\nexport class Information<T = any> {\n private static instances = 0;\n private theSubInfos: Information<unknown>[] = [];\n private destructor?: () => void;\n private owner?: Owner<T>;\n private executedCbs?: InformationExecutedCb<T>[];\n private alreadyExecuted = false;\n\n public constructor(\n private info?:\n | InfoObjectType<T>\n | InfoExecutorType<T>\n | InformationDataType<T>,\n private theName = \"unknown\",\n private onlyOneOwner = true,\n ) {\n Information.instances += 1;\n }\n\n /**\n * Следующее значение источника\n */\n private next(value: T) {\n if (this.owner !== undefined) {\n this.owner.give(value);\n }\n return this;\n }\n\n /**\n * Возможность гостю получить информацию от источника\n */\n public value(owner: Owner<T>) {\n if (this.onlyOneOwner && this.owner !== undefined) {\n throw new Error(`owner already connected to info ${this.name()}`);\n }\n\n this.owner = owner;\n if (this.executedCbs !== undefined && !this.alreadyExecuted) {\n this.executedCbs.forEach((cb) => cb(owner));\n this.alreadyExecuted = true;\n }\n\n if (this.info === undefined) {\n return this;\n }\n\n if (typeof this.info === \"function\") {\n const mbDestructor = this.info(owner);\n if (\n this.destructor === undefined &&\n mbDestructor !== undefined &&\n this.info !== mbDestructor &&\n typeof mbDestructor === \"function\"\n ) {\n this.destructor = mbDestructor as () => void;\n }\n } else if (\n typeof this.info === \"object\" &&\n this.info !== null &&\n \"value\" in this.info &&\n typeof this.info.value === \"function\"\n ) {\n this.info.value(owner);\n } else {\n this.next(this.info as T);\n }\n\n return this;\n }\n\n /**\n * Ability to destroy the information info\n */\n public destroy() {\n while (this.theSubInfos.length > 0) {\n const subInfo = this.theSubInfos.shift();\n subInfo?.destroy();\n }\n if (this.destructor) {\n this.destructor();\n }\n this.owner = undefined;\n this.executedCbs = undefined;\n this.destructor = undefined;\n return this;\n }\n\n /**\n * The ability to link another info to the current info\n */\n public subInfo(info: Information<any>) {\n this.theSubInfos.push(info);\n return this;\n }\n\n public subInfos() {\n return this.theSubInfos;\n }\n\n public name() {\n return `#info_${this.theName}_${Information.instances}`;\n }\n\n public executed(cb: InformationExecutedCb<T>) {\n if (!this.executedCbs) {\n this.executedCbs = [];\n }\n this.executedCbs.push(cb);\n if (this.alreadyExecuted && this.owner !== undefined) {\n cb(this.owner);\n }\n return this;\n }\n\n public hasOwner(): boolean {\n return !!this.owner;\n }\n}\n\nexport const I = <T>(\n info?: InfoObjectType<T> | InfoExecutorType<T> | InformationDataType<T>,\n theName = \"unknown\",\n onlyOneOwner = true,\n) => new Information(info, theName, onlyOneOwner);\n","import { OwnerExecutorType } from \"../types/OwnerType\";\n\n/**\n * Information owner, if information\n * has owner than information executed\n * https://silentium-lab.github.io/silentium/#/en/owner\n */\nexport class Owner<T = any> {\n public constructor(\n private ownerFn: OwnerExecutorType<T>,\n private errorFn?: (cause: unknown) => void,\n private disposedFn?: () => boolean,\n ) {}\n\n public give(value: T) {\n if (!this.disposed()) {\n this.ownerFn(value);\n }\n return this;\n }\n\n public error(cause: unknown) {\n if (this.errorFn !== undefined) {\n this.errorFn(cause);\n }\n\n return this;\n }\n\n public disposed() {\n return this.disposedFn !== undefined ? this.disposedFn() : false;\n }\n}\n\nexport const O = <T>(ownerFn: OwnerExecutorType<T>) => new Owner(ownerFn);\n","import { Owner } from \"../Owner/Owner\";\nimport { InformationType } from \"../types/InformationType\";\nimport { Information } from \"./Information\";\n\ntype ExtractType<T> = T extends InformationType<infer U> ? U : never;\ntype ExtractTypeS<T> = T extends Information<infer U> ? U : never;\n\nexport type ExtractTypesFromArray<T extends InformationType<any>[]> = {\n [K in keyof T]: ExtractType<T[K]>;\n};\n\nexport type ExtractTypesFromArrayS<T extends Information<any>[]> = {\n [K in keyof T]: ExtractTypeS<T[K]>;\n};\n\n/**\n * Combines multiple information sources into a single unified source\n * represented as an array containing values from all sources\n * https://silentium-lab.github.io/silentium/#/en/information/all\n */\nexport const all = <const T extends Information[]>(...infos: T) => {\n const i = new Information<ExtractTypesFromArrayS<T>>((g) => {\n const keysKnown = new Set<string>(Object.keys(infos));\n const keysFilled = new Set();\n const isAllFilled = () => {\n return keysFilled.size > 0 && keysFilled.size === keysKnown.size;\n };\n const result: Record<string, unknown> = {};\n\n Object.entries(infos).forEach(([key, info]) => {\n i.subInfo(info);\n keysKnown.add(key);\n info.value(\n new Owner((v) => {\n keysFilled.add(key);\n result[key] = v;\n if (isAllFilled()) {\n g.give(Object.values(result) as ExtractTypesFromArrayS<T>);\n }\n }),\n );\n });\n });\n\n return i;\n};\n","import { I, Information } from \"./Information\";\n\n/**\n * From a set of information sources we get\n * a common response from any source for a single owner\n * https://silentium-lab.github.io/silentium/#/en/information/any\n */\nexport const any = <T>(...infos: Information<T>[]) => {\n const info = I((g) => {\n infos.forEach((info) => {\n info.value(g);\n info.subInfo(info);\n });\n });\n\n return info;\n};\n","import { O, Owner } from \"../Owner/Owner\";\nimport { I, Information } from \"./Information\";\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\ntype Last<T extends any[]> = T extends [...infer U, infer L] ? L : never;\n\n/**\n * The set of information sources forms a sequential chain where each source provides\n * an answer. The final answer will be the output result. If any source in the chain\n * provides a new answer, the component's overall response will be repeated.\n * https://silentium-lab.github.io/silentium/#/en/information/applied\n */\nexport const chain = <T extends Information[]>(\n ...infos: T\n): Information<Last<T>> => {\n let theOwner: Owner<Last<T>> | undefined;\n let lastValue: Last<T> | undefined;\n const respondedI = new WeakMap();\n\n const handleI = (index: number) => {\n const info = infos[index];\n const nextI = infos[index + 1];\n\n info.value(\n O((v) => {\n if (!nextI) {\n lastValue = v;\n theOwner?.give(v);\n }\n\n if (nextI && lastValue !== undefined && theOwner !== undefined) {\n theOwner.give(lastValue);\n }\n\n if (nextI && !respondedI.has(info)) {\n handleI(index + 1);\n }\n\n respondedI.set(info, 1);\n }),\n );\n };\n\n const info = I<Last<T>>((g) => {\n theOwner = g;\n });\n\n info.executed(() => {\n handleI(0);\n });\n\n return info;\n};\n","import { Owner } from \"../Owner/Owner\";\nimport { Information } from \"./Information\";\n\n/**\n * Information to which a function is applied in order\n * to control the value passing process\n * https://silentium-lab.github.io/silentium/#/en/information/applied\n */\nexport const executorApplied = <T>(\n base: Information<T>,\n applier: (executor: Owner<T>) => Owner<T>,\n) => {\n const i = new Information<T>((g) => {\n base.value(applier(g));\n });\n i.subInfo(base);\n\n return i;\n};\n","import { O } from \"../Owner/Owner\";\nimport { I, Information } from \"./Information\";\n\n/**\n * Information to which the function was applied to change the value\n * https://silentium-lab.github.io/silentium/#/en/information/applied\n */\nexport const applied = <T, R>(base: Information<T>, applier: (v: T) => R) => {\n const info = I((g) => {\n base.value(\n O((v) => {\n g.give(applier(v));\n }),\n );\n });\n info.subInfo(base);\n\n return info;\n};\n","import { O } from \"../Owner/Owner\";\nimport { Information } from \"./Information\";\n\n/**\n * Information whose value is being validated\n * via a predicate; if the predicate returns true, the value\n * can be passed to the output\n * https://silentium-lab.github.io/silentium/#/en/information/filtered\n */\nexport const filtered = <T>(\n base: Information<T>,\n predicate: (v: T) => boolean,\n defaultValue?: T,\n) => {\n return new Information<T>((g) => {\n base.value(\n O((v) => {\n if (predicate(v)) {\n g.give(v);\n } else if (defaultValue !== undefined) {\n g.give(defaultValue);\n }\n }),\n );\n }).subInfo(base);\n};\n","import { Owner } from \"./Owner\";\n\n/**\n * Owner to which a function is applied that modifies the incoming\n * value it receives\n * https://silentium-lab.github.io/silentium/#/en/owner/applied\n */\nexport const ownerApplied = <T, R>(\n base: Owner<R>,\n applier: (value: T) => R,\n) => {\n return new Owner<T>(\n (v) => {\n base.give(applier(v));\n },\n (cause) => {\n base.error(cause);\n },\n () => base.disposed(),\n );\n};\n","import { Owner } from \"./Owner\";\n\n/**\n * Owner to which the function is applied that\n * controls the conditions for passing the value\n * https://silentium-lab.github.io/silentium/#/en/owner/executor-applied\n */\nexport const ownerExecutorApplied = <T>(\n base: Owner<T>,\n applier: (ge: (v: T) => void) => (v: T) => void,\n) => {\n const executor = applier((v) => base.give(v));\n return new Owner<T>((v) => {\n executor(v);\n });\n};\n","import { Information } from \"../Information\";\nimport { O } from \".\";\n\nexport interface InfoSync<T> {\n syncValue(): T;\n filled(): boolean;\n}\n\n/**\n * Owner that can return a synchronous value\n * from the information passed to it. If there is no value and no\n * defaultValue, an error will occur\n * https://silentium-lab.github.io/silentium/#/en/owner/sync\n */\nexport const ownerSync = <T>(\n base: Information<T>,\n defaultValue?: T,\n): InfoSync<T> => {\n let lastValue: T | undefined;\n\n base.value(\n O((v) => {\n lastValue = v;\n }),\n );\n\n return {\n syncValue() {\n if (lastValue === undefined && defaultValue === undefined) {\n throw new Error(\"info sync is empty\");\n }\n return (lastValue ?? defaultValue) as T;\n },\n filled() {\n return lastValue !== undefined;\n },\n };\n};\n","import { O } from \"../Owner\";\nimport { LazyType } from \"../types/LazyType\";\nimport { Information } from \"./Information\";\n\n/**\n * Helps in the process of executing information to create\n * a new information object and also destroy it if\n * destruction information is received\n * https://silentium-lab.github.io/silentium/#/en/information/lazy\n */\nexport const lazyS = <T>(\n lazyI: LazyType<Information<T>>,\n destroyI?: Information<unknown>,\n) => {\n const info = new Information<T>((g) => {\n const instance = lazyI.get();\n info.subInfo(instance);\n instance.value(g);\n });\n\n if (destroyI) {\n info.subInfo(destroyI);\n destroyI.value(\n O(() => {\n info.destroy();\n }),\n );\n }\n\n return info;\n};\n","import { InformationDataType } from \"../types\";\nimport { O } from \"../Owner/Owner\";\nimport { LazyType } from \"../types/LazyType\";\nimport { all } from \"./All\";\nimport { I, Information } from \"./Information\";\n\n/**\n * Component that applies an info object constructor to each data item,\n * producing an information source with new values\n * https://silentium-lab.github.io/silentium/#/en/information/map\n */\nexport const map = <T, TG>(\n base: Information<T[]>,\n targetI: LazyType<Information<TG>>,\n) => {\n const i = new Information<TG[]>((g) => {\n base.value(\n O((v) => {\n const infos: Information<TG>[] = [];\n v.forEach((val) => {\n let valInfo: Information<T> | T = val;\n if (!(valInfo instanceof Information)) {\n valInfo = I(val as InformationDataType<T>);\n }\n const info = targetI.get(valInfo);\n infos.push(info);\n });\n const allI = all(...infos).value(g);\n i.subInfo(allI);\n }),\n );\n });\n i.subInfo(base);\n\n return i;\n};\n","import { Owner } from \"../Owner\";\nimport { Information } from \"./Information\";\nimport { InformationDataType } from \"../types/InformationType\";\n\n/**\n * A component that allows creating linked objects of information and its owner\n * in such a way that if a new value is assigned to the owner, this value\n * will become the value of the linked information source\n * https://silentium-lab.github.io/silentium/#/en/information/of\n */\nexport const of = <T>(incomeI?: InformationDataType<T>) => {\n let sharedValue = incomeI as T;\n let relatedO: Owner<T> | undefined;\n\n const notifyO = () => {\n if (relatedO !== undefined) {\n relatedO.give(sharedValue);\n }\n };\n\n const info = new Information<T>((g) => {\n relatedO = g;\n if (sharedValue !== undefined && sharedValue !== null) {\n notifyO();\n }\n }, \"of\");\n\n return [\n info,\n new Owner<T>((v) => {\n sharedValue = v;\n notifyO();\n }),\n ] as const;\n};\n","import { O } from \"../Owner\";\nimport { Information } from \"./Information\";\n\n/**\n * Limits the number of values from the information source\n * to a single value - once the first value is emitted, no more\n * values are delivered from the source\n * https://silentium-lab.github.io/silentium/#/en/information/once\n */\nexport const once = <T>(base: Information<T>) => {\n const info = new Information<T>((g) => {\n let isFilled = false;\n base.value(\n O((v) => {\n if (!isFilled) {\n isFilled = true;\n g.give(v);\n }\n }),\n );\n });\n info.subInfo(base);\n\n return info;\n};\n","import { Owner } from \"../Owner\";\n\n/**\n * Helps maintain an owner list allowing different\n * owners to get information from a common source\n * https://silentium-lab.github.io/silentium/#/en/utils/owner-pool\n */\nexport class OwnerPool<T> {\n private owners: Set<Owner<T>>;\n private innerOwner: Owner<T>;\n\n public constructor() {\n this.owners = new Set<Owner<T>>();\n this.innerOwner = new Owner(\n (v) => {\n this.owners.forEach((g) => {\n g.give(v);\n });\n },\n (cause) => {\n this.owners.forEach((g) => {\n g.error(cause);\n });\n },\n );\n }\n\n public owner() {\n return this.innerOwner;\n }\n\n public size(): number {\n return this.owners.size;\n }\n\n public has(owner: Owner<T>): boolean {\n return this.owners.has(owner);\n }\n\n public add(shouldBePatron: Owner<T>) {\n this.owners.add(shouldBePatron);\n return this;\n }\n\n public remove(g: Owner<T>) {\n this.owners.delete(g);\n return this;\n }\n\n public destroy() {\n this.owners.forEach((g) => {\n this.remove(g);\n });\n return this;\n }\n}\n","import { Owner } from \"../Owner\";\nimport { Information } from \"./Information\";\nimport { OwnerPool } from \"../utils/OwnerPool\";\n\n/**\n * An information object that helps multiple owners access\n * a single another information object\n * https://silentium-lab.github.io/silentium/#/en/information/pool\n */\nexport const pool = <T>(base: Information<T>) => {\n const ownersPool = new OwnerPool<T>();\n let lastValue: T | undefined;\n\n const i = new Information<T>(\n (g) => {\n if (lastValue !== undefined && !ownersPool.has(g)) {\n g.give(lastValue);\n }\n ownersPool.add(g);\n\n return () => {\n ownersPool.destroy();\n };\n },\n \"pool\",\n false,\n );\n i.subInfo(base);\n\n i.executed(() => {\n const gp = ownersPool.owner();\n base.value(\n new Owner((v) => {\n gp.give(v);\n lastValue = v;\n }),\n );\n });\n\n return [i, ownersPool] as const;\n};\n\nexport const poolStateless = <T>(base: Information<T>) => {\n const ownersPool = new OwnerPool<T>();\n\n const i = new Information<T>(\n (g) => {\n ownersPool.add(g);\n\n return () => {\n ownersPool.destroy();\n };\n },\n \"pool\",\n false,\n );\n i.subInfo(base);\n\n i.executed((g) => {\n ownersPool.add(g);\n base.value(ownersPool.owner());\n });\n\n return [i, ownersPool] as const;\n};\n","import { I, Information } from \"../Information\";\nimport { O } from \"../Owner\";\n\n/**\n * A component that takes one value at a time and returns an array\n * https://silentium-lab.github.io/silentium/#/en/information/sequence\n */\nexport const sequence = <T>(base: Information<T>): Information<T[]> => {\n const i = I<T[]>((o) => {\n const result: T[] = [];\n\n base.value(\n O((v) => {\n result.push(v);\n o.give(result);\n }),\n );\n });\n i.subInfo(base);\n\n return i;\n};\n","import { I, Information } from \"../Information\";\nimport { O } from \"../Owner\";\n\n/**\n * Component that receives a data array and yields values one by one\n * https://silentium-lab.github.io/silentium/#/en/information/stream\n */\nexport const stream = <T>(base: Information<T[]>): Information<T> => {\n const i = I<T>((o) => {\n base.value(\n O((v) => {\n v.forEach((cv) => {\n o.give(cv);\n });\n }),\n );\n });\n\n return i;\n};\n","import { I } from \"../Information\";\n\n/**\n * When receiving a reference to a function expecting a callback, the component\n * creates its own callback, and the data received in this callback\n * will become the value of the information object\n * https://silentium-lab.github.io/silentium/#/en/information/from-callback\n */\nexport const fromCallback = <T>(waitForCb: (cb: (v: T) => any) => unknown) => {\n return I((o) => {\n waitForCb((v) => {\n o.give(v);\n });\n });\n};\n","import { I } from \"../Information\";\n\n/**\n * A component that receives data from an event and\n * presents it as an information object\n * https://silentium-lab.github.io/silentium/#/en/information/from-event\n */\nexport const fromEvent = <T extends []>(\n emitter: any,\n eventName: string,\n subscribeMethod: string,\n unsubscribeMethod?: string,\n) => {\n return I((o) => {\n const handler = (...args: T) => {\n o.give(args);\n };\n emitter[subscribeMethod](eventName, handler);\n return () => {\n if (unsubscribeMethod !== undefined) {\n emitter[unsubscribeMethod](eventName, handler);\n }\n };\n });\n};\n","import { I, Information } from \"../Information/Information\";\n\n/**\n * Component that gets a value from a promise and\n * presents it as information\n * https://silentium-lab.github.io/silentium/#/en/information/from-promise\n */\nexport const fromPromise = <T>(p: Promise<T>): Information<T> => {\n return I((o) => {\n p.then((v) => {\n o.give(v);\n }).catch((e) => {\n o.error(e);\n });\n });\n};\n","import { LazyType } from \"../types/LazyType\";\n\n/**\n * Helps to get lazy instance of dependency\n * @url https://silentium-lab.github.io/silentium/#/utils/lazy\n */\nexport const lazy = <T>(buildingFn: (...args: any[]) => T): LazyType<T> => {\n if (buildingFn === undefined) {\n throw new Error(\"lazy didn't receive buildingFn argument\");\n }\n\n return {\n get<R extends unknown[], CT = null>(...args: R): CT extends null ? T : CT {\n return buildingFn(...args) as CT extends null ? T : CT;\n },\n };\n};\n","import { LazyType } from \"../types/LazyType\";\n\ninterface Constructable<T> {\n new (...args: unknown[]): T;\n}\n\ninterface Prototyped<T> {\n prototype: T;\n}\n\n/**\n * Helps create an object from a class\n * https://silentium-lab.github.io/silentium/#/en/utils/lazy-class\n */\nexport const lazyClass = <T>(\n constructorFn: Prototyped<T>,\n modules: Record<string, unknown> = {},\n): LazyType<T> => {\n if (constructorFn === undefined) {\n throw new Error(\"PrivateClass didn't receive constructorFn argument\");\n }\n\n return {\n get<R extends unknown[], CT = null>(...args: R): CT extends null ? T : CT {\n return new (constructorFn as Constructable<T>)(\n ...args,\n modules,\n ) as CT extends null ? T : CT;\n },\n };\n};\n"],"names":["__publicField","info"],"mappings":";;;;;AAcO,MAAM,YAAA,GAAN,MAAM,YAAqB,CAAA;AAAA,EAQzB,WACG,CAAA,IAAA,EAIA,OAAU,GAAA,SAAA,EACV,eAAe,IACvB,EAAA;AANQ,IAAA,IAAA,CAAA,IAAA,GAAA,IAAA;AAIA,IAAA,IAAA,CAAA,OAAA,GAAA,OAAA;AACA,IAAA,IAAA,CAAA,YAAA,GAAA,YAAA;AAZV,IAAAA,eAAA,CAAA,IAAA,EAAQ,eAAsC,EAAC,CAAA;AAC/C,IAAQA,eAAA,CAAA,IAAA,EAAA,YAAA,CAAA;AACR,IAAQA,eAAA,CAAA,IAAA,EAAA,OAAA,CAAA;AACR,IAAQA,eAAA,CAAA,IAAA,EAAA,aAAA,CAAA;AACR,IAAAA,eAAA,CAAA,IAAA,EAAQ,iBAAkB,EAAA,KAAA,CAAA;AAUxB,IAAA,YAAA,CAAY,SAAa,IAAA,CAAA;AAAA;AAC3B;AAAA;AAAA;AAAA,EAKQ,KAAK,KAAU,EAAA;AACrB,IAAI,IAAA,IAAA,CAAK,UAAU,MAAW,EAAA;AAC5B,MAAK,IAAA,CAAA,KAAA,CAAM,KAAK,KAAK,CAAA;AAAA;AAEvB,IAAO,OAAA,IAAA;AAAA;AACT;AAAA;AAAA;AAAA,EAKO,MAAM,KAAiB,EAAA;AAC5B,IAAA,IAAI,IAAK,CAAA,YAAA,IAAgB,IAAK,CAAA,KAAA,KAAU,MAAW,EAAA;AACjD,MAAA,MAAM,IAA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AAA,IAAI,kBAAkB,MAAW,EAAA;AAC/B,IAAM,MAAA,IAAI,MAAM,oDAAoD,CAAA;AAAA;AAGtE,EAAO,OAAA;AAAA,IACL,OAAuC,IAAmC,EAAA;AACxE,MAAA,OAAO,IAAK,aAAA;AAAA,QACV,GAAG,IAAA;AAAA,QACH;AAAA,OACF;AAAA;AACF,GACF;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/silentium.d.ts
CHANGED
|
@@ -157,8 +157,9 @@ declare const ownerApplied: <T, R>(base: Owner<R>, applier: (value: T) => R) =>
|
|
|
157
157
|
*/
|
|
158
158
|
declare const ownerExecutorApplied: <T>(base: Owner<T>, applier: (ge: (v: T) => void) => (v: T) => void) => Owner<T>;
|
|
159
159
|
|
|
160
|
-
interface
|
|
160
|
+
interface InfoSync<T> {
|
|
161
161
|
syncValue(): T;
|
|
162
|
+
filled(): boolean;
|
|
162
163
|
}
|
|
163
164
|
/**
|
|
164
165
|
* Owner that can return a synchronous value
|
|
@@ -166,7 +167,7 @@ interface infoSync<T> {
|
|
|
166
167
|
* defaultValue, an error will occur
|
|
167
168
|
* https://silentium-lab.github.io/silentium/#/en/owner/sync
|
|
168
169
|
*/
|
|
169
|
-
declare const ownerSync: <T>(base: Information<T>, defaultValue?: T) =>
|
|
170
|
+
declare const ownerSync: <T>(base: Information<T>, defaultValue?: T) => InfoSync<T>;
|
|
170
171
|
|
|
171
172
|
/**
|
|
172
173
|
* A component that allows creating linked objects of information and its owner
|
|
@@ -258,4 +259,4 @@ interface Prototyped<T> {
|
|
|
258
259
|
*/
|
|
259
260
|
declare const lazyClass: <T>(constructorFn: Prototyped<T>, modules?: Record<string, unknown>) => LazyType<T>;
|
|
260
261
|
|
|
261
|
-
export { type ExtractTypesFromArray, type ExtractTypesFromArrayS, I, Information, type InformationDataType, type InformationExecutorType, type InformationObjectType, type InformationType, type LazyType, O, Owner, type OwnerExecutorType, type OwnerObjectType, OwnerPool, type OwnerType, all, any, applied, chain, executorApplied, filtered, fromCallback, fromEvent, fromPromise,
|
|
262
|
+
export { type ExtractTypesFromArray, type ExtractTypesFromArrayS, I, type InfoSync, Information, type InformationDataType, type InformationExecutorType, type InformationObjectType, type InformationType, type LazyType, O, Owner, type OwnerExecutorType, type OwnerObjectType, OwnerPool, type OwnerType, all, any, applied, chain, executorApplied, filtered, fromCallback, fromEvent, fromPromise, lazy, lazyClass, lazyS, map, of, once, ownerApplied, ownerExecutorApplied, ownerSync, pool, poolStateless, sequence, stream };
|
package/dist/silentium.js
CHANGED
package/dist/silentium.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"silentium.js","sources":["../src/Information/Information.ts","../src/Owner/Owner.ts","../src/Information/All.ts","../src/Information/Any.ts","../src/Information/Chain.ts","../src/Information/ExecutorApplied.ts","../src/Information/Applied.ts","../src/Information/Filtered.ts","../src/Owner/OwnerApplied.ts","../src/Owner/OwnerExecutorApplied.ts","../src/Owner/OwnerSync.ts","../src/Information/Lazy.ts","../src/Information/Map.ts","../src/Information/Of.ts","../src/Information/Once.ts","../src/utils/OwnerPool.ts","../src/Information/Pool.ts","../src/Information/Sequence.ts","../src/Information/Stream.ts","../src/Information/FromCallback.ts","../src/Information/FromEvent.ts","../src/Information/FromPromise.ts","../src/utils/Lazy.ts","../src/utils/LazyClass.ts"],"sourcesContent":["import { Owner } from \"../Owner/Owner\";\nimport { InformationDataType } from \"../types/InformationType\";\n\ntype InfoExecutorType<T> = (g: Owner<T>) => (() => void | undefined) | void;\ntype InfoObjectType<T> = {\n value: InfoExecutorType<T>;\n};\n\ntype InformationExecutedCb<T> = (g: Owner<T>) => void;\n\n/**\n * Main information representation\n * https://silentium-lab.github.io/silentium/#/en/information\n */\nexport class Information<T = any> {\n private static instances = 0;\n private theSubInfos: Information<unknown>[] = [];\n private destructor?: () => void;\n private owner?: Owner<T>;\n private executedCbs?: InformationExecutedCb<T>[];\n private alreadyExecuted = false;\n\n public constructor(\n private info?:\n | InfoObjectType<T>\n | InfoExecutorType<T>\n | InformationDataType<T>,\n private theName = \"unknown\",\n private onlyOneOwner = true,\n ) {\n Information.instances += 1;\n }\n\n /**\n * Следующее значение источника\n */\n private next(value: T) {\n if (this.owner !== undefined) {\n this.owner.give(value);\n }\n return this;\n }\n\n /**\n * Возможность гостю получить информацию от источника\n */\n public value(owner: Owner<T>) {\n if (this.onlyOneOwner && this.owner !== undefined) {\n throw new Error(`owner already connected to info ${this.name()}`);\n }\n\n this.owner = owner;\n if (this.executedCbs !== undefined && !this.alreadyExecuted) {\n this.executedCbs.forEach((cb) => cb(owner));\n this.alreadyExecuted = true;\n }\n\n if (this.info === undefined) {\n return this;\n }\n\n if (typeof this.info === \"function\") {\n const mbDestructor = this.info(owner);\n if (\n this.destructor === undefined &&\n mbDestructor !== undefined &&\n this.info !== mbDestructor &&\n typeof mbDestructor === \"function\"\n ) {\n this.destructor = mbDestructor as () => void;\n }\n } else if (\n typeof this.info === \"object\" &&\n this.info !== null &&\n \"value\" in this.info &&\n typeof this.info.value === \"function\"\n ) {\n this.info.value(owner);\n } else {\n this.next(this.info as T);\n }\n\n return this;\n }\n\n /**\n * Ability to destroy the information info\n */\n public destroy() {\n while (this.theSubInfos.length > 0) {\n const subInfo = this.theSubInfos.shift();\n subInfo?.destroy();\n }\n if (this.destructor) {\n this.destructor();\n }\n this.owner = undefined;\n this.executedCbs = undefined;\n this.destructor = undefined;\n return this;\n }\n\n /**\n * The ability to link another info to the current info\n */\n public subInfo(info: Information<any>) {\n this.theSubInfos.push(info);\n return this;\n }\n\n public subInfos() {\n return this.theSubInfos;\n }\n\n public name() {\n return `#info_${this.theName}_${Information.instances}`;\n }\n\n public executed(cb: InformationExecutedCb<T>) {\n if (!this.executedCbs) {\n this.executedCbs = [];\n }\n this.executedCbs.push(cb);\n if (this.alreadyExecuted && this.owner !== undefined) {\n cb(this.owner);\n }\n return this;\n }\n\n public hasOwner(): boolean {\n return !!this.owner;\n }\n}\n\nexport const I = <T>(\n info?: InfoObjectType<T> | InfoExecutorType<T> | InformationDataType<T>,\n theName = \"unknown\",\n onlyOneOwner = true,\n) => new Information(info, theName, onlyOneOwner);\n","import { OwnerExecutorType } from \"../types/OwnerType\";\n\n/**\n * Information owner, if information\n * has owner than information executed\n * https://silentium-lab.github.io/silentium/#/en/owner\n */\nexport class Owner<T = any> {\n public constructor(\n private ownerFn: OwnerExecutorType<T>,\n private errorFn?: (cause: unknown) => void,\n private disposedFn?: () => boolean,\n ) {}\n\n public give(value: T) {\n if (!this.disposed()) {\n this.ownerFn(value);\n }\n return this;\n }\n\n public error(cause: unknown) {\n if (this.errorFn !== undefined) {\n this.errorFn(cause);\n }\n\n return this;\n }\n\n public disposed() {\n return this.disposedFn !== undefined ? this.disposedFn() : false;\n }\n}\n\nexport const O = <T>(ownerFn: OwnerExecutorType<T>) => new Owner(ownerFn);\n","import { Owner } from \"../Owner/Owner\";\nimport { InformationType } from \"../types/InformationType\";\nimport { Information } from \"./Information\";\n\ntype ExtractType<T> = T extends InformationType<infer U> ? U : never;\ntype ExtractTypeS<T> = T extends Information<infer U> ? U : never;\n\nexport type ExtractTypesFromArray<T extends InformationType<any>[]> = {\n [K in keyof T]: ExtractType<T[K]>;\n};\n\nexport type ExtractTypesFromArrayS<T extends Information<any>[]> = {\n [K in keyof T]: ExtractTypeS<T[K]>;\n};\n\n/**\n * Combines multiple information sources into a single unified source\n * represented as an array containing values from all sources\n * https://silentium-lab.github.io/silentium/#/en/information/all\n */\nexport const all = <const T extends Information[]>(...infos: T) => {\n const i = new Information<ExtractTypesFromArrayS<T>>((g) => {\n const keysKnown = new Set<string>(Object.keys(infos));\n const keysFilled = new Set();\n const isAllFilled = () => {\n return keysFilled.size > 0 && keysFilled.size === keysKnown.size;\n };\n const result: Record<string, unknown> = {};\n\n Object.entries(infos).forEach(([key, info]) => {\n i.subInfo(info);\n keysKnown.add(key);\n info.value(\n new Owner((v) => {\n keysFilled.add(key);\n result[key] = v;\n if (isAllFilled()) {\n g.give(Object.values(result) as ExtractTypesFromArrayS<T>);\n }\n }),\n );\n });\n });\n\n return i;\n};\n","import { I, Information } from \"./Information\";\n\n/**\n * From a set of information sources we get\n * a common response from any source for a single owner\n * https://silentium-lab.github.io/silentium/#/en/information/any\n */\nexport const any = <T>(...infos: Information<T>[]) => {\n const info = I((g) => {\n infos.forEach((info) => {\n info.value(g);\n info.subInfo(info);\n });\n });\n\n return info;\n};\n","import { O, Owner } from \"../Owner/Owner\";\nimport { I, Information } from \"./Information\";\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\ntype Last<T extends any[]> = T extends [...infer U, infer L] ? L : never;\n\n/**\n * The set of information sources forms a sequential chain where each source provides\n * an answer. The final answer will be the output result. If any source in the chain\n * provides a new answer, the component's overall response will be repeated.\n * https://silentium-lab.github.io/silentium/#/en/information/applied\n */\nexport const chain = <T extends Information[]>(\n ...infos: T\n): Information<Last<T>> => {\n let theOwner: Owner<Last<T>> | undefined;\n let lastValue: Last<T> | undefined;\n const respondedI = new WeakMap();\n\n const handleI = (index: number) => {\n const info = infos[index];\n const nextI = infos[index + 1];\n\n info.value(\n O((v) => {\n if (!nextI) {\n lastValue = v;\n theOwner?.give(v);\n }\n\n if (nextI && lastValue !== undefined && theOwner !== undefined) {\n theOwner.give(lastValue);\n }\n\n if (nextI && !respondedI.has(info)) {\n handleI(index + 1);\n }\n\n respondedI.set(info, 1);\n }),\n );\n };\n\n const info = I<Last<T>>((g) => {\n theOwner = g;\n });\n\n info.executed(() => {\n handleI(0);\n });\n\n return info;\n};\n","import { Owner } from \"../Owner/Owner\";\nimport { Information } from \"./Information\";\n\n/**\n * Information to which a function is applied in order\n * to control the value passing process\n * https://silentium-lab.github.io/silentium/#/en/information/applied\n */\nexport const executorApplied = <T>(\n base: Information<T>,\n applier: (executor: Owner<T>) => Owner<T>,\n) => {\n const i = new Information<T>((g) => {\n base.value(applier(g));\n });\n i.subInfo(base);\n\n return i;\n};\n","import { O } from \"../Owner/Owner\";\nimport { I, Information } from \"./Information\";\n\n/**\n * Information to which the function was applied to change the value\n * https://silentium-lab.github.io/silentium/#/en/information/applied\n */\nexport const applied = <T, R>(base: Information<T>, applier: (v: T) => R) => {\n const info = I((g) => {\n base.value(\n O((v) => {\n g.give(applier(v));\n }),\n );\n });\n info.subInfo(base);\n\n return info;\n};\n","import { O } from \"../Owner/Owner\";\nimport { Information } from \"./Information\";\n\n/**\n * Information whose value is being validated\n * via a predicate; if the predicate returns true, the value\n * can be passed to the output\n * https://silentium-lab.github.io/silentium/#/en/information/filtered\n */\nexport const filtered = <T>(\n base: Information<T>,\n predicate: (v: T) => boolean,\n defaultValue?: T,\n) => {\n return new Information<T>((g) => {\n base.value(\n O((v) => {\n if (predicate(v)) {\n g.give(v);\n } else if (defaultValue !== undefined) {\n g.give(defaultValue);\n }\n }),\n );\n }).subInfo(base);\n};\n","import { Owner } from \"./Owner\";\n\n/**\n * Owner to which a function is applied that modifies the incoming\n * value it receives\n * https://silentium-lab.github.io/silentium/#/en/owner/applied\n */\nexport const ownerApplied = <T, R>(\n base: Owner<R>,\n applier: (value: T) => R,\n) => {\n return new Owner<T>(\n (v) => {\n base.give(applier(v));\n },\n (cause) => {\n base.error(cause);\n },\n () => base.disposed(),\n );\n};\n","import { Owner } from \"./Owner\";\n\n/**\n * Owner to which the function is applied that\n * controls the conditions for passing the value\n * https://silentium-lab.github.io/silentium/#/en/owner/executor-applied\n */\nexport const ownerExecutorApplied = <T>(\n base: Owner<T>,\n applier: (ge: (v: T) => void) => (v: T) => void,\n) => {\n const executor = applier((v) => base.give(v));\n return new Owner<T>((v) => {\n executor(v);\n });\n};\n","import { Information } from \"../Information\";\nimport { O } from \".\";\n\nexport interface infoSync<T> {\n syncValue(): T;\n}\n\n/**\n * Owner that can return a synchronous value\n * from the information passed to it. If there is no value and no\n * defaultValue, an error will occur\n * https://silentium-lab.github.io/silentium/#/en/owner/sync\n */\nexport const ownerSync = <T>(\n base: Information<T>,\n defaultValue?: T,\n): infoSync<T> => {\n let lastValue: T | undefined;\n\n base.value(\n O((v) => {\n lastValue = v;\n }),\n );\n\n return {\n syncValue() {\n if (lastValue === undefined && defaultValue === undefined) {\n throw new Error(\"info sync is empty\");\n }\n return (lastValue ?? defaultValue) as T;\n },\n };\n};\n","import { O } from \"../Owner\";\nimport { LazyType } from \"../types/LazyType\";\nimport { Information } from \"./Information\";\n\n/**\n * Helps in the process of executing information to create\n * a new information object and also destroy it if\n * destruction information is received\n * https://silentium-lab.github.io/silentium/#/en/information/lazy\n */\nexport const lazyS = <T>(\n lazyI: LazyType<Information<T>>,\n destroyI?: Information<unknown>,\n) => {\n const info = new Information<T>((g) => {\n const instance = lazyI.get();\n info.subInfo(instance);\n instance.value(g);\n });\n\n if (destroyI) {\n info.subInfo(destroyI);\n destroyI.value(\n O(() => {\n info.destroy();\n }),\n );\n }\n\n return info;\n};\n","import { InformationDataType } from \"../types\";\nimport { O } from \"../Owner/Owner\";\nimport { LazyType } from \"../types/LazyType\";\nimport { all } from \"./All\";\nimport { I, Information } from \"./Information\";\n\n/**\n * Component that applies an info object constructor to each data item,\n * producing an information source with new values\n * https://silentium-lab.github.io/silentium/#/en/information/map\n */\nexport const map = <T, TG>(\n base: Information<T[]>,\n targetI: LazyType<Information<TG>>,\n) => {\n const i = new Information<TG[]>((g) => {\n base.value(\n O((v) => {\n const infos: Information<TG>[] = [];\n v.forEach((val) => {\n let valInfo: Information<T> | T = val;\n if (!(valInfo instanceof Information)) {\n valInfo = I(val as InformationDataType<T>);\n }\n const info = targetI.get(valInfo);\n infos.push(info);\n });\n const allI = all(...infos).value(g);\n i.subInfo(allI);\n }),\n );\n });\n i.subInfo(base);\n\n return i;\n};\n","import { Owner } from \"../Owner\";\nimport { Information } from \"./Information\";\nimport { InformationDataType } from \"../types/InformationType\";\n\n/**\n * A component that allows creating linked objects of information and its owner\n * in such a way that if a new value is assigned to the owner, this value\n * will become the value of the linked information source\n * https://silentium-lab.github.io/silentium/#/en/information/of\n */\nexport const of = <T>(incomeI?: InformationDataType<T>) => {\n let sharedValue = incomeI as T;\n let relatedO: Owner<T> | undefined;\n\n const notifyO = () => {\n if (relatedO !== undefined) {\n relatedO.give(sharedValue);\n }\n };\n\n const info = new Information<T>((g) => {\n relatedO = g;\n if (sharedValue !== undefined && sharedValue !== null) {\n notifyO();\n }\n }, \"of\");\n\n return [\n info,\n new Owner<T>((v) => {\n sharedValue = v;\n notifyO();\n }),\n ] as const;\n};\n","import { O } from \"../Owner\";\nimport { Information } from \"./Information\";\n\n/**\n * Limits the number of values from the information source\n * to a single value - once the first value is emitted, no more\n * values are delivered from the source\n * https://silentium-lab.github.io/silentium/#/en/information/once\n */\nexport const once = <T>(base: Information<T>) => {\n const info = new Information<T>((g) => {\n let isFilled = false;\n base.value(\n O((v) => {\n if (!isFilled) {\n isFilled = true;\n g.give(v);\n }\n }),\n );\n });\n info.subInfo(base);\n\n return info;\n};\n","import { Owner } from \"../Owner\";\n\n/**\n * Helps maintain an owner list allowing different\n * owners to get information from a common source\n * https://silentium-lab.github.io/silentium/#/en/utils/owner-pool\n */\nexport class OwnerPool<T> {\n private owners: Set<Owner<T>>;\n private innerOwner: Owner<T>;\n\n public constructor() {\n this.owners = new Set<Owner<T>>();\n this.innerOwner = new Owner(\n (v) => {\n this.owners.forEach((g) => {\n g.give(v);\n });\n },\n (cause) => {\n this.owners.forEach((g) => {\n g.error(cause);\n });\n },\n );\n }\n\n public owner() {\n return this.innerOwner;\n }\n\n public size(): number {\n return this.owners.size;\n }\n\n public has(owner: Owner<T>): boolean {\n return this.owners.has(owner);\n }\n\n public add(shouldBePatron: Owner<T>) {\n this.owners.add(shouldBePatron);\n return this;\n }\n\n public remove(g: Owner<T>) {\n this.owners.delete(g);\n return this;\n }\n\n public destroy() {\n this.owners.forEach((g) => {\n this.remove(g);\n });\n return this;\n }\n}\n","import { Owner } from \"../Owner\";\nimport { Information } from \"./Information\";\nimport { OwnerPool } from \"../utils/OwnerPool\";\n\n/**\n * An information object that helps multiple owners access\n * a single another information object\n * https://silentium-lab.github.io/silentium/#/en/information/pool\n */\nexport const pool = <T>(base: Information<T>) => {\n const ownersPool = new OwnerPool<T>();\n let lastValue: T | undefined;\n\n const i = new Information<T>(\n (g) => {\n if (lastValue !== undefined && !ownersPool.has(g)) {\n g.give(lastValue);\n }\n ownersPool.add(g);\n\n return () => {\n ownersPool.destroy();\n };\n },\n \"pool\",\n false,\n );\n i.subInfo(base);\n\n i.executed(() => {\n const gp = ownersPool.owner();\n base.value(\n new Owner((v) => {\n gp.give(v);\n lastValue = v;\n }),\n );\n });\n\n return [i, ownersPool] as const;\n};\n\nexport const poolStateless = <T>(base: Information<T>) => {\n const ownersPool = new OwnerPool<T>();\n\n const i = new Information<T>(\n (g) => {\n ownersPool.add(g);\n\n return () => {\n ownersPool.destroy();\n };\n },\n \"pool\",\n false,\n );\n i.subInfo(base);\n\n i.executed((g) => {\n ownersPool.add(g);\n base.value(ownersPool.owner());\n });\n\n return [i, ownersPool] as const;\n};\n","import { I, Information } from \"../Information\";\nimport { O } from \"../Owner\";\n\n/**\n * A component that takes one value at a time and returns an array\n * https://silentium-lab.github.io/silentium/#/en/information/sequence\n */\nexport const sequence = <T>(base: Information<T>): Information<T[]> => {\n const i = I<T[]>((o) => {\n const result: T[] = [];\n\n base.value(\n O((v) => {\n result.push(v);\n o.give(result);\n }),\n );\n });\n i.subInfo(base);\n\n return i;\n};\n","import { I, Information } from \"../Information\";\nimport { O } from \"../Owner\";\n\n/**\n * Component that receives a data array and yields values one by one\n * https://silentium-lab.github.io/silentium/#/en/information/stream\n */\nexport const stream = <T>(base: Information<T[]>): Information<T> => {\n const i = I<T>((o) => {\n base.value(\n O((v) => {\n v.forEach((cv) => {\n o.give(cv);\n });\n }),\n );\n });\n\n return i;\n};\n","import { I } from \"../Information\";\n\n/**\n * When receiving a reference to a function expecting a callback, the component\n * creates its own callback, and the data received in this callback\n * will become the value of the information object\n * https://silentium-lab.github.io/silentium/#/en/information/from-callback\n */\nexport const fromCallback = <T>(waitForCb: (cb: (v: T) => any) => unknown) => {\n return I((o) => {\n waitForCb((v) => {\n o.give(v);\n });\n });\n};\n","import { I } from \"../Information\";\n\n/**\n * A component that receives data from an event and\n * presents it as an information object\n * https://silentium-lab.github.io/silentium/#/en/information/from-event\n */\nexport const fromEvent = <T extends []>(\n emitter: any,\n eventName: string,\n subscribeMethod: string,\n unsubscribeMethod?: string,\n) => {\n return I((o) => {\n const handler = (...args: T) => {\n o.give(args);\n };\n emitter[subscribeMethod](eventName, handler);\n return () => {\n if (unsubscribeMethod !== undefined) {\n emitter[unsubscribeMethod](eventName, handler);\n }\n };\n });\n};\n","import { I, Information } from \"../Information/Information\";\n\n/**\n * Component that gets a value from a promise and\n * presents it as information\n * https://silentium-lab.github.io/silentium/#/en/information/from-promise\n */\nexport const fromPromise = <T>(p: Promise<T>): Information<T> => {\n return I((o) => {\n p.then((v) => {\n o.give(v);\n }).catch((e) => {\n o.error(e);\n });\n });\n};\n","import { LazyType } from \"../types/LazyType\";\n\n/**\n * Helps to get lazy instance of dependency\n * @url https://silentium-lab.github.io/silentium/#/utils/lazy\n */\nexport const lazy = <T>(buildingFn: (...args: any[]) => T): LazyType<T> => {\n if (buildingFn === undefined) {\n throw new Error(\"lazy didn't receive buildingFn argument\");\n }\n\n return {\n get<R extends unknown[], CT = null>(...args: R): CT extends null ? T : CT {\n return buildingFn(...args) as CT extends null ? T : CT;\n },\n };\n};\n","import { LazyType } from \"../types/LazyType\";\n\ninterface Constructable<T> {\n new (...args: unknown[]): T;\n}\n\ninterface Prototyped<T> {\n prototype: T;\n}\n\n/**\n * Helps create an object from a class\n * https://silentium-lab.github.io/silentium/#/en/utils/lazy-class\n */\nexport const lazyClass = <T>(\n constructorFn: Prototyped<T>,\n modules: Record<string, unknown> = {},\n): LazyType<T> => {\n if (constructorFn === undefined) {\n throw new Error(\"PrivateClass didn't receive constructorFn argument\");\n }\n\n return {\n get<R extends unknown[], CT = null>(...args: R): CT extends null ? T : CT {\n return new (constructorFn as Constructable<T>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AI,CAAA;AAAA,KACb;AACA,IAAQ,OAAA,CAAA,eAAe,CAAE,CAAA,SAAA,EAAW,OAAO,CAAA;AAC3C,IAAA,OAAO,MAAM;AACX,MAAA,IAAI,sBAAsB,MAAW,EAAA;AACnC,QAAQ,OAAA,CAAA,iBAAiB,CAAE,CAAA,SAAA,EAAW,OAAO,CAAA;AAAA;AAC/C,KACF;AAAA,GACD,CAAA;AACH;;ACjBa,MAAA,WAAA,GAAc,CAAI,CAAkC,KAAA;AAC/D,EAAO,OAAA,CAAA,CAAE,CAAC,CAAM,KAAA;AACd,IAAE,CAAA,CAAA,IAAA,CAAK,CAAC,CAAM,KAAA;AACZ,MAAA,CAAA,CAAE,KAAK,CAAC,CAAA;AAAA,KACT,CAAA,CAAE,KAAM,CAAA,CAAC,CAAM,KAAA;AACd,MAAA,CAAA,CAAE,MAAM,CAAC,CAAA;AAAA,KACV,CAAA;AAAA,GACF,CAAA;AACH;;ACTa,MAAA,IAAA,GAAO,CAAI,UAAmD,KAAA;AACzE,EAAA,IAAI,eAAe,MAAW,EAAA;AAC5B,IAAM,MAAA,IAAI,MAAM,yCAAyC,CAAA;AAAA;AAG3D,EAAO,OAAA;AAAA,IACL,OAAuC,IAAmC,EAAA;AACxE,MAAO,OAAA,UAAA,CAAW,GAAG,IAAI,CAAA;AAAA;AAC3B,GACF;AACF;;ACFO,MAAM,SAAY,GAAA,CACvB,aACA,EAAA,OAAA,GAAmC,EACnB,KAAA;AAChB,EAAA,IAAI,kBAAkB,MAAW,EAAA;AAC/B,IAAM,MAAA,IAAI,MAAM,oDAAoD,CAAA;AAAA;AAGtE,EAAO,OAAA;AAAA,IACL,OAAuC,IAAmC,EAAA;AACxE,MAAA,OAAO,IAAK,aAAA;AAAA,QACV,GAAG,IAAA;AAAA,QACH;AAAA,OACF;AAAA;AACF,GACF;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"silentium.js","sources":["../src/Information/Information.ts","../src/Owner/Owner.ts","../src/Information/All.ts","../src/Information/Any.ts","../src/Information/Chain.ts","../src/Information/ExecutorApplied.ts","../src/Information/Applied.ts","../src/Information/Filtered.ts","../src/Owner/OwnerApplied.ts","../src/Owner/OwnerExecutorApplied.ts","../src/Owner/OwnerSync.ts","../src/Information/Lazy.ts","../src/Information/Map.ts","../src/Information/Of.ts","../src/Information/Once.ts","../src/utils/OwnerPool.ts","../src/Information/Pool.ts","../src/Information/Sequence.ts","../src/Information/Stream.ts","../src/Information/FromCallback.ts","../src/Information/FromEvent.ts","../src/Information/FromPromise.ts","../src/utils/Lazy.ts","../src/utils/LazyClass.ts"],"sourcesContent":["import { Owner } from \"../Owner/Owner\";\nimport { InformationDataType } from \"../types/InformationType\";\n\ntype InfoExecutorType<T> = (g: Owner<T>) => (() => void | undefined) | void;\ntype InfoObjectType<T> = {\n value: InfoExecutorType<T>;\n};\n\ntype InformationExecutedCb<T> = (g: Owner<T>) => void;\n\n/**\n * Main information representation\n * https://silentium-lab.github.io/silentium/#/en/information\n */\nexport class Information<T = any> {\n private static instances = 0;\n private theSubInfos: Information<unknown>[] = [];\n private destructor?: () => void;\n private owner?: Owner<T>;\n private executedCbs?: InformationExecutedCb<T>[];\n private alreadyExecuted = false;\n\n public constructor(\n private info?:\n | InfoObjectType<T>\n | InfoExecutorType<T>\n | InformationDataType<T>,\n private theName = \"unknown\",\n private onlyOneOwner = true,\n ) {\n Information.instances += 1;\n }\n\n /**\n * Следующее значение источника\n */\n private next(value: T) {\n if (this.owner !== undefined) {\n this.owner.give(value);\n }\n return this;\n }\n\n /**\n * Возможность гостю получить информацию от источника\n */\n public value(owner: Owner<T>) {\n if (this.onlyOneOwner && this.owner !== undefined) {\n throw new Error(`owner already connected to info ${this.name()}`);\n }\n\n this.owner = owner;\n if (this.executedCbs !== undefined && !this.alreadyExecuted) {\n this.executedCbs.forEach((cb) => cb(owner));\n this.alreadyExecuted = true;\n }\n\n if (this.info === undefined) {\n return this;\n }\n\n if (typeof this.info === \"function\") {\n const mbDestructor = this.info(owner);\n if (\n this.destructor === undefined &&\n mbDestructor !== undefined &&\n this.info !== mbDestructor &&\n typeof mbDestructor === \"function\"\n ) {\n this.destructor = mbDestructor as () => void;\n }\n } else if (\n typeof this.info === \"object\" &&\n this.info !== null &&\n \"value\" in this.info &&\n typeof this.info.value === \"function\"\n ) {\n this.info.value(owner);\n } else {\n this.next(this.info as T);\n }\n\n return this;\n }\n\n /**\n * Ability to destroy the information info\n */\n public destroy() {\n while (this.theSubInfos.length > 0) {\n const subInfo = this.theSubInfos.shift();\n subInfo?.destroy();\n }\n if (this.destructor) {\n this.destructor();\n }\n this.owner = undefined;\n this.executedCbs = undefined;\n this.destructor = undefined;\n return this;\n }\n\n /**\n * The ability to link another info to the current info\n */\n public subInfo(info: Information<any>) {\n this.theSubInfos.push(info);\n return this;\n }\n\n public subInfos() {\n return this.theSubInfos;\n }\n\n public name() {\n return `#info_${this.theName}_${Information.instances}`;\n }\n\n public executed(cb: InformationExecutedCb<T>) {\n if (!this.executedCbs) {\n this.executedCbs = [];\n }\n this.executedCbs.push(cb);\n if (this.alreadyExecuted && this.owner !== undefined) {\n cb(this.owner);\n }\n return this;\n }\n\n public hasOwner(): boolean {\n return !!this.owner;\n }\n}\n\nexport const I = <T>(\n info?: InfoObjectType<T> | InfoExecutorType<T> | InformationDataType<T>,\n theName = \"unknown\",\n onlyOneOwner = true,\n) => new Information(info, theName, onlyOneOwner);\n","import { OwnerExecutorType } from \"../types/OwnerType\";\n\n/**\n * Information owner, if information\n * has owner than information executed\n * https://silentium-lab.github.io/silentium/#/en/owner\n */\nexport class Owner<T = any> {\n public constructor(\n private ownerFn: OwnerExecutorType<T>,\n private errorFn?: (cause: unknown) => void,\n private disposedFn?: () => boolean,\n ) {}\n\n public give(value: T) {\n if (!this.disposed()) {\n this.ownerFn(value);\n }\n return this;\n }\n\n public error(cause: unknown) {\n if (this.errorFn !== undefined) {\n this.errorFn(cause);\n }\n\n return this;\n }\n\n public disposed() {\n return this.disposedFn !== undefined ? this.disposedFn() : false;\n }\n}\n\nexport const O = <T>(ownerFn: OwnerExecutorType<T>) => new Owner(ownerFn);\n","import { Owner } from \"../Owner/Owner\";\nimport { InformationType } from \"../types/InformationType\";\nimport { Information } from \"./Information\";\n\ntype ExtractType<T> = T extends InformationType<infer U> ? U : never;\ntype ExtractTypeS<T> = T extends Information<infer U> ? U : never;\n\nexport type ExtractTypesFromArray<T extends InformationType<any>[]> = {\n [K in keyof T]: ExtractType<T[K]>;\n};\n\nexport type ExtractTypesFromArrayS<T extends Information<any>[]> = {\n [K in keyof T]: ExtractTypeS<T[K]>;\n};\n\n/**\n * Combines multiple information sources into a single unified source\n * represented as an array containing values from all sources\n * https://silentium-lab.github.io/silentium/#/en/information/all\n */\nexport const all = <const T extends Information[]>(...infos: T) => {\n const i = new Information<ExtractTypesFromArrayS<T>>((g) => {\n const keysKnown = new Set<string>(Object.keys(infos));\n const keysFilled = new Set();\n const isAllFilled = () => {\n return keysFilled.size > 0 && keysFilled.size === keysKnown.size;\n };\n const result: Record<string, unknown> = {};\n\n Object.entries(infos).forEach(([key, info]) => {\n i.subInfo(info);\n keysKnown.add(key);\n info.value(\n new Owner((v) => {\n keysFilled.add(key);\n result[key] = v;\n if (isAllFilled()) {\n g.give(Object.values(result) as ExtractTypesFromArrayS<T>);\n }\n }),\n );\n });\n });\n\n return i;\n};\n","import { I, Information } from \"./Information\";\n\n/**\n * From a set of information sources we get\n * a common response from any source for a single owner\n * https://silentium-lab.github.io/silentium/#/en/information/any\n */\nexport const any = <T>(...infos: Information<T>[]) => {\n const info = I((g) => {\n infos.forEach((info) => {\n info.value(g);\n info.subInfo(info);\n });\n });\n\n return info;\n};\n","import { O, Owner } from \"../Owner/Owner\";\nimport { I, Information } from \"./Information\";\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\ntype Last<T extends any[]> = T extends [...infer U, infer L] ? L : never;\n\n/**\n * The set of information sources forms a sequential chain where each source provides\n * an answer. The final answer will be the output result. If any source in the chain\n * provides a new answer, the component's overall response will be repeated.\n * https://silentium-lab.github.io/silentium/#/en/information/applied\n */\nexport const chain = <T extends Information[]>(\n ...infos: T\n): Information<Last<T>> => {\n let theOwner: Owner<Last<T>> | undefined;\n let lastValue: Last<T> | undefined;\n const respondedI = new WeakMap();\n\n const handleI = (index: number) => {\n const info = infos[index];\n const nextI = infos[index + 1];\n\n info.value(\n O((v) => {\n if (!nextI) {\n lastValue = v;\n theOwner?.give(v);\n }\n\n if (nextI && lastValue !== undefined && theOwner !== undefined) {\n theOwner.give(lastValue);\n }\n\n if (nextI && !respondedI.has(info)) {\n handleI(index + 1);\n }\n\n respondedI.set(info, 1);\n }),\n );\n };\n\n const info = I<Last<T>>((g) => {\n theOwner = g;\n });\n\n info.executed(() => {\n handleI(0);\n });\n\n return info;\n};\n","import { Owner } from \"../Owner/Owner\";\nimport { Information } from \"./Information\";\n\n/**\n * Information to which a function is applied in order\n * to control the value passing process\n * https://silentium-lab.github.io/silentium/#/en/information/applied\n */\nexport const executorApplied = <T>(\n base: Information<T>,\n applier: (executor: Owner<T>) => Owner<T>,\n) => {\n const i = new Information<T>((g) => {\n base.value(applier(g));\n });\n i.subInfo(base);\n\n return i;\n};\n","import { O } from \"../Owner/Owner\";\nimport { I, Information } from \"./Information\";\n\n/**\n * Information to which the function was applied to change the value\n * https://silentium-lab.github.io/silentium/#/en/information/applied\n */\nexport const applied = <T, R>(base: Information<T>, applier: (v: T) => R) => {\n const info = I((g) => {\n base.value(\n O((v) => {\n g.give(applier(v));\n }),\n );\n });\n info.subInfo(base);\n\n return info;\n};\n","import { O } from \"../Owner/Owner\";\nimport { Information } from \"./Information\";\n\n/**\n * Information whose value is being validated\n * via a predicate; if the predicate returns true, the value\n * can be passed to the output\n * https://silentium-lab.github.io/silentium/#/en/information/filtered\n */\nexport const filtered = <T>(\n base: Information<T>,\n predicate: (v: T) => boolean,\n defaultValue?: T,\n) => {\n return new Information<T>((g) => {\n base.value(\n O((v) => {\n if (predicate(v)) {\n g.give(v);\n } else if (defaultValue !== undefined) {\n g.give(defaultValue);\n }\n }),\n );\n }).subInfo(base);\n};\n","import { Owner } from \"./Owner\";\n\n/**\n * Owner to which a function is applied that modifies the incoming\n * value it receives\n * https://silentium-lab.github.io/silentium/#/en/owner/applied\n */\nexport const ownerApplied = <T, R>(\n base: Owner<R>,\n applier: (value: T) => R,\n) => {\n return new Owner<T>(\n (v) => {\n base.give(applier(v));\n },\n (cause) => {\n base.error(cause);\n },\n () => base.disposed(),\n );\n};\n","import { Owner } from \"./Owner\";\n\n/**\n * Owner to which the function is applied that\n * controls the conditions for passing the value\n * https://silentium-lab.github.io/silentium/#/en/owner/executor-applied\n */\nexport const ownerExecutorApplied = <T>(\n base: Owner<T>,\n applier: (ge: (v: T) => void) => (v: T) => void,\n) => {\n const executor = applier((v) => base.give(v));\n return new Owner<T>((v) => {\n executor(v);\n });\n};\n","import { Information } from \"../Information\";\nimport { O } from \".\";\n\nexport interface InfoSync<T> {\n syncValue(): T;\n filled(): boolean;\n}\n\n/**\n * Owner that can return a synchronous value\n * from the information passed to it. If there is no value and no\n * defaultValue, an error will occur\n * https://silentium-lab.github.io/silentium/#/en/owner/sync\n */\nexport const ownerSync = <T>(\n base: Information<T>,\n defaultValue?: T,\n): InfoSync<T> => {\n let lastValue: T | undefined;\n\n base.value(\n O((v) => {\n lastValue = v;\n }),\n );\n\n return {\n syncValue() {\n if (lastValue === undefined && defaultValue === undefined) {\n throw new Error(\"info sync is empty\");\n }\n return (lastValue ?? defaultValue) as T;\n },\n filled() {\n return lastValue !== undefined;\n },\n };\n};\n","import { O } from \"../Owner\";\nimport { LazyType } from \"../types/LazyType\";\nimport { Information } from \"./Information\";\n\n/**\n * Helps in the process of executing information to create\n * a new information object and also destroy it if\n * destruction information is received\n * https://silentium-lab.github.io/silentium/#/en/information/lazy\n */\nexport const lazyS = <T>(\n lazyI: LazyType<Information<T>>,\n destroyI?: Information<unknown>,\n) => {\n const info = new Information<T>((g) => {\n const instance = lazyI.get();\n info.subInfo(instance);\n instance.value(g);\n });\n\n if (destroyI) {\n info.subInfo(destroyI);\n destroyI.value(\n O(() => {\n info.destroy();\n }),\n );\n }\n\n return info;\n};\n","import { InformationDataType } from \"../types\";\nimport { O } from \"../Owner/Owner\";\nimport { LazyType } from \"../types/LazyType\";\nimport { all } from \"./All\";\nimport { I, Information } from \"./Information\";\n\n/**\n * Component that applies an info object constructor to each data item,\n * producing an information source with new values\n * https://silentium-lab.github.io/silentium/#/en/information/map\n */\nexport const map = <T, TG>(\n base: Information<T[]>,\n targetI: LazyType<Information<TG>>,\n) => {\n const i = new Information<TG[]>((g) => {\n base.value(\n O((v) => {\n const infos: Information<TG>[] = [];\n v.forEach((val) => {\n let valInfo: Information<T> | T = val;\n if (!(valInfo instanceof Information)) {\n valInfo = I(val as InformationDataType<T>);\n }\n const info = targetI.get(valInfo);\n infos.push(info);\n });\n const allI = all(...infos).value(g);\n i.subInfo(allI);\n }),\n );\n });\n i.subInfo(base);\n\n return i;\n};\n","import { Owner } from \"../Owner\";\nimport { Information } from \"./Information\";\nimport { InformationDataType } from \"../types/InformationType\";\n\n/**\n * A component that allows creating linked objects of information and its owner\n * in such a way that if a new value is assigned to the owner, this value\n * will become the value of the linked information source\n * https://silentium-lab.github.io/silentium/#/en/information/of\n */\nexport const of = <T>(incomeI?: InformationDataType<T>) => {\n let sharedValue = incomeI as T;\n let relatedO: Owner<T> | undefined;\n\n const notifyO = () => {\n if (relatedO !== undefined) {\n relatedO.give(sharedValue);\n }\n };\n\n const info = new Information<T>((g) => {\n relatedO = g;\n if (sharedValue !== undefined && sharedValue !== null) {\n notifyO();\n }\n }, \"of\");\n\n return [\n info,\n new Owner<T>((v) => {\n sharedValue = v;\n notifyO();\n }),\n ] as const;\n};\n","import { O } from \"../Owner\";\nimport { Information } from \"./Information\";\n\n/**\n * Limits the number of values from the information source\n * to a single value - once the first value is emitted, no more\n * values are delivered from the source\n * https://silentium-lab.github.io/silentium/#/en/information/once\n */\nexport const once = <T>(base: Information<T>) => {\n const info = new Information<T>((g) => {\n let isFilled = false;\n base.value(\n O((v) => {\n if (!isFilled) {\n isFilled = true;\n g.give(v);\n }\n }),\n );\n });\n info.subInfo(base);\n\n return info;\n};\n","import { Owner } from \"../Owner\";\n\n/**\n * Helps maintain an owner list allowing different\n * owners to get information from a common source\n * https://silentium-lab.github.io/silentium/#/en/utils/owner-pool\n */\nexport class OwnerPool<T> {\n private owners: Set<Owner<T>>;\n private innerOwner: Owner<T>;\n\n public constructor() {\n this.owners = new Set<Owner<T>>();\n this.innerOwner = new Owner(\n (v) => {\n this.owners.forEach((g) => {\n g.give(v);\n });\n },\n (cause) => {\n this.owners.forEach((g) => {\n g.error(cause);\n });\n },\n );\n }\n\n public owner() {\n return this.innerOwner;\n }\n\n public size(): number {\n return this.owners.size;\n }\n\n public has(owner: Owner<T>): boolean {\n return this.owners.has(owner);\n }\n\n public add(shouldBePatron: Owner<T>) {\n this.owners.add(shouldBePatron);\n return this;\n }\n\n public remove(g: Owner<T>) {\n this.owners.delete(g);\n return this;\n }\n\n public destroy() {\n this.owners.forEach((g) => {\n this.remove(g);\n });\n return this;\n }\n}\n","import { Owner } from \"../Owner\";\nimport { Information } from \"./Information\";\nimport { OwnerPool } from \"../utils/OwnerPool\";\n\n/**\n * An information object that helps multiple owners access\n * a single another information object\n * https://silentium-lab.github.io/silentium/#/en/information/pool\n */\nexport const pool = <T>(base: Information<T>) => {\n const ownersPool = new OwnerPool<T>();\n let lastValue: T | undefined;\n\n const i = new Information<T>(\n (g) => {\n if (lastValue !== undefined && !ownersPool.has(g)) {\n g.give(lastValue);\n }\n ownersPool.add(g);\n\n return () => {\n ownersPool.destroy();\n };\n },\n \"pool\",\n false,\n );\n i.subInfo(base);\n\n i.executed(() => {\n const gp = ownersPool.owner();\n base.value(\n new Owner((v) => {\n gp.give(v);\n lastValue = v;\n }),\n );\n });\n\n return [i, ownersPool] as const;\n};\n\nexport const poolStateless = <T>(base: Information<T>) => {\n const ownersPool = new OwnerPool<T>();\n\n const i = new Information<T>(\n (g) => {\n ownersPool.add(g);\n\n return () => {\n ownersPool.destroy();\n };\n },\n \"pool\",\n false,\n );\n i.subInfo(base);\n\n i.executed((g) => {\n ownersPool.add(g);\n base.value(ownersPool.owner());\n });\n\n return [i, ownersPool] as const;\n};\n","import { I, Information } from \"../Information\";\nimport { O } from \"../Owner\";\n\n/**\n * A component that takes one value at a time and returns an array\n * https://silentium-lab.github.io/silentium/#/en/information/sequence\n */\nexport const sequence = <T>(base: Information<T>): Information<T[]> => {\n const i = I<T[]>((o) => {\n const result: T[] = [];\n\n base.value(\n O((v) => {\n result.push(v);\n o.give(result);\n }),\n );\n });\n i.subInfo(base);\n\n return i;\n};\n","import { I, Information } from \"../Information\";\nimport { O } from \"../Owner\";\n\n/**\n * Component that receives a data array and yields values one by one\n * https://silentium-lab.github.io/silentium/#/en/information/stream\n */\nexport const stream = <T>(base: Information<T[]>): Information<T> => {\n const i = I<T>((o) => {\n base.value(\n O((v) => {\n v.forEach((cv) => {\n o.give(cv);\n });\n }),\n );\n });\n\n return i;\n};\n","import { I } from \"../Information\";\n\n/**\n * When receiving a reference to a function expecting a callback, the component\n * creates its own callback, and the data received in this callback\n * will become the value of the information object\n * https://silentium-lab.github.io/silentium/#/en/information/from-callback\n */\nexport const fromCallback = <T>(waitForCb: (cb: (v: T) => any) => unknown) => {\n return I((o) => {\n waitForCb((v) => {\n o.give(v);\n });\n });\n};\n","import { I } from \"../Information\";\n\n/**\n * A component that receives data from an event and\n * presents it as an information object\n * https://silentium-lab.github.io/silentium/#/en/information/from-event\n */\nexport const fromEvent = <T extends []>(\n emitter: any,\n eventName: string,\n subscribeMethod: string,\n unsubscribeMethod?: string,\n) => {\n return I((o) => {\n const handler = (...args: T) => {\n o.give(args);\n };\n emitter[subscribeMethod](eventName, handler);\n return () => {\n if (unsubscribeMethod !== undefined) {\n emitter[unsubscribeMethod](eventName, handler);\n }\n };\n });\n};\n","import { I, Information } from \"../Information/Information\";\n\n/**\n * Component that gets a value from a promise and\n * presents it as information\n * https://silentium-lab.github.io/silentium/#/en/information/from-promise\n */\nexport const fromPromise = <T>(p: Promise<T>): Information<T> => {\n return I((o) => {\n p.then((v) => {\n o.give(v);\n }).catch((e) => {\n o.error(e);\n });\n });\n};\n","import { LazyType } from \"../types/LazyType\";\n\n/**\n * Helps to get lazy instance of dependency\n * @url https://silentium-lab.github.io/silentium/#/utils/lazy\n */\nexport const lazy = <T>(buildingFn: (...args: any[]) => T): LazyType<T> => {\n if (buildingFn === undefined) {\n throw new Error(\"lazy didn't receive buildingFn argument\");\n }\n\n return {\n get<R extends unknown[], CT = null>(...args: R): CT extends null ? T : CT {\n return buildingFn(...args) as CT extends null ? T : CT;\n },\n };\n};\n","import { LazyType } from \"../types/LazyType\";\n\ninterface Constructable<T> {\n new (...args: unknown[]): T;\n}\n\ninterface Prototyped<T> {\n prototype: T;\n}\n\n/**\n * Helps create an object from a class\n * https://silentium-lab.github.io/silentium/#/en/utils/lazy-class\n */\nexport const lazyClass = <T>(\n constructorFn: Prototyped<T>,\n modules: Record<string, unknown> = {},\n): LazyType<T> => {\n if (constructorFn === undefined) {\n throw new Error(\"PrivateClass didn't receive constructorFn argument\");\n }\n\n return {\n get<R extends unknown[], CT = null>(...args: R): CT extends null ? T : CT {\n return new (constructorFn as Constructable<T>)(\n ...args,\n modules,\n ) as CT extends null ? T : CT;\n },\n };\n};\n"],"names":["__publicField","info"],"mappings":";;;AAcO,MAAM,YAAA,GAAN,MAAM,YAAqB,CAAA;AAAA,EAQzB,WACG,CAAA,IAAA,EAIA,OAAU,GAAA,SAAA,EACV,eAAe,IACvB,EAAA;AANQ,IAAA,IAAA,CAAA,IAAA,GAAA,IAAA;AAIA,IAAA,IAAA,CAAA,OAAA,GAAA,OAAA;AACA,IAAA,IAAA,CAAA,YAAA,GAAA,YAAA;AAZV,IAAAA,eAAA,CAAA,IAAA,EAAQ,eAAsC,EAAC,CAAA;AAC/C,IAAQA,eAAA,CAAA,IAAA,EAAA,YAAA,CA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ACd,IAAE,CAAA,CAAA,IAAA,CAAK,CAAC,CAAM,KAAA;AACZ,MAAA,CAAA,CAAE,KAAK,CAAC,CAAA;AAAA,KACT,CAAA,CAAE,KAAM,CAAA,CAAC,CAAM,KAAA;AACd,MAAA,CAAA,CAAE,MAAM,CAAC,CAAA;AAAA,KACV,CAAA;AAAA,GACF,CAAA;AACH;;ACTa,MAAA,IAAA,GAAO,CAAI,UAAmD,KAAA;AACzE,EAAA,IAAI,eAAe,MAAW,EAAA;AAC5B,IAAM,MAAA,IAAI,MAAM,yCAAyC,CAAA;AAAA;AAG3D,EAAO,OAAA;AAAA,IACL,OAAuC,IAAmC,EAAA;AACxE,MAAO,OAAA,UAAA,CAAW,GAAG,IAAI,CAAA;AAAA;AAC3B,GACF;AACF;;ACFO,MAAM,SAAY,GAAA,CACvB,aACA,EAAA,OAAA,GAAmC,EACnB,KAAA;AAChB,EAAA,IAAI,kBAAkB,MAAW,EAAA;AAC/B,IAAM,MAAA,IAAI,MAAM,oDAAoD,CAAA;AAAA;AAGtE,EAAO,OAAA;AAAA,IACL,OAAuC,IAAmC,EAAA;AACxE,MAAA,OAAO,IAAK,aAAA;AAAA,QACV,GAAG,IAAA;AAAA,QACH;AAAA,OACF;AAAA;AACF,GACF;AACF;;;;"}
|
package/dist/silentium.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e){"use strict";var t=Object.defineProperty,n=(e,n,s)=>((e,n,s)=>n in e?t(e,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[n]=s)(e,"symbol"!=typeof n?n+"":n,s);const s=class e{constructor(t,s="unknown",r=!0){this.info=t,this.theName=s,this.onlyOneOwner=r,n(this,"theSubInfos",[]),n(this,"destructor"),n(this,"owner"),n(this,"executedCbs"),n(this,"alreadyExecuted",!1),e.instances+=1}next(e){return void 0!==this.owner&&this.owner.give(e),this}value(e){if(this.onlyOneOwner&&void 0!==this.owner)throw new Error(`owner already connected to info ${this.name()}`);if(this.owner=e,void 0===this.executedCbs||this.alreadyExecuted||(this.executedCbs.forEach((t=>t(e))),this.alreadyExecuted=!0),void 0===this.info)return this;if("function"==typeof this.info){const t=this.info(e);void 0===this.destructor&&void 0!==t&&this.info!==t&&"function"==typeof t&&(this.destructor=t)}else"object"==typeof this.info&&null!==this.info&&"value"in this.info&&"function"==typeof this.info.value?this.info.value(e):this.next(this.info);return this}destroy(){for(;this.theSubInfos.length>0;){const e=this.theSubInfos.shift();e?.destroy()}return this.destructor&&this.destructor(),this.owner=void 0,this.executedCbs=void 0,this.destructor=void 0,this}subInfo(e){return this.theSubInfos.push(e),this}subInfos(){return this.theSubInfos}name(){return`#info_${this.theName}_${e.instances}`}executed(e){return this.executedCbs||(this.executedCbs=[]),this.executedCbs.push(e),this.alreadyExecuted&&void 0!==this.owner&&e(this.owner),this}hasOwner(){return!!this.owner}};n(s,"instances",0);let r=s;const o=(e,t="unknown",n=!0)=>new r(e,t,n);class i{constructor(e,t,n){this.ownerFn=e,this.errorFn=t,this.disposedFn=n}give(e){return this.disposed()||this.ownerFn(e),this}error(e){return void 0!==this.errorFn&&this.errorFn(e),this}disposed(){return void 0!==this.disposedFn&&this.disposedFn()}}const u=e=>new i(e),h=(...e)=>{const t=new r((n=>{const s=new Set(Object.keys(e)),r=new Set,o={};Object.entries(e).forEach((([e,u])=>{t.subInfo(u),s.add(e),u.value(new i((t=>{r.add(e),o[e]=t,r.size>0&&r.size===s.size&&n.give(Object.values(o))})))}))}));return t};var c=Object.defineProperty,
|
|
1
|
+
!function(e){"use strict";var t=Object.defineProperty,n=(e,n,s)=>((e,n,s)=>n in e?t(e,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[n]=s)(e,"symbol"!=typeof n?n+"":n,s);const s=class e{constructor(t,s="unknown",r=!0){this.info=t,this.theName=s,this.onlyOneOwner=r,n(this,"theSubInfos",[]),n(this,"destructor"),n(this,"owner"),n(this,"executedCbs"),n(this,"alreadyExecuted",!1),e.instances+=1}next(e){return void 0!==this.owner&&this.owner.give(e),this}value(e){if(this.onlyOneOwner&&void 0!==this.owner)throw new Error(`owner already connected to info ${this.name()}`);if(this.owner=e,void 0===this.executedCbs||this.alreadyExecuted||(this.executedCbs.forEach((t=>t(e))),this.alreadyExecuted=!0),void 0===this.info)return this;if("function"==typeof this.info){const t=this.info(e);void 0===this.destructor&&void 0!==t&&this.info!==t&&"function"==typeof t&&(this.destructor=t)}else"object"==typeof this.info&&null!==this.info&&"value"in this.info&&"function"==typeof this.info.value?this.info.value(e):this.next(this.info);return this}destroy(){for(;this.theSubInfos.length>0;){const e=this.theSubInfos.shift();e?.destroy()}return this.destructor&&this.destructor(),this.owner=void 0,this.executedCbs=void 0,this.destructor=void 0,this}subInfo(e){return this.theSubInfos.push(e),this}subInfos(){return this.theSubInfos}name(){return`#info_${this.theName}_${e.instances}`}executed(e){return this.executedCbs||(this.executedCbs=[]),this.executedCbs.push(e),this.alreadyExecuted&&void 0!==this.owner&&e(this.owner),this}hasOwner(){return!!this.owner}};n(s,"instances",0);let r=s;const o=(e,t="unknown",n=!0)=>new r(e,t,n);class i{constructor(e,t,n){this.ownerFn=e,this.errorFn=t,this.disposedFn=n}give(e){return this.disposed()||this.ownerFn(e),this}error(e){return void 0!==this.errorFn&&this.errorFn(e),this}disposed(){return void 0!==this.disposedFn&&this.disposedFn()}}const u=e=>new i(e),h=(...e)=>{const t=new r((n=>{const s=new Set(Object.keys(e)),r=new Set,o={};Object.entries(e).forEach((([e,u])=>{t.subInfo(u),s.add(e),u.value(new i((t=>{r.add(e),o[e]=t,r.size>0&&r.size===s.size&&n.give(Object.values(o))})))}))}));return t};var c=Object.defineProperty,d=(e,t,n)=>((e,t,n)=>t in e?c(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);class a{constructor(){d(this,"owners"),d(this,"innerOwner"),this.owners=new Set,this.innerOwner=new i((e=>{this.owners.forEach((t=>{t.give(e)}))}),(e=>{this.owners.forEach((t=>{t.error(e)}))}))}owner(){return this.innerOwner}size(){return this.owners.size}has(e){return this.owners.has(e)}add(e){return this.owners.add(e),this}remove(e){return this.owners.delete(e),this}destroy(){return this.owners.forEach((e=>{this.remove(e)})),this}}e.I=o,e.Information=r,e.O=u,e.Owner=i,e.OwnerPool=a,e.all=h,e.any=(...e)=>o((t=>{e.forEach((e=>{e.value(t),e.subInfo(e)}))})),e.applied=(e,t)=>{const n=o((n=>{e.value(u((e=>{n.give(t(e))})))}));return n.subInfo(e),n},e.chain=(...e)=>{let t,n;const s=new WeakMap,r=o=>{const i=e[o],h=e[o+1];i.value(u((e=>{h||(n=e,t?.give(e)),h&&void 0!==n&&void 0!==t&&t.give(n),h&&!s.has(i)&&r(o+1),s.set(i,1)})))},i=o((e=>{t=e}));return i.executed((()=>{r(0)})),i},e.executorApplied=(e,t)=>{const n=new r((n=>{e.value(t(n))}));return n.subInfo(e),n},e.filtered=(e,t,n)=>new r((s=>{e.value(u((e=>{t(e)?s.give(e):void 0!==n&&s.give(n)})))})).subInfo(e),e.fromCallback=e=>o((t=>{e((e=>{t.give(e)}))})),e.fromEvent=(e,t,n,s)=>o((r=>{const o=(...e)=>{r.give(e)};return e[n](t,o),()=>{void 0!==s&&e[s](t,o)}})),e.fromPromise=e=>o((t=>{e.then((e=>{t.give(e)})).catch((e=>{t.error(e)}))})),e.lazy=e=>{if(void 0===e)throw new Error("lazy didn't receive buildingFn argument");return{get:(...t)=>e(...t)}},e.lazyClass=(e,t={})=>{if(void 0===e)throw new Error("PrivateClass didn't receive constructorFn argument");return{get:(...n)=>new e(...n,t)}},e.lazyS=(e,t)=>{const n=new r((t=>{const s=e.get();n.subInfo(s),s.value(t)}));return t&&(n.subInfo(t),t.value(u((()=>{n.destroy()})))),n},e.map=(e,t)=>{const n=new r((s=>{e.value(u((e=>{const i=[];e.forEach((e=>{let n=e;n instanceof r||(n=o(e));const s=t.get(n);i.push(s)}));const u=h(...i).value(s);n.subInfo(u)})))}));return n.subInfo(e),n},e.of=e=>{let t,n=e;const s=()=>{void 0!==t&&t.give(n)};return[new r((e=>{t=e,null!=n&&s()}),"of"),new i((e=>{n=e,s()}))]},e.once=e=>{const t=new r((t=>{let n=!1;e.value(u((e=>{n||(n=!0,t.give(e))})))}));return t.subInfo(e),t},e.ownerApplied=(e,t)=>new i((n=>{e.give(t(n))}),(t=>{e.error(t)}),(()=>e.disposed())),e.ownerExecutorApplied=(e,t)=>{const n=t((t=>e.give(t)));return new i((e=>{n(e)}))},e.ownerSync=(e,t)=>{let n;return e.value(u((e=>{n=e}))),{syncValue(){if(void 0===n&&void 0===t)throw new Error("info sync is empty");return n??t},filled:()=>void 0!==n}},e.pool=e=>{const t=new a;let n;const s=new r((e=>(void 0===n||t.has(e)||e.give(n),t.add(e),()=>{t.destroy()})),"pool",!1);return s.subInfo(e),s.executed((()=>{const s=t.owner();e.value(new i((e=>{s.give(e),n=e})))})),[s,t]},e.poolStateless=e=>{const t=new a,n=new r((e=>(t.add(e),()=>{t.destroy()})),"pool",!1);return n.subInfo(e),n.executed((n=>{t.add(n),e.value(t.owner())})),[n,t]},e.sequence=e=>{const t=o((t=>{const n=[];e.value(u((e=>{n.push(e),t.give(n)})))}));return t.subInfo(e),t},e.stream=e=>o((t=>{e.value(u((e=>{e.forEach((e=>{t.give(e)}))})))}))}({});
|
package/dist/silentium.min.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e=Object.defineProperty,t=(t,n,s)=>((t,n,s)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[n]=s)(t,"symbol"!=typeof n?n+"":n,s);const n=class e{constructor(n,s="unknown",r=!0){this.info=n,this.theName=s,this.onlyOneOwner=r,t(this,"theSubInfos",[]),t(this,"destructor"),t(this,"owner"),t(this,"executedCbs"),t(this,"alreadyExecuted",!1),e.instances+=1}next(e){return void 0!==this.owner&&this.owner.give(e),this}value(e){if(this.onlyOneOwner&&void 0!==this.owner)throw new Error(`owner already connected to info ${this.name()}`);if(this.owner=e,void 0===this.executedCbs||this.alreadyExecuted||(this.executedCbs.forEach((t=>t(e))),this.alreadyExecuted=!0),void 0===this.info)return this;if("function"==typeof this.info){const t=this.info(e);void 0===this.destructor&&void 0!==t&&this.info!==t&&"function"==typeof t&&(this.destructor=t)}else"object"==typeof this.info&&null!==this.info&&"value"in this.info&&"function"==typeof this.info.value?this.info.value(e):this.next(this.info);return this}destroy(){for(;this.theSubInfos.length>0;){const e=this.theSubInfos.shift();e?.destroy()}return this.destructor&&this.destructor(),this.owner=void 0,this.executedCbs=void 0,this.destructor=void 0,this}subInfo(e){return this.theSubInfos.push(e),this}subInfos(){return this.theSubInfos}name(){return`#info_${this.theName}_${e.instances}`}executed(e){return this.executedCbs||(this.executedCbs=[]),this.executedCbs.push(e),this.alreadyExecuted&&void 0!==this.owner&&e(this.owner),this}hasOwner(){return!!this.owner}};t(n,"instances",0);let s=n;const r=(e,t="unknown",n=!0)=>new s(e,t,n);class o{constructor(e,t,n){this.ownerFn=e,this.errorFn=t,this.disposedFn=n}give(e){return this.disposed()||this.ownerFn(e),this}error(e){return void 0!==this.errorFn&&this.errorFn(e),this}disposed(){return void 0!==this.disposedFn&&this.disposedFn()}}const i=e=>new o(e),u=(...e)=>{const t=new s((n=>{const s=new Set(Object.keys(e)),r=new Set,i={};Object.entries(e).forEach((([e,u])=>{t.subInfo(u),s.add(e),u.value(new o((t=>{r.add(e),i[e]=t,r.size>0&&r.size===s.size&&n.give(Object.values(i))})))}))}));return t},h=(...e)=>r((t=>{e.forEach((e=>{e.value(t),e.subInfo(e)}))})),c=(...e)=>{let t,n;const s=new WeakMap,o=r=>{const u=e[r],h=e[r+1];u.value(i((e=>{h||(n=e,t?.give(e)),h&&void 0!==n&&void 0!==t&&t.give(n),h&&!s.has(u)&&o(r+1),s.set(u,1)})))},u=r((e=>{t=e}));return u.executed((()=>{o(0)})),u},d=(e,t)=>{const n=new s((n=>{e.value(t(n))}));return n.subInfo(e),n},a=(e,t)=>{const n=r((n=>{e.value(i((e=>{n.give(t(e))})))}));return n.subInfo(e),n},v=(e,t,n)=>new s((s=>{e.value(i((e=>{t(e)?s.give(e):void 0!==n&&s.give(n)})))})).subInfo(e),
|
|
1
|
+
var e=Object.defineProperty,t=(t,n,s)=>((t,n,s)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[n]=s)(t,"symbol"!=typeof n?n+"":n,s);const n=class e{constructor(n,s="unknown",r=!0){this.info=n,this.theName=s,this.onlyOneOwner=r,t(this,"theSubInfos",[]),t(this,"destructor"),t(this,"owner"),t(this,"executedCbs"),t(this,"alreadyExecuted",!1),e.instances+=1}next(e){return void 0!==this.owner&&this.owner.give(e),this}value(e){if(this.onlyOneOwner&&void 0!==this.owner)throw new Error(`owner already connected to info ${this.name()}`);if(this.owner=e,void 0===this.executedCbs||this.alreadyExecuted||(this.executedCbs.forEach((t=>t(e))),this.alreadyExecuted=!0),void 0===this.info)return this;if("function"==typeof this.info){const t=this.info(e);void 0===this.destructor&&void 0!==t&&this.info!==t&&"function"==typeof t&&(this.destructor=t)}else"object"==typeof this.info&&null!==this.info&&"value"in this.info&&"function"==typeof this.info.value?this.info.value(e):this.next(this.info);return this}destroy(){for(;this.theSubInfos.length>0;){const e=this.theSubInfos.shift();e?.destroy()}return this.destructor&&this.destructor(),this.owner=void 0,this.executedCbs=void 0,this.destructor=void 0,this}subInfo(e){return this.theSubInfos.push(e),this}subInfos(){return this.theSubInfos}name(){return`#info_${this.theName}_${e.instances}`}executed(e){return this.executedCbs||(this.executedCbs=[]),this.executedCbs.push(e),this.alreadyExecuted&&void 0!==this.owner&&e(this.owner),this}hasOwner(){return!!this.owner}};t(n,"instances",0);let s=n;const r=(e,t="unknown",n=!0)=>new s(e,t,n);class o{constructor(e,t,n){this.ownerFn=e,this.errorFn=t,this.disposedFn=n}give(e){return this.disposed()||this.ownerFn(e),this}error(e){return void 0!==this.errorFn&&this.errorFn(e),this}disposed(){return void 0!==this.disposedFn&&this.disposedFn()}}const i=e=>new o(e),u=(...e)=>{const t=new s((n=>{const s=new Set(Object.keys(e)),r=new Set,i={};Object.entries(e).forEach((([e,u])=>{t.subInfo(u),s.add(e),u.value(new o((t=>{r.add(e),i[e]=t,r.size>0&&r.size===s.size&&n.give(Object.values(i))})))}))}));return t},h=(...e)=>r((t=>{e.forEach((e=>{e.value(t),e.subInfo(e)}))})),c=(...e)=>{let t,n;const s=new WeakMap,o=r=>{const u=e[r],h=e[r+1];u.value(i((e=>{h||(n=e,t?.give(e)),h&&void 0!==n&&void 0!==t&&t.give(n),h&&!s.has(u)&&o(r+1),s.set(u,1)})))},u=r((e=>{t=e}));return u.executed((()=>{o(0)})),u},d=(e,t)=>{const n=new s((n=>{e.value(t(n))}));return n.subInfo(e),n},a=(e,t)=>{const n=r((n=>{e.value(i((e=>{n.give(t(e))})))}));return n.subInfo(e),n},v=(e,t,n)=>new s((s=>{e.value(i((e=>{t(e)?s.give(e):void 0!==n&&s.give(n)})))})).subInfo(e),f=(e,t)=>new o((n=>{e.give(t(n))}),(t=>{e.error(t)}),(()=>e.disposed())),w=(e,t)=>{const n=t((t=>e.give(t)));return new o((e=>{n(e)}))},l=(e,t)=>{let n;return e.value(i((e=>{n=e}))),{syncValue(){if(void 0===n&&void 0===t)throw new Error("info sync is empty");return n??t},filled:()=>void 0!==n}},b=(e,t)=>{const n=new s((t=>{const s=e.get();n.subInfo(s),s.value(t)}));return t&&(n.subInfo(t),t.value(i((()=>{n.destroy()})))),n},g=(e,t)=>{const n=new s((o=>{e.value(i((e=>{const i=[];e.forEach((e=>{let n=e;n instanceof s||(n=r(e));const o=t.get(n);i.push(o)}));const h=u(...i).value(o);n.subInfo(h)})))}));return n.subInfo(e),n},y=e=>{let t,n=e;const r=()=>{void 0!==t&&t.give(n)};return[new s((e=>{t=e,null!=n&&r()}),"of"),new o((e=>{n=e,r()}))]},p=e=>{const t=new s((t=>{let n=!1;e.value(i((e=>{n||(n=!0,t.give(e))})))}));return t.subInfo(e),t};var I=Object.defineProperty,x=(e,t,n)=>((e,t,n)=>t in e?I(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);class E{constructor(){x(this,"owners"),x(this,"innerOwner"),this.owners=new Set,this.innerOwner=new o((e=>{this.owners.forEach((t=>{t.give(e)}))}),(e=>{this.owners.forEach((t=>{t.error(e)}))}))}owner(){return this.innerOwner}size(){return this.owners.size}has(e){return this.owners.has(e)}add(e){return this.owners.add(e),this}remove(e){return this.owners.delete(e),this}destroy(){return this.owners.forEach((e=>{this.remove(e)})),this}}const m=e=>{const t=new E;let n;const r=new s((e=>(void 0===n||t.has(e)||e.give(n),t.add(e),()=>{t.destroy()})),"pool",!1);return r.subInfo(e),r.executed((()=>{const s=t.owner();e.value(new o((e=>{s.give(e),n=e})))})),[r,t]},O=e=>{const t=new E,n=new s((e=>(t.add(e),()=>{t.destroy()})),"pool",!1);return n.subInfo(e),n.executed((n=>{t.add(n),e.value(t.owner())})),[n,t]},F=e=>{const t=r((t=>{const n=[];e.value(i((e=>{n.push(e),t.give(n)})))}));return t.subInfo(e),t},C=e=>r((t=>{e.value(i((e=>{e.forEach((e=>{t.give(e)}))})))})),S=e=>r((t=>{e((e=>{t.give(e)}))})),j=(e,t,n,s)=>r((r=>{const o=(...e)=>{r.give(e)};return e[n](t,o),()=>{void 0!==s&&e[s](t,o)}})),z=e=>r((t=>{e.then((e=>{t.give(e)})).catch((e=>{t.error(e)}))})),k=e=>{if(void 0===e)throw new Error("lazy didn't receive buildingFn argument");return{get:(...t)=>e(...t)}},P=(e,t={})=>{if(void 0===e)throw new Error("PrivateClass didn't receive constructorFn argument");return{get:(...n)=>new e(...n,t)}};export{r as I,s as Information,i as O,o as Owner,E as OwnerPool,u as all,h as any,a as applied,c as chain,d as executorApplied,v as filtered,S as fromCallback,j as fromEvent,z as fromPromise,k as lazy,P as lazyClass,b as lazyS,g as map,y as of,p as once,f as ownerApplied,w as ownerExecutorApplied,l as ownerSync,m as pool,O as poolStateless,F as sequence,C as stream};
|
|
2
2
|
//# sourceMappingURL=silentium.min.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"silentium.min.mjs","sources":["../src/Information/Information.ts","../src/Owner/Owner.ts","../src/Information/All.ts","../src/Information/Any.ts","../src/Information/Chain.ts","../src/Information/ExecutorApplied.ts","../src/Information/Applied.ts","../src/Information/Filtered.ts","../src/Owner/OwnerApplied.ts","../src/Owner/OwnerExecutorApplied.ts","../src/Owner/OwnerSync.ts","../src/Information/Lazy.ts","../src/Information/Map.ts","../src/Information/Of.ts","../src/Information/Once.ts","../src/utils/OwnerPool.ts","../src/Information/Pool.ts","../src/Information/Sequence.ts","../src/Information/Stream.ts","../src/Information/FromCallback.ts","../src/Information/FromEvent.ts","../src/Information/FromPromise.ts","../src/utils/Lazy.ts","../src/utils/LazyClass.ts"],"sourcesContent":["import { Owner } from \"../Owner/Owner\";\nimport { InformationDataType } from \"../types/InformationType\";\n\ntype InfoExecutorType<T> = (g: Owner<T>) => (() => void | undefined) | void;\ntype InfoObjectType<T> = {\n value: InfoExecutorType<T>;\n};\n\ntype InformationExecutedCb<T> = (g: Owner<T>) => void;\n\n/**\n * Main information representation\n * https://silentium-lab.github.io/silentium/#/en/information\n */\nexport class Information<T = any> {\n private static instances = 0;\n private theSubInfos: Information<unknown>[] = [];\n private destructor?: () => void;\n private owner?: Owner<T>;\n private executedCbs?: InformationExecutedCb<T>[];\n private alreadyExecuted = false;\n\n public constructor(\n private info?:\n | InfoObjectType<T>\n | InfoExecutorType<T>\n | InformationDataType<T>,\n private theName = \"unknown\",\n private onlyOneOwner = true,\n ) {\n Information.instances += 1;\n }\n\n /**\n * Следующее значение источника\n */\n private next(value: T) {\n if (this.owner !== undefined) {\n this.owner.give(value);\n }\n return this;\n }\n\n /**\n * Возможность гостю получить информацию от источника\n */\n public value(owner: Owner<T>) {\n if (this.onlyOneOwner && this.owner !== undefined) {\n throw new Error(`owner already connected to info ${this.name()}`);\n }\n\n this.owner = owner;\n if (this.executedCbs !== undefined && !this.alreadyExecuted) {\n this.executedCbs.forEach((cb) => cb(owner));\n this.alreadyExecuted = true;\n }\n\n if (this.info === undefined) {\n return this;\n }\n\n if (typeof this.info === \"function\") {\n const mbDestructor = this.info(owner);\n if (\n this.destructor === undefined &&\n mbDestructor !== undefined &&\n this.info !== mbDestructor &&\n typeof mbDestructor === \"function\"\n ) {\n this.destructor = mbDestructor as () => void;\n }\n } else if (\n typeof this.info === \"object\" &&\n this.info !== null &&\n \"value\" in this.info &&\n typeof this.info.value === \"function\"\n ) {\n this.info.value(owner);\n } else {\n this.next(this.info as T);\n }\n\n return this;\n }\n\n /**\n * Ability to destroy the information info\n */\n public destroy() {\n while (this.theSubInfos.length > 0) {\n const subInfo = this.theSubInfos.shift();\n subInfo?.destroy();\n }\n if (this.destructor) {\n this.destructor();\n }\n this.owner = undefined;\n this.executedCbs = undefined;\n this.destructor = undefined;\n return this;\n }\n\n /**\n * The ability to link another info to the current info\n */\n public subInfo(info: Information<any>) {\n this.theSubInfos.push(info);\n return this;\n }\n\n public subInfos() {\n return this.theSubInfos;\n }\n\n public name() {\n return `#info_${this.theName}_${Information.instances}`;\n }\n\n public executed(cb: InformationExecutedCb<T>) {\n if (!this.executedCbs) {\n this.executedCbs = [];\n }\n this.executedCbs.push(cb);\n if (this.alreadyExecuted && this.owner !== undefined) {\n cb(this.owner);\n }\n return this;\n }\n\n public hasOwner(): boolean {\n return !!this.owner;\n }\n}\n\nexport const I = <T>(\n info?: InfoObjectType<T> | InfoExecutorType<T> | InformationDataType<T>,\n theName = \"unknown\",\n onlyOneOwner = true,\n) => new Information(info, theName, onlyOneOwner);\n","import { OwnerExecutorType } from \"../types/OwnerType\";\n\n/**\n * Information owner, if information\n * has owner than information executed\n * https://silentium-lab.github.io/silentium/#/en/owner\n */\nexport class Owner<T = any> {\n public constructor(\n private ownerFn: OwnerExecutorType<T>,\n private errorFn?: (cause: unknown) => void,\n private disposedFn?: () => boolean,\n ) {}\n\n public give(value: T) {\n if (!this.disposed()) {\n this.ownerFn(value);\n }\n return this;\n }\n\n public error(cause: unknown) {\n if (this.errorFn !== undefined) {\n this.errorFn(cause);\n }\n\n return this;\n }\n\n public disposed() {\n return this.disposedFn !== undefined ? this.disposedFn() : false;\n }\n}\n\nexport const O = <T>(ownerFn: OwnerExecutorType<T>) => new Owner(ownerFn);\n","import { Owner } from \"../Owner/Owner\";\nimport { InformationType } from \"../types/InformationType\";\nimport { Information } from \"./Information\";\n\ntype ExtractType<T> = T extends InformationType<infer U> ? U : never;\ntype ExtractTypeS<T> = T extends Information<infer U> ? U : never;\n\nexport type ExtractTypesFromArray<T extends InformationType<any>[]> = {\n [K in keyof T]: ExtractType<T[K]>;\n};\n\nexport type ExtractTypesFromArrayS<T extends Information<any>[]> = {\n [K in keyof T]: ExtractTypeS<T[K]>;\n};\n\n/**\n * Combines multiple information sources into a single unified source\n * represented as an array containing values from all sources\n * https://silentium-lab.github.io/silentium/#/en/information/all\n */\nexport const all = <const T extends Information[]>(...infos: T) => {\n const i = new Information<ExtractTypesFromArrayS<T>>((g) => {\n const keysKnown = new Set<string>(Object.keys(infos));\n const keysFilled = new Set();\n const isAllFilled = () => {\n return keysFilled.size > 0 && keysFilled.size === keysKnown.size;\n };\n const result: Record<string, unknown> = {};\n\n Object.entries(infos).forEach(([key, info]) => {\n i.subInfo(info);\n keysKnown.add(key);\n info.value(\n new Owner((v) => {\n keysFilled.add(key);\n result[key] = v;\n if (isAllFilled()) {\n g.give(Object.values(result) as ExtractTypesFromArrayS<T>);\n }\n }),\n );\n });\n });\n\n return i;\n};\n","import { I, Information } from \"./Information\";\n\n/**\n * From a set of information sources we get\n * a common response from any source for a single owner\n * https://silentium-lab.github.io/silentium/#/en/information/any\n */\nexport const any = <T>(...infos: Information<T>[]) => {\n const info = I((g) => {\n infos.forEach((info) => {\n info.value(g);\n info.subInfo(info);\n });\n });\n\n return info;\n};\n","import { O, Owner } from \"../Owner/Owner\";\nimport { I, Information } from \"./Information\";\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\ntype Last<T extends any[]> = T extends [...infer U, infer L] ? L : never;\n\n/**\n * The set of information sources forms a sequential chain where each source provides\n * an answer. The final answer will be the output result. If any source in the chain\n * provides a new answer, the component's overall response will be repeated.\n * https://silentium-lab.github.io/silentium/#/en/information/applied\n */\nexport const chain = <T extends Information[]>(\n ...infos: T\n): Information<Last<T>> => {\n let theOwner: Owner<Last<T>> | undefined;\n let lastValue: Last<T> | undefined;\n const respondedI = new WeakMap();\n\n const handleI = (index: number) => {\n const info = infos[index];\n const nextI = infos[index + 1];\n\n info.value(\n O((v) => {\n if (!nextI) {\n lastValue = v;\n theOwner?.give(v);\n }\n\n if (nextI && lastValue !== undefined && theOwner !== undefined) {\n theOwner.give(lastValue);\n }\n\n if (nextI && !respondedI.has(info)) {\n handleI(index + 1);\n }\n\n respondedI.set(info, 1);\n }),\n );\n };\n\n const info = I<Last<T>>((g) => {\n theOwner = g;\n });\n\n info.executed(() => {\n handleI(0);\n });\n\n return info;\n};\n","import { Owner } from \"../Owner/Owner\";\nimport { Information } from \"./Information\";\n\n/**\n * Information to which a function is applied in order\n * to control the value passing process\n * https://silentium-lab.github.io/silentium/#/en/information/applied\n */\nexport const executorApplied = <T>(\n base: Information<T>,\n applier: (executor: Owner<T>) => Owner<T>,\n) => {\n const i = new Information<T>((g) => {\n base.value(applier(g));\n });\n i.subInfo(base);\n\n return i;\n};\n","import { O } from \"../Owner/Owner\";\nimport { I, Information } from \"./Information\";\n\n/**\n * Information to which the function was applied to change the value\n * https://silentium-lab.github.io/silentium/#/en/information/applied\n */\nexport const applied = <T, R>(base: Information<T>, applier: (v: T) => R) => {\n const info = I((g) => {\n base.value(\n O((v) => {\n g.give(applier(v));\n }),\n );\n });\n info.subInfo(base);\n\n return info;\n};\n","import { O } from \"../Owner/Owner\";\nimport { Information } from \"./Information\";\n\n/**\n * Information whose value is being validated\n * via a predicate; if the predicate returns true, the value\n * can be passed to the output\n * https://silentium-lab.github.io/silentium/#/en/information/filtered\n */\nexport const filtered = <T>(\n base: Information<T>,\n predicate: (v: T) => boolean,\n defaultValue?: T,\n) => {\n return new Information<T>((g) => {\n base.value(\n O((v) => {\n if (predicate(v)) {\n g.give(v);\n } else if (defaultValue !== undefined) {\n g.give(defaultValue);\n }\n }),\n );\n }).subInfo(base);\n};\n","import { Owner } from \"./Owner\";\n\n/**\n * Owner to which a function is applied that modifies the incoming\n * value it receives\n * https://silentium-lab.github.io/silentium/#/en/owner/applied\n */\nexport const ownerApplied = <T, R>(\n base: Owner<R>,\n applier: (value: T) => R,\n) => {\n return new Owner<T>(\n (v) => {\n base.give(applier(v));\n },\n (cause) => {\n base.error(cause);\n },\n () => base.disposed(),\n );\n};\n","import { Owner } from \"./Owner\";\n\n/**\n * Owner to which the function is applied that\n * controls the conditions for passing the value\n * https://silentium-lab.github.io/silentium/#/en/owner/executor-applied\n */\nexport const ownerExecutorApplied = <T>(\n base: Owner<T>,\n applier: (ge: (v: T) => void) => (v: T) => void,\n) => {\n const executor = applier((v) => base.give(v));\n return new Owner<T>((v) => {\n executor(v);\n });\n};\n","import { Information } from \"../Information\";\nimport { O } from \".\";\n\nexport interface infoSync<T> {\n syncValue(): T;\n}\n\n/**\n * Owner that can return a synchronous value\n * from the information passed to it. If there is no value and no\n * defaultValue, an error will occur\n * https://silentium-lab.github.io/silentium/#/en/owner/sync\n */\nexport const ownerSync = <T>(\n base: Information<T>,\n defaultValue?: T,\n): infoSync<T> => {\n let lastValue: T | undefined;\n\n base.value(\n O((v) => {\n lastValue = v;\n }),\n );\n\n return {\n syncValue() {\n if (lastValue === undefined && defaultValue === undefined) {\n throw new Error(\"info sync is empty\");\n }\n return (lastValue ?? defaultValue) as T;\n },\n };\n};\n","import { O } from \"../Owner\";\nimport { LazyType } from \"../types/LazyType\";\nimport { Information } from \"./Information\";\n\n/**\n * Helps in the process of executing information to create\n * a new information object and also destroy it if\n * destruction information is received\n * https://silentium-lab.github.io/silentium/#/en/information/lazy\n */\nexport const lazyS = <T>(\n lazyI: LazyType<Information<T>>,\n destroyI?: Information<unknown>,\n) => {\n const info = new Information<T>((g) => {\n const instance = lazyI.get();\n info.subInfo(instance);\n instance.value(g);\n });\n\n if (destroyI) {\n info.subInfo(destroyI);\n destroyI.value(\n O(() => {\n info.destroy();\n }),\n );\n }\n\n return info;\n};\n","import { InformationDataType } from \"../types\";\nimport { O } from \"../Owner/Owner\";\nimport { LazyType } from \"../types/LazyType\";\nimport { all } from \"./All\";\nimport { I, Information } from \"./Information\";\n\n/**\n * Component that applies an info object constructor to each data item,\n * producing an information source with new values\n * https://silentium-lab.github.io/silentium/#/en/information/map\n */\nexport const map = <T, TG>(\n base: Information<T[]>,\n targetI: LazyType<Information<TG>>,\n) => {\n const i = new Information<TG[]>((g) => {\n base.value(\n O((v) => {\n const infos: Information<TG>[] = [];\n v.forEach((val) => {\n let valInfo: Information<T> | T = val;\n if (!(valInfo instanceof Information)) {\n valInfo = I(val as InformationDataType<T>);\n }\n const info = targetI.get(valInfo);\n infos.push(info);\n });\n const allI = all(...infos).value(g);\n i.subInfo(allI);\n }),\n );\n });\n i.subInfo(base);\n\n return i;\n};\n","import { Owner } from \"../Owner\";\nimport { Information } from \"./Information\";\nimport { InformationDataType } from \"../types/InformationType\";\n\n/**\n * A component that allows creating linked objects of information and its owner\n * in such a way that if a new value is assigned to the owner, this value\n * will become the value of the linked information source\n * https://silentium-lab.github.io/silentium/#/en/information/of\n */\nexport const of = <T>(incomeI?: InformationDataType<T>) => {\n let sharedValue = incomeI as T;\n let relatedO: Owner<T> | undefined;\n\n const notifyO = () => {\n if (relatedO !== undefined) {\n relatedO.give(sharedValue);\n }\n };\n\n const info = new Information<T>((g) => {\n relatedO = g;\n if (sharedValue !== undefined && sharedValue !== null) {\n notifyO();\n }\n }, \"of\");\n\n return [\n info,\n new Owner<T>((v) => {\n sharedValue = v;\n notifyO();\n }),\n ] as const;\n};\n","import { O } from \"../Owner\";\nimport { Information } from \"./Information\";\n\n/**\n * Limits the number of values from the information source\n * to a single value - once the first value is emitted, no more\n * values are delivered from the source\n * https://silentium-lab.github.io/silentium/#/en/information/once\n */\nexport const once = <T>(base: Information<T>) => {\n const info = new Information<T>((g) => {\n let isFilled = false;\n base.value(\n O((v) => {\n if (!isFilled) {\n isFilled = true;\n g.give(v);\n }\n }),\n );\n });\n info.subInfo(base);\n\n return info;\n};\n","import { Owner } from \"../Owner\";\n\n/**\n * Helps maintain an owner list allowing different\n * owners to get information from a common source\n * https://silentium-lab.github.io/silentium/#/en/utils/owner-pool\n */\nexport class OwnerPool<T> {\n private owners: Set<Owner<T>>;\n private innerOwner: Owner<T>;\n\n public constructor() {\n this.owners = new Set<Owner<T>>();\n this.innerOwner = new Owner(\n (v) => {\n this.owners.forEach((g) => {\n g.give(v);\n });\n },\n (cause) => {\n this.owners.forEach((g) => {\n g.error(cause);\n });\n },\n );\n }\n\n public owner() {\n return this.innerOwner;\n }\n\n public size(): number {\n return this.owners.size;\n }\n\n public has(owner: Owner<T>): boolean {\n return this.owners.has(owner);\n }\n\n public add(shouldBePatron: Owner<T>) {\n this.owners.add(shouldBePatron);\n return this;\n }\n\n public remove(g: Owner<T>) {\n this.owners.delete(g);\n return this;\n }\n\n public destroy() {\n this.owners.forEach((g) => {\n this.remove(g);\n });\n return this;\n }\n}\n","import { Owner } from \"../Owner\";\nimport { Information } from \"./Information\";\nimport { OwnerPool } from \"../utils/OwnerPool\";\n\n/**\n * An information object that helps multiple owners access\n * a single another information object\n * https://silentium-lab.github.io/silentium/#/en/information/pool\n */\nexport const pool = <T>(base: Information<T>) => {\n const ownersPool = new OwnerPool<T>();\n let lastValue: T | undefined;\n\n const i = new Information<T>(\n (g) => {\n if (lastValue !== undefined && !ownersPool.has(g)) {\n g.give(lastValue);\n }\n ownersPool.add(g);\n\n return () => {\n ownersPool.destroy();\n };\n },\n \"pool\",\n false,\n );\n i.subInfo(base);\n\n i.executed(() => {\n const gp = ownersPool.owner();\n base.value(\n new Owner((v) => {\n gp.give(v);\n lastValue = v;\n }),\n );\n });\n\n return [i, ownersPool] as const;\n};\n\nexport const poolStateless = <T>(base: Information<T>) => {\n const ownersPool = new OwnerPool<T>();\n\n const i = new Information<T>(\n (g) => {\n ownersPool.add(g);\n\n return () => {\n ownersPool.destroy();\n };\n },\n \"pool\",\n false,\n );\n i.subInfo(base);\n\n i.executed((g) => {\n ownersPool.add(g);\n base.value(ownersPool.owner());\n });\n\n return [i, ownersPool] as const;\n};\n","import { I, Information } from \"../Information\";\nimport { O } from \"../Owner\";\n\n/**\n * A component that takes one value at a time and returns an array\n * https://silentium-lab.github.io/silentium/#/en/information/sequence\n */\nexport const sequence = <T>(base: Information<T>): Information<T[]> => {\n const i = I<T[]>((o) => {\n const result: T[] = [];\n\n base.value(\n O((v) => {\n result.push(v);\n o.give(result);\n }),\n );\n });\n i.subInfo(base);\n\n return i;\n};\n","import { I, Information } from \"../Information\";\nimport { O } from \"../Owner\";\n\n/**\n * Component that receives a data array and yields values one by one\n * https://silentium-lab.github.io/silentium/#/en/information/stream\n */\nexport const stream = <T>(base: Information<T[]>): Information<T> => {\n const i = I<T>((o) => {\n base.value(\n O((v) => {\n v.forEach((cv) => {\n o.give(cv);\n });\n }),\n );\n });\n\n return i;\n};\n","import { I } from \"../Information\";\n\n/**\n * When receiving a reference to a function expecting a callback, the component\n * creates its own callback, and the data received in this callback\n * will become the value of the information object\n * https://silentium-lab.github.io/silentium/#/en/information/from-callback\n */\nexport const fromCallback = <T>(waitForCb: (cb: (v: T) => any) => unknown) => {\n return I((o) => {\n waitForCb((v) => {\n o.give(v);\n });\n });\n};\n","import { I } from \"../Information\";\n\n/**\n * A component that receives data from an event and\n * presents it as an information object\n * https://silentium-lab.github.io/silentium/#/en/information/from-event\n */\nexport const fromEvent = <T extends []>(\n emitter: any,\n eventName: string,\n subscribeMethod: string,\n unsubscribeMethod?: string,\n) => {\n return I((o) => {\n const handler = (...args: T) => {\n o.give(args);\n };\n emitter[subscribeMethod](eventName, handler);\n return () => {\n if (unsubscribeMethod !== undefined) {\n emitter[unsubscribeMethod](eventName, handler);\n }\n };\n });\n};\n","import { I, Information } from \"../Information/Information\";\n\n/**\n * Component that gets a value from a promise and\n * presents it as information\n * https://silentium-lab.github.io/silentium/#/en/information/from-promise\n */\nexport const fromPromise = <T>(p: Promise<T>): Information<T> => {\n return I((o) => {\n p.then((v) => {\n o.give(v);\n }).catch((e) => {\n o.error(e);\n });\n });\n};\n","import { LazyType } from \"../types/LazyType\";\n\n/**\n * Helps to get lazy instance of dependency\n * @url https://silentium-lab.github.io/silentium/#/utils/lazy\n */\nexport const lazy = <T>(buildingFn: (...args: any[]) => T): LazyType<T> => {\n if (buildingFn === undefined) {\n throw new Error(\"lazy didn't receive buildingFn argument\");\n }\n\n return {\n get<R extends unknown[], CT = null>(...args: R): CT extends null ? T : CT {\n return buildingFn(...args) as CT extends null ? T : CT;\n },\n };\n};\n","import { LazyType } from \"../types/LazyType\";\n\ninterface Constructable<T> {\n new (...args: unknown[]): T;\n}\n\ninterface Prototyped<T> {\n prototype: T;\n}\n\n/**\n * Helps create an object from a class\n * https://silentium-lab.github.io/silentium/#/en/utils/lazy-class\n */\nexport const lazyClass = <T>(\n constructorFn: Prototyped<T>,\n modules: Record<string, unknown> = {},\n): LazyType<T> => {\n if (constructorFn === undefined) {\n throw new Error(\"PrivateClass didn't receive constructorFn argument\");\n }\n\n return {\n get<R extends unknown[], CT = null>(...args: R): CT extends null ? T : CT {\n return new (constructorFn as Constructable<T>)(\n ...args,\n modules,\n ) as CT extends null ? T : CT;\n },\n };\n};\n"],"names":["_Information","constructor","info","theName","onlyOneOwner","this","__publicField","instances","next","value","owner","give","Error","name","executedCbs","alreadyExecuted","forEach","cb","mbDestructor","destructor","destroy","theSubInfos","length","subInfo","shift","push","subInfos","executed","hasOwner","Information","I","Owner","ownerFn","errorFn","disposedFn","disposed","error","cause","O","all","infos","i","g","keysKnown","Set","Object","keys","keysFilled","result","entries","key","add","v","size","values","any","chain","theOwner","lastValue","respondedI","WeakMap","handleI","index","nextI","has","set","executorApplied","base","applier","applied","filtered","predicate","defaultValue","ownerApplied","ownerExecutorApplied","executor","ownerSync","syncValue","lazyS","lazyI","destroyI","instance","get","map","targetI","val","valInfo","allI","of","incomeI","relatedO","sharedValue","notifyO","once","isFilled","OwnerPool","owners","innerOwner","shouldBePatron","remove","delete","pool","ownersPool","gp","poolStateless","sequence","o","stream","cv","fromCallback","waitForCb","fromEvent","emitter","eventName","subscribeMethod","unsubscribeMethod","handler","args","fromPromise","p","then","catch","e","lazy","buildingFn","lazyClass","constructorFn","modules"],"mappings":"0JAcO,MAAMA,EAAN,MAAMA,EAQJ,WAAAC,CACGC,EAIAC,EAAU,UACVC,GAAe,GALfC,KAAAH,KAAAA,EAIAG,KAAAF,QAAAA,EACAE,KAAAD,aAAAA,EAZVE,EAAAD,KAAQ,cAAsC,IACtCC,EAAAD,KAAA,cACAC,EAAAD,KAAA,SACAC,EAAAD,KAAA,eACRC,EAAAD,KAAQ,mBAAkB,GAUxBL,EAAYO,WAAa,CAAA,CAMnB,IAAAC,CAAKC,GAIJ,YAHY,IAAfJ,KAAKK,OACFL,KAAAK,MAAMC,KAAKF,GAEXJ,IAAA,CAMF,KAAAI,CAAMC,GACX,GAAIL,KAAKD,mBAA+B,IAAfC,KAAKK,MAC5B,MAAM,IAAIE,MAAM,mCAAmCP,KAAKQ,UAStD,GANJR,KAAKK,MAAQA,OACY,IAArBL,KAAKS,aAA8BT,KAAKU,kBAC1CV,KAAKS,YAAYE,SAASC,GAAOA,EAAGP,KACpCL,KAAKU,iBAAkB,QAGP,IAAdV,KAAKH,KACA,OAAAG,KAGL,GAAqB,mBAAdA,KAAKH,KAAqB,CAC7B,MAAAgB,EAAeb,KAAKH,KAAKQ,QAET,IAApBL,KAAKc,iBACY,IAAjBD,GACAb,KAAKH,OAASgB,GACU,mBAAjBA,IAEPb,KAAKc,WAAaD,EACpB,KAEqB,iBAAdb,KAAKH,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ICPSC,EAAmBC,GACvBhF,GAAG4E,IACRI,GAAW1D,IACTsD,EAAE/F,KAAKyC,EAAC,GACT,ICLQ2D,EAAY,CACvBC,EACAC,EACAC,EACAC,IAEOrF,GAAG4E,IACF,MAAAU,EAAU,IAAIC,KAClBX,EAAE/F,KAAK0G,EAAI,EAGb,OADQL,EAAAE,GAAiBD,EAAWG,GAC7B,UACqB,IAAtBD,GACMH,EAAAG,GAAmBF,EAAWG,EAAO,CAEjD,ICfSE,EAAkBC,GACtBzF,GAAG4E,IACNa,EAAAC,MAAMpE,IACNsD,EAAE/F,KAAKyC,EAAC,IACPqE,OAAOC,IACRhB,EAAEtE,MAAMsF,EAAC,GACV,ICPQC,EAAWC,IACtB,QAAmB,IAAfA,EACI,MAAA,IAAIhH,MAAM,2CAGX,MAAA,CACLsE,QAAuCmC,IAC9BO,KAAcP,GAEzB,ECDWQ,EAAY,CACvBC,EACAC,EAAmC,MAEnC,QAAsB,IAAlBD,EACI,MAAA,IAAIlH,MAAM,sDAGX,MAAA,CACLsE,QAAuCmC,IAC9B,IAAKS,KACPT,EACHU,GAGN"}
|
|
1
|
+
{"version":3,"file":"silentium.min.mjs","sources":["../src/Information/Information.ts","../src/Owner/Owner.ts","../src/Information/All.ts","../src/Information/Any.ts","../src/Information/Chain.ts","../src/Information/ExecutorApplied.ts","../src/Information/Applied.ts","../src/Information/Filtered.ts","../src/Owner/OwnerApplied.ts","../src/Owner/OwnerExecutorApplied.ts","../src/Owner/OwnerSync.ts","../src/Information/Lazy.ts","../src/Information/Map.ts","../src/Information/Of.ts","../src/Information/Once.ts","../src/utils/OwnerPool.ts","../src/Information/Pool.ts","../src/Information/Sequence.ts","../src/Information/Stream.ts","../src/Information/FromCallback.ts","../src/Information/FromEvent.ts","../src/Information/FromPromise.ts","../src/utils/Lazy.ts","../src/utils/LazyClass.ts"],"sourcesContent":["import { Owner } from \"../Owner/Owner\";\nimport { InformationDataType } from \"../types/InformationType\";\n\ntype InfoExecutorType<T> = (g: Owner<T>) => (() => void | undefined) | void;\ntype InfoObjectType<T> = {\n value: InfoExecutorType<T>;\n};\n\ntype InformationExecutedCb<T> = (g: Owner<T>) => void;\n\n/**\n * Main information representation\n * https://silentium-lab.github.io/silentium/#/en/information\n */\nexport class Information<T = any> {\n private static instances = 0;\n private theSubInfos: Information<unknown>[] = [];\n private destructor?: () => void;\n private owner?: Owner<T>;\n private executedCbs?: InformationExecutedCb<T>[];\n private alreadyExecuted = false;\n\n public constructor(\n private info?:\n | InfoObjectType<T>\n | InfoExecutorType<T>\n | InformationDataType<T>,\n private theName = \"unknown\",\n private onlyOneOwner = true,\n ) {\n Information.instances += 1;\n }\n\n /**\n * Следующее значение источника\n */\n private next(value: T) {\n if (this.owner !== undefined) {\n this.owner.give(value);\n }\n return this;\n }\n\n /**\n * Возможность гостю получить информацию от источника\n */\n public value(owner: Owner<T>) {\n if (this.onlyOneOwner && this.owner !== undefined) {\n throw new Error(`owner already connected to info ${this.name()}`);\n }\n\n this.owner = owner;\n if (this.executedCbs !== undefined && !this.alreadyExecuted) {\n this.executedCbs.forEach((cb) => cb(owner));\n this.alreadyExecuted = true;\n }\n\n if (this.info === undefined) {\n return this;\n }\n\n if (typeof this.info === \"function\") {\n const mbDestructor = this.info(owner);\n if (\n this.destructor === undefined &&\n mbDestructor !== undefined &&\n this.info !== mbDestructor &&\n typeof mbDestructor === \"function\"\n ) {\n this.destructor = mbDestructor as () => void;\n }\n } else if (\n typeof this.info === \"object\" &&\n this.info !== null &&\n \"value\" in this.info &&\n typeof this.info.value === \"function\"\n ) {\n this.info.value(owner);\n } else {\n this.next(this.info as T);\n }\n\n return this;\n }\n\n /**\n * Ability to destroy the information info\n */\n public destroy() {\n while (this.theSubInfos.length > 0) {\n const subInfo = this.theSubInfos.shift();\n subInfo?.destroy();\n }\n if (this.destructor) {\n this.destructor();\n }\n this.owner = undefined;\n this.executedCbs = undefined;\n this.destructor = undefined;\n return this;\n }\n\n /**\n * The ability to link another info to the current info\n */\n public subInfo(info: Information<any>) {\n this.theSubInfos.push(info);\n return this;\n }\n\n public subInfos() {\n return this.theSubInfos;\n }\n\n public name() {\n return `#info_${this.theName}_${Information.instances}`;\n }\n\n public executed(cb: InformationExecutedCb<T>) {\n if (!this.executedCbs) {\n this.executedCbs = [];\n }\n this.executedCbs.push(cb);\n if (this.alreadyExecuted && this.owner !== undefined) {\n cb(this.owner);\n }\n return this;\n }\n\n public hasOwner(): boolean {\n return !!this.owner;\n }\n}\n\nexport const I = <T>(\n info?: InfoObjectType<T> | InfoExecutorType<T> | InformationDataType<T>,\n theName = \"unknown\",\n onlyOneOwner = true,\n) => new Information(info, theName, onlyOneOwner);\n","import { OwnerExecutorType } from \"../types/OwnerType\";\n\n/**\n * Information owner, if information\n * has owner than information executed\n * https://silentium-lab.github.io/silentium/#/en/owner\n */\nexport class Owner<T = any> {\n public constructor(\n private ownerFn: OwnerExecutorType<T>,\n private errorFn?: (cause: unknown) => void,\n private disposedFn?: () => boolean,\n ) {}\n\n public give(value: T) {\n if (!this.disposed()) {\n this.ownerFn(value);\n }\n return this;\n }\n\n public error(cause: unknown) {\n if (this.errorFn !== undefined) {\n this.errorFn(cause);\n }\n\n return this;\n }\n\n public disposed() {\n return this.disposedFn !== undefined ? this.disposedFn() : false;\n }\n}\n\nexport const O = <T>(ownerFn: OwnerExecutorType<T>) => new Owner(ownerFn);\n","import { Owner } from \"../Owner/Owner\";\nimport { InformationType } from \"../types/InformationType\";\nimport { Information } from \"./Information\";\n\ntype ExtractType<T> = T extends InformationType<infer U> ? U : never;\ntype ExtractTypeS<T> = T extends Information<infer U> ? U : never;\n\nexport type ExtractTypesFromArray<T extends InformationType<any>[]> = {\n [K in keyof T]: ExtractType<T[K]>;\n};\n\nexport type ExtractTypesFromArrayS<T extends Information<any>[]> = {\n [K in keyof T]: ExtractTypeS<T[K]>;\n};\n\n/**\n * Combines multiple information sources into a single unified source\n * represented as an array containing values from all sources\n * https://silentium-lab.github.io/silentium/#/en/information/all\n */\nexport const all = <const T extends Information[]>(...infos: T) => {\n const i = new Information<ExtractTypesFromArrayS<T>>((g) => {\n const keysKnown = new Set<string>(Object.keys(infos));\n const keysFilled = new Set();\n const isAllFilled = () => {\n return keysFilled.size > 0 && keysFilled.size === keysKnown.size;\n };\n const result: Record<string, unknown> = {};\n\n Object.entries(infos).forEach(([key, info]) => {\n i.subInfo(info);\n keysKnown.add(key);\n info.value(\n new Owner((v) => {\n keysFilled.add(key);\n result[key] = v;\n if (isAllFilled()) {\n g.give(Object.values(result) as ExtractTypesFromArrayS<T>);\n }\n }),\n );\n });\n });\n\n return i;\n};\n","import { I, Information } from \"./Information\";\n\n/**\n * From a set of information sources we get\n * a common response from any source for a single owner\n * https://silentium-lab.github.io/silentium/#/en/information/any\n */\nexport const any = <T>(...infos: Information<T>[]) => {\n const info = I((g) => {\n infos.forEach((info) => {\n info.value(g);\n info.subInfo(info);\n });\n });\n\n return info;\n};\n","import { O, Owner } from \"../Owner/Owner\";\nimport { I, Information } from \"./Information\";\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\ntype Last<T extends any[]> = T extends [...infer U, infer L] ? L : never;\n\n/**\n * The set of information sources forms a sequential chain where each source provides\n * an answer. The final answer will be the output result. If any source in the chain\n * provides a new answer, the component's overall response will be repeated.\n * https://silentium-lab.github.io/silentium/#/en/information/applied\n */\nexport const chain = <T extends Information[]>(\n ...infos: T\n): Information<Last<T>> => {\n let theOwner: Owner<Last<T>> | undefined;\n let lastValue: Last<T> | undefined;\n const respondedI = new WeakMap();\n\n const handleI = (index: number) => {\n const info = infos[index];\n const nextI = infos[index + 1];\n\n info.value(\n O((v) => {\n if (!nextI) {\n lastValue = v;\n theOwner?.give(v);\n }\n\n if (nextI && lastValue !== undefined && theOwner !== undefined) {\n theOwner.give(lastValue);\n }\n\n if (nextI && !respondedI.has(info)) {\n handleI(index + 1);\n }\n\n respondedI.set(info, 1);\n }),\n );\n };\n\n const info = I<Last<T>>((g) => {\n theOwner = g;\n });\n\n info.executed(() => {\n handleI(0);\n });\n\n return info;\n};\n","import { Owner } from \"../Owner/Owner\";\nimport { Information } from \"./Information\";\n\n/**\n * Information to which a function is applied in order\n * to control the value passing process\n * https://silentium-lab.github.io/silentium/#/en/information/applied\n */\nexport const executorApplied = <T>(\n base: Information<T>,\n applier: (executor: Owner<T>) => Owner<T>,\n) => {\n const i = new Information<T>((g) => {\n base.value(applier(g));\n });\n i.subInfo(base);\n\n return i;\n};\n","import { O } from \"../Owner/Owner\";\nimport { I, Information } from \"./Information\";\n\n/**\n * Information to which the function was applied to change the value\n * https://silentium-lab.github.io/silentium/#/en/information/applied\n */\nexport const applied = <T, R>(base: Information<T>, applier: (v: T) => R) => {\n const info = I((g) => {\n base.value(\n O((v) => {\n g.give(applier(v));\n }),\n );\n });\n info.subInfo(base);\n\n return info;\n};\n","import { O } from \"../Owner/Owner\";\nimport { Information } from \"./Information\";\n\n/**\n * Information whose value is being validated\n * via a predicate; if the predicate returns true, the value\n * can be passed to the output\n * https://silentium-lab.github.io/silentium/#/en/information/filtered\n */\nexport const filtered = <T>(\n base: Information<T>,\n predicate: (v: T) => boolean,\n defaultValue?: T,\n) => {\n return new Information<T>((g) => {\n base.value(\n O((v) => {\n if (predicate(v)) {\n g.give(v);\n } else if (defaultValue !== undefined) {\n g.give(defaultValue);\n }\n }),\n );\n }).subInfo(base);\n};\n","import { Owner } from \"./Owner\";\n\n/**\n * Owner to which a function is applied that modifies the incoming\n * value it receives\n * https://silentium-lab.github.io/silentium/#/en/owner/applied\n */\nexport const ownerApplied = <T, R>(\n base: Owner<R>,\n applier: (value: T) => R,\n) => {\n return new Owner<T>(\n (v) => {\n base.give(applier(v));\n },\n (cause) => {\n base.error(cause);\n },\n () => base.disposed(),\n );\n};\n","import { Owner } from \"./Owner\";\n\n/**\n * Owner to which the function is applied that\n * controls the conditions for passing the value\n * https://silentium-lab.github.io/silentium/#/en/owner/executor-applied\n */\nexport const ownerExecutorApplied = <T>(\n base: Owner<T>,\n applier: (ge: (v: T) => void) => (v: T) => void,\n) => {\n const executor = applier((v) => base.give(v));\n return new Owner<T>((v) => {\n executor(v);\n });\n};\n","import { Information } from \"../Information\";\nimport { O } from \".\";\n\nexport interface InfoSync<T> {\n syncValue(): T;\n filled(): boolean;\n}\n\n/**\n * Owner that can return a synchronous value\n * from the information passed to it. If there is no value and no\n * defaultValue, an error will occur\n * https://silentium-lab.github.io/silentium/#/en/owner/sync\n */\nexport const ownerSync = <T>(\n base: Information<T>,\n defaultValue?: T,\n): InfoSync<T> => {\n let lastValue: T | undefined;\n\n base.value(\n O((v) => {\n lastValue = v;\n }),\n );\n\n return {\n syncValue() {\n if (lastValue === undefined && defaultValue === undefined) {\n throw new Error(\"info sync is empty\");\n }\n return (lastValue ?? defaultValue) as T;\n },\n filled() {\n return lastValue !== undefined;\n },\n };\n};\n","import { O } from \"../Owner\";\nimport { LazyType } from \"../types/LazyType\";\nimport { Information } from \"./Information\";\n\n/**\n * Helps in the process of executing information to create\n * a new information object and also destroy it if\n * destruction information is received\n * https://silentium-lab.github.io/silentium/#/en/information/lazy\n */\nexport const lazyS = <T>(\n lazyI: LazyType<Information<T>>,\n destroyI?: Information<unknown>,\n) => {\n const info = new Information<T>((g) => {\n const instance = lazyI.get();\n info.subInfo(instance);\n instance.value(g);\n });\n\n if (destroyI) {\n info.subInfo(destroyI);\n destroyI.value(\n O(() => {\n info.destroy();\n }),\n );\n }\n\n return info;\n};\n","import { InformationDataType } from \"../types\";\nimport { O } from \"../Owner/Owner\";\nimport { LazyType } from \"../types/LazyType\";\nimport { all } from \"./All\";\nimport { I, Information } from \"./Information\";\n\n/**\n * Component that applies an info object constructor to each data item,\n * producing an information source with new values\n * https://silentium-lab.github.io/silentium/#/en/information/map\n */\nexport const map = <T, TG>(\n base: Information<T[]>,\n targetI: LazyType<Information<TG>>,\n) => {\n const i = new Information<TG[]>((g) => {\n base.value(\n O((v) => {\n const infos: Information<TG>[] = [];\n v.forEach((val) => {\n let valInfo: Information<T> | T = val;\n if (!(valInfo instanceof Information)) {\n valInfo = I(val as InformationDataType<T>);\n }\n const info = targetI.get(valInfo);\n infos.push(info);\n });\n const allI = all(...infos).value(g);\n i.subInfo(allI);\n }),\n );\n });\n i.subInfo(base);\n\n return i;\n};\n","import { Owner } from \"../Owner\";\nimport { Information } from \"./Information\";\nimport { InformationDataType } from \"../types/InformationType\";\n\n/**\n * A component that allows creating linked objects of information and its owner\n * in such a way that if a new value is assigned to the owner, this value\n * will become the value of the linked information source\n * https://silentium-lab.github.io/silentium/#/en/information/of\n */\nexport const of = <T>(incomeI?: InformationDataType<T>) => {\n let sharedValue = incomeI as T;\n let relatedO: Owner<T> | undefined;\n\n const notifyO = () => {\n if (relatedO !== undefined) {\n relatedO.give(sharedValue);\n }\n };\n\n const info = new Information<T>((g) => {\n relatedO = g;\n if (sharedValue !== undefined && sharedValue !== null) {\n notifyO();\n }\n }, \"of\");\n\n return [\n info,\n new Owner<T>((v) => {\n sharedValue = v;\n notifyO();\n }),\n ] as const;\n};\n","import { O } from \"../Owner\";\nimport { Information } from \"./Information\";\n\n/**\n * Limits the number of values from the information source\n * to a single value - once the first value is emitted, no more\n * values are delivered from the source\n * https://silentium-lab.github.io/silentium/#/en/information/once\n */\nexport const once = <T>(base: Information<T>) => {\n const info = new Information<T>((g) => {\n let isFilled = false;\n base.value(\n O((v) => {\n if (!isFilled) {\n isFilled = true;\n g.give(v);\n }\n }),\n );\n });\n info.subInfo(base);\n\n return info;\n};\n","import { Owner } from \"../Owner\";\n\n/**\n * Helps maintain an owner list allowing different\n * owners to get information from a common source\n * https://silentium-lab.github.io/silentium/#/en/utils/owner-pool\n */\nexport class OwnerPool<T> {\n private owners: Set<Owner<T>>;\n private innerOwner: Owner<T>;\n\n public constructor() {\n this.owners = new Set<Owner<T>>();\n this.innerOwner = new Owner(\n (v) => {\n this.owners.forEach((g) => {\n g.give(v);\n });\n },\n (cause) => {\n this.owners.forEach((g) => {\n g.error(cause);\n });\n },\n );\n }\n\n public owner() {\n return this.innerOwner;\n }\n\n public size(): number {\n return this.owners.size;\n }\n\n public has(owner: Owner<T>): boolean {\n return this.owners.has(owner);\n }\n\n public add(shouldBePatron: Owner<T>) {\n this.owners.add(shouldBePatron);\n return this;\n }\n\n public remove(g: Owner<T>) {\n this.owners.delete(g);\n return this;\n }\n\n public destroy() {\n this.owners.forEach((g) => {\n this.remove(g);\n });\n return this;\n }\n}\n","import { Owner } from \"../Owner\";\nimport { Information } from \"./Information\";\nimport { OwnerPool } from \"../utils/OwnerPool\";\n\n/**\n * An information object that helps multiple owners access\n * a single another information object\n * https://silentium-lab.github.io/silentium/#/en/information/pool\n */\nexport const pool = <T>(base: Information<T>) => {\n const ownersPool = new OwnerPool<T>();\n let lastValue: T | undefined;\n\n const i = new Information<T>(\n (g) => {\n if (lastValue !== undefined && !ownersPool.has(g)) {\n g.give(lastValue);\n }\n ownersPool.add(g);\n\n return () => {\n ownersPool.destroy();\n };\n },\n \"pool\",\n false,\n );\n i.subInfo(base);\n\n i.executed(() => {\n const gp = ownersPool.owner();\n base.value(\n new Owner((v) => {\n gp.give(v);\n lastValue = v;\n }),\n );\n });\n\n return [i, ownersPool] as const;\n};\n\nexport const poolStateless = <T>(base: Information<T>) => {\n const ownersPool = new OwnerPool<T>();\n\n const i = new Information<T>(\n (g) => {\n ownersPool.add(g);\n\n return () => {\n ownersPool.destroy();\n };\n },\n \"pool\",\n false,\n );\n i.subInfo(base);\n\n i.executed((g) => {\n ownersPool.add(g);\n base.value(ownersPool.owner());\n });\n\n return [i, ownersPool] as const;\n};\n","import { I, Information } from \"../Information\";\nimport { O } from \"../Owner\";\n\n/**\n * A component that takes one value at a time and returns an array\n * https://silentium-lab.github.io/silentium/#/en/information/sequence\n */\nexport const sequence = <T>(base: Information<T>): Information<T[]> => {\n const i = I<T[]>((o) => {\n const result: T[] = [];\n\n base.value(\n O((v) => {\n result.push(v);\n o.give(result);\n }),\n );\n });\n i.subInfo(base);\n\n return i;\n};\n","import { I, Information } from \"../Information\";\nimport { O } from \"../Owner\";\n\n/**\n * Component that receives a data array and yields values one by one\n * https://silentium-lab.github.io/silentium/#/en/information/stream\n */\nexport const stream = <T>(base: Information<T[]>): Information<T> => {\n const i = I<T>((o) => {\n base.value(\n O((v) => {\n v.forEach((cv) => {\n o.give(cv);\n });\n }),\n );\n });\n\n return i;\n};\n","import { I } from \"../Information\";\n\n/**\n * When receiving a reference to a function expecting a callback, the component\n * creates its own callback, and the data received in this callback\n * will become the value of the information object\n * https://silentium-lab.github.io/silentium/#/en/information/from-callback\n */\nexport const fromCallback = <T>(waitForCb: (cb: (v: T) => any) => unknown) => {\n return I((o) => {\n waitForCb((v) => {\n o.give(v);\n });\n });\n};\n","import { I } from \"../Information\";\n\n/**\n * A component that receives data from an event and\n * presents it as an information object\n * https://silentium-lab.github.io/silentium/#/en/information/from-event\n */\nexport const fromEvent = <T extends []>(\n emitter: any,\n eventName: string,\n subscribeMethod: string,\n unsubscribeMethod?: string,\n) => {\n return I((o) => {\n const handler = (...args: T) => {\n o.give(args);\n };\n emitter[subscribeMethod](eventName, handler);\n return () => {\n if (unsubscribeMethod !== undefined) {\n emitter[unsubscribeMethod](eventName, handler);\n }\n };\n });\n};\n","import { I, Information } from \"../Information/Information\";\n\n/**\n * Component that gets a value from a promise and\n * presents it as information\n * https://silentium-lab.github.io/silentium/#/en/information/from-promise\n */\nexport const fromPromise = <T>(p: Promise<T>): Information<T> => {\n return I((o) => {\n p.then((v) => {\n o.give(v);\n }).catch((e) => {\n o.error(e);\n });\n });\n};\n","import { LazyType } from \"../types/LazyType\";\n\n/**\n * Helps to get lazy instance of dependency\n * @url https://silentium-lab.github.io/silentium/#/utils/lazy\n */\nexport const lazy = <T>(buildingFn: (...args: any[]) => T): LazyType<T> => {\n if (buildingFn === undefined) {\n throw new Error(\"lazy didn't receive buildingFn argument\");\n }\n\n return {\n get<R extends unknown[], CT = null>(...args: R): CT extends null ? T : CT {\n return buildingFn(...args) as CT extends null ? T : CT;\n },\n };\n};\n","import { LazyType } from \"../types/LazyType\";\n\ninterface Constructable<T> {\n new (...args: unknown[]): T;\n}\n\ninterface Prototyped<T> {\n prototype: T;\n}\n\n/**\n * Helps create an object from a class\n * https://silentium-lab.github.io/silentium/#/en/utils/lazy-class\n */\nexport const lazyClass = <T>(\n constructorFn: Prototyped<T>,\n modules: Record<string, unknown> = {},\n): LazyType<T> => {\n if (constructorFn === undefined) {\n throw new Error(\"PrivateClass didn't receive constructorFn argument\");\n }\n\n return {\n get<R extends unknown[], CT = null>(...args: R): CT extends null ? T : CT {\n return new (constructorFn as Constructable<T>)(\n ...args,\n modules,\n ) as CT extends null ? T : CT;\n },\n };\n};\n"],"names":["_Information","constructor","info","theName","onlyOneOwner","this","__publicField","instances","next","value","owner","give","Error","name","executedCbs","alreadyExecuted","forEach","cb","mbDestructor","destructor","destroy","theSubInfos","length","subInfo","shift","push","subInfos","executed","hasOwner","Information","I","Owner","ownerFn","errorFn","disposedFn","disposed","error","cause","O","all","infos","i","g","keysKnown","Set","Object","keys","keysFilled","result","entries","key","add","v","size","values","any","chain","theOwner","lastValue","respondedI","WeakMap","handleI","index","nextI","has","set","executorApplied","base","applier","applied","filtered","predicate","defaultValue","ownerApplied","ownerExecutorApplied","executor","ownerSync","syncValue","filled","lazyS","lazyI","destroyI","instance","get","map","targetI","val","valInfo","allI","of","incomeI","relatedO","sharedValue","notifyO","once","isFilled","OwnerPool","owners","innerOwner","shouldBePatron","remove","delete","pool","ownersPool","gp","poolStateless","sequence","o","stream","cv","fromCallback","waitForCb","fromEvent","emitter","eventName","subscribeMethod","unsubscribeMethod","handler","args","fromPromise","p","then","catch","e","lazy","buildingFn","lazyClass","constructorFn","modules"],"mappings":"0JAcO,MAAMA,EAAN,MAAMA,EAQJ,WAAAC,CACGC,EAIAC,EAAU,UACVC,GAAe,GALfC,KAAAH,KAAAA,EAIAG,KAAAF,QAAAA,EACAE,KAAAD,aAAAA,EAZVE,EAAAD,KAAQ,cAAsC,IACtCC,EAAAD,KAAA,cACAC,EA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AmC,MAEnC,QAAsB,IAAlBD,EACI,MAAA,IAAInH,MAAM,sDAGX,MAAA,CACLuE,QAAuCmC,IAC9B,IAAKS,KACPT,EACHU,GAGN"}
|
package/dist/silentium.mjs
CHANGED
package/dist/silentium.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"silentium.mjs","sources":["../src/Information/Information.ts","../src/Owner/Owner.ts","../src/Information/All.ts","../src/Information/Any.ts","../src/Information/Chain.ts","../src/Information/ExecutorApplied.ts","../src/Information/Applied.ts","../src/Information/Filtered.ts","../src/Owner/OwnerApplied.ts","../src/Owner/OwnerExecutorApplied.ts","../src/Owner/OwnerSync.ts","../src/Information/Lazy.ts","../src/Information/Map.ts","../src/Information/Of.ts","../src/Information/Once.ts","../src/utils/OwnerPool.ts","../src/Information/Pool.ts","../src/Information/Sequence.ts","../src/Information/Stream.ts","../src/Information/FromCallback.ts","../src/Information/FromEvent.ts","../src/Information/FromPromise.ts","../src/utils/Lazy.ts","../src/utils/LazyClass.ts"],"sourcesContent":["import { Owner } from \"../Owner/Owner\";\nimport { InformationDataType } from \"../types/InformationType\";\n\ntype InfoExecutorType<T> = (g: Owner<T>) => (() => void | undefined) | void;\ntype InfoObjectType<T> = {\n value: InfoExecutorType<T>;\n};\n\ntype InformationExecutedCb<T> = (g: Owner<T>) => void;\n\n/**\n * Main information representation\n * https://silentium-lab.github.io/silentium/#/en/information\n */\nexport class Information<T = any> {\n private static instances = 0;\n private theSubInfos: Information<unknown>[] = [];\n private destructor?: () => void;\n private owner?: Owner<T>;\n private executedCbs?: InformationExecutedCb<T>[];\n private alreadyExecuted = false;\n\n public constructor(\n private info?:\n | InfoObjectType<T>\n | InfoExecutorType<T>\n | InformationDataType<T>,\n private theName = \"unknown\",\n private onlyOneOwner = true,\n ) {\n Information.instances += 1;\n }\n\n /**\n * Следующее значение источника\n */\n private next(value: T) {\n if (this.owner !== undefined) {\n this.owner.give(value);\n }\n return this;\n }\n\n /**\n * Возможность гостю получить информацию от источника\n */\n public value(owner: Owner<T>) {\n if (this.onlyOneOwner && this.owner !== undefined) {\n throw new Error(`owner already connected to info ${this.name()}`);\n }\n\n this.owner = owner;\n if (this.executedCbs !== undefined && !this.alreadyExecuted) {\n this.executedCbs.forEach((cb) => cb(owner));\n this.alreadyExecuted = true;\n }\n\n if (this.info === undefined) {\n return this;\n }\n\n if (typeof this.info === \"function\") {\n const mbDestructor = this.info(owner);\n if (\n this.destructor === undefined &&\n mbDestructor !== undefined &&\n this.info !== mbDestructor &&\n typeof mbDestructor === \"function\"\n ) {\n this.destructor = mbDestructor as () => void;\n }\n } else if (\n typeof this.info === \"object\" &&\n this.info !== null &&\n \"value\" in this.info &&\n typeof this.info.value === \"function\"\n ) {\n this.info.value(owner);\n } else {\n this.next(this.info as T);\n }\n\n return this;\n }\n\n /**\n * Ability to destroy the information info\n */\n public destroy() {\n while (this.theSubInfos.length > 0) {\n const subInfo = this.theSubInfos.shift();\n subInfo?.destroy();\n }\n if (this.destructor) {\n this.destructor();\n }\n this.owner = undefined;\n this.executedCbs = undefined;\n this.destructor = undefined;\n return this;\n }\n\n /**\n * The ability to link another info to the current info\n */\n public subInfo(info: Information<any>) {\n this.theSubInfos.push(info);\n return this;\n }\n\n public subInfos() {\n return this.theSubInfos;\n }\n\n public name() {\n return `#info_${this.theName}_${Information.instances}`;\n }\n\n public executed(cb: InformationExecutedCb<T>) {\n if (!this.executedCbs) {\n this.executedCbs = [];\n }\n this.executedCbs.push(cb);\n if (this.alreadyExecuted && this.owner !== undefined) {\n cb(this.owner);\n }\n return this;\n }\n\n public hasOwner(): boolean {\n return !!this.owner;\n }\n}\n\nexport const I = <T>(\n info?: InfoObjectType<T> | InfoExecutorType<T> | InformationDataType<T>,\n theName = \"unknown\",\n onlyOneOwner = true,\n) => new Information(info, theName, onlyOneOwner);\n","import { OwnerExecutorType } from \"../types/OwnerType\";\n\n/**\n * Information owner, if information\n * has owner than information executed\n * https://silentium-lab.github.io/silentium/#/en/owner\n */\nexport class Owner<T = any> {\n public constructor(\n private ownerFn: OwnerExecutorType<T>,\n private errorFn?: (cause: unknown) => void,\n private disposedFn?: () => boolean,\n ) {}\n\n public give(value: T) {\n if (!this.disposed()) {\n this.ownerFn(value);\n }\n return this;\n }\n\n public error(cause: unknown) {\n if (this.errorFn !== undefined) {\n this.errorFn(cause);\n }\n\n return this;\n }\n\n public disposed() {\n return this.disposedFn !== undefined ? this.disposedFn() : false;\n }\n}\n\nexport const O = <T>(ownerFn: OwnerExecutorType<T>) => new Owner(ownerFn);\n","import { Owner } from \"../Owner/Owner\";\nimport { InformationType } from \"../types/InformationType\";\nimport { Information } from \"./Information\";\n\ntype ExtractType<T> = T extends InformationType<infer U> ? U : never;\ntype ExtractTypeS<T> = T extends Information<infer U> ? U : never;\n\nexport type ExtractTypesFromArray<T extends InformationType<any>[]> = {\n [K in keyof T]: ExtractType<T[K]>;\n};\n\nexport type ExtractTypesFromArrayS<T extends Information<any>[]> = {\n [K in keyof T]: ExtractTypeS<T[K]>;\n};\n\n/**\n * Combines multiple information sources into a single unified source\n * represented as an array containing values from all sources\n * https://silentium-lab.github.io/silentium/#/en/information/all\n */\nexport const all = <const T extends Information[]>(...infos: T) => {\n const i = new Information<ExtractTypesFromArrayS<T>>((g) => {\n const keysKnown = new Set<string>(Object.keys(infos));\n const keysFilled = new Set();\n const isAllFilled = () => {\n return keysFilled.size > 0 && keysFilled.size === keysKnown.size;\n };\n const result: Record<string, unknown> = {};\n\n Object.entries(infos).forEach(([key, info]) => {\n i.subInfo(info);\n keysKnown.add(key);\n info.value(\n new Owner((v) => {\n keysFilled.add(key);\n result[key] = v;\n if (isAllFilled()) {\n g.give(Object.values(result) as ExtractTypesFromArrayS<T>);\n }\n }),\n );\n });\n });\n\n return i;\n};\n","import { I, Information } from \"./Information\";\n\n/**\n * From a set of information sources we get\n * a common response from any source for a single owner\n * https://silentium-lab.github.io/silentium/#/en/information/any\n */\nexport const any = <T>(...infos: Information<T>[]) => {\n const info = I((g) => {\n infos.forEach((info) => {\n info.value(g);\n info.subInfo(info);\n });\n });\n\n return info;\n};\n","import { O, Owner } from \"../Owner/Owner\";\nimport { I, Information } from \"./Information\";\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\ntype Last<T extends any[]> = T extends [...infer U, infer L] ? L : never;\n\n/**\n * The set of information sources forms a sequential chain where each source provides\n * an answer. The final answer will be the output result. If any source in the chain\n * provides a new answer, the component's overall response will be repeated.\n * https://silentium-lab.github.io/silentium/#/en/information/applied\n */\nexport const chain = <T extends Information[]>(\n ...infos: T\n): Information<Last<T>> => {\n let theOwner: Owner<Last<T>> | undefined;\n let lastValue: Last<T> | undefined;\n const respondedI = new WeakMap();\n\n const handleI = (index: number) => {\n const info = infos[index];\n const nextI = infos[index + 1];\n\n info.value(\n O((v) => {\n if (!nextI) {\n lastValue = v;\n theOwner?.give(v);\n }\n\n if (nextI && lastValue !== undefined && theOwner !== undefined) {\n theOwner.give(lastValue);\n }\n\n if (nextI && !respondedI.has(info)) {\n handleI(index + 1);\n }\n\n respondedI.set(info, 1);\n }),\n );\n };\n\n const info = I<Last<T>>((g) => {\n theOwner = g;\n });\n\n info.executed(() => {\n handleI(0);\n });\n\n return info;\n};\n","import { Owner } from \"../Owner/Owner\";\nimport { Information } from \"./Information\";\n\n/**\n * Information to which a function is applied in order\n * to control the value passing process\n * https://silentium-lab.github.io/silentium/#/en/information/applied\n */\nexport const executorApplied = <T>(\n base: Information<T>,\n applier: (executor: Owner<T>) => Owner<T>,\n) => {\n const i = new Information<T>((g) => {\n base.value(applier(g));\n });\n i.subInfo(base);\n\n return i;\n};\n","import { O } from \"../Owner/Owner\";\nimport { I, Information } from \"./Information\";\n\n/**\n * Information to which the function was applied to change the value\n * https://silentium-lab.github.io/silentium/#/en/information/applied\n */\nexport const applied = <T, R>(base: Information<T>, applier: (v: T) => R) => {\n const info = I((g) => {\n base.value(\n O((v) => {\n g.give(applier(v));\n }),\n );\n });\n info.subInfo(base);\n\n return info;\n};\n","import { O } from \"../Owner/Owner\";\nimport { Information } from \"./Information\";\n\n/**\n * Information whose value is being validated\n * via a predicate; if the predicate returns true, the value\n * can be passed to the output\n * https://silentium-lab.github.io/silentium/#/en/information/filtered\n */\nexport const filtered = <T>(\n base: Information<T>,\n predicate: (v: T) => boolean,\n defaultValue?: T,\n) => {\n return new Information<T>((g) => {\n base.value(\n O((v) => {\n if (predicate(v)) {\n g.give(v);\n } else if (defaultValue !== undefined) {\n g.give(defaultValue);\n }\n }),\n );\n }).subInfo(base);\n};\n","import { Owner } from \"./Owner\";\n\n/**\n * Owner to which a function is applied that modifies the incoming\n * value it receives\n * https://silentium-lab.github.io/silentium/#/en/owner/applied\n */\nexport const ownerApplied = <T, R>(\n base: Owner<R>,\n applier: (value: T) => R,\n) => {\n return new Owner<T>(\n (v) => {\n base.give(applier(v));\n },\n (cause) => {\n base.error(cause);\n },\n () => base.disposed(),\n );\n};\n","import { Owner } from \"./Owner\";\n\n/**\n * Owner to which the function is applied that\n * controls the conditions for passing the value\n * https://silentium-lab.github.io/silentium/#/en/owner/executor-applied\n */\nexport const ownerExecutorApplied = <T>(\n base: Owner<T>,\n applier: (ge: (v: T) => void) => (v: T) => void,\n) => {\n const executor = applier((v) => base.give(v));\n return new Owner<T>((v) => {\n executor(v);\n });\n};\n","import { Information } from \"../Information\";\nimport { O } from \".\";\n\nexport interface infoSync<T> {\n syncValue(): T;\n}\n\n/**\n * Owner that can return a synchronous value\n * from the information passed to it. If there is no value and no\n * defaultValue, an error will occur\n * https://silentium-lab.github.io/silentium/#/en/owner/sync\n */\nexport const ownerSync = <T>(\n base: Information<T>,\n defaultValue?: T,\n): infoSync<T> => {\n let lastValue: T | undefined;\n\n base.value(\n O((v) => {\n lastValue = v;\n }),\n );\n\n return {\n syncValue() {\n if (lastValue === undefined && defaultValue === undefined) {\n throw new Error(\"info sync is empty\");\n }\n return (lastValue ?? defaultValue) as T;\n },\n };\n};\n","import { O } from \"../Owner\";\nimport { LazyType } from \"../types/LazyType\";\nimport { Information } from \"./Information\";\n\n/**\n * Helps in the process of executing information to create\n * a new information object and also destroy it if\n * destruction information is received\n * https://silentium-lab.github.io/silentium/#/en/information/lazy\n */\nexport const lazyS = <T>(\n lazyI: LazyType<Information<T>>,\n destroyI?: Information<unknown>,\n) => {\n const info = new Information<T>((g) => {\n const instance = lazyI.get();\n info.subInfo(instance);\n instance.value(g);\n });\n\n if (destroyI) {\n info.subInfo(destroyI);\n destroyI.value(\n O(() => {\n info.destroy();\n }),\n );\n }\n\n return info;\n};\n","import { InformationDataType } from \"../types\";\nimport { O } from \"../Owner/Owner\";\nimport { LazyType } from \"../types/LazyType\";\nimport { all } from \"./All\";\nimport { I, Information } from \"./Information\";\n\n/**\n * Component that applies an info object constructor to each data item,\n * producing an information source with new values\n * https://silentium-lab.github.io/silentium/#/en/information/map\n */\nexport const map = <T, TG>(\n base: Information<T[]>,\n targetI: LazyType<Information<TG>>,\n) => {\n const i = new Information<TG[]>((g) => {\n base.value(\n O((v) => {\n const infos: Information<TG>[] = [];\n v.forEach((val) => {\n let valInfo: Information<T> | T = val;\n if (!(valInfo instanceof Information)) {\n valInfo = I(val as InformationDataType<T>);\n }\n const info = targetI.get(valInfo);\n infos.push(info);\n });\n const allI = all(...infos).value(g);\n i.subInfo(allI);\n }),\n );\n });\n i.subInfo(base);\n\n return i;\n};\n","import { Owner } from \"../Owner\";\nimport { Information } from \"./Information\";\nimport { InformationDataType } from \"../types/InformationType\";\n\n/**\n * A component that allows creating linked objects of information and its owner\n * in such a way that if a new value is assigned to the owner, this value\n * will become the value of the linked information source\n * https://silentium-lab.github.io/silentium/#/en/information/of\n */\nexport const of = <T>(incomeI?: InformationDataType<T>) => {\n let sharedValue = incomeI as T;\n let relatedO: Owner<T> | undefined;\n\n const notifyO = () => {\n if (relatedO !== undefined) {\n relatedO.give(sharedValue);\n }\n };\n\n const info = new Information<T>((g) => {\n relatedO = g;\n if (sharedValue !== undefined && sharedValue !== null) {\n notifyO();\n }\n }, \"of\");\n\n return [\n info,\n new Owner<T>((v) => {\n sharedValue = v;\n notifyO();\n }),\n ] as const;\n};\n","import { O } from \"../Owner\";\nimport { Information } from \"./Information\";\n\n/**\n * Limits the number of values from the information source\n * to a single value - once the first value is emitted, no more\n * values are delivered from the source\n * https://silentium-lab.github.io/silentium/#/en/information/once\n */\nexport const once = <T>(base: Information<T>) => {\n const info = new Information<T>((g) => {\n let isFilled = false;\n base.value(\n O((v) => {\n if (!isFilled) {\n isFilled = true;\n g.give(v);\n }\n }),\n );\n });\n info.subInfo(base);\n\n return info;\n};\n","import { Owner } from \"../Owner\";\n\n/**\n * Helps maintain an owner list allowing different\n * owners to get information from a common source\n * https://silentium-lab.github.io/silentium/#/en/utils/owner-pool\n */\nexport class OwnerPool<T> {\n private owners: Set<Owner<T>>;\n private innerOwner: Owner<T>;\n\n public constructor() {\n this.owners = new Set<Owner<T>>();\n this.innerOwner = new Owner(\n (v) => {\n this.owners.forEach((g) => {\n g.give(v);\n });\n },\n (cause) => {\n this.owners.forEach((g) => {\n g.error(cause);\n });\n },\n );\n }\n\n public owner() {\n return this.innerOwner;\n }\n\n public size(): number {\n return this.owners.size;\n }\n\n public has(owner: Owner<T>): boolean {\n return this.owners.has(owner);\n }\n\n public add(shouldBePatron: Owner<T>) {\n this.owners.add(shouldBePatron);\n return this;\n }\n\n public remove(g: Owner<T>) {\n this.owners.delete(g);\n return this;\n }\n\n public destroy() {\n this.owners.forEach((g) => {\n this.remove(g);\n });\n return this;\n }\n}\n","import { Owner } from \"../Owner\";\nimport { Information } from \"./Information\";\nimport { OwnerPool } from \"../utils/OwnerPool\";\n\n/**\n * An information object that helps multiple owners access\n * a single another information object\n * https://silentium-lab.github.io/silentium/#/en/information/pool\n */\nexport const pool = <T>(base: Information<T>) => {\n const ownersPool = new OwnerPool<T>();\n let lastValue: T | undefined;\n\n const i = new Information<T>(\n (g) => {\n if (lastValue !== undefined && !ownersPool.has(g)) {\n g.give(lastValue);\n }\n ownersPool.add(g);\n\n return () => {\n ownersPool.destroy();\n };\n },\n \"pool\",\n false,\n );\n i.subInfo(base);\n\n i.executed(() => {\n const gp = ownersPool.owner();\n base.value(\n new Owner((v) => {\n gp.give(v);\n lastValue = v;\n }),\n );\n });\n\n return [i, ownersPool] as const;\n};\n\nexport const poolStateless = <T>(base: Information<T>) => {\n const ownersPool = new OwnerPool<T>();\n\n const i = new Information<T>(\n (g) => {\n ownersPool.add(g);\n\n return () => {\n ownersPool.destroy();\n };\n },\n \"pool\",\n false,\n );\n i.subInfo(base);\n\n i.executed((g) => {\n ownersPool.add(g);\n base.value(ownersPool.owner());\n });\n\n return [i, ownersPool] as const;\n};\n","import { I, Information } from \"../Information\";\nimport { O } from \"../Owner\";\n\n/**\n * A component that takes one value at a time and returns an array\n * https://silentium-lab.github.io/silentium/#/en/information/sequence\n */\nexport const sequence = <T>(base: Information<T>): Information<T[]> => {\n const i = I<T[]>((o) => {\n const result: T[] = [];\n\n base.value(\n O((v) => {\n result.push(v);\n o.give(result);\n }),\n );\n });\n i.subInfo(base);\n\n return i;\n};\n","import { I, Information } from \"../Information\";\nimport { O } from \"../Owner\";\n\n/**\n * Component that receives a data array and yields values one by one\n * https://silentium-lab.github.io/silentium/#/en/information/stream\n */\nexport const stream = <T>(base: Information<T[]>): Information<T> => {\n const i = I<T>((o) => {\n base.value(\n O((v) => {\n v.forEach((cv) => {\n o.give(cv);\n });\n }),\n );\n });\n\n return i;\n};\n","import { I } from \"../Information\";\n\n/**\n * When receiving a reference to a function expecting a callback, the component\n * creates its own callback, and the data received in this callback\n * will become the value of the information object\n * https://silentium-lab.github.io/silentium/#/en/information/from-callback\n */\nexport const fromCallback = <T>(waitForCb: (cb: (v: T) => any) => unknown) => {\n return I((o) => {\n waitForCb((v) => {\n o.give(v);\n });\n });\n};\n","import { I } from \"../Information\";\n\n/**\n * A component that receives data from an event and\n * presents it as an information object\n * https://silentium-lab.github.io/silentium/#/en/information/from-event\n */\nexport const fromEvent = <T extends []>(\n emitter: any,\n eventName: string,\n subscribeMethod: string,\n unsubscribeMethod?: string,\n) => {\n return I((o) => {\n const handler = (...args: T) => {\n o.give(args);\n };\n emitter[subscribeMethod](eventName, handler);\n return () => {\n if (unsubscribeMethod !== undefined) {\n emitter[unsubscribeMethod](eventName, handler);\n }\n };\n });\n};\n","import { I, Information } from \"../Information/Information\";\n\n/**\n * Component that gets a value from a promise and\n * presents it as information\n * https://silentium-lab.github.io/silentium/#/en/information/from-promise\n */\nexport const fromPromise = <T>(p: Promise<T>): Information<T> => {\n return I((o) => {\n p.then((v) => {\n o.give(v);\n }).catch((e) => {\n o.error(e);\n });\n });\n};\n","import { LazyType } from \"../types/LazyType\";\n\n/**\n * Helps to get lazy instance of dependency\n * @url https://silentium-lab.github.io/silentium/#/utils/lazy\n */\nexport const lazy = <T>(buildingFn: (...args: any[]) => T): LazyType<T> => {\n if (buildingFn === undefined) {\n throw new Error(\"lazy didn't receive buildingFn argument\");\n }\n\n return {\n get<R extends unknown[], CT = null>(...args: R): CT extends null ? T : CT {\n return buildingFn(...args) as CT extends null ? T : CT;\n },\n };\n};\n","import { LazyType } from \"../types/LazyType\";\n\ninterface Constructable<T> {\n new (...args: unknown[]): T;\n}\n\ninterface Prototyped<T> {\n prototype: T;\n}\n\n/**\n * Helps create an object from a class\n * https://silentium-lab.github.io/silentium/#/en/utils/lazy-class\n */\nexport const lazyClass = <T>(\n constructorFn: Prototyped<T>,\n modules: Record<string, unknown> = {},\n): LazyType<T> => {\n if (constructorFn === undefined) {\n throw new Error(\"PrivateClass didn't receive constructorFn argument\");\n }\n\n return {\n get<R extends unknown[], CT = null>(...args: R): CT extends null ? T : CT {\n return new (constructorFn as Constructable<T>)(\n ...args,\n modules,\n ) as CT extends null ? T : CT;\n },\n };\n};\n"],"names":["__publicField","info"],"mappings":";;;AAcO,MAAM,YAAA,GAAN,MAAM,YAAqB,CAAA;AAAA,EAQzB,WACG,CAAA,IAAA,EAIA,OAAU,GAAA,SAAA,EACV,eAAe,IACvB,E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AA,SAAA,EAAW,OAAO,CAAA;AAAA;AAC/C,KACF;AAAA,GACD,CAAA;AACH;;ACjBa,MAAA,WAAA,GAAc,CAAI,CAAkC,KAAA;AAC/D,EAAO,OAAA,CAAA,CAAE,CAAC,CAAM,KAAA;AACd,IAAE,CAAA,CAAA,IAAA,CAAK,CAAC,CAAM,KAAA;AACZ,MAAA,CAAA,CAAE,KAAK,CAAC,CAAA;AAAA,KACT,CAAA,CAAE,KAAM,CAAA,CAAC,CAAM,KAAA;AACd,MAAA,CAAA,CAAE,MAAM,CAAC,CAAA;AAAA,KACV,CAAA;AAAA,GACF,CAAA;AACH;;ACTa,MAAA,IAAA,GAAO,CAAI,UAAmD,KAAA;AACzE,EAAA,IAAI,eAAe,MAAW,EAAA;AAC5B,IAAM,MAAA,IAAI,MAAM,yCAAyC,CAAA;AAAA;AAG3D,EAAO,OAAA;AAAA,IACL,OAAuC,IAAmC,EAAA;AACxE,MAAO,OAAA,UAAA,CAAW,GAAG,IAAI,CAAA;AAAA;AAC3B,GACF;AACF;;ACFO,MAAM,SAAY,GAAA,CACvB,aACA,EAAA,OAAA,GAAmC,EACnB,KAAA;AAChB,EAAA,IAAI,kBAAkB,MAAW,EAAA;AAC/B,IAAM,MAAA,IAAI,MAAM,oDAAoD,CAAA;AAAA;AAGtE,EAAO,OAAA;AAAA,IACL,OAAuC,IAAmC,EAAA;AACxE,MAAA,OAAO,IAAK,aAAA;AAAA,QACV,GAAG,IAAA;AAAA,QACH;AAAA,OACF;AAAA;AACF,GACF;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"silentium.mjs","sources":["../src/Information/Information.ts","../src/Owner/Owner.ts","../src/Information/All.ts","../src/Information/Any.ts","../src/Information/Chain.ts","../src/Information/ExecutorApplied.ts","../src/Information/Applied.ts","../src/Information/Filtered.ts","../src/Owner/OwnerApplied.ts","../src/Owner/OwnerExecutorApplied.ts","../src/Owner/OwnerSync.ts","../src/Information/Lazy.ts","../src/Information/Map.ts","../src/Information/Of.ts","../src/Information/Once.ts","../src/utils/OwnerPool.ts","../src/Information/Pool.ts","../src/Information/Sequence.ts","../src/Information/Stream.ts","../src/Information/FromCallback.ts","../src/Information/FromEvent.ts","../src/Information/FromPromise.ts","../src/utils/Lazy.ts","../src/utils/LazyClass.ts"],"sourcesContent":["import { Owner } from \"../Owner/Owner\";\nimport { InformationDataType } from \"../types/InformationType\";\n\ntype InfoExecutorType<T> = (g: Owner<T>) => (() => void | undefined) | void;\ntype InfoObjectType<T> = {\n value: InfoExecutorType<T>;\n};\n\ntype InformationExecutedCb<T> = (g: Owner<T>) => void;\n\n/**\n * Main information representation\n * https://silentium-lab.github.io/silentium/#/en/information\n */\nexport class Information<T = any> {\n private static instances = 0;\n private theSubInfos: Information<unknown>[] = [];\n private destructor?: () => void;\n private owner?: Owner<T>;\n private executedCbs?: InformationExecutedCb<T>[];\n private alreadyExecuted = false;\n\n public constructor(\n private info?:\n | InfoObjectType<T>\n | InfoExecutorType<T>\n | InformationDataType<T>,\n private theName = \"unknown\",\n private onlyOneOwner = true,\n ) {\n Information.instances += 1;\n }\n\n /**\n * Следующее значение источника\n */\n private next(value: T) {\n if (this.owner !== undefined) {\n this.owner.give(value);\n }\n return this;\n }\n\n /**\n * Возможность гостю получить информацию от источника\n */\n public value(owner: Owner<T>) {\n if (this.onlyOneOwner && this.owner !== undefined) {\n throw new Error(`owner already connected to info ${this.name()}`);\n }\n\n this.owner = owner;\n if (this.executedCbs !== undefined && !this.alreadyExecuted) {\n this.executedCbs.forEach((cb) => cb(owner));\n this.alreadyExecuted = true;\n }\n\n if (this.info === undefined) {\n return this;\n }\n\n if (typeof this.info === \"function\") {\n const mbDestructor = this.info(owner);\n if (\n this.destructor === undefined &&\n mbDestructor !== undefined &&\n this.info !== mbDestructor &&\n typeof mbDestructor === \"function\"\n ) {\n this.destructor = mbDestructor as () => void;\n }\n } else if (\n typeof this.info === \"object\" &&\n this.info !== null &&\n \"value\" in this.info &&\n typeof this.info.value === \"function\"\n ) {\n this.info.value(owner);\n } else {\n this.next(this.info as T);\n }\n\n return this;\n }\n\n /**\n * Ability to destroy the information info\n */\n public destroy() {\n while (this.theSubInfos.length > 0) {\n const subInfo = this.theSubInfos.shift();\n subInfo?.destroy();\n }\n if (this.destructor) {\n this.destructor();\n }\n this.owner = undefined;\n this.executedCbs = undefined;\n this.destructor = undefined;\n return this;\n }\n\n /**\n * The ability to link another info to the current info\n */\n public subInfo(info: Information<any>) {\n this.theSubInfos.push(info);\n return this;\n }\n\n public subInfos() {\n return this.theSubInfos;\n }\n\n public name() {\n return `#info_${this.theName}_${Information.instances}`;\n }\n\n public executed(cb: InformationExecutedCb<T>) {\n if (!this.executedCbs) {\n this.executedCbs = [];\n }\n this.executedCbs.push(cb);\n if (this.alreadyExecuted && this.owner !== undefined) {\n cb(this.owner);\n }\n return this;\n }\n\n public hasOwner(): boolean {\n return !!this.owner;\n }\n}\n\nexport const I = <T>(\n info?: InfoObjectType<T> | InfoExecutorType<T> | InformationDataType<T>,\n theName = \"unknown\",\n onlyOneOwner = true,\n) => new Information(info, theName, onlyOneOwner);\n","import { OwnerExecutorType } from \"../types/OwnerType\";\n\n/**\n * Information owner, if information\n * has owner than information executed\n * https://silentium-lab.github.io/silentium/#/en/owner\n */\nexport class Owner<T = any> {\n public constructor(\n private ownerFn: OwnerExecutorType<T>,\n private errorFn?: (cause: unknown) => void,\n private disposedFn?: () => boolean,\n ) {}\n\n public give(value: T) {\n if (!this.disposed()) {\n this.ownerFn(value);\n }\n return this;\n }\n\n public error(cause: unknown) {\n if (this.errorFn !== undefined) {\n this.errorFn(cause);\n }\n\n return this;\n }\n\n public disposed() {\n return this.disposedFn !== undefined ? this.disposedFn() : false;\n }\n}\n\nexport const O = <T>(ownerFn: OwnerExecutorType<T>) => new Owner(ownerFn);\n","import { Owner } from \"../Owner/Owner\";\nimport { InformationType } from \"../types/InformationType\";\nimport { Information } from \"./Information\";\n\ntype ExtractType<T> = T extends InformationType<infer U> ? U : never;\ntype ExtractTypeS<T> = T extends Information<infer U> ? U : never;\n\nexport type ExtractTypesFromArray<T extends InformationType<any>[]> = {\n [K in keyof T]: ExtractType<T[K]>;\n};\n\nexport type ExtractTypesFromArrayS<T extends Information<any>[]> = {\n [K in keyof T]: ExtractTypeS<T[K]>;\n};\n\n/**\n * Combines multiple information sources into a single unified source\n * represented as an array containing values from all sources\n * https://silentium-lab.github.io/silentium/#/en/information/all\n */\nexport const all = <const T extends Information[]>(...infos: T) => {\n const i = new Information<ExtractTypesFromArrayS<T>>((g) => {\n const keysKnown = new Set<string>(Object.keys(infos));\n const keysFilled = new Set();\n const isAllFilled = () => {\n return keysFilled.size > 0 && keysFilled.size === keysKnown.size;\n };\n const result: Record<string, unknown> = {};\n\n Object.entries(infos).forEach(([key, info]) => {\n i.subInfo(info);\n keysKnown.add(key);\n info.value(\n new Owner((v) => {\n keysFilled.add(key);\n result[key] = v;\n if (isAllFilled()) {\n g.give(Object.values(result) as ExtractTypesFromArrayS<T>);\n }\n }),\n );\n });\n });\n\n return i;\n};\n","import { I, Information } from \"./Information\";\n\n/**\n * From a set of information sources we get\n * a common response from any source for a single owner\n * https://silentium-lab.github.io/silentium/#/en/information/any\n */\nexport const any = <T>(...infos: Information<T>[]) => {\n const info = I((g) => {\n infos.forEach((info) => {\n info.value(g);\n info.subInfo(info);\n });\n });\n\n return info;\n};\n","import { O, Owner } from \"../Owner/Owner\";\nimport { I, Information } from \"./Information\";\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\ntype Last<T extends any[]> = T extends [...infer U, infer L] ? L : never;\n\n/**\n * The set of information sources forms a sequential chain where each source provides\n * an answer. The final answer will be the output result. If any source in the chain\n * provides a new answer, the component's overall response will be repeated.\n * https://silentium-lab.github.io/silentium/#/en/information/applied\n */\nexport const chain = <T extends Information[]>(\n ...infos: T\n): Information<Last<T>> => {\n let theOwner: Owner<Last<T>> | undefined;\n let lastValue: Last<T> | undefined;\n const respondedI = new WeakMap();\n\n const handleI = (index: number) => {\n const info = infos[index];\n const nextI = infos[index + 1];\n\n info.value(\n O((v) => {\n if (!nextI) {\n lastValue = v;\n theOwner?.give(v);\n }\n\n if (nextI && lastValue !== undefined && theOwner !== undefined) {\n theOwner.give(lastValue);\n }\n\n if (nextI && !respondedI.has(info)) {\n handleI(index + 1);\n }\n\n respondedI.set(info, 1);\n }),\n );\n };\n\n const info = I<Last<T>>((g) => {\n theOwner = g;\n });\n\n info.executed(() => {\n handleI(0);\n });\n\n return info;\n};\n","import { Owner } from \"../Owner/Owner\";\nimport { Information } from \"./Information\";\n\n/**\n * Information to which a function is applied in order\n * to control the value passing process\n * https://silentium-lab.github.io/silentium/#/en/information/applied\n */\nexport const executorApplied = <T>(\n base: Information<T>,\n applier: (executor: Owner<T>) => Owner<T>,\n) => {\n const i = new Information<T>((g) => {\n base.value(applier(g));\n });\n i.subInfo(base);\n\n return i;\n};\n","import { O } from \"../Owner/Owner\";\nimport { I, Information } from \"./Information\";\n\n/**\n * Information to which the function was applied to change the value\n * https://silentium-lab.github.io/silentium/#/en/information/applied\n */\nexport const applied = <T, R>(base: Information<T>, applier: (v: T) => R) => {\n const info = I((g) => {\n base.value(\n O((v) => {\n g.give(applier(v));\n }),\n );\n });\n info.subInfo(base);\n\n return info;\n};\n","import { O } from \"../Owner/Owner\";\nimport { Information } from \"./Information\";\n\n/**\n * Information whose value is being validated\n * via a predicate; if the predicate returns true, the value\n * can be passed to the output\n * https://silentium-lab.github.io/silentium/#/en/information/filtered\n */\nexport const filtered = <T>(\n base: Information<T>,\n predicate: (v: T) => boolean,\n defaultValue?: T,\n) => {\n return new Information<T>((g) => {\n base.value(\n O((v) => {\n if (predicate(v)) {\n g.give(v);\n } else if (defaultValue !== undefined) {\n g.give(defaultValue);\n }\n }),\n );\n }).subInfo(base);\n};\n","import { Owner } from \"./Owner\";\n\n/**\n * Owner to which a function is applied that modifies the incoming\n * value it receives\n * https://silentium-lab.github.io/silentium/#/en/owner/applied\n */\nexport const ownerApplied = <T, R>(\n base: Owner<R>,\n applier: (value: T) => R,\n) => {\n return new Owner<T>(\n (v) => {\n base.give(applier(v));\n },\n (cause) => {\n base.error(cause);\n },\n () => base.disposed(),\n );\n};\n","import { Owner } from \"./Owner\";\n\n/**\n * Owner to which the function is applied that\n * controls the conditions for passing the value\n * https://silentium-lab.github.io/silentium/#/en/owner/executor-applied\n */\nexport const ownerExecutorApplied = <T>(\n base: Owner<T>,\n applier: (ge: (v: T) => void) => (v: T) => void,\n) => {\n const executor = applier((v) => base.give(v));\n return new Owner<T>((v) => {\n executor(v);\n });\n};\n","import { Information } from \"../Information\";\nimport { O } from \".\";\n\nexport interface InfoSync<T> {\n syncValue(): T;\n filled(): boolean;\n}\n\n/**\n * Owner that can return a synchronous value\n * from the information passed to it. If there is no value and no\n * defaultValue, an error will occur\n * https://silentium-lab.github.io/silentium/#/en/owner/sync\n */\nexport const ownerSync = <T>(\n base: Information<T>,\n defaultValue?: T,\n): InfoSync<T> => {\n let lastValue: T | undefined;\n\n base.value(\n O((v) => {\n lastValue = v;\n }),\n );\n\n return {\n syncValue() {\n if (lastValue === undefined && defaultValue === undefined) {\n throw new Error(\"info sync is empty\");\n }\n return (lastValue ?? defaultValue) as T;\n },\n filled() {\n return lastValue !== undefined;\n },\n };\n};\n","import { O } from \"../Owner\";\nimport { LazyType } from \"../types/LazyType\";\nimport { Information } from \"./Information\";\n\n/**\n * Helps in the process of executing information to create\n * a new information object and also destroy it if\n * destruction information is received\n * https://silentium-lab.github.io/silentium/#/en/information/lazy\n */\nexport const lazyS = <T>(\n lazyI: LazyType<Information<T>>,\n destroyI?: Information<unknown>,\n) => {\n const info = new Information<T>((g) => {\n const instance = lazyI.get();\n info.subInfo(instance);\n instance.value(g);\n });\n\n if (destroyI) {\n info.subInfo(destroyI);\n destroyI.value(\n O(() => {\n info.destroy();\n }),\n );\n }\n\n return info;\n};\n","import { InformationDataType } from \"../types\";\nimport { O } from \"../Owner/Owner\";\nimport { LazyType } from \"../types/LazyType\";\nimport { all } from \"./All\";\nimport { I, Information } from \"./Information\";\n\n/**\n * Component that applies an info object constructor to each data item,\n * producing an information source with new values\n * https://silentium-lab.github.io/silentium/#/en/information/map\n */\nexport const map = <T, TG>(\n base: Information<T[]>,\n targetI: LazyType<Information<TG>>,\n) => {\n const i = new Information<TG[]>((g) => {\n base.value(\n O((v) => {\n const infos: Information<TG>[] = [];\n v.forEach((val) => {\n let valInfo: Information<T> | T = val;\n if (!(valInfo instanceof Information)) {\n valInfo = I(val as InformationDataType<T>);\n }\n const info = targetI.get(valInfo);\n infos.push(info);\n });\n const allI = all(...infos).value(g);\n i.subInfo(allI);\n }),\n );\n });\n i.subInfo(base);\n\n return i;\n};\n","import { Owner } from \"../Owner\";\nimport { Information } from \"./Information\";\nimport { InformationDataType } from \"../types/InformationType\";\n\n/**\n * A component that allows creating linked objects of information and its owner\n * in such a way that if a new value is assigned to the owner, this value\n * will become the value of the linked information source\n * https://silentium-lab.github.io/silentium/#/en/information/of\n */\nexport const of = <T>(incomeI?: InformationDataType<T>) => {\n let sharedValue = incomeI as T;\n let relatedO: Owner<T> | undefined;\n\n const notifyO = () => {\n if (relatedO !== undefined) {\n relatedO.give(sharedValue);\n }\n };\n\n const info = new Information<T>((g) => {\n relatedO = g;\n if (sharedValue !== undefined && sharedValue !== null) {\n notifyO();\n }\n }, \"of\");\n\n return [\n info,\n new Owner<T>((v) => {\n sharedValue = v;\n notifyO();\n }),\n ] as const;\n};\n","import { O } from \"../Owner\";\nimport { Information } from \"./Information\";\n\n/**\n * Limits the number of values from the information source\n * to a single value - once the first value is emitted, no more\n * values are delivered from the source\n * https://silentium-lab.github.io/silentium/#/en/information/once\n */\nexport const once = <T>(base: Information<T>) => {\n const info = new Information<T>((g) => {\n let isFilled = false;\n base.value(\n O((v) => {\n if (!isFilled) {\n isFilled = true;\n g.give(v);\n }\n }),\n );\n });\n info.subInfo(base);\n\n return info;\n};\n","import { Owner } from \"../Owner\";\n\n/**\n * Helps maintain an owner list allowing different\n * owners to get information from a common source\n * https://silentium-lab.github.io/silentium/#/en/utils/owner-pool\n */\nexport class OwnerPool<T> {\n private owners: Set<Owner<T>>;\n private innerOwner: Owner<T>;\n\n public constructor() {\n this.owners = new Set<Owner<T>>();\n this.innerOwner = new Owner(\n (v) => {\n this.owners.forEach((g) => {\n g.give(v);\n });\n },\n (cause) => {\n this.owners.forEach((g) => {\n g.error(cause);\n });\n },\n );\n }\n\n public owner() {\n return this.innerOwner;\n }\n\n public size(): number {\n return this.owners.size;\n }\n\n public has(owner: Owner<T>): boolean {\n return this.owners.has(owner);\n }\n\n public add(shouldBePatron: Owner<T>) {\n this.owners.add(shouldBePatron);\n return this;\n }\n\n public remove(g: Owner<T>) {\n this.owners.delete(g);\n return this;\n }\n\n public destroy() {\n this.owners.forEach((g) => {\n this.remove(g);\n });\n return this;\n }\n}\n","import { Owner } from \"../Owner\";\nimport { Information } from \"./Information\";\nimport { OwnerPool } from \"../utils/OwnerPool\";\n\n/**\n * An information object that helps multiple owners access\n * a single another information object\n * https://silentium-lab.github.io/silentium/#/en/information/pool\n */\nexport const pool = <T>(base: Information<T>) => {\n const ownersPool = new OwnerPool<T>();\n let lastValue: T | undefined;\n\n const i = new Information<T>(\n (g) => {\n if (lastValue !== undefined && !ownersPool.has(g)) {\n g.give(lastValue);\n }\n ownersPool.add(g);\n\n return () => {\n ownersPool.destroy();\n };\n },\n \"pool\",\n false,\n );\n i.subInfo(base);\n\n i.executed(() => {\n const gp = ownersPool.owner();\n base.value(\n new Owner((v) => {\n gp.give(v);\n lastValue = v;\n }),\n );\n });\n\n return [i, ownersPool] as const;\n};\n\nexport const poolStateless = <T>(base: Information<T>) => {\n const ownersPool = new OwnerPool<T>();\n\n const i = new Information<T>(\n (g) => {\n ownersPool.add(g);\n\n return () => {\n ownersPool.destroy();\n };\n },\n \"pool\",\n false,\n );\n i.subInfo(base);\n\n i.executed((g) => {\n ownersPool.add(g);\n base.value(ownersPool.owner());\n });\n\n return [i, ownersPool] as const;\n};\n","import { I, Information } from \"../Information\";\nimport { O } from \"../Owner\";\n\n/**\n * A component that takes one value at a time and returns an array\n * https://silentium-lab.github.io/silentium/#/en/information/sequence\n */\nexport const sequence = <T>(base: Information<T>): Information<T[]> => {\n const i = I<T[]>((o) => {\n const result: T[] = [];\n\n base.value(\n O((v) => {\n result.push(v);\n o.give(result);\n }),\n );\n });\n i.subInfo(base);\n\n return i;\n};\n","import { I, Information } from \"../Information\";\nimport { O } from \"../Owner\";\n\n/**\n * Component that receives a data array and yields values one by one\n * https://silentium-lab.github.io/silentium/#/en/information/stream\n */\nexport const stream = <T>(base: Information<T[]>): Information<T> => {\n const i = I<T>((o) => {\n base.value(\n O((v) => {\n v.forEach((cv) => {\n o.give(cv);\n });\n }),\n );\n });\n\n return i;\n};\n","import { I } from \"../Information\";\n\n/**\n * When receiving a reference to a function expecting a callback, the component\n * creates its own callback, and the data received in this callback\n * will become the value of the information object\n * https://silentium-lab.github.io/silentium/#/en/information/from-callback\n */\nexport const fromCallback = <T>(waitForCb: (cb: (v: T) => any) => unknown) => {\n return I((o) => {\n waitForCb((v) => {\n o.give(v);\n });\n });\n};\n","import { I } from \"../Information\";\n\n/**\n * A component that receives data from an event and\n * presents it as an information object\n * https://silentium-lab.github.io/silentium/#/en/information/from-event\n */\nexport const fromEvent = <T extends []>(\n emitter: any,\n eventName: string,\n subscribeMethod: string,\n unsubscribeMethod?: string,\n) => {\n return I((o) => {\n const handler = (...args: T) => {\n o.give(args);\n };\n emitter[subscribeMethod](eventName, handler);\n return () => {\n if (unsubscribeMethod !== undefined) {\n emitter[unsubscribeMethod](eventName, handler);\n }\n };\n });\n};\n","import { I, Information } from \"../Information/Information\";\n\n/**\n * Component that gets a value from a promise and\n * presents it as information\n * https://silentium-lab.github.io/silentium/#/en/information/from-promise\n */\nexport const fromPromise = <T>(p: Promise<T>): Information<T> => {\n return I((o) => {\n p.then((v) => {\n o.give(v);\n }).catch((e) => {\n o.error(e);\n });\n });\n};\n","import { LazyType } from \"../types/LazyType\";\n\n/**\n * Helps to get lazy instance of dependency\n * @url https://silentium-lab.github.io/silentium/#/utils/lazy\n */\nexport const lazy = <T>(buildingFn: (...args: any[]) => T): LazyType<T> => {\n if (buildingFn === undefined) {\n throw new Error(\"lazy didn't receive buildingFn argument\");\n }\n\n return {\n get<R extends unknown[], CT = null>(...args: R): CT extends null ? T : CT {\n return buildingFn(...args) as CT extends null ? T : CT;\n },\n };\n};\n","import { LazyType } from \"../types/LazyType\";\n\ninterface Constructable<T> {\n new (...args: unknown[]): T;\n}\n\ninterface Prototyped<T> {\n prototype: T;\n}\n\n/**\n * Helps create an object from a class\n * https://silentium-lab.github.io/silentium/#/en/utils/lazy-class\n */\nexport const lazyClass = <T>(\n constructorFn: Prototyped<T>,\n modules: Record<string, unknown> = {},\n): LazyType<T> => {\n if (constructorFn === undefined) {\n throw new Error(\"PrivateClass didn't receive constructorFn argument\");\n }\n\n return {\n get<R extends unknown[], CT = null>(...args: R): CT extends null ? T : CT {\n return new (constructorFn as Constructable<T>)(\n ...args,\n modules,\n ) as CT extends null ? T : CT;\n },\n };\n};\n"],"names":["__publicField","info"],"mappings":";;;AAcO,MAAM,YAAA,GAAN,MAAM,YAAqB,CAAA;AAAA,EAQzB,WACG,CAAA,IAAA,EAIA,OAAU,GAAA,SAAA,EACV,eAAe,IACvB,EAAA;AANQ,IAAA,IAAA,CAAA,IAAA,GAAA,IAAA;AAIA,IAAA,IAAA,CAAA,OAAA,GAAA,OAAA;AACA,IAAA,IAAA,CAAA,YAAA,GAAA,YAAA;AAZV,IAAAA,eAAA,CAAA,IAAA,EAAQ,eAAsC,EAAC,CAAA;AAC/C,IAAQA,eAAA,CAAA,IAAA,EAAA,YAAA,CAAA;AACR,IAAQA,eAAA,CAAA,IAAA,EAAA,OAAA,CAAA;AACR,IAAQA,eAAA,CAAA,IAAA,EAAA,aAAA,CAAA;AACR,IAAAA,eAAA,CAAA,IAAA,EAAQ,iBAAkB,EAAA,KAAA,CAAA;AAUxB,IAAA,YAAA,CAAY,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AAA,KACV,CAAA;AAAA,GACF,CAAA;AACH;;ACTa,MAAA,IAAA,GAAO,CAAI,UAAmD,KAAA;AACzE,EAAA,IAAI,eAAe,MAAW,EAAA;AAC5B,IAAM,MAAA,IAAI,MAAM,yCAAyC,CAAA;AAAA;AAG3D,EAAO,OAAA;AAAA,IACL,OAAuC,IAAmC,EAAA;AACxE,MAAO,OAAA,UAAA,CAAW,GAAG,IAAI,CAAA;AAAA;AAC3B,GACF;AACF;;ACFO,MAAM,SAAY,GAAA,CACvB,aACA,EAAA,OAAA,GAAmC,EACnB,KAAA;AAChB,EAAA,IAAI,kBAAkB,MAAW,EAAA;AAC/B,IAAM,MAAA,IAAI,MAAM,oDAAoD,CAAA;AAAA;AAGtE,EAAO,OAAA;AAAA,IACL,OAAuC,IAAmC,EAAA;AACxE,MAAA,OAAO,IAAK,aAAA;AAAA,QACV,GAAG,IAAA;AAAA,QACH;AAAA,OACF;AAAA;AACF,GACF;AACF;;;;"}
|
package/package.json
CHANGED
package/src/Owner/OwnerSync.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Information } from "../Information";
|
|
2
2
|
import { O } from ".";
|
|
3
3
|
|
|
4
|
-
export interface
|
|
4
|
+
export interface InfoSync<T> {
|
|
5
5
|
syncValue(): T;
|
|
6
|
+
filled(): boolean;
|
|
6
7
|
}
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -14,7 +15,7 @@ export interface infoSync<T> {
|
|
|
14
15
|
export const ownerSync = <T>(
|
|
15
16
|
base: Information<T>,
|
|
16
17
|
defaultValue?: T,
|
|
17
|
-
):
|
|
18
|
+
): InfoSync<T> => {
|
|
18
19
|
let lastValue: T | undefined;
|
|
19
20
|
|
|
20
21
|
base.value(
|
|
@@ -30,5 +31,8 @@ export const ownerSync = <T>(
|
|
|
30
31
|
}
|
|
31
32
|
return (lastValue ?? defaultValue) as T;
|
|
32
33
|
},
|
|
34
|
+
filled() {
|
|
35
|
+
return lastValue !== undefined;
|
|
36
|
+
},
|
|
33
37
|
};
|
|
34
38
|
};
|