patron-oop 1.44.1 → 1.46.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (216) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/patron.cjs +359 -268
  3. package/dist/patron.cjs.map +1 -1
  4. package/dist/patron.d.ts +215 -150
  5. package/dist/patron.js +343 -261
  6. package/dist/patron.js.map +1 -1
  7. package/dist/patron.min.js +1 -1
  8. package/dist/patron.min.mjs +1 -1
  9. package/dist/patron.min.mjs.map +1 -1
  10. package/dist/patron.mjs +343 -261
  11. package/dist/patron.mjs.map +1 -1
  12. package/docs/README.md +3 -0
  13. package/docs/assets/css/base.css +42 -0
  14. package/docs/assets/favicon/android-icon-144x144.png +0 -0
  15. package/docs/assets/favicon/android-icon-192x192.png +0 -0
  16. package/docs/assets/favicon/android-icon-36x36.png +0 -0
  17. package/docs/assets/favicon/android-icon-48x48.png +0 -0
  18. package/docs/assets/favicon/android-icon-72x72.png +0 -0
  19. package/docs/assets/favicon/android-icon-96x96.png +0 -0
  20. package/docs/assets/favicon/apple-icon-114x114.png +0 -0
  21. package/docs/assets/favicon/apple-icon-120x120.png +0 -0
  22. package/docs/assets/favicon/apple-icon-144x144.png +0 -0
  23. package/docs/assets/favicon/apple-icon-152x152.png +0 -0
  24. package/docs/assets/favicon/apple-icon-180x180.png +0 -0
  25. package/docs/assets/favicon/apple-icon-57x57.png +0 -0
  26. package/docs/assets/favicon/apple-icon-60x60.png +0 -0
  27. package/docs/assets/favicon/apple-icon-72x72.png +0 -0
  28. package/docs/assets/favicon/apple-icon-76x76.png +0 -0
  29. package/docs/assets/favicon/apple-icon-precomposed.png +0 -0
  30. package/docs/assets/favicon/apple-icon.png +0 -0
  31. package/docs/assets/favicon/browserconfig.xml +2 -0
  32. package/docs/assets/favicon/favicon-16x16.png +0 -0
  33. package/docs/assets/favicon/favicon-32x32.png +0 -0
  34. package/docs/assets/favicon/favicon-96x96.png +0 -0
  35. package/docs/assets/favicon/favicon.ico +0 -0
  36. package/docs/assets/favicon/manifest.json +41 -0
  37. package/docs/assets/favicon/ms-icon-144x144.png +0 -0
  38. package/docs/assets/favicon/ms-icon-150x150.png +0 -0
  39. package/docs/assets/favicon/ms-icon-310x310.png +0 -0
  40. package/docs/assets/favicon/ms-icon-70x70.png +0 -0
  41. package/docs/assets/img/404.jpg +0 -0
  42. package/docs/assets/img/angular_16.jpg +0 -0
  43. package/docs/assets/img/angular_32.jpg +0 -0
  44. package/docs/assets/img/eo_16.jpg +0 -0
  45. package/docs/assets/img/eo_big.png +0 -0
  46. package/docs/assets/img/github_16.jpg +0 -0
  47. package/docs/assets/img/logo.jpg +0 -0
  48. package/docs/assets/img/philosofy/observable.jpg +0 -0
  49. package/docs/assets/img/philosofy/responsible.jpg +0 -0
  50. package/docs/assets/img/philosofy/result.jpg +0 -0
  51. package/docs/assets/img/philosofy/tell.jpg +0 -0
  52. package/docs/assets/img/react_16.jpg +0 -0
  53. package/docs/assets/img/react_32.jpg +0 -0
  54. package/docs/assets/img/vue_16.jpg +0 -0
  55. package/docs/assets/img/vue_32.jpg +0 -0
  56. package/docs/assets/js/components/linkDynamic.mjs +11 -0
  57. package/docs/assets/js/components/linkReloadable.mjs +13 -0
  58. package/docs/assets/js/entrypoints/compatibility.mjs +31 -0
  59. package/docs/assets/js/entrypoints/components.mjs +2 -0
  60. package/docs/assets/js/entrypoints/examples.mjs +25 -0
  61. package/docs/assets/js/entrypoints/factory.mjs +20 -0
  62. package/docs/assets/js/entrypoints/guest.mjs +61 -0
  63. package/docs/assets/js/entrypoints/index.mjs +110 -0
  64. package/docs/assets/js/entrypoints/integrations.mjs +36 -0
  65. package/docs/assets/js/entrypoints/patron.mjs +46 -0
  66. package/docs/assets/js/entrypoints/source.mjs +76 -0
  67. package/docs/assets/js/entrypoints/terminology.mjs +51 -0
  68. package/docs/assets/js/entrypoints/utils.mjs +61 -0
  69. package/docs/assets/js/lib/StyleFetched.mjs +14 -0
  70. package/docs/assets/js/routing.mjs +110 -0
  71. package/docs/assets/schemes/dip.html +28 -0
  72. package/docs/favicon.ico +0 -0
  73. package/docs/index-dev.html +346 -0
  74. package/docs/index.html +346 -0
  75. package/docs/manifest.json +41 -0
  76. package/docs/pages/404.html +9 -0
  77. package/docs/pages/common/layout.html +17 -0
  78. package/docs/pages/compatibility/dip.html +82 -0
  79. package/docs/pages/compatibility/elegant-objects.html +373 -0
  80. package/docs/pages/compatibility/layout.html +17 -0
  81. package/docs/pages/examples/errors.html +167 -0
  82. package/docs/pages/examples/index.html +10 -0
  83. package/docs/pages/examples.html +41 -0
  84. package/docs/pages/factory/index.html +18 -0
  85. package/docs/pages/factory.html +36 -0
  86. package/docs/pages/guest/guest-applied.html +51 -0
  87. package/docs/pages/guest/guest-cast.html +219 -0
  88. package/docs/pages/guest/guest-disposable.html +147 -0
  89. package/docs/pages/guest/guest-executor-applied.html +65 -0
  90. package/docs/pages/guest/guest-object.html +101 -0
  91. package/docs/pages/guest/guest-pool.html +107 -0
  92. package/docs/pages/guest/guest-sync.html +66 -0
  93. package/docs/pages/guest/index.html +115 -0
  94. package/docs/pages/guest.html +59 -0
  95. package/docs/pages/index.html +72 -0
  96. package/docs/pages/integrations/angular.html +5 -0
  97. package/docs/pages/integrations/layout.html +17 -0
  98. package/docs/pages/integrations/react.html +7 -0
  99. package/docs/pages/integrations/vue.html +102 -0
  100. package/docs/pages/patron/index.html +140 -0
  101. package/docs/pages/patron/patron-applied.html +66 -0
  102. package/docs/pages/patron/patron-executor-applied.html +94 -0
  103. package/docs/pages/patron/patron-once.html +110 -0
  104. package/docs/pages/patron/patron-pool.html +99 -0
  105. package/docs/pages/patron.html +50 -0
  106. package/docs/pages/philosofy.html +210 -0
  107. package/docs/pages/source/index.html +167 -0
  108. package/docs/pages/source/source-active.html +113 -0
  109. package/docs/pages/source/source-all.html +129 -0
  110. package/docs/pages/source/source-applied.html +73 -0
  111. package/docs/pages/source/source-dynamic.html +93 -0
  112. package/docs/pages/source/source-executor-applied.html +64 -0
  113. package/docs/pages/source/source-map.html +192 -0
  114. package/docs/pages/source/source-once.html +73 -0
  115. package/docs/pages/source/source-race.html +171 -0
  116. package/docs/pages/source/source-sequence.html +160 -0
  117. package/docs/pages/source/source-with-pool.html +102 -0
  118. package/docs/pages/source/source.html +167 -0
  119. package/docs/pages/source.html +68 -0
  120. package/docs/pages/terminology/guest.html +14 -0
  121. package/docs/pages/terminology/index.html +6 -0
  122. package/docs/pages/terminology/introduction.html +25 -0
  123. package/docs/pages/terminology/patron.html +10 -0
  124. package/docs/pages/terminology/source.html +55 -0
  125. package/docs/pages/terminology/visitor.html +19 -0
  126. package/docs/pages/terminology.html +53 -0
  127. package/docs/pages/utils/give.html +47 -0
  128. package/docs/pages/utils/index.html +24 -0
  129. package/docs/pages/utils/is-guest-aware.html +22 -0
  130. package/docs/pages/utils/is-guest.html +21 -0
  131. package/docs/pages/utils/is-patron-in-pools.html +53 -0
  132. package/docs/pages/utils/private.html +44 -0
  133. package/docs/pages/utils/remove-patron-from-pools.html +57 -0
  134. package/docs/pages/utils/value.html +47 -0
  135. package/docs/pages/utils.html +61 -0
  136. package/eslint.config.mjs +6 -0
  137. package/package.json +1 -1
  138. package/src/Guest/Guest.test.ts +11 -6
  139. package/src/Guest/Guest.ts +7 -14
  140. package/src/Guest/GuestApplied.test.ts +13 -0
  141. package/src/Guest/GuestApplied.ts +16 -0
  142. package/src/Guest/GuestCast.test.ts +4 -5
  143. package/src/Guest/GuestCast.ts +3 -10
  144. package/src/Guest/GuestDisposable.test.ts +13 -17
  145. package/src/Guest/GuestDisposable.ts +3 -3
  146. package/src/Guest/GuestExecutorApplied.test.ts +27 -0
  147. package/src/Guest/GuestExecutorApplied.ts +23 -0
  148. package/src/Guest/GuestObject.test.ts +6 -6
  149. package/src/Guest/GuestObject.ts +3 -3
  150. package/src/Guest/GuestPool.test.ts +5 -22
  151. package/src/Guest/GuestPool.ts +7 -8
  152. package/src/Guest/GuestSync.test.ts +2 -2
  153. package/src/Patron/Patron.test.ts +4 -5
  154. package/src/Patron/Patron.ts +11 -3
  155. package/src/Patron/PatronApplied.ts +22 -0
  156. package/src/Patron/PatronExecutorApplied.ts +25 -0
  157. package/src/Patron/PatronOnce.sourceEmpty.test.ts +2 -2
  158. package/src/Patron/PatronOnce.test.ts +2 -2
  159. package/src/Patron/PatronOnce.ts +3 -9
  160. package/src/Patron/PatronPool.test.ts +2 -1
  161. package/src/Patron/PatronPool.ts +22 -27
  162. package/src/Private/PrivateClass.modules.test.ts +11 -8
  163. package/src/Private/PrivateClass.test.ts +7 -6
  164. package/src/Source/Source.test.ts +9 -5
  165. package/src/Source/Source.ts +46 -30
  166. package/src/Source/SourceActive.test.ts +13 -0
  167. package/src/Source/SourceActive.ts +41 -0
  168. package/src/Source/SourceAll._asArray.test.ts +22 -0
  169. package/src/Source/SourceAll._twoValuesAfter.test.ts +19 -0
  170. package/src/Source/SourceAll._twoValuesBefore.test.ts +19 -0
  171. package/src/Source/SourceAll._withPatron.test.ts +25 -0
  172. package/src/{Guest/GuestAwareAll.ts → Source/SourceAll.ts} +11 -11
  173. package/src/Source/SourceApplied.test.ts +14 -0
  174. package/src/Source/SourceApplied.ts +23 -0
  175. package/src/Source/SourceDynamic.ofSource.test.ts +12 -12
  176. package/src/Source/SourceDynamic.test.ts +9 -9
  177. package/src/Source/SourceDynamic.ts +7 -7
  178. package/src/Source/SourceExecutorApplied.test.ts +30 -0
  179. package/src/Source/SourceExecutorApplied.ts +22 -0
  180. package/src/Source/SourceMap.defered.test.ts +46 -0
  181. package/src/Source/SourceMap.fn.test.ts +27 -0
  182. package/src/Source/SourceMap.test.ts +32 -0
  183. package/src/Source/SourceMap.ts +48 -0
  184. package/src/Source/SourceOnce.notcalled.test.ts +4 -4
  185. package/src/Source/SourceOnce.test.ts +4 -5
  186. package/src/Source/SourceOnce.ts +7 -13
  187. package/src/Source/SourceRace.test.ts +46 -0
  188. package/src/Source/SourceRace.ts +30 -0
  189. package/src/Source/SourceSequence.defered.test.ts +53 -0
  190. package/src/Source/SourceSequence.test.ts +30 -0
  191. package/src/{Guest/GuestAwareSequence.ts → Source/SourceSequence.ts} +14 -19
  192. package/src/Source/SourceWithPool.empty.test.ts +14 -0
  193. package/src/Source/SourceWithPool.test.ts +10 -0
  194. package/src/Source/SourceWithPool.ts +58 -0
  195. package/src/index.ts +13 -7
  196. package/test-utils/debounce.ts +11 -0
  197. package/test-utils/id.ts +1 -0
  198. package/test-utils/wait.ts +6 -3
  199. package/src/Guest/GuestAware.test.ts +0 -13
  200. package/src/Guest/GuestAware.ts +0 -59
  201. package/src/Guest/GuestAwareActive.test.ts +0 -12
  202. package/src/Guest/GuestAwareActive.ts +0 -42
  203. package/src/Guest/GuestAwareAll._asArray.test.ts +0 -19
  204. package/src/Guest/GuestAwareAll._twoValuesAfter.test.ts +0 -16
  205. package/src/Guest/GuestAwareAll._twoValuesBefore.test.ts +0 -16
  206. package/src/Guest/GuestAwareAll._withPatron.test.ts +0 -22
  207. package/src/Guest/GuestAwareMap.defered.test.ts +0 -46
  208. package/src/Guest/GuestAwareMap.fn.test.ts +0 -27
  209. package/src/Guest/GuestAwareMap.test.ts +0 -29
  210. package/src/Guest/GuestAwareMap.ts +0 -48
  211. package/src/Guest/GuestAwareRace.test.ts +0 -46
  212. package/src/Guest/GuestAwareRace.ts +0 -33
  213. package/src/Guest/GuestAwareSequence.defered.test.ts +0 -58
  214. package/src/Guest/GuestAwareSequence.test.ts +0 -30
  215. package/src/Source/SourceEmpty.test.ts +0 -20
  216. package/src/Source/SourceEmpty.ts +0 -31
