@spinajs/http 2.0.86 → 2.0.88
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/lib/{config → cjs/config}/http.d.ts +0 -0
- package/lib/cjs/config/http.d.ts.map +1 -0
- package/lib/cjs/config/http.js +99 -0
- package/lib/cjs/config/http.js.map +1 -0
- package/lib/cjs/controllers.d.ts +47 -0
- package/lib/cjs/controllers.d.ts.map +1 -0
- package/lib/cjs/controllers.js +258 -0
- package/lib/cjs/controllers.js.map +1 -0
- package/lib/{decorators.d.ts → cjs/decorators.d.ts} +0 -0
- package/lib/cjs/decorators.d.ts.map +1 -0
- package/lib/cjs/decorators.js +399 -0
- package/lib/cjs/decorators.js.map +1 -0
- package/lib/cjs/exceptions.d.ts +1 -0
- package/lib/{exceptions.d.ts.map → cjs/exceptions.d.ts.map} +1 -1
- package/lib/cjs/exceptions.js +1 -0
- package/lib/{exceptions.js.map → cjs/exceptions.js.map} +1 -1
- package/lib/{index.d.ts → cjs/index.d.ts} +0 -0
- package/lib/cjs/index.d.ts.map +1 -0
- package/lib/cjs/index.js +25 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/{interfaces.d.ts → cjs/interfaces.d.ts} +0 -0
- package/lib/cjs/interfaces.d.ts.map +1 -0
- package/lib/cjs/interfaces.js +237 -0
- package/lib/cjs/interfaces.js.map +1 -0
- package/lib/{locales → cjs/locales}/en.json +0 -0
- package/lib/{locales → cjs/locales}/pl.json +0 -0
- package/lib/{middlewares → cjs/middlewares}/RequestId.d.ts +0 -0
- package/lib/cjs/middlewares/RequestId.d.ts.map +1 -0
- package/lib/cjs/middlewares/RequestId.js +36 -0
- package/lib/cjs/middlewares/RequestId.js.map +1 -0
- package/lib/{middlewares → cjs/middlewares}/ResponseTime.d.ts +0 -0
- package/lib/cjs/middlewares/ResponseTime.d.ts.map +1 -0
- package/lib/cjs/middlewares/ResponseTime.js +40 -0
- package/lib/cjs/middlewares/ResponseTime.js.map +1 -0
- package/lib/{response-methods → cjs/response-methods}/badRequest.d.ts +0 -0
- package/lib/cjs/response-methods/badRequest.d.ts.map +1 -0
- package/lib/cjs/response-methods/badRequest.js +21 -0
- package/lib/cjs/response-methods/badRequest.js.map +1 -0
- package/lib/{response-methods → cjs/response-methods}/conflict.d.ts +0 -0
- package/lib/cjs/response-methods/conflict.d.ts.map +1 -0
- package/lib/cjs/response-methods/conflict.js +21 -0
- package/lib/cjs/response-methods/conflict.js.map +1 -0
- package/lib/{response-methods → cjs/response-methods}/cookieResponse.d.ts +0 -0
- package/lib/cjs/response-methods/cookieResponse.d.ts.map +1 -0
- package/lib/cjs/response-methods/cookieResponse.js +74 -0
- package/lib/cjs/response-methods/cookieResponse.js.map +1 -0
- package/lib/{response-methods → cjs/response-methods}/created.d.ts +0 -0
- package/lib/cjs/response-methods/created.d.ts.map +1 -0
- package/lib/cjs/response-methods/created.js +21 -0
- package/lib/cjs/response-methods/created.js.map +1 -0
- package/lib/{response-methods → cjs/response-methods}/file.d.ts +0 -0
- package/lib/cjs/response-methods/file.d.ts.map +1 -0
- package/lib/cjs/response-methods/file.js +132 -0
- package/lib/cjs/response-methods/file.js.map +1 -0
- package/lib/{response-methods → cjs/response-methods}/forbidden.d.ts +0 -0
- package/lib/cjs/response-methods/forbidden.d.ts.map +1 -0
- package/lib/cjs/response-methods/forbidden.js +21 -0
- package/lib/cjs/response-methods/forbidden.js.map +1 -0
- package/lib/{response-methods → cjs/response-methods}/index.d.ts +0 -0
- package/lib/cjs/response-methods/index.d.ts.map +1 -0
- package/lib/cjs/response-methods/index.js +30 -0
- package/lib/cjs/response-methods/index.js.map +1 -0
- package/lib/{response-methods → cjs/response-methods}/noContent.d.ts +0 -0
- package/lib/cjs/response-methods/noContent.d.ts.map +1 -0
- package/lib/cjs/response-methods/noContent.js +21 -0
- package/lib/cjs/response-methods/noContent.js.map +1 -0
- package/lib/{response-methods → cjs/response-methods}/notAllowed.d.ts +0 -0
- package/lib/cjs/response-methods/notAllowed.d.ts.map +1 -0
- package/lib/cjs/response-methods/notAllowed.js +21 -0
- package/lib/cjs/response-methods/notAllowed.js.map +1 -0
- package/lib/{response-methods → cjs/response-methods}/notFound.d.ts +0 -0
- package/lib/cjs/response-methods/notFound.d.ts.map +1 -0
- package/lib/cjs/response-methods/notFound.js +21 -0
- package/lib/cjs/response-methods/notFound.js.map +1 -0
- package/lib/{response-methods → cjs/response-methods}/ok.d.ts +0 -0
- package/lib/cjs/response-methods/ok.d.ts.map +1 -0
- package/lib/cjs/response-methods/ok.js +21 -0
- package/lib/cjs/response-methods/ok.js.map +1 -0
- package/lib/{response-methods → cjs/response-methods}/redirect.d.ts +0 -0
- package/lib/cjs/response-methods/redirect.d.ts.map +1 -0
- package/lib/cjs/response-methods/redirect.js +20 -0
- package/lib/cjs/response-methods/redirect.js.map +1 -0
- package/lib/{response-methods → cjs/response-methods}/serverError.d.ts +0 -0
- package/lib/cjs/response-methods/serverError.d.ts.map +1 -0
- package/lib/cjs/response-methods/serverError.js +21 -0
- package/lib/cjs/response-methods/serverError.js.map +1 -0
- package/lib/{response-methods → cjs/response-methods}/template.d.ts +0 -0
- package/lib/cjs/response-methods/template.d.ts.map +1 -0
- package/lib/cjs/response-methods/template.js +37 -0
- package/lib/cjs/response-methods/template.js.map +1 -0
- package/lib/{response-methods → cjs/response-methods}/unauthorized.d.ts +0 -0
- package/lib/cjs/response-methods/unauthorized.d.ts.map +1 -0
- package/lib/cjs/response-methods/unauthorized.js +20 -0
- package/lib/cjs/response-methods/unauthorized.js.map +1 -0
- package/lib/{responses.d.ts → cjs/responses.d.ts} +0 -0
- package/lib/cjs/responses.d.ts.map +1 -0
- package/lib/cjs/responses.js +158 -0
- package/lib/cjs/responses.js.map +1 -0
- package/lib/{route-args → cjs/route-args}/ArgAsRequest.d.ts +0 -0
- package/lib/cjs/route-args/ArgAsRequest.d.ts.map +1 -0
- package/lib/cjs/route-args/ArgAsRequest.js +25 -0
- package/lib/cjs/route-args/ArgAsRequest.js.map +1 -0
- package/lib/{route-args → cjs/route-args}/ArgAsResponse.d.ts +0 -0
- package/lib/cjs/route-args/ArgAsResponse.d.ts.map +1 -0
- package/lib/cjs/route-args/ArgAsResponse.js +25 -0
- package/lib/cjs/route-args/ArgAsResponse.js.map +1 -0
- package/lib/{route-args → cjs/route-args}/ArgHydrator.d.ts +0 -0
- package/lib/cjs/route-args/ArgHydrator.d.ts.map +1 -0
- package/lib/cjs/route-args/ArgHydrator.js +7 -0
- package/lib/cjs/route-args/ArgHydrator.js.map +1 -0
- package/lib/{route-args → cjs/route-args}/FromBody.d.ts +0 -0
- package/lib/cjs/route-args/FromBody.d.ts.map +1 -0
- package/lib/cjs/route-args/FromBody.js +27 -0
- package/lib/cjs/route-args/FromBody.js.map +1 -0
- package/lib/{route-args → cjs/route-args}/FromCookie.d.ts +0 -0
- package/lib/cjs/route-args/FromCookie.d.ts.map +1 -0
- package/lib/cjs/route-args/FromCookie.js +73 -0
- package/lib/cjs/route-args/FromCookie.js.map +1 -0
- package/lib/{route-args → cjs/route-args}/FromDi.d.ts +0 -0
- package/lib/cjs/route-args/FromDi.d.ts.map +1 -0
- package/lib/cjs/route-args/FromDi.js +35 -0
- package/lib/cjs/route-args/FromDi.js.map +1 -0
- package/lib/{route-args → cjs/route-args}/FromForm.d.ts +0 -0
- package/lib/cjs/route-args/FromForm.d.ts.map +1 -0
- package/lib/cjs/route-args/FromForm.js +276 -0
- package/lib/cjs/route-args/FromForm.js.map +1 -0
- package/lib/{route-args → cjs/route-args}/FromHeaderArg.d.ts +0 -0
- package/lib/cjs/route-args/FromHeaderArg.d.ts.map +1 -0
- package/lib/cjs/route-args/FromHeaderArg.js +30 -0
- package/lib/cjs/route-args/FromHeaderArg.js.map +1 -0
- package/lib/{route-args → cjs/route-args}/FromParams.d.ts +0 -0
- package/lib/cjs/route-args/FromParams.d.ts.map +1 -0
- package/lib/cjs/route-args/FromParams.js +29 -0
- package/lib/cjs/route-args/FromParams.js.map +1 -0
- package/lib/{route-args → cjs/route-args}/FromQuery.d.ts +0 -0
- package/lib/cjs/route-args/FromQuery.d.ts.map +1 -0
- package/lib/cjs/route-args/FromQuery.js +29 -0
- package/lib/cjs/route-args/FromQuery.js.map +1 -0
- package/lib/{route-args → cjs/route-args}/RouteArgs.d.ts +0 -0
- package/lib/cjs/route-args/RouteArgs.d.ts.map +1 -0
- package/lib/cjs/route-args/RouteArgs.js +108 -0
- package/lib/cjs/route-args/RouteArgs.js.map +1 -0
- package/lib/{route-args → cjs/route-args}/index.d.ts +0 -0
- package/lib/cjs/route-args/index.d.ts.map +1 -0
- package/lib/cjs/route-args/index.js +28 -0
- package/lib/cjs/route-args/index.js.map +1 -0
- package/lib/{schemas → cjs/schemas}/RouteArgsSchemas.d.ts +0 -0
- package/lib/cjs/schemas/RouteArgsSchemas.d.ts.map +1 -0
- package/lib/cjs/schemas/RouteArgsSchemas.js +27 -0
- package/lib/cjs/schemas/RouteArgsSchemas.js.map +1 -0
- package/lib/cjs/server.d.ts +49 -0
- package/lib/cjs/server.d.ts.map +1 -0
- package/lib/cjs/server.js +261 -0
- package/lib/cjs/server.js.map +1 -0
- package/lib/{static → cjs/static}/favicon.ico +0 -0
- package/lib/{static → cjs/static}/style.css +0 -0
- package/lib/{transformers → cjs/transformers}/PureTransformer.d.ts +0 -0
- package/lib/cjs/transformers/PureTransformer.d.ts.map +1 -0
- package/lib/cjs/transformers/PureTransformer.js +28 -0
- package/lib/cjs/transformers/PureTransformer.js.map +1 -0
- package/lib/{transformers → cjs/transformers}/index.d.ts +0 -0
- package/lib/cjs/transformers/index.d.ts.map +1 -0
- package/lib/cjs/transformers/index.js +18 -0
- package/lib/cjs/transformers/index.js.map +1 -0
- package/lib/{views → cjs/views}/responses/badRequest.pug +0 -0
- package/lib/{views → cjs/views}/responses/conflict.pug +0 -0
- package/lib/{views → cjs/views}/responses/forbidden.pug +0 -0
- package/lib/{views → cjs/views}/responses/noContent.pug +0 -0
- package/lib/{views → cjs/views}/responses/not-allowed.pug +0 -0
- package/lib/{views → cjs/views}/responses/notFound.pug +0 -0
- package/lib/{views → cjs/views}/responses/ok.pug +0 -0
- package/lib/{views → cjs/views}/responses/serverError.pug +0 -0
- package/lib/{views → cjs/views}/responses/unauthorized.pug +0 -0
- package/lib/mjs/config/http.d.ts +59 -0
- package/lib/mjs/config/http.d.ts.map +1 -0
- package/lib/{config → mjs/config}/http.js +0 -0
- package/lib/mjs/config/http.js.map +1 -0
- package/lib/{controllers.d.ts → mjs/controllers.d.ts} +0 -0
- package/lib/mjs/controllers.d.ts.map +1 -0
- package/lib/{controllers.js → mjs/controllers.js} +0 -0
- package/lib/mjs/controllers.js.map +1 -0
- package/lib/mjs/decorators.d.ts +156 -0
- package/lib/mjs/decorators.d.ts.map +1 -0
- package/lib/{decorators.js → mjs/decorators.js} +0 -0
- package/lib/mjs/decorators.js.map +1 -0
- package/lib/{exceptions.d.ts → mjs/exceptions.d.ts} +0 -0
- package/lib/mjs/exceptions.d.ts.map +1 -0
- package/lib/{exceptions.js → mjs/exceptions.js} +0 -0
- package/lib/mjs/exceptions.js.map +1 -0
- package/lib/mjs/index.d.ts +9 -0
- package/lib/mjs/index.d.ts.map +1 -0
- package/lib/{index.js → mjs/index.js} +0 -0
- package/lib/mjs/index.js.map +1 -0
- package/lib/mjs/interfaces.d.ts +505 -0
- package/lib/mjs/interfaces.d.ts.map +1 -0
- package/lib/{interfaces.js → mjs/interfaces.js} +5 -5
- package/lib/mjs/interfaces.js.map +1 -0
- package/lib/mjs/locales/en.json +10 -0
- package/lib/mjs/locales/pl.json +10 -0
- package/lib/mjs/middlewares/RequestId.d.ts +9 -0
- package/lib/mjs/middlewares/RequestId.d.ts.map +1 -0
- package/lib/{middlewares → mjs/middlewares}/RequestId.js +0 -0
- package/lib/mjs/middlewares/RequestId.js.map +1 -0
- package/lib/mjs/middlewares/ResponseTime.d.ts +11 -0
- package/lib/mjs/middlewares/ResponseTime.d.ts.map +1 -0
- package/lib/{middlewares → mjs/middlewares}/ResponseTime.js +0 -0
- package/lib/mjs/middlewares/ResponseTime.js.map +1 -0
- package/lib/mjs/response-methods/badRequest.d.ts +13 -0
- package/lib/mjs/response-methods/badRequest.d.ts.map +1 -0
- package/lib/{response-methods → mjs/response-methods}/badRequest.js +0 -0
- package/lib/mjs/response-methods/badRequest.js.map +1 -0
- package/lib/mjs/response-methods/conflict.d.ts +13 -0
- package/lib/mjs/response-methods/conflict.d.ts.map +1 -0
- package/lib/{response-methods → mjs/response-methods}/conflict.js +0 -0
- package/lib/mjs/response-methods/conflict.js.map +1 -0
- package/lib/mjs/response-methods/cookieResponse.d.ts +20 -0
- package/lib/mjs/response-methods/cookieResponse.d.ts.map +1 -0
- package/lib/{response-methods → mjs/response-methods}/cookieResponse.js +0 -0
- package/lib/mjs/response-methods/cookieResponse.js.map +1 -0
- package/lib/mjs/response-methods/created.d.ts +13 -0
- package/lib/mjs/response-methods/created.d.ts.map +1 -0
- package/lib/{response-methods → mjs/response-methods}/created.js +0 -0
- package/lib/mjs/response-methods/created.js.map +1 -0
- package/lib/mjs/response-methods/file.d.ts +27 -0
- package/lib/mjs/response-methods/file.d.ts.map +1 -0
- package/lib/{response-methods → mjs/response-methods}/file.js +0 -0
- package/lib/mjs/response-methods/file.js.map +1 -0
- package/lib/mjs/response-methods/forbidden.d.ts +13 -0
- package/lib/mjs/response-methods/forbidden.d.ts.map +1 -0
- package/lib/{response-methods → mjs/response-methods}/forbidden.js +0 -0
- package/lib/mjs/response-methods/forbidden.js.map +1 -0
- package/lib/mjs/response-methods/index.d.ts +14 -0
- package/lib/mjs/response-methods/index.d.ts.map +1 -0
- package/lib/{response-methods → mjs/response-methods}/index.js +0 -0
- package/lib/mjs/response-methods/index.js.map +1 -0
- package/lib/mjs/response-methods/noContent.d.ts +13 -0
- package/lib/mjs/response-methods/noContent.d.ts.map +1 -0
- package/lib/{response-methods → mjs/response-methods}/noContent.js +0 -0
- package/lib/mjs/response-methods/noContent.js.map +1 -0
- package/lib/mjs/response-methods/notAllowed.d.ts +13 -0
- package/lib/mjs/response-methods/notAllowed.d.ts.map +1 -0
- package/lib/{response-methods → mjs/response-methods}/notAllowed.js +0 -0
- package/lib/mjs/response-methods/notAllowed.js.map +1 -0
- package/lib/mjs/response-methods/notFound.d.ts +13 -0
- package/lib/mjs/response-methods/notFound.d.ts.map +1 -0
- package/lib/{response-methods → mjs/response-methods}/notFound.js +0 -0
- package/lib/mjs/response-methods/notFound.js.map +1 -0
- package/lib/mjs/response-methods/ok.d.ts +13 -0
- package/lib/mjs/response-methods/ok.d.ts.map +1 -0
- package/lib/{response-methods → mjs/response-methods}/ok.js +0 -0
- package/lib/mjs/response-methods/ok.js.map +1 -0
- package/lib/mjs/response-methods/redirect.d.ts +13 -0
- package/lib/mjs/response-methods/redirect.d.ts.map +1 -0
- package/lib/{response-methods → mjs/response-methods}/redirect.js +0 -0
- package/lib/mjs/response-methods/redirect.js.map +1 -0
- package/lib/mjs/response-methods/serverError.d.ts +13 -0
- package/lib/mjs/response-methods/serverError.d.ts.map +1 -0
- package/lib/{response-methods → mjs/response-methods}/serverError.js +0 -0
- package/lib/mjs/response-methods/serverError.js.map +1 -0
- package/lib/mjs/response-methods/template.d.ts +16 -0
- package/lib/mjs/response-methods/template.d.ts.map +1 -0
- package/lib/{response-methods → mjs/response-methods}/template.js +0 -0
- package/lib/mjs/response-methods/template.js.map +1 -0
- package/lib/mjs/response-methods/unauthorized.d.ts +13 -0
- package/lib/mjs/response-methods/unauthorized.d.ts.map +1 -0
- package/lib/{response-methods → mjs/response-methods}/unauthorized.js +0 -0
- package/lib/mjs/response-methods/unauthorized.js.map +1 -0
- package/lib/mjs/responses.d.ts +35 -0
- package/lib/mjs/responses.d.ts.map +1 -0
- package/lib/{responses.js → mjs/responses.js} +0 -0
- package/lib/mjs/responses.js.map +1 -0
- package/lib/mjs/route-args/ArgAsRequest.d.ts +10 -0
- package/lib/mjs/route-args/ArgAsRequest.d.ts.map +1 -0
- package/lib/{route-args → mjs/route-args}/ArgAsRequest.js +0 -0
- package/lib/mjs/route-args/ArgAsRequest.js.map +1 -0
- package/lib/mjs/route-args/ArgAsResponse.d.ts +11 -0
- package/lib/mjs/route-args/ArgAsResponse.d.ts.map +1 -0
- package/lib/{route-args → mjs/route-args}/ArgAsResponse.js +0 -0
- package/lib/mjs/route-args/ArgAsResponse.js.map +1 -0
- package/lib/mjs/route-args/ArgHydrator.d.ts +5 -0
- package/lib/mjs/route-args/ArgHydrator.d.ts.map +1 -0
- package/lib/{route-args → mjs/route-args}/ArgHydrator.js +0 -0
- package/lib/mjs/route-args/ArgHydrator.js.map +1 -0
- package/lib/mjs/route-args/FromBody.d.ts +11 -0
- package/lib/mjs/route-args/FromBody.d.ts.map +1 -0
- package/lib/{route-args → mjs/route-args}/FromBody.js +0 -0
- package/lib/mjs/route-args/FromBody.js.map +1 -0
- package/lib/mjs/route-args/FromCookie.d.ts +14 -0
- package/lib/mjs/route-args/FromCookie.d.ts.map +1 -0
- package/lib/{route-args → mjs/route-args}/FromCookie.js +0 -0
- package/lib/mjs/route-args/FromCookie.js.map +1 -0
- package/lib/mjs/route-args/FromDi.d.ts +14 -0
- package/lib/mjs/route-args/FromDi.d.ts.map +1 -0
- package/lib/{route-args → mjs/route-args}/FromDi.js +0 -0
- package/lib/mjs/route-args/FromDi.js.map +1 -0
- package/lib/mjs/route-args/FromForm.d.ts +90 -0
- package/lib/mjs/route-args/FromForm.d.ts.map +1 -0
- package/lib/{route-args → mjs/route-args}/FromForm.js +0 -0
- package/lib/mjs/route-args/FromForm.js.map +1 -0
- package/lib/mjs/route-args/FromHeaderArg.d.ts +13 -0
- package/lib/mjs/route-args/FromHeaderArg.d.ts.map +1 -0
- package/lib/{route-args → mjs/route-args}/FromHeaderArg.js +0 -0
- package/lib/mjs/route-args/FromHeaderArg.js.map +1 -0
- package/lib/mjs/route-args/FromParams.d.ts +11 -0
- package/lib/mjs/route-args/FromParams.d.ts.map +1 -0
- package/lib/{route-args → mjs/route-args}/FromParams.js +0 -0
- package/lib/mjs/route-args/FromParams.js.map +1 -0
- package/lib/mjs/route-args/FromQuery.d.ts +11 -0
- package/lib/mjs/route-args/FromQuery.d.ts.map +1 -0
- package/lib/{route-args → mjs/route-args}/FromQuery.js +0 -0
- package/lib/mjs/route-args/FromQuery.js.map +1 -0
- package/lib/mjs/route-args/RouteArgs.d.ts +22 -0
- package/lib/mjs/route-args/RouteArgs.d.ts.map +1 -0
- package/lib/{route-args → mjs/route-args}/RouteArgs.js +0 -0
- package/lib/mjs/route-args/RouteArgs.js.map +1 -0
- package/lib/mjs/route-args/index.d.ts +12 -0
- package/lib/mjs/route-args/index.d.ts.map +1 -0
- package/lib/{route-args → mjs/route-args}/index.js +0 -0
- package/lib/mjs/route-args/index.js.map +1 -0
- package/lib/mjs/schemas/RouteArgsSchemas.d.ts +37 -0
- package/lib/mjs/schemas/RouteArgsSchemas.d.ts.map +1 -0
- package/lib/{schemas → mjs/schemas}/RouteArgsSchemas.js +0 -0
- package/lib/mjs/schemas/RouteArgsSchemas.js.map +1 -0
- package/lib/{server.d.ts → mjs/server.d.ts} +0 -0
- package/lib/mjs/server.d.ts.map +1 -0
- package/lib/{server.js → mjs/server.js} +0 -0
- package/lib/mjs/server.js.map +1 -0
- package/lib/mjs/static/favicon.ico +0 -0
- package/lib/mjs/static/style.css +15 -0
- package/lib/mjs/transformers/PureTransformer.d.ts +10 -0
- package/lib/mjs/transformers/PureTransformer.d.ts.map +1 -0
- package/lib/{transformers → mjs/transformers}/PureTransformer.js +0 -0
- package/lib/mjs/transformers/PureTransformer.js.map +1 -0
- package/lib/mjs/transformers/index.d.ts +2 -0
- package/lib/mjs/transformers/index.d.ts.map +1 -0
- package/lib/{transformers → mjs/transformers}/index.js +0 -0
- package/lib/mjs/transformers/index.js.map +1 -0
- package/lib/mjs/views/responses/badRequest.pug +13 -0
- package/lib/mjs/views/responses/conflict.pug +13 -0
- package/lib/mjs/views/responses/forbidden.pug +13 -0
- package/lib/mjs/views/responses/noContent.pug +13 -0
- package/lib/mjs/views/responses/not-allowed.pug +13 -0
- package/lib/mjs/views/responses/notFound.pug +13 -0
- package/lib/mjs/views/responses/ok.pug +12 -0
- package/lib/mjs/views/responses/serverError.pug +13 -0
- package/lib/mjs/views/responses/unauthorized.pug +13 -0
- package/lib/tsconfig.cjs.tsbuildinfo +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/package.json +21 -12
- package/lib/config/http.d.ts.map +0 -1
- package/lib/config/http.js.map +0 -1
- package/lib/controllers.d.ts.map +0 -1
- package/lib/controllers.js.map +0 -1
- package/lib/decorators.d.ts.map +0 -1
- package/lib/decorators.js.map +0 -1
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/interfaces.d.ts.map +0 -1
- package/lib/interfaces.js.map +0 -1
- package/lib/middlewares/RequestId.d.ts.map +0 -1
- package/lib/middlewares/RequestId.js.map +0 -1
- package/lib/middlewares/ResponseTime.d.ts.map +0 -1
- package/lib/middlewares/ResponseTime.js.map +0 -1
- package/lib/response-methods/badRequest.d.ts.map +0 -1
- package/lib/response-methods/badRequest.js.map +0 -1
- package/lib/response-methods/conflict.d.ts.map +0 -1
- package/lib/response-methods/conflict.js.map +0 -1
- package/lib/response-methods/cookieResponse.d.ts.map +0 -1
- package/lib/response-methods/cookieResponse.js.map +0 -1
- package/lib/response-methods/created.d.ts.map +0 -1
- package/lib/response-methods/created.js.map +0 -1
- package/lib/response-methods/file.d.ts.map +0 -1
- package/lib/response-methods/file.js.map +0 -1
- package/lib/response-methods/forbidden.d.ts.map +0 -1
- package/lib/response-methods/forbidden.js.map +0 -1
- package/lib/response-methods/index.d.ts.map +0 -1
- package/lib/response-methods/index.js.map +0 -1
- package/lib/response-methods/noContent.d.ts.map +0 -1
- package/lib/response-methods/noContent.js.map +0 -1
- package/lib/response-methods/notAllowed.d.ts.map +0 -1
- package/lib/response-methods/notAllowed.js.map +0 -1
- package/lib/response-methods/notFound.d.ts.map +0 -1
- package/lib/response-methods/notFound.js.map +0 -1
- package/lib/response-methods/ok.d.ts.map +0 -1
- package/lib/response-methods/ok.js.map +0 -1
- package/lib/response-methods/redirect.d.ts.map +0 -1
- package/lib/response-methods/redirect.js.map +0 -1
- package/lib/response-methods/serverError.d.ts.map +0 -1
- package/lib/response-methods/serverError.js.map +0 -1
- package/lib/response-methods/template.d.ts.map +0 -1
- package/lib/response-methods/template.js.map +0 -1
- package/lib/response-methods/unauthorized.d.ts.map +0 -1
- package/lib/response-methods/unauthorized.js.map +0 -1
- package/lib/responses.d.ts.map +0 -1
- package/lib/responses.js.map +0 -1
- package/lib/route-args/ArgAsRequest.d.ts.map +0 -1
- package/lib/route-args/ArgAsRequest.js.map +0 -1
- package/lib/route-args/ArgAsResponse.d.ts.map +0 -1
- package/lib/route-args/ArgAsResponse.js.map +0 -1
- package/lib/route-args/ArgHydrator.d.ts.map +0 -1
- package/lib/route-args/ArgHydrator.js.map +0 -1
- package/lib/route-args/FromBody.d.ts.map +0 -1
- package/lib/route-args/FromBody.js.map +0 -1
- package/lib/route-args/FromCookie.d.ts.map +0 -1
- package/lib/route-args/FromCookie.js.map +0 -1
- package/lib/route-args/FromDi.d.ts.map +0 -1
- package/lib/route-args/FromDi.js.map +0 -1
- package/lib/route-args/FromForm.d.ts.map +0 -1
- package/lib/route-args/FromForm.js.map +0 -1
- package/lib/route-args/FromHeaderArg.d.ts.map +0 -1
- package/lib/route-args/FromHeaderArg.js.map +0 -1
- package/lib/route-args/FromParams.d.ts.map +0 -1
- package/lib/route-args/FromParams.js.map +0 -1
- package/lib/route-args/FromQuery.d.ts.map +0 -1
- package/lib/route-args/FromQuery.js.map +0 -1
- package/lib/route-args/RouteArgs.d.ts.map +0 -1
- package/lib/route-args/RouteArgs.js.map +0 -1
- package/lib/route-args/index.d.ts.map +0 -1
- package/lib/route-args/index.js.map +0 -1
- package/lib/schemas/RouteArgsSchemas.d.ts.map +0 -1
- package/lib/schemas/RouteArgsSchemas.js.map +0 -1
- package/lib/server.d.ts.map +0 -1
- package/lib/server.js.map +0 -1
- package/lib/transformers/PureTransformer.d.ts.map +0 -1
- package/lib/transformers/PureTransformer.js.map +0 -1
- package/lib/transformers/index.d.ts.map +0 -1
- package/lib/transformers/index.js.map +0 -1
|
@@ -0,0 +1,505 @@
|
|
|
1
|
+
import * as express from 'express';
|
|
2
|
+
import { Constructor, AsyncService } from '@spinajs/di';
|
|
3
|
+
import { Configuration } from '@spinajs/configuration';
|
|
4
|
+
import { fs } from '@spinajs/fs';
|
|
5
|
+
/**
|
|
6
|
+
* Accept header enum
|
|
7
|
+
*/
|
|
8
|
+
export declare enum HttpAcceptHeaders {
|
|
9
|
+
/**
|
|
10
|
+
* Accept header for JSON
|
|
11
|
+
*/
|
|
12
|
+
JSON = 1,
|
|
13
|
+
/**
|
|
14
|
+
* Accept header for HTML
|
|
15
|
+
*/
|
|
16
|
+
HTML = 2,
|
|
17
|
+
/**
|
|
18
|
+
* Accept header for XML
|
|
19
|
+
*/
|
|
20
|
+
XML = 4,
|
|
21
|
+
/**
|
|
22
|
+
* Accept all accept headers shorcut
|
|
23
|
+
*/
|
|
24
|
+
ALL = 7
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Config options for static files
|
|
28
|
+
*/
|
|
29
|
+
export interface IHttpStaticFileConfiguration {
|
|
30
|
+
/**
|
|
31
|
+
* virtual prefix in url eg. http://localhost:3000/static/images/kitten.jpg
|
|
32
|
+
*/
|
|
33
|
+
Route: string;
|
|
34
|
+
/**
|
|
35
|
+
* full path to folder with static content
|
|
36
|
+
*/
|
|
37
|
+
Path: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Uploaded file fields
|
|
41
|
+
*/
|
|
42
|
+
export interface IUploadedFile {
|
|
43
|
+
Size: number;
|
|
44
|
+
Path: string;
|
|
45
|
+
Name: string;
|
|
46
|
+
Type: string;
|
|
47
|
+
LastModifiedDate?: Date;
|
|
48
|
+
Hash?: string;
|
|
49
|
+
}
|
|
50
|
+
export interface Request extends express.Request {
|
|
51
|
+
storage: IActionLocalStoregeContext;
|
|
52
|
+
}
|
|
53
|
+
export interface IActionLocalStoregeContext {
|
|
54
|
+
requestId: string;
|
|
55
|
+
responseStart: Date;
|
|
56
|
+
}
|
|
57
|
+
export declare abstract class ServerMiddleware extends AsyncService {
|
|
58
|
+
Order: number;
|
|
59
|
+
abstract before(): (req: Request, res: express.Response, next: express.NextFunction) => void | null;
|
|
60
|
+
abstract after(): (req: Request, res: express.Response, next: express.NextFunction) => void | null;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* HTTP response statuses
|
|
64
|
+
*/
|
|
65
|
+
export declare enum HTTP_STATUS_CODE {
|
|
66
|
+
/**
|
|
67
|
+
* All ok with content
|
|
68
|
+
*/
|
|
69
|
+
OK = 200,
|
|
70
|
+
/**
|
|
71
|
+
* Request is OK and new resource has been created.
|
|
72
|
+
*/
|
|
73
|
+
CREATED = 201,
|
|
74
|
+
/**
|
|
75
|
+
* Request is accepted, but has not been completed yet.
|
|
76
|
+
*/
|
|
77
|
+
ACCEPTED = 202,
|
|
78
|
+
/**
|
|
79
|
+
* ALl is ok & no content to return
|
|
80
|
+
*/
|
|
81
|
+
NO_CONTENT = 204,
|
|
82
|
+
/**
|
|
83
|
+
* The server is delivering only part of the resource (byte serving) due to a range header
|
|
84
|
+
* sent by the client. The range header is used by HTTP clients to enable resuming of
|
|
85
|
+
* interrupted downloads, or split a download into multiple simultaneous streams.
|
|
86
|
+
*/
|
|
87
|
+
PARTIAL_CONTENT = 206,
|
|
88
|
+
/**
|
|
89
|
+
* Resource is not modified
|
|
90
|
+
*/
|
|
91
|
+
NOT_MODIFIED = 304,
|
|
92
|
+
/**
|
|
93
|
+
* Invalid request, eg. invalid parameters
|
|
94
|
+
*/
|
|
95
|
+
BAD_REQUEST = 400,
|
|
96
|
+
/**
|
|
97
|
+
* Auth required
|
|
98
|
+
*/
|
|
99
|
+
UNAUTHORIZED = 401,
|
|
100
|
+
/**
|
|
101
|
+
* No permission
|
|
102
|
+
*/
|
|
103
|
+
FORBIDDEN = 403,
|
|
104
|
+
/**
|
|
105
|
+
* Resource not found
|
|
106
|
+
*/
|
|
107
|
+
NOT_FOUND = 404,
|
|
108
|
+
/**
|
|
109
|
+
* Not acceptable request headers (Accept header)
|
|
110
|
+
*/
|
|
111
|
+
NOT_ACCEPTABLE = 406,
|
|
112
|
+
/**
|
|
113
|
+
* Method not allowed eg. DELETE not allowed on resource, or login second time
|
|
114
|
+
*/
|
|
115
|
+
NOT_ALLOWED = 405,
|
|
116
|
+
/**
|
|
117
|
+
* Conflict
|
|
118
|
+
*/
|
|
119
|
+
CONFLICT = 409,
|
|
120
|
+
/**
|
|
121
|
+
* Internal server error.
|
|
122
|
+
*/
|
|
123
|
+
INTERNAL_ERROR = 500,
|
|
124
|
+
/**
|
|
125
|
+
* Method not implemented
|
|
126
|
+
*/
|
|
127
|
+
NOT_IMPLEMENTED = 501
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Avaible route types, match HTTP methods
|
|
131
|
+
*/
|
|
132
|
+
export declare enum RouteType {
|
|
133
|
+
/**
|
|
134
|
+
* POST method - used to create new resource or send data to server
|
|
135
|
+
*/
|
|
136
|
+
POST = "post",
|
|
137
|
+
/**
|
|
138
|
+
* GET method - used to retrieve data from server
|
|
139
|
+
*/
|
|
140
|
+
GET = "get",
|
|
141
|
+
/**
|
|
142
|
+
* PUT method - used to updates resource
|
|
143
|
+
*/
|
|
144
|
+
PUT = "put",
|
|
145
|
+
/**
|
|
146
|
+
* DELETE method - used to delete resource
|
|
147
|
+
*/
|
|
148
|
+
DELETE = "delete",
|
|
149
|
+
/**
|
|
150
|
+
* PATCH method - used to partially update resource eg. one field
|
|
151
|
+
*/
|
|
152
|
+
PATCH = "patch",
|
|
153
|
+
/**
|
|
154
|
+
* HEAD method - same as get, but returns no data. usefull for checking if resource exists etc.
|
|
155
|
+
*/
|
|
156
|
+
HEAD = "head",
|
|
157
|
+
/**
|
|
158
|
+
* FILE method - spine special route type. Internall its simple GET method, but informs that specified route returns binary file
|
|
159
|
+
*/
|
|
160
|
+
FILE = "file",
|
|
161
|
+
UNKNOWN = "unknown"
|
|
162
|
+
}
|
|
163
|
+
export declare enum UuidVersion {
|
|
164
|
+
v1 = 0,
|
|
165
|
+
v3 = 1,
|
|
166
|
+
v4 = 2,
|
|
167
|
+
v5 = 3
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Avaible route parameters type
|
|
171
|
+
*/
|
|
172
|
+
export declare enum ParameterType {
|
|
173
|
+
/**
|
|
174
|
+
* Parameter is injected from DI container & resolved
|
|
175
|
+
*/
|
|
176
|
+
FromDi = "FromDi",
|
|
177
|
+
/**
|
|
178
|
+
* Parameter value is taken from query string eg. `?name=flavio`
|
|
179
|
+
*/
|
|
180
|
+
FromQuery = "FromQuery",
|
|
181
|
+
/**
|
|
182
|
+
* From message body, eg. POST json object
|
|
183
|
+
*/
|
|
184
|
+
FromBody = "FromBody",
|
|
185
|
+
/**
|
|
186
|
+
* From url params eg: `/:id`
|
|
187
|
+
*/
|
|
188
|
+
FromParams = "FromParams",
|
|
189
|
+
/**
|
|
190
|
+
* From form file field
|
|
191
|
+
*/
|
|
192
|
+
FromFile = "FromFile",
|
|
193
|
+
/**
|
|
194
|
+
* From form
|
|
195
|
+
*/
|
|
196
|
+
FromForm = "FromForm",
|
|
197
|
+
/**
|
|
198
|
+
* From cvs file
|
|
199
|
+
*/
|
|
200
|
+
FromCSV = "FromCSV",
|
|
201
|
+
/**
|
|
202
|
+
* From JSON file
|
|
203
|
+
*/
|
|
204
|
+
FromJSONFile = "FromJSONFile",
|
|
205
|
+
/**
|
|
206
|
+
* From form field
|
|
207
|
+
*/
|
|
208
|
+
FormField = "FromFormField",
|
|
209
|
+
/**
|
|
210
|
+
* From model object
|
|
211
|
+
*/
|
|
212
|
+
FromModel = "FromModel",
|
|
213
|
+
/**
|
|
214
|
+
* Data from coockie
|
|
215
|
+
*/
|
|
216
|
+
FromCookie = "FromCookie",
|
|
217
|
+
/**
|
|
218
|
+
* From http header
|
|
219
|
+
*/
|
|
220
|
+
FromHeader = "FromHeader",
|
|
221
|
+
/**
|
|
222
|
+
* Req from express
|
|
223
|
+
*/
|
|
224
|
+
Req = "ArgAsRequest",
|
|
225
|
+
Res = "ArgAsResponse",
|
|
226
|
+
/**
|
|
227
|
+
* Other custom arguments
|
|
228
|
+
*/
|
|
229
|
+
Other = "Other"
|
|
230
|
+
}
|
|
231
|
+
export interface IFormOptions {
|
|
232
|
+
multiples: boolean;
|
|
233
|
+
}
|
|
234
|
+
export interface IFormOptions {
|
|
235
|
+
/**
|
|
236
|
+
* default 1000; limit the number of fields that the Querystring parser will decode, set 0 for unlimited
|
|
237
|
+
*/
|
|
238
|
+
maxFields?: number;
|
|
239
|
+
/**
|
|
240
|
+
* default 20 * 1024 * 1024 (20mb); limit the amount of memory all fields together (except files) can allocate in bytes.
|
|
241
|
+
*/
|
|
242
|
+
maxFieldsSize?: number;
|
|
243
|
+
/**
|
|
244
|
+
* default 'utf-8'; sets encoding for incoming form fields,
|
|
245
|
+
*/
|
|
246
|
+
encoding?: string;
|
|
247
|
+
}
|
|
248
|
+
export interface IUploadOptions {
|
|
249
|
+
/**
|
|
250
|
+
* default false; include checksums calculated for incoming files, set this to some hash algorithm, see crypto.createHash for available algorithms
|
|
251
|
+
*/
|
|
252
|
+
hash?: false;
|
|
253
|
+
/**
|
|
254
|
+
* default os.tmpdir(); the directory for placing file uploads in. You can move them later by using fs.rename()
|
|
255
|
+
*/
|
|
256
|
+
uploadDir?: string | ((cfg: Configuration) => string);
|
|
257
|
+
/**
|
|
258
|
+
* default false; when you call the .parse method, the files argument (of the callback) will contain arrays of files for inputs which submit multiple files using the HTML5 multiple attribute. Also, the fields argument will contain arrays of values for fields that have names ending with '[]'.
|
|
259
|
+
*/
|
|
260
|
+
multiples?: boolean;
|
|
261
|
+
enabledPlugins?: string[];
|
|
262
|
+
/**
|
|
263
|
+
* default 200 * 1024 * 1024 (200mb); limit the size of uploaded file.
|
|
264
|
+
*/
|
|
265
|
+
maxFileSize?: number;
|
|
266
|
+
/**
|
|
267
|
+
* default false; to include the extensions of the original files or not
|
|
268
|
+
*/
|
|
269
|
+
keepExtensions?: boolean;
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Describes parameters passed to route.
|
|
273
|
+
*/
|
|
274
|
+
export interface IRouteParameter {
|
|
275
|
+
/**
|
|
276
|
+
* Parameter index in function args
|
|
277
|
+
*/
|
|
278
|
+
Index: number;
|
|
279
|
+
/**
|
|
280
|
+
* Is value taken from query string, url params or message body
|
|
281
|
+
*/
|
|
282
|
+
Type: ParameterType | string;
|
|
283
|
+
/**
|
|
284
|
+
* Schema for validation parameter ( raw value eg. to check if matches string / number constrain)
|
|
285
|
+
*/
|
|
286
|
+
RouteParamSchema?: any;
|
|
287
|
+
/**
|
|
288
|
+
* Schema for paramater
|
|
289
|
+
*/
|
|
290
|
+
Schema?: any;
|
|
291
|
+
/**
|
|
292
|
+
* Additional options
|
|
293
|
+
*/
|
|
294
|
+
Options?: any;
|
|
295
|
+
/**
|
|
296
|
+
* Parameter runtime type eg. number or class
|
|
297
|
+
*/
|
|
298
|
+
RuntimeType: any;
|
|
299
|
+
/**
|
|
300
|
+
* Name of parameter eg. `id`
|
|
301
|
+
*/
|
|
302
|
+
Name: string;
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Route action call spefici data. Used to pass data / arguments when parsing
|
|
306
|
+
* action parameters for specific call. Eg. to parse form data, and extract it
|
|
307
|
+
* as different arguments.
|
|
308
|
+
*/
|
|
309
|
+
export interface IRouteCall {
|
|
310
|
+
Payload: any;
|
|
311
|
+
}
|
|
312
|
+
export interface ICookieOptions {
|
|
313
|
+
maxAge?: number | undefined;
|
|
314
|
+
signed?: boolean | undefined;
|
|
315
|
+
expires?: Date | undefined;
|
|
316
|
+
httpOnly?: boolean | undefined;
|
|
317
|
+
path?: string | undefined;
|
|
318
|
+
domain?: string | undefined;
|
|
319
|
+
secure?: boolean | undefined;
|
|
320
|
+
sameSite?: boolean | 'lax' | 'strict' | 'none' | undefined;
|
|
321
|
+
}
|
|
322
|
+
export interface IRoute {
|
|
323
|
+
/**
|
|
324
|
+
* url path eg. /foo/bar/:id
|
|
325
|
+
*/
|
|
326
|
+
Path: string;
|
|
327
|
+
/**
|
|
328
|
+
* HTTP request method, used internally. Not visible to others.
|
|
329
|
+
*/
|
|
330
|
+
InternalType: RouteType;
|
|
331
|
+
/**
|
|
332
|
+
* SPINAJS API method type, mostly same as HTTP type, but can be non standard type eg. FILE
|
|
333
|
+
* This type is visible outside in api discovery.
|
|
334
|
+
*/
|
|
335
|
+
Type: RouteType;
|
|
336
|
+
/**
|
|
337
|
+
* Method name assigned to this route eg. `findUsers`
|
|
338
|
+
*/
|
|
339
|
+
Method: string;
|
|
340
|
+
/**
|
|
341
|
+
* Custom route parameters taken from query string or message body
|
|
342
|
+
*/
|
|
343
|
+
Parameters: Map<number, IRouteParameter>;
|
|
344
|
+
/**
|
|
345
|
+
* Assigned middlewares to route
|
|
346
|
+
*/
|
|
347
|
+
Middlewares: IMiddlewareDescriptor[];
|
|
348
|
+
/**
|
|
349
|
+
* Assigned policies to route
|
|
350
|
+
*/
|
|
351
|
+
Policies: IPolicyDescriptor[];
|
|
352
|
+
/**
|
|
353
|
+
* Additional route options eg. file size etc.
|
|
354
|
+
*/
|
|
355
|
+
Options: any;
|
|
356
|
+
Schema: any;
|
|
357
|
+
}
|
|
358
|
+
export interface IMiddlewareDescriptor {
|
|
359
|
+
Type: Constructor<RouteMiddleware>;
|
|
360
|
+
Options: any[];
|
|
361
|
+
}
|
|
362
|
+
export interface IController {
|
|
363
|
+
/**
|
|
364
|
+
* Express router with middleware stack
|
|
365
|
+
*/
|
|
366
|
+
Router: express.Router;
|
|
367
|
+
/**
|
|
368
|
+
* Controller descriptor
|
|
369
|
+
*/
|
|
370
|
+
Descriptor: IControllerDescriptor;
|
|
371
|
+
/**
|
|
372
|
+
* Base path for all controller routes eg. my/custom/path/
|
|
373
|
+
*
|
|
374
|
+
* It can be defined via `@BasePath` decorator, defaults to controller name without `Controller` part.
|
|
375
|
+
*/
|
|
376
|
+
BasePath: string;
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Middlewares are classes that can change request object or perform specific task before & after route execution
|
|
380
|
+
* eg. route parameter logging / headers check etc.
|
|
381
|
+
*/
|
|
382
|
+
export declare abstract class RouteMiddleware {
|
|
383
|
+
/**
|
|
384
|
+
* Inform, if middleware is enabled for given action
|
|
385
|
+
*/
|
|
386
|
+
abstract isEnabled(route: IRoute, controller: IController): boolean;
|
|
387
|
+
/**
|
|
388
|
+
* Called before action in middleware stack eg. to modify req or resp objects.
|
|
389
|
+
* Its express middleware func
|
|
390
|
+
*/
|
|
391
|
+
abstract onBefore(req: express.Request, res: express.Response, route: IRoute, controller: IController): Promise<void>;
|
|
392
|
+
/**
|
|
393
|
+
* Called after action response, is framework middleware
|
|
394
|
+
* Used to modify response returned by actions in controller
|
|
395
|
+
* eg. filter out data
|
|
396
|
+
*
|
|
397
|
+
*/
|
|
398
|
+
abstract onResponse(response: Response, route: IRoute, controller: IController): Promise<void>;
|
|
399
|
+
/**
|
|
400
|
+
* Called after action in middleware stack eg. to modify express response.
|
|
401
|
+
* Its express middleware func
|
|
402
|
+
*/
|
|
403
|
+
abstract onAfter(req: express.Request, res: express.Response, route: IRoute, controller: IController): Promise<void>;
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* Descriptor for policies eg. attached routes, passed options eg. token etc.
|
|
407
|
+
*/
|
|
408
|
+
export interface IPolicyDescriptor {
|
|
409
|
+
Type: Constructor<BasePolicy>;
|
|
410
|
+
Options: any[];
|
|
411
|
+
}
|
|
412
|
+
export type ResponseFunction = (req: express.Request, res: express.Response) => void;
|
|
413
|
+
export declare abstract class Response {
|
|
414
|
+
protected responseData: any;
|
|
415
|
+
protected fs: fs;
|
|
416
|
+
constructor(responseData: any);
|
|
417
|
+
abstract execute(req: express.Request, res: express.Response, next?: express.NextFunction): Promise<ResponseFunction | void>;
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* Base class for policies.
|
|
421
|
+
*
|
|
422
|
+
* Policies checks if route can be executed eg. user have proper role
|
|
423
|
+
*/
|
|
424
|
+
export declare abstract class BasePolicy {
|
|
425
|
+
/**
|
|
426
|
+
* Checks if policy is enabled for given action & controlle eg. user session exists
|
|
427
|
+
*
|
|
428
|
+
* @param action action that is executed ( route info )
|
|
429
|
+
* @param instance controller instance
|
|
430
|
+
*/
|
|
431
|
+
abstract isEnabled(action: IRoute, instance: IController): boolean;
|
|
432
|
+
/**
|
|
433
|
+
*
|
|
434
|
+
* Executes policy, when throws exception - route is not executed
|
|
435
|
+
*
|
|
436
|
+
* @param req express request object
|
|
437
|
+
*/
|
|
438
|
+
abstract execute(req: Request, action: IRoute, instance: IController): Promise<void>;
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* Descriptor for controller
|
|
442
|
+
*/
|
|
443
|
+
export interface IControllerDescriptor {
|
|
444
|
+
/**
|
|
445
|
+
* Controller routes
|
|
446
|
+
*/
|
|
447
|
+
Routes: Map<string | symbol, IRoute>;
|
|
448
|
+
/**
|
|
449
|
+
* Controller - wise middlewares
|
|
450
|
+
*/
|
|
451
|
+
Middlewares: IMiddlewareDescriptor[];
|
|
452
|
+
/**
|
|
453
|
+
* Controller - wise policies
|
|
454
|
+
*/
|
|
455
|
+
Policies: IPolicyDescriptor[];
|
|
456
|
+
/**
|
|
457
|
+
* Base url path for controller ( added for all child url's)
|
|
458
|
+
*/
|
|
459
|
+
BasePath: string;
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* Base class for data transformers.
|
|
463
|
+
*
|
|
464
|
+
* Data formatter helps transforms data for desired format.
|
|
465
|
+
* Eg. we have API function that returns some data, but we want
|
|
466
|
+
* to easily transform data for some client
|
|
467
|
+
* eg. plain array to format that datatables.net can easily read
|
|
468
|
+
*/
|
|
469
|
+
export declare abstract class DataTransformer<T = any, U = any> {
|
|
470
|
+
/**
|
|
471
|
+
* Transforms data from one format to another
|
|
472
|
+
*
|
|
473
|
+
* @param data - input data
|
|
474
|
+
*/
|
|
475
|
+
abstract transform(data: T, request: express.Request): U;
|
|
476
|
+
abstract get Type(): string;
|
|
477
|
+
}
|
|
478
|
+
export type RouteCallback = (req: express.Request, res: express.Response, next: express.NextFunction) => (req: express.Request, res: express.Response) => void;
|
|
479
|
+
export interface IFileResponseOptions {
|
|
480
|
+
/**
|
|
481
|
+
* Path to file
|
|
482
|
+
*/
|
|
483
|
+
path: string;
|
|
484
|
+
/**
|
|
485
|
+
* File system provider, default is local
|
|
486
|
+
*/
|
|
487
|
+
provider?: string;
|
|
488
|
+
/**
|
|
489
|
+
* File name ( for browser )
|
|
490
|
+
*/
|
|
491
|
+
filename: string;
|
|
492
|
+
/**
|
|
493
|
+
* If not provided, it will be guessed
|
|
494
|
+
*/
|
|
495
|
+
mimeType?: string;
|
|
496
|
+
/**
|
|
497
|
+
* Should delete file after downloaded eg. generated temp file
|
|
498
|
+
*/
|
|
499
|
+
deleteAfterDownload?: boolean;
|
|
500
|
+
}
|
|
501
|
+
export interface ITemplateResponseOptions {
|
|
502
|
+
template: string;
|
|
503
|
+
provider?: string;
|
|
504
|
+
}
|
|
505
|
+
//# sourceMappingURL=interfaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../src/interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAM,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAEjC;;GAEG;AACH,oBAAY,iBAAiB;IAC3B;;OAEG;IACH,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AAC,CAAC;IAErC;;OAEG;IACH,WAAW,EAAE,qBAAqB,EAAE,CAAC;IAErC;;OAEG;IACH,QAAQ,EAAE,iBAAiB,EAAE,CAAC;IAE9B;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;GAOG;AACH,8BAAsB,eAAe,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG;IACpD;;;;OAIG;aACa,SAAS,CAAC,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,GAAG,CAAC;IAE/D,aAAoB,IAAI,IAAI,MAAM,CAAC;CACpC;AAED,MAAM,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,YAAY,KAAK,CAAC,GAAG,EAAE,OAAO,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,QAAQ,KAAK,IAAI,CAAC;AAE/J,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -20,7 +20,7 @@ export var HttpAcceptHeaders;
|
|
|
20
20
|
* Accept all accept headers shorcut
|
|
21
21
|
*/
|
|
22
22
|
HttpAcceptHeaders[HttpAcceptHeaders["ALL"] = 7] = "ALL";
|
|
23
|
-
})(HttpAcceptHeaders || (HttpAcceptHeaders = {}));
|
|
23
|
+
})(HttpAcceptHeaders = HttpAcceptHeaders || (HttpAcceptHeaders = {}));
|
|
24
24
|
export class ServerMiddleware extends AsyncService {
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
@@ -90,7 +90,7 @@ export var HTTP_STATUS_CODE;
|
|
|
90
90
|
* Method not implemented
|
|
91
91
|
*/
|
|
92
92
|
HTTP_STATUS_CODE[HTTP_STATUS_CODE["NOT_IMPLEMENTED"] = 501] = "NOT_IMPLEMENTED";
|
|
93
|
-
})(HTTP_STATUS_CODE || (HTTP_STATUS_CODE = {}));
|
|
93
|
+
})(HTTP_STATUS_CODE = HTTP_STATUS_CODE || (HTTP_STATUS_CODE = {}));
|
|
94
94
|
/**
|
|
95
95
|
* Avaible route types, match HTTP methods
|
|
96
96
|
*/
|
|
@@ -125,14 +125,14 @@ export var RouteType;
|
|
|
125
125
|
*/
|
|
126
126
|
RouteType["FILE"] = "file";
|
|
127
127
|
RouteType["UNKNOWN"] = "unknown";
|
|
128
|
-
})(RouteType || (RouteType = {}));
|
|
128
|
+
})(RouteType = RouteType || (RouteType = {}));
|
|
129
129
|
export var UuidVersion;
|
|
130
130
|
(function (UuidVersion) {
|
|
131
131
|
UuidVersion[UuidVersion["v1"] = 0] = "v1";
|
|
132
132
|
UuidVersion[UuidVersion["v3"] = 1] = "v3";
|
|
133
133
|
UuidVersion[UuidVersion["v4"] = 2] = "v4";
|
|
134
134
|
UuidVersion[UuidVersion["v5"] = 3] = "v5";
|
|
135
|
-
})(UuidVersion || (UuidVersion = {}));
|
|
135
|
+
})(UuidVersion = UuidVersion || (UuidVersion = {}));
|
|
136
136
|
/**
|
|
137
137
|
* Avaible route parameters type
|
|
138
138
|
*/
|
|
@@ -196,7 +196,7 @@ export var ParameterType;
|
|
|
196
196
|
* Other custom arguments
|
|
197
197
|
*/
|
|
198
198
|
ParameterType["Other"] = "Other";
|
|
199
|
-
})(ParameterType || (ParameterType = {}));
|
|
199
|
+
})(ParameterType = ParameterType || (ParameterType = {}));
|
|
200
200
|
/**
|
|
201
201
|
* Middlewares are classes that can change request object or perform specific task before & after route execution
|
|
202
202
|
* eg. route parameter logging / headers check etc.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/interfaces.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,YAAY,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAI5D;;GAEG;AACH,MAAM,CAAN,IAAY,iBAoBX;AApBD,WAAY,iBAAiB;IAC3B;;OAEG;IACH,yDAAQ,CAAA;IAER;;OAEG;IACH,yDAAQ,CAAA;IAER;;OAEG;IACH,uDAAO,CAAA;IAEP;;OAEG;IACH,uDAAe,CAAA;AACjB,CAAC,EApBW,iBAAiB,GAAjB,iBAAiB,KAAjB,iBAAiB,QAoB5B;AAsCD,MAAM,OAAgB,gBAAiB,SAAQ,YAAY;CAK1D;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,gBA6EX;AA7ED,WAAY,gBAAgB;IAC1B;;OAEG;IACH,qDAAQ,CAAA;IAER;;OAEG;IACH,+DAAa,CAAA;IAEb;;OAEG;IACH,iEAAc,CAAA;IAEd;;OAEG;IACH,qEAAgB,CAAA;IAEhB;;;;OAIG;IACH,+EAAqB,CAAA;IAErB;;OAEG;IACH,yEAAkB,CAAA;IAElB;;OAEG;IACH,uEAAiB,CAAA;IAEjB;;OAEG;IACH,yEAAkB,CAAA;IAElB;;OAEG;IACH,mEAAe,CAAA;IAEf;;OAEG;IACH,mEAAe,CAAA;IAEf;;OAEG;IACH,6EAAoB,CAAA;IAEpB;;OAEG;IACH,uEAAiB,CAAA;IAEjB;;OAEG;IACH,iEAAc,CAAA;IAEd;;OAEG;IACH,6EAAoB,CAAA;IAEpB;;OAEG;IACH,+EAAqB,CAAA;AACvB,CAAC,EA7EW,gBAAgB,GAAhB,gBAAgB,KAAhB,gBAAgB,QA6E3B;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,SAqCX;AArCD,WAAY,SAAS;IACnB;;OAEG;IAC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,EAAE,CAAC,OAAO,CAAK,mBAAmB,EAAE,CAAC,gCAAgC,CAAC,CAAC,CAAC;IACpF,CAAC;CAGF;AAED;;;;GAIG;AACH,MAAM,OAAgB,UAAU;CAgB/B;AA2BD;;;;;;;GAOG;AACH,MAAM,OAAgB,eAAe;CASpC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Not found": "Resource not found",
|
|
3
|
+
"Server error": "Critital server error",
|
|
4
|
+
"Forbidden" : "Access forbidden",
|
|
5
|
+
"Route not found": "Route not found",
|
|
6
|
+
"Unauthorized": "Access denied",
|
|
7
|
+
"No content" : "No content",
|
|
8
|
+
"Bad request" : "Bad request",
|
|
9
|
+
"You do not have access to this resource." : "You do not have access to this resource"
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Not found": "Nie znaleziono zasobu",
|
|
3
|
+
"Server error": "Błąd serwera",
|
|
4
|
+
"Forbidden" : "Zabroniony dostęp",
|
|
5
|
+
"Route not found": "Ścieżka nie odnaleziona",
|
|
6
|
+
"Unauthorized": "Brak uprawnień",
|
|
7
|
+
"No content" : "Brak zawartości",
|
|
8
|
+
"Bad request" : "Złe żądanie",
|
|
9
|
+
"You do not have access to this resource." : "Nie posiadasz uprawnień do tego zasobu."
|
|
10
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Response, NextFunction } from 'express';
|
|
2
|
+
import { ServerMiddleware, Request as sRequest } from '../interfaces.js';
|
|
3
|
+
import * as express from 'express';
|
|
4
|
+
export declare class RequestId extends ServerMiddleware {
|
|
5
|
+
constructor();
|
|
6
|
+
after(): (_req: sRequest, _res: express.Response, _next: express.NextFunction) => void;
|
|
7
|
+
before(): (req: sRequest, res: Response<any, Record<string, any>>, next: NextFunction) => void;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=RequestId.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RequestId.d.ts","sourceRoot":"","sources":["../../../src/middlewares/RequestId.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAInC,qBACa,SAAU,SAAQ,gBAAgB;;IAMtC,KAAK,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,CAAC,YAAY,KAAK,IAAI;IAItF,MAAM,IAAI,CAAC,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,YAAY,KAAK,IAAI;CAMtG"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RequestId.js","sourceRoot":"","sources":["../../../src/middlewares/RequestId.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,gBAAgB,EAAuB,MAAM,kBAAkB,CAAC;AAEzE,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGlC,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,gBAAgB;IAC7C;QACE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;IACjB,CAAC;IAEM,KAAK;QACV,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,MAAM;QACX,OAAO,CAAC,GAAa,EAAE,IAAsB,EAAE,IAA0B,EAAE,EAAE;YAC3E,GAAG,CAAC,OAAO,CAAC,SAAS,GAAG,MAAM,EAAE,CAAC;YACjC,IAAI,EAAE,CAAC;QACT,CAAC,CAAC;IACJ,CAAC;CACF,CAAA;AAhBY,SAAS;IADrB,UAAU,CAAC,gBAAgB,CAAC;;GAChB,SAAS,CAgBrB;SAhBY,SAAS"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Request, Response, NextFunction } from 'express';
|
|
2
|
+
import { ParamsDictionary } from 'express-serve-static-core';
|
|
3
|
+
import { ParsedQs } from 'qs';
|
|
4
|
+
import { ServerMiddleware } from '../interfaces.js';
|
|
5
|
+
import * as express from 'express';
|
|
6
|
+
export declare class ResponseTime extends ServerMiddleware {
|
|
7
|
+
constructor();
|
|
8
|
+
after(): (req: express.Request, _res: express.Response, _next: express.NextFunction) => void;
|
|
9
|
+
before(): (_req: Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: NextFunction) => void;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=ResponseTime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResponseTime.d.ts","sourceRoot":"","sources":["../../../src/middlewares/ResponseTime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAC9B,OAAO,EAAE,gBAAgB,EAAuB,MAAM,kBAAkB,CAAC;AACzE,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAGnC,qBACa,YAAa,SAAQ,gBAAgB;;IAMzC,KAAK,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,CAAC,YAAY,KAAK,IAAI;IAS5F,MAAM,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,gBAAgB,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,E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
|
|
|
1
|
+
/// <reference types="qs" />
|
|
2
|
+
import * as express from 'express';
|
|
3
|
+
import { Response } from '../interfaces.js';
|
|
4
|
+
/**
|
|
5
|
+
* Internall response function.
|
|
6
|
+
* Returns HTTP 400 BAD REQUEST ERROR
|
|
7
|
+
* @param err - error to send
|
|
8
|
+
*/
|
|
9
|
+
export declare class BadRequest extends Response {
|
|
10
|
+
constructor(data: any);
|
|
11
|
+
execute(_req: express.Request, _res: express.Response): Promise<(req: express.Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: express.Response<any, Record<string, any>>) => void>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=badRequest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"badRequest.d.ts","sourceRoot":"","sources":["../../../src/response-methods/badRequest.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAoB,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG9D;;;;GAIG;AAEH,qBAAa,UAAW,SAAQ,QAAQ;gBAC1B,IAAI,EAAE,GAAG;IAIR,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,QAAQ;CAInE"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"badRequest.js","sourceRoot":"","sources":["../../../src/response-methods/badRequest.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C;;;;GAIG;AAEH,MAAM,OAAO,UAAW,SAAQ,QAAQ;IACtC,YAAY,IAAS;QACnB,KAAK,CAAC,IAAI,CAAC,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,IAAqB,EAAE,IAAsB;QAChE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;QACtD,OAAO,MAAM,YAAY,CAAC,IAAI,CAAC,YAAY,EAAE,gBAAgB,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;IACnF,CAAC;CACF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="qs" />
|
|
2
|
+
import * as express from 'express';
|
|
3
|
+
import { Response } from '../interfaces.js';
|
|
4
|
+
/**
|
|
5
|
+
* Internall response function.
|
|
6
|
+
* Returns HTTP 409 Conflict
|
|
7
|
+
* @param err - error to send
|
|
8
|
+
*/
|
|
9
|
+
export declare class Conflict extends Response {
|
|
10
|
+
constructor(data: any);
|
|
11
|
+
execute(_req: express.Request, _res: express.Response): Promise<(req: express.Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: express.Response<any, Record<string, any>>) => void>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=conflict.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conflict.d.ts","sourceRoot":"","sources":["../../../src/response-methods/conflict.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAoB,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG9D;;;;GAIG;AAEH,qBAAa,QAAS,SAAQ,QAAQ;gBACxB,IAAI,EAAE,GAAG;IAIR,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,QAAQ;CAKnE"}
|