@common-stack/server-stack 8.0.2-alpha.0 → 8.2.1-alpha.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/LICENSE +34 -21
- package/lib/MainStackServer.cjs +126 -146
- package/lib/MainStackServer.cjs.map +1 -1
- package/lib/MainStackServer.d.ts +12 -6
- package/lib/MainStackServer.mjs +126 -146
- 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 +5 -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/responseCachePlugin.cjs +2 -2
- package/lib/plugins/responseCachePlugin.cjs.map +1 -1
- package/lib/plugins/responseCachePlugin.mjs +2 -2
- package/lib/plugins/responseCachePlugin.mjs.map +1 -1
- 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 +7 -2
- package/lib/servers/GraphqlServer.cjs.map +1 -1
- package/lib/servers/GraphqlServer.d.ts +8 -6
- package/lib/servers/GraphqlServer.mjs +7 -2
- 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 +2 -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/lib/plugins/invalidateCachePlugin.test.d.ts +0 -1
- package/lib/plugins/response-cache-plugin.test.d.ts +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,18 +10,6 @@ function startListening(port) {
|
|
|
9
10
|
server.listen(port, resolve);
|
|
10
11
|
});
|
|
11
12
|
}
|
|
12
|
-
const infraModule = ({ broker, pubsub, mongoClient, logger, redisClient }) => 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(core.CommonType.REDIS_CLIENT).toConstantValue(redisClient);
|
|
21
|
-
bind('MoleculerBroker').toConstantValue(broker);
|
|
22
|
-
bind('MongoDBConnection').toConstantValue(mongoClient);
|
|
23
|
-
});
|
|
24
13
|
/**
|
|
25
14
|
* Controls the lifecycle of the Application Server
|
|
26
15
|
*
|
|
@@ -31,113 +20,86 @@ class MainStackServer {
|
|
|
31
20
|
httpServer;
|
|
32
21
|
app;
|
|
33
22
|
logger;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
23
|
+
infrastructureFactory;
|
|
24
|
+
mainServiceContext;
|
|
25
|
+
microserviceContext;
|
|
37
26
|
multiPathWebsocket;
|
|
38
|
-
serviceContainer;
|
|
39
|
-
microserviceContainer;
|
|
40
27
|
serverFeature;
|
|
41
28
|
settings;
|
|
42
|
-
|
|
29
|
+
options;
|
|
30
|
+
serviceBroker;
|
|
31
|
+
allModules;
|
|
32
|
+
constructor(feature, settings, options) {
|
|
43
33
|
this.serverFeature = feature;
|
|
44
34
|
this.settings = settings;
|
|
35
|
+
this.options = options;
|
|
45
36
|
this.logger = server.logger.child({ className: 'StackServer' });
|
|
37
|
+
this.infrastructureFactory = new infrastructureFactory.InfrastructureFactory(this.logger);
|
|
46
38
|
}
|
|
47
39
|
async initialize() {
|
|
48
40
|
this.logger.info('StackServer initializing');
|
|
49
|
-
//
|
|
50
|
-
this.
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
//
|
|
54
|
-
this.
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
moleculerInterNamespace.InterNamespaceMiddleware([
|
|
58
|
-
{
|
|
59
|
-
namespace: 'api-admin',
|
|
60
|
-
transporter: moleculer_config.default.transporter,
|
|
61
|
-
metrics: { enabled: false },
|
|
62
|
-
},
|
|
63
|
-
]),
|
|
64
|
-
],
|
|
65
|
-
started: async () => {
|
|
66
|
-
await this.serverFeature.preStart(this.serviceContainer);
|
|
67
|
-
if (envConfig.config.NODE_ENV === 'development') ;
|
|
68
|
-
try {
|
|
69
|
-
this.logger.info('Starting Migration');
|
|
70
|
-
await migrations.migrate(mongoClient, this.serviceContainer, this.logger);
|
|
71
|
-
this.logger.info('End Migration');
|
|
72
|
-
}
|
|
73
|
-
catch (e) {
|
|
74
|
-
this.logger.error('Error while running migrations', e);
|
|
75
|
-
this.logger.error(e.stack);
|
|
76
|
-
}
|
|
77
|
-
try {
|
|
78
|
-
await this.serverFeature.postStart(this.serviceContainer);
|
|
79
|
-
}
|
|
80
|
-
catch (e) {
|
|
81
|
-
this.logger.error('Error while running Post Start due to [%s]', e.message);
|
|
82
|
-
this.logger.error(e.stack);
|
|
83
|
-
}
|
|
84
|
-
// start DB migration
|
|
85
|
-
if (envConfig.config.NODE_ENV === 'development') ;
|
|
86
|
-
},
|
|
87
|
-
// created,
|
|
88
|
-
async created() {
|
|
89
|
-
return Promise.resolve();
|
|
90
|
-
},
|
|
91
|
-
});
|
|
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
|
|
92
49
|
if (envConfig.config.NODE_ENV === 'development') {
|
|
93
|
-
this.
|
|
94
|
-
|
|
95
|
-
metrics: { enabled: false },
|
|
96
|
-
nodeID: 'node-broker-2',
|
|
97
|
-
started: async () => {
|
|
98
|
-
await this.serverFeature.microservicePreStart(this.microserviceContainer);
|
|
99
|
-
await this.serverFeature.microservicePostStart(this.microserviceContainer);
|
|
100
|
-
},
|
|
101
|
-
// created,
|
|
102
|
-
created: async () => Promise.resolve(),
|
|
103
|
-
});
|
|
50
|
+
this.microserviceContext = await this.infrastructureFactory.createBrokerAndContainer(infrastructureFactory.InfrastructureFactory.createDevelopmentMicroserviceConfig(), this.serverFeature, this.settings, this.mainServiceContext.allModules);
|
|
51
|
+
this.setupMicroserviceBrokerLifecycle();
|
|
104
52
|
}
|
|
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
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
const
|
|
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({
|
|
138
100
|
schema: allModules.schemas,
|
|
139
101
|
resolvers: allModules.createResolvers({
|
|
140
|
-
pubsub,
|
|
102
|
+
pubsub: context.pubsub,
|
|
141
103
|
logger: server.logger,
|
|
142
104
|
subscriptionID: `${this.settings.subTopic}`,
|
|
143
105
|
}),
|
|
@@ -147,53 +109,71 @@ class MainStackServer {
|
|
|
147
109
|
rules: allModules.rules,
|
|
148
110
|
logger: server.logger,
|
|
149
111
|
}).build();
|
|
150
|
-
//
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
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
|
|
156
141
|
const serviceBroker = {
|
|
157
|
-
serviceContainer:
|
|
158
|
-
serviceContext:
|
|
142
|
+
serviceContainer: serviceContainer,
|
|
143
|
+
serviceContext: serviceContextFunc,
|
|
159
144
|
dataSource: allModules.createDataSource(),
|
|
160
145
|
defaultPreferences: allModules.createDefaultPreferences(),
|
|
161
146
|
createContext: async (req, res) => allModules.createContext(req, res),
|
|
162
147
|
logger: server.logger,
|
|
163
148
|
schema: executableSchema,
|
|
164
149
|
};
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
this.microserviceContainer = await allModules.createHemeraContainers({
|
|
172
|
-
...this.settings,
|
|
173
|
-
mongoConnection: mongoClient,
|
|
174
|
-
});
|
|
175
|
-
allModules.loadClientMoleculerService({
|
|
176
|
-
broker: this.microserviceBroker,
|
|
177
|
-
container: this.microserviceContainer,
|
|
178
|
-
settings: this.settings,
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
// 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
|
|
182
156
|
this.httpServer = http__namespace.createServer();
|
|
183
|
-
|
|
184
|
-
|
|
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);
|
|
185
163
|
this.httpServer.startListening = startListening.bind(this.httpServer);
|
|
186
164
|
this.httpServer.on('request', this.app);
|
|
187
165
|
this.httpServer.on('close', () => {
|
|
188
166
|
this.httpServer = undefined;
|
|
189
167
|
});
|
|
190
|
-
|
|
168
|
+
// Setup WebSocket if configured
|
|
169
|
+
const customWebsocket = this.allModules.getWebsocketConfig();
|
|
191
170
|
const customWebsocketEnable = !_.isEmpty(customWebsocket);
|
|
192
171
|
if (customWebsocketEnable) {
|
|
193
|
-
this.multiPathWebsocket = new WebsocketMultipathUpdate.WebsocketMultiPathServer(serviceBroker, redisClient, customWebsocket);
|
|
172
|
+
this.multiPathWebsocket = new WebsocketMultipathUpdate.WebsocketMultiPathServer(this.serviceBroker, context.redisClient, customWebsocket);
|
|
194
173
|
this.httpServer = this.multiPathWebsocket.httpServerUpgrade(this.httpServer);
|
|
195
174
|
}
|
|
196
|
-
|
|
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);
|
|
197
177
|
await graphqlServer.initialize();
|
|
198
178
|
this.app.use('/graphql', (req, res, next) => {
|
|
199
179
|
res.append('Access-Control-Allow-Credentials', JSON.stringify(true));
|
|
@@ -204,11 +184,11 @@ class MainStackServer {
|
|
|
204
184
|
});
|
|
205
185
|
}
|
|
206
186
|
async start() {
|
|
207
|
-
if (envConfig.config.NODE_ENV === 'development') {
|
|
208
|
-
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()]);
|
|
209
189
|
}
|
|
210
190
|
else {
|
|
211
|
-
await this.
|
|
191
|
+
await this.mainServiceContext.broker.start();
|
|
212
192
|
}
|
|
213
193
|
}
|
|
214
194
|
async cleanup() {
|
|
@@ -218,14 +198,14 @@ class MainStackServer {
|
|
|
218
198
|
if (this.httpServer) {
|
|
219
199
|
await this.httpServer.close();
|
|
220
200
|
}
|
|
221
|
-
if (this.
|
|
222
|
-
await this.
|
|
201
|
+
if (this.infrastructureFactory) {
|
|
202
|
+
await this.infrastructureFactory.cleanup();
|
|
223
203
|
}
|
|
224
|
-
if (this.
|
|
225
|
-
await this.
|
|
204
|
+
if (this.mainServiceContext?.broker) {
|
|
205
|
+
await this.mainServiceContext.broker.stop();
|
|
226
206
|
}
|
|
227
|
-
if (this.
|
|
228
|
-
await this.
|
|
207
|
+
if (this.microserviceContext?.broker) {
|
|
208
|
+
await this.microserviceContext.broker.stop();
|
|
229
209
|
}
|
|
230
210
|
}
|
|
231
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,GAAG,IAAI,CAAC;AACpB,IAAA,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,KAAI;AAC3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,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
|
}
|