patron-oop 1.34.0 → 1.35.0

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
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.35.0](https://github.com/kosukhin/patron/compare/v1.34.0...v1.35.0) (2025-01-11)
6
+
7
+
8
+ ### Features
9
+
10
+ * **16-rename-guestcast-to-guestawareall:** rename guestchain to guestawareall ([debb920](https://github.com/kosukhin/patron/commit/debb920f45c4dfe4d4db2dfd05b84a134398a64c))
11
+
5
12
  ## [1.34.0](https://github.com/kosukhin/patron/compare/v1.33.0...v1.34.0) (2025-01-11)
6
13
 
7
14
 
package/dist/patron.cjs CHANGED
@@ -238,65 +238,65 @@ class GuestPool {
238
238
  var __defProp$3 = Object.defineProperty;
239
239
  var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
240
240
  var __publicField$3 = (obj, key, value) => __defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
241
- class GuestChain {
241
+ class GuestAwareAll {
242
242
  constructor() {
243
- __publicField$3(this, "theChain");
243
+ __publicField$3(this, "theAll");
244
244
  __publicField$3(this, "keysKnown", /* @__PURE__ */ new Set());
245
245
  __publicField$3(this, "keysFilled", /* @__PURE__ */ new Set());
246
- __publicField$3(this, "filledChainPool", new GuestPool(this));
247
- this.theChain = new Source({});
246
+ __publicField$3(this, "filledAllPool", new GuestPool(this));
247
+ this.theAll = new Source({});
248
248
  }
249
- resultArray(guest) {
249
+ valueArray(guest) {
250
250
  const guestObject = new GuestObject(guest);
251
- this.filledChainPool.add(
251
+ this.filledAllPool.add(
252
252
  new GuestCast(guestObject, (value) => {
253
253
  guestObject.give(Object.values(value));
254
254
  })
255
255
  );
256
- if (this.isChainFilled()) {
257
- this.theChain.value(
258
- new Guest((chain) => {
259
- this.filledChainPool.give(Object.values(chain));
256
+ if (this.isAllFilled()) {
257
+ this.theAll.value(
258
+ new Guest((all) => {
259
+ this.filledAllPool.give(Object.values(all));
260
260
  })
261
261
  );
262
262
  }
263
263
  return this;
264
264
  }
265
- result(guest) {
265
+ value(guest) {
266
266
  const guestObject = new GuestObject(guest);
267
- if (this.isChainFilled()) {
268
- this.filledChainPool.add(guestObject);
269
- this.theChain.value(
270
- new Guest((chain) => {
271
- this.filledChainPool.give(chain);
267
+ if (this.isAllFilled()) {
268
+ this.filledAllPool.add(guestObject);
269
+ this.theAll.value(
270
+ new Guest((all) => {
271
+ this.filledAllPool.give(all);
272
272
  })
273
273
  );
274
274
  } else {
275
- this.filledChainPool.add(guestObject);
275
+ this.filledAllPool.add(guestObject);
276
276
  }
277
277
  return this;
278
278
  }
279
- receiveKey(key) {
279
+ guestKey(key) {
280
280
  this.keysKnown.add(key);
281
281
  return new Guest((value) => {
282
282
  queueMicrotask(() => {
283
- this.theChain.value(
284
- new Guest((chain) => {
283
+ this.theAll.value(
284
+ new Guest((all) => {
285
285
  this.keysFilled.add(key);
286
- const lastChain = {
287
- ...chain,
286
+ const lastAll = {
287
+ ...all,
288
288
  [key]: value
289
289
  };
290
- this.theChain.give(lastChain);
291
- if (this.isChainFilled()) {
292
- this.filledChainPool.give(lastChain);
290
+ this.theAll.give(lastAll);
291
+ if (this.isAllFilled()) {
292
+ this.filledAllPool.give(lastAll);
293
293
  }
294
294
  })
295
295
  );
296
296
  });
297
297
  });
298
298
  }
299
- isChainFilled() {
299
+ isAllFilled() {
300
300
  return this.keysFilled.size > 0 && this.keysFilled.size === this.keysKnown.size;
301
301
  }
302
302
  }
@@ -333,7 +333,7 @@ class GuestAwareSequence {
333
333
  this.targetSourceFactory = targetSourceFactory;
334
334
  }
335
335
  value(guest) {
336
- const chain = new GuestChain();
336
+ const all = new GuestAwareAll();
337
337
  const sequenceSource = new SourceEmpty();
338
338
  const targetSource = this.targetSourceFactory.create(
339
339
  sequenceSource
@@ -347,12 +347,12 @@ class GuestAwareSequence {
347
347
  index = index + 1;
348
348
  handle();
349
349
  } else {
350
- chain.resultArray(guest);
350
+ all.valueArray(guest);
351
351
  }
352
352
  };
353
353
  function handle() {
354
354
  sequenceSource.give(theValue[index]);
355
- value(targetSource, chain.receiveKey("" + index));
355
+ value(targetSource, all.guestKey(index.toString()));
356
356
  value(targetSource, nextItemHandle);
357
357
  }
358
358
  if (theValue[index] !== void 0) {
@@ -372,7 +372,7 @@ class GuestAwareMap {
372
372
  this.targetSourceFactory = targetSourceFactory;
373
373
  }
374
374
  value(guest) {
375
- const chain = new GuestChain();
375
+ const all = new GuestAwareAll();
376
376
  value(
377
377
  this.baseSource,
378
378
  new GuestCast(guest, (theValue) => {
@@ -382,11 +382,11 @@ class GuestAwareMap {
382
382
  give(val, innerGuest);
383
383
  })
384
384
  );
385
- value(targetSource, chain.receiveKey("" + index));
385
+ value(targetSource, all.guestKey(index.toString()));
386
386
  });
387
387
  })
388
388
  );
389
- chain.resultArray(guest);
389
+ all.valueArray(guest);
390
390
  return this;
391
391
  }
392
392
  }
@@ -545,11 +545,11 @@ exports.Factory = Factory;
545
545
  exports.Guest = Guest;
546
546
  exports.GuestAware = GuestAware;
547
547
  exports.GuestAwareActive = GuestAwareActive;
548
+ exports.GuestAwareAll = GuestAwareAll;
548
549
  exports.GuestAwareMap = GuestAwareMap;
549
550
  exports.GuestAwareRace = GuestAwareRace;
550
551
  exports.GuestAwareSequence = GuestAwareSequence;
551
552
  exports.GuestCast = GuestCast;
552
- exports.GuestChain = GuestChain;
553
553
  exports.GuestDisposable = GuestDisposable;
554
554
  exports.GuestObject = GuestObject;
555
555
  exports.GuestPool = GuestPool;
@@ -1 +1 @@
1
- {"version":3,"file":"patron.cjs","sources":["../src/Guest/GuestAware.ts","../src/Guest/Guest.ts","../src/Guest/GuestCast.ts","../src/Patron/PatronPool.ts","../src/Source/Source.ts","../src/Guest/GuestObject.ts","../src/Guest/GuestPool.ts","../src/Guest/GuestChain.ts","../src/Source/SourceEmpty.ts","../src/Guest/GuestAwareSequence.ts","../src/Guest/GuestAwareMap.ts","../src/Guest/GuestAwareRace.ts","../src/Guest/GuestAwareActive.ts","../src/Guest/GuestSync.ts","../src/Guest/GuestDisposable.ts","../src/Patron/Patron.ts","../src/Patron/PatronOnce.ts","../src/Source/SourceDynamic.ts","../src/Factory/Factory.ts","../src/Factory/Module.ts"],"sourcesContent":["import { GuestType } from \"./Guest\";\n\nexport type GuestAwareExecutorType<T> = (guest: GuestType<T>) => unknown;\n\nexport interface GuestAwareObjectType<T> {\n value: GuestAwareExecutorType<T>\n}\n\nexport type GuestAwareType<T = any> = GuestAwareExecutorType<T> | GuestAwareObjectType<T>\n\nexport function value<T>(guestAware: GuestAwareType<T>, guest: GuestType<T>) {\n if (typeof guestAware === 'function') {\n return guestAware(guest);\n } else {\n return guestAware.value(guest);\n }\n}\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-aware\n */\nexport class GuestAware<T = any> implements GuestAwareObjectType<T> {\n public constructor(private guestAware: GuestAwareType<T>) { }\n\n public value(guest: GuestType<T>): GuestType<T> {\n value(this.guestAware, guest);\n return guest;\n }\n}\n","type GuestIntroduction = \"guest\" | \"patron\";\n\nexport interface GiveOptions {\n data?: unknown;\n}\n\nexport type GuestExecutorType<T = any> = (\n value: T,\n options?: GiveOptions,\n) => void;\n\nexport interface GuestObjectType<T = any> {\n give(value: T, options?: GiveOptions): this;\n introduction?(): GuestIntroduction;\n}\n\nexport type GuestType<T = any> = GuestExecutorType<T> | GuestObjectType<T>;\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/utils/give\n */\nexport function give<T>(data: T, guest: GuestType<T>, options?: GiveOptions) {\n if (typeof guest === \"function\") {\n guest(data, options);\n } else {\n guest.give(data, options);\n }\n}\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest\n */\nexport class Guest<T> implements GuestObjectType<T> {\n public constructor(private receiver: GuestExecutorType<T>) { }\n\n public give(value: T, options?: GiveOptions) {\n this.receiver(value, options);\n return this;\n }\n}\n","import {\n GuestDisposableType,\n MaybeDisposableType,\n} from \"./GuestDisposable\";\nimport { give, GiveOptions, GuestType } from \"./Guest\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-cast\n */\nexport class GuestCast<T> implements GuestDisposableType<T> {\n public constructor(\n private sourceGuest: GuestType<any>,\n private targetGuest: GuestType<T>,\n ) { }\n\n public introduction() {\n if (typeof this.sourceGuest === \"function\") {\n return \"guest\";\n }\n if (!this.sourceGuest.introduction) {\n return \"guest\";\n }\n return this.sourceGuest.introduction();\n }\n\n public give(value: T, options?: GiveOptions): this {\n give(value, this.targetGuest, options);\n return this;\n }\n\n public disposed(value: T | null): boolean {\n const maybeDisposable = this.sourceGuest as MaybeDisposableType;\n return maybeDisposable.disposed ? maybeDisposable.disposed(value) : false;\n }\n}\n","import { GuestDisposableType } from \"../Guest/GuestDisposable\";\nimport { give, GuestObjectType, GuestType, GiveOptions } from \"../Guest/Guest\";\n\nconst poolSets = new Map<PoolType, Set<GuestObjectType>>();\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/utils/remove-patron-from-pools\n */\nexport const removePatronFromPools = (patron: GuestObjectType) => {\n poolSets.forEach((pool) => {\n pool.delete(patron);\n });\n};\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/utils/is-patron-in-pools\n */\nexport const isPatronInPools = (patron: GuestObjectType) => {\n let inPool = false;\n poolSets.forEach((pool) => {\n if (!inPool) {\n inPool = pool.has(patron);\n }\n });\n return inPool;\n};\n\nexport interface PoolType<T = any> extends GuestObjectType<T> {\n add(guest: GuestObjectType<T>): this;\n distribute(receiving: T, possiblePatron: GuestObjectType<T>): this;\n remove(patron: GuestObjectType<T>): this;\n size(): number;\n}\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/patron/patron-pool\n */\nexport class PatronPool<T> implements PoolType<T> {\n private patrons: Set<GuestObjectType<T>>;\n\n public give: (value: T, options?: GiveOptions) => this;\n\n public constructor(private initiator: unknown) {\n this.patrons = new Set<GuestObjectType<T>>();\n poolSets.set(this, this.patrons);\n let lastMicrotask: (() => void) | null = null;\n const doReceive = (value: T, options?: GiveOptions) => {\n this.patrons.forEach((target) => {\n this.sendValueToGuest(value, target, options);\n });\n };\n this.give = (value: T, options?: GiveOptions) => {\n const currentMicroTask = () => {\n if (currentMicroTask === lastMicrotask) {\n doReceive(value, options);\n }\n };\n lastMicrotask = currentMicroTask;\n queueMicrotask(currentMicroTask);\n return this;\n };\n }\n\n public size(): number {\n return this.patrons.size;\n }\n\n public add(shouldBePatron: GuestType<T>) {\n if (!shouldBePatron) {\n throw new Error(\"PatronPool add method received nothing!\");\n }\n if (\n typeof shouldBePatron !== \"function\" &&\n shouldBePatron.introduction &&\n shouldBePatron.introduction() === \"patron\"\n ) {\n this.patrons.add(shouldBePatron);\n }\n return this;\n }\n\n public remove(patron: GuestObjectType<T>) {\n this.patrons.delete(patron);\n return this;\n }\n\n public distribute(receiving: T, possiblePatron: GuestType<T>): this {\n this.add(possiblePatron);\n this.sendValueToGuest(receiving, possiblePatron, {});\n return this;\n }\n\n private sendValueToGuest(\n value: T,\n guest: GuestType<T>,\n options?: GiveOptions,\n ) {\n const isDisposed = this.guestDisposed(value, guest);\n\n if (!isDisposed) {\n give(value, guest, {\n ...options,\n data: {\n ...((options?.data as Record<string, unknown>) ?? {}),\n initiator: this.initiator,\n pool: this,\n },\n });\n }\n }\n\n private guestDisposed(value: T, guest: GuestType<T>) {\n if ((guest as GuestDisposableType).disposed?.(value)) {\n this.remove(guest as GuestObjectType);\n return true;\n }\n\n return false;\n }\n}\n","import { Guest, GuestObjectType, GuestType } from \"../Guest/Guest\";\nimport { GuestAwareObjectType } from \"../Guest/GuestAware\";\nimport { PatronPool } from \"../Patron/PatronPool\";\n\nexport interface PoolAware<T = any> {\n pool(): PatronPool<T>;\n}\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/source\n */\nexport type SourceType<T = any> = GuestAwareObjectType<T> &\n GuestObjectType<T> &\n PoolAware<T>;\n\nexport class Source<T> implements SourceType<T> {\n private thePool = new PatronPool(this);\n\n public constructor(private sourceDocument: T) { }\n\n public pool() {\n return this.thePool;\n }\n\n public give(value: T): this {\n this.sourceDocument = value;\n this.thePool.give(this.sourceDocument);\n return this;\n }\n\n public value(guest: GuestType<T>): this {\n if (typeof guest === \"function\") {\n this.thePool.distribute(this.sourceDocument, new Guest(guest));\n } else {\n this.thePool.distribute(this.sourceDocument, guest);\n }\n return this;\n }\n}\n","import {\n GuestDisposableType,\n MaybeDisposableType,\n} from \"./GuestDisposable\";\nimport { GiveOptions, Guest, GuestType } from \"./Guest\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-object\n */\nexport class GuestObject<T> implements GuestDisposableType<T> {\n public constructor(private baseGuest: GuestType<T>) { }\n\n public give(value: T, options?: GiveOptions): this {\n let guest = this.baseGuest;\n if (typeof guest === \"function\") {\n guest = new Guest(guest);\n }\n guest.give(value, options);\n return this;\n }\n\n public introduction() {\n if (typeof this.baseGuest === \"function\" || !this.baseGuest.introduction) {\n return \"guest\";\n }\n return this.baseGuest.introduction();\n }\n\n public disposed(value: T | null): boolean {\n const maybeDisposable = this.baseGuest as MaybeDisposableType;\n return maybeDisposable.disposed ? maybeDisposable.disposed(value) : false;\n }\n}\n","import { PatronPool } from \"../Patron/PatronPool\";\nimport { PoolType } from \"../Patron/PatronPool\";\nimport { give, GuestObjectType, GuestType, GiveOptions } from \"./Guest\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-pool\n */\nexport class GuestPool<T> implements GuestObjectType<T>, PoolType<T> {\n private guests = new Set<GuestType<T>>();\n\n private patronPool: PatronPool<T>;\n\n public constructor(initiator: unknown) {\n this.patronPool = new PatronPool(initiator);\n }\n\n public give(value: T, options?: GiveOptions): this {\n this.deliverToGuests(value, options);\n this.patronPool.give(value, options);\n return this;\n }\n\n public add(guest: GuestType<T>): this {\n if (\n typeof guest === \"function\" ||\n !guest.introduction ||\n guest.introduction() === \"guest\"\n ) {\n this.guests.add(guest);\n }\n this.patronPool.add(guest);\n return this;\n }\n\n public remove(patron: GuestObjectType<T>): this {\n this.guests.delete(patron);\n this.patronPool.remove(patron);\n return this;\n }\n\n public distribute(receiving: T, possiblePatron: GuestObjectType<T>): this {\n this.add(possiblePatron);\n this.give(receiving);\n return this;\n }\n\n public size() {\n return this.patronPool.size() + this.guests.size;\n }\n\n private deliverToGuests(value: T, options?: GiveOptions) {\n this.guests.forEach((target) => {\n give(value, target, options);\n });\n this.guests.clear();\n }\n}\n","import { GuestCast } from \"./GuestCast\";\nimport { Source } from \"../Source/Source\";\nimport { Guest, GuestObjectType, GuestType } from \"./Guest\";\nimport { GuestObject } from \"./GuestObject\";\nimport { GuestPool } from \"./GuestPool\";\n\nexport interface ChainType<T = any> {\n result(guest: GuestObjectType<T>): this;\n resultArray(guest: GuestObjectType<T>): this;\n receiveKey<R>(key: string): GuestObjectType<R>;\n}\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-chain\n */\nexport class GuestChain<T> implements ChainType<T> {\n private theChain: Source<Record<string, unknown>>;\n\n private keysKnown = new Set();\n\n private keysFilled = new Set();\n\n private filledChainPool = new GuestPool(this);\n\n public constructor() {\n this.theChain = new Source<Record<string, unknown>>({});\n }\n\n public resultArray(guest: GuestType<T>) {\n const guestObject = new GuestObject(guest);\n this.filledChainPool.add(\n new GuestCast(guestObject, (value: Record<string, unknown>) => {\n guestObject.give(Object.values(value) as T);\n }),\n );\n if (this.isChainFilled()) {\n this.theChain.value(\n new Guest((chain: Record<string, unknown>) => {\n this.filledChainPool.give(Object.values(chain));\n }),\n );\n }\n return this;\n }\n\n public result(guest: GuestType<T>) {\n const guestObject = new GuestObject(guest);\n if (this.isChainFilled()) {\n this.filledChainPool.add(guestObject);\n this.theChain.value(\n new Guest((chain) => {\n this.filledChainPool.give(chain);\n }),\n );\n } else {\n this.filledChainPool.add(guestObject);\n }\n return this;\n }\n\n public receiveKey<R>(key: string): GuestObjectType<R> {\n this.keysKnown.add(key);\n return new Guest((value) => {\n // Обернул в очередь чтобы можно было синхронно наполнить очередь известных ключей\n queueMicrotask(() => {\n this.theChain.value(\n new Guest((chain: Record<string, unknown>) => {\n this.keysFilled.add(key);\n const lastChain = {\n ...chain,\n [key]: value,\n };\n this.theChain.give(lastChain);\n if (this.isChainFilled()) {\n this.filledChainPool.give(lastChain);\n }\n }),\n );\n });\n });\n }\n\n private isChainFilled() {\n return (\n this.keysFilled.size > 0 && this.keysFilled.size === this.keysKnown.size\n );\n }\n}\n","import { PatronPool } from \"../Patron/PatronPool\";\nimport { GuestCast } from \"../Guest/GuestCast\";\nimport { give, GuestType } from \"./../Guest/Guest\";\nimport { Source, SourceType } from \"./Source\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/source/source-empty\n */\nexport class SourceEmpty<T> implements SourceType<T> {\n private baseSource = new Source<T | null>(null);\n\n public value(guest: GuestType<T>) {\n this.baseSource.value(\n new GuestCast(guest as GuestType, (value) => {\n if (value !== null) {\n give(value, guest);\n }\n }),\n );\n return this;\n }\n\n public give(value: T): this {\n this.baseSource.give(value);\n return this;\n }\n\n public pool(): PatronPool<T> {\n return this.baseSource.pool();\n }\n}\n","import { FactoryType } from \"../Factory/Factory\";\nimport { give } from \"./Guest\";\nimport { GuestAwareObjectType, GuestAwareType, value } from \"./GuestAware\";\nimport { GuestCast } from \"./GuestCast\";\nimport { GuestChain } from \"./GuestChain\";\nimport { GuestType } from \"./Guest\";\nimport { SourceEmpty } from \"../Source/SourceEmpty\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-aware-sequence\n */\nexport class GuestAwareSequence<T, TG> implements GuestAwareObjectType<TG[]> {\n public constructor(\n private baseSource: GuestAwareType<T[]>,\n private targetSourceFactory: FactoryType<GuestAwareType<TG>>\n ) { }\n\n public value(guest: GuestType<TG[]>) {\n const chain = new GuestChain<TG[]>();\n const sequenceSource = new SourceEmpty();\n const targetSource = this.targetSourceFactory.create(\n sequenceSource\n )\n\n value(\n this.baseSource,\n new GuestCast(guest, (theValue) => {\n let index = 0;\n\n const nextItemHandle = () => {\n if (theValue[index + 1] !== undefined) {\n index = index + 1;\n handle();\n } else {\n chain.resultArray(guest);\n }\n }\n\n function handle() {\n sequenceSource.give(theValue[index]);\n value(targetSource, chain.receiveKey('' + index));\n value(targetSource, nextItemHandle);\n }\n\n if (theValue[index] !== undefined) {\n handle();\n } else {\n give([], guest);\n }\n })\n );\n return this;\n }\n}\n","import { FactoryType } from \"../Factory/Factory\";\nimport { give } from \"./Guest\";\nimport { GuestAwareObjectType, GuestAwareType, value } from \"./GuestAware\";\nimport { GuestCast } from \"./GuestCast\";\nimport { GuestChain } from \"./GuestChain\";\nimport { GuestType } from \"./Guest\";\nimport { GuestAware } from \"./GuestAware\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-aware-map\n */\nexport class GuestAwareMap<T, TG> implements GuestAwareObjectType<TG[]> {\n public constructor(\n private baseSource: GuestAwareType<T[]>,\n private targetSourceFactory: FactoryType<GuestAwareType<TG>>\n ) { }\n\n public value(guest: GuestType<TG[]>) {\n const chain = new GuestChain();\n value(\n this.baseSource,\n new GuestCast(<GuestType>guest, (theValue) => {\n theValue.forEach((val, index) => {\n const targetSource = this.targetSourceFactory.create(\n new GuestAware((innerGuest) => {\n give(val, innerGuest);\n })\n )\n value(targetSource, chain.receiveKey('' + index));\n });\n })\n )\n chain.resultArray(<GuestType>guest);\n return this;\n }\n}\n","import { give, GuestType } from \"./Guest\";\nimport { GuestAwareObjectType, GuestAwareType, value } from \"./GuestAware\";\nimport { GuestCast } from \"./GuestCast\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-aware-race\n */\nexport class GuestAwareRace<T> implements GuestAwareObjectType<T> {\n public constructor(private guestAwares: GuestAwareType<T>[]) { }\n\n public value(guest: GuestType<T>): this {\n let connectedWithGuestAware: GuestAwareType | null = null;\n this.guestAwares.forEach(guestAware => {\n value(\n guestAware,\n new GuestCast(<GuestType>guest, (value) => {\n if (!connectedWithGuestAware || connectedWithGuestAware === guestAware) {\n give(value as T, guest);\n connectedWithGuestAware = guestAware\n }\n })\n );\n });\n return this;\n }\n}\n","import { SourceType } from \"../Source/Source\";\nimport { SourceEmpty } from \"../Source/SourceEmpty\";\nimport { GuestType } from \"./Guest\";\nimport { GuestAwareObjectType } from \"./GuestAware\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/utils/action-type\n */\nexport interface ActionType<P = any> {\n do(config: P): this;\n}\n\nexport interface GuestAwareAcitveType<R = unknown, T = unknown> extends GuestAwareObjectType<T>, ActionType<R> {\n}\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-aware-active\n */\nexport class GuestAwareActive<R, T> implements GuestAwareAcitveType<R, T> {\n private source = new SourceEmpty<T>();\n\n public constructor(private configExecutor: (config: R, source: SourceType<T>) => void) { }\n\n public do(config: R): this {\n this.configExecutor(config, this.source);\n return this;\n }\n\n public value(guest: GuestType<T>): this {\n this.source.value(guest);\n return this;\n }\n}\n","import { GuestObjectType } from \"./Guest\";\n\nexport interface GuestValueType<T = any> extends GuestObjectType<T> {\n value(): T;\n}\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-sync\n */\nexport class GuestSync<T> implements GuestValueType<T> {\n public constructor(private theValue: T) { }\n\n public give(value: T): this {\n this.theValue = value;\n return this;\n }\n\n public value() {\n return this.theValue;\n }\n}\n","import { give, GiveOptions, GuestObjectType, GuestType } from \"./Guest\";\n\nexport interface GuestDisposableType<T = any> extends GuestObjectType<T> {\n disposed(value: T | null): boolean;\n}\n\nexport type MaybeDisposableType<T = any> = Partial<GuestDisposableType<T>>;\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-disposable\n */\nexport class GuestDisposable<T> implements GuestDisposableType<T> {\n public constructor(\n private guest: GuestType,\n private disposeCheck: (value: T | null) => boolean,\n ) { }\n\n public disposed(value: T | null): boolean {\n return this.disposeCheck(value);\n }\n\n public give(value: T, options?: GiveOptions): this {\n give(value, this.guest, options);\n return this;\n }\n}\n","import { GuestDisposableType } from \"../Guest/GuestDisposable\";\nimport { give, GiveOptions, GuestType } from \"../Guest/Guest\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/patron\n */\nexport class Patron<T> implements GuestDisposableType<T> {\n public constructor(private willBePatron: GuestType<T>) { }\n\n public introduction() {\n return \"patron\" as const;\n }\n\n public give(value: T, options?: GiveOptions): this {\n give(value, this.willBePatron, options);\n return this;\n }\n\n public disposed(value: T | null): boolean {\n const maybeDisposable = this.willBePatron as GuestDisposableType;\n return maybeDisposable?.disposed?.(value) || false;\n }\n}\n","import { PoolType } from \"./PatronPool\";\nimport { give, GuestType, GiveOptions } from \"../Guest/Guest\";\nimport {\n GuestDisposableType,\n MaybeDisposableType,\n} from \"../Guest/GuestDisposable\";\n\ntype PoolAware = {\n pool?: PoolType;\n};\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/patron/patron-once\n */\nexport class PatronOnce<T> implements GuestDisposableType<T> {\n private received = false;\n\n public constructor(private baseGuest: GuestType<T>) { }\n\n public introduction() {\n return \"patron\" as const;\n }\n\n public give(value: T, options?: GiveOptions): this {\n if (!this.received) {\n give(value, this.baseGuest, options);\n }\n const data = options?.data as PoolAware;\n if (data?.pool) {\n data.pool.remove(this);\n }\n return this;\n }\n\n public disposed(value: T | null): boolean {\n const maybeDisposable = this.baseGuest as MaybeDisposableType;\n return maybeDisposable.disposed ? maybeDisposable.disposed(value) : false;\n }\n}\n","import { give, GuestType } from \"../Guest/Guest\";\nimport { GuestAwareType, value } from \"../Guest/GuestAware\";\nimport { PatronPool } from \"../Patron/PatronPool\";\nimport { SourceType } from \"./Source\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/source-dynamic\n */\nexport class SourceDynamic<T = unknown> implements SourceType<T> {\n public constructor(\n private baseGuest: GuestType<T>,\n private baseGuestAware: GuestAwareType<T>,\n ) { }\n\n public value(guest: GuestType<T>) {\n value(this.baseGuestAware, guest);\n return this;\n }\n\n public give(value: T) {\n give(value, this.baseGuest);\n return this;\n }\n\n public pool(): PatronPool<T> {\n throw Error('No pool in SourceDynamic');\n }\n}\n","interface Constructable<T> {\n new(...args: unknown[]): T;\n}\n\ninterface Prototyped<T> {\n prototype: T;\n}\n\nexport interface FactoryType<T> {\n create<R extends unknown[], CT = null>(...args: R): CT extends null ? T : CT;\n}\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/utils/factory\n */\nexport class Factory<T> implements FactoryType<T> {\n public constructor(\n private constructorFn: Prototyped<T>,\n private factories: Record<string, unknown> = {},\n ) { }\n\n public create<R extends unknown[], CT = null>(\n ...args: R\n ): CT extends null ? T : CT {\n return new (this.constructorFn as Constructable<T>)(\n ...args,\n this.factories,\n ) as CT extends null ? T : CT;\n }\n}\n","import { FactoryType } from \"./Factory\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/utils/module\n */\nexport class Module<T> implements FactoryType<T> {\n public constructor(private buildingFn: (...args: any[]) => T) { }\n\n public create<R extends unknown[], CT = null>(...args: R): CT extends null ? T : CT {\n return this.buildingFn(...args) as CT extends null ? T : CT;\n }\n}\n"],"names":["__publicField","value"],"mappings":";;AAUgB,SAAA,KAAA,CAAS,YAA+B,KAAqB,EAAA;AAC3E,EAAI,IAAA,OAAO,eAAe,UAAY,EAAA;AACpC,IAAA,OAAO,WAAW,KAAK,CAAA,CAAA;AAAA,GAClB,MAAA;AACL,IAAO,OAAA,UAAA,CAAW,MAAM,KAAK,CAAA,CAAA;AAAA,GAC/B;AACF,CAAA;AAKO,MAAM,UAAuD,CAAA;AAAA,EAC3D,YAAoB,UAA+B,EAAA;AAA/B,IAAA,IAAA,CAAA,UAAA,GAAA,UAAA,CAAA;AAAA,GAAiC;AAAA,EAErD,MAAM,KAAmC,EAAA;AAC9C,IAAM,KAAA,CAAA,IAAA,CAAK,YAAY,KAAK,CAAA,CAAA;AAC5B,IAAO,OAAA,KAAA,CAAA;AAA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A;AAAnC,IAAA,IAAA,CAAA,UAAA,GAAA,UAAA,CAAA;AAAA,GAAqC;AAAA,EAEzD,UAA0C,IAAmC,EAAA;AAClF,IAAO,OAAA,IAAA,CAAK,UAAW,CAAA,GAAG,IAAI,CAAA,CAAA;AAAA,GAChC;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"patron.cjs","sources":["../src/Guest/GuestAware.ts","../src/Guest/Guest.ts","../src/Guest/GuestCast.ts","../src/Patron/PatronPool.ts","../src/Source/Source.ts","../src/Guest/GuestObject.ts","../src/Guest/GuestPool.ts","../src/Guest/GuestAwareAll.ts","../src/Source/SourceEmpty.ts","../src/Guest/GuestAwareSequence.ts","../src/Guest/GuestAwareMap.ts","../src/Guest/GuestAwareRace.ts","../src/Guest/GuestAwareActive.ts","../src/Guest/GuestSync.ts","../src/Guest/GuestDisposable.ts","../src/Patron/Patron.ts","../src/Patron/PatronOnce.ts","../src/Source/SourceDynamic.ts","../src/Factory/Factory.ts","../src/Factory/Module.ts"],"sourcesContent":["import { GuestType } from \"./Guest\";\n\nexport type GuestAwareExecutorType<T> = (guest: GuestType<T>) => unknown;\n\nexport interface GuestAwareObjectType<T> {\n value: GuestAwareExecutorType<T>\n}\n\nexport type GuestAwareType<T = any> = GuestAwareExecutorType<T> | GuestAwareObjectType<T>\n\nexport function value<T>(guestAware: GuestAwareType<T>, guest: GuestType<T>) {\n if (typeof guestAware === 'function') {\n return guestAware(guest);\n } else {\n return guestAware.value(guest);\n }\n}\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-aware\n */\nexport class GuestAware<T = any> implements GuestAwareObjectType<T> {\n public constructor(private guestAware: GuestAwareType<T>) { }\n\n public value(guest: GuestType<T>): GuestType<T> {\n value(this.guestAware, guest);\n return guest;\n }\n}\n","type GuestIntroduction = \"guest\" | \"patron\";\n\nexport interface GiveOptions {\n data?: unknown;\n}\n\nexport type GuestExecutorType<T = any> = (\n value: T,\n options?: GiveOptions,\n) => void;\n\nexport interface GuestObjectType<T = any> {\n give(value: T, options?: GiveOptions): this;\n introduction?(): GuestIntroduction;\n}\n\nexport type GuestType<T = any> = GuestExecutorType<T> | GuestObjectType<T>;\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/utils/give\n */\nexport function give<T>(data: T, guest: GuestType<T>, options?: GiveOptions) {\n if (typeof guest === \"function\") {\n guest(data, options);\n } else {\n guest.give(data, options);\n }\n}\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest\n */\nexport class Guest<T> implements GuestObjectType<T> {\n public constructor(private receiver: GuestExecutorType<T>) { }\n\n public give(value: T, options?: GiveOptions) {\n this.receiver(value, options);\n return this;\n }\n}\n","import {\n GuestDisposableType,\n MaybeDisposableType,\n} from \"./GuestDisposable\";\nimport { give, GiveOptions, GuestType } from \"./Guest\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-cast\n */\nexport class GuestCast<T> implements GuestDisposableType<T> {\n public constructor(\n private sourceGuest: GuestType<any>,\n private targetGuest: GuestType<T>,\n ) { }\n\n public introduction() {\n if (typeof this.sourceGuest === \"function\") {\n return \"guest\";\n }\n if (!this.sourceGuest.introduction) {\n return \"guest\";\n }\n return this.sourceGuest.introduction();\n }\n\n public give(value: T, options?: GiveOptions): this {\n give(value, this.targetGuest, options);\n return this;\n }\n\n public disposed(value: T | null): boolean {\n const maybeDisposable = this.sourceGuest as MaybeDisposableType;\n return maybeDisposable.disposed ? maybeDisposable.disposed(value) : false;\n }\n}\n","import { GuestDisposableType } from \"../Guest/GuestDisposable\";\nimport { give, GuestObjectType, GuestType, GiveOptions } from \"../Guest/Guest\";\n\nconst poolSets = new Map<PoolType, Set<GuestObjectType>>();\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/utils/remove-patron-from-pools\n */\nexport const removePatronFromPools = (patron: GuestObjectType) => {\n poolSets.forEach((pool) => {\n pool.delete(patron);\n });\n};\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/utils/is-patron-in-pools\n */\nexport const isPatronInPools = (patron: GuestObjectType) => {\n let inPool = false;\n poolSets.forEach((pool) => {\n if (!inPool) {\n inPool = pool.has(patron);\n }\n });\n return inPool;\n};\n\nexport interface PoolType<T = any> extends GuestObjectType<T> {\n add(guest: GuestObjectType<T>): this;\n distribute(receiving: T, possiblePatron: GuestObjectType<T>): this;\n remove(patron: GuestObjectType<T>): this;\n size(): number;\n}\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/patron/patron-pool\n */\nexport class PatronPool<T> implements PoolType<T> {\n private patrons: Set<GuestObjectType<T>>;\n\n public give: (value: T, options?: GiveOptions) => this;\n\n public constructor(private initiator: unknown) {\n this.patrons = new Set<GuestObjectType<T>>();\n poolSets.set(this, this.patrons);\n let lastMicrotask: (() => void) | null = null;\n const doReceive = (value: T, options?: GiveOptions) => {\n this.patrons.forEach((target) => {\n this.sendValueToGuest(value, target, options);\n });\n };\n this.give = (value: T, options?: GiveOptions) => {\n const currentMicroTask = () => {\n if (currentMicroTask === lastMicrotask) {\n doReceive(value, options);\n }\n };\n lastMicrotask = currentMicroTask;\n queueMicrotask(currentMicroTask);\n return this;\n };\n }\n\n public size(): number {\n return this.patrons.size;\n }\n\n public add(shouldBePatron: GuestType<T>) {\n if (!shouldBePatron) {\n throw new Error(\"PatronPool add method received nothing!\");\n }\n if (\n typeof shouldBePatron !== \"function\" &&\n shouldBePatron.introduction &&\n shouldBePatron.introduction() === \"patron\"\n ) {\n this.patrons.add(shouldBePatron);\n }\n return this;\n }\n\n public remove(patron: GuestObjectType<T>) {\n this.patrons.delete(patron);\n return this;\n }\n\n public distribute(receiving: T, possiblePatron: GuestType<T>): this {\n this.add(possiblePatron);\n this.sendValueToGuest(receiving, possiblePatron, {});\n return this;\n }\n\n private sendValueToGuest(\n value: T,\n guest: GuestType<T>,\n options?: GiveOptions,\n ) {\n const isDisposed = this.guestDisposed(value, guest);\n\n if (!isDisposed) {\n give(value, guest, {\n ...options,\n data: {\n ...((options?.data as Record<string, unknown>) ?? {}),\n initiator: this.initiator,\n pool: this,\n },\n });\n }\n }\n\n private guestDisposed(value: T, guest: GuestType<T>) {\n if ((guest as GuestDisposableType).disposed?.(value)) {\n this.remove(guest as GuestObjectType);\n return true;\n }\n\n return false;\n }\n}\n","import { Guest, GuestObjectType, GuestType } from \"../Guest/Guest\";\nimport { GuestAwareObjectType } from \"../Guest/GuestAware\";\nimport { PatronPool } from \"../Patron/PatronPool\";\n\nexport interface PoolAware<T = any> {\n pool(): PatronPool<T>;\n}\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/source\n */\nexport type SourceType<T = any> = GuestAwareObjectType<T> &\n GuestObjectType<T> &\n PoolAware<T>;\n\nexport class Source<T> implements SourceType<T> {\n private thePool = new PatronPool(this);\n\n public constructor(private sourceDocument: T) { }\n\n public pool() {\n return this.thePool;\n }\n\n public give(value: T): this {\n this.sourceDocument = value;\n this.thePool.give(this.sourceDocument);\n return this;\n }\n\n public value(guest: GuestType<T>): this {\n if (typeof guest === \"function\") {\n this.thePool.distribute(this.sourceDocument, new Guest(guest));\n } else {\n this.thePool.distribute(this.sourceDocument, guest);\n }\n return this;\n }\n}\n","import {\n GuestDisposableType,\n MaybeDisposableType,\n} from \"./GuestDisposable\";\nimport { GiveOptions, Guest, GuestType } from \"./Guest\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-object\n */\nexport class GuestObject<T> implements GuestDisposableType<T> {\n public constructor(private baseGuest: GuestType<T>) { }\n\n public give(value: T, options?: GiveOptions): this {\n let guest = this.baseGuest;\n if (typeof guest === \"function\") {\n guest = new Guest(guest);\n }\n guest.give(value, options);\n return this;\n }\n\n public introduction() {\n if (typeof this.baseGuest === \"function\" || !this.baseGuest.introduction) {\n return \"guest\";\n }\n return this.baseGuest.introduction();\n }\n\n public disposed(value: T | null): boolean {\n const maybeDisposable = this.baseGuest as MaybeDisposableType;\n return maybeDisposable.disposed ? maybeDisposable.disposed(value) : false;\n }\n}\n","import { PatronPool } from \"../Patron/PatronPool\";\nimport { PoolType } from \"../Patron/PatronPool\";\nimport { give, GuestObjectType, GuestType, GiveOptions } from \"./Guest\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-pool\n */\nexport class GuestPool<T> implements GuestObjectType<T>, PoolType<T> {\n private guests = new Set<GuestType<T>>();\n\n private patronPool: PatronPool<T>;\n\n public constructor(initiator: unknown) {\n this.patronPool = new PatronPool(initiator);\n }\n\n public give(value: T, options?: GiveOptions): this {\n this.deliverToGuests(value, options);\n this.patronPool.give(value, options);\n return this;\n }\n\n public add(guest: GuestType<T>): this {\n if (\n typeof guest === \"function\" ||\n !guest.introduction ||\n guest.introduction() === \"guest\"\n ) {\n this.guests.add(guest);\n }\n this.patronPool.add(guest);\n return this;\n }\n\n public remove(patron: GuestObjectType<T>): this {\n this.guests.delete(patron);\n this.patronPool.remove(patron);\n return this;\n }\n\n public distribute(receiving: T, possiblePatron: GuestObjectType<T>): this {\n this.add(possiblePatron);\n this.give(receiving);\n return this;\n }\n\n public size() {\n return this.patronPool.size() + this.guests.size;\n }\n\n private deliverToGuests(value: T, options?: GiveOptions) {\n this.guests.forEach((target) => {\n give(value, target, options);\n });\n this.guests.clear();\n }\n}\n","import { GuestAwareObjectType } from \"src/Guest/GuestAware\";\nimport { Source } from \"../Source/Source\";\nimport { Guest, GuestObjectType, GuestType } from \"./Guest\";\nimport { GuestCast } from \"./GuestCast\";\nimport { GuestObject } from \"./GuestObject\";\nimport { GuestPool } from \"./GuestPool\";\n\nexport interface GuestAwareAllType<T = any> extends GuestAwareObjectType<T> {\n valueArray(guest: GuestObjectType<T>): this;\n guestKey<R>(key: string): GuestObjectType<R>;\n}\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-aware-all\n */\nexport class GuestAwareAll<T> implements GuestAwareAllType<T> {\n private theAll: Source<Record<string, unknown>>;\n\n private keysKnown = new Set();\n\n private keysFilled = new Set();\n\n private filledAllPool = new GuestPool(this);\n\n public constructor() {\n this.theAll = new Source<Record<string, unknown>>({});\n }\n\n public valueArray(guest: GuestType<T>) {\n const guestObject = new GuestObject(guest);\n this.filledAllPool.add(\n new GuestCast(guestObject, (value: Record<string, unknown>) => {\n guestObject.give(Object.values(value) as T);\n }),\n );\n if (this.isAllFilled()) {\n this.theAll.value(\n new Guest((all: Record<string, unknown>) => {\n this.filledAllPool.give(Object.values(all));\n }),\n );\n }\n return this;\n }\n\n public value(guest: GuestType<T>) {\n const guestObject = new GuestObject(guest);\n if (this.isAllFilled()) {\n this.filledAllPool.add(guestObject);\n this.theAll.value(\n new Guest((all) => {\n this.filledAllPool.give(all);\n }),\n );\n } else {\n this.filledAllPool.add(guestObject);\n }\n return this;\n }\n\n public guestKey<R>(key: string): GuestObjectType<R> {\n this.keysKnown.add(key);\n return new Guest((value) => {\n // Обернул в очередь чтобы можно было синхронно наполнить очередь известных ключей\n queueMicrotask(() => {\n this.theAll.value(\n new Guest((all: Record<string, unknown>) => {\n this.keysFilled.add(key);\n const lastAll = {\n ...all,\n [key]: value,\n };\n this.theAll.give(lastAll);\n if (this.isAllFilled()) {\n this.filledAllPool.give(lastAll);\n }\n }),\n );\n });\n });\n }\n\n private isAllFilled() {\n return (\n this.keysFilled.size > 0 && this.keysFilled.size === this.keysKnown.size\n );\n }\n}\n","import { PatronPool } from \"../Patron/PatronPool\";\nimport { GuestCast } from \"../Guest/GuestCast\";\nimport { give, GuestType } from \"./../Guest/Guest\";\nimport { Source, SourceType } from \"./Source\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/source/source-empty\n */\nexport class SourceEmpty<T> implements SourceType<T> {\n private baseSource = new Source<T | null>(null);\n\n public value(guest: GuestType<T>) {\n this.baseSource.value(\n new GuestCast(guest as GuestType, (value) => {\n if (value !== null) {\n give(value, guest);\n }\n }),\n );\n return this;\n }\n\n public give(value: T): this {\n this.baseSource.give(value);\n return this;\n }\n\n public pool(): PatronPool<T> {\n return this.baseSource.pool();\n }\n}\n","import { FactoryType } from \"../Factory/Factory\";\nimport { give } from \"./Guest\";\nimport { GuestAwareObjectType, GuestAwareType, value } from \"./GuestAware\";\nimport { GuestCast } from \"./GuestCast\";\nimport { GuestAwareAll } from \"./GuestAwareAll\";\nimport { GuestType } from \"./Guest\";\nimport { SourceEmpty } from \"../Source/SourceEmpty\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-aware-sequence\n */\nexport class GuestAwareSequence<T, TG> implements GuestAwareObjectType<TG[]> {\n public constructor(\n private baseSource: GuestAwareType<T[]>,\n private targetSourceFactory: FactoryType<GuestAwareType<TG>>\n ) { }\n\n public value(guest: GuestType<TG[]>) {\n const all = new GuestAwareAll<TG[]>();\n const sequenceSource = new SourceEmpty();\n const targetSource = this.targetSourceFactory.create(\n sequenceSource\n )\n\n value(\n this.baseSource,\n new GuestCast(guest, (theValue) => {\n let index = 0;\n\n const nextItemHandle = () => {\n if (theValue[index + 1] !== undefined) {\n index = index + 1;\n handle();\n } else {\n all.valueArray(guest);\n }\n }\n\n function handle() {\n sequenceSource.give(theValue[index]);\n value(targetSource, all.guestKey(index.toString()));\n value(targetSource, nextItemHandle);\n }\n\n if (theValue[index] !== undefined) {\n handle();\n } else {\n give([], guest);\n }\n })\n );\n return this;\n }\n}\n","import { FactoryType } from \"../Factory/Factory\";\nimport { give } from \"./Guest\";\nimport { GuestAwareObjectType, GuestAwareType, value } from \"./GuestAware\";\nimport { GuestCast } from \"./GuestCast\";\nimport { GuestAwareAll } from \"./GuestAwareAll\";\nimport { GuestType } from \"./Guest\";\nimport { GuestAware } from \"./GuestAware\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-aware-map\n */\nexport class GuestAwareMap<T, TG> implements GuestAwareObjectType<TG[]> {\n public constructor(\n private baseSource: GuestAwareType<T[]>,\n private targetSourceFactory: FactoryType<GuestAwareType<TG>>\n ) { }\n\n public value(guest: GuestType<TG[]>) {\n const all = new GuestAwareAll();\n value(\n this.baseSource,\n new GuestCast(<GuestType>guest, (theValue) => {\n theValue.forEach((val, index) => {\n const targetSource = this.targetSourceFactory.create(\n new GuestAware((innerGuest) => {\n give(val, innerGuest);\n })\n )\n value(targetSource, all.guestKey(index.toString()));\n });\n })\n )\n all.valueArray(<GuestType>guest);\n return this;\n }\n}\n","import { give, GuestType } from \"./Guest\";\nimport { GuestAwareObjectType, GuestAwareType, value } from \"./GuestAware\";\nimport { GuestCast } from \"./GuestCast\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-aware-race\n */\nexport class GuestAwareRace<T> implements GuestAwareObjectType<T> {\n public constructor(private guestAwares: GuestAwareType<T>[]) { }\n\n public value(guest: GuestType<T>): this {\n let connectedWithGuestAware: GuestAwareType | null = null;\n this.guestAwares.forEach(guestAware => {\n value(\n guestAware,\n new GuestCast(<GuestType>guest, (value) => {\n if (!connectedWithGuestAware || connectedWithGuestAware === guestAware) {\n give(value as T, guest);\n connectedWithGuestAware = guestAware\n }\n })\n );\n });\n return this;\n }\n}\n","import { SourceType } from \"../Source/Source\";\nimport { SourceEmpty } from \"../Source/SourceEmpty\";\nimport { GuestType } from \"./Guest\";\nimport { GuestAwareObjectType } from \"./GuestAware\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/utils/action-type\n */\nexport interface ActionType<P = any> {\n do(config: P): this;\n}\n\nexport interface GuestAwareAcitveType<R = unknown, T = unknown> extends GuestAwareObjectType<T>, ActionType<R> {\n}\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-aware-active\n */\nexport class GuestAwareActive<R, T> implements GuestAwareAcitveType<R, T> {\n private source = new SourceEmpty<T>();\n\n public constructor(private configExecutor: (config: R, source: SourceType<T>) => void) { }\n\n public do(config: R): this {\n this.configExecutor(config, this.source);\n return this;\n }\n\n public value(guest: GuestType<T>): this {\n this.source.value(guest);\n return this;\n }\n}\n","import { GuestObjectType } from \"./Guest\";\n\nexport interface GuestValueType<T = any> extends GuestObjectType<T> {\n value(): T;\n}\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-sync\n */\nexport class GuestSync<T> implements GuestValueType<T> {\n public constructor(private theValue: T) { }\n\n public give(value: T): this {\n this.theValue = value;\n return this;\n }\n\n public value() {\n return this.theValue;\n }\n}\n","import { give, GiveOptions, GuestObjectType, GuestType } from \"./Guest\";\n\nexport interface GuestDisposableType<T = any> extends GuestObjectType<T> {\n disposed(value: T | null): boolean;\n}\n\nexport type MaybeDisposableType<T = any> = Partial<GuestDisposableType<T>>;\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-disposable\n */\nexport class GuestDisposable<T> implements GuestDisposableType<T> {\n public constructor(\n private guest: GuestType,\n private disposeCheck: (value: T | null) => boolean,\n ) { }\n\n public disposed(value: T | null): boolean {\n return this.disposeCheck(value);\n }\n\n public give(value: T, options?: GiveOptions): this {\n give(value, this.guest, options);\n return this;\n }\n}\n","import { GuestDisposableType } from \"../Guest/GuestDisposable\";\nimport { give, GiveOptions, GuestType } from \"../Guest/Guest\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/patron\n */\nexport class Patron<T> implements GuestDisposableType<T> {\n public constructor(private willBePatron: GuestType<T>) { }\n\n public introduction() {\n return \"patron\" as const;\n }\n\n public give(value: T, options?: GiveOptions): this {\n give(value, this.willBePatron, options);\n return this;\n }\n\n public disposed(value: T | null): boolean {\n const maybeDisposable = this.willBePatron as GuestDisposableType;\n return maybeDisposable?.disposed?.(value) || false;\n }\n}\n","import { PoolType } from \"./PatronPool\";\nimport { give, GuestType, GiveOptions } from \"../Guest/Guest\";\nimport {\n GuestDisposableType,\n MaybeDisposableType,\n} from \"../Guest/GuestDisposable\";\n\ntype PoolAware = {\n pool?: PoolType;\n};\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/patron/patron-once\n */\nexport class PatronOnce<T> implements GuestDisposableType<T> {\n private received = false;\n\n public constructor(private baseGuest: GuestType<T>) { }\n\n public introduction() {\n return \"patron\" as const;\n }\n\n public give(value: T, options?: GiveOptions): this {\n if (!this.received) {\n give(value, this.baseGuest, options);\n }\n const data = options?.data as PoolAware;\n if (data?.pool) {\n data.pool.remove(this);\n }\n return this;\n }\n\n public disposed(value: T | null): boolean {\n const maybeDisposable = this.baseGuest as MaybeDisposableType;\n return maybeDisposable.disposed ? maybeDisposable.disposed(value) : false;\n }\n}\n","import { give, GuestType } from \"../Guest/Guest\";\nimport { GuestAwareType, value } from \"../Guest/GuestAware\";\nimport { PatronPool } from \"../Patron/PatronPool\";\nimport { SourceType } from \"./Source\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/source-dynamic\n */\nexport class SourceDynamic<T = unknown> implements SourceType<T> {\n public constructor(\n private baseGuest: GuestType<T>,\n private baseGuestAware: GuestAwareType<T>,\n ) { }\n\n public value(guest: GuestType<T>) {\n value(this.baseGuestAware, guest);\n return this;\n }\n\n public give(value: T) {\n give(value, this.baseGuest);\n return this;\n }\n\n public pool(): PatronPool<T> {\n throw Error('No pool in SourceDynamic');\n }\n}\n","interface Constructable<T> {\n new(...args: unknown[]): T;\n}\n\ninterface Prototyped<T> {\n prototype: T;\n}\n\nexport interface FactoryType<T> {\n create<R extends unknown[], CT = null>(...args: R): CT extends null ? T : CT;\n}\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/utils/factory\n */\nexport class Factory<T> implements FactoryType<T> {\n public constructor(\n private constructorFn: Prototyped<T>,\n private factories: Record<string, unknown> = {},\n ) { }\n\n public create<R extends unknown[], CT = null>(\n ...args: R\n ): CT extends null ? T : CT {\n return new (this.constructorFn as Constructable<T>)(\n ...args,\n this.factories,\n ) as CT extends null ? T : CT;\n }\n}\n","import { FactoryType } from \"./Factory\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/utils/module\n */\nexport class Module<T> implements FactoryType<T> {\n public constructor(private buildingFn: (...args: any[]) => T) { }\n\n public create<R extends unknown[], CT = null>(...args: R): CT extends null ? T : CT {\n return this.buildingFn(...args) as CT extends null ? T : CT;\n }\n}\n"],"names":["__publicField","value"],"mappings":";;AAUgB,SAAA,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AA0B,CAAA,CAAA;AAAA,GACxC;AACF;;ACZO,MAAM,OAAqC,CAAA;AAAA,EACzC,WACG,CAAA,aAAA,EACA,SAAqC,GAAA,EAC7C,EAAA;AAFQ,IAAA,IAAA,CAAA,aAAA,GAAA,aAAA,CAAA;AACA,IAAA,IAAA,CAAA,SAAA,GAAA,SAAA,CAAA;AAAA,GACN;AAAA,EAEG,UACF,IACuB,EAAA;AAC1B,IAAA,OAAO,IAAK,IAAK,CAAA,aAAA;AAAA,MACf,GAAG,IAAA;AAAA,MACH,IAAK,CAAA,SAAA;AAAA,KACP,CAAA;AAAA,GACF;AACF;;ACxBO,MAAM,MAAoC,CAAA;AAAA,EACxC,YAAoB,UAAmC,EAAA;AAAnC,IAAA,IAAA,CAAA,UAAA,GAAA,UAAA,CAAA;AAAA,GAAqC;AAAA,EAEzD,UAA0C,IAAmC,EAAA;AAClF,IAAO,OAAA,IAAA,CAAK,UAAW,CAAA,GAAG,IAAI,CAAA,CAAA;AAAA,GAChC;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/patron.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { GuestAwareObjectType as GuestAwareObjectType$1 } from 'src/Guest/GuestAware';
2
+
1
3
  type GuestIntroduction = "guest" | "patron";
2
4
  interface GiveOptions {
3
5
  data?: unknown;
@@ -173,24 +175,23 @@ declare class GuestCast<T> implements GuestDisposableType<T> {
173
175
  disposed(value: T | null): boolean;
174
176
  }
175
177
 
176
- interface ChainType<T = any> {
177
- result(guest: GuestObjectType<T>): this;
178
- resultArray(guest: GuestObjectType<T>): this;
179
- receiveKey<R>(key: string): GuestObjectType<R>;
178
+ interface GuestAwareAllType<T = any> extends GuestAwareObjectType$1<T> {
179
+ valueArray(guest: GuestObjectType<T>): this;
180
+ guestKey<R>(key: string): GuestObjectType<R>;
180
181
  }
181
182
  /**
182
- * @url https://kosukhin.github.io/patron.site/#/guest/guest-chain
183
+ * @url https://kosukhin.github.io/patron.site/#/guest/guest-aware-all
183
184
  */
184
- declare class GuestChain<T> implements ChainType<T> {
185
- private theChain;
185
+ declare class GuestAwareAll<T> implements GuestAwareAllType<T> {
186
+ private theAll;
186
187
  private keysKnown;
187
188
  private keysFilled;
188
- private filledChainPool;
189
+ private filledAllPool;
189
190
  constructor();
190
- resultArray(guest: GuestType<T>): this;
191
- result(guest: GuestType<T>): this;
192
- receiveKey<R>(key: string): GuestObjectType<R>;
193
- private isChainFilled;
191
+ valueArray(guest: GuestType<T>): this;
192
+ value(guest: GuestType<T>): this;
193
+ guestKey<R>(key: string): GuestObjectType<R>;
194
+ private isAllFilled;
194
195
  }
195
196
 
196
197
  /**
@@ -286,4 +287,4 @@ declare class Module<T> implements FactoryType<T> {
286
287
  create<R extends unknown[], CT = null>(...args: R): CT extends null ? T : CT;
287
288
  }
288
289
 
289
- export { type ActionType, type ChainType, Factory, type FactoryType, type GiveOptions, Guest, GuestAware, type GuestAwareAcitveType, GuestAwareActive, type GuestAwareExecutorType, GuestAwareMap, type GuestAwareObjectType, GuestAwareRace, GuestAwareSequence, type GuestAwareType, GuestCast, GuestChain, GuestDisposable, type GuestDisposableType, type GuestExecutorType, GuestObject, type GuestObjectType, GuestPool, GuestSync, type GuestType, type GuestValueType, type MaybeDisposableType, Module, Patron, PatronOnce, PatronPool, type PoolAware, type PoolType, Source, SourceDynamic, SourceEmpty, type SourceType, give, isPatronInPools, removePatronFromPools, value };
290
+ export { type ActionType, Factory, type FactoryType, type GiveOptions, Guest, GuestAware, type GuestAwareAcitveType, GuestAwareActive, GuestAwareAll, type GuestAwareAllType, type GuestAwareExecutorType, GuestAwareMap, type GuestAwareObjectType, GuestAwareRace, GuestAwareSequence, type GuestAwareType, GuestCast, GuestDisposable, type GuestDisposableType, type GuestExecutorType, GuestObject, type GuestObjectType, GuestPool, GuestSync, type GuestType, type GuestValueType, type MaybeDisposableType, Module, Patron, PatronOnce, PatronPool, type PoolAware, type PoolType, Source, SourceDynamic, SourceEmpty, type SourceType, give, isPatronInPools, removePatronFromPools, value };
package/dist/patron.js CHANGED
@@ -236,65 +236,65 @@ class GuestPool {
236
236
  var __defProp$3 = Object.defineProperty;
237
237
  var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
238
238
  var __publicField$3 = (obj, key, value) => __defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
239
- class GuestChain {
239
+ class GuestAwareAll {
240
240
  constructor() {
241
- __publicField$3(this, "theChain");
241
+ __publicField$3(this, "theAll");
242
242
  __publicField$3(this, "keysKnown", /* @__PURE__ */ new Set());
243
243
  __publicField$3(this, "keysFilled", /* @__PURE__ */ new Set());
244
- __publicField$3(this, "filledChainPool", new GuestPool(this));
245
- this.theChain = new Source({});
244
+ __publicField$3(this, "filledAllPool", new GuestPool(this));
245
+ this.theAll = new Source({});
246
246
  }
247
- resultArray(guest) {
247
+ valueArray(guest) {
248
248
  const guestObject = new GuestObject(guest);
249
- this.filledChainPool.add(
249
+ this.filledAllPool.add(
250
250
  new GuestCast(guestObject, (value) => {
251
251
  guestObject.give(Object.values(value));
252
252
  })
253
253
  );
254
- if (this.isChainFilled()) {
255
- this.theChain.value(
256
- new Guest((chain) => {
257
- this.filledChainPool.give(Object.values(chain));
254
+ if (this.isAllFilled()) {
255
+ this.theAll.value(
256
+ new Guest((all) => {
257
+ this.filledAllPool.give(Object.values(all));
258
258
  })
259
259
  );
260
260
  }
261
261
  return this;
262
262
  }
263
- result(guest) {
263
+ value(guest) {
264
264
  const guestObject = new GuestObject(guest);
265
- if (this.isChainFilled()) {
266
- this.filledChainPool.add(guestObject);
267
- this.theChain.value(
268
- new Guest((chain) => {
269
- this.filledChainPool.give(chain);
265
+ if (this.isAllFilled()) {
266
+ this.filledAllPool.add(guestObject);
267
+ this.theAll.value(
268
+ new Guest((all) => {
269
+ this.filledAllPool.give(all);
270
270
  })
271
271
  );
272
272
  } else {
273
- this.filledChainPool.add(guestObject);
273
+ this.filledAllPool.add(guestObject);
274
274
  }
275
275
  return this;
276
276
  }
277
- receiveKey(key) {
277
+ guestKey(key) {
278
278
  this.keysKnown.add(key);
279
279
  return new Guest((value) => {
280
280
  queueMicrotask(() => {
281
- this.theChain.value(
282
- new Guest((chain) => {
281
+ this.theAll.value(
282
+ new Guest((all) => {
283
283
  this.keysFilled.add(key);
284
- const lastChain = {
285
- ...chain,
284
+ const lastAll = {
285
+ ...all,
286
286
  [key]: value
287
287
  };
288
- this.theChain.give(lastChain);
289
- if (this.isChainFilled()) {
290
- this.filledChainPool.give(lastChain);
288
+ this.theAll.give(lastAll);
289
+ if (this.isAllFilled()) {
290
+ this.filledAllPool.give(lastAll);
291
291
  }
292
292
  })
293
293
  );
294
294
  });
295
295
  });
296
296
  }
297
- isChainFilled() {
297
+ isAllFilled() {
298
298
  return this.keysFilled.size > 0 && this.keysFilled.size === this.keysKnown.size;
299
299
  }
300
300
  }
@@ -331,7 +331,7 @@ class GuestAwareSequence {
331
331
  this.targetSourceFactory = targetSourceFactory;
332
332
  }
333
333
  value(guest) {
334
- const chain = new GuestChain();
334
+ const all = new GuestAwareAll();
335
335
  const sequenceSource = new SourceEmpty();
336
336
  const targetSource = this.targetSourceFactory.create(
337
337
  sequenceSource
@@ -345,12 +345,12 @@ class GuestAwareSequence {
345
345
  index = index + 1;
346
346
  handle();
347
347
  } else {
348
- chain.resultArray(guest);
348
+ all.valueArray(guest);
349
349
  }
350
350
  };
351
351
  function handle() {
352
352
  sequenceSource.give(theValue[index]);
353
- value(targetSource, chain.receiveKey("" + index));
353
+ value(targetSource, all.guestKey(index.toString()));
354
354
  value(targetSource, nextItemHandle);
355
355
  }
356
356
  if (theValue[index] !== void 0) {
@@ -370,7 +370,7 @@ class GuestAwareMap {
370
370
  this.targetSourceFactory = targetSourceFactory;
371
371
  }
372
372
  value(guest) {
373
- const chain = new GuestChain();
373
+ const all = new GuestAwareAll();
374
374
  value(
375
375
  this.baseSource,
376
376
  new GuestCast(guest, (theValue) => {
@@ -380,11 +380,11 @@ class GuestAwareMap {
380
380
  give(val, innerGuest);
381
381
  })
382
382
  );
383
- value(targetSource, chain.receiveKey("" + index));
383
+ value(targetSource, all.guestKey(index.toString()));
384
384
  });
385
385
  })
386
386
  );
387
- chain.resultArray(guest);
387
+ all.valueArray(guest);
388
388
  return this;
389
389
  }
390
390
  }
@@ -539,5 +539,5 @@ class Module {
539
539
  }
540
540
  }
541
541
 
542
- export { Factory, Guest, GuestAware, GuestAwareActive, GuestAwareMap, GuestAwareRace, GuestAwareSequence, GuestCast, GuestChain, GuestDisposable, GuestObject, GuestPool, GuestSync, Module, Patron, PatronOnce, PatronPool, Source, SourceDynamic, SourceEmpty, give, isPatronInPools, removePatronFromPools, value };
542
+ export { Factory, Guest, GuestAware, GuestAwareActive, GuestAwareAll, GuestAwareMap, GuestAwareRace, GuestAwareSequence, GuestCast, GuestDisposable, GuestObject, GuestPool, GuestSync, Module, Patron, PatronOnce, PatronPool, Source, SourceDynamic, SourceEmpty, give, isPatronInPools, removePatronFromPools, value };
543
543
  //# sourceMappingURL=patron.js.map