@modern-js/bff-core 1.22.1 → 1.22.2-beta.0
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/CHANGELOG.md +135 -17
- package/dist/js/modern/api.js +49 -34
- package/dist/js/modern/client/generate-client.js +52 -34
- package/dist/js/modern/client/index.js +1 -1
- package/dist/js/modern/client/result.js +10 -8
- package/dist/js/modern/errors/http.js +8 -14
- package/dist/js/modern/index.js +19 -3
- package/dist/js/modern/operators/http.js +139 -116
- package/dist/js/modern/router/constants.js +31 -13
- package/dist/js/modern/router/index.js +68 -131
- package/dist/js/modern/router/types.js +0 -1
- package/dist/js/modern/router/utils.js +36 -54
- package/dist/js/modern/types.js +45 -47
- package/dist/js/modern/utils/alias.js +35 -50
- package/dist/js/modern/utils/debug.js +5 -2
- package/dist/js/modern/utils/index.js +5 -2
- package/dist/js/modern/utils/meta.js +8 -4
- package/dist/js/modern/utils/storage.js +8 -14
- package/dist/js/modern/utils/validate.js +23 -29
- package/dist/js/node/api.js +78 -46
- package/dist/js/node/client/generate-client.js +85 -55
- package/dist/js/node/client/index.js +17 -18
- package/dist/js/node/client/result.js +32 -18
- package/dist/js/node/errors/http.js +28 -22
- package/dist/js/node/index.js +45 -122
- package/dist/js/node/operators/http.js +184 -169
- package/dist/js/node/router/constants.js +60 -28
- package/dist/js/node/router/index.js +112 -201
- package/dist/js/node/router/types.js +15 -5
- package/dist/js/node/router/utils.js +71 -78
- package/dist/js/node/types.js +71 -57
- package/dist/js/node/utils/alias.js +65 -73
- package/dist/js/node/utils/debug.js +27 -10
- package/dist/js/node/utils/index.js +28 -68
- package/dist/js/node/utils/meta.js +30 -12
- package/dist/js/node/utils/storage.js +36 -24
- package/dist/js/node/utils/validate.js +50 -44
- package/package.json +12 -40
|
@@ -1,68 +1,74 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
|
+
mod
|
|
22
|
+
));
|
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
|
+
var validate_exports = {};
|
|
25
|
+
__export(validate_exports, {
|
|
26
|
+
ERR_INVALID_ARG_TYPE: () => ERR_INVALID_ARG_TYPE,
|
|
27
|
+
getTypeErrorMessage: () => getTypeErrorMessage,
|
|
28
|
+
validateFunction: () => validateFunction
|
|
5
29
|
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
// fork from https://github.com/nodejs/node/blob/master/lib/internal/errors.js
|
|
13
|
-
const getTypeErrorMessage = actual => {
|
|
14
|
-
let msg = '';
|
|
15
|
-
|
|
30
|
+
module.exports = __toCommonJS(validate_exports);
|
|
31
|
+
var import_util = __toESM(require("util"));
|
|
32
|
+
const getTypeErrorMessage = (actual) => {
|
|
33
|
+
var _a;
|
|
34
|
+
let msg = "";
|
|
16
35
|
if (actual == null) {
|
|
17
36
|
msg += `. Received ${actual}`;
|
|
18
|
-
} else if (typeof actual ===
|
|
37
|
+
} else if (typeof actual === "function" && actual.name) {
|
|
19
38
|
msg += `. Received function ${actual.name}`;
|
|
20
|
-
} else if (typeof actual ===
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
if ((_actual$constructor = actual.constructor) !== null && _actual$constructor !== void 0 && _actual$constructor.name) {
|
|
39
|
+
} else if (typeof actual === "object") {
|
|
40
|
+
if ((_a = actual.constructor) == null ? void 0 : _a.name) {
|
|
24
41
|
msg += `. Received an instance of ${actual.constructor.name}`;
|
|
25
42
|
} else {
|
|
26
|
-
const inspected =
|
|
27
|
-
depth: -1
|
|
28
|
-
});
|
|
29
|
-
|
|
43
|
+
const inspected = import_util.default.inspect(actual, { depth: -1 });
|
|
30
44
|
msg += `. Received ${inspected}`;
|
|
31
45
|
}
|
|
32
46
|
} else {
|
|
33
|
-
let inspected =
|
|
34
|
-
colors: false
|
|
35
|
-
});
|
|
36
|
-
|
|
47
|
+
let inspected = import_util.default.inspect(actual, { colors: false });
|
|
37
48
|
if (inspected.length > 25) {
|
|
38
49
|
inspected = `${inspected.slice(0, 25)}...`;
|
|
39
50
|
}
|
|
40
|
-
|
|
41
51
|
msg += `. Received type ${typeof actual} (${inspected})`;
|
|
42
52
|
}
|
|
43
|
-
|
|
44
53
|
return msg;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
exports.getTypeErrorMessage = getTypeErrorMessage;
|
|
49
|
-
|
|
54
|
+
};
|
|
50
55
|
class ERR_INVALID_ARG_TYPE extends Error {
|
|
51
56
|
constructor(funcName, expectedType, actual) {
|
|
52
|
-
const message = `[ERR_INVALID_ARG_TYPE]: The '${funcName}' argument must be of type ${expectedType}${getTypeErrorMessage(
|
|
57
|
+
const message = `[ERR_INVALID_ARG_TYPE]: The '${funcName}' argument must be of type ${expectedType}${getTypeErrorMessage(
|
|
58
|
+
actual
|
|
59
|
+
)}`;
|
|
53
60
|
super(message);
|
|
54
61
|
}
|
|
55
|
-
|
|
56
62
|
}
|
|
57
|
-
|
|
58
|
-
exports.ERR_INVALID_ARG_TYPE = ERR_INVALID_ARG_TYPE;
|
|
59
|
-
|
|
60
63
|
const validateFunction = (maybeFunc, name) => {
|
|
61
|
-
if (typeof maybeFunc !==
|
|
62
|
-
throw new ERR_INVALID_ARG_TYPE(name,
|
|
64
|
+
if (typeof maybeFunc !== "function") {
|
|
65
|
+
throw new ERR_INVALID_ARG_TYPE(name, "function", maybeFunc);
|
|
63
66
|
}
|
|
64
|
-
|
|
65
67
|
return true;
|
|
66
68
|
};
|
|
67
|
-
|
|
68
|
-
exports
|
|
69
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
70
|
+
0 && (module.exports = {
|
|
71
|
+
ERR_INVALID_ARG_TYPE,
|
|
72
|
+
getTypeErrorMessage,
|
|
73
|
+
validateFunction
|
|
74
|
+
});
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "1.22.
|
|
14
|
+
"version": "1.22.2-beta.0",
|
|
15
15
|
"jsnext:source": "./src/index.ts",
|
|
16
16
|
"types": "./dist/types/index.d.ts",
|
|
17
17
|
"main": "./dist/js/node/index.js",
|
|
@@ -26,23 +26,23 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@babel/runtime": "^7.18.0",
|
|
29
|
-
"
|
|
29
|
+
"@modern-js/bff-runtime": "2.0.0-beta.4",
|
|
30
|
+
"@modern-js/utils": "2.0.0-beta.4",
|
|
31
|
+
"esbuild": "0.15.7",
|
|
30
32
|
"esbuild-register": "^3.3.3",
|
|
31
33
|
"koa-compose": "^4.1.0",
|
|
32
|
-
"reflect-metadata": "^0.1.13"
|
|
33
|
-
"@modern-js/bff-runtime": "1.22.1",
|
|
34
|
-
"@modern-js/utils": "1.22.1"
|
|
34
|
+
"reflect-metadata": "^0.1.13"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
+
"@scripts/build": "2.0.0-beta.4",
|
|
38
|
+
"@scripts/jest-config": "2.0.0-beta.4",
|
|
37
39
|
"@types/jest": "^27",
|
|
38
40
|
"@types/koa-compose": "^3.2.5",
|
|
39
41
|
"@types/node": "^14",
|
|
40
42
|
"jest": "^27",
|
|
41
|
-
"type-fest": "
|
|
43
|
+
"type-fest": "2.15.0",
|
|
42
44
|
"typescript": "^4",
|
|
43
|
-
"zod": "^3.17.3"
|
|
44
|
-
"@scripts/build": "1.22.1",
|
|
45
|
-
"@scripts/jest-config": "1.22.1"
|
|
45
|
+
"zod": "^3.17.3"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"zod": "^3.17.3"
|
|
@@ -52,41 +52,13 @@
|
|
|
52
52
|
"optional": true
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
|
-
"modernConfig": {
|
|
56
|
-
"output": {
|
|
57
|
-
"packageMode": "node-js"
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
55
|
"publishConfig": {
|
|
61
56
|
"registry": "https://registry.npmjs.org/",
|
|
62
57
|
"access": "public"
|
|
63
58
|
},
|
|
64
|
-
"wireit": {
|
|
65
|
-
"build": {
|
|
66
|
-
"command": "modern build",
|
|
67
|
-
"files": [
|
|
68
|
-
"src/**/*",
|
|
69
|
-
"tsconfig.json",
|
|
70
|
-
"package.json"
|
|
71
|
-
],
|
|
72
|
-
"output": [
|
|
73
|
-
"dist/**/*"
|
|
74
|
-
]
|
|
75
|
-
},
|
|
76
|
-
"test": {
|
|
77
|
-
"command": "jest --passWithNoTests",
|
|
78
|
-
"files": [
|
|
79
|
-
"src/**/*",
|
|
80
|
-
"tsconfig.json",
|
|
81
|
-
"package.json",
|
|
82
|
-
"tests/**/*"
|
|
83
|
-
],
|
|
84
|
-
"output": []
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
59
|
"scripts": {
|
|
88
|
-
"new": "modern new",
|
|
89
|
-
"build": "
|
|
90
|
-
"test": "
|
|
60
|
+
"new": "modern-lib new",
|
|
61
|
+
"build": "modern-lib build",
|
|
62
|
+
"test": "jest --passWithNoTests"
|
|
91
63
|
}
|
|
92
64
|
}
|