akanjs 2.3.5-rc.8 → 2.3.5
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/base/base.ts +6 -2
- package/base/primitiveRegistry.ts +50 -46
- package/base/symbols.ts +16 -11
- package/base/types.ts +12 -0
- package/constant/constantRegistry.ts +10 -9
- package/constant/deserialize.ts +7 -7
- package/constant/fieldInfo.ts +173 -31
- package/constant/getDefault.ts +2 -2
- package/constant/immerify.ts +2 -2
- package/constant/purify.ts +19 -4
- package/constant/serialize.ts +6 -5
- package/constant/types.ts +9 -1
- package/constant/via.ts +312 -57
- package/dictionary/dictInfo.ts +28 -38
- package/dictionary/locale.ts +36 -38
- package/document/by.ts +84 -21
- package/document/database.ts +53 -18
- package/document/databaseRegistry.ts +7 -3
- package/document/filterMeta.ts +26 -14
- package/document/into.ts +71 -76
- package/document/types.ts +4 -2
- package/fetch/fetchType/endpointFetch.type.ts +6 -3
- package/fetch/fetchType/sliceFetch.type.ts +24 -13
- package/package.json +1 -1
- package/service/predefinedAdaptor/compress.adaptor.ts +9 -9
- package/service/predefinedAdaptor/database.adaptor.ts +3 -7
- package/service/serve.ts +17 -52
- package/service/types.ts +61 -21
- package/signal/endpoint.ts +2 -1
- package/signal/endpointInfo.ts +53 -23
- package/signal/internal.ts +2 -1
- package/signal/internalInfo.ts +71 -23
- package/signal/serverSignal.ts +23 -57
- package/signal/slice.ts +35 -35
- package/signal/sliceInfo.ts +63 -47
- package/signal/types.ts +23 -17
- package/store/action.ts +57 -44
- package/store/state.ts +47 -36
- package/store/stateBuilder.ts +3 -3
- package/store/store.ts +61 -15
- package/store/types.ts +16 -6
- package/types/base/base.d.ts +5 -1
- package/types/base/primitiveRegistry.d.ts +43 -38
- package/types/base/symbols.d.ts +5 -0
- package/types/base/types.d.ts +1 -0
- package/types/constant/constantRegistry.d.ts +3 -8
- package/types/constant/deserialize.d.ts +2 -2
- package/types/constant/fieldInfo.d.ts +41 -20
- package/types/constant/immerify.d.ts +2 -2
- package/types/constant/purify.d.ts +3 -2
- package/types/constant/serialize.d.ts +2 -2
- package/types/constant/types.d.ts +6 -1
- package/types/constant/via.d.ts +143 -22
- package/types/dictionary/dictInfo.d.ts +18 -11
- package/types/dictionary/locale.d.ts +23 -16
- package/types/document/by.d.ts +44 -7
- package/types/document/database.d.ts +9 -7
- package/types/document/databaseRegistry.d.ts +5 -4
- package/types/document/filterMeta.d.ts +18 -11
- package/types/document/into.d.ts +46 -19
- package/types/document/types.d.ts +3 -2
- package/types/fetch/fetchType/endpointFetch.type.d.ts +2 -2
- package/types/fetch/fetchType/sliceFetch.type.d.ts +11 -11
- package/types/service/serve.d.ts +4 -5
- package/types/service/serviceModule.d.ts +5 -5
- package/types/service/types.d.ts +23 -5
- package/types/signal/endpoint.d.ts +2 -1
- package/types/signal/endpointInfo.d.ts +40 -15
- package/types/signal/internal.d.ts +2 -1
- package/types/signal/internalInfo.d.ts +46 -12
- package/types/signal/serverSignal.d.ts +15 -12
- package/types/signal/slice.d.ts +8 -6
- package/types/signal/sliceInfo.d.ts +41 -20
- package/types/signal/types.d.ts +23 -17
- package/types/store/action.d.ts +25 -22
- package/types/store/baseSt.d.ts +42 -13
- package/types/store/state.d.ts +23 -26
- package/types/store/stateBuilder.d.ts +2 -2
- package/types/store/store.d.ts +17 -5
- package/types/store/types.d.ts +9 -3
- package/ui/Signal/makeExample.ts +3 -3
package/types/store/baseSt.d.ts
CHANGED
|
@@ -62,7 +62,7 @@ declare const BaseStore_base: import("./store.d.ts").StoreCls<"base", import("./
|
|
|
62
62
|
devMode: boolean;
|
|
63
63
|
deviceToken: string;
|
|
64
64
|
currentPath: string;
|
|
65
|
-
}>, any, any, any, any, any,
|
|
65
|
+
}>, any, any, any, any, any, any, any, any>;
|
|
66
66
|
export declare class BaseStore extends BaseStore_base {
|
|
67
67
|
setDevMode(value: boolean): void;
|
|
68
68
|
setWindowSize(): void;
|
|
@@ -98,7 +98,36 @@ declare const RootStore_base: import("./rootStore.d.ts").RootStoreCls<"root", im
|
|
|
98
98
|
deviceToken: string;
|
|
99
99
|
currentPath: string;
|
|
100
100
|
}>, Omit<BaseStore, "slice" | keyof import("./types.d.ts").SetGet<any>>, {
|
|
101
|
-
[x: `base${Capitalize<string>}`]:
|
|
101
|
+
[x: `base${Capitalize<string>}`]: {
|
|
102
|
+
[x: `init${any}`]: (...args: any[]) => Promise<void>;
|
|
103
|
+
} & {
|
|
104
|
+
[x: `refresh${any}`]: (initForm?: (import("akanjs/fetch").FetchInitForm<any, any, import("../base.d.ts").GetStateObject<{
|
|
105
|
+
[x: string]: any;
|
|
106
|
+
}>, any> & import("../common.d.ts").FetchPolicy<unknown> & {
|
|
107
|
+
queryArgs?: any[] | undefined;
|
|
108
|
+
}) | undefined) => Promise<void>;
|
|
109
|
+
} & {
|
|
110
|
+
[x: `select${any}`]: (model: any, options?: {
|
|
111
|
+
refresh?: boolean;
|
|
112
|
+
remove?: boolean;
|
|
113
|
+
}) => void;
|
|
114
|
+
} & {
|
|
115
|
+
[x: `setPageOf${any}`]: (page: number, options?: import("../common.d.ts").FetchPolicy) => Promise<void>;
|
|
116
|
+
} & {
|
|
117
|
+
[x: `addPageOf${any}`]: (page: number, options?: import("../common.d.ts").FetchPolicy) => Promise<void>;
|
|
118
|
+
} & {
|
|
119
|
+
[x: `setLimitOf${any}`]: (limit: number, options?: import("../common.d.ts").FetchPolicy) => Promise<void>;
|
|
120
|
+
} & {
|
|
121
|
+
[x: `setQueryArgsOf${any}`]: (...args: any[] | [setQueryArgs: (...prevQueryArgs: any[]) => any[], options?: import("../common.d.ts").FetchPolicy<unknown> | undefined]) => Promise<void>;
|
|
122
|
+
} & {
|
|
123
|
+
[x: `setSortOf${any}`]: (sort: any, options?: import("../common.d.ts").FetchPolicy) => Promise<void>;
|
|
124
|
+
} & {
|
|
125
|
+
refName: "base";
|
|
126
|
+
suffix: string;
|
|
127
|
+
sliceName: `base${Capitalize<string>}`;
|
|
128
|
+
get: () => import("./state.d.ts").SliceState<"base", "", any, any, any[], any, any, any, "", any, any>;
|
|
129
|
+
set: (setState: Partial<import("./state.d.ts").SliceState<"base", "", any, any, any[], any, any, any, "", any, any>> | ((state: import("./state.d.ts").SliceState<"base", "", any, any, any[], any, any, any, "", any, any>) => void)) => void;
|
|
130
|
+
};
|
|
102
131
|
}, any>;
|
|
103
132
|
export declare class RootStore extends RootStore_base {
|
|
104
133
|
}
|
|
@@ -377,35 +406,35 @@ export declare const st: {
|
|
|
377
406
|
currentPath: string;
|
|
378
407
|
}>) => any)) => void;
|
|
379
408
|
slice: {
|
|
380
|
-
[x: `base${Capitalize<string>}`]: import("./withSelector.d.ts").SliceSelectors<"base", import("./state.d.ts").SliceState<"base", "", any, any, any[], any, any,
|
|
381
|
-
|
|
409
|
+
[x: `base${Capitalize<string>}`]: import("./withSelector.d.ts").SliceSelectors<"base", import("./state.d.ts").SliceState<"base", "", any, any, any[], any, any, any, "", any, any>, {
|
|
410
|
+
[x: `init${any}`]: (...args: any[]) => Promise<void>;
|
|
382
411
|
} & {
|
|
383
|
-
|
|
412
|
+
[x: `refresh${any}`]: (initForm?: (import("akanjs/fetch").FetchInitForm<any, any, import("../base.d.ts").GetStateObject<{
|
|
384
413
|
[x: string]: any;
|
|
385
414
|
}>, any> & import("../common.d.ts").FetchPolicy<unknown> & {
|
|
386
415
|
queryArgs?: any[] | undefined;
|
|
387
416
|
}) | undefined) => Promise<void>;
|
|
388
417
|
} & {
|
|
389
|
-
|
|
418
|
+
[x: `select${any}`]: (model: any, options?: {
|
|
390
419
|
refresh?: boolean;
|
|
391
420
|
remove?: boolean;
|
|
392
421
|
}) => void;
|
|
393
422
|
} & {
|
|
394
|
-
|
|
423
|
+
[x: `setPageOf${any}`]: (page: number, options?: import("../common.d.ts").FetchPolicy) => Promise<void>;
|
|
395
424
|
} & {
|
|
396
|
-
|
|
425
|
+
[x: `addPageOf${any}`]: (page: number, options?: import("../common.d.ts").FetchPolicy) => Promise<void>;
|
|
397
426
|
} & {
|
|
398
|
-
|
|
427
|
+
[x: `setLimitOf${any}`]: (limit: number, options?: import("../common.d.ts").FetchPolicy) => Promise<void>;
|
|
399
428
|
} & {
|
|
400
|
-
|
|
429
|
+
[x: `setQueryArgsOf${any}`]: (...args: any[] | [setQueryArgs: (...prevQueryArgs: any[]) => any[], options?: import("../common.d.ts").FetchPolicy<unknown> | undefined]) => Promise<void>;
|
|
401
430
|
} & {
|
|
402
|
-
|
|
431
|
+
[x: `setSortOf${any}`]: (sort: any, options?: import("../common.d.ts").FetchPolicy) => Promise<void>;
|
|
403
432
|
} & {
|
|
404
433
|
refName: "base";
|
|
405
434
|
suffix: string;
|
|
406
435
|
sliceName: `base${Capitalize<string>}`;
|
|
407
|
-
get: () => import("./state.d.ts").SliceState<"base", "", any, any, any[], any, any,
|
|
408
|
-
set: (setState: Partial<import("./state.d.ts").SliceState<"base", "", any, any, any[], any, any,
|
|
436
|
+
get: () => import("./state.d.ts").SliceState<"base", "", any, any, any[], any, any, any, "", any, any>;
|
|
437
|
+
set: (setState: Partial<import("./state.d.ts").SliceState<"base", "", any, any, any[], any, any, any, "", any, any>> | ((state: import("./state.d.ts").SliceState<"base", "", any, any, any[], any, any, any, "", any, any>) => void)) => void;
|
|
409
438
|
}>;
|
|
410
439
|
};
|
|
411
440
|
};
|
package/types/store/state.d.ts
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
|
-
import { DataList
|
|
1
|
+
import { DataList } from "akanjs/base";
|
|
2
2
|
import { type DefaultOf } from "akanjs/constant";
|
|
3
3
|
import type { ExtractSort, FilterInstance } from "akanjs/document";
|
|
4
|
-
import type { SerializedSlice,
|
|
5
|
-
import type { Submit } from "./types.d.ts";
|
|
4
|
+
import type { SerializedSlice, SlceCnstCapitalizedRefName, SlceCnstDefault, SlceCnstFull, SlceCnstInsight, SlceCnstLight, SlceCnstRefName, SlceDbFilter, SlceDbSort, SliceCls } from "akanjs/signal";
|
|
5
|
+
import type { StoreSliceArgs, StoreSliceMap, StoreSliceSuffixCap, Submit } from "./types.d.ts";
|
|
6
6
|
export type SliceStateKey = "defaultModel" | "modelInsight" | "modelList" | "modelListLoading" | "modelInitList" | "modelInitAt" | "modelSelection" | "lastPageOfModel" | "pageOfModel" | "limitOfModel" | "queryArgsOfModel" | "sortOfModel";
|
|
7
|
+
type _SliceMap<S extends SliceCls> = StoreSliceMap<S>;
|
|
8
|
+
type _StateRefName<S extends SliceCls> = SlceCnstRefName<S>;
|
|
9
|
+
type _StateCap<S extends SliceCls> = SlceCnstCapitalizedRefName<S>;
|
|
10
|
+
type _StateFull<S extends SliceCls> = SlceCnstFull<S>;
|
|
11
|
+
type _StateLight<S extends SliceCls> = SlceCnstLight<S>;
|
|
12
|
+
type _StateInsight<S extends SliceCls> = SlceCnstInsight<S>;
|
|
13
|
+
type _StateDefault<S extends SliceCls> = SlceCnstDefault<S>;
|
|
14
|
+
type _StateFilter<S extends SliceCls> = SlceDbFilter<S>;
|
|
15
|
+
type _StateSort<S extends SliceCls> = SlceDbSort<S>;
|
|
7
16
|
type BaseState<RefName extends string, Full, _Default = DefaultOf<Full>> = {
|
|
8
17
|
[K in RefName]: Full | null;
|
|
9
18
|
} & {
|
|
@@ -48,40 +57,28 @@ export type SliceState<RefName extends string, Suffix extends string, Full, Ligh
|
|
|
48
57
|
} & {
|
|
49
58
|
[K in `sortOf${_CapitalizedRefName}${_CapitalizedSuffix}`]: _Sort;
|
|
50
59
|
};
|
|
51
|
-
type _SliceMap<SlceCls extends SliceCls> = SlceCls[typeof SLICE_META];
|
|
52
|
-
type _SuffixStr<SlceCls extends SliceCls, Suffix extends keyof _SliceMap<SlceCls>> = Suffix & string;
|
|
53
|
-
type _SuffixCap<SlceCls extends SliceCls, Suffix extends keyof _SliceMap<SlceCls>> = Capitalize<_SuffixStr<SlceCls, Suffix>>;
|
|
54
|
-
type _ArgsOf<SlceCls extends SliceCls, Suffix extends keyof _SliceMap<SlceCls>> = SliceInfoArgs<_SliceMap<SlceCls>[Suffix]>;
|
|
55
60
|
type DefaultSliceStateFields<SlceCls extends SliceCls, _RefName extends string, _CapRefName extends string, _Full, _Light extends {
|
|
56
61
|
id: string;
|
|
57
|
-
}, _Insight, _Default, _Sort> = {
|
|
58
|
-
[Suffix in
|
|
62
|
+
}, _Insight, _Default, _Sort, _Suffixes extends keyof _SliceMap<SlceCls> = keyof _SliceMap<SlceCls>> = {
|
|
63
|
+
[Suffix in _Suffixes as `default${_CapRefName}${StoreSliceSuffixCap<SlceCls, Suffix>}`]: _Default;
|
|
59
64
|
} & {
|
|
60
|
-
[Suffix in
|
|
65
|
+
[Suffix in _Suffixes as `${_RefName}List${StoreSliceSuffixCap<SlceCls, Suffix>}` | `${_RefName}InitList${StoreSliceSuffixCap<SlceCls, Suffix>}` | `${_RefName}Selection${StoreSliceSuffixCap<SlceCls, Suffix>}`]: DataList<_Light>;
|
|
61
66
|
} & {
|
|
62
|
-
[Suffix in
|
|
67
|
+
[Suffix in _Suffixes as `${_RefName}InitAt${StoreSliceSuffixCap<SlceCls, Suffix>}`]: Date;
|
|
63
68
|
} & {
|
|
64
|
-
[Suffix in
|
|
69
|
+
[Suffix in _Suffixes as `${_RefName}ListLoading${StoreSliceSuffixCap<SlceCls, Suffix>}`]: boolean;
|
|
65
70
|
} & {
|
|
66
|
-
[Suffix in
|
|
71
|
+
[Suffix in _Suffixes as `${_RefName}Insight${StoreSliceSuffixCap<SlceCls, Suffix>}`]: _Insight;
|
|
67
72
|
} & {
|
|
68
|
-
[Suffix in
|
|
73
|
+
[Suffix in _Suffixes as `lastPageOf${_CapRefName}${StoreSliceSuffixCap<SlceCls, Suffix>}` | `pageOf${_CapRefName}${StoreSliceSuffixCap<SlceCls, Suffix>}` | `limitOf${_CapRefName}${StoreSliceSuffixCap<SlceCls, Suffix>}`]: number;
|
|
69
74
|
} & {
|
|
70
|
-
[Suffix in
|
|
75
|
+
[Suffix in _Suffixes as `queryArgsOf${_CapRefName}${StoreSliceSuffixCap<SlceCls, Suffix>}`]: StoreSliceArgs<SlceCls, Suffix>;
|
|
71
76
|
} & {
|
|
72
|
-
[Suffix in
|
|
73
|
-
} & {
|
|
74
|
-
[Suffix in keyof _SliceMap<SlceCls> as `pageOf${_CapRefName}${_SuffixCap<SlceCls, Suffix>}`]: number;
|
|
75
|
-
} & {
|
|
76
|
-
[Suffix in keyof _SliceMap<SlceCls> as `limitOf${_CapRefName}${_SuffixCap<SlceCls, Suffix>}`]: number;
|
|
77
|
-
} & {
|
|
78
|
-
[Suffix in keyof _SliceMap<SlceCls> as `queryArgsOf${_CapRefName}${_SuffixCap<SlceCls, Suffix>}`]: _ArgsOf<SlceCls, Suffix>;
|
|
79
|
-
} & {
|
|
80
|
-
[Suffix in keyof _SliceMap<SlceCls> as `sortOf${_CapRefName}${_SuffixCap<SlceCls, Suffix>}`]: _Sort;
|
|
77
|
+
[Suffix in _Suffixes as `sortOf${_CapRefName}${StoreSliceSuffixCap<SlceCls, Suffix>}`]: _Sort;
|
|
81
78
|
};
|
|
82
|
-
export type DefaultState<SlceCls extends SliceCls, _RefName extends SlceCls
|
|
79
|
+
export type DefaultState<SlceCls extends SliceCls, _RefName extends _StateRefName<SlceCls> = _StateRefName<SlceCls>, _Full = _StateFull<SlceCls>, _Light extends {
|
|
83
80
|
id: string;
|
|
84
|
-
} = SlceCls
|
|
81
|
+
} = _StateLight<SlceCls>, _Insight = _StateInsight<SlceCls>, _Filter extends FilterInstance = _StateFilter<SlceCls>, _CapitalizedRefName extends string = _StateCap<SlceCls>, _Default = _StateDefault<SlceCls>, _Sort = _StateSort<SlceCls>> = BaseState<_RefName, _Full, _Default> & DefaultSliceStateFields<SlceCls, _RefName, _CapitalizedRefName, _Full, _Light, _Insight, _Default, _Sort>;
|
|
85
82
|
export declare const createDatabaseState: (refName: string) => {
|
|
86
83
|
[x: string]: string | boolean | object | null;
|
|
87
84
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Cls, type EnumInstance,
|
|
1
|
+
import { type Cls, DEFAULT_VALUE, type EnumInstance, type PrimitiveScalar } from "akanjs/base";
|
|
2
2
|
export type StateInitializer = () => unknown;
|
|
3
3
|
export type StateInitializerMap = Record<string, StateInitializer>;
|
|
4
4
|
export type SearchParamsState = Record<string, string | string[]>;
|
|
@@ -64,7 +64,7 @@ export interface ComputedOptions<T> {
|
|
|
64
64
|
type PrimitiveInput = typeof PrimitiveScalar | StringConstructor | BooleanConstructor | DateConstructor;
|
|
65
65
|
type FieldTypeInput = PrimitiveInput | Cls | EnumInstance | FieldTypeInput[];
|
|
66
66
|
type ValueOfType<T> = T extends readonly (infer V)[] ? ValueOfType<V>[] : T extends {
|
|
67
|
-
[
|
|
67
|
+
[DEFAULT_VALUE]: infer V;
|
|
68
68
|
} ? V : T extends EnumInstance<any, infer V> ? V : T extends new (...args: any[]) => infer V ? V : any;
|
|
69
69
|
type NullableValue<Value, Options> = Options extends {
|
|
70
70
|
nullable: true;
|
package/types/store/store.d.ts
CHANGED
|
@@ -1,16 +1,28 @@
|
|
|
1
1
|
import { ACTION_META, type Cls, type MergeAllActionTypes, type MergeAllKeyOfObjects, type SLICE_META, STATE_DERIVED_META, STATE_INIT_META, STATE_META } from "akanjs/base";
|
|
2
2
|
import type { FilterInstance } from "akanjs/document";
|
|
3
3
|
import type { ClientSignal } from "akanjs/fetch";
|
|
4
|
-
import type { SerializedSlice, SliceCls } from "akanjs/signal";
|
|
4
|
+
import type { SerializedSlice, SlceCnstCapitalizedRefName, SlceCnstDefault, SlceCnstFull, SlceCnstInput, SlceCnstInsight, SlceCnstLight, SlceDbFilter, SlceDbSort, SliceCls } from "akanjs/signal";
|
|
5
5
|
import { type DefaultAction } from "./action.d.ts";
|
|
6
6
|
import { type DefaultState } from "./state.d.ts";
|
|
7
7
|
import { type DerivedStateBuilder, type DerivedStateOf, type StateDerivedMeta, type StateInitializerMap, type WritableStateBuilder, type WritableStateOf } from "./stateBuilder.d.ts";
|
|
8
|
-
import type { InternalSlice, SetGet, SetGetWritable } from "./types.d.ts";
|
|
9
|
-
|
|
8
|
+
import type { InternalSlice, SetGet, SetGetWritable, StoreSliceMap, StoreSliceName, StoreSliceSuffix } from "./types.d.ts";
|
|
9
|
+
type _SliceMap<S extends SliceCls> = StoreSliceMap<S>;
|
|
10
|
+
type _StoreInput<S extends SliceCls> = SlceCnstInput<S>;
|
|
11
|
+
type _StoreFull<S extends SliceCls> = SlceCnstFull<S>;
|
|
12
|
+
type _StoreLight<S extends SliceCls> = SlceCnstLight<S>;
|
|
13
|
+
type _StoreInsight<S extends SliceCls> = SlceCnstInsight<S>;
|
|
14
|
+
type _StoreFilter<S extends SliceCls> = SlceDbFilter<S>;
|
|
15
|
+
type _StoreCap<S extends SliceCls> = SlceCnstCapitalizedRefName<S>;
|
|
16
|
+
type _StoreDefault<S extends SliceCls> = SlceCnstDefault<S>;
|
|
17
|
+
type _StoreSort<S extends SliceCls> = SlceDbSort<S>;
|
|
18
|
+
type StoreSliceOf<SlceCls extends SliceCls, RefName extends string, Suffix extends keyof _SliceMap<SlceCls>, Input, Full, Light extends {
|
|
10
19
|
id: string;
|
|
11
|
-
}
|
|
20
|
+
}, Insight, Filter extends FilterInstance, CapitalizedRefName extends string, Default, Sort> = InternalSlice<_SliceMap<SlceCls>[Suffix], RefName, StoreSliceSuffix<SlceCls, Suffix>, Input, Full, Light, Insight, Filter, CapitalizedRefName, Default, Sort>;
|
|
21
|
+
export type StoreCls<RefName extends string = string, WritableState = any, Action = unknown, SlceCls extends SliceCls = any, DerivedState = unknown, State = WritableState & DerivedState, _Input = _StoreInput<SlceCls>, _Full = _StoreFull<SlceCls>, _Light extends {
|
|
22
|
+
id: string;
|
|
23
|
+
} = _StoreLight<SlceCls>, _Insight = _StoreInsight<SlceCls>, _Filter extends FilterInstance = _StoreFilter<SlceCls>, _CapitalizedRefName extends string = _StoreCap<SlceCls>, _Default = _StoreDefault<SlceCls>, _Sort = _StoreSort<SlceCls>> = Cls<SetGetWritable<WritableState, State> & Action & {
|
|
12
24
|
slice: {
|
|
13
|
-
[Suffix in keyof SlceCls
|
|
25
|
+
[Suffix in keyof _SliceMap<SlceCls> as Suffix extends string ? StoreSliceName<RefName, Suffix> : never]: StoreSliceOf<SlceCls, RefName, Suffix, _Input, _Full, _Light, _Insight, _Filter, _CapitalizedRefName, _Default, _Sort>;
|
|
14
26
|
};
|
|
15
27
|
}, {
|
|
16
28
|
readonly type: "module";
|
package/types/store/types.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { SLICE_META } from "akanjs/base";
|
|
1
2
|
import type { DefaultOf } from "akanjs/constant";
|
|
2
3
|
import type { ExtractSort, FilterInstance } from "akanjs/document";
|
|
3
|
-
import type { SliceInfo } from "akanjs/signal";
|
|
4
|
+
import type { SliceCls, SliceInfo, SliceInfoArgs } from "akanjs/signal";
|
|
4
5
|
import type { SliceAction } from "./action.d.ts";
|
|
5
6
|
import type { SliceState } from "./state.d.ts";
|
|
6
7
|
export interface Submit {
|
|
@@ -29,7 +30,12 @@ export interface SetPick<State = any> {
|
|
|
29
30
|
export type Get<State, Actions> = {
|
|
30
31
|
get: () => State & Actions;
|
|
31
32
|
};
|
|
32
|
-
export type
|
|
33
|
+
export type StoreSliceMap<SlceCls extends SliceCls> = SlceCls[typeof SLICE_META];
|
|
34
|
+
export type StoreSliceSuffix<SlceCls extends SliceCls, Suffix extends keyof StoreSliceMap<SlceCls>> = Suffix & string;
|
|
35
|
+
export type StoreSliceSuffixCap<SlceCls extends SliceCls, Suffix extends keyof StoreSliceMap<SlceCls>> = Capitalize<StoreSliceSuffix<SlceCls, Suffix>>;
|
|
36
|
+
export type StoreSliceArgs<SlceCls extends SliceCls, Suffix extends keyof StoreSliceMap<SlceCls>> = SliceInfoArgs<StoreSliceMap<SlceCls>[Suffix]>;
|
|
37
|
+
export type StoreSliceName<RefName extends string, Suffix extends string> = `${RefName}${Capitalize<Suffix>}`;
|
|
38
|
+
export type SliceStateAction<RefName extends string = string, Suffix extends string = "", SliceName extends string = StoreSliceName<RefName, Suffix>, State = any, Action = any> = Action & {
|
|
33
39
|
refName: RefName;
|
|
34
40
|
suffix: Suffix;
|
|
35
41
|
sliceName: SliceName;
|
|
@@ -38,5 +44,5 @@ export type SliceStateAction<RefName extends string = string, Suffix extends str
|
|
|
38
44
|
};
|
|
39
45
|
export type InternalSlice<SlceInfo extends SliceInfo = any, RefName extends string = any, Suffix extends string = any, Input = any, Full = any, Light extends {
|
|
40
46
|
id: string;
|
|
41
|
-
} = any, Insight = any, Filter extends FilterInstance = any, _CapitalizedRefName extends string = Capitalize<RefName>, _Default = DefaultOf<Full>, _Sort = ExtractSort<Filter>, _Args extends any[] = SlceInfo
|
|
47
|
+
} = any, Insight = any, Filter extends FilterInstance = any, _CapitalizedRefName extends string = Capitalize<RefName>, _Default = DefaultOf<Full>, _Sort = ExtractSort<Filter>, _Args extends any[] = SliceInfoArgs<SlceInfo>, _SliceState = SliceState<RefName, "", Full, Light, _Args, Insight, Filter, _CapitalizedRefName, "", _Default, _Sort>, _SliceAction = SliceAction<RefName, "", Input, Light, _Args, Filter, _CapitalizedRefName, "", _Sort>, _SliceName extends string = StoreSliceName<RefName, Suffix>> = SliceStateAction<RefName, Suffix, _SliceName, _SliceState, _SliceAction>;
|
|
42
48
|
export {};
|
package/ui/Signal/makeExample.ts
CHANGED
|
@@ -2,9 +2,9 @@ import {
|
|
|
2
2
|
Any,
|
|
3
3
|
arraiedModel,
|
|
4
4
|
type Cls,
|
|
5
|
+
EXAMPLE_VALUE,
|
|
5
6
|
FIELD_META,
|
|
6
7
|
getNonArrayModel,
|
|
7
|
-
PRIMITIVE_EXAMPLE_VALUE,
|
|
8
8
|
PrimitiveRegistry,
|
|
9
9
|
type PrimitiveScalar,
|
|
10
10
|
} from "akanjs/base";
|
|
@@ -15,7 +15,7 @@ import type { SerializedArg, SerializedEndpoint, SignalType } from "akanjs/signa
|
|
|
15
15
|
const getResponseExample = (ref: Cls | Cls[]) => {
|
|
16
16
|
const [modelRef, arrDepth] = getNonArrayModel(ref);
|
|
17
17
|
const isPrimitive = PrimitiveRegistry.has(modelRef);
|
|
18
|
-
if (isPrimitive) return arraiedModel((modelRef as typeof PrimitiveScalar)[
|
|
18
|
+
if (isPrimitive) return arraiedModel((modelRef as typeof PrimitiveScalar)[EXAMPLE_VALUE], arrDepth);
|
|
19
19
|
|
|
20
20
|
const example: Record<string, unknown> = {};
|
|
21
21
|
Object.entries((modelRef as ConstantCls)[FIELD_META]).forEach(([key, field]) => {
|
|
@@ -30,7 +30,7 @@ const getResponseExample = (ref: Cls | Cls[]) => {
|
|
|
30
30
|
const getRequestExample = (modelRef: Cls) => {
|
|
31
31
|
const example: Record<string, unknown> = {};
|
|
32
32
|
const isPrimitive = PrimitiveRegistry.has(modelRef);
|
|
33
|
-
if (isPrimitive) return (modelRef as typeof PrimitiveScalar)[
|
|
33
|
+
if (isPrimitive) return (modelRef as typeof PrimitiveScalar)[EXAMPLE_VALUE];
|
|
34
34
|
else {
|
|
35
35
|
Object.entries((modelRef as ConstantCls)[FIELD_META]).forEach(([key, field]) => {
|
|
36
36
|
if (!field.isScalar && field.isClass) example[key] = "ObjectID";
|