UNPKG

@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()!

575 lines 18 kB
"use strict"; var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; 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 __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var execution_exports = {}; __export(execution_exports, { Condition: () => Condition, EventExecution: () => EventExecution, Execution: () => Execution, FunctionExecution: () => FunctionExecution, RequestExecution: () => RequestExecution, ResponseExecution: () => ResponseExecution, protobufPackage: () => protobufPackage }); module.exports = __toCommonJS(execution_exports); var import_wire = require("@bufbuild/protobuf/wire"); var import_long = __toESM(require("long")); var import_timestamp = require("../../../google/protobuf/timestamp.js"); const protobufPackage = "zitadel.action.v2beta"; function createBaseExecution() { return { condition: void 0, creationDate: void 0, changeDate: void 0, targets: [] }; } const Execution = { encode(message, writer = new import_wire.BinaryWriter()) { if (message.condition !== void 0) { Condition.encode(message.condition, writer.uint32(10).fork()).join(); } if (message.creationDate !== void 0) { import_timestamp.Timestamp.encode(toTimestamp(message.creationDate), writer.uint32(18).fork()).join(); } if (message.changeDate !== void 0) { import_timestamp.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 import_wire.BinaryReader ? input : new import_wire.BinaryReader(input); const end = length === void 0 ? 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(import_timestamp.Timestamp.decode(reader, reader.uint32())); continue; } case 3: { if (tag !== 26) { break; } message.changeDate = fromTimestamp(import_timestamp.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) : void 0, creationDate: isSet(object.creationDate) ? fromJsonTimestamp(object.creationDate) : void 0, changeDate: isSet(object.changeDate) ? fromJsonTimestamp(object.changeDate) : void 0, targets: globalThis.Array.isArray(object?.targets) ? object.targets.map((e) => globalThis.String(e)) : [] }; }, toJSON(message) { const obj = {}; if (message.condition !== void 0) { obj.condition = Condition.toJSON(message.condition); } if (message.creationDate !== void 0) { obj.creationDate = message.creationDate.toISOString(); } if (message.changeDate !== void 0) { 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 !== void 0 && object.condition !== null ? Condition.fromPartial(object.condition) : void 0; message.creationDate = object.creationDate ?? void 0; message.changeDate = object.changeDate ?? void 0; message.targets = object.targets?.map((e) => e) || []; return message; } }; function createBaseCondition() { return { request: void 0, response: void 0, function: void 0, event: void 0 }; } const Condition = { encode(message, writer = new import_wire.BinaryWriter()) { if (message.request !== void 0) { RequestExecution.encode(message.request, writer.uint32(10).fork()).join(); } if (message.response !== void 0) { ResponseExecution.encode(message.response, writer.uint32(18).fork()).join(); } if (message.function !== void 0) { FunctionExecution.encode(message.function, writer.uint32(26).fork()).join(); } if (message.event !== void 0) { EventExecution.encode(message.event, 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 = 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) : void 0, response: isSet(object.response) ? ResponseExecution.fromJSON(object.response) : void 0, function: isSet(object.function) ? FunctionExecution.fromJSON(object.function) : void 0, event: isSet(object.event) ? EventExecution.fromJSON(object.event) : void 0 }; }, toJSON(message) { const obj = {}; if (message.request !== void 0) { obj.request = RequestExecution.toJSON(message.request); } if (message.response !== void 0) { obj.response = ResponseExecution.toJSON(message.response); } if (message.function !== void 0) { obj.function = FunctionExecution.toJSON(message.function); } if (message.event !== void 0) { obj.event = EventExecution.toJSON(message.event); } return obj; }, create(base) { return Condition.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseCondition(); message.request = object.request !== void 0 && object.request !== null ? RequestExecution.fromPartial(object.request) : void 0; message.response = object.response !== void 0 && object.response !== null ? ResponseExecution.fromPartial(object.response) : void 0; message.function = object.function !== void 0 && object.function !== null ? FunctionExecution.fromPartial(object.function) : void 0; message.event = object.event !== void 0 && object.event !== null ? EventExecution.fromPartial(object.event) : void 0; return message; } }; function createBaseRequestExecution() { return { method: void 0, service: void 0, all: void 0 }; } const RequestExecution = { encode(message, writer = new import_wire.BinaryWriter()) { if (message.method !== void 0) { writer.uint32(10).string(message.method); } if (message.service !== void 0) { writer.uint32(18).string(message.service); } if (message.all !== void 0) { writer.uint32(24).bool(message.all); } 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 = 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) : void 0, service: isSet(object.service) ? globalThis.String(object.service) : void 0, all: isSet(object.all) ? globalThis.Boolean(object.all) : void 0 }; }, toJSON(message) { const obj = {}; if (message.method !== void 0) { obj.method = message.method; } if (message.service !== void 0) { obj.service = message.service; } if (message.all !== void 0) { obj.all = message.all; } return obj; }, create(base) { return RequestExecution.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseRequestExecution(); message.method = object.method ?? void 0; message.service = object.service ?? void 0; message.all = object.all ?? void 0; return message; } }; function createBaseResponseExecution() { return { method: void 0, service: void 0, all: void 0 }; } const ResponseExecution = { encode(message, writer = new import_wire.BinaryWriter()) { if (message.method !== void 0) { writer.uint32(10).string(message.method); } if (message.service !== void 0) { writer.uint32(18).string(message.service); } if (message.all !== void 0) { writer.uint32(24).bool(message.all); } 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 = 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) : void 0, service: isSet(object.service) ? globalThis.String(object.service) : void 0, all: isSet(object.all) ? globalThis.Boolean(object.all) : void 0 }; }, toJSON(message) { const obj = {}; if (message.method !== void 0) { obj.method = message.method; } if (message.service !== void 0) { obj.service = message.service; } if (message.all !== void 0) { obj.all = message.all; } return obj; }, create(base) { return ResponseExecution.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseResponseExecution(); message.method = object.method ?? void 0; message.service = object.service ?? void 0; message.all = object.all ?? void 0; return message; } }; function createBaseFunctionExecution() { return { name: "" }; } const FunctionExecution = { encode(message, writer = new import_wire.BinaryWriter()) { if (message.name !== "") { writer.uint32(10).string(message.name); } 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 = 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: void 0, group: void 0, all: void 0 }; } const EventExecution = { encode(message, writer = new import_wire.BinaryWriter()) { if (message.event !== void 0) { writer.uint32(10).string(message.event); } if (message.group !== void 0) { writer.uint32(18).string(message.group); } if (message.all !== void 0) { writer.uint32(24).bool(message.all); } 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 = 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) : void 0, group: isSet(object.group) ? globalThis.String(object.group) : void 0, all: isSet(object.all) ? globalThis.Boolean(object.all) : void 0 }; }, toJSON(message) { const obj = {}; if (message.event !== void 0) { obj.event = message.event; } if (message.group !== void 0) { obj.group = message.group; } if (message.all !== void 0) { obj.all = message.all; } return obj; }, create(base) { return EventExecution.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseEventExecution(); message.event = object.event ?? void 0; message.group = object.group ?? void 0; message.all = object.all ?? void 0; return message; } }; function toTimestamp(date) { const seconds = numberToLong(Math.trunc(date.getTime() / 1e3)); const nanos = date.getTime() % 1e3 * 1e6; return { seconds, nanos }; } function fromTimestamp(t) { let millis = (t.seconds.toNumber() || 0) * 1e3; millis += (t.nanos || 0) / 1e6; 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(import_timestamp.Timestamp.fromJSON(o)); } } function numberToLong(number) { return import_long.default.fromNumber(number); } function isSet(value) { return value !== null && value !== void 0; } // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { Condition, EventExecution, Execution, FunctionExecution, RequestExecution, ResponseExecution, protobufPackage }); //# sourceMappingURL=execution.js.map