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