@esposter/shared 2.21.0 → 2.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.d.ts +421 -45
  2. package/dist/index.js +565 -101
  3. package/package.json +5 -5
package/dist/index.d.ts CHANGED
@@ -70,16 +70,22 @@ declare const RoutePath: {
70
70
  };
71
71
  type RoutePath = typeof RoutePath;
72
72
  //#endregion
73
- //#region src/util/types/GetProperties.d.ts
74
- type GetProperties<T, P extends string = "", D extends unknown[] = [unknown, unknown, unknown, unknown, unknown], R extends boolean = true> = [T] extends [never] ? never : D extends [] ? never : NonNullable<T> extends infer O ? O extends unknown[] ? GetArrayProps<O, P, D, R> : O extends object ? GetObjectProps<O, P, D, R> : GetPrimitiveProps<O, P, D, R> : never;
73
+ //#region src/util/types/GetArrayProps.d.ts
75
74
  type GetArrayProps<T extends unknown[], P extends string, D extends unknown[], R extends boolean> = (D extends [unknown, ...infer Rest] ? GetProperties<T[number], R extends true ? `${P}[number]` : `${P}.[number]`, Rest, false> : never) | {
76
75
  path: R extends true ? "length" : `${P}.length`;
77
76
  value: T["length"];
78
77
  };
78
+ //#endregion
79
+ //#region src/util/types/KnownKeys.d.ts
80
+ type KnownKeys<T> = { [K in keyof T as string extends K ? never : number extends K ? never : K]: T[K] };
81
+ //#endregion
82
+ //#region src/util/types/GetObjectProps.d.ts
79
83
  type GetObjectProps<T, P extends string, D extends unknown[], R extends boolean> = { [K in keyof KnownKeys<T> & (number | string)]: K extends `${number}` ? never : NonNullable<T[K]> extends Function ? never : (D extends [unknown, ...infer Rest] ? GetProperties<T[K], R extends true ? `${K}` : `${P}.${K}`, Rest, false> : never) | {
80
84
  path: R extends true ? `${K}` : `${P}.${K}`;
81
85
  value: T[K];
82
86
  } }[keyof KnownKeys<T> & (number | string)];
87
+ //#endregion
88
+ //#region src/util/types/GetPrimitiveProps.d.ts
83
89
  type GetPrimitiveProps<T, P extends string, D extends unknown[], R extends boolean> = T extends string ? {
84
90
  path: R extends true ? "length" : `${P}.length`;
85
91
  value: number;
@@ -87,7 +93,9 @@ type GetPrimitiveProps<T, P extends string, D extends unknown[], R extends boole
87
93
  path: R extends true ? "description" : `${P}.description`;
88
94
  value: string | undefined;
89
95
  } : never;
90
- type KnownKeys<T> = { [K in keyof T as string extends K ? never : number extends K ? never : K]: T[K] };
96
+ //#endregion
97
+ //#region src/util/types/GetProperties.d.ts
98
+ type GetProperties<T, P extends string = "", D extends unknown[] = [unknown, unknown, unknown, unknown, unknown], R extends boolean = true> = [T] extends [never] ? never : D extends [] ? never : NonNullable<T> extends infer O ? O extends unknown[] ? GetArrayProps<O, P, D, R> : O extends object ? GetObjectProps<O, P, D, R> : GetPrimitiveProps<O, P, D, R> : never;
91
99
  //#endregion
92
100
  //#region src/util/types/GetPaths.d.ts
