@modern-js/bff-core 2.60.6 → 2.62.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.
@@ -38,7 +38,6 @@ __export(http_exports, {
38
38
  createHttpOperator: () => createHttpOperator
39
39
  });
40
40
  module.exports = __toCommonJS(http_exports);
41
- var import_zod = require("zod");
42
41
  var import_http = require("../errors/http");
43
42
  var import_types = require("../types");
44
43
  const validateInput = async (schema, input) => {
@@ -173,7 +172,6 @@ const Redirect = (url) => {
173
172
  };
174
173
  };
175
174
  const Upload = (urlPath, schema) => {
176
- const finalSchema = schema || import_zod.z.any();
177
175
  return {
178
176
  name: "Upload",
179
177
  metadata({ setMetadata }) {
@@ -183,13 +181,16 @@ const Upload = (urlPath, schema) => {
183
181
  method: import_types.HttpMethod.Post,
184
182
  action: "upload"
185
183
  });
186
- setMetadata(import_types.HttpMetadata.Files, finalSchema);
184
+ setMetadata(import_types.HttpMetadata.Files, schema);
187
185
  },
188
186
  async validate(helper, next) {
187
+ if (!schema) {
188
+ return next();
189
+ }
189
190
  const { inputs: { formData: files } } = helper;
190
191
  helper.inputs = {
191
192
  ...helper.inputs,
192
- files: await validateInput(finalSchema, files)
193
+ files: await validateInput(schema, files)
193
194
  };
194
195
  return next();
195
196
  }
@@ -1,4 +1,3 @@
1
- import { z } from "zod";
2
1
  import { ValidationError } from "../errors/http";
3
2
  import { HttpMetadata, HttpMethod, OperatorType, ResponseMetaType, TriggerType } from "../types";
4
3
  const validateInput = async (schema, input) => {
@@ -133,7 +132,6 @@ const Redirect = (url) => {
133
132
  };
134
133
  };
135
134
  const Upload = (urlPath, schema) => {
136
- const finalSchema = schema || z.any();
137
135
  return {
138
136
  name: "Upload",
139
137
  metadata({ setMetadata }) {
@@ -143,13 +141,16 @@ const Upload = (urlPath, schema) => {
143
141
  method: HttpMethod.Post,
144
142
  action: "upload"
145
143
  });
146
- setMetadata(HttpMetadata.Files, finalSchema);
144
+ setMetadata(HttpMetadata.Files, schema);
147
145
  },
148
146
  async validate(helper, next) {
147
+ if (!schema) {
148
+ return next();
149
+ }
149
150
  const { inputs: { formData: files } } = helper;
150
151
  helper.inputs = {
151
152
  ...helper.inputs,
152
- files: await validateInput(finalSchema, files)
153
+ files: await validateInput(schema, files)
153
154
  };
154
155
  return next();
155
156
  }
@@ -1,4 +1,4 @@
1
- import { z } from 'zod';
1
+ import type { z } from 'zod';
2
2
  import { HttpMethod, type Operator, ResponseMetaType } from '../types';
3
3
  export interface ResponseMeta {
4
4
  type: ResponseMetaType;
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.60.6",
18
+ "version": "2.62.0",
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.60.6"
35
+ "@modern-js/utils": "2.62.0"
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
- "@scripts/build": "2.60.6",
47
- "@modern-js/types": "2.60.6",
48
- "@scripts/jest-config": "2.60.6"
46
+ "@modern-js/types": "2.62.0",
47
+ "@scripts/build": "2.62.0",
48
+ "@scripts/jest-config": "2.62.0"
49
49
  },
50
50
  "peerDependencies": {
51
51
  "ts-node": "^10.9.1",