@tsed/apollo 8.0.0-alpha.3 → 8.0.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/ApolloModule.js +12 -7
- package/lib/cjs/ApolloModule.js.map +1 -1
- package/lib/cjs/constants/constants.js +2 -1
- package/lib/cjs/constants/constants.js.map +1 -1
- package/lib/cjs/decorators/dataSource.js +2 -2
- package/lib/cjs/decorators/injectApolloContext.js +23 -0
- package/lib/cjs/decorators/injectApolloContext.js.map +1 -0
- package/lib/cjs/index.js +5 -0
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/interfaces/AlterApolloContext.js +3 -0
- package/lib/cjs/interfaces/AlterApolloContext.js.map +1 -0
- package/lib/cjs/interfaces/AlterApolloServerPlugins.js +3 -0
- package/lib/cjs/interfaces/AlterApolloServerPlugins.js.map +1 -0
- package/lib/cjs/interfaces/AlterApolloSettings.js +3 -0
- package/lib/cjs/interfaces/AlterApolloSettings.js.map +1 -0
- package/lib/cjs/interfaces/ApolloContext.js +3 -0
- package/lib/cjs/interfaces/ApolloContext.js.map +1 -0
- package/lib/cjs/services/ApolloService.js +73 -53
- package/lib/cjs/services/ApolloService.js.map +1 -1
- package/lib/esm/ApolloModule.js +13 -8
- package/lib/esm/ApolloModule.js.map +1 -1
- package/lib/esm/constants/constants.js +1 -0
- package/lib/esm/constants/constants.js.map +1 -1
- package/lib/esm/decorators/dataSource.js +2 -2
- package/lib/esm/decorators/injectApolloContext.js +19 -0
- package/lib/esm/decorators/injectApolloContext.js.map +1 -0
- package/lib/esm/index.js +5 -0
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/interfaces/AlterApolloContext.js +2 -0
- package/lib/esm/interfaces/AlterApolloContext.js.map +1 -0
- package/lib/esm/interfaces/AlterApolloServerPlugins.js +2 -0
- package/lib/esm/interfaces/AlterApolloServerPlugins.js.map +1 -0
- package/lib/esm/interfaces/AlterApolloSettings.js +2 -0
- package/lib/esm/interfaces/AlterApolloSettings.js.map +1 -0
- package/lib/esm/interfaces/ApolloContext.js +2 -0
- package/lib/esm/interfaces/ApolloContext.js.map +1 -0
- package/lib/esm/services/ApolloService.js +73 -53
- package/lib/esm/services/ApolloService.js.map +1 -1
- package/lib/types/ApolloModule.d.ts +3 -2
- package/lib/types/constants/constants.d.ts +1 -0
- package/lib/types/decorators/dataSource.d.ts +2 -2
- package/lib/types/decorators/injectApolloContext.d.ts +5 -0
- package/lib/types/index.d.ts +5 -0
- package/lib/types/interfaces/AlterApolloContext.d.ts +5 -0
- package/lib/types/interfaces/AlterApolloServerPlugins.d.ts +5 -0
- package/lib/types/interfaces/AlterApolloSettings.d.ts +7 -0
- package/lib/types/interfaces/ApolloContext.d.ts +4 -0
- package/lib/types/interfaces/ApolloSettings.d.ts +22 -10
- package/lib/types/services/ApolloService.d.ts +18 -14
- package/lib/types-esm/ApolloModule.d.ts +3 -2
- package/lib/types-esm/constants/constants.d.ts +1 -0
- package/lib/types-esm/decorators/dataSource.d.ts +2 -2
- package/lib/types-esm/decorators/injectApolloContext.d.ts +5 -0
- package/lib/types-esm/index.d.ts +5 -0
- package/lib/types-esm/interfaces/AlterApolloContext.d.ts +5 -0
- package/lib/types-esm/interfaces/AlterApolloServerPlugins.d.ts +5 -0
- package/lib/types-esm/interfaces/AlterApolloSettings.d.ts +7 -0
- package/lib/types-esm/interfaces/ApolloContext.d.ts +4 -0
- package/lib/types-esm/interfaces/ApolloSettings.d.ts +22 -10
- package/lib/types-esm/services/ApolloService.d.ts +18 -14
- package/package.json +17 -21
- package/readme.md +1 -24
- package/vitest.config.mts +4 -4
- package/.nycrc +0 -26
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { __decorate, __metadata
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import { ApolloServer } from "@apollo/server";
|
|
3
|
+
import { ApolloServerPluginLandingPageDisabled } from "@apollo/server/plugin/disabled";
|
|
4
|
+
import { ApolloServerPluginDrainHttpServer } from "@apollo/server/plugin/drainHttpServer";
|
|
5
|
+
import { ApolloServerPluginLandingPageLocalDefault } from "@apollo/server/plugin/landingPage/default";
|
|
6
|
+
import { useContext, InjectorService, LocalsContainer, PlatformApplication } from "@tsed/common";
|
|
4
7
|
import { Constant, Inject, Service } from "@tsed/di";
|
|
5
8
|
import { Logger } from "@tsed/logger";
|
|
6
|
-
import { ApolloServerPluginDrainHttpServer, ApolloServerPluginLandingPageDisabled, ApolloServerPluginLandingPageLocalDefault } from "apollo-server-core";
|
|
7
9
|
import Http from "http";
|
|
8
10
|
import Https from "https";
|
|
9
|
-
import { DATASOURCES_PROVIDERS } from "../constants/constants.js";
|
|
11
|
+
import { APOLLO_CONTEXT, DATASOURCES_PROVIDERS } from "../constants/constants.js";
|
|
10
12
|
let ApolloService = class ApolloService {
|
|
11
|
-
constructor(
|
|
12
|
-
this.dataSources = dataSources;
|
|
13
|
+
constructor() {
|
|
13
14
|
/**
|
|
14
15
|
*
|
|
15
16
|
* @type {Map<any, any>}
|
|
@@ -24,22 +25,40 @@ let ApolloService = class ApolloService {
|
|
|
24
25
|
this.logger.info(`Create server with Apollo for: ${id}`);
|
|
25
26
|
this.logger.debug(`options: ${JSON.stringify({ path })}`);
|
|
26
27
|
const plugins = await this.getPlugins(settings);
|
|
27
|
-
const server =
|
|
28
|
+
const server = this.createInstance({
|
|
28
29
|
...config,
|
|
29
|
-
plugins
|
|
30
|
-
dataSources: this.createDataSources(dataSources)
|
|
30
|
+
plugins
|
|
31
31
|
}, customServer);
|
|
32
32
|
if (server) {
|
|
33
33
|
this.servers.set(id || "default", {
|
|
34
34
|
instance: server,
|
|
35
|
-
schema: settings.schema
|
|
35
|
+
schema: settings.schema,
|
|
36
|
+
typeDefs: settings.typeDefs,
|
|
37
|
+
resolvers: settings.resolvers
|
|
36
38
|
});
|
|
37
39
|
await server.start();
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
const contextHandler = this.createContextHandler(server, settings);
|
|
41
|
+
switch (this.platformName) {
|
|
42
|
+
case "express":
|
|
43
|
+
const { expressMiddleware } = await import("@apollo/server/express4");
|
|
44
|
+
this.app.use(path, expressMiddleware(server, {
|
|
45
|
+
...middlewareOptions,
|
|
46
|
+
context: contextHandler
|
|
47
|
+
}));
|
|
48
|
+
break;
|
|
49
|
+
case "koa":
|
|
50
|
+
const { koaMiddleware } = await import("@as-integrations/koa");
|
|
51
|
+
this.app.use(path, koaMiddleware(server, {
|
|
52
|
+
...middlewareOptions,
|
|
53
|
+
context: contextHandler
|
|
54
|
+
}));
|
|
55
|
+
break;
|
|
56
|
+
default:
|
|
57
|
+
this.logger.warn({
|
|
58
|
+
event: "APOLLO_UNKNOWN_PLATFORM",
|
|
59
|
+
message: "Platform not supported. Please use Ts.ED platform (express, koa)"
|
|
60
|
+
});
|
|
61
|
+
}
|
|
43
62
|
}
|
|
44
63
|
}
|
|
45
64
|
catch (er) {
|
|
@@ -49,8 +68,7 @@ let ApolloService = class ApolloService {
|
|
|
49
68
|
message: er.message,
|
|
50
69
|
stack: er.stack
|
|
51
70
|
});
|
|
52
|
-
|
|
53
|
-
process.exit(-1);
|
|
71
|
+
throw er;
|
|
54
72
|
}
|
|
55
73
|
}
|
|
56
74
|
return this.get(id);
|
|
@@ -63,12 +81,21 @@ let ApolloService = class ApolloService {
|
|
|
63
81
|
return this.servers.get(id)?.instance;
|
|
64
82
|
}
|
|
65
83
|
/**
|
|
66
|
-
* Get
|
|
84
|
+
* Get schema of the ApolloServer from his id
|
|
67
85
|
* @returns GraphQLSchema
|
|
68
86
|
*/
|
|
69
87
|
getSchema(id = "default") {
|
|
70
88
|
return this.servers.get(id)?.schema;
|
|
71
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* Get TypeDefs of the ApolloServer from his id
|
|
92
|
+
*/
|
|
93
|
+
getTypeDefs(id = "default") {
|
|
94
|
+
return this.servers.get(id)?.typeDefs;
|
|
95
|
+
}
|
|
96
|
+
getResolvers(id = "default") {
|
|
97
|
+
return this.servers.get(id)?.resolvers;
|
|
98
|
+
}
|
|
72
99
|
/**
|
|
73
100
|
*
|
|
74
101
|
* @param {string} id
|
|
@@ -77,47 +104,42 @@ let ApolloService = class ApolloService {
|
|
|
77
104
|
has(id = "default") {
|
|
78
105
|
return this.servers.has(id);
|
|
79
106
|
}
|
|
80
|
-
async createInstance(options, server) {
|
|
81
|
-
if (server) {
|
|
82
|
-
return server(options);
|
|
83
|
-
}
|
|
84
|
-
const importServer = async () => {
|
|
85
|
-
switch (this.platformName) {
|
|
86
|
-
default:
|
|
87
|
-
this.logger.error(`Platform "${this.platformName}" not supported by @tsed/apollo`);
|
|
88
|
-
case "express":
|
|
89
|
-
return (await import("apollo-server-express")).ApolloServer;
|
|
90
|
-
case "koa":
|
|
91
|
-
return (await import("apollo-server-koa")).ApolloServer;
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
const Server = await importServer();
|
|
95
|
-
return new Server(options);
|
|
96
|
-
}
|
|
97
107
|
/**
|
|
98
108
|
* create a new dataSources function to use with apollo server config
|
|
99
|
-
* @param dataSources
|
|
100
109
|
*/
|
|
101
|
-
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
name = name || nameOf(klass);
|
|
110
|
+
createContextHandler(server, settings) {
|
|
111
|
+
const { injector } = this;
|
|
112
|
+
const dataSourcesContainer = injector.getProviders(DATASOURCES_PROVIDERS).reduce((map, provider) => {
|
|
113
|
+
let { name } = provider.store.get(DATASOURCES_PROVIDERS);
|
|
114
|
+
name = name || provider.className;
|
|
107
115
|
const sourceName = `${name[0].toLowerCase()}${name.slice(1)}`;
|
|
108
|
-
map
|
|
116
|
+
map.set(sourceName, provider);
|
|
109
117
|
return map;
|
|
110
|
-
},
|
|
111
|
-
return () => {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
118
|
+
}, new Map());
|
|
119
|
+
return async () => {
|
|
120
|
+
const $ctx = useContext();
|
|
121
|
+
const context = {
|
|
122
|
+
dataSources: {
|
|
123
|
+
...(settings.dataSources?.() || {})
|
|
124
|
+
}
|
|
115
125
|
};
|
|
126
|
+
const alteredContext = await this.injector.alterAsync("$alterApolloContext", context, $ctx);
|
|
127
|
+
$ctx.set(APOLLO_CONTEXT, alteredContext);
|
|
128
|
+
const locals = new LocalsContainer();
|
|
129
|
+
locals.set(APOLLO_CONTEXT, alteredContext);
|
|
130
|
+
locals.set(ApolloServer, server);
|
|
131
|
+
dataSourcesContainer.forEach((provider, key) => {
|
|
132
|
+
alteredContext.dataSources[key] = injector.invoke(provider.token, locals);
|
|
133
|
+
});
|
|
134
|
+
return alteredContext;
|
|
116
135
|
};
|
|
117
136
|
}
|
|
137
|
+
createInstance(options, server) {
|
|
138
|
+
return server ? server(options) : new ApolloServer(options);
|
|
139
|
+
}
|
|
118
140
|
async getPlugins(serverSettings) {
|
|
119
141
|
const playground = serverSettings.playground || (serverSettings.playground === undefined && process.env.NODE_ENV !== "production");
|
|
120
|
-
const result = await this.injector.
|
|
142
|
+
const result = await this.injector.alterAsync("$alterApolloServerPlugins", [
|
|
121
143
|
this.httpServer &&
|
|
122
144
|
ApolloServerPluginDrainHttpServer({
|
|
123
145
|
httpServer: this.httpServer
|
|
@@ -158,9 +180,7 @@ __decorate([
|
|
|
158
180
|
__metadata("design:type", InjectorService)
|
|
159
181
|
], ApolloService.prototype, "injector", void 0);
|
|
160
182
|
ApolloService = __decorate([
|
|
161
|
-
Service()
|
|
162
|
-
__param(0, Inject(DATASOURCES_PROVIDERS)),
|
|
163
|
-
__metadata("design:paramtypes", [Array])
|
|
183
|
+
Service()
|
|
164
184
|
], ApolloService);
|
|
165
185
|
export { ApolloService };
|
|
166
186
|
//# sourceMappingURL=ApolloService.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApolloService.js","sourceRoot":"","sources":["../../../src/services/ApolloService.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EAAE;8BACS,eAAe;+CAAC;AAhCvB,aAAa;IADzB,OAAO,EAAE;GACG,aAAa,CAoNzB;SApNY,aAAa"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { AfterListen, Logger, OnRoutesInit } from "@tsed/common";
|
|
2
|
-
import { Configuration } from "@tsed/di";
|
|
2
|
+
import { Configuration, InjectorService } from "@tsed/di";
|
|
3
3
|
import { ApolloSettings } from "./interfaces/ApolloSettings.js";
|
|
4
4
|
import { ApolloService } from "./services/ApolloService.js";
|
|
5
5
|
export declare class ApolloModule implements OnRoutesInit, AfterListen {
|
|
6
6
|
protected logger: Logger;
|
|
7
7
|
protected service: ApolloService;
|
|
8
8
|
protected configuration: Configuration;
|
|
9
|
+
protected injector: InjectorService;
|
|
9
10
|
get settings(): {
|
|
10
11
|
[key: string]: ApolloSettings;
|
|
11
12
|
} | undefined;
|
|
12
|
-
$onRoutesInit(): Promise<
|
|
13
|
+
$onRoutesInit(): Promise<void>;
|
|
13
14
|
$afterListen(): Promise<any> | void;
|
|
14
15
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* ```typescript
|
|
5
5
|
* import { DataSourceService } from "@tsed/graphql";
|
|
6
|
-
* import { RESTDataSource } from 'apollo
|
|
6
|
+
* import { RESTDataSource } from '@apollo/datasource-rest';
|
|
7
7
|
*
|
|
8
8
|
* @DataSource()
|
|
9
9
|
* export class MyDataSource extends RESTDataSource {
|
|
@@ -31,7 +31,7 @@ export declare function DataSource(name?: string): ClassDecorator;
|
|
|
31
31
|
*
|
|
32
32
|
* ```typescript
|
|
33
33
|
* import { DataSourceService } from "@tsed/graphql";
|
|
34
|
-
* import { RESTDataSource } from 'apollo
|
|
34
|
+
* import { RESTDataSource } from '@apollo/datasource-rest';
|
|
35
35
|
*
|
|
36
36
|
* @DataSource()
|
|
37
37
|
* export class MyDataSource extends RESTDataSource {
|
package/lib/types/index.d.ts
CHANGED
|
@@ -4,5 +4,10 @@
|
|
|
4
4
|
export * from "./ApolloModule.js";
|
|
5
5
|
export * from "./constants/constants.js";
|
|
6
6
|
export * from "./decorators/dataSource.js";
|
|
7
|
+
export * from "./decorators/injectApolloContext.js";
|
|
8
|
+
export * from "./interfaces/AlterApolloContext.js";
|
|
9
|
+
export * from "./interfaces/AlterApolloServerPlugins.js";
|
|
10
|
+
export * from "./interfaces/AlterApolloSettings.js";
|
|
11
|
+
export * from "./interfaces/ApolloContext.js";
|
|
7
12
|
export * from "./interfaces/ApolloSettings.js";
|
|
8
13
|
export * from "./services/ApolloService.js";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PlatformContext } from "@tsed/common";
|
|
2
|
+
import type { ApolloContext } from "./ApolloContext";
|
|
3
|
+
export interface AlterApolloContext<Context extends ApolloContext = ApolloContext> {
|
|
4
|
+
$alterApolloContext(context: Context, $ctx: PlatformContext): Context | Promise<Context>;
|
|
5
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ApolloServerPlugin } from "@apollo/server";
|
|
2
|
+
import type { ApolloSettings } from "./ApolloSettings";
|
|
3
|
+
export interface AlterApolloServerPlugins {
|
|
4
|
+
$alterApolloServerPlugins(plugins: ApolloServerPlugin[], serverSettings: ApolloSettings): ApolloServerPlugin[] | Promise<ApolloServerPlugin[]>;
|
|
5
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ApolloContext } from "./ApolloContext.js";
|
|
2
|
+
import type { ApolloSettingsWithID } from "./ApolloSettings.js";
|
|
3
|
+
export interface AlterApolloSettings<Context extends ApolloContext = ApolloContext> {
|
|
4
|
+
$alterApolloSettings(settings: ApolloSettingsWithID<Context>): (ApolloSettingsWithID<Context> & {
|
|
5
|
+
id: string;
|
|
6
|
+
}) | Promise<ApolloSettingsWithID<Context>>;
|
|
7
|
+
}
|
|
@@ -1,20 +1,32 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ApolloServer, ApolloServerOptions, ApolloServerOptionsWithSchema } from "@apollo/server";
|
|
2
|
+
import type { GatewayInterface } from "@apollo/server-gateway-interface";
|
|
3
|
+
import type { IExecutableSchemaDefinition } from "@graphql-tools/schema";
|
|
4
|
+
import type { GraphQLSchema } from "graphql/index";
|
|
5
|
+
import { ApolloContext } from "./ApolloContext";
|
|
2
6
|
export type ApolloMiddlewareOptions = Record<string, any>;
|
|
3
|
-
export type
|
|
4
|
-
getMiddleware(settings: ApolloMiddlewareOptions): any;
|
|
5
|
-
};
|
|
6
|
-
export type ApolloCustomServerCB = (config: ApolloConfig) => ApolloServer;
|
|
7
|
-
export type ApolloConfig = Config;
|
|
7
|
+
export type ApolloCustomServerCB<TContext extends ApolloContext> = (config: ApolloServerOptions<TContext>) => ApolloServer<TContext>;
|
|
8
8
|
declare global {
|
|
9
9
|
namespace TsED {
|
|
10
10
|
interface ApolloSettings {
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
export
|
|
14
|
+
export type ApolloServerOptionsBase<TContext extends ApolloContext = ApolloContext> = Omit<ApolloServerOptionsWithSchema<TContext>, "schema" | "typeDefs" | "resolvers" | "gateway">;
|
|
15
|
+
export type ApolloSettings<TContext extends ApolloContext = ApolloContext> = ApolloServerOptionsBase<TContext> & TsED.ApolloSettings & {
|
|
15
16
|
path: string;
|
|
16
|
-
server?: ApolloCustomServerCB
|
|
17
|
-
playground?: boolean
|
|
17
|
+
server?: ApolloCustomServerCB<TContext>;
|
|
18
|
+
playground?: boolean;
|
|
18
19
|
serverRegistration?: ApolloMiddlewareOptions;
|
|
19
20
|
middlewareOptions?: ApolloMiddlewareOptions;
|
|
20
|
-
|
|
21
|
+
schema?: GraphQLSchema;
|
|
22
|
+
typeDefs?: IExecutableSchemaDefinition<TContext>["typeDefs"];
|
|
23
|
+
resolvers?: IExecutableSchemaDefinition<TContext>["resolvers"];
|
|
24
|
+
gateway?: GatewayInterface;
|
|
25
|
+
/**
|
|
26
|
+
* @deprecated use $alterApolloContext instead
|
|
27
|
+
*/
|
|
28
|
+
dataSources?: () => Record<string, unknown>;
|
|
29
|
+
};
|
|
30
|
+
export type ApolloSettingsWithID<TContext extends ApolloContext = ApolloContext> = ApolloSettings<TContext> & {
|
|
31
|
+
id: string;
|
|
32
|
+
};
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
+
import { ApolloServer, ApolloServerOptions } from "@apollo/server";
|
|
2
|
+
import type { IExecutableSchemaDefinition } from "@graphql-tools/schema";
|
|
1
3
|
import { Logger } from "@tsed/logger";
|
|
2
|
-
import type { Config } from "apollo-server-core";
|
|
3
|
-
import { ApolloServerBase } from "apollo-server-core";
|
|
4
4
|
import type { GraphQLSchema } from "graphql";
|
|
5
|
-
import
|
|
6
|
-
import { ApolloCustomServerCB } from "../interfaces/ApolloSettings.js";
|
|
5
|
+
import { ApolloContext } from "../interfaces/ApolloContext.js";
|
|
6
|
+
import type { ApolloCustomServerCB, ApolloSettings } from "../interfaces/ApolloSettings.js";
|
|
7
7
|
export declare class ApolloService {
|
|
8
|
-
protected dataSources: any[];
|
|
9
8
|
platformName: string;
|
|
10
9
|
protected logger: Logger;
|
|
11
10
|
/**
|
|
@@ -14,36 +13,41 @@ export declare class ApolloService {
|
|
|
14
13
|
* @private
|
|
15
14
|
*/
|
|
16
15
|
protected servers: Map<string, {
|
|
17
|
-
instance:
|
|
18
|
-
schema
|
|
16
|
+
instance: ApolloServer<ApolloContext>;
|
|
17
|
+
schema?: GraphQLSchema;
|
|
18
|
+
typeDefs?: IExecutableSchemaDefinition<ApolloContext>["typeDefs"];
|
|
19
|
+
resolvers?: IExecutableSchemaDefinition<ApolloContext>["resolvers"];
|
|
19
20
|
}>;
|
|
20
21
|
private app;
|
|
21
22
|
private httpServer;
|
|
22
23
|
private httpsServer;
|
|
23
24
|
private injector;
|
|
24
|
-
|
|
25
|
-
createServer(id: string, settings: ApolloSettings): Promise<ApolloServer>;
|
|
25
|
+
createServer(id: string, settings: ApolloSettings): Promise<ApolloServer<ApolloContext>>;
|
|
26
26
|
/**
|
|
27
27
|
* Get an instance of ApolloServer from his id
|
|
28
28
|
* @returns ApolloServer
|
|
29
29
|
*/
|
|
30
|
-
get(id?: string):
|
|
30
|
+
get(id?: string): ApolloServer<ApolloContext> | undefined;
|
|
31
31
|
/**
|
|
32
|
-
* Get
|
|
32
|
+
* Get schema of the ApolloServer from his id
|
|
33
33
|
* @returns GraphQLSchema
|
|
34
34
|
*/
|
|
35
35
|
getSchema(id?: string): GraphQLSchema | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Get TypeDefs of the ApolloServer from his id
|
|
38
|
+
*/
|
|
39
|
+
getTypeDefs(id?: string): import("@graphql-tools/utils").TypeSource | undefined;
|
|
40
|
+
getResolvers(id?: string): import("@graphql-tools/utils").IResolvers<any, ApolloContext, Record<string, any>, any> | import("@graphql-tools/utils").IResolvers<any, ApolloContext, Record<string, any>, any>[] | undefined;
|
|
36
41
|
/**
|
|
37
42
|
*
|
|
38
43
|
* @param {string} id
|
|
39
44
|
* @returns {boolean}
|
|
40
45
|
*/
|
|
41
46
|
has(id?: string): boolean;
|
|
42
|
-
protected createInstance(options: Config, server?: ApolloCustomServerCB): Promise<ApolloServer | undefined>;
|
|
43
47
|
/**
|
|
44
48
|
* create a new dataSources function to use with apollo server config
|
|
45
|
-
* @param dataSources
|
|
46
49
|
*/
|
|
47
|
-
|
|
50
|
+
createContextHandler(server: ApolloServer<ApolloContext>, settings: ApolloSettings): () => Promise<any>;
|
|
51
|
+
protected createInstance(options: ApolloServerOptions<ApolloContext>, server?: ApolloCustomServerCB<ApolloContext>): ApolloServer<ApolloContext>;
|
|
48
52
|
private getPlugins;
|
|
49
53
|
}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { AfterListen, Logger, OnRoutesInit } from "@tsed/common";
|
|
2
|
-
import { Configuration } from "@tsed/di";
|
|
2
|
+
import { Configuration, InjectorService } from "@tsed/di";
|
|
3
3
|
import { ApolloSettings } from "./interfaces/ApolloSettings.js";
|
|
4
4
|
import { ApolloService } from "./services/ApolloService.js";
|
|
5
5
|
export declare class ApolloModule implements OnRoutesInit, AfterListen {
|
|
6
6
|
protected logger: Logger;
|
|
7
7
|
protected service: ApolloService;
|
|
8
8
|
protected configuration: Configuration;
|
|
9
|
+
protected injector: InjectorService;
|
|
9
10
|
get settings(): {
|
|
10
11
|
[key: string]: ApolloSettings;
|
|
11
12
|
} | undefined;
|
|
12
|
-
$onRoutesInit(): Promise<
|
|
13
|
+
$onRoutesInit(): Promise<void>;
|
|
13
14
|
$afterListen(): Promise<any> | void;
|
|
14
15
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* ```typescript
|
|
5
5
|
* import { DataSourceService } from "@tsed/graphql";
|
|
6
|
-
* import { RESTDataSource } from 'apollo
|
|
6
|
+
* import { RESTDataSource } from '@apollo/datasource-rest';
|
|
7
7
|
*
|
|
8
8
|
* @DataSource()
|
|
9
9
|
* export class MyDataSource extends RESTDataSource {
|
|
@@ -31,7 +31,7 @@ export declare function DataSource(name?: string): ClassDecorator;
|
|
|
31
31
|
*
|
|
32
32
|
* ```typescript
|
|
33
33
|
* import { DataSourceService } from "@tsed/graphql";
|
|
34
|
-
* import { RESTDataSource } from 'apollo
|
|
34
|
+
* import { RESTDataSource } from '@apollo/datasource-rest';
|
|
35
35
|
*
|
|
36
36
|
* @DataSource()
|
|
37
37
|
* export class MyDataSource extends RESTDataSource {
|
package/lib/types-esm/index.d.ts
CHANGED
|
@@ -4,5 +4,10 @@
|
|
|
4
4
|
export * from "./ApolloModule.js";
|
|
5
5
|
export * from "./constants/constants.js";
|
|
6
6
|
export * from "./decorators/dataSource.js";
|
|
7
|
+
export * from "./decorators/injectApolloContext.js";
|
|
8
|
+
export * from "./interfaces/AlterApolloContext.js";
|
|
9
|
+
export * from "./interfaces/AlterApolloServerPlugins.js";
|
|
10
|
+
export * from "./interfaces/AlterApolloSettings.js";
|
|
11
|
+
export * from "./interfaces/ApolloContext.js";
|
|
7
12
|
export * from "./interfaces/ApolloSettings.js";
|
|
8
13
|
export * from "./services/ApolloService.js";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PlatformContext } from "@tsed/common";
|
|
2
|
+
import type { ApolloContext } from "./ApolloContext";
|
|
3
|
+
export interface AlterApolloContext<Context extends ApolloContext = ApolloContext> {
|
|
4
|
+
$alterApolloContext(context: Context, $ctx: PlatformContext): Context | Promise<Context>;
|
|
5
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ApolloServerPlugin } from "@apollo/server";
|
|
2
|
+
import type { ApolloSettings } from "./ApolloSettings";
|
|
3
|
+
export interface AlterApolloServerPlugins {
|
|
4
|
+
$alterApolloServerPlugins(plugins: ApolloServerPlugin[], serverSettings: ApolloSettings): ApolloServerPlugin[] | Promise<ApolloServerPlugin[]>;
|
|
5
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ApolloContext } from "./ApolloContext.js";
|
|
2
|
+
import type { ApolloSettingsWithID } from "./ApolloSettings.js";
|
|
3
|
+
export interface AlterApolloSettings<Context extends ApolloContext = ApolloContext> {
|
|
4
|
+
$alterApolloSettings(settings: ApolloSettingsWithID<Context>): (ApolloSettingsWithID<Context> & {
|
|
5
|
+
id: string;
|
|
6
|
+
}) | Promise<ApolloSettingsWithID<Context>>;
|
|
7
|
+
}
|
|
@@ -1,20 +1,32 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ApolloServer, ApolloServerOptions, ApolloServerOptionsWithSchema } from "@apollo/server";
|
|
2
|
+
import type { GatewayInterface } from "@apollo/server-gateway-interface";
|
|
3
|
+
import type { IExecutableSchemaDefinition } from "@graphql-tools/schema";
|
|
4
|
+
import type { GraphQLSchema } from "graphql/index";
|
|
5
|
+
import { ApolloContext } from "./ApolloContext";
|
|
2
6
|
export type ApolloMiddlewareOptions = Record<string, any>;
|
|
3
|
-
export type
|
|
4
|
-
getMiddleware(settings: ApolloMiddlewareOptions): any;
|
|
5
|
-
};
|
|
6
|
-
export type ApolloCustomServerCB = (config: ApolloConfig) => ApolloServer;
|
|
7
|
-
export type ApolloConfig = Config;
|
|
7
|
+
export type ApolloCustomServerCB<TContext extends ApolloContext> = (config: ApolloServerOptions<TContext>) => ApolloServer<TContext>;
|
|
8
8
|
declare global {
|
|
9
9
|
namespace TsED {
|
|
10
10
|
interface ApolloSettings {
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
export
|
|
14
|
+
export type ApolloServerOptionsBase<TContext extends ApolloContext = ApolloContext> = Omit<ApolloServerOptionsWithSchema<TContext>, "schema" | "typeDefs" | "resolvers" | "gateway">;
|
|
15
|
+
export type ApolloSettings<TContext extends ApolloContext = ApolloContext> = ApolloServerOptionsBase<TContext> & TsED.ApolloSettings & {
|
|
15
16
|
path: string;
|
|
16
|
-
server?: ApolloCustomServerCB
|
|
17
|
-
playground?: boolean
|
|
17
|
+
server?: ApolloCustomServerCB<TContext>;
|
|
18
|
+
playground?: boolean;
|
|
18
19
|
serverRegistration?: ApolloMiddlewareOptions;
|
|
19
20
|
middlewareOptions?: ApolloMiddlewareOptions;
|
|
20
|
-
|
|
21
|
+
schema?: GraphQLSchema;
|
|
22
|
+
typeDefs?: IExecutableSchemaDefinition<TContext>["typeDefs"];
|
|
23
|
+
resolvers?: IExecutableSchemaDefinition<TContext>["resolvers"];
|
|
24
|
+
gateway?: GatewayInterface;
|
|
25
|
+
/**
|
|
26
|
+
* @deprecated use $alterApolloContext instead
|
|
27
|
+
*/
|
|
28
|
+
dataSources?: () => Record<string, unknown>;
|
|
29
|
+
};
|
|
30
|
+
export type ApolloSettingsWithID<TContext extends ApolloContext = ApolloContext> = ApolloSettings<TContext> & {
|
|
31
|
+
id: string;
|
|
32
|
+
};
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
+
import { ApolloServer, ApolloServerOptions } from "@apollo/server";
|
|
2
|
+
import type { IExecutableSchemaDefinition } from "@graphql-tools/schema";
|
|
1
3
|
import { Logger } from "@tsed/logger";
|
|
2
|
-
import type { Config } from "apollo-server-core";
|
|
3
|
-
import { ApolloServerBase } from "apollo-server-core";
|
|
4
4
|
import type { GraphQLSchema } from "graphql";
|
|
5
|
-
import
|
|
6
|
-
import { ApolloCustomServerCB } from "../interfaces/ApolloSettings.js";
|
|
5
|
+
import { ApolloContext } from "../interfaces/ApolloContext.js";
|
|
6
|
+
import type { ApolloCustomServerCB, ApolloSettings } from "../interfaces/ApolloSettings.js";
|
|
7
7
|
export declare class ApolloService {
|
|
8
|
-
protected dataSources: any[];
|
|
9
8
|
platformName: string;
|
|
10
9
|
protected logger: Logger;
|
|
11
10
|
/**
|
|
@@ -14,36 +13,41 @@ export declare class ApolloService {
|
|
|
14
13
|
* @private
|
|
15
14
|
*/
|
|
16
15
|
protected servers: Map<string, {
|
|
17
|
-
instance:
|
|
18
|
-
schema
|
|
16
|
+
instance: ApolloServer<ApolloContext>;
|
|
17
|
+
schema?: GraphQLSchema;
|
|
18
|
+
typeDefs?: IExecutableSchemaDefinition<ApolloContext>["typeDefs"];
|
|
19
|
+
resolvers?: IExecutableSchemaDefinition<ApolloContext>["resolvers"];
|
|
19
20
|
}>;
|
|
20
21
|
private app;
|
|
21
22
|
private httpServer;
|
|
22
23
|
private httpsServer;
|
|
23
24
|
private injector;
|
|
24
|
-
|
|
25
|
-
createServer(id: string, settings: ApolloSettings): Promise<ApolloServer>;
|
|
25
|
+
createServer(id: string, settings: ApolloSettings): Promise<ApolloServer<ApolloContext>>;
|
|
26
26
|
/**
|
|
27
27
|
* Get an instance of ApolloServer from his id
|
|
28
28
|
* @returns ApolloServer
|
|
29
29
|
*/
|
|
30
|
-
get(id?: string):
|
|
30
|
+
get(id?: string): ApolloServer<ApolloContext> | undefined;
|
|
31
31
|
/**
|
|
32
|
-
* Get
|
|
32
|
+
* Get schema of the ApolloServer from his id
|
|
33
33
|
* @returns GraphQLSchema
|
|
34
34
|
*/
|
|
35
35
|
getSchema(id?: string): GraphQLSchema | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Get TypeDefs of the ApolloServer from his id
|
|
38
|
+
*/
|
|
39
|
+
getTypeDefs(id?: string): import("@graphql-tools/utils").TypeSource | undefined;
|
|
40
|
+
getResolvers(id?: string): import("@graphql-tools/utils").IResolvers<any, ApolloContext, Record<string, any>, any> | import("@graphql-tools/utils").IResolvers<any, ApolloContext, Record<string, any>, any>[] | undefined;
|
|
36
41
|
/**
|
|
37
42
|
*
|
|
38
43
|
* @param {string} id
|
|
39
44
|
* @returns {boolean}
|
|
40
45
|
*/
|
|
41
46
|
has(id?: string): boolean;
|
|
42
|
-
protected createInstance(options: Config, server?: ApolloCustomServerCB): Promise<ApolloServer | undefined>;
|
|
43
47
|
/**
|
|
44
48
|
* create a new dataSources function to use with apollo server config
|
|
45
|
-
* @param dataSources
|
|
46
49
|
*/
|
|
47
|
-
|
|
50
|
+
createContextHandler(server: ApolloServer<ApolloContext>, settings: ApolloSettings): () => Promise<any>;
|
|
51
|
+
protected createInstance(options: ApolloServerOptions<ApolloContext>, server?: ApolloCustomServerCB<ApolloContext>): ApolloServer<ApolloContext>;
|
|
48
52
|
private getPlugins;
|
|
49
53
|
}
|