@common-stack/server-stack 8.0.2-alpha.0 → 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.
Files changed (147) hide show
  1. package/LICENSE +34 -21
  2. package/lib/MainStackServer.cjs +126 -146
  3. package/lib/MainStackServer.cjs.map +1 -1
  4. package/lib/MainStackServer.d.ts +12 -6
  5. package/lib/MainStackServer.mjs +126 -146
  6. package/lib/MainStackServer.mjs.map +1 -1
  7. package/lib/StackServer.cjs +23 -66
  8. package/lib/StackServer.cjs.map +1 -1
  9. package/lib/StackServer.d.ts +4 -5
  10. package/lib/StackServer.mjs +23 -66
  11. package/lib/StackServer.mjs.map +1 -1
  12. package/lib/api/schema-builder.cjs +13 -12
  13. package/lib/api/schema-builder.cjs.map +1 -1
  14. package/lib/api/schema-builder.mjs +13 -12
  15. package/lib/api/schema-builder.mjs.map +1 -1
  16. package/lib/api/sub-graph-schema-builder.cjs +147 -0
  17. package/lib/api/sub-graph-schema-builder.cjs.map +1 -0
  18. package/lib/api/sub-graph-schema-builder.d.ts +24 -0
  19. package/lib/api/sub-graph-schema-builder.mjs +147 -0
  20. package/lib/api/sub-graph-schema-builder.mjs.map +1 -0
  21. package/lib/config/env-config.cjs +6 -0
  22. package/lib/config/env-config.cjs.map +1 -1
  23. package/lib/config/env-config.d.ts +6 -0
  24. package/lib/config/env-config.mjs +6 -0
  25. package/lib/config/env-config.mjs.map +1 -1
  26. package/lib/examples/tenant-feature-example.d.ts +13 -0
  27. package/lib/examples/tenant-feature-integration.d.ts +14 -0
  28. package/lib/features/multi-module-example.d.ts +17 -0
  29. package/lib/index.cjs +1 -1
  30. package/lib/index.d.ts +1 -0
  31. package/lib/index.mjs +1 -1
  32. package/lib/infrastructure/container-module.cjs +27 -0
  33. package/lib/infrastructure/container-module.cjs.map +1 -0
  34. package/lib/infrastructure/container-module.d.ts +3 -0
  35. package/lib/infrastructure/container-module.mjs +27 -0
  36. package/lib/infrastructure/container-module.mjs.map +1 -0
  37. package/lib/infrastructure/example-workflows.d.ts +16 -0
  38. package/lib/infrastructure/index.d.ts +5 -0
  39. package/lib/infrastructure/infrastructure-factory.cjs +172 -0
  40. package/lib/infrastructure/infrastructure-factory.cjs.map +1 -0
  41. package/lib/infrastructure/infrastructure-factory.d.ts +36 -0
  42. package/lib/infrastructure/infrastructure-factory.mjs +172 -0
  43. package/lib/infrastructure/infrastructure-factory.mjs.map +1 -0
  44. package/lib/infrastructure/inngest-factory.cjs +47 -0
  45. package/lib/infrastructure/inngest-factory.cjs.map +1 -0
  46. package/lib/infrastructure/inngest-factory.d.ts +8 -0
  47. package/lib/infrastructure/inngest-factory.mjs +47 -0
  48. package/lib/infrastructure/inngest-factory.mjs.map +1 -0
  49. package/lib/infrastructure/types.d.ts +28 -0
  50. package/lib/infrastructure/usage-examples.d.ts +9 -0
  51. package/lib/infrastructure/workflow-orchestrator.cjs +59 -0
  52. package/lib/infrastructure/workflow-orchestrator.cjs.map +1 -0
  53. package/lib/infrastructure/workflow-orchestrator.d.ts +10 -0
  54. package/lib/infrastructure/workflow-orchestrator.mjs +59 -0
  55. package/lib/infrastructure/workflow-orchestrator.mjs.map +1 -0
  56. package/lib/inngest/client-id-generator.d.ts +29 -0
  57. package/lib/inngest/handler-factory.d.ts +24 -0
  58. package/lib/inngest/middleware/auto-resolve-invoke.middleware.cjs +275 -0
  59. package/lib/inngest/middleware/auto-resolve-invoke.middleware.cjs.map +1 -0
  60. package/lib/inngest/middleware/auto-resolve-invoke.middleware.d.ts +111 -0
  61. package/lib/inngest/middleware/auto-resolve-invoke.middleware.mjs +275 -0
  62. package/lib/inngest/middleware/auto-resolve-invoke.middleware.mjs.map +1 -0
  63. package/lib/inngest/middleware/function-reference-helper.cjs +363 -0
  64. package/lib/inngest/middleware/function-reference-helper.cjs.map +1 -0
  65. package/lib/inngest/middleware/function-reference-helper.d.ts +211 -0
  66. package/lib/inngest/middleware/function-reference-helper.mjs +363 -0
  67. package/lib/inngest/middleware/function-reference-helper.mjs.map +1 -0
  68. package/lib/inngest/middleware/index.d.ts +31 -0
  69. package/lib/inngest/middleware/types.d.ts +162 -0
  70. package/lib/inngest/multi-module-functions.d.ts +133 -0
  71. package/lib/inngest/setup.cjs +55 -0
  72. package/lib/inngest/setup.cjs.map +1 -0
  73. package/lib/inngest/setup.d.ts +10 -0
  74. package/lib/inngest/setup.mjs +55 -0
  75. package/lib/inngest/setup.mjs.map +1 -0
  76. package/lib/interfaces/graphql-request-context.d.ts +5 -0
  77. package/lib/middleware/index.d.ts +5 -0
  78. package/lib/middleware/redis-client.cjs +18 -0
  79. package/lib/middleware/redis-client.cjs.map +1 -0
  80. package/lib/middleware/redis-client.d.ts +16 -0
  81. package/lib/middleware/redis-client.mjs +18 -0
  82. package/lib/middleware/redis-client.mjs.map +1 -0
  83. package/lib/plugins/responseCachePlugin.cjs +2 -2
  84. package/lib/plugins/responseCachePlugin.cjs.map +1 -1
  85. package/lib/plugins/responseCachePlugin.mjs +2 -2
  86. package/lib/plugins/responseCachePlugin.mjs.map +1 -1
  87. package/lib/servers/ExpressApp.cjs +8 -3
  88. package/lib/servers/ExpressApp.cjs.map +1 -1
  89. package/lib/servers/ExpressApp.d.ts +1 -1
  90. package/lib/servers/ExpressApp.mjs +8 -3
  91. package/lib/servers/ExpressApp.mjs.map +1 -1
  92. package/lib/servers/GraphqlServer.cjs +7 -2
  93. package/lib/servers/GraphqlServer.cjs.map +1 -1
  94. package/lib/servers/GraphqlServer.d.ts +8 -6
  95. package/lib/servers/GraphqlServer.mjs +7 -2
  96. package/lib/servers/GraphqlServer.mjs.map +1 -1
  97. package/lib/servers/GraphqlWs.cjs +3 -44
  98. package/lib/servers/GraphqlWs.cjs.map +1 -1
  99. package/lib/servers/GraphqlWs.mjs +3 -44
  100. package/lib/servers/GraphqlWs.mjs.map +1 -1
  101. package/lib/servers/WebsocketMultipathUpdate.cjs +4 -2
  102. package/lib/servers/WebsocketMultipathUpdate.cjs.map +1 -1
  103. package/lib/servers/WebsocketMultipathUpdate.mjs +4 -2
  104. package/lib/servers/WebsocketMultipathUpdate.mjs.map +1 -1
  105. package/lib/servers/mongodb-migration-update.d.ts +1 -1
  106. package/lib/servers/websocket-context.cjs +70 -0
  107. package/lib/servers/websocket-context.cjs.map +1 -0
  108. package/lib/servers/websocket-context.d.ts +30 -0
  109. package/lib/servers/websocket-context.mjs +70 -0
  110. package/lib/servers/websocket-context.mjs.map +1 -0
  111. package/lib/utils/add-shareable-directive-to-schema.cjs +44 -0
  112. package/lib/utils/add-shareable-directive-to-schema.cjs.map +1 -0
  113. package/lib/utils/add-shareable-directive-to-schema.d.ts +1 -0
  114. package/lib/utils/add-shareable-directive-to-schema.mjs +44 -0
  115. package/lib/utils/add-shareable-directive-to-schema.mjs.map +1 -0
  116. package/lib/utils/index.d.ts +2 -0
  117. package/lib/utils/safe-model-factory.d.ts +18 -0
  118. package/package.json +15 -11
  119. package/lib/api/resolver.cjs +0 -12
  120. package/lib/api/resolver.cjs.map +0 -1
  121. package/lib/api/resolver.mjs +0 -12
  122. package/lib/api/resolver.mjs.map +0 -1
  123. package/lib/api/root-schema.graphqls.cjs +0 -2
  124. package/lib/api/root-schema.graphqls.cjs.map +0 -1
  125. package/lib/api/root-schema.graphqls.mjs +0 -2
  126. package/lib/api/root-schema.graphqls.mjs.map +0 -1
  127. package/lib/api/scalar.cjs +0 -16
  128. package/lib/api/scalar.cjs.map +0 -1
  129. package/lib/api/scalar.mjs +0 -16
  130. package/lib/api/scalar.mjs.map +0 -1
  131. package/lib/graphql/directives/index.cjs +0 -10
  132. package/lib/graphql/directives/index.cjs.map +0 -1
  133. package/lib/graphql/directives/index.d.ts +0 -7
  134. package/lib/graphql/directives/index.mjs +0 -10
  135. package/lib/graphql/directives/index.mjs.map +0 -1
  136. package/lib/graphql/index.d.ts +0 -2
  137. package/lib/graphql/schema/directives.graphql.cjs +0 -1
  138. package/lib/graphql/schema/directives.graphql.cjs.map +0 -1
  139. package/lib/graphql/schema/directives.graphql.mjs +0 -1
  140. package/lib/graphql/schema/directives.graphql.mjs.map +0 -1
  141. package/lib/graphql/schema/index.cjs +0 -1
  142. package/lib/graphql/schema/index.cjs.map +0 -1
  143. package/lib/graphql/schema/index.d.ts +0 -1
  144. package/lib/graphql/schema/index.mjs +0 -1
  145. package/lib/graphql/schema/index.mjs.map +0 -1
  146. package/lib/plugins/invalidateCachePlugin.test.d.ts +0 -1
  147. package/lib/plugins/response-cache-plugin.test.d.ts +0 -1
