@esposter/shared 2.34.2 → 2.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -37,16 +37,11 @@ declare const RoutePath: {
37
37
  readonly About: "/about";
38
38
  readonly Achievements: "/achievements";
39
39
  readonly Anime: "/anime";
40
- readonly Calendar: "/calendar";
41
40
  readonly Calls: (id: string) => string;
42
41
  readonly CallsIndex: "/calls";
43
42
  readonly Clicker: "/clicker";
44
- readonly Dashboard: "/dashboard";
45
- readonly DashboardEditor: "/dashboard/editor";
46
43
  readonly Docs: "/docs";
47
44
  readonly Dungeons: "/dungeons";
48
- readonly EmailEditor: "/email-editor";
49
- readonly FlowchartEditor: "/flowchart-editor";
50
45
  readonly FluidSimulator: "/fluid-simulator";
51
46
  readonly Github: "https://github.com/Esposter/Esposter";
52
47
  readonly Index: "/";
@@ -61,22 +56,24 @@ declare const RoutePath: {
61
56
  readonly PostCreate: "/post/create";
62
57
  readonly PostUpdate: (id: string) => string;
63
58
  readonly PrivacyPolicy: "/privacy-policy";
64
- readonly Survey: (id: string) => string;
65
- readonly Surveyer: "/surveyer";
66
- readonly TableEditor: "/table-editor";
59
+ readonly Resource: (id: string) => string;
60
+ readonly Resources: "/resources";
61
+ readonly ResourcesAll: "/resources/all";
62
+ readonly ResourcesCreate: "/resources/create";
63
+ readonly ResourcesCreateType: (type: string) => string;
67
64
  readonly UserSettings: "/user/settings";
68
- readonly WebpageEditor: "/webpage-editor";
65
+ readonly View: (type: string, id: string) => string;
69
66
  };
70
67
  type RoutePath = typeof RoutePath;
71
68
  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) | {
72
69
  path: R extends true ? "length" : `${P}.length`;
73
70
  value: T["length"];
74
71
  };
75
- type KnownKeys<T> = { [K in keyof T as string extends K ? never : number extends K ? never : K]: T[K] };
72
+ type KnownKeys<T> = { [K in keyof T as string extends K ? never : number extends K ? never : K]: T[K]; };
76
73
  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) | {
77
74
  path: R extends true ? `${K}` : `${P}.${K}`;
78
75
  value: T[K];
79
- } }[keyof KnownKeys<T> & (number | string)];
76
+ }; }[keyof KnownKeys<T> & (number | string)];
80
77
  type GetPrimitiveProps<T, P extends string, D extends unknown[], R extends boolean> = T extends string ? {
81
78
  path: R extends true ? "length" : `${P}.length`;
82
79
  value: number;
@@ -84,11 +81,11 @@ type GetPrimitiveProps<T, P extends string, D extends unknown[], R extends boole
84
81
  path: R extends true ? "description" : `${P}.description`;
85
82
  value: string | undefined;
86
83
  } : never;
