UNPKG

@cerbos/embedded

Version:

Client library for interacting with embedded Cerbos policy decision points generated by Cerbos Hub from server-side Node.js and browser-based applications

74 lines 2.87 kB
"use strict"; // Code generated by protoc-gen-ts_proto. DO NOT EDIT. // source: cerbos/schema/v1/schema.proto Object.defineProperty(exports, "__esModule", { value: true }); exports.ValidationError = exports.ValidationError_Source = exports.protobufPackage = void 0; exports.validationError_SourceFromJSON = validationError_SourceFromJSON; exports.validationError_SourceToJSON = validationError_SourceToJSON; /* eslint-disable */ 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 validationError_SourceFromJSON(object) { switch (object) { case 0: case "SOURCE_UNSPECIFIED": return ValidationError_Source.SOURCE_UNSPECIFIED; case 1: case "SOURCE_PRINCIPAL": return ValidationError_Source.SOURCE_PRINCIPAL; case 2: case "SOURCE_RESOURCE": return ValidationError_Source.SOURCE_RESOURCE; default: throw new globalThis.Error("Unrecognized enum value " + object + " for enum ValidationError_Source"); } } function validationError_SourceToJSON(object) { switch (object) { case ValidationError_Source.SOURCE_UNSPECIFIED: return "SOURCE_UNSPECIFIED"; case ValidationError_Source.SOURCE_PRINCIPAL: return "SOURCE_PRINCIPAL"; case ValidationError_Source.SOURCE_RESOURCE: return "SOURCE_RESOURCE"; default: throw new globalThis.Error("Unrecognized enum value " + object + " for enum ValidationError_Source"); } } exports.ValidationError = { fromJSON(object) { return { path: isSet(object.path) ? globalThis.String(object.path) : "", message: isSet(object.message) ? globalThis.String(object.message) : "", source: isSet(object.source) ? validationError_SourceFromJSON(object.source) : 0, }; }, toJSON(message) { const obj = {}; if (message.path !== "") { obj.path = message.path; } if (message.message !== "") { obj.message = message.message; } if (message.source !== 0) { obj.source = validationError_SourceToJSON(message.source); } return obj; }, }; function isSet(value) { return value !== null && value !== undefined; } //# sourceMappingURL=schema.js.map