@getstrata/bootstrap 0.2.12 → 0.2.13

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.
@@ -301,6 +301,23 @@ class MembershipService {
301
301
  }
302
302
  var membershipService_default = MembershipService;
303
303
 
304
+ // ../../src/core/contracts/applicationContext.ts
305
+ function getRequiredDependency(dependencies, key) {
306
+ const dependency = dependencies[key];
307
+ if (dependency === undefined) {
308
+ throw new Error(`Required dependency "${String(key)}" is not registered.`);
309
+ }
310
+ return dependency;
311
+ }
312
+
313
+ // ../../src/core/contracts/serviceTokens.ts
314
+ var CORE_CONFIG_TOKEN = "core.config";
315
+ var CORE_CACHE_TOKEN = "core.cache";
316
+ var CORE_QUEUE_TOKEN = "core.queue";
317
+ var CORE_POLICY_GATE_TOKEN = "core.policyGate";
318
+ var CORE_AUTH_TOKEN = "core.auth";
319
+ var CORE_TOKEN_SERVICE_TOKEN = "core.tokenService";
320
+
304
321
  // ../../src/core/logging/logger.ts
305
322
  class Logger {
306
323
  channel;
@@ -337,113 +354,7 @@ class Logger {
337
354
  }
338
355
  var appLogger = new Logger("app");
339
356
 
340
- // ../../src/bootstrap/config.ts
341
- var APP_PORT_CONFIG_KEY = "app.port";
342
- var CACHE_TTL_MS_CONFIG_KEY = "cache.ttlMs";
343
- var CACHE_MAX_ENTRIES_CONFIG_KEY = "cache.maxEntries";
344
- var CACHE_DRIVER_CONFIG_KEY = "cache.driver";
345
- var REDIS_URL_CONFIG_KEY = "cache.redisUrl";
346
- var DATABASE_URL_CONFIG_KEY = "database.url";
347
- var CORE_CONFIG_TOKEN = "core.config";
348
- var CORE_CACHE_TOKEN = "core.cache";
349
- var CORE_QUEUE_TOKEN = "core.queue";
350
- var CORE_POLICY_GATE_TOKEN = "core.policyGate";
351
- var CORE_AUTH_TOKEN = "core.auth";
352
- var CORE_TOKEN_SERVICE_TOKEN = "core.tokenService";
353
- var AUTH_DEV_HEADERS_CONFIG_KEY = "auth.allowDevHeaders";
354
- var DEFAULT_APP_PORT = 3000;
355
- var DEFAULT_CACHE_TTL_MS = 3600000;
356
- var DEFAULT_CACHE_MAX_ENTRIES = 100;
357
- var DEFAULT_CACHE_DRIVER = "array";
358
- var DEFAULT_API_TOKEN = "";
359
- var DEFAULT_QUEUE_DRIVER = "sync";
360
-
361
- // ../../src/bootstrap/contracts.ts
362
- class ServiceContainer {
363
- services = new Map;
364
- singletonFactories = new Map;
365
- bindings = new Map;
366
- set(key, value) {
367
- this.singletonFactories.delete(key);
368
- this.bindings.delete(key);
369
- this.services.set(key, value);
370
- return value;
371
- }
372
- singleton(key, factory) {
373
- this.bindings.delete(key);
374
- this.services.delete(key);
375
- this.singletonFactories.set(key, factory);
376
- }
377
- bind(key, factory) {
378
- this.singletonFactories.delete(key);
379
- this.services.delete(key);
380
- this.bindings.set(key, factory);
381
- }
382
- get(key) {
383
- if (this.services.has(key)) {
384
- return this.services.get(key);
385
- }
386
- const singletonFactory = this.singletonFactories.get(key);
387
- if (singletonFactory) {
388
- const value = singletonFactory(this);
389
- this.services.set(key, value);
390
- return value;
391
- }
392
- const binding = this.bindings.get(key);
393
- if (binding) {
394
- return binding(this);
395
- }
396
- throw new Error(`Service "${key}" is not registered.`);
397
- }
398
- resolve(key) {
399
- return this.get(key);
400
- }
401
- has(key) {
402
- return this.services.has(key) || this.singletonFactories.has(key) || this.bindings.has(key);
403
- }
404
- }
405
-
406
- class ConfigStore {
407
- values = new Map;
408
- set(key, value) {
409
- this.values.set(key, value);
410
- return value;
411
- }
412
- get(key) {
413
- return this.values.get(key);
414
- }
415
- require(key) {
416
- if (!this.values.has(key)) {
417
- throw new Error(`Config key "${key}" is not defined.`);
418
- }
419
- return this.values.get(key);
420
- }
421
- has(key) {
422
- return this.values.has(key);
423
- }
424
- }
425
- var requiredDependencyKeys = [
426
- "container",
427
- "cache",
428
- "storage"
429
- ];
430
- function getRequiredDependency(dependencies, key) {
431
- const dependency = dependencies[key];
432
- if (dependency === undefined) {
433
- throw new Error(`Required dependency "${key}" is not registered.`);
434
- }
435
- return dependency;
436
- }
437
- function assertAppDependenciesComplete(dependencies) {
438
- for (const key of requiredDependencyKeys) {
439
- getRequiredDependency(dependencies, key);
440
- }
441
- }
442
- function resolveService(dependencies, token) {
443
- return dependencies.container.resolve(token);
444
- }
445
-
446
- // ../../src/bootstrap/applicationRegistry.ts
357
+ // ../../src/core/runtime/applicationRegistry.ts
447
358
  var APPLICATION_CONTEXT_KEY = Symbol.for("@getstrata/applicationContext");
448
359
  var activeContext;
449
360
  function readStoredApplicationContext() {
@@ -488,7 +399,6 @@ function resolveApplicationLogger() {
488
399
  function resolveApplicationDependencies() {
489
400
  return requireActiveApplicationContext().dependencies;
490
401
  }
491
-
492
402
  // ../../src/bootstrap/membershipService.ts
493
403
  function resolveMembershipService() {
494
404
  const dependencies = resolveApplicationDependencies();
@@ -79,6 +79,14 @@ 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_POLICY_GATE_TOKEN = "core.policyGate";
87
+ var CORE_AUTH_TOKEN = "core.auth";
88
+ var CORE_TOKEN_SERVICE_TOKEN = "core.tokenService";
89
+
82
90
  // ../../src/bootstrap/config.ts
83
91
  var APP_PORT_CONFIG_KEY = "app.port";
84
92
  var CACHE_TTL_MS_CONFIG_KEY = "cache.ttlMs";
@@ -86,12 +94,6 @@ var CACHE_MAX_ENTRIES_CONFIG_KEY = "cache.maxEntries";
86
94
  var CACHE_DRIVER_CONFIG_KEY = "cache.driver";
87
95
  var REDIS_URL_CONFIG_KEY = "cache.redisUrl";
88
96
  var DATABASE_URL_CONFIG_KEY = "database.url";
89
- var CORE_CONFIG_TOKEN = "core.config";
90
- var CORE_CACHE_TOKEN = "core.cache";
91
- var CORE_QUEUE_TOKEN = "core.queue";
92
- var CORE_POLICY_GATE_TOKEN = "core.policyGate";
93
- var CORE_AUTH_TOKEN = "core.auth";
94
- var CORE_TOKEN_SERVICE_TOKEN = "core.tokenService";
95
97
  var AUTH_DEV_HEADERS_CONFIG_KEY = "auth.allowDevHeaders";
96
98
  var DEFAULT_APP_PORT = 3000;
97
99
  var DEFAULT_CACHE_TTL_MS = 3600000;
@@ -43,6 +43,14 @@ 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_POLICY_GATE_TOKEN = "core.policyGate";
51
+ var CORE_AUTH_TOKEN = "core.auth";
52
+ var CORE_TOKEN_SERVICE_TOKEN = "core.tokenService";
53
+
46
54
  // ../../src/bootstrap/config.ts
47
55
  var APP_PORT_CONFIG_KEY = "app.port";
48
56
  var CACHE_TTL_MS_CONFIG_KEY = "cache.ttlMs";
@@ -50,12 +58,6 @@ var CACHE_MAX_ENTRIES_CONFIG_KEY = "cache.maxEntries";
50
58
  var CACHE_DRIVER_CONFIG_KEY = "cache.driver";
51
59
  var REDIS_URL_CONFIG_KEY = "cache.redisUrl";
52
60
  var DATABASE_URL_CONFIG_KEY = "database.url";
53
- var CORE_CONFIG_TOKEN = "core.config";
54
- var CORE_CACHE_TOKEN = "core.cache";
55
- var CORE_QUEUE_TOKEN = "core.queue";
56
- var CORE_POLICY_GATE_TOKEN = "core.policyGate";
57
- var CORE_AUTH_TOKEN = "core.auth";
58
- var CORE_TOKEN_SERVICE_TOKEN = "core.tokenService";
59
61
  var AUTH_DEV_HEADERS_CONFIG_KEY = "auth.allowDevHeaders";
60
62
  var DEFAULT_APP_PORT = 3000;
61
63
  var DEFAULT_CACHE_TTL_MS = 3600000;
@@ -3410,6 +3412,15 @@ class DispatchWebhookJob extends Job {
3410
3412
  }
3411
3413
  var dispatchWebhookJob_default = DispatchWebhookJob;
3412
3414
 
3415
+ // ../../src/core/contracts/applicationContext.ts
3416
+ function getRequiredDependency(dependencies, key) {
3417
+ const dependency = dependencies[key];
3418
+ if (dependency === undefined) {
3419
+ throw new Error(`Required dependency "${String(key)}" is not registered.`);
3420
+ }
3421
+ return dependency;
3422
+ }
3423
+
3413
3424
  // ../../src/core/logging/logger.ts
3414
3425
  class Logger {
3415
3426
  channel;
@@ -3446,92 +3457,7 @@ class Logger {
3446
3457
  }
3447
3458
  var appLogger = new Logger("app");
3448
3459
 
3449
- // ../../src/bootstrap/contracts.ts
3450
- class ServiceContainer {
3451
- services = new Map;
3452
- singletonFactories = new Map;
3453
- bindings = new Map;
3454
- set(key, value) {
3455
- this.singletonFactories.delete(key);
3456
- this.bindings.delete(key);
3457
- this.services.set(key, value);
3458
- return value;
3459
- }
3460
- singleton(key, factory) {
3461
- this.bindings.delete(key);
3462
- this.services.delete(key);
3463
- this.singletonFactories.set(key, factory);
3464
- }
3465
- bind(key, factory) {
3466
- this.singletonFactories.delete(key);
3467
- this.services.delete(key);
3468
- this.bindings.set(key, factory);
3469
- }
3470
- get(key) {
3471
- if (this.services.has(key)) {
3472
- return this.services.get(key);
3473
- }
3474
- const singletonFactory = this.singletonFactories.get(key);
3475
- if (singletonFactory) {
3476
- const value = singletonFactory(this);
3477
- this.services.set(key, value);
3478
- return value;
3479
- }
3480
- const binding = this.bindings.get(key);
3481
- if (binding) {
3482
- return binding(this);
3483
- }
3484
- throw new Error(`Service "${key}" is not registered.`);
3485
- }
3486
- resolve(key) {
3487
- return this.get(key);
3488
- }
3489
- has(key) {
3490
- return this.services.has(key) || this.singletonFactories.has(key) || this.bindings.has(key);
3491
- }
3492
- }
3493
-
3494
- class ConfigStore {
3495
- values = new Map;
3496
- set(key, value) {
3497
- this.values.set(key, value);
3498
- return value;
3499
- }
3500
- get(key) {
3501
- return this.values.get(key);
3502
- }
3503
- require(key) {
3504
- if (!this.values.has(key)) {
3505
- throw new Error(`Config key "${key}" is not defined.`);
3506
- }
3507
- return this.values.get(key);
3508
- }
3509
- has(key) {
3510
- return this.values.has(key);
3511
- }
3512
- }
3513
- var requiredDependencyKeys = [
3514
- "container",
3515
- "cache",
3516
- "storage"
3517
- ];
3518
- function getRequiredDependency(dependencies, key) {
3519
- const dependency = dependencies[key];
3520
- if (dependency === undefined) {
3521
- throw new Error(`Required dependency "${key}" is not registered.`);
3522
- }
3523
- return dependency;
3524
- }
3525
- function assertAppDependenciesComplete(dependencies) {
3526
- for (const key of requiredDependencyKeys) {
3527
- getRequiredDependency(dependencies, key);
3528
- }
3529
- }
3530
- function resolveService(dependencies, token) {
3531
- return dependencies.container.resolve(token);
3532
- }
3533
-
3534
- // ../../src/bootstrap/applicationRegistry.ts
3460
+ // ../../src/core/runtime/applicationRegistry.ts
3535
3461
  var APPLICATION_CONTEXT_KEY = Symbol.for("@getstrata/applicationContext");
3536
3462
  var activeContext;
3537
3463
  function readStoredApplicationContext() {
@@ -3576,7 +3502,6 @@ function resolveApplicationLogger() {
3576
3502
  function resolveApplicationDependencies() {
3577
3503
  return requireActiveApplicationContext().dependencies;
3578
3504
  }
3579
-
3580
3505
  // ../../src/bootstrap/queue/defaultJobs.ts
3581
3506
  function registerDefaultJobs() {
3582
3507
  jobRegistry.register("cache.invalidate-tags", () => {
@@ -375,6 +375,23 @@ class JobRegistry {
375
375
  }
376
376
  var jobRegistry = new JobRegistry;
377
377
 
378
+ // ../../src/core/contracts/applicationContext.ts
379
+ function getRequiredDependency(dependencies, key) {
380
+ const dependency = dependencies[key];
381
+ if (dependency === undefined) {
382
+ throw new Error(`Required dependency "${String(key)}" is not registered.`);
383
+ }
384
+ return dependency;
385
+ }
386
+
387
+ // ../../src/core/contracts/serviceTokens.ts
388
+ var CORE_CONFIG_TOKEN = "core.config";
389
+ var CORE_CACHE_TOKEN = "core.cache";
390
+ var CORE_QUEUE_TOKEN = "core.queue";
391
+ var CORE_POLICY_GATE_TOKEN = "core.policyGate";
392
+ var CORE_AUTH_TOKEN = "core.auth";
393
+ var CORE_TOKEN_SERVICE_TOKEN = "core.tokenService";
394
+
378
395
  // ../../src/core/logging/logger.ts
379
396
  class Logger {
380
397
  channel;
@@ -411,113 +428,7 @@ class Logger {
411
428
  }
412
429
  var appLogger = new Logger("app");
413
430
 
414
- // ../../src/bootstrap/config.ts
415
- var APP_PORT_CONFIG_KEY = "app.port";
416
- var CACHE_TTL_MS_CONFIG_KEY = "cache.ttlMs";
417
- var CACHE_MAX_ENTRIES_CONFIG_KEY = "cache.maxEntries";
418
- var CACHE_DRIVER_CONFIG_KEY = "cache.driver";
419
- var REDIS_URL_CONFIG_KEY = "cache.redisUrl";
420
- var DATABASE_URL_CONFIG_KEY = "database.url";
421
- var CORE_CONFIG_TOKEN = "core.config";
422
- var CORE_CACHE_TOKEN = "core.cache";
423
- var CORE_QUEUE_TOKEN = "core.queue";
424
- var CORE_POLICY_GATE_TOKEN = "core.policyGate";
425
- var CORE_AUTH_TOKEN = "core.auth";
426
- var CORE_TOKEN_SERVICE_TOKEN = "core.tokenService";
427
- var AUTH_DEV_HEADERS_CONFIG_KEY = "auth.allowDevHeaders";
428
- var DEFAULT_APP_PORT = 3000;
429
- var DEFAULT_CACHE_TTL_MS = 3600000;
430
- var DEFAULT_CACHE_MAX_ENTRIES = 100;
431
- var DEFAULT_CACHE_DRIVER = "array";
432
- var DEFAULT_API_TOKEN = "";
433
- var DEFAULT_QUEUE_DRIVER = "sync";
434
-
435
- // ../../src/bootstrap/contracts.ts
436
- class ServiceContainer {
437
- services = new Map;
438
- singletonFactories = new Map;
439
- bindings = new Map;
440
- set(key, value) {
441
- this.singletonFactories.delete(key);
442
- this.bindings.delete(key);
443
- this.services.set(key, value);
444
- return value;
445
- }
446
- singleton(key, factory) {
447
- this.bindings.delete(key);
448
- this.services.delete(key);
449
- this.singletonFactories.set(key, factory);
450
- }
451
- bind(key, factory) {
452
- this.singletonFactories.delete(key);
453
- this.services.delete(key);
454
- this.bindings.set(key, factory);
455
- }
456
- get(key) {
457
- if (this.services.has(key)) {
458
- return this.services.get(key);
459
- }
460
- const singletonFactory = this.singletonFactories.get(key);
461
- if (singletonFactory) {
462
- const value = singletonFactory(this);
463
- this.services.set(key, value);
464
- return value;
465
- }
466
- const binding = this.bindings.get(key);
467
- if (binding) {
468
- return binding(this);
469
- }
470
- throw new Error(`Service "${key}" is not registered.`);
471
- }
472
- resolve(key) {
473
- return this.get(key);
474
- }
475
- has(key) {
476
- return this.services.has(key) || this.singletonFactories.has(key) || this.bindings.has(key);
477
- }
478
- }
479
-
480
- class ConfigStore {
481
- values = new Map;
482
- set(key, value) {
483
- this.values.set(key, value);
484
- return value;
485
- }
486
- get(key) {
487
- return this.values.get(key);
488
- }
489
- require(key) {
490
- if (!this.values.has(key)) {
491
- throw new Error(`Config key "${key}" is not defined.`);
492
- }
493
- return this.values.get(key);
494
- }
495
- has(key) {
496
- return this.values.has(key);
497
- }
498
- }
499
- var requiredDependencyKeys = [
500
- "container",
501
- "cache",
502
- "storage"
503
- ];
504
- function getRequiredDependency(dependencies, key) {
505
- const dependency = dependencies[key];
506
- if (dependency === undefined) {
507
- throw new Error(`Required dependency "${key}" is not registered.`);
508
- }
509
- return dependency;
510
- }
511
- function assertAppDependenciesComplete(dependencies) {
512
- for (const key of requiredDependencyKeys) {
513
- getRequiredDependency(dependencies, key);
514
- }
515
- }
516
- function resolveService(dependencies, token) {
517
- return dependencies.container.resolve(token);
518
- }
519
-
520
- // ../../src/bootstrap/applicationRegistry.ts
431
+ // ../../src/core/runtime/applicationRegistry.ts
521
432
  var APPLICATION_CONTEXT_KEY = Symbol.for("@getstrata/applicationContext");
522
433
  var activeContext;
523
434
  function readStoredApplicationContext() {
@@ -562,7 +473,6 @@ function resolveApplicationLogger() {
562
473
  function resolveApplicationDependencies() {
563
474
  return requireActiveApplicationContext().dependencies;
564
475
  }
565
-
566
476
  // ../../src/bootstrap/queue/defaultJobs.ts
567
477
  function registerDefaultJobs() {
568
478
  jobRegistry.register("cache.invalidate-tags", () => {
@@ -2,7 +2,6 @@
2
2
  * Stable framework surface for application modules and future package extraction.
3
3
  * Import from `@getstrata/core` (workspace) or `src/framework/public-api`.
4
4
  */
5
- export { resolveApplicationAuth, resolveApplicationCache, resolveApplicationConfig, resolveApplicationDependencies, resolveApplicationLogger, resolveApplicationPolicyGate, resolveApplicationQueue, setActiveApplicationContext, } from "../bootstrap/applicationRegistry.ts";
6
5
  export type { ServiceProvider } from "../bootstrap/contracts.ts";
7
6
  export { ConfigStore, resolveService, ServiceContainer, } from "../bootstrap/contracts.ts";
8
7
  export type { AdminColumn, AdminColumnType, AdminResource, AdminResourceDefinition, AdminResourceHandlers, } from "../core/admin/index.ts";
@@ -96,6 +95,7 @@ export { AsyncQueue, createQueue, Job, SyncQueue } from "../core/queue/index.ts"
96
95
  export { createFailedJobService, createProductionQueue, createQueueWorker, createTrackedJob, FailedJobRepository, FailedJobService, jobRegistry, QueueWorker, RedisQueue, ResilientQueue, runQueueJob, } from "../core/queue/publicQueue.ts";
97
96
  export type { QueueMetricsSnapshot } from "../core/queue/queueMetrics.ts";
98
97
  export { collectQueueMetrics } from "../core/queue/queueMetrics.ts";
98
+ export { resolveApplicationAuth, resolveApplicationCache, resolveApplicationConfig, resolveApplicationDependencies, 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
@@ -503,6 +503,85 @@ async function scheduleRunCommand() {
503
503
  }
504
504
  await runDueScheduledTasks(appSchedule);
505
505
  }
506
+ // ../../src/core/contracts/applicationContext.ts
507
+ function getRequiredDependency(dependencies, key) {
508
+ const dependency = dependencies[key];
509
+ if (dependency === undefined) {
510
+ throw new Error(`Required dependency "${String(key)}" is not registered.`);
511
+ }
512
+ return dependency;
513
+ }
514
+
515
+ // ../../src/core/contracts/serviceTokens.ts
516
+ var CORE_CONFIG_TOKEN = "core.config";
517
+ var CORE_CACHE_TOKEN = "core.cache";
518
+ var CORE_QUEUE_TOKEN = "core.queue";
519
+ var CORE_POLICY_GATE_TOKEN = "core.policyGate";
520
+ var CORE_AUTH_TOKEN = "core.auth";
521
+ var CORE_TOKEN_SERVICE_TOKEN = "core.tokenService";
522
+
523
+ // ../../src/core/runtime/applicationRegistry.ts
524
+ var APPLICATION_CONTEXT_KEY = Symbol.for("@getstrata/applicationContext");
525
+ var activeContext;
526
+ function readStoredApplicationContext() {
527
+ if (activeContext) {
528
+ return activeContext;
529
+ }
530
+ const globalContext = globalThis[APPLICATION_CONTEXT_KEY];
531
+ if (globalContext) {
532
+ activeContext = globalContext;
533
+ }
534
+ return activeContext;
535
+ }
536
+ function setActiveApplicationContext(context) {
537
+ activeContext = context;
538
+ globalThis[APPLICATION_CONTEXT_KEY] = context;
539
+ }
540
+ function requireActiveApplicationContext() {
541
+ const context = readStoredApplicationContext();
542
+ if (!context) {
543
+ throw new Error("The application context has not been bootstrapped.");
544
+ }
545
+ return context;
546
+ }
547
+ function resolveApplicationCache() {
548
+ return getRequiredDependency(requireActiveApplicationContext().dependencies, "cache");
549
+ }
550
+ function resolveApplicationQueue() {
551
+ return requireActiveApplicationContext().container.resolve(CORE_QUEUE_TOKEN);
552
+ }
553
+ function resolveApplicationAuth() {
554
+ return requireActiveApplicationContext().container.resolve(CORE_AUTH_TOKEN);
555
+ }
556
+ function resolveApplicationPolicyGate() {
557
+ return requireActiveApplicationContext().container.resolve(CORE_POLICY_GATE_TOKEN);
558
+ }
559
+ function resolveApplicationConfig() {
560
+ return requireActiveApplicationContext().config;
561
+ }
562
+ function resolveApplicationLogger() {
563
+ return appLogger;
564
+ }
565
+ function resolveApplicationDependencies() {
566
+ return requireActiveApplicationContext().dependencies;
567
+ }
568
+ // ../../src/bootstrap/discoverModules.ts
569
+ var appModules = [];
570
+ function discoverModules() {
571
+ return appModules;
572
+ }
573
+
574
+ // ../../src/bootstrap/cache/modelCacheTags.ts
575
+ function cacheTagsForModelWrite(tableName, action) {
576
+ const module = discoverModules().find((entry) => entry.tableName === tableName);
577
+ const baseTags = module?.cacheTags ?? [`${tableName}s`];
578
+ const isDelete = action === "deleted" || action === "force-deleted";
579
+ const extraTags = isDelete ? module?.cacheDeleteExtraTags ?? [] : [];
580
+ return [...new Set([...baseTags, ...extraTags])];
581
+ }
582
+ function discoverModelTableNames() {
583
+ return discoverModules().map((module) => module.tableName).filter((tableName) => tableName !== undefined);
584
+ }
506
585
  // ../../src/bootstrap/config.ts
507
586
  var APP_PORT_CONFIG_KEY = "app.port";
508
587
  var CACHE_TTL_MS_CONFIG_KEY = "cache.ttlMs";
@@ -510,19 +589,12 @@ var CACHE_MAX_ENTRIES_CONFIG_KEY = "cache.maxEntries";
510
589
  var CACHE_DRIVER_CONFIG_KEY = "cache.driver";
511
590
  var REDIS_URL_CONFIG_KEY = "cache.redisUrl";
512
591
  var DATABASE_URL_CONFIG_KEY = "database.url";
513
- var CORE_CONFIG_TOKEN = "core.config";
514
- var CORE_CACHE_TOKEN = "core.cache";
515
- var CORE_QUEUE_TOKEN = "core.queue";
516
- var CORE_POLICY_GATE_TOKEN = "core.policyGate";
517
- var CORE_AUTH_TOKEN = "core.auth";
518
- var CORE_TOKEN_SERVICE_TOKEN = "core.tokenService";
519
592
  var DEFAULT_APP_PORT = 3000;
520
593
  var DEFAULT_CACHE_TTL_MS = 3600000;
521
594
  var DEFAULT_CACHE_MAX_ENTRIES = 100;
522
595
  var DEFAULT_CACHE_DRIVER = "array";
523
596
  var DEFAULT_API_TOKEN = "";
524
597
  var DEFAULT_QUEUE_DRIVER = "sync";
525
-
526
598
  // ../../src/bootstrap/contracts.ts
527
599
  class ServiceContainer {
528
600
  services = new Map;
@@ -592,7 +664,7 @@ var requiredDependencyKeys = [
592
664
  "cache",
593
665
  "storage"
594
666
  ];
595
- function getRequiredDependency(dependencies, key) {
667
+ function getRequiredDependency2(dependencies, key) {
596
668
  const dependency = dependencies[key];
597
669
  if (dependency === undefined) {
598
670
  throw new Error(`Required dependency "${key}" is not registered.`);
@@ -601,75 +673,12 @@ function getRequiredDependency(dependencies, key) {
601
673
  }
602
674
  function assertAppDependenciesComplete(dependencies) {
603
675
  for (const key of requiredDependencyKeys) {
604
- getRequiredDependency(dependencies, key);
676
+ getRequiredDependency2(dependencies, key);
605
677
  }
606
678
  }
607
679
  function resolveService(dependencies, token) {
608
680
  return dependencies.container.resolve(token);
609
681
  }
610
-
611
- // ../../src/bootstrap/applicationRegistry.ts
612
- var APPLICATION_CONTEXT_KEY = Symbol.for("@getstrata/applicationContext");
613
- var activeContext;
614
- function readStoredApplicationContext() {
615
- if (activeContext) {
616
- return activeContext;
617
- }
618
- const globalContext = globalThis[APPLICATION_CONTEXT_KEY];
619
- if (globalContext) {
620
- activeContext = globalContext;
621
- }
622
- return activeContext;
623
- }
624
- function setActiveApplicationContext(context) {
625
- activeContext = context;
626
- globalThis[APPLICATION_CONTEXT_KEY] = context;
627
- }
628
- function requireActiveApplicationContext() {
629
- const context = readStoredApplicationContext();
630
- if (!context) {
631
- throw new Error("The application context has not been bootstrapped.");
632
- }
633
- return context;
634
- }
635
- function resolveApplicationCache() {
636
- return getRequiredDependency(requireActiveApplicationContext().dependencies, "cache");
637
- }
638
- function resolveApplicationQueue() {
639
- return requireActiveApplicationContext().container.resolve(CORE_QUEUE_TOKEN);
640
- }
641
- function resolveApplicationAuth() {
642
- return requireActiveApplicationContext().container.resolve(CORE_AUTH_TOKEN);
643
- }
644
- function resolveApplicationPolicyGate() {
645
- return requireActiveApplicationContext().container.resolve(CORE_POLICY_GATE_TOKEN);
646
- }
647
- function resolveApplicationConfig() {
648
- return requireActiveApplicationContext().config;
649
- }
650
- function resolveApplicationLogger() {
651
- return appLogger;
652
- }
653
- function resolveApplicationDependencies() {
654
- return requireActiveApplicationContext().dependencies;
655
- }
656
- // ../../src/bootstrap/discoverModules.ts
657
- var appModules = [];
658
- function discoverModules() {
659
- return appModules;
660
- }
661
-
662
- // ../../src/bootstrap/cache/modelCacheTags.ts
663
- function cacheTagsForModelWrite(tableName, action) {
664
- const module = discoverModules().find((entry) => entry.tableName === tableName);
665
- const baseTags = module?.cacheTags ?? [`${tableName}s`];
666
- const isDelete = action === "deleted" || action === "force-deleted";
667
- const extraTags = isDelete ? module?.cacheDeleteExtraTags ?? [] : [];
668
- return [...new Set([...baseTags, ...extraTags])];
669
- }
670
- function discoverModelTableNames() {
671
- return discoverModules().map((module) => module.tableName).filter((tableName) => tableName !== undefined);
672
- }
673
682
  // ../../src/config/auth.ts
674
683
  var authConfig = {
675
684
  allowDevHeaders: (process.env.AUTH_DEV_HEADERS ?? "true") !== "false",
@@ -5273,7 +5282,7 @@ export {
5273
5282
  prefixRouteMap,
5274
5283
  parseFormBody,
5275
5284
  mergeWebRoutes,
5276
- getRequiredDependency,
5285
+ getRequiredDependency2 as getRequiredDependency,
5277
5286
  discoverModelTableNames,
5278
5287
  createWebServer,
5279
5288
  createWebRoutes,