patron-oop 1.39.1 → 1.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"patron.min.mjs","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/GuestAwareAll.ts","../src/Source/SourceEmpty.ts","../src/Patron/PatronOnce.ts","../src/Guest/GuestAwareSequence.ts","../src/Guest/GuestAwareMap.ts","../src/Guest/GuestAwareRace.ts","../src/Guest/GuestAwareActive.ts","../src/Guest/GuestSync.ts","../src/Guest/GuestDisposable.ts","../src/Patron/Patron.ts","../src/Source/SourceDynamic.ts","../src/Factory/Factory.ts","../src/Factory/Module.ts"],"sourcesContent":["import { GuestType } from \"./Guest\";\n\nexport type GuestAwareExecutorType<T> = (guest: GuestType<T>) => unknown;\n\nexport interface GuestAwareObjectType<T> {\n value: GuestAwareExecutorType<T>\n}\n\nexport type GuestAwareType<T = any> = GuestAwareExecutorType<T> | GuestAwareObjectType<T>\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/utils/give\n */\nexport function value<T>(guestAware: GuestAwareType<T>, guest: GuestType<T>) {\n if (typeof guestAware === 'function') {\n return guestAware(guest);\n } else {\n return guestAware.value(guest);\n }\n}\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/utils/is-guest-aware\n */\nexport function isGuestAware(mbGuestAware: any): mbGuestAware is GuestAwareType {\n return typeof mbGuestAware === 'function' || typeof mbGuestAware?.value === 'function';\n}\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-aware\n */\nexport class GuestAware<T = any> implements GuestAwareObjectType<T> {\n public constructor(private guestAware: GuestAwareType<T>) { }\n\n public value(guest: GuestType<T>): GuestType<T> {\n value(this.guestAware, 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/#/utils/is-guest\n */\nexport function isGuest(mbGuest: any): mbGuest is GuestType {\n return typeof mbGuest === 'function' || typeof mbGuest?.give === 'function';\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\";\nimport { PoolAwareOptions } from \"../Patron/PatronOnce\";\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, {\n ...options,\n data: {\n ...(options?.data ?? {}),\n castedGuest: (options?.data as PoolAwareOptions)?.castedGuest ?? this,\n }\n });\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 { Guest, GuestObjectType, GuestType } from \"../Guest/Guest\";\nimport { GuestAwareObjectType } from \"../Guest/GuestAware\";\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> = GuestAwareObjectType<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 { GuestAwareObjectType } from \"./GuestAware\";\nimport { Source } from \"../Source/Source\";\nimport { Guest, GuestObjectType, GuestType } from \"./Guest\";\nimport { GuestCast } from \"./GuestCast\";\nimport { GuestObject } from \"./GuestObject\";\nimport { GuestPool } from \"./GuestPool\";\n\nexport interface GuestAwareAllType<T = any> extends GuestAwareObjectType<T> {\n valueArray(guest: GuestObjectType<T>): this;\n guestKey<R>(key: string): GuestObjectType<R>;\n}\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-aware-all\n */\nexport class GuestAwareAll<T> implements GuestAwareAllType<T> {\n private theAll: Source<Record<string, unknown>>;\n\n private keysKnown = new Set();\n\n private keysFilled = new Set();\n\n private filledAllPool = new GuestPool(this);\n\n public constructor() {\n this.theAll = new Source<Record<string, unknown>>({});\n }\n\n public valueArray(guest: GuestType<T>) {\n const guestObject = new GuestObject(guest);\n this.filledAllPool.add(\n new GuestCast(guestObject, (value: Record<string, unknown>) => {\n guestObject.give(Object.values(value) as T);\n }),\n );\n if (this.isAllFilled()) {\n this.theAll.value(\n new Guest((all: Record<string, unknown>) => {\n this.filledAllPool.give(Object.values(all));\n }),\n );\n }\n return this;\n }\n\n public value(guest: GuestType<T>) {\n const guestObject = new GuestObject(guest);\n if (this.isAllFilled()) {\n this.filledAllPool.add(guestObject);\n this.theAll.value(\n new Guest((all) => {\n this.filledAllPool.give(all);\n }),\n );\n } else {\n this.filledAllPool.add(guestObject);\n }\n return this;\n }\n\n public guestKey<R>(key: string): GuestObjectType<R> {\n this.keysKnown.add(key);\n return new Guest((value) => {\n // Обернул в очередь чтобы можно было синхронно наполнить очередь известных ключей\n queueMicrotask(() => {\n this.theAll.value(\n new Guest((all: Record<string, unknown>) => {\n this.keysFilled.add(key);\n const lastAll = {\n ...all,\n [key]: value,\n };\n this.theAll.give(lastAll);\n if (this.isAllFilled()) {\n this.filledAllPool.give(lastAll);\n }\n }),\n );\n });\n });\n }\n\n private isAllFilled() {\n return (\n this.keysFilled.size > 0 && this.keysFilled.size === this.keysKnown.size\n );\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, options) => {\n if (value !== null) {\n give(value, guest, options);\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","import { PoolType } from \"./PatronPool\";\nimport { give, GuestType, GiveOptions, GuestObjectType } from \"../Guest/Guest\";\nimport {\n GuestDisposableType,\n MaybeDisposableType,\n} from \"../Guest/GuestDisposable\";\n\nexport type PoolAwareOptions = {\n pool?: PoolType;\n castedGuest?: GuestObjectType;\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 this.received = true;\n give(value, this.baseGuest, options);\n }\n return this;\n }\n\n public disposed(value: T | null): boolean {\n if (this.received) {\n return true;\n }\n const maybeDisposable = this.baseGuest as MaybeDisposableType;\n return maybeDisposable.disposed ? maybeDisposable.disposed(value) : false;\n }\n}\n","import { FactoryType } from \"../Factory/Factory\";\nimport { give } from \"./Guest\";\nimport { GuestAwareObjectType, GuestAwareType, isGuestAware, value } from \"./GuestAware\";\nimport { GuestCast } from \"./GuestCast\";\nimport { GuestAwareAll } from \"./GuestAwareAll\";\nimport { GuestType } from \"./Guest\";\nimport { SourceEmpty } from \"../Source/SourceEmpty\";\nimport { PatronOnce } from \"../Patron/PatronOnce\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-aware-sequence\n */\nexport class GuestAwareSequence<T, TG> implements GuestAwareObjectType<TG[]> {\n public constructor(\n private baseSource: GuestAwareType<T[]>,\n private targetSourceFactory: FactoryType<GuestAwareType<TG>>\n ) { }\n\n public value(guest: GuestType<TG[]>) {\n const all = new GuestAwareAll<TG[]>();\n const sequenceSource = new SourceEmpty();\n const targetSource = this.targetSourceFactory.create(\n sequenceSource\n )\n\n value(\n this.baseSource,\n new GuestCast(guest, (theValue) => {\n let index = 0;\n\n const nextItemHandle = () => {\n if (theValue[index + 1] !== undefined) {\n index = index + 1;\n handle();\n } else {\n all.valueArray(guest);\n }\n }\n\n function handle() {\n sequenceSource.give(null);\n const nextValue = theValue[index];\n if (isGuestAware(nextValue)) {\n value(nextValue, new PatronOnce((theNextValue) => {\n sequenceSource.give(theNextValue);\n value(targetSource, all.guestKey(index.toString()));\n nextItemHandle();\n }));\n } else {\n sequenceSource.give(nextValue);\n value(targetSource, all.guestKey(index.toString()));\n nextItemHandle();\n }\n }\n\n if (theValue[index] !== undefined) {\n handle();\n } else {\n give([], guest);\n }\n })\n );\n return this;\n }\n}\n","import { FactoryType } from \"../Factory/Factory\";\nimport { give } from \"./Guest\";\nimport { GuestAwareObjectType, GuestAwareType, isGuestAware, value } from \"./GuestAware\";\nimport { GuestCast } from \"./GuestCast\";\nimport { GuestAwareAll } from \"./GuestAwareAll\";\nimport { GuestType } from \"./Guest\";\nimport { GuestAware } from \"./GuestAware\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-aware-map\n */\nexport class GuestAwareMap<T, TG> implements GuestAwareObjectType<TG[]> {\n public constructor(\n private baseSource: GuestAwareType<T[]>,\n private targetSourceFactory: FactoryType<GuestAwareType<TG>>\n ) { }\n\n public value(guest: GuestType<TG[]>) {\n const all = new GuestAwareAll();\n value(\n this.baseSource,\n new GuestCast(<GuestType>guest, (theValue) => {\n theValue.forEach((val, index) => {\n const valueSource = isGuestAware(val)\n ? val\n : new GuestAware((innerGuest) => {\n give(val, innerGuest);\n });\n const targetSource = this.targetSourceFactory.create(valueSource)\n value(targetSource, all.guestKey(index.toString()));\n });\n })\n )\n all.valueArray(<GuestType>guest);\n return this;\n }\n}\n","import { give, GuestType } from \"./Guest\";\nimport { GuestAwareObjectType, GuestAwareType, value } from \"./GuestAware\";\nimport { GuestCast } from \"./GuestCast\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-aware-race\n */\nexport class GuestAwareRace<T> implements GuestAwareObjectType<T> {\n public constructor(private guestAwares: GuestAwareType<T>[]) { }\n\n public value(guest: GuestType<T>): this {\n let connectedWithGuestAware: GuestAwareType | null = null;\n this.guestAwares.forEach(guestAware => {\n value(\n guestAware,\n new GuestCast(<GuestType>guest, (value) => {\n if (!connectedWithGuestAware || connectedWithGuestAware === guestAware) {\n give(value as T, guest);\n connectedWithGuestAware = guestAware\n }\n })\n );\n });\n return this;\n }\n}\n","import { SourceType } from \"../Source/Source\";\nimport { SourceEmpty } from \"../Source/SourceEmpty\";\nimport { GuestType } from \"./Guest\";\nimport { GuestAwareObjectType } from \"./GuestAware\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/utils/action-type\n */\nexport interface ActionType<P = any> {\n do(config: P): this;\n}\n\nexport interface GuestAwareAcitveType<R = unknown, T = unknown> extends GuestAwareObjectType<T>, ActionType<R> {\n}\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-aware-active\n */\nexport class GuestAwareActive<R, T> implements GuestAwareAcitveType<R, T> {\n private source = new SourceEmpty<T>();\n\n public constructor(private configExecutor: (config: R, source: SourceType<T>) => void) { }\n\n public do(config: R): this {\n this.configExecutor(config, this.source);\n return this;\n }\n\n public value(guest: GuestType<T>): this {\n this.source.value(guest);\n return this;\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 { give, GuestType } from \"../Guest/Guest\";\nimport { GuestAwareType, value } from \"../Guest/GuestAware\";\nimport { PatronPool } from \"../Patron/PatronPool\";\nimport { SourceType } from \"./Source\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/source-dynamic\n */\nexport class SourceDynamic<T = unknown> implements SourceType<T> {\n public constructor(\n private baseGuest: GuestType<T>,\n private baseGuestAware: GuestAwareType<T>,\n ) { }\n\n public value(guest: GuestType<T>) {\n value(this.baseGuestAware, guest);\n return this;\n }\n\n public give(value: T) {\n give(value, this.baseGuest);\n return this;\n }\n\n public pool(): PatronPool<T> {\n throw Error('No pool in SourceDynamic');\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":["value","guestAware","guest","isGuestAware","mbGuestAware","GuestAware","constructor","this","give","data","options","isGuest","mbGuest","Guest","receiver","GuestCast","sourceGuest","targetGuest","introduction","castedGuest","disposed","maybeDisposable","poolSets","Map","removePatronFromPools","patron","forEach","pool","delete","isPatronInPools","inPool","has","PatronPool","initiator","__publicField","patrons","Set","set","lastMicrotask","doReceive","target","sendValueToGuest","currentMicroTask","queueMicrotask","size","add","shouldBePatron","Error","remove","distribute","receiving","possiblePatron","guestDisposed","Source","sourceDocument","thePool","GuestObject","baseGuest","GuestPool","patronPool","deliverToGuests","guests","clear","GuestAwareAll","theAll","valueArray","guestObject","filledAllPool","Object","values","isAllFilled","all","guestKey","key","keysKnown","keysFilled","lastAll","SourceEmpty","baseSource","PatronOnce","received","GuestAwareSequence","targetSourceFactory","sequenceSource","targetSource","create","theValue","index","nextItemHandle","handle","nextValue","theNextValue","toString","GuestAwareMap","val","valueSource","innerGuest","GuestAwareRace","guestAwares","connectedWithGuestAware","GuestAwareActive","configExecutor","config","source","GuestSync","GuestDisposable","disposeCheck","Patron","willBePatron","SourceDynamic","baseGuestA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CAEO,IAAAC,CAAKR,GAEH,OADFA,EAAAA,EAAOO,KAAKkD,WACVlD,IACT,CAEO,IAAAoB,GACL,MAAMoB,MAAM,2BACd,ECXK,MAAMgE,EACJ,WAAAzG,CACG0G,EACAC,EAAqC,IADrC1G,KAAAyG,cAAAA,EACAzG,KAAA0G,UAAAA,CACN,CAEG,MAAA5B,IACF6B,GAEH,OAAO,IAAK3G,KAAKyG,iBACZE,EACH3G,KAAK0G,UAET,ECvBK,MAAME,EACJ,WAAA7G,CAAoB8G,GAAA7G,KAAA6G,WAAAA,CAAqC,CAEzD,MAAA/B,IAA0C6B,GACxC,OAAA3G,KAAK6G,cAAcF,EAC5B"}
1
+ {"version":3,"file":"patron.min.mjs","sources":["../src/Guest/GuestAware.ts","../src/Guest/Guest.ts","../src/Patron/PatronOnce.ts","../src/Guest/GuestCast.ts","../src/Patron/PatronPool.ts","../src/Source/Source.ts","../src/Source/SourceEmpty.ts","../src/Guest/GuestObject.ts","../src/Guest/GuestPool.ts","../src/Guest/GuestAwareAll.ts","../src/Guest/GuestAwareSequence.ts","../src/Guest/GuestAwareMap.ts","../src/Guest/GuestAwareRace.ts","../src/Guest/GuestAwareActive.ts","../src/Guest/GuestSync.ts","../src/Guest/GuestDisposable.ts","../src/Patron/Patron.ts","../src/Source/SourceDynamic.ts","../src/Private/PrivateClass.ts","../src/Private/Private.ts"],"sourcesContent":["import { GuestType } from \"./Guest\";\n\nexport type GuestAwareExecutorType<T> = (guest: GuestType<T>) => unknown;\n\nexport interface GuestAwareObjectType<T> {\n value: GuestAwareExecutorType<T>\n}\n\nexport type GuestAwareType<T = any> = GuestAwareExecutorType<T> | GuestAwareObjectType<T>\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/utils/give\n */\nexport function value<T>(guestAware: GuestAwareType<T>, guest: GuestType<T>) {\n if (typeof guestAware === 'function') {\n return guestAware(guest);\n } else {\n return guestAware.value(guest);\n }\n}\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/utils/is-guest-aware\n */\nexport function isGuestAware(mbGuestAware: any): mbGuestAware is GuestAwareType {\n return typeof mbGuestAware === 'function' || typeof mbGuestAware?.value === 'function';\n}\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-aware\n */\nexport class GuestAware<T = any> implements GuestAwareObjectType<T> {\n public constructor(private guestAware: GuestAwareType<T>) { }\n\n public value(guest: GuestType<T>): GuestType<T> {\n value(this.guestAware, 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/#/utils/is-guest\n */\nexport function isGuest(mbGuest: any): mbGuest is GuestType {\n return typeof mbGuest === 'function' || typeof mbGuest?.give === 'function';\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 { PoolType } from \"./PatronPool\";\nimport { give, GuestType, GiveOptions, GuestObjectType } from \"../Guest/Guest\";\nimport {\n GuestDisposableType,\n MaybeDisposableType,\n} from \"../Guest/GuestDisposable\";\n\nexport type PoolAwareOptions = {\n pool?: PoolType;\n castedGuest?: GuestObjectType;\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 this.received = true;\n give(value, this.baseGuest, options);\n }\n return this;\n }\n\n public disposed(value: T | null): boolean {\n if (this.received) {\n return true;\n }\n const maybeDisposable = this.baseGuest as MaybeDisposableType;\n return maybeDisposable.disposed ? maybeDisposable.disposed(value) : false;\n }\n}\n","import {\n GuestDisposableType,\n MaybeDisposableType,\n} from \"./GuestDisposable\";\nimport { give, GiveOptions, GuestType } from \"./Guest\";\nimport { PoolAwareOptions } from \"../Patron/PatronOnce\";\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, {\n ...options,\n data: {\n ...(options?.data ?? {}),\n castedGuest: (options?.data as PoolAwareOptions)?.castedGuest ?? this,\n }\n });\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 { Guest, GuestObjectType, GuestType } from \"../Guest/Guest\";\nimport { GuestAwareObjectType } from \"../Guest/GuestAware\";\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> = GuestAwareObjectType<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 { 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, options) => {\n if (value !== null) {\n give(value, guest, options);\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","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 { GuestAwareObjectType } from \"./GuestAware\";\nimport { Source } from \"../Source/Source\";\nimport { Guest, GuestObjectType, GuestType } from \"./Guest\";\nimport { GuestCast } from \"./GuestCast\";\nimport { GuestObject } from \"./GuestObject\";\nimport { GuestPool } from \"./GuestPool\";\n\nexport interface GuestAwareAllType<T = any> extends GuestAwareObjectType<T> {\n valueArray(guest: GuestObjectType<T>): this;\n guestKey<R>(key: string): GuestObjectType<R>;\n}\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-aware-all\n */\nexport class GuestAwareAll<T> implements GuestAwareAllType<T> {\n private theAll: Source<Record<string, unknown>>;\n\n private keysKnown = new Set();\n\n private keysFilled = new Set();\n\n private filledAllPool = new GuestPool(this);\n\n public constructor() {\n this.theAll = new Source<Record<string, unknown>>({});\n }\n\n public valueArray(guest: GuestType<T>) {\n const guestObject = new GuestObject(guest);\n this.filledAllPool.add(\n new GuestCast(guestObject, (value: Record<string, unknown>) => {\n guestObject.give(Object.values(value) as T);\n }),\n );\n if (this.isAllFilled()) {\n this.theAll.value(\n new Guest((all: Record<string, unknown>) => {\n this.filledAllPool.give(Object.values(all));\n }),\n );\n }\n return this;\n }\n\n public value(guest: GuestType<T>) {\n const guestObject = new GuestObject(guest);\n if (this.isAllFilled()) {\n this.filledAllPool.add(guestObject);\n this.theAll.value(\n new Guest((all) => {\n this.filledAllPool.give(all);\n }),\n );\n } else {\n this.filledAllPool.add(guestObject);\n }\n return this;\n }\n\n public guestKey<R>(key: string): GuestObjectType<R> {\n this.keysKnown.add(key);\n return new Guest((value) => {\n // Обернул в очередь чтобы можно было синхронно наполнить очередь известных ключей\n queueMicrotask(() => {\n this.theAll.value(\n new Guest((all: Record<string, unknown>) => {\n this.keysFilled.add(key);\n const lastAll = {\n ...all,\n [key]: value,\n };\n this.theAll.give(lastAll);\n if (this.isAllFilled()) {\n this.filledAllPool.give(lastAll);\n }\n }),\n );\n });\n });\n }\n\n private isAllFilled() {\n return (\n this.keysFilled.size > 0 && this.keysFilled.size === this.keysKnown.size\n );\n }\n}\n","import { PatronOnce } from \"../Patron/PatronOnce\";\nimport { PrivateType } from \"../Private/Private\";\nimport { SourceEmpty } from \"../Source/SourceEmpty\";\nimport { give, GuestType } from \"./Guest\";\nimport { GuestAwareObjectType, GuestAwareType, isGuestAware, value } from \"./GuestAware\";\nimport { GuestAwareAll } from \"./GuestAwareAll\";\nimport { GuestCast } from \"./GuestCast\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-aware-sequence\n */\nexport class GuestAwareSequence<T, TG> implements GuestAwareObjectType<TG[]> {\n public constructor(\n private baseSource: GuestAwareType<T[]>,\n private targetSource: PrivateType<GuestAwareType<TG>>\n ) { }\n\n public value(guest: GuestType<TG[]>) {\n const all = new GuestAwareAll<TG[]>();\n const sequenceSource = new SourceEmpty();\n const targetSource = this.targetSource.get(\n sequenceSource\n )\n\n value(\n this.baseSource,\n new GuestCast(guest, (theValue) => {\n let index = 0;\n\n const nextItemHandle = () => {\n if (theValue[index + 1] !== undefined) {\n index = index + 1;\n handle();\n } else {\n all.valueArray(guest);\n }\n }\n\n function handle() {\n sequenceSource.give(null);\n const nextValue = theValue[index];\n if (isGuestAware(nextValue)) {\n value(nextValue, new PatronOnce((theNextValue) => {\n sequenceSource.give(theNextValue);\n value(targetSource, all.guestKey(index.toString()));\n nextItemHandle();\n }));\n } else {\n sequenceSource.give(nextValue);\n value(targetSource, all.guestKey(index.toString()));\n nextItemHandle();\n }\n }\n\n if (theValue[index] !== undefined) {\n handle();\n } else {\n give([], guest);\n }\n })\n );\n return this;\n }\n}\n","import { PrivateType } from \"../Private/Private\";\nimport { give, GuestType } from \"./Guest\";\nimport { GuestAware, GuestAwareObjectType, GuestAwareType, isGuestAware, value } from \"./GuestAware\";\nimport { GuestAwareAll } from \"./GuestAwareAll\";\nimport { GuestCast } from \"./GuestCast\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-aware-map\n */\nexport class GuestAwareMap<T, TG> implements GuestAwareObjectType<TG[]> {\n public constructor(\n private baseSource: GuestAwareType<T[]>,\n private targetSource: PrivateType<GuestAwareType<TG>>\n ) { }\n\n public value(guest: GuestType<TG[]>) {\n const all = new GuestAwareAll();\n value(\n this.baseSource,\n new GuestCast(<GuestType>guest, (theValue) => {\n theValue.forEach((val, index) => {\n const valueSource = isGuestAware(val)\n ? val\n : new GuestAware((innerGuest) => {\n give(val, innerGuest);\n });\n const targetSource = this.targetSource.get(valueSource)\n value(targetSource, all.guestKey(index.toString()));\n });\n })\n )\n all.valueArray(<GuestType>guest);\n return this;\n }\n}\n","import { give, GuestType } from \"./Guest\";\nimport { GuestAwareObjectType, GuestAwareType, value } from \"./GuestAware\";\nimport { GuestCast } from \"./GuestCast\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-aware-race\n */\nexport class GuestAwareRace<T> implements GuestAwareObjectType<T> {\n public constructor(private guestAwares: GuestAwareType<T>[]) { }\n\n public value(guest: GuestType<T>): this {\n let connectedWithGuestAware: GuestAwareType | null = null;\n this.guestAwares.forEach(guestAware => {\n value(\n guestAware,\n new GuestCast(<GuestType>guest, (value) => {\n if (!connectedWithGuestAware || connectedWithGuestAware === guestAware) {\n give(value as T, guest);\n connectedWithGuestAware = guestAware\n }\n })\n );\n });\n return this;\n }\n}\n","import { SourceType } from \"../Source/Source\";\nimport { SourceEmpty } from \"../Source/SourceEmpty\";\nimport { GuestType } from \"./Guest\";\nimport { GuestAwareObjectType } from \"./GuestAware\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/utils/action-type\n */\nexport interface ActionType<P = any> {\n do(config: P): this;\n}\n\nexport interface GuestAwareAcitveType<R = unknown, T = unknown> extends GuestAwareObjectType<T>, ActionType<R> {\n}\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-aware-active\n */\nexport class GuestAwareActive<R, T> implements GuestAwareAcitveType<R, T> {\n private source = new SourceEmpty<T>();\n\n public constructor(private configExecutor: (config: R, source: SourceType<T>) => void) { }\n\n public do(config: R): this {\n this.configExecutor(config, this.source);\n return this;\n }\n\n public value(guest: GuestType<T>): this {\n this.source.value(guest);\n return this;\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 { give, GuestType } from \"../Guest/Guest\";\nimport { GuestAwareType, value } from \"../Guest/GuestAware\";\nimport { PatronPool } from \"../Patron/PatronPool\";\nimport { SourceType } from \"./Source\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/source-dynamic\n */\nexport class SourceDynamic<T = unknown> implements SourceType<T> {\n public constructor(\n private baseGuest: GuestType<T>,\n private baseGuestAware: GuestAwareType<T>,\n ) { }\n\n public value(guest: GuestType<T>) {\n value(this.baseGuestAware, guest);\n return this;\n }\n\n public give(value: T) {\n give(value, this.baseGuest);\n return this;\n }\n\n public pool(): PatronPool<T> {\n throw Error('No pool in SourceDynamic');\n }\n}\n","import { PrivateType } from \"./Private\";\n\ninterface Constructable<T> {\n new(...args: unknown[]): T;\n}\n\ninterface Prototyped<T> {\n prototype: T;\n}\n\nexport class PrivateClass<T> implements PrivateType<T> {\n public constructor(\n private constructorFn: Prototyped<T>,\n private modules: Record<string, unknown> = {},\n ) { }\n\n public get<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.modules,\n ) as CT extends null ? T : CT;\n }\n}\n","/**\n * @url https://kosukhin.github.io/patron.site/#/utils/private\n */\nexport interface PrivateType<T> {\n get<R extends unknown[], CT = null>(...args: R): CT extends null ? T : CT;\n}\n\nexport class Private<T> implements PrivateType<T> {\n public constructor(private buildingFn: (...args: any[]) => T) { }\n\n public get<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":["value","guestAware","guest","isGuestAware","mbGuestAware","GuestAware","constructor","this","give","data","options","isGuest","mbGuest","Guest","receiver","PatronOnce","baseGuest","__publicField","introduction","received","disposed","maybeDisposable","GuestCast","sourceGuest","targetGuest","castedGuest","poolSets","Map","removePatronFromPools","patron","forEach","pool","delete","isPatronInPools","inPool","has","PatronPool","initiator","patrons","Set","set","lastMicrotask","doReceive","target","sendValueToGuest","currentMicroTask","queueMicrotask","size","add","shouldBePatron","Error","remove","distribute","receiving","possiblePatron","guestDisposed","Source","sourceDocument","thePool","SourceEmpty","baseSource","GuestObject","GuestPool","patronPool","deliverToGuests","guests","clear","GuestAwareAll","theAll","valueArray","guestObject","filledAllPool","Object","values","isAllFilled","all","guestKey","key","keysKnown","keysFilled","lastAll","GuestAwareSequence","targetSource","sequenceSource","get","theValue","index","nextItemHandle","handle","nextValue","theNextValue","toString","GuestAwareMap","val","valueSource","innerGuest","GuestAwareRace","guestAwares","connectedWithGuestAware","GuestAwareActive","configExecutor","config","source","GuestSync","GuestDisposable","disposeCheck","Patron","willBePatron","SourceDynamic","baseGuestAware","PrivateClass","constructorFn","modules","args","Private","buildingFn"],"mappings":"AAagB,SAAAA,EAASC,EAA+BC,GAClD,MAAsB,mBAAfD,EACFA,EAAWC,GAEXD,EAAWD,MAAME,EAE5B,CAKO,SAASC,EAAaC,GAC3B,MAA+B,mBAAjBA,GAA8D,mBAAxBA,GAAcJ,KACpE,CAKO,MAAMK,EACJ,WAAAC,CAAoBL,GAAAM,KAAAN,WAAAA,CAAiC,CAErD,KAAAD,CAAME,GAEJ,OADDF,EAAAO,KAAKN,WAAYC,GAChBA,CACT,EChBc,SAAAM,EAAQC,EAASP,EAAqBQ,GAC/B,mBAAVR,EACTA,EAAMO,EAAMC,GAENR,EAAAM,KAAKC,EAAMC,EAErB,CAKO,SAASC,EAAQC,GACtB,MAA0B,mBAAZA,GAAmD,mBAAlBA,GAASJ,IAC1D,CAKO,MAAMK,EACJ,WAAAP,CAAoBQ,GAAAP,KAAAO,SAAAA,CAAkC,CAEtD,IAAAN,CAAKR,EAAUU,GAEb,OADFH,KAAAO,SAASd,EAAOU,GACdH,IACT,uIC9BK,MAAMQ,EAGJ,WAAAT,CAAoBU,GAAAT,KAAAS,UAAAA,EAF3BC,EAAAV,KAAQ,YAAW,EAEmC,CAE/C,YAAAW,GACE,MAAA,QACT,CAEO,IAAAV,CAAKR,EAAUU,GAKb,OAJFH,KAAKY,WACRZ,KAAKY,UAAW,EACXX,EAAAR,EAAOO,KAAKS,UAAWN,IAEvBH,IACT,CAEO,QAAAa,CAASpB,GACd,GAAIO,KAAKY,SACA,OAAA,EAET,MAAME,EAAkBd,KAAKS,UAC7B,QAAOK,EAAgBD,UAAWC,EAAgBD,SAASpB,EAC7D,EC5BK,MAAMsB,EACJ,WAAAhB,C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ECbK,MAAM4G,EACJ,WAAAtG,CACGU,EACA6F,GADAtG,KAAAS,UAAAA,EACAT,KAAAsG,eAAAA,CACN,CAEG,KAAA7G,CAAME,GAEJ,OADDF,EAAAO,KAAKsG,eAAgB3G,GACpBK,IACT,CAEO,IAAAC,CAAKR,GAEH,OADFA,EAAAA,EAAOO,KAAKS,WACVT,IACT,CAEO,IAAAwB,GACL,MAAMmB,MAAM,2BACd,EChBK,MAAM4D,EACJ,WAAAxG,CACGyG,EACAC,EAAmC,IADnCzG,KAAAwG,cAAAA,EACAxG,KAAAyG,QAAAA,CACN,CAEG,GAAA5B,IACF6B,GAEH,OAAO,IAAK1G,KAAKwG,iBACZE,EACH1G,KAAKyG,QAET,EChBK,MAAME,EACJ,WAAA5G,CAAoB6G,GAAA5G,KAAA4G,WAAAA,CAAqC,CAEzD,GAAA/B,IAAuC6B,GACrC,OAAA1G,KAAK4G,cAAcF,EAC5B"}
package/dist/patron.mjs CHANGED
@@ -38,6 +38,33 @@ class Guest {
38
38
  }
39
39
  }
40
40
 
41
+ var __defProp$6 = Object.defineProperty;
42
+ var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
43
+ var __publicField$6 = (obj, key, value) => __defNormalProp$6(obj, key + "" , value);
44
+ class PatronOnce {
45
+ constructor(baseGuest) {
46
+ this.baseGuest = baseGuest;
47
+ __publicField$6(this, "received", false);
48
+ }
49
+ introduction() {
50
+ return "patron";
51
+ }
52
+ give(value, options) {
53
+ if (!this.received) {
54
+ this.received = true;
55
+ give(value, this.baseGuest, options);
56
+ }
57
+ return this;
58
+ }
59
+ disposed(value) {
60
+ if (this.received) {
61
+ return true;
62
+ }
63
+ const maybeDisposable = this.baseGuest;
64
+ return maybeDisposable.disposed ? maybeDisposable.disposed(value) : false;
65
+ }
66
+ }
67
+
41
68
  class GuestCast {
42
69
  constructor(sourceGuest, targetGuest) {
43
70
  this.sourceGuest = sourceGuest;
@@ -68,9 +95,9 @@ class GuestCast {
68
95
  }
69
96
  }
70
97
 
71
- var __defProp$6 = Object.defineProperty;
72
- var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
73
- var __publicField$6 = (obj, key, value) => __defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
98
+ var __defProp$5 = Object.defineProperty;
99
+ var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
100
+ var __publicField$5 = (obj, key, value) => __defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
74
101
  const poolSets = /* @__PURE__ */ new Map();
75
102
  const removePatronFromPools = (patron) => {
76
103
  poolSets.forEach((pool) => {
@@ -89,8 +116,8 @@ const isPatronInPools = (patron) => {
89
116
  class PatronPool {
90
117
  constructor(initiator) {
91
118
  this.initiator = initiator;
92
- __publicField$6(this, "patrons");
93
- __publicField$6(this, "give");
119
+ __publicField$5(this, "patrons");
120
+ __publicField$5(this, "give");
94
121
  this.patrons = /* @__PURE__ */ new Set();
95
122
  poolSets.set(this, this.patrons);
96
123
  let lastMicrotask = null;
@@ -153,13 +180,13 @@ class PatronPool {
153
180
  }
154
181
  }
155
182
 
156
- var __defProp$5 = Object.defineProperty;
157
- var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
158
- var __publicField$5 = (obj, key, value) => __defNormalProp$5(obj, key + "" , value);
183
+ var __defProp$4 = Object.defineProperty;
184
+ var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
185
+ var __publicField$4 = (obj, key, value) => __defNormalProp$4(obj, key + "" , value);
159
186
  class Source {
160
187
  constructor(sourceDocument) {
161
188
  this.sourceDocument = sourceDocument;
162
- __publicField$5(this, "thePool", new PatronPool(this));
189
+ __publicField$4(this, "thePool", new PatronPool(this));
163
190
  }
164
191
  pool() {
165
192
  return this.thePool;
@@ -179,6 +206,32 @@ class Source {
179
206
  }
180
207
  }
181
208
 
209
+ var __defProp$3 = Object.defineProperty;
210
+ var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
211
+ var __publicField$3 = (obj, key, value) => __defNormalProp$3(obj, key + "" , value);
212
+ class SourceEmpty {
213
+ constructor() {
214
+ __publicField$3(this, "baseSource", new Source(null));
215
+ }
216
+ value(guest) {
217
+ this.baseSource.value(
218
+ new GuestCast(guest, (value, options) => {
219
+ if (value !== null) {
220
+ give(value, guest, options);
221
+ }
222
+ })
223
+ );
224
+ return this;
225
+ }
226
+ give(value) {
227
+ this.baseSource.give(value);
228
+ return this;
229
+ }
230
+ pool() {
231
+ return this.baseSource.pool();
232
+ }
233
+ }
234
+
182
235
  class GuestObject {
183
236
  constructor(baseGuest) {
184
237
  this.baseGuest = baseGuest;
@@ -203,13 +256,13 @@ class GuestObject {
203
256
  }
204
257
  }
205
258
 
206
- var __defProp$4 = Object.defineProperty;
207
- var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
208
- var __publicField$4 = (obj, key, value) => __defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
259
+ var __defProp$2 = Object.defineProperty;
260
+ var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
261
+ var __publicField$2 = (obj, key, value) => __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
209
262
  class GuestPool {
210
263
  constructor(initiator) {
211
- __publicField$4(this, "guests", /* @__PURE__ */ new Set());
212
- __publicField$4(this, "patronPool");
264
+ __publicField$2(this, "guests", /* @__PURE__ */ new Set());
265
+ __publicField$2(this, "patronPool");
213
266
  this.patronPool = new PatronPool(initiator);
214
267
  }
215
268
  give(value, options) {
@@ -245,15 +298,15 @@ class GuestPool {
245
298
  }
246
299
  }
247
300
 
248
- var __defProp$3 = Object.defineProperty;
249
- var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
250
- var __publicField$3 = (obj, key, value) => __defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
301
+ var __defProp$1 = Object.defineProperty;
302
+ var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
303
+ var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
251
304
  class GuestAwareAll {
252
305
  constructor() {
253
- __publicField$3(this, "theAll");
254
- __publicField$3(this, "keysKnown", /* @__PURE__ */ new Set());
255
- __publicField$3(this, "keysFilled", /* @__PURE__ */ new Set());
256
- __publicField$3(this, "filledAllPool", new GuestPool(this));
306
+ __publicField$1(this, "theAll");
307
+ __publicField$1(this, "keysKnown", /* @__PURE__ */ new Set());
308
+ __publicField$1(this, "keysFilled", /* @__PURE__ */ new Set());
309
+ __publicField$1(this, "filledAllPool", new GuestPool(this));
257
310
  this.theAll = new Source({});
258
311
  }
259
312
  valueArray(guest) {
@@ -311,68 +364,15 @@ class GuestAwareAll {
311
364
  }
312
365
  }
313
366
 
314
- var __defProp$2 = Object.defineProperty;
315
- var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
316
- var __publicField$2 = (obj, key, value) => __defNormalProp$2(obj, key + "" , value);
317
- class SourceEmpty {
318
- constructor() {
319
- __publicField$2(this, "baseSource", new Source(null));
320
- }
321
- value(guest) {
322
- this.baseSource.value(
323
- new GuestCast(guest, (value, options) => {
324
- if (value !== null) {
325
- give(value, guest, options);
326
- }
327
- })
328
- );
329
- return this;
330
- }
331
- give(value) {
332
- this.baseSource.give(value);
333
- return this;
334
- }
335
- pool() {
336
- return this.baseSource.pool();
337
- }
338
- }
339
-
340
- var __defProp$1 = Object.defineProperty;
341
- var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
342
- var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, key + "" , value);
343
- class PatronOnce {
344
- constructor(baseGuest) {
345
- this.baseGuest = baseGuest;
346
- __publicField$1(this, "received", false);
347
- }
348
- introduction() {
349
- return "patron";
350
- }
351
- give(value, options) {
352
- if (!this.received) {
353
- this.received = true;
354
- give(value, this.baseGuest, options);
355
- }
356
- return this;
357
- }
358
- disposed(value) {
359
- if (this.received) {
360
- return true;
361
- }
362
- const maybeDisposable = this.baseGuest;
363
- return maybeDisposable.disposed ? maybeDisposable.disposed(value) : false;
364
- }
365
- }
366
-
367
367
  class GuestAwareSequence {
368
- constructor(baseSource, targetSourceFactory) {
368
+ constructor(baseSource, targetSource) {
369
369
  this.baseSource = baseSource;
370
- this.targetSourceFactory = targetSourceFactory;
370
+ this.targetSource = targetSource;
371
371
  }
372
372
  value(guest) {
373
373
  const all = new GuestAwareAll();
374
374
  const sequenceSource = new SourceEmpty();
375
- const targetSource = this.targetSourceFactory.create(
375
+ const targetSource = this.targetSource.get(
376
376
  sequenceSource
377
377
  );
378
378
  value(
@@ -414,9 +414,9 @@ class GuestAwareSequence {
414
414
  }
415
415
 
416
416
  class GuestAwareMap {
417
- constructor(baseSource, targetSourceFactory) {
417
+ constructor(baseSource, targetSource) {
418
418
  this.baseSource = baseSource;
419
- this.targetSourceFactory = targetSourceFactory;
419
+ this.targetSource = targetSource;
420
420
  }
421
421
  value(guest) {
422
422
  const all = new GuestAwareAll();
@@ -427,7 +427,7 @@ class GuestAwareMap {
427
427
  const valueSource = isGuestAware(val) ? val : new GuestAware((innerGuest) => {
428
428
  give(val, innerGuest);
429
429
  });
430
- const targetSource = this.targetSourceFactory.create(valueSource);
430
+ const targetSource = this.targetSource.get(valueSource);
431
431
  value(targetSource, all.guestKey(index.toString()));
432
432
  });
433
433
  })
@@ -538,27 +538,27 @@ class SourceDynamic {
538
538
  }
539
539
  }
540
540
 
541
- class Factory {
542
- constructor(constructorFn, factories = {}) {
541
+ class PrivateClass {
542
+ constructor(constructorFn, modules = {}) {
543
543
  this.constructorFn = constructorFn;
544
- this.factories = factories;
544
+ this.modules = modules;
545
545
  }
546
- create(...args) {
546
+ get(...args) {
547
547
  return new this.constructorFn(
548
548
  ...args,
549
- this.factories
549
+ this.modules
550
550
  );
551
551
  }
552
552
  }
553
553
 
554
- class Module {
554
+ class Private {
555
555
  constructor(buildingFn) {
556
556
  this.buildingFn = buildingFn;
557
557
  }
558
- create(...args) {
558
+ get(...args) {
559
559
  return this.buildingFn(...args);
560
560
  }
561
561
  }
562
562
 
563
- export { Factory, Guest, GuestAware, GuestAwareActive, GuestAwareAll, GuestAwareMap, GuestAwareRace, GuestAwareSequence, GuestCast, GuestDisposable, GuestObject, GuestPool, GuestSync, Module, Patron, PatronOnce, PatronPool, Source, SourceDynamic, SourceEmpty, give, isGuest, isGuestAware, isPatronInPools, removePatronFromPools, value };
563
+ export { Guest, GuestAware, GuestAwareActive, GuestAwareAll, GuestAwareMap, GuestAwareRace, GuestAwareSequence, GuestCast, GuestDisposable, GuestObject, GuestPool, GuestSync, Patron, PatronOnce, PatronPool, Private, PrivateClass, Source, SourceDynamic, SourceEmpty, give, isGuest, isGuestAware, isPatronInPools, removePatronFromPools, value };
564
564
  //# sourceMappingURL=patron.mjs.map