package/dist/patron.d.ts CHANGED
@@ -1,17 +1,14 @@
1
1
  type GuestIntroduction = "guest" | "patron";
2
- interface GiveOptions {
3
- data?: unknown;
4
- }
5
- type GuestExecutorType<T = any, This = void> = (value: T, options?: GiveOptions) => This;
2
+ type GuestExecutorType<T = any, This = void> = (value: T) => This;
6
3
  interface GuestObjectType<T = any> {
7
- give(value: T, options?: GiveOptions): this;
4
+ give(value: T): this;
8
5
  introduction?(): GuestIntroduction;
9
6
  }
10
7
  type GuestType<T = any> = GuestExecutorType<T> | GuestObjectType<T>;
11
8
  /**
12
9
  * @url https://kosukhin.github.io/patron.site/#/utils/give
13
10
  */
14
- declare function give<T>(data: T, guest: GuestType<T>, options?: GiveOptions): void;
11
+ declare function give<T>(data: T, guest: GuestType<T>): void;
15
12
  /**
16
13
  * @url https://kosukhin.github.io/patron.site/#/utils/is-guest
17
14
  */
@@ -22,72 +19,40 @@ declare function isGuest(mbGuest: any): mbGuest is GuestType;
22
19
  declare class Guest<T> implements GuestObjectType<T> {
23
20
  private receiver;
24
21
  constructor(receiver: GuestExecutorType<T>);
25
- give(value: T, options?: GiveOptions): this;
26
- }
27
-
28
- type GuestAwareExecutorType<T> = (guest: GuestType<T>) => unknown;
29
- interface GuestAwareObjectType<T> {
30
- value: GuestAwareExecutorType<T>;
31
- }
32
- type GuestAwareType<T = any> = GuestAwareExecutorType<T> | GuestAwareObjectType<T>;
33
- /**
34
- * @url https://kosukhin.github.io/patron.site/#/utils/give
35
- */
36
- declare function value<T>(guestAware: GuestAwareType<T>, guest: GuestType<T>): unknown;
37
- /**
38
- * @url https://kosukhin.github.io/patron.site/#/utils/is-guest-aware
39
- */
40
- declare function isGuestAware(mbGuestAware: any): mbGuestAware is GuestAwareType;
41
- /**
42
- * @url https://kosukhin.github.io/patron.site/#/guest/guest-aware
43
- */
44
- declare class GuestAware<T = any> implements GuestAwareObjectType<T> {
45
- private guestAware;
46
- constructor(guestAware: GuestAwareType<T>);
47
- value(guest: GuestType<T>): GuestType<T>;
22
+ give(value: T): this;
48
23
  }
