@getstrata/bootstrap 0.2.22 → 0.2.25
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/buildWebModuleRoutes.d.ts +9 -0
- package/dist/bootstrap/config.d.ts +1 -1
- package/dist/bootstrap/contracts.d.ts +4 -4
- package/dist/bootstrap/env.d.ts +1 -1
- package/dist/bootstrap/membershipService.d.ts +1 -1
- package/dist/bootstrap/public-api.d.ts +6 -2
- package/dist/bootstrap/routeRegistry.d.ts +1 -1
- package/dist/entries/applicationRegistry.js +12 -115
- package/dist/entries/buildModuleRoutes.js +411 -0
- package/dist/entries/buildWebModuleRoutes.js +435 -0
- package/dist/entries/config.js +9 -9
- package/dist/entries/context.js +112 -192
- package/dist/entries/contracts.js +10 -85
- package/dist/entries/createWebRoutes.js +100 -682
- package/dist/entries/dependencies.js +112 -192
- package/dist/entries/http/securedRouteModelBinding.js +0 -37
- package/dist/entries/httpKernel.js +9 -9
- package/dist/entries/membershipService.js +2 -426
- package/dist/entries/providers/view.js +9 -20
- package/dist/entries/providers.js +102 -129
- package/dist/entries/queue/defaultJobs.js +0 -37
- package/dist/entries/web/routing.js +16 -44
- package/dist/index.js +507 -730
- 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
|
@@ -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";
|
|
@@ -211,7 +211,6 @@ var db = new Proxy(function database() {}, {
|
|
|
211
211
|
return typeof value === "function" ? value.bind(connection) : value;
|
|
212
212
|
}
|
|
213
213
|
});
|
|
214
|
-
var connection_default = db;
|
|
215
214
|
|
|
216
215
|
// ../../src/modules/user/apiTokenTable.ts
|
|
217
216
|
import { defineTable } from "@getstrata/core/database";
|
|
@@ -1097,9 +1096,6 @@ var queueConfig = {
|
|
|
1097
1096
|
};
|
|
1098
1097
|
|
|
1099
1098
|
// ../../src/core/config/envSchema.ts
|
|
1100
|
-
function defineEnvSchema(schema) {
|
|
1101
|
-
return schema;
|
|
1102
|
-
}
|
|
1103
1099
|
function validateEnv(schema, env = process.env) {
|
|
1104
1100
|
const resolved = {};
|
|
1105
1101
|
for (const [name, rule] of Object.entries(schema)) {
|
|
@@ -1128,6 +1124,7 @@ function validateEnv(schema, env = process.env) {
|
|
|
1128
1124
|
}
|
|
1129
1125
|
|
|
1130
1126
|
// ../../src/bootstrap/env.ts
|
|
1127
|
+
import { defineEnvSchema } from "@getstrata/core/config/envSchema";
|
|
1131
1128
|
var appEnvSchema = defineEnvSchema({
|
|
1132
1129
|
DATABASE_URL: { required: true, pattern: /^postgres(ql)?:\/\// },
|
|
1133
1130
|
PORT: {
|
|
@@ -3244,112 +3241,19 @@ function createAppQueue(driver, redisUrl, failedJobs = createFailedJobService(),
|
|
|
3244
3241
|
});
|
|
3245
3242
|
}
|
|
3246
3243
|
|
|
3247
|
-
// ../../src/
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
}
|
|
3260
|
-
function assertAppDependenciesComplete(dependencies) {
|
|
3261
|
-
for (const key of requiredDependencyKeys) {
|
|
3262
|
-
getRequiredDependency(dependencies, key);
|
|
3263
|
-
}
|
|
3264
|
-
}
|
|
3265
|
-
function resolveService(dependencies, token) {
|
|
3266
|
-
return dependencies.container.resolve(token);
|
|
3267
|
-
}
|
|
3268
|
-
|
|
3269
|
-
// ../../src/core/logging/logger.ts
|
|
3270
|
-
class Logger {
|
|
3271
|
-
channel;
|
|
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);
|
|
3289
|
-
}
|
|
3290
|
-
debug(message, context) {
|
|
3291
|
-
this.write("debug", message, context);
|
|
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);
|
|
3301
|
-
}
|
|
3302
|
-
}
|
|
3303
|
-
var appLogger = new Logger("app");
|
|
3244
|
+
// ../../src/bootstrap/applicationRegistry.ts
|
|
3245
|
+
import {
|
|
3246
|
+
resolveApplicationAuth,
|
|
3247
|
+
resolveApplicationCache,
|
|
3248
|
+
resolveApplicationConfig,
|
|
3249
|
+
resolveApplicationDependencies,
|
|
3250
|
+
resolveApplicationEventBus,
|
|
3251
|
+
resolveApplicationLogger,
|
|
3252
|
+
resolveApplicationPolicyGate,
|
|
3253
|
+
resolveApplicationQueue,
|
|
3254
|
+
setActiveApplicationContext
|
|
3255
|
+
} from "@getstrata/core/runtime/applicationRegistry.ts";
|
|
3304
3256
|
|
|
3305
|
-
// ../../src/core/runtime/applicationRegistry.ts
|
|
3306
|
-
var APPLICATION_CONTEXT_KEY = Symbol.for("@getstrata/applicationContext");
|
|
3307
|
-
var activeContext;
|
|
3308
|
-
function readStoredApplicationContext() {
|
|
3309
|
-
if (activeContext) {
|
|
3310
|
-
return activeContext;
|
|
3311
|
-
}
|
|
3312
|
-
const globalContext = globalThis[APPLICATION_CONTEXT_KEY];
|
|
3313
|
-
if (globalContext) {
|
|
3314
|
-
activeContext = globalContext;
|
|
3315
|
-
}
|
|
3316
|
-
return activeContext;
|
|
3317
|
-
}
|
|
3318
|
-
function setActiveApplicationContext(context) {
|
|
3319
|
-
activeContext = context;
|
|
3320
|
-
globalThis[APPLICATION_CONTEXT_KEY] = context;
|
|
3321
|
-
}
|
|
3322
|
-
function requireActiveApplicationContext() {
|
|
3323
|
-
const context = readStoredApplicationContext();
|
|
3324
|
-
if (!context) {
|
|
3325
|
-
throw new Error("The application context has not been bootstrapped.");
|
|
3326
|
-
}
|
|
3327
|
-
return context;
|
|
3328
|
-
}
|
|
3329
|
-
function resolveApplicationCache() {
|
|
3330
|
-
return getRequiredDependency(requireActiveApplicationContext().dependencies, "cache");
|
|
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;
|
|
3352
|
-
}
|
|
3353
3257
|
// ../../src/bootstrap/discoverModules.ts
|
|
3354
3258
|
import { readdirSync as readdirSync2 } from "fs";
|
|
3355
3259
|
import { join as join2 } from "path";
|
|
@@ -3704,10 +3608,89 @@ class DispatchWebhookJob extends Job {
|
|
|
3704
3608
|
}
|
|
3705
3609
|
var dispatchWebhookJob_default = DispatchWebhookJob;
|
|
3706
3610
|
|
|
3611
|
+
// ../../src/core/contracts/di.ts
|
|
3612
|
+
function getRequiredDependency(dependencies, key) {
|
|
3613
|
+
const dependency = dependencies[key];
|
|
3614
|
+
if (dependency === undefined) {
|
|
3615
|
+
throw new Error(`Required dependency "${key}" is not registered.`);
|
|
3616
|
+
}
|
|
3617
|
+
return dependency;
|
|
3618
|
+
}
|
|
3619
|
+
|
|
3620
|
+
// ../../src/core/contracts/serviceTokens.ts
|
|
3621
|
+
var CORE_POLICY_GATE_TOKEN2 = "core.policyGate";
|
|
3622
|
+
var CORE_AUTH_TOKEN2 = "core.auth";
|
|
3623
|
+
|
|
3624
|
+
// ../../src/core/logging/logger.ts
|
|
3625
|
+
class Logger {
|
|
3626
|
+
channel;
|
|
3627
|
+
constructor(channel = "app") {
|
|
3628
|
+
this.channel = channel;
|
|
3629
|
+
}
|
|
3630
|
+
write(level, message, context = {}) {
|
|
3631
|
+
const entry = {
|
|
3632
|
+
level,
|
|
3633
|
+
channel: this.channel,
|
|
3634
|
+
message,
|
|
3635
|
+
timestamp: new Date().toISOString(),
|
|
3636
|
+
...context
|
|
3637
|
+
};
|
|
3638
|
+
const line = JSON.stringify(entry);
|
|
3639
|
+
if (level === "error") {
|
|
3640
|
+
console.error(line);
|
|
3641
|
+
return;
|
|
3642
|
+
}
|
|
3643
|
+
console.log(line);
|
|
3644
|
+
}
|
|
3645
|
+
debug(message, context) {
|
|
3646
|
+
this.write("debug", message, context);
|
|
3647
|
+
}
|
|
3648
|
+
info(message, context) {
|
|
3649
|
+
this.write("info", message, context);
|
|
3650
|
+
}
|
|
3651
|
+
warn(message, context) {
|
|
3652
|
+
this.write("warn", message, context);
|
|
3653
|
+
}
|
|
3654
|
+
error(message, context) {
|
|
3655
|
+
this.write("error", message, context);
|
|
3656
|
+
}
|
|
3657
|
+
}
|
|
3658
|
+
var appLogger = new Logger("app");
|
|
3659
|
+
|
|
3660
|
+
// ../../src/core/runtime/applicationRegistry.ts
|
|
3661
|
+
var APPLICATION_CONTEXT_KEY = Symbol.for("@getstrata/applicationContext");
|
|
3662
|
+
var activeContext;
|
|
3663
|
+
function readStoredApplicationContext() {
|
|
3664
|
+
if (activeContext) {
|
|
3665
|
+
return activeContext;
|
|
3666
|
+
}
|
|
3667
|
+
const globalContext = globalThis[APPLICATION_CONTEXT_KEY];
|
|
3668
|
+
if (globalContext) {
|
|
3669
|
+
activeContext = globalContext;
|
|
3670
|
+
}
|
|
3671
|
+
return activeContext;
|
|
3672
|
+
}
|
|
3673
|
+
function requireActiveApplicationContext() {
|
|
3674
|
+
const context = readStoredApplicationContext();
|
|
3675
|
+
if (!context) {
|
|
3676
|
+
throw new Error("The application context has not been bootstrapped.");
|
|
3677
|
+
}
|
|
3678
|
+
return context;
|
|
3679
|
+
}
|
|
3680
|
+
function resolveApplicationCache2() {
|
|
3681
|
+
return getRequiredDependency(requireActiveApplicationContext().dependencies, "cache");
|
|
3682
|
+
}
|
|
3683
|
+
function resolveApplicationAuth2() {
|
|
3684
|
+
return requireActiveApplicationContext().container.resolve(CORE_AUTH_TOKEN2);
|
|
3685
|
+
}
|
|
3686
|
+
function resolveApplicationPolicyGate2() {
|
|
3687
|
+
return requireActiveApplicationContext().container.resolve(CORE_POLICY_GATE_TOKEN2);
|
|
3688
|
+
}
|
|
3689
|
+
|
|
3707
3690
|
// ../../src/bootstrap/queue/defaultJobs.ts
|
|
3708
3691
|
function registerDefaultJobs() {
|
|
3709
3692
|
jobRegistry.register("cache.invalidate-tags", () => {
|
|
3710
|
-
return new invalidateCacheTagsJob_default(
|
|
3693
|
+
return new invalidateCacheTagsJob_default(resolveApplicationCache2());
|
|
3711
3694
|
});
|
|
3712
3695
|
jobRegistry.register("webhook.dispatch", () => new dispatchWebhookJob_default);
|
|
3713
3696
|
}
|
|
@@ -3904,16 +3887,6 @@ class EtaViewEngine {
|
|
|
3904
3887
|
});
|
|
3905
3888
|
}
|
|
3906
3889
|
}
|
|
3907
|
-
// ../../src/core/view/htmlResponse.ts
|
|
3908
|
-
function htmlResponse(html, init = {}) {
|
|
3909
|
-
return new Response(html, {
|
|
3910
|
-
status: init.status ?? 200,
|
|
3911
|
-
statusText: init.statusText,
|
|
3912
|
-
headers: {
|
|
3913
|
-
"Content-Type": "text/html; charset=utf-8"
|
|
3914
|
-
}
|
|
3915
|
-
});
|
|
3916
|
-
}
|
|
3917
3890
|
// ../../src/core/http/cookies.ts
|
|
3918
3891
|
function readRequestCookie(request, name) {
|
|
3919
3892
|
const cookies = request.cookies;
|
|
@@ -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,27 +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
|
-
function resolveApplicationDependencies() {
|
|
500
|
-
return requireActiveApplicationContext().dependencies;
|
|
501
|
-
}
|
|
502
465
|
|
|
503
466
|
// ../../src/bootstrap/queue/defaultJobs.ts
|
|
504
467
|
function registerDefaultJobs() {
|
|
@@ -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,27 +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
|
-
function resolveApplicationDependencies() {
|
|
183
|
-
return requireActiveApplicationContext().dependencies;
|
|
184
|
-
}
|
|
185
148
|
|
|
186
149
|
// ../../src/core/crypto/nonCryptographicHash.ts
|
|
187
150
|
function nonCryptographicDigest(input) {
|
|
@@ -409,6 +372,15 @@ function resolveRegisterRateLimit() {
|
|
|
409
372
|
}
|
|
410
373
|
|
|
411
374
|
// ../../src/bootstrap/config.ts
|
|
375
|
+
import {
|
|
376
|
+
CORE_AUTH_TOKEN as CORE_AUTH_TOKEN2,
|
|
377
|
+
CORE_CACHE_TOKEN,
|
|
378
|
+
CORE_CONFIG_TOKEN,
|
|
379
|
+
CORE_EVENT_BUS_TOKEN as CORE_EVENT_BUS_TOKEN2,
|
|
380
|
+
CORE_POLICY_GATE_TOKEN as CORE_POLICY_GATE_TOKEN2,
|
|
381
|
+
CORE_QUEUE_TOKEN as CORE_QUEUE_TOKEN2,
|
|
382
|
+
CORE_TOKEN_SERVICE_TOKEN
|
|
383
|
+
} from "@getstrata/core/contracts/serviceTokens.ts";
|
|
412
384
|
var APP_PORT_CONFIG_KEY = "app.port";
|
|
413
385
|
var CACHE_TTL_MS_CONFIG_KEY = "cache.ttlMs";
|
|
414
386
|
var CACHE_MAX_ENTRIES_CONFIG_KEY = "cache.maxEntries";
|
|
@@ -430,7 +402,7 @@ class HttpKernel {
|
|
|
430
402
|
this.dependencies = dependencies;
|
|
431
403
|
}
|
|
432
404
|
globalMiddleware() {
|
|
433
|
-
const auth = this.dependencies.container.resolve(
|
|
405
|
+
const auth = this.dependencies.container.resolve(CORE_AUTH_TOKEN2);
|
|
434
406
|
return [
|
|
435
407
|
createCorsMiddleware(),
|
|
436
408
|
createSecurityHeadersMiddleware(),
|
|
@@ -445,7 +417,7 @@ class HttpKernel {
|
|
|
445
417
|
];
|
|
446
418
|
}
|
|
447
419
|
group(name) {
|
|
448
|
-
const auth = this.dependencies.container.resolve(
|
|
420
|
+
const auth = this.dependencies.container.resolve(CORE_AUTH_TOKEN2);
|
|
449
421
|
switch (name) {
|
|
450
422
|
case "authenticated":
|
|
451
423
|
return [createRequireAuthMiddleware(auth)];
|
|
@@ -500,18 +472,18 @@ class HttpKernel {
|
|
|
500
472
|
return this.wrapWebAuthenticated(handler);
|
|
501
473
|
}
|
|
502
474
|
wrapWebAuthenticated(handler) {
|
|
503
|
-
const auth = this.dependencies.container.resolve(
|
|
475
|
+
const auth = this.dependencies.container.resolve(CORE_AUTH_TOKEN2);
|
|
504
476
|
return withMiddleware(createRequireWebAuthMiddleware(auth))(handler);
|
|
505
477
|
}
|
|
506
478
|
wrapWebAbility(ability, handler) {
|
|
507
|
-
const auth = this.dependencies.container.resolve(
|
|
479
|
+
const auth = this.dependencies.container.resolve(CORE_AUTH_TOKEN2);
|
|
508
480
|
const abilityChecker = this.dependencies.container.resolve(CORE_TOKEN_SERVICE_TOKEN);
|
|
509
481
|
const requireAbility = createRequireAbilityMiddleware(abilityChecker);
|
|
510
482
|
const middleware = [createRequireWebAuthMiddleware(auth), requireAbility(ability)];
|
|
511
483
|
return withMiddleware(...middleware)(handler);
|
|
512
484
|
}
|
|
513
485
|
wrapWebGlobalAdmin(handler) {
|
|
514
|
-
const auth = this.dependencies.container.resolve(
|
|
486
|
+
const auth = this.dependencies.container.resolve(CORE_AUTH_TOKEN2);
|
|
515
487
|
const middleware = [createRequireWebAuthMiddleware(auth), createRequireGlobalAdminMiddleware()];
|
|
516
488
|
return withMiddleware(...middleware)(handler);
|
|
517
489
|
}
|
|
@@ -535,8 +507,8 @@ class HttpKernel {
|
|
|
535
507
|
return withMiddleware(...middleware)(handler);
|
|
536
508
|
}
|
|
537
509
|
wrapPolicy(resource, action, handler) {
|
|
538
|
-
const auth = this.dependencies.container.resolve(
|
|
539
|
-
const gate = this.dependencies.container.resolve(
|
|
510
|
+
const auth = this.dependencies.container.resolve(CORE_AUTH_TOKEN2);
|
|
511
|
+
const gate = this.dependencies.container.resolve(CORE_POLICY_GATE_TOKEN2);
|
|
540
512
|
return withMiddleware(createAuthorizeMiddleware(gate, auth, resource, action))(handler);
|
|
541
513
|
}
|
|
542
514
|
wrapLogin(handler) {
|