@aomex/web
Advanced tools
Comparing version 3.3.0 to 3.4.0
@@ -6,2 +6,13 @@ # Change Log | ||
# [3.4.0](https://github.com/aomex/aomex/compare/v3.3.0...v3.4.0) (2024-10-04) | ||
### Features | ||
* **web:** request暴露headers和rawHeaders属性 ([3f15488](https://github.com/aomex/aomex/commit/3f154882429860c1a6100194c9d42af40f077728)) | ||
# [3.3.0](https://github.com/aomex/aomex/compare/v3.2.4...v3.3.0) (2024-09-26) | ||
@@ -8,0 +19,0 @@ |
@@ -5,3 +5,3 @@ import * as net from 'net'; | ||
import stream, { Stream } from 'node:stream'; | ||
import { Next, Middleware, MixinMiddleware, OpenAPI, Validator, TransformedValidator, magistrate, ValidatorToken, ComposeFn } from '@aomex/core'; | ||
import { Next, Middleware, MixinMiddleware, OpenAPI, Validator, TransformedValidator, ValidateResult, ValidatorToken, ComposeFn } from '@aomex/core'; | ||
import { Accepts } from 'accepts'; | ||
@@ -31,2 +31,4 @@ import { HttpError } from 'http-errors'; | ||
method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD'; | ||
headers: IncomingMessage['headers']; | ||
rawHeaders: IncomingMessage['rawHeaders']; | ||
params: Record<string, unknown>; | ||
@@ -274,3 +276,3 @@ private _accept?; | ||
protected isEmpty(value: any): boolean; | ||
protected validateValue(file: FileValidator.FormidableFile, _key: string, label: string): magistrate.Result<FileValidator.FormidableFile>; | ||
protected validateValue(file: FileValidator.FormidableFile, _key: string, label: string): ValidateResult.Any<FileValidator.FormidableFile>; | ||
protected copy: () => FileValidator<T>; | ||
@@ -277,0 +279,0 @@ protected toDocument(): OpenAPI.SchemaObject; |
@@ -611,3 +611,3 @@ // src/http/app.ts | ||
Validator, | ||
magistrate, | ||
ValidateResult, | ||
Rule | ||
@@ -646,16 +646,16 @@ } from "@aomex/core"; | ||
const { maxSize, mimeTypes: mimeTypes3 } = this.config; | ||
if (Array.isArray(file)) { | ||
file = file[0]; | ||
} | ||
if (Array.isArray(file)) file = file[0]; | ||
if (!(file instanceof PersistentFile)) { | ||
return magistrate.fail(i18n.t("validator.file.must_be_file", { label })); | ||
return ValidateResult.deny(i18n.t("validator.file.must_be_file", { label })); | ||
} | ||
if (maxSize !== void 0 && file.size > maxSize) { | ||
return magistrate.fail(i18n.t("validator.file.too_large", { label })); | ||
return ValidateResult.deny(i18n.t("validator.file.too_large", { label })); | ||
} | ||
const hasMimeTypeLimitation = mimeTypes3 && mimeTypes3.length; | ||
if (hasMimeTypeLimitation && (!file.mimetype || !typeIs3.is(file.mimetype, ...mimeTypes3))) { | ||
return magistrate.fail(i18n.t("validator.file.unsupported_mimetype", { label })); | ||
return ValidateResult.deny( | ||
i18n.t("validator.file.unsupported_mimetype", { label }) | ||
); | ||
} | ||
return magistrate.ok(file); | ||
return ValidateResult.accept(file); | ||
} | ||
@@ -676,3 +676,3 @@ toDocument() { | ||
rule, | ||
ValidatorError, | ||
ValidateDeniedError, | ||
middleware as middleware3 | ||
@@ -687,3 +687,3 @@ } from "@aomex/core"; | ||
} catch (e) { | ||
ctx.throw(e instanceof ValidatorError ? 400 : 500, e); | ||
ctx.throw(e instanceof ValidateDeniedError ? 400 : 500, e); | ||
} | ||
@@ -709,3 +709,3 @@ }, | ||
// src/middleware/query.ts | ||
import { middleware as middleware4, validate as validate2, Validator as Validator3, ValidatorError as ValidatorError2 } from "@aomex/core"; | ||
import { middleware as middleware4, validate as validate2, Validator as Validator3, ValidateDeniedError as ValidateDeniedError2 } from "@aomex/core"; | ||
var query = (fields) => { | ||
@@ -718,3 +718,3 @@ return middleware4.web({ | ||
} catch (e) { | ||
ctx.throw(e instanceof ValidatorError2 ? 400 : 500, e); | ||
ctx.throw(e instanceof ValidateDeniedError2 ? 400 : 500, e); | ||
} | ||
@@ -738,3 +738,3 @@ }, | ||
// src/middleware/params.ts | ||
import { middleware as middleware5, validate as validate3, Validator as Validator4, ValidatorError as ValidatorError3 } from "@aomex/core"; | ||
import { middleware as middleware5, validate as validate3, Validator as Validator4, ValidateDeniedError as ValidateDeniedError3 } from "@aomex/core"; | ||
var params = (fields) => { | ||
@@ -747,3 +747,3 @@ return middleware5.web({ | ||
} catch (e) { | ||
ctx.throw(e instanceof ValidatorError3 ? 400 : 500, e); | ||
ctx.throw(e instanceof ValidateDeniedError3 ? 400 : 500, e); | ||
} | ||
@@ -750,0 +750,0 @@ }, |
{ | ||
"name": "@aomex/web", | ||
"version": "3.3.0", | ||
"version": "3.4.0", | ||
"description": "aomex web层应用", | ||
@@ -43,3 +43,3 @@ "type": "module", | ||
"content-disposition": "^0.5.4", | ||
"cookie": "^0.6.0", | ||
"cookie": "^0.7.1", | ||
"destroy": "^1.2.0", | ||
@@ -55,4 +55,4 @@ "formidable": "^3.5.1", | ||
"vary": "^1.1.2", | ||
"@aomex/internal-file-import": "^3.3.0", | ||
"@aomex/internal-tools": "^3.3.0" | ||
"@aomex/internal-file-import": "^3.4.0", | ||
"@aomex/internal-tools": "^3.4.0" | ||
}, | ||
@@ -68,5 +68,5 @@ "devDependencies": { | ||
"@types/vary": "^1.1.3", | ||
"@aomex/core": "^3.3.0" | ||
"@aomex/core": "^3.4.0" | ||
}, | ||
"scripts": {} | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
132293
1571
+ Addedcookie@0.7.2(transitive)
- Removedcookie@0.6.0(transitive)
Updated@aomex/internal-tools@^3.4.0
Updatedcookie@^0.7.1