@aeriajs/server 0.0.250 → 0.0.252

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/handler.js CHANGED
@@ -4,9 +4,6 @@ exports.regularVerb = exports.customVerbs = exports.safeHandle = void 0;
4
4
  const core_1 = require("@aeriajs/core");
5
5
  const entrypoint_1 = require("@aeriajs/entrypoint");
6
6
  const types_1 = require("@aeriajs/types");
7
- const common_1 = require("@aeriajs/common");
8
- const appendPagination_js_1 = require("./appendPagination.js");
9
- const postPipe = (0, common_1.pipe)([appendPagination_js_1.appendPagination]);
10
7
  const getACErrorHttpCode = (code) => {
11
8
  switch (code) {
12
9
  case types_1.ACError.FunctionNotFound: return types_1.HTTPStatus.NotFound;
@@ -62,7 +59,7 @@ const customVerbs = () => async (parentContext) => {
62
59
  });
63
60
  }
64
61
  const result = await fn(context.request.payload, context);
65
- return postPipe(result, context);
62
+ return result;
66
63
  };
67
64
  exports.customVerbs = customVerbs;
68
65
  const regularVerb = (functionName) => async (parentContext) => {
@@ -99,6 +96,6 @@ const regularVerb = (functionName) => async (parentContext) => {
99
96
  });
100
97
  }
101
98
  const result = await fn(requestCopy.payload, context);
102
- return postPipe(result, context);
99
+ return result;
103
100
  };
104
101
  exports.regularVerb = regularVerb;
package/dist/handler.mjs CHANGED
@@ -2,9 +2,6 @@
2
2
  import { createContext, getFunction } from "@aeriajs/core";
3
3
  import { getCollection } from "@aeriajs/entrypoint";
4
4
  import { ACError, HTTPStatus, Result } from "@aeriajs/types";
5
- import { pipe } from "@aeriajs/common";
6
- import { appendPagination } from "./appendPagination.mjs";
7
- const postPipe = pipe([appendPagination]);
8
5
  const getACErrorHttpCode = (code) => {
9
6
  switch (code) {
10
7
  case ACError.FunctionNotFound:
@@ -64,7 +61,7 @@ export const customVerbs = () => async (parentContext) => {
64
61
  });
65
62
  }
66
63
  const result = await fn(context.request.payload, context);
67
- return postPipe(result, context);
64
+ return result;
68
65
  };
69
66
  export const regularVerb = (functionName) => async (parentContext) => {
70
67
  const { fragments: [collectionName, id] } = parentContext.request;
@@ -100,5 +97,5 @@ export const regularVerb = (functionName) => async (parentContext) => {
100
97
  });
101
98
  }
102
99
  const result = await fn(requestCopy.payload, context);
103
- return postPipe(result, context);
100
+ return result;
104
101
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aeriajs/server",
3
- "version": "0.0.250",
3
+ "version": "0.0.252",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -33,14 +33,14 @@
33
33
  "mongodb": "^6.5.0"
34
34
  },
35
35
  "peerDependencies": {
36
- "@aeriajs/core": "^0.0.248",
37
- "@aeriajs/builtins": "^0.0.248",
38
- "@aeriajs/common": "^0.0.137",
39
- "@aeriajs/entrypoint": "^0.0.141",
40
- "@aeriajs/http": "^0.0.166",
41
- "@aeriajs/node-http": "^0.0.166",
42
- "@aeriajs/server": "^0.0.250",
43
- "@aeriajs/types": "^0.0.119",
36
+ "@aeriajs/core": "^0.0.250",
37
+ "@aeriajs/builtins": "^0.0.250",
38
+ "@aeriajs/common": "^0.0.139",
39
+ "@aeriajs/entrypoint": "^0.0.143",
40
+ "@aeriajs/http": "^0.0.168",
41
+ "@aeriajs/node-http": "^0.0.168",
42
+ "@aeriajs/server": "^0.0.252",
43
+ "@aeriajs/types": "^0.0.121",
44
44
  "mongodb": "^6.5.0"
45
45
  },
46
46
  "scripts": {
@@ -1,2 +0,0 @@
1
- import { type Context } from '@aeriajs/types';
2
- export declare const appendPagination: (value: unknown, context: Context) => Promise<unknown>;
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.appendPagination = void 0;
4
- const types_1 = require("@aeriajs/types");
5
- const common_1 = require("@aeriajs/common");
6
- const core_1 = require("@aeriajs/core");
7
- const appendPagination = async (value, context) => {
8
- if (context.calledFunction === 'getAll' && value) {
9
- if (!(0, common_1.isResult)(value)) {
10
- return value;
11
- }
12
- const { result } = value;
13
- if (Array.isArray(result)) {
14
- return types_1.Result.result({
15
- data: result,
16
- pagination: await (0, core_1.makePagination)(context.request.payload, result, context),
17
- });
18
- }
19
- }
20
- return value;
21
- };
22
- exports.appendPagination = appendPagination;
@@ -1,23 +0,0 @@
1
- "use strict";
2
- import { Result } from "@aeriajs/types";
3
- import { isResult } from "@aeriajs/common";
4
- import { makePagination } from "@aeriajs/core";
5
- export const appendPagination = async (value, context) => {
6
- if (context.calledFunction === "getAll" && value) {
7
- if (!isResult(value)) {
8
- return value;
9
- }
10
- const { result } = value;
11
- if (Array.isArray(result)) {
12
- return Result.result({
13
- data: result,
14
- pagination: await makePagination(
15
- context.request.payload,
16
- result,
17
- context
18
- )
19
- });
20
- }
21
- }
22
- return value;
23
- };