@modern-js/bff-core 2.58.2 → 2.58.3
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/cjs/compatible.js +16 -0
- package/dist/cjs/operators/http.js +1 -1
- package/dist/cjs/utils/alias.js +2 -2
- package/dist/esm/api.js +1 -1
- package/dist/esm/client/generateClient.js +1 -1
- package/dist/esm/compatible.js +0 -0
- package/dist/esm/operators/http.js +1 -1
- package/dist/esm/router/index.js +3 -3
- package/dist/esm/router/utils.js +1 -1
- package/dist/esm/utils/alias.js +2 -2
- package/dist/types/api.d.ts +1 -1
- package/dist/types/compatible.d.ts +9 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/operators/http.d.ts +1 -1
- package/dist/types/router/index.d.ts +1 -1
- package/package.json +5 -5
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var compatible_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(compatible_exports);
|
|
@@ -47,8 +47,8 @@ __export(http_exports, {
|
|
|
47
47
|
createHttpOperator: () => createHttpOperator
|
|
48
48
|
});
|
|
49
49
|
module.exports = __toCommonJS(http_exports);
|
|
50
|
-
var import_types = require("../types");
|
|
51
50
|
var import_http = require("../errors/http");
|
|
51
|
+
var import_types = require("../types");
|
|
52
52
|
const validateInput = async (schema, input) => {
|
|
53
53
|
try {
|
|
54
54
|
return await schema.parseAsync(input);
|
package/dist/cjs/utils/alias.js
CHANGED
|
@@ -33,10 +33,10 @@ __export(alias_exports, {
|
|
|
33
33
|
registerPaths: () => registerPaths
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(alias_exports);
|
|
36
|
-
var path = __toESM(require("path"));
|
|
37
|
-
var os = __toESM(require("os"));
|
|
38
36
|
var import_fs = __toESM(require("fs"));
|
|
39
37
|
var import_module = __toESM(require("module"));
|
|
38
|
+
var os = __toESM(require("os"));
|
|
39
|
+
var path = __toESM(require("path"));
|
|
40
40
|
const getRelativeRuntimePath = (appDirectory, serverRuntimePath) => {
|
|
41
41
|
let relativeRuntimePath = "";
|
|
42
42
|
if (os.platform() === "win32") {
|
package/dist/esm/api.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "reflect-metadata";
|
|
2
2
|
import compose from "koa-compose";
|
|
3
|
-
import {
|
|
3
|
+
import { HANDLER_WITH_META, validateFunction } from "./utils";
|
|
4
4
|
function Api(...args) {
|
|
5
5
|
const handler = args.pop();
|
|
6
6
|
validateFunction(handler, "Apihandler");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as path from "path";
|
|
2
2
|
import { ApiRouter } from "../router";
|
|
3
|
-
import {
|
|
3
|
+
import { Err, Ok } from "./result";
|
|
4
4
|
const DEFAULT_CLIENT_REQUEST_CREATOR = "@modern-js/create-request";
|
|
5
5
|
const generateClient = async ({ appDir, resourcePath, apiDir, lambdaDir, prefix, port, target, requestCreator, fetcher, requireResolve = require.resolve, httpMethodDecider }) => {
|
|
6
6
|
if (!requestCreator) {
|
|
File without changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { HttpMetadata, OperatorType, HttpMethod, TriggerType, ResponseMetaType } from "../types";
|
|
2
1
|
import { ValidationError } from "../errors/http";
|
|
2
|
+
import { HttpMetadata, HttpMethod, OperatorType, ResponseMetaType, TriggerType } from "../types";
|
|
3
3
|
const validateInput = async (schema, input) => {
|
|
4
4
|
try {
|
|
5
5
|
return await schema.parseAsync(input);
|
package/dist/esm/router/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
import { fs, logger } from "@modern-js/utils";
|
|
3
3
|
import "reflect-metadata";
|
|
4
|
-
import { HttpMethod,
|
|
5
|
-
import {
|
|
6
|
-
import { APIMode,
|
|
4
|
+
import { HttpMethod, OperatorType, TriggerType, httpMethods } from "../types";
|
|
5
|
+
import { INPUT_PARAMS_DECIDER, debug } from "../utils";
|
|
6
|
+
import { APIMode, API_FILE_RULES, FRAMEWORK_MODE_APP_DIR, FRAMEWORK_MODE_LAMBDA_DIR } from "./constants";
|
|
7
7
|
import { getFiles, getPathFromFilename, requireHandlerModule, sortRoutes } from "./utils";
|
|
8
8
|
export * from "./types";
|
|
9
9
|
export * from "./constants";
|
package/dist/esm/router/utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
-
import {
|
|
2
|
+
import { compatibleRequire, globby } from "@modern-js/utils";
|
|
3
3
|
import { INDEX_SUFFIX } from "./constants";
|
|
4
4
|
const getFiles = (lambdaDir, rules) => globby.sync(rules, {
|
|
5
5
|
cwd: lambdaDir,
|
package/dist/esm/utils/alias.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as path from "path";
|
|
2
|
-
import * as os from "os";
|
|
3
1
|
import fs from "fs";
|
|
4
2
|
import Module from "module";
|
|
3
|
+
import * as os from "os";
|
|
4
|
+
import * as path from "path";
|
|
5
5
|
const getRelativeRuntimePath = (appDirectory, serverRuntimePath) => {
|
|
6
6
|
let relativeRuntimePath = "";
|
|
7
7
|
if (os.platform() === "win32") {
|
package/dist/types/api.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
|
-
import type { ApiRunner, ArrayToObject, ExtractInputType, ExtractOuputType,
|
|
2
|
+
import type { ApiRunner, ArrayToObject, ExtractInputType, ExtractOuputType, MaybeAsync, Operator } from './types';
|
|
3
3
|
export declare function Api<Operators extends Operator<any, any>[], Res extends MaybeAsync<any>>(...args: [
|
|
4
4
|
...operators: Operators,
|
|
5
5
|
handler: (arg: ArrayToObject<ExtractOuputType<Operators>>) => Res
|
package/dist/types/index.d.ts
CHANGED
|
@@ -5,3 +5,4 @@ export * from './types';
|
|
|
5
5
|
export * from './client';
|
|
6
6
|
export * from './operators/http';
|
|
7
7
|
export { getRelativeRuntimePath, HANDLER_WITH_META, isWithMetaHandler, INPUT_PARAMS_DECIDER, isInputParamsDeciderHandler, createStorage, registerPaths, } from './utils';
|
|
8
|
+
export type * from './compatible';
|
|
@@ -2,7 +2,7 @@ import 'reflect-metadata';
|
|
|
2
2
|
import type { HttpMethodDecider } from '@modern-js/types';
|
|
3
3
|
import { HttpMethod } from '../types';
|
|
4
4
|
import { APIMode } from './constants';
|
|
5
|
-
import type {
|
|
5
|
+
import type { APIHandlerInfo, ApiHandler } from './types';
|
|
6
6
|
export * from './types';
|
|
7
7
|
export * from './constants';
|
|
8
8
|
export declare class ApiRouter {
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "2.58.
|
|
18
|
+
"version": "2.58.3",
|
|
19
19
|
"jsnext:source": "./src/index.ts",
|
|
20
20
|
"types": "./dist/types/index.d.ts",
|
|
21
21
|
"main": "./dist/cjs/index.js",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"koa-compose": "^4.1.0",
|
|
33
33
|
"reflect-metadata": "^0.1.13",
|
|
34
34
|
"type-fest": "2.15.0",
|
|
35
|
-
"@modern-js/utils": "2.58.
|
|
35
|
+
"@modern-js/utils": "2.58.3"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/jest": "^29",
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
"tsconfig-paths": "^4.1.2",
|
|
44
44
|
"typescript": "^5",
|
|
45
45
|
"zod": "^3.22.3",
|
|
46
|
-
"@
|
|
47
|
-
"@
|
|
48
|
-
"@scripts/jest-config": "2.58.
|
|
46
|
+
"@scripts/build": "2.58.3",
|
|
47
|
+
"@modern-js/types": "2.58.3",
|
|
48
|
+
"@scripts/jest-config": "2.58.3"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"ts-node": "^10.9.1",
|