@tsed/apollo 7.79.3 → 7.80.0
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/services/ApolloService.js +2 -2
- package/lib/cjs/services/ApolloService.js.map +1 -1
- package/lib/types-esm/ApolloModule.d.ts +14 -0
- package/lib/types-esm/constants/constants.d.ts +1 -0
- package/lib/types-esm/decorators/dataSource.d.ts +56 -0
- package/lib/types-esm/index.d.ts +8 -0
- package/lib/types-esm/interfaces/ApolloSettings.d.ts +20 -0
- package/lib/types-esm/services/ApolloService.d.ts +49 -0
- package/package.json +20 -16
- package/vitest.config.mts +21 -0
- package/jest.config.js +0 -14
- package/lib/cjs/package.json +0 -3
- package/lib/esm/package.json +0 -3
- package/tsconfig.esm.json +0 -39
|
@@ -96,9 +96,9 @@ let ApolloService = class ApolloService {
|
|
|
96
96
|
default:
|
|
97
97
|
this.logger.error(`Platform "${this.platformName}" not supported by @tsed/apollo`);
|
|
98
98
|
case "express":
|
|
99
|
-
return (await
|
|
99
|
+
return (await import("apollo-server-express")).ApolloServer;
|
|
100
100
|
case "koa":
|
|
101
|
-
return (await
|
|
101
|
+
return (await import("apollo-server-koa")).ApolloServer;
|
|
102
102
|
}
|
|
103
103
|
};
|
|
104
104
|
const Server = await importServer();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApolloService.js","sourceRoot":"","sources":["../../../src/services/ApolloService.ts"],"names":[],"mappings":";;;;AAAA,yCAAkE;AAClE,qCAAkD;AAClD,iCAAmD;AACnD,yCAAoC;AAEpC,2DAK4B;AAG5B,wDAAwB;AACxB,0DAA0B;AAC1B,4DAAgE;AAKzD,IAAM,aAAa,GAAnB,MAAM,aAAa;IAgC6B;IA9BrD,YAAY,CAAS;IAGX,MAAM,CAAS;IAEzB;;;;OAIG;IACO,OAAO,GAMb,IAAI,GAAG,EAAE,CAAC;IAGN,GAAG,CAA2B;IAG9B,UAAU,CAAqB;IAG/B,W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LzB;AAlLY,sCAAa"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AfterListen, Logger, OnRoutesInit } from "@tsed/common";
|
|
2
|
+
import { Configuration } from "@tsed/di";
|
|
3
|
+
import { ApolloSettings } from "./interfaces/ApolloSettings.js";
|
|
4
|
+
import { ApolloService } from "./services/ApolloService.js";
|
|
5
|
+
export declare class ApolloModule implements OnRoutesInit, AfterListen {
|
|
6
|
+
protected logger: Logger;
|
|
7
|
+
protected service: ApolloService;
|
|
8
|
+
protected configuration: Configuration;
|
|
9
|
+
get settings(): {
|
|
10
|
+
[key: string]: ApolloSettings;
|
|
11
|
+
} | undefined;
|
|
12
|
+
$onRoutesInit(): Promise<any> | void;
|
|
13
|
+
$afterListen(): Promise<any> | void;
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const DATASOURCES_PROVIDERS = "graphql:datasources";
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a new injectable DataSource.
|
|
3
|
+
*
|
|
4
|
+
* ```typescript
|
|
5
|
+
* import { DataSourceService } from "@tsed/graphql";
|
|
6
|
+
* import { RESTDataSource } from 'apollo-datasource-rest';
|
|
7
|
+
*
|
|
8
|
+
* @DataSource()
|
|
9
|
+
* export class MyDataSource extends RESTDataSource {
|
|
10
|
+
* constructor() {
|
|
11
|
+
* super();
|
|
12
|
+
* this.baseURL = 'https://awesome-api.example.com';
|
|
13
|
+
* }
|
|
14
|
+
*
|
|
15
|
+
* willSendRequest(request) {
|
|
16
|
+
* request.headers.set('Authorization', this.context.token);
|
|
17
|
+
* }
|
|
18
|
+
*
|
|
19
|
+
* getMyData(id: string) {
|
|
20
|
+
* return this.get(`/v1/my_rest_data/${id}`);
|
|
21
|
+
* }
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @decorator
|
|
26
|
+
* @graphql
|
|
27
|
+
*/
|
|
28
|
+
export declare function DataSource(name?: string): ClassDecorator;
|
|
29
|
+
/**
|
|
30
|
+
* Create a new injectable DataSource.
|
|
31
|
+
*
|
|
32
|
+
* ```typescript
|
|
33
|
+
* import { DataSourceService } from "@tsed/graphql";
|
|
34
|
+
* import { RESTDataSource } from 'apollo-datasource-rest';
|
|
35
|
+
*
|
|
36
|
+
* @DataSource()
|
|
37
|
+
* export class MyDataSource extends RESTDataSource {
|
|
38
|
+
* constructor() {
|
|
39
|
+
* super();
|
|
40
|
+
* this.baseURL = 'https://awesome-api.example.com';
|
|
41
|
+
* }
|
|
42
|
+
*
|
|
43
|
+
* willSendRequest(request) {
|
|
44
|
+
* request.headers.set('Authorization', this.context.token);
|
|
45
|
+
* }
|
|
46
|
+
*
|
|
47
|
+
* getMyData(id: string) {
|
|
48
|
+
* return this.get(`/v1/my_rest_data/${id}`);
|
|
49
|
+
* }
|
|
50
|
+
* }
|
|
51
|
+
* ```
|
|
52
|
+
*
|
|
53
|
+
* @decorator
|
|
54
|
+
* @graphql
|
|
55
|
+
*/
|
|
56
|
+
export declare const DataSourceService: typeof DataSource;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Automatically generated by @tsed/barrels.
|
|
3
|
+
*/
|
|
4
|
+
export * from "./ApolloModule.js";
|
|
5
|
+
export * from "./constants/constants.js";
|
|
6
|
+
export * from "./decorators/dataSource.js";
|
|
7
|
+
export * from "./interfaces/ApolloSettings.js";
|
|
8
|
+
export * from "./services/ApolloService.js";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ApolloServerBase, ApolloServerPluginLandingPageGraphQLPlaygroundOptions, Config } from "apollo-server-core";
|
|
2
|
+
export type ApolloMiddlewareOptions = Record<string, any>;
|
|
3
|
+
export type ApolloServer = ApolloServerBase & {
|
|
4
|
+
getMiddleware(settings: ApolloMiddlewareOptions): any;
|
|
5
|
+
};
|
|
6
|
+
export type ApolloCustomServerCB = (config: ApolloConfig) => ApolloServer;
|
|
7
|
+
export type ApolloConfig = Config;
|
|
8
|
+
declare global {
|
|
9
|
+
namespace TsED {
|
|
10
|
+
interface ApolloSettings {
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export interface ApolloSettings extends ApolloConfig, TsED.ApolloSettings {
|
|
15
|
+
path: string;
|
|
16
|
+
server?: ApolloCustomServerCB;
|
|
17
|
+
playground?: boolean | ApolloServerPluginLandingPageGraphQLPlaygroundOptions;
|
|
18
|
+
serverRegistration?: ApolloMiddlewareOptions;
|
|
19
|
+
middlewareOptions?: ApolloMiddlewareOptions;
|
|
20
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Logger } from "@tsed/logger";
|
|
2
|
+
import type { Config } from "apollo-server-core";
|
|
3
|
+
import { ApolloServerBase } from "apollo-server-core";
|
|
4
|
+
import type { GraphQLSchema } from "graphql";
|
|
5
|
+
import type { ApolloServer, ApolloSettings } from "../interfaces/ApolloSettings.js";
|
|
6
|
+
import { ApolloCustomServerCB } from "../interfaces/ApolloSettings.js";
|
|
7
|
+
export declare class ApolloService {
|
|
8
|
+
protected dataSources: any[];
|
|
9
|
+
platformName: string;
|
|
10
|
+
protected logger: Logger;
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
* @type {Map<any, any>}
|
|
14
|
+
* @private
|
|
15
|
+
*/
|
|
16
|
+
protected servers: Map<string, {
|
|
17
|
+
instance: ApolloServerBase;
|
|
18
|
+
schema: GraphQLSchema | undefined;
|
|
19
|
+
}>;
|
|
20
|
+
private app;
|
|
21
|
+
private httpServer;
|
|
22
|
+
private httpsServer;
|
|
23
|
+
private injector;
|
|
24
|
+
constructor(dataSources: any[]);
|
|
25
|
+
createServer(id: string, settings: ApolloSettings): Promise<ApolloServer>;
|
|
26
|
+
/**
|
|
27
|
+
* Get an instance of ApolloServer from his id
|
|
28
|
+
* @returns ApolloServer
|
|
29
|
+
*/
|
|
30
|
+
get(id?: string): ApolloServerBase | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Get an instance of GraphQL schema from his id
|
|
33
|
+
* @returns GraphQLSchema
|
|
34
|
+
*/
|
|
35
|
+
getSchema(id?: string): GraphQLSchema | undefined;
|
|
36
|
+
/**
|
|
37
|
+
*
|
|
38
|
+
* @param {string} id
|
|
39
|
+
* @returns {boolean}
|
|
40
|
+
*/
|
|
41
|
+
has(id?: string): boolean;
|
|
42
|
+
protected createInstance(options: Config, server?: ApolloCustomServerCB): Promise<ApolloServer | undefined>;
|
|
43
|
+
/**
|
|
44
|
+
* create a new dataSources function to use with apollo server config
|
|
45
|
+
* @param dataSources
|
|
46
|
+
*/
|
|
47
|
+
protected createDataSources(dataSources: Function | undefined): () => any;
|
|
48
|
+
private getPlugins;
|
|
49
|
+
}
|
package/package.json
CHANGED
|
@@ -1,33 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/apollo",
|
|
3
|
-
"version": "7.79.3",
|
|
4
3
|
"description": "Apollo package for Ts.ED framework",
|
|
4
|
+
"type": "commonjs",
|
|
5
|
+
"version": "7.80.0",
|
|
5
6
|
"source": "./src/index.ts",
|
|
6
7
|
"main": "./lib/cjs/index.js",
|
|
7
8
|
"module": "./lib/esm/index.js",
|
|
8
9
|
"typings": "./lib/types/index.d.ts",
|
|
9
10
|
"exports": {
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./lib/types/index.d.ts",
|
|
13
|
+
"import": "./lib/esm/index.js",
|
|
14
|
+
"default": "./lib/cjs/index.js"
|
|
15
|
+
}
|
|
14
16
|
},
|
|
15
17
|
"scripts": {
|
|
16
18
|
"build": "yarn barrels && yarn build:ts",
|
|
17
19
|
"barrels": "barrels",
|
|
18
|
-
"test": "
|
|
19
|
-
"build:ts": "tsc --build tsconfig.json
|
|
20
|
+
"test": "vitest run",
|
|
21
|
+
"build:ts": "tsc --build tsconfig.json",
|
|
22
|
+
"test:ci": "vitest run --coverage.thresholds.autoUpdate=true"
|
|
20
23
|
},
|
|
21
24
|
"dependencies": {
|
|
22
25
|
"tslib": "2.6.1"
|
|
23
26
|
},
|
|
24
27
|
"devDependencies": {
|
|
25
|
-
"@tsed/barrels": "7.
|
|
26
|
-
"@tsed/common": "7.
|
|
27
|
-
"@tsed/core": "7.
|
|
28
|
-
"@tsed/di": "7.
|
|
28
|
+
"@tsed/barrels": "7.80.0",
|
|
29
|
+
"@tsed/common": "7.80.0",
|
|
30
|
+
"@tsed/core": "7.80.0",
|
|
31
|
+
"@tsed/di": "7.80.0",
|
|
29
32
|
"@tsed/logger": ">=6.7.5",
|
|
30
|
-
"@tsed/typescript": "7.
|
|
33
|
+
"@tsed/typescript": "7.80.0",
|
|
31
34
|
"@types/graphql": "14.5.0",
|
|
32
35
|
"apollo-datasource": "^3.3.2",
|
|
33
36
|
"apollo-datasource-rest": "^3.7.0",
|
|
@@ -37,12 +40,13 @@
|
|
|
37
40
|
"apollo-server-testing": "^2.26.2",
|
|
38
41
|
"eslint": "^8.57.0",
|
|
39
42
|
"graphql": "15.8.0",
|
|
40
|
-
"
|
|
43
|
+
"typescript": "4.9.5",
|
|
44
|
+
"vitest": "2.0.4"
|
|
41
45
|
},
|
|
42
46
|
"peerDependencies": {
|
|
43
|
-
"@tsed/common": "7.
|
|
44
|
-
"@tsed/core": "7.
|
|
45
|
-
"@tsed/di": "7.
|
|
47
|
+
"@tsed/common": "7.80.0",
|
|
48
|
+
"@tsed/core": "7.80.0",
|
|
49
|
+
"@tsed/di": "7.80.0",
|
|
46
50
|
"@tsed/logger": ">=6.7.5",
|
|
47
51
|
"apollo-datasource": ">=3.0.0",
|
|
48
52
|
"apollo-datasource-rest": ">=3.0.0",
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import {presets} from "@tsed/vitest/presets";
|
|
3
|
+
import {defineConfig} from "vitest/config";
|
|
4
|
+
|
|
5
|
+
export default defineConfig(
|
|
6
|
+
{
|
|
7
|
+
...presets,
|
|
8
|
+
test: {
|
|
9
|
+
...presets.test,
|
|
10
|
+
coverage: {
|
|
11
|
+
...presets.test.coverage,
|
|
12
|
+
thresholds: {
|
|
13
|
+
statements: 0,
|
|
14
|
+
branches: 0,
|
|
15
|
+
functions: 0,
|
|
16
|
+
lines: 0
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
);
|
package/jest.config.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// For a detailed explanation regarding each configuration property, visit:
|
|
2
|
-
// https://jestjs.io/docs/en/configuration.html
|
|
3
|
-
|
|
4
|
-
module.exports = {
|
|
5
|
-
...require("@tsed/jest-config"),
|
|
6
|
-
coverageThreshold: {
|
|
7
|
-
global: {
|
|
8
|
-
statements: 94.79,
|
|
9
|
-
branches: 79.31,
|
|
10
|
-
functions: 100,
|
|
11
|
-
lines: 94.79
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
};
|
package/lib/cjs/package.json
DELETED
package/lib/esm/package.json
DELETED
package/tsconfig.esm.json
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "@tsed/typescript/tsconfig.node.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"baseUrl": ".",
|
|
5
|
-
"module": "ES2020",
|
|
6
|
-
"rootDir": "src",
|
|
7
|
-
"outDir": "./lib/esm",
|
|
8
|
-
"declaration": true,
|
|
9
|
-
"declarationDir": "./lib/types",
|
|
10
|
-
"composite": true,
|
|
11
|
-
"noEmit": false
|
|
12
|
-
},
|
|
13
|
-
"include": ["src", "src/**/*.json"],
|
|
14
|
-
"exclude": [
|
|
15
|
-
"node_modules",
|
|
16
|
-
"test",
|
|
17
|
-
"lib",
|
|
18
|
-
"benchmark",
|
|
19
|
-
"coverage",
|
|
20
|
-
"spec",
|
|
21
|
-
"**/*.benchmark.ts",
|
|
22
|
-
"**/*.spec.ts",
|
|
23
|
-
"keys",
|
|
24
|
-
"jest.config.js",
|
|
25
|
-
"**/__mock__/**",
|
|
26
|
-
"webpack.config.js"
|
|
27
|
-
],
|
|
28
|
-
"references": [
|
|
29
|
-
{
|
|
30
|
-
"path": "../../platform/common"
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
"path": "../../core"
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
"path": "../../di"
|
|
37
|
-
}
|
|
38
|
-
]
|
|
39
|
-
}
|