@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,339 lines • 429 kB
JavaScript
"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 user_service_exports = {};
__export(user_service_exports, {
AddHumanUserRequest: () => AddHumanUserRequest,
AddHumanUserResponse: () => AddHumanUserResponse,
AddIDPLinkRequest: () => AddIDPLinkRequest,
AddIDPLinkResponse: () => AddIDPLinkResponse,
AddKeyRequest: () => AddKeyRequest,
AddKeyResponse: () => AddKeyResponse,
AddOTPEmailRequest: () => AddOTPEmailRequest,
AddOTPEmailResponse: () => AddOTPEmailResponse,
AddOTPSMSRequest: () => AddOTPSMSRequest,
AddOTPSMSResponse: () => AddOTPSMSResponse,
AddPersonalAccessTokenRequest: () => AddPersonalAccessTokenRequest,
AddPersonalAccessTokenResponse: () => AddPersonalAccessTokenResponse,
AddSecretRequest: () => AddSecretRequest,
AddSecretResponse: () => AddSecretResponse,
AuthFactors: () => AuthFactors,
AuthenticationMethodType: () => AuthenticationMethodType,
CreateInviteCodeRequest: () => CreateInviteCodeRequest,
CreateInviteCodeResponse: () => CreateInviteCodeResponse,
CreatePasskeyRegistrationLinkRequest: () => CreatePasskeyRegistrationLinkRequest,
CreatePasskeyRegistrationLinkResponse: () => CreatePasskeyRegistrationLinkResponse,
CreateUserRequest: () => CreateUserRequest,
CreateUserRequest_Human: () => CreateUserRequest_Human,
CreateUserRequest_Machine: () => CreateUserRequest_Machine,
CreateUserResponse: () => CreateUserResponse,
DeactivateUserRequest: () => DeactivateUserRequest,
DeactivateUserResponse: () => DeactivateUserResponse,
DeleteUserMetadataRequest: () => DeleteUserMetadataRequest,
DeleteUserMetadataResponse: () => DeleteUserMetadataResponse,
DeleteUserRequest: () => DeleteUserRequest,
DeleteUserResponse: () => DeleteUserResponse,
DomainQuery: () => DomainQuery,
GetUserByIDRequest: () => GetUserByIDRequest,
GetUserByIDResponse: () => GetUserByIDResponse,
HumanMFAInitSkippedRequest: () => HumanMFAInitSkippedRequest,
HumanMFAInitSkippedResponse: () => HumanMFAInitSkippedResponse,
ListAuthenticationFactorsRequest: () => ListAuthenticationFactorsRequest,
ListAuthenticationFactorsResponse: () => ListAuthenticationFactorsResponse,
ListAuthenticationMethodTypesRequest: () => ListAuthenticationMethodTypesRequest,
ListAuthenticationMethodTypesResponse: () => ListAuthenticationMethodTypesResponse,
ListIDPLinksRequest: () => ListIDPLinksRequest,
ListIDPLinksResponse: () => ListIDPLinksResponse,
ListKeysRequest: () => ListKeysRequest,
ListKeysResponse: () => ListKeysResponse,
ListPasskeysRequest: () => ListPasskeysRequest,
ListPasskeysResponse: () => ListPasskeysResponse,
ListPersonalAccessTokensRequest: () => ListPersonalAccessTokensRequest,
ListPersonalAccessTokensResponse: () => ListPersonalAccessTokensResponse,
ListUserMetadataRequest: () => ListUserMetadataRequest,
ListUserMetadataResponse: () => ListUserMetadataResponse,
ListUsersRequest: () => ListUsersRequest,
ListUsersResponse: () => ListUsersResponse,
LockUserRequest: () => LockUserRequest,
LockUserResponse: () => LockUserResponse,
Metadata: () => Metadata,
PasswordResetRequest: () => PasswordResetRequest,
PasswordResetResponse: () => PasswordResetResponse,
ReactivateUserRequest: () => ReactivateUserRequest,
ReactivateUserResponse: () => ReactivateUserResponse,
RegisterPasskeyRequest: () => RegisterPasskeyRequest,
RegisterPasskeyResponse: () => RegisterPasskeyResponse,
RegisterTOTPRequest: () => RegisterTOTPRequest,
RegisterTOTPResponse: () => RegisterTOTPResponse,
RegisterU2FRequest: () => RegisterU2FRequest,
RegisterU2FResponse: () => RegisterU2FResponse,
RemoveIDPLinkRequest: () => RemoveIDPLinkRequest,
RemoveIDPLinkResponse: () => RemoveIDPLinkResponse,
RemoveKeyRequest: () => RemoveKeyRequest,
RemoveKeyResponse: () => RemoveKeyResponse,
RemoveOTPEmailRequest: () => RemoveOTPEmailRequest,
RemoveOTPEmailResponse: () => RemoveOTPEmailResponse,
RemoveOTPSMSRequest: () => RemoveOTPSMSRequest,
RemoveOTPSMSResponse: () => RemoveOTPSMSResponse,
RemovePasskeyRequest: () => RemovePasskeyRequest,
RemovePasskeyResponse: () => RemovePasskeyResponse,
RemovePersonalAccessTokenRequest: () => RemovePersonalAccessTokenRequest,
RemovePersonalAccessTokenResponse: () => RemovePersonalAccessTokenResponse,
RemovePhoneRequest: () => RemovePhoneRequest,
RemovePhoneResponse: () => RemovePhoneResponse,
RemoveSecretRequest: () => RemoveSecretRequest,
RemoveSecretResponse: () => RemoveSecretResponse,
RemoveTOTPRequest: () => RemoveTOTPRequest,
RemoveTOTPResponse: () => RemoveTOTPResponse,
RemoveU2FRequest: () => RemoveU2FRequest,
RemoveU2FResponse: () => RemoveU2FResponse,
ResendEmailCodeRequest: () => ResendEmailCodeRequest,
ResendEmailCodeResponse: () => ResendEmailCodeResponse,
ResendInviteCodeRequest: () => ResendInviteCodeRequest,
ResendInviteCodeResponse: () => ResendInviteCodeResponse,
ResendPhoneCodeRequest: () => ResendPhoneCodeRequest,
ResendPhoneCodeResponse: () => ResendPhoneCodeResponse,
RetrieveIdentityProviderIntentRequest: () => RetrieveIdentityProviderIntentRequest,
RetrieveIdentityProviderIntentResponse: () => RetrieveIdentityProviderIntentResponse,
SendEmailCodeRequest: () => SendEmailCodeRequest,
SendEmailCodeResponse: () => SendEmailCodeResponse,
SetEmailRequest: () => SetEmailRequest,
SetEmailResponse: () => SetEmailResponse,
SetPasswordRequest: () => SetPasswordRequest,
SetPasswordResponse: () => SetPasswordResponse,
SetPhoneRequest: () => SetPhoneRequest,
SetPhoneResponse: () => SetPhoneResponse,
SetUserMetadataRequest: () => SetUserMetadataRequest,
SetUserMetadataResponse: () => SetUserMetadataResponse,
StartIdentityProviderIntentRequest: () => StartIdentityProviderIntentRequest,
StartIdentityProviderIntentResponse: () => StartIdentityProviderIntentResponse,
UnlockUserRequest: () => UnlockUserRequest,
UnlockUserResponse: () => UnlockUserResponse,
UpdateHumanUserRequest: () => UpdateHumanUserRequest,
UpdateHumanUserResponse: () => UpdateHumanUserResponse,
UpdateUserRequest: () => UpdateUserRequest,
UpdateUserRequest_Human: () => UpdateUserRequest_Human,
UpdateUserRequest_Human_Profile: () => UpdateUserRequest_Human_Profile,
UpdateUserRequest_Machine: () => UpdateUserRequest_Machine,
UpdateUserResponse: () => UpdateUserResponse,
UserServiceDefinition: () => UserServiceDefinition,
VerifyEmailRequest: () => VerifyEmailRequest,
VerifyEmailResponse: () => VerifyEmailResponse,
VerifyInviteCodeRequest: () => VerifyInviteCodeRequest,
VerifyInviteCodeResponse: () => VerifyInviteCodeResponse,
VerifyPasskeyRegistrationRequest: () => VerifyPasskeyRegistrationRequest,
VerifyPasskeyRegistrationResponse: () => VerifyPasskeyRegistrationResponse,
VerifyPhoneRequest: () => VerifyPhoneRequest,
VerifyPhoneResponse: () => VerifyPhoneResponse,
VerifyTOTPRegistrationRequest: () => VerifyTOTPRegistrationRequest,
VerifyTOTPRegistrationResponse: () => VerifyTOTPRegistrationResponse,
VerifyU2FRegistrationRequest: () => VerifyU2FRegistrationRequest,
VerifyU2FRegistrationResponse: () => VerifyU2FRegistrationResponse,
authFactorsFromJSON: () => authFactorsFromJSON,
authFactorsToJSON: () => authFactorsToJSON,
authenticationMethodTypeFromJSON: () => authenticationMethodTypeFromJSON,
authenticationMethodTypeToJSON: () => authenticationMethodTypeToJSON,
protobufPackage: () => protobufPackage
});
module.exports = __toCommonJS(user_service_exports);
var import_wire = require("@bufbuild/protobuf/wire");
var import_long = __toESM(require("long"));
var import_struct = require("../../../google/protobuf/struct.js");
var import_timestamp = require("../../../google/protobuf/timestamp.js");
var import_filter = require("../../filter/v2/filter.js");
var import_metadata = require("../../metadata/v2/metadata.js");
var import_object = require("../../object/v2/object.js");
var import_auth = require("./auth.js");
var import_email = require("./email.js");
var import_idp = require("./idp.js");
var import_key = require("./key.js");
var import_password = require("./password.js");
var import_pat = require("./pat.js");
var import_phone = require("./phone.js");
var import_query = require("./query.js");
var import_user = require("./user.js");
const protobufPackage = "zitadel.user.v2";
var AuthenticationMethodType = /* @__PURE__ */ ((AuthenticationMethodType2) => {
AuthenticationMethodType2[AuthenticationMethodType2["AUTHENTICATION_METHOD_TYPE_UNSPECIFIED"] = 0] = "AUTHENTICATION_METHOD_TYPE_UNSPECIFIED";
AuthenticationMethodType2[AuthenticationMethodType2["AUTHENTICATION_METHOD_TYPE_PASSWORD"] = 1] = "AUTHENTICATION_METHOD_TYPE_PASSWORD";
AuthenticationMethodType2[AuthenticationMethodType2["AUTHENTICATION_METHOD_TYPE_PASSKEY"] = 2] = "AUTHENTICATION_METHOD_TYPE_PASSKEY";
AuthenticationMethodType2[AuthenticationMethodType2["AUTHENTICATION_METHOD_TYPE_IDP"] = 3] = "AUTHENTICATION_METHOD_TYPE_IDP";
AuthenticationMethodType2[AuthenticationMethodType2["AUTHENTICATION_METHOD_TYPE_TOTP"] = 4] = "AUTHENTICATION_METHOD_TYPE_TOTP";
AuthenticationMethodType2[AuthenticationMethodType2["AUTHENTICATION_METHOD_TYPE_U2F"] = 5] = "AUTHENTICATION_METHOD_TYPE_U2F";
AuthenticationMethodType2[AuthenticationMethodType2["AUTHENTICATION_METHOD_TYPE_OTP_SMS"] = 6] = "AUTHENTICATION_METHOD_TYPE_OTP_SMS";
AuthenticationMethodType2[AuthenticationMethodType2["AUTHENTICATION_METHOD_TYPE_OTP_EMAIL"] = 7] = "AUTHENTICATION_METHOD_TYPE_OTP_EMAIL";
AuthenticationMethodType2[AuthenticationMethodType2["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
return AuthenticationMethodType2;
})(AuthenticationMethodType || {});
function authenticationMethodTypeFromJSON(object) {
switch (object) {
case 0:
case "AUTHENTICATION_METHOD_TYPE_UNSPECIFIED":
return 0 /* AUTHENTICATION_METHOD_TYPE_UNSPECIFIED */;
case 1:
case "AUTHENTICATION_METHOD_TYPE_PASSWORD":
return 1 /* AUTHENTICATION_METHOD_TYPE_PASSWORD */;
case 2:
case "AUTHENTICATION_METHOD_TYPE_PASSKEY":
return 2 /* AUTHENTICATION_METHOD_TYPE_PASSKEY */;
case 3:
case "AUTHENTICATION_METHOD_TYPE_IDP":
return 3 /* AUTHENTICATION_METHOD_TYPE_IDP */;
case 4:
case "AUTHENTICATION_METHOD_TYPE_TOTP":
return 4 /* AUTHENTICATION_METHOD_TYPE_TOTP */;
case 5:
case "AUTHENTICATION_METHOD_TYPE_U2F":
return 5 /* AUTHENTICATION_METHOD_TYPE_U2F */;
case 6:
case "AUTHENTICATION_METHOD_TYPE_OTP_SMS":
return 6 /* AUTHENTICATION_METHOD_TYPE_OTP_SMS */;
case 7:
case "AUTHENTICATION_METHOD_TYPE_OTP_EMAIL":
return 7 /* AUTHENTICATION_METHOD_TYPE_OTP_EMAIL */;
case -1:
case "UNRECOGNIZED":
default:
return -1 /* UNRECOGNIZED */;
}
}
function authenticationMethodTypeToJSON(object) {
switch (object) {
case 0 /* AUTHENTICATION_METHOD_TYPE_UNSPECIFIED */:
return "AUTHENTICATION_METHOD_TYPE_UNSPECIFIED";
case 1 /* AUTHENTICATION_METHOD_TYPE_PASSWORD */:
return "AUTHENTICATION_METHOD_TYPE_PASSWORD";
case 2 /* AUTHENTICATION_METHOD_TYPE_PASSKEY */:
return "AUTHENTICATION_METHOD_TYPE_PASSKEY";
case 3 /* AUTHENTICATION_METHOD_TYPE_IDP */:
return "AUTHENTICATION_METHOD_TYPE_IDP";
case 4 /* AUTHENTICATION_METHOD_TYPE_TOTP */:
return "AUTHENTICATION_METHOD_TYPE_TOTP";
case 5 /* AUTHENTICATION_METHOD_TYPE_U2F */:
return "AUTHENTICATION_METHOD_TYPE_U2F";
case 6 /* AUTHENTICATION_METHOD_TYPE_OTP_SMS */:
return "AUTHENTICATION_METHOD_TYPE_OTP_SMS";
case 7 /* AUTHENTICATION_METHOD_TYPE_OTP_EMAIL */:
return "AUTHENTICATION_METHOD_TYPE_OTP_EMAIL";
case -1 /* UNRECOGNIZED */:
default:
return "UNRECOGNIZED";
}
}
var AuthFactors = /* @__PURE__ */ ((AuthFactors2) => {
AuthFactors2[AuthFactors2["OTP"] = 0] = "OTP";
AuthFactors2[AuthFactors2["OTP_SMS"] = 1] = "OTP_SMS";
AuthFactors2[AuthFactors2["OTP_EMAIL"] = 2] = "OTP_EMAIL";
AuthFactors2[AuthFactors2["U2F"] = 3] = "U2F";
AuthFactors2[AuthFactors2["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
return AuthFactors2;
})(AuthFactors || {});
function authFactorsFromJSON(object) {
switch (object) {
case 0:
case "OTP":
return 0 /* OTP */;
case 1:
case "OTP_SMS":
return 1 /* OTP_SMS */;
case 2:
case "OTP_EMAIL":
return 2 /* OTP_EMAIL */;
case 3:
case "U2F":
return 3 /* U2F */;
case -1:
case "UNRECOGNIZED":
default:
return -1 /* UNRECOGNIZED */;
}
}
function authFactorsToJSON(object) {
switch (object) {
case 0 /* OTP */:
return "OTP";
case 1 /* OTP_SMS */:
return "OTP_SMS";
case 2 /* OTP_EMAIL */:
return "OTP_EMAIL";
case 3 /* U2F */:
return "U2F";
case -1 /* UNRECOGNIZED */:
default:
return "UNRECOGNIZED";
}
}
function createBaseAddHumanUserRequest() {
return {
userId: void 0,
username: void 0,
organization: void 0,
profile: void 0,
email: void 0,
phone: void 0,
metadata: [],
password: void 0,
hashedPassword: void 0,
idpLinks: [],
totpSecret: void 0
};
}
const AddHumanUserRequest = {
encode(message, writer = new import_wire.BinaryWriter()) {
if (message.userId !== void 0) {
writer.uint32(10).string(message.userId);
}
if (message.username !== void 0) {
writer.uint32(18).string(message.username);
}
if (message.organization !== void 0) {
import_object.Organization.encode(message.organization, writer.uint32(90).fork()).join();
}
if (message.profile !== void 0) {
import_user.SetHumanProfile.encode(message.profile, writer.uint32(34).fork()).join();
}
if (message.email !== void 0) {
import_email.SetHumanEmail.encode(message.email, writer.uint32(42).fork()).join();
}
if (message.phone !== void 0) {
import_phone.SetHumanPhone.encode(message.phone, writer.uint32(82).fork()).join();
}
for (const v of message.metadata) {
import_user.SetMetadataEntry.encode(v, writer.uint32(50).fork()).join();
}
if (message.password !== void 0) {
import_password.Password.encode(message.password, writer.uint32(58).fork()).join();
}
if (message.hashedPassword !== void 0) {
import_password.HashedPassword.encode(message.hashedPassword, writer.uint32(66).fork()).join();
}
for (const v of message.idpLinks) {
import_idp.IDPLink.encode(v, writer.uint32(74).fork()).join();
}
if (message.totpSecret !== void 0) {
writer.uint32(98).string(message.totpSecret);
}
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 = createBaseAddHumanUserRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.userId = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.username = reader.string();
continue;
}
case 11: {
if (tag !== 90) {
break;
}
message.organization = import_object.Organization.decode(reader, reader.uint32());
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.profile = import_user.SetHumanProfile.decode(reader, reader.uint32());
continue;
}
case 5: {
if (tag !== 42) {
break;
}
message.email = import_email.SetHumanEmail.decode(reader, reader.uint32());
continue;
}
case 10: {
if (tag !== 82) {
break;
}
message.phone = import_phone.SetHumanPhone.decode(reader, reader.uint32());
continue;
}
case 6: {
if (tag !== 50) {
break;
}
message.metadata.push(import_user.SetMetadataEntry.decode(reader, reader.uint32()));
continue;
}
case 7: {
if (tag !== 58) {
break;
}
message.password = import_password.Password.decode(reader, reader.uint32());
continue;
}
case 8: {
if (tag !== 66) {
break;
}
message.hashedPassword = import_password.HashedPassword.decode(reader, reader.uint32());
continue;
}
case 9: {
if (tag !== 74) {
break;
}
message.idpLinks.push(import_idp.IDPLink.decode(reader, reader.uint32()));
continue;
}
case 12: {
if (tag !== 98) {
break;
}
message.totpSecret = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
userId: isSet(object.userId) ? globalThis.String(object.userId) : void 0,
username: isSet(object.username) ? globalThis.String(object.username) : void 0,
organization: isSet(object.organization) ? import_object.Organization.fromJSON(object.organization) : void 0,
profile: isSet(object.profile) ? import_user.SetHumanProfile.fromJSON(object.profile) : void 0,
email: isSet(object.email) ? import_email.SetHumanEmail.fromJSON(object.email) : void 0,
phone: isSet(object.phone) ? import_phone.SetHumanPhone.fromJSON(object.phone) : void 0,
metadata: globalThis.Array.isArray(object?.metadata) ? object.metadata.map((e) => import_user.SetMetadataEntry.fromJSON(e)) : [],
password: isSet(object.password) ? import_password.Password.fromJSON(object.password) : void 0,
hashedPassword: isSet(object.hashedPassword) ? import_password.HashedPassword.fromJSON(object.hashedPassword) : void 0,
idpLinks: globalThis.Array.isArray(object?.idpLinks) ? object.idpLinks.map((e) => import_idp.IDPLink.fromJSON(e)) : [],
totpSecret: isSet(object.totpSecret) ? globalThis.String(object.totpSecret) : void 0
};
},
toJSON(message) {
const obj = {};
if (message.userId !== void 0) {
obj.userId = message.userId;
}
if (message.username !== void 0) {
obj.username = message.username;
}
if (message.organization !== void 0) {
obj.organization = import_object.Organization.toJSON(message.organization);
}
if (message.profile !== void 0) {
obj.profile = import_user.SetHumanProfile.toJSON(message.profile);
}
if (message.email !== void 0) {
obj.email = import_email.SetHumanEmail.toJSON(message.email);
}
if (message.phone !== void 0) {
obj.phone = import_phone.SetHumanPhone.toJSON(message.phone);
}
if (message.metadata?.length) {
obj.metadata = message.metadata.map((e) => import_user.SetMetadataEntry.toJSON(e));
}
if (message.password !== void 0) {
obj.password = import_password.Password.toJSON(message.password);
}
if (message.hashedPassword !== void 0) {
obj.hashedPassword = import_password.HashedPassword.toJSON(message.hashedPassword);
}
if (message.idpLinks?.length) {
obj.idpLinks = message.idpLinks.map((e) => import_idp.IDPLink.toJSON(e));
}
if (message.totpSecret !== void 0) {
obj.totpSecret = message.totpSecret;
}
return obj;
},
create(base) {
return AddHumanUserRequest.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseAddHumanUserRequest();
message.userId = object.userId ?? void 0;
message.username = object.username ?? void 0;
message.organization = object.organization !== void 0 && object.organization !== null ? import_object.Organization.fromPartial(object.organization) : void 0;
message.profile = object.profile !== void 0 && object.profile !== null ? import_user.SetHumanProfile.fromPartial(object.profile) : void 0;
message.email = object.email !== void 0 && object.email !== null ? import_email.SetHumanEmail.fromPartial(object.email) : void 0;
message.phone = object.phone !== void 0 && object.phone !== null ? import_phone.SetHumanPhone.fromPartial(object.phone) : void 0;
message.metadata = object.metadata?.map((e) => import_user.SetMetadataEntry.fromPartial(e)) || [];
message.password = object.password !== void 0 && object.password !== null ? import_password.Password.fromPartial(object.password) : void 0;
message.hashedPassword = object.hashedPassword !== void 0 && object.hashedPassword !== null ? import_password.HashedPassword.fromPartial(object.hashedPassword) : void 0;
message.idpLinks = object.idpLinks?.map((e) => import_idp.IDPLink.fromPartial(e)) || [];
message.totpSecret = object.totpSecret ?? void 0;
return message;
}
};
function createBaseAddHumanUserResponse() {
return { userId: "", details: void 0, emailCode: void 0, phoneCode: void 0 };
}
const AddHumanUserResponse = {
encode(message, writer = new import_wire.BinaryWriter()) {
if (message.userId !== "") {
writer.uint32(10).string(message.userId);
}
if (message.details !== void 0) {
import_object.Details.encode(message.details, writer.uint32(18).fork()).join();
}
if (message.emailCode !== void 0) {
writer.uint32(26).string(message.emailCode);
}
if (message.phoneCode !== void 0) {
writer.uint32(34).string(message.phoneCode);
}
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 = createBaseAddHumanUserResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.userId = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.details = import_object.Details.decode(reader, reader.uint32());
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.emailCode = reader.string();
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.phoneCode = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
userId: isSet(object.userId) ? globalThis.String(object.userId) : "",
details: isSet(object.details) ? import_object.Details.fromJSON(object.details) : void 0,
emailCode: isSet(object.emailCode) ? globalThis.String(object.emailCode) : void 0,
phoneCode: isSet(object.phoneCode) ? globalThis.String(object.phoneCode) : void 0
};
},
toJSON(message) {
const obj = {};
if (message.userId !== "") {
obj.userId = message.userId;
}
if (message.details !== void 0) {
obj.details = import_object.Details.toJSON(message.details);
}
if (message.emailCode !== void 0) {
obj.emailCode = message.emailCode;
}
if (message.phoneCode !== void 0) {
obj.phoneCode = message.phoneCode;
}
return obj;
},
create(base) {
return AddHumanUserResponse.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseAddHumanUserResponse();
message.userId = object.userId ?? "";
message.details = object.details !== void 0 && object.details !== null ? import_object.Details.fromPartial(object.details) : void 0;
message.emailCode = object.emailCode ?? void 0;
message.phoneCode = object.phoneCode ?? void 0;
return message;
}
};
function createBaseCreateUserRequest() {
return { organizationId: "", userId: void 0, username: void 0, human: void 0, machine: void 0 };
}
const CreateUserRequest = {
encode(message, writer = new import_wire.BinaryWriter()) {
if (message.organizationId !== "") {
writer.uint32(10).string(message.organizationId);
}
if (message.userId !== void 0) {
writer.uint32(18).string(message.userId);
}
if (message.username !== void 0) {
writer.uint32(26).string(message.username);
}
if (message.human !== void 0) {
CreateUserRequest_Human.encode(message.human, writer.uint32(34).fork()).join();
}
if (message.machine !== void 0) {
CreateUserRequest_Machine.encode(message.machine, writer.uint32(42).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 = createBaseCreateUserRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.organizationId = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.userId = reader.string();
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.username = reader.string();
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.human = CreateUserRequest_Human.decode(reader, reader.uint32());
continue;
}
case 5: {
if (tag !== 42) {
break;
}
message.machine = CreateUserRequest_Machine.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
organizationId: isSet(object.organizationId) ? globalThis.String(object.organizationId) : "",
userId: isSet(object.userId) ? globalThis.String(object.userId) : void 0,
username: isSet(object.username) ? globalThis.String(object.username) : void 0,
human: isSet(object.human) ? CreateUserRequest_Human.fromJSON(object.human) : void 0,
machine: isSet(object.machine) ? CreateUserRequest_Machine.fromJSON(object.machine) : void 0
};
},
toJSON(message) {
const obj = {};
if (message.organizationId !== "") {
obj.organizationId = message.organizationId;
}
if (message.userId !== void 0) {
obj.userId = message.userId;
}
if (message.username !== void 0) {
obj.username = message.username;
}
if (message.human !== void 0) {
obj.human = CreateUserRequest_Human.toJSON(message.human);
}
if (message.machine !== void 0) {
obj.machine = CreateUserRequest_Machine.toJSON(message.machine);
}
return obj;
},
create(base) {
return CreateUserRequest.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseCreateUserRequest();
message.organizationId = object.organizationId ?? "";
message.userId = object.userId ?? void 0;
message.username = object.username ?? void 0;
message.human = object.human !== void 0 && object.human !== null ? CreateUserRequest_Human.fromPartial(object.human) : void 0;
message.machine = object.machine !== void 0 && object.machine !== null ? CreateUserRequest_Machine.fromPartial(object.machine) : void 0;
return message;
}
};
function createBaseCreateUserRequest_Human() {
return {
profile: void 0,
email: void 0,
phone: void 0,
password: void 0,
hashedPassword: void 0,
idpLinks: [],
totpSecret: void 0,
metadata: []
};
}
const CreateUserRequest_Human = {
encode(message, writer = new import_wire.BinaryWriter()) {
if (message.profile !== void 0) {
import_user.SetHumanProfile.encode(message.profile, writer.uint32(10).fork()).join();
}
if (message.email !== void 0) {
import_email.SetHumanEmail.encode(message.email, writer.uint32(18).fork()).join();
}
if (message.phone !== void 0) {
import_phone.SetHumanPhone.encode(message.phone, writer.uint32(26).fork()).join();
}
if (message.password !== void 0) {
import_password.Password.encode(message.password, writer.uint32(34).fork()).join();
}
if (message.hashedPassword !== void 0) {
import_password.HashedPassword.encode(message.hashedPassword, writer.uint32(42).fork()).join();
}
for (const v of message.idpLinks) {
import_idp.IDPLink.encode(v, writer.uint32(58).fork()).join();
}
if (message.totpSecret !== void 0) {
writer.uint32(66).string(message.totpSecret);
}
for (const v of message.metadata) {
Metadata.encode(v, writer.uint32(74).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 = createBaseCreateUserRequest_Human();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.profile = import_user.SetHumanProfile.decode(reader, reader.uint32());
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.email = import_email.SetHumanEmail.decode(reader, reader.uint32());
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.phone = import_phone.SetHumanPhone.decode(reader, reader.uint32());
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.password = import_password.Password.decode(reader, reader.uint32());
continue;
}
case 5: {
if (tag !== 42) {
break;
}
message.hashedPassword = import_password.HashedPassword.decode(reader, reader.uint32());
continue;
}
case 7: {
if (tag !== 58) {
break;
}
message.idpLinks.push(import_idp.IDPLink.decode(reader, reader.uint32()));
continue;
}
case 8: {
if (tag !== 66) {
break;
}
message.totpSecret = reader.string();
continue;
}
case 9: {
if (tag !== 74) {
break;
}
message.metadata.push(Metadata.decode(reader, reader.uint32()));
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
profile: isSet(object.profile) ? import_user.SetHumanProfile.fromJSON(object.profile) : void 0,
email: isSet(object.email) ? import_email.SetHumanEmail.fromJSON(object.email) : void 0,
phone: isSet(object.phone) ? import_phone.SetHumanPhone.fromJSON(object.phone) : void 0,
password: isSet(object.password) ? import_password.Password.fromJSON(object.password) : void 0,
hashedPassword: isSet(object.hashedPassword) ? import_password.HashedPassword.fromJSON(object.hashedPassword) : void 0,
idpLinks: globalThis.Array.isArray(object?.idpLinks) ? object.idpLinks.map((e) => import_idp.IDPLink.fromJSON(e)) : [],
totpSecret: isSet(object.totpSecret) ? globalThis.String(object.totpSecret) : void 0,
metadata: globalThis.Array.isArray(object?.metadata) ? object.metadata.map((e) => Metadata.fromJSON(e)) : []
};
},
toJSON(message) {
const obj = {};
if (message.profile !== void 0) {
obj.profile = import_user.SetHumanProfile.toJSON(message.profile);
}
if (message.email !== void 0) {
obj.email = import_email.SetHumanEmail.toJSON(message.email);
}
if (message.phone !== void 0) {
obj.phone = import_phone.SetHumanPhone.toJSON(message.phone);
}
if (message.password !== void 0) {
obj.password = import_password.Password.toJSON(message.password);
}
if (message.hashedPassword !== void 0) {
obj.hashedPassword = import_password.HashedPassword.toJSON(message.hashedPassword);
}
if (message.idpLinks?.length) {
obj.idpLinks = message.idpLinks.map((e) => import_idp.IDPLink.toJSON(e));
}
if (message.totpSecret !== void 0) {
obj.totpSecret = message.totpSecret;
}
if (message.metadata?.length) {
obj.metadata = message.metadata.map((e) => Metadata.toJSON(e));
}
return obj;
},
create(base) {
return CreateUserRequest_Human.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseCreateUserRequest_Human();
message.profile = object.profile !== void 0 && object.profile !== null ? import_user.SetHumanProfile.fromPartial(object.profile) : void 0;
message.email = object.email !== void 0 && object.email !== null ? import_email.SetHumanEmail.fromPartial(object.email) : void 0;
message.phone = object.phone !== void 0 && object.phone !== null ? import_phone.SetHumanPhone.fromPartial(object.phone) : void 0;
message.password = object.password !== void 0 && object.password !== null ? import_password.Password.fromPartial(object.password) : void 0;
message.hashedPassword = object.hashedPassword !== void 0 && object.hashedPassword !== null ? import_password.HashedPassword.fromPartial(object.hashedPassword) : void 0;
message.idpLinks = object.idpLinks?.map((e) => import_idp.IDPLink.fromPartial(e)) || [];
message.totpSecret = object.totpSecret ?? void 0;
message.metadata = object.metadata?.map((e) => Metadata.fromPartial(e)) || [];
return message;
}
};
function createBaseCreateUserRequest_Machine() {
return { name: "", description: void 0 };
}
const CreateUserRequest_Machine = {
encode(message, writer = new import_wire.BinaryWriter()) {
if (message.name !== "") {
writer.uint32(10).string(message.name);
}
if (message.description !== void 0) {
writer.uint32(18).string(message.description);
}
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 = createBaseCreateUserRequest_Machine();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.name = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.description = 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) : "",
description: isSet(object.description) ? globalThis.String(object.description) : void 0
};
},
toJSON(message) {
const obj = {};
if (message.name !== "") {
obj.name = message.name;
}
if (message.description !== void 0) {
obj.description = message.description;
}
return obj;
},
create(base) {
return CreateUserRequest_Machine.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseCreateUserRequest_Machine();
message.name = object.name ?? "";
message.description = object.description ?? void 0;
return message;
}
};
function createBaseCreateUserResponse() {
return { id: "", creationDate: void 0, emailCode: void 0, phoneCode: void 0 };
}
const CreateUserResponse = {
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.emailCode !== void 0) {
writer.uint32(26).string(message.emailCode);
}
if (message.phoneCode !== void 0) {
writer.uint32(34).string(message.phoneCode);
}
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 = createBaseCreateUserResponse();
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.emailCode = reader.string();
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.phoneCode = 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,
emailCode: isSet(object.emailCode) ? globalThis.String(object.emailCode) : void 0,
phoneCode: isSet(object.phoneCode) ? globalThis.String(object.phoneCode) : void 0
};
},
toJSON(message) {
const obj = {};
if (message.id !== "") {
obj.id = message.id;
}
if (message.creationDate !== void 0) {
obj.creationDate = message.creationDate.toISOString();
}
if (message.emailCode !== void 0) {
obj.emailCode = message.emailCode;
}
if (message.phoneCode !== void 0) {
obj.phoneCode = message.phoneCode;
}
return obj;
},
create(base) {
return CreateUserResponse.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseCreateUserResponse();
message.id = object.id ?? "";
message.creationDate = object.creationDate ?? void 0;
message.emailCode = object.emailCode ?? void 0;
message.phoneCode = object.phoneCode ?? void 0;
return message;
}
};
function createBaseGetUserByIDRequest() {
return { userId: "" };
}
const GetUserByIDRequest = {
encode(message, writer = new import_wire.BinaryWriter()) {
if (message.userId !== "") {
writer.uint32(10).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 = createBaseGetUserByIDRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.userId = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return { userId: isSet(object.userId) ? globalThis.String(object.userId) : "" };
},
toJSON(message) {
const obj = {};
if (message.userId !== "") {
obj.userId = message.userId;
}
return obj;
},
create(base) {
return GetUserByIDRequest.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseGetUserByIDRequest();
message.userId = object.userId ?? "";
return message;
}
};
function createBaseGetUserByIDResponse() {
return { details: void 0, user: void 0 };
}
const GetUserByIDResponse = {
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.user !== void 0) {
import_user.User.encode(message.user, writer.uint32(18).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 = createBaseGetUserByIDResponse();
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.user = import_user.User.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,
user: isSet(object.user) ? import_user.User.fromJSON(object.user) : void 0
};
},
toJSON(message) {
const obj = {};
if (message.details !== void 0) {
obj.details = import_object.Details.toJSON(message.details);
}
if (message.user !== void 0) {
obj.user = import_user.User.toJSON(message.user);
}
return obj;
},
create(base) {
return GetUserByIDResponse.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseGetUserByIDResponse();
message.details = object.details !== void 0 && object.details !== null ? import_object.Details.fromPartial(object.details) : void 0;
message.user = object.user !== void 0 && object.user !== null ? import_user.User.fromPartial(object.user) : void 0;
return message;
}
};
function createBaseListUsersRequest() {
return { query: void 0, sortingColumn: 0, queries: [] };
}
const ListUsersRequest = {
encode(message, writer = new import_wire.BinaryWriter()) {
if (message.query !== void 0) {
import_object.ListQuery.encode(message.query, writer.uint32(10).fork()).join();
}
if (message.sortingColumn !== 0) {
writer.uint32(16).int32(message.sortingColumn);
}
for (const v of message.queries) {
import_query.SearchQuery.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 = createBaseListUsersRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.query = import_object.ListQuery.decode(reader, reader.uint32());
continue;
}
case 2: {
if (tag !== 16) {
break;
}
message.sortingColumn = reader.int32();
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.queries.push(import_query.SearchQuery.decode(reader, reader.uint32()));
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
query: isSet(object.query) ? import_object.ListQuery.fromJSON(object.query) : void 0,
sortingColumn: isSet(object.sortingColumn) ? (0, import_query.userFieldNameFromJSON)(object.sortingColumn) : 0,
queries: globalThis.Array.isArray(object?.queries) ? object.queries.map((e) => import_query.SearchQuery.fromJSON(e)) : []
};
},
toJSON(message) {
const obj = {};
if (message.query !== void 0) {
obj.query = import_object.ListQuery.toJSON(message.query);
}
if (message.sortingColumn !== 0) {
obj.sortingColumn = (0, import_query.userFieldNameToJSON)(message.sortingColumn);
}
if (message.queries?.length) {
obj.queries = message.queries.map((e) => import_query.SearchQuery.toJSON(e));
}
return obj;
},
create(base) {
return ListUsersRequest.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseListUsersRequest();
message.query = object.query !== void 0 && object.query !== null ? import_object.ListQuery.fromPartial(object.query) : void 0;
message.sortingColumn = object.sortingColumn ?? 0;
message.queries = object.queries?.map((e) => import_query.SearchQuery.fromPartial(e)) || [];
return message;
}
};
function createBaseListUsersResponse() {
return { details: void 0, sortingColumn: 0, result: [] };
}
const ListUsersResponse = {
encode(message, writer = new import_wire.BinaryWriter()) {
if (message.details !== void 0) {
import_object.ListDetails.encode(message.details, writer.uint32(10).fork()).join();
}
if (message.sortingColumn !== 0) {
writer.uint32(16).int32(message.sortingColumn);
}
for (const v of message.result) {
import_user.User.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 = createBaseListUsersResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.details = import_object.ListDetails.decode(reader, reader.uint32());
continue;
}
case 2: {
if (tag !== 16) {
break;
}
message.sortingColumn = reader.int32();
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.result.push(import_user.User.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.ListDetails.fromJSON(object.details) : void 0,
sortingColumn: isSet(object.sortingColumn) ? (0, import_query.userFieldNameFromJSON)(object.sortingColumn) : 0,
result: globalThis.Array.isArray(object?.result) ? object.result.map((e) => import_user.User.fromJSON(e)) : []
};
},
toJSON(message) {
const obj = {};
if (message.details !== void 0) {
obj.details = import_object.ListDetails.toJSON(message.details);
}
if (message.sortingColumn !== 0) {
obj.sortingColumn = (0, import_query.userFieldNameToJSON)(message.sortingColumn);
}
if (message.result?.length) {
obj.result = message.result.map((e) => import_user.User.toJSON(e));
}
return obj;
},
create(base) {
return ListUsersResponse.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseListUsersResponse();
message.details = object.details !== void 0 && object.details !== null ? import_object.ListDetails.fromPartial(object.details) : void 0;
message.sortingColumn = object.sortingColumn ?? 0;
message.result = object.result?.map((e) => import_user.User.fromPartial(e)) || [];
return message;
}
};
function createBaseSetEmailRequest() {
return { userId: "", email: "", sendCode: void 0, returnCode: void 0, isVerified: void 0 };
}
const SetEmailRequest = {
encode(message, writer = new import_wire.BinaryWriter()