@aeriajs/http 0.0.113 → 0.0.115

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/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  export * from './cors.js';
2
- export * from './next.js';
3
2
  export * from './options.js';
4
3
  export * from './routing.js';
5
4
  export * from './payload.js';
package/dist/index.js CHANGED
@@ -15,7 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./cors.js"), exports);
18
- __exportStar(require("./next.js"), exports);
19
18
  __exportStar(require("./options.js"), exports);
20
19
  __exportStar(require("./routing.js"), exports);
21
20
  __exportStar(require("./payload.js"), exports);
package/dist/index.mjs CHANGED
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
  export * from "./cors.mjs";
3
- export * from "./next.mjs";
4
3
  export * from "./options.mjs";
5
4
  export * from "./routing.mjs";
6
5
  export * from "./payload.mjs";
package/dist/routing.d.ts CHANGED
@@ -24,18 +24,18 @@ export type ProxiedRouter<TRouter> = TRouter & Record<typeof REQUEST_METHODS[num
24
24
  export declare const matches: <TRequest extends GenericRequest>(req: TRequest, method: RequestMethod | RequestMethod[] | null, exp: string | RegExp, options?: RouterOptions, config?: ApiConfig) => {
25
25
  fragments: string[];
26
26
  } | undefined;
27
- export declare const registerRoute: (context: RouteContext, method: RequestMethod | RequestMethod[], exp: RouteUri, cb: (context: RouteContext) => unknown, contract?: ContractWithRoles, options?: RouterOptions) => Promise<{} | null | undefined>;
27
+ export declare const registerRoute: <TRouteContext extends RouteContext>(context: TRouteContext, method: RequestMethod | RequestMethod[], exp: RouteUri, cb: (context: TRouteContext) => unknown, contract?: ContractWithRoles, options?: RouterOptions) => Promise<{} | null | undefined>;
28
28
  export declare const wrapRouteExecution: (response: GenericResponse, cb: () => unknown | Promise<unknown>) => Promise<{} | undefined>;
29
29
  export declare const createRouter: (options?: Partial<RouterOptions>) => ProxiedRouter<{
30
30
  route: <const TContractWithRoles extends ContractWithRoles, TCallback extends (TContractWithRoles extends {
31
31
  response: infer Response;
32
32
  } ? InferProperties<Response> : unknown) extends infer Response ? (context: TypedContext<TContractWithRoles>) => Response : never>(method: RequestMethod | RequestMethod[], exp: RouteUri, cb: TCallback, contract?: TContractWithRoles) => void;
33
- routes: ((_: unknown, context: RouteContext, groupOptions?: RouteGroupOptions) => ReturnType<typeof registerRoute>)[];
33
+ routes: ((_: unknown, context: RouteContext, groupOptions?: RouteGroupOptions) => unknown)[];
34
34
  routesMeta: RoutesMeta;
35
35
  group: <TRouter extends {
36
36
  install: (context: RouteContext, options?: RouterOptions) => unknown;
37
37
  routesMeta: RoutesMeta;
38
38
  }>(exp: RouteUri, router: TRouter, middleware?: (context: RouteContext) => unknown) => void;
39
- install: (_context: RouteContext, _options?: RouterOptions) => Promise<{} | {} | null | undefined>;
39
+ install: (_context: RouteContext, _options?: RouterOptions) => Promise<unknown>;
40
40
  }>;
41
41
  export {};
package/dist/routing.js CHANGED
@@ -7,7 +7,6 @@ const common_1 = require("@aeriajs/common");
7
7
  const validation_1 = require("@aeriajs/validation");
8
8
  const entrypoint_1 = require("@aeriajs/entrypoint");
9
9
  const payload_js_1 = require("./payload.js");
10
- const next_js_1 = require("./next.js");
11
10
  const checkUnprocessable = (what, schema, context, validateOptions = {}) => {
12
11
  let result;
13
12
  if (Array.isArray(schema)) {
@@ -199,7 +198,7 @@ const createRouter = (options = {}) => {
199
198
  };
200
199
  const routerPipe = (0, common_1.pipe)(routes, {
201
200
  returnFirst: (value) => {
202
- if (value !== undefined && !(0, next_js_1.isNext)(value)) {
201
+ if (value !== undefined) {
203
202
  return value;
204
203
  }
205
204
  },
@@ -215,7 +214,7 @@ const createRouter = (options = {}) => {
215
214
  };
216
215
  router.install = async (context, options) => {
217
216
  const result = await routerPipe(undefined, context, options);
218
- if (exhaust && (result === undefined || (0, next_js_1.isNext)(result))) {
217
+ if (exhaust && result === undefined) {
219
218
  return context.error(types_1.HTTPStatus.NotFound, {
220
219
  code: types_1.ACError.ResourceNotFound,
221
220
  message: 'Not found',
package/dist/routing.mjs CHANGED
@@ -5,7 +5,6 @@ import { pipe, isGranted, deepMerge, endpointError } from "@aeriajs/common";
5
5
  import { validate } from "@aeriajs/validation";
6
6
  import { getConfig } from "@aeriajs/entrypoint";
7
7
  import { safeJson } from "./payload.mjs";
8
- import { isNext } from "./next.mjs";
9
8
  const checkUnprocessable = (what, schema, context, validateOptions = {}) => {
10
9
  let result;
11
10
  if (Array.isArray(schema)) {
@@ -194,7 +193,7 @@ export const createRouter = (options = {}) => {
194
193
  };
195
194
  const routerPipe = pipe(routes, {
196
195
  returnFirst: (value) => {
197
- if (value !== void 0 && !isNext(value)) {
196
+ if (value !== void 0) {
198
197
  return value;
199
198
  }
200
199
  }
@@ -210,7 +209,7 @@ export const createRouter = (options = {}) => {
210
209
  };
211
210
  router.install = async (context, options2) => {
212
211
  const result = await routerPipe(void 0, context, options2);
213
- if (exhaust && (result === void 0 || isNext(result))) {
212
+ if (exhaust && result === void 0) {
214
213
  return context.error(HTTPStatus.NotFound, {
215
214
  code: ACError.ResourceNotFound,
216
215
  message: "Not found"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aeriajs/http",
3
- "version": "0.0.113",
3
+ "version": "0.0.115",
4
4
  "description": "## Installation",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -28,10 +28,10 @@
28
28
  "@aeriajs/validation": "link:../validation"
29
29
  },
30
30
  "peerDependencies": {
31
- "@aeriajs/common": "^0.0.100",
32
- "@aeriajs/entrypoint": "^0.0.102",
33
- "@aeriajs/types": "^0.0.86",
34
- "@aeriajs/validation": "^0.0.103"
31
+ "@aeriajs/common": "^0.0.102",
32
+ "@aeriajs/entrypoint": "^0.0.104",
33
+ "@aeriajs/types": "^0.0.87",
34
+ "@aeriajs/validation": "^0.0.105"
35
35
  },
36
36
  "scripts": {
37
37
  "test": "vitest run",
package/dist/next.d.ts DELETED
@@ -1,7 +0,0 @@
1
- export declare const NEXT_SYMBOL: unique symbol;
2
- type NextObject = {
3
- [NEXT_SYMBOL]: null;
4
- };
5
- export declare const next: () => NextObject;
6
- export declare const isNext: (object: unknown) => object is NextObject;
7
- export {};
package/dist/next.js DELETED
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isNext = exports.next = exports.NEXT_SYMBOL = void 0;
4
- exports.NEXT_SYMBOL = Symbol('NEXT_SYMBOL');
5
- const next = () => {
6
- return {
7
- [exports.NEXT_SYMBOL]: null,
8
- };
9
- };
10
- exports.next = next;
11
- const isNext = (object) => {
12
- if (!object) {
13
- return false;
14
- }
15
- const sym = Object.getOwnPropertyDescriptor(object, exports.NEXT_SYMBOL);
16
- return !!sym;
17
- };
18
- exports.isNext = isNext;
package/dist/next.mjs DELETED
@@ -1,14 +0,0 @@
1
- "use strict";
2
- export const NEXT_SYMBOL = Symbol("NEXT_SYMBOL");
3
- export const next = () => {
4
- return {
5
- [NEXT_SYMBOL]: null
6
- };
7
- };
8
- export const isNext = (object) => {
9
- if (!object) {
10
- return false;
11
- }
12
- const sym = Object.getOwnPropertyDescriptor(object, NEXT_SYMBOL);
13
- return !!sym;
14
- };