alepha 0.6.8 → 0.6.9

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/core.d.ts CHANGED
@@ -8,6 +8,7 @@ import { ValueError } from '@sinclair/typebox/errors';
8
8
  import { ReadableStream as ReadableStream$1 } from 'node:stream/web';
9
9
  import * as TypeBoxValue from '@sinclair/typebox/value';
10
10
  export { TypeBoxValue };
11
+ import { Readable } from 'node:stream';
11
12
 
12
13
  /**
13
14
  * Used for identifying descriptors.
@@ -963,19 +964,25 @@ declare class TypeProvider {
963
964
  file: (options?: {
964
965
  max?: number;
965
966
  }) => TFile;
967
+ stream: () => TStream;
966
968
  }
967
969
  interface FileLike {
968
970
  name: string;
969
971
  type: string;
970
972
  size: number;
971
973
  lastModified: number;
972
- stream(): ReadableStream | ReadableStream$1;
974
+ stream(): StreamLike;
973
975
  arrayBuffer(): Promise<ArrayBuffer>;
974
976
  text(): Promise<string>;
977
+ filepath?: string;
975
978
  }
976
- declare const t: TypeProvider;
977
979
  type TFile = TUnsafe<FileLike>;
980
+ type StreamLike = ReadableStream | ReadableStream$1 | Readable;
981
+ type TStream = TUnsafe<StreamLike>;
982
+ declare const t: TypeProvider;
978
983
  declare const isTypeFile: (value: TSchema) => value is TFile;
984
+ declare const isFileLike: (value: any) => value is FileLike;
985
+ declare const isTypeStream: (value: TSchema) => value is TStream;
979
986
  type TextLength = "short" | "long" | "rich";
980
987
  interface AlephaStringOptions extends StringOptions {
981
988
  size?: TextLength;
@@ -988,4 +995,4 @@ declare const run: (arg: Alepha | Class | ((env?: Env) => Alepha), opts?: {
988
995
  ready?: (alepha: Alepha) => Async<void>;
989
996
  }) => Alepha;
990
997
 
991
- export { $cursor, $hook, $inject, $logger, $retry, Alepha, type AlephaStringOptions, AppNotStartedError, type Async, type AsyncFn, type AsyncLocalStorageData, AsyncLocalStorageProvider, COLORS, CircularDependencyError, type Class, type ClassEntry, type ClassProvider, type ClassSwap, ContainerLockedError, type CursorDescriptor, type Descriptor, type DescriptorIdentifier, type DescriptorItem, type Env, EventEmitter, type EventEmitterItem, EventEmitterLike, type FileLike, type Hook, type HookDescriptor, type HookOptions, type Hooks, KIND, LEVEL_COLORS, type LogLevel, Logger, type LoggerEnv, type LoggerOptions, MockLogger, type MockLoggerStore, NotImplementedError, OPTIONS, PROVIDER, type PromiseFn, type RetryDescriptorOptions, type State, type TFile, type TextLength, TypeBoxError, TypeProvider, __alephaRef, __bind, __descriptor, descriptorEvents, isDescriptorValue, isTypeFile, isUUID, run, t };
998
+ export { $cursor, $hook, $inject, $logger, $retry, Alepha, type AlephaStringOptions, AppNotStartedError, type Async, type AsyncFn, type AsyncLocalStorageData, AsyncLocalStorageProvider, COLORS, CircularDependencyError, type Class, type ClassEntry, type ClassProvider, type ClassSwap, ContainerLockedError, type CursorDescriptor, type Descriptor, type DescriptorIdentifier, type DescriptorItem, type Env, EventEmitter, type EventEmitterItem, EventEmitterLike, type FileLike, type Hook, type HookDescriptor, type HookOptions, type Hooks, KIND, LEVEL_COLORS, type LogLevel, Logger, type LoggerEnv, type LoggerOptions, MockLogger, type MockLoggerStore, NotImplementedError, OPTIONS, PROVIDER, type PromiseFn, type RetryDescriptorOptions, type State, type StreamLike, type TFile, type TStream, type TextLength, TypeBoxError, TypeProvider, __alephaRef, __bind, __descriptor, descriptorEvents, isDescriptorValue, isFileLike, isTypeFile, isTypeStream, isUUID, run, t };
package/package.json CHANGED
@@ -1,31 +1,31 @@
1
1
  {
2
2
  "name": "alepha",
3
- "version": "0.6.8",
3
+ "version": "0.6.9",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "main": "./core.js",
7
7
  "types": "./core.d.ts",
8
8
  "dependencies": {
9
- "@alepha/cache": "0.6.8",
10
- "@alepha/core": "0.6.8",
11
- "@alepha/datetime": "0.6.8",
12
- "@alepha/lock": "0.6.8",
13
- "@alepha/postgres": "0.6.8",
14
- "@alepha/queue": "0.6.8",
15
- "@alepha/react": "0.6.8",
16
- "@alepha/react-auth": "0.6.8",
17
- "@alepha/redis": "0.6.8",
18
- "@alepha/scheduler": "0.6.8",
19
- "@alepha/security": "0.6.8",
20
- "@alepha/server": "0.6.8",
21
- "@alepha/server-cookies": "0.6.8",
22
- "@alepha/server-metrics": "0.6.8",
23
- "@alepha/server-proxy": "0.6.8",
24
- "@alepha/server-static": "0.6.8",
25
- "@alepha/server-swagger": "0.6.8",
26
- "@alepha/testing": "0.6.8",
27
- "@alepha/topic": "0.6.8",
28
- "@alepha/vite": "0.6.8"
9
+ "@alepha/cache": "0.6.9",
10
+ "@alepha/core": "0.6.9",
11
+ "@alepha/datetime": "0.6.9",
12
+ "@alepha/lock": "0.6.9",
13
+ "@alepha/postgres": "0.6.9",
14
+ "@alepha/queue": "0.6.9",
15
+ "@alepha/react": "0.6.9",
16
+ "@alepha/react-auth": "0.6.9",
17
+ "@alepha/redis": "0.6.9",
18
+ "@alepha/scheduler": "0.6.9",
19
+ "@alepha/security": "0.6.9",
20
+ "@alepha/server": "0.6.9",
21
+ "@alepha/server-cookies": "0.6.9",
22
+ "@alepha/server-metrics": "0.6.9",
23
+ "@alepha/server-proxy": "0.6.9",
24
+ "@alepha/server-static": "0.6.9",
25
+ "@alepha/server-swagger": "0.6.9",
26
+ "@alepha/testing": "0.6.9",
27
+ "@alepha/topic": "0.6.9",
28
+ "@alepha/vite": "0.6.9"
29
29
  },
30
30
  "peerDependencies": {
31
31
  "@types/react": "^19",
@@ -159,5 +159,19 @@
159
159
  "require": "./server/swagger.cjs",
160
160
  "types": "./server/swagger.d.ts"
161
161
  }
162
- }
162
+ },
163
+ "keywords": [
164
+ "alepha",
165
+ "cache",
166
+ "datetime",
167
+ "lock",
168
+ "postgres",
169
+ "queue",
170
+ "react",
171
+ "redis",
172
+ "scheduler",
173
+ "security",
174
+ "server",
175
+ "topic"
176
+ ]
163
177
  }
package/postgres.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as _alepha_core from '@alepha/core';
2
2
  import { TObject as TObject$1, Static as Static$1, Alepha, KIND, OPTIONS } from '@alepha/core';
3
3
  import * as _sinclair_typebox from '@sinclair/typebox';
4
- import { TObject, Static, TSchema, ObjectOptions, Kind, TProperties, Evaluate, TReadonly, TOptional, TAdditionalProperties, OptionalKind, TArray, TIntersect, TBoolean, TInteger, IntegerOptions, StringOptions, TOptionalWithFlag } from '@sinclair/typebox';
4
+ import { TObject, Static, TSchema, ObjectOptions, Kind, TProperties, Evaluate, TReadonly, TOptional, TAdditionalProperties, OptionalKind, TArray, TIntersect, TRecord, TBoolean, TInteger, IntegerOptions, StringOptions, TOptionalWithFlag } from '@sinclair/typebox';
5
5
  import * as drizzle_orm from 'drizzle-orm';
6
6
  import { TableConfig, SQLWrapper, SQL, BuildColumns } from 'drizzle-orm';
7
7
  export { sql } from 'drizzle-orm';
@@ -662,11 +662,11 @@ type PageQuery = Static$1<typeof pageQuerySchema>;
662
662
  * @param objectSchema
663
663
  * @param options
664
664
  */
