@zitadel/node
Version:
Library for API access to ZITADEL. Provides compiled gRPC service clients and helpers for applications and service accounts.
544 lines (543 loc) • 19 kB
JavaScript
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.7.5
// protoc unknown
// source: zitadel/action/v2beta/execution.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import Long from "long";
import { Timestamp } from "../../../google/protobuf/timestamp.js";
export const protobufPackage = "zitadel.action.v2beta";
function createBaseExecution() {
return { condition: undefined, creationDate: undefined, changeDate: undefined, targets: [] };
}
export const Execution = {
encode(message, writer = new BinaryWriter()) {
if (message.condition !== undefined) {
Condition.encode(message.condition, writer.uint32(10).fork()).join();
}
if (message.creationDate !== undefined) {
Timestamp.encode(toTimestamp(message.creationDate), writer.uint32(18).fork()).join();
}
if (message.changeDate !== undefined) {
Timestamp.encode(toTimestamp(message.changeDate), writer.uint32(26).fork()).join();
}
for (const v of message.targets) {
writer.uint32(34).string(v);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseExecution();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.condition = Condition.decode(reader, reader.uint32());
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.creationDate = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.changeDate = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.targets.push(reader.string());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
condition: isSet(object.condition) ? Condition.fromJSON(object.condition) : undefined,
creationDate: isSet(object.creationDate) ? fromJsonTimestamp(object.creationDate) : undefined,
changeDate: isSet(object.changeDate) ? fromJsonTimestamp(object.changeDate) : undefined,
targets: globalThis.Array.isArray(object?.targets) ? object.targets.map((e) => globalThis.String(e)) : [],
};
},
toJSON(message) {
const obj = {};
if (message.condition !== undefined) {
obj.condition = Condition.toJSON(message.condition);
}
if (message.creationDate !== undefined) {
obj.creationDate = message.creationDate.toISOString();
}
if (message.changeDate !== undefined) {
obj.changeDate = message.changeDate.toISOString();
}
if (message.targets?.length) {
obj.targets = message.targets;
}
return obj;
},
create(base) {
return Execution.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseExecution();
message.condition = (object.condition !== undefined && object.condition !== null)
? Condition.fromPartial(object.condition)
: undefined;
message.creationDate = object.creationDate ?? undefined;
message.changeDate = object.changeDate ?? undefined;
message.targets = object.targets?.map((e) => e) || [];
return message;
},
};
function createBaseCondition() {
return { request: undefined, response: undefined, function: undefined, event: undefined };
}
export const Condition = {
encode(message, writer = new BinaryWriter()) {
if (message.request !== undefined) {
RequestExecution.encode(message.request, writer.uint32(10).fork()).join();
}
if (message.response !== undefined) {
ResponseExecution.encode(message.response, writer.uint32(18).fork()).join();
}
if (message.function !== undefined) {
FunctionExecution.encode(message.function, writer.uint32(26).fork()).join();
}
if (message.event !== undefined) {
EventExecution.encode(message.event, writer.uint32(34).fork()).join();
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseCondition();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.request = RequestExecution.decode(reader, reader.uint32());
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.response = ResponseExecution.decode(reader, reader.uint32());
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.function = FunctionExecution.decode(reader, reader.uint32());
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.event = EventExecution.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
request: isSet(object.request) ? RequestExecution.fromJSON(object.request) : undefined,
response: isSet(object.response) ? ResponseExecution.fromJSON(object.response) : undefined,
function: isSet(object.function) ? FunctionExecution.fromJSON(object.function) : undefined,
event: isSet(object.event) ? EventExecution.fromJSON(object.event) : undefined,
};
},
toJSON(message) {
const obj = {};
if (message.request !== undefined) {
obj.request = RequestExecution.toJSON(message.request);
}
if (message.response !== undefined) {
obj.response = ResponseExecution.toJSON(message.response);
}
if (message.function !== undefined) {
obj.function = FunctionExecution.toJSON(message.function);
}
if (message.event !== undefined) {
obj.event = EventExecution.toJSON(message.event);
}
return obj;
},
create(base) {
return Condition.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseCondition();
message.request = (object.request !== undefined && object.request !== null)
? RequestExecution.fromPartial(object.request)
: undefined;
message.response = (object.response !== undefined && object.response !== null)
? ResponseExecution.fromPartial(object.response)
: undefined;
message.function = (object.function !== undefined && object.function !== null)
? FunctionExecution.fromPartial(object.function)
: undefined;
message.event = (object.event !== undefined && object.event !== null)
? EventExecution.fromPartial(object.event)
: undefined;
return message;
},
};
function createBaseRequestExecution() {
return { method: undefined, service: undefined, all: undefined };
}
export const RequestExecution = {
encode(message, writer = new BinaryWriter()) {
if (message.method !== undefined) {
writer.uint32(10).string(message.method);
}
if (message.service !== undefined) {
writer.uint32(18).string(message.service);
}
if (message.all !== undefined) {
writer.uint32(24).bool(message.all);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseRequestExecution();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.method = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.service = reader.string();
continue;
}
case 3: {
if (tag !== 24) {
break;
}
message.all = reader.bool();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
method: isSet(object.method) ? globalThis.String(object.method) : undefined,
service: isSet(object.service) ? globalThis.String(object.service) : undefined,
all: isSet(object.all) ? globalThis.Boolean(object.all) : undefined,
};
},
toJSON(message) {
const obj = {};
if (message.method !== undefined) {
obj.method = message.method;
}
if (message.service !== undefined) {
obj.service = message.service;
}
if (message.all !== undefined) {
obj.all = message.all;
}
return obj;
},
create(base) {
return RequestExecution.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseRequestExecution();
message.method = object.method ?? undefined;
message.service = object.service ?? undefined;
message.all = object.all ?? undefined;
return message;
},
};
function createBaseResponseExecution() {
return { method: undefined, service: undefined, all: undefined };
}
export const ResponseExecution = {
encode(message, writer = new BinaryWriter()) {
if (message.method !== undefined) {
writer.uint32(10).string(message.method);
}
if (message.service !== undefined) {
writer.uint32(18).string(message.service);
}
if (message.all !== undefined) {
writer.uint32(24).bool(message.all);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseResponseExecution();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.method = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.service = reader.string();
continue;
}
case 3: {
if (tag !== 24) {
break;
}
message.all = reader.bool();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
method: isSet(object.method) ? globalThis.String(object.method) : undefined,
service: isSet(object.service) ? globalThis.String(object.service) : undefined,
all: isSet(object.all) ? globalThis.Boolean(object.all) : undefined,
};
},
toJSON(message) {
const obj = {};
if (message.method !== undefined) {
obj.method = message.method;
}
if (message.service !== undefined) {
obj.service = message.service;
}
if (message.all !== undefined) {
obj.all = message.all;
}
return obj;
},
create(base) {
return ResponseExecution.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseResponseExecution();
message.method = object.method ?? undefined;
message.service = object.service ?? undefined;
message.all = object.all ?? undefined;
return message;
},
};
function createBaseFunctionExecution() {
return { name: "" };
}
export const FunctionExecution = {
encode(message, writer = new BinaryWriter()) {
if (message.name !== "") {
writer.uint32(10).string(message.name);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseFunctionExecution();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.name = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return { name: isSet(object.name) ? globalThis.String(object.name) : "" };
},
toJSON(message) {
const obj = {};
if (message.name !== "") {
obj.name = message.name;
}
return obj;
},
create(base) {
return FunctionExecution.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseFunctionExecution();
message.name = object.name ?? "";
return message;
},
};
function createBaseEventExecution() {
return { event: undefined, group: undefined, all: undefined };
}
export const EventExecution = {
encode(message, writer = new BinaryWriter()) {
if (message.event !== undefined) {
writer.uint32(10).string(message.event);
}
if (message.group !== undefined) {
writer.uint32(18).string(message.group);
}
if (message.all !== undefined) {
writer.uint32(24).bool(message.all);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseEventExecution();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.event = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.group = reader.string();
continue;
}
case 3: {
if (tag !== 24) {
break;
}
message.all = reader.bool();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
event: isSet(object.event) ? globalThis.String(object.event) : undefined,
group: isSet(object.group) ? globalThis.String(object.group) : undefined,
all: isSet(object.all) ? globalThis.Boolean(object.all) : undefined,
};
},
toJSON(message) {
const obj = {};
if (message.event !== undefined) {
obj.event = message.event;
}
if (message.group !== undefined) {
obj.group = message.group;
}
if (message.all !== undefined) {
obj.all = message.all;
}
return obj;
},
create(base) {
return EventExecution.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseEventExecution();
message.event = object.event ?? undefined;
message.group = object.group ?? undefined;
message.all = object.all ?? undefined;
return message;
},
};
function toTimestamp(date) {
const seconds = numberToLong(Math.trunc(date.getTime() / 1_000));
const nanos = (date.getTime() % 1_000) * 1_000_000;
return { seconds, nanos };
}
function fromTimestamp(t) {
let millis = (t.seconds.toNumber() || 0) * 1_000;
millis += (t.nanos || 0) / 1_000_000;
return new globalThis.Date(millis);
}
function fromJsonTimestamp(o) {
if (o instanceof globalThis.Date) {
return o;
}
else if (typeof o === "string") {
return new globalThis.Date(o);
}
else {
return fromTimestamp(Timestamp.fromJSON(o));
}
}
function numberToLong(number) {
return Long.fromNumber(number);
}
function isSet(value) {
return value !== null && value !== undefined;
}