@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,522 lines • 43.8 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 internal_permission_service_exports = {};
__export(internal_permission_service_exports, {
CreateAdministratorRequest: () => CreateAdministratorRequest,
CreateAdministratorResponse: () => CreateAdministratorResponse,
DeleteAdministratorRequest: () => DeleteAdministratorRequest,
DeleteAdministratorResponse: () => DeleteAdministratorResponse,
GetAdministratorRequest: () => GetAdministratorRequest,
GetAdministratorResponse: () => GetAdministratorResponse,
InternalPermissionServiceDefinition: () => InternalPermissionServiceDefinition,
ListAdministratorsRequest: () => ListAdministratorsRequest,
ListAdministratorsResponse: () => ListAdministratorsResponse,
ResourceType: () => ResourceType,
ResourceType_ProjectGrant: () => ResourceType_ProjectGrant,
UpdateAdministratorRequest: () => UpdateAdministratorRequest,
UpdateAdministratorResponse: () => UpdateAdministratorResponse,
protobufPackage: () => protobufPackage
});
module.exports = __toCommonJS(internal_permission_service_exports);
var import_wire = require("@bufbuild/protobuf/wire");
var import_long = __toESM(require("long"));
var import_timestamp = require("../../../google/protobuf/timestamp.js");
var import_filter = require("../../filter/v2beta/filter.js");
var import_query = require("./query.js");
const protobufPackage = "zitadel.internal_permission.v2beta";
function createBaseListAdministratorsRequest() {
return { pagination: void 0, sortingColumn: void 0, filters: [] };
}
const ListAdministratorsRequest = {
encode(message, writer = new import_wire.BinaryWriter()) {
if (message.pagination !== void 0) {
import_filter.PaginationRequest.encode(message.pagination, writer.uint32(10).fork()).join();
}
if (message.sortingColumn !== void 0) {
writer.uint32(16).int32(message.sortingColumn);
}
for (const v of message.filters) {
import_query.AdministratorSearchFilter.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 = createBaseListAdministratorsRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.pagination = import_filter.PaginationRequest.decode(reader, reader.uint32());
continue;
}
case 2: {
if (tag !== 16) {
break;
}
message.sortingColumn = reader.int32();
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.filters.push(import_query.AdministratorSearchFilter.decode(reader, reader.uint32()));
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
pagination: isSet(object.pagination) ? import_filter.PaginationRequest.fromJSON(object.pagination) : void 0,
sortingColumn: isSet(object.sortingColumn) ? (0, import_query.administratorFieldNameFromJSON)(object.sortingColumn) : void 0,
filters: globalThis.Array.isArray(object?.filters) ? object.filters.map((e) => import_query.AdministratorSearchFilter.fromJSON(e)) : []
};
},
toJSON(message) {
const obj = {};
if (message.pagination !== void 0) {
obj.pagination = import_filter.PaginationRequest.toJSON(message.pagination);
}
if (message.sortingColumn !== void 0) {
obj.sortingColumn = (0, import_query.administratorFieldNameToJSON)(message.sortingColumn);
}
if (message.filters?.length) {
obj.filters = message.filters.map((e) => import_query.AdministratorSearchFilter.toJSON(e));
}
return obj;
},
create(base) {
return ListAdministratorsRequest.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseListAdministratorsRequest();
message.pagination = object.pagination !== void 0 && object.pagination !== null ? import_filter.PaginationRequest.fromPartial(object.pagination) : void 0;
message.sortingColumn = object.sortingColumn ?? void 0;
message.filters = object.filters?.map((e) => import_query.AdministratorSearchFilter.fromPartial(e)) || [];
return message;
}
};
function createBaseListAdministratorsResponse() {
return { pagination: void 0, administrators: [] };
}
const ListAdministratorsResponse = {
encode(message, writer = new import_wire.BinaryWriter()) {
if (message.pagination !== void 0) {
import_filter.PaginationResponse.encode(message.pagination, writer.uint32(10).fork()).join();
}
for (const v of message.administrators) {
import_query.Administrator.encode(v, 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 = createBaseListAdministratorsResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.pagination = import_filter.PaginationResponse.decode(reader, reader.uint32());
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.administrators.push(import_query.Administrator.decode(reader, reader.uint32()));
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
pagination: isSet(object.pagination) ? import_filter.PaginationResponse.fromJSON(object.pagination) : void 0,
administrators: globalThis.Array.isArray(object?.administrators) ? object.administrators.map((e) => import_query.Administrator.fromJSON(e)) : []
};
},
toJSON(message) {
const obj = {};
if (message.pagination !== void 0) {
obj.pagination = import_filter.PaginationResponse.toJSON(message.pagination);
}
if (message.administrators?.length) {
obj.administrators = message.administrators.map((e) => import_query.Administrator.toJSON(e));
}
return obj;
},
create(base) {
return ListAdministratorsResponse.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseListAdministratorsResponse();
message.pagination = object.pagination !== void 0 && object.pagination !== null ? import_filter.PaginationResponse.fromPartial(object.pagination) : void 0;
message.administrators = object.administrators?.map((e) => import_query.Administrator.fromPartial(e)) || [];
return message;
}
};
function createBaseGetAdministratorRequest() {
return { id: "" };
}
const GetAdministratorRequest = {
encode(message, writer = new import_wire.BinaryWriter()) {
if (message.id !== "") {
writer.uint32(10).string(message.id);
}
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 = createBaseGetAdministratorRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.id = 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) : "" };
},
toJSON(message) {
const obj = {};
if (message.id !== "") {
obj.id = message.id;
}
return obj;
},
create(base) {
return GetAdministratorRequest.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseGetAdministratorRequest();
message.id = object.id ?? "";
return message;
}
};
function createBaseGetAdministratorResponse() {
return { administrator: void 0 };
}
const GetAdministratorResponse = {
encode(message, writer = new import_wire.BinaryWriter()) {
if (message.administrator !== void 0) {
import_query.Administrator.encode(message.administrator, 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 = createBaseGetAdministratorResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.administrator = import_query.Administrator.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return { administrator: isSet(object.administrator) ? import_query.Administrator.fromJSON(object.administrator) : void 0 };
},
toJSON(message) {
const obj = {};
if (message.administrator !== void 0) {
obj.administrator = import_query.Administrator.toJSON(message.administrator);
}
return obj;
},
create(base) {
return GetAdministratorResponse.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseGetAdministratorResponse();
message.administrator = object.administrator !== void 0 && object.administrator !== null ? import_query.Administrator.fromPartial(object.administrator) : void 0;
return message;
}
};
function createBaseCreateAdministratorRequest() {
return { userId: "", resource: void 0, roles: [] };
}
const CreateAdministratorRequest = {
encode(message, writer = new import_wire.BinaryWriter()) {
if (message.userId !== "") {
writer.uint32(10).string(message.userId);
}
if (message.resource !== void 0) {
ResourceType.encode(message.resource, writer.uint32(18).fork()).join();
}
for (const v of message.roles) {
writer.uint32(26).string(v);
}
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 = createBaseCreateAdministratorRequest();
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.resource = ResourceType.decode(reader, reader.uint32());
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.roles.push(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) : "",
resource: isSet(object.resource) ? ResourceType.fromJSON(object.resource) : void 0,
roles: globalThis.Array.isArray(object?.roles) ? object.roles.map((e) => globalThis.String(e)) : []
};
},
toJSON(message) {
const obj = {};
if (message.userId !== "") {
obj.userId = message.userId;
}
if (message.resource !== void 0) {
obj.resource = ResourceType.toJSON(message.resource);
}
if (message.roles?.length) {
obj.roles = message.roles;
}
return obj;
},
create(base) {
return CreateAdministratorRequest.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseCreateAdministratorRequest();
message.userId = object.userId ?? "";
message.resource = object.resource !== void 0 && object.resource !== null ? ResourceType.fromPartial(object.resource) : void 0;
message.roles = object.roles?.map((e) => e) || [];
return message;
}
};
function createBaseResourceType() {
return { instance: void 0, organizationId: void 0, projectId: void 0, projectGrant: void 0 };
}
const ResourceType = {
encode(message, writer = new import_wire.BinaryWriter()) {
if (message.instance !== void 0) {
writer.uint32(8).bool(message.instance);
}
if (message.organizationId !== void 0) {
writer.uint32(18).string(message.organizationId);
}
if (message.projectId !== void 0) {
writer.uint32(26).string(message.projectId);
}
if (message.projectGrant !== void 0) {
ResourceType_ProjectGrant.encode(message.projectGrant, 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 = createBaseResourceType();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.instance = reader.bool();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.organizationId = reader.string();
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.projectId = reader.string();
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.projectGrant = ResourceType_ProjectGrant.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
instance: isSet(object.instance) ? globalThis.Boolean(object.instance) : void 0,
organizationId: isSet(object.organizationId) ? globalThis.String(object.organizationId) : void 0,
projectId: isSet(object.projectId) ? globalThis.String(object.projectId) : void 0,
projectGrant: isSet(object.projectGrant) ? ResourceType_ProjectGrant.fromJSON(object.projectGrant) : void 0
};
},
toJSON(message) {
const obj = {};
if (message.instance !== void 0) {
obj.instance = message.instance;
}
if (message.organizationId !== void 0) {
obj.organizationId = message.organizationId;
}
if (message.projectId !== void 0) {
obj.projectId = message.projectId;
}
if (message.projectGrant !== void 0) {
obj.projectGrant = ResourceType_ProjectGrant.toJSON(message.projectGrant);
}
return obj;
},
create(base) {
return ResourceType.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseResourceType();
message.instance = object.instance ?? void 0;
message.organizationId = object.organizationId ?? void 0;
message.projectId = object.projectId ?? void 0;
message.projectGrant = object.projectGrant !== void 0 && object.projectGrant !== null ? ResourceType_ProjectGrant.fromPartial(object.projectGrant) : void 0;
return message;
}
};
function createBaseResourceType_ProjectGrant() {
return { projectId: "", projectGrantId: "" };
}
const ResourceType_ProjectGrant = {
encode(message, writer = new import_wire.BinaryWriter()) {
if (message.projectId !== "") {
writer.uint32(10).string(message.projectId);
}
if (message.projectGrantId !== "") {
writer.uint32(18).string(message.projectGrantId);
}
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 = createBaseResourceType_ProjectGrant();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.projectId = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.projectGrantId = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
projectId: isSet(object.projectId) ? globalThis.String(object.projectId) : "",
projectGrantId: isSet(object.projectGrantId) ? globalThis.String(object.projectGrantId) : ""
};
},
toJSON(message) {
const obj = {};
if (message.projectId !== "") {
obj.projectId = message.projectId;
}
if (message.projectGrantId !== "") {
obj.projectGrantId = message.projectGrantId;
}
return obj;
},
create(base) {
return ResourceType_ProjectGrant.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseResourceType_ProjectGrant();
message.projectId = object.projectId ?? "";
message.projectGrantId = object.projectGrantId ?? "";
return message;
}
};
function createBaseCreateAdministratorResponse() {
return { creationDate: void 0 };
}
const CreateAdministratorResponse = {
encode(message, writer = new import_wire.BinaryWriter()) {
if (message.creationDate !== void 0) {
import_timestamp.Timestamp.encode(toTimestamp(message.creationDate), 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 = createBaseCreateAdministratorResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.creationDate = fromTimestamp(import_timestamp.Timestamp.decode(reader, reader.uint32()));
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return { creationDate: isSet(object.creationDate) ? fromJsonTimestamp(object.creationDate) : void 0 };
},
toJSON(message) {
const obj = {};
if (message.creationDate !== void 0) {
obj.creationDate = message.creationDate.toISOString();
}
return obj;
},
create(base) {
return CreateAdministratorResponse.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseCreateAdministratorResponse();
message.creationDate = object.creationDate ?? void 0;
return message;
}
};
function createBaseUpdateAdministratorRequest() {
return { userId: "", resource: void 0, roles: [] };
}
const UpdateAdministratorRequest = {
encode(message, writer = new import_wire.BinaryWriter()) {
if (message.userId !== "") {
writer.uint32(10).string(message.userId);
}
if (message.resource !== void 0) {
ResourceType.encode(message.resource, writer.uint32(18).fork()).join();
}
for (const v of message.roles) {
writer.uint32(26).string(v);
}
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 = createBaseUpdateAdministratorRequest();
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.resource = ResourceType.decode(reader, reader.uint32());
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.roles.push(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) : "",
resource: isSet(object.resource) ? ResourceType.fromJSON(object.resource) : void 0,
roles: globalThis.Array.isArray(object?.roles) ? object.roles.map((e) => globalThis.String(e)) : []
};
},
toJSON(message) {
const obj = {};
if (message.userId !== "") {
obj.userId = message.userId;
}
if (message.resource !== void 0) {
obj.resource = ResourceType.toJSON(message.resource);
}
if (message.roles?.length) {
obj.roles = message.roles;
}
return obj;
},
create(base) {
return UpdateAdministratorRequest.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseUpdateAdministratorRequest();
message.userId = object.userId ?? "";
message.resource = object.resource !== void 0 && object.resource !== null ? ResourceType.fromPartial(object.resource) : void 0;
message.roles = object.roles?.map((e) => e) || [];
return message;
}
};
function createBaseUpdateAdministratorResponse() {
return { changeDate: void 0 };
}
const UpdateAdministratorResponse = {
encode(message, writer = new import_wire.BinaryWriter()) {
if (message.changeDate !== void 0) {
import_timestamp.Timestamp.encode(toTimestamp(message.changeDate), 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 = createBaseUpdateAdministratorResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.changeDate = fromTimestamp(import_timestamp.Timestamp.decode(reader, reader.uint32()));
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return { changeDate: isSet(object.changeDate) ? fromJsonTimestamp(object.changeDate) : void 0 };
},
toJSON(message) {
const obj = {};
if (message.changeDate !== void 0) {
obj.changeDate = message.changeDate.toISOString();
}
return obj;
},
create(base) {
return UpdateAdministratorResponse.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseUpdateAdministratorResponse();
message.changeDate = object.changeDate ?? void 0;
return message;
}
};
function createBaseDeleteAdministratorRequest() {
return { userId: "", resource: void 0 };
}
const DeleteAdministratorRequest = {
encode(message, writer = new import_wire.BinaryWriter()) {
if (message.userId !== "") {
writer.uint32(10).string(message.userId);
}
if (message.resource !== void 0) {
ResourceType.encode(message.resource, 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 = createBaseDeleteAdministratorRequest();
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.resource = ResourceType.decode(reader, reader.uint32());
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) : "",
resource: isSet(object.resource) ? ResourceType.fromJSON(object.resource) : void 0
};
},
toJSON(message) {
const obj = {};
if (message.userId !== "") {
obj.userId = message.userId;
}
if (message.resource !== void 0) {
obj.resource = ResourceType.toJSON(message.resource);
}
return obj;
},
create(base) {
return DeleteAdministratorRequest.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseDeleteAdministratorRequest();
message.userId = object.userId ?? "";
message.resource = object.resource !== void 0 && object.resource !== null ? ResourceType.fromPartial(object.resource) : void 0;
return message;
}
};
function createBaseDeleteAdministratorResponse() {
return { deletionDate: void 0 };
}
const DeleteAdministratorResponse = {
encode(message, writer = new import_wire.BinaryWriter()) {
if (message.deletionDate !== void 0) {
import_timestamp.Timestamp.encode(toTimestamp(message.deletionDate), 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 = createBaseDeleteAdministratorResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.deletionDate = fromTimestamp(import_timestamp.Timestamp.decode(reader, reader.uint32()));
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return { deletionDate: isSet(object.deletionDate) ? fromJsonTimestamp(object.deletionDate) : void 0 };
},
toJSON(message) {
const obj = {};
if (message.deletionDate !== void 0) {
obj.deletionDate = message.deletionDate.toISOString();
}
return obj;
},
create(base) {
return DeleteAdministratorResponse.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseDeleteAdministratorResponse();
message.deletionDate = object.deletionDate ?? void 0;
return message;
}
};
const InternalPermissionServiceDefinition = {
name: "InternalPermissionService",
fullName: "zitadel.internal_permission.v2beta.InternalPermissionService",
methods: {
/**
* ListAdministrators returns all administrators and its roles matching the request and necessary permissions.
*
* Required permissions depend on the resource type:
* - "iam.member.read" for instance administrators
* - "org.member.read" for organization administrators
* - "project.member.read" for project administrators
* - "project.grant.member.read" for project grant administrators
* - no permissions required for listing own administrator roles
*/
listAdministrators: {
name: "ListAdministrators",
requestType: ListAdministratorsRequest,
requestStream: false,
responseType: ListAdministratorsResponse,
responseStream: false,
options: {
_unknownFields: {
8338: [
Buffer.from([
87,
74,
56,
10,
3,
50,
48,
48,
18,
49,
10,
47,
65,
32,
108,
105,
115,
116,
32,
111,
102,
32,
97,
108,
108,
32,
97,
100,
109,
105,
110,
105,
115,
116,
114,
97,
116,
111,
114,
115,
32,
109,
97,
116,
99,
104,
105,
110,
103,
32,
116,
104,
101,
32,
113,
117,
101,
114,
121,
74,
27,
10,
3,
52,
48,
48,
18,
20,
10,
18,
105,
110,
118,
97,
108,
105,
100,
32,
108,
105,
115,
116,
32,
113,
117,
101,
114,
121
])
],
400010: [Buffer.from([17, 10, 15, 10, 13, 97, 117, 116, 104, 101, 110, 116, 105, 99, 97, 116, 101, 100])],
578365826: [
Buffer.from([
34,
58,
1,
42,
34,
29,
47,
118,
50,
98,
101,
116,
97,
47,
97,
100,
109,
105,
110,
105,
115,
116,
114,
97,
116,
111,
114,
115,
47,
115,
101,
97,
114,
99,
104
])
]
}
}
},
/**
* CreateAdministrator grants a administrator role to a user for a specific resource.
*
* Note that the roles are specific to the resource type.
* This means that if you want to grant a user the administrator role for an organization and a project,
* you need to create two administrator roles.
*
* Required permissions depend on the resource type:
* - "iam.member.write" for instance administrators
* - "org.member.write" for organization administrators
* - "project.member.write" for project administrators
* - "project.grant.member.write" for project grant administrators
*/
createAdministrator: {
name: "CreateAdministrator",
requestType: CreateAdministratorRequest,
requestStream: false,
responseType: CreateAdministratorResponse,
responseStream: false,
options: {
_unknownFields: {
8338: [
Buffer.from([
99,
74,
43,
10,
3,
50,
48,
48,
18,
36,
10,
34,
65,
100,
109,
105,
110,
105,
115,
116,
114,
97,
116,
111,
114,
32,
99,
114,
101,
97,
116,
101,
100,
32,
115,
117,
99,
99,
101,
115,
115,
102,
117,
108,
108,
121,
74,
52,
10,
3,
52,
48,
57,
18,
45,
10,
43,
84,
104,
101,
32,
97,
100,
109,
105,
110,
105,
115,
116,
114,
97,
116,
111,
114,
32,
116,
111,
32,
99,
114,
101,
97,
116,
101,
32,
97,
108,
114,
101,
97,
100,
121,
32,
101,
120,
105,
115,
116,
115,
46
])
],
400010: [Buffer.from([17, 10, 15, 10, 13, 97, 117, 116, 104, 101, 110, 116, 105, 99, 97, 116, 101, 100])],
578365826: [
Buffer.from([
27,
58,
1,
42,
34,
22,
47,
118,
50,
98,
101,
116,
97,
47,
97,
100,
109,
105,
110,
105,
115,
116,
114,
97,
116,
111,
114,
115
])
]
}
}
},
/**
* UpdateAdministrator updates the specific administrator role.
*
* Note that any role previously granted to the user and not present in the request will be revoked.
*
* Required permissions depend on the resource type:
* - "iam.member.write" for instance administrators
* - "org.member.write" for organization administrators
* - "project.member.write" for project administrators
* - "project.grant.member.write" for project grant administrators
*/
updateAdministrator: {
name: "UpdateAdministrator",
requestType: UpdateAdministratorRequest,
requestStream: false,
responseType: UpdateAdministratorResponse,
responseStream: false,
options: {
_unknownFields: {
8338: [
Buffer.from([
117,
74,
61,
10,
3,
50,
48,
48,
18,
54,
10,
52,
65,
100,
109,
105,
110,
105,
115,
116,
114,
97,
116,
111,
114,
32,
115,
117,
99,
99,
101,
115,
115,
102,
117,
108,
108,
121,
32,
117,
112,
100,
97,
116,
101,
100,
32,
111,
114,
32,
108,
101,
102,
116,
32,
117,
110,
99,
104,
97,
110,
103,
101,
100,
74,
52,
10,
3,
52,
48,
52,
18,
45,
10,
43,
84,
104,
101,
32,
97,
100,
109,
105,
110,
105,
115,
116,
114,
97,
116,
111,
114,
32,
116,
111,
32,
117,
112,
100,
97,
116,
101,
32,
100,
111,
101,
115,
32,
110,
111,
116,
32,
101,
120,
105,
115,
116,
46
])
],
400010: [Buffer.from([17, 10, 15, 10, 13, 97, 117, 116, 104, 101, 110, 116, 105, 99, 97, 116, 101, 100])],
578365826: [
Buffer.from([
37,
58,
1,
42,
34,
32,
47,
118,
50,
98,
101,
116,
97,
47,
97,
100,
109,
105,
110,
105,
115,
116,
114,
97,
116,
111,
114,
115,
47,
123,
117,
115,
101,
114,
95,
105,
100,
125
])
]
}
}
},
/**
* DeleteAdministrator revokes a administrator role from a user.
*
* In case the administrator role is not found, the request will return a successful response as
* the desired state is already achieved.
* You can check the deletion date in the response to verify if the administrator role was deleted during the request.
*
* Required permissions depend on the resource type:
* - "iam.member.delete" for instance administrators
* - "org.member.delete" for organization administrators
* - "project.member.delete" for project administrators
* - "project.grant.member.delete" for project grant administrators
*/
deleteAdministrator: {
name: "DeleteAdministrator",
requestType: DeleteAdministratorRequest,
requestStream: false,
responseType: DeleteAdministratorResponse,
responseStream: false,
options: {
_unknownFields: {
8338: [
Buffer.from([
45,
74,
43,
10,
3,
50,
48,
48,
18,
36,
10,
34,
65,
100,
109,
105,
110,
105,
115,
116,
114,
97,
116,
111,
114,
32,
100,
101,
108,
101,
116,
101,
100,
32,
115,
117,
99,
99,
101,
115,
115,
102,
117,
108,
108,
121
])
],
400010: [Buffer.from([17, 10, 15, 10, 13, 97, 117, 116, 104, 101, 110, 116, 105, 99, 97, 116, 101, 100])],
578365826: [
Buffer.from([
34,
42,
32,
47,
118,
50,
98,
101,
116,
97,
47,
97,
100,
109,
105,
110,
105,
115,
116,
114,
97,
116,
111,
114,
115,
47,
123,
117,
115,
101,
114,
95,
105,
100,
125
])
]
}
}
}
}
};
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 = {
CreateAdministratorRequest,
CreateAdministratorResponse,
DeleteAdministratorRequest,
DeleteAdministratorResponse,
GetAdministratorRequest,
GetAdministratorResponse,
InternalPermissionServiceDefinition,
ListAdministratorsRequest,
ListAdministratorsResponse,
ResourceType,
ResourceType_ProjectGrant,
UpdateAdministratorRequest,
UpdateAdministratorResponse,
protobufPackage
});
//# sourceMappingURL=internal_permission_service.js.map