@contember/engine-http 2.1.0-alpha.3 → 2.1.0-alpha.30
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/dist/development/index.cjs +0 -4
- package/dist/development/index.cjs.map +1 -1
- package/dist/development/index.js +0 -4
- package/dist/development/index.js.map +1 -1
- package/dist/development/src/MasterContainer.cjs +27 -29
- package/dist/development/src/MasterContainer.cjs.map +1 -1
- package/dist/development/src/MasterContainer.js +27 -29
- package/dist/development/src/MasterContainer.js.map +1 -1
- package/dist/development/src/application/application.cjs +31 -13
- package/dist/development/src/application/application.cjs.map +1 -1
- package/dist/development/src/application/application.js +31 -13
- package/dist/development/src/application/application.js.map +1 -1
- package/dist/development/src/config/configSchema.cjs +5 -1
- package/dist/development/src/config/configSchema.cjs.map +1 -1
- package/dist/development/src/config/configSchema.js +5 -1
- package/dist/development/src/config/configSchema.js.map +1 -1
- package/dist/development/src/config/configTemplate.cjs +5 -1
- package/dist/development/src/config/configTemplate.cjs.map +1 -1
- package/dist/development/src/config/configTemplate.js +5 -1
- package/dist/development/src/config/configTemplate.js.map +1 -1
- package/dist/development/src/content/ContentApiControllerFactory.cjs +29 -12
- package/dist/development/src/content/ContentApiControllerFactory.cjs.map +1 -1
- package/dist/development/src/content/ContentApiControllerFactory.js +29 -12
- package/dist/development/src/content/ContentApiControllerFactory.js.map +1 -1
- package/dist/development/src/content/ContentQueryHandlerFactory.cjs.map +1 -1
- package/dist/development/src/content/ContentQueryHandlerFactory.js.map +1 -1
- package/dist/development/src/content/ProjectMembershipResolver.cjs +2 -2
- package/dist/development/src/content/ProjectMembershipResolver.cjs.map +1 -1
- package/dist/development/src/content/ProjectMembershipResolver.js +2 -2
- package/dist/development/src/content/ProjectMembershipResolver.js.map +1 -1
- package/dist/development/src/projectGroup/ProjectGroupContainer.cjs +1 -1
- package/dist/development/src/projectGroup/ProjectGroupContainer.js +1 -1
- package/dist/development/src/system/ContentQueryExecutor.cjs +6 -2
- package/dist/development/src/system/ContentQueryExecutor.cjs.map +1 -1
- package/dist/development/src/system/ContentQueryExecutor.js +6 -2
- package/dist/development/src/system/ContentQueryExecutor.js.map +1 -1
- package/dist/development/src/tenant/TenantApiMiddlewareFactory.cjs +13 -7
- package/dist/development/src/tenant/TenantApiMiddlewareFactory.cjs.map +1 -1
- package/dist/development/src/tenant/TenantApiMiddlewareFactory.js +13 -7
- package/dist/development/src/tenant/TenantApiMiddlewareFactory.js.map +1 -1
- package/dist/development/src/utils/remoteAddress.cjs +58 -0
- package/dist/development/src/utils/remoteAddress.cjs.map +1 -0
- package/dist/development/src/utils/remoteAddress.js +58 -0
- package/dist/development/src/utils/remoteAddress.js.map +1 -0
- package/dist/production/index.cjs +0 -4
- package/dist/production/index.cjs.map +1 -1
- package/dist/production/index.js +0 -4
- package/dist/production/index.js.map +1 -1
- package/dist/production/src/MasterContainer.cjs +27 -29
- package/dist/production/src/MasterContainer.cjs.map +1 -1
- package/dist/production/src/MasterContainer.js +27 -29
- package/dist/production/src/MasterContainer.js.map +1 -1
- package/dist/production/src/application/application.cjs +31 -13
- package/dist/production/src/application/application.cjs.map +1 -1
- package/dist/production/src/application/application.js +31 -13
- package/dist/production/src/application/application.js.map +1 -1
- package/dist/production/src/config/configSchema.cjs +5 -1
- package/dist/production/src/config/configSchema.cjs.map +1 -1
- package/dist/production/src/config/configSchema.js +5 -1
- package/dist/production/src/config/configSchema.js.map +1 -1
- package/dist/production/src/config/configTemplate.cjs +5 -1
- package/dist/production/src/config/configTemplate.cjs.map +1 -1
- package/dist/production/src/config/configTemplate.js +5 -1
- package/dist/production/src/config/configTemplate.js.map +1 -1
- package/dist/production/src/content/ContentApiControllerFactory.cjs +29 -12
- package/dist/production/src/content/ContentApiControllerFactory.cjs.map +1 -1
- package/dist/production/src/content/ContentApiControllerFactory.js +29 -12
- package/dist/production/src/content/ContentApiControllerFactory.js.map +1 -1
- package/dist/production/src/content/ContentQueryHandlerFactory.cjs.map +1 -1
- package/dist/production/src/content/ContentQueryHandlerFactory.js.map +1 -1
- package/dist/production/src/content/ProjectMembershipResolver.cjs +2 -2
- package/dist/production/src/content/ProjectMembershipResolver.cjs.map +1 -1
- package/dist/production/src/content/ProjectMembershipResolver.js +2 -2
- package/dist/production/src/content/ProjectMembershipResolver.js.map +1 -1
- package/dist/production/src/projectGroup/ProjectGroupContainer.cjs +1 -1
- package/dist/production/src/projectGroup/ProjectGroupContainer.js +1 -1
- package/dist/production/src/system/ContentQueryExecutor.cjs +6 -2
- package/dist/production/src/system/ContentQueryExecutor.cjs.map +1 -1
- package/dist/production/src/system/ContentQueryExecutor.js +6 -2
- package/dist/production/src/system/ContentQueryExecutor.js.map +1 -1
- package/dist/production/src/tenant/TenantApiMiddlewareFactory.cjs +13 -7
- package/dist/production/src/tenant/TenantApiMiddlewareFactory.cjs.map +1 -1
- package/dist/production/src/tenant/TenantApiMiddlewareFactory.js +13 -7
- package/dist/production/src/tenant/TenantApiMiddlewareFactory.js.map +1 -1
- package/dist/production/src/utils/remoteAddress.cjs +58 -0
- package/dist/production/src/utils/remoteAddress.cjs.map +1 -0
- package/dist/production/src/utils/remoteAddress.js +58 -0
- package/dist/production/src/utils/remoteAddress.js.map +1 -0
- package/dist/tests/tsconfig.tsbuildinfo +1 -1
- package/dist/types/MasterContainer.d.ts +22 -22
- package/dist/types/MasterContainer.d.ts.map +1 -1
- package/dist/types/application/application.d.ts +1 -0
- package/dist/types/application/application.d.ts.map +1 -1
- package/dist/types/config/configSchema.d.ts +18 -0
- package/dist/types/config/configSchema.d.ts.map +1 -1
- package/dist/types/config/configTemplate.d.ts.map +1 -1
- package/dist/types/content/ContentApiControllerFactory.d.ts +4 -4
- package/dist/types/content/ContentApiControllerFactory.d.ts.map +1 -1
- package/dist/types/content/ContentGraphqlContext.d.ts +9 -0
- package/dist/types/content/ContentGraphqlContext.d.ts.map +1 -0
- package/dist/types/content/ContentQueryHandlerFactory.d.ts +2 -2
- package/dist/types/content/ContentQueryHandlerFactory.d.ts.map +1 -1
- package/dist/types/content/index.d.ts +0 -1
- package/dist/types/content/index.d.ts.map +1 -1
- package/dist/types/system/ContentQueryExecutor.d.ts +1 -1
- package/dist/types/system/ContentQueryExecutor.d.ts.map +1 -1
- package/dist/types/tenant/TenantApiMiddlewareFactory.d.ts +0 -6
- package/dist/types/tenant/TenantApiMiddlewareFactory.d.ts.map +1 -1
- package/dist/types/tenant/index.d.ts +0 -1
- package/dist/types/tenant/index.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/dist/types/utils/remoteAddress.d.ts +3 -0
- package/dist/types/utils/remoteAddress.d.ts.map +1 -0
- package/package.json +16 -15
- package/src/MasterContainer.ts +33 -36
- package/src/application/application.ts +32 -13
- package/src/config/configSchema.ts +4 -0
- package/src/config/configTemplate.ts +4 -0
- package/src/content/ContentApiControllerFactory.ts +37 -15
- package/src/content/ContentGraphqlContext.ts +7 -0
- package/src/content/ContentQueryHandlerFactory.ts +4 -4
- package/src/content/ProjectMembershipResolver.ts +2 -2
- package/src/content/index.ts +0 -1
- package/src/system/ContentQueryExecutor.ts +8 -4
- package/src/tenant/TenantApiMiddlewareFactory.ts +15 -10
- package/src/tenant/index.ts +0 -1
- package/src/utils/remoteAddress.ts +70 -0
- package/dist/development/src/content/ContentGraphQLContextFactory.cjs +0 -39
- package/dist/development/src/content/ContentGraphQLContextFactory.cjs.map +0 -1
- package/dist/development/src/content/ContentGraphQLContextFactory.js +0 -39
- package/dist/development/src/content/ContentGraphQLContextFactory.js.map +0 -1
- package/dist/development/src/tenant/TenantGraphQLContextFactory.cjs +0 -19
- package/dist/development/src/tenant/TenantGraphQLContextFactory.cjs.map +0 -1
- package/dist/development/src/tenant/TenantGraphQLContextFactory.js +0 -19
- package/dist/development/src/tenant/TenantGraphQLContextFactory.js.map +0 -1
- package/dist/production/src/content/ContentGraphQLContextFactory.cjs +0 -39
- package/dist/production/src/content/ContentGraphQLContextFactory.cjs.map +0 -1
- package/dist/production/src/content/ContentGraphQLContextFactory.js +0 -39
- package/dist/production/src/content/ContentGraphQLContextFactory.js.map +0 -1
- package/dist/production/src/tenant/TenantGraphQLContextFactory.cjs +0 -19
- package/dist/production/src/tenant/TenantGraphQLContextFactory.cjs.map +0 -1
- package/dist/production/src/tenant/TenantGraphQLContextFactory.js +0 -19
- package/dist/production/src/tenant/TenantGraphQLContextFactory.js.map +0 -1
- package/dist/types/content/ContentGraphQLContextFactory.d.ts +0 -38
- package/dist/types/content/ContentGraphQLContextFactory.d.ts.map +0 -1
- package/dist/types/tenant/TenantGraphQLContextFactory.d.ts +0 -12
- package/dist/types/tenant/TenantGraphQLContextFactory.d.ts.map +0 -1
- package/src/content/ContentGraphQLContextFactory.ts +0 -70
- package/src/tenant/TenantGraphQLContextFactory.ts +0 -24
|
@@ -8,7 +8,6 @@ const Authorizator = require("./src/common/Authorizator.cjs");
|
|
|
8
8
|
const HttpResponse = require("./src/common/HttpResponse.cjs");
|
|
9
9
|
const ModuleInfoMiddleware = require("./src/common/ModuleInfoMiddleware.cjs");
|
|
10
10
|
const ContentApiControllerFactory = require("./src/content/ContentApiControllerFactory.cjs");
|
|
11
|
-
const ContentGraphQLContextFactory = require("./src/content/ContentGraphQLContextFactory.cjs");
|
|
12
11
|
const ContentQueryHandlerFactory = require("./src/content/ContentQueryHandlerFactory.cjs");
|
|
13
12
|
const ContentSchemaResolver = require("./src/content/ContentSchemaResolver.cjs");
|
|
14
13
|
const GraphQlSchemaFactory = require("./src/content/GraphQlSchemaFactory.cjs");
|
|
@@ -22,7 +21,6 @@ const SystemGraphQLContextFactory = require("./src/system/SystemGraphQLContextFa
|
|
|
22
21
|
const SystemGraphQLHandlerFactory = require("./src/system/SystemGraphQLHandlerFactory.cjs");
|
|
23
22
|
const TenantApiMiddlewareFactory = require("./src/tenant/TenantApiMiddlewareFactory.cjs");
|
|
24
23
|
const TenantGraphQLHandlerFactory = require("./src/tenant/TenantGraphQLHandlerFactory.cjs");
|
|
25
|
-
const TenantGraphQLContextFactory = require("./src/tenant/TenantGraphQLContextFactory.cjs");
|
|
26
24
|
const ImportApiMiddlewareFactory = require("./src/transfer/ImportApiMiddlewareFactory.cjs");
|
|
27
25
|
const ExportApiControllerFactory = require("./src/transfer/ExportApiControllerFactory.cjs");
|
|
28
26
|
const ImportExecutor = require("./src/transfer/ImportExecutor.cjs");
|
|
@@ -55,7 +53,6 @@ exports.HttpErrorResponse = HttpResponse.HttpErrorResponse;
|
|
|
55
53
|
exports.HttpResponse = HttpResponse.HttpResponse;
|
|
56
54
|
exports.createModuleInfoMiddleware = ModuleInfoMiddleware.createModuleInfoMiddleware;
|
|
57
55
|
exports.ContentApiControllerFactory = ContentApiControllerFactory.ContentApiControllerFactory;
|
|
58
|
-
exports.ContentGraphQLContextFactory = ContentGraphQLContextFactory.ContentGraphQLContextFactory;
|
|
59
56
|
exports.ContentQueryHandlerFactory = ContentQueryHandlerFactory.ContentQueryHandlerFactory;
|
|
60
57
|
exports.ContentSchemaResolver = ContentSchemaResolver.ContentSchemaResolver;
|
|
61
58
|
exports.GraphQlSchemaFactory = GraphQlSchemaFactory.GraphQlSchemaFactory;
|
|
@@ -69,7 +66,6 @@ exports.SystemGraphQLContextFactory = SystemGraphQLContextFactory.SystemGraphQLC
|
|
|
69
66
|
exports.SystemGraphQLHandlerFactory = SystemGraphQLHandlerFactory.SystemGraphQLHandlerFactory;
|
|
70
67
|
exports.TenantApiMiddlewareFactory = TenantApiMiddlewareFactory.TenantApiMiddlewareFactory;
|
|
71
68
|
exports.TenantGraphQLHandlerFactory = TenantGraphQLHandlerFactory.TenantGraphQLHandlerFactory;
|
|
72
|
-
exports.TenantGraphQLContextFactory = TenantGraphQLContextFactory.TenantGraphQLContextFactory;
|
|
73
69
|
exports.ImportApiMiddlewareFactory = ImportApiMiddlewareFactory.ImportApiMiddlewareFactory;
|
|
74
70
|
exports.ExportApiControllerFactory = ExportApiControllerFactory.ExportApiControllerFactory;
|
|
75
71
|
exports.ImportError = ImportExecutor.ImportError;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../packages/engine-http/src/index.ts"],"sourcesContent":["import { MasterContainerArgs, MasterContainerFactory } from './MasterContainer'\nimport Koa from 'koa'\n\nexport * from './config/config'\nexport * from './config/ConfigProcessor'\nexport * from './config/tenantConfigResolver'\nexport * from './common'\nexport * from './content'\nexport * from './plugin/Plugin'\nexport * from './misc'\nexport * from './project-common'\nexport * from './system'\nexport * from './tenant'\nexport * from './transfer'\nexport * from './application'\nexport * from './providers'\nexport * from './graphql'\nexport * from './project/config'\nexport * from './utils/CryptoWrapper'\nexport * from './project/ProjectContainer'\nexport * from './project/ProjectContainerResolver'\nexport * from './projectGroup/ProjectGroupContainer'\nexport * from './projectGroup/ProjectGroupResolver'\nexport { type ProjectGroupContainerResolver } from './projectGroup/ProjectGroupContainerResolver'\n\nexport * from './utils/serverStartup'\nexport * from './utils/serverTermination'\nexport * from './utils/sentry'\nexport * from './MasterContainer'\nexport { serverConfigSchema } from './config/configSchema'\n\nexport const createContainer = (args: MasterContainerArgs) => {\n\treturn new MasterContainerFactory().create(args)\n}\n\nexport { Koa }\n"],"names":["MasterContainerFactory"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../packages/engine-http/src/index.ts"],"sourcesContent":["import { MasterContainerArgs, MasterContainerFactory } from './MasterContainer'\nimport Koa from 'koa'\n\nexport * from './config/config'\nexport * from './config/ConfigProcessor'\nexport * from './config/tenantConfigResolver'\nexport * from './common'\nexport * from './content'\nexport * from './plugin/Plugin'\nexport * from './misc'\nexport * from './project-common'\nexport * from './system'\nexport * from './tenant'\nexport * from './transfer'\nexport * from './application'\nexport * from './providers'\nexport * from './graphql'\nexport * from './project/config'\nexport * from './utils/CryptoWrapper'\nexport * from './project/ProjectContainer'\nexport * from './project/ProjectContainerResolver'\nexport * from './projectGroup/ProjectGroupContainer'\nexport * from './projectGroup/ProjectGroupResolver'\nexport { type ProjectGroupContainerResolver } from './projectGroup/ProjectGroupContainerResolver'\n\nexport * from './utils/serverStartup'\nexport * from './utils/serverTermination'\nexport * from './utils/sentry'\nexport * from './MasterContainer'\nexport { serverConfigSchema } from './config/configSchema'\n\nexport const createContainer = (args: MasterContainerArgs) => {\n\treturn new MasterContainerFactory().create(args)\n}\n\nexport { Koa }\n"],"names":["MasterContainerFactory"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+Ba,MAAA,kBAAkB,CAAC,SAA8B;AAC7D,SAAO,IAAIA,gBAAA,uBAAA,EAAyB,OAAO,IAAI;AAChD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -6,7 +6,6 @@ import { Authenticator } from "./src/common/Authorizator.js";
|
|
|
6
6
|
import { HttpErrorResponse, HttpResponse } from "./src/common/HttpResponse.js";
|
|
7
7
|
import { createModuleInfoMiddleware } from "./src/common/ModuleInfoMiddleware.js";
|
|
8
8
|
import { ContentApiControllerFactory } from "./src/content/ContentApiControllerFactory.js";
|
|
9
|
-
import { ContentGraphQLContextFactory } from "./src/content/ContentGraphQLContextFactory.js";
|
|
10
9
|
import { ContentQueryHandlerFactory } from "./src/content/ContentQueryHandlerFactory.js";
|
|
11
10
|
import { ContentSchemaResolver } from "./src/content/ContentSchemaResolver.js";
|
|
12
11
|
import { GraphQlSchemaFactory } from "./src/content/GraphQlSchemaFactory.js";
|
|
@@ -20,7 +19,6 @@ import { SystemGraphQLContextFactory } from "./src/system/SystemGraphQLContextFa
|
|
|
20
19
|
import { SystemGraphQLHandlerFactory } from "./src/system/SystemGraphQLHandlerFactory.js";
|
|
21
20
|
import { TenantApiMiddlewareFactory } from "./src/tenant/TenantApiMiddlewareFactory.js";
|
|
22
21
|
import { TenantGraphQLHandlerFactory } from "./src/tenant/TenantGraphQLHandlerFactory.js";
|
|
23
|
-
import { TenantGraphQLContextFactory } from "./src/tenant/TenantGraphQLContextFactory.js";
|
|
24
22
|
import { ImportApiMiddlewareFactory } from "./src/transfer/ImportApiMiddlewareFactory.js";
|
|
25
23
|
import { ExportApiControllerFactory } from "./src/transfer/ExportApiControllerFactory.js";
|
|
26
24
|
import { ImportError, ImportExecutor } from "./src/transfer/ImportExecutor.js";
|
|
@@ -47,7 +45,6 @@ export {
|
|
|
47
45
|
Application,
|
|
48
46
|
Authenticator,
|
|
49
47
|
ContentApiControllerFactory,
|
|
50
|
-
ContentGraphQLContextFactory,
|
|
51
48
|
ContentQueryHandlerFactory,
|
|
52
49
|
ContentSchemaResolver,
|
|
53
50
|
ContentSchemaTransferMappingFactory,
|
|
@@ -79,7 +76,6 @@ export {
|
|
|
79
76
|
SystemGraphQLHandlerFactory,
|
|
80
77
|
SystemSchemaTransferMappingFactory,
|
|
81
78
|
TenantApiMiddlewareFactory,
|
|
82
|
-
TenantGraphQLContextFactory,
|
|
83
79
|
TenantGraphQLHandlerFactory,
|
|
84
80
|
createContainer,
|
|
85
81
|
createDbQueriesListener,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../packages/engine-http/src/index.ts"],"sourcesContent":["import { MasterContainerArgs, MasterContainerFactory } from './MasterContainer'\nimport Koa from 'koa'\n\nexport * from './config/config'\nexport * from './config/ConfigProcessor'\nexport * from './config/tenantConfigResolver'\nexport * from './common'\nexport * from './content'\nexport * from './plugin/Plugin'\nexport * from './misc'\nexport * from './project-common'\nexport * from './system'\nexport * from './tenant'\nexport * from './transfer'\nexport * from './application'\nexport * from './providers'\nexport * from './graphql'\nexport * from './project/config'\nexport * from './utils/CryptoWrapper'\nexport * from './project/ProjectContainer'\nexport * from './project/ProjectContainerResolver'\nexport * from './projectGroup/ProjectGroupContainer'\nexport * from './projectGroup/ProjectGroupResolver'\nexport { type ProjectGroupContainerResolver } from './projectGroup/ProjectGroupContainerResolver'\n\nexport * from './utils/serverStartup'\nexport * from './utils/serverTermination'\nexport * from './utils/sentry'\nexport * from './MasterContainer'\nexport { serverConfigSchema } from './config/configSchema'\n\nexport const createContainer = (args: MasterContainerArgs) => {\n\treturn new MasterContainerFactory().create(args)\n}\n\nexport { Koa }\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../packages/engine-http/src/index.ts"],"sourcesContent":["import { MasterContainerArgs, MasterContainerFactory } from './MasterContainer'\nimport Koa from 'koa'\n\nexport * from './config/config'\nexport * from './config/ConfigProcessor'\nexport * from './config/tenantConfigResolver'\nexport * from './common'\nexport * from './content'\nexport * from './plugin/Plugin'\nexport * from './misc'\nexport * from './project-common'\nexport * from './system'\nexport * from './tenant'\nexport * from './transfer'\nexport * from './application'\nexport * from './providers'\nexport * from './graphql'\nexport * from './project/config'\nexport * from './utils/CryptoWrapper'\nexport * from './project/ProjectContainer'\nexport * from './project/ProjectContainerResolver'\nexport * from './projectGroup/ProjectGroupContainer'\nexport * from './projectGroup/ProjectGroupResolver'\nexport { type ProjectGroupContainerResolver } from './projectGroup/ProjectGroupContainerResolver'\n\nexport * from './utils/serverStartup'\nexport * from './utils/serverTermination'\nexport * from './utils/sentry'\nexport * from './MasterContainer'\nexport { serverConfigSchema } from './config/configSchema'\n\nexport const createContainer = (args: MasterContainerArgs) => {\n\treturn new MasterContainerFactory().create(args)\n}\n\nexport { Koa }\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+Ba,MAAA,kBAAkB,CAAC,SAA8B;AAC7D,SAAO,IAAI,uBAAA,EAAyB,OAAO,IAAI;AAChD;"}
|
|
@@ -1,51 +1,49 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const dic = require("@contember/dic");
|
|
3
4
|
const engineSystemApi = require("@contember/engine-system-api");
|
|
4
5
|
const engineTenantApi = require("@contember/engine-tenant-api");
|
|
5
|
-
const dic = require("@contember/dic");
|
|
6
6
|
const schemaMigrations = require("@contember/schema-migrations");
|
|
7
7
|
const Initializer = require("./bootstrap/Initializer.cjs");
|
|
8
|
-
const
|
|
9
|
-
require("@contember/engine-common");
|
|
10
|
-
const ProjectGroupContainer = require("./projectGroup/ProjectGroupContainer.cjs");
|
|
11
|
-
const ProjectGroupResolver = require("./projectGroup/ProjectGroupResolver.cjs");
|
|
8
|
+
const Database = require("@contember/database");
|
|
12
9
|
const engineContentApi = require("@contember/engine-content-api");
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const SystemApiMiddlewareFactory = require("./system/SystemApiMiddlewareFactory.cjs");
|
|
18
|
-
const SystemGraphQLContextFactory = require("./system/SystemGraphQLContextFactory.cjs");
|
|
19
|
-
const SystemGraphQLHandlerFactory = require("./system/SystemGraphQLHandlerFactory.cjs");
|
|
10
|
+
const Koa = require("koa");
|
|
11
|
+
const crypto = require("node:crypto");
|
|
12
|
+
const application = require("./application/application.cjs");
|
|
13
|
+
const HttpResponse = require("./common/HttpResponse.cjs");
|
|
20
14
|
const ContentApiControllerFactory = require("./content/ContentApiControllerFactory.cjs");
|
|
21
|
-
const ContentGraphQLContextFactory = require("./content/ContentGraphQLContextFactory.cjs");
|
|
22
15
|
const ContentQueryHandlerFactory = require("./content/ContentQueryHandlerFactory.cjs");
|
|
23
16
|
require("./content/ContentSchemaResolver.cjs");
|
|
24
17
|
const GraphQlSchemaFactory = require("./content/GraphQlSchemaFactory.cjs");
|
|
25
18
|
const NotModifiedChecker = require("./content/NotModifiedChecker.cjs");
|
|
26
19
|
require("./content/ProjectMembershipResolver.cjs");
|
|
20
|
+
const ContentApiSpecificCache = require("./content/ContentApiSpecificCache.cjs");
|
|
21
|
+
const HomepageMiddlewareFactory = require("./misc/HomepageMiddlewareFactory.cjs");
|
|
22
|
+
const ProjectContainer = require("./project/ProjectContainer.cjs");
|
|
23
|
+
require("@contember/engine-common");
|
|
27
24
|
const ProjectContextResolver = require("./project-common/ProjectContextResolver.cjs");
|
|
25
|
+
const ProjectGroupContainer = require("./projectGroup/ProjectGroupContainer.cjs");
|
|
26
|
+
const ProjectGroupContainerResolver = require("./projectGroup/ProjectGroupContainerResolver.cjs");
|
|
27
|
+
const ProjectGroupResolver = require("./projectGroup/ProjectGroupResolver.cjs");
|
|
28
|
+
const CollectHttpMetricsMiddelware = require("./prometheus/CollectHttpMetricsMiddelware.cjs");
|
|
29
|
+
const ShowMetricsMiddleware = require("./prometheus/ShowMetricsMiddleware.cjs");
|
|
30
|
+
const ProjectGroupContainerMetricsHook = require("./prometheus/ProjectGroupContainerMetricsHook.cjs");
|
|
31
|
+
const PrometheusRegistryFactory = require("./prometheus/PrometheusRegistryFactory.cjs");
|
|
32
|
+
const providers = require("./providers.cjs");
|
|
33
|
+
const SystemApiMiddlewareFactory = require("./system/SystemApiMiddlewareFactory.cjs");
|
|
34
|
+
const SystemGraphQLContextFactory = require("./system/SystemGraphQLContextFactory.cjs");
|
|
35
|
+
const SystemGraphQLHandlerFactory = require("./system/SystemGraphQLHandlerFactory.cjs");
|
|
36
|
+
const ContentQueryExecutor = require("./system/ContentQueryExecutor.cjs");
|
|
37
|
+
const TenantApiMiddlewareFactory = require("./tenant/TenantApiMiddlewareFactory.cjs");
|
|
38
|
+
const TenantGraphQLHandlerFactory = require("./tenant/TenantGraphQLHandlerFactory.cjs");
|
|
28
39
|
const ImportApiMiddlewareFactory = require("./transfer/ImportApiMiddlewareFactory.cjs");
|
|
29
40
|
const ExportApiControllerFactory = require("./transfer/ExportApiControllerFactory.cjs");
|
|
30
41
|
const ImportExecutor = require("./transfer/ImportExecutor.cjs");
|
|
31
42
|
const ExportExecutor = require("./transfer/ExportExecutor.cjs");
|
|
32
43
|
const ContentSchemaTransferMappingFactory = require("./transfer/ContentSchemaTransferMappingFactory.cjs");
|
|
33
44
|
const SystemSchemaTransferMappingFactory = require("./transfer/SystemSchemaTransferMappingFactory.cjs");
|
|
34
|
-
const HomepageMiddlewareFactory = require("./misc/HomepageMiddlewareFactory.cjs");
|
|
35
|
-
const application = require("./application/application.cjs");
|
|
36
|
-
const ApplicationWorkerManager = require("./workers/ApplicationWorkerManager.cjs");
|
|
37
|
-
const HttpResponse = require("./common/HttpResponse.cjs");
|
|
38
|
-
const ContentQueryExecutor = require("./system/ContentQueryExecutor.cjs");
|
|
39
|
-
const Database = require("@contember/database");
|
|
40
|
-
const Koa = require("koa");
|
|
41
|
-
const ProjectGroupContainerResolver = require("./projectGroup/ProjectGroupContainerResolver.cjs");
|
|
42
|
-
const PrometheusRegistryFactory = require("./prometheus/PrometheusRegistryFactory.cjs");
|
|
43
|
-
const ProjectGroupContainerMetricsHook = require("./prometheus/ProjectGroupContainerMetricsHook.cjs");
|
|
44
|
-
const CollectHttpMetricsMiddelware = require("./prometheus/CollectHttpMetricsMiddelware.cjs");
|
|
45
|
-
const ShowMetricsMiddleware = require("./prometheus/ShowMetricsMiddleware.cjs");
|
|
46
|
-
const crypto = require("node:crypto");
|
|
47
45
|
const CryptoWrapper = require("./utils/CryptoWrapper.cjs");
|
|
48
|
-
const
|
|
46
|
+
const ApplicationWorkerManager = require("./workers/ApplicationWorkerManager.cjs");
|
|
49
47
|
class MasterContainerFactory {
|
|
50
48
|
createBuilder(args) {
|
|
51
49
|
const builder = this.createBuilderInternal(args);
|
|
@@ -62,7 +60,7 @@ class MasterContainerFactory {
|
|
|
62
60
|
logger,
|
|
63
61
|
processType
|
|
64
62
|
}) {
|
|
65
|
-
return new dic.Builder({}).addService("serverConfig", () => serverConfig).addService("debugMode", () => debugMode).addService("version", () => version).addService("processType", () => processType).addService("projectConfigResolver", () => projectConfigResolver).addService("tenantConfigResolver", () => tenantConfigResolver).addService("plugins", () => plugins).addService("providers", () => providers.createProviders()).addService("tenantContainerFactory", ({ providers: providers2 }) => new engineTenantApi.TenantContainerFactory(providers2)).addService("modificationHandlerFactory", () => new schemaMigrations.ModificationHandlerFactory(schemaMigrations.ModificationHandlerFactory.defaultFactoryMap)).addService("executionContainerFactory", ({ providers: providers2 }) => new engineContentApi.ExecutionContainerFactory(providers2)).addService("graphQlSchemaBuilderFactory", () => new engineContentApi.GraphQlSchemaBuilderFactory()).addService("contentQueryExecutor", ({ executionContainerFactory, graphQlSchemaBuilderFactory }) => new ContentQueryExecutor.ContentQueryExecutorImpl(executionContainerFactory, graphQlSchemaBuilderFactory)).addService("systemContainerFactory", ({ providers: providers2, modificationHandlerFactory, contentQueryExecutor }) => new engineSystemApi.SystemContainerFactory(providers2, modificationHandlerFactory, contentQueryExecutor)).addService("contentPermissionFactory", ({}) => new engineContentApi.PermissionFactory()).addService("databaseMetadataResolver", () => new Database.DatabaseMetadataResolver()).addService("graphqlSchemaCache", ({ serverConfig: serverConfig2 }) => new ContentApiSpecificCache.ContentApiSpecificCache({
|
|
63
|
+
return new dic.Builder({}).addService("serverConfig", () => serverConfig).addService("debugMode", () => debugMode).addService("version", () => version).addService("processType", () => processType).addService("projectConfigResolver", () => projectConfigResolver).addService("tenantConfigResolver", () => tenantConfigResolver).addService("plugins", () => plugins).addService("providers", () => providers.createProviders()).addService("tenantContainerFactory", ({ providers: providers2 }) => new engineTenantApi.TenantContainerFactory(providers2)).addService("modificationHandlerFactory", () => new schemaMigrations.ModificationHandlerFactory(schemaMigrations.ModificationHandlerFactory.defaultFactoryMap)).addService("executionContainerFactory", ({ providers: providers2, serverConfig: serverConfig2 }) => new engineContentApi.ExecutionContainerFactory(providers2, serverConfig2.contentApi?.whereOptimizer)).addService("graphQlSchemaBuilderFactory", () => new engineContentApi.GraphQlSchemaBuilderFactory()).addService("contentQueryExecutor", ({ executionContainerFactory, graphQlSchemaBuilderFactory }) => new ContentQueryExecutor.ContentQueryExecutorImpl(executionContainerFactory, graphQlSchemaBuilderFactory)).addService("systemContainerFactory", ({ providers: providers2, modificationHandlerFactory, contentQueryExecutor }) => new engineSystemApi.SystemContainerFactory(providers2, modificationHandlerFactory, contentQueryExecutor)).addService("contentPermissionFactory", ({}) => new engineContentApi.PermissionFactory()).addService("databaseMetadataResolver", () => new Database.DatabaseMetadataResolver()).addService("graphqlSchemaCache", ({ serverConfig: serverConfig2 }) => new ContentApiSpecificCache.ContentApiSpecificCache({
|
|
66
64
|
ttlSeconds: serverConfig2.contentApi?.schemaCacheTtlSeconds
|
|
67
65
|
})).addService("graphQlSchemaFactory", ({ plugins: plugins2, providers: providers2, graphqlSchemaCache, contentPermissionFactory, graphQlSchemaBuilderFactory }) => {
|
|
68
66
|
const contributors = plugins2.map((it) => it.getSchemaContributor ? it.getSchemaContributor({ providers: providers2 }) : null).filter((it) => !!it);
|
|
@@ -84,7 +82,7 @@ class MasterContainerFactory {
|
|
|
84
82
|
serverConfig2.projectGroup?.configEncryptionKey ? new CryptoWrapper.CryptoWrapper(encryptionKey) : void 0,
|
|
85
83
|
projectGroupContainerResolver
|
|
86
84
|
);
|
|
87
|
-
}).addService("notModifiedChecker", () => new NotModifiedChecker.NotModifiedChecker()).addService("
|
|
85
|
+
}).addService("notModifiedChecker", () => new NotModifiedChecker.NotModifiedChecker()).addService("contentQueryHandlerFactory", ({ debugMode: debugMode2 }) => new ContentQueryHandlerFactory.ContentQueryHandlerFactory(debugMode2)).addService("projectContextResolver", () => new ProjectContextResolver.ProjectContextResolver()).addService("contentApiMiddlewareFactory", ({ projectContextResolver, notModifiedChecker, executionContainerFactory, contentQueryHandlerFactory, graphQlSchemaFactory }) => new ContentApiControllerFactory.ContentApiControllerFactory(notModifiedChecker, executionContainerFactory, contentQueryHandlerFactory, projectContextResolver, graphQlSchemaFactory)).addService("tenantApiMiddlewareFactory", () => new TenantApiMiddlewareFactory.TenantApiMiddlewareFactory()).addService("systemGraphQLContextFactory", () => new SystemGraphQLContextFactory.SystemGraphQLContextFactory()).addService("systemApiMiddlewareFactory", ({ debugMode: debugMode2, systemGraphQLContextFactory, projectContextResolver }) => new SystemApiMiddlewareFactory.SystemApiMiddlewareFactory(debugMode2, systemGraphQLContextFactory, projectContextResolver)).addService("contentSchemaTransferMappingFactory", () => new ContentSchemaTransferMappingFactory.ContentSchemaTransferMappingFactory()).addService("systemSchemaTransferMappingFactory", () => new SystemSchemaTransferMappingFactory.SystemSchemaTransferMappingFactory()).addService("importExecutor", ({ contentSchemaTransferMappingFactory, systemSchemaTransferMappingFactory, databaseMetadataResolver }) => new ImportExecutor.ImportExecutor(contentSchemaTransferMappingFactory, systemSchemaTransferMappingFactory, databaseMetadataResolver)).addService("exportExecutor", ({ contentSchemaTransferMappingFactory, systemSchemaTransferMappingFactory }) => new ExportExecutor.ExportExecutor(contentSchemaTransferMappingFactory, systemSchemaTransferMappingFactory)).addService("importApiMiddlewareFactory", ({ projectGroupResolver, importExecutor }) => new ImportApiMiddlewareFactory.ImportApiMiddlewareFactory(projectGroupResolver, importExecutor)).addService("exportApiMiddlewareFactory", ({ projectGroupResolver, exportExecutor }) => new ExportApiControllerFactory.ExportApiControllerFactory(projectGroupResolver, exportExecutor)).addService("application", ({ projectGroupResolver, serverConfig: serverConfig2, logger: logger2, debugMode: debugMode2, version: version2, promRegistry }) => {
|
|
88
86
|
const app = new application.Application(
|
|
89
87
|
projectGroupResolver,
|
|
90
88
|
serverConfig2,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MasterContainer.cjs","sources":["../../../../packages/engine-http/src/MasterContainer.ts"],"sourcesContent":["import { SystemContainerFactory } from '@contember/engine-system-api'\nimport { TenantContainerFactory } from '@contember/engine-tenant-api'\nimport { Builder } from '@contember/dic'\nimport { ServerConfig } from './config/config'\nimport { ModificationHandlerFactory } from '@contember/schema-migrations'\nimport { Initializer } from './bootstrap'\n\nimport { ProjectContainerFactoryFactory } from './project'\nimport { ProjectConfigResolver } from './config/projectConfigResolver'\nimport { TenantConfigResolver } from './config/tenantConfigResolver'\nimport { ProjectGroupContainerFactory } from './projectGroup/ProjectGroupContainer'\nimport { ProjectGroupResolver } from './projectGroup/ProjectGroupResolver'\nimport { Logger } from '@contember/logger'\nimport { ExecutionContainerFactory, GraphQlSchemaBuilderFactory, PermissionFactory } from '@contember/engine-content-api'\nimport { createProviders, Providers } from './providers'\nimport { TenantApiMiddlewareFactory, TenantGraphQLContextFactory, TenantGraphQLHandlerFactory } from './tenant'\nimport { SystemApiMiddlewareFactory, SystemGraphQLContextFactory, SystemGraphQLHandlerFactory } from './system'\nimport {\n\tContentApiControllerFactory, ContentGraphQLContextFactory, ContentQueryHandlerFactory, GraphQLSchemaContributor, GraphQlSchemaFactory,\n\tGraphQLSchemaFactoryResult, NotModifiedChecker,\n} from './content'\nimport { ProjectContextResolver } from './project-common'\nimport {\n\tContentSchemaTransferMappingFactory,\n\tExportApiControllerFactory,\n\tExportExecutor,\n\tImportApiMiddlewareFactory,\n\tImportExecutor,\n\tSystemSchemaTransferMappingFactory,\n} from './transfer'\nimport { homepageController } from './misc'\nimport { Plugin } from './plugin/Plugin'\nimport { Application } from './application'\nimport { ApplicationWorkerManager } from './workers'\nimport { HttpResponse } from './common'\nimport { ContentQueryExecutorImpl } from './system/ContentQueryExecutor'\nimport { DatabaseMetadataResolver } from '@contember/database'\nimport Koa from 'koa'\nimport { ProjectGroupContainerResolver } from './projectGroup/ProjectGroupContainerResolver'\nimport { PrometheusRegistryFactory } from './prometheus/PrometheusRegistryFactory'\nimport { ProjectGroupContainerMetricsHook } from './prometheus/ProjectGroupContainerMetricsHook'\nimport { createColllectHttpMetricsMiddleware, createShowMetricsMiddleware } from './prometheus'\nimport { createSecretKey } from 'node:crypto'\nimport { CryptoWrapper } from './utils/CryptoWrapper'\nimport { ContentApiSpecificCache } from './content/ContentApiSpecificCache'\nimport { Schema } from '@contember/schema'\n\nexport type ProcessType =\n\t| 'singleNode'\n\t| 'clusterMaster'\n\t| 'clusterWorker'\n\nexport interface MasterContainer {\n\tinitializer: Initializer\n\tapplication: Application\n\tproviders: Providers\n\tapplicationWorkers: ApplicationWorkerManager\n\tmonitoringKoa: Koa\n}\n\nexport interface MasterContainerArgs {\n\tdebugMode: boolean\n\tserverConfig: ServerConfig\n\tprojectConfigResolver: ProjectConfigResolver\n\ttenantConfigResolver: TenantConfigResolver\n\tplugins: Plugin[]\n\tlogger: Logger\n\tversion?: string\n\tprocessType: ProcessType\n}\n\nexport type MasterContainerBuilder = ReturnType<MasterContainerFactory['createBuilderInternal']>\nexport type MasterContainerHook = (builder: MasterContainerBuilder) => MasterContainerBuilder\n\nexport class MasterContainerFactory {\n\n\tcreateBuilder(args: MasterContainerArgs): MasterContainerBuilder {\n\t\tconst builder = this.createBuilderInternal(args)\n\t\tconst hooks = args.plugins\n\t\t\t.map(it => it.getMasterContainerHook?.())\n\t\t\t.filter((it): it is MasterContainerHook => it !== undefined)\n\t\treturn hooks.reduce((acc, cb) => cb(acc), builder)\n\t}\n\n\tcreateBuilderInternal({\n\t\tserverConfig,\n\t\tdebugMode,\n\t\tplugins,\n\t\tprojectConfigResolver,\n\t\ttenantConfigResolver,\n\t\tversion,\n\t\tlogger,\n\t\tprocessType,\n\t}: MasterContainerArgs) {\n\t\treturn new Builder({})\n\t\t\t.addService('serverConfig', () =>\n\t\t\t\tserverConfig)\n\t\t\t.addService('debugMode', () =>\n\t\t\t\tdebugMode)\n\t\t\t.addService('version', () =>\n\t\t\t\tversion)\n\t\t\t.addService('processType', () =>\n\t\t\t\tprocessType)\n\t\t\t.addService('projectConfigResolver', () =>\n\t\t\t\tprojectConfigResolver)\n\t\t\t.addService('tenantConfigResolver', () =>\n\t\t\t\ttenantConfigResolver)\n\t\t\t.addService('plugins', () =>\n\t\t\t\tplugins)\n\t\t\t.addService('providers', () =>\n\t\t\t\tcreateProviders())\n\t\t\t.addService('tenantContainerFactory', ({ providers }) =>\n\t\t\t\tnew TenantContainerFactory(providers))\n\t\t\t.addService('modificationHandlerFactory', () =>\n\t\t\t\tnew ModificationHandlerFactory(ModificationHandlerFactory.defaultFactoryMap))\n\t\t\t.addService('executionContainerFactory', ({ providers }) =>\n\t\t\t\tnew ExecutionContainerFactory(providers))\n\t\t\t.addService('graphQlSchemaBuilderFactory', () =>\n\t\t\t\tnew GraphQlSchemaBuilderFactory())\n\t\t\t.addService('contentQueryExecutor', ({ executionContainerFactory, graphQlSchemaBuilderFactory }) =>\n\t\t\t\tnew ContentQueryExecutorImpl(executionContainerFactory, graphQlSchemaBuilderFactory))\n\t\t\t.addService('systemContainerFactory', ({ providers, modificationHandlerFactory, contentQueryExecutor }) =>\n\t\t\t\tnew SystemContainerFactory(providers, modificationHandlerFactory, contentQueryExecutor))\n\t\t\t.addService('contentPermissionFactory', ({}) =>\n\t\t\t\tnew PermissionFactory())\n\t\t\t.addService('databaseMetadataResolver', () =>\n\t\t\t\tnew DatabaseMetadataResolver())\n\t\t\t.addService('graphqlSchemaCache', ({ serverConfig }) =>\n\t\t\t\tnew ContentApiSpecificCache<Schema, GraphQLSchemaFactoryResult>({\n\t\t\t\t\tttlSeconds: serverConfig.contentApi?.schemaCacheTtlSeconds,\n\t\t\t\t}))\n\t\t\t.addService('graphQlSchemaFactory', ({ plugins, providers, graphqlSchemaCache, contentPermissionFactory, graphQlSchemaBuilderFactory }) => {\n\t\t\t\tconst contributors = plugins\n\t\t\t\t\t.map(it => (it.getSchemaContributor ? it.getSchemaContributor({ providers }) : null))\n\t\t\t\t\t.filter((it): it is GraphQLSchemaContributor => !!it)\n\n\t\t\t\treturn new GraphQlSchemaFactory(\n\t\t\t\t\tgraphqlSchemaCache,\n\t\t\t\t\tgraphQlSchemaBuilderFactory,\n\t\t\t\t\tcontentPermissionFactory,\n\t\t\t\t\tcontributors,\n\t\t\t\t)\n\t\t\t})\n\t\t\t.addService('projectContainerFactoryFactory', ({ plugins, providers, databaseMetadataResolver }) =>\n\t\t\t\tnew ProjectContainerFactoryFactory(plugins, providers, databaseMetadataResolver))\n\t\t\t.addService('tenantGraphQLHandlerFactory', () =>\n\t\t\t\tnew TenantGraphQLHandlerFactory())\n\t\t\t.addService('systemGraphQLHandlerFactory', ({ debugMode }) =>\n\t\t\t\tnew SystemGraphQLHandlerFactory(debugMode))\n\t\t\t.addService('logger', () =>\n\t\t\t\tlogger)\n\t\t\t.addService('projectGroupContainerFactory', ({ debugMode, providers, systemContainerFactory, tenantContainerFactory, projectContainerFactoryFactory, projectConfigResolver, tenantGraphQLHandlerFactory, systemGraphQLHandlerFactory, logger }) =>\n\t\t\t\tnew ProjectGroupContainerFactory(debugMode, providers, systemContainerFactory, tenantContainerFactory, projectContainerFactoryFactory, projectConfigResolver, tenantGraphQLHandlerFactory, systemGraphQLHandlerFactory, logger))\n\t\t\t.addService('projectGroupContainerResolver', ({ tenantConfigResolver, projectGroupContainerFactory }) =>\n\t\t\t\tnew ProjectGroupContainerResolver(tenantConfigResolver, projectGroupContainerFactory))\n\t\t\t.addService('promRegistryFactory', ({ processType, version }) =>\n\t\t\t\tnew PrometheusRegistryFactory(processType, { version }))\n\t\t\t.addService('projectGroupContainerMetricsHook', ({ projectGroupContainerResolver }) =>\n\t\t\t\tnew ProjectGroupContainerMetricsHook(projectGroupContainerResolver))\n\t\t\t.addService('promRegistry', ({ promRegistryFactory, projectGroupContainerMetricsHook }) => {\n\t\t\t\tconst registry = promRegistryFactory.create()\n\t\t\t\tprojectGroupContainerMetricsHook.register(registry)\n\t\t\t\treturn registry\n\t\t\t})\n\t\t\t.addService('projectGroupContainer', ({ tenantConfigResolver, projectGroupContainerFactory }) =>\n\t\t\t\tprojectGroupContainerFactory.create({ slug: undefined, config: tenantConfigResolver(undefined, {}) }))\n\t\t\t.addService('projectGroupResolver', ({ serverConfig, projectGroupContainerResolver }): ProjectGroupResolver => {\n\t\t\t\tconst encryptionKey = serverConfig.projectGroup?.configEncryptionKey\n\t\t\t\t\t? createSecretKey(Buffer.from(serverConfig.projectGroup?.configEncryptionKey, 'hex'))\n\t\t\t\t\t: undefined\n\t\t\t\treturn new ProjectGroupResolver(\n\t\t\t\t\tserverConfig.projectGroup?.domainMapping,\n\t\t\t\t\tserverConfig.projectGroup?.configHeader,\n\t\t\t\t\tserverConfig.projectGroup?.configEncryptionKey ? new CryptoWrapper(encryptionKey) : undefined,\n\t\t\t\t\tprojectGroupContainerResolver,\n\t\t\t\t)\n\n\t\t\t})\n\t\t\t.addService('notModifiedChecker', () =>\n\t\t\t\tnew NotModifiedChecker())\n\t\t\t.addService('contentGraphqlContextFactory', ({ providers, executionContainerFactory }) =>\n\t\t\t\tnew ContentGraphQLContextFactory(providers, executionContainerFactory))\n\t\t\t.addService('contentQueryHandlerFactory', ({ debugMode }) =>\n\t\t\t\tnew ContentQueryHandlerFactory(debugMode))\n\t\t\t.addService('projectContextResolver', () =>\n\t\t\t\tnew ProjectContextResolver())\n\t\t\t.addService('contentApiMiddlewareFactory', ({ projectContextResolver, notModifiedChecker, contentGraphqlContextFactory, contentQueryHandlerFactory, graphQlSchemaFactory }) =>\n\t\t\t\tnew ContentApiControllerFactory(notModifiedChecker, contentGraphqlContextFactory, contentQueryHandlerFactory, projectContextResolver, graphQlSchemaFactory))\n\t\t\t.addService('tenantGraphQLContextFactory', () =>\n\t\t\t\tnew TenantGraphQLContextFactory())\n\t\t\t.addService('tenantApiMiddlewareFactory', ({ debugMode, projectGroupResolver, tenantGraphQLContextFactory }) =>\n\t\t\t\tnew TenantApiMiddlewareFactory(debugMode, projectGroupResolver, tenantGraphQLContextFactory))\n\t\t\t.addService('systemGraphQLContextFactory', () =>\n\t\t\t\tnew SystemGraphQLContextFactory())\n\t\t\t.addService('systemApiMiddlewareFactory', ({ debugMode, systemGraphQLContextFactory, projectContextResolver }) =>\n\t\t\t\tnew SystemApiMiddlewareFactory(debugMode, systemGraphQLContextFactory, projectContextResolver))\n\t\t\t.addService('contentSchemaTransferMappingFactory', () =>\n\t\t\t\tnew ContentSchemaTransferMappingFactory())\n\t\t\t.addService('systemSchemaTransferMappingFactory', () =>\n\t\t\t\tnew SystemSchemaTransferMappingFactory())\n\t\t\t.addService('importExecutor', ({ contentSchemaTransferMappingFactory, systemSchemaTransferMappingFactory, databaseMetadataResolver }) =>\n\t\t\t\tnew ImportExecutor(contentSchemaTransferMappingFactory, systemSchemaTransferMappingFactory, databaseMetadataResolver))\n\t\t\t.addService('exportExecutor', ({ contentSchemaTransferMappingFactory, systemSchemaTransferMappingFactory }) =>\n\t\t\t\tnew ExportExecutor(contentSchemaTransferMappingFactory, systemSchemaTransferMappingFactory))\n\t\t\t.addService('importApiMiddlewareFactory', ({ projectGroupResolver, importExecutor }) =>\n\t\t\t\tnew ImportApiMiddlewareFactory(projectGroupResolver, importExecutor))\n\t\t\t.addService('exportApiMiddlewareFactory', ({ projectGroupResolver, exportExecutor }) =>\n\t\t\t\tnew ExportApiControllerFactory(projectGroupResolver, exportExecutor))\n\t\t\t.addService('application', ({ projectGroupResolver, serverConfig, logger, debugMode, version, promRegistry }) => {\n\t\t\t\tconst app = new Application(\n\t\t\t\t\tprojectGroupResolver,\n\t\t\t\t\tserverConfig,\n\t\t\t\t\tdebugMode,\n\t\t\t\t\tversion,\n\t\t\t\t\tlogger,\n\t\t\t\t)\n\t\t\t\tapp.addMiddleware(createColllectHttpMetricsMiddleware(promRegistry))\n\n\t\t\t\treturn app\n\t\t\t})\n\t\t\t.setupService('application', (it, { contentApiMiddlewareFactory, tenantApiMiddlewareFactory, systemApiMiddlewareFactory, importApiMiddlewareFactory, exportApiMiddlewareFactory }) => {\n\t\t\t\tit.addRoute('content', '/content/:projectSlug/:stageSlug', contentApiMiddlewareFactory.create())\n\t\t\t\tit.addRoute('tenant', '/tenant', tenantApiMiddlewareFactory.create())\n\t\t\t\tit.addRoute('system', '/system/:projectSlug', systemApiMiddlewareFactory.create())\n\t\t\t\tit.addRoute('transfer', '/import', importApiMiddlewareFactory.create())\n\t\t\t\tit.addRoute('transfer', '/export', exportApiMiddlewareFactory.create())\n\t\t\t\tit.addRoute('misc', '/', homepageController)\n\n\t\t\t\tit.addInternalRoute('internal', '/health', () => {\n\t\t\t\t\treturn new HttpResponse(200, 'OK')\n\t\t\t\t})\n\t\t\t})\n\t\t\t.addService('initializer', ({ projectGroupContainer }) =>\n\t\t\t\tnew Initializer(projectGroupContainer))\n\t\t\t.addService('applicationWorkers', () =>\n\t\t\t\tnew ApplicationWorkerManager())\n\t\t\t.setupService('executionContainerFactory', (it, { plugins }) => {\n\t\t\t\tfor (const plugin of plugins) {\n\t\t\t\t\tif (plugin.getExecutionContainerHook) {\n\t\t\t\t\t\tit.hooks.push(plugin.getExecutionContainerHook())\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})\n\t\t\t.addService('monitoringKoa', ({ promRegistry }) => {\n\t\t\t\tconst app = new Koa()\n\t\t\t\tapp.use(createShowMetricsMiddleware(promRegistry))\n\n\t\t\t\treturn app\n\t\t\t})\n\n\t}\n\n\tcreate(args: MasterContainerArgs): MasterContainer {\n\t\tconst container = this.createBuilder(args).build()\n\t\treturn container.pick('initializer', 'application', 'providers', 'applicationWorkers', 'monitoringKoa')\n\t}\n}\n"],"names":["Builder","createProviders","providers","TenantContainerFactory","ModificationHandlerFactory","ExecutionContainerFactory","GraphQlSchemaBuilderFactory","ContentQueryExecutorImpl","SystemContainerFactory","PermissionFactory","DatabaseMetadataResolver","serverConfig","ContentApiSpecificCache","plugins","GraphQlSchemaFactory","ProjectContainerFactoryFactory","TenantGraphQLHandlerFactory","debugMode","SystemGraphQLHandlerFactory","projectConfigResolver","logger","ProjectGroupContainerFactory","tenantConfigResolver","ProjectGroupContainerResolver","processType","version","PrometheusRegistryFactory","ProjectGroupContainerMetricsHook","createSecretKey","ProjectGroupResolver","CryptoWrapper","NotModifiedChecker","ContentGraphQLContextFactory","ContentQueryHandlerFactory","ProjectContextResolver","ContentApiControllerFactory","TenantGraphQLContextFactory","TenantApiMiddlewareFactory","SystemGraphQLContextFactory","SystemApiMiddlewareFactory","ContentSchemaTransferMappingFactory","SystemSchemaTransferMappingFactory","ImportExecutor","ExportExecutor","ImportApiMiddlewareFactory","ExportApiControllerFactory","Application","createColllectHttpMetricsMiddleware","homepageController","HttpResponse","Initializer","ApplicationWorkerManager","createShowMetricsMiddleware"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0EO,MAAM,uBA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AoC,4BAA4B,QAAQ;AAC/F,SAAG,SAAS,UAAU,WAAW,2BAA2B,QAAQ;AACpE,SAAG,SAAS,UAAU,wBAAwB,2BAA2B,QAAQ;AACjF,SAAG,SAAS,YAAY,WAAW,2BAA2B,QAAQ;AACtE,SAAG,SAAS,YAAY,WAAW,2BAA2B,QAAQ;AACnE,SAAA,SAAS,QAAQ,KAAKC,0BAAAA,kBAAkB;AAExC,SAAA,iBAAiB,YAAY,WAAW,MAAM;AACzC,eAAA,IAAIC,aAAAA,aAAa,KAAK,IAAI;AAAA,MAAA,CACjC;AAAA,IAAA,CACD,EACA,WAAW,eAAe,CAAC,EAAE,sBAC7B,MAAA,IAAIC,YAAY,YAAA,qBAAqB,CAAC,EACtC,WAAW,sBAAsB,MACjC,IAAIC,yBAAAA,0BAA0B,EAC9B,aAAa,6BAA6B,CAAC,IAAI,EAAE,SAAAtC,eAAc;AAC/D,iBAAW,UAAUA,UAAS;AAC7B,YAAI,OAAO,2BAA2B;AACrC,aAAG,MAAM,KAAK,OAAO,0BAAA,CAA2B;AAAA,QAAA;AAAA,MACjD;AAAA,IAED,CAAA,EACA,WAAW,iBAAiB,CAAC,EAAE,mBAAmB;AAC5C,YAAA,MAAM,IAAI,IAAI;AAChB,UAAA,IAAIuC,kDAA4B,YAAY,CAAC;AAE1C,aAAA;AAAA,IAAA,CACP;AAAA,EAAA;AAAA,EAIH,OAAO,MAA4C;AAClD,UAAM,YAAY,KAAK,cAAc,IAAI,EAAE,MAAM;AACjD,WAAO,UAAU,KAAK,eAAe,eAAe,aAAa,sBAAsB,eAAe;AAAA,EAAA;AAExG;;"}
|
|
1
|
+
{"version":3,"file":"MasterContainer.cjs","sources":["../../../../packages/engine-http/src/MasterContainer.ts"],"sourcesContent":["import { Builder } from '@contember/dic'\nimport { SystemContainerFactory } from '@contember/engine-system-api'\nimport { TenantContainerFactory } from '@contember/engine-tenant-api'\nimport { ModificationHandlerFactory } from '@contember/schema-migrations'\nimport { Initializer } from './bootstrap'\nimport { ServerConfig } from './config/config'\n\nimport { DatabaseMetadataResolver } from '@contember/database'\nimport { ExecutionContainerFactory, GraphQlSchemaBuilderFactory, PermissionFactory } from '@contember/engine-content-api'\nimport { Logger } from '@contember/logger'\nimport { Schema } from '@contember/schema'\nimport Koa from 'koa'\nimport { createSecretKey } from 'node:crypto'\nimport { Application } from './application'\nimport { HttpResponse } from './common'\nimport { ProjectConfigResolver } from './config/projectConfigResolver'\nimport { TenantConfigResolver } from './config/tenantConfigResolver'\nimport {\n\tContentApiControllerFactory,\n\tContentQueryHandlerFactory, GraphQLSchemaContributor, GraphQlSchemaFactory,\n\tGraphQLSchemaFactoryResult, NotModifiedChecker,\n} from './content'\nimport { ContentApiSpecificCache } from './content/ContentApiSpecificCache'\nimport { homepageController } from './misc'\nimport { Plugin } from './plugin/Plugin'\nimport { ProjectContainerFactoryFactory } from './project'\nimport { ProjectContextResolver } from './project-common'\nimport { ProjectGroupContainerFactory } from './projectGroup/ProjectGroupContainer'\nimport { ProjectGroupContainerResolver } from './projectGroup/ProjectGroupContainerResolver'\nimport { ProjectGroupResolver } from './projectGroup/ProjectGroupResolver'\nimport { createColllectHttpMetricsMiddleware, createShowMetricsMiddleware } from './prometheus'\nimport { ProjectGroupContainerMetricsHook } from './prometheus/ProjectGroupContainerMetricsHook'\nimport { PrometheusRegistryFactory } from './prometheus/PrometheusRegistryFactory'\nimport { createProviders, Providers } from './providers'\nimport { SystemApiMiddlewareFactory, SystemGraphQLContextFactory, SystemGraphQLHandlerFactory } from './system'\nimport { ContentQueryExecutorImpl } from './system/ContentQueryExecutor'\nimport { TenantApiMiddlewareFactory, TenantGraphQLHandlerFactory } from './tenant'\nimport {\n\tContentSchemaTransferMappingFactory,\n\tExportApiControllerFactory,\n\tExportExecutor,\n\tImportApiMiddlewareFactory,\n\tImportExecutor,\n\tSystemSchemaTransferMappingFactory,\n} from './transfer'\nimport { CryptoWrapper } from './utils/CryptoWrapper'\nimport { ApplicationWorkerManager } from './workers'\n\nexport type ProcessType =\n\t| 'singleNode'\n\t| 'clusterMaster'\n\t| 'clusterWorker'\n\nexport interface MasterContainer {\n\tinitializer: Initializer\n\tapplication: Application\n\tproviders: Providers\n\tapplicationWorkers: ApplicationWorkerManager\n\tmonitoringKoa: Koa\n}\n\nexport interface MasterContainerArgs {\n\tdebugMode: boolean\n\tserverConfig: ServerConfig\n\tprojectConfigResolver: ProjectConfigResolver\n\ttenantConfigResolver: TenantConfigResolver\n\tplugins: Plugin[]\n\tlogger: Logger\n\tversion?: string\n\tprocessType: ProcessType\n}\n\nexport type MasterContainerBuilder = ReturnType<MasterContainerFactory['createBuilderInternal']>\nexport type MasterContainerHook = (builder: MasterContainerBuilder) => MasterContainerBuilder\n\nexport class MasterContainerFactory {\n\n\tcreateBuilder(args: MasterContainerArgs): MasterContainerBuilder {\n\t\tconst builder = this.createBuilderInternal(args)\n\t\tconst hooks = args.plugins\n\t\t\t.map(it => it.getMasterContainerHook?.())\n\t\t\t.filter((it): it is MasterContainerHook => it !== undefined)\n\t\treturn hooks.reduce((acc, cb) => cb(acc), builder)\n\t}\n\n\tcreateBuilderInternal({\n\t\tserverConfig,\n\t\tdebugMode,\n\t\tplugins,\n\t\tprojectConfigResolver,\n\t\ttenantConfigResolver,\n\t\tversion,\n\t\tlogger,\n\t\tprocessType,\n\t}: MasterContainerArgs) {\n\t\treturn new Builder({})\n\t\t\t.addService('serverConfig', () =>\n\t\t\t\tserverConfig)\n\t\t\t.addService('debugMode', () =>\n\t\t\t\tdebugMode)\n\t\t\t.addService('version', () =>\n\t\t\t\tversion)\n\t\t\t.addService('processType', () =>\n\t\t\t\tprocessType)\n\t\t\t.addService('projectConfigResolver', () =>\n\t\t\t\tprojectConfigResolver)\n\t\t\t.addService('tenantConfigResolver', () =>\n\t\t\t\ttenantConfigResolver)\n\t\t\t.addService('plugins', () =>\n\t\t\t\tplugins)\n\t\t\t.addService('providers', () =>\n\t\t\t\tcreateProviders())\n\t\t\t.addService('tenantContainerFactory', ({ providers }) =>\n\t\t\t\tnew TenantContainerFactory(providers))\n\t\t\t.addService('modificationHandlerFactory', () =>\n\t\t\t\tnew ModificationHandlerFactory(ModificationHandlerFactory.defaultFactoryMap))\n\t\t\t.addService('executionContainerFactory', ({ providers, serverConfig }) =>\n\t\t\t\tnew ExecutionContainerFactory(providers, serverConfig.contentApi?.whereOptimizer))\n\t\t\t.addService('graphQlSchemaBuilderFactory', () =>\n\t\t\t\tnew GraphQlSchemaBuilderFactory())\n\t\t\t.addService('contentQueryExecutor', ({ executionContainerFactory, graphQlSchemaBuilderFactory }) =>\n\t\t\t\tnew ContentQueryExecutorImpl(executionContainerFactory, graphQlSchemaBuilderFactory))\n\t\t\t.addService('systemContainerFactory', ({ providers, modificationHandlerFactory, contentQueryExecutor }) =>\n\t\t\t\tnew SystemContainerFactory(providers, modificationHandlerFactory, contentQueryExecutor))\n\t\t\t.addService('contentPermissionFactory', ({}) =>\n\t\t\t\tnew PermissionFactory())\n\t\t\t.addService('databaseMetadataResolver', () =>\n\t\t\t\tnew DatabaseMetadataResolver())\n\t\t\t.addService('graphqlSchemaCache', ({ serverConfig }) =>\n\t\t\t\tnew ContentApiSpecificCache<Schema, GraphQLSchemaFactoryResult>({\n\t\t\t\t\tttlSeconds: serverConfig.contentApi?.schemaCacheTtlSeconds,\n\t\t\t\t}))\n\t\t\t.addService('graphQlSchemaFactory', ({ plugins, providers, graphqlSchemaCache, contentPermissionFactory, graphQlSchemaBuilderFactory }) => {\n\t\t\t\tconst contributors = plugins\n\t\t\t\t\t.map(it => (it.getSchemaContributor ? it.getSchemaContributor({ providers }) : null))\n\t\t\t\t\t.filter((it): it is GraphQLSchemaContributor => !!it)\n\n\t\t\t\treturn new GraphQlSchemaFactory(\n\t\t\t\t\tgraphqlSchemaCache,\n\t\t\t\t\tgraphQlSchemaBuilderFactory,\n\t\t\t\t\tcontentPermissionFactory,\n\t\t\t\t\tcontributors,\n\t\t\t\t)\n\t\t\t})\n\t\t\t.addService('projectContainerFactoryFactory', ({ plugins, providers, databaseMetadataResolver }) =>\n\t\t\t\tnew ProjectContainerFactoryFactory(plugins, providers, databaseMetadataResolver))\n\t\t\t.addService('tenantGraphQLHandlerFactory', () =>\n\t\t\t\tnew TenantGraphQLHandlerFactory())\n\t\t\t.addService('systemGraphQLHandlerFactory', ({ debugMode }) =>\n\t\t\t\tnew SystemGraphQLHandlerFactory(debugMode))\n\t\t\t.addService('logger', () =>\n\t\t\t\tlogger)\n\t\t\t.addService('projectGroupContainerFactory', ({ debugMode, providers, systemContainerFactory, tenantContainerFactory, projectContainerFactoryFactory, projectConfigResolver, tenantGraphQLHandlerFactory, systemGraphQLHandlerFactory, logger }) =>\n\t\t\t\tnew ProjectGroupContainerFactory(debugMode, providers, systemContainerFactory, tenantContainerFactory, projectContainerFactoryFactory, projectConfigResolver, tenantGraphQLHandlerFactory, systemGraphQLHandlerFactory, logger))\n\t\t\t.addService('projectGroupContainerResolver', ({ tenantConfigResolver, projectGroupContainerFactory }) =>\n\t\t\t\tnew ProjectGroupContainerResolver(tenantConfigResolver, projectGroupContainerFactory))\n\t\t\t.addService('promRegistryFactory', ({ processType, version }) =>\n\t\t\t\tnew PrometheusRegistryFactory(processType, { version }))\n\t\t\t.addService('projectGroupContainerMetricsHook', ({ projectGroupContainerResolver }) =>\n\t\t\t\tnew ProjectGroupContainerMetricsHook(projectGroupContainerResolver))\n\t\t\t.addService('promRegistry', ({ promRegistryFactory, projectGroupContainerMetricsHook }) => {\n\t\t\t\tconst registry = promRegistryFactory.create()\n\t\t\t\tprojectGroupContainerMetricsHook.register(registry)\n\t\t\t\treturn registry\n\t\t\t})\n\t\t\t.addService('projectGroupContainer', ({ tenantConfigResolver, projectGroupContainerFactory }) =>\n\t\t\t\tprojectGroupContainerFactory.create({ slug: undefined, config: tenantConfigResolver(undefined, {}) }))\n\t\t\t.addService('projectGroupResolver', ({ serverConfig, projectGroupContainerResolver }): ProjectGroupResolver => {\n\t\t\t\tconst encryptionKey = serverConfig.projectGroup?.configEncryptionKey\n\t\t\t\t\t? createSecretKey(Buffer.from(serverConfig.projectGroup?.configEncryptionKey, 'hex'))\n\t\t\t\t\t: undefined\n\t\t\t\treturn new ProjectGroupResolver(\n\t\t\t\t\tserverConfig.projectGroup?.domainMapping,\n\t\t\t\t\tserverConfig.projectGroup?.configHeader,\n\t\t\t\t\tserverConfig.projectGroup?.configEncryptionKey ? new CryptoWrapper(encryptionKey) : undefined,\n\t\t\t\t\tprojectGroupContainerResolver,\n\t\t\t\t)\n\n\t\t\t})\n\t\t\t.addService('notModifiedChecker', () =>\n\t\t\t\tnew NotModifiedChecker())\n\t\t\t.addService('contentQueryHandlerFactory', ({ debugMode }) =>\n\t\t\t\tnew ContentQueryHandlerFactory(debugMode))\n\t\t\t.addService('projectContextResolver', () =>\n\t\t\t\tnew ProjectContextResolver())\n\t\t\t.addService('contentApiMiddlewareFactory', ({ projectContextResolver, notModifiedChecker, executionContainerFactory, contentQueryHandlerFactory, graphQlSchemaFactory }) =>\n\t\t\t\tnew ContentApiControllerFactory(notModifiedChecker, executionContainerFactory, contentQueryHandlerFactory, projectContextResolver, graphQlSchemaFactory))\n\t\t\t.addService('tenantApiMiddlewareFactory', () =>\n\t\t\t\tnew TenantApiMiddlewareFactory())\n\t\t\t.addService('systemGraphQLContextFactory', () =>\n\t\t\t\tnew SystemGraphQLContextFactory())\n\t\t\t.addService('systemApiMiddlewareFactory', ({ debugMode, systemGraphQLContextFactory, projectContextResolver }) =>\n\t\t\t\tnew SystemApiMiddlewareFactory(debugMode, systemGraphQLContextFactory, projectContextResolver))\n\t\t\t.addService('contentSchemaTransferMappingFactory', () =>\n\t\t\t\tnew ContentSchemaTransferMappingFactory())\n\t\t\t.addService('systemSchemaTransferMappingFactory', () =>\n\t\t\t\tnew SystemSchemaTransferMappingFactory())\n\t\t\t.addService('importExecutor', ({ contentSchemaTransferMappingFactory, systemSchemaTransferMappingFactory, databaseMetadataResolver }) =>\n\t\t\t\tnew ImportExecutor(contentSchemaTransferMappingFactory, systemSchemaTransferMappingFactory, databaseMetadataResolver))\n\t\t\t.addService('exportExecutor', ({ contentSchemaTransferMappingFactory, systemSchemaTransferMappingFactory }) =>\n\t\t\t\tnew ExportExecutor(contentSchemaTransferMappingFactory, systemSchemaTransferMappingFactory))\n\t\t\t.addService('importApiMiddlewareFactory', ({ projectGroupResolver, importExecutor }) =>\n\t\t\t\tnew ImportApiMiddlewareFactory(projectGroupResolver, importExecutor))\n\t\t\t.addService('exportApiMiddlewareFactory', ({ projectGroupResolver, exportExecutor }) =>\n\t\t\t\tnew ExportApiControllerFactory(projectGroupResolver, exportExecutor))\n\t\t\t.addService('application', ({ projectGroupResolver, serverConfig, logger, debugMode, version, promRegistry }) => {\n\t\t\t\tconst app = new Application(\n\t\t\t\t\tprojectGroupResolver,\n\t\t\t\t\tserverConfig,\n\t\t\t\t\tdebugMode,\n\t\t\t\t\tversion,\n\t\t\t\t\tlogger,\n\t\t\t\t)\n\t\t\t\tapp.addMiddleware(createColllectHttpMetricsMiddleware(promRegistry))\n\n\t\t\t\treturn app\n\t\t\t})\n\t\t\t.setupService('application', (it, { contentApiMiddlewareFactory, tenantApiMiddlewareFactory, systemApiMiddlewareFactory, importApiMiddlewareFactory, exportApiMiddlewareFactory }) => {\n\t\t\t\tit.addRoute('content', '/content/:projectSlug/:stageSlug', contentApiMiddlewareFactory.create())\n\t\t\t\tit.addRoute('tenant', '/tenant', tenantApiMiddlewareFactory.create())\n\t\t\t\tit.addRoute('system', '/system/:projectSlug', systemApiMiddlewareFactory.create())\n\t\t\t\tit.addRoute('transfer', '/import', importApiMiddlewareFactory.create())\n\t\t\t\tit.addRoute('transfer', '/export', exportApiMiddlewareFactory.create())\n\t\t\t\tit.addRoute('misc', '/', homepageController)\n\n\t\t\t\tit.addInternalRoute('internal', '/health', () => {\n\t\t\t\t\treturn new HttpResponse(200, 'OK')\n\t\t\t\t})\n\t\t\t})\n\t\t\t.addService('initializer', ({ projectGroupContainer }) =>\n\t\t\t\tnew Initializer(projectGroupContainer))\n\t\t\t.addService('applicationWorkers', () =>\n\t\t\t\tnew ApplicationWorkerManager())\n\t\t\t.setupService('executionContainerFactory', (it, { plugins }) => {\n\t\t\t\tfor (const plugin of plugins) {\n\t\t\t\t\tif (plugin.getExecutionContainerHook) {\n\t\t\t\t\t\tit.hooks.push(plugin.getExecutionContainerHook())\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})\n\t\t\t.addService('monitoringKoa', ({ promRegistry }) => {\n\t\t\t\tconst app = new Koa()\n\t\t\t\tapp.use(createShowMetricsMiddleware(promRegistry))\n\n\t\t\t\treturn app\n\t\t\t})\n\n\t}\n\n\tcreate(args: MasterContainerArgs): MasterContainer {\n\t\tconst container = this.createBuilder(args).build()\n\t\treturn container.pick('initializer', 'application', 'providers', 'applicationWorkers', 'monitoringKoa')\n\t}\n}\n"],"names":["Builder","createProviders","providers","TenantContainerFactory","ModificationHandlerFactory","serverConfig","ExecutionContainerFactory","GraphQlSchemaBuilderFactory","ContentQueryExecutorImpl","SystemContainerFactory","PermissionFactory","DatabaseMetadataResolver","ContentApiSpecificCache","plugins","GraphQlSchemaFactory","ProjectContainerFactoryFactory","TenantGraphQLHandlerFactory","debugMode","SystemGraphQLHandlerFactory","projectConfigResolver","logger","ProjectGroupContainerFactory","tenantConfigResolver","ProjectGroupContainerResolver","processType","version","PrometheusRegistryFactory","ProjectGroupContainerMetricsHook","createSecretKey","ProjectGroupResolver","CryptoWrapper","NotModifiedChecker","ContentQueryHandlerFactory","ProjectContextResolver","ContentApiControllerFactory","TenantApiMiddlewareFactory","SystemGraphQLContextFactory","SystemApiMiddlewareFactory","ContentSchemaTransferMappingFactory","SystemSchemaTransferMappingFactory","ImportExecutor","ExportExecutor","ImportApiMiddlewareFactory","ExportApiControllerFactory","Application","createColllectHttpMetricsMiddleware","homepageController","HttpResponse","Initializer","ApplicationWorkerManager","createShowMetricsMiddleware"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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A2B,QAAQ;AACjF,SAAG,SAAS,YAAY,WAAW,2BAA2B,QAAQ;AACtE,SAAG,SAAS,YAAY,WAAW,2BAA2B,QAAQ;AACnE,SAAA,SAAS,QAAQ,KAAKC,0BAAAA,kBAAkB;AAExC,SAAA,iBAAiB,YAAY,WAAW,MAAM;AACzC,eAAA,IAAIC,aAAAA,aAAa,KAAK,IAAI;AAAA,MAAA,CACjC;AAAA,IAAA,CACD,EACA,WAAW,eAAe,CAAC,EAAE,sBAC7B,MAAA,IAAIC,YAAY,YAAA,qBAAqB,CAAC,EACtC,WAAW,sBAAsB,MACjC,IAAIC,yBAAAA,0BAA0B,EAC9B,aAAa,6BAA6B,CAAC,IAAI,EAAE,SAAApC,eAAc;AAC/D,iBAAW,UAAUA,UAAS;AAC7B,YAAI,OAAO,2BAA2B;AACrC,aAAG,MAAM,KAAK,OAAO,0BAAA,CAA2B;AAAA,QAAA;AAAA,MACjD;AAAA,IAED,CAAA,EACA,WAAW,iBAAiB,CAAC,EAAE,mBAAmB;AAC5C,YAAA,MAAM,IAAI,IAAI;AAChB,UAAA,IAAIqC,kDAA4B,YAAY,CAAC;AAE1C,aAAA;AAAA,IAAA,CACP;AAAA,EAAA;AAAA,EAIH,OAAO,MAA4C;AAClD,UAAM,YAAY,KAAK,cAAc,IAAI,EAAE,MAAM;AACjD,WAAO,UAAU,KAAK,eAAe,eAAe,aAAa,sBAAsB,eAAe;AAAA,EAAA;AAExG;;"}
|
|
@@ -1,49 +1,47 @@
|
|
|
1
|
+
import { Builder } from "@contember/dic";
|
|
1
2
|
import { SystemContainerFactory } from "@contember/engine-system-api";
|
|
2
3
|
import { TenantContainerFactory } from "@contember/engine-tenant-api";
|
|
3
|
-
import { Builder } from "@contember/dic";
|
|
4
4
|
import { ModificationHandlerFactory } from "@contember/schema-migrations";
|
|
5
5
|
import { Initializer } from "./bootstrap/Initializer.js";
|
|
6
|
-
import {
|
|
7
|
-
import "@contember/engine-common";
|
|
8
|
-
import { ProjectGroupContainerFactory } from "./projectGroup/ProjectGroupContainer.js";
|
|
9
|
-
import { ProjectGroupResolver } from "./projectGroup/ProjectGroupResolver.js";
|
|
6
|
+
import { DatabaseMetadataResolver } from "@contember/database";
|
|
10
7
|
import { ExecutionContainerFactory, GraphQlSchemaBuilderFactory, PermissionFactory } from "@contember/engine-content-api";
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { SystemApiMiddlewareFactory } from "./system/SystemApiMiddlewareFactory.js";
|
|
16
|
-
import { SystemGraphQLContextFactory } from "./system/SystemGraphQLContextFactory.js";
|
|
17
|
-
import { SystemGraphQLHandlerFactory } from "./system/SystemGraphQLHandlerFactory.js";
|
|
8
|
+
import Koa from "koa";
|
|
9
|
+
import { createSecretKey } from "node:crypto";
|
|
10
|
+
import { Application } from "./application/application.js";
|
|
11
|
+
import { HttpResponse } from "./common/HttpResponse.js";
|
|
18
12
|
import { ContentApiControllerFactory } from "./content/ContentApiControllerFactory.js";
|
|
19
|
-
import { ContentGraphQLContextFactory } from "./content/ContentGraphQLContextFactory.js";
|
|
20
13
|
import { ContentQueryHandlerFactory } from "./content/ContentQueryHandlerFactory.js";
|
|
21
14
|
import "./content/ContentSchemaResolver.js";
|
|
22
15
|
import { GraphQlSchemaFactory } from "./content/GraphQlSchemaFactory.js";
|
|
23
16
|
import { NotModifiedChecker } from "./content/NotModifiedChecker.js";
|
|
24
17
|
import "./content/ProjectMembershipResolver.js";
|
|
18
|
+
import { ContentApiSpecificCache } from "./content/ContentApiSpecificCache.js";
|
|
19
|
+
import { homepageController } from "./misc/HomepageMiddlewareFactory.js";
|
|
20
|
+
import { ProjectContainerFactoryFactory } from "./project/ProjectContainer.js";
|
|
21
|
+
import "@contember/engine-common";
|
|
25
22
|
import { ProjectContextResolver } from "./project-common/ProjectContextResolver.js";
|
|
23
|
+
import { ProjectGroupContainerFactory } from "./projectGroup/ProjectGroupContainer.js";
|
|
24
|
+
import { ProjectGroupContainerResolver } from "./projectGroup/ProjectGroupContainerResolver.js";
|
|
25
|
+
import { ProjectGroupResolver } from "./projectGroup/ProjectGroupResolver.js";
|
|
26
|
+
import { createColllectHttpMetricsMiddleware } from "./prometheus/CollectHttpMetricsMiddelware.js";
|
|
27
|
+
import { createShowMetricsMiddleware } from "./prometheus/ShowMetricsMiddleware.js";
|
|
28
|
+
import { ProjectGroupContainerMetricsHook } from "./prometheus/ProjectGroupContainerMetricsHook.js";
|
|
29
|
+
import { PrometheusRegistryFactory } from "./prometheus/PrometheusRegistryFactory.js";
|
|
30
|
+
import { createProviders } from "./providers.js";
|
|
31
|
+
import { SystemApiMiddlewareFactory } from "./system/SystemApiMiddlewareFactory.js";
|
|
32
|
+
import { SystemGraphQLContextFactory } from "./system/SystemGraphQLContextFactory.js";
|
|
33
|
+
import { SystemGraphQLHandlerFactory } from "./system/SystemGraphQLHandlerFactory.js";
|
|
34
|
+
import { ContentQueryExecutorImpl } from "./system/ContentQueryExecutor.js";
|
|
35
|
+
import { TenantApiMiddlewareFactory } from "./tenant/TenantApiMiddlewareFactory.js";
|
|
36
|
+
import { TenantGraphQLHandlerFactory } from "./tenant/TenantGraphQLHandlerFactory.js";
|
|
26
37
|
import { ImportApiMiddlewareFactory } from "./transfer/ImportApiMiddlewareFactory.js";
|
|
27
38
|
import { ExportApiControllerFactory } from "./transfer/ExportApiControllerFactory.js";
|
|
28
39
|
import { ImportExecutor } from "./transfer/ImportExecutor.js";
|
|
29
40
|
import { ExportExecutor } from "./transfer/ExportExecutor.js";
|
|
30
41
|
import { ContentSchemaTransferMappingFactory } from "./transfer/ContentSchemaTransferMappingFactory.js";
|
|
31
42
|
import { SystemSchemaTransferMappingFactory } from "./transfer/SystemSchemaTransferMappingFactory.js";
|
|
32
|
-
import { homepageController } from "./misc/HomepageMiddlewareFactory.js";
|
|
33
|
-
import { Application } from "./application/application.js";
|
|
34
|
-
import { ApplicationWorkerManager } from "./workers/ApplicationWorkerManager.js";
|
|
35
|
-
import { HttpResponse } from "./common/HttpResponse.js";
|
|
36
|
-
import { ContentQueryExecutorImpl } from "./system/ContentQueryExecutor.js";
|
|
37
|
-
import { DatabaseMetadataResolver } from "@contember/database";
|
|
38
|
-
import Koa from "koa";
|
|
39
|
-
import { ProjectGroupContainerResolver } from "./projectGroup/ProjectGroupContainerResolver.js";
|
|
40
|
-
import { PrometheusRegistryFactory } from "./prometheus/PrometheusRegistryFactory.js";
|
|
41
|
-
import { ProjectGroupContainerMetricsHook } from "./prometheus/ProjectGroupContainerMetricsHook.js";
|
|
42
|
-
import { createColllectHttpMetricsMiddleware } from "./prometheus/CollectHttpMetricsMiddelware.js";
|
|
43
|
-
import { createShowMetricsMiddleware } from "./prometheus/ShowMetricsMiddleware.js";
|
|
44
|
-
import { createSecretKey } from "node:crypto";
|
|
45
43
|
import { CryptoWrapper } from "./utils/CryptoWrapper.js";
|
|
46
|
-
import {
|
|
44
|
+
import { ApplicationWorkerManager } from "./workers/ApplicationWorkerManager.js";
|
|
47
45
|
class MasterContainerFactory {
|
|
48
46
|
createBuilder(args) {
|
|
49
47
|
const builder = this.createBuilderInternal(args);
|
|
@@ -60,7 +58,7 @@ class MasterContainerFactory {
|
|
|
60
58
|
logger,
|
|
61
59
|
processType
|
|
62
60
|
}) {
|
|
63
|
-
return new Builder({}).addService("serverConfig", () => serverConfig).addService("debugMode", () => debugMode).addService("version", () => version).addService("processType", () => processType).addService("projectConfigResolver", () => projectConfigResolver).addService("tenantConfigResolver", () => tenantConfigResolver).addService("plugins", () => plugins).addService("providers", () => createProviders()).addService("tenantContainerFactory", ({ providers }) => new TenantContainerFactory(providers)).addService("modificationHandlerFactory", () => new ModificationHandlerFactory(ModificationHandlerFactory.defaultFactoryMap)).addService("executionContainerFactory", ({ providers }) => new ExecutionContainerFactory(providers)).addService("graphQlSchemaBuilderFactory", () => new GraphQlSchemaBuilderFactory()).addService("contentQueryExecutor", ({ executionContainerFactory, graphQlSchemaBuilderFactory }) => new ContentQueryExecutorImpl(executionContainerFactory, graphQlSchemaBuilderFactory)).addService("systemContainerFactory", ({ providers, modificationHandlerFactory, contentQueryExecutor }) => new SystemContainerFactory(providers, modificationHandlerFactory, contentQueryExecutor)).addService("contentPermissionFactory", ({}) => new PermissionFactory()).addService("databaseMetadataResolver", () => new DatabaseMetadataResolver()).addService("graphqlSchemaCache", ({ serverConfig: serverConfig2 }) => new ContentApiSpecificCache({
|
|
61
|
+
return new Builder({}).addService("serverConfig", () => serverConfig).addService("debugMode", () => debugMode).addService("version", () => version).addService("processType", () => processType).addService("projectConfigResolver", () => projectConfigResolver).addService("tenantConfigResolver", () => tenantConfigResolver).addService("plugins", () => plugins).addService("providers", () => createProviders()).addService("tenantContainerFactory", ({ providers }) => new TenantContainerFactory(providers)).addService("modificationHandlerFactory", () => new ModificationHandlerFactory(ModificationHandlerFactory.defaultFactoryMap)).addService("executionContainerFactory", ({ providers, serverConfig: serverConfig2 }) => new ExecutionContainerFactory(providers, serverConfig2.contentApi?.whereOptimizer)).addService("graphQlSchemaBuilderFactory", () => new GraphQlSchemaBuilderFactory()).addService("contentQueryExecutor", ({ executionContainerFactory, graphQlSchemaBuilderFactory }) => new ContentQueryExecutorImpl(executionContainerFactory, graphQlSchemaBuilderFactory)).addService("systemContainerFactory", ({ providers, modificationHandlerFactory, contentQueryExecutor }) => new SystemContainerFactory(providers, modificationHandlerFactory, contentQueryExecutor)).addService("contentPermissionFactory", ({}) => new PermissionFactory()).addService("databaseMetadataResolver", () => new DatabaseMetadataResolver()).addService("graphqlSchemaCache", ({ serverConfig: serverConfig2 }) => new ContentApiSpecificCache({
|
|
64
62
|
ttlSeconds: serverConfig2.contentApi?.schemaCacheTtlSeconds
|
|
65
63
|
})).addService("graphQlSchemaFactory", ({ plugins: plugins2, providers, graphqlSchemaCache, contentPermissionFactory, graphQlSchemaBuilderFactory }) => {
|
|
66
64
|
const contributors = plugins2.map((it) => it.getSchemaContributor ? it.getSchemaContributor({ providers }) : null).filter((it) => !!it);
|
|
@@ -82,7 +80,7 @@ class MasterContainerFactory {
|
|
|
82
80
|
serverConfig2.projectGroup?.configEncryptionKey ? new CryptoWrapper(encryptionKey) : void 0,
|
|
83
81
|
projectGroupContainerResolver
|
|
84
82
|
);
|
|
85
|
-
}).addService("notModifiedChecker", () => new NotModifiedChecker()).addService("
|
|
83
|
+
}).addService("notModifiedChecker", () => new NotModifiedChecker()).addService("contentQueryHandlerFactory", ({ debugMode: debugMode2 }) => new ContentQueryHandlerFactory(debugMode2)).addService("projectContextResolver", () => new ProjectContextResolver()).addService("contentApiMiddlewareFactory", ({ projectContextResolver, notModifiedChecker, executionContainerFactory, contentQueryHandlerFactory, graphQlSchemaFactory }) => new ContentApiControllerFactory(notModifiedChecker, executionContainerFactory, contentQueryHandlerFactory, projectContextResolver, graphQlSchemaFactory)).addService("tenantApiMiddlewareFactory", () => new TenantApiMiddlewareFactory()).addService("systemGraphQLContextFactory", () => new SystemGraphQLContextFactory()).addService("systemApiMiddlewareFactory", ({ debugMode: debugMode2, systemGraphQLContextFactory, projectContextResolver }) => new SystemApiMiddlewareFactory(debugMode2, systemGraphQLContextFactory, projectContextResolver)).addService("contentSchemaTransferMappingFactory", () => new ContentSchemaTransferMappingFactory()).addService("systemSchemaTransferMappingFactory", () => new SystemSchemaTransferMappingFactory()).addService("importExecutor", ({ contentSchemaTransferMappingFactory, systemSchemaTransferMappingFactory, databaseMetadataResolver }) => new ImportExecutor(contentSchemaTransferMappingFactory, systemSchemaTransferMappingFactory, databaseMetadataResolver)).addService("exportExecutor", ({ contentSchemaTransferMappingFactory, systemSchemaTransferMappingFactory }) => new ExportExecutor(contentSchemaTransferMappingFactory, systemSchemaTransferMappingFactory)).addService("importApiMiddlewareFactory", ({ projectGroupResolver, importExecutor }) => new ImportApiMiddlewareFactory(projectGroupResolver, importExecutor)).addService("exportApiMiddlewareFactory", ({ projectGroupResolver, exportExecutor }) => new ExportApiControllerFactory(projectGroupResolver, exportExecutor)).addService("application", ({ projectGroupResolver, serverConfig: serverConfig2, logger: logger2, debugMode: debugMode2, version: version2, promRegistry }) => {
|
|
86
84
|
const app = new Application(
|
|
87
85
|
projectGroupResolver,
|
|
88
86
|
serverConfig2,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MasterContainer.js","sources":["../../../../packages/engine-http/src/MasterContainer.ts"],"sourcesContent":["import { SystemContainerFactory } from '@contember/engine-system-api'\nimport { TenantContainerFactory } from '@contember/engine-tenant-api'\nimport { Builder } from '@contember/dic'\nimport { ServerConfig } from './config/config'\nimport { ModificationHandlerFactory } from '@contember/schema-migrations'\nimport { Initializer } from './bootstrap'\n\nimport { ProjectContainerFactoryFactory } from './project'\nimport { ProjectConfigResolver } from './config/projectConfigResolver'\nimport { TenantConfigResolver } from './config/tenantConfigResolver'\nimport { ProjectGroupContainerFactory } from './projectGroup/ProjectGroupContainer'\nimport { ProjectGroupResolver } from './projectGroup/ProjectGroupResolver'\nimport { Logger } from '@contember/logger'\nimport { ExecutionContainerFactory, GraphQlSchemaBuilderFactory, PermissionFactory } from '@contember/engine-content-api'\nimport { createProviders, Providers } from './providers'\nimport { TenantApiMiddlewareFactory, TenantGraphQLContextFactory, TenantGraphQLHandlerFactory } from './tenant'\nimport { SystemApiMiddlewareFactory, SystemGraphQLContextFactory, SystemGraphQLHandlerFactory } from './system'\nimport {\n\tContentApiControllerFactory, ContentGraphQLContextFactory, ContentQueryHandlerFactory, GraphQLSchemaContributor, GraphQlSchemaFactory,\n\tGraphQLSchemaFactoryResult, NotModifiedChecker,\n} from './content'\nimport { ProjectContextResolver } from './project-common'\nimport {\n\tContentSchemaTransferMappingFactory,\n\tExportApiControllerFactory,\n\tExportExecutor,\n\tImportApiMiddlewareFactory,\n\tImportExecutor,\n\tSystemSchemaTransferMappingFactory,\n} from './transfer'\nimport { homepageController } from './misc'\nimport { Plugin } from './plugin/Plugin'\nimport { Application } from './application'\nimport { ApplicationWorkerManager } from './workers'\nimport { HttpResponse } from './common'\nimport { ContentQueryExecutorImpl } from './system/ContentQueryExecutor'\nimport { DatabaseMetadataResolver } from '@contember/database'\nimport Koa from 'koa'\nimport { ProjectGroupContainerResolver } from './projectGroup/ProjectGroupContainerResolver'\nimport { PrometheusRegistryFactory } from './prometheus/PrometheusRegistryFactory'\nimport { ProjectGroupContainerMetricsHook } from './prometheus/ProjectGroupContainerMetricsHook'\nimport { createColllectHttpMetricsMiddleware, createShowMetricsMiddleware } from './prometheus'\nimport { createSecretKey } from 'node:crypto'\nimport { CryptoWrapper } from './utils/CryptoWrapper'\nimport { ContentApiSpecificCache } from './content/ContentApiSpecificCache'\nimport { Schema } from '@contember/schema'\n\nexport type ProcessType =\n\t| 'singleNode'\n\t| 'clusterMaster'\n\t| 'clusterWorker'\n\nexport interface MasterContainer {\n\tinitializer: Initializer\n\tapplication: Application\n\tproviders: Providers\n\tapplicationWorkers: ApplicationWorkerManager\n\tmonitoringKoa: Koa\n}\n\nexport interface MasterContainerArgs {\n\tdebugMode: boolean\n\tserverConfig: ServerConfig\n\tprojectConfigResolver: ProjectConfigResolver\n\ttenantConfigResolver: TenantConfigResolver\n\tplugins: Plugin[]\n\tlogger: Logger\n\tversion?: string\n\tprocessType: ProcessType\n}\n\nexport type MasterContainerBuilder = ReturnType<MasterContainerFactory['createBuilderInternal']>\nexport type MasterContainerHook = (builder: MasterContainerBuilder) => MasterContainerBuilder\n\nexport class MasterContainerFactory {\n\n\tcreateBuilder(args: MasterContainerArgs): MasterContainerBuilder {\n\t\tconst builder = this.createBuilderInternal(args)\n\t\tconst hooks = args.plugins\n\t\t\t.map(it => it.getMasterContainerHook?.())\n\t\t\t.filter((it): it is MasterContainerHook => it !== undefined)\n\t\treturn hooks.reduce((acc, cb) => cb(acc), builder)\n\t}\n\n\tcreateBuilderInternal({\n\t\tserverConfig,\n\t\tdebugMode,\n\t\tplugins,\n\t\tprojectConfigResolver,\n\t\ttenantConfigResolver,\n\t\tversion,\n\t\tlogger,\n\t\tprocessType,\n\t}: MasterContainerArgs) {\n\t\treturn new Builder({})\n\t\t\t.addService('serverConfig', () =>\n\t\t\t\tserverConfig)\n\t\t\t.addService('debugMode', () =>\n\t\t\t\tdebugMode)\n\t\t\t.addService('version', () =>\n\t\t\t\tversion)\n\t\t\t.addService('processType', () =>\n\t\t\t\tprocessType)\n\t\t\t.addService('projectConfigResolver', () =>\n\t\t\t\tprojectConfigResolver)\n\t\t\t.addService('tenantConfigResolver', () =>\n\t\t\t\ttenantConfigResolver)\n\t\t\t.addService('plugins', () =>\n\t\t\t\tplugins)\n\t\t\t.addService('providers', () =>\n\t\t\t\tcreateProviders())\n\t\t\t.addService('tenantContainerFactory', ({ providers }) =>\n\t\t\t\tnew TenantContainerFactory(providers))\n\t\t\t.addService('modificationHandlerFactory', () =>\n\t\t\t\tnew ModificationHandlerFactory(ModificationHandlerFactory.defaultFactoryMap))\n\t\t\t.addService('executionContainerFactory', ({ providers }) =>\n\t\t\t\tnew ExecutionContainerFactory(providers))\n\t\t\t.addService('graphQlSchemaBuilderFactory', () =>\n\t\t\t\tnew GraphQlSchemaBuilderFactory())\n\t\t\t.addService('contentQueryExecutor', ({ executionContainerFactory, graphQlSchemaBuilderFactory }) =>\n\t\t\t\tnew ContentQueryExecutorImpl(executionContainerFactory, graphQlSchemaBuilderFactory))\n\t\t\t.addService('systemContainerFactory', ({ providers, modificationHandlerFactory, contentQueryExecutor }) =>\n\t\t\t\tnew SystemContainerFactory(providers, modificationHandlerFactory, contentQueryExecutor))\n\t\t\t.addService('contentPermissionFactory', ({}) =>\n\t\t\t\tnew PermissionFactory())\n\t\t\t.addService('databaseMetadataResolver', () =>\n\t\t\t\tnew DatabaseMetadataResolver())\n\t\t\t.addService('graphqlSchemaCache', ({ serverConfig }) =>\n\t\t\t\tnew ContentApiSpecificCache<Schema, GraphQLSchemaFactoryResult>({\n\t\t\t\t\tttlSeconds: serverConfig.contentApi?.schemaCacheTtlSeconds,\n\t\t\t\t}))\n\t\t\t.addService('graphQlSchemaFactory', ({ plugins, providers, graphqlSchemaCache, contentPermissionFactory, graphQlSchemaBuilderFactory }) => {\n\t\t\t\tconst contributors = plugins\n\t\t\t\t\t.map(it => (it.getSchemaContributor ? it.getSchemaContributor({ providers }) : null))\n\t\t\t\t\t.filter((it): it is GraphQLSchemaContributor => !!it)\n\n\t\t\t\treturn new GraphQlSchemaFactory(\n\t\t\t\t\tgraphqlSchemaCache,\n\t\t\t\t\tgraphQlSchemaBuilderFactory,\n\t\t\t\t\tcontentPermissionFactory,\n\t\t\t\t\tcontributors,\n\t\t\t\t)\n\t\t\t})\n\t\t\t.addService('projectContainerFactoryFactory', ({ plugins, providers, databaseMetadataResolver }) =>\n\t\t\t\tnew ProjectContainerFactoryFactory(plugins, providers, databaseMetadataResolver))\n\t\t\t.addService('tenantGraphQLHandlerFactory', () =>\n\t\t\t\tnew TenantGraphQLHandlerFactory())\n\t\t\t.addService('systemGraphQLHandlerFactory', ({ debugMode }) =>\n\t\t\t\tnew SystemGraphQLHandlerFactory(debugMode))\n\t\t\t.addService('logger', () =>\n\t\t\t\tlogger)\n\t\t\t.addService('projectGroupContainerFactory', ({ debugMode, providers, systemContainerFactory, tenantContainerFactory, projectContainerFactoryFactory, projectConfigResolver, tenantGraphQLHandlerFactory, systemGraphQLHandlerFactory, logger }) =>\n\t\t\t\tnew ProjectGroupContainerFactory(debugMode, providers, systemContainerFactory, tenantContainerFactory, projectContainerFactoryFactory, projectConfigResolver, tenantGraphQLHandlerFactory, systemGraphQLHandlerFactory, logger))\n\t\t\t.addService('projectGroupContainerResolver', ({ tenantConfigResolver, projectGroupContainerFactory }) =>\n\t\t\t\tnew ProjectGroupContainerResolver(tenantConfigResolver, projectGroupContainerFactory))\n\t\t\t.addService('promRegistryFactory', ({ processType, version }) =>\n\t\t\t\tnew PrometheusRegistryFactory(processType, { version }))\n\t\t\t.addService('projectGroupContainerMetricsHook', ({ projectGroupContainerResolver }) =>\n\t\t\t\tnew ProjectGroupContainerMetricsHook(projectGroupContainerResolver))\n\t\t\t.addService('promRegistry', ({ promRegistryFactory, projectGroupContainerMetricsHook }) => {\n\t\t\t\tconst registry = promRegistryFactory.create()\n\t\t\t\tprojectGroupContainerMetricsHook.register(registry)\n\t\t\t\treturn registry\n\t\t\t})\n\t\t\t.addService('projectGroupContainer', ({ tenantConfigResolver, projectGroupContainerFactory }) =>\n\t\t\t\tprojectGroupContainerFactory.create({ slug: undefined, config: tenantConfigResolver(undefined, {}) }))\n\t\t\t.addService('projectGroupResolver', ({ serverConfig, projectGroupContainerResolver }): ProjectGroupResolver => {\n\t\t\t\tconst encryptionKey = serverConfig.projectGroup?.configEncryptionKey\n\t\t\t\t\t? createSecretKey(Buffer.from(serverConfig.projectGroup?.configEncryptionKey, 'hex'))\n\t\t\t\t\t: undefined\n\t\t\t\treturn new ProjectGroupResolver(\n\t\t\t\t\tserverConfig.projectGroup?.domainMapping,\n\t\t\t\t\tserverConfig.projectGroup?.configHeader,\n\t\t\t\t\tserverConfig.projectGroup?.configEncryptionKey ? new CryptoWrapper(encryptionKey) : undefined,\n\t\t\t\t\tprojectGroupContainerResolver,\n\t\t\t\t)\n\n\t\t\t})\n\t\t\t.addService('notModifiedChecker', () =>\n\t\t\t\tnew NotModifiedChecker())\n\t\t\t.addService('contentGraphqlContextFactory', ({ providers, executionContainerFactory }) =>\n\t\t\t\tnew ContentGraphQLContextFactory(providers, executionContainerFactory))\n\t\t\t.addService('contentQueryHandlerFactory', ({ debugMode }) =>\n\t\t\t\tnew ContentQueryHandlerFactory(debugMode))\n\t\t\t.addService('projectContextResolver', () =>\n\t\t\t\tnew ProjectContextResolver())\n\t\t\t.addService('contentApiMiddlewareFactory', ({ projectContextResolver, notModifiedChecker, contentGraphqlContextFactory, contentQueryHandlerFactory, graphQlSchemaFactory }) =>\n\t\t\t\tnew ContentApiControllerFactory(notModifiedChecker, contentGraphqlContextFactory, contentQueryHandlerFactory, projectContextResolver, graphQlSchemaFactory))\n\t\t\t.addService('tenantGraphQLContextFactory', () =>\n\t\t\t\tnew TenantGraphQLContextFactory())\n\t\t\t.addService('tenantApiMiddlewareFactory', ({ debugMode, projectGroupResolver, tenantGraphQLContextFactory }) =>\n\t\t\t\tnew TenantApiMiddlewareFactory(debugMode, projectGroupResolver, tenantGraphQLContextFactory))\n\t\t\t.addService('systemGraphQLContextFactory', () =>\n\t\t\t\tnew SystemGraphQLContextFactory())\n\t\t\t.addService('systemApiMiddlewareFactory', ({ debugMode, systemGraphQLContextFactory, projectContextResolver }) =>\n\t\t\t\tnew SystemApiMiddlewareFactory(debugMode, systemGraphQLContextFactory, projectContextResolver))\n\t\t\t.addService('contentSchemaTransferMappingFactory', () =>\n\t\t\t\tnew ContentSchemaTransferMappingFactory())\n\t\t\t.addService('systemSchemaTransferMappingFactory', () =>\n\t\t\t\tnew SystemSchemaTransferMappingFactory())\n\t\t\t.addService('importExecutor', ({ contentSchemaTransferMappingFactory, systemSchemaTransferMappingFactory, databaseMetadataResolver }) =>\n\t\t\t\tnew ImportExecutor(contentSchemaTransferMappingFactory, systemSchemaTransferMappingFactory, databaseMetadataResolver))\n\t\t\t.addService('exportExecutor', ({ contentSchemaTransferMappingFactory, systemSchemaTransferMappingFactory }) =>\n\t\t\t\tnew ExportExecutor(contentSchemaTransferMappingFactory, systemSchemaTransferMappingFactory))\n\t\t\t.addService('importApiMiddlewareFactory', ({ projectGroupResolver, importExecutor }) =>\n\t\t\t\tnew ImportApiMiddlewareFactory(projectGroupResolver, importExecutor))\n\t\t\t.addService('exportApiMiddlewareFactory', ({ projectGroupResolver, exportExecutor }) =>\n\t\t\t\tnew ExportApiControllerFactory(projectGroupResolver, exportExecutor))\n\t\t\t.addService('application', ({ projectGroupResolver, serverConfig, logger, debugMode, version, promRegistry }) => {\n\t\t\t\tconst app = new Application(\n\t\t\t\t\tprojectGroupResolver,\n\t\t\t\t\tserverConfig,\n\t\t\t\t\tdebugMode,\n\t\t\t\t\tversion,\n\t\t\t\t\tlogger,\n\t\t\t\t)\n\t\t\t\tapp.addMiddleware(createColllectHttpMetricsMiddleware(promRegistry))\n\n\t\t\t\treturn app\n\t\t\t})\n\t\t\t.setupService('application', (it, { contentApiMiddlewareFactory, tenantApiMiddlewareFactory, systemApiMiddlewareFactory, importApiMiddlewareFactory, exportApiMiddlewareFactory }) => {\n\t\t\t\tit.addRoute('content', '/content/:projectSlug/:stageSlug', contentApiMiddlewareFactory.create())\n\t\t\t\tit.addRoute('tenant', '/tenant', tenantApiMiddlewareFactory.create())\n\t\t\t\tit.addRoute('system', '/system/:projectSlug', systemApiMiddlewareFactory.create())\n\t\t\t\tit.addRoute('transfer', '/import', importApiMiddlewareFactory.create())\n\t\t\t\tit.addRoute('transfer', '/export', exportApiMiddlewareFactory.create())\n\t\t\t\tit.addRoute('misc', '/', homepageController)\n\n\t\t\t\tit.addInternalRoute('internal', '/health', () => {\n\t\t\t\t\treturn new HttpResponse(200, 'OK')\n\t\t\t\t})\n\t\t\t})\n\t\t\t.addService('initializer', ({ projectGroupContainer }) =>\n\t\t\t\tnew Initializer(projectGroupContainer))\n\t\t\t.addService('applicationWorkers', () =>\n\t\t\t\tnew ApplicationWorkerManager())\n\t\t\t.setupService('executionContainerFactory', (it, { plugins }) => {\n\t\t\t\tfor (const plugin of plugins) {\n\t\t\t\t\tif (plugin.getExecutionContainerHook) {\n\t\t\t\t\t\tit.hooks.push(plugin.getExecutionContainerHook())\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})\n\t\t\t.addService('monitoringKoa', ({ promRegistry }) => {\n\t\t\t\tconst app = new Koa()\n\t\t\t\tapp.use(createShowMetricsMiddleware(promRegistry))\n\n\t\t\t\treturn app\n\t\t\t})\n\n\t}\n\n\tcreate(args: MasterContainerArgs): MasterContainer {\n\t\tconst container = this.createBuilder(args).build()\n\t\treturn container.pick('initializer', 'application', 'providers', 'applicationWorkers', 'monitoringKoa')\n\t}\n}\n"],"names":["serverConfig","plugins","debugMode","projectConfigResolver","logger","tenantConfigResolver","processType","version"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAAA,IAAA,CACD,EACA,WAAW,eAAe,CAAC,EAAE,sBAC7B,MAAA,IAAI,YAAY,qBAAqB,CAAC,EACtC,WAAW,sBAAsB,MACjC,IAAI,0BAA0B,EAC9B,aAAa,6BAA6B,CAAC,IAAI,EAAE,SAAAH,eAAc;AAC/D,iBAAW,UAAUA,UAAS;AAC7B,YAAI,OAAO,2BAA2B;AACrC,aAAG,MAAM,KAAK,OAAO,0BAAA,CAA2B;AAAA,QAAA;AAAA,MACjD;AAAA,IAED,CAAA,EACA,WAAW,iBAAiB,CAAC,EAAE,mBAAmB;AAC5C,YAAA,MAAM,IAAI,IAAI;AAChB,UAAA,IAAI,4BAA4B,YAAY,CAAC;AAE1C,aAAA;AAAA,IAAA,CACP;AAAA,EAAA;AAAA,EAIH,OAAO,MAA4C;AAClD,UAAM,YAAY,KAAK,cAAc,IAAI,EAAE,MAAM;AACjD,WAAO,UAAU,KAAK,eAAe,eAAe,aAAa,sBAAsB,eAAe;AAAA,EAAA;AAExG;"}
|
|
1
|
+
{"version":3,"file":"MasterContainer.js","sources":["../../../../packages/engine-http/src/MasterContainer.ts"],"sourcesContent":["import { Builder } from '@contember/dic'\nimport { SystemContainerFactory } from '@contember/engine-system-api'\nimport { TenantContainerFactory } from '@contember/engine-tenant-api'\nimport { ModificationHandlerFactory } from '@contember/schema-migrations'\nimport { Initializer } from './bootstrap'\nimport { ServerConfig } from './config/config'\n\nimport { DatabaseMetadataResolver } from '@contember/database'\nimport { ExecutionContainerFactory, GraphQlSchemaBuilderFactory, PermissionFactory } from '@contember/engine-content-api'\nimport { Logger } from '@contember/logger'\nimport { Schema } from '@contember/schema'\nimport Koa from 'koa'\nimport { createSecretKey } from 'node:crypto'\nimport { Application } from './application'\nimport { HttpResponse } from './common'\nimport { ProjectConfigResolver } from './config/projectConfigResolver'\nimport { TenantConfigResolver } from './config/tenantConfigResolver'\nimport {\n\tContentApiControllerFactory,\n\tContentQueryHandlerFactory, GraphQLSchemaContributor, GraphQlSchemaFactory,\n\tGraphQLSchemaFactoryResult, NotModifiedChecker,\n} from './content'\nimport { ContentApiSpecificCache } from './content/ContentApiSpecificCache'\nimport { homepageController } from './misc'\nimport { Plugin } from './plugin/Plugin'\nimport { ProjectContainerFactoryFactory } from './project'\nimport { ProjectContextResolver } from './project-common'\nimport { ProjectGroupContainerFactory } from './projectGroup/ProjectGroupContainer'\nimport { ProjectGroupContainerResolver } from './projectGroup/ProjectGroupContainerResolver'\nimport { ProjectGroupResolver } from './projectGroup/ProjectGroupResolver'\nimport { createColllectHttpMetricsMiddleware, createShowMetricsMiddleware } from './prometheus'\nimport { ProjectGroupContainerMetricsHook } from './prometheus/ProjectGroupContainerMetricsHook'\nimport { PrometheusRegistryFactory } from './prometheus/PrometheusRegistryFactory'\nimport { createProviders, Providers } from './providers'\nimport { SystemApiMiddlewareFactory, SystemGraphQLContextFactory, SystemGraphQLHandlerFactory } from './system'\nimport { ContentQueryExecutorImpl } from './system/ContentQueryExecutor'\nimport { TenantApiMiddlewareFactory, TenantGraphQLHandlerFactory } from './tenant'\nimport {\n\tContentSchemaTransferMappingFactory,\n\tExportApiControllerFactory,\n\tExportExecutor,\n\tImportApiMiddlewareFactory,\n\tImportExecutor,\n\tSystemSchemaTransferMappingFactory,\n} from './transfer'\nimport { CryptoWrapper } from './utils/CryptoWrapper'\nimport { ApplicationWorkerManager } from './workers'\n\nexport type ProcessType =\n\t| 'singleNode'\n\t| 'clusterMaster'\n\t| 'clusterWorker'\n\nexport interface MasterContainer {\n\tinitializer: Initializer\n\tapplication: Application\n\tproviders: Providers\n\tapplicationWorkers: ApplicationWorkerManager\n\tmonitoringKoa: Koa\n}\n\nexport interface MasterContainerArgs {\n\tdebugMode: boolean\n\tserverConfig: ServerConfig\n\tprojectConfigResolver: ProjectConfigResolver\n\ttenantConfigResolver: TenantConfigResolver\n\tplugins: Plugin[]\n\tlogger: Logger\n\tversion?: string\n\tprocessType: ProcessType\n}\n\nexport type MasterContainerBuilder = ReturnType<MasterContainerFactory['createBuilderInternal']>\nexport type MasterContainerHook = (builder: MasterContainerBuilder) => MasterContainerBuilder\n\nexport class MasterContainerFactory {\n\n\tcreateBuilder(args: MasterContainerArgs): MasterContainerBuilder {\n\t\tconst builder = this.createBuilderInternal(args)\n\t\tconst hooks = args.plugins\n\t\t\t.map(it => it.getMasterContainerHook?.())\n\t\t\t.filter((it): it is MasterContainerHook => it !== undefined)\n\t\treturn hooks.reduce((acc, cb) => cb(acc), builder)\n\t}\n\n\tcreateBuilderInternal({\n\t\tserverConfig,\n\t\tdebugMode,\n\t\tplugins,\n\t\tprojectConfigResolver,\n\t\ttenantConfigResolver,\n\t\tversion,\n\t\tlogger,\n\t\tprocessType,\n\t}: MasterContainerArgs) {\n\t\treturn new Builder({})\n\t\t\t.addService('serverConfig', () =>\n\t\t\t\tserverConfig)\n\t\t\t.addService('debugMode', () =>\n\t\t\t\tdebugMode)\n\t\t\t.addService('version', () =>\n\t\t\t\tversion)\n\t\t\t.addService('processType', () =>\n\t\t\t\tprocessType)\n\t\t\t.addService('projectConfigResolver', () =>\n\t\t\t\tprojectConfigResolver)\n\t\t\t.addService('tenantConfigResolver', () =>\n\t\t\t\ttenantConfigResolver)\n\t\t\t.addService('plugins', () =>\n\t\t\t\tplugins)\n\t\t\t.addService('providers', () =>\n\t\t\t\tcreateProviders())\n\t\t\t.addService('tenantContainerFactory', ({ providers }) =>\n\t\t\t\tnew TenantContainerFactory(providers))\n\t\t\t.addService('modificationHandlerFactory', () =>\n\t\t\t\tnew ModificationHandlerFactory(ModificationHandlerFactory.defaultFactoryMap))\n\t\t\t.addService('executionContainerFactory', ({ providers, serverConfig }) =>\n\t\t\t\tnew ExecutionContainerFactory(providers, serverConfig.contentApi?.whereOptimizer))\n\t\t\t.addService('graphQlSchemaBuilderFactory', () =>\n\t\t\t\tnew GraphQlSchemaBuilderFactory())\n\t\t\t.addService('contentQueryExecutor', ({ executionContainerFactory, graphQlSchemaBuilderFactory }) =>\n\t\t\t\tnew ContentQueryExecutorImpl(executionContainerFactory, graphQlSchemaBuilderFactory))\n\t\t\t.addService('systemContainerFactory', ({ providers, modificationHandlerFactory, contentQueryExecutor }) =>\n\t\t\t\tnew SystemContainerFactory(providers, modificationHandlerFactory, contentQueryExecutor))\n\t\t\t.addService('contentPermissionFactory', ({}) =>\n\t\t\t\tnew PermissionFactory())\n\t\t\t.addService('databaseMetadataResolver', () =>\n\t\t\t\tnew DatabaseMetadataResolver())\n\t\t\t.addService('graphqlSchemaCache', ({ serverConfig }) =>\n\t\t\t\tnew ContentApiSpecificCache<Schema, GraphQLSchemaFactoryResult>({\n\t\t\t\t\tttlSeconds: serverConfig.contentApi?.schemaCacheTtlSeconds,\n\t\t\t\t}))\n\t\t\t.addService('graphQlSchemaFactory', ({ plugins, providers, graphqlSchemaCache, contentPermissionFactory, graphQlSchemaBuilderFactory }) => {\n\t\t\t\tconst contributors = plugins\n\t\t\t\t\t.map(it => (it.getSchemaContributor ? it.getSchemaContributor({ providers }) : null))\n\t\t\t\t\t.filter((it): it is GraphQLSchemaContributor => !!it)\n\n\t\t\t\treturn new GraphQlSchemaFactory(\n\t\t\t\t\tgraphqlSchemaCache,\n\t\t\t\t\tgraphQlSchemaBuilderFactory,\n\t\t\t\t\tcontentPermissionFactory,\n\t\t\t\t\tcontributors,\n\t\t\t\t)\n\t\t\t})\n\t\t\t.addService('projectContainerFactoryFactory', ({ plugins, providers, databaseMetadataResolver }) =>\n\t\t\t\tnew ProjectContainerFactoryFactory(plugins, providers, databaseMetadataResolver))\n\t\t\t.addService('tenantGraphQLHandlerFactory', () =>\n\t\t\t\tnew TenantGraphQLHandlerFactory())\n\t\t\t.addService('systemGraphQLHandlerFactory', ({ debugMode }) =>\n\t\t\t\tnew SystemGraphQLHandlerFactory(debugMode))\n\t\t\t.addService('logger', () =>\n\t\t\t\tlogger)\n\t\t\t.addService('projectGroupContainerFactory', ({ debugMode, providers, systemContainerFactory, tenantContainerFactory, projectContainerFactoryFactory, projectConfigResolver, tenantGraphQLHandlerFactory, systemGraphQLHandlerFactory, logger }) =>\n\t\t\t\tnew ProjectGroupContainerFactory(debugMode, providers, systemContainerFactory, tenantContainerFactory, projectContainerFactoryFactory, projectConfigResolver, tenantGraphQLHandlerFactory, systemGraphQLHandlerFactory, logger))\n\t\t\t.addService('projectGroupContainerResolver', ({ tenantConfigResolver, projectGroupContainerFactory }) =>\n\t\t\t\tnew ProjectGroupContainerResolver(tenantConfigResolver, projectGroupContainerFactory))\n\t\t\t.addService('promRegistryFactory', ({ processType, version }) =>\n\t\t\t\tnew PrometheusRegistryFactory(processType, { version }))\n\t\t\t.addService('projectGroupContainerMetricsHook', ({ projectGroupContainerResolver }) =>\n\t\t\t\tnew ProjectGroupContainerMetricsHook(projectGroupContainerResolver))\n\t\t\t.addService('promRegistry', ({ promRegistryFactory, projectGroupContainerMetricsHook }) => {\n\t\t\t\tconst registry = promRegistryFactory.create()\n\t\t\t\tprojectGroupContainerMetricsHook.register(registry)\n\t\t\t\treturn registry\n\t\t\t})\n\t\t\t.addService('projectGroupContainer', ({ tenantConfigResolver, projectGroupContainerFactory }) =>\n\t\t\t\tprojectGroupContainerFactory.create({ slug: undefined, config: tenantConfigResolver(undefined, {}) }))\n\t\t\t.addService('projectGroupResolver', ({ serverConfig, projectGroupContainerResolver }): ProjectGroupResolver => {\n\t\t\t\tconst encryptionKey = serverConfig.projectGroup?.configEncryptionKey\n\t\t\t\t\t? createSecretKey(Buffer.from(serverConfig.projectGroup?.configEncryptionKey, 'hex'))\n\t\t\t\t\t: undefined\n\t\t\t\treturn new ProjectGroupResolver(\n\t\t\t\t\tserverConfig.projectGroup?.domainMapping,\n\t\t\t\t\tserverConfig.projectGroup?.configHeader,\n\t\t\t\t\tserverConfig.projectGroup?.configEncryptionKey ? new CryptoWrapper(encryptionKey) : undefined,\n\t\t\t\t\tprojectGroupContainerResolver,\n\t\t\t\t)\n\n\t\t\t})\n\t\t\t.addService('notModifiedChecker', () =>\n\t\t\t\tnew NotModifiedChecker())\n\t\t\t.addService('contentQueryHandlerFactory', ({ debugMode }) =>\n\t\t\t\tnew ContentQueryHandlerFactory(debugMode))\n\t\t\t.addService('projectContextResolver', () =>\n\t\t\t\tnew ProjectContextResolver())\n\t\t\t.addService('contentApiMiddlewareFactory', ({ projectContextResolver, notModifiedChecker, executionContainerFactory, contentQueryHandlerFactory, graphQlSchemaFactory }) =>\n\t\t\t\tnew ContentApiControllerFactory(notModifiedChecker, executionContainerFactory, contentQueryHandlerFactory, projectContextResolver, graphQlSchemaFactory))\n\t\t\t.addService('tenantApiMiddlewareFactory', () =>\n\t\t\t\tnew TenantApiMiddlewareFactory())\n\t\t\t.addService('systemGraphQLContextFactory', () =>\n\t\t\t\tnew SystemGraphQLContextFactory())\n\t\t\t.addService('systemApiMiddlewareFactory', ({ debugMode, systemGraphQLContextFactory, projectContextResolver }) =>\n\t\t\t\tnew SystemApiMiddlewareFactory(debugMode, systemGraphQLContextFactory, projectContextResolver))\n\t\t\t.addService('contentSchemaTransferMappingFactory', () =>\n\t\t\t\tnew ContentSchemaTransferMappingFactory())\n\t\t\t.addService('systemSchemaTransferMappingFactory', () =>\n\t\t\t\tnew SystemSchemaTransferMappingFactory())\n\t\t\t.addService('importExecutor', ({ contentSchemaTransferMappingFactory, systemSchemaTransferMappingFactory, databaseMetadataResolver }) =>\n\t\t\t\tnew ImportExecutor(contentSchemaTransferMappingFactory, systemSchemaTransferMappingFactory, databaseMetadataResolver))\n\t\t\t.addService('exportExecutor', ({ contentSchemaTransferMappingFactory, systemSchemaTransferMappingFactory }) =>\n\t\t\t\tnew ExportExecutor(contentSchemaTransferMappingFactory, systemSchemaTransferMappingFactory))\n\t\t\t.addService('importApiMiddlewareFactory', ({ projectGroupResolver, importExecutor }) =>\n\t\t\t\tnew ImportApiMiddlewareFactory(projectGroupResolver, importExecutor))\n\t\t\t.addService('exportApiMiddlewareFactory', ({ projectGroupResolver, exportExecutor }) =>\n\t\t\t\tnew ExportApiControllerFactory(projectGroupResolver, exportExecutor))\n\t\t\t.addService('application', ({ projectGroupResolver, serverConfig, logger, debugMode, version, promRegistry }) => {\n\t\t\t\tconst app = new Application(\n\t\t\t\t\tprojectGroupResolver,\n\t\t\t\t\tserverConfig,\n\t\t\t\t\tdebugMode,\n\t\t\t\t\tversion,\n\t\t\t\t\tlogger,\n\t\t\t\t)\n\t\t\t\tapp.addMiddleware(createColllectHttpMetricsMiddleware(promRegistry))\n\n\t\t\t\treturn app\n\t\t\t})\n\t\t\t.setupService('application', (it, { contentApiMiddlewareFactory, tenantApiMiddlewareFactory, systemApiMiddlewareFactory, importApiMiddlewareFactory, exportApiMiddlewareFactory }) => {\n\t\t\t\tit.addRoute('content', '/content/:projectSlug/:stageSlug', contentApiMiddlewareFactory.create())\n\t\t\t\tit.addRoute('tenant', '/tenant', tenantApiMiddlewareFactory.create())\n\t\t\t\tit.addRoute('system', '/system/:projectSlug', systemApiMiddlewareFactory.create())\n\t\t\t\tit.addRoute('transfer', '/import', importApiMiddlewareFactory.create())\n\t\t\t\tit.addRoute('transfer', '/export', exportApiMiddlewareFactory.create())\n\t\t\t\tit.addRoute('misc', '/', homepageController)\n\n\t\t\t\tit.addInternalRoute('internal', '/health', () => {\n\t\t\t\t\treturn new HttpResponse(200, 'OK')\n\t\t\t\t})\n\t\t\t})\n\t\t\t.addService('initializer', ({ projectGroupContainer }) =>\n\t\t\t\tnew Initializer(projectGroupContainer))\n\t\t\t.addService('applicationWorkers', () =>\n\t\t\t\tnew ApplicationWorkerManager())\n\t\t\t.setupService('executionContainerFactory', (it, { plugins }) => {\n\t\t\t\tfor (const plugin of plugins) {\n\t\t\t\t\tif (plugin.getExecutionContainerHook) {\n\t\t\t\t\t\tit.hooks.push(plugin.getExecutionContainerHook())\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})\n\t\t\t.addService('monitoringKoa', ({ promRegistry }) => {\n\t\t\t\tconst app = new Koa()\n\t\t\t\tapp.use(createShowMetricsMiddleware(promRegistry))\n\n\t\t\t\treturn app\n\t\t\t})\n\n\t}\n\n\tcreate(args: MasterContainerArgs): MasterContainer {\n\t\tconst container = this.createBuilder(args).build()\n\t\treturn container.pick('initializer', 'application', 'providers', 'applicationWorkers', 'monitoringKoa')\n\t}\n}\n"],"names":["serverConfig","plugins","debugMode","projectConfigResolver","logger","tenantConfigResolver","processType","version"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2EO,MAAM,uBAAuB;AAAA,EAEnC,cAAc,MAAmD;AAC1D,UAAA,UAAU,KAAK,sBAAsB,IAAI;AAC/C,UAAM,QAAQ,KAAK,QACjB,IAAI,CAAM,OAAA,GAAG,yBAA0B,CAAA,EACvC,OAAO,CAAC,OAAkC,OAAO,MAAS;AACrD,WAAA,MAAM,OAAO,CAAC,KAAK,OAAO,GAAG,GAAG,GAAG,OAAO;AAAA,EAAA;AAAA,EAGlD,sBAAsB;AAAA,IACrB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,GACuB;AACvB,WAAO,IAAI,QAAQ,EAAE,EACnB,WAAW,gBAAgB,MAC3B,YAAY,EACZ,WAAW,aAAa,MACxB,SAAS,EACT,WAAW,WAAW,MACtB,OAAO,EACP,WAAW,eAAe,MAC1B,WAAW,EACX,WAAW,yBAAyB,MACpC,qBAAqB,EACrB,WAAW,wBAAwB,MACnC,oBAAoB,EACpB,WAAW,WAAW,MACtB,OAAO,EACP,WAAW,aAAa,MACxB,gBAAiB,CAAA,EACjB,WAAW,0BAA0B,CAAC,EAAE,UAAU,MAClD,IAAI,uBAAuB,SAAS,CAAC,EACrC,WAAW,8BAA8B,MACzC,IAAI,2BAA2B,2BAA2B,iBAAiB,CAAC,EAC5E,WAAW,6BAA6B,CAAC,EAAE,WAAW,cAAAA,cAAa,MACnE,IAAI,0BAA0B,WAAWA,cAAa,YAAY,cAAc,CAAC,EACjF,WAAW,+BAA+B,MAC1C,IAAI,6BAA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