silentium 0.0.12 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/dist/silentium.cjs +52 -5
- package/dist/silentium.cjs.map +1 -1
- package/dist/silentium.d.ts +22 -4
- package/dist/silentium.js +50 -6
- package/dist/silentium.js.map +1 -1
- package/dist/silentium.min.js +1 -1
- package/dist/silentium.min.mjs +1 -1
- package/dist/silentium.min.mjs.map +1 -1
- package/dist/silentium.mjs +50 -6
- package/dist/silentium.mjs.map +1 -1
- package/eslint.config.mjs +1 -0
- package/package.json +3 -2
- package/src/Patron/PatronPool.destroy.test.ts +27 -0
- package/src/Patron/PatronPool.statistic.test.ts +28 -0
- package/src/Patron/PatronPool.subSource.test.ts +34 -0
- package/src/Patron/PatronPool.ts +72 -5
- package/src/Source/SourceAll._primitives.test.ts +20 -0
- package/src/Source/SourceAll._primitivesArray.test.ts +14 -0
- package/src/Source/SourceAll._promise.test.ts +28 -0
- package/src/Source/SourceAll.ts +2 -0
- package/src/Source/SourceChangeable.ts +1 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [0.0.14](https://github.com/silentium-lab/silentium/compare/v0.0.13...v0.0.14) (2025-04-24)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **main:** added subSourceMany procedure ([c7f3148](https://github.com/silentium-lab/silentium/commit/c7f3148413fafb8d1d0286738f4d1a13db3018df))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* **main:** fix source all sub source ([1053974](https://github.com/silentium-lab/silentium/commit/1053974eabfa1b3601e70699113c638c93078120))
|
|
16
|
+
|
|
17
|
+
### [0.0.13](https://github.com/silentium-lab/silentium/compare/v0.0.12...v0.0.13) (2025-04-24)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* **19-need-to-create-subsource-function:** subSource function created ([1392bc5](https://github.com/silentium-lab/silentium/commit/1392bc538e88ad97fde4586ab68891932741eaf0))
|
|
23
|
+
|
|
5
24
|
### [0.0.12](https://github.com/silentium-lab/silentium/compare/v0.0.11...v0.0.12) (2025-04-23)
|
|
6
25
|
|
|
7
26
|
|
package/dist/silentium.cjs
CHANGED
|
@@ -195,10 +195,49 @@ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { en
|
|
|
195
195
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
196
196
|
const poolSets = /* @__PURE__ */ new Map();
|
|
197
197
|
const poolsOfInitiators = /* @__PURE__ */ new Map();
|
|
198
|
+
const subSources = /* @__PURE__ */ new Map();
|
|
199
|
+
const poolsChangeFns = [];
|
|
200
|
+
const notifyPoolsChange = () => {
|
|
201
|
+
poolsChangeFns.forEach((fn) => fn());
|
|
202
|
+
};
|
|
203
|
+
const lastPatronPoolsStatistic = {
|
|
204
|
+
poolsCount: 0,
|
|
205
|
+
patronsCount: 0
|
|
206
|
+
};
|
|
207
|
+
const patronPoolsStatistic = source((g) => {
|
|
208
|
+
give(lastPatronPoolsStatistic, g);
|
|
209
|
+
poolsChangeFns.push(() => {
|
|
210
|
+
let patronsCount = 0;
|
|
211
|
+
poolSets.forEach((set) => {
|
|
212
|
+
patronsCount += set.size;
|
|
213
|
+
});
|
|
214
|
+
lastPatronPoolsStatistic.poolsCount = poolSets.size;
|
|
215
|
+
lastPatronPoolsStatistic.patronsCount = patronsCount;
|
|
216
|
+
give(lastPatronPoolsStatistic, g);
|
|
217
|
+
});
|
|
218
|
+
});
|
|
219
|
+
const subSource = (source2, subSource2) => {
|
|
220
|
+
if (source2 !== null && typeof source2 !== "object") {
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
if (!subSources.has(source2)) {
|
|
224
|
+
subSources.set(source2, []);
|
|
225
|
+
}
|
|
226
|
+
subSources.get(source2)?.push(subSource2);
|
|
227
|
+
};
|
|
228
|
+
const subSourceMany = (subSource2, sources) => {
|
|
229
|
+
sources.forEach((source2) => {
|
|
230
|
+
subSource2(source2, subSource2);
|
|
231
|
+
});
|
|
232
|
+
};
|
|
198
233
|
const destroy = (initiators) => {
|
|
199
234
|
initiators.forEach((initiator) => {
|
|
200
235
|
const pool = poolsOfInitiators.get(initiator);
|
|
201
236
|
pool?.destroy();
|
|
237
|
+
const relatedInitiators = subSources.get(initiator);
|
|
238
|
+
if (relatedInitiators) {
|
|
239
|
+
destroy(relatedInitiators);
|
|
240
|
+
}
|
|
202
241
|
});
|
|
203
242
|
};
|
|
204
243
|
const patronPools = (patron) => {
|
|
@@ -212,7 +251,7 @@ const patronPools = (patron) => {
|
|
|
212
251
|
};
|
|
213
252
|
const removePatronFromPools = (patron) => {
|
|
214
253
|
if (patron === void 0) {
|
|
215
|
-
throw new Error("removePatronFromPools
|
|
254
|
+
throw new Error("removePatronFromPools didn't receive patron argument");
|
|
216
255
|
}
|
|
217
256
|
poolSets.forEach((pool) => {
|
|
218
257
|
pool.delete(patron);
|
|
@@ -220,7 +259,7 @@ const removePatronFromPools = (patron) => {
|
|
|
220
259
|
};
|
|
221
260
|
const isPatronInPools = (patron) => {
|
|
222
261
|
if (patron === void 0) {
|
|
223
|
-
throw new Error("isPatronInPools
|
|
262
|
+
throw new Error("isPatronInPools didn't receive patron argument");
|
|
224
263
|
}
|
|
225
264
|
let inPool = false;
|
|
226
265
|
poolSets.forEach((pool) => {
|
|
@@ -247,6 +286,7 @@ class PatronPool {
|
|
|
247
286
|
doReceive(value);
|
|
248
287
|
return this;
|
|
249
288
|
};
|
|
289
|
+
notifyPoolsChange();
|
|
250
290
|
}
|
|
251
291
|
size() {
|
|
252
292
|
return this.patrons.size;
|
|
@@ -258,10 +298,12 @@ class PatronPool {
|
|
|
258
298
|
if (typeof shouldBePatron !== "function" && shouldBePatron.introduction && shouldBePatron.introduction() === "patron") {
|
|
259
299
|
this.patrons.add(shouldBePatron);
|
|
260
300
|
}
|
|
301
|
+
notifyPoolsChange();
|
|
261
302
|
return this;
|
|
262
303
|
}
|
|
263
304
|
remove(patron) {
|
|
264
305
|
this.patrons.delete(patron);
|
|
306
|
+
notifyPoolsChange();
|
|
265
307
|
return this;
|
|
266
308
|
}
|
|
267
309
|
distribute(receiving, possiblePatron) {
|
|
@@ -275,12 +317,15 @@ class PatronPool {
|
|
|
275
317
|
});
|
|
276
318
|
poolSets.delete(this);
|
|
277
319
|
poolsOfInitiators.delete(this.initiator);
|
|
320
|
+
notifyPoolsChange();
|
|
321
|
+
return this;
|
|
278
322
|
}
|
|
279
323
|
sendValueToGuest(value, guest) {
|
|
280
324
|
const isDisposed = this.guestDisposed(value, guest);
|
|
281
325
|
if (!isDisposed) {
|
|
282
326
|
give(value, guest);
|
|
283
327
|
}
|
|
328
|
+
return this;
|
|
284
329
|
}
|
|
285
330
|
guestDisposed(value, guest) {
|
|
286
331
|
if (guest.disposed?.(value)) {
|
|
@@ -318,7 +363,6 @@ const patronExecutorApplied = (baseGuest, applier) => {
|
|
|
318
363
|
const sourceChangeable = (source) => {
|
|
319
364
|
const createdSource = {};
|
|
320
365
|
const thePool = new PatronPool(createdSource);
|
|
321
|
-
const theEmptyPool = new PatronPool(createdSource);
|
|
322
366
|
let isEmpty = source === void 0;
|
|
323
367
|
if (source !== void 0 && isSource(source)) {
|
|
324
368
|
value(
|
|
@@ -334,7 +378,7 @@ const sourceChangeable = (source) => {
|
|
|
334
378
|
createdSource.value = (g) => {
|
|
335
379
|
if (isEmpty) {
|
|
336
380
|
if (isPatron(g)) {
|
|
337
|
-
|
|
381
|
+
thePool.add(g);
|
|
338
382
|
}
|
|
339
383
|
return createdSource;
|
|
340
384
|
}
|
|
@@ -349,7 +393,6 @@ const sourceChangeable = (source) => {
|
|
|
349
393
|
isEmpty = false;
|
|
350
394
|
source = value2;
|
|
351
395
|
thePool.give(source);
|
|
352
|
-
theEmptyPool.give(source);
|
|
353
396
|
return createdSource;
|
|
354
397
|
};
|
|
355
398
|
return createdSource;
|
|
@@ -364,6 +407,7 @@ const sourceAll = (sources) => {
|
|
|
364
407
|
const isSourcesArray = Array.isArray(sources);
|
|
365
408
|
const theAll = sourceChangeable({});
|
|
366
409
|
Object.entries(sources).forEach(([key, source]) => {
|
|
410
|
+
subSource(source, theAll);
|
|
367
411
|
keysKnown.add(key);
|
|
368
412
|
value(
|
|
369
413
|
source,
|
|
@@ -620,6 +664,7 @@ exports.patronApplied = patronApplied;
|
|
|
620
664
|
exports.patronExecutorApplied = patronExecutorApplied;
|
|
621
665
|
exports.patronOnce = patronOnce;
|
|
622
666
|
exports.patronPools = patronPools;
|
|
667
|
+
exports.patronPoolsStatistic = patronPoolsStatistic;
|
|
623
668
|
exports.personal = personal;
|
|
624
669
|
exports.personalClass = personalClass;
|
|
625
670
|
exports.removePatronFromPools = removePatronFromPools;
|
|
@@ -635,5 +680,7 @@ exports.sourceOnce = sourceOnce;
|
|
|
635
680
|
exports.sourceRace = sourceRace;
|
|
636
681
|
exports.sourceSequence = sourceSequence;
|
|
637
682
|
exports.sourceSync = sourceSync;
|
|
683
|
+
exports.subSource = subSource;
|
|
684
|
+
exports.subSourceMany = subSourceMany;
|
|
638
685
|
exports.value = value;
|
|
639
686
|
//# sourceMappingURL=silentium.cjs.map
|
package/dist/silentium.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"silentium.cjs","sources":["../src/Source/Source.ts","../src/Guest/Guest.ts","../src/Guest/GuestCast.ts","../src/Guest/GuestSync.ts","../src/Guest/GuestDisposable.ts","../src/Guest/GuestApplied.ts","../src/Guest/GuestExecutorApplied.ts","../src/Patron/Patron.ts","../src/Patron/PatronOnce.ts","../src/Patron/PatronPool.ts","../src/Patron/PatronApplied.ts","../src/Patron/PatronExecutorApplied.ts","../src/Source/SourceChangeable.ts","../src/Source/SourceAll.ts","../src/Source/SourceSequence.ts","../src/Source/SourceMap.ts","../src/Source/SourceRace.ts","../src/Source/SourceDynamic.ts","../src/Source/SourceApplied.ts","../src/Source/SourceExecutorApplied.ts","../src/Source/SourceFiltered.ts","../src/Source/SourceOnce.ts","../src/Source/SourceSync.ts","../src/Personal/PersonalClass.ts","../src/Personal/Personal.ts"],"sourcesContent":["import { give, GuestType } from \"../Guest/Guest\";\n\nexport type SourceExecutorType<T> = (guest: GuestType<T>) => unknown;\n\nexport interface SourceObjectType<T> {\n value: SourceExecutorType<T>;\n}\n\nexport type SourceDataType<T> = Extract<\n T,\n string | number | boolean | Date | object | Array<unknown> | symbol\n>;\n\nexport type SourceType<T = any> =\n | SourceExecutorType<T>\n | SourceObjectType<T>\n | SourceDataType<T>;\n\n/**\n * Helps to connect source and guest, if you need to get value in guest from source\n * helpful because we don't know what shape of source do we have, it can be function or object or primitive\n * @url https://silentium-lab.github.io/silentium/#/utils/value\n */\nexport const value = <T>(source: SourceType<T>, guest: GuestType<T>) => {\n if (source === undefined || source === null) {\n throw new Error(\"value didn't receive source argument\");\n }\n if (guest === undefined || source === null) {\n throw new Error(\"value didn't receive guest argument\");\n }\n if (typeof source === \"function\") {\n source(guest);\n } else if (\n typeof source === \"object\" &&\n \"value\" in source &&\n typeof source.value === \"function\"\n ) {\n source.value(guest);\n } else {\n give(source as T, guest);\n }\n\n return source;\n};\n\n/**\n * Helps to check what some information is of source shape\n * @url https://silentium-lab.github.io/silentium/#/utils/is-source\n */\nexport const isSource = <T>(\n mbSource: T | SourceType<T>,\n): mbSource is SourceType<T> => {\n if (\n mbSource !== null &&\n typeof mbSource === \"object\" &&\n \"value\" in mbSource &&\n typeof mbSource.value === \"function\"\n ) {\n return true;\n }\n return mbSource !== null && mbSource !== undefined;\n};\n\n/**\n * Represents source as function\n * @url https://silentium-lab.github.io/silentium/#/source\n */\nexport const source = <T>(source: SourceType<T>): SourceExecutorType<T> => {\n if (source === undefined) {\n throw new Error(\"Source constructor didn't receive executor function\");\n }\n\n return (guest: GuestType<T>) => {\n value(source, guest);\n };\n};\n","import { source, SourceExecutorType, SourceType } from \"../Source/Source\";\n\ntype GuestIntroduction = \"guest\" | \"patron\";\n\nexport type GuestExecutorType<T = any, This = void> = (value: T) => This;\n\nexport interface GuestObjectType<T = any> {\n give(value: T): this;\n introduction?(): GuestIntroduction;\n}\n\nexport type GuestType<T = any> = GuestExecutorType<T> | GuestObjectType<T>;\n\n/**\n * Helps to give data to guest, guests can be of different shapes\n * function guest or object guest\n * @url https://silentium-lab.github.io/silentium/#/utils/give\n */\nexport const give = <T>(\n data: T,\n guest?: GuestType<T>,\n): GuestType<T> | SourceExecutorType<T> => {\n if (data === undefined) {\n throw new Error(\"give didn't receive data argument\");\n }\n if (guest === undefined) {\n return source<T>(data as SourceType<T>) as SourceExecutorType<T>;\n }\n if (typeof guest === \"function\") {\n guest(data);\n } else {\n guest.give(data);\n }\n return guest;\n};\n\n/**\n * Helps to check if mbGuest can be used to retrieve value\n * @url https://silentium-lab.github.io/silentium/#/utils/is-guest\n */\nexport const 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 * Helps to create guest of object type\n * @url https://silentium-lab.github.io/silentium/#/guest\n */\nexport const guest = <T>(receiver: GuestExecutorType<T>) => {\n if (!receiver) {\n throw new Error(\"receiver function was not passed to Guest constructor\");\n }\n const result = {\n give(value: T) {\n receiver(value);\n return result;\n },\n };\n return result;\n};\n","import { give, GuestType } from \"./Guest\";\nimport { GuestDisposableType, MaybeDisposableType } from \"./GuestDisposable\";\n\n/**\n * Helps to inherit guest behavior, its introduction and dispose settings\n * @url https://silentium-lab.github.io/silentium/#/guest/guest-cast\n */\nexport const guestCast = <T>(\n sourceGuest: GuestType<any>,\n targetGuest: GuestType<T>,\n): GuestDisposableType<T> => {\n if (sourceGuest === undefined) {\n throw new Error(\"GuestCast didn't receive sourceGuest argument\");\n }\n if (targetGuest === undefined) {\n throw new Error(\"GuestCast didn't receive targetGuest argument\");\n }\n\n const result = {\n disposed(value: T | null): boolean {\n const maybeDisposable = sourceGuest as MaybeDisposableType;\n return maybeDisposable.disposed ? maybeDisposable.disposed(value) : false;\n },\n give(value: T) {\n give(value, targetGuest);\n return result;\n },\n introduction() {\n if (typeof sourceGuest === \"function\") {\n return \"guest\";\n }\n if (!sourceGuest.introduction) {\n return \"guest\";\n }\n return sourceGuest.introduction();\n },\n };\n\n return result;\n};\n","import { GuestObjectType } from \"./Guest\";\n\nexport interface GuestValueType<T = any> extends GuestObjectType<T> {\n value(): T;\n}\n\n/**\n * @url https://silentium-lab.github.io/silentium/#/guest/guest-sync\n */\nexport const guestSync = <T>(theValue?: T): GuestValueType<T> => {\n const result = {\n give(value: T) {\n theValue = value;\n return result;\n },\n value() {\n if (theValue === undefined) {\n throw new Error(\"no value in GuestSync!\");\n }\n return theValue;\n },\n };\n\n return result;\n};\n","import { give, 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 * Connects to guest logic what can tell PatronPool\n * what guest don't need to receive new values\n * @url https://silentium-lab.github.io/silentium/#/guest/guest-disposable\n */\nexport const guestDisposable = <T>(\n guest: GuestType,\n disposeCheck: (value: T | null) => boolean,\n): GuestDisposableType<T> => {\n if (guest === undefined) {\n throw new Error(\"GuestDisposable didn't receive guest argument\");\n }\n if (disposeCheck === undefined) {\n throw new Error(\"GuestDisposable didn't receive disposeCheck argument\");\n }\n\n const result = {\n disposed(value: T | null): boolean {\n return disposeCheck(value);\n },\n give(value: T) {\n give(value, guest);\n return result;\n },\n };\n\n return result;\n};\n","import { give, GuestObjectType, GuestType } from \"../Guest/Guest\";\n\n/**\n * Helps to apply function to value before baseGuest will receive it\n * @url https://silentium-lab.github.io/silentium/#/guest/guest-applied\n */\nexport const guestApplied = <T, R>(\n baseGuest: GuestType<R>,\n applier: (value: T) => R,\n): GuestObjectType<T> => {\n const result = {\n give(value: T) {\n give(applier(value), baseGuest);\n return result;\n },\n };\n return result;\n};\n","import {\n give,\n GuestExecutorType,\n GuestObjectType,\n GuestType,\n} from \"../Guest/Guest\";\n\n/**\n * Apply function to guest function of receiving value, useful for debouncing or throttling\n * @url https://silentium-lab.github.io/silentium/#/guest/guest-executor-applied\n */\nexport const guestExecutorApplied = <T>(\n baseGuest: GuestType<T>,\n applier: (executor: GuestExecutorType<T>) => GuestExecutorType<T>,\n): GuestObjectType<T> => {\n const result = {\n give: applier((v) => give(v, baseGuest)),\n };\n\n return result as GuestObjectType<T>;\n};\n","import { give, GuestType } from \"../Guest/Guest\";\nimport { GuestDisposableType } from \"../Guest/GuestDisposable\";\n\nexport type PatronType<T> = GuestDisposableType<T> & {\n introduction(): \"patron\";\n};\n\n/**\n * Helps to check what incoming object is patron\n * @url https://silentium-lab.github.io/silentium/#/utils/is-patron\n */\nexport const isPatron = (guest: GuestType): guest is PatronType<unknown> =>\n typeof guest === \"object\" &&\n guest !== null &&\n guest?.introduction?.() === \"patron\";\n\nexport const introduction = () => \"patron\" as const;\n\n/**\n * Help to turn existed guest intro patron\n * @url https://silentium-lab.github.io/silentium/#/patron\n */\nexport const patron = <T>(\n willBePatron: GuestType<T>,\n): GuestDisposableType<T> => {\n if (willBePatron === undefined) {\n throw new Error(\"Patron didn't receive willBePatron argument\");\n }\n\n const result = {\n give(value: T) {\n give(value, willBePatron);\n return result;\n },\n disposed(value: T | null): boolean {\n const maybeDisposable = willBePatron as GuestDisposableType;\n return maybeDisposable?.disposed?.(value) || false;\n },\n introduction,\n };\n\n return result;\n};\n","import { introduction } from \"../Patron/Patron\";\nimport { give, GuestType } from \"../Guest/Guest\";\nimport {\n GuestDisposableType,\n MaybeDisposableType,\n} from \"../Guest/GuestDisposable\";\n\n/**\n * Helps to call patron only once, this will be helpful when you\n * need value but you know what value can not be existed at a time of requesting\n * @url https://silentium-lab.github.io/silentium/#/patron/patron-once\n */\nexport const patronOnce = <T>(\n baseGuest: GuestType<T>,\n): GuestDisposableType<T> => {\n if (baseGuest === undefined) {\n throw new Error(\"PatronOnce didn't receive baseGuest argument\");\n }\n\n let received = false;\n\n const result = {\n give(value: T) {\n if (!received) {\n received = true;\n give(value, baseGuest);\n }\n return result;\n },\n disposed(value: T | null): boolean {\n if (received) {\n return true;\n }\n const maybeDisposable = baseGuest as MaybeDisposableType;\n return maybeDisposable.disposed ? maybeDisposable.disposed(value) : false;\n },\n introduction,\n };\n\n return result;\n};\n","import { give, GuestObjectType, GuestType } from \"../Guest/Guest\";\nimport { GuestDisposableType } from \"../Guest/GuestDisposable\";\n\nconst poolSets = new Map<PoolType, Set<GuestObjectType>>();\nconst poolsOfInitiators = new Map<unknown, PoolType>();\n\n/**\n * Helps to remove all pools of related initiators\n * @url https://silentium-lab.github.io/silentium/#/utils/destroy\n */\nexport const destroy = (initiators: unknown[]) => {\n initiators.forEach((initiator) => {\n const pool = poolsOfInitiators.get(initiator);\n pool?.destroy();\n });\n};\n\n/**\n * Returns all pools related to one patron\n * @url https://silentium-lab.github.io/silentium/#/utils/patron-pools\n */\nexport const patronPools = (patron: GuestObjectType) => {\n const pools: PoolType[] = [];\n poolSets.forEach((pool, poolInstance) => {\n if (pool.has(patron)) {\n pools.push(poolInstance);\n }\n });\n return pools;\n};\n\n/**\n * Removes patron from all existed pools\n * @url https://silentium-lab.github.io/silentium/#/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 * Checks what patron is connected with any pool\n * @url https://silentium-lab.github.io/silentium/#/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 destroy(): void;\n}\n\n/**\n * Pool class helps to implement dispatching for patron about new values\n * what may appear in sources\n * @url https://silentium-lab.github.io/silentium/#/patron/patron-pool\n */\nexport class PatronPool<T> implements PoolType<T> {\n private patrons: Set<GuestObjectType<T>>;\n\n public give: (value: T) => this;\n\n public constructor(private initiator: unknown) {\n this.patrons = new Set<GuestObjectType<T>>();\n poolSets.set(this, this.patrons);\n poolsOfInitiators.set(this.initiator, this);\n const doReceive = (value: T) => {\n this.patrons.forEach((target) => {\n this.sendValueToGuest(value, target);\n });\n };\n this.give = (value: T) => {\n doReceive(value);\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 public destroy() {\n this.patrons.forEach((patron) => {\n this.remove(patron);\n });\n poolSets.delete(this);\n poolsOfInitiators.delete(this.initiator);\n }\n\n private sendValueToGuest(value: T, guest: GuestType<T>) {\n const isDisposed = this.guestDisposed(value, guest);\n if (!isDisposed) {\n give(value, guest);\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 return false;\n }\n}\n","import { introduction } from \"../Patron/Patron\";\nimport { GuestObjectType, GuestType } from \"../Guest/Guest\";\nimport { guestApplied } from \"../Guest/GuestApplied\";\n\n/**\n * Helps to apply function to patron\n * @url https://silentium-lab.github.io/silentium/#/patron/patron-applied\n */\nexport const patronApplied = <T, R>(\n baseGuest: GuestType<R>,\n applier: (value: T) => R,\n): GuestObjectType<T> => {\n const applied = guestApplied(baseGuest, applier);\n\n const result = {\n give(value: T) {\n applied.give(value);\n return result;\n },\n introduction,\n };\n\n return result;\n};\n","import { introduction } from \"../Patron/Patron\";\nimport { GuestExecutorType, GuestType } from \"../Guest/Guest\";\nimport { guestExecutorApplied } from \"../Guest/GuestExecutorApplied\";\n\n/**\n * Helps to apply function to patrons executor\n * @url https://silentium-lab.github.io/silentium/#/patron/patron-executor-applied\n */\nexport const patronExecutorApplied = <T>(\n baseGuest: GuestType<T>,\n applier: (executor: GuestExecutorType) => GuestExecutorType,\n) => {\n const guestApplied = guestExecutorApplied(baseGuest, applier);\n\n const result = {\n give(value: T) {\n guestApplied.give(value);\n return result;\n },\n introduction,\n };\n\n return result;\n};\n","import { guest, GuestObjectType, GuestType } from \"../Guest/Guest\";\nimport { isPatron } from \"../Patron/Patron\";\nimport { patronOnce } from \"../Patron/PatronOnce\";\nimport { PatronPool } from \"../Patron/PatronPool\";\nimport {\n isSource,\n SourceDataType,\n SourceObjectType,\n SourceType,\n value,\n} from \"./Source\";\n\nexport type SourceChangeableType<T = any> = SourceObjectType<T> &\n GuestObjectType<T>;\n\n/**\n * Ability to create source what can be changed later\n * @url https://silentium-lab.github.io/silentium/#/source/source-changeable\n */\nexport const sourceChangeable = <T>(source?: SourceType<T>) => {\n const createdSource = {} as SourceChangeableType<T>;\n const thePool = new PatronPool(createdSource);\n const theEmptyPool = new PatronPool(createdSource);\n let isEmpty = source === undefined;\n\n if (source !== undefined && isSource(source)) {\n value(\n source,\n patronOnce((unwrappedSourceDocument) => {\n isEmpty = unwrappedSourceDocument === undefined;\n source = unwrappedSourceDocument as SourceDataType<T>;\n }),\n );\n } else {\n isEmpty = source === undefined;\n }\n\n createdSource.value = (g: GuestType<T>) => {\n if (isEmpty) {\n if (isPatron(g)) {\n theEmptyPool.add(g);\n }\n return createdSource;\n }\n\n if (typeof g === \"function\") {\n thePool.distribute(source, guest(g));\n } else {\n thePool.distribute(source, g);\n }\n\n return createdSource;\n };\n\n createdSource.give = (value: T) => {\n isEmpty = false;\n source = value as SourceDataType<T>;\n thePool.give(source);\n theEmptyPool.give(source);\n return createdSource;\n };\n\n return createdSource as SourceChangeableType<T>;\n};\n","import { give, guest, GuestType } from \"../Guest/Guest\";\nimport { guestCast } from \"../Guest/GuestCast\";\nimport { patron } from \"../Patron/Patron\";\nimport { SourceType, value } from \"./Source\";\nimport { sourceChangeable } from \"./SourceChangeable\";\n\n/**\n * Represents common value as Record or Array of bunch of sources,\n * when all sources will gets it's values\n * @url https://silentium-lab.github.io/silentium/#/source/source-all\n */\nexport const sourceAll = <T>(\n sources: SourceType<any>[] | Record<string, SourceType<any>>,\n) => {\n const keysKnown = new Set<string>(Object.keys(sources));\n const keysFilled = new Set();\n const isAllFilled = () => {\n return keysFilled.size > 0 && keysFilled.size === keysKnown.size;\n };\n const isSourcesArray = Array.isArray(sources);\n const theAll = sourceChangeable<Record<string, unknown>>({});\n\n Object.entries(sources).forEach(([key, source]) => {\n keysKnown.add(key);\n value(\n source,\n patron((v) => {\n theAll.value(\n guest((all: Record<string, unknown>) => {\n keysFilled.add(key);\n const lastAll = {\n ...all,\n [key]: v,\n };\n theAll.give(lastAll);\n }),\n );\n }),\n );\n });\n\n return (guest: GuestType<T>) => {\n value((g) => {\n theAll.value(\n guestCast(g, (value) => {\n if (isAllFilled()) {\n give((isSourcesArray ? Object.values(value) : value) as T, g);\n }\n }),\n );\n }, guest);\n };\n};\n","import { give, GuestType } from \"../Guest/Guest\";\nimport { guestCast } from \"../Guest/GuestCast\";\nimport { patronOnce } from \"../Patron/PatronOnce\";\nimport { PersonalType } from \"../Personal/Personal\";\nimport { isSource, SourceType, value } from \"./Source\";\nimport { sourceAll } from \"./SourceAll\";\nimport { sourceChangeable, SourceChangeableType } from \"./SourceChangeable\";\n\n/**\n * Ability to apply source to source of array values sequentially\n * @url https://silentium-lab.github.io/silentium/#/source/source-sequence\n */\nexport const sourceSequence = <T, TG>(\n baseSource: SourceType<T[]>,\n targetSource: PersonalType<SourceType<TG>>,\n) => {\n if (baseSource === undefined) {\n throw new Error(\"SourceSequence didn't receive baseSource argument\");\n }\n if (targetSource === undefined) {\n throw new Error(\"SourceSequence didn't receive targetSource argument\");\n }\n\n return (guest: GuestType<TG[]>) => {\n const sequenceSource = sourceChangeable();\n const source = targetSource.get(sequenceSource);\n\n value(\n baseSource,\n guestCast(guest, (theValue) => {\n let index = 0;\n\n const sources: SourceChangeableType[] = [];\n theValue.forEach(() => {\n sources.push(sourceChangeable());\n });\n\n const nextItemHandle = () => {\n if (theValue[index + 1] !== undefined) {\n index = index + 1;\n handle();\n }\n };\n\n function handle() {\n const currentSource = sources[index];\n const nextValue = theValue[index];\n if (isSource(nextValue)) {\n value(\n nextValue,\n patronOnce((theNextValue) => {\n sequenceSource.give(theNextValue);\n value(source, currentSource);\n nextItemHandle();\n }),\n );\n } else {\n sequenceSource.give(nextValue);\n value(source, currentSource);\n nextItemHandle();\n }\n }\n\n if (theValue[index] !== undefined) {\n handle();\n value(sourceAll(sources), guest);\n } else {\n give([], guest);\n }\n }),\n );\n };\n};\n","import { GuestType } from \"../Guest/Guest\";\nimport { guestCast } from \"../Guest/GuestCast\";\nimport { PersonalType } from \"../Personal/Personal\";\nimport { SourceType, value } from \"./Source\";\nimport { sourceAll } from \"./SourceAll\";\n\n/**\n * Helps to modify many sources with one private source\n * @url https://silentium-lab.github.io/silentium/#/source/source-map\n */\nexport const sourceMap = <T, TG>(\n baseSource: SourceType<T[]>,\n targetSource: PersonalType<SourceType<TG>>,\n) => {\n if (baseSource === undefined) {\n throw new Error(\"SourceMap didn't receive baseSource argument\");\n }\n if (targetSource === undefined) {\n throw new Error(\"SourceMap didn't receive targetSource argument\");\n }\n\n return (guest: GuestType<TG[]>) => {\n value(\n baseSource,\n guestCast(<GuestType>guest, (theValue) => {\n const sources: SourceType[] = [];\n theValue.forEach((val) => {\n const source = targetSource.get(val);\n sources.push(source);\n });\n value(sourceAll(sources), guest);\n }),\n );\n return this;\n };\n};\n","import { give, GuestType } from \"../Guest/Guest\";\nimport { guestCast } from \"../Guest/GuestCast\";\nimport { SourceType, value } from \"./Source\";\n\n/**\n * Connects guest with source what give response faster than others\n * @url https://silentium-lab.github.io/silentium/#/source/source-race\n */\nexport const sourceRace = <T>(sources: SourceType<T>[]) => {\n if (sources === undefined) {\n throw new Error(\"SourceRace didnt receive sources argument\");\n }\n\n return (guest: GuestType<T>) => {\n let connectedWithSource: SourceType | null = null;\n sources.forEach((source) => {\n value(\n source,\n guestCast(<GuestType>guest, (value) => {\n if (!connectedWithSource || connectedWithSource === source) {\n give(value as T, guest);\n connectedWithSource = source;\n }\n }),\n );\n });\n };\n};\n","import { give, GuestType } from \"../Guest/Guest\";\nimport { SourceType, value } from \"./Source\";\nimport { SourceChangeableType } from \"./SourceChangeable\";\n\n/**\n * Ability to build common changeable source from different guest and source\n * @url https://silentium-lab.github.io/silentium/#/source/source-dynamic\n */\nexport const sourceDynamic = <T>(\n baseGuest: GuestType<T>,\n baseSource: SourceType<T>,\n): SourceChangeableType<T> => {\n if (baseGuest === undefined) {\n throw new Error(\"SourceDynamic didn't receive baseGuest argument\");\n }\n if (baseSource === undefined) {\n throw new Error(\"SourceDynamic didn't receive baseSource argument\");\n }\n\n const sourceObject = {\n value(guest: GuestType<T>) {\n value(baseSource, guest);\n return sourceObject;\n },\n give(value: T) {\n give(value, baseGuest);\n return this;\n },\n };\n\n return sourceObject;\n};\n","import { give, GuestType } from \"../Guest/Guest\";\nimport { guestCast } from \"../Guest/GuestCast\";\nimport { SourceType, value } from \"../Source/Source\";\n\n/**\n * Gives ability to apply function to source value\n * @url https://silentium-lab.github.io/silentium/#/source/source-applied\n */\nexport const sourceApplied = <T, R>(\n baseSource: SourceType<T>,\n applier: (v: T) => R,\n) => {\n return (guest: GuestType<R>) => {\n value(\n baseSource,\n guestCast(guest, (v) => {\n give(applier(v), guest);\n }),\n );\n };\n};\n","import { SourceExecutorType, SourceType, value } from \"../Source/Source\";\n\n/**\n * Ability to apply function to source executor, helpful when need to apply throttling or debounce\n * @url https://silentium-lab.github.io/silentium/#/source/source-executor-applied\n */\nexport const sourceExecutorApplied = <T>(\n source: SourceType<T>,\n applier: (executor: SourceExecutorType<T>) => SourceExecutorType<T>,\n) => {\n return applier((g) => {\n value(source, g);\n });\n};\n","import { give, GuestType } from \"../Guest/Guest\";\nimport { guestCast } from \"../Guest/GuestCast\";\nimport { SourceType, value } from \"../Source/Source\";\n\n/**\n * Helps not to respond with information what checked by predicate function\n * @url https://silentium-lab.github.io/silentium/#/source/source-filtered\n */\nexport const sourceFiltered = <T>(\n baseSource: SourceType<T>,\n predicate: (v: T) => boolean,\n) => {\n return (g: GuestType<T>) => {\n value(\n baseSource,\n guestCast(g, (v) => {\n if (predicate(v) === true) {\n give(v, g);\n }\n }),\n );\n };\n};\n","import { GuestType } from \"../Guest/Guest\";\nimport { SourceType, value } from \"./Source\";\nimport { sourceChangeable } from \"./SourceChangeable\";\n\n/**\n * Ability set the value only once\n * @url https://silentium-lab.github.io/silentium/#/source/source-once\n */\nexport const sourceOnce = <T>(initialValue?: SourceType<T>) => {\n let isFilled = initialValue !== undefined;\n const source = sourceChangeable(initialValue);\n\n return {\n value(guest: GuestType<T>) {\n value(source, guest);\n return this;\n },\n give(value: T) {\n if (!isFilled) {\n source.give(value);\n isFilled = true;\n }\n return this;\n },\n };\n};\n","import { GuestType } from \"../Guest/Guest\";\nimport { guestSync } from \"../Guest/GuestSync\";\nimport { patron } from \"../Patron/Patron\";\nimport { SourceObjectType, SourceType, value } from \"../Source/Source\";\n\n/**\n * Helps to represent source value as sync value, what can be returned\n * useful for example in tests\n * @url https://silentium-lab.github.io/silentium/#/source/source-sync\n */\nexport const sourceSync = <T>(\n baseSource: SourceType<T>,\n): SourceObjectType<T> & { syncValue(): T } => {\n const syncGuest = guestSync<T>();\n value(baseSource, patron(syncGuest));\n\n return {\n value(guest: GuestType<T>) {\n value(baseSource, guest);\n return this;\n },\n syncValue() {\n try {\n return syncGuest.value() as T;\n } catch {\n throw new Error(\"No value in SourceSync\");\n }\n },\n };\n};\n","import { PersonalType } from \"./Personal\";\n\ninterface Constructable<T> {\n new (...args: unknown[]): T;\n}\n\ninterface Prototyped<T> {\n prototype: T;\n}\n\nexport const personalClass = <T>(\n constructorFn: Prototyped<T>,\n modules: Record<string, unknown> = {},\n): PersonalType<T> => {\n if (constructorFn === undefined) {\n throw new Error(\"PrivateClass didn't receive constructorFn argument\");\n }\n\n return {\n get<R extends unknown[], CT = null>(...args: R): CT extends null ? T : CT {\n return new (constructorFn as Constructable<T>)(\n ...args,\n modules,\n ) as CT extends null ? T : CT;\n },\n };\n};\n","export interface PersonalType<T> {\n get<R extends unknown[], CT = null>(...args: R): CT extends null ? T : CT;\n}\n\n/**\n * Helps to get personal instance of dependency\n * @url https://silentium-lab.github.io/silentium/#/utils/private\n */\nexport const personal = <T>(\n buildingFn: (...args: any[]) => T,\n): PersonalType<T> => {\n if (buildingFn === undefined) {\n throw new Error(\"personal didn't receive buildingFn argument\");\n }\n\n return {\n get<R extends unknown[], CT = null>(...args: R): CT extends null ? T : CT {\n return buildingFn(...args) as CT extends null ? T : CT;\n },\n };\n};\n"],"names":["source","guest","value"],"mappings":";;AAuBa,MAAA,KAAA,GAAQ,CAAIA,OAAAA,EAAuB,KAAwB,KAAA;AACtE,EAAIA,IAAAA,OAAAA,KAAW,MAAaA,IAAAA,OAAAA,KAAW,IA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B,UACoB,KAAA;AACpB,EAAA,IAAI,eAAe,MAAW,EAAA;AAC5B,IAAM,MAAA,IAAI,MAAM,6CAA6C,CAAA;AAAA;AAG/D,EAAO,OAAA;AAAA,IACL,OAAuC,IAAmC,EAAA;AACxE,MAAO,OAAA,UAAA,CAAW,GAAG,IAAI,CAAA;AAAA;AAC3B,GACF;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"silentium.cjs","sources":["../src/Source/Source.ts","../src/Guest/Guest.ts","../src/Guest/GuestCast.ts","../src/Guest/GuestSync.ts","../src/Guest/GuestDisposable.ts","../src/Guest/GuestApplied.ts","../src/Guest/GuestExecutorApplied.ts","../src/Patron/Patron.ts","../src/Patron/PatronOnce.ts","../src/Patron/PatronPool.ts","../src/Patron/PatronApplied.ts","../src/Patron/PatronExecutorApplied.ts","../src/Source/SourceChangeable.ts","../src/Source/SourceAll.ts","../src/Source/SourceSequence.ts","../src/Source/SourceMap.ts","../src/Source/SourceRace.ts","../src/Source/SourceDynamic.ts","../src/Source/SourceApplied.ts","../src/Source/SourceExecutorApplied.ts","../src/Source/SourceFiltered.ts","../src/Source/SourceOnce.ts","../src/Source/SourceSync.ts","../src/Personal/PersonalClass.ts","../src/Personal/Personal.ts"],"sourcesContent":["import { give, GuestType } from \"../Guest/Guest\";\n\nexport type SourceExecutorType<T> = (guest: GuestType<T>) => unknown;\n\nexport interface SourceObjectType<T> {\n value: SourceExecutorType<T>;\n}\n\nexport type SourceDataType<T> = Extract<\n T,\n string | number | boolean | Date | object | Array<unknown> | symbol\n>;\n\nexport type SourceType<T = any> =\n | SourceExecutorType<T>\n | SourceObjectType<T>\n | SourceDataType<T>;\n\n/**\n * Helps to connect source and guest, if you need to get value in guest from source\n * helpful because we don't know what shape of source do we have, it can be function or object or primitive\n * @url https://silentium-lab.github.io/silentium/#/utils/value\n */\nexport const value = <T>(source: SourceType<T>, guest: GuestType<T>) => {\n if (source === undefined || source === null) {\n throw new Error(\"value didn't receive source argument\");\n }\n if (guest === undefined || source === null) {\n throw new Error(\"value didn't receive guest argument\");\n }\n if (typeof source === \"function\") {\n source(guest);\n } else if (\n typeof source === \"object\" &&\n \"value\" in source &&\n typeof source.value === \"function\"\n ) {\n source.value(guest);\n } else {\n give(source as T, guest);\n }\n\n return source;\n};\n\n/**\n * Helps to check what some information is of source shape\n * @url https://silentium-lab.github.io/silentium/#/utils/is-source\n */\nexport const isSource = <T>(\n mbSource: T | SourceType<T>,\n): mbSource is SourceType<T> => {\n if (\n mbSource !== null &&\n typeof mbSource === \"object\" &&\n \"value\" in mbSource &&\n typeof mbSource.value === \"function\"\n ) {\n return true;\n }\n return mbSource !== null && mbSource !== undefined;\n};\n\n/**\n * Represents source as function\n * @url https://silentium-lab.github.io/silentium/#/source\n */\nexport const source = <T>(source: SourceType<T>): SourceExecutorType<T> => {\n if (source === undefined) {\n throw new Error(\"Source constructor didn't receive executor function\");\n }\n\n return (guest: GuestType<T>) => {\n value(source, guest);\n };\n};\n","import { source, SourceExecutorType, SourceType } from \"../Source/Source\";\n\ntype GuestIntroduction = \"guest\" | \"patron\";\n\nexport type GuestExecutorType<T = any, This = void> = (value: T) => This;\n\nexport interface GuestObjectType<T = any> {\n give(value: T): this;\n introduction?(): GuestIntroduction;\n}\n\nexport type GuestType<T = any> = GuestExecutorType<T> | GuestObjectType<T>;\n\n/**\n * Helps to give data to guest, guests can be of different shapes\n * function guest or object guest\n * @url https://silentium-lab.github.io/silentium/#/utils/give\n */\nexport const give = <T>(\n data: T,\n guest?: GuestType<T>,\n): GuestType<T> | SourceExecutorType<T> => {\n if (data === undefined) {\n throw new Error(\"give didn't receive data argument\");\n }\n if (guest === undefined) {\n return source<T>(data as SourceType<T>) as SourceExecutorType<T>;\n }\n if (typeof guest === \"function\") {\n guest(data);\n } else {\n guest.give(data);\n }\n return guest;\n};\n\n/**\n * Helps to check if mbGuest can be used to retrieve value\n * @url https://silentium-lab.github.io/silentium/#/utils/is-guest\n */\nexport const 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 * Helps to create guest of object type\n * @url https://silentium-lab.github.io/silentium/#/guest\n */\nexport const guest = <T>(receiver: GuestExecutorType<T>) => {\n if (!receiver) {\n throw new Error(\"receiver function was not passed to Guest constructor\");\n }\n const result = {\n give(value: T) {\n receiver(value);\n return result;\n },\n };\n return result;\n};\n","import { give, GuestType } from \"./Guest\";\nimport { GuestDisposableType, MaybeDisposableType } from \"./GuestDisposable\";\n\n/**\n * Helps to inherit guest behavior, its introduction and dispose settings\n * @url https://silentium-lab.github.io/silentium/#/guest/guest-cast\n */\nexport const guestCast = <T>(\n sourceGuest: GuestType<any>,\n targetGuest: GuestType<T>,\n): GuestDisposableType<T> => {\n if (sourceGuest === undefined) {\n throw new Error(\"GuestCast didn't receive sourceGuest argument\");\n }\n if (targetGuest === undefined) {\n throw new Error(\"GuestCast didn't receive targetGuest argument\");\n }\n\n const result = {\n disposed(value: T | null): boolean {\n const maybeDisposable = sourceGuest as MaybeDisposableType;\n return maybeDisposable.disposed ? maybeDisposable.disposed(value) : false;\n },\n give(value: T) {\n give(value, targetGuest);\n return result;\n },\n introduction() {\n if (typeof sourceGuest === \"function\") {\n return \"guest\";\n }\n if (!sourceGuest.introduction) {\n return \"guest\";\n }\n return sourceGuest.introduction();\n },\n };\n\n return result;\n};\n","import { GuestObjectType } from \"./Guest\";\n\nexport interface GuestValueType<T = any> extends GuestObjectType<T> {\n value(): T;\n}\n\n/**\n * @url https://silentium-lab.github.io/silentium/#/guest/guest-sync\n */\nexport const guestSync = <T>(theValue?: T): GuestValueType<T> => {\n const result = {\n give(value: T) {\n theValue = value;\n return result;\n },\n value() {\n if (theValue === undefined) {\n throw new Error(\"no value in GuestSync!\");\n }\n return theValue;\n },\n };\n\n return result;\n};\n","import { give, 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 * Connects to guest logic what can tell PatronPool\n * what guest don't need to receive new values\n * @url https://silentium-lab.github.io/silentium/#/guest/guest-disposable\n */\nexport const guestDisposable = <T>(\n guest: GuestType,\n disposeCheck: (value: T | null) => boolean,\n): GuestDisposableType<T> => {\n if (guest === undefined) {\n throw new Error(\"GuestDisposable didn't receive guest argument\");\n }\n if (disposeCheck === undefined) {\n throw new Error(\"GuestDisposable didn't receive disposeCheck argument\");\n }\n\n const result = {\n disposed(value: T | null): boolean {\n return disposeCheck(value);\n },\n give(value: T) {\n give(value, guest);\n return result;\n },\n };\n\n return result;\n};\n","import { give, GuestObjectType, GuestType } from \"../Guest/Guest\";\n\n/**\n * Helps to apply function to value before baseGuest will receive it\n * @url https://silentium-lab.github.io/silentium/#/guest/guest-applied\n */\nexport const guestApplied = <T, R>(\n baseGuest: GuestType<R>,\n applier: (value: T) => R,\n): GuestObjectType<T> => {\n const result = {\n give(value: T) {\n give(applier(value), baseGuest);\n return result;\n },\n };\n return result;\n};\n","import {\n give,\n GuestExecutorType,\n GuestObjectType,\n GuestType,\n} from \"../Guest/Guest\";\n\n/**\n * Apply function to guest function of receiving value, useful for debouncing or throttling\n * @url https://silentium-lab.github.io/silentium/#/guest/guest-executor-applied\n */\nexport const guestExecutorApplied = <T>(\n baseGuest: GuestType<T>,\n applier: (executor: GuestExecutorType<T>) => GuestExecutorType<T>,\n): GuestObjectType<T> => {\n const result = {\n give: applier((v) => give(v, baseGuest)),\n };\n\n return result as GuestObjectType<T>;\n};\n","import { give, GuestType } from \"../Guest/Guest\";\nimport { GuestDisposableType } from \"../Guest/GuestDisposable\";\n\nexport type PatronType<T> = GuestDisposableType<T> & {\n introduction(): \"patron\";\n};\n\n/**\n * Helps to check what incoming object is patron\n * @url https://silentium-lab.github.io/silentium/#/utils/is-patron\n */\nexport const isPatron = (guest: GuestType): guest is PatronType<unknown> =>\n typeof guest === \"object\" &&\n guest !== null &&\n guest?.introduction?.() === \"patron\";\n\nexport const introduction = () => \"patron\" as const;\n\n/**\n * Help to turn existed guest intro patron\n * @url https://silentium-lab.github.io/silentium/#/patron\n */\nexport const patron = <T>(\n willBePatron: GuestType<T>,\n): GuestDisposableType<T> => {\n if (willBePatron === undefined) {\n throw new Error(\"Patron didn't receive willBePatron argument\");\n }\n\n const result = {\n give(value: T) {\n give(value, willBePatron);\n return result;\n },\n disposed(value: T | null): boolean {\n const maybeDisposable = willBePatron as GuestDisposableType;\n return maybeDisposable?.disposed?.(value) || false;\n },\n introduction,\n };\n\n return result;\n};\n","import { introduction } from \"../Patron/Patron\";\nimport { give, GuestType } from \"../Guest/Guest\";\nimport {\n GuestDisposableType,\n MaybeDisposableType,\n} from \"../Guest/GuestDisposable\";\n\n/**\n * Helps to call patron only once, this will be helpful when you\n * need value but you know what value can not be existed at a time of requesting\n * @url https://silentium-lab.github.io/silentium/#/patron/patron-once\n */\nexport const patronOnce = <T>(\n baseGuest: GuestType<T>,\n): GuestDisposableType<T> => {\n if (baseGuest === undefined) {\n throw new Error(\"PatronOnce didn't receive baseGuest argument\");\n }\n\n let received = false;\n\n const result = {\n give(value: T) {\n if (!received) {\n received = true;\n give(value, baseGuest);\n }\n return result;\n },\n disposed(value: T | null): boolean {\n if (received) {\n return true;\n }\n const maybeDisposable = baseGuest as MaybeDisposableType;\n return maybeDisposable.disposed ? maybeDisposable.disposed(value) : false;\n },\n introduction,\n };\n\n return result;\n};\n","import { source, SourceType } from \"../Source/Source\";\nimport { give, GuestObjectType, GuestType } from \"../Guest/Guest\";\nimport { GuestDisposableType } from \"../Guest/GuestDisposable\";\n\nconst poolSets = new Map<PoolType, Set<GuestObjectType>>();\nconst poolsOfInitiators = new Map<SourceType, PoolType>();\nconst subSources = new Map<SourceType, SourceType[]>();\n\nconst poolsChangeFns: (() => void)[] = [];\nconst notifyPoolsChange = () => {\n poolsChangeFns.forEach((fn) => fn());\n};\nconst lastPatronPoolsStatistic = {\n poolsCount: 0,\n patronsCount: 0,\n};\n/**\n * Helps to debug application and see is it have problems with frozen pools\n * @url https://silentium-lab.github.io/silentium/#/utils/patron-pools-statistic\n */\nexport const patronPoolsStatistic = source<{\n poolsCount: number;\n patronsCount: number;\n}>((g) => {\n give(lastPatronPoolsStatistic, g);\n poolsChangeFns.push(() => {\n let patronsCount = 0;\n poolSets.forEach((set) => {\n patronsCount += set.size;\n });\n lastPatronPoolsStatistic.poolsCount = poolSets.size;\n lastPatronPoolsStatistic.patronsCount = patronsCount;\n give(lastPatronPoolsStatistic, g);\n });\n});\n\n/**\n * Helps to connect source and subsource, needed to destroy all sub sources\n * when base source will be destroyed\n * @url https://silentium-lab.github.io/silentium/#/utils/sub-source\n */\nexport const subSource = (source: SourceType, subSource: SourceType) => {\n // sub sources can appear only on SourceObjectType\n if (source !== null && typeof source !== \"object\") {\n return;\n }\n\n if (!subSources.has(source)) {\n subSources.set(source, []);\n }\n\n subSources.get(source)?.push(subSource);\n};\n\n/**\n * Helps to define many sources of one sub source\n */\nexport const subSourceMany = (subSource: SourceType, sources: SourceType[]) => {\n sources.forEach((source) => {\n subSource(source, subSource);\n });\n};\n\n/**\n * Helps to remove all pools of related initiators\n * @url https://silentium-lab.github.io/silentium/#/utils/destroy\n */\nexport const destroy = (initiators: SourceType[]) => {\n initiators.forEach((initiator) => {\n const pool = poolsOfInitiators.get(initiator);\n pool?.destroy();\n const relatedInitiators = subSources.get(initiator);\n if (relatedInitiators) {\n destroy(relatedInitiators);\n }\n });\n};\n\n/**\n * Returns all pools related to one patron\n * @url https://silentium-lab.github.io/silentium/#/utils/patron-pools\n */\nexport const patronPools = (patron: GuestObjectType) => {\n const pools: PoolType[] = [];\n poolSets.forEach((pool, poolInstance) => {\n if (pool.has(patron)) {\n pools.push(poolInstance);\n }\n });\n return pools;\n};\n\n/**\n * Removes patron from all existed pools\n * @url https://silentium-lab.github.io/silentium/#/utils/remove-patron-from-pools\n */\nexport const removePatronFromPools = (patron: GuestObjectType) => {\n if (patron === undefined) {\n throw new Error(\"removePatronFromPools didn't receive patron argument\");\n }\n poolSets.forEach((pool) => {\n pool.delete(patron);\n });\n};\n\n/**\n * Checks what patron is connected with any pool\n * @url https://silentium-lab.github.io/silentium/#/utils/is-patron-in-pools\n */\nexport const isPatronInPools = (patron: GuestObjectType) => {\n if (patron === undefined) {\n throw new Error(\"isPatronInPools didn't 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 destroy(): void;\n}\n\n/**\n * Pool class helps to implement dispatching for patron about new values\n * what may appear in sources\n * @url https://silentium-lab.github.io/silentium/#/patron/patron-pool\n */\nexport class PatronPool<T> implements PoolType<T> {\n private patrons: Set<GuestObjectType<T>>;\n\n public give: (value: T) => this;\n\n public constructor(private initiator: SourceType) {\n this.patrons = new Set<GuestObjectType<T>>();\n poolSets.set(this, this.patrons);\n poolsOfInitiators.set(this.initiator, this);\n const doReceive = (value: T) => {\n this.patrons.forEach((target) => {\n this.sendValueToGuest(value, target);\n });\n };\n this.give = (value: T) => {\n doReceive(value);\n return this;\n };\n notifyPoolsChange();\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 notifyPoolsChange();\n return this;\n }\n\n public remove(patron: GuestObjectType<T>) {\n this.patrons.delete(patron);\n notifyPoolsChange();\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 public destroy() {\n this.patrons.forEach((patron) => {\n this.remove(patron);\n });\n poolSets.delete(this);\n poolsOfInitiators.delete(this.initiator);\n notifyPoolsChange();\n return this;\n }\n\n private sendValueToGuest(value: T, guest: GuestType<T>) {\n const isDisposed = this.guestDisposed(value, guest);\n if (!isDisposed) {\n give(value, guest);\n }\n return this;\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 return false;\n }\n}\n","import { introduction } from \"../Patron/Patron\";\nimport { GuestObjectType, GuestType } from \"../Guest/Guest\";\nimport { guestApplied } from \"../Guest/GuestApplied\";\n\n/**\n * Helps to apply function to patron\n * @url https://silentium-lab.github.io/silentium/#/patron/patron-applied\n */\nexport const patronApplied = <T, R>(\n baseGuest: GuestType<R>,\n applier: (value: T) => R,\n): GuestObjectType<T> => {\n const applied = guestApplied(baseGuest, applier);\n\n const result = {\n give(value: T) {\n applied.give(value);\n return result;\n },\n introduction,\n };\n\n return result;\n};\n","import { introduction } from \"../Patron/Patron\";\nimport { GuestExecutorType, GuestType } from \"../Guest/Guest\";\nimport { guestExecutorApplied } from \"../Guest/GuestExecutorApplied\";\n\n/**\n * Helps to apply function to patrons executor\n * @url https://silentium-lab.github.io/silentium/#/patron/patron-executor-applied\n */\nexport const patronExecutorApplied = <T>(\n baseGuest: GuestType<T>,\n applier: (executor: GuestExecutorType) => GuestExecutorType,\n) => {\n const guestApplied = guestExecutorApplied(baseGuest, applier);\n\n const result = {\n give(value: T) {\n guestApplied.give(value);\n return result;\n },\n introduction,\n };\n\n return result;\n};\n","import { guest, GuestObjectType, GuestType } from \"../Guest/Guest\";\nimport { isPatron } from \"../Patron/Patron\";\nimport { patronOnce } from \"../Patron/PatronOnce\";\nimport { PatronPool } from \"../Patron/PatronPool\";\nimport {\n isSource,\n SourceDataType,\n SourceObjectType,\n SourceType,\n value,\n} from \"./Source\";\n\nexport type SourceChangeableType<T = any> = SourceObjectType<T> &\n GuestObjectType<T>;\n\n/**\n * Ability to create source what can be changed later\n * @url https://silentium-lab.github.io/silentium/#/source/source-changeable\n */\nexport const sourceChangeable = <T>(source?: SourceType<T>) => {\n const createdSource = {} as SourceChangeableType<T>;\n const thePool = new PatronPool(createdSource);\n let isEmpty = source === undefined;\n\n if (source !== undefined && isSource(source)) {\n value(\n source,\n patronOnce((unwrappedSourceDocument) => {\n isEmpty = unwrappedSourceDocument === undefined;\n source = unwrappedSourceDocument as SourceDataType<T>;\n }),\n );\n } else {\n isEmpty = source === undefined;\n }\n\n createdSource.value = (g: GuestType<T>) => {\n if (isEmpty) {\n if (isPatron(g)) {\n thePool.add(g);\n }\n return createdSource;\n }\n\n if (typeof g === \"function\") {\n thePool.distribute(source, guest(g));\n } else {\n thePool.distribute(source, g);\n }\n\n return createdSource;\n };\n\n createdSource.give = (value: T) => {\n isEmpty = false;\n source = value as SourceDataType<T>;\n thePool.give(source);\n return createdSource;\n };\n\n return createdSource as SourceChangeableType<T>;\n};\n","import { subSource } from \"../Patron/PatronPool\";\nimport { give, guest, GuestType } from \"../Guest/Guest\";\nimport { guestCast } from \"../Guest/GuestCast\";\nimport { patron } from \"../Patron/Patron\";\nimport { SourceType, value } from \"./Source\";\nimport { sourceChangeable } from \"./SourceChangeable\";\n\n/**\n * Represents common value as Record or Array of bunch of sources,\n * when all sources will gets it's values\n * @url https://silentium-lab.github.io/silentium/#/source/source-all\n */\nexport const sourceAll = <T>(\n sources: SourceType<any>[] | Record<string, SourceType<any>>,\n) => {\n const keysKnown = new Set<string>(Object.keys(sources));\n const keysFilled = new Set();\n const isAllFilled = () => {\n return keysFilled.size > 0 && keysFilled.size === keysKnown.size;\n };\n const isSourcesArray = Array.isArray(sources);\n const theAll = sourceChangeable<Record<string, unknown>>({});\n\n Object.entries(sources).forEach(([key, source]) => {\n subSource(source, theAll);\n keysKnown.add(key);\n value(\n source,\n patron((v) => {\n theAll.value(\n guest((all: Record<string, unknown>) => {\n keysFilled.add(key);\n const lastAll = {\n ...all,\n [key]: v,\n };\n theAll.give(lastAll);\n }),\n );\n }),\n );\n });\n\n return (guest: GuestType<T>) => {\n value((g) => {\n theAll.value(\n guestCast(g, (value) => {\n if (isAllFilled()) {\n give((isSourcesArray ? Object.values(value) : value) as T, g);\n }\n }),\n );\n }, guest);\n };\n};\n","import { give, GuestType } from \"../Guest/Guest\";\nimport { guestCast } from \"../Guest/GuestCast\";\nimport { patronOnce } from \"../Patron/PatronOnce\";\nimport { PersonalType } from \"../Personal/Personal\";\nimport { isSource, SourceType, value } from \"./Source\";\nimport { sourceAll } from \"./SourceAll\";\nimport { sourceChangeable, SourceChangeableType } from \"./SourceChangeable\";\n\n/**\n * Ability to apply source to source of array values sequentially\n * @url https://silentium-lab.github.io/silentium/#/source/source-sequence\n */\nexport const sourceSequence = <T, TG>(\n baseSource: SourceType<T[]>,\n targetSource: PersonalType<SourceType<TG>>,\n) => {\n if (baseSource === undefined) {\n throw new Error(\"SourceSequence didn't receive baseSource argument\");\n }\n if (targetSource === undefined) {\n throw new Error(\"SourceSequence didn't receive targetSource argument\");\n }\n\n return (guest: GuestType<TG[]>) => {\n const sequenceSource = sourceChangeable();\n const source = targetSource.get(sequenceSource);\n\n value(\n baseSource,\n guestCast(guest, (theValue) => {\n let index = 0;\n\n const sources: SourceChangeableType[] = [];\n theValue.forEach(() => {\n sources.push(sourceChangeable());\n });\n\n const nextItemHandle = () => {\n if (theValue[index + 1] !== undefined) {\n index = index + 1;\n handle();\n }\n };\n\n function handle() {\n const currentSource = sources[index];\n const nextValue = theValue[index];\n if (isSource(nextValue)) {\n value(\n nextValue,\n patronOnce((theNextValue) => {\n sequenceSource.give(theNextValue);\n value(source, currentSource);\n nextItemHandle();\n }),\n );\n } else {\n sequenceSource.give(nextValue);\n value(source, currentSource);\n nextItemHandle();\n }\n }\n\n if (theValue[index] !== undefined) {\n handle();\n value(sourceAll(sources), guest);\n } else {\n give([], guest);\n }\n }),\n );\n };\n};\n","import { GuestType } from \"../Guest/Guest\";\nimport { guestCast } from \"../Guest/GuestCast\";\nimport { PersonalType } from \"../Personal/Personal\";\nimport { SourceType, value } from \"./Source\";\nimport { sourceAll } from \"./SourceAll\";\n\n/**\n * Helps to modify many sources with one private source\n * @url https://silentium-lab.github.io/silentium/#/source/source-map\n */\nexport const sourceMap = <T, TG>(\n baseSource: SourceType<T[]>,\n targetSource: PersonalType<SourceType<TG>>,\n) => {\n if (baseSource === undefined) {\n throw new Error(\"SourceMap didn't receive baseSource argument\");\n }\n if (targetSource === undefined) {\n throw new Error(\"SourceMap didn't receive targetSource argument\");\n }\n\n return (guest: GuestType<TG[]>) => {\n value(\n baseSource,\n guestCast(<GuestType>guest, (theValue) => {\n const sources: SourceType[] = [];\n theValue.forEach((val) => {\n const source = targetSource.get(val);\n sources.push(source);\n });\n value(sourceAll(sources), guest);\n }),\n );\n return this;\n };\n};\n","import { give, GuestType } from \"../Guest/Guest\";\nimport { guestCast } from \"../Guest/GuestCast\";\nimport { SourceType, value } from \"./Source\";\n\n/**\n * Connects guest with source what give response faster than others\n * @url https://silentium-lab.github.io/silentium/#/source/source-race\n */\nexport const sourceRace = <T>(sources: SourceType<T>[]) => {\n if (sources === undefined) {\n throw new Error(\"SourceRace didnt receive sources argument\");\n }\n\n return (guest: GuestType<T>) => {\n let connectedWithSource: SourceType | null = null;\n sources.forEach((source) => {\n value(\n source,\n guestCast(<GuestType>guest, (value) => {\n if (!connectedWithSource || connectedWithSource === source) {\n give(value as T, guest);\n connectedWithSource = source;\n }\n }),\n );\n });\n };\n};\n","import { give, GuestType } from \"../Guest/Guest\";\nimport { SourceType, value } from \"./Source\";\nimport { SourceChangeableType } from \"./SourceChangeable\";\n\n/**\n * Ability to build common changeable source from different guest and source\n * @url https://silentium-lab.github.io/silentium/#/source/source-dynamic\n */\nexport const sourceDynamic = <T>(\n baseGuest: GuestType<T>,\n baseSource: SourceType<T>,\n): SourceChangeableType<T> => {\n if (baseGuest === undefined) {\n throw new Error(\"SourceDynamic didn't receive baseGuest argument\");\n }\n if (baseSource === undefined) {\n throw new Error(\"SourceDynamic didn't receive baseSource argument\");\n }\n\n const sourceObject = {\n value(guest: GuestType<T>) {\n value(baseSource, guest);\n return sourceObject;\n },\n give(value: T) {\n give(value, baseGuest);\n return this;\n },\n };\n\n return sourceObject;\n};\n","import { give, GuestType } from \"../Guest/Guest\";\nimport { guestCast } from \"../Guest/GuestCast\";\nimport { SourceType, value } from \"../Source/Source\";\n\n/**\n * Gives ability to apply function to source value\n * @url https://silentium-lab.github.io/silentium/#/source/source-applied\n */\nexport const sourceApplied = <T, R>(\n baseSource: SourceType<T>,\n applier: (v: T) => R,\n) => {\n return (guest: GuestType<R>) => {\n value(\n baseSource,\n guestCast(guest, (v) => {\n give(applier(v), guest);\n }),\n );\n };\n};\n","import { SourceExecutorType, SourceType, value } from \"../Source/Source\";\n\n/**\n * Ability to apply function to source executor, helpful when need to apply throttling or debounce\n * @url https://silentium-lab.github.io/silentium/#/source/source-executor-applied\n */\nexport const sourceExecutorApplied = <T>(\n source: SourceType<T>,\n applier: (executor: SourceExecutorType<T>) => SourceExecutorType<T>,\n) => {\n return applier((g) => {\n value(source, g);\n });\n};\n","import { give, GuestType } from \"../Guest/Guest\";\nimport { guestCast } from \"../Guest/GuestCast\";\nimport { SourceType, value } from \"../Source/Source\";\n\n/**\n * Helps not to respond with information what checked by predicate function\n * @url https://silentium-lab.github.io/silentium/#/source/source-filtered\n */\nexport const sourceFiltered = <T>(\n baseSource: SourceType<T>,\n predicate: (v: T) => boolean,\n) => {\n return (g: GuestType<T>) => {\n value(\n baseSource,\n guestCast(g, (v) => {\n if (predicate(v) === true) {\n give(v, g);\n }\n }),\n );\n };\n};\n","import { GuestType } from \"../Guest/Guest\";\nimport { SourceType, value } from \"./Source\";\nimport { sourceChangeable } from \"./SourceChangeable\";\n\n/**\n * Ability set the value only once\n * @url https://silentium-lab.github.io/silentium/#/source/source-once\n */\nexport const sourceOnce = <T>(initialValue?: SourceType<T>) => {\n let isFilled = initialValue !== undefined;\n const source = sourceChangeable(initialValue);\n\n return {\n value(guest: GuestType<T>) {\n value(source, guest);\n return this;\n },\n give(value: T) {\n if (!isFilled) {\n source.give(value);\n isFilled = true;\n }\n return this;\n },\n };\n};\n","import { GuestType } from \"../Guest/Guest\";\nimport { guestSync } from \"../Guest/GuestSync\";\nimport { patron } from \"../Patron/Patron\";\nimport { SourceObjectType, SourceType, value } from \"../Source/Source\";\n\n/**\n * Helps to represent source value as sync value, what can be returned\n * useful for example in tests\n * @url https://silentium-lab.github.io/silentium/#/source/source-sync\n */\nexport const sourceSync = <T>(\n baseSource: SourceType<T>,\n): SourceObjectType<T> & { syncValue(): T } => {\n const syncGuest = guestSync<T>();\n value(baseSource, patron(syncGuest));\n\n return {\n value(guest: GuestType<T>) {\n value(baseSource, guest);\n return this;\n },\n syncValue() {\n try {\n return syncGuest.value() as T;\n } catch {\n throw new Error(\"No value in SourceSync\");\n }\n },\n };\n};\n","import { PersonalType } from \"./Personal\";\n\ninterface Constructable<T> {\n new (...args: unknown[]): T;\n}\n\ninterface Prototyped<T> {\n prototype: T;\n}\n\nexport const personalClass = <T>(\n constructorFn: Prototyped<T>,\n modules: Record<string, unknown> = {},\n): PersonalType<T> => {\n if (constructorFn === undefined) {\n throw new Error(\"PrivateClass didn't receive constructorFn argument\");\n }\n\n return {\n get<R extends unknown[], CT = null>(...args: R): CT extends null ? T : CT {\n return new (constructorFn as Constructable<T>)(\n ...args,\n modules,\n ) as CT extends null ? T : CT;\n },\n };\n};\n","export interface PersonalType<T> {\n get<R extends unknown[], CT = null>(...args: R): CT extends null ? T : CT;\n}\n\n/**\n * Helps to get personal instance of dependency\n * @url https://silentium-lab.github.io/silentium/#/utils/private\n */\nexport const personal = <T>(\n buildingFn: (...args: any[]) => T,\n): PersonalType<T> => {\n if (buildingFn === undefined) {\n throw new Error(\"personal didn't receive buildingFn argument\");\n }\n\n return {\n get<R extends unknown[], CT = null>(...args: R): CT extends null ? T : CT {\n return buildingFn(...args) as CT extends null ? T : CT;\n },\n };\n};\n"],"names":["source","guest","subSource","value"],"mappings":";;AAuBa,MAAA,KAAA,GAAQ,CAAIA,OAAAA,EAAuB,KAAwB,KAAA;AACtE,EAAIA,IAAAA,OAAAA,KAAW,MAAaA,IAAAA,OAAAA,KAAW,IAAM,EAAA;AAC3C,IAAM,MAAA,IAAI,MAAM,sCAAsC,CAAA;AAAA;AAExD,EAAI,IAAA,KAAA,KAAU,MAAaA,IAAAA,OAAAA,KAAW,IAAM,EAAA;AAC1C,IAAM,MAAA,IAAI,MAAM,qCAAqC,CAAA;AAAA;AAEvD,EAAI,IAAA,OAAOA,YAAW,UAAY,EAAA;AAChC,IAAAA,QAAO,KAAK,CAAA;AAAA,GACd,MAAA,IACE,OAAOA,OAAW,KAAA,QAAA,IAClB,WAAWA,OACX,IAAA,OAAOA,OAAO,CAAA,KAAA,KAAU,UACxB,EAAA;AACA,IAAAA,OAAAA,CAAO,MAAM,KAAK,CAAA;AAAA,GACb,MAAA;AACL,IAAA,IAAA,CAAKA,SAAa,KAAK,CAAA;AAAA;AAGzB,EAAOA,OAAAA,OAAAA;AACT;AAMa,MAAA,QAAA,GAAW,CACtB,QAC8B,KAAA;AAC9B,EACE,IAAA,QAAA,KAAa,IACb,IAAA,OAAO,QAAa,KAAA,QAAA,IACpB,WAAW,QACX,IAAA,OAAO,QAAS,CAAA,KAAA,KAAU,UAC1B,EAAA;AACA,IAAO,OAAA,IAAA;AAAA;AAET,EAAO,OAAA,QAAA,KAAa,QAAQ,QAAa,KAAA,MAAA;AAC3C;AAMa,MAAA,MAAA,GAAS,CAAIA,OAAiD,KAAA;AACzE,EAAA,IAAIA,YAAW,MAAW,EAAA;AACxB,IAAM,MAAA,IAAI,MAAM,qDAAqD,CAAA;AAAA;AAGvE,EAAA,OAAO,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A;AAAA,IACL,MAAM,KAAqB,EAAA;AACzB,MAAA,KAAA,CAAM,YAAY,KAAK,CAAA;AACvB,MAAO,OAAA,IAAA;AAAA,KACT;AAAA,IACA,SAAY,GAAA;AACV,MAAI,IAAA;AACF,QAAA,OAAO,UAAU,KAAM,EAAA;AAAA,OACjB,CAAA,MAAA;AACN,QAAM,MAAA,IAAI,MAAM,wBAAwB,CAAA;AAAA;AAC1C;AACF,GACF;AACF;;ACnBO,MAAM,aAAgB,GAAA,CAC3B,aACA,EAAA,OAAA,GAAmC,EACf,KAAA;AACpB,EAAA,IAAI,kBAAkB,MAAW,EAAA;AAC/B,IAAM,MAAA,IAAI,MAAM,oDAAoD,CAAA;AAAA;AAGtE,EAAO,OAAA;AAAA,IACL,OAAuC,IAAmC,EAAA;AACxE,MAAA,OAAO,IAAK,aAAA;AAAA,QACV,GAAG,IAAA;AAAA,QACH;AAAA,OACF;AAAA;AACF,GACF;AACF;;AClBa,MAAA,QAAA,GAAW,CACtB,UACoB,KAAA;AACpB,EAAA,IAAI,eAAe,MAAW,EAAA;AAC5B,IAAM,MAAA,IAAI,MAAM,6CAA6C,CAAA;AAAA;AAG/D,EAAO,OAAA;AAAA,IACL,OAAuC,IAAmC,EAAA;AACxE,MAAO,OAAA,UAAA,CAAW,GAAG,IAAI,CAAA;AAAA;AAC3B,GACF;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/silentium.d.ts
CHANGED
|
@@ -106,11 +106,29 @@ declare const patron: <T>(willBePatron: GuestType<T>) => GuestDisposableType<T>;
|
|
|
106
106
|
*/
|
|
107
107
|
declare const patronOnce: <T>(baseGuest: GuestType<T>) => GuestDisposableType<T>;
|
|
108
108
|
|
|
109
|
+
/**
|
|
110
|
+
* Helps to debug application and see is it have problems with frozen pools
|
|
111
|
+
* @url https://silentium-lab.github.io/silentium/#/utils/patron-pools-statistic
|
|
112
|
+
*/
|
|
113
|
+
declare const patronPoolsStatistic: SourceExecutorType<{
|
|
114
|
+
poolsCount: number;
|
|
115
|
+
patronsCount: number;
|
|
116
|
+
}>;
|
|
117
|
+
/**
|
|
118
|
+
* Helps to connect source and subsource, needed to destroy all sub sources
|
|
119
|
+
* when base source will be destroyed
|
|
120
|
+
* @url https://silentium-lab.github.io/silentium/#/utils/sub-source
|
|
121
|
+
*/
|
|
122
|
+
declare const subSource: (source: SourceType, subSource: SourceType) => void;
|
|
123
|
+
/**
|
|
124
|
+
* Helps to define many sources of one sub source
|
|
125
|
+
*/
|
|
126
|
+
declare const subSourceMany: (subSource: SourceType, sources: SourceType[]) => void;
|
|
109
127
|
/**
|
|
110
128
|
* Helps to remove all pools of related initiators
|
|
111
129
|
* @url https://silentium-lab.github.io/silentium/#/utils/destroy
|
|
112
130
|
*/
|
|
113
|
-
declare const destroy: (initiators:
|
|
131
|
+
declare const destroy: (initiators: SourceType[]) => void;
|
|
114
132
|
/**
|
|
115
133
|
* Returns all pools related to one patron
|
|
116
134
|
* @url https://silentium-lab.github.io/silentium/#/utils/patron-pools
|
|
@@ -142,12 +160,12 @@ declare class PatronPool<T> implements PoolType<T> {
|
|
|
142
160
|
private initiator;
|
|
143
161
|
private patrons;
|
|
144
162
|
give: (value: T) => this;
|
|
145
|
-
constructor(initiator:
|
|
163
|
+
constructor(initiator: SourceType);
|
|
146
164
|
size(): number;
|
|
147
165
|
add(shouldBePatron: GuestType<T>): this;
|
|
148
166
|
remove(patron: GuestObjectType<T>): this;
|
|
149
167
|
distribute(receiving: T, possiblePatron: GuestType<T>): this;
|
|
150
|
-
destroy():
|
|
168
|
+
destroy(): this;
|
|
151
169
|
private sendValueToGuest;
|
|
152
170
|
private guestDisposed;
|
|
153
171
|
}
|
|
@@ -255,4 +273,4 @@ interface Prototyped<T> {
|
|
|
255
273
|
}
|
|
256
274
|
declare const personalClass: <T>(constructorFn: Prototyped<T>, modules?: Record<string, unknown>) => PersonalType<T>;
|
|
257
275
|
|
|
258
|
-
export { type GuestDisposableType, type GuestExecutorType, type GuestObjectType, type GuestType, type GuestValueType, type MaybeDisposableType, PatronPool, type PatronType, type PersonalType, type PoolType, type SourceChangeableType, type SourceDataType, type SourceExecutorType, type SourceObjectType, type SourceType, destroy, give, guest, guestApplied, guestCast, guestDisposable, guestExecutorApplied, guestSync, introduction, isGuest, isPatron, isPatronInPools, isSource, patron, patronApplied, patronExecutorApplied, patronOnce, patronPools, personal, personalClass, removePatronFromPools, source, sourceAll, sourceApplied, sourceChangeable, sourceDynamic, sourceExecutorApplied, sourceFiltered, sourceMap, sourceOnce, sourceRace, sourceSequence, sourceSync, value };
|
|
276
|
+
export { type GuestDisposableType, type GuestExecutorType, type GuestObjectType, type GuestType, type GuestValueType, type MaybeDisposableType, PatronPool, type PatronType, type PersonalType, type PoolType, type SourceChangeableType, type SourceDataType, type SourceExecutorType, type SourceObjectType, type SourceType, destroy, give, guest, guestApplied, guestCast, guestDisposable, guestExecutorApplied, guestSync, introduction, isGuest, isPatron, isPatronInPools, isSource, patron, patronApplied, patronExecutorApplied, patronOnce, patronPools, patronPoolsStatistic, personal, personalClass, removePatronFromPools, source, sourceAll, sourceApplied, sourceChangeable, sourceDynamic, sourceExecutorApplied, sourceFiltered, sourceMap, sourceOnce, sourceRace, sourceSequence, sourceSync, subSource, subSourceMany, value };
|
package/dist/silentium.js
CHANGED
|
@@ -193,10 +193,49 @@ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { en
|
|
|
193
193
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
194
194
|
const poolSets = /* @__PURE__ */ new Map();
|
|
195
195
|
const poolsOfInitiators = /* @__PURE__ */ new Map();
|
|
196
|
+
const subSources = /* @__PURE__ */ new Map();
|
|
197
|
+
const poolsChangeFns = [];
|
|
198
|
+
const notifyPoolsChange = () => {
|
|
199
|
+
poolsChangeFns.forEach((fn) => fn());
|
|
200
|
+
};
|
|
201
|
+
const lastPatronPoolsStatistic = {
|
|
202
|
+
poolsCount: 0,
|
|
203
|
+
patronsCount: 0
|
|
204
|
+
};
|
|
205
|
+
const patronPoolsStatistic = source((g) => {
|
|
206
|
+
give(lastPatronPoolsStatistic, g);
|
|
207
|
+
poolsChangeFns.push(() => {
|
|
208
|
+
let patronsCount = 0;
|
|
209
|
+
poolSets.forEach((set) => {
|
|
210
|
+
patronsCount += set.size;
|
|
211
|
+
});
|
|
212
|
+
lastPatronPoolsStatistic.poolsCount = poolSets.size;
|
|
213
|
+
lastPatronPoolsStatistic.patronsCount = patronsCount;
|
|
214
|
+
give(lastPatronPoolsStatistic, g);
|
|
215
|
+
});
|
|
216
|
+
});
|
|
217
|
+
const subSource = (source2, subSource2) => {
|
|
218
|
+
if (source2 !== null && typeof source2 !== "object") {
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
if (!subSources.has(source2)) {
|
|
222
|
+
subSources.set(source2, []);
|
|
223
|
+
}
|
|
224
|
+
subSources.get(source2)?.push(subSource2);
|
|
225
|
+
};
|
|
226
|
+
const subSourceMany = (subSource2, sources) => {
|
|
227
|
+
sources.forEach((source2) => {
|
|
228
|
+
subSource2(source2, subSource2);
|
|
229
|
+
});
|
|
230
|
+
};
|
|
196
231
|
const destroy = (initiators) => {
|
|
197
232
|
initiators.forEach((initiator) => {
|
|
198
233
|
const pool = poolsOfInitiators.get(initiator);
|
|
199
234
|
pool?.destroy();
|
|
235
|
+
const relatedInitiators = subSources.get(initiator);
|
|
236
|
+
if (relatedInitiators) {
|
|
237
|
+
destroy(relatedInitiators);
|
|
238
|
+
}
|
|
200
239
|
});
|
|
201
240
|
};
|
|
202
241
|
const patronPools = (patron) => {
|
|
@@ -210,7 +249,7 @@ const patronPools = (patron) => {
|
|
|
210
249
|
};
|
|
211
250
|
const removePatronFromPools = (patron) => {
|
|
212
251
|
if (patron === void 0) {
|
|
213
|
-
throw new Error("removePatronFromPools
|
|
252
|
+
throw new Error("removePatronFromPools didn't receive patron argument");
|
|
214
253
|
}
|
|
215
254
|
poolSets.forEach((pool) => {
|
|
216
255
|
pool.delete(patron);
|
|
@@ -218,7 +257,7 @@ const removePatronFromPools = (patron) => {
|
|
|
218
257
|
};
|
|
219
258
|
const isPatronInPools = (patron) => {
|
|
220
259
|
if (patron === void 0) {
|
|
221
|
-
throw new Error("isPatronInPools
|
|
260
|
+
throw new Error("isPatronInPools didn't receive patron argument");
|
|
222
261
|
}
|
|
223
262
|
let inPool = false;
|
|
224
263
|
poolSets.forEach((pool) => {
|
|
@@ -245,6 +284,7 @@ class PatronPool {
|
|
|
245
284
|
doReceive(value);
|
|
246
285
|
return this;
|
|
247
286
|
};
|
|
287
|
+
notifyPoolsChange();
|
|
248
288
|
}
|
|
249
289
|
size() {
|
|
250
290
|
return this.patrons.size;
|
|
@@ -256,10 +296,12 @@ class PatronPool {
|
|
|
256
296
|
if (typeof shouldBePatron !== "function" && shouldBePatron.introduction && shouldBePatron.introduction() === "patron") {
|
|
257
297
|
this.patrons.add(shouldBePatron);
|
|
258
298
|
}
|
|
299
|
+
notifyPoolsChange();
|
|
259
300
|
return this;
|
|
260
301
|
}
|
|
261
302
|
remove(patron) {
|
|
262
303
|
this.patrons.delete(patron);
|
|
304
|
+
notifyPoolsChange();
|
|
263
305
|
return this;
|
|
264
306
|
}
|
|
265
307
|
distribute(receiving, possiblePatron) {
|
|
@@ -273,12 +315,15 @@ class PatronPool {
|
|
|
273
315
|
});
|
|
274
316
|
poolSets.delete(this);
|
|
275
317
|
poolsOfInitiators.delete(this.initiator);
|
|
318
|
+
notifyPoolsChange();
|
|
319
|
+
return this;
|
|
276
320
|
}
|
|
277
321
|
sendValueToGuest(value, guest) {
|
|
278
322
|
const isDisposed = this.guestDisposed(value, guest);
|
|
279
323
|
if (!isDisposed) {
|
|
280
324
|
give(value, guest);
|
|
281
325
|
}
|
|
326
|
+
return this;
|
|
282
327
|
}
|
|
283
328
|
guestDisposed(value, guest) {
|
|
284
329
|
if (guest.disposed?.(value)) {
|
|
@@ -316,7 +361,6 @@ const patronExecutorApplied = (baseGuest, applier) => {
|
|
|
316
361
|
const sourceChangeable = (source) => {
|
|
317
362
|
const createdSource = {};
|
|
318
363
|
const thePool = new PatronPool(createdSource);
|
|
319
|
-
const theEmptyPool = new PatronPool(createdSource);
|
|
320
364
|
let isEmpty = source === void 0;
|
|
321
365
|
if (source !== void 0 && isSource(source)) {
|
|
322
366
|
value(
|
|
@@ -332,7 +376,7 @@ const sourceChangeable = (source) => {
|
|
|
332
376
|
createdSource.value = (g) => {
|
|
333
377
|
if (isEmpty) {
|
|
334
378
|
if (isPatron(g)) {
|
|
335
|
-
|
|
379
|
+
thePool.add(g);
|
|
336
380
|
}
|
|
337
381
|
return createdSource;
|
|
338
382
|
}
|
|
@@ -347,7 +391,6 @@ const sourceChangeable = (source) => {
|
|
|
347
391
|
isEmpty = false;
|
|
348
392
|
source = value2;
|
|
349
393
|
thePool.give(source);
|
|
350
|
-
theEmptyPool.give(source);
|
|
351
394
|
return createdSource;
|
|
352
395
|
};
|
|
353
396
|
return createdSource;
|
|
@@ -362,6 +405,7 @@ const sourceAll = (sources) => {
|
|
|
362
405
|
const isSourcesArray = Array.isArray(sources);
|
|
363
406
|
const theAll = sourceChangeable({});
|
|
364
407
|
Object.entries(sources).forEach(([key, source]) => {
|
|
408
|
+
subSource(source, theAll);
|
|
365
409
|
keysKnown.add(key);
|
|
366
410
|
value(
|
|
367
411
|
source,
|
|
@@ -599,5 +643,5 @@ const personal = (buildingFn) => {
|
|
|
599
643
|
};
|
|
600
644
|
};
|
|
601
645
|
|
|
602
|
-
export { PatronPool, destroy, give, guest, guestApplied, guestCast, guestDisposable, guestExecutorApplied, guestSync, introduction, isGuest, isPatron, isPatronInPools, isSource, patron, patronApplied, patronExecutorApplied, patronOnce, patronPools, personal, personalClass, removePatronFromPools, source, sourceAll, sourceApplied, sourceChangeable, sourceDynamic, sourceExecutorApplied, sourceFiltered, sourceMap, sourceOnce, sourceRace, sourceSequence, sourceSync, value };
|
|
646
|
+
export { PatronPool, destroy, give, guest, guestApplied, guestCast, guestDisposable, guestExecutorApplied, guestSync, introduction, isGuest, isPatron, isPatronInPools, isSource, patron, patronApplied, patronExecutorApplied, patronOnce, patronPools, patronPoolsStatistic, personal, personalClass, removePatronFromPools, source, sourceAll, sourceApplied, sourceChangeable, sourceDynamic, sourceExecutorApplied, sourceFiltered, sourceMap, sourceOnce, sourceRace, sourceSequence, sourceSync, subSource, subSourceMany, value };
|
|
603
647
|
//# sourceMappingURL=silentium.js.map
|