@zitadel/node
Version:
Library for API access to ZITADEL. Provides compiled gRPC service clients and helpers for applications and service accounts.
692 lines (691 loc) • 26.4 kB
JavaScript
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.7.5
// protoc unknown
// source: zitadel/app/v2beta/app.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import Long from "long";
import { Timestamp } from "../../../google/protobuf/timestamp.js";
import { textFilterMethodFromJSON, textFilterMethodToJSON } from "../../filter/v2/filter.js";
import { APIConfig } from "./api.js";
import { OIDCConfig } from "./oidc.js";
import { SAMLConfig } from "./saml.js";
export const protobufPackage = "zitadel.app.v2beta";
export var AppState;
(function (AppState) {
AppState[AppState["APP_STATE_UNSPECIFIED"] = 0] = "APP_STATE_UNSPECIFIED";
AppState[AppState["APP_STATE_ACTIVE"] = 1] = "APP_STATE_ACTIVE";
AppState[AppState["APP_STATE_INACTIVE"] = 2] = "APP_STATE_INACTIVE";
AppState[AppState["APP_STATE_REMOVED"] = 3] = "APP_STATE_REMOVED";
AppState[AppState["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(AppState || (AppState = {}));
export function appStateFromJSON(object) {
switch (object) {
case 0:
case "APP_STATE_UNSPECIFIED":
return AppState.APP_STATE_UNSPECIFIED;
case 1:
case "APP_STATE_ACTIVE":
return AppState.APP_STATE_ACTIVE;
case 2:
case "APP_STATE_INACTIVE":
return AppState.APP_STATE_INACTIVE;
case 3:
case "APP_STATE_REMOVED":
return AppState.APP_STATE_REMOVED;
case -1:
case "UNRECOGNIZED":
default:
return AppState.UNRECOGNIZED;
}
}
export function appStateToJSON(object) {
switch (object) {
case AppState.APP_STATE_UNSPECIFIED:
return "APP_STATE_UNSPECIFIED";
case AppState.APP_STATE_ACTIVE:
return "APP_STATE_ACTIVE";
case AppState.APP_STATE_INACTIVE:
return "APP_STATE_INACTIVE";
case AppState.APP_STATE_REMOVED:
return "APP_STATE_REMOVED";
case AppState.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
}
}
export var AppSorting;
(function (AppSorting) {
AppSorting[AppSorting["APP_SORT_BY_ID"] = 0] = "APP_SORT_BY_ID";
AppSorting[AppSorting["APP_SORT_BY_NAME"] = 1] = "APP_SORT_BY_NAME";
AppSorting[AppSorting["APP_SORT_BY_STATE"] = 2] = "APP_SORT_BY_STATE";
AppSorting[AppSorting["APP_SORT_BY_CREATION_DATE"] = 3] = "APP_SORT_BY_CREATION_DATE";
AppSorting[AppSorting["APP_SORT_BY_CHANGE_DATE"] = 4] = "APP_SORT_BY_CHANGE_DATE";
AppSorting[AppSorting["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(AppSorting || (AppSorting = {}));
export function appSortingFromJSON(object) {
switch (object) {
case 0:
case "APP_SORT_BY_ID":
return AppSorting.APP_SORT_BY_ID;
case 1:
case "APP_SORT_BY_NAME":
return AppSorting.APP_SORT_BY_NAME;
case 2:
case "APP_SORT_BY_STATE":
return AppSorting.APP_SORT_BY_STATE;
case 3:
case "APP_SORT_BY_CREATION_DATE":
return AppSorting.APP_SORT_BY_CREATION_DATE;
case 4:
case "APP_SORT_BY_CHANGE_DATE":
return AppSorting.APP_SORT_BY_CHANGE_DATE;
case -1:
case "UNRECOGNIZED":
default:
return AppSorting.UNRECOGNIZED;
}
}
export function appSortingToJSON(object) {
switch (object) {
case AppSorting.APP_SORT_BY_ID:
return "APP_SORT_BY_ID";
case AppSorting.APP_SORT_BY_NAME:
return "APP_SORT_BY_NAME";
case AppSorting.APP_SORT_BY_STATE:
return "APP_SORT_BY_STATE";
case AppSorting.APP_SORT_BY_CREATION_DATE:
return "APP_SORT_BY_CREATION_DATE";
case AppSorting.APP_SORT_BY_CHANGE_DATE:
return "APP_SORT_BY_CHANGE_DATE";
case AppSorting.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
}
}
export var ApplicationKeysSorting;
(function (ApplicationKeysSorting) {
ApplicationKeysSorting[ApplicationKeysSorting["APPLICATION_KEYS_SORT_BY_ID"] = 0] = "APPLICATION_KEYS_SORT_BY_ID";
ApplicationKeysSorting[ApplicationKeysSorting["APPLICATION_KEYS_SORT_BY_PROJECT_ID"] = 1] = "APPLICATION_KEYS_SORT_BY_PROJECT_ID";
ApplicationKeysSorting[ApplicationKeysSorting["APPLICATION_KEYS_SORT_BY_APPLICATION_ID"] = 2] = "APPLICATION_KEYS_SORT_BY_APPLICATION_ID";
ApplicationKeysSorting[ApplicationKeysSorting["APPLICATION_KEYS_SORT_BY_CREATION_DATE"] = 3] = "APPLICATION_KEYS_SORT_BY_CREATION_DATE";
ApplicationKeysSorting[ApplicationKeysSorting["APPLICATION_KEYS_SORT_BY_ORGANIZATION_ID"] = 4] = "APPLICATION_KEYS_SORT_BY_ORGANIZATION_ID";
ApplicationKeysSorting[ApplicationKeysSorting["APPLICATION_KEYS_SORT_BY_EXPIRATION"] = 5] = "APPLICATION_KEYS_SORT_BY_EXPIRATION";
ApplicationKeysSorting[ApplicationKeysSorting["APPLICATION_KEYS_SORT_BY_TYPE"] = 6] = "APPLICATION_KEYS_SORT_BY_TYPE";
ApplicationKeysSorting[ApplicationKeysSorting["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(ApplicationKeysSorting || (ApplicationKeysSorting = {}));
export function applicationKeysSortingFromJSON(object) {
switch (object) {
case 0:
case "APPLICATION_KEYS_SORT_BY_ID":
return ApplicationKeysSorting.APPLICATION_KEYS_SORT_BY_ID;
case 1:
case "APPLICATION_KEYS_SORT_BY_PROJECT_ID":
return ApplicationKeysSorting.APPLICATION_KEYS_SORT_BY_PROJECT_ID;
case 2:
case "APPLICATION_KEYS_SORT_BY_APPLICATION_ID":
return ApplicationKeysSorting.APPLICATION_KEYS_SORT_BY_APPLICATION_ID;
case 3:
case "APPLICATION_KEYS_SORT_BY_CREATION_DATE":
return ApplicationKeysSorting.APPLICATION_KEYS_SORT_BY_CREATION_DATE;
case 4:
case "APPLICATION_KEYS_SORT_BY_ORGANIZATION_ID":
return ApplicationKeysSorting.APPLICATION_KEYS_SORT_BY_ORGANIZATION_ID;
case 5:
case "APPLICATION_KEYS_SORT_BY_EXPIRATION":
return ApplicationKeysSorting.APPLICATION_KEYS_SORT_BY_EXPIRATION;
case 6:
case "APPLICATION_KEYS_SORT_BY_TYPE":
return ApplicationKeysSorting.APPLICATION_KEYS_SORT_BY_TYPE;
case -1:
case "UNRECOGNIZED":
default:
return ApplicationKeysSorting.UNRECOGNIZED;
}
}
export function applicationKeysSortingToJSON(object) {
switch (object) {
case ApplicationKeysSorting.APPLICATION_KEYS_SORT_BY_ID:
return "APPLICATION_KEYS_SORT_BY_ID";
case ApplicationKeysSorting.APPLICATION_KEYS_SORT_BY_PROJECT_ID:
return "APPLICATION_KEYS_SORT_BY_PROJECT_ID";
case ApplicationKeysSorting.APPLICATION_KEYS_SORT_BY_APPLICATION_ID:
return "APPLICATION_KEYS_SORT_BY_APPLICATION_ID";
case ApplicationKeysSorting.APPLICATION_KEYS_SORT_BY_CREATION_DATE:
return "APPLICATION_KEYS_SORT_BY_CREATION_DATE";
case ApplicationKeysSorting.APPLICATION_KEYS_SORT_BY_ORGANIZATION_ID:
return "APPLICATION_KEYS_SORT_BY_ORGANIZATION_ID";
case ApplicationKeysSorting.APPLICATION_KEYS_SORT_BY_EXPIRATION:
return "APPLICATION_KEYS_SORT_BY_EXPIRATION";
case ApplicationKeysSorting.APPLICATION_KEYS_SORT_BY_TYPE:
return "APPLICATION_KEYS_SORT_BY_TYPE";
case ApplicationKeysSorting.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
}
}
function createBaseApplication() {
return {
id: "",
creationDate: undefined,
changeDate: undefined,
state: 0,
name: "",
oidcConfig: undefined,
apiConfig: undefined,
samlConfig: undefined,
};
}
export const Application = {
encode(message, writer = new BinaryWriter()) {
if (message.id !== "") {
writer.uint32(10).string(message.id);
}
if (message.creationDate !== undefined) {
Timestamp.encode(toTimestamp(message.creationDate), writer.uint32(18).fork()).join();
}
if (message.changeDate !== undefined) {
Timestamp.encode(toTimestamp(message.changeDate), writer.uint32(26).fork()).join();
}
if (message.state !== 0) {
writer.uint32(32).int32(message.state);
}
if (message.name !== "") {
writer.uint32(42).string(message.name);
}
if (message.oidcConfig !== undefined) {
OIDCConfig.encode(message.oidcConfig, writer.uint32(50).fork()).join();
}
if (message.apiConfig !== undefined) {
APIConfig.encode(message.apiConfig, writer.uint32(58).fork()).join();
}
if (message.samlConfig !== undefined) {
SAMLConfig.encode(message.samlConfig, writer.uint32(66).fork()).join();
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseApplication();
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(Timestamp.decode(reader, reader.uint32()));
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.changeDate = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
continue;
}
case 4: {
if (tag !== 32) {
break;
}
message.state = reader.int32();
continue;
}
case 5: {
if (tag !== 42) {
break;
}
message.name = reader.string();
continue;
}
case 6: {
if (tag !== 50) {
break;
}
message.oidcConfig = OIDCConfig.decode(reader, reader.uint32());
continue;
}
case 7: {
if (tag !== 58) {
break;
}
message.apiConfig = APIConfig.decode(reader, reader.uint32());
continue;
}
case 8: {
if (tag !== 66) {
break;
}
message.samlConfig = SAMLConfig.decode(reader, 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) : "",
creationDate: isSet(object.creationDate) ? fromJsonTimestamp(object.creationDate) : undefined,
changeDate: isSet(object.changeDate) ? fromJsonTimestamp(object.changeDate) : undefined,
state: isSet(object.state) ? appStateFromJSON(object.state) : 0,
name: isSet(object.name) ? globalThis.String(object.name) : "",
oidcConfig: isSet(object.oidcConfig) ? OIDCConfig.fromJSON(object.oidcConfig) : undefined,
apiConfig: isSet(object.apiConfig) ? APIConfig.fromJSON(object.apiConfig) : undefined,
samlConfig: isSet(object.samlConfig) ? SAMLConfig.fromJSON(object.samlConfig) : undefined,
};
},
toJSON(message) {
const obj = {};
if (message.id !== "") {
obj.id = message.id;
}
if (message.creationDate !== undefined) {
obj.creationDate = message.creationDate.toISOString();
}
if (message.changeDate !== undefined) {
obj.changeDate = message.changeDate.toISOString();
}
if (message.state !== 0) {
obj.state = appStateToJSON(message.state);
}
if (message.name !== "") {
obj.name = message.name;
}
if (message.oidcConfig !== undefined) {
obj.oidcConfig = OIDCConfig.toJSON(message.oidcConfig);
}
if (message.apiConfig !== undefined) {
obj.apiConfig = APIConfig.toJSON(message.apiConfig);
}
if (message.samlConfig !== undefined) {
obj.samlConfig = SAMLConfig.toJSON(message.samlConfig);
}
return obj;
},
create(base) {
return Application.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseApplication();
message.id = object.id ?? "";
message.creationDate = object.creationDate ?? undefined;
message.changeDate = object.changeDate ?? undefined;
message.state = object.state ?? 0;
message.name = object.name ?? "";
message.oidcConfig = (object.oidcConfig !== undefined && object.oidcConfig !== null)
? OIDCConfig.fromPartial(object.oidcConfig)
: undefined;
message.apiConfig = (object.apiConfig !== undefined && object.apiConfig !== null)
? APIConfig.fromPartial(object.apiConfig)
: undefined;
message.samlConfig = (object.samlConfig !== undefined && object.samlConfig !== null)
? SAMLConfig.fromPartial(object.samlConfig)
: undefined;
return message;
},
};
function createBaseApplicationSearchFilter() {
return {
nameFilter: undefined,
stateFilter: undefined,
apiAppOnly: undefined,
oidcAppOnly: undefined,
samlAppOnly: undefined,
};
}
export const ApplicationSearchFilter = {
encode(message, writer = new BinaryWriter()) {
if (message.nameFilter !== undefined) {
ApplicationNameQuery.encode(message.nameFilter, writer.uint32(10).fork()).join();
}
if (message.stateFilter !== undefined) {
writer.uint32(16).int32(message.stateFilter);
}
if (message.apiAppOnly !== undefined) {
writer.uint32(24).bool(message.apiAppOnly);
}
if (message.oidcAppOnly !== undefined) {
writer.uint32(32).bool(message.oidcAppOnly);
}
if (message.samlAppOnly !== undefined) {
writer.uint32(40).bool(message.samlAppOnly);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseApplicationSearchFilter();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.nameFilter = ApplicationNameQuery.decode(reader, reader.uint32());
continue;
}
case 2: {
if (tag !== 16) {
break;
}
message.stateFilter = reader.int32();
continue;
}
case 3: {
if (tag !== 24) {
break;
}
message.apiAppOnly = reader.bool();
continue;
}
case 4: {
if (tag !== 32) {
break;
}
message.oidcAppOnly = reader.bool();
continue;
}
case 5: {
if (tag !== 40) {
break;
}
message.samlAppOnly = reader.bool();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
nameFilter: isSet(object.nameFilter) ? ApplicationNameQuery.fromJSON(object.nameFilter) : undefined,
stateFilter: isSet(object.stateFilter) ? appStateFromJSON(object.stateFilter) : undefined,
apiAppOnly: isSet(object.apiAppOnly) ? globalThis.Boolean(object.apiAppOnly) : undefined,
oidcAppOnly: isSet(object.oidcAppOnly) ? globalThis.Boolean(object.oidcAppOnly) : undefined,
samlAppOnly: isSet(object.samlAppOnly) ? globalThis.Boolean(object.samlAppOnly) : undefined,
};
},
toJSON(message) {
const obj = {};
if (message.nameFilter !== undefined) {
obj.nameFilter = ApplicationNameQuery.toJSON(message.nameFilter);
}
if (message.stateFilter !== undefined) {
obj.stateFilter = appStateToJSON(message.stateFilter);
}
if (message.apiAppOnly !== undefined) {
obj.apiAppOnly = message.apiAppOnly;
}
if (message.oidcAppOnly !== undefined) {
obj.oidcAppOnly = message.oidcAppOnly;
}
if (message.samlAppOnly !== undefined) {
obj.samlAppOnly = message.samlAppOnly;
}
return obj;
},
create(base) {
return ApplicationSearchFilter.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseApplicationSearchFilter();
message.nameFilter = (object.nameFilter !== undefined && object.nameFilter !== null)
? ApplicationNameQuery.fromPartial(object.nameFilter)
: undefined;
message.stateFilter = object.stateFilter ?? undefined;
message.apiAppOnly = object.apiAppOnly ?? undefined;
message.oidcAppOnly = object.oidcAppOnly ?? undefined;
message.samlAppOnly = object.samlAppOnly ?? undefined;
return message;
},
};
function createBaseApplicationNameQuery() {
return { name: "", method: 0 };
}
export const ApplicationNameQuery = {
encode(message, writer = new BinaryWriter()) {
if (message.name !== "") {
writer.uint32(10).string(message.name);
}
if (message.method !== 0) {
writer.uint32(16).int32(message.method);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseApplicationNameQuery();
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 !== 16) {
break;
}
message.method = reader.int32();
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) : "",
method: isSet(object.method) ? textFilterMethodFromJSON(object.method) : 0,
};
},
toJSON(message) {
const obj = {};
if (message.name !== "") {
obj.name = message.name;
}
if (message.method !== 0) {
obj.method = textFilterMethodToJSON(message.method);
}
return obj;
},
create(base) {
return ApplicationNameQuery.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseApplicationNameQuery();
message.name = object.name ?? "";
message.method = object.method ?? 0;
return message;
},
};
function createBaseApplicationKey() {
return {
id: "",
applicationId: "",
projectId: "",
creationDate: undefined,
organizationId: "",
expirationDate: undefined,
};
}
export const ApplicationKey = {
encode(message, writer = new BinaryWriter()) {
if (message.id !== "") {
writer.uint32(10).string(message.id);
}
if (message.applicationId !== "") {
writer.uint32(18).string(message.applicationId);
}
if (message.projectId !== "") {
writer.uint32(26).string(message.projectId);
}
if (message.creationDate !== undefined) {
Timestamp.encode(toTimestamp(message.creationDate), writer.uint32(34).fork()).join();
}
if (message.organizationId !== "") {
writer.uint32(42).string(message.organizationId);
}
if (message.expirationDate !== undefined) {
Timestamp.encode(toTimestamp(message.expirationDate), writer.uint32(50).fork()).join();
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseApplicationKey();
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.applicationId = reader.string();
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.projectId = reader.string();
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.creationDate = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
continue;
}
case 5: {
if (tag !== 42) {
break;
}
message.organizationId = reader.string();
continue;
}
case 6: {
if (tag !== 50) {
break;
}
message.expirationDate = fromTimestamp(Timestamp.decode(reader, 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) : "",
applicationId: isSet(object.applicationId) ? globalThis.String(object.applicationId) : "",
projectId: isSet(object.projectId) ? globalThis.String(object.projectId) : "",
creationDate: isSet(object.creationDate) ? fromJsonTimestamp(object.creationDate) : undefined,
organizationId: isSet(object.organizationId) ? globalThis.String(object.organizationId) : "",
expirationDate: isSet(object.expirationDate) ? fromJsonTimestamp(object.expirationDate) : undefined,
};
},
toJSON(message) {
const obj = {};
if (message.id !== "") {
obj.id = message.id;
}
if (message.applicationId !== "") {
obj.applicationId = message.applicationId;
}
if (message.projectId !== "") {
obj.projectId = message.projectId;
}
if (message.creationDate !== undefined) {
obj.creationDate = message.creationDate.toISOString();
}
if (message.organizationId !== "") {
obj.organizationId = message.organizationId;
}
if (message.expirationDate !== undefined) {
obj.expirationDate = message.expirationDate.toISOString();
}
return obj;
},
create(base) {
return ApplicationKey.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseApplicationKey();
message.id = object.id ?? "";
message.applicationId = object.applicationId ?? "";
message.projectId = object.projectId ?? "";
message.creationDate = object.creationDate ?? undefined;
message.organizationId = object.organizationId ?? "";
message.expirationDate = object.expirationDate ?? undefined;
return message;
},
};
function toTimestamp(date) {
const seconds = numberToLong(Math.trunc(date.getTime() / 1_000));
const nanos = (date.getTime() % 1_000) * 1_000_000;
return { seconds, nanos };
}
function fromTimestamp(t) {
let millis = (t.seconds.toNumber() || 0) * 1_000;
millis += (t.nanos || 0) / 1_000_000;
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(Timestamp.fromJSON(o));
}
}
function numberToLong(number) {
return Long.fromNumber(number);
}
function isSet(value) {
return value !== null && value !== undefined;
}