@getstrata/bootstrap 0.2.19 → 0.2.21
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/config.d.ts +1 -1
- package/dist/bootstrap/providers/events.d.ts +1 -1
- package/dist/bootstrap/public-api.d.ts +5 -2
- package/dist/core/contracts/serviceTokens.d.ts +2 -1
- package/dist/core/runtime/applicationRegistry.d.ts +5 -3
- package/dist/entries/applicationRegistry.js +6 -0
- package/dist/entries/config.js +2 -0
- package/dist/entries/context.js +5 -1
- package/dist/entries/createWebRoutes.js +12 -1
- package/dist/entries/dependencies.js +4236 -0
- package/dist/entries/http/securedRouteModelBinding.js +5 -0
- package/dist/entries/httpKernel.js +1 -0
- package/dist/entries/membershipService.js +5 -0
- package/dist/entries/providers/view.js +1 -0
- package/dist/entries/providers.js +5 -1
- package/dist/entries/queue/defaultJobs.js +5 -0
- package/dist/entries/routeRegistry.js +29 -0
- package/dist/entries/secretsGuard.js +91 -0
- package/dist/entries/web/routing.js +5 -0
- package/dist/framework/public-api.d.ts +1 -1
- package/dist/index.js +26 -2
- package/dist/modules/scim/controller.d.ts +1 -1
- package/dist/modules/scim/service.d.ts +1 -1
- package/dist/modules/user/provider.d.ts +1 -1
- package/package.json +18 -3
- package/dist/core/contracts/applicationContext.d.ts +0 -7
|
@@ -85,10 +85,12 @@ function assertAppDependenciesComplete(dependencies) {
|
|
|
85
85
|
function resolveService(dependencies, token) {
|
|
86
86
|
return dependencies.container.resolve(token);
|
|
87
87
|
}
|
|
88
|
+
|
|
88
89
|
// ../../src/core/contracts/serviceTokens.ts
|
|
89
90
|
var CORE_CONFIG_TOKEN = "core.config";
|
|
90
91
|
var CORE_CACHE_TOKEN = "core.cache";
|
|
91
92
|
var CORE_QUEUE_TOKEN = "core.queue";
|
|
93
|
+
var CORE_EVENT_BUS_TOKEN = "core.eventBus";
|
|
92
94
|
var CORE_POLICY_GATE_TOKEN = "core.policyGate";
|
|
93
95
|
var CORE_AUTH_TOKEN = "core.auth";
|
|
94
96
|
var CORE_TOKEN_SERVICE_TOKEN = "core.tokenService";
|
|
@@ -159,6 +161,9 @@ function resolveApplicationCache() {
|
|
|
159
161
|
function resolveApplicationQueue() {
|
|
160
162
|
return requireActiveApplicationContext().container.resolve(CORE_QUEUE_TOKEN);
|
|
161
163
|
}
|
|
164
|
+
function resolveApplicationEventBus() {
|
|
165
|
+
return requireActiveApplicationContext().container.resolve(CORE_EVENT_BUS_TOKEN);
|
|
166
|
+
}
|
|
162
167
|
function resolveApplicationAuth() {
|
|
163
168
|
return requireActiveApplicationContext().container.resolve(CORE_AUTH_TOKEN);
|
|
164
169
|
}
|
|
@@ -78,6 +78,7 @@ function resolveRegisterRateLimit() {
|
|
|
78
78
|
var CORE_CONFIG_TOKEN = "core.config";
|
|
79
79
|
var CORE_CACHE_TOKEN = "core.cache";
|
|
80
80
|
var CORE_QUEUE_TOKEN = "core.queue";
|
|
81
|
+
var CORE_EVENT_BUS_TOKEN = "core.eventBus";
|
|
81
82
|
var CORE_POLICY_GATE_TOKEN = "core.policyGate";
|
|
82
83
|
var CORE_AUTH_TOKEN = "core.auth";
|
|
83
84
|
var CORE_TOKEN_SERVICE_TOKEN = "core.tokenService";
|
|
@@ -20,10 +20,12 @@ function assertAppDependenciesComplete(dependencies) {
|
|
|
20
20
|
function resolveService(dependencies, token) {
|
|
21
21
|
return dependencies.container.resolve(token);
|
|
22
22
|
}
|
|
23
|
+
|
|
23
24
|
// ../../src/core/contracts/serviceTokens.ts
|
|
24
25
|
var CORE_CONFIG_TOKEN = "core.config";
|
|
25
26
|
var CORE_CACHE_TOKEN = "core.cache";
|
|
26
27
|
var CORE_QUEUE_TOKEN = "core.queue";
|
|
28
|
+
var CORE_EVENT_BUS_TOKEN = "core.eventBus";
|
|
27
29
|
var CORE_POLICY_GATE_TOKEN = "core.policyGate";
|
|
28
30
|
var CORE_AUTH_TOKEN = "core.auth";
|
|
29
31
|
var CORE_TOKEN_SERVICE_TOKEN = "core.tokenService";
|
|
@@ -94,6 +96,9 @@ function resolveApplicationCache() {
|
|
|
94
96
|
function resolveApplicationQueue() {
|
|
95
97
|
return requireActiveApplicationContext().container.resolve(CORE_QUEUE_TOKEN);
|
|
96
98
|
}
|
|
99
|
+
function resolveApplicationEventBus() {
|
|
100
|
+
return requireActiveApplicationContext().container.resolve(CORE_EVENT_BUS_TOKEN);
|
|
101
|
+
}
|
|
97
102
|
function resolveApplicationAuth() {
|
|
98
103
|
return requireActiveApplicationContext().container.resolve(CORE_AUTH_TOKEN);
|
|
99
104
|
}
|
|
@@ -83,6 +83,7 @@ function htmlResponse(html, init = {}) {
|
|
|
83
83
|
var CORE_CONFIG_TOKEN = "core.config";
|
|
84
84
|
var CORE_CACHE_TOKEN = "core.cache";
|
|
85
85
|
var CORE_QUEUE_TOKEN = "core.queue";
|
|
86
|
+
var CORE_EVENT_BUS_TOKEN = "core.eventBus";
|
|
86
87
|
var CORE_POLICY_GATE_TOKEN = "core.policyGate";
|
|
87
88
|
var CORE_AUTH_TOKEN = "core.auth";
|
|
88
89
|
var CORE_TOKEN_SERVICE_TOKEN = "core.tokenService";
|
|
@@ -47,6 +47,7 @@ function resolveAbilitiesForRole(role) {
|
|
|
47
47
|
var CORE_CONFIG_TOKEN = "core.config";
|
|
48
48
|
var CORE_CACHE_TOKEN = "core.cache";
|
|
49
49
|
var CORE_QUEUE_TOKEN = "core.queue";
|
|
50
|
+
var CORE_EVENT_BUS_TOKEN = "core.eventBus";
|
|
50
51
|
var CORE_POLICY_GATE_TOKEN = "core.policyGate";
|
|
51
52
|
var CORE_AUTH_TOKEN = "core.auth";
|
|
52
53
|
var CORE_TOKEN_SERVICE_TOKEN = "core.tokenService";
|
|
@@ -1277,7 +1278,6 @@ function modelEventName(tableName, action) {
|
|
|
1277
1278
|
}
|
|
1278
1279
|
|
|
1279
1280
|
// ../../src/bootstrap/providers/events.ts
|
|
1280
|
-
var CORE_EVENT_BUS_TOKEN = "core.eventBus";
|
|
1281
1281
|
var eventsProvider = {
|
|
1282
1282
|
name: "core.events",
|
|
1283
1283
|
register({ container }) {
|
|
@@ -3265,6 +3265,7 @@ function assertAppDependenciesComplete(dependencies) {
|
|
|
3265
3265
|
function resolveService(dependencies, token) {
|
|
3266
3266
|
return dependencies.container.resolve(token);
|
|
3267
3267
|
}
|
|
3268
|
+
|
|
3268
3269
|
// ../../src/core/logging/logger.ts
|
|
3269
3270
|
class Logger {
|
|
3270
3271
|
channel;
|
|
@@ -3331,6 +3332,9 @@ function resolveApplicationCache() {
|
|
|
3331
3332
|
function resolveApplicationQueue() {
|
|
3332
3333
|
return requireActiveApplicationContext().container.resolve(CORE_QUEUE_TOKEN);
|
|
3333
3334
|
}
|
|
3335
|
+
function resolveApplicationEventBus() {
|
|
3336
|
+
return requireActiveApplicationContext().container.resolve(CORE_EVENT_BUS_TOKEN);
|
|
3337
|
+
}
|
|
3334
3338
|
function resolveApplicationAuth() {
|
|
3335
3339
|
return requireActiveApplicationContext().container.resolve(CORE_AUTH_TOKEN);
|
|
3336
3340
|
}
|
|
@@ -405,10 +405,12 @@ function assertAppDependenciesComplete(dependencies) {
|
|
|
405
405
|
function resolveService(dependencies, token) {
|
|
406
406
|
return dependencies.container.resolve(token);
|
|
407
407
|
}
|
|
408
|
+
|
|
408
409
|
// ../../src/core/contracts/serviceTokens.ts
|
|
409
410
|
var CORE_CONFIG_TOKEN = "core.config";
|
|
410
411
|
var CORE_CACHE_TOKEN = "core.cache";
|
|
411
412
|
var CORE_QUEUE_TOKEN = "core.queue";
|
|
413
|
+
var CORE_EVENT_BUS_TOKEN = "core.eventBus";
|
|
412
414
|
var CORE_POLICY_GATE_TOKEN = "core.policyGate";
|
|
413
415
|
var CORE_AUTH_TOKEN = "core.auth";
|
|
414
416
|
var CORE_TOKEN_SERVICE_TOKEN = "core.tokenService";
|
|
@@ -479,6 +481,9 @@ function resolveApplicationCache() {
|
|
|
479
481
|
function resolveApplicationQueue() {
|
|
480
482
|
return requireActiveApplicationContext().container.resolve(CORE_QUEUE_TOKEN);
|
|
481
483
|
}
|
|
484
|
+
function resolveApplicationEventBus() {
|
|
485
|
+
return requireActiveApplicationContext().container.resolve(CORE_EVENT_BUS_TOKEN);
|
|
486
|
+
}
|
|
482
487
|
function resolveApplicationAuth() {
|
|
483
488
|
return requireActiveApplicationContext().container.resolve(CORE_AUTH_TOKEN);
|
|
484
489
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// ../../src/bootstrap/routeRegistry.ts
|
|
3
|
+
class RouteRegistry {
|
|
4
|
+
routes = [];
|
|
5
|
+
register(route) {
|
|
6
|
+
this.routes.push(route);
|
|
7
|
+
}
|
|
8
|
+
clear() {
|
|
9
|
+
this.routes.length = 0;
|
|
10
|
+
}
|
|
11
|
+
list() {
|
|
12
|
+
return [...this.routes].sort((left, right) => left.path.localeCompare(right.path));
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
var ROUTE_REGISTRY_KEY = Symbol.for("@getstrata/routeRegistry");
|
|
16
|
+
function readSharedRouteRegistry() {
|
|
17
|
+
const globalRegistry = globalThis[ROUTE_REGISTRY_KEY];
|
|
18
|
+
if (globalRegistry) {
|
|
19
|
+
return globalRegistry;
|
|
20
|
+
}
|
|
21
|
+
const registry = new RouteRegistry;
|
|
22
|
+
globalThis[ROUTE_REGISTRY_KEY] = registry;
|
|
23
|
+
return registry;
|
|
24
|
+
}
|
|
25
|
+
var routeRegistry = readSharedRouteRegistry();
|
|
26
|
+
export {
|
|
27
|
+
routeRegistry,
|
|
28
|
+
RouteRegistry
|
|
29
|
+
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// ../../src/config/app.ts
|
|
3
|
+
var appConfig = {
|
|
4
|
+
name: "WorkHub",
|
|
5
|
+
env: process.env.APP_ENV ?? "local",
|
|
6
|
+
debug: (process.env.APP_DEBUG ?? "true") !== "false",
|
|
7
|
+
url: process.env.APP_URL ?? "http://localhost:3000",
|
|
8
|
+
apiPrefix: process.env.API_PREFIX ?? "/api/v1"
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
// ../../src/config/features.ts
|
|
12
|
+
function readFeatureFlags() {
|
|
13
|
+
return {
|
|
14
|
+
webhooks: (process.env.FEATURE_WEBHOOKS ?? "true") !== "false",
|
|
15
|
+
fullTextSearch: (process.env.FEATURE_SEARCH ?? "true") !== "false",
|
|
16
|
+
auditLog: (process.env.FEATURE_AUDIT_LOG ?? "true") !== "false",
|
|
17
|
+
oauthLogin: (process.env.FEATURE_OAUTH ?? "true") !== "false",
|
|
18
|
+
samlLogin: (process.env.FEATURE_SAML ?? "false") === "true",
|
|
19
|
+
scim: (process.env.FEATURE_SCIM ?? "true") !== "false",
|
|
20
|
+
billing: (process.env.FEATURE_BILLING ?? "true") !== "false",
|
|
21
|
+
siemExport: (process.env.FEATURE_SIEM_EXPORT ?? "true") !== "false",
|
|
22
|
+
publicReads: (process.env.FEATURE_PUBLIC_READS ?? "true") !== "false",
|
|
23
|
+
emailVerification: (process.env.FEATURE_EMAIL_VERIFICATION ?? "false") === "true",
|
|
24
|
+
mfa: (process.env.FEATURE_MFA ?? "false") === "true"
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
var featureFlags = readFeatureFlags();
|
|
28
|
+
function isFeatureEnabled(feature) {
|
|
29
|
+
return readFeatureFlags()[feature];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// ../../src/domain/auth.ts
|
|
33
|
+
var TEST_ADMIN_API_TOKEN = "workhub-admin-test-token";
|
|
34
|
+
var TEST_MEMBER_API_TOKEN = "workhub-member-test-token";
|
|
35
|
+
|
|
36
|
+
// ../../src/domain/scim.ts
|
|
37
|
+
var TEST_SCIM_BEARER_TOKEN = "workhub-scim-test-token";
|
|
38
|
+
var DEFAULT_SCIM_BEARER_TOKEN = TEST_SCIM_BEARER_TOKEN;
|
|
39
|
+
|
|
40
|
+
// ../../src/bootstrap/secretsGuard.ts
|
|
41
|
+
var DEFAULT_TOKENS = new Set([TEST_ADMIN_API_TOKEN, TEST_MEMBER_API_TOKEN]);
|
|
42
|
+
var DEFAULT_SCIM_TOKENS = new Set([TEST_SCIM_BEARER_TOKEN, DEFAULT_SCIM_BEARER_TOKEN]);
|
|
43
|
+
function assertProductionSecrets(env = process.env) {
|
|
44
|
+
const appEnv = env.APP_ENV ?? appConfig.env;
|
|
45
|
+
if (appEnv !== "production") {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const adminToken = env.ADMIN_API_TOKEN ?? TEST_ADMIN_API_TOKEN;
|
|
49
|
+
const memberToken = env.MEMBER_API_TOKEN ?? TEST_MEMBER_API_TOKEN;
|
|
50
|
+
const scimToken = env.SCIM_BEARER_TOKEN ?? DEFAULT_SCIM_BEARER_TOKEN;
|
|
51
|
+
const encryptionEnabled = env.FEATURE_FIELD_ENCRYPTION !== "false";
|
|
52
|
+
const devHeadersEnabled = (env.AUTH_DEV_HEADERS ?? "true") !== "false";
|
|
53
|
+
if (devHeadersEnabled) {
|
|
54
|
+
throw new Error("Production startup blocked: set AUTH_DEV_HEADERS=false to disable development auth headers.");
|
|
55
|
+
}
|
|
56
|
+
if (DEFAULT_TOKENS.has(adminToken) || DEFAULT_TOKENS.has(memberToken)) {
|
|
57
|
+
throw new Error("Production startup blocked: rotate ADMIN_API_TOKEN and MEMBER_API_TOKEN away from default WorkHub test values.");
|
|
58
|
+
}
|
|
59
|
+
if (DEFAULT_SCIM_TOKENS.has(scimToken)) {
|
|
60
|
+
throw new Error("Production startup blocked: rotate SCIM_BEARER_TOKEN away from default WorkHub test values.");
|
|
61
|
+
}
|
|
62
|
+
if (encryptionEnabled && !env.KMS_ENCRYPTION_KEY?.trim()) {
|
|
63
|
+
throw new Error("Production startup blocked: set KMS_ENCRYPTION_KEY when field encryption is enabled.");
|
|
64
|
+
}
|
|
65
|
+
if (!env.SIEM_EXPORT_URL?.trim() && isFeatureEnabled("siemExport")) {
|
|
66
|
+
console.warn("[secrets] SIEM_EXPORT_URL is not configured; audit logs remain database-only.");
|
|
67
|
+
}
|
|
68
|
+
const billingEnabled = (env.FEATURE_BILLING ?? "true") !== "false";
|
|
69
|
+
if (billingEnabled && !env.STRIPE_WEBHOOK_SECRET?.trim()) {
|
|
70
|
+
throw new Error("Production startup blocked: set STRIPE_WEBHOOK_SECRET when billing webhooks are enabled.");
|
|
71
|
+
}
|
|
72
|
+
const corsOrigins = (env.CORS_ALLOWED_ORIGINS ?? "*").split(",").map((origin) => origin.trim());
|
|
73
|
+
if (corsOrigins.includes("*")) {
|
|
74
|
+
throw new Error("Production startup blocked: set explicit CORS_ALLOWED_ORIGINS instead of wildcard.");
|
|
75
|
+
}
|
|
76
|
+
if ((env.FEATURE_PUBLIC_READS ?? "true") !== "false") {
|
|
77
|
+
throw new Error("Production startup blocked: set FEATURE_PUBLIC_READS=false for authenticated-only reads.");
|
|
78
|
+
}
|
|
79
|
+
if (!env.OAUTH_STATE_SECRET?.trim()) {
|
|
80
|
+
throw new Error("Production startup blocked: set OAUTH_STATE_SECRET for OAuth CSRF protection.");
|
|
81
|
+
}
|
|
82
|
+
if (!env.TOKEN_HASH_PEPPER?.trim()) {
|
|
83
|
+
throw new Error("Production startup blocked: set TOKEN_HASH_PEPPER for API token hashing.");
|
|
84
|
+
}
|
|
85
|
+
if (!env.API_TOKEN_DEFAULT_EXPIRY_DAYS?.trim()) {
|
|
86
|
+
throw new Error("Production startup blocked: set API_TOKEN_DEFAULT_EXPIRY_DAYS to enforce token rotation.");
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
export {
|
|
90
|
+
assertProductionSecrets
|
|
91
|
+
};
|
|
@@ -88,10 +88,12 @@ function assertAppDependenciesComplete(dependencies) {
|
|
|
88
88
|
function resolveService(dependencies, token) {
|
|
89
89
|
return dependencies.container.resolve(token);
|
|
90
90
|
}
|
|
91
|
+
|
|
91
92
|
// ../../src/core/contracts/serviceTokens.ts
|
|
92
93
|
var CORE_CONFIG_TOKEN = "core.config";
|
|
93
94
|
var CORE_CACHE_TOKEN = "core.cache";
|
|
94
95
|
var CORE_QUEUE_TOKEN = "core.queue";
|
|
96
|
+
var CORE_EVENT_BUS_TOKEN = "core.eventBus";
|
|
95
97
|
var CORE_POLICY_GATE_TOKEN = "core.policyGate";
|
|
96
98
|
var CORE_AUTH_TOKEN = "core.auth";
|
|
97
99
|
var CORE_TOKEN_SERVICE_TOKEN = "core.tokenService";
|
|
@@ -162,6 +164,9 @@ function resolveApplicationCache() {
|
|
|
162
164
|
function resolveApplicationQueue() {
|
|
163
165
|
return requireActiveApplicationContext().container.resolve(CORE_QUEUE_TOKEN);
|
|
164
166
|
}
|
|
167
|
+
function resolveApplicationEventBus() {
|
|
168
|
+
return requireActiveApplicationContext().container.resolve(CORE_EVENT_BUS_TOKEN);
|
|
169
|
+
}
|
|
165
170
|
function resolveApplicationAuth() {
|
|
166
171
|
return requireActiveApplicationContext().container.resolve(CORE_AUTH_TOKEN);
|
|
167
172
|
}
|
|
@@ -95,7 +95,7 @@ export { AsyncQueue, createQueue, Job, SyncQueue } from "../core/queue/index.ts"
|
|
|
95
95
|
export { createFailedJobService, createProductionQueue, createQueueWorker, createTrackedJob, FailedJobRepository, FailedJobService, jobRegistry, QueueWorker, RedisQueue, ResilientQueue, runQueueJob, } from "../core/queue/publicQueue.ts";
|
|
96
96
|
export type { QueueMetricsSnapshot } from "../core/queue/queueMetrics.ts";
|
|
97
97
|
export { collectQueueMetrics } from "../core/queue/queueMetrics.ts";
|
|
98
|
-
export { resolveApplicationAuth, resolveApplicationCache, resolveApplicationConfig, resolveApplicationDependencies, resolveApplicationLogger, resolveApplicationPolicyGate, resolveApplicationQueue, setActiveApplicationContext, } from "../core/runtime/applicationRegistry.ts";
|
|
98
|
+
export { resolveApplicationAuth, resolveApplicationCache, resolveApplicationConfig, resolveApplicationDependencies, resolveApplicationEventBus, resolveApplicationLogger, resolveApplicationPolicyGate, resolveApplicationQueue, setActiveApplicationContext, } from "../core/runtime/applicationRegistry.ts";
|
|
99
99
|
export type { ScheduledTask } from "../core/scheduler/schedule.ts";
|
|
100
100
|
export { appSchedule, runDueScheduledTasks, Schedule } from "../core/scheduler/schedule.ts";
|
|
101
101
|
export { guestCanViewResource, isPublicReadsEnabled } from "../core/security/publicReads.ts";
|
package/dist/index.js
CHANGED
|
@@ -524,10 +524,12 @@ function assertAppDependenciesComplete(dependencies) {
|
|
|
524
524
|
function resolveService(dependencies, token) {
|
|
525
525
|
return dependencies.container.resolve(token);
|
|
526
526
|
}
|
|
527
|
+
|
|
527
528
|
// ../../src/core/contracts/serviceTokens.ts
|
|
528
529
|
var CORE_CONFIG_TOKEN = "core.config";
|
|
529
530
|
var CORE_CACHE_TOKEN = "core.cache";
|
|
530
531
|
var CORE_QUEUE_TOKEN = "core.queue";
|
|
532
|
+
var CORE_EVENT_BUS_TOKEN = "core.eventBus";
|
|
531
533
|
var CORE_POLICY_GATE_TOKEN = "core.policyGate";
|
|
532
534
|
var CORE_AUTH_TOKEN = "core.auth";
|
|
533
535
|
var CORE_TOKEN_SERVICE_TOKEN = "core.tokenService";
|
|
@@ -562,6 +564,9 @@ function resolveApplicationCache() {
|
|
|
562
564
|
function resolveApplicationQueue() {
|
|
563
565
|
return requireActiveApplicationContext().container.resolve(CORE_QUEUE_TOKEN);
|
|
564
566
|
}
|
|
567
|
+
function resolveApplicationEventBus() {
|
|
568
|
+
return requireActiveApplicationContext().container.resolve(CORE_EVENT_BUS_TOKEN);
|
|
569
|
+
}
|
|
565
570
|
function resolveApplicationAuth() {
|
|
566
571
|
return requireActiveApplicationContext().container.resolve(CORE_AUTH_TOKEN);
|
|
567
572
|
}
|
|
@@ -1789,7 +1794,6 @@ function modelEventName(tableName, action) {
|
|
|
1789
1794
|
}
|
|
1790
1795
|
|
|
1791
1796
|
// ../../src/bootstrap/providers/events.ts
|
|
1792
|
-
var CORE_EVENT_BUS_TOKEN = "core.eventBus";
|
|
1793
1797
|
var eventsProvider = {
|
|
1794
1798
|
name: "core.events",
|
|
1795
1799
|
register({ container }) {
|
|
@@ -4676,7 +4680,17 @@ class RouteRegistry {
|
|
|
4676
4680
|
return [...this.routes].sort((left, right) => left.path.localeCompare(right.path));
|
|
4677
4681
|
}
|
|
4678
4682
|
}
|
|
4679
|
-
var
|
|
4683
|
+
var ROUTE_REGISTRY_KEY = Symbol.for("@getstrata/routeRegistry");
|
|
4684
|
+
function readSharedRouteRegistry() {
|
|
4685
|
+
const globalRegistry = globalThis[ROUTE_REGISTRY_KEY];
|
|
4686
|
+
if (globalRegistry) {
|
|
4687
|
+
return globalRegistry;
|
|
4688
|
+
}
|
|
4689
|
+
const registry = new RouteRegistry;
|
|
4690
|
+
globalThis[ROUTE_REGISTRY_KEY] = registry;
|
|
4691
|
+
return registry;
|
|
4692
|
+
}
|
|
4693
|
+
var routeRegistry = readSharedRouteRegistry();
|
|
4680
4694
|
|
|
4681
4695
|
// ../../src/bootstrap/createWebRoutes.ts
|
|
4682
4696
|
function registerRoute(method, path, middleware) {
|
|
@@ -4738,6 +4752,10 @@ function mergeWebRoutes(dependencies, routes) {
|
|
|
4738
4752
|
...routes
|
|
4739
4753
|
};
|
|
4740
4754
|
}
|
|
4755
|
+
// ../../src/bootstrap/dependencies.ts
|
|
4756
|
+
function createAppDependencies() {
|
|
4757
|
+
return createAppContext().dependencies;
|
|
4758
|
+
}
|
|
4741
4759
|
// ../../src/core/crypto/nonCryptographicHash.ts
|
|
4742
4760
|
function nonCryptographicDigest(input) {
|
|
4743
4761
|
return Bun.hash(input).toString(16);
|
|
@@ -5269,12 +5287,14 @@ export {
|
|
|
5269
5287
|
scheduleRunCommand,
|
|
5270
5288
|
runProviderPhase,
|
|
5271
5289
|
runDueScheduledTasks,
|
|
5290
|
+
routeRegistry,
|
|
5272
5291
|
routeParams,
|
|
5273
5292
|
resolveService,
|
|
5274
5293
|
resolveMembershipService,
|
|
5275
5294
|
resolveApplicationQueue,
|
|
5276
5295
|
resolveApplicationPolicyGate,
|
|
5277
5296
|
resolveApplicationLogger,
|
|
5297
|
+
resolveApplicationEventBus,
|
|
5278
5298
|
resolveApplicationDependencies,
|
|
5279
5299
|
resolveApplicationConfig,
|
|
5280
5300
|
resolveApplicationCache,
|
|
@@ -5290,14 +5310,17 @@ export {
|
|
|
5290
5310
|
createRouteKernel,
|
|
5291
5311
|
createHttpKernel,
|
|
5292
5312
|
createCsrfProtection,
|
|
5313
|
+
createAppDependencies,
|
|
5293
5314
|
createAppContext,
|
|
5294
5315
|
coreProviders,
|
|
5295
5316
|
collectProviders,
|
|
5296
5317
|
cacheTagsForModelWrite,
|
|
5318
|
+
assertProductionSecrets,
|
|
5297
5319
|
assertAppDependenciesComplete,
|
|
5298
5320
|
appSchedule,
|
|
5299
5321
|
ServiceContainer,
|
|
5300
5322
|
Schedule,
|
|
5323
|
+
RouteRegistry,
|
|
5301
5324
|
REDIS_URL_CONFIG_KEY,
|
|
5302
5325
|
DEFAULT_APP_PORT,
|
|
5303
5326
|
DATABASE_URL_CONFIG_KEY,
|
|
@@ -5305,6 +5328,7 @@ export {
|
|
|
5305
5328
|
CORE_TOKEN_SERVICE_TOKEN,
|
|
5306
5329
|
CORE_QUEUE_TOKEN,
|
|
5307
5330
|
CORE_POLICY_GATE_TOKEN,
|
|
5331
|
+
CORE_EVENT_BUS_TOKEN,
|
|
5308
5332
|
CORE_CONFIG_TOKEN,
|
|
5309
5333
|
CORE_CACHE_TOKEN,
|
|
5310
5334
|
CORE_AUTH_TOKEN,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AppDependencies } from "@getstrata/
|
|
1
|
+
import type { AppDependencies } from "@getstrata/core/contracts/di";
|
|
2
2
|
import OrganizationMemberRepository from "../organization/memberRepository";
|
|
3
3
|
import OrganizationRepository from "../organization/repository";
|
|
4
4
|
import type UserRepository from "../user/repository";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ServiceProvider } from "@getstrata/
|
|
1
|
+
import type { ServiceProvider } from "@getstrata/core/contracts/di";
|
|
2
2
|
declare const userRepositoryToken = "user.repository";
|
|
3
3
|
declare const apiTokenRepositoryToken = "user.apiTokenRepository";
|
|
4
4
|
declare const tokenServiceToken = "core.tokenService";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getstrata/bootstrap",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.21",
|
|
4
4
|
"description": "Strata application bootstrap — HttpKernel, DI, web session helpers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -45,6 +45,11 @@
|
|
|
45
45
|
"import": "./dist/entries/createWebRoutes.js",
|
|
46
46
|
"default": "./dist/entries/createWebRoutes.js"
|
|
47
47
|
},
|
|
48
|
+
"./dependencies": {
|
|
49
|
+
"types": "./dist/bootstrap/dependencies.d.ts",
|
|
50
|
+
"import": "./dist/entries/dependencies.js",
|
|
51
|
+
"default": "./dist/entries/dependencies.js"
|
|
52
|
+
},
|
|
48
53
|
"./http/securedRouteModelBinding": {
|
|
49
54
|
"types": "./dist/bootstrap/http/securedRouteModelBinding.d.ts",
|
|
50
55
|
"import": "./dist/entries/http/securedRouteModelBinding.js",
|
|
@@ -75,6 +80,16 @@
|
|
|
75
80
|
"import": "./dist/entries/providers/view.js",
|
|
76
81
|
"default": "./dist/entries/providers/view.js"
|
|
77
82
|
},
|
|
83
|
+
"./routeRegistry": {
|
|
84
|
+
"types": "./dist/bootstrap/routeRegistry.d.ts",
|
|
85
|
+
"import": "./dist/entries/routeRegistry.js",
|
|
86
|
+
"default": "./dist/entries/routeRegistry.js"
|
|
87
|
+
},
|
|
88
|
+
"./secretsGuard": {
|
|
89
|
+
"types": "./dist/bootstrap/secretsGuard.d.ts",
|
|
90
|
+
"import": "./dist/entries/secretsGuard.js",
|
|
91
|
+
"default": "./dist/entries/secretsGuard.js"
|
|
92
|
+
},
|
|
78
93
|
"./web/forms": {
|
|
79
94
|
"types": "./dist/bootstrap/web/forms.d.ts",
|
|
80
95
|
"import": "./dist/entries/web/forms.js",
|
|
@@ -112,14 +127,14 @@
|
|
|
112
127
|
"build:bundle": "bun build index.ts --outdir dist --target bun --external bun --external eta --external @getstrata/core",
|
|
113
128
|
"build:types": "tsc -p tsconfig.types.json",
|
|
114
129
|
"prepublishOnly": "bun run build",
|
|
115
|
-
"build:subpaths": "bun build entries/applicationRegistry.ts entries/cache/modelCacheTags.ts entries/config.ts entries/context.ts entries/contracts.ts entries/createWebRoutes.ts entries/http/securedRouteModelBinding.ts entries/httpKernel.ts entries/membershipService.ts entries/queue/defaultJobs.ts entries/providers.ts entries/providers/view.ts entries/web/forms.ts entries/web/routing.ts entries/web/server.ts entries/web/session.ts entries/web/slug.ts --outdir dist --root . --target bun --external bun --external eta --external @getstrata/core",
|
|
130
|
+
"build:subpaths": "bun build entries/applicationRegistry.ts entries/cache/modelCacheTags.ts entries/config.ts entries/context.ts entries/contracts.ts entries/createWebRoutes.ts entries/dependencies.ts entries/http/securedRouteModelBinding.ts entries/httpKernel.ts entries/membershipService.ts entries/queue/defaultJobs.ts entries/providers.ts entries/providers/view.ts entries/routeRegistry.ts entries/secretsGuard.ts entries/web/forms.ts entries/web/routing.ts entries/web/server.ts entries/web/session.ts entries/web/slug.ts --outdir dist --root . --target bun --external bun --external eta --external @getstrata/core",
|
|
116
131
|
"build:shims": "true"
|
|
117
132
|
},
|
|
118
133
|
"publishConfig": {
|
|
119
134
|
"access": "public"
|
|
120
135
|
},
|
|
121
136
|
"peerDependencies": {
|
|
122
|
-
"@getstrata/core": "^0.5.
|
|
137
|
+
"@getstrata/core": "^0.5.29",
|
|
123
138
|
"typescript": "^5.9.0"
|
|
124
139
|
}
|
|
125
140
|
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { AppContext, AppDependencies } from "./di";
|
|
2
|
-
/** @deprecated Use AppContext from @getstrata/core/contracts/di */
|
|
3
|
-
type ApplicationContext = AppContext;
|
|
4
|
-
/** @deprecated Use AppDependencies from @getstrata/core/contracts/di */
|
|
5
|
-
type ApplicationDependenciesLike = AppDependencies;
|
|
6
|
-
export { getRequiredDependency } from "./di";
|
|
7
|
-
export type { ApplicationContext, ApplicationDependenciesLike };
|