@@ -35,4 +35,10 @@ const config = envalid__namespace.cleanEnv(process.env,
35
35
  }),
36
36
  example: '{"enabled":true,"port":3030,"path":"/metrics"}',
37
37
  }),
38
+ INNGEST_EVENT_KEY: str({ devDefault: 'dummy' }),
39
+ INNGEST_SIGNING_KEY: str({ devDefault: 'dummy' }),
40
+ INNGEST_IS_DEV: bool({ devDefault: true, default: false }),
41
+ INNGEST_ENVIRONMENT: str({ devDefault: 'development', default: 'production' }),
42
+ INNGEST_BASE_URL: str({ devDefault: 'http://localhost:8288', default: 'https://api.inngest.com' }),
43
+ INNGEST_CLIENT_ID: str({ devDefault: '', default: '' }),
38
44
  } /* end */);exports.config=config;//# sourceMappingURL=env-config.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"env-config.cjs","sources":["../../src/config/env-config.ts"],"sourcesContent":[null],"names":["envalid"],"mappings":"gZAEA,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,GAAGA,kBAAO,CAAC;AAE5B,MAAA,MAAM,GAAGA,kBAAO,CAAC,QAAQ,CAClC,OAAO,CAAC,GAAG;AACX;AACA;IACI,QAAQ,EAAE,GAAG,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,CAAC,EAAE,CAAC;IACnG,QAAQ,EAAE,GAAG,EAAE;IACf,SAAS,EAAE,GAAG,EAAE;IAChB,OAAO,EAAE,GAAG,E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AO,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC;IACxE,cAAc,EAAE,IAAI,CAAC;AACjB,QAAA,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC;AACpB,YAAA,OAAO,EAAE,KAAK;AACd,YAAA,IAAI,EAAE,IAAI;AACV,YAAA,IAAI,EAAE,UAAU;SACnB,CAAC;AACF,QAAA,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC;AACvB,YAAA,OAAO,EAAE,KAAK;AACd,YAAA,IAAI,EAAE,IAAI;AACV,YAAA,IAAI,EAAE,UAAU;SACnB,CAAC;AACF,QAAA,OAAO,EAAE,gDAAgD;KAC5D,CAAC;IACF,iBAAiB,EAAE,GAAG,CAAC,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC;IAC/C,mBAAmB,EAAE,GAAG,CAAC,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC;AACjD,IAAA,cAAc,EAAE,IAAI,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AAC1D,IAAA,mBAAmB,EAAE,GAAG,CAAC,EAAE,UAAU,EAAE,aAAa,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC;AAC9E,IAAA,gBAAgB,EAAE,GAAG,CAAC,EAAE,UAAU,EAAE,uBAAuB,EAAE,OAAO,EAAE,yBAAyB,EAAE,CAAC;AAClG,IAAA,iBAAiB,EAAE,GAAG,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;CAC1D"}
