@guren/server 1.0.0-rc.9 → 1.1.0
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/{Application-DtWDHXr1.d.ts → Application-BnsyCKXY.d.ts} +79 -8
- package/dist/AuthManager-SfhCNkAU.d.ts +79 -0
- package/dist/{BroadcastManager-AkIWUGJo.d.ts → BroadcastManager-CGWl9rUO.d.ts} +5 -0
- package/dist/{ConsoleKernel-CqCVrdZs.d.ts → ConsoleKernel-BDtBETjm.d.ts} +1 -1
- package/dist/{Gate-CNkBYf8m.d.ts → Gate-CynjZCtS.d.ts} +5 -0
- package/dist/{I18nManager-Dtgzsf5n.d.ts → I18nManager-BiSoczfV.d.ts} +6 -1
- package/dist/McpServiceProvider-JW6PDVMD.js +7 -0
- package/dist/api-token-BSSCLlFW.d.ts +541 -0
- package/dist/auth/index.d.ts +9 -327
- package/dist/auth/index.js +59 -6684
- package/dist/authorization/index.d.ts +2 -2
- package/dist/authorization/index.js +19 -604
- package/dist/broadcasting/index.d.ts +2 -2
- package/dist/broadcasting/index.js +12 -895
- package/dist/cache/index.js +8 -809
- package/dist/chunk-2T6JN4VR.js +1563 -0
- package/dist/chunk-44F7JQ7I.js +950 -0
- package/dist/chunk-74HTZG3V.js +331 -0
- package/dist/chunk-A3ISJVEV.js +598 -0
- package/dist/chunk-CSDKWLFD.js +652 -0
- package/dist/chunk-CSRQTEQA.js +839 -0
- package/dist/chunk-DAQKYKLH.js +182 -0
- package/dist/chunk-EDRGAM6G.js +647 -0
- package/dist/chunk-EGU5KB7V.js +818 -0
- package/dist/chunk-H32L2NE3.js +372 -0
- package/dist/chunk-HKQSAFSN.js +837 -0
- package/dist/chunk-IOTWFHZU.js +558 -0
- package/dist/chunk-ONSDE37A.js +125 -0
- package/dist/chunk-QH4NUKSV.js +255 -0
- package/dist/chunk-QQKTH5KX.js +114 -0
- package/dist/chunk-R2TCP7D7.js +409 -0
- package/dist/chunk-SIP34GBE.js +380 -0
- package/dist/chunk-THSX7OOR.js +454 -0
- package/dist/chunk-UY3AZSYL.js +14 -0
- package/dist/chunk-VT5KRDPH.js +134 -0
- package/dist/chunk-WJJ5CTNI.js +907 -0
- package/dist/chunk-WVY45EIW.js +359 -0
- package/dist/chunk-ZRBLZY3M.js +462 -0
- package/dist/client-CKXJLsTe.d.ts +232 -0
- package/dist/email-verification-CAeArjui.d.ts +327 -0
- package/dist/encryption/index.js +48 -556
- package/dist/errors-JOOPDDQ6.js +34 -0
- package/dist/events/index.js +14 -316
- package/dist/health/index.js +12 -367
- package/dist/i18n/index.d.ts +2 -2
- package/dist/i18n/index.js +14 -583
- package/dist/index.d.ts +37 -239
- package/dist/index.js +2931 -19222
- package/dist/lambda/index.d.ts +9 -7
- package/dist/lambda/index.js +4 -9
- package/dist/logging/index.js +12 -545
- package/dist/mail/index.d.ts +29 -1
- package/dist/mail/index.js +15 -684
- package/dist/mcp/index.d.ts +7 -5
- package/dist/mcp/index.js +5 -378
- package/dist/notifications/index.d.ts +8 -6
- package/dist/notifications/index.js +13 -730
- package/dist/queue/index.d.ts +37 -7
- package/dist/queue/index.js +22 -940
- package/dist/redis/index.d.ts +366 -0
- package/dist/redis/index.js +597 -0
- package/dist/runtime/index.d.ts +8 -6
- package/dist/runtime/index.js +26 -244
- package/dist/scheduling/index.js +14 -822
- package/dist/storage/index.d.ts +1 -0
- package/dist/storage/index.js +6 -824
- package/dist/vite/index.d.ts +2 -2
- package/dist/vite/index.js +5 -1
- package/package.json +15 -7
- package/dist/api-token-JOif2CtG.d.ts +0 -1792
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import * as hono from 'hono';
|
|
2
|
-
import { Context, MiddlewareHandler, Hono, ExecutionContext } from 'hono';
|
|
3
|
-
import {
|
|
2
|
+
import { Context, MiddlewareHandler, Hono, Next, ExecutionContext } from 'hono';
|
|
3
|
+
import { l as OAuthManager, g as AuthContext, j as ApiToken, C as CreateSessionMiddlewareOptions } from './api-token-BSSCLlFW.js';
|
|
4
|
+
import { A as AuthManager } from './AuthManager-SfhCNkAU.js';
|
|
4
5
|
import { InlineConfig, ViteDevServer } from 'vite';
|
|
5
6
|
import { E as EventManager } from './EventManager-CmIoLt7r.js';
|
|
6
7
|
import { C as CacheManager } from './CacheManager-BkvHEOZX.js';
|
|
7
8
|
import { M as MailManager } from './MailManager-DpMvYiP9.js';
|
|
8
9
|
import { L as LogManager } from './LogManager-7mxnkaPM.js';
|
|
9
|
-
import { I as I18nManager } from './I18nManager-
|
|
10
|
-
import { B as BroadcastManager } from './BroadcastManager-
|
|
10
|
+
import { I as I18nManager } from './I18nManager-BiSoczfV.js';
|
|
11
|
+
import { B as BroadcastManager } from './BroadcastManager-CGWl9rUO.js';
|
|
11
12
|
import { E as Encrypter, A as AppKeyring } from './app-key-CsBfRC_Q.js';
|
|
12
13
|
import { S as StorageManager } from './StorageManager-oZTHqaza.js';
|
|
13
14
|
import { H as HealthManager } from './HealthManager-DUyMIzsZ.js';
|
|
14
15
|
import { S as Scheduler } from './Scheduler-BstvSca7.js';
|
|
15
|
-
import { G as Gate } from './Gate-
|
|
16
|
+
import { G as Gate } from './Gate-CynjZCtS.js';
|
|
16
17
|
import { M as Middleware } from './index-9_Jzj5jo.js';
|
|
17
18
|
|
|
18
19
|
declare const CSRF_TOKEN_KEY = "_csrf_token";
|
|
@@ -129,6 +130,14 @@ type SharedPropsDefault = Record<string, unknown>;
|
|
|
129
130
|
type ResolvedSharedInertiaProps = InertiaSharedProps extends Record<string, unknown> ? InertiaSharedProps : SharedPropsDefault;
|
|
130
131
|
type SharedInertiaPropsResolver<Props extends Record<string, unknown> = ResolvedSharedInertiaProps> = (ctx: Context) => Promise<Props> | Props;
|
|
131
132
|
declare function setInertiaSharedProps<Props extends Record<string, unknown> = ResolvedSharedInertiaProps>(resolverFn: SharedInertiaPropsResolver<Props> | null): void;
|
|
133
|
+
declare function getInertiaSharedPropsResolver(): SharedInertiaPropsResolver<ResolvedSharedInertiaProps> | null;
|
|
134
|
+
/**
|
|
135
|
+
* Register additional shared props without replacing resolvers registered
|
|
136
|
+
* earlier — the new resolver's props are merged over the previous ones.
|
|
137
|
+
* Use this from app providers so multiple providers can each contribute
|
|
138
|
+
* shared props (setInertiaSharedProps replaces the resolver wholesale).
|
|
139
|
+
*/
|
|
140
|
+
declare function shareInertiaProps<Props extends Record<string, unknown>>(resolverFn: SharedInertiaPropsResolver<Props>): void;
|
|
132
141
|
|
|
133
142
|
/**
|
|
134
143
|
* Parses the incoming request payload supporting both JSON bodies and form submissions.
|
|
@@ -259,7 +268,11 @@ interface SecurityHeadersOptions {
|
|
|
259
268
|
referrerPolicy?: string | false;
|
|
260
269
|
/** X-Permitted-Cross-Domain-Policies header. Set to false to disable. Default: 'none' */
|
|
261
270
|
crossDomainPolicies?: string | false;
|
|
262
|
-
/**
|
|
271
|
+
/**
|
|
272
|
+
* Strict-Transport-Security header.
|
|
273
|
+
* Default: `{ maxAge: 31536000 }` (1 year) when NODE_ENV is 'production', false otherwise.
|
|
274
|
+
* Browsers ignore HSTS on plain-HTTP responses, so the production default is safe behind TLS terminators.
|
|
275
|
+
*/
|
|
263
276
|
hsts?: HstsOptions | false;
|
|
264
277
|
}
|
|
265
278
|
/**
|
|
@@ -1358,6 +1371,28 @@ declare class Controller {
|
|
|
1358
1371
|
}>(modelClass: T): Awaited<ReturnType<T['findOrFail']>>;
|
|
1359
1372
|
protected get ctx(): Context;
|
|
1360
1373
|
protected get request(): hono.HonoRequest<any, unknown>;
|
|
1374
|
+
/**
|
|
1375
|
+
* Get an uploaded file from a multipart request.
|
|
1376
|
+
*
|
|
1377
|
+
* Returns null when the field is missing, is not a file, or the upload is
|
|
1378
|
+
* empty. Hono caches the parsed body, so this composes with other body
|
|
1379
|
+
* reads in the same request.
|
|
1380
|
+
*
|
|
1381
|
+
* @example
|
|
1382
|
+
* ```typescript
|
|
1383
|
+
* const avatar = await this.file('avatar')
|
|
1384
|
+
* if (!avatar) {
|
|
1385
|
+
* throw ValidationException.withMessages({ avatar: 'Choose a file.' })
|
|
1386
|
+
* }
|
|
1387
|
+
* await storage.disk().put(`avatars/${avatar.name}`, Buffer.from(await avatar.arrayBuffer()))
|
|
1388
|
+
* ```
|
|
1389
|
+
*/
|
|
1390
|
+
protected file(name: string): Promise<File | null>;
|
|
1391
|
+
/**
|
|
1392
|
+
* Get all uploaded files for a multipart field (e.g. `<input multiple>`).
|
|
1393
|
+
* Returns an empty array when none were uploaded.
|
|
1394
|
+
*/
|
|
1395
|
+
protected files(name: string): Promise<File[]>;
|
|
1361
1396
|
protected get auth(): AuthContext;
|
|
1362
1397
|
protected make<K extends keyof ServiceBindings>(key: K): ServiceBindings[K];
|
|
1363
1398
|
protected make<T>(key: string): T;
|
|
@@ -1383,6 +1418,31 @@ declare class Controller {
|
|
|
1383
1418
|
* ```
|
|
1384
1419
|
*/
|
|
1385
1420
|
protected apiTokenUserId(): string | number;
|
|
1421
|
+
/**
|
|
1422
|
+
* Authorize the current user (or guest) for an ability.
|
|
1423
|
+
* Throws AuthorizationException (403) when denied.
|
|
1424
|
+
*
|
|
1425
|
+
* ORM records are plain objects with no constructor information, so pass
|
|
1426
|
+
* the model class alongside the record to resolve the policy:
|
|
1427
|
+
*
|
|
1428
|
+
* @example
|
|
1429
|
+
* ```typescript
|
|
1430
|
+
* const post = await Post.findOrFail(id)
|
|
1431
|
+
* await this.authorize('update', [Post, post])
|
|
1432
|
+
* await this.authorize('create', Post)
|
|
1433
|
+
* ```
|
|
1434
|
+
*/
|
|
1435
|
+
protected authorize(ability: string, ...args: unknown[]): Promise<void>;
|
|
1436
|
+
/**
|
|
1437
|
+
* Check whether the current user (or guest) can perform an ability.
|
|
1438
|
+
*
|
|
1439
|
+
* @example
|
|
1440
|
+
* ```typescript
|
|
1441
|
+
* if (await this.can('update', [Post, post])) { ... }
|
|
1442
|
+
* ```
|
|
1443
|
+
*/
|
|
1444
|
+
protected can(ability: string, ...args: unknown[]): Promise<boolean>;
|
|
1445
|
+
private gateUser;
|
|
1386
1446
|
protected inertia<TPage extends InertiaPageContractLike>(page: TPage, props: InertiaPageProps<TPage>, options?: InertiaResponseOptions): Promise<InertiaResponse<InertiaPageComponent<TPage>, InertiaPageProps<TPage> & ResolvedSharedInertiaProps>>;
|
|
1387
1447
|
protected inertia<Component extends string, Props extends DefaultInertiaProps>(component: Component, props: Props, options?: InertiaResponseOptions): Promise<InertiaResponse<Component, Props & ResolvedSharedInertiaProps>>;
|
|
1388
1448
|
protected json<T>(data: T, init?: ResponseInit): Response;
|
|
@@ -1710,8 +1770,10 @@ type ControllerAction<C extends ControllerConstructor = ControllerConstructor> =
|
|
|
1710
1770
|
type RouteResult = Response | string | number | boolean | Record<string, unknown> | Array<unknown> | null | void;
|
|
1711
1771
|
/**
|
|
1712
1772
|
* Handler for a route - either an inline function or a controller action tuple.
|
|
1773
|
+
* Inline handlers receive `next`, so any Hono middleware (e.g.
|
|
1774
|
+
* `broadcast.sseMiddleware()`) can be mounted directly as a terminal handler.
|
|
1713
1775
|
*/
|
|
1714
|
-
type RouteHandler<C extends ControllerConstructor = ControllerConstructor> = ((c: Context) => RouteResult | Promise<RouteResult>) | ControllerAction<C>;
|
|
1776
|
+
type RouteHandler<C extends ControllerConstructor = ControllerConstructor> = ((c: Context, next: Next) => RouteResult | Promise<RouteResult>) | ControllerAction<C>;
|
|
1715
1777
|
/**
|
|
1716
1778
|
* Model binding resolver function.
|
|
1717
1779
|
*/
|
|
@@ -1773,6 +1835,15 @@ interface RouteDefinition {
|
|
|
1773
1835
|
body?: SchemaLike<unknown>;
|
|
1774
1836
|
output?: SchemaLike<unknown>;
|
|
1775
1837
|
};
|
|
1838
|
+
/** Named middleware (aliases or groups) applied to this route */
|
|
1839
|
+
middlewareNames?: string[];
|
|
1840
|
+
/** Whether inline (unnamed) middleware handlers are attached */
|
|
1841
|
+
hasInlineMiddleware?: boolean;
|
|
1842
|
+
/** Controller binding when the handler is a [Controller, 'method'] tuple */
|
|
1843
|
+
controller?: {
|
|
1844
|
+
name: string;
|
|
1845
|
+
action: string;
|
|
1846
|
+
};
|
|
1776
1847
|
summary?: string;
|
|
1777
1848
|
description?: string;
|
|
1778
1849
|
tags?: string[];
|
|
@@ -2107,4 +2178,4 @@ declare class Application {
|
|
|
2107
2178
|
}
|
|
2108
2179
|
declare function createApp(options?: ApplicationOptions): Application;
|
|
2109
2180
|
|
|
2110
|
-
export { type
|
|
2181
|
+
export { type NotificationAttachment as $, Application as A, type InertiaPagePayload as B, Container as C, type DevBannerOptions as D, type ErrorResponse as E, type FailedJob as F, GUREN_ASCII_ART as G, type HostAuthorizationOptions as H, type InertiaOptions as I, type InertiaResponse as J, type InertiaSharedProps as K, type InertiaSsrContext as L, type InertiaSsrOptions as M, NotificationManager as N, type InertiaSsrRenderer as O, type Provider as P, QueueManager as Q, type InertiaSsrResult as R, ServiceProvider as S, type InferInertiaProps as T, Job as U, type JobClass as V, type JobFailureHandler as W, type JobHandler as X, type JobOptions as Y, type Notifiable as Z, Notification as _, type StartViteDevServerOptions as a, setExceptionHandler as a$, type NotificationChannel as a0, type NotificationChannelFactory as a1, type NotificationClass as a2, type NotificationMailMessage as a3, type NotificationManagerOptions as a4, ProviderManager as a5, type QueueConfig as a6, type QueueDriver as a7, type QueueDriverFactory as a8, type QueuedJob as a9, abortIf as aA, abortUnless as aB, clearJobRegistry as aC, createApp as aD, createContainer as aE, createCsrfMiddleware as aF, createExceptionHandler as aG, createHostAuthorizationMiddleware as aH, createNotificationManager as aI, createQueueManager as aJ, createSecurityHeaders as aK, csrfField as aL, formatValidationErrors as aM, getContainer as aN, getCsrfToken as aO, getExceptionHandler as aP, getInertiaSharedPropsResolver as aQ, getJob as aR, getNotificationManager as aS, getQueueDriver as aT, getRegisteredJobs as aU, getValidatedData as aV, inertia as aW, parseRequestPayload as aX, registerJob as aY, resolve as aZ, setContainer as a_, type RendererRegistration as aa, type ResolvedSharedInertiaProps as ab, type ResourceRouteOptions as ac, type RouteBuilder as ad, type RouteContractOptions as ae, type RouteDefinition as af, type RouteOpenApiMetadata as ag, type ResourceAction as ah, Router as ai, type SecurityHeadersOptions as aj, type SentNotification as ak, type ServiceBinding as al, type ServiceClass as am, type ServiceFactory as an, type ServiceProviderClass as ao, type ServiceProviderConstructor as ap, type ServiceProviderOptions as aq, type SharedInertiaPropsResolver as ar, type SlackAttachment as as, type SlackBlock as at, type SlackMessage as au, VALIDATED_DATA_KEY as av, type ValidateRequestOptions as aw, type ValidationSchema as ax, type WorkerOptions as ay, abort as az, type StartedViteDevServer as b, setInertiaSharedProps as b0, setNotificationManager as b1, setQueueDriver as b2, shareInertiaProps as b3, validate as b4, validateRequest as b5, validateRequestWith as b6, validateSafe as b7, verifyCsrfToken as b8, type ServiceBindings as c, type ApplicationListenOptions as d, type ApplicationOptions as e, type AuthPayload as f, type AuthPluginOptions as g, CSRF_FORM_FIELD as h, CSRF_HEADER_NAME as i, CSRF_TOKEN_KEY as j, type ContextualBinding as k, logDevServerBanner as l, type ContextualBindingBuilder as m, type ContextualNeedsBuilder as n, Controller as o, type ControllerInertiaProps as p, type CsrfOptions as q, type DatabaseChannelOptions as r, startViteDevServer as s, type DatabaseNotification as t, type ExceptionClass as u, ExceptionHandler as v, type ExceptionHandlerOptions as w, type ExceptionRenderer as x, type ExceptionReporter as y, type HstsOptions as z };
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { Context } from 'hono';
|
|
2
|
+
import { Model } from '@guren/orm';
|
|
3
|
+
import { A as Authenticatable, U as UserProvider, a as AuthCredentials, b as AuthManagerContract, c as AuthManagerOptions, G as GuardFactory, P as ProviderFactory, d as GuardContext, e as Guard, f as AttachContextOptions, g as AuthContext } from './api-token-BSSCLlFW.js';
|
|
4
|
+
|
|
5
|
+
interface PasswordHasher {
|
|
6
|
+
hash(plain: string): Promise<string>;
|
|
7
|
+
verify(hashed: string, plain: string): Promise<boolean>;
|
|
8
|
+
needsRehash?(hashed: string): boolean;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
declare abstract class BaseUserProvider<User extends Authenticatable = Authenticatable> implements UserProvider<User> {
|
|
12
|
+
abstract retrieveById(identifier: unknown): Promise<User | null>;
|
|
13
|
+
abstract retrieveByCredentials(credentials: AuthCredentials): Promise<User | null>;
|
|
14
|
+
abstract validateCredentials(user: User, credentials: AuthCredentials): Promise<boolean>;
|
|
15
|
+
abstract getId(user: User): unknown;
|
|
16
|
+
setRememberToken(user: User, token: string | null): Promise<void>;
|
|
17
|
+
getRememberToken(user: User): Promise<string | null>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
interface ModelUserProviderOptions {
|
|
21
|
+
idColumn?: string;
|
|
22
|
+
usernameColumn?: string;
|
|
23
|
+
passwordColumn?: string;
|
|
24
|
+
rememberTokenColumn?: string;
|
|
25
|
+
hasher?: PasswordHasher;
|
|
26
|
+
credentialsPasswordField?: string;
|
|
27
|
+
}
|
|
28
|
+
declare class ModelUserProvider<User extends Authenticatable = Authenticatable> extends BaseUserProvider<User> {
|
|
29
|
+
private readonly model;
|
|
30
|
+
private readonly idColumn;
|
|
31
|
+
private readonly usernameColumn;
|
|
32
|
+
private readonly passwordColumn;
|
|
33
|
+
private readonly rememberTokenColumn;
|
|
34
|
+
private readonly hasher;
|
|
35
|
+
private readonly credentialsPasswordField;
|
|
36
|
+
constructor(model: typeof Model, options?: ModelUserProviderOptions);
|
|
37
|
+
private cast;
|
|
38
|
+
retrieveById(identifier: unknown): Promise<User | null>;
|
|
39
|
+
retrieveByCredentials(credentials: AuthCredentials): Promise<User | null>;
|
|
40
|
+
validateCredentials(user: User, credentials: AuthCredentials): Promise<boolean>;
|
|
41
|
+
getId(user: User): unknown;
|
|
42
|
+
/**
|
|
43
|
+
* Strip the password hash, remember token, and the model's `hidden`
|
|
44
|
+
* fields before the record leaves the auth layer. Credential
|
|
45
|
+
* validation happens on the raw record before sanitizing, so this
|
|
46
|
+
* never affects login — only what `auth.user()` exposes.
|
|
47
|
+
*/
|
|
48
|
+
sanitize(user: User): User;
|
|
49
|
+
setRememberToken(user: User, token: string | null): Promise<void>;
|
|
50
|
+
getRememberToken(user: User): Promise<string | null>;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
declare class AuthManager implements AuthManagerContract {
|
|
54
|
+
private readonly guards;
|
|
55
|
+
private readonly providers;
|
|
56
|
+
private defaultGuard;
|
|
57
|
+
constructor(options?: AuthManagerOptions);
|
|
58
|
+
registerGuard<User>(name: string, factory: GuardFactory<User>): void;
|
|
59
|
+
registerProvider<User>(name: string, factory: ProviderFactory<User>): void;
|
|
60
|
+
getProvider<User>(name: string): UserProvider<User>;
|
|
61
|
+
createGuard<User>(name: string, context: GuardContext): Guard<User>;
|
|
62
|
+
guardNames(): string[];
|
|
63
|
+
setDefaultGuard(name: string): void;
|
|
64
|
+
getDefaultGuard(): string;
|
|
65
|
+
createAuthContext(ctx: Context, options?: AttachContextOptions): AuthContext;
|
|
66
|
+
attempt(name: string, ctx: Context, credentials: AuthCredentials, remember?: boolean): Promise<boolean>;
|
|
67
|
+
/**
|
|
68
|
+
* Shorthand method to register a model-based authentication provider and session guard.
|
|
69
|
+
* This simplifies the common case of authenticating users via a database model.
|
|
70
|
+
*
|
|
71
|
+
* @param model - The model class to use for user authentication
|
|
72
|
+
* @param options - Options for the ModelUserProvider (partial, with defaults)
|
|
73
|
+
* @param providerName - Name for the provider (defaults to 'users')
|
|
74
|
+
* @param guardName - Name for the guard (defaults to 'web')
|
|
75
|
+
*/
|
|
76
|
+
useModel(model: typeof Model<PlainObject>, options?: Partial<ModelUserProviderOptions>, providerName?: string, guardName?: string): void;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export { AuthManager as A, BaseUserProvider as B, ModelUserProvider as M, type PasswordHasher as P };
|
|
@@ -123,6 +123,11 @@ interface SSEMiddlewareOptions {
|
|
|
123
123
|
* Retry delay for SSE reconnection.
|
|
124
124
|
*/
|
|
125
125
|
retry?: number;
|
|
126
|
+
/**
|
|
127
|
+
* Function to get the user from the request context, used to authorize
|
|
128
|
+
* channels requested via the `?channels=` query parameter.
|
|
129
|
+
*/
|
|
130
|
+
getUser?: (ctx: unknown) => unknown | Promise<unknown>;
|
|
126
131
|
}
|
|
127
132
|
/**
|
|
128
133
|
* Auth middleware options.
|
|
@@ -213,6 +213,11 @@ declare class Gate {
|
|
|
213
213
|
check(ability: string, user: AuthUser | null, ...args: unknown[]): Promise<boolean>;
|
|
214
214
|
/**
|
|
215
215
|
* Check a policy for the given ability.
|
|
216
|
+
*
|
|
217
|
+
* The subject may be a class instance (policy resolved via its constructor)
|
|
218
|
+
* or a `[ModelClass, record]` / `['key', record]` tuple. The tuple form is
|
|
219
|
+
* required for plain records returned by the ORM, which carry no constructor
|
|
220
|
+
* information.
|
|
216
221
|
*/
|
|
217
222
|
protected checkPolicy(ability: string, user: AuthUser | null, model: unknown, additionalArgs: unknown[]): Promise<boolean | undefined>;
|
|
218
223
|
/**
|
|
@@ -71,9 +71,14 @@ interface I18nConfig {
|
|
|
71
71
|
*/
|
|
72
72
|
fallbackLocale?: string;
|
|
73
73
|
/**
|
|
74
|
-
* Path to translation files.
|
|
74
|
+
* Path to translation files (constructs a JsonLoader internally).
|
|
75
75
|
*/
|
|
76
76
|
path?: string;
|
|
77
|
+
/**
|
|
78
|
+
* Custom translation loader (e.g. JsonLoader, MemoryLoader).
|
|
79
|
+
* Takes precedence over `path`.
|
|
80
|
+
*/
|
|
81
|
+
loader?: TranslationLoader;
|
|
77
82
|
/**
|
|
78
83
|
* Preloaded messages.
|
|
79
84
|
*/
|