@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()!
414 lines • 13.3 kB
JavaScript
;
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 target_exports = {};
__export(target_exports, {
RESTAsync: () => RESTAsync,
RESTCall: () => RESTCall,
RESTWebhook: () => RESTWebhook,
Target: () => Target,
protobufPackage: () => protobufPackage
});
module.exports = __toCommonJS(target_exports);
var import_wire = require("@bufbuild/protobuf/wire");
var import_long = __toESM(require("long"));
var import_duration = require("../../../google/protobuf/duration.js");
var import_timestamp = require("../../../google/protobuf/timestamp.js");
const protobufPackage = "zitadel.action.v2beta";
function createBaseTarget() {
return {
id: "",
creationDate: void 0,
changeDate: void 0,
name: "",
restWebhook: void 0,
restCall: void 0,
restAsync: void 0,
timeout: void 0,
endpoint: "",
signingKey: ""
};
}
const Target = {
encode(message, writer = new import_wire.BinaryWriter()) {
if (message.id !== "") {
writer.uint32(10).string(message.id);
}
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();
}
if (message.name !== "") {
writer.uint32(34).string(message.name);
}
if (message.restWebhook !== void 0) {
RESTWebhook.encode(message.restWebhook, writer.uint32(42).fork()).join();
}
if (message.restCall !== void 0) {
RESTCall.encode(message.restCall, writer.uint32(50).fork()).join();
}
if (message.restAsync !== void 0) {
RESTAsync.encode(message.restAsync, writer.uint32(58).fork()).join();
}
if (message.timeout !== void 0) {
import_duration.Duration.encode(message.timeout, writer.uint32(66).fork()).join();
}
if (message.endpoint !== "") {
writer.uint32(74).string(message.endpoint);
}
if (message.signingKey !== "") {
writer.uint32(82).string(message.signingKey);
}
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 = createBaseTarget();
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.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.name = reader.string();
continue;
}
case 5: {
if (tag !== 42) {
break;
}
message.restWebhook = RESTWebhook.decode(reader, reader.uint32());
continue;
}
case 6: {
if (tag !== 50) {
break;
}
message.restCall = RESTCall.decode(reader, reader.uint32());
continue;
}
case 7: {
if (tag !== 58) {
break;
}
message.restAsync = RESTAsync.decode(reader, reader.uint32());
continue;
}
case 8: {
if (tag !== 66) {
break;
}
message.timeout = import_duration.Duration.decode(reader, reader.uint32());
continue;
}
case 9: {
if (tag !== 74) {
break;
}
message.endpoint = reader.string();
continue;
}
case 10: {
if (tag !== 82) {
break;
}
message.signingKey = 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) : "",
creationDate: isSet(object.creationDate) ? fromJsonTimestamp(object.creationDate) : void 0,
changeDate: isSet(object.changeDate) ? fromJsonTimestamp(object.changeDate) : void 0,
name: isSet(object.name) ? globalThis.String(object.name) : "",
restWebhook: isSet(object.restWebhook) ? RESTWebhook.fromJSON(object.restWebhook) : void 0,
restCall: isSet(object.restCall) ? RESTCall.fromJSON(object.restCall) : void 0,
restAsync: isSet(object.restAsync) ? RESTAsync.fromJSON(object.restAsync) : void 0,
timeout: isSet(object.timeout) ? import_duration.Duration.fromJSON(object.timeout) : void 0,
endpoint: isSet(object.endpoint) ? globalThis.String(object.endpoint) : "",
signingKey: isSet(object.signingKey) ? globalThis.String(object.signingKey) : ""
};
},
toJSON(message) {
const obj = {};
if (message.id !== "") {
obj.id = message.id;
}
if (message.creationDate !== void 0) {
obj.creationDate = message.creationDate.toISOString();
}
if (message.changeDate !== void 0) {
obj.changeDate = message.changeDate.toISOString();
}
if (message.name !== "") {
obj.name = message.name;
}
if (message.restWebhook !== void 0) {
obj.restWebhook = RESTWebhook.toJSON(message.restWebhook);
}
if (message.restCall !== void 0) {
obj.restCall = RESTCall.toJSON(message.restCall);
}
if (message.restAsync !== void 0) {
obj.restAsync = RESTAsync.toJSON(message.restAsync);
}
if (message.timeout !== void 0) {
obj.timeout = import_duration.Duration.toJSON(message.timeout);
}
if (message.endpoint !== "") {
obj.endpoint = message.endpoint;
}
if (message.signingKey !== "") {
obj.signingKey = message.signingKey;
}
return obj;
},
create(base) {
return Target.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseTarget();
message.id = object.id ?? "";
message.creationDate = object.creationDate ?? void 0;
message.changeDate = object.changeDate ?? void 0;
message.name = object.name ?? "";
message.restWebhook = object.restWebhook !== void 0 && object.restWebhook !== null ? RESTWebhook.fromPartial(object.restWebhook) : void 0;
message.restCall = object.restCall !== void 0 && object.restCall !== null ? RESTCall.fromPartial(object.restCall) : void 0;
message.restAsync = object.restAsync !== void 0 && object.restAsync !== null ? RESTAsync.fromPartial(object.restAsync) : void 0;
message.timeout = object.timeout !== void 0 && object.timeout !== null ? import_duration.Duration.fromPartial(object.timeout) : void 0;
message.endpoint = object.endpoint ?? "";
message.signingKey = object.signingKey ?? "";
return message;
}
};
function createBaseRESTWebhook() {
return { interruptOnError: false };
}
const RESTWebhook = {
encode(message, writer = new import_wire.BinaryWriter()) {
if (message.interruptOnError !== false) {
writer.uint32(8).bool(message.interruptOnError);
}
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 = createBaseRESTWebhook();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.interruptOnError = reader.bool();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return { interruptOnError: isSet(object.interruptOnError) ? globalThis.Boolean(object.interruptOnError) : false };
},
toJSON(message) {
const obj = {};
if (message.interruptOnError !== false) {
obj.interruptOnError = message.interruptOnError;
}
return obj;
},
create(base) {
return RESTWebhook.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseRESTWebhook();
message.interruptOnError = object.interruptOnError ?? false;
return message;
}
};
function createBaseRESTCall() {
return { interruptOnError: false };
}
const RESTCall = {
encode(message, writer = new import_wire.BinaryWriter()) {
if (message.interruptOnError !== false) {
writer.uint32(8).bool(message.interruptOnError);
}
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 = createBaseRESTCall();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.interruptOnError = reader.bool();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return { interruptOnError: isSet(object.interruptOnError) ? globalThis.Boolean(object.interruptOnError) : false };
},
toJSON(message) {
const obj = {};
if (message.interruptOnError !== false) {
obj.interruptOnError = message.interruptOnError;
}
return obj;
},
create(base) {
return RESTCall.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseRESTCall();
message.interruptOnError = object.interruptOnError ?? false;
return message;
}
};
function createBaseRESTAsync() {
return {};
}
const RESTAsync = {
encode(_, writer = new import_wire.BinaryWriter()) {
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 = createBaseRESTAsync();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(_) {
return {};
},
toJSON(_) {
const obj = {};
return obj;
},
create(base) {
return RESTAsync.fromPartial(base ?? {});
},
fromPartial(_) {
const message = createBaseRESTAsync();
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 = {
RESTAsync,
RESTCall,
RESTWebhook,
Target,
protobufPackage
});
//# sourceMappingURL=target.js.map