@getstrata/bootstrap 0.2.49 → 0.2.50
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/CHANGELOG.md +8 -0
- package/README.md +3 -1
- package/dist/bootstrap/config.d.ts +1 -1
- package/dist/bootstrap/health.d.ts +8 -2
- package/dist/bootstrap/public-api.d.ts +4 -2
- package/dist/bootstrap/web/index.d.ts +1 -1
- package/dist/bootstrap/web/session.d.ts +25 -3
- package/dist/entries/buildModuleRoutes.js +19 -4
- package/dist/entries/buildWebModuleRoutes.js +19 -4
- package/dist/entries/config.js +4 -0
- package/dist/entries/context.js +2 -0
- package/dist/entries/createRoutes.js +203 -155
- package/dist/entries/createSpaRoutes.js +1 -1
- package/dist/entries/createWebRoutes.js +19 -4
- package/dist/entries/dependencies.js +2 -0
- package/dist/entries/health.js +69 -152
- package/dist/entries/httpKernel.js +19 -4
- package/dist/entries/providers.js +2 -0
- package/dist/entries/secretsGuard.js +64 -10
- package/dist/entries/web/routing.js +19 -4
- package/dist/entries/web/session.js +59 -7
- package/dist/index.js +240 -20
- package/package.json +5 -4
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# @getstrata/bootstrap changelog
|
|
2
|
+
|
|
3
|
+
## 0.2.50
|
|
4
|
+
|
|
5
|
+
- `createCookieSessionAuthManager` / `CookieSessionGuard` turn `CookieSessionStore` into an `AuthGuard` / `AuthManager` for `CORE_AUTH_TOKEN`. Supply a `mapUser` mapper; WorkHub abilities are not baked in. Omit `sql` to read the client from `bindDatabaseConnection()` on every call.
|
|
6
|
+
- `checkDatabase()` / `createHealthRoutes()` ping the bound database client, not WorkHub’s private connection holder. `/health` stays `{ status: "ok" }` unless `{ pingOnHealth: true }`. Extra JSON fields are optional.
|
|
7
|
+
- `assertProductionSecrets()` is feature-gated. A production HTMX app with `SESSION_SECRET` (32+), `AUTH_DEV_HEADERS=false`, and feature flags off does not need WorkHub API tokens. WorkHub’s current production env (rotated tokens, CORS, pepper, expiry) still passes.
|
|
8
|
+
- Re-exports `CORE_ABILITY_CHECKER_TOKEN` and `CORE_AUTH_USER_DIRECTORY_TOKEN`.
|
package/README.md
CHANGED
|
@@ -28,7 +28,9 @@ import {
|
|
|
28
28
|
import { createHttpKernel, createAppContext, coreProviders } from "@getstrata/bootstrap";
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
`createAppContext()` does not call `assertProductionSecrets`. WorkHub calls that from `App.serve()` / `queue:work`. Sibling apps
|
|
31
|
+
`createAppContext()` does not call `assertProductionSecrets`. WorkHub calls that from `App.serve()` / `queue:work`. Sibling HTMX apps can call it in production without WorkHub API tokens when feature flags are off — see [SIBLING-HTMX.md](../../docs/SIBLING-HTMX.md).
|
|
32
|
+
|
|
33
|
+
Sibling HTMX apps should bind `createCookieSessionAuthManager` from `@getstrata/bootstrap/web/session` instead of HMAC `SessionGuard`. `CookieSessionStore` reads optional `is_admin` from the user row for `wrapWebGlobalAdmin`. Pass `mapUser` to map `is_admin` / `learn_subscriber` onto `AuthUser.role`.
|
|
32
34
|
|
|
33
35
|
`wrapWeb` applies the web group (CSRF + flash) and `withErrorHandling`, so CSRF `ForbiddenError` becomes an HTML 403 in `FRONTEND_MODE=server-htmx`. `wrapWebLogin` / `wrapWebRegister` include that web group plus throttle — do not wrap them with `wrapWeb` again.
|
|
34
36
|
|
|
@@ -4,7 +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
|
-
export { CORE_AUTH_TOKEN, CORE_CACHE_TOKEN, CORE_CONFIG_TOKEN, CORE_EVENT_BUS_TOKEN, CORE_POLICY_GATE_TOKEN, CORE_QUEUE_TOKEN, CORE_TOKEN_SERVICE_TOKEN, } from "@getstrata/core/contracts/serviceTokens";
|
|
7
|
+
export { CORE_ABILITY_CHECKER_TOKEN, CORE_AUTH_TOKEN, CORE_AUTH_USER_DIRECTORY_TOKEN, CORE_CACHE_TOKEN, CORE_CONFIG_TOKEN, CORE_EVENT_BUS_TOKEN, CORE_POLICY_GATE_TOKEN, CORE_QUEUE_TOKEN, CORE_TOKEN_SERVICE_TOKEN, } from "@getstrata/core/contracts/serviceTokens";
|
|
8
8
|
declare const AUTH_DEV_HEADERS_CONFIG_KEY = "auth.allowDevHeaders";
|
|
9
9
|
declare const DEFAULT_APP_PORT = 3000;
|
|
10
10
|
declare const DEFAULT_CACHE_TTL_MS = 3600000;
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import type { AppDependencies } from "./contracts";
|
|
2
|
+
interface CreateHealthRoutesOptions {
|
|
3
|
+
pingOnHealth?: boolean;
|
|
4
|
+
extra?: Record<string, unknown> | (() => Record<string, unknown> | Promise<Record<string, unknown>>);
|
|
5
|
+
}
|
|
2
6
|
declare function checkDatabase(): Promise<boolean>;
|
|
7
|
+
declare function pingDatabase(): Promise<boolean>;
|
|
3
8
|
declare function checkRedis(redisUrl: string): Promise<boolean>;
|
|
4
|
-
declare function createHealthRoutes(dependencies: AppDependencies): {
|
|
9
|
+
declare function createHealthRoutes(dependencies: AppDependencies, options?: CreateHealthRoutesOptions): {
|
|
5
10
|
"/health": () => Promise<Response>;
|
|
6
11
|
"/ready": () => Promise<Response>;
|
|
7
12
|
};
|
|
8
|
-
export {
|
|
13
|
+
export type { CreateHealthRoutesOptions };
|
|
14
|
+
export { checkDatabase, checkRedis, createHealthRoutes, pingDatabase };
|
|
@@ -9,7 +9,7 @@ export { buildModuleRoutes } from "./buildModuleRoutes.ts";
|
|
|
9
9
|
export type { BuildWebModuleRoutesOptions } from "./buildWebModuleRoutes.ts";
|
|
10
10
|
export { buildWebModuleRoutes } from "./buildWebModuleRoutes.ts";
|
|
11
11
|
export { cacheTagsForModelWrite, discoverModelTableNames } from "./cache/modelCacheTags.ts";
|
|
12
|
-
export { APP_PORT_CONFIG_KEY, CORE_AUTH_TOKEN, CORE_CACHE_TOKEN, CORE_CONFIG_TOKEN, CORE_EVENT_BUS_TOKEN, CORE_POLICY_GATE_TOKEN, CORE_QUEUE_TOKEN, CORE_TOKEN_SERVICE_TOKEN, DATABASE_URL_CONFIG_KEY, DEFAULT_APP_PORT, REDIS_URL_CONFIG_KEY, } from "./config.ts";
|
|
12
|
+
export { APP_PORT_CONFIG_KEY, CORE_ABILITY_CHECKER_TOKEN, CORE_AUTH_TOKEN, CORE_AUTH_USER_DIRECTORY_TOKEN, CORE_CACHE_TOKEN, CORE_CONFIG_TOKEN, CORE_EVENT_BUS_TOKEN, CORE_POLICY_GATE_TOKEN, CORE_QUEUE_TOKEN, CORE_TOKEN_SERVICE_TOKEN, DATABASE_URL_CONFIG_KEY, DEFAULT_APP_PORT, REDIS_URL_CONFIG_KEY, } from "./config.ts";
|
|
13
13
|
export { collectProviders, createAppContext, runProviderPhase } from "./context.ts";
|
|
14
14
|
export type { AppContext, AppDependencies, AppModule, AppRouteMap, CachedJson, ConfigStore, ModuleRouteContext, MutableAppDependencies, ProviderContext, ServiceFactory, ServiceProvider, } from "./contracts.ts";
|
|
15
15
|
export { assertAppDependenciesComplete, getRequiredDependency, resolveService, ServiceContainer, } from "./contracts.ts";
|
|
@@ -17,6 +17,8 @@ export { createWebRoutes, mergeWebRoutes } from "./createWebRoutes.ts";
|
|
|
17
17
|
export { createAppDependencies } from "./dependencies.ts";
|
|
18
18
|
export type { DiscoverModulesOptions } from "./discoverModules.ts";
|
|
19
19
|
export { configureModulesDirectory, discoverModules, ensureModulesLoaded, } from "./discoverModules.ts";
|
|
20
|
+
export type { CreateHealthRoutesOptions } from "./health.ts";
|
|
21
|
+
export { checkDatabase, checkRedis, createHealthRoutes, pingDatabase } from "./health.ts";
|
|
20
22
|
export { type RouteModelAuthorization, securedBindRouteModel, securedBindRouteModelByKey, } from "./http/securedRouteModelBinding.ts";
|
|
21
23
|
export { createHttpKernel, type HttpKernel, type MiddlewareGroupName } from "./httpKernel.ts";
|
|
22
24
|
export { resolveMembershipService } from "./membershipService.ts";
|
|
@@ -25,4 +27,4 @@ export { coreProviders } from "./providers/index.ts";
|
|
|
25
27
|
export { registerDefaultJobs } from "./queue/defaultJobs.ts";
|
|
26
28
|
export { RouteRegistry, routeRegistry } from "./routeRegistry.ts";
|
|
27
29
|
export { assertProductionSecrets } from "./secretsGuard.ts";
|
|
28
|
-
export { CookieSessionStore, createCsrfProtection, createRouteKernel, createWebServer, type ParsedForm, parseFormBody, routeParams, type SessionUser, slugify, toRouteRequest, type WebServerOptions, wrapSecuredRouteModelByKey, wrapWebLogin, wrapWebRegister, } from "./web/index.ts";
|
|
30
|
+
export { CookieSessionGuard, CookieSessionStore, createCookieSessionAuthManager, createCsrfProtection, createRouteKernel, createWebServer, type MapSessionUser, type ParsedForm, parseFormBody, routeParams, type SessionUser, slugify, toRouteRequest, type WebServerOptions, wrapSecuredRouteModelByKey, wrapWebLogin, wrapWebRegister, } from "./web/index.ts";
|
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
export { createCsrfProtection, type ParsedForm, parseFormBody } from "./forms.ts";
|
|
5
5
|
export { createRouteKernel, routeParams, toRouteRequest, wrapSecuredRouteModelByKey, wrapWebLogin, wrapWebRegister, } from "./routing.ts";
|
|
6
6
|
export { convertAppRoutesToBunRoutes, createWebServer, type WebServerOptions } from "./server.ts";
|
|
7
|
-
export { CookieSessionStore, type SessionUser } from "./session.ts";
|
|
7
|
+
export { CookieSessionGuard, CookieSessionStore, createCookieSessionAuthManager, type MapSessionUser, type SessionUser, } from "./session.ts";
|
|
8
8
|
export { slugify } from "./slug.ts";
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { AuthUser } from "@getstrata/core/auth/authContext";
|
|
2
|
+
import { type AuthGuard, AuthManager } from "@getstrata/core/auth/guard";
|
|
1
3
|
export interface SessionUser {
|
|
2
4
|
id: number;
|
|
3
5
|
name: string;
|
|
@@ -8,18 +10,38 @@ export interface SessionUser {
|
|
|
8
10
|
type SqlClient = {
|
|
9
11
|
unsafe<T>(query: string, params?: readonly unknown[]): Promise<T[]>;
|
|
10
12
|
};
|
|
13
|
+
type SqlSource = SqlClient | (() => SqlClient);
|
|
14
|
+
declare function defaultSessionSql(): SqlClient;
|
|
15
|
+
export type MapSessionUser = (user: SessionUser) => AuthUser;
|
|
16
|
+
declare function defaultMapSessionUser(user: SessionUser): AuthUser;
|
|
11
17
|
export declare class CookieSessionStore {
|
|
12
|
-
private readonly
|
|
18
|
+
private readonly sqlSource;
|
|
13
19
|
private readonly secret;
|
|
14
20
|
private readonly cookieName;
|
|
15
21
|
private readonly maxAgeSeconds;
|
|
16
|
-
constructor(
|
|
22
|
+
constructor(sqlSource: SqlSource, secret: string, cookieName?: string, maxAgeSeconds?: number);
|
|
17
23
|
cookieHeader(_user: SessionUser, sessionId: string): string;
|
|
18
24
|
clearCookieHeader(): string;
|
|
19
25
|
private withSecureFlag;
|
|
26
|
+
private sql;
|
|
20
27
|
create(user: SessionUser): Promise<string>;
|
|
21
28
|
destroy(sessionId: string): Promise<void>;
|
|
22
29
|
read(request: Request): Promise<SessionUser | null>;
|
|
23
30
|
private sign;
|
|
24
31
|
}
|
|
25
|
-
export {
|
|
32
|
+
export declare class CookieSessionGuard implements AuthGuard {
|
|
33
|
+
private readonly store;
|
|
34
|
+
private readonly mapUser;
|
|
35
|
+
constructor(store: CookieSessionStore, mapUser?: MapSessionUser);
|
|
36
|
+
resolve(request: Request): Promise<AuthUser | null>;
|
|
37
|
+
}
|
|
38
|
+
export interface CreateCookieSessionAuthManagerOptions {
|
|
39
|
+
store?: CookieSessionStore;
|
|
40
|
+
sql?: SqlSource;
|
|
41
|
+
secret?: string;
|
|
42
|
+
cookieName?: string;
|
|
43
|
+
maxAgeSeconds?: number;
|
|
44
|
+
mapUser?: MapSessionUser;
|
|
45
|
+
}
|
|
46
|
+
declare function createCookieSessionAuthManager(options?: CreateCookieSessionAuthManagerOptions): AuthManager;
|
|
47
|
+
export { createCookieSessionAuthManager, defaultMapSessionUser, defaultSessionSql };
|
|
@@ -7,6 +7,7 @@ import { applyMiddlewareToRoutes } from "@getstrata/core/http/middleware";
|
|
|
7
7
|
|
|
8
8
|
// ../../src/bootstrap/httpKernel.ts
|
|
9
9
|
import { createMembershipMiddleware } from "@getstrata/core/auth/membershipMiddleware";
|
|
10
|
+
import { resolveAbilityChecker } from "@getstrata/core/contracts/serviceTokens";
|
|
10
11
|
import { createAuthMiddleware } from "@getstrata/core/http/authMiddleware";
|
|
11
12
|
import { createAuthorizeMiddleware } from "@getstrata/core/http/authorizeMiddleware";
|
|
12
13
|
import { createBodySizeLimitMiddleware } from "@getstrata/core/http/bodySizeLimitMiddleware";
|
|
@@ -67,24 +68,38 @@ function parsePositiveInt(value, fallback) {
|
|
|
67
68
|
}
|
|
68
69
|
return Math.trunc(parsed);
|
|
69
70
|
}
|
|
71
|
+
function parseWindowSeconds(secondsValue, msValue, fallback) {
|
|
72
|
+
if (secondsValue !== undefined && secondsValue.trim() !== "") {
|
|
73
|
+
return parsePositiveInt(secondsValue, fallback);
|
|
74
|
+
}
|
|
75
|
+
if (msValue !== undefined && msValue.trim() !== "") {
|
|
76
|
+
const parsedMs = Number(msValue);
|
|
77
|
+
if (Number.isFinite(parsedMs) && parsedMs > 0) {
|
|
78
|
+
return Math.max(1, Math.trunc(parsedMs / 1000));
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return fallback;
|
|
82
|
+
}
|
|
70
83
|
function resolveLoginRateLimit() {
|
|
71
84
|
const defaults = isLocalAppEnv() ? LOCAL_LOGIN_RATE_LIMIT : PRODUCTION_LOGIN_RATE_LIMIT;
|
|
72
85
|
return {
|
|
73
86
|
maxAttempts: parsePositiveInt(process.env.LOGIN_RATE_LIMIT_PER_WINDOW, defaults.maxAttempts),
|
|
74
|
-
decaySeconds:
|
|
87
|
+
decaySeconds: parseWindowSeconds(process.env.LOGIN_RATE_LIMIT_WINDOW_SECONDS, process.env.LOGIN_RATE_LIMIT_WINDOW_MS, defaults.decaySeconds)
|
|
75
88
|
};
|
|
76
89
|
}
|
|
77
90
|
function resolveRegisterRateLimit() {
|
|
78
91
|
const defaults = isLocalAppEnv() ? { maxAttempts: 100, decaySeconds: 60 } : { maxAttempts: 10, decaySeconds: 60 };
|
|
79
92
|
return {
|
|
80
93
|
maxAttempts: parsePositiveInt(process.env.REGISTER_RATE_LIMIT_PER_WINDOW, defaults.maxAttempts),
|
|
81
|
-
decaySeconds:
|
|
94
|
+
decaySeconds: parseWindowSeconds(process.env.REGISTER_RATE_LIMIT_WINDOW_SECONDS, process.env.REGISTER_RATE_LIMIT_WINDOW_MS, defaults.decaySeconds)
|
|
82
95
|
};
|
|
83
96
|
}
|
|
84
97
|
|
|
85
98
|
// ../../src/bootstrap/config.ts
|
|
86
99
|
import {
|
|
100
|
+
CORE_ABILITY_CHECKER_TOKEN,
|
|
87
101
|
CORE_AUTH_TOKEN,
|
|
102
|
+
CORE_AUTH_USER_DIRECTORY_TOKEN,
|
|
88
103
|
CORE_CACHE_TOKEN,
|
|
89
104
|
CORE_CONFIG_TOKEN,
|
|
90
105
|
CORE_EVENT_BUS_TOKEN,
|
|
@@ -188,7 +203,7 @@ class HttpKernel {
|
|
|
188
203
|
}
|
|
189
204
|
wrapWebAbility(ability, handler) {
|
|
190
205
|
const auth = this.dependencies.container.resolve(CORE_AUTH_TOKEN);
|
|
191
|
-
const abilityChecker = this.dependencies.container
|
|
206
|
+
const abilityChecker = resolveAbilityChecker(this.dependencies.container);
|
|
192
207
|
const requireAbility = createRequireAbilityMiddleware(abilityChecker);
|
|
193
208
|
const middleware = [createRequireWebAuthMiddleware(auth), requireAbility(ability)];
|
|
194
209
|
return this.wrapWeb(withMiddleware(...middleware)(handler));
|
|
@@ -212,7 +227,7 @@ class HttpKernel {
|
|
|
212
227
|
return withMiddleware(...middleware)(handler);
|
|
213
228
|
}
|
|
214
229
|
wrapAbility(ability, handler) {
|
|
215
|
-
const abilityChecker = this.dependencies.container
|
|
230
|
+
const abilityChecker = resolveAbilityChecker(this.dependencies.container);
|
|
216
231
|
const requireAbility = createRequireAbilityMiddleware(abilityChecker);
|
|
217
232
|
const middleware = [...this.group("authenticated"), requireAbility(ability)];
|
|
218
233
|
return withMiddleware(...middleware)(handler);
|
|
@@ -10,6 +10,7 @@ import { applyMiddlewareToRoutes } from "@getstrata/core/http/middleware";
|
|
|
10
10
|
|
|
11
11
|
// ../../src/bootstrap/httpKernel.ts
|
|
12
12
|
import { createMembershipMiddleware } from "@getstrata/core/auth/membershipMiddleware";
|
|
13
|
+
import { resolveAbilityChecker } from "@getstrata/core/contracts/serviceTokens";
|
|
13
14
|
import { createAuthMiddleware } from "@getstrata/core/http/authMiddleware";
|
|
14
15
|
import { createAuthorizeMiddleware } from "@getstrata/core/http/authorizeMiddleware";
|
|
15
16
|
import { createBodySizeLimitMiddleware } from "@getstrata/core/http/bodySizeLimitMiddleware";
|
|
@@ -70,24 +71,38 @@ function parsePositiveInt(value, fallback) {
|
|
|
70
71
|
}
|
|
71
72
|
return Math.trunc(parsed);
|
|
72
73
|
}
|
|
74
|
+
function parseWindowSeconds(secondsValue, msValue, fallback) {
|
|
75
|
+
if (secondsValue !== undefined && secondsValue.trim() !== "") {
|
|
76
|
+
return parsePositiveInt(secondsValue, fallback);
|
|
77
|
+
}
|
|
78
|
+
if (msValue !== undefined && msValue.trim() !== "") {
|
|
79
|
+
const parsedMs = Number(msValue);
|
|
80
|
+
if (Number.isFinite(parsedMs) && parsedMs > 0) {
|
|
81
|
+
return Math.max(1, Math.trunc(parsedMs / 1000));
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return fallback;
|
|
85
|
+
}
|
|
73
86
|
function resolveLoginRateLimit() {
|
|
74
87
|
const defaults = isLocalAppEnv() ? LOCAL_LOGIN_RATE_LIMIT : PRODUCTION_LOGIN_RATE_LIMIT;
|
|
75
88
|
return {
|
|
76
89
|
maxAttempts: parsePositiveInt(process.env.LOGIN_RATE_LIMIT_PER_WINDOW, defaults.maxAttempts),
|
|
77
|
-
decaySeconds:
|
|
90
|
+
decaySeconds: parseWindowSeconds(process.env.LOGIN_RATE_LIMIT_WINDOW_SECONDS, process.env.LOGIN_RATE_LIMIT_WINDOW_MS, defaults.decaySeconds)
|
|
78
91
|
};
|
|
79
92
|
}
|
|
80
93
|
function resolveRegisterRateLimit() {
|
|
81
94
|
const defaults = isLocalAppEnv() ? { maxAttempts: 100, decaySeconds: 60 } : { maxAttempts: 10, decaySeconds: 60 };
|
|
82
95
|
return {
|
|
83
96
|
maxAttempts: parsePositiveInt(process.env.REGISTER_RATE_LIMIT_PER_WINDOW, defaults.maxAttempts),
|
|
84
|
-
decaySeconds:
|
|
97
|
+
decaySeconds: parseWindowSeconds(process.env.REGISTER_RATE_LIMIT_WINDOW_SECONDS, process.env.REGISTER_RATE_LIMIT_WINDOW_MS, defaults.decaySeconds)
|
|
85
98
|
};
|
|
86
99
|
}
|
|
87
100
|
|
|
88
101
|
// ../../src/bootstrap/config.ts
|
|
89
102
|
import {
|
|
103
|
+
CORE_ABILITY_CHECKER_TOKEN,
|
|
90
104
|
CORE_AUTH_TOKEN,
|
|
105
|
+
CORE_AUTH_USER_DIRECTORY_TOKEN,
|
|
91
106
|
CORE_CACHE_TOKEN,
|
|
92
107
|
CORE_CONFIG_TOKEN,
|
|
93
108
|
CORE_EVENT_BUS_TOKEN,
|
|
@@ -191,7 +206,7 @@ class HttpKernel {
|
|
|
191
206
|
}
|
|
192
207
|
wrapWebAbility(ability, handler) {
|
|
193
208
|
const auth = this.dependencies.container.resolve(CORE_AUTH_TOKEN);
|
|
194
|
-
const abilityChecker = this.dependencies.container
|
|
209
|
+
const abilityChecker = resolveAbilityChecker(this.dependencies.container);
|
|
195
210
|
const requireAbility = createRequireAbilityMiddleware(abilityChecker);
|
|
196
211
|
const middleware = [createRequireWebAuthMiddleware(auth), requireAbility(ability)];
|
|
197
212
|
return this.wrapWeb(withMiddleware(...middleware)(handler));
|
|
@@ -215,7 +230,7 @@ class HttpKernel {
|
|
|
215
230
|
return withMiddleware(...middleware)(handler);
|
|
216
231
|
}
|
|
217
232
|
wrapAbility(ability, handler) {
|
|
218
|
-
const abilityChecker = this.dependencies.container
|
|
233
|
+
const abilityChecker = resolveAbilityChecker(this.dependencies.container);
|
|
219
234
|
const requireAbility = createRequireAbilityMiddleware(abilityChecker);
|
|
220
235
|
const middleware = [...this.group("authenticated"), requireAbility(ability)];
|
|
221
236
|
return withMiddleware(...middleware)(handler);
|
package/dist/entries/config.js
CHANGED
|
@@ -3,7 +3,9 @@ var __jsonParse = (a) => JSON.parse(a);
|
|
|
3
3
|
|
|
4
4
|
// ../../src/bootstrap/config.ts
|
|
5
5
|
import {
|
|
6
|
+
CORE_ABILITY_CHECKER_TOKEN,
|
|
6
7
|
CORE_AUTH_TOKEN,
|
|
8
|
+
CORE_AUTH_USER_DIRECTORY_TOKEN,
|
|
7
9
|
CORE_CACHE_TOKEN,
|
|
8
10
|
CORE_CONFIG_TOKEN,
|
|
9
11
|
CORE_EVENT_BUS_TOKEN,
|
|
@@ -30,7 +32,9 @@ export {
|
|
|
30
32
|
CACHE_DRIVER_CONFIG_KEY,
|
|
31
33
|
CACHE_MAX_ENTRIES_CONFIG_KEY,
|
|
32
34
|
CACHE_TTL_MS_CONFIG_KEY,
|
|
35
|
+
CORE_ABILITY_CHECKER_TOKEN,
|
|
33
36
|
CORE_AUTH_TOKEN,
|
|
37
|
+
CORE_AUTH_USER_DIRECTORY_TOKEN,
|
|
34
38
|
CORE_CACHE_TOKEN,
|
|
35
39
|
CORE_CONFIG_TOKEN,
|
|
36
40
|
CORE_EVENT_BUS_TOKEN,
|
package/dist/entries/context.js
CHANGED