@esposter/shared 2.34.2 → 2.36.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 +204 -228
  2. package/dist/index.js +7383 -9307
  3. package/package.json +10 -10
package/dist/index.d.ts CHANGED
@@ -24,6 +24,9 @@ declare class NotFoundError<T extends string = string> extends Error {
24
24
  declare class NotInitializedError<T extends string = string> extends Error {
25
25
  constructor(name: T);
26
26
  }
27
+ declare class WordFilteredError extends Error {
28
+ constructor(message: string);
29
+ }
27
30
  interface ClassifiedMentions {
28
31
  broadcastIds: string[];
29
32
  regularUserIds: string[];
@@ -37,16 +40,11 @@ declare const RoutePath: {
37
40
  readonly About: "/about";
38
41
  readonly Achievements: "/achievements";
39
42
  readonly Anime: "/anime";
40
- readonly Calendar: "/calendar";
41
43
  readonly Calls: (id: string) => string;
42
44
  readonly CallsIndex: "/calls";
43
45
  readonly Clicker: "/clicker";
44
- readonly Dashboard: "/dashboard";
45
- readonly DashboardEditor: "/dashboard/editor";
46
46
  readonly Docs: "/docs";
47
47
  readonly Dungeons: "/dungeons";
48
- readonly EmailEditor: "/email-editor";
49
- readonly FlowchartEditor: "/flowchart-editor";
50
48
  readonly FluidSimulator: "/fluid-simulator";
51
49
  readonly Github: "https://github.com/Esposter/Esposter";
52
50
  readonly Index: "/";
@@ -61,22 +59,27 @@ declare const RoutePath: {
61
59
  readonly PostCreate: "/post/create";
62
60
  readonly PostUpdate: (id: string) => string;
63
61
  readonly PrivacyPolicy: "/privacy-policy";
64
- readonly Survey: (id: string) => string;
65
- readonly Surveyer: "/surveyer";
66
- readonly TableEditor: "/table-editor";
62
+ readonly Resource: (id: string) => string;
63
+ readonly ResourceItems: (id: string) => string;
64
+ readonly Resources: "/resources";
65
+ readonly ResourcesAll: "/resources/all";
66
+ readonly ResourcesCreate: "/resources/create";
67
+ readonly ResourcesCreateType: (type: string) => string;
68
+ readonly ResourcesRecycleBin: "/resources/recycle-bin";
69
+ readonly User: (id: string) => string;
67
70
  readonly UserSettings: "/user/settings";
68
- readonly WebpageEditor: "/webpage-editor";
71
+ readonly View: (type: string, id: string) => string;
69
72
  };
70
73
  type RoutePath = typeof RoutePath;
71
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) | {
72
75
  path: R extends true ? "length" : `${P}.length`;
73
76
  value: T["length"];
74
77
  };
75
- type KnownKeys<T> = { [K in keyof T as string extends K ? never : number extends K ? never : K]: T[K] };
78
+ type KnownKeys<T> = { [K in keyof T as string extends K ? never : number extends K ? never : K]: T[K]; };
76
79
  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
80
  path: R extends true ? `${K}` : `${P}.${K}`;
78
81
  value: T[K];
79
- } }[keyof KnownKeys<T> & (number | string)];
82
+ }; }[keyof KnownKeys<T> & (number | string)];
80
83
  type GetPrimitiveProps<T, P extends string, D extends unknown[], R extends boolean> = T extends string ? {
81
84
  path: R extends true ? "length" : `${P}.length`;
82
85
  value: number;
@@ -84,11 +87,11 @@ type GetPrimitiveProps<T, P extends string, D extends unknown[], R extends boole
84
87
  path: R extends true ? "description" : `${P}.description`;
85
88
  value: string | undefined;
86
89
  } : 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 {
90
+ 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
+ type GetPaths<T> = GetProperties<T> extends (infer U) ? (U extends {
89
92
  path: infer Path;
90
93
  } ? Path : never) : never;
91
- type PropertyNames<T> = { [P in GetPaths<T>]: P };
94
+ type PropertyNames<T> = { [P in GetPaths<T>]: P; };
92
95
  interface ItemEntityType<T extends string> {
93
96
  type: T;
94
97
  }
@@ -233,8 +236,8 @@ const update2: UpdateOperation<User> = {
233
236
  @category Utilities
234
237
  */
235
238
  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;
239
+ ? (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`
240
+ : never; // Should never happen
238
241
  /**
239
242
  Extract all required keys from the given type.
240
243
 
@@ -266,7 +269,7 @@ const validator3 = createValidation<User>('luckyNumber', value => value > 0);
266
269
  @category Utilities
267
270
  */
268
271
  type RequiredKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
269
- ? Exclude<keyof Type, OptionalKeysOf<Type>> : never;
272
+ ? Exclude<keyof Type, OptionalKeysOf<Type>> : never; // Should never happen
270
273
  /**
271
274
  Returns a boolean for whether the given type is `never`.
272
275
 
@@ -540,20 +543,21 @@ type CollapseRestElement<TArray extends UnknownArray> = IfNotAnyOrNever<TArray,
540
543
  ifNot: _CollapseRestElement<TArray>;
541
544
  }>;
542
545
  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., []),
546
+ ? keyof TArray & `${number}` extends never ?
547
+ // Enters this branch, if `TArray` is empty (e.g., []),
544
548
  // 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}';
549
+ TArray extends readonly [...infer Rest, infer Last] ? _CollapseRestElement<Rest, ForwardAccumulator, [Last, ...BackwardAccumulator]> // Accumulate elements that are present after the rest element.
550
+ : TArray extends readonly [] ? [...ForwardAccumulator, ...BackwardAccumulator] : [...ForwardAccumulator, TArray[number], ...BackwardAccumulator] // Add the rest element between the accumulated elements.
551
+ : 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.
552
+ : First], BackwardAccumulator> : never // Should never happen, since `[(infer First)?, ...infer Rest]` is a top-type for arrays.
553
+ : never; // Should never happen
554
+ type Whitespace = '\t' // '\t'
555
+ | '\n' // '\n'
556
+ | '\v' // '\v'
557
+ | '\f' // '\f'
558
+ | '\r' // '\r'
559
+ | ' ' // ' '
560
+ | '…' | ' ' | ' ' | ' ' | ' ' | ' ' | ' ' | ' ' | ' ' | ' ' | ' ' | ' ' | ' ' | ' ' | '
' | '
' | ' ' | ' ' | ' ' | '';
557
561
  type WordSeparators = '-' | '_' | Whitespace;
558
562
  type AsciiPunctuation = '!' | '"' | '#' | '$' | '%' | '&' | '\'' | '(' | ')' | '*' | '+' | ',' | '-' | '.' | '/' | ':' | ';' | '<' | '=' | '>' | '?' | '@' | '[' | '\\' | ']' | '^' | '_' | '`' | '{' | '|' | '}' | '~';
559
563
  declare const tag: unique symbol;
@@ -561,7 +565,7 @@ declare const tag: unique symbol;
561
565
  type TagContainer<Token> = {
562
566
  readonly [tag]: Token;
563
567
  };
564
- type Tag<Token extends PropertyKey, TagMetadata> = TagContainer<{ [K in Token]: TagMetadata }>;
568
+ type Tag<Token extends PropertyKey, TagMetadata> = TagContainer<{ [K in Token]: TagMetadata; }>;
565
569
  /**
566
570
  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
571
 
@@ -652,81 +656,7 @@ type WontWork = UnwrapTagged<string>;
652
656
  @category Type
653
657
  */
654
658
  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
- */
659
+ 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
660
  /**
731
661
  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
662
 
@@ -788,7 +718,8 @@ type IsStringLiteral<S> = IfNotAnyOrNever<S, {
788
718
  ifAny: false;
789
719
  ifNever: false;
790
720
  }>;
791
- type _IsStringLiteral<S> = // If `T` is an infinite string type (e.g., `on${string}`), `Record<T, never>` produces an index signature,
721
+ type _IsStringLiteral<S> =
722
+ // If `T` is an infinite string type (e.g., `on${string}`), `Record<T, never>` produces an index signature,
792
723
  // and since `{}` extends index signatures, the result becomes `false`.
793
724
  S extends string ? {} extends Record<S, never> ? false : true : false;
794
725
  /**
@@ -872,7 +803,7 @@ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface`
872
803
  @see {@link SimplifyDeep}
873
804
  @category Object
874
805
  */
875
- type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};
806
+ type Simplify<T> = { [KeyType in keyof T]: T[KeyType]; } & {};
876
807
  /**
877
808
  Returns a boolean for whether the two given types are equal.
878
809
 
@@ -993,7 +924,7 @@ type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
993
924
  @see {@link PickIndexSignature}
994
925
  @category Object
995
926
  */
996
- type OmitIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType] };
927
+ type OmitIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType]; };
997
928
  /**
998
929
  Pick only index signatures from the given object type, leaving out all explicitly defined properties.
999
930
 
@@ -1039,9 +970,9 @@ type ExampleIndexSignature = PickIndexSignature<Example>;
1039
970
  @see {@link OmitIndexSignature}
1040
971
  @category Object
1041
972
  */
