@leyyo/common 1.0.13 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/deploy/deploy.common.d.ts +12 -7
- package/dist/deploy/deploy.common.js +29 -10
- package/dist/deploy/deploy.common.js.map +1 -1
- package/dist/deploy/index.types.d.ts +12 -8
- package/dist/error/error.common.d.ts +12 -20
- package/dist/error/error.common.js +151 -85
- package/dist/error/error.common.js.map +1 -1
- package/dist/error/http-error.map.d.ts +6 -0
- package/dist/error/http-error.map.js +25 -0
- package/dist/error/http-error.map.js.map +1 -0
- package/dist/error/index.d.ts +2 -0
- package/dist/error/index.js +2 -0
- package/dist/error/index.js.map +1 -1
- package/dist/error/index.types.d.ts +35 -36
- package/dist/error/items/bad-request.error.d.ts +10 -0
- package/dist/error/items/bad-request.error.js +16 -0
- package/dist/error/items/bad-request.error.js.map +1 -0
- package/dist/error/items/caused.error.d.ts +8 -0
- package/dist/error/items/caused.error.js +16 -0
- package/dist/error/items/caused.error.js.map +1 -0
- package/dist/error/items/conflict.error.d.ts +10 -0
- package/dist/error/items/conflict.error.js +16 -0
- package/dist/error/items/conflict.error.js.map +1 -0
- package/dist/error/items/content-too-large.error.d.ts +10 -0
- package/dist/error/items/content-too-large.error.js +16 -0
- package/dist/error/items/content-too-large.error.js.map +1 -0
- package/dist/error/items/developer.error.d.ts +4 -0
- package/dist/error/items/developer.error.js +9 -0
- package/dist/error/items/developer.error.js.map +1 -0
- package/dist/error/items/forbidden.error.d.ts +10 -0
- package/dist/error/items/forbidden.error.js +16 -0
- package/dist/error/items/forbidden.error.js.map +1 -0
- package/dist/error/items/gone.error.d.ts +10 -0
- package/dist/error/items/gone.error.js +16 -0
- package/dist/error/items/gone.error.js.map +1 -0
- package/dist/error/items/http.error.d.ts +15 -0
- package/dist/error/items/http.error.js +21 -0
- package/dist/error/items/http.error.js.map +1 -0
- package/dist/error/items/index.d.ts +21 -0
- package/dist/error/items/index.js +38 -0
- package/dist/error/items/index.js.map +1 -0
- package/dist/error/items/invalid-value.error.d.ts +6 -0
- package/dist/error/items/invalid-value.error.js +11 -0
- package/dist/error/items/invalid-value.error.js.map +1 -0
- package/dist/error/items/length-required.error.d.ts +10 -0
- package/dist/error/items/length-required.error.js +16 -0
- package/dist/error/items/length-required.error.js.map +1 -0
- package/dist/error/items/leyyo.error.d.ts +50 -0
- package/dist/error/items/leyyo.error.js +98 -0
- package/dist/error/items/leyyo.error.js.map +1 -0
- package/dist/error/items/method-not-allowed.error.d.ts +10 -0
- package/dist/error/items/method-not-allowed.error.js +16 -0
- package/dist/error/items/method-not-allowed.error.js.map +1 -0
- package/dist/error/items/multiple.error.d.ts +11 -0
- package/dist/error/items/multiple.error.js +34 -0
- package/dist/error/items/multiple.error.js.map +1 -0
- package/dist/error/items/not-acceptable.error.d.ts +10 -0
- package/dist/error/items/not-acceptable.error.js +16 -0
- package/dist/error/items/not-acceptable.error.js.map +1 -0
- package/dist/error/items/not-found.error.d.ts +10 -0
- package/dist/error/items/not-found.error.js +16 -0
- package/dist/error/items/not-found.error.js.map +1 -0
- package/dist/error/items/payment-required.error.d.ts +10 -0
- package/dist/error/items/payment-required.error.js +16 -0
- package/dist/error/items/payment-required.error.js.map +1 -0
- package/dist/error/items/precondition-failed.error.d.ts +10 -0
- package/dist/error/items/precondition-failed.error.js +16 -0
- package/dist/error/items/precondition-failed.error.js.map +1 -0
- package/dist/error/items/proxy-authentication-required.error.d.ts +10 -0
- package/dist/error/items/proxy-authentication-required.error.js +16 -0
- package/dist/error/items/proxy-authentication-required.error.js.map +1 -0
- package/dist/error/items/request-timeout.error.d.ts +10 -0
- package/dist/error/items/request-timeout.error.js +16 -0
- package/dist/error/items/request-timeout.error.js.map +1 -0
- package/dist/error/items/silent.error.d.ts +11 -0
- package/dist/error/items/silent.error.js +19 -0
- package/dist/error/items/silent.error.js.map +1 -0
- package/dist/error/items/unauthorized.error.d.ts +10 -0
- package/dist/error/items/unauthorized.error.js +16 -0
- package/dist/error/items/unauthorized.error.js.map +1 -0
- package/dist/event/event.common.d.ts +77 -0
- package/dist/event/event.common.js +308 -0
- package/dist/event/event.common.js.map +1 -0
- package/dist/event/event.error.d.ts +3 -0
- package/dist/event/event.error.js +8 -0
- package/dist/event/event.error.js.map +1 -0
- package/dist/event/index.js.map +1 -0
- package/dist/event/index.types.d.ts +261 -0
- package/dist/{hook → event}/index.types.js.map +1 -1
- package/dist/hub/hub.channel.d.ts +27 -0
- package/dist/hub/hub.channel.js +83 -0
- package/dist/hub/hub.channel.js.map +1 -0
- package/dist/hub/hub.common.d.ts +27 -0
- package/dist/hub/hub.common.js +92 -0
- package/dist/hub/hub.common.js.map +1 -0
- package/dist/hub/index.js.map +1 -0
- package/dist/hub/index.types.d.ts +105 -0
- package/dist/{to → hub}/index.types.js.map +1 -1
- package/dist/index.d.ts +5 -23
- package/dist/index.js +7 -25
- package/dist/index.js.map +1 -1
- package/dist/leyyo/index.d.ts +0 -1
- package/dist/leyyo/index.js +0 -1
- package/dist/leyyo/index.js.map +1 -1
- package/dist/leyyo/index.types.d.ts +4 -22
- package/dist/leyyo/leyyo.d.ts +4 -22
- package/dist/leyyo/leyyo.js +12 -39
- package/dist/leyyo/leyyo.js.map +1 -1
- package/dist/log/index.types.d.ts +19 -26
- package/dist/log/log.common.d.ts +1 -1
- package/dist/log/log.common.js +24 -49
- package/dist/log/log.common.js.map +1 -1
- package/dist/log/logger.error.d.ts +3 -0
- package/dist/log/logger.error.js +8 -0
- package/dist/log/logger.error.js.map +1 -0
- package/dist/log/logger.instance.d.ts +7 -9
- package/dist/log/logger.instance.js +40 -50
- package/dist/log/logger.instance.js.map +1 -1
- package/dist/name/index.types.d.ts +1 -1
- package/dist/name/name.common.js +64 -37
- package/dist/name/name.common.js.map +1 -1
- package/dist/name/name.error.d.ts +3 -0
- package/dist/name/name.error.js +8 -0
- package/dist/name/name.error.js.map +1 -0
- package/dist/opt/index.js.map +1 -0
- package/dist/opt/index.types.d.ts +33 -0
- package/dist/{fqn → opt}/index.types.js.map +1 -1
- package/dist/opt/opt.common.d.ts +15 -0
- package/dist/opt/opt.common.js +93 -0
- package/dist/opt/opt.common.js.map +1 -0
- package/dist/repo/index.types.d.ts +1 -19
- package/dist/repo/repo.common.d.ts +0 -6
- package/dist/repo/repo.common.js +0 -20
- package/dist/repo/repo.common.js.map +1 -1
- package/dist/shared/index.d.ts +3 -0
- package/dist/shared/index.enum.d.ts +7 -0
- package/dist/{exception/index.types.js → shared/index.enum.js} +1 -1
- package/dist/shared/index.enum.js.map +1 -0
- package/dist/shared/index.fqn.d.ts +3 -0
- package/dist/shared/index.fqn.js +3 -0
- package/dist/shared/index.fqn.js.map +1 -0
- package/dist/shared/index.js +3 -0
- package/dist/shared/index.js.map +1 -1
- package/dist/shared/index.json.d.ts +33 -0
- package/dist/shared/index.json.js +3 -0
- package/dist/shared/index.json.js.map +1 -0
- package/dist/shared/index.types.d.ts +78 -100
- package/dist/shared/index.types.js +31 -0
- package/dist/shared/index.types.js.map +1 -1
- package/dist/util/delay.d.ts +9 -0
- package/dist/util/delay.js +21 -0
- package/dist/util/delay.js.map +1 -0
- package/dist/util/empty.fn.d.ts +8 -0
- package/dist/util/empty.fn.js +11 -0
- package/dist/util/empty.fn.js.map +1 -0
- package/dist/util/index.d.ts +5 -0
- package/dist/{developer → util}/index.js +5 -2
- package/dist/util/index.js.map +1 -0
- package/dist/util/one-or-more.d.ts +8 -0
- package/dist/util/one-or-more.js +19 -0
- package/dist/util/one-or-more.js.map +1 -0
- package/dist/util/secure-clone.d.ts +3 -0
- package/dist/util/secure-clone.js +38 -0
- package/dist/util/secure-clone.js.map +1 -0
- package/dist/util/secure-json.d.ts +37 -0
- package/dist/util/secure-json.js +126 -0
- package/dist/util/secure-json.js.map +1 -0
- package/package.json +2 -2
- package/dist/assertion/assertion.common.d.ts +0 -183
- package/dist/assertion/assertion.common.js +0 -663
- package/dist/assertion/assertion.common.js.map +0 -1
- package/dist/assertion/index.js.map +0 -1
- package/dist/assertion/index.types.d.ts +0 -661
- package/dist/assertion/index.types.js.map +0 -1
- package/dist/descriptor/descriptor.common.d.ts +0 -22
- package/dist/descriptor/descriptor.common.js +0 -117
- package/dist/descriptor/descriptor.common.js.map +0 -1
- package/dist/descriptor/index.js.map +0 -1
- package/dist/descriptor/index.types.d.ts +0 -23
- package/dist/descriptor/index.types.js.map +0 -1
- package/dist/developer/developer.common.d.ts +0 -32
- package/dist/developer/developer.common.js +0 -245
- package/dist/developer/developer.common.js.map +0 -1
- package/dist/developer/index.d.ts +0 -2
- package/dist/developer/index.errors.d.ts +0 -13
- package/dist/developer/index.errors.js +0 -24
- package/dist/developer/index.errors.js.map +0 -1
- package/dist/developer/index.js.map +0 -1
- package/dist/developer/index.types.d.ts +0 -85
- package/dist/developer/index.types.js.map +0 -1
- package/dist/exception/assertion.exception.d.ts +0 -5
- package/dist/exception/assertion.exception.js +0 -12
- package/dist/exception/assertion.exception.js.map +0 -1
- package/dist/exception/caused.exception.d.ts +0 -5
- package/dist/exception/caused.exception.js +0 -13
- package/dist/exception/caused.exception.js.map +0 -1
- package/dist/exception/developer.exception.d.ts +0 -5
- package/dist/exception/developer.exception.js +0 -12
- package/dist/exception/developer.exception.js.map +0 -1
- package/dist/exception/exception.d.ts +0 -32
- package/dist/exception/exception.js +0 -117
- package/dist/exception/exception.js.map +0 -1
- package/dist/exception/index.d.ts +0 -7
- package/dist/exception/index.js +0 -24
- package/dist/exception/index.js.map +0 -1
- package/dist/exception/index.types.d.ts +0 -30
- package/dist/exception/index.types.js.map +0 -1
- package/dist/exception/invalid-value.exception.d.ts +0 -5
- package/dist/exception/invalid-value.exception.js +0 -12
- package/dist/exception/invalid-value.exception.js.map +0 -1
- package/dist/exception/multiple.exception.d.ts +0 -8
- package/dist/exception/multiple.exception.js +0 -34
- package/dist/exception/multiple.exception.js.map +0 -1
- package/dist/fqn/fqn.common.d.ts +0 -20
- package/dist/fqn/fqn.common.js +0 -123
- package/dist/fqn/fqn.common.js.map +0 -1
- package/dist/fqn/index.js.map +0 -1
- package/dist/fqn/index.types.d.ts +0 -20
- package/dist/fqn/index.types.js +0 -3
- package/dist/hook/hook.common.d.ts +0 -25
- package/dist/hook/hook.common.js +0 -95
- package/dist/hook/hook.common.js.map +0 -1
- package/dist/hook/index.d.ts +0 -1
- package/dist/hook/index.js +0 -18
- package/dist/hook/index.js.map +0 -1
- package/dist/hook/index.types.d.ts +0 -72
- package/dist/hook/index.types.js +0 -3
- package/dist/is/index.d.ts +0 -1
- package/dist/is/index.js +0 -18
- package/dist/is/index.js.map +0 -1
- package/dist/is/index.types.d.ts +0 -240
- package/dist/is/index.types.js +0 -3
- package/dist/is/index.types.js.map +0 -1
- package/dist/is/is.common.d.ts +0 -71
- package/dist/is/is.common.js +0 -177
- package/dist/is/is.common.js.map +0 -1
- package/dist/leyyo/leyyo-hook.common.d.ts +0 -10
- package/dist/leyyo/leyyo-hook.common.js +0 -18
- package/dist/leyyo/leyyo-hook.common.js.map +0 -1
- package/dist/mixin/index.d.ts +0 -1
- package/dist/mixin/index.js +0 -18
- package/dist/mixin/index.js.map +0 -1
- package/dist/mixin/index.types.d.ts +0 -19
- package/dist/mixin/index.types.js +0 -3
- package/dist/mixin/index.types.js.map +0 -1
- package/dist/mixin/mixin.common.d.ts +0 -22
- package/dist/mixin/mixin.common.js +0 -165
- package/dist/mixin/mixin.common.js.map +0 -1
- package/dist/system/country-code.d.ts +0 -10
- package/dist/system/country-code.js +0 -19
- package/dist/system/country-code.js.map +0 -1
- package/dist/system/environment.d.ts +0 -7
- package/dist/system/environment.js +0 -6
- package/dist/system/environment.js.map +0 -1
- package/dist/system/index.d.ts +0 -7
- package/dist/system/index.js +0 -24
- package/dist/system/index.js.map +0 -1
- package/dist/system/index.types.d.ts +0 -6
- package/dist/system/index.types.js +0 -3
- package/dist/system/index.types.js.map +0 -1
- package/dist/system/language-code.d.ts +0 -7
- package/dist/system/language-code.js +0 -11
- package/dist/system/language-code.js.map +0 -1
- package/dist/system/locale-code.d.ts +0 -9
- package/dist/system/locale-code.js +0 -16
- package/dist/system/locale-code.js.map +0 -1
- package/dist/system/sys-class.d.ts +0 -4
- package/dist/system/sys-class.js +0 -21
- package/dist/system/sys-class.js.map +0 -1
- package/dist/system/sys-function.d.ts +0 -4
- package/dist/system/sys-function.js +0 -8
- package/dist/system/sys-function.js.map +0 -1
- package/dist/system/system.common.d.ts +0 -11
- package/dist/system/system.common.js +0 -64
- package/dist/system/system.common.js.map +0 -1
- package/dist/test/index.d.ts +0 -2
- package/dist/test/index.js +0 -19
- package/dist/test/index.js.map +0 -1
- package/dist/test/index.types.d.ts +0 -9
- package/dist/test/index.types.js +0 -3
- package/dist/test/index.types.js.map +0 -1
- package/dist/test/test.common.d.ts +0 -14
- package/dist/test/test.common.js +0 -48
- package/dist/test/test.common.js.map +0 -1
- package/dist/test/tested.d.ts +0 -1
- package/dist/test/tested.js +0 -9
- package/dist/test/tested.js.map +0 -1
- package/dist/to/index.d.ts +0 -7
- package/dist/to/index.js +0 -24
- package/dist/to/index.js.map +0 -1
- package/dist/to/index.types.d.ts +0 -76
- package/dist/to/index.types.js +0 -3
- package/dist/to/key-value.d.ts +0 -4
- package/dist/to/key-value.js +0 -8
- package/dist/to/key-value.js.map +0 -1
- package/dist/to/list.d.ts +0 -20
- package/dist/to/list.js +0 -38
- package/dist/to/list.js.map +0 -1
- package/dist/to/primitive.d.ts +0 -7
- package/dist/to/primitive.js +0 -6
- package/dist/to/primitive.js.map +0 -1
- package/dist/to/real-value.d.ts +0 -7
- package/dist/to/real-value.js +0 -6
- package/dist/to/real-value.js.map +0 -1
- package/dist/to/to.common.d.ts +0 -77
- package/dist/to/to.common.js +0 -1079
- package/dist/to/to.common.js.map +0 -1
- package/dist/to/weak-false.d.ts +0 -7
- package/dist/to/weak-false.js +0 -6
- package/dist/to/weak-false.js.map +0 -1
- package/dist/to/weak-true.d.ts +0 -7
- package/dist/to/weak-true.js +0 -9
- package/dist/to/weak-true.js.map +0 -1
- package/dist/wrapper/index.d.ts +0 -2
- package/dist/wrapper/index.js +0 -19
- package/dist/wrapper/index.js.map +0 -1
- package/dist/wrapper/index.types.d.ts +0 -29
- package/dist/wrapper/index.types.js +0 -3
- package/dist/wrapper/index.types.js.map +0 -1
- package/dist/wrapper/wrap.d.ts +0 -7
- package/dist/wrapper/wrap.js +0 -11
- package/dist/wrapper/wrap.js.map +0 -1
- package/dist/wrapper/wrapper.common.d.ts +0 -26
- package/dist/wrapper/wrapper.common.js +0 -82
- package/dist/wrapper/wrapper.common.js.map +0 -1
- /package/dist/{assertion → event}/index.d.ts +0 -0
- /package/dist/{assertion → event}/index.js +0 -0
- /package/dist/{assertion → event}/index.types.js +0 -0
- /package/dist/{descriptor → hub}/index.d.ts +0 -0
- /package/dist/{descriptor → hub}/index.js +0 -0
- /package/dist/{descriptor → hub}/index.types.js +0 -0
- /package/dist/{fqn → opt}/index.d.ts +0 -0
- /package/dist/{fqn → opt}/index.js +0 -0
- /package/dist/{developer → opt}/index.types.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"name.error.js","sourceRoot":"","sources":["../../src/name/name.error.ts"],"names":[],"mappings":";;;AAAA,oCAAoC;AAEpC,MAAa,SAAU,SAAQ,kBAAU;CAExC;AAFD,8BAEC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/opt/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ClassLike, Describable, ExtendedType, Fnc, InitLike, Obj, OneOrMore, SetOrMore, ShiftMain, ShiftSecure } from "../shared";
|
|
2
|
+
export type OptReason = 'invalid' | 'unexpected' | 'not:allowed' | 'not:found' | 'duplicated' | 'empty' | 'conflicted';
|
|
3
|
+
export interface Opt<R extends string = string> extends Obj {
|
|
4
|
+
issue?: SetOrMore<OptReason | R | string> | OneOrMore<OptReason | R | string>;
|
|
5
|
+
message?: SetOrMore<string> | OneOrMore<string>;
|
|
6
|
+
field?: string;
|
|
7
|
+
param?: SetOrMore<unknown> | OneOrMore<unknown>;
|
|
8
|
+
where?: SetOrMore<ClassLike | Fnc | string> | OneOrMore<ClassLike | Fnc | string>;
|
|
9
|
+
value?: SetOrMore<unknown> | OneOrMore<unknown>;
|
|
10
|
+
expected?: SetOrMore<ExtendedType | string> | OneOrMore<ExtendedType | string>;
|
|
11
|
+
type?: SetOrMore<ExtendedType | string> | OneOrMore<ExtendedType | string>;
|
|
12
|
+
method?: SetOrMore<string> | OneOrMore<string>;
|
|
13
|
+
case?: SetOrMore<unknown> | OneOrMore<unknown>;
|
|
14
|
+
desc?: SetOrMore<Describable | string> | OneOrMore<Describable | string> | unknown;
|
|
15
|
+
error?: SetOrMore<{
|
|
16
|
+
name: string;
|
|
17
|
+
message: string;
|
|
18
|
+
}>;
|
|
19
|
+
assert?: SetOrMore<string>;
|
|
20
|
+
[k: string]: unknown;
|
|
21
|
+
}
|
|
22
|
+
export type OptFn<O extends Opt = Opt> = () => O;
|
|
23
|
+
export type OptAny<O extends Opt = Opt> = O | OptFn<O>;
|
|
24
|
+
export interface OptCommonLike extends ShiftSecure<OptCommonSecure> {
|
|
25
|
+
fn<O extends Opt = Opt>(opt: O | Opt): O;
|
|
26
|
+
check<O extends Opt = Opt>(opt: O | OptFn<O> | Opt): O;
|
|
27
|
+
clone<O extends Opt = Opt>(opt: O | OptFn<O> | Opt): O;
|
|
28
|
+
append<O extends Opt = Opt>(opt: O | Opt, appended: O | Opt): O;
|
|
29
|
+
field<O extends Opt = Opt>(opt: O | OptFn<O> | Opt, field: string | number): O;
|
|
30
|
+
add<O extends Opt = Opt>(opt: O | OptFn<O> | Opt, key: keyof O | string, value: unknown): O;
|
|
31
|
+
}
|
|
32
|
+
export interface OptCommonSecure extends ShiftMain<OptCommonLike>, InitLike {
|
|
33
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.types.js","sourceRoot":"","sources":["../../src/
|
|
1
|
+
{"version":3,"file":"index.types.js","sourceRoot":"","sources":["../../src/opt/index.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Opt, OptCommonLike, OptCommonSecure, OptFn } from "./index.types";
|
|
2
|
+
import type { LeyyoLike } from "../leyyo";
|
|
3
|
+
export declare class OptCommon implements OptCommonLike, OptCommonSecure {
|
|
4
|
+
private lyy;
|
|
5
|
+
constructor(lyy: LeyyoLike);
|
|
6
|
+
fn<O extends Opt = Opt>(opt: O | Opt): O;
|
|
7
|
+
check<O extends Opt = Opt>(opt: O | OptFn<O> | Opt): O;
|
|
8
|
+
clone<O extends Opt = Opt>(opt: O | OptFn<O> | Opt): O;
|
|
9
|
+
append<O extends Opt = Opt>(opt: O | Opt, appended: O | Opt): O;
|
|
10
|
+
add<O extends Opt = Opt>(opt: O | OptFn<O> | Opt, key: keyof O | string, value: unknown): O;
|
|
11
|
+
field<O extends Opt = Opt>(opt: O | OptFn<O> | Opt, field: string | number): O;
|
|
12
|
+
get $secure(): OptCommonSecure;
|
|
13
|
+
get $back(): OptCommonLike;
|
|
14
|
+
$init(): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OptCommon = void 0;
|
|
4
|
+
const internal_1 = require("../internal");
|
|
5
|
+
const util_1 = require("../util");
|
|
6
|
+
class OptCommon {
|
|
7
|
+
constructor(lyy) {
|
|
8
|
+
this.lyy = lyy;
|
|
9
|
+
}
|
|
10
|
+
fn(opt) {
|
|
11
|
+
return opt;
|
|
12
|
+
}
|
|
13
|
+
check(opt) {
|
|
14
|
+
opt = opt !== null && opt !== void 0 ? opt : {};
|
|
15
|
+
if (typeof opt === 'function') {
|
|
16
|
+
opt = opt();
|
|
17
|
+
}
|
|
18
|
+
return opt;
|
|
19
|
+
}
|
|
20
|
+
clone(opt) {
|
|
21
|
+
return (0, util_1.secureClone)(this.check(opt));
|
|
22
|
+
}
|
|
23
|
+
append(opt, appended) {
|
|
24
|
+
if (typeof appended === 'object' && !Array.isArray(appended)) {
|
|
25
|
+
let o = (opt !== null && opt !== void 0 ? opt : {});
|
|
26
|
+
for (const [k, v] of Object.entries(appended)) {
|
|
27
|
+
if (o[k] === undefined) {
|
|
28
|
+
o[k] = v;
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
o = this.add(o, k, v);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return o;
|
|
35
|
+
}
|
|
36
|
+
return opt;
|
|
37
|
+
}
|
|
38
|
+
add(opt, key, value) {
|
|
39
|
+
let o = this.check(opt);
|
|
40
|
+
if (value === undefined || typeof key !== 'string') {
|
|
41
|
+
return o;
|
|
42
|
+
}
|
|
43
|
+
if (key === 'field') {
|
|
44
|
+
return this.field(o, value);
|
|
45
|
+
}
|
|
46
|
+
if (o[key] === undefined) {
|
|
47
|
+
o[key] = value;
|
|
48
|
+
}
|
|
49
|
+
else if (o[key] instanceof Set) {
|
|
50
|
+
o[key].add(value);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
o[key] = new Set([o[key], value]);
|
|
54
|
+
}
|
|
55
|
+
return o;
|
|
56
|
+
}
|
|
57
|
+
field(opt, field) {
|
|
58
|
+
const o = this.check(opt);
|
|
59
|
+
const t = typeof field;
|
|
60
|
+
if (!['string', 'number'].includes(t)) {
|
|
61
|
+
return o;
|
|
62
|
+
}
|
|
63
|
+
if (o.field !== undefined) {
|
|
64
|
+
if (typeof o.field !== 'string') {
|
|
65
|
+
o.field = '';
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
o.field = '';
|
|
70
|
+
}
|
|
71
|
+
if (o.field === '') {
|
|
72
|
+
o.field = (t === 'string') ? field : `$.[${field}]`;
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
o.field += (t === 'string') ? `.${field}` : `[${field}]`;
|
|
76
|
+
}
|
|
77
|
+
return o;
|
|
78
|
+
}
|
|
79
|
+
// region secure
|
|
80
|
+
get $secure() {
|
|
81
|
+
return this;
|
|
82
|
+
}
|
|
83
|
+
get $back() {
|
|
84
|
+
return this;
|
|
85
|
+
}
|
|
86
|
+
$init() {
|
|
87
|
+
this.lyy.$secure.$lazyRun(() => {
|
|
88
|
+
this.lyy.event.emit('ly:fqn:register', 'class', internal_1.FQN, OptCommon);
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
exports.OptCommon = OptCommon;
|
|
93
|
+
//# sourceMappingURL=opt.common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"opt.common.js","sourceRoot":"","sources":["../../src/opt/opt.common.ts"],"names":[],"mappings":";;;AAAA,0CAAgC;AAGhC,kCAAoC;AAEpC,MAAa,SAAS;IAClB,YAAoB,GAAc;QAAd,QAAG,GAAH,GAAG,CAAW;IAClC,CAAC;IACD,EAAE,CAAsB,GAAU;QAC9B,OAAO,GAAQ,CAAC;IACpB,CAAC;IACD,KAAK,CAAsB,GAAmB;QAC1C,GAAG,GAAG,GAAG,aAAH,GAAG,cAAH,GAAG,GAAI,EAAO,CAAC;QACrB,IAAI,OAAO,GAAG,KAAK,UAAU,EAAE,CAAC;YAC5B,GAAG,GAAG,GAAG,EAAO,CAAC;QACrB,CAAC;QACD,OAAO,GAAQ,CAAC;IACpB,CAAC;IACD,KAAK,CAAsB,GAAmB;QAC1C,OAAO,IAAA,kBAAW,EAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAM,CAAC;IAC7C,CAAC;IACD,MAAM,CAAsB,GAAU,EAAE,QAAe;QACnD,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC3D,IAAI,CAAC,GAAG,CAAC,GAAG,a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QACnE,CAAC,CAAC,CAAC;IACP,CAAC;CAEJ;AA3FD,8BA2FC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { Dict, InitLike, ShiftMain, ShiftSecure } from "../shared";
|
|
2
|
-
import { List } from "../to";
|
|
3
2
|
/**
|
|
4
3
|
* Common Repository factory
|
|
5
4
|
*
|
|
@@ -23,23 +22,6 @@ export interface RepoCommonLike extends ShiftSecure<RepoCommonSecure> {
|
|
|
23
22
|
* If the array does not exist than it returns null
|
|
24
23
|
* */
|
|
25
24
|
getArray<V>(collection: symbol): Array<V>;
|
|
26
|
-
/**
|
|
27
|
-
* Creates new list with given collection
|
|
28
|
-
*
|
|
29
|
-
* @param {Array<string>} names
|
|
30
|
-
* @return {List<any>}
|
|
31
|
-
* */
|
|
32
|
-
newList<V>(...names: Array<string>): List<V>;
|
|
33
|
-
/**
|
|
34
|
-
* Returns a list by given collection
|
|
35
|
-
*
|
|
36
|
-
* @param {symbol} collection
|
|
37
|
-
* @return {List<any>}
|
|
38
|
-
*
|
|
39
|
-
* Note:
|
|
40
|
-
* If the list does not exist than it returns null
|
|
41
|
-
* */
|
|
42
|
-
getList<V>(collection: symbol): List<V>;
|
|
43
25
|
/**
|
|
44
26
|
* Creates new map with given collection
|
|
45
27
|
*
|
|
@@ -118,5 +100,5 @@ export type RepoItem = Dict<number>;
|
|
|
118
100
|
* Repo export dictionary which includes items
|
|
119
101
|
* */
|
|
120
102
|
export type RepoDetail = Record<RepoType, RepoItem>;
|
|
121
|
-
export type RepoType = 'array' | '
|
|
103
|
+
export type RepoType = 'array' | 'map' | 'set' | 'record';
|
|
122
104
|
export type RepoLengthLambda = (obj: unknown) => number;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { List } from "../to";
|
|
2
1
|
import type { RepoCommonLike, RepoCommonSecure, RepoDetail, RepoItem, RepoType } from "./index.types";
|
|
3
2
|
import type { LeyyoLike } from "../leyyo";
|
|
4
3
|
/** @inheritDoc */
|
|
5
4
|
export declare class RepoCommon implements RepoCommonLike, RepoCommonSecure {
|
|
6
5
|
private lyy;
|
|
7
|
-
private readonly _lists;
|
|
8
6
|
private readonly _arrays;
|
|
9
7
|
private readonly _maps;
|
|
10
8
|
private readonly _sets;
|
|
@@ -19,10 +17,6 @@ export declare class RepoCommon implements RepoCommonLike, RepoCommonSecure {
|
|
|
19
17
|
$init(): void;
|
|
20
18
|
private _addDetail;
|
|
21
19
|
/** @inheritDoc */
|
|
22
|
-
newList<V>(...names: Array<string>): List<V>;
|
|
23
|
-
/** @inheritDoc */
|
|
24
|
-
getList<V>(collection: symbol): List<V>;
|
|
25
|
-
/** @inheritDoc */
|
|
26
20
|
newArray<V>(...names: Array<string>): Array<V>;
|
|
27
21
|
/** @inheritDoc */
|
|
28
22
|
getArray<V>(collection: symbol): Array<V>;
|
package/dist/repo/repo.common.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RepoCommon = void 0;
|
|
4
|
-
const internal_1 = require("../internal");
|
|
5
|
-
const to_1 = require("../to");
|
|
6
4
|
// noinspection JSUnusedLocalSymbols,JSUnusedGlobalSymbols
|
|
7
5
|
/** @inheritDoc */
|
|
8
6
|
class RepoCommon {
|
|
@@ -14,7 +12,6 @@ class RepoCommon {
|
|
|
14
12
|
* */
|
|
15
13
|
constructor(lyy) {
|
|
16
14
|
this.lyy = lyy;
|
|
17
|
-
this._lists = new Map();
|
|
18
15
|
this._arrays = new Map();
|
|
19
16
|
this._maps = new Map();
|
|
20
17
|
this._sets = new Map();
|
|
@@ -22,7 +19,6 @@ class RepoCommon {
|
|
|
22
19
|
}
|
|
23
20
|
$init() {
|
|
24
21
|
this.lyy.$secure.$lazyRun(() => {
|
|
25
|
-
this.lyy.fqn.register(null, RepoCommon, 'class', internal_1.FQN);
|
|
26
22
|
});
|
|
27
23
|
}
|
|
28
24
|
_addDetail(map, result, collection, fn) {
|
|
@@ -54,18 +50,6 @@ class RepoCommon {
|
|
|
54
50
|
}
|
|
55
51
|
}
|
|
56
52
|
}
|
|
57
|
-
// region list
|
|
58
|
-
/** @inheritDoc */
|
|
59
|
-
newList(...names) {
|
|
60
|
-
const list = new to_1.List();
|
|
61
|
-
this._lists.set(Symbol.for(names.join('/')), list);
|
|
62
|
-
return list;
|
|
63
|
-
}
|
|
64
|
-
/** @inheritDoc */
|
|
65
|
-
getList(collection) {
|
|
66
|
-
return this._lists.get(collection);
|
|
67
|
-
}
|
|
68
|
-
// endregion list
|
|
69
53
|
// region array
|
|
70
54
|
/** @inheritDoc */
|
|
71
55
|
newArray(...names) {
|
|
@@ -122,9 +106,6 @@ class RepoCommon {
|
|
|
122
106
|
case "array":
|
|
123
107
|
this._addDetail(this._arrays, result, collection, (v) => v.length);
|
|
124
108
|
return result;
|
|
125
|
-
case "list":
|
|
126
|
-
this._addDetail(this._lists, result, collection, (v) => v.length);
|
|
127
|
-
return result;
|
|
128
109
|
case "map":
|
|
129
110
|
this._addDetail(this._maps, result, collection, (v) => v.size);
|
|
130
111
|
return result;
|
|
@@ -147,7 +128,6 @@ class RepoCommon {
|
|
|
147
128
|
}
|
|
148
129
|
else {
|
|
149
130
|
result['array'] = this.detailItem('array', collection);
|
|
150
|
-
result['list'] = this.detailItem('list', collection);
|
|
151
131
|
result['map'] = this.detailItem('map', collection);
|
|
152
132
|
result['set'] = this.detailItem('set', collection);
|
|
153
133
|
result['record'] = this.detailItem('record', collection);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repo.common.js","sourceRoot":"","sources":["../../src/repo/repo.common.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"repo.common.js","sourceRoot":"","sources":["../../src/repo/repo.common.ts"],"names":[],"mappings":";;;AAIA,0DAA0D;AAC1D,kBAAkB;AAClB,MAAa,UAAU;IAMnB;;;;;SAKK;IACL,YAAoB,GAAc;QAAd,QAAG,GAAH,GAAG,CAAW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.ts
CHANGED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { EnumAlt, EnumLiteral, EnumMap } from "./index.types";
|
|
2
|
+
export interface EnumCommonLike {
|
|
3
|
+
getEnum(name: string): [EnumMap, EnumAlt?];
|
|
4
|
+
getLiteral(name: string): [EnumLiteral, EnumAlt?];
|
|
5
|
+
getEnumAsync(name: string): Promise<[EnumMap, EnumAlt?]>;
|
|
6
|
+
getLiteralAsync(name: string): Promise<[EnumLiteral, EnumAlt?]>;
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.enum.js","sourceRoot":"","sources":["../../src/shared/index.enum.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.fqn.js","sourceRoot":"","sources":["../../src/shared/index.fqn.ts"],"names":[],"mappings":""}
|
package/dist/shared/index.js
CHANGED
|
@@ -15,4 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./index.types"), exports);
|
|
18
|
+
__exportStar(require("./index.json"), exports);
|
|
19
|
+
__exportStar(require("./index.enum"), exports);
|
|
20
|
+
__exportStar(require("./index.fqn"), exports);
|
|
18
21
|
//# sourceMappingURL=index.js.map
|
package/dist/shared/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,+CAA6B;AAC7B,+CAA6B;AAC7B,8CAA4B"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSON Object, record of `JsonValue`
|
|
3
|
+
*
|
|
4
|
+
* @see #JsonValue
|
|
5
|
+
*/
|
|
6
|
+
export type JsonObject = {
|
|
7
|
+
[K in string]?: JsonValue;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* JSON Array, array of `JsonValue`
|
|
11
|
+
*
|
|
12
|
+
* @see #JsonValue
|
|
13
|
+
*/
|
|
14
|
+
export type JsonArray = Array<JsonValue>;
|
|
15
|
+
/**
|
|
16
|
+
* JSON Primitive
|
|
17
|
+
*
|
|
18
|
+
* `OneOf`
|
|
19
|
+
* @see `string`
|
|
20
|
+
* @see `number`
|
|
21
|
+
* @see `boolean`
|
|
22
|
+
* @see `null`
|
|
23
|
+
*/
|
|
24
|
+
export type JsonPrimitive = string | number | boolean | null;
|
|
25
|
+
/**
|
|
26
|
+
* JSON Value
|
|
27
|
+
*
|
|
28
|
+
* `OneOf`
|
|
29
|
+
* @see #JsonPrimitive
|
|
30
|
+
* @see #JsonObject
|
|
31
|
+
* @see #JsonArray
|
|
32
|
+
*/
|
|
33
|
+
export type JsonValue = JsonPrimitive | JsonObject | JsonArray;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.json.js","sourceRoot":"","sources":["../../src/shared/index.json.ts"],"names":[],"mappings":""}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
export type HttpStatus = number;
|
|
2
2
|
export type BasicType = 'undefined' | 'string' | 'object' | 'number' | 'boolean' | 'function' | 'symbol' | 'bigint';
|
|
3
|
+
export type ExtendedType = BasicType | 'array' | 'class' | 'null' | 'empty' | 'nan' | 'integer' | 'date' | 'enum';
|
|
4
|
+
export type KeyValue = string | number;
|
|
5
|
+
export type AnyKey = string | number | symbol;
|
|
6
|
+
export type Obj = Object & {};
|
|
3
7
|
export type Dict<T = unknown> = Record<KeyValue, T>;
|
|
4
8
|
export type Arr<T = unknown> = Array<T>;
|
|
5
|
-
export type KeyValue = string | number;
|
|
6
9
|
export type Id = string | number;
|
|
7
|
-
export type Unknown = unknown;
|
|
8
10
|
export type Integer = number;
|
|
9
11
|
export type Float = number;
|
|
10
|
-
export type Boolean = boolean;
|
|
11
|
-
export type Enum = string;
|
|
12
12
|
export type Alpha = string;
|
|
13
|
-
export type
|
|
13
|
+
export type Text = string;
|
|
14
14
|
export type Digit = string;
|
|
15
15
|
export type Title = string;
|
|
16
16
|
export type Description = string;
|
|
@@ -24,75 +24,66 @@ export type Timestamp = number;
|
|
|
24
24
|
export type IsoDatetime = string;
|
|
25
25
|
export type IsoDate = string;
|
|
26
26
|
export type IsoTime = string;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
(...args:
|
|
27
|
+
export type Fnc<R = unknown> = ((...args: Arr) => R) & Function;
|
|
28
|
+
export type Async<R = unknown> = ((...args: Arr) => Promise<R>) & AsyncGeneratorFunction;
|
|
29
|
+
export interface Abstract<T = {}> extends Function {
|
|
30
|
+
prototype: T;
|
|
31
|
+
readonly name: string;
|
|
32
|
+
readonly length: number;
|
|
33
|
+
bind(thisArg: unknown, ...args: Arr): unknown;
|
|
34
|
+
apply(thisArg: unknown, args: Arr): unknown;
|
|
35
|
+
call(thisArg: unknown, ...args: Arr): unknown;
|
|
36
36
|
}
|
|
37
|
-
interface
|
|
38
|
-
(...args:
|
|
37
|
+
export interface ClassLike<T = {}> extends Abstract<T> {
|
|
38
|
+
new (...args: Arr): T;
|
|
39
39
|
}
|
|
40
|
-
export type Fnc<R = unknown> = _SyncFnc<R> & Function;
|
|
41
|
-
export type Async<R = unknown> = _AsyncFnc<R> & AsyncGeneratorFunction;
|
|
42
|
-
export type AnyFnc<R = unknown> = Fnc<R> | Async<R>;
|
|
43
|
-
export type _Type<T> = {
|
|
44
|
-
new (...args: Array<unknown>): T;
|
|
45
|
-
prototype?: unknown;
|
|
46
|
-
};
|
|
47
|
-
export type ClassLike<T = {}> = (_BaseFunc & _Type<T>) | _SyncFnc<T>;
|
|
48
40
|
export type TypeOf<C = ClassLike> = C extends ClassLike<infer T> ? T : C;
|
|
41
|
+
export declare namespace Express {
|
|
42
|
+
interface Request {
|
|
43
|
+
custom?: Dict;
|
|
44
|
+
}
|
|
45
|
+
interface Response {
|
|
46
|
+
custom?: Dict;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
49
|
export interface Describable {
|
|
50
50
|
description: string;
|
|
51
51
|
}
|
|
52
52
|
export interface Nameable {
|
|
53
53
|
name: string;
|
|
54
54
|
}
|
|
55
|
-
export
|
|
56
|
-
|
|
57
|
-
export type ClassOrFuncOrName = ClassLike | Function | string;
|
|
58
|
-
/**
|
|
59
|
-
* Referenced from Object
|
|
60
|
-
* */
|
|
61
|
-
export type Obj = Object & {};
|
|
62
|
-
export interface Abstract<T> extends Function {
|
|
63
|
-
prototype: T;
|
|
64
|
-
}
|
|
65
|
-
export interface Entity<I extends Id = Uuid> {
|
|
66
|
-
id?: I;
|
|
67
|
-
}
|
|
68
|
-
export interface Pair<I extends Id = Uuid> extends Entity<I> {
|
|
69
|
-
name?: string;
|
|
55
|
+
export interface HasId {
|
|
56
|
+
id?: string | number;
|
|
70
57
|
}
|
|
71
58
|
export type TypeOfMethod<T, M extends keyof T> = T[M] extends Function ? T[M] : never;
|
|
59
|
+
export type TypeOfFnc<F extends Fnc> = F extends (...args: Arr) => infer R ? R : never;
|
|
60
|
+
export type TypeOfAsync<F extends Async> = TypeOfPromise<TypeOfFnc<F>>;
|
|
61
|
+
export type TypeOfPromise<P> = P extends Promise<infer R> ? R : P;
|
|
62
|
+
/**
|
|
63
|
+
* String keys of a interface
|
|
64
|
+
* - Note: keyof keywords returns string|number|symbol, but it's ignore nuöber and symbol keys
|
|
65
|
+
* */
|
|
66
|
+
export type StrKey<T> = Extract<keyof T, string>;
|
|
67
|
+
/**
|
|
68
|
+
* Serialized version of another type
|
|
69
|
+
*/
|
|
70
|
+
export type Serialized<T> = {
|
|
71
|
+
[P in keyof T]: T[P];
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Makes mutable an interface
|
|
75
|
+
*
|
|
76
|
+
* @see Readonly
|
|
77
|
+
* */
|
|
78
|
+
export type Mutable<A> = {
|
|
79
|
+
-readonly [K in keyof A]: A[K];
|
|
80
|
+
};
|
|
72
81
|
export type KeyOf<T> = keyof T;
|
|
73
82
|
export type Keys<T> = Array<keyof T>;
|
|
74
83
|
export type ValueOf<T> = T[KeyOf<T>];
|
|
75
84
|
export type Values<T> = Array<T[KeyOf<T>]>;
|
|
76
|
-
export type MaximumOneOf<T, K extends keyof T = keyof T> = K extends keyof T ? {
|
|
77
|
-
[P in K]: T[K];
|
|
78
|
-
} & Partial<Record<Exclude<keyof T, K>, never>> : never;
|
|
79
|
-
export type OneOf<Obj> = ValueOf<OneOfByKey<Obj>>;
|
|
80
|
-
export type Xor<A, B> = XorIn<A & {
|
|
81
|
-
[K in keyof B]?: undefined;
|
|
82
|
-
}> | XorIn<B & {
|
|
83
|
-
[K in keyof A]?: undefined;
|
|
84
|
-
}>;
|
|
85
85
|
export type OneOrMore<T> = T | Array<T>;
|
|
86
|
-
export type
|
|
87
|
-
export type ValueCallback<T> = () => T;
|
|
88
|
-
export type ValueCallbackAsync<T> = () => Promise<T>;
|
|
89
|
-
type OneOnly<T, K extends keyof T> = Omit<T, Exclude<keyof T, K>> | Pick<T, K>;
|
|
90
|
-
type OneOfByKey<T> = {
|
|
91
|
-
[key in keyof T]: OneOnly<T, key>;
|
|
92
|
-
};
|
|
93
|
-
type XorIn<T> = {
|
|
94
|
-
[K in keyof T]: T[K];
|
|
95
|
-
} & unknown;
|
|
86
|
+
export type SetOrMore<T> = T | Set<T>;
|
|
96
87
|
/**
|
|
97
88
|
* An interface which contains secure mode members and provides to shift to main mode
|
|
98
89
|
* */
|
|
@@ -133,42 +124,11 @@ export interface InitLike {
|
|
|
133
124
|
* */
|
|
134
125
|
$init(...args: Arr): void;
|
|
135
126
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
*/
|
|
139
|
-
export type JsonObject = {
|
|
140
|
-
[K in string]?: JsonValue;
|
|
127
|
+
export type EnumMap<E extends KeyValue = KeyValue> = {
|
|
128
|
+
[K in E]: KeyValue;
|
|
141
129
|
};
|
|
142
|
-
/**
|
|
143
|
-
* JSON Array
|
|
144
|
-
*/
|
|
145
|
-
export type JsonArray = Array<JsonValue>;
|
|
146
|
-
/**
|
|
147
|
-
* JSON Primitives
|
|
148
|
-
*/
|
|
149
|
-
export type JsonPrimitive = string | number | boolean | null;
|
|
150
|
-
/**
|
|
151
|
-
* JSON Values
|
|
152
|
-
*/
|
|
153
|
-
export type JsonValue = JsonPrimitive | JsonObject | JsonArray;
|
|
154
|
-
/**
|
|
155
|
-
* Primitive language key
|
|
156
|
-
*
|
|
157
|
-
* It can be language (xx), local (xx-xx) or string (not preferred)
|
|
158
|
-
* */
|
|
159
|
-
export type I18nKey = LanguageCode | LocaleCode | string;
|
|
160
|
-
/**
|
|
161
|
-
* Language map
|
|
162
|
-
*
|
|
163
|
-
* @example
|
|
164
|
-
* const name = {en: "Apple", tr: "Elma"};
|
|
165
|
-
*
|
|
166
|
-
* */
|
|
167
|
-
export type I18nRaw<V = unknown> = Dict<V>;
|
|
168
|
-
export type I18nAny<V = unknown> = I18nRaw<V> | V;
|
|
169
|
-
export type EnumMap<E extends KeyValue = KeyValue> = Dict<E>;
|
|
170
130
|
export type EnumAlt<E extends KeyValue = KeyValue> = Dict<E>;
|
|
171
|
-
export type EnumLiteral<E extends KeyValue = KeyValue> = Array<E> |
|
|
131
|
+
export type EnumLiteral<E extends KeyValue = KeyValue> = Array<E> | ReadonlyArray<E>;
|
|
172
132
|
export type IgnoreFieldsByType<T, I> = {
|
|
173
133
|
[K in keyof T]: T[K] extends I ? K : never;
|
|
174
134
|
}[keyof T];
|
|
@@ -178,13 +138,31 @@ export type ReplaceType<T, O, N> = {
|
|
|
178
138
|
export type SameType<A, T> = {
|
|
179
139
|
[K in keyof A]: T;
|
|
180
140
|
};
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
*/
|
|
184
|
-
export type Serialized<T> = {
|
|
185
|
-
[P in keyof T]: T[P];
|
|
141
|
+
export type PickByType<T, I> = {
|
|
142
|
+
[K in keyof T]: T[K] extends I ? K : never;
|
|
186
143
|
};
|
|
187
|
-
export type
|
|
188
|
-
|
|
144
|
+
export type PickKeyByType<T, I> = PickByType<T, I>[keyof T];
|
|
145
|
+
export type OmitByType<T, I> = {
|
|
146
|
+
[K in keyof T]: T[K] extends I ? never : K;
|
|
147
|
+
};
|
|
148
|
+
export type OmitKeysByType<T, I> = OmitByType<T, I>[keyof T];
|
|
149
|
+
export type ValueOrCallback<T> = T | ValueCallback<T> | ValueCallbackAsync<T>;
|
|
150
|
+
export type ValueCallback<T> = () => T;
|
|
151
|
+
export type ValueCallbackAsync<T> = () => Promise<T>;
|
|
152
|
+
export type MaximumOneOf<T, K extends keyof T = keyof T> = K extends keyof T ? {
|
|
153
|
+
[P in K]: T[K];
|
|
154
|
+
} & Partial<Record<Exclude<keyof T, K>, never>> : never;
|
|
155
|
+
export type OneOf<Obj> = ValueOf<OneOfByKey<Obj>>;
|
|
156
|
+
export type Xor<A, B> = XorIn<A & {
|
|
157
|
+
[K in keyof B]?: undefined;
|
|
158
|
+
}> | XorIn<B & {
|
|
159
|
+
[K in keyof A]?: undefined;
|
|
160
|
+
}>;
|
|
161
|
+
type OneOnly<T, K extends keyof T> = Omit<T, Exclude<keyof T, K>> | Pick<T, K>;
|
|
162
|
+
type OneOfByKey<T> = {
|
|
163
|
+
[key in keyof T]: OneOnly<T, key>;
|
|
189
164
|
};
|
|
165
|
+
type XorIn<T> = {
|
|
166
|
+
[K in keyof T]: T[K];
|
|
167
|
+
} & unknown;
|
|
190
168
|
export {};
|