@@ -18,4 +18,10 @@ export declare const config: Readonly<{
18
18
  NAMESPACE: string;
19
19
  LOG_LEVEL: string;
20
20
  METRICS_CONFIG: string;
21
+ INNGEST_EVENT_KEY: string;
22
+ INNGEST_SIGNING_KEY: string;
23
+ INNGEST_IS_DEV: boolean;
24
+ INNGEST_ENVIRONMENT: string;
25
+ INNGEST_BASE_URL: string;
26
+ INNGEST_CLIENT_ID: string;
21
27
  } & envalid.CleanedEnvAccessors>;
@@ -35,4 +35,10 @@ const config = envalid.cleanEnv(process.env,
35
35
  }),
36
36
  example: '{"enabled":true,"port":3030,"path":"/metrics"}',
37
37
  }),
38
+ INNGEST_EVENT_KEY: str({ devDefault: 'dummy' }),
39
+ INNGEST_SIGNING_KEY: str({ devDefault: 'dummy' }),
40
+ INNGEST_IS_DEV: bool({ devDefault: true, default: false }),
41
+ INNGEST_ENVIRONMENT: str({ devDefault: 'development', default: 'production' }),
42
+ INNGEST_BASE_URL: str({ devDefault: 'http://localhost:8288', default: 'https://api.inngest.com' }),
43
+ INNGEST_CLIENT_ID: str({ devDefault: '', default: '' }),
38
44
  } /* end */);export{config};//# sourceMappingURL=env-config.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"env-config.mjs","sources":["../../src/config/env-config.ts"],"sourcesContent":[null],"names":[],"mappings":"gCAEA,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;AAE5B,MAAA,MAAM,GAAG,OAAO,CAAC,QAAQ,CAClC,OAAO,CAAC,GAAG;AACX;AACA;IACI,QAAQ,EAAE,GAAG,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,CAAC,EAAE,CAAC;IACnG,QAAQ,EAAE,GAAG,EAAE;IACf,SAAS,EAAE,GAAG,EAAE;IAChB,OAAO,EAAE,GAAG,EAAE;IACd,gBAAgB,EAAE,GAAG,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;IAC9C,WAAW,EAAE,GAAG,EAAE;IAClB,WAAW,EAAE,GAAG,EAAE;IAClB,UAAU,EAAE,GAAG,EAAE;IACjB,SAAS,EAAE,GAAG,EAAE;IAChB,QAAQ,EAAE,GAAG,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;IACrC,iBAAiB,EAAE,IAAI,CAA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OAAO,EAAE,KAAK;AACd,YAAA,IAAI,EAAE,IAAI;AACV,YAAA,IAAI,EAAE,UAAU;SACnB,CAAC;AACF,QAAA,OAAO,EAAE,gDAAgD;KAC5D,CAAC;IACF,iBAAiB,EAAE,GAAG,CAAC,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC;IAC/C,mBAAmB,EAAE,GAAG,CAAC,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC;AACjD,IAAA,cAAc,EAAE,IAAI,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AAC1D,IAAA,mBAAmB,EAAE,GAAG,CAAC,EAAE,UAAU,EAAE,aAAa,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC;AAC9E,IAAA,gBAAgB,EAAE,GAAG,CAAC,EAAE,UAAU,EAAE,uBAAuB,EAAE,OAAO,EAAE,yBAAyB,EAAE,CAAC;AAClG,IAAA,iBAAiB,EAAE,GAAG,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;CAC1D"}
@@ -0,0 +1,13 @@
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
+ };
@@ -0,0 +1,14 @@
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>;
@@ -0,0 +1,17 @@
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.cjs CHANGED
@@ -1 +1 @@
1
- 'use strict';var StackServer=require('./StackServer.cjs'),MainStackServer=require('./MainStackServer.cjs'),datasourceRest=require('@apollo/datasource-rest');exports.StackServer=StackServer.StackServer;exports.MainStackServer=MainStackServer.MainStackServer;Object.defineProperty(exports,'RESTDataSource',{enumerable:true,get:function(){return datasourceRest.RESTDataSource}});//# sourceMappingURL=index.cjs.map
1
+ 'use strict';var StackServer=require('./StackServer.cjs'),MainStackServer=require('./MainStackServer.cjs'),datasourceRest=require('@apollo/datasource-rest'),redisClient=require('./middleware/redis-client.cjs');exports.StackServer=StackServer.StackServer;exports.MainStackServer=MainStackServer.MainStackServer;Object.defineProperty(exports,'RESTDataSource',{enumerable:true,get:function(){return datasourceRest.RESTDataSource}});exports.redisClientMiddleware=redisClient.redisClientMiddleware;//# sourceMappingURL=index.cjs.map
package/lib/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export { StackServer } from './StackServer';
2
2
  export { MainStackServer } from './MainStackServer';
3
3
  export { RESTDataSource } from '@apollo/datasource-rest';
