@bessemer/cornerstone 0.5.113 → 0.5.114
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/dist/expression.d.ts +17 -1
- package/dist/expression.d.ts.map +1 -1
- package/dist/expression.js.map +1 -1
- package/dist/index.d.ts +301 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/map.d.ts +306 -0
- package/dist/map.d.ts.map +1 -1
- package/dist/map.js.map +1 -1
- package/dist/sql.d.ts +5 -1
- package/dist/sql.d.ts.map +1 -1
- package/dist/sql.js.map +1 -1
- package/dist/zod-util.d.ts +18 -0
- package/dist/zod-util.d.ts.map +1 -1
- package/dist/zod-util.js.map +1 -1
- package/package.json +5 -3
package/dist/expression.d.ts
CHANGED
|
@@ -5,7 +5,23 @@ import * as Expressions from '@bessemer/cornerstone/expression/expression';
|
|
|
5
5
|
import { TaggedType } from '@bessemer/cornerstone/types';
|
|
6
6
|
import { Signable } from '@bessemer/cornerstone/signature';
|
|
7
7
|
import { UnknownRecord } from 'type-fest';
|
|
8
|
-
export {
|
|
8
|
+
export {
|
|
9
|
+
/**
|
|
10
|
+
* @since 2.0.0
|
|
11
|
+
*/
|
|
12
|
+
Expressions,
|
|
13
|
+
/**
|
|
14
|
+
* @since 2.0.0
|
|
15
|
+
*/
|
|
16
|
+
NumericExpressions,
|
|
17
|
+
/**
|
|
18
|
+
* @since 2.0.0
|
|
19
|
+
*/
|
|
20
|
+
StringExpressions,
|
|
21
|
+
/**
|
|
22
|
+
* @since 2.0.0
|
|
23
|
+
*/
|
|
24
|
+
ArrayExpressions, };
|
|
9
25
|
export type ExpressionKey<ReturnType, ArgumentType extends Array<unknown>> = TaggedType<string, ['ExpressionKey', ReturnType, ArgumentType]>;
|
|
10
26
|
export type Expression<ReturnType> = ReturnType | IExpression<ReturnType>;
|
|
11
27
|
export interface IExpression<ReturnType> {
|
package/dist/expression.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expression.d.ts","sourceRoot":"","sources":["../src/expression.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,kBAAkB,MAAM,qDAAqD,CAAA;AACzF,OAAO,KAAK,iBAAiB,MAAM,oDAAoD,CAAA;AACvF,OAAO,KAAK,gBAAgB,MAAM,mDAAmD,CAAA;AACrF,OAAO,KAAK,WAAW,MAAM,6CAA6C,CAAA;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAA;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAEzC,OAAO,
|
|
1
|
+
{"version":3,"file":"expression.d.ts","sourceRoot":"","sources":["../src/expression.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,kBAAkB,MAAM,qDAAqD,CAAA;AACzF,OAAO,KAAK,iBAAiB,MAAM,oDAAoD,CAAA;AACvF,OAAO,KAAK,gBAAgB,MAAM,mDAAmD,CAAA;AACrF,OAAO,KAAK,WAAW,MAAM,6CAA6C,CAAA;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAA;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAEzC,OAAO;AACL;;GAEG;AACH,WAAW;AACX;;GAEG;AACH,kBAAkB;AAClB;;GAEG;AACH,iBAAiB;AACjB;;GAEG;AACH,gBAAgB,GACjB,CAAA;AAED,MAAM,MAAM,aAAa,CAAC,UAAU,EAAE,YAAY,SAAS,KAAK,CAAC,OAAO,CAAC,IAAI,UAAU,CAAC,MAAM,EAAE,CAAC,eAAe,EAAE,UAAU,EAAE,YAAY,CAAC,CAAC,CAAA;AAE5I,MAAM,MAAM,UAAU,CAAC,UAAU,IAAI,UAAU,GAAG,WAAW,CAAC,UAAU,CAAC,CAAA;AAEzE,MAAM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AAS,CAAC,CAAA;CACnE;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,EAAE,aAAa,CAAA;CACzB,CAAA"}
|
package/dist/expression.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/expression.ts"],"sourcesContent":["import * as NumericExpressions from '@bessemer/cornerstone/expression/numeric-expression'\nimport * as StringExpressions from '@bessemer/cornerstone/expression/string-expression'\nimport * as ArrayExpressions from '@bessemer/cornerstone/expression/array-expression'\nimport * as Expressions from '@bessemer/cornerstone/expression/expression'\nimport { TaggedType } from '@bessemer/cornerstone/types'\nimport { Signable } from '@bessemer/cornerstone/signature'\nimport { UnknownRecord } from 'type-fest'\n\nexport { Expressions
|
|
1
|
+
{"version":3,"sources":["../src/expression.ts"],"sourcesContent":["import * as NumericExpressions from '@bessemer/cornerstone/expression/numeric-expression'\nimport * as StringExpressions from '@bessemer/cornerstone/expression/string-expression'\nimport * as ArrayExpressions from '@bessemer/cornerstone/expression/array-expression'\nimport * as Expressions from '@bessemer/cornerstone/expression/expression'\nimport { TaggedType } from '@bessemer/cornerstone/types'\nimport { Signable } from '@bessemer/cornerstone/signature'\nimport { UnknownRecord } from 'type-fest'\n\nexport {\n /**\n * @since 2.0.0\n */\n Expressions,\n /**\n * @since 2.0.0\n */\n NumericExpressions,\n /**\n * @since 2.0.0\n */\n StringExpressions,\n /**\n * @since 2.0.0\n */\n ArrayExpressions,\n}\n\nexport type ExpressionKey<ReturnType, ArgumentType extends Array<unknown>> = TaggedType<string, ['ExpressionKey', ReturnType, ArgumentType]>\n\nexport type Expression<ReturnType> = ReturnType | IExpression<ReturnType>\n\nexport interface IExpression<ReturnType> {\n expressionKey: ExpressionKey<ReturnType, Array<unknown>>\n}\n\nexport interface ExpressionReference<ReturnType, ArgumentType extends Array<unknown>> {\n expressionKey: ExpressionKey<ReturnType, ArgumentType>\n}\n\nexport interface ReducingExpression<ReturnType, ArgumentType> extends ExpressionReference<ReturnType, [Array<Expression<ArgumentType>>]> {}\n\nexport type EvaluateExpression = <T>(expression: Expression<T>) => T\n\nexport type ExpressionDefinition<\n ReturnType,\n ArgumentType extends Array<unknown>,\n ExpressionType extends Expression<ReturnType>\n> = ExpressionReference<ReturnType, ArgumentType> & {\n expressionKey: ExpressionKey<ReturnType, ArgumentType>\n builder: (...parameters: ArgumentType) => ExpressionType\n resolver: (expression: ExpressionType, evaluate: EvaluateExpression, context: ExpressionContext) => ReturnType\n}\n\nexport interface ExpressionVariable<T> extends IExpression<T> {\n expressionKey: 'Variable'\n name: string\n}\n\nexport interface ParameterizedVariable<ValueType, ParameterType extends Array<Signable>> {\n apply(...parameters: ParameterType): ExpressionVariable<ValueType>\n}\n\nexport type ExpressionContext = {\n variables: UnknownRecord\n}\n"],"mappings":";AAAA,YAAY,wBAAwB;AACpC,YAAY,uBAAuB;AACnC,YAAY,sBAAsB;AAClC,YAAY,iBAAiB;","names":[]}
|
package/dist/index.d.ts
CHANGED
|
@@ -73,5 +73,305 @@ import * as HttpMethods from '@bessemer/cornerstone/net/http-method';
|
|
|
73
73
|
import * as ContentTypes from '@bessemer/cornerstone/net/content-type';
|
|
74
74
|
import * as Proxies from '@bessemer/cornerstone/proxy';
|
|
75
75
|
import * as Generators from '@bessemer/cornerstone/generators';
|
|
76
|
-
export {
|
|
76
|
+
export {
|
|
77
|
+
/**
|
|
78
|
+
* @since 2.0.0
|
|
79
|
+
*/
|
|
80
|
+
Types,
|
|
81
|
+
/**
|
|
82
|
+
* @since 2.0.0
|
|
83
|
+
*/
|
|
84
|
+
Objects,
|
|
85
|
+
/**
|
|
86
|
+
* @since 2.0.0
|
|
87
|
+
*/
|
|
88
|
+
Functions,
|
|
89
|
+
/**
|
|
90
|
+
* @since 2.0.0
|
|
91
|
+
*/
|
|
92
|
+
Arrays,
|
|
93
|
+
/**
|
|
94
|
+
* @since 2.0.0
|
|
95
|
+
*/
|
|
96
|
+
Strings,
|
|
97
|
+
/**
|
|
98
|
+
* @since 2.0.0
|
|
99
|
+
*/
|
|
100
|
+
Async,
|
|
101
|
+
/**
|
|
102
|
+
* @since 2.0.0
|
|
103
|
+
*/
|
|
104
|
+
AsyncValues,
|
|
105
|
+
/**
|
|
106
|
+
* @since 2.0.0
|
|
107
|
+
*/
|
|
108
|
+
Maths,
|
|
109
|
+
/**
|
|
110
|
+
* @since 2.0.0
|
|
111
|
+
*/
|
|
112
|
+
Maps,
|
|
113
|
+
/**
|
|
114
|
+
* @since 2.0.0
|
|
115
|
+
*/
|
|
116
|
+
Sets,
|
|
117
|
+
/**
|
|
118
|
+
* @since 2.0.0
|
|
119
|
+
*/
|
|
120
|
+
Dates,
|
|
121
|
+
/**
|
|
122
|
+
* @since 2.0.0
|
|
123
|
+
*/
|
|
124
|
+
Comparators,
|
|
125
|
+
/**
|
|
126
|
+
* @since 2.0.0
|
|
127
|
+
*/
|
|
128
|
+
Equalitors,
|
|
129
|
+
/**
|
|
130
|
+
* @since 2.0.0
|
|
131
|
+
*/
|
|
132
|
+
Durations,
|
|
133
|
+
/**
|
|
134
|
+
* @since 2.0.0
|
|
135
|
+
*/
|
|
136
|
+
Uris,
|
|
137
|
+
/**
|
|
138
|
+
* @since 2.0.0
|
|
139
|
+
*/
|
|
140
|
+
Urls,
|
|
141
|
+
/**
|
|
142
|
+
* @since 2.0.0
|
|
143
|
+
*/
|
|
144
|
+
Loggers,
|
|
145
|
+
/**
|
|
146
|
+
* @since 2.0.0
|
|
147
|
+
*/
|
|
148
|
+
Errors,
|
|
149
|
+
/**
|
|
150
|
+
* @since 2.0.0
|
|
151
|
+
*/
|
|
152
|
+
ErrorTypes,
|
|
153
|
+
/**
|
|
154
|
+
* @since 2.0.0
|
|
155
|
+
*/
|
|
156
|
+
ErrorCodes,
|
|
157
|
+
/**
|
|
158
|
+
* @since 2.0.0
|
|
159
|
+
*/
|
|
160
|
+
ErrorCauses,
|
|
161
|
+
/**
|
|
162
|
+
* @since 2.0.0
|
|
163
|
+
*/
|
|
164
|
+
ErrorEvents,
|
|
165
|
+
/**
|
|
166
|
+
* @since 2.0.0
|
|
167
|
+
*/
|
|
168
|
+
Assertions,
|
|
169
|
+
/**
|
|
170
|
+
* @since 2.0.0
|
|
171
|
+
*/
|
|
172
|
+
Uuid4,
|
|
173
|
+
/**
|
|
174
|
+
* @since 2.0.0
|
|
175
|
+
*/
|
|
176
|
+
Uuid7,
|
|
177
|
+
/**
|
|
178
|
+
* @since 2.0.0
|
|
179
|
+
*/
|
|
180
|
+
Ulids,
|
|
181
|
+
/**
|
|
182
|
+
* @since 2.0.0
|
|
183
|
+
*/
|
|
184
|
+
Entries,
|
|
185
|
+
/**
|
|
186
|
+
* @since 2.0.0
|
|
187
|
+
*/
|
|
188
|
+
Hashes,
|
|
189
|
+
/**
|
|
190
|
+
* @since 2.0.0
|
|
191
|
+
*/
|
|
192
|
+
Crypto,
|
|
193
|
+
/**
|
|
194
|
+
* @since 2.0.0
|
|
195
|
+
*/
|
|
196
|
+
Globs,
|
|
197
|
+
/**
|
|
198
|
+
* @since 2.0.0
|
|
199
|
+
*/
|
|
200
|
+
Ranges,
|
|
201
|
+
/**
|
|
202
|
+
* @since 2.0.0
|
|
203
|
+
*/
|
|
204
|
+
ObjectPaths,
|
|
205
|
+
/**
|
|
206
|
+
* @since 2.0.0
|
|
207
|
+
*/
|
|
208
|
+
TypePaths,
|
|
209
|
+
/**
|
|
210
|
+
* @since 2.0.0
|
|
211
|
+
*/
|
|
212
|
+
ObjectDiffs,
|
|
213
|
+
/**
|
|
214
|
+
* @since 2.0.0
|
|
215
|
+
*/
|
|
216
|
+
Clocks,
|
|
217
|
+
/**
|
|
218
|
+
* @since 2.0.0
|
|
219
|
+
*/
|
|
220
|
+
TimeZoneIds,
|
|
221
|
+
/**
|
|
222
|
+
* @since 2.0.0
|
|
223
|
+
*/
|
|
224
|
+
TimeZoneOffsets,
|
|
225
|
+
/**
|
|
226
|
+
* @since 2.0.0
|
|
227
|
+
*/
|
|
228
|
+
Instants,
|
|
229
|
+
/**
|
|
230
|
+
* @since 2.0.0
|
|
231
|
+
*/
|
|
232
|
+
PlainDates,
|
|
233
|
+
/**
|
|
234
|
+
* @since 2.0.0
|
|
235
|
+
*/
|
|
236
|
+
PlainTimes,
|
|
237
|
+
/**
|
|
238
|
+
* @since 2.0.0
|
|
239
|
+
*/
|
|
240
|
+
PlainDateTimes,
|
|
241
|
+
/**
|
|
242
|
+
* @since 2.0.0
|
|
243
|
+
*/
|
|
244
|
+
ZodUtil,
|
|
245
|
+
/**
|
|
246
|
+
* @since 2.0.0
|
|
247
|
+
*/
|
|
248
|
+
Tags,
|
|
249
|
+
/**
|
|
250
|
+
* @since 2.0.0
|
|
251
|
+
*/
|
|
252
|
+
Promises,
|
|
253
|
+
/**
|
|
254
|
+
* @since 2.0.0
|
|
255
|
+
*/
|
|
256
|
+
References,
|
|
257
|
+
/**
|
|
258
|
+
* @since 2.0.0
|
|
259
|
+
*/
|
|
260
|
+
Signatures,
|
|
261
|
+
/**
|
|
262
|
+
* @since 2.0.0
|
|
263
|
+
*/
|
|
264
|
+
Eithers,
|
|
265
|
+
/**
|
|
266
|
+
* @since 2.0.0
|
|
267
|
+
*/
|
|
268
|
+
Results,
|
|
269
|
+
/**
|
|
270
|
+
* @since 2.0.0
|
|
271
|
+
*/
|
|
272
|
+
Lazy,
|
|
273
|
+
/**
|
|
274
|
+
* @since 2.0.0
|
|
275
|
+
*/
|
|
276
|
+
Patches,
|
|
277
|
+
/**
|
|
278
|
+
* @since 2.0.0
|
|
279
|
+
*/
|
|
280
|
+
Content,
|
|
281
|
+
/**
|
|
282
|
+
* @since 2.0.0
|
|
283
|
+
*/
|
|
284
|
+
Combinables,
|
|
285
|
+
/**
|
|
286
|
+
* @since 2.0.0
|
|
287
|
+
*/
|
|
288
|
+
Properties,
|
|
289
|
+
/**
|
|
290
|
+
* @since 2.0.0
|
|
291
|
+
*/
|
|
292
|
+
RichTexts,
|
|
293
|
+
/**
|
|
294
|
+
* @since 2.0.0
|
|
295
|
+
*/
|
|
296
|
+
Retry,
|
|
297
|
+
/**
|
|
298
|
+
* @since 2.0.0
|
|
299
|
+
*/
|
|
300
|
+
Stores,
|
|
301
|
+
/**
|
|
302
|
+
* @since 2.0.0
|
|
303
|
+
*/
|
|
304
|
+
Misc,
|
|
305
|
+
/**
|
|
306
|
+
* @since 2.0.0
|
|
307
|
+
*/
|
|
308
|
+
Json,
|
|
309
|
+
/**
|
|
310
|
+
* @since 2.0.0
|
|
311
|
+
*/
|
|
312
|
+
AspectRatios,
|
|
313
|
+
/**
|
|
314
|
+
* @since 2.0.0
|
|
315
|
+
*/
|
|
316
|
+
DataSizes,
|
|
317
|
+
/**
|
|
318
|
+
* @since 2.0.0
|
|
319
|
+
*/
|
|
320
|
+
MimeTypes,
|
|
321
|
+
/**
|
|
322
|
+
* @since 2.0.0
|
|
323
|
+
*/
|
|
324
|
+
CurrencyCodes,
|
|
325
|
+
/**
|
|
326
|
+
* @since 2.0.0
|
|
327
|
+
*/
|
|
328
|
+
MonetaryAmounts,
|
|
329
|
+
/**
|
|
330
|
+
* @since 2.0.0
|
|
331
|
+
*/
|
|
332
|
+
CountryCodes,
|
|
333
|
+
/**
|
|
334
|
+
* @since 2.0.0
|
|
335
|
+
*/
|
|
336
|
+
CountrySubdivisionCodes,
|
|
337
|
+
/**
|
|
338
|
+
* @since 2.0.0
|
|
339
|
+
*/
|
|
340
|
+
LanguageCodes,
|
|
341
|
+
/**
|
|
342
|
+
* @since 2.0.0
|
|
343
|
+
*/
|
|
344
|
+
Locales,
|
|
345
|
+
/**
|
|
346
|
+
* @since 2.0.0
|
|
347
|
+
*/
|
|
348
|
+
ResourceKeys,
|
|
349
|
+
/**
|
|
350
|
+
* @since 2.0.0
|
|
351
|
+
*/
|
|
352
|
+
HexCodes,
|
|
353
|
+
/**
|
|
354
|
+
* @since 2.0.0
|
|
355
|
+
*/
|
|
356
|
+
IpV6Addresses,
|
|
357
|
+
/**
|
|
358
|
+
* @since 2.0.0
|
|
359
|
+
*/
|
|
360
|
+
IpV4Addresses,
|
|
361
|
+
/**
|
|
362
|
+
* @since 2.0.0
|
|
363
|
+
*/
|
|
364
|
+
HttpMethods,
|
|
365
|
+
/**
|
|
366
|
+
* @since 2.0.0
|
|
367
|
+
*/
|
|
368
|
+
ContentTypes,
|
|
369
|
+
/**
|
|
370
|
+
* @since 2.0.0
|
|
371
|
+
*/
|
|
372
|
+
Proxies,
|
|
373
|
+
/**
|
|
374
|
+
* @since 2.0.0
|
|
375
|
+
*/
|
|
376
|
+
Generators, };
|
|
77
377
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,6BAA6B,CAAA;AACpD,OAAO,KAAK,OAAO,MAAM,8BAA8B,CAAA;AACvD,OAAO,KAAK,SAAS,MAAM,gCAAgC,CAAA;AAC3D,OAAO,KAAK,MAAM,MAAM,6BAA6B,CAAA;AACrD,OAAO,KAAK,OAAO,MAAM,8BAA8B,CAAA;AACvD,OAAO,KAAK,KAAK,MAAM,6BAA6B,CAAA;AACpD,OAAO,KAAK,WAAW,MAAM,mCAAmC,CAAA;AAChE,OAAO,KAAK,KAAK,MAAM,4BAA4B,CAAA;AACnD,OAAO,KAAK,IAAI,MAAM,2BAA2B,CAAA;AACjD,OAAO,KAAK,IAAI,MAAM,2BAA2B,CAAA;AACjD,OAAO,KAAK,KAAK,MAAM,qCAAqC,CAAA;AAC5D,OAAO,KAAK,WAAW,MAAM,kCAAkC,CAAA;AAC/D,OAAO,KAAK,UAAU,MAAM,iCAAiC,CAAA;AAC7D,OAAO,KAAK,SAAS,MAAM,yCAAyC,CAAA;AACpE,OAAO,KAAK,IAAI,MAAM,+BAA+B,CAAA;AACrD,OAAO,KAAK,IAAI,MAAM,+BAA+B,CAAA;AACrD,OAAO,KAAK,OAAO,MAAM,8BAA8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AAI;AACJ;;GAEG;AACH,IAAI;AACJ;;GAEG;AACH,YAAY;AACZ;;GAEG;AACH,SAAS;AACT;;GAEG;AACH,SAAS;AACT;;GAEG;AACH,aAAa;AACb;;GAEG;AACH,eAAe;AACf;;GAEG;AACH,YAAY;AACZ;;GAEG;AACH,uBAAuB;AACvB;;GAEG;AACH,aAAa;AACb;;GAEG;AACH,OAAO;AACP;;GAEG;AACH,YAAY;AACZ;;GAEG;AACH,QAAQ;AACR;;GAEG;AACH,aAAa;AACb;;GAEG;AACH,aAAa;AACb;;GAEG;AACH,WAAW;AACX;;GAEG;AACH,YAAY;AACZ;;GAEG;AACH,OAAO;AACP;;GAEG;AACH,UAAU,GACX,CAAA"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import * as Types from '@bessemer/cornerstone/types'\nimport * as Objects from '@bessemer/cornerstone/object'\nimport * as Functions from '@bessemer/cornerstone/function'\nimport * as Arrays from '@bessemer/cornerstone/array'\nimport * as Strings from '@bessemer/cornerstone/string'\nimport * as Async from '@bessemer/cornerstone/async'\nimport * as AsyncValues from '@bessemer/cornerstone/async-value'\nimport * as Maths from '@bessemer/cornerstone/math'\nimport * as Maps from '@bessemer/cornerstone/map'\nimport * as Sets from '@bessemer/cornerstone/set'\nimport * as Dates from '@bessemer/cornerstone/temporal/date'\nimport * as Comparators from '@bessemer/cornerstone/comparator'\nimport * as Equalitors from '@bessemer/cornerstone/equalitor'\nimport * as Durations from '@bessemer/cornerstone/temporal/duration'\nimport * as Uris from '@bessemer/cornerstone/net/uri'\nimport * as Urls from '@bessemer/cornerstone/net/url'\nimport * as Loggers from '@bessemer/cornerstone/logger'\nimport * as Errors from '@bessemer/cornerstone/error/error'\nimport * as ErrorTypes from '@bessemer/cornerstone/error/error-type'\nimport * as ErrorCodes from '@bessemer/cornerstone/error/error-code'\nimport * as ErrorCauses from '@bessemer/cornerstone/error/error-cause'\nimport * as ErrorEvents from '@bessemer/cornerstone/error/error-event'\nimport * as Assertions from '@bessemer/cornerstone/assertion'\nimport * as Uuid4 from '@bessemer/cornerstone/uuid/uuid-v4'\nimport * as Uuid7 from '@bessemer/cornerstone/uuid/uuid-v7'\nimport * as Ulids from '@bessemer/cornerstone/uuid/ulid'\nimport * as Entries from '@bessemer/cornerstone/entry'\nimport * as Hashes from '@bessemer/cornerstone/hash'\nimport * as Crypto from '@bessemer/cornerstone/crypto'\nimport * as Globs from '@bessemer/cornerstone/glob'\nimport * as Ranges from '@bessemer/cornerstone/range'\nimport * as ObjectPaths from '@bessemer/cornerstone/object/object-path'\nimport * as TypePaths from '@bessemer/cornerstone/object/type-path'\nimport * as ObjectDiffs from '@bessemer/cornerstone/object/object-diff'\nimport * as TimeZoneIds from '@bessemer/cornerstone/temporal/time-zone-id'\nimport * as TimeZoneOffsets from '@bessemer/cornerstone/temporal/time-zone-offset'\nimport * as Instants from '@bessemer/cornerstone/temporal/instant'\nimport * as PlainDates from '@bessemer/cornerstone/temporal/plain-date'\nimport * as PlainTimes from '@bessemer/cornerstone/temporal/plain-time'\nimport * as PlainDateTimes from '@bessemer/cornerstone/temporal/plain-date-time'\nimport * as Clocks from '@bessemer/cornerstone/temporal/clock'\n\nimport * as ZodUtil from '@bessemer/cornerstone/zod-util'\nimport * as Tags from '@bessemer/cornerstone/tag'\nimport * as Promises from '@bessemer/cornerstone/promise'\nimport * as References from '@bessemer/cornerstone/reference'\nimport * as Signatures from '@bessemer/cornerstone/signature'\nimport * as Eithers from '@bessemer/cornerstone/either'\nimport * as Results from '@bessemer/cornerstone/result'\nimport * as Lazy from '@bessemer/cornerstone/lazy'\nimport * as Patches from '@bessemer/cornerstone/patch'\nimport * as Content from '@bessemer/cornerstone/content'\nimport * as Combinables from '@bessemer/cornerstone/combinable'\nimport * as Properties from '@bessemer/cornerstone/property'\nimport * as RichTexts from '@bessemer/cornerstone/rich-text'\nimport * as Retry from '@bessemer/cornerstone/retry'\nimport * as Stores from '@bessemer/cornerstone/store'\nimport * as Misc from '@bessemer/cornerstone/misc'\nimport * as Json from '@bessemer/cornerstone/json'\nimport * as AspectRatios from '@bessemer/cornerstone/aspect-ratio'\nimport * as DataSizes from '@bessemer/cornerstone/data-size'\nimport * as MimeTypes from '@bessemer/cornerstone/mime-type'\nimport * as MonetaryAmounts from '@bessemer/cornerstone/monetary-amount'\nimport * as CurrencyCodes from '@bessemer/cornerstone/intl/currency-code'\nimport * as CountryCodes from '@bessemer/cornerstone/intl/country-code'\nimport * as CountrySubdivisionCodes from '@bessemer/cornerstone/intl/country-subdivision-code'\nimport * as LanguageCodes from '@bessemer/cornerstone/intl/language-code'\nimport * as Locales from '@bessemer/cornerstone/intl/locale'\nimport * as ResourceKeys from '@bessemer/cornerstone/resource-key'\nimport * as HexCodes from '@bessemer/cornerstone/hex-code'\nimport * as IpV6Addresses from '@bessemer/cornerstone/net/ipv6-address'\nimport * as IpV4Addresses from '@bessemer/cornerstone/net/ipv4-address'\nimport * as HttpMethods from '@bessemer/cornerstone/net/http-method'\nimport * as ContentTypes from '@bessemer/cornerstone/net/content-type'\nimport * as Proxies from '@bessemer/cornerstone/proxy'\nimport * as Generators from '@bessemer/cornerstone/generators'\n\nexport {\n Types,\n Objects,\n Functions,\n Arrays,\n Strings,\n Async,\n AsyncValues,\n Maths,\n Maps,\n Sets,\n Dates,\n Comparators,\n Equalitors,\n Durations,\n Uris,\n Urls,\n Loggers,\n Errors,\n ErrorTypes,\n ErrorCodes,\n ErrorCauses,\n ErrorEvents,\n Assertions,\n Uuid4,\n Uuid7,\n Ulids,\n Entries,\n Hashes,\n Crypto,\n Globs,\n Ranges,\n ObjectPaths,\n TypePaths,\n ObjectDiffs,\n Clocks,\n TimeZoneIds,\n TimeZoneOffsets,\n Instants,\n PlainDates,\n PlainTimes,\n PlainDateTimes,\n ZodUtil,\n Tags,\n Promises,\n References,\n Signatures,\n Eithers,\n Results,\n Lazy,\n Patches,\n Content,\n Combinables,\n Properties,\n RichTexts,\n Retry,\n Stores,\n Misc,\n Json,\n AspectRatios,\n DataSizes,\n MimeTypes,\n CurrencyCodes,\n MonetaryAmounts,\n CountryCodes,\n CountrySubdivisionCodes,\n LanguageCodes,\n Locales,\n ResourceKeys,\n HexCodes,\n IpV6Addresses,\n IpV4Addresses,\n HttpMethods,\n ContentTypes,\n Proxies,\n Generators,\n}\n"],"mappings":";AAAA,YAAY,WAAW;AACvB,YAAY,aAAa;AACzB,YAAY,eAAe;AAC3B,YAAY,YAAY;AACxB,YAAY,aAAa;AACzB,YAAY,WAAW;AACvB,YAAY,iBAAiB;AAC7B,YAAY,WAAW;AACvB,YAAY,UAAU;AACtB,YAAY,UAAU;AACtB,YAAY,WAAW;AACvB,YAAY,iBAAiB;AAC7B,YAAY,gBAAgB;AAC5B,YAAY,eAAe;AAC3B,YAAY,UAAU;AACtB,YAAY,UAAU;AACtB,YAAY,aAAa;AACzB,YAAY,YAAY;AACxB,YAAY,gBAAgB;AAC5B,YAAY,gBAAgB;AAC5B,YAAY,iBAAiB;AAC7B,YAAY,iBAAiB;AAC7B,YAAY,gBAAgB;AAC5B,YAAY,WAAW;AACvB,YAAY,WAAW;AACvB,YAAY,WAAW;AACvB,YAAY,aAAa;AACzB,YAAY,YAAY;AACxB,YAAY,YAAY;AACxB,YAAY,WAAW;AACvB,YAAY,YAAY;AACxB,YAAY,iBAAiB;AAC7B,YAAY,eAAe;AAC3B,YAAY,iBAAiB;AAC7B,YAAY,iBAAiB;AAC7B,YAAY,qBAAqB;AACjC,YAAY,cAAc;AAC1B,YAAY,gBAAgB;AAC5B,YAAY,gBAAgB;AAC5B,YAAY,oBAAoB;AAChC,YAAY,YAAY;AAExB,YAAY,aAAa;AACzB,YAAY,UAAU;AACtB,YAAY,cAAc;AAC1B,YAAY,gBAAgB;AAC5B,YAAY,gBAAgB;AAC5B,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,UAAU;AACtB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,iBAAiB;AAC7B,YAAY,gBAAgB;AAC5B,YAAY,eAAe;AAC3B,YAAY,WAAW;AACvB,YAAY,YAAY;AACxB,YAAY,UAAU;AACtB,YAAY,UAAU;AACtB,YAAY,kBAAkB;AAC9B,YAAY,eAAe;AAC3B,YAAY,eAAe;AAC3B,YAAY,qBAAqB;AACjC,YAAY,mBAAmB;AAC/B,YAAY,kBAAkB;AAC9B,YAAY,6BAA6B;AACzC,YAAY,mBAAmB;AAC/B,YAAY,aAAa;AACzB,YAAY,kBAAkB;AAC9B,YAAY,cAAc;AAC1B,YAAY,mBAAmB;AAC/B,YAAY,mBAAmB;AAC/B,YAAY,iBAAiB;AAC7B,YAAY,kBAAkB;AAC9B,YAAY,aAAa;AACzB,YAAY,gBAAgB;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import * as Types from '@bessemer/cornerstone/types'\nimport * as Objects from '@bessemer/cornerstone/object'\nimport * as Functions from '@bessemer/cornerstone/function'\nimport * as Arrays from '@bessemer/cornerstone/array'\nimport * as Strings from '@bessemer/cornerstone/string'\nimport * as Async from '@bessemer/cornerstone/async'\nimport * as AsyncValues from '@bessemer/cornerstone/async-value'\nimport * as Maths from '@bessemer/cornerstone/math'\nimport * as Maps from '@bessemer/cornerstone/map'\nimport * as Sets from '@bessemer/cornerstone/set'\nimport * as Dates from '@bessemer/cornerstone/temporal/date'\nimport * as Comparators from '@bessemer/cornerstone/comparator'\nimport * as Equalitors from '@bessemer/cornerstone/equalitor'\nimport * as Durations from '@bessemer/cornerstone/temporal/duration'\nimport * as Uris from '@bessemer/cornerstone/net/uri'\nimport * as Urls from '@bessemer/cornerstone/net/url'\nimport * as Loggers from '@bessemer/cornerstone/logger'\nimport * as Errors from '@bessemer/cornerstone/error/error'\nimport * as ErrorTypes from '@bessemer/cornerstone/error/error-type'\nimport * as ErrorCodes from '@bessemer/cornerstone/error/error-code'\nimport * as ErrorCauses from '@bessemer/cornerstone/error/error-cause'\nimport * as ErrorEvents from '@bessemer/cornerstone/error/error-event'\nimport * as Assertions from '@bessemer/cornerstone/assertion'\nimport * as Uuid4 from '@bessemer/cornerstone/uuid/uuid-v4'\nimport * as Uuid7 from '@bessemer/cornerstone/uuid/uuid-v7'\nimport * as Ulids from '@bessemer/cornerstone/uuid/ulid'\nimport * as Entries from '@bessemer/cornerstone/entry'\nimport * as Hashes from '@bessemer/cornerstone/hash'\nimport * as Crypto from '@bessemer/cornerstone/crypto'\nimport * as Globs from '@bessemer/cornerstone/glob'\nimport * as Ranges from '@bessemer/cornerstone/range'\nimport * as ObjectPaths from '@bessemer/cornerstone/object/object-path'\nimport * as TypePaths from '@bessemer/cornerstone/object/type-path'\nimport * as ObjectDiffs from '@bessemer/cornerstone/object/object-diff'\nimport * as TimeZoneIds from '@bessemer/cornerstone/temporal/time-zone-id'\nimport * as TimeZoneOffsets from '@bessemer/cornerstone/temporal/time-zone-offset'\nimport * as Instants from '@bessemer/cornerstone/temporal/instant'\nimport * as PlainDates from '@bessemer/cornerstone/temporal/plain-date'\nimport * as PlainTimes from '@bessemer/cornerstone/temporal/plain-time'\nimport * as PlainDateTimes from '@bessemer/cornerstone/temporal/plain-date-time'\nimport * as Clocks from '@bessemer/cornerstone/temporal/clock'\n\nimport * as ZodUtil from '@bessemer/cornerstone/zod-util'\nimport * as Tags from '@bessemer/cornerstone/tag'\nimport * as Promises from '@bessemer/cornerstone/promise'\nimport * as References from '@bessemer/cornerstone/reference'\nimport * as Signatures from '@bessemer/cornerstone/signature'\nimport * as Eithers from '@bessemer/cornerstone/either'\nimport * as Results from '@bessemer/cornerstone/result'\nimport * as Lazy from '@bessemer/cornerstone/lazy'\nimport * as Patches from '@bessemer/cornerstone/patch'\nimport * as Content from '@bessemer/cornerstone/content'\nimport * as Combinables from '@bessemer/cornerstone/combinable'\nimport * as Properties from '@bessemer/cornerstone/property'\nimport * as RichTexts from '@bessemer/cornerstone/rich-text'\nimport * as Retry from '@bessemer/cornerstone/retry'\nimport * as Stores from '@bessemer/cornerstone/store'\nimport * as Misc from '@bessemer/cornerstone/misc'\nimport * as Json from '@bessemer/cornerstone/json'\nimport * as AspectRatios from '@bessemer/cornerstone/aspect-ratio'\nimport * as DataSizes from '@bessemer/cornerstone/data-size'\nimport * as MimeTypes from '@bessemer/cornerstone/mime-type'\nimport * as MonetaryAmounts from '@bessemer/cornerstone/monetary-amount'\nimport * as CurrencyCodes from '@bessemer/cornerstone/intl/currency-code'\nimport * as CountryCodes from '@bessemer/cornerstone/intl/country-code'\nimport * as CountrySubdivisionCodes from '@bessemer/cornerstone/intl/country-subdivision-code'\nimport * as LanguageCodes from '@bessemer/cornerstone/intl/language-code'\nimport * as Locales from '@bessemer/cornerstone/intl/locale'\nimport * as ResourceKeys from '@bessemer/cornerstone/resource-key'\nimport * as HexCodes from '@bessemer/cornerstone/hex-code'\nimport * as IpV6Addresses from '@bessemer/cornerstone/net/ipv6-address'\nimport * as IpV4Addresses from '@bessemer/cornerstone/net/ipv4-address'\nimport * as HttpMethods from '@bessemer/cornerstone/net/http-method'\nimport * as ContentTypes from '@bessemer/cornerstone/net/content-type'\nimport * as Proxies from '@bessemer/cornerstone/proxy'\nimport * as Generators from '@bessemer/cornerstone/generators'\n\nexport {\n /**\n * @since 2.0.0\n */\n Types,\n /**\n * @since 2.0.0\n */\n Objects,\n /**\n * @since 2.0.0\n */\n Functions,\n /**\n * @since 2.0.0\n */\n Arrays,\n /**\n * @since 2.0.0\n */\n Strings,\n /**\n * @since 2.0.0\n */\n Async,\n /**\n * @since 2.0.0\n */\n AsyncValues,\n /**\n * @since 2.0.0\n */\n Maths,\n /**\n * @since 2.0.0\n */\n Maps,\n /**\n * @since 2.0.0\n */\n Sets,\n /**\n * @since 2.0.0\n */\n Dates,\n /**\n * @since 2.0.0\n */\n Comparators,\n /**\n * @since 2.0.0\n */\n Equalitors,\n /**\n * @since 2.0.0\n */\n Durations,\n /**\n * @since 2.0.0\n */\n Uris,\n /**\n * @since 2.0.0\n */\n Urls,\n /**\n * @since 2.0.0\n */\n Loggers,\n /**\n * @since 2.0.0\n */\n Errors,\n /**\n * @since 2.0.0\n */\n ErrorTypes,\n /**\n * @since 2.0.0\n */\n ErrorCodes,\n /**\n * @since 2.0.0\n */\n ErrorCauses,\n /**\n * @since 2.0.0\n */\n ErrorEvents,\n /**\n * @since 2.0.0\n */\n Assertions,\n /**\n * @since 2.0.0\n */\n Uuid4,\n /**\n * @since 2.0.0\n */\n Uuid7,\n /**\n * @since 2.0.0\n */\n Ulids,\n /**\n * @since 2.0.0\n */\n Entries,\n /**\n * @since 2.0.0\n */\n Hashes,\n /**\n * @since 2.0.0\n */\n Crypto,\n /**\n * @since 2.0.0\n */\n Globs,\n /**\n * @since 2.0.0\n */\n Ranges,\n /**\n * @since 2.0.0\n */\n ObjectPaths,\n /**\n * @since 2.0.0\n */\n TypePaths,\n /**\n * @since 2.0.0\n */\n ObjectDiffs,\n /**\n * @since 2.0.0\n */\n Clocks,\n /**\n * @since 2.0.0\n */\n TimeZoneIds,\n /**\n * @since 2.0.0\n */\n TimeZoneOffsets,\n /**\n * @since 2.0.0\n */\n Instants,\n /**\n * @since 2.0.0\n */\n PlainDates,\n /**\n * @since 2.0.0\n */\n PlainTimes,\n /**\n * @since 2.0.0\n */\n PlainDateTimes,\n /**\n * @since 2.0.0\n */\n ZodUtil,\n /**\n * @since 2.0.0\n */\n Tags,\n /**\n * @since 2.0.0\n */\n Promises,\n /**\n * @since 2.0.0\n */\n References,\n /**\n * @since 2.0.0\n */\n Signatures,\n /**\n * @since 2.0.0\n */\n Eithers,\n /**\n * @since 2.0.0\n */\n Results,\n /**\n * @since 2.0.0\n */\n Lazy,\n /**\n * @since 2.0.0\n */\n Patches,\n /**\n * @since 2.0.0\n */\n Content,\n /**\n * @since 2.0.0\n */\n Combinables,\n /**\n * @since 2.0.0\n */\n Properties,\n /**\n * @since 2.0.0\n */\n RichTexts,\n /**\n * @since 2.0.0\n */\n Retry,\n /**\n * @since 2.0.0\n */\n Stores,\n /**\n * @since 2.0.0\n */\n Misc,\n /**\n * @since 2.0.0\n */\n Json,\n /**\n * @since 2.0.0\n */\n AspectRatios,\n /**\n * @since 2.0.0\n */\n DataSizes,\n /**\n * @since 2.0.0\n */\n MimeTypes,\n /**\n * @since 2.0.0\n */\n CurrencyCodes,\n /**\n * @since 2.0.0\n */\n MonetaryAmounts,\n /**\n * @since 2.0.0\n */\n CountryCodes,\n /**\n * @since 2.0.0\n */\n CountrySubdivisionCodes,\n /**\n * @since 2.0.0\n */\n LanguageCodes,\n /**\n * @since 2.0.0\n */\n Locales,\n /**\n * @since 2.0.0\n */\n ResourceKeys,\n /**\n * @since 2.0.0\n */\n HexCodes,\n /**\n * @since 2.0.0\n */\n IpV6Addresses,\n /**\n * @since 2.0.0\n */\n IpV4Addresses,\n /**\n * @since 2.0.0\n */\n HttpMethods,\n /**\n * @since 2.0.0\n */\n ContentTypes,\n /**\n * @since 2.0.0\n */\n Proxies,\n /**\n * @since 2.0.0\n */\n Generators,\n}\n"],"mappings":";AAAA,YAAY,WAAW;AACvB,YAAY,aAAa;AACzB,YAAY,eAAe;AAC3B,YAAY,YAAY;AACxB,YAAY,aAAa;AACzB,YAAY,WAAW;AACvB,YAAY,iBAAiB;AAC7B,YAAY,WAAW;AACvB,YAAY,UAAU;AACtB,YAAY,UAAU;AACtB,YAAY,WAAW;AACvB,YAAY,iBAAiB;AAC7B,YAAY,gBAAgB;AAC5B,YAAY,eAAe;AAC3B,YAAY,UAAU;AACtB,YAAY,UAAU;AACtB,YAAY,aAAa;AACzB,YAAY,YAAY;AACxB,YAAY,gBAAgB;AAC5B,YAAY,gBAAgB;AAC5B,YAAY,iBAAiB;AAC7B,YAAY,iBAAiB;AAC7B,YAAY,gBAAgB;AAC5B,YAAY,WAAW;AACvB,YAAY,WAAW;AACvB,YAAY,WAAW;AACvB,YAAY,aAAa;AACzB,YAAY,YAAY;AACxB,YAAY,YAAY;AACxB,YAAY,WAAW;AACvB,YAAY,YAAY;AACxB,YAAY,iBAAiB;AAC7B,YAAY,eAAe;AAC3B,YAAY,iBAAiB;AAC7B,YAAY,iBAAiB;AAC7B,YAAY,qBAAqB;AACjC,YAAY,cAAc;AAC1B,YAAY,gBAAgB;AAC5B,YAAY,gBAAgB;AAC5B,YAAY,oBAAoB;AAChC,YAAY,YAAY;AAExB,YAAY,aAAa;AACzB,YAAY,UAAU;AACtB,YAAY,cAAc;AAC1B,YAAY,gBAAgB;AAC5B,YAAY,gBAAgB;AAC5B,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,UAAU;AACtB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,iBAAiB;AAC7B,YAAY,gBAAgB;AAC5B,YAAY,eAAe;AAC3B,YAAY,WAAW;AACvB,YAAY,YAAY;AACxB,YAAY,UAAU;AACtB,YAAY,UAAU;AACtB,YAAY,kBAAkB;AAC9B,YAAY,eAAe;AAC3B,YAAY,eAAe;AAC3B,YAAY,qBAAqB;AACjC,YAAY,mBAAmB;AAC/B,YAAY,kBAAkB;AAC9B,YAAY,6BAA6B;AACzC,YAAY,mBAAmB;AAC/B,YAAY,aAAa;AACzB,YAAY,kBAAkB;AAC9B,YAAY,cAAc;AAC1B,YAAY,mBAAmB;AAC/B,YAAY,mBAAmB;AAC/B,YAAY,iBAAiB;AAC7B,YAAY,kBAAkB;AAC9B,YAAY,aAAa;AACzB,YAAY,gBAAgB;","names":[]}
|
package/dist/map.d.ts
CHANGED
|
@@ -1,20 +1,326 @@
|
|
|
1
1
|
import { Entry } from '@bessemer/cornerstone/entry';
|
|
2
2
|
import { Dictionary } from '@bessemer/cornerstone/types';
|
|
3
|
+
/**
|
|
4
|
+
* Creates a Map from a dictionary object (plain object with string keys).
|
|
5
|
+
* Converts an object's key-value pairs into a Map structure.
|
|
6
|
+
*
|
|
7
|
+
* **Example**
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* import { Maps } from "@bessemer/cornerstone"
|
|
11
|
+
*
|
|
12
|
+
* const user = { name: "Alice", age: "30", role: "admin" }
|
|
13
|
+
* const userMap = Maps.from(user)
|
|
14
|
+
* console.log(userMap.get("name")) // "Alice"
|
|
15
|
+
* console.log(userMap.size) // 3
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @category constructors
|
|
19
|
+
*/
|
|
3
20
|
export declare const from: <ValueType>(record: Dictionary<ValueType>) => Map<string, ValueType>;
|
|
21
|
+
/**
|
|
22
|
+
* Creates a Map from an array of key-value pair entries.
|
|
23
|
+
* Each entry is a tuple of [key, value] that will be added to the Map.
|
|
24
|
+
*
|
|
25
|
+
* **Example**
|
|
26
|
+
*
|
|
27
|
+
* ```ts
|
|
28
|
+
* import { Maps } from "@bessemer/cornerstone"
|
|
29
|
+
*
|
|
30
|
+
* const entries: Array<[string, number]> = [["a", 1], ["b", 2], ["c", 3]]
|
|
31
|
+
* const map = Maps.fromEntries(entries)
|
|
32
|
+
* console.log(map.get("b")) // 2
|
|
33
|
+
* console.log(map.size) // 3
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @category constructors
|
|
37
|
+
*/
|
|
4
38
|
export declare const fromEntries: <KeyType extends string | number | symbol, ValueType>(entries: Array<Entry<KeyType, ValueType>>) => Map<KeyType, ValueType>;
|
|
39
|
+
/**
|
|
40
|
+
* Groups elements of an iterable by a key extracted using a mapper function.
|
|
41
|
+
* Returns a Map where each key maps to an array of all elements that share that key.
|
|
42
|
+
*
|
|
43
|
+
* **Example**
|
|
44
|
+
*
|
|
45
|
+
* ```ts
|
|
46
|
+
* import { Maps } from "@bessemer/cornerstone"
|
|
47
|
+
*
|
|
48
|
+
* const users = [
|
|
49
|
+
* { name: "Alice", role: "admin" },
|
|
50
|
+
* { name: "Bob", role: "user" },
|
|
51
|
+
* { name: "Charlie", role: "admin" }
|
|
52
|
+
* ]
|
|
53
|
+
*
|
|
54
|
+
* const byRole = Maps.groupBy(users, (user) => user.role)
|
|
55
|
+
* console.log(byRole.get("admin")) // [{ name: "Alice", role: "admin" }, { name: "Charlie", role: "admin" }]
|
|
56
|
+
* console.log(byRole.get("user")) // [{ name: "Bob", role: "user" }]
|
|
57
|
+
* ```
|
|
58
|
+
*
|
|
59
|
+
* @category transformations
|
|
60
|
+
*/
|
|
5
61
|
export declare const groupBy: <CollectionType, KeyType>(iterable: Iterable<CollectionType>, mapper: (it: CollectionType) => KeyType) => Map<KeyType, Array<CollectionType>>;
|
|
62
|
+
/**
|
|
63
|
+
* Fuses two maps together by using values from the first map as keys to lookup
|
|
64
|
+
* values in the second map. The resulting map has the same keys as the target map,
|
|
65
|
+
* but with values resolved through the valuesMap.
|
|
66
|
+
*
|
|
67
|
+
* **Example**
|
|
68
|
+
*
|
|
69
|
+
* ```ts
|
|
70
|
+
* import { Maps } from "@bessemer/cornerstone"
|
|
71
|
+
*
|
|
72
|
+
* const userRoles = new Map([["user1", "roleA"], ["user2", "roleB"]])
|
|
73
|
+
* const rolePermissions = new Map([["roleA", "read"], ["roleB", "write"]])
|
|
74
|
+
*
|
|
75
|
+
* const userPermissions = Maps.fuse(userRoles, rolePermissions)
|
|
76
|
+
* console.log(userPermissions.get("user1")) // "read"
|
|
77
|
+
* console.log(userPermissions.get("user2")) // "write"
|
|
78
|
+
* ```
|
|
79
|
+
*
|
|
80
|
+
* @category transformations
|
|
81
|
+
*/
|
|
6
82
|
export declare const fuse: <KeyType, FuseType, ValueType>(target: Map<KeyType, FuseType>, valuesMap: Map<FuseType, ValueType>) => Map<KeyType, ValueType>;
|
|
83
|
+
/**
|
|
84
|
+
* Transforms all keys in a map using a mapper function while preserving the values.
|
|
85
|
+
* Returns a new map with transformed keys and the same values.
|
|
86
|
+
*
|
|
87
|
+
* **Example**
|
|
88
|
+
*
|
|
89
|
+
* ```ts
|
|
90
|
+
* import { Maps } from "@bessemer/cornerstone"
|
|
91
|
+
*
|
|
92
|
+
* const map = new Map([[1, "one"], [2, "two"], [3, "three"]])
|
|
93
|
+
* const stringKeyMap = Maps.mapKeys(map, (key) => `num_${key}`)
|
|
94
|
+
* console.log(stringKeyMap.get("num_1")) // "one"
|
|
95
|
+
* console.log(stringKeyMap.get("num_2")) // "two"
|
|
96
|
+
* ```
|
|
97
|
+
*
|
|
98
|
+
* @category transformations
|
|
99
|
+
*/
|
|
7
100
|
export declare const mapKeys: <KeyType, ValueType, NewKeyType>(target: Map<KeyType, ValueType>, mapper: (key: KeyType) => NewKeyType) => Map<NewKeyType, ValueType>;
|
|
101
|
+
/**
|
|
102
|
+
* Transforms all values in a map using a mapper function while preserving the keys.
|
|
103
|
+
* Returns a new map with the same keys and transformed values.
|
|
104
|
+
*
|
|
105
|
+
* **Example**
|
|
106
|
+
*
|
|
107
|
+
* ```ts
|
|
108
|
+
* import { Maps } from "@bessemer/cornerstone"
|
|
109
|
+
*
|
|
110
|
+
* const prices = new Map([["apple", 1.5], ["banana", 0.8], ["orange", 1.2]])
|
|
111
|
+
* const doubled = Maps.mapValues(prices, (price) => price * 2)
|
|
112
|
+
* console.log(doubled.get("apple")) // 3.0
|
|
113
|
+
* console.log(doubled.get("banana")) // 1.6
|
|
114
|
+
* ```
|
|
115
|
+
*
|
|
116
|
+
* @category transformations
|
|
117
|
+
*/
|
|
8
118
|
export declare const mapValues: <KeyType, ValueType, NewValueType>(target: Map<KeyType, ValueType>, mapper: (value: ValueType) => NewValueType) => Map<KeyType, NewValueType>;
|
|
119
|
+
/**
|
|
120
|
+
* Transforms both keys and values in a map using a mapper function.
|
|
121
|
+
* Returns a new map with transformed entries. Throws an error if the mapper
|
|
122
|
+
* produces duplicate keys.
|
|
123
|
+
*
|
|
124
|
+
* **Example**
|
|
125
|
+
*
|
|
126
|
+
* ```ts
|
|
127
|
+
* import { Maps } from "@bessemer/cornerstone"
|
|
128
|
+
*
|
|
129
|
+
* const map = new Map([[1, "a"], [2, "b"], [3, "c"]])
|
|
130
|
+
* const transformed = Maps.map(map, ([key, value]) => [key * 10, value.toUpperCase()])
|
|
131
|
+
* console.log(transformed.get(10)) // "A"
|
|
132
|
+
* console.log(transformed.get(20)) // "B"
|
|
133
|
+
* ```
|
|
134
|
+
*
|
|
135
|
+
* @category transformations
|
|
136
|
+
*/
|
|
9
137
|
export declare const map: <KeyType, ValueType, NewKeyType, NewValueType>(target: Map<KeyType, ValueType>, mapper: (entry: Entry<KeyType, ValueType>) => Entry<NewKeyType, NewValueType>) => Map<NewKeyType, NewValueType>;
|
|
138
|
+
/**
|
|
139
|
+
* Creates a map by extracting keys from collection items using a mapper function.
|
|
140
|
+
* Each item becomes a value in the map, keyed by the result of the mapper.
|
|
141
|
+
* Throws an error if the mapper produces duplicate keys.
|
|
142
|
+
*
|
|
143
|
+
* **Example**
|
|
144
|
+
*
|
|
145
|
+
* ```ts
|
|
146
|
+
* import { Maps } from "@bessemer/cornerstone"
|
|
147
|
+
*
|
|
148
|
+
* const users = [
|
|
149
|
+
* { id: 1, name: "Alice" },
|
|
150
|
+
* { id: 2, name: "Bob" },
|
|
151
|
+
* { id: 3, name: "Charlie" }
|
|
152
|
+
* ]
|
|
153
|
+
*
|
|
154
|
+
* const usersById = Maps.collectKeys(users, (user) => user.id)
|
|
155
|
+
* console.log(usersById.get(1)) // { id: 1, name: "Alice" }
|
|
156
|
+
* console.log(usersById.get(2)) // { id: 2, name: "Bob" }
|
|
157
|
+
* ```
|
|
158
|
+
*
|
|
159
|
+
* @category constructors
|
|
160
|
+
*/
|
|
10
161
|
export declare const collectKeys: <CollectionType, KeyType>(iterable: Iterable<CollectionType>, mapper: (it: CollectionType) => KeyType) => Map<KeyType, CollectionType>;
|
|
162
|
+
/**
|
|
163
|
+
* Creates a map by extracting values from collection items using a mapper function.
|
|
164
|
+
* Each item becomes a key in the map, with the mapped value as its value.
|
|
165
|
+
* Throws an error if there are duplicate items in the collection.
|
|
166
|
+
*
|
|
167
|
+
* **Example**
|
|
168
|
+
*
|
|
169
|
+
* ```ts
|
|
170
|
+
* import { Maps } from "@bessemer/cornerstone"
|
|
171
|
+
*
|
|
172
|
+
* const userIds = [1, 2, 3]
|
|
173
|
+
* const userNames = Maps.collectValues(userIds, (id) => `User${id}`)
|
|
174
|
+
* console.log(userNames.get(1)) // "User1"
|
|
175
|
+
* console.log(userNames.get(2)) // "User2"
|
|
176
|
+
* ```
|
|
177
|
+
*
|
|
178
|
+
* @category constructors
|
|
179
|
+
*/
|
|
11
180
|
export declare const collectValues: <CollectionType, ValueType>(iterable: Iterable<CollectionType>, mapper: (it: CollectionType) => ValueType) => Map<CollectionType, ValueType>;
|
|
181
|
+
/**
|
|
182
|
+
* Collects items from an iterable into a Map by transforming each item into a key-value entry.
|
|
183
|
+
* Optionally accepts a reducer function to handle duplicate keys by combining their values.
|
|
184
|
+
* Without a reducer, throws an error on duplicate keys.
|
|
185
|
+
*
|
|
186
|
+
* **Example**
|
|
187
|
+
*
|
|
188
|
+
* ```ts
|
|
189
|
+
* import { Maps } from "@bessemer/cornerstone"
|
|
190
|
+
*
|
|
191
|
+
* const items = ["apple", "banana", "apricot"]
|
|
192
|
+
* const byFirstLetter = Maps.collect(
|
|
193
|
+
* items,
|
|
194
|
+
* (item) => [item[0], item]
|
|
195
|
+
* )
|
|
196
|
+
* // throws error due to duplicate key 'a'
|
|
197
|
+
*
|
|
198
|
+
* const withReducer = Maps.collect(
|
|
199
|
+
* items,
|
|
200
|
+
* (item) => [item[0], [item]],
|
|
201
|
+
* (key, first, second) => [...first, ...second]
|
|
202
|
+
* )
|
|
203
|
+
* console.log(withReducer.get("a")) // ["apple", "apricot"]
|
|
204
|
+
* console.log(withReducer.get("b")) // ["banana"]
|
|
205
|
+
* ```
|
|
206
|
+
*
|
|
207
|
+
* @category constructors
|
|
208
|
+
*/
|
|
12
209
|
export declare function collect<CollectionType, KeyType, ValueType>(iterable: Iterable<CollectionType>, mapEntry: (it: CollectionType) => Entry<KeyType, ValueType>): Map<KeyType, ValueType>;
|
|
13
210
|
export declare function collect<CollectionType, KeyType, ValueType>(iterable: Iterable<CollectionType>, mapEntry: (it: CollectionType) => Entry<KeyType, ValueType>, reducer: (key: KeyType, first: ValueType, second: ValueType) => ValueType): Map<KeyType, ValueType>;
|
|
211
|
+
/**
|
|
212
|
+
* Creates a new map with additional entries appended. Throws an error if any
|
|
213
|
+
* of the new entries have keys that already exist in the map.
|
|
214
|
+
*
|
|
215
|
+
* **Example**
|
|
216
|
+
*
|
|
217
|
+
* ```ts
|
|
218
|
+
* import { Maps } from "@bessemer/cornerstone"
|
|
219
|
+
*
|
|
220
|
+
* const original = new Map([["a", 1], ["b", 2]])
|
|
221
|
+
* const extended = Maps.append(original, ["c", 3], ["d", 4])
|
|
222
|
+
* console.log(extended.get("c")) // 3
|
|
223
|
+
* console.log(extended.size) // 4
|
|
224
|
+
* console.log(original.size) // 2 (original unchanged)
|
|
225
|
+
* ```
|
|
226
|
+
*
|
|
227
|
+
* @category mutations
|
|
228
|
+
*/
|
|
14
229
|
export declare const append: <KeyType, ValueType>(map: Map<KeyType, ValueType>, ...values: Array<Entry<KeyType, ValueType>>) => Map<KeyType, ValueType>;
|
|
230
|
+
/**
|
|
231
|
+
* Mutates a map by appending entries in place. Throws an error if any
|
|
232
|
+
* of the new entries have keys that already exist in the map.
|
|
233
|
+
*
|
|
234
|
+
* **Example**
|
|
235
|
+
*
|
|
236
|
+
* ```ts
|
|
237
|
+
* import { Maps } from "@bessemer/cornerstone"
|
|
238
|
+
*
|
|
239
|
+
* const map = new Map([["a", 1], ["b", 2]])
|
|
240
|
+
* Maps.appendInto(map, ["c", 3], ["d", 4])
|
|
241
|
+
* console.log(map.get("c")) // 3
|
|
242
|
+
* console.log(map.size) // 4
|
|
243
|
+
* ```
|
|
244
|
+
*
|
|
245
|
+
* @category mutations
|
|
246
|
+
*/
|
|
15
247
|
export declare const appendInto: <KeyType, ValueType>(map: Map<KeyType, ValueType>, ...values: Array<Entry<KeyType, ValueType>>) => void;
|
|
248
|
+
/**
|
|
249
|
+
* Creates a new map by concatenating multiple maps together. Throws an error
|
|
250
|
+
* if any duplicate keys are encountered across the maps.
|
|
251
|
+
*
|
|
252
|
+
* **Example**
|
|
253
|
+
*
|
|
254
|
+
* ```ts
|
|
255
|
+
* import { Maps } from "@bessemer/cornerstone"
|
|
256
|
+
*
|
|
257
|
+
* const map1 = new Map([["a", 1], ["b", 2]])
|
|
258
|
+
* const map2 = new Map([["c", 3]])
|
|
259
|
+
* const map3 = new Map([["d", 4]])
|
|
260
|
+
*
|
|
261
|
+
* const combined = Maps.concatenate(map1, map2, map3)
|
|
262
|
+
* console.log(combined.size) // 4
|
|
263
|
+
* console.log(combined.get("c")) // 3
|
|
264
|
+
* ```
|
|
265
|
+
*
|
|
266
|
+
* @category mutations
|
|
267
|
+
*/
|
|
16
268
|
export declare const concatenate: <KeyType, ValueType>(map: Map<KeyType, ValueType>, ...values: Array<Map<KeyType, ValueType>>) => Map<KeyType, ValueType>;
|
|
269
|
+
/**
|
|
270
|
+
* Mutates a map by concatenating other maps into it in place. Throws an error
|
|
271
|
+
* if any duplicate keys are encountered.
|
|
272
|
+
*
|
|
273
|
+
* **Example**
|
|
274
|
+
*
|
|
275
|
+
* ```ts
|
|
276
|
+
* import { Maps } from "@bessemer/cornerstone"
|
|
277
|
+
*
|
|
278
|
+
* const map1 = new Map([["a", 1], ["b", 2]])
|
|
279
|
+
* const map2 = new Map([["c", 3]])
|
|
280
|
+
*
|
|
281
|
+
* Maps.concatenateInto(map1, map2)
|
|
282
|
+
* console.log(map1.size) // 3
|
|
283
|
+
* console.log(map1.get("c")) // 3
|
|
284
|
+
* ```
|
|
285
|
+
*
|
|
286
|
+
* @category mutations
|
|
287
|
+
*/
|
|
17
288
|
export declare const concatenateInto: <KeyType, ValueType>(map: Map<KeyType, ValueType>, ...values: Array<Map<KeyType, ValueType>>) => void;
|
|
289
|
+
/**
|
|
290
|
+
* Creates a new map containing only entries that satisfy the predicate function.
|
|
291
|
+
* Returns a filtered copy of the original map.
|
|
292
|
+
*
|
|
293
|
+
* **Example**
|
|
294
|
+
*
|
|
295
|
+
* ```ts
|
|
296
|
+
* import { Maps } from "@bessemer/cornerstone"
|
|
297
|
+
*
|
|
298
|
+
* const prices = new Map([["apple", 1.5], ["banana", 0.5], ["orange", 2.0]])
|
|
299
|
+
* const expensive = Maps.filter(prices, ([_, price]) => price > 1.0)
|
|
300
|
+
* console.log(expensive.size) // 2
|
|
301
|
+
* console.log(expensive.has("banana")) // false
|
|
302
|
+
* console.log(expensive.get("apple")) // 1.5
|
|
303
|
+
* ```
|
|
304
|
+
*
|
|
305
|
+
* @category filtering
|
|
306
|
+
*/
|
|
18
307
|
export declare const filter: <KeyType, ValueType>(map: Map<KeyType, ValueType>, predicate: (entry: Entry<KeyType, ValueType>) => boolean) => Map<KeyType, ValueType>;
|
|
308
|
+
/**
|
|
309
|
+
* Mutates a map by removing entries that don't satisfy the predicate function.
|
|
310
|
+
* Filters the map in place.
|
|
311
|
+
*
|
|
312
|
+
* **Example**
|
|
313
|
+
*
|
|
314
|
+
* ```ts
|
|
315
|
+
* import { Maps } from "@bessemer/cornerstone"
|
|
316
|
+
*
|
|
317
|
+
* const prices = new Map([["apple", 1.5], ["banana", 0.5], ["orange", 2.0]])
|
|
318
|
+
* Maps.filterFrom(prices, ([_, price]) => price > 1.0)
|
|
319
|
+
* console.log(prices.size) // 2
|
|
320
|
+
* console.log(prices.has("banana")) // false
|
|
321
|
+
* ```
|
|
322
|
+
*
|
|
323
|
+
* @category filtering
|
|
324
|
+
*/
|
|
19
325
|
export declare const filterFrom: <KeyType, ValueType>(map: Map<KeyType, ValueType>, predicate: (entry: Entry<KeyType, ValueType>) => boolean) => void;
|
|
20
326
|
//# sourceMappingURL=map.d.ts.map
|
package/dist/map.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../src/map.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAA;AAInD,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AAExD,eAAO,MAA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C,KAAG,IAO7H,CAAA;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,MAAM,GAAI,OAAO,EAAE,SAAS,EACvC,KAAK,GAAG,CAAC,OAAO,EAAE,SAAS,CAAC,EAC5B,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,SAAS,CAAC,KAAK,OAAO,KACvD,GAAG,CAAC,OAAO,EAAE,SAAS,CAIxB,CAAA;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,UAAU,GAAI,OAAO,EAAE,SAAS,EAAE,KAAK,GAAG,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,SAAS,CAAC,KAAK,OAAO,KAAG,IAMvI,CAAA"}
|
package/dist/map.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/map.ts"],"sourcesContent":["import { Entry } from '@bessemer/cornerstone/entry'\nimport { concatenate as arrayConcatenate } from '@bessemer/cornerstone/array'\nimport { assert, assertPresent } from '@bessemer/cornerstone/assertion'\nimport { Objects } from '@bessemer/cornerstone/index'\nimport { Dictionary } from '@bessemer/cornerstone/types'\n\nexport const from = <ValueType>(record: Dictionary<ValueType>): Map<string, ValueType> => {\n return fromEntries(Object.entries(record))\n}\n\nexport const fromEntries = <KeyType extends string | number | symbol, ValueType>(\n entries: Array<Entry<KeyType, ValueType>>\n): Map<KeyType, ValueType> => {\n return collect(entries, (it) => it)\n}\n\nexport const groupBy = <CollectionType, KeyType>(\n iterable: Iterable<CollectionType>,\n mapper: (it: CollectionType) => KeyType\n): Map<KeyType, Array<CollectionType>> => {\n return collect(\n iterable,\n (it) => [mapper(it), [it]],\n (_, first, second) => arrayConcatenate(first, second)\n )\n}\n\nexport const fuse = <KeyType, FuseType, ValueType>(target: Map<KeyType, FuseType>, valuesMap: Map<FuseType, ValueType>): Map<KeyType, ValueType> => {\n return mapValues(target, (value) => {\n const newValue = valuesMap.get(value)\n assertPresent(newValue, () => `Maps.fuse - Encountered missing linkage: ${value}`)\n return newValue\n })\n}\n\nexport const mapKeys = <KeyType, ValueType, NewKeyType>(\n target: Map<KeyType, ValueType>,\n mapper: (key: KeyType) => NewKeyType\n): Map<NewKeyType, ValueType> => {\n return map(target, ([key, value]) => [mapper(key), value])\n}\n\nexport const mapValues = <KeyType, ValueType, NewValueType>(\n target: Map<KeyType, ValueType>,\n mapper: (value: ValueType) => NewValueType\n): Map<KeyType, NewValueType> => {\n return map(target, ([key, value]) => [key, mapper(value)])\n}\n\nexport const map = <KeyType, ValueType, NewKeyType, NewValueType>(\n target: Map<KeyType, ValueType>,\n mapper: (entry: Entry<KeyType, ValueType>) => Entry<NewKeyType, NewValueType>\n): Map<NewKeyType, NewValueType> => {\n return collect(target.entries(), mapper, (key) => {\n throw new Error(`Maps.transform - Encountered illegal duplicate collection value: ${key}`)\n })\n}\n\nexport const collectKeys = <CollectionType, KeyType>(\n iterable: Iterable<CollectionType>,\n mapper: (it: CollectionType) => KeyType\n): Map<KeyType, CollectionType> => {\n return collect(\n iterable,\n (it) => [mapper(it), it],\n (key) => {\n throw new Error(`Maps.collectKeys - Encountered illegal duplicate collection value: ${key}`)\n }\n )\n}\n\nexport const collectValues = <CollectionType, ValueType>(\n iterable: Iterable<CollectionType>,\n mapper: (it: CollectionType) => ValueType\n): Map<CollectionType, ValueType> => {\n return collect(\n iterable,\n (it) => [it, mapper(it)],\n (key) => {\n throw new Error(`Maps.mapValues - Encountered illegal duplicate collection value: ${key}`)\n }\n )\n}\n\nexport function collect<CollectionType, KeyType, ValueType>(\n iterable: Iterable<CollectionType>,\n mapEntry: (it: CollectionType) => Entry<KeyType, ValueType>\n): Map<KeyType, ValueType>\nexport function collect<CollectionType, KeyType, ValueType>(\n iterable: Iterable<CollectionType>,\n mapEntry: (it: CollectionType) => Entry<KeyType, ValueType>,\n reducer: (key: KeyType, first: ValueType, second: ValueType) => ValueType\n): Map<KeyType, ValueType>\nexport function collect<CollectionType, KeyType, ValueType>(\n iterable: Iterable<CollectionType>,\n mapEntry: (it: CollectionType) => Entry<KeyType, ValueType>,\n reducer?: (key: KeyType, first: ValueType, second: ValueType) => ValueType\n): Map<KeyType, ValueType> {\n const result = new Map<KeyType, ValueType>()\n\n for (const item of iterable) {\n const [key, value] = mapEntry(item)\n\n if (result.has(key)) {\n if (Objects.isNil(reducer)) {\n throw new Error(`Maps.collect - Encountered illegal duplicate collection key: ${key}`)\n }\n\n const existingValue = result.get(key)!\n const reducedValue = reducer(key, existingValue, value)\n result.set(key, reducedValue)\n } else {\n result.set(key, value)\n }\n }\n\n return result\n}\n\nexport const append = <KeyType, ValueType>(map: Map<KeyType, ValueType>, ...values: Array<Entry<KeyType, ValueType>>): Map<KeyType, ValueType> => {\n const result = new Map(map.entries())\n appendInto(result, ...values)\n return result\n}\n\nexport const appendInto = <KeyType, ValueType>(map: Map<KeyType, ValueType>, ...values: Array<Entry<KeyType, ValueType>>): void => {\n for (const [key, value] of values) {\n assert(!map.has(key), () => `Maps.append - Encountered illegal duplicate key: ${key}`)\n map.set(key, value)\n }\n}\n\nexport const concatenate = <KeyType, ValueType>(map: Map<KeyType, ValueType>, ...values: Array<Map<KeyType, ValueType>>): Map<KeyType, ValueType> => {\n const result = new Map(map)\n concatenateInto(result, ...values)\n return result\n}\n\nexport const concatenateInto = <KeyType, ValueType>(map: Map<KeyType, ValueType>, ...values: Array<Map<KeyType, ValueType>>): void => {\n for (const otherMap of values) {\n for (const [key, value] of otherMap) {\n assert(!map.has(key), () => `Maps.concatenate - Encountered illegal duplicate key: ${key}`)\n map.set(key, value)\n }\n }\n}\n\nexport const filter = <KeyType, ValueType>(\n map: Map<KeyType, ValueType>,\n predicate: (entry: Entry<KeyType, ValueType>) => boolean\n): Map<KeyType, ValueType> => {\n const result = new Map(map)\n filterFrom(result, predicate)\n return result\n}\n\nexport const filterFrom = <KeyType, ValueType>(map: Map<KeyType, ValueType>, predicate: (entry: Entry<KeyType, ValueType>) => boolean): void => {\n for (const entry of map) {\n if (!predicate(entry)) {\n map.delete(entry[0])\n }\n }\n}\n"],"mappings":";AACA,SAAS,eAAe,wBAAwB;AAChD,SAAS,QAAQ,qBAAqB;AACtC,SAAS,eAAe;AAGjB,IAAM,OAAO,CAAY,WAA0D;AACxF,SAAO,YAAY,OAAO,QAAQ,MAAM,CAAC;AAC3C;AAEO,IAAM,cAAc,CACzB,YAC4B;AAC5B,SAAO,QAAQ,SAAS,CAAC,OAAO,EAAE;AACpC;AAEO,IAAM,UAAU,CACrB,UACA,WACwC;AACxC,SAAO;AAAA,IACL;AAAA,IACA,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,EAAE,CAAC;AAAA,IACzB,CAAC,GAAG,OAAO,WAAW,iBAAiB,OAAO,MAAM;AAAA,EACtD;AACF;AAEO,IAAM,OAAO,CAA+B,QAAgC,cAAiE;AAClJ,SAAO,UAAU,QAAQ,CAAC,UAAU;AAClC,UAAM,WAAW,UAAU,IAAI,KAAK;AACpC,kBAAc,UAAU,MAAM,4CAA4C,KAAK,EAAE;AACjF,WAAO;AAAA,EACT,CAAC;AACH;AAEO,IAAM,UAAU,CACrB,QACA,WAC+B;AAC/B,SAAO,IAAI,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM,CAAC,OAAO,GAAG,GAAG,KAAK,CAAC;AAC3D;AAEO,IAAM,YAAY,CACvB,QACA,WAC+B;AAC/B,SAAO,IAAI,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM,CAAC,KAAK,OAAO,KAAK,CAAC,CAAC;AAC3D;AAEO,IAAM,MAAM,CACjB,QACA,WACkC;AAClC,SAAO,QAAQ,OAAO,QAAQ,GAAG,QAAQ,CAAC,QAAQ;AAChD,UAAM,IAAI,MAAM,oEAAoE,GAAG,EAAE;AAAA,EAC3F,CAAC;AACH;AAEO,IAAM,cAAc,CACzB,UACA,WACiC;AACjC,SAAO;AAAA,IACL;AAAA,IACA,CAAC,OAA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IA,IAAG;AAC1B,kBAAgB,QAAQ,GAAG,MAAM;AACjC,SAAO;AACT;AAEO,IAAM,kBAAkB,CAAqBA,SAAiC,WAAiD;AACpI,aAAW,YAAY,QAAQ;AAC7B,eAAW,CAAC,KAAK,KAAK,KAAK,UAAU;AACnC,aAAO,CAACA,KAAI,IAAI,GAAG,GAAG,MAAM,yDAAyD,GAAG,EAAE;AAC1F,MAAAA,KAAI,IAAI,KAAK,KAAK;AAAA,IACpB;AAAA,EACF;AACF;AAEO,IAAM,SAAS,CACpBA,MACA,cAC4B;AAC5B,QAAM,SAAS,IAAI,IAAIA,IAAG;AAC1B,aAAW,QAAQ,SAAS;AAC5B,SAAO;AACT;AAEO,IAAM,aAAa,CAAqBA,MAA8B,cAAmE;AAC9I,aAAW,SAASA,MAAK;AACvB,QAAI,CAAC,UAAU,KAAK,GAAG;AACrB,MAAAA,KAAI,OAAO,MAAM,CAAC,CAAC;AAAA,IACrB;AAAA,EACF;AACF;","names":["map"]}
|
|
1
|
+
{"version":3,"sources":["../src/map.ts"],"sourcesContent":["import { Entry } from '@bessemer/cornerstone/entry'\nimport { concatenate as arrayConcatenate } from '@bessemer/cornerstone/array'\nimport { assert, assertPresent } from '@bessemer/cornerstone/assertion'\nimport { Objects } from '@bessemer/cornerstone/index'\nimport { Dictionary } from '@bessemer/cornerstone/types'\n\n/**\n * Creates a Map from a dictionary object (plain object with string keys).\n * Converts an object's key-value pairs into a Map structure.\n *\n * **Example**\n *\n * ```ts\n * import { Maps } from \"@bessemer/cornerstone\"\n *\n * const user = { name: \"Alice\", age: \"30\", role: \"admin\" }\n * const userMap = Maps.from(user)\n * console.log(userMap.get(\"name\")) // \"Alice\"\n * console.log(userMap.size) // 3\n * ```\n *\n * @category constructors\n */\nexport const from = <ValueType>(record: Dictionary<ValueType>): Map<string, ValueType> => {\n return fromEntries(Object.entries(record))\n}\n\n/**\n * Creates a Map from an array of key-value pair entries.\n * Each entry is a tuple of [key, value] that will be added to the Map.\n *\n * **Example**\n *\n * ```ts\n * import { Maps } from \"@bessemer/cornerstone\"\n *\n * const entries: Array<[string, number]> = [[\"a\", 1], [\"b\", 2], [\"c\", 3]]\n * const map = Maps.fromEntries(entries)\n * console.log(map.get(\"b\")) // 2\n * console.log(map.size) // 3\n * ```\n *\n * @category constructors\n */\nexport const fromEntries = <KeyType extends string | number | symbol, ValueType>(\n entries: Array<Entry<KeyType, ValueType>>\n): Map<KeyType, ValueType> => {\n return collect(entries, (it) => it)\n}\n\n/**\n * Groups elements of an iterable by a key extracted using a mapper function.\n * Returns a Map where each key maps to an array of all elements that share that key.\n *\n * **Example**\n *\n * ```ts\n * import { Maps } from \"@bessemer/cornerstone\"\n *\n * const users = [\n * { name: \"Alice\", role: \"admin\" },\n * { name: \"Bob\", role: \"user\" },\n * { name: \"Charlie\", role: \"admin\" }\n * ]\n *\n * const byRole = Maps.groupBy(users, (user) => user.role)\n * console.log(byRole.get(\"admin\")) // [{ name: \"Alice\", role: \"admin\" }, { name: \"Charlie\", role: \"admin\" }]\n * console.log(byRole.get(\"user\")) // [{ name: \"Bob\", role: \"user\" }]\n * ```\n *\n * @category transformations\n */\nexport const groupBy = <CollectionType, KeyType>(\n iterable: Iterable<CollectionType>,\n mapper: (it: CollectionType) => KeyType\n): Map<KeyType, Array<CollectionType>> => {\n return collect(\n iterable,\n (it) => [mapper(it), [it]],\n (_, first, second) => arrayConcatenate(first, second)\n )\n}\n\n/**\n * Fuses two maps together by using values from the first map as keys to lookup\n * values in the second map. The resulting map has the same keys as the target map,\n * but with values resolved through the valuesMap.\n *\n * **Example**\n *\n * ```ts\n * import { Maps } from \"@bessemer/cornerstone\"\n *\n * const userRoles = new Map([[\"user1\", \"roleA\"], [\"user2\", \"roleB\"]])\n * const rolePermissions = new Map([[\"roleA\", \"read\"], [\"roleB\", \"write\"]])\n *\n * const userPermissions = Maps.fuse(userRoles, rolePermissions)\n * console.log(userPermissions.get(\"user1\")) // \"read\"\n * console.log(userPermissions.get(\"user2\")) // \"write\"\n * ```\n *\n * @category transformations\n */\nexport const fuse = <KeyType, FuseType, ValueType>(target: Map<KeyType, FuseType>, valuesMap: Map<FuseType, ValueType>): Map<KeyType, ValueType> => {\n return mapValues(target, (value) => {\n const newValue = valuesMap.get(value)\n assertPresent(newValue, () => `Maps.fuse - Encountered missing linkage: ${value}`)\n return newValue\n })\n}\n\n/**\n * Transforms all keys in a map using a mapper function while preserving the values.\n * Returns a new map with transformed keys and the same values.\n *\n * **Example**\n *\n * ```ts\n * import { Maps } from \"@bessemer/cornerstone\"\n *\n * const map = new Map([[1, \"one\"], [2, \"two\"], [3, \"three\"]])\n * const stringKeyMap = Maps.mapKeys(map, (key) => `num_${key}`)\n * console.log(stringKeyMap.get(\"num_1\")) // \"one\"\n * console.log(stringKeyMap.get(\"num_2\")) // \"two\"\n * ```\n *\n * @category transformations\n */\nexport const mapKeys = <KeyType, ValueType, NewKeyType>(\n target: Map<KeyType, ValueType>,\n mapper: (key: KeyType) => NewKeyType\n): Map<NewKeyType, ValueType> => {\n return map(target, ([key, value]) => [mapper(key), value])\n}\n\n/**\n * Transforms all values in a map using a mapper function while preserving the keys.\n * Returns a new map with the same keys and transformed values.\n *\n * **Example**\n *\n * ```ts\n * import { Maps } from \"@bessemer/cornerstone\"\n *\n * const prices = new Map([[\"apple\", 1.5], [\"banana\", 0.8], [\"orange\", 1.2]])\n * const doubled = Maps.mapValues(prices, (price) => price * 2)\n * console.log(doubled.get(\"apple\")) // 3.0\n * console.log(doubled.get(\"banana\")) // 1.6\n * ```\n *\n * @category transformations\n */\nexport const mapValues = <KeyType, ValueType, NewValueType>(\n target: Map<KeyType, ValueType>,\n mapper: (value: ValueType) => NewValueType\n): Map<KeyType, NewValueType> => {\n return map(target, ([key, value]) => [key, mapper(value)])\n}\n\n/**\n * Transforms both keys and values in a map using a mapper function.\n * Returns a new map with transformed entries. Throws an error if the mapper\n * produces duplicate keys.\n *\n * **Example**\n *\n * ```ts\n * import { Maps } from \"@bessemer/cornerstone\"\n *\n * const map = new Map([[1, \"a\"], [2, \"b\"], [3, \"c\"]])\n * const transformed = Maps.map(map, ([key, value]) => [key * 10, value.toUpperCase()])\n * console.log(transformed.get(10)) // \"A\"\n * console.log(transformed.get(20)) // \"B\"\n * ```\n *\n * @category transformations\n */\nexport const map = <KeyType, ValueType, NewKeyType, NewValueType>(\n target: Map<KeyType, ValueType>,\n mapper: (entry: Entry<KeyType, ValueType>) => Entry<NewKeyType, NewValueType>\n): Map<NewKeyType, NewValueType> => {\n return collect(target.entries(), mapper, (key) => {\n throw new Error(`Maps.transform - Encountered illegal duplicate collection value: ${key}`)\n })\n}\n\n/**\n * Creates a map by extracting keys from collection items using a mapper function.\n * Each item becomes a value in the map, keyed by the result of the mapper.\n * Throws an error if the mapper produces duplicate keys.\n *\n * **Example**\n *\n * ```ts\n * import { Maps } from \"@bessemer/cornerstone\"\n *\n * const users = [\n * { id: 1, name: \"Alice\" },\n * { id: 2, name: \"Bob\" },\n * { id: 3, name: \"Charlie\" }\n * ]\n *\n * const usersById = Maps.collectKeys(users, (user) => user.id)\n * console.log(usersById.get(1)) // { id: 1, name: \"Alice\" }\n * console.log(usersById.get(2)) // { id: 2, name: \"Bob\" }\n * ```\n *\n * @category constructors\n */\nexport const collectKeys = <CollectionType, KeyType>(\n iterable: Iterable<CollectionType>,\n mapper: (it: CollectionType) => KeyType\n): Map<KeyType, CollectionType> => {\n return collect(\n iterable,\n (it) => [mapper(it), it],\n (key) => {\n throw new Error(`Maps.collectKeys - Encountered illegal duplicate collection value: ${key}`)\n }\n )\n}\n\n/**\n * Creates a map by extracting values from collection items using a mapper function.\n * Each item becomes a key in the map, with the mapped value as its value.\n * Throws an error if there are duplicate items in the collection.\n *\n * **Example**\n *\n * ```ts\n * import { Maps } from \"@bessemer/cornerstone\"\n *\n * const userIds = [1, 2, 3]\n * const userNames = Maps.collectValues(userIds, (id) => `User${id}`)\n * console.log(userNames.get(1)) // \"User1\"\n * console.log(userNames.get(2)) // \"User2\"\n * ```\n *\n * @category constructors\n */\nexport const collectValues = <CollectionType, ValueType>(\n iterable: Iterable<CollectionType>,\n mapper: (it: CollectionType) => ValueType\n): Map<CollectionType, ValueType> => {\n return collect(\n iterable,\n (it) => [it, mapper(it)],\n (key) => {\n throw new Error(`Maps.mapValues - Encountered illegal duplicate collection value: ${key}`)\n }\n )\n}\n\n/**\n * Collects items from an iterable into a Map by transforming each item into a key-value entry.\n * Optionally accepts a reducer function to handle duplicate keys by combining their values.\n * Without a reducer, throws an error on duplicate keys.\n *\n * **Example**\n *\n * ```ts\n * import { Maps } from \"@bessemer/cornerstone\"\n *\n * const items = [\"apple\", \"banana\", \"apricot\"]\n * const byFirstLetter = Maps.collect(\n * items,\n * (item) => [item[0], item]\n * )\n * // throws error due to duplicate key 'a'\n *\n * const withReducer = Maps.collect(\n * items,\n * (item) => [item[0], [item]],\n * (key, first, second) => [...first, ...second]\n * )\n * console.log(withReducer.get(\"a\")) // [\"apple\", \"apricot\"]\n * console.log(withReducer.get(\"b\")) // [\"banana\"]\n * ```\n *\n * @category constructors\n */\nexport function collect<CollectionType, KeyType, ValueType>(\n iterable: Iterable<CollectionType>,\n mapEntry: (it: CollectionType) => Entry<KeyType, ValueType>\n): Map<KeyType, ValueType>\nexport function collect<CollectionType, KeyType, ValueType>(\n iterable: Iterable<CollectionType>,\n mapEntry: (it: CollectionType) => Entry<KeyType, ValueType>,\n reducer: (key: KeyType, first: ValueType, second: ValueType) => ValueType\n): Map<KeyType, ValueType>\nexport function collect<CollectionType, KeyType, ValueType>(\n iterable: Iterable<CollectionType>,\n mapEntry: (it: CollectionType) => Entry<KeyType, ValueType>,\n reducer?: (key: KeyType, first: ValueType, second: ValueType) => ValueType\n): Map<KeyType, ValueType> {\n const result = new Map<KeyType, ValueType>()\n\n for (const item of iterable) {\n const [key, value] = mapEntry(item)\n\n if (result.has(key)) {\n if (Objects.isNil(reducer)) {\n throw new Error(`Maps.collect - Encountered illegal duplicate collection key: ${key}`)\n }\n\n const existingValue = result.get(key)!\n const reducedValue = reducer(key, existingValue, value)\n result.set(key, reducedValue)\n } else {\n result.set(key, value)\n }\n }\n\n return result\n}\n\n/**\n * Creates a new map with additional entries appended. Throws an error if any\n * of the new entries have keys that already exist in the map.\n *\n * **Example**\n *\n * ```ts\n * import { Maps } from \"@bessemer/cornerstone\"\n *\n * const original = new Map([[\"a\", 1], [\"b\", 2]])\n * const extended = Maps.append(original, [\"c\", 3], [\"d\", 4])\n * console.log(extended.get(\"c\")) // 3\n * console.log(extended.size) // 4\n * console.log(original.size) // 2 (original unchanged)\n * ```\n *\n * @category mutations\n */\nexport const append = <KeyType, ValueType>(map: Map<KeyType, ValueType>, ...values: Array<Entry<KeyType, ValueType>>): Map<KeyType, ValueType> => {\n const result = new Map(map.entries())\n appendInto(result, ...values)\n return result\n}\n\n/**\n * Mutates a map by appending entries in place. Throws an error if any\n * of the new entries have keys that already exist in the map.\n *\n * **Example**\n *\n * ```ts\n * import { Maps } from \"@bessemer/cornerstone\"\n *\n * const map = new Map([[\"a\", 1], [\"b\", 2]])\n * Maps.appendInto(map, [\"c\", 3], [\"d\", 4])\n * console.log(map.get(\"c\")) // 3\n * console.log(map.size) // 4\n * ```\n *\n * @category mutations\n */\nexport const appendInto = <KeyType, ValueType>(map: Map<KeyType, ValueType>, ...values: Array<Entry<KeyType, ValueType>>): void => {\n for (const [key, value] of values) {\n assert(!map.has(key), () => `Maps.append - Encountered illegal duplicate key: ${key}`)\n map.set(key, value)\n }\n}\n\n/**\n * Creates a new map by concatenating multiple maps together. Throws an error\n * if any duplicate keys are encountered across the maps.\n *\n * **Example**\n *\n * ```ts\n * import { Maps } from \"@bessemer/cornerstone\"\n *\n * const map1 = new Map([[\"a\", 1], [\"b\", 2]])\n * const map2 = new Map([[\"c\", 3]])\n * const map3 = new Map([[\"d\", 4]])\n *\n * const combined = Maps.concatenate(map1, map2, map3)\n * console.log(combined.size) // 4\n * console.log(combined.get(\"c\")) // 3\n * ```\n *\n * @category mutations\n */\nexport const concatenate = <KeyType, ValueType>(map: Map<KeyType, ValueType>, ...values: Array<Map<KeyType, ValueType>>): Map<KeyType, ValueType> => {\n const result = new Map(map)\n concatenateInto(result, ...values)\n return result\n}\n\n/**\n * Mutates a map by concatenating other maps into it in place. Throws an error\n * if any duplicate keys are encountered.\n *\n * **Example**\n *\n * ```ts\n * import { Maps } from \"@bessemer/cornerstone\"\n *\n * const map1 = new Map([[\"a\", 1], [\"b\", 2]])\n * const map2 = new Map([[\"c\", 3]])\n *\n * Maps.concatenateInto(map1, map2)\n * console.log(map1.size) // 3\n * console.log(map1.get(\"c\")) // 3\n * ```\n *\n * @category mutations\n */\nexport const concatenateInto = <KeyType, ValueType>(map: Map<KeyType, ValueType>, ...values: Array<Map<KeyType, ValueType>>): void => {\n for (const otherMap of values) {\n for (const [key, value] of otherMap) {\n assert(!map.has(key), () => `Maps.concatenate - Encountered illegal duplicate key: ${key}`)\n map.set(key, value)\n }\n }\n}\n\n/**\n * Creates a new map containing only entries that satisfy the predicate function.\n * Returns a filtered copy of the original map.\n *\n * **Example**\n *\n * ```ts\n * import { Maps } from \"@bessemer/cornerstone\"\n *\n * const prices = new Map([[\"apple\", 1.5], [\"banana\", 0.5], [\"orange\", 2.0]])\n * const expensive = Maps.filter(prices, ([_, price]) => price > 1.0)\n * console.log(expensive.size) // 2\n * console.log(expensive.has(\"banana\")) // false\n * console.log(expensive.get(\"apple\")) // 1.5\n * ```\n *\n * @category filtering\n */\nexport const filter = <KeyType, ValueType>(\n map: Map<KeyType, ValueType>,\n predicate: (entry: Entry<KeyType, ValueType>) => boolean\n): Map<KeyType, ValueType> => {\n const result = new Map(map)\n filterFrom(result, predicate)\n return result\n}\n\n/**\n * Mutates a map by removing entries that don't satisfy the predicate function.\n * Filters the map in place.\n *\n * **Example**\n *\n * ```ts\n * import { Maps } from \"@bessemer/cornerstone\"\n *\n * const prices = new Map([[\"apple\", 1.5], [\"banana\", 0.5], [\"orange\", 2.0]])\n * Maps.filterFrom(prices, ([_, price]) => price > 1.0)\n * console.log(prices.size) // 2\n * console.log(prices.has(\"banana\")) // false\n * ```\n *\n * @category filtering\n */\nexport const filterFrom = <KeyType, ValueType>(map: Map<KeyType, ValueType>, predicate: (entry: Entry<KeyType, ValueType>) => boolean): void => {\n for (const entry of map) {\n if (!predicate(entry)) {\n map.delete(entry[0])\n }\n }\n}\n"],"mappings":";AACA,SAAS,eAAe,wBAAwB;AAChD,SAAS,QAAQ,qBAAqB;AACtC,SAAS,eAAe;AAoBjB,IAAM,OAAO,CAAY,WAA0D;AACxF,SAAO,YAAY,OAAO,QAAQ,MAAM,CAAC;AAC3C;AAmBO,IAAM,cAAc,CACzB,YAC4B;AAC5B,SAAO,QAAQ,SAAS,CAAC,OAAO,EAAE;AACpC;AAwBO,IAAM,UAAU,CACrB,UACA,WACwC;AACxC,SAAO;AAAA,IACL;AAAA,IACA,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,EAAE,CAAC;AAAA,IACzB,CAAC,GAAG,OAAO,WAAW,iBAAiB,OAAO,MAAM;AAAA,EACtD;AACF;AAsBO,IAAM,OAAO,CAA+B,QAAgC,cAAiE;AAClJ,SAAO,UAAU,QAAQ,CAAC,UAAU;AAClC,UAAM,WAAW,UAAU,IAAI,KAAK;AACpC,kBAAc,UAAU,MAAM,4CAA4C,KAAK,EAAE;AACjF,WAAO;AAAA,EACT,CAAC;AACH;AAmBO,IAAM,UAAU,CACrB,QACA,WAC+B;AAC/B,SAAO,IAAI,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM,CAAC,OAAO,GAAG,GAAG,KAAK,CAAC;AAC3D;AAmBO,IAAM,YAAY,CACvB,QACA,WAC+B;AAC/B,SAAO,IAAI,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM,CAAC,KAAK,OAAO,KAAK,CAAC,CAAC;AAC3D;AAoBO,IAAM,MAAM,CACjB,QACA,WACkC;AAClC,SAAO,QAAQ,OAAO,QAAQ,GAAG,QAAQ,CAAC,QAAQ;AAChD,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M,oDAAoD,GAAG,EAAE;AACrF,IAAAA,KAAI,IAAI,KAAK,KAAK;AAAA,EACpB;AACF;AAsBO,IAAM,cAAc,CAAqBA,SAAiC,WAAoE;AACnJ,QAAM,SAAS,IAAI,IAAIA,IAAG;AAC1B,kBAAgB,QAAQ,GAAG,MAAM;AACjC,SAAO;AACT;AAqBO,IAAM,kBAAkB,CAAqBA,SAAiC,WAAiD;AACpI,aAAW,YAAY,QAAQ;AAC7B,eAAW,CAAC,KAAK,KAAK,KAAK,UAAU;AACnC,aAAO,CAACA,KAAI,IAAI,GAAG,GAAG,MAAM,yDAAyD,GAAG,EAAE;AAC1F,MAAAA,KAAI,IAAI,KAAK,KAAK;AAAA,IACpB;AAAA,EACF;AACF;AAoBO,IAAM,SAAS,CACpBA,MACA,cAC4B;AAC5B,QAAM,SAAS,IAAI,IAAIA,IAAG;AAC1B,aAAW,QAAQ,SAAS;AAC5B,SAAO;AACT;AAmBO,IAAM,aAAa,CAAqBA,MAA8B,cAAmE;AAC9I,aAAW,SAASA,MAAK;AACvB,QAAI,CAAC,UAAU,KAAK,GAAG;AACrB,MAAAA,KAAI,OAAO,MAAM,CAAC,CAAC;AAAA,IACrB;AAAA,EACF;AACF;","names":["map"]}
|
package/dist/sql.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import * as Sql from '@bessemer/cornerstone/sql/sql';
|
|
2
2
|
import { BasicType, Dictionary, TaggedType } from '@bessemer/cornerstone/types';
|
|
3
|
-
export {
|
|
3
|
+
export {
|
|
4
|
+
/**
|
|
5
|
+
* @since 2.0.0
|
|
6
|
+
*/
|
|
7
|
+
Sql, };
|
|
4
8
|
export type SqlFragment = TaggedType<string, 'SqlFragment'>;
|
|
5
9
|
export type SqlParameterMap = Dictionary<BasicType | Array<BasicType>>;
|
|
6
10
|
//# sourceMappingURL=sql.d.ts.map
|
package/dist/sql.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sql.d.ts","sourceRoot":"","sources":["../src/sql.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,+BAA+B,CAAA;AACpD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AAE/E,OAAO,
|
|
1
|
+
{"version":3,"file":"sql.d.ts","sourceRoot":"","sources":["../src/sql.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,+BAA+B,CAAA;AACpD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AAE/E,OAAO;AACL;;GAEG;AACH,GAAG,GACJ,CAAA;AAED,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;AAC3D,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,CAAA"}
|
package/dist/sql.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/sql.ts"],"sourcesContent":["import * as Sql from '@bessemer/cornerstone/sql/sql'\nimport { BasicType, Dictionary, TaggedType } from '@bessemer/cornerstone/types'\n\nexport { Sql
|
|
1
|
+
{"version":3,"sources":["../src/sql.ts"],"sourcesContent":["import * as Sql from '@bessemer/cornerstone/sql/sql'\nimport { BasicType, Dictionary, TaggedType } from '@bessemer/cornerstone/types'\n\nexport {\n /**\n * @since 2.0.0\n */\n Sql,\n}\n\nexport type SqlFragment = TaggedType<string, 'SqlFragment'>\nexport type SqlParameterMap = Dictionary<BasicType | Array<BasicType>>\n"],"mappings":";AAAA,YAAY,SAAS;","names":[]}
|
package/dist/zod-util.d.ts
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This module provides an implementation of the `Order` type class which is used to define a total ordering on some type `A`.
|
|
3
|
+
* An order is defined by a relation `<=`, which obeys the following laws:
|
|
4
|
+
*
|
|
5
|
+
* - either `x <= y` or `y <= x` (totality)
|
|
6
|
+
* - if `x <= y` and `y <= x`, then `x == y` (antisymmetry)
|
|
7
|
+
* - if `x <= y` and `y <= z`, then `x <= z` (transitivity)
|
|
8
|
+
*
|
|
9
|
+
* The truth table for compare is defined as follows:
|
|
10
|
+
*
|
|
11
|
+
* | `x <= y` | `x >= y` | Ordering | |
|
|
12
|
+
* | -------- | -------- | -------- | --------------------- |
|
|
13
|
+
* | `true` | `true` | `0` | corresponds to x == y |
|
|
14
|
+
* | `true` | `false` | `< 0` | corresponds to x < y |
|
|
15
|
+
* | `false` | `true` | `> 0` | corresponds to x > y |
|
|
16
|
+
*
|
|
17
|
+
* @since 2.0.0
|
|
18
|
+
*/
|
|
1
19
|
import Zod, { ZodError, ZodType } from 'zod';
|
|
2
20
|
import { ResourceKey } from '@bessemer/cornerstone/resource-key';
|
|
3
21
|
import { AsyncResult, Result } from '@bessemer/cornerstone/result';
|
package/dist/zod-util.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zod-util.d.ts","sourceRoot":"","sources":["../src/zod-util.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAA;AAGhE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AAClE,OAAO,EAAE,UAAU,EAAgB,MAAM,yCAAyC,CAAA;AAClF,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAE5C,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS,OAAO,EAAE,MAAM,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,KAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAEvF,CAAA;AAED,eAAO,MAAM,aAAa,GAAU,CAAC,SAAS,OAAO,EAAE,MAAM,GA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AI,QAAQ,OAAO,KAAG,OAE5C,CAAA"}
|
package/dist/zod-util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/zod-util.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../src/zod-util.ts"],"sourcesContent":["/**\n * This module provides an implementation of the `Order` type class which is used to define a total ordering on some type `A`.\n * An order is defined by a relation `<=`, which obeys the following laws:\n *\n * - either `x <= y` or `y <= x` (totality)\n * - if `x <= y` and `y <= x`, then `x == y` (antisymmetry)\n * - if `x <= y` and `y <= z`, then `x <= z` (transitivity)\n *\n * The truth table for compare is defined as follows:\n *\n * | `x <= y` | `x >= y` | Ordering | |\n * | -------- | -------- | -------- | --------------------- |\n * | `true` | `true` | `0` | corresponds to x == y |\n * | `true` | `false` | `< 0` | corresponds to x < y |\n * | `false` | `true` | `> 0` | corresponds to x > y |\n *\n * @since 2.0.0\n */\nimport Zod, { ZodError, ZodType } from 'zod'\nimport { ResourceKey } from '@bessemer/cornerstone/resource-key'\nimport { parse as jsonParse } from '@bessemer/cornerstone/json'\nimport * as Results from '@bessemer/cornerstone/result'\nimport { AsyncResult, Result } from '@bessemer/cornerstone/result'\nimport { ErrorEvent, unpackResult } from '@bessemer/cornerstone/error/error-event'\nimport { $RefinementCtx } from 'zod/v4/core'\n\nexport const defaults = <T extends ZodType>(data: Zod.input<T>, schema: T): Zod.output<T> => {\n return schema.parse(data)\n}\n\nexport const defaultsAsync = async <T extends ZodType>(data: Zod.input<T>, schema: T): Promise<Zod.output<T>> => {\n return schema.parseAsync(data)\n}\n\nexport const parse = <T extends ZodType>(type: T, data: unknown): Result<Zod.infer<T>, ZodError<Zod.infer<T>>> => {\n const result = type.safeParse(data)\n if (result.success) {\n return Results.success(result.data)\n } else {\n return Results.failure(result.error)\n }\n}\n\nexport const parseAsync = async <T extends ZodType>(type: T, data: unknown): AsyncResult<Zod.infer<T>, ZodError<Zod.infer<T>>> => {\n const result = await type.safeParseAsync(data)\n if (result.success) {\n return Results.success(result.data)\n } else {\n return Results.failure(result.error)\n }\n}\n\nexport const parseJson = <T extends ZodType>(type: T, data: string): Result<Zod.infer<T>, SyntaxError | ZodError<Zod.infer<T>>> => {\n const result = jsonParse(data)\n if (Results.isFailure(result)) {\n return result\n }\n\n return parse(type, result)\n}\n\nexport const parseJsonAsync = async <T extends ZodType>(type: T, data: string): AsyncResult<Zod.infer<T>, SyntaxError | ZodError<Zod.infer<T>>> => {\n const result = jsonParse(data)\n if (Results.isFailure(result)) {\n return result\n }\n\n return parseAsync(type, result)\n}\n\nexport const parseJsonOrThrow = <T extends ZodType>(type: T, data: string): Zod.infer<T> => {\n const result = parseJson(type, data)\n Results.assertSuccess(result)\n return result\n}\n\nexport const arrayable = <T>(type: ZodType<T>) => {\n return Zod.union([type, Zod.array(type)])\n}\n\nexport const key = (): ZodType<ResourceKey> => {\n return Zod.string()\n}\n\nexport type StructuredTransformer<InputType, OutputType> = (value: InputType) => Result<OutputType, ErrorEvent>\n\nexport const structuredTransform = <InputType, OutputType, SchemaType extends ZodType<InputType, InputType> = ZodType<InputType, InputType>>(\n schema: SchemaType,\n transformer: StructuredTransformer<InputType, OutputType>\n) => {\n const refinedResultTransformer = refineResult(transformer)\n\n return schema.superRefine(refinedResultTransformer).transform((it) => {\n const result = transformer(it)\n return unpackResult(result)\n })\n}\n\nexport const refineResult = <InputType, OutputType>(\n transformer: StructuredTransformer<InputType, OutputType>\n): ((value: InputType, context: $RefinementCtx<InputType>) => void) => {\n return (value, context) => {\n const result = transformer(value)\n\n if (Results.isFailure(result)) {\n const error = result.value\n\n error.causes.forEach((cause) => {\n context.addIssue({\n code: 'custom',\n message: cause.message,\n input: value,\n context: error.context,\n cause,\n })\n })\n }\n }\n}\n\nexport const unwrap = (schema: ZodType): ZodType => {\n const def = schema._zod.def\n\n if ('inner' in def && def.inner) {\n return unwrap(def.inner as ZodType)\n }\n if (def.type === 'pipe' && 'in' in def) {\n return unwrap((def as any).in as ZodType)\n }\n\n return schema\n}\n\nexport enum ZodTypeKind {\n String = 'string',\n Number = 'number',\n Int = 'int',\n Boolean = 'boolean',\n Bigint = 'bigint',\n Symbol = 'symbol',\n Null = 'null',\n Undefined = 'undefined',\n Void = 'void',\n Never = 'never',\n Any = 'any',\n Unknown = 'unknown',\n Date = 'date',\n Object = 'object',\n Record = 'record',\n File = 'file',\n Array = 'array',\n Tuple = 'tuple',\n Union = 'union',\n Intersection = 'intersection',\n Map = 'map',\n Set = 'set',\n Enum = 'enum',\n Literal = 'literal',\n Nullable = 'nullable',\n Optional = 'optional',\n Nonoptional = 'nonoptional',\n Success = 'success',\n Transform = 'transform',\n Default = 'default',\n Prefault = 'prefault',\n Catch = 'catch',\n Nan = 'nan',\n Pipe = 'pipe',\n Readonly = 'readonly',\n TemplateLiteral = 'template_literal',\n Promise = 'promise',\n Lazy = 'lazy',\n Function = 'function',\n Custom = 'custom',\n}\n\nexport const isType = (schema: ZodType, type: ZodTypeKind): boolean => {\n return unwrap(schema).type === type\n}\n\nexport const isRequired = (schema: ZodType): boolean => {\n return !schema.safeParse(undefined).success\n}\n"],"mappings":";AAkBA,OAAO,SAAgC;AAEvC,SAAS,SAAS,iBAAiB;AACnC,YAAY,aAAa;AAEzB,SAAqB,oBAAoB;AAGlC,IAAM,WAAW,CAAoB,MAAoB,WAA6B;AAC3F,SAAO,OAAO,MAAM,IAAI;AAC1B;AAEO,IAAM,gBAAgB,OAA0B,MAAoB,WAAsC;AAC/G,SAAO,OAAO,WAAW,IAAI;AAC/B;AAEO,IAAM,QAAQ,CAAoB,MAAS,SAAgE;AAChH,QAAM,SAAS,KAAK,UAAU,IAAI;AAClC,MAAI,OAAO,SAAS;AAClB,WAAe,gBAAQ,OAAO,IAAI;AAAA,EACpC,OAAO;AACL,WAAe,gBAAQ,OAAO,KAAK;AAAA,EACrC;AACF;AAEO,IAAM,aAAa,OAA0B,MAAS,SAAqE;AAChI,QAAM,SAAS,MAAM,KAAK,eAAe,IAAI;AAC7C,MAAI,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A,aAAU;AACV,EAAAA,aAAA,UAAO;AACP,EAAAA,aAAA,cAAW;AACX,EAAAA,aAAA,YAAS;AAxCC,SAAAA;AAAA,GAAA;AA2CL,IAAM,SAAS,CAAC,QAAiB,SAA+B;AACrE,SAAO,OAAO,MAAM,EAAE,SAAS;AACjC;AAEO,IAAM,aAAa,CAAC,WAA6B;AACtD,SAAO,CAAC,OAAO,UAAU,MAAS,EAAE;AACtC;","names":["ZodTypeKind"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bessemer/cornerstone",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.114",
|
|
5
5
|
"module": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"sideEffects": false,
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
"build": "tsup && tsc --project tsconfig.build.json --emitDeclarationOnly",
|
|
20
20
|
"test": "jest",
|
|
21
21
|
"prettier-fix": "prettier --write .",
|
|
22
|
-
"clean": "rm -rf dist && rm -rf .turbo"
|
|
22
|
+
"clean": "rm -rf dist && rm -rf .turbo",
|
|
23
|
+
"docgen": "docgen"
|
|
23
24
|
},
|
|
24
25
|
"dependencies": {
|
|
25
26
|
"@js-temporal/polyfill": "0.5.1",
|
|
@@ -38,5 +39,6 @@
|
|
|
38
39
|
},
|
|
39
40
|
"files": [
|
|
40
41
|
"dist"
|
|
41
|
-
]
|
|
42
|
+
],
|
|
43
|
+
"homepage": "https://lutteringer.github.io/bessemer"
|
|
42
44
|
}
|