@grpc/proto-loader
Advanced tools
Comparing version 0.7.12 to 0.7.13
@@ -536,3 +536,3 @@ #!/usr/bin/env node | ||
const method = serviceType.methods[methodName]; | ||
for (const name of [methodName, camelCase(methodName)]) { | ||
for (const name of new Set([methodName, camelCase(methodName)])) { | ||
if (CLIENT_RESERVED_METHOD_NAMES.has(name)) { | ||
@@ -539,0 +539,0 @@ continue; |
@@ -86,2 +86,26 @@ /** | ||
} | ||
export declare enum IdempotencyLevel { | ||
IDEMPOTENCY_UNKNOWN = "IDEMPOTENCY_UNKNOWN", | ||
NO_SIDE_EFFECTS = "NO_SIDE_EFFECTS", | ||
IDEMPOTENT = "IDEMPOTENT" | ||
} | ||
export interface NamePart { | ||
name_part: string; | ||
is_extension: boolean; | ||
} | ||
export interface UninterpretedOption { | ||
name?: NamePart[]; | ||
identifier_value?: string; | ||
positive_int_value?: number; | ||
negative_int_value?: number; | ||
double_value?: number; | ||
string_value?: string; | ||
aggregate_value?: string; | ||
} | ||
export interface MethodOptions { | ||
deprecated: boolean; | ||
idempotency_level: IdempotencyLevel; | ||
uninterpreted_option: UninterpretedOption[]; | ||
[k: string]: unknown; | ||
} | ||
export interface MethodDefinition<RequestType, ResponseType, OutputRequestType = RequestType, OutputResponseType = ResponseType> { | ||
@@ -98,2 +122,3 @@ path: string; | ||
responseType: MessageTypeDefinition; | ||
options: MethodOptions; | ||
} | ||
@@ -100,0 +125,0 @@ export interface ServiceDefinition { |
@@ -20,3 +20,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.loadFileDescriptorSetFromObject = exports.loadFileDescriptorSetFromBuffer = exports.fromJSON = exports.loadSync = exports.load = exports.isAnyExtension = exports.Long = void 0; | ||
exports.loadFileDescriptorSetFromObject = exports.loadFileDescriptorSetFromBuffer = exports.fromJSON = exports.loadSync = exports.load = exports.IdempotencyLevel = exports.isAnyExtension = exports.Long = void 0; | ||
const camelCase = require("lodash.camelcase"); | ||
@@ -32,2 +32,8 @@ const Protobuf = require("protobufjs"); | ||
exports.isAnyExtension = isAnyExtension; | ||
var IdempotencyLevel; | ||
(function (IdempotencyLevel) { | ||
IdempotencyLevel["IDEMPOTENCY_UNKNOWN"] = "IDEMPOTENCY_UNKNOWN"; | ||
IdempotencyLevel["NO_SIDE_EFFECTS"] = "NO_SIDE_EFFECTS"; | ||
IdempotencyLevel["IDEMPOTENT"] = "IDEMPOTENT"; | ||
})(IdempotencyLevel = exports.IdempotencyLevel || (exports.IdempotencyLevel = {})); | ||
const descriptorOptions = { | ||
@@ -87,2 +93,20 @@ longs: String, | ||
} | ||
function mapMethodOptions(options) { | ||
return (options || []).reduce((obj, item) => { | ||
for (const [key, value] of Object.entries(item)) { | ||
switch (key) { | ||
case 'uninterpreted_option': | ||
obj.uninterpreted_option.push(item.uninterpreted_option); | ||
break; | ||
default: | ||
obj[key] = value; | ||
} | ||
} | ||
return obj; | ||
}, { | ||
deprecated: false, | ||
idempotency_level: IdempotencyLevel.IDEMPOTENCY_UNKNOWN, | ||
uninterpreted_option: [], | ||
}); | ||
} | ||
function createMethodDefinition(method, serviceName, options, fileDescriptors) { | ||
@@ -105,2 +129,3 @@ /* This is only ever called after the corresponding root.resolveAll(), so we | ||
responseType: createMessageDefinition(responseType, fileDescriptors), | ||
options: mapMethodOptions(method.parsedOptions), | ||
}; | ||
@@ -107,0 +132,0 @@ } |
{ | ||
"name": "@grpc/proto-loader", | ||
"version": "0.7.12", | ||
"version": "0.7.13", | ||
"author": "Google Inc.", | ||
@@ -50,3 +50,3 @@ "contributors": [ | ||
"long": "^5.0.0", | ||
"protobufjs": "^7.2.4", | ||
"protobufjs": "^7.2.5", | ||
"yargs": "^17.7.2" | ||
@@ -61,4 +61,6 @@ }, | ||
"clang-format": "^1.2.2", | ||
"google-proto-files": "^3.0.2", | ||
"gts": "^3.1.0", | ||
"rimraf": "^3.0.2", | ||
"ts-node": "^10.9.2", | ||
"typescript": "~4.7.4" | ||
@@ -65,0 +67,0 @@ }, |
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
120003
1426
11
Updatedprotobufjs@^7.2.5