4
+ export { redisClientMiddleware } from './middleware/redis-client';
package/lib/index.mjs CHANGED
@@ -1 +1 @@
1
- export{StackServer}from'./StackServer.mjs';export{MainStackServer}from'./MainStackServer.mjs';export{RESTDataSource}from'@apollo/datasource-rest';//# sourceMappingURL=index.mjs.map
1
+ export{StackServer}from'./StackServer.mjs';export{MainStackServer}from'./MainStackServer.mjs';export{RESTDataSource}from'@apollo/datasource-rest';export{redisClientMiddleware}from'./middleware/redis-client.mjs';//# sourceMappingURL=index.mjs.map
@@ -0,0 +1,27 @@
1
+ 'use strict';var inversify=require('inversify'),core=require('@common-stack/core');const createInfrastructureModule = (context, connectorConfig) => {
2
+ return new inversify.ContainerModule((bind) => {
3
+ // Core bindings - always included
4
+ // Bind logger with multiple identifiers for compatibility, avoiding duplicates
5
+ bind('Logger').toConstantValue(context.logger);
6
+ bind(core.CommonType.LOGGER).toConstantValue(context.logger); // 'LOGGER'
7
+ bind(core.ClientTypes.Logger).toConstantValue(context.logger); // Symbol.for('Logger')
8
+ bind('Environment').toConstantValue(process.env.NODE_ENV || 'development');
9
+ bind(core.CommonType.ENVIRONMENT).toConstantValue(process.env.NODE_ENV || 'development');
10
+ bind(core.CommonType.MOLECULER_BROKER).toConstantValue(context.broker);
11
+ bind('MoleculerBroker').toConstantValue(context.broker);
12
+ // Conditional bindings based on connector configuration
13
+ if (connectorConfig.pubsub && context.pubsub) {
14
+ bind('PubSub').toConstantValue(context.pubsub);
15
+ bind(core.CommonType.PUBSUB).toConstantValue(context.pubsub);
16
+ }
17
+ if (connectorConfig.mongo && context.mongoClient) {
18
+ bind('MongoDBConnection').toConstantValue(context.mongoClient);
19
+ }
20
+ if (connectorConfig.redis && context.redisClient) {
21
+ bind(core.CommonType.REDIS_CLIENT).toConstantValue(context.redisClient);
22
+ }
23
+ if (connectorConfig.inngest && context.inngestClient) {
24
+ bind(core.CommonType.INNGEST_CLIENT).toConstantValue(context.inngestClient);
25
+ }
26
+ });
27
+ };exports.createInfrastructureModule=createInfrastructureModule;//# sourceMappingURL=container-module.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"container-module.cjs","sources":["../../src/infrastructure/container-module.ts"],"sourcesContent":[null],"names":["ContainerModule","CommonType","ClientTypes"],"mappings":"yFAIa,0BAA0B,GAAG,CAAC,OAA8B,EAA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IAAI,CAACA,eAAU,CAAC,YAAY,CAAC,CAAC,eAAe,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;SACtE;QAED,IAAI,eAAe,CAAC,OAAO,IAAI,OAAO,CAAC,aAAa,EAAE;AAClD,YAAA,IAAI,CAACA,eAAU,CAAC,cAAc,CAAC,CAAC,eAAe,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;SAC1E;AACL,KAAC,CAAC,CAAC;AACP"}
@@ -0,0 +1,3 @@
1
+ import { ContainerModule } from 'inversify';
2
+ import { InfrastructureContext, ConnectorConfig } from './types';
3
+ export declare const createInfrastructureModule: (context: InfrastructureContext, connectorConfig: ConnectorConfig) => ContainerModule;
@@ -0,0 +1,27 @@
1
+ import {ContainerModule}from'inversify';import {CommonType,ClientTypes}from'@common-stack/core';const createInfrastructureModule = (context, connectorConfig) => {
2
+ return new ContainerModule((bind) => {
3
+ // Core bindings - always included
4
+ // Bind logger with multiple identifiers for compatibility, avoiding duplicates
5
+ bind('Logger').toConstantValue(context.logger);
6
+ bind(CommonType.LOGGER).toConstantValue(context.logger); // 'LOGGER'
7
+ bind(ClientTypes.Logger).toConstantValue(context.logger); // Symbol.for('Logger')
8
+ bind('Environment').toConstantValue(process.env.NODE_ENV || 'development');
9
+ bind(CommonType.ENVIRONMENT).toConstantValue(process.env.NODE_ENV || 'development');
10
+ bind(CommonType.MOLECULER_BROKER).toConstantValue(context.broker);
11
+ bind('MoleculerBroker').toConstantValue(context.broker);
12
+ // Conditional bindings based on connector configuration
13
+ if (connectorConfig.pubsub && context.pubsub) {
14
+ bind('PubSub').toConstantValue(context.pubsub);
15
+ bind(CommonType.PUBSUB).toConstantValue(context.pubsub);
16
+ }
17
+ if (connectorConfig.mongo && context.mongoClient) {
18
+ bind('MongoDBConnection').toConstantValue(context.mongoClient);
19
+ }
20
+ if (connectorConfig.redis && context.redisClient) {
21
+ bind(CommonType.REDIS_CLIENT).toConstantValue(context.redisClient);
22
+ }
23
+ if (connectorConfig.inngest && context.inngestClient) {
24
+ bind(CommonType.INNGEST_CLIENT).toConstantValue(context.inngestClient);
25
+ }
26
+ });
27
+ };export{createInfrastructureModule};//# sourceMappingURL=container-module.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"container-module.mjs","sources":["../../src/infrastructure/container-module.ts"],"sourcesContent":[null],"names":[],"mappings":"sGAIa,0BAA0B,GAAG,CAAC,OAA8B,EAAE,eAAgC,KAAI;AAC3G,IAAA,OAAO,IAAI,eAAe,CAAC,CAAC,IAAqB,KAAI;;;QAGjD,IAAI,CAAC,QAAQ,CAAC,CAAC,eAAe,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AAC/C,QAAA,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,eAAe,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AACxD,QAAA,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,eAAe,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AAEzD,QAAA,IAAI,CAAC,aAAa,CAAC,CAAC,eAAe,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,aAAa,CAAC,CAAC;AAC3E,QAAA,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,eAAe,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,aAAa,CAAC,CAAC;AACpF,QAAA,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC,eAAe,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAClE,IAAI,CAAC,iBAAiB,CAAC,CAAC,eAAe,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;;QAGxD,IAAI,eAAe,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,EAAE;YAC1C,IAAI,CAAC,QAAQ,CAAC,CAAC,eAAe,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AAC/C,YAAA,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,eAAe,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;SAC3D;QAED,IAAI,eAAe,CAAC,KAAK,IAAI,OAAO,CAAC,WAAW,EAAE;YAC9C,IAAI,CAAC,mBAAmB,CAAC,CAAC,eAAe,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;SAClE;QAED,IAAI,eAAe,CAAC,KAAK,IAAI,OAAO,CAAC,WAAW,EAAE;AAC9C,YAAA,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,eAAe,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;SACtE;QAED,IAAI,eAAe,CAAC,OAAO,IAAI,OAAO,CAAC,aAAa,EAAE;AAClD,YAAA,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC,eAAe,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;SAC1E;AACL,KAAC,CAAC,CAAC;AACP"}
@@ -0,0 +1,16 @@
1
+ import { WorkflowStep, ConnectorConfig } from './types';
2
+ /**
3
+ * Example custom workflow steps that can be added to the infrastructure initialization
4
+ */
5
+ export declare const metricsInitializationStep: WorkflowStep;
6
+ export declare const customMigrationStep: WorkflowStep;
7
+ export declare const healthCheckStep: WorkflowStep;
8
+ export declare const cacheWarmingStep: WorkflowStep;
9
+ export declare const HIGH_PERFORMANCE_CONFIG: ConnectorConfig;
10
+ export declare const MINIMAL_CONFIG: ConnectorConfig;
11
+ export declare function createCustomWorkflow(environment: string): WorkflowStep[];
12
+ export declare function createCustomInfrastructureConfig(environment: string): {
13
+ connectors: ConnectorConfig;
14
+ workflows: WorkflowStep[];
15
+ environment: string;
16
+ };
@@ -0,0 +1,5 @@
1
+ export * from './types';
2
+ export * from './container-module';
3
+ export * from './workflow-orchestrator';
4
+ export * from './infrastructure-factory';
5
+ export * from './inngest-factory';
@@ -0,0 +1,172 @@
1
+ 'use strict';var moleculer=require('moleculer'),serverCore=require('@common-stack/server-core'),workflowOrchestrator=require('./workflow-orchestrator.cjs'),containerModule=require('./container-module.cjs'),inngestFactory=require('./inngest-factory.cjs'),connectionBroker=require('../connectors/connection-broker.cjs'),moleculer_config=require('../config/moleculer.config.cjs'),moleculerInterNamespace=require('../middleware/moleculer-inter-namespace.cjs');class InfrastructureFactory {
2
+ logger;
3
+ connectionBroker;
4
+ orchestrator;
5
+ constructor(logger) {
6
+ this.logger = logger;
7
+ }
8
+ async initialize() {
9
+ this.logger.info('Initializing Infrastructure Factory');
10
+ this.connectionBroker = new connectionBroker.ConnectionBroker(moleculer_config.default.transporter, this.logger);
11
+ }
12
+ async createBrokerAndContainer(options, serverFeature, settings, existingAllModules) {
13
+ const { type, nodeId, connectorConfig, enableMetrics = true, workflows = [] } = options;
14
+ // Step 1: Create infrastructure context
15
+ const context = await this.createInfrastructureContext(connectorConfig);
16
+ // Step 2: Create workflow orchestrator
17
+ const config = {
18
+ connectors: connectorConfig,
19
+ workflows,
20
+ environment: process.env.NODE_ENV || 'development',
21
+ };
22
+ this.orchestrator = new workflowOrchestrator.WorkflowOrchestrator(config);
23
+ // Step 3: Create service broker
24
+ const broker = this.createServiceBroker(type, nodeId, enableMetrics);
25
+ context.broker = broker;
26
+ // Step 4: Load and compose modules first (before any container creation)
27
+ const allModules = await this.loadAndComposeModules(serverFeature, context, connectorConfig, existingAllModules);
28
+ // Step 5: Create container based on module composition
29
+ const container = await this.createContainerFromModules(allModules, type, settings, context, existingAllModules);
30
+ // Step 6: Initialize services and load Moleculer services
31
+ if (!existingAllModules && container) {
32
+ // For completely new modules, create services and load moleculer services
33
+ await allModules.createService({ ...settings, mongoConnection: context.mongoClient });
34
+ this.loadMoleculerServices(allModules, broker, container, settings, type);
35
+ }
36
+ else if (existingAllModules && type === 'microservice' && container) {
37
+ // For microservices with existing modules, skip service creation but allow Moleculer service loading
38
+ // This enables microservices to register their Moleculer services with the hemera container
39
+ this.logger.info('Loading Moleculer services for microservice with existing modules');
40
+ this.loadMoleculerServices(allModules, broker, container, settings, type);
41
+ }
42
+ else {
43
+ this.logger.info('Skipping service creation and Moleculer service loading for existing modules to prevent duplicates');
44
+ }
45
+ return { broker, container: container || null, context, allModules };
46
+ }
47
+ async loadAndComposeModules(serverFeature, context, connectorConfig, existingAllModules) {
48
+ if (existingAllModules) {
49
+ // If we already have composed modules, reuse them completely
50
+ // This prevents duplicate infrastructure creation and ensures container reuse
51
+ // Do NOT create any new Feature instances or process serverFeature again
52
+ return existingAllModules;
53
+ }
54
+ // Create infrastructure module only once for new feature compositions
55
+ const infraModule = containerModule.createInfrastructureModule(context, connectorConfig);
56
+ // Compose new feature with infrastructure and server features
57
+ return new serverCore.Feature({
58
+ createContainerFunc: [(settings) => infraModule],
59
+ createMicroServiceContainerFunc: [(settings) => infraModule],
60
+ }, serverFeature);
61
+ }
62
+ async createContainerFromModules(allModules, type, settings, context, existingAllModules) {
63
+ const containerSettings = { ...settings, mongoConnection: context.mongoClient };
64
+ if (existingAllModules) {
65
+ // For existing modules with microservice type, we still need to create a hemera container
66
+ // This allows microservices to have their own container for Moleculer service bindings
67
+ // while reusing the main modules to avoid service duplication
68
+ if (type === 'microservice') {
69
+ this.logger.info('Creating hemera container for microservice while reusing existing modules');
70
+ return await allModules.createHemeraContainers(containerSettings);
71
+ }
72
+ else {
73
+ // For main service with existing modules, skip container creation entirely
74
+ this.logger.warn('Reusing existing modules - container already exists, skipping new container creation');
75
+ return null; // Signal that we're reusing existing infrastructure
76
+ }
77
+ }
78
+ // Create fresh container for new modules
79
+ if (type === 'main') {
80
+ return await allModules.createContainers(containerSettings);
81
+ }
82
+ else {
83
+ return await allModules.createHemeraContainers(containerSettings);
84
+ }
85
+ }
86
+ loadMoleculerServices(allModules, broker, container, settings, type) {
87
+ // Load moleculer services based on type
88
+ if (type === 'main') {
89
+ allModules.loadMainMoleculerService({
90
+ broker,
91
+ container,
92
+ settings,
93
+ });
94
+ }
95
+ else {
96
+ allModules.loadClientMoleculerService({
97
+ broker,
98
+ container,
99
+ settings,
100
+ });
101
+ }
102
+ }
103
+ async createInfrastructureContext(connectorConfig) {
104
+ const context = {
105
+ logger: this.logger,
106
+ };
107
+ if (connectorConfig.redis) {
108
+ context.redisClient = await this.connectionBroker.redisConnection;
109
+ }
110
+ if (connectorConfig.mongo) {
111
+ context.mongoClient = await this.connectionBroker.mongoConnection;
112
+ }
113
+ if (connectorConfig.pubsub) {
114
+ context.pubsub = await this.connectionBroker.graphqlPubsub;
115
+ }
116
+ if (connectorConfig.inngest) {
117
+ context.inngestClient = inngestFactory.createInngestClient(this.logger);
118
+ }
119
+ return context;
120
+ }
121
+ createServiceBroker(type, nodeId, enableMetrics = true) {
122
+ const config = {
123
+ ...moleculer_config.default,
124
+ metrics: { enabled: enableMetrics },
125
+ ...(nodeId && { nodeID: nodeId }),
126
+ };
127
+ if (type === 'main') {
128
+ config.middlewares = [
129
+ moleculerInterNamespace.InterNamespaceMiddleware([
130
+ {
131
+ namespace: 'api-admin',
132
+ transporter: moleculer_config.default.transporter,
133
+ metrics: { enabled: false },
134
+ },
135
+ ]),
136
+ ];
137
+ }
138
+ return new moleculer.ServiceBroker(config);
139
+ }
140
+ getConnectionBroker() {
141
+ return this.connectionBroker;
142
+ }
143
+ async cleanup() {
144
+ if (this.connectionBroker) {
145
+ await this.connectionBroker.stop();
146
+ }
147
+ }
148
+ // Factory methods for common configurations
149
+ static createMainServiceConfig() {
150
+ return {
151
+ type: 'main',
152
+ connectorConfig: workflowOrchestrator.CONNECTOR_CONFIGS.FULL,
153
+ enableMetrics: true,
154
+ };
155
+ }
156
+ static createMicroserviceConfig(nodeId) {
157
+ return {
158
+ type: 'microservice',
159
+ nodeId: nodeId || `microservice-node-${Date.now()}`,
160
+ connectorConfig: workflowOrchestrator.CONNECTOR_CONFIGS.MICROSERVICE,
161
+ enableMetrics: false,
162
+ };
163
+ }
164
+ static createDevelopmentMicroserviceConfig() {
165
+ return {
166
+ type: 'microservice',
167
+ nodeId: 'node-broker-2',
168
+ connectorConfig: workflowOrchestrator.CONNECTOR_CONFIGS.DEVELOPMENT,
169
+ enableMetrics: false,
170
+ };
171
+ }
172
+ }exports.InfrastructureFactory=InfrastructureFactory;//# sourceMappingURL=infrastructure-factory.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"infrastructure-factory.cjs","sources":["../../src/infrastructure/infrastructure-factory.ts"],"sourcesContent":[null],"names":["ConnectionBroker","brokerConfig","WorkflowOrchestrator","createInfrastructureModule","ServerFeature","createInngestClient","InterNamespaceMiddleware","ServiceBroker","CONNECTOR_CONFIGS"],"mappings":"8cAoBa,qBAAqB,CAAA;AACtB,IAAA,MAAM,CAAoB;AAC1B,IAAA,gBAAgB,CAAmB;AACnC,IAAA,YAAY,CAAuB;AAE3C,IAAA,WAAA,CAAY,MAAyB,EAAA;AACjC,QAAA,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;KACxB;AAEM,IAAA,MAAM,UAAU,GAAA;AACnB,QAAA,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAC;AACxD,QAAA,IAAI,CAAC,gBAAgB,GAAG,IAAIA,iCAAgB,CAACC,wBAAY,CAAC,WAAW,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;KACvF;IAEM,MAAM,wBAAwB,CACjC,OAAoC,EACpC,aAA4B,EAC5B,QAAa,EACb,kBAAkC,EAAA;AAOlC,QAAA,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,eAAe,EAAE,aAAa,GAAG,IAAI,EAAE,SAAS,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC;;QAGxF,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,2BAA2B,CAAC,eAAe,CAAC,CAAC;;AAGxE,QAAA,MAAM,MAAM,GAAyB;AACjC,YAAA,UAAU,EAAE,eAAe;YAC3B,SAAS;AACT,YAAA,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,aAAa;SACrD,CAAC;QACF,IAAI,CAAC,YAAY,GAAG,IAAIC,yCAAoB,CAAC,MAAM,CAAC,CAAC;;AAGrD,QAAA,MAAM,MAAM,GA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AO,EAAE,KAAK,EAAE;AAC9B,qBAAA;iBACJ,CAAC;aACL,CAAC;SACL;AAED,QAAA,OAAO,IAAIM,uBAAa,CAAC,MAAM,CAAC,CAAC;KACpC;IAEM,mBAAmB,GAAA;QACtB,OAAO,IAAI,CAAC,gBAAgB,CAAC;KAChC;AAEM,IAAA,MAAM,OAAO,GAAA;AAChB,QAAA,IAAI,IAAI,CAAC,gBAAgB,EAAE;AACvB,YAAA,MAAM,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,CAAC;SACtC;KACJ;;AAGM,IAAA,OAAO,uBAAuB,GAAA;QACjC,OAAO;AACH,YAAA,IAAI,EAAE,MAAM;YACZ,eAAe,EAAEC,sCAAiB,CAAC,IAAI;AACvC,YAAA,aAAa,EAAE,IAAI;SACtB,CAAC;KACL;IAEM,OAAO,wBAAwB,CAAC,MAAe,EAAA;QAClD,OAAO;AACH,YAAA,IAAI,EAAE,cAAc;YACpB,MAAM,EAAE,MAAM,IAAI,CAAA,kBAAA,EAAqB,IAAI,CAAC,GAAG,EAAE,CAAE,CAAA;YACnD,eAAe,EAAEA,sCAAiB,CAAC,YAAY;AAC/C,YAAA,aAAa,EAAE,KAAK;SACvB,CAAC;KACL;AAEM,IAAA,OAAO,mCAAmC,GAAA;QAC7C,OAAO;AACH,YAAA,IAAI,EAAE,cAAc;AACpB,YAAA,MAAM,EAAE,eAAe;YACvB,eAAe,EAAEA,sCAAiB,CAAC,WAAW;AAC9C,YAAA,aAAa,EAAE,KAAK;SACvB,CAAC;KACL;AACJ"}
@@ -0,0 +1,36 @@
1
+ import { ServiceBroker } from 'moleculer';
2
+ import { Container } from 'inversify';
3
+ import { Feature as ServerFeature } from '@common-stack/server-core';
4
+ import { CdmLogger } from '@cdm-logger/core';
5
+ import { InfrastructureContext, ConnectorConfig, WorkflowStep } from './types';
6
+ import { ConnectionBroker } from '../connectors/connection-broker';
7
+ export interface BrokerInitializationOptions {
8
+ type: 'main' | 'microservice';
9
+ nodeId?: string;
10
+ connectorConfig: ConnectorConfig;
11
+ enableMetrics?: boolean;
12
+ workflows?: WorkflowStep[];
13
+ }
14
+ export declare class InfrastructureFactory {
15
+ private logger;
16
+ private connectionBroker;
17
+ private orchestrator;
18
+ constructor(logger: CdmLogger.ILogger);
19
+ initialize(): Promise<void>;
20
+ createBrokerAndContainer(options: BrokerInitializationOptions, serverFeature: ServerFeature, settings: any, existingAllModules?: ServerFeature): Promise<{
21
+ broker: ServiceBroker;
22
+ container: Container;
23
+ context: InfrastructureContext;
24
+ allModules: ServerFeature;
25
+ }>;
26
+ private loadAndComposeModules;
27
+ private createContainerFromModules;
28
+ private loadMoleculerServices;
29
+ private createInfrastructureContext;
30
+ private createServiceBroker;
31
+ getConnectionBroker(): ConnectionBroker;
32
+ cleanup(): Promise<void>;
33
+ static createMainServiceConfig(): BrokerInitializationOptions;
34
+ static createMicroserviceConfig(nodeId?: string): BrokerInitializationOptions;
35
+ static createDevelopmentMicroserviceConfig(): BrokerInitializationOptions;
36
+ }
@@ -0,0 +1,172 @@
1
+ import {ServiceBroker}from'moleculer';import {Feature}from'@common-stack/server-core';import {WorkflowOrchestrator,CONNECTOR_CONFIGS}from'./workflow-orchestrator.mjs';import {createInfrastructureModule}from'./container-module.mjs';import {createInngestClient}from'./inngest-factory.mjs';import {ConnectionBroker}from'../connectors/connection-broker.mjs';import brokerConfig from'../config/moleculer.config.mjs';import {InterNamespaceMiddleware}from'../middleware/moleculer-inter-namespace.mjs';class InfrastructureFactory {
2
+ logger;
3
+ connectionBroker;
4
+ orchestrator;
5
+ constructor(logger) {
6
+ this.logger = logger;
7
+ }
8
+ async initialize() {
9
+ this.logger.info('Initializing Infrastructure Factory');
10
+ this.connectionBroker = new ConnectionBroker(brokerConfig.transporter, this.logger);
11
+ }
12
+ async createBrokerAndContainer(options, serverFeature, settings, existingAllModules) {
13
+ const { type, nodeId, connectorConfig, enableMetrics = true, workflows = [] } = options;
14
+ // Step 1: Create infrastructure context
15
+ const context = await this.createInfrastructureContext(connectorConfig);
16
+ // Step 2: Create workflow orchestrator
17
+ const config = {
18
+ connectors: connectorConfig,
19
+ workflows,
20
+ environment: process.env.NODE_ENV || 'development',
21
+ };
22
+ this.orchestrator = new WorkflowOrchestrator(config);
23
+ // Step 3: Create service broker
24
+ const broker = this.createServiceBroker(type, nodeId, enableMetrics);
25
+ context.broker = broker;
26
+ // Step 4: Load and compose modules first (before any container creation)
27
+ const allModules = await this.loadAndComposeModules(serverFeature, context, connectorConfig, existingAllModules);
28
+ // Step 5: Create container based on module composition
29
+ const container = await this.createContainerFromModules(allModules, type, settings, context, existingAllModules);
30
+ // Step 6: Initialize services and load Moleculer services
31
+ if (!existingAllModules && container) {
32
+ // For completely new modules, create services and load moleculer services
33
+ await allModules.createService({ ...settings, mongoConnection: context.mongoClient });
34
+ this.loadMoleculerServices(allModules, broker, container, settings, type);
35
+ }
36
+ else if (existingAllModules && type === 'microservice' && container) {
37
+ // For microservices with existing modules, skip service creation but allow Moleculer service loading
38
+ // This enables microservices to register their Moleculer services with the hemera container
39
+ this.logger.info('Loading Moleculer services for microservice with existing modules');
40
+ this.loadMoleculerServices(allModules, broker, container, settings, type);
41
+ }
42
+ else {
43
+ this.logger.info('Skipping service creation and Moleculer service loading for existing modules to prevent duplicates');
44
+ }
45
+ return { broker, container: container || null, context, allModules };
46
+ }
47
+ async loadAndComposeModules(serverFeature, context, connectorConfig, existingAllModules) {
48
+ if (existingAllModules) {
49
+ // If we already have composed modules, reuse them completely
50
+ // This prevents duplicate infrastructure creation and ensures container reuse
51
+ // Do NOT create any new Feature instances or process serverFeature again
52
+ return existingAllModules;
53
+ }
54
+ // Create infrastructure module only once for new feature compositions
55
+ const infraModule = createInfrastructureModule(context, connectorConfig);
56
+ // Compose new feature with infrastructure and server features
57
+ return new Feature({
58
+ createContainerFunc: [(settings) => infraModule],
59
+ createMicroServiceContainerFunc: [(settings) => infraModule],
60
+ }, serverFeature);
61
+ }
62
+ async createContainerFromModules(allModules, type, settings, context, existingAllModules) {
63
+ const containerSettings = { ...settings, mongoConnection: context.mongoClient };
64
+ if (existingAllModules) {
65
+ // For existing modules with microservice type, we still need to create a hemera container
66
+ // This allows microservices to have their own container for Moleculer service bindings
67
+ // while reusing the main modules to avoid service duplication
68
+ if (type === 'microservice') {
69
+ this.logger.info('Creating hemera container for microservice while reusing existing modules');
70
+ return await allModules.createHemeraContainers(containerSettings);
71
+ }
72
+ else {
73
+ // For main service with existing modules, skip container creation entirely
74
+ this.logger.warn('Reusing existing modules - container already exists, skipping new container creation');
75
+ return null; // Signal that we're reusing existing infrastructure
76
+ }
77
+ }
78
+ // Create fresh container for new modules
79
+ if (type === 'main') {
80
+ return await allModules.createContainers(containerSettings);
81
+ }
82
+ else {
83
+ return await allModules.createHemeraContainers(containerSettings);
84
+ }
85
+ }
86
+ loadMoleculerServices(allModules, broker, container, settings, type) {
87
+ // Load moleculer services based on type
88
+ if (type === 'main') {
89
+ allModules.loadMainMoleculerService({
90
+ broker,
91
+ container,
92
+ settings,
93
+ });
94
+ }
95
+ else {
96
+ allModules.loadClientMoleculerService({
97
+ broker,
98
+ container,
99
+ settings,
100
+ });
101
+ }
102
+ }
103
+ async createInfrastructureContext(connectorConfig) {
104
+ const context = {
105
+ logger: this.logger,
106
+ };
107
+ if (connectorConfig.redis) {
108
+ context.redisClient = await this.connectionBroker.redisConnection;
109
+ }
110
+ if (connectorConfig.mongo) {
111
+ context.mongoClient = await this.connectionBroker.mongoConnection;
112
+ }
113
+ if (connectorConfig.pubsub) {
114
+ context.pubsub = await this.connectionBroker.graphqlPubsub;
115
+ }
116
+ if (connectorConfig.inngest) {
117
+ context.inngestClient = createInngestClient(this.logger);
118
+ }
119
+ return context;
120
+ }
121
+ createServiceBroker(type, nodeId, enableMetrics = true) {
122
+ const config = {
123
+ ...brokerConfig,
124
+ metrics: { enabled: enableMetrics },
125
+ ...(nodeId && { nodeID: nodeId }),
126
+ };
127
+ if (type === 'main') {
128
+ config.middlewares = [
129
+ InterNamespaceMiddleware([
130
+ {
131
+ namespace: 'api-admin',
132
+ transporter: brokerConfig.transporter,
133
+ metrics: { enabled: false },
134
+ },
135
+ ]),
136
+ ];
137
+ }
138
+ return new ServiceBroker(config);
139
+ }
140
+ getConnectionBroker() {
141
+ return this.connectionBroker;
142
+ }
143
+ async cleanup() {
144
+ if (this.connectionBroker) {
145
+ await this.connectionBroker.stop();
146
+ }
147
+ }
148
+ // Factory methods for common configurations
149
+ static createMainServiceConfig() {
150
+ return {
151
+ type: 'main',
152
+ connectorConfig: CONNECTOR_CONFIGS.FULL,
153
+ enableMetrics: true,
154
+ };
155
+ }
156
+ static createMicroserviceConfig(nodeId) {
157
+ return {
158
+ type: 'microservice',
159
+ nodeId: nodeId || `microservice-node-${Date.now()}`,
160
+ connectorConfig: CONNECTOR_CONFIGS.MICROSERVICE,
161
+ enableMetrics: false,
162
+ };
163
+ }
164
+ static createDevelopmentMicroserviceConfig() {
165
+ return {
166
+ type: 'microservice',
167
+ nodeId: 'node-broker-2',
168
+ connectorConfig: CONNECTOR_CONFIGS.DEVELOPMENT,
169
+ enableMetrics: false,
170
+ };
171
+ }
172
+ }export{InfrastructureFactory};//# sourceMappingURL=infrastructure-factory.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"infrastructure-factory.mjs","sources":["../../src/infrastructure/infrastructure-factory.ts"],"sourcesContent":[null],"names":["ServerFeature"],"mappings":"ofAoBa,qBAAqB,CAAA;AACtB,IAAA,MAAM,CAAoB;AAC1B,IAAA,gBAAgB,CAAmB;AACnC,IAAA,YAAY,CAAuB;AAE3C,IAAA,WAAA,CAAY,MAAyB,EAAA;AACjC,QAAA,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;KACxB;AAEM,IAAA,MAAM,UAAU,GAAA;AACnB,QAAA,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAC;AACxD,QAAA,IAAI,CAAC,gBAAgB,GAAG,IAAI,gBAAgB,CAAC,YAAY,CAAC,WAAW,E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