@common-stack/server-stack 8.2.5-alpha.7 → 8.3.1-alpha.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/MainStackServer.cjs +17 -10
- package/lib/MainStackServer.cjs.map +1 -1
- package/lib/MainStackServer.mjs +17 -10
- package/lib/MainStackServer.mjs.map +1 -1
- package/lib/StackServer.cjs +1 -1
- package/lib/StackServer.cjs.map +1 -1
- package/lib/StackServer.mjs +1 -1
- package/lib/StackServer.mjs.map +1 -1
- package/lib/config/env-config.cjs +6 -0
- package/lib/config/env-config.cjs.map +1 -1
- package/lib/config/env-config.mjs +6 -0
- package/lib/config/env-config.mjs.map +1 -1
- package/lib/connectors/mongo-connector.cjs +1 -1
- package/lib/connectors/mongo-connector.cjs.map +1 -1
- package/lib/connectors/mongo-connector.mjs +2 -2
- package/lib/connectors/mongo-connector.mjs.map +1 -1
- package/lib/infrastructure/container-module.cjs +2 -1
- package/lib/infrastructure/container-module.cjs.map +1 -1
- package/lib/infrastructure/container-module.mjs +2 -1
- package/lib/infrastructure/container-module.mjs.map +1 -1
- package/lib/infrastructure/inngest-factory.cjs +6 -2
- package/lib/infrastructure/inngest-factory.cjs.map +1 -1
- package/lib/infrastructure/inngest-factory.mjs +6 -2
- package/lib/infrastructure/inngest-factory.mjs.map +1 -1
- package/lib/servers/ExpressApp.cjs +3 -3
- package/lib/servers/ExpressApp.cjs.map +1 -1
- package/lib/servers/ExpressApp.mjs +1 -1
- package/lib/servers/ExpressApp.mjs.map +1 -1
- package/lib/servers/WebsocketMultipathUpdate.cjs +51 -9
- package/lib/servers/WebsocketMultipathUpdate.cjs.map +1 -1
- package/lib/servers/WebsocketMultipathUpdate.mjs +51 -9
- package/lib/servers/WebsocketMultipathUpdate.mjs.map +1 -1
- package/package.json +8 -8
- package/lib/MainStackServer.d.ts +0 -34
- package/lib/StackServer.d.ts +0 -29
- package/lib/api/remote-config.d.ts +0 -6
- package/lib/api/resolver.d.ts +0 -10
- package/lib/api/scalar.d.ts +0 -2
- package/lib/api/schema-builder.d.ts +0 -24
- package/lib/api/sub-graph-schema-builder.d.ts +0 -24
- package/lib/api/utils.d.ts +0 -4
- package/lib/config/env-config.d.ts +0 -28
- package/lib/config/index.d.ts +0 -1
- package/lib/config/moleculer.config.d.ts +0 -20
- package/lib/connectors/connection-broker.d.ts +0 -26
- package/lib/connectors/graphql-pubsub-connector.d.ts +0 -22
- package/lib/connectors/mongo-connector.d.ts +0 -21
- package/lib/connectors/nats-connector.d.ts +0 -20
- package/lib/connectors/redis-connector.d.ts +0 -30
- package/lib/examples/tenant-feature-example.d.ts +0 -13
- package/lib/examples/tenant-feature-integration.d.ts +0 -14
- package/lib/features/multi-module-example.d.ts +0 -17
- package/lib/index.d.ts +0 -4
- package/lib/infrastructure/container-module.d.ts +0 -3
- package/lib/infrastructure/example-workflows.d.ts +0 -16
- package/lib/infrastructure/index.d.ts +0 -5
- package/lib/infrastructure/infrastructure-factory.d.ts +0 -45
- package/lib/infrastructure/inngest-factory.d.ts +0 -8
- package/lib/infrastructure/types.d.ts +0 -28
- package/lib/infrastructure/usage-examples.d.ts +0 -9
- package/lib/infrastructure/workflow-orchestrator.d.ts +0 -10
- package/lib/inngest/client-id-generator.d.ts +0 -29
- package/lib/inngest/handler-factory.d.ts +0 -24
- package/lib/inngest/middleware/auto-resolve-invoke.middleware.d.ts +0 -111
- package/lib/inngest/middleware/function-reference-helper.d.ts +0 -211
- package/lib/inngest/middleware/index.d.ts +0 -31
- package/lib/inngest/middleware/types.d.ts +0 -162
- package/lib/inngest/multi-module-functions.d.ts +0 -133
- package/lib/inngest/setup.d.ts +0 -10
- package/lib/interfaces/dbMigration.d.ts +0 -8
- package/lib/interfaces/graphql-request-context.d.ts +0 -20
- package/lib/interfaces/index.d.ts +0 -4
- package/lib/interfaces/module-interface.d.ts +0 -13
- package/lib/interfaces/moleculer.d.ts +0 -7
- package/lib/middleware/cors.d.ts +0 -6
- package/lib/middleware/error.d.ts +0 -9
- package/lib/middleware/index.d.ts +0 -5
- package/lib/middleware/moleculer-inter-namespace.d.ts +0 -2
- package/lib/middleware/redis-client.d.ts +0 -16
- package/lib/middleware/sentry.d.ts +0 -2
- package/lib/middleware/services.d.ts +0 -2
- package/lib/plugins/index.d.ts +0 -2
- package/lib/plugins/invalidateCachePlugin.d.ts +0 -8
- package/lib/plugins/responseCachePlugin.d.ts +0 -12
- package/lib/servers/ExpressApp.d.ts +0 -3
- package/lib/servers/GraphqlServer.d.ts +0 -25
- package/lib/servers/GraphqlWs.d.ts +0 -14
- package/lib/servers/WebsocketMultipathUpdate.d.ts +0 -18
- package/lib/servers/mongodb-migration-update.d.ts +0 -12
- package/lib/servers/utils.d.ts +0 -14
- package/lib/servers/websocket-context.d.ts +0 -30
- package/lib/utils/add-shareable-directive-to-schema.d.ts +0 -1
- package/lib/utils/index.d.ts +0 -3
- package/lib/utils/migrations.d.ts +0 -8
- package/lib/utils/safe-model-factory.d.ts +0 -18
|
@@ -1,21 +1,28 @@
|
|
|
1
|
-
'use strict';var url=require('url'),ws=require('ws'),ws$1=require('graphql-ws/lib/use/ws'),websocketContext=require('./websocket-context.cjs');function _interopNamespaceDefault(e){var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var url__namespace=/*#__PURE__*/_interopNamespaceDefault(url);class WebsocketMultiPathServer {
|
|
1
|
+
'use strict';var url=require('url'),ws=require('ws'),ws$1=require('graphql-ws/lib/use/ws'),websocketContext=require('./websocket-context.cjs'),envConfig=require('../config/env-config.cjs');function _interopNamespaceDefault(e){var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var url__namespace=/*#__PURE__*/_interopNamespaceDefault(url);class WebsocketMultiPathServer {
|
|
2
2
|
moduleService;
|
|
3
3
|
cache;
|
|
4
4
|
webSockets = {};
|
|
5
5
|
// private graphqlSubscriptionServer: GraphqlSubscriptionServer;
|
|
6
6
|
_graphqlWs;
|
|
7
|
-
|
|
7
|
+
/** Maximum WebSocket connections allowed per instance */
|
|
8
|
+
maxConnections;
|
|
9
|
+
/** Whether connection limiting is enabled */
|
|
10
|
+
limitEnabled;
|
|
11
|
+
constructor(moduleService, cache, multiplePathConfig, limitConfig) {
|
|
8
12
|
this.moduleService = moduleService;
|
|
9
13
|
this.cache = cache;
|
|
14
|
+
// Read from validated config (Kubernetes configmap) or use defaults
|
|
15
|
+
this.maxConnections = limitConfig?.maxConnections ?? envConfig.config.WEBSOCKET_MAX_CONNECTIONS;
|
|
16
|
+
this.limitEnabled = limitConfig?.limitEnabled ?? envConfig.config.WEBSOCKET_LIMIT_ENABLED;
|
|
10
17
|
this._graphqlWs = new ws.WebSocketServer({ noServer: true, path: __GRAPHQL_ENDPOINT__ });
|
|
11
18
|
this.webSockets[__GRAPHQL_ENDPOINT__] = this._graphqlWs;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
});
|
|
19
|
+
// Initialize useServer ONCE for the GraphQL WebSocket server
|
|
20
|
+
// This prevents memory leaks from creating new listeners on each connection
|
|
21
|
+
ws$1.useServer({
|
|
22
|
+
schema: moduleService.schema,
|
|
23
|
+
// Using shared context creation function to maintain consistency with GraphqlWs
|
|
24
|
+
context: async (ctx) => websocketContext.createWebSocketContext(ctx, moduleService, cache),
|
|
25
|
+
}, this._graphqlWs);
|
|
19
26
|
for (let key in multiplePathConfig) {
|
|
20
27
|
if (!multiplePathConfig.hasOwnProperty(key)) {
|
|
21
28
|
continue;
|
|
@@ -34,12 +41,22 @@
|
|
|
34
41
|
httpServerUpgrade(httpServer) {
|
|
35
42
|
httpServer.on('upgrade', (request, socket, head) => {
|
|
36
43
|
const pathname = url__namespace.parse(request.url).pathname;
|
|
44
|
+
// Check connection limit before accepting new connections
|
|
45
|
+
if (this.limitEnabled && this.isConnectionLimitReached()) {
|
|
46
|
+
this.moduleService.logger?.warn?.(`WebSocket connection limit reached (${this.maxConnections}). Rejecting new connection.`);
|
|
47
|
+
socket.write('HTTP/1.1 503 Service Unavailable\r\n');
|
|
48
|
+
socket.write('Retry-After: 60\r\n');
|
|
49
|
+
socket.write('\r\n');
|
|
50
|
+
socket.destroy();
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
37
53
|
if (!this.webSockets[pathname]) {
|
|
38
54
|
// in development
|
|
39
55
|
if (pathname !== '/sockjs-node') {
|
|
40
56
|
// need to destroy
|
|
41
57
|
socket.destroy();
|
|
42
58
|
}
|
|
59
|
+
return;
|
|
43
60
|
}
|
|
44
61
|
// code to run when a new connection is made
|
|
45
62
|
this.webSockets[pathname].handleUpgrade(request, socket, head, (ws) => {
|
|
@@ -52,6 +69,31 @@
|
|
|
52
69
|
// }, this.graphqlWs);
|
|
53
70
|
return httpServer;
|
|
54
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* Get total number of active WebSocket connections across all paths
|
|
74
|
+
*/
|
|
75
|
+
getTotalConnections() {
|
|
76
|
+
return Object.values(this.webSockets).reduce((total, wsServer) => total + wsServer.clients.size, 0);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Get connection statistics for monitoring
|
|
80
|
+
*/
|
|
81
|
+
getConnectionStats() {
|
|
82
|
+
const total = this.getTotalConnections();
|
|
83
|
+
return {
|
|
84
|
+
total,
|
|
85
|
+
graphql: this._graphqlWs.clients.size,
|
|
86
|
+
maxConnections: this.maxConnections,
|
|
87
|
+
limitEnabled: this.limitEnabled,
|
|
88
|
+
utilizationPercent: Math.round((total / this.maxConnections) * 100),
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Check if connection limit has been reached
|
|
93
|
+
*/
|
|
94
|
+
isConnectionLimitReached() {
|
|
95
|
+
return this.getTotalConnections() >= this.maxConnections;
|
|
96
|
+
}
|
|
55
97
|
get graphqlWs() {
|
|
56
98
|
return this._graphqlWs;
|
|
57
99
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebsocketMultipathUpdate.cjs","sources":["../../src/servers/WebsocketMultipathUpdate.ts"],"sourcesContent":[null],"names":["WebSocketServer","useServer","createWebSocketContext","url"],"mappings":"
|
|
1
|
+
{"version":3,"file":"WebsocketMultipathUpdate.cjs","sources":["../../src/servers/WebsocketMultipathUpdate.ts"],"sourcesContent":[null],"names":["config","WebSocketServer","useServer","createWebSocketContext","url"],"mappings":"+hBAwBa,wBAAwB,CAAA;AAWtB,IAAA,aAAA,CAAA;AACA,IAAA,KAAA,CAAA;IAXH,UAAU,GAAoB,EAAE,CAAC;;AAEjC,IAAA,UAAU,CAAkB;;AAGnB,IAAA,cAAc,CAAS;;AAEvB,IAAA,YAAY,CAAU;AAEvC,IAAA,WAAA,CACW,aAA6B,EAC7B,KAAsC,EAC7C,kBAAyC,EACzC,WAAkC,EAAA;QAH3B,IAAa,CAAA,aAAA,GAAb,aAAa,CAAgB;QAC7B,IAAK,CAAA,KAAA,GAAL,KAAK,CAAiC;;QAK7C,IAAI,CAAC,cAAc,GAAG,WAAW,EAAE,cAAc,IAAIA,gBAAM,CAAC,yBAAyB,CAAC;QACtF,IAAI,CAAC,YAAY,GAAG,WAAW,EAAE,YAAY,IAAIA,gBAAM,CAAC,uBAAuB,CAAC;AAChF,QAAA,IAAI,CAAC,UAAU,GAAG,IAAIC,kBAAe,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,oBAAoB,EAAE,CAAC,CAAC;QACtF,IAAI,CAAC,UAAU,CAAC,oBAAoB,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC;;;AAIxD,QAAAC,cAAS,CACL;YACI,MAAM,EAAE,aAAa,CAA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,EAAE,IAAI,CAAC,YAAY;AAC/B,YAAA,kBAAkB,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,cAAc,IAAI,GAAG,CAAC;SACtE,CAAC;KACL;AAED;;AAEG;IACK,wBAAwB,GAAA;QAC5B,OAAO,IAAI,CAAC,mBAAmB,EAAE,IAAI,IAAI,CAAC,cAAc,CAAC;KAC5D;AAED,IAAA,IAAW,SAAS,GAAA;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC;KAC1B;IACM,KAAK,GAAA;AACR,QAAA,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,UAAU,EAAE;YAC/B,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC;SAChC;KACJ;AACJ"}
|
|
@@ -1,21 +1,28 @@
|
|
|
1
|
-
import*as url from'url';import {WebSocketServer}from'ws';import {useServer}from'graphql-ws/lib/use/ws';import {createWebSocketContext}from'./websocket-context.mjs';class WebsocketMultiPathServer {
|
|
1
|
+
import*as url from'url';import {WebSocketServer}from'ws';import {useServer}from'graphql-ws/lib/use/ws';import {createWebSocketContext}from'./websocket-context.mjs';import {config}from'../config/env-config.mjs';class WebsocketMultiPathServer {
|
|
2
2
|
moduleService;
|
|
3
3
|
cache;
|
|
4
4
|
webSockets = {};
|
|
5
5
|
// private graphqlSubscriptionServer: GraphqlSubscriptionServer;
|
|
6
6
|
_graphqlWs;
|
|
7
|
-
|
|
7
|
+
/** Maximum WebSocket connections allowed per instance */
|
|
8
|
+
maxConnections;
|
|
9
|
+
/** Whether connection limiting is enabled */
|
|
10
|
+
limitEnabled;
|
|
11
|
+
constructor(moduleService, cache, multiplePathConfig, limitConfig) {
|
|
8
12
|
this.moduleService = moduleService;
|
|
9
13
|
this.cache = cache;
|
|
14
|
+
// Read from validated config (Kubernetes configmap) or use defaults
|
|
15
|
+
this.maxConnections = limitConfig?.maxConnections ?? config.WEBSOCKET_MAX_CONNECTIONS;
|
|
16
|
+
this.limitEnabled = limitConfig?.limitEnabled ?? config.WEBSOCKET_LIMIT_ENABLED;
|
|
10
17
|
this._graphqlWs = new WebSocketServer({ noServer: true, path: __GRAPHQL_ENDPOINT__ });
|
|
11
18
|
this.webSockets[__GRAPHQL_ENDPOINT__] = this._graphqlWs;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
});
|
|
19
|
+
// Initialize useServer ONCE for the GraphQL WebSocket server
|
|
20
|
+
// This prevents memory leaks from creating new listeners on each connection
|
|
21
|
+
useServer({
|
|
22
|
+
schema: moduleService.schema,
|
|
23
|
+
// Using shared context creation function to maintain consistency with GraphqlWs
|
|
24
|
+
context: async (ctx) => createWebSocketContext(ctx, moduleService, cache),
|
|
25
|
+
}, this._graphqlWs);
|
|
19
26
|
for (let key in multiplePathConfig) {
|
|
20
27
|
if (!multiplePathConfig.hasOwnProperty(key)) {
|
|
21
28
|
continue;
|
|
@@ -34,12 +41,22 @@ import*as url from'url';import {WebSocketServer}from'ws';import {useServer}from'
|
|
|
34
41
|
httpServerUpgrade(httpServer) {
|
|
35
42
|
httpServer.on('upgrade', (request, socket, head) => {
|
|
36
43
|
const pathname = url.parse(request.url).pathname;
|
|
44
|
+
// Check connection limit before accepting new connections
|
|
45
|
+
if (this.limitEnabled && this.isConnectionLimitReached()) {
|
|
46
|
+
this.moduleService.logger?.warn?.(`WebSocket connection limit reached (${this.maxConnections}). Rejecting new connection.`);
|
|
47
|
+
socket.write('HTTP/1.1 503 Service Unavailable\r\n');
|
|
48
|
+
socket.write('Retry-After: 60\r\n');
|
|
49
|
+
socket.write('\r\n');
|
|
50
|
+
socket.destroy();
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
37
53
|
if (!this.webSockets[pathname]) {
|
|
38
54
|
// in development
|
|
39
55
|
if (pathname !== '/sockjs-node') {
|
|
40
56
|
// need to destroy
|
|
41
57
|
socket.destroy();
|
|
42
58
|
}
|
|
59
|
+
return;
|
|
43
60
|
}
|
|
44
61
|
// code to run when a new connection is made
|
|
45
62
|
this.webSockets[pathname].handleUpgrade(request, socket, head, (ws) => {
|
|
@@ -52,6 +69,31 @@ import*as url from'url';import {WebSocketServer}from'ws';import {useServer}from'
|
|
|
52
69
|
// }, this.graphqlWs);
|
|
53
70
|
return httpServer;
|
|
54
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* Get total number of active WebSocket connections across all paths
|
|
74
|
+
*/
|
|
75
|
+
getTotalConnections() {
|
|
76
|
+
return Object.values(this.webSockets).reduce((total, wsServer) => total + wsServer.clients.size, 0);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Get connection statistics for monitoring
|
|
80
|
+
*/
|
|
81
|
+
getConnectionStats() {
|
|
82
|
+
const total = this.getTotalConnections();
|
|
83
|
+
return {
|
|
84
|
+
total,
|
|
85
|
+
graphql: this._graphqlWs.clients.size,
|
|
86
|
+
maxConnections: this.maxConnections,
|
|
87
|
+
limitEnabled: this.limitEnabled,
|
|
88
|
+
utilizationPercent: Math.round((total / this.maxConnections) * 100),
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Check if connection limit has been reached
|
|
93
|
+
*/
|
|
94
|
+
isConnectionLimitReached() {
|
|
95
|
+
return this.getTotalConnections() >= this.maxConnections;
|
|
96
|
+
}
|
|
55
97
|
get graphqlWs() {
|
|
56
98
|
return this._graphqlWs;
|
|
57
99
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebsocketMultipathUpdate.mjs","sources":["../../src/servers/WebsocketMultipathUpdate.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"WebsocketMultipathUpdate.mjs","sources":["../../src/servers/WebsocketMultipathUpdate.ts"],"sourcesContent":[null],"names":[],"mappings":"wNAwBa,wBAAwB,CAAA;AAWtB,IAAA,aAAA,CAAA;AACA,IAAA,KAAA,CAAA;IAX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
{
|
|
2
2
|
"name": "@common-stack/server-stack",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.3.1-alpha.0",
|
|
4
4
|
"description": "common core for higher packages to depend on",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "CDMBase LLC",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"@cdm-logger/client": "^9.0.17",
|
|
33
33
|
"@cdm-logger/server": "^9.0.17",
|
|
34
34
|
"@cdmbase/graphql-type-uri": "^4.0.0",
|
|
35
|
-
"@common-stack/codegen-zod": "8.2.
|
|
36
|
-
"@common-stack/graphql-api": "8.2.5-alpha.
|
|
35
|
+
"@common-stack/codegen-zod": "8.2.5-alpha.15",
|
|
36
|
+
"@common-stack/graphql-api": "8.2.5-alpha.36",
|
|
37
37
|
"@graphql-tools/links": "~9.0.1",
|
|
38
38
|
"@graphql-tools/schema": "~10.0.6",
|
|
39
39
|
"@graphql-tools/stitch": "~9.2.10",
|
|
@@ -78,12 +78,12 @@
|
|
|
78
78
|
"subscriptions-transport-ws": "^0.11.0",
|
|
79
79
|
"universal-cookie-express": "^4.0.1",
|
|
80
80
|
"ws": "^8.11.0",
|
|
81
|
-
"xstate": "^5.
|
|
81
|
+
"xstate": "^5.20.0",
|
|
82
82
|
"zod": "^4.0.0"
|
|
83
83
|
},
|
|
84
84
|
"devDependencies": {
|
|
85
|
-
"@common-stack/server-core": "8.
|
|
86
|
-
"common": "8.2.
|
|
85
|
+
"@common-stack/server-core": "8.3.1-alpha.0",
|
|
86
|
+
"common": "8.2.5-alpha.35"
|
|
87
87
|
},
|
|
88
88
|
"peerDependencies": {
|
|
89
89
|
"@cdm-logger/core": ">=7.0.12",
|
|
@@ -93,8 +93,8 @@
|
|
|
93
93
|
"publishConfig": {
|
|
94
94
|
"access": "public"
|
|
95
95
|
},
|
|
96
|
-
"gitHead": "93612661cfed3ecf056700afcfa67ee2af2adbe8",
|
|
97
96
|
"typescript": {
|
|
98
97
|
"definition": "lib/index.d.ts"
|
|
99
|
-
}
|
|
98
|
+
},
|
|
99
|
+
"gitHead": "896a0a80a57b2ec62925bdda9ed35e61cd5c1e9f"
|
|
100
100
|
}
|
package/lib/MainStackServer.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import 'reflect-metadata';
|
|
2
|
-
import * as http from 'http';
|
|
3
|
-
import * as express from 'express';
|
|
4
|
-
import { Feature as ServerFeature } from '@common-stack/server-core';
|
|
5
|
-
/**
|
|
6
|
-
* Controls the lifecycle of the Application Server
|
|
7
|
-
*
|
|
8
|
-
* @export
|
|
9
|
-
* @class StackServer
|
|
10
|
-
*/
|
|
11
|
-
export declare class MainStackServer {
|
|
12
|
-
httpServer: http.Server & {
|
|
13
|
-
startListening?: (port: any) => void;
|
|
14
|
-
};
|
|
15
|
-
app: express.Express;
|
|
16
|
-
private logger;
|
|
17
|
-
private infrastructureFactory;
|
|
18
|
-
private mainServiceContext;
|
|
19
|
-
private microserviceContext;
|
|
20
|
-
private multiPathWebsocket;
|
|
21
|
-
private serverFeature;
|
|
22
|
-
private settings;
|
|
23
|
-
private options;
|
|
24
|
-
private serviceBroker;
|
|
25
|
-
private allModules;
|
|
26
|
-
constructor(feature: ServerFeature, settings: any, options?: Record<string, unknown>);
|
|
27
|
-
initialize(): Promise<void>;
|
|
28
|
-
private setupMainServiceBrokerLifecycle;
|
|
29
|
-
private setupMicroserviceBrokerLifecycle;
|
|
30
|
-
private setupGraphQLSchema;
|
|
31
|
-
private setupHttpServer;
|
|
32
|
-
start(): Promise<void>;
|
|
33
|
-
cleanup(): Promise<void>;
|
|
34
|
-
}
|
package/lib/StackServer.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Feature as ServerFeature } from '@common-stack/server-core';
|
|
2
|
-
import { Container } from 'inversify';
|
|
3
|
-
import { ServiceBroker } from 'moleculer';
|
|
4
|
-
import { InfrastructureContext } from './infrastructure';
|
|
5
|
-
/**
|
|
6
|
-
* Controls the lifecycle of the Microservice Server
|
|
7
|
-
*
|
|
8
|
-
* @export
|
|
9
|
-
* @class StackServer
|
|
10
|
-
*/
|
|
11
|
-
export declare class StackServer {
|
|
12
|
-
private logger;
|
|
13
|
-
private infrastructureFactory;
|
|
14
|
-
private microserviceContext;
|
|
15
|
-
private serverFeature;
|
|
16
|
-
private settings;
|
|
17
|
-
private onContainerCreated?;
|
|
18
|
-
constructor(feature: ServerFeature, settings: any, options?: {
|
|
19
|
-
onContainerCreated?: (params: {
|
|
20
|
-
container: Container;
|
|
21
|
-
broker: ServiceBroker;
|
|
22
|
-
context: InfrastructureContext;
|
|
23
|
-
}) => void | Promise<void>;
|
|
24
|
-
});
|
|
25
|
-
initialize(): Promise<void>;
|
|
26
|
-
private setupMicroserviceBrokerLifecycle;
|
|
27
|
-
start(): Promise<void>;
|
|
28
|
-
cleanup(): Promise<void>;
|
|
29
|
-
}
|
package/lib/api/resolver.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare const resolvers: {
|
|
2
|
-
AnyObject: import("graphql").GraphQLScalarType<unknown, unknown>;
|
|
3
|
-
Date: import("graphql").GraphQLScalarType<Date, string>;
|
|
4
|
-
Time: import("graphql").GraphQLScalarType<Date, string>;
|
|
5
|
-
URI: any;
|
|
6
|
-
URIInput: any;
|
|
7
|
-
DateTime: import("graphql").GraphQLScalarType<Date, Date>;
|
|
8
|
-
JSON: import("graphql").GraphQLScalarType<unknown, unknown>;
|
|
9
|
-
JSONObject: import("graphql").GraphQLScalarType<unknown, unknown>;
|
|
10
|
-
};
|
package/lib/api/scalar.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { GraphQLSchema } from 'graphql';
|
|
2
|
-
import { IGraphqlShieldRules } from '@common-stack/server-core';
|
|
3
|
-
import { CdmLogger } from '@cdm-logger/core';
|
|
4
|
-
interface IGraphqlOptions {
|
|
5
|
-
schema: string | string[];
|
|
6
|
-
resolvers: any;
|
|
7
|
-
directives: any[];
|
|
8
|
-
directiveResolvers: {
|
|
9
|
-
[key: string]: any;
|
|
10
|
-
};
|
|
11
|
-
middlewares: any[];
|
|
12
|
-
rules?: IGraphqlShieldRules;
|
|
13
|
-
logger: CdmLogger.ILogger;
|
|
14
|
-
}
|
|
15
|
-
export declare class GatewaySchemaBuilder {
|
|
16
|
-
private options;
|
|
17
|
-
constructor(options: IGraphqlOptions);
|
|
18
|
-
build(): Promise<GraphQLSchema>;
|
|
19
|
-
private load;
|
|
20
|
-
private createRemoteSchema;
|
|
21
|
-
private loadRemoteSchema;
|
|
22
|
-
private createOwnSchema;
|
|
23
|
-
}
|
|
24
|
-
export {};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { GraphQLSchema } from 'graphql';
|
|
2
|
-
import { IGraphqlShieldRules } from '@common-stack/server-core';
|
|
3
|
-
import { CdmLogger } from '@cdm-logger/core';
|
|
4
|
-
interface IGraphqlOptions {
|
|
5
|
-
schema: string | string[];
|
|
6
|
-
resolvers: any;
|
|
7
|
-
directives: any[];
|
|
8
|
-
directiveResolvers: {
|
|
9
|
-
[key: string]: any;
|
|
10
|
-
};
|
|
11
|
-
middlewares: any[];
|
|
12
|
-
rules?: IGraphqlShieldRules;
|
|
13
|
-
logger: CdmLogger.ILogger;
|
|
14
|
-
}
|
|
15
|
-
export declare class SubGraphSchemaBuilder {
|
|
16
|
-
private readonly options;
|
|
17
|
-
constructor(options: IGraphqlOptions);
|
|
18
|
-
build(): Promise<GraphQLSchema>;
|
|
19
|
-
private load;
|
|
20
|
-
private createRemoteSchema;
|
|
21
|
-
private loadRemoteSchema;
|
|
22
|
-
private createOwnSchema;
|
|
23
|
-
}
|
|
24
|
-
export {};
|
package/lib/api/utils.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import * as envalid from 'envalid';
|
|
2
|
-
export declare const config: Readonly<{
|
|
3
|
-
NODE_ENV: string;
|
|
4
|
-
NATS_URL: string;
|
|
5
|
-
NATS_USER: string;
|
|
6
|
-
NATS_PW: string;
|
|
7
|
-
GRAPHQL_ENDPOINT: string;
|
|
8
|
-
BACKEND_URL: string;
|
|
9
|
-
GRAPHQL_URL: string;
|
|
10
|
-
CLIENT_URL: string;
|
|
11
|
-
MONGO_URL: string;
|
|
12
|
-
APP_NAME: string;
|
|
13
|
-
REDIS_CLUSTER_URL: string;
|
|
14
|
-
REDIS_URL: string;
|
|
15
|
-
REDIS_CLUSTER_ENABLED: boolean;
|
|
16
|
-
REDIS_SENTINEL_ENABLED: boolean;
|
|
17
|
-
CONNECTION_ID: string;
|
|
18
|
-
NAMESPACE: string;
|
|
19
|
-
CROSS_NAMESPACES: string;
|
|
20
|
-
LOG_LEVEL: string;
|
|
21
|
-
METRICS_CONFIG: string;
|
|
22
|
-
INNGEST_EVENT_KEY: string;
|
|
23
|
-
INNGEST_SIGNING_KEY: string;
|
|
24
|
-
INNGEST_IS_DEV: boolean;
|
|
25
|
-
INNGEST_ENVIRONMENT: string;
|
|
26
|
-
INNGEST_BASE_URL: string;
|
|
27
|
-
INNGEST_CLIENT_ID: string;
|
|
28
|
-
} & envalid.CleanedEnvAccessors>;
|
package/lib/config/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './env-config';
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { BrokerOptions } from 'moleculer';
|
|
2
|
-
/**
|
|
3
|
-
* Moleculer ServiceBroker configuration file
|
|
4
|
-
*
|
|
5
|
-
* More info about options:
|
|
6
|
-
* https://moleculer.services/docs/0.14/configuration.html
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* Overwrite options in production:
|
|
10
|
-
* ================================
|
|
11
|
-
* You can overwrite any option with environment variables.
|
|
12
|
-
* For example to overwrite the 'logLevel', use `LOGLEVEL=warn` env var.
|
|
13
|
-
* To overwrite a nested parameter, e.g. retryPolicy.retries, use `RETRYPOLICY_RETRIES=10` env var.
|
|
14
|
-
*
|
|
15
|
-
* To overwrite broker’s deeply nested default options, which are not presented in 'moleculer.config.ts',
|
|
16
|
-
* via environment variables, use the `MOL_` prefix and double underscore `__` for nested properties in .env file.
|
|
17
|
-
* For example, to set the cacher prefix to `MYCACHE`, you should declare an env var as `MOL_CACHER__OPTIONS__PREFIX=MYCACHE`.
|
|
18
|
-
*/
|
|
19
|
-
declare const brokerConfig: BrokerOptions;
|
|
20
|
-
export default brokerConfig;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { CdmLogger } from '@cdm-logger/core';
|
|
2
|
-
import { TransporterType } from '../interfaces/moleculer';
|
|
3
|
-
type ILogger = CdmLogger.ILogger;
|
|
4
|
-
/**
|
|
5
|
-
* Connection broker class
|
|
6
|
-
*
|
|
7
|
-
* @class ConnectionBroker
|
|
8
|
-
*/
|
|
9
|
-
export declare class ConnectionBroker {
|
|
10
|
-
private _mongoConnector;
|
|
11
|
-
private _redisConnector;
|
|
12
|
-
private _natsConnector;
|
|
13
|
-
private _graphqlPubsubConnector;
|
|
14
|
-
/**
|
|
15
|
-
* Creates an instance of ConnectionBroker.
|
|
16
|
-
* @param {*} options
|
|
17
|
-
* @memberof ConnectionBroker
|
|
18
|
-
*/
|
|
19
|
-
constructor(transporter: TransporterType, logger: ILogger);
|
|
20
|
-
get mongoConnection(): Promise<import("mongoose").Connection>;
|
|
21
|
-
get redisConnection(): Promise<import("ioredis").default | import("ioredis").Cluster>;
|
|
22
|
-
get natsConnection(): import("nats").Client | Promise<import("nats").Client>;
|
|
23
|
-
get graphqlPubsub(): Promise<import("graphql-nats-subscriptions").NatsPubSub | import("graphql-subscriptions").PubSub>;
|
|
24
|
-
stop(): Promise<void>;
|
|
25
|
-
}
|
|
26
|
-
export {};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { PubSub } from 'graphql-subscriptions';
|
|
2
|
-
import { NatsPubSub } from 'graphql-nats-subscriptions';
|
|
3
|
-
import { GenericObject } from 'moleculer';
|
|
4
|
-
import { CdmLogger } from '@cdm-logger/core';
|
|
5
|
-
type ILogger = CdmLogger.ILogger;
|
|
6
|
-
type PubSubOptions = {
|
|
7
|
-
apolloLogging?: boolean;
|
|
8
|
-
logger: ILogger;
|
|
9
|
-
} & GenericObject;
|
|
10
|
-
export declare class GraphqlPubSubConnector {
|
|
11
|
-
private client;
|
|
12
|
-
private opts;
|
|
13
|
-
private logger;
|
|
14
|
-
/**
|
|
15
|
-
* Creates an instance of GraphqlPubSubConnector.
|
|
16
|
-
* @param {*} opts
|
|
17
|
-
* @memberof GraphqlPubSubConnector
|
|
18
|
-
*/
|
|
19
|
-
constructor(opts?: PubSubOptions);
|
|
20
|
-
getClient(): Promise<NatsPubSub | PubSub>;
|
|
21
|
-
}
|
|
22
|
-
export {};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Connection, ConnectOptions } from 'mongoose';
|
|
2
|
-
export declare class MongoConnector {
|
|
3
|
-
private client;
|
|
4
|
-
private db;
|
|
5
|
-
private opts;
|
|
6
|
-
private uri;
|
|
7
|
-
private logger;
|
|
8
|
-
constructor(uri: string, opts?: ConnectOptions);
|
|
9
|
-
/**
|
|
10
|
-
* Connect to database
|
|
11
|
-
*
|
|
12
|
-
* @memberof MongoConnector
|
|
13
|
-
*/
|
|
14
|
-
connect(): Promise<Connection>;
|
|
15
|
-
/**
|
|
16
|
-
* Disconnect from database
|
|
17
|
-
*
|
|
18
|
-
* @memberof MongoConnector
|
|
19
|
-
*/
|
|
20
|
-
disconnect(): Promise<void>;
|
|
21
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import * as nats from 'nats';
|
|
2
|
-
export declare class NatsConnector {
|
|
3
|
-
private opts;
|
|
4
|
-
private client;
|
|
5
|
-
private logger;
|
|
6
|
-
private connected;
|
|
7
|
-
constructor(opts: nats.ClientOpts);
|
|
8
|
-
/**
|
|
9
|
-
* Connect to a NATS server
|
|
10
|
-
*
|
|
11
|
-
* @memberof NatsConnector
|
|
12
|
-
*/
|
|
13
|
-
connect(): nats.Client | Promise<nats.Client>;
|
|
14
|
-
/**
|
|
15
|
-
* Disconnect from a NATS server
|
|
16
|
-
*
|
|
17
|
-
* @memberof NatsTransporter
|
|
18
|
-
*/
|
|
19
|
-
disconnect(): void;
|
|
20
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import * as IORedis from 'ioredis';
|
|
2
|
-
export declare class RedisConnector {
|
|
3
|
-
private client;
|
|
4
|
-
private opts;
|
|
5
|
-
private logger;
|
|
6
|
-
/**
|
|
7
|
-
* Creates an instance of RedisConnector.
|
|
8
|
-
*
|
|
9
|
-
* @param {object} opts
|
|
10
|
-
*/
|
|
11
|
-
constructor(opts?: IORedis.ClusterOptions | IORedis.RedisOptions);
|
|
12
|
-
/**
|
|
13
|
-
* Connect to the Redis server
|
|
14
|
-
*
|
|
15
|
-
* @memberof RedisConnector
|
|
16
|
-
*/
|
|
17
|
-
connect(): Promise<IORedis.Cluster | IORedis.Redis>;
|
|
18
|
-
/**
|
|
19
|
-
* Return redis or redis.cluster Client
|
|
20
|
-
*
|
|
21
|
-
* @memberof RedisConnection
|
|
22
|
-
*/
|
|
23
|
-
getRedisClient(): IORedis.Cluster | IORedis.Redis;
|
|
24
|
-
/**
|
|
25
|
-
* Close Redis client connection.
|
|
26
|
-
*
|
|
27
|
-
* @memberof RedisConnection
|
|
28
|
-
*/
|
|
29
|
-
disconnect(): Promise<void>;
|
|
30
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Container } from 'inversify';
|
|
2
|
-
/**
|
|
3
|
-
* Example Inngest functions factory for tenant management
|
|
4
|
-
* This is how individual modules can register their Inngest functions
|
|
5
|
-
*/
|
|
6
|
-
export declare const tenantInngestFunctions: (container: Container) => {};
|
|
7
|
-
/**
|
|
8
|
-
* Example Feature configuration for a tenant module
|
|
9
|
-
*/
|
|
10
|
-
export declare const TenantFeature: {
|
|
11
|
-
inngestFunctions: (container: Container) => {};
|
|
12
|
-
registerExpressMiddlewareFunc: (app: any, container: any) => void;
|
|
13
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Feature } from '@common-stack/server-core';
|
|
2
|
-
/**
|
|
3
|
-
* Example of how to create a Feature that includes Inngest functions
|
|
4
|
-
*/
|
|
5
|
-
export declare const TenantFeature: Feature<any, any>;
|
|
6
|
-
/**
|
|
7
|
-
* Example of how other modules can also contribute Inngest functions
|
|
8
|
-
*/
|
|
9
|
-
export declare const NotificationFeature: Feature<any, any>;
|
|
10
|
-
export declare const AnalyticsFeature: Feature<any, any>;
|
|
11
|
-
/**
|
|
12
|
-
* Example of combining multiple features with Inngest functions
|
|
13
|
-
*/
|
|
14
|
-
export declare const createApplicationFeature: () => Feature<any, any>;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Feature } from '@common-stack/server-core';
|
|
2
|
-
/**
|
|
3
|
-
* Example Feature that demonstrates using an array of Inngest function factories
|
|
4
|
-
*/
|
|
5
|
-
export declare const MultiModuleFeature: Feature<any, any>;
|
|
6
|
-
/**
|
|
7
|
-
* Example: Feature for just user management
|
|
8
|
-
*/
|
|
9
|
-
export declare const UserManagementFeature: Feature<any, any>;
|
|
10
|
-
/**
|
|
11
|
-
* Example: Feature for email campaigns
|
|
12
|
-
*/
|
|
13
|
-
export declare const EmailCampaignFeature: Feature<any, any>;
|
|
14
|
-
/**
|
|
15
|
-
* Example: Combining multiple features - each with their own Inngest functions
|
|
16
|
-
*/
|
|
17
|
-
export declare const ApplicationFeature: Feature<any, any>;
|
package/lib/index.d.ts
DELETED