87
- 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;
88
- type GetPaths<T> = GetProperties<T> extends infer U ? (U extends {
84
+ 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;
85
+ type GetPaths<T> = GetProperties<T> extends (infer U) ? (U extends {
89
86
  path: infer Path;
90
87
  } ? Path : never) : never;
91
- type PropertyNames<T> = { [P in GetPaths<T>]: P };
88
+ type PropertyNames<T> = { [P in GetPaths<T>]: P; };
92
89
  interface ItemEntityType<T extends string> {
93
90
  type: T;
94
91
  }
@@ -233,8 +230,8 @@ const update2: UpdateOperation<User> = {
233
230
  @category Utilities
234
231
  */
235
232
  type OptionalKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
236
- ? (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`
237
- : never;
233
+ ? (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`
234
+ : never; // Should never happen
238
235
  /**
239
236
  Extract all required keys from the given type.
240
237
 
@@ -266,7 +263,7 @@ const validator3 = createValidation<User>('luckyNumber', value => value > 0);
266
263
  @category Utilities
267
264
  */
268
265
  type RequiredKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
269
- ? Exclude<keyof Type, OptionalKeysOf<Type>> : never;
266
+ ? Exclude<keyof Type, OptionalKeysOf<Type>> : never; // Should never happen
270
267
  /**
271
268
  Returns a boolean for whether the given type is `never`.
272
269
 
@@ -540,20 +537,21 @@ type CollapseRestElement<TArray extends UnknownArray> = IfNotAnyOrNever<TArray,
540
537
  ifNot: _CollapseRestElement<TArray>;
541
538
  }>;
542
539
  type _CollapseRestElement<TArray extends UnknownArray, ForwardAccumulator extends UnknownArray = [], BackwardAccumulator extends UnknownArray = []> = TArray extends UnknownArray // For distributing `TArray`
543
- ? keyof TArray & `${number}` extends never // Enters this branch, if `TArray` is empty (e.g., []),
540
+ ? keyof TArray & `${number}` extends never ?
541
+ // Enters this branch, if `TArray` is empty (e.g., []),
544
542
  // or `TArray` contains no non-rest elements preceding the rest element (e.g., `[...string[]]` or `[...string[], string]`).
545
- ? TArray extends readonly [...infer Rest, infer Last] ? _CollapseRestElement<Rest, ForwardAccumulator, [Last, ...BackwardAccumulator]> // Accumulate elements that are present after the rest element.
546
- : TArray extends readonly [] ? [...ForwardAccumulator, ...BackwardAccumulator] : [...ForwardAccumulator, TArray[number], ...BackwardAccumulator] // Add the rest element between the accumulated elements.
547
- : TArray extends readonly [(infer First)?, ...infer Rest] ? _CollapseRestElement<Rest, [...ForwardAccumulator, '0' extends OptionalKeysOf<TArray> ? If<IsExactOptionalPropertyTypesEnabled, First, First | undefined> // Add `| undefined` for optional elements, if `exactOptionalPropertyTypes` is disabled.
548
- : First], BackwardAccumulator> : never // Should never happen, since `[(infer First)?, ...infer Rest]` is a top-type for arrays.
549
- : never; // Should never happen
550
- type Whitespace = '\u{9}' // '\t'
551
- | '\u{A}' // '\n'
552
- | '\u{B}' // '\v'
553
- | '\u{C}' // '\f'
554
- | '\u{D}' // '\r'
555
- | '\u{20}' // ' '
556
- | '\u{85}' | '\u{A0}' | '\u{1680}' | '\u{2000}' | '\u{2001}' | '\u{2002}' | '\u{2003}' | '\u{2004}' | '\u{2005}' | '\u{2006}' | '\u{2007}' | '\u{2008}' | '\u{2009}' | '\u{200A}' | '\u{2028}
' | '\u{2029}
' | '\u{202F}' | '\u{205F}' | '\u{3000}' | '\u{FEFF}';
543
+ TArray extends readonly [...infer Rest, infer Last] ? _CollapseRestElement<Rest, ForwardAccumulator, [Last, ...BackwardAccumulator]> // Accumulate elements that are present after the rest element.
544
+ : TArray extends readonly [] ? [...ForwardAccumulator, ...BackwardAccumulator] : [...ForwardAccumulator, TArray[number], ...BackwardAccumulator] // Add the rest element between the accumulated elements.
545
+ : TArray extends readonly [(infer First)?, ...infer Rest] ? _CollapseRestElement<Rest, [...ForwardAccumulator, '0' extends OptionalKeysOf<TArray> ? If<IsExactOptionalPropertyTypesEnabled, First, First | undefined> // Add `| undefined` for optional elements, if `exactOptionalPropertyTypes` is disabled.
546
+ : First], BackwardAccumulator> : never // Should never happen, since `[(infer First)?, ...infer Rest]` is a top-type for arrays.
547
+ : never; // Should never happen
548
+ type Whitespace = '\t' // '\t'
549
+ | '\n' // '\n'
550
+ | '\v' // '\v'
551
+ | '\f' // '\f'
552
+ | '\r' // '\r'
553
+ | ' ' // ' '
554
+ | '…' | ' ' | ' ' | ' ' | ' ' | ' ' | ' ' | ' ' | ' ' | ' ' | ' ' | ' ' | ' ' | ' ' | '
' | '
' | ' ' | ' ' | ' ' | '';
557
555
  type WordSeparators = '-' | '_' | Whitespace;
558
556
  type AsciiPunctuation = '!' | '"' | '#' | '$' | '%' | '&' | '\'' | '(' | ')' | '*' | '+' | ',' | '-' | '.' | '/' | ':' | ';' | '<' | '=' | '>' | '?' | '@' | '[' | '\\' | ']' | '^' | '_' | '`' | '{' | '|' | '}' | '~';
559
557
  declare const tag: unique symbol;
@@ -561,7 +559,7 @@ declare const tag: unique symbol;
561
559
  type TagContainer<Token> = {
562
560
  readonly [tag]: Token;
563
561
  };
564
- type Tag<Token extends PropertyKey, TagMetadata> = TagContainer<{ [K in Token]: TagMetadata }>;
562
+ type Tag<Token extends PropertyKey, TagMetadata> = TagContainer<{ [K in Token]: TagMetadata; }>;
565
563
  /**
566
564
  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).
567
565
 
@@ -652,81 +650,7 @@ type WontWork = UnwrapTagged<string>;
652
650
  @category Type
653
651
  */
654
652
  type UnwrapTagged<TaggedType extends Tag<PropertyKey, any>> = RemoveAllTags<TaggedType>;
655
- type RemoveAllTags<T> = T extends Tag<PropertyKey, any> ? { [ThisTag in keyof T[typeof tag]]: T extends Tagged<infer Type, ThisTag, T[typeof tag][ThisTag]> ? RemoveAllTags<Type> : never }[keyof T[typeof tag]] : T;
656
- /**
657
- Note: The `Opaque` type is deprecated in favor of `Tagged`.
658
-
659
- Attach a "tag" to an arbitrary type. This allows you to create distinct types, that aren't assignable to one another, for runtime values that would otherwise have the same type. (See examples.)
660
-
661
- The generic type parameters can be anything.
662
-
663
- Note that `Opaque` is somewhat of a misnomer here, in that, unlike [some alternative implementations](https://github.com/microsoft/TypeScript/issues/4895#issuecomment-425132582), the original, untagged type is not actually hidden. (E.g., functions that accept the untagged type can still be called with the "opaque" version -- but not vice-versa.)
664
-
665
- Also note that this implementation is limited to a single tag. If you want to allow multiple tags, use `Tagged` instead.
666
-
667
- [Read more about tagged types.](https://medium.com/@KevinBGreene/surviving-the-typescript-ecosystem-branding-and-type-tagging-6cf6e516523d)
668
-
669
- There have been several discussions about adding similar features to TypeScript. Unfortunately, nothing has (yet) moved forward:
670
- - [Microsoft/TypeScript#202](https://github.com/microsoft/TypeScript/issues/202)
671
- - [Microsoft/TypeScript#15408](https://github.com/Microsoft/TypeScript/issues/15408)
672
- - [Microsoft/TypeScript#15807](https://github.com/Microsoft/TypeScript/issues/15807)
673
-
674
- @example
675
- ```
676
- import type {Opaque} from 'type-fest';
677
-
678
- type AccountNumber = Opaque<number, 'AccountNumber'>;
679
- type AccountBalance = Opaque<number, 'AccountBalance'>;
680
-
681
- // The `Token` parameter allows the compiler to differentiate between types, whereas "unknown" will not. For example, consider the following structures:
682
- type ThingOne = Opaque<string>;
683
- type ThingTwo = Opaque<string>;
684
-
685
- // To the compiler, these types are allowed to be cast to each other as they have the same underlying type. They are both `string & { __opaque__: unknown }`.
686
- // To avoid this behaviour, you would instead pass the "Token" parameter, like so.
687
- type NewThingOne = Opaque<string, 'ThingOne'>;
688
- type NewThingTwo = Opaque<string, 'ThingTwo'>;
689
-
690
- // Now they're completely separate types, so the following will fail to compile.
691
- function createNewThingOne(): NewThingOne {
692
- // As you can see, casting from a string is still allowed. However, you may not cast NewThingOne to NewThingTwo, and vice versa.
693
- return 'new thing one' as NewThingOne;
694
- }
695
-
696
- // This will fail to compile, as they are fundamentally different types.
697
- // @ts-expect-error
698
- const thingTwo = createNewThingOne() as NewThingTwo;
699
-
700
- // Here's another example of opaque typing.
701
- function createAccountNumber(): AccountNumber {
702
- return 2 as AccountNumber;
703
- }
704
-
705
- declare function getMoneyForAccount(accountNumber: AccountNumber): AccountBalance;
706
-
707
- // This will compile successfully.
708
- getMoneyForAccount(createAccountNumber());
709
-
710
- // But this won't, because it has to be explicitly passed as an `AccountNumber` type.
711
- // @ts-expect-error
712
- getMoneyForAccount(2);
713
-
714
- // You can use opaque values like they aren't opaque too.
715
- const accountNumber = createAccountNumber();
716
-
717
- // This will compile successfully.
718
- const newAccountNumber = accountNumber + 2;
719
-
720
- // As a side note, you can (and should) use recursive types for your opaque types to make them stronger and hopefully easier to type.
721
- type Person = {
722
- id: Opaque<number, Person>;
723
- name: string;
724
- };
725
- ```
726
-
727
- @category Type
728
- @deprecated Use {@link Tagged} instead
729
- */
653
+ type RemoveAllTags<T> = T extends Tag<PropertyKey, any> ? { [ThisTag in keyof T[typeof tag]]: T extends Tagged<infer Type, ThisTag, T[typeof tag][ThisTag]> ? RemoveAllTags<Type> : never; }[keyof T[typeof tag]] : T;
730
654
  /**
731
655
  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).
732
656
 
@@ -788,7 +712,8 @@ type IsStringLiteral<S> = IfNotAnyOrNever<S, {
788
712
  ifAny: false;
789
713
  ifNever: false;
790
714
  }>;
791
- type _IsStringLiteral<S> = // If `T` is an infinite string type (e.g., `on${string}`), `Record<T, never>` produces an index signature,
715
+ type _IsStringLiteral<S> =
716
+ // If `T` is an infinite string type (e.g., `on${string}`), `Record<T, never>` produces an index signature,
792
717
  // and since `{}` extends index signatures, the result becomes `false`.
793
718
  S extends string ? {} extends Record<S, never> ? false : true : false;
794
719
  /**
@@ -872,7 +797,7 @@ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface`
872
797
  @see {@link SimplifyDeep}
873
798
  @category Object
874
799
  */
875
- type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};
800
+ type Simplify<T> = { [KeyType in keyof T]: T[KeyType]; } & {};
876
801
  /**
877
802
  Returns a boolean for whether the two given types are equal.
878
803
 
@@ -993,7 +918,7 @@ type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
993
918
  @see {@link PickIndexSignature}
994
919
  @category Object
995
920
  */
996
- type OmitIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType] };
921
+ type OmitIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType]; };
997
922
  /**
998
923
  Pick only index signatures from the given object type, leaving out all explicitly defined properties.
999
924
 
@@ -1039,9 +964,9 @@ type ExampleIndexSignature = PickIndexSignature<Example>;
1039
964
  @see {@link OmitIndexSignature}
1040
965
  @category Object
1041
966
  */
