akanjs 2.3.8-rc.2 → 2.3.8-rc.3
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/symbols.ts +3 -0
- package/dictionary/dictInfo.ts +58 -45
- package/dictionary/locale.ts +97 -52
- package/document/filterMeta.ts +18 -2
- package/package.json +1 -1
- package/signal/endpoint.ts +14 -6
- package/signal/slice.ts +11 -3
- package/types/base/symbols.d.ts +3 -0
- package/types/dictionary/base.dictionary.d.ts +1 -1
- package/types/dictionary/dictInfo.d.ts +24 -11
- package/types/dictionary/locale.d.ts +39 -40
- package/types/document/filterMeta.d.ts +25 -3
- package/types/signal/endpoint.d.ts +16 -6
- package/types/signal/signalRegistry.d.ts +2 -14
- package/types/signal/slice.d.ts +13 -3
package/base/symbols.ts
CHANGED
|
@@ -4,6 +4,9 @@ export const FILTER_META = Symbol.for("akan.filter");
|
|
|
4
4
|
export const LOADER_META = Symbol.for("akan.loader");
|
|
5
5
|
export const INJECT_META = Symbol.for("akan.inject");
|
|
6
6
|
export const ENDPOINT_META = Symbol.for("akan.endpoint");
|
|
7
|
+
export const ENDPOINT_DICT_SHAPE: unique symbol = Symbol.for("akan.endpoint.dictShape") as never;
|
|
8
|
+
export const SLICE_DICT_SHAPE: unique symbol = Symbol.for("akan.slice.dictShape") as never;
|
|
9
|
+
export const FILTER_DICT_SHAPE: unique symbol = Symbol.for("akan.filter.dictShape") as never;
|
|
7
10
|
export const INTERNAL_META = Symbol.for("akan.internal");
|
|
8
11
|
export const STATE_META = Symbol.for("akan.state");
|
|
9
12
|
export const STATE_INIT_META = Symbol.for("akan.state.init");
|
package/dictionary/dictInfo.ts
CHANGED
|
@@ -1,40 +1,62 @@
|
|
|
1
|
-
import type { GetStateObject } from "akanjs/base";
|
|
1
|
+
import type { ENDPOINT_DICT_SHAPE, FILTER_DICT_SHAPE, GetStateObject, SLICE_DICT_SHAPE } from "akanjs/base";
|
|
2
2
|
import { capitalize } from "akanjs/common";
|
|
3
3
|
import type { BaseInsight, BaseObject } from "akanjs/constant";
|
|
4
|
-
import type { BaseFilterQueryKey, BaseFilterSortKey, FilterCls, FilterInfo, FilterInstance } from "akanjs/document";
|
|
5
4
|
import type {
|
|
6
|
-
|
|
5
|
+
BaseFilterQueryKey,
|
|
6
|
+
BaseFilterSortKey,
|
|
7
|
+
FilterCls,
|
|
8
|
+
FilterDictShape as FilterCompactShape,
|
|
9
|
+
FilterDictArgShape,
|
|
10
|
+
FilterInfo,
|
|
11
|
+
FilterInstance,
|
|
12
|
+
} from "akanjs/document";
|
|
13
|
+
import type {
|
|
7
14
|
EndpointCls,
|
|
15
|
+
EndpointDictShape as EndpointCompactShape,
|
|
8
16
|
EndpointInfo,
|
|
9
17
|
SliceCls,
|
|
18
|
+
SliceDictShape as SliceCompactShape,
|
|
10
19
|
SliceInfo,
|
|
11
|
-
SliceInfoArgNames,
|
|
12
20
|
} from "akanjs/signal";
|
|
13
21
|
import type { DictionaryNode, RootDictionary } from "./trans";
|
|
14
22
|
|
|
15
23
|
type MutableDictionaryNode = DictionaryNode & { t?: string; desc?: DictionaryNode };
|
|
16
24
|
type EnumValueKey = string | number;
|
|
17
|
-
type
|
|
25
|
+
type DictArgShape = { [key: string]: readonly string[] };
|
|
26
|
+
type AnyFilterShape = FilterCompactShape<FilterInstance<Record<string, FilterInfo>, Record<string, unknown>>>;
|
|
18
27
|
type DictFilterShape<Filter> =
|
|
19
28
|
Filter extends FilterCls<infer FilterShape>
|
|
20
|
-
? FilterShape
|
|
21
|
-
: Filter extends
|
|
22
|
-
?
|
|
23
|
-
: Filter extends
|
|
24
|
-
? Filter
|
|
25
|
-
:
|
|
29
|
+
? FilterCompactShape<FilterShape>
|
|
30
|
+
: Filter extends { readonly [FILTER_DICT_SHAPE]: infer CompactShape extends FilterDictArgShape }
|
|
31
|
+
? CompactShape
|
|
32
|
+
: Filter extends FilterInstance
|
|
33
|
+
? FilterCompactShape<Filter>
|
|
34
|
+
: Filter extends { query: Record<string, FilterInfo>; sort: Record<string, unknown> }
|
|
35
|
+
? FilterCompactShape<Filter>
|
|
36
|
+
: Filter extends { query: DictArgShape; sort: Record<string, true> }
|
|
37
|
+
? Filter
|
|
38
|
+
: AnyFilterShape;
|
|
26
39
|
type DictSliceShape<Slice> =
|
|
27
40
|
Slice extends SliceCls<infer _SrvModule, infer SliceInfoObj>
|
|
28
|
-
? SliceInfoObj
|
|
29
|
-
: Slice extends
|
|
30
|
-
?
|
|
31
|
-
:
|
|
41
|
+
? SliceCompactShape<SliceInfoObj>
|
|
42
|
+
: Slice extends { readonly [SLICE_DICT_SHAPE]: infer CompactShape extends DictArgShape }
|
|
43
|
+
? CompactShape
|
|
44
|
+
: Slice extends DictArgShape
|
|
45
|
+
? Slice
|
|
46
|
+
: Slice extends Record<string, SliceInfo>
|
|
47
|
+
? SliceCompactShape<Slice>
|
|
48
|
+
: Record<never, never>;
|
|
32
49
|
type DictEndpointShape<Endpoint> =
|
|
33
50
|
Endpoint extends EndpointCls<infer _SrvModule, infer EndpointInfoObj>
|
|
34
|
-
? EndpointInfoObj
|
|
35
|
-
: Endpoint extends
|
|
36
|
-
?
|
|
37
|
-
:
|
|
51
|
+
? EndpointCompactShape<EndpointInfoObj>
|
|
52
|
+
: Endpoint extends { readonly [ENDPOINT_DICT_SHAPE]: infer CompactShape extends DictArgShape }
|
|
53
|
+
? CompactShape
|
|
54
|
+
: Endpoint extends DictArgShape
|
|
55
|
+
? Endpoint
|
|
56
|
+
: Endpoint extends Record<string, EndpointInfo>
|
|
57
|
+
? EndpointCompactShape<Endpoint>
|
|
58
|
+
: Record<never, never>;
|
|
59
|
+
type DictArgNames<ArgNames> = ArgNames extends readonly string[] ? ArgNames[number] : never;
|
|
38
60
|
type DictFilterQuery<Filter> = DictFilterShape<Filter>["query"];
|
|
39
61
|
type DictFilterSort<Filter> = DictFilterShape<Filter>["sort"];
|
|
40
62
|
|
|
@@ -282,22 +304,14 @@ export class ModelDictInfo<
|
|
|
282
304
|
}
|
|
283
305
|
query<Filter>(
|
|
284
306
|
translate: (fn: (trans: Languages) => FunctionTranslation<Languages>) => {
|
|
285
|
-
[K in Exclude<keyof DictFilterQuery<Filter>, QueryKey>]:
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
>
|
|
290
|
-
? FunctionTranslation<Languages, ArgNames[number]>
|
|
291
|
-
: never;
|
|
307
|
+
[K in Exclude<keyof DictFilterQuery<Filter>, QueryKey>]: FunctionTranslation<
|
|
308
|
+
Languages,
|
|
309
|
+
DictArgNames<DictFilterQuery<Filter>[K]>
|
|
310
|
+
>;
|
|
292
311
|
},
|
|
293
312
|
) {
|
|
294
313
|
Object.assign(this.queryDictionary, translate(fn), ModelDictInfo.baseQueryDictionary) as unknown as {
|
|
295
|
-
[K in keyof DictFilterQuery<Filter>]: FunctionTranslation<
|
|
296
|
-
Languages,
|
|
297
|
-
DictFilterQuery<Filter>[K] extends FilterInfo<infer ArgNames, infer _Args, infer _Model>
|
|
298
|
-
? ArgNames[number]
|
|
299
|
-
: never
|
|
300
|
-
>;
|
|
314
|
+
[K in keyof DictFilterQuery<Filter>]: FunctionTranslation<Languages, DictArgNames<DictFilterQuery<Filter>[K]>>;
|
|
301
315
|
};
|
|
302
316
|
return this as unknown as ModelDictInfo<
|
|
303
317
|
Languages,
|
|
@@ -363,10 +377,10 @@ export class ModelDictInfo<
|
|
|
363
377
|
}
|
|
364
378
|
slice<Slice>(
|
|
365
379
|
translate: (fn: (trans: Languages) => FunctionTranslation<Languages>) => {
|
|
366
|
-
[K in Exclude<keyof DictSliceShape<Slice>, SliceKey>]:
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
380
|
+
[K in Exclude<keyof DictSliceShape<Slice>, SliceKey>]: FunctionTranslation<
|
|
381
|
+
Languages,
|
|
382
|
+
DictArgNames<DictSliceShape<Slice>[K]>
|
|
383
|
+
>;
|
|
370
384
|
},
|
|
371
385
|
) {
|
|
372
386
|
Object.assign(this.sliceDictionary, translate(fn), ModelDictInfo.baseSliceDictionary) as unknown as {
|
|
@@ -388,12 +402,10 @@ export class ModelDictInfo<
|
|
|
388
402
|
}
|
|
389
403
|
endpoint<Endpoint>(
|
|
390
404
|
translate: (fn: (trans: Languages) => FunctionTranslation<Languages>) => {
|
|
391
|
-
[K in Exclude<
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
? FunctionTranslation<Languages, EndpInfoArgNames<Info>[number]>
|
|
396
|
-
: never;
|
|
405
|
+
[K in Exclude<keyof DictEndpointShape<Endpoint>, EndpointKey>]: FunctionTranslation<
|
|
406
|
+
Languages,
|
|
407
|
+
DictArgNames<DictEndpointShape<Endpoint>[K]>
|
|
408
|
+
>;
|
|
397
409
|
},
|
|
398
410
|
) {
|
|
399
411
|
Object.assign(this.endpointDictionary, translate(fn)) as unknown as {
|
|
@@ -1009,9 +1021,10 @@ export class ServiceDictInfo<
|
|
|
1009
1021
|
}
|
|
1010
1022
|
endpoint<Endpoint>(
|
|
1011
1023
|
translate: (fn: (trans: Languages) => FunctionTranslation<Languages>) => {
|
|
1012
|
-
[K in keyof DictEndpointShape<Endpoint>]:
|
|
1013
|
-
|
|
1014
|
-
|
|
1024
|
+
[K in keyof DictEndpointShape<Endpoint>]: FunctionTranslation<
|
|
1025
|
+
Languages,
|
|
1026
|
+
DictArgNames<DictEndpointShape<Endpoint>[K]>
|
|
1027
|
+
>;
|
|
1015
1028
|
},
|
|
1016
1029
|
) {
|
|
1017
1030
|
Object.assign(this.endpointDictionary, translate(fn)) as unknown as {
|
package/dictionary/locale.ts
CHANGED
|
@@ -1,7 +1,28 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
ENDPOINT_DICT_SHAPE,
|
|
3
|
+
FILTER_DICT_SHAPE,
|
|
4
|
+
GetStateObject,
|
|
5
|
+
MergedValues,
|
|
6
|
+
SLICE_DICT_SHAPE,
|
|
7
|
+
} from "akanjs/base";
|
|
2
8
|
import type { BaseInsight, BaseObject } from "akanjs/constant";
|
|
3
|
-
import type {
|
|
4
|
-
|
|
9
|
+
import type {
|
|
10
|
+
FilterCls,
|
|
11
|
+
FilterDictShape as FilterCompactShape,
|
|
12
|
+
FilterDictArgShape,
|
|
13
|
+
FilterInfo,
|
|
14
|
+
FilterInstance,
|
|
15
|
+
} from "akanjs/document";
|
|
16
|
+
import type {
|
|
17
|
+
EndpointCls,
|
|
18
|
+
EndpointDictShape as EndpointCompactShape,
|
|
19
|
+
EndpointInfo,
|
|
20
|
+
SliceCls,
|
|
21
|
+
SliceDictShape as SliceCompactShape,
|
|
22
|
+
SliceInfo,
|
|
23
|
+
SliceInfoArgNames,
|
|
24
|
+
SliceInfoRefName,
|
|
25
|
+
} from "akanjs/signal";
|
|
5
26
|
import type { ModelDictInfo, ScalarDictInfo, ServiceDictInfo } from ".";
|
|
6
27
|
|
|
7
28
|
interface Trans {
|
|
@@ -16,35 +37,61 @@ interface FnTrans<ArgKey extends string> {
|
|
|
16
37
|
desc?: string;
|
|
17
38
|
arg?: { [key in ArgKey]: FieldTrans };
|
|
18
39
|
}
|
|
19
|
-
type
|
|
40
|
+
type DictArgShape = { [key: string]: readonly string[] };
|
|
41
|
+
type AnyFilterShape = FilterCompactShape<FilterInstance<Record<string, FilterInfo>, Record<string, unknown>>>;
|
|
20
42
|
type DictFilterShape<Filter> =
|
|
21
43
|
Filter extends FilterCls<infer FilterShape>
|
|
22
|
-
? FilterShape
|
|
23
|
-
: Filter extends
|
|
24
|
-
?
|
|
25
|
-
: Filter extends
|
|
26
|
-
? Filter
|
|
27
|
-
:
|
|
44
|
+
? FilterCompactShape<FilterShape>
|
|
45
|
+
: Filter extends { readonly [FILTER_DICT_SHAPE]: infer CompactShape extends FilterDictArgShape }
|
|
46
|
+
? CompactShape
|
|
47
|
+
: Filter extends FilterInstance
|
|
48
|
+
? FilterCompactShape<Filter>
|
|
49
|
+
: Filter extends { query: Record<string, FilterInfo>; sort: Record<string, unknown> }
|
|
50
|
+
? FilterCompactShape<Filter>
|
|
51
|
+
: Filter extends { query: DictArgShape; sort: Record<string, true> }
|
|
52
|
+
? Filter
|
|
53
|
+
: AnyFilterShape;
|
|
28
54
|
type DictFilterQuery<Filter> = DictFilterShape<Filter>["query"];
|
|
29
55
|
type DictFilterSort<Filter> = DictFilterShape<Filter>["sort"];
|
|
56
|
+
type DictArgNames<ArgNames> = ArgNames extends readonly string[] ? ArgNames[number] : never;
|
|
57
|
+
type DictEndpointShape<Endpoint> =
|
|
58
|
+
Endpoint extends EndpointCls<infer _SrvModule, infer EndpointInfoObj>
|
|
59
|
+
? EndpointCompactShape<EndpointInfoObj>
|
|
60
|
+
: Endpoint extends { readonly [ENDPOINT_DICT_SHAPE]: infer CompactShape extends DictArgShape }
|
|
61
|
+
? CompactShape
|
|
62
|
+
: Endpoint extends DictArgShape
|
|
63
|
+
? Endpoint
|
|
64
|
+
: Endpoint extends Record<string, EndpointInfo>
|
|
65
|
+
? EndpointCompactShape<Endpoint>
|
|
66
|
+
: Record<never, never>;
|
|
67
|
+
type DictSliceShape<Slice> =
|
|
68
|
+
Slice extends SliceCls<infer _SrvModule, infer SliceInfoObj>
|
|
69
|
+
? SliceCompactShape<SliceInfoObj>
|
|
70
|
+
: Slice extends { readonly [SLICE_DICT_SHAPE]: infer CompactShape extends DictArgShape }
|
|
71
|
+
? CompactShape
|
|
72
|
+
: Slice extends DictArgShape
|
|
73
|
+
? Slice
|
|
74
|
+
: Slice extends Record<string, SliceInfo>
|
|
75
|
+
? SliceCompactShape<Slice>
|
|
76
|
+
: Record<never, never>;
|
|
30
77
|
type FilterTranslatorKey<Filter> = {
|
|
31
78
|
[Key in keyof DictFilterQuery<Filter> & string]:
|
|
32
79
|
| `${Key}`
|
|
33
80
|
| `${Key}.desc`
|
|
34
|
-
| (DictFilterQuery<Filter>[Key] extends
|
|
35
|
-
?
|
|
36
|
-
|
|
37
|
-
|
|
81
|
+
| (DictArgNames<DictFilterQuery<Filter>[Key]> extends string
|
|
82
|
+
?
|
|
83
|
+
| `${Key}.arg.${DictArgNames<DictFilterQuery<Filter>[Key]>}`
|
|
84
|
+
| `${Key}.arg.${DictArgNames<DictFilterQuery<Filter>[Key]>}.desc`
|
|
38
85
|
: never);
|
|
39
86
|
}[keyof DictFilterQuery<Filter> & string];
|
|
40
|
-
type EndpointTranslatorKey<Endpoint
|
|
41
|
-
[Key in keyof Endpoint & string]:
|
|
87
|
+
type EndpointTranslatorKey<Endpoint> = {
|
|
88
|
+
[Key in keyof DictEndpointShape<Endpoint> & string]:
|
|
42
89
|
| `${Key}`
|
|
43
90
|
| `${Key}.desc`
|
|
44
|
-
| `${Key}.arg.${
|
|
45
|
-
| `${Key}.arg.${
|
|
46
|
-
}[keyof Endpoint & string];
|
|
47
|
-
type
|
|
91
|
+
| `${Key}.arg.${DictArgNames<DictEndpointShape<Endpoint>[Key]>}`
|
|
92
|
+
| `${Key}.arg.${DictArgNames<DictEndpointShape<Endpoint>[Key]>}.desc`;
|
|
93
|
+
}[keyof DictEndpointShape<Endpoint> & string];
|
|
94
|
+
type FullSliceTranslatorKey<Slice> = {
|
|
48
95
|
[Key in keyof Slice & string]: Slice[Key] extends infer Info extends SliceInfo
|
|
49
96
|
?
|
|
50
97
|
| `${SliceInfoRefName<Info>}List${Capitalize<Key>}`
|
|
@@ -57,6 +104,21 @@ type SliceTranslatorKey<Slice> = {
|
|
|
57
104
|
| `${SliceInfoRefName<Info>}Insight${Capitalize<Key>}.arg.${SliceInfoArgNames<Info>[number]}.desc`
|
|
58
105
|
: never;
|
|
59
106
|
}[keyof Slice & string];
|
|
107
|
+
type CompactSliceTranslatorKey<T extends string, Slice> = {
|
|
108
|
+
[Key in keyof DictSliceShape<Slice> & string]: Key extends ""
|
|
109
|
+
? never
|
|
110
|
+
:
|
|
111
|
+
| `${T}List${Capitalize<Key>}`
|
|
112
|
+
| `${T}List${Capitalize<Key>}.desc`
|
|
113
|
+
| `${T}List${Capitalize<Key>}.arg.${DictArgNames<DictSliceShape<Slice>[Key]> | "skip" | "limit" | "sort"}`
|
|
114
|
+
| `${T}List${Capitalize<Key>}.arg.${DictArgNames<DictSliceShape<Slice>[Key]> | "skip" | "limit" | "sort"}.desc`
|
|
115
|
+
| `${T}Insight${Capitalize<Key>}`
|
|
116
|
+
| `${T}Insight${Capitalize<Key>}.desc`
|
|
117
|
+
| `${T}Insight${Capitalize<Key>}.arg.${DictArgNames<DictSliceShape<Slice>[Key]>}`
|
|
118
|
+
| `${T}Insight${Capitalize<Key>}.arg.${DictArgNames<DictSliceShape<Slice>[Key]>}.desc`;
|
|
119
|
+
}[keyof DictSliceShape<Slice> & string];
|
|
120
|
+
type SliceTranslatorKey<T extends string, Slice> =
|
|
121
|
+
Slice extends Record<string, SliceInfo> ? FullSliceTranslatorKey<Slice> : CompactSliceTranslatorKey<T, Slice>;
|
|
60
122
|
|
|
61
123
|
type SliceApiTrans<
|
|
62
124
|
T extends string,
|
|
@@ -85,8 +147,8 @@ export type ModelTrans<
|
|
|
85
147
|
Model extends BaseObject,
|
|
86
148
|
Insight extends BaseInsight,
|
|
87
149
|
Filter,
|
|
88
|
-
Slice
|
|
89
|
-
Endpoint
|
|
150
|
+
Slice,
|
|
151
|
+
Endpoint,
|
|
90
152
|
ErrorKey extends string,
|
|
91
153
|
EtcKey extends string,
|
|
92
154
|
> = {
|
|
@@ -95,35 +157,25 @@ export type ModelTrans<
|
|
|
95
157
|
model: { [K in keyof GetStateObject<Model>]: FieldTrans };
|
|
96
158
|
insight: { [K in keyof GetStateObject<Insight>]: FieldTrans };
|
|
97
159
|
query: {
|
|
98
|
-
[K in keyof DictFilterQuery<Filter>]: DictFilterQuery<Filter>[K]
|
|
99
|
-
? FnTrans<ArgNames[number]>
|
|
100
|
-
: never;
|
|
160
|
+
[K in keyof DictFilterQuery<Filter>]: FnTrans<DictArgNames<DictFilterQuery<Filter>[K]>>;
|
|
101
161
|
};
|
|
102
162
|
sort: { [K in keyof DictFilterSort<Filter>]: FieldTrans };
|
|
103
163
|
api: {
|
|
104
|
-
[K in keyof Endpoint]: FnTrans<
|
|
164
|
+
[K in keyof DictEndpointShape<Endpoint>]: FnTrans<DictArgNames<DictEndpointShape<Endpoint>[K]>>;
|
|
105
165
|
} & BaseModelCrudGetApiTrans<T> &
|
|
106
166
|
MergedValues<{
|
|
107
|
-
[K in keyof Slice]: SliceApiTrans<
|
|
167
|
+
[K in keyof DictSliceShape<Slice>]: SliceApiTrans<T, K & string, DictArgNames<DictSliceShape<Slice>[K]>>;
|
|
108
168
|
}>;
|
|
109
169
|
error: { [K in ErrorKey]: Trans };
|
|
110
170
|
} & { [K in EtcKey]: Trans };
|
|
111
|
-
export type ModelTranslatorKey<
|
|
112
|
-
T extends string,
|
|
113
|
-
Model,
|
|
114
|
-
Insight,
|
|
115
|
-
Filter,
|
|
116
|
-
Slice extends { [key: string]: SliceInfo },
|
|
117
|
-
Endpoint extends { [key: string]: EndpointInfo },
|
|
118
|
-
EtcKey extends string,
|
|
119
|
-
> =
|
|
171
|
+
export type ModelTranslatorKey<T extends string, Model, Insight, Filter, Slice, Endpoint, EtcKey extends string> =
|
|
120
172
|
| `${T}.modelName`
|
|
121
173
|
| `${T}.modelDesc`
|
|
122
174
|
| `${T}.${keyof GetStateObject<Model> & string}${"" | ".desc"}`
|
|
123
175
|
| `${T}.insight.${keyof GetStateObject<Insight> & string}${"" | ".desc"}`
|
|
124
176
|
| `${T}.query.${FilterTranslatorKey<Filter>}`
|
|
125
177
|
| `${T}.sort.${keyof DictFilterSort<Filter> & string}${"" | ".desc"}`
|
|
126
|
-
| `${T}.signal.${EndpointTranslatorKey<Endpoint> | SliceTranslatorKey<Slice>}`
|
|
178
|
+
| `${T}.signal.${EndpointTranslatorKey<Endpoint> | SliceTranslatorKey<T, Slice>}`
|
|
127
179
|
| `${T}.${EtcKey}`;
|
|
128
180
|
|
|
129
181
|
export type ScalarTrans<_T extends string, Model, ErrorKey extends string, EtcKey extends string> = {
|
|
@@ -138,22 +190,15 @@ export type ScalarTranslatorKey<T extends string, Model, EtcKey extends string>
|
|
|
138
190
|
| `${T}.${keyof GetStateObject<Model> & string}${"" | ".desc"}`
|
|
139
191
|
| `${T}.${EtcKey}`;
|
|
140
192
|
|
|
141
|
-
export type ServiceTrans<
|
|
142
|
-
_T extends string,
|
|
143
|
-
Endpoint extends { [key: string]: EndpointInfo },
|
|
144
|
-
ErrorKey extends string,
|
|
145
|
-
EtcKey extends string,
|
|
146
|
-
> = {
|
|
193
|
+
export type ServiceTrans<_T extends string, Endpoint, ErrorKey extends string, EtcKey extends string> = {
|
|
147
194
|
api: {
|
|
148
|
-
[K in keyof Endpoint]: FnTrans<
|
|
195
|
+
[K in keyof DictEndpointShape<Endpoint>]: FnTrans<DictArgNames<DictEndpointShape<Endpoint>[K]>>;
|
|
149
196
|
};
|
|
150
197
|
error: { [K in ErrorKey]: Trans };
|
|
151
198
|
} & { [K in EtcKey]: Trans };
|
|
152
|
-
export type ServiceTranslatorKey<
|
|
153
|
-
T
|
|
154
|
-
|
|
155
|
-
EtcKey extends string,
|
|
156
|
-
> = `${T}.signal.${EndpointTranslatorKey<Endpoint>}` | `${T}.${EtcKey}`;
|
|
199
|
+
export type ServiceTranslatorKey<T extends string, Endpoint, EtcKey extends string> =
|
|
200
|
+
| `${T}.signal.${EndpointTranslatorKey<Endpoint>}`
|
|
201
|
+
| `${T}.${EtcKey}`;
|
|
157
202
|
|
|
158
203
|
export type EnumTrans<EnumValue extends string | number> = {
|
|
159
204
|
[key in EnumValue]: Trans;
|
|
@@ -174,8 +219,8 @@ export const registerModelTrans = <
|
|
|
174
219
|
Model extends BaseObject,
|
|
175
220
|
Insight extends BaseInsight,
|
|
176
221
|
Filter,
|
|
177
|
-
Slice
|
|
178
|
-
Endpoint
|
|
222
|
+
Slice,
|
|
223
|
+
Endpoint,
|
|
179
224
|
ModelDict,
|
|
180
225
|
>(
|
|
181
226
|
modelDict: ModelDict,
|
|
@@ -233,7 +278,7 @@ export const registerScalarTrans = <T extends string, Model, ScalarDict>(
|
|
|
233
278
|
: never;
|
|
234
279
|
};
|
|
235
280
|
|
|
236
|
-
export const registerServiceTrans = <T extends string, Endpoint
|
|
281
|
+
export const registerServiceTrans = <T extends string, Endpoint, ServiceDict>(
|
|
237
282
|
serviceDict: ServiceDict,
|
|
238
283
|
): ServiceDict extends ServiceDictInfo<infer _Languages, infer _EndpointKey, infer ErrorKey, infer EtcKey>
|
|
239
284
|
? DictModule<ServiceTranslatorKey<T, Endpoint, EtcKey>, `${T}.error.${ErrorKey}`>
|
package/document/filterMeta.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Cls, MergeAllDoubleKeyOfObjects, MergeAllKeyOfTypes } from "akanjs/base";
|
|
2
|
-
import { FILTER_META } from "akanjs/base";
|
|
2
|
+
import { FILTER_DICT_SHAPE, FILTER_META } from "akanjs/base";
|
|
3
3
|
import type {
|
|
4
4
|
BaseObject,
|
|
5
5
|
ConstantFieldTypeInput,
|
|
@@ -109,6 +109,21 @@ export type FilterInstance<
|
|
|
109
109
|
query: Query;
|
|
110
110
|
sort: Sort;
|
|
111
111
|
};
|
|
112
|
+
export type FilterDictArgShape = {
|
|
113
|
+
query: { [key: string]: readonly string[] };
|
|
114
|
+
sort: { [key: string]: true };
|
|
115
|
+
};
|
|
116
|
+
export type FilterDictShape<Filter extends FilterInstance> = {
|
|
117
|
+
query: {
|
|
118
|
+
[K in keyof Filter["query"]]: Filter["query"][K] extends FilterInfo<infer ArgNames, infer _Args, infer _Model>
|
|
119
|
+
? ArgNames
|
|
120
|
+
: never;
|
|
121
|
+
};
|
|
122
|
+
sort: { [K in keyof Filter["sort"]]: true };
|
|
123
|
+
};
|
|
124
|
+
export interface FilterDictShapeCarrier<DictShape extends FilterDictArgShape = FilterDictArgShape> {
|
|
125
|
+
readonly [FILTER_DICT_SHAPE]: DictShape;
|
|
126
|
+
}
|
|
112
127
|
interface BaseQuery<Model> {
|
|
113
128
|
any: FilterInfo<[], [], Model>;
|
|
114
129
|
}
|
|
@@ -140,8 +155,9 @@ export type ExtractQuery<Filter extends FilterInstance> = {
|
|
|
140
155
|
};
|
|
141
156
|
export type ExtractSort<Filter extends FilterInstance> = keyof Filter["sort"];
|
|
142
157
|
export interface FilterCls<Filter extends FilterInstance = any, Query = unknown, Sort = unknown>
|
|
143
|
-
extends Cls<{ [key: string]:
|
|
158
|
+
extends Cls<FilterDictShapeCarrier<FilterDictShape<Filter>> & { [key: string]: unknown }> {
|
|
144
159
|
[FILTER_META]: Filter;
|
|
160
|
+
prototype: FilterDictShapeCarrier<FilterDictShape<Filter>> & { [key: string]: unknown };
|
|
145
161
|
sortField: Set<string>;
|
|
146
162
|
_Query: Query;
|
|
147
163
|
_Sort: Sort;
|
package/package.json
CHANGED
package/signal/endpoint.ts
CHANGED
|
@@ -1,20 +1,28 @@
|
|
|
1
1
|
import type { Assign } from "akanjs/base";
|
|
2
|
-
import { ENDPOINT_META } from "akanjs/base";
|
|
2
|
+
import { ENDPOINT_DICT_SHAPE, ENDPOINT_META } from "akanjs/base";
|
|
3
3
|
import { applyMixins } from "akanjs/common";
|
|
4
4
|
import { type Adaptor, type AdaptorCls, dangerouslyAdapt, type ServiceModel } from "akanjs/service";
|
|
5
|
-
import { buildEndpoint, type EndpointBuilder, type EndpointInfo } from "./endpointInfo";
|
|
5
|
+
import { buildEndpoint, type EndpInfoArgNames, type EndpointBuilder, type EndpointInfo } from "./endpointInfo";
|
|
6
6
|
import type { SrvRefName } from "./types";
|
|
7
7
|
|
|
8
|
-
export
|
|
8
|
+
export type EndpointDictArgShape = { [key: string]: readonly string[] };
|
|
9
|
+
export type EndpointDictShape<EndpointInfoObj extends { [key: string]: EndpointInfo }> = {
|
|
10
|
+
[K in keyof EndpointInfoObj]: EndpInfoArgNames<EndpointInfoObj[K]>;
|
|
11
|
+
};
|
|
9
12
|
|
|
10
|
-
export interface
|
|
13
|
+
export interface Endpoint<DictShape extends EndpointDictArgShape = Record<never, never>> extends Adaptor {
|
|
14
|
+
readonly [ENDPOINT_DICT_SHAPE]: DictShape;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type EndpointCls<
|
|
11
18
|
SrvModule extends ServiceModel = ServiceModel,
|
|
12
19
|
EndpointInfoObj extends { [key: string]: EndpointInfo } = { [key: string]: EndpointInfo },
|
|
13
|
-
>
|
|
20
|
+
> = AdaptorCls<Endpoint<EndpointDictShape<EndpointInfoObj>>> & {
|
|
14
21
|
baseName: SrvRefName<SrvModule>;
|
|
15
22
|
srv: SrvModule;
|
|
23
|
+
prototype: Endpoint<EndpointDictShape<EndpointInfoObj>>;
|
|
16
24
|
[ENDPOINT_META]: EndpointInfoObj;
|
|
17
|
-
}
|
|
25
|
+
};
|
|
18
26
|
|
|
19
27
|
type EndpointMetaOf<EndpCls> = EndpCls extends EndpointCls<any, infer EndpointInfoObj> ? EndpointInfoObj : never;
|
|
20
28
|
|
package/signal/slice.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Any, type Assign, type Cls, type MergeAllKeyOfObjects, SLICE_META } from "akanjs/base";
|
|
1
|
+
import { Any, type Assign, type Cls, type MergeAllKeyOfObjects, SLICE_DICT_SHAPE, SLICE_META } from "akanjs/base";
|
|
2
2
|
import { applyMixins } from "akanjs/common";
|
|
3
3
|
import type { DocumentModel, QueryOf } from "akanjs/constant";
|
|
4
4
|
import type { FilterInstance } from "akanjs/document";
|
|
@@ -16,14 +16,22 @@ import {
|
|
|
16
16
|
} from "./sliceInfo";
|
|
17
17
|
import type { CnstFull, CnstInput, CnstInsight, CnstLight, DbFilter, SrvMap, SrvRefName } from "./types";
|
|
18
18
|
|
|
19
|
-
export
|
|
19
|
+
export type SliceDictArgShape = { [key: string]: readonly string[] };
|
|
20
|
+
export type SliceDictShape<SliceInfoObj extends { [key: string]: SliceInfo }> = {
|
|
21
|
+
[K in keyof SliceInfoObj]: SliceInfoArgNames<SliceInfoObj[K]>;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export interface Slice<DictShape extends SliceDictArgShape = Record<never, never>> extends Adaptor {
|
|
25
|
+
readonly [SLICE_DICT_SHAPE]: DictShape;
|
|
26
|
+
}
|
|
20
27
|
|
|
21
28
|
export type SliceCls<
|
|
22
29
|
SrvModule extends ServiceModel = ServiceModel,
|
|
23
30
|
SliceInfoObj extends { [key: string]: SliceInfo } = { [key: string]: SliceInfo },
|
|
24
|
-
> = AdaptorCls & {
|
|
31
|
+
> = AdaptorCls<Slice<SliceDictShape<SliceInfoObj>>> & {
|
|
25
32
|
baseName: SrvRefName<SrvModule>;
|
|
26
33
|
srv: SrvModule;
|
|
34
|
+
prototype: Slice<SliceDictShape<SliceInfoObj>>;
|
|
27
35
|
[SLICE_META]: SliceInfoObj;
|
|
28
36
|
getGuards: GuardCls[];
|
|
29
37
|
cruGuards: GuardCls[];
|
package/types/base/symbols.d.ts
CHANGED
|
@@ -4,6 +4,9 @@ export declare const FILTER_META: unique symbol;
|
|
|
4
4
|
export declare const LOADER_META: unique symbol;
|
|
5
5
|
export declare const INJECT_META: unique symbol;
|
|
6
6
|
export declare const ENDPOINT_META: unique symbol;
|
|
7
|
+
export declare const ENDPOINT_DICT_SHAPE: unique symbol;
|
|
8
|
+
export declare const SLICE_DICT_SHAPE: unique symbol;
|
|
9
|
+
export declare const FILTER_DICT_SHAPE: unique symbol;
|
|
7
10
|
export declare const INTERNAL_META: unique symbol;
|
|
8
11
|
export declare const STATE_META: unique symbol;
|
|
9
12
|
export declare const STATE_INIT_META: unique symbol;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const baseDictionary: import("./dictInfo.d.ts").ServiceDictInfo<[string, string],
|
|
1
|
+
export declare const baseDictionary: import("./dictInfo.d.ts").ServiceDictInfo<[string, string], "ping" | "pingBody" | "pingParam" | "pingQuery" | "wsPing" | "pubsubPing", never, "error" | "save" | "password" | "remove" | "ok" | "connecting" | "failed" | "cancel" | "success" | "edit" | "view" | "somethingWrong" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "unauthorized" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "addModel" | "createModel" | "createSuccess" | "updateModel" | "removeModel" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "actions" | "new">;
|
|
@@ -1,16 +1,29 @@
|
|
|
1
|
-
import type { GetStateObject } from "akanjs/base";
|
|
1
|
+
import type { ENDPOINT_DICT_SHAPE, FILTER_DICT_SHAPE, GetStateObject, SLICE_DICT_SHAPE } from "akanjs/base";
|
|
2
2
|
import type { BaseInsight, BaseObject } from "akanjs/constant";
|
|
3
|
-
import type { BaseFilterQueryKey, BaseFilterSortKey, FilterCls, FilterInfo, FilterInstance } from "akanjs/document";
|
|
4
|
-
import type {
|
|
3
|
+
import type { BaseFilterQueryKey, BaseFilterSortKey, FilterCls, FilterDictShape as FilterCompactShape, FilterDictArgShape, FilterInfo, FilterInstance } from "akanjs/document";
|
|
4
|
+
import type { EndpointCls, EndpointDictShape as EndpointCompactShape, EndpointInfo, SliceCls, SliceDictShape as SliceCompactShape, SliceInfo } from "akanjs/signal";
|
|
5
5
|
import type { RootDictionary } from "./trans.d.ts";
|
|
6
6
|
type EnumValueKey = string | number;
|
|
7
|
-
type
|
|
8
|
-
|
|
7
|
+
type DictArgShape = {
|
|
8
|
+
[key: string]: readonly string[];
|
|
9
|
+
};
|
|
10
|
+
type AnyFilterShape = FilterCompactShape<FilterInstance<Record<string, FilterInfo>, Record<string, unknown>>>;
|
|
11
|
+
type DictFilterShape<Filter> = Filter extends FilterCls<infer FilterShape> ? FilterCompactShape<FilterShape> : Filter extends {
|
|
12
|
+
readonly [FILTER_DICT_SHAPE]: infer CompactShape extends FilterDictArgShape;
|
|
13
|
+
} ? CompactShape : Filter extends FilterInstance ? FilterCompactShape<Filter> : Filter extends {
|
|
9
14
|
query: Record<string, FilterInfo>;
|
|
10
15
|
sort: Record<string, unknown>;
|
|
16
|
+
} ? FilterCompactShape<Filter> : Filter extends {
|
|
17
|
+
query: DictArgShape;
|
|
18
|
+
sort: Record<string, true>;
|
|
11
19
|
} ? Filter : AnyFilterShape;
|
|
12
|
-
type DictSliceShape<Slice> = Slice extends SliceCls<infer _SrvModule, infer SliceInfoObj> ? SliceInfoObj : Slice extends
|
|
13
|
-
|
|
20
|
+
type DictSliceShape<Slice> = Slice extends SliceCls<infer _SrvModule, infer SliceInfoObj> ? SliceCompactShape<SliceInfoObj> : Slice extends {
|
|
21
|
+
readonly [SLICE_DICT_SHAPE]: infer CompactShape extends DictArgShape;
|
|
22
|
+
} ? CompactShape : Slice extends DictArgShape ? Slice : Slice extends Record<string, SliceInfo> ? SliceCompactShape<Slice> : Record<never, never>;
|
|
23
|
+
type DictEndpointShape<Endpoint> = Endpoint extends EndpointCls<infer _SrvModule, infer EndpointInfoObj> ? EndpointCompactShape<EndpointInfoObj> : Endpoint extends {
|
|
24
|
+
readonly [ENDPOINT_DICT_SHAPE]: infer CompactShape extends DictArgShape;
|
|
25
|
+
} ? CompactShape : Endpoint extends DictArgShape ? Endpoint : Endpoint extends Record<string, EndpointInfo> ? EndpointCompactShape<Endpoint> : Record<never, never>;
|
|
26
|
+
type DictArgNames<ArgNames> = ArgNames extends readonly string[] ? ArgNames[number] : never;
|
|
14
27
|
type DictFilterQuery<Filter> = DictFilterShape<Filter>["query"];
|
|
15
28
|
type DictFilterSort<Filter> = DictFilterShape<Filter>["sort"];
|
|
16
29
|
declare class FieldTranslation<Languages extends [string, ...string[]]> {
|
|
@@ -105,7 +118,7 @@ export declare class ModelDictInfo<Languages extends [string, ...string[]] = [st
|
|
|
105
118
|
[K in Exclude<keyof GetStateObject<Insight>, InsightKey>]: FieldTranslation<Languages>;
|
|
106
119
|
}): ModelDictInfo<Languages, ModelKey, keyof GetStateObject<Insight> & string, QueryKey, SortKey, EnumKey, BaseSignalKey, SliceKey, EndpointKey, ErrorKey, EtcKey>;
|
|
107
120
|
query<Filter>(translate: (fn: (trans: Languages) => FunctionTranslation<Languages>) => {
|
|
108
|
-
[K in Exclude<keyof DictFilterQuery<Filter>, QueryKey>]: DictFilterQuery<Filter>[K]
|
|
121
|
+
[K in Exclude<keyof DictFilterQuery<Filter>, QueryKey>]: FunctionTranslation<Languages, DictArgNames<DictFilterQuery<Filter>[K]>>;
|
|
109
122
|
}): ModelDictInfo<Languages, ModelKey, InsightKey, keyof DictFilterQuery<Filter> & string, SortKey, EnumKey, BaseSignalKey, SliceKey, EndpointKey, ErrorKey, EtcKey>;
|
|
110
123
|
sort<Filter>(translate: (t: (trans: Languages) => FieldTranslation<Languages>) => {
|
|
111
124
|
[K in Exclude<keyof DictFilterSort<Filter>, SortKey>]: FieldTranslation<Languages>;
|
|
@@ -117,10 +130,10 @@ export declare class ModelDictInfo<Languages extends [string, ...string[]] = [st
|
|
|
117
130
|
[K in Enum["value"]]: FieldTranslation<Languages>;
|
|
118
131
|
}): ModelDictInfo<Languages, ModelKey, InsightKey, QueryKey, SortKey, EnumKey | Enum["refName"], BaseSignalKey, SliceKey, EndpointKey, ErrorKey, EtcKey>;
|
|
119
132
|
slice<Slice>(translate: (fn: (trans: Languages) => FunctionTranslation<Languages>) => {
|
|
120
|
-
[K in Exclude<keyof DictSliceShape<Slice>, SliceKey>]:
|
|
133
|
+
[K in Exclude<keyof DictSliceShape<Slice>, SliceKey>]: FunctionTranslation<Languages, DictArgNames<DictSliceShape<Slice>[K]>>;
|
|
121
134
|
}): ModelDictInfo<Languages, ModelKey, InsightKey, QueryKey, SortKey, EnumKey, BaseSignalKey, keyof DictSliceShape<Slice> & string, EndpointKey, ErrorKey, EtcKey>;
|
|
122
135
|
endpoint<Endpoint>(translate: (fn: (trans: Languages) => FunctionTranslation<Languages>) => {
|
|
123
|
-
[K in Exclude<keyof DictEndpointShape<Endpoint>, EndpointKey>]:
|
|
136
|
+
[K in Exclude<keyof DictEndpointShape<Endpoint>, EndpointKey>]: FunctionTranslation<Languages, DictArgNames<DictEndpointShape<Endpoint>[K]>>;
|
|
124
137
|
}): ModelDictInfo<Languages, ModelKey, InsightKey, QueryKey, SortKey, EnumKey, BaseSignalKey, SliceKey, keyof DictEndpointShape<Endpoint> & string, ErrorKey, EtcKey>;
|
|
125
138
|
error<ErrorDict extends {
|
|
126
139
|
[key: string]: Languages;
|
|
@@ -196,7 +209,7 @@ export declare class ServiceDictInfo<Languages extends [string, ...string[]] = [
|
|
|
196
209
|
};
|
|
197
210
|
constructor(languages: Languages);
|
|
198
211
|
endpoint<Endpoint>(translate: (fn: (trans: Languages) => FunctionTranslation<Languages>) => {
|
|
199
|
-
[K in keyof DictEndpointShape<Endpoint>]:
|
|
212
|
+
[K in keyof DictEndpointShape<Endpoint>]: FunctionTranslation<Languages, DictArgNames<DictEndpointShape<Endpoint>[K]>>;
|
|
200
213
|
}): ServiceDictInfo<Languages, keyof DictEndpointShape<Endpoint> & string, ErrorKey, EtcKey>;
|
|
201
214
|
error<ErrorDict extends {
|
|
202
215
|
[key: string]: Languages;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { GetStateObject, MergedValues } from "akanjs/base";
|
|
1
|
+
import type { ENDPOINT_DICT_SHAPE, FILTER_DICT_SHAPE, GetStateObject, MergedValues, SLICE_DICT_SHAPE } from "akanjs/base";
|
|
2
2
|
import type { BaseInsight, BaseObject } from "akanjs/constant";
|
|
3
|
-
import type { FilterCls, FilterInfo, FilterInstance } from "akanjs/document";
|
|
4
|
-
import type {
|
|
3
|
+
import type { FilterCls, FilterDictShape as FilterCompactShape, FilterDictArgShape, FilterInfo, FilterInstance } from "akanjs/document";
|
|
4
|
+
import type { EndpointCls, EndpointDictShape as EndpointCompactShape, EndpointInfo, SliceCls, SliceDictShape as SliceCompactShape, SliceInfo, SliceInfoArgNames, SliceInfoRefName } from "akanjs/signal";
|
|
5
5
|
import type { ModelDictInfo, ScalarDictInfo, ServiceDictInfo } from ".";
|
|
6
6
|
interface Trans {
|
|
7
7
|
t: string;
|
|
@@ -17,24 +17,41 @@ interface FnTrans<ArgKey extends string> {
|
|
|
17
17
|
[key in ArgKey]: FieldTrans;
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
|
-
type
|
|
21
|
-
|
|
20
|
+
type DictArgShape = {
|
|
21
|
+
[key: string]: readonly string[];
|
|
22
|
+
};
|
|
23
|
+
type AnyFilterShape = FilterCompactShape<FilterInstance<Record<string, FilterInfo>, Record<string, unknown>>>;
|
|
24
|
+
type DictFilterShape<Filter> = Filter extends FilterCls<infer FilterShape> ? FilterCompactShape<FilterShape> : Filter extends {
|
|
25
|
+
readonly [FILTER_DICT_SHAPE]: infer CompactShape extends FilterDictArgShape;
|
|
26
|
+
} ? CompactShape : Filter extends FilterInstance ? FilterCompactShape<Filter> : Filter extends {
|
|
22
27
|
query: Record<string, FilterInfo>;
|
|
23
28
|
sort: Record<string, unknown>;
|
|
29
|
+
} ? FilterCompactShape<Filter> : Filter extends {
|
|
30
|
+
query: DictArgShape;
|
|
31
|
+
sort: Record<string, true>;
|
|
24
32
|
} ? Filter : AnyFilterShape;
|
|
25
33
|
type DictFilterQuery<Filter> = DictFilterShape<Filter>["query"];
|
|
26
34
|
type DictFilterSort<Filter> = DictFilterShape<Filter>["sort"];
|
|
35
|
+
type DictArgNames<ArgNames> = ArgNames extends readonly string[] ? ArgNames[number] : never;
|
|
36
|
+
type DictEndpointShape<Endpoint> = Endpoint extends EndpointCls<infer _SrvModule, infer EndpointInfoObj> ? EndpointCompactShape<EndpointInfoObj> : Endpoint extends {
|
|
37
|
+
readonly [ENDPOINT_DICT_SHAPE]: infer CompactShape extends DictArgShape;
|
|
38
|
+
} ? CompactShape : Endpoint extends DictArgShape ? Endpoint : Endpoint extends Record<string, EndpointInfo> ? EndpointCompactShape<Endpoint> : Record<never, never>;
|
|
39
|
+
type DictSliceShape<Slice> = Slice extends SliceCls<infer _SrvModule, infer SliceInfoObj> ? SliceCompactShape<SliceInfoObj> : Slice extends {
|
|
40
|
+
readonly [SLICE_DICT_SHAPE]: infer CompactShape extends DictArgShape;
|
|
41
|
+
} ? CompactShape : Slice extends DictArgShape ? Slice : Slice extends Record<string, SliceInfo> ? SliceCompactShape<Slice> : Record<never, never>;
|
|
27
42
|
type FilterTranslatorKey<Filter> = {
|
|
28
|
-
[Key in keyof DictFilterQuery<Filter> & string]: `${Key}` | `${Key}.desc` | (DictFilterQuery<Filter>[Key]
|
|
43
|
+
[Key in keyof DictFilterQuery<Filter> & string]: `${Key}` | `${Key}.desc` | (DictArgNames<DictFilterQuery<Filter>[Key]> extends string ? `${Key}.arg.${DictArgNames<DictFilterQuery<Filter>[Key]>}` | `${Key}.arg.${DictArgNames<DictFilterQuery<Filter>[Key]>}.desc` : never);
|
|
29
44
|
}[keyof DictFilterQuery<Filter> & string];
|
|
30
|
-
type EndpointTranslatorKey<Endpoint
|
|
31
|
-
[
|
|
32
|
-
}>
|
|
33
|
-
|
|
34
|
-
}[keyof Endpoint & string];
|
|
35
|
-
type SliceTranslatorKey<Slice> = {
|
|
45
|
+
type EndpointTranslatorKey<Endpoint> = {
|
|
46
|
+
[Key in keyof DictEndpointShape<Endpoint> & string]: `${Key}` | `${Key}.desc` | `${Key}.arg.${DictArgNames<DictEndpointShape<Endpoint>[Key]>}` | `${Key}.arg.${DictArgNames<DictEndpointShape<Endpoint>[Key]>}.desc`;
|
|
47
|
+
}[keyof DictEndpointShape<Endpoint> & string];
|
|
48
|
+
type FullSliceTranslatorKey<Slice> = {
|
|
36
49
|
[Key in keyof Slice & string]: Slice[Key] extends infer Info extends SliceInfo ? `${SliceInfoRefName<Info>}List${Capitalize<Key>}` | `${SliceInfoRefName<Info>}List${Capitalize<Key>}.desc` | `${SliceInfoRefName<Info>}List${Capitalize<Key>}.arg.${SliceInfoArgNames<Info>[number] | "skip" | "limit" | "sort"}` | `${SliceInfoRefName<Info>}List${Capitalize<Key>}.arg.${SliceInfoArgNames<Info>[number] | "skip" | "limit" | "sort"}.desc` | `${SliceInfoRefName<Info>}Insight${Capitalize<Key>}` | `${SliceInfoRefName<Info>}Insight${Capitalize<Key>}.desc` | `${SliceInfoRefName<Info>}Insight${Capitalize<Key>}.arg.${SliceInfoArgNames<Info>[number]}` | `${SliceInfoRefName<Info>}Insight${Capitalize<Key>}.arg.${SliceInfoArgNames<Info>[number]}.desc` : never;
|
|
37
50
|
}[keyof Slice & string];
|
|
51
|
+
type CompactSliceTranslatorKey<T extends string, Slice> = {
|
|
52
|
+
[Key in keyof DictSliceShape<Slice> & string]: Key extends "" ? never : `${T}List${Capitalize<Key>}` | `${T}List${Capitalize<Key>}.desc` | `${T}List${Capitalize<Key>}.arg.${DictArgNames<DictSliceShape<Slice>[Key]> | "skip" | "limit" | "sort"}` | `${T}List${Capitalize<Key>}.arg.${DictArgNames<DictSliceShape<Slice>[Key]> | "skip" | "limit" | "sort"}.desc` | `${T}Insight${Capitalize<Key>}` | `${T}Insight${Capitalize<Key>}.desc` | `${T}Insight${Capitalize<Key>}.arg.${DictArgNames<DictSliceShape<Slice>[Key]>}` | `${T}Insight${Capitalize<Key>}.arg.${DictArgNames<DictSliceShape<Slice>[Key]>}.desc`;
|
|
53
|
+
}[keyof DictSliceShape<Slice> & string];
|
|
54
|
+
type SliceTranslatorKey<T extends string, Slice> = Slice extends Record<string, SliceInfo> ? FullSliceTranslatorKey<Slice> : CompactSliceTranslatorKey<T, Slice>;
|
|
38
55
|
type SliceApiTrans<T extends string, Suffix extends string, ArgName extends string, _CapitalizedSuffix extends string = Capitalize<Suffix>> = {
|
|
39
56
|
[K in `${T}List${_CapitalizedSuffix}`]: FnTrans<ArgName | "skip" | "limit" | "sort">;
|
|
40
57
|
} & {
|
|
@@ -51,11 +68,7 @@ type BaseModelCrudGetApiTrans<T extends string> = {
|
|
|
51
68
|
} & {
|
|
52
69
|
[K in `remove${T}`]: FnTrans<`${T}Id`>;
|
|
53
70
|
};
|
|
54
|
-
export type ModelTrans<T extends string, Model extends BaseObject, Insight extends BaseInsight, Filter, Slice extends {
|
|
55
|
-
[key: string]: SliceInfo;
|
|
56
|
-
}, Endpoint extends {
|
|
57
|
-
[key: string]: EndpointInfo;
|
|
58
|
-
}, ErrorKey extends string, EtcKey extends string> = {
|
|
71
|
+
export type ModelTrans<T extends string, Model extends BaseObject, Insight extends BaseInsight, Filter, Slice, Endpoint, ErrorKey extends string, EtcKey extends string> = {
|
|
59
72
|
modelName: Trans;
|
|
60
73
|
modelDesc: Trans;
|
|
61
74
|
model: {
|
|
@@ -65,15 +78,15 @@ export type ModelTrans<T extends string, Model extends BaseObject, Insight exten
|
|
|
65
78
|
[K in keyof GetStateObject<Insight>]: FieldTrans;
|
|
66
79
|
};
|
|
67
80
|
query: {
|
|
68
|
-
[K in keyof DictFilterQuery<Filter>]: DictFilterQuery<Filter>[K]
|
|
81
|
+
[K in keyof DictFilterQuery<Filter>]: FnTrans<DictArgNames<DictFilterQuery<Filter>[K]>>;
|
|
69
82
|
};
|
|
70
83
|
sort: {
|
|
71
84
|
[K in keyof DictFilterSort<Filter>]: FieldTrans;
|
|
72
85
|
};
|
|
73
86
|
api: {
|
|
74
|
-
[K in keyof Endpoint]: FnTrans<
|
|
87
|
+
[K in keyof DictEndpointShape<Endpoint>]: FnTrans<DictArgNames<DictEndpointShape<Endpoint>[K]>>;
|
|
75
88
|
} & BaseModelCrudGetApiTrans<T> & MergedValues<{
|
|
76
|
-
[K in keyof Slice]: SliceApiTrans<
|
|
89
|
+
[K in keyof DictSliceShape<Slice>]: SliceApiTrans<T, K & string, DictArgNames<DictSliceShape<Slice>[K]>>;
|
|
77
90
|
}>;
|
|
78
91
|
error: {
|
|
79
92
|
[K in ErrorKey]: Trans;
|
|
@@ -81,11 +94,7 @@ export type ModelTrans<T extends string, Model extends BaseObject, Insight exten
|
|
|
81
94
|
} & {
|
|
82
95
|
[K in EtcKey]: Trans;
|
|
83
96
|
};
|
|
84
|
-
export type ModelTranslatorKey<T extends string, Model, Insight, Filter, Slice extends {
|
|
85
|
-
[key: string]: SliceInfo;
|
|
86
|
-
}, Endpoint extends {
|
|
87
|
-
[key: string]: EndpointInfo;
|
|
88
|
-
}, EtcKey extends string> = `${T}.modelName` | `${T}.modelDesc` | `${T}.${keyof GetStateObject<Model> & string}${"" | ".desc"}` | `${T}.insight.${keyof GetStateObject<Insight> & string}${"" | ".desc"}` | `${T}.query.${FilterTranslatorKey<Filter>}` | `${T}.sort.${keyof DictFilterSort<Filter> & string}${"" | ".desc"}` | `${T}.signal.${EndpointTranslatorKey<Endpoint> | SliceTranslatorKey<Slice>}` | `${T}.${EtcKey}`;
|
|
97
|
+
export type ModelTranslatorKey<T extends string, Model, Insight, Filter, Slice, Endpoint, EtcKey extends string> = `${T}.modelName` | `${T}.modelDesc` | `${T}.${keyof GetStateObject<Model> & string}${"" | ".desc"}` | `${T}.insight.${keyof GetStateObject<Insight> & string}${"" | ".desc"}` | `${T}.query.${FilterTranslatorKey<Filter>}` | `${T}.sort.${keyof DictFilterSort<Filter> & string}${"" | ".desc"}` | `${T}.signal.${EndpointTranslatorKey<Endpoint> | SliceTranslatorKey<T, Slice>}` | `${T}.${EtcKey}`;
|
|
89
98
|
export type ScalarTrans<_T extends string, Model, ErrorKey extends string, EtcKey extends string> = {
|
|
90
99
|
name: Trans;
|
|
91
100
|
desc: Trans;
|
|
@@ -99,11 +108,9 @@ export type ScalarTrans<_T extends string, Model, ErrorKey extends string, EtcKe
|
|
|
99
108
|
[K in EtcKey]: Trans;
|
|
100
109
|
};
|
|
101
110
|
export type ScalarTranslatorKey<T extends string, Model, EtcKey extends string> = `${T}.modelName` | `${T}.modelDesc` | `${T}.${keyof GetStateObject<Model> & string}${"" | ".desc"}` | `${T}.${EtcKey}`;
|
|
102
|
-
export type ServiceTrans<_T extends string, Endpoint extends {
|
|
103
|
-
[key: string]: EndpointInfo;
|
|
104
|
-
}, ErrorKey extends string, EtcKey extends string> = {
|
|
111
|
+
export type ServiceTrans<_T extends string, Endpoint, ErrorKey extends string, EtcKey extends string> = {
|
|
105
112
|
api: {
|
|
106
|
-
[K in keyof Endpoint]: FnTrans<
|
|
113
|
+
[K in keyof DictEndpointShape<Endpoint>]: FnTrans<DictArgNames<DictEndpointShape<Endpoint>[K]>>;
|
|
107
114
|
};
|
|
108
115
|
error: {
|
|
109
116
|
[K in ErrorKey]: Trans;
|
|
@@ -111,9 +118,7 @@ export type ServiceTrans<_T extends string, Endpoint extends {
|
|
|
111
118
|
} & {
|
|
112
119
|
[K in EtcKey]: Trans;
|
|
113
120
|
};
|
|
114
|
-
export type ServiceTranslatorKey<T extends string, Endpoint extends {
|
|
115
|
-
[key: string]: EndpointInfo;
|
|
116
|
-
}, EtcKey extends string> = `${T}.signal.${EndpointTranslatorKey<Endpoint>}` | `${T}.${EtcKey}`;
|
|
121
|
+
export type ServiceTranslatorKey<T extends string, Endpoint, EtcKey extends string> = `${T}.signal.${EndpointTranslatorKey<Endpoint>}` | `${T}.${EtcKey}`;
|
|
117
122
|
export type EnumTrans<EnumValue extends string | number> = {
|
|
118
123
|
[key in EnumValue]: Trans;
|
|
119
124
|
};
|
|
@@ -123,13 +128,7 @@ export interface DictModule<DictKey extends string, ErrorKey extends string> {
|
|
|
123
128
|
__Error_Key__: ErrorKey;
|
|
124
129
|
dict: ModelDictInfo<[string, ...string[]]> | ScalarDictInfo<[string, ...string[]]> | ServiceDictInfo<[string, ...string[]]>;
|
|
125
130
|
}
|
|
126
|
-
export declare const registerModelTrans: <RefName extends string, Model extends BaseObject, Insight extends BaseInsight, Filter, Slice extends {
|
|
127
|
-
[key: string]: SliceInfo;
|
|
128
|
-
}, Endpoint extends {
|
|
129
|
-
[key: string]: EndpointInfo;
|
|
130
|
-
}, ModelDict>(modelDict: ModelDict) => ModelDict extends ModelDictInfo<infer _Languages, infer _ModelKey, infer _InsightKey, infer _QueryKey, infer _SortKey, infer EnumKey, infer _BaseSignalKey, infer _SliceKey, infer _EndpointKey, infer ErrorKey, infer EtcKey> ? DictModule<ModelTranslatorKey<RefName, Model, Insight, Filter, Slice, Endpoint, EtcKey> | EnumTranslatorKey<EnumKey>, `${RefName}.error.${ErrorKey}`> : never;
|
|
131
|
+
export declare const registerModelTrans: <RefName extends string, Model extends BaseObject, Insight extends BaseInsight, Filter, Slice, Endpoint, ModelDict>(modelDict: ModelDict) => ModelDict extends ModelDictInfo<infer _Languages, infer _ModelKey, infer _InsightKey, infer _QueryKey, infer _SortKey, infer EnumKey, infer _BaseSignalKey, infer _SliceKey, infer _EndpointKey, infer ErrorKey, infer EtcKey> ? DictModule<ModelTranslatorKey<RefName, Model, Insight, Filter, Slice, Endpoint, EtcKey> | EnumTranslatorKey<EnumKey>, `${RefName}.error.${ErrorKey}`> : never;
|
|
131
132
|
export declare const registerScalarTrans: <T extends string, Model, ScalarDict>(scalarDict: ScalarDict) => ScalarDict extends ScalarDictInfo<infer _Languages, infer _ModelKey, infer EnumKey, infer ErrorKey, infer EtcKey> ? DictModule<ScalarTranslatorKey<T, Model, EtcKey> | EnumTranslatorKey<EnumKey>, `${T}.error.${ErrorKey}`> : never;
|
|
132
|
-
export declare const registerServiceTrans: <T extends string, Endpoint extends {
|
|
133
|
-
[key: string]: EndpointInfo;
|
|
134
|
-
}, ServiceDict>(serviceDict: ServiceDict) => ServiceDict extends ServiceDictInfo<infer _Languages, infer _EndpointKey, infer ErrorKey, infer EtcKey> ? DictModule<ServiceTranslatorKey<T, Endpoint, EtcKey>, `${T}.error.${ErrorKey}`> : never;
|
|
133
|
+
export declare const registerServiceTrans: <T extends string, Endpoint, ServiceDict>(serviceDict: ServiceDict) => ServiceDict extends ServiceDictInfo<infer _Languages, infer _EndpointKey, infer ErrorKey, infer EtcKey> ? DictModule<ServiceTranslatorKey<T, Endpoint, EtcKey>, `${T}.error.${ErrorKey}`> : never;
|
|
135
134
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Cls, MergeAllDoubleKeyOfObjects, MergeAllKeyOfTypes } from "akanjs/base";
|
|
2
|
-
import { FILTER_META } from "akanjs/base";
|
|
2
|
+
import { FILTER_DICT_SHAPE, FILTER_META } from "akanjs/base";
|
|
3
3
|
import type { BaseObject, ConstantFieldTypeInput, DocumentModel, FieldToValue, PlainTypeToFieldType, QueryOf, Serialized } from "akanjs/constant";
|
|
4
4
|
import type { DocumentQuery, DocumentQueryHelper } from "./documentQuery.d.ts";
|
|
5
5
|
import type { ConstantFilterMeta } from "./types.d.ts";
|
|
@@ -30,6 +30,25 @@ export type FilterInstance<Query extends {
|
|
|
30
30
|
query: Query;
|
|
31
31
|
sort: Sort;
|
|
32
32
|
};
|
|
33
|
+
export type FilterDictArgShape = {
|
|
34
|
+
query: {
|
|
35
|
+
[key: string]: readonly string[];
|
|
36
|
+
};
|
|
37
|
+
sort: {
|
|
38
|
+
[key: string]: true;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
export type FilterDictShape<Filter extends FilterInstance> = {
|
|
42
|
+
query: {
|
|
43
|
+
[K in keyof Filter["query"]]: Filter["query"][K] extends FilterInfo<infer ArgNames, infer _Args, infer _Model> ? ArgNames : never;
|
|
44
|
+
};
|
|
45
|
+
sort: {
|
|
46
|
+
[K in keyof Filter["sort"]]: true;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
export interface FilterDictShapeCarrier<DictShape extends FilterDictArgShape = FilterDictArgShape> {
|
|
50
|
+
readonly [FILTER_DICT_SHAPE]: DictShape;
|
|
51
|
+
}
|
|
33
52
|
interface BaseQuery<Model> {
|
|
34
53
|
any: FilterInfo<[], [], Model>;
|
|
35
54
|
}
|
|
@@ -53,10 +72,13 @@ export type ExtractQuery<Filter extends FilterInstance> = {
|
|
|
53
72
|
[K in keyof Filter["query"]]: Filter["query"][K] extends FilterInfo<any, infer Args> ? (...args: Args) => QueryOf<any> : never;
|
|
54
73
|
};
|
|
55
74
|
export type ExtractSort<Filter extends FilterInstance> = keyof Filter["sort"];
|
|
56
|
-
export interface FilterCls<Filter extends FilterInstance = any, Query = unknown, Sort = unknown> extends Cls<{
|
|
57
|
-
[key: string]:
|
|
75
|
+
export interface FilterCls<Filter extends FilterInstance = any, Query = unknown, Sort = unknown> extends Cls<FilterDictShapeCarrier<FilterDictShape<Filter>> & {
|
|
76
|
+
[key: string]: unknown;
|
|
58
77
|
}> {
|
|
59
78
|
[FILTER_META]: Filter;
|
|
79
|
+
prototype: FilterDictShapeCarrier<FilterDictShape<Filter>> & {
|
|
80
|
+
[key: string]: unknown;
|
|
81
|
+
};
|
|
60
82
|
sortField: Set<string>;
|
|
61
83
|
_Query: Query;
|
|
62
84
|
_Sort: Sort;
|
|
@@ -1,19 +1,29 @@
|
|
|
1
1
|
import type { Assign } from "akanjs/base";
|
|
2
|
-
import { ENDPOINT_META } from "akanjs/base";
|
|
2
|
+
import { ENDPOINT_DICT_SHAPE, ENDPOINT_META } from "akanjs/base";
|
|
3
3
|
import { type Adaptor, type AdaptorCls, type ServiceModel } from "akanjs/service";
|
|
4
|
-
import { type EndpointBuilder, type EndpointInfo } from "./endpointInfo.d.ts";
|
|
4
|
+
import { type EndpInfoArgNames, type EndpointBuilder, type EndpointInfo } from "./endpointInfo.d.ts";
|
|
5
5
|
import type { SrvRefName } from "./types.d.ts";
|
|
6
|
-
export
|
|
6
|
+
export type EndpointDictArgShape = {
|
|
7
|
+
[key: string]: readonly string[];
|
|
8
|
+
};
|
|
9
|
+
export type EndpointDictShape<EndpointInfoObj extends {
|
|
10
|
+
[key: string]: EndpointInfo;
|
|
11
|
+
}> = {
|
|
12
|
+
[K in keyof EndpointInfoObj]: EndpInfoArgNames<EndpointInfoObj[K]>;
|
|
13
|
+
};
|
|
14
|
+
export interface Endpoint<DictShape extends EndpointDictArgShape = Record<never, never>> extends Adaptor {
|
|
15
|
+
readonly [ENDPOINT_DICT_SHAPE]: DictShape;
|
|
7
16
|
}
|
|
8
|
-
export
|
|
17
|
+
export type EndpointCls<SrvModule extends ServiceModel = ServiceModel, EndpointInfoObj extends {
|
|
9
18
|
[key: string]: EndpointInfo;
|
|
10
19
|
} = {
|
|
11
20
|
[key: string]: EndpointInfo;
|
|
12
|
-
}>
|
|
21
|
+
}> = AdaptorCls<Endpoint<EndpointDictShape<EndpointInfoObj>>> & {
|
|
13
22
|
baseName: SrvRefName<SrvModule>;
|
|
14
23
|
srv: SrvModule;
|
|
24
|
+
prototype: Endpoint<EndpointDictShape<EndpointInfoObj>>;
|
|
15
25
|
[ENDPOINT_META]: EndpointInfoObj;
|
|
16
|
-
}
|
|
26
|
+
};
|
|
17
27
|
type EndpointMetaOf<EndpCls> = EndpCls extends EndpointCls<any, infer EndpointInfoObj> ? EndpointInfoObj : never;
|
|
18
28
|
type MergeEndpointMetas<EndpClses extends readonly EndpointCls[], Acc = unknown> = EndpClses extends readonly [
|
|
19
29
|
infer First extends EndpointCls,
|
|
@@ -30,20 +30,8 @@ export declare class ServiceSignal<IntlCls extends InternalCls = InternalCls, En
|
|
|
30
30
|
export declare class SignalRegistry {
|
|
31
31
|
#private;
|
|
32
32
|
static registerDatabase<RefName extends string, IntlCls extends InternalCls, EndpCls extends EndpointCls, SlceCls extends SliceCls, SrvrCls extends ServerSignalCls>(refName: RefName, internal: SignalWithBase<RefName, IntlCls>, endpoint: SignalWithBase<RefName, EndpCls>, slice: SignalWithBase<RefName, SlceCls>, server: SrvrCls): DatabaseSignal<IntlCls, EndpCls, SlceCls, SrvrCls>;
|
|
33
|
-
static getDatabase(refName: string): DatabaseSignal<InternalCls, EndpointCls
|
|
34
|
-
[x: `${Uncapitalize<string>}Service`]: import("../service.d.ts").ExtractInjectInfoObject<{}> & import("../service.d.ts").Service;
|
|
35
|
-
}>, {
|
|
36
|
-
[key: string]: import("./endpointInfo.d.ts").EndpointInfo<import("./endpointInfo.d.ts").EndpointType, {
|
|
37
|
-
[key: string]: any;
|
|
38
|
-
}, any, any, any, any, import("../constant.d.ts").ConstantFieldTypeInput, never, never, boolean>;
|
|
39
|
-
}>, SliceCls, ServerSignalCls> | undefined;
|
|
33
|
+
static getDatabase(refName: string): DatabaseSignal<InternalCls, EndpointCls, SliceCls, ServerSignalCls> | undefined;
|
|
40
34
|
static registerService<RefName extends string, IntlCls extends InternalCls, EndpCls extends EndpointCls, SrvrCls extends ServerSignalCls>(refName: RefName, internal: SignalWithBase<RefName, IntlCls>, endpoint: SignalWithBase<RefName, EndpCls>, server: SrvrCls): ServiceSignal<IntlCls, EndpCls, SrvrCls>;
|
|
41
|
-
static getService(refName: string): ServiceSignal<InternalCls, EndpointCls
|
|
42
|
-
[x: `${Uncapitalize<string>}Service`]: import("../service.d.ts").ExtractInjectInfoObject<{}> & import("../service.d.ts").Service;
|
|
43
|
-
}>, {
|
|
44
|
-
[key: string]: import("./endpointInfo.d.ts").EndpointInfo<import("./endpointInfo.d.ts").EndpointType, {
|
|
45
|
-
[key: string]: any;
|
|
46
|
-
}, any, any, any, any, import("../constant.d.ts").ConstantFieldTypeInput, never, never, boolean>;
|
|
47
|
-
}>, ServerSignalCls> | undefined;
|
|
35
|
+
static getService(refName: string): ServiceSignal<InternalCls, EndpointCls, ServerSignalCls> | undefined;
|
|
48
36
|
}
|
|
49
37
|
export {};
|
package/types/signal/slice.d.ts
CHANGED
|
@@ -1,19 +1,29 @@
|
|
|
1
|
-
import { type Assign, type Cls, type MergeAllKeyOfObjects, SLICE_META } from "akanjs/base";
|
|
1
|
+
import { type Assign, type Cls, type MergeAllKeyOfObjects, SLICE_DICT_SHAPE, SLICE_META } from "akanjs/base";
|
|
2
2
|
import type { DocumentModel, QueryOf } from "akanjs/constant";
|
|
3
3
|
import type { FilterInstance } from "akanjs/document";
|
|
4
4
|
import { type Adaptor, type AdaptorCls, type ServiceModel } from "akanjs/service";
|
|
5
5
|
import type { Guard, GuardCls } from "./guard.d.ts";
|
|
6
6
|
import { type SliceBuilder, type SliceInfo, type SliceInfoArgNames, type SliceInfoArgs, type SliceInfoInternalArgs, type SliceInfoServerArgs, type SliceInfoSrvs } from "./sliceInfo.d.ts";
|
|
7
7
|
import type { CnstFull, CnstInput, CnstInsight, CnstLight, DbFilter, SrvMap, SrvRefName } from "./types.d.ts";
|
|
8
|
-
export
|
|
8
|
+
export type SliceDictArgShape = {
|
|
9
|
+
[key: string]: readonly string[];
|
|
10
|
+
};
|
|
11
|
+
export type SliceDictShape<SliceInfoObj extends {
|
|
12
|
+
[key: string]: SliceInfo;
|
|
13
|
+
}> = {
|
|
14
|
+
[K in keyof SliceInfoObj]: SliceInfoArgNames<SliceInfoObj[K]>;
|
|
15
|
+
};
|
|
16
|
+
export interface Slice<DictShape extends SliceDictArgShape = Record<never, never>> extends Adaptor {
|
|
17
|
+
readonly [SLICE_DICT_SHAPE]: DictShape;
|
|
9
18
|
}
|
|
10
19
|
export type SliceCls<SrvModule extends ServiceModel = ServiceModel, SliceInfoObj extends {
|
|
11
20
|
[key: string]: SliceInfo;
|
|
12
21
|
} = {
|
|
13
22
|
[key: string]: SliceInfo;
|
|
14
|
-
}> = AdaptorCls & {
|
|
23
|
+
}> = AdaptorCls<Slice<SliceDictShape<SliceInfoObj>>> & {
|
|
15
24
|
baseName: SrvRefName<SrvModule>;
|
|
16
25
|
srv: SrvModule;
|
|
26
|
+
prototype: Slice<SliceDictShape<SliceInfoObj>>;
|
|
17
27
|
[SLICE_META]: SliceInfoObj;
|
|
18
28
|
getGuards: GuardCls[];
|
|
19
29
|
cruGuards: GuardCls[];
|