@casual-simulation/aux-records 3.8.1 → 3.10.2
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/AIChatInterface.d.ts +7 -43
- package/AIChatInterface.js +8 -6
- package/AIChatInterface.js.map +1 -1
- package/AIController.js +44 -49
- package/AIController.js.map +1 -1
- package/AIOpenAIRealtimeInterface.d.ts +1 -1
- package/AnthropicAIChatInterface.js +4 -4
- package/AnthropicAIChatInterface.js.map +1 -1
- package/AuthController.d.ts +78 -10
- package/AuthController.js +230 -166
- package/AuthController.js.map +1 -1
- package/AuthStore.d.ts +317 -4
- package/BigIntPatch.d.ts +1 -0
- package/BigIntPatch.js +24 -0
- package/BigIntPatch.js.map +1 -0
- package/BlockadeLabsGenerateSkyboxInterface.js +4 -4
- package/BlockadeLabsGenerateSkyboxInterface.js.map +1 -1
- package/CachingConfigStore.d.ts +8 -1
- package/CachingConfigStore.js +50 -0
- package/CachingConfigStore.js.map +1 -1
- package/ComIdConfig.d.ts +132 -86
- package/ComIdConfig.js +5 -5
- package/ComIdConfig.js.map +1 -1
- package/ConfigurationStore.d.ts +1393 -3
- package/ConfigurationStore.js +49 -0
- package/ConfigurationStore.js.map +1 -1
- package/DataRecordsController.js +28 -28
- package/DataRecordsController.js.map +1 -1
- package/EventRecordsController.js +9 -9
- package/EventRecordsController.js.map +1 -1
- package/FileRecordsController.js +18 -17
- package/FileRecordsController.js.map +1 -1
- package/GoogleAIChatInterface.js +4 -4
- package/GoogleAIChatInterface.js.map +1 -1
- package/HttpTestUtils.d.ts +48 -0
- package/HttpTestUtils.js +256 -0
- package/HttpTestUtils.js.map +1 -0
- package/LivekitController.js +2 -2
- package/LivekitController.js.map +1 -1
- package/LoomController.js +3 -4
- package/LoomController.js.map +1 -1
- package/MemoryStore.d.ts +60 -7
- package/MemoryStore.js +427 -59
- package/MemoryStore.js.map +1 -1
- package/MetricsStore.d.ts +11 -0
- package/ModerationConfiguration.d.ts +11 -85
- package/ModerationConfiguration.js +17 -17
- package/ModerationConfiguration.js.map +1 -1
- package/ModerationController.js +9 -11
- package/ModerationController.js.map +1 -1
- package/OpenAIChatInterface.js +8 -13
- package/OpenAIChatInterface.js.map +1 -1
- package/OpenAIImageInterface.js +4 -5
- package/OpenAIImageInterface.js.map +1 -1
- package/PolicyController.js +66 -73
- package/PolicyController.js.map +1 -1
- package/PolicyStore.d.ts +59 -33
- package/PolicyStore.js +35 -1
- package/PolicyStore.js.map +1 -1
- package/PrivoClient.d.ts +3 -1
- package/PrivoClient.js +2 -4
- package/PrivoClient.js.map +1 -1
- package/PrivoConfiguration.d.ts +6 -72
- package/PrivoConfiguration.js +30 -31
- package/PrivoConfiguration.js.map +1 -1
- package/README.md +276 -2
- package/RateLimitController.js +2 -2
- package/RateLimitController.js.map +1 -1
- package/RecordsClient.d.ts +3 -1
- package/RecordsClient.js +6 -6
- package/RecordsClient.js.map +1 -1
- package/RecordsController.d.ts +145 -3
- package/RecordsController.js +399 -61
- package/RecordsController.js.map +1 -1
- package/RecordsServer.d.ts +1932 -1109
- package/RecordsStore.d.ts +99 -14
- package/RecordsStore.js +8 -10
- package/RecordsStore.js.map +1 -1
- package/ServerConfig.d.ts +698 -9867
- package/ServerConfig.js +457 -377
- package/ServerConfig.js.map +1 -1
- package/SloydInterface.js +1 -1
- package/SloydInterface.js.map +1 -1
- package/StabilityAIImageInterface.js +6 -9
- package/StabilityAIImageInterface.js.map +1 -1
- package/StripeInterface.d.ts +431 -287
- package/StripeInterface.js +21 -1
- package/StripeInterface.js.map +1 -1
- package/SubscriptionConfigBuilder.d.ts +10 -1
- package/SubscriptionConfigBuilder.js +72 -41
- package/SubscriptionConfigBuilder.js.map +1 -1
- package/SubscriptionConfiguration.d.ts +606 -6334
- package/SubscriptionConfiguration.js +460 -277
- package/SubscriptionConfiguration.js.map +1 -1
- package/SubscriptionController.d.ts +677 -4
- package/SubscriptionController.js +2986 -186
- package/SubscriptionController.js.map +1 -1
- package/SystemNotificationMessenger.d.ts +14 -70
- package/SystemNotificationMessenger.js +17 -20
- package/SystemNotificationMessenger.js.map +1 -1
- package/TestUtils.d.ts +18 -3
- package/TestUtils.js +84 -8
- package/TestUtils.js.map +1 -1
- package/TypeUtils.d.ts +991 -0
- package/TypeUtils.js +2 -0
- package/TypeUtils.js.map +1 -0
- package/Utils.d.ts +59 -0
- package/Utils.js +507 -3
- package/Utils.js.map +1 -1
- package/Validations.d.ts +24 -108
- package/Validations.js +62 -45
- package/Validations.js.map +1 -1
- package/ViewTemplateRenderer.d.ts +39 -0
- package/ViewTemplateRenderer.js +19 -0
- package/ViewTemplateRenderer.js.map +1 -0
- package/contracts/ContractRecordsController.d.ts +58 -0
- package/contracts/ContractRecordsController.js +144 -0
- package/contracts/ContractRecordsController.js.map +1 -0
- package/contracts/ContractRecordsStore.d.ts +285 -0
- package/contracts/ContractRecordsStore.js +19 -0
- package/contracts/ContractRecordsStore.js.map +1 -0
- package/contracts/MemoryContractRecordsStore.d.ts +27 -0
- package/contracts/MemoryContractRecordsStore.js +124 -0
- package/contracts/MemoryContractRecordsStore.js.map +1 -0
- package/contracts/index.d.ts +4 -0
- package/contracts/index.js +21 -0
- package/contracts/index.js.map +1 -0
- package/crud/CrudHelpers.d.ts +25 -26
- package/crud/CrudHelpers.js +1 -1
- package/crud/CrudHelpers.js.map +1 -1
- package/crud/CrudRecordsController.js +13 -16
- package/crud/CrudRecordsController.js.map +1 -1
- package/crud/CrudRecordsControllerTests.d.ts +2 -2
- package/crud/CrudRecordsControllerTests.js +605 -580
- package/crud/CrudRecordsControllerTests.js.map +1 -1
- package/crud/MemoryCrudRecordsStore.js +1 -2
- package/crud/MemoryCrudRecordsStore.js.map +1 -1
- package/crud/sub/MemorySubCrudRecordsStore.js +4 -6
- package/crud/sub/MemorySubCrudRecordsStore.js.map +1 -1
- package/crud/sub/SubCrudRecordsController.js +8 -8
- package/crud/sub/SubCrudRecordsController.js.map +1 -1
- package/database/DatabaseRecordsController.js +1 -2
- package/database/DatabaseRecordsController.js.map +1 -1
- package/database/SqliteDatabaseInterface.js +1 -2
- package/database/SqliteDatabaseInterface.js.map +1 -1
- package/dns/DNSDomainNameValidator.d.ts +11 -0
- package/dns/DNSDomainNameValidator.js +59 -0
- package/dns/DNSDomainNameValidator.js.map +1 -0
- package/dns/DomainNameValidator.d.ts +36 -0
- package/dns/DomainNameValidator.js +19 -0
- package/dns/DomainNameValidator.js.map +1 -0
- package/dns/index.d.ts +3 -0
- package/dns/index.js +20 -0
- package/dns/index.js.map +1 -0
- package/financial/FinancialController.d.ts +272 -0
- package/financial/FinancialController.js +762 -0
- package/financial/FinancialController.js.map +1 -0
- package/financial/FinancialInterface.d.ts +352 -0
- package/financial/FinancialInterface.js +642 -0
- package/financial/FinancialInterface.js.map +1 -0
- package/financial/FinancialStore.d.ts +186 -0
- package/financial/FinancialStore.js +19 -0
- package/financial/FinancialStore.js.map +1 -0
- package/financial/MemoryFinancialInterface.d.ts +23 -0
- package/financial/MemoryFinancialInterface.js +592 -0
- package/financial/MemoryFinancialInterface.js.map +1 -0
- package/financial/TigerBeetleFinancialInterface.d.ts +46 -0
- package/financial/TigerBeetleFinancialInterface.js +109 -0
- package/financial/TigerBeetleFinancialInterface.js.map +1 -0
- package/financial/TigerBeetleTestUtils.d.ts +40 -0
- package/financial/TigerBeetleTestUtils.js +185 -0
- package/financial/TigerBeetleTestUtils.js.map +1 -0
- package/financial/Types.d.ts +1 -0
- package/financial/Types.js +801 -0
- package/financial/Types.js.map +1 -0
- package/financial/index.d.ts +6 -0
- package/financial/index.js +24 -0
- package/financial/index.js.map +1 -0
- package/index.d.ts +4 -0
- package/index.js +3 -0
- package/index.js.map +1 -1
- package/notifications/NotificationRecordsController.js +14 -14
- package/notifications/NotificationRecordsController.js.map +1 -1
- package/notifications/WebPushInterface.d.ts +24 -155
- package/notifications/WebPushInterface.js +2 -2
- package/notifications/WebPushInterface.js.map +1 -1
- package/package.json +72 -70
- package/packages/version/MemoryPackageVersionRecordsStore.js +12 -15
- package/packages/version/MemoryPackageVersionRecordsStore.js.map +1 -1
- package/packages/version/PackageVersionRecordsController.d.ts +19 -0
- package/packages/version/PackageVersionRecordsController.js +102 -22
- package/packages/version/PackageVersionRecordsController.js.map +1 -1
- package/packages/version/PackageVersionRecordsStore.js +6 -8
- package/packages/version/PackageVersionRecordsStore.js.map +1 -1
- package/purchasable-items/MemoryPurchasableItemRecordsStore.d.ts +7 -0
- package/purchasable-items/MemoryPurchasableItemRecordsStore.js +33 -0
- package/purchasable-items/MemoryPurchasableItemRecordsStore.js.map +1 -0
- package/purchasable-items/PurchasableItemRecordsController.d.ts +16 -0
- package/purchasable-items/PurchasableItemRecordsController.js +72 -0
- package/purchasable-items/PurchasableItemRecordsController.js.map +1 -0
- package/purchasable-items/PurchasableItemRecordsStore.d.ts +66 -0
- package/purchasable-items/PurchasableItemRecordsStore.js +2 -0
- package/purchasable-items/PurchasableItemRecordsStore.js.map +1 -0
- package/purchasable-items/index.d.ts +4 -0
- package/purchasable-items/index.js +21 -0
- package/purchasable-items/index.js.map +1 -0
- package/queue/MemoryQueue.js +1 -1
- package/queue/MemoryQueue.js.map +1 -1
- package/search/MemorySearchInterface.js +1 -2
- package/search/MemorySearchInterface.js.map +1 -1
- package/search/SearchRecordsController.d.ts +66 -244
- package/search/SearchRecordsController.js +35 -36
- package/search/SearchRecordsController.js.map +1 -1
- package/search/SearchSyncProcessor.d.ts +7 -83
- package/search/TypesenseSearchInterface.js +8 -11
- package/search/TypesenseSearchInterface.js.map +1 -1
- package/tracing/TracingDecorators.js +5 -8
- package/tracing/TracingDecorators.js.map +1 -1
- package/webhooks/WebhookEnvironment.d.ts +36 -560
- package/webhooks/WebhookEnvironment.js +1 -1
- package/webhooks/WebhookEnvironment.js.map +1 -1
- package/webhooks/WebhookRecordsController.js +14 -16
- package/webhooks/WebhookRecordsController.js.map +1 -1
- package/websockets/MemoryLockStore.d.ts +18 -0
- package/websockets/MemoryLockStore.js +2 -0
- package/websockets/MemoryLockStore.js.map +1 -0
- package/websockets/MemoryTempInstRecordsStore.js +15 -27
- package/websockets/MemoryTempInstRecordsStore.js.map +1 -1
- package/websockets/MemoryWebsocketConnectionStore.js +6 -8
- package/websockets/MemoryWebsocketConnectionStore.js.map +1 -1
- package/websockets/MemoryWebsocketMessenger.js +1 -2
- package/websockets/MemoryWebsocketMessenger.js.map +1 -1
- package/websockets/SplitInstRecordsStore.js +2 -2
- package/websockets/SplitInstRecordsStore.js.map +1 -1
- package/websockets/WebsocketController.d.ts +5 -0
- package/websockets/WebsocketController.js +122 -83
- package/websockets/WebsocketController.js.map +1 -1
- package/RecordsServer.js +0 -6435
- package/RecordsServer.js.map +0 -1
package/TypeUtils.d.ts
ADDED
|
@@ -0,0 +1,991 @@
|
|
|
1
|
+
import type { KnownErrorCodes } from '@casual-simulation/aux-common';
|
|
2
|
+
/**
|
|
3
|
+
* A map of ISO4217 alphabetic currency codes to their numeric codes
|
|
4
|
+
* and minor units
|
|
5
|
+
* * Last updated: 2024-08-30 (YYYY-MM-DD)
|
|
6
|
+
*/
|
|
7
|
+
export type ISO4217_Map = {
|
|
8
|
+
AED: {
|
|
9
|
+
n: 784;
|
|
10
|
+
mU: 2;
|
|
11
|
+
};
|
|
12
|
+
AFN: {
|
|
13
|
+
n: 971;
|
|
14
|
+
mU: 2;
|
|
15
|
+
};
|
|
16
|
+
ALL: {
|
|
17
|
+
n: 8;
|
|
18
|
+
mU: 2;
|
|
19
|
+
};
|
|
20
|
+
AMD: {
|
|
21
|
+
n: 51;
|
|
22
|
+
mU: 2;
|
|
23
|
+
};
|
|
24
|
+
ANG: {
|
|
25
|
+
n: 532;
|
|
26
|
+
mU: 2;
|
|
27
|
+
};
|
|
28
|
+
AOA: {
|
|
29
|
+
n: 973;
|
|
30
|
+
mU: 2;
|
|
31
|
+
};
|
|
32
|
+
ARS: {
|
|
33
|
+
n: 32;
|
|
34
|
+
mU: 2;
|
|
35
|
+
};
|
|
36
|
+
AUD: {
|
|
37
|
+
n: 36;
|
|
38
|
+
mU: 2;
|
|
39
|
+
};
|
|
40
|
+
AWG: {
|
|
41
|
+
n: 533;
|
|
42
|
+
mU: 2;
|
|
43
|
+
};
|
|
44
|
+
AZN: {
|
|
45
|
+
n: 944;
|
|
46
|
+
mU: 2;
|
|
47
|
+
};
|
|
48
|
+
BAM: {
|
|
49
|
+
n: 977;
|
|
50
|
+
mU: 2;
|
|
51
|
+
};
|
|
52
|
+
BBD: {
|
|
53
|
+
n: 52;
|
|
54
|
+
mU: 2;
|
|
55
|
+
};
|
|
56
|
+
BDT: {
|
|
57
|
+
n: 50;
|
|
58
|
+
mU: 2;
|
|
59
|
+
};
|
|
60
|
+
BGN: {
|
|
61
|
+
n: 975;
|
|
62
|
+
mU: 2;
|
|
63
|
+
};
|
|
64
|
+
BHD: {
|
|
65
|
+
n: 48;
|
|
66
|
+
mU: 3;
|
|
67
|
+
};
|
|
68
|
+
BIF: {
|
|
69
|
+
n: 108;
|
|
70
|
+
mU: 0;
|
|
71
|
+
};
|
|
72
|
+
BMD: {
|
|
73
|
+
n: 60;
|
|
74
|
+
mU: 2;
|
|
75
|
+
};
|
|
76
|
+
BND: {
|
|
77
|
+
n: 96;
|
|
78
|
+
mU: 2;
|
|
79
|
+
};
|
|
80
|
+
BOB: {
|
|
81
|
+
n: 68;
|
|
82
|
+
mU: 2;
|
|
83
|
+
};
|
|
84
|
+
BOV: {
|
|
85
|
+
n: 984;
|
|
86
|
+
mU: 2;
|
|
87
|
+
};
|
|
88
|
+
BRL: {
|
|
89
|
+
n: 986;
|
|
90
|
+
mU: 2;
|
|
91
|
+
};
|
|
92
|
+
BSD: {
|
|
93
|
+
n: 44;
|
|
94
|
+
mU: 2;
|
|
95
|
+
};
|
|
96
|
+
BTN: {
|
|
97
|
+
n: 64;
|
|
98
|
+
mU: 2;
|
|
99
|
+
};
|
|
100
|
+
BWP: {
|
|
101
|
+
n: 72;
|
|
102
|
+
mU: 2;
|
|
103
|
+
};
|
|
104
|
+
BYN: {
|
|
105
|
+
n: 933;
|
|
106
|
+
mU: 2;
|
|
107
|
+
};
|
|
108
|
+
BZD: {
|
|
109
|
+
n: 84;
|
|
110
|
+
mU: 2;
|
|
111
|
+
};
|
|
112
|
+
CAD: {
|
|
113
|
+
n: 124;
|
|
114
|
+
mU: 2;
|
|
115
|
+
};
|
|
116
|
+
CDF: {
|
|
117
|
+
n: 976;
|
|
118
|
+
mU: 2;
|
|
119
|
+
};
|
|
120
|
+
CHE: {
|
|
121
|
+
n: 947;
|
|
122
|
+
mU: 2;
|
|
123
|
+
};
|
|
124
|
+
CHF: {
|
|
125
|
+
n: 756;
|
|
126
|
+
mU: 2;
|
|
127
|
+
};
|
|
128
|
+
CHW: {
|
|
129
|
+
n: 948;
|
|
130
|
+
mU: 2;
|
|
131
|
+
};
|
|
132
|
+
CLF: {
|
|
133
|
+
n: 990;
|
|
134
|
+
mU: 4;
|
|
135
|
+
};
|
|
136
|
+
CLP: {
|
|
137
|
+
n: 152;
|
|
138
|
+
mU: 0;
|
|
139
|
+
};
|
|
140
|
+
CNY: {
|
|
141
|
+
n: 156;
|
|
142
|
+
mU: 2;
|
|
143
|
+
};
|
|
144
|
+
COP: {
|
|
145
|
+
n: 170;
|
|
146
|
+
mU: 2;
|
|
147
|
+
};
|
|
148
|
+
COU: {
|
|
149
|
+
n: 970;
|
|
150
|
+
mU: 2;
|
|
151
|
+
};
|
|
152
|
+
CRC: {
|
|
153
|
+
n: 188;
|
|
154
|
+
mU: 2;
|
|
155
|
+
};
|
|
156
|
+
CUC: {
|
|
157
|
+
n: 931;
|
|
158
|
+
mU: 2;
|
|
159
|
+
};
|
|
160
|
+
CUP: {
|
|
161
|
+
n: 192;
|
|
162
|
+
mU: 2;
|
|
163
|
+
};
|
|
164
|
+
CVE: {
|
|
165
|
+
n: 132;
|
|
166
|
+
mU: 2;
|
|
167
|
+
};
|
|
168
|
+
CZK: {
|
|
169
|
+
n: 203;
|
|
170
|
+
mU: 2;
|
|
171
|
+
};
|
|
172
|
+
DJF: {
|
|
173
|
+
n: 262;
|
|
174
|
+
mU: 0;
|
|
175
|
+
};
|
|
176
|
+
DKK: {
|
|
177
|
+
n: 208;
|
|
178
|
+
mU: 2;
|
|
179
|
+
};
|
|
180
|
+
DOP: {
|
|
181
|
+
n: 214;
|
|
182
|
+
mU: 2;
|
|
183
|
+
};
|
|
184
|
+
DZD: {
|
|
185
|
+
n: 12;
|
|
186
|
+
mU: 2;
|
|
187
|
+
};
|
|
188
|
+
EGP: {
|
|
189
|
+
n: 818;
|
|
190
|
+
mU: 2;
|
|
191
|
+
};
|
|
192
|
+
ERN: {
|
|
193
|
+
n: 232;
|
|
194
|
+
mU: 2;
|
|
195
|
+
};
|
|
196
|
+
ETB: {
|
|
197
|
+
n: 230;
|
|
198
|
+
mU: 2;
|
|
199
|
+
};
|
|
200
|
+
EUR: {
|
|
201
|
+
n: 978;
|
|
202
|
+
mU: 2;
|
|
203
|
+
};
|
|
204
|
+
FJD: {
|
|
205
|
+
n: 242;
|
|
206
|
+
mU: 2;
|
|
207
|
+
};
|
|
208
|
+
FKP: {
|
|
209
|
+
n: 238;
|
|
210
|
+
mU: 2;
|
|
211
|
+
};
|
|
212
|
+
GBP: {
|
|
213
|
+
n: 826;
|
|
214
|
+
mU: 2;
|
|
215
|
+
};
|
|
216
|
+
GEL: {
|
|
217
|
+
n: 981;
|
|
218
|
+
mU: 2;
|
|
219
|
+
};
|
|
220
|
+
GHS: {
|
|
221
|
+
n: 936;
|
|
222
|
+
mU: 2;
|
|
223
|
+
};
|
|
224
|
+
GIP: {
|
|
225
|
+
n: 292;
|
|
226
|
+
mU: 2;
|
|
227
|
+
};
|
|
228
|
+
GMD: {
|
|
229
|
+
n: 270;
|
|
230
|
+
mU: 2;
|
|
231
|
+
};
|
|
232
|
+
GNF: {
|
|
233
|
+
n: 324;
|
|
234
|
+
mU: 0;
|
|
235
|
+
};
|
|
236
|
+
GTQ: {
|
|
237
|
+
n: 320;
|
|
238
|
+
mU: 2;
|
|
239
|
+
};
|
|
240
|
+
GYD: {
|
|
241
|
+
n: 328;
|
|
242
|
+
mU: 2;
|
|
243
|
+
};
|
|
244
|
+
HKD: {
|
|
245
|
+
n: 344;
|
|
246
|
+
mU: 2;
|
|
247
|
+
};
|
|
248
|
+
HNL: {
|
|
249
|
+
n: 340;
|
|
250
|
+
mU: 2;
|
|
251
|
+
};
|
|
252
|
+
HTG: {
|
|
253
|
+
n: 332;
|
|
254
|
+
mU: 2;
|
|
255
|
+
};
|
|
256
|
+
HUF: {
|
|
257
|
+
n: 348;
|
|
258
|
+
mU: 2;
|
|
259
|
+
};
|
|
260
|
+
IDR: {
|
|
261
|
+
n: 360;
|
|
262
|
+
mU: 2;
|
|
263
|
+
};
|
|
264
|
+
ILS: {
|
|
265
|
+
n: 376;
|
|
266
|
+
mU: 2;
|
|
267
|
+
};
|
|
268
|
+
INR: {
|
|
269
|
+
n: 356;
|
|
270
|
+
mU: 2;
|
|
271
|
+
};
|
|
272
|
+
IQD: {
|
|
273
|
+
n: 368;
|
|
274
|
+
mU: 3;
|
|
275
|
+
};
|
|
276
|
+
IRR: {
|
|
277
|
+
n: 364;
|
|
278
|
+
mU: 2;
|
|
279
|
+
};
|
|
280
|
+
ISK: {
|
|
281
|
+
n: 352;
|
|
282
|
+
mU: 0;
|
|
283
|
+
};
|
|
284
|
+
JMD: {
|
|
285
|
+
n: 388;
|
|
286
|
+
mU: 2;
|
|
287
|
+
};
|
|
288
|
+
JOD: {
|
|
289
|
+
n: 400;
|
|
290
|
+
mU: 3;
|
|
291
|
+
};
|
|
292
|
+
JPY: {
|
|
293
|
+
n: 392;
|
|
294
|
+
mU: 0;
|
|
295
|
+
};
|
|
296
|
+
KES: {
|
|
297
|
+
n: 404;
|
|
298
|
+
mU: 2;
|
|
299
|
+
};
|
|
300
|
+
KGS: {
|
|
301
|
+
n: 417;
|
|
302
|
+
mU: 2;
|
|
303
|
+
};
|
|
304
|
+
KHR: {
|
|
305
|
+
n: 116;
|
|
306
|
+
mU: 2;
|
|
307
|
+
};
|
|
308
|
+
KMF: {
|
|
309
|
+
n: 174;
|
|
310
|
+
mU: 0;
|
|
311
|
+
};
|
|
312
|
+
KPW: {
|
|
313
|
+
n: 408;
|
|
314
|
+
mU: 2;
|
|
315
|
+
};
|
|
316
|
+
KRW: {
|
|
317
|
+
n: 410;
|
|
318
|
+
mU: 0;
|
|
319
|
+
};
|
|
320
|
+
KWD: {
|
|
321
|
+
n: 414;
|
|
322
|
+
mU: 3;
|
|
323
|
+
};
|
|
324
|
+
KYD: {
|
|
325
|
+
n: 136;
|
|
326
|
+
mU: 2;
|
|
327
|
+
};
|
|
328
|
+
KZT: {
|
|
329
|
+
n: 398;
|
|
330
|
+
mU: 2;
|
|
331
|
+
};
|
|
332
|
+
LAK: {
|
|
333
|
+
n: 418;
|
|
334
|
+
mU: 2;
|
|
335
|
+
};
|
|
336
|
+
LBP: {
|
|
337
|
+
n: 422;
|
|
338
|
+
mU: 2;
|
|
339
|
+
};
|
|
340
|
+
LKR: {
|
|
341
|
+
n: 144;
|
|
342
|
+
mU: 2;
|
|
343
|
+
};
|
|
344
|
+
LRD: {
|
|
345
|
+
n: 430;
|
|
346
|
+
mU: 2;
|
|
347
|
+
};
|
|
348
|
+
LSL: {
|
|
349
|
+
n: 426;
|
|
350
|
+
mU: 2;
|
|
351
|
+
};
|
|
352
|
+
LYD: {
|
|
353
|
+
n: 434;
|
|
354
|
+
mU: 3;
|
|
355
|
+
};
|
|
356
|
+
MAD: {
|
|
357
|
+
n: 504;
|
|
358
|
+
mU: 2;
|
|
359
|
+
};
|
|
360
|
+
MDL: {
|
|
361
|
+
n: 498;
|
|
362
|
+
mU: 2;
|
|
363
|
+
};
|
|
364
|
+
MGA: {
|
|
365
|
+
n: 969;
|
|
366
|
+
mU: 2;
|
|
367
|
+
};
|
|
368
|
+
MKD: {
|
|
369
|
+
n: 807;
|
|
370
|
+
mU: 2;
|
|
371
|
+
};
|
|
372
|
+
MMK: {
|
|
373
|
+
n: 104;
|
|
374
|
+
mU: 2;
|
|
375
|
+
};
|
|
376
|
+
MNT: {
|
|
377
|
+
n: 496;
|
|
378
|
+
mU: 2;
|
|
379
|
+
};
|
|
380
|
+
MOP: {
|
|
381
|
+
n: 446;
|
|
382
|
+
mU: 2;
|
|
383
|
+
};
|
|
384
|
+
MRU: {
|
|
385
|
+
n: 929;
|
|
386
|
+
mU: 2;
|
|
387
|
+
};
|
|
388
|
+
MUR: {
|
|
389
|
+
n: 480;
|
|
390
|
+
mU: 2;
|
|
391
|
+
};
|
|
392
|
+
MVR: {
|
|
393
|
+
n: 462;
|
|
394
|
+
mU: 2;
|
|
395
|
+
};
|
|
396
|
+
MWK: {
|
|
397
|
+
n: 454;
|
|
398
|
+
mU: 2;
|
|
399
|
+
};
|
|
400
|
+
MXN: {
|
|
401
|
+
n: 484;
|
|
402
|
+
mU: 2;
|
|
403
|
+
};
|
|
404
|
+
MXV: {
|
|
405
|
+
n: 979;
|
|
406
|
+
mU: 2;
|
|
407
|
+
};
|
|
408
|
+
MYR: {
|
|
409
|
+
n: 458;
|
|
410
|
+
mU: 2;
|
|
411
|
+
};
|
|
412
|
+
MZN: {
|
|
413
|
+
n: 943;
|
|
414
|
+
mU: 2;
|
|
415
|
+
};
|
|
416
|
+
NAD: {
|
|
417
|
+
n: 516;
|
|
418
|
+
mU: 2;
|
|
419
|
+
};
|
|
420
|
+
NGN: {
|
|
421
|
+
n: 566;
|
|
422
|
+
mU: 2;
|
|
423
|
+
};
|
|
424
|
+
NIO: {
|
|
425
|
+
n: 558;
|
|
426
|
+
mU: 2;
|
|
427
|
+
};
|
|
428
|
+
NOK: {
|
|
429
|
+
n: 578;
|
|
430
|
+
mU: 2;
|
|
431
|
+
};
|
|
432
|
+
NPR: {
|
|
433
|
+
n: 524;
|
|
434
|
+
mU: 2;
|
|
435
|
+
};
|
|
436
|
+
NZD: {
|
|
437
|
+
n: 554;
|
|
438
|
+
mU: 2;
|
|
439
|
+
};
|
|
440
|
+
OMR: {
|
|
441
|
+
n: 512;
|
|
442
|
+
mU: 3;
|
|
443
|
+
};
|
|
444
|
+
PAB: {
|
|
445
|
+
n: 590;
|
|
446
|
+
mU: 2;
|
|
447
|
+
};
|
|
448
|
+
PEN: {
|
|
449
|
+
n: 604;
|
|
450
|
+
mU: 2;
|
|
451
|
+
};
|
|
452
|
+
PGK: {
|
|
453
|
+
n: 598;
|
|
454
|
+
mU: 2;
|
|
455
|
+
};
|
|
456
|
+
PHP: {
|
|
457
|
+
n: 608;
|
|
458
|
+
mU: 2;
|
|
459
|
+
};
|
|
460
|
+
PKR: {
|
|
461
|
+
n: 586;
|
|
462
|
+
mU: 2;
|
|
463
|
+
};
|
|
464
|
+
PLN: {
|
|
465
|
+
n: 985;
|
|
466
|
+
mU: 2;
|
|
467
|
+
};
|
|
468
|
+
PYG: {
|
|
469
|
+
n: 600;
|
|
470
|
+
mU: 0;
|
|
471
|
+
};
|
|
472
|
+
QAR: {
|
|
473
|
+
n: 634;
|
|
474
|
+
mU: 2;
|
|
475
|
+
};
|
|
476
|
+
RON: {
|
|
477
|
+
n: 946;
|
|
478
|
+
mU: 2;
|
|
479
|
+
};
|
|
480
|
+
RSD: {
|
|
481
|
+
n: 941;
|
|
482
|
+
mU: 2;
|
|
483
|
+
};
|
|
484
|
+
RUB: {
|
|
485
|
+
n: 643;
|
|
486
|
+
mU: 2;
|
|
487
|
+
};
|
|
488
|
+
RWF: {
|
|
489
|
+
n: 646;
|
|
490
|
+
mU: 0;
|
|
491
|
+
};
|
|
492
|
+
SAR: {
|
|
493
|
+
n: 682;
|
|
494
|
+
mU: 2;
|
|
495
|
+
};
|
|
496
|
+
SBD: {
|
|
497
|
+
n: 90;
|
|
498
|
+
mU: 2;
|
|
499
|
+
};
|
|
500
|
+
SCR: {
|
|
501
|
+
n: 690;
|
|
502
|
+
mU: 2;
|
|
503
|
+
};
|
|
504
|
+
SDG: {
|
|
505
|
+
n: 938;
|
|
506
|
+
mU: 2;
|
|
507
|
+
};
|
|
508
|
+
SEK: {
|
|
509
|
+
n: 752;
|
|
510
|
+
mU: 2;
|
|
511
|
+
};
|
|
512
|
+
SGD: {
|
|
513
|
+
n: 702;
|
|
514
|
+
mU: 2;
|
|
515
|
+
};
|
|
516
|
+
SHP: {
|
|
517
|
+
n: 654;
|
|
518
|
+
mU: 2;
|
|
519
|
+
};
|
|
520
|
+
SLE: {
|
|
521
|
+
n: 925;
|
|
522
|
+
mU: 2;
|
|
523
|
+
};
|
|
524
|
+
SOS: {
|
|
525
|
+
n: 706;
|
|
526
|
+
mU: 2;
|
|
527
|
+
};
|
|
528
|
+
SRD: {
|
|
529
|
+
n: 968;
|
|
530
|
+
mU: 2;
|
|
531
|
+
};
|
|
532
|
+
SSP: {
|
|
533
|
+
n: 728;
|
|
534
|
+
mU: 2;
|
|
535
|
+
};
|
|
536
|
+
STN: {
|
|
537
|
+
n: 930;
|
|
538
|
+
mU: 2;
|
|
539
|
+
};
|
|
540
|
+
SVC: {
|
|
541
|
+
n: 222;
|
|
542
|
+
mU: 2;
|
|
543
|
+
};
|
|
544
|
+
SYP: {
|
|
545
|
+
n: 760;
|
|
546
|
+
mU: 2;
|
|
547
|
+
};
|
|
548
|
+
SZL: {
|
|
549
|
+
n: 748;
|
|
550
|
+
mU: 2;
|
|
551
|
+
};
|
|
552
|
+
THB: {
|
|
553
|
+
n: 764;
|
|
554
|
+
mU: 2;
|
|
555
|
+
};
|
|
556
|
+
TJS: {
|
|
557
|
+
n: 972;
|
|
558
|
+
mU: 2;
|
|
559
|
+
};
|
|
560
|
+
TMT: {
|
|
561
|
+
n: 934;
|
|
562
|
+
mU: 2;
|
|
563
|
+
};
|
|
564
|
+
TND: {
|
|
565
|
+
n: 788;
|
|
566
|
+
mU: 3;
|
|
567
|
+
};
|
|
568
|
+
TOP: {
|
|
569
|
+
n: 776;
|
|
570
|
+
mU: 2;
|
|
571
|
+
};
|
|
572
|
+
TRY: {
|
|
573
|
+
n: 949;
|
|
574
|
+
mU: 2;
|
|
575
|
+
};
|
|
576
|
+
TTD: {
|
|
577
|
+
n: 780;
|
|
578
|
+
mU: 2;
|
|
579
|
+
};
|
|
580
|
+
TWD: {
|
|
581
|
+
n: 901;
|
|
582
|
+
mU: 2;
|
|
583
|
+
};
|
|
584
|
+
TZS: {
|
|
585
|
+
n: 834;
|
|
586
|
+
mU: 2;
|
|
587
|
+
};
|
|
588
|
+
UAH: {
|
|
589
|
+
n: 980;
|
|
590
|
+
mU: 2;
|
|
591
|
+
};
|
|
592
|
+
UGX: {
|
|
593
|
+
n: 800;
|
|
594
|
+
mU: 0;
|
|
595
|
+
};
|
|
596
|
+
USD: {
|
|
597
|
+
n: 840;
|
|
598
|
+
mU: 2;
|
|
599
|
+
};
|
|
600
|
+
USN: {
|
|
601
|
+
n: 997;
|
|
602
|
+
mU: 2;
|
|
603
|
+
};
|
|
604
|
+
UYI: {
|
|
605
|
+
n: 940;
|
|
606
|
+
mU: 0;
|
|
607
|
+
};
|
|
608
|
+
UYU: {
|
|
609
|
+
n: 858;
|
|
610
|
+
mU: 2;
|
|
611
|
+
};
|
|
612
|
+
UYW: {
|
|
613
|
+
n: 927;
|
|
614
|
+
mU: 4;
|
|
615
|
+
};
|
|
616
|
+
UZS: {
|
|
617
|
+
n: 860;
|
|
618
|
+
mU: 2;
|
|
619
|
+
};
|
|
620
|
+
VED: {
|
|
621
|
+
n: 926;
|
|
622
|
+
mU: 2;
|
|
623
|
+
};
|
|
624
|
+
VES: {
|
|
625
|
+
n: 928;
|
|
626
|
+
mU: 2;
|
|
627
|
+
};
|
|
628
|
+
VND: {
|
|
629
|
+
n: 704;
|
|
630
|
+
mU: 0;
|
|
631
|
+
};
|
|
632
|
+
VUV: {
|
|
633
|
+
n: 548;
|
|
634
|
+
mU: 0;
|
|
635
|
+
};
|
|
636
|
+
WST: {
|
|
637
|
+
n: 882;
|
|
638
|
+
mU: 2;
|
|
639
|
+
};
|
|
640
|
+
XAF: {
|
|
641
|
+
n: 950;
|
|
642
|
+
mU: 0;
|
|
643
|
+
};
|
|
644
|
+
XAG: {
|
|
645
|
+
n: 961;
|
|
646
|
+
mU: null;
|
|
647
|
+
};
|
|
648
|
+
XAU: {
|
|
649
|
+
n: 959;
|
|
650
|
+
mU: null;
|
|
651
|
+
};
|
|
652
|
+
XBA: {
|
|
653
|
+
n: 955;
|
|
654
|
+
mU: null;
|
|
655
|
+
};
|
|
656
|
+
XBB: {
|
|
657
|
+
n: 956;
|
|
658
|
+
mU: null;
|
|
659
|
+
};
|
|
660
|
+
XBC: {
|
|
661
|
+
n: 957;
|
|
662
|
+
mU: null;
|
|
663
|
+
};
|
|
664
|
+
XBD: {
|
|
665
|
+
n: 958;
|
|
666
|
+
mU: null;
|
|
667
|
+
};
|
|
668
|
+
XCD: {
|
|
669
|
+
n: 951;
|
|
670
|
+
mU: 2;
|
|
671
|
+
};
|
|
672
|
+
XDR: {
|
|
673
|
+
n: 960;
|
|
674
|
+
mU: null;
|
|
675
|
+
};
|
|
676
|
+
XOF: {
|
|
677
|
+
n: 952;
|
|
678
|
+
mU: 0;
|
|
679
|
+
};
|
|
680
|
+
XPD: {
|
|
681
|
+
n: 964;
|
|
682
|
+
mU: null;
|
|
683
|
+
};
|
|
684
|
+
XPF: {
|
|
685
|
+
n: 953;
|
|
686
|
+
mU: 0;
|
|
687
|
+
};
|
|
688
|
+
XPT: {
|
|
689
|
+
n: 962;
|
|
690
|
+
mU: null;
|
|
691
|
+
};
|
|
692
|
+
XSU: {
|
|
693
|
+
n: 994;
|
|
694
|
+
mU: null;
|
|
695
|
+
};
|
|
696
|
+
XTS: {
|
|
697
|
+
n: 963;
|
|
698
|
+
mU: null;
|
|
699
|
+
};
|
|
700
|
+
XUA: {
|
|
701
|
+
n: 965;
|
|
702
|
+
mU: null;
|
|
703
|
+
};
|
|
704
|
+
XXX: {
|
|
705
|
+
n: 999;
|
|
706
|
+
mU: null;
|
|
707
|
+
};
|
|
708
|
+
YER: {
|
|
709
|
+
n: 886;
|
|
710
|
+
mU: 2;
|
|
711
|
+
};
|
|
712
|
+
ZAR: {
|
|
713
|
+
n: 710;
|
|
714
|
+
mU: 2;
|
|
715
|
+
};
|
|
716
|
+
ZMW: {
|
|
717
|
+
n: 967;
|
|
718
|
+
mU: 2;
|
|
719
|
+
};
|
|
720
|
+
ZWG: {
|
|
721
|
+
n: 924;
|
|
722
|
+
mU: 2;
|
|
723
|
+
};
|
|
724
|
+
ZWL: {
|
|
725
|
+
n: 932;
|
|
726
|
+
mU: 2;
|
|
727
|
+
};
|
|
728
|
+
};
|
|
729
|
+
/**
|
|
730
|
+
* A Generic utility type that parses a type's keys and properties from
|
|
731
|
+
* sub-objects into an array of arrays each containing each key and
|
|
732
|
+
* its requested properties
|
|
733
|
+
* @template U The root type
|
|
734
|
+
* @template A An array of properties to extract from each key (U[T]) in U
|
|
735
|
+
* @template T Used to force union effects on all keys, please do not override
|
|
736
|
+
* ? What is KASP? An acronym for Keys And Specified Properties :)
|
|
737
|
+
* @example
|
|
738
|
+
* type X = {
|
|
739
|
+
* a: { x: 'String literal'; y: number, z: boolean };
|
|
740
|
+
* b: { x: string; y: number, z: boolean };
|
|
741
|
+
* };
|
|
742
|
+
* type Y = ArrayOfKASP<X, ['x','y']>;
|
|
743
|
+
* // [['a','String literal','number'],['b','string','number']]
|
|
744
|
+
*/
|
|
745
|
+
export type ArrayOfKASP<U, A extends Array<keyof U[T]>, T extends keyof U = keyof U> = Array<T extends keyof U ? [
|
|
746
|
+
T,
|
|
747
|
+
...{
|
|
748
|
+
[K in keyof A]: A[K] extends keyof U[T] ? U[T][A[K]] : never;
|
|
749
|
+
}
|
|
750
|
+
] : never>;
|
|
751
|
+
/**
|
|
752
|
+
* A Generic utility type which returns the opposite of the extends operator (!extends)
|
|
753
|
+
* @template T The type to check if it does not extend U
|
|
754
|
+
* @template U The type to check if T does not extend it
|
|
755
|
+
*/
|
|
756
|
+
export type NotExtends<T, U> = T extends U ? false : true;
|
|
757
|
+
/**
|
|
758
|
+
* A Generic utility type which return the specified properties of a type
|
|
759
|
+
* @template T The type to extract properties from
|
|
760
|
+
* @template Keys The keys to extract from T
|
|
761
|
+
*/
|
|
762
|
+
export type PropertiesOf<T, K extends keyof T> = {
|
|
763
|
+
[Key in K]: T[K];
|
|
764
|
+
}[K];
|
|
765
|
+
/**
|
|
766
|
+
* A Generic utility type which converts a union of keys
|
|
767
|
+
* to another union of keys which conform to the paradigm `${P}${Key}${S}`
|
|
768
|
+
* @template T The Union of keys to apply the prefix/suffix to
|
|
769
|
+
* @template P The prefix to apply to each key
|
|
770
|
+
* @template S The suffix to apply to each key
|
|
771
|
+
* @template A A boolean flag to determine whether to apply the prefix/suffix or remove it
|
|
772
|
+
* @template C A boolean flag to determine whether to capitalize / uncapitalize the key
|
|
773
|
+
* @example
|
|
774
|
+
* type UnionToAlias = 'keyX' | 'keyY' | 'keyZ';
|
|
775
|
+
* type Aliased = AliasUnion<UnionToAlias, 'omit'>; // "omitKeyX" | "omitKeyY" | "omitKeyZ"
|
|
776
|
+
* type De_Aliased = AliasUnion<Aliased, 'omit', '', false>; // "keyX" | "keyY" | "keyZ"
|
|
777
|
+
*/
|
|
778
|
+
export type AliasUnion<T extends string, P extends string = '_', S extends string = '', A extends boolean = true, C extends boolean = true> = A extends true ? T extends string ? `${P}${Capitalize<T>}${S}` : never : T extends string & `${P}${infer Key}${S}` ? C extends true ? Uncapitalize<Key> : Key : never;
|
|
779
|
+
/**
|
|
780
|
+
* A Generic utility type which maps original keys to aliased keys
|
|
781
|
+
* @template T The union of strings to map to aliases
|
|
782
|
+
* @template P The prefix to apply to each key
|
|
783
|
+
* @template S The suffix to apply to each key
|
|
784
|
+
* @template R A boolean flag to determine whether to reverse the mapping (true = original to alias)
|
|
785
|
+
* @example
|
|
786
|
+
* type UnionToAlias = 'keyX' | 'keyY' | 'keyZ';
|
|
787
|
+
* type AliasM = AliasMap<UnionToAlias, 'omit'>; // { "omitKeyX": "keyX", "omitKeyY": "keyY", "omitKeyZ": "keyZ" }
|
|
788
|
+
* type ReverseAliasM = AliasMap<UnionToAlias, 'omit', '', true>; // { "keyX": "omitKeyX", "keyY": "omitKeyY", "keyZ": "omitKeyZ" }
|
|
789
|
+
*/
|
|
790
|
+
export type AliasMap<T extends string, P extends string = '_', S extends string = '', R extends boolean = false> = R extends true ? {
|
|
791
|
+
[K in T]: AliasUnion<K, P, S>;
|
|
792
|
+
} : {
|
|
793
|
+
[A in AliasUnion<T, P, S>]: AliasUnion<A, P, S, false>;
|
|
794
|
+
};
|
|
795
|
+
/**
|
|
796
|
+
* A Generic utility type which allows a value to be either itself or null
|
|
797
|
+
* @template T The type to make nullable
|
|
798
|
+
*/
|
|
799
|
+
export type Nullable<T> = T | null;
|
|
800
|
+
export type NotNullOrOptional<T> = {
|
|
801
|
+
[K in keyof T]-?: Exclude<T[K], null>;
|
|
802
|
+
};
|
|
803
|
+
/**
|
|
804
|
+
* A Generic utility type which flattens arrays into unions containing the array's elements
|
|
805
|
+
* @template T The type to flatten (can contain non-array types which will be included in the returned union)
|
|
806
|
+
* @example
|
|
807
|
+
* type X = FlattenUnion<[1,2,3]>; // 1 | 2 | 3
|
|
808
|
+
* type Y = FlattenUnion<[1,2,3] | 'a' | 'b'>; // 1 | 2 | 3 | 'a' | 'b'
|
|
809
|
+
*/
|
|
810
|
+
export type FlattenUnion<T> = T extends Array<infer U> ? U : T;
|
|
811
|
+
/**
|
|
812
|
+
* A Generic utility type which forms a union of the values of a given type
|
|
813
|
+
* * Is not inherently recursive, will only extract the first level of keys
|
|
814
|
+
* @template T The type to extract values from
|
|
815
|
+
* @example
|
|
816
|
+
* type X = { a: 1; b: 2; c: 3 };
|
|
817
|
+
* type Y = UnionOfTValues<X>; // 1 | 2 | 3
|
|
818
|
+
*/
|
|
819
|
+
export type UnionOfTValues<T, K = keyof T> = K extends keyof T ? T[K] : never;
|
|
820
|
+
/** Provides an extensible interface for commonly used Date markers */
|
|
821
|
+
export interface GenericTimeKeys {
|
|
822
|
+
/** The date at which the entity was created */
|
|
823
|
+
createdAtMs: DateMS;
|
|
824
|
+
/** The date at which the entity was last updated */
|
|
825
|
+
updatedAtMs: DateMS;
|
|
826
|
+
}
|
|
827
|
+
/** Provides an extensible interface for commonly used Date markers used by the database (prisma) */
|
|
828
|
+
export interface GenericTimeKeysDB {
|
|
829
|
+
/** The date at which the entity was created */
|
|
830
|
+
createdAt: Date;
|
|
831
|
+
/** The date at which the entity was last updated */
|
|
832
|
+
updatedAt: Date;
|
|
833
|
+
}
|
|
834
|
+
/**
|
|
835
|
+
* A Generic utility type which switches the time keys of a type M to either GenericTimeKeys or GenericTimeKeysDB
|
|
836
|
+
*/
|
|
837
|
+
export type UseTimeKeys<M, Expects = GenericTimeKeys | GenericTimeKeysDB> = Expects extends GenericTimeKeysDB ? Omit<M, keyof GenericTimeKeys> & GenericTimeKeysDB : Omit<M, keyof GenericTimeKeysDB> & GenericTimeKeys;
|
|
838
|
+
/**
|
|
839
|
+
* A Generic utility type which effectively coerces type T to its primitive counterpart
|
|
840
|
+
*/
|
|
841
|
+
export type RootType<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T extends bigint ? bigint : T extends symbol ? symbol : T extends null ? null : T extends undefined ? undefined : T extends object ? T extends Array<infer U> ? RootType<U>[] : T : never;
|
|
842
|
+
/**
|
|
843
|
+
* A Generic utility type which expands the functionality of RootType to unions
|
|
844
|
+
*/
|
|
845
|
+
export type ReduceUnion<T> = T extends any ? RootType<T> : never;
|
|
846
|
+
/**
|
|
847
|
+
* A Generic utility type which reduces the keys of a type T to their primitive types
|
|
848
|
+
* * This is useful for converting complex types to their primitive counterparts
|
|
849
|
+
* @template T The type to reduce the keys of
|
|
850
|
+
* @example
|
|
851
|
+
* type X = { a: { x: 'literal0' | 'literal1'; y: 0 | 5, z: true | false }; b: { x: string; y: number, z: boolean } };
|
|
852
|
+
* type Y = ReduceKeysToPrimitives<X>; // { a: { x: string; y: number, z: boolean }; b: { x: string; y: number, z: boolean } }
|
|
853
|
+
*/
|
|
854
|
+
export type ReduceKeysToPrimitives<T> = {
|
|
855
|
+
[K in keyof T]: ReduceUnion<T[K]>;
|
|
856
|
+
};
|
|
857
|
+
/**
|
|
858
|
+
* A Generic utility type which extracts id's as a union of their keys from a given type T
|
|
859
|
+
* @template T The type to extract id's from
|
|
860
|
+
* @template S The suffix to search for in the keys of T, defaults to 'Id'
|
|
861
|
+
* @template X The keys of T to search for, defaults to all keys of T
|
|
862
|
+
*/
|
|
863
|
+
export type IdStrIn<T, S extends string = 'Id', X extends keyof T = keyof T> = X extends `${infer _}${S}` | 'id' ? X : never;
|
|
864
|
+
/**
|
|
865
|
+
* A Generic utility type which extracts id's from a given type T
|
|
866
|
+
* @template T The type to extract id's from
|
|
867
|
+
*/
|
|
868
|
+
export type IdIn<T> = Pick<T, IdStrIn<T>>;
|
|
869
|
+
/** A type alias for a number, that should only represent time in milliseconds */
|
|
870
|
+
export type DateMS = number;
|
|
871
|
+
/** A type alias for a number, that should only represent a quantity of gigs (6 minute intervals of work) */
|
|
872
|
+
export type GigQty = number;
|
|
873
|
+
/** A type alias for a number, that should only represent a quantity of a currency in its smallest fractional unit (E.G. cents in USD) */
|
|
874
|
+
export type CurrencySFU = number;
|
|
875
|
+
/**
|
|
876
|
+
* A Generic utility type which compares a type to "never" providing a boolean representation as to whether or not
|
|
877
|
+
* the aforementioned type is "never"
|
|
878
|
+
*/
|
|
879
|
+
export type IsNever<T> = [T] extends [never] ? true : false;
|
|
880
|
+
/**
|
|
881
|
+
* A Generic utility type which extracts the property on type T at K when K is a key of T;
|
|
882
|
+
* but does not constrain K to be a key of T
|
|
883
|
+
* @template T The type to extract the property from
|
|
884
|
+
* @template K The key to extract the property at
|
|
885
|
+
* @example
|
|
886
|
+
* type X = { a: 1; b: 2; c: 3 };
|
|
887
|
+
* type Y = KNever<X, 'a'>; // 1
|
|
888
|
+
* type Z = KNever<X, 'd'>; // never
|
|
889
|
+
*/
|
|
890
|
+
export type KNever<T, K> = K extends keyof T ? T[K] : never;
|
|
891
|
+
/**
|
|
892
|
+
* A Generic utility type which extracts from S keys which are present in P
|
|
893
|
+
* @template P The type which contains the keys to extract from S if they are present
|
|
894
|
+
* @template S The type to extract keys from
|
|
895
|
+
* @example
|
|
896
|
+
* type P = 'a' | 'b' | 'c';
|
|
897
|
+
* type S = 'b' | 'c' | 'd';
|
|
898
|
+
* type X = ExtractKeys<P, S>; // 'b' | 'c'
|
|
899
|
+
*/
|
|
900
|
+
export type OfPUnion<P, S> = S extends P ? S : never;
|
|
901
|
+
/**
|
|
902
|
+
* A Generic utility type which represents either T or a Promise of T
|
|
903
|
+
* @template T The type to represent as a Promise or an immediate value of
|
|
904
|
+
*/
|
|
905
|
+
export type PromiseOrValue<T> = T | Promise<T>;
|
|
906
|
+
/**
|
|
907
|
+
* A niched utility type which performs the core advertised functionality of ProviderIfInHost, and
|
|
908
|
+
* converts type E to a type which provides values which are members of Host H
|
|
909
|
+
* @template E The (entity) type to convert
|
|
910
|
+
* @template H The (host) type which contains types that should be converted to provider functions
|
|
911
|
+
*/
|
|
912
|
+
export type EntityProvider<E, H, P extends keyof E = keyof E> = {
|
|
913
|
+
[K in P]: E[K] extends UnionOfTValues<H> ? (...args: any) => PromiseOrValue<ProviderIfInHost<E[K], H>> : E[K] extends UnionOfTValues<H>[] ? ProviderIfInHost<E[K], H> : E[K];
|
|
914
|
+
};
|
|
915
|
+
/**
|
|
916
|
+
* A Generic utility type which converts a type to a type which provides values
|
|
917
|
+
* which are members of Host H (provider functions).
|
|
918
|
+
* * Useful for preventing direct recursive access to members which are described by the host
|
|
919
|
+
* @template T The type to convert
|
|
920
|
+
* @template H The host type which contains types that should be converted to provider functions
|
|
921
|
+
*/
|
|
922
|
+
export type ProviderIfInHost<T, H> = T extends Array<any> ? (...args: any) => PromiseOrValue<{
|
|
923
|
+
[K in keyof T]: EntityProvider<T[K], H>;
|
|
924
|
+
}> : EntityProvider<T, H>;
|
|
925
|
+
/**
|
|
926
|
+
* An abstract type which represents a "model" host, a niched type, grouping types which may reference each other
|
|
927
|
+
* @template T A type which contains types that may be self-referential (from the host context)
|
|
928
|
+
* @example
|
|
929
|
+
* type X = ModelHost<{
|
|
930
|
+
* a: { x: 'String literal'; y: number, z: boolean }; // Target within host X
|
|
931
|
+
* b: X['a'][]; // Self-referential property of host X
|
|
932
|
+
* }>;
|
|
933
|
+
*
|
|
934
|
+
*/
|
|
935
|
+
export type ModelHost<T extends Record<keyof any, unknown>> = T;
|
|
936
|
+
/**
|
|
937
|
+
* A Generic utility type which extracts the keys of a type T which are present in a type H
|
|
938
|
+
*/
|
|
939
|
+
export type StoreOfModel<M extends ModelHost<any>, A extends keyof any> = A extends keyof any ? keyof M : never;
|
|
940
|
+
/**
|
|
941
|
+
* A Generic utility type which allows for extensible Action results to be defined with a success state
|
|
942
|
+
* @template S The success state of the action
|
|
943
|
+
* @template T The type of the result to be included in the action result
|
|
944
|
+
*/
|
|
945
|
+
export type ActionResult_T<S extends boolean, T extends object> = {
|
|
946
|
+
/** The result success state of the action */
|
|
947
|
+
success: S;
|
|
948
|
+
} & T;
|
|
949
|
+
/**
|
|
950
|
+
* A Generic utility type which represents an action result with a success state and a result
|
|
951
|
+
* @template S The success state of the action
|
|
952
|
+
* @template T The type of the result to be included in the action result
|
|
953
|
+
*/
|
|
954
|
+
export type StatefulResult<S extends boolean = true | false, T extends object = S extends true ? object : {
|
|
955
|
+
/** The error code */
|
|
956
|
+
errorCode: KnownErrorCodes;
|
|
957
|
+
/** The error message */
|
|
958
|
+
errorMessage?: string;
|
|
959
|
+
}> = ActionResult_T<S, T>;
|
|
960
|
+
export type SuccessResult = StatefulResult<true, object>;
|
|
961
|
+
export type FailedResult = StatefulResult<false, {
|
|
962
|
+
errorCode: KnownErrorCodes;
|
|
963
|
+
errorMessage: string;
|
|
964
|
+
}>;
|
|
965
|
+
/**
|
|
966
|
+
* A Generic utility type which represents data in a manner which is safe for JSON serialization
|
|
967
|
+
*/
|
|
968
|
+
export type SafeJSONSerializable<T, K extends keyof T = keyof T> = {
|
|
969
|
+
[Key in K]: T[Key] extends object ? SafeJSONSerializable<T[Key]> : T[Key] extends Date | bigint ? string : T[Key] extends Function | symbol | undefined | Map<any, any> | Set<any> ? never : T[Key];
|
|
970
|
+
};
|
|
971
|
+
/**
|
|
972
|
+
* A Generic Promise utility type which extracts the type of a promise's resolved value
|
|
973
|
+
* @template T The type of the promise to extract the resolved value from
|
|
974
|
+
*/
|
|
975
|
+
export type PromiseT<T> = T extends Promise<infer U> ? U : T;
|
|
976
|
+
/**
|
|
977
|
+
* A Generic utility type which extracts the keys of a type T which are not present in a type U
|
|
978
|
+
* @template T The type to extract keys from
|
|
979
|
+
* @template U The type to exclude keys from T
|
|
980
|
+
*/
|
|
981
|
+
export type Without<T, U> = {
|
|
982
|
+
[K in Exclude<keyof T, keyof U>]?: never;
|
|
983
|
+
};
|
|
984
|
+
/**
|
|
985
|
+
* A Generic utility type which represents an exclusive OR between two types
|
|
986
|
+
* @template T The first type
|
|
987
|
+
* @template U The second type
|
|
988
|
+
* @template B An optional base type to extend from
|
|
989
|
+
*/
|
|
990
|
+
export type XOR<T, U, B = object> = B & ((T & Without<U, T>) | (U & Without<T, U>));
|
|
991
|
+
//# sourceMappingURL=TypeUtils.d.ts.map
|