1042
- type PickIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? KeyType : never]: ObjectType[KeyType] };
967
+ type PickIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? KeyType : never]: ObjectType[KeyType]; };
1043
968
  // Merges two objects without worrying about index signatures.
1044
- type SimpleMerge<Destination, Source> = Simplify<{ [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key] } & Source>;
969
+ type SimpleMerge<Destination, Source> = Simplify<{ [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key]; } & Source>;
1045
970
  /**
1046
971
  Merge two types into a new type. Keys of the second type overrides keys of the first type.
1047
972
 
@@ -1105,10 +1030,9 @@ Note: If you want a merge type that more accurately reflects the runtime behavio
1105
1030
  @category Object
1106
1031
  */
1107
1032
  type Merge<Destination, Source> = Destination extends unknown // For distributing `Destination`
1108
- ? Source extends unknown // For distributing `Source`
1109
- ? If<IsEqual<Destination, Source>, Destination, _Merge<Destination, Source>> : never // Should never happen
1110
- : never;
1111
- // Should never happen
1033
+ ? Source extends unknown // For distributing `Source`
1034
+ ? If<IsEqual<Destination, Source>, Destination, _Merge<Destination, Source>> : never // Should never happen
1035
+ : never; // Should never happen
1112
1036
  type _Merge<Destination, Source> = Simplify<SimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>> & SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>>;
1113
1037
  /**
1114
1038
  Merges user specified options with default options.
@@ -1162,9 +1086,9 @@ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOp
1162
1086
  // Types of property 'leavesOnly' are incompatible. Type 'string' is not assignable to type 'boolean'.
1163
1087
  ```
1164
1088
  */
1165
- type ApplyDefaultOptions<Options extends object, Defaults extends Simplify<Omit<Required<Options>, RequiredKeysOf<Options>> & Partial<Record<RequiredKeysOf<Options>, never>>>, SpecifiedOptions extends Options> = _ApplyDefaultOptions<Options, Defaults, SpecifiedOptions> extends infer Result extends Required<Options> // `extends Required<Options>` ensures that `ApplyDefaultOptions<SomeOption, ...>` is always assignable to `Required<SomeOption>`
1166
- ? Result : never;
1167
- type _ApplyDefaultOptions<Options, Defaults, SpecifiedOptions> = If<IsAny<SpecifiedOptions>, Defaults, If<IsNever<SpecifiedOptions>, Defaults, Merge<Defaults, { [Key in keyof SpecifiedOptions as undefined extends Required<Options>[Key & keyof Options] ? Key : undefined extends SpecifiedOptions[Key] ? never : Key]: SpecifiedOptions[Key] }>>>;
1089
+ type ApplyDefaultOptions<Options extends object, Defaults extends Simplify<Omit<Required<Options>, RequiredKeysOf<Options>> & Partial<Record<RequiredKeysOf<Options>, never>>>, SpecifiedOptions extends Options> = _ApplyDefaultOptions<Options, Defaults, SpecifiedOptions> extends (infer Result extends Required<Options> // `extends Required<Options>` ensures that `ApplyDefaultOptions<SomeOption, ...>` is always assignable to `Required<SomeOption>`
1090
+ ) ? Result : never;
1091
+ type _ApplyDefaultOptions<Options, Defaults, SpecifiedOptions> = If<IsAny<SpecifiedOptions>, Defaults, If<IsNever<SpecifiedOptions>, Defaults, Merge<Defaults, { [Key in keyof SpecifiedOptions as undefined extends Required<Options>[Key & keyof Options] ? Key : undefined extends SpecifiedOptions[Key] ? never : Key]: SpecifiedOptions[Key]; }>>>;
1168
1092
  /**
1169
1093
  Collapses literal types in a union into their corresponding primitive types, when possible. For example, `CollapseLiterals<'foo' | 'bar' | (string & {})>` returns `string`.
1170
1094
 
@@ -1192,33 +1116,42 @@ type E = CollapseLiterals<LiteralUnion<'foo' | 'bar', string> | null | undefined
1192
1116
  //=> string | null | undefined
1193
1117
  ```
1194
1118
  */
1195
- type CollapseLiterals<T> = {} extends T ? T : T extends infer U & {} ? U : T;
1119
+ type CollapseLiterals<T> = {} extends T ? T : T extends (infer U) & {} ? U : T;
1196
1120
  /**
1197
1121
  @see {@link SomeExtend}
1198
1122
  */
1199
1123
  type SomeExtendOptions = {
1200
1124
  /**
1201
- Consider `never` elements to match the target type only if the target type itself is `never` (or `any`).
1202
- - When set to `true` (default), `never` is _not_ treated as a bottom type, instead, it is treated as a type that matches only itself (or `any`).
1203
- - When set to `false`, `never` is treated as a bottom type, and behaves as it normally would.
1204
- @default true
1205
- @example
1206
- ```
1207
- import type {SomeExtend} from 'type-fest';
1208
- type A = SomeExtend<[1, 2, never], string, {strictNever: true}>;
1209
- //=> false
1210
- type B = SomeExtend<[1, 2, never], string, {strictNever: false}>;
1211
- //=> true
1212
- type C = SomeExtend<[1, never], never, {strictNever: true}>;
1213
- //=> true
1214
- type D = SomeExtend<[1, never], never, {strictNever: false}>;
1215
- //=> true
1216
- type E = SomeExtend<[never], any, {strictNever: true}>;
1217
- //=> true
1218
- type F = SomeExtend<[never], any, {strictNever: false}>;
1219
- //=> true
1220
- ```
1221
- */
1125
+ Consider `never` elements to match the target type only if the target type itself is `never` (or `any`).
1126
+
1127
+ - When set to `true` (default), `never` is _not_ treated as a bottom type, instead, it is treated as a type that matches only itself (or `any`).
1128
+ - When set to `false`, `never` is treated as a bottom type, and behaves as it normally would.
1129
+
1130
+ @default true
1131
+
1132
+ @example
1133
+ ```
1134
+ import type {SomeExtend} from 'type-fest';
1135
+
1136
+ type A = SomeExtend<[1, 2, never], string, {strictNever: true}>;
1137
+ //=> false
1138
+
1139
+ type B = SomeExtend<[1, 2, never], string, {strictNever: false}>;
1140
+ //=> true
1141
+
1142
+ type C = SomeExtend<[1, never], never, {strictNever: true}>;
1143
+ //=> true
1144
+
1145
+ type D = SomeExtend<[1, never], never, {strictNever: false}>;
1146
+ //=> true
1147
+
1148
+ type E = SomeExtend<[never], any, {strictNever: true}>;
1149
+ //=> true
1150
+
1151
+ type F = SomeExtend<[never], any, {strictNever: false}>;
1152
+ //=> true
1153
+ ```
1154
+ */
1222
1155
  strictNever?: boolean;
1223
1156
  };
