@zitadel/node
Version:
Library for API access to ZITADEL. Provides compiled gRPC service clients and helpers for applications and service accounts.
761 lines (760 loc) • 26.4 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.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import { Duration } from "../google/protobuf/duration.js";
import { LocalizedMessage } from "./message.js";
import { ObjectDetails, textQueryMethodFromJSON, textQueryMethodToJSON } from "./object.js";
export const protobufPackage = "zitadel.action.v1";
export var ActionState;
(function (ActionState) {
ActionState[ActionState["ACTION_STATE_UNSPECIFIED"] = 0] = "ACTION_STATE_UNSPECIFIED";
ActionState[ActionState["ACTION_STATE_INACTIVE"] = 1] = "ACTION_STATE_INACTIVE";
ActionState[ActionState["ACTION_STATE_ACTIVE"] = 2] = "ACTION_STATE_ACTIVE";
ActionState[ActionState["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(ActionState || (ActionState = {}));
export function actionStateFromJSON(object) {
switch (object) {
case 0:
case "ACTION_STATE_UNSPECIFIED":
return ActionState.ACTION_STATE_UNSPECIFIED;
case 1:
case "ACTION_STATE_INACTIVE":
return ActionState.ACTION_STATE_INACTIVE;
case 2:
case "ACTION_STATE_ACTIVE":
return ActionState.ACTION_STATE_ACTIVE;
case -1:
case "UNRECOGNIZED":
default:
return ActionState.UNRECOGNIZED;
}
}
export function actionStateToJSON(object) {
switch (object) {
case ActionState.ACTION_STATE_UNSPECIFIED:
return "ACTION_STATE_UNSPECIFIED";
case ActionState.ACTION_STATE_INACTIVE:
return "ACTION_STATE_INACTIVE";
case ActionState.ACTION_STATE_ACTIVE:
return "ACTION_STATE_ACTIVE";
case ActionState.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
}
}
export var ActionFieldName;
(function (ActionFieldName) {
ActionFieldName[ActionFieldName["ACTION_FIELD_NAME_UNSPECIFIED"] = 0] = "ACTION_FIELD_NAME_UNSPECIFIED";
ActionFieldName[ActionFieldName["ACTION_FIELD_NAME_NAME"] = 1] = "ACTION_FIELD_NAME_NAME";
ActionFieldName[ActionFieldName["ACTION_FIELD_NAME_ID"] = 2] = "ACTION_FIELD_NAME_ID";
ActionFieldName[ActionFieldName["ACTION_FIELD_NAME_STATE"] = 3] = "ACTION_FIELD_NAME_STATE";
ActionFieldName[ActionFieldName["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(ActionFieldName || (ActionFieldName = {}));
export function actionFieldNameFromJSON(object) {
switch (object) {
case 0:
case "ACTION_FIELD_NAME_UNSPECIFIED":
return ActionFieldName.ACTION_FIELD_NAME_UNSPECIFIED;
case 1:
case "ACTION_FIELD_NAME_NAME":
return ActionFieldName.ACTION_FIELD_NAME_NAME;
case 2:
case "ACTION_FIELD_NAME_ID":
return ActionFieldName.ACTION_FIELD_NAME_ID;
case 3:
case "ACTION_FIELD_NAME_STATE":
return ActionFieldName.ACTION_FIELD_NAME_STATE;
case -1:
case "UNRECOGNIZED":
default:
return ActionFieldName.UNRECOGNIZED;
}
}
export function actionFieldNameToJSON(object) {
switch (object) {
case ActionFieldName.ACTION_FIELD_NAME_UNSPECIFIED:
return "ACTION_FIELD_NAME_UNSPECIFIED";
case ActionFieldName.ACTION_FIELD_NAME_NAME:
return "ACTION_FIELD_NAME_NAME";
case ActionFieldName.ACTION_FIELD_NAME_ID:
return "ACTION_FIELD_NAME_ID";
case ActionFieldName.ACTION_FIELD_NAME_STATE:
return "ACTION_FIELD_NAME_STATE";
case ActionFieldName.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
}
}
export var FlowState;
(function (FlowState) {
FlowState[FlowState["FLOW_STATE_UNSPECIFIED"] = 0] = "FLOW_STATE_UNSPECIFIED";
FlowState[FlowState["FLOW_STATE_INACTIVE"] = 1] = "FLOW_STATE_INACTIVE";
FlowState[FlowState["FLOW_STATE_ACTIVE"] = 2] = "FLOW_STATE_ACTIVE";
FlowState[FlowState["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(FlowState || (FlowState = {}));
export function flowStateFromJSON(object) {
switch (object) {
case 0:
case "FLOW_STATE_UNSPECIFIED":
return FlowState.FLOW_STATE_UNSPECIFIED;
case 1:
case "FLOW_STATE_INACTIVE":
return FlowState.FLOW_STATE_INACTIVE;
case 2:
case "FLOW_STATE_ACTIVE":
return FlowState.FLOW_STATE_ACTIVE;
case -1:
case "UNRECOGNIZED":
default:
return FlowState.UNRECOGNIZED;
}
}
export function flowStateToJSON(object) {
switch (object) {
case FlowState.FLOW_STATE_UNSPECIFIED:
return "FLOW_STATE_UNSPECIFIED";
case FlowState.FLOW_STATE_INACTIVE:
return "FLOW_STATE_INACTIVE";
case FlowState.FLOW_STATE_ACTIVE:
return "FLOW_STATE_ACTIVE";
case FlowState.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
}
}
function createBaseAction() {
return { id: "", details: undefined, state: 0, name: "", script: "", timeout: undefined, allowedToFail: false };
}
export const Action = {
encode(message, writer = new BinaryWriter()) {
if (message.id !== "") {
writer.uint32(10).string(message.id);
}
if (message.details !== undefined) {
ObjectDetails.encode(message.details, writer.uint32(18).fork()).join();
}
if (message.state !== 0) {
writer.uint32(24).int32(message.state);
}
if (message.name !== "") {
writer.uint32(34).string(message.name);
}
if (message.script !== "") {
writer.uint32(42).string(message.script);
}
if (message.timeout !== undefined) {
Duration.encode(message.timeout, writer.uint32(50).fork()).join();
}
if (message.allowedToFail !== false) {
writer.uint32(56).bool(message.allowedToFail);
}
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 = createBaseAction();
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.details = ObjectDetails.decode(reader, reader.uint32());
continue;
}
case 3: {
if (tag !== 24) {
break;
}
message.state = reader.int32();
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.name = reader.string();
continue;
}
case 5: {
if (tag !== 42) {
break;
}
message.script = reader.string();
continue;
}
case 6: {
if (tag !== 50) {
break;
}
message.timeout = Duration.decode(reader, reader.uint32());
continue;
}
case 7: {
if (tag !== 56) {
break;
}
message.allowedToFail = reader.bool();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
id: isSet(object.id) ? globalThis.String(object.id) : "",
details: isSet(object.details) ? ObjectDetails.fromJSON(object.details) : undefined,
state: isSet(object.state) ? actionStateFromJSON(object.state) : 0,
name: isSet(object.name) ? globalThis.String(object.name) : "",
script: isSet(object.script) ? globalThis.String(object.script) : "",
timeout: isSet(object.timeout) ? Duration.fromJSON(object.timeout) : undefined,
allowedToFail: isSet(object.allowedToFail) ? globalThis.Boolean(object.allowedToFail) : false,
};
},
toJSON(message) {
const obj = {};
if (message.id !== "") {
obj.id = message.id;
}
if (message.details !== undefined) {
obj.details = ObjectDetails.toJSON(message.details);
}
if (message.state !== 0) {
obj.state = actionStateToJSON(message.state);
}
if (message.name !== "") {
obj.name = message.name;
}
if (message.script !== "") {
obj.script = message.script;
}
if (message.timeout !== undefined) {
obj.timeout = Duration.toJSON(message.timeout);
}
if (message.allowedToFail !== false) {
obj.allowedToFail = message.allowedToFail;
}
return obj;
},
create(base) {
return Action.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseAction();
message.id = object.id ?? "";
message.details = (object.details !== undefined && object.details !== null)
? ObjectDetails.fromPartial(object.details)
: undefined;
message.state = object.state ?? 0;
message.name = object.name ?? "";
message.script = object.script ?? "";
message.timeout = (object.timeout !== undefined && object.timeout !== null)
? Duration.fromPartial(object.timeout)
: undefined;
message.allowedToFail = object.allowedToFail ?? false;
return message;
},
};
function createBaseActionIDQuery() {
return { id: "" };
}
export const ActionIDQuery = {
encode(message, writer = new BinaryWriter()) {
if (message.id !== "") {
writer.uint32(10).string(message.id);
}
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 = createBaseActionIDQuery();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.id = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return { id: isSet(object.id) ? globalThis.String(object.id) : "" };
},
toJSON(message) {
const obj = {};
if (message.id !== "") {
obj.id = message.id;
}
return obj;
},
create(base) {
return ActionIDQuery.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseActionIDQuery();
message.id = object.id ?? "";
return message;
},
};
function createBaseActionNameQuery() {
return { name: "", method: 0 };
}
export const ActionNameQuery = {
encode(message, writer = new BinaryWriter()) {
if (message.name !== "") {
writer.uint32(10).string(message.name);
}
if (message.method !== 0) {
writer.uint32(16).int32(message.method);
}
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 = createBaseActionNameQuery();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.name = reader.string();
continue;
}
case 2: {
if (tag !== 16) {
break;
}
message.method = reader.int32();
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) : "",
method: isSet(object.method) ? textQueryMethodFromJSON(object.method) : 0,
};
},
toJSON(message) {
const obj = {};
if (message.name !== "") {
obj.name = message.name;
}
if (message.method !== 0) {
obj.method = textQueryMethodToJSON(message.method);
}
return obj;
},
create(base) {
return ActionNameQuery.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseActionNameQuery();
message.name = object.name ?? "";
message.method = object.method ?? 0;
return message;
},
};
function createBaseActionStateQuery() {
return { state: 0 };
}
export const ActionStateQuery = {
encode(message, writer = new BinaryWriter()) {
if (message.state !== 0) {
writer.uint32(8).int32(message.state);
}
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 = createBaseActionStateQuery();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.state = reader.int32();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return { state: isSet(object.state) ? actionStateFromJSON(object.state) : 0 };
},
toJSON(message) {
const obj = {};
if (message.state !== 0) {
obj.state = actionStateToJSON(message.state);
}
return obj;
},
create(base) {
return ActionStateQuery.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseActionStateQuery();
message.state = object.state ?? 0;
return message;
},
};
function createBaseFlow() {
return { type: undefined, details: undefined, state: 0, triggerActions: [] };
}
export const Flow = {
encode(message, writer = new BinaryWriter()) {
if (message.type !== undefined) {
FlowType.encode(message.type, writer.uint32(10).fork()).join();
}
if (message.details !== undefined) {
ObjectDetails.encode(message.details, writer.uint32(18).fork()).join();
}
if (message.state !== 0) {
writer.uint32(24).int32(message.state);
}
for (const v of message.triggerActions) {
TriggerAction.encode(v, 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 = createBaseFlow();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.type = FlowType.decode(reader, reader.uint32());
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.details = ObjectDetails.decode(reader, reader.uint32());
continue;
}
case 3: {
if (tag !== 24) {
break;
}
message.state = reader.int32();
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.triggerActions.push(TriggerAction.decode(reader, reader.uint32()));
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
type: isSet(object.type) ? FlowType.fromJSON(object.type) : undefined,
details: isSet(object.details) ? ObjectDetails.fromJSON(object.details) : undefined,
state: isSet(object.state) ? flowStateFromJSON(object.state) : 0,
triggerActions: globalThis.Array.isArray(object?.triggerActions)
? object.triggerActions.map((e) => TriggerAction.fromJSON(e))
: [],
};
},
toJSON(message) {
const obj = {};
if (message.type !== undefined) {
obj.type = FlowType.toJSON(message.type);
}
if (message.details !== undefined) {
obj.details = ObjectDetails.toJSON(message.details);
}
if (message.state !== 0) {
obj.state = flowStateToJSON(message.state);
}
if (message.triggerActions?.length) {
obj.triggerActions = message.triggerActions.map((e) => TriggerAction.toJSON(e));
}
return obj;
},
create(base) {
return Flow.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseFlow();
message.type = (object.type !== undefined && object.type !== null) ? FlowType.fromPartial(object.type) : undefined;
message.details = (object.details !== undefined && object.details !== null)
? ObjectDetails.fromPartial(object.details)
: undefined;
message.state = object.state ?? 0;
message.triggerActions = object.triggerActions?.map((e) => TriggerAction.fromPartial(e)) || [];
return message;
},
};
function createBaseFlowType() {
return { id: "", name: undefined };
}
export const FlowType = {
encode(message, writer = new BinaryWriter()) {
if (message.id !== "") {
writer.uint32(10).string(message.id);
}
if (message.name !== undefined) {
LocalizedMessage.encode(message.name, writer.uint32(18).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 = createBaseFlowType();
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.name = LocalizedMessage.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
id: isSet(object.id) ? globalThis.String(object.id) : "",
name: isSet(object.name) ? LocalizedMessage.fromJSON(object.name) : undefined,
};
},
toJSON(message) {
const obj = {};
if (message.id !== "") {
obj.id = message.id;
}
if (message.name !== undefined) {
obj.name = LocalizedMessage.toJSON(message.name);
}
return obj;
},
create(base) {
return FlowType.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseFlowType();
message.id = object.id ?? "";
message.name = (object.name !== undefined && object.name !== null)
? LocalizedMessage.fromPartial(object.name)
: undefined;
return message;
},
};
function createBaseTriggerType() {
return { id: "", name: undefined };
}
export const TriggerType = {
encode(message, writer = new BinaryWriter()) {
if (message.id !== "") {
writer.uint32(10).string(message.id);
}
if (message.name !== undefined) {
LocalizedMessage.encode(message.name, writer.uint32(18).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 = createBaseTriggerType();
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.name = LocalizedMessage.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
id: isSet(object.id) ? globalThis.String(object.id) : "",
name: isSet(object.name) ? LocalizedMessage.fromJSON(object.name) : undefined,
};
},
toJSON(message) {
const obj = {};
if (message.id !== "") {
obj.id = message.id;
}
if (message.name !== undefined) {
obj.name = LocalizedMessage.toJSON(message.name);
}
return obj;
},
create(base) {
return TriggerType.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseTriggerType();
message.id = object.id ?? "";
message.name = (object.name !== undefined && object.name !== null)
? LocalizedMessage.fromPartial(object.name)
: undefined;
return message;
},
};
function createBaseTriggerAction() {
return { triggerType: undefined, actions: [] };
}
export const TriggerAction = {
encode(message, writer = new BinaryWriter()) {
if (message.triggerType !== undefined) {
TriggerType.encode(message.triggerType, writer.uint32(10).fork()).join();
}
for (const v of message.actions) {
Action.encode(v, writer.uint32(18).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 = createBaseTriggerAction();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.triggerType = TriggerType.decode(reader, reader.uint32());
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.actions.push(Action.decode(reader, reader.uint32()));
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
triggerType: isSet(object.triggerType) ? TriggerType.fromJSON(object.triggerType) : undefined,
actions: globalThis.Array.isArray(object?.actions) ? object.actions.map((e) => Action.fromJSON(e)) : [],
};
},
toJSON(message) {
const obj = {};
if (message.triggerType !== undefined) {
obj.triggerType = TriggerType.toJSON(message.triggerType);
}
if (message.actions?.length) {
obj.actions = message.actions.map((e) => Action.toJSON(e));
}
return obj;
},
create(base) {
return TriggerAction.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseTriggerAction();
message.triggerType = (object.triggerType !== undefined && object.triggerType !== null)
? TriggerType.fromPartial(object.triggerType)
: undefined;
message.actions = object.actions?.map((e) => Action.fromPartial(e)) || [];
return message;
},
};
function isSet(value) {
return value !== null && value !== undefined;
}