@esposter/shared 3.0.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +106 -143
- package/dist/index.js +12 -68
- package/package.json +9 -9
package/dist/index.d.ts
CHANGED
|
@@ -43,13 +43,6 @@ export declare class WordFilteredError extends Error {
|
|
|
43
43
|
constructor(message: string);
|
|
44
44
|
}
|
|
45
45
|
//#endregion
|
|
46
|
-
//#region src/models/message/ClassifiedMentions.d.ts
|
|
47
|
-
export interface ClassifiedMentions {
|
|
48
|
-
broadcastIds: string[];
|
|
49
|
-
regularUserIds: string[];
|
|
50
|
-
roleIds: string[];
|
|
51
|
-
}
|
|
52
|
-
//#endregion
|
|
53
46
|
//#region src/models/message/MentionType.d.ts
|
|
54
47
|
export declare enum MentionType {
|
|
55
48
|
Role = "role",
|
|
@@ -102,46 +95,10 @@ export declare const RoutePath: {
|
|
|
102
95
|
};
|
|
103
96
|
export type RoutePath = typeof RoutePath;
|
|
104
97
|
//#endregion
|
|
105
|
-
//#region src/util/types/GetArrayProps.d.ts
|
|
106
|
-
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) | {
|
|
107
|
-
path: R extends true ? "length" : `${P}.length`;
|
|
108
|
-
value: T["length"];
|
|
109
|
-
};
|
|
110
|
-
//#endregion
|
|
111
|
-
//#region src/util/types/KnownKeys.d.ts
|
|
112
|
-
export type KnownKeys<T> = { [K in keyof T as string extends K ? never : number extends K ? never : K]: T[K]; };
|
|
113
|
-
//#endregion
|
|
114
|
-
//#region src/util/types/GetObjectProps.d.ts
|
|
115
|
-
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) | {
|
|
116
|
-
path: R extends true ? `${K}` : `${P}.${K}`;
|
|
117
|
-
value: T[K];
|
|
118
|
-
}; }[keyof KnownKeys<T> & (number | string)];
|
|
119
|
-
//#endregion
|
|
120
|
-
//#region src/util/types/GetPrimitiveProps.d.ts
|
|
121
|
-
export type GetPrimitiveProps<T, P extends string, D extends unknown[], R extends boolean> = T extends string ? {
|
|
122
|
-
path: R extends true ? "length" : `${P}.length`;
|
|
123
|
-
value: number;
|
|
124
|
-
} : T extends symbol ? (D extends [unknown, ...infer Rest] ? GetProperties<string | undefined, R extends true ? "description" : `${P}.description`, Rest, false> : never) | {
|
|
125
|
-
path: R extends true ? "description" : `${P}.description`;
|
|
126
|
-
value: string | undefined;
|
|
127
|
-
} : never;
|
|
128
|
-
//#endregion
|
|
129
|
-
//#region src/util/types/GetProperties.d.ts
|
|
130
|
-
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;
|
|
131
|
-
//#endregion
|
|
132
|
-
//#region src/util/types/GetPaths.d.ts
|
|
133
|
-
export type GetPaths<T> = GetProperties<T> extends (infer U) ? (U extends {
|
|
134
|
-
path: infer Path;
|
|
135
|
-
} ? Path : never) : never;
|
|
136
|
-
//#endregion
|
|
137
|
-
//#region src/util/types/PropertyNames.d.ts
|
|
138
|
-
export type PropertyNames<T> = { [P in GetPaths<T>]: P; };
|
|
139
|
-
//#endregion
|
|
140
98
|
//#region src/models/shared/ItemEntityType.d.ts
|
|
141
99
|
export interface ItemEntityType<T extends string> {
|
|
142
100
|
type: T;
|
|
143
101
|
}
|
|
144
|
-
export declare const ItemEntityTypePropertyNames: PropertyNames<ItemEntityType<string>>;
|
|
145
102
|
export declare const createItemEntityTypeSchema: <T extends z.ZodType<string>>(schema: T) => z.ZodObject<{
|
|
146
103
|
type: T;
|
|
147
104
|
}>;
|
|
@@ -152,25 +109,8 @@ export declare class ItemMetadata {
|
|
|
152
109
|
deletedAt: Date | null;
|
|
153
110
|
updatedAt: Date;
|
|
154
111
|
}
|
|
155
|
-
export declare const ItemMetadataPropertyNames: PropertyNames<ItemMetadata>;
|
|
156
|
-
export declare const itemMetadataSchema: z.ZodObject<{
|
|
157
|
-
createdAt: z.ZodDate;
|
|
158
|
-
deletedAt: z.ZodNullable<z.ZodDate>;
|
|
159
|
-
updatedAt: z.ZodDate;
|
|
160
|
-
}>;
|
|
161
|
-
//#endregion
|
|
162
|
-
//#region src/models/shared/Serializable.d.ts
|
|
163
|
-
export declare abstract class Serializable {
|
|
164
|
-
toJSON(): this;
|
|
165
|
-
}
|
|
166
|
-
//#endregion
|
|
167
|
-
//#region src/models/shared/TakeOne.d.ts
|
|
168
|
-
export interface TakeOne {
|
|
169
|
-
<T extends readonly unknown[]>(values: T, index?: number): T[number];
|
|
170
|
-
<T extends object>(values: T, index: keyof T): T[keyof T];
|
|
171
|
-
}
|
|
172
112
|
//#endregion
|
|
173
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
113
|
+
//#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/primitive.d.ts
|
|
174
114
|
/**
|
|
175
115
|
Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
|
|
176
116
|
|
|
@@ -178,7 +118,7 @@ Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/
|
|
|
178
118
|
*/
|
|
179
119
|
type Primitive = null | undefined | string | number | boolean | symbol | bigint;
|
|
180
120
|
//#endregion
|
|
181
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
121
|
+
//#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/basic.d.ts
|
|
182
122
|
/**
|
|
183
123
|
Matches a [`class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes).
|
|
184
124
|
|
|
@@ -189,7 +129,7 @@ type Class<T, Arguments extends unknown[] = any[]> = {
|
|
|
189
129
|
new (...arguments_: Arguments): T;
|
|
190
130
|
};
|
|
191
131
|
//#endregion
|
|
192
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
132
|
+
//#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/union-to-intersection.d.ts
|
|
193
133
|
/**
|
|
194
134
|
Convert a union type to an intersection type.
|
|
195
135
|
|
|
@@ -223,7 +163,7 @@ never
|
|
|
223
163
|
// The `& Union` is to ensure result of `UnionToIntersection<A | B>` is always assignable to `A | B`
|
|
224
164
|
Intersection & Union : never;
|
|
225
165
|
//#endregion
|
|
226
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
166
|
+
//#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/keys-of-union.d.ts
|
|
227
167
|
/**
|
|
228
168
|
Create a union of all keys from a given type, even those exclusive to specific union members.
|
|
229
169
|
|
|
@@ -265,7 +205,7 @@ type KeysOfUnion<ObjectType> =
|
|
|
265
205
|
// Hack to fix https://github.com/sindresorhus/type-fest/issues/1008
|
|
266
206
|
keyof UnionToIntersection<ObjectType extends unknown ? Record<keyof ObjectType, never> : never>;
|
|
267
207
|
//#endregion
|
|
268
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
208
|
+
//#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/is-any.d.ts
|
|
269
209
|
/**
|
|
270
210
|
Returns a boolean for whether the given type is `any`.
|
|
271
211
|
|
|
@@ -296,7 +236,7 @@ const anyA = get(anyObject, 'a');
|
|
|
296
236
|
*/
|
|
297
237
|
type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;
|
|
298
238
|
//#endregion
|
|
299
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
239
|
+
//#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/is-optional-key-of.d.ts
|
|
300
240
|
/**
|
|
301
241
|
Returns a boolean for whether the given key is an optional key of type.
|
|
302
242
|
|
|
@@ -339,7 +279,7 @@ type T5 = IsOptionalKeyOf<User | Admin, 'surname'>;
|
|
|
339
279
|
*/
|
|
340
280
|
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;
|
|
341
281
|
//#endregion
|
|
342
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
282
|
+
//#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/optional-keys-of.d.ts
|
|
343
283
|
/**
|
|
344
284
|
Extract all optional keys from the given type.
|
|
345
285
|
|
|
@@ -377,7 +317,7 @@ type OptionalKeysOf<Type extends object> = Type extends unknown // For distribut
|
|
|
377
317
|
? (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`
|
|
378
318
|
: never; // Should never happen
|
|
379
319
|
//#endregion
|
|
380
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
320
|
+
//#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/required-keys-of.d.ts
|
|
381
321
|
/**
|
|
382
322
|
Extract all required keys from the given type.
|
|
383
323
|
|
|
@@ -411,7 +351,7 @@ const validator3 = createValidation<User>('luckyNumber', value => value > 0);
|
|
|
411
351
|
type RequiredKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
|
|
412
352
|
? Exclude<keyof Type, OptionalKeysOf<Type>> : never; // Should never happen
|
|
413
353
|
//#endregion
|
|
414
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
354
|
+
//#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/is-never.d.ts
|
|
415
355
|
/**
|
|
416
356
|
Returns a boolean for whether the given type is `never`.
|
|
417
357
|
|
|
@@ -467,7 +407,7 @@ type B = IsTrueFixed<never>;
|
|
|
467
407
|
*/
|
|
468
408
|
type IsNever<T> = [T] extends [never] ? true : false;
|
|
469
409
|
//#endregion
|
|
470
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
410
|
+
//#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/if.d.ts
|
|
471
411
|
/**
|
|
472
412
|
An if-else-like type that resolves depending on whether the given `boolean` type is `true` or `false`.
|
|
473
413
|
|
|
@@ -562,7 +502,7 @@ type Works = IncludesWithoutIf<HundredZeroes, '1'>;
|
|
|
562
502
|
*/
|
|
563
503
|
type If<Type extends boolean, IfBranch, ElseBranch> = IsNever<Type> extends true ? ElseBranch : Type extends true ? IfBranch : ElseBranch;
|
|
564
504
|
//#endregion
|
|
565
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
505
|
+
//#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/unknown-array.d.ts
|
|
566
506
|
/**
|
|
567
507
|
Represents an array with `unknown` value.
|
|
568
508
|
|
|
@@ -589,7 +529,7 @@ type C = IsArray<string>;
|
|
|
589
529
|
*/
|
|
590
530
|
type UnknownArray = readonly unknown[];
|
|
591
531
|
//#endregion
|
|
592
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
532
|
+
//#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/internal/type.d.ts
|
|
593
533
|
/**
|
|
594
534
|
Returns a boolean for whether A is false.
|
|
595
535
|
|
|
@@ -657,7 +597,7 @@ Indicates the value of `exactOptionalPropertyTypes` compiler option.
|
|
|
657
597
|
*/
|
|
658
598
|
type IsExactOptionalPropertyTypesEnabled = [(string | undefined)?] extends [string?] ? false : true;
|
|
659
599
|
//#endregion
|
|
660
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
600
|
+
//#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/internal/array.d.ts
|
|
661
601
|
/**
|
|
662
602
|
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.
|
|
663
603
|
|
|
@@ -693,16 +633,20 @@ type CollapseRestElement<TArray extends UnknownArray> = IfNotAnyOrNever<TArray,
|
|
|
693
633
|
ifNot: _CollapseRestElement<TArray>;
|
|
694
634
|
}>;
|
|
695
635
|
type _CollapseRestElement<TArray extends UnknownArray, ForwardAccumulator extends UnknownArray = [], BackwardAccumulator extends UnknownArray = []> = TArray extends UnknownArray // For distributing `TArray`
|
|
696
|
-
? keyof TArray
|
|
636
|
+
? '0' extends keyof TArray ?
|
|
637
|
+
// Enters this branch, if `TArray` starts with a non-rest element (e.g., `[string, number]` or `[string, ...number[]]`).
|
|
638
|
+
TArray extends readonly [(infer First)?, ...infer Rest] ? _CollapseRestElement<Rest, [...ForwardAccumulator,
|
|
639
|
+
// A tuple allows fewer than one element only when its first element is optional. Written in exactly this shape because equivalent ones, such as `[] extends TArray`, are several times slower.
|
|
640
|
+
TArray extends readonly [unknown, ...unknown[]] ? First : If<IsExactOptionalPropertyTypesEnabled, First, First | undefined> // Add `| undefined` for optional elements, if `exactOptionalPropertyTypes` is disabled.
|
|
641
|
+
], BackwardAccumulator> : never // Should never happen, since `[(infer First)?, ...infer Rest]` is a top-type for arrays.
|
|
642
|
+
:
|
|
697
643
|
// Enters this branch, if `TArray` is empty (e.g., []),
|
|
698
644
|
// or `TArray` contains no non-rest elements preceding the rest element (e.g., `[...string[]]` or `[...string[], string]`).
|
|
699
645
|
TArray extends readonly [...infer Rest, infer Last] ? _CollapseRestElement<Rest, ForwardAccumulator, [Last, ...BackwardAccumulator]> // Accumulate elements that are present after the rest element.
|
|
700
646
|
: TArray extends readonly [] ? [...ForwardAccumulator, ...BackwardAccumulator] : [...ForwardAccumulator, TArray[number], ...BackwardAccumulator] // Add the rest element between the accumulated elements.
|
|
701
|
-
: 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.
|
|
702
|
-
: First], BackwardAccumulator> : never // Should never happen, since `[(infer First)?, ...infer Rest]` is a top-type for arrays.
|
|
703
647
|
: never; // Should never happen
|
|
704
648
|
//#endregion
|
|
705
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
649
|
+
//#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/internal/characters.d.ts
|
|
706
650
|
type Whitespace = '\t' // '\t'
|
|
707
651
|
| '\n' // '\n'
|
|
708
652
|
| '\v' // '\v'
|
|
@@ -713,7 +657,7 @@ type Whitespace = '\t' // '\t'
|
|
|
713
657
|
type WordSeparators = '-' | '_' | Whitespace;
|
|
714
658
|
type AsciiPunctuation = '!' | '"' | '#' | '$' | '%' | '&' | '\'' | '(' | ')' | '*' | '+' | ',' | '-' | '.' | '/' | ':' | ';' | '<' | '=' | '>' | '?' | '@' | '[' | '\\' | ']' | '^' | '_' | '`' | '{' | '|' | '}' | '~';
|
|
715
659
|
//#endregion
|
|
716
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
660
|
+
//#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/simplify.d.ts
|
|
717
661
|
/**
|
|
718
662
|
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.
|
|
719
663
|
|
|
@@ -774,7 +718,7 @@ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface`
|
|
|
774
718
|
*/
|
|
775
719
|
type Simplify<T> = { [KeyType in keyof T]: T[KeyType]; } & {};
|
|
776
720
|
//#endregion
|
|
777
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
721
|
+
//#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/is-equal.d.ts
|
|
778
722
|
/**
|
|
779
723
|
Returns a boolean for whether the two given types are equal.
|
|
780
724
|
|
|
@@ -805,7 +749,7 @@ type IsEqual<A, B> = [A] extends [B] ? [B] extends [A] ? _IsEqual<A, B> : false
|
|
|
805
749
|
// This version fails the `equalWrappedTupleIntersectionToBeNeverAndNeverExpanded` test in `test-d/is-equal.ts`.
|
|
806
750
|
type _IsEqual<A, B> = (<G>() => G extends A & G | G ? 1 : 2) extends (<G>() => G extends B & G | G ? 1 : 2) ? true : false;
|
|
807
751
|
//#endregion
|
|
808
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
752
|
+
//#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/omit-index-signature.d.ts
|
|
809
753
|
/**
|
|
810
754
|
Omit any index signatures from the given object type, leaving only explicitly defined properties.
|
|
811
755
|
|
|
@@ -899,7 +843,7 @@ type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
|
|
|
899
843
|
*/
|
|
900
844
|
type OmitIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType]; };
|
|
901
845
|
//#endregion
|
|
902
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
846
|
+
//#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/pick-index-signature.d.ts
|
|
903
847
|
/**
|
|
904
848
|
Pick only index signatures from the given object type, leaving out all explicitly defined properties.
|
|
905
849
|
|
|
@@ -947,7 +891,7 @@ type ExampleIndexSignature = PickIndexSignature<Example>;
|
|
|
947
891
|
*/
|
|
948
892
|
type PickIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? KeyType : never]: ObjectType[KeyType]; };
|
|
949
893
|
//#endregion
|
|
950
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
894
|
+
//#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/merge.d.ts
|
|
951
895
|
// Merges two objects without worrying about index signatures.
|
|
952
896
|
type SimpleMerge<Destination, Source> = Simplify<{ [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key]; } & Source>;
|
|
953
897
|
/**
|
|
@@ -1018,7 +962,7 @@ type Merge<Destination, Source> = Destination extends unknown // For distributin
|
|
|
1018
962
|
: never; // Should never happen
|
|
1019
963
|
type _Merge<Destination, Source> = Simplify<SimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>> & SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>>;
|
|
1020
964
|
//#endregion
|
|
1021
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
965
|
+
//#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/trim.d.ts
|
|
1022
966
|
/**
|
|
1023
967
|
Remove spaces from the left side.
|
|
1024
968
|
*/
|
|
@@ -1043,7 +987,7 @@ type Example = Trim<' foo '>;
|
|
|
1043
987
|
*/
|
|
1044
988
|
type Trim<V extends string> = TrimLeft<TrimRight<V>>;
|
|
1045
989
|
//#endregion
|
|
1046
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
990
|
+
//#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/some-extend.d.ts
|
|
1047
991
|
/**
|
|
1048
992
|
@see {@link SomeExtend}
|
|
1049
993
|
*/
|
|
@@ -1130,16 +1074,17 @@ type B = SomeExtend<[1?, 2?, '3'?], string | undefined>;
|
|
|
1130
1074
|
@category Utilities
|
|
1131
1075
|
@category Array
|
|
1132
1076
|
*/
|
|
1133
|
-
type SomeExtend<TArray extends UnknownArray, Type, Options extends SomeExtendOptions = {}> =
|
|
1134
|
-
|
|
1135
|
-
ifNot: TArray extends readonly [infer First, ...infer Rest] ? IsNever<First> extends true ? Or<Or<IsNever<Type>, IsAny<Type>>, Not<Options['strictNever']>> extends true ?
|
|
1136
|
-
// If target `Type` is also `never`, or is `any`, or `strictNever` is disabled, return `true`.
|
|
1137
|
-
true : _SomeExtend<Rest, Type, Options> : First extends Type ? true : _SomeExtend<Rest, Type, Options> : false;
|
|
1077
|
+
type SomeExtend<TArray extends UnknownArray, Type, Options extends SomeExtendOptions = {}> = IfNotAnyOrNever<CollapseRestElement<TArray>, {
|
|
1078
|
+
ifNot: _SomeExtend<CollapseRestElement<TArray>, Type, ApplyDefaultOptions<SomeExtendOptions, DefaultSomeExtendOptions, Options>>;
|
|
1138
1079
|
ifAny: false;
|
|
1139
1080
|
ifNever: false;
|
|
1140
1081
|
}>;
|
|
1082
|
+
// Kept free of `IfNotAnyOrNever` so that it stays tail-recursive, which allows it to handle long arrays.
|
|
1083
|
+
type _SomeExtend<TArray extends UnknownArray, Type, Options extends Required<SomeExtendOptions>> = TArray extends readonly [infer First, ...infer Rest] ? IsNever<First> extends true ? Or<Or<IsNever<Type>, IsAny<Type>>, Not<Options['strictNever']>> extends true ?
|
|
1084
|
+
// If target `Type` is also `never`, or is `any`, or `strictNever` is disabled, return `true`.
|
|
1085
|
+
true : _SomeExtend<Rest, Type, Options> : First extends Type ? true : _SomeExtend<Rest, Type, Options> : false;
|
|
1141
1086
|
//#endregion
|
|
1142
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
1087
|
+
//#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/or-all.d.ts
|
|
1143
1088
|
/**
|
|
1144
1089
|
Returns a boolean for whether any of the given elements is `true`.
|
|
1145
1090
|
|
|
@@ -1210,7 +1155,7 @@ Note: `OrAll<[]>` evaluates to `false` because there are no `true` elements in a
|
|
|
1210
1155
|
*/
|
|
1211
1156
|
type OrAll<T extends readonly boolean[]> = SomeExtend<T, true>;
|
|
1212
1157
|
//#endregion
|
|
1213
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
1158
|
+
//#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/or.d.ts
|
|
1214
1159
|
/**
|
|
1215
1160
|
Returns a boolean for whether either of two given types is `true`.
|
|
1216
1161
|
|
|
@@ -1290,7 +1235,7 @@ type G = Or<never, never>;
|
|
|
1290
1235
|
*/
|
|
1291
1236
|
type Or<A extends boolean, B extends boolean> = OrAll<[A, B]>;
|
|
1292
1237
|
//#endregion
|
|
1293
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
1238
|
+
//#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/internal/string.d.ts
|
|
1294
1239
|
/**
|
|
1295
1240
|
Returns a boolean for whether the given string `S` starts with the given string `SearchString`.
|
|
1296
1241
|
|
|
@@ -1320,7 +1265,7 @@ This type is a workaround for [Microsoft/TypeScript#46109](https://github.com/mi
|
|
|
1320
1265
|
*/
|
|
1321
1266
|
type IsNumeric<T extends string> = T extends `${number}` ? Trim<T> extends T ? true : false : false;
|
|
1322
1267
|
//#endregion
|
|
1323
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
1268
|
+
//#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/internal/object.d.ts
|
|
1324
1269
|
/**
|
|
1325
1270
|
Merges user specified options with default options.
|
|
1326
1271
|
|
|
@@ -1429,7 +1374,7 @@ type UnwrapBrand<T> = IfNotAnyOrNever<T, {
|
|
|
1429
1374
|
}>;
|
|
1430
1375
|
type _UnwrapBrand<T, Base> = T extends Primitive ? T extends (infer U) & Pick<T, Exclude<keyof T, KeysOfUnion<Base>>> ? U : T : T;
|
|
1431
1376
|
//#endregion
|
|
1432
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
1377
|
+
//#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/is-string-literal.d.ts
|
|
1433
1378
|
/**
|
|
1434
1379
|
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).
|
|
1435
1380
|
|
|
@@ -1493,7 +1438,7 @@ type _IsStringLiteral<S> =
|
|
|
1493
1438
|
// and since `{}` extends index signatures, the result becomes `false`.
|
|
1494
1439
|
S extends string ? {} extends Record<S, never> ? false : true : false;
|
|
1495
1440
|
//#endregion
|
|
1496
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
1441
|
+
//#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/all-extend.d.ts
|
|
1497
1442
|
/**
|
|
1498
1443
|
@see {@link AllExtend}
|
|
1499
1444
|
*/
|
|
@@ -1586,16 +1531,17 @@ type B = AllExtend<[1?, 2?, 3?], number | undefined>;
|
|
|
1586
1531
|
@category Utilities
|
|
1587
1532
|
@category Array
|
|
1588
1533
|
*/
|
|
1589
|
-
type AllExtend<TArray extends UnknownArray, Type, Options extends AllExtendOptions = {}> =
|
|
1590
|
-
|
|
1591
|
-
ifNot: TArray extends readonly [infer First, ...infer Rest] ? IsNever<First> extends true ? Or<Or<IsNever<Type>, IsAny<Type>>, Not<Options['strictNever']>> extends true ?
|
|
1592
|
-
// If target `Type` is also `never`, or is `any`, or `strictNever` is disabled, recurse further.
|
|
1593
|
-
_AllExtend<Rest, Type, Options> : false : First extends Type ? _AllExtend<Rest, Type, Options> : false : true;
|
|
1534
|
+
type AllExtend<TArray extends UnknownArray, Type, Options extends AllExtendOptions = {}> = IfNotAnyOrNever<CollapseRestElement<TArray>, {
|
|
1535
|
+
ifNot: _AllExtend<CollapseRestElement<TArray>, Type, ApplyDefaultOptions<AllExtendOptions, DefaultAllExtendOptions, Options>>;
|
|
1594
1536
|
ifAny: false;
|
|
1595
1537
|
ifNever: false;
|
|
1596
1538
|
}>;
|
|
1539
|
+
// Kept free of `IfNotAnyOrNever` so that it stays tail-recursive, which allows it to handle long arrays.
|
|
1540
|
+
type _AllExtend<TArray extends UnknownArray, Type, Options extends Required<AllExtendOptions>> = TArray extends readonly [infer First, ...infer Rest] ? IsNever<First> extends true ? Or<Or<IsNever<Type>, IsAny<Type>>, Not<Options['strictNever']>> extends true ?
|
|
1541
|
+
// If target `Type` is also `never`, or is `any`, or `strictNever` is disabled, recurse further.
|
|
1542
|
+
_AllExtend<Rest, Type, Options> : false : First extends Type ? _AllExtend<Rest, Type, Options> : false : true;
|
|
1597
1543
|
//#endregion
|
|
1598
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
1544
|
+
//#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/except.d.ts
|
|
1599
1545
|
/**
|
|
1600
1546
|
Filter out keys from an object.
|
|
1601
1547
|
|
|
@@ -1695,7 +1641,7 @@ type PostPayloadFixed = Except<UserData, 'email'>;
|
|
|
1695
1641
|
type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {}> = _Except<ObjectType, KeysType, ApplyDefaultOptions<ExceptOptions, DefaultExceptOptions, Options>>;
|
|
1696
1642
|
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>> : {});
|
|
1697
1643
|
//#endregion
|
|
1698
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
1644
|
+
//#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/promisable.d.ts
|
|
1699
1645
|
/**
|
|
1700
1646
|
Create a type that represents either the value or the value wrapped in `PromiseLike`.
|
|
1701
1647
|
|
|
@@ -1722,7 +1668,7 @@ await logger(() => Promise.resolve('bar'));
|
|
|
1722
1668
|
*/
|
|
1723
1669
|
type Promisable<T> = T | PromiseLike<T>;
|
|
1724
1670
|
//#endregion
|
|
1725
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
1671
|
+
//#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/is-lowercase.d.ts
|
|
1726
1672
|
/**
|
|
1727
1673
|
Returns a boolean for whether the given string literal is lowercase.
|
|
1728
1674
|
|
|
@@ -1750,7 +1696,7 @@ Returns a boolean for whether an individual part of the string is lowercase.
|
|
|
1750
1696
|
*/
|
|
1751
1697
|
type IsLowercaseHelper<S extends string> = S extends Lowercase<string> ? true : S extends Uppercase<string> | Capitalize<string> | `${string}${Uppercase<string>}${string}` ? false : boolean;
|
|
1752
1698
|
//#endregion
|
|
1753
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
1699
|
+
//#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/is-uppercase.d.ts
|
|
1754
1700
|
/**
|
|
1755
1701
|
Returns a boolean for whether the given string literal is uppercase.
|
|
1756
1702
|
|
|
@@ -1778,7 +1724,7 @@ Returns a boolean for whether an individual part of the string is uppercase.
|
|
|
1778
1724
|
*/
|
|
1779
1725
|
type IsUppercaseHelper<S extends string> = S extends Uppercase<string> ? true : S extends Lowercase<string> | Uncapitalize<string> | `${string}${Lowercase<string>}${string}` ? false : boolean;
|
|
1780
1726
|
//#endregion
|
|
1781
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
1727
|
+
//#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/words.d.ts
|
|
1782
1728
|
type SkipEmptyWord<Word extends string> = Word extends '' ? [] : [Word];
|
|
1783
1729
|
type RemoveLastCharacter<Sentence extends string, Character extends string> = Sentence extends `${infer LeftSide}${Character}` ? SkipEmptyWord<LeftSide> : never;
|
|
1784
1730
|
/**
|
|
@@ -1894,7 +1840,7 @@ WordsImplementation<RemainingCharacters, Options, FirstCharacter, `${CurrentWord
|
|
|
1894
1840
|
// No case change: concat word
|
|
1895
1841
|
WordsImplementation<RemainingCharacters, Options, FirstCharacter, `${CurrentWord}${FirstCharacter}`> : [...SkipEmptyWord<CurrentWord>];
|
|
1896
1842
|
//#endregion
|
|
1897
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
1843
|
+
//#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/delimiter-case.d.ts
|
|
1898
1844
|
type _DefaultDelimiterCaseOptions = Merge<_DefaultWordsOptions, {
|
|
1899
1845
|
splitOnNumbers: false;
|
|
1900
1846
|
}>;
|
|
@@ -1945,7 +1891,7 @@ const rawCliOptions: OddlyCasedProperties<SomeOptions> = {
|
|
|
1945
1891
|
type DelimiterCase<Value, Delimiter extends string, Options extends WordsOptions = {}> = Value extends string ? Delimiter extends string // For distributing `Delimiter`
|
|
1946
1892
|
? IsStringLiteral<Value> extends false ? Value : Lowercase<DelimiterCaseFromArray<Words<Value, ApplyDefaultOptions<WordsOptions, _DefaultDelimiterCaseOptions, Options>>, Delimiter>> : never : Value;
|
|
1947
1893
|
//#endregion
|
|
1948
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
1894
|
+
//#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/kebab-case.d.ts
|
|
1949
1895
|
/**
|
|
1950
1896
|
Convert a string literal to kebab-case.
|
|
1951
1897
|
|
|
@@ -1985,6 +1931,23 @@ const rawCliOptions: KebabCasedProperties<CliOptions> = {
|
|
|
1985
1931
|
*/
|
|
1986
1932
|
type KebabCase<Value, Options extends WordsOptions = {}> = DelimiterCase<Value, '-', ApplyDefaultOptions<WordsOptions, _DefaultDelimiterCaseOptions, Options>>;
|
|
1987
1933
|
//#endregion
|
|
1934
|
+
//#region src/models/shared/ItemMetadataClass.d.ts
|
|
1935
|
+
export interface ItemMetadataClass<TBase extends Class<NonNullable<unknown>>> {
|
|
1936
|
+
new (...args: ConstructorParameters<TBase>): InstanceType<TBase> & ItemMetadata;
|
|
1937
|
+
prototype: InstanceType<TBase> & ItemMetadata;
|
|
1938
|
+
}
|
|
1939
|
+
//#endregion
|
|
1940
|
+
//#region src/models/shared/Serializable.d.ts
|
|
1941
|
+
export declare abstract class Serializable {
|
|
1942
|
+
toJSON(): this;
|
|
1943
|
+
}
|
|
1944
|
+
//#endregion
|
|
1945
|
+
//#region src/models/shared/TakeOne.d.ts
|
|
1946
|
+
export interface TakeOne {
|
|
1947
|
+
<T extends readonly unknown[]>(values: T, index?: number): T[number];
|
|
1948
|
+
<T extends object>(values: T, index: keyof T): T[keyof T];
|
|
1949
|
+
}
|
|
1950
|
+
//#endregion
|
|
1988
1951
|
//#region src/util/types/DeepOmit.d.ts
|
|
1989
1952
|
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;
|
|
1990
1953
|
//#endregion
|
|
@@ -1994,12 +1957,6 @@ export type DeepOptionalUndefined<T> = T extends Date | Function | Primitive ? T
|
|
|
1994
1957
|
//#region src/models/shared/ToData.d.ts
|
|
1995
1958
|
export type ToData<T> = DeepOptionalUndefined<DeepOmit<T, "toJSON">>;
|
|
1996
1959
|
//#endregion
|
|
1997
|
-
//#region src/models/shared/WithMetadata.d.ts
|
|
1998
|
-
export interface WithMetadata<TBase extends Class<NonNullable<unknown>>> {
|
|
1999
|
-
new (...args: ConstructorParameters<TBase>): InstanceType<TBase> & ItemMetadata;
|
|
2000
|
-
prototype: InstanceType<TBase> & ItemMetadata;
|
|
2001
|
-
}
|
|
2002
|
-
//#endregion
|
|
2003
1960
|
//#region src/models/zod/UniqueArraySchemaKey.d.ts
|
|
2004
1961
|
export type UniqueArraySchemaKey<TSchema extends z.ZodType> = TSchema extends z.ZodObject ? keyof TSchema["shape"] & string : keyof z.output<TSchema> & string;
|
|
2005
1962
|
//#endregion
|
|
@@ -2012,9 +1969,6 @@ export declare const SITE_NAME = "Esposter";
|
|
|
2012
1969
|
export declare const KIBIBYTE: number;
|
|
2013
1970
|
export declare const GIBIBYTE: number;
|
|
2014
1971
|
//#endregion
|
|
2015
|
-
//#region src/services/error/createExponentialBackoff.d.ts
|
|
2016
|
-
export declare const createExponentialBackoff: (baseDelayMs: number, maxDelayMs: number) => (<T>(operation: () => Promise<T>) => Promise<T>);
|
|
2017
|
-
//#endregion
|
|
2018
1972
|
//#region src/services/error/getResult.d.ts
|
|
2019
1973
|
export declare const getResult: <T>(fn: () => T) => Result<T, Error>;
|
|
2020
1974
|
//#endregion
|
|
@@ -2030,9 +1984,6 @@ export declare const withFinalizer: <T>(fn: () => T, finalizer?: () => void) =>
|
|
|
2030
1984
|
//#region src/services/error/withFinalizerAsync.d.ts
|
|
2031
1985
|
export declare const withFinalizerAsync: <T>(fn: () => Promisable<T>, finalizer?: () => Promisable<void>) => Promise<T>;
|
|
2032
1986
|
//#endregion
|
|
2033
|
-
//#region src/services/message/classifyMentions.d.ts
|
|
2034
|
-
export declare const classifyMentions: (message: string) => ClassifiedMentions;
|
|
2035
|
-
//#endregion
|
|
2036
1987
|
//#region src/services/message/constants.d.ts
|
|
2037
1988
|
export declare const MENTION_ID_ATTRIBUTE = "data-id";
|
|
2038
1989
|
export declare const MENTION_ITEM_TYPE_ATTRIBUTE = "data-mention-type";
|
|
@@ -2044,7 +1995,6 @@ export declare const MENTION_HERE_ID = "@here";
|
|
|
2044
1995
|
export declare const MENTION_EVERYONE_ID = "@everyone";
|
|
2045
1996
|
export declare const CUSTOM_EMOJI_ID_ATTRIBUTE = "data-custom-emoji-id";
|
|
2046
1997
|
export declare const CUSTOM_EMOJI_NAME_ATTRIBUTE = "data-custom-emoji-name";
|
|
2047
|
-
export declare const CUSTOM_EMOJI_TYPE = "customEmoji";
|
|
2048
1998
|
//#endregion
|
|
2049
1999
|
//#region src/services/message/getMentions.d.ts
|
|
2050
2000
|
export declare const getMentions: (message: string) => HTMLElement[];
|
|
@@ -2062,7 +2012,7 @@ export declare const sanitizeHtml: (...[html, options]: Parameters<typeof baseSa
|
|
|
2062
2012
|
export declare const sanitizeTextHtml: (html: string) => string;
|
|
2063
2013
|
//#endregion
|
|
2064
2014
|
//#region src/services/shared/applyItemMetadataMixin.d.ts
|
|
2065
|
-
export declare const applyItemMetadataMixin: <TBase extends Class<NonNullable<unknown>>>(Base: TBase) =>
|
|
2015
|
+
export declare const applyItemMetadataMixin: <TBase extends Class<NonNullable<unknown>>>(Base: TBase) => ItemMetadataClass<TBase>;
|
|
2066
2016
|
//#endregion
|
|
2067
2017
|
//#region src/services/zod/createNormalizedStringSchema.d.ts
|
|
2068
2018
|
export declare const createNormalizedStringSchema: (maxLength: number, schema?: z.ZodString) => z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
|
|
@@ -2079,24 +2029,9 @@ export declare const chunkBySerializedSize: <T>(items: T[], maxBytes: number, ma
|
|
|
2079
2029
|
//#region src/util/array/takeOne.d.ts
|
|
2080
2030
|
export declare const takeOne: TakeOne;
|
|
2081
2031
|
//#endregion
|
|
2082
|
-
//#region src/util/date/checkIsSameDay.d.ts
|
|
2083
|
-
export declare const checkIsSameDay: (date: Date, otherDate: Date) => boolean;
|
|
2084
|
-
//#endregion
|
|
2085
|
-
//#region src/util/date/checkIsToday.d.ts
|
|
2086
|
-
export declare const checkIsToday: (date: Date) => boolean;
|
|
2087
|
-
//#endregion
|
|
2088
|
-
//#region src/util/date/checkIsYesterday.d.ts
|
|
2089
|
-
export declare const checkIsYesterday: (date: Date) => boolean;
|
|
2090
|
-
//#endregion
|
|
2091
2032
|
//#region src/util/date/getEndOfDay.d.ts
|
|
2092
2033
|
export declare const getEndOfDay: (date: Date) => Date;
|
|
2093
2034
|
//#endregion
|
|
2094
|
-
//#region src/util/date/getPlainDate.d.ts
|
|
2095
|
-
export declare const getPlainDate: (date: Date) => Temporal.PlainDate;
|
|
2096
|
-
//#endregion
|
|
2097
|
-
//#region src/util/date/getStartOfDay.d.ts
|
|
2098
|
-
export declare const getStartOfDay: (date: Date) => Date;
|
|
2099
|
-
//#endregion
|
|
2100
2035
|
//#region src/util/date/getZonedDateTime.d.ts
|
|
2101
2036
|
export declare const getZonedDateTime: (date: Date) => Temporal.ZonedDateTime;
|
|
2102
2037
|
//#endregion
|
|
@@ -2108,7 +2043,6 @@ export declare const noop: () => void;
|
|
|
2108
2043
|
//#endregion
|
|
2109
2044
|
//#region src/util/id/constants.d.ts
|
|
2110
2045
|
export declare const ID_SEPARATOR = "|";
|
|
2111
|
-
export declare const UUID_LENGTH = 36;
|
|
2112
2046
|
//#endregion
|
|
2113
2047
|
//#region src/util/map/getOrCreate.d.ts
|
|
2114
2048
|
export declare const getOrCreate: <TKey, TValue>(map: Map<TKey, TValue>, key: TKey, create: () => TValue) => TValue;
|
|
@@ -2116,6 +2050,41 @@ export declare const getOrCreate: <TKey, TValue>(map: Map<TKey, TValue>, key: TK
|
|
|
2116
2050
|
//#region src/util/object/checkIsPlainObject.d.ts
|
|
2117
2051
|
export declare const checkIsPlainObject: (data: unknown) => data is object;
|
|
2118
2052
|
//#endregion
|
|
2053
|
+
//#region src/util/types/GetArrayProps.d.ts
|
|
2054
|
+
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) | {
|
|
2055
|
+
path: R extends true ? "length" : `${P}.length`;
|
|
2056
|
+
value: T["length"];
|
|
2057
|
+
};
|
|
2058
|
+
//#endregion
|
|
2059
|
+
//#region src/util/types/KnownKeys.d.ts
|
|
2060
|
+
export type KnownKeys<T> = { [K in keyof T as string extends K ? never : number extends K ? never : K]: T[K]; };
|
|
2061
|
+
//#endregion
|
|
2062
|
+
//#region src/util/types/GetObjectProps.d.ts
|
|
2063
|
+
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) | {
|
|
2064
|
+
path: R extends true ? `${K}` : `${P}.${K}`;
|
|
2065
|
+
value: T[K];
|
|
2066
|
+
}; }[keyof KnownKeys<T> & (number | string)];
|
|
2067
|
+
//#endregion
|
|
2068
|
+
//#region src/util/types/GetPrimitiveProps.d.ts
|
|
2069
|
+
export type GetPrimitiveProps<T, P extends string, D extends unknown[], R extends boolean> = T extends string ? {
|
|
2070
|
+
path: R extends true ? "length" : `${P}.length`;
|
|
2071
|
+
value: number;
|
|
2072
|
+
} : T extends symbol ? (D extends [unknown, ...infer Rest] ? GetProperties<string | undefined, R extends true ? "description" : `${P}.description`, Rest, false> : never) | {
|
|
2073
|
+
path: R extends true ? "description" : `${P}.description`;
|
|
2074
|
+
value: string | undefined;
|
|
2075
|
+
} : never;
|
|
2076
|
+
//#endregion
|
|
2077
|
+
//#region src/util/types/GetProperties.d.ts
|
|
2078
|
+
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;
|
|
2079
|
+
//#endregion
|
|
2080
|
+
//#region src/util/types/GetPaths.d.ts
|
|
2081
|
+
export type GetPaths<T> = GetProperties<T> extends (infer U) ? (U extends {
|
|
2082
|
+
path: infer Path;
|
|
2083
|
+
} ? Path : never) : never;
|
|
2084
|
+
//#endregion
|
|
2085
|
+
//#region src/util/types/PropertyNames.d.ts
|
|
2086
|
+
export type PropertyNames<T> = { [P in GetPaths<T>]: P; };
|
|
2087
|
+
//#endregion
|
|
2119
2088
|
//#region src/util/object/getPropertyNames.d.ts
|
|
2120
2089
|
export declare const getPropertyNames: <T>() => PropertyNames<T>;
|
|
2121
2090
|
//#endregion
|
|
@@ -2179,9 +2148,6 @@ export type FunctionProperties<T> = { [K in keyof T]: T[K] extends Function ? K
|
|
|
2179
2148
|
//#region src/util/types/ExcludeFunctionProperties.d.ts
|
|
2180
2149
|
export type ExcludeFunctionProperties<T> = Except<T, FunctionProperties<T>[keyof T]>;
|
|
2181
2150
|
//#endregion
|
|
2182
|
-
//#region src/util/types/MapValue.d.ts
|
|
2183
|
-
export type MapValue<BaseType> = BaseType extends Map<unknown, infer ValueType> ? ValueType : never;
|
|
2184
|
-
//#endregion
|
|
2185
2151
|
//#region src/util/types/TupleSplit.d.ts
|
|
2186
2152
|
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, []];
|
|
2187
2153
|
//#endregion
|
|
@@ -2197,9 +2163,6 @@ export type TupleSlice<T extends unknown[], S extends number, E extends number =
|
|
|
2197
2163
|
//#region src/util/validation/exhaustiveGuard.d.ts
|
|
2198
2164
|
export declare const exhaustiveGuard: (value: never) => never;
|
|
2199
2165
|
//#endregion
|
|
2200
|
-
//#region src/util/id/uuid/checkIsUuidV4.d.ts
|
|
2201
|
-
export declare const checkIsUuidV4: (uuid: string) => boolean;
|
|
2202
|
-
//#endregion
|
|
2203
2166
|
//#region src/util/id/uuid/constants.d.ts
|
|
2204
2167
|
export declare const UUIDV4_REGEX: RegExp;
|
|
2205
2168
|
//#endregion
|
package/dist/index.js
CHANGED
|
@@ -146,11 +146,7 @@ const RoutePath = {
|
|
|
146
146
|
View: (type, id) => `/view/${type}/${id}`
|
|
147
147
|
};
|
|
148
148
|
//#endregion
|
|
149
|
-
//#region src/util/object/getPropertyNames.ts
|
|
150
|
-
const getPropertyNames = () => new Proxy({}, { get: (_target, property) => property });
|
|
151
|
-
//#endregion
|
|
152
149
|
//#region src/models/shared/ItemEntityType.ts
|
|
153
|
-
const ItemEntityTypePropertyNames = getPropertyNames();
|
|
154
150
|
const createItemEntityTypeSchema = (schema) => z.object({ type: schema });
|
|
155
151
|
//#endregion
|
|
156
152
|
//#region src/models/shared/ItemMetadata.ts
|
|
@@ -159,12 +155,6 @@ var ItemMetadata = class {
|
|
|
159
155
|
deletedAt = null;
|
|
160
156
|
updatedAt = /* @__PURE__ */ new Date();
|
|
161
157
|
};
|
|
162
|
-
const ItemMetadataPropertyNames = getPropertyNames();
|
|
163
|
-
const itemMetadataSchema = z.object({
|
|
164
|
-
createdAt: z.date(),
|
|
165
|
-
deletedAt: z.date().nullable(),
|
|
166
|
-
updatedAt: z.date()
|
|
167
|
-
});
|
|
168
158
|
//#endregion
|
|
169
159
|
//#region src/models/shared/Operation.ts
|
|
170
160
|
let Operation = /* @__PURE__ */ function(Operation) {
|
|
@@ -207,32 +197,12 @@ const toAppError = (error) => {
|
|
|
207
197
|
else return new Error(String(error), { cause: error });
|
|
208
198
|
};
|
|
209
199
|
//#endregion
|
|
210
|
-
//#region src/services/error/getResultAsync.ts
|
|
211
|
-
const getResultAsync = (fn) => ResultAsync.fromThrowable(fn, toAppError)();
|
|
212
|
-
//#endregion
|
|
213
|
-
//#region src/util/time/sleep.ts
|
|
214
|
-
const sleep = (durationMs) => new Promise((resolve) => {
|
|
215
|
-
setTimeout(resolve, durationMs);
|
|
216
|
-
});
|
|
217
|
-
//#endregion
|
|
218
|
-
//#region src/services/error/createExponentialBackoff.ts
|
|
219
|
-
const createExponentialBackoff = (baseDelayMs, maxDelayMs) => {
|
|
220
|
-
let failureCount = 0;
|
|
221
|
-
return async (operation) => {
|
|
222
|
-
if (failureCount > 0) await sleep(Math.min(baseDelayMs * 2 ** (failureCount - 1), maxDelayMs));
|
|
223
|
-
return getResultAsync(operation).match((value) => {
|
|
224
|
-
failureCount = 0;
|
|
225
|
-
return value;
|
|
226
|
-
}, (error) => {
|
|
227
|
-
failureCount += 1;
|
|
228
|
-
throw error;
|
|
229
|
-
});
|
|
230
|
-
};
|
|
231
|
-
};
|
|
232
|
-
//#endregion
|
|
233
200
|
//#region src/services/error/getResult.ts
|
|
234
201
|
const getResult = (fn) => fromThrowable(fn, toAppError)();
|
|
235
202
|
//#endregion
|
|
203
|
+
//#region src/services/error/getResultAsync.ts
|
|
204
|
+
const getResultAsync = (fn) => ResultAsync.fromThrowable(fn, toAppError)();
|
|
205
|
+
//#endregion
|
|
236
206
|
//#region src/services/error/withFinalizer.ts
|
|
237
207
|
const withFinalizer = (fn, finalizer) => {
|
|
238
208
|
const result = getResult(fn);
|
|
@@ -270,25 +240,10 @@ const MENTION_HERE_ID = "@here";
|
|
|
270
240
|
const MENTION_EVERYONE_ID = "@everyone";
|
|
271
241
|
const CUSTOM_EMOJI_ID_ATTRIBUTE = "data-custom-emoji-id";
|
|
272
242
|
const CUSTOM_EMOJI_NAME_ATTRIBUTE = "data-custom-emoji-name";
|
|
273
|
-
const CUSTOM_EMOJI_TYPE = "customEmoji";
|
|
274
243
|
//#endregion
|
|
275
244
|
//#region src/services/message/getMentions.ts
|
|
276
245
|
const getMentions = (message) => parse(message).querySelectorAll(MENTION_SELECTOR);
|
|
277
246
|
//#endregion
|
|
278
|
-
//#region src/services/message/classifyMentions.ts
|
|
279
|
-
const BROADCAST_MENTION_IDS = /* @__PURE__ */ new Set([MENTION_EVERYONE_ID, MENTION_HERE_ID]);
|
|
280
|
-
const classifyMentions = (message) => {
|
|
281
|
-
const mentions = getMentions(message).map((mention) => ({
|
|
282
|
-
id: mention.getAttribute(MENTION_ID_ATTRIBUTE),
|
|
283
|
-
type: mention.getAttribute(MENTION_ITEM_TYPE_ATTRIBUTE)
|
|
284
|
-
})).filter((mention) => Boolean(mention.id));
|
|
285
|
-
return {
|
|
286
|
-
broadcastIds: mentions.filter(({ id }) => BROADCAST_MENTION_IDS.has(id)).map(({ id }) => id),
|
|
287
|
-
regularUserIds: mentions.filter(({ id, type }) => !BROADCAST_MENTION_IDS.has(id) && type !== "role").map(({ id }) => id),
|
|
288
|
-
roleIds: mentions.filter(({ type }) => type === "role").map(({ id }) => id)
|
|
289
|
-
};
|
|
290
|
-
};
|
|
291
|
-
//#endregion
|
|
292
247
|
//#region src/services/prettier/css.ts
|
|
293
248
|
const css = String.raw;
|
|
294
249
|
//#endregion
|
|
@@ -414,30 +369,14 @@ const takeOne = (values, index = 0) => {
|
|
|
414
369
|
//#region src/util/date/getZonedDateTime.ts
|
|
415
370
|
const getZonedDateTime = (date) => Temporal.Instant.fromEpochMilliseconds(date.getTime()).toZonedDateTimeISO(Temporal.Now.timeZoneId());
|
|
416
371
|
//#endregion
|
|
417
|
-
//#region src/util/date/getPlainDate.ts
|
|
418
|
-
const getPlainDate = (date) => getZonedDateTime(date).toPlainDate();
|
|
419
|
-
//#endregion
|
|
420
|
-
//#region src/util/date/checkIsSameDay.ts
|
|
421
|
-
const checkIsSameDay = (date, otherDate) => getPlainDate(date).equals(getPlainDate(otherDate));
|
|
422
|
-
//#endregion
|
|
423
|
-
//#region src/util/date/checkIsToday.ts
|
|
424
|
-
const checkIsToday = (date) => getPlainDate(date).equals(Temporal.Now.plainDateISO());
|
|
425
|
-
//#endregion
|
|
426
|
-
//#region src/util/date/checkIsYesterday.ts
|
|
427
|
-
const checkIsYesterday = (date) => getPlainDate(date).equals(Temporal.Now.plainDateISO().subtract({ days: 1 }));
|
|
428
|
-
//#endregion
|
|
429
372
|
//#region src/util/date/getEndOfDay.ts
|
|
430
373
|
const getEndOfDay = (date) => /* @__PURE__ */ new Date(getZonedDateTime(date).startOfDay().add({ days: 1 }).epochMilliseconds - 1);
|
|
431
374
|
//#endregion
|
|
432
|
-
//#region src/util/date/getStartOfDay.ts
|
|
433
|
-
const getStartOfDay = (date) => new Date(getZonedDateTime(date).startOfDay().epochMilliseconds);
|
|
434
|
-
//#endregion
|
|
435
375
|
//#region src/util/environment/checkIsServer.ts
|
|
436
376
|
const checkIsServer = () => typeof window === "undefined";
|
|
437
377
|
//#endregion
|
|
438
378
|
//#region src/util/id/constants.ts
|
|
439
379
|
const ID_SEPARATOR = "|";
|
|
440
|
-
const UUID_LENGTH = 36;
|
|
441
380
|
//#endregion
|
|
442
381
|
//#region src/util/map/getOrCreate.ts
|
|
443
382
|
const getOrCreate = (map, key, create) => {
|
|
@@ -454,6 +393,9 @@ const checkIsPlainObject = (data) => {
|
|
|
454
393
|
return prototype === null || prototype === Object.prototype;
|
|
455
394
|
};
|
|
456
395
|
//#endregion
|
|
396
|
+
//#region src/util/object/getPropertyNames.ts
|
|
397
|
+
const getPropertyNames = () => new Proxy({}, { get: (_target, property) => property });
|
|
398
|
+
//#endregion
|
|
457
399
|
//#region src/util/object/jsonDateParse.ts
|
|
458
400
|
const ISO_DATE_REGEX = /^(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})T(?<hours>\d{2}):(?<minutes>\d{2}):(?<seconds>\d{2}(?:\.{0,1}\d*))(?:Z|(?<sign>\+|-)(?<offset>[\d|:]*))?$/u;
|
|
459
401
|
const MS_AJAX_DATE_REGEX = /^\/Date\((?<timestamp>-?\d+(?:[-+]\d+)?)\)[/\\]$/u;
|
|
@@ -547,6 +489,11 @@ const now = () => {
|
|
|
547
489
|
return (BigInt(loadMilliseconds) * 10n ** 6n + (BigInt(seconds) * 10n ** 9n + BigInt(nanoseconds))).toString();
|
|
548
490
|
};
|
|
549
491
|
//#endregion
|
|
492
|
+
//#region src/util/time/sleep.ts
|
|
493
|
+
const sleep = (durationMs) => new Promise((resolve) => {
|
|
494
|
+
setTimeout(resolve, durationMs);
|
|
495
|
+
});
|
|
496
|
+
//#endregion
|
|
550
497
|
//#region src/util/validation/exhaustiveGuard.ts
|
|
551
498
|
const exhaustiveGuard = (value) => {
|
|
552
499
|
throw new InvalidOperationError("Read", exhaustiveGuard.name, JSON.stringify(value));
|
|
@@ -555,7 +502,4 @@ const exhaustiveGuard = (value) => {
|
|
|
555
502
|
//#region src/util/id/uuid/constants.ts
|
|
556
503
|
const UUIDV4_REGEX = /^[0-9A-F]{8}-[0-9A-F]{4}-[4][0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/iu;
|
|
557
504
|
//#endregion
|
|
558
|
-
|
|
559
|
-
const checkIsUuidV4 = (uuid) => UUIDV4_REGEX.test(uuid);
|
|
560
|
-
//#endregion
|
|
561
|
-
export { AllSpecialValues, CUSTOM_EMOJI_ID_ATTRIBUTE, CUSTOM_EMOJI_NAME_ATTRIBUTE, CUSTOM_EMOJI_TYPE, ForbiddenError, GIBIBYTE, ID_SEPARATOR, InvalidOperationError, ItemEntityTypePropertyNames, ItemMetadata, ItemMetadataPropertyNames, KIBIBYTE, MAX_READ_LIMIT, MENTION_EVERYONE_ID, MENTION_HERE_ID, MENTION_ID_ATTRIBUTE, MENTION_ITEM_TYPE_ATTRIBUTE, MENTION_LABEL_ATTRIBUTE, MENTION_SELECTOR, MENTION_TYPE, MENTION_TYPE_ATTRIBUTE, MentionType, NotFoundError, NotInitializedError, Operation, RoutePath, SITE_NAME, Serializable, UUIDV4_REGEX, UUID_LENGTH, WordFilteredError, applyItemMetadataMixin, capitalize, checkIsPlainObject, checkIsSameDay, checkIsServer, checkIsToday, checkIsUuidV4, checkIsYesterday, chunk, chunkBySerializedSize, classifyMentions, createExponentialBackoff, createItemEntityTypeSchema, createNormalizedStringSchema, createUniqueArraySchema, css, encodeUrlSubDelimiters, exhaustiveGuard, getDecodedUriComponent, getEndOfDay, getMentions, getOrCreate, getPlainDate, getPropertyNames, getRawData, getResult, getResultAsync, getStartOfDay, getZonedDateTime, hrtime, html, itemMetadataSchema, jsonDateParse, mergeObjectsStrict, noop, normalizeString, now, sanitizeHtml, sanitizeTextHtml, settleAll, sleep, streamToText, takeOne, toAppError, toKebabCase, toRawDeep, truncate, uncapitalize, withFinalizer, withFinalizerAsync };
|
|
505
|
+
export { AllSpecialValues, CUSTOM_EMOJI_ID_ATTRIBUTE, CUSTOM_EMOJI_NAME_ATTRIBUTE, ForbiddenError, GIBIBYTE, ID_SEPARATOR, InvalidOperationError, ItemMetadata, KIBIBYTE, MAX_READ_LIMIT, MENTION_EVERYONE_ID, MENTION_HERE_ID, MENTION_ID_ATTRIBUTE, MENTION_ITEM_TYPE_ATTRIBUTE, MENTION_LABEL_ATTRIBUTE, MENTION_SELECTOR, MENTION_TYPE, MENTION_TYPE_ATTRIBUTE, MentionType, NotFoundError, NotInitializedError, Operation, RoutePath, SITE_NAME, Serializable, UUIDV4_REGEX, WordFilteredError, applyItemMetadataMixin, capitalize, checkIsPlainObject, checkIsServer, chunk, chunkBySerializedSize, createItemEntityTypeSchema, createNormalizedStringSchema, createUniqueArraySchema, css, encodeUrlSubDelimiters, exhaustiveGuard, getDecodedUriComponent, getEndOfDay, getMentions, getOrCreate, getPropertyNames, getRawData, getResult, getResultAsync, getZonedDateTime, hrtime, html, jsonDateParse, mergeObjectsStrict, noop, normalizeString, now, sanitizeHtml, sanitizeTextHtml, settleAll, sleep, streamToText, takeOne, toAppError, toKebabCase, toRawDeep, truncate, uncapitalize, withFinalizer, withFinalizerAsync };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@esposter/shared",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "A library that contains shared typescript code.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"error-handling",
|
|
@@ -56,20 +56,20 @@
|
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@arethetypeswrong/core": "^0.18.5",
|
|
58
58
|
"@azure/data-tables": "^13.3.2",
|
|
59
|
-
"@esposter/configuration": "3.
|
|
60
|
-
"@types/node": "^26.
|
|
59
|
+
"@esposter/configuration": "3.2.0",
|
|
60
|
+
"@types/node": "^26.6.1",
|
|
61
61
|
"@types/sanitize-html": "^2.16.1",
|
|
62
62
|
"publint": "^0.3.24",
|
|
63
63
|
"tsdown": "^0.23.0",
|
|
64
|
-
"type-fest": "^5.
|
|
65
|
-
"vitest": "^5.0.
|
|
66
|
-
"vue": "^3.5.
|
|
64
|
+
"type-fest": "^5.10.0",
|
|
65
|
+
"vitest": "^5.0.1",
|
|
66
|
+
"vue": "^3.5.43"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
|
-
"zod": "^4.6.
|
|
69
|
+
"zod": "^4.6.5"
|
|
70
70
|
},
|
|
71
71
|
"inlinedDependencies": {
|
|
72
|
-
"type-fest": "5.
|
|
72
|
+
"type-fest": "5.10.0"
|
|
73
73
|
},
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "bc055ed2f154eff219a355016a6b586962dbfa9c"
|
|
75
75
|
}
|