@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()!
517 lines • 17 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 user_exports = {};
__export(user_exports, {
CreateUser: () => CreateUser,
GetSchema: () => GetSchema,
GetUser: () => GetUser,
PatchUser: () => PatchUser,
State: () => State,
protobufPackage: () => protobufPackage,
stateFromJSON: () => stateFromJSON,
stateToJSON: () => stateToJSON
});
module.exports = __toCommonJS(user_exports);
var import_wire = require("@bufbuild/protobuf/wire");
var import_struct = require("../../../../google/protobuf/struct.js");
var import_object = require("../../object/v3alpha/object.js");
var import_authenticator = require("./authenticator.js");
var import_communication = require("./communication.js");
const protobufPackage = "zitadel.resources.user.v3alpha";
var State = /* @__PURE__ */ ((State2) => {
State2[State2["USER_STATE_UNSPECIFIED"] = 0] = "USER_STATE_UNSPECIFIED";
State2[State2["USER_STATE_ACTIVE"] = 1] = "USER_STATE_ACTIVE";
State2[State2["USER_STATE_INACTIVE"] = 2] = "USER_STATE_INACTIVE";
State2[State2["USER_STATE_DELETED"] = 3] = "USER_STATE_DELETED";
State2[State2["USER_STATE_LOCKED"] = 4] = "USER_STATE_LOCKED";
State2[State2["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
return State2;
})(State || {});
function stateFromJSON(object) {
switch (object) {
case 0:
case "USER_STATE_UNSPECIFIED":
return 0 /* USER_STATE_UNSPECIFIED */;
case 1:
case "USER_STATE_ACTIVE":
return 1 /* USER_STATE_ACTIVE */;
case 2:
case "USER_STATE_INACTIVE":
return 2 /* USER_STATE_INACTIVE */;
case 3:
case "USER_STATE_DELETED":
return 3 /* USER_STATE_DELETED */;
case 4:
case "USER_STATE_LOCKED":
return 4 /* USER_STATE_LOCKED */;
case -1:
case "UNRECOGNIZED":
default:
return -1 /* UNRECOGNIZED */;
}
}
function stateToJSON(object) {
switch (object) {
case 0 /* USER_STATE_UNSPECIFIED */:
return "USER_STATE_UNSPECIFIED";
case 1 /* USER_STATE_ACTIVE */:
return "USER_STATE_ACTIVE";
case 2 /* USER_STATE_INACTIVE */:
return "USER_STATE_INACTIVE";
case 3 /* USER_STATE_DELETED */:
return "USER_STATE_DELETED";
case 4 /* USER_STATE_LOCKED */:
return "USER_STATE_LOCKED";
case -1 /* UNRECOGNIZED */:
default:
return "UNRECOGNIZED";
}
}
function createBaseCreateUser() {
return { schemaId: "", data: void 0, contact: void 0, authenticators: void 0, userId: void 0 };
}
const CreateUser = {
encode(message, writer = new import_wire.BinaryWriter()) {
if (message.schemaId !== "") {
writer.uint32(10).string(message.schemaId);
}
if (message.data !== void 0) {
import_struct.Struct.encode(import_struct.Struct.wrap(message.data), writer.uint32(18).fork()).join();
}
if (message.contact !== void 0) {
import_communication.SetContact.encode(message.contact, writer.uint32(26).fork()).join();
}
if (message.authenticators !== void 0) {
import_authenticator.SetAuthenticators.encode(message.authenticators, writer.uint32(34).fork()).join();
}
if (message.userId !== void 0) {
writer.uint32(42).string(message.userId);
}
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 = createBaseCreateUser();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.schemaId = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.data = import_struct.Struct.unwrap(import_struct.Struct.decode(reader, reader.uint32()));
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.contact = import_communication.SetContact.decode(reader, reader.uint32());
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.authenticators = import_authenticator.SetAuthenticators.decode(reader, reader.uint32());
continue;
}
case 5: {
if (tag !== 42) {
break;
}
message.userId = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
schemaId: isSet(object.schemaId) ? globalThis.String(object.schemaId) : "",
data: isObject(object.data) ? object.data : void 0,
contact: isSet(object.contact) ? import_communication.SetContact.fromJSON(object.contact) : void 0,
authenticators: isSet(object.authenticators) ? import_authenticator.SetAuthenticators.fromJSON(object.authenticators) : void 0,
userId: isSet(object.userId) ? globalThis.String(object.userId) : void 0
};
},
toJSON(message) {
const obj = {};
if (message.schemaId !== "") {
obj.schemaId = message.schemaId;
}
if (message.data !== void 0) {
obj.data = message.data;
}
if (message.contact !== void 0) {
obj.contact = import_communication.SetContact.toJSON(message.contact);
}
if (message.authenticators !== void 0) {
obj.authenticators = import_authenticator.SetAuthenticators.toJSON(message.authenticators);
}
if (message.userId !== void 0) {
obj.userId = message.userId;
}
return obj;
},
create(base) {
return CreateUser.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseCreateUser();
message.schemaId = object.schemaId ?? "";
message.data = object.data ?? void 0;
message.contact = object.contact !== void 0 && object.contact !== null ? import_communication.SetContact.fromPartial(object.contact) : void 0;
message.authenticators = object.authenticators !== void 0 && object.authenticators !== null ? import_authenticator.SetAuthenticators.fromPartial(object.authenticators) : void 0;
message.userId = object.userId ?? void 0;
return message;
}
};
function createBasePatchUser() {
return { schemaId: void 0, data: void 0, contact: void 0 };
}
const PatchUser = {
encode(message, writer = new import_wire.BinaryWriter()) {
if (message.schemaId !== void 0) {
writer.uint32(10).string(message.schemaId);
}
if (message.data !== void 0) {
import_struct.Struct.encode(import_struct.Struct.wrap(message.data), writer.uint32(18).fork()).join();
}
if (message.contact !== void 0) {
import_communication.SetContact.encode(message.contact, 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 = createBasePatchUser();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.schemaId = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.data = import_struct.Struct.unwrap(import_struct.Struct.decode(reader, reader.uint32()));
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.contact = import_communication.SetContact.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
schemaId: isSet(object.schemaId) ? globalThis.String(object.schemaId) : void 0,
data: isObject(object.data) ? object.data : void 0,
contact: isSet(object.contact) ? import_communication.SetContact.fromJSON(object.contact) : void 0
};
},
toJSON(message) {
const obj = {};
if (message.schemaId !== void 0) {
obj.schemaId = message.schemaId;
}
if (message.data !== void 0) {
obj.data = message.data;
}
if (message.contact !== void 0) {
obj.contact = import_communication.SetContact.toJSON(message.contact);
}
return obj;
},
create(base) {
return PatchUser.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBasePatchUser();
message.schemaId = object.schemaId ?? void 0;
message.data = object.data ?? void 0;
message.contact = object.contact !== void 0 && object.contact !== null ? import_communication.SetContact.fromPartial(object.contact) : void 0;
return message;
}
};
function createBaseGetUser() {
return {
details: void 0,
schema: void 0,
data: void 0,
contact: void 0,
authenticators: void 0,
state: 0
};
}
const GetUser = {
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.schema !== void 0) {
GetSchema.encode(message.schema, writer.uint32(18).fork()).join();
}
if (message.data !== void 0) {
import_struct.Struct.encode(import_struct.Struct.wrap(message.data), writer.uint32(26).fork()).join();
}
if (message.contact !== void 0) {
import_communication.Contact.encode(message.contact, writer.uint32(34).fork()).join();
}
if (message.authenticators !== void 0) {
import_authenticator.Authenticators.encode(message.authenticators, writer.uint32(42).fork()).join();
}
if (message.state !== 0) {
writer.uint32(48).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 = createBaseGetUser();
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.schema = GetSchema.decode(reader, reader.uint32());
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.data = import_struct.Struct.unwrap(import_struct.Struct.decode(reader, reader.uint32()));
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.contact = import_communication.Contact.decode(reader, reader.uint32());
continue;
}
case 5: {
if (tag !== 42) {
break;
}
message.authenticators = import_authenticator.Authenticators.decode(reader, reader.uint32());
continue;
}
case 6: {
if (tag !== 48) {
break;
}
message.state = reader.int32();
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,
schema: isSet(object.schema) ? GetSchema.fromJSON(object.schema) : void 0,
data: isObject(object.data) ? object.data : void 0,
contact: isSet(object.contact) ? import_communication.Contact.fromJSON(object.contact) : void 0,
authenticators: isSet(object.authenticators) ? import_authenticator.Authenticators.fromJSON(object.authenticators) : void 0,
state: isSet(object.state) ? stateFromJSON(object.state) : 0
};
},
toJSON(message) {
const obj = {};
if (message.details !== void 0) {
obj.details = import_object.Details.toJSON(message.details);
}
if (message.schema !== void 0) {
obj.schema = GetSchema.toJSON(message.schema);
}
if (message.data !== void 0) {
obj.data = message.data;
}
if (message.contact !== void 0) {
obj.contact = import_communication.Contact.toJSON(message.contact);
}
if (message.authenticators !== void 0) {
obj.authenticators = import_authenticator.Authenticators.toJSON(message.authenticators);
}
if (message.state !== 0) {
obj.state = stateToJSON(message.state);
}
return obj;
},
create(base) {
return GetUser.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseGetUser();
message.details = object.details !== void 0 && object.details !== null ? import_object.Details.fromPartial(object.details) : void 0;
message.schema = object.schema !== void 0 && object.schema !== null ? GetSchema.fromPartial(object.schema) : void 0;
message.data = object.data ?? void 0;
message.contact = object.contact !== void 0 && object.contact !== null ? import_communication.Contact.fromPartial(object.contact) : void 0;
message.authenticators = object.authenticators !== void 0 && object.authenticators !== null ? import_authenticator.Authenticators.fromPartial(object.authenticators) : void 0;
message.state = object.state ?? 0;
return message;
}
};
function createBaseGetSchema() {
return { id: "", type: "", revision: 0 };
}
const GetSchema = {
encode(message, writer = new import_wire.BinaryWriter()) {
if (message.id !== "") {
writer.uint32(10).string(message.id);
}
if (message.type !== "") {
writer.uint32(18).string(message.type);
}
if (message.revision !== 0) {
writer.uint32(24).uint32(message.revision);
}
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 = createBaseGetSchema();
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.type = reader.string();
continue;
}
case 3: {
if (tag !== 24) {
break;
}
message.revision = 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) : "",
type: isSet(object.type) ? globalThis.String(object.type) : "",
revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0
};
},
toJSON(message) {
const obj = {};
if (message.id !== "") {
obj.id = message.id;
}
if (message.type !== "") {
obj.type = message.type;
}
if (message.revision !== 0) {
obj.revision = Math.round(message.revision);
}
return obj;
},
create(base) {
return GetSchema.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseGetSchema();
message.id = object.id ?? "";
message.type = object.type ?? "";
message.revision = object.revision ?? 0;
return message;
}
};
function isObject(value) {
return typeof value === "object" && value !== null;
}
function isSet(value) {
return value !== null && value !== void 0;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
CreateUser,
GetSchema,
GetUser,
PatchUser,
State,
protobufPackage,
stateFromJSON,
stateToJSON
});
//# sourceMappingURL=user.js.map