93
101
  type GetPaths<T> = GetProperties<T> extends infer U ? (U extends {
@@ -127,10 +135,10 @@ declare abstract class Serializable {
127
135
  //#region src/models/shared/TakeOne.d.ts
128
136
  interface TakeOne {
129
137
  <T extends readonly unknown[]>(values: T, index?: number): T[number];
130
- <T extends Record<PropertyKey, unknown>>(values: T, index: keyof T): T[keyof T];
138
+ <T extends object | Record<PropertyKey, unknown>>(values: T, index: keyof T): T[keyof T];
131
139
  }
132
140
  //#endregion
133
- //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/primitive.d.ts
141
+ //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/primitive.d.ts
134
142
  /**
135
143
  Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
136
144
 
@@ -138,7 +146,7 @@ Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/
138
146
  */
139
147
  type Primitive = null | undefined | string | number | boolean | symbol | bigint;
140
148
  //#endregion
141
- //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/basic.d.ts
149
+ //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/basic.d.ts
142
150
  /**
143
151
  Matches a [`class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes).
144
152
 
@@ -149,7 +157,7 @@ type Class<T, Arguments extends unknown[] = any[]> = {
149
157
  new (...arguments_: Arguments): T;
150
158
  };
151
159
  //#endregion
152
- //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/is-any.d.ts
160
+ //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/is-any.d.ts
153
161
  /**
154
162
  Returns a boolean for whether the given type is `any`.
155
163
 
@@ -180,7 +188,7 @@ const anyA = get(anyObject, 'a');
180
188
  */
181
189
  type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;
182
190
  //#endregion
183
- //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/is-optional-key-of.d.ts
191
+ //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/is-optional-key-of.d.ts
184
192
  /**
185
193
  Returns a boolean for whether the given key is an optional key of type.
186
194
 
@@ -223,7 +231,7 @@ type T5 = IsOptionalKeyOf<User | Admin, 'surname'>;
223
231
  */
224
232
  type IsOptionalKeyOf<Type extends object, Key extends keyof Type> = IsAny<Type | Key> extends true ? never : Key extends keyof Type ? Type extends Record<Key, Type[Key]> ? false : true : false;
225
233
  //#endregion
226
- //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/optional-keys-of.d.ts
234
+ //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/optional-keys-of.d.ts
227
235
  /**
228
236
  Extract all optional keys from the given type.
229
237
 
@@ -261,7 +269,7 @@ type OptionalKeysOf<Type extends object> = Type extends unknown // For distribut
261
269
  ? (keyof { [Key in keyof Type as IsOptionalKeyOf<Type, Key> extends false ? never : Key]: never }) & keyof Type // Intersect with `keyof Type` to ensure result of `OptionalKeysOf<Type>` is always assignable to `keyof Type`
262
270
  : never;
263
271
  //#endregion
264
- //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/required-keys-of.d.ts
272
+ //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/required-keys-of.d.ts
265
273
  /**
266
274
  Extract all required keys from the given type.
267
275
 
@@ -295,7 +303,7 @@ const validator3 = createValidation<User>('luckyNumber', value => value > 0);
295
303
  type RequiredKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
296
304
  ? Exclude<keyof Type, OptionalKeysOf<Type>> : never;
297
305
  //#endregion
298
- //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/is-never.d.ts
306
+ //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/is-never.d.ts
299
307
  /**
300
308
  Returns a boolean for whether the given type is `never`.
301
309
 
@@ -351,7 +359,7 @@ type B = IsTrueFixed<never>;
351
359
  */
352
360
  type IsNever<T> = [T] extends [never] ? true : false;
353
361
  //#endregion
354
- //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/if.d.ts
362
+ //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/if.d.ts
355
363
  /**
356
364
  An if-else-like type that resolves depending on whether the given `boolean` type is `true` or `false`.
357
365
 
@@ -446,7 +454,7 @@ type Works = IncludesWithoutIf<HundredZeroes, '1'>;
446
454
  */
447
455
  type If<Type extends boolean, IfBranch, ElseBranch> = IsNever<Type> extends true ? ElseBranch : Type extends true ? IfBranch : ElseBranch;
448
456
  //#endregion
449
- //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/unknown-array.d.ts
457
+ //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/unknown-array.d.ts
450
458
  /**
451
459
  Represents an array with `unknown` value.
452
460
 
@@ -473,7 +481,7 @@ type C = IsArray<string>;
473
481
  */
474
482
  type UnknownArray = readonly unknown[];
475
483
  //#endregion
476
- //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/internal/type.d.ts
484
+ //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/internal/type.d.ts
477
485
  /**
478
486
  Returns a boolean for whether A is false.
479
487
 
@@ -537,7 +545,7 @@ Indicates the value of `exactOptionalPropertyTypes` compiler option.
537
545
  */
538
546
  type IsExactOptionalPropertyTypesEnabled = [(string | undefined)?] extends [string?] ? false : true;
539
547
  //#endregion
540
- //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/internal/array.d.ts
548
+ //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/internal/array.d.ts
541
549
  /**
542
550
  Transforms a tuple type by replacing it's rest element with a single element that has the same type as the rest element, while keeping all the non-rest elements intact.
543
551
 
@@ -579,7 +587,7 @@ type _CollapseRestElement<TArray extends UnknownArray, ForwardAccumulator extend
579
587
  : First], BackwardAccumulator> : never // Should never happen, since `[(infer First)?, ...infer Rest]` is a top-type for arrays.
580
588
  : never; // Should never happen
581
589
  //#endregion
582
- //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/internal/characters.d.ts
590
+ //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/internal/characters.d.ts
583
591
  type Whitespace = '\u{9}' // '\t'
584
592
  | '\u{A}' // '\n'
585
593
  | '\u{B}' // '\v'
@@ -593,19 +601,17 @@ type AsciiPunctuation = '!' | '"' | '#' | '$' | '%' | '&' | '\'' | '(' | ')' | '
593
601
  //#region ../../node_modules/.pnpm/tagged-tag@1.0.0/node_modules/tagged-tag/index.d.ts
594
602
  declare const tag: unique symbol;
595
603
  //#endregion
596
- //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/tagged.d.ts
604
+ //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/tagged.d.ts
597
605
  // eslint-disable-next-line type-fest/require-exported-types
598
606
  type TagContainer<Token> = {
599
607
  readonly [tag]: Token;
600
608
  };
601
609
  type Tag<Token extends PropertyKey, TagMetadata> = TagContainer<{ [K in Token]: TagMetadata }>;
602
610
  /**
603
- Attach a "tag" to an arbitrary type. This allows you to create distinct types, that aren't assignable to one another, for distinct concepts in your program that should not be interchangeable, even if their runtime values have the same type. (See examples.)
611
+ Create a [tagged type](https://medium.com/@KevinBGreene/surviving-the-typescript-ecosystem-branding-and-type-tagging-6cf6e516523d) that can support [multiple tags](https://github.com/sindresorhus/type-fest/issues/665) and [per-tag metadata](https://medium.com/@ethanresnick/advanced-typescript-tagged-types-improved-with-type-level-metadata-5072fc125fcf).
604
612
 
605
613
  A type returned by `Tagged` can be passed to `Tagged` again, to create a type with multiple tags.
606
614
 
607
- [Read more about tagged types.](https://medium.com/@KevinBGreene/surviving-the-typescript-ecosystem-branding-and-type-tagging-6cf6e516523d)
608
-
609
615
  A tag's name is usually a string (and must be a string, number, or symbol), but each application of a tag can also contain an arbitrary type as its "metadata". See {@link GetTagMetadata} for examples and explanation.
610
616
 
611
617
  A type `A` returned by `Tagged` is assignable to another type `B` returned by `Tagged` if and only if:
@@ -662,7 +668,7 @@ type SpecialCacheKey2 = Tagged<string, 'URL' | 'SpecialCacheKey'>;
662
668
  */
663
669
  type Tagged<Type, TagName extends PropertyKey, TagMetadata = never> = Type & Tag<TagName, TagMetadata>;
664
670
  /**
665
- Revert a tagged type back to its original type by removing all tags.
671
+ Get the untagged portion of a tagged type created with `Tagged`.
666
672
 
667
673
  Why is this necessary?
668
674
 
@@ -767,7 +773,7 @@ type Person = {
767
773
  @deprecated Use {@link Tagged} instead
768
774
  */
769
775
  //#endregion
770
- //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/is-literal.d.ts
776
+ //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/is-literal.d.ts
771
777
  /**
772
778
  Returns a boolean for whether the given type is a `string` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types).
773
779
 
@@ -829,7 +835,7 @@ type _IsStringLiteral<S> = // If `T` is an infinite string type (e.g., `on${stri
829
835
  // and since `{}` extends index signatures, the result becomes `false`.
830
836
  S extends string ? {} extends Record<S, never> ? false : true : false;
831
837
  //#endregion
832
- //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/trim.d.ts
838
+ //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/trim.d.ts
833
839
  /**
834
840
  Remove spaces from the left side.
835
841
  */
@@ -854,7 +860,7 @@ type Example = Trim<' foo '>;
854
860
  */
855
861
  type Trim<V extends string> = TrimLeft<TrimRight<V>>;
856
862
  //#endregion
857
- //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/internal/string.d.ts
863
+ //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/internal/string.d.ts
858
864
  /**
859
865
  Returns a boolean for whether the given string `S` starts with the given string `SearchString`.
860
866
 
@@ -884,7 +890,7 @@ This type is a workaround for [Microsoft/TypeScript#46109](https://github.com/mi
884
890
  */
885
891
  type IsNumeric<T extends string> = T extends `${number}` ? Trim<T> extends T ? true : false : false;
886
892
  //#endregion
887
- //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/simplify.d.ts
893
+ //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/simplify.d.ts
888
894
  /**
889
895
  Useful to flatten the type output to improve type hints shown in editors. And also to transform an interface into a type to aide with assignability.
890
896
 
@@ -945,7 +951,7 @@ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface`
945
951
  */
946
952
  type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};
947
953
  //#endregion
948
- //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/is-equal.d.ts
954
+ //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/is-equal.d.ts
949
955
  /**
950
956
  Returns a boolean for whether the two given types are equal.
951
957
 
@@ -976,7 +982,7 @@ type IsEqual<A, B> = [A] extends [B] ? [B] extends [A] ? _IsEqual<A, B> : false
976
982
  // This version fails the `equalWrappedTupleIntersectionToBeNeverAndNeverExpanded` test in `test-d/is-equal.ts`.
977
983
  type _IsEqual<A, B> = (<G>() => G extends A & G | G ? 1 : 2) extends (<G>() => G extends B & G | G ? 1 : 2) ? true : false;
978
984
  //#endregion
979
- //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/omit-index-signature.d.ts
985
+ //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/omit-index-signature.d.ts
980
986
  /**
981
987
  Omit any index signatures from the given object type, leaving only explicitly defined properties.
982
988
 
@@ -1070,7 +1076,7 @@ type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
1070
1076
  */
1071
1077
  type OmitIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType] };
1072
1078
  //#endregion
1073
- //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/pick-index-signature.d.ts
1079
+ //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/pick-index-signature.d.ts
1074
1080
  /**
1075
1081
  Pick only index signatures from the given object type, leaving out all explicitly defined properties.
1076
1082
 
@@ -1118,7 +1124,7 @@ type ExampleIndexSignature = PickIndexSignature<Example>;
1118
1124
  */
