@akanjs/constant 0.9.58-canary.0 → 0.9.58-canary.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/cjs/src/constantInfo.js +18 -16
- package/esm/src/constantInfo.js +18 -16
- package/package.json +1 -1
- package/src/constantInfo.d.ts +10 -9
package/cjs/src/constantInfo.js
CHANGED
|
@@ -93,26 +93,28 @@ const constantInfo = {
|
|
|
93
93
|
return constantInfo.getDatabase(refName)[modelType];
|
|
94
94
|
}
|
|
95
95
|
};
|
|
96
|
-
const cnstOf = (refName,
|
|
97
|
-
[
|
|
96
|
+
const cnstOf = (refName, inputRef, objectRef, fullRef, lightRef, insightRef, option = {}) => {
|
|
97
|
+
[inputRef, objectRef, fullRef, lightRef, insightRef].forEach((modelRef) => {
|
|
98
98
|
constantInfo.modelRefNameMap.set(modelRef, refName);
|
|
99
99
|
});
|
|
100
|
-
constantInfo.setModelType(
|
|
101
|
-
constantInfo.setModelType(
|
|
102
|
-
constantInfo.setModelType(
|
|
103
|
-
constantInfo.setModelType(
|
|
100
|
+
constantInfo.setModelType(inputRef, "input");
|
|
101
|
+
constantInfo.setModelType(objectRef, "object");
|
|
102
|
+
constantInfo.setModelType(fullRef, "full");
|
|
103
|
+
constantInfo.setModelType(lightRef, "light");
|
|
104
|
+
constantInfo.setModelType(insightRef, "insight");
|
|
104
105
|
const cnst = {
|
|
105
106
|
refName,
|
|
106
|
-
input:
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
107
|
+
input: inputRef,
|
|
108
|
+
object: objectRef,
|
|
109
|
+
full: fullRef,
|
|
110
|
+
light: lightRef,
|
|
111
|
+
insight: insightRef,
|
|
112
|
+
crystalize: (0, import__.makeCrystalize)(fullRef, option),
|
|
113
|
+
lightCrystalize: (0, import__.makeCrystalize)(lightRef, option),
|
|
114
|
+
crystalizeInsight: (0, import__.makeCrystalize)(insightRef, option),
|
|
115
|
+
purify: (0, import__.makePurify)(inputRef, option),
|
|
116
|
+
getDefault: () => (0, import_immerify.immerify)(fullRef, Object.assign(new fullRef(), (0, import__.makeDefault)(fullRef, option))),
|
|
117
|
+
getDefaultInsight: () => (0, import_immerify.immerify)(insightRef, Object.assign(new insightRef(), (0, import__.makeDefault)(insightRef, option))),
|
|
116
118
|
_CapitalizedT: null,
|
|
117
119
|
_Default: null,
|
|
118
120
|
_DefaultInput: null,
|
package/esm/src/constantInfo.js
CHANGED
|
@@ -69,26 +69,28 @@ const constantInfo = {
|
|
|
69
69
|
return constantInfo.getDatabase(refName)[modelType];
|
|
70
70
|
}
|
|
71
71
|
};
|
|
72
|
-
const cnstOf = (refName,
|
|
73
|
-
[
|
|
72
|
+
const cnstOf = (refName, inputRef, objectRef, fullRef, lightRef, insightRef, option = {}) => {
|
|
73
|
+
[inputRef, objectRef, fullRef, lightRef, insightRef].forEach((modelRef) => {
|
|
74
74
|
constantInfo.modelRefNameMap.set(modelRef, refName);
|
|
75
75
|
});
|
|
76
|
-
constantInfo.setModelType(
|
|
77
|
-
constantInfo.setModelType(
|
|
78
|
-
constantInfo.setModelType(
|
|
79
|
-
constantInfo.setModelType(
|
|
76
|
+
constantInfo.setModelType(inputRef, "input");
|
|
77
|
+
constantInfo.setModelType(objectRef, "object");
|
|
78
|
+
constantInfo.setModelType(fullRef, "full");
|
|
79
|
+
constantInfo.setModelType(lightRef, "light");
|
|
80
|
+
constantInfo.setModelType(insightRef, "insight");
|
|
80
81
|
const cnst = {
|
|
81
82
|
refName,
|
|
82
|
-
input:
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
83
|
+
input: inputRef,
|
|
84
|
+
object: objectRef,
|
|
85
|
+
full: fullRef,
|
|
86
|
+
light: lightRef,
|
|
87
|
+
insight: insightRef,
|
|
88
|
+
crystalize: makeCrystalize(fullRef, option),
|
|
89
|
+
lightCrystalize: makeCrystalize(lightRef, option),
|
|
90
|
+
crystalizeInsight: makeCrystalize(insightRef, option),
|
|
91
|
+
purify: makePurify(inputRef, option),
|
|
92
|
+
getDefault: () => immerify(fullRef, Object.assign(new fullRef(), makeDefault(fullRef, option))),
|
|
93
|
+
getDefaultInsight: () => immerify(insightRef, Object.assign(new insightRef(), makeDefault(insightRef, option))),
|
|
92
94
|
_CapitalizedT: null,
|
|
93
95
|
_Default: null,
|
|
94
96
|
_DefaultInput: null,
|
package/package.json
CHANGED
package/src/constantInfo.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { CrystalizeFunc, PurifiedModel, PurifyFunc } from ".";
|
|
|
4
4
|
import type { DefaultOf, DocumentModel, QueryOf } from "./types";
|
|
5
5
|
export type ModelType = "input" | "object" | "full" | "light" | "insight" | "filter" | "scalar";
|
|
6
6
|
export declare const constantInfo: {
|
|
7
|
-
database: Map<string, ConstantModel<
|
|
7
|
+
database: Map<string, ConstantModel<string, any, any, any, any, any, Capitalize<string>, DefaultOf<any>, DefaultOf<any>, GetStateObject<any>, GetStateObject<any>, DefaultOf<any>, any, any, any, QueryOf<any>>>;
|
|
8
8
|
scalar: Map<string, ScalarConstantModel<any, any, any, any, any>>;
|
|
9
9
|
modelRefNameMap: Map<new (...args: any[]) => any, string>;
|
|
10
10
|
getRefName<AllowEmpty extends boolean = false>(modelRef: Type, { allowEmpty }?: {
|
|
@@ -20,19 +20,20 @@ export declare const constantInfo: {
|
|
|
20
20
|
isInsight(modelRef: Type): boolean;
|
|
21
21
|
isFilter(modelRef: Type): boolean;
|
|
22
22
|
isScalar(modelRef: Type): boolean;
|
|
23
|
-
setDatabase(refName: string, cnst: ConstantModel<
|
|
23
|
+
setDatabase(refName: string, cnst: ConstantModel<string, any, any, any, any, any>): void;
|
|
24
24
|
getDatabase<AllowEmpty extends boolean = false>(refName: string, { allowEmpty }?: {
|
|
25
25
|
allowEmpty?: AllowEmpty;
|
|
26
|
-
}): AllowEmpty extends true ? ConstantModel<
|
|
27
|
-
setScalar(refName: string, cnst: ScalarConstantModel<
|
|
26
|
+
}): AllowEmpty extends true ? ConstantModel<string, any, any, any, any, any> | undefined : ConstantModel<string, any, any, any, any, any>;
|
|
27
|
+
setScalar(refName: string, cnst: ScalarConstantModel<string, any, any, any, any>): void;
|
|
28
28
|
getScalar<AllowEmpty extends boolean = false>(refName: string, { allowEmpty }?: {
|
|
29
29
|
allowEmpty?: AllowEmpty;
|
|
30
|
-
}): AllowEmpty extends true ? ScalarConstantModel<
|
|
31
|
-
getModelRef(refName: string, modelType: "input" | "full" | "light" | "insight" | "scalar"): Type | GqlScalar;
|
|
30
|
+
}): AllowEmpty extends true ? ScalarConstantModel<string, any, any, any, any> | undefined : ScalarConstantModel<string, any, any, any, any>;
|
|
31
|
+
getModelRef(refName: string, modelType: "input" | "object" | "full" | "light" | "insight" | "scalar"): Type | GqlScalar;
|
|
32
32
|
};
|
|
33
|
-
export interface ConstantModel<T extends string, Input, Full, Light, Insight, _CapitalizedT extends string = Capitalize<T>, _Default = DefaultOf<Full>, _DefaultInput = DefaultOf<Input>, _DefaultState = GetStateObject<Full>, _DefaultStateInput = GetStateObject<Input>, _DefaultInsight = DefaultOf<Insight>, _PurifiedInput = PurifiedModel<Input>, _Doc = DocumentModel<Full>, _DocInput = DocumentModel<Input>, _QueryOfDoc = QueryOf<_Doc>> {
|
|
33
|
+
export interface ConstantModel<T extends string, Input, Obj, Full, Light, Insight, _CapitalizedT extends string = Capitalize<T>, _Default = DefaultOf<Full>, _DefaultInput = DefaultOf<Input>, _DefaultState = GetStateObject<Full>, _DefaultStateInput = GetStateObject<Input>, _DefaultInsight = DefaultOf<Insight>, _PurifiedInput = PurifiedModel<Input>, _Doc = DocumentModel<Full>, _DocInput = DocumentModel<Input>, _QueryOfDoc = QueryOf<_Doc>> {
|
|
34
34
|
refName: T;
|
|
35
35
|
input: Type<Input>;
|
|
36
|
+
object: Type<Obj>;
|
|
36
37
|
full: Type<Full>;
|
|
37
38
|
light: Type<Light>;
|
|
38
39
|
insight: Type<Insight>;
|
|
@@ -53,9 +54,9 @@ export interface ConstantModel<T extends string, Input, Full, Light, Insight, _C
|
|
|
53
54
|
_DocInput: _DocInput;
|
|
54
55
|
_QueryOfDoc: _QueryOfDoc;
|
|
55
56
|
}
|
|
56
|
-
export declare const cnstOf: <T extends string, Input, Full, Light, Insight>(refName: T,
|
|
57
|
+
export declare const cnstOf: <T extends string, Input, Obj, Full, Light, Insight>(refName: T, inputRef: Type<Input>, objectRef: Type<Obj>, fullRef: Type<Full>, lightRef: Type<Light>, insightRef: Type<Insight>, option?: {
|
|
57
58
|
overwrite?: any;
|
|
58
|
-
}) => ConstantModel<T, Input, Full, Light, Insight, Capitalize<T>, DefaultOf<Full>, DefaultOf<Input>, GetStateObject<Full>, GetStateObject<Input>, DefaultOf<Insight>, PurifiedModel<Input>, DocumentModel<Full>, DocumentModel<Input>, QueryOf<DocumentModel<Full>>>;
|
|
59
|
+
}) => ConstantModel<T, Input, Obj, Full, Light, Insight, Capitalize<T>, DefaultOf<Full>, DefaultOf<Input>, GetStateObject<Full>, GetStateObject<Input>, DefaultOf<Insight>, PurifiedModel<Input>, DocumentModel<Full>, DocumentModel<Input>, QueryOf<DocumentModel<Full>>>;
|
|
59
60
|
export interface ScalarConstantModel<T extends string, Model, _Default = DefaultOf<Model>, _Doc = DocumentModel<Model>, _PurifiedInput = PurifiedModel<Model>> {
|
|
60
61
|
refName: T;
|
|
61
62
|
model: Type<Model>;
|