akanjs 2.3.8-rc.2 → 2.3.8-rc.4

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.
@@ -1,7 +1,6 @@
1
1
  import type { Database } from "bun:sqlite";
2
- import type { Dayjs } from "akanjs/base";
3
2
  import { adapt } from "../adapt";
4
- import type { CacheAdaptor } from "./cache.adaptor";
3
+ import type { CacheAdaptor, CacheSetOptions } from "./cache.adaptor";
5
4
  import {
6
5
  decodeSolidValue,
7
6
  encodeSolidValue,
@@ -62,7 +61,7 @@ export class SolidCache
62
61
  this.#db?.close();
63
62
  }
64
63
 
65
- async set(topic: string, key: string, value: string | number | Buffer, option: { expireAt?: Dayjs } = {}) {
64
+ async set(topic: string, key: string, value: string | number | Buffer, option: CacheSetOptions = {}) {
66
65
  const encoded = encodeSolidValue(value);
67
66
  const now = Date.now();
68
67
  this.#db
@@ -99,7 +98,7 @@ export class SolidCache
99
98
  key: string,
100
99
  subKey: string,
101
100
  value: string | number | Buffer,
102
- option: { expireAt?: Dayjs } = {},
101
+ option: CacheSetOptions = {},
103
102
  ) {
104
103
  const encoded = encodeSolidValue(value);
105
104
  const now = Date.now();
@@ -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 interface Endpoint extends Adaptor {}
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 EndpointCls<
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
- > extends AdaptorCls {
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 interface Slice extends Adaptor {}
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[];
@@ -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], string, 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
+ 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 { EndpInfoArgNames, EndpointCls, EndpointInfo, SliceCls, SliceInfo, SliceInfoArgNames } from "akanjs/signal";
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 AnyFilterShape = FilterInstance<Record<string, FilterInfo>, Record<string, unknown>>;
8
- type DictFilterShape<Filter> = Filter extends FilterCls<infer FilterShape> ? FilterShape : Filter extends FilterInstance ? Filter : Filter extends {
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 Record<string, SliceInfo> ? Slice : Record<never, never>;
13
- type DictEndpointShape<Endpoint> = Endpoint extends EndpointCls<infer _SrvModule, infer EndpointInfoObj> ? EndpointInfoObj : Endpoint extends Record<string, EndpointInfo> ? Endpoint : Record<never, never>;
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] extends FilterInfo<infer ArgNames, infer _Args, infer _Model> ? FunctionTranslation<Languages, ArgNames[number]> : never;
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>]: DictSliceShape<Slice>[K] extends infer Info extends SliceInfo ? FunctionTranslation<Languages, SliceInfoArgNames<Info>[number]> : never;
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>]: DictEndpointShape<Endpoint>[K] extends infer Info extends EndpointInfo ? FunctionTranslation<Languages, EndpInfoArgNames<Info>[number]> : never;
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>]: DictEndpointShape<Endpoint>[K] extends infer Info extends EndpointInfo ? FunctionTranslation<Languages, EndpInfoArgNames<Info>[number]> : never;
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 { EndpInfoArgNames, EndpointInfo, SliceInfo, SliceInfoArgNames, SliceInfoRefName } from "akanjs/signal";
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 AnyFilterShape = FilterInstance<Record<string, FilterInfo>, Record<string, unknown>>;
21
- type DictFilterShape<Filter> = Filter extends FilterCls<infer FilterShape> ? FilterShape : Filter extends FilterInstance ? Filter : Filter extends {
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] extends FilterInfo<infer ArgNames, infer _Args> ? ArgNames[number] extends string ? `${Key}.arg.${ArgNames[number]}` | `${Key}.arg.${ArgNames[number]}.desc` : never : never);
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 extends {
31
- [key: string]: EndpointInfo;
32
- }> = {
33
- [Key in keyof Endpoint & string]: `${Key}` | `${Key}.desc` | `${Key}.arg.${EndpInfoArgNames<Endpoint[Key]>[number]}` | `${Key}.arg.${EndpInfoArgNames<Endpoint[Key]>[number]}.desc`;
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] extends FilterInfo<infer ArgNames, infer _Args> ? FnTrans<ArgNames[number]> : never;
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<EndpInfoArgNames<Endpoint[K]>[number]>;
87
+ [K in keyof DictEndpointShape<Endpoint>]: FnTrans<DictArgNames<DictEndpointShape<Endpoint>[K]>>;
75
88
  } & BaseModelCrudGetApiTrans<T> & MergedValues<{
76
- [K in keyof Slice]: SliceApiTrans<SliceInfoRefName<Slice[K]>, K & string, SliceInfoArgNames<Slice[K]>[number]>;
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<EndpInfoArgNames<Endpoint[K]>[number]>;
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,20 +1,17 @@
1
- import type { Dayjs, MergedValues, PromiseOrObject } from "akanjs/base";
1
+ import type { MergedValues, PromiseOrObject } from "akanjs/base";
2
2
  import { Logger } from "akanjs/common";
3
3
  import type { DocumentModel, QueryOf } from "akanjs/constant";
4
- import type { CacheAdaptor } from "akanjs/service";
4
+ import type { CacheAdaptor, CacheSetOptions } from "akanjs/service";
5
5
  import type { DataLoader } from "./dataLoader.d.ts";
6
6
  import type { ExtractQuery, ExtractSort, FilterInstance } from "./filterMeta.d.ts";
7
7
  import type { CRUDEventType, Mdl, SaveEventType } from "./into.d.ts";
8
8
  import type { DataInputOf, FindQueryOption, ListQueryOption } from "./types.d.ts";
9
- export interface RedisSetOptions {
10
- expireAt?: Dayjs;
11
- }
12
9
  export declare class CacheDatabase<T = unknown> {
13
10
  private readonly refName;
14
11
  private readonly cache;
15
12
  private logger;
16
13
  constructor(refName: string, cache: CacheAdaptor);
17
- set(topic: string, key: string, value: string | number | Buffer, option?: RedisSetOptions): Promise<void>;
14
+ set(topic: string, key: string, value: string | number | Buffer, option?: CacheSetOptions): Promise<void>;
18
15
  get<T extends string | number | Buffer>(topic: string, key: string): Promise<T | undefined>;
19
16
  delete(topic: string, key: string): Promise<void>;
20
17
  }
@@ -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]: any;
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;
@@ -3,6 +3,7 @@ import { type ConstantFieldTypeInput, type FieldToValue, type PlainTypeToFieldTy
3
3
  import type { DatabaseModel } from "akanjs/document";
4
4
  import type { Endpoint, EndpointCls, Internal, InternalCls, ServerSignal, ServerSignalCls, SliceCls } from "akanjs/signal";
5
5
  import type { Adaptor, AdaptorCls, Service, ServiceCls } from ".";
6
+ import type { CacheSetOptions } from "./predefinedAdaptor.d.ts";
6
7
  export type InjectType = "database" | "service" | "use" | "signal" | "plug" | "env" | "memory";
7
8
  interface InjectBuilderOptions<ReturnType> {
8
9
  generateFactory?: (options: any) => ReturnType;
@@ -13,6 +14,7 @@ interface InjectBuilderOptions<ReturnType> {
13
14
  local?: boolean;
14
15
  default?: unknown;
15
16
  isMap?: boolean;
17
+ cacheOption?: CacheSetOptions;
16
18
  parentRefName: string;
17
19
  }
18
20
  export interface InjectRegistry {
@@ -55,6 +57,7 @@ export declare class InjectInfo<Type extends InjectType = any, ReturnType = any,
55
57
  readonly adaptor?: AdaptorCls;
56
58
  readonly default?: unknown;
57
59
  readonly isMap?: boolean;
60
+ readonly cacheOption?: CacheSetOptions;
58
61
  readonly parentRefName: string;
59
62
  constructor(type: Type, options: InjectBuilderOptions<ReturnType>);
60
63
  static resolveInjection(instance: Adaptor | Service, applyCls: AdaptorCls | ServiceCls, registry: InjectRegistry, env: BaseEnv): Promise<void>;
@@ -73,21 +76,22 @@ export declare const injectionBuilder: (parentRefName: string) => {
73
76
  local?: Local;
74
77
  default?: DefaultValue;
75
78
  of?: MapValue;
79
+ expireAt?: CacheSetOptions["expireAt"];
76
80
  get?: GetFn;
77
81
  set?: (value: ReturnType<GetFn>) => GetFieldValue<ValueRef, ExplicitType>;
78
82
  }) => InjectInfo<"memory", Local extends true ? MapConstructor extends ValueRef ? Map<string, FieldToValue<MapValue>> : (DefaultValue extends never ? true : false) extends true ? (never extends GetFn ? GetFieldValue<ValueRef, ExplicitType, MapValue> : ReturnType<GetFn>) | null : never extends GetFn ? GetFieldValue<ValueRef, ExplicitType, MapValue> : ReturnType<GetFn> : MapConstructor extends ValueRef ? {
79
83
  get: (key: string) => Promise<(never extends GetFn ? FieldToValue<MapValue> : ReturnType<GetFn>) | undefined>;
80
- set: (key: string, value: never extends GetFn ? FieldToValue<MapValue> : ReturnType<GetFn>) => Promise<void>;
84
+ set: (key: string, value: never extends GetFn ? FieldToValue<MapValue> : ReturnType<GetFn>, option?: CacheSetOptions) => Promise<void>;
81
85
  delete: (key: string) => Promise<void>;
82
- getOrInsert: (key: string, value: never extends GetFn ? FieldToValue<MapValue> : ReturnType<GetFn>) => Promise<never extends GetFn ? FieldToValue<MapValue> : ReturnType<GetFn>>;
83
- getOrInsertComputed: (key: string, compute: (key: string) => (never extends GetFn ? FieldToValue<MapValue> : ReturnType<GetFn>) | Promise<never extends GetFn ? FieldToValue<MapValue> : ReturnType<GetFn>>) => Promise<never extends GetFn ? FieldToValue<MapValue> : ReturnType<GetFn>>;
86
+ getOrInsert: (key: string, value: never extends GetFn ? FieldToValue<MapValue> : ReturnType<GetFn>, option?: CacheSetOptions) => Promise<never extends GetFn ? FieldToValue<MapValue> : ReturnType<GetFn>>;
87
+ getOrInsertComputed: (key: string, compute: (key: string) => (never extends GetFn ? FieldToValue<MapValue> : ReturnType<GetFn>) | Promise<never extends GetFn ? FieldToValue<MapValue> : ReturnType<GetFn>>, option?: CacheSetOptions) => Promise<never extends GetFn ? FieldToValue<MapValue> : ReturnType<GetFn>>;
84
88
  keys: () => Promise<string[]>;
85
89
  entries: () => Promise<[string, never extends GetFn ? FieldToValue<MapValue> : ReturnType<GetFn>][]>;
86
90
  forEach: (callback: (value: never extends GetFn ? FieldToValue<MapValue> : ReturnType<GetFn>, key: string) => void | Promise<void>) => Promise<void>;
87
91
  clear: () => Promise<void>;
88
92
  } : {
89
93
  get: () => Promise<(DefaultValue extends never ? true : false) extends true ? (never extends GetFn ? GetFieldValue<ValueRef, ExplicitType, MapValue> : ReturnType<GetFn>) | null : never extends GetFn ? GetFieldValue<ValueRef, ExplicitType, MapValue> : ReturnType<GetFn>>;
90
- set: (value: (DefaultValue extends never ? true : false) extends true ? (never extends GetFn ? GetFieldValue<ValueRef, ExplicitType, MapValue> : ReturnType<GetFn>) | null : never extends GetFn ? GetFieldValue<ValueRef, ExplicitType, MapValue> : ReturnType<GetFn>) => Promise<void>;
94
+ set: (value: (DefaultValue extends never ? true : false) extends true ? (never extends GetFn ? GetFieldValue<ValueRef, ExplicitType, MapValue> : ReturnType<GetFn>) | null : never extends GetFn ? GetFieldValue<ValueRef, ExplicitType, MapValue> : ReturnType<GetFn>, option?: CacheSetOptions) => Promise<void>;
91
95
  delete: () => Promise<void>;
92
96
  }, never, ValueRef>;
93
97
  };
@@ -1,15 +1,14 @@
1
1
  import type { BaseEnv, Dayjs, SshOptions } from "akanjs/base";
2
2
  import type { Redis } from "ioredis";
3
+ export interface CacheSetOptions {
4
+ expireAt?: Dayjs;
5
+ }
3
6
  export interface CacheAdaptor {
4
- set(topic: string, key: string, value: string | number | Buffer, option?: {
5
- expireAt?: Dayjs;
6
- }): Promise<void>;
7
+ set(topic: string, key: string, value: string | number | Buffer, option?: CacheSetOptions): Promise<void>;
7
8
  get<T extends string | number | Buffer>(topic: string, key: string): Promise<T | undefined>;
8
9
  delete(topic: string, key: string): Promise<void>;
9
10
  getClient?(): Redis;
10
- hset(topic: string, key: string, subKey: string, value: string | number | Buffer, option?: {
11
- expireAt?: Dayjs;
12
- }): Promise<void>;
11
+ hset(topic: string, key: string, subKey: string, value: string | number | Buffer, option?: CacheSetOptions): Promise<void>;
13
12
  hget<T extends string | number | Buffer>(topic: string, key: string, subKey: string): Promise<T | undefined>;
14
13
  hdelete(topic: string, key: string, subKey: string): Promise<void>;
15
14
  hkeys(topic: string, key: string): Promise<string[]>;
@@ -27,14 +26,10 @@ declare const RedisCache_base: import("..").AdaptorCls<{}, {
27
26
  redis: import("..").InjectInfo<"env", Redis, RedisEnv, never>;
28
27
  }>;
29
28
  export declare class RedisCache extends RedisCache_base implements CacheAdaptor {
30
- set(topic: string, key: string, value: string | number | Buffer, option?: {
31
- expireAt?: Dayjs;
32
- }): Promise<void>;
29
+ set(topic: string, key: string, value: string | number | Buffer, option?: CacheSetOptions): Promise<void>;
33
30
  get<T extends string | number | Buffer>(topic: string, key: string): Promise<T | undefined>;
34
31
  delete(topic: string, key: string): Promise<void>;
35
- hset(topic: string, key: string, subKey: string, value: string | number | Buffer, option?: {
36
- expireAt?: Dayjs;
37
- }): Promise<void>;
32
+ hset(topic: string, key: string, subKey: string, value: string | number | Buffer, option?: CacheSetOptions): Promise<void>;
38
33
  hget<T extends string | number | Buffer>(topic: string, key: string, subKey: string): Promise<T | undefined>;
39
34
  hdelete(topic: string, key: string, subKey: string): Promise<void>;
40
35
  hkeys(topic: string, key: string): Promise<string[]>;
@@ -1,5 +1,4 @@
1
- import type { Dayjs } from "akanjs/base";
2
- import type { CacheAdaptor } from "./cache.adaptor";
1
+ import type { CacheAdaptor, CacheSetOptions } from "./cache.adaptor";
3
2
  import { type SolidConfig, type SolidEnv } from "./solidSqlite.d.ts";
4
3
  declare const SolidCache_base: import("..").AdaptorCls<{}, {
5
4
  config: import("..").InjectInfo<"env", Required<SolidConfig>, SolidEnv, never>;
@@ -8,14 +7,10 @@ export declare class SolidCache extends SolidCache_base implements CacheAdaptor
8
7
  #private;
9
8
  onInit(): Promise<void>;
10
9
  onDestroy(): Promise<void>;
11
- set(topic: string, key: string, value: string | number | Buffer, option?: {
12
- expireAt?: Dayjs;
13
- }): Promise<void>;
10
+ set(topic: string, key: string, value: string | number | Buffer, option?: CacheSetOptions): Promise<void>;
14
11
  get<T extends string | number | Buffer>(topic: string, key: string): Promise<T | undefined>;
15
12
  delete(topic: string, key: string): Promise<void>;
16
- hset(topic: string, key: string, subKey: string, value: string | number | Buffer, option?: {
17
- expireAt?: Dayjs;
18
- }): Promise<void>;
13
+ hset(topic: string, key: string, subKey: string, value: string | number | Buffer, option?: CacheSetOptions): Promise<void>;
19
14
  hget<T extends string | number | Buffer>(topic: string, key: string, subKey: string): Promise<T | undefined>;
20
15
  hdelete(topic: string, key: string, subKey: string): Promise<void>;
21
16
  hkeys(topic: string, key: string): Promise<string[]>;
@@ -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 interface Endpoint extends Adaptor {
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 interface EndpointCls<SrvModule extends ServiceModel = ServiceModel, EndpointInfoObj extends {
17
+ export type EndpointCls<SrvModule extends ServiceModel = ServiceModel, EndpointInfoObj extends {
9
18
  [key: string]: EndpointInfo;
10
19
  } = {
11
20
  [key: string]: EndpointInfo;
12
- }> extends AdaptorCls {
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<import("../service.d.ts").ServiceModel<import("../service.d.ts").ServiceCls, any, any, {
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<import("../service.d.ts").ServiceModel<import("../service.d.ts").ServiceCls, any, any, {
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 {};