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.
- package/CHANGELOG.md +20 -0
- package/dist/patron.cjs +359 -268
- package/dist/patron.cjs.map +1 -1
- package/dist/patron.d.ts +215 -150
- package/dist/patron.js +343 -261
- package/dist/patron.js.map +1 -1
- package/dist/patron.min.js +1 -1
- package/dist/patron.min.mjs +1 -1
- package/dist/patron.min.mjs.map +1 -1
- package/dist/patron.mjs +343 -261
- package/dist/patron.mjs.map +1 -1
- package/docs/README.md +3 -0
- package/docs/assets/css/base.css +42 -0
- package/docs/assets/favicon/android-icon-144x144.png +0 -0
- package/docs/assets/favicon/android-icon-192x192.png +0 -0
- package/docs/assets/favicon/android-icon-36x36.png +0 -0
- package/docs/assets/favicon/android-icon-48x48.png +0 -0
- package/docs/assets/favicon/android-icon-72x72.png +0 -0
- package/docs/assets/favicon/android-icon-96x96.png +0 -0
- package/docs/assets/favicon/apple-icon-114x114.png +0 -0
- package/docs/assets/favicon/apple-icon-120x120.png +0 -0
- package/docs/assets/favicon/apple-icon-144x144.png +0 -0
- package/docs/assets/favicon/apple-icon-152x152.png +0 -0
- package/docs/assets/favicon/apple-icon-180x180.png +0 -0
- package/docs/assets/favicon/apple-icon-57x57.png +0 -0
- package/docs/assets/favicon/apple-icon-60x60.png +0 -0
- package/docs/assets/favicon/apple-icon-72x72.png +0 -0
- package/docs/assets/favicon/apple-icon-76x76.png +0 -0
- package/docs/assets/favicon/apple-icon-precomposed.png +0 -0
- package/docs/assets/favicon/apple-icon.png +0 -0
- package/docs/assets/favicon/browserconfig.xml +2 -0
- package/docs/assets/favicon/favicon-16x16.png +0 -0
- package/docs/assets/favicon/favicon-32x32.png +0 -0
- package/docs/assets/favicon/favicon-96x96.png +0 -0
- package/docs/assets/favicon/favicon.ico +0 -0
- package/docs/assets/favicon/manifest.json +41 -0
- package/docs/assets/favicon/ms-icon-144x144.png +0 -0
- package/docs/assets/favicon/ms-icon-150x150.png +0 -0
- package/docs/assets/favicon/ms-icon-310x310.png +0 -0
- package/docs/assets/favicon/ms-icon-70x70.png +0 -0
- package/docs/assets/img/404.jpg +0 -0
- package/docs/assets/img/angular_16.jpg +0 -0
- package/docs/assets/img/angular_32.jpg +0 -0
- package/docs/assets/img/eo_16.jpg +0 -0
- package/docs/assets/img/eo_big.png +0 -0
- package/docs/assets/img/github_16.jpg +0 -0
- package/docs/assets/img/logo.jpg +0 -0
- package/docs/assets/img/philosofy/observable.jpg +0 -0
- package/docs/assets/img/philosofy/responsible.jpg +0 -0
- package/docs/assets/img/philosofy/result.jpg +0 -0
- package/docs/assets/img/philosofy/tell.jpg +0 -0
- package/docs/assets/img/react_16.jpg +0 -0
- package/docs/assets/img/react_32.jpg +0 -0
- package/docs/assets/img/vue_16.jpg +0 -0
- package/docs/assets/img/vue_32.jpg +0 -0
- package/docs/assets/js/components/linkDynamic.mjs +11 -0
- package/docs/assets/js/components/linkReloadable.mjs +13 -0
- package/docs/assets/js/entrypoints/compatibility.mjs +31 -0
- package/docs/assets/js/entrypoints/components.mjs +2 -0
- package/docs/assets/js/entrypoints/examples.mjs +25 -0
- package/docs/assets/js/entrypoints/factory.mjs +20 -0
- package/docs/assets/js/entrypoints/guest.mjs +61 -0
- package/docs/assets/js/entrypoints/index.mjs +110 -0
- package/docs/assets/js/entrypoints/integrations.mjs +36 -0
- package/docs/assets/js/entrypoints/patron.mjs +46 -0
- package/docs/assets/js/entrypoints/source.mjs +76 -0
- package/docs/assets/js/entrypoints/terminology.mjs +51 -0
- package/docs/assets/js/entrypoints/utils.mjs +61 -0
- package/docs/assets/js/lib/StyleFetched.mjs +14 -0
- package/docs/assets/js/routing.mjs +110 -0
- package/docs/assets/schemes/dip.html +28 -0
- package/docs/favicon.ico +0 -0
- package/docs/index-dev.html +346 -0
- package/docs/index.html +346 -0
- package/docs/manifest.json +41 -0
- package/docs/pages/404.html +9 -0
- package/docs/pages/common/layout.html +17 -0
- package/docs/pages/compatibility/dip.html +82 -0
- package/docs/pages/compatibility/elegant-objects.html +373 -0
- package/docs/pages/compatibility/layout.html +17 -0
- package/docs/pages/examples/errors.html +167 -0
- package/docs/pages/examples/index.html +10 -0
- package/docs/pages/examples.html +41 -0
- package/docs/pages/factory/index.html +18 -0
- package/docs/pages/factory.html +36 -0
- package/docs/pages/guest/guest-applied.html +51 -0
- package/docs/pages/guest/guest-cast.html +219 -0
- package/docs/pages/guest/guest-disposable.html +147 -0
- package/docs/pages/guest/guest-executor-applied.html +65 -0
- package/docs/pages/guest/guest-object.html +101 -0
- package/docs/pages/guest/guest-pool.html +107 -0
- package/docs/pages/guest/guest-sync.html +66 -0
- package/docs/pages/guest/index.html +115 -0
- package/docs/pages/guest.html +59 -0
- package/docs/pages/index.html +72 -0
- package/docs/pages/integrations/angular.html +5 -0
- package/docs/pages/integrations/layout.html +17 -0
- package/docs/pages/integrations/react.html +7 -0
- package/docs/pages/integrations/vue.html +102 -0
- package/docs/pages/patron/index.html +140 -0
- package/docs/pages/patron/patron-applied.html +66 -0
- package/docs/pages/patron/patron-executor-applied.html +94 -0
- package/docs/pages/patron/patron-once.html +110 -0
- package/docs/pages/patron/patron-pool.html +99 -0
- package/docs/pages/patron.html +50 -0
- package/docs/pages/philosofy.html +210 -0
- package/docs/pages/source/index.html +167 -0
- package/docs/pages/source/source-active.html +113 -0
- package/docs/pages/source/source-all.html +129 -0
- package/docs/pages/source/source-applied.html +73 -0
- package/docs/pages/source/source-dynamic.html +93 -0
- package/docs/pages/source/source-executor-applied.html +64 -0
- package/docs/pages/source/source-map.html +192 -0
- package/docs/pages/source/source-once.html +73 -0
- package/docs/pages/source/source-race.html +171 -0
- package/docs/pages/source/source-sequence.html +160 -0
- package/docs/pages/source/source-with-pool.html +102 -0
- package/docs/pages/source/source.html +167 -0
- package/docs/pages/source.html +68 -0
- package/docs/pages/terminology/guest.html +14 -0
- package/docs/pages/terminology/index.html +6 -0
- package/docs/pages/terminology/introduction.html +25 -0
- package/docs/pages/terminology/patron.html +10 -0
- package/docs/pages/terminology/source.html +55 -0
- package/docs/pages/terminology/visitor.html +19 -0
- package/docs/pages/terminology.html +53 -0
- package/docs/pages/utils/give.html +47 -0
- package/docs/pages/utils/index.html +24 -0
- package/docs/pages/utils/is-guest-aware.html +22 -0
- package/docs/pages/utils/is-guest.html +21 -0
- package/docs/pages/utils/is-patron-in-pools.html +53 -0
- package/docs/pages/utils/private.html +44 -0
- package/docs/pages/utils/remove-patron-from-pools.html +57 -0
- package/docs/pages/utils/value.html +47 -0
- package/docs/pages/utils.html +61 -0
- package/eslint.config.mjs +6 -0
- package/package.json +1 -1
- package/src/Guest/Guest.test.ts +11 -6
- package/src/Guest/Guest.ts +7 -14
- package/src/Guest/GuestApplied.test.ts +13 -0
- package/src/Guest/GuestApplied.ts +16 -0
- package/src/Guest/GuestCast.test.ts +4 -5
- package/src/Guest/GuestCast.ts +3 -10
- package/src/Guest/GuestDisposable.test.ts +13 -17
- package/src/Guest/GuestDisposable.ts +3 -3
- package/src/Guest/GuestExecutorApplied.test.ts +27 -0
- package/src/Guest/GuestExecutorApplied.ts +23 -0
- package/src/Guest/GuestObject.test.ts +6 -6
- package/src/Guest/GuestObject.ts +3 -3
- package/src/Guest/GuestPool.test.ts +5 -22
- package/src/Guest/GuestPool.ts +7 -8
- package/src/Guest/GuestSync.test.ts +2 -2
- package/src/Patron/Patron.test.ts +4 -5
- package/src/Patron/Patron.ts +11 -3
- package/src/Patron/PatronApplied.ts +22 -0
- package/src/Patron/PatronExecutorApplied.ts +25 -0
- package/src/Patron/PatronOnce.sourceEmpty.test.ts +2 -2
- package/src/Patron/PatronOnce.test.ts +2 -2
- package/src/Patron/PatronOnce.ts +3 -9
- package/src/Patron/PatronPool.test.ts +2 -1
- package/src/Patron/PatronPool.ts +22 -27
- package/src/Private/PrivateClass.modules.test.ts +11 -8
- package/src/Private/PrivateClass.test.ts +7 -6
- package/src/Source/Source.test.ts +9 -5
- package/src/Source/Source.ts +46 -30
- package/src/Source/SourceActive.test.ts +13 -0
- package/src/Source/SourceActive.ts +41 -0
- package/src/Source/SourceAll._asArray.test.ts +22 -0
- package/src/Source/SourceAll._twoValuesAfter.test.ts +19 -0
- package/src/Source/SourceAll._twoValuesBefore.test.ts +19 -0
- package/src/Source/SourceAll._withPatron.test.ts +25 -0
- package/src/{Guest/GuestAwareAll.ts → Source/SourceAll.ts} +11 -11
- package/src/Source/SourceApplied.test.ts +14 -0
- package/src/Source/SourceApplied.ts +23 -0
- package/src/Source/SourceDynamic.ofSource.test.ts +12 -12
- package/src/Source/SourceDynamic.test.ts +9 -9
- package/src/Source/SourceDynamic.ts +7 -7
- package/src/Source/SourceExecutorApplied.test.ts +30 -0
- package/src/Source/SourceExecutorApplied.ts +22 -0
- package/src/Source/SourceMap.defered.test.ts +46 -0
- package/src/Source/SourceMap.fn.test.ts +27 -0
- package/src/Source/SourceMap.test.ts +32 -0
- package/src/Source/SourceMap.ts +48 -0
- package/src/Source/SourceOnce.notcalled.test.ts +4 -4
- package/src/Source/SourceOnce.test.ts +4 -5
- package/src/Source/SourceOnce.ts +7 -13
- package/src/Source/SourceRace.test.ts +46 -0
- package/src/Source/SourceRace.ts +30 -0
- package/src/Source/SourceSequence.defered.test.ts +53 -0
- package/src/Source/SourceSequence.test.ts +30 -0
- package/src/{Guest/GuestAwareSequence.ts → Source/SourceSequence.ts} +14 -19
- package/src/Source/SourceWithPool.empty.test.ts +14 -0
- package/src/Source/SourceWithPool.test.ts +10 -0
- package/src/Source/SourceWithPool.ts +58 -0
- package/src/index.ts +13 -7
- package/test-utils/debounce.ts +11 -0
- package/test-utils/id.ts +1 -0
- package/test-utils/wait.ts +6 -3
- package/src/Guest/GuestAware.test.ts +0 -13
- package/src/Guest/GuestAware.ts +0 -59
- package/src/Guest/GuestAwareActive.test.ts +0 -12
- package/src/Guest/GuestAwareActive.ts +0 -42
- package/src/Guest/GuestAwareAll._asArray.test.ts +0 -19
- package/src/Guest/GuestAwareAll._twoValuesAfter.test.ts +0 -16
- package/src/Guest/GuestAwareAll._twoValuesBefore.test.ts +0 -16
- package/src/Guest/GuestAwareAll._withPatron.test.ts +0 -22
- package/src/Guest/GuestAwareMap.defered.test.ts +0 -46
- package/src/Guest/GuestAwareMap.fn.test.ts +0 -27
- package/src/Guest/GuestAwareMap.test.ts +0 -29
- package/src/Guest/GuestAwareMap.ts +0 -48
- package/src/Guest/GuestAwareRace.test.ts +0 -46
- package/src/Guest/GuestAwareRace.ts +0 -33
- package/src/Guest/GuestAwareSequence.defered.test.ts +0 -58
- package/src/Guest/GuestAwareSequence.test.ts +0 -30
- package/src/Source/SourceEmpty.test.ts +0 -20
- package/src/Source/SourceEmpty.ts +0 -31
package/dist/patron.d.ts
CHANGED
@@ -1,17 +1,14 @@
|
|
1
1
|
type GuestIntroduction = "guest" | "patron";
|
2
|
-
|
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
|
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
|
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
|
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
|
-
|
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-
|
30
|
+
* @url https://kosukhin.github.io/patron.site/#/guest/guest-disposable
|
64
31
|
*/
|
65
|
-
declare class
|
66
|
-
private
|
67
|
-
private
|
68
|
-
constructor(
|
69
|
-
value
|
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-
|
41
|
+
* @url https://kosukhin.github.io/patron.site/#/guest/guest-cast
|
74
42
|
*/
|
75
|
-
declare class
|
76
|
-
private
|
77
|
-
private
|
78
|
-
constructor(
|
79
|
-
|
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/#/
|
53
|
+
* @url https://kosukhin.github.io/patron.site/#/utils/patron-pools
|
84
54
|
*/
|
85
|
-
declare
|
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
|
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
|
-
|
122
|
-
|
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/#/
|
105
|
+
* @url https://kosukhin.github.io/patron.site/#/guest/guest-sync
|
126
106
|
*/
|
127
|
-
|
128
|
-
|
129
|
-
|
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(
|
111
|
+
value(): T;
|
135
112
|
}
|
136
113
|
|
137
114
|
/**
|
138
|
-
* @url https://kosukhin.github.io/patron.site/#/
|
115
|
+
* @url https://kosukhin.github.io/patron.site/#/guest/guest-object
|
139
116
|
*/
|
140
|
-
|
141
|
-
|
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
|
-
|
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-
|
136
|
+
* @url https://kosukhin.github.io/patron.site/#/guest/guest-executor-applied
|
147
137
|
*/
|
148
|
-
declare class
|
149
|
-
|
150
|
-
|
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
|
-
|
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/#/
|
154
|
+
* @url https://kosukhin.github.io/patron.site/#/utils/is-patron
|
162
155
|
*/
|
163
|
-
declare
|
164
|
-
|
165
|
-
|
166
|
-
|
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/#/
|
171
|
+
* @url https://kosukhin.github.io/patron.site/#/patron/patron-applied
|
173
172
|
*/
|
174
|
-
declare class
|
175
|
-
private
|
176
|
-
|
177
|
-
|
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
|
-
|
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/
|
221
|
+
* @url https://kosukhin.github.io/patron.site/#/guest/source-all
|
189
222
|
*/
|
190
|
-
declare class
|
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/#/
|
236
|
+
* @url https://kosukhin.github.io/patron.site/#/utils/private
|
204
237
|
*/
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
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
|
-
|
218
|
-
|
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/
|
258
|
+
* @url https://kosukhin.github.io/patron.site/#/guest/source-map
|
222
259
|
*/
|
223
|
-
declare class
|
224
|
-
private
|
225
|
-
|
226
|
-
|
227
|
-
value():
|
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/
|
268
|
+
* @url https://kosukhin.github.io/patron.site/#/guest/source-race
|
232
269
|
*/
|
233
|
-
declare class
|
234
|
-
private
|
235
|
-
constructor(
|
236
|
-
|
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/#/
|
280
|
+
* @url https://kosukhin.github.io/patron.site/#/source-with-pool
|
243
281
|
*/
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
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/#/
|
296
|
+
* @url https://kosukhin.github.io/patron.site/#/utils/action-type
|
258
297
|
*/
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
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
|
317
|
+
declare class SourceDynamic<T = unknown> implements SourceWithPoolType<T> {
|
272
318
|
private baseGuest;
|
273
|
-
private
|
274
|
-
constructor(baseGuest: GuestType<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-
|
327
|
+
* @url https://kosukhin.github.io/patron.site/#/source/source-applied
|
282
328
|
*/
|
283
|
-
declare class
|
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,
|
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 };
|