@modern-js/bff-runtime 2.4.0 → 2.6.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 +13 -0
- package/dist/{js/node → cjs}/match.js +3 -23
- package/dist/{js/modern → esm-node}/match.js +3 -23
- package/package.json +8 -9
- /package/dist/{js/node → cjs}/compatible.js +0 -0
- /package/dist/{js/node → cjs}/index.js +0 -0
- /package/dist/{js/node → cjs}/request.js +0 -0
- /package/dist/{js/node → cjs}/response.js +0 -0
- /package/dist/{js/node → cjs}/types.js +0 -0
- /package/dist/{js/treeshaking → esm}/compatible.js +0 -0
- /package/dist/{js/treeshaking → esm}/index.js +0 -0
- /package/dist/{js/treeshaking → esm}/match.js +0 -0
- /package/dist/{js/treeshaking → esm}/request.js +0 -0
- /package/dist/{js/treeshaking → esm}/response.js +0 -0
- /package/dist/{js/treeshaking → esm}/types.js +0 -0
- /package/dist/{js/modern → esm-node}/compatible.js +0 -0
- /package/dist/{js/modern → esm-node}/index.js +0 -0
- /package/dist/{js/modern → esm-node}/request.js +0 -0
- /package/dist/{js/modern → esm-node}/response.js +0 -0
- /package/dist/{js/modern → esm-node}/types.js +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @modern-js/bff-runtime
|
|
2
2
|
|
|
3
|
+
## 2.6.0
|
|
4
|
+
|
|
5
|
+
## 2.5.0
|
|
6
|
+
|
|
7
|
+
### Patch Changes
|
|
8
|
+
|
|
9
|
+
- 89ca6cc: refactor: merge build-config into scripts/build
|
|
10
|
+
|
|
11
|
+
refactor: 把 build-config 合并进 scripts/build
|
|
12
|
+
|
|
13
|
+
- 30614fa: chore: modify package.json entry fields and build config
|
|
14
|
+
chore: 更改 package.json entry 字段以及构建配置
|
|
15
|
+
|
|
3
16
|
## 2.4.0
|
|
4
17
|
|
|
5
18
|
## 2.3.0
|
|
@@ -15,26 +15,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
15
|
return to;
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var __async = (__this, __arguments, generator) => {
|
|
19
|
-
return new Promise((resolve, reject) => {
|
|
20
|
-
var fulfilled = (value) => {
|
|
21
|
-
try {
|
|
22
|
-
step(generator.next(value));
|
|
23
|
-
} catch (e) {
|
|
24
|
-
reject(e);
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
var rejected = (value) => {
|
|
28
|
-
try {
|
|
29
|
-
step(generator.throw(value));
|
|
30
|
-
} catch (e) {
|
|
31
|
-
reject(e);
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
35
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
36
|
-
});
|
|
37
|
-
};
|
|
38
18
|
var match_exports = {};
|
|
39
19
|
__export(match_exports, {
|
|
40
20
|
baseMatch: () => baseMatch,
|
|
@@ -62,18 +42,18 @@ const baseMatch = (schema, handler) => {
|
|
|
62
42
|
const validateApiOutput = (0, import_validator.createSchemaValidator)(
|
|
63
43
|
(0, import_farrow_schema.toSchemaCtor)(schema.response)
|
|
64
44
|
);
|
|
65
|
-
const handle = (input) =>
|
|
45
|
+
const handle = async (input) => {
|
|
66
46
|
const inputResult = validateApiInput(input);
|
|
67
47
|
if (inputResult.isErr) {
|
|
68
48
|
return (0, import_response.InputValidationError)(getErrorMessage(inputResult.value));
|
|
69
49
|
}
|
|
70
|
-
const output =
|
|
50
|
+
const output = await handler(input);
|
|
71
51
|
const outputResult = validateApiOutput(output);
|
|
72
52
|
if (outputResult.isErr) {
|
|
73
53
|
return (0, import_response.OutputValidationError)(getErrorMessage(outputResult.value));
|
|
74
54
|
}
|
|
75
55
|
return (0, import_response.HandleSuccess)(output);
|
|
76
|
-
}
|
|
56
|
+
};
|
|
77
57
|
return Object.assign(handle, {
|
|
78
58
|
schema,
|
|
79
59
|
[HANDLER_WITH_SCHEMA]: true
|
|
@@ -1,23 +1,3 @@
|
|
|
1
|
-
var __async = (__this, __arguments, generator) => {
|
|
2
|
-
return new Promise((resolve, reject) => {
|
|
3
|
-
var fulfilled = (value) => {
|
|
4
|
-
try {
|
|
5
|
-
step(generator.next(value));
|
|
6
|
-
} catch (e) {
|
|
7
|
-
reject(e);
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
var rejected = (value) => {
|
|
11
|
-
try {
|
|
12
|
-
step(generator.throw(value));
|
|
13
|
-
} catch (e) {
|
|
14
|
-
reject(e);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
1
|
import {
|
|
22
2
|
toSchemaCtor,
|
|
23
3
|
Struct,
|
|
@@ -47,18 +27,18 @@ const baseMatch = (schema, handler) => {
|
|
|
47
27
|
const validateApiOutput = createSchemaValidator(
|
|
48
28
|
toSchemaCtor(schema.response)
|
|
49
29
|
);
|
|
50
|
-
const handle = (input) =>
|
|
30
|
+
const handle = async (input) => {
|
|
51
31
|
const inputResult = validateApiInput(input);
|
|
52
32
|
if (inputResult.isErr) {
|
|
53
33
|
return InputValidationError(getErrorMessage(inputResult.value));
|
|
54
34
|
}
|
|
55
|
-
const output =
|
|
35
|
+
const output = await handler(input);
|
|
56
36
|
const outputResult = validateApiOutput(output);
|
|
57
37
|
if (outputResult.isErr) {
|
|
58
38
|
return OutputValidationError(getErrorMessage(outputResult.value));
|
|
59
39
|
}
|
|
60
40
|
return HandleSuccess(output);
|
|
61
|
-
}
|
|
41
|
+
};
|
|
62
42
|
return Object.assign(handle, {
|
|
63
43
|
schema,
|
|
64
44
|
[HANDLER_WITH_SCHEMA]: true
|
package/package.json
CHANGED
|
@@ -11,20 +11,19 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "2.
|
|
14
|
+
"version": "2.6.0",
|
|
15
15
|
"jsnext:source": "./src/index.ts",
|
|
16
16
|
"types": "./dist/types/index.d.ts",
|
|
17
|
-
"main": "./dist/
|
|
18
|
-
"module": "./dist/
|
|
19
|
-
"jsnext:modern": "./dist/js/modern/index.js",
|
|
17
|
+
"main": "./dist/cjs/index.js",
|
|
18
|
+
"module": "./dist/esm/index.js",
|
|
20
19
|
"exports": {
|
|
21
20
|
".": {
|
|
22
21
|
"node": {
|
|
23
22
|
"jsnext:source": "./src/index.ts",
|
|
24
|
-
"import": "./dist/
|
|
25
|
-
"require": "./dist/
|
|
23
|
+
"import": "./dist/esm-node/index.js",
|
|
24
|
+
"require": "./dist/cjs/index.js"
|
|
26
25
|
},
|
|
27
|
-
"default": "./dist/
|
|
26
|
+
"default": "./dist/esm/index.js"
|
|
28
27
|
}
|
|
29
28
|
},
|
|
30
29
|
"dependencies": {
|
|
@@ -39,8 +38,8 @@
|
|
|
39
38
|
"jest": "^27",
|
|
40
39
|
"ts-jest": "^27.0.5",
|
|
41
40
|
"typescript": "^4",
|
|
42
|
-
"@scripts/
|
|
43
|
-
"@scripts/
|
|
41
|
+
"@scripts/build": "2.6.0",
|
|
42
|
+
"@scripts/jest-config": "2.6.0"
|
|
44
43
|
},
|
|
45
44
|
"publishConfig": {
|
|
46
45
|
"registry": "https://registry.npmjs.org/",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|