patron-oop 1.4.0 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +12 -0
- package/dist/patron.d.ts +14 -105
- package/dist/patron.js +134 -130
- package/dist/patron.js.map +1 -1
- package/dist/patron.min.js +1 -1
- package/dist/patron.mjs +132 -118
- package/dist/patron.mjs.map +1 -1
- package/examples/elegant_objects.html +3 -1
- package/package.json +1 -1
- package/src/Guest/Guest.ts +45 -0
- package/src/Guest/GuestAware.test.ts +15 -0
- package/src/{GuestAware.ts → Guest/GuestAware.ts} +1 -1
- package/src/Guest/GuestCallback.test.ts +13 -0
- package/src/{Guest.ts → Guest/GuestCallback.ts} +1 -1
- package/src/Guest/GuestCast.test.ts +31 -0
- package/src/{GuestCast.ts → Guest/GuestCast.ts} +1 -1
- package/src/Guest/GuestChain.test.ts +72 -0
- package/src/{Chain.ts → Guest/GuestChain.ts} +9 -9
- package/src/Guest/GuestInTheMiddle.test.ts +71 -0
- package/src/{GuestInTheMiddle.ts → Guest/GuestInTheMiddle.ts} +1 -1
- package/src/{GuestPool.test.ts → Guest/GuestPool.test.ts} +7 -7
- package/src/{GuestPool.ts → Guest/GuestPool.ts} +3 -3
- package/src/Guest/GuestSync.test.ts +13 -0
- package/src/{GuestSync.ts → Guest/GuestSync.ts} +1 -1
- package/src/Patron/Patron.ts +18 -0
- package/src/{Patron.test.ts → Patron/PatronOfGuest.test.ts} +6 -6
- package/src/{Patron.ts → Patron/PatronOfGuest.ts} +2 -2
- package/src/{PatronOnce.test.ts → Patron/PatronOnce.test.ts} +4 -4
- package/src/{PatronOnce.ts → Patron/PatronOnce.ts} +2 -2
- package/src/{PatronPool.test.ts → Patron/PatronPool.test.ts} +6 -6
- package/src/{PatronPool.ts → Patron/PatronPool.ts} +7 -2
- package/src/Source/Source.ts +12 -0
- package/src/Source/SourceOfValue.test.ts +13 -0
- package/src/{Source.ts → Source/SourceOfValue.ts} +4 -4
- package/src/Source/SourcesApplied.test.ts +14 -0
- package/src/Source/SourcesApplied.ts +40 -0
- package/src/index.ts +17 -15
- package/src/Cache.test.ts +0 -20
- package/src/Cache.ts +0 -33
- package/src/Chain.test.ts +0 -72
- package/src/Factory.test.ts +0 -16
- package/src/Factory.ts +0 -23
- package/src/FactoryDynamic.ts +0 -11
- package/src/FactoryWithFactories.ts +0 -25
- package/src/Guest.test.ts +0 -13
- package/src/GuestInTheMiddle.test.ts +0 -71
- package/src/GuestSync.test.ts +0 -11
- package/src/PoolType.ts +0 -7
- package/src/Source.test.ts +0 -13
package/CHANGELOG.md
CHANGED
@@ -2,6 +2,18 @@
|
|
2
2
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
4
4
|
|
5
|
+
### [1.5.1](https://github.com/kosukhin/patron/compare/v1.5.0...v1.5.1) (2024-10-20)
|
6
|
+
|
7
|
+
## [1.5.0](https://github.com/kosukhin/patron/compare/v1.4.0...v1.5.0) (2024-10-20)
|
8
|
+
|
9
|
+
|
10
|
+
### Features
|
11
|
+
|
12
|
+
* **issue-1:** доделал основные классы - фабрики ([a44fc85](https://github.com/kosukhin/patron/commit/a44fc853f7a1bd7ad8abf9428709eaec3d979b3f))
|
13
|
+
* **issue-1:** заготовка для фабрик основного функционала ([4f22d35](https://github.com/kosukhin/patron/commit/4f22d357188add1baf374c207b321f4c47e99997))
|
14
|
+
* **issue-1:** наработка для сорс апплиед ([c704597](https://github.com/kosukhin/patron/commit/c7045970265d843c77b6f657b60d629a1f0d3298))
|
15
|
+
* **main:** guest cast поправить ([211e05c](https://github.com/kosukhin/patron/commit/211e05c576b7c86b5d39537a8da5f5f83d071b46))
|
16
|
+
|
5
17
|
## [1.4.0](https://github.com/kosukhin/patron/compare/v1.3.0...v1.4.0) (2024-10-13)
|
6
18
|
|
7
19
|
|
package/dist/patron.d.ts
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
import { GuestAwareType as GuestAwareType$1 } from 'src/GuestAware';
|
2
|
-
|
3
1
|
type GuestIntroduction = "guest" | "patron";
|
4
2
|
interface ReceiveOptions {
|
5
3
|
data?: unknown;
|
@@ -9,37 +7,18 @@ interface GuestType<T = unknown> {
|
|
9
7
|
receive(value: T, options?: ReceiveOptions): this;
|
10
8
|
introduction?(): GuestIntroduction;
|
11
9
|
}
|
12
|
-
declare class
|
10
|
+
declare class GuestCallback<T> implements GuestType<T> {
|
13
11
|
private receiver;
|
14
12
|
constructor(receiver: GuestExecutorType<T>);
|
15
13
|
receive(value: T, options?: ReceiveOptions): this;
|
16
14
|
}
|
17
15
|
|
18
|
-
interface GuestAwareType<T = unknown> {
|
19
|
-
receiving(guest: GuestType<T>): unknown;
|
20
|
-
}
|
21
|
-
declare class GuestAware<T = unknown> implements GuestAwareType<T> {
|
22
|
-
private guestReceiver;
|
23
|
-
constructor(guestReceiver: (guest: GuestType<T>) => void);
|
24
|
-
receiving(guest: GuestType<T>): GuestType<T>;
|
25
|
-
}
|
26
|
-
|
27
|
-
type CacheType<T = unknown> = GuestType<T> & GuestAwareType<T>;
|
28
|
-
declare class Cache<T> implements CacheType<T> {
|
29
|
-
private defaultValue;
|
30
|
-
private theCache;
|
31
|
-
private pool;
|
32
|
-
constructor(initiator: unknown, defaultValue?: T | null, theCache?: T | null);
|
33
|
-
receive(value: T, options?: ReceiveOptions): this;
|
34
|
-
receiving(guest: GuestType<T>): this;
|
35
|
-
}
|
36
|
-
|
37
16
|
interface ChainType<T = unknown> {
|
38
17
|
result(guest: GuestType<T>): this;
|
39
18
|
resultArray(guest: GuestType<T>): this;
|
40
19
|
receiveKey<R>(key: string): GuestType<R>;
|
41
20
|
}
|
42
|
-
declare class
|
21
|
+
declare class GuestChain<T> implements ChainType<T> {
|
43
22
|
private theChain;
|
44
23
|
private keysKnown;
|
45
24
|
private keysFilled;
|
@@ -51,67 +30,6 @@ declare class Chain<T> implements ChainType<T> {
|
|
51
30
|
private isChainFilled;
|
52
31
|
}
|
53
32
|
|
54
|
-
interface Prototyped$1<T> {
|
55
|
-
prototype: T;
|
56
|
-
}
|
57
|
-
interface FactoryType<T> {
|
58
|
-
create<R extends unknown[], CT = null>(...args: R): CT extends null ? T : CT;
|
59
|
-
}
|
60
|
-
declare class Factory<T> implements FactoryType<T> {
|
61
|
-
private constructorFn;
|
62
|
-
constructor(constructorFn: Prototyped$1<T>);
|
63
|
-
create<R extends unknown[], CT = null>(...args: R): CT extends null ? T : CT;
|
64
|
-
}
|
65
|
-
|
66
|
-
declare class FactoryDynamic<T> implements FactoryType<T> {
|
67
|
-
private creationFn;
|
68
|
-
constructor(creationFn: (...args: unknown[]) => T);
|
69
|
-
create<R extends unknown[], CT = null>(...args: R): CT extends null ? T : CT;
|
70
|
-
}
|
71
|
-
|
72
|
-
interface Prototyped<T> {
|
73
|
-
prototype: T;
|
74
|
-
}
|
75
|
-
declare class FactoryWithFactories<T> implements FactoryType<T> {
|
76
|
-
private constructorFn;
|
77
|
-
private factories;
|
78
|
-
constructor(constructorFn: Prototyped<T>, factories?: Record<string, unknown>);
|
79
|
-
create<R extends unknown[], CT = null>(...args: R): CT extends null ? T : CT;
|
80
|
-
}
|
81
|
-
|
82
|
-
declare class GuestCast<T> implements GuestType<T> {
|
83
|
-
private sourceGuest;
|
84
|
-
private targetGuest;
|
85
|
-
constructor(sourceGuest: GuestType<unknown>, targetGuest: GuestType<T>);
|
86
|
-
introduction(): "guest" | "patron";
|
87
|
-
receive(value: T, options?: ReceiveOptions): this;
|
88
|
-
}
|
89
|
-
|
90
|
-
declare class GuestInTheMiddle<T> implements GuestType<T> {
|
91
|
-
private baseGuest;
|
92
|
-
private middleFn;
|
93
|
-
constructor(baseGuest: GuestType<unknown>, middleFn: (value: T, options?: ReceiveOptions) => void);
|
94
|
-
introduction(): "guest" | "patron";
|
95
|
-
receive(value: T, options?: ReceiveOptions): this;
|
96
|
-
}
|
97
|
-
|
98
|
-
interface PoolType<T = unknown> extends GuestType<T> {
|
99
|
-
add(guest: GuestType<T>): this;
|
100
|
-
distribute(receiving: T, possiblePatron: GuestType<T>): this;
|
101
|
-
remove(patron: GuestType<T>): this;
|
102
|
-
}
|
103
|
-
|
104
|
-
declare class GuestPool<T> implements GuestType<T>, PoolType<T> {
|
105
|
-
private guests;
|
106
|
-
private patronPool;
|
107
|
-
constructor(initiator: unknown);
|
108
|
-
receive(value: T, options?: ReceiveOptions): this;
|
109
|
-
add(guest: GuestType<T>): this;
|
110
|
-
remove(patron: GuestType<T>): this;
|
111
|
-
distribute(receiving: T, possiblePatron: GuestType<T>): this;
|
112
|
-
private deliverToGuests;
|
113
|
-
}
|
114
|
-
|
115
33
|
interface GuestValueType<T = unknown> extends GuestType<T> {
|
116
34
|
value(): T;
|
117
35
|
}
|
@@ -122,28 +40,15 @@ declare class GuestSync<T> implements GuestValueType<T> {
|
|
122
40
|
value(): T;
|
123
41
|
}
|
124
42
|
|
125
|
-
/**
|
126
|
-
* Патрон - это постоянный посетитель
|
127
|
-
*/
|
128
|
-
declare class Patron<T> implements GuestType<T> {
|
129
|
-
private willBePatron;
|
130
|
-
constructor(willBePatron: GuestType<T>);
|
131
|
-
introduction(): "patron";
|
132
|
-
receive(value: T, options?: ReceiveOptions): this;
|
133
|
-
}
|
134
|
-
|
135
|
-
declare class PatronOnce<T> implements GuestType<T> {
|
136
|
-
private baseGuest;
|
137
|
-
private received;
|
138
|
-
constructor(baseGuest: GuestType<T>);
|
139
|
-
introduction(): "patron";
|
140
|
-
receive(value: T, options?: ReceiveOptions): this;
|
141
|
-
}
|
142
|
-
|
143
43
|
/**
|
144
44
|
* Удалить патрон из всех пулов
|
145
45
|
*/
|
146
46
|
declare const removePatronFromPools: (patron: GuestType) => void;
|
47
|
+
interface PoolType<T = unknown> extends GuestType<T> {
|
48
|
+
add(guest: GuestType<T>): this;
|
49
|
+
distribute(receiving: T, possiblePatron: GuestType<T>): this;
|
50
|
+
remove(patron: GuestType<T>): this;
|
51
|
+
}
|
147
52
|
declare class PatronPool<T> implements PoolType<T> {
|
148
53
|
private initiator;
|
149
54
|
private patrons;
|
@@ -155,8 +60,12 @@ declare class PatronPool<T> implements PoolType<T> {
|
|
155
60
|
private sendValueToGuest;
|
156
61
|
}
|
157
62
|
|
158
|
-
|
159
|
-
|
63
|
+
interface GuestAwareType<T = unknown> {
|
64
|
+
receiving(guest: GuestType<T>): unknown;
|
65
|
+
}
|
66
|
+
|
67
|
+
type SourceType<T = unknown> = GuestAwareType<T> & GuestType<T>;
|
68
|
+
declare class SourceOfValue<T> implements SourceType<T> {
|
160
69
|
private sourceDocument;
|
161
70
|
private pool;
|
162
71
|
constructor(sourceDocument: T);
|
@@ -164,4 +73,4 @@ declare class Source<T> implements SourceType<T> {
|
|
164
73
|
receiving(guest: GuestType<T>): this;
|
165
74
|
}
|
166
75
|
|
167
|
-
export {
|
76
|
+
export { type ChainType, GuestCallback, GuestChain, type GuestExecutorType, GuestSync, type GuestType, type GuestValueType, PatronPool, type PoolType, type ReceiveOptions, SourceOfValue, type SourceType, removePatronFromPools };
|
package/dist/patron.js
CHANGED
@@ -1,8 +1,18 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
class GuestCallback {
|
4
|
+
constructor(receiver) {
|
5
|
+
this.receiver = receiver;
|
6
|
+
}
|
7
|
+
receive(value, options) {
|
8
|
+
this.receiver(value, options);
|
9
|
+
return this;
|
10
|
+
}
|
11
|
+
}
|
12
|
+
|
13
|
+
var __defProp$4 = Object.defineProperty;
|
14
|
+
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
15
|
+
var __publicField$4 = (obj, key, value) => __defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
|
6
16
|
const poolSets = /* @__PURE__ */ new Map();
|
7
17
|
const removePatronFromPools = (patron) => {
|
8
18
|
poolSets.forEach((pool) => {
|
@@ -12,8 +22,8 @@ const removePatronFromPools = (patron) => {
|
|
12
22
|
class PatronPool {
|
13
23
|
constructor(initiator) {
|
14
24
|
this.initiator = initiator;
|
15
|
-
__publicField$
|
16
|
-
__publicField$
|
25
|
+
__publicField$4(this, "patrons", /* @__PURE__ */ new Set());
|
26
|
+
__publicField$4(this, "receive");
|
17
27
|
poolSets.set(this, this.patrons);
|
18
28
|
let lastMicrotask = null;
|
19
29
|
const doReceive = (value, options) => {
|
@@ -59,42 +69,6 @@ class PatronPool {
|
|
59
69
|
}
|
60
70
|
}
|
61
71
|
|
62
|
-
var __defProp$4 = Object.defineProperty;
|
63
|
-
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
64
|
-
var __publicField$4 = (obj, key, value) => __defNormalProp$4(obj, key + "" , value);
|
65
|
-
class Cache {
|
66
|
-
constructor(initiator, defaultValue = null, theCache = null) {
|
67
|
-
this.defaultValue = defaultValue;
|
68
|
-
this.theCache = theCache;
|
69
|
-
__publicField$4(this, "pool");
|
70
|
-
this.pool = new PatronPool(initiator);
|
71
|
-
}
|
72
|
-
receive(value, options) {
|
73
|
-
this.theCache = value;
|
74
|
-
this.pool.receive(value, options);
|
75
|
-
return this;
|
76
|
-
}
|
77
|
-
receiving(guest) {
|
78
|
-
if (this.theCache !== null) {
|
79
|
-
guest.receive(this.theCache);
|
80
|
-
} else if (this.defaultValue !== null) {
|
81
|
-
guest.receive(this.defaultValue);
|
82
|
-
}
|
83
|
-
this.pool.add(guest);
|
84
|
-
return this;
|
85
|
-
}
|
86
|
-
}
|
87
|
-
|
88
|
-
class Guest {
|
89
|
-
constructor(receiver) {
|
90
|
-
this.receiver = receiver;
|
91
|
-
}
|
92
|
-
receive(value, options) {
|
93
|
-
this.receiver(value, options);
|
94
|
-
return this;
|
95
|
-
}
|
96
|
-
}
|
97
|
-
|
98
72
|
var __defProp$3 = Object.defineProperty;
|
99
73
|
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
100
74
|
var __publicField$3 = (obj, key, value) => __defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
|
@@ -153,14 +127,33 @@ class GuestInTheMiddle {
|
|
153
127
|
|
154
128
|
var __defProp$2 = Object.defineProperty;
|
155
129
|
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
156
|
-
var __publicField$2 = (obj, key, value) => __defNormalProp$2(obj,
|
157
|
-
class
|
130
|
+
var __publicField$2 = (obj, key, value) => __defNormalProp$2(obj, key + "" , value);
|
131
|
+
class SourceOfValue {
|
132
|
+
constructor(sourceDocument) {
|
133
|
+
this.sourceDocument = sourceDocument;
|
134
|
+
__publicField$2(this, "pool", new PatronPool(this));
|
135
|
+
}
|
136
|
+
receive(value) {
|
137
|
+
this.sourceDocument = value;
|
138
|
+
this.pool.receive(this.sourceDocument);
|
139
|
+
return this;
|
140
|
+
}
|
141
|
+
receiving(guest) {
|
142
|
+
this.pool.distribute(this.sourceDocument, guest);
|
143
|
+
return this;
|
144
|
+
}
|
145
|
+
}
|
146
|
+
|
147
|
+
var __defProp$1 = Object.defineProperty;
|
148
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
149
|
+
var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
150
|
+
class GuestChain {
|
158
151
|
constructor() {
|
159
|
-
__publicField$
|
160
|
-
__publicField$
|
161
|
-
__publicField$
|
162
|
-
__publicField$
|
163
|
-
this.theChain = new
|
152
|
+
__publicField$1(this, "theChain");
|
153
|
+
__publicField$1(this, "keysKnown", /* @__PURE__ */ new Set());
|
154
|
+
__publicField$1(this, "keysFilled", /* @__PURE__ */ new Set());
|
155
|
+
__publicField$1(this, "filledChainPool", new GuestPool(this));
|
156
|
+
this.theChain = new SourceOfValue({});
|
164
157
|
}
|
165
158
|
resultArray(guest) {
|
166
159
|
this.filledChainPool.add(
|
@@ -171,7 +164,7 @@ class Chain {
|
|
171
164
|
);
|
172
165
|
if (this.isChainFilled()) {
|
173
166
|
this.theChain.receiving(
|
174
|
-
new
|
167
|
+
new GuestCallback((chain) => {
|
175
168
|
this.filledChainPool.receive(Object.values(chain));
|
176
169
|
})
|
177
170
|
);
|
@@ -182,7 +175,7 @@ class Chain {
|
|
182
175
|
if (this.isChainFilled()) {
|
183
176
|
this.filledChainPool.add(guest);
|
184
177
|
this.theChain.receiving(
|
185
|
-
new
|
178
|
+
new GuestCallback((chain) => {
|
186
179
|
this.filledChainPool.receive(chain);
|
187
180
|
})
|
188
181
|
);
|
@@ -193,10 +186,10 @@ class Chain {
|
|
193
186
|
}
|
194
187
|
receiveKey(key) {
|
195
188
|
this.keysKnown.add(key);
|
196
|
-
return new
|
189
|
+
return new GuestCallback((value) => {
|
197
190
|
queueMicrotask(() => {
|
198
191
|
this.theChain.receiving(
|
199
|
-
new
|
192
|
+
new GuestCallback((chain) => {
|
200
193
|
this.keysFilled.add(key);
|
201
194
|
const lastChain = {
|
202
195
|
...chain,
|
@@ -216,46 +209,16 @@ class Chain {
|
|
216
209
|
}
|
217
210
|
}
|
218
211
|
|
219
|
-
class
|
220
|
-
constructor(
|
221
|
-
this.
|
222
|
-
}
|
223
|
-
create(...args) {
|
224
|
-
return new this.constructorFn(
|
225
|
-
...args
|
226
|
-
);
|
227
|
-
}
|
228
|
-
}
|
229
|
-
|
230
|
-
class FactoryDynamic {
|
231
|
-
constructor(creationFn) {
|
232
|
-
this.creationFn = creationFn;
|
233
|
-
}
|
234
|
-
create(...args) {
|
235
|
-
return this.creationFn(...args);
|
236
|
-
}
|
237
|
-
}
|
238
|
-
|
239
|
-
class FactoryWithFactories {
|
240
|
-
constructor(constructorFn, factories = {}) {
|
241
|
-
this.constructorFn = constructorFn;
|
242
|
-
this.factories = factories;
|
243
|
-
}
|
244
|
-
create(...args) {
|
245
|
-
return new this.constructorFn(
|
246
|
-
...args,
|
247
|
-
this.factories
|
248
|
-
);
|
212
|
+
class GuestSync {
|
213
|
+
constructor(theValue) {
|
214
|
+
this.theValue = theValue;
|
249
215
|
}
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
constructor(guestReceiver) {
|
254
|
-
this.guestReceiver = guestReceiver;
|
216
|
+
receive(value) {
|
217
|
+
this.theValue = value;
|
218
|
+
return this;
|
255
219
|
}
|
256
|
-
|
257
|
-
this.
|
258
|
-
return guest;
|
220
|
+
value() {
|
221
|
+
return this.theValue;
|
259
222
|
}
|
260
223
|
}
|
261
224
|
|
@@ -276,20 +239,41 @@ class GuestCast {
|
|
276
239
|
}
|
277
240
|
}
|
278
241
|
|
279
|
-
class
|
280
|
-
constructor(
|
281
|
-
this.
|
242
|
+
class GuestAware {
|
243
|
+
constructor(guestReceiver) {
|
244
|
+
this.guestReceiver = guestReceiver;
|
282
245
|
}
|
283
|
-
|
284
|
-
this.
|
285
|
-
return
|
246
|
+
receiving(guest) {
|
247
|
+
this.guestReceiver(guest);
|
248
|
+
return guest;
|
286
249
|
}
|
287
|
-
|
288
|
-
|
250
|
+
}
|
251
|
+
|
252
|
+
class Guest {
|
253
|
+
callback(receiver) {
|
254
|
+
return new GuestCallback(receiver);
|
255
|
+
}
|
256
|
+
chain() {
|
257
|
+
return new GuestChain();
|
258
|
+
}
|
259
|
+
cast(sourceGuest, targetGuest) {
|
260
|
+
return new GuestCast(sourceGuest, targetGuest);
|
261
|
+
}
|
262
|
+
middleware(baseGuest, middleFn) {
|
263
|
+
return new GuestInTheMiddle(baseGuest, middleFn);
|
264
|
+
}
|
265
|
+
pool(initiator) {
|
266
|
+
return new GuestPool(initiator);
|
267
|
+
}
|
268
|
+
aware(guestReceiver) {
|
269
|
+
return new GuestAware(guestReceiver);
|
270
|
+
}
|
271
|
+
sync(value) {
|
272
|
+
return new GuestSync(value);
|
289
273
|
}
|
290
274
|
}
|
291
275
|
|
292
|
-
class
|
276
|
+
class PatronOfGuest {
|
293
277
|
constructor(willBePatron) {
|
294
278
|
this.willBePatron = willBePatron;
|
295
279
|
}
|
@@ -302,13 +286,13 @@ class Patron {
|
|
302
286
|
}
|
303
287
|
}
|
304
288
|
|
305
|
-
var __defProp
|
306
|
-
var __defNormalProp
|
307
|
-
var __publicField
|
289
|
+
var __defProp = Object.defineProperty;
|
290
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
291
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
|
308
292
|
class PatronOnce {
|
309
293
|
constructor(baseGuest) {
|
310
294
|
this.baseGuest = baseGuest;
|
311
|
-
__publicField
|
295
|
+
__publicField(this, "received", false);
|
312
296
|
}
|
313
297
|
introduction() {
|
314
298
|
return "patron";
|
@@ -325,39 +309,59 @@ class PatronOnce {
|
|
325
309
|
}
|
326
310
|
}
|
327
311
|
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
class Source {
|
332
|
-
constructor(sourceDocument) {
|
333
|
-
this.sourceDocument = sourceDocument;
|
334
|
-
__publicField(this, "pool", new PatronPool(this));
|
312
|
+
class Patron {
|
313
|
+
ofGuest(willBePatron) {
|
314
|
+
return new PatronOfGuest(willBePatron);
|
335
315
|
}
|
336
|
-
|
337
|
-
|
338
|
-
this.pool.receive(this.sourceDocument);
|
339
|
-
return this;
|
316
|
+
once(baseGuest) {
|
317
|
+
return new PatronOnce(baseGuest);
|
340
318
|
}
|
341
|
-
|
342
|
-
|
343
|
-
|
319
|
+
pool(initiator) {
|
320
|
+
return new PatronPool(initiator);
|
321
|
+
}
|
322
|
+
}
|
323
|
+
|
324
|
+
const sourcesApplied = (target, methodsSources) => {
|
325
|
+
return Object.fromEntries(
|
326
|
+
Object.entries(target).map(([key, value]) => {
|
327
|
+
if (value instanceof Function && methodsSources[key]) {
|
328
|
+
methodsSources[key];
|
329
|
+
return [
|
330
|
+
key,
|
331
|
+
new Proxy(value, {
|
332
|
+
apply(target2, thisArg, argArray) {
|
333
|
+
return target2.apply(thisArg, [
|
334
|
+
...methodsSources[key],
|
335
|
+
...argArray
|
336
|
+
]);
|
337
|
+
}
|
338
|
+
})
|
339
|
+
];
|
340
|
+
}
|
341
|
+
return [key, value];
|
342
|
+
})
|
343
|
+
);
|
344
|
+
};
|
345
|
+
|
346
|
+
class Source {
|
347
|
+
ofValue(sourceDocument) {
|
348
|
+
return new SourceOfValue(sourceDocument);
|
349
|
+
}
|
350
|
+
applySources(target, methodsSources) {
|
351
|
+
return sourcesApplied(target, methodsSources);
|
344
352
|
}
|
345
353
|
}
|
346
354
|
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
exports.
|
354
|
-
exports.
|
355
|
-
exports.GuestInTheMiddle = GuestInTheMiddle;
|
356
|
-
exports.GuestPool = GuestPool;
|
355
|
+
if (window) {
|
356
|
+
window["guest"] = new Guest();
|
357
|
+
window["patron"] = new Patron();
|
358
|
+
window["source"] = new Source();
|
359
|
+
}
|
360
|
+
|
361
|
+
exports.GuestCallback = GuestCallback;
|
362
|
+
exports.GuestChain = GuestChain;
|
357
363
|
exports.GuestSync = GuestSync;
|
358
|
-
exports.Patron = Patron;
|
359
|
-
exports.PatronOnce = PatronOnce;
|
360
364
|
exports.PatronPool = PatronPool;
|
361
|
-
exports.
|
365
|
+
exports.SourceOfValue = SourceOfValue;
|
362
366
|
exports.removePatronFromPools = removePatronFromPools;
|
363
367
|
//# sourceMappingURL=patron.js.map
|
package/dist/patron.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"patron.js","sources":["../src/PatronPool.ts","../src/Cache.ts","../src/Guest.ts","../src/GuestPool.ts","../src/GuestInTheMiddle.ts","../src/Chain.ts","../src/Factory.ts","../src/FactoryDynamic.ts","../src/FactoryWithFactories.ts","../src/GuestAware.ts","../src/GuestCast.ts","../src/GuestSync.ts","../src/Patron.ts","../src/PatronOnce.ts","../src/Source.ts"],"sourcesContent":["import { PoolType } from \"./PoolType\";\nimport { GuestType, ReceiveOptions } from \"./Guest\";\n\nconst poolSets = new Map<PoolType, Set<GuestType>>();\n\n/**\n * Удалить патрон из всех пулов\n */\nexport const removePatronFromPools = (patron: GuestType) => {\n poolSets.forEach((pool) => {\n pool.delete(patron);\n });\n};\n\nexport class PatronPool<T> implements PoolType<T> {\n private patrons = new Set<GuestType<T>>();\n\n public receive: (value: T, options?: ReceiveOptions) => this;\n\n public constructor(private initiator: unknown) {\n poolSets.set(this, this.patrons);\n\n let lastMicrotask: (() => void) | null = null;\n const doReceive = (value: T, options?: ReceiveOptions) => {\n this.patrons.forEach((target) => {\n this.sendValueToGuest(value, target, options);\n });\n };\n this.receive = (value: T, options?: ReceiveOptions) => {\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 add(shouldBePatron: GuestType<T>) {\n if (\n shouldBePatron.introduction &&\n shouldBePatron.introduction() === \"patron\"\n ) {\n this.patrons.add(shouldBePatron);\n }\n return this;\n }\n\n public remove(patron: GuestType<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?: ReceiveOptions,\n ) {\n guest.receive(value, {\n ...options,\n data: {\n ...((options?.data as Record<string, unknown>) ?? {}),\n initiator: this.initiator,\n pool: this,\n },\n });\n }\n}\n","import { PatronPool } from \"./PatronPool\";\nimport { GuestType, ReceiveOptions } from \"./Guest\";\nimport { GuestAwareType } from \"./GuestAware\";\n\nexport type CacheType<T = unknown> = GuestType<T> & GuestAwareType<T>;\n\nexport class Cache<T> implements CacheType<T> {\n private pool: PatronPool<T>;\n\n public constructor(\n initiator: unknown,\n private defaultValue: T | null = null,\n private theCache: T | null = null,\n ) {\n this.pool = new PatronPool<T>(initiator);\n }\n\n public receive(value: T, options?: ReceiveOptions): this {\n this.theCache = value;\n this.pool.receive(value, options);\n return this;\n }\n\n public receiving(guest: GuestType<T>): this {\n if (this.theCache !== null) {\n guest.receive(this.theCache);\n } else if (this.defaultValue !== null) {\n guest.receive(this.defaultValue);\n }\n this.pool.add(guest);\n return this;\n }\n}\n","type GuestIntroduction = \"guest\" | \"patron\";\n\nexport interface ReceiveOptions {\n data?: unknown;\n}\n\nexport type GuestExecutorType<T> = (value: T, options?: ReceiveOptions) => void;\n\nexport interface GuestType<T = unknown> {\n receive(value: T, options?: ReceiveOptions): this;\n introduction?(): GuestIntroduction;\n}\n\nexport class Guest<T> implements GuestType<T> {\n public constructor(private receiver: GuestExecutorType<T>) {}\n\n public receive(value: T, options?: ReceiveOptions) {\n this.receiver(value, options);\n return this;\n }\n}\n","import { PatronPool } from \"./PatronPool\";\nimport { PoolType } from \"./PoolType\";\nimport { GuestType, ReceiveOptions } from \"./Guest\";\n\nexport class GuestPool<T> implements GuestType<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 receive(value: T, options?: ReceiveOptions): this {\n this.deliverToGuests(value, options);\n this.patronPool.receive(value, options);\n return this;\n }\n\n public add(guest: GuestType<T>): this {\n if (!guest.introduction || guest.introduction() === \"guest\") {\n this.guests.add(guest);\n }\n this.patronPool.add(guest);\n return this;\n }\n\n public remove(patron: GuestType<T>): this {\n this.guests.delete(patron);\n this.patronPool.remove(patron);\n return this;\n }\n\n public distribute(receiving: T, possiblePatron: GuestType<T>): this {\n this.add(possiblePatron);\n this.receive(receiving);\n return this;\n }\n\n private deliverToGuests(value: T, options?: ReceiveOptions) {\n this.guests.forEach((target) => {\n target.receive(value, options);\n });\n this.guests.clear();\n }\n}\n","import { GuestType, ReceiveOptions } from \"./Guest\";\n\nexport class GuestInTheMiddle<T> implements GuestType<T> {\n public constructor(\n private baseGuest: GuestType<unknown>,\n private middleFn: (value: T, options?: ReceiveOptions) => void,\n ) {}\n\n introduction() {\n if (!this.baseGuest.introduction) {\n return \"guest\";\n }\n return this.baseGuest.introduction();\n }\n\n receive(value: T, options?: ReceiveOptions): this {\n this.middleFn(value, options);\n return this;\n }\n}\n","import { Cache } from \"./Cache\";\nimport { Guest, GuestType } from \"./Guest\";\nimport { GuestPool } from \"./GuestPool\";\nimport { GuestInTheMiddle } from \"./GuestInTheMiddle\";\n\nexport interface ChainType<T = unknown> {\n result(guest: GuestType<T>): this;\n resultArray(guest: GuestType<T>): this;\n receiveKey<R>(key: string): GuestType<R>;\n}\n\nexport class Chain<T> implements ChainType<T> {\n private theChain: Cache<Record<string, unknown>>;\n\n private keysKnown = new Set();\n\n private keysFilled = new Set();\n\n private filledChainPool = new GuestPool(this);\n\n public constructor() {\n this.theChain = new Cache<Record<string, unknown>>(this, {});\n }\n\n public resultArray(guest: GuestType<T>) {\n this.filledChainPool.add(\n new GuestInTheMiddle(guest, (value: Record<string, unknown>) =>\n Object.values(value),\n ),\n );\n if (this.isChainFilled()) {\n this.theChain.receiving(\n new Guest((chain) => {\n this.filledChainPool.receive(Object.values(chain));\n }),\n );\n }\n\n return this;\n }\n\n public result(guest: GuestType<T>) {\n if (this.isChainFilled()) {\n this.filledChainPool.add(guest);\n this.theChain.receiving(\n new Guest((chain) => {\n this.filledChainPool.receive(chain);\n }),\n );\n } else {\n this.filledChainPool.add(guest);\n }\n return this;\n }\n\n public receiveKey<R>(key: string): GuestType<R> {\n this.keysKnown.add(key);\n return new Guest((value) => {\n // Обернул в очередь чтобы можно было синхронно наполнить очередь известных ключей\n queueMicrotask(() => {\n this.theChain.receiving(\n new Guest((chain) => {\n this.keysFilled.add(key);\n const lastChain = {\n ...chain,\n [key]: value,\n };\n this.theChain.receive(lastChain);\n if (this.isChainFilled()) {\n this.filledChainPool.receive(lastChain);\n }\n }),\n );\n });\n });\n }\n\n private isChainFilled() {\n return (\n this.keysFilled.size > 0 && this.keysFilled.size === this.keysKnown.size\n );\n }\n}\n","interface Constructable<T> {\n new (...args: unknown[]): T;\n}\n\ninterface Prototyped<T> {\n prototype: T;\n}\n\nexport interface FactoryType<T> {\n create<R extends unknown[], CT = null>(...args: R): CT extends null ? T : CT;\n}\n\nexport class Factory<T> implements FactoryType<T> {\n public constructor(private constructorFn: Prototyped<T>) {}\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 ) as CT extends null ? T : CT;\n }\n}\n","import { FactoryType } from \"./Factory\";\n\nexport class FactoryDynamic<T> implements FactoryType<T> {\n public constructor(private creationFn: (...args: unknown[]) => T) {}\n\n public create<R extends unknown[], CT = null>(\n ...args: R\n ): CT extends null ? T : CT {\n return this.creationFn(...args) as CT extends null ? T : CT;\n }\n}\n","import { FactoryType } from \"./Factory\";\n\ninterface Constructable<T> {\n new (...args: unknown[]): T;\n}\n\ninterface Prototyped<T> {\n prototype: T;\n}\n\nexport class FactoryWithFactories<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 { GuestType } from \"./Guest\";\n\nexport interface GuestAwareType<T = unknown> {\n receiving(guest: GuestType<T>): unknown;\n}\n\nexport class GuestAware<T = unknown> implements GuestAwareType<T> {\n public constructor(private guestReceiver: (guest: GuestType<T>) => void) {}\n\n public receiving(guest: GuestType<T>): GuestType<T> {\n this.guestReceiver(guest);\n return guest;\n }\n}\n","import { GuestType, ReceiveOptions } from \"./Guest\";\n\nexport class GuestCast<T> implements GuestType<T> {\n public constructor(\n private sourceGuest: GuestType<unknown>,\n private targetGuest: GuestType<T>,\n ) {}\n\n introduction() {\n if (!this.sourceGuest.introduction) {\n return \"guest\";\n }\n return this.sourceGuest.introduction();\n }\n\n receive(value: T, options?: ReceiveOptions): this {\n this.targetGuest.receive(value, options);\n return this;\n }\n}\n","import { GuestType } from \"./Guest\";\n\nexport interface GuestValueType<T = unknown> extends GuestType<T> {\n value(): T;\n}\n\nexport class GuestSync<T> implements GuestValueType<T> {\n public constructor(private theValue: T) {}\n\n public receive(value: T): this {\n this.theValue = value;\n return this;\n }\n\n public value() {\n return this.theValue;\n }\n}\n","import { GuestType, ReceiveOptions } from \"./Guest\";\n\n/**\n * Патрон - это постоянный посетитель\n */\nexport class Patron<T> implements GuestType<T> {\n public constructor(private willBePatron: GuestType<T>) {}\n\n public introduction() {\n return \"patron\" as const;\n }\n\n public receive(value: T, options?: ReceiveOptions): this {\n this.willBePatron.receive(value, options);\n return this;\n }\n}\n","import { GuestType, ReceiveOptions } from \"./Guest\";\nimport { PoolType } from \"./PoolType\";\n\ntype PoolAware = {\n pool?: PoolType;\n};\n\nexport class PatronOnce<T> implements GuestType<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 receive(value: T, options?: ReceiveOptions): this {\n if (!this.received) {\n this.baseGuest.receive(value, options);\n }\n\n const data = options?.data as PoolAware;\n\n if (data?.pool) {\n data.pool.remove(this);\n }\n\n return this;\n }\n}\n","import { GuestAwareType } from \"src/GuestAware\";\nimport { GuestType } from \"./Guest\";\nimport { PatronPool } from \"./PatronPool\";\n\nexport type SourceType<T = unknown> = GuestAwareType<T> & GuestType<T>;\n\nexport class Source<T> implements SourceType<T> {\n private pool = new PatronPool(this);\n\n public constructor(private sourceDocument: T) {}\n\n public receive(value: T): this {\n this.sourceDocument = value;\n this.pool.receive(this.sourceDocument);\n return this;\n }\n\n public receiving(guest: GuestType<T>): this {\n this.pool.distribute(this.sourceDocument, guest);\n return this;\n }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A;AAC/C,IAAO,OAAA,IAAA,CAAA;AAAA,GACT;AACF;;;;;;;;;;;;;;;;;;;"}
|
1
|
+
{"version":3,"file":"patron.js","sources":["../src/Guest/GuestCallback.ts","../src/Patron/PatronPool.ts","../src/Guest/GuestPool.ts","../src/Guest/GuestInTheMiddle.ts","../src/Source/SourceOfValue.ts","../src/Guest/GuestChain.ts","../src/Guest/GuestSync.ts","../src/Guest/GuestCast.ts","../src/Guest/GuestAware.ts","../src/Guest/Guest.ts","../src/Patron/PatronOfGuest.ts","../src/Patron/PatronOnce.ts","../src/Patron/Patron.ts","../src/Source/SourcesApplied.ts","../src/Source/Source.ts","../src/index.ts"],"sourcesContent":["type GuestIntroduction = \"guest\" | \"patron\";\n\nexport interface ReceiveOptions {\n data?: unknown;\n}\n\nexport type GuestExecutorType<T> = (value: T, options?: ReceiveOptions) => void;\n\nexport interface GuestType<T = unknown> {\n receive(value: T, options?: ReceiveOptions): this;\n introduction?(): GuestIntroduction;\n}\n\nexport class GuestCallback<T> implements GuestType<T> {\n public constructor(private receiver: GuestExecutorType<T>) {}\n\n public receive(value: T, options?: ReceiveOptions) {\n this.receiver(value, options);\n return this;\n }\n}\n","import { GuestType, ReceiveOptions } from \"../Guest/GuestCallback\";\n\nconst poolSets = new Map<PoolType, Set<GuestType>>();\n\n/**\n * Удалить патрон из всех пулов\n */\nexport const removePatronFromPools = (patron: GuestType) => {\n poolSets.forEach((pool) => {\n pool.delete(patron);\n });\n};\n\nexport interface PoolType<T = unknown> extends GuestType<T> {\n add(guest: GuestType<T>): this;\n distribute(receiving: T, possiblePatron: GuestType<T>): this;\n remove(patron: GuestType<T>): this;\n}\n\nexport class PatronPool<T> implements PoolType<T> {\n private patrons = new Set<GuestType<T>>();\n\n public receive: (value: T, options?: ReceiveOptions) => this;\n\n public constructor(private initiator: unknown) {\n poolSets.set(this, this.patrons);\n\n let lastMicrotask: (() => void) | null = null;\n const doReceive = (value: T, options?: ReceiveOptions) => {\n this.patrons.forEach((target) => {\n this.sendValueToGuest(value, target, options);\n });\n };\n this.receive = (value: T, options?: ReceiveOptions) => {\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 add(shouldBePatron: GuestType<T>) {\n if (\n shouldBePatron.introduction &&\n shouldBePatron.introduction() === \"patron\"\n ) {\n this.patrons.add(shouldBePatron);\n }\n return this;\n }\n\n public remove(patron: GuestType<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?: ReceiveOptions,\n ) {\n guest.receive(value, {\n ...options,\n data: {\n ...((options?.data as Record<string, unknown>) ?? {}),\n initiator: this.initiator,\n pool: this,\n },\n });\n }\n}\n","import { PatronPool } from \"../Patron/PatronPool\";\nimport { PoolType } from \"../Patron/PatronPool\";\nimport { GuestType, ReceiveOptions } from \"./GuestCallback\";\n\nexport class GuestPool<T> implements GuestType<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 receive(value: T, options?: ReceiveOptions): this {\n this.deliverToGuests(value, options);\n this.patronPool.receive(value, options);\n return this;\n }\n\n public add(guest: GuestType<T>): this {\n if (!guest.introduction || guest.introduction() === \"guest\") {\n this.guests.add(guest);\n }\n this.patronPool.add(guest);\n return this;\n }\n\n public remove(patron: GuestType<T>): this {\n this.guests.delete(patron);\n this.patronPool.remove(patron);\n return this;\n }\n\n public distribute(receiving: T, possiblePatron: GuestType<T>): this {\n this.add(possiblePatron);\n this.receive(receiving);\n return this;\n }\n\n private deliverToGuests(value: T, options?: ReceiveOptions) {\n this.guests.forEach((target) => {\n target.receive(value, options);\n });\n this.guests.clear();\n }\n}\n","import { GuestType, ReceiveOptions } from \"./GuestCallback\";\n\nexport class GuestInTheMiddle<T> implements GuestType<T> {\n public constructor(\n private baseGuest: GuestType<unknown>,\n private middleFn: (value: T, options?: ReceiveOptions) => void,\n ) {}\n\n introduction() {\n if (!this.baseGuest.introduction) {\n return \"guest\";\n }\n return this.baseGuest.introduction();\n }\n\n receive(value: T, options?: ReceiveOptions): this {\n this.middleFn(value, options);\n return this;\n }\n}\n","import { GuestAwareType } from \"../Guest/GuestAware\";\nimport { GuestType } from \"../Guest/GuestCallback\";\nimport { PatronPool } from \"../Patron/PatronPool\";\n\nexport type SourceType<T = unknown> = GuestAwareType<T> & GuestType<T>;\n\nexport class SourceOfValue<T> implements SourceType<T> {\n private pool = new PatronPool(this);\n\n public constructor(private sourceDocument: T) {}\n\n public receive(value: T): this {\n this.sourceDocument = value;\n this.pool.receive(this.sourceDocument);\n return this;\n }\n\n public receiving(guest: GuestType<T>): this {\n this.pool.distribute(this.sourceDocument, guest);\n return this;\n }\n}\n","import { GuestCallback, GuestType } from \"./GuestCallback\";\nimport { GuestPool } from \"./GuestPool\";\nimport { GuestInTheMiddle } from \"./GuestInTheMiddle\";\nimport { SourceOfValue } from \"../Source/SourceOfValue\";\n\nexport interface ChainType<T = unknown> {\n result(guest: GuestType<T>): this;\n resultArray(guest: GuestType<T>): this;\n receiveKey<R>(key: string): GuestType<R>;\n}\n\nexport class GuestChain<T> implements ChainType<T> {\n private theChain: SourceOfValue<Record<string, unknown>>;\n\n private keysKnown = new Set();\n\n private keysFilled = new Set();\n\n private filledChainPool = new GuestPool(this);\n\n public constructor() {\n this.theChain = new SourceOfValue<Record<string, unknown>>({});\n }\n\n public resultArray(guest: GuestType<T>) {\n this.filledChainPool.add(\n new GuestInTheMiddle(guest, (value: Record<string, unknown>) =>\n Object.values(value),\n ),\n );\n if (this.isChainFilled()) {\n this.theChain.receiving(\n new GuestCallback((chain: Record<string, unknown>) => {\n this.filledChainPool.receive(Object.values(chain));\n }),\n );\n }\n\n return this;\n }\n\n public result(guest: GuestType<T>) {\n if (this.isChainFilled()) {\n this.filledChainPool.add(guest);\n this.theChain.receiving(\n new GuestCallback((chain) => {\n this.filledChainPool.receive(chain);\n }),\n );\n } else {\n this.filledChainPool.add(guest);\n }\n return this;\n }\n\n public receiveKey<R>(key: string): GuestType<R> {\n this.keysKnown.add(key);\n return new GuestCallback((value) => {\n // Обернул в очередь чтобы можно было синхронно наполнить очередь известных ключей\n queueMicrotask(() => {\n this.theChain.receiving(\n new GuestCallback((chain: Record<string, unknown>) => {\n this.keysFilled.add(key);\n const lastChain = {\n ...chain,\n [key]: value,\n };\n this.theChain.receive(lastChain);\n if (this.isChainFilled()) {\n this.filledChainPool.receive(lastChain);\n }\n }),\n );\n });\n });\n }\n\n private isChainFilled() {\n return (\n this.keysFilled.size > 0 && this.keysFilled.size === this.keysKnown.size\n );\n }\n}\n","import { GuestType } from \"./GuestCallback\";\n\nexport interface GuestValueType<T = unknown> extends GuestType<T> {\n value(): T;\n}\n\nexport class GuestSync<T> implements GuestValueType<T> {\n public constructor(private theValue: T) {}\n\n public receive(value: T): this {\n this.theValue = value;\n return this;\n }\n\n public value() {\n return this.theValue;\n }\n}\n","import { GuestType, ReceiveOptions } from \"./GuestCallback\";\n\nexport class GuestCast<T> implements GuestType<T> {\n public constructor(\n private sourceGuest: GuestType<unknown>,\n private targetGuest: GuestType<T>,\n ) {}\n\n introduction() {\n if (!this.sourceGuest.introduction) {\n return \"guest\";\n }\n return this.sourceGuest.introduction();\n }\n\n receive(value: T, options?: ReceiveOptions): this {\n this.targetGuest.receive(value, options);\n return this;\n }\n}\n","import { GuestType } from \"./GuestCallback\";\n\nexport interface GuestAwareType<T = unknown> {\n receiving(guest: GuestType<T>): unknown;\n}\n\nexport class GuestAware<T = unknown> implements GuestAwareType<T> {\n public constructor(private guestReceiver: (guest: GuestType<T>) => void) {}\n\n public receiving(guest: GuestType<T>): GuestType<T> {\n this.guestReceiver(guest);\n return guest;\n }\n}\n","import {\n GuestCallback,\n GuestExecutorType,\n GuestType,\n ReceiveOptions,\n} from \"./GuestCallback\";\nimport { GuestChain } from \"./GuestChain\";\nimport { GuestCast } from \"./GuestCast\";\nimport { GuestInTheMiddle } from \"./GuestInTheMiddle\";\nimport { GuestPool } from \"./GuestPool\";\nimport { GuestAware } from \"./GuestAware\";\nimport { GuestSync } from \"./GuestSync\";\n\nexport class Guest {\n public callback<P>(receiver: GuestExecutorType<P>) {\n return new GuestCallback(receiver);\n }\n\n public chain() {\n return new GuestChain();\n }\n\n public cast<P>(sourceGuest: GuestType<unknown>, targetGuest: GuestType<P>) {\n return new GuestCast(sourceGuest, targetGuest);\n }\n\n public middleware<P>(\n baseGuest: GuestType<unknown>,\n middleFn: (value: P, options?: ReceiveOptions) => void,\n ) {\n return new GuestInTheMiddle(baseGuest, middleFn);\n }\n\n public pool(initiator: unknown) {\n return new GuestPool(initiator);\n }\n\n public aware<P>(guestReceiver: (guest: GuestType<P>) => void) {\n return new GuestAware(guestReceiver);\n }\n\n public sync<P>(value: P) {\n return new GuestSync(value);\n }\n}\n","import { GuestType, ReceiveOptions } from \"../Guest/GuestCallback\";\n\n/**\n * Патрон - это постоянный посетитель\n */\nexport class PatronOfGuest<T> implements GuestType<T> {\n public constructor(private willBePatron: GuestType<T>) {}\n\n public introduction() {\n return \"patron\" as const;\n }\n\n public receive(value: T, options?: ReceiveOptions): this {\n this.willBePatron.receive(value, options);\n return this;\n }\n}\n","import { PoolType } from \"./PatronPool\";\nimport { GuestType, ReceiveOptions } from \"../Guest/GuestCallback\";\n\ntype PoolAware = {\n pool?: PoolType;\n};\n\nexport class PatronOnce<T> implements GuestType<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 receive(value: T, options?: ReceiveOptions): this {\n if (!this.received) {\n this.baseGuest.receive(value, options);\n }\n\n const data = options?.data as PoolAware;\n\n if (data?.pool) {\n data.pool.remove(this);\n }\n\n return this;\n }\n}\n","import { PatronOfGuest } from \"./PatronOfGuest\";\nimport { GuestType } from \"../Guest/GuestCallback\";\nimport { PatronOnce } from \"./PatronOnce\";\nimport { PatronPool } from \"./PatronPool\";\n\nexport class Patron {\n public ofGuest<P>(willBePatron: GuestType<P>) {\n return new PatronOfGuest(willBePatron);\n }\n\n public once<P>(baseGuest: GuestType<P>) {\n return new PatronOnce(baseGuest);\n }\n\n public pool(initiator: unknown) {\n return new PatronPool(initiator);\n }\n}\n","type TupleSplit<\n T,\n N extends number,\n O extends readonly any[] = readonly [],\n> = O[\"length\"] extends N\n ? [O, T]\n : T extends readonly [infer F, ...infer R]\n ? TupleSplit<readonly [...R], N, readonly [...O, F]>\n : [O, T];\n\ntype SkipFirst<T extends readonly any[], N extends number> = TupleSplit<\n T,\n N\n>[1];\n\nexport const sourcesApplied = <T>(\n target: T,\n methodsSources: Record<string, unknown[]>,\n) => {\n return Object.fromEntries(\n Object.entries(target as object).map(([key, value]) => {\n if (value instanceof Function && methodsSources[key]) {\n const methodArgs = methodsSources[key];\n return [\n key,\n new Proxy(value, {\n apply(target: Function, thisArg: any, argArray: any[]): any {\n return target.apply(thisArg, [\n ...methodsSources[key],\n ...argArray,\n ]);\n },\n }) as (...args: Parameters<typeof value>) => ReturnType<typeof value>,\n ];\n }\n\n return [key, value];\n }),\n );\n};\n","import { SourceOfValue } from \"./SourceOfValue\";\nimport { sourcesApplied } from \"./SourcesApplied\";\n\nexport class Source {\n public ofValue<P>(sourceDocument: P) {\n return new SourceOfValue(sourceDocument);\n }\n\n public applySources<P>(target: P, methodsSources: Record<string, unknown[]>) {\n return sourcesApplied(target, methodsSources);\n }\n}\n","export * from \"./Guest/GuestCallback\";\nexport * from \"./Guest/GuestChain\";\nexport * from \"./Guest/GuestSync\";\nexport * from \"./Patron/PatronPool\";\nexport * from \"./Source/SourceOfValue\";\n\nimport { Guest } from \"./Guest/Guest\";\nimport { Patron } from \"./Patron/Patron\";\nimport { Source } from \"./Source/Source\";\n\ndeclare var window: any;\n\nif (window) {\n window[\"guest\"] = new Guest();\n window[\"patron\"] = new Patron();\n window[\"source\"] = new Source();\n}\n"],"names":["__publicField","target"],"mappings":";;AAaO,MAAM,aAAyC,CAAA;AAAA,EAC7C,YAAoB,QAAgC,EAAA;AAAhC,IAAA,IAAA,CAAA,QAAA,GAAA,QAAA,CAAA;AAAA,GAAiC;AAAA,EAErD,OAAA,CAAQ,OAAU,OAA0B,EAAA;AACjD,IAAK,IAAA,CAAA,QAAA,CAAS,OAAO,OAAO,CAAA,CAAA;AAC5B,IAAO,OAAA,IAAA,CAAA;AAAA,GACT;AACF;;;;;AClBA,MAAM,QAAA,uBAAe,GAA8B,EAAA,CAAA;AAKtC,MAAA,qBAAA,GAAwB,CAAC,MAAsB,KAAA;AAC1D,EAAS,QAAA,CAAA,OAAA,CAAQ,CAAC,IAAS,KAAA;AACzB,IAAA,IAAA,CAAK,OAAO,MAAM,CAAA,CAAA;AAAA,GACnB,CAAA,CAAA;AACH,EAAA;AAQO,MAAM,UAAqC,CAAA;AAAA,EAKzC,YAAoB,SAAoB,EAAA;AAApB,IAAA,IAAA,CAAA,SAAA,GAAA,SAAA,CAAA;AAJ3B,IAAQA,eAAA,CAAA,IAAA,EAAA,SAAA,sBAAc,GAAkB,EAAA,CAAA,CAAA;AAExC,IAAOA,eAAA,CAAA,IAAA,EAAA,SAAA,CAAA,CAAA;AAGL,IAAS,QAAA,CAAA,GAAA,CAAI,IAAM,EAAA,IAAA,CAAK,OAAO,CAAA,CAAA;AAE/B,IAAA,IAAI,aAAqC,GAAA,IAAA,CAAA;AACzC,IAAM,MAAA,SAAA,GAAY,CAAC,KAAA,EAAU,OAA6B,KAAA;AACxD,MAAK,IAAA,CAAA,OAAA,CAAQ,OAAQ,CAAA,CAAC,MAAW,KAAA;AAC/B,QAAK,IAAA,CAAA,gBAAA,CAAiB,KAAO,EAAA,MAAA,EAAQ,OAAO,CAAA,CAAA;AAAA,OAC7C,CAAA,C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