@esposter/shared 2.0.0 → 2.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/README.md +17 -0
- package/dist/index.d.ts +81 -167
- package/dist/index.js +1 -45393
- package/package.json +4 -12
package/README.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# @esposter/shared
|
|
2
|
+
|
|
3
|
+
[![Apache-2.0 licensed][badge-license]][url-license]
|
|
4
|
+
[![NPM version][badge-npm-version]][url-npm]
|
|
5
|
+
[![NPM downloads][badge-npm-downloads]][url-npm]
|
|
6
|
+
[![NPM Unpacked Size (with version)][badge-npm-unpacked-size]][url-npm]
|
|
7
|
+
|
|
8
|
+
## <a name="license">⚖️ License</a>
|
|
9
|
+
|
|
10
|
+
This project is licensed under the [Apache-2.0 license](https://github.com/Esposter/Esposter/blob/main/LICENSE).
|
|
11
|
+
|
|
12
|
+
[badge-license]: https://img.shields.io/github/license/Esposter/Esposter.svg?color=blue
|
|
13
|
+
[url-license]: https://github.com/Esposter/Esposter/blob/main/LICENSE
|
|
14
|
+
[badge-npm-version]: https://img.shields.io/npm/v/@esposter/shared/latest?color=brightgreen
|
|
15
|
+
[url-npm]: https://www.npmjs.com/package/@esposter/shared/v/latest
|
|
16
|
+
[badge-npm-unpacked-size]: https://img.shields.io/npm/unpacked-size/@esposter/shared/latest?label=npm
|
|
17
|
+
[badge-npm-downloads]: https://img.shields.io/npm/dm/@esposter/shared.svg
|
package/dist/index.d.ts
CHANGED
|
@@ -1,36 +1,26 @@
|
|
|
1
|
-
//#region src/util/parseXmlString.d.ts
|
|
2
|
-
declare const parseXmlString: <T extends object>(xmlString: string) => Promise<T>;
|
|
3
|
-
|
|
4
|
-
//#endregion
|
|
5
|
-
//#region src/util/parseXmlValue.d.ts
|
|
6
|
-
declare const parseXmlValue: (value: string) => boolean | number | string;
|
|
7
|
-
|
|
8
|
-
//#endregion
|
|
9
1
|
//#region src/models/shared/Operation.d.ts
|
|
10
2
|
declare enum Operation {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
//#endregion
|
|
3
|
+
Create = "Create",
|
|
4
|
+
Delete = "Delete",
|
|
5
|
+
Push = "Push",
|
|
6
|
+
Read = "Read",
|
|
7
|
+
Update = "Update",
|
|
8
|
+
} //#endregion
|
|
19
9
|
//#region src/models/error/InvalidOperationError.d.ts
|
|
20
10
|
declare class InvalidOperationError extends Error {
|
|
21
|
-
|
|
11
|
+
constructor(operation: Operation, name: string, message: string);
|
|
22
12
|
}
|
|
23
13
|
|
|
24
14
|
//#endregion
|
|
25
15
|
//#region src/models/error/NotFoundError.d.ts
|
|
26
16
|
declare class NotFoundError<T extends string = string> extends Error {
|
|
27
|
-
|
|
17
|
+
constructor(name: T, id: string);
|
|
28
18
|
}
|
|
29
19
|
|
|
30
20
|
//#endregion
|
|
31
21
|
//#region src/models/error/NotInitializedError.d.ts
|
|
32
22
|
declare class NotInitializedError<T extends string = string> extends Error {
|
|
33
|
-
|
|
23
|
+
constructor(name: T);
|
|
34
24
|
}
|
|
35
25
|
|
|
36
26
|
//#endregion
|
|
@@ -43,7 +33,7 @@ declare const isPlainObject: (data: unknown) => data is object;
|
|
|
43
33
|
|
|
44
34
|
//#endregion
|
|
45
35
|
//#region src/util/types/MergeObjectsStrict.d.ts
|
|
46
|
-
type MergeObjectsStrict<T extends object[]> = T extends [infer TFirst, infer TSecond, ...infer TRemaining] ? TSecond extends { [K in keyof TSecond]
|
|
36
|
+
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;
|
|
47
37
|
|
|
48
38
|
//#endregion
|
|
49
39
|
//#region src/util/object/mergeObjectsStrict.d.ts
|
|
@@ -63,19 +53,30 @@ declare const toKebabCase: <T extends string>(string: T) => CamelToKebab<T>;
|
|
|
63
53
|
|
|
64
54
|
//#endregion
|
|
65
55
|
//#region src/util/types/FunctionProperties.d.ts
|
|
66
|
-
type FunctionProperties<T> = { [K in keyof T]
|
|
56
|
+
type FunctionProperties<T> = { [K in keyof T]: T[K] extends Function ? K : never };
|
|
67
57
|
|
|
68
58
|
//#endregion
|
|
69
|
-
//#region ../../node_modules/.pnpm/type-fest@4.
|
|
59
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/observable-like.d.ts
|
|
70
60
|
declare global {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
61
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
62
|
+
interface SymbolConstructor {
|
|
63
|
+
readonly observable: symbol;
|
|
64
|
+
}
|
|
75
65
|
}
|
|
76
66
|
|
|
77
67
|
//#endregion
|
|
78
|
-
//#region ../../node_modules/.pnpm/type-fest@4.
|
|
68
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/optional-keys-of.d.ts
|
|
69
|
+
/**
|
|
70
|
+
@remarks
|
|
71
|
+
The TC39 observable proposal defines a `closed` property, but some implementations (such as xstream) do not as of 10/08/2021.
|
|
72
|
+
As well, some guidance on making an `Observable` to not include `closed` property.
|
|
73
|
+
@see https://github.com/tc39/proposal-observable/blob/master/src/Observable.js#L129-L130
|
|
74
|
+
@see https://github.com/staltz/xstream/blob/6c22580c1d84d69773ee4b0905df44ad464955b3/src/index.ts#L79-L85
|
|
75
|
+
@see https://github.com/benlesh/symbol-observable#making-an-object-observable
|
|
76
|
+
|
|
77
|
+
@category Observable
|
|
78
|
+
*/
|
|
79
|
+
|
|
79
80
|
/**
|
|
80
81
|
Extract all optional keys from the given type.
|
|
81
82
|
|
|
@@ -109,15 +110,13 @@ const update2: UpdateOperation<User> = {
|
|
|
109
110
|
|
|
110
111
|
@category Utilities
|
|
111
112
|
*/
|
|
112
|
-
type OptionalKeysOf<BaseType extends object> =
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
[Key in keyof BaseType as BaseType extends Record<Key, BaseType[Key]> ? never : Key]: never
|
|
116
|
-
}) & (keyof BaseType) // Intersect with `keyof BaseType` to ensure result of `OptionalKeysOf<BaseType>` is always assignable to `keyof BaseType`
|
|
117
|
-
: never;
|
|
113
|
+
type OptionalKeysOf<BaseType extends object> = BaseType extends unknown // For distributing `BaseType`
|
|
114
|
+
? (keyof { [Key in keyof BaseType as BaseType extends Record<Key, BaseType[Key]> ? never : Key]: never }) & (keyof BaseType) // Intersect with `keyof BaseType` to ensure result of `OptionalKeysOf<BaseType>` is always assignable to `keyof BaseType`
|
|
115
|
+
: never;
|
|
118
116
|
|
|
119
117
|
//#endregion
|
|
120
|
-
//#region ../../node_modules/.pnpm/type-fest@4.
|
|
118
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/required-keys-of.d.ts
|
|
119
|
+
// Should never happen
|
|
121
120
|
/**
|
|
122
121
|
Extract all required keys from the given type.
|
|
123
122
|
|
|
@@ -142,13 +141,13 @@ const validator2 = createValidation<User>('surname', value => value.length < 25)
|
|
|
142
141
|
|
|
143
142
|
@category Utilities
|
|
144
143
|
*/
|
|
145
|
-
type RequiredKeysOf<BaseType extends object> =
|
|
146
|
-
|
|
147
|
-
? Exclude<keyof BaseType, OptionalKeysOf<BaseType>>
|
|
148
|
-
: never;
|
|
144
|
+
type RequiredKeysOf<BaseType extends object> = BaseType extends unknown // For distributing `BaseType`
|
|
145
|
+
? Exclude<keyof BaseType, OptionalKeysOf<BaseType>> : never;
|
|
149
146
|
|
|
150
147
|
//#endregion
|
|
151
|
-
//#region ../../node_modules/.pnpm/type-fest@4.
|
|
148
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/is-never.d.ts
|
|
149
|
+
// Should never happen
|
|
150
|
+
|
|
152
151
|
/**
|
|
153
152
|
Returns a boolean for whether the given type is `never`.
|
|
154
153
|
|
|
@@ -193,7 +192,7 @@ endIfEqual('abc', '123');
|
|
|
193
192
|
type IsNever<T> = [T] extends [never] ? true : false;
|
|
194
193
|
|
|
195
194
|
//#endregion
|
|
196
|
-
//#region ../../node_modules/.pnpm/type-fest@4.
|
|
195
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/if-never.d.ts
|
|
197
196
|
/**
|
|
198
197
|
An if-else-like type that resolves depending on whether the given type is `never`.
|
|
199
198
|
|
|
@@ -213,13 +212,14 @@ type ShouldBeBar = IfNever<'not never', 'foo', 'bar'>;
|
|
|
213
212
|
@category Type Guard
|
|
214
213
|
@category Utilities
|
|
215
214
|
*/
|
|
216
|
-
type IfNever<T, TypeIfNever = true, TypeIfNotNever = false> = (
|
|
217
|
-
IsNever<T> extends true ? TypeIfNever : TypeIfNotNever
|
|
218
|
-
);
|
|
215
|
+
type IfNever<T, TypeIfNever = true, TypeIfNotNever = false> = (IsNever<T> extends true ? TypeIfNever : TypeIfNotNever);
|
|
219
216
|
|
|
220
217
|
//#endregion
|
|
221
|
-
//#region ../../node_modules/.pnpm/type-fest@4.
|
|
218
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/is-any.d.ts
|
|
219
|
+
// Can eventually be replaced with the built-in once this library supports
|
|
220
|
+
// TS5.4+ only. Tracked in https://github.com/sindresorhus/type-fest/issues/848
|
|
222
221
|
type NoInfer<T> = T extends infer U ? U : never;
|
|
222
|
+
|
|
223
223
|
/**
|
|
224
224
|
Returns a boolean for whether the given type is `any`.
|
|
225
225
|
|
|
@@ -251,7 +251,7 @@ const anyA = get(anyObject, 'a');
|
|
|
251
251
|
type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;
|
|
252
252
|
|
|
253
253
|
//#endregion
|
|
254
|
-
//#region ../../node_modules/.pnpm/type-fest@4.
|
|
254
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/is-equal.d.ts
|
|
255
255
|
/**
|
|
256
256
|
Returns a boolean for whether the two given types are equal.
|
|
257
257
|
|
|
@@ -278,14 +278,10 @@ type Includes<Value extends readonly any[], Item> =
|
|
|
278
278
|
@category Type Guard
|
|
279
279
|
@category Utilities
|
|
280
280
|
*/
|
|
281
|
-
type IsEqual<A, B> =
|
|
282
|
-
(<G>() => G extends A & G | G ? 1 : 2) extends
|
|
283
|
-
(<G>() => G extends B & G | G ? 1 : 2)
|
|
284
|
-
? true
|
|
285
|
-
: false;
|
|
281
|
+
type IsEqual<A, B> = (<G>() => G extends A & G | G ? 1 : 2) extends (<G>() => G extends B & G | G ? 1 : 2) ? true : false;
|
|
286
282
|
|
|
287
283
|
//#endregion
|
|
288
|
-
//#region ../../node_modules/.pnpm/type-fest@4.
|
|
284
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/simplify.d.ts
|
|
289
285
|
/**
|
|
290
286
|
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.
|
|
291
287
|
|
|
@@ -343,10 +339,10 @@ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface`
|
|
|
343
339
|
@see SimplifyDeep
|
|
344
340
|
@category Object
|
|
345
341
|
*/
|
|
346
|
-
type Simplify<T> = {[KeyType in keyof T]: T[KeyType]} & {};
|
|
342
|
+
type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};
|
|
347
343
|
|
|
348
344
|
//#endregion
|
|
349
|
-
//#region ../../node_modules/.pnpm/type-fest@4.
|
|
345
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/omit-index-signature.d.ts
|
|
350
346
|
/**
|
|
351
347
|
Omit any index signatures from the given object type, leaving only explicitly defined properties.
|
|
352
348
|
|
|
@@ -437,14 +433,10 @@ type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
|
|
|
437
433
|
@see PickIndexSignature
|
|
438
434
|
@category Object
|
|
439
435
|
*/
|
|
440
|
-
type OmitIndexSignature<ObjectType> = {
|
|
441
|
-
[KeyType in keyof ObjectType as {} extends Record<KeyType, unknown>
|
|
442
|
-
? never
|
|
443
|
-
: KeyType]: ObjectType[KeyType];
|
|
444
|
-
};
|
|
436
|
+
type OmitIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType] };
|
|
445
437
|
|
|
446
438
|
//#endregion
|
|
447
|
-
//#region ../../node_modules/.pnpm/type-fest@4.
|
|
439
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/pick-index-signature.d.ts
|
|
448
440
|
/**
|
|
449
441
|
Pick only index signatures from the given object type, leaving out all explicitly defined properties.
|
|
450
442
|
|
|
@@ -490,17 +482,13 @@ type ExampleIndexSignature = PickIndexSignature<Example>;
|
|
|
490
482
|
@see OmitIndexSignature
|
|
491
483
|
@category Object
|
|
492
484
|
*/
|
|
493
|
-
type PickIndexSignature<ObjectType> = {
|
|
494
|
-
[KeyType in keyof ObjectType as {} extends Record<KeyType, unknown>
|
|
495
|
-
? KeyType
|
|
496
|
-
: never]: ObjectType[KeyType];
|
|
497
|
-
};
|
|
485
|
+
type PickIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? KeyType : never]: ObjectType[KeyType] };
|
|
498
486
|
|
|
499
487
|
//#endregion
|
|
500
|
-
//#region ../../node_modules/.pnpm/type-fest@4.
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
488
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/merge.d.ts
|
|
489
|
+
// Merges two objects without worrying about index signatures.
|
|
490
|
+
type SimpleMerge<Destination, Source> = { [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key] } & Source;
|
|
491
|
+
|
|
504
492
|
/**
|
|
505
493
|
Merge two types into a new type. Keys of the second type overrides keys of the first type.
|
|
506
494
|
|
|
@@ -535,14 +523,10 @@ export type FooBar = Merge<Foo, Bar>;
|
|
|
535
523
|
|
|
536
524
|
@category Object
|
|
537
525
|
*/
|
|
538
|
-
type Merge<Destination, Source> =
|
|
539
|
-
Simplify<
|
|
540
|
-
SimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>>
|
|
541
|
-
& SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>
|
|
542
|
-
>;
|
|
526
|
+
type Merge<Destination, Source> = Simplify<SimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>> & SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>>;
|
|
543
527
|
|
|
544
528
|
//#endregion
|
|
545
|
-
//#region ../../node_modules/.pnpm/type-fest@4.
|
|
529
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/if-any.d.ts
|
|
546
530
|
/**
|
|
547
531
|
An if-else-like type that resolves depending on whether the given type is `any`.
|
|
548
532
|
|
|
@@ -562,12 +546,10 @@ type ShouldBeBar = IfAny<'not any', 'foo', 'bar'>;
|
|
|
562
546
|
@category Type Guard
|
|
563
547
|
@category Utilities
|
|
564
548
|
*/
|
|
565
|
-
type IfAny<T, TypeIfAny = true, TypeIfNotAny = false> = (
|
|
566
|
-
IsAny<T> extends true ? TypeIfAny : TypeIfNotAny
|
|
567
|
-
);
|
|
549
|
+
type IfAny<T, TypeIfAny = true, TypeIfNotAny = false> = (IsAny<T> extends true ? TypeIfAny : TypeIfNotAny);
|
|
568
550
|
|
|
569
551
|
//#endregion
|
|
570
|
-
//#region ../../node_modules/.pnpm/type-fest@4.
|
|
552
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/internal/object.d.ts
|
|
571
553
|
/**
|
|
572
554
|
Merges user specified options with default options.
|
|
573
555
|
|
|
@@ -620,53 +602,11 @@ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOp
|
|
|
620
602
|
// Types of property 'leavesOnly' are incompatible. Type 'string' is not assignable to type 'boolean'.
|
|
621
603
|
```
|
|
622
604
|
*/
|
|
623
|
-
type ApplyDefaultOptions<
|
|
624
|
-
|
|
625
|
-
Defaults extends Simplify<Omit<Required<Options>, RequiredKeysOf<Options>> & Partial<Record<RequiredKeysOf<Options>, never>>>,
|
|
626
|
-
SpecifiedOptions extends Options,
|
|
627
|
-
> =
|
|
628
|
-
IfAny<SpecifiedOptions, Defaults,
|
|
629
|
-
IfNever<SpecifiedOptions, Defaults,
|
|
630
|
-
Simplify<Merge<Defaults, {
|
|
631
|
-
[Key in keyof SpecifiedOptions
|
|
632
|
-
as Key extends OptionalKeysOf<Options>
|
|
633
|
-
? Extract<SpecifiedOptions[Key], undefined> extends never
|
|
634
|
-
? Key
|
|
635
|
-
: never
|
|
636
|
-
: Key
|
|
637
|
-
]: SpecifiedOptions[Key]
|
|
638
|
-
}> & Required<Options>> // `& Required<Options>` ensures that `ApplyDefaultOptions<SomeOption, ...>` is always assignable to `Required<SomeOption>`
|
|
639
|
-
>>;
|
|
640
|
-
|
|
641
|
-
//#endregion
|
|
642
|
-
//#region ../../node_modules/.pnpm/type-fest@4.40.0/node_modules/type-fest/source/except.d.ts
|
|
643
|
-
/**
|
|
644
|
-
Filter out keys from an object.
|
|
645
|
-
|
|
646
|
-
Returns `never` if `Exclude` is strictly equal to `Key`.
|
|
647
|
-
Returns `never` if `Key` extends `Exclude`.
|
|
648
|
-
Returns `Key` otherwise.
|
|
605
|
+
type ApplyDefaultOptions<Options extends object, Defaults extends Simplify<Omit<Required<Options>, RequiredKeysOf<Options>> & Partial<Record<RequiredKeysOf<Options>, never>>>, SpecifiedOptions extends Options> = IfAny<SpecifiedOptions, Defaults, IfNever<SpecifiedOptions, Defaults, Simplify<Merge<Defaults, { [Key in keyof SpecifiedOptions as Key extends OptionalKeysOf<Options> ? Extract<SpecifiedOptions[Key], undefined> extends never ? Key : never : Key]: SpecifiedOptions[Key] }> & Required<Options>> // `& Required<Options>` ensures that `ApplyDefaultOptions<SomeOption, ...>` is always assignable to `Required<SomeOption>`
|
|
606
|
+
>>;
|
|
649
607
|
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
type Filtered = Filter<'foo', 'foo'>;
|
|
653
|
-
//=> never
|
|
654
|
-
```
|
|
655
|
-
|
|
656
|
-
@example
|
|
657
|
-
```
|
|
658
|
-
type Filtered = Filter<'bar', string>;
|
|
659
|
-
//=> never
|
|
660
|
-
```
|
|
661
|
-
|
|
662
|
-
@example
|
|
663
|
-
```
|
|
664
|
-
type Filtered = Filter<'bar', 'foo'>;
|
|
665
|
-
//=> 'bar'
|
|
666
|
-
```
|
|
667
|
-
|
|
668
|
-
@see {Except}
|
|
669
|
-
*/
|
|
608
|
+
//#endregion
|
|
609
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/except.d.ts
|
|
670
610
|
/**
|
|
671
611
|
Filter out keys from an object.
|
|
672
612
|
|
|
@@ -696,18 +636,17 @@ type Filtered = Filter<'bar', 'foo'>;
|
|
|
696
636
|
*/
|
|
697
637
|
type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
|
|
698
638
|
type ExceptOptions = {
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
*/
|
|
706
|
-
requireExactProps?: boolean;
|
|
639
|
+
/**
|
|
640
|
+
Disallow assigning non-specified properties.
|
|
641
|
+
Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
|
|
642
|
+
@default false
|
|
643
|
+
*/
|
|
644
|
+
requireExactProps?: boolean;
|
|
707
645
|
};
|
|
708
646
|
type DefaultExceptOptions = {
|
|
709
|
-
|
|
647
|
+
requireExactProps: false;
|
|
710
648
|
};
|
|
649
|
+
|
|
711
650
|
/**
|
|
712
651
|
Create a type from an object type without certain keys.
|
|
713
652
|
|
|
@@ -761,13 +700,8 @@ type PostPayload = Except<UserData, 'email'>;
|
|
|
761
700
|
|
|
762
701
|
@category Object
|
|
763
702
|
*/
|
|
764
|
-
type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {}> =
|
|
765
|
-
|
|
766
|
-
type _Except<ObjectType, KeysType extends keyof ObjectType, Options extends Required<ExceptOptions>> = {
|
|
767
|
-
[KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];
|
|
768
|
-
} & (Options['requireExactProps'] extends true
|
|
769
|
-
? Partial<Record<KeysType, never>>
|
|
770
|
-
: {});
|
|
703
|
+
type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {}> = _Except<ObjectType, KeysType, ApplyDefaultOptions<ExceptOptions, DefaultExceptOptions, Options>>;
|
|
704
|
+
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>> : {});
|
|
771
705
|
|
|
772
706
|
//#endregion
|
|
773
707
|
//#region src/util/types/ExcludeFunctionProperties.d.ts
|
|
@@ -779,47 +713,27 @@ type KebabToCamel<S extends string> = S extends `${infer T}-${infer U}` ? `${T}$
|
|
|
779
713
|
|
|
780
714
|
//#endregion
|
|
781
715
|
//#region src/util/types/TupleSplitHead.d.ts
|
|
782
|
-
type TupleSplitHead<
|
|
783
|
-
T extends unknown[],
|
|
784
|
-
N extends number
|
|
785
|
-
> = T["length"] extends N ? T : T extends [...infer R, unknown] ? TupleSplitHead<R, N> : never;
|
|
716
|
+
type TupleSplitHead<T extends unknown[], N extends number> = T["length"] extends N ? T : T extends [...infer R, unknown] ? TupleSplitHead<R, N> : never;
|
|
786
717
|
|
|
787
718
|
//#endregion
|
|
788
719
|
//#region src/util/types/TupleSplitTail.d.ts
|
|
789
|
-
type TupleSplitTail<
|
|
790
|
-
T,
|
|
791
|
-
N extends number,
|
|
792
|
-
O extends unknown[] = []
|
|
793
|
-
> = O["length"] extends N ? T : T extends [infer F, ...infer R] ? TupleSplitTail<[...R], N, [...O, F]> : never;
|
|
720
|
+
type TupleSplitTail<T, N extends number, O extends unknown[] = []> = O["length"] extends N ? T : T extends [infer F, ...infer R] ? TupleSplitTail<[...R], N, [...O, F]> : never;
|
|
794
721
|
|
|
795
722
|
//#endregion
|
|
796
723
|
//#region src/util/types/TupleSplit.d.ts
|
|
797
|
-
type TupleSplit<
|
|
798
|
-
T extends unknown[],
|
|
799
|
-
N extends number
|
|
800
|
-
> = [TupleSplitHead<T, N>, TupleSplitTail<T, N>];
|
|
724
|
+
type TupleSplit<T extends unknown[], N extends number> = [TupleSplitHead<T, N>, TupleSplitTail<T, N>];
|
|
801
725
|
|
|
802
726
|
//#endregion
|
|
803
727
|
//#region src/util/types/SkipFirst.d.ts
|
|
804
|
-
type SkipFirst<
|
|
805
|
-
T extends unknown[],
|
|
806
|
-
N extends number
|
|
807
|
-
> = TupleSplit<T, N>[1];
|
|
728
|
+
type SkipFirst<T extends unknown[], N extends number> = TupleSplit<T, N>[1];
|
|
808
729
|
|
|
809
730
|
//#endregion
|
|
810
731
|
//#region src/util/types/TakeFirst.d.ts
|
|
811
|
-
type TakeFirst<
|
|
812
|
-
T extends unknown[],
|
|
813
|
-
N extends number
|
|
814
|
-
> = TupleSplit<T, N>[0];
|
|
732
|
+
type TakeFirst<T extends unknown[], N extends number> = TupleSplit<T, N>[0];
|
|
815
733
|
|
|
816
734
|
//#endregion
|
|
817
735
|
//#region src/util/types/TupleSlice.d.ts
|
|
818
|
-
type TupleSlice<
|
|
819
|
-
T extends unknown[],
|
|
820
|
-
S extends number,
|
|
821
|
-
E extends number = T["length"]
|
|
822
|
-
> = SkipFirst<TakeFirst<T, E>, S>;
|
|
736
|
+
type TupleSlice<T extends unknown[], S extends number, E extends number = T["length"]> = SkipFirst<TakeFirst<T, E>, S>;
|
|
823
737
|
|
|
824
738
|
//#endregion
|
|
825
739
|
//#region src/util/validation/exhaustiveGuard.d.ts
|
|
@@ -836,4 +750,4 @@ declare const UUIDV4_SEARCH_REGEX: RegExp;
|
|
|
836
750
|
declare const uuidValidateV4: (uuid: string) => boolean;
|
|
837
751
|
|
|
838
752
|
//#endregion
|
|
839
|
-
export { CamelToKebab, ExcludeFunctionProperties, FunctionProperties, ID_SEPARATOR, InvalidOperationError, KebabToCamel, MergeObjectsStrict, NIL, NotFoundError, NotInitializedError, Operation, SkipFirst, TakeFirst, TupleSlice, TupleSplit, TupleSplitHead, TupleSplitTail, UUIDV4_REGEX, UUIDV4_SEARCH_REGEX, capitalize, exhaustiveGuard, isPlainObject, mergeObjectsStrict,
|
|
753
|
+
export { CamelToKebab, ExcludeFunctionProperties, FunctionProperties, ID_SEPARATOR, InvalidOperationError, KebabToCamel, MergeObjectsStrict, NIL, NotFoundError, NotInitializedError, Operation, SkipFirst, TakeFirst, TupleSlice, TupleSplit, TupleSplitHead, TupleSplitTail, UUIDV4_REGEX, UUIDV4_SEARCH_REGEX, capitalize, exhaustiveGuard, isPlainObject, mergeObjectsStrict, toKebabCase, uuidValidateV4 };
|