1042
- type PickIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? KeyType : never]: ObjectType[KeyType] };
973
+ type PickIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? KeyType : never]: ObjectType[KeyType]; };
1043
974
  // 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>;
975
+ type SimpleMerge<Destination, Source> = Simplify<{ [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key]; } & Source>;
1045
976
  /**
1046
977
  Merge two types into a new type. Keys of the second type overrides keys of the first type.
1047
978
 
@@ -1105,10 +1036,9 @@ Note: If you want a merge type that more accurately reflects the runtime behavio
1105
1036
  @category Object
1106
1037
  */
1107
1038
  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
1039
+ ? Source extends unknown // For distributing `Source`
1040
+ ? If<IsEqual<Destination, Source>, Destination, _Merge<Destination, Source>> : never // Should never happen
1041
+ : never; // Should never happen
1112
1042
  type _Merge<Destination, Source> = Simplify<SimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>> & SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>>;
1113
1043
  /**
1114
1044
  Merges user specified options with default options.
@@ -1162,9 +1092,9 @@ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOp
1162
1092
  // Types of property 'leavesOnly' are incompatible. Type 'string' is not assignable to type 'boolean'.
1163
1093
  ```
1164
1094
  */
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] }>>>;
1095
+ 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>`
1096
+ ) ? Result : never;
1097
+ 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
1098
  /**
1169
1099
  Collapses literal types in a union into their corresponding primitive types, when possible. For example, `CollapseLiterals<'foo' | 'bar' | (string & {})>` returns `string`.
1170
1100
 
@@ -1192,33 +1122,42 @@ type E = CollapseLiterals<LiteralUnion<'foo' | 'bar', string> | null | undefined
1192
1122
  //=> string | null | undefined
1193
1123
  ```
