@ragnaraven/zitadel-node-dual
Version:
Library for API access to ZITADEL with modern ES import syntax. Works everywhere - NestJS, Node.js, any TypeScript environment. No more require()!
802 lines • 24.8 kB
JavaScript
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var action_exports = {};
__export(action_exports, {
Action: () => Action,
ActionFieldName: () => ActionFieldName,
ActionIDQuery: () => ActionIDQuery,
ActionNameQuery: () => ActionNameQuery,
ActionState: () => ActionState,
ActionStateQuery: () => ActionStateQuery,
Flow: () => Flow,
FlowState: () => FlowState,
FlowType: () => FlowType,
TriggerAction: () => TriggerAction,
TriggerType: () => TriggerType,
actionFieldNameFromJSON: () => actionFieldNameFromJSON,
actionFieldNameToJSON: () => actionFieldNameToJSON,
actionStateFromJSON: () => actionStateFromJSON,
actionStateToJSON: () => actionStateToJSON,
flowStateFromJSON: () => flowStateFromJSON,
flowStateToJSON: () => flowStateToJSON,
protobufPackage: () => protobufPackage
});
module.exports = __toCommonJS(action_exports);
var import_wire = require("@bufbuild/protobuf/wire");
var import_duration = require("../google/protobuf/duration.js");
var import_message = require("./message.js");
var import_object = require("./object.js");
const protobufPackage = "zitadel.action.v1";
var ActionState = /* @__PURE__ */ ((ActionState2) => {
ActionState2[ActionState2["ACTION_STATE_UNSPECIFIED"] = 0] = "ACTION_STATE_UNSPECIFIED";
ActionState2[ActionState2["ACTION_STATE_INACTIVE"] = 1] = "ACTION_STATE_INACTIVE";
ActionState2[ActionState2["ACTION_STATE_ACTIVE"] = 2] = "ACTION_STATE_ACTIVE";
ActionState2[ActionState2["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
return ActionState2;
})(ActionState || {});
function actionStateFromJSON(object) {
switch (object) {
case 0:
case "ACTION_STATE_UNSPECIFIED":
return 0 /* ACTION_STATE_UNSPECIFIED */;
case 1:
case "ACTION_STATE_INACTIVE":
return 1 /* ACTION_STATE_INACTIVE */;
case 2:
case "ACTION_STATE_ACTIVE":
return 2 /* ACTION_STATE_ACTIVE */;
case -1:
case "UNRECOGNIZED":
default:
return -1 /* UNRECOGNIZED */;
}
}
function actionStateToJSON(object) {
switch (object) {
case 0 /* ACTION_STATE_UNSPECIFIED */:
return "ACTION_STATE_UNSPECIFIED";
case 1 /* ACTION_STATE_INACTIVE */:
return "ACTION_STATE_INACTIVE";
case 2 /* ACTION_STATE_ACTIVE */:
return "ACTION_STATE_ACTIVE";
case -1 /* UNRECOGNIZED */:
default:
return "UNRECOGNIZED";
}
}
var ActionFieldName = /* @__PURE__ */ ((ActionFieldName2) => {
ActionFieldName2[ActionFieldName2["ACTION_FIELD_NAME_UNSPECIFIED"] = 0] = "ACTION_FIELD_NAME_UNSPECIFIED";
ActionFieldName2[ActionFieldName2["ACTION_FIELD_NAME_NAME"] = 1] = "ACTION_FIELD_NAME_NAME";
ActionFieldName2[ActionFieldName2["ACTION_FIELD_NAME_ID"] = 2] = "ACTION_FIELD_NAME_ID";
ActionFieldName2[ActionFieldName2["ACTION_FIELD_NAME_STATE"] = 3] = "ACTION_FIELD_NAME_STATE";
ActionFieldName2[ActionFieldName2["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
return ActionFieldName2;
})(ActionFieldName || {});
function actionFieldNameFromJSON(object) {
switch (object) {
case 0:
case "ACTION_FIELD_NAME_UNSPECIFIED":
return 0 /* ACTION_FIELD_NAME_UNSPECIFIED */;
case 1:
case "ACTION_FIELD_NAME_NAME":
return 1 /* ACTION_FIELD_NAME_NAME */;
case 2:
case "ACTION_FIELD_NAME_ID":
return 2 /* ACTION_FIELD_NAME_ID */;
case 3:
case "ACTION_FIELD_NAME_STATE":
return 3 /* ACTION_FIELD_NAME_STATE */;
case -1:
case "UNRECOGNIZED":
default:
return -1 /* UNRECOGNIZED */;
}
}
function actionFieldNameToJSON(object) {
switch (object) {
case 0 /* ACTION_FIELD_NAME_UNSPECIFIED */:
return "ACTION_FIELD_NAME_UNSPECIFIED";
case 1 /* ACTION_FIELD_NAME_NAME */:
return "ACTION_FIELD_NAME_NAME";
case 2 /* ACTION_FIELD_NAME_ID */:
return "ACTION_FIELD_NAME_ID";
case 3 /* ACTION_FIELD_NAME_STATE */:
return "ACTION_FIELD_NAME_STATE";
case -1 /* UNRECOGNIZED */:
default:
return "UNRECOGNIZED";
}
}
var FlowState = /* @__PURE__ */ ((FlowState2) => {
FlowState2[FlowState2["FLOW_STATE_UNSPECIFIED"] = 0] = "FLOW_STATE_UNSPECIFIED";
FlowState2[FlowState2["FLOW_STATE_INACTIVE"] = 1] = "FLOW_STATE_INACTIVE";
FlowState2[FlowState2["FLOW_STATE_ACTIVE"] = 2] = "FLOW_STATE_ACTIVE";
FlowState2[FlowState2["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
return FlowState2;
})(FlowState || {});
function flowStateFromJSON(object) {
switch (object) {
case 0:
case "FLOW_STATE_UNSPECIFIED":
return 0 /* FLOW_STATE_UNSPECIFIED */;
case 1:
case "FLOW_STATE_INACTIVE":
return 1 /* FLOW_STATE_INACTIVE */;
case 2:
case "FLOW_STATE_ACTIVE":
return 2 /* FLOW_STATE_ACTIVE */;
case -1:
case "UNRECOGNIZED":
default:
return -1 /* UNRECOGNIZED */;
}
}
function flowStateToJSON(object) {
switch (object) {
case 0 /* FLOW_STATE_UNSPECIFIED */:
return "FLOW_STATE_UNSPECIFIED";
case 1 /* FLOW_STATE_INACTIVE */:
return "FLOW_STATE_INACTIVE";
case 2 /* FLOW_STATE_ACTIVE */:
return "FLOW_STATE_ACTIVE";
case -1 /* UNRECOGNIZED */:
default:
return "UNRECOGNIZED";
}
}
function createBaseAction() {
return { id: "", details: void 0, state: 0, name: "", script: "", timeout: void 0, allowedToFail: false };
}
const Action = {
encode(message, writer = new import_wire.BinaryWriter()) {
if (message.id !== "") {
writer.uint32(10).string(message.id);
}
if (message.details !== void 0) {
import_object.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 !== void 0) {
import_duration.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 import_wire.BinaryReader ? input : new import_wire.BinaryReader(input);
const end = length === void 0 ? 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 = import_object.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 = import_duration.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) ? import_object.ObjectDetails.fromJSON(object.details) : void 0,
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) ? import_duration.Duration.fromJSON(object.timeout) : void 0,
allowedToFail: isSet(object.allowedToFail) ? globalThis.Boolean(object.allowedToFail) : false
};
},
toJSON(message) {
const obj = {};
if (message.id !== "") {
obj.id = message.id;
}
if (message.details !== void 0) {
obj.details = import_object.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 !== void 0) {
obj.timeout = import_duration.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 !== void 0 && object.details !== null ? import_object.ObjectDetails.fromPartial(object.details) : void 0;
message.state = object.state ?? 0;
message.name = object.name ?? "";
message.script = object.script ?? "";
message.timeout = object.timeout !== void 0 && object.timeout !== null ? import_duration.Duration.fromPartial(object.timeout) : void 0;
message.allowedToFail = object.allowedToFail ?? false;
return message;
}
};
function createBaseActionIDQuery() {
return { id: "" };
}
const ActionIDQuery = {
encode(message, writer = new import_wire.BinaryWriter()) {
if (message.id !== "") {
writer.uint32(10).string(message.id);
}
return writer;
},
decode(input, length) {
const reader = input instanceof import_wire.BinaryReader ? input : new import_wire.BinaryReader(input);
const end = length === void 0 ? 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 };
}
const ActionNameQuery = {
encode(message, writer = new import_wire.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 import_wire.BinaryReader ? input : new import_wire.BinaryReader(input);
const end = length === void 0 ? 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) ? (0, import_object.textQueryMethodFromJSON)(object.method) : 0
};
},
toJSON(message) {
const obj = {};
if (message.name !== "") {
obj.name = message.name;
}
if (message.method !== 0) {
obj.method = (0, import_object.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 };
}
const ActionStateQuery = {
encode(message, writer = new import_wire.BinaryWriter()) {
if (message.state !== 0) {
writer.uint32(8).int32(message.state);
}
return writer;
},
decode(input, length) {
const reader = input instanceof import_wire.BinaryReader ? input : new import_wire.BinaryReader(input);
const end = length === void 0 ? 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: void 0, details: void 0, state: 0, triggerActions: [] };
}
const Flow = {
encode(message, writer = new import_wire.BinaryWriter()) {
if (message.type !== void 0) {
FlowType.encode(message.type, writer.uint32(10).fork()).join();
}
if (message.details !== void 0) {
import_object.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 import_wire.BinaryReader ? input : new import_wire.BinaryReader(input);
const end = length === void 0 ? 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 = import_object.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) : void 0,
details: isSet(object.details) ? import_object.ObjectDetails.fromJSON(object.details) : void 0,
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 !== void 0) {
obj.type = FlowType.toJSON(message.type);
}
if (message.details !== void 0) {
obj.details = import_object.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 !== void 0 && object.type !== null ? FlowType.fromPartial(object.type) : void 0;
message.details = object.details !== void 0 && object.details !== null ? import_object.ObjectDetails.fromPartial(object.details) : void 0;
message.state = object.state ?? 0;
message.triggerActions = object.triggerActions?.map((e) => TriggerAction.fromPartial(e)) || [];
return message;
}
};
function createBaseFlowType() {
return { id: "", name: void 0 };
}
const FlowType = {
encode(message, writer = new import_wire.BinaryWriter()) {
if (message.id !== "") {
writer.uint32(10).string(message.id);
}
if (message.name !== void 0) {
import_message.LocalizedMessage.encode(message.name, writer.uint32(18).fork()).join();
}
return writer;
},
decode(input, length) {
const reader = input instanceof import_wire.BinaryReader ? input : new import_wire.BinaryReader(input);
const end = length === void 0 ? 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 = import_message.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) ? import_message.LocalizedMessage.fromJSON(object.name) : void 0
};
},
toJSON(message) {
const obj = {};
if (message.id !== "") {
obj.id = message.id;
}
if (message.name !== void 0) {
obj.name = import_message.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 !== void 0 && object.name !== null ? import_message.LocalizedMessage.fromPartial(object.name) : void 0;
return message;
}
};
function createBaseTriggerType() {
return { id: "", name: void 0 };
}
const TriggerType = {
encode(message, writer = new import_wire.BinaryWriter()) {
if (message.id !== "") {
writer.uint32(10).string(message.id);
}
if (message.name !== void 0) {
import_message.LocalizedMessage.encode(message.name, writer.uint32(18).fork()).join();
}
return writer;
},
decode(input, length) {
const reader = input instanceof import_wire.BinaryReader ? input : new import_wire.BinaryReader(input);
const end = length === void 0 ? 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 = import_message.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) ? import_message.LocalizedMessage.fromJSON(object.name) : void 0
};
},
toJSON(message) {
const obj = {};
if (message.id !== "") {
obj.id = message.id;
}
if (message.name !== void 0) {
obj.name = import_message.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 !== void 0 && object.name !== null ? import_message.LocalizedMessage.fromPartial(object.name) : void 0;
return message;
}
};
function createBaseTriggerAction() {
return { triggerType: void 0, actions: [] };
}
const TriggerAction = {
encode(message, writer = new import_wire.BinaryWriter()) {
if (message.triggerType !== void 0) {
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 import_wire.BinaryReader ? input : new import_wire.BinaryReader(input);
const end = length === void 0 ? 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) : void 0,
actions: globalThis.Array.isArray(object?.actions) ? object.actions.map((e) => Action.fromJSON(e)) : []
};
},
toJSON(message) {
const obj = {};
if (message.triggerType !== void 0) {
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 !== void 0 && object.triggerType !== null ? TriggerType.fromPartial(object.triggerType) : void 0;
message.actions = object.actions?.map((e) => Action.fromPartial(e)) || [];
return message;
}
};
function isSet(value) {
return value !== null && value !== void 0;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
Action,
ActionFieldName,
ActionIDQuery,
ActionNameQuery,
ActionState,
ActionStateQuery,
Flow,
FlowState,
FlowType,
TriggerAction,
TriggerType,
actionFieldNameFromJSON,
actionFieldNameToJSON,
actionStateFromJSON,
actionStateToJSON,
flowStateFromJSON,
flowStateToJSON,
protobufPackage
});
//# sourceMappingURL=action.js.map