koatty_core
Advanced tools
Comparing version 1.2.4 to 1.2.5
/// <reference types="node" /> | ||
import EventEmitter from "events"; | ||
import { Metadata, MetadataValue, status } from "@grpc/grpc-js"; | ||
import { Metadata, status } from "@grpc/grpc-js"; | ||
import { sendUnaryData, ServerDuplexStream, ServerReadableStream, ServerUnaryCall, ServerWritableStream } from "@grpc/grpc-js/build/src/server-call"; | ||
@@ -28,7 +28,2 @@ import { GrpcStatusCode } from "koatty_trace"; | ||
/** | ||
* Creates an instance of KoattyGrpcContext. | ||
* @memberof KoattyGrpcContext | ||
*/ | ||
constructor(); | ||
/** | ||
* throw Exception | ||
@@ -50,3 +45,3 @@ * | ||
*/ | ||
getMetaData(key: string): MetadataValue[]; | ||
getMetaData(key: string): import("@grpc/grpc-js").MetadataValue | import("@grpc/grpc-js").MetadataValue[]; | ||
/** | ||
@@ -60,3 +55,3 @@ * setMetaData | ||
*/ | ||
setMetaData(key: string, value: MetadataValue): any; | ||
setMetaData(key: string, value: string | Buffer): any; | ||
} | ||
@@ -63,0 +58,0 @@ /** |
@@ -10,3 +10,3 @@ "use strict"; | ||
* @Date: 2021-11-16 14:46:22 | ||
* @LastEditTime: 2021-11-16 21:17:23 | ||
* @LastEditTime: 2021-11-17 01:04:39 | ||
*/ | ||
@@ -24,15 +24,2 @@ const events_1 = tslib_1.__importDefault(require("events")); | ||
class KoattyGrpcContext extends events_1.default { | ||
/** | ||
* Creates an instance of KoattyGrpcContext. | ||
* @memberof KoattyGrpcContext | ||
*/ | ||
constructor() { | ||
super(); | ||
Reflect.defineProperty(this, '_caches', { | ||
value: {}, | ||
writable: true, | ||
configurable: false, | ||
enumerable: false, | ||
}); | ||
} | ||
throw(message, code, status) { | ||
@@ -59,3 +46,7 @@ if (typeof message !== "string") { | ||
getMetaData(key) { | ||
return this.metadata.get(key); | ||
const value = this.metadata.get(key); | ||
if (value.length === 1) { | ||
return value[0]; | ||
} | ||
return value; | ||
} | ||
@@ -62,0 +53,0 @@ /** |
{ | ||
"name": "koatty_core", | ||
"version": "1.2.4", | ||
"version": "1.2.5", | ||
"description": "Koatty routing component, adapt to http1/2, websocket, gRPC.", | ||
@@ -5,0 +5,0 @@ "scripts": { |
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
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
2096689
880