@carno.js/core 0.2.11 → 1.0.2
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/LICENSE +673 -673
- package/README.md +188 -0
- package/dist/Carno.js +272 -333
- package/dist/Carno.mjs +268 -0
- package/dist/DefaultRoutes.js +51 -0
- package/dist/DefaultRoutes.mjs +34 -0
- package/dist/bun/index.js +183 -0
- package/dist/bun/index.js.map +86 -0
- package/dist/cache/CacheDriver.js +13 -0
- package/dist/cache/CacheDriver.mjs +0 -0
- package/dist/cache/CacheService.js +113 -0
- package/dist/cache/CacheService.mjs +93 -0
- package/dist/cache/MemoryDriver.js +66 -0
- package/dist/cache/MemoryDriver.mjs +46 -0
- package/dist/cache/RedisDriver.js +81 -0
- package/dist/cache/RedisDriver.mjs +61 -0
- package/dist/compiler/JITCompiler.js +111 -0
- package/dist/compiler/JITCompiler.mjs +89 -0
- package/dist/container/Container.js +99 -0
- package/dist/container/Container.mjs +78 -0
- package/dist/context/Context.js +97 -0
- package/dist/context/Context.mjs +77 -0
- package/dist/cors/CorsHandler.js +90 -0
- package/dist/cors/CorsHandler.mjs +68 -0
- package/dist/decorators/Controller.js +42 -0
- package/dist/decorators/Controller.mjs +22 -0
- package/dist/decorators/Inject.js +30 -0
- package/dist/decorators/Inject.mjs +10 -0
- package/dist/decorators/Middleware.js +35 -0
- package/dist/decorators/Middleware.mjs +15 -0
- package/dist/decorators/Service.js +31 -0
- package/dist/decorators/Service.mjs +12 -0
- package/dist/decorators/methods.js +60 -0
- package/dist/decorators/methods.mjs +34 -0
- package/dist/decorators/params.js +63 -0
- package/dist/decorators/params.mjs +37 -0
- package/dist/events/Lifecycle.js +69 -0
- package/dist/events/Lifecycle.mjs +41 -0
- package/dist/exceptions/HttpException.js +112 -26
- package/dist/exceptions/HttpException.mjs +82 -0
- package/dist/index.js +129 -31
- package/dist/index.mjs +94 -0
- package/dist/metadata.js +34 -0
- package/dist/metadata.mjs +9 -0
- package/dist/middleware/CarnoMiddleware.js +13 -0
- package/dist/middleware/CarnoMiddleware.mjs +0 -0
- package/dist/router/RadixRouter.js +121 -0
- package/dist/router/RadixRouter.mjs +101 -0
- package/dist/testing/TestHarness.js +81 -0
- package/dist/testing/TestHarness.mjs +60 -0
- package/dist/utils/Metadata.js +53 -0
- package/dist/utils/Metadata.mjs +31 -0
- package/dist/validation/ValibotAdapter.js +67 -0
- package/dist/validation/ValibotAdapter.mjs +48 -0
- package/dist/validation/ValidatorAdapter.js +35 -19
- package/dist/validation/ValidatorAdapter.mjs +14 -0
- package/dist/validation/ZodAdapter.js +80 -0
- package/dist/validation/ZodAdapter.mjs +59 -0
- package/package.json +21 -63
- package/src/Carno.ts +605 -0
- package/src/DefaultRoutes.ts +34 -0
- package/src/cache/CacheDriver.ts +50 -0
- package/src/cache/CacheService.ts +139 -0
- package/src/cache/MemoryDriver.ts +104 -0
- package/src/cache/RedisDriver.ts +116 -0
- package/src/compiler/JITCompiler.ts +167 -0
- package/src/container/Container.ts +168 -0
- package/src/context/Context.ts +128 -0
- package/src/cors/CorsHandler.ts +145 -0
- package/src/decorators/Controller.ts +63 -0
- package/src/decorators/Inject.ts +16 -0
- package/src/decorators/Middleware.ts +22 -0
- package/src/decorators/Service.ts +18 -0
- package/src/decorators/methods.ts +58 -0
- package/src/decorators/params.ts +47 -0
- package/src/events/Lifecycle.ts +97 -0
- package/src/exceptions/HttpException.ts +99 -0
- package/src/index.ts +92 -0
- package/src/metadata.ts +46 -0
- package/src/middleware/CarnoMiddleware.ts +14 -0
- package/src/router/RadixRouter.ts +225 -0
- package/src/testing/TestHarness.ts +177 -0
- package/src/utils/Metadata.ts +43 -0
- package/src/validation/ValibotAdapter.ts +95 -0
- package/src/validation/ValidatorAdapter.ts +69 -0
- package/src/validation/ZodAdapter.ts +102 -0
- package/dist/Carno.d.ts +0 -75
- package/dist/cache/bento-cache.driver.d.ts +0 -13
- package/dist/cache/bento-cache.driver.js +0 -55
- package/dist/cache/cache.service.d.ts +0 -8
- package/dist/cache/cache.service.js +0 -6
- package/dist/commons/decorators/Injectable.decorator.d.ts +0 -20
- package/dist/commons/decorators/Injectable.decorator.js +0 -33
- package/dist/commons/decorators/controller.decorator.d.ts +0 -8
- package/dist/commons/decorators/controller.decorator.js +0 -22
- package/dist/commons/decorators/http.decorators.d.ts +0 -13
- package/dist/commons/decorators/http.decorators.js +0 -63
- package/dist/commons/decorators/index.d.ts +0 -6
- package/dist/commons/decorators/index.js +0 -22
- package/dist/commons/decorators/inject.decorator.d.ts +0 -1
- package/dist/commons/decorators/inject.decorator.js +0 -5
- package/dist/commons/decorators/middleware.decorator.d.ts +0 -2
- package/dist/commons/decorators/middleware.decorator.js +0 -30
- package/dist/commons/decorators/service.decorator.d.ts +0 -2
- package/dist/commons/decorators/service.decorator.js +0 -7
- package/dist/commons/decorators/validation.decorator.d.ts +0 -32
- package/dist/commons/decorators/validation.decorator.js +0 -40
- package/dist/commons/http-code.enum.d.ts +0 -50
- package/dist/commons/http-code.enum.js +0 -54
- package/dist/commons/index.d.ts +0 -3
- package/dist/commons/index.js +0 -19
- package/dist/commons/registries/ProviderControl.d.ts +0 -77
- package/dist/commons/registries/ProviderControl.js +0 -112
- package/dist/commons/registries/ProviderRegistry.d.ts +0 -7
- package/dist/commons/registries/ProviderRegistry.js +0 -20
- package/dist/constants.d.ts +0 -8
- package/dist/constants.js +0 -11
- package/dist/container/ContainerConfiguration.d.ts +0 -45
- package/dist/container/ContainerConfiguration.js +0 -121
- package/dist/container/DependencyResolver.d.ts +0 -20
- package/dist/container/DependencyResolver.js +0 -85
- package/dist/container/InjectorService.d.ts +0 -58
- package/dist/container/InjectorService.js +0 -286
- package/dist/container/MethodInvoker.d.ts +0 -21
- package/dist/container/MethodInvoker.js +0 -83
- package/dist/container/RouteResolver.d.ts +0 -27
- package/dist/container/RouteResolver.js +0 -173
- package/dist/container/container.d.ts +0 -41
- package/dist/container/container.js +0 -71
- package/dist/container/createContainer.d.ts +0 -3
- package/dist/container/createContainer.js +0 -12
- package/dist/container/createInjector.d.ts +0 -2
- package/dist/container/createInjector.js +0 -7
- package/dist/container/index.d.ts +0 -6
- package/dist/container/index.js +0 -22
- package/dist/container/middleware.resolver.d.ts +0 -9
- package/dist/container/middleware.resolver.js +0 -35
- package/dist/default-routes-carno.d.ts +0 -3
- package/dist/default-routes-carno.js +0 -29
- package/dist/domain/BaseContext.d.ts +0 -15
- package/dist/domain/BaseContext.js +0 -2
- package/dist/domain/CarnoClosure.d.ts +0 -1
- package/dist/domain/CarnoClosure.js +0 -2
- package/dist/domain/CarnoMiddleware.d.ts +0 -5
- package/dist/domain/CarnoMiddleware.js +0 -2
- package/dist/domain/Context.d.ts +0 -58
- package/dist/domain/Context.js +0 -188
- package/dist/domain/FastContext.d.ts +0 -34
- package/dist/domain/FastContext.js +0 -59
- package/dist/domain/LocalsContainer.d.ts +0 -4
- package/dist/domain/LocalsContainer.js +0 -10
- package/dist/domain/Metadata.d.ts +0 -449
- package/dist/domain/Metadata.js +0 -511
- package/dist/domain/cors-config.d.ts +0 -12
- package/dist/domain/cors-config.js +0 -18
- package/dist/domain/cors-headers-cache.d.ts +0 -17
- package/dist/domain/cors-headers-cache.js +0 -101
- package/dist/domain/http-method.d.ts +0 -7
- package/dist/domain/http-method.js +0 -11
- package/dist/domain/index.d.ts +0 -10
- package/dist/domain/index.js +0 -26
- package/dist/domain/provider-scope.d.ts +0 -5
- package/dist/domain/provider-scope.js +0 -9
- package/dist/domain/provider-type.d.ts +0 -6
- package/dist/domain/provider-type.js +0 -10
- package/dist/domain/provider.d.ts +0 -37
- package/dist/domain/provider.js +0 -70
- package/dist/events/hooks.decorator.d.ts +0 -3
- package/dist/events/hooks.decorator.js +0 -29
- package/dist/events/index.d.ts +0 -2
- package/dist/events/index.js +0 -18
- package/dist/events/on-event.d.ts +0 -13
- package/dist/events/on-event.js +0 -11
- package/dist/exceptions/HttpException.d.ts +0 -9
- package/dist/exceptions/index.d.ts +0 -1
- package/dist/exceptions/index.js +0 -17
- package/dist/index.d.ts +0 -16
- package/dist/route/CompiledRoute.d.ts +0 -23
- package/dist/route/CompiledRoute.js +0 -9
- package/dist/route/FastPathExecutor.d.ts +0 -12
- package/dist/route/FastPathExecutor.js +0 -50
- package/dist/route/JITCompiler.d.ts +0 -28
- package/dist/route/JITCompiler.js +0 -245
- package/dist/route/Matcher.d.ts +0 -11
- package/dist/route/Matcher.js +0 -48
- package/dist/route/ParamResolverFactory.d.ts +0 -14
- package/dist/route/ParamResolverFactory.js +0 -49
- package/dist/route/RouteCompiler.d.ts +0 -28
- package/dist/route/RouteCompiler.js +0 -157
- package/dist/route/RouteExecutor.d.ts +0 -12
- package/dist/route/RouteExecutor.js +0 -84
- package/dist/route/memoirist.d.ts +0 -31
- package/dist/route/memoirist.js +0 -373
- package/dist/services/logger.service.d.ts +0 -23
- package/dist/services/logger.service.js +0 -47
- package/dist/testing/core-testing.d.ts +0 -24
- package/dist/testing/core-testing.js +0 -102
- package/dist/testing/index.d.ts +0 -1
- package/dist/testing/index.js +0 -17
- package/dist/utils/ValidationCache.d.ts +0 -5
- package/dist/utils/ValidationCache.js +0 -35
- package/dist/utils/ancestorOf.d.ts +0 -2
- package/dist/utils/ancestorOf.js +0 -10
- package/dist/utils/ancestorsOf.d.ts +0 -6
- package/dist/utils/ancestorsOf.js +0 -20
- package/dist/utils/classOf.d.ts +0 -13
- package/dist/utils/classOf.js +0 -21
- package/dist/utils/cleanObject.d.ts +0 -6
- package/dist/utils/cleanObject.js +0 -22
- package/dist/utils/constructorOf.d.ts +0 -11
- package/dist/utils/constructorOf.js +0 -18
- package/dist/utils/createInstance.d.ts +0 -1
- package/dist/utils/createInstance.js +0 -7
- package/dist/utils/decoratorTypeOf.d.ts +0 -11
- package/dist/utils/decoratorTypeOf.js +0 -32
- package/dist/utils/deepClone.d.ts +0 -6
- package/dist/utils/deepClone.js +0 -63
- package/dist/utils/deepMerge.d.ts +0 -9
- package/dist/utils/deepMerge.js +0 -62
- package/dist/utils/descriptorOf.d.ts +0 -8
- package/dist/utils/descriptorOf.js +0 -16
- package/dist/utils/formatValidationErrors.d.ts +0 -5
- package/dist/utils/formatValidationErrors.js +0 -80
- package/dist/utils/getClassOrSymbol.d.ts +0 -1
- package/dist/utils/getClassOrSymbol.js +0 -8
- package/dist/utils/getConstructorArgNames.d.ts +0 -1
- package/dist/utils/getConstructorArgNames.js +0 -12
- package/dist/utils/getMethodArgTypes.d.ts +0 -1
- package/dist/utils/getMethodArgTypes.js +0 -9
- package/dist/utils/getValue.d.ts +0 -32
- package/dist/utils/getValue.js +0 -47
- package/dist/utils/hasJsonMethod.d.ts +0 -1
- package/dist/utils/hasJsonMethod.js +0 -6
- package/dist/utils/index.d.ts +0 -15
- package/dist/utils/index.js +0 -31
- package/dist/utils/isArray.d.ts +0 -13
- package/dist/utils/isArray.js +0 -21
- package/dist/utils/isArrowFn.d.ts +0 -1
- package/dist/utils/isArrowFn.js +0 -7
- package/dist/utils/isBoolean.d.ts +0 -7
- package/dist/utils/isBoolean.js +0 -15
- package/dist/utils/isBuffer.d.ts +0 -7
- package/dist/utils/isBuffer.js +0 -19
- package/dist/utils/isClass.d.ts +0 -1
- package/dist/utils/isClass.js +0 -26
- package/dist/utils/isCollection.d.ts +0 -6
- package/dist/utils/isCollection.js +0 -20
- package/dist/utils/isDate.d.ts +0 -6
- package/dist/utils/isDate.js +0 -11
- package/dist/utils/isEmpty.d.ts +0 -6
- package/dist/utils/isEmpty.js +0 -12
- package/dist/utils/isFunction.d.ts +0 -1
- package/dist/utils/isFunction.js +0 -6
- package/dist/utils/isInheritedFrom.d.ts +0 -1
- package/dist/utils/isInheritedFrom.js +0 -24
- package/dist/utils/isMomentObject.d.ts +0 -1
- package/dist/utils/isMomentObject.js +0 -6
- package/dist/utils/isMongooseObject.d.ts +0 -2
- package/dist/utils/isMongooseObject.js +0 -11
- package/dist/utils/isNil.d.ts +0 -1
- package/dist/utils/isNil.js +0 -6
- package/dist/utils/isNumber.d.ts +0 -7
- package/dist/utils/isNumber.js +0 -15
- package/dist/utils/isObject.d.ts +0 -1
- package/dist/utils/isObject.js +0 -6
- package/dist/utils/isObservable.d.ts +0 -1
- package/dist/utils/isObservable.js +0 -6
- package/dist/utils/isPlainObject.d.ts +0 -7
- package/dist/utils/isPlainObject.js +0 -16
- package/dist/utils/isPrimitive.d.ts +0 -14
- package/dist/utils/isPrimitive.js +0 -28
- package/dist/utils/isPrimitiveType.d.ts +0 -1
- package/dist/utils/isPrimitiveType.js +0 -11
- package/dist/utils/isPromise.d.ts +0 -7
- package/dist/utils/isPromise.js +0 -14
- package/dist/utils/isProtectedKey.d.ts +0 -5
- package/dist/utils/isProtectedKey.js +0 -10
- package/dist/utils/isRegExp.d.ts +0 -1
- package/dist/utils/isRegExp.js +0 -6
- package/dist/utils/isRequestScope.d.ts +0 -11
- package/dist/utils/isRequestScope.js +0 -23
- package/dist/utils/isSerializable.d.ts +0 -1
- package/dist/utils/isSerializable.js +0 -11
- package/dist/utils/isStream.d.ts +0 -1
- package/dist/utils/isStream.js +0 -6
- package/dist/utils/isString.d.ts +0 -6
- package/dist/utils/isString.js +0 -14
- package/dist/utils/isSymbol.d.ts +0 -6
- package/dist/utils/isSymbol.js +0 -14
- package/dist/utils/methodsOf.d.ts +0 -9
- package/dist/utils/methodsOf.js +0 -24
- package/dist/utils/nameOf.d.ts +0 -14
- package/dist/utils/nameOf.js +0 -31
- package/dist/utils/objectKeys.d.ts +0 -1
- package/dist/utils/objectKeys.js +0 -7
- package/dist/utils/primitiveOf.d.ts +0 -1
- package/dist/utils/primitiveOf.js +0 -18
- package/dist/utils/prototypeOf.d.ts +0 -6
- package/dist/utils/prototypeOf.js +0 -12
- package/dist/utils/setValue.d.ts +0 -1
- package/dist/utils/setValue.js +0 -32
- package/dist/utils/toMap.d.ts +0 -3
- package/dist/utils/toMap.js +0 -34
- package/dist/utils/toStringConstructor.d.ts +0 -1
- package/dist/utils/toStringConstructor.js +0 -10
- package/dist/validation/ValidatorAdapter.d.ts +0 -66
- package/dist/validation/adapters/ClassValidatorAdapter.d.ts +0 -23
- package/dist/validation/adapters/ClassValidatorAdapter.js +0 -47
- package/dist/validation/adapters/ZodAdapter.d.ts +0 -14
- package/dist/validation/adapters/ZodAdapter.js +0 -56
- package/dist/validation/adapters/index.d.ts +0 -4
- package/dist/validation/adapters/index.js +0 -7
- package/dist/validation/index.d.ts +0 -3
- package/dist/validation/index.js +0 -20
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
8
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
15
|
+
var Service_exports = {};
|
|
16
|
+
__export(Service_exports, {
|
|
17
|
+
Service: () => Service
|
|
18
|
+
});
|
|
19
|
+
module.exports = __toCommonJS(Service_exports);
|
|
20
|
+
var import_metadata = require('../metadata.js'), import_Container = require('../container/Container.js');
|
|
21
|
+
function Service(options = {}) {
|
|
22
|
+
return (target) => {
|
|
23
|
+
Reflect.defineMetadata(import_metadata.SERVICE_META, {
|
|
24
|
+
scope: options.scope ?? import_Container.Scope.SINGLETON
|
|
25
|
+
}, target);
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
29
|
+
0 && (module.exports = {
|
|
30
|
+
Service
|
|
31
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SERVICE_META } from "../metadata.mjs";
|
|
2
|
+
import { Scope } from "../container/Container.mjs";
|
|
3
|
+
function Service(options = {}) {
|
|
4
|
+
return (target) => {
|
|
5
|
+
Reflect.defineMetadata(SERVICE_META, {
|
|
6
|
+
scope: options.scope ?? Scope.SINGLETON
|
|
7
|
+
}, target);
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
Service
|
|
12
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
8
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
15
|
+
var methods_exports = {};
|
|
16
|
+
__export(methods_exports, {
|
|
17
|
+
Delete: () => Delete,
|
|
18
|
+
Get: () => Get,
|
|
19
|
+
Head: () => Head,
|
|
20
|
+
Options: () => Options,
|
|
21
|
+
Patch: () => Patch,
|
|
22
|
+
Post: () => Post,
|
|
23
|
+
Put: () => Put
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(methods_exports);
|
|
26
|
+
var import_metadata = require('../metadata.js');
|
|
27
|
+
function createMethodDecorator(method) {
|
|
28
|
+
return function(path = "") {
|
|
29
|
+
return function(targetOrMethod, contextOrPropertyKey, descriptor) {
|
|
30
|
+
if (contextOrPropertyKey && typeof contextOrPropertyKey == "object" && "kind" in contextOrPropertyKey) {
|
|
31
|
+
const context = contextOrPropertyKey;
|
|
32
|
+
return context.addInitializer(function() {
|
|
33
|
+
const constructor2 = this.constructor, routes2 = Reflect.getMetadata(import_metadata.ROUTES_META, constructor2) || [];
|
|
34
|
+
routes2.push({
|
|
35
|
+
method,
|
|
36
|
+
path: path.startsWith("/") ? path : "/" + path,
|
|
37
|
+
handlerName: String(context.name)
|
|
38
|
+
}), Reflect.defineMetadata(import_metadata.ROUTES_META, routes2, constructor2);
|
|
39
|
+
}), targetOrMethod;
|
|
40
|
+
}
|
|
41
|
+
const constructor = targetOrMethod.constructor, propertyKey = contextOrPropertyKey, routes = Reflect.getMetadata(import_metadata.ROUTES_META, constructor) || [];
|
|
42
|
+
routes.push({
|
|
43
|
+
method,
|
|
44
|
+
path: path.startsWith("/") ? path : "/" + path,
|
|
45
|
+
handlerName: String(propertyKey)
|
|
46
|
+
}), Reflect.defineMetadata(import_metadata.ROUTES_META, routes, constructor);
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
const Get = createMethodDecorator("get"), Post = createMethodDecorator("post"), Put = createMethodDecorator("put"), Delete = createMethodDecorator("delete"), Patch = createMethodDecorator("patch"), Head = createMethodDecorator("head"), Options = createMethodDecorator("options");
|
|
51
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
52
|
+
0 && (module.exports = {
|
|
53
|
+
Delete,
|
|
54
|
+
Get,
|
|
55
|
+
Head,
|
|
56
|
+
Options,
|
|
57
|
+
Patch,
|
|
58
|
+
Post,
|
|
59
|
+
Put
|
|
60
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ROUTES_META } from "../metadata.mjs";
|
|
2
|
+
function createMethodDecorator(method) {
|
|
3
|
+
return function(path = "") {
|
|
4
|
+
return function(targetOrMethod, contextOrPropertyKey, descriptor) {
|
|
5
|
+
if (contextOrPropertyKey && typeof contextOrPropertyKey == "object" && "kind" in contextOrPropertyKey) {
|
|
6
|
+
const context = contextOrPropertyKey;
|
|
7
|
+
return context.addInitializer(function() {
|
|
8
|
+
const constructor2 = this.constructor, routes2 = Reflect.getMetadata(ROUTES_META, constructor2) || [];
|
|
9
|
+
routes2.push({
|
|
10
|
+
method,
|
|
11
|
+
path: path.startsWith("/") ? path : "/" + path,
|
|
12
|
+
handlerName: String(context.name)
|
|
13
|
+
}), Reflect.defineMetadata(ROUTES_META, routes2, constructor2);
|
|
14
|
+
}), targetOrMethod;
|
|
15
|
+
}
|
|
16
|
+
const constructor = targetOrMethod.constructor, propertyKey = contextOrPropertyKey, routes = Reflect.getMetadata(ROUTES_META, constructor) || [];
|
|
17
|
+
routes.push({
|
|
18
|
+
method,
|
|
19
|
+
path: path.startsWith("/") ? path : "/" + path,
|
|
20
|
+
handlerName: String(propertyKey)
|
|
21
|
+
}), Reflect.defineMetadata(ROUTES_META, routes, constructor);
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
const Get = createMethodDecorator("get"), Post = createMethodDecorator("post"), Put = createMethodDecorator("put"), Delete = createMethodDecorator("delete"), Patch = createMethodDecorator("patch"), Head = createMethodDecorator("head"), Options = createMethodDecorator("options");
|
|
26
|
+
export {
|
|
27
|
+
Delete,
|
|
28
|
+
Get,
|
|
29
|
+
Head,
|
|
30
|
+
Options,
|
|
31
|
+
Patch,
|
|
32
|
+
Post,
|
|
33
|
+
Put
|
|
34
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
8
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
15
|
+
var params_exports = {};
|
|
16
|
+
__export(params_exports, {
|
|
17
|
+
Body: () => Body,
|
|
18
|
+
Ctx: () => Ctx,
|
|
19
|
+
Header: () => Header,
|
|
20
|
+
Locals: () => Locals,
|
|
21
|
+
Param: () => Param,
|
|
22
|
+
Query: () => Query,
|
|
23
|
+
Req: () => Req
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(params_exports);
|
|
26
|
+
var import_metadata = require('../metadata.js');
|
|
27
|
+
function createParamDecorator(type, key) {
|
|
28
|
+
return function(target, propertyKey, index) {
|
|
29
|
+
const params = Reflect.getMetadata(import_metadata.PARAMS_META, target.constructor, propertyKey) || [];
|
|
30
|
+
params.push({ type, key, index }), Reflect.defineMetadata(import_metadata.PARAMS_META, params, target.constructor, propertyKey);
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function Param(key) {
|
|
34
|
+
return createParamDecorator("param", key);
|
|
35
|
+
}
|
|
36
|
+
function Query(key) {
|
|
37
|
+
return createParamDecorator("query", key);
|
|
38
|
+
}
|
|
39
|
+
function Body(key) {
|
|
40
|
+
return createParamDecorator("body", key);
|
|
41
|
+
}
|
|
42
|
+
function Header(key) {
|
|
43
|
+
return createParamDecorator("header", key);
|
|
44
|
+
}
|
|
45
|
+
function Req() {
|
|
46
|
+
return createParamDecorator("req");
|
|
47
|
+
}
|
|
48
|
+
function Ctx() {
|
|
49
|
+
return createParamDecorator("ctx");
|
|
50
|
+
}
|
|
51
|
+
function Locals(key) {
|
|
52
|
+
return createParamDecorator("locals", key);
|
|
53
|
+
}
|
|
54
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
55
|
+
0 && (module.exports = {
|
|
56
|
+
Body,
|
|
57
|
+
Ctx,
|
|
58
|
+
Header,
|
|
59
|
+
Locals,
|
|
60
|
+
Param,
|
|
61
|
+
Query,
|
|
62
|
+
Req
|
|
63
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { PARAMS_META } from "../metadata.mjs";
|
|
2
|
+
function createParamDecorator(type, key) {
|
|
3
|
+
return function(target, propertyKey, index) {
|
|
4
|
+
const params = Reflect.getMetadata(PARAMS_META, target.constructor, propertyKey) || [];
|
|
5
|
+
params.push({ type, key, index }), Reflect.defineMetadata(PARAMS_META, params, target.constructor, propertyKey);
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
function Param(key) {
|
|
9
|
+
return createParamDecorator("param", key);
|
|
10
|
+
}
|
|
11
|
+
function Query(key) {
|
|
12
|
+
return createParamDecorator("query", key);
|
|
13
|
+
}
|
|
14
|
+
function Body(key) {
|
|
15
|
+
return createParamDecorator("body", key);
|
|
16
|
+
}
|
|
17
|
+
function Header(key) {
|
|
18
|
+
return createParamDecorator("header", key);
|
|
19
|
+
}
|
|
20
|
+
function Req() {
|
|
21
|
+
return createParamDecorator("req");
|
|
22
|
+
}
|
|
23
|
+
function Ctx() {
|
|
24
|
+
return createParamDecorator("ctx");
|
|
25
|
+
}
|
|
26
|
+
function Locals(key) {
|
|
27
|
+
return createParamDecorator("locals", key);
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
Body,
|
|
31
|
+
Ctx,
|
|
32
|
+
Header,
|
|
33
|
+
Locals,
|
|
34
|
+
Param,
|
|
35
|
+
Query,
|
|
36
|
+
Req
|
|
37
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
8
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
15
|
+
var Lifecycle_exports = {};
|
|
16
|
+
__export(Lifecycle_exports, {
|
|
17
|
+
EVENTS_META: () => EVENTS_META,
|
|
18
|
+
EventType: () => EventType,
|
|
19
|
+
OnApplicationBoot: () => OnApplicationBoot,
|
|
20
|
+
OnApplicationInit: () => OnApplicationInit,
|
|
21
|
+
OnApplicationShutdown: () => OnApplicationShutdown,
|
|
22
|
+
clearEventRegistry: () => clearEventRegistry,
|
|
23
|
+
getEventHandlers: () => getEventHandlers,
|
|
24
|
+
hasEventHandlers: () => hasEventHandlers,
|
|
25
|
+
registerEvent: () => registerEvent
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(Lifecycle_exports);
|
|
28
|
+
var EventType = /* @__PURE__ */ ((EventType2) => (EventType2.INIT = "onInit", EventType2.BOOT = "onBoot", EventType2.SHUTDOWN = "onShutdown", EventType2))(EventType || {});
|
|
29
|
+
const EVENTS_META = /* @__PURE__ */ Symbol("turbo:events"), eventRegistry = /* @__PURE__ */ new Map();
|
|
30
|
+
function registerEvent(type, target, methodName, priority = 0) {
|
|
31
|
+
let handlers = eventRegistry.get(type);
|
|
32
|
+
handlers || (handlers = [], eventRegistry.set(type, handlers)), handlers.push({ target, methodName, priority });
|
|
33
|
+
}
|
|
34
|
+
function getEventHandlers(type) {
|
|
35
|
+
return (eventRegistry.get(type) || []).sort((a, b) => b.priority - a.priority);
|
|
36
|
+
}
|
|
37
|
+
function hasEventHandlers(type) {
|
|
38
|
+
return (eventRegistry.get(type)?.length ?? 0) > 0;
|
|
39
|
+
}
|
|
40
|
+
function clearEventRegistry() {
|
|
41
|
+
eventRegistry.clear();
|
|
42
|
+
}
|
|
43
|
+
function OnApplicationInit(priority = 0) {
|
|
44
|
+
return function(target, propertyKey) {
|
|
45
|
+
registerEvent("onInit" /* INIT */, target.constructor, propertyKey, priority);
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function OnApplicationBoot(priority = 0) {
|
|
49
|
+
return function(target, propertyKey) {
|
|
50
|
+
registerEvent("onBoot" /* BOOT */, target.constructor, propertyKey, priority);
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function OnApplicationShutdown(priority = 0) {
|
|
54
|
+
return function(target, propertyKey) {
|
|
55
|
+
registerEvent("onShutdown" /* SHUTDOWN */, target.constructor, propertyKey, priority);
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
59
|
+
0 && (module.exports = {
|
|
60
|
+
EVENTS_META,
|
|
61
|
+
EventType,
|
|
62
|
+
OnApplicationBoot,
|
|
63
|
+
OnApplicationInit,
|
|
64
|
+
OnApplicationShutdown,
|
|
65
|
+
clearEventRegistry,
|
|
66
|
+
getEventHandlers,
|
|
67
|
+
hasEventHandlers,
|
|
68
|
+
registerEvent
|
|
69
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
var EventType = /* @__PURE__ */ ((EventType2) => (EventType2.INIT = "onInit", EventType2.BOOT = "onBoot", EventType2.SHUTDOWN = "onShutdown", EventType2))(EventType || {});
|
|
2
|
+
const EVENTS_META = /* @__PURE__ */ Symbol("turbo:events"), eventRegistry = /* @__PURE__ */ new Map();
|
|
3
|
+
function registerEvent(type, target, methodName, priority = 0) {
|
|
4
|
+
let handlers = eventRegistry.get(type);
|
|
5
|
+
handlers || (handlers = [], eventRegistry.set(type, handlers)), handlers.push({ target, methodName, priority });
|
|
6
|
+
}
|
|
7
|
+
function getEventHandlers(type) {
|
|
8
|
+
return (eventRegistry.get(type) || []).sort((a, b) => b.priority - a.priority);
|
|
9
|
+
}
|
|
10
|
+
function hasEventHandlers(type) {
|
|
11
|
+
return (eventRegistry.get(type)?.length ?? 0) > 0;
|
|
12
|
+
}
|
|
13
|
+
function clearEventRegistry() {
|
|
14
|
+
eventRegistry.clear();
|
|
15
|
+
}
|
|
16
|
+
function OnApplicationInit(priority = 0) {
|
|
17
|
+
return function(target, propertyKey) {
|
|
18
|
+
registerEvent("onInit" /* INIT */, target.constructor, propertyKey, priority);
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function OnApplicationBoot(priority = 0) {
|
|
22
|
+
return function(target, propertyKey) {
|
|
23
|
+
registerEvent("onBoot" /* BOOT */, target.constructor, propertyKey, priority);
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function OnApplicationShutdown(priority = 0) {
|
|
27
|
+
return function(target, propertyKey) {
|
|
28
|
+
registerEvent("onShutdown" /* SHUTDOWN */, target.constructor, propertyKey, priority);
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
EVENTS_META,
|
|
33
|
+
EventType,
|
|
34
|
+
OnApplicationBoot,
|
|
35
|
+
OnApplicationInit,
|
|
36
|
+
OnApplicationShutdown,
|
|
37
|
+
clearEventRegistry,
|
|
38
|
+
getEventHandlers,
|
|
39
|
+
hasEventHandlers,
|
|
40
|
+
registerEvent
|
|
41
|
+
};
|
|
@@ -1,26 +1,112 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
8
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
15
|
+
var HttpException_exports = {};
|
|
16
|
+
__export(HttpException_exports, {
|
|
17
|
+
BadRequestException: () => BadRequestException,
|
|
18
|
+
ConflictException: () => ConflictException,
|
|
19
|
+
ForbiddenException: () => ForbiddenException,
|
|
20
|
+
HttpException: () => HttpException,
|
|
21
|
+
InternalServerErrorException: () => InternalServerErrorException,
|
|
22
|
+
MethodNotAllowedException: () => MethodNotAllowedException,
|
|
23
|
+
NotFoundException: () => NotFoundException,
|
|
24
|
+
ServiceUnavailableException: () => ServiceUnavailableException,
|
|
25
|
+
TooManyRequestsException: () => TooManyRequestsException,
|
|
26
|
+
UnauthorizedException: () => UnauthorizedException,
|
|
27
|
+
UnprocessableEntityException: () => UnprocessableEntityException
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(HttpException_exports);
|
|
30
|
+
class HttpException extends Error {
|
|
31
|
+
constructor(statusCode, message, errors) {
|
|
32
|
+
super(message);
|
|
33
|
+
this.statusCode = statusCode;
|
|
34
|
+
this.errors = errors;
|
|
35
|
+
this.name = "HttpException";
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Convert exception to Response.
|
|
39
|
+
*/
|
|
40
|
+
toResponse() {
|
|
41
|
+
const body = {
|
|
42
|
+
statusCode: this.statusCode,
|
|
43
|
+
message: this.message,
|
|
44
|
+
...this.errors && { errors: this.errors }
|
|
45
|
+
};
|
|
46
|
+
return Response.json(body, { status: this.statusCode });
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
class BadRequestException extends HttpException {
|
|
50
|
+
constructor(message = "Bad Request", errors) {
|
|
51
|
+
super(400, message, errors), this.name = "BadRequestException";
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
class UnauthorizedException extends HttpException {
|
|
55
|
+
constructor(message = "Unauthorized") {
|
|
56
|
+
super(401, message), this.name = "UnauthorizedException";
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
class ForbiddenException extends HttpException {
|
|
60
|
+
constructor(message = "Forbidden") {
|
|
61
|
+
super(403, message), this.name = "ForbiddenException";
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
class NotFoundException extends HttpException {
|
|
65
|
+
constructor(message = "Not Found") {
|
|
66
|
+
super(404, message), this.name = "NotFoundException";
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
class MethodNotAllowedException extends HttpException {
|
|
70
|
+
constructor(message = "Method Not Allowed") {
|
|
71
|
+
super(405, message), this.name = "MethodNotAllowedException";
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
class ConflictException extends HttpException {
|
|
75
|
+
constructor(message = "Conflict") {
|
|
76
|
+
super(409, message), this.name = "ConflictException";
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
class UnprocessableEntityException extends HttpException {
|
|
80
|
+
constructor(message = "Unprocessable Entity", errors) {
|
|
81
|
+
super(422, message, errors), this.name = "UnprocessableEntityException";
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
class TooManyRequestsException extends HttpException {
|
|
85
|
+
constructor(message = "Too Many Requests") {
|
|
86
|
+
super(429, message), this.name = "TooManyRequestsException";
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
class InternalServerErrorException extends HttpException {
|
|
90
|
+
constructor(message = "Internal Server Error") {
|
|
91
|
+
super(500, message), this.name = "InternalServerErrorException";
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
class ServiceUnavailableException extends HttpException {
|
|
95
|
+
constructor(message = "Service Unavailable") {
|
|
96
|
+
super(503, message), this.name = "ServiceUnavailableException";
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
100
|
+
0 && (module.exports = {
|
|
101
|
+
BadRequestException,
|
|
102
|
+
ConflictException,
|
|
103
|
+
ForbiddenException,
|
|
104
|
+
HttpException,
|
|
105
|
+
InternalServerErrorException,
|
|
106
|
+
MethodNotAllowedException,
|
|
107
|
+
NotFoundException,
|
|
108
|
+
ServiceUnavailableException,
|
|
109
|
+
TooManyRequestsException,
|
|
110
|
+
UnauthorizedException,
|
|
111
|
+
UnprocessableEntityException
|
|
112
|
+
});
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
class HttpException extends Error {
|
|
2
|
+
constructor(statusCode, message, errors) {
|
|
3
|
+
super(message);
|
|
4
|
+
this.statusCode = statusCode;
|
|
5
|
+
this.errors = errors;
|
|
6
|
+
this.name = "HttpException";
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Convert exception to Response.
|
|
10
|
+
*/
|
|
11
|
+
toResponse() {
|
|
12
|
+
const body = {
|
|
13
|
+
statusCode: this.statusCode,
|
|
14
|
+
message: this.message,
|
|
15
|
+
...this.errors && { errors: this.errors }
|
|
16
|
+
};
|
|
17
|
+
return Response.json(body, { status: this.statusCode });
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
class BadRequestException extends HttpException {
|
|
21
|
+
constructor(message = "Bad Request", errors) {
|
|
22
|
+
super(400, message, errors), this.name = "BadRequestException";
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
class UnauthorizedException extends HttpException {
|
|
26
|
+
constructor(message = "Unauthorized") {
|
|
27
|
+
super(401, message), this.name = "UnauthorizedException";
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
class ForbiddenException extends HttpException {
|
|
31
|
+
constructor(message = "Forbidden") {
|
|
32
|
+
super(403, message), this.name = "ForbiddenException";
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
class NotFoundException extends HttpException {
|
|
36
|
+
constructor(message = "Not Found") {
|
|
37
|
+
super(404, message), this.name = "NotFoundException";
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
class MethodNotAllowedException extends HttpException {
|
|
41
|
+
constructor(message = "Method Not Allowed") {
|
|
42
|
+
super(405, message), this.name = "MethodNotAllowedException";
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
class ConflictException extends HttpException {
|
|
46
|
+
constructor(message = "Conflict") {
|
|
47
|
+
super(409, message), this.name = "ConflictException";
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
class UnprocessableEntityException extends HttpException {
|
|
51
|
+
constructor(message = "Unprocessable Entity", errors) {
|
|
52
|
+
super(422, message, errors), this.name = "UnprocessableEntityException";
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
class TooManyRequestsException extends HttpException {
|
|
56
|
+
constructor(message = "Too Many Requests") {
|
|
57
|
+
super(429, message), this.name = "TooManyRequestsException";
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
class InternalServerErrorException extends HttpException {
|
|
61
|
+
constructor(message = "Internal Server Error") {
|
|
62
|
+
super(500, message), this.name = "InternalServerErrorException";
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
class ServiceUnavailableException extends HttpException {
|
|
66
|
+
constructor(message = "Service Unavailable") {
|
|
67
|
+
super(503, message), this.name = "ServiceUnavailableException";
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
export {
|
|
71
|
+
BadRequestException,
|
|
72
|
+
ConflictException,
|
|
73
|
+
ForbiddenException,
|
|
74
|
+
HttpException,
|
|
75
|
+
InternalServerErrorException,
|
|
76
|
+
MethodNotAllowedException,
|
|
77
|
+
NotFoundException,
|
|
78
|
+
ServiceUnavailableException,
|
|
79
|
+
TooManyRequestsException,
|
|
80
|
+
UnauthorizedException,
|
|
81
|
+
UnprocessableEntityException
|
|
82
|
+
};
|