@atlantjs/backend 11.0.7 → 11.0.8

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.
@@ -2,8 +2,7 @@ import { FailureAbstract, HttpStatusCodes } from "@atlantjs/arch";
2
2
  import { Response } from "express";
3
3
  import { ForceResponse } from "./force-response.abstract";
4
4
  export declare abstract class ForceAbstract {
5
- protected res: Response;
6
- abstract apply(...args: unknown[]): Promise<Response>;
7
- protected onSuccess(response: ForceResponse): Promise<Response>;
8
- protected onFailure(failure: FailureAbstract, httpStatusCode?: HttpStatusCodes): Response;
5
+ abstract apply(res: Response, ...args: unknown[]): Promise<Response>;
6
+ protected onSuccess(res: Response, response: ForceResponse): Promise<Response>;
7
+ protected onFailure(res: Response, failure: FailureAbstract, httpStatusCode?: HttpStatusCodes): Response;
9
8
  }
@@ -1,32 +1,18 @@
1
1
  "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.ForceAbstract = void 0;
13
4
  const arch_1 = require("@atlantjs/arch");
14
5
  const class_validator_1 = require("class-validator");
15
- const routing_controllers_1 = require("routing-controllers");
16
6
  class ForceAbstract {
17
- async onSuccess(response) {
7
+ async onSuccess(res, response) {
18
8
  if (arch_1._.isNotUndefined(response)) {
19
9
  await (0, class_validator_1.validateOrReject)(response);
20
10
  }
21
11
  const data = response.data;
22
- return this.res.status(response.statusCode).send(data);
12
+ return res.status(response.statusCode).send(data);
23
13
  }
24
- onFailure(failure, httpStatusCode = arch_1.HttpStatusCodes.BAD_REQUEST) {
25
- return this.res.status(httpStatusCode).send(failure.toPolygon());
14
+ onFailure(res, failure, httpStatusCode = arch_1.HttpStatusCodes.BAD_REQUEST) {
15
+ return res.status(httpStatusCode).send(failure.toPolygon());
26
16
  }
27
17
  }
28
18
  exports.ForceAbstract = ForceAbstract;
29
- __decorate([
30
- (0, routing_controllers_1.Res)(),
31
- __metadata("design:type", Object)
32
- ], ForceAbstract.prototype, "res", void 0);
@@ -1,40 +1,7 @@
1
1
  "use strict";
2
- // import { HttpContentTypePoint } from "./http-content-type.point";
3
- // import { HttpMethodPoint } from "./http-method.point";
4
- // import "reflect-metadata";
5
- // import { getMetadataArgsStorage } from "routing-controllers";
6
2
  Object.defineProperty(exports, "__esModule", { value: true });
7
3
  exports.Delete = exports.Patch = exports.Put = exports.Post = exports.Get = void 0;
8
4
  exports.UnifiedController = UnifiedController;
9
- // function HttpMethod(httpMethod: HttpMethodPoint) {
10
- // return (
11
- // route: string,
12
- // contentType = HttpContentTypePoint.JSON,
13
- // ): ClassDecorator => {
14
- // return (target) => {
15
- // getMetadataArgsStorage().actions.push({
16
- // type: httpMethod,
17
- // target: target.constructor,
18
- // method: "apply",
19
- // route,
20
- // options: {},
21
- // });
22
- // if (contentType === HttpContentTypePoint.JSON) {
23
- // getMetadataArgsStorage().controllers.push({
24
- // type: "json",
25
- // target: target,
26
- // route,
27
- // options: {},
28
- // });
29
- // }
30
- // };
31
- // };
32
- // }
33
- // export const Get = HttpMethod(HttpMethodPoint.GET);
34
- // export const Post = HttpMethod(HttpMethodPoint.POST);
35
- // export const Put = HttpMethod(HttpMethodPoint.PUT);
36
- // export const Patch = HttpMethod(HttpMethodPoint.PATCH);
37
- // export const Delete = HttpMethod(HttpMethodPoint.DELETE);
38
5
  const routing_controllers_1 = require("routing-controllers");
39
6
  function UnifiedController(options) {
40
7
  return (target) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlantjs/backend",
3
- "version": "11.0.7",
3
+ "version": "11.0.8",
4
4
  "main": "index.js",
5
5
  "license": "UNLICENSED",
6
6
  "publishConfig": {