@getstrata/bootstrap 0.2.21 → 0.2.23
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/bootstrap/applicationRegistry.d.ts +1 -1
- package/dist/bootstrap/buildModuleRoutes.d.ts +10 -0
- package/dist/bootstrap/config.d.ts +1 -1
- package/dist/bootstrap/contracts.d.ts +4 -4
- package/dist/bootstrap/discoverModules.d.ts +7 -3
- package/dist/bootstrap/modules.d.ts +1 -1
- package/dist/bootstrap/public-api.d.ts +4 -0
- package/dist/entries/applicationRegistry.js +12 -115
- package/dist/entries/buildModuleRoutes.js +626 -0
- package/dist/entries/cache/modelCacheTags.js +56 -2
- package/dist/entries/config.js +9 -9
- package/dist/entries/context.js +177 -187
- package/dist/entries/contracts.js +10 -85
- package/dist/entries/createWebRoutes.js +68 -14
- package/dist/entries/dependencies.js +177 -187
- package/dist/entries/discoverModules.js +65 -0
- package/dist/entries/http/securedRouteModelBinding.js +4 -34
- package/dist/entries/httpKernel.js +9 -9
- package/dist/entries/membershipService.js +0 -34
- package/dist/entries/providers/view.js +9 -9
- package/dist/entries/providers.js +156 -113
- package/dist/entries/queue/defaultJobs.js +0 -34
- package/dist/entries/web/routing.js +20 -41
- package/dist/index.js +3830 -3762
- package/package.json +14 -4
- package/dist/cli/commands/scheduleRun.d.ts +0 -3
- package/dist/config/app.d.ts +0 -10
- package/dist/config/auth.d.ts +0 -7
- package/dist/config/contentSecurityPolicy.d.ts +0 -5
- package/dist/config/cors.d.ts +0 -9
- package/dist/config/database.d.ts +0 -10
- package/dist/config/features.d.ts +0 -18
- package/dist/config/frontend.d.ts +0 -6
- package/dist/config/queue.d.ts +0 -8
- package/dist/config/rateLimit.d.ts +0 -10
- package/dist/config/uploads.d.ts +0 -5
- package/dist/core/admin/formatValue.d.ts +0 -3
- package/dist/core/admin/index.d.ts +0 -3
- package/dist/core/admin/registry.d.ts +0 -11
- package/dist/core/admin/types.d.ts +0 -24
- package/dist/core/audit/exportAuditLogs.d.ts +0 -8
- package/dist/core/audit/siemFormatter.d.ts +0 -30
- package/dist/core/auth/abilityChecker.d.ts +0 -6
- package/dist/core/auth/accessControl.d.ts +0 -8
- package/dist/core/auth/authContext.d.ts +0 -11
- package/dist/core/auth/guard.d.ts +0 -36
- package/dist/core/auth/membershipContext.d.ts +0 -15
- package/dist/core/auth/membershipContextMiddleware.d.ts +0 -3
- package/dist/core/auth/membershipMiddleware.d.ts +0 -2
- package/dist/core/auth/membershipScope.d.ts +0 -16
- package/dist/core/auth/membershipService.d.ts +0 -23
- package/dist/core/auth/oauth/oidcProvider.d.ts +0 -18
- package/dist/core/auth/oauth/providers.d.ts +0 -22
- package/dist/core/auth/oauth/samlProvider.d.ts +0 -9
- package/dist/core/auth/oauth/types.d.ts +0 -11
- package/dist/core/auth/password.d.ts +0 -3
- package/dist/core/auth/policy.d.ts +0 -15
- package/dist/core/auth/resolveMembershipService.d.ts +0 -3
- package/dist/core/auth/scimAuthMiddleware.d.ts +0 -3
- package/dist/core/auth/sessionCookie.d.ts +0 -6
- package/dist/core/auth/sessionGuard.d.ts +0 -9
- package/dist/core/auth/tokenHash.d.ts +0 -3
- package/dist/core/cache/createCacheStore.d.ts +0 -11
- package/dist/core/cache/redisCacheStore.d.ts +0 -23
- package/dist/core/cache/repository.d.ts +0 -17
- package/dist/core/cache/simpleCache.d.ts +0 -23
- package/dist/core/cache/simpleCacheStore.d.ts +0 -16
- package/dist/core/cache/store.d.ts +0 -12
- package/dist/core/cache/taggedCache.d.ts +0 -9
- package/dist/core/cache/tags.d.ts +0 -11
- package/dist/core/config/envSchema.d.ts +0 -12
- package/dist/core/contracts/container.d.ts +0 -30
- package/dist/core/contracts/di.d.ts +0 -31
- package/dist/core/contracts/serviceContainer.d.ts +0 -1
- package/dist/core/contracts/serviceTokens.d.ts +0 -8
- package/dist/core/crypto/fieldEncryption.d.ts +0 -13
- package/dist/core/crypto/mfaSecret.d.ts +0 -3
- package/dist/core/crypto/nonCryptographicHash.d.ts +0 -2
- package/dist/core/database/baseRepository.d.ts +0 -67
- package/dist/core/database/bindConnection.d.ts +0 -3
- package/dist/core/database/boundConnection.d.ts +0 -5
- package/dist/core/database/connection.d.ts +0 -7
- package/dist/core/database/connectionContext.d.ts +0 -8
- package/dist/core/database/defaultConnection.d.ts +0 -6
- package/dist/core/database/errors.d.ts +0 -12
- package/dist/core/database/index.d.ts +0 -18
- package/dist/core/database/migrations/advisoryLock.d.ts +0 -6
- package/dist/core/database/migrations/runner.d.ts +0 -25
- package/dist/core/database/migrations/types.d.ts +0 -15
- package/dist/core/database/model.d.ts +0 -57
- package/dist/core/database/query.d.ts +0 -63
- package/dist/core/database/queryProxy.d.ts +0 -3
- package/dist/core/database/relationships.d.ts +0 -100
- package/dist/core/database/repositoryConnection.d.ts +0 -4
- package/dist/core/database/repositoryQuery.d.ts +0 -38
- package/dist/core/database/schema/blueprint.d.ts +0 -47
- package/dist/core/database/schema/columnDefinition.d.ts +0 -36
- package/dist/core/database/schema/driver.d.ts +0 -8
- package/dist/core/database/schema/errors.d.ts +0 -4
- package/dist/core/database/schema/grammars/compileStatements.d.ts +0 -8
- package/dist/core/database/schema/grammars/createGrammar.d.ts +0 -4
- package/dist/core/database/schema/grammars/grammar.d.ts +0 -10
- package/dist/core/database/schema/grammars/index.d.ts +0 -7
- package/dist/core/database/schema/grammars/mysqlGrammar.d.ts +0 -2
- package/dist/core/database/schema/grammars/postgresGrammar.d.ts +0 -2
- package/dist/core/database/schema/grammars/sqliteGrammar.d.ts +0 -2
- package/dist/core/database/schema/index.d.ts +0 -12
- package/dist/core/database/schema/schema.d.ts +0 -21
- package/dist/core/database/seeders/runner.d.ts +0 -6
- package/dist/core/database/seeders/types.d.ts +0 -8
- package/dist/core/database/table.d.ts +0 -13
- package/dist/core/database/transaction.d.ts +0 -3
- package/dist/core/database/types.d.ts +0 -66
- package/dist/core/database/whereBuilder.d.ts +0 -17
- package/dist/core/errors/http.d.ts +0 -33
- package/dist/core/events/eventBus.d.ts +0 -10
- package/dist/core/events/index.d.ts +0 -4
- package/dist/core/facades/index.d.ts +0 -10
- package/dist/core/http/authMiddleware.d.ts +0 -5
- package/dist/core/http/authorizeMiddleware.d.ts +0 -5
- package/dist/core/http/bodySizeLimitMiddleware.d.ts +0 -4
- package/dist/core/http/conditionalResponse.d.ts +0 -2
- package/dist/core/http/contentNegotiation.d.ts +0 -2
- package/dist/core/http/cookies.d.ts +0 -4
- package/dist/core/http/corsMiddleware.d.ts +0 -3
- package/dist/core/http/csrfMiddleware.d.ts +0 -3
- package/dist/core/http/csrfProtection.d.ts +0 -12
- package/dist/core/http/csrfToken.d.ts +0 -14
- package/dist/core/http/etag.d.ts +0 -18
- package/dist/core/http/flashMiddleware.d.ts +0 -3
- package/dist/core/http/flashSession.d.ts +0 -12
- package/dist/core/http/formRequest.d.ts +0 -10
- package/dist/core/http/index.d.ts +0 -27
- package/dist/core/http/loginThrottleMiddleware.d.ts +0 -11
- package/dist/core/http/memoryThrottleMiddleware.d.ts +0 -9
- package/dist/core/http/metricsMiddleware.d.ts +0 -4
- package/dist/core/http/middleware.d.ts +0 -8
- package/dist/core/http/pagination.d.ts +0 -11
- package/dist/core/http/parseFormBody.d.ts +0 -6
- package/dist/core/http/parseMultipartUpload.d.ts +0 -10
- package/dist/core/http/requestMetaContext.d.ts +0 -15
- package/dist/core/http/requireAbilityMiddleware.d.ts +0 -4
- package/dist/core/http/requireAuthMiddleware.d.ts +0 -4
- package/dist/core/http/requireGlobalAdminMiddleware.d.ts +0 -3
- package/dist/core/http/requireWebAuthMiddleware.d.ts +0 -4
- package/dist/core/http/resources.d.ts +0 -7
- package/dist/core/http/route.d.ts +0 -6
- package/dist/core/http/routeMiddleware.d.ts +0 -3
- package/dist/core/http/routeModelBinding.d.ts +0 -3
- package/dist/core/http/scimThrottleMiddleware.d.ts +0 -9
- package/dist/core/http/securedRouteModelBinding.d.ts +0 -11
- package/dist/core/http/securityHeadersMiddleware.d.ts +0 -3
- package/dist/core/http/throttleMiddleware.d.ts +0 -11
- package/dist/core/http/validation.d.ts +0 -23
- package/dist/core/http/webErrorResponse.d.ts +0 -5
- package/dist/core/http/webFormRequest.d.ts +0 -7
- package/dist/core/jobs/dispatchWebhookJob.d.ts +0 -13
- package/dist/core/jobs/invalidateCacheTagsJob.d.ts +0 -12
- package/dist/core/lifecycle/gracefulShutdown.d.ts +0 -6
- package/dist/core/logging/logger.d.ts +0 -17
- package/dist/core/logging/requestLoggingMiddleware.d.ts +0 -3
- package/dist/core/mail/mailer.d.ts +0 -38
- package/dist/core/mail/markdownMail.d.ts +0 -15
- package/dist/core/mail/markdownMailable.d.ts +0 -12
- package/dist/core/metrics/prometheus.d.ts +0 -26
- package/dist/core/notifications/dispatcher.d.ts +0 -13
- package/dist/core/notifications/index.d.ts +0 -3
- package/dist/core/notifications/notification.d.ts +0 -7
- package/dist/core/notifications/types.d.ts +0 -25
- package/dist/core/openapi/registeredRoute.d.ts +0 -6
- package/dist/core/pagination/index.d.ts +0 -27
- package/dist/core/queue/createAppQueue.d.ts +0 -5
- package/dist/core/queue/failedJobRepository.d.ts +0 -6
- package/dist/core/queue/failedJobService.d.ts +0 -16
- package/dist/core/queue/failedJobTable.d.ts +0 -3
- package/dist/core/queue/index.d.ts +0 -19
- package/dist/core/queue/jobRegistry.d.ts +0 -13
- package/dist/core/queue/jobRunner.d.ts +0 -9
- package/dist/core/queue/publicQueue.d.ts +0 -16
- package/dist/core/queue/queueMetrics.d.ts +0 -15
- package/dist/core/queue/redisQueue.d.ts +0 -29
- package/dist/core/queue/resilientQueue.d.ts +0 -9
- package/dist/core/queue/types.d.ts +0 -8
- package/dist/core/runtime/applicationRegistry.d.ts +0 -17
- package/dist/core/runtime/asyncContextStore.d.ts +0 -3
- package/dist/core/scheduler/schedule.d.ts +0 -15
- package/dist/core/security/publicReads.d.ts +0 -3
- package/dist/core/security/safeFetch.d.ts +0 -10
- package/dist/core/security/safeUrl.d.ts +0 -20
- package/dist/core/security/scimTenantTokens.d.ts +0 -3
- package/dist/core/security/securityEvents.d.ts +0 -6
- package/dist/core/security/timingSafeCompare.d.ts +0 -2
- package/dist/core/security/tokenExpiry.d.ts +0 -2
- package/dist/core/security/totp.d.ts +0 -3
- package/dist/core/storage/storage.d.ts +0 -44
- package/dist/core/tenant/databaseTenantContext.d.ts +0 -2
- package/dist/core/tenant/resolveTenant.d.ts +0 -3
- package/dist/core/tenant/tenantContext.d.ts +0 -13
- package/dist/core/tenant/tenantDatabaseScope.d.ts +0 -8
- package/dist/core/tenant/tenantMiddleware.d.ts +0 -6
- package/dist/core/tracing/otel.d.ts +0 -26
- package/dist/core/tracing/traceContext.d.ts +0 -9
- package/dist/core/tracing/tracingMiddleware.d.ts +0 -3
- package/dist/core/validation/rules.d.ts +0 -17
- package/dist/core/view/etaViewEngine.d.ts +0 -15
- package/dist/core/view/htmlResponse.d.ts +0 -6
- package/dist/core/view/index.d.ts +0 -5
- package/dist/core/view/viewEngine.d.ts +0 -6
- package/dist/core/view/webLayoutData.d.ts +0 -17
- package/dist/db/connection/createConnection.d.ts +0 -6
- package/dist/db/connection/index.d.ts +0 -11
- package/dist/domain/abilities.d.ts +0 -5
- package/dist/domain/auth.d.ts +0 -4
- package/dist/domain/scim.d.ts +0 -9
- package/dist/domain/workhub.d.ts +0 -35
- package/dist/framework/public-api.d.ts +0 -116
- package/dist/modules/organization/memberRepository.d.ts +0 -14
- package/dist/modules/organization/memberTypes.d.ts +0 -9
- package/dist/modules/organization/repository.d.ts +0 -14
- package/dist/modules/organization/table.d.ts +0 -3
- package/dist/modules/organization/types.d.ts +0 -10
- package/dist/modules/scim/controller.d.ts +0 -16
- package/dist/modules/scim/scimResponse.d.ts +0 -10
- package/dist/modules/scim/service.d.ts +0 -214
- package/dist/modules/user/apiTokenRepository.d.ts +0 -8
- package/dist/modules/user/apiTokenTable.d.ts +0 -3
- package/dist/modules/user/authService.d.ts +0 -23
- package/dist/modules/user/notificationRepository.d.ts +0 -6
- package/dist/modules/user/notificationService.d.ts +0 -25
- package/dist/modules/user/notificationTable.d.ts +0 -3
- package/dist/modules/user/notificationTypes.d.ts +0 -12
- package/dist/modules/user/oauthIdentityRepository.d.ts +0 -9
- package/dist/modules/user/provider.d.ts +0 -11
- package/dist/modules/user/repository.d.ts +0 -13
- package/dist/modules/user/table.d.ts +0 -3
- package/dist/modules/user/tokenService.d.ts +0 -29
- package/dist/modules/user/types.d.ts +0 -46
- package/dist/types/services.d.ts +0 -16
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// ../../src/core/contracts/di.ts
|
|
3
|
-
var requiredDependencyKeys = [
|
|
4
|
-
"container",
|
|
5
|
-
"cache",
|
|
6
|
-
"storage"
|
|
7
|
-
];
|
|
8
3
|
function getRequiredDependency(dependencies, key) {
|
|
9
4
|
const dependency = dependencies[key];
|
|
10
5
|
if (dependency === undefined) {
|
|
@@ -12,23 +7,10 @@ function getRequiredDependency(dependencies, key) {
|
|
|
12
7
|
}
|
|
13
8
|
return dependency;
|
|
14
9
|
}
|
|
15
|
-
function assertAppDependenciesComplete(dependencies) {
|
|
16
|
-
for (const key of requiredDependencyKeys) {
|
|
17
|
-
getRequiredDependency(dependencies, key);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
function resolveService(dependencies, token) {
|
|
21
|
-
return dependencies.container.resolve(token);
|
|
22
|
-
}
|
|
23
10
|
|
|
24
11
|
// ../../src/core/contracts/serviceTokens.ts
|
|
25
|
-
var CORE_CONFIG_TOKEN = "core.config";
|
|
26
|
-
var CORE_CACHE_TOKEN = "core.cache";
|
|
27
|
-
var CORE_QUEUE_TOKEN = "core.queue";
|
|
28
|
-
var CORE_EVENT_BUS_TOKEN = "core.eventBus";
|
|
29
12
|
var CORE_POLICY_GATE_TOKEN = "core.policyGate";
|
|
30
13
|
var CORE_AUTH_TOKEN = "core.auth";
|
|
31
|
-
var CORE_TOKEN_SERVICE_TOKEN = "core.tokenService";
|
|
32
14
|
|
|
33
15
|
// ../../src/core/logging/logger.ts
|
|
34
16
|
class Logger {
|
|
@@ -79,10 +61,6 @@ function readStoredApplicationContext() {
|
|
|
79
61
|
}
|
|
80
62
|
return activeContext;
|
|
81
63
|
}
|
|
82
|
-
function setActiveApplicationContext(context) {
|
|
83
|
-
activeContext = context;
|
|
84
|
-
globalThis[APPLICATION_CONTEXT_KEY] = context;
|
|
85
|
-
}
|
|
86
64
|
function requireActiveApplicationContext() {
|
|
87
65
|
const context = readStoredApplicationContext();
|
|
88
66
|
if (!context) {
|
|
@@ -93,24 +71,12 @@ function requireActiveApplicationContext() {
|
|
|
93
71
|
function resolveApplicationCache() {
|
|
94
72
|
return getRequiredDependency(requireActiveApplicationContext().dependencies, "cache");
|
|
95
73
|
}
|
|
96
|
-
function resolveApplicationQueue() {
|
|
97
|
-
return requireActiveApplicationContext().container.resolve(CORE_QUEUE_TOKEN);
|
|
98
|
-
}
|
|
99
|
-
function resolveApplicationEventBus() {
|
|
100
|
-
return requireActiveApplicationContext().container.resolve(CORE_EVENT_BUS_TOKEN);
|
|
101
|
-
}
|
|
102
74
|
function resolveApplicationAuth() {
|
|
103
75
|
return requireActiveApplicationContext().container.resolve(CORE_AUTH_TOKEN);
|
|
104
76
|
}
|
|
105
77
|
function resolveApplicationPolicyGate() {
|
|
106
78
|
return requireActiveApplicationContext().container.resolve(CORE_POLICY_GATE_TOKEN);
|
|
107
79
|
}
|
|
108
|
-
function resolveApplicationConfig() {
|
|
109
|
-
return requireActiveApplicationContext().config;
|
|
110
|
-
}
|
|
111
|
-
function resolveApplicationLogger() {
|
|
112
|
-
return appLogger;
|
|
113
|
-
}
|
|
114
80
|
function resolveApplicationDependencies() {
|
|
115
81
|
return requireActiveApplicationContext().dependencies;
|
|
116
82
|
}
|
|
@@ -79,16 +79,16 @@ function htmlResponse(html, init = {}) {
|
|
|
79
79
|
}
|
|
80
80
|
});
|
|
81
81
|
}
|
|
82
|
-
// ../../src/core/contracts/serviceTokens.ts
|
|
83
|
-
var CORE_CONFIG_TOKEN = "core.config";
|
|
84
|
-
var CORE_CACHE_TOKEN = "core.cache";
|
|
85
|
-
var CORE_QUEUE_TOKEN = "core.queue";
|
|
86
|
-
var CORE_EVENT_BUS_TOKEN = "core.eventBus";
|
|
87
|
-
var CORE_POLICY_GATE_TOKEN = "core.policyGate";
|
|
88
|
-
var CORE_AUTH_TOKEN = "core.auth";
|
|
89
|
-
var CORE_TOKEN_SERVICE_TOKEN = "core.tokenService";
|
|
90
|
-
|
|
91
82
|
// ../../src/bootstrap/config.ts
|
|
83
|
+
import {
|
|
84
|
+
CORE_AUTH_TOKEN,
|
|
85
|
+
CORE_CACHE_TOKEN,
|
|
86
|
+
CORE_CONFIG_TOKEN,
|
|
87
|
+
CORE_EVENT_BUS_TOKEN,
|
|
88
|
+
CORE_POLICY_GATE_TOKEN,
|
|
89
|
+
CORE_QUEUE_TOKEN,
|
|
90
|
+
CORE_TOKEN_SERVICE_TOKEN
|
|
91
|
+
} from "@getstrata/core/contracts/serviceTokens.ts";
|
|
92
92
|
var APP_PORT_CONFIG_KEY = "app.port";
|
|
93
93
|
var CACHE_TTL_MS_CONFIG_KEY = "cache.ttlMs";
|
|
94
94
|
var CACHE_MAX_ENTRIES_CONFIG_KEY = "cache.maxEntries";
|
|
@@ -43,16 +43,16 @@ function resolveAbilitiesForRole(role) {
|
|
|
43
43
|
return [...MEMBER_ABILITIES];
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
// ../../src/core/contracts/serviceTokens.ts
|
|
47
|
-
var CORE_CONFIG_TOKEN = "core.config";
|
|
48
|
-
var CORE_CACHE_TOKEN = "core.cache";
|
|
49
|
-
var CORE_QUEUE_TOKEN = "core.queue";
|
|
50
|
-
var CORE_EVENT_BUS_TOKEN = "core.eventBus";
|
|
51
|
-
var CORE_POLICY_GATE_TOKEN = "core.policyGate";
|
|
52
|
-
var CORE_AUTH_TOKEN = "core.auth";
|
|
53
|
-
var CORE_TOKEN_SERVICE_TOKEN = "core.tokenService";
|
|
54
|
-
|
|
55
46
|
// ../../src/bootstrap/config.ts
|
|
47
|
+
import {
|
|
48
|
+
CORE_AUTH_TOKEN,
|
|
49
|
+
CORE_CACHE_TOKEN,
|
|
50
|
+
CORE_CONFIG_TOKEN,
|
|
51
|
+
CORE_EVENT_BUS_TOKEN,
|
|
52
|
+
CORE_POLICY_GATE_TOKEN,
|
|
53
|
+
CORE_QUEUE_TOKEN,
|
|
54
|
+
CORE_TOKEN_SERVICE_TOKEN
|
|
55
|
+
} from "@getstrata/core/contracts/serviceTokens.ts";
|
|
56
56
|
var APP_PORT_CONFIG_KEY = "app.port";
|
|
57
57
|
var CACHE_TTL_MS_CONFIG_KEY = "cache.ttlMs";
|
|
58
58
|
var CACHE_MAX_ENTRIES_CONFIG_KEY = "cache.maxEntries";
|
|
@@ -3244,116 +3244,77 @@ function createAppQueue(driver, redisUrl, failedJobs = createFailedJobService(),
|
|
|
3244
3244
|
});
|
|
3245
3245
|
}
|
|
3246
3246
|
|
|
3247
|
-
// ../../src/
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3247
|
+
// ../../src/bootstrap/applicationRegistry.ts
|
|
3248
|
+
import {
|
|
3249
|
+
resolveApplicationAuth,
|
|
3250
|
+
resolveApplicationCache,
|
|
3251
|
+
resolveApplicationConfig,
|
|
3252
|
+
resolveApplicationDependencies,
|
|
3253
|
+
resolveApplicationEventBus,
|
|
3254
|
+
resolveApplicationLogger,
|
|
3255
|
+
resolveApplicationPolicyGate,
|
|
3256
|
+
resolveApplicationQueue,
|
|
3257
|
+
setActiveApplicationContext
|
|
3258
|
+
} from "@getstrata/core/runtime/applicationRegistry.ts";
|
|
3259
|
+
|
|
3260
|
+
// ../../src/bootstrap/discoverModules.ts
|
|
3261
|
+
import { readdirSync as readdirSync2 } from "fs";
|
|
3262
|
+
import { join as join2 } from "path";
|
|
3263
|
+
import { pathToFileURL as pathToFileURL2 } from "url";
|
|
3264
|
+
var DISCOVER_MODULES_STATE_KEY = Symbol.for("@getstrata/discoverModulesState");
|
|
3265
|
+
function readDiscoverModulesState() {
|
|
3266
|
+
const existing = globalThis[DISCOVER_MODULES_STATE_KEY];
|
|
3267
|
+
if (existing) {
|
|
3268
|
+
return existing;
|
|
3263
3269
|
}
|
|
3270
|
+
const state = { appModules: [] };
|
|
3271
|
+
globalThis[DISCOVER_MODULES_STATE_KEY] = state;
|
|
3272
|
+
return state;
|
|
3264
3273
|
}
|
|
3265
|
-
function
|
|
3266
|
-
|
|
3274
|
+
function configureModulesDirectory(modulesDir) {
|
|
3275
|
+
readDiscoverModulesState().configuredModulesDir = modulesDir;
|
|
3267
3276
|
}
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
constructor(channel = "app") {
|
|
3273
|
-
this.channel = channel;
|
|
3274
|
-
}
|
|
3275
|
-
write(level, message, context = {}) {
|
|
3276
|
-
const entry = {
|
|
3277
|
-
level,
|
|
3278
|
-
channel: this.channel,
|
|
3279
|
-
message,
|
|
3280
|
-
timestamp: new Date().toISOString(),
|
|
3281
|
-
...context
|
|
3282
|
-
};
|
|
3283
|
-
const line = JSON.stringify(entry);
|
|
3284
|
-
if (level === "error") {
|
|
3285
|
-
console.error(line);
|
|
3286
|
-
return;
|
|
3287
|
-
}
|
|
3288
|
-
console.log(line);
|
|
3277
|
+
function resolveModulesDirectory(options) {
|
|
3278
|
+
const state = readDiscoverModulesState();
|
|
3279
|
+
if (options?.modulesDir) {
|
|
3280
|
+
return options.modulesDir;
|
|
3289
3281
|
}
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
}
|
|
3293
|
-
info(message, context) {
|
|
3294
|
-
this.write("info", message, context);
|
|
3295
|
-
}
|
|
3296
|
-
warn(message, context) {
|
|
3297
|
-
this.write("warn", message, context);
|
|
3298
|
-
}
|
|
3299
|
-
error(message, context) {
|
|
3300
|
-
this.write("error", message, context);
|
|
3282
|
+
if (state.configuredModulesDir) {
|
|
3283
|
+
return state.configuredModulesDir;
|
|
3301
3284
|
}
|
|
3285
|
+
return join2(import.meta.dir, "../modules");
|
|
3302
3286
|
}
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
if (globalContext) {
|
|
3314
|
-
activeContext = globalContext;
|
|
3287
|
+
async function loadDiscoveredModules(options) {
|
|
3288
|
+
const modulesDirectory = resolveModulesDirectory(options);
|
|
3289
|
+
let moduleNames;
|
|
3290
|
+
try {
|
|
3291
|
+
moduleNames = readdirSync2(modulesDirectory, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
|
|
3292
|
+
} catch (error) {
|
|
3293
|
+
if (error.code === "ENOENT") {
|
|
3294
|
+
return [];
|
|
3295
|
+
}
|
|
3296
|
+
throw error;
|
|
3315
3297
|
}
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3298
|
+
const modules = await Promise.all(moduleNames.map(async (moduleName) => {
|
|
3299
|
+
const moduleUrl = pathToFileURL2(join2(modulesDirectory, moduleName, "index.ts")).href;
|
|
3300
|
+
const loaded = await import(moduleUrl);
|
|
3301
|
+
return loaded.default;
|
|
3302
|
+
}));
|
|
3303
|
+
return modules.filter((module) => module?.name !== undefined).sort((left, right) => (left.order ?? 100) - (right.order ?? 100));
|
|
3321
3304
|
}
|
|
3322
|
-
function
|
|
3323
|
-
const
|
|
3324
|
-
if (
|
|
3325
|
-
|
|
3305
|
+
async function ensureModulesLoaded(options) {
|
|
3306
|
+
const state = readDiscoverModulesState();
|
|
3307
|
+
if (state.appModules.length > 0) {
|
|
3308
|
+
return state.appModules;
|
|
3326
3309
|
}
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
function resolveApplicationQueue() {
|
|
3333
|
-
return requireActiveApplicationContext().container.resolve(CORE_QUEUE_TOKEN);
|
|
3334
|
-
}
|
|
3335
|
-
function resolveApplicationEventBus() {
|
|
3336
|
-
return requireActiveApplicationContext().container.resolve(CORE_EVENT_BUS_TOKEN);
|
|
3337
|
-
}
|
|
3338
|
-
function resolveApplicationAuth() {
|
|
3339
|
-
return requireActiveApplicationContext().container.resolve(CORE_AUTH_TOKEN);
|
|
3340
|
-
}
|
|
3341
|
-
function resolveApplicationPolicyGate() {
|
|
3342
|
-
return requireActiveApplicationContext().container.resolve(CORE_POLICY_GATE_TOKEN);
|
|
3343
|
-
}
|
|
3344
|
-
function resolveApplicationConfig() {
|
|
3345
|
-
return requireActiveApplicationContext().config;
|
|
3346
|
-
}
|
|
3347
|
-
function resolveApplicationLogger() {
|
|
3348
|
-
return appLogger;
|
|
3349
|
-
}
|
|
3350
|
-
function resolveApplicationDependencies() {
|
|
3351
|
-
return requireActiveApplicationContext().dependencies;
|
|
3310
|
+
state.modulesReady ??= loadDiscoveredModules(options).then((modules) => {
|
|
3311
|
+
state.appModules.splice(0, state.appModules.length, ...modules);
|
|
3312
|
+
return state.appModules;
|
|
3313
|
+
});
|
|
3314
|
+
return state.modulesReady;
|
|
3352
3315
|
}
|
|
3353
|
-
// ../../src/bootstrap/discoverModules.ts
|
|
3354
|
-
var appModules = [];
|
|
3355
3316
|
function discoverModules() {
|
|
3356
|
-
return appModules;
|
|
3317
|
+
return readDiscoverModulesState().appModules;
|
|
3357
3318
|
}
|
|
3358
3319
|
|
|
3359
3320
|
// ../../src/bootstrap/cache/modelCacheTags.ts
|
|
@@ -3650,10 +3611,92 @@ class DispatchWebhookJob extends Job {
|
|
|
3650
3611
|
}
|
|
3651
3612
|
var dispatchWebhookJob_default = DispatchWebhookJob;
|
|
3652
3613
|
|
|
3614
|
+
// ../../src/core/contracts/di.ts
|
|
3615
|
+
function getRequiredDependency(dependencies, key) {
|
|
3616
|
+
const dependency = dependencies[key];
|
|
3617
|
+
if (dependency === undefined) {
|
|
3618
|
+
throw new Error(`Required dependency "${key}" is not registered.`);
|
|
3619
|
+
}
|
|
3620
|
+
return dependency;
|
|
3621
|
+
}
|
|
3622
|
+
|
|
3623
|
+
// ../../src/core/contracts/serviceTokens.ts
|
|
3624
|
+
var CORE_POLICY_GATE_TOKEN2 = "core.policyGate";
|
|
3625
|
+
var CORE_AUTH_TOKEN2 = "core.auth";
|
|
3626
|
+
|
|
3627
|
+
// ../../src/core/logging/logger.ts
|
|
3628
|
+
class Logger {
|
|
3629
|
+
channel;
|
|
3630
|
+
constructor(channel = "app") {
|
|
3631
|
+
this.channel = channel;
|
|
3632
|
+
}
|
|
3633
|
+
write(level, message, context = {}) {
|
|
3634
|
+
const entry = {
|
|
3635
|
+
level,
|
|
3636
|
+
channel: this.channel,
|
|
3637
|
+
message,
|
|
3638
|
+
timestamp: new Date().toISOString(),
|
|
3639
|
+
...context
|
|
3640
|
+
};
|
|
3641
|
+
const line = JSON.stringify(entry);
|
|
3642
|
+
if (level === "error") {
|
|
3643
|
+
console.error(line);
|
|
3644
|
+
return;
|
|
3645
|
+
}
|
|
3646
|
+
console.log(line);
|
|
3647
|
+
}
|
|
3648
|
+
debug(message, context) {
|
|
3649
|
+
this.write("debug", message, context);
|
|
3650
|
+
}
|
|
3651
|
+
info(message, context) {
|
|
3652
|
+
this.write("info", message, context);
|
|
3653
|
+
}
|
|
3654
|
+
warn(message, context) {
|
|
3655
|
+
this.write("warn", message, context);
|
|
3656
|
+
}
|
|
3657
|
+
error(message, context) {
|
|
3658
|
+
this.write("error", message, context);
|
|
3659
|
+
}
|
|
3660
|
+
}
|
|
3661
|
+
var appLogger = new Logger("app");
|
|
3662
|
+
|
|
3663
|
+
// ../../src/core/runtime/applicationRegistry.ts
|
|
3664
|
+
var APPLICATION_CONTEXT_KEY = Symbol.for("@getstrata/applicationContext");
|
|
3665
|
+
var activeContext;
|
|
3666
|
+
function readStoredApplicationContext() {
|
|
3667
|
+
if (activeContext) {
|
|
3668
|
+
return activeContext;
|
|
3669
|
+
}
|
|
3670
|
+
const globalContext = globalThis[APPLICATION_CONTEXT_KEY];
|
|
3671
|
+
if (globalContext) {
|
|
3672
|
+
activeContext = globalContext;
|
|
3673
|
+
}
|
|
3674
|
+
return activeContext;
|
|
3675
|
+
}
|
|
3676
|
+
function requireActiveApplicationContext() {
|
|
3677
|
+
const context = readStoredApplicationContext();
|
|
3678
|
+
if (!context) {
|
|
3679
|
+
throw new Error("The application context has not been bootstrapped.");
|
|
3680
|
+
}
|
|
3681
|
+
return context;
|
|
3682
|
+
}
|
|
3683
|
+
function resolveApplicationCache2() {
|
|
3684
|
+
return getRequiredDependency(requireActiveApplicationContext().dependencies, "cache");
|
|
3685
|
+
}
|
|
3686
|
+
function resolveApplicationAuth2() {
|
|
3687
|
+
return requireActiveApplicationContext().container.resolve(CORE_AUTH_TOKEN2);
|
|
3688
|
+
}
|
|
3689
|
+
function resolveApplicationPolicyGate2() {
|
|
3690
|
+
return requireActiveApplicationContext().container.resolve(CORE_POLICY_GATE_TOKEN2);
|
|
3691
|
+
}
|
|
3692
|
+
function resolveApplicationDependencies2() {
|
|
3693
|
+
return requireActiveApplicationContext().dependencies;
|
|
3694
|
+
}
|
|
3695
|
+
|
|
3653
3696
|
// ../../src/bootstrap/queue/defaultJobs.ts
|
|
3654
3697
|
function registerDefaultJobs() {
|
|
3655
3698
|
jobRegistry.register("cache.invalidate-tags", () => {
|
|
3656
|
-
return new invalidateCacheTagsJob_default(
|
|
3699
|
+
return new invalidateCacheTagsJob_default(resolveApplicationCache2());
|
|
3657
3700
|
});
|
|
3658
3701
|
jobRegistry.register("webhook.dispatch", () => new dispatchWebhookJob_default);
|
|
3659
3702
|
}
|
|
@@ -3674,7 +3717,7 @@ var queue_default = queueProvider;
|
|
|
3674
3717
|
|
|
3675
3718
|
// ../../src/core/storage/storage.ts
|
|
3676
3719
|
import { mkdir, readFile, unlink, writeFile } from "fs/promises";
|
|
3677
|
-
import { dirname, join as
|
|
3720
|
+
import { dirname, join as join3 } from "path";
|
|
3678
3721
|
var {S3Client } = globalThis.Bun;
|
|
3679
3722
|
|
|
3680
3723
|
class LocalStorageDriver {
|
|
@@ -3686,7 +3729,7 @@ class LocalStorageDriver {
|
|
|
3686
3729
|
return this.rootDirectory ?? process.env.STORAGE_PATH ?? "storage";
|
|
3687
3730
|
}
|
|
3688
3731
|
resolvePath(path) {
|
|
3689
|
-
return
|
|
3732
|
+
return join3(this.resolveRootDirectory(), path.replace(/^\/+/, ""));
|
|
3690
3733
|
}
|
|
3691
3734
|
async put(path, contents) {
|
|
3692
3735
|
const absolutePath = this.resolvePath(path);
|
|
@@ -3819,9 +3862,9 @@ function currentRequestMeta() {
|
|
|
3819
3862
|
}
|
|
3820
3863
|
|
|
3821
3864
|
// ../../src/core/view/etaViewEngine.ts
|
|
3822
|
-
import { join as
|
|
3865
|
+
import { join as join4 } from "path";
|
|
3823
3866
|
import { Eta } from "eta";
|
|
3824
|
-
var DEFAULT_VIEWS_DIRECTORY =
|
|
3867
|
+
var DEFAULT_VIEWS_DIRECTORY = join4(process.cwd(), "resources/views");
|
|
3825
3868
|
var DEFAULT_LAYOUT = "layouts/app.eta";
|
|
3826
3869
|
|
|
3827
3870
|
class EtaViewEngine {
|
|
@@ -385,11 +385,6 @@ function readSharedJobRegistry() {
|
|
|
385
385
|
var jobRegistry = readSharedJobRegistry();
|
|
386
386
|
|
|
387
387
|
// ../../src/core/contracts/di.ts
|
|
388
|
-
var requiredDependencyKeys = [
|
|
389
|
-
"container",
|
|
390
|
-
"cache",
|
|
391
|
-
"storage"
|
|
392
|
-
];
|
|
393
388
|
function getRequiredDependency(dependencies, key) {
|
|
394
389
|
const dependency = dependencies[key];
|
|
395
390
|
if (dependency === undefined) {
|
|
@@ -397,23 +392,10 @@ function getRequiredDependency(dependencies, key) {
|
|
|
397
392
|
}
|
|
398
393
|
return dependency;
|
|
399
394
|
}
|
|
400
|
-
function assertAppDependenciesComplete(dependencies) {
|
|
401
|
-
for (const key of requiredDependencyKeys) {
|
|
402
|
-
getRequiredDependency(dependencies, key);
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
function resolveService(dependencies, token) {
|
|
406
|
-
return dependencies.container.resolve(token);
|
|
407
|
-
}
|
|
408
395
|
|
|
409
396
|
// ../../src/core/contracts/serviceTokens.ts
|
|
410
|
-
var CORE_CONFIG_TOKEN = "core.config";
|
|
411
|
-
var CORE_CACHE_TOKEN = "core.cache";
|
|
412
|
-
var CORE_QUEUE_TOKEN = "core.queue";
|
|
413
|
-
var CORE_EVENT_BUS_TOKEN = "core.eventBus";
|
|
414
397
|
var CORE_POLICY_GATE_TOKEN = "core.policyGate";
|
|
415
398
|
var CORE_AUTH_TOKEN = "core.auth";
|
|
416
|
-
var CORE_TOKEN_SERVICE_TOKEN = "core.tokenService";
|
|
417
399
|
|
|
418
400
|
// ../../src/core/logging/logger.ts
|
|
419
401
|
class Logger {
|
|
@@ -464,10 +446,6 @@ function readStoredApplicationContext() {
|
|
|
464
446
|
}
|
|
465
447
|
return activeContext;
|
|
466
448
|
}
|
|
467
|
-
function setActiveApplicationContext(context) {
|
|
468
|
-
activeContext = context;
|
|
469
|
-
globalThis[APPLICATION_CONTEXT_KEY] = context;
|
|
470
|
-
}
|
|
471
449
|
function requireActiveApplicationContext() {
|
|
472
450
|
const context = readStoredApplicationContext();
|
|
473
451
|
if (!context) {
|
|
@@ -478,24 +456,12 @@ function requireActiveApplicationContext() {
|
|
|
478
456
|
function resolveApplicationCache() {
|
|
479
457
|
return getRequiredDependency(requireActiveApplicationContext().dependencies, "cache");
|
|
480
458
|
}
|
|
481
|
-
function resolveApplicationQueue() {
|
|
482
|
-
return requireActiveApplicationContext().container.resolve(CORE_QUEUE_TOKEN);
|
|
483
|
-
}
|
|
484
|
-
function resolveApplicationEventBus() {
|
|
485
|
-
return requireActiveApplicationContext().container.resolve(CORE_EVENT_BUS_TOKEN);
|
|
486
|
-
}
|
|
487
459
|
function resolveApplicationAuth() {
|
|
488
460
|
return requireActiveApplicationContext().container.resolve(CORE_AUTH_TOKEN);
|
|
489
461
|
}
|
|
490
462
|
function resolveApplicationPolicyGate() {
|
|
491
463
|
return requireActiveApplicationContext().container.resolve(CORE_POLICY_GATE_TOKEN);
|
|
492
464
|
}
|
|
493
|
-
function resolveApplicationConfig() {
|
|
494
|
-
return requireActiveApplicationContext().config;
|
|
495
|
-
}
|
|
496
|
-
function resolveApplicationLogger() {
|
|
497
|
-
return appLogger;
|
|
498
|
-
}
|
|
499
465
|
function resolveApplicationDependencies() {
|
|
500
466
|
return requireActiveApplicationContext().dependencies;
|
|
501
467
|
}
|
|
@@ -68,11 +68,6 @@ class PreconditionFailedError extends HttpError {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
// ../../src/core/contracts/di.ts
|
|
71
|
-
var requiredDependencyKeys = [
|
|
72
|
-
"container",
|
|
73
|
-
"cache",
|
|
74
|
-
"storage"
|
|
75
|
-
];
|
|
76
71
|
function getRequiredDependency(dependencies, key) {
|
|
77
72
|
const dependency = dependencies[key];
|
|
78
73
|
if (dependency === undefined) {
|
|
@@ -80,23 +75,10 @@ function getRequiredDependency(dependencies, key) {
|
|
|
80
75
|
}
|
|
81
76
|
return dependency;
|
|
82
77
|
}
|
|
83
|
-
function assertAppDependenciesComplete(dependencies) {
|
|
84
|
-
for (const key of requiredDependencyKeys) {
|
|
85
|
-
getRequiredDependency(dependencies, key);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
function resolveService(dependencies, token) {
|
|
89
|
-
return dependencies.container.resolve(token);
|
|
90
|
-
}
|
|
91
78
|
|
|
92
79
|
// ../../src/core/contracts/serviceTokens.ts
|
|
93
|
-
var CORE_CONFIG_TOKEN = "core.config";
|
|
94
|
-
var CORE_CACHE_TOKEN = "core.cache";
|
|
95
|
-
var CORE_QUEUE_TOKEN = "core.queue";
|
|
96
|
-
var CORE_EVENT_BUS_TOKEN = "core.eventBus";
|
|
97
80
|
var CORE_POLICY_GATE_TOKEN = "core.policyGate";
|
|
98
81
|
var CORE_AUTH_TOKEN = "core.auth";
|
|
99
|
-
var CORE_TOKEN_SERVICE_TOKEN = "core.tokenService";
|
|
100
82
|
|
|
101
83
|
// ../../src/core/logging/logger.ts
|
|
102
84
|
class Logger {
|
|
@@ -147,10 +129,6 @@ function readStoredApplicationContext() {
|
|
|
147
129
|
}
|
|
148
130
|
return activeContext;
|
|
149
131
|
}
|
|
150
|
-
function setActiveApplicationContext(context) {
|
|
151
|
-
activeContext = context;
|
|
152
|
-
globalThis[APPLICATION_CONTEXT_KEY] = context;
|
|
153
|
-
}
|
|
154
132
|
function requireActiveApplicationContext() {
|
|
155
133
|
const context = readStoredApplicationContext();
|
|
156
134
|
if (!context) {
|
|
@@ -161,24 +139,12 @@ function requireActiveApplicationContext() {
|
|
|
161
139
|
function resolveApplicationCache() {
|
|
162
140
|
return getRequiredDependency(requireActiveApplicationContext().dependencies, "cache");
|
|
163
141
|
}
|
|
164
|
-
function resolveApplicationQueue() {
|
|
165
|
-
return requireActiveApplicationContext().container.resolve(CORE_QUEUE_TOKEN);
|
|
166
|
-
}
|
|
167
|
-
function resolveApplicationEventBus() {
|
|
168
|
-
return requireActiveApplicationContext().container.resolve(CORE_EVENT_BUS_TOKEN);
|
|
169
|
-
}
|
|
170
142
|
function resolveApplicationAuth() {
|
|
171
143
|
return requireActiveApplicationContext().container.resolve(CORE_AUTH_TOKEN);
|
|
172
144
|
}
|
|
173
145
|
function resolveApplicationPolicyGate() {
|
|
174
146
|
return requireActiveApplicationContext().container.resolve(CORE_POLICY_GATE_TOKEN);
|
|
175
147
|
}
|
|
176
|
-
function resolveApplicationConfig() {
|
|
177
|
-
return requireActiveApplicationContext().config;
|
|
178
|
-
}
|
|
179
|
-
function resolveApplicationLogger() {
|
|
180
|
-
return appLogger;
|
|
181
|
-
}
|
|
182
148
|
function resolveApplicationDependencies() {
|
|
183
149
|
return requireActiveApplicationContext().dependencies;
|
|
184
150
|
}
|
|
@@ -195,6 +161,10 @@ function isEtagEnabled() {
|
|
|
195
161
|
function formatWeakEtag(digest) {
|
|
196
162
|
return `W/"${digest}"`;
|
|
197
163
|
}
|
|
164
|
+
function computeEtagFromJson(data) {
|
|
165
|
+
const digest = nonCryptographicDigest(JSON.stringify(data)).slice(0, 32);
|
|
166
|
+
return formatWeakEtag(digest);
|
|
167
|
+
}
|
|
198
168
|
function etagFromResource(resource) {
|
|
199
169
|
const version = resource.updated_at ?? resource.created_at ?? "";
|
|
200
170
|
const versionText = version instanceof Date ? version.toISOString() : version ? String(version) : "0";
|
|
@@ -409,6 +379,15 @@ function resolveRegisterRateLimit() {
|
|
|
409
379
|
}
|
|
410
380
|
|
|
411
381
|
// ../../src/bootstrap/config.ts
|
|
382
|
+
import {
|
|
383
|
+
CORE_AUTH_TOKEN as CORE_AUTH_TOKEN2,
|
|
384
|
+
CORE_CACHE_TOKEN,
|
|
385
|
+
CORE_CONFIG_TOKEN,
|
|
386
|
+
CORE_EVENT_BUS_TOKEN as CORE_EVENT_BUS_TOKEN2,
|
|
387
|
+
CORE_POLICY_GATE_TOKEN as CORE_POLICY_GATE_TOKEN2,
|
|
388
|
+
CORE_QUEUE_TOKEN as CORE_QUEUE_TOKEN2,
|
|
389
|
+
CORE_TOKEN_SERVICE_TOKEN
|
|
390
|
+
} from "@getstrata/core/contracts/serviceTokens.ts";
|
|
412
391
|
var APP_PORT_CONFIG_KEY = "app.port";
|
|
413
392
|
var CACHE_TTL_MS_CONFIG_KEY = "cache.ttlMs";
|
|
414
393
|
var CACHE_MAX_ENTRIES_CONFIG_KEY = "cache.maxEntries";
|
|
@@ -430,7 +409,7 @@ class HttpKernel {
|
|
|
430
409
|
this.dependencies = dependencies;
|
|
431
410
|
}
|
|
432
411
|
globalMiddleware() {
|
|
433
|
-
const auth = this.dependencies.container.resolve(
|
|
412
|
+
const auth = this.dependencies.container.resolve(CORE_AUTH_TOKEN2);
|
|
434
413
|
return [
|
|
435
414
|
createCorsMiddleware(),
|
|
436
415
|
createSecurityHeadersMiddleware(),
|
|
@@ -445,7 +424,7 @@ class HttpKernel {
|
|
|
445
424
|
];
|
|
446
425
|
}
|
|
447
426
|
group(name) {
|
|
448
|
-
const auth = this.dependencies.container.resolve(
|
|
427
|
+
const auth = this.dependencies.container.resolve(CORE_AUTH_TOKEN2);
|
|
449
428
|
switch (name) {
|
|
450
429
|
case "authenticated":
|
|
451
430
|
return [createRequireAuthMiddleware(auth)];
|
|
@@ -500,18 +479,18 @@ class HttpKernel {
|
|
|
500
479
|
return this.wrapWebAuthenticated(handler);
|
|
501
480
|
}
|
|
502
481
|
wrapWebAuthenticated(handler) {
|
|
503
|
-
const auth = this.dependencies.container.resolve(
|
|
482
|
+
const auth = this.dependencies.container.resolve(CORE_AUTH_TOKEN2);
|
|
504
483
|
return withMiddleware(createRequireWebAuthMiddleware(auth))(handler);
|
|
505
484
|
}
|
|
506
485
|
wrapWebAbility(ability, handler) {
|
|
507
|
-
const auth = this.dependencies.container.resolve(
|
|
486
|
+
const auth = this.dependencies.container.resolve(CORE_AUTH_TOKEN2);
|
|
508
487
|
const abilityChecker = this.dependencies.container.resolve(CORE_TOKEN_SERVICE_TOKEN);
|
|
509
488
|
const requireAbility = createRequireAbilityMiddleware(abilityChecker);
|
|
510
489
|
const middleware = [createRequireWebAuthMiddleware(auth), requireAbility(ability)];
|
|
511
490
|
return withMiddleware(...middleware)(handler);
|
|
512
491
|
}
|
|
513
492
|
wrapWebGlobalAdmin(handler) {
|
|
514
|
-
const auth = this.dependencies.container.resolve(
|
|
493
|
+
const auth = this.dependencies.container.resolve(CORE_AUTH_TOKEN2);
|
|
515
494
|
const middleware = [createRequireWebAuthMiddleware(auth), createRequireGlobalAdminMiddleware()];
|
|
516
495
|
return withMiddleware(...middleware)(handler);
|
|
517
496
|
}
|
|
@@ -535,8 +514,8 @@ class HttpKernel {
|
|
|
535
514
|
return withMiddleware(...middleware)(handler);
|
|
536
515
|
}
|
|
537
516
|
wrapPolicy(resource, action, handler) {
|
|
538
|
-
const auth = this.dependencies.container.resolve(
|
|
539
|
-
const gate = this.dependencies.container.resolve(
|
|
517
|
+
const auth = this.dependencies.container.resolve(CORE_AUTH_TOKEN2);
|
|
518
|
+
const gate = this.dependencies.container.resolve(CORE_POLICY_GATE_TOKEN2);
|
|
540
519
|
return withMiddleware(createAuthorizeMiddleware(gate, auth, resource, action))(handler);
|
|
541
520
|
}
|
|
542
521
|
wrapLogin(handler) {
|