@esposter/shared 3.0.0 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.d.ts +120 -148
  2. package/dist/index.js +35 -78
  3. package/package.json +9 -9
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ import { Result, ResultAsync } from "neverthrow";
3
3
  import { HTMLElement } from "node-html-parser";
4
4
  import baseSanitizeHtml from "sanitize-html";
5
5
  //#region src/test/constants.d.ts
6
- export declare const AllSpecialValues: {
6
+ export declare const ALL_SPECIAL_VALUES: {
7
7
  isPlainObject: boolean;
8
8
  value: unknown;
9
9
  }[];
@@ -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",
@@ -65,6 +58,7 @@ export interface MaybeReactive {
65
58
  export declare const RoutePath: {
66
59
  readonly About: "/about";
67
60
  readonly Achievements: "/achievements";
61
+ readonly AgentConsole: "/agent-console";
68
62
  readonly Anime: "/anime";
69
63
  readonly Calls: (id: string) => string;
70
64
  readonly CallsIndex: "/calls";
@@ -102,46 +96,10 @@ export declare const RoutePath: {
102
96
  };
103
97
  export type RoutePath = typeof RoutePath;
104
98
  //#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
99
  //#region src/models/shared/ItemEntityType.d.ts
141
100
  export interface ItemEntityType<T extends string> {
142
101
  type: T;
143
102
  }
144
- export declare const ItemEntityTypePropertyNames: PropertyNames<ItemEntityType<string>>;
145
103
  export declare const createItemEntityTypeSchema: <T extends z.ZodType<string>>(schema: T) => z.ZodObject<{
146
104
  type: T;
147
105
  }>;
@@ -152,25 +110,8 @@ export declare class ItemMetadata {
152
110
  deletedAt: Date | null;
153
111
  updatedAt: Date;
154
112
  }
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
113
  //#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
- //#endregion
173
- //#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/primitive.d.ts
114
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/primitive.d.ts
174
115
  /**
175
116
  Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
176
117
 
@@ -178,7 +119,7 @@ Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/
178
119
  */
179
120
  type Primitive = null | undefined | string | number | boolean | symbol | bigint;
180
121
  //#endregion
181
- //#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/basic.d.ts
122
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/basic.d.ts
182
123
  /**
183
124
  Matches a [`class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes).
184
125
 
@@ -189,7 +130,7 @@ type Class<T, Arguments extends unknown[] = any[]> = {
189
130
  new (...arguments_: Arguments): T;
190
131
  };
191
132
  //#endregion
192
- //#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/union-to-intersection.d.ts
133
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/union-to-intersection.d.ts
193
134
  /**
194
135
  Convert a union type to an intersection type.
195
136
 
@@ -223,7 +164,7 @@ never
223
164
  // The `& Union` is to ensure result of `UnionToIntersection<A | B>` is always assignable to `A | B`
224
165
  Intersection & Union : never;
225
166
  //#endregion
226
- //#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/keys-of-union.d.ts
167
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/keys-of-union.d.ts
227
168
  /**
228
169
  Create a union of all keys from a given type, even those exclusive to specific union members.
229
170
 
@@ -265,7 +206,7 @@ type KeysOfUnion<ObjectType> =
265
206
  // Hack to fix https://github.com/sindresorhus/type-fest/issues/1008
266
207
  keyof UnionToIntersection<ObjectType extends unknown ? Record<keyof ObjectType, never> : never>;
267
208
  //#endregion
268
- //#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/is-any.d.ts
209
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/is-any.d.ts
269
210
  /**
270
211
  Returns a boolean for whether the given type is `any`.
271
212
 
@@ -296,7 +237,7 @@ const anyA = get(anyObject, 'a');
296
237
  */
297
238
  type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;
298
239
  //#endregion
299
- //#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/is-optional-key-of.d.ts
240
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/is-optional-key-of.d.ts
300
241
  /**
301
242
  Returns a boolean for whether the given key is an optional key of type.
302
243
 
@@ -339,7 +280,7 @@ type T5 = IsOptionalKeyOf<User | Admin, 'surname'>;
339
280
  */
340
281
  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
282
  //#endregion
342
- //#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/optional-keys-of.d.ts
283
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/optional-keys-of.d.ts
343
284
  /**
344
285
  Extract all optional keys from the given type.
345
286
 
@@ -377,7 +318,7 @@ type OptionalKeysOf<Type extends object> = Type extends unknown // For distribut
377
318
  ? (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
319
  : never; // Should never happen
379
320
  //#endregion
380
- //#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/required-keys-of.d.ts
321
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/required-keys-of.d.ts
381
322
  /**
382
323
  Extract all required keys from the given type.
383
324
 
@@ -411,7 +352,7 @@ const validator3 = createValidation<User>('luckyNumber', value => value > 0);
411
352
  type RequiredKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
412
353
  ? Exclude<keyof Type, OptionalKeysOf<Type>> : never; // Should never happen
413
354
  //#endregion
414
- //#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/is-never.d.ts
355
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/is-never.d.ts
415
356
  /**
416
357
  Returns a boolean for whether the given type is `never`.
417
358
 
@@ -467,7 +408,7 @@ type B = IsTrueFixed<never>;
467
408
  */
468
409
  type IsNever<T> = [T] extends [never] ? true : false;
469
410
  //#endregion
470
- //#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/if.d.ts
411
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/if.d.ts
471
412
  /**
472
413
  An if-else-like type that resolves depending on whether the given `boolean` type is `true` or `false`.
473
414
 
@@ -562,7 +503,7 @@ type Works = IncludesWithoutIf<HundredZeroes, '1'>;
562
503
  */
563
504
  type If<Type extends boolean, IfBranch, ElseBranch> = IsNever<Type> extends true ? ElseBranch : Type extends true ? IfBranch : ElseBranch;
564
505
  //#endregion
565
- //#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/unknown-array.d.ts
506
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/unknown-array.d.ts
566
507
  /**
567
508
  Represents an array with `unknown` value.
568
509
 
@@ -589,7 +530,7 @@ type C = IsArray<string>;
589
530
  */
590
531
  type UnknownArray = readonly unknown[];
591
532
  //#endregion
592
- //#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/internal/type.d.ts
533
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/internal/type.d.ts
593
534
  /**
594
535
  Returns a boolean for whether A is false.
595
536
 
@@ -657,7 +598,7 @@ Indicates the value of `exactOptionalPropertyTypes` compiler option.
657
598
  */
658
599
  type IsExactOptionalPropertyTypesEnabled = [(string | undefined)?] extends [string?] ? false : true;
659
600
  //#endregion
660
- //#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/internal/array.d.ts
601
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/internal/array.d.ts
661
602
  /**
662
603
  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
604
 
@@ -693,16 +634,20 @@ type CollapseRestElement<TArray extends UnknownArray> = IfNotAnyOrNever<TArray,
693
634
  ifNot: _CollapseRestElement<TArray>;
694
635
  }>;
695
636
  type _CollapseRestElement<TArray extends UnknownArray, ForwardAccumulator extends UnknownArray = [], BackwardAccumulator extends UnknownArray = []> = TArray extends UnknownArray // For distributing `TArray`
696
- ? keyof TArray & `${number}` extends never ?
637
+ ? '0' extends keyof TArray ?
638
+ // Enters this branch, if `TArray` starts with a non-rest element (e.g., `[string, number]` or `[string, ...number[]]`).
639
+ TArray extends readonly [(infer First)?, ...infer Rest] ? _CollapseRestElement<Rest, [...ForwardAccumulator,
640
+ // 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.
641
+ TArray extends readonly [unknown, ...unknown[]] ? First : If<IsExactOptionalPropertyTypesEnabled, First, First | undefined> // Add `| undefined` for optional elements, if `exactOptionalPropertyTypes` is disabled.
642
+ ], BackwardAccumulator> : never // Should never happen, since `[(infer First)?, ...infer Rest]` is a top-type for arrays.
643
+ :
697
644
  // Enters this branch, if `TArray` is empty (e.g., []),
698
645
  // or `TArray` contains no non-rest elements preceding the rest element (e.g., `[...string[]]` or `[...string[], string]`).
699
646
  TArray extends readonly [...infer Rest, infer Last] ? _CollapseRestElement<Rest, ForwardAccumulator, [Last, ...BackwardAccumulator]> // Accumulate elements that are present after the rest element.
700
647
  : 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
648
  : never; // Should never happen
704
649
  //#endregion
705
- //#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/internal/characters.d.ts
650
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/internal/characters.d.ts
706
651
  type Whitespace = '\t' // '\t'
707
652
  | '\n' // '\n'
708
653
  | '\v' // '\v'
@@ -713,7 +658,7 @@ type Whitespace = '\t' // '\t'
713
658
  type WordSeparators = '-' | '_' | Whitespace;
714
659
  type AsciiPunctuation = '!' | '"' | '#' | '$' | '%' | '&' | '\'' | '(' | ')' | '*' | '+' | ',' | '-' | '.' | '/' | ':' | ';' | '<' | '=' | '>' | '?' | '@' | '[' | '\\' | ']' | '^' | '_' | '`' | '{' | '|' | '}' | '~';
715
660
  //#endregion
716
- //#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/simplify.d.ts
661
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/simplify.d.ts
717
662
  /**
718
663
  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
664
 
@@ -774,7 +719,7 @@ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface`
774
719
  */
775
720
  type Simplify<T> = { [KeyType in keyof T]: T[KeyType]; } & {};
776
721
  //#endregion
777
- //#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/is-equal.d.ts
722
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/is-equal.d.ts
778
723
  /**
779
724
  Returns a boolean for whether the two given types are equal.
780
725
 
@@ -805,7 +750,7 @@ type IsEqual<A, B> = [A] extends [B] ? [B] extends [A] ? _IsEqual<A, B> : false
805
750
  // This version fails the `equalWrappedTupleIntersectionToBeNeverAndNeverExpanded` test in `test-d/is-equal.ts`.
806
751
  type _IsEqual<A, B> = (<G>() => G extends A & G | G ? 1 : 2) extends (<G>() => G extends B & G | G ? 1 : 2) ? true : false;
807
752
  //#endregion
808
- //#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/omit-index-signature.d.ts
753
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/omit-index-signature.d.ts
809
754
  /**
810
755
  Omit any index signatures from the given object type, leaving only explicitly defined properties.
811
756
 
@@ -899,7 +844,7 @@ type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
899
844
  */
900
845
  type OmitIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType]; };
901
846
  //#endregion
902
- //#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/pick-index-signature.d.ts
847
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/pick-index-signature.d.ts
903
848
  /**
904
849
  Pick only index signatures from the given object type, leaving out all explicitly defined properties.
905
850
 
@@ -947,7 +892,7 @@ type ExampleIndexSignature = PickIndexSignature<Example>;
947
892
  */
948
893
  type PickIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? KeyType : never]: ObjectType[KeyType]; };