665
- declare const pageSchema: <T extends TObject | TIntersect>(objectSchema: T, options?: ObjectOptions) => TPage<T>;
665
+ declare const pageSchema: <T extends TObject | TIntersect | TRecord>(objectSchema: T, options?: ObjectOptions) => TPage<T>;
666
666
  /**
667
667
  *
668
668
  */
669
- type TPage<T extends TObject | TIntersect> = TObject<{
669
+ type TPage<T extends TObject | TIntersect | TRecord> = TObject<{
670
670
  content: TArray<T>;
671
671
  can: TObject<{
672
672
  next: TBoolean;
@@ -696,10 +696,6 @@ type Page<T> = {
696
696
  *
697
697
  */
698
698
  declare class Repository<TTable extends PgTableWithColumns<TableConfig$1>, TTableSchema extends TObject> {
699
- readonly options: {
700
- table: TTable;
701
- schema: TTableSchema;
702
- };
703
699
  readonly provider: PostgresProvider;
704
700
  protected readonly alepha: Alepha;
705
701
  static of: <TEntity extends TableConfig$1, TSchema extends TObject>(table: PgTableWithColumnsAndSchema<TEntity, TSchema>) => (new () => Repository<PgTableWithColumnsAndSchema<TEntity, TSchema>, TSchema>);
@@ -724,6 +720,10 @@ declare class Repository<TTable extends PgTableWithColumns<TableConfig$1>, TTabl
724
720
  table: TTable;
725
721
  schema: TTableSchema;
726
722
  };
723
+ readonly options: {
724
+ table: TTable;
725
+ schema: TTableSchema;
726
+ };
727
727
  constructor(options: {
728
728
  table: TTable;
729
729
  schema: TTableSchema;
package/security.d.ts CHANGED
@@ -2,6 +2,28 @@ import * as _alepha_core from '@alepha/core';
2
2
  import { Static as Static$1, KIND, OPTIONS, Alepha } from '@alepha/core';
3
3
  import { JWSHeaderParameters, FlattenedJWSInput, CryptoKey, KeyObject, JSONWebKeySet, JWTVerifyResult, JWTPayload, JWTHeaderParameters } from 'jose';
4
4
 
5
+ /**
6
+ * Represents a User Account extracted from JWT.
7
+ */
8
+ interface UserAccountInfo {
9
+ /**
10
+ * ID of user account. Based on JWT.sub.
11
+ */
12
+ id: string;
13
+ /**
14
+ * Represents the roles assigned to a user.
15
+ */
16
+ roles?: string[];
17
+ /**
18
+ * User full name, if available.
19
+ */
20
+ name?: string;
21
+ /**
22
+ * Organization ID, if available.
23
+ */
24
+ organization?: string;
25
+ }
26
+
5
27
  /** Symbol key applied to readonly types */
6
28
  declare const ReadonlyKind: unique symbol;
7
29
  /** Symbol key applied to optional types */
@@ -142,39 +164,6 @@ interface TSchema extends TKind, SchemaOptions {
142
164
  static: unknown;
143
165
  }
144
166
 
145
- declare const roleSchema: TObject<{
146
- name: TString;
147
- description: TOptional<TString>;
148
- default: TOptional<TBoolean>;
149
- permissions: TArray<TObject<{
150
- name: TString;
151
- ownership: TOptional<TBoolean>;
152
- }>>;
153
- }>;
154
- type Role = Static$1<typeof roleSchema>;
155
-
156
- /**
157
- * Represents a User Account extracted from JWT.
158
- */
159
- interface UserAccountInfo {
160
- /**
161
- * ID of user account. Based on JWT.sub.
162
- */
163
- id: string;
164
- /**
165
- * Represents the roles assigned to a user.
166
- */
167
- roles?: Role[];
168
- /**
169
- * User full name, if available.
170
- */
171
- name?: string;
172
- /**
173
- * Organization ID, if available.
174
- */
175
- organization?: string;
176
- }
177
-
178
167
  declare const permissionSchema: TObject<{
179
168
  name: TString;
180
169
  group: TOptional<TString>;
@@ -241,6 +230,17 @@ interface UserAccountToken extends UserAccountInfo {
241
230
  ownership?: string | boolean;
242
231
  }
243
232
 
233
+ declare const roleSchema: TObject<{
234
+ name: TString;
235
+ description: TOptional<TString>;
236
+ default: TOptional<TBoolean>;
237
+ permissions: TArray<TObject<{
238
+ name: TString;
239
+ ownership: TOptional<TBoolean>;
240
+ }>>;
241
+ }>;
242
+ type Role = Static$1<typeof roleSchema>;
243
+
244
244
  /**
245
245
  * Provides utilities for working with JSON Web Tokens (JWT).
246
246
  */
@@ -406,9 +406,9 @@ declare class SecurityProvider {
406
406
  * Bonus: we check also if the user has "ownership" flag.
407
407
  *
408
408
  * @param permissionLike - The permission to check for.
409
- * @param roles - The roles to check for the permission.
409
+ * @param roleEntries - The roles to check for the permission.
410
410
  */
411
- checkPermission(permissionLike: string | Permission, ...roles: Role[]): SecurityCheckResult;
411
+ checkPermission(permissionLike: string | Permission, ...roleEntries: string[]): SecurityCheckResult;
412
412
  /**
413
413
  * Creates a user account from the provided payload.
414
414
  *
@@ -423,7 +423,7 @@ declare class SecurityProvider {
423
423
  * @param permission - The permission to check for.
424
424
  * @returns True if the user has the role, false otherwise.
425
425
  */
426
- can(roleName: string, permission: string | Permission): boolean;
426
+ can(role: string, permission: string | Permission): boolean;
427
427
  /**
428
428
  * Converts a permission object to a string.
429
429
  *
@@ -550,6 +550,10 @@ interface RealmDescriptor {
550
550
  * Set all roles in the realm.
551
551
  */
552
552
  setRoles(roles: Role[]): Promise<void>;
553
+ /**
554
+ * Get a role by name, throws an error if not found.
555
+ */
556
+ getRoleByName(name: string): Role;
553
557
  /**
554
558
  * Create a token for the subject.
555
559
  */
package/server.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import * as _alepha_core from '@alepha/core';
2
- import { Static as Static$1, TSchema as TSchema$1, Async, Alepha, OPTIONS, KIND, FileLike } from '@alepha/core';
2
+ import { Static as Static$1, TObject as TObject$1, TSchema as TSchema$1, Async, StreamLike, Alepha, OPTIONS, KIND, FileLike } from '@alepha/core';
3
3
  export { KIND } from '@alepha/core';
4
- import { UserAccountToken, Permission, SecurityProvider } from '@alepha/security';
4
+ import { UserAccountToken, Permission, SecurityProvider, JwtProvider } from '@alepha/security';
5
5
  import { IncomingMessage, ServerResponse as ServerResponse$1 } from 'node:http';
6
6
  import { Readable } from 'node:stream';
7
- import { ReadableStream as ReadableStream$1 } from 'node:stream/web';
7
+ import { ReadableStream } from 'node:stream/web';
8
8
  import { Route, RouterProvider } from '@alepha/router';
9
9
  import * as _alepha_cache from '@alepha/cache';
10
10
  import { DurationLike } from '@alepha/datetime';
@@ -189,7 +189,7 @@ interface TSchema extends TKind, SchemaOptions {
189
189
  declare const routeMethods: readonly ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS", "CONNECT", "TRACE"];
190
190
  type RouteMethod = (typeof routeMethods)[number];
191
191
 
192
- declare const envSchema$4: _alepha_core.TObject<{
192
+ declare const envSchema$4: TObject$1<{
193
193
  SERVER_ALS_ENABLED: TBoolean;
194
194
  }>;
195
195
  declare module "alepha" {
@@ -211,7 +211,7 @@ declare class ServerRouterProvider extends RouterProvider<ServerRouteWithHandler
211
211
  };
212
212
  body: any;
213
213
  }>;
214
- protected doRequestHandler(route: ServerRoute, request: ServerRequest, responseType: ResponseType, withAls: boolean): Promise<void>;
214
+ protected tryRequestProcessing(route: ServerRoute, request: ServerRequest, responseType: ResponseType, withAls: boolean): Promise<void>;
215
215
  protected getResponseType(schema?: RequestConfigSchema): ResponseType;
216
216
  protected errorHandler(route: ServerRoute, request: ServerRequest, error: Error): Promise<void>;
217
217
  validateRequest(route: {
@@ -221,16 +221,16 @@ declare class ServerRouterProvider extends RouterProvider<ServerRouteWithHandler
221
221
  }
222
222
  interface RequestConfigSchema {
223
223
  body?: TSchema$1;
224
- params?: TSchema$1;
225
- query?: TSchema$1;
226
- headers?: TSchema$1;
224
+ params?: TObject$1;
225
+ query?: TObject$1;
226
+ headers?: TObject$1;
227
227
  response?: TSchema$1;
228
228
  }
229
229
  interface ServerRequestConfig<TConfig extends RequestConfigSchema = RequestConfigSchema> {
230
230
  body: TConfig["body"] extends TSchema$1 ? Static$1<TConfig["body"]> : any;
231
- headers: TConfig["headers"] extends TSchema$1 ? Static$1<TConfig["headers"]> : Record<string, string>;
232
- params: TConfig["params"] extends TSchema$1 ? Static$1<TConfig["params"]> : Record<string, string>;
233
- query: TConfig["query"] extends TSchema$1 ? Static$1<TConfig["query"]> : Record<string, string>;
231
+ headers: TConfig["headers"] extends TObject$1 ? Static$1<TConfig["headers"]> : Record<string, string>;
232
+ params: TConfig["params"] extends TObject$1 ? Static$1<TConfig["params"]> : Record<string, string>;
233
+ query: TConfig["query"] extends TObject$1 ? Static$1<TConfig["query"]> : Record<string, string>;
234
234
  }
235
235
  type ServerRequestConfigEntry<TConfig extends RequestConfigSchema = RequestConfigSchema> = Partial<ServerRequestConfig<TConfig>>;
236
236
  interface ServerRequest<TConfig extends RequestConfigSchema = RequestConfigSchema> extends ServerRequestConfig<TConfig> {
@@ -244,7 +244,7 @@ interface ServerRequest<TConfig extends RequestConfigSchema = RequestConfigSchem
244
244
  res: ServerResponse$1;
245
245
  };
246
246
  };
247
- user?: UserAccountToken;
247
+ user: UserAccountToken;
248
248
  }
249
249
  interface ServerRoute<TConfig extends RequestConfigSchema = RequestConfigSchema> extends Route {
250
250
  method?: RouteMethod;
@@ -253,19 +253,19 @@ interface ServerRoute<TConfig extends RequestConfigSchema = RequestConfigSchema>
253
253
  schema?: TConfig;
254
254
  }
255
255
  type ServerResponseBody<TConfig extends RequestConfigSchema = RequestConfigSchema> = TConfig["response"] extends TSchema$1 ? Static$1<TConfig["response"]> : ResponseBodyType;
256
- type ResponseType = "json" | "text" | "void" | "stream" | "buffer" | "file";
257
- type ResponseBodyType = string | ArrayBuffer | Readable | ReadableStream$1 | ReadableStream | undefined | null | void;
256
+ type ResponseType = "json" | "text" | "void" | "file" | "any";
257
+ type ResponseBodyType = string | Buffer | StreamLike | undefined | null | void;
258
258
  type ServerHandler<TConfig extends RequestConfigSchema = RequestConfigSchema> = (request: ServerRequest<TConfig>) => Async<ServerResponseBody<TConfig>>;
259
259
  interface ServerReply {
260
260
  headers: Record<string, string> & {
261
261
  "set-cookie"?: string[];
262
262
  };
263
263
  status?: number;
264
- body?: ResponseBodyType;
264
+ body?: any;
265
265
  redirect(url: string): void;
266
266
  }
267
267
  interface ServerResponse {
268
- body: string | ArrayBuffer | Readable | ReadableStream$1;
268
+ body: string | ArrayBuffer | Readable | ReadableStream;
269
269
  headers: Record<string, string>;
270
270
  status: number;
271
271
  }
@@ -426,7 +426,12 @@ declare class HttpError extends Error {
426
426
  cause: {
427
427
  name: string;
428
428
  message: string;
429
- } | undefined;
429
+ };
430
+ } | {
431
+ status: number;
432
+ error: string | undefined;
433
+ message: string;
434
+ cause?: undefined;
430
435
  };
431
436
  readonly status: number;
432
437
  readonly error?: string;
@@ -446,23 +451,41 @@ declare class HttpError extends Error {
446
451
  }
447
452
  declare const errorNameByStatus: Record<number, string>;
448
453
 
454
+ declare class RouteDescriptorHelper {
455
+ name(options: RouteDescriptorOptions, instance: any, key: string): string;
456
+ path(options: RouteDescriptorOptions, instance: any, key: string, prefix?: string): string;
457
+ link(options: RouteDescriptorOptions, instance: any, key: string, prefix?: string): HttpClientLink;
458
+ method(options: {
459
+ method?: string;
460
+ schema?: any;
461
+ }): RouteMethod;
462
+ permission(options: RouteDescriptorOptions, instance: any, key: string, prefix?: string): Permission;
463
+ group(options: RouteDescriptorOptions, instance: any): string;
464
+ isMultipart(options: {
465
+ schema?: RequestConfigSchema;
466
+ }): boolean;
467
+ bodyContentType(options: RouteDescriptorOptions): string | undefined;
468
+ protected short(name: string): string;
469
+ }
470
+
449
471
  declare class HttpClient {
450
472
  protected readonly alepha: Alepha;
451
473
  protected readonly env: {
452
474
  SERVER_API_URL: string;
475
+ CLIENT_API_PREFIX: string;
453
476
  };
477
+ protected readonly helper: RouteDescriptorHelper;
454
478
  readonly URL_LINKS = "/_links";
455
479
  readonly cache: _alepha_cache.CacheDescriptor<any, any[]>;
456
480
  links?: Array<HttpClientLink>;
457
481
  protected readonly pendingRequests: HttpClientPendingRequests;
458
- protected host: string;
459
482
  json<T = any>(url: string, options?: RequestInit): Promise<T>;
460
483
  clear(): Promise<void>;
461
- createFetchFunction(link: HttpClientLink, options?: FetchFactoryAdditionalOptions): (config?: Partial<ClientRequestEntry>, fetchOptions?: ClientRequestOptions) => Promise<any>;
484
+ createFetchFunction(link: HttpClientLink, options?: FetchFactoryAdditionalOptions): (config?: Partial<ClientRequestEntry>, request?: ClientRequestOptions) => Promise<any>;
462
485
  request(args: {
463
- link: HttpClientLink;
464
- fetch?: ClientRequestOptions;
465
486
  config?: ServerRequestConfigEntry;
487
+ link: HttpClientLink;
488
+ request?: ClientRequestOptions;
466
489
  host?: string;
467
490
  }): Promise<any>;
468
491
  protected url(host: string, link: HttpClientLink, args: ServerRequestConfigEntry): string;
@@ -476,12 +499,18 @@ declare class HttpClient {
476
499
  * @protected
477
500
  */
478
501
  protected response(response: Response, options: FetchRunOptions): Promise<Response | any>;
502
+ protected getFileLike(response: Response, defaultFileName?: string): FileLike;
479
503
  protected pathVariables(url: string, action: HttpClientLink, args?: ServerRequestConfigEntry): string;
480
504
  protected queryParams(url: string, action: HttpClientLink, args?: ServerRequestConfigEntry): string;
481
505
  of<T extends object>(options?: {
482
506
  group?: string;
483
507
  host?: string | (() => string);
484
508
  }): HttpVirtualClient<T>;
509
+ follow(name: string, config?: any, options?: {
510
+ request?: ClientRequestOptions;
511
+ group?: string;
512
+ host?: string | (() => string);
513
+ }): Promise<any>;
485
514
  can(name: string): boolean;
486
515
  getLinks(opts?: {
487
516
  force?: boolean;
@@ -540,23 +569,6 @@ declare const $remote: {
540
569
  [KIND]: string;
541
570
  };
542
571
 
543
- declare class RouteDescriptorHelper {
544
- name(options: RouteDescriptorOptions, instance: any, key: string): string;
545
- path(options: RouteDescriptorOptions, instance: any, key: string, prefix?: string): string;
546
- link(options: RouteDescriptorOptions, instance: any, key: string, prefix?: string): HttpClientLink;
547
- method(options: {
548
- method?: string;
549
- schema?: any;
550
- }): RouteMethod;
551
- permission(options: RouteDescriptorOptions, instance: any, key: string, prefix?: string): Permission;
552
- group(options: RouteDescriptorOptions, instance: any): string;
553
- isMultipart(options: {
554
- schema?: RequestConfigSchema;
555
- }): boolean;
556
- bodyContentType(options: RouteDescriptorOptions): string | undefined;
557
- protected short(name: string): string;
558
- }
559
-
560
572
  declare class ServerProvider {
561
573
  get hostname(): string;
562
574
  }
@@ -667,13 +679,16 @@ declare class BrowserActionDescriptorProvider {
667
679
  };
668
680
  protected readonly helper: RouteDescriptorHelper;
669
681
  readonly configure: _alepha_core.HookDescriptor<"configure">;
682
+ configureActions(): void;
670
683
  registerAction(value: RouteDescriptor, instance: any, key: string): void;
671
684
  }
672
685
 
673
686
  declare class ServerSecurityProvider {
674
687
  protected readonly log: _alepha_core.Logger;
675
688
  protected readonly securityProvider: SecurityProvider;
689
+ protected readonly jwtProvider: JwtProvider;
676
690
  protected readonly alepha: Alepha;
691
+ readonly onClientRequest: _alepha_core.HookDescriptor<"client:onRequest">;
677
692
  protected readonly onRequest: _alepha_core.HookDescriptor<"server:onRequest">;
678
693
  protected readonly onRoute: _alepha_core.HookDescriptor<"server:onRoute">;
679
694
  }
@@ -727,12 +742,13 @@ interface HybridFile extends FileLike {
727
742
  /**
728
743
  * Create a file-like object from various sources.
729
744
  */
730
- declare const file: (source: string | Buffer | ArrayBuffer, // TODO: FileLike, Blob, WebStream, NodeStream
731
- options?: {
745
+ declare const file: (source: string | Buffer | ArrayBuffer | StreamLike, options?: {
732
746
  type?: string;
733
747
  name?: string;
734
- }) => Promise<FileLike>;
735
- declare const isFileLike: (value: any) => value is FileLike;
748
+ }) => FileLike;
749
+ declare const bufferToStream: (buffer: Buffer) => Readable;
750
+ declare const streamToBuffer: (stream: Readable) => Promise<Buffer>;
751
+ declare const bufferToArrayBuffer: (buffer: Buffer) => ArrayBuffer;
736
752
  declare const getContentType: (filename: string) => string;
737
753
 
738
754
  declare const envSchema$1: _alepha_core.TObject<{
@@ -837,6 +853,11 @@ declare module "@alepha/core" {
837
853
  headers: Record<string, string>;
838
854
  request: RequestInit;
839
855
  };
856
+ "client:beforeFetch": {
857
+ url: string;
858
+ options: FetchRunOptions;
859
+ request: RequestInit;
860
+ };
840
861
  "client:onError": {
841
862
  route?: HttpClientLink;
842
863
  error: HttpError;
@@ -855,4 +876,4 @@ declare class ServerModule {
855
876
  constructor();
856
877
  }
857
878
 
858
- export { $action, $remote, $route, BadRequestError, BrowserActionDescriptorProvider, type ClientRequestEntry, type ClientRequestEntryContainer, type ClientRequestOptions, type ClientRequestResponse, ConflictError, type FetchFactoryAdditionalOptions, type FetchRunOptions, ForbiddenError, HttpClient, type HttpClientLink, type HttpClientPendingRequests, HttpError, type HttpVirtualClient, NodeHttpServerProvider, NotFoundError, type Ok, REMOTE_DESCRIPTOR_KEY, type RemoteDescriptor, type RemoteDescriptorOptions, type RequestConfigSchema, type ResponseBodyType, type ResponseType, type RouteDescriptor, type RouteDescriptorOptions, type RouteMethod, ServerActionDescriptorProvider, type ServerHandler, ServerLinksProvider, ServerLoggerProvider, ServerModule, ServerMultipartProvider, ServerProvider, type ServerRawRequest, type ServerRemote, type ServerReply, type ServerRequest, type ServerRequestConfig, type ServerRequestConfigEntry, type ServerResponse, type ServerResponseBody, type ServerRoute, type ServerRouteAction, type ServerRouteWithHandler, ServerRouterProvider, ServerSecurityProvider, UnauthorizedError, ValidationError, errorNameByStatus, errorSchema, file, getContentType, isFileLike, isServerAction, okSchema, routeMethods };
879
+ export { $action, $remote, $route, BadRequestError, BrowserActionDescriptorProvider, type ClientRequestEntry, type ClientRequestEntryContainer, type ClientRequestOptions, type ClientRequestResponse, ConflictError, type FetchFactoryAdditionalOptions, type FetchRunOptions, ForbiddenError, HttpClient, type HttpClientLink, type HttpClientPendingRequests, HttpError, type HttpVirtualClient, NodeHttpServerProvider, NotFoundError, type Ok, REMOTE_DESCRIPTOR_KEY, type RemoteDescriptor, type RemoteDescriptorOptions, type RequestConfigSchema, type ResponseBodyType, type ResponseType, type RouteDescriptor, type RouteDescriptorOptions, type RouteMethod, ServerActionDescriptorProvider, type ServerHandler, ServerLinksProvider, ServerLoggerProvider, ServerModule, ServerMultipartProvider, ServerProvider, type ServerRawRequest, type ServerRemote, type ServerReply, type ServerRequest, type ServerRequestConfig, type ServerRequestConfigEntry, type ServerResponse, type ServerResponseBody, type ServerRoute, type ServerRouteAction, type ServerRouteWithHandler, ServerRouterProvider, ServerSecurityProvider, UnauthorizedError, ValidationError, bufferToArrayBuffer, bufferToStream, errorNameByStatus, errorSchema, file, getContentType, isServerAction, okSchema, routeMethods, streamToBuffer };