1224
1157
  type DefaultSomeExtendOptions = {
@@ -1272,8 +1205,9 @@ type B = SomeExtend<[1?, 2?, '3'?], string | undefined>;
1272
1205
  */
1273
1206
  type SomeExtend<TArray extends UnknownArray, Type, Options extends SomeExtendOptions = {}> = _SomeExtend<CollapseRestElement<TArray>, Type, ApplyDefaultOptions<SomeExtendOptions, DefaultSomeExtendOptions, Options>>;
1274
1207
  type _SomeExtend<TArray extends UnknownArray, Type, Options extends Required<SomeExtendOptions>> = IfNotAnyOrNever<TArray, {
1275
- ifNot: 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`.
1276
- ? true : _SomeExtend<Rest, Type, Options> : First extends Type ? true : _SomeExtend<Rest, Type, Options> : false;
1208
+ ifNot: TArray extends readonly [infer First, ...infer Rest] ? IsNever<First> extends true ? Or<Or<IsNever<Type>, IsAny<Type>>, Not<Options['strictNever']>> extends true ?
1209
+ // If target `Type` is also `never`, or is `any`, or `strictNever` is disabled, return `true`.
1210
+ true : _SomeExtend<Rest, Type, Options> : First extends Type ? true : _SomeExtend<Rest, Type, Options> : false;
1277
1211
  ifAny: false;
1278
1212
  ifNever: false;
1279
1213
  }>;
@@ -1457,31 +1391,42 @@ type IsNumeric<T extends string> = T extends `${number}` ? Trim<T> extends T ? t
1457
1391
  */
1458
1392
  type AllExtendOptions = {
1459
1393
  /**
1460
- Consider `never` elements to match the target type only if the target type itself is `never` (or `any`).
1461
- - When set to `true` (default), `never` is _not_ treated as a bottom type, instead, it is treated as a type that matches only itself (or `any`).
1462
- - When set to `false`, `never` is treated as a bottom type, and behaves as it normally would.
1463
- @default true
1464
- @example
1465
- ```
1466
- import type {AllExtend} from 'type-fest';
1467
- type A = AllExtend<[1, 2, never], number, {strictNever: true}>;
1468
- //=> false
1469
- type B = AllExtend<[1, 2, never], number, {strictNever: false}>;
1470
- //=> true
1471
- type C = AllExtend<[never, never], never, {strictNever: true}>;
1472
- //=> true
1473
- type D = AllExtend<[never, never], never, {strictNever: false}>;
1474
- //=> true
1475
- type E = AllExtend<['a', 'b', never], any, {strictNever: true}>;
1476
- //=> true
1477
- type F = AllExtend<['a', 'b', never], any, {strictNever: false}>;
1478
- //=> true
1479
- type G = AllExtend<[never, 1], never, {strictNever: true}>;
1480
- //=> false
1481
- type H = AllExtend<[never, 1], never, {strictNever: false}>;
1482
- //=> false
1483
- ```
1484
- */
1394
+ Consider `never` elements to match the target type only if the target type itself is `never` (or `any`).
1395
+
1396
+ - When set to `true` (default), `never` is _not_ treated as a bottom type, instead, it is treated as a type that matches only itself (or `any`).
1397
+ - When set to `false`, `never` is treated as a bottom type, and behaves as it normally would.
1398
+
1399
+ @default true
1400
+
1401
+ @example
1402
+ ```
1403
+ import type {AllExtend} from 'type-fest';
1404
+
1405
+ type A = AllExtend<[1, 2, never], number, {strictNever: true}>;
1406
+ //=> false
1407
+
1408
+ type B = AllExtend<[1, 2, never], number, {strictNever: false}>;
1409
+ //=> true
1410
+
1411
+ type C = AllExtend<[never, never], never, {strictNever: true}>;
1412
+ //=> true
1413
+
1414
+ type D = AllExtend<[never, never], never, {strictNever: false}>;
1415
+ //=> true
1416
+
1417
+ type E = AllExtend<['a', 'b', never], any, {strictNever: true}>;
1418
+ //=> true
1419
+
1420
+ type F = AllExtend<['a', 'b', never], any, {strictNever: false}>;
1421
+ //=> true
1422
+
1423
+ type G = AllExtend<[never, 1], never, {strictNever: true}>;
1424
+ //=> false
1425
+
1426
+ type H = AllExtend<[never, 1], never, {strictNever: false}>;
1427
+ //=> false
1428
+ ```
1429
+ */
1485
1430
  strictNever?: boolean;
1486
1431
  };
1487
1432
  type DefaultAllExtendOptions = {
@@ -1535,8 +1480,9 @@ type B = AllExtend<[1?, 2?, 3?], number | undefined>;
1535
1480
  */
1536
1481
  type AllExtend<TArray extends UnknownArray, Type, Options extends AllExtendOptions = {}> = _AllExtend<CollapseRestElement<TArray>, Type, ApplyDefaultOptions<AllExtendOptions, DefaultAllExtendOptions, Options>>;
1537
1482
  type _AllExtend<TArray extends UnknownArray, Type, Options extends Required<AllExtendOptions>> = IfNotAnyOrNever<TArray, {
1538
- ifNot: 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.
1539
- ? _AllExtend<Rest, Type, Options> : false : First extends Type ? _AllExtend<Rest, Type, Options> : false : true;
1483
+ ifNot: TArray extends readonly [infer First, ...infer Rest] ? IsNever<First> extends true ? Or<Or<IsNever<Type>, IsAny<Type>>, Not<Options['strictNever']>> extends true ?
1484
+ // If target `Type` is also `never`, or is `any`, or `strictNever` is disabled, recurse further.
1485
+ _AllExtend<Rest, Type, Options> : false : First extends Type ? _AllExtend<Rest, Type, Options> : false : true;
1540
1486
  ifAny: false;
1541
1487
  ifNever: false;
1542
1488
  }>;
@@ -1570,10 +1516,12 @@ type Filtered = Filter<'bar', 'foo'>;
1570
1516
  type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
1571
1517
  type ExceptOptions = {
1572
1518
  /**
1573
- Disallow assigning non-specified properties.
1574
- Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
1575
- @default false
1576
- */
1519
+ Disallow assigning non-specified properties.
1520
+
1521
+ Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
1522
+
1523
+ @default false
1524
+ */
1577
1525
  requireExactProps?: boolean;
1578
1526
  };
1579
1527
  type DefaultExceptOptions = {
@@ -1635,7 +1583,7 @@ type PostPayloadFixed = Except<UserData, 'email'>;
1635
1583
  @category Object
1636
1584
  */
1637
1585
  type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {}> = _Except<ObjectType, KeysType, ApplyDefaultOptions<ExceptOptions, DefaultExceptOptions, Options>>;
1638
- 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>> : {});
1586
+ 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>> : {});
1639
1587
  /**
1640
1588
  Create a type that represents either the value or the value wrapped in `PromiseLike`.
1641
1589
 
@@ -1722,29 +1670,36 @@ Words options.
1722
1670
  */
1723
1671
  type WordsOptions = {
1724
1672
  /**
1725
- Split on numeric sequence.
1726
- @default true
1727
- @example
1728
- ```
1729
- import type {Words} from 'type-fest';
1730
- type Example1 = Words<'p2pNetwork', {splitOnNumbers: true}>;
1731
- //=> ['p', '2', 'p', 'Network']
1732
- type Example2 = Words<'p2pNetwork', {splitOnNumbers: false}>;
1733
- //=> ['p2p', 'Network']
1734
- ```
1735
- */
1673
+ Split on numeric sequence.
1674
+
1675
+ @default true
1676
+
1677
+ @example
1678
+ ```
1679
+ import type {Words} from 'type-fest';
1680
+
1681
+ type Example1 = Words<'p2pNetwork', {splitOnNumbers: true}>;
1682
+ //=> ['p', '2', 'p', 'Network']
1683
+
1684
+ type Example2 = Words<'p2pNetwork', {splitOnNumbers: false}>;
1685
+ //=> ['p2p', 'Network']
1686
+ ```
1687
+ */
1736
1688
  splitOnNumbers?: boolean;
1737
1689
  /**
1738
- Split on {@link AsciiPunctuation | punctuation characters} (e.g., `#`, `&`, `*`, `:`, `?`, `@`, `~`).
1739
- @example
1740
- ```
1741
- import type {Words} from 'type-fest';
1742
- type Example1 = Words<'hello:world', {splitOnPunctuation: true}>;
1743
- //=> ['hello', 'world']
1744
- type Example2 = Words<'hello:world', {splitOnPunctuation: false}>;
1745
- //=> ['hello', ':world']
1746
- ```
1747
- */
1690
+ Split on {@link AsciiPunctuation | punctuation characters} (e.g., `#`, `&`, `*`, `:`, `?`, `@`, `~`).
1691
+
1692
+ @example
1693
+ ```
1694
+ import type {Words} from 'type-fest';
1695
+
1696
+ type Example1 = Words<'hello:world', {splitOnPunctuation: true}>;
1697
+ //=> ['hello', 'world']
1698
+
1699
+ type Example2 = Words<'hello:world', {splitOnPunctuation: false}>;
1700
+ //=> ['hello', ':world']
1701
+ ```
1702
+ */
1748
1703
  splitOnPunctuation?: boolean;
1749
1704
  };
1750
1705
  type _DefaultWordsOptions = {
@@ -1795,19 +1750,31 @@ type Words8 = Words<'hello::world', {splitOnPunctuation: true}>;
1795
1750
  @category Template literal
1796
1751
  */
1797
1752
  type Words<Sentence extends string, Options extends WordsOptions = {}> = WordsImplementation<Sentence, ApplyDefaultOptions<WordsOptions, _DefaultWordsOptions, Options>>;
1798
- 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
1799
- ? [...SkipEmptyWord<CurrentWord>, ...WordsImplementation<RemainingCharacters, Options>] : LastCharacter extends '' // Fist char of word
1800
- ? WordsImplementation<RemainingCharacters, Options, FirstCharacter, FirstCharacter> // Case change: non-numeric to numeric
1801
- : [false, true] extends [IsNumeric<LastCharacter>, IsNumeric<FirstCharacter>] ? Options['splitOnNumbers'] extends true // Split on number: push word
1802
- ? [...SkipEmptyWord<CurrentWord>, ...WordsImplementation<RemainingCharacters, Options, FirstCharacter, FirstCharacter>] // No split on number: concat word
1803
- : WordsImplementation<RemainingCharacters, Options, FirstCharacter, `${CurrentWord}${FirstCharacter}`> // Case change: numeric to non-numeric
1804
- : [true, false] extends [IsNumeric<LastCharacter>, IsNumeric<FirstCharacter>] ? Options['splitOnNumbers'] extends true // Split on number: push word
1805
- ? [...SkipEmptyWord<CurrentWord>, ...WordsImplementation<RemainingCharacters, Options, FirstCharacter, FirstCharacter>] // No split on number: concat word
1806
- : WordsImplementation<RemainingCharacters, Options, FirstCharacter, `${CurrentWord}${FirstCharacter}`> // No case change: concat word
1807
- : [true, true] extends [IsNumeric<LastCharacter>, IsNumeric<FirstCharacter>] ? WordsImplementation<RemainingCharacters, Options, FirstCharacter, `${CurrentWord}${FirstCharacter}`> // Case change: lower to upper, push word
1808
- : [true, true] extends [IsLowercase<LastCharacter>, IsUppercase<FirstCharacter>] ? [...SkipEmptyWord<CurrentWord>, ...WordsImplementation<RemainingCharacters, Options, FirstCharacter, FirstCharacter>] // Case change: upper to lower, brings back the last character, push word
1809
- : [true, true] extends [IsUppercase<LastCharacter>, IsLowercase<FirstCharacter>] ? [...RemoveLastCharacter<CurrentWord, LastCharacter>, ...WordsImplementation<RemainingCharacters, Options, FirstCharacter, `${LastCharacter}${FirstCharacter}`>] // No case change: concat word
1810
- : WordsImplementation<RemainingCharacters, Options, FirstCharacter, `${CurrentWord}${FirstCharacter}`> : [...SkipEmptyWord<CurrentWord>];
1753
+ 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) ?
1754
+ // Skip word separator
1755
+ [...SkipEmptyWord<CurrentWord>, ...WordsImplementation<RemainingCharacters, Options>] : LastCharacter extends '' ?
1756
+ // Fist char of word
1757
+ WordsImplementation<RemainingCharacters, Options, FirstCharacter, FirstCharacter> :
1758
+ // Case change: non-numeric to numeric
1759
+ [false, true] extends [IsNumeric<LastCharacter>, IsNumeric<FirstCharacter>] ? Options['splitOnNumbers'] extends true ?
1760
+ // Split on number: push word
1761
+ [...SkipEmptyWord<CurrentWord>, ...WordsImplementation<RemainingCharacters, Options, FirstCharacter, FirstCharacter>] :
1762
+ // No split on number: concat word
1763
+ WordsImplementation<RemainingCharacters, Options, FirstCharacter, `${CurrentWord}${FirstCharacter}`> :
1764
+ // Case change: numeric to non-numeric
1765
+ [true, false] extends [IsNumeric<LastCharacter>, IsNumeric<FirstCharacter>] ? Options['splitOnNumbers'] extends true ?
1766
+ // Split on number: push word
1767
+ [...SkipEmptyWord<CurrentWord>, ...WordsImplementation<RemainingCharacters, Options, FirstCharacter, FirstCharacter>] :
1768
+ // No split on number: concat word
1769
+ WordsImplementation<RemainingCharacters, Options, FirstCharacter, `${CurrentWord}${FirstCharacter}`> :
1770
+ // No case change: concat word
1771
+ [true, true] extends [IsNumeric<LastCharacter>, IsNumeric<FirstCharacter>] ? WordsImplementation<RemainingCharacters, Options, FirstCharacter, `${CurrentWord}${FirstCharacter}`> :
1772
+ // Case change: lower to upper, push word
1773
+ [true, true] extends [IsLowercase<LastCharacter>, IsUppercase<FirstCharacter>] ? [...SkipEmptyWord<CurrentWord>, ...WordsImplementation<RemainingCharacters, Options, FirstCharacter, FirstCharacter>] :
1774
+ // Case change: upper to lower, brings back the last character, push word
1775
+ [true, true] extends [IsUppercase<LastCharacter>, IsLowercase<FirstCharacter>] ? [...RemoveLastCharacter<CurrentWord, LastCharacter>, ...WordsImplementation<RemainingCharacters, Options, FirstCharacter, `${LastCharacter}${FirstCharacter}`>] :
1776
+ // No case change: concat word
1777
+ WordsImplementation<RemainingCharacters, Options, FirstCharacter, `${CurrentWord}${FirstCharacter}`> : [...SkipEmptyWord<CurrentWord>];
1811
1778
  type _DefaultDelimiterCaseOptions = Merge<_DefaultWordsOptions, {
1812
1779
  splitOnNumbers: false;
1813
1780
  }>;
@@ -1856,7 +1823,7 @@ const rawCliOptions: OddlyCasedProperties<SomeOptions> = {
1856
1823
  @category Template literal
1857
1824
  */
1858
1825
  type DelimiterCase<Value, Delimiter extends string, Options extends WordsOptions = {}> = Value extends string ? Delimiter extends string // For distributing `Delimiter`
1859
- ? IsStringLiteral<Value> extends false ? Value : Lowercase<DelimiterCaseFromArray<Words<Value, ApplyDefaultOptions<WordsOptions, _DefaultDelimiterCaseOptions, Options>>, Delimiter>> : never : Value;
1826
+ ? IsStringLiteral<Value> extends false ? Value : Lowercase<DelimiterCaseFromArray<Words<Value, ApplyDefaultOptions<WordsOptions, _DefaultDelimiterCaseOptions, Options>>, Delimiter>> : never : Value;
1860
1827
  /**
1861
1828
  Convert a string literal to kebab-case.
1862
1829
 
@@ -1895,8 +1862,8 @@ const rawCliOptions: KebabCasedProperties<CliOptions> = {
1895
1862
  @category Template literal
1896
1863
  */
1897
1864
  type KebabCase<Value, Options extends WordsOptions = {}> = DelimiterCase<Value, '-', ApplyDefaultOptions<WordsOptions, _DefaultDelimiterCaseOptions, Options>>;
1898
- type DeepOmit<T, TKey extends PropertyKey> = [T] extends [Date | Function | Primitive] ? T : [Record<string, unknown>] extends [T] ? T : T extends object ? T extends unknown[] ? T extends readonly unknown[] ? { [K in keyof T]: DeepOmit<T[K], TKey> } : DeepOmit<T[number], TKey>[] : { [P in keyof T as P extends TKey ? never : P]: DeepOmit<T[P], TKey> } : T;
1899
- type DeepOptionalUndefined<T> = T extends Date | Function | Primitive ? T : T extends unknown[] ? { [K in keyof T]: DeepOptionalUndefined<T[K]> } : T extends object ? { [K in keyof T as undefined extends T[K] ? K : never]?: DeepOptionalUndefined<T[K]> } & { [K in keyof T as undefined extends T[K] ? never : K]: DeepOptionalUndefined<T[K]> } extends infer O ? { [K in keyof O]: O[K] } : never : T;
1865
+ type DeepOmit<T, TKey extends PropertyKey> = [T] extends [Date | Function | Primitive] ? T : [Record<string, unknown>] extends [T] ? T : T extends object ? T extends unknown[] ? T extends readonly unknown[] ? { [K in keyof T]: DeepOmit<T[K], TKey>; } : DeepOmit<T[number], TKey>[] : { [P in keyof T as P extends TKey ? never : P]: DeepOmit<T[P], TKey>; } : T;
1866
+ type DeepOptionalUndefined<T> = T extends Date | Function | Primitive ? T : T extends unknown[] ? { [K in keyof T]: DeepOptionalUndefined<T[K]>; } : T extends object ? { [K in keyof T as undefined extends T[K] ? K : never]?: DeepOptionalUndefined<T[K]>; } & { [K in keyof T as undefined extends T[K] ? never : K]: DeepOptionalUndefined<T[K]>; } extends (infer O) ? { [K in keyof O]: O[K]; } : never : T;
1900
1867
  type ToData<T> = DeepOptionalUndefined<DeepOmit<T, "toJSON">>;
1901
1868
  interface WithMetadata<TBase extends Class<NonNullable<unknown>>> {
1902
1869
  new (...args: ConstructorParameters<TBase>): InstanceType<TBase> & ItemMetadata;
@@ -1904,6 +1871,7 @@ interface WithMetadata<TBase extends Class<NonNullable<unknown>>> {
1904
1871
  }
1905
1872
  declare const MAX_READ_LIMIT = 1000;
1906
1873
  declare const SITE_NAME = "Esposter";
1874
+ declare const createExponentialBackoff: (baseDelayMs: number, maxDelayMs: number) => (<T>(operation: () => Promise<T>) => Promise<T>);
1907
1875
  interface ErrorConfig {
1908
1876
  withStackTrace: boolean;
1909
1877
  }
@@ -1952,10 +1920,10 @@ declare type UnwrapAsync<T> = IsLiteralArray<T> extends 1 ? Writable<T> extends
1952
1920
  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;
1953
1921
  declare type TraverseWithAllErrorsAsync<T, Depth extends number = 5> = TraverseAsync<T, Depth> extends ResultAsync<infer Oks, infer Errs> ? ResultAsync<Oks, Errs[]> : never;
1954
1922
  declare type Writable<T> = T extends ReadonlyArray<unknown> ? [...T] : T;
1955
- declare type ExtractOkTypes<T extends readonly Result<unknown, unknown>[]> = { [idx in keyof T]: T[idx] extends Result<infer U, unknown> ? U : never };
1956
- declare type ExtractOkAsyncTypes<T extends readonly ResultAsync<unknown, unknown>[]> = { [idx in keyof T]: T[idx] extends ResultAsync<infer U, unknown> ? U : never };
1957
- declare type ExtractErrTypes<T extends readonly Result<unknown, unknown>[]> = { [idx in keyof T]: T[idx] extends Result<unknown, infer E> ? E : never };
1958
- declare type ExtractErrAsyncTypes<T extends readonly ResultAsync<unknown, unknown>[]> = { [idx in keyof T]: T[idx] extends ResultAsync<unknown, infer E> ? E : never };
1923
+ declare type ExtractOkTypes<T extends readonly Result<unknown, unknown>[]> = { [idx in keyof T]: T[idx] extends Result<infer U, unknown> ? U : never; };
1924
+ declare type ExtractOkAsyncTypes<T extends readonly ResultAsync<unknown, unknown>[]> = { [idx in keyof T]: T[idx] extends ResultAsync<infer U, unknown> ? U : never; };
1925
+ declare type ExtractErrTypes<T extends readonly Result<unknown, unknown>[]> = { [idx in keyof T]: T[idx] extends Result<unknown, infer E> ? E : never; };
1926
+ declare type ExtractErrAsyncTypes<T extends readonly ResultAsync<unknown, unknown>[]> = { [idx in keyof T]: T[idx] extends ResultAsync<unknown, infer E> ? E : never; };
1959
1927
  declare type InferOkTypes<R> = R extends Result<infer T, unknown> ? T : never;
1960
1928
  declare type InferErrTypes<R> = R extends Result<unknown, infer E> ? E : never;
1961
1929
  declare type InferAsyncOkTypes<R> = R extends ResultAsync<infer T, unknown> ? T : never;
@@ -2188,7 +2156,7 @@ declare type CollectResults<T, Collected extends unknown[] = [], Depth extends n
2188
2156
  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;
2189
2157
  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;
2190
2158
  declare type Dedup<T> = T extends Result<infer RL, infer RR> ? [unknown] extends [RL] ? Err<RL, RR> : Ok<RL, RR> : T;
2191
- 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] : [];
2159
+ 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] : [];
2192
2160
  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;
2193
2161
  declare type UnknownMembersToNever<T> = T extends [infer H, ...infer R] ? [[unknown] extends [H] ? never : H, ...UnknownMembersToNever<R>] : T;
2194
2162
  declare type MembersToUnion<T> = T extends unknown[] ? T[number] : never;
@@ -2212,6 +2180,7 @@ declare const MENTION_TYPE_ATTRIBUTE = "data-type";
2212
2180
  declare const MENTION_TYPE = "mention";
2213
2181
  declare const MENTION_HERE_ID = "@here";
2214
2182
  declare const MENTION_EVERYONE_ID = "@everyone";
2183
+ //#region src/void-tag.d.ts
2215
2184
  declare class VoidTag {
2216
2185
  addClosingSlash: boolean;
2217
2186
  private voidTags;
@@ -2219,16 +2188,20 @@ declare class VoidTag {
2219
2188
  formatNode(tag: string, attrs: string, innerHTML: string): string;
2220
2189
  isVoidElement(tag: string): boolean;
2221
2190
  }
2191
+ //#endregion
2192
+ //#region src/nodes/type.d.ts
2222
2193
  declare enum NodeType {
2223
2194
  ELEMENT_NODE = 1,
2224
2195
  TEXT_NODE = 3,
2225
2196
  COMMENT_NODE = 8
2226
2197
  }
2198
+ //#endregion
2199
+ //#region src/nodes/node.d.ts
2227
2200
  /**
2228
2201
  * Node Class as base class for TextNode and HTMLElement.
2229
2202
  */
2230
2203
  declare abstract class Node {
2231
- parentNode: HTMLElement;
2204
+ parentNode: HTMLElement | null;
2232
2205
  abstract rawTagName: string;
2233
2206
  abstract nodeType: NodeType;
2234
2207
  childNodes: Node[];
@@ -2237,7 +2210,7 @@ declare abstract class Node {
2237
2210
  abstract rawText: string;
2238
2211
  abstract toString(): string;
2239
2212
  abstract clone(): Node;
2240
- constructor(parentNode?: HTMLElement, range?: [number, number]);
2213
+ constructor(parentNode?: HTMLElement | null, range?: [number, number]);
2241
2214
  /**
2242
2215
  * Remove current node
2243
2216
  */
@@ -2246,6 +2219,8 @@ declare abstract class Node {
2246
2219
  get textContent(): string;
2247
2220
  set textContent(val: string);
2248
2221
  }
2222
+ //#endregion
2223
+ //#region src/nodes/html.d.ts
2249
2224
  interface KeyAttributes {
2250
2225
  id?: string;
2251
2226
  class?: string;
@@ -2269,7 +2244,7 @@ declare class DOMTokenList {
2269
2244
  toggle(c: string): void;
2270
2245
  contains(c: string): boolean;
2271
2246
  get length(): number;
2272
- values(): IterableIterator<string>;
2247
+ values(): SetIterator<string>;
2273
2248
  get value(): string[];
2274
2249
  toString(): string;
2275
2250
  }
@@ -2308,7 +2283,7 @@ declare class HTMLElement extends Node {
2308
2283
  *
2309
2284
  * @memberof HTMLElement
2310
2285
  */
2311
- constructor(tagName: string, keyAttrs: KeyAttributes, rawAttrs?: string, parentNode?: HTMLElement, range?: [number, number], voidTag?: VoidTag, _parseOptions?: Partial<Options>);
2286
+ constructor(tagName: string, keyAttrs: KeyAttributes, rawAttrs?: string, parentNode?: HTMLElement | null, range?: [number, number], voidTag?: VoidTag, _parseOptions?: Partial<Options>);
2312
2287
  /**
2313
2288
  * Remove Child element from childNodes array
2314
2289
  * @param {HTMLElement} node node to remove
@@ -2507,9 +2482,8 @@ declare const getMentions: (message: string) => HTMLElement[];
2507
2482
  declare const css: typeof String.raw;
2508
2483
  declare const html: typeof String.raw;
2509
2484
  declare const sanitizeHtml: (...[html, options]: Parameters<typeof baseSanitizeHtml>) => string;
2510
- declare const sanitizeMessageHtml: (html: string) => string;
2485
+ declare const sanitizeTextHtml: (html: string) => string;
2511
2486
  declare const applyItemMetadataMixin: <TBase extends Class<NonNullable<unknown>>>(Base: TBase) => WithMetadata<TBase>;
2512
- declare const SURVEY_DISPLAY_NAME = "Surveyer";
2513
2487
  declare const takeOne: TakeOne;
2514
2488
  declare const getIsServer: () => boolean;
2515
2489
  declare const noop: () => void;
@@ -2518,7 +2492,7 @@ declare const getOrCreate: <TKey, TValue>(map: Map<TKey, TValue>, key: TKey, cre
2518
2492
  declare const checkIsPlainObject: (data: unknown) => data is object;
2519
2493
  declare const getPropertyNames: <T>() => PropertyNames<T>;
2520
2494
  declare const jsonDateParse: <T = any>(text: string) => T;
2521
- type MergeObjectsStrict<T extends object[]> = T extends [infer TFirst, infer TSecond, ...infer TRemaining] ? TSecond extends { [K in keyof TSecond]: K extends keyof TFirst ? never : TSecond[K] } ? TRemaining extends object[] ? MergeObjectsStrict<[TSecond, ...TRemaining]> & TFirst : TFirst & TSecond : never : T extends [infer TFirst] ? TFirst : never;
2495
+ type MergeObjectsStrict<T extends object[]> = T extends [infer TFirst, infer TSecond, ...infer TRemaining] ? TSecond extends { [K in keyof TSecond]: K extends keyof TFirst ? never : TSecond[K]; } ? TRemaining extends object[] ? MergeObjectsStrict<[TSecond, ...TRemaining]> & TFirst : TFirst & TSecond : never : T extends [infer TFirst] ? TFirst : never;
2522
2496
  declare const mergeObjectsStrict: <T extends object[]>(...objects: T) => MergeObjectsStrict<T>;
2523
2497
  declare const getRawData: <T>(data: T) => T;
2524
2498
  declare const toRawDeep: <T extends object>(data: T) => T;
@@ -2531,8 +2505,9 @@ declare const truncate: (string: string, length: number) => string;
2531
2505
  declare const uncapitalize: <T extends string>(string: T) => Uncapitalize<T>;
2532
2506
  declare const hrtime: (previousHrTime?: [number, number]) => [number, number];
2533
2507
  declare const now: () => string;
2508
+ declare const sleep: (durationMs: number) => Promise<void>;
2534
2509
  type BuildTuple<N extends number, T = unknown, R extends unknown[] = []> = R["length"] extends N ? R : BuildTuple<N, T, [...R, T]>;
2535
- type FunctionProperties<T> = { [K in keyof T]: T[K] extends Function ? K : never };
2510
+ type FunctionProperties<T> = { [K in keyof T]: T[K] extends Function ? K : never; };
2536
2511
  type ExcludeFunctionProperties<T> = Except<T, FunctionProperties<T>[keyof T]>;
2537
2512
  type MapValue<BaseType> = BaseType extends Map<unknown, infer ValueType> ? ValueType : never;
2538
2513
  type TupleSplit<T extends unknown[], N extends number> = T extends [...BuildTuple<N>, ...infer R] ? [T extends [...infer H, ...R] ? H : BuildTuple<N, T[number]>, R] : [T, []];
@@ -2545,7 +2520,6 @@ declare const exhaustiveGuard: (value: never) => never;
2545
2520
  type CreateUniqueArraySchema = (<TOutput extends object, TInput, TSchema extends z.ZodType<TOutput, TInput>>(schema: TSchema, key: UniqueArraySchemaKey<TSchema>) => z.ZodArray<TSchema>) & (<TSchema extends z.ZodType>(schema: TSchema) => z.ZodArray<TSchema>);
2546
2521
  type UniqueArraySchemaKey<TSchema extends z.ZodType> = TSchema extends z.ZodObject ? keyof TSchema["shape"] & string : keyof z.output<TSchema> & string;
2547
2522
  declare const createUniqueArraySchema: CreateUniqueArraySchema;
2548
- declare const NIL = "00000000-0000-0000-0000-000000000000";
2549
2523
  declare const UUIDV4_REGEX: RegExp;
2550
2524
  declare const uuidValidateV4: (uuid: string) => boolean;
2551
- export { AllSpecialValues, BuildTuple, ClassifiedMentions, CreateUniqueArraySchema, DeepOmit, DeepOptionalUndefined, ExcludeFunctionProperties, ForbiddenError, FunctionProperties, GetArrayProps, GetObjectProps, GetPaths, GetPrimitiveProps, GetProperties, ID_SEPARATOR, InvalidOperationError, ItemEntityType, ItemEntityTypePropertyNames, ItemMetadata, ItemMetadataPropertyNames, KnownKeys, MAX_READ_LIMIT, MENTION_EVERYONE_ID, MENTION_HERE_ID, MENTION_ID_ATTRIBUTE, MENTION_ITEM_TYPE_ATTRIBUTE, MENTION_LABEL_ATTRIBUTE, MENTION_TYPE, MENTION_TYPE_ATTRIBUTE, MapValue, MentionType, MergeObjectsStrict, NIL, NotFoundError, NotInitializedError, Operation, PropertyNames, RoutePath, SITE_NAME, SURVEY_DISPLAY_NAME, Serializable, SkipFirst, TakeFirst, TakeOne, ToData, TupleSlice, TupleSplit, TupleSplitHead, TupleSplitTail, UUIDV4_REGEX, UniqueArraySchemaKey, WithMetadata, applyItemMetadataMixin, capitalize, checkIsPlainObject, classifyMentions, createItemEntityTypeSchema, createNormalizedStringSchema, createUniqueArraySchema, css, exhaustiveGuard, getIsServer, getMentions, getOrCreate, getPropertyNames, getRawData, getResult, getResultAsync, hrtime, html, itemMetadataSchema, jsonDateParse, mergeObjectsStrict, noop, normalizeString, now, sanitizeHtml, sanitizeMessageHtml, streamToText, takeOne, toAppError, toKebabCase, toRawDeep, truncate, uncapitalize, uuidValidateV4, withFinalizer, withFinalizerAsync };
2525
+ export { AllSpecialValues, BuildTuple, ClassifiedMentions, CreateUniqueArraySchema, DeepOmit, DeepOptionalUndefined, ExcludeFunctionProperties, ForbiddenError, FunctionProperties, GetArrayProps, GetObjectProps, GetPaths, GetPrimitiveProps, GetProperties, ID_SEPARATOR, InvalidOperationError, ItemEntityType, ItemEntityTypePropertyNames, ItemMetadata, ItemMetadataPropertyNames, KnownKeys, MAX_READ_LIMIT, MENTION_EVERYONE_ID, MENTION_HERE_ID, MENTION_ID_ATTRIBUTE, MENTION_ITEM_TYPE_ATTRIBUTE, MENTION_LABEL_ATTRIBUTE, MENTION_TYPE, MENTION_TYPE_ATTRIBUTE, MapValue, MentionType, MergeObjectsStrict, NotFoundError, NotInitializedError, Operation, PropertyNames, RoutePath, SITE_NAME, Serializable, SkipFirst, TakeFirst, TakeOne, ToData, TupleSlice, TupleSplit, TupleSplitHead, TupleSplitTail, UUIDV4_REGEX, UniqueArraySchemaKey, WithMetadata, applyItemMetadataMixin, capitalize, checkIsPlainObject, classifyMentions, createExponentialBackoff, createItemEntityTypeSchema, createNormalizedStringSchema, createUniqueArraySchema, css, exhaustiveGuard, getIsServer, getMentions, getOrCreate, getPropertyNames, getRawData, getResult, getResultAsync, hrtime, html, itemMetadataSchema, jsonDateParse, mergeObjectsStrict, noop, normalizeString, now, sanitizeHtml, sanitizeTextHtml, sleep, streamToText, takeOne, toAppError, toKebabCase, toRawDeep, truncate, uncapitalize, uuidValidateV4, withFinalizer, withFinalizerAsync };