@tsed/graphql-ws 8.0.0-alpha.4 → 8.0.0-alpha.6
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/package.json +12 -13
- package/readme.md +2 -2
- package/lib/cjs/GraphQLWSModule.js +0 -59
- package/lib/cjs/GraphQLWSModule.js.map +0 -1
- package/lib/cjs/GraphQLWSOptions.js +0 -3
- package/lib/cjs/GraphQLWSOptions.js.map +0 -1
- package/lib/cjs/index.js +0 -9
- package/lib/cjs/index.js.map +0 -1
- package/lib/cjs/package.json +0 -3
- package/lib/esm/package.json +0 -3
- package/lib/types-esm/GraphQLWSModule.d.ts +0 -10
- package/lib/types-esm/GraphQLWSOptions.d.ts +0 -16
- package/lib/types-esm/index.d.ts +0 -5
package/package.json
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/graphql-ws",
|
|
3
|
-
"version": "8.0.0-alpha.4",
|
|
4
3
|
"description": "An extension to allow GraphQL over WebSockets using graphql-ws protocol",
|
|
5
|
-
"type": "
|
|
4
|
+
"type": "module",
|
|
5
|
+
"version": "8.0.0-alpha.6",
|
|
6
6
|
"source": "./src/index.ts",
|
|
7
|
-
"main": "./lib/
|
|
7
|
+
"main": "./lib/esm/index.js",
|
|
8
8
|
"module": "./lib/esm/index.js",
|
|
9
9
|
"typings": "./lib/types/index.d.ts",
|
|
10
10
|
"exports": {
|
|
11
11
|
".": {
|
|
12
12
|
"types": "./lib/types/index.d.ts",
|
|
13
13
|
"import": "./lib/esm/index.js",
|
|
14
|
-
"require": "./lib/cjs/index.js",
|
|
15
14
|
"default": "./lib/cjs/index.js"
|
|
16
15
|
}
|
|
17
16
|
},
|
|
@@ -24,20 +23,20 @@
|
|
|
24
23
|
"tslib": "2.6.1"
|
|
25
24
|
},
|
|
26
25
|
"devDependencies": {
|
|
27
|
-
"@tsed/barrels": "8.0.0-alpha.
|
|
28
|
-
"@tsed/common": "8.0.0-alpha.
|
|
29
|
-
"@tsed/core": "8.0.0-alpha.
|
|
30
|
-
"@tsed/di": "8.0.0-alpha.
|
|
26
|
+
"@tsed/barrels": "8.0.0-alpha.6",
|
|
27
|
+
"@tsed/common": "8.0.0-alpha.6",
|
|
28
|
+
"@tsed/core": "8.0.0-alpha.6",
|
|
29
|
+
"@tsed/di": "8.0.0-alpha.6",
|
|
31
30
|
"@tsed/logger": ">=6.7.5",
|
|
32
|
-
"@tsed/typescript": "8.0.0-alpha.
|
|
31
|
+
"@tsed/typescript": "8.0.0-alpha.6",
|
|
33
32
|
"eslint": "^8.57.0",
|
|
34
|
-
"graphql-ws": "
|
|
33
|
+
"graphql-ws": "5.16.0",
|
|
35
34
|
"typescript": "4.9.5"
|
|
36
35
|
},
|
|
37
36
|
"peerDependencies": {
|
|
38
|
-
"@tsed/common": "8.0.0-alpha.
|
|
39
|
-
"@tsed/core": "8.0.0-alpha.
|
|
40
|
-
"@tsed/di": "8.0.0-alpha.
|
|
37
|
+
"@tsed/common": "8.0.0-alpha.6",
|
|
38
|
+
"@tsed/core": "8.0.0-alpha.6",
|
|
39
|
+
"@tsed/di": "8.0.0-alpha.6",
|
|
41
40
|
"@tsed/logger": ">=6.7.5",
|
|
42
41
|
"graphql-ws": ">=5.14.2"
|
|
43
42
|
},
|
package/readme.md
CHANGED
|
@@ -60,12 +60,12 @@ export class Server {}
|
|
|
60
60
|
|
|
61
61
|
## ApolloService
|
|
62
62
|
|
|
63
|
-
ApolloService let you
|
|
63
|
+
ApolloService let you retrieve an instance of ApolloServer.
|
|
64
64
|
|
|
65
65
|
```typescript
|
|
66
66
|
import {Injectable, AfterRoutesInit} from "@tsed/common";
|
|
67
67
|
import {graphQLService} from "@tsed/apollo";
|
|
68
|
-
import {ApolloServer} from "apollo
|
|
68
|
+
import {ApolloServer} from "@apollo/server";
|
|
69
69
|
|
|
70
70
|
@Injectable()
|
|
71
71
|
export class UsersService implements AfterRoutesInit {
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GraphQLWSModule = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const di_1 = require("@tsed/di");
|
|
6
|
-
const ws_1 = require("graphql-ws/lib/use/ws");
|
|
7
|
-
const http_1 = tslib_1.__importDefault(require("http"));
|
|
8
|
-
const https_1 = tslib_1.__importDefault(require("https"));
|
|
9
|
-
let GraphQLWSModule = class GraphQLWSModule {
|
|
10
|
-
async createWSServer(settings) {
|
|
11
|
-
// @ts-ignore
|
|
12
|
-
const { WebSocketServer } = await import("ws");
|
|
13
|
-
const wsServer = new WebSocketServer({
|
|
14
|
-
...(this.settings.wsServerOptions || {}),
|
|
15
|
-
...settings.wsServerOptions,
|
|
16
|
-
server: this.httpsServer || this.httpServer,
|
|
17
|
-
path: settings.path
|
|
18
|
-
});
|
|
19
|
-
return (0, ws_1.useServer)({
|
|
20
|
-
...(this.settings.wsUseServerOptions || {}),
|
|
21
|
-
...settings.wsUseServerOptions,
|
|
22
|
-
schema: settings.schema
|
|
23
|
-
}, wsServer);
|
|
24
|
-
}
|
|
25
|
-
async $alterApolloServerPlugins(plugins, settings) {
|
|
26
|
-
const wsServer = await this.createWSServer(settings);
|
|
27
|
-
this.injector.logger.info(`Create GraphQL WS server on: ${settings.path}`);
|
|
28
|
-
return plugins.concat({
|
|
29
|
-
serverWillStart() {
|
|
30
|
-
return {
|
|
31
|
-
async drainServer() {
|
|
32
|
-
await wsServer.dispose();
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
tslib_1.__decorate([
|
|
40
|
-
(0, di_1.Constant)("graphqlWs", {}),
|
|
41
|
-
tslib_1.__metadata("design:type", Object)
|
|
42
|
-
], GraphQLWSModule.prototype, "settings", void 0);
|
|
43
|
-
tslib_1.__decorate([
|
|
44
|
-
(0, di_1.Inject)(http_1.default.Server),
|
|
45
|
-
tslib_1.__metadata("design:type", Object)
|
|
46
|
-
], GraphQLWSModule.prototype, "httpServer", void 0);
|
|
47
|
-
tslib_1.__decorate([
|
|
48
|
-
(0, di_1.Inject)(https_1.default.Server),
|
|
49
|
-
tslib_1.__metadata("design:type", Object)
|
|
50
|
-
], GraphQLWSModule.prototype, "httpsServer", void 0);
|
|
51
|
-
tslib_1.__decorate([
|
|
52
|
-
(0, di_1.Inject)(),
|
|
53
|
-
tslib_1.__metadata("design:type", di_1.InjectorService)
|
|
54
|
-
], GraphQLWSModule.prototype, "injector", void 0);
|
|
55
|
-
GraphQLWSModule = tslib_1.__decorate([
|
|
56
|
-
(0, di_1.Module)()
|
|
57
|
-
], GraphQLWSModule);
|
|
58
|
-
exports.GraphQLWSModule = GraphQLWSModule;
|
|
59
|
-
//# sourceMappingURL=GraphQLWSModule.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GraphQLWSModule.js","sourceRoot":"","sources":["../../src/GraphQLWSModule.ts"],"names":[],"mappings":";;;;AAAA,iCAAmE;AAEnE,8CAAgD;AAChD,wDAAwB;AACxB,0DAA0B;AAKnB,IAAM,eAAe,GAArB,MAAM,eAAe;IAa1B,KAAK,CAAC,cAAc,CAAC,QAA0B;QAC7C,aAAa;QACb,MAAM,EAAC,eAAe,EAAC,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC;QAE7C,MAAM,QAAQ,GAAG,IAAI,eAAe,CAAC;YACnC,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,CAAC;QAEH,OAAO,IAAA,cAAS,EACd;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,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,gCAAgC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;QAE3E,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;AAhDC;IAAC,IAAA,aAAQ,EAAC,WAAW,EAAE,EAAE,CAAC;;iDACS;AAEnC;IAAC,IAAA,WAAM,EAAC,cAAI,CAAC,MAAM,CAAC;;mDACmB;AAEvC;IAAC,IAAA,WAAM,EAAC,eAAK,CAAC,MAAM,CAAC;;oDACoB;AAEzC;IAAC,IAAA,WAAM,GAAE;sCACS,oBAAe;iDAAC;AAXvB,eAAe;IAD3B,IAAA,WAAM,GAAE;GACI,eAAe,CAiD3B;AAjDY,0CAAe"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GraphQLWSOptions.js","sourceRoot":"","sources":["../../src/GraphQLWSOptions.ts"],"names":[],"mappings":""}
|
package/lib/cjs/index.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
/**
|
|
5
|
-
* @file Automatically generated by @tsed/barrels.
|
|
6
|
-
*/
|
|
7
|
-
tslib_1.__exportStar(require("./GraphQLWSModule.js"), exports);
|
|
8
|
-
tslib_1.__exportStar(require("./GraphQLWSOptions.js"), exports);
|
|
9
|
-
//# sourceMappingURL=index.js.map
|
package/lib/cjs/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,+DAAqC;AACrC,gEAAsC"}
|
package/lib/cjs/package.json
DELETED
package/lib/esm/package.json
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Disposable } from "graphql-ws";
|
|
2
|
-
import { GraphQLWSOptions } from "./GraphQLWSOptions.js";
|
|
3
|
-
export declare class GraphQLWSModule {
|
|
4
|
-
private settings;
|
|
5
|
-
private httpServer;
|
|
6
|
-
private httpsServer;
|
|
7
|
-
private injector;
|
|
8
|
-
createWSServer(settings: GraphQLWSOptions): Promise<Disposable>;
|
|
9
|
-
$alterApolloServerPlugins(plugins: any[], settings: GraphQLWSOptions): Promise<any[]>;
|
|
10
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { ServerOptions } from "graphql-ws/lib/server";
|
|
2
|
-
import { ServerOptions as WSServerOptions } from "ws";
|
|
3
|
-
export interface GraphQLWSOptions {
|
|
4
|
-
path: string;
|
|
5
|
-
schema: any;
|
|
6
|
-
wsUseServerOptions?: ServerOptions;
|
|
7
|
-
wsServerOptions?: WSServerOptions;
|
|
8
|
-
}
|
|
9
|
-
declare global {
|
|
10
|
-
namespace TsED {
|
|
11
|
-
interface ApolloSettings {
|
|
12
|
-
wsUseServerOptions?: ServerOptions;
|
|
13
|
-
wsServerOptions?: WSServerOptions;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|