@inversifyjs/apollo-subscription-ws 0.2.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/CHANGELOG.md +13 -0
- package/README.md +3 -0
- package/lib/esm/apollo/models/ApolloSubscriptionServerContainerModuleOptions.d.ts +4 -0
- package/lib/esm/apollo/models/ApolloSubscriptionServerContainerModuleOptions.d.ts.map +1 -0
- package/lib/esm/apollo/models/ApolloSubscriptionServerContainerModuleOptions.js +2 -0
- package/lib/esm/apollo/models/ApolloSubscriptionServerContainerModuleOptions.js.map +1 -0
- package/lib/esm/apollo/models/wsServerServiceIdentifier.d.ts +4 -0
- package/lib/esm/apollo/models/wsServerServiceIdentifier.d.ts.map +1 -0
- package/lib/esm/apollo/models/wsServerServiceIdentifier.js +2 -0
- package/lib/esm/apollo/models/wsServerServiceIdentifier.js.map +1 -0
- package/lib/esm/apollo/modules/ApolloSubscriptionServerContainerModule.d.ts +6 -0
- package/lib/esm/apollo/modules/ApolloSubscriptionServerContainerModule.d.ts.map +1 -0
- package/lib/esm/apollo/modules/ApolloSubscriptionServerContainerModule.int.spec.d.ts +2 -0
- package/lib/esm/apollo/modules/ApolloSubscriptionServerContainerModule.int.spec.d.ts.map +1 -0
- package/lib/esm/apollo/modules/ApolloSubscriptionServerContainerModule.js +37 -0
- package/lib/esm/apollo/modules/ApolloSubscriptionServerContainerModule.js.map +1 -0
- package/lib/esm/apollo/modules/ApolloSubscriptionServerContainerModule.spec.d.ts +2 -0
- package/lib/esm/apollo/modules/ApolloSubscriptionServerContainerModule.spec.d.ts.map +1 -0
- package/lib/esm/index.d.ts +4 -0
- package/lib/esm/index.d.ts.map +1 -0
- package/lib/esm/index.js +3 -0
- package/lib/esm/index.js.map +1 -0
- package/package.json +73 -0
- package/tsconfig.esm.json +10 -0
package/CHANGELOG.md
ADDED
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApolloSubscriptionServerContainerModuleOptions.d.ts","sourceRoot":"","sources":["../../../../src/apollo/models/ApolloSubscriptionServerContainerModuleOptions.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,8CAA8C;IAC7D,IAAI,CAAC,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApolloSubscriptionServerContainerModuleOptions.js","sourceRoot":"","sources":["../../../../src/apollo/models/ApolloSubscriptionServerContainerModuleOptions.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wsServerServiceIdentifier.d.ts","sourceRoot":"","sources":["../../../../src/apollo/models/wsServerServiceIdentifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,IAAI,CAAC;AAE1C,eAAO,MAAM,yBAAyB,EAAE,iBAAiB,CAAC,eAAe,CACb,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wsServerServiceIdentifier.js","sourceRoot":"","sources":["../../../../src/apollo/models/wsServerServiceIdentifier.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,yBAAyB,GACpC,MAAM,CAAC,GAAG,CAAC,8CAA8C,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ContainerModule } from 'inversify';
|
|
2
|
+
import { type ApolloSubscriptionServerContainerModuleOptions } from '../models/ApolloSubscriptionServerContainerModuleOptions';
|
|
3
|
+
export declare class ApolloSubscriptionServerContainerModule extends ContainerModule {
|
|
4
|
+
constructor(options?: ApolloSubscriptionServerContainerModuleOptions);
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=ApolloSubscriptionServerContainerModule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApolloSubscriptionServerContainerModule.d.ts","sourceRoot":"","sources":["../../../../src/apollo/modules/ApolloSubscriptionServerContainerModule.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,eAAe,EAAmC,MAAM,WAAW,CAAC;AAG7E,OAAO,EAAE,KAAK,8CAA8C,EAAE,MAAM,0DAA0D,CAAC;AAG/H,qBAAa,uCAAwC,SAAQ,eAAe;gBAC9D,OAAO,CAAC,EAAE,8CAA8C;CA4CrE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApolloSubscriptionServerContainerModule.int.spec.d.ts","sourceRoot":"","sources":["../../../../src/apollo/modules/ApolloSubscriptionServerContainerModule.int.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { apolloServerGraphqlServiceIdentifier, apolloServerPluginsServiceIdentifier, httpServerServiceIdentifier, } from '@inversifyjs/apollo-core';
|
|
2
|
+
import { useServer } from 'graphql-ws/use/ws';
|
|
3
|
+
import { ContainerModule } from 'inversify';
|
|
4
|
+
import { WebSocketServer } from 'ws';
|
|
5
|
+
import { wsServerServiceIdentifier } from '../models/wsServerServiceIdentifier';
|
|
6
|
+
export class ApolloSubscriptionServerContainerModule extends ContainerModule {
|
|
7
|
+
constructor(options) {
|
|
8
|
+
super((loadOptions) => {
|
|
9
|
+
loadOptions
|
|
10
|
+
.bind(wsServerServiceIdentifier)
|
|
11
|
+
.toResolvedValue((httpServer) => new WebSocketServer({
|
|
12
|
+
path: options?.path ?? '/subscriptions',
|
|
13
|
+
server: httpServer,
|
|
14
|
+
}), [httpServerServiceIdentifier])
|
|
15
|
+
.inSingletonScope();
|
|
16
|
+
loadOptions
|
|
17
|
+
.bind(apolloServerPluginsServiceIdentifier)
|
|
18
|
+
.toResolvedValue((graphqlSchema, wsServer) => {
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/typedef
|
|
20
|
+
const serverCleanup = useServer({ schema: graphqlSchema }, wsServer);
|
|
21
|
+
return [
|
|
22
|
+
{
|
|
23
|
+
async serverWillStart() {
|
|
24
|
+
return {
|
|
25
|
+
async drainServer() {
|
|
26
|
+
await serverCleanup.dispose();
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
];
|
|
32
|
+
}, [apolloServerGraphqlServiceIdentifier, wsServerServiceIdentifier])
|
|
33
|
+
.inSingletonScope();
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=ApolloSubscriptionServerContainerModule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApolloSubscriptionServerContainerModule.js","sourceRoot":"","sources":["../../../../src/apollo/modules/ApolloSubscriptionServerContainerModule.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,oCAAoC,EACpC,oCAAoC,EACpC,2BAA2B,GAC5B,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAmC,MAAM,WAAW,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,IAAI,CAAC;AAGrC,OAAO,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AAEhF,MAAM,OAAO,uCAAwC,SAAQ,eAAe;IAC1E,YAAY,OAAwD;QAClE,KAAK,CAAC,CAAC,WAAuC,EAAQ,EAAE;YACtD,WAAW;iBACR,IAAI,CAAC,yBAAyB,CAAC;iBAC/B,eAAe,CACd,CAAC,UAAuB,EAAmB,EAAE,CAC3C,IAAI,eAAe,CAAC;gBAClB,IAAI,EAAE,OAAO,EAAE,IAAI,IAAI,gBAAgB;gBACvC,MAAM,EAAE,UAAU;aACnB,CAAC,EACJ,CAAC,2BAA2B,CAAC,CAC9B;iBACA,gBAAgB,EAAE,CAAC;YAEtB,WAAW;iBACR,IAAI,CAAC,oCAAoC,CAAC;iBAC1C,eAAe,CACd,CACE,aAA4B,EAC5B,QAAyB,EACH,EAAE;gBACxB,sDAAsD;gBACtD,MAAM,aAAa,GAAG,SAAS,CAC7B,EAAE,MAAM,EAAE,aAAa,EAAE,EACzB,QAAQ,CACT,CAAC;gBAEF,OAAO;oBACL;wBACE,KAAK,CAAC,eAAe;4BACnB,OAAO;gCACL,KAAK,CAAC,WAAW;oCACf,MAAM,aAAa,CAAC,OAAO,EAAE,CAAC;gCAChC,CAAC;6BACF,CAAC;wBACJ,CAAC;qBACF;iBACF,CAAC;YACJ,CAAC,EACD,CAAC,oCAAoC,EAAE,yBAAyB,CAAC,CAClE;iBACA,gBAAgB,EAAE,CAAC;QACxB,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApolloSubscriptionServerContainerModule.spec.d.ts","sourceRoot":"","sources":["../../../../src/apollo/modules/ApolloSubscriptionServerContainerModule.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { type ApolloSubscriptionServerContainerModuleOptions } from './apollo/models/ApolloSubscriptionServerContainerModuleOptions.js';
|
|
2
|
+
export { ApolloSubscriptionServerContainerModule } from './apollo/modules/ApolloSubscriptionServerContainerModule.js';
|
|
3
|
+
export { wsServerServiceIdentifier } from './apollo/models/wsServerServiceIdentifier.js';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,8CAA8C,EAAE,MAAM,mEAAmE,CAAC;AACxI,OAAO,EAAE,uCAAuC,EAAE,MAAM,6DAA6D,CAAC;AACtH,OAAO,EAAE,yBAAyB,EAAE,MAAM,8CAA8C,CAAC"}
|
package/lib/esm/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uCAAuC,EAAE,MAAM,6DAA6D,CAAC;AACtH,OAAO,EAAE,yBAAyB,EAAE,MAAM,8CAA8C,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
{
|
|
2
|
+
"author": "Roberto Pintos López",
|
|
3
|
+
"bugs": {
|
|
4
|
+
"url": "https://github.com/inversify/graphql/issues"
|
|
5
|
+
},
|
|
6
|
+
"description": "InversifyJs GraphQL Apollo subscriptions via ws package",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"graphql-ws": "6.0.6",
|
|
9
|
+
"@inversifyjs/apollo-core": "0.3.0"
|
|
10
|
+
},
|
|
11
|
+
"devDependencies": {
|
|
12
|
+
"@as-integrations/express5": "1.1.2",
|
|
13
|
+
"@graphql-tools/utils": "10.11.0",
|
|
14
|
+
"@inversifyjs/http-express": "4.9.1",
|
|
15
|
+
"@types/express": "5.0.6",
|
|
16
|
+
"@types/node": "24.10.4",
|
|
17
|
+
"@types/ws": "8.18.1",
|
|
18
|
+
"@vitest/coverage-v8": "4.0.16",
|
|
19
|
+
"eslint": "9.39.2",
|
|
20
|
+
"graphql": "16.12.0",
|
|
21
|
+
"prettier": "3.7.4",
|
|
22
|
+
"rimraf": "6.1.2",
|
|
23
|
+
"tslib": "2.8.1",
|
|
24
|
+
"typescript": "5.9.3",
|
|
25
|
+
"vitest": "4.0.16",
|
|
26
|
+
"@inversifyjs/apollo-express": "0.5.0"
|
|
27
|
+
},
|
|
28
|
+
"homepage": "https://inversify.io/framework/",
|
|
29
|
+
"keywords": [
|
|
30
|
+
"apollo",
|
|
31
|
+
"inversify",
|
|
32
|
+
"graphql",
|
|
33
|
+
"http",
|
|
34
|
+
"node",
|
|
35
|
+
"typescript"
|
|
36
|
+
],
|
|
37
|
+
"devEngines": {
|
|
38
|
+
"node": "^24.10.0",
|
|
39
|
+
"pnpm": "^10.13.1"
|
|
40
|
+
},
|
|
41
|
+
"license": "MIT",
|
|
42
|
+
"module": "lib/esm/index.js",
|
|
43
|
+
"exports": {
|
|
44
|
+
".": "./lib/esm/index.js"
|
|
45
|
+
},
|
|
46
|
+
"name": "@inversifyjs/apollo-subscription-ws",
|
|
47
|
+
"peerDependencies": {
|
|
48
|
+
"@apollo/server": "^5.2.0",
|
|
49
|
+
"inversify": "^7.10.8",
|
|
50
|
+
"ws": "^8.18.3"
|
|
51
|
+
},
|
|
52
|
+
"publishConfig": {
|
|
53
|
+
"access": "public"
|
|
54
|
+
},
|
|
55
|
+
"repository": {
|
|
56
|
+
"type": "git",
|
|
57
|
+
"url": "git+https://github.com/inversify/graphql.git"
|
|
58
|
+
},
|
|
59
|
+
"type": "module",
|
|
60
|
+
"version": "0.2.0",
|
|
61
|
+
"scripts": {
|
|
62
|
+
"build": "tsc",
|
|
63
|
+
"build:clean": "rimraf lib",
|
|
64
|
+
"format": "prettier --write ./src",
|
|
65
|
+
"lint": "eslint ./src",
|
|
66
|
+
"prebuild": "pnpm run build:clean",
|
|
67
|
+
"test": "vitest run",
|
|
68
|
+
"test:integration": "pnpm run test --project Integration",
|
|
69
|
+
"test:coverage": "pnpm run test:unit --coverage",
|
|
70
|
+
"test:uncommitted": "pnpm run test --changed=HEAD",
|
|
71
|
+
"test:unit": "pnpm run test --project Unit"
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json.schemastore.org/tsconfig",
|
|
3
|
+
"extends": "@inversifyjs/foundation-typescript-config/tsconfig.base.esm.json",
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
"outDir": "./lib/esm",
|
|
6
|
+
"rootDir": "./src",
|
|
7
|
+
"tsBuildInfoFile": "tsconfig.tsbuildinfo"
|
|
8
|
+
},
|
|
9
|
+
"include": ["src"]
|
|
10
|
+
}
|