49
24
 
50
- /**
51
- * @url https://kosukhin.github.io/patron.site/#/utils/private
52
- */
53
- interface PrivateType<T> {
54
- get<R extends unknown[], CT = null>(...args: R): CT extends null ? T : CT;
55
- }
56
- declare class Private<T> implements PrivateType<T> {
57
- private buildingFn;
58
- constructor(buildingFn: (...args: any[]) => T);
59
- get<R extends unknown[], CT = null>(...args: R): CT extends null ? T : CT;
25
+ interface GuestDisposableType<T = any> extends GuestObjectType<T> {
26
+ disposed(value: T | null): boolean;
60
27
  }
61
-
28
+ type MaybeDisposableType<T = any> = Partial<GuestDisposableType<T>>;
62
29
  /**
63
- * @url https://kosukhin.github.io/patron.site/#/guest/guest-aware-sequence
30
+ * @url https://kosukhin.github.io/patron.site/#/guest/guest-disposable
64
31
  */
65
- declare class GuestAwareSequence<T, TG> implements GuestAwareObjectType<TG[]> {
66
- private baseSource;
67
- private targetSource;
68
- constructor(baseSource: GuestAwareType<T[]>, targetSource: PrivateType<GuestAwareType<TG>>);
69
- value(guest: GuestType<TG[]>): this;
32
+ declare class GuestDisposable<T> implements GuestDisposableType<T> {
33
+ private guest;
34
+ private disposeCheck;
35
+ constructor(guest: GuestType, disposeCheck: (value: T | null) => boolean);
36
+ disposed(value: T | null): boolean;
37
+ give(value: T): this;
70
38
  }
71
39
 
72
40
  /**
73
- * @url https://kosukhin.github.io/patron.site/#/guest/guest-aware-map
41
+ * @url https://kosukhin.github.io/patron.site/#/guest/guest-cast
74
42
  */
75
- declare class GuestAwareMap<T, TG> implements GuestAwareObjectType<TG[]> {
76
- private baseSource;
77
- private targetSource;
78
- constructor(baseSource: GuestAwareType<T[]>, targetSource: PrivateType<GuestAwareType<TG>>);
79
- value(guest: GuestType<TG[]>): this;
43
+ declare class GuestCast<T> implements GuestDisposableType<T> {
44
+ private sourceGuest;
45
+ private targetGuest;
46
+ constructor(sourceGuest: GuestType<any>, targetGuest: GuestType<T>);
47
+ introduction(): "guest" | "patron";
48
+ give(value: T): this;
49
+ disposed(value: T | null): boolean;
80
50
  }
81
51
 
82
52
  /**
83
- * @url https://kosukhin.github.io/patron.site/#/guest/guest-aware-race
53
+ * @url https://kosukhin.github.io/patron.site/#/utils/patron-pools
84
54
  */
85
- declare class GuestAwareRace<T> implements GuestAwareObjectType<T> {
86
- private guestAwares;
87
- constructor(guestAwares: GuestAwareType<T>[]);
88
- value(guest: GuestType<T>): this;
89
- }
90
-
55
+ declare const patronPools: (patron: GuestObjectType) => PoolType<any>[];
91
56
  /**
92
57
  * @url https://kosukhin.github.io/patron.site/#/utils/remove-patron-from-pools
93
58
  */
@@ -108,7 +73,7 @@ interface PoolType<T = any> extends GuestObjectType<T> {
108
73
  declare class PatronPool<T> implements PoolType<T> {
109
74
  private initiator;
110
75
  private patrons;
111
- give: (value: T, options?: GiveOptions) => this;
76
+ give: (value: T) => this;
112
77
  constructor(initiator: unknown);
113
78
  size(): number;
114
79
  add(shouldBePatron: GuestType<T>): this;
@@ -118,76 +83,144 @@ declare class PatronPool<T> implements PoolType<T> {
118
83
  private guestDisposed;
119
84
  }
120
85
 
121
- interface PoolAware<T = any> {
122
- pool(): PatronPool<T>;
86
+ /**
87
+ * @url https://kosukhin.github.io/patron.site/#/guest/guest-pool
88
+ */
89
+ declare class GuestPool<T> implements GuestObjectType<T>, PoolType<T> {
90
+ private guests;
91
+ private patronPool;
92
+ constructor(initiator: unknown);
93
+ give(value: T): this;
94
+ add(guest: GuestType<T>): this;
95
+ remove(patron: GuestObjectType<T>): this;
96
+ distribute(receiving: T, possiblePatron: GuestObjectType<T>): this;
97
+ size(): number;
98
+ private deliverToGuests;
99
+ }
100
+
101
+ interface GuestValueType<T = any> extends GuestObjectType<T> {
102
+ value(): T;
123
103
  }
124
104
  /**
125
- * @url https://kosukhin.github.io/patron.site/#/source
105
+ * @url https://kosukhin.github.io/patron.site/#/guest/guest-sync
126
106
  */
127
- type SourceType<T = any> = GuestAwareObjectType<T> & GuestObjectType<T> & PoolAware<T>;
128
- declare class Source<T> implements SourceType<T> {
129
- private sourceDocument;
130
- private thePool;
131
- constructor(sourceDocument: T);
132
- pool(): PatronPool<unknown>;
107
+ declare class GuestSync<T> implements GuestValueType<T> {
108
+ private theValue;
109
+ constructor(theValue: T);
133
110
  give(value: T): this;
134
- value(guest: GuestType<T>): this;
111
+ value(): T;
135
112
  }
136
113
 
137
114
  /**
138
- * @url https://kosukhin.github.io/patron.site/#/utils/action-type
115
+ * @url https://kosukhin.github.io/patron.site/#/guest/guest-object
139
116
  */
140
- interface ActionType<P = any> {
141
- do(config: P): this;
117
+ declare class GuestObject<T> implements GuestDisposableType<T> {
118
+ private baseGuest;
119
+ constructor(baseGuest: GuestType<T>);
120
+ give(value: T): this;
121
+ introduction(): "guest" | "patron";
122
+ disposed(value: T | null): boolean;
142
123
  }
143
- interface GuestAwareAcitveType<R = unknown, T = unknown> extends GuestAwareObjectType<T>, ActionType<R> {
124
+
125
+ /**
126
+ * @url https://kosukhin.github.io/patron.site/#/guest/guest-applied
127
+ */
128
+ declare class GuestApplied<T, R> implements GuestObjectType<T> {
129
+ private baseGuest;
130
+ private applier;
131
+ constructor(baseGuest: GuestType<R>, applier: (value: T) => R);
132
+ give(value: T): this;
144
133
  }
134
+
145
135
  /**
146
- * @url https://kosukhin.github.io/patron.site/#/guest/guest-aware-active
136
+ * @url https://kosukhin.github.io/patron.site/#/guest/guest-executor-applied
147
137
  */
148
- declare class GuestAwareActive<R, T> implements GuestAwareAcitveType<R, T> {
149
- private configExecutor;
150
- private source;
151
- constructor(configExecutor: (config: R, source: SourceType<T>) => void);
152
- do(config: R): this;
153
- value(guest: GuestType<T>): this;
138
+ declare class GuestExecutorApplied<T> implements GuestObjectType<T> {
139
+ give: GuestExecutorType<T, this>;
140
+ constructor(baseGuest: GuestType<T>, applier: (executor: GuestExecutorType) => GuestExecutorType);
154
141
  }
155
142
 
156
- interface GuestDisposableType<T = any> extends GuestObjectType<T> {
143
+ /**
144
+ * @url https://kosukhin.github.io/patron.site/#/patron
145
+ */
146
+ declare class Patron<T> implements GuestDisposableType<T> {
147
+ private willBePatron;
148
+ constructor(willBePatron: GuestType<T>);
149
+ introduction(): "patron";
150
+ give(value: T): this;
157
151
  disposed(value: T | null): boolean;
158
152
  }
159
- type MaybeDisposableType<T = any> = Partial<GuestDisposableType<T>>;
160
153
  /**
161
- * @url https://kosukhin.github.io/patron.site/#/guest/guest-disposable
154
+ * @url https://kosukhin.github.io/patron.site/#/utils/is-patron
162
155
  */
163
- declare class GuestDisposable<T> implements GuestDisposableType<T> {
164
- private guest;
165
- private disposeCheck;
166
- constructor(guest: GuestType, disposeCheck: (value: T | null) => boolean);
156
+ declare const isPatron: (guest: GuestType) => guest is Patron<unknown>;
157
+
158
+ /**
159
+ * @url https://kosukhin.github.io/patron.site/#/patron/patron-once
160
+ */
161
+ declare class PatronOnce<T> implements GuestDisposableType<T> {
162
+ private baseGuest;
163
+ private received;
164
+ constructor(baseGuest: GuestType<T>);
165
+ introduction(): "patron";
166
+ give(value: T): this;
167
167
  disposed(value: T | null): boolean;
168
- give(value: T, options?: GiveOptions): this;
169
168
  }
170
169
 
171
170
  /**
172
- * @url https://kosukhin.github.io/patron.site/#/guest/guest-cast
171
+ * @url https://kosukhin.github.io/patron.site/#/patron/patron-applied
173
172
  */
174
- declare class GuestCast<T> implements GuestDisposableType<T> {
175
- private sourceGuest;
176
- private targetGuest;
177
- constructor(sourceGuest: GuestType<any>, targetGuest: GuestType<T>);
173
+ declare class PatronApplied<T, R> implements GuestObjectType<T> {
174
+ private guestApplied;
175
+ constructor(baseGuest: GuestType<R>, applier: (value: T) => R);
176
+ give(value: T): this;
178
177
  introduction(): "guest" | "patron";
179
- give(value: T, options?: GiveOptions): this;
180
- disposed(value: T | null): boolean;
181
178
  }
182
179
 
183
- interface GuestAwareAllType<T = any> extends GuestAwareObjectType<T> {
180
+ /**
181
+ * @url https://kosukhin.github.io/patron.site/#/patron/patron-executor-applied
182
+ */
183
+ declare class PatronExecutorApplied<T> implements GuestObjectType<T> {
184
+ private guestApplied;
185
+ constructor(baseGuest: GuestType<T>, applier: (executor: GuestExecutorType) => GuestExecutorType);
186
+ give(value: T): this;
187
+ introduction(): "guest" | "patron";
188
+ }
189
+
190
+ type SourceExecutorType<T> = (guest: GuestType<T>) => unknown;
191
+ interface SourceObjectType<T> {
192
+ value: SourceExecutorType<T>;
193
+ }
194
+ type SourceType<T = any> = SourceExecutorType<T> | SourceObjectType<T>;
195
+ /**
196
+ * @url https://kosukhin.github.io/patron.site/#/utils/value
197
+ */
198
+ declare function value<T>(source: SourceType<T>, guest: GuestType<T>): unknown;
199
+ /**
200
+ * @url https://kosukhin.github.io/patron.site/#/utils/is-source
201
+ */
202
+ declare function isSource(mbSource: any): mbSource is SourceType;
203
+ /**
204
+ * @url https://kosukhin.github.io/patron.site/#/guest/source
205
+ */
206
+ declare class Source<T = any> implements SourceObjectType<T> {
207
+ private source;
208
+ constructor(source: SourceType<T>);
209
+ value(guest: GuestType<T>): GuestType<T>;
210
+ }
211
+ /**
212
+ * @url https://kosukhin.github.io/patron.site/#/utils/source-of
213
+ */
214
+ declare const sourceOf: <T>(value: T) => Source<T>;
215
+
216
+ interface SourceAllType<T = any> extends SourceObjectType<T> {
184
217
  valueArray(guest: GuestObjectType<T>): this;
185
218
  guestKey<R>(key: string): GuestObjectType<R>;
186
219
  }
187
220
  /**
188
- * @url https://kosukhin.github.io/patron.site/#/guest/guest-aware-all
221
+ * @url https://kosukhin.github.io/patron.site/#/guest/source-all
189
222
  */
190
- declare class GuestAwareAll<T> implements GuestAwareAllType<T> {
223
+ declare class SourceAll<T> implements SourceAllType<T> {
191
224
  private theAll;
192
225
  private keysKnown;
193
226
  private keysFilled;
@@ -200,88 +233,120 @@ declare class GuestAwareAll<T> implements GuestAwareAllType<T> {
200
233
  }
201
234
 
202
235
  /**
203
- * @url https://kosukhin.github.io/patron.site/#/guest/guest-pool
236
+ * @url https://kosukhin.github.io/patron.site/#/utils/private
204
237
  */
205
- declare class GuestPool<T> implements GuestObjectType<T>, PoolType<T> {
206
- private guests;
207
- private patronPool;
208
- constructor(initiator: unknown);
209
- give(value: T, options?: GiveOptions): this;
210
- add(guest: GuestType<T>): this;
211
- remove(patron: GuestObjectType<T>): this;
212
- distribute(receiving: T, possiblePatron: GuestObjectType<T>): this;
213
- size(): number;
214
- private deliverToGuests;
238
+ interface PrivateType<T> {
239
+ get<R extends unknown[], CT = null>(...args: R): CT extends null ? T : CT;
240
+ }
241
+ declare class Private<T> implements PrivateType<T> {
242
+ private buildingFn;
243
+ constructor(buildingFn: (...args: any[]) => T);
244
+ get<R extends unknown[], CT = null>(...args: R): CT extends null ? T : CT;
215
245
  }
216
246
 
217
- interface GuestValueType<T = any> extends GuestObjectType<T> {
218
- value(): T;
247
+ /**
248
+ * @url https://kosukhin.github.io/patron.site/#/guest/source-sequence
249
+ */
250
+ declare class SourceSequence<T, TG> implements SourceObjectType<TG[]> {
251
+ private baseSource;
252
+ private targetSource;
253
+ constructor(baseSource: SourceType<T[]>, targetSource: PrivateType<SourceType<TG>>);
254
+ value(guest: GuestType<TG[]>): this;
219
255
  }
256
+
220
257
  /**
221
- * @url https://kosukhin.github.io/patron.site/#/guest/guest-sync
258
+ * @url https://kosukhin.github.io/patron.site/#/guest/source-map
222
259
  */
223
- declare class GuestSync<T> implements GuestValueType<T> {
224
- private theValue;
225
- constructor(theValue: T);
226
- give(value: T): this;
227
- value(): T;
260
+ declare class SourceMap<T, TG> implements SourceObjectType<TG[]> {
261
+ private baseSource;
262
+ private targetSource;
263
+ constructor(baseSource: SourceType<T[]>, targetSource: PrivateType<SourceType<TG>>);
264
+ value(guest: GuestType<TG[]>): this;
228
265
  }
229
266
 
230
267
  /**
231
- * @url https://kosukhin.github.io/patron.site/#/guest/guest-object
268
+ * @url https://kosukhin.github.io/patron.site/#/guest/source-race
232
269
  */
233
- declare class GuestObject<T> implements GuestDisposableType<T> {
234
- private baseGuest;
235
- constructor(baseGuest: GuestType<T>);
236
- give(value: T, options?: GiveOptions): this;
237
- introduction(): "guest" | "patron";
238
- disposed(value: T | null): boolean;
270
+ declare class SourceRace<T> implements SourceObjectType<T> {
271
+ private sources;
272
+ constructor(sources: SourceType<T>[]);
273
+ value(guest: GuestType<T>): this;
239
274
  }
240
275
 
276
+ interface PoolAwareType<T = any> {
277
+ pool(): PatronPool<T>;
278
+ }
241
279
  /**
242
- * @url https://kosukhin.github.io/patron.site/#/patron
280
+ * @url https://kosukhin.github.io/patron.site/#/source-with-pool
243
281
  */
244
- declare class Patron<T> implements GuestDisposableType<T> {
245
- private willBePatron;
246
- constructor(willBePatron: GuestType<T>);
247
- introduction(): "patron";
248
- give(value: T, options?: GiveOptions): this;
249
- disposed(value: T | null): boolean;
282
+ type SourceWithPoolType<T = any> = SourceObjectType<T> & GuestObjectType<T> & PoolAwareType<T>;
283
+ declare class SourceWithPool<T> implements SourceWithPoolType<T> {
284
+ private sourceDocument?;
285
+ private thePool;
286
+ private theEmptyPool;
287
+ private isEmpty;
288
+ constructor(sourceDocument?: T | undefined);
289
+ pool(): PatronPool<unknown>;
290
+ give(value: T): this;
291
+ value(guest: GuestType<T>): this;
292
+ filled(): boolean;
250
293
  }
251
294
 
252
- type PoolAwareOptions = {
253
- pool?: PoolType;
254
- castedGuest?: GuestObjectType;
255
- };
256
295
  /**
257
- * @url https://kosukhin.github.io/patron.site/#/patron/patron-once
296
+ * @url https://kosukhin.github.io/patron.site/#/utils/action-type
258
297
  */
259
- declare class PatronOnce<T> implements GuestDisposableType<T> {
260
- private baseGuest;
261
- private received;
262
- constructor(baseGuest: GuestType<T>);
263
- introduction(): "patron";
264
- give(value: T, options?: GiveOptions): this;
265
- disposed(value: T | null): boolean;
298
+ interface ActionType<P = any> {
299
+ do(config: P): this;
300
+ }
301
+ interface SourceAcitveType<R = unknown, T = unknown> extends SourceObjectType<T>, ActionType<R> {
302
+ }
303
+ /**
304
+ * @url https://kosukhin.github.io/patron.site/#/guest/source-active
305
+ */
306
+ declare class SourceActive<R, T> implements SourceAcitveType<R, T> {
307
+ private configExecutor;
308
+ private source;
309
+ constructor(configExecutor: (config: R, source: SourceWithPoolType<T>) => void);
310
+ do(config: R): this;
311
+ value(guest: GuestType<T>): this;
266
312
  }
267
313
 
268
314
  /**
269
315
  * @url https://kosukhin.github.io/patron.site/#/source-dynamic
270
316
  */
271
- declare class SourceDynamic<T = unknown> implements SourceType<T> {
317
+ declare class SourceDynamic<T = unknown> implements SourceWithPoolType<T> {
272
318
  private baseGuest;
273
- private baseGuestAware;
274
- constructor(baseGuest: GuestType<T>, baseGuestAware: GuestAwareType<T>);
319
+ private baseSource;
320
+ constructor(baseGuest: GuestType<T>, baseSource: SourceType<T>);
275
321
  value(guest: GuestType<T>): this;
276
322
  give(value: T): this;
277
323
  pool(): PatronPool<T>;
278
324
  }
279
325
 
280
326
  /**
281
- * @url https://kosukhin.github.io/patron.site/#/source/source-empty
327
+ * @url https://kosukhin.github.io/patron.site/#/source/source-applied
282
328
  */
283
- declare class SourceEmpty<T> implements SourceType<T> {
329
+ declare class SourceApplied<T, R> implements SourceObjectType<R> {
284
330
  private baseSource;
331
+ private applier;
332
+ constructor(baseSource: SourceType<T>, applier: (v: T) => R);
333
+ value(g: GuestType<R>): this;
334
+ }
335
+
336
+ /**
337
+ * @url https://kosukhin.github.io/patron.site/#/source/source-executor-applied
338
+ */
339
+ declare class SourceExecutorApplied<T> implements SourceObjectType<T> {
340
+ value: SourceExecutorType<T>;
341
+ constructor(source: SourceType<T>, applier: (executor: SourceExecutorType<T>) => SourceExecutorType<T>);
342
+ }
343
+
344
+ /**
345
+ * @url https://kosukhin.github.io/patron.site/#/source/source-once
346
+ */
347
+ declare class SourceOnce<T> implements SourceWithPoolType<T> {
348
+ private source;
349
+ constructor(initialValue?: T);
285
350
  value(guest: GuestType<T>): this;
286
351
  give(value: T): this;
287
352
  pool(): PatronPool<T>;
@@ -297,4 +362,4 @@ declare class PrivateClass<T> implements PrivateType<T> {
297
362
  get<R extends unknown[], CT = null>(...args: R): CT extends null ? T : CT;
298
363
  }
299
364
 
300
- export { type ActionType, 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, Patron, PatronOnce, PatronPool, type PoolAware, type PoolAwareOptions, type PoolType, Private, PrivateClass, type PrivateType, Source, SourceDynamic, SourceEmpty, type SourceType, give, isGuest, isGuestAware, isPatronInPools, removePatronFromPools, value };
365
+ export { type ActionType, Guest, GuestApplied, GuestCast, GuestDisposable, type GuestDisposableType, GuestExecutorApplied, type GuestExecutorType, GuestObject, type GuestObjectType, GuestPool, GuestSync, type GuestType, type GuestValueType, type MaybeDisposableType, Patron, PatronApplied, PatronExecutorApplied, PatronOnce, PatronPool, type PoolAwareType, type PoolType, Private, PrivateClass, type PrivateType, Source, type SourceAcitveType, SourceActive, SourceAll, type SourceAllType, SourceApplied, SourceDynamic, SourceExecutorApplied, type SourceExecutorType, SourceMap, type SourceObjectType, SourceOnce, SourceRace, SourceSequence, type SourceType, SourceWithPool, type SourceWithPoolType, give, isGuest, isPatron, isPatronInPools, isSource, patronPools, removePatronFromPools, sourceOf, value };