@primerouting/zitadel-node
Version:
Library for API access to ZITADEL. Provides compiled gRPC service clients and helpers for applications and service accounts. Support http2 self-hosted instances
91 lines (90 loc) • 3.19 kB
JavaScript
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v1.181.1
// protoc unknown
// source: google/protobuf/duration.proto
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Duration = exports.protobufPackage = void 0;
/* eslint-disable */
const long_1 = __importDefault(require("long"));
const minimal_1 = __importDefault(require("protobufjs/minimal"));
exports.protobufPackage = "google.protobuf";
function createBaseDuration() {
return { seconds: long_1.default.ZERO, nanos: 0 };
}
exports.Duration = {
encode(message, writer = minimal_1.default.Writer.create()) {
if (!message.seconds.equals(long_1.default.ZERO)) {
writer.uint32(8).int64(message.seconds);
}
if (message.nanos !== 0) {
writer.uint32(16).int32(message.nanos);
}
return writer;
},
decode(input, length) {
const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseDuration();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 8) {
break;
}
message.seconds = reader.int64();
continue;
case 2:
if (tag !== 16) {
break;
}
message.nanos = reader.int32();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
seconds: isSet(object.seconds) ? long_1.default.fromValue(object.seconds) : long_1.default.ZERO,
nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0,
};
},
toJSON(message) {
const obj = {};
if (!message.seconds.equals(long_1.default.ZERO)) {
obj.seconds = (message.seconds || long_1.default.ZERO).toString();
}
if (message.nanos !== 0) {
obj.nanos = Math.round(message.nanos);
}
return obj;
},
create(base) {
return exports.Duration.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseDuration();
message.seconds = (object.seconds !== undefined && object.seconds !== null)
? long_1.default.fromValue(object.seconds)
: long_1.default.ZERO;
message.nanos = object.nanos ?? 0;
return message;
},
};
if (minimal_1.default.util.Long !== long_1.default) {
minimal_1.default.util.Long = long_1.default;
minimal_1.default.configure();
}
function isSet(value) {
return value !== null && value !== undefined;
}
;