@akanjs/signal 0.9.55 → 0.9.57

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/src/apiInfo.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { Dayjs, JSON, PromiseOrObject, Type, UnType } from "@akanjs/base";
2
2
  import { ConstantFieldTypeInput, DocumentModel, FieldToValue, ParamFieldType, PlainTypeToFieldType, PurifiedModel } from "@akanjs/constant";
3
- import { Access, Account, ArgType, GuardType, InternalArgType, Job, Me, Req, Res, Self, SignalOption, UserIp, Ws } from "./signalDecorators";
3
+ import { InternalParam } from "@akanjs/nest";
4
+ import { ArgType, SignalOption } from "./signalDecorators";
4
5
  type ApiType = "query" | "mutation" | "pubsub" | "message";
5
- export type GetInternalArg<ArgType extends InternalArgType> = ArgType extends "Account" ? Account : ArgType extends "Me" ? Me : ArgType extends "Self" ? Self : ArgType extends "UserIp" ? UserIp : ArgType extends "Access" ? Access : ArgType extends "Req" ? Req : ArgType extends "Res" ? Res : ArgType extends "Ws" ? Ws : ArgType extends "Job" ? Job : never;
6
6
  export interface ApiArgProps<Optional extends boolean = false> {
7
7
  nullable?: Optional;
8
8
  example?: string | number | boolean | Dayjs;
@@ -11,9 +11,10 @@ export declare class ApiInfo<ReqType extends ApiType, Srvs extends {
11
11
  [key: string]: any;
12
12
  } = {
13
13
  [key: string]: any;
14
- }, Args extends any[] = [], InternalArgs extends any[] = [], ServerArgs extends any[] = [], Returns extends ConstantFieldTypeInput = ConstantFieldTypeInput, ServerReturns = never, Nullable extends boolean = false> {
14
+ }, ArgNames extends string[] = [], Args extends any[] = [], InternalArgs extends any[] = [], ServerArgs extends any[] = [], Returns extends ConstantFieldTypeInput = ConstantFieldTypeInput, ServerReturns = never, Nullable extends boolean = false> {
15
15
  #private;
16
16
  readonly type: ReqType;
17
+ readonly argNames: ArgNames;
17
18
  readonly args: {
18
19
  type: ArgType;
19
20
  name: string;
@@ -21,21 +22,20 @@ export declare class ApiInfo<ReqType extends ApiType, Srvs extends {
21
22
  option?: ApiArgProps<boolean>;
22
23
  }[];
23
24
  readonly internalArgs: {
24
- type: InternalArgType;
25
+ type: InternalParam;
25
26
  option?: ApiArgProps<boolean>;
26
27
  }[];
27
28
  readonly returnRef: Returns;
28
29
  readonly signalOption: SignalOption<Returns, Nullable, any>;
29
- readonly guards: GuardType[];
30
30
  execFn: ((...args: [...ServerArgs, ...InternalArgs]) => any) | null;
31
- constructor(type: ReqType, returnRef: Returns, signalOptionOrGuard?: SignalOption<Returns, Nullable> | GuardType, ...guards: GuardType[]);
32
- param<Arg extends ParamFieldType, _ClientArg = FieldToValue<Arg>, _ServerArg = DocumentModel<_ClientArg>>(name: string, argRef: Arg, option?: Omit<ApiArgProps, "nullable">): ApiInfo<ReqType, Srvs, [...Args, arg: _ClientArg], InternalArgs, [...ServerArgs, arg: _ServerArg], Returns, ServerReturns, Nullable>;
33
- body<ExplicitType = unknown, Arg extends ConstantFieldTypeInput = PlainTypeToFieldType<ExplicitType>, Optional extends boolean = false, _ArgType = unknown extends ExplicitType ? FieldToValue<Arg> : ExplicitType, _ClientArg = PurifiedModel<_ArgType>, _ServerArg = DocumentModel<_ArgType>>(name: string, argRef: Arg, option?: ApiArgProps<Optional>): ApiInfo<ReqType, Srvs, [...Args, arg: _ClientArg | (Optional extends true ? null : never)], InternalArgs, [...ServerArgs, arg: _ServerArg | (Optional extends true ? undefined : never)], Returns, ServerReturns, Nullable>;
34
- room<ExplicitType = unknown, Arg extends ConstantFieldTypeInput = PlainTypeToFieldType<ExplicitType>, _ArgType = unknown extends ExplicitType ? FieldToValue<Arg> : ExplicitType, _ClientArg = PurifiedModel<_ArgType>, _ServerArg = DocumentModel<_ArgType>>(name: string, argRef: Arg, option?: Omit<ApiArgProps, "nullable">): ApiInfo<ReqType, Srvs, [...Args, arg: _ClientArg], InternalArgs, [...ServerArgs, arg: _ServerArg], Returns, ServerReturns, Nullable>;
35
- msg<ExplicitType = unknown, Arg extends ConstantFieldTypeInput = PlainTypeToFieldType<ExplicitType>, Optional extends boolean = false, _ArgType = unknown extends ExplicitType ? FieldToValue<Arg> : ExplicitType, _ClientArg = PurifiedModel<_ArgType>, _ServerArg = DocumentModel<_ArgType>>(name: string, argRef: Arg, option?: ApiArgProps<Optional>): ApiInfo<ReqType, Srvs, [...Args, arg: _ClientArg | (Optional extends true ? null : never)], InternalArgs, [...ServerArgs, arg: _ServerArg | (Optional extends true ? undefined : never)], Returns, ServerReturns, Nullable>;
36
- search<ExplicitType = unknown, Arg extends ConstantFieldTypeInput = PlainTypeToFieldType<ExplicitType>, _ArgType = unknown extends ExplicitType ? FieldToValue<Arg> : ExplicitType, _ClientArg = PurifiedModel<_ArgType>, _ServerArg = DocumentModel<_ArgType>>(name: string, argRef: Arg, option?: Omit<ApiArgProps, "nullable">): ApiInfo<ReqType, Srvs, [...Args, arg: _ClientArg | null], InternalArgs, [...ServerArgs, arg: _ServerArg | undefined], Returns, ServerReturns, Nullable>;
37
- with<ArgType extends InternalArgType, Optional extends boolean = false>(argType: Exclude<ArgType, "Parent">, option?: ApiArgProps<Optional>): ApiInfo<ReqType, Srvs, Args, [...InternalArgs, arg: GetInternalArg<ArgType> | (Optional extends true ? undefined : never)], ServerArgs, Returns, ServerReturns, Nullable>;
38
- exec<ExecFn extends (this: Srvs, ...args: [...ServerArgs, ...InternalArgs]) => ReqType extends "pubsub" ? Promise<void> | void : PromiseOrObject<DocumentModel<FieldToValue<Returns>> | (Nullable extends true ? null | undefined : never)>>(execFn: ExecFn): ApiInfo<ReqType, Srvs, Args, InternalArgs, ServerArgs, Returns, ReturnType<ExecFn>, Nullable>;
31
+ constructor(type: ReqType, returnRef: Returns, signalOption?: SignalOption<Returns, Nullable>);
32
+ param<ArgName extends string, Arg extends ParamFieldType, _ClientArg = FieldToValue<Arg>, _ServerArg = DocumentModel<_ClientArg>>(name: string, argRef: Arg, option?: Omit<ApiArgProps, "nullable">): ApiInfo<ReqType, Srvs, [...ArgNames, ArgName], [...Args, arg: _ClientArg], InternalArgs, [...ServerArgs, arg: _ServerArg], Returns, ServerReturns, Nullable>;
33
+ body<ArgName extends string, ExplicitType = unknown, Arg extends ConstantFieldTypeInput = PlainTypeToFieldType<ExplicitType>, Optional extends boolean = false, _ArgType = unknown extends ExplicitType ? FieldToValue<Arg> : ExplicitType, _ClientArg = PurifiedModel<_ArgType>, _ServerArg = DocumentModel<_ArgType>>(name: ArgName, argRef: Arg, option?: ApiArgProps<Optional>): ApiInfo<ReqType, Srvs, [...ArgNames, ArgName], [...Args, arg: _ClientArg | (Optional extends true ? null : never)], InternalArgs, [...ServerArgs, arg: _ServerArg | (Optional extends true ? undefined : never)], Returns, ServerReturns, Nullable>;
34
+ room<ArgName extends string, ExplicitType = unknown, Arg extends ConstantFieldTypeInput = PlainTypeToFieldType<ExplicitType>, _ArgType = unknown extends ExplicitType ? FieldToValue<Arg> : ExplicitType, _ClientArg = PurifiedModel<_ArgType>, _ServerArg = DocumentModel<_ArgType>>(name: string, argRef: Arg, option?: Omit<ApiArgProps, "nullable">): ApiInfo<ReqType, Srvs, [...ArgNames, ArgName], [...Args, arg: _ClientArg], InternalArgs, [...ServerArgs, arg: _ServerArg], Returns, ServerReturns, Nullable>;
35
+ msg<ArgName extends string, ExplicitType = unknown, Arg extends ConstantFieldTypeInput = PlainTypeToFieldType<ExplicitType>, Optional extends boolean = false, _ArgType = unknown extends ExplicitType ? FieldToValue<Arg> : ExplicitType, _ClientArg = PurifiedModel<_ArgType>, _ServerArg = DocumentModel<_ArgType>>(name: string, argRef: Arg, option?: ApiArgProps<Optional>): ApiInfo<ReqType, Srvs, [...ArgNames, ArgName], [...Args, arg: _ClientArg | (Optional extends true ? null : never)], InternalArgs, [...ServerArgs, arg: _ServerArg | (Optional extends true ? undefined : never)], Returns, ServerReturns, Nullable>;
36
+ search<ArgName extends string, ExplicitType = unknown, Arg extends ConstantFieldTypeInput = PlainTypeToFieldType<ExplicitType>, _ArgType = unknown extends ExplicitType ? FieldToValue<Arg> : ExplicitType, _ClientArg = PurifiedModel<_ArgType>, _ServerArg = DocumentModel<_ArgType>>(name: string, argRef: Arg, option?: Omit<ApiArgProps, "nullable">): ApiInfo<ReqType, Srvs, [...ArgNames, ArgName], [...Args, arg: _ClientArg | null], InternalArgs, [...ServerArgs, arg: _ServerArg | undefined], Returns, ServerReturns, Nullable>;
37
+ with<ArgType, Optional extends boolean = false>(argType: InternalParam<ArgType>, option?: ApiArgProps<Optional>): ApiInfo<ReqType, Srvs, ArgNames, Args, [...InternalArgs, arg: ArgType | (Optional extends true ? null : never)], ServerArgs, Returns, ServerReturns, Nullable>;
38
+ exec<ExecFn extends (this: Srvs, ...args: [...ServerArgs, ...InternalArgs]) => ReqType extends "pubsub" ? Promise<void> | void : PromiseOrObject<DocumentModel<FieldToValue<Returns>> | (Nullable extends true ? null | undefined : never)>>(execFn: ExecFn): ApiInfo<ReqType, Srvs, ArgNames, Args, InternalArgs, ServerArgs, Returns, ReturnType<ExecFn>, Nullable>;
39
39
  applyApiMeta(sigRef: Type, key: string): void;
40
40
  }
41
41
  type ApiInfoReturn<ReqType extends ApiType, Returns extends ConstantFieldTypeInput, ServerReturns, Nullable extends boolean, _ReturnValue = Returns extends typeof JSON ? Awaited<ServerReturns> : FieldToValue<Returns>> = ReqType extends "query" ? Promise<_ReturnValue | (Nullable extends true ? null : never)> : ReqType extends "mutation" ? Promise<_ReturnValue | (Nullable extends true ? null : never)> : ReqType extends "pubsub" ? (_ReturnValue | (Nullable extends true ? null : never)) & {
@@ -43,16 +43,16 @@ type ApiInfoReturn<ReqType extends ApiType, Returns extends ConstantFieldTypeInp
43
43
  } : ReqType extends "message" ? (_ReturnValue | (Nullable extends true ? null : never)) & {
44
44
  __Returns__: "Emit";
45
45
  } : never;
46
- export type BuildApiSignal<SigBuilder extends ApiBuilder<any>, _ApiMap = ReturnType<SigBuilder>> = {
47
- [K in keyof _ApiMap]: _ApiMap[K] extends ApiInfo<infer ReqType, any, infer Args, any, any, infer Returns, infer ServerReturns, infer Nullable> ? (...args: Args) => ApiInfoReturn<ReqType, Returns, ServerReturns, Nullable> : never;
46
+ export type BuildApiSignal<ApiInfoMap> = {
47
+ [K in keyof ApiInfoMap]: ApiInfoMap[K] extends ApiInfo<infer ReqType, any, any, infer Args, any, any, infer Returns, infer ServerReturns, infer Nullable> ? (...args: Args) => ApiInfoReturn<ReqType, Returns, ServerReturns, Nullable> : never;
48
48
  };
49
49
  export declare const makeApiBuilder: <Srvs extends {
50
50
  [key: string]: any;
51
51
  }>() => {
52
- query: <Returns extends ConstantFieldTypeInput = ConstantFieldTypeInput, Nullable extends boolean = false>(returnRef: Returns, signalOptionOrGuard?: SignalOption<Returns, Nullable> | GuardType, ...guards: GuardType[]) => ApiInfo<"query", Srvs, [], [], [], Returns, never, Nullable>;
53
- mutation: <Returns extends ConstantFieldTypeInput = ConstantFieldTypeInput, Nullable_1 extends boolean = false>(returnRef: Returns, signalOptionOrGuard?: SignalOption<Returns, Nullable_1> | GuardType, ...guards: GuardType[]) => ApiInfo<"mutation", Srvs, [], [], [], Returns, never, Nullable_1>;
54
- pubsub: <Returns extends ConstantFieldTypeInput = ConstantFieldTypeInput, Nullable_2 extends boolean = false>(returnRef: Returns, signalOptionOrGuard?: SignalOption<Returns, Nullable_2> | GuardType, ...guards: GuardType[]) => ApiInfo<"pubsub", Srvs, [], [], [], Returns, never, Nullable_2>;
55
- message: <Returns extends ConstantFieldTypeInput = ConstantFieldTypeInput, Nullable_3 extends boolean = false>(returnRef: Returns, signalOptionOrGuard?: SignalOption<Returns, Nullable_3> | GuardType, ...guards: GuardType[]) => ApiInfo<"message", Srvs, [], [], [], Returns, never, Nullable_3>;
52
+ query: <Returns extends ConstantFieldTypeInput = ConstantFieldTypeInput, Nullable extends boolean = false>(returnRef: Returns, signalOption?: SignalOption<Returns, Nullable>) => ApiInfo<"query", Srvs, [], [], [], [], Returns, never, Nullable>;
53
+ mutation: <Returns extends ConstantFieldTypeInput = ConstantFieldTypeInput, Nullable_1 extends boolean = false>(returnRef: Returns, signalOption?: SignalOption<Returns, Nullable_1>) => ApiInfo<"mutation", Srvs, [], [], [], [], Returns, never, Nullable_1>;
54
+ pubsub: <Returns extends ConstantFieldTypeInput = ConstantFieldTypeInput, Nullable_2 extends boolean = false>(returnRef: Returns, signalOption?: SignalOption<Returns, Nullable_2>) => ApiInfo<"pubsub", Srvs, [], [], [], [], Returns, never, Nullable_2>;
55
+ message: <Returns extends ConstantFieldTypeInput = ConstantFieldTypeInput, Nullable_3 extends boolean = false>(returnRef: Returns, signalOption?: SignalOption<Returns, Nullable_3>) => ApiInfo<"message", Srvs, [], [], [], [], Returns, never, Nullable_3>;
56
56
  };
57
57
  export type ApiBuilder<Srvs extends {
58
58
  [key: string]: any;
@@ -63,11 +63,11 @@ export type ApiBuilder<Srvs extends {
63
63
  } = {
64
64
  [K in keyof Srvs as K extends string ? Uncapitalize<K> : never]: UnType<Srvs[K]>;
65
65
  }> = (builder: {
66
- query: <Returns extends ConstantFieldTypeInput = ConstantFieldTypeInput, Nullable extends boolean = false>(returnRef: Returns, signalOptionOrGuard?: SignalOption<Returns, Nullable> | GuardType, ...guards: GuardType[]) => ApiInfo<"query", _ThisSrvs, [], [], [], Returns, never, Nullable>;
67
- mutation: <Returns extends ConstantFieldTypeInput = ConstantFieldTypeInput, Nullable extends boolean = false>(returnRef: Returns, signalOptionOrGuard?: SignalOption<Returns, Nullable> | GuardType, ...guards: GuardType[]) => ApiInfo<"mutation", _ThisSrvs, [], [], [], Returns, never, Nullable>;
68
- pubsub: <Returns extends ConstantFieldTypeInput = ConstantFieldTypeInput, Nullable extends boolean = false>(returnRef: Returns, signalOptionOrGuard?: SignalOption<Returns, Nullable> | GuardType, ...guards: GuardType[]) => ApiInfo<"pubsub", _ThisSrvs, [], [], [], Returns, never, Nullable>;
69
- message: <Returns extends ConstantFieldTypeInput = ConstantFieldTypeInput, Nullable extends boolean = false>(returnRef: Returns, signalOptionOrGuard?: SignalOption<Returns, Nullable> | GuardType, ...guards: GuardType[]) => ApiInfo<"message", _ThisSrvs, [], [], [], Returns, never, Nullable>;
66
+ query: <Returns extends ConstantFieldTypeInput = ConstantFieldTypeInput, Nullable extends boolean = false>(returnRef: Returns, signalOption?: SignalOption<Returns, Nullable>) => ApiInfo<"query", _ThisSrvs, [], [], [], [], Returns, never, Nullable>;
67
+ mutation: <Returns extends ConstantFieldTypeInput = ConstantFieldTypeInput, Nullable extends boolean = false>(returnRef: Returns, signalOption?: SignalOption<Returns, Nullable>) => ApiInfo<"mutation", _ThisSrvs, [], [], [], [], Returns, never, Nullable>;
68
+ pubsub: <Returns extends ConstantFieldTypeInput = ConstantFieldTypeInput, Nullable extends boolean = false>(returnRef: Returns, signalOption?: SignalOption<Returns, Nullable>) => ApiInfo<"pubsub", _ThisSrvs, [], [], [], [], Returns, never, Nullable>;
69
+ message: <Returns extends ConstantFieldTypeInput = ConstantFieldTypeInput, Nullable extends boolean = false>(returnRef: Returns, signalOption?: SignalOption<Returns, Nullable>) => ApiInfo<"message", _ThisSrvs, [], [], [], [], Returns, never, Nullable>;
70
70
  }) => {
71
- [key: string]: ApiInfo<any, any, any, any, any, any, any, any>;
71
+ [key: string]: ApiInfo<any, any, any, any, any, any, any, any, any>;
72
72
  };
73
73
  export {};
@@ -1,134 +1,58 @@
1
1
  import { JSON } from "@akanjs/base";
2
- declare const BaseInternal_base: import("@akanjs/base").Type<import("./internalApiInfo").BuildInternalApiSignal<({ interval }: {
3
- resolveField: <Returns extends import("@akanjs/constant").ConstantFieldTypeInput, Nullable extends boolean = false>(returnRef: Returns, signalOption?: Pick<import("./signalDecorators").SignalOption<Returns, Nullable, keyof import("@akanjs/base").UnType<Returns>>, "nullable"> | undefined) => import("./internalApiInfo").InternalApiInfo<"resolveField", {
4
- baseService: import("@akanjs/service").BaseService;
5
- }, [], [], Returns, import("@akanjs/document").Doc<never>, Nullable>;
6
- interval: <Nullable extends boolean = false>(scheduleTime: number, signalOption?: import("./signalDecorators").SignalOption<typeof JSON, Nullable, "__Scalar__"> | undefined) => import("./internalApiInfo").InternalApiInfo<"interval", {
7
- baseService: import("@akanjs/service").BaseService;
8
- }, [], [], typeof JSON, import("@akanjs/document").Doc<never>, Nullable>;
9
- cron: <Nullable extends boolean = false>(scheduleCron: string, signalOption?: import("./signalDecorators").SignalOption<typeof JSON, Nullable, "__Scalar__"> | undefined) => import("./internalApiInfo").InternalApiInfo<"cron", {
10
- baseService: import("@akanjs/service").BaseService;
11
- }, [], [], typeof JSON, import("@akanjs/document").Doc<never>, Nullable>;
12
- timeout: <Nullable extends boolean = false>(timeout: number, signalOption?: import("./signalDecorators").SignalOption<typeof JSON, Nullable, "__Scalar__"> | undefined) => import("./internalApiInfo").InternalApiInfo<"timeout", {
13
- baseService: import("@akanjs/service").BaseService;
14
- }, [], [], typeof JSON, import("@akanjs/document").Doc<never>, Nullable>;
15
- initialize: <Nullable extends boolean = false>(signalOption?: import("./signalDecorators").SignalOption<typeof JSON, Nullable, "__Scalar__"> | undefined) => import("./internalApiInfo").InternalApiInfo<"init", {
16
- baseService: import("@akanjs/service").BaseService;
17
- }, [], [], typeof JSON, import("@akanjs/document").Doc<never>, Nullable>;
18
- destroy: <Nullable extends boolean = false>(signalOption?: import("./signalDecorators").SignalOption<typeof JSON, Nullable, "__Scalar__"> | undefined) => import("./internalApiInfo").InternalApiInfo<"destroy", {
19
- baseService: import("@akanjs/service").BaseService;
20
- }, [], [], typeof JSON, import("@akanjs/document").Doc<never>, Nullable>;
21
- process: <Returns extends import("@akanjs/constant").ConstantFieldTypeInput, Nullable extends boolean = false>(returnRef: Returns, signalOption?: import("./signalDecorators").SignalOption<Returns, Nullable, keyof import("@akanjs/base").UnType<Returns>> | undefined) => import("./internalApiInfo").InternalApiInfo<"process", {
22
- baseService: import("@akanjs/service").BaseService;
23
- }, [], [], Returns, import("@akanjs/document").Doc<never>, Nullable>;
24
- }) => {
2
+ declare const BaseInternal_base: new (...args: any[]) => {
25
3
  publishPing: import("./internalApiInfo").InternalApiInfo<"interval", {
26
4
  baseService: import("@akanjs/service").BaseService;
27
- }, [], [], typeof JSON, import("@akanjs/document").Doc<never>, false>;
28
- }, {
29
- publishPing: import("./internalApiInfo").InternalApiInfo<"interval", {
30
- baseService: import("@akanjs/service").BaseService;
31
- }, [], [], typeof JSON, import("@akanjs/document").Doc<never>, false>;
32
- }> & {}>;
5
+ }, [], [], [], typeof JSON, false>;
6
+ };
33
7
  export declare class BaseInternal extends BaseInternal_base {
34
8
  }
35
- declare const BaseEndpoint_base: import("@akanjs/base").Type<import("./apiInfo").BuildApiSignal<({ query, mutation, message, pubsub }: {
36
- query: <Returns extends import("@akanjs/constant").ConstantFieldTypeInput = import("@akanjs/constant").ConstantFieldTypeInput, Nullable extends boolean = false>(returnRef: Returns, signalOptionOrGuard?: "Public" | "None" | "User" | "Admin" | "SuperAdmin" | "Every" | "Owner" | import("./signalDecorators").SignalOption<Returns, Nullable, keyof import("@akanjs/base").UnType<Returns>> | undefined, ...guards: import("./signalDecorators").GuardType[]) => import("./apiInfo").ApiInfo<"query", {
37
- baseService: import("@akanjs/service").BaseService;
38
- }, [], [], [], Returns, never, Nullable>;
39
- mutation: <Returns extends import("@akanjs/constant").ConstantFieldTypeInput = import("@akanjs/constant").ConstantFieldTypeInput, Nullable extends boolean = false>(returnRef: Returns, signalOptionOrGuard?: "Public" | "None" | "User" | "Admin" | "SuperAdmin" | "Every" | "Owner" | import("./signalDecorators").SignalOption<Returns, Nullable, keyof import("@akanjs/base").UnType<Returns>> | undefined, ...guards: import("./signalDecorators").GuardType[]) => import("./apiInfo").ApiInfo<"mutation", {
40
- baseService: import("@akanjs/service").BaseService;
41
- }, [], [], [], Returns, never, Nullable>;
42
- pubsub: <Returns extends import("@akanjs/constant").ConstantFieldTypeInput = import("@akanjs/constant").ConstantFieldTypeInput, Nullable extends boolean = false>(returnRef: Returns, signalOptionOrGuard?: "Public" | "None" | "User" | "Admin" | "SuperAdmin" | "Every" | "Owner" | import("./signalDecorators").SignalOption<Returns, Nullable, keyof import("@akanjs/base").UnType<Returns>> | undefined, ...guards: import("./signalDecorators").GuardType[]) => import("./apiInfo").ApiInfo<"pubsub", {
43
- baseService: import("@akanjs/service").BaseService;
44
- }, [], [], [], Returns, never, Nullable>;
45
- message: <Returns extends import("@akanjs/constant").ConstantFieldTypeInput = import("@akanjs/constant").ConstantFieldTypeInput, Nullable extends boolean = false>(returnRef: Returns, signalOptionOrGuard?: "Public" | "None" | "User" | "Admin" | "SuperAdmin" | "Every" | "Owner" | import("./signalDecorators").SignalOption<Returns, Nullable, keyof import("@akanjs/base").UnType<Returns>> | undefined, ...guards: import("./signalDecorators").GuardType[]) => import("./apiInfo").ApiInfo<"message", {
46
- baseService: import("@akanjs/service").BaseService;
47
- }, [], [], [], Returns, never, Nullable>;
48
- }) => {
49
- ping: import("./apiInfo").ApiInfo<"query", {
50
- baseService: import("@akanjs/service").BaseService;
51
- }, [], [], [], StringConstructor, string, false>;
52
- pingBody: import("./apiInfo").ApiInfo<"query", {
53
- baseService: import("@akanjs/service").BaseService;
54
- }, [arg: string], [], [arg: string], StringConstructor, string, false>;
55
- pingParam: import("./apiInfo").ApiInfo<"query", {
56
- baseService: import("@akanjs/service").BaseService;
57
- }, [arg: string], [], [arg: string], StringConstructor, string, false>;
58
- pingQuery: import("./apiInfo").ApiInfo<"query", {
59
- baseService: import("@akanjs/service").BaseService;
60
- }, [arg: string | null], [], [arg: string | undefined], StringConstructor, string | undefined, true>;
61
- pingEvery: import("./apiInfo").ApiInfo<"query", {
62
- baseService: import("@akanjs/service").BaseService;
63
- }, [], [], [], StringConstructor, string, false>;
64
- pingUser: import("./apiInfo").ApiInfo<"query", {
65
- baseService: import("@akanjs/service").BaseService;
66
- }, [], [], [], StringConstructor, string, false>;
67
- pingAdmin: import("./apiInfo").ApiInfo<"query", {
68
- baseService: import("@akanjs/service").BaseService;
69
- }, [], [], [], StringConstructor, string, false>;
70
- getDictionary: import("./apiInfo").ApiInfo<"query", {
71
- baseService: import("@akanjs/service").BaseService;
72
- }, [arg: string], [], [arg: string], typeof JSON, Record<string, Record<string, string>>, false>;
73
- getAllDictionary: import("./apiInfo").ApiInfo<"query", {
74
- baseService: import("@akanjs/service").BaseService;
75
- }, [], [], [], typeof JSON, Record<string, Record<string, Record<string, string>>>, false>;
76
- cleanup: import("./apiInfo").ApiInfo<"mutation", {
77
- baseService: import("@akanjs/service").BaseService;
78
- }, [], [], [], BooleanConstructor, Promise<boolean>, false>;
79
- wsPing: import("./apiInfo").ApiInfo<"message", {
80
- baseService: import("@akanjs/service").BaseService;
81
- }, [], [], [], StringConstructor, string, false>;
82
- pubsubPing: import("./apiInfo").ApiInfo<"pubsub", {
83
- baseService: import("@akanjs/service").BaseService;
84
- }, [], [], [], StringConstructor, void, false>;
85
- getSignals: import("./apiInfo").ApiInfo<"query", {
86
- baseService: import("@akanjs/service").BaseService;
87
- }, [], [], [], typeof JSON, import("./signalInfo").SerializedSignal[], false>;
88
- }, {
9
+ declare const BaseEndpoint_base: new (...args: any[]) => import("@akanjs/base").Assign<{
89
10
  ping: import("./apiInfo").ApiInfo<"query", {
90
11
  baseService: import("@akanjs/service").BaseService;
91
- }, [], [], [], StringConstructor, string, false>;
12
+ }, [], [], [], [], StringConstructor, string, false>;
92
13
  pingBody: import("./apiInfo").ApiInfo<"query", {
93
14
  baseService: import("@akanjs/service").BaseService;
94
- }, [arg: string], [], [arg: string], StringConstructor, string, false>;
15
+ }, ["data"], [arg: string], [], [arg: string], StringConstructor, string, false>;
95
16
  pingParam: import("./apiInfo").ApiInfo<"query", {
96
17
  baseService: import("@akanjs/service").BaseService;
97
- }, [arg: string], [], [arg: string], StringConstructor, string, false>;
18
+ }, [string], [arg: string], [], [arg: string], StringConstructor, string, false>;
98
19
  pingQuery: import("./apiInfo").ApiInfo<"query", {
99
20
  baseService: import("@akanjs/service").BaseService;
100
- }, [arg: string | null], [], [arg: string | undefined], StringConstructor, string | undefined, true>;
21
+ }, [string], [arg: string | null], [], [arg: string | undefined], StringConstructor, string | undefined, true>;
101
22
  pingEvery: import("./apiInfo").ApiInfo<"query", {
102
23
  baseService: import("@akanjs/service").BaseService;
103
- }, [], [], [], StringConstructor, string, false>;
24
+ }, [], [], [], [], StringConstructor, string, false>;
104
25
  pingUser: import("./apiInfo").ApiInfo<"query", {
105
26
  baseService: import("@akanjs/service").BaseService;
106
- }, [], [], [], StringConstructor, string, false>;
27
+ }, [], [], [], [], StringConstructor, string, false>;
107
28
  pingAdmin: import("./apiInfo").ApiInfo<"query", {
108
29
  baseService: import("@akanjs/service").BaseService;
109
- }, [], [], [], StringConstructor, string, false>;
30
+ }, [], [], [], [], StringConstructor, string, false>;
110
31
  getDictionary: import("./apiInfo").ApiInfo<"query", {
111
32
  baseService: import("@akanjs/service").BaseService;
112
- }, [arg: string], [], [arg: string], typeof JSON, Record<string, Record<string, string>>, false>;
33
+ }, [string], [arg: string], [], [arg: string], typeof JSON, Record<string, object>, false>;
113
34
  getAllDictionary: import("./apiInfo").ApiInfo<"query", {
114
35
  baseService: import("@akanjs/service").BaseService;
115
- }, [], [], [], typeof JSON, Record<string, Record<string, Record<string, string>>>, false>;
36
+ }, [], [], [], [], typeof JSON, Record<string, Record<string, object>>, false>;
116
37
  cleanup: import("./apiInfo").ApiInfo<"mutation", {
117
38
  baseService: import("@akanjs/service").BaseService;
118
- }, [], [], [], BooleanConstructor, Promise<boolean>, false>;
39
+ }, [], [], [], [], BooleanConstructor, Promise<boolean>, false>;
119
40
  wsPing: import("./apiInfo").ApiInfo<"message", {
120
41
  baseService: import("@akanjs/service").BaseService;
121
- }, [], [], [], StringConstructor, string, false>;
42
+ }, [], [], [], [], StringConstructor, string, false>;
122
43
  pubsubPing: import("./apiInfo").ApiInfo<"pubsub", {
123
44
  baseService: import("@akanjs/service").BaseService;
124
- }, [], [], [], StringConstructor, void, false>;
45
+ }, [], [], [], [], StringConstructor, void, false>;
125
46
  getSignals: import("./apiInfo").ApiInfo<"query", {
126
47
  baseService: import("@akanjs/service").BaseService;
127
- }, [], [], [], typeof JSON, import("./signalInfo").SerializedSignal[], false>;
128
- }> & {}>;
48
+ }, [], [], [], [], typeof JSON, import("./signalInfo").SerializedSignal[], false>;
49
+ }, {}>;
129
50
  export declare class BaseEndpoint extends BaseEndpoint_base {
130
51
  }
