Comparing version 2.0.5 to 2.0.6-dev.0
/*! | ||
* TSBuffer v2.0.5 | ||
* TSBuffer v2.0.6-dev.0 | ||
* ----------------------------------------- | ||
@@ -13,2 +13,9 @@ * MIT LICENSE | ||
export declare class Base64Util { | ||
static bufferToBase64(buf: Uint8Array): string; | ||
static base64ToBuffer(base64: string): Uint8Array; | ||
static base64Encode(str: string): string; | ||
static base64Decode(str: string): string; | ||
} | ||
/** @public */ | ||
@@ -34,2 +41,15 @@ export declare interface DecodeOptions { | ||
/** @public */ | ||
declare type EncodeJsonOutput = { | ||
isSucc: true; | ||
/** Encoded JSON Object */ | ||
json: any; | ||
errMsg?: undefined; | ||
} | { | ||
isSucc: false; | ||
/** Error message */ | ||
errMsg: string; | ||
json?: undefined; | ||
}; | ||
/** @public */ | ||
export declare interface EncodeOptions { | ||
@@ -71,2 +91,16 @@ /** Skip validate value *before* encode */ | ||
decode<T = unknown>(buf: Uint8Array, schemaOrId: string | TSBufferSchema, options?: DecodeOptions): DecodeOutput<T>; | ||
/** | ||
* 编码为 JSON Object,根据协议将 JSON 不支持的格式(如 ArrayBuffer、Date、ObjectId)转换成 JSON 可传输的格式 | ||
* @param value | ||
* @param schemaOrId | ||
* @param options | ||
*/ | ||
encodeJSON(value: any, schemaOrId: string | TSBufferSchema, options?: EncodeOptions): EncodeJsonOutput; | ||
/** | ||
* 从 JSON Object 解码,根据协议将 ArrayBuffer、Date、ObjectId 等类型从 JSON 中还原 | ||
* @param json - JSON Object (是 JSON 对象,而非 JSON 字符串) | ||
* @param schemaOrId | ||
* @param options | ||
*/ | ||
decodeJSON<T = unknown>(json: any, schemaOrId: string | TSBufferSchema, options?: DecodeOptions): DecodeOutput<T>; | ||
validate: TSBufferValidator<Proto>['validate']; | ||
@@ -73,0 +107,0 @@ prune: TSBufferValidator<Proto>['prune']; |
{ | ||
"name": "tsbuffer", | ||
"version": "2.0.5", | ||
"version": "2.0.6-dev.0", | ||
"description": "", | ||
@@ -16,8 +16,8 @@ "main": "index.cjs", | ||
"k8w-extend-native": "^1.4.6", | ||
"tsbuffer-validator": "~2.0.5", | ||
"tsbuffer-validator": "^2.0.7-dev.1", | ||
"tslib": "^2.3.1" | ||
}, | ||
"devDependencies": { | ||
"@microsoft/api-documenter": "^7.13.63", | ||
"@microsoft/api-extractor": "^7.18.16", | ||
"@microsoft/api-documenter": "^7.13.65", | ||
"@microsoft/api-extractor": "^7.18.17", | ||
"@types/mocha": "^8.2.3", | ||
@@ -27,5 +27,5 @@ "@types/node": "^15.14.9", | ||
"nyc": "^15.1.0", | ||
"rollup": "^2.58.0", | ||
"rollup": "^2.59.0", | ||
"rollup-plugin-typescript2": "^0.30.0", | ||
"ts-node": "^10.3.0", | ||
"ts-node": "^10.4.0", | ||
"tsbuffer-proto-generator": "~1.4.9", | ||
@@ -32,0 +32,0 @@ "typescript": "^4.4.4" |
Sorry, the diff of this file is not supported yet
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
167253
4016
1
+ Addedtsbuffer-validator@2.1.2(transitive)
- Removedtsbuffer-validator@2.0.8(transitive)