1194
1124
  */
1195
- type CollapseLiterals<T> = {} extends T ? T : T extends infer U & {} ? U : T;
1125
+ type CollapseLiterals<T> = {} extends T ? T : T extends (infer U) & {} ? U : T;
1196
1126
  /**
1197
1127
  @see {@link SomeExtend}
1198
1128
  */
1199
1129
  type SomeExtendOptions = {
1200
1130
  /**
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
- */
1131
+ Consider `never` elements to match the target type only if the target type itself is `never` (or `any`).
1132
+
1133
+ - 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`).
1134
+ - When set to `false`, `never` is treated as a bottom type, and behaves as it normally would.
1135
+
1136
+ @default true
1137
+
1138
+ @example
1139
+ ```
1140
+ import type {SomeExtend} from 'type-fest';
1141
+
1142
+ type A = SomeExtend<[1, 2, never], string, {strictNever: true}>;
1143
+ //=> false
1144
+
1145
+ type B = SomeExtend<[1, 2, never], string, {strictNever: false}>;
1146
+ //=> true
1147
+
1148
+ type C = SomeExtend<[1, never], never, {strictNever: true}>;
1149
+ //=> true
1150
+
1151
+ type D = SomeExtend<[1, never], never, {strictNever: false}>;
1152
+ //=> true
1153
+
1154
+ type E = SomeExtend<[never], any, {strictNever: true}>;
1155
+ //=> true
1156
+
1157
+ type F = SomeExtend<[never], any, {strictNever: false}>;
1158
+ //=> true
1159
+ ```
1160
+ */
1222
1161
  strictNever?: boolean;
1223
1162
  };
1224
1163
  type DefaultSomeExtendOptions = {
@@ -1272,8 +1211,9 @@ type B = SomeExtend<[1?, 2?, '3'?], string | undefined>;
1272
1211
  */
1273
1212
  type SomeExtend<TArray extends UnknownArray, Type, Options extends SomeExtendOptions = {}> = _SomeExtend<CollapseRestElement<TArray>, Type, ApplyDefaultOptions<SomeExtendOptions, DefaultSomeExtendOptions, Options>>;
1274
1213
  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;
1214
+ ifNot: TArray extends readonly [infer First, ...infer Rest] ? IsNever<First> extends true ? Or<Or<IsNever<Type>, IsAny<Type>>, Not<Options['strictNever']>> extends true ?
1215
+ // If target `Type` is also `never`, or is `any`, or `strictNever` is disabled, return `true`.
1216
+ true : _SomeExtend<Rest, Type, Options> : First extends Type ? true : _SomeExtend<Rest, Type, Options> : false;
1277
1217
  ifAny: false;
1278
1218
  ifNever: false;
1279
1219
  }>;
@@ -1457,31 +1397,42 @@ type IsNumeric<T extends string> = T extends `${number}` ? Trim<T> extends T ? t
1457
1397
  */
1458
1398
  type AllExtendOptions = {
1459
1399
  /**
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
- */
1400
+ Consider `never` elements to match the target type only if the target type itself is `never` (or `any`).
1401
+
1402
+ - 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`).
1403
+ - When set to `false`, `never` is treated as a bottom type, and behaves as it normally would.
1404
+
1405
+ @default true
1406
+
1407
+ @example
1408
+ ```
1409
+ import type {AllExtend} from 'type-fest';
1410
+
1411
+ type A = AllExtend<[1, 2, never], number, {strictNever: true}>;
1412
+ //=> false
1413
+
1414
+ type B = AllExtend<[1, 2, never], number, {strictNever: false}>;
1415
+ //=> true
1416
+
1417
+ type C = AllExtend<[never, never], never, {strictNever: true}>;
1418
+ //=> true
1419
+
1420
+ type D = AllExtend<[never, never], never, {strictNever: false}>;
1421
+ //=> true
1422
+
1423
+ type E = AllExtend<['a', 'b', never], any, {strictNever: true}>;
1424
+ //=> true
1425
+
1426
+ type F = AllExtend<['a', 'b', never], any, {strictNever: false}>;
1427
+ //=> true
1428
+
1429
+ type G = AllExtend<[never, 1], never, {strictNever: true}>;
1430
+ //=> false
1431
+
1432
+ type H = AllExtend<[never, 1], never, {strictNever: false}>;
1433
+ //=> false
1434
+ ```
1435
+ */
1485
1436
  strictNever?: boolean;
