@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
|
@@ -1,183 +1,28 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
// ../../src/
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
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
|
-
|
|
24
|
-
// ../../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
|
-
var CORE_POLICY_GATE_TOKEN = "core.policyGate";
|
|
30
|
-
var CORE_AUTH_TOKEN = "core.auth";
|
|
31
|
-
var CORE_TOKEN_SERVICE_TOKEN = "core.tokenService";
|
|
32
|
-
|
|
33
|
-
// ../../src/core/logging/logger.ts
|
|
34
|
-
class Logger {
|
|
35
|
-
channel;
|
|
36
|
-
constructor(channel = "app") {
|
|
37
|
-
this.channel = channel;
|
|
38
|
-
}
|
|
39
|
-
write(level, message, context = {}) {
|
|
40
|
-
const entry = {
|
|
41
|
-
level,
|
|
42
|
-
channel: this.channel,
|
|
43
|
-
message,
|
|
44
|
-
timestamp: new Date().toISOString(),
|
|
45
|
-
...context
|
|
46
|
-
};
|
|
47
|
-
const line = JSON.stringify(entry);
|
|
48
|
-
if (level === "error") {
|
|
49
|
-
console.error(line);
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
console.log(line);
|
|
53
|
-
}
|
|
54
|
-
debug(message, context) {
|
|
55
|
-
this.write("debug", message, context);
|
|
56
|
-
}
|
|
57
|
-
info(message, context) {
|
|
58
|
-
this.write("info", message, context);
|
|
59
|
-
}
|
|
60
|
-
warn(message, context) {
|
|
61
|
-
this.write("warn", message, context);
|
|
62
|
-
}
|
|
63
|
-
error(message, context) {
|
|
64
|
-
this.write("error", message, context);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
var appLogger = new Logger("app");
|
|
2
|
+
// ../../src/bootstrap/applicationRegistry.ts
|
|
3
|
+
import {
|
|
4
|
+
resolveApplicationAuth,
|
|
5
|
+
resolveApplicationCache,
|
|
6
|
+
resolveApplicationConfig,
|
|
7
|
+
resolveApplicationDependencies,
|
|
8
|
+
resolveApplicationEventBus,
|
|
9
|
+
resolveApplicationLogger,
|
|
10
|
+
resolveApplicationPolicyGate,
|
|
11
|
+
resolveApplicationQueue,
|
|
12
|
+
setActiveApplicationContext
|
|
13
|
+
} from "@getstrata/core/runtime/applicationRegistry.ts";
|
|
68
14
|
|
|
69
|
-
// ../../src/
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
return activeContext;
|
|
81
|
-
}
|
|
82
|
-
function setActiveApplicationContext(context) {
|
|
83
|
-
activeContext = context;
|
|
84
|
-
globalThis[APPLICATION_CONTEXT_KEY] = context;
|
|
85
|
-
}
|
|
86
|
-
function requireActiveApplicationContext() {
|
|
87
|
-
const context = readStoredApplicationContext();
|
|
88
|
-
if (!context) {
|
|
89
|
-
throw new Error("The application context has not been bootstrapped.");
|
|
90
|
-
}
|
|
91
|
-
return context;
|
|
92
|
-
}
|
|
93
|
-
function resolveApplicationCache() {
|
|
94
|
-
return getRequiredDependency(requireActiveApplicationContext().dependencies, "cache");
|
|
95
|
-
}
|
|
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
|
-
function resolveApplicationAuth() {
|
|
103
|
-
return requireActiveApplicationContext().container.resolve(CORE_AUTH_TOKEN);
|
|
104
|
-
}
|
|
105
|
-
function resolveApplicationPolicyGate() {
|
|
106
|
-
return requireActiveApplicationContext().container.resolve(CORE_POLICY_GATE_TOKEN);
|
|
107
|
-
}
|
|
108
|
-
function resolveApplicationConfig() {
|
|
109
|
-
return requireActiveApplicationContext().config;
|
|
110
|
-
}
|
|
111
|
-
function resolveApplicationLogger() {
|
|
112
|
-
return appLogger;
|
|
113
|
-
}
|
|
114
|
-
function resolveApplicationDependencies() {
|
|
115
|
-
return requireActiveApplicationContext().dependencies;
|
|
116
|
-
}
|
|
117
|
-
// ../../src/core/contracts/container.ts
|
|
118
|
-
class ServiceContainer {
|
|
119
|
-
services = new Map;
|
|
120
|
-
singletonFactories = new Map;
|
|
121
|
-
bindings = new Map;
|
|
122
|
-
set(key, value) {
|
|
123
|
-
this.singletonFactories.delete(key);
|
|
124
|
-
this.bindings.delete(key);
|
|
125
|
-
this.services.set(key, value);
|
|
126
|
-
return value;
|
|
127
|
-
}
|
|
128
|
-
singleton(key, factory) {
|
|
129
|
-
this.bindings.delete(key);
|
|
130
|
-
this.services.delete(key);
|
|
131
|
-
this.singletonFactories.set(key, factory);
|
|
132
|
-
}
|
|
133
|
-
bind(key, factory) {
|
|
134
|
-
this.singletonFactories.delete(key);
|
|
135
|
-
this.services.delete(key);
|
|
136
|
-
this.bindings.set(key, factory);
|
|
137
|
-
}
|
|
138
|
-
get(key) {
|
|
139
|
-
if (this.services.has(key)) {
|
|
140
|
-
return this.services.get(key);
|
|
141
|
-
}
|
|
142
|
-
const singletonFactory = this.singletonFactories.get(key);
|
|
143
|
-
if (singletonFactory) {
|
|
144
|
-
const value = singletonFactory(this);
|
|
145
|
-
this.services.set(key, value);
|
|
146
|
-
return value;
|
|
147
|
-
}
|
|
148
|
-
const binding = this.bindings.get(key);
|
|
149
|
-
if (binding) {
|
|
150
|
-
return binding(this);
|
|
151
|
-
}
|
|
152
|
-
throw new Error(`Service "${key}" is not registered.`);
|
|
153
|
-
}
|
|
154
|
-
resolve(key) {
|
|
155
|
-
return this.get(key);
|
|
156
|
-
}
|
|
157
|
-
has(key) {
|
|
158
|
-
return this.services.has(key) || this.singletonFactories.has(key) || this.bindings.has(key);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
15
|
+
// ../../src/bootstrap/contracts.ts
|
|
16
|
+
import {
|
|
17
|
+
ConfigStore,
|
|
18
|
+
ServiceContainer
|
|
19
|
+
} from "@getstrata/core/contracts/container";
|
|
20
|
+
import {
|
|
21
|
+
assertAppDependenciesComplete,
|
|
22
|
+
getRequiredDependency,
|
|
23
|
+
resolveService
|
|
24
|
+
} from "@getstrata/core/contracts/di";
|
|
161
25
|
|
|
162
|
-
class ConfigStore {
|
|
163
|
-
values = new Map;
|
|
164
|
-
set(key, value) {
|
|
165
|
-
this.values.set(key, value);
|
|
166
|
-
return value;
|
|
167
|
-
}
|
|
168
|
-
get(key) {
|
|
169
|
-
return this.values.get(key);
|
|
170
|
-
}
|
|
171
|
-
require(key) {
|
|
172
|
-
if (!this.values.has(key)) {
|
|
173
|
-
throw new Error(`Config key "${key}" is not defined.`);
|
|
174
|
-
}
|
|
175
|
-
return this.values.get(key);
|
|
176
|
-
}
|
|
177
|
-
has(key) {
|
|
178
|
-
return this.values.has(key);
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
26
|
// ../../src/bootstrap/discoverModules.ts
|
|
182
27
|
import { readdirSync } from "fs";
|
|
183
28
|
import { join } from "path";
|
|
@@ -282,6 +127,15 @@ function resolveAbilitiesForRole(role) {
|
|
|
282
127
|
}
|
|
283
128
|
|
|
284
129
|
// ../../src/bootstrap/config.ts
|
|
130
|
+
import {
|
|
131
|
+
CORE_AUTH_TOKEN,
|
|
132
|
+
CORE_CACHE_TOKEN,
|
|
133
|
+
CORE_CONFIG_TOKEN,
|
|
134
|
+
CORE_EVENT_BUS_TOKEN,
|
|
135
|
+
CORE_POLICY_GATE_TOKEN,
|
|
136
|
+
CORE_QUEUE_TOKEN,
|
|
137
|
+
CORE_TOKEN_SERVICE_TOKEN
|
|
138
|
+
} from "@getstrata/core/contracts/serviceTokens.ts";
|
|
285
139
|
var APP_PORT_CONFIG_KEY = "app.port";
|
|
286
140
|
var CACHE_TTL_MS_CONFIG_KEY = "cache.ttlMs";
|
|
287
141
|
var CACHE_MAX_ENTRIES_CONFIG_KEY = "cache.maxEntries";
|
|
@@ -440,7 +294,6 @@ var db = new Proxy(function database() {}, {
|
|
|
440
294
|
return typeof value === "function" ? value.bind(connection) : value;
|
|
441
295
|
}
|
|
442
296
|
});
|
|
443
|
-
var connection_default = db;
|
|
444
297
|
|
|
445
298
|
// ../../src/modules/user/apiTokenTable.ts
|
|
446
299
|
import { defineTable } from "@getstrata/core/database";
|
|
@@ -1326,9 +1179,6 @@ var queueConfig = {
|
|
|
1326
1179
|
};
|
|
1327
1180
|
|
|
1328
1181
|
// ../../src/core/config/envSchema.ts
|
|
1329
|
-
function defineEnvSchema(schema) {
|
|
1330
|
-
return schema;
|
|
1331
|
-
}
|
|
1332
1182
|
function validateEnv(schema, env = process.env) {
|
|
1333
1183
|
const resolved = {};
|
|
1334
1184
|
for (const [name, rule] of Object.entries(schema)) {
|
|
@@ -1357,6 +1207,7 @@ function validateEnv(schema, env = process.env) {
|
|
|
1357
1207
|
}
|
|
1358
1208
|
|
|
1359
1209
|
// ../../src/bootstrap/env.ts
|
|
1210
|
+
import { defineEnvSchema } from "@getstrata/core/config/envSchema";
|
|
1360
1211
|
var appEnvSchema = defineEnvSchema({
|
|
1361
1212
|
DATABASE_URL: { required: true, pattern: /^postgres(ql)?:\/\// },
|
|
1362
1213
|
PORT: {
|
|
@@ -3767,10 +3618,89 @@ class DispatchWebhookJob extends Job {
|
|
|
3767
3618
|
}
|
|
3768
3619
|
var dispatchWebhookJob_default = DispatchWebhookJob;
|
|
3769
3620
|
|
|
3621
|
+
// ../../src/core/contracts/di.ts
|
|
3622
|
+
function getRequiredDependency2(dependencies, key) {
|
|
3623
|
+
const dependency = dependencies[key];
|
|
3624
|
+
if (dependency === undefined) {
|
|
3625
|
+
throw new Error(`Required dependency "${key}" is not registered.`);
|
|
3626
|
+
}
|
|
3627
|
+
return dependency;
|
|
3628
|
+
}
|
|
3629
|
+
|
|
3630
|
+
// ../../src/core/contracts/serviceTokens.ts
|
|
3631
|
+
var CORE_POLICY_GATE_TOKEN2 = "core.policyGate";
|
|
3632
|
+
var CORE_AUTH_TOKEN2 = "core.auth";
|
|
3633
|
+
|
|
3634
|
+
// ../../src/core/logging/logger.ts
|
|
3635
|
+
class Logger {
|
|
3636
|
+
channel;
|
|
3637
|
+
constructor(channel = "app") {
|
|
3638
|
+
this.channel = channel;
|
|
3639
|
+
}
|
|
3640
|
+
write(level, message, context = {}) {
|
|
3641
|
+
const entry = {
|
|
3642
|
+
level,
|
|
3643
|
+
channel: this.channel,
|
|
3644
|
+
message,
|
|
3645
|
+
timestamp: new Date().toISOString(),
|
|
3646
|
+
...context
|
|
3647
|
+
};
|
|
3648
|
+
const line = JSON.stringify(entry);
|
|
3649
|
+
if (level === "error") {
|
|
3650
|
+
console.error(line);
|
|
3651
|
+
return;
|
|
3652
|
+
}
|
|
3653
|
+
console.log(line);
|
|
3654
|
+
}
|
|
3655
|
+
debug(message, context) {
|
|
3656
|
+
this.write("debug", message, context);
|
|
3657
|
+
}
|
|
3658
|
+
info(message, context) {
|
|
3659
|
+
this.write("info", message, context);
|
|
3660
|
+
}
|
|
3661
|
+
warn(message, context) {
|
|
3662
|
+
this.write("warn", message, context);
|
|
3663
|
+
}
|
|
3664
|
+
error(message, context) {
|
|
3665
|
+
this.write("error", message, context);
|
|
3666
|
+
}
|
|
3667
|
+
}
|
|
3668
|
+
var appLogger = new Logger("app");
|
|
3669
|
+
|
|
3670
|
+
// ../../src/core/runtime/applicationRegistry.ts
|
|
3671
|
+
var APPLICATION_CONTEXT_KEY = Symbol.for("@getstrata/applicationContext");
|
|
3672
|
+
var activeContext;
|
|
3673
|
+
function readStoredApplicationContext() {
|
|
3674
|
+
if (activeContext) {
|
|
3675
|
+
return activeContext;
|
|
3676
|
+
}
|
|
3677
|
+
const globalContext = globalThis[APPLICATION_CONTEXT_KEY];
|
|
3678
|
+
if (globalContext) {
|
|
3679
|
+
activeContext = globalContext;
|
|
3680
|
+
}
|
|
3681
|
+
return activeContext;
|
|
3682
|
+
}
|
|
3683
|
+
function requireActiveApplicationContext() {
|
|
3684
|
+
const context = readStoredApplicationContext();
|
|
3685
|
+
if (!context) {
|
|
3686
|
+
throw new Error("The application context has not been bootstrapped.");
|
|
3687
|
+
}
|
|
3688
|
+
return context;
|
|
3689
|
+
}
|
|
3690
|
+
function resolveApplicationCache2() {
|
|
3691
|
+
return getRequiredDependency2(requireActiveApplicationContext().dependencies, "cache");
|
|
3692
|
+
}
|
|
3693
|
+
function resolveApplicationAuth2() {
|
|
3694
|
+
return requireActiveApplicationContext().container.resolve(CORE_AUTH_TOKEN2);
|
|
3695
|
+
}
|
|
3696
|
+
function resolveApplicationPolicyGate2() {
|
|
3697
|
+
return requireActiveApplicationContext().container.resolve(CORE_POLICY_GATE_TOKEN2);
|
|
3698
|
+
}
|
|
3699
|
+
|
|
3770
3700
|
// ../../src/bootstrap/queue/defaultJobs.ts
|
|
3771
3701
|
function registerDefaultJobs() {
|
|
3772
3702
|
jobRegistry.register("cache.invalidate-tags", () => {
|
|
3773
|
-
return new invalidateCacheTagsJob_default(
|
|
3703
|
+
return new invalidateCacheTagsJob_default(resolveApplicationCache2());
|
|
3774
3704
|
});
|
|
3775
3705
|
jobRegistry.register("webhook.dispatch", () => new dispatchWebhookJob_default);
|
|
3776
3706
|
}
|
|
@@ -3967,16 +3897,6 @@ class EtaViewEngine {
|
|
|
3967
3897
|
});
|
|
3968
3898
|
}
|
|
3969
3899
|
}
|
|
3970
|
-
// ../../src/core/view/htmlResponse.ts
|
|
3971
|
-
function htmlResponse(html, init = {}) {
|
|
3972
|
-
return new Response(html, {
|
|
3973
|
-
status: init.status ?? 200,
|
|
3974
|
-
statusText: init.statusText,
|
|
3975
|
-
headers: {
|
|
3976
|
-
"Content-Type": "text/html; charset=utf-8"
|
|
3977
|
-
}
|
|
3978
|
-
});
|
|
3979
|
-
}
|
|
3980
3900
|
// ../../src/core/http/cookies.ts
|
|
3981
3901
|
function readRequestCookie(request, name) {
|
|
3982
3902
|
const cookies = request.cookies;
|
|
@@ -65,11 +65,6 @@ class PreconditionFailedError extends HttpError {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
// ../../src/core/contracts/di.ts
|
|
68
|
-
var requiredDependencyKeys = [
|
|
69
|
-
"container",
|
|
70
|
-
"cache",
|
|
71
|
-
"storage"
|
|
72
|
-
];
|
|
73
68
|
function getRequiredDependency(dependencies, key) {
|
|
74
69
|
const dependency = dependencies[key];
|
|
75
70
|
if (dependency === undefined) {
|
|
@@ -77,23 +72,10 @@ function getRequiredDependency(dependencies, key) {
|
|
|
77
72
|
}
|
|
78
73
|
return dependency;
|
|
79
74
|
}
|
|
80
|
-
function assertAppDependenciesComplete(dependencies) {
|
|
81
|
-
for (const key of requiredDependencyKeys) {
|
|
82
|
-
getRequiredDependency(dependencies, key);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
function resolveService(dependencies, token) {
|
|
86
|
-
return dependencies.container.resolve(token);
|
|
87
|
-
}
|
|
88
75
|
|
|
89
76
|
// ../../src/core/contracts/serviceTokens.ts
|
|
90
|
-
var CORE_CONFIG_TOKEN = "core.config";
|
|
91
|
-
var CORE_CACHE_TOKEN = "core.cache";
|
|
92
|
-
var CORE_QUEUE_TOKEN = "core.queue";
|
|
93
|
-
var CORE_EVENT_BUS_TOKEN = "core.eventBus";
|
|
94
77
|
var CORE_POLICY_GATE_TOKEN = "core.policyGate";
|
|
95
78
|
var CORE_AUTH_TOKEN = "core.auth";
|
|
96
|
-
var CORE_TOKEN_SERVICE_TOKEN = "core.tokenService";
|
|
97
79
|
|
|
98
80
|
// ../../src/core/logging/logger.ts
|
|
99
81
|
class Logger {
|
|
@@ -144,10 +126,6 @@ function readStoredApplicationContext() {
|
|
|
144
126
|
}
|
|
145
127
|
return activeContext;
|
|
146
128
|
}
|
|
147
|
-
function setActiveApplicationContext(context) {
|
|
148
|
-
activeContext = context;
|
|
149
|
-
globalThis[APPLICATION_CONTEXT_KEY] = context;
|
|
150
|
-
}
|
|
151
129
|
function requireActiveApplicationContext() {
|
|
152
130
|
const context = readStoredApplicationContext();
|
|
153
131
|
if (!context) {
|
|
@@ -158,27 +136,12 @@ function requireActiveApplicationContext() {
|
|
|
158
136
|
function resolveApplicationCache() {
|
|
159
137
|
return getRequiredDependency(requireActiveApplicationContext().dependencies, "cache");
|
|
160
138
|
}
|
|
161
|
-
function resolveApplicationQueue() {
|
|
162
|
-
return requireActiveApplicationContext().container.resolve(CORE_QUEUE_TOKEN);
|
|
163
|
-
}
|
|
164
|
-
function resolveApplicationEventBus() {
|
|
165
|
-
return requireActiveApplicationContext().container.resolve(CORE_EVENT_BUS_TOKEN);
|
|
166
|
-
}
|
|
167
139
|
function resolveApplicationAuth() {
|
|
168
140
|
return requireActiveApplicationContext().container.resolve(CORE_AUTH_TOKEN);
|
|
169
141
|
}
|
|
170
142
|
function resolveApplicationPolicyGate() {
|
|
171
143
|
return requireActiveApplicationContext().container.resolve(CORE_POLICY_GATE_TOKEN);
|
|
172
144
|
}
|
|
173
|
-
function resolveApplicationConfig() {
|
|
174
|
-
return requireActiveApplicationContext().config;
|
|
175
|
-
}
|
|
176
|
-
function resolveApplicationLogger() {
|
|
177
|
-
return appLogger;
|
|
178
|
-
}
|
|
179
|
-
function resolveApplicationDependencies() {
|
|
180
|
-
return requireActiveApplicationContext().dependencies;
|
|
181
|
-
}
|
|
182
145
|
|
|
183
146
|
// ../../src/core/crypto/nonCryptographicHash.ts
|
|
184
147
|
function nonCryptographicDigest(input) {
|
|
@@ -74,16 +74,16 @@ function resolveRegisterRateLimit() {
|
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
// ../../src/core/contracts/serviceTokens.ts
|
|
78
|
-
var CORE_CONFIG_TOKEN = "core.config";
|
|
79
|
-
var CORE_CACHE_TOKEN = "core.cache";
|
|
80
|
-
var CORE_QUEUE_TOKEN = "core.queue";
|
|
81
|
-
var CORE_EVENT_BUS_TOKEN = "core.eventBus";
|
|
82
|
-
var CORE_POLICY_GATE_TOKEN = "core.policyGate";
|
|
83
|
-
var CORE_AUTH_TOKEN = "core.auth";
|
|
84
|
-
var CORE_TOKEN_SERVICE_TOKEN = "core.tokenService";
|
|
85
|
-
|
|
86
77
|
// ../../src/bootstrap/config.ts
|
|
78
|
+
import {
|
|
79
|
+
CORE_AUTH_TOKEN,
|
|
80
|
+
CORE_CACHE_TOKEN,
|
|
81
|
+
CORE_CONFIG_TOKEN,
|
|
82
|
+
CORE_EVENT_BUS_TOKEN,
|
|
83
|
+
CORE_POLICY_GATE_TOKEN,
|
|
84
|
+
CORE_QUEUE_TOKEN,
|
|
85
|
+
CORE_TOKEN_SERVICE_TOKEN
|
|
86
|
+
} from "@getstrata/core/contracts/serviceTokens.ts";
|
|
87
87
|
var APP_PORT_CONFIG_KEY = "app.port";
|
|
88
88
|
var CACHE_TTL_MS_CONFIG_KEY = "cache.ttlMs";
|
|
89
89
|
var CACHE_MAX_ENTRIES_CONFIG_KEY = "cache.maxEntries";
|