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

1,188 lines 29 kB
"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 saml_service_exports = {}; __export(saml_service_exports, { CreateResponseRequest: () => CreateResponseRequest, CreateResponseResponse: () => CreateResponseResponse, GetSAMLRequestRequest: () => GetSAMLRequestRequest, GetSAMLRequestResponse: () => GetSAMLRequestResponse, PostResponse: () => PostResponse, RedirectResponse: () => RedirectResponse, SAMLServiceDefinition: () => SAMLServiceDefinition, Session: () => Session, protobufPackage: () => protobufPackage }); module.exports = __toCommonJS(saml_service_exports); var import_wire = require("@bufbuild/protobuf/wire"); var import_object = require("../../object/v2/object.js"); var import_authorization = require("./authorization.js"); const protobufPackage = "zitadel.saml.v2"; function createBaseGetSAMLRequestRequest() { return { samlRequestId: "" }; } const GetSAMLRequestRequest = { encode(message, writer = new import_wire.BinaryWriter()) { if (message.samlRequestId !== "") { writer.uint32(10).string(message.samlRequestId); } 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 = createBaseGetSAMLRequestRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.samlRequestId = reader.string(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { samlRequestId: isSet(object.samlRequestId) ? globalThis.String(object.samlRequestId) : "" }; }, toJSON(message) { const obj = {}; if (message.samlRequestId !== "") { obj.samlRequestId = message.samlRequestId; } return obj; }, create(base) { return GetSAMLRequestRequest.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseGetSAMLRequestRequest(); message.samlRequestId = object.samlRequestId ?? ""; return message; } }; function createBaseGetSAMLRequestResponse() { return { samlRequest: void 0 }; } const GetSAMLRequestResponse = { encode(message, writer = new import_wire.BinaryWriter()) { if (message.samlRequest !== void 0) { import_authorization.SAMLRequest.encode(message.samlRequest, writer.uint32(10).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 = createBaseGetSAMLRequestResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.samlRequest = import_authorization.SAMLRequest.decode(reader, reader.uint32()); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { samlRequest: isSet(object.samlRequest) ? import_authorization.SAMLRequest.fromJSON(object.samlRequest) : void 0 }; }, toJSON(message) { const obj = {}; if (message.samlRequest !== void 0) { obj.samlRequest = import_authorization.SAMLRequest.toJSON(message.samlRequest); } return obj; }, create(base) { return GetSAMLRequestResponse.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseGetSAMLRequestResponse(); message.samlRequest = object.samlRequest !== void 0 && object.samlRequest !== null ? import_authorization.SAMLRequest.fromPartial(object.samlRequest) : void 0; return message; } }; function createBaseCreateResponseRequest() { return { samlRequestId: "", session: void 0, error: void 0 }; } const CreateResponseRequest = { encode(message, writer = new import_wire.BinaryWriter()) { if (message.samlRequestId !== "") { writer.uint32(10).string(message.samlRequestId); } if (message.session !== void 0) { Session.encode(message.session, writer.uint32(18).fork()).join(); } if (message.error !== void 0) { import_authorization.AuthorizationError.encode(message.error, writer.uint32(26).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 = createBaseCreateResponseRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.samlRequestId = reader.string(); continue; } case 2: { if (tag !== 18) { break; } message.session = Session.decode(reader, reader.uint32()); continue; } case 3: { if (tag !== 26) { break; } message.error = import_authorization.AuthorizationError.decode(reader, reader.uint32()); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { samlRequestId: isSet(object.samlRequestId) ? globalThis.String(object.samlRequestId) : "", session: isSet(object.session) ? Session.fromJSON(object.session) : void 0, error: isSet(object.error) ? import_authorization.AuthorizationError.fromJSON(object.error) : void 0 }; }, toJSON(message) { const obj = {}; if (message.samlRequestId !== "") { obj.samlRequestId = message.samlRequestId; } if (message.session !== void 0) { obj.session = Session.toJSON(message.session); } if (message.error !== void 0) { obj.error = import_authorization.AuthorizationError.toJSON(message.error); } return obj; }, create(base) { return CreateResponseRequest.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseCreateResponseRequest(); message.samlRequestId = object.samlRequestId ?? ""; message.session = object.session !== void 0 && object.session !== null ? Session.fromPartial(object.session) : void 0; message.error = object.error !== void 0 && object.error !== null ? import_authorization.AuthorizationError.fromPartial(object.error) : void 0; return message; } }; function createBaseSession() { return { sessionId: "", sessionToken: "" }; } const Session = { encode(message, writer = new import_wire.BinaryWriter()) { if (message.sessionId !== "") { writer.uint32(10).string(message.sessionId); } if (message.sessionToken !== "") { writer.uint32(18).string(message.sessionToken); } 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 = createBaseSession(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.sessionId = reader.string(); continue; } case 2: { if (tag !== 18) { break; } message.sessionToken = reader.string(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { sessionId: isSet(object.sessionId) ? globalThis.String(object.sessionId) : "", sessionToken: isSet(object.sessionToken) ? globalThis.String(object.sessionToken) : "" }; }, toJSON(message) { const obj = {}; if (message.sessionId !== "") { obj.sessionId = message.sessionId; } if (message.sessionToken !== "") { obj.sessionToken = message.sessionToken; } return obj; }, create(base) { return Session.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseSession(); message.sessionId = object.sessionId ?? ""; message.sessionToken = object.sessionToken ?? ""; return message; } }; function createBaseCreateResponseResponse() { return { details: void 0, url: "", redirect: void 0, post: void 0 }; } const CreateResponseResponse = { encode(message, writer = new import_wire.BinaryWriter()) { if (message.details !== void 0) { import_object.Details.encode(message.details, writer.uint32(10).fork()).join(); } if (message.url !== "") { writer.uint32(18).string(message.url); } if (message.redirect !== void 0) { RedirectResponse.encode(message.redirect, writer.uint32(26).fork()).join(); } if (message.post !== void 0) { PostResponse.encode(message.post, 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 = createBaseCreateResponseResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.details = import_object.Details.decode(reader, reader.uint32()); continue; } case 2: { if (tag !== 18) { break; } message.url = reader.string(); continue; } case 3: { if (tag !== 26) { break; } message.redirect = RedirectResponse.decode(reader, reader.uint32()); continue; } case 4: { if (tag !== 34) { break; } message.post = PostResponse.decode(reader, reader.uint32()); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { details: isSet(object.details) ? import_object.Details.fromJSON(object.details) : void 0, url: isSet(object.url) ? globalThis.String(object.url) : "", redirect: isSet(object.redirect) ? RedirectResponse.fromJSON(object.redirect) : void 0, post: isSet(object.post) ? PostResponse.fromJSON(object.post) : void 0 }; }, toJSON(message) { const obj = {}; if (message.details !== void 0) { obj.details = import_object.Details.toJSON(message.details); } if (message.url !== "") { obj.url = message.url; } if (message.redirect !== void 0) { obj.redirect = RedirectResponse.toJSON(message.redirect); } if (message.post !== void 0) { obj.post = PostResponse.toJSON(message.post); } return obj; }, create(base) { return CreateResponseResponse.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseCreateResponseResponse(); message.details = object.details !== void 0 && object.details !== null ? import_object.Details.fromPartial(object.details) : void 0; message.url = object.url ?? ""; message.redirect = object.redirect !== void 0 && object.redirect !== null ? RedirectResponse.fromPartial(object.redirect) : void 0; message.post = object.post !== void 0 && object.post !== null ? PostResponse.fromPartial(object.post) : void 0; return message; } }; function createBaseRedirectResponse() { return {}; } const RedirectResponse = { 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 = createBaseRedirectResponse(); 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 RedirectResponse.fromPartial(base ?? {}); }, fromPartial(_) { const message = createBaseRedirectResponse(); return message; } }; function createBasePostResponse() { return { relayState: "", samlResponse: "" }; } const PostResponse = { encode(message, writer = new import_wire.BinaryWriter()) { if (message.relayState !== "") { writer.uint32(10).string(message.relayState); } if (message.samlResponse !== "") { writer.uint32(18).string(message.samlResponse); } 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 = createBasePostResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.relayState = reader.string(); continue; } case 2: { if (tag !== 18) { break; } message.samlResponse = reader.string(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { relayState: isSet(object.relayState) ? globalThis.String(object.relayState) : "", samlResponse: isSet(object.samlResponse) ? globalThis.String(object.samlResponse) : "" }; }, toJSON(message) { const obj = {}; if (message.relayState !== "") { obj.relayState = message.relayState; } if (message.samlResponse !== "") { obj.samlResponse = message.samlResponse; } return obj; }, create(base) { return PostResponse.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBasePostResponse(); message.relayState = object.relayState ?? ""; message.samlResponse = object.samlResponse ?? ""; return message; } }; const SAMLServiceDefinition = { name: "SAMLService", fullName: "zitadel.saml.v2.SAMLService", methods: { getSAMLRequest: { name: "GetSAMLRequest", requestType: GetSAMLRequestRequest, requestStream: false, responseType: GetSAMLRequestResponse, responseStream: false, options: { _unknownFields: { 8338: [ Buffer.from([ 141, 1, 18, 24, 71, 101, 116, 32, 83, 65, 77, 76, 32, 82, 101, 113, 117, 101, 115, 116, 32, 100, 101, 116, 97, 105, 108, 115, 26, 100, 71, 101, 116, 32, 83, 65, 77, 76, 32, 82, 101, 113, 117, 101, 115, 116, 32, 100, 101, 116, 97, 105, 108, 115, 32, 98, 121, 32, 73, 68, 46, 32, 82, 101, 116, 117, 114, 110, 115, 32, 100, 101, 116, 97, 105, 108, 115, 32, 116, 104, 97, 116, 32, 97, 114, 101, 32, 112, 97, 114, 115, 101, 100, 32, 102, 114, 111, 109, 32, 116, 104, 101, 32, 97, 112, 112, 108, 105, 99, 97, 116, 105, 111, 110, 39, 115, 32, 83, 65, 77, 76, 32, 82, 101, 113, 117, 101, 115, 116, 46, 74, 11, 10, 3, 50, 48, 48, 18, 4, 10, 2, 79, 75 ]) ], 400010: [Buffer.from([17, 10, 15, 10, 13, 97, 117, 116, 104, 101, 110, 116, 105, 99, 97, 116, 101, 100])], 578365826: [ Buffer.from([ 42, 18, 40, 47, 118, 50, 47, 115, 97, 109, 108, 47, 115, 97, 109, 108, 95, 114, 101, 113, 117, 101, 115, 116, 115, 47, 123, 115, 97, 109, 108, 95, 114, 101, 113, 117, 101, 115, 116, 95, 105, 100, 125 ]) ] } } }, createResponse: { name: "CreateResponse", requestType: CreateResponseRequest, requestStream: false, responseType: CreateResponseResponse, responseStream: false, options: { _unknownFields: { 8338: [ Buffer.from([ 145, 3, 18, 45, 70, 105, 110, 97, 108, 105, 122, 101, 32, 97, 32, 83, 65, 77, 76, 32, 82, 101, 113, 117, 101, 115, 116, 32, 97, 110, 100, 32, 103, 101, 116, 32, 116, 104, 101, 32, 114, 101, 115, 112, 111, 110, 115, 101, 46, 26, 210, 2, 70, 105, 110, 97, 108, 105, 122, 101, 32, 97, 32, 83, 65, 77, 76, 32, 82, 101, 113, 117, 101, 115, 116, 32, 97, 110, 100, 32, 103, 101, 116, 32, 116, 104, 101, 32, 114, 101, 115, 112, 111, 110, 115, 101, 32, 100, 101, 102, 105, 110, 105, 116, 105, 111, 110, 32, 102, 111, 114, 32, 115, 117, 99, 99, 101, 115, 115, 32, 111, 114, 32, 102, 97, 105, 108, 117, 114, 101, 46, 32, 84, 104, 101, 32, 114, 101, 115, 112, 111, 110, 115, 101, 32, 109, 117, 115, 116, 32, 98, 101, 32, 104, 97, 110, 100, 108, 101, 100, 32, 97, 115, 32, 112, 101, 114, 32, 116, 104, 101, 32, 83, 65, 77, 76, 32, 100, 101, 102, 105, 110, 105, 116, 105, 111, 110, 32, 116, 111, 32, 105, 110, 102, 111, 114, 109, 32, 116, 104, 101, 32, 97, 112, 112, 108, 105, 99, 97, 116, 105, 111, 110, 32, 97, 98, 111, 117, 116, 32, 116, 104, 101, 32, 115, 117, 99, 99, 101, 115, 115, 32, 111, 114, 32, 102, 97, 105, 108, 117, 114, 101, 46, 32, 79, 110, 32, 115, 117, 99, 99, 101, 115, 115, 44, 32, 116, 104, 101, 32, 114, 101, 115, 112, 111, 110, 115, 101, 32, 99, 111, 110, 116, 97, 105, 110, 115, 32, 100, 101, 116, 97, 105, 108, 115, 32, 102, 111, 114, 32, 116, 104, 101, 32, 97, 112, 112, 108, 105, 99, 97, 116, 105, 111, 110, 32, 116, 111, 32, 111, 98, 116, 97, 105, 110, 32, 116, 104, 101, 32, 83, 65, 77, 76, 82, 101, 115, 112, 111, 110, 115, 101, 46, 32, 84, 104, 105, 115, 32, 109, 101, 116, 104, 111, 100, 32, 99, 97, 110, 32, 111, 110, 108, 121, 32, 98, 101, 32, 99, 97, 108, 108, 101, 100, 32, 111, 110, 99, 101, 32, 102, 111, 114, 32, 97, 110, 32, 83, 65, 77, 76, 32, 114, 101, 113, 117, 101, 115, 116, 46, 74, 11, 10, 3, 50, 48, 48, 18, 4, 10, 2, 79, 75 ]) ], 400010: [Buffer.from([17, 10, 15, 10, 13, 97, 117, 116, 104, 101, 110, 116, 105, 99, 97, 116, 101, 100])], 578365826: [ Buffer.from([ 45, 58, 1, 42, 34, 40, 47, 118, 50, 47, 115, 97, 109, 108, 47, 115, 97, 109, 108, 95, 114, 101, 113, 117, 101, 115, 116, 115, 47, 123, 115, 97, 109, 108, 95, 114, 101, 113, 117, 101, 115, 116, 95, 105, 100, 125 ]) ] } } } } }; function isSet(value) { return value !== null && value !== void 0; } // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { CreateResponseRequest, CreateResponseResponse, GetSAMLRequestRequest, GetSAMLRequestResponse, PostResponse, RedirectResponse, SAMLServiceDefinition, Session, protobufPackage }); //# sourceMappingURL=saml_service.js.map