1486
1437
  };
1487
1438
  type DefaultAllExtendOptions = {
@@ -1535,8 +1486,9 @@ type B = AllExtend<[1?, 2?, 3?], number | undefined>;
1535
1486
  */
1536
1487
  type AllExtend<TArray extends UnknownArray, Type, Options extends AllExtendOptions = {}> = _AllExtend<CollapseRestElement<TArray>, Type, ApplyDefaultOptions<AllExtendOptions, DefaultAllExtendOptions, Options>>;
1537
1488
  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;
1489
+ ifNot: TArray extends readonly [infer First, ...infer Rest] ? IsNever<First> extends true ? Or<Or<IsNever<Type>, IsAny<Type>>, Not<Options['strictNever']>> extends true ?
1490
+ // If target `Type` is also `never`, or is `any`, or `strictNever` is disabled, recurse further.
1491
+ _AllExtend<Rest, Type, Options> : false : First extends Type ? _AllExtend<Rest, Type, Options> : false : true;
1540
1492
  ifAny: false;
1541
1493
  ifNever: false;
1542
1494
  }>;
@@ -1570,10 +1522,12 @@ type Filtered = Filter<'bar', 'foo'>;
1570
1522
  type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
1571
1523
  type ExceptOptions = {
1572
1524
  /**
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
- */
1525
+ Disallow assigning non-specified properties.
1526
+
1527
+ Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
1528
+
1529
+ @default false
1530
+ */
1577
1531
  requireExactProps?: boolean;
1578
1532
  };
