@tsed/graphql-ws 8.11.1 → 8.12.0-rc.1
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/esm/GraphQLWSModule.js +0 -1
- package/lib/esm/GraphQLWSOptions.js +0 -1
- package/lib/esm/index.js +0 -1
- package/package.json +10 -7
- package/lib/esm/GraphQLWSModule.js.map +0 -1
- package/lib/esm/GraphQLWSOptions.js.map +0 -1
- package/lib/esm/index.js.map +0 -1
- package/src/GraphQLWSModule.ts +0 -51
- package/src/GraphQLWSOptions.ts +0 -18
- package/src/index.ts +0 -5
package/lib/esm/index.js
CHANGED
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@tsed/graphql-ws",
|
|
3
3
|
"description": "An extension to allow GraphQL over WebSockets using graphql-ws protocol",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "8.
|
|
5
|
+
"version": "8.12.0-rc.1",
|
|
6
6
|
"source": "./src/index.ts",
|
|
7
7
|
"main": "./lib/esm/index.js",
|
|
8
8
|
"module": "./lib/esm/index.js",
|
|
@@ -24,12 +24,12 @@
|
|
|
24
24
|
"tslib": "2.7.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@tsed/barrels": "8.
|
|
28
|
-
"@tsed/core": "8.
|
|
29
|
-
"@tsed/di": "8.
|
|
27
|
+
"@tsed/barrels": "8.12.0-rc.1",
|
|
28
|
+
"@tsed/core": "8.12.0-rc.1",
|
|
29
|
+
"@tsed/di": "8.12.0-rc.1",
|
|
30
30
|
"@tsed/logger": "^7.0.1",
|
|
31
|
-
"@tsed/platform-http": "8.
|
|
32
|
-
"@tsed/typescript": "8.
|
|
31
|
+
"@tsed/platform-http": "8.12.0-rc.1",
|
|
32
|
+
"@tsed/typescript": "8.12.0-rc.1",
|
|
33
33
|
"@types/ws": "8.18.1",
|
|
34
34
|
"eslint": "9.12.0",
|
|
35
35
|
"graphql-ws": "6.0.4",
|
|
@@ -50,5 +50,8 @@
|
|
|
50
50
|
},
|
|
51
51
|
"homepage": "https://github.com/tsedio/tsed/tree/production/packages/graphql/graphql-ws",
|
|
52
52
|
"author": "Romain Lenzotti",
|
|
53
|
-
"license": "MIT"
|
|
53
|
+
"license": "MIT",
|
|
54
|
+
"publishConfig": {
|
|
55
|
+
"tag": "rc"
|
|
56
|
+
}
|
|
54
57
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GraphQLWSModule.js","sourceRoot":"","sources":["../../src/GraphQLWSModule.ts"],"names":[],"mappings":";AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,KAAK,MAAM,YAAY,CAAC;AAE/B,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAC,MAAM,UAAU,CAAC;AAC1D,OAAO,EAAC,SAAS,EAAC,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAC,eAAe,EAAC,MAAM,IAAI,CAAC;AAK5B,IAAM,eAAe,GAArB,MAAM,eAAe;IAArB;QACG,aAAQ,GAAG,QAAQ,CAAmB,WAAW,EAAE,EAAsB,CAAC,CAAC;QAC3E,eAAU,GAAG,MAAM,CAAqB,IAAI,CAAC,MAAM,CAAC,CAAC;QACrD,gBAAW,GAAG,MAAM,CAAsB,KAAK,CAAC,MAAM,CAAC,CAAC;IAqClE,CAAC;IAnCC,KAAK,CAAC,cAAc,CAAC,QAA0B;QAC7C,MAAM,IAAI,GAAG;YACX,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,eAAe,IAAI,EAAE,CAAC;YACxC,GAAG,QAAQ,CAAC,eAAe;YAC3B,MAAM,EAAE,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,UAAW;YAC5C,IAAI,EAAE,QAAQ,CAAC,IAAI;SACpB,CAAC;QAEF,MAAM,QAAQ,GAAG,IAAI,eAAe,CAAC,IAAI,CAAC,CAAC;QAE3C,OAAO,SAAS,CACd;YACE,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,kBAAkB,IAAI,EAAE,CAAC;YAC3C,GAAG,QAAQ,CAAC,kBAAkB;YAC9B,MAAM,EAAE,QAAQ,CAAC,MAAM;SACxB,EACD,QAAQ,CACT,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,yBAAyB,CAAC,OAAc,EAAE,QAA0B;QACxE,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;QAErD,MAAM,EAAE,CAAC,IAAI,CAAC,gCAAgC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;QAE/D,OAAO,OAAO,CAAC,MAAM,CAAC;YACpB,eAAe;gBACb,OAAO;oBACL,KAAK,CAAC,WAAW;wBACf,MAAM,QAAQ,CAAC,OAAO,EAAE,CAAC;oBAC3B,CAAC;iBACF,CAAC;YACJ,CAAC;SACK,CAAC,CAAC;IACZ,CAAC;CACF,CAAA;AAxCY,eAAe;IAD3B,MAAM,EAAE;GACI,eAAe,CAwC3B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GraphQLWSOptions.js","sourceRoot":"","sources":["../../src/GraphQLWSOptions.ts"],"names":[],"mappings":""}
|
package/lib/esm/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC"}
|
package/src/GraphQLWSModule.ts
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import Http from "node:http";
|
|
2
|
-
import Https from "node:https";
|
|
3
|
-
|
|
4
|
-
import {constant, inject, logger, Module} from "@tsed/di";
|
|
5
|
-
import {useServer} from "graphql-ws/use/ws";
|
|
6
|
-
import {WebSocketServer} from "ws";
|
|
7
|
-
|
|
8
|
-
import {GraphQLWSOptions} from "./GraphQLWSOptions.js";
|
|
9
|
-
|
|
10
|
-
@Module()
|
|
11
|
-
export class GraphQLWSModule {
|
|
12
|
-
private settings = constant<GraphQLWSOptions>("graphqlWs", {} as GraphQLWSOptions);
|
|
13
|
-
private httpServer = inject<Http.Server | null>(Http.Server);
|
|
14
|
-
private httpsServer = inject<Https.Server | null>(Https.Server);
|
|
15
|
-
|
|
16
|
-
async createWSServer(settings: GraphQLWSOptions) {
|
|
17
|
-
const opts = {
|
|
18
|
-
...(this.settings.wsServerOptions || {}),
|
|
19
|
-
...settings.wsServerOptions,
|
|
20
|
-
server: this.httpsServer || this.httpServer!,
|
|
21
|
-
path: settings.path
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const wsServer = new WebSocketServer(opts);
|
|
25
|
-
|
|
26
|
-
return useServer(
|
|
27
|
-
{
|
|
28
|
-
...(this.settings.wsUseServerOptions || {}),
|
|
29
|
-
...settings.wsUseServerOptions,
|
|
30
|
-
schema: settings.schema
|
|
31
|
-
},
|
|
32
|
-
wsServer
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
async $alterApolloServerPlugins(plugins: any[], settings: GraphQLWSOptions) {
|
|
37
|
-
const wsServer = await this.createWSServer(settings);
|
|
38
|
-
|
|
39
|
-
logger().info(`Create GraphQL WS server on: ${settings.path}`);
|
|
40
|
-
|
|
41
|
-
return plugins.concat({
|
|
42
|
-
serverWillStart() {
|
|
43
|
-
return {
|
|
44
|
-
async drainServer() {
|
|
45
|
-
await wsServer.dispose();
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
} as any);
|
|
50
|
-
}
|
|
51
|
-
}
|
package/src/GraphQLWSOptions.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type {ServerOptions as UseServerOptions} from "graphql-ws";
|
|
2
|
-
import type {ServerOptions as WSServerOptions} from "ws";
|
|
3
|
-
|
|
4
|
-
export interface GraphQLWSOptions {
|
|
5
|
-
path: string;
|
|
6
|
-
schema: UseServerOptions["schema"];
|
|
7
|
-
wsUseServerOptions?: UseServerOptions;
|
|
8
|
-
wsServerOptions?: WSServerOptions;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
declare global {
|
|
12
|
-
namespace TsED {
|
|
13
|
-
interface ApolloSettings {
|
|
14
|
-
wsUseServerOptions?: UseServerOptions;
|
|
15
|
-
wsServerOptions?: WSServerOptions;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|