@aeriajs/http 0.0.114 → 0.0.116
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 +0 -1
- package/dist/index.js +0 -1
- package/dist/index.mjs +0 -1
- package/dist/routing.d.ts +3 -3
- package/dist/routing.js +2 -3
- package/dist/routing.mjs +2 -3
- package/package.json +5 -5
- package/dist/next.d.ts +0 -7
- package/dist/next.js +0 -18
- package/dist/next.mjs +0 -14
package/dist/index.d.ts
CHANGED
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
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:
|
|
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) =>
|
|
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<
|
|
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
|
|
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 &&
|
|
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
|
|
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 &&
|
|
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.
|
|
3
|
+
"version": "0.0.116",
|
|
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.
|
|
32
|
-
"@aeriajs/entrypoint": "^0.0.
|
|
33
|
-
"@aeriajs/types": "^0.0.
|
|
34
|
-
"@aeriajs/validation": "^0.0.
|
|
31
|
+
"@aeriajs/common": "^0.0.103",
|
|
32
|
+
"@aeriajs/entrypoint": "^0.0.105",
|
|
33
|
+
"@aeriajs/types": "^0.0.87",
|
|
34
|
+
"@aeriajs/validation": "^0.0.106"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"test": "vitest run",
|
package/dist/next.d.ts
DELETED
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
|
-
};
|