@common-stack/server-stack 8.0.1-alpha.2 → 8.2.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/LICENSE +34 -21
- package/lib/MainStackServer.cjs +126 -143
- package/lib/MainStackServer.cjs.map +1 -1
- package/lib/MainStackServer.d.ts +12 -6
- package/lib/MainStackServer.mjs +126 -143
- package/lib/MainStackServer.mjs.map +1 -1
- package/lib/StackServer.cjs +23 -66
- package/lib/StackServer.cjs.map +1 -1
- package/lib/StackServer.d.ts +4 -5
- package/lib/StackServer.mjs +23 -66
- package/lib/StackServer.mjs.map +1 -1
- package/lib/api/schema-builder.cjs +13 -12
- package/lib/api/schema-builder.cjs.map +1 -1
- package/lib/api/schema-builder.mjs +13 -12
- package/lib/api/schema-builder.mjs.map +1 -1
- package/lib/api/sub-graph-schema-builder.cjs +147 -0
- package/lib/api/sub-graph-schema-builder.cjs.map +1 -0
- package/lib/api/sub-graph-schema-builder.d.ts +24 -0
- package/lib/api/sub-graph-schema-builder.mjs +147 -0
- package/lib/api/sub-graph-schema-builder.mjs.map +1 -0
- package/lib/config/env-config.cjs +6 -0
- package/lib/config/env-config.cjs.map +1 -1
- package/lib/config/env-config.d.ts +6 -0
- package/lib/config/env-config.mjs +6 -0
- package/lib/config/env-config.mjs.map +1 -1
- package/lib/examples/tenant-feature-example.d.ts +13 -0
- package/lib/examples/tenant-feature-integration.d.ts +14 -0
- package/lib/features/multi-module-example.d.ts +17 -0
- package/lib/index.cjs +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.mjs +1 -1
- package/lib/infrastructure/container-module.cjs +27 -0
- package/lib/infrastructure/container-module.cjs.map +1 -0
- package/lib/infrastructure/container-module.d.ts +3 -0
- package/lib/infrastructure/container-module.mjs +27 -0
- package/lib/infrastructure/container-module.mjs.map +1 -0
- package/lib/infrastructure/example-workflows.d.ts +16 -0
- package/lib/infrastructure/index.d.ts +5 -0
- package/lib/infrastructure/infrastructure-factory.cjs +172 -0
- package/lib/infrastructure/infrastructure-factory.cjs.map +1 -0
- package/lib/infrastructure/infrastructure-factory.d.ts +36 -0
- package/lib/infrastructure/infrastructure-factory.mjs +172 -0
- package/lib/infrastructure/infrastructure-factory.mjs.map +1 -0
- package/lib/infrastructure/inngest-factory.cjs +47 -0
- package/lib/infrastructure/inngest-factory.cjs.map +1 -0
- package/lib/infrastructure/inngest-factory.d.ts +8 -0
- package/lib/infrastructure/inngest-factory.mjs +47 -0
- package/lib/infrastructure/inngest-factory.mjs.map +1 -0
- package/lib/infrastructure/types.d.ts +28 -0
- package/lib/infrastructure/usage-examples.d.ts +9 -0
- package/lib/infrastructure/workflow-orchestrator.cjs +59 -0
- package/lib/infrastructure/workflow-orchestrator.cjs.map +1 -0
- package/lib/infrastructure/workflow-orchestrator.d.ts +10 -0
- package/lib/infrastructure/workflow-orchestrator.mjs +59 -0
- package/lib/infrastructure/workflow-orchestrator.mjs.map +1 -0
- package/lib/inngest/client-id-generator.d.ts +29 -0
- package/lib/inngest/handler-factory.d.ts +24 -0
- package/lib/inngest/middleware/auto-resolve-invoke.middleware.cjs +275 -0
- package/lib/inngest/middleware/auto-resolve-invoke.middleware.cjs.map +1 -0
- package/lib/inngest/middleware/auto-resolve-invoke.middleware.d.ts +111 -0
- package/lib/inngest/middleware/auto-resolve-invoke.middleware.mjs +275 -0
- package/lib/inngest/middleware/auto-resolve-invoke.middleware.mjs.map +1 -0
- package/lib/inngest/middleware/function-reference-helper.cjs +363 -0
- package/lib/inngest/middleware/function-reference-helper.cjs.map +1 -0
- package/lib/inngest/middleware/function-reference-helper.d.ts +211 -0
- package/lib/inngest/middleware/function-reference-helper.mjs +363 -0
- package/lib/inngest/middleware/function-reference-helper.mjs.map +1 -0
- package/lib/inngest/middleware/index.d.ts +31 -0
- package/lib/inngest/middleware/types.d.ts +162 -0
- package/lib/inngest/multi-module-functions.d.ts +133 -0
- package/lib/inngest/setup.cjs +55 -0
- package/lib/inngest/setup.cjs.map +1 -0
- package/lib/inngest/setup.d.ts +10 -0
- package/lib/inngest/setup.mjs +55 -0
- package/lib/inngest/setup.mjs.map +1 -0
- package/lib/interfaces/graphql-request-context.d.ts +20 -0
- package/lib/interfaces/index.d.ts +1 -0
- package/lib/middleware/index.d.ts +5 -0
- package/lib/middleware/redis-client.cjs +18 -0
- package/lib/middleware/redis-client.cjs.map +1 -0
- package/lib/middleware/redis-client.d.ts +16 -0
- package/lib/middleware/redis-client.mjs +18 -0
- package/lib/middleware/redis-client.mjs.map +1 -0
- package/lib/plugins/index.d.ts +1 -0
- package/lib/plugins/invalidateCachePlugin.cjs +33 -10
- package/lib/plugins/invalidateCachePlugin.cjs.map +1 -1
- package/lib/plugins/invalidateCachePlugin.mjs +33 -10
- package/lib/plugins/invalidateCachePlugin.mjs.map +1 -1
- package/lib/plugins/responseCachePlugin.cjs +63 -0
- package/lib/plugins/responseCachePlugin.cjs.map +1 -0
- package/lib/plugins/responseCachePlugin.d.ts +12 -0
- package/lib/plugins/responseCachePlugin.mjs +63 -0
- package/lib/plugins/responseCachePlugin.mjs.map +1 -0
- package/lib/servers/ExpressApp.cjs +8 -3
- package/lib/servers/ExpressApp.cjs.map +1 -1
- package/lib/servers/ExpressApp.d.ts +1 -1
- package/lib/servers/ExpressApp.mjs +8 -3
- package/lib/servers/ExpressApp.mjs.map +1 -1
- package/lib/servers/GraphqlServer.cjs +10 -36
- package/lib/servers/GraphqlServer.cjs.map +1 -1
- package/lib/servers/GraphqlServer.d.ts +8 -6
- package/lib/servers/GraphqlServer.mjs +10 -36
- package/lib/servers/GraphqlServer.mjs.map +1 -1
- package/lib/servers/GraphqlWs.cjs +3 -44
- package/lib/servers/GraphqlWs.cjs.map +1 -1
- package/lib/servers/GraphqlWs.mjs +3 -44
- package/lib/servers/GraphqlWs.mjs.map +1 -1
- package/lib/servers/WebsocketMultipathUpdate.cjs +4 -2
- package/lib/servers/WebsocketMultipathUpdate.cjs.map +1 -1
- package/lib/servers/WebsocketMultipathUpdate.mjs +4 -2
- package/lib/servers/WebsocketMultipathUpdate.mjs.map +1 -1
- package/lib/servers/mongodb-migration-update.d.ts +1 -1
- package/lib/servers/websocket-context.cjs +70 -0
- package/lib/servers/websocket-context.cjs.map +1 -0
- package/lib/servers/websocket-context.d.ts +30 -0
- package/lib/servers/websocket-context.mjs +70 -0
- package/lib/servers/websocket-context.mjs.map +1 -0
- package/lib/utils/add-shareable-directive-to-schema.cjs +44 -0
- package/lib/utils/add-shareable-directive-to-schema.cjs.map +1 -0
- package/lib/utils/add-shareable-directive-to-schema.d.ts +1 -0
- package/lib/utils/add-shareable-directive-to-schema.mjs +44 -0
- package/lib/utils/add-shareable-directive-to-schema.mjs.map +1 -0
- package/lib/utils/index.d.ts +3 -0
- package/lib/utils/safe-model-factory.d.ts +18 -0
- package/package.json +15 -11
- package/lib/api/resolver.cjs +0 -12
- package/lib/api/resolver.cjs.map +0 -1
- package/lib/api/resolver.mjs +0 -12
- package/lib/api/resolver.mjs.map +0 -1
- package/lib/api/root-schema.graphqls.cjs +0 -2
- package/lib/api/root-schema.graphqls.cjs.map +0 -1
- package/lib/api/root-schema.graphqls.mjs +0 -2
- package/lib/api/root-schema.graphqls.mjs.map +0 -1
- package/lib/api/scalar.cjs +0 -16
- package/lib/api/scalar.cjs.map +0 -1
- package/lib/api/scalar.mjs +0 -16
- package/lib/api/scalar.mjs.map +0 -1
- package/lib/graphql/directives/index.cjs +0 -10
- package/lib/graphql/directives/index.cjs.map +0 -1
- package/lib/graphql/directives/index.d.ts +0 -7
- package/lib/graphql/directives/index.mjs +0 -10
- package/lib/graphql/directives/index.mjs.map +0 -1
- package/lib/graphql/index.d.ts +0 -2
- package/lib/graphql/schema/directives.graphql.cjs +0 -1
- package/lib/graphql/schema/directives.graphql.cjs.map +0 -1
- package/lib/graphql/schema/directives.graphql.mjs +0 -1
- package/lib/graphql/schema/directives.graphql.mjs.map +0 -1
- package/lib/graphql/schema/index.cjs +0 -1
- package/lib/graphql/schema/index.cjs.map +0 -1
- package/lib/graphql/schema/index.d.ts +0 -1
- package/lib/graphql/schema/index.mjs +0 -1
- package/lib/graphql/schema/index.mjs.map +0 -1
package/LICENSE
CHANGED
|
@@ -1,21 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2017 CDMBase LLC.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
IMPLIED,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
PROPRIETARY LICENSE
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2017-2025 CDMBase LLC. All Rights Reserved.
|
|
4
|
+
|
|
5
|
+
This software and associated documentation files (the "Software") are the
|
|
6
|
+
proprietary and confidential information of CDMBase LLC ("Confidential Information").
|
|
7
|
+
|
|
8
|
+
NOTICE: All information contained herein is, and remains the property of
|
|
9
|
+
CDMBase LLC. The intellectual and technical concepts contained herein are
|
|
10
|
+
proprietary to CDMBase LLC and may be covered by U.S. and Foreign Patents,
|
|
11
|
+
patents in process, and are protected by trade secret or copyright law.
|
|
12
|
+
|
|
13
|
+
Dissemination of this information or reproduction of this material is strictly
|
|
14
|
+
forbidden unless prior written permission is obtained from CDMBase LLC.
|
|
15
|
+
|
|
16
|
+
NO LICENSE, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, TO ANY INTELLECTUAL
|
|
17
|
+
PROPERTY RIGHTS ARE GRANTED BY THIS DOCUMENT.
|
|
18
|
+
|
|
19
|
+
RESTRICTIONS:
|
|
20
|
+
1. You may NOT use, copy, modify, merge, publish, distribute, sublicense,
|
|
21
|
+
and/or sell copies of the Software without explicit written permission
|
|
22
|
+
from CDMBase LLC.
|
|
23
|
+
2. You may NOT reverse engineer, decompile, or disassemble the Software.
|
|
24
|
+
3. You may NOT remove or alter any proprietary notices or labels on the Software.
|
|
25
|
+
4. The Software is licensed, not sold.
|
|
26
|
+
|
|
27
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
28
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
29
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
30
|
+
CDMBASE LLC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
|
31
|
+
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
32
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
33
|
+
|
|
34
|
+
For licensing inquiries, please contact: legal@cdmbase.com
|
package/lib/MainStackServer.cjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
'use strict';var http=require('http'),server=require('@cdm-logger/server'),serverCore=require('@common-stack/server-core'),
|
|
1
|
+
'use strict';require('reflect-metadata');var http=require('http'),server=require('@cdm-logger/server'),serverCore=require('@common-stack/server-core'),_=require('lodash-es'),graphqlModule=require('@common-stack/graphql-api/lib/module.js'),ExpressApp=require('./servers/ExpressApp.cjs'),GraphqlServer=require('./servers/GraphqlServer.cjs'),envConfig=require('./config/env-config.cjs'),schemaBuilder=require('./api/schema-builder.cjs'),WebsocketMultipathUpdate=require('./servers/WebsocketMultipathUpdate.cjs'),migrations=require('./utils/migrations.cjs');require('graphql');var subGraphSchemaBuilder=require('./api/sub-graph-schema-builder.cjs'),setup=require('./inngest/setup.cjs');require('inversify'),require('@common-stack/core');var infrastructureFactory=require('./infrastructure/infrastructure-factory.cjs');require('inngest');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 http__namespace=/*#__PURE__*/_interopNamespaceDefault(http);/* eslint-disable import/namespace */
|
|
2
2
|
/* eslint-disable import/no-unresolved */
|
|
3
3
|
/* eslint-disable import/no-extraneous-dependencies */
|
|
4
4
|
// version 08/25/2021
|
|
5
|
+
const graphqlApiFeature = graphqlModule.default ?? graphqlModule;
|
|
5
6
|
function startListening(port) {
|
|
6
7
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
7
8
|
const server = this;
|
|
@@ -9,17 +10,6 @@ function startListening(port) {
|
|
|
9
10
|
server.listen(port, resolve);
|
|
10
11
|
});
|
|
11
12
|
}
|
|
12
|
-
const infraModule = ({ broker, pubsub, mongoClient, logger }) => new inversify.ContainerModule((bind) => {
|
|
13
|
-
bind('Logger').toConstantValue(logger);
|
|
14
|
-
bind(core.CommonType.LOGGER).toConstantValue(logger);
|
|
15
|
-
bind('Environment').toConstantValue(envConfig.config.NODE_ENV || 'development');
|
|
16
|
-
bind(core.CommonType.ENVIRONMENT).toConstantValue(envConfig.config.NODE_ENV || 'development');
|
|
17
|
-
bind('PubSub').toConstantValue(pubsub);
|
|
18
|
-
bind(core.CommonType.PUBSUB).toConstantValue(pubsub);
|
|
19
|
-
bind(core.CommonType.MOLECULER_BROKER).toConstantValue(broker);
|
|
20
|
-
bind('MoleculerBroker').toConstantValue(broker);
|
|
21
|
-
bind('MongoDBConnection').toConstantValue(mongoClient);
|
|
22
|
-
});
|
|
23
13
|
/**
|
|
24
14
|
* Controls the lifecycle of the Application Server
|
|
25
15
|
*
|
|
@@ -30,111 +20,86 @@ class MainStackServer {
|
|
|
30
20
|
httpServer;
|
|
31
21
|
app;
|
|
32
22
|
logger;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
23
|
+
infrastructureFactory;
|
|
24
|
+
mainServiceContext;
|
|
25
|
+
microserviceContext;
|
|
36
26
|
multiPathWebsocket;
|
|
37
|
-
serviceContainer;
|
|
38
|
-
microserviceContainer;
|
|
39
27
|
serverFeature;
|
|
40
28
|
settings;
|
|
41
|
-
|
|
29
|
+
options;
|
|
30
|
+
serviceBroker;
|
|
31
|
+
allModules;
|
|
32
|
+
constructor(feature, settings, options) {
|
|
42
33
|
this.serverFeature = feature;
|
|
43
34
|
this.settings = settings;
|
|
35
|
+
this.options = options;
|
|
44
36
|
this.logger = server.logger.child({ className: 'StackServer' });
|
|
37
|
+
this.infrastructureFactory = new infrastructureFactory.InfrastructureFactory(this.logger);
|
|
45
38
|
}
|
|
46
39
|
async initialize() {
|
|
47
40
|
this.logger.info('StackServer initializing');
|
|
48
|
-
//
|
|
49
|
-
this.
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
//
|
|
53
|
-
this.
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
moleculerInterNamespace.InterNamespaceMiddleware([
|
|
57
|
-
{
|
|
58
|
-
namespace: 'api-admin',
|
|
59
|
-
transporter: moleculer_config.default.transporter,
|
|
60
|
-
metrics: { enabled: false },
|
|
61
|
-
},
|
|
62
|
-
]),
|
|
63
|
-
],
|
|
64
|
-
started: async () => {
|
|
65
|
-
await this.serverFeature.preStart(this.serviceContainer);
|
|
66
|
-
if (envConfig.config.NODE_ENV === 'development') ;
|
|
67
|
-
try {
|
|
68
|
-
this.logger.info('Starting Migration');
|
|
69
|
-
await migrations.migrate(mongoClient, this.serviceContainer, this.logger);
|
|
70
|
-
this.logger.info('End Migration');
|
|
71
|
-
}
|
|
72
|
-
catch (e) {
|
|
73
|
-
this.logger.error('Error while running migrations', e);
|
|
74
|
-
this.logger.error(e.stack);
|
|
75
|
-
}
|
|
76
|
-
try {
|
|
77
|
-
await this.serverFeature.postStart(this.serviceContainer);
|
|
78
|
-
}
|
|
79
|
-
catch (e) {
|
|
80
|
-
this.logger.error('Error while running Post Start due to [%s]', e.message);
|
|
81
|
-
this.logger.error(e.stack);
|
|
82
|
-
}
|
|
83
|
-
// start DB migration
|
|
84
|
-
if (envConfig.config.NODE_ENV === 'development') ;
|
|
85
|
-
},
|
|
86
|
-
// created,
|
|
87
|
-
async created() {
|
|
88
|
-
return Promise.resolve();
|
|
89
|
-
},
|
|
90
|
-
});
|
|
41
|
+
// Initialize infrastructure factory
|
|
42
|
+
await this.infrastructureFactory.initialize();
|
|
43
|
+
// Create main service broker and container
|
|
44
|
+
this.mainServiceContext = await this.infrastructureFactory.createBrokerAndContainer(infrastructureFactory.InfrastructureFactory.createMainServiceConfig(), this.serverFeature, this.settings);
|
|
45
|
+
// Setup main service broker lifecycle
|
|
46
|
+
this.setupMainServiceBrokerLifecycle();
|
|
47
|
+
// Create microservice broker and container for development environment
|
|
48
|
+
// Reuse same allModules but allow separate container with proper bindings
|
|
91
49
|
if (envConfig.config.NODE_ENV === 'development') {
|
|
92
|
-
this.
|
|
93
|
-
|
|
94
|
-
metrics: { enabled: false },
|
|
95
|
-
nodeID: 'node-broker-2',
|
|
96
|
-
started: async () => {
|
|
97
|
-
await this.serverFeature.microservicePreStart(this.microserviceContainer);
|
|
98
|
-
await this.serverFeature.microservicePostStart(this.microserviceContainer);
|
|
99
|
-
},
|
|
100
|
-
// created,
|
|
101
|
-
created: async () => Promise.resolve(),
|
|
102
|
-
});
|
|
50
|
+
this.microserviceContext = await this.infrastructureFactory.createBrokerAndContainer(infrastructureFactory.InfrastructureFactory.createDevelopmentMicroserviceConfig(), this.serverFeature, this.settings, this.mainServiceContext.allModules);
|
|
51
|
+
this.setupMicroserviceBrokerLifecycle();
|
|
103
52
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
()
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
53
|
+
// Build GraphQL schema and create service context
|
|
54
|
+
await this.setupGraphQLSchema();
|
|
55
|
+
// Initialize HTTP server and Express app
|
|
56
|
+
await this.setupHttpServer();
|
|
57
|
+
}
|
|
58
|
+
setupMainServiceBrokerLifecycle() {
|
|
59
|
+
const originalStart = this.mainServiceContext.broker.start.bind(this.mainServiceContext.broker);
|
|
60
|
+
this.mainServiceContext.broker.start = async () => {
|
|
61
|
+
await originalStart();
|
|
62
|
+
// Execute pre-start hooks
|
|
63
|
+
await this.serverFeature.preStart(this.mainServiceContext.container);
|
|
64
|
+
try {
|
|
65
|
+
this.logger.info('Starting Migration');
|
|
66
|
+
await migrations.migrate(this.mainServiceContext.context.mongoClient, this.mainServiceContext.container, this.logger);
|
|
67
|
+
this.logger.info('End Migration');
|
|
68
|
+
}
|
|
69
|
+
catch (e) {
|
|
70
|
+
this.logger.error('Error while running migrations', e);
|
|
71
|
+
this.logger.error(e.stack);
|
|
72
|
+
}
|
|
73
|
+
try {
|
|
74
|
+
await this.serverFeature.postStart(this.mainServiceContext.container);
|
|
75
|
+
}
|
|
76
|
+
catch (e) {
|
|
77
|
+
this.logger.error('Error while running Post Start due to [%s]', e.message);
|
|
78
|
+
this.logger.error(e.stack);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
setupMicroserviceBrokerLifecycle() {
|
|
83
|
+
if (!this.microserviceContext)
|
|
84
|
+
return;
|
|
85
|
+
const originalStart = this.microserviceContext.broker.start.bind(this.microserviceContext.broker);
|
|
86
|
+
this.microserviceContext.broker.start = async () => {
|
|
87
|
+
await originalStart();
|
|
88
|
+
// Use main container if microservice container is null (due to module reuse)
|
|
89
|
+
const containerToUse = this.microserviceContext.container || this.mainServiceContext.container;
|
|
90
|
+
await this.serverFeature.microservicePreStart(containerToUse);
|
|
91
|
+
await this.serverFeature.microservicePostStart(containerToUse);
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
async setupGraphQLSchema() {
|
|
95
|
+
const { context, container, allModules: baseModules } = this.mainServiceContext;
|
|
96
|
+
// Compose features using the proper Feature pattern
|
|
97
|
+
const allModules = new serverCore.Feature(this.mainServiceContext.allModules, graphqlApiFeature);
|
|
98
|
+
const Constructor = this?.options?.isSubGraph ? subGraphSchemaBuilder.SubGraphSchemaBuilder : schemaBuilder.GatewaySchemaBuilder;
|
|
99
|
+
const executableSchema = await new Constructor({
|
|
135
100
|
schema: allModules.schemas,
|
|
136
101
|
resolvers: allModules.createResolvers({
|
|
137
|
-
pubsub,
|
|
102
|
+
pubsub: context.pubsub,
|
|
138
103
|
logger: server.logger,
|
|
139
104
|
subscriptionID: `${this.settings.subTopic}`,
|
|
140
105
|
}),
|
|
@@ -144,53 +109,71 @@ class MainStackServer {
|
|
|
144
109
|
rules: allModules.rules,
|
|
145
110
|
logger: server.logger,
|
|
146
111
|
}).build();
|
|
147
|
-
//
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
112
|
+
// Use the existing singleton container
|
|
113
|
+
const serviceContainer = container;
|
|
114
|
+
// Only create services if the base modules don't already have services created
|
|
115
|
+
// This prevents duplicate service creation when infrastructure factory already created them
|
|
116
|
+
let services;
|
|
117
|
+
const baseModulesServices = baseModules.services;
|
|
118
|
+
if (baseModulesServices) {
|
|
119
|
+
this.logger.info('Reusing existing services from infrastructure factory to avoid duplication');
|
|
120
|
+
services = baseModulesServices;
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
try {
|
|
124
|
+
this.logger.info('Creating services for GraphQL schema (base modules had no services)');
|
|
125
|
+
services = await allModules.createService({
|
|
126
|
+
...this.settings,
|
|
127
|
+
mongoConnection: context.mongoClient,
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
catch (error) {
|
|
131
|
+
this.logger.error('Failed to create services in MainStackServer:', error);
|
|
132
|
+
services = {};
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
// Create service context function that uses the created services
|
|
136
|
+
const serviceContextFunc = async (req, connectionParams, webSocket) => {
|
|
137
|
+
const results = await Promise.all(allModules.createContextFunc.map((createContext) => createContext(req, connectionParams, webSocket)));
|
|
138
|
+
return _.merge({}, ...results, services);
|
|
139
|
+
};
|
|
140
|
+
// Create service broker interface
|
|
153
141
|
const serviceBroker = {
|
|
154
|
-
serviceContainer:
|
|
155
|
-
serviceContext:
|
|
142
|
+
serviceContainer: serviceContainer,
|
|
143
|
+
serviceContext: serviceContextFunc,
|
|
156
144
|
dataSource: allModules.createDataSource(),
|
|
157
145
|
defaultPreferences: allModules.createDefaultPreferences(),
|
|
158
146
|
createContext: async (req, res) => allModules.createContext(req, res),
|
|
159
147
|
logger: server.logger,
|
|
160
148
|
schema: executableSchema,
|
|
161
149
|
};
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
this.microserviceContainer = await allModules.createHemeraContainers({
|
|
169
|
-
...this.settings,
|
|
170
|
-
mongoConnection: mongoClient,
|
|
171
|
-
});
|
|
172
|
-
allModules.loadClientMoleculerService({
|
|
173
|
-
broker: this.microserviceBroker,
|
|
174
|
-
container: this.microserviceContainer,
|
|
175
|
-
settings: this.settings,
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
// initialize Servers
|
|
150
|
+
this.serviceBroker = serviceBroker;
|
|
151
|
+
this.allModules = allModules;
|
|
152
|
+
}
|
|
153
|
+
async setupHttpServer() {
|
|
154
|
+
const { context } = this.mainServiceContext;
|
|
155
|
+
// Initialize HTTP server and Express app
|
|
179
156
|
this.httpServer = http__namespace.createServer();
|
|
180
|
-
|
|
181
|
-
|
|
157
|
+
// Pass Redis client to expressApp so it can be attached at the very top of middleware stack
|
|
158
|
+
this.app = await ExpressApp.expressApp(this.allModules, this.serviceBroker, null, this.httpServer, context.redisClient);
|
|
159
|
+
// Register existing express middleware (Redis client middleware is already attached in expressApp)
|
|
160
|
+
this.allModules.registerExpressMiddleware(this.app, this.mainServiceContext.container);
|
|
161
|
+
// Setup Inngest functions
|
|
162
|
+
setup.setupInngestFunctions(this.allModules, this.app, this.mainServiceContext.container, this.logger);
|
|
182
163
|
this.httpServer.startListening = startListening.bind(this.httpServer);
|
|
183
164
|
this.httpServer.on('request', this.app);
|
|
184
165
|
this.httpServer.on('close', () => {
|
|
185
166
|
this.httpServer = undefined;
|
|
186
167
|
});
|
|
187
|
-
|
|
168
|
+
// Setup WebSocket if configured
|
|
169
|
+
const customWebsocket = this.allModules.getWebsocketConfig();
|
|
188
170
|
const customWebsocketEnable = !_.isEmpty(customWebsocket);
|
|
189
171
|
if (customWebsocketEnable) {
|
|
190
|
-
this.multiPathWebsocket = new WebsocketMultipathUpdate.WebsocketMultiPathServer(serviceBroker, redisClient, customWebsocket);
|
|
172
|
+
this.multiPathWebsocket = new WebsocketMultipathUpdate.WebsocketMultiPathServer(this.serviceBroker, context.redisClient, customWebsocket);
|
|
191
173
|
this.httpServer = this.multiPathWebsocket.httpServerUpgrade(this.httpServer);
|
|
192
174
|
}
|
|
193
|
-
|
|
175
|
+
// Setup GraphQL server
|
|
176
|
+
const graphqlServer = new GraphqlServer.GraphqlServer(this.app, this.httpServer, context.redisClient, this.serviceBroker, !customWebsocketEnable, this.allModules.apolloCacheKeyGenerator.bind(this.allModules), this.allModules.apolloInvalidateCacheKeyGenerator.bind(this.allModules), this.allModules.graphqlPlugins);
|
|
194
177
|
await graphqlServer.initialize();
|
|
195
178
|
this.app.use('/graphql', (req, res, next) => {
|
|
196
179
|
res.append('Access-Control-Allow-Credentials', JSON.stringify(true));
|
|
@@ -201,11 +184,11 @@ class MainStackServer {
|
|
|
201
184
|
});
|
|
202
185
|
}
|
|
203
186
|
async start() {
|
|
204
|
-
if (envConfig.config.NODE_ENV === 'development') {
|
|
205
|
-
await Promise.all([this.
|
|
187
|
+
if (envConfig.config.NODE_ENV === 'development' && this.microserviceContext) {
|
|
188
|
+
await Promise.all([this.mainServiceContext.broker.start(), this.microserviceContext.broker.start()]);
|
|
206
189
|
}
|
|
207
190
|
else {
|
|
208
|
-
await this.
|
|
191
|
+
await this.mainServiceContext.broker.start();
|
|
209
192
|
}
|
|
210
193
|
}
|
|
211
194
|
async cleanup() {
|
|
@@ -215,14 +198,14 @@ class MainStackServer {
|
|
|
215
198
|
if (this.httpServer) {
|
|
216
199
|
await this.httpServer.close();
|
|
217
200
|
}
|
|
218
|
-
if (this.
|
|
219
|
-
await this.
|
|
201
|
+
if (this.infrastructureFactory) {
|
|
202
|
+
await this.infrastructureFactory.cleanup();
|
|
220
203
|
}
|
|
221
|
-
if (this.
|
|
222
|
-
await this.
|
|
204
|
+
if (this.mainServiceContext?.broker) {
|
|
205
|
+
await this.mainServiceContext.broker.stop();
|
|
223
206
|
}
|
|
224
|
-
if (this.
|
|
225
|
-
await this.
|
|
207
|
+
if (this.microserviceContext?.broker) {
|
|
208
|
+
await this.microserviceContext.broker.stop();
|
|
226
209
|
}
|
|
227
210
|
}
|
|
228
211
|
}exports.MainStackServer=MainStackServer;//# sourceMappingURL=MainStackServer.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MainStackServer.cjs","sources":["../src/MainStackServer.ts"],"sourcesContent":[null],"names":["
|
|
1
|
+
{"version":3,"file":"MainStackServer.cjs","sources":["../src/MainStackServer.ts"],"sourcesContent":[null],"names":["serverLogger","InfrastructureFactory","config","migrate","Feature","SubGraphSchemaBuilder","GatewaySchemaBuilder","merge","http","expressApp","setupInngestFunctions","isEmpty","WebsocketMultiPathServer","GraphqlServer"],"mappings":"+pCAAA;AACA;AACA;AACA;AAwBA,MAAM,iBAAiB,GAAI,aAAqB,CAAC,OAAO,IAAI,aAAa,CAAC;AAE1E,SAAS,cAAc,CAAC,IAAI,EAAA;;IAExB,MAAM,MAAM,G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CAAC;SACnC;AACD,QAAA,IAAI,IAAI,CAAC,UAAU,EAAE;AACjB,YAAA,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;SACjC;AACD,QAAA,IAAI,IAAI,CAAC,qBAAqB,EAAE;AAC5B,YAAA,MAAM,IAAI,CAAC,qBAAqB,CAAC,OAAO,EAAE,CAAC;SAC9C;AACD,QAAA,IAAI,IAAI,CAAC,kBAAkB,EAAE,MAAM,EAAE;YACjC,MAAM,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;SAC/C;AACD,QAAA,IAAI,IAAI,CAAC,mBAAmB,EAAE,MAAM,EAAE;YAClC,MAAM,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;SAChD;KACJ;AACJ"}
|
package/lib/MainStackServer.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
1
2
|
import * as http from 'http';
|
|
2
3
|
import * as express from 'express';
|
|
3
4
|
import { Feature as ServerFeature } from '@common-stack/server-core';
|
|
@@ -13,16 +14,21 @@ export declare class MainStackServer {
|
|
|
13
14
|
};
|
|
14
15
|
app: express.Express;
|
|
15
16
|
private logger;
|
|
16
|
-
private
|
|
17
|
-
private
|
|
18
|
-
private
|
|
17
|
+
private infrastructureFactory;
|
|
18
|
+
private mainServiceContext;
|
|
19
|
+
private microserviceContext;
|
|
19
20
|
private multiPathWebsocket;
|
|
20
|
-
private serviceContainer;
|
|
21
|
-
private microserviceContainer;
|
|
22
21
|
private serverFeature;
|
|
23
22
|
private settings;
|
|
24
|
-
|
|
23
|
+
private options;
|
|
24
|
+
private serviceBroker;
|
|
25
|
+
private allModules;
|
|
26
|
+
constructor(feature: ServerFeature, settings: any, options?: Record<string, unknown>);
|
|
25
27
|
initialize(): Promise<void>;
|
|
28
|
+
private setupMainServiceBrokerLifecycle;
|
|
29
|
+
private setupMicroserviceBrokerLifecycle;
|
|
30
|
+
private setupGraphQLSchema;
|
|
31
|
+
private setupHttpServer;
|
|
26
32
|
start(): Promise<void>;
|
|
27
33
|
cleanup(): Promise<void>;
|
|
28
34
|
}
|