131
- declare const BaseSignal_base: import("@akanjs/base").Type<BaseEndpoint & BaseInternal>;
52
+ declare const BaseSignal_base: new (...args: any[]) => import("./apiInfo").BuildApiSignal<BaseEndpoint> & import("./internalApiInfo").BuildInternalApiSignal<BaseInternal>;
132
53
  export declare class BaseSignal extends BaseSignal_base {
133
54
  }
55
+ declare const Base_base: new (...args: any[]) => import("@akanjs/service").Sig<BaseSignal>;
56
+ export declare class Base extends Base_base {
57
+ }
134
58
  export {};
package/src/doc.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { type Type } from "@akanjs/base";
2
- import { ArgMeta, SignalType } from "./signalDecorators";
3
- export declare const makeRequestExample: (sigRef: Type, key: string) => {
1
+ import { SerializedArg, SerializedEndpoint } from ".";
2
+ import { SignalType } from "./signalDecorators";
3
+ export declare const makeRequestExample: (gqlMeta: SerializedEndpoint) => {
4
4
  [key: string]: any;
5
5
  };
6
- export declare const getExampleData: (argMetas: ArgMeta[], signalType?: SignalType) => {
6
+ export declare const getExampleData: (argMetas: SerializedArg[], signalType?: SignalType) => {
7
7
  [key: string]: any;
8
8
  };
9
- export declare const makeResponseExample: (sigRef: Type, key: string) => string | number | boolean | object | null;
9
+ export declare const makeResponseExample: (gqlMeta: SerializedEndpoint) => string | number | boolean | object | null;
package/src/fetch.d.ts CHANGED
@@ -2,14 +2,14 @@ export declare const fetch: {
2
2
  ping: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string>;
3
3
  pingBody: (args_0: string, option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string>;
4
4
  pingParam: (args_0: string, option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string>;
5
- pingQuery: (args_0?: string | null | undefined, option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string | null>;
5
+ pingQuery: (arg?: string | null | undefined, option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string | null>;
6
6
  pingEvery: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string>;
7
7
  pingUser: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string>;
8
8
  pingAdmin: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string>;
9
- getDictionary: (args_0: string, option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<Record<string, Record<string, string>>>;
10
- getAllDictionary: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<Record<string, Record<string, Record<string, string>>>>;
9
+ getDictionary: (args_0: string, option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<Record<string, object>>;
10
+ getAllDictionary: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<Record<string, Record<string, object>>>;
11
11
  cleanup: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<boolean>;
12
- wsPing: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => void;
12
+ wsPing: () => void;
13
13
  getSignals: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<import("./signalInfo").SerializedSignal[]>;
14
14
  listenWsPing: (handleEvent: (data: string & {
15
15
  __Returns__: "Emit";
@@ -21,7 +21,7 @@ export declare const fetch: {
21
21
  clone: (option?: {
22
22
  jwt: string | null;
23
23
  }) => Omit<{
24
- wsPing: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => void;
24
+ wsPing: () => void;
25
25
  listenWsPing: (handleEvent: (data: string & {
26
26
  __Returns__: "Emit";
27
27
  }) => any, options?: import("@akanjs/common").FetchPolicy) => () => void;
@@ -31,12 +31,12 @@ export declare const fetch: {
31
31
  ping: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string>;
32
32
  pingBody: (args_0: string, option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string>;
33
33
  pingParam: (args_0: string, option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string>;
34
- pingQuery: (args_0?: string | null | undefined, option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string | null>;
34
+ pingQuery: (arg?: string | null | undefined, option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string | null>;
35
35
  pingEvery: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string>;
36
36
  pingUser: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string>;
37
37
  pingAdmin: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string>;
38
- getDictionary: (args_0: string, option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<Record<string, Record<string, string>>>;
39
- getAllDictionary: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<Record<string, Record<string, Record<string, string>>>>;
38
+ getDictionary: (args_0: string, option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<Record<string, object>>;
39
+ getAllDictionary: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<Record<string, Record<string, object>>>;
40
40
  cleanup: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<boolean>;
41
41
  getSignals: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<import("./signalInfo").SerializedSignal[]>;
42
42
  } & typeof globalThis.fetch & {
package/src/gql.d.ts CHANGED
@@ -1,13 +1,13 @@
1
- import { DataList, type GetActionObject, type GetStateObject, type MergeAll, type MergedValues, type Prettify, type PromiseOrObject, Type, Upload } from "@akanjs/base";
1
+ import { DataList, type GetActionObject, type GetStateObject, MergeAll, type MergedValues, type Prettify, type PromiseOrObject, Type } from "@akanjs/base";
2
2
  import { FetchPolicy } from "@akanjs/common";
3
3
  import { ConstantModel, DefaultOf, DocumentModel, ProtoFile, QueryOf } from "@akanjs/constant";
4
- import type { FilterType, SortOf } from "@akanjs/document";
4
+ import type { ExtractQuery, ExtractSort, FilterInstance } from "@akanjs/document";
5
5
  import { AnyVariables } from "@urql/core";
6
6
  import { type Client } from ".";
7
7
  import { type DefaultSignal, type SliceMeta } from "./signalDecorators";
8
8
  export declare class GqlStorage {
9
9
  }
10
- export interface FetchInitForm<Input, Full, Filter extends FilterType, _DefaultInput = DefaultOf<Input>, _Sort = SortOf<Filter>> {
10
+ export interface FetchInitForm<Input, Full, Filter extends FilterInstance, _DefaultInput = DefaultOf<Input>, _Sort = ExtractSort<Filter>> {
11
11
  page?: number;
12
12
  limit?: number;
13
13
  sort?: _Sort;
@@ -15,7 +15,7 @@ export interface FetchInitForm<Input, Full, Filter extends FilterType, _DefaultI
15
15
  invalidate?: boolean;
16
16
  insight?: boolean;
17
17
  }
18
- export type ServerInit<T extends string, Light, Insight = any, QueryArgs = any[], Filter extends FilterType = any, _CapitalizedT extends string = Capitalize<T>, _Sort = SortOf<Filter>> = SliceMeta & {
18
+ export type ServerInit<T extends string, Light, Insight = any, QueryArgs = any[], Filter extends FilterInstance = any, _CapitalizedT extends string = Capitalize<T>, _Sort = ExtractSort<Filter>> = SliceMeta & {
19
19
  [K in `${T}ObjList`]: Light[];
20
20
  } & {
21
21
  [K in `${T}ObjInsight`]: Insight;
@@ -32,7 +32,7 @@ export type ServerInit<T extends string, Light, Insight = any, QueryArgs = any[]
32
32
  } & {
33
33
  [K in `${T}InitAt`]: Date;
34
34
  };
35
- export type ClientInit<T extends string, Light, Insight = any, QueryArgs = any[], Filter extends FilterType = any, _CapitalizedT extends string = Capitalize<T>, _Sort = SortOf<Filter>> = PromiseOrObject<ServerInit<T, Light, Insight, QueryArgs, Filter, _CapitalizedT, _Sort>>;
35
+ export type ClientInit<T extends string, Light, Insight = any, QueryArgs = any[], Filter extends FilterInstance = any, _CapitalizedT extends string = Capitalize<T>, _Sort = ExtractSort<Filter>> = PromiseOrObject<ServerInit<T, Light, Insight, QueryArgs, Filter, _CapitalizedT, _Sort>>;
36
36
  export type ServerView<T extends string, Model> = {
37
37
  refName: T;
38
38
  } & {
@@ -50,8 +50,8 @@ export type ServerEdit<T extends string, Model> = {
50
50
  };
51
51
  export type ClientEdit<T extends string, Model> = PromiseOrObject<ServerEdit<T, Model>>;
52
52
  type RemoveLast3<T extends any[]> = T extends [...infer Rest, any, any, any] ? Rest : T;
53
- export type FilterListArgs<Args extends any[]> = PartialNullableArgs<ConvertArgs<RemoveLast3<FilterInternalArgs<Args>>>>;
54
- type FetchOption<Input, Full, Filter extends FilterType, _DefaultInput = DefaultOf<Input>, _Sort = SortOf<Filter>> = FetchPolicy & FetchInitForm<Input, Full, Filter, _DefaultInput, _Sort>;
53
+ export type FilterListArgs<Args extends any[]> = PartialNullableArgs<RemoveLast3<Args>>;
54
+ type FetchOption<Input, Full, Filter extends FilterInstance, _DefaultInput = DefaultOf<Input>, _Sort = ExtractSort<Filter>> = FetchPolicy & FetchInitForm<Input, Full, Filter, _DefaultInput, _Sort>;
55
55
  type ViewReturn<T extends string, Full> = {
56
56
  [K in T]: Full;
57
57
  } & {
@@ -64,7 +64,7 @@ type EditReturn<T extends string, Full> = {
64
64
  };
65
65
  type InitReturn<T extends string, Light extends {
66
66
  id: string;
67
- }, Insight, Args, Filter extends FilterType, _CapitalizedT extends string = Capitalize<T>, _Sort = SortOf<Filter>> = {
67
+ }, Insight, Args, Filter extends FilterInstance, _CapitalizedT extends string = Capitalize<T>, _Sort = ExtractSort<Filter>> = {
68
68
  [K in `${T}Init`]: ServerInit<T, Light, Insight, Args, Filter, _CapitalizedT, _Sort>;
69
69
  } & {
70
70
  [K in `${T}List`]: DataList<Light>;
@@ -91,14 +91,14 @@ type ViewEditMethods<T extends string, Full, _CapitalizedT extends string = Capi
91
91
  };
92
92
  type InitMethods<T extends string, Input, Full, Light extends {
93
93
  id: string;
94
- }, Insight, Filter extends FilterType, _CapitalizedT extends string = Capitalize<T>, _QueryOfDoc = QueryOf<DocumentModel<Full>>, _DefaultInput = DefaultOf<Input>, _Sort = SortOf<Filter>> = {
94
+ }, Insight, Filter extends FilterInstance, _CapitalizedT extends string = Capitalize<T>, _QueryOfDoc = QueryOf<DocumentModel<Full>>, _DefaultInput = DefaultOf<Input>, _Sort = ExtractSort<Filter>> = {
95
95
  [K in `init${_CapitalizedT}`]: (query?: _QueryOfDoc, option?: FetchOption<Input, Full, Filter, _DefaultInput, _Sort>) => Promise<InitReturn<T, Light, Insight, [query?: _QueryOfDoc], Filter, _CapitalizedT, _Sort>>;
96
96
  } & {
97
97
  [K in `get${_CapitalizedT}Init`]: (query?: _QueryOfDoc, option?: FetchOption<Input, Full, Filter, _DefaultInput, _Sort>) => ClientInit<T, Light, Insight, [query?: _QueryOfDoc], Filter, _CapitalizedT, _Sort>;
98
98
  };
99
99
  type DynamicListMethodsOfKey<T extends string, Input, Full, Light extends {
100
100
  id: string;
101
- }, Insight, Filter extends FilterType, Suffix extends string, QueryArgs extends any[], _CapitalizedT extends string = Capitalize<T>, _DefaultInput = DefaultOf<Input>, _Sort = SortOf<Filter>> = {
101
+ }, Insight, Filter extends FilterInstance, Suffix extends string, QueryArgs extends any[], _CapitalizedT extends string = Capitalize<T>, _DefaultInput = DefaultOf<Input>, _Sort = ExtractSort<Filter>> = {
102
102
  [Key in `init${_CapitalizedT}${Suffix}`]: (...args: [...queryArgs: QueryArgs, option?: FetchOption<Input, Full, Filter, _DefaultInput, _Sort>]) => Promise<{
103
103
  [P in `${T}Init${Suffix}`]: ServerInit<T, Light, Insight, QueryArgs, Filter, _CapitalizedT, _Sort>;
104
104
  } & {
@@ -111,31 +111,20 @@ type DynamicListMethodsOfKey<T extends string, Input, Full, Light extends {
111
111
  };
112
112
  type DynamicListMethods<T extends string, Input, Full, Light extends {
113
113
  id: string;
114
- }, Insight, Filter extends FilterType, Signal, _CapitalizedT extends string = Capitalize<T>, _DefaultInput = DefaultOf<Input>, _Sort = SortOf<Filter>, _DynamicSliceArgMap = DynamicSliceArgMap<T, Input, Full, Filter, Signal, _CapitalizedT, _DefaultInput, _Sort>> = MergedValues<{
114
+ }, Insight, Filter extends FilterInstance, Signal, _CapitalizedT extends string = Capitalize<T>, _DefaultInput = DefaultOf<Input>, _Sort = ExtractSort<Filter>, _DynamicSliceArgMap = DynamicSliceArgMap<T, Input, Full, Filter, Signal, _CapitalizedT, _DefaultInput, _Sort>> = MergedValues<{
115
115
  [K in keyof _DynamicSliceArgMap]: K extends string ? _DynamicSliceArgMap[K] extends any[] ? DynamicListMethodsOfKey<T, Input, Full, Light, Insight, Filter, K, _DynamicSliceArgMap[K], _CapitalizedT, _DefaultInput, _Sort> : never : never;
116
116
  }>;
117
- export type DynamicSliceArgMap<T extends string, Input, Full, Filter extends FilterType, Signal, _CapitalizedT extends string = Capitalize<T>, _DefaultInput = DefaultOf<Input>, _Sort = SortOf<Filter>> = {
117
+ export type DynamicSliceArgMap<T extends string, Input, Full, Filter extends FilterInstance, Signal, _CapitalizedT extends string = Capitalize<T>, _DefaultInput = DefaultOf<Input>, _Sort = ExtractSort<Filter>> = {
118
118
  [K in keyof Signal as K extends `${T}List${infer Suffix}` ? Suffix : never]: Signal[K] extends (...args: infer Args) => Promise<Full[]> ? FilterListArgs<Args> : never;
119
119
  };
120
120
  export type DbGraphQL<T extends string, Input, Full, Light extends {
121
121
  id: string;
122
- }, Insight, Filter extends FilterType, Fetch, Signal, _CapitalizedT extends string = Capitalize<T>, _Default = DefaultOf<Full>, _DefaultInput = DefaultOf<Input>, _DefaultState = GetStateObject<Full>, _DefaultStateInput = GetStateObject<Input>, _Doc = DocumentModel<Full>, _DocInput = DocumentModel<Input>, _QueryOfDoc = QueryOf<DocumentModel<Full>>, _Query = GetActionObject<Filter>, _Sort = SortOf<Filter>, _DynamicSliceArgMap = DynamicSliceArgMap<T, Input, Full, Filter, Signal, _CapitalizedT, _DefaultInput, _Sort>> = {
122
+ }, Insight, Filter extends FilterInstance, Fetch, Signal, _CapitalizedT extends string = Capitalize<T>, _Default = DefaultOf<Full>, _DefaultInput = DefaultOf<Input>, _DefaultState = GetStateObject<Full>, _DefaultStateInput = GetStateObject<Input>, _Doc = DocumentModel<Full>, _DocInput = DocumentModel<Input>, _QueryOfDoc = QueryOf<DocumentModel<Full>>, _Query = ExtractQuery<Filter>, _Sort = ExtractSort<Filter>, _DynamicSliceArgMap = DynamicSliceArgMap<T, Input, Full, Filter, Signal, _CapitalizedT, _DefaultInput, _Sort>> = {
123
123
  refName: string;
124
124
  slices: SliceMeta[];
125
125
  } & GetWsMessageOf<Signal> & GetWsPubsubOf<Signal> & BasicMethods<T, Input, Full, Light, Insight, _CapitalizedT> & ViewEditMethods<T, Full, _CapitalizedT> & InitMethods<T, Input, Full, Light, Insight, Filter, _CapitalizedT, _QueryOfDoc, _DefaultInput, _Sort> & Fetch & DynamicListMethods<T, Input, Full, Light, Insight, Filter, Signal, _CapitalizedT, _DefaultInput, _Sort, _DynamicSliceArgMap>;
126
- type IsInternalArg<T> = T extends {
127
- __InternalArg__: any;
128
- } ? true : false;
129
- type ConvertArg<T> = T extends Upload[] ? FileList : T;
130
- type ConvertArgs<T extends any[]> = T extends [infer Head, ...infer Rest] ? [ConvertArg<Head>, ...ConvertArgs<Rest>] : [];
131
- type FilterInternalArgs<T extends any[]> = T extends [...infer Rest, infer Last] ? IsInternalArg<Last> extends true ? FilterInternalArgs<Rest> : T : [];
132
126
  type PartialNullableArgs<T extends any[]> = T extends [infer Head, ...infer Rest] ? null extends Head ? Partial<T> : [Head, ...PartialNullableArgs<Rest>] : [];
133
- export type FilterOutInternalArgs<Args extends any[]> = PartialNullableArgs<ConvertArgs<FilterInternalArgs<Args>>>;
134
- type FunctionParams<F> = F extends (...args: infer P) => any ? P : never;
135
- type RebuildFunction<Params extends readonly unknown[], R> = (...args: [...Params, option?: FetchPolicy]) => R;
136
- export type RemoveInternalArgs<F extends (...args: any) => any, Returns = ReturnType<F>> = RebuildFunction<FilterOutInternalArgs<FunctionParams<F>>, Returns>;
137
127
  type EnsurePromise<T> = T extends Promise<any> ? T : Promise<T>;
138
- type ApplyPromise<T> = T extends (...args: infer A) => infer R ? (...args: A) => EnsurePromise<R> : never;
139
128
  type ApplyVoidReturn<T> = T extends (...args: infer A) => any ? (...args: A) => void : never;
140
129
  type HasMarker<Fn, Marker> = Fn extends (...args: any) => Promise<{
141
130
  __Returns__: Marker;
@@ -143,10 +132,10 @@ type HasMarker<Fn, Marker> = Fn extends (...args: any) => Promise<{
143
132
  __Returns__: Marker;
144
133
  } ? true : false;
145
134
  export type GetQueryMutationOf<Sig, M = unknown> = {
146
- [K in keyof Sig as K extends keyof M ? never : HasMarker<Sig[K], string> extends true ? never : K]: Sig[K] extends (...args: any) => any ? ApplyPromise<RemoveInternalArgs<Sig[K]>> : never;
135
+ [K in keyof Sig as K extends keyof M ? never : HasMarker<Sig[K], string> extends true ? never : K]: Sig[K] extends (...args: any) => any ? Sig[K] extends (...args: infer Args) => infer Return ? (...args: [...PartialNullableArgs<Args>, option?: FetchPolicy]) => EnsurePromise<Return> : never : never;
147
136
  };
148
137
  type EmitMethods<Sig> = {
149
- [K in keyof Sig as HasMarker<Sig[K], "Emit"> extends true ? K : never]: Sig[K] extends (...args: any) => any ? ApplyVoidReturn<RemoveInternalArgs<Sig[K], void>> : never;
138
+ [K in keyof Sig as HasMarker<Sig[K], "Emit"> extends true ? K : never]: Sig[K] extends (...args: any) => any ? ApplyVoidReturn<Sig[K]> : never;
150
139
  };
151
140
  type ListenMethods<Sig> = {
152
141
  [K in keyof Sig as K extends string ? HasMarker<Sig[K], "Emit"> extends true ? `listen${Capitalize<K>}` : never : never]: Sig[K] extends (...args: any) => infer R ? (handleEvent: (data: Awaited<R>) => any, options?: FetchPolicy) => () => void : never;
@@ -155,11 +144,7 @@ export type GetWsMessageOf<Sig> = EmitMethods<Sig> & ListenMethods<Sig>;
155
144
  type RemoveReturnMeta<Return> = Return extends infer R & {
156
145
  __Returns__: any;
157
146
  } ? R : Return;
158
- type GenerateSubscribeMethod<Fn> = Fn extends (...args: infer Args) => infer R ? (...args: [
159
- ...args: FilterOutInternalArgs<Args>,
160
- onData: (data: RemoveReturnMeta<Awaited<R>>) => void,
161
- fetchPolicy?: FetchPolicy
162
- ]) => () => void : never;
147
+ type GenerateSubscribeMethod<Fn> = Fn extends (...args: infer Args) => infer R ? (...args: [...args: Args, onData: (data: RemoveReturnMeta<Awaited<R>>) => void, fetchPolicy?: FetchPolicy]) => () => void : never;
163
148
  export type GetWsPubsubOf<Sig> = {
164
149
  [K in keyof Sig as K extends string ? HasMarker<Sig[K], "Subscribe"> extends true ? `subscribe${Capitalize<K>}` : never : never]: GenerateSubscribeMethod<Sig[K]>;
165
150
  };
@@ -174,7 +159,7 @@ export declare const gqlOf: <T extends string, Input, Full extends {
174
159
  id: string;
175
160
  }, Light extends {
176
161
  id: string;
177
- }, Insight, Filter extends FilterType, Signal, _CapitalizedT extends string, _Default, _DefaultInput, _DefaultState, _DefaultStateInput, _DefaultInsight, _PurifiedInput, _Doc, _DocInput, _QueryOfDoc, _Sort = SortOf<Filter>, _SignalAction = GetActionObject<Signal>>(constant: ConstantModel<T, Input, Full, Light, Insight, _CapitalizedT, _Default, _DefaultInput, _DefaultState, _DefaultStateInput, _DefaultInsight, _PurifiedInput, _Doc, _DocInput, _QueryOfDoc>, filterRef: Type<Filter>, sigRef: Type<Signal>, option?: {
162
+ }, Insight, Filter extends FilterInstance, Signal, _CapitalizedT extends string, _Default, _DefaultInput, _DefaultState, _DefaultStateInput, _DefaultInsight, _PurifiedInput, _Doc, _DocInput, _QueryOfDoc, _Sort = ExtractSort<Filter>, _SignalAction = GetActionObject<Signal>>(constant: ConstantModel<T, Input, Full, Light, Insight, _CapitalizedT, _Default, _DefaultInput, _DefaultState, _DefaultStateInput, _DefaultInsight, _PurifiedInput, _Doc, _DocInput, _QueryOfDoc>, filterRef: Type<Filter>, sigRef: Type<Signal>, option?: {
178
163
  overwrite?: {
179
164
  [key: string]: any;
180
165
  };
@@ -1,7 +1,8 @@
1
1
  import { JSON, PromiseOrObject, Type, UnType } from "@akanjs/base";
2
2
  import { ConstantFieldTypeInput, DocumentModel, FieldToValue, PlainTypeToFieldType } from "@akanjs/constant";
3
- import { GetInternalArg } from "./apiInfo";
4
- import { ArgType, InternalArgType, Job, SignalOption } from "./signalDecorators";
3
+ import { InternalParam } from "@akanjs/nest";
4
+ import type { Job } from "bull";
5
+ import { ArgType, SignalOption } from "./signalDecorators";
5
6
  type InternalApiType = "resolveField" | "interval" | "cron" | "timeout" | "init" | "destroy" | "process";
6
7
  interface InternalApiArgProps<Nullable extends boolean = false> {
7
8
  nullable?: Nullable;
@@ -10,7 +11,7 @@ export declare class InternalApiInfo<ReqType extends InternalApiType, Srvs exten
10
11
  [key: string]: any;
11
12
  } = {
12
13
  [key: string]: any;
13
- }, Args extends any[] = [], InternalArgs extends any[] = [], Returns extends ConstantFieldTypeInput = ConstantFieldTypeInput, Parent extends DocumentModel<any> = DocumentModel<any>, Nullable extends boolean = false> {
14
+ }, Args extends any[] = [], InternalArgs extends any[] = [], DefaultArgs extends any[] = [], Returns extends ConstantFieldTypeInput = ConstantFieldTypeInput, Nullable extends boolean = false> {
14
15
  #private;
15
16
  readonly type: ReqType;
16
17
  readonly args: {
@@ -20,18 +21,19 @@ export declare class InternalApiInfo<ReqType extends InternalApiType, Srvs exten
20
21
  option?: InternalApiArgProps<boolean>;
21
22
  }[];
22
23
  readonly internalArgs: {
23
- type: InternalArgType;
24
+ type: InternalParam;
24
25
  option?: InternalApiArgProps<boolean>;
25
26
  }[];
27
+ readonly defaultArgs: string[];
26
28
  readonly returnRef: Returns;
27
29
  readonly signalOption: SignalOption<Returns, Nullable>;
28
- execFn: ((...args: [...Args, ...InternalArgs]) => any) | null;
30
+ execFn: ((...args: [...Args, ...DefaultArgs, ...InternalArgs]) => any) | null;
29
31
  constructor(type: ReqType, returnRef: Returns, signalOption?: SignalOption<Returns, Nullable>);
30
- msg<ExplicitType, Arg extends ConstantFieldTypeInput = PlainTypeToFieldType<ExplicitType>, Nullable extends boolean = false, _FieldToValue = FieldToValue<Arg>>(name: string, argRef: Arg, option?: InternalApiArgProps<Nullable>): InternalApiInfo<ReqType, Srvs, [...Args, arg: _FieldToValue | (Nullable extends true ? undefined : never)], InternalArgs, Returns, Parent, Nullable>;
31
- with<ArgType extends InternalArgType, Nullable extends boolean = false>(argType: ArgType, option?: InternalApiArgProps<Nullable>): InternalApiInfo<ReqType, Srvs, Args, [...InternalArgs, arg: ArgType extends "Job" ? Job : ArgType extends "Parent" ? Parent : GetInternalArg<ArgType> | (Nullable extends true ? null : never)], Returns, Parent, Nullable>;
32
+ msg<ExplicitType, Arg extends ConstantFieldTypeInput = PlainTypeToFieldType<ExplicitType>, Nullable extends boolean = false, _FieldToValue = FieldToValue<Arg>>(name: string, argRef: Arg, option?: InternalApiArgProps<Nullable>): InternalApiInfo<ReqType, Srvs, [...Args, arg: _FieldToValue | (Nullable extends true ? undefined : never)], InternalArgs, DefaultArgs, Returns, Nullable>;
33
+ with<ArgType, Optional extends boolean = false>(argType: InternalParam<ArgType>, option?: InternalApiArgProps<Optional>): InternalApiInfo<ReqType, Srvs, Args, [...InternalArgs, arg: ArgType | (Optional extends true ? null : never)], DefaultArgs, Returns, Nullable>;
32
34
  exec(query: (this: {
33
35
  [K in keyof Srvs as K extends string ? Uncapitalize<K> : never]: Srvs[K];
34
- }, ...args: [...Args, ...InternalArgs]) => ReqType extends "process" | "resolveField" ? PromiseOrObject<DocumentModel<FieldToValue<Returns>> | (Nullable extends true ? null : never)> : PromiseOrObject<void>): this;
36
+ }, ...args: [...Args, ...DefaultArgs, ...InternalArgs]) => ReqType extends "process" | "resolveField" ? PromiseOrObject<DocumentModel<FieldToValue<Returns>> | (Nullable extends true ? null : never)> : PromiseOrObject<void>): this;
35
37
  applyApiMeta(sigRef: Type, key: string): void;
36
38
  }
37
39
  export declare const makeInternalApiBuilder: <Srvs extends {
@@ -39,16 +41,16 @@ export declare const makeInternalApiBuilder: <Srvs extends {
39
41
  } = {
40
42
  [key: string]: any;
41
43
  }, Parent extends DocumentModel<any> = DocumentModel<any>>() => {
42
- resolveField: <Returns extends ConstantFieldTypeInput, Nullable extends boolean = false>(returnRef: Returns, signalOption?: Pick<SignalOption<Returns, Nullable>, "nullable">) => InternalApiInfo<"resolveField", Srvs, [], [], Returns, Parent, Nullable>;
43
- interval: <Nullable_2 extends boolean = false>(scheduleTime: number, signalOption?: SignalOption<typeof JSON, Nullable_2>) => InternalApiInfo<"interval", Srvs, [], [], typeof JSON, Parent, Nullable_2>;
44
- cron: <Nullable_2 extends boolean = false>(scheduleCron: string, signalOption?: SignalOption<typeof JSON, Nullable_2>) => InternalApiInfo<"cron", Srvs, [], [], typeof JSON, Parent, Nullable_2>;
45
- timeout: <Nullable_2 extends boolean = false>(timeout: number, signalOption?: SignalOption<typeof JSON, Nullable_2>) => InternalApiInfo<"timeout", Srvs, [], [], typeof JSON, Parent, Nullable_2>;
46
- initialize: <Nullable_2 extends boolean = false>(signalOption?: SignalOption<typeof JSON, Nullable_2>) => InternalApiInfo<"init", Srvs, [], [], typeof JSON, Parent, Nullable_2>;
47
- destroy: <Nullable_2 extends boolean = false>(signalOption?: SignalOption<typeof JSON, Nullable_2>) => InternalApiInfo<"destroy", Srvs, [], [], typeof JSON, Parent, Nullable_2>;
48
- process: <Returns extends ConstantFieldTypeInput, Nullable_1 extends boolean = false>(returnRef: Returns, signalOption?: SignalOption<Returns, Nullable_1>) => InternalApiInfo<"process", Srvs, [], [], Returns, Parent, Nullable_1>;
44
+ resolveField: <Returns extends ConstantFieldTypeInput, Nullable extends boolean = false>(returnRef: Returns, signalOption?: Pick<SignalOption<Returns, Nullable>, "nullable">) => InternalApiInfo<"resolveField", Srvs, [], [], [Parent], Returns, Nullable>;
45
+ interval: <Nullable_2 extends boolean = false>(scheduleTime: number, signalOption?: SignalOption<typeof JSON, Nullable_2>) => InternalApiInfo<"interval", Srvs, [], [], [], typeof JSON, Nullable_2>;
46
+ cron: <Nullable_2 extends boolean = false>(scheduleCron: string, signalOption?: SignalOption<typeof JSON, Nullable_2>) => InternalApiInfo<"cron", Srvs, [], [], [], typeof JSON, Nullable_2>;
47
+ timeout: <Nullable_2 extends boolean = false>(timeout: number, signalOption?: SignalOption<typeof JSON, Nullable_2>) => InternalApiInfo<"timeout", Srvs, [], [], [], typeof JSON, Nullable_2>;
48
+ initialize: <Nullable_2 extends boolean = false>(signalOption?: SignalOption<typeof JSON, Nullable_2>) => InternalApiInfo<"init", Srvs, [], [], [], typeof JSON, Nullable_2>;
49
+ destroy: <Nullable_2 extends boolean = false>(signalOption?: SignalOption<typeof JSON, Nullable_2>) => InternalApiInfo<"destroy", Srvs, [], [], [], typeof JSON, Nullable_2>;
50
+ process: <Returns extends ConstantFieldTypeInput, Nullable_1 extends boolean = false>(returnRef: Returns, signalOption?: SignalOption<Returns, Nullable_1>) => InternalApiInfo<"process", Srvs, [], [], [Job<any>], Returns, Nullable_1>;
49
51
  };
50
- export type BuildInternalApiSignal<SigBuilder extends InternalApiBuilder<any>, _ApiMap = ReturnType<SigBuilder>> = {
51
- [K in keyof _ApiMap as _ApiMap[K] extends InternalApiInfo<"process", any, any, any, any, any, any> ? K : never]: _ApiMap[K] extends InternalApiInfo<infer ReqType, any, infer Args, any, infer Returns, any, infer Nullable> ? (...args: Args) => ReqType extends "process" ? Promise<(FieldToValue<Returns> | (Nullable extends true ? null : never)) & {
52
+ export type BuildInternalApiSignal<InternalApiInfoMap> = {
53
+ [K in keyof InternalApiInfoMap as InternalApiInfoMap[K] extends InternalApiInfo<"process", any, any, any, any, any, any> ? K : never]: InternalApiInfoMap[K] extends InternalApiInfo<infer ReqType, any, infer Args, any, any, infer Returns, infer Nullable> ? (...args: Args) => ReqType extends "process" ? Promise<(FieldToValue<Returns> | (Nullable extends true ? null : never)) & {
52
54
  __Returns__: "Done";
53
55
  }> : never : never;
54
56
  };
@@ -61,13 +63,13 @@ export type InternalApiBuilder<Srvs extends {
61
63
  } = {
62
64
  [K in keyof Srvs as K extends string ? Uncapitalize<K> : never]: UnType<Srvs[K]>;
63
65
  }> = (builder: {
64
- resolveField: <Returns extends ConstantFieldTypeInput, Nullable extends boolean = false>(returnRef: Returns, signalOption?: Pick<SignalOption<Returns, Nullable>, "nullable">) => InternalApiInfo<"resolveField", _ThisSrvs, [], [], Returns, Parent, Nullable>;
65
- interval: <Nullable extends boolean = false>(scheduleTime: number, signalOption?: SignalOption<typeof JSON, Nullable>) => InternalApiInfo<"interval", _ThisSrvs, [], [], typeof JSON, Parent, Nullable>;
66
- cron: <Nullable extends boolean = false>(scheduleCron: string, signalOption?: SignalOption<typeof JSON, Nullable>) => InternalApiInfo<"cron", _ThisSrvs, [], [], typeof JSON, Parent, Nullable>;
67
- timeout: <Nullable extends boolean = false>(timeout: number, signalOption?: SignalOption<typeof JSON, Nullable>) => InternalApiInfo<"timeout", _ThisSrvs, [], [], typeof JSON, Parent, Nullable>;
68
- initialize: <Nullable extends boolean = false>(signalOption?: SignalOption<typeof JSON, Nullable>) => InternalApiInfo<"init", _ThisSrvs, [], [], typeof JSON, Parent, Nullable>;
69
- destroy: <Nullable extends boolean = false>(signalOption?: SignalOption<typeof JSON, Nullable>) => InternalApiInfo<"destroy", _ThisSrvs, [], [], typeof JSON, Parent, Nullable>;
70
- process: <Returns extends ConstantFieldTypeInput, Nullable extends boolean = false>(returnRef: Returns, signalOption?: SignalOption<Returns, Nullable>) => InternalApiInfo<"process", _ThisSrvs, [], [], Returns, Parent, Nullable>;
66
+ resolveField: <Returns extends ConstantFieldTypeInput, Nullable extends boolean = false>(returnRef: Returns, signalOption?: Pick<SignalOption<Returns, Nullable>, "nullable">) => InternalApiInfo<"resolveField", _ThisSrvs, [], [], [Parent], Returns, Nullable>;
67
+ interval: <Nullable extends boolean = false>(scheduleTime: number, signalOption?: SignalOption<typeof JSON, Nullable>) => InternalApiInfo<"interval", _ThisSrvs, [], [], [], typeof JSON, Nullable>;
68
+ cron: <Nullable extends boolean = false>(scheduleCron: string, signalOption?: SignalOption<typeof JSON, Nullable>) => InternalApiInfo<"cron", _ThisSrvs, [], [], [], typeof JSON, Nullable>;
69
+ timeout: <Nullable extends boolean = false>(timeout: number, signalOption?: SignalOption<typeof JSON, Nullable>) => InternalApiInfo<"timeout", _ThisSrvs, [], [], [], typeof JSON, Nullable>;
70
+ initialize: <Nullable extends boolean = false>(signalOption?: SignalOption<typeof JSON, Nullable>) => InternalApiInfo<"init", _ThisSrvs, [], [], [], typeof JSON, Nullable>;
71
+ destroy: <Nullable extends boolean = false>(signalOption?: SignalOption<typeof JSON, Nullable>) => InternalApiInfo<"destroy", _ThisSrvs, [], [], [], typeof JSON, Nullable>;
72
+ process: <Returns extends ConstantFieldTypeInput, Nullable extends boolean = false>(returnRef: Returns, signalOption?: SignalOption<Returns, Nullable>) => InternalApiInfo<"process", _ThisSrvs, [], [], [Job], Returns, Nullable>;
71
73
  }) => {
72
74
  [key: string]: InternalApiInfo<any, any, any, any, any, any, any>;
73
75
  };