1119
1125
  type PickIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? KeyType : never]: ObjectType[KeyType] };
1120
1126
  //#endregion
1121
- //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/merge.d.ts
1127
+ //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/merge.d.ts
1122
1128
  // Merges two objects without worrying about index signatures.
1123
1129
  type SimpleMerge<Destination, Source> = Simplify<{ [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key] } & Source>;
1124
1130
  /**
@@ -1190,7 +1196,7 @@ type Merge<Destination, Source> = Destination extends unknown // For distributin
1190
1196
  // Should never happen
1191
1197
  type _Merge<Destination, Source> = Simplify<SimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>> & SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>>;
1192
1198
  //#endregion
1193
- //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/internal/object.d.ts
1199
+ //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/internal/object.d.ts
1194
1200
  /**
1195
1201
  Merges user specified options with default options.
1196
1202
 
@@ -1274,7 +1280,7 @@ type E = CollapseLiterals<LiteralUnion<'foo' | 'bar', string> | null | undefined
1274
1280
  */
1275
1281
  type CollapseLiterals<T> = {} extends T ? T : T extends infer U & {} ? U : T;
1276
1282
  //#endregion
1277
- //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/some-extend.d.ts
1283
+ //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/some-extend.d.ts
1278
1284
  /**
1279
1285
  @see {@link SomeExtend}
1280
1286
  */
@@ -1356,7 +1362,7 @@ type SomeExtend<TArray extends UnknownArray, Type, Options extends SomeExtendOpt
1356
1362
  type _SomeExtend<TArray extends UnknownArray, Type, Options extends Required<SomeExtendOptions>> = IfNotAnyOrNever<TArray, TArray extends readonly [infer First, ...infer Rest] ? IsNever<First> extends true ? Or<Or<IsNever<Type>, IsAny<Type>>, Not<Options['strictNever']>> extends true // If target `Type` is also `never`, or is `any`, or `strictNever` is disabled, return `true`.
1357
1363
  ? true : _SomeExtend<Rest, Type, Options> : First extends Type ? true : _SomeExtend<Rest, Type, Options> : false, false, false>;
1358
1364
  //#endregion
1359
- //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/or-all.d.ts
1365
+ //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/or-all.d.ts
1360
1366
  /**
1361
1367
  Returns a boolean for whether any of the given elements is `true`.
1362
1368
 
@@ -1427,9 +1433,9 @@ Note: `OrAll<[]>` evaluates to `false` because there are no `true` elements in a
1427
1433
  */
1428
1434
  type OrAll<T extends readonly boolean[]> = SomeExtend<T, true>;
1429
1435
  //#endregion
1430
- //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/or.d.ts
1436
+ //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/or.d.ts
1431
1437
  /**
1432
- Returns a boolean for whether either of two given types is true.
1438
+ Returns a boolean for whether either of two given types is `true`.
1433
1439
 
1434
1440
  Use-case: Constructing complex conditional types where at least one condition must be satisfied.
1435
1441
 
@@ -1507,7 +1513,7 @@ type G = Or<never, never>;
1507
1513
  */
1508
1514
  type Or<A extends boolean, B extends boolean> = OrAll<[A, B]>;
1509
1515
  //#endregion
1510
- //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/all-extend.d.ts
1516
+ //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/all-extend.d.ts
1511
1517
  /**
1512
1518
  @see {@link AllExtend}
1513
1519
  */
@@ -1593,7 +1599,7 @@ type AllExtend<TArray extends UnknownArray, Type, Options extends AllExtendOptio
1593
1599
  type _AllExtend<TArray extends UnknownArray, Type, Options extends Required<AllExtendOptions>> = IfNotAnyOrNever<TArray, TArray extends readonly [infer First, ...infer Rest] ? IsNever<First> extends true ? Or<Or<IsNever<Type>, IsAny<Type>>, Not<Options['strictNever']>> extends true // If target `Type` is also `never`, or is `any`, or `strictNever` is disabled, recurse further.
1594
1600
  ? _AllExtend<Rest, Type, Options> : false : First extends Type ? _AllExtend<Rest, Type, Options> : false : true, false, false>;
1595
1601
  //#endregion
1596
- //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/except.d.ts
1602
+ //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/except.d.ts
1597
1603
  /**
1598
1604
  Filter out keys from an object.
1599
1605
 
@@ -1691,7 +1697,34 @@ type PostPayloadFixed = Except<UserData, 'email'>;
1691
1697
  type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {}> = _Except<ObjectType, KeysType, ApplyDefaultOptions<ExceptOptions, DefaultExceptOptions, Options>>;
1692
1698
  type _Except<ObjectType, KeysType extends keyof ObjectType, Options extends Required<ExceptOptions>> = { [KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType] } & (Options['requireExactProps'] extends true ? Partial<Record<KeysType, never>> : {});
1693
1699
  //#endregion
1694
- //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/is-lowercase.d.ts
1700
+ //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/promisable.d.ts
1701
+ /**
1702
+ Create a type that represents either the value or the value wrapped in `PromiseLike`.
1703
+
1704
+ Use-cases:
1705
+ - A function accepts a callback that may either return a value synchronously or may return a promised value.
1706
+ - This type could be the return type of `Promise#then()`, `Promise#catch()`, and `Promise#finally()` callbacks.
1707
+
1708
+ Please upvote [this issue](https://github.com/microsoft/TypeScript/issues/31394) if you want to have this type as a built-in in TypeScript.
1709
+
1710
+ @example
1711
+ ```
1712
+ import type {Promisable} from 'type-fest';
1713
+
1714
+ async function logger(getLogEntry: () => Promisable<string>): Promise<void> {
1715
+ const entry = await getLogEntry();
1716
+ console.log(entry);
1717
+ }
1718
+
1719
+ await logger(() => 'foo');
1720
+ await logger(() => Promise.resolve('bar'));
1721
+ ```
1722
+
1723
+ @category Async
1724
+ */
1725
+ type Promisable<T> = T | PromiseLike<T>;
1726
+ //#endregion
1727
+ //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/is-lowercase.d.ts
1695
1728
  /**
1696
1729
  Returns a boolean for whether the given string literal is lowercase.
1697
1730
 
@@ -1719,7 +1752,7 @@ Returns a boolean for whether an individual part of the string is lowercase.
1719
1752
  */
1720
1753
  type IsLowercaseHelper<S extends string> = S extends Lowercase<string> ? true : S extends Uppercase<string> | Capitalize<string> | `${string}${Uppercase<string>}${string}` ? false : boolean;
1721
1754
  //#endregion
1722
- //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/is-uppercase.d.ts
1755
+ //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/is-uppercase.d.ts
1723
1756
  /**
1724
1757
  Returns a boolean for whether the given string literal is uppercase.
1725
1758
 
@@ -1747,7 +1780,7 @@ Returns a boolean for whether an individual part of the string is uppercase.
1747
1780
  */
1748
1781
  type IsUppercaseHelper<S extends string> = S extends Uppercase<string> ? true : S extends Lowercase<string> | Uncapitalize<string> | `${string}${Lowercase<string>}${string}` ? false : boolean;
1749
1782
  //#endregion
1750
- //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/words.d.ts
1783
+ //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/words.d.ts
1751
1784
  type SkipEmptyWord<Word extends string> = Word extends '' ? [] : [Word];
