patron-oop 1.27.0 → 1.29.0

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,20 @@
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
+ ## [1.29.0](https://github.com/kosukhin/patron/compare/v1.28.0...v1.29.0) (2024-12-23)
6
+
7
+
8
+ ### Features
9
+
10
+ * **issue-9:** module class added ([0ffe862](https://github.com/kosukhin/patron/commit/0ffe86293a00c5559016965a3683fd10906e21f4))
11
+
12
+ ## [1.28.0](https://github.com/kosukhin/patron/compare/v1.27.0...v1.28.0) (2024-12-15)
13
+
14
+
15
+ ### Features
16
+
17
+ * **main:** use any for guest cast ([8e6a19c](https://github.com/kosukhin/patron/commit/8e6a19c67bbbadfc703b5c1b1a3f6fd90c252d33))
18
+
5
19
  ## [1.27.0](https://github.com/kosukhin/patron/compare/v1.26.0...v1.27.0) (2024-12-15)
6
20
 
7
21
 
package/dist/patron.cjs CHANGED
@@ -404,17 +404,16 @@ class Factory {
404
404
  }
405
405
  }
406
406
 
407
- class FactoryDynamic {
408
- constructor(creationFn) {
409
- this.creationFn = creationFn;
407
+ class Module {
408
+ constructor(buildingFn) {
409
+ this.buildingFn = buildingFn;
410
410
  }
411
411
  create(...args) {
412
- return this.creationFn(...args);
412
+ return this.buildingFn(...args);
413
413
  }
414
414
  }
415
415
 
416
416
  exports.Factory = Factory;
417
- exports.FactoryDynamic = FactoryDynamic;
418
417
  exports.Guest = Guest;
419
418
  exports.GuestAware = GuestAware;
420
419
  exports.GuestCast = GuestCast;
@@ -423,6 +422,7 @@ exports.GuestDisposable = GuestDisposable;
423
422
  exports.GuestObject = GuestObject;
424
423
  exports.GuestPool = GuestPool;
425
424
  exports.GuestSync = GuestSync;
425
+ exports.Module = Module;
426
426
  exports.Patron = Patron;
427
427
  exports.PatronOnce = PatronOnce;
428
428
  exports.PatronPool = PatronPool;
@@ -1 +1 @@
1
- {"version":3,"file":"patron.cjs","sources":["../src/Guest/GuestAware.ts","../src/Guest/Guest.ts","../src/Guest/GuestCast.ts","../src/Patron/PatronPool.ts","../src/Source/Source.ts","../src/Guest/GuestObject.ts","../src/Guest/GuestPool.ts","../src/Guest/GuestChain.ts","../src/Guest/GuestSync.ts","../src/Guest/GuestDisposable.ts","../src/Patron/Patron.ts","../src/Patron/PatronOnce.ts","../src/Source/SourceEmpty.ts","../src/Factory/Factory.ts","../src/Factory/FactoryDynamic.ts"],"sourcesContent":["import { GuestType } from \"./Guest\";\n\nexport interface GuestAwareType<T = any> {\n value(guest: GuestType<T>): unknown;\n}\n\nexport class GuestAware<T = any> implements GuestAwareType<T> {\n public constructor(private guestReceiver: (guest: GuestType<T>) => void) { }\n\n public value(guest: GuestType<T>): GuestType<T> {\n this.guestReceiver(guest);\n return guest;\n }\n}\n","type GuestIntroduction = \"guest\" | \"patron\";\n\nexport interface GiveOptions {\n data?: unknown;\n}\n\nexport type GuestExecutorType<T = any> = (\n value: T,\n options?: GiveOptions,\n) => void;\n\nexport interface GuestObjectType<T = any> {\n give(value: T, options?: GiveOptions): this;\n introduction?(): GuestIntroduction;\n}\n\nexport type GuestType<T = any> = GuestExecutorType<T> | GuestObjectType<T>;\n\nexport function give<T>(data: T, guest: GuestType<T>, options?: GiveOptions) {\n if (typeof guest === \"function\") {\n guest(data, options);\n } else {\n guest.give(data, options);\n }\n}\n\nexport class Guest<T> implements GuestObjectType<T> {\n public constructor(private receiver: GuestExecutorType<T>) { }\n\n public give(value: T, options?: GiveOptions) {\n this.receiver(value, options);\n return this;\n }\n}\n","import {\n GuestDisposableType,\n MaybeDisposableType,\n} from \"src/Guest/GuestDisposable\";\nimport { give, GiveOptions, GuestType } from \"./Guest\";\n\nexport class GuestCast<T> implements GuestDisposableType<T> {\n public constructor(\n private sourceGuest: GuestType<unknown>,\n private targetGuest: GuestType<T>,\n ) {}\n\n public introduction() {\n if (typeof this.sourceGuest === \"function\") {\n return \"guest\";\n }\n if (!this.sourceGuest.introduction) {\n return \"guest\";\n }\n return this.sourceGuest.introduction();\n }\n\n public give(value: T, options?: GiveOptions): this {\n give(value, this.targetGuest, options);\n return this;\n }\n\n public disposed(value: T | null): boolean {\n const maybeDisposable = this.sourceGuest as MaybeDisposableType;\n return maybeDisposable.disposed ? maybeDisposable.disposed(value) : false;\n }\n}\n","import { GuestDisposableType } from \"../Guest/GuestDisposable\";\nimport { give, GuestObjectType, GuestType, GiveOptions } from \"../Guest/Guest\";\n\nconst poolSets = new Map<PoolType, Set<GuestObjectType>>();\n\n// remove patron from all pools\nexport const removePatronFromPools = (patron: GuestObjectType) => {\n poolSets.forEach((pool) => {\n pool.delete(patron);\n });\n};\n\n// check patron existed in any pool\nexport const isPatronInPools = (patron: GuestObjectType) => {\n let inPool = false;\n poolSets.forEach((pool) => {\n if (!inPool) {\n inPool = pool.has(patron);\n }\n });\n return inPool;\n};\n\nexport interface PoolType<T = any> extends GuestObjectType<T> {\n add(guest: GuestObjectType<T>): this;\n distribute(receiving: T, possiblePatron: GuestObjectType<T>): this;\n remove(patron: GuestObjectType<T>): this;\n size(): number;\n}\n\nexport class PatronPool<T> implements PoolType<T> {\n private patrons: Set<GuestObjectType<T>>;\n\n public give: (value: T, options?: GiveOptions) => this;\n\n public constructor(private initiator: unknown) {\n this.patrons = new Set<GuestObjectType<T>>();\n poolSets.set(this, this.patrons);\n let lastMicrotask: (() => void) | null = null;\n const doReceive = (value: T, options?: GiveOptions) => {\n this.patrons.forEach((target) => {\n this.sendValueToGuest(value, target, options);\n });\n };\n this.give = (value: T, options?: GiveOptions) => {\n const currentMicroTask = () => {\n if (currentMicroTask === lastMicrotask) {\n doReceive(value, options);\n }\n };\n lastMicrotask = currentMicroTask;\n queueMicrotask(currentMicroTask);\n return this;\n };\n }\n\n public size(): number {\n return this.patrons.size;\n }\n\n public add(shouldBePatron: GuestType<T>) {\n if (!shouldBePatron) {\n throw new Error(\"PatronPool add method received nothing!\");\n }\n if (\n typeof shouldBePatron !== \"function\" &&\n shouldBePatron.introduction &&\n shouldBePatron.introduction() === \"patron\"\n ) {\n this.patrons.add(shouldBePatron);\n }\n return this;\n }\n\n public remove(patron: GuestObjectType<T>) {\n this.patrons.delete(patron);\n return this;\n }\n\n public distribute(receiving: T, possiblePatron: GuestType<T>): this {\n this.add(possiblePatron);\n this.sendValueToGuest(receiving, possiblePatron, {});\n return this;\n }\n\n private sendValueToGuest(\n value: T,\n guest: GuestType<T>,\n options?: GiveOptions,\n ) {\n const isDisposed = this.guestDisposed(value, guest);\n\n if (!isDisposed) {\n give(value, guest, {\n ...options,\n data: {\n ...((options?.data as Record<string, unknown>) ?? {}),\n initiator: this.initiator,\n pool: this,\n },\n });\n }\n }\n\n private guestDisposed(value: T, guest: GuestType<T>) {\n if ((guest as GuestDisposableType).disposed?.(value)) {\n this.remove(guest as GuestObjectType);\n return true;\n }\n\n return false;\n }\n}\n","import { GuestAwareType } from \"../Guest/GuestAware\";\nimport { Guest, GuestObjectType, GuestType } from \"../Guest/Guest\";\nimport { PatronPool } from \"../Patron/PatronPool\";\n\nexport interface PoolAware<T = any> {\n pool(): PatronPool<T>;\n}\n\nexport type SourceType<T = any> = GuestAwareType<T> &\n GuestObjectType<T> &\n PoolAware<T>;\n\nexport class Source<T> implements SourceType<T> {\n private thePool = new PatronPool(this);\n\n public constructor(private sourceDocument: T) { }\n\n public pool() {\n return this.thePool;\n }\n\n public give(value: T): this {\n this.sourceDocument = value;\n this.thePool.give(this.sourceDocument);\n return this;\n }\n\n public value(guest: GuestType<T>): this {\n if (typeof guest === \"function\") {\n this.thePool.distribute(this.sourceDocument, new Guest(guest));\n } else {\n this.thePool.distribute(this.sourceDocument, guest);\n }\n return this;\n }\n}\n","import {\n GuestDisposableType,\n MaybeDisposableType,\n} from \"src/Guest/GuestDisposable\";\nimport { GiveOptions, Guest, GuestType } from \"./Guest\";\n\nexport class GuestObject<T> implements GuestDisposableType<T> {\n public constructor(private baseGuest: GuestType<T>) {}\n\n public give(value: T, options?: GiveOptions): this {\n let guest = this.baseGuest;\n if (typeof guest === \"function\") {\n guest = new Guest(guest);\n }\n guest.give(value, options);\n return this;\n }\n\n public introduction() {\n if (typeof this.baseGuest === \"function\" || !this.baseGuest.introduction) {\n return \"guest\";\n }\n return this.baseGuest.introduction();\n }\n\n public disposed(value: T | null): boolean {\n const maybeDisposable = this.baseGuest as MaybeDisposableType;\n return maybeDisposable.disposed ? maybeDisposable.disposed(value) : false;\n }\n}\n","import { PatronPool } from \"../Patron/PatronPool\";\nimport { PoolType } from \"../Patron/PatronPool\";\nimport { give, GuestObjectType, GuestType, GiveOptions } from \"./Guest\";\n\nexport class GuestPool<T> implements GuestObjectType<T>, PoolType<T> {\n private guests = new Set<GuestType<T>>();\n\n private patronPool: PatronPool<T>;\n\n public constructor(initiator: unknown) {\n this.patronPool = new PatronPool(initiator);\n }\n\n public give(value: T, options?: GiveOptions): this {\n this.deliverToGuests(value, options);\n this.patronPool.give(value, options);\n return this;\n }\n\n public add(guest: GuestType<T>): this {\n if (\n typeof guest === \"function\" ||\n !guest.introduction ||\n guest.introduction() === \"guest\"\n ) {\n this.guests.add(guest);\n }\n this.patronPool.add(guest);\n return this;\n }\n\n public remove(patron: GuestObjectType<T>): this {\n this.guests.delete(patron);\n this.patronPool.remove(patron);\n return this;\n }\n\n public distribute(receiving: T, possiblePatron: GuestObjectType<T>): this {\n this.add(possiblePatron);\n this.give(receiving);\n return this;\n }\n\n public size() {\n return this.patronPool.size() + this.guests.size;\n }\n\n private deliverToGuests(value: T, options?: GiveOptions) {\n this.guests.forEach((target) => {\n give(value, target, options);\n });\n this.guests.clear();\n }\n}\n","import { GuestCast } from \"./GuestCast\";\nimport { Source } from \"../Source/Source\";\nimport { Guest, GuestObjectType, GuestType } from \"./Guest\";\nimport { GuestObject } from \"./GuestObject\";\nimport { GuestPool } from \"./GuestPool\";\n\nexport interface ChainType<T = any> {\n result(guest: GuestObjectType<T>): this;\n resultArray(guest: GuestObjectType<T>): this;\n receiveKey<R>(key: string): GuestObjectType<R>;\n}\n\nexport class GuestChain<T> implements ChainType<T> {\n private theChain: Source<Record<string, unknown>>;\n\n private keysKnown = new Set();\n\n private keysFilled = new Set();\n\n private filledChainPool = new GuestPool(this);\n\n public constructor() {\n this.theChain = new Source<Record<string, unknown>>({});\n }\n\n public resultArray(guest: GuestType<T>) {\n const guestObject = new GuestObject(guest);\n this.filledChainPool.add(\n new GuestCast(guestObject, (value: Record<string, unknown>) => {\n guestObject.give(Object.values(value) as T);\n }),\n );\n if (this.isChainFilled()) {\n this.theChain.value(\n new Guest((chain: Record<string, unknown>) => {\n this.filledChainPool.give(Object.values(chain));\n }),\n );\n }\n return this;\n }\n\n public result(guest: GuestType<T>) {\n const guestObject = new GuestObject(guest);\n if (this.isChainFilled()) {\n this.filledChainPool.add(guestObject);\n this.theChain.value(\n new Guest((chain) => {\n this.filledChainPool.give(chain);\n }),\n );\n } else {\n this.filledChainPool.add(guestObject);\n }\n return this;\n }\n\n public receiveKey<R>(key: string): GuestObjectType<R> {\n this.keysKnown.add(key);\n return new Guest((value) => {\n // Обернул в очередь чтобы можно было синхронно наполнить очередь известных ключей\n queueMicrotask(() => {\n this.theChain.value(\n new Guest((chain: Record<string, unknown>) => {\n this.keysFilled.add(key);\n const lastChain = {\n ...chain,\n [key]: value,\n };\n this.theChain.give(lastChain);\n if (this.isChainFilled()) {\n this.filledChainPool.give(lastChain);\n }\n }),\n );\n });\n });\n }\n\n private isChainFilled() {\n return (\n this.keysFilled.size > 0 && this.keysFilled.size === this.keysKnown.size\n );\n }\n}\n","import { GuestObjectType } from \"./Guest\";\n\nexport interface GuestValueType<T = any> extends GuestObjectType<T> {\n value(): T;\n}\n\nexport class GuestSync<T> implements GuestValueType<T> {\n public constructor(private theValue: T) { }\n\n public give(value: T): this {\n this.theValue = value;\n return this;\n }\n\n public value() {\n return this.theValue;\n }\n}\n","import { give, GiveOptions, GuestObjectType, GuestType } from \"./Guest\";\n\nexport interface GuestDisposableType<T = any> extends GuestObjectType<T> {\n disposed(value: T | null): boolean;\n}\n\nexport type MaybeDisposableType<T = any> = Partial<GuestDisposableType<T>>;\n\nexport class GuestDisposable<T> implements GuestDisposableType<T> {\n public constructor(\n private guest: GuestType,\n private disposeCheck: (value: T | null) => boolean,\n ) { }\n\n public disposed(value: T | null): boolean {\n return this.disposeCheck(value);\n }\n\n public give(value: T, options?: GiveOptions): this {\n give(value, this.guest, options);\n return this;\n }\n}\n","import { GuestDisposableType } from \"../Guest/GuestDisposable\";\nimport { give, GiveOptions, GuestType } from \"../Guest/Guest\";\n\nexport class Patron<T> implements GuestDisposableType<T> {\n public constructor(private willBePatron: GuestType<T>) {}\n\n public introduction() {\n return \"patron\" as const;\n }\n\n public give(value: T, options?: GiveOptions): this {\n give(value, this.willBePatron, options);\n return this;\n }\n\n public disposed(value: T | null): boolean {\n const maybeDisposable = this.willBePatron as GuestDisposableType;\n return maybeDisposable?.disposed?.(value) || false;\n }\n}\n","import { PoolType } from \"./PatronPool\";\nimport { give, GuestType, GiveOptions } from \"../Guest/Guest\";\nimport {\n GuestDisposableType,\n MaybeDisposableType,\n} from \"src/Guest/GuestDisposable\";\n\ntype PoolAware = {\n pool?: PoolType;\n};\n\nexport class PatronOnce<T> implements GuestDisposableType<T> {\n private received = false;\n\n public constructor(private baseGuest: GuestType<T>) {}\n\n public introduction() {\n return \"patron\" as const;\n }\n\n public give(value: T, options?: GiveOptions): this {\n if (!this.received) {\n give(value, this.baseGuest, options);\n }\n const data = options?.data as PoolAware;\n if (data?.pool) {\n data.pool.remove(this);\n }\n return this;\n }\n\n public disposed(value: T | null): boolean {\n const maybeDisposable = this.baseGuest as MaybeDisposableType;\n return maybeDisposable.disposed ? maybeDisposable.disposed(value) : false;\n }\n}\n","import { PatronPool } from \"src/Patron/PatronPool\";\nimport { GuestCast } from \"../Guest/GuestCast\";\nimport { give, GuestType } from \"./../Guest/Guest\";\nimport { Source, SourceType } from \"./Source\";\n\nexport class SourceEmpty<T> implements SourceType<T> {\n private baseSource = new Source<T | null>(null);\n\n public value(guest: GuestType<T>) {\n this.baseSource.value(\n new GuestCast(guest as GuestType, (value) => {\n if (value !== null) {\n give(value, guest);\n }\n }),\n );\n return this;\n }\n\n public give(value: T): this {\n this.baseSource.give(value);\n return this;\n }\n\n public pool(): PatronPool<T> {\n return this.baseSource.pool();\n }\n}\n","interface Constructable<T> {\n new (...args: unknown[]): T;\n}\n\ninterface Prototyped<T> {\n prototype: T;\n}\n\nexport interface FactoryType<T> {\n create<R extends unknown[], CT = null>(...args: R): CT extends null ? T : CT;\n}\n\nexport class Factory<T> implements FactoryType<T> {\n public constructor(\n private constructorFn: Prototyped<T>,\n private factories: Record<string, unknown> = {},\n ) {}\n\n public create<R extends unknown[], CT = null>(\n ...args: R\n ): CT extends null ? T : CT {\n return new (this.constructorFn as Constructable<T>)(\n ...args,\n this.factories,\n ) as CT extends null ? T : CT;\n }\n}\n","import { FactoryType } from \"./Factory\";\n\nexport class FactoryDynamic<T> implements FactoryType<T> {\n public constructor(private creationFn: (...args: unknown[]) => T) {}\n\n public create<R extends unknown[], CT = null>(\n ...args: R\n ): CT extends null ? T : CT {\n return this.creationFn(...args) as CT extends null ? T : CT;\n }\n}\n"],"names":["__publicField"],"mappings":";;AAMO,MAAM,UAAiD,CAAA;AAAA,EACrD,YAAoB,aAA8C,EAAA;AAA9C,IAAA,IAAA,CAAA,aAAA,GAAA,aAAA,CAAA;AAAA,GAAgD;AAAA,EAEpE,MAAM,KAAmC,EAAA;AAC9C,IAAA,IAAA,CAAK,cAAc,KAAK,CAAA,CAAA;AACxB,IAAO,OAAA,KAAA,CAAA;AAAA,GACT;AACF;;ACKgB,SAAA,IAAA,CAAQ,IAAS,EAAA,KAAA,EAAqB,OAAuB,EAAA;AAC3E,EAAI,IAAA,OAAO,UAAU,UAAY,EAAA;AAC/B,IAAA,KAAA,CAAM,MAAM,OAAO,CAAA,CAAA;AAAA,GACd,MAAA;AACL,IAAM,KAAA,CAAA,IAAA,CAAK,MAAM,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3C,QAAA,IAAI,UAAU,IAAM,EAAA;AAClB,UAAA,IAAA,CAAK,OAAO,KAAK,CAAA,CAAA;AAAA,SACnB;AAAA,OACD,CAAA;AAAA,KACH,CAAA;AACA,IAAO,OAAA,IAAA,CAAA;AAAA,GACT;AAAA,EAEO,KAAK,KAAgB,EAAA;AAC1B,IAAK,IAAA,CAAA,UAAA,CAAW,KAAK,KAAK,CAAA,CAAA;AAC1B,IAAO,OAAA,IAAA,CAAA;AAAA,GACT;AAAA,EAEO,IAAsB,GAAA;AAC3B,IAAO,OAAA,IAAA,CAAK,WAAW,IAAK,EAAA,CAAA;AAAA,GAC9B;AACF;;ACfO,MAAM,OAAqC,CAAA;AAAA,EACzC,WACG,CAAA,aAAA,EACA,SAAqC,GAAA,EAC7C,EAAA;AAFQ,IAAA,IAAA,CAAA,aAAA,GAAA,aAAA,CAAA;AACA,IAAA,IAAA,CAAA,SAAA,GAAA,SAAA,CAAA;AAAA,GACP;AAAA,EAEI,UACF,IACuB,EAAA;AAC1B,IAAA,OAAO,IAAK,IAAK,CAAA,aAAA;AAAA,MACf,GAAG,IAAA;AAAA,MACH,IAAK,CAAA,SAAA;AAAA,KACP,CAAA;AAAA,GACF;AACF;;ACxBO,MAAM,cAA4C,CAAA;AAAA,EAChD,YAAoB,UAAuC,EAAA;AAAvC,IAAA,IAAA,CAAA,UAAA,GAAA,UAAA,CAAA;AAAA,GAAwC;AAAA,EAE5D,UACF,IACuB,EAAA;AAC1B,IAAO,OAAA,IAAA,CAAK,UAAW,CAAA,GAAG,IAAI,CAAA,CAAA;AAAA,GAChC;AACF;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"patron.cjs","sources":["../src/Guest/GuestAware.ts","../src/Guest/Guest.ts","../src/Guest/GuestCast.ts","../src/Patron/PatronPool.ts","../src/Source/Source.ts","../src/Guest/GuestObject.ts","../src/Guest/GuestPool.ts","../src/Guest/GuestChain.ts","../src/Guest/GuestSync.ts","../src/Guest/GuestDisposable.ts","../src/Patron/Patron.ts","../src/Patron/PatronOnce.ts","../src/Source/SourceEmpty.ts","../src/Factory/Factory.ts","../src/Factory/Module.ts"],"sourcesContent":["import { GuestType } from \"./Guest\";\n\nexport interface GuestAwareType<T = any> {\n value(guest: GuestType<T>): unknown;\n}\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-aware\n */\nexport class GuestAware<T = any> implements GuestAwareType<T> {\n public constructor(private guestReceiver: (guest: GuestType<T>) => void) { }\n\n public value(guest: GuestType<T>): GuestType<T> {\n this.guestReceiver(guest);\n return guest;\n }\n}\n","type GuestIntroduction = \"guest\" | \"patron\";\n\nexport interface GiveOptions {\n data?: unknown;\n}\n\nexport type GuestExecutorType<T = any> = (\n value: T,\n options?: GiveOptions,\n) => void;\n\nexport interface GuestObjectType<T = any> {\n give(value: T, options?: GiveOptions): this;\n introduction?(): GuestIntroduction;\n}\n\nexport type GuestType<T = any> = GuestExecutorType<T> | GuestObjectType<T>;\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/utils/give\n */\nexport function give<T>(data: T, guest: GuestType<T>, options?: GiveOptions) {\n if (typeof guest === \"function\") {\n guest(data, options);\n } else {\n guest.give(data, options);\n }\n}\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest\n */\nexport class Guest<T> implements GuestObjectType<T> {\n public constructor(private receiver: GuestExecutorType<T>) { }\n\n public give(value: T, options?: GiveOptions) {\n this.receiver(value, options);\n return this;\n }\n}\n","import {\n GuestDisposableType,\n MaybeDisposableType,\n} from \"./GuestDisposable\";\nimport { give, GiveOptions, GuestType } from \"./Guest\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-cast\n */\nexport class GuestCast<T> implements GuestDisposableType<T> {\n public constructor(\n private sourceGuest: GuestType<any>,\n private targetGuest: GuestType<T>,\n ) { }\n\n public introduction() {\n if (typeof this.sourceGuest === \"function\") {\n return \"guest\";\n }\n if (!this.sourceGuest.introduction) {\n return \"guest\";\n }\n return this.sourceGuest.introduction();\n }\n\n public give(value: T, options?: GiveOptions): this {\n give(value, this.targetGuest, options);\n return this;\n }\n\n public disposed(value: T | null): boolean {\n const maybeDisposable = this.sourceGuest as MaybeDisposableType;\n return maybeDisposable.disposed ? maybeDisposable.disposed(value) : false;\n }\n}\n","import { GuestDisposableType } from \"../Guest/GuestDisposable\";\nimport { give, GuestObjectType, GuestType, GiveOptions } from \"../Guest/Guest\";\n\nconst poolSets = new Map<PoolType, Set<GuestObjectType>>();\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/utils/remove-patron-from-pools\n */\nexport const removePatronFromPools = (patron: GuestObjectType) => {\n poolSets.forEach((pool) => {\n pool.delete(patron);\n });\n};\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/utils/is-patron-in-pools\n */\nexport const isPatronInPools = (patron: GuestObjectType) => {\n let inPool = false;\n poolSets.forEach((pool) => {\n if (!inPool) {\n inPool = pool.has(patron);\n }\n });\n return inPool;\n};\n\nexport interface PoolType<T = any> extends GuestObjectType<T> {\n add(guest: GuestObjectType<T>): this;\n distribute(receiving: T, possiblePatron: GuestObjectType<T>): this;\n remove(patron: GuestObjectType<T>): this;\n size(): number;\n}\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/patron/patron-pool\n */\nexport class PatronPool<T> implements PoolType<T> {\n private patrons: Set<GuestObjectType<T>>;\n\n public give: (value: T, options?: GiveOptions) => this;\n\n public constructor(private initiator: unknown) {\n this.patrons = new Set<GuestObjectType<T>>();\n poolSets.set(this, this.patrons);\n let lastMicrotask: (() => void) | null = null;\n const doReceive = (value: T, options?: GiveOptions) => {\n this.patrons.forEach((target) => {\n this.sendValueToGuest(value, target, options);\n });\n };\n this.give = (value: T, options?: GiveOptions) => {\n const currentMicroTask = () => {\n if (currentMicroTask === lastMicrotask) {\n doReceive(value, options);\n }\n };\n lastMicrotask = currentMicroTask;\n queueMicrotask(currentMicroTask);\n return this;\n };\n }\n\n public size(): number {\n return this.patrons.size;\n }\n\n public add(shouldBePatron: GuestType<T>) {\n if (!shouldBePatron) {\n throw new Error(\"PatronPool add method received nothing!\");\n }\n if (\n typeof shouldBePatron !== \"function\" &&\n shouldBePatron.introduction &&\n shouldBePatron.introduction() === \"patron\"\n ) {\n this.patrons.add(shouldBePatron);\n }\n return this;\n }\n\n public remove(patron: GuestObjectType<T>) {\n this.patrons.delete(patron);\n return this;\n }\n\n public distribute(receiving: T, possiblePatron: GuestType<T>): this {\n this.add(possiblePatron);\n this.sendValueToGuest(receiving, possiblePatron, {});\n return this;\n }\n\n private sendValueToGuest(\n value: T,\n guest: GuestType<T>,\n options?: GiveOptions,\n ) {\n const isDisposed = this.guestDisposed(value, guest);\n\n if (!isDisposed) {\n give(value, guest, {\n ...options,\n data: {\n ...((options?.data as Record<string, unknown>) ?? {}),\n initiator: this.initiator,\n pool: this,\n },\n });\n }\n }\n\n private guestDisposed(value: T, guest: GuestType<T>) {\n if ((guest as GuestDisposableType).disposed?.(value)) {\n this.remove(guest as GuestObjectType);\n return true;\n }\n\n return false;\n }\n}\n","import { GuestAwareType } from \"../Guest/GuestAware\";\nimport { Guest, GuestObjectType, GuestType } from \"../Guest/Guest\";\nimport { PatronPool } from \"../Patron/PatronPool\";\n\nexport interface PoolAware<T = any> {\n pool(): PatronPool<T>;\n}\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/source\n */\nexport type SourceType<T = any> = GuestAwareType<T> &\n GuestObjectType<T> &\n PoolAware<T>;\n\nexport class Source<T> implements SourceType<T> {\n private thePool = new PatronPool(this);\n\n public constructor(private sourceDocument: T) { }\n\n public pool() {\n return this.thePool;\n }\n\n public give(value: T): this {\n this.sourceDocument = value;\n this.thePool.give(this.sourceDocument);\n return this;\n }\n\n public value(guest: GuestType<T>): this {\n if (typeof guest === \"function\") {\n this.thePool.distribute(this.sourceDocument, new Guest(guest));\n } else {\n this.thePool.distribute(this.sourceDocument, guest);\n }\n return this;\n }\n}\n","import {\n GuestDisposableType,\n MaybeDisposableType,\n} from \"./GuestDisposable\";\nimport { GiveOptions, Guest, GuestType } from \"./Guest\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-object\n */\nexport class GuestObject<T> implements GuestDisposableType<T> {\n public constructor(private baseGuest: GuestType<T>) { }\n\n public give(value: T, options?: GiveOptions): this {\n let guest = this.baseGuest;\n if (typeof guest === \"function\") {\n guest = new Guest(guest);\n }\n guest.give(value, options);\n return this;\n }\n\n public introduction() {\n if (typeof this.baseGuest === \"function\" || !this.baseGuest.introduction) {\n return \"guest\";\n }\n return this.baseGuest.introduction();\n }\n\n public disposed(value: T | null): boolean {\n const maybeDisposable = this.baseGuest as MaybeDisposableType;\n return maybeDisposable.disposed ? maybeDisposable.disposed(value) : false;\n }\n}\n","import { PatronPool } from \"../Patron/PatronPool\";\nimport { PoolType } from \"../Patron/PatronPool\";\nimport { give, GuestObjectType, GuestType, GiveOptions } from \"./Guest\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-pool\n */\nexport class GuestPool<T> implements GuestObjectType<T>, PoolType<T> {\n private guests = new Set<GuestType<T>>();\n\n private patronPool: PatronPool<T>;\n\n public constructor(initiator: unknown) {\n this.patronPool = new PatronPool(initiator);\n }\n\n public give(value: T, options?: GiveOptions): this {\n this.deliverToGuests(value, options);\n this.patronPool.give(value, options);\n return this;\n }\n\n public add(guest: GuestType<T>): this {\n if (\n typeof guest === \"function\" ||\n !guest.introduction ||\n guest.introduction() === \"guest\"\n ) {\n this.guests.add(guest);\n }\n this.patronPool.add(guest);\n return this;\n }\n\n public remove(patron: GuestObjectType<T>): this {\n this.guests.delete(patron);\n this.patronPool.remove(patron);\n return this;\n }\n\n public distribute(receiving: T, possiblePatron: GuestObjectType<T>): this {\n this.add(possiblePatron);\n this.give(receiving);\n return this;\n }\n\n public size() {\n return this.patronPool.size() + this.guests.size;\n }\n\n private deliverToGuests(value: T, options?: GiveOptions) {\n this.guests.forEach((target) => {\n give(value, target, options);\n });\n this.guests.clear();\n }\n}\n","import { GuestCast } from \"./GuestCast\";\nimport { Source } from \"../Source/Source\";\nimport { Guest, GuestObjectType, GuestType } from \"./Guest\";\nimport { GuestObject } from \"./GuestObject\";\nimport { GuestPool } from \"./GuestPool\";\n\nexport interface ChainType<T = any> {\n result(guest: GuestObjectType<T>): this;\n resultArray(guest: GuestObjectType<T>): this;\n receiveKey<R>(key: string): GuestObjectType<R>;\n}\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-chain\n */\nexport class GuestChain<T> implements ChainType<T> {\n private theChain: Source<Record<string, unknown>>;\n\n private keysKnown = new Set();\n\n private keysFilled = new Set();\n\n private filledChainPool = new GuestPool(this);\n\n public constructor() {\n this.theChain = new Source<Record<string, unknown>>({});\n }\n\n public resultArray(guest: GuestType<T>) {\n const guestObject = new GuestObject(guest);\n this.filledChainPool.add(\n new GuestCast(guestObject, (value: Record<string, unknown>) => {\n guestObject.give(Object.values(value) as T);\n }),\n );\n if (this.isChainFilled()) {\n this.theChain.value(\n new Guest((chain: Record<string, unknown>) => {\n this.filledChainPool.give(Object.values(chain));\n }),\n );\n }\n return this;\n }\n\n public result(guest: GuestType<T>) {\n const guestObject = new GuestObject(guest);\n if (this.isChainFilled()) {\n this.filledChainPool.add(guestObject);\n this.theChain.value(\n new Guest((chain) => {\n this.filledChainPool.give(chain);\n }),\n );\n } else {\n this.filledChainPool.add(guestObject);\n }\n return this;\n }\n\n public receiveKey<R>(key: string): GuestObjectType<R> {\n this.keysKnown.add(key);\n return new Guest((value) => {\n // Обернул в очередь чтобы можно было синхронно наполнить очередь известных ключей\n queueMicrotask(() => {\n this.theChain.value(\n new Guest((chain: Record<string, unknown>) => {\n this.keysFilled.add(key);\n const lastChain = {\n ...chain,\n [key]: value,\n };\n this.theChain.give(lastChain);\n if (this.isChainFilled()) {\n this.filledChainPool.give(lastChain);\n }\n }),\n );\n });\n });\n }\n\n private isChainFilled() {\n return (\n this.keysFilled.size > 0 && this.keysFilled.size === this.keysKnown.size\n );\n }\n}\n","import { GuestObjectType } from \"./Guest\";\n\nexport interface GuestValueType<T = any> extends GuestObjectType<T> {\n value(): T;\n}\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-sync\n */\nexport class GuestSync<T> implements GuestValueType<T> {\n public constructor(private theValue: T) { }\n\n public give(value: T): this {\n this.theValue = value;\n return this;\n }\n\n public value() {\n return this.theValue;\n }\n}\n","import { give, GiveOptions, GuestObjectType, GuestType } from \"./Guest\";\n\nexport interface GuestDisposableType<T = any> extends GuestObjectType<T> {\n disposed(value: T | null): boolean;\n}\n\nexport type MaybeDisposableType<T = any> = Partial<GuestDisposableType<T>>;\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-disposable\n */\nexport class GuestDisposable<T> implements GuestDisposableType<T> {\n public constructor(\n private guest: GuestType,\n private disposeCheck: (value: T | null) => boolean,\n ) { }\n\n public disposed(value: T | null): boolean {\n return this.disposeCheck(value);\n }\n\n public give(value: T, options?: GiveOptions): this {\n give(value, this.guest, options);\n return this;\n }\n}\n","import { GuestDisposableType } from \"../Guest/GuestDisposable\";\nimport { give, GiveOptions, GuestType } from \"../Guest/Guest\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/patron\n */\nexport class Patron<T> implements GuestDisposableType<T> {\n public constructor(private willBePatron: GuestType<T>) { }\n\n public introduction() {\n return \"patron\" as const;\n }\n\n public give(value: T, options?: GiveOptions): this {\n give(value, this.willBePatron, options);\n return this;\n }\n\n public disposed(value: T | null): boolean {\n const maybeDisposable = this.willBePatron as GuestDisposableType;\n return maybeDisposable?.disposed?.(value) || false;\n }\n}\n","import { PoolType } from \"./PatronPool\";\nimport { give, GuestType, GiveOptions } from \"../Guest/Guest\";\nimport {\n GuestDisposableType,\n MaybeDisposableType,\n} from \"../Guest/GuestDisposable\";\n\ntype PoolAware = {\n pool?: PoolType;\n};\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/patron/patron-once\n */\nexport class PatronOnce<T> implements GuestDisposableType<T> {\n private received = false;\n\n public constructor(private baseGuest: GuestType<T>) { }\n\n public introduction() {\n return \"patron\" as const;\n }\n\n public give(value: T, options?: GiveOptions): this {\n if (!this.received) {\n give(value, this.baseGuest, options);\n }\n const data = options?.data as PoolAware;\n if (data?.pool) {\n data.pool.remove(this);\n }\n return this;\n }\n\n public disposed(value: T | null): boolean {\n const maybeDisposable = this.baseGuest as MaybeDisposableType;\n return maybeDisposable.disposed ? maybeDisposable.disposed(value) : false;\n }\n}\n","import { PatronPool } from \"../Patron/PatronPool\";\nimport { GuestCast } from \"../Guest/GuestCast\";\nimport { give, GuestType } from \"./../Guest/Guest\";\nimport { Source, SourceType } from \"./Source\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/source/source-empty\n */\nexport class SourceEmpty<T> implements SourceType<T> {\n private baseSource = new Source<T | null>(null);\n\n public value(guest: GuestType<T>) {\n this.baseSource.value(\n new GuestCast(guest as GuestType, (value) => {\n if (value !== null) {\n give(value, guest);\n }\n }),\n );\n return this;\n }\n\n public give(value: T): this {\n this.baseSource.give(value);\n return this;\n }\n\n public pool(): PatronPool<T> {\n return this.baseSource.pool();\n }\n}\n","interface Constructable<T> {\n new(...args: unknown[]): T;\n}\n\ninterface Prototyped<T> {\n prototype: T;\n}\n\nexport interface FactoryType<T> {\n create<R extends unknown[], CT = null>(...args: R): CT extends null ? T : CT;\n}\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/utils/factory\n */\nexport class Factory<T> implements FactoryType<T> {\n public constructor(\n private constructorFn: Prototyped<T>,\n private factories: Record<string, unknown> = {},\n ) { }\n\n public create<R extends unknown[], CT = null>(\n ...args: R\n ): CT extends null ? T : CT {\n return new (this.constructorFn as Constructable<T>)(\n ...args,\n this.factories,\n ) as CT extends null ? T : CT;\n }\n}\n","import { FactoryType } from \"./Factory\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/utils/module\n */\nexport class Module<T> implements FactoryType<T> {\n public constructor(private buildingFn: (...args: any[]) => T) { }\n\n public create<R extends unknown[], CT = null>(...args: R): C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AAA,MACH,IAAK,CAAA,SAAA;AAAA,KACP,CAAA;AAAA,GACF;AACF;;ACxBO,MAAM,MAAoC,CAAA;AAAA,EACxC,YAAoB,UAAmC,EAAA;AAAnC,IAAA,IAAA,CAAA,UAAA,GAAA,UAAA,CAAA;AAAA,GAAqC;AAAA,EAEzD,UAA0C,IAAmC,EAAA;AAClF,IAAO,OAAA,IAAA,CAAK,UAAW,CAAA,GAAG,IAAI,CAAA,CAAA;AAAA,GAChC;AACF;;;;;;;;;;;;;;;;;;;;;"}
package/dist/patron.d.ts CHANGED
@@ -1,6 +1,3 @@
1
- import { GuestDisposableType as GuestDisposableType$1 } from 'src/Guest/GuestDisposable';
2
- import { PatronPool as PatronPool$1 } from 'src/Patron/PatronPool';
3
-
4
1
  type GuestIntroduction = "guest" | "patron";
5
2
  interface GiveOptions {
6
3
  data?: unknown;
@@ -11,7 +8,13 @@ interface GuestObjectType<T = any> {
11
8
  introduction?(): GuestIntroduction;
12
9
  }
13
10
  type GuestType<T = any> = GuestExecutorType<T> | GuestObjectType<T>;
11
+ /**
12
+ * @url https://kosukhin.github.io/patron.site/#/utils/give
13
+ */
14
14
  declare function give<T>(data: T, guest: GuestType<T>, options?: GiveOptions): void;
15
+ /**
16
+ * @url https://kosukhin.github.io/patron.site/#/guest
17
+ */
15
18
  declare class Guest<T> implements GuestObjectType<T> {
16
19
  private receiver;
17
20
  constructor(receiver: GuestExecutorType<T>);
@@ -21,16 +24,37 @@ declare class Guest<T> implements GuestObjectType<T> {
21
24
  interface GuestAwareType<T = any> {
22
25
  value(guest: GuestType<T>): unknown;
23
26
  }
27
+ /**
28
+ * @url https://kosukhin.github.io/patron.site/#/guest/guest-aware
29
+ */
24
30
  declare class GuestAware<T = any> implements GuestAwareType<T> {
25
31
  private guestReceiver;
26
32
  constructor(guestReceiver: (guest: GuestType<T>) => void);
27
33
  value(guest: GuestType<T>): GuestType<T>;
28
34
  }
29
35
 
30
- declare class GuestCast<T> implements GuestDisposableType$1<T> {
36
+ interface GuestDisposableType<T = any> extends GuestObjectType<T> {
37
+ disposed(value: T | null): boolean;
38
+ }
39
+ type MaybeDisposableType<T = any> = Partial<GuestDisposableType<T>>;
40
+ /**
41
+ * @url https://kosukhin.github.io/patron.site/#/guest/guest-disposable
42
+ */
43
+ declare class GuestDisposable<T> implements GuestDisposableType<T> {
44
+ private guest;
45
+ private disposeCheck;
46
+ constructor(guest: GuestType, disposeCheck: (value: T | null) => boolean);
47
+ disposed(value: T | null): boolean;
48
+ give(value: T, options?: GiveOptions): this;
49
+ }
50
+
51
+ /**
52
+ * @url https://kosukhin.github.io/patron.site/#/guest/guest-cast
53
+ */
54
+ declare class GuestCast<T> implements GuestDisposableType<T> {
31
55
  private sourceGuest;
32
56
  private targetGuest;
33
- constructor(sourceGuest: GuestType<unknown>, targetGuest: GuestType<T>);
57
+ constructor(sourceGuest: GuestType<any>, targetGuest: GuestType<T>);
34
58
  introduction(): "guest" | "patron";
35
59
  give(value: T, options?: GiveOptions): this;
36
60
  disposed(value: T | null): boolean;
@@ -41,6 +65,9 @@ interface ChainType<T = any> {
41
65
  resultArray(guest: GuestObjectType<T>): this;
42
66
  receiveKey<R>(key: string): GuestObjectType<R>;
43
67
  }
68
+ /**
69
+ * @url https://kosukhin.github.io/patron.site/#/guest/guest-chain
70
+ */
44
71
  declare class GuestChain<T> implements ChainType<T> {
45
72
  private theChain;
46
73
  private keysKnown;
@@ -53,7 +80,13 @@ declare class GuestChain<T> implements ChainType<T> {
53
80
  private isChainFilled;
54
81
  }
55
82
 
83
+ /**
84
+ * @url https://kosukhin.github.io/patron.site/#/utils/remove-patron-from-pools
85
+ */
56
86
  declare const removePatronFromPools: (patron: GuestObjectType) => void;
87
+ /**
88
+ * @url https://kosukhin.github.io/patron.site/#/utils/is-patron-in-pools
89
+ */
57
90
  declare const isPatronInPools: (patron: GuestObjectType) => boolean;
58
91
  interface PoolType<T = any> extends GuestObjectType<T> {
59
92
  add(guest: GuestObjectType<T>): this;
@@ -61,6 +94,9 @@ interface PoolType<T = any> extends GuestObjectType<T> {
61
94
  remove(patron: GuestObjectType<T>): this;
62
95
  size(): number;
63
96
  }
97
+ /**
98
+ * @url https://kosukhin.github.io/patron.site/#/patron/patron-pool
99
+ */
64
100
  declare class PatronPool<T> implements PoolType<T> {
65
101
  private initiator;
66
102
  private patrons;
@@ -74,6 +110,9 @@ declare class PatronPool<T> implements PoolType<T> {
74
110
  private guestDisposed;
75
111
  }
76
112
 
113
+ /**
114
+ * @url https://kosukhin.github.io/patron.site/#/guest/guest-pool
115
+ */
77
116
  declare class GuestPool<T> implements GuestObjectType<T>, PoolType<T> {
78
117
  private guests;
79
118
  private patronPool;
@@ -89,6 +128,9 @@ declare class GuestPool<T> implements GuestObjectType<T>, PoolType<T> {
89
128
  interface GuestValueType<T = any> extends GuestObjectType<T> {
90
129
  value(): T;
91
130
  }
131
+ /**
132
+ * @url https://kosukhin.github.io/patron.site/#/guest/guest-sync
133
+ */
92
134
  declare class GuestSync<T> implements GuestValueType<T> {
93
135
  private theValue;
94
136
  constructor(theValue: T);
@@ -96,7 +138,10 @@ declare class GuestSync<T> implements GuestValueType<T> {
96
138
  value(): T;
97
139
  }
98
140
 
99
- declare class GuestObject<T> implements GuestDisposableType$1<T> {
141
+ /**
142
+ * @url https://kosukhin.github.io/patron.site/#/guest/guest-object
143
+ */
144
+ declare class GuestObject<T> implements GuestDisposableType<T> {
100
145
  private baseGuest;
101
146
  constructor(baseGuest: GuestType<T>);
102
147
  give(value: T, options?: GiveOptions): this;
@@ -104,18 +149,9 @@ declare class GuestObject<T> implements GuestDisposableType$1<T> {
104
149
  disposed(value: T | null): boolean;
105
150
  }
106
151
 
107
- interface GuestDisposableType<T = any> extends GuestObjectType<T> {
108
- disposed(value: T | null): boolean;
109
- }
110
- type MaybeDisposableType<T = any> = Partial<GuestDisposableType<T>>;
111
- declare class GuestDisposable<T> implements GuestDisposableType<T> {
112
- private guest;
113
- private disposeCheck;
114
- constructor(guest: GuestType, disposeCheck: (value: T | null) => boolean);
115
- disposed(value: T | null): boolean;
116
- give(value: T, options?: GiveOptions): this;
117
- }
118
-
152
+ /**
153
+ * @url https://kosukhin.github.io/patron.site/#/patron
154
+ */
119
155
  declare class Patron<T> implements GuestDisposableType<T> {
120
156
  private willBePatron;
121
157
  constructor(willBePatron: GuestType<T>);
@@ -124,7 +160,10 @@ declare class Patron<T> implements GuestDisposableType<T> {
124
160
  disposed(value: T | null): boolean;
125
161
  }
126
162
 
127
- declare class PatronOnce<T> implements GuestDisposableType$1<T> {
163
+ /**
164
+ * @url https://kosukhin.github.io/patron.site/#/patron/patron-once
165
+ */
166
+ declare class PatronOnce<T> implements GuestDisposableType<T> {
128
167
  private baseGuest;
129
168
  private received;
130
169
  constructor(baseGuest: GuestType<T>);
@@ -136,6 +175,9 @@ declare class PatronOnce<T> implements GuestDisposableType$1<T> {
136
175
  interface PoolAware<T = any> {
137
176
  pool(): PatronPool<T>;
138
177
  }
178
+ /**
179
+ * @url https://kosukhin.github.io/patron.site/#/source
180
+ */
139
181
  type SourceType<T = any> = GuestAwareType<T> & GuestObjectType<T> & PoolAware<T>;
140
182
  declare class Source<T> implements SourceType<T> {
141
183
  private sourceDocument;
@@ -146,11 +188,14 @@ declare class Source<T> implements SourceType<T> {
146
188
  value(guest: GuestType<T>): this;
147
189
  }
148
190
 
191
+ /**
192
+ * @url https://kosukhin.github.io/patron.site/#/source/source-empty
193
+ */
149
194
  declare class SourceEmpty<T> implements SourceType<T> {
150
195
  private baseSource;
151
196
  value(guest: GuestType<T>): this;
152
197
  give(value: T): this;
153
- pool(): PatronPool$1<T>;
198
+ pool(): PatronPool<T>;
154
199
  }
155
200
 
156
201
  interface Prototyped<T> {
@@ -159,6 +204,9 @@ interface Prototyped<T> {
159
204
  interface FactoryType<T> {
160
205
  create<R extends unknown[], CT = null>(...args: R): CT extends null ? T : CT;
161
206
  }
207
+ /**
208
+ * @url https://kosukhin.github.io/patron.site/#/utils/factory
209
+ */
162
210
  declare class Factory<T> implements FactoryType<T> {
163
211
  private constructorFn;
164
212
  private factories;
@@ -166,10 +214,13 @@ declare class Factory<T> implements FactoryType<T> {
166
214
  create<R extends unknown[], CT = null>(...args: R): CT extends null ? T : CT;
167
215
  }
168
216
 
169
- declare class FactoryDynamic<T> implements FactoryType<T> {
170
- private creationFn;
171
- constructor(creationFn: (...args: unknown[]) => T);
217
+ /**
218
+ * @url https://kosukhin.github.io/patron.site/#/utils/module
219
+ */
220
+ declare class Module<T> implements FactoryType<T> {
221
+ private buildingFn;
222
+ constructor(buildingFn: (...args: any[]) => T);
172
223
  create<R extends unknown[], CT = null>(...args: R): CT extends null ? T : CT;
173
224
  }
174
225
 
175
- export { type ChainType, Factory, FactoryDynamic, type FactoryType, type GiveOptions, Guest, GuestAware, type GuestAwareType, GuestCast, GuestChain, GuestDisposable, type GuestDisposableType, type GuestExecutorType, GuestObject, type GuestObjectType, GuestPool, GuestSync, type GuestType, type GuestValueType, type MaybeDisposableType, Patron, PatronOnce, PatronPool, type PoolAware, type PoolType, Source, SourceEmpty, type SourceType, give, isPatronInPools, removePatronFromPools };
226
+ export { type ChainType, Factory, type FactoryType, type GiveOptions, Guest, GuestAware, type GuestAwareType, GuestCast, GuestChain, GuestDisposable, type GuestDisposableType, type GuestExecutorType, GuestObject, type GuestObjectType, GuestPool, GuestSync, type GuestType, type GuestValueType, type MaybeDisposableType, Module, Patron, PatronOnce, PatronPool, type PoolAware, type PoolType, Source, SourceEmpty, type SourceType, give, isPatronInPools, removePatronFromPools };
package/dist/patron.js CHANGED
@@ -402,14 +402,14 @@ class Factory {
402
402
  }
403
403
  }
404
404
 
405
- class FactoryDynamic {
406
- constructor(creationFn) {
407
- this.creationFn = creationFn;
405
+ class Module {
406
+ constructor(buildingFn) {
407
+ this.buildingFn = buildingFn;
408
408
  }
409
409
  create(...args) {
410
- return this.creationFn(...args);
410
+ return this.buildingFn(...args);
411
411
  }
412
412
  }
413
413
 
414
- export { Factory, FactoryDynamic, Guest, GuestAware, GuestCast, GuestChain, GuestDisposable, GuestObject, GuestPool, GuestSync, Patron, PatronOnce, PatronPool, Source, SourceEmpty, give, isPatronInPools, removePatronFromPools };
414
+ export { Factory, Guest, GuestAware, GuestCast, GuestChain, GuestDisposable, GuestObject, GuestPool, GuestSync, Module, Patron, PatronOnce, PatronPool, Source, SourceEmpty, give, isPatronInPools, removePatronFromPools };
415
415
  //# sourceMappingURL=patron.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"patron.js","sources":["../src/Guest/GuestAware.ts","../src/Guest/Guest.ts","../src/Guest/GuestCast.ts","../src/Patron/PatronPool.ts","../src/Source/Source.ts","../src/Guest/GuestObject.ts","../src/Guest/GuestPool.ts","../src/Guest/GuestChain.ts","../src/Guest/GuestSync.ts","../src/Guest/GuestDisposable.ts","../src/Patron/Patron.ts","../src/Patron/PatronOnce.ts","../src/Source/SourceEmpty.ts","../src/Factory/Factory.ts","../src/Factory/FactoryDynamic.ts"],"sourcesContent":["import { GuestType } from \"./Guest\";\n\nexport interface GuestAwareType<T = any> {\n value(guest: GuestType<T>): unknown;\n}\n\nexport class GuestAware<T = any> implements GuestAwareType<T> {\n public constructor(private guestReceiver: (guest: GuestType<T>) => void) { }\n\n public value(guest: GuestType<T>): GuestType<T> {\n this.guestReceiver(guest);\n return guest;\n }\n}\n","type GuestIntroduction = \"guest\" | \"patron\";\n\nexport interface GiveOptions {\n data?: unknown;\n}\n\nexport type GuestExecutorType<T = any> = (\n value: T,\n options?: GiveOptions,\n) => void;\n\nexport interface GuestObjectType<T = any> {\n give(value: T, options?: GiveOptions): this;\n introduction?(): GuestIntroduction;\n}\n\nexport type GuestType<T = any> = GuestExecutorType<T> | GuestObjectType<T>;\n\nexport function give<T>(data: T, guest: GuestType<T>, options?: GiveOptions) {\n if (typeof guest === \"function\") {\n guest(data, options);\n } else {\n guest.give(data, options);\n }\n}\n\nexport class Guest<T> implements GuestObjectType<T> {\n public constructor(private receiver: GuestExecutorType<T>) { }\n\n public give(value: T, options?: GiveOptions) {\n this.receiver(value, options);\n return this;\n }\n}\n","import {\n GuestDisposableType,\n MaybeDisposableType,\n} from \"src/Guest/GuestDisposable\";\nimport { give, GiveOptions, GuestType } from \"./Guest\";\n\nexport class GuestCast<T> implements GuestDisposableType<T> {\n public constructor(\n private sourceGuest: GuestType<unknown>,\n private targetGuest: GuestType<T>,\n ) {}\n\n public introduction() {\n if (typeof this.sourceGuest === \"function\") {\n return \"guest\";\n }\n if (!this.sourceGuest.introduction) {\n return \"guest\";\n }\n return this.sourceGuest.introduction();\n }\n\n public give(value: T, options?: GiveOptions): this {\n give(value, this.targetGuest, options);\n return this;\n }\n\n public disposed(value: T | null): boolean {\n const maybeDisposable = this.sourceGuest as MaybeDisposableType;\n return maybeDisposable.disposed ? maybeDisposable.disposed(value) : false;\n }\n}\n","import { GuestDisposableType } from \"../Guest/GuestDisposable\";\nimport { give, GuestObjectType, GuestType, GiveOptions } from \"../Guest/Guest\";\n\nconst poolSets = new Map<PoolType, Set<GuestObjectType>>();\n\n// remove patron from all pools\nexport const removePatronFromPools = (patron: GuestObjectType) => {\n poolSets.forEach((pool) => {\n pool.delete(patron);\n });\n};\n\n// check patron existed in any pool\nexport const isPatronInPools = (patron: GuestObjectType) => {\n let inPool = false;\n poolSets.forEach((pool) => {\n if (!inPool) {\n inPool = pool.has(patron);\n }\n });\n return inPool;\n};\n\nexport interface PoolType<T = any> extends GuestObjectType<T> {\n add(guest: GuestObjectType<T>): this;\n distribute(receiving: T, possiblePatron: GuestObjectType<T>): this;\n remove(patron: GuestObjectType<T>): this;\n size(): number;\n}\n\nexport class PatronPool<T> implements PoolType<T> {\n private patrons: Set<GuestObjectType<T>>;\n\n public give: (value: T, options?: GiveOptions) => this;\n\n public constructor(private initiator: unknown) {\n this.patrons = new Set<GuestObjectType<T>>();\n poolSets.set(this, this.patrons);\n let lastMicrotask: (() => void) | null = null;\n const doReceive = (value: T, options?: GiveOptions) => {\n this.patrons.forEach((target) => {\n this.sendValueToGuest(value, target, options);\n });\n };\n this.give = (value: T, options?: GiveOptions) => {\n const currentMicroTask = () => {\n if (currentMicroTask === lastMicrotask) {\n doReceive(value, options);\n }\n };\n lastMicrotask = currentMicroTask;\n queueMicrotask(currentMicroTask);\n return this;\n };\n }\n\n public size(): number {\n return this.patrons.size;\n }\n\n public add(shouldBePatron: GuestType<T>) {\n if (!shouldBePatron) {\n throw new Error(\"PatronPool add method received nothing!\");\n }\n if (\n typeof shouldBePatron !== \"function\" &&\n shouldBePatron.introduction &&\n shouldBePatron.introduction() === \"patron\"\n ) {\n this.patrons.add(shouldBePatron);\n }\n return this;\n }\n\n public remove(patron: GuestObjectType<T>) {\n this.patrons.delete(patron);\n return this;\n }\n\n public distribute(receiving: T, possiblePatron: GuestType<T>): this {\n this.add(possiblePatron);\n this.sendValueToGuest(receiving, possiblePatron, {});\n return this;\n }\n\n private sendValueToGuest(\n value: T,\n guest: GuestType<T>,\n options?: GiveOptions,\n ) {\n const isDisposed = this.guestDisposed(value, guest);\n\n if (!isDisposed) {\n give(value, guest, {\n ...options,\n data: {\n ...((options?.data as Record<string, unknown>) ?? {}),\n initiator: this.initiator,\n pool: this,\n },\n });\n }\n }\n\n private guestDisposed(value: T, guest: GuestType<T>) {\n if ((guest as GuestDisposableType).disposed?.(value)) {\n this.remove(guest as GuestObjectType);\n return true;\n }\n\n return false;\n }\n}\n","import { GuestAwareType } from \"../Guest/GuestAware\";\nimport { Guest, GuestObjectType, GuestType } from \"../Guest/Guest\";\nimport { PatronPool } from \"../Patron/PatronPool\";\n\nexport interface PoolAware<T = any> {\n pool(): PatronPool<T>;\n}\n\nexport type SourceType<T = any> = GuestAwareType<T> &\n GuestObjectType<T> &\n PoolAware<T>;\n\nexport class Source<T> implements SourceType<T> {\n private thePool = new PatronPool(this);\n\n public constructor(private sourceDocument: T) { }\n\n public pool() {\n return this.thePool;\n }\n\n public give(value: T): this {\n this.sourceDocument = value;\n this.thePool.give(this.sourceDocument);\n return this;\n }\n\n public value(guest: GuestType<T>): this {\n if (typeof guest === \"function\") {\n this.thePool.distribute(this.sourceDocument, new Guest(guest));\n } else {\n this.thePool.distribute(this.sourceDocument, guest);\n }\n return this;\n }\n}\n","import {\n GuestDisposableType,\n MaybeDisposableType,\n} from \"src/Guest/GuestDisposable\";\nimport { GiveOptions, Guest, GuestType } from \"./Guest\";\n\nexport class GuestObject<T> implements GuestDisposableType<T> {\n public constructor(private baseGuest: GuestType<T>) {}\n\n public give(value: T, options?: GiveOptions): this {\n let guest = this.baseGuest;\n if (typeof guest === \"function\") {\n guest = new Guest(guest);\n }\n guest.give(value, options);\n return this;\n }\n\n public introduction() {\n if (typeof this.baseGuest === \"function\" || !this.baseGuest.introduction) {\n return \"guest\";\n }\n return this.baseGuest.introduction();\n }\n\n public disposed(value: T | null): boolean {\n const maybeDisposable = this.baseGuest as MaybeDisposableType;\n return maybeDisposable.disposed ? maybeDisposable.disposed(value) : false;\n }\n}\n","import { PatronPool } from \"../Patron/PatronPool\";\nimport { PoolType } from \"../Patron/PatronPool\";\nimport { give, GuestObjectType, GuestType, GiveOptions } from \"./Guest\";\n\nexport class GuestPool<T> implements GuestObjectType<T>, PoolType<T> {\n private guests = new Set<GuestType<T>>();\n\n private patronPool: PatronPool<T>;\n\n public constructor(initiator: unknown) {\n this.patronPool = new PatronPool(initiator);\n }\n\n public give(value: T, options?: GiveOptions): this {\n this.deliverToGuests(value, options);\n this.patronPool.give(value, options);\n return this;\n }\n\n public add(guest: GuestType<T>): this {\n if (\n typeof guest === \"function\" ||\n !guest.introduction ||\n guest.introduction() === \"guest\"\n ) {\n this.guests.add(guest);\n }\n this.patronPool.add(guest);\n return this;\n }\n\n public remove(patron: GuestObjectType<T>): this {\n this.guests.delete(patron);\n this.patronPool.remove(patron);\n return this;\n }\n\n public distribute(receiving: T, possiblePatron: GuestObjectType<T>): this {\n this.add(possiblePatron);\n this.give(receiving);\n return this;\n }\n\n public size() {\n return this.patronPool.size() + this.guests.size;\n }\n\n private deliverToGuests(value: T, options?: GiveOptions) {\n this.guests.forEach((target) => {\n give(value, target, options);\n });\n this.guests.clear();\n }\n}\n","import { GuestCast } from \"./GuestCast\";\nimport { Source } from \"../Source/Source\";\nimport { Guest, GuestObjectType, GuestType } from \"./Guest\";\nimport { GuestObject } from \"./GuestObject\";\nimport { GuestPool } from \"./GuestPool\";\n\nexport interface ChainType<T = any> {\n result(guest: GuestObjectType<T>): this;\n resultArray(guest: GuestObjectType<T>): this;\n receiveKey<R>(key: string): GuestObjectType<R>;\n}\n\nexport class GuestChain<T> implements ChainType<T> {\n private theChain: Source<Record<string, unknown>>;\n\n private keysKnown = new Set();\n\n private keysFilled = new Set();\n\n private filledChainPool = new GuestPool(this);\n\n public constructor() {\n this.theChain = new Source<Record<string, unknown>>({});\n }\n\n public resultArray(guest: GuestType<T>) {\n const guestObject = new GuestObject(guest);\n this.filledChainPool.add(\n new GuestCast(guestObject, (value: Record<string, unknown>) => {\n guestObject.give(Object.values(value) as T);\n }),\n );\n if (this.isChainFilled()) {\n this.theChain.value(\n new Guest((chain: Record<string, unknown>) => {\n this.filledChainPool.give(Object.values(chain));\n }),\n );\n }\n return this;\n }\n\n public result(guest: GuestType<T>) {\n const guestObject = new GuestObject(guest);\n if (this.isChainFilled()) {\n this.filledChainPool.add(guestObject);\n this.theChain.value(\n new Guest((chain) => {\n this.filledChainPool.give(chain);\n }),\n );\n } else {\n this.filledChainPool.add(guestObject);\n }\n return this;\n }\n\n public receiveKey<R>(key: string): GuestObjectType<R> {\n this.keysKnown.add(key);\n return new Guest((value) => {\n // Обернул в очередь чтобы можно было синхронно наполнить очередь известных ключей\n queueMicrotask(() => {\n this.theChain.value(\n new Guest((chain: Record<string, unknown>) => {\n this.keysFilled.add(key);\n const lastChain = {\n ...chain,\n [key]: value,\n };\n this.theChain.give(lastChain);\n if (this.isChainFilled()) {\n this.filledChainPool.give(lastChain);\n }\n }),\n );\n });\n });\n }\n\n private isChainFilled() {\n return (\n this.keysFilled.size > 0 && this.keysFilled.size === this.keysKnown.size\n );\n }\n}\n","import { GuestObjectType } from \"./Guest\";\n\nexport interface GuestValueType<T = any> extends GuestObjectType<T> {\n value(): T;\n}\n\nexport class GuestSync<T> implements GuestValueType<T> {\n public constructor(private theValue: T) { }\n\n public give(value: T): this {\n this.theValue = value;\n return this;\n }\n\n public value() {\n return this.theValue;\n }\n}\n","import { give, GiveOptions, GuestObjectType, GuestType } from \"./Guest\";\n\nexport interface GuestDisposableType<T = any> extends GuestObjectType<T> {\n disposed(value: T | null): boolean;\n}\n\nexport type MaybeDisposableType<T = any> = Partial<GuestDisposableType<T>>;\n\nexport class GuestDisposable<T> implements GuestDisposableType<T> {\n public constructor(\n private guest: GuestType,\n private disposeCheck: (value: T | null) => boolean,\n ) { }\n\n public disposed(value: T | null): boolean {\n return this.disposeCheck(value);\n }\n\n public give(value: T, options?: GiveOptions): this {\n give(value, this.guest, options);\n return this;\n }\n}\n","import { GuestDisposableType } from \"../Guest/GuestDisposable\";\nimport { give, GiveOptions, GuestType } from \"../Guest/Guest\";\n\nexport class Patron<T> implements GuestDisposableType<T> {\n public constructor(private willBePatron: GuestType<T>) {}\n\n public introduction() {\n return \"patron\" as const;\n }\n\n public give(value: T, options?: GiveOptions): this {\n give(value, this.willBePatron, options);\n return this;\n }\n\n public disposed(value: T | null): boolean {\n const maybeDisposable = this.willBePatron as GuestDisposableType;\n return maybeDisposable?.disposed?.(value) || false;\n }\n}\n","import { PoolType } from \"./PatronPool\";\nimport { give, GuestType, GiveOptions } from \"../Guest/Guest\";\nimport {\n GuestDisposableType,\n MaybeDisposableType,\n} from \"src/Guest/GuestDisposable\";\n\ntype PoolAware = {\n pool?: PoolType;\n};\n\nexport class PatronOnce<T> implements GuestDisposableType<T> {\n private received = false;\n\n public constructor(private baseGuest: GuestType<T>) {}\n\n public introduction() {\n return \"patron\" as const;\n }\n\n public give(value: T, options?: GiveOptions): this {\n if (!this.received) {\n give(value, this.baseGuest, options);\n }\n const data = options?.data as PoolAware;\n if (data?.pool) {\n data.pool.remove(this);\n }\n return this;\n }\n\n public disposed(value: T | null): boolean {\n const maybeDisposable = this.baseGuest as MaybeDisposableType;\n return maybeDisposable.disposed ? maybeDisposable.disposed(value) : false;\n }\n}\n","import { PatronPool } from \"src/Patron/PatronPool\";\nimport { GuestCast } from \"../Guest/GuestCast\";\nimport { give, GuestType } from \"./../Guest/Guest\";\nimport { Source, SourceType } from \"./Source\";\n\nexport class SourceEmpty<T> implements SourceType<T> {\n private baseSource = new Source<T | null>(null);\n\n public value(guest: GuestType<T>) {\n this.baseSource.value(\n new GuestCast(guest as GuestType, (value) => {\n if (value !== null) {\n give(value, guest);\n }\n }),\n );\n return this;\n }\n\n public give(value: T): this {\n this.baseSource.give(value);\n return this;\n }\n\n public pool(): PatronPool<T> {\n return this.baseSource.pool();\n }\n}\n","interface Constructable<T> {\n new (...args: unknown[]): T;\n}\n\ninterface Prototyped<T> {\n prototype: T;\n}\n\nexport interface FactoryType<T> {\n create<R extends unknown[], CT = null>(...args: R): CT extends null ? T : CT;\n}\n\nexport class Factory<T> implements FactoryType<T> {\n public constructor(\n private constructorFn: Prototyped<T>,\n private factories: Record<string, unknown> = {},\n ) {}\n\n public create<R extends unknown[], CT = null>(\n ...args: R\n ): CT extends null ? T : CT {\n return new (this.constructorFn as Constructable<T>)(\n ...args,\n this.factories,\n ) as CT extends null ? T : CT;\n }\n}\n","import { FactoryType } from \"./Factory\";\n\nexport class FactoryDynamic<T> implements FactoryType<T> {\n public constructor(private creationFn: (...args: unknown[]) => T) {}\n\n public create<R extends unknown[], CT = null>(\n ...args: R\n ): CT extends null ? T : CT {\n return this.creationFn(...args) as CT extends null ? T : CT;\n }\n}\n"],"names":["__publicField"],"mappings":"AAMO,MAAM,UAAiD,CAAA;AAAA,EACrD,YAAoB,aAA8C,EAAA;AAA9C,IAAA,IAAA,CAAA,aAAA,GAAA,aAAA,CAAA;AAAA,GAAgD;AAAA,EAEpE,MAAM,KAAmC,EAAA;AAC9C,IAAA,IAAA,CAAK,cAAc,KAAK,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,CAAA,CAAA;AAAA,GAChC;AACF;;;;"}
1
+ {"version":3,"file":"patron.js","sources":["../src/Guest/GuestAware.ts","../src/Guest/Guest.ts","../src/Guest/GuestCast.ts","../src/Patron/PatronPool.ts","../src/Source/Source.ts","../src/Guest/GuestObject.ts","../src/Guest/GuestPool.ts","../src/Guest/GuestChain.ts","../src/Guest/GuestSync.ts","../src/Guest/GuestDisposable.ts","../src/Patron/Patron.ts","../src/Patron/PatronOnce.ts","../src/Source/SourceEmpty.ts","../src/Factory/Factory.ts","../src/Factory/Module.ts"],"sourcesContent":["import { GuestType } from \"./Guest\";\n\nexport interface GuestAwareType<T = any> {\n value(guest: GuestType<T>): unknown;\n}\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-aware\n */\nexport class GuestAware<T = any> implements GuestAwareType<T> {\n public constructor(private guestReceiver: (guest: GuestType<T>) => void) { }\n\n public value(guest: GuestType<T>): GuestType<T> {\n this.guestReceiver(guest);\n return guest;\n }\n}\n","type GuestIntroduction = \"guest\" | \"patron\";\n\nexport interface GiveOptions {\n data?: unknown;\n}\n\nexport type GuestExecutorType<T = any> = (\n value: T,\n options?: GiveOptions,\n) => void;\n\nexport interface GuestObjectType<T = any> {\n give(value: T, options?: GiveOptions): this;\n introduction?(): GuestIntroduction;\n}\n\nexport type GuestType<T = any> = GuestExecutorType<T> | GuestObjectType<T>;\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/utils/give\n */\nexport function give<T>(data: T, guest: GuestType<T>, options?: GiveOptions) {\n if (typeof guest === \"function\") {\n guest(data, options);\n } else {\n guest.give(data, options);\n }\n}\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest\n */\nexport class Guest<T> implements GuestObjectType<T> {\n public constructor(private receiver: GuestExecutorType<T>) { }\n\n public give(value: T, options?: GiveOptions) {\n this.receiver(value, options);\n return this;\n }\n}\n","import {\n GuestDisposableType,\n MaybeDisposableType,\n} from \"./GuestDisposable\";\nimport { give, GiveOptions, GuestType } from \"./Guest\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-cast\n */\nexport class GuestCast<T> implements GuestDisposableType<T> {\n public constructor(\n private sourceGuest: GuestType<any>,\n private targetGuest: GuestType<T>,\n ) { }\n\n public introduction() {\n if (typeof this.sourceGuest === \"function\") {\n return \"guest\";\n }\n if (!this.sourceGuest.introduction) {\n return \"guest\";\n }\n return this.sourceGuest.introduction();\n }\n\n public give(value: T, options?: GiveOptions): this {\n give(value, this.targetGuest, options);\n return this;\n }\n\n public disposed(value: T | null): boolean {\n const maybeDisposable = this.sourceGuest as MaybeDisposableType;\n return maybeDisposable.disposed ? maybeDisposable.disposed(value) : false;\n }\n}\n","import { GuestDisposableType } from \"../Guest/GuestDisposable\";\nimport { give, GuestObjectType, GuestType, GiveOptions } from \"../Guest/Guest\";\n\nconst poolSets = new Map<PoolType, Set<GuestObjectType>>();\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/utils/remove-patron-from-pools\n */\nexport const removePatronFromPools = (patron: GuestObjectType) => {\n poolSets.forEach((pool) => {\n pool.delete(patron);\n });\n};\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/utils/is-patron-in-pools\n */\nexport const isPatronInPools = (patron: GuestObjectType) => {\n let inPool = false;\n poolSets.forEach((pool) => {\n if (!inPool) {\n inPool = pool.has(patron);\n }\n });\n return inPool;\n};\n\nexport interface PoolType<T = any> extends GuestObjectType<T> {\n add(guest: GuestObjectType<T>): this;\n distribute(receiving: T, possiblePatron: GuestObjectType<T>): this;\n remove(patron: GuestObjectType<T>): this;\n size(): number;\n}\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/patron/patron-pool\n */\nexport class PatronPool<T> implements PoolType<T> {\n private patrons: Set<GuestObjectType<T>>;\n\n public give: (value: T, options?: GiveOptions) => this;\n\n public constructor(private initiator: unknown) {\n this.patrons = new Set<GuestObjectType<T>>();\n poolSets.set(this, this.patrons);\n let lastMicrotask: (() => void) | null = null;\n const doReceive = (value: T, options?: GiveOptions) => {\n this.patrons.forEach((target) => {\n this.sendValueToGuest(value, target, options);\n });\n };\n this.give = (value: T, options?: GiveOptions) => {\n const currentMicroTask = () => {\n if (currentMicroTask === lastMicrotask) {\n doReceive(value, options);\n }\n };\n lastMicrotask = currentMicroTask;\n queueMicrotask(currentMicroTask);\n return this;\n };\n }\n\n public size(): number {\n return this.patrons.size;\n }\n\n public add(shouldBePatron: GuestType<T>) {\n if (!shouldBePatron) {\n throw new Error(\"PatronPool add method received nothing!\");\n }\n if (\n typeof shouldBePatron !== \"function\" &&\n shouldBePatron.introduction &&\n shouldBePatron.introduction() === \"patron\"\n ) {\n this.patrons.add(shouldBePatron);\n }\n return this;\n }\n\n public remove(patron: GuestObjectType<T>) {\n this.patrons.delete(patron);\n return this;\n }\n\n public distribute(receiving: T, possiblePatron: GuestType<T>): this {\n this.add(possiblePatron);\n this.sendValueToGuest(receiving, possiblePatron, {});\n return this;\n }\n\n private sendValueToGuest(\n value: T,\n guest: GuestType<T>,\n options?: GiveOptions,\n ) {\n const isDisposed = this.guestDisposed(value, guest);\n\n if (!isDisposed) {\n give(value, guest, {\n ...options,\n data: {\n ...((options?.data as Record<string, unknown>) ?? {}),\n initiator: this.initiator,\n pool: this,\n },\n });\n }\n }\n\n private guestDisposed(value: T, guest: GuestType<T>) {\n if ((guest as GuestDisposableType).disposed?.(value)) {\n this.remove(guest as GuestObjectType);\n return true;\n }\n\n return false;\n }\n}\n","import { GuestAwareType } from \"../Guest/GuestAware\";\nimport { Guest, GuestObjectType, GuestType } from \"../Guest/Guest\";\nimport { PatronPool } from \"../Patron/PatronPool\";\n\nexport interface PoolAware<T = any> {\n pool(): PatronPool<T>;\n}\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/source\n */\nexport type SourceType<T = any> = GuestAwareType<T> &\n GuestObjectType<T> &\n PoolAware<T>;\n\nexport class Source<T> implements SourceType<T> {\n private thePool = new PatronPool(this);\n\n public constructor(private sourceDocument: T) { }\n\n public pool() {\n return this.thePool;\n }\n\n public give(value: T): this {\n this.sourceDocument = value;\n this.thePool.give(this.sourceDocument);\n return this;\n }\n\n public value(guest: GuestType<T>): this {\n if (typeof guest === \"function\") {\n this.thePool.distribute(this.sourceDocument, new Guest(guest));\n } else {\n this.thePool.distribute(this.sourceDocument, guest);\n }\n return this;\n }\n}\n","import {\n GuestDisposableType,\n MaybeDisposableType,\n} from \"./GuestDisposable\";\nimport { GiveOptions, Guest, GuestType } from \"./Guest\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-object\n */\nexport class GuestObject<T> implements GuestDisposableType<T> {\n public constructor(private baseGuest: GuestType<T>) { }\n\n public give(value: T, options?: GiveOptions): this {\n let guest = this.baseGuest;\n if (typeof guest === \"function\") {\n guest = new Guest(guest);\n }\n guest.give(value, options);\n return this;\n }\n\n public introduction() {\n if (typeof this.baseGuest === \"function\" || !this.baseGuest.introduction) {\n return \"guest\";\n }\n return this.baseGuest.introduction();\n }\n\n public disposed(value: T | null): boolean {\n const maybeDisposable = this.baseGuest as MaybeDisposableType;\n return maybeDisposable.disposed ? maybeDisposable.disposed(value) : false;\n }\n}\n","import { PatronPool } from \"../Patron/PatronPool\";\nimport { PoolType } from \"../Patron/PatronPool\";\nimport { give, GuestObjectType, GuestType, GiveOptions } from \"./Guest\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-pool\n */\nexport class GuestPool<T> implements GuestObjectType<T>, PoolType<T> {\n private guests = new Set<GuestType<T>>();\n\n private patronPool: PatronPool<T>;\n\n public constructor(initiator: unknown) {\n this.patronPool = new PatronPool(initiator);\n }\n\n public give(value: T, options?: GiveOptions): this {\n this.deliverToGuests(value, options);\n this.patronPool.give(value, options);\n return this;\n }\n\n public add(guest: GuestType<T>): this {\n if (\n typeof guest === \"function\" ||\n !guest.introduction ||\n guest.introduction() === \"guest\"\n ) {\n this.guests.add(guest);\n }\n this.patronPool.add(guest);\n return this;\n }\n\n public remove(patron: GuestObjectType<T>): this {\n this.guests.delete(patron);\n this.patronPool.remove(patron);\n return this;\n }\n\n public distribute(receiving: T, possiblePatron: GuestObjectType<T>): this {\n this.add(possiblePatron);\n this.give(receiving);\n return this;\n }\n\n public size() {\n return this.patronPool.size() + this.guests.size;\n }\n\n private deliverToGuests(value: T, options?: GiveOptions) {\n this.guests.forEach((target) => {\n give(value, target, options);\n });\n this.guests.clear();\n }\n}\n","import { GuestCast } from \"./GuestCast\";\nimport { Source } from \"../Source/Source\";\nimport { Guest, GuestObjectType, GuestType } from \"./Guest\";\nimport { GuestObject } from \"./GuestObject\";\nimport { GuestPool } from \"./GuestPool\";\n\nexport interface ChainType<T = any> {\n result(guest: GuestObjectType<T>): this;\n resultArray(guest: GuestObjectType<T>): this;\n receiveKey<R>(key: string): GuestObjectType<R>;\n}\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-chain\n */\nexport class GuestChain<T> implements ChainType<T> {\n private theChain: Source<Record<string, unknown>>;\n\n private keysKnown = new Set();\n\n private keysFilled = new Set();\n\n private filledChainPool = new GuestPool(this);\n\n public constructor() {\n this.theChain = new Source<Record<string, unknown>>({});\n }\n\n public resultArray(guest: GuestType<T>) {\n const guestObject = new GuestObject(guest);\n this.filledChainPool.add(\n new GuestCast(guestObject, (value: Record<string, unknown>) => {\n guestObject.give(Object.values(value) as T);\n }),\n );\n if (this.isChainFilled()) {\n this.theChain.value(\n new Guest((chain: Record<string, unknown>) => {\n this.filledChainPool.give(Object.values(chain));\n }),\n );\n }\n return this;\n }\n\n public result(guest: GuestType<T>) {\n const guestObject = new GuestObject(guest);\n if (this.isChainFilled()) {\n this.filledChainPool.add(guestObject);\n this.theChain.value(\n new Guest((chain) => {\n this.filledChainPool.give(chain);\n }),\n );\n } else {\n this.filledChainPool.add(guestObject);\n }\n return this;\n }\n\n public receiveKey<R>(key: string): GuestObjectType<R> {\n this.keysKnown.add(key);\n return new Guest((value) => {\n // Обернул в очередь чтобы можно было синхронно наполнить очередь известных ключей\n queueMicrotask(() => {\n this.theChain.value(\n new Guest((chain: Record<string, unknown>) => {\n this.keysFilled.add(key);\n const lastChain = {\n ...chain,\n [key]: value,\n };\n this.theChain.give(lastChain);\n if (this.isChainFilled()) {\n this.filledChainPool.give(lastChain);\n }\n }),\n );\n });\n });\n }\n\n private isChainFilled() {\n return (\n this.keysFilled.size > 0 && this.keysFilled.size === this.keysKnown.size\n );\n }\n}\n","import { GuestObjectType } from \"./Guest\";\n\nexport interface GuestValueType<T = any> extends GuestObjectType<T> {\n value(): T;\n}\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-sync\n */\nexport class GuestSync<T> implements GuestValueType<T> {\n public constructor(private theValue: T) { }\n\n public give(value: T): this {\n this.theValue = value;\n return this;\n }\n\n public value() {\n return this.theValue;\n }\n}\n","import { give, GiveOptions, GuestObjectType, GuestType } from \"./Guest\";\n\nexport interface GuestDisposableType<T = any> extends GuestObjectType<T> {\n disposed(value: T | null): boolean;\n}\n\nexport type MaybeDisposableType<T = any> = Partial<GuestDisposableType<T>>;\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-disposable\n */\nexport class GuestDisposable<T> implements GuestDisposableType<T> {\n public constructor(\n private guest: GuestType,\n private disposeCheck: (value: T | null) => boolean,\n ) { }\n\n public disposed(value: T | null): boolean {\n return this.disposeCheck(value);\n }\n\n public give(value: T, options?: GiveOptions): this {\n give(value, this.guest, options);\n return this;\n }\n}\n","import { GuestDisposableType } from \"../Guest/GuestDisposable\";\nimport { give, GiveOptions, GuestType } from \"../Guest/Guest\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/patron\n */\nexport class Patron<T> implements GuestDisposableType<T> {\n public constructor(private willBePatron: GuestType<T>) { }\n\n public introduction() {\n return \"patron\" as const;\n }\n\n public give(value: T, options?: GiveOptions): this {\n give(value, this.willBePatron, options);\n return this;\n }\n\n public disposed(value: T | null): boolean {\n const maybeDisposable = this.willBePatron as GuestDisposableType;\n return maybeDisposable?.disposed?.(value) || false;\n }\n}\n","import { PoolType } from \"./PatronPool\";\nimport { give, GuestType, GiveOptions } from \"../Guest/Guest\";\nimport {\n GuestDisposableType,\n MaybeDisposableType,\n} from \"../Guest/GuestDisposable\";\n\ntype PoolAware = {\n pool?: PoolType;\n};\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/patron/patron-once\n */\nexport class PatronOnce<T> implements GuestDisposableType<T> {\n private received = false;\n\n public constructor(private baseGuest: GuestType<T>) { }\n\n public introduction() {\n return \"patron\" as const;\n }\n\n public give(value: T, options?: GiveOptions): this {\n if (!this.received) {\n give(value, this.baseGuest, options);\n }\n const data = options?.data as PoolAware;\n if (data?.pool) {\n data.pool.remove(this);\n }\n return this;\n }\n\n public disposed(value: T | null): boolean {\n const maybeDisposable = this.baseGuest as MaybeDisposableType;\n return maybeDisposable.disposed ? maybeDisposable.disposed(value) : false;\n }\n}\n","import { PatronPool } from \"../Patron/PatronPool\";\nimport { GuestCast } from \"../Guest/GuestCast\";\nimport { give, GuestType } from \"./../Guest/Guest\";\nimport { Source, SourceType } from \"./Source\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/source/source-empty\n */\nexport class SourceEmpty<T> implements SourceType<T> {\n private baseSource = new Source<T | null>(null);\n\n public value(guest: GuestType<T>) {\n this.baseSource.value(\n new GuestCast(guest as GuestType, (value) => {\n if (value !== null) {\n give(value, guest);\n }\n }),\n );\n return this;\n }\n\n public give(value: T): this {\n this.baseSource.give(value);\n return this;\n }\n\n public pool(): PatronPool<T> {\n return this.baseSource.pool();\n }\n}\n","interface Constructable<T> {\n new(...args: unknown[]): T;\n}\n\ninterface Prototyped<T> {\n prototype: T;\n}\n\nexport interface FactoryType<T> {\n create<R extends unknown[], CT = null>(...args: R): CT extends null ? T : CT;\n}\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/utils/factory\n */\nexport class Factory<T> implements FactoryType<T> {\n public constructor(\n private constructorFn: Prototyped<T>,\n private factories: Record<string, unknown> = {},\n ) { }\n\n public create<R extends unknown[], CT = null>(\n ...args: R\n ): CT extends null ? T : CT {\n return new (this.constructorFn as Constructable<T>)(\n ...args,\n this.factories,\n ) as CT extends null ? T : CT;\n }\n}\n","import { FactoryType } from \"./Factory\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/utils/module\n */\nexport class Module<T> implements FactoryType<T> {\n public constructor(private buildingFn: (...args: any[]) => T) { }\n\n public create<R extends unknown[], CT = null>(...args: R): CT extends null ? T : CT {\n return this.buildingFn(...args) as CT extends null ? T : CT;\n }\n}\n"],"names":["__publicField"],"mappings":"AASO,MAAM,UAAiD,CAAA;AAAA,EACrD,YAAoB,aAA8C,EAAA;AAA9C,IAAA,IAAA,CAAA,aAAA,GAAA,aAAA,CAAA;AAAA,GAAgD;AAAA,EAEpE,MAAM,KAAmC,EAAA;AAC9C,IAAA,IAAA,CAAK,cAAc,KAAK,CAAA,CAAA;AACxB,IAAO,OAAA,KAAA,CAAA;AAAA,GACT;AACF;;ACKgB,SAAA,IAAA,CAAQ,IAAS,EAAA,KAAA,EAAqB,OAAuB,EAAA;AAC3E,EAAI,IAAA,OAAO,UAAU,UAAY,EAAA;AAC/B,IAAA,KAAA,CAAM,MAAM,OAAO,CAAA,CAAA;AAAA,GACd,MAAA;AACL,IAAM,KAAA,CAAA,IAAA,CAAK,MAAM,OAAO,CAAA,CAAA;AAAA,GAC1B;AACF,CAAA;AAKO,MAAM,KAAuC,CAAA;AAAA,EAC3C,YAAoB,QAAgC,EAAA;AAAhC,IAAA,IAAA,CAAA,QAAA,GAAA,QAAA,CAAA;AAAA,GAAkC;AAAA,EAEtD,IAAA,CAAK,OAAU,OAAuB,EAAA;AAC3C,IAAK,IAAA,CAAA,QAAA,CAAS,OAAO,OAAO,CAAA,CAAA;AAC5B,IAAO,OAAA,IAAA,CAAA;AAAA,GACT;AACF;;AC9BO,MAAM,SAA+C,CAAA;AAAA,EACnD,WAAA,CACG,aACA,WACR,EAAA;AAFQ,IAAA,IAAA,CAAA,WAAA,GAAA,WAAA,CAAA;AACA,IAA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ACG,CAAA,aAAA,EACA,SAAqC,GAAA,EAC7C,EAAA;AAFQ,IAAA,IAAA,CAAA,aAAA,GAAA,aAAA,CAAA;AACA,IAAA,IAAA,CAAA,SAAA,GAAA,SAAA,CAAA;AAAA,GACN;AAAA,EAEG,UACF,IACuB,EAAA;AAC1B,IAAA,OAAO,IAAK,IAAK,CAAA,aAAA;AAAA,MACf,GAAG,IAAA;AAAA,MACH,IAAK,CAAA,SAAA;AAAA,KACP,CAAA;AAAA,GACF;AACF;;ACxBO,MAAM,MAAoC,CAAA;AAAA,EACxC,YAAoB,UAAmC,EAAA;AAAnC,IAAA,IAAA,CAAA,UAAA,GAAA,UAAA,CAAA;AAAA,GAAqC;AAAA,EAEzD,UAA0C,IAAmC,EAAA;AAClF,IAAO,OAAA,IAAA,CAAK,UAAW,CAAA,GAAG,IAAI,CAAA,CAAA;AAAA,GAChC;AACF;;;;"}
@@ -1 +1 @@
1
- !function(t){"use strict";function e(t,e,s){"function"==typeof e?e(t,s):e.give(t,s)}class s{constructor(t){this.receiver=t}give(t,e){return this.receiver(t,e),this}}class i{constructor(t,e){this.sourceGuest=t,this.targetGuest=e}introduction(){return"function"==typeof this.sourceGuest?"guest":this.sourceGuest.introduction?this.sourceGuest.introduction():"guest"}give(t,s){return e(t,this.targetGuest,s),this}disposed(t){const e=this.sourceGuest;return!!e.disposed&&e.disposed(t)}}var r=Object.defineProperty,o=(t,e,s)=>((t,e,s)=>e in t?r(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s)(t,"symbol"!=typeof e?e+"":e,s);const n=new Map;class u{constructor(t){this.initiator=t,o(this,"patrons"),o(this,"give"),this.patrons=new Set,n.set(this,this.patrons);let e=null;const s=(t,e)=>{this.patrons.forEach((s=>{this.sendValueToGuest(t,s,e)}))};this.give=(t,i)=>{const r=()=>{r===e&&s(t,i)};return e=r,queueMicrotask(r),this}}size(){return this.patrons.size}add(t){if(!t)throw new Error("PatronPool add method received nothing!");return"function"!=typeof t&&t.introduction&&"patron"===t.introduction()&&this.patrons.add(t),this}remove(t){return this.patrons.delete(t),this}distribute(t,e){return this.add(e),this.sendValueToGuest(t,e,{}),this}sendValueToGuest(t,s,i){this.guestDisposed(t,s)||e(t,s,{...i,data:{...i?.data??{},initiator:this.initiator,pool:this}})}guestDisposed(t,e){return!!e.disposed?.(t)&&(this.remove(e),!0)}}var h=Object.defineProperty,a=(t,e,s)=>((t,e,s)=>e in t?h(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s)(t,e+"",s);class c{constructor(t){this.sourceDocument=t,a(this,"thePool",new u(this))}pool(){return this.thePool}give(t){return this.sourceDocument=t,this.thePool.give(this.sourceDocument),this}value(t){return"function"==typeof t?this.thePool.distribute(this.sourceDocument,new s(t)):this.thePool.distribute(this.sourceDocument,t),this}}class l{constructor(t){this.baseGuest=t}give(t,e){let i=this.baseGuest;return"function"==typeof i&&(i=new s(i)),i.give(t,e),this}introduction(){return"function"!=typeof this.baseGuest&&this.baseGuest.introduction?this.baseGuest.introduction():"guest"}disposed(t){const e=this.baseGuest;return!!e.disposed&&e.disposed(t)}}var d=Object.defineProperty,v=(t,e,s)=>((t,e,s)=>e in t?d(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s)(t,"symbol"!=typeof e?e+"":e,s);class p{constructor(t){v(this,"guests",new Set),v(this,"patronPool"),this.patronPool=new u(t)}give(t,e){return this.deliverToGuests(t,e),this.patronPool.give(t,e),this}add(t){return"function"!=typeof t&&t.introduction&&"guest"!==t.introduction()||this.guests.add(t),this.patronPool.add(t),this}remove(t){return this.guests.delete(t),this.patronPool.remove(t),this}distribute(t,e){return this.add(e),this.give(t),this}size(){return this.patronPool.size()+this.guests.size}deliverToGuests(t,s){this.guests.forEach((i=>{e(t,i,s)})),this.guests.clear()}}var g=Object.defineProperty,b=(t,e,s)=>((t,e,s)=>e in t?g(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s)(t,"symbol"!=typeof e?e+"":e,s);var f=Object.defineProperty,P=(t,e,s)=>((t,e,s)=>e in t?f(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s)(t,e+"",s);var w=Object.defineProperty,y=(t,e,s)=>((t,e,s)=>e in t?w(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s)(t,e+"",s);t.Factory=class{constructor(t,e={}){this.constructorFn=t,this.factories=e}create(...t){return new this.constructorFn(...t,this.factories)}},t.FactoryDynamic=class{constructor(t){this.creationFn=t}create(...t){return this.creationFn(...t)}},t.Guest=s,t.GuestAware=class{constructor(t){this.guestReceiver=t}value(t){return this.guestReceiver(t),t}},t.GuestCast=i,t.GuestChain=class{constructor(){b(this,"theChain"),b(this,"keysKnown",new Set),b(this,"keysFilled",new Set),b(this,"filledChainPool",new p(this)),this.theChain=new c({})}resultArray(t){const e=new l(t);return this.filledChainPool.add(new i(e,(t=>{e.give(Object.values(t))}))),this.isChainFilled()&&this.theChain.value(new s((t=>{this.filledChainPool.give(Object.values(t))}))),this}result(t){const e=new l(t);return this.isChainFilled()?(this.filledChainPool.add(e),this.theChain.value(new s((t=>{this.filledChainPool.give(t)})))):this.filledChainPool.add(e),this}receiveKey(t){return this.keysKnown.add(t),new s((e=>{queueMicrotask((()=>{this.theChain.value(new s((s=>{this.keysFilled.add(t);const i={...s,[t]:e};this.theChain.give(i),this.isChainFilled()&&this.filledChainPool.give(i)})))}))}))}isChainFilled(){return this.keysFilled.size>0&&this.keysFilled.size===this.keysKnown.size}},t.GuestDisposable=class{constructor(t,e){this.guest=t,this.disposeCheck=e}disposed(t){return this.disposeCheck(t)}give(t,s){return e(t,this.guest,s),this}},t.GuestObject=l,t.GuestPool=p,t.GuestSync=class{constructor(t){this.theValue=t}give(t){return this.theValue=t,this}value(){return this.theValue}},t.Patron=class{constructor(t){this.willBePatron=t}introduction(){return"patron"}give(t,s){return e(t,this.willBePatron,s),this}disposed(t){const e=this.willBePatron;return e?.disposed?.(t)||!1}},t.PatronOnce=class{constructor(t){this.baseGuest=t,P(this,"received",!1)}introduction(){return"patron"}give(t,s){this.received||e(t,this.baseGuest,s);const i=s?.data;return i?.pool&&i.pool.remove(this),this}disposed(t){const e=this.baseGuest;return!!e.disposed&&e.disposed(t)}},t.PatronPool=u,t.Source=c,t.SourceEmpty=class{constructor(){y(this,"baseSource",new c(null))}value(t){return this.baseSource.value(new i(t,(s=>{null!==s&&e(s,t)}))),this}give(t){return this.baseSource.give(t),this}pool(){return this.baseSource.pool()}},t.give=e,t.isPatronInPools=t=>{let e=!1;return n.forEach((s=>{e||(e=s.has(t))})),e},t.removePatronFromPools=t=>{n.forEach((e=>{e.delete(t)}))}}({});
1
+ !function(t){"use strict";function e(t,e,s){"function"==typeof e?e(t,s):e.give(t,s)}class s{constructor(t){this.receiver=t}give(t,e){return this.receiver(t,e),this}}class i{constructor(t,e){this.sourceGuest=t,this.targetGuest=e}introduction(){return"function"==typeof this.sourceGuest?"guest":this.sourceGuest.introduction?this.sourceGuest.introduction():"guest"}give(t,s){return e(t,this.targetGuest,s),this}disposed(t){const e=this.sourceGuest;return!!e.disposed&&e.disposed(t)}}var o=Object.defineProperty,r=(t,e,s)=>((t,e,s)=>e in t?o(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s)(t,"symbol"!=typeof e?e+"":e,s);const n=new Map;class u{constructor(t){this.initiator=t,r(this,"patrons"),r(this,"give"),this.patrons=new Set,n.set(this,this.patrons);let e=null;const s=(t,e)=>{this.patrons.forEach((s=>{this.sendValueToGuest(t,s,e)}))};this.give=(t,i)=>{const o=()=>{o===e&&s(t,i)};return e=o,queueMicrotask(o),this}}size(){return this.patrons.size}add(t){if(!t)throw new Error("PatronPool add method received nothing!");return"function"!=typeof t&&t.introduction&&"patron"===t.introduction()&&this.patrons.add(t),this}remove(t){return this.patrons.delete(t),this}distribute(t,e){return this.add(e),this.sendValueToGuest(t,e,{}),this}sendValueToGuest(t,s,i){this.guestDisposed(t,s)||e(t,s,{...i,data:{...i?.data??{},initiator:this.initiator,pool:this}})}guestDisposed(t,e){return!!e.disposed?.(t)&&(this.remove(e),!0)}}var h=Object.defineProperty,a=(t,e,s)=>((t,e,s)=>e in t?h(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s)(t,e+"",s);class l{constructor(t){this.sourceDocument=t,a(this,"thePool",new u(this))}pool(){return this.thePool}give(t){return this.sourceDocument=t,this.thePool.give(this.sourceDocument),this}value(t){return"function"==typeof t?this.thePool.distribute(this.sourceDocument,new s(t)):this.thePool.distribute(this.sourceDocument,t),this}}class c{constructor(t){this.baseGuest=t}give(t,e){let i=this.baseGuest;return"function"==typeof i&&(i=new s(i)),i.give(t,e),this}introduction(){return"function"!=typeof this.baseGuest&&this.baseGuest.introduction?this.baseGuest.introduction():"guest"}disposed(t){const e=this.baseGuest;return!!e.disposed&&e.disposed(t)}}var d=Object.defineProperty,v=(t,e,s)=>((t,e,s)=>e in t?d(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s)(t,"symbol"!=typeof e?e+"":e,s);class p{constructor(t){v(this,"guests",new Set),v(this,"patronPool"),this.patronPool=new u(t)}give(t,e){return this.deliverToGuests(t,e),this.patronPool.give(t,e),this}add(t){return"function"!=typeof t&&t.introduction&&"guest"!==t.introduction()||this.guests.add(t),this.patronPool.add(t),this}remove(t){return this.guests.delete(t),this.patronPool.remove(t),this}distribute(t,e){return this.add(e),this.give(t),this}size(){return this.patronPool.size()+this.guests.size}deliverToGuests(t,s){this.guests.forEach((i=>{e(t,i,s)})),this.guests.clear()}}var g=Object.defineProperty,b=(t,e,s)=>((t,e,s)=>e in t?g(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s)(t,"symbol"!=typeof e?e+"":e,s);var f=Object.defineProperty,P=(t,e,s)=>((t,e,s)=>e in t?f(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s)(t,e+"",s);var w=Object.defineProperty,y=(t,e,s)=>((t,e,s)=>e in t?w(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s)(t,e+"",s);t.Factory=class{constructor(t,e={}){this.constructorFn=t,this.factories=e}create(...t){return new this.constructorFn(...t,this.factories)}},t.Guest=s,t.GuestAware=class{constructor(t){this.guestReceiver=t}value(t){return this.guestReceiver(t),t}},t.GuestCast=i,t.GuestChain=class{constructor(){b(this,"theChain"),b(this,"keysKnown",new Set),b(this,"keysFilled",new Set),b(this,"filledChainPool",new p(this)),this.theChain=new l({})}resultArray(t){const e=new c(t);return this.filledChainPool.add(new i(e,(t=>{e.give(Object.values(t))}))),this.isChainFilled()&&this.theChain.value(new s((t=>{this.filledChainPool.give(Object.values(t))}))),this}result(t){const e=new c(t);return this.isChainFilled()?(this.filledChainPool.add(e),this.theChain.value(new s((t=>{this.filledChainPool.give(t)})))):this.filledChainPool.add(e),this}receiveKey(t){return this.keysKnown.add(t),new s((e=>{queueMicrotask((()=>{this.theChain.value(new s((s=>{this.keysFilled.add(t);const i={...s,[t]:e};this.theChain.give(i),this.isChainFilled()&&this.filledChainPool.give(i)})))}))}))}isChainFilled(){return this.keysFilled.size>0&&this.keysFilled.size===this.keysKnown.size}},t.GuestDisposable=class{constructor(t,e){this.guest=t,this.disposeCheck=e}disposed(t){return this.disposeCheck(t)}give(t,s){return e(t,this.guest,s),this}},t.GuestObject=c,t.GuestPool=p,t.GuestSync=class{constructor(t){this.theValue=t}give(t){return this.theValue=t,this}value(){return this.theValue}},t.Module=class{constructor(t){this.buildingFn=t}create(...t){return this.buildingFn(...t)}},t.Patron=class{constructor(t){this.willBePatron=t}introduction(){return"patron"}give(t,s){return e(t,this.willBePatron,s),this}disposed(t){const e=this.willBePatron;return e?.disposed?.(t)||!1}},t.PatronOnce=class{constructor(t){this.baseGuest=t,P(this,"received",!1)}introduction(){return"patron"}give(t,s){this.received||e(t,this.baseGuest,s);const i=s?.data;return i?.pool&&i.pool.remove(this),this}disposed(t){const e=this.baseGuest;return!!e.disposed&&e.disposed(t)}},t.PatronPool=u,t.Source=l,t.SourceEmpty=class{constructor(){y(this,"baseSource",new l(null))}value(t){return this.baseSource.value(new i(t,(s=>{null!==s&&e(s,t)}))),this}give(t){return this.baseSource.give(t),this}pool(){return this.baseSource.pool()}},t.give=e,t.isPatronInPools=t=>{let e=!1;return n.forEach((s=>{e||(e=s.has(t))})),e},t.removePatronFromPools=t=>{n.forEach((e=>{e.delete(t)}))}}({});