@getstrata/core 0.5.18 → 0.5.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 -16
- package/dist/bootstrap/cache/modelCacheTags.d.ts +3 -0
- package/dist/bootstrap/config.d.ts +2 -7
- package/dist/bootstrap/discoverModules.d.ts +3 -2
- package/dist/core/auth/guard.d.ts +2 -2
- package/dist/core/auth/sessionGuard.d.ts +2 -2
- package/dist/core/cache/modelCacheTags.d.ts +1 -3
- package/dist/core/contracts/applicationContext.d.ts +18 -0
- package/dist/core/contracts/serviceContainer.d.ts +5 -0
- package/dist/core/contracts/serviceTokens.d.ts +7 -0
- package/dist/core/openapi/generator.d.ts +1 -1
- package/dist/core/openapi/registeredRoute.d.ts +6 -0
- package/dist/core/runtime/applicationRegistry.d.ts +15 -0
- package/dist/core/view/webLayoutData.d.ts +2 -2
- package/dist/entries/http/webErrorResponse.js +2 -2
- package/dist/entries/queue/createAppQueue.js +234 -2655
- package/dist/entries/queue/jobRunner.js +2 -1
- package/dist/entries/queue/publicQueue.js +2 -1
- package/dist/entries/queue/queueMetrics.js +236 -2606
- package/dist/entries/runtime/applicationRegistry.js +1 -0
- package/dist/entries/view.js +2 -2
- package/dist/framework/public-api.d.ts +2 -1
- package/dist/index.js +117 -96
- package/package.json +6 -1
- package/dist/bootstrap/modules.d.ts +0 -1
- package/dist/bootstrap/routeRegistry.d.ts +0 -14
|
@@ -1,16 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import type { PolicyGate } from "../core/auth/policy";
|
|
3
|
-
import { type Logger } from "../core/logging/logger";
|
|
4
|
-
import type { Queue } from "../core/queue";
|
|
5
|
-
import type { CacheLike } from "../types/services";
|
|
6
|
-
import type { AppContext } from "./contracts";
|
|
7
|
-
import { type ConfigStore } from "./contracts";
|
|
8
|
-
declare function setActiveApplicationContext(context: AppContext): void;
|
|
9
|
-
declare function resolveApplicationCache(): CacheLike;
|
|
10
|
-
declare function resolveApplicationQueue(): Queue;
|
|
11
|
-
declare function resolveApplicationAuth(): AuthManager;
|
|
12
|
-
declare function resolveApplicationPolicyGate(): PolicyGate;
|
|
13
|
-
declare function resolveApplicationConfig(): ConfigStore;
|
|
14
|
-
declare function resolveApplicationLogger(): Logger;
|
|
15
|
-
declare function resolveApplicationDependencies(): import("./contracts").AppDependencies;
|
|
16
|
-
export { resolveApplicationAuth, resolveApplicationCache, resolveApplicationConfig, resolveApplicationDependencies, resolveApplicationLogger, resolveApplicationPolicyGate, resolveApplicationQueue, setActiveApplicationContext, };
|
|
1
|
+
export { resolveApplicationAuth, resolveApplicationCache, resolveApplicationConfig, resolveApplicationDependencies, resolveApplicationLogger, resolveApplicationPolicyGate, resolveApplicationQueue, setActiveApplicationContext, } from "../core/runtime/applicationRegistry.ts";
|
|
@@ -4,12 +4,7 @@ declare const CACHE_MAX_ENTRIES_CONFIG_KEY = "cache.maxEntries";
|
|
|
4
4
|
declare const CACHE_DRIVER_CONFIG_KEY = "cache.driver";
|
|
5
5
|
declare const REDIS_URL_CONFIG_KEY = "cache.redisUrl";
|
|
6
6
|
declare const DATABASE_URL_CONFIG_KEY = "database.url";
|
|
7
|
-
|
|
8
|
-
declare const CORE_CACHE_TOKEN = "core.cache";
|
|
9
|
-
declare const CORE_QUEUE_TOKEN = "core.queue";
|
|
10
|
-
declare const CORE_POLICY_GATE_TOKEN = "core.policyGate";
|
|
11
|
-
declare const CORE_AUTH_TOKEN = "core.auth";
|
|
12
|
-
declare const CORE_TOKEN_SERVICE_TOKEN = "core.tokenService";
|
|
7
|
+
export { CORE_AUTH_TOKEN, CORE_CACHE_TOKEN, CORE_CONFIG_TOKEN, CORE_POLICY_GATE_TOKEN, CORE_QUEUE_TOKEN, CORE_TOKEN_SERVICE_TOKEN, } from "../core/contracts/serviceTokens.ts";
|
|
13
8
|
declare const AUTH_DEV_HEADERS_CONFIG_KEY = "auth.allowDevHeaders";
|
|
14
9
|
declare const DEFAULT_APP_PORT = 3000;
|
|
15
10
|
declare const DEFAULT_CACHE_TTL_MS = 3600000;
|
|
@@ -17,4 +12,4 @@ declare const DEFAULT_CACHE_MAX_ENTRIES = 100;
|
|
|
17
12
|
declare const DEFAULT_CACHE_DRIVER = "array";
|
|
18
13
|
declare const DEFAULT_API_TOKEN = "";
|
|
19
14
|
declare const DEFAULT_QUEUE_DRIVER = "sync";
|
|
20
|
-
export { APP_PORT_CONFIG_KEY, AUTH_DEV_HEADERS_CONFIG_KEY, CACHE_DRIVER_CONFIG_KEY, CACHE_MAX_ENTRIES_CONFIG_KEY, CACHE_TTL_MS_CONFIG_KEY,
|
|
15
|
+
export { APP_PORT_CONFIG_KEY, AUTH_DEV_HEADERS_CONFIG_KEY, CACHE_DRIVER_CONFIG_KEY, CACHE_MAX_ENTRIES_CONFIG_KEY, CACHE_TTL_MS_CONFIG_KEY, DATABASE_URL_CONFIG_KEY, DEFAULT_API_TOKEN, DEFAULT_APP_PORT, DEFAULT_CACHE_DRIVER, DEFAULT_CACHE_MAX_ENTRIES, DEFAULT_CACHE_TTL_MS, DEFAULT_QUEUE_DRIVER, REDIS_URL_CONFIG_KEY, };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { AppModule } from "./contracts";
|
|
2
|
-
declare
|
|
2
|
+
declare let appModules: AppModule[];
|
|
3
|
+
declare function ensureModulesLoaded(): Promise<AppModule[]>;
|
|
3
4
|
declare function discoverModules(): AppModule[];
|
|
4
|
-
export { appModules, discoverModules };
|
|
5
|
+
export { appModules, discoverModules, ensureModulesLoaded };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ServiceContainerLike } from "../contracts/serviceContainer";
|
|
2
2
|
import type { AuthUser } from "./authContext";
|
|
3
3
|
interface AuthGuard {
|
|
4
4
|
resolve(request: Request): AuthUser | null | Promise<AuthUser | null>;
|
|
@@ -16,7 +16,7 @@ declare class ApiTokenGuard implements AuthGuard {
|
|
|
16
16
|
}
|
|
17
17
|
declare class DatabaseTokenGuard implements AuthGuard {
|
|
18
18
|
private readonly container;
|
|
19
|
-
constructor(container:
|
|
19
|
+
constructor(container: ServiceContainerLike);
|
|
20
20
|
resolve(request: Request): Promise<AuthUser | null>;
|
|
21
21
|
}
|
|
22
22
|
declare class CompositeGuard implements AuthGuard {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ServiceContainerLike } from "../contracts/serviceContainer";
|
|
2
2
|
import type { AuthUser } from "./authContext";
|
|
3
3
|
import type { AuthGuard } from "./guard";
|
|
4
4
|
declare class SessionGuard implements AuthGuard {
|
|
5
5
|
private readonly container;
|
|
6
|
-
constructor(container:
|
|
6
|
+
constructor(container: ServiceContainerLike);
|
|
7
7
|
resolve(request: Request): Promise<AuthUser | null>;
|
|
8
8
|
}
|
|
9
9
|
export { SessionGuard };
|
|
@@ -1,3 +1 @@
|
|
|
1
|
-
|
|
2
|
-
declare function discoverModelTableNames(): string[];
|
|
3
|
-
export { cacheTagsForModelWrite, discoverModelTableNames };
|
|
1
|
+
export { cacheTagsForModelWrite, discoverModelTableNames, } from "../../bootstrap/cache/modelCacheTags.ts";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { CacheLike } from "../../types/services";
|
|
2
|
+
import type { ServiceContainerLike } from "./serviceContainer";
|
|
3
|
+
interface ConfigStoreLike {
|
|
4
|
+
get<T>(key: string): T | undefined;
|
|
5
|
+
}
|
|
6
|
+
interface ApplicationDependenciesLike {
|
|
7
|
+
container: ServiceContainerLike;
|
|
8
|
+
cache: CacheLike;
|
|
9
|
+
storage?: unknown;
|
|
10
|
+
}
|
|
11
|
+
interface ApplicationContext {
|
|
12
|
+
container: ServiceContainerLike;
|
|
13
|
+
config: ConfigStoreLike;
|
|
14
|
+
dependencies: ApplicationDependenciesLike;
|
|
15
|
+
}
|
|
16
|
+
declare function getRequiredDependency<K extends keyof ApplicationDependenciesLike>(dependencies: Partial<ApplicationDependenciesLike>, key: K): ApplicationDependenciesLike[K];
|
|
17
|
+
export type { ApplicationContext, ApplicationDependenciesLike, ConfigStoreLike };
|
|
18
|
+
export { getRequiredDependency };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
declare const CORE_CONFIG_TOKEN = "core.config";
|
|
2
|
+
declare const CORE_CACHE_TOKEN = "core.cache";
|
|
3
|
+
declare const CORE_QUEUE_TOKEN = "core.queue";
|
|
4
|
+
declare const CORE_POLICY_GATE_TOKEN = "core.policyGate";
|
|
5
|
+
declare const CORE_AUTH_TOKEN = "core.auth";
|
|
6
|
+
declare const CORE_TOKEN_SERVICE_TOKEN = "core.tokenService";
|
|
7
|
+
export { CORE_AUTH_TOKEN, CORE_CACHE_TOKEN, CORE_CONFIG_TOKEN, CORE_POLICY_GATE_TOKEN, CORE_QUEUE_TOKEN, CORE_TOKEN_SERVICE_TOKEN, };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { CacheLike } from "../../types/services";
|
|
2
|
+
import type { AuthManager } from "../auth/guard";
|
|
3
|
+
import type { PolicyGate } from "../auth/policy";
|
|
4
|
+
import type { ApplicationContext } from "../contracts/applicationContext";
|
|
5
|
+
import { type Logger } from "../logging/logger";
|
|
6
|
+
import type { Queue } from "../queue";
|
|
7
|
+
declare function setActiveApplicationContext(context: ApplicationContext): void;
|
|
8
|
+
declare function resolveApplicationCache(): CacheLike;
|
|
9
|
+
declare function resolveApplicationQueue(): Queue;
|
|
10
|
+
declare function resolveApplicationAuth(): AuthManager;
|
|
11
|
+
declare function resolveApplicationPolicyGate(): PolicyGate;
|
|
12
|
+
declare function resolveApplicationConfig(): import("../contracts/applicationContext").ConfigStoreLike;
|
|
13
|
+
declare function resolveApplicationLogger(): Logger;
|
|
14
|
+
declare function resolveApplicationDependencies(): import("../contracts/applicationContext").ApplicationDependenciesLike;
|
|
15
|
+
export { resolveApplicationAuth, resolveApplicationCache, resolveApplicationConfig, resolveApplicationDependencies, resolveApplicationLogger, resolveApplicationPolicyGate, resolveApplicationQueue, setActiveApplicationContext, };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ServiceContainerLike } from "../contracts/serviceContainer";
|
|
2
2
|
interface WebLayoutAuthUser {
|
|
3
3
|
id: number;
|
|
4
4
|
email: string;
|
|
@@ -12,6 +12,6 @@ interface WebLayoutData {
|
|
|
12
12
|
message: string;
|
|
13
13
|
} | null;
|
|
14
14
|
}
|
|
15
|
-
declare function resolveWebLayoutData(container:
|
|
15
|
+
declare function resolveWebLayoutData(container: ServiceContainerLike, request?: Request): Promise<Record<string, unknown>>;
|
|
16
16
|
export type { WebLayoutAuthUser, WebLayoutData };
|
|
17
17
|
export { resolveWebLayoutData };
|
|
@@ -182,8 +182,9 @@ function htmlResponse(html, init = {}) {
|
|
|
182
182
|
function isHtmxRequest(request) {
|
|
183
183
|
return request.headers.get("HX-Request") === "true";
|
|
184
184
|
}
|
|
185
|
-
// ../../src/
|
|
185
|
+
// ../../src/core/contracts/serviceTokens.ts
|
|
186
186
|
var CORE_TOKEN_SERVICE_TOKEN = "core.tokenService";
|
|
187
|
+
// ../../src/bootstrap/config.ts
|
|
187
188
|
var DEFAULT_QUEUE_DRIVER = "sync";
|
|
188
189
|
|
|
189
190
|
// ../../src/core/auth/oauth/oidcProvider.ts
|
|
@@ -2123,7 +2124,6 @@ var db = new Proxy(function database() {}, {
|
|
|
2123
2124
|
return typeof value === "function" ? value.bind(connection) : value;
|
|
2124
2125
|
}
|
|
2125
2126
|
});
|
|
2126
|
-
var connection_default = db;
|
|
2127
2127
|
|
|
2128
2128
|
// ../../src/modules/user/apiTokenTable.ts
|
|
2129
2129
|
var apiTokenTable = defineTable({
|