1752
1785
  type RemoveLastCharacter<Sentence extends string, Character extends string> = Sentence extends `${infer LeftSide}${Character}` ? SkipEmptyWord<LeftSide> : never;
1753
1786
  /**
@@ -1769,15 +1802,29 @@ type WordsOptions = {
1769
1802
  ```
1770
1803
  */
1771
1804
  splitOnNumbers?: boolean;
1805
+ /**
1806
+ Split on {@link AsciiPunctuation | punctuation characters} (e.g., `#`, `&`, `*`, `:`, `?`, `@`, `~`).
1807
+ @example
1808
+ ```
1809
+ import type {Words} from 'type-fest';
1810
+ type Example1 = Words<'hello:world', {splitOnPunctuation: true}>;
1811
+ //=> ['hello', 'world']
1812
+ type Example2 = Words<'hello:world', {splitOnPunctuation: false}>;
1813
+ //=> ['hello', ':world']
1814
+ ```
1815
+ */
1816
+ splitOnPunctuation?: boolean;
1772
1817
  };
1773
1818
  type _DefaultWordsOptions = {
1774
1819
  splitOnNumbers: true;
1820
+ splitOnPunctuation: false;
1775
1821
  };
1776
1822
  /**
1777
- Split a string (almost) like Lodash's `_.words()` function.
1823
+ Split a string similar to Lodash's `_.words()` function.
1778
1824
 
1779
1825
  - Split on each word that begins with a capital letter.
1780
1826
  - Split on each {@link WordSeparators}.
1827
+ - Split on each {@link AsciiPunctuation} (if {@link WordsOptions.splitOnPunctuation} is enabled).
1781
1828
  - Split on numeric sequence.
1782
1829
 
1783
1830
  @example
@@ -1801,13 +1848,22 @@ type Words4 = Words<'lifeIs42'>;
1801
1848
 
1802
1849
  type Words5 = Words<'p2pNetwork', {splitOnNumbers: false}>;
1803
1850
  //=> ['p2p', 'Network']
1851
+
1852
+ type Words6 = Words<'hello:world', {splitOnPunctuation: true}>;
1853
+ //=> ['hello', 'world']
1854
+
1855
+ type Words7 = Words<'hello:world', {splitOnPunctuation: false}>;
1856
+ //=> ['hello', ':world']
1857
+
1858
+ type Words8 = Words<'hello::world', {splitOnPunctuation: true}>;
1859
+ //=> ['hello', 'world']
1804
1860
  ```
1805
1861
 
1806
1862
  @category Change case
1807
1863
  @category Template literal
1808
1864
  */
1809
1865
  type Words<Sentence extends string, Options extends WordsOptions = {}> = WordsImplementation<Sentence, ApplyDefaultOptions<WordsOptions, _DefaultWordsOptions, Options>>;
1810
- type WordsImplementation<Sentence extends string, Options extends Required<WordsOptions>, LastCharacter extends string = '', CurrentWord extends string = ''> = Sentence extends `${infer FirstCharacter}${infer RemainingCharacters}` ? FirstCharacter extends WordSeparators // Skip word separator
1866
+ type WordsImplementation<Sentence extends string, Options extends Required<WordsOptions>, LastCharacter extends string = '', CurrentWord extends string = ''> = Sentence extends `${infer FirstCharacter}${infer RemainingCharacters}` ? FirstCharacter extends WordSeparators | (Options['splitOnPunctuation'] extends true ? AsciiPunctuation : never) // Skip word separator
1811
1867
  ? [...SkipEmptyWord<CurrentWord>, ...WordsImplementation<RemainingCharacters, Options>] : LastCharacter extends '' // Fist char of word
1812
1868
  ? WordsImplementation<RemainingCharacters, Options, FirstCharacter, FirstCharacter> // Case change: non-numeric to numeric
1813
1869
  : [false, true] extends [IsNumeric<LastCharacter>, IsNumeric<FirstCharacter>] ? Options['splitOnNumbers'] extends true // Split on number: push word
@@ -1821,7 +1877,7 @@ type WordsImplementation<Sentence extends string, Options extends Required<Words
1821
1877
  : [true, true] extends [IsUppercase<LastCharacter>, IsLowercase<FirstCharacter>] ? [...RemoveLastCharacter<CurrentWord, LastCharacter>, ...WordsImplementation<RemainingCharacters, Options, FirstCharacter, `${LastCharacter}${FirstCharacter}`>] // No case change: concat word
1822
1878
  : WordsImplementation<RemainingCharacters, Options, FirstCharacter, `${CurrentWord}${FirstCharacter}`> : [...SkipEmptyWord<CurrentWord>];
1823
1879
  //#endregion
1824
- //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/remove-prefix.d.ts
1880
+ //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/remove-prefix.d.ts
1825
1881
  /**
1826
1882
  @see {@link RemovePrefix}
1827
1883
  */
@@ -1911,7 +1967,7 @@ type _RemovePrefix<S extends string, Prefix extends string, Options extends Requ
1911
1967
  : S // Return back `S` when `Prefix` is not present at the start of `S`
1912
1968
  : never;
1913
1969
  //#endregion
1914
- //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/delimiter-case.d.ts
1970
+ //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/delimiter-case.d.ts
1915
1971
  type _DefaultDelimiterCaseOptions = Merge<_DefaultWordsOptions, {
1916
1972
  splitOnNumbers: false;
1917
1973
  }>;
@@ -1935,6 +1991,7 @@ import type {DelimiterCase} from 'type-fest';
1935
1991
 
1936
1992
  const someVariable: DelimiterCase<'fooBar', '#'> = 'foo#bar';
1937
1993
  const someVariableNoSplitOnNumbers: DelimiterCase<'p2pNetwork', '#', {splitOnNumbers: false}> = 'p2p#network';
1994
+ const someVariableWithPunctuation: DelimiterCase<'div.card::after', '#', {splitOnPunctuation: true}> = 'div#card#after';
1938
1995
 
1939
1996
  // Advanced
1940
1997
 
@@ -1962,7 +2019,7 @@ type DelimiterCase<Value, Delimiter extends string, Options extends WordsOptions
1962
2019
  strict: false;
1963
2020
  }>> : Value;
1964
2021
  //#endregion
