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

347 lines 11.5 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 telemetry_service_exports = {}; __export(telemetry_service_exports, { ReportBaseInformationRequest: () => ReportBaseInformationRequest, ReportBaseInformationResponse: () => ReportBaseInformationResponse, ReportResourceCountsRequest: () => ReportResourceCountsRequest, ReportResourceCountsResponse: () => ReportResourceCountsResponse, TelemetryServiceDefinition: () => TelemetryServiceDefinition, protobufPackage: () => protobufPackage }); module.exports = __toCommonJS(telemetry_service_exports); var import_wire = require("@bufbuild/protobuf/wire"); var import_telemetry = require("./telemetry.js"); const protobufPackage = "zitadel.analytics.v2beta"; function createBaseReportBaseInformationRequest() { return { systemId: "", version: "", instances: [] }; } const ReportBaseInformationRequest = { encode(message, writer = new import_wire.BinaryWriter()) { if (message.systemId !== "") { writer.uint32(10).string(message.systemId); } if (message.version !== "") { writer.uint32(18).string(message.version); } for (const v of message.instances) { import_telemetry.InstanceInformation.encode(v, 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 = createBaseReportBaseInformationRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.systemId = reader.string(); continue; } case 2: { if (tag !== 18) { break; } message.version = reader.string(); continue; } case 3: { if (tag !== 26) { break; } message.instances.push(import_telemetry.InstanceInformation.decode(reader, reader.uint32())); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { systemId: isSet(object.systemId) ? globalThis.String(object.systemId) : "", version: isSet(object.version) ? globalThis.String(object.version) : "", instances: globalThis.Array.isArray(object?.instances) ? object.instances.map((e) => import_telemetry.InstanceInformation.fromJSON(e)) : [] }; }, toJSON(message) { const obj = {}; if (message.systemId !== "") { obj.systemId = message.systemId; } if (message.version !== "") { obj.version = message.version; } if (message.instances?.length) { obj.instances = message.instances.map((e) => import_telemetry.InstanceInformation.toJSON(e)); } return obj; }, create(base) { return ReportBaseInformationRequest.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseReportBaseInformationRequest(); message.systemId = object.systemId ?? ""; message.version = object.version ?? ""; message.instances = object.instances?.map((e) => import_telemetry.InstanceInformation.fromPartial(e)) || []; return message; } }; function createBaseReportBaseInformationResponse() { return { reportId: "" }; } const ReportBaseInformationResponse = { encode(message, writer = new import_wire.BinaryWriter()) { if (message.reportId !== "") { writer.uint32(10).string(message.reportId); } 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 = createBaseReportBaseInformationResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.reportId = reader.string(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { reportId: isSet(object.reportId) ? globalThis.String(object.reportId) : "" }; }, toJSON(message) { const obj = {}; if (message.reportId !== "") { obj.reportId = message.reportId; } return obj; }, create(base) { return ReportBaseInformationResponse.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseReportBaseInformationResponse(); message.reportId = object.reportId ?? ""; return message; } }; function createBaseReportResourceCountsRequest() { return { systemId: "", reportId: void 0, resourceCounts: [] }; } const ReportResourceCountsRequest = { encode(message, writer = new import_wire.BinaryWriter()) { if (message.systemId !== "") { writer.uint32(10).string(message.systemId); } if (message.reportId !== void 0) { writer.uint32(18).string(message.reportId); } for (const v of message.resourceCounts) { import_telemetry.ResourceCount.encode(v, 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 = createBaseReportResourceCountsRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.systemId = reader.string(); continue; } case 2: { if (tag !== 18) { break; } message.reportId = reader.string(); continue; } case 3: { if (tag !== 26) { break; } message.resourceCounts.push(import_telemetry.ResourceCount.decode(reader, reader.uint32())); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { systemId: isSet(object.systemId) ? globalThis.String(object.systemId) : "", reportId: isSet(object.reportId) ? globalThis.String(object.reportId) : void 0, resourceCounts: globalThis.Array.isArray(object?.resourceCounts) ? object.resourceCounts.map((e) => import_telemetry.ResourceCount.fromJSON(e)) : [] }; }, toJSON(message) { const obj = {}; if (message.systemId !== "") { obj.systemId = message.systemId; } if (message.reportId !== void 0) { obj.reportId = message.reportId; } if (message.resourceCounts?.length) { obj.resourceCounts = message.resourceCounts.map((e) => import_telemetry.ResourceCount.toJSON(e)); } return obj; }, create(base) { return ReportResourceCountsRequest.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseReportResourceCountsRequest(); message.systemId = object.systemId ?? ""; message.reportId = object.reportId ?? void 0; message.resourceCounts = object.resourceCounts?.map((e) => import_telemetry.ResourceCount.fromPartial(e)) || []; return message; } }; function createBaseReportResourceCountsResponse() { return { reportId: "" }; } const ReportResourceCountsResponse = { encode(message, writer = new import_wire.BinaryWriter()) { if (message.reportId !== "") { writer.uint32(10).string(message.reportId); } 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 = createBaseReportResourceCountsResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.reportId = reader.string(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { reportId: isSet(object.reportId) ? globalThis.String(object.reportId) : "" }; }, toJSON(message) { const obj = {}; if (message.reportId !== "") { obj.reportId = message.reportId; } return obj; }, create(base) { return ReportResourceCountsResponse.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseReportResourceCountsResponse(); message.reportId = object.reportId ?? ""; return message; } }; const TelemetryServiceDefinition = { name: "TelemetryService", fullName: "zitadel.analytics.v2beta.TelemetryService", methods: { /** * ReportBaseInformation is used to report the base information of the ZITADEL system, * including the version, instances, their creation date and domains. * The response contains a report ID to link it to the resource counts or other reports. * The report ID is only valid for the same system ID. */ reportBaseInformation: { name: "ReportBaseInformation", requestType: ReportBaseInformationRequest, requestStream: false, responseType: ReportBaseInformationResponse, responseStream: false, options: {} }, /** * ReportResourceCounts is used to report the resource counts such as amount of organizations * or users per organization and much more. * Since the resource counts can be reported in multiple batches, * the response contains a report ID to continue reporting. * The report ID is only valid for the same system ID. */ reportResourceCounts: { name: "ReportResourceCounts", requestType: ReportResourceCountsRequest, requestStream: false, responseType: ReportResourceCountsResponse, responseStream: false, options: {} } } }; function isSet(value) { return value !== null && value !== void 0; } // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { ReportBaseInformationRequest, ReportBaseInformationResponse, ReportResourceCountsRequest, ReportResourceCountsResponse, TelemetryServiceDefinition, protobufPackage }); //# sourceMappingURL=telemetry_service.js.map