@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.
@@ -93,26 +93,28 @@ const constantInfo = {
93
93
  return constantInfo.getDatabase(refName)[modelType];
94
94
  }
95
95
  };
96
- const cnstOf = (refName, Input, Full, Light, Insight, option = {}) => {
97
- [Input, Full, Light, Insight].forEach((modelRef) => {
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(Input, "input");
101
- constantInfo.setModelType(Full, "full");
102
- constantInfo.setModelType(Light, "light");
103
- constantInfo.setModelType(Insight, "insight");
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: Input,
107
- full: Full,
108
- light: Light,
109
- insight: Insight,
110
- crystalize: (0, import__.makeCrystalize)(Full, option),
111
- lightCrystalize: (0, import__.makeCrystalize)(Light, option),
112
- crystalizeInsight: (0, import__.makeCrystalize)(Insight, option),
113
- purify: (0, import__.makePurify)(Input, option),
114
- getDefault: () => (0, import_immerify.immerify)(Full, Object.assign(new Full(), (0, import__.makeDefault)(Full, option))),
115
- getDefaultInsight: () => (0, import_immerify.immerify)(Insight, Object.assign(new Insight(), (0, import__.makeDefault)(Insight, option))),
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,
@@ -69,26 +69,28 @@ const constantInfo = {
69
69
  return constantInfo.getDatabase(refName)[modelType];
70
70
  }
71
71
  };
72
- const cnstOf = (refName, Input, Full, Light, Insight, option = {}) => {
73
- [Input, Full, Light, Insight].forEach((modelRef) => {
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(Input, "input");
77
- constantInfo.setModelType(Full, "full");
78
- constantInfo.setModelType(Light, "light");
79
- constantInfo.setModelType(Insight, "insight");
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: Input,
83
- full: Full,
84
- light: Light,
85
- insight: Insight,
86
- crystalize: makeCrystalize(Full, option),
87
- lightCrystalize: makeCrystalize(Light, option),
88
- crystalizeInsight: makeCrystalize(Insight, option),
89
- purify: makePurify(Input, option),
90
- getDefault: () => immerify(Full, Object.assign(new Full(), makeDefault(Full, option))),
91
- getDefaultInsight: () => immerify(Insight, Object.assign(new Insight(), makeDefault(Insight, option))),
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akanjs/constant",
3
- "version": "0.9.58-canary.0",
3
+ "version": "0.9.58-canary.2",
4
4
  "sourceType": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -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<any, any, any, any, any, any, DefaultOf<any>, DefaultOf<any>, GetStateObject<any>, GetStateObject<any>, DefaultOf<any>, any, any, any, QueryOf<any>>>;
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<any, any, any, any, any, any>): void;
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<any, any, any, any, any, any> | undefined : ConstantModel<any, any, any, any, any, any>;
27
- setScalar(refName: string, cnst: ScalarConstantModel<any, any, any, any, any>): void;
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<any, any, any, any, any> | undefined : ScalarConstantModel<any, any, any, any, any>;
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, Input: Type<Input>, Full: Type<Full>, Light: Type<Light>, Insight: Type<Insight>, option?: {
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>;