@cerbos/grpc
Version:
Client library for interacting with the Cerbos policy decision point service over gRPC from server-side Node.js applications
111 lines • 3.97 kB
JavaScript
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// source: cerbos/schema/v1/schema.proto
Object.defineProperty(exports, "__esModule", { value: true });
exports.Schema = exports.ValidationError = exports.ValidationError_Source = exports.protobufPackage = void 0;
/* eslint-disable */
const wire_1 = require("@bufbuild/protobuf/wire");
exports.protobufPackage = "cerbos.schema.v1";
var ValidationError_Source;
(function (ValidationError_Source) {
ValidationError_Source[ValidationError_Source["SOURCE_UNSPECIFIED"] = 0] = "SOURCE_UNSPECIFIED";
ValidationError_Source[ValidationError_Source["SOURCE_PRINCIPAL"] = 1] = "SOURCE_PRINCIPAL";
ValidationError_Source[ValidationError_Source["SOURCE_RESOURCE"] = 2] = "SOURCE_RESOURCE";
})(ValidationError_Source || (exports.ValidationError_Source = ValidationError_Source = {}));
function createBaseValidationError() {
return { path: "", message: "", source: 0 };
}
exports.ValidationError = {
encode(message, writer = new wire_1.BinaryWriter()) {
if (message.path !== "") {
writer.uint32(10).string(message.path);
}
if (message.message !== "") {
writer.uint32(18).string(message.message);
}
if (message.source !== 0) {
writer.uint32(24).int32(message.source);
}
return writer;
},
decode(input, length) {
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseValidationError();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.path = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.message = reader.string();
continue;
}
case 3: {
if (tag !== 24) {
break;
}
message.source = reader.int32();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
};
function createBaseSchema() {
return { id: "", definition: new Uint8Array(0) };
}
exports.Schema = {
encode(message, writer = new wire_1.BinaryWriter()) {
if (message.id !== "") {
writer.uint32(10).string(message.id);
}
if (message.definition.length !== 0) {
writer.uint32(18).bytes(message.definition);
}
return writer;
},
decode(input, length) {
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseSchema();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.id = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.definition = reader.bytes();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
};
//# sourceMappingURL=schema.js.map
;