1579
1533
  type DefaultExceptOptions = {
@@ -1635,7 +1589,7 @@ type PostPayloadFixed = Except<UserData, 'email'>;
1635
1589
  @category Object
1636
1590
  */
1637
1591
  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>> : {});
1592
+ 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
1593
  /**
1640
1594
  Create a type that represents either the value or the value wrapped in `PromiseLike`.
1641
1595
 
@@ -1722,29 +1676,36 @@ Words options.
1722
1676
  */
1723
1677
  type WordsOptions = {
1724
1678
  /**
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
- */
1679
+ Split on numeric sequence.
1680
+
1681
+ @default true
1682
+
1683
+ @example
1684
+ ```
1685
+ import type {Words} from 'type-fest';
1686
+
1687
+ type Example1 = Words<'p2pNetwork', {splitOnNumbers: true}>;
1688
+ //=> ['p', '2', 'p', 'Network']
1689
+
1690
+ type Example2 = Words<'p2pNetwork', {splitOnNumbers: false}>;
1691
+ //=> ['p2p', 'Network']
1692
+ ```
1693
+ */
1736
1694
  splitOnNumbers?: boolean;
1737
1695
  /**
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
- */
1696
+ Split on {@link AsciiPunctuation | punctuation characters} (e.g., `#`, `&`, `*`, `:`, `?`, `@`, `~`).
1697
+
1698
+ @example
1699
+ ```
1700
+ import type {Words} from 'type-fest';
1701
+
1702
+ type Example1 = Words<'hello:world', {splitOnPunctuation: true}>;
1703
+ //=> ['hello', 'world']
1704
+
1705
+ type Example2 = Words<'hello:world', {splitOnPunctuation: false}>;
1706
+ //=> ['hello', ':world']
1707
+ ```
1708
+ */
1748
1709
  splitOnPunctuation?: boolean;
1749
1710
  };
1750
1711
  type _DefaultWordsOptions = {
@@ -1795,19 +1756,31 @@ type Words8 = Words<'hello::world', {splitOnPunctuation: true}>;
1795
1756
  @category Template literal
1796
1757
  */
1797
1758
  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>];
1759
+ 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) ?
1760
+ // Skip word separator
1761
+ [...SkipEmptyWord<CurrentWord>, ...WordsImplementation<RemainingCharacters, Options>] : LastCharacter extends '' ?
1762
+ // Fist char of word
1763
+ WordsImplementation<RemainingCharacters, Options, FirstCharacter, FirstCharacter> :
1764
+ // Case change: non-numeric to numeric
1765
+ [false, true] 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
+ // Case change: numeric to non-numeric
1771
+ [true, false] extends [IsNumeric<LastCharacter>, IsNumeric<FirstCharacter>] ? Options['splitOnNumbers'] extends true ?
1772
+ // Split on number: push word
1773
+ [...SkipEmptyWord<CurrentWord>, ...WordsImplementation<RemainingCharacters, Options, FirstCharacter, FirstCharacter>] :
1774
+ // No split on number: concat word
1775
+ WordsImplementation<RemainingCharacters, Options, FirstCharacter, `${CurrentWord}${FirstCharacter}`> :
1776
+ // No case change: concat word
1777
+ [true, true] extends [IsNumeric<LastCharacter>, IsNumeric<FirstCharacter>] ? WordsImplementation<RemainingCharacters, Options, FirstCharacter, `${CurrentWord}${FirstCharacter}`> :
1778
+ // Case change: lower to upper, push word
1779
+ [true, true] extends [IsLowercase<LastCharacter>, IsUppercase<FirstCharacter>] ? [...SkipEmptyWord<CurrentWord>, ...WordsImplementation<RemainingCharacters, Options, FirstCharacter, FirstCharacter>] :
1780
+ // Case change: upper to lower, brings back the last character, push word
1781
+ [true, true] extends [IsUppercase<LastCharacter>, IsLowercase<FirstCharacter>] ? [...RemoveLastCharacter<CurrentWord, LastCharacter>, ...WordsImplementation<RemainingCharacters, Options, FirstCharacter, `${LastCharacter}${FirstCharacter}`>] :
1782
+ // No case change: concat word
1783
+ WordsImplementation<RemainingCharacters, Options, FirstCharacter, `${CurrentWord}${FirstCharacter}`> : [...SkipEmptyWord<CurrentWord>];
1811
1784
  type _DefaultDelimiterCaseOptions = Merge<_DefaultWordsOptions, {
1812
1785
  splitOnNumbers: false;
1813
1786
  }>;