1965
- //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/kebab-case.d.ts
2022
+ //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/kebab-case.d.ts
1966
2023
  /**
1967
2024
  Convert a string literal to kebab-case.
1968
2025
 
@@ -1976,6 +2033,7 @@ import type {KebabCase} from 'type-fest';
1976
2033
 
1977
2034
  const someVariable: KebabCase<'fooBar'> = 'foo-bar';
1978
2035
  const someVariableNoSplitOnNumbers: KebabCase<'p2pNetwork', {splitOnNumbers: false}> = 'p2p-network';
2036
+ const someVariableWithPunctuation: KebabCase<'div.card::after', {splitOnPunctuation: true}> = 'div-card-after';
1979
2037
 
1980
2038
  // Advanced
1981
2039
 
@@ -2019,6 +2077,318 @@ interface WithMetadata<TBase extends Class<NonNullable<unknown>>> {
2019
2077
  //#region src/services/app/constants.d.ts
2020
2078
  declare const SITE_NAME = "Esposter";
2021
2079
  //#endregion
2080
+ //#region ../../node_modules/.pnpm/neverthrow@8.2.0/node_modules/neverthrow/dist/index.d.ts
2081
+ interface ErrorConfig {
2082
+ withStackTrace: boolean;
2083
+ }
2084
+ declare class ResultAsync<T, E> implements PromiseLike<Result<T, E>> {
2085
+ private _promise;
2086
+ constructor(res: Promise<Result<T, E>>);
2087
+ static fromSafePromise<T, E = never>(promise: PromiseLike<T>): ResultAsync<T, E>;
2088
+ static fromPromise<T, E>(promise: PromiseLike<T>, errorFn: (e: unknown) => E): ResultAsync<T, E>;
2089
+ static fromThrowable<A extends readonly any[], R, E>(fn: (...args: A) => Promise<R>, errorFn?: (err: unknown) => E): (...args: A) => ResultAsync<R, E>;
2090
+ static combine<T extends readonly [ResultAsync<unknown, unknown>, ...ResultAsync<unknown, unknown>[]]>(asyncResultList: T): CombineResultAsyncs<T>;
2091
+ static combine<T extends readonly ResultAsync<unknown, unknown>[]>(asyncResultList: T): CombineResultAsyncs<T>;
2092
+ static combineWithAllErrors<T extends readonly [ResultAsync<unknown, unknown>, ...ResultAsync<unknown, unknown>[]]>(asyncResultList: T): CombineResultsWithAllErrorsArrayAsync<T>;
2093
+ static combineWithAllErrors<T extends readonly ResultAsync<unknown, unknown>[]>(asyncResultList: T): CombineResultsWithAllErrorsArrayAsync<T>;
2094
+ map<A>(f: (t: T) => A | Promise<A>): ResultAsync<A, E>;
2095
+ andThrough<F>(f: (t: T) => Result<unknown, F> | ResultAsync<unknown, F>): ResultAsync<T, E | F>;
2096
+ andTee(f: (t: T) => unknown): ResultAsync<T, E>;
2097
+ orTee(f: (t: E) => unknown): ResultAsync<T, E>;
2098
+ mapErr<U>(f: (e: E) => U | Promise<U>): ResultAsync<T, U>;
2099
+ andThen<R extends Result<unknown, unknown>>(f: (t: T) => R): ResultAsync<InferOkTypes<R>, InferErrTypes<R> | E>;
2100
+ andThen<R extends ResultAsync<unknown, unknown>>(f: (t: T) => R): ResultAsync<InferAsyncOkTypes<R>, InferAsyncErrTypes<R> | E>;
2101
+ andThen<U, F>(f: (t: T) => Result<U, F> | ResultAsync<U, F>): ResultAsync<U, E | F>;
2102
+ orElse<R extends Result<unknown, unknown>>(f: (e: E) => R): ResultAsync<InferOkTypes<R> | T, InferErrTypes<R>>;
2103
+ orElse<R extends ResultAsync<unknown, unknown>>(f: (e: E) => R): ResultAsync<InferAsyncOkTypes<R> | T, InferAsyncErrTypes<R>>;
2104
+ orElse<U, A>(f: (e: E) => Result<U, A> | ResultAsync<U, A>): ResultAsync<U | T, A>;
2105
+ match<A, B = A>(ok: (t: T) => A, _err: (e: E) => B): Promise<A | B>;
2106
+ unwrapOr<A>(t: A): Promise<T | A>;
2107
+ /**
2108
+ * @deprecated will be removed in 9.0.0.
2109
+ *
2110
+ * You can use `safeTry` without this method.
2111
+ * @example
2112
+ * ```typescript
2113
+ * safeTry(async function* () {
2114
+ * const okValue = yield* yourResult
2115
+ * })
2116
+ * ```
2117
+ * Emulates Rust's `?` operator in `safeTry`'s body. See also `safeTry`.
2118
+ */
2119
+ safeUnwrap(): AsyncGenerator<Err<never, E>, T>;
2120
+ then<A, B>(successCallback?: (res: Result<T, E>) => A | PromiseLike<A>, failureCallback?: (reason: unknown) => B | PromiseLike<B>): PromiseLike<A | B>;
2121
+ [Symbol.asyncIterator](): AsyncGenerator<Err<never, E>, T>;
2122
+ }
2123
+ declare type CombineResultAsyncs<T extends readonly ResultAsync<unknown, unknown>[]> = IsLiteralArray<T> extends 1 ? TraverseAsync<UnwrapAsync<T>> : ResultAsync<ExtractOkAsyncTypes<T>, ExtractErrAsyncTypes<T>[number]>;
2124
+ declare type CombineResultsWithAllErrorsArrayAsync<T extends readonly ResultAsync<unknown, unknown>[]> = IsLiteralArray<T> extends 1 ? TraverseWithAllErrorsAsync<UnwrapAsync<T>> : ResultAsync<ExtractOkAsyncTypes<T>, ExtractErrAsyncTypes<T>[number][]>;
2125
+ declare type UnwrapAsync<T> = IsLiteralArray<T> extends 1 ? Writable<T> extends [infer H, ...infer Rest] ? H extends PromiseLike<infer HI> ? HI extends Result<unknown, unknown> ? [Dedup<HI>, ...UnwrapAsync<Rest>] : never : never : [] : T extends Array<infer A> ? A extends PromiseLike<infer HI> ? HI extends Result<infer L, infer R> ? Ok<L, R>[] : never : never : never;
2126
+ declare type TraverseAsync<T, Depth extends number = 5> = IsLiteralArray<T> extends 1 ? Combine<T, Depth> extends [infer Oks, infer Errs] ? ResultAsync<EmptyArrayToNever<Oks>, MembersToUnion<Errs>> : never : T extends Array<infer I> ? Combine<MemberListOf<I>, Depth> extends [infer Oks, infer Errs] ? Oks extends unknown[] ? Errs extends unknown[] ? ResultAsync<EmptyArrayToNever<Oks[number][]>, MembersToUnion<Errs[number][]>> : ResultAsync<EmptyArrayToNever<Oks[number][]>, Errs> : Errs extends unknown[] ? ResultAsync<Oks, MembersToUnion<Errs[number][]>> : ResultAsync<Oks, Errs> : never : never;
2127
+ declare type TraverseWithAllErrorsAsync<T, Depth extends number = 5> = TraverseAsync<T, Depth> extends ResultAsync<infer Oks, infer Errs> ? ResultAsync<Oks, Errs[]> : never;
2128
+ declare type Writable<T> = T extends ReadonlyArray<unknown> ? [...T] : T;
2129
+ declare type ExtractOkTypes<T extends readonly Result<unknown, unknown>[]> = { [idx in keyof T]: T[idx] extends Result<infer U, unknown> ? U : never };
2130
+ declare type ExtractOkAsyncTypes<T extends readonly ResultAsync<unknown, unknown>[]> = { [idx in keyof T]: T[idx] extends ResultAsync<infer U, unknown> ? U : never };
2131
+ declare type ExtractErrTypes<T extends readonly Result<unknown, unknown>[]> = { [idx in keyof T]: T[idx] extends Result<unknown, infer E> ? E : never };
2132
+ declare type ExtractErrAsyncTypes<T extends readonly ResultAsync<unknown, unknown>[]> = { [idx in keyof T]: T[idx] extends ResultAsync<unknown, infer E> ? E : never };
2133
+ declare type InferOkTypes<R> = R extends Result<infer T, unknown> ? T : never;
2134
+ declare type InferErrTypes<R> = R extends Result<unknown, infer E> ? E : never;
2135
+ declare type InferAsyncOkTypes<R> = R extends ResultAsync<infer T, unknown> ? T : never;
2136
+ declare type InferAsyncErrTypes<R> = R extends ResultAsync<unknown, infer E> ? E : never;
2137
+ declare namespace Result {
2138
+ /**
2139
+ * Wraps a function with a try catch, creating a new function with the same
2140
+ * arguments but returning `Ok` if successful, `Err` if the function throws
2141
+ *
2142
+ * @param fn function to wrap with ok on success or err on failure
2143
+ * @param errorFn when an error is thrown, this will wrap the error result if provided
2144
+ */
2145
+ function fromThrowable<Fn extends (...args: readonly any[]) => any, E>(fn: Fn, errorFn?: (e: unknown) => E): (...args: Parameters<Fn>) => Result<ReturnType<Fn>, E>;
2146
+ function combine<T extends readonly [Result<unknown, unknown>, ...Result<unknown, unknown>[]]>(resultList: T): CombineResults<T>;
2147
+ function combine<T extends readonly Result<unknown, unknown>[]>(resultList: T): CombineResults<T>;
2148
+ function combineWithAllErrors<T extends readonly [Result<unknown, unknown>, ...Result<unknown, unknown>[]]>(resultList: T): CombineResultsWithAllErrorsArray<T>;
2149
+ function combineWithAllErrors<T extends readonly Result<unknown, unknown>[]>(resultList: T): CombineResultsWithAllErrorsArray<T>;
2150
+ }
2151
+ declare type Result<T, E> = Ok<T, E> | Err<T, E>;
2152
+ interface IResult<T, E> {
2153
+ /**
2154
+ * Used to check if a `Result` is an `OK`
2155
+ *
2156
+ * @returns `true` if the result is an `OK` variant of Result
2157
+ */
2158
+ isOk(): this is Ok<T, E>;
2159
+ /**
2160
+ * Used to check if a `Result` is an `Err`
2161
+ *
2162
+ * @returns `true` if the result is an `Err` variant of Result
2163
+ */
2164
+ isErr(): this is Err<T, E>;
2165
+ /**
2166
+ * Maps a `Result<T, E>` to `Result<U, E>`
2167
+ * by applying a function to a contained `Ok` value, leaving an `Err` value
2168
+ * untouched.
2169
+ *
2170
+ * @param f The function to apply an `OK` value
2171
+ * @returns the result of applying `f` or an `Err` untouched
2172
+ */
2173
+ map<A>(f: (t: T) => A): Result<A, E>;
2174
+ /**
2175
+ * Maps a `Result<T, E>` to `Result<T, F>` by applying a function to a
2176
+ * contained `Err` value, leaving an `Ok` value untouched.
2177
+ *
2178
+ * This function can be used to pass through a successful result while
2179
+ * handling an error.
2180
+ *
2181
+ * @param f a function to apply to the error `Err` value
2182
+ */
2183
+ mapErr<U>(f: (e: E) => U): Result<T, U>;
2184
+ /**
2185
+ * Similar to `map` Except you must return a new `Result`.
2186
+ *
2187
+ * This is useful for when you need to do a subsequent computation using the
2188
+ * inner `T` value, but that computation might fail.
2189
+ * Additionally, `andThen` is really useful as a tool to flatten a
2190
+ * `Result<Result<A, E2>, E1>` into a `Result<A, E2>` (see example below).
2191
+ *
2192
+ * @param f The function to apply to the current value
2193
+ */
2194
+ andThen<R extends Result<unknown, unknown>>(f: (t: T) => R): Result<InferOkTypes<R>, InferErrTypes<R> | E>;
2195
+ andThen<U, F>(f: (t: T) => Result<U, F>): Result<U, E | F>;
2196
+ /**
2197
+ * This "tee"s the current value to an passed-in computation such as side
2198
+ * effect functions but still returns the same current value as the result.
2199
+ *
2200
+ * This is useful when you want to pass the current result to your side-track
2201
+ * work such as logging but want to continue main-track work after that.
2202
+ * This method does not care about the result of the passed in computation.
2203
+ *
2204
+ * @param f The function to apply to the current value
2205
+ */
2206
+ andTee(f: (t: T) => unknown): Result<T, E>;
2207
+ /**
2208
+ * This "tee"s the current `Err` value to an passed-in computation such as side
2209
+ * effect functions but still returns the same `Err` value as the result.
2210
+ *
2211
+ * This is useful when you want to pass the current `Err` value to your side-track
2212
+ * work such as logging but want to continue error-track work after that.
2213
+ * This method does not care about the result of the passed in computation.
2214
+ *
2215
+ * @param f The function to apply to the current `Err` value
2216
+ */
2217
+ orTee(f: (t: E) => unknown): Result<T, E>;
2218
+ /**
2219
+ * Similar to `andTee` except error result of the computation will be passed
2220
+ * to the downstream in case of an error.
2221
+ *
2222
+ * This version is useful when you want to make side-effects but in case of an
2223
+ * error, you want to pass the error to the downstream.
2224
+ *
2225
+ * @param f The function to apply to the current value
2226
+ */
2227
+ andThrough<R extends Result<unknown, unknown>>(f: (t: T) => R): Result<T, InferErrTypes<R> | E>;
2228
+ andThrough<F>(f: (t: T) => Result<unknown, F>): Result<T, E | F>;
2229
+ /**
2230
+ * Takes an `Err` value and maps it to a `Result<T, SomeNewType>`.
2231
+ *
2232
+ * This is useful for error recovery.
2233
+ *
2234
+ *
2235
+ * @param f A function to apply to an `Err` value, leaving `Ok` values
2236
+ * untouched.
2237
+ */
2238
+ orElse<R extends Result<unknown, unknown>>(f: (e: E) => R): Result<InferOkTypes<R> | T, InferErrTypes<R>>;
2239
+ orElse<U, A>(f: (e: E) => Result<U, A>): Result<U | T, A>;
2240
+ /**
2241
+ * Similar to `map` Except you must return a new `Result`.
2242
+ *
2243
+ * This is useful for when you need to do a subsequent async computation using
2244
+ * the inner `T` value, but that computation might fail. Must return a ResultAsync
2245
+ *
2246
+ * @param f The function that returns a `ResultAsync` to apply to the current
2247
+ * value
2248
+ */
2249
+ asyncAndThen<U, F>(f: (t: T) => ResultAsync<U, F>): ResultAsync<U, E | F>;
2250
+ /**
2251
+ * Maps a `Result<T, E>` to `ResultAsync<U, E>`
2252
+ * by applying an async function to a contained `Ok` value, leaving an `Err`
2253
+ * value untouched.
2254
+ *
2255
+ * @param f An async function to apply an `OK` value
2256
+ */
2257
+ asyncMap<U>(f: (t: T) => Promise<U>): ResultAsync<U, E>;
2258
+ /**
2259
+ * Unwrap the `Ok` value, or return the default if there is an `Err`
2260
+ *
2261
+ * @param v the default value to return if there is an `Err`
2262
+ */
2263
+ unwrapOr<A>(v: A): T | A;
2264
+ /**
2265
+ *
2266
+ * Given 2 functions (one for the `Ok` variant and one for the `Err` variant)
2267
+ * execute the function that matches the `Result` variant.
2268
+ *
2269
+ * Match callbacks do not necessitate to return a `Result`, however you can
2270
+ * return a `Result` if you want to.
2271
+ *
2272
+ * `match` is like chaining `map` and `mapErr`, with the distinction that
2273
+ * with `match` both functions must have the same return type.
2274
+ *
2275
+ * @param ok
2276
+ * @param err
2277
+ */
2278
+ match<A, B = A>(ok: (t: T) => A, err: (e: E) => B): A | B;
2279
+ /**
2280
+ * @deprecated will be removed in 9.0.0.
2281
+ *
2282
+ * You can use `safeTry` without this method.
2283
+ * @example
2284
+ * ```typescript
2285
+ * safeTry(function* () {
2286
+ * const okValue = yield* yourResult
2287
+ * })
2288
+ * ```
2289
+ * Emulates Rust's `?` operator in `safeTry`'s body. See also `safeTry`.
2290
+ */
2291
+ safeUnwrap(): Generator<Err<never, E>, T>;
2292
+ /**
2293
+ * **This method is unsafe, and should only be used in a test environments**
2294
+ *
2295
+ * Takes a `Result<T, E>` and returns a `T` when the result is an `Ok`, otherwise it throws a custom object.
2296
+ *
2297
+ * @param config
2298
+ */
2299
+ _unsafeUnwrap(config?: ErrorConfig): T;
2300
+ /**
2301
+ * **This method is unsafe, and should only be used in a test environments**
2302
+ *
2303
+ * takes a `Result<T, E>` and returns a `E` when the result is an `Err`,
2304
+ * otherwise it throws a custom object.
2305
+ *
2306
+ * @param config
2307
+ */
2308
+ _unsafeUnwrapErr(config?: ErrorConfig): E;
2309
+ }
2310
+ declare class Ok<T, E> implements IResult<T, E> {
2311
+ readonly value: T;
2312
+ constructor(value: T);
2313
+ isOk(): this is Ok<T, E>;
2314
+ isErr(): this is Err<T, E>;
2315
+ map<A>(f: (t: T) => A): Result<A, E>;
2316
+ mapErr<U>(_f: (e: E) => U): Result<T, U>;
2317
+ andThen<R extends Result<unknown, unknown>>(f: (t: T) => R): Result<InferOkTypes<R>, InferErrTypes<R> | E>;
2318
+ andThen<U, F>(f: (t: T) => Result<U, F>): Result<U, E | F>;
2319
+ andThrough<R extends Result<unknown, unknown>>(f: (t: T) => R): Result<T, InferErrTypes<R> | E>;
2320
+ andThrough<F>(f: (t: T) => Result<unknown, F>): Result<T, E | F>;
2321
+ andTee(f: (t: T) => unknown): Result<T, E>;
2322
+ orTee(_f: (t: E) => unknown): Result<T, E>;
2323
+ orElse<R extends Result<unknown, unknown>>(_f: (e: E) => R): Result<InferOkTypes<R> | T, InferErrTypes<R>>;
2324
+ orElse<U, A>(_f: (e: E) => Result<U, A>): Result<U | T, A>;
2325
+ asyncAndThen<U, F>(f: (t: T) => ResultAsync<U, F>): ResultAsync<U, E | F>;
2326
+ asyncAndThrough<R extends ResultAsync<unknown, unknown>>(f: (t: T) => R): ResultAsync<T, InferAsyncErrTypes<R> | E>;
2327
+ asyncAndThrough<F>(f: (t: T) => ResultAsync<unknown, F>): ResultAsync<T, E | F>;
2328
+ asyncMap<U>(f: (t: T) => Promise<U>): ResultAsync<U, E>;
2329
+ unwrapOr<A>(_v: A): T | A;
2330
+ match<A, B = A>(ok: (t: T) => A, _err: (e: E) => B): A | B;
2331
+ safeUnwrap(): Generator<Err<never, E>, T>;
2332
+ _unsafeUnwrap(_?: ErrorConfig): T;
2333
+ _unsafeUnwrapErr(config?: ErrorConfig): E;
2334
+ [Symbol.iterator](): Generator<Err<never, E>, T>;
2335
+ }
2336
+ declare class Err<T, E> implements IResult<T, E> {
2337
+ readonly error: E;
2338
+ constructor(error: E);
2339
+ isOk(): this is Ok<T, E>;
2340
+ isErr(): this is Err<T, E>;
2341
+ map<A>(_f: (t: T) => A): Result<A, E>;
2342
+ mapErr<U>(f: (e: E) => U): Result<T, U>;
2343
+ andThrough<F>(_f: (t: T) => Result<unknown, F>): Result<T, E | F>;
2344
+ andTee(_f: (t: T) => unknown): Result<T, E>;
2345
+ orTee(f: (t: E) => unknown): Result<T, E>;
2346
+ andThen<R extends Result<unknown, unknown>>(_f: (t: T) => R): Result<InferOkTypes<R>, InferErrTypes<R> | E>;
2347
+ andThen<U, F>(_f: (t: T) => Result<U, F>): Result<U, E | F>;
2348
+ orElse<R extends Result<unknown, unknown>>(f: (e: E) => R): Result<InferOkTypes<R> | T, InferErrTypes<R>>;
2349
+ orElse<U, A>(f: (e: E) => Result<U, A>): Result<U | T, A>;
2350
+ asyncAndThen<U, F>(_f: (t: T) => ResultAsync<U, F>): ResultAsync<U, E | F>;
2351
+ asyncAndThrough<F>(_f: (t: T) => ResultAsync<unknown, F>): ResultAsync<T, E | F>;
2352
+ asyncMap<U>(_f: (t: T) => Promise<U>): ResultAsync<U, E>;
2353
+ unwrapOr<A>(v: A): T | A;
2354
+ match<A, B = A>(_ok: (t: T) => A, err: (e: E) => B): A | B;
2355
+ safeUnwrap(): Generator<Err<never, E>, T>;
2356
+ _unsafeUnwrap(config?: ErrorConfig): T;
2357
+ _unsafeUnwrapErr(_?: ErrorConfig): E;
2358
+ [Symbol.iterator](): Generator<Err<never, E>, T>;
2359
+ }
2360
+ declare type Prev = [never, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, ...0[]];
2361
+ declare type CollectResults<T, Collected extends unknown[] = [], Depth extends number = 50> = [Depth] extends [never] ? [] : T extends [infer H, ...infer Rest] ? H extends Result<infer L, infer R> ? CollectResults<Rest, [...Collected, [L, R]], Prev[Depth]> : never : Collected;
2362
+ declare type Transpose<A, Transposed extends unknown[][] = [], Depth extends number = 10> = A extends [infer T, ...infer Rest] ? T extends [infer L, infer R] ? Transposed extends [infer PL, infer PR] ? PL extends unknown[] ? PR extends unknown[] ? Transpose<Rest, [[...PL, L], [...PR, R]], Prev[Depth]> : never : never : Transpose<Rest, [[L], [R]], Prev[Depth]> : Transposed : Transposed;
2363
+ declare type Combine<T, Depth extends number = 5> = Transpose<CollectResults<T>, [], Depth> extends [infer L, infer R] ? [UnknownMembersToNever<L>, UnknownMembersToNever<R>] : Transpose<CollectResults<T>, [], Depth> extends [] ? [[], []] : never;
2364
+ declare type Dedup<T> = T extends Result<infer RL, infer RR> ? [unknown] extends [RL] ? Err<RL, RR> : Ok<RL, RR> : T;
2365
+ declare type MemberListOf<T> = ((T extends unknown ? (t: T) => T : never) extends infer U ? (U extends unknown ? (u: U) => unknown : never) extends ((v: infer V) => unknown) ? V : never : never) extends ((_: unknown) => infer W) ? [...MemberListOf<Exclude<T, W>>, W] : [];
2366
+ declare type EmptyArrayToNever<T, NeverArrayToNever extends number = 0> = T extends [] ? never : NeverArrayToNever extends 1 ? T extends [never, ...infer Rest] ? [EmptyArrayToNever<Rest>] extends [never] ? never : T : T : T;
2367
+ declare type UnknownMembersToNever<T> = T extends [infer H, ...infer R] ? [[unknown] extends [H] ? never : H, ...UnknownMembersToNever<R>] : T;
2368
+ declare type MembersToUnion<T> = T extends unknown[] ? T[number] : never;
2369
+ declare type IsLiteralArray<T> = T extends {
2370
+ length: infer L;
2371
+ } ? L extends number ? number extends L ? 0 : 1 : 0 : 0;
2372
+ declare type Traverse<T, Depth extends number = 5> = Combine<T, Depth> extends [infer Oks, infer Errs] ? Result<EmptyArrayToNever<Oks, 1>, MembersToUnion<Errs>> : never;
2373
+ declare type TraverseWithAllErrors<T, Depth extends number = 5> = Traverse<T, Depth> extends Result<infer Oks, infer Errs> ? Result<Oks, Errs[]> : never;
2374
+ declare type CombineResults<T extends readonly Result<unknown, unknown>[]> = IsLiteralArray<T> extends 1 ? Traverse<T> : Result<ExtractOkTypes<T>, ExtractErrTypes<T>[number]>;
2375
+ declare type CombineResultsWithAllErrorsArray<T extends readonly Result<unknown, unknown>[]> = IsLiteralArray<T> extends 1 ? TraverseWithAllErrors<T> : Result<ExtractOkTypes<T>, ExtractErrTypes<T>[number][]>;
2376
+ //#endregion
2377
+ //#region src/services/error/getResult.d.ts
2378
+ declare const getResult: <T>(fn: () => T) => Result<T, Error>;
2379
+ //#endregion
2380
+ //#region src/services/error/getResultAsync.d.ts
2381
+ declare const getResultAsync: <T>(fn: () => Promise<T>) => ResultAsync<T, Error>;
2382
+ //#endregion
2383
+ //#region src/services/error/toAppError.d.ts
2384
+ declare const toAppError: (error: unknown) => Error;
2385
+ //#endregion
2386
+ //#region src/services/error/withFinalizer.d.ts
2387
+ declare const withFinalizer: <T>(fn: () => T, finalizer?: () => void) => T;
2388
+ //#endregion
2389
+ //#region src/services/error/withFinalizerAsync.d.ts
2390
+ declare const withFinalizerAsync: <T>(fn: () => Promisable<T>, finalizer?: () => Promisable<void>) => Promise<T>;
2391
+ //#endregion
2022
2392
  //#region src/services/message/constants.d.ts
