truxie 0.1.0-test.3 → 0.1.0-test.5
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/chunk-F5KXBDV2.js +1 -0
- package/dist/chunk-RMR6UXWO.js +1 -0
- package/dist/chunk-XVPJFMLQ.js +1 -0
- package/dist/index.d.ts +90 -88
- package/dist/index.js +2 -2
- package/dist/saga.js +1 -1
- package/dist/schedule.d.ts +132 -0
- package/dist/schedule.js +1 -0
- package/dist/types-D-An5cXP.d.ts +88 -0
- package/package.json +11 -1
- package/dist/chunk-M2ZPR3DR.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {a,d as d$1}from'./chunk-RMR6UXWO.js';import'reflect-metadata';var s=Symbol("module"),d=Symbol("module:global");function b(t){return e=>{Reflect.defineMetadata(s,t,e);}}a(b,"Module");function m(){return t=>{Reflect.defineMetadata(d,true,t);}}a(m,"Global");function A(t){return Reflect.getOwnMetadata(s,t)}a(A,"getModuleMetadata");function O(t){return Reflect.getOwnMetadata(d,t)===true}a(O,"isGlobalModule");function p(t,e,o,l){var u=arguments.length,n=u<3?e:l===null?l=Object.getOwnPropertyDescriptor(e,o):l,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(t,e,o,l);else for(var i=t.length-1;i>=0;i--)(a=t[i])&&(n=(u<3?a(n):u>3?a(e,o,n):a(e,o))||n);return u>3&&n&&Object.defineProperty(e,o,n),n}a(p,"_ts_decorate");var f=class{static{a(this,"DiscoveryService");}container;providers=[];_init(e,o){this.container=e,this.providers=o;}getProviders(){return this.providers}async resolve(e){return this.container.resolve(e)}getProviderClass(e){return typeof e=="function"?e:"useClass"in e?e.useClass:null}};f=p([d$1()],f);export{b as a,m as b,A as c,O as d,f as e};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import'reflect-metadata';var u=Object.defineProperty;var n=(t,e)=>u(t,"name",{value:e,configurable:true});var p=(function(t){return t.SINGLETON="singleton",t.REQUEST="request",t.TRANSIENT="transient",t})({}),s=class{static{n(this,"InjectionToken");}description;constructor(e){this.description=e;}toString(){return `InjectionToken(${this.description})`}};var f=Symbol("injectable"),a=Symbol("inject:param"),l=Symbol("inject:deps"),r=Symbol("optional");function R(t){return e=>{Reflect.defineMetadata(f,{scope:t?.scope??p.SINGLETON},e);}}n(R,"Injectable");function O(...t){return (e,c,o)=>{if(typeof o=="number"){let i=Reflect.getOwnMetadata(a,e)??new Map;i.set(o,t[0]),Reflect.defineMetadata(a,i,e);}else Reflect.defineMetadata(l,t,e);}}n(O,"Inject");function g(){return (t,e,c)=>{let o=Reflect.getOwnMetadata(r,t)??new Set;o.add(c),Reflect.defineMetadata(r,o,t);}}n(g,"Optional");function S(t){return Reflect.getOwnMetadata(f,t)}n(S,"getInjectableMetadata");function w(t){return Reflect.getOwnMetadata(l,t)??[]}n(w,"getClassDeps");function x(t){return Reflect.getOwnMetadata(a,t)??new Map}n(x,"getInjectTokens");function I(t){return Reflect.getOwnMetadata(r,t)??new Set}n(I,"getOptionalParams");export{n as a,p as b,s as c,R as d,O as e,g as f,S as g,w as h,x as i,I as j};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {a as a$1}from'./chunk-RMR6UXWO.js';var e=class extends Error{static{a$1(this,"AppError");}statusCode;status;isOperational;constructor(s,c){super(s),this.statusCode=c,this.status=c>=400&&c<500?"fail":"error",this.isOperational=true,Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace(this,this.constructor);}},o=class extends e{static{a$1(this,"NotFoundError");}constructor(s="Resource not found"){super(s,404);}},u=class extends e{static{a$1(this,"ValidationError");}errors;constructor(s="Validation failed",c){super(s,400),this.errors=c;}},a=class extends e{static{a$1(this,"UnauthorizedError");}constructor(s="Not authorized"){super(s,401);}},n=class extends e{static{a$1(this,"ForbiddenError");}constructor(s="Access forbidden"){super(s,403);}},p=class extends e{static{a$1(this,"ConflictError");}constructor(s="Resource conflict"){super(s,409);}},i=class extends e{static{a$1(this,"RequestAbortedError");}constructor(s="Request aborted by client"){super(s,499);}};export{e as a,o as b,u as c,a as d,n as e,p as f,i as g};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,46 +1,7 @@
|
|
|
1
|
+
import { P as Provider, T as Token, I as InjectableOptions, a as Type, F as ForwardRef, M as ModuleMetadata, D as DynamicModule, b as ModuleAsyncOptions, c as InjectionToken } from './types-D-An5cXP.js';
|
|
2
|
+
export { C as ClassProvider, E as ExistingProvider, d as FactoryProvider, e as ModuleOptionsFactory, S as Scope, V as ValueProvider } from './types-D-An5cXP.js';
|
|
1
3
|
import { ZodSchema } from 'zod';
|
|
2
4
|
|
|
3
|
-
declare enum Scope {
|
|
4
|
-
SINGLETON = "singleton",
|
|
5
|
-
REQUEST = "request",
|
|
6
|
-
TRANSIENT = "transient"
|
|
7
|
-
}
|
|
8
|
-
interface Type<T = unknown> extends Function {
|
|
9
|
-
new (...args: any[]): T;
|
|
10
|
-
}
|
|
11
|
-
interface InjectableOptions {
|
|
12
|
-
scope?: Scope;
|
|
13
|
-
}
|
|
14
|
-
interface ClassProvider<T = unknown> {
|
|
15
|
-
provide: Token<T>;
|
|
16
|
-
useClass: Type<T>;
|
|
17
|
-
scope?: Scope;
|
|
18
|
-
}
|
|
19
|
-
interface ValueProvider<T = unknown> {
|
|
20
|
-
provide: Token<T>;
|
|
21
|
-
useValue: T;
|
|
22
|
-
}
|
|
23
|
-
interface FactoryProvider<T = unknown> {
|
|
24
|
-
provide: Token<T>;
|
|
25
|
-
useFactory: (...args: any[]) => T | Promise<T>;
|
|
26
|
-
inject?: Token[];
|
|
27
|
-
scope?: Scope;
|
|
28
|
-
}
|
|
29
|
-
interface ExistingProvider<T = unknown> {
|
|
30
|
-
provide: Token<T>;
|
|
31
|
-
useExisting: Token<T>;
|
|
32
|
-
}
|
|
33
|
-
type Provider<T = unknown> = Type<T> | ClassProvider<T> | ValueProvider<T> | FactoryProvider<T> | ExistingProvider<T>;
|
|
34
|
-
type Token<T = unknown> = Type<T> | string | symbol | InjectionToken<T>;
|
|
35
|
-
declare class InjectionToken<T = unknown> {
|
|
36
|
-
readonly description: string;
|
|
37
|
-
constructor(description: string);
|
|
38
|
-
toString(): string;
|
|
39
|
-
}
|
|
40
|
-
interface ForwardRef<T = unknown> {
|
|
41
|
-
forwardRef: () => Type<T>;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
5
|
declare class Container {
|
|
45
6
|
private registrations;
|
|
46
7
|
private resolving;
|
|
@@ -78,52 +39,6 @@ declare function Optional(): ParameterDecorator;
|
|
|
78
39
|
declare function forwardRef<T>(fn: () => Type<T>): ForwardRef<T>;
|
|
79
40
|
declare function resolveForwardRef<T>(ref: Type<T> | ForwardRef<T>): Type<T>;
|
|
80
41
|
|
|
81
|
-
interface ModuleMetadata {
|
|
82
|
-
imports?: Array<Type | DynamicModule>;
|
|
83
|
-
controllers?: Type[];
|
|
84
|
-
providers?: Provider[];
|
|
85
|
-
exports?: Token[];
|
|
86
|
-
}
|
|
87
|
-
interface DynamicModule {
|
|
88
|
-
module: Type;
|
|
89
|
-
imports?: Array<Type | DynamicModule>;
|
|
90
|
-
controllers?: Type[];
|
|
91
|
-
providers?: Provider[];
|
|
92
|
-
exports?: Token[];
|
|
93
|
-
global?: boolean;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Factory class interface for `useClass` / `useExisting` async options.
|
|
97
|
-
* Implement this on a class to provide module options asynchronously.
|
|
98
|
-
*/
|
|
99
|
-
interface ModuleOptionsFactory<T> {
|
|
100
|
-
createModuleOptions(): T | Promise<T>;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Async options accepted by `forRootAsync()`.
|
|
104
|
-
*
|
|
105
|
-
* Exactly one of `useFactory`, `useClass`, or `useExisting` must be provided.
|
|
106
|
-
*/
|
|
107
|
-
type ModuleAsyncOptions<T> = {
|
|
108
|
-
imports?: Array<Type | DynamicModule>;
|
|
109
|
-
useFactory: (...args: any[]) => T | Promise<T>;
|
|
110
|
-
inject?: Token[];
|
|
111
|
-
useClass?: never;
|
|
112
|
-
useExisting?: never;
|
|
113
|
-
} | {
|
|
114
|
-
imports?: Array<Type | DynamicModule>;
|
|
115
|
-
useClass: Type<ModuleOptionsFactory<T>>;
|
|
116
|
-
useFactory?: never;
|
|
117
|
-
inject?: never;
|
|
118
|
-
useExisting?: never;
|
|
119
|
-
} | {
|
|
120
|
-
imports?: Array<Type | DynamicModule>;
|
|
121
|
-
useExisting: Type<ModuleOptionsFactory<T>>;
|
|
122
|
-
useFactory?: never;
|
|
123
|
-
inject?: never;
|
|
124
|
-
useClass?: never;
|
|
125
|
-
};
|
|
126
|
-
|
|
127
42
|
declare function Module(metadata: ModuleMetadata): ClassDecorator;
|
|
128
43
|
/**
|
|
129
44
|
* Marks a module as global so its exported providers are visible to all
|
|
@@ -609,6 +524,27 @@ declare class ZodParamPipe<T> implements ParamPipe {
|
|
|
609
524
|
*/
|
|
610
525
|
declare function DefaultValuePipe(defaultValue: unknown): ParamPipe;
|
|
611
526
|
|
|
527
|
+
/**
|
|
528
|
+
* Factory that creates a typed `@Body()` parameter decorator which
|
|
529
|
+
* validates the request body against a Zod schema.
|
|
530
|
+
*
|
|
531
|
+
* @example
|
|
532
|
+
* ```ts
|
|
533
|
+
* const createUserSchema = z.object({
|
|
534
|
+
* email: z.string().email(),
|
|
535
|
+
* name: z.string().min(1),
|
|
536
|
+
* })
|
|
537
|
+
*
|
|
538
|
+
* const CreateUserDTO = ZodValidatedBody(createUserSchema)
|
|
539
|
+
*
|
|
540
|
+
* @Post('/')
|
|
541
|
+
* async create(@CreateUserDTO() body) {
|
|
542
|
+
* // body is parsed & validated — z.infer<typeof createUserSchema>
|
|
543
|
+
* }
|
|
544
|
+
* ```
|
|
545
|
+
*/
|
|
546
|
+
declare function ZodValidatedBody<T extends ZodSchema>(schema: T): () => ParameterDecorator;
|
|
547
|
+
|
|
612
548
|
declare function UseFilters(...filters: FilterRef[]): ClassDecorator & MethodDecorator;
|
|
613
549
|
declare function Catch(...exceptions: Type<Error>[]): ClassDecorator;
|
|
614
550
|
|
|
@@ -992,6 +928,67 @@ declare function createParamDecorator<T = unknown>(extractor: (ctx: ExecutionCon
|
|
|
992
928
|
declare function getRouteParams(controllerClass: Function, methodName: string): RouteParamMetadata[] | null;
|
|
993
929
|
declare function resolveParamArgs(meta: RouteParamMetadata[], ctx: ExecutionContext): Promise<unknown[]>;
|
|
994
930
|
|
|
931
|
+
/** Sentinel brand for redirect detection by framework adapters. */
|
|
932
|
+
declare const REDIRECT_BRAND: "__redirect";
|
|
933
|
+
interface RedirectResult {
|
|
934
|
+
[REDIRECT_BRAND]: true;
|
|
935
|
+
url: string;
|
|
936
|
+
statusCode: number;
|
|
937
|
+
}
|
|
938
|
+
/**
|
|
939
|
+
* Return this from a controller method to trigger an HTTP redirect.
|
|
940
|
+
* The framework adapter (e.g. Nitro) detects the branded object and
|
|
941
|
+
* performs the actual redirect.
|
|
942
|
+
*
|
|
943
|
+
* @example
|
|
944
|
+
* ```ts
|
|
945
|
+
* @Get('/old-path')
|
|
946
|
+
* async legacy() {
|
|
947
|
+
* return redirect('/new-path')
|
|
948
|
+
* }
|
|
949
|
+
*
|
|
950
|
+
* @Get('/external')
|
|
951
|
+
* async external() {
|
|
952
|
+
* return redirect('https://example.com', 301)
|
|
953
|
+
* }
|
|
954
|
+
* ```
|
|
955
|
+
*/
|
|
956
|
+
declare function redirect(url: string, statusCode?: number): RedirectResult;
|
|
957
|
+
/** Type guard to check if a controller return value is a redirect. */
|
|
958
|
+
declare function isRedirect(value: unknown): value is RedirectResult;
|
|
959
|
+
|
|
960
|
+
/**
|
|
961
|
+
* Provides runtime access to registered providers and the DI container.
|
|
962
|
+
*
|
|
963
|
+
* Automatically registered by BackendApplication during init().
|
|
964
|
+
* Used by extension modules (e.g. ScheduleModule) that need to scan
|
|
965
|
+
* all providers for metadata.
|
|
966
|
+
*
|
|
967
|
+
* @example
|
|
968
|
+
* ```typescript
|
|
969
|
+
* @Injectable()
|
|
970
|
+
* @Inject(DiscoveryService)
|
|
971
|
+
* class MyExplorer {
|
|
972
|
+
* constructor(private readonly discovery: DiscoveryService) {}
|
|
973
|
+
*
|
|
974
|
+
* async onApplicationBootstrap() {
|
|
975
|
+
* for (const provider of this.discovery.getProviders()) {
|
|
976
|
+
* // scan for custom metadata
|
|
977
|
+
* }
|
|
978
|
+
* }
|
|
979
|
+
* }
|
|
980
|
+
* ```
|
|
981
|
+
*/
|
|
982
|
+
declare class DiscoveryService {
|
|
983
|
+
private container;
|
|
984
|
+
private providers;
|
|
985
|
+
/** @internal Called by BackendApplication during init. */
|
|
986
|
+
_init(container: Container, providers: Provider[]): void;
|
|
987
|
+
getProviders(): Provider[];
|
|
988
|
+
resolve<T>(token: Token<T>): Promise<T>;
|
|
989
|
+
getProviderClass(provider: Provider): Type | null;
|
|
990
|
+
}
|
|
991
|
+
|
|
995
992
|
interface ApplicationOptions {
|
|
996
993
|
rootModule: Type | DynamicModule;
|
|
997
994
|
globalGuards?: PipelineOptions['guards'];
|
|
@@ -1025,6 +1022,11 @@ declare class BackendApplication {
|
|
|
1025
1022
|
* classes placed in `providers: []` (backward compatibility).
|
|
1026
1023
|
*/
|
|
1027
1024
|
getControllers(): Type[];
|
|
1025
|
+
/**
|
|
1026
|
+
* Return all providers registered across all modules.
|
|
1027
|
+
* Used by extension packages (e.g. @truxie/schedule) to scan for metadata.
|
|
1028
|
+
*/
|
|
1029
|
+
getProviders(): Provider[];
|
|
1028
1030
|
getEventBus(): EventBus;
|
|
1029
1031
|
createHandler(options: Omit<CreatePipelineOptions, 'handler'> & {
|
|
1030
1032
|
handler: HandlerFn;
|
|
@@ -1034,4 +1036,4 @@ declare class BackendApplication {
|
|
|
1034
1036
|
private ensureInitialized;
|
|
1035
1037
|
}
|
|
1036
1038
|
|
|
1037
|
-
export { AppError, type ApplicationOptions, Auth, type AuthExtractorFn, BackendApplication, BaseExecutionContext, Body, Catch, type
|
|
1039
|
+
export { AppError, type ApplicationOptions, Auth, type AuthExtractorFn, BackendApplication, BaseExecutionContext, Body, Catch, type CompiledRoute, ConfigurableModuleBuilder, type ConfigurableModuleBuilderResult, type ConfigurableModuleClass, ConflictError, Container, Controller, ControllerRouter, Cookie, type CreatePipelineOptions, DefaultValuePipe, Delete, DiscoveryService, DomainEvent, DynamicModule, EventBus, type EventBusOptions, type EventHandler, type ExceptionFilter, type ExecutionContext, type ExtraOptions, type FeatureConfig, type FilterRef, ForbiddenError, FormData, type FormDataPart, ForwardRef, Get, Global, type GuardClass, type GuardInstance, type GuardRef, type HandlerFn, Headers, type HttpMethod, type ICanActivateGuard, type IUseCase, Inject, Injectable, InjectableOptions, type Interceptor, type InterceptorRef, Ip, type Middleware, type MiddlewareRef, Module, ModuleAsyncOptions, ModuleMetadata, ModuleRegistry, NoGuard, NotFoundError, type OnApplicationBootstrap, type OnApplicationShutdown, OnEvent, type OnModuleDestroy, type OnModuleInit, Optional, Param, type ParamPipe, type ParamPipeRef, ParseIdPipe, ParseIntPipe, Patch, type PipeRef, type PipeTransform, type PipelineOptions, Post, Provider, Put, Query, REDIRECT_BRAND, RawBody, type RedirectResult, RequestAbortedError, RouteGuards, type RouteMatch, type RouteMetadata, type RouteParamMetadata, type RouteParamType, Token, Type, UOW_INSTANCE_KEY, UOW_SESSION_KEY, UnauthorizedError, type UnitOfWork, type UnitOfWorkFactory, UnitOfWorkInterceptor, UseFilters, UseInterceptors, UseMiddleware, UsePipes, UserAgent, ValidationError, ZodParamPipe, ZodValidatedBody, ZodValidationPipe, createParamDecorator, createPipeline, defineAuth, forwardRef, getControllerGuards, getControllerPath, getEffectiveInterceptors, getEffectiveMiddlewares, getInterceptorsMetadata, getMethodGuards, getMethodInterceptors, getMethodMiddlewares, getMiddlewaresMetadata, getModuleMetadata, getRouteMetadata, getRouteParams, isGlobalModule, isRedirect, redirect, resolveForwardRef, resolveParamArgs };
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {a,g,b as b$1,h as h$1,i,j as j$1,c,m,d,o,q as q$1}from'./chunk-M2ZPR3DR.js';export{k as AppError,p as ConflictError,o as ForbiddenError,e as Inject,d as Injectable,l as NotFoundError,f as Optional,q as RequestAbortedError,b as Scope,n as UnauthorizedError,m as ValidationError}from'./chunk-M2ZPR3DR.js';import'reflect-metadata';function Ce(o){return {forwardRef:o}}a(Ce,"forwardRef");function _(o){return typeof o=="object"&&"forwardRef"in o?o.forwardRef():o}a(_,"resolveForwardRef");var E=class o{static{a(this,"Container");}registrations=new Map;resolving=new Set;parent=null;children=[];register(...e){for(let t of e)this.registerOne(t);}registerOne(e){if(typeof e=="function"){let s=g(e)?.scope??b$1.SINGLETON;this.registrations.set(e,{provider:e,scope:s});return}let t=e.provide,r=b$1.SINGLETON;if("useClass"in e){let n=g(e.useClass);r=e.scope??n?.scope??b$1.SINGLETON;}else "useFactory"in e&&(r=e.scope??b$1.SINGLETON);this.registrations.set(t,{provider:e,scope:r});}async resolve(e){let t=_(e),r=t!==e?t:e,n=this.registrations.get(r)??this.parent?.findRegistration(r);if(!n)throw new Error(`No provider found for ${X(r)}`);if(n.scope===b$1.SINGLETON&&n.instance!==void 0||n.scope===b$1.REQUEST&&this.parent!==null&&n.instance!==void 0)return n.instance;if(this.resolving.has(r))throw new Error(`Circular dependency detected for ${X(r)}`);this.resolving.add(r);try{let s=await this.createInstance(n);return (n.scope===b$1.SINGLETON||n.scope===b$1.REQUEST&&this.parent!==null)&&(n.instance=s),s}finally{this.resolving.delete(r);}}has(e){return this.registrations.has(e)||(this.parent?.has(e)??false)}findRegistration(e){return this.registrations.get(e)??this.parent?.findRegistration(e)}createChild(){let e=new o;e.parent=this;for(let[t,r]of this.registrations)r.scope===b$1.REQUEST&&e.registrations.set(t,{provider:r.provider,scope:b$1.REQUEST,instance:void 0});return this.children.push(e),e}async dispose(){for(let e of this.children)await e.dispose();this.children=[];for(let[,e]of this.registrations)if(e.instance&&typeof e.instance=="object"&&e.instance!==null){let t=e.instance;typeof t.onModuleDestroy=="function"&&await t.onModuleDestroy();}this.registrations.clear(),this.resolving.clear();}async createInstance(e){let{provider:t}=e;if(typeof t=="function")return this.instantiateClass(t);if("useValue"in t)return t.useValue;if("useClass"in t)return this.instantiateClass(t.useClass);if("useFactory"in t){let r=t,n=[];if(r.inject)for(let s of r.inject)n.push(await this.resolve(s));return r.useFactory(...n)}if("useExisting"in t)return this.resolve(t.useExisting);throw new Error("Unknown provider type")}async instantiateClass(e){let t=Reflect.getMetadata("design:paramtypes",e)??[],r=h$1(e),n=i(e),s=j$1(e),a=n.size>0?Math.max(...n.keys())+1:0,c=Math.max(t.length,a,r.length),f=[];for(let d=0;d<c;d++){let u=n.get(d)??r[d]??t[d],l=s.has(d);try{f.push(await this.resolve(u));}catch{if(l)f.push(void 0);else throw new Error(`Cannot resolve parameter at index ${d} (${X(u)}) of ${e.name}`)}}return new e(...f)}};function X(o){return typeof o=="string"?o:typeof o=="symbol"||o instanceof c?o.toString():typeof o=="function"?o.name:String(o)}a(X,"tokenToString");var Se=Symbol("module"),Ie=Symbol("module:global");function Ne(o){return e=>{Reflect.defineMetadata(Se,o,e);}}a(Ne,"Module");function De(){return o=>{Reflect.defineMetadata(Ie,true,o);}}a(De,"Global");function k(o){return Reflect.getOwnMetadata(Se,o)}a(k,"getModuleMetadata");function T(o){return Reflect.getOwnMetadata(Ie,o)===true}a(T,"isGlobalModule");var Oe=Symbol("controller:path"),ee=Symbol("controller:guards"),te=Symbol("route:metadata"),re=Symbol("method:route"),C=Symbol("method:guards"),oe=Symbol("method:noguard");function Fe(o){return e=>{Reflect.defineMetadata(Oe,o,e);}}a(Fe,"Controller");function S(o){return (e="")=>(t,r,n)=>{let s=n!==void 0,a=String(s?r:r?.name??r),c=s?n?.value:t;if(typeof c=="function"&&(c[re]={method:o,path:e,methodName:a}),s){let f=Reflect.getOwnMetadata(te,t.constructor)??[];return f.push({method:o,path:e,methodName:a}),Reflect.defineMetadata(te,f,t.constructor),n}return t}}a(S,"createMethodDecorator");var _e=S("GET"),ke=S("POST"),Ge=S("PUT"),Ue=S("DELETE"),$e=S("PATCH");function Be(...o){return (e,t,r)=>{if(t==null){Reflect.defineMetadata(ee,o,e);return}if(r!==void 0){if(r?.value){let n=r.value[C]??[];r.value[C]=[...n,...o];}return r}if(typeof e=="function"){let n=e[C]??[];e[C]=[...n,...o];}return typeof e=="function"&&t?.kind==="class"&&Reflect.defineMetadata(ee,o,e),e}}a(Be,"RouteGuards");function je(){return (o,e,t)=>t!==void 0?(t?.value&&(t.value[oe]=true),t):(typeof o=="function"&&(o[oe]=true),o)}a(je,"NoGuard");function x(o){return Reflect.getOwnMetadata(Oe,o)}a(x,"getControllerPath");function ne(o){return Reflect.getOwnMetadata(ee,o)??[]}a(ne,"getControllerGuards");function G(o){let e=[],t=o.prototype;if(t){let r=Object.getOwnPropertyNames(t);for(let n of r){if(n==="constructor")continue;let s=t[n];typeof s=="function"&&s[re]&&e.push(s[re]);}}return e.length>0?e:Reflect.getOwnMetadata(te,o)??[]}a(G,"getRouteMetadata");function U(o,e){let r=o.prototype?.[e],n=typeof r=="function"&&r[oe]===true,s=typeof r=="function"&&r[C]||[];return n?s:[...ne(o),...s]}a(U,"getMethodGuards");var b=class{static{a(this,"ModuleRegistry");}resolved=new Map;sortedModules=[];scan(e){this.resolveModule(e),this.sortedModules=this.topologicalSort(),this.validateExports();}registerAll(e){let t=new Set;for(let r of this.sortedModules)if(r.global)for(let n of r.providers)t.add(n);t.size>0&&e.register(...t);for(let r of this.sortedModules){e.register(...r.providers);for(let n of r.metadata.imports??[]){let s=this.getModuleType(n),a=this.resolved.get(s);if(a)for(let c of a.exports){let f=this.findProvider(a,c)??this.findReExportedProvider(a,c);f&&e.register(f);}}}}getAllProviders(){let e=[];for(let t of this.sortedModules)e.push(...t.providers);return e}getAllControllers(){let e=new Set,t=[];for(let r of this.sortedModules){for(let n of r.controllers)e.has(n)||(e.add(n),t.push(n));for(let n of r.metadata.providers??[])typeof n=="function"&&x(n)!==void 0&&!e.has(n)&&(e.add(n),t.push(n));}return t}async callLifecycleHooks(e,t,r){for(let n of this.sortedModules)for(let s of n.providers){let a=typeof s=="function"?s:s.provide;if(e.has(a))try{let c=await e.resolve(a);c&&typeof c=="object"&&typeof c[t]=="function"&&await c[t](r);}catch{}}}resolveModule(e){let t=typeof e=="object"&&"module"in e,r=t?e.module:e;if(this.resolved.has(r))return this.resolved.get(r);let n=k(r)??{},s=t?e:{},a=[...n.controllers??[],...s.controllers??[]],c={imports:[...n.imports??[],...s.imports??[]],controllers:a,providers:[...n.providers??[],...s.providers??[]],exports:[...n.exports??[],...s.exports??[]]},f={type:r,metadata:c,controllers:a,providers:[...a,...c.providers??[]],exports:new Set(c.exports??[]),global:t?e.global??T(r):T(r)};this.resolved.set(r,f);for(let d of c.imports??[])this.resolveModule(d);return f}getVisibleTokens(e){let t=new Set;for(let r of e.providers)t.add(this.getProviderToken(r));for(let r of e.metadata.imports??[]){let n=this.getModuleType(r),s=this.resolved.get(n);if(s)for(let a of s.exports)t.add(a);}for(let r of this.sortedModules)if(r.global)for(let n of r.providers)t.add(this.getProviderToken(n));return t}validateExports(){for(let e of this.sortedModules){let t=new Set(e.providers.map(n=>this.getProviderToken(n))),r=this.collectImportedExports(e);for(let n of e.exports)if(!t.has(n)&&!r.has(n)){let s=typeof n=="function"?n.name:String(n);throw new Error(`${e.type.name} exports ${s} but it is not in its providers and is not re-exported from an imported module`)}}}validateVisibility(){for(let e of this.sortedModules){let t=this.getVisibleTokens(e);for(let r of e.providers){if(typeof r!="function")continue;let n=h$1(r);for(let s of n)if(!t.has(s)){let a=typeof s=="function"?s.name:String(s);throw new Error(`${e.type.name}: ${r.name} depends on ${a}, but it is not provided in this module and not exported by any imported module`)}}}}getProviderToken(e){return typeof e=="function"?e:e.provide}collectImportedExports(e){let t=new Set;for(let r of e.metadata.imports??[]){let n=this.getModuleType(r),s=this.resolved.get(n);if(s)for(let a of s.exports)t.add(a);}return t}findProvider(e,t){return e.providers.find(r=>typeof r=="function"?r===t:r.provide===t)}findReExportedProvider(e,t){for(let r of e.metadata.imports??[]){let n=this.getModuleType(r),s=this.resolved.get(n);if(!s||!s.exports.has(t))continue;let a=this.findProvider(s,t);if(a)return a;let c=this.findReExportedProvider(s,t);if(c)return c}}getModuleType(e){return typeof e=="object"&&"module"in e?e.module:e}topologicalSort(){let e=new Set,t=new Set,r=[],n=a(s=>{if(e.has(s))return;if(t.has(s))throw new Error(`Circular module dependency detected: ${s.name}`);t.add(s);let a=this.resolved.get(s);if(a){for(let c of a.metadata.imports??[])n(this.getModuleType(c));t.delete(s),e.add(s),r.push(a);}},"visit");for(let[s]of this.resolved)n(s);return r}};function ht(o,e){if("useFactory"in e&&e.useFactory){let t=e.useFactory;return [{provide:o,useFactory:t,inject:e.inject??[]}]}if("useClass"in e&&e.useClass){let t=e.useClass;return [{provide:o,useFactory:a(async r=>r.createModuleOptions(),"useFactory"),inject:[t]},t]}if("useExisting"in e&&e.useExisting){let t=e.useExisting;return [{provide:o,useFactory:a(async r=>r.createModuleOptions(),"useFactory"),inject:[t]}]}throw new Error("ModuleAsyncOptions must specify one of: useFactory, useClass, or useExisting")}a(ht,"createAsyncProviders");var $=class{static{a(this,"ConfigurableModuleBuilder");}description;featureDescription;onForRoot;onForFeature;constructor(e="MODULE_OPTIONS"){this.description=e,this.featureDescription=e+"_FEATURE";}setTokenDescription(e){return this.description=e,this}transformDynamicModule(e){return this.onForRoot=e,this}transformFeatureModule(e){return this.onForFeature=e,this}build(){let e=new c(this.description),t=new c(this.featureDescription),r=this.onForRoot,n=this.onForFeature;return {ConfigurableModuleClass:class{static{a(this,"ConfigurableModuleClassImpl");}static forRoot(c,f={}){let d={module:this,global:f.global??false,providers:[{provide:e,useValue:c}],exports:[e]};return r&&(d=r(d,c)),d}static forRootAsync(c){let f=ht(e,c);return {module:this,imports:c.imports??[],providers:f,exports:[e]}}static forFeature(c,f={}){let d={module:this,global:f.global??false,providers:[{provide:t,useValue:c}],exports:[t]};return n&&(d=n(d,c)),d}},MODULE_OPTIONS_TOKEN:e,MODULE_FEATURE_TOKEN:t}}};var B=class{static{a(this,"BaseExecutionContext");}nativeRequest;handler;container;query;params;body;rawBody;formData;auth;data=new Map;metadata=new Map;abortController;constructor(e,t,r,n={},s={},a){this.nativeRequest=e,this.handler=t,this.container=r,this.query=n,this.params=s,this.abortController=a??new AbortController;}getNativeRequest(){return this.nativeRequest}getHandler(){return this.handler}getBody(){return this.body}setBody(e){this.body=e;}getRawBody(){return this.rawBody}setRawBody(e){this.rawBody=e;}getFormData(){return this.formData}setFormData(e){this.formData=e;}getQuery(){return this.query}getParams(){return this.params}getAuth(){return this.auth}setAuth(e){this.auth=e;}getMetadata(e){return this.metadata.get(e)}setMetadata(e,t){this.metadata.set(e,t);}getData(e){return this.data.get(e)}setData(e,t){this.data.set(e,t);}getContainer(){return this.container}getSignal(){return this.abortController.signal}abort(e){this.abortController.abort(e);}};var Le=Symbol("filters"),He=Symbol("catch");function qe(...o){return (e,t,r)=>{let n=t?e.constructor:e,s=Reflect.getOwnMetadata(Le,n)??[];Reflect.defineMetadata(Le,[...s,...o],n);}}a(qe,"UseFilters");function Ve(...o){return e=>{Reflect.defineMetadata(He,o,e);}}a(Ve,"Catch");function se(o){return Reflect.getOwnMetadata(He,o)??[]}a(se,"getCatchMetadata");function j(o$1,e,t){return async r=>{let n=[...e.middlewares??[],...t.middlewares??[]],s=[...e.guards??[],...t.guards??[]],a$1=[...e.interceptors??[],...t.interceptors??[]],c=[...e.pipes??[],...t.pipes??[]],f=[...e.filters??[],...t.filters??[]],d=await I(o$1,f);try{w(r);let u=await I(o$1,n);return await mt(r,u,async()=>{w(r);let l=await I(o$1,s);for(let R of l)if(w(r),!await R.canActivate(r))throw new o("Access denied by guard");w(r);let M=await I(o$1,c);for(let R of M)w(r),await R.transform(r);w(r);let g=await I(o$1,a$1),we=a(async()=>(w(r),t.handler(r)),"handlerCall");return g.length===0?we():g.reduceRight((R,Me)=>async()=>(w(r),Me.intercept(r,R)),we)()})}catch(u){return gt(u,r,d)}}}a(j,"createPipeline");async function mt(o,e,t){return e.length===0?t():e.reduceRight((n,s)=>()=>s.use(o,n),t)()}a(mt,"runMiddlewareChain");function w(o){if(o.getSignal().aborted)throw new q$1}a(w,"checkAborted");async function gt(o,e,t){for(let r of t){let n=se(r.constructor);if(n.length===0||o instanceof Error&&n.some(a=>o instanceof a))return r.catch(o,e)}throw o}a(gt,"handleError");async function I(o,e){let t=[];for(let r of e)typeof r=="function"?t.push(await o.resolve(r)):t.push(r);return t}a(I,"resolveRefs");var ie=Symbol("interceptors"),ae=Symbol("method:interceptors");function ze(...o){return (e,t,r)=>{if(t!==void 0){let s=r?.value??e,a=s[ae]??[];return s[ae]=[...a,...o],r}let n=Reflect.getOwnMetadata(ie,e)??[];Reflect.defineMetadata(ie,[...n,...o],e);}}a(ze,"UseInterceptors");function ce(o){return Reflect.getOwnMetadata(ie,o)??[]}a(ce,"getInterceptorsMetadata");function de(o,e){let r=o.prototype?.[e];return typeof r=="function"&&r[ae]||[]}a(de,"getMethodInterceptors");function L(o,e){return [...ce(o),...de(o,e)]}a(L,"getEffectiveInterceptors");var fe="uow:session",ue="uow:instance",H=class{static{a(this,"UnitOfWorkInterceptor");}factory;constructor(e){this.factory=e;}async intercept(e,t){let r=this.factory();await r.start(),e.setData(fe,r.getContext()),e.setData(ue,r);try{let n=await t();return await r.commit(),n}catch(n){throw await r.rollback(),n}}};var le=Symbol("middlewares"),pe=Symbol("method:middlewares");function We(...o){return (e,t,r)=>{if(t!==void 0){let s=r?.value??e,a=s[pe]??[];return s[pe]=[...a,...o],r}let n=Reflect.getOwnMetadata(le,e)??[];Reflect.defineMetadata(le,[...n,...o],e);}}a(We,"UseMiddleware");function he(o){return Reflect.getOwnMetadata(le,o)??[]}a(he,"getMiddlewaresMetadata");function me(o,e){let r=o.prototype?.[e];return typeof r=="function"&&r[pe]||[]}a(me,"getMethodMiddlewares");function q(o,e){return [...he(o),...me(o,e)]}a(q,"getEffectiveMiddlewares");var Qe=Symbol("pipes");function Ye(...o){return (e,t,r)=>{let n=t?e.constructor:e,s=Reflect.getOwnMetadata(Qe,n)??[];Reflect.defineMetadata(Qe,[...s,...o],n);}}a(Ye,"UsePipes");var V=class{static{a(this,"ZodValidationPipe");}schema;constructor(e){this.schema=e;}transform(e){let t=e.getBody(),r=this.schema.safeParse(t);if(!r.success){let n={};for(let s of r.error.issues){let a=s.path.join(".")||"_root";n[a]||(n[a]=[]),n[a].push(s.message);}throw new m("Validation failed",n)}e.setBody(r.data);}};var yt=/^[0-9a-fA-F]{24}$/,z=class{static{a(this,"ParseIdPipe");}paramName;constructor(e="id"){this.paramName=e;}transform(e){let r=e.getParams()[this.paramName];if(!r||!yt.test(r))throw new m(`Invalid ${this.paramName}: must be a valid ObjectId`)}};var W=class{static{a(this,"ParseIntPipe");}transform(e){let t=Number(e);if(!Number.isInteger(t)||e===""||e===null||e===void 0)throw new m(`Expected an integer, received: ${JSON.stringify(e)}`);return t}};var Q=class{static{a(this,"ZodParamPipe");}schema;constructor(e){this.schema=e;}transform(e){let t=this.schema.safeParse(e);if(!t.success){let r=t.error.errors.map(n=>`${n.path.join(".")}: ${n.message}`).join(", ");throw new m(r)}return t.data}};function Ze(o){return {transform(e){return e??o}}}a(Ze,"DefaultValuePipe");var Y=class{static{a(this,"DomainEvent");}payload;timestamp;constructor(e){this.payload=e,this.timestamp=Date.now();}};function wt(o,e,t,r){var n=arguments.length,s=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,r);else for(var c=o.length-1;c>=0;c--)(a=o[c])&&(s=(n<3?a(s):n>3?a(e,t,s):a(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s}a(wt,"_ts_decorate");function Je(o,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,e)}a(Je,"_ts_metadata");var h=class{static{a(this,"EventBus");}handlers=new Map;onError;constructor(){this.onError=Mt;}setOptions(e){e.onError&&(this.onError=e.onError);}subscribe(e,t,r){let n=this.handlers.get(e)??[];n.push({instance:r?.instance??{},methodName:r?.methodName??"anonymous",handler:t}),this.handlers.set(e,n);}registerHandler(e,t,r){let n=t[r].bind(t);this.subscribe(e,n,{instance:t,methodName:r});}async emit(e){let t=this.handlers.get(e.type);if(!t||t.length===0)return;let r=await Promise.allSettled(t.map(n=>n.handler(e)));for(let n=0;n<r.length;n++){let s=r[n];if(s.status==="rejected"){let a=t[n],c=`${a.instance.constructor?.name??"Unknown"}.${a.methodName}`;this.onError(s.reason,e.type,c);}}}emitAsync(e){this.emit(e).catch(()=>{});}hasHandlers(e){let t=this.handlers.get(e);return t!==void 0&&t.length>0}handlerCount(e){return this.handlers.get(e)?.length??0}clear(){this.handlers.clear();}};h=wt([d(),Je("design:type",Function),Je("design:paramtypes",[])],h);function Mt(o,e,t){console.error(`[EventBus] Handler "${t}" failed for event "${e}":`,o);}a(Mt,"defaultErrorHandler");var ge=Symbol("on-event");function Ke(o){return (e,t,r)=>{let n=Reflect.getOwnMetadata(ge,e.constructor)??[];n.push({eventType:o,methodName:String(t)}),Reflect.defineMetadata(ge,n,e.constructor);}}a(Ke,"OnEvent");function Xe(o){return Reflect.getOwnMetadata(ge,o)??[]}a(Xe,"getOnEventMetadata");var Z=class{static{a(this,"ControllerRouter");}routes=[];globalPrefix;constructor(e=""){this.globalPrefix=e;}register(...e){for(let t of e){let r=x(t)??"",n=G(t);for(let s of n){let a=vt(`${this.globalPrefix}/${r}/${s.path}`);bt(a,t.name,s.methodName),this.checkDuplicate(a,s.method,t.name,s.methodName);let{pattern:c,paramNames:f}=Et(a),d=U(t,s.methodName),u=L(t,s.methodName),l=q(t,s.methodName);this.routes.push({method:s.method,pattern:c,paramNames:f,controllerClass:t,methodName:s.methodName,guardClasses:d,interceptorRefs:u,middlewareRefs:l,rawPath:a});}}}checkDuplicate(e,t,r,n){let s=this.routes.find(a=>a.method===t&&a.rawPath===e);if(s)throw new Error(`Duplicate route: ${t} ${e}
|
|
1
|
+
import {c as c$2,e as e$1,g as g$1}from'./chunk-XVPJFMLQ.js';export{a as AppError,f as ConflictError,e as ForbiddenError,b as NotFoundError,g as RequestAbortedError,d as UnauthorizedError,c as ValidationError}from'./chunk-XVPJFMLQ.js';import {c as c$1,d,e}from'./chunk-F5KXBDV2.js';export{e as DiscoveryService,b as Global,a as Module,c as getModuleMetadata,d as isGlobalModule}from'./chunk-F5KXBDV2.js';import {a,g,b,h,i,j as j$1,c,d as d$1}from'./chunk-RMR6UXWO.js';export{e as Inject,d as Injectable,f as Optional,b as Scope}from'./chunk-RMR6UXWO.js';import'reflect-metadata';function De(o){return {forwardRef:o}}a(De,"forwardRef");function k(o){return typeof o=="object"&&"forwardRef"in o?o.forwardRef():o}a(k,"resolveForwardRef");var x=class o{static{a(this,"Container");}registrations=new Map;resolving=new Set;parent=null;children=[];register(...e){for(let t of e)this.registerOne(t);}registerOne(e){if(typeof e=="function"){let s=g(e)?.scope??b.SINGLETON;this.registrations.set(e,{provider:e,scope:s});return}let t=e.provide,r=b.SINGLETON;if("useClass"in e){let n=g(e.useClass);r=e.scope??n?.scope??b.SINGLETON;}else "useFactory"in e&&(r=e.scope??b.SINGLETON);this.registrations.set(t,{provider:e,scope:r});}async resolve(e){let t=k(e),r=t!==e?t:e,n=this.registrations.get(r)??this.parent?.findRegistration(r);if(!n)throw new Error(`No provider found for ${te(r)}`);if(n.scope===b.SINGLETON&&n.instance!==void 0||n.scope===b.REQUEST&&this.parent!==null&&n.instance!==void 0)return n.instance;if(this.resolving.has(r))throw new Error(`Circular dependency detected for ${te(r)}`);this.resolving.add(r);try{let s=await this.createInstance(n);return (n.scope===b.SINGLETON||n.scope===b.REQUEST&&this.parent!==null)&&(n.instance=s),s}finally{this.resolving.delete(r);}}has(e){return this.registrations.has(e)||(this.parent?.has(e)??false)}findRegistration(e){return this.registrations.get(e)??this.parent?.findRegistration(e)}createChild(){let e=new o;e.parent=this;for(let[t,r]of this.registrations)r.scope===b.REQUEST&&e.registrations.set(t,{provider:r.provider,scope:b.REQUEST,instance:void 0});return this.children.push(e),e}async dispose(){for(let e of this.children)await e.dispose();this.children=[];for(let[,e]of this.registrations)if(e.instance&&typeof e.instance=="object"&&e.instance!==null){let t=e.instance;typeof t.onModuleDestroy=="function"&&await t.onModuleDestroy();}this.registrations.clear(),this.resolving.clear();}async createInstance(e){let{provider:t}=e;if(typeof t=="function")return this.instantiateClass(t);if("useValue"in t)return t.useValue;if("useClass"in t)return this.instantiateClass(t.useClass);if("useFactory"in t){let r=t,n=[];if(r.inject)for(let s of r.inject)n.push(await this.resolve(s));return r.useFactory(...n)}if("useExisting"in t)return this.resolve(t.useExisting);throw new Error("Unknown provider type")}async instantiateClass(e){let t=Reflect.getMetadata("design:paramtypes",e)??[],r=h(e),n=i(e),s=j$1(e),a=n.size>0?Math.max(...n.keys())+1:0,c=Math.max(t.length,a,r.length),f=[];for(let d=0;d<c;d++){let u=n.get(d)??r[d]??t[d],l=s.has(d);try{f.push(await this.resolve(u));}catch{if(l)f.push(void 0);else throw new Error(`Cannot resolve parameter at index ${d} (${te(u)}) of ${e.name}`)}}return new e(...f)}};function te(o){return typeof o=="string"?o:typeof o=="symbol"||o instanceof c?o.toString():typeof o=="function"?o.name:String(o)}a(te,"tokenToString");var _e=Symbol("controller:path"),re=Symbol("controller:guards"),oe=Symbol("route:metadata"),ne=Symbol("method:route"),S=Symbol("method:guards"),se=Symbol("method:noguard");function Fe(o){return e=>{Reflect.defineMetadata(_e,o,e);}}a(Fe,"Controller");function I(o){return (e="")=>(t,r,n)=>{let s=n!==void 0,a=String(s?r:r?.name??r),c=s?n?.value:t;if(typeof c=="function"&&(c[ne]={method:o,path:e,methodName:a}),s){let f=Reflect.getOwnMetadata(oe,t.constructor)??[];return f.push({method:o,path:e,methodName:a}),Reflect.defineMetadata(oe,f,t.constructor),n}return t}}a(I,"createMethodDecorator");var Oe=I("GET"),Be=I("POST"),ke=I("PUT"),Ue=I("DELETE"),$e=I("PATCH");function Ge(...o){return (e,t,r)=>{if(t==null){Reflect.defineMetadata(re,o,e);return}if(r!==void 0){if(r?.value){let n=r.value[S]??[];r.value[S]=[...n,...o];}return r}if(typeof e=="function"){let n=e[S]??[];e[S]=[...n,...o];}return typeof e=="function"&&t?.kind==="class"&&Reflect.defineMetadata(re,o,e),e}}a(Ge,"RouteGuards");function je(){return (o,e,t)=>t!==void 0?(t?.value&&(t.value[se]=true),t):(typeof o=="function"&&(o[se]=true),o)}a(je,"NoGuard");function M(o){return Reflect.getOwnMetadata(_e,o)}a(M,"getControllerPath");function ie(o){return Reflect.getOwnMetadata(re,o)??[]}a(ie,"getControllerGuards");function U(o){let e=[],t=o.prototype;if(t){let r=Object.getOwnPropertyNames(t);for(let n of r){if(n==="constructor")continue;let s=t[n];typeof s=="function"&&s[ne]&&e.push(s[ne]);}}return e.length>0?e:Reflect.getOwnMetadata(oe,o)??[]}a(U,"getRouteMetadata");function $(o,e){let r=o.prototype?.[e],n=typeof r=="function"&&r[se]===true,s=typeof r=="function"&&r[S]||[];return n?s:[...ie(o),...s]}a($,"getMethodGuards");var R=class{static{a(this,"ModuleRegistry");}resolved=new Map;sortedModules=[];scan(e){this.resolveModule(e),this.sortedModules=this.topologicalSort(),this.validateExports();}registerAll(e){let t=new Set;for(let r of this.sortedModules)if(r.global)for(let n of r.providers)t.add(n);t.size>0&&e.register(...t);for(let r of this.sortedModules){e.register(...r.providers);for(let n of r.metadata.imports??[]){let s=this.getModuleType(n),a=this.resolved.get(s);if(a)for(let c of a.exports){let f=this.findProvider(a,c)??this.findReExportedProvider(a,c);f&&e.register(f);}}}}getAllProviders(){let e=[];for(let t of this.sortedModules)e.push(...t.providers);return e}getAllControllers(){let e=new Set,t=[];for(let r of this.sortedModules){for(let n of r.controllers)e.has(n)||(e.add(n),t.push(n));for(let n of r.metadata.providers??[])typeof n=="function"&&M(n)!==void 0&&!e.has(n)&&(e.add(n),t.push(n));}return t}async callLifecycleHooks(e,t,r){for(let n of this.sortedModules)for(let s of n.providers){let a=typeof s=="function"?s:s.provide;if(e.has(a))try{let c=await e.resolve(a);c&&typeof c=="object"&&typeof c[t]=="function"&&await c[t](r);}catch{}}}resolveModule(e){let t=typeof e=="object"&&"module"in e,r=t?e.module:e;if(this.resolved.has(r))return this.resolved.get(r);let n=c$1(r)??{},s=t?e:{},a=[...n.controllers??[],...s.controllers??[]],c={imports:[...n.imports??[],...s.imports??[]],controllers:a,providers:[...n.providers??[],...s.providers??[]],exports:[...n.exports??[],...s.exports??[]]},f={type:r,metadata:c,controllers:a,providers:[...a,...c.providers??[]],exports:new Set(c.exports??[]),global:t?e.global??d(r):d(r)};this.resolved.set(r,f);for(let d of c.imports??[])this.resolveModule(d);return f}getVisibleTokens(e){let t=new Set;for(let r of e.providers)t.add(this.getProviderToken(r));for(let r of e.metadata.imports??[]){let n=this.getModuleType(r),s=this.resolved.get(n);if(s)for(let a of s.exports)t.add(a);}for(let r of this.sortedModules)if(r.global)for(let n of r.providers)t.add(this.getProviderToken(n));return t}validateExports(){for(let e of this.sortedModules){let t=new Set(e.providers.map(n=>this.getProviderToken(n))),r=this.collectImportedExports(e);for(let n of e.exports)if(!t.has(n)&&!r.has(n)){let s=typeof n=="function"?n.name:String(n);throw new Error(`${e.type.name} exports ${s} but it is not in its providers and is not re-exported from an imported module`)}}}validateVisibility(){for(let e of this.sortedModules){let t=this.getVisibleTokens(e);for(let r of e.providers){if(typeof r!="function")continue;let n=h(r);for(let s of n)if(!t.has(s)){let a=typeof s=="function"?s.name:String(s);throw new Error(`${e.type.name}: ${r.name} depends on ${a}, but it is not provided in this module and not exported by any imported module`)}}}}getProviderToken(e){return typeof e=="function"?e:e.provide}collectImportedExports(e){let t=new Set;for(let r of e.metadata.imports??[]){let n=this.getModuleType(r),s=this.resolved.get(n);if(s)for(let a of s.exports)t.add(a);}return t}findProvider(e,t){return e.providers.find(r=>typeof r=="function"?r===t:r.provide===t)}findReExportedProvider(e,t){for(let r of e.metadata.imports??[]){let n=this.getModuleType(r),s=this.resolved.get(n);if(!s||!s.exports.has(t))continue;let a=this.findProvider(s,t);if(a)return a;let c=this.findReExportedProvider(s,t);if(c)return c}}getModuleType(e){return typeof e=="object"&&"module"in e?e.module:e}topologicalSort(){let e=new Set,t=new Set,r=[],n=a(s=>{if(e.has(s))return;if(t.has(s))throw new Error(`Circular module dependency detected: ${s.name}`);t.add(s);let a=this.resolved.get(s);if(a){for(let c of a.metadata.imports??[])n(this.getModuleType(c));t.delete(s),e.add(s),r.push(a);}},"visit");for(let[s]of this.resolved)n(s);return r}};function wt(o,e){if("useFactory"in e&&e.useFactory){let t=e.useFactory;return [{provide:o,useFactory:t,inject:e.inject??[]}]}if("useClass"in e&&e.useClass){let t=e.useClass;return [{provide:o,useFactory:a(async r=>r.createModuleOptions(),"useFactory"),inject:[t]},t]}if("useExisting"in e&&e.useExisting){let t=e.useExisting;return [{provide:o,useFactory:a(async r=>r.createModuleOptions(),"useFactory"),inject:[t]}]}throw new Error("ModuleAsyncOptions must specify one of: useFactory, useClass, or useExisting")}a(wt,"createAsyncProviders");var G=class{static{a(this,"ConfigurableModuleBuilder");}description;featureDescription;onForRoot;onForFeature;constructor(e="MODULE_OPTIONS"){this.description=e,this.featureDescription=e+"_FEATURE";}setTokenDescription(e){return this.description=e,this}transformDynamicModule(e){return this.onForRoot=e,this}transformFeatureModule(e){return this.onForFeature=e,this}build(){let e=new c(this.description),t=new c(this.featureDescription),r=this.onForRoot,n=this.onForFeature;return {ConfigurableModuleClass:class{static{a(this,"ConfigurableModuleClassImpl");}static forRoot(c,f={}){let d={module:this,global:f.global??false,providers:[{provide:e,useValue:c}],exports:[e]};return r&&(d=r(d,c)),d}static forRootAsync(c){let f=wt(e,c);return {module:this,imports:c.imports??[],providers:f,exports:[e]}}static forFeature(c,f={}){let d={module:this,global:f.global??false,providers:[{provide:t,useValue:c}],exports:[t]};return n&&(d=n(d,c)),d}},MODULE_OPTIONS_TOKEN:e,MODULE_FEATURE_TOKEN:t}}};var j=class{static{a(this,"BaseExecutionContext");}nativeRequest;handler;container;query;params;body;rawBody;formData;auth;data=new Map;metadata=new Map;abortController;constructor(e,t,r,n={},s={},a){this.nativeRequest=e,this.handler=t,this.container=r,this.query=n,this.params=s,this.abortController=a??new AbortController;}getNativeRequest(){return this.nativeRequest}getHandler(){return this.handler}getBody(){return this.body}setBody(e){this.body=e;}getRawBody(){return this.rawBody}setRawBody(e){this.rawBody=e;}getFormData(){return this.formData}setFormData(e){this.formData=e;}getQuery(){return this.query}getParams(){return this.params}getAuth(){return this.auth}setAuth(e){this.auth=e;}getMetadata(e){return this.metadata.get(e)}setMetadata(e,t){this.metadata.set(e,t);}getData(e){return this.data.get(e)}setData(e,t){this.data.set(e,t);}getContainer(){return this.container}getSignal(){return this.abortController.signal}abort(e){this.abortController.abort(e);}};var He=Symbol("filters"),Ve=Symbol("catch");function Le(...o){return (e,t,r)=>{let n=t?e.constructor:e,s=Reflect.getOwnMetadata(He,n)??[];Reflect.defineMetadata(He,[...s,...o],n);}}a(Le,"UseFilters");function qe(...o){return e=>{Reflect.defineMetadata(Ve,o,e);}}a(qe,"Catch");function ae(o){return Reflect.getOwnMetadata(Ve,o)??[]}a(ae,"getCatchMetadata");function H(o,e,t){return async r=>{let n=[...e.middlewares??[],...t.middlewares??[]],s=[...e.guards??[],...t.guards??[]],a$1=[...e.interceptors??[],...t.interceptors??[]],c=[...e.pipes??[],...t.pipes??[]],f=[...e.filters??[],...t.filters??[]],d=await N(o,f);try{w(r);let u=await N(o,n);return await vt(r,u,async()=>{w(r);let l=await N(o,s);for(let b of l)if(w(r),!await b.canActivate(r))throw new e$1("Access denied by guard");w(r);let v=await N(o,c);for(let b of v)w(r),await b.transform(r);w(r);let g=await N(o,a$1),Ee=a(async()=>(w(r),t.handler(r)),"handlerCall");return g.length===0?Ee():g.reduceRight((b,xe)=>async()=>(w(r),xe.intercept(r,b)),Ee)()})}catch(u){return Et(u,r,d)}}}a(H,"createPipeline");async function vt(o,e,t){return e.length===0?t():e.reduceRight((n,s)=>()=>s.use(o,n),t)()}a(vt,"runMiddlewareChain");function w(o){if(o.getSignal().aborted)throw new g$1}a(w,"checkAborted");async function Et(o,e,t){for(let r of t){let n=ae(r.constructor);if(n.length===0||o instanceof Error&&n.some(a=>o instanceof a))return r.catch(o,e)}throw o}a(Et,"handleError");async function N(o,e){let t=[];for(let r of e)typeof r=="function"?t.push(await o.resolve(r)):t.push(r);return t}a(N,"resolveRefs");var ce=Symbol("interceptors"),de=Symbol("method:interceptors");function ze(...o){return (e,t,r)=>{if(t!==void 0){let s=r?.value??e,a=s[de]??[];return s[de]=[...a,...o],r}let n=Reflect.getOwnMetadata(ce,e)??[];Reflect.defineMetadata(ce,[...n,...o],e);}}a(ze,"UseInterceptors");function fe(o){return Reflect.getOwnMetadata(ce,o)??[]}a(fe,"getInterceptorsMetadata");function ue(o,e){let r=o.prototype?.[e];return typeof r=="function"&&r[de]||[]}a(ue,"getMethodInterceptors");function V(o,e){return [...fe(o),...ue(o,e)]}a(V,"getEffectiveInterceptors");var le="uow:session",pe="uow:instance",L=class{static{a(this,"UnitOfWorkInterceptor");}factory;constructor(e){this.factory=e;}async intercept(e,t){let r=this.factory();await r.start(),e.setData(le,r.getContext()),e.setData(pe,r);try{let n=await t();return await r.commit(),n}catch(n){throw await r.rollback(),n}}};var he=Symbol("middlewares"),me=Symbol("method:middlewares");function We(...o){return (e,t,r)=>{if(t!==void 0){let s=r?.value??e,a=s[me]??[];return s[me]=[...a,...o],r}let n=Reflect.getOwnMetadata(he,e)??[];Reflect.defineMetadata(he,[...n,...o],e);}}a(We,"UseMiddleware");function ge(o){return Reflect.getOwnMetadata(he,o)??[]}a(ge,"getMiddlewaresMetadata");function ye(o,e){let r=o.prototype?.[e];return typeof r=="function"&&r[me]||[]}a(ye,"getMethodMiddlewares");function q(o,e){return [...ge(o),...ye(o,e)]}a(q,"getEffectiveMiddlewares");var Qe=Symbol("pipes");function Ze(...o){return (e,t,r)=>{let n=t?e.constructor:e,s=Reflect.getOwnMetadata(Qe,n)??[];Reflect.defineMetadata(Qe,[...s,...o],n);}}a(Ze,"UsePipes");var z=class{static{a(this,"ZodValidationPipe");}schema;constructor(e){this.schema=e;}transform(e){let t=e.getBody(),r=this.schema.safeParse(t);if(!r.success){let n={};for(let s of r.error.issues){let a=s.path.join(".")||"_root";n[a]||(n[a]=[]),n[a].push(s.message);}throw new c$2("Validation failed",n)}e.setBody(r.data);}};var xt=/^[0-9a-fA-F]{24}$/,W=class{static{a(this,"ParseIdPipe");}paramName;constructor(e="id"){this.paramName=e;}transform(e){let r=e.getParams()[this.paramName];if(!r||!xt.test(r))throw new c$2(`Invalid ${this.paramName}: must be a valid ObjectId`)}};var Q=class{static{a(this,"ParseIntPipe");}transform(e){let t=Number(e);if(!Number.isInteger(t)||e===""||e===null||e===void 0)throw new c$2(`Expected an integer, received: ${JSON.stringify(e)}`);return t}};var Z=class{static{a(this,"ZodParamPipe");}schema;constructor(e){this.schema=e;}transform(e){let t=this.schema.safeParse(e);if(!t.success){let r=t.error.errors.map(n=>`${n.path.join(".")}: ${n.message}`).join(", ");throw new c$2(r)}return t.data}};function Ye(o){return {transform(e){return e??o}}}a(Ye,"DefaultValuePipe");var E=Symbol("route:params");function Mt(o){return o==null?false:typeof o=="function"||typeof o=="object"&&typeof o.transform=="function"}a(Mt,"isParamPipeRef");function Y(o,e){return Mt(o)?{key:void 0,pipes:[o,...e??[]]}:{key:o,pipes:e??[]}}a(Y,"resolveArgs");function y(o,e,t=[]){return (r,n,s)=>{if(n===void 0)return;let a=r[n];if(typeof a!="function")return;let c=a[E]??[];a[E]=[...c,{index:s,type:o,key:e,pipes:t.length>0?t:void 0}];}}a(y,"buildBuiltinDecorator");function Rt(o){return typeof o=="function"?new o:o}a(Rt,"resolveParamPipe");function Je(o,...e){let{key:t,pipes:r}=Y(o,e);return y("query",t,r)}a(Je,"Query");function Ke(o,...e){let{key:t,pipes:r}=Y(o,e);return y("param",t,r)}a(Ke,"Param");function Xe(o,...e){let{key:t,pipes:r}=Y(o,e);return y("body",t,r)}a(Xe,"Body");var et=a(()=>y("rawBody"),"RawBody"),tt=a(()=>y("formData"),"FormData"),rt=a(()=>y("ip"),"Ip"),ot=a(()=>y("userAgent"),"UserAgent"),nt=a(o=>y("cookie",o),"Cookie");function st(o,...e){let{key:t,pipes:r}=Y(o,e);return y("headers",t,r)}a(st,"Headers");function we(o){return ()=>(e,t,r)=>{if(t===void 0)return;let n=e[t];if(typeof n!="function")return;let s=n[E]??[];n[E]=[...s,{index:r,type:"auth",extractor:o}];}}a(we,"defineAuth");var it=we();function J(o){return ()=>(e,t,r)=>{if(t===void 0)return;let n=e[t];if(typeof n!="function")return;let s=n[E]??[];n[E]=[...s,{index:r,type:"custom",extractor:o}];}}a(J,"createParamDecorator");function at(o,e){let t=o.prototype[e];if(typeof t!="function")return null;let r=t[E];return r&&r.length>0?r:null}a(at,"getRouteParams");async function ct(o,e){let t=Math.max(...o.map(n=>n.index)),r=new Array(t+1).fill(void 0);for(let{index:n,type:s,key:a,pipes:c,extractor:f}of o){let d;switch(s){case "query":{let u=e.getQuery();d=a!==void 0?u[a]:u;break}case "param":{let u=e.getParams();d=a!==void 0?u[a]:u;break}case "body":{let u=e.getBody()??{};d=a!==void 0?u[a]:u;break}case "rawBody":{d=e.getRawBody();break}case "formData":{d=e.getFormData();break}case "headers":{let u=e.getNativeRequest(),l=u?.node?.req?.headers??u?.headers??{};d=a!==void 0?l[a.toLowerCase()]:l;break}case "cookie":{let u=e.getNativeRequest(),l=u?.node?.req?.headers?.cookie??u?.headers?.cookie??"";if(a&&l){let v=l.split(";").map(g=>g.trim()).find(g=>g.startsWith(a+"="));d=v?decodeURIComponent(v.slice(a.length+1)):void 0;}else d=void 0;break}case "ip":{let u=e.getNativeRequest(),l=u?.node?.req?.headers??{},v=l["cf-connecting-ip"];if(v){d=v.trim();break}let g=l["x-forwarded-for"];if(g){d=(String(g).split(",")[0]??"").trim();break}d=u?.node?.req?.socket?.remoteAddress??"";break}case "userAgent":{d=(e.getNativeRequest()?.node?.req?.headers??{})["user-agent"]??"";break}case "auth":{d=f?await f(e):e.getAuth();break}case "custom":{d=f?await f(e):void 0;break}}if(c&&c.length>0)for(let u of c)d=Rt(u).transform(d);r[n]=d;}return r}a(ct,"resolveParamArgs");function dt(o){return J(e=>{let t=e.getBody(),r=o.safeParse(t);if(!r.success){let n={};for(let s of r.error.issues){let a=s.path.join(".")||"_root";(n[a]??=[]).push(s.message);}throw new c$2("Validation failed",n)}return r.data})}a(dt,"ZodValidatedBody");var K=class{static{a(this,"DomainEvent");}payload;timestamp;constructor(e){this.payload=e,this.timestamp=Date.now();}};function bt(o,e,t,r){var n=arguments.length,s=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,r);else for(var c=o.length-1;c>=0;c--)(a=o[c])&&(s=(n<3?a(s):n>3?a(e,t,s):a(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s}a(bt,"_ts_decorate");function ft(o,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,e)}a(ft,"_ts_metadata");var m=class{static{a(this,"EventBus");}handlers=new Map;onError;constructor(){this.onError=Pt;}setOptions(e){e.onError&&(this.onError=e.onError);}subscribe(e,t,r){let n=this.handlers.get(e)??[];n.push({instance:r?.instance??{},methodName:r?.methodName??"anonymous",handler:t}),this.handlers.set(e,n);}registerHandler(e,t,r){let n=t[r].bind(t);this.subscribe(e,n,{instance:t,methodName:r});}async emit(e){let t=this.handlers.get(e.type);if(!t||t.length===0)return;let r=await Promise.allSettled(t.map(n=>n.handler(e)));for(let n=0;n<r.length;n++){let s=r[n];if(s.status==="rejected"){let a=t[n],c=`${a.instance.constructor?.name??"Unknown"}.${a.methodName}`;this.onError(s.reason,e.type,c);}}}emitAsync(e){this.emit(e).catch(()=>{});}hasHandlers(e){let t=this.handlers.get(e);return t!==void 0&&t.length>0}handlerCount(e){return this.handlers.get(e)?.length??0}clear(){this.handlers.clear();}};m=bt([d$1(),ft("design:type",Function),ft("design:paramtypes",[])],m);function Pt(o,e,t){console.error(`[EventBus] Handler "${t}" failed for event "${e}":`,o);}a(Pt,"defaultErrorHandler");var ve=Symbol("on-event");function ut(o){return (e,t,r)=>{let n=Reflect.getOwnMetadata(ve,e.constructor)??[];n.push({eventType:o,methodName:String(t)}),Reflect.defineMetadata(ve,n,e.constructor);}}a(ut,"OnEvent");function lt(o){return Reflect.getOwnMetadata(ve,o)??[]}a(lt,"getOnEventMetadata");var X=class{static{a(this,"ControllerRouter");}routes=[];globalPrefix;constructor(e=""){this.globalPrefix=e;}register(...e){for(let t of e){let r=M(t)??"",n=U(t);for(let s of n){let a=Ct(`${this.globalPrefix}/${r}/${s.path}`);St(a,t.name,s.methodName),this.checkDuplicate(a,s.method,t.name,s.methodName);let{pattern:c,paramNames:f}=Tt(a),d=$(t,s.methodName),u=V(t,s.methodName),l=q(t,s.methodName);this.routes.push({method:s.method,pattern:c,paramNames:f,controllerClass:t,methodName:s.methodName,guardClasses:d,interceptorRefs:u,middlewareRefs:l,rawPath:a});}}this.routes.sort((t,r)=>pt(t.rawPath)-pt(r.rawPath));}checkDuplicate(e,t,r,n){let s=this.routes.find(a=>a.method===t&&a.rawPath===e);if(s)throw new Error(`Duplicate route: ${t} ${e}
|
|
2
2
|
Already registered by: ${s.controllerClass.name}.${s.methodName}
|
|
3
|
-
Conflicting with: ${r}.${n}`)}match(e,t){let r=e.toUpperCase();for(let n of this.routes){if(n.method!==r)continue;let s=n.pattern.exec(t);if(!s)continue;let a={};for(let c=0;c<n.paramNames.length;c++)a[n.paramNames[c]]=s[c+1]??"";return {route:n,params:a}}return null}getRoutes(){return this.routes}};function
|
|
3
|
+
Conflicting with: ${r}.${n}`)}match(e,t){let r=e.toUpperCase();for(let n of this.routes){if(n.method!==r)continue;let s=n.pattern.exec(t);if(!s)continue;let a={};for(let c=0;c<n.paramNames.length;c++)a[n.paramNames[c]]=s[c+1]??"";return {route:n,params:a}}return null}getRoutes(){return this.routes}};function Ct(o){return "/"+o.replace(/\/+/g,"/").replace(/^\/|\/$/g,"")}a(Ct,"normalizePath");function Tt(o){let e=[],t=o.split("/").map(r=>r.startsWith(":")?(e.push(r.slice(1)),"([^/]+)"):At(r)).join("/");return {pattern:new RegExp(`^${t}$`),paramNames:e}}a(Tt,"compilePath");function At(o){return o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}a(At,"escapeRegex");function pt(o){return o.split("/").filter(Boolean).reduce((e,t)=>e+(t.startsWith(":")?1:0),0)}a(pt,"routePriority");function St(o,e,t){let r=`Invalid path "${o}" on ${e}.${t}:`;if(!o.startsWith("/"))throw new Error(`${r} must start with /`);let n=o.split("/").filter((a,c)=>c>0),s=new Set;for(let a of n){if(a==="")throw new Error(`${r} contains empty segment (double slash)`);if(a.startsWith(":")){let c=a.slice(1);if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(c))throw new Error(`${r} invalid param name ":${c}" \u2014 must be a valid identifier`);if(s.has(c))throw new Error(`${r} duplicate param name ":${c}"`);s.add(c);}}}a(St,"validatePath");var ht="__redirect";function mt(o,e=302){return {__redirect:true,url:o,statusCode:e}}a(mt,"redirect");function gt(o){return o!==null&&typeof o=="object"&&o.__redirect===true}a(gt,"isRedirect");async function yt(o,e){let t=await o.resolve(m);for(let r of e){let n=It(r);if(!n)continue;let s=lt(n);if(s.length===0)continue;let a=typeof r=="function"?r:r.provide,c;try{c=await o.resolve(a);}catch{continue}for(let f of s)typeof c[f.methodName]=="function"&&t.registerHandler(f.eventType,c,f.methodName);}}a(yt,"scanEventHandlers");function It(o){return typeof o=="function"?g(o)?o:null:"useClass"in o?o.useClass:null}a(It,"getProviderClass");var ee=class{static{a(this,"BackendApplication");}container;registry;initialized=false;options;eventBus;prefix="";constructor(e){this.options=e,this.container=new x,this.registry=new R;}async init(){if(this.initialized)return;this.eventBus=new m,this.options.eventBus&&this.eventBus.setOptions(this.options.eventBus),this.container.register({provide:m,useValue:this.eventBus});let e$1=new e;this.container.register({provide:e,useValue:e$1}),this.registry.scan(this.options.rootModule),this.registry.registerAll(this.container);let t=this.registry.getAllProviders();e$1._init(this.container,t),await this.registry.callLifecycleHooks(this.container,"onModuleInit"),await yt(this.container,t),await this.registry.callLifecycleHooks(this.container,"onApplicationBootstrap"),this.initialized=true;}setGlobalPrefix(e){return this.prefix=e,this}getGlobalPrefix(){return this.prefix}async resolve(e){return this.ensureInitialized(),this.container.resolve(e)}has(e){return this.container.has(e)}getContainer(){return this.container}getControllers(){return this.ensureInitialized(),this.registry.getAllControllers()}getProviders(){return this.ensureInitialized(),this.registry.getAllProviders()}getEventBus(){return this.ensureInitialized(),this.eventBus}createHandler(e){return this.ensureInitialized(),H(this.container,this.getGlobalOptions(),e)}async shutdown(){this.initialized&&(await this.registry.callLifecycleHooks(this.container,"onModuleDestroy"),await this.registry.callLifecycleHooks(this.container,"onApplicationShutdown"),this.eventBus.clear(),await this.container.dispose(),this.initialized=false);}getGlobalOptions(){return {guards:this.options.globalGuards,interceptors:this.options.globalInterceptors,pipes:this.options.globalPipes,filters:this.options.globalFilters}}ensureInitialized(){if(!this.initialized)throw new Error("BackendApplication not initialized. Call init() first.")}};export{it as Auth,ee as BackendApplication,j as BaseExecutionContext,Xe as Body,qe as Catch,G as ConfigurableModuleBuilder,x as Container,Fe as Controller,X as ControllerRouter,nt as Cookie,Ye as DefaultValuePipe,Ue as Delete,K as DomainEvent,m as EventBus,tt as FormData,Oe as Get,st as Headers,rt as Ip,R as ModuleRegistry,je as NoGuard,ut as OnEvent,Ke as Param,W as ParseIdPipe,Q as ParseIntPipe,$e as Patch,Be as Post,ke as Put,Je as Query,ht as REDIRECT_BRAND,et as RawBody,Ge as RouteGuards,pe as UOW_INSTANCE_KEY,le as UOW_SESSION_KEY,L as UnitOfWorkInterceptor,Le as UseFilters,ze as UseInterceptors,We as UseMiddleware,Ze as UsePipes,ot as UserAgent,Z as ZodParamPipe,dt as ZodValidatedBody,z as ZodValidationPipe,J as createParamDecorator,H as createPipeline,we as defineAuth,De as forwardRef,ie as getControllerGuards,M as getControllerPath,V as getEffectiveInterceptors,q as getEffectiveMiddlewares,fe as getInterceptorsMetadata,$ as getMethodGuards,ue as getMethodInterceptors,ye as getMethodMiddlewares,ge as getMiddlewaresMetadata,U as getRouteMetadata,at as getRouteParams,gt as isRedirect,mt as redirect,k as resolveForwardRef,ct as resolveParamArgs};
|
package/dist/saga.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a,
|
|
1
|
+
import {g}from'./chunk-XVPJFMLQ.js';import {a,d as d$1}from'./chunk-RMR6UXWO.js';function d(i,n,r,o){var c=arguments.length,e=c<3?n:o===null?o=Object.getOwnPropertyDescriptor(n,r):o,t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")e=Reflect.decorate(i,n,r,o);else for(var u=i.length-1;u>=0;u--)(t=i[u])&&(e=(c<3?t(e):c>3?t(n,r,e):t(n,r))||e);return c>3&&e&&Object.defineProperty(n,r,e),e}a(d,"_ts_decorate");var l=class{static{a(this,"SagaOrchestrator");}async execute(n,r){let o=r?.signal,c=r?.onCompensationError??(()=>{}),e=[],t={};for(let a of n){if(o?.aborted)return this.buildFailure(new g,a.name,e,t,c);try{let s=await a.execute(o);e.push({step:a,result:s}),t[a.name]=s;}catch(s){return this.buildFailure(s,a.name,e,t,c)}}let u=e.length>0?e[e.length-1].result:void 0;return {success:true,results:t,value:u,compensated:[],compensationErrors:{}}}async buildFailure(n,r,o,c,e){let t=[],u={};for(let a=o.length-1;a>=0;a--){let{step:s,result:b}=o[a];if(s.compensate)try{await s.compensate(b),t.push(s.name);}catch(m){u[s.name]=m,e(s.name,m);}}return {success:false,results:c,error:n,failedStep:r,compensated:t,compensationErrors:u}}};l=d([d$1()],l);export{l as SagaOrchestrator};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { D as DynamicModule } from './types-D-An5cXP.js';
|
|
2
|
+
|
|
3
|
+
interface CronOptions {
|
|
4
|
+
/** Optional name for the task (used for programmatic access via SchedulerRegistry). */
|
|
5
|
+
name?: string;
|
|
6
|
+
/** Whether the cron job should start immediately. Defaults to true. */
|
|
7
|
+
enabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
interface IntervalOptions {
|
|
10
|
+
/** Optional name for the task. */
|
|
11
|
+
name?: string;
|
|
12
|
+
/** Whether the interval should start immediately. Defaults to true. */
|
|
13
|
+
enabled?: boolean;
|
|
14
|
+
}
|
|
15
|
+
interface TimeoutOptions {
|
|
16
|
+
/** Optional name for the task. */
|
|
17
|
+
name?: string;
|
|
18
|
+
/** Whether the timeout should be scheduled immediately. Defaults to true. */
|
|
19
|
+
enabled?: boolean;
|
|
20
|
+
}
|
|
21
|
+
interface SchedulerTask {
|
|
22
|
+
type: 'cron' | 'interval' | 'timeout';
|
|
23
|
+
name: string;
|
|
24
|
+
stop: () => void;
|
|
25
|
+
}
|
|
26
|
+
interface ScheduleModuleOptions {
|
|
27
|
+
/** Called when a scheduled handler throws. Defaults to console.error. */
|
|
28
|
+
onError?: (error: unknown, taskName: string) => void;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Method decorator that schedules the method using a cron expression.
|
|
33
|
+
*
|
|
34
|
+
* Requires `ScheduleModule.forRoot()` in your module imports.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* @Injectable()
|
|
39
|
+
* class ReportService {
|
|
40
|
+
* @Cron('0 * * * *') // Every hour
|
|
41
|
+
* async generateReport() { ... }
|
|
42
|
+
*
|
|
43
|
+
* @Cron('0 0 * * *', { name: 'daily-cleanup' })
|
|
44
|
+
* async cleanup() { ... }
|
|
45
|
+
* }
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
declare function Cron(expression: string, options?: CronOptions): MethodDecorator;
|
|
49
|
+
/**
|
|
50
|
+
* Method decorator that runs the method at a fixed interval.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```typescript
|
|
54
|
+
* @Injectable()
|
|
55
|
+
* class HealthCheckService {
|
|
56
|
+
* @Interval(30_000) // Every 30 seconds
|
|
57
|
+
* async ping() { ... }
|
|
58
|
+
* }
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
declare function Interval(ms: number, options?: IntervalOptions): MethodDecorator;
|
|
62
|
+
/**
|
|
63
|
+
* Method decorator that runs the method once after a delay.
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```typescript
|
|
67
|
+
* @Injectable()
|
|
68
|
+
* class StartupService {
|
|
69
|
+
* @Timeout(5_000) // 5 seconds after bootstrap
|
|
70
|
+
* async warmupCache() { ... }
|
|
71
|
+
* }
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
declare function Timeout(ms: number, options?: TimeoutOptions): MethodDecorator;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Enables declarative task scheduling with @Cron, @Interval, and @Timeout decorators.
|
|
78
|
+
*
|
|
79
|
+
* Import with `ScheduleModule.forRoot()` in your root module.
|
|
80
|
+
* The module automatically scans all providers for schedule decorators
|
|
81
|
+
* during bootstrap and stops all tasks on shutdown.
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```typescript
|
|
85
|
+
* @Module({
|
|
86
|
+
* imports: [ScheduleModule.forRoot()],
|
|
87
|
+
* })
|
|
88
|
+
* export class AppModule {}
|
|
89
|
+
*
|
|
90
|
+
* // Then in any @Injectable() service:
|
|
91
|
+
* @Injectable()
|
|
92
|
+
* class SyncService {
|
|
93
|
+
* @Cron('0 * * * *')
|
|
94
|
+
* async syncData() { ... }
|
|
95
|
+
*
|
|
96
|
+
* @Interval(30_000)
|
|
97
|
+
* async healthCheck() { ... }
|
|
98
|
+
* }
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
declare class ScheduleModule {
|
|
102
|
+
static forRoot(options?: ScheduleModuleOptions): DynamicModule;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Registry that tracks all running scheduled tasks.
|
|
107
|
+
* Inject this to programmatically manage tasks at runtime.
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* ```typescript
|
|
111
|
+
* @Injectable()
|
|
112
|
+
* @Inject(SchedulerRegistry)
|
|
113
|
+
* class AdminService {
|
|
114
|
+
* constructor(private readonly scheduler: SchedulerRegistry) {}
|
|
115
|
+
*
|
|
116
|
+
* pauseSync() {
|
|
117
|
+
* this.scheduler.stopTask('sync-job')
|
|
118
|
+
* }
|
|
119
|
+
* }
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
declare class SchedulerRegistry {
|
|
123
|
+
private tasks;
|
|
124
|
+
register(task: SchedulerTask): void;
|
|
125
|
+
getTask(name: string): SchedulerTask | undefined;
|
|
126
|
+
stopTask(name: string): boolean;
|
|
127
|
+
stopAll(): void;
|
|
128
|
+
getTaskNames(): string[];
|
|
129
|
+
get size(): number;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export { Cron, type CronOptions, Interval, type IntervalOptions, ScheduleModule, type ScheduleModuleOptions, SchedulerRegistry, type SchedulerTask, Timeout, type TimeoutOptions };
|
package/dist/schedule.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {e as e$1,b as b$1,a as a$1}from'./chunk-F5KXBDV2.js';import {a,d,e}from'./chunk-RMR6UXWO.js';import'reflect-metadata';import {Cron}from'croner';var g=Symbol("schedule:cron"),v=Symbol("schedule:interval"),T=Symbol("schedule:timeout"),b=Symbol("schedule:options");function x(n,t){return (r,e,s)=>{let o=Reflect.getOwnMetadata(g,r.constructor)??[];o.push({expression:n,methodName:String(e),options:t??{}}),Reflect.defineMetadata(g,o,r.constructor);}}a(x,"Cron");function I(n,t){return (r,e,s)=>{let o=Reflect.getOwnMetadata(v,r.constructor)??[];o.push({ms:n,methodName:String(e),options:t??{}}),Reflect.defineMetadata(v,o,r.constructor);}}a(I,"Interval");function N(n,t){return (r,e,s)=>{let o=Reflect.getOwnMetadata(T,r.constructor)??[];o.push({ms:n,methodName:String(e),options:t??{}}),Reflect.defineMetadata(T,o,r.constructor);}}a(N,"Timeout");function E(n){return Reflect.getOwnMetadata(g,n)??[]}a(E,"getCronMetadata");function A(n){return Reflect.getOwnMetadata(v,n)??[]}a(A,"getIntervalMetadata");function S(n){return Reflect.getOwnMetadata(T,n)??[]}a(S,"getTimeoutMetadata");function j(n,t,r,e){var s=arguments.length,o=s<3?t:e===null?e=Object.getOwnPropertyDescriptor(t,r):e,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,r,e);else for(var c=n.length-1;c>=0;c--)(i=n[c])&&(o=(s<3?i(o):s>3?i(t,r,o):i(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o}a(j,"_ts_decorate");var l=class{static{a(this,"SchedulerRegistry");}tasks=new Map;register(t){this.tasks.has(t.name)&&this.tasks.get(t.name).stop(),this.tasks.set(t.name,t);}getTask(t){return this.tasks.get(t)}stopTask(t){let r=this.tasks.get(t);return r?(r.stop(),this.tasks.delete(t),true):false}stopAll(){for(let t of this.tasks.values())t.stop();this.tasks.clear();}getTaskNames(){return [...this.tasks.keys()]}get size(){return this.tasks.size}};l=j([d()],l);function w(n,t,r,e){var s=arguments.length,o=s<3?t:e===null?e=Object.getOwnPropertyDescriptor(t,r):e,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,r,e);else for(var c=n.length-1;c>=0;c--)(i=n[c])&&(o=(s<3?i(o):s>3?i(t,r,o):i(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o}a(w,"_ts_decorate");function _(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)}a(_,"_ts_metadata");var p=class{static{a(this,"ScheduleExplorer");}discovery;registry;options;onError;constructor(t,r,e){this.discovery=t,this.registry=r,this.options=e,this.onError=e.onError??D;}async onApplicationBootstrap(){let t=this.discovery.getProviders();for(let r of t){let e=this.discovery.getProviderClass(r);if(!e)continue;let s=E(e),o=A(e),i=S(e);if(s.length===0&&o.length===0&&i.length===0)continue;let c=typeof r=="function"?r:r.provide,f;try{f=await this.discovery.resolve(c);}catch{continue}let O=e.name;for(let u of s)this.registerCron(f,O,u);for(let u of o)this.registerInterval(f,O,u);for(let u of i)this.registerTimeout(f,O,u);}}onApplicationShutdown(){this.registry.stopAll();}registerCron(t,r,e){let s=e.options.enabled!==false,o=e.options.name??`${r}.${e.methodName}`,i=t[e.methodName].bind(t),c=new Cron(e.expression,{paused:!s},async()=>{try{await i();}catch(f){this.onError(f,o);}});this.registry.register({type:"cron",name:o,stop:a(()=>c.stop(),"stop")});}registerInterval(t,r,e){let s=e.options.enabled!==false,o=e.options.name??`${r}.${e.methodName}`;if(!s)return;let i=t[e.methodName].bind(t),c=setInterval(async()=>{try{await i();}catch(f){this.onError(f,o);}},e.ms);this.registry.register({type:"interval",name:o,stop:a(()=>clearInterval(c),"stop")});}registerTimeout(t,r,e){let s=e.options.enabled!==false,o=e.options.name??`${r}.${e.methodName}`;if(!s)return;let i=t[e.methodName].bind(t),c=setTimeout(async()=>{try{await i();}catch(f){this.onError(f,o);}},e.ms);this.registry.register({type:"timeout",name:o,stop:a(()=>clearTimeout(c),"stop")});}};p=w([d(),e(e$1,l,b),_("design:type",Function),_("design:paramtypes",[typeof e$1>"u"?Object:e$1,typeof l>"u"?Object:l,typeof ScheduleModuleOptions>"u"?Object:ScheduleModuleOptions])],p);function D(n,t){console.error(`[Schedule] Task "${t}" failed:`,n);}a(D,"defaultErrorHandler");function P(n,t,r,e){var s=arguments.length,o=s<3?t:e===null?e=Object.getOwnPropertyDescriptor(t,r):e,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,r,e);else for(var c=n.length-1;c>=0;c--)(i=n[c])&&(o=(s<3?i(o):s>3?i(t,r,o):i(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o}a(P,"_ts_decorate");var m=class n{static{a(this,"ScheduleModule");}static forRoot(t){return {module:n,global:true,providers:[{provide:b,useValue:t??{}},l,p],exports:[l]}}};m=P([b$1(),a$1({})],m);export{x as Cron,I as Interval,m as ScheduleModule,l as SchedulerRegistry,N as Timeout};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
declare enum Scope {
|
|
2
|
+
SINGLETON = "singleton",
|
|
3
|
+
REQUEST = "request",
|
|
4
|
+
TRANSIENT = "transient"
|
|
5
|
+
}
|
|
6
|
+
interface Type<T = unknown> extends Function {
|
|
7
|
+
new (...args: any[]): T;
|
|
8
|
+
}
|
|
9
|
+
interface InjectableOptions {
|
|
10
|
+
scope?: Scope;
|
|
11
|
+
}
|
|
12
|
+
interface ClassProvider<T = unknown> {
|
|
13
|
+
provide: Token<T>;
|
|
14
|
+
useClass: Type<T>;
|
|
15
|
+
scope?: Scope;
|
|
16
|
+
}
|
|
17
|
+
interface ValueProvider<T = unknown> {
|
|
18
|
+
provide: Token<T>;
|
|
19
|
+
useValue: T;
|
|
20
|
+
}
|
|
21
|
+
interface FactoryProvider<T = unknown> {
|
|
22
|
+
provide: Token<T>;
|
|
23
|
+
useFactory: (...args: any[]) => T | Promise<T>;
|
|
24
|
+
inject?: Token[];
|
|
25
|
+
scope?: Scope;
|
|
26
|
+
}
|
|
27
|
+
interface ExistingProvider<T = unknown> {
|
|
28
|
+
provide: Token<T>;
|
|
29
|
+
useExisting: Token<T>;
|
|
30
|
+
}
|
|
31
|
+
type Provider<T = unknown> = Type<T> | ClassProvider<T> | ValueProvider<T> | FactoryProvider<T> | ExistingProvider<T>;
|
|
32
|
+
type Token<T = unknown> = Type<T> | string | symbol | InjectionToken<T>;
|
|
33
|
+
declare class InjectionToken<T = unknown> {
|
|
34
|
+
readonly description: string;
|
|
35
|
+
constructor(description: string);
|
|
36
|
+
toString(): string;
|
|
37
|
+
}
|
|
38
|
+
interface ForwardRef<T = unknown> {
|
|
39
|
+
forwardRef: () => Type<T>;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
interface ModuleMetadata {
|
|
43
|
+
imports?: Array<Type | DynamicModule>;
|
|
44
|
+
controllers?: Type[];
|
|
45
|
+
providers?: Provider[];
|
|
46
|
+
exports?: Token[];
|
|
47
|
+
}
|
|
48
|
+
interface DynamicModule {
|
|
49
|
+
module: Type;
|
|
50
|
+
imports?: Array<Type | DynamicModule>;
|
|
51
|
+
controllers?: Type[];
|
|
52
|
+
providers?: Provider[];
|
|
53
|
+
exports?: Token[];
|
|
54
|
+
global?: boolean;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Factory class interface for `useClass` / `useExisting` async options.
|
|
58
|
+
* Implement this on a class to provide module options asynchronously.
|
|
59
|
+
*/
|
|
60
|
+
interface ModuleOptionsFactory<T> {
|
|
61
|
+
createModuleOptions(): T | Promise<T>;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Async options accepted by `forRootAsync()`.
|
|
65
|
+
*
|
|
66
|
+
* Exactly one of `useFactory`, `useClass`, or `useExisting` must be provided.
|
|
67
|
+
*/
|
|
68
|
+
type ModuleAsyncOptions<T> = {
|
|
69
|
+
imports?: Array<Type | DynamicModule>;
|
|
70
|
+
useFactory: (...args: any[]) => T | Promise<T>;
|
|
71
|
+
inject?: Token[];
|
|
72
|
+
useClass?: never;
|
|
73
|
+
useExisting?: never;
|
|
74
|
+
} | {
|
|
75
|
+
imports?: Array<Type | DynamicModule>;
|
|
76
|
+
useClass: Type<ModuleOptionsFactory<T>>;
|
|
77
|
+
useFactory?: never;
|
|
78
|
+
inject?: never;
|
|
79
|
+
useExisting?: never;
|
|
80
|
+
} | {
|
|
81
|
+
imports?: Array<Type | DynamicModule>;
|
|
82
|
+
useExisting: Type<ModuleOptionsFactory<T>>;
|
|
83
|
+
useFactory?: never;
|
|
84
|
+
inject?: never;
|
|
85
|
+
useClass?: never;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export { type ClassProvider as C, type DynamicModule as D, type ExistingProvider as E, type ForwardRef as F, type InjectableOptions as I, type ModuleMetadata as M, type Provider as P, Scope as S, type Token as T, type ValueProvider as V, type Type as a, type ModuleAsyncOptions as b, InjectionToken as c, type FactoryProvider as d, type ModuleOptionsFactory as e };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "truxie",
|
|
3
|
-
"version": "0.1.0-test.
|
|
3
|
+
"version": "0.1.0-test.5",
|
|
4
4
|
"description": "NestJS-like structural backend library with DI, modules, guards, interceptors, pipes, and exception filters",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -16,6 +16,11 @@
|
|
|
16
16
|
"types": "./dist/saga.d.ts",
|
|
17
17
|
"import": "./dist/saga.js",
|
|
18
18
|
"default": "./dist/saga.js"
|
|
19
|
+
},
|
|
20
|
+
"./schedule": {
|
|
21
|
+
"types": "./dist/schedule.d.ts",
|
|
22
|
+
"import": "./dist/schedule.js",
|
|
23
|
+
"default": "./dist/schedule.js"
|
|
19
24
|
}
|
|
20
25
|
},
|
|
21
26
|
"files": [
|
|
@@ -32,9 +37,13 @@
|
|
|
32
37
|
"reflect-metadata": "^0.2.2"
|
|
33
38
|
},
|
|
34
39
|
"peerDependencies": {
|
|
40
|
+
"croner": "^9.0.0",
|
|
35
41
|
"zod": "^3.22.0"
|
|
36
42
|
},
|
|
37
43
|
"peerDependenciesMeta": {
|
|
44
|
+
"croner": {
|
|
45
|
+
"optional": true
|
|
46
|
+
},
|
|
38
47
|
"zod": {
|
|
39
48
|
"optional": true
|
|
40
49
|
}
|
|
@@ -42,6 +51,7 @@
|
|
|
42
51
|
"devDependencies": {
|
|
43
52
|
"@swc/core": "^1.15.18",
|
|
44
53
|
"@types/node": "^22.10.5",
|
|
54
|
+
"croner": "^9.1.0",
|
|
45
55
|
"tsup": "^8.0.0",
|
|
46
56
|
"typescript": "^5.0.0",
|
|
47
57
|
"vitest": "^4.0.18",
|
package/dist/chunk-M2ZPR3DR.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import'reflect-metadata';var R=Object.defineProperty;var n=(t,e)=>R(t,"name",{value:e,configurable:true});var u=(function(t){return t.SINGLETON="singleton",t.REQUEST="request",t.TRANSIENT="transient",t})({}),p=class{static{n(this,"InjectionToken");}description;constructor(e){this.description=e;}toString(){return `InjectionToken(${this.description})`}};var l=Symbol("injectable"),c=Symbol("inject:param"),f=Symbol("inject:deps"),a=Symbol("optional");function I(t){return e=>{Reflect.defineMetadata(l,{scope:t?.scope??u.SINGLETON},e);}}n(I,"Injectable");function N(...t){return (e,s,r)=>{if(typeof r=="number"){let i=Reflect.getOwnMetadata(c,e)??new Map;i.set(r,t[0]),Reflect.defineMetadata(c,i,e);}else Reflect.defineMetadata(f,t,e);}}n(N,"Inject");function h(){return (t,e,s)=>{let r=Reflect.getOwnMetadata(a,t)??new Set;r.add(s),Reflect.defineMetadata(a,r,t);}}n(h,"Optional");function m(t){return Reflect.getOwnMetadata(l,t)}n(m,"getInjectableMetadata");function E(t){return Reflect.getOwnMetadata(f,t)??[]}n(E,"getClassDeps");function j(t){return Reflect.getOwnMetadata(c,t)??new Map}n(j,"getInjectTokens");function _(t){return Reflect.getOwnMetadata(a,t)??new Set}n(_,"getOptionalParams");var o=class extends Error{static{n(this,"AppError");}statusCode;status;isOperational;constructor(e,s){super(e),this.statusCode=s,this.status=s>=400&&s<500?"fail":"error",this.isOperational=true,Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace(this,this.constructor);}},d=class extends o{static{n(this,"NotFoundError");}constructor(e="Resource not found"){super(e,404);}},x=class extends o{static{n(this,"ValidationError");}errors;constructor(e="Validation failed",s){super(e,400),this.errors=s;}},T=class extends o{static{n(this,"UnauthorizedError");}constructor(e="Not authorized"){super(e,401);}},M=class extends o{static{n(this,"ForbiddenError");}constructor(e="Access forbidden"){super(e,403);}},A=class extends o{static{n(this,"ConflictError");}constructor(e="Resource conflict"){super(e,409);}},O=class extends o{static{n(this,"RequestAbortedError");}constructor(e="Request aborted by client"){super(e,499);}};export{n as a,u as b,p as c,I as d,N as e,h as f,m as g,E as h,j as i,_ as j,o as k,d as l,x as m,T as n,M as o,A as p,O as q};
|