@@ -1856,7 +1829,7 @@ const rawCliOptions: OddlyCasedProperties<SomeOptions> = {
1856
1829
  @category Template literal
1857
1830
  */
1858
1831
  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;
1832
+ ? IsStringLiteral<Value> extends false ? Value : Lowercase<DelimiterCaseFromArray<Words<Value, ApplyDefaultOptions<WordsOptions, _DefaultDelimiterCaseOptions, Options>>, Delimiter>> : never : Value;
1860
1833
  /**
1861
1834
  Convert a string literal to kebab-case.
1862
1835
 
@@ -1895,8 +1868,8 @@ const rawCliOptions: KebabCasedProperties<CliOptions> = {
1895
1868
  @category Template literal
1896
1869
  */
1897
1870
  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;
1871
+ 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;
1872
+ 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
1873
  type ToData<T> = DeepOptionalUndefined<DeepOmit<T, "toJSON">>;
1901
1874
  interface WithMetadata<TBase extends Class<NonNullable<unknown>>> {
1902
1875
  new (...args: ConstructorParameters<TBase>): InstanceType<TBase> & ItemMetadata;
@@ -1904,6 +1877,7 @@ interface WithMetadata<TBase extends Class<NonNullable<unknown>>> {
1904
1877
  }
1905
1878
  declare const MAX_READ_LIMIT = 1000;
1906
1879
  declare const SITE_NAME = "Esposter";
1880
+ declare const createExponentialBackoff: (baseDelayMs: number, maxDelayMs: number) => (<T>(operation: () => Promise<T>) => Promise<T>);
1907
1881
  interface ErrorConfig {
1908
1882
  withStackTrace: boolean;
1909
1883
  }
@@ -1952,10 +1926,10 @@ declare type UnwrapAsync<T> = IsLiteralArray<T> extends 1 ? Writable<T> extends
1952
1926
  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
1927
  declare type TraverseWithAllErrorsAsync<T, Depth extends number = 5> = TraverseAsync<T, Depth> extends ResultAsync<infer Oks, infer Errs> ? ResultAsync<Oks, Errs[]> : never;
1954
1928
  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 };
1929
+ declare type ExtractOkTypes<T extends readonly Result<unknown, unknown>[]> = { [idx in keyof T]: T[idx] extends Result<infer U, unknown> ? U : never; };
1930
+ declare type ExtractOkAsyncTypes<T extends readonly ResultAsync<unknown, unknown>[]> = { [idx in keyof T]: T[idx] extends ResultAsync<infer U, unknown> ? U : never; };
1931
+ declare type ExtractErrTypes<T extends readonly Result<unknown, unknown>[]> = { [idx in keyof T]: T[idx] extends Result<unknown, infer E> ? E : never; };
1932
+ declare type ExtractErrAsyncTypes<T extends readonly ResultAsync<unknown, unknown>[]> = { [idx in keyof T]: T[idx] extends ResultAsync<unknown, infer E> ? E : never; };
1959
1933
  declare type InferOkTypes<R> = R extends Result<infer T, unknown> ? T : never;
1960
1934
  declare type InferErrTypes<R> = R extends Result<unknown, infer E> ? E : never;
1961
1935
  declare type InferAsyncOkTypes<R> = R extends ResultAsync<infer T, unknown> ? T : never;
@@ -2188,7 +2162,7 @@ declare type CollectResults<T, Collected extends unknown[] = [], Depth extends n
2188
2162
  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
2163
  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
2164
  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] : [];