949
894
  //#endregion
950
- //#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/merge.d.ts
895
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/merge.d.ts
951
896
  // Merges two objects without worrying about index signatures.
952
897
  type SimpleMerge<Destination, Source> = Simplify<{ [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key]; } & Source>;
953
898
  /**
@@ -1018,7 +963,7 @@ type Merge<Destination, Source> = Destination extends unknown // For distributin
1018
963
  : never; // Should never happen
1019
964
  type _Merge<Destination, Source> = Simplify<SimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>> & SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>>;
1020
965
  //#endregion
1021
- //#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/trim.d.ts
966
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/trim.d.ts
1022
967
  /**
1023
968
  Remove spaces from the left side.
1024
969
  */
@@ -1043,7 +988,7 @@ type Example = Trim<' foo '>;
1043
988
  */
1044
989
  type Trim<V extends string> = TrimLeft<TrimRight<V>>;
1045
990
  //#endregion
1046
- //#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/some-extend.d.ts
991
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/some-extend.d.ts
1047
992
  /**
1048
993
  @see {@link SomeExtend}
1049
994
  */
@@ -1130,16 +1075,17 @@ type B = SomeExtend<[1?, 2?, '3'?], string | undefined>;
1130
1075
  @category Utilities
1131
1076
  @category Array
