patron-oop 1.40.0 → 1.42.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.husky/pre-push +2 -0
- package/CHANGELOG.md +21 -0
- package/dist/patron.cjs +98 -8
- package/dist/patron.cjs.map +1 -1
- package/dist/patron.d.ts +1 -1
- package/dist/patron.js +98 -8
- package/dist/patron.js.map +1 -1
- package/dist/patron.min.js +1 -1
- package/dist/patron.min.mjs +1 -1
- package/dist/patron.min.mjs.map +1 -1
- package/dist/patron.mjs +98 -8
- package/dist/patron.mjs.map +1 -1
- package/eslint.config.mjs +6 -7
- package/package.json +7 -4
- package/src/Guest/Guest.ts +17 -4
- package/src/Guest/GuestAware.ts +26 -6
- package/src/Guest/GuestAwareActive.test.ts +5 -7
- package/src/Guest/GuestAwareActive.ts +12 -3
- package/src/Guest/GuestAwareMap.defered.test.ts +10 -12
- package/src/Guest/GuestAwareMap.fn.test.ts +5 -8
- package/src/Guest/GuestAwareMap.test.ts +7 -10
- package/src/Guest/GuestAwareMap.ts +21 -8
- package/src/Guest/GuestAwareRace.test.ts +8 -8
- package/src/Guest/GuestAwareRace.ts +12 -5
- package/src/Guest/GuestAwareSequence.defered.test.ts +18 -15
- package/src/Guest/GuestAwareSequence.test.ts +6 -9
- package/src/Guest/GuestAwareSequence.ts +26 -13
- package/src/Guest/GuestCast.ts +10 -6
- package/src/Guest/GuestDisposable.ts +8 -1
- package/src/Guest/GuestObject.ts +6 -5
- package/src/Guest/GuestPool.test.ts +15 -2
- package/src/Guest/GuestSync.ts +5 -1
- package/src/Patron/Patron.ts +5 -1
- package/src/Patron/PatronOnce.sourceEmpty.test.ts +7 -4
- package/src/Patron/PatronOnce.test.ts +2 -2
- package/src/Patron/PatronOnce.ts +5 -1
- package/src/Patron/PatronPool.ts +6 -0
- package/src/Private/Private.test.ts +2 -2
- package/src/Private/Private.ts +9 -3
- package/src/Private/PrivateClass.modules.test.ts +1 -1
- package/src/Private/PrivateClass.test.ts +2 -4
- package/src/Private/PrivateClass.ts +6 -2
- package/src/Source/Source.ts +5 -1
- package/src/Source/SourceDynamic.ofSource.test.ts +4 -4
- package/src/Source/SourceDynamic.test.ts +2 -2
- package/src/Source/SourceDynamic.ts +9 -2
package/dist/patron.js
CHANGED
@@ -1,4 +1,10 @@
|
|
1
1
|
function value(guestAware, guest) {
|
2
|
+
if (guestAware === void 0) {
|
3
|
+
throw new Error("value didnt receive guestAware argument");
|
4
|
+
}
|
5
|
+
if (guest === void 0) {
|
6
|
+
throw new Error("value didnt receive guest argument");
|
7
|
+
}
|
2
8
|
if (typeof guestAware === "function") {
|
3
9
|
return guestAware(guest);
|
4
10
|
} else {
|
@@ -6,11 +12,17 @@ function value(guestAware, guest) {
|
|
6
12
|
}
|
7
13
|
}
|
8
14
|
function isGuestAware(mbGuestAware) {
|
15
|
+
if (mbGuestAware === void 0) {
|
16
|
+
throw new Error("isGuestAware didnt receive mbGuestAware argument");
|
17
|
+
}
|
9
18
|
return typeof mbGuestAware === "function" || typeof mbGuestAware?.value === "function";
|
10
19
|
}
|
11
20
|
class GuestAware {
|
12
21
|
constructor(guestAware) {
|
13
22
|
this.guestAware = guestAware;
|
23
|
+
if (guestAware === void 0) {
|
24
|
+
throw new Error("GuestAware constructor didnt receive executor function");
|
25
|
+
}
|
14
26
|
}
|
15
27
|
value(guest) {
|
16
28
|
value(this.guestAware, guest);
|
@@ -19,6 +31,12 @@ class GuestAware {
|
|
19
31
|
}
|
20
32
|
|
21
33
|
function give(data, guest, options) {
|
34
|
+
if (data === void 0) {
|
35
|
+
throw new Error("give didnt receive data argument");
|
36
|
+
}
|
37
|
+
if (guest === void 0) {
|
38
|
+
throw new Error("give didnt receive guest argument");
|
39
|
+
}
|
22
40
|
if (typeof guest === "function") {
|
23
41
|
guest(data, options);
|
24
42
|
} else {
|
@@ -26,11 +44,17 @@ function give(data, guest, options) {
|
|
26
44
|
}
|
27
45
|
}
|
28
46
|
function isGuest(mbGuest) {
|
47
|
+
if (mbGuest === void 0) {
|
48
|
+
throw new Error("isGuest didnt receive mbGuest argument");
|
49
|
+
}
|
29
50
|
return typeof mbGuest === "function" || typeof mbGuest?.give === "function";
|
30
51
|
}
|
31
52
|
class Guest {
|
32
53
|
constructor(receiver) {
|
33
54
|
this.receiver = receiver;
|
55
|
+
if (!receiver) {
|
56
|
+
throw new Error("reseiver function was not passed to Guest constructor");
|
57
|
+
}
|
34
58
|
}
|
35
59
|
give(value, options) {
|
36
60
|
this.receiver(value, options);
|
@@ -45,6 +69,9 @@ class PatronOnce {
|
|
45
69
|
constructor(baseGuest) {
|
46
70
|
this.baseGuest = baseGuest;
|
47
71
|
__publicField$6(this, "received", false);
|
72
|
+
if (baseGuest === void 0) {
|
73
|
+
throw new Error("PatronOnce didnt receive baseGuest argument");
|
74
|
+
}
|
48
75
|
}
|
49
76
|
introduction() {
|
50
77
|
return "patron";
|
@@ -69,6 +96,12 @@ class GuestCast {
|
|
69
96
|
constructor(sourceGuest, targetGuest) {
|
70
97
|
this.sourceGuest = sourceGuest;
|
71
98
|
this.targetGuest = targetGuest;
|
99
|
+
if (sourceGuest === void 0) {
|
100
|
+
throw new Error("GuestCast didnt receive sourceGuest argument");
|
101
|
+
}
|
102
|
+
if (targetGuest === void 0) {
|
103
|
+
throw new Error("GuestCast didnt receive targetGuest argument");
|
104
|
+
}
|
72
105
|
}
|
73
106
|
introduction() {
|
74
107
|
if (typeof this.sourceGuest === "function") {
|
@@ -100,11 +133,17 @@ var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key,
|
|
100
133
|
var __publicField$5 = (obj, key, value) => __defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
|
101
134
|
const poolSets = /* @__PURE__ */ new Map();
|
102
135
|
const removePatronFromPools = (patron) => {
|
136
|
+
if (patron === void 0) {
|
137
|
+
throw new Error("removePatronFromPools didnt receive patron argument");
|
138
|
+
}
|
103
139
|
poolSets.forEach((pool) => {
|
104
140
|
pool.delete(patron);
|
105
141
|
});
|
106
142
|
};
|
107
143
|
const isPatronInPools = (patron) => {
|
144
|
+
if (patron === void 0) {
|
145
|
+
throw new Error("isPatronInPools didnt receive patron argument");
|
146
|
+
}
|
108
147
|
let inPool = false;
|
109
148
|
poolSets.forEach((pool) => {
|
110
149
|
if (!inPool) {
|
@@ -187,6 +226,9 @@ class Source {
|
|
187
226
|
constructor(sourceDocument) {
|
188
227
|
this.sourceDocument = sourceDocument;
|
189
228
|
__publicField$4(this, "thePool", new PatronPool(this));
|
229
|
+
if (sourceDocument === void 0) {
|
230
|
+
throw new Error("Source didnt receive sourceDocument argument");
|
231
|
+
}
|
190
232
|
}
|
191
233
|
pool() {
|
192
234
|
return this.thePool;
|
@@ -235,6 +277,9 @@ class SourceEmpty {
|
|
235
277
|
class GuestObject {
|
236
278
|
constructor(baseGuest) {
|
237
279
|
this.baseGuest = baseGuest;
|
280
|
+
if (baseGuest === void 0) {
|
281
|
+
throw new Error("GuestObject didnt receive baseGuest argument");
|
282
|
+
}
|
238
283
|
}
|
239
284
|
give(value, options) {
|
240
285
|
let guest = this.baseGuest;
|
@@ -368,13 +413,17 @@ class GuestAwareSequence {
|
|
368
413
|
constructor(baseSource, targetSource) {
|
369
414
|
this.baseSource = baseSource;
|
370
415
|
this.targetSource = targetSource;
|
416
|
+
if (baseSource === void 0) {
|
417
|
+
throw new Error("GuestAwareSequence didnt receive baseSource argument");
|
418
|
+
}
|
419
|
+
if (targetSource === void 0) {
|
420
|
+
throw new Error("GuestAwareSequence didnt receive targetSource argument");
|
421
|
+
}
|
371
422
|
}
|
372
423
|
value(guest) {
|
373
424
|
const all = new GuestAwareAll();
|
374
425
|
const sequenceSource = new SourceEmpty();
|
375
|
-
const targetSource = this.targetSource.get(
|
376
|
-
sequenceSource
|
377
|
-
);
|
426
|
+
const targetSource = this.targetSource.get(sequenceSource);
|
378
427
|
value(
|
379
428
|
this.baseSource,
|
380
429
|
new GuestCast(guest, (theValue) => {
|
@@ -391,11 +440,14 @@ class GuestAwareSequence {
|
|
391
440
|
sequenceSource.give(null);
|
392
441
|
const nextValue = theValue[index];
|
393
442
|
if (isGuestAware(nextValue)) {
|
394
|
-
value(
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
443
|
+
value(
|
444
|
+
nextValue,
|
445
|
+
new PatronOnce((theNextValue) => {
|
446
|
+
sequenceSource.give(theNextValue);
|
447
|
+
value(targetSource, all.guestKey(index.toString()));
|
448
|
+
nextItemHandle();
|
449
|
+
})
|
450
|
+
);
|
399
451
|
} else {
|
400
452
|
sequenceSource.give(nextValue);
|
401
453
|
value(targetSource, all.guestKey(index.toString()));
|
@@ -417,6 +469,12 @@ class GuestAwareMap {
|
|
417
469
|
constructor(baseSource, targetSource) {
|
418
470
|
this.baseSource = baseSource;
|
419
471
|
this.targetSource = targetSource;
|
472
|
+
if (baseSource === void 0) {
|
473
|
+
throw new Error("GuestAwareMap didnt receive baseSource argument");
|
474
|
+
}
|
475
|
+
if (targetSource === void 0) {
|
476
|
+
throw new Error("GuestAwareMap didnt receive targetSource argument");
|
477
|
+
}
|
420
478
|
}
|
421
479
|
value(guest) {
|
422
480
|
const all = new GuestAwareAll();
|
@@ -440,6 +498,9 @@ class GuestAwareMap {
|
|
440
498
|
class GuestAwareRace {
|
441
499
|
constructor(guestAwares) {
|
442
500
|
this.guestAwares = guestAwares;
|
501
|
+
if (guestAwares === void 0) {
|
502
|
+
throw new Error("GuestAwareRace didnt receive guestAwares argument");
|
503
|
+
}
|
443
504
|
}
|
444
505
|
value(guest) {
|
445
506
|
let connectedWithGuestAware = null;
|
@@ -465,6 +526,11 @@ class GuestAwareActive {
|
|
465
526
|
constructor(configExecutor) {
|
466
527
|
this.configExecutor = configExecutor;
|
467
528
|
__publicField(this, "source", new SourceEmpty());
|
529
|
+
if (configExecutor === void 0) {
|
530
|
+
throw new Error(
|
531
|
+
"GuestAwareActive constructor didnt receive executor function"
|
532
|
+
);
|
533
|
+
}
|
468
534
|
}
|
469
535
|
do(config) {
|
470
536
|
this.configExecutor(config, this.source);
|
@@ -479,6 +545,9 @@ class GuestAwareActive {
|
|
479
545
|
class GuestSync {
|
480
546
|
constructor(theValue) {
|
481
547
|
this.theValue = theValue;
|
548
|
+
if (theValue === void 0) {
|
549
|
+
throw new Error("GuestSync didnt receive theValue argument");
|
550
|
+
}
|
482
551
|
}
|
483
552
|
give(value) {
|
484
553
|
this.theValue = value;
|
@@ -493,6 +562,12 @@ class GuestDisposable {
|
|
493
562
|
constructor(guest, disposeCheck) {
|
494
563
|
this.guest = guest;
|
495
564
|
this.disposeCheck = disposeCheck;
|
565
|
+
if (guest === void 0) {
|
566
|
+
throw new Error("GuestDisposable didnt receive guest argument");
|
567
|
+
}
|
568
|
+
if (disposeCheck === void 0) {
|
569
|
+
throw new Error("GuestDisposable didnt receive disposeCheck argument");
|
570
|
+
}
|
496
571
|
}
|
497
572
|
disposed(value) {
|
498
573
|
return this.disposeCheck(value);
|
@@ -506,6 +581,9 @@ class GuestDisposable {
|
|
506
581
|
class Patron {
|
507
582
|
constructor(willBePatron) {
|
508
583
|
this.willBePatron = willBePatron;
|
584
|
+
if (willBePatron === void 0) {
|
585
|
+
throw new Error("Patron didnt receive willBePatron argument");
|
586
|
+
}
|
509
587
|
}
|
510
588
|
introduction() {
|
511
589
|
return "patron";
|
@@ -524,6 +602,12 @@ class SourceDynamic {
|
|
524
602
|
constructor(baseGuest, baseGuestAware) {
|
525
603
|
this.baseGuest = baseGuest;
|
526
604
|
this.baseGuestAware = baseGuestAware;
|
605
|
+
if (baseGuest === void 0) {
|
606
|
+
throw new Error("SourceDynamic didnt receive baseGuest argument");
|
607
|
+
}
|
608
|
+
if (baseGuestAware === void 0) {
|
609
|
+
throw new Error("SourceDynamic didnt receive baseGuestAware argument");
|
610
|
+
}
|
527
611
|
}
|
528
612
|
value(guest) {
|
529
613
|
value(this.baseGuestAware, guest);
|
@@ -542,6 +626,9 @@ class PrivateClass {
|
|
542
626
|
constructor(constructorFn, modules = {}) {
|
543
627
|
this.constructorFn = constructorFn;
|
544
628
|
this.modules = modules;
|
629
|
+
if (constructorFn === void 0) {
|
630
|
+
throw new Error("PrivateClass didnt receive constructorFn argument");
|
631
|
+
}
|
545
632
|
}
|
546
633
|
get(...args) {
|
547
634
|
return new this.constructorFn(
|
@@ -554,6 +641,9 @@ class PrivateClass {
|
|
554
641
|
class Private {
|
555
642
|
constructor(buildingFn) {
|
556
643
|
this.buildingFn = buildingFn;
|
644
|
+
if (buildingFn === void 0) {
|
645
|
+
throw new Error("Private didnt receive buildingFn argument");
|
646
|
+
}
|
557
647
|
}
|
558
648
|
get(...args) {
|
559
649
|
return this.buildingFn(...args);
|
package/dist/patron.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"patron.js","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":["__publicField","value"],"mappings":"AAagB,SAAA,KAAA,CAAS,YAA+B,KAAqB,EAAA;AAC3E,EAAI,IAAA,OAAO,eAAe,UAAY,EAAA;AACpC,IAAA,OAAO,WAAW,KAAK,CAAA,CAAA;AAAA,GAClB,MAAA;AACL,IAAO,OAAA,UAAA,CAAW,MAAM,KAAK,CAAA,CAAA;AAAA,GAC/B;AACF,CAAA;AAKO,SAAS,aAAa,YAAmD,EAAA;AAC9E,EAAA,OAAO,OAAO,YAAA,KAAiB,UAAc,IAAA,OAAO,cAAc,KAAU,KAAA,UAAA,CAAA;AAC9E,CAAA;AAKO,MAAM,UAAuD,CAAA;AAAA,EAC3D,YAAoB,UAA+B,EAAA;AAA/B,IAAA,IAAA,CAAA,UAA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,WAAA,CACG,WACA,cACR,EAAA;AAFQ,IAAA,IAAA,CAAA,SAAA,GAAA,SAAA,CAAA;AACA,IAAA,IAAA,CAAA,cAAA,GAAA,cAAA,CAAA;AAAA,GACN;AAAA,EAEG,MAAM,KAAqB,EAAA;AAChC,IAAM,KAAA,CAAA,IAAA,CAAK,gBAAgB,KAAK,CAAA,CAAA;AAChC,IAAO,OAAA,IAAA,CAAA;AAAA,GACT;AAAA,EAEO,KAAKA,MAAU,EAAA;AACpB,IAAKA,IAAAA,CAAAA,MAAAA,EAAO,KAAK,SAAS,CAAA,CAAA;AAC1B,IAAO,OAAA,IAAA,CAAA;AAAA,GACT;AAAA,EAEO,IAAsB,GAAA;AAC3B,IAAA,MAAM,MAAM,0BAA0B,CAAA,CAAA;AAAA,GACxC;AACF;;ACjBO,MAAM,YAA0C,CAAA;AAAA,EAC9C,WACG,CAAA,aAAA,EACA,OAAmC,GAAA,EAC3C,EAAA;AAFQ,IAAA,IAAA,CAAA,aAAA,GAAA,aAAA,CAAA;AACA,IAAA,IAAA,CAAA,OAAA,GAAA,OAAA,CAAA;AAAA,GACN;AAAA,EAEG,OACF,IACuB,EAAA;AAC1B,IAAA,OAAO,IAAK,IAAK,CAAA,aAAA;AAAA,MACf,GAAG,IAAA;AAAA,MACH,IAAK,CAAA,OAAA;AAAA,KACP,CAAA;AAAA,GACF;AACF;;ACjBO,MAAM,OAAqC,CAAA;AAAA,EACzC,YAAoB,UAAmC,EAAA;AAAnC,IAAA,IAAA,CAAA,UAAA,GAAA,UAAA,CAAA;AAAA,GAAqC;AAAA,EAEzD,OAAuC,IAAmC,EAAA;AAC/E,IAAO,OAAA,IAAA,CAAK,UAAW,CAAA,GAAG,IAAI,CAAA,CAAA;AAAA,GAChC;AACF;;;;"}
|
1
|
+
{"version":3,"file":"patron.js","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> =\n | GuestAwareExecutorType<T>\n | 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 (guestAware === undefined) {\n throw new Error(\"value didnt receive guestAware argument\");\n }\n if (guest === undefined) {\n throw new Error(\"value didnt receive guest argument\");\n }\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(\n mbGuestAware: any,\n): mbGuestAware is GuestAwareType {\n if (mbGuestAware === undefined) {\n throw new Error(\"isGuestAware didnt receive mbGuestAware argument\");\n }\n return (\n typeof mbGuestAware === \"function\" ||\n typeof mbGuestAware?.value === \"function\"\n );\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 if (guestAware === undefined) {\n throw new Error(\"GuestAware constructor didnt receive executor function\");\n }\n }\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, This = void> = (\n value: T,\n options?: GiveOptions,\n) => This;\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 (data === undefined) {\n throw new Error(\"give didnt receive data argument\");\n }\n if (guest === undefined) {\n throw new Error(\"give didnt receive guest argument\");\n }\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 if (mbGuest === undefined) {\n throw new Error(\"isGuest didnt receive mbGuest argument\");\n }\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 if (!receiver) {\n throw new Error(\"reseiver function was not passed to Guest constructor\");\n }\n }\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 if (baseGuest === undefined) {\n throw new Error(\"PatronOnce didnt receive baseGuest argument\");\n }\n }\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 { GuestDisposableType, MaybeDisposableType } 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 if (sourceGuest === undefined) {\n throw new Error(\"GuestCast didnt receive sourceGuest argument\");\n }\n if (targetGuest === undefined) {\n throw new Error(\"GuestCast didnt receive targetGuest argument\");\n }\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 if (patron === undefined) {\n throw new Error(\"removePatronFromPools didnt receive patron argument\");\n }\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 if (patron === undefined) {\n throw new Error(\"isPatronInPools didnt receive patron argument\");\n }\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 if (sourceDocument === undefined) {\n throw new Error(\"Source didnt receive sourceDocument argument\");\n }\n }\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 { GuestDisposableType, MaybeDisposableType } 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 if (baseGuest === undefined) {\n throw new Error(\"GuestObject didnt receive baseGuest argument\");\n }\n }\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 {\n GuestAwareObjectType,\n GuestAwareType,\n isGuestAware,\n value,\n} 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 if (baseSource === undefined) {\n throw new Error(\"GuestAwareSequence didnt receive baseSource argument\");\n }\n if (targetSource === undefined) {\n throw new Error(\"GuestAwareSequence didnt receive targetSource argument\");\n }\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(sequenceSource);\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(\n nextValue,\n new PatronOnce((theNextValue) => {\n sequenceSource.give(theNextValue);\n value(targetSource, all.guestKey(index.toString()));\n nextItemHandle();\n }),\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 {\n GuestAware,\n GuestAwareObjectType,\n GuestAwareType,\n isGuestAware,\n value,\n} 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 if (baseSource === undefined) {\n throw new Error(\"GuestAwareMap didnt receive baseSource argument\");\n }\n if (targetSource === undefined) {\n throw new Error(\"GuestAwareMap didnt receive targetSource argument\");\n }\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 if (guestAwares === undefined) {\n throw new Error(\"GuestAwareRace didnt receive guestAwares argument\");\n }\n }\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 (\n !connectedWithGuestAware ||\n connectedWithGuestAware === guestAware\n ) {\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>\n extends GuestAwareObjectType<T>,\n ActionType<R> {}\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(\n private configExecutor: (config: R, source: SourceType<T>) => void,\n ) {\n if (configExecutor === undefined) {\n throw new Error(\n \"GuestAwareActive constructor didnt receive executor function\",\n );\n }\n }\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 if (theValue === undefined) {\n throw new Error(\"GuestSync didnt receive theValue argument\");\n }\n }\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 if (guest === undefined) {\n throw new Error(\"GuestDisposable didnt receive guest argument\");\n }\n if (disposeCheck === undefined) {\n throw new Error(\"GuestDisposable didnt receive disposeCheck argument\");\n }\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 if (willBePatron === undefined) {\n throw new Error(\"Patron didnt receive willBePatron argument\");\n }\n }\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 if (baseGuest === undefined) {\n throw new Error(\"SourceDynamic didnt receive baseGuest argument\");\n }\n if (baseGuestAware === undefined) {\n throw new Error(\"SourceDynamic didnt receive baseGuestAware argument\");\n }\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 if (constructorFn === undefined) {\n throw new Error(\"PrivateClass didnt receive constructorFn argument\");\n }\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 if (buildingFn === undefined) {\n throw new Error(\"Private didnt receive buildingFn argument\");\n }\n }\n\n public get<R extends unknown[], CT = null>(\n ...args: R\n ): CT extends null ? T : CT {\n return this.buildingFn(...args) as CT extends null ? T : CT;\n }\n}\n"],"names":["__publicField","value"],"mappings":"AAegB,SAAA,KAAA,CAAS,YAA+B,KAAqB,EAAA;AAC3E,EAAA,IAAI,eAAe,MAAW,EAAA;AAC5B,IAAM,MAAA,IAAI,MAAM,yCAAyC,CAAA;AAAA;AAE3D,EAAA,IAAI,UAAU,MAAW,EAAA;AACvB,IAAM,MAAA,IAAI,MAAM,oCAAoC,CAAA;AAAA;AAEtD,EAAI,IAAA,OAAO,eAAe,UAAY,EAAA;AACpC,IAAA,OAAO,WAAW,KAAK,CAAA;AAAA,GAClB,MAAA;AACL,IAAO,OAAA,UAAA,CAAW,MAAM,KAAK,CAAA;AAAA;AAEjC;AAKO,SAAS,aACd,YACgC,EAAA;AAChC,EAAA,IAAI,iBAAiB,MAAW,EAAA;AAC9B,IAAM,MAAA,IAAI,MAAM,kDAAkD,CAAA;AAAA;AAEpE,EAAA,OACE,OAAO,YAAA,KAAiB,UACx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AAC1B,IAAA,OAAO,IAAK,IAAK,CAAA,aAAA;AAAA,MACf,GAAG,IAAA;AAAA,MACH,IAAK,CAAA;AAAA,KACP;AAAA;AAEJ;;ACrBO,MAAM,OAAqC,CAAA;AAAA,EACzC,YAAoB,UAAmC,EAAA;AAAnC,IAAA,IAAA,CAAA,UAAA,GAAA,UAAA;AACzB,IAAA,IAAI,eAAe,MAAW,EAAA;AAC5B,MAAM,MAAA,IAAI,MAAM,2CAA2C,CAAA;AAAA;AAC7D;AACF,EAEO,OACF,IACuB,EAAA;AAC1B,IAAO,OAAA,IAAA,CAAK,UAAW,CAAA,GAAG,IAAI,CAAA;AAAA;AAElC;;;;"}
|
package/dist/patron.min.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
!function(
|
1
|
+
!function(e){"use strict";function t(e,t){if(void 0===e)throw new Error("value didnt receive guestAware argument");if(void 0===t)throw new Error("value didnt receive guest argument");return"function"==typeof e?e(t):e.value(t)}function r(e){if(void 0===e)throw new Error("isGuestAware didnt receive mbGuestAware argument");return"function"==typeof e||"function"==typeof e?.value}class s{constructor(e){if(this.guestAware=e,void 0===e)throw new Error("GuestAware constructor didnt receive executor function")}value(e){return t(this.guestAware,e),e}}function i(e,t,r){if(void 0===e)throw new Error("give didnt receive data argument");if(void 0===t)throw new Error("give didnt receive guest argument");"function"==typeof t?t(e,r):t.give(e,r)}class o{constructor(e){if(this.receiver=e,!e)throw new Error("reseiver function was not passed to Guest constructor")}give(e,t){return this.receiver(e,t),this}}var n=Object.defineProperty,u=(e,t,r)=>((e,t,r)=>t in e?n(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,t+"",r);class a{constructor(e){if(this.baseGuest=e,u(this,"received",!1),void 0===e)throw new Error("PatronOnce didnt receive baseGuest argument")}introduction(){return"patron"}give(e,t){return this.received||(this.received=!0,i(e,this.baseGuest,t)),this}disposed(e){if(this.received)return!0;const t=this.baseGuest;return!!t.disposed&&t.disposed(e)}}class c{constructor(e,t){if(this.sourceGuest=e,this.targetGuest=t,void 0===e)throw new Error("GuestCast didnt receive sourceGuest argument");if(void 0===t)throw new Error("GuestCast didnt receive targetGuest argument")}introduction(){return"function"==typeof this.sourceGuest?"guest":this.sourceGuest.introduction?this.sourceGuest.introduction():"guest"}give(e,t){return i(e,this.targetGuest,{...t,data:{...t?.data??{},castedGuest:t?.data?.castedGuest??this}}),this}disposed(e){const t=this.sourceGuest;return!!t.disposed&&t.disposed(e)}}var l=Object.defineProperty,h=(e,t,r)=>((e,t,r)=>t in e?l(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);const d=new Map;class v{constructor(e){this.initiator=e,h(this,"patrons"),h(this,"give"),this.patrons=new Set,d.set(this,this.patrons);let t=null;const r=(e,t)=>{this.patrons.forEach((r=>{this.sendValueToGuest(e,r,t)}))};this.give=(e,s)=>{const i=()=>{i===t&&r(e,s)};return t=i,queueMicrotask(i),this}}size(){return this.patrons.size}add(e){if(!e)throw new Error("PatronPool add method received nothing!");return"function"!=typeof e&&e.introduction&&"patron"===e.introduction()&&this.patrons.add(e),this}remove(e){return this.patrons.delete(e),this}distribute(e,t){return this.add(t),this.sendValueToGuest(e,t,{}),this}sendValueToGuest(e,t,r){this.guestDisposed(e,t)||i(e,t,{...r,data:{...r?.data??{},initiator:this.initiator,pool:this}})}guestDisposed(e,t){return!!t.disposed?.(e)&&(this.remove(t),!0)}}var w=Object.defineProperty,g=(e,t,r)=>((e,t,r)=>t in e?w(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,t+"",r);class f{constructor(e){if(this.sourceDocument=e,g(this,"thePool",new v(this)),void 0===e)throw new Error("Source didnt receive sourceDocument argument")}pool(){return this.thePool}give(e){return this.sourceDocument=e,this.thePool.give(this.sourceDocument),this}value(e){return"function"==typeof e?this.thePool.distribute(this.sourceDocument,new o(e)):this.thePool.distribute(this.sourceDocument,e),this}}var b=Object.defineProperty,p=(e,t,r)=>((e,t,r)=>t in e?b(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,t+"",r);class G{constructor(){p(this,"baseSource",new f(null))}value(e){return this.baseSource.value(new c(e,((t,r)=>{null!==t&&i(t,e,r)}))),this}give(e){return this.baseSource.give(e),this}pool(){return this.baseSource.pool()}}class m{constructor(e){if(this.baseGuest=e,void 0===e)throw new Error("GuestObject didnt receive baseGuest argument")}give(e,t){let r=this.baseGuest;return"function"==typeof r&&(r=new o(r)),r.give(e,t),this}introduction(){return"function"!=typeof this.baseGuest&&this.baseGuest.introduction?this.baseGuest.introduction():"guest"}disposed(e){const t=this.baseGuest;return!!t.disposed&&t.disposed(e)}}var P=Object.defineProperty,A=(e,t,r)=>((e,t,r)=>t in e?P(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class y{constructor(e){A(this,"guests",new Set),A(this,"patronPool"),this.patronPool=new v(e)}give(e,t){return this.deliverToGuests(e,t),this.patronPool.give(e,t),this}add(e){return"function"!=typeof e&&e.introduction&&"guest"!==e.introduction()||this.guests.add(e),this.patronPool.add(e),this}remove(e){return this.guests.delete(e),this.patronPool.remove(e),this}distribute(e,t){return this.add(t),this.give(e),this}size(){return this.patronPool.size()+this.guests.size}deliverToGuests(e,t){this.guests.forEach((r=>{i(e,r,t)})),this.guests.clear()}}var E=Object.defineProperty,S=(e,t,r)=>((e,t,r)=>t in e?E(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class F{constructor(){S(this,"theAll"),S(this,"keysKnown",new Set),S(this,"keysFilled",new Set),S(this,"filledAllPool",new y(this)),this.theAll=new f({})}valueArray(e){const t=new m(e);return this.filledAllPool.add(new c(t,(e=>{t.give(Object.values(e))}))),this.isAllFilled()&&this.theAll.value(new o((e=>{this.filledAllPool.give(Object.values(e))}))),this}value(e){const t=new m(e);return this.isAllFilled()?(this.filledAllPool.add(t),this.theAll.value(new o((e=>{this.filledAllPool.give(e)})))):this.filledAllPool.add(t),this}guestKey(e){return this.keysKnown.add(e),new o((t=>{queueMicrotask((()=>{this.theAll.value(new o((r=>{this.keysFilled.add(e);const s={...r,[e]:t};this.theAll.give(s),this.isAllFilled()&&this.filledAllPool.give(s)})))}))}))}isAllFilled(){return this.keysFilled.size>0&&this.keysFilled.size===this.keysKnown.size}}var D=Object.defineProperty,O=(e,t,r)=>((e,t,r)=>t in e?D(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,t+"",r);e.Guest=o,e.GuestAware=s,e.GuestAwareActive=class{constructor(e){if(this.configExecutor=e,O(this,"source",new G),void 0===e)throw new Error("GuestAwareActive constructor didnt receive executor function")}do(e){return this.configExecutor(e,this.source),this}value(e){return this.source.value(e),this}},e.GuestAwareAll=F,e.GuestAwareMap=class{constructor(e,t){if(this.baseSource=e,this.targetSource=t,void 0===e)throw new Error("GuestAwareMap didnt receive baseSource argument");if(void 0===t)throw new Error("GuestAwareMap didnt receive targetSource argument")}value(e){const o=new F;return t(this.baseSource,new c(e,(e=>{e.forEach(((e,n)=>{const u=r(e)?e:new s((t=>{i(e,t)}));t(this.targetSource.get(u),o.guestKey(n.toString()))}))}))),o.valueArray(e),this}},e.GuestAwareRace=class{constructor(e){if(this.guestAwares=e,void 0===e)throw new Error("GuestAwareRace didnt receive guestAwares argument")}value(e){let r=null;return this.guestAwares.forEach((s=>{t(s,new c(e,(t=>{r&&r!==s||(i(t,e),r=s)})))})),this}},e.GuestAwareSequence=class{constructor(e,t){if(this.baseSource=e,this.targetSource=t,void 0===e)throw new Error("GuestAwareSequence didnt receive baseSource argument");if(void 0===t)throw new Error("GuestAwareSequence didnt receive targetSource argument")}value(e){const s=new F,o=new G,n=this.targetSource.get(o);return t(this.baseSource,new c(e,(u=>{let c=0;const l=()=>{void 0!==u[c+1]?(c+=1,h()):s.valueArray(e)};function h(){o.give(null);const e=u[c];r(e)?t(e,new a((e=>{o.give(e),t(n,s.guestKey(c.toString())),l()}))):(o.give(e),t(n,s.guestKey(c.toString())),l())}void 0!==u[c]?h():i([],e)}))),this}},e.GuestCast=c,e.GuestDisposable=class{constructor(e,t){if(this.guest=e,this.disposeCheck=t,void 0===e)throw new Error("GuestDisposable didnt receive guest argument");if(void 0===t)throw new Error("GuestDisposable didnt receive disposeCheck argument")}disposed(e){return this.disposeCheck(e)}give(e,t){return i(e,this.guest,t),this}},e.GuestObject=m,e.GuestPool=y,e.GuestSync=class{constructor(e){if(this.theValue=e,void 0===e)throw new Error("GuestSync didnt receive theValue argument")}give(e){return this.theValue=e,this}value(){return this.theValue}},e.Patron=class{constructor(e){if(this.willBePatron=e,void 0===e)throw new Error("Patron didnt receive willBePatron argument")}introduction(){return"patron"}give(e,t){return i(e,this.willBePatron,t),this}disposed(e){const t=this.willBePatron;return t?.disposed?.(e)||!1}},e.PatronOnce=a,e.PatronPool=v,e.Private=class{constructor(e){if(this.buildingFn=e,void 0===e)throw new Error("Private didnt receive buildingFn argument")}get(...e){return this.buildingFn(...e)}},e.PrivateClass=class{constructor(e,t={}){if(this.constructorFn=e,this.modules=t,void 0===e)throw new Error("PrivateClass didnt receive constructorFn argument")}get(...e){return new this.constructorFn(...e,this.modules)}},e.Source=f,e.SourceDynamic=class{constructor(e,t){if(this.baseGuest=e,this.baseGuestAware=t,void 0===e)throw new Error("SourceDynamic didnt receive baseGuest argument");if(void 0===t)throw new Error("SourceDynamic didnt receive baseGuestAware argument")}value(e){return t(this.baseGuestAware,e),this}give(e){return i(e,this.baseGuest),this}pool(){throw Error("No pool in SourceDynamic")}},e.SourceEmpty=G,e.give=i,e.isGuest=function(e){if(void 0===e)throw new Error("isGuest didnt receive mbGuest argument");return"function"==typeof e||"function"==typeof e?.give},e.isGuestAware=r,e.isPatronInPools=e=>{if(void 0===e)throw new Error("isPatronInPools didnt receive patron argument");let t=!1;return d.forEach((r=>{t||(t=r.has(e))})),t},e.removePatronFromPools=e=>{if(void 0===e)throw new Error("removePatronFromPools didnt receive patron argument");d.forEach((t=>{t.delete(e)}))},e.value=t}({});
|
package/dist/patron.min.mjs
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
function t(
|
1
|
+
function e(e,t){if(void 0===e)throw new Error("value didnt receive guestAware argument");if(void 0===t)throw new Error("value didnt receive guest argument");return"function"==typeof e?e(t):e.value(t)}function t(e){if(void 0===e)throw new Error("isGuestAware didnt receive mbGuestAware argument");return"function"==typeof e||"function"==typeof e?.value}class r{constructor(e){if(this.guestAware=e,void 0===e)throw new Error("GuestAware constructor didnt receive executor function")}value(t){return e(this.guestAware,t),t}}function i(e,t,r){if(void 0===e)throw new Error("give didnt receive data argument");if(void 0===t)throw new Error("give didnt receive guest argument");"function"==typeof t?t(e,r):t.give(e,r)}function s(e){if(void 0===e)throw new Error("isGuest didnt receive mbGuest argument");return"function"==typeof e||"function"==typeof e?.give}class o{constructor(e){if(this.receiver=e,!e)throw new Error("reseiver function was not passed to Guest constructor")}give(e,t){return this.receiver(e,t),this}}var n=Object.defineProperty,u=(e,t,r)=>((e,t,r)=>t in e?n(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,t+"",r);class a{constructor(e){if(this.baseGuest=e,u(this,"received",!1),void 0===e)throw new Error("PatronOnce didnt receive baseGuest argument")}introduction(){return"patron"}give(e,t){return this.received||(this.received=!0,i(e,this.baseGuest,t)),this}disposed(e){if(this.received)return!0;const t=this.baseGuest;return!!t.disposed&&t.disposed(e)}}class c{constructor(e,t){if(this.sourceGuest=e,this.targetGuest=t,void 0===e)throw new Error("GuestCast didnt receive sourceGuest argument");if(void 0===t)throw new Error("GuestCast didnt receive targetGuest argument")}introduction(){return"function"==typeof this.sourceGuest?"guest":this.sourceGuest.introduction?this.sourceGuest.introduction():"guest"}give(e,t){return i(e,this.targetGuest,{...t,data:{...t?.data??{},castedGuest:t?.data?.castedGuest??this}}),this}disposed(e){const t=this.sourceGuest;return!!t.disposed&&t.disposed(e)}}var h=Object.defineProperty,d=(e,t,r)=>((e,t,r)=>t in e?h(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);const l=new Map,v=e=>{if(void 0===e)throw new Error("removePatronFromPools didnt receive patron argument");l.forEach((t=>{t.delete(e)}))},w=e=>{if(void 0===e)throw new Error("isPatronInPools didnt receive patron argument");let t=!1;return l.forEach((r=>{t||(t=r.has(e))})),t};class g{constructor(e){this.initiator=e,d(this,"patrons"),d(this,"give"),this.patrons=new Set,l.set(this,this.patrons);let t=null;const r=(e,t)=>{this.patrons.forEach((r=>{this.sendValueToGuest(e,r,t)}))};this.give=(e,i)=>{const s=()=>{s===t&&r(e,i)};return t=s,queueMicrotask(s),this}}size(){return this.patrons.size}add(e){if(!e)throw new Error("PatronPool add method received nothing!");return"function"!=typeof e&&e.introduction&&"patron"===e.introduction()&&this.patrons.add(e),this}remove(e){return this.patrons.delete(e),this}distribute(e,t){return this.add(t),this.sendValueToGuest(e,t,{}),this}sendValueToGuest(e,t,r){this.guestDisposed(e,t)||i(e,t,{...r,data:{...r?.data??{},initiator:this.initiator,pool:this}})}guestDisposed(e,t){return!!t.disposed?.(e)&&(this.remove(t),!0)}}var f=Object.defineProperty,b=(e,t,r)=>((e,t,r)=>t in e?f(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,t+"",r);class p{constructor(e){if(this.sourceDocument=e,b(this,"thePool",new g(this)),void 0===e)throw new Error("Source didnt receive sourceDocument argument")}pool(){return this.thePool}give(e){return this.sourceDocument=e,this.thePool.give(this.sourceDocument),this}value(e){return"function"==typeof e?this.thePool.distribute(this.sourceDocument,new o(e)):this.thePool.distribute(this.sourceDocument,e),this}}var m=Object.defineProperty,G=(e,t,r)=>((e,t,r)=>t in e?m(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,t+"",r);class y{constructor(){G(this,"baseSource",new p(null))}value(e){return this.baseSource.value(new c(e,((t,r)=>{null!==t&&i(t,e,r)}))),this}give(e){return this.baseSource.give(e),this}pool(){return this.baseSource.pool()}}class A{constructor(e){if(this.baseGuest=e,void 0===e)throw new Error("GuestObject didnt receive baseGuest argument")}give(e,t){let r=this.baseGuest;return"function"==typeof r&&(r=new o(r)),r.give(e,t),this}introduction(){return"function"!=typeof this.baseGuest&&this.baseGuest.introduction?this.baseGuest.introduction():"guest"}disposed(e){const t=this.baseGuest;return!!t.disposed&&t.disposed(e)}}var E=Object.defineProperty,P=(e,t,r)=>((e,t,r)=>t in e?E(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class S{constructor(e){P(this,"guests",new Set),P(this,"patronPool"),this.patronPool=new g(e)}give(e,t){return this.deliverToGuests(e,t),this.patronPool.give(e,t),this}add(e){return"function"!=typeof e&&e.introduction&&"guest"!==e.introduction()||this.guests.add(e),this.patronPool.add(e),this}remove(e){return this.guests.delete(e),this.patronPool.remove(e),this}distribute(e,t){return this.add(t),this.give(e),this}size(){return this.patronPool.size()+this.guests.size}deliverToGuests(e,t){this.guests.forEach((r=>{i(e,r,t)})),this.guests.clear()}}var F=Object.defineProperty,D=(e,t,r)=>((e,t,r)=>t in e?F(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class k{constructor(){D(this,"theAll"),D(this,"keysKnown",new Set),D(this,"keysFilled",new Set),D(this,"filledAllPool",new S(this)),this.theAll=new p({})}valueArray(e){const t=new A(e);return this.filledAllPool.add(new c(t,(e=>{t.give(Object.values(e))}))),this.isAllFilled()&&this.theAll.value(new o((e=>{this.filledAllPool.give(Object.values(e))}))),this}value(e){const t=new A(e);return this.isAllFilled()?(this.filledAllPool.add(t),this.theAll.value(new o((e=>{this.filledAllPool.give(e)})))):this.filledAllPool.add(t),this}guestKey(e){return this.keysKnown.add(e),new o((t=>{queueMicrotask((()=>{this.theAll.value(new o((r=>{this.keysFilled.add(e);const i={...r,[e]:t};this.theAll.give(i),this.isAllFilled()&&this.filledAllPool.give(i)})))}))}))}isAllFilled(){return this.keysFilled.size>0&&this.keysFilled.size===this.keysKnown.size}}class O{constructor(e,t){if(this.baseSource=e,this.targetSource=t,void 0===e)throw new Error("GuestAwareSequence didnt receive baseSource argument");if(void 0===t)throw new Error("GuestAwareSequence didnt receive targetSource argument")}value(r){const s=new k,o=new y,n=this.targetSource.get(o);return e(this.baseSource,new c(r,(u=>{let c=0;const h=()=>{void 0!==u[c+1]?(c+=1,d()):s.valueArray(r)};function d(){o.give(null);const r=u[c];t(r)?e(r,new a((t=>{o.give(t),e(n,s.guestKey(c.toString())),h()}))):(o.give(r),e(n,s.guestKey(c.toString())),h())}void 0!==u[c]?d():i([],r)}))),this}}class j{constructor(e,t){if(this.baseSource=e,this.targetSource=t,void 0===e)throw new Error("GuestAwareMap didnt receive baseSource argument");if(void 0===t)throw new Error("GuestAwareMap didnt receive targetSource argument")}value(s){const o=new k;return e(this.baseSource,new c(s,(s=>{s.forEach(((s,n)=>{const u=t(s)?s:new r((e=>{i(s,e)}));e(this.targetSource.get(u),o.guestKey(n.toString()))}))}))),o.valueArray(s),this}}class z{constructor(e){if(this.guestAwares=e,void 0===e)throw new Error("GuestAwareRace didnt receive guestAwares argument")}value(t){let r=null;return this.guestAwares.forEach((s=>{e(s,new c(t,(e=>{r&&r!==s||(i(e,t),r=s)})))})),this}}var K=Object.defineProperty,V=(e,t,r)=>((e,t,r)=>t in e?K(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,t+"",r);class C{constructor(e){if(this.configExecutor=e,V(this,"source",new y),void 0===e)throw new Error("GuestAwareActive constructor didnt receive executor function")}do(e){return this.configExecutor(e,this.source),this}value(e){return this.source.value(e),this}}class x{constructor(e){if(this.theValue=e,void 0===e)throw new Error("GuestSync didnt receive theValue argument")}give(e){return this.theValue=e,this}value(){return this.theValue}}class M{constructor(e,t){if(this.guest=e,this.disposeCheck=t,void 0===e)throw new Error("GuestDisposable didnt receive guest argument");if(void 0===t)throw new Error("GuestDisposable didnt receive disposeCheck argument")}disposed(e){return this.disposeCheck(e)}give(e,t){return i(e,this.guest,t),this}}class T{constructor(e){if(this.willBePatron=e,void 0===e)throw new Error("Patron didnt receive willBePatron argument")}introduction(){return"patron"}give(e,t){return i(e,this.willBePatron,t),this}disposed(e){const t=this.willBePatron;return t?.disposed?.(e)||!1}}class q{constructor(e,t){if(this.baseGuest=e,this.baseGuestAware=t,void 0===e)throw new Error("SourceDynamic didnt receive baseGuest argument");if(void 0===t)throw new Error("SourceDynamic didnt receive baseGuestAware argument")}value(t){return e(this.baseGuestAware,t),this}give(e){return i(e,this.baseGuest),this}pool(){throw Error("No pool in SourceDynamic")}}class B{constructor(e,t={}){if(this.constructorFn=e,this.modules=t,void 0===e)throw new Error("PrivateClass didnt receive constructorFn argument")}get(...e){return new this.constructorFn(...e,this.modules)}}class I{constructor(e){if(this.buildingFn=e,void 0===e)throw new Error("Private didnt receive buildingFn argument")}get(...e){return this.buildingFn(...e)}}export{o as Guest,r as GuestAware,C as GuestAwareActive,k as GuestAwareAll,j as GuestAwareMap,z as GuestAwareRace,O as GuestAwareSequence,c as GuestCast,M as GuestDisposable,A as GuestObject,S as GuestPool,x as GuestSync,T as Patron,a as PatronOnce,g as PatronPool,I as Private,B as PrivateClass,p as Source,q as SourceDynamic,y as SourceEmpty,i as give,s as isGuest,t as isGuestAware,w as isPatronInPools,v as removePatronFromPools,e as value};
|
2
2
|
//# sourceMappingURL=patron.min.mjs.map
|