2165
+ 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
2166
  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
2167
  declare type UnknownMembersToNever<T> = T extends [infer H, ...infer R] ? [[unknown] extends [H] ? never : H, ...UnknownMembersToNever<R>] : T;
2194
2168
  declare type MembersToUnion<T> = T extends unknown[] ? T[number] : never;
@@ -2228,7 +2202,7 @@ declare enum NodeType {
2228
2202
  * Node Class as base class for TextNode and HTMLElement.
2229
2203
  */
2230
2204
  declare abstract class Node {
2231
- parentNode: HTMLElement;
2205
+ parentNode: HTMLElement | null;
2232
2206
  abstract rawTagName: string;
2233
2207
  abstract nodeType: NodeType;
2234
2208
  childNodes: Node[];
@@ -2237,7 +2211,7 @@ declare abstract class Node {
2237
2211
  abstract rawText: string;
2238
2212
  abstract toString(): string;
2239
2213
  abstract clone(): Node;
2240
- constructor(parentNode?: HTMLElement, range?: [number, number]);
2214
+ constructor(parentNode?: HTMLElement | null, range?: [number, number]);
2241
2215
  /**
2242
2216
  * Remove current node
2243
2217
  */
@@ -2269,7 +2243,7 @@ declare class DOMTokenList {
2269
2243
  toggle(c: string): void;
2270
2244
  contains(c: string): boolean;
2271
2245
  get length(): number;
2272
- values(): IterableIterator<string>;
2246
+ values(): SetIterator<string>;
2273
2247
  get value(): string[];
2274
2248
  toString(): string;
2275
2249
  }
@@ -2308,7 +2282,7 @@ declare class HTMLElement extends Node {
2308
2282
  *
2309
2283
  * @memberof HTMLElement
2310
2284
  */
2311
- constructor(tagName: string, keyAttrs: KeyAttributes, rawAttrs?: string, parentNode?: HTMLElement, range?: [number, number], voidTag?: VoidTag, _parseOptions?: Partial<Options>);
2285
+ constructor(tagName: string, keyAttrs: KeyAttributes, rawAttrs?: string, parentNode?: HTMLElement | null, range?: [number, number], voidTag?: VoidTag, _parseOptions?: Partial<Options>);
2312
2286
  /**
2313
2287
  * Remove Child element from childNodes array
2314
2288
  * @param {HTMLElement} node node to remove
@@ -2507,22 +2481,26 @@ declare const getMentions: (message: string) => HTMLElement[];
2507
2481
  declare const css: typeof String.raw;
2508
2482
  declare const html: typeof String.raw;
2509
2483
  declare const sanitizeHtml: (...[html, options]: Parameters<typeof baseSanitizeHtml>) => string;
2510
- declare const sanitizeMessageHtml: (html: string) => string;
2484
+ declare const sanitizeTextHtml: (html: string) => string;
2511
2485
  declare const applyItemMetadataMixin: <TBase extends Class<NonNullable<unknown>>>(Base: TBase) => WithMetadata<TBase>;
2512
- declare const SURVEY_DISPLAY_NAME = "Surveyer";
2486
+ declare const chunk: <T>(array: T[], size: number) => T[][];
2487
+ declare const chunkBySerializedSize: <T>(items: T[], maxBytes: number, maxCount: number) => T[][];
2513
2488
  declare const takeOne: TakeOne;
2514
2489
  declare const getIsServer: () => boolean;
2515
2490
  declare const noop: () => void;
2516
2491
  declare const ID_SEPARATOR = "|";
2492
+ declare const UUID_LENGTH = 36;
2517
2493
  declare const getOrCreate: <TKey, TValue>(map: Map<TKey, TValue>, key: TKey, create: () => TValue) => TValue;
2518
2494
  declare const checkIsPlainObject: (data: unknown) => data is object;
2519
2495
  declare const getPropertyNames: <T>() => PropertyNames<T>;
2520
2496
  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;
2497
+ 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
2498
  declare const mergeObjectsStrict: <T extends object[]>(...objects: T) => MergeObjectsStrict<T>;
2499
+ declare const settleAll: <T>(tasks: (() => Promise<T>)[], concurrencyLimit?: number) => Promise<T[]>;
2523
2500
  declare const getRawData: <T>(data: T) => T;
2524
2501
  declare const toRawDeep: <T extends object>(data: T) => T;
2525
2502
  declare const capitalize: (string: string) => string;
2503
+ declare const encodeUrlSubDelimiters: (value: string) => string;
2526
2504
  declare const normalizeString: (value: null | string | undefined) => string;
2527
2505
  declare const createNormalizedStringSchema: (maxLength: number, schema?: z.ZodString) => z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
2528
2506
  declare const streamToText: (readable: NodeJS.ReadableStream) => Promise<string>;
@@ -2531,21 +2509,19 @@ declare const truncate: (string: string, length: number) => string;
2531
2509
  declare const uncapitalize: <T extends string>(string: T) => Uncapitalize<T>;
2532
2510
  declare const hrtime: (previousHrTime?: [number, number]) => [number, number];
2533
2511
  declare const now: () => string;
2512
+ declare const sleep: (durationMs: number) => Promise<void>;
2534
2513
  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 };
2514
+ type FunctionProperties<T> = { [K in keyof T]: T[K] extends Function ? K : never; };
2536
2515
  type ExcludeFunctionProperties<T> = Except<T, FunctionProperties<T>[keyof T]>;
2537
2516
  type MapValue<BaseType> = BaseType extends Map<unknown, infer ValueType> ? ValueType : never;
2538
2517
  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, []];
2539
2518
  type SkipFirst<T extends unknown[], N extends number> = TupleSplit<T, N>[1];
2540
2519
  type TakeFirst<T extends unknown[], N extends number> = TupleSplit<T, N>[0];
2541
2520
  type TupleSlice<T extends unknown[], S extends number, E extends number = T["length"]> = E extends T["length"] ? SkipFirst<T, S> : SkipFirst<TakeFirst<T, E>, S>;
2542
- type TupleSplitHead<T extends unknown[], N extends number> = TupleSplit<T, N>[0];
2543
- type TupleSplitTail<T extends unknown[], N extends number> = TupleSplit<T, N>[1];
2544
2521
  declare const exhaustiveGuard: (value: never) => never;
2545
2522
  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
2523
  type UniqueArraySchemaKey<TSchema extends z.ZodType> = TSchema extends z.ZodObject ? keyof TSchema["shape"] & string : keyof z.output<TSchema> & string;
2547
2524
  declare const createUniqueArraySchema: CreateUniqueArraySchema;
2548
- declare const NIL = "00000000-0000-0000-0000-000000000000";
2549
2525
  declare const UUIDV4_REGEX: RegExp;
2550
2526
  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 };
2527
+ 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, UUIDV4_REGEX, UUID_LENGTH, UniqueArraySchemaKey, WithMetadata, WordFilteredError, applyItemMetadataMixin, capitalize, checkIsPlainObject, chunk, chunkBySerializedSize, classifyMentions, createExponentialBackoff, createItemEntityTypeSchema, createNormalizedStringSchema, createUniqueArraySchema, css, encodeUrlSubDelimiters, exhaustiveGuard, getIsServer, getMentions, getOrCreate, getPropertyNames, getRawData, getResult, getResultAsync, hrtime, html, itemMetadataSchema, jsonDateParse, mergeObjectsStrict, noop, normalizeString, now, sanitizeHtml, sanitizeTextHtml, settleAll, sleep, streamToText, takeOne, toAppError, toKebabCase, toRawDeep, truncate, uncapitalize, uuidValidateV4, withFinalizer, withFinalizerAsync };