2023
2393
  declare const MENTION_ID_ATTRIBUTE = "data-id";
2024
2394
  declare const MENTION_LABEL_ATTRIBUTE = "data-label";
@@ -2347,6 +2717,9 @@ declare const takeOne: TakeOne;
2347
2717
  //#region src/util/environment/getIsServer.d.ts
2348
2718
  declare const getIsServer: () => boolean;
2349
2719
  //#endregion
2720
+ //#region src/util/function/noop.d.ts
2721
+ declare const noop: () => void;
2722
+ //#endregion
2350
2723
  //#region src/util/id/constants.d.ts
2351
2724
  declare const ID_SEPARATOR = "|";
2352
2725
  //#endregion
@@ -2377,6 +2750,9 @@ declare const escapeRegExp: (string: string) => string;
2377
2750
  //#region src/util/text/capitalize.d.ts
2378
2751
  declare const capitalize: (string: string) => string;
2379
2752
  //#endregion
2753
+ //#region src/util/text/normalizeString.d.ts
2754
+ declare const normalizeString: (value: null | string | undefined) => string;
2755
+ //#endregion
2380
2756
  //#region src/util/text/streamToText.d.ts
2381
2757
  declare const streamToText: (readable: NodeJS.ReadableStream) => Promise<string>;
2382
2758
  //#endregion
