@lakutata/entrypoint 3.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +23 -0
- package/README.md +183 -0
- package/THIRD_PARTY_NOTICES.md +206 -0
- package/dist/cjs/Entrypoint.d.ts +868 -0
- package/dist/cjs/Entrypoint.js +998 -0
- package/dist/cjs/adapter/commander/CommanderCLIEntrypoint.d.ts +192 -0
- package/dist/cjs/adapter/commander/CommanderCLIEntrypoint.js +439 -0
- package/dist/cjs/adapter/commander/Prompt.d.ts +22 -0
- package/dist/cjs/adapter/commander/Prompt.js +164 -0
- package/dist/cjs/adapter/commander/Width.d.ts +12 -0
- package/dist/cjs/adapter/commander/Width.js +67 -0
- package/dist/cjs/adapter/electron/ElectronIPCServiceEntrypoint.d.ts +203 -0
- package/dist/cjs/adapter/electron/ElectronIPCServiceEntrypoint.js +249 -0
- package/dist/cjs/adapter/express/ExpressHTTPEntrypoint.d.ts +172 -0
- package/dist/cjs/adapter/express/ExpressHTTPEntrypoint.js +301 -0
- package/dist/cjs/adapter/express/Responders.d.ts +89 -0
- package/dist/cjs/adapter/express/Responders.js +71 -0
- package/dist/cjs/adapter/express/StaticUI.d.ts +83 -0
- package/dist/cjs/adapter/express/StaticUI.js +104 -0
- package/dist/cjs/adapter/fastify/FastifyHTTPEntrypoint.d.ts +156 -0
- package/dist/cjs/adapter/fastify/FastifyHTTPEntrypoint.js +339 -0
- package/dist/cjs/adapter/fastify/Responders.d.ts +88 -0
- package/dist/cjs/adapter/fastify/Responders.js +77 -0
- package/dist/cjs/adapter/http/HTTPServiceEntrypoint.d.ts +117 -0
- package/dist/cjs/adapter/http/HTTPServiceEntrypoint.js +257 -0
- package/dist/cjs/adapter/jsonrpc/JSONRPCProtocol.d.ts +194 -0
- package/dist/cjs/adapter/jsonrpc/JSONRPCProtocol.js +187 -0
- package/dist/cjs/adapter/jsonrpc/JSONRPCServiceEntrypoint.d.ts +154 -0
- package/dist/cjs/adapter/jsonrpc/JSONRPCServiceEntrypoint.js +397 -0
- package/dist/cjs/adapter/schedule/ScheduleEntrypoint.d.ts +86 -0
- package/dist/cjs/adapter/schedule/ScheduleEntrypoint.js +275 -0
- package/dist/cjs/adapter/socket.io/SocketIOServiceEntrypoint.d.ts +138 -0
- package/dist/cjs/adapter/socket.io/SocketIOServiceEntrypoint.js +216 -0
- package/dist/cjs/channel/BuiltinChannels.d.ts +18 -0
- package/dist/cjs/channel/BuiltinChannels.js +128 -0
- package/dist/cjs/channel/Channel.d.ts +196 -0
- package/dist/cjs/channel/Channel.js +106 -0
- package/dist/cjs/channel/EntrypointAdapter.d.ts +195 -0
- package/dist/cjs/channel/EntrypointAdapter.js +43 -0
- package/dist/cjs/context/BaseContext.d.ts +75 -0
- package/dist/cjs/context/BaseContext.js +90 -0
- package/dist/cjs/context/CLIContext.d.ts +38 -0
- package/dist/cjs/context/CLIContext.js +53 -0
- package/dist/cjs/context/HTTPContext.d.ts +52 -0
- package/dist/cjs/context/HTTPContext.js +78 -0
- package/dist/cjs/context/ScheduleContext.d.ts +47 -0
- package/dist/cjs/context/ScheduleContext.js +65 -0
- package/dist/cjs/context/ServiceContext.d.ts +47 -0
- package/dist/cjs/context/ServiceContext.js +62 -0
- package/dist/cjs/decorators/CLIAction.d.ts +120 -0
- package/dist/cjs/decorators/CLIAction.js +13 -0
- package/dist/cjs/decorators/HTTPAction.d.ts +178 -0
- package/dist/cjs/decorators/HTTPAction.js +14 -0
- package/dist/cjs/decorators/Prefix.d.ts +44 -0
- package/dist/cjs/decorators/Prefix.js +48 -0
- package/dist/cjs/decorators/Schedule.d.ts +120 -0
- package/dist/cjs/decorators/Schedule.js +64 -0
- package/dist/cjs/decorators/ServiceAction.d.ts +116 -0
- package/dist/cjs/decorators/ServiceAction.js +12 -0
- package/dist/cjs/decorators/UseMiddlewares.d.ts +52 -0
- package/dist/cjs/decorators/UseMiddlewares.js +58 -0
- package/dist/cjs/decorators/http/DELETE.d.ts +87 -0
- package/dist/cjs/decorators/http/DELETE.js +7 -0
- package/dist/cjs/decorators/http/GET.d.ts +89 -0
- package/dist/cjs/decorators/http/GET.js +7 -0
- package/dist/cjs/decorators/http/HEAD.d.ts +84 -0
- package/dist/cjs/decorators/http/HEAD.js +7 -0
- package/dist/cjs/decorators/http/OPTIONS.d.ts +80 -0
- package/dist/cjs/decorators/http/OPTIONS.js +7 -0
- package/dist/cjs/decorators/http/PATCH.d.ts +90 -0
- package/dist/cjs/decorators/http/PATCH.js +7 -0
- package/dist/cjs/decorators/http/POST.d.ts +91 -0
- package/dist/cjs/decorators/http/POST.js +7 -0
- package/dist/cjs/decorators/http/PUT.d.ts +92 -0
- package/dist/cjs/decorators/http/PUT.js +7 -0
- package/dist/cjs/exceptions/AccessDeniedException.d.ts +10 -0
- package/dist/cjs/exceptions/AccessDeniedException.js +17 -0
- package/dist/cjs/exceptions/ControllerActionNotFoundException.d.ts +9 -0
- package/dist/cjs/exceptions/ControllerActionNotFoundException.js +16 -0
- package/dist/cjs/exceptions/DuplicateActionNameException.d.ts +8 -0
- package/dist/cjs/exceptions/DuplicateActionNameException.js +15 -0
- package/dist/cjs/exceptions/EntrypointStoppedException.d.ts +9 -0
- package/dist/cjs/exceptions/EntrypointStoppedException.js +16 -0
- package/dist/cjs/exceptions/InvalidActionGroupException.d.ts +4 -0
- package/dist/cjs/exceptions/InvalidActionGroupException.js +11 -0
- package/dist/cjs/exceptions/InvalidChannelException.d.ts +8 -0
- package/dist/cjs/exceptions/InvalidChannelException.js +15 -0
- package/dist/cjs/exceptions/InvalidEntrypointAdapterException.d.ts +9 -0
- package/dist/cjs/exceptions/InvalidEntrypointAdapterException.js +16 -0
- package/dist/cjs/exceptions/InvalidMiddlewareException.d.ts +8 -0
- package/dist/cjs/exceptions/InvalidMiddlewareException.js +15 -0
- package/dist/cjs/exceptions/InvalidPrefixException.d.ts +8 -0
- package/dist/cjs/exceptions/InvalidPrefixException.js +15 -0
- package/dist/cjs/exceptions/MiddlewareNextCalledException.d.ts +8 -0
- package/dist/cjs/exceptions/MiddlewareNextCalledException.js +15 -0
- package/dist/cjs/exceptions/RouteNotFoundException.d.ts +9 -0
- package/dist/cjs/exceptions/RouteNotFoundException.js +16 -0
- package/dist/cjs/exceptions/ServiceInvokeException.d.ts +11 -0
- package/dist/cjs/exceptions/ServiceInvokeException.js +14 -0
- package/dist/cjs/exports/CTRLDecorators.d.ts +13 -0
- package/dist/cjs/exports/CTRLDecorators.js +38 -0
- package/dist/cjs/exports/Channel.d.ts +14 -0
- package/dist/cjs/exports/Channel.js +33 -0
- package/dist/cjs/exports/CommanderAdapter.d.ts +1 -0
- package/dist/cjs/exports/CommanderAdapter.js +8 -0
- package/dist/cjs/exports/ElectronAdapter.d.ts +1 -0
- package/dist/cjs/exports/ElectronAdapter.js +9 -0
- package/dist/cjs/exports/Entrypoint.d.ts +24 -0
- package/dist/cjs/exports/Entrypoint.js +55 -0
- package/dist/cjs/exports/ExpressAdapter.d.ts +4 -0
- package/dist/cjs/exports/ExpressAdapter.js +15 -0
- package/dist/cjs/exports/FastifyAdapter.d.ts +4 -0
- package/dist/cjs/exports/FastifyAdapter.js +14 -0
- package/dist/cjs/exports/JSONRPCAdapter.d.ts +2 -0
- package/dist/cjs/exports/JSONRPCAdapter.js +11 -0
- package/dist/cjs/exports/SocketIOAdapter.d.ts +1 -0
- package/dist/cjs/exports/SocketIOAdapter.js +9 -0
- package/dist/cjs/lib/AccessControl.d.ts +118 -0
- package/dist/cjs/lib/AccessControl.js +208 -0
- package/dist/cjs/lib/AccessControlRule.d.ts +91 -0
- package/dist/cjs/lib/AccessControlRule.js +76 -0
- package/dist/cjs/lib/ActionOptions.d.ts +67 -0
- package/dist/cjs/lib/ActionOptions.js +67 -0
- package/dist/cjs/lib/ActionResult.d.ts +28 -0
- package/dist/cjs/lib/ActionResult.js +28 -0
- package/dist/cjs/lib/ApplicationOf.d.ts +6 -0
- package/dist/cjs/lib/ApplicationOf.js +14 -0
- package/dist/cjs/lib/Controller.d.ts +59 -0
- package/dist/cjs/lib/Controller.js +64 -0
- package/dist/cjs/lib/ControllerEntrypoint.d.ts +168 -0
- package/dist/cjs/lib/ControllerEntrypoint.js +239 -0
- package/dist/cjs/lib/GetActionDTOAndOptions.d.ts +29 -0
- package/dist/cjs/lib/GetActionDTOAndOptions.js +49 -0
- package/dist/cjs/lib/HTTPErrors.d.ts +55 -0
- package/dist/cjs/lib/HTTPErrors.js +52 -0
- package/dist/cjs/lib/Middleware.d.ts +146 -0
- package/dist/cjs/lib/Middleware.js +144 -0
- package/dist/cjs/lib/Prefix.d.ts +98 -0
- package/dist/cjs/lib/Prefix.js +151 -0
- package/dist/cjs/lib/Result.d.ts +173 -0
- package/dist/cjs/lib/Result.js +153 -0
- package/dist/cjs/lib/ServiceResponseCodec.d.ts +82 -0
- package/dist/cjs/lib/ServiceResponseCodec.js +117 -0
- package/dist/cjs/lib/StringifyPattern.d.ts +7 -0
- package/dist/cjs/lib/StringifyPattern.js +58 -0
- package/dist/cjs/lib/UnsetValue.d.ts +12 -0
- package/dist/cjs/lib/UnsetValue.js +216 -0
- package/dist/cjs/lib/pattern/GlobPattern.d.ts +34 -0
- package/dist/cjs/lib/pattern/GlobPattern.js +68 -0
- package/dist/cjs/lib/pattern/PatternManager.d.ts +103 -0
- package/dist/cjs/lib/pattern/PatternManager.js +233 -0
- package/dist/cjs/lib/schedule/Cron.d.ts +56 -0
- package/dist/cjs/lib/schedule/Cron.js +282 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/types/CLIContextParams.d.ts +14 -0
- package/dist/cjs/types/CLIContextParams.js +2 -0
- package/dist/cjs/types/ErrorDescription.d.ts +14 -0
- package/dist/cjs/types/ErrorDescription.js +2 -0
- package/dist/cjs/types/HTTPContextParams.d.ts +27 -0
- package/dist/cjs/types/HTTPContextParams.js +2 -0
- package/dist/cjs/types/ScheduleContextParams.d.ts +21 -0
- package/dist/cjs/types/ScheduleContextParams.js +2 -0
- package/dist/cjs/types/ServiceContextParams.d.ts +16 -0
- package/dist/cjs/types/ServiceContextParams.js +2 -0
- package/dist/esm/Entrypoint.js +985 -0
- package/dist/esm/adapter/commander/CommanderCLIEntrypoint.js +433 -0
- package/dist/esm/adapter/commander/Prompt.js +127 -0
- package/dist/esm/adapter/commander/Width.js +63 -0
- package/dist/esm/adapter/electron/ElectronIPCServiceEntrypoint.js +212 -0
- package/dist/esm/adapter/express/ExpressHTTPEntrypoint.js +295 -0
- package/dist/esm/adapter/express/Responders.js +66 -0
- package/dist/esm/adapter/express/StaticUI.js +96 -0
- package/dist/esm/adapter/fastify/FastifyHTTPEntrypoint.js +333 -0
- package/dist/esm/adapter/fastify/Responders.js +73 -0
- package/dist/esm/adapter/http/HTTPServiceEntrypoint.js +253 -0
- package/dist/esm/adapter/jsonrpc/JSONRPCProtocol.js +182 -0
- package/dist/esm/adapter/jsonrpc/JSONRPCServiceEntrypoint.js +361 -0
- package/dist/esm/adapter/schedule/ScheduleEntrypoint.js +272 -0
- package/dist/esm/adapter/socket.io/SocketIOServiceEntrypoint.js +212 -0
- package/dist/esm/channel/BuiltinChannels.js +125 -0
- package/dist/esm/channel/Channel.js +100 -0
- package/dist/esm/channel/EntrypointAdapter.js +39 -0
- package/dist/esm/context/BaseContext.js +87 -0
- package/dist/esm/context/CLIContext.js +49 -0
- package/dist/esm/context/HTTPContext.js +74 -0
- package/dist/esm/context/ScheduleContext.js +61 -0
- package/dist/esm/context/ServiceContext.js +58 -0
- package/dist/esm/decorators/CLIAction.js +10 -0
- package/dist/esm/decorators/HTTPAction.js +11 -0
- package/dist/esm/decorators/Prefix.js +45 -0
- package/dist/esm/decorators/Schedule.js +61 -0
- package/dist/esm/decorators/ServiceAction.js +9 -0
- package/dist/esm/decorators/UseMiddlewares.js +55 -0
- package/dist/esm/decorators/http/DELETE.js +4 -0
- package/dist/esm/decorators/http/GET.js +4 -0
- package/dist/esm/decorators/http/HEAD.js +4 -0
- package/dist/esm/decorators/http/OPTIONS.js +4 -0
- package/dist/esm/decorators/http/PATCH.js +4 -0
- package/dist/esm/decorators/http/POST.js +4 -0
- package/dist/esm/decorators/http/PUT.js +4 -0
- package/dist/esm/exceptions/AccessDeniedException.js +13 -0
- package/dist/esm/exceptions/ControllerActionNotFoundException.js +12 -0
- package/dist/esm/exceptions/DuplicateActionNameException.js +11 -0
- package/dist/esm/exceptions/EntrypointStoppedException.js +12 -0
- package/dist/esm/exceptions/InvalidActionGroupException.js +7 -0
- package/dist/esm/exceptions/InvalidChannelException.js +11 -0
- package/dist/esm/exceptions/InvalidEntrypointAdapterException.js +12 -0
- package/dist/esm/exceptions/InvalidMiddlewareException.js +11 -0
- package/dist/esm/exceptions/InvalidPrefixException.js +11 -0
- package/dist/esm/exceptions/MiddlewareNextCalledException.js +11 -0
- package/dist/esm/exceptions/RouteNotFoundException.js +12 -0
- package/dist/esm/exceptions/ServiceInvokeException.js +10 -0
- package/dist/esm/exports/CTRLDecorators.js +19 -0
- package/dist/esm/exports/Channel.js +11 -0
- package/dist/esm/exports/CommanderAdapter.js +1 -0
- package/dist/esm/exports/ElectronAdapter.js +1 -0
- package/dist/esm/exports/Entrypoint.js +22 -0
- package/dist/esm/exports/ExpressAdapter.js +3 -0
- package/dist/esm/exports/FastifyAdapter.js +3 -0
- package/dist/esm/exports/JSONRPCAdapter.js +2 -0
- package/dist/esm/exports/SocketIOAdapter.js +1 -0
- package/dist/esm/lib/AccessControl.js +204 -0
- package/dist/esm/lib/AccessControlRule.js +72 -0
- package/dist/esm/lib/ActionOptions.js +63 -0
- package/dist/esm/lib/ActionResult.js +24 -0
- package/dist/esm/lib/ApplicationOf.js +11 -0
- package/dist/esm/lib/Controller.js +61 -0
- package/dist/esm/lib/ControllerEntrypoint.js +229 -0
- package/dist/esm/lib/GetActionDTOAndOptions.js +46 -0
- package/dist/esm/lib/HTTPErrors.js +48 -0
- package/dist/esm/lib/Middleware.js +134 -0
- package/dist/esm/lib/Prefix.js +143 -0
- package/dist/esm/lib/Result.js +147 -0
- package/dist/esm/lib/ServiceResponseCodec.js +113 -0
- package/dist/esm/lib/StringifyPattern.js +55 -0
- package/dist/esm/lib/UnsetValue.js +213 -0
- package/dist/esm/lib/pattern/GlobPattern.js +64 -0
- package/dist/esm/lib/pattern/PatternManager.js +229 -0
- package/dist/esm/lib/schedule/Cron.js +277 -0
- package/dist/esm/types/CLIContextParams.js +1 -0
- package/dist/esm/types/ErrorDescription.js +1 -0
- package/dist/esm/types/HTTPContextParams.js +1 -0
- package/dist/esm/types/ScheduleContextParams.js +1 -0
- package/dist/esm/types/ServiceContextParams.js +1 -0
- package/dist/types/Entrypoint.d.ts +868 -0
- package/dist/types/adapter/commander/CommanderCLIEntrypoint.d.ts +192 -0
- package/dist/types/adapter/commander/Prompt.d.ts +22 -0
- package/dist/types/adapter/commander/Width.d.ts +12 -0
- package/dist/types/adapter/electron/ElectronIPCServiceEntrypoint.d.ts +203 -0
- package/dist/types/adapter/express/ExpressHTTPEntrypoint.d.ts +172 -0
- package/dist/types/adapter/express/Responders.d.ts +89 -0
- package/dist/types/adapter/express/StaticUI.d.ts +83 -0
- package/dist/types/adapter/fastify/FastifyHTTPEntrypoint.d.ts +156 -0
- package/dist/types/adapter/fastify/Responders.d.ts +88 -0
- package/dist/types/adapter/http/HTTPServiceEntrypoint.d.ts +117 -0
- package/dist/types/adapter/jsonrpc/JSONRPCProtocol.d.ts +194 -0
- package/dist/types/adapter/jsonrpc/JSONRPCServiceEntrypoint.d.ts +154 -0
- package/dist/types/adapter/schedule/ScheduleEntrypoint.d.ts +86 -0
- package/dist/types/adapter/socket.io/SocketIOServiceEntrypoint.d.ts +138 -0
- package/dist/types/channel/BuiltinChannels.d.ts +18 -0
- package/dist/types/channel/Channel.d.ts +196 -0
- package/dist/types/channel/EntrypointAdapter.d.ts +195 -0
- package/dist/types/context/BaseContext.d.ts +75 -0
- package/dist/types/context/CLIContext.d.ts +38 -0
- package/dist/types/context/HTTPContext.d.ts +52 -0
- package/dist/types/context/ScheduleContext.d.ts +47 -0
- package/dist/types/context/ServiceContext.d.ts +47 -0
- package/dist/types/decorators/CLIAction.d.ts +120 -0
- package/dist/types/decorators/HTTPAction.d.ts +178 -0
- package/dist/types/decorators/Prefix.d.ts +44 -0
- package/dist/types/decorators/Schedule.d.ts +120 -0
- package/dist/types/decorators/ServiceAction.d.ts +116 -0
- package/dist/types/decorators/UseMiddlewares.d.ts +52 -0
- package/dist/types/decorators/http/DELETE.d.ts +87 -0
- package/dist/types/decorators/http/GET.d.ts +89 -0
- package/dist/types/decorators/http/HEAD.d.ts +84 -0
- package/dist/types/decorators/http/OPTIONS.d.ts +80 -0
- package/dist/types/decorators/http/PATCH.d.ts +90 -0
- package/dist/types/decorators/http/POST.d.ts +91 -0
- package/dist/types/decorators/http/PUT.d.ts +92 -0
- package/dist/types/exceptions/AccessDeniedException.d.ts +10 -0
- package/dist/types/exceptions/ControllerActionNotFoundException.d.ts +9 -0
- package/dist/types/exceptions/DuplicateActionNameException.d.ts +8 -0
- package/dist/types/exceptions/EntrypointStoppedException.d.ts +9 -0
- package/dist/types/exceptions/InvalidActionGroupException.d.ts +4 -0
- package/dist/types/exceptions/InvalidChannelException.d.ts +8 -0
- package/dist/types/exceptions/InvalidEntrypointAdapterException.d.ts +9 -0
- package/dist/types/exceptions/InvalidMiddlewareException.d.ts +8 -0
- package/dist/types/exceptions/InvalidPrefixException.d.ts +8 -0
- package/dist/types/exceptions/MiddlewareNextCalledException.d.ts +8 -0
- package/dist/types/exceptions/RouteNotFoundException.d.ts +9 -0
- package/dist/types/exceptions/ServiceInvokeException.d.ts +11 -0
- package/dist/types/exports/CTRLDecorators.d.ts +13 -0
- package/dist/types/exports/Channel.d.ts +14 -0
- package/dist/types/exports/CommanderAdapter.d.ts +1 -0
- package/dist/types/exports/ElectronAdapter.d.ts +1 -0
- package/dist/types/exports/Entrypoint.d.ts +24 -0
- package/dist/types/exports/ExpressAdapter.d.ts +4 -0
- package/dist/types/exports/FastifyAdapter.d.ts +4 -0
- package/dist/types/exports/JSONRPCAdapter.d.ts +2 -0
- package/dist/types/exports/SocketIOAdapter.d.ts +1 -0
- package/dist/types/lib/AccessControl.d.ts +118 -0
- package/dist/types/lib/AccessControlRule.d.ts +91 -0
- package/dist/types/lib/ActionOptions.d.ts +67 -0
- package/dist/types/lib/ActionResult.d.ts +28 -0
- package/dist/types/lib/ApplicationOf.d.ts +6 -0
- package/dist/types/lib/Controller.d.ts +59 -0
- package/dist/types/lib/ControllerEntrypoint.d.ts +168 -0
- package/dist/types/lib/GetActionDTOAndOptions.d.ts +29 -0
- package/dist/types/lib/HTTPErrors.d.ts +55 -0
- package/dist/types/lib/Middleware.d.ts +146 -0
- package/dist/types/lib/Prefix.d.ts +98 -0
- package/dist/types/lib/Result.d.ts +173 -0
- package/dist/types/lib/ServiceResponseCodec.d.ts +82 -0
- package/dist/types/lib/StringifyPattern.d.ts +7 -0
- package/dist/types/lib/UnsetValue.d.ts +12 -0
- package/dist/types/lib/pattern/GlobPattern.d.ts +34 -0
- package/dist/types/lib/pattern/PatternManager.d.ts +103 -0
- package/dist/types/lib/schedule/Cron.d.ts +56 -0
- package/dist/types/types/CLIContextParams.d.ts +14 -0
- package/dist/types/types/ErrorDescription.d.ts +14 -0
- package/dist/types/types/HTTPContextParams.d.ts +27 -0
- package/dist/types/types/ScheduleContextParams.d.ts +21 -0
- package/dist/types/types/ServiceContextParams.d.ts +16 -0
- package/package.json +152 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { Controller, type ControllerProperty } from '../../lib/Controller.js';
|
|
2
|
+
import { DTO, MethodDecorator } from '@lakutata/core';
|
|
3
|
+
import { ActionOptions } from '../../lib/ActionOptions.js';
|
|
4
|
+
import { HTTPContext } from '../../context/HTTPContext.js';
|
|
5
|
+
/**
|
|
6
|
+
* Expose the controller method as an HTTP PATCH action on a route, to update a part of a resource: the shorthand of
|
|
7
|
+
* `@HTTPAction(route, 'patch', …)`. The adapter assembles the input: by default, the query string merged with the
|
|
8
|
+
* parsed body (JSON or URL encoded), then the route parameters over them. The middlewares run, the input is validated
|
|
9
|
+
* against the DTO (the defaults applied, the unknown keys removed; without a DTO, it is accepted as it is), the access
|
|
10
|
+
* control runs when `acl` is set, then the method receives the validated input as a plain object. The query values and
|
|
11
|
+
* the route parameters are strings and the DTO schemas are strict: convert them with `.strict(false)`. The value
|
|
12
|
+
* returned is answered by the adapter's responder: as JSON by default, with the status 204 for `undefined`;
|
|
13
|
+
* `Result.status()` sets a status and headers. An error thrown is answered as `{errno, errMsg}` with the first 4xx
|
|
14
|
+
* `statusCode` along its causes (400 for an invalid input), else its own `statusCode`, else 500.
|
|
15
|
+
* @param r The route, in the syntax of the HTTP adapter (`/users/:id`); the controller's `@Prefix({route})` is
|
|
16
|
+
* prepended to it.
|
|
17
|
+
* @returns The method decorator.
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* import {DTO} from 'lakutata'
|
|
21
|
+
* import {Controller} from 'lakutata/com/entrypoint'
|
|
22
|
+
* import {PATCH} from 'lakutata/decorator/ctrl'
|
|
23
|
+
* import {Expect} from 'lakutata/decorator/dto'
|
|
24
|
+
*
|
|
25
|
+
* class RenameDTO extends DTO {
|
|
26
|
+
* @Expect(DTO.String().required())
|
|
27
|
+
* public id!: string
|
|
28
|
+
*
|
|
29
|
+
* @Expect(DTO.String().min(1).optional())
|
|
30
|
+
* public name?: string
|
|
31
|
+
* }
|
|
32
|
+
*
|
|
33
|
+
* class ProjectController extends Controller {
|
|
34
|
+
* //PATCH /projects/p1 with the body {"name": "Apollo"}: answered with the status 204 (no content)
|
|
35
|
+
* @PATCH('/projects/:id', RenameDTO)
|
|
36
|
+
* public async rename(input: RenameDTO): Promise<void> {
|
|
37
|
+
* console.log(`rename ${input.id} to ${input.name}`)
|
|
38
|
+
* }
|
|
39
|
+
* }
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export declare function PATCH<ClassPrototype extends Controller, Method>(r: string): MethodDecorator<ClassPrototype, Method, ControllerProperty<ClassPrototype>>;
|
|
43
|
+
/**
|
|
44
|
+
* Expose the controller method as an HTTP PATCH action on a route, its input validated against a DTO: the shorthand of
|
|
45
|
+
* `@HTTPAction(route, 'patch', …)`. The input is the query string merged with the parsed body, then the route
|
|
46
|
+
* parameters over them (the default of the adapters); the method receives it validated, as a plain object. The value
|
|
47
|
+
* returned is answered as JSON (204 for `undefined`), an error as `{errno, errMsg}` with its status (400 for an invalid
|
|
48
|
+
* input, else 500 by default).
|
|
49
|
+
* @param r The route, in the syntax of the HTTP adapter (`/users/:id`); the controller's `@Prefix({route})` is
|
|
50
|
+
* prepended to it.
|
|
51
|
+
* @param dtoConstructor The DTO class validating the input; the query values and the route parameters are strings,
|
|
52
|
+
* convert them with `.strict(false)`.
|
|
53
|
+
* @returns The method decorator.
|
|
54
|
+
*/
|
|
55
|
+
export declare function PATCH<ClassPrototype extends Controller, Method, DTOConstructor extends typeof DTO = typeof DTO>(r: string, dtoConstructor: DTOConstructor): MethodDecorator<ClassPrototype, Method, ControllerProperty<ClassPrototype>>;
|
|
56
|
+
/**
|
|
57
|
+
* Expose the controller method as an HTTP PATCH action on a route, with action options: the shorthand of
|
|
58
|
+
* `@HTTPAction(route, 'patch', …)`. The input is the query string merged with the parsed body, then the route
|
|
59
|
+
* parameters over them (the default of the adapters), accepted as it is. The value returned is answered as JSON (204
|
|
60
|
+
* for `undefined`), an error as `{errno, errMsg}` with its status (500 by default).
|
|
61
|
+
* @param r The route, in the syntax of the HTTP adapter (`/users/:id`); the controller's `@Prefix({route})` is
|
|
62
|
+
* prepended to it.
|
|
63
|
+
* @param actionOptions The action options: `acl` runs the access control rules (false by default); `name` (unique in the
|
|
64
|
+
* HTTP actions, `ClassName:method` by default), `description` and `groups` describe the action; `rule` is an access
|
|
65
|
+
* rule of the action; `middlewares` run before the ones `@UseMiddlewares` adds to the method.
|
|
66
|
+
* @returns The method decorator.
|
|
67
|
+
* @throws {InvalidValueException} When the class is declared, if the action options are invalid.
|
|
68
|
+
* @throws {InvalidMiddlewareException} When the class is declared, if a middleware of the options is neither a function
|
|
69
|
+
* nor a class extending `Middleware`.
|
|
70
|
+
*/
|
|
71
|
+
export declare function PATCH<ClassPrototype extends Controller, Method>(r: string, actionOptions: ActionOptions<HTTPContext>): MethodDecorator<ClassPrototype, Method, ControllerProperty<ClassPrototype>>;
|
|
72
|
+
/**
|
|
73
|
+
* Expose the controller method as an HTTP PATCH action on a route, its input validated against a DTO, with action
|
|
74
|
+
* options: the shorthand of `@HTTPAction(route, 'patch', …)`. The input is the query string merged with the parsed
|
|
75
|
+
* body, then the route parameters over them (the default of the adapters); the method receives it validated, as a plain
|
|
76
|
+
* object. The value returned is answered as JSON (204 for `undefined`), an error as `{errno, errMsg}` with its status
|
|
77
|
+
* (400 for an invalid input, else 500 by default).
|
|
78
|
+
* @param r The route, in the syntax of the HTTP adapter (`/users/:id`); the controller's `@Prefix({route})` is
|
|
79
|
+
* prepended to it.
|
|
80
|
+
* @param dtoConstructor The DTO class validating the input; the query values and the route parameters are strings,
|
|
81
|
+
* convert them with `.strict(false)`.
|
|
82
|
+
* @param actionOptions The action options: `acl` runs the access control rules (false by default); `name` (unique in the
|
|
83
|
+
* HTTP actions, `ClassName:method` by default), `description` and `groups` describe the action; `rule` is an access
|
|
84
|
+
* rule of the action; `middlewares` run before the ones `@UseMiddlewares` adds to the method.
|
|
85
|
+
* @returns The method decorator.
|
|
86
|
+
* @throws {InvalidValueException} When the class is declared, if the action options are invalid.
|
|
87
|
+
* @throws {InvalidMiddlewareException} When the class is declared, if a middleware of the options is neither a function
|
|
88
|
+
* nor a class extending `Middleware`.
|
|
89
|
+
*/
|
|
90
|
+
export declare function PATCH<ClassPrototype extends Controller, Method, DTOConstructor extends typeof DTO = typeof DTO>(r: string, dtoConstructor: DTOConstructor, actionOptions: ActionOptions<HTTPContext>): MethodDecorator<ClassPrototype, Method, ControllerProperty<ClassPrototype>>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PATCH = PATCH;
|
|
4
|
+
const HTTPAction_js_1 = require("../HTTPAction.js");
|
|
5
|
+
function PATCH(r, dtoConstructorOrOptions, options) {
|
|
6
|
+
return (0, HTTPAction_js_1.HTTPAction)(r, 'patch', dtoConstructorOrOptions, options);
|
|
7
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { Controller, type ControllerProperty } from '../../lib/Controller.js';
|
|
2
|
+
import { DTO, MethodDecorator } from '@lakutata/core';
|
|
3
|
+
import { ActionOptions } from '../../lib/ActionOptions.js';
|
|
4
|
+
import { HTTPContext } from '../../context/HTTPContext.js';
|
|
5
|
+
/**
|
|
6
|
+
* Expose the controller method as an HTTP POST action on a route, to create a resource or run a command: the shorthand
|
|
7
|
+
* of `@HTTPAction(route, 'post', …)`. The adapter assembles the input: by default, the query string merged with the
|
|
8
|
+
* parsed body (JSON or URL encoded), then the route parameters over them. The middlewares run, the input is validated
|
|
9
|
+
* against the DTO (the defaults applied, the unknown keys removed; without a DTO, it is accepted as it is), the access
|
|
10
|
+
* control runs when `acl` is set, then the method receives the validated input as a plain object. The query values and
|
|
11
|
+
* the route parameters are strings and the DTO schemas are strict: convert them with `.strict(false)`. The value
|
|
12
|
+
* returned is answered by the adapter's responder: as JSON by default, with the status 204 for `undefined`;
|
|
13
|
+
* `Result.status()` sets a status and headers. An error thrown is answered as `{errno, errMsg}` with the first 4xx
|
|
14
|
+
* `statusCode` along its causes (400 for an invalid input), else its own `statusCode`, else 500.
|
|
15
|
+
* @param r The route, in the syntax of the HTTP adapter (`/users/:id`); the controller's `@Prefix({route})` is
|
|
16
|
+
* prepended to it.
|
|
17
|
+
* @returns The method decorator.
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* import {DTO} from 'lakutata'
|
|
21
|
+
* import {Controller, Result, type StatusResult} from 'lakutata/com/entrypoint'
|
|
22
|
+
* import {POST} from 'lakutata/decorator/ctrl'
|
|
23
|
+
* import {Expect} from 'lakutata/decorator/dto'
|
|
24
|
+
*
|
|
25
|
+
* class CreateUserDTO extends DTO {
|
|
26
|
+
* @Expect(DTO.String().email().required())
|
|
27
|
+
* public email!: string
|
|
28
|
+
*
|
|
29
|
+
* @Expect(DTO.String().min(1).required())
|
|
30
|
+
* public name!: string
|
|
31
|
+
* }
|
|
32
|
+
*
|
|
33
|
+
* class UserController extends Controller {
|
|
34
|
+
* //POST /users with the body {"email": "ada@example.com", "name": "Ada"}: answered with the status 201 and the JSON
|
|
35
|
+
* //{"id": 1, "email": "ada@example.com", "name": "Ada"}; an invalid body with the status 400
|
|
36
|
+
* @POST('/users', CreateUserDTO, {acl: true, name: 'Create a user'})
|
|
37
|
+
* public async create(input: CreateUserDTO): Promise<StatusResult> {
|
|
38
|
+
* return Result.status(201, {id: 1, email: input.email, name: input.name})
|
|
39
|
+
* }
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export declare function POST<ClassPrototype extends Controller, Method>(r: string): MethodDecorator<ClassPrototype, Method, ControllerProperty<ClassPrototype>>;
|
|
44
|
+
/**
|
|
45
|
+
* Expose the controller method as an HTTP POST action on a route, its input validated against a DTO: the shorthand of
|
|
46
|
+
* `@HTTPAction(route, 'post', …)`. The input is the query string merged with the parsed body, then the route parameters
|
|
47
|
+
* over them (the default of the adapters); the method receives it validated, as a plain object. The value returned is
|
|
48
|
+
* answered as JSON (204 for `undefined`), an error as `{errno, errMsg}` with its status (400 for an invalid input, else
|
|
49
|
+
* 500 by default).
|
|
50
|
+
* @param r The route, in the syntax of the HTTP adapter (`/users/:id`); the controller's `@Prefix({route})` is
|
|
51
|
+
* prepended to it.
|
|
52
|
+
* @param dtoConstructor The DTO class validating the input; the query values and the route parameters are strings,
|
|
53
|
+
* convert them with `.strict(false)`.
|
|
54
|
+
* @returns The method decorator.
|
|
55
|
+
*/
|
|
56
|
+
export declare function POST<ClassPrototype extends Controller, Method, DTOConstructor extends typeof DTO = typeof DTO>(r: string, dtoConstructor: DTOConstructor): MethodDecorator<ClassPrototype, Method, ControllerProperty<ClassPrototype>>;
|
|
57
|
+
/**
|
|
58
|
+
* Expose the controller method as an HTTP POST action on a route, with action options: the shorthand of
|
|
59
|
+
* `@HTTPAction(route, 'post', …)`. The input is the query string merged with the parsed body, then the route parameters
|
|
60
|
+
* over them (the default of the adapters), accepted as it is. The value returned is answered as JSON (204 for
|
|
61
|
+
* `undefined`), an error as `{errno, errMsg}` with its status (500 by default).
|
|
62
|
+
* @param r The route, in the syntax of the HTTP adapter (`/users/:id`); the controller's `@Prefix({route})` is
|
|
63
|
+
* prepended to it.
|
|
64
|
+
* @param actionOptions The action options: `acl` runs the access control rules (false by default); `name` (unique in the
|
|
65
|
+
* HTTP actions, `ClassName:method` by default), `description` and `groups` describe the action; `rule` is an access
|
|
66
|
+
* rule of the action; `middlewares` run before the ones `@UseMiddlewares` adds to the method.
|
|
67
|
+
* @returns The method decorator.
|
|
68
|
+
* @throws {InvalidValueException} When the class is declared, if the action options are invalid.
|
|
69
|
+
* @throws {InvalidMiddlewareException} When the class is declared, if a middleware of the options is neither a function
|
|
70
|
+
* nor a class extending `Middleware`.
|
|
71
|
+
*/
|
|
72
|
+
export declare function POST<ClassPrototype extends Controller, Method>(r: string, actionOptions: ActionOptions<HTTPContext>): MethodDecorator<ClassPrototype, Method, ControllerProperty<ClassPrototype>>;
|
|
73
|
+
/**
|
|
74
|
+
* Expose the controller method as an HTTP POST action on a route, its input validated against a DTO, with action
|
|
75
|
+
* options: the shorthand of `@HTTPAction(route, 'post', …)`. The input is the query string merged with the parsed body,
|
|
76
|
+
* then the route parameters over them (the default of the adapters); the method receives it validated, as a plain
|
|
77
|
+
* object. The value returned is answered as JSON (204 for `undefined`), an error as `{errno, errMsg}` with its status
|
|
78
|
+
* (400 for an invalid input, else 500 by default).
|
|
79
|
+
* @param r The route, in the syntax of the HTTP adapter (`/users/:id`); the controller's `@Prefix({route})` is
|
|
80
|
+
* prepended to it.
|
|
81
|
+
* @param dtoConstructor The DTO class validating the input; the query values and the route parameters are strings,
|
|
82
|
+
* convert them with `.strict(false)`.
|
|
83
|
+
* @param actionOptions The action options: `acl` runs the access control rules (false by default); `name` (unique in the
|
|
84
|
+
* HTTP actions, `ClassName:method` by default), `description` and `groups` describe the action; `rule` is an access
|
|
85
|
+
* rule of the action; `middlewares` run before the ones `@UseMiddlewares` adds to the method.
|
|
86
|
+
* @returns The method decorator.
|
|
87
|
+
* @throws {InvalidValueException} When the class is declared, if the action options are invalid.
|
|
88
|
+
* @throws {InvalidMiddlewareException} When the class is declared, if a middleware of the options is neither a function
|
|
89
|
+
* nor a class extending `Middleware`.
|
|
90
|
+
*/
|
|
91
|
+
export declare function POST<ClassPrototype extends Controller, Method, DTOConstructor extends typeof DTO = typeof DTO>(r: string, dtoConstructor: DTOConstructor, actionOptions: ActionOptions<HTTPContext>): MethodDecorator<ClassPrototype, Method, ControllerProperty<ClassPrototype>>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.POST = POST;
|
|
4
|
+
const HTTPAction_js_1 = require("../HTTPAction.js");
|
|
5
|
+
function POST(r, dtoConstructorOrOptions, options) {
|
|
6
|
+
return (0, HTTPAction_js_1.HTTPAction)(r, 'post', dtoConstructorOrOptions, options);
|
|
7
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { Controller, type ControllerProperty } from '../../lib/Controller.js';
|
|
2
|
+
import { DTO, MethodDecorator } from '@lakutata/core';
|
|
3
|
+
import { ActionOptions } from '../../lib/ActionOptions.js';
|
|
4
|
+
import { HTTPContext } from '../../context/HTTPContext.js';
|
|
5
|
+
/**
|
|
6
|
+
* Expose the controller method as an HTTP PUT action on a route, to replace a resource: the shorthand of
|
|
7
|
+
* `@HTTPAction(route, 'put', …)`. The adapter assembles the input: by default, the query string merged with the parsed
|
|
8
|
+
* body (JSON or URL encoded), then the route parameters over them. The middlewares run, the input is validated against
|
|
9
|
+
* the DTO (the defaults applied, the unknown keys removed; without a DTO, it is accepted as it is), the access control
|
|
10
|
+
* runs when `acl` is set, then the method receives the validated input as a plain object. The query values and the
|
|
11
|
+
* route parameters are strings and the DTO schemas are strict: convert them with `.strict(false)`. The value returned
|
|
12
|
+
* is answered by the adapter's responder: as JSON by default, with the status 204 for `undefined`; `Result.status()`
|
|
13
|
+
* sets a status and headers. An error thrown is answered as `{errno, errMsg}` with the first 4xx `statusCode` along its
|
|
14
|
+
* causes (400 for an invalid input), else its own `statusCode`, else 500.
|
|
15
|
+
* @param r The route, in the syntax of the HTTP adapter (`/users/:id`); the controller's `@Prefix({route})` is
|
|
16
|
+
* prepended to it.
|
|
17
|
+
* @returns The method decorator.
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* import {DTO} from 'lakutata'
|
|
21
|
+
* import {Controller} from 'lakutata/com/entrypoint'
|
|
22
|
+
* import {PUT} from 'lakutata/decorator/ctrl'
|
|
23
|
+
* import {Expect} from 'lakutata/decorator/dto'
|
|
24
|
+
*
|
|
25
|
+
* class ReplaceSettingsDTO extends DTO {
|
|
26
|
+
* //The route parameter
|
|
27
|
+
* @Expect(DTO.String().required())
|
|
28
|
+
* public user!: string
|
|
29
|
+
*
|
|
30
|
+
* //The body
|
|
31
|
+
* @Expect(DTO.String().valid('light', 'dark').required())
|
|
32
|
+
* public theme!: string
|
|
33
|
+
* }
|
|
34
|
+
*
|
|
35
|
+
* class SettingsController extends Controller {
|
|
36
|
+
* //PUT /settings/ada with the body {"theme": "dark"}: answered with the JSON {"user": "ada", "theme": "dark"}
|
|
37
|
+
* @PUT('/settings/:user', ReplaceSettingsDTO)
|
|
38
|
+
* public async replace(input: ReplaceSettingsDTO): Promise<{ user: string, theme: string }> {
|
|
39
|
+
* return {user: input.user, theme: input.theme}
|
|
40
|
+
* }
|
|
41
|
+
* }
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export declare function PUT<ClassPrototype extends Controller, Method>(r: string): MethodDecorator<ClassPrototype, Method, ControllerProperty<ClassPrototype>>;
|
|
45
|
+
/**
|
|
46
|
+
* Expose the controller method as an HTTP PUT action on a route, its input validated against a DTO: the shorthand of
|
|
47
|
+
* `@HTTPAction(route, 'put', …)`. The input is the query string merged with the parsed body, then the route parameters
|
|
48
|
+
* over them (the default of the adapters); the method receives it validated, as a plain object. The value returned is
|
|
49
|
+
* answered as JSON (204 for `undefined`), an error as `{errno, errMsg}` with its status (400 for an invalid input, else
|
|
50
|
+
* 500 by default).
|
|
51
|
+
* @param r The route, in the syntax of the HTTP adapter (`/users/:id`); the controller's `@Prefix({route})` is
|
|
52
|
+
* prepended to it.
|
|
53
|
+
* @param dtoConstructor The DTO class validating the input; the query values and the route parameters are strings,
|
|
54
|
+
* convert them with `.strict(false)`.
|
|
55
|
+
* @returns The method decorator.
|
|
56
|
+
*/
|
|
57
|
+
export declare function PUT<ClassPrototype extends Controller, Method, DTOConstructor extends typeof DTO = typeof DTO>(r: string, dtoConstructor: DTOConstructor): MethodDecorator<ClassPrototype, Method, ControllerProperty<ClassPrototype>>;
|
|
58
|
+
/**
|
|
59
|
+
* Expose the controller method as an HTTP PUT action on a route, with action options: the shorthand of
|
|
60
|
+
* `@HTTPAction(route, 'put', …)`. The input is the query string merged with the parsed body, then the route parameters
|
|
61
|
+
* over them (the default of the adapters), accepted as it is. The value returned is answered as JSON (204 for
|
|
62
|
+
* `undefined`), an error as `{errno, errMsg}` with its status (500 by default).
|
|
63
|
+
* @param r The route, in the syntax of the HTTP adapter (`/users/:id`); the controller's `@Prefix({route})` is
|
|
64
|
+
* prepended to it.
|
|
65
|
+
* @param actionOptions The action options: `acl` runs the access control rules (false by default); `name` (unique in the
|
|
66
|
+
* HTTP actions, `ClassName:method` by default), `description` and `groups` describe the action; `rule` is an access
|
|
67
|
+
* rule of the action; `middlewares` run before the ones `@UseMiddlewares` adds to the method.
|
|
68
|
+
* @returns The method decorator.
|
|
69
|
+
* @throws {InvalidValueException} When the class is declared, if the action options are invalid.
|
|
70
|
+
* @throws {InvalidMiddlewareException} When the class is declared, if a middleware of the options is neither a function
|
|
71
|
+
* nor a class extending `Middleware`.
|
|
72
|
+
*/
|
|
73
|
+
export declare function PUT<ClassPrototype extends Controller, Method>(r: string, actionOptions: ActionOptions<HTTPContext>): MethodDecorator<ClassPrototype, Method, ControllerProperty<ClassPrototype>>;
|
|
74
|
+
/**
|
|
75
|
+
* Expose the controller method as an HTTP PUT action on a route, its input validated against a DTO, with action
|
|
76
|
+
* options: the shorthand of `@HTTPAction(route, 'put', …)`. The input is the query string merged with the parsed body,
|
|
77
|
+
* then the route parameters over them (the default of the adapters); the method receives it validated, as a plain
|
|
78
|
+
* object. The value returned is answered as JSON (204 for `undefined`), an error as `{errno, errMsg}` with its status
|
|
79
|
+
* (400 for an invalid input, else 500 by default).
|
|
80
|
+
* @param r The route, in the syntax of the HTTP adapter (`/users/:id`); the controller's `@Prefix({route})` is
|
|
81
|
+
* prepended to it.
|
|
82
|
+
* @param dtoConstructor The DTO class validating the input; the query values and the route parameters are strings,
|
|
83
|
+
* convert them with `.strict(false)`.
|
|
84
|
+
* @param actionOptions The action options: `acl` runs the access control rules (false by default); `name` (unique in the
|
|
85
|
+
* HTTP actions, `ClassName:method` by default), `description` and `groups` describe the action; `rule` is an access
|
|
86
|
+
* rule of the action; `middlewares` run before the ones `@UseMiddlewares` adds to the method.
|
|
87
|
+
* @returns The method decorator.
|
|
88
|
+
* @throws {InvalidValueException} When the class is declared, if the action options are invalid.
|
|
89
|
+
* @throws {InvalidMiddlewareException} When the class is declared, if a middleware of the options is neither a function
|
|
90
|
+
* nor a class extending `Middleware`.
|
|
91
|
+
*/
|
|
92
|
+
export declare function PUT<ClassPrototype extends Controller, Method, DTOConstructor extends typeof DTO = typeof DTO>(r: string, dtoConstructor: DTOConstructor, actionOptions: ActionOptions<HTTPContext>): MethodDecorator<ClassPrototype, Method, ControllerProperty<ClassPrototype>>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PUT = PUT;
|
|
4
|
+
const HTTPAction_js_1 = require("../HTTPAction.js");
|
|
5
|
+
function PUT(r, dtoConstructorOrOptions, options) {
|
|
6
|
+
return (0, HTTPAction_js_1.HTTPAction)(r, 'put', dtoConstructorOrOptions, options);
|
|
7
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Exception } from '@lakutata/core';
|
|
2
|
+
/**
|
|
3
|
+
* An access control rule denied the request: a rule of the entrypoint (`rules`) or of the action resolved `false`.
|
|
4
|
+
* Its errno is `E_ACCESS_DENY`, its HTTP status 403.
|
|
5
|
+
*/
|
|
6
|
+
export declare class AccessDeniedException extends Exception {
|
|
7
|
+
errno: string | number;
|
|
8
|
+
message: string;
|
|
9
|
+
readonly statusCode: number;
|
|
10
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AccessDeniedException = void 0;
|
|
4
|
+
const core_1 = require("@lakutata/core");
|
|
5
|
+
/**
|
|
6
|
+
* An access control rule denied the request: a rule of the entrypoint (`rules`) or of the action resolved `false`.
|
|
7
|
+
* Its errno is `E_ACCESS_DENY`, its HTTP status 403.
|
|
8
|
+
*/
|
|
9
|
+
class AccessDeniedException extends core_1.Exception {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
this.errno = 'E_ACCESS_DENY';
|
|
13
|
+
this.message = 'Access denied';
|
|
14
|
+
this.statusCode = 403;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.AccessDeniedException = AccessDeniedException;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Exception } from '@lakutata/core';
|
|
2
|
+
/**
|
|
3
|
+
* No action matches the request: the service pattern, the command or the route of no controller action matches it.
|
|
4
|
+
* Its errno is `E_CONTROLLER_ACTION_NOT_FOUND`, its HTTP status 404.
|
|
5
|
+
*/
|
|
6
|
+
export declare class ControllerActionNotFoundException extends Exception {
|
|
7
|
+
errno: string | number;
|
|
8
|
+
readonly statusCode: number;
|
|
9
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ControllerActionNotFoundException = void 0;
|
|
4
|
+
const core_1 = require("@lakutata/core");
|
|
5
|
+
/**
|
|
6
|
+
* No action matches the request: the service pattern, the command or the route of no controller action matches it.
|
|
7
|
+
* Its errno is `E_CONTROLLER_ACTION_NOT_FOUND`, its HTTP status 404.
|
|
8
|
+
*/
|
|
9
|
+
class ControllerActionNotFoundException extends core_1.Exception {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
this.errno = 'E_CONTROLLER_ACTION_NOT_FOUND';
|
|
13
|
+
this.statusCode = 404;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.ControllerActionNotFoundException = ControllerActionNotFoundException;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Exception } from '@lakutata/core';
|
|
2
|
+
/**
|
|
3
|
+
* Two actions of a channel have the same name (`name` of their options, `Class:method` by default), when the
|
|
4
|
+
* entrypoint initializes. Its errno is `E_DUPLICATE_ACTION_NAME`.
|
|
5
|
+
*/
|
|
6
|
+
export declare class DuplicateActionNameException extends Exception {
|
|
7
|
+
errno: string | number;
|
|
8
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DuplicateActionNameException = void 0;
|
|
4
|
+
const core_1 = require("@lakutata/core");
|
|
5
|
+
/**
|
|
6
|
+
* Two actions of a channel have the same name (`name` of their options, `Class:method` by default), when the
|
|
7
|
+
* entrypoint initializes. Its errno is `E_DUPLICATE_ACTION_NAME`.
|
|
8
|
+
*/
|
|
9
|
+
class DuplicateActionNameException extends core_1.Exception {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
this.errno = 'E_DUPLICATE_ACTION_NAME';
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.DuplicateActionNameException = DuplicateActionNameException;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Exception } from '@lakutata/core';
|
|
2
|
+
/**
|
|
3
|
+
* The request arrived while the entrypoint is stopping (the application exiting): it is refused, the requests in
|
|
4
|
+
* progress being waited for. Its errno is `E_ENTRYPOINT_STOPPED`, its HTTP status 503.
|
|
5
|
+
*/
|
|
6
|
+
export declare class EntrypointStoppedException extends Exception {
|
|
7
|
+
errno: string | number;
|
|
8
|
+
readonly statusCode: number;
|
|
9
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EntrypointStoppedException = void 0;
|
|
4
|
+
const core_1 = require("@lakutata/core");
|
|
5
|
+
/**
|
|
6
|
+
* The request arrived while the entrypoint is stopping (the application exiting): it is refused, the requests in
|
|
7
|
+
* progress being waited for. Its errno is `E_ENTRYPOINT_STOPPED`, its HTTP status 503.
|
|
8
|
+
*/
|
|
9
|
+
class EntrypointStoppedException extends core_1.Exception {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
this.errno = 'E_ENTRYPOINT_STOPPED';
|
|
13
|
+
this.statusCode = 503;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.EntrypointStoppedException = EntrypointStoppedException;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InvalidActionGroupException = void 0;
|
|
4
|
+
const core_1 = require("@lakutata/core");
|
|
5
|
+
class InvalidActionGroupException extends core_1.Exception {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.errno = 'E_INVALID_ACTION_GROUP';
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.InvalidActionGroupException = InvalidActionGroupException;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Exception } from '@lakutata/core';
|
|
2
|
+
/**
|
|
3
|
+
* A channel is defined twice under the same name, or a channel used is not defined. Its errno is
|
|
4
|
+
* `E_INVALID_CHANNEL`.
|
|
5
|
+
*/
|
|
6
|
+
export declare class InvalidChannelException extends Exception {
|
|
7
|
+
errno: string | number;
|
|
8
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InvalidChannelException = void 0;
|
|
4
|
+
const core_1 = require("@lakutata/core");
|
|
5
|
+
/**
|
|
6
|
+
* A channel is defined twice under the same name, or a channel used is not defined. Its errno is
|
|
7
|
+
* `E_INVALID_CHANNEL`.
|
|
8
|
+
*/
|
|
9
|
+
class InvalidChannelException extends core_1.Exception {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
this.errno = 'E_INVALID_CHANNEL';
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.InvalidChannelException = InvalidChannelException;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Exception } from '@lakutata/core';
|
|
2
|
+
/**
|
|
3
|
+
* An option of the entrypoint is given an adapter of another channel, an adapter of an undefined channel, or a value
|
|
4
|
+
* which is neither an option nor an adapter, when the entrypoint initializes. Its errno is
|
|
5
|
+
* `E_INVALID_ENTRYPOINT_ADAPTER`.
|
|
6
|
+
*/
|
|
7
|
+
export declare class InvalidEntrypointAdapterException extends Exception {
|
|
8
|
+
errno: string | number;
|
|
9
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InvalidEntrypointAdapterException = void 0;
|
|
4
|
+
const core_1 = require("@lakutata/core");
|
|
5
|
+
/**
|
|
6
|
+
* An option of the entrypoint is given an adapter of another channel, an adapter of an undefined channel, or a value
|
|
7
|
+
* which is neither an option nor an adapter, when the entrypoint initializes. Its errno is
|
|
8
|
+
* `E_INVALID_ENTRYPOINT_ADAPTER`.
|
|
9
|
+
*/
|
|
10
|
+
class InvalidEntrypointAdapterException extends core_1.Exception {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.errno = 'E_INVALID_ENTRYPOINT_ADAPTER';
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.InvalidEntrypointAdapterException = InvalidEntrypointAdapterException;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Exception } from '@lakutata/core';
|
|
2
|
+
/**
|
|
3
|
+
* A middleware is neither a function nor a class extending `Middleware`, when the entrypoint initializes. Its errno is
|
|
4
|
+
* `E_INVALID_MIDDLEWARE`.
|
|
5
|
+
*/
|
|
6
|
+
export declare class InvalidMiddlewareException extends Exception {
|
|
7
|
+
errno: string | number;
|
|
8
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InvalidMiddlewareException = void 0;
|
|
4
|
+
const core_1 = require("@lakutata/core");
|
|
5
|
+
/**
|
|
6
|
+
* A middleware is neither a function nor a class extending `Middleware`, when the entrypoint initializes. Its errno is
|
|
7
|
+
* `E_INVALID_MIDDLEWARE`.
|
|
8
|
+
*/
|
|
9
|
+
class InvalidMiddlewareException extends core_1.Exception {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
this.errno = 'E_INVALID_MIDDLEWARE';
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.InvalidMiddlewareException = InvalidMiddlewareException;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Exception } from '@lakutata/core';
|
|
2
|
+
/**
|
|
3
|
+
* A pattern prefix of a controller (`@Prefix`) and the pattern of one of its service actions set the same key to
|
|
4
|
+
* different values, when the entrypoint initializes. Its errno is `E_INVALID_PREFIX`.
|
|
5
|
+
*/
|
|
6
|
+
export declare class InvalidPrefixException extends Exception {
|
|
7
|
+
errno: string | number;
|
|
8
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InvalidPrefixException = void 0;
|
|
4
|
+
const core_1 = require("@lakutata/core");
|
|
5
|
+
/**
|
|
6
|
+
* A pattern prefix of a controller (`@Prefix`) and the pattern of one of its service actions set the same key to
|
|
7
|
+
* different values, when the entrypoint initializes. Its errno is `E_INVALID_PREFIX`.
|
|
8
|
+
*/
|
|
9
|
+
class InvalidPrefixException extends core_1.Exception {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
this.errno = 'E_INVALID_PREFIX';
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.InvalidPrefixException = InvalidPrefixException;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Exception } from '@lakutata/core';
|
|
2
|
+
/**
|
|
3
|
+
* A middleware called `next()` more than once for a request (the request rejects with it). Its errno is
|
|
4
|
+
* `E_MIDDLEWARE_NEXT_CALLED`.
|
|
5
|
+
*/
|
|
6
|
+
export declare class MiddlewareNextCalledException extends Exception {
|
|
7
|
+
errno: string | number;
|
|
8
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MiddlewareNextCalledException = void 0;
|
|
4
|
+
const core_1 = require("@lakutata/core");
|
|
5
|
+
/**
|
|
6
|
+
* A middleware called `next()` more than once for a request (the request rejects with it). Its errno is
|
|
7
|
+
* `E_MIDDLEWARE_NEXT_CALLED`.
|
|
8
|
+
*/
|
|
9
|
+
class MiddlewareNextCalledException extends core_1.Exception {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
this.errno = 'E_MIDDLEWARE_NEXT_CALLED';
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.MiddlewareNextCalledException = MiddlewareNextCalledException;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Exception } from '@lakutata/core';
|
|
2
|
+
/**
|
|
3
|
+
* No HTTP route matches the request (the HTTP adapters answer it). Its errno is `E_ROUTE_NOT_FOUND`, its HTTP status
|
|
4
|
+
* 404.
|
|
5
|
+
*/
|
|
6
|
+
export declare class RouteNotFoundException extends Exception {
|
|
7
|
+
errno: string | number;
|
|
8
|
+
readonly statusCode: number;
|
|
9
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RouteNotFoundException = void 0;
|
|
4
|
+
const core_1 = require("@lakutata/core");
|
|
5
|
+
/**
|
|
6
|
+
* No HTTP route matches the request (the HTTP adapters answer it). Its errno is `E_ROUTE_NOT_FOUND`, its HTTP status
|
|
7
|
+
* 404.
|
|
8
|
+
*/
|
|
9
|
+
class RouteNotFoundException extends core_1.Exception {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
this.errno = 'E_ROUTE_NOT_FOUND';
|
|
13
|
+
this.statusCode = 404;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.RouteNotFoundException = RouteNotFoundException;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Exception } from '@lakutata/core';
|
|
2
|
+
/**
|
|
3
|
+
* The failure of a service invocation: the error of the remote service, with its properties (errno, errMsg, statusCode…)
|
|
4
|
+
*/
|
|
5
|
+
export declare class ServiceInvokeException extends Exception {
|
|
6
|
+
errno: string | number;
|
|
7
|
+
/**
|
|
8
|
+
* The id of the service invoked.
|
|
9
|
+
*/
|
|
10
|
+
service?: string;
|
|
11
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ServiceInvokeException = void 0;
|
|
4
|
+
const core_1 = require("@lakutata/core");
|
|
5
|
+
/**
|
|
6
|
+
* The failure of a service invocation: the error of the remote service, with its properties (errno, errMsg, statusCode…)
|
|
7
|
+
*/
|
|
8
|
+
class ServiceInvokeException extends core_1.Exception {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this.errno = 'E_SERVICE_INVOKE';
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.ServiceInvokeException = ServiceInvokeException;
|