@esposter/shared 2.38.0 → 2.38.1

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 +328 -687
  2. package/dist/index.js +127 -13930
  3. package/package.json +19 -6
package/dist/index.d.ts CHANGED
@@ -1,13 +1,20 @@
1
1
  import { z } from "zod";
2
+ import { Result, ResultAsync } from "neverthrow";
3
+ import { HTMLElement } from "node-html-parser";
2
4
  import baseSanitizeHtml from "sanitize-html";
3
- export declare const AllSpecialValues: {
5
+ //#region src/test/constants.d.ts
6
+ declare const AllSpecialValues: {
4
7
  isPlainObject: boolean;
5
8
  value: unknown;
6
9
  }[];
7
- export declare class ForbiddenError extends Error {
10
+ //#endregion
11
+ //#region src/models/error/ForbiddenError.d.ts
12
+ declare class ForbiddenError extends Error {
8
13
  constructor(message: string);
9
14
  }
10
- export declare enum Operation {
15
+ //#endregion
16
+ //#region src/models/shared/Operation.d.ts
17
+ declare enum Operation {
11
18
  Create = "Create",
12
19
  Delete = "Delete",
13
20
  Push = "Push",
@@ -15,28 +22,42 @@ export declare enum Operation {
15
22
  Unshift = "Unshift",
16
23
  Update = "Update"
17
24
  }
18
- export declare class InvalidOperationError extends Error {
25
+ //#endregion
26
+ //#region src/models/error/InvalidOperationError.d.ts
27
+ declare class InvalidOperationError extends Error {
19
28
  constructor(operation: Operation, name: string, message: string);
20
29
  }
21
- export declare class NotFoundError<T extends string = string> extends Error {
30
+ //#endregion
31
+ //#region src/models/error/NotFoundError.d.ts
32
+ declare class NotFoundError<T extends string = string> extends Error {
22
33
  constructor(name: T, id: string);
23
34
  }
24
- export declare class NotInitializedError<T extends string = string> extends Error {
35
+ //#endregion
36
+ //#region src/models/error/NotInitializedError.d.ts
37
+ declare class NotInitializedError<T extends string = string> extends Error {
25
38
  constructor(name: T);
26
39
  }
27
- export declare class WordFilteredError extends Error {
40
+ //#endregion
41
+ //#region src/models/error/WordFilteredError.d.ts
42
+ declare class WordFilteredError extends Error {
28
43
  constructor(message: string);
29
44
  }
30
- export interface ClassifiedMentions {
45
+ //#endregion
46
+ //#region src/models/message/ClassifiedMentions.d.ts
47
+ interface ClassifiedMentions {
31
48
  broadcastIds: string[];
32
49
  regularUserIds: string[];
33
50
  roleIds: string[];
34
51
  }
35
- export declare enum MentionType {
52
+ //#endregion
53
+ //#region src/models/message/MentionType.d.ts
54
+ declare enum MentionType {
36
55
  Role = "role",
37
56
  User = "user"
38
57
  }
39
- export declare const RoutePath: {
58
+ //#endregion
59
+ //#region src/models/router/RoutePath.d.ts
60
+ declare const RoutePath: {
40
61
  readonly About: "/about";
41
62
  readonly Achievements: "/achievements";
42
63
  readonly Anime: "/anime";
@@ -74,59 +95,85 @@ export declare const RoutePath: {
74
95
  readonly UserSettings: "/user/settings";
75
96
  readonly View: (type: string, id: string) => string;
76
97
  };
77
- export type RoutePath = typeof RoutePath;
78
- export 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) | {
98
+ type RoutePath = typeof RoutePath;
99
+ //#endregion
100
+ //#region src/util/types/GetArrayProps.d.ts
101
+ 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) | {
79
102
  path: R extends true ? "length" : `${P}.length`;
80
103
  value: T["length"];
81
104
  };
82
- export type KnownKeys<T> = { [K in keyof T as string extends K ? never : number extends K ? never : K]: T[K]; };
83
- export 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) | {
105
+ //#endregion
106
+ //#region src/util/types/KnownKeys.d.ts
107
+ type KnownKeys<T> = { [K in keyof T as string extends K ? never : number extends K ? never : K]: T[K]; };
108
+ //#endregion
109
+ //#region src/util/types/GetObjectProps.d.ts
110
+ 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) | {
84
111
  path: R extends true ? `${K}` : `${P}.${K}`;
85
112
  value: T[K];
86
113
  }; }[keyof KnownKeys<T> & (number | string)];
87
- export type GetPrimitiveProps<T, P extends string, D extends unknown[], R extends boolean> = T extends string ? {
114
+ //#endregion
115
+ //#region src/util/types/GetPrimitiveProps.d.ts
116
+ type GetPrimitiveProps<T, P extends string, D extends unknown[], R extends boolean> = T extends string ? {
88
117
  path: R extends true ? "length" : `${P}.length`;
89
118
  value: number;
90
119
  } : T extends symbol ? (D extends [unknown, ...infer Rest] ? GetProperties<string | undefined, R extends true ? "description" : `${P}.description`, Rest, false> : never) | {
91
120
  path: R extends true ? "description" : `${P}.description`;
92
121
  value: string | undefined;
93
122
  } : never;
94
- export 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;
95
- export type GetPaths<T> = GetProperties<T> extends (infer U) ? (U extends {
123
+ //#endregion
124
+ //#region src/util/types/GetProperties.d.ts
125
+ 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;
126
+ //#endregion
127
+ //#region src/util/types/GetPaths.d.ts
128
+ type GetPaths<T> = GetProperties<T> extends (infer U) ? (U extends {
96
129
  path: infer Path;
97
130
  } ? Path : never) : never;
98
- export type PropertyNames<T> = { [P in GetPaths<T>]: P; };
99
- export interface ItemEntityType<T extends string> {
131
+ //#endregion
132
+ //#region src/util/types/PropertyNames.d.ts
133
+ type PropertyNames<T> = { [P in GetPaths<T>]: P; };
134
+ //#endregion
135
+ //#region src/models/shared/ItemEntityType.d.ts
136
+ interface ItemEntityType<T extends string> {
100
137
  type: T;
101
138
  }
102
- export declare const ItemEntityTypePropertyNames: PropertyNames<ItemEntityType<string>>;
103
- export declare const createItemEntityTypeSchema: <T extends z.ZodType<string>>(schema: T) => z.ZodObject<{
139
+ declare const ItemEntityTypePropertyNames: PropertyNames<ItemEntityType<string>>;
140
+ declare const createItemEntityTypeSchema: <T extends z.ZodType<string>>(schema: T) => z.ZodObject<{
104
141
  type: T;
105
142
  }>;
106
- export declare class ItemMetadata {
143
+ //#endregion
144
+ //#region src/models/shared/ItemMetadata.d.ts
145
+ declare class ItemMetadata {
107
146
  createdAt: Date;
108
147
  deletedAt: Date | null;
109
148
  updatedAt: Date;
110
149
  }
111
- export declare const ItemMetadataPropertyNames: PropertyNames<ItemMetadata>;
112
- export declare const itemMetadataSchema: z.ZodObject<{
150
+ declare const ItemMetadataPropertyNames: PropertyNames<ItemMetadata>;
151
+ declare const itemMetadataSchema: z.ZodObject<{
113
152
  createdAt: z.ZodDate;
114
153
  deletedAt: z.ZodNullable<z.ZodDate>;
115
154
  updatedAt: z.ZodDate;
116
155
  }>;
117
- export declare abstract class Serializable {
156
+ //#endregion
157
+ //#region src/models/shared/Serializable.d.ts
158
+ declare abstract class Serializable {
118
159
  toJSON(): this;
119
160
  }
120
- export interface TakeOne {
161
+ //#endregion
162
+ //#region src/models/shared/TakeOne.d.ts
163
+ interface TakeOne {
121
164
  <T extends readonly unknown[]>(values: T, index?: number): T[number];
122
165
  <T extends object | Record<PropertyKey, unknown>>(values: T, index: keyof T): T[keyof T];
123
166
  }
167
+ //#endregion
168
+ //#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/primitive.d.ts
124
169
  /**
125
170
  Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
126
171
 
127
172
  @category Type
128
173
  */
129
174
  type Primitive = null | undefined | string | number | boolean | symbol | bigint;
175
+ //#endregion
176
+ //#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/basic.d.ts
130
177
  /**
131
178
  Matches a [`class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes).
132
179
 
@@ -136,6 +183,8 @@ type Class<T, Arguments extends unknown[] = any[]> = {
136
183
  prototype: Pick<T, keyof T>;
137
184
  new (...arguments_: Arguments): T;
138
185
  };
186
+ //#endregion
187
+ //#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/is-any.d.ts
139
188
  /**
140
189
  Returns a boolean for whether the given type is `any`.
141
190
 
@@ -165,6 +214,8 @@ const anyA = get(anyObject, 'a');
165
214
  @category Utilities
166
215
  */
167
216
  type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;
217
+ //#endregion
218
+ //#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/is-optional-key-of.d.ts
168
219
  /**
169
220
  Returns a boolean for whether the given key is an optional key of type.
170
221
 
@@ -206,6 +257,8 @@ type T5 = IsOptionalKeyOf<User | Admin, 'surname'>;
206
257
  @category Utilities
207
258
  */
208
259
  type IsOptionalKeyOf<Type extends object, Key extends keyof Type> = IsAny<Type | Key> extends true ? never : Key extends keyof Type ? Type extends Record<Key, Type[Key]> ? false : true : false;
260
+ //#endregion
261
+ //#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/optional-keys-of.d.ts
209
262
  /**
210
263
  Extract all optional keys from the given type.
211
264
 
@@ -242,6 +295,8 @@ const update2: UpdateOperation<User> = {
242
295
  type OptionalKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
243
296
  ? (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`
244
297
  : never; // Should never happen
298
+ //#endregion
299
+ //#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/required-keys-of.d.ts
245
300
  /**
246
301
  Extract all required keys from the given type.
247
302
 
@@ -274,6 +329,8 @@ const validator3 = createValidation<User>('luckyNumber', value => value > 0);
274
329
  */
275
330
  type RequiredKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
276
331
  ? Exclude<keyof Type, OptionalKeysOf<Type>> : never; // Should never happen
332
+ //#endregion
333
+ //#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/is-never.d.ts
277
334
  /**
278
335
  Returns a boolean for whether the given type is `never`.
279
336
 
@@ -328,6 +385,8 @@ type B = IsTrueFixed<never>;
328
385
  @category Utilities
329
386
  */
330
387
  type IsNever<T> = [T] extends [never] ? true : false;
388
+ //#endregion
389
+ //#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/if.d.ts
331
390
  /**
332
391
  An if-else-like type that resolves depending on whether the given `boolean` type is `true` or `false`.
333
392
 
@@ -421,6 +480,8 @@ type Works = IncludesWithoutIf<HundredZeroes, '1'>;
421
480
  @category Utilities
422
481
  */
423
482
  type If<Type extends boolean, IfBranch, ElseBranch> = IsNever<Type> extends true ? ElseBranch : Type extends true ? IfBranch : ElseBranch;
483
+ //#endregion
484
+ //#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/unknown-array.d.ts
424
485
  /**
425
486
  Represents an array with `unknown` value.
426
487
 
@@ -446,6 +507,8 @@ type C = IsArray<string>;
446
507
  @category Array
447
508
  */
448
509
  type UnknownArray = readonly unknown[];
510
+ //#endregion
511
+ //#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/internal/type.d.ts
449
512
  /**
450
513
  Returns a boolean for whether A is false.
451
514
 
@@ -512,6 +575,8 @@ type IfNotAnyOrNever<T, Cases extends {
512
575
  Indicates the value of `exactOptionalPropertyTypes` compiler option.
513
576
  */
514
577
  type IsExactOptionalPropertyTypesEnabled = [(string | undefined)?] extends [string?] ? false : true;
578
+ //#endregion
579
+ //#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/internal/array.d.ts
515
580
  /**
516
581
  Transforms a tuple type by replacing it's rest element with a single element that has the same type as the rest element, while keeping all the non-rest elements intact.
517
582
 
@@ -555,6 +620,8 @@ TArray extends readonly [...infer Rest, infer Last] ? _CollapseRestElement<Rest,
555
620
  : 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.
556
621
  : First], BackwardAccumulator> : never // Should never happen, since `[(infer First)?, ...infer Rest]` is a top-type for arrays.
557
622
  : never; // Should never happen
623
+ //#endregion
624
+ //#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/internal/characters.d.ts
558
625
  type Whitespace = '\t' // '\t'
559
626
  | '\n' // '\n'
560
627
  | '\v' // '\v'
@@ -564,7 +631,11 @@ type Whitespace = '\t' // '\t'
564
631
  | '…' | ' ' | ' ' | ' ' | ' ' | ' ' | ' ' | ' ' | ' ' | ' ' | ' ' | ' ' | ' ' | ' ' | '
' | '
' | ' ' | ' ' | ' ' | '';
565
632
  type WordSeparators = '-' | '_' | Whitespace;
566
633
  type AsciiPunctuation = '!' | '"' | '#' | '$' | '%' | '&' | '\'' | '(' | ')' | '*' | '+' | ',' | '-' | '.' | '/' | ':' | ';' | '<' | '=' | '>' | '?' | '@' | '[' | '\\' | ']' | '^' | '_' | '`' | '{' | '|' | '}' | '~';
634
+ //#endregion
635
+ //#region ../../node_modules/.pnpm/tagged-tag@1.0.0/node_modules/tagged-tag/index.d.ts
567
636
  declare const tag: unique symbol;
637
+ //#endregion
638
+ //#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/tagged.d.ts
568
639
  // eslint-disable-next-line type-fest/require-exported-types
569
640
  type TagContainer<Token> = {
570
641
  readonly [tag]: Token;
@@ -661,6 +732,8 @@ type WontWork = UnwrapTagged<string>;
661
732
  */
662
733
  type UnwrapTagged<TaggedType extends Tag<PropertyKey, any>> = RemoveAllTags<TaggedType>;
663
734
  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;
735
+ //#endregion
736
+ //#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/is-literal.d.ts
664
737
  /**
665
738
  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).
666
739
 
@@ -726,6 +799,8 @@ type _IsStringLiteral<S> =
726
799
  // If `T` is an infinite string type (e.g., `on${string}`), `Record<T, never>` produces an index signature,
727
800
  // and since `{}` extends index signatures, the result becomes `false`.
728
801
  S extends string ? {} extends Record<S, never> ? false : true : false;
802
+ //#endregion
803
+ //#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/trim.d.ts
729
804
  /**
730
805
  Remove spaces from the left side.
731
806
  */
@@ -749,6 +824,8 @@ type Example = Trim<' foo '>;
749
824
  @category Template literal
750
825
  */
751
826
  type Trim<V extends string> = TrimLeft<TrimRight<V>>;
827
+ //#endregion
828
+ //#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/simplify.d.ts
752
829
  /**
753
830
  Useful to flatten the type output to improve type hints shown in editors. And also to transform an interface into a type to aide with assignability.
754
831
 
@@ -808,6 +885,8 @@ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface`
808
885
  @category Object
809
886
  */
810
887
  type Simplify<T> = { [KeyType in keyof T]: T[KeyType]; } & {};
888
+ //#endregion
889
+ //#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/is-equal.d.ts
811
890
  /**
812
891
  Returns a boolean for whether the two given types are equal.
813
892
 
@@ -837,6 +916,8 @@ type Includes<Value extends readonly any[], Item> =
837
916
  type IsEqual<A, B> = [A] extends [B] ? [B] extends [A] ? _IsEqual<A, B> : false : false;
838
917
  // This version fails the `equalWrappedTupleIntersectionToBeNeverAndNeverExpanded` test in `test-d/is-equal.ts`.
839
918
  type _IsEqual<A, B> = (<G>() => G extends A & G | G ? 1 : 2) extends (<G>() => G extends B & G | G ? 1 : 2) ? true : false;
919
+ //#endregion
920
+ //#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/omit-index-signature.d.ts
840
921
  /**
841
922
  Omit any index signatures from the given object type, leaving only explicitly defined properties.
842
923
 
@@ -929,6 +1010,8 @@ type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
929
1010
  @category Object
930
1011
  */
931
1012
  type OmitIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType]; };
1013
+ //#endregion
1014
+ //#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/pick-index-signature.d.ts
932
1015
  /**
933
1016
  Pick only index signatures from the given object type, leaving out all explicitly defined properties.
934
1017
 
@@ -975,6 +1058,8 @@ type ExampleIndexSignature = PickIndexSignature<Example>;
975
1058
  @category Object
976
1059
  */
977
1060
  type PickIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? KeyType : never]: ObjectType[KeyType]; };
1061
+ //#endregion
1062
+ //#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/merge.d.ts
978
1063
  // Merges two objects without worrying about index signatures.
979
1064
  type SimpleMerge<Destination, Source> = Simplify<{ [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key]; } & Source>;
980
1065
  /**
@@ -1044,6 +1129,8 @@ type Merge<Destination, Source> = Destination extends unknown // For distributin
1044
1129
  ? If<IsEqual<Destination, Source>, Destination, _Merge<Destination, Source>> : never // Should never happen
1045
1130
  : never; // Should never happen
1046
1131
  type _Merge<Destination, Source> = Simplify<SimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>> & SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>>;
1132
+ //#endregion
1133
+ //#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/internal/object.d.ts
1047
1134
  /**
1048
1135
  Merges user specified options with default options.
1049
1136
 
@@ -1127,6 +1214,8 @@ type E = CollapseLiterals<LiteralUnion<'foo' | 'bar', string> | null | undefined
1127
1214
  ```
1128
1215
  */
1129
1216
  type CollapseLiterals<T> = {} extends T ? T : T extends (infer U) & {} ? U : T;
1217
+ //#endregion
1218
+ //#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/some-extend.d.ts
1130
1219
  /**
1131
1220
  @see {@link SomeExtend}
1132
1221
  */
@@ -1221,6 +1310,8 @@ type _SomeExtend<TArray extends UnknownArray, Type, Options extends Required<Som
1221
1310
  ifAny: false;
1222
1311
  ifNever: false;
1223
1312
  }>;
1313
+ //#endregion
1314
+ //#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/or-all.d.ts
1224
1315
  /**
1225
1316
  Returns a boolean for whether any of the given elements is `true`.
1226
1317
 
@@ -1290,6 +1381,8 @@ Note: `OrAll<[]>` evaluates to `false` because there are no `true` elements in a
1290
1381
  @see {@link AndAll}
1291
1382
  */
1292
1383
  type OrAll<T extends readonly boolean[]> = SomeExtend<T, true>;
1384
+ //#endregion
1385
+ //#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/or.d.ts
1293
1386
  /**
1294
1387
  Returns a boolean for whether either of two given types is `true`.
1295
1388
 
@@ -1368,6 +1461,8 @@ type G = Or<never, never>;
1368
1461
  @see {@link Xor}
1369
1462
  */
1370
1463
  type Or<A extends boolean, B extends boolean> = OrAll<[A, B]>;
1464
+ //#endregion
1465
+ //#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/internal/string.d.ts
1371
1466
  /**
1372
1467
  Returns a boolean for whether the given string `S` starts with the given string `SearchString`.
1373
1468
 
@@ -1396,6 +1491,8 @@ Returns a boolean for whether the string is numeric.
1396
1491
  This type is a workaround for [Microsoft/TypeScript#46109](https://github.com/microsoft/TypeScript/issues/46109#issuecomment-930307987).
1397
1492
  */
1398
1493
  type IsNumeric<T extends string> = T extends `${number}` ? Trim<T> extends T ? true : false : false;
1494
+ //#endregion
1495
+ //#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/all-extend.d.ts
1399
1496
  /**
1400
1497
  @see {@link AllExtend}
1401
1498
  */
@@ -1496,6 +1593,8 @@ type _AllExtend<TArray extends UnknownArray, Type, Options extends Required<AllE
1496
1593
  ifAny: false;
1497
1594
  ifNever: false;
1498
1595
  }>;
1596
+ //#endregion
1597
+ //#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/except.d.ts
1499
1598
  /**
1500
1599
  Filter out keys from an object.
1501
1600
 
@@ -1594,6 +1693,8 @@ type PostPayloadFixed = Except<UserData, 'email'>;
1594
1693
  */
1595
1694
  type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {}> = _Except<ObjectType, KeysType, ApplyDefaultOptions<ExceptOptions, DefaultExceptOptions, Options>>;
1596
1695
  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>> : {});
1696
+ //#endregion
1697
+ //#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/promisable.d.ts
1597
1698
  /**
1598
1699
  Create a type that represents either the value or the value wrapped in `PromiseLike`.
1599
1700
 
@@ -1619,6 +1720,8 @@ await logger(() => Promise.resolve('bar'));
1619
1720
  @category Async
1620
1721
  */
1621
1722
  type Promisable<T> = T | PromiseLike<T>;
1723
+ //#endregion
1724
+ //#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/is-lowercase.d.ts
1622
1725
  /**
1623
1726
  Returns a boolean for whether the given string literal is lowercase.
1624
1727
 
@@ -1645,6 +1748,8 @@ type _IsLowercase<S extends string, Accumulator extends boolean[] = []> = S exte
1645
1748
  Returns a boolean for whether an individual part of the string is lowercase.
1646
1749
  */
1647
1750
  type IsLowercaseHelper<S extends string> = S extends Lowercase<string> ? true : S extends Uppercase<string> | Capitalize<string> | `${string}${Uppercase<string>}${string}` ? false : boolean;
1751
+ //#endregion
1752
+ //#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/is-uppercase.d.ts
1648
1753
  /**
1649
1754
  Returns a boolean for whether the given string literal is uppercase.
1650
1755
 
@@ -1671,6 +1776,8 @@ type _IsUppercase<S extends string, Accumulator extends boolean[] = []> = S exte
1671
1776
  Returns a boolean for whether an individual part of the string is uppercase.
1672
1777
  */
1673
1778
  type IsUppercaseHelper<S extends string> = S extends Uppercase<string> ? true : S extends Lowercase<string> | Uncapitalize<string> | `${string}${Lowercase<string>}${string}` ? false : boolean;
1779
+ //#endregion
1780
+ //#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/words.d.ts
1674
1781
  type SkipEmptyWord<Word extends string> = Word extends '' ? [] : [Word];
1675
1782
  type RemoveLastCharacter<Sentence extends string, Character extends string> = Sentence extends `${infer LeftSide}${Character}` ? SkipEmptyWord<LeftSide> : never;
1676
1783
  /**
@@ -1785,6 +1892,8 @@ WordsImplementation<RemainingCharacters, Options, FirstCharacter, `${CurrentWord
1785
1892
  [true, true] extends [IsUppercase<LastCharacter>, IsLowercase<FirstCharacter>] ? [...RemoveLastCharacter<CurrentWord, LastCharacter>, ...WordsImplementation<RemainingCharacters, Options, FirstCharacter, `${LastCharacter}${FirstCharacter}`>] :
1786
1893
  // No case change: concat word
1787
1894
  WordsImplementation<RemainingCharacters, Options, FirstCharacter, `${CurrentWord}${FirstCharacter}`> : [...SkipEmptyWord<CurrentWord>];
1895
+ //#endregion
1896
+ //#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/delimiter-case.d.ts
1788
1897
  type _DefaultDelimiterCaseOptions = Merge<_DefaultWordsOptions, {
1789
1898
  splitOnNumbers: false;
1790
1899
  }>;
@@ -1834,6 +1943,8 @@ const rawCliOptions: OddlyCasedProperties<SomeOptions> = {
1834
1943
  */
1835
1944
  type DelimiterCase<Value, Delimiter extends string, Options extends WordsOptions = {}> = Value extends string ? Delimiter extends string // For distributing `Delimiter`
1836
1945
  ? IsStringLiteral<Value> extends false ? Value : Lowercase<DelimiterCaseFromArray<Words<Value, ApplyDefaultOptions<WordsOptions, _DefaultDelimiterCaseOptions, Options>>, Delimiter>> : never : Value;
1946
+ //#endregion
1947
+ //#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/kebab-case.d.ts
1837
1948
  /**
1838
1949
  Convert a string literal to kebab-case.
1839
1950
 
@@ -1872,667 +1983,197 @@ const rawCliOptions: KebabCasedProperties<CliOptions> = {
1872
1983
  @category Template literal
1873
1984
  */
1874
1985
  type KebabCase<Value, Options extends WordsOptions = {}> = DelimiterCase<Value, '-', ApplyDefaultOptions<WordsOptions, _DefaultDelimiterCaseOptions, Options>>;
1875
- export 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;
1876
- export 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;
1877
- export type ToData<T> = DeepOptionalUndefined<DeepOmit<T, "toJSON">>;
1878
- export interface WithMetadata<TBase extends Class<NonNullable<unknown>>> {
1986
+ //#endregion
1987
+ //#region src/util/types/DeepOmit.d.ts
1988
+ 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;
1989
+ //#endregion
1990
+ //#region src/util/types/DeepOptionalUndefined.d.ts
1991
+ 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;
1992
+ //#endregion
1993
+ //#region src/models/shared/ToData.d.ts
1994
+ type ToData<T> = DeepOptionalUndefined<DeepOmit<T, "toJSON">>;
1995
+ //#endregion
1996
+ //#region src/models/shared/WithMetadata.d.ts
1997
+ interface WithMetadata<TBase extends Class<NonNullable<unknown>>> {
1879
1998
  new (...args: ConstructorParameters<TBase>): InstanceType<TBase> & ItemMetadata;
1880
1999
  prototype: InstanceType<TBase> & ItemMetadata;
1881
2000
  }
1882
- export declare const MAX_READ_LIMIT = 1e3;
1883
- export declare const SITE_NAME = "Esposter";
1884
- export declare const KIBIBYTE: number;
1885
- export declare const MEGABYTE: number;
1886
- export declare const GIBIBYTE: number;
1887
- export declare const createExponentialBackoff: (baseDelayMs: number, maxDelayMs: number) => (<T>(operation: () => Promise<T>) => Promise<T>);
1888
- interface ErrorConfig {
1889
- withStackTrace: boolean;
1890
- }
1891
- declare class ResultAsync<T, E> implements PromiseLike<Result<T, E>> {
1892
- private _promise;
1893
- constructor(res: Promise<Result<T, E>>);
1894
- static fromSafePromise<T, E = never>(promise: PromiseLike<T>): ResultAsync<T, E>;
1895
- static fromPromise<T, E>(promise: PromiseLike<T>, errorFn: (e: unknown) => E): ResultAsync<T, E>;
1896
- static fromThrowable<A extends readonly any[], R, E>(fn: (...args: A) => Promise<R>, errorFn?: (err: unknown) => E): (...args: A) => ResultAsync<R, E>;
1897
- static combine<T extends readonly [ResultAsync<unknown, unknown>, ...ResultAsync<unknown, unknown>[]]>(asyncResultList: T): CombineResultAsyncs<T>;
1898
- static combine<T extends readonly ResultAsync<unknown, unknown>[]>(asyncResultList: T): CombineResultAsyncs<T>;
1899
- static combineWithAllErrors<T extends readonly [ResultAsync<unknown, unknown>, ...ResultAsync<unknown, unknown>[]]>(asyncResultList: T): CombineResultsWithAllErrorsArrayAsync<T>;
1900
- static combineWithAllErrors<T extends readonly ResultAsync<unknown, unknown>[]>(asyncResultList: T): CombineResultsWithAllErrorsArrayAsync<T>;
1901
- map<A>(f: (t: T) => A | Promise<A>): ResultAsync<A, E>;
1902
- andThrough<F>(f: (t: T) => Result<unknown, F> | ResultAsync<unknown, F>): ResultAsync<T, E | F>;
1903
- andTee(f: (t: T) => unknown): ResultAsync<T, E>;
1904
- orTee(f: (t: E) => unknown): ResultAsync<T, E>;
1905
- mapErr<U>(f: (e: E) => U | Promise<U>): ResultAsync<T, U>;
1906
- andThen<R extends Result<unknown, unknown>>(f: (t: T) => R): ResultAsync<InferOkTypes<R>, InferErrTypes<R> | E>;
1907
- andThen<R extends ResultAsync<unknown, unknown>>(f: (t: T) => R): ResultAsync<InferAsyncOkTypes<R>, InferAsyncErrTypes<R> | E>;
1908
- andThen<U, F>(f: (t: T) => Result<U, F> | ResultAsync<U, F>): ResultAsync<U, E | F>;
1909
- orElse<R extends Result<unknown, unknown>>(f: (e: E) => R): ResultAsync<InferOkTypes<R> | T, InferErrTypes<R>>;
1910
- orElse<R extends ResultAsync<unknown, unknown>>(f: (e: E) => R): ResultAsync<InferAsyncOkTypes<R> | T, InferAsyncErrTypes<R>>;
1911
- orElse<U, A>(f: (e: E) => Result<U, A> | ResultAsync<U, A>): ResultAsync<U | T, A>;
1912
- match<A, B = A>(ok: (t: T) => A, _err: (e: E) => B): Promise<A | B>;
1913
- unwrapOr<A>(t: A): Promise<T | A>;
1914
- /**
1915
- * @deprecated will be removed in 9.0.0.
1916
- *
1917
- * You can use `safeTry` without this method.
1918
- * @example
1919
- * ```typescript
1920
- * safeTry(async function* () {
1921
- * const okValue = yield* yourResult
1922
- * })
1923
- * ```
1924
- * Emulates Rust's `?` operator in `safeTry`'s body. See also `safeTry`.
1925
- */
1926
- safeUnwrap(): AsyncGenerator<Err<never, E>, T>;
1927
- then<A, B>(successCallback?: (res: Result<T, E>) => A | PromiseLike<A>, failureCallback?: (reason: unknown) => B | PromiseLike<B>): PromiseLike<A | B>;
1928
- [Symbol.asyncIterator](): AsyncGenerator<Err<never, E>, T>;
1929
- }
1930
- declare type CombineResultAsyncs<T extends readonly ResultAsync<unknown, unknown>[]> = IsLiteralArray<T> extends 1 ? TraverseAsync<UnwrapAsync<T>> : ResultAsync<ExtractOkAsyncTypes<T>, ExtractErrAsyncTypes<T>[number]>;
1931
- declare type CombineResultsWithAllErrorsArrayAsync<T extends readonly ResultAsync<unknown, unknown>[]> = IsLiteralArray<T> extends 1 ? TraverseWithAllErrorsAsync<UnwrapAsync<T>> : ResultAsync<ExtractOkAsyncTypes<T>, ExtractErrAsyncTypes<T>[number][]>;
1932
- declare type UnwrapAsync<T> = IsLiteralArray<T> extends 1 ? Writable<T> extends [infer H, ...infer Rest] ? H extends PromiseLike<infer HI> ? HI extends Result<unknown, unknown> ? [Dedup<HI>, ...UnwrapAsync<Rest>] : never : never : [] : T extends Array<infer A> ? A extends PromiseLike<infer HI> ? HI extends Result<infer L, infer R> ? Ok<L, R>[] : never : never : never;
1933
- 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;
1934
- declare type TraverseWithAllErrorsAsync<T, Depth extends number = 5> = TraverseAsync<T, Depth> extends ResultAsync<infer Oks, infer Errs> ? ResultAsync<Oks, Errs[]> : never;
1935
- declare type Writable<T> = T extends ReadonlyArray<unknown> ? [...T] : T;
1936
- declare type ExtractOkTypes<T extends readonly Result<unknown, unknown>[]> = { [idx in keyof T]: T[idx] extends Result<infer U, unknown> ? U : never; };
1937
- declare type ExtractOkAsyncTypes<T extends readonly ResultAsync<unknown, unknown>[]> = { [idx in keyof T]: T[idx] extends ResultAsync<infer U, unknown> ? U : never; };
1938
- declare type ExtractErrTypes<T extends readonly Result<unknown, unknown>[]> = { [idx in keyof T]: T[idx] extends Result<unknown, infer E> ? E : never; };
1939
- declare type ExtractErrAsyncTypes<T extends readonly ResultAsync<unknown, unknown>[]> = { [idx in keyof T]: T[idx] extends ResultAsync<unknown, infer E> ? E : never; };
1940
- declare type InferOkTypes<R> = R extends Result<infer T, unknown> ? T : never;
1941
- declare type InferErrTypes<R> = R extends Result<unknown, infer E> ? E : never;
1942
- declare type InferAsyncOkTypes<R> = R extends ResultAsync<infer T, unknown> ? T : never;
1943
- declare type InferAsyncErrTypes<R> = R extends ResultAsync<unknown, infer E> ? E : never;
1944
- declare namespace Result {
1945
- /**
1946
- * Wraps a function with a try catch, creating a new function with the same
1947
- * arguments but returning `Ok` if successful, `Err` if the function throws
1948
- *
1949
- * @param fn function to wrap with ok on success or err on failure
1950
- * @param errorFn when an error is thrown, this will wrap the error result if provided
1951
- */
1952
- function fromThrowable<Fn extends (...args: readonly any[]) => any, E>(fn: Fn, errorFn?: (e: unknown) => E): (...args: Parameters<Fn>) => Result<ReturnType<Fn>, E>;
1953
- function combine<T extends readonly [Result<unknown, unknown>, ...Result<unknown, unknown>[]]>(resultList: T): CombineResults<T>;
1954
- function combine<T extends readonly Result<unknown, unknown>[]>(resultList: T): CombineResults<T>;
1955
- function combineWithAllErrors<T extends readonly [Result<unknown, unknown>, ...Result<unknown, unknown>[]]>(resultList: T): CombineResultsWithAllErrorsArray<T>;
1956
- function combineWithAllErrors<T extends readonly Result<unknown, unknown>[]>(resultList: T): CombineResultsWithAllErrorsArray<T>;
1957
- }
1958
- declare type Result<T, E> = Ok<T, E> | Err<T, E>;
1959
- interface IResult<T, E> {
1960
- /**
1961
- * Used to check if a `Result` is an `OK`
1962
- *
1963
- * @returns `true` if the result is an `OK` variant of Result
1964
- */
1965
- isOk(): this is Ok<T, E>;
1966
- /**
1967
- * Used to check if a `Result` is an `Err`
1968
- *
1969
- * @returns `true` if the result is an `Err` variant of Result
1970
- */
1971
- isErr(): this is Err<T, E>;
1972
- /**
1973
- * Maps a `Result<T, E>` to `Result<U, E>`
1974
- * by applying a function to a contained `Ok` value, leaving an `Err` value
1975
- * untouched.
1976
- *
1977
- * @param f The function to apply an `OK` value
1978
- * @returns the result of applying `f` or an `Err` untouched
1979
- */
1980
- map<A>(f: (t: T) => A): Result<A, E>;
1981
- /**
1982
- * Maps a `Result<T, E>` to `Result<T, F>` by applying a function to a
1983
- * contained `Err` value, leaving an `Ok` value untouched.
1984
- *
1985
- * This function can be used to pass through a successful result while
1986
- * handling an error.
1987
- *
1988
- * @param f a function to apply to the error `Err` value
1989
- */
1990
- mapErr<U>(f: (e: E) => U): Result<T, U>;
1991
- /**
1992
- * Similar to `map` Except you must return a new `Result`.
1993
- *
1994
- * This is useful for when you need to do a subsequent computation using the
1995
- * inner `T` value, but that computation might fail.
1996
- * Additionally, `andThen` is really useful as a tool to flatten a
1997
- * `Result<Result<A, E2>, E1>` into a `Result<A, E2>` (see example below).
1998
- *
1999
- * @param f The function to apply to the current value
2000
- */
2001
- andThen<R extends Result<unknown, unknown>>(f: (t: T) => R): Result<InferOkTypes<R>, InferErrTypes<R> | E>;
2002
- andThen<U, F>(f: (t: T) => Result<U, F>): Result<U, E | F>;
2003
- /**
2004
- * This "tee"s the current value to an passed-in computation such as side
2005
- * effect functions but still returns the same current value as the result.
2006
- *
2007
- * This is useful when you want to pass the current result to your side-track
2008
- * work such as logging but want to continue main-track work after that.
2009
- * This method does not care about the result of the passed in computation.
2010
- *
2011
- * @param f The function to apply to the current value
2012
- */
2013
- andTee(f: (t: T) => unknown): Result<T, E>;
2014
- /**
2015
- * This "tee"s the current `Err` value to an passed-in computation such as side
2016
- * effect functions but still returns the same `Err` value as the result.
2017
- *
2018
- * This is useful when you want to pass the current `Err` value to your side-track
2019
- * work such as logging but want to continue error-track work after that.
2020
- * This method does not care about the result of the passed in computation.
2021
- *
2022
- * @param f The function to apply to the current `Err` value
2023
- */
2024
- orTee(f: (t: E) => unknown): Result<T, E>;
2025
- /**
2026
- * Similar to `andTee` except error result of the computation will be passed
2027
- * to the downstream in case of an error.
2028
- *
2029
- * This version is useful when you want to make side-effects but in case of an
2030
- * error, you want to pass the error to the downstream.
2031
- *
2032
- * @param f The function to apply to the current value
2033
- */
2034
- andThrough<R extends Result<unknown, unknown>>(f: (t: T) => R): Result<T, InferErrTypes<R> | E>;
2035
- andThrough<F>(f: (t: T) => Result<unknown, F>): Result<T, E | F>;
2036
- /**
2037
- * Takes an `Err` value and maps it to a `Result<T, SomeNewType>`.
2038
- *
2039
- * This is useful for error recovery.
2040
- *
2041
- *
2042
- * @param f A function to apply to an `Err` value, leaving `Ok` values
2043
- * untouched.
2044
- */
2045
- orElse<R extends Result<unknown, unknown>>(f: (e: E) => R): Result<InferOkTypes<R> | T, InferErrTypes<R>>;
2046
- orElse<U, A>(f: (e: E) => Result<U, A>): Result<U | T, A>;
2047
- /**
2048
- * Similar to `map` Except you must return a new `Result`.
2049
- *
2050
- * This is useful for when you need to do a subsequent async computation using
2051
- * the inner `T` value, but that computation might fail. Must return a ResultAsync
2052
- *
2053
- * @param f The function that returns a `ResultAsync` to apply to the current
2054
- * value
2055
- */
2056
- asyncAndThen<U, F>(f: (t: T) => ResultAsync<U, F>): ResultAsync<U, E | F>;
2057
- /**
2058
- * Maps a `Result<T, E>` to `ResultAsync<U, E>`
2059
- * by applying an async function to a contained `Ok` value, leaving an `Err`
2060
- * value untouched.
2061
- *
2062
- * @param f An async function to apply an `OK` value
2063
- */
2064
- asyncMap<U>(f: (t: T) => Promise<U>): ResultAsync<U, E>;
2065
- /**
2066
- * Unwrap the `Ok` value, or return the default if there is an `Err`
2067
- *
2068
- * @param v the default value to return if there is an `Err`
2069
- */
2070
- unwrapOr<A>(v: A): T | A;
2071
- /**
2072
- *
2073
- * Given 2 functions (one for the `Ok` variant and one for the `Err` variant)
2074
- * execute the function that matches the `Result` variant.
2075
- *
2076
- * Match callbacks do not necessitate to return a `Result`, however you can
2077
- * return a `Result` if you want to.
2078
- *
2079
- * `match` is like chaining `map` and `mapErr`, with the distinction that
2080
- * with `match` both functions must have the same return type.
2081
- *
2082
- * @param ok
2083
- * @param err
2084
- */
2085
- match<A, B = A>(ok: (t: T) => A, err: (e: E) => B): A | B;
2086
- /**
2087
- * @deprecated will be removed in 9.0.0.
2088
- *
2089
- * You can use `safeTry` without this method.
2090
- * @example
2091
- * ```typescript
2092
- * safeTry(function* () {
2093
- * const okValue = yield* yourResult
2094
- * })
2095
- * ```
2096
- * Emulates Rust's `?` operator in `safeTry`'s body. See also `safeTry`.
2097
- */
2098
- safeUnwrap(): Generator<Err<never, E>, T>;
2099
- /**
2100
- * **This method is unsafe, and should only be used in a test environments**
2101
- *
2102
- * Takes a `Result<T, E>` and returns a `T` when the result is an `Ok`, otherwise it throws a custom object.
2103
- *
2104
- * @param config
2105
- */
2106
- _unsafeUnwrap(config?: ErrorConfig): T;
2107
- /**
2108
- * **This method is unsafe, and should only be used in a test environments**
2109
- *
2110
- * takes a `Result<T, E>` and returns a `E` when the result is an `Err`,
2111
- * otherwise it throws a custom object.
2112
- *
2113
- * @param config
2114
- */
2115
- _unsafeUnwrapErr(config?: ErrorConfig): E;
2116
- }
2117
- declare class Ok<T, E> implements IResult<T, E> {
2118
- readonly value: T;
2119
- constructor(value: T);
2120
- isOk(): this is Ok<T, E>;
2121
- isErr(): this is Err<T, E>;
2122
- map<A>(f: (t: T) => A): Result<A, E>;
2123
- mapErr<U>(_f: (e: E) => U): Result<T, U>;
2124
- andThen<R extends Result<unknown, unknown>>(f: (t: T) => R): Result<InferOkTypes<R>, InferErrTypes<R> | E>;
2125
- andThen<U, F>(f: (t: T) => Result<U, F>): Result<U, E | F>;
2126
- andThrough<R extends Result<unknown, unknown>>(f: (t: T) => R): Result<T, InferErrTypes<R> | E>;
2127
- andThrough<F>(f: (t: T) => Result<unknown, F>): Result<T, E | F>;
2128
- andTee(f: (t: T) => unknown): Result<T, E>;
2129
- orTee(_f: (t: E) => unknown): Result<T, E>;
2130
- orElse<R extends Result<unknown, unknown>>(_f: (e: E) => R): Result<InferOkTypes<R> | T, InferErrTypes<R>>;
2131
- orElse<U, A>(_f: (e: E) => Result<U, A>): Result<U | T, A>;
2132
- asyncAndThen<U, F>(f: (t: T) => ResultAsync<U, F>): ResultAsync<U, E | F>;
2133
- asyncAndThrough<R extends ResultAsync<unknown, unknown>>(f: (t: T) => R): ResultAsync<T, InferAsyncErrTypes<R> | E>;
2134
- asyncAndThrough<F>(f: (t: T) => ResultAsync<unknown, F>): ResultAsync<T, E | F>;
2135
- asyncMap<U>(f: (t: T) => Promise<U>): ResultAsync<U, E>;
2136
- unwrapOr<A>(_v: A): T | A;
2137
- match<A, B = A>(ok: (t: T) => A, _err: (e: E) => B): A | B;
2138
- safeUnwrap(): Generator<Err<never, E>, T>;
2139
- _unsafeUnwrap(_?: ErrorConfig): T;
2140
- _unsafeUnwrapErr(config?: ErrorConfig): E;
2141
- [Symbol.iterator](): Generator<Err<never, E>, T>;
2142
- }
2143
- declare class Err<T, E> implements IResult<T, E> {
2144
- readonly error: E;
2145
- constructor(error: E);
2146
- isOk(): this is Ok<T, E>;
2147
- isErr(): this is Err<T, E>;
2148
- map<A>(_f: (t: T) => A): Result<A, E>;
2149
- mapErr<U>(f: (e: E) => U): Result<T, U>;
2150
- andThrough<F>(_f: (t: T) => Result<unknown, F>): Result<T, E | F>;
2151
- andTee(_f: (t: T) => unknown): Result<T, E>;
2152
- orTee(f: (t: E) => unknown): Result<T, E>;
2153
- andThen<R extends Result<unknown, unknown>>(_f: (t: T) => R): Result<InferOkTypes<R>, InferErrTypes<R> | E>;
2154
- andThen<U, F>(_f: (t: T) => Result<U, F>): Result<U, E | F>;
2155
- orElse<R extends Result<unknown, unknown>>(f: (e: E) => R): Result<InferOkTypes<R> | T, InferErrTypes<R>>;
2156
- orElse<U, A>(f: (e: E) => Result<U, A>): Result<U | T, A>;
2157
- asyncAndThen<U, F>(_f: (t: T) => ResultAsync<U, F>): ResultAsync<U, E | F>;
2158
- asyncAndThrough<F>(_f: (t: T) => ResultAsync<unknown, F>): ResultAsync<T, E | F>;
2159
- asyncMap<U>(_f: (t: T) => Promise<U>): ResultAsync<U, E>;
2160
- unwrapOr<A>(v: A): T | A;
2161
- match<A, B = A>(_ok: (t: T) => A, err: (e: E) => B): A | B;
2162
- safeUnwrap(): Generator<Err<never, E>, T>;
2163
- _unsafeUnwrap(config?: ErrorConfig): T;
2164
- _unsafeUnwrapErr(_?: ErrorConfig): E;
2165
- [Symbol.iterator](): Generator<Err<never, E>, T>;
2166
- }
2167
- declare type Prev = [never, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, ...0[]];
2168
- declare type CollectResults<T, Collected extends unknown[] = [], Depth extends number = 50> = [Depth] extends [never] ? [] : T extends [infer H, ...infer Rest] ? H extends Result<infer L, infer R> ? CollectResults<Rest, [...Collected, [L, R]], Prev[Depth]> : never : Collected;
2169
- 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;
2170
- 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;
2171
- declare type Dedup<T> = T extends Result<infer RL, infer RR> ? [unknown] extends [RL] ? Err<RL, RR> : Ok<RL, RR> : T;
2172
- 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] : [];
2173
- 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;
2174
- declare type UnknownMembersToNever<T> = T extends [infer H, ...infer R] ? [[unknown] extends [H] ? never : H, ...UnknownMembersToNever<R>] : T;
2175
- declare type MembersToUnion<T> = T extends unknown[] ? T[number] : never;
2176
- declare type IsLiteralArray<T> = T extends {
2177
- length: infer L;
2178
- } ? L extends number ? number extends L ? 0 : 1 : 0 : 0;
2179
- declare type Traverse<T, Depth extends number = 5> = Combine<T, Depth> extends [infer Oks, infer Errs] ? Result<EmptyArrayToNever<Oks, 1>, MembersToUnion<Errs>> : never;
2180
- declare type TraverseWithAllErrors<T, Depth extends number = 5> = Traverse<T, Depth> extends Result<infer Oks, infer Errs> ? Result<Oks, Errs[]> : never;
2181
- declare type CombineResults<T extends readonly Result<unknown, unknown>[]> = IsLiteralArray<T> extends 1 ? Traverse<T> : Result<ExtractOkTypes<T>, ExtractErrTypes<T>[number]>;
2182
- declare type CombineResultsWithAllErrorsArray<T extends readonly Result<unknown, unknown>[]> = IsLiteralArray<T> extends 1 ? TraverseWithAllErrors<T> : Result<ExtractOkTypes<T>, ExtractErrTypes<T>[number][]>;
2183
- export declare const getResult: <T>(fn: () => T) => Result<T, Error>;
2184
- export declare const getResultAsync: <T>(fn: () => Promise<T>) => ResultAsync<T, Error>;
2185
- export declare const toAppError: (error: unknown) => Error;
2186
- export declare const withFinalizer: <T>(fn: () => T, finalizer?: () => void) => T;
2187
- export declare const withFinalizerAsync: <T>(fn: () => Promisable<T>, finalizer?: () => Promisable<void>) => Promise<T>;
2188
- export declare const classifyMentions: (message: string) => ClassifiedMentions;
2189
- export declare const MENTION_ID_ATTRIBUTE = "data-id";
2190
- export declare const MENTION_ITEM_TYPE_ATTRIBUTE = "data-mention-type";
2191
- export declare const MENTION_LABEL_ATTRIBUTE = "data-label";
2192
- export declare const MENTION_TYPE_ATTRIBUTE = "data-type";
2193
- export declare const MENTION_TYPE = "mention";
2194
- export declare const MENTION_SELECTOR: string;
2195
- export declare const MENTION_HERE_ID = "@here";
2196
- export declare const MENTION_EVERYONE_ID = "@everyone";
2197
- export declare const CUSTOM_EMOJI_ID_ATTRIBUTE = "data-custom-emoji-id";
2198
- export declare const CUSTOM_EMOJI_NAME_ATTRIBUTE = "data-custom-emoji-name";
2199
- export declare const CUSTOM_EMOJI_TYPE = "customEmoji";
2200
- declare class VoidTag {
2201
- addClosingSlash: boolean;
2202
- private voidTags;
2203
- constructor(addClosingSlash?: boolean, tags?: string[]);
2204
- formatNode(tag: string, attrs: string, innerHTML: string): string;
2205
- isVoidElement(tag: string): boolean;
2206
- }
2207
- declare enum NodeType {
2208
- ELEMENT_NODE = 1,
2209
- TEXT_NODE = 3,
2210
- COMMENT_NODE = 8
2211
- }
2212
- /**
2213
- * Node Class as base class for TextNode and HTMLElement.
2214
- */
2215
- declare abstract class Node {
2216
- parentNode: HTMLElement | null;
2217
- abstract rawTagName: string;
2218
- abstract nodeType: NodeType;
2219
- childNodes: Node[];
2220
- range: readonly [number, number];
2221
- abstract text: string;
2222
- abstract rawText: string;
2223
- abstract toString(): string;
2224
- abstract clone(): Node;
2225
- constructor(parentNode?: HTMLElement | null, range?: [number, number]);
2226
- /**
2227
- * Remove current node
2228
- */
2229
- remove(): this;
2230
- get innerText(): string;
2231
- get textContent(): string;
2232
- set textContent(val: string);
2233
- }
2234
- interface KeyAttributes {
2235
- id?: string;
2236
- class?: string;
2237
- }
2238
- interface Attributes {
2239
- [key: string]: string;
2240
- }
2241
- interface RawAttributes {
2242
- [key: string]: string;
2243
- }
2244
- type InsertPosition = 'beforebegin' | 'afterbegin' | 'beforeend' | 'afterend';
2245
- type NodeInsertable = Node | string;
2246
- declare class DOMTokenList {
2247
- private _set;
2248
- private _afterUpdate;
2249
- private _validate;
2250
- constructor(valuesInit?: string[], afterUpdate?: (t: DOMTokenList) => void);
2251
- add(c: string): void;
2252
- replace(c1: string, c2: string): void;
2253
- remove(c: string): void;
2254
- toggle(c: string): void;
2255
- contains(c: string): boolean;
2256
- get length(): number;
2257
- values(): SetIterator<string>;
2258
- get value(): string[];
2259
- toString(): string;
2260
- }
2261
- /**
2262
- * HTMLElement, which contains a set of children.
2263
- *
2264
- * Note: this is a minimalist implementation, no complete tree
2265
- * structure provided (no parentNode, nextSibling,
2266
- * previousSibling etc).
2267
- * @class HTMLElement
2268
- * @extends {Node}
2269
- */
2270
- declare class HTMLElement extends Node {
2271
- rawAttrs: string;
2272
- private voidTag;
2273
- private _attrs;
2274
- private _rawAttrs;
2275
- private _parseOptions;
2276
- private _id;
2277
- rawTagName: string;
2278
- classList: DOMTokenList;
2279
- /**
2280
- * Node Type declaration.
2281
- */
2282
- nodeType: NodeType;
2283
- /**
2284
- * Quote attribute values
2285
- * @param attr attribute value
2286
- * @returns {string} quoted value
2287
- */
2288
- private quoteAttribute;
2289
- /**
2290
- * Creates an instance of HTMLElement.
2291
- * @param keyAttrs id and class attribute
2292
- * @param [rawAttrs] attributes in string
2293
- *
2294
- * @memberof HTMLElement
2295
- */
2296
- constructor(tagName: string, keyAttrs: KeyAttributes, rawAttrs?: string, parentNode?: HTMLElement | null, range?: [number, number], voidTag?: VoidTag, _parseOptions?: Partial<Options>);
2297
- /**
2298
- * Remove Child element from childNodes array
2299
- * @param {HTMLElement} node node to remove
2300
- */
2301
- removeChild(node: Node): this;
2302
- /**
2303
- * Exchanges given child with new child
2304
- * @param {HTMLElement} oldNode node to exchange
2305
- * @param {HTMLElement} newNode new node
2306
- */
2307
- exchangeChild(oldNode: Node, newNode: Node): this;
2308
- get tagName(): string;
2309
- set tagName(newname: string);
2310
- get localName(): string;
2311
- get isVoidElement(): boolean;
2312
- get id(): string;
2313
- set id(newid: string);
2314
- /**
2315
- * Get escpaed (as-it) text value of current node and its children.
2316
- * @return {string} text content
2317
- */
2318
- get rawText(): string;
2319
- get textContent(): string;
2320
- set textContent(val: string);
2321
- /**
2322
- * Get unescaped text value of current node and its children.
2323
- * @return {string} text content
2324
- */
2325
- get text(): string;
2326
- /**
2327
- * Get structured Text (with '\n' etc.)
2328
- * @return {string} structured text
2329
- */
2330
- get structuredText(): string;
2331
- toString(): string;
2332
- get innerHTML(): string;
2333
- set innerHTML(content: string);
2334
- set_content(content: string | Node | Node[], options?: Partial<Options>): this;
2335
- replaceWith(...nodes: (string | Node)[]): this;
2336
- get outerHTML(): string;
2337
- /**
2338
- * Trim element from right (in block) after seeing pattern in a TextNode.
2339
- * @param {RegExp} pattern pattern to find
2340
- * @return {HTMLElement} reference to current node
2341
- */
2342
- trimRight(pattern: RegExp): this;
2343
- /**
2344
- * Get DOM structure
2345
- * @return {string} structure
2346
- */
2347
- get structure(): string;
2348
- /**
2349
- * Remove whitespaces in this sub tree.
2350
- * @return {HTMLElement} pointer to this
2351
- */
2352
- removeWhitespace(): this;
2353
- /**
2354
- * Query CSS selector to find matching nodes.
2355
- * @param {string} selector Simplified CSS selector
2356
- * @return {HTMLElement[]} matching elements
2357
- */
2358
- querySelectorAll(selector: string): HTMLElement[];
2359
- /**
2360
- * Query CSS Selector to find matching node.
2361
- * @param {string} selector Simplified CSS selector
2362
- * @return {(HTMLElement|null)} matching node
2363
- */
2364
- querySelector(selector: string): HTMLElement | null;
2365
- /**
2366
- * Tests whether the node matches a given CSS selector.
2367
- * @param {string} selector Simplified CSS selector
2368
- * @return {boolean}
2369
- */
2370
- matches(selector: string): boolean;
2371
- /**
2372
- * find elements by their tagName
2373
- * @param {string} tagName the tagName of the elements to select
2374
- */
2375
- getElementsByTagName(tagName: string): Array<HTMLElement>;
2376
- /**
2377
- * find element by it's id
2378
- * @param {string} id the id of the element to select
2379
- * @returns {HTMLElement | null} the element with the given id or null if not found
2380
- */
2381
- getElementById(id: string): HTMLElement | null;
2382
- /**
2383
- * traverses the Element and its parents (heading toward the document root) until it finds a node that matches the provided selector string. Will return itself or the matching ancestor. If no such element exists, it returns null.
2384
- * @param selector a DOMString containing a selector list
2385
- * @returns {HTMLElement | null} the element with the given id or null if not found
2386
- */
2387
- closest(selector: string): HTMLElement | null;
2388
- /**
2389
- * Append a child node to childNodes
2390
- * @param {Node} node node to append
2391
- * @return {Node} node appended
2392
- */
2393
- appendChild<T extends Node = Node>(node: T): T;
2394
- /**
2395
- * Get attributes
2396
- * @access private
2397
- * @return {Object} parsed and unescaped attributes
2398
- */
2399
- get attrs(): Attributes;
2400
- get attributes(): Record<string, string>;
2401
- /**
2402
- * Get escaped (as-is) attributes
2403
- * @return {Object} parsed attributes
2404
- */
2405
- get rawAttributes(): RawAttributes;
2406
- removeAttribute(key: string): this;
2407
- hasAttribute(key: string): boolean;
2408
- /**
2409
- * Get an attribute
2410
- * @return {string | undefined} value of the attribute; or undefined if not exist
2411
- */
2412
- getAttribute(key: string): string | undefined;
2413
- /**
2414
- * Set an attribute value to the HTMLElement
2415
- * @param {string} key The attribute name
2416
- * @param {string} value The value to set, or null / undefined to remove an attribute
2417
- */
2418
- setAttribute(key: string, value: string): this;
2419
- /**
2420
- * Replace all the attributes of the HTMLElement by the provided attributes
2421
- * @param {Attributes} attributes the new attribute set
2422
- */
2423
- setAttributes(attributes: Attributes): this;
2424
- insertAdjacentHTML(where: InsertPosition, html: string): this;
2425
- /** Prepend nodes or strings to this node's children. */
2426
- prepend(...insertable: NodeInsertable[]): void;
2427
- /** Append nodes or strings to this node's children. */
2428
- append(...insertable: NodeInsertable[]): void;
2429
- /** Insert nodes or strings before this node. */
2430
- before(...insertable: NodeInsertable[]): void;
2431
- /** Insert nodes or strings after this node. */
2432
- after(...insertable: NodeInsertable[]): void;
2433
- get nextSibling(): Node | null;
2434
- get nextElementSibling(): HTMLElement | null;
2435
- get previousSibling(): Node | null;
2436
- get previousElementSibling(): HTMLElement | null;
2437
- /** Get all childNodes of type {@link HTMLElement}. */
2438
- get children(): HTMLElement[];
2439
- /**
2440
- * Get the first child node.
2441
- * @return The first child or undefined if none exists.
2442
- */
2443
- get firstChild(): Node | undefined;
2444
- /**
2445
- * Get the first child node of type {@link HTMLElement}.
2446
- * @return The first child element or undefined if none exists.
2447
- */
2448
- get firstElementChild(): HTMLElement | undefined;
2449
- /**
2450
- * Get the last child node.
2451
- * @return The last child or undefined if none exists.
2452
- */
2453
- get lastChild(): Node | undefined;
2454
- /**
2455
- * Get the last child node of type {@link HTMLElement}.
2456
- * @return The last child element or undefined if none exists.
2457
- */
2458
- get lastElementChild(): HTMLElement | undefined;
2459
- get childElementCount(): number;
2460
- get classNames(): string;
2461
- /** Clone this Node */
2462
- clone(): Node;
2463
- }
2464
- interface Options {
2465
- lowerCaseTagName?: boolean;
2466
- comment?: boolean;
2467
- /**
2468
- * @see PR #215 for explanation
2469
- */
2470
- fixNestedATags?: boolean;
2471
- parseNoneClosedTags?: boolean;
2472
- /**
2473
- * When true, preserves invalid HTML nesting (e.g., <p><p>bar</p></p>) instead of auto-closing tags
2474
- */
2475
- preserveTagNesting?: boolean;
2476
- blockTextElements: {
2477
- [tag: string]: boolean;
2478
- };
2479
- voidTag?: {
2480
- /**
2481
- * options, default value is ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'link', 'meta', 'param', 'source', 'track', 'wbr']
2482
- */
2483
- tags?: string[];
2484
- /**
2485
- * void tag serialisation, add a final slash <br/>
2486
- */
2487
- closingSlash?: boolean;
2488
- };
2489
- closeAllByClosing?: boolean;
2490
- }
2491
- export declare const getMentions: (message: string) => HTMLElement[];
2492
- export declare const css: typeof String.raw;
2493
- export declare const html: typeof String.raw;
2494
- export declare const sanitizeHtml: (...[html, options]: Parameters<typeof baseSanitizeHtml>) => string;
2495
- export declare const sanitizeTextHtml: (html: string) => string;
2496
- export declare const applyItemMetadataMixin: <TBase extends Class<NonNullable<unknown>>>(Base: TBase) => WithMetadata<TBase>;
2497
- export declare const chunk: <T>(array: T[], size: number) => T[][];
2498
- export declare const chunkBySerializedSize: <T>(items: T[], maxBytes: number, maxCount: number) => T[][];
2499
- export declare const takeOne: TakeOne;
2500
- export declare const getIsServer: () => boolean;
2501
- export declare const noop: () => void;
2502
- export declare const ID_SEPARATOR = "|";
2503
- export declare const UUID_LENGTH = 36;
2504
- export declare const getOrCreate: <TKey, TValue>(map: Map<TKey, TValue>, key: TKey, create: () => TValue) => TValue;
2505
- export declare const checkIsPlainObject: (data: unknown) => data is object;
2506
- export declare const getPropertyNames: <T>() => PropertyNames<T>;
2507
- export declare const jsonDateParse: <T = any>(text: string) => T;
2508
- export 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;
2509
- export declare const mergeObjectsStrict: <T extends object[]>(...objects: T) => MergeObjectsStrict<T>;
2510
- export declare const settleAll: <T>(tasks: (() => Promise<T>)[], concurrencyLimit?: number) => Promise<T[]>;
2511
- export declare const getRawData: <T>(data: T) => T;
2512
- export declare const toRawDeep: <T extends object>(data: T) => T;
2513
- export declare const capitalize: (string: string) => string;
2514
- export declare const encodeUrlSubDelimiters: (value: string) => string;
2515
- export declare const getDecodedUriComponent: (value: string, fallback: string) => string;
2516
- export declare const normalizeString: (value: null | string | undefined) => string;
2517
- export declare const createNormalizedStringSchema: (maxLength: number, schema?: z.ZodString) => z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
2518
- export declare const streamToText: (readable: NodeJS.ReadableStream) => Promise<string>;
2519
- export declare const toKebabCase: <T extends string>(string: T) => KebabCase<T>;
2520
- export declare const truncate: (string: string, length: number) => string;
2521
- export declare const uncapitalize: <T extends string>(string: T) => Uncapitalize<T>;
2522
- export declare const hrtime: (previousHrTime?: [number, number]) => [number, number];
2523
- export declare const now: () => string;
2524
- export declare const sleep: (durationMs: number) => Promise<void>;
2525
- export type BuildTuple<N extends number, T = unknown, R extends unknown[] = []> = R["length"] extends N ? R : BuildTuple<N, T, [...R, T]>;
2526
- export type FunctionProperties<T> = { [K in keyof T]: T[K] extends Function ? K : never; };
2527
- export type ExcludeFunctionProperties<T> = Except<T, FunctionProperties<T>[keyof T]>;
2528
- export type MapValue<BaseType> = BaseType extends Map<unknown, infer ValueType> ? ValueType : never;
2529
- export 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, []];
2530
- export type SkipFirst<T extends unknown[], N extends number> = TupleSplit<T, N>[1];
2531
- export type TakeFirst<T extends unknown[], N extends number> = TupleSplit<T, N>[0];
2532
- export 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>;
2533
- export declare const exhaustiveGuard: (value: never) => never;
2534
- export 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>);
2535
- export type UniqueArraySchemaKey<TSchema extends z.ZodType> = TSchema extends z.ZodObject ? keyof TSchema["shape"] & string : keyof z.output<TSchema> & string;
2536
- export declare const createUniqueArraySchema: CreateUniqueArraySchema;
2537
- export declare const UUIDV4_REGEX: RegExp;
2538
- export declare const uuidValidateV4: (uuid: string) => boolean;
2001
+ //#endregion
2002
+ //#region src/services/app/constants.d.ts
2003
+ declare const MAX_READ_LIMIT = 1e3;
2004
+ declare const SITE_NAME = "Esposter";
2005
+ declare const KIBIBYTE: number;
2006
+ declare const MEGABYTE: number;
2007
+ declare const GIBIBYTE: number;
2008
+ //#endregion
2009
+ //#region src/services/error/createExponentialBackoff.d.ts
2010
+ declare const createExponentialBackoff: (baseDelayMs: number, maxDelayMs: number) => (<T>(operation: () => Promise<T>) => Promise<T>);
2011
+ //#endregion
2012
+ //#region src/services/error/getResult.d.ts
2013
+ declare const getResult: <T>(fn: () => T) => Result<T, Error>;
2014
+ //#endregion
2015
+ //#region src/services/error/getResultAsync.d.ts
2016
+ declare const getResultAsync: <T>(fn: () => Promise<T>) => ResultAsync<T, Error>;
2017
+ //#endregion
2018
+ //#region src/services/error/toAppError.d.ts
2019
+ declare const toAppError: (error: unknown) => Error;
2020
+ //#endregion
2021
+ //#region src/services/error/withFinalizer.d.ts
2022
+ declare const withFinalizer: <T>(fn: () => T, finalizer?: () => void) => T;
2023
+ //#endregion
2024
+ //#region src/services/error/withFinalizerAsync.d.ts
2025
+ declare const withFinalizerAsync: <T>(fn: () => Promisable<T>, finalizer?: () => Promisable<void>) => Promise<T>;
2026
+ //#endregion
2027
+ //#region src/services/message/classifyMentions.d.ts
2028
+ declare const classifyMentions: (message: string) => ClassifiedMentions;
2029
+ //#endregion
2030
+ //#region src/services/message/constants.d.ts
2031
+ declare const MENTION_ID_ATTRIBUTE = "data-id";
2032
+ declare const MENTION_ITEM_TYPE_ATTRIBUTE = "data-mention-type";
2033
+ declare const MENTION_LABEL_ATTRIBUTE = "data-label";
2034
+ declare const MENTION_TYPE_ATTRIBUTE = "data-type";
2035
+ declare const MENTION_TYPE = "mention";
2036
+ declare const MENTION_SELECTOR: string;
2037
+ declare const MENTION_HERE_ID = "@here";
2038
+ declare const MENTION_EVERYONE_ID = "@everyone";
2039
+ declare const CUSTOM_EMOJI_ID_ATTRIBUTE = "data-custom-emoji-id";
2040
+ declare const CUSTOM_EMOJI_NAME_ATTRIBUTE = "data-custom-emoji-name";
2041
+ declare const CUSTOM_EMOJI_TYPE = "customEmoji";
2042
+ //#endregion
2043
+ //#region src/services/message/getMentions.d.ts
2044
+ declare const getMentions: (message: string) => HTMLElement[];
2045
+ //#endregion
2046
+ //#region src/services/prettier/css.d.ts
2047
+ declare const css: typeof String.raw;
2048
+ //#endregion
2049
+ //#region src/services/prettier/html.d.ts
2050
+ declare const html: typeof String.raw;
2051
+ //#endregion
2052
+ //#region src/services/sanitizeHtml/sanitizeHtml.d.ts
2053
+ declare const sanitizeHtml: (...[html, options]: Parameters<typeof baseSanitizeHtml>) => string;
2054
+ //#endregion
2055
+ //#region src/services/sanitizeHtml/sanitizeTextHtml.d.ts
2056
+ declare const sanitizeTextHtml: (html: string) => string;
2057
+ //#endregion
2058
+ //#region src/services/shared/applyItemMetadataMixin.d.ts
2059
+ declare const applyItemMetadataMixin: <TBase extends Class<NonNullable<unknown>>>(Base: TBase) => WithMetadata<TBase>;
2060
+ //#endregion
2061
+ //#region src/util/array/chunk.d.ts
2062
+ declare const chunk: <T>(array: T[], size: number) => T[][];
2063
+ //#endregion
2064
+ //#region src/util/array/chunkBySerializedSize.d.ts
2065
+ declare const chunkBySerializedSize: <T>(items: T[], maxBytes: number, maxCount: number) => T[][];
2066
+ //#endregion
2067
+ //#region src/util/array/takeOne.d.ts
2068
+ declare const takeOne: TakeOne;
2069
+ //#endregion
2070
+ //#region src/util/environment/getIsServer.d.ts
2071
+ declare const getIsServer: () => boolean;
2072
+ //#endregion
2073
+ //#region src/util/function/noop.d.ts
2074
+ declare const noop: () => void;
2075
+ //#endregion
2076
+ //#region src/util/id/constants.d.ts
2077
+ declare const ID_SEPARATOR = "|";
2078
+ declare const UUID_LENGTH = 36;
2079
+ //#endregion
2080
+ //#region src/util/map/getOrCreate.d.ts
2081
+ declare const getOrCreate: <TKey, TValue>(map: Map<TKey, TValue>, key: TKey, create: () => TValue) => TValue;
2082
+ //#endregion
2083
+ //#region src/util/object/checkIsPlainObject.d.ts
2084
+ declare const checkIsPlainObject: (data: unknown) => data is object;
2085
+ //#endregion
2086
+ //#region src/util/object/getPropertyNames.d.ts
2087
+ declare const getPropertyNames: <T>() => PropertyNames<T>;
2088
+ //#endregion
2089
+ //#region src/util/object/jsonDateParse.d.ts
2090
+ declare const jsonDateParse: <T = any>(text: string) => T;
2091
+ //#endregion
2092
+ //#region src/util/types/MergeObjectsStrict.d.ts
2093
+ 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;
2094
+ //#endregion
2095
+ //#region src/util/object/mergeObjectsStrict.d.ts
2096
+ declare const mergeObjectsStrict: <T extends object[]>(...objects: T) => MergeObjectsStrict<T>;
2097
+ //#endregion
2098
+ //#region src/util/promise/settleAll.d.ts
2099
+ declare const settleAll: <T>(tasks: (() => Promise<T>)[], concurrencyLimit?: number) => Promise<T[]>;
2100
+ //#endregion
2101
+ //#region src/util/reactivity/getRawData.d.ts
2102
+ declare const getRawData: <T>(data: T) => T;
2103
+ //#endregion
2104
+ //#region src/util/reactivity/toRawDeep.d.ts
2105
+ declare const toRawDeep: <T extends object>(data: T) => T;
2106
+ //#endregion
2107
+ //#region src/util/text/capitalize.d.ts
2108
+ declare const capitalize: (string: string) => string;
2109
+ //#endregion
2110
+ //#region src/util/text/encodeUrlSubDelimiters.d.ts
2111
+ declare const encodeUrlSubDelimiters: (value: string) => string;
2112
+ //#endregion
2113
+ //#region src/util/text/getDecodedUriComponent.d.ts
2114
+ declare const getDecodedUriComponent: (value: string, fallback: string) => string;
2115
+ //#endregion
2116
+ //#region src/util/text/normalizeString.d.ts
2117
+ declare const normalizeString: (value: null | string | undefined) => string;
2118
+ declare const createNormalizedStringSchema: (maxLength: number, schema?: z.ZodString) => z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
2119
+ //#endregion
2120
+ //#region src/util/text/streamToText.d.ts
2121
+ declare const streamToText: (readable: NodeJS.ReadableStream) => Promise<string>;
2122
+ //#endregion
2123
+ //#region src/util/text/toKebabCase.d.ts
2124
+ declare const toKebabCase: <T extends string>(string: T) => KebabCase<T>;
2125
+ //#endregion
2126
+ //#region src/util/text/truncate.d.ts
2127
+ declare const truncate: (string: string, length: number) => string;
2128
+ //#endregion
2129
+ //#region src/util/text/uncapitalize.d.ts
2130
+ declare const uncapitalize: <T extends string>(string: T) => Uncapitalize<T>;
2131
+ //#endregion
2132
+ //#region src/util/time/hrtime.d.ts
2133
+ declare const hrtime: (previousHrTime?: [number, number]) => [number, number];
2134
+ //#endregion
2135
+ //#region src/util/time/now.d.ts
2136
+ declare const now: () => string;
2137
+ //#endregion
2138
+ //#region src/util/time/sleep.d.ts
2139
+ declare const sleep: (durationMs: number) => Promise<void>;
2140
+ //#endregion
2141
+ //#region src/util/types/BuildTuple.d.ts
2142
+ type BuildTuple<N extends number, T = unknown, R extends unknown[] = []> = R["length"] extends N ? R : BuildTuple<N, T, [...R, T]>;
2143
+ //#endregion
2144
+ //#region src/util/types/FunctionProperties.d.ts
2145
+ type FunctionProperties<T> = { [K in keyof T]: T[K] extends Function ? K : never; };
2146
+ //#endregion
2147
+ //#region src/util/types/ExcludeFunctionProperties.d.ts
2148
+ type ExcludeFunctionProperties<T> = Except<T, FunctionProperties<T>[keyof T]>;
2149
+ //#endregion
2150
+ //#region src/util/types/MapValue.d.ts
2151
+ type MapValue<BaseType> = BaseType extends Map<unknown, infer ValueType> ? ValueType : never;
2152
+ //#endregion
2153
+ //#region src/util/types/TupleSplit.d.ts
2154
+ 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, []];
2155
+ //#endregion
2156
+ //#region src/util/types/SkipFirst.d.ts
2157
+ type SkipFirst<T extends unknown[], N extends number> = TupleSplit<T, N>[1];
2158
+ //#endregion
2159
+ //#region src/util/types/TakeFirst.d.ts
2160
+ type TakeFirst<T extends unknown[], N extends number> = TupleSplit<T, N>[0];
2161
+ //#endregion
2162
+ //#region src/util/types/TupleSlice.d.ts
2163
+ 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>;
2164
+ //#endregion
2165
+ //#region src/util/validation/exhaustiveGuard.d.ts
2166
+ declare const exhaustiveGuard: (value: never) => never;
2167
+ //#endregion
2168
+ //#region src/util/zod/createUniqueArraySchema.d.ts
2169
+ 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>);
2170
+ type UniqueArraySchemaKey<TSchema extends z.ZodType> = TSchema extends z.ZodObject ? keyof TSchema["shape"] & string : keyof z.output<TSchema> & string;
2171
+ declare const createUniqueArraySchema: CreateUniqueArraySchema;
2172
+ //#endregion
2173
+ //#region src/util/id/uuid/constants.d.ts
2174
+ declare const UUIDV4_REGEX: RegExp;
2175
+ //#endregion
2176
+ //#region src/util/id/uuid/uuidValidateV4.d.ts
2177
+ declare const uuidValidateV4: (uuid: string) => boolean;
2178
+ //#endregion
2179
+ export { AllSpecialValues, BuildTuple, CUSTOM_EMOJI_ID_ATTRIBUTE, CUSTOM_EMOJI_NAME_ATTRIBUTE, CUSTOM_EMOJI_TYPE, ClassifiedMentions, CreateUniqueArraySchema, DeepOmit, DeepOptionalUndefined, ExcludeFunctionProperties, ForbiddenError, FunctionProperties, GIBIBYTE, GetArrayProps, GetObjectProps, GetPaths, GetPrimitiveProps, GetProperties, ID_SEPARATOR, InvalidOperationError, ItemEntityType, ItemEntityTypePropertyNames, ItemMetadata, ItemMetadataPropertyNames, KIBIBYTE, KnownKeys, MAX_READ_LIMIT, MEGABYTE, MENTION_EVERYONE_ID, MENTION_HERE_ID, MENTION_ID_ATTRIBUTE, MENTION_ITEM_TYPE_ATTRIBUTE, MENTION_LABEL_ATTRIBUTE, MENTION_SELECTOR, 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, getDecodedUriComponent, 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 };