@@ -2435,4 +2811,4 @@ declare const UUIDV4_REGEX: RegExp;
2435
2811
  //#region src/util/id/uuid/uuidValidateV4.d.ts
2436
2812
  declare const uuidValidateV4: (uuid: string) => boolean;
2437
2813
  //#endregion
2438
- export { AllSpecialValues, BuildTuple, DeepOmit, DeepOptionalUndefined, ExcludeFunctionProperties, ForbiddenError, FunctionProperties, GetPaths, GetProperties, ID_SEPARATOR, InvalidOperationError, ItemEntityType, ItemEntityTypePropertyNames, ItemMetadata, ItemMetadataPropertyNames, MENTION_EVERYONE_ID, MENTION_HERE_ID, MENTION_ID_ATTRIBUTE, MENTION_LABEL_ATTRIBUTE, MENTION_TYPE, MENTION_TYPE_ATTRIBUTE, MapValue, MergeObjectsStrict, NIL, NotFoundError, NotInitializedError, Operation, PropertyNames, RoutePath, SITE_NAME, SURVEY_DISPLAY_NAME, Serializable, SkipFirst, TakeFirst, TakeOne, ToData, TupleSlice, TupleSplit, TupleSplitHead, TupleSplitTail, UUIDV4_REGEX, WithMetadata, applyItemMetadataMixin, capitalize, createItemEntityTypeSchema, css, escapeRegExp, exhaustiveGuard, getIsServer, getMentions, getPropertyNames, getRawData, hrtime, html, isPlainObject, itemMetadataSchema, jsonDateParse, mergeObjectsStrict, now, streamToText, takeOne, toKebabCase, toRawDeep, truncate, uncapitalize, uuidValidateV4 };
2814
+ export { AllSpecialValues, BuildTuple, DeepOmit, DeepOptionalUndefined, ExcludeFunctionProperties, ForbiddenError, FunctionProperties, GetArrayProps, GetObjectProps, GetPaths, GetPrimitiveProps, GetProperties, ID_SEPARATOR, InvalidOperationError, ItemEntityType, ItemEntityTypePropertyNames, ItemMetadata, ItemMetadataPropertyNames, KnownKeys, MENTION_EVERYONE_ID, MENTION_HERE_ID, MENTION_ID_ATTRIBUTE, MENTION_LABEL_ATTRIBUTE, MENTION_TYPE, MENTION_TYPE_ATTRIBUTE, MapValue, MergeObjectsStrict, NIL, NotFoundError, NotInitializedError, Operation, PropertyNames, RoutePath, SITE_NAME, SURVEY_DISPLAY_NAME, Serializable, SkipFirst, TakeFirst, TakeOne, ToData, TupleSlice, TupleSplit, TupleSplitHead, TupleSplitTail, UUIDV4_REGEX, WithMetadata, applyItemMetadataMixin, capitalize, createItemEntityTypeSchema, css, escapeRegExp, exhaustiveGuard, getIsServer, getMentions, getPropertyNames, getRawData, getResult, getResultAsync, hrtime, html, isPlainObject, itemMetadataSchema, jsonDateParse, mergeObjectsStrict, noop, normalizeString, now, streamToText, takeOne, toAppError, toKebabCase, toRawDeep, truncate, uncapitalize, uuidValidateV4, withFinalizer, withFinalizerAsync };