@esposter/shared 2.20.0 → 2.22.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/LICENSE +201 -201
- package/dist/index.d.ts +74 -43
- package/dist/index.js +57 -14
- package/dist/magic-string.es-CDi1Mjxn.js +1011 -0
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,11 @@ declare const AllSpecialValues: {
|
|
|
6
6
|
value: unknown;
|
|
7
7
|
}[];
|
|
8
8
|
//#endregion
|
|
9
|
+
//#region src/models/error/ForbiddenError.d.ts
|
|
10
|
+
declare class ForbiddenError extends Error {
|
|
11
|
+
constructor(message: string);
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
9
14
|
//#region src/models/shared/Operation.d.ts
|
|
10
15
|
declare enum Operation {
|
|
11
16
|
Create = "Create",
|
|
@@ -49,6 +54,7 @@ declare const RoutePath: {
|
|
|
49
54
|
readonly Index: "/";
|
|
50
55
|
readonly Login: "/login";
|
|
51
56
|
readonly Messages: (id: string) => string;
|
|
57
|
+
readonly MessagesFriends: "/messages/friends";
|
|
52
58
|
readonly MessagesIndex: "/messages";
|
|
53
59
|
readonly MessagesInvite: (code: string) => string;
|
|
54
60
|
readonly MessagesMessage: (id: string, rowKey: string) => string;
|
|
@@ -121,10 +127,10 @@ declare abstract class Serializable {
|
|
|
121
127
|
//#region src/models/shared/TakeOne.d.ts
|
|
122
128
|
interface TakeOne {
|
|
123
129
|
<T extends readonly unknown[]>(values: T, index?: number): T[number];
|
|
124
|
-
<T extends Record<PropertyKey, unknown>>(values: T, index: keyof T): T[keyof T];
|
|
130
|
+
<T extends object | Record<PropertyKey, unknown>>(values: T, index: keyof T): T[keyof T];
|
|
125
131
|
}
|
|
126
132
|
//#endregion
|
|
127
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
133
|
+
//#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/primitive.d.ts
|
|
128
134
|
/**
|
|
129
135
|
Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
|
|
130
136
|
|
|
@@ -132,7 +138,7 @@ Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/
|
|
|
132
138
|
*/
|
|
133
139
|
type Primitive = null | undefined | string | number | boolean | symbol | bigint;
|
|
134
140
|
//#endregion
|
|
135
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
141
|
+
//#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/basic.d.ts
|
|
136
142
|
/**
|
|
137
143
|
Matches a [`class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes).
|
|
138
144
|
|
|
@@ -143,7 +149,7 @@ type Class<T, Arguments extends unknown[] = any[]> = {
|
|
|
143
149
|
new (...arguments_: Arguments): T;
|
|
144
150
|
};
|
|
145
151
|
//#endregion
|
|
146
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
152
|
+
//#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/is-any.d.ts
|
|
147
153
|
/**
|
|
148
154
|
Returns a boolean for whether the given type is `any`.
|
|
149
155
|
|
|
@@ -174,7 +180,7 @@ const anyA = get(anyObject, 'a');
|
|
|
174
180
|
*/
|
|
175
181
|
type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;
|
|
176
182
|
//#endregion
|
|
177
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
183
|
+
//#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/is-optional-key-of.d.ts
|
|
178
184
|
/**
|
|
179
185
|
Returns a boolean for whether the given key is an optional key of type.
|
|
180
186
|
|
|
@@ -217,7 +223,7 @@ type T5 = IsOptionalKeyOf<User | Admin, 'surname'>;
|
|
|
217
223
|
*/
|
|
218
224
|
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;
|
|
219
225
|
//#endregion
|
|
220
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
226
|
+
//#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/optional-keys-of.d.ts
|
|
221
227
|
/**
|
|
222
228
|
Extract all optional keys from the given type.
|
|
223
229
|
|
|
@@ -255,7 +261,7 @@ type OptionalKeysOf<Type extends object> = Type extends unknown // For distribut
|
|
|
255
261
|
? (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`
|
|
256
262
|
: never;
|
|
257
263
|
//#endregion
|
|
258
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
264
|
+
//#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/required-keys-of.d.ts
|
|
259
265
|
/**
|
|
260
266
|
Extract all required keys from the given type.
|
|
261
267
|
|
|
@@ -289,7 +295,7 @@ const validator3 = createValidation<User>('luckyNumber', value => value > 0);
|
|
|
289
295
|
type RequiredKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
|
|
290
296
|
? Exclude<keyof Type, OptionalKeysOf<Type>> : never;
|
|
291
297
|
//#endregion
|
|
292
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
298
|
+
//#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/is-never.d.ts
|
|
293
299
|
/**
|
|
294
300
|
Returns a boolean for whether the given type is `never`.
|
|
295
301
|
|
|
@@ -345,7 +351,7 @@ type B = IsTrueFixed<never>;
|
|
|
345
351
|
*/
|
|
346
352
|
type IsNever<T> = [T] extends [never] ? true : false;
|
|
347
353
|
//#endregion
|
|
348
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
354
|
+
//#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/if.d.ts
|
|
349
355
|
/**
|
|
350
356
|
An if-else-like type that resolves depending on whether the given `boolean` type is `true` or `false`.
|
|
351
357
|
|
|
@@ -440,7 +446,7 @@ type Works = IncludesWithoutIf<HundredZeroes, '1'>;
|
|
|
440
446
|
*/
|
|
441
447
|
type If<Type extends boolean, IfBranch, ElseBranch> = IsNever<Type> extends true ? ElseBranch : Type extends true ? IfBranch : ElseBranch;
|
|
442
448
|
//#endregion
|
|
443
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
449
|
+
//#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/unknown-array.d.ts
|
|
444
450
|
/**
|
|
445
451
|
Represents an array with `unknown` value.
|
|
446
452
|
|
|
@@ -467,7 +473,7 @@ type C = IsArray<string>;
|
|
|
467
473
|
*/
|
|
468
474
|
type UnknownArray = readonly unknown[];
|
|
469
475
|
//#endregion
|
|
470
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
476
|
+
//#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/internal/type.d.ts
|
|
471
477
|
/**
|
|
472
478
|
Returns a boolean for whether A is false.
|
|
473
479
|
|
|
@@ -531,7 +537,7 @@ Indicates the value of `exactOptionalPropertyTypes` compiler option.
|
|
|
531
537
|
*/
|
|
532
538
|
type IsExactOptionalPropertyTypesEnabled = [(string | undefined)?] extends [string?] ? false : true;
|
|
533
539
|
//#endregion
|
|
534
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
540
|
+
//#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/internal/array.d.ts
|
|
535
541
|
/**
|
|
536
542
|
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.
|
|
537
543
|
|
|
@@ -573,7 +579,7 @@ type _CollapseRestElement<TArray extends UnknownArray, ForwardAccumulator extend
|
|
|
573
579
|
: First], BackwardAccumulator> : never // Should never happen, since `[(infer First)?, ...infer Rest]` is a top-type for arrays.
|
|
574
580
|
: never; // Should never happen
|
|
575
581
|
//#endregion
|
|
576
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
582
|
+
//#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/internal/characters.d.ts
|
|
577
583
|
type Whitespace = '\u{9}' // '\t'
|
|
578
584
|
| '\u{A}' // '\n'
|
|
579
585
|
| '\u{B}' // '\v'
|
|
@@ -587,19 +593,17 @@ type AsciiPunctuation = '!' | '"' | '#' | '$' | '%' | '&' | '\'' | '(' | ')' | '
|
|
|
587
593
|
//#region ../../node_modules/.pnpm/tagged-tag@1.0.0/node_modules/tagged-tag/index.d.ts
|
|
588
594
|
declare const tag: unique symbol;
|
|
589
595
|
//#endregion
|
|
590
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
596
|
+
//#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/tagged.d.ts
|
|
591
597
|
// eslint-disable-next-line type-fest/require-exported-types
|
|
592
598
|
type TagContainer<Token> = {
|
|
593
599
|
readonly [tag]: Token;
|
|
594
600
|
};
|
|
595
601
|
type Tag<Token extends PropertyKey, TagMetadata> = TagContainer<{ [K in Token]: TagMetadata }>;
|
|
596
602
|
/**
|
|
597
|
-
|
|
603
|
+
Create a [tagged type](https://medium.com/@KevinBGreene/surviving-the-typescript-ecosystem-branding-and-type-tagging-6cf6e516523d) that can support [multiple tags](https://github.com/sindresorhus/type-fest/issues/665) and [per-tag metadata](https://medium.com/@ethanresnick/advanced-typescript-tagged-types-improved-with-type-level-metadata-5072fc125fcf).
|
|
598
604
|
|
|
599
605
|
A type returned by `Tagged` can be passed to `Tagged` again, to create a type with multiple tags.
|
|
600
606
|
|
|
601
|
-
[Read more about tagged types.](https://medium.com/@KevinBGreene/surviving-the-typescript-ecosystem-branding-and-type-tagging-6cf6e516523d)
|
|
602
|
-
|
|
603
607
|
A tag's name is usually a string (and must be a string, number, or symbol), but each application of a tag can also contain an arbitrary type as its "metadata". See {@link GetTagMetadata} for examples and explanation.
|
|
604
608
|
|
|
605
609
|
A type `A` returned by `Tagged` is assignable to another type `B` returned by `Tagged` if and only if:
|
|
@@ -656,7 +660,7 @@ type SpecialCacheKey2 = Tagged<string, 'URL' | 'SpecialCacheKey'>;
|
|
|
656
660
|
*/
|
|
657
661
|
type Tagged<Type, TagName extends PropertyKey, TagMetadata = never> = Type & Tag<TagName, TagMetadata>;
|
|
658
662
|
/**
|
|
659
|
-
|
|
663
|
+
Get the untagged portion of a tagged type created with `Tagged`.
|
|
660
664
|
|
|
661
665
|
Why is this necessary?
|
|
662
666
|
|
|
@@ -761,7 +765,7 @@ type Person = {
|
|
|
761
765
|
@deprecated Use {@link Tagged} instead
|
|
762
766
|
*/
|
|
763
767
|
//#endregion
|
|
764
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
768
|
+
//#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/is-literal.d.ts
|
|
765
769
|
/**
|
|
766
770
|
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).
|
|
767
771
|
|
|
@@ -823,7 +827,7 @@ type _IsStringLiteral<S> = // If `T` is an infinite string type (e.g., `on${stri
|
|
|
823
827
|
// and since `{}` extends index signatures, the result becomes `false`.
|
|
824
828
|
S extends string ? {} extends Record<S, never> ? false : true : false;
|
|
825
829
|
//#endregion
|
|
826
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
830
|
+
//#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/trim.d.ts
|
|
827
831
|
/**
|
|
828
832
|
Remove spaces from the left side.
|
|
829
833
|
*/
|
|
@@ -848,7 +852,7 @@ type Example = Trim<' foo '>;
|
|
|
848
852
|
*/
|
|
849
853
|
type Trim<V extends string> = TrimLeft<TrimRight<V>>;
|
|
850
854
|
//#endregion
|
|
851
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
855
|
+
//#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/internal/string.d.ts
|
|
852
856
|
/**
|
|
853
857
|
Returns a boolean for whether the given string `S` starts with the given string `SearchString`.
|
|
854
858
|
|
|
@@ -878,7 +882,7 @@ This type is a workaround for [Microsoft/TypeScript#46109](https://github.com/mi
|
|
|
878
882
|
*/
|
|
879
883
|
type IsNumeric<T extends string> = T extends `${number}` ? Trim<T> extends T ? true : false : false;
|
|
880
884
|
//#endregion
|
|
881
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
885
|
+
//#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/simplify.d.ts
|
|
882
886
|
/**
|
|
883
887
|
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.
|
|
884
888
|
|
|
@@ -939,7 +943,7 @@ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface`
|
|
|
939
943
|
*/
|
|
940
944
|
type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};
|
|
941
945
|
//#endregion
|
|
942
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
946
|
+
//#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/is-equal.d.ts
|
|
943
947
|
/**
|
|
944
948
|
Returns a boolean for whether the two given types are equal.
|
|
945
949
|
|
|
@@ -970,7 +974,7 @@ type IsEqual<A, B> = [A] extends [B] ? [B] extends [A] ? _IsEqual<A, B> : false
|
|
|
970
974
|
// This version fails the `equalWrappedTupleIntersectionToBeNeverAndNeverExpanded` test in `test-d/is-equal.ts`.
|
|
971
975
|
type _IsEqual<A, B> = (<G>() => G extends A & G | G ? 1 : 2) extends (<G>() => G extends B & G | G ? 1 : 2) ? true : false;
|
|
972
976
|
//#endregion
|
|
973
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
977
|
+
//#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/omit-index-signature.d.ts
|
|
974
978
|
/**
|
|
975
979
|
Omit any index signatures from the given object type, leaving only explicitly defined properties.
|
|
976
980
|
|
|
@@ -1064,7 +1068,7 @@ type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
|
|
|
1064
1068
|
*/
|
|
1065
1069
|
type OmitIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType] };
|
|
1066
1070
|
//#endregion
|
|
1067
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
1071
|
+
//#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/pick-index-signature.d.ts
|
|
1068
1072
|
/**
|
|
1069
1073
|
Pick only index signatures from the given object type, leaving out all explicitly defined properties.
|
|
1070
1074
|
|
|
@@ -1112,7 +1116,7 @@ type ExampleIndexSignature = PickIndexSignature<Example>;
|
|
|
1112
1116
|
*/
|
|
1113
1117
|
type PickIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? KeyType : never]: ObjectType[KeyType] };
|
|
1114
1118
|
//#endregion
|
|
1115
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
1119
|
+
//#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/merge.d.ts
|
|
1116
1120
|
// Merges two objects without worrying about index signatures.
|
|
1117
1121
|
type SimpleMerge<Destination, Source> = Simplify<{ [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key] } & Source>;
|
|
1118
1122
|
/**
|
|
@@ -1184,7 +1188,7 @@ type Merge<Destination, Source> = Destination extends unknown // For distributin
|
|
|
1184
1188
|
// Should never happen
|
|
1185
1189
|
type _Merge<Destination, Source> = Simplify<SimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>> & SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>>;
|
|
1186
1190
|
//#endregion
|
|
1187
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
1191
|
+
//#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/internal/object.d.ts
|
|
1188
1192
|
/**
|
|
1189
1193
|
Merges user specified options with default options.
|
|
1190
1194
|
|
|
@@ -1268,7 +1272,7 @@ type E = CollapseLiterals<LiteralUnion<'foo' | 'bar', string> | null | undefined
|
|
|
1268
1272
|
*/
|
|
1269
1273
|
type CollapseLiterals<T> = {} extends T ? T : T extends infer U & {} ? U : T;
|
|
1270
1274
|
//#endregion
|
|
1271
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
1275
|
+
//#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/some-extend.d.ts
|
|
1272
1276
|
/**
|
|
1273
1277
|
@see {@link SomeExtend}
|
|
1274
1278
|
*/
|
|
@@ -1350,7 +1354,7 @@ type SomeExtend<TArray extends UnknownArray, Type, Options extends SomeExtendOpt
|
|
|
1350
1354
|
type _SomeExtend<TArray extends UnknownArray, Type, Options extends Required<SomeExtendOptions>> = IfNotAnyOrNever<TArray, TArray extends readonly [infer First, ...infer Rest] ? IsNever<First> extends true ? Or<Or<IsNever<Type>, IsAny<Type>>, Not<Options['strictNever']>> extends true // If target `Type` is also `never`, or is `any`, or `strictNever` is disabled, return `true`.
|
|
1351
1355
|
? true : _SomeExtend<Rest, Type, Options> : First extends Type ? true : _SomeExtend<Rest, Type, Options> : false, false, false>;
|
|
1352
1356
|
//#endregion
|
|
1353
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
1357
|
+
//#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/or-all.d.ts
|
|
1354
1358
|
/**
|
|
1355
1359
|
Returns a boolean for whether any of the given elements is `true`.
|
|
1356
1360
|
|
|
@@ -1421,9 +1425,9 @@ Note: `OrAll<[]>` evaluates to `false` because there are no `true` elements in a
|
|
|
1421
1425
|
*/
|
|
1422
1426
|
type OrAll<T extends readonly boolean[]> = SomeExtend<T, true>;
|
|
1423
1427
|
//#endregion
|
|
1424
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
1428
|
+
//#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/or.d.ts
|
|
1425
1429
|
/**
|
|
1426
|
-
Returns a boolean for whether either of two given types is true
|
|
1430
|
+
Returns a boolean for whether either of two given types is `true`.
|
|
1427
1431
|
|
|
1428
1432
|
Use-case: Constructing complex conditional types where at least one condition must be satisfied.
|
|
1429
1433
|
|
|
@@ -1501,7 +1505,7 @@ type G = Or<never, never>;
|
|
|
1501
1505
|
*/
|
|
1502
1506
|
type Or<A extends boolean, B extends boolean> = OrAll<[A, B]>;
|
|
1503
1507
|
//#endregion
|
|
1504
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
1508
|
+
//#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/all-extend.d.ts
|
|
1505
1509
|
/**
|
|
1506
1510
|
@see {@link AllExtend}
|
|
1507
1511
|
*/
|
|
@@ -1587,7 +1591,7 @@ type AllExtend<TArray extends UnknownArray, Type, Options extends AllExtendOptio
|
|
|
1587
1591
|
type _AllExtend<TArray extends UnknownArray, Type, Options extends Required<AllExtendOptions>> = IfNotAnyOrNever<TArray, TArray extends readonly [infer First, ...infer Rest] ? IsNever<First> extends true ? Or<Or<IsNever<Type>, IsAny<Type>>, Not<Options['strictNever']>> extends true // If target `Type` is also `never`, or is `any`, or `strictNever` is disabled, recurse further.
|
|
1588
1592
|
? _AllExtend<Rest, Type, Options> : false : First extends Type ? _AllExtend<Rest, Type, Options> : false : true, false, false>;
|
|
1589
1593
|
//#endregion
|
|
1590
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
1594
|
+
//#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/except.d.ts
|
|
1591
1595
|
/**
|
|
1592
1596
|
Filter out keys from an object.
|
|
1593
1597
|
|
|
@@ -1685,7 +1689,7 @@ type PostPayloadFixed = Except<UserData, 'email'>;
|
|
|
1685
1689
|
type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {}> = _Except<ObjectType, KeysType, ApplyDefaultOptions<ExceptOptions, DefaultExceptOptions, Options>>;
|
|
1686
1690
|
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>> : {});
|
|
1687
1691
|
//#endregion
|
|
1688
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
1692
|
+
//#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/is-lowercase.d.ts
|
|
1689
1693
|
/**
|
|
1690
1694
|
Returns a boolean for whether the given string literal is lowercase.
|
|
1691
1695
|
|
|
@@ -1713,7 +1717,7 @@ Returns a boolean for whether an individual part of the string is lowercase.
|
|
|
1713
1717
|
*/
|
|
1714
1718
|
type IsLowercaseHelper<S extends string> = S extends Lowercase<string> ? true : S extends Uppercase<string> | Capitalize<string> | `${string}${Uppercase<string>}${string}` ? false : boolean;
|
|
1715
1719
|
//#endregion
|
|
1716
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
1720
|
+
//#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/is-uppercase.d.ts
|
|
1717
1721
|
/**
|
|
1718
1722
|
Returns a boolean for whether the given string literal is uppercase.
|
|
1719
1723
|
|
|
@@ -1741,7 +1745,7 @@ Returns a boolean for whether an individual part of the string is uppercase.
|
|
|
1741
1745
|
*/
|
|
1742
1746
|
type IsUppercaseHelper<S extends string> = S extends Uppercase<string> ? true : S extends Lowercase<string> | Uncapitalize<string> | `${string}${Lowercase<string>}${string}` ? false : boolean;
|
|
1743
1747
|
//#endregion
|
|
1744
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
1748
|
+
//#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/words.d.ts
|
|
1745
1749
|
type SkipEmptyWord<Word extends string> = Word extends '' ? [] : [Word];
|
|
1746
1750
|
type RemoveLastCharacter<Sentence extends string, Character extends string> = Sentence extends `${infer LeftSide}${Character}` ? SkipEmptyWord<LeftSide> : never;
|
|
1747
1751
|
/**
|
|
@@ -1763,15 +1767,29 @@ type WordsOptions = {
|
|
|
1763
1767
|
```
|
|
1764
1768
|
*/
|
|
1765
1769
|
splitOnNumbers?: boolean;
|
|
1770
|
+
/**
|
|
1771
|
+
Split on {@link AsciiPunctuation | punctuation characters} (e.g., `#`, `&`, `*`, `:`, `?`, `@`, `~`).
|
|
1772
|
+
@example
|
|
1773
|
+
```
|
|
1774
|
+
import type {Words} from 'type-fest';
|
|
1775
|
+
type Example1 = Words<'hello:world', {splitOnPunctuation: true}>;
|
|
1776
|
+
//=> ['hello', 'world']
|
|
1777
|
+
type Example2 = Words<'hello:world', {splitOnPunctuation: false}>;
|
|
1778
|
+
//=> ['hello', ':world']
|
|
1779
|
+
```
|
|
1780
|
+
*/
|
|
1781
|
+
splitOnPunctuation?: boolean;
|
|
1766
1782
|
};
|
|
1767
1783
|
type _DefaultWordsOptions = {
|
|
1768
1784
|
splitOnNumbers: true;
|
|
1785
|
+
splitOnPunctuation: false;
|
|
1769
1786
|
};
|
|
1770
1787
|
/**
|
|
1771
|
-
Split a string
|
|
1788
|
+
Split a string similar to Lodash's `_.words()` function.
|
|
1772
1789
|
|
|
1773
1790
|
- Split on each word that begins with a capital letter.
|
|
1774
1791
|
- Split on each {@link WordSeparators}.
|
|
1792
|
+
- Split on each {@link AsciiPunctuation} (if {@link WordsOptions.splitOnPunctuation} is enabled).
|
|
1775
1793
|
- Split on numeric sequence.
|
|
1776
1794
|
|
|
1777
1795
|
@example
|
|
@@ -1795,13 +1813,22 @@ type Words4 = Words<'lifeIs42'>;
|
|
|
1795
1813
|
|
|
1796
1814
|
type Words5 = Words<'p2pNetwork', {splitOnNumbers: false}>;
|
|
1797
1815
|
//=> ['p2p', 'Network']
|
|
1816
|
+
|
|
1817
|
+
type Words6 = Words<'hello:world', {splitOnPunctuation: true}>;
|
|
1818
|
+
//=> ['hello', 'world']
|
|
1819
|
+
|
|
1820
|
+
type Words7 = Words<'hello:world', {splitOnPunctuation: false}>;
|
|
1821
|
+
//=> ['hello', ':world']
|
|
1822
|
+
|
|
1823
|
+
type Words8 = Words<'hello::world', {splitOnPunctuation: true}>;
|
|
1824
|
+
//=> ['hello', 'world']
|
|
1798
1825
|
```
|
|
1799
1826
|
|
|
1800
1827
|
@category Change case
|
|
1801
1828
|
@category Template literal
|
|
1802
1829
|
*/
|
|
1803
1830
|
type Words<Sentence extends string, Options extends WordsOptions = {}> = WordsImplementation<Sentence, ApplyDefaultOptions<WordsOptions, _DefaultWordsOptions, Options>>;
|
|
1804
|
-
type WordsImplementation<Sentence extends string, Options extends Required<WordsOptions>, LastCharacter extends string = '', CurrentWord extends string = ''> = Sentence extends `${infer FirstCharacter}${infer RemainingCharacters}` ? FirstCharacter extends WordSeparators // Skip word separator
|
|
1831
|
+
type WordsImplementation<Sentence extends string, Options extends Required<WordsOptions>, LastCharacter extends string = '', CurrentWord extends string = ''> = Sentence extends `${infer FirstCharacter}${infer RemainingCharacters}` ? FirstCharacter extends WordSeparators | (Options['splitOnPunctuation'] extends true ? AsciiPunctuation : never) // Skip word separator
|
|
1805
1832
|
? [...SkipEmptyWord<CurrentWord>, ...WordsImplementation<RemainingCharacters, Options>] : LastCharacter extends '' // Fist char of word
|
|
1806
1833
|
? WordsImplementation<RemainingCharacters, Options, FirstCharacter, FirstCharacter> // Case change: non-numeric to numeric
|
|
1807
1834
|
: [false, true] extends [IsNumeric<LastCharacter>, IsNumeric<FirstCharacter>] ? Options['splitOnNumbers'] extends true // Split on number: push word
|
|
@@ -1815,7 +1842,7 @@ type WordsImplementation<Sentence extends string, Options extends Required<Words
|
|
|
1815
1842
|
: [true, true] extends [IsUppercase<LastCharacter>, IsLowercase<FirstCharacter>] ? [...RemoveLastCharacter<CurrentWord, LastCharacter>, ...WordsImplementation<RemainingCharacters, Options, FirstCharacter, `${LastCharacter}${FirstCharacter}`>] // No case change: concat word
|
|
1816
1843
|
: WordsImplementation<RemainingCharacters, Options, FirstCharacter, `${CurrentWord}${FirstCharacter}`> : [...SkipEmptyWord<CurrentWord>];
|
|
1817
1844
|
//#endregion
|
|
1818
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
1845
|
+
//#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/remove-prefix.d.ts
|
|
1819
1846
|
/**
|
|
1820
1847
|
@see {@link RemovePrefix}
|
|
1821
1848
|
*/
|
|
@@ -1905,7 +1932,7 @@ type _RemovePrefix<S extends string, Prefix extends string, Options extends Requ
|
|
|
1905
1932
|
: S // Return back `S` when `Prefix` is not present at the start of `S`
|
|
1906
1933
|
: never;
|
|
1907
1934
|
//#endregion
|
|
1908
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
1935
|
+
//#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/delimiter-case.d.ts
|
|
1909
1936
|
type _DefaultDelimiterCaseOptions = Merge<_DefaultWordsOptions, {
|
|
1910
1937
|
splitOnNumbers: false;
|
|
1911
1938
|
}>;
|
|
@@ -1929,6 +1956,7 @@ import type {DelimiterCase} from 'type-fest';
|
|
|
1929
1956
|
|
|
1930
1957
|
const someVariable: DelimiterCase<'fooBar', '#'> = 'foo#bar';
|
|
1931
1958
|
const someVariableNoSplitOnNumbers: DelimiterCase<'p2pNetwork', '#', {splitOnNumbers: false}> = 'p2p#network';
|
|
1959
|
+
const someVariableWithPunctuation: DelimiterCase<'div.card::after', '#', {splitOnPunctuation: true}> = 'div#card#after';
|
|
1932
1960
|
|
|
1933
1961
|
// Advanced
|
|
1934
1962
|
|
|
@@ -1956,7 +1984,7 @@ type DelimiterCase<Value, Delimiter extends string, Options extends WordsOptions
|
|
|
1956
1984
|
strict: false;
|
|
1957
1985
|
}>> : Value;
|
|
1958
1986
|
//#endregion
|
|
1959
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
1987
|
+
//#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/kebab-case.d.ts
|
|
1960
1988
|
/**
|
|
1961
1989
|
Convert a string literal to kebab-case.
|
|
1962
1990
|
|
|
@@ -1970,6 +1998,7 @@ import type {KebabCase} from 'type-fest';
|
|
|
1970
1998
|
|
|
1971
1999
|
const someVariable: KebabCase<'fooBar'> = 'foo-bar';
|
|
1972
2000
|
const someVariableNoSplitOnNumbers: KebabCase<'p2pNetwork', {splitOnNumbers: false}> = 'p2p-network';
|
|
2001
|
+
const someVariableWithPunctuation: KebabCase<'div.card::after', {splitOnPunctuation: true}> = 'div-card-after';
|
|
1973
2002
|
|
|
1974
2003
|
// Advanced
|
|
1975
2004
|
|
|
@@ -2018,6 +2047,8 @@ declare const MENTION_ID_ATTRIBUTE = "data-id";
|
|
|
2018
2047
|
declare const MENTION_LABEL_ATTRIBUTE = "data-label";
|
|
2019
2048
|
declare const MENTION_TYPE_ATTRIBUTE = "data-type";
|
|
2020
2049
|
declare const MENTION_TYPE = "mention";
|
|
2050
|
+
declare const MENTION_HERE_ID = "@here";
|
|
2051
|
+
declare const MENTION_EVERYONE_ID = "@everyone";
|
|
2021
2052
|
//#endregion
|
|
2022
2053
|
//#region ../../node_modules/.pnpm/node-html-parser@7.1.0/node_modules/node-html-parser/dist/void-tag.d.ts
|
|
2023
2054
|
declare class VoidTag {
|
|
@@ -2349,7 +2380,7 @@ declare const getPropertyNames: <T>() => PropertyNames<T>;
|
|
|
2349
2380
|
declare const isPlainObject: (data: unknown) => data is object;
|
|
2350
2381
|
//#endregion
|
|
2351
2382
|
//#region src/util/object/jsonDateParse.d.ts
|
|
2352
|
-
declare const jsonDateParse: (text: string) =>
|
|
2383
|
+
declare const jsonDateParse: <T = any>(text: string) => T;
|
|
2353
2384
|
//#endregion
|
|
2354
2385
|
//#region src/util/types/MergeObjectsStrict.d.ts
|
|
2355
2386
|
type MergeObjectsStrict<T extends object[]> = T extends [infer TFirst, infer TSecond, ...infer TRemaining] ? TSecond extends { [K in keyof TSecond]: K extends keyof TFirst ? never : TSecond[K] } ? TRemaining extends object[] ? MergeObjectsStrict<[TSecond, ...TRemaining]> & TFirst : TFirst & TSecond : never : T extends [infer TFirst] ? TFirst : never;
|
|
@@ -2427,4 +2458,4 @@ declare const UUIDV4_REGEX: RegExp;
|
|
|
2427
2458
|
//#region src/util/id/uuid/uuidValidateV4.d.ts
|
|
2428
2459
|
declare const uuidValidateV4: (uuid: string) => boolean;
|
|
2429
2460
|
//#endregion
|
|
2430
|
-
export { AllSpecialValues, BuildTuple, DeepOmit, DeepOptionalUndefined, ExcludeFunctionProperties, FunctionProperties, GetPaths, GetProperties, ID_SEPARATOR, InvalidOperationError, ItemEntityType, ItemEntityTypePropertyNames, ItemMetadata, ItemMetadataPropertyNames, MENTION_ID_ATTRIBUTE, MENTION_LABEL_ATTRIBUTE, MENTION_TYPE, MENTION_TYPE_ATTRIBUTE, MapValue, MergeObjectsStrict, NIL, NotFoundError, NotInitializedError, Operation, PropertyNames, RoutePath, SITE_NAME, SURVEY_DISPLAY_NAME, Serializable, SkipFirst, TakeFirst, TakeOne, ToData, TupleSlice, TupleSplit, TupleSplitHead, TupleSplitTail, UUIDV4_REGEX, WithMetadata, applyItemMetadataMixin, capitalize, createItemEntityTypeSchema, css, escapeRegExp, exhaustiveGuard, getIsServer, getMentions, getPropertyNames, getRawData, hrtime, html, isPlainObject, itemMetadataSchema, jsonDateParse, mergeObjectsStrict, now, streamToText, takeOne, toKebabCase, toRawDeep, truncate, uncapitalize, uuidValidateV4 };
|
|
2461
|
+
export { AllSpecialValues, BuildTuple, DeepOmit, DeepOptionalUndefined, ExcludeFunctionProperties, ForbiddenError, FunctionProperties, GetPaths, GetProperties, ID_SEPARATOR, InvalidOperationError, ItemEntityType, ItemEntityTypePropertyNames, ItemMetadata, ItemMetadataPropertyNames, MENTION_EVERYONE_ID, MENTION_HERE_ID, MENTION_ID_ATTRIBUTE, MENTION_LABEL_ATTRIBUTE, MENTION_TYPE, MENTION_TYPE_ATTRIBUTE, MapValue, MergeObjectsStrict, NIL, NotFoundError, NotInitializedError, Operation, PropertyNames, RoutePath, SITE_NAME, SURVEY_DISPLAY_NAME, Serializable, SkipFirst, TakeFirst, TakeOne, ToData, TupleSlice, TupleSplit, TupleSplitHead, TupleSplitTail, UUIDV4_REGEX, WithMetadata, applyItemMetadataMixin, capitalize, createItemEntityTypeSchema, css, escapeRegExp, exhaustiveGuard, getIsServer, getMentions, getPropertyNames, getRawData, hrtime, html, isPlainObject, itemMetadataSchema, jsonDateParse, mergeObjectsStrict, now, streamToText, takeOne, toKebabCase, toRawDeep, truncate, uncapitalize, uuidValidateV4 };
|