Skip to content

Commit e164dbe

Browse files
committed
fix d.ts
1 parent e5913e8 commit e164dbe

1 file changed

Lines changed: 38 additions & 34 deletions

File tree

index.d.ts

Lines changed: 38 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
} from "@apollo/server";
1313
import { ServerOptions as WsServerOptions } from "graphql-ws";
1414

15-
interface GraphQLActionOptions {
15+
export interface GraphQLActionOptions {
1616
query?: string | string[];
1717
mutation?: string | string[];
1818
subscription?: string | string[];
@@ -27,6 +27,37 @@ interface GraphQLActionOptions {
2727
dataLoaderBatchParam?: string;
2828
}
2929

30+
export interface ActionResolverSchema {
31+
action: string;
32+
rootParams?: {
33+
[key: string]: string;
34+
};
35+
dataLoader?: boolean;
36+
nullIfError?: boolean;
37+
skipNullKeys?: boolean;
38+
params?: { [key: string]: any };
39+
}
40+
41+
export interface ServiceResolverSchema {
42+
[key: string]:
43+
| {
44+
[key: string]: ActionResolverSchema;
45+
}
46+
| GraphQLScalarType;
47+
}
48+
49+
export interface ServiceGraphQLSettings {
50+
query?: string | string[];
51+
mutation?: string | string[];
52+
subscription?: string | string[];
53+
type?: string | string[];
54+
interface?: string | string[];
55+
union?: string | string[];
56+
enum?: string | string[];
57+
input?: string | string[];
58+
resolvers?: ServiceResolverSchema;
59+
}
60+
3061
declare module "moleculer-apollo-server" {
3162
export { GraphQLError } from "graphql";
3263

@@ -46,38 +77,7 @@ declare module "moleculer-apollo-server" {
4677
): (req: IncomingRequest, res: GatewayResponse) => Promise<void>;
4778
}
4879

49-
export interface ActionResolverSchema {
50-
action: string;
51-
rootParams?: {
52-
[key: string]: string;
53-
};
54-
dataLoader?: boolean;
55-
nullIfError?: boolean;
56-
skipNullKeys?: boolean;
57-
params?: { [key: string]: any };
58-
}
59-
60-
export interface ServiceResolverSchema {
61-
[key: string]:
62-
| {
63-
[key: string]: ActionResolverSchema;
64-
}
65-
| GraphQLScalarType;
66-
}
67-
68-
export interface ServiceGraphQLSettings {
69-
query?: string | string[];
70-
mutation?: string | string[];
71-
subscription?: string | string[];
72-
type?: string | string[];
73-
interface?: string | string[];
74-
union?: string | string[];
75-
enum?: string | string[];
76-
input?: string | string[];
77-
resolvers?: ServiceResolverSchema;
78-
}
79-
80-
export interface ApolloServiceOptions {
80+
export interface ApolloMixinOptions {
8181
serverOptions?: BaseApolloServerOptions<BaseContext> & {
8282
subscriptions?: boolean | WsServerOptions;
8383
};
@@ -146,7 +146,7 @@ declare module "moleculer-apollo-server" {
146146
wsServer?: WebSocketServer;
147147
}
148148

149-
export function ApolloService(options: ApolloServiceOptions): ServiceSchema;
149+
export function ApolloService(options: ApolloMixinOptions): ServiceSchema;
150150

151151
export function moleculerGql(
152152
typeString: TemplateStringsArray | string,
@@ -158,4 +158,8 @@ declare module "moleculer" {
158158
interface ActionSchema {
159159
graphql?: GraphQLActionOptions;
160160
}
161+
162+
interface ServiceSettingSchema {
163+
graphql?: ServiceGraphQLSettings;
164+
}
161165
}

0 commit comments

Comments
 (0)