1132
1077
  */
1133
- type SomeExtend<TArray extends UnknownArray, Type, Options extends SomeExtendOptions = {}> = _SomeExtend<CollapseRestElement<TArray>, Type, ApplyDefaultOptions<SomeExtendOptions, DefaultSomeExtendOptions, Options>>;
1134
- type _SomeExtend<TArray extends UnknownArray, Type, Options extends Required<SomeExtendOptions>> = IfNotAnyOrNever<TArray, {
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;
1078
+ type SomeExtend<TArray extends UnknownArray, Type, Options extends SomeExtendOptions = {}> = IfNotAnyOrNever<CollapseRestElement<TArray>, {
1079
+ ifNot: _SomeExtend<CollapseRestElement<TArray>, Type, ApplyDefaultOptions<SomeExtendOptions, DefaultSomeExtendOptions, Options>>;
1138
1080
  ifAny: false;
1139
1081
  ifNever: false;
1140
1082
  }>;
1083
+ // Kept free of `IfNotAnyOrNever` so that it stays tail-recursive, which allows it to handle long arrays.
1084
+ 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 ?
1085
+ // If target `Type` is also `never`, or is `any`, or `strictNever` is disabled, return `true`.
1086
+ true : _SomeExtend<Rest, Type, Options> : First extends Type ? true : _SomeExtend<Rest, Type, Options> : false;
1141
1087
  //#endregion
1142
- //#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/or-all.d.ts
1088
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/or-all.d.ts
1143
1089
  /**
1144
1090
  Returns a boolean for whether any of the given elements is `true`.
1145
1091
 
@@ -1210,7 +1156,7 @@ Note: `OrAll<[]>` evaluates to `false` because there are no `true` elements in a
1210
1156
  */
1211
1157
  type OrAll<T extends readonly boolean[]> = SomeExtend<T, true>;
1212
1158
  //#endregion
1213
- //#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/or.d.ts
1159
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/or.d.ts
1214
1160
  /**
1215
1161
  Returns a boolean for whether either of two given types is `true`.
1216
1162
 
@@ -1290,7 +1236,7 @@ type G = Or<never, never>;
1290
1236
  */
1291
1237
  type Or<A extends boolean, B extends boolean> = OrAll<[A, B]>;
1292
1238
  //#endregion
1293
- //#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/internal/string.d.ts
1239
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/internal/string.d.ts
1294
1240
  /**
1295
1241
  Returns a boolean for whether the given string `S` starts with the given string `SearchString`.
1296
1242
 
@@ -1320,7 +1266,7 @@ This type is a workaround for [Microsoft/TypeScript#46109](https://github.com/mi
1320
1266
  */
1321
1267
  type IsNumeric<T extends string> = T extends `${number}` ? Trim<T> extends T ? true : false : false;
1322
1268
  //#endregion
1323
- //#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/internal/object.d.ts
1269
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/internal/object.d.ts
1324
1270
  /**
1325
1271
  Merges user specified options with default options.
1326
1272
 
@@ -1429,7 +1375,7 @@ type UnwrapBrand<T> = IfNotAnyOrNever<T, {
1429
1375
  }>;
1430
1376
  type _UnwrapBrand<T, Base> = T extends Primitive ? T extends (infer U) & Pick<T, Exclude<keyof T, KeysOfUnion<Base>>> ? U : T : T;
1431
1377
  //#endregion
1432
- //#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/is-string-literal.d.ts
1378
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/is-string-literal.d.ts
1433
1379
  /**
1434
1380
  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
1381
 
@@ -1493,7 +1439,7 @@ type _IsStringLiteral<S> =
1493
1439
  // and since `{}` extends index signatures, the result becomes `false`.
1494
1440
  S extends string ? {} extends Record<S, never> ? false : true : false;
1495
1441
  //#endregion
1496
- //#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/all-extend.d.ts
1442
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/all-extend.d.ts
1497
1443
  /**
1498
1444
  @see {@link AllExtend}
1499
1445
  */
@@ -1586,16 +1532,17 @@ type B = AllExtend<[1?, 2?, 3?], number | undefined>;
1586
1532
  @category Utilities
1587
1533
  @category Array
1588
1534
  */
1589
- type AllExtend<TArray extends UnknownArray, Type, Options extends AllExtendOptions = {}> = _AllExtend<CollapseRestElement<TArray>, Type, ApplyDefaultOptions<AllExtendOptions, DefaultAllExtendOptions, Options>>;
1590
- type _AllExtend<TArray extends UnknownArray, Type, Options extends Required<AllExtendOptions>> = IfNotAnyOrNever<TArray, {
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;
1535
+ type AllExtend<TArray extends UnknownArray, Type, Options extends AllExtendOptions = {}> = IfNotAnyOrNever<CollapseRestElement<TArray>, {
1536
+ ifNot: _AllExtend<CollapseRestElement<TArray>, Type, ApplyDefaultOptions<AllExtendOptions, DefaultAllExtendOptions, Options>>;
1594
1537
  ifAny: false;
1595
1538
  ifNever: false;
1596
1539
  }>;
1540
+ // Kept free of `IfNotAnyOrNever` so that it stays tail-recursive, which allows it to handle long arrays.
1541
+ 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 ?
1542
+ // If target `Type` is also `never`, or is `any`, or `strictNever` is disabled, recurse further.
1543
+ _AllExtend<Rest, Type, Options> : false : First extends Type ? _AllExtend<Rest, Type, Options> : false : true;
1597
1544
  //#endregion
1598
- //#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/except.d.ts
1545
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/except.d.ts
1599
1546
  /**
1600
1547
  Filter out keys from an object.
1601
1548
 
@@ -1695,7 +1642,7 @@ type PostPayloadFixed = Except<UserData, 'email'>;
1695
1642
  type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {}> = _Except<ObjectType, KeysType, ApplyDefaultOptions<ExceptOptions, DefaultExceptOptions, Options>>;
1696
1643
  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
1644
  //#endregion
1698
- //#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/promisable.d.ts
1645
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/promisable.d.ts
1699
1646
  /**
1700
1647
  Create a type that represents either the value or the value wrapped in `PromiseLike`.
1701
1648
 
@@ -1722,7 +1669,7 @@ await logger(() => Promise.resolve('bar'));
1722
1669
  */
1723
1670
  type Promisable<T> = T | PromiseLike<T>;
1724
1671
  //#endregion
1725
- //#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/is-lowercase.d.ts
1672
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/is-lowercase.d.ts
1726
1673
  /**
1727
1674
  Returns a boolean for whether the given string literal is lowercase.
1728
1675
 
@@ -1750,7 +1697,7 @@ Returns a boolean for whether an individual part of the string is lowercase.
1750
1697
  */
1751
1698
  type IsLowercaseHelper<S extends string> = S extends Lowercase<string> ? true : S extends Uppercase<string> | Capitalize<string> | `${string}${Uppercase<string>}${string}` ? false : boolean;
1752
1699
  //#endregion
1753
- //#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/is-uppercase.d.ts
1700
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/is-uppercase.d.ts
1754
1701
  /**
1755
1702
  Returns a boolean for whether the given string literal is uppercase.
1756
1703
 
@@ -1778,7 +1725,7 @@ Returns a boolean for whether an individual part of the string is uppercase.
1778
1725
  */
1779
1726
  type IsUppercaseHelper<S extends string> = S extends Uppercase<string> ? true : S extends Lowercase<string> | Uncapitalize<string> | `${string}${Lowercase<string>}${string}` ? false : boolean;
1780
1727
  //#endregion
1781
- //#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/words.d.ts
1728
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/words.d.ts
1782
1729
  type SkipEmptyWord<Word extends string> = Word extends '' ? [] : [Word];
1783
1730
  type RemoveLastCharacter<Sentence extends string, Character extends string> = Sentence extends `${infer LeftSide}${Character}` ? SkipEmptyWord<LeftSide> : never;
1784
1731
  /**
@@ -1894,7 +1841,7 @@ WordsImplementation<RemainingCharacters, Options, FirstCharacter, `${CurrentWord
1894
1841
  // No case change: concat word
1895
1842
  WordsImplementation<RemainingCharacters, Options, FirstCharacter, `${CurrentWord}${FirstCharacter}`> : [...SkipEmptyWord<CurrentWord>];
1896
1843
  //#endregion
1897
- //#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/delimiter-case.d.ts
1844
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/delimiter-case.d.ts
1898
1845
  type _DefaultDelimiterCaseOptions = Merge<_DefaultWordsOptions, {
1899
1846
  splitOnNumbers: false;
1900
1847
  }>;
@@ -1945,7 +1892,7 @@ const rawCliOptions: OddlyCasedProperties<SomeOptions> = {
1945
1892
  type DelimiterCase<Value, Delimiter extends string, Options extends WordsOptions = {}> = Value extends string ? Delimiter extends string // For distributing `Delimiter`
1946
1893
  ? IsStringLiteral<Value> extends false ? Value : Lowercase<DelimiterCaseFromArray<Words<Value, ApplyDefaultOptions<WordsOptions, _DefaultDelimiterCaseOptions, Options>>, Delimiter>> : never : Value;
1947
1894
  //#endregion
1948
- //#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/kebab-case.d.ts
1895
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/kebab-case.d.ts
1949
1896
  /**
1950
1897
  Convert a string literal to kebab-case.
1951
1898
 
@@ -1985,6 +1932,23 @@ const rawCliOptions: KebabCasedProperties<CliOptions> = {
1985
1932
  */
1986
1933
  type KebabCase<Value, Options extends WordsOptions = {}> = DelimiterCase<Value, '-', ApplyDefaultOptions<WordsOptions, _DefaultDelimiterCaseOptions, Options>>;
1987
1934
  //#endregion
1935
+ //#region src/models/shared/ItemMetadataClass.d.ts
1936
+ export interface ItemMetadataClass<TBase extends Class<NonNullable<unknown>>> {
1937
+ new (...args: ConstructorParameters<TBase>): InstanceType<TBase> & ItemMetadata;
1938
+ prototype: InstanceType<TBase> & ItemMetadata;
1939
+ }
1940
+ //#endregion
1941
+ //#region src/models/shared/Serializable.d.ts
1942
+ export declare abstract class Serializable {
1943
+ toJSON(): this;
1944
+ }
1945
+ //#endregion
1946
+ //#region src/models/shared/TakeOne.d.ts
1947
+ export interface TakeOne {
1948
+ <T extends readonly unknown[]>(values: T, index?: number): T[number];
1949
+ <T extends object>(values: T, index: keyof T): T[keyof T];
1950
+ }
1951
+ //#endregion
1988
1952
  //#region src/util/types/DeepOmit.d.ts
1989
1953
  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
1954
  //#endregion
@@ -1994,12 +1958,6 @@ export type DeepOptionalUndefined<T> = T extends Date | Function | Primitive ? T
1994
1958
  //#region src/models/shared/ToData.d.ts
1995
1959
  export type ToData<T> = DeepOptionalUndefined<DeepOmit<T, "toJSON">>;
1996
1960
  //#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
1961
  //#region src/models/zod/UniqueArraySchemaKey.d.ts
2004
1962
  export type UniqueArraySchemaKey<TSchema extends z.ZodType> = TSchema extends z.ZodObject ? keyof TSchema["shape"] & string : keyof z.output<TSchema> & string;
2005
1963
  //#endregion
@@ -2012,26 +1970,20 @@ export declare const SITE_NAME = "Esposter";
2012
1970
  export declare const KIBIBYTE: number;
2013
1971
  export declare const GIBIBYTE: number;
2014
1972
  //#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
1973
  //#region src/services/error/getResult.d.ts
2019
- export declare const getResult: <T>(fn: () => T) => Result<T, Error>;
1974
+ export declare const getResult: <T>(callback: () => T) => Result<T, Error>;
2020
1975
  //#endregion
2021
1976
  //#region src/services/error/getResultAsync.d.ts
2022
- export declare const getResultAsync: <T>(fn: () => Promise<T>) => ResultAsync<T, Error>;
1977
+ export declare const getResultAsync: <T>(callback: () => Promise<T>) => ResultAsync<T, Error>;
2023
1978
  //#endregion
2024
1979
  //#region src/services/error/toAppError.d.ts
2025
1980
  export declare const toAppError: (error: unknown) => Error;
2026
1981
  //#endregion
2027
1982
  //#region src/services/error/withFinalizer.d.ts
2028
- export declare const withFinalizer: <T>(fn: () => T, finalizer?: () => void) => T;
1983
+ export declare const withFinalizer: <T>(callback: () => T, finalizer?: () => void) => T;
2029
1984
  //#endregion
2030
1985
  //#region src/services/error/withFinalizerAsync.d.ts
2031
- export declare const withFinalizerAsync: <T>(fn: () => Promisable<T>, finalizer?: () => Promisable<void>) => Promise<T>;
2032
- //#endregion
2033
- //#region src/services/message/classifyMentions.d.ts
2034
- export declare const classifyMentions: (message: string) => ClassifiedMentions;
1986
+ export declare const withFinalizerAsync: <T>(callback: () => Promisable<T>, finalizer?: () => Promisable<void>) => Promise<T>;
2035
1987
  //#endregion
2036
1988
  //#region src/services/message/constants.d.ts
2037
1989
  export declare const MENTION_ID_ATTRIBUTE = "data-id";
@@ -2044,7 +1996,6 @@ export declare const MENTION_HERE_ID = "@here";
2044
1996
  export declare const MENTION_EVERYONE_ID = "@everyone";
2045
1997
  export declare const CUSTOM_EMOJI_ID_ATTRIBUTE = "data-custom-emoji-id";
2046
1998
  export declare const CUSTOM_EMOJI_NAME_ATTRIBUTE = "data-custom-emoji-name";
2047
- export declare const CUSTOM_EMOJI_TYPE = "customEmoji";
2048
1999
  //#endregion
2049
2000
  //#region src/services/message/getMentions.d.ts
2050
2001
  export declare const getMentions: (message: string) => HTMLElement[];
@@ -2062,7 +2013,7 @@ export declare const sanitizeHtml: (...[html, options]: Parameters<typeof baseSa
2062
2013
  export declare const sanitizeTextHtml: (html: string) => string;
2063
2014
  //#endregion
2064
2015
  //#region src/services/shared/applyItemMetadataMixin.d.ts
2065
- export declare const applyItemMetadataMixin: <TBase extends Class<NonNullable<unknown>>>(Base: TBase) => WithMetadata<TBase>;
2016
+ export declare const applyItemMetadataMixin: <TBase extends Class<NonNullable<unknown>>>(Base: TBase) => ItemMetadataClass<TBase>;
2066
2017
  //#endregion
2067
2018
  //#region src/services/zod/createNormalizedStringSchema.d.ts
2068
2019
  export declare const createNormalizedStringSchema: (maxLength: number, schema?: z.ZodString) => z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
@@ -2070,6 +2021,14 @@ export declare const createNormalizedStringSchema: (maxLength: number, schema?:
2070
2021
  //#region src/services/zod/createUniqueArraySchema.d.ts
2071
2022
  export declare const createUniqueArraySchema: CreateUniqueArraySchema;
2072
2023
  //#endregion
2024
+ //#region src/services/zstd/constants.d.ts
2025
+ export declare const DEFAULT_COMPRESSION_LEVEL = 12;
2026
+ export declare const MIN_WINDOW_LOG = 10;
2027
+ export declare const MAX_WINDOW_LOG = 27;
2028
+ //#endregion
2029
+ //#region src/services/zstd/getWindowLog.d.ts
2030
+ export declare const getWindowLog: (dictionaryByteCount: number, inputByteCount: number) => number;
2031
+ //#endregion
2073
2032
  //#region src/util/array/chunk.d.ts
2074
2033
  export declare const chunk: <T>(array: T[], size: number) => T[][];
2075
2034
  //#endregion
@@ -2079,24 +2038,9 @@ export declare const chunkBySerializedSize: <T>(items: T[], maxBytes: number, ma
2079
2038
  //#region src/util/array/takeOne.d.ts
2080
2039
  export declare const takeOne: TakeOne;
2081
2040
  //#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
2041
  //#region src/util/date/getEndOfDay.d.ts
2092
2042
  export declare const getEndOfDay: (date: Date) => Date;
2093
2043
  //#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
2044
  //#region src/util/date/getZonedDateTime.d.ts
2101
2045
  export declare const getZonedDateTime: (date: Date) => Temporal.ZonedDateTime;
2102
2046
  //#endregion
@@ -2108,7 +2052,6 @@ export declare const noop: () => void;
2108
2052
  //#endregion
2109
2053
  //#region src/util/id/constants.d.ts
2110
2054
  export declare const ID_SEPARATOR = "|";
2111
- export declare const UUID_LENGTH = 36;
2112
2055
  //#endregion
2113
2056
  //#region src/util/map/getOrCreate.d.ts
2114
2057
  export declare const getOrCreate: <TKey, TValue>(map: Map<TKey, TValue>, key: TKey, create: () => TValue) => TValue;
@@ -2116,6 +2059,41 @@ export declare const getOrCreate: <TKey, TValue>(map: Map<TKey, TValue>, key: TK
2116
2059
  //#region src/util/object/checkIsPlainObject.d.ts
2117
2060
  export declare const checkIsPlainObject: (data: unknown) => data is object;
2118
2061
  //#endregion
2062
+ //#region src/util/types/GetArrayProps.d.ts
2063
+ 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) | {
2064
+ path: R extends true ? "length" : `${P}.length`;
2065
+ value: T["length"];
2066
+ };
2067
+ //#endregion
2068
+ //#region src/util/types/KnownKeys.d.ts
2069
+ export type KnownKeys<T> = { [K in keyof T as string extends K ? never : number extends K ? never : K]: T[K]; };
2070
+ //#endregion
2071
+ //#region src/util/types/GetObjectProps.d.ts
2072
+ 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) | {
2073
+ path: R extends true ? `${K}` : `${P}.${K}`;
2074
+ value: T[K];
2075
+ }; }[keyof KnownKeys<T> & (number | string)];
2076
+ //#endregion
2077
+ //#region src/util/types/GetPrimitiveProps.d.ts
2078
+ export type GetPrimitiveProps<T, P extends string, D extends unknown[], R extends boolean> = T extends string ? {
2079
+ path: R extends true ? "length" : `${P}.length`;
2080
+ value: number;
2081
+ } : T extends symbol ? (D extends [unknown, ...infer Rest] ? GetProperties<string | undefined, R extends true ? "description" : `${P}.description`, Rest, false> : never) | {
2082
+ path: R extends true ? "description" : `${P}.description`;
2083
+ value: string | undefined;
2084
+ } : never;
2085
+ //#endregion
2086
+ //#region src/util/types/GetProperties.d.ts
2087
+ 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;
2088
+ //#endregion
2089
+ //#region src/util/types/GetPaths.d.ts
2090
+ export type GetPaths<T> = GetProperties<T> extends (infer U) ? (U extends {
2091
+ path: infer Path;
2092
+ } ? Path : never) : never;
2093
+ //#endregion
2094
+ //#region src/util/types/PropertyNames.d.ts
2095
+ export type PropertyNames<T> = { [P in GetPaths<T>]: P; };
2096
+ //#endregion
2119
2097
  //#region src/util/object/getPropertyNames.d.ts
2120
2098
  export declare const getPropertyNames: <T>() => PropertyNames<T>;
2121
2099
  //#endregion
@@ -2179,9 +2157,6 @@ export type FunctionProperties<T> = { [K in keyof T]: T[K] extends Function ? K
2179
2157
  //#region src/util/types/ExcludeFunctionProperties.d.ts
2180
2158
  export type ExcludeFunctionProperties<T> = Except<T, FunctionProperties<T>[keyof T]>;
2181
2159
  //#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
2160
  //#region src/util/types/TupleSplit.d.ts
2186
2161
  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
2162
  //#endregion
@@ -2197,9 +2172,6 @@ export type TupleSlice<T extends unknown[], S extends number, E extends number =
2197
2172
  //#region src/util/validation/exhaustiveGuard.d.ts
2198
2173
  export declare const exhaustiveGuard: (value: never) => never;
2199
2174
  //#endregion
2200
- //#region src/util/id/uuid/checkIsUuidV4.d.ts
2201
- export declare const checkIsUuidV4: (uuid: string) => boolean;
2202
- //#endregion
2203
2175
  //#region src/util/id/uuid/constants.d.ts
2204
2176
  export declare const UUIDV4_REGEX: RegExp;
2205
2177
  //#endregion
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import baseSanitizeHtml from "sanitize-html";
6
6
  const noop = () => {};
7
7
  //#endregion
8
8
  //#region src/test/constants.ts
9
- const AllSpecialValues = [
9
+ const ALL_SPECIAL_VALUES = [
10
10
  {
11
11
  isPlainObject: true,
12
12
  value: {}
@@ -110,6 +110,7 @@ const GIBIBYTE = KIBIBYTE ** 2 * KIBIBYTE;
110
110
  const RoutePath = {
111
111
  About: "/about",
112
112
  Achievements: "/achievements",
113
+ AgentConsole: "/agent-console",
113
114
  Anime: "/anime",
114
115
  Calls: (id) => `/calls/${id}`,
115
116
  CallsIndex: "/calls",
@@ -146,11 +147,7 @@ const RoutePath = {
146
147
  View: (type, id) => `/view/${type}/${id}`
147
148
  };
148
149
  //#endregion
149
- //#region src/util/object/getPropertyNames.ts
150
- const getPropertyNames = () => new Proxy({}, { get: (_target, property) => property });
151
- //#endregion
152
150
  //#region src/models/shared/ItemEntityType.ts
153
- const ItemEntityTypePropertyNames = getPropertyNames();
154
151
  const createItemEntityTypeSchema = (schema) => z.object({ type: schema });
155
152
  //#endregion
156
153
  //#region src/models/shared/ItemMetadata.ts
@@ -159,12 +156,6 @@ var ItemMetadata = class {
159
156
  deletedAt = null;
160
157
  updatedAt = /* @__PURE__ */ new Date();
161
158
  };
162
- const ItemMetadataPropertyNames = getPropertyNames();
163
- const itemMetadataSchema = z.object({
164
- createdAt: z.date(),
165
- deletedAt: z.date().nullable(),
166
- updatedAt: z.date()
167
- });
168
159
  //#endregion
169
160
  //#region src/models/shared/Operation.ts
170
161
  let Operation = /* @__PURE__ */ function(Operation) {
@@ -207,54 +198,38 @@ const toAppError = (error) => {
207
198
  else return new Error(String(error), { cause: error });
208
199
  };
209
200
  //#endregion
210
- //#region src/services/error/getResultAsync.ts
211
- const getResultAsync = (fn) => ResultAsync.fromThrowable(fn, toAppError)();
201
+ //#region src/services/error/getResult.ts
202
+ const getResult = (callback) => fromThrowable(callback, toAppError)();
212
203
  //#endregion
213
- //#region src/util/time/sleep.ts
214
- const sleep = (durationMs) => new Promise((resolve) => {
215
- setTimeout(resolve, durationMs);
216
- });
204
+ //#region src/services/error/getResultAsync.ts
205
+ const getResultAsync = (callback) => ResultAsync.fromThrowable(callback, toAppError)();
217
206
  //#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;
207
+ //#region src/services/error/withFinalizer.ts
208
+ const withFinalizer = (callback, finalizer) => {
209
+ const callbackResult = getResult(callback);
210
+ if (finalizer) getResult(finalizer).match(noop, (error) => {
211
+ callbackResult.match(() => {
228
212
  throw error;
213
+ }, () => {
214
+ console.error(error);
229
215
  });
230
- };
231
- };
232
- //#endregion
233
- //#region src/services/error/getResult.ts
234
- const getResult = (fn) => fromThrowable(fn, toAppError)();
235
- //#endregion
236
- //#region src/services/error/withFinalizer.ts
237
- const withFinalizer = (fn, finalizer) => {
238
- const result = getResult(fn);
239
- (finalizer ? getResult(finalizer) : void 0)?.match(noop, (error) => {
240
- throw error;
241
216
  });
242
- return result.match((value) => value, (error) => {
217
+ return callbackResult.match((value) => value, (error) => {
243
218
  throw error;
244
219
  });
245
220
  };
246
221
  //#endregion
247
222
  //#region src/services/error/withFinalizerAsync.ts
248
- const withFinalizerAsync = async (fn, finalizer) => {
249
- const result = await getResultAsync(async () => fn());
223
+ const withFinalizerAsync = async (callback, finalizer) => {
224
+ const callbackResult = await getResultAsync(async () => callback());
250
225
  if (finalizer) await getResultAsync(async () => finalizer()).match(noop, (error) => {
251
- result.match(() => {
226
+ callbackResult.match(() => {
252
227
  throw error;
253
228
  }, () => {
254
229
  console.error(error);
255
230
  });
256
231
  });
257
- return result.match((value) => value, (error) => {
232
+ return callbackResult.match((value) => value, (error) => {
258
233
  throw error;
259
234
  });
260
235
  };
@@ -270,25 +245,10 @@ const MENTION_HERE_ID = "@here";
270
245
  const MENTION_EVERYONE_ID = "@everyone";
271
246
  const CUSTOM_EMOJI_ID_ATTRIBUTE = "data-custom-emoji-id";
272
247
  const CUSTOM_EMOJI_NAME_ATTRIBUTE = "data-custom-emoji-name";
273
- const CUSTOM_EMOJI_TYPE = "customEmoji";
274
248
  //#endregion
275
249
  //#region src/services/message/getMentions.ts
276
250
  const getMentions = (message) => parse(message).querySelectorAll(MENTION_SELECTOR);
277
251
  //#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
252
  //#region src/services/prettier/css.ts
293
253
  const css = String.raw;
294
254
  //#endregion
@@ -378,6 +338,14 @@ const createNormalizedStringSchema = (maxLength, schema = z.string()) => schema.
378
338
  //#region src/services/zod/createUniqueArraySchema.ts
379
339
  const createUniqueArraySchema = (schema, key) => schema.array().refine((array) => new Set(key === void 0 ? array : array.map((item) => item[key])).size === array.length, "Array items must be unique");
380
340
  //#endregion
341
+ //#region src/services/zstd/constants.ts
342
+ const DEFAULT_COMPRESSION_LEVEL = 12;
343
+ const MIN_WINDOW_LOG = 10;
344
+ const MAX_WINDOW_LOG = 27;
345
+ //#endregion
346
+ //#region src/services/zstd/getWindowLog.ts
347
+ const getWindowLog = (dictionaryByteCount, inputByteCount) => Math.min(27, Math.max(10, Math.ceil(Math.log2(dictionaryByteCount + inputByteCount + 1))));
348
+ //#endregion
381
349
  //#region src/util/array/chunk.ts
382
350
  const chunk = (array, size) => {
383
351
  const chunks = [];
@@ -414,30 +382,14 @@ const takeOne = (values, index = 0) => {
414
382
  //#region src/util/date/getZonedDateTime.ts
415
383
  const getZonedDateTime = (date) => Temporal.Instant.fromEpochMilliseconds(date.getTime()).toZonedDateTimeISO(Temporal.Now.timeZoneId());
416
384
  //#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
385
  //#region src/util/date/getEndOfDay.ts
430
386
  const getEndOfDay = (date) => /* @__PURE__ */ new Date(getZonedDateTime(date).startOfDay().add({ days: 1 }).epochMilliseconds - 1);
431
387
  //#endregion
432
- //#region src/util/date/getStartOfDay.ts
433
- const getStartOfDay = (date) => new Date(getZonedDateTime(date).startOfDay().epochMilliseconds);
434
- //#endregion
435
388
  //#region src/util/environment/checkIsServer.ts
436
389
  const checkIsServer = () => typeof window === "undefined";
437
390
  //#endregion
438
391
  //#region src/util/id/constants.ts
439
392
  const ID_SEPARATOR = "|";
440
- const UUID_LENGTH = 36;
441
393
  //#endregion
442
394
  //#region src/util/map/getOrCreate.ts
443
395
  const getOrCreate = (map, key, create) => {
@@ -454,6 +406,9 @@ const checkIsPlainObject = (data) => {
454
406
  return prototype === null || prototype === Object.prototype;
455
407
  };
456
408
  //#endregion
409
+ //#region src/util/object/getPropertyNames.ts
410
+ const getPropertyNames = () => new Proxy({}, { get: (_target, property) => property });
411
+ //#endregion
457
412
  //#region src/util/object/jsonDateParse.ts
458
413
  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
414
  const MS_AJAX_DATE_REGEX = /^\/Date\((?<timestamp>-?\d+(?:[-+]\d+)?)\)[/\\]$/u;
@@ -547,6 +502,11 @@ const now = () => {
547
502
  return (BigInt(loadMilliseconds) * 10n ** 6n + (BigInt(seconds) * 10n ** 9n + BigInt(nanoseconds))).toString();
548
503
  };
549
504
  //#endregion
505
+ //#region src/util/time/sleep.ts
506
+ const sleep = (durationMs) => new Promise((resolve) => {
507
+ setTimeout(resolve, durationMs);
508
+ });
509
+ //#endregion
550
510
  //#region src/util/validation/exhaustiveGuard.ts
551
511
  const exhaustiveGuard = (value) => {
552
512
  throw new InvalidOperationError("Read", exhaustiveGuard.name, JSON.stringify(value));
@@ -555,7 +515,4 @@ const exhaustiveGuard = (value) => {
555
515
  //#region src/util/id/uuid/constants.ts
556
516
  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
517
  //#endregion
558
- //#region src/util/id/uuid/checkIsUuidV4.ts
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 };
518
+ export { ALL_SPECIAL_VALUES, CUSTOM_EMOJI_ID_ATTRIBUTE, CUSTOM_EMOJI_NAME_ATTRIBUTE, DEFAULT_COMPRESSION_LEVEL, ForbiddenError, GIBIBYTE, ID_SEPARATOR, InvalidOperationError, ItemMetadata, KIBIBYTE, MAX_READ_LIMIT, MAX_WINDOW_LOG, MENTION_EVERYONE_ID, MENTION_HERE_ID, MENTION_ID_ATTRIBUTE, MENTION_ITEM_TYPE_ATTRIBUTE, MENTION_LABEL_ATTRIBUTE, MENTION_SELECTOR, MENTION_TYPE, MENTION_TYPE_ATTRIBUTE, MIN_WINDOW_LOG, 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, getWindowLog, 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.0.0",
3
+ "version": "3.3.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.0.0",
60
- "@types/node": "^26.5.1",
59
+ "@esposter/configuration": "3.3.0",
60
+ "@types/node": "^26.6.3",
61
61
  "@types/sanitize-html": "^2.16.1",
62
62
  "publint": "^0.3.24",
63
63
  "tsdown": "^0.23.0",
64
- "type-fest": "^5.9.0",
65
- "vitest": "^5.0.0",
66
- "vue": "^3.5.42"
64
+ "type-fest": "^5.10.0",
65
+ "vitest": "^5.0.2",
66
+ "vue": "^3.5.43"
67
67
  },
68
68
  "peerDependencies": {
69
- "zod": "^4.6.2"
69
+ "zod": "^4.6.5"
70
70
  },
71
71
  "inlinedDependencies": {
72
- "type-fest": "5.9.0"
72
+ "type-fest": "5.10.0"
73
73
  },
74
- "gitHead": "5ea72289bdd594e598aab8fefd5686df2a642a7e"
74
+ "gitHead": "5854a00717502d8de96adc8b44d3621ab85f9b57"
75
75
  }