mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-12 15:03:52 +00:00
update nextjs to 15
This commit is contained in:
@@ -18,17 +18,11 @@ import {
|
||||
VerifyU2FRegistrationRequest,
|
||||
} from "@zitadel/proto/zitadel/user/v2/user_service_pb";
|
||||
|
||||
import { create, fromJson, toJson } from "@zitadel/client";
|
||||
import { create } from "@zitadel/client";
|
||||
import { TextQueryMethod } from "@zitadel/proto/zitadel/object/v2/object_pb";
|
||||
import { CreateCallbackRequest } from "@zitadel/proto/zitadel/oidc/v2/oidc_service_pb";
|
||||
import { Organization } from "@zitadel/proto/zitadel/org/v2/org_pb";
|
||||
import { BrandingSettingsSchema } from "@zitadel/proto/zitadel/settings/v2/branding_settings_pb";
|
||||
import { LegalAndSupportSettingsSchema } from "@zitadel/proto/zitadel/settings/v2/legal_settings_pb";
|
||||
import {
|
||||
IdentityProviderType,
|
||||
LoginSettingsSchema,
|
||||
} from "@zitadel/proto/zitadel/settings/v2/login_settings_pb";
|
||||
import { PasswordComplexitySettingsSchema } from "@zitadel/proto/zitadel/settings/v2/password_settings_pb";
|
||||
import { IdentityProviderType } from "@zitadel/proto/zitadel/settings/v2/login_settings_pb";
|
||||
import type { RedirectURLsJson } from "@zitadel/proto/zitadel/user/v2/idp_pb";
|
||||
import {
|
||||
NotificationType,
|
||||
@@ -43,7 +37,7 @@ import {
|
||||
User,
|
||||
UserState,
|
||||
} from "@zitadel/proto/zitadel/user/v2/user_pb";
|
||||
import { unstable_cache } from "next/cache";
|
||||
import { unstable_cacheLife as cacheLife } from "next/cache";
|
||||
import { PROVIDER_MAPPING } from "./idp";
|
||||
|
||||
const SESSION_LIFETIME_S = 3600; // TODO load from oidc settings
|
||||
@@ -66,43 +60,19 @@ export const orgService = createOrganizationServiceClient(transport);
|
||||
export const settingsService = createSettingsServiceClient(transport);
|
||||
|
||||
export async function getBrandingSettings(organization?: string) {
|
||||
return unstable_cache(
|
||||
async () => {
|
||||
return await settingsService
|
||||
.getBrandingSettings({ ctx: makeReqCtx(organization) }, {})
|
||||
.then((resp) =>
|
||||
resp.settings
|
||||
? toJson(BrandingSettingsSchema, resp.settings)
|
||||
: undefined,
|
||||
);
|
||||
},
|
||||
["brandingSettings", organization ?? "default"],
|
||||
{
|
||||
revalidate: CACHE_REVALIDATION_INTERVAL_IN_SECONDS,
|
||||
tags: ["brandingSettings"],
|
||||
},
|
||||
)().then((resp) =>
|
||||
resp ? fromJson(BrandingSettingsSchema, resp) : undefined,
|
||||
);
|
||||
"use cache";
|
||||
cacheLife("hours");
|
||||
|
||||
return settingsService
|
||||
.getBrandingSettings({ ctx: makeReqCtx(organization) }, {})
|
||||
.then((resp) => (resp.settings ? resp.settings : undefined));
|
||||
}
|
||||
|
||||
export async function getLoginSettings(orgId?: string) {
|
||||
return unstable_cache(
|
||||
async () => {
|
||||
return await settingsService
|
||||
.getLoginSettings({ ctx: makeReqCtx(orgId) }, {})
|
||||
.then((resp) =>
|
||||
resp.settings
|
||||
? toJson(LoginSettingsSchema, resp.settings)
|
||||
: undefined,
|
||||
);
|
||||
},
|
||||
["loginSettings", orgId ?? "default"],
|
||||
{
|
||||
revalidate: CACHE_REVALIDATION_INTERVAL_IN_SECONDS,
|
||||
tags: ["loginSettings"],
|
||||
},
|
||||
)().then((resp) => (resp ? fromJson(LoginSettingsSchema, resp) : undefined));
|
||||
"use cache";
|
||||
return await settingsService
|
||||
.getLoginSettings({ ctx: makeReqCtx(orgId) }, {})
|
||||
.then((resp) => (resp.settings ? resp.settings : undefined));
|
||||
}
|
||||
|
||||
export async function listIDPLinks(userId: string) {
|
||||
@@ -132,51 +102,24 @@ export async function registerTOTP(userId: string) {
|
||||
}
|
||||
|
||||
export async function getGeneralSettings() {
|
||||
"use cache";
|
||||
return settingsService
|
||||
.getGeneralSettings({}, {})
|
||||
.then((resp) => resp.supportedLanguages);
|
||||
}
|
||||
|
||||
export async function getLegalAndSupportSettings(organization?: string) {
|
||||
return unstable_cache(
|
||||
async () => {
|
||||
return await settingsService
|
||||
.getLegalAndSupportSettings({ ctx: makeReqCtx(organization) }, {})
|
||||
.then((resp) =>
|
||||
resp.settings
|
||||
? toJson(LegalAndSupportSettingsSchema, resp.settings)
|
||||
: undefined,
|
||||
);
|
||||
},
|
||||
["legalAndSupportSettings", organization ?? "default"],
|
||||
{
|
||||
revalidate: CACHE_REVALIDATION_INTERVAL_IN_SECONDS,
|
||||
tags: ["legalAndSupportSettings"],
|
||||
},
|
||||
)().then((resp) =>
|
||||
resp ? fromJson(LegalAndSupportSettingsSchema, resp) : undefined,
|
||||
);
|
||||
"use cache";
|
||||
return settingsService
|
||||
.getLegalAndSupportSettings({ ctx: makeReqCtx(organization) }, {})
|
||||
.then((resp) => (resp.settings ? resp.settings : undefined));
|
||||
}
|
||||
|
||||
export async function getPasswordComplexitySettings(organization?: string) {
|
||||
return unstable_cache(
|
||||
async () => {
|
||||
return await settingsService
|
||||
.getPasswordComplexitySettings({ ctx: makeReqCtx(organization) })
|
||||
.then((resp) =>
|
||||
resp.settings
|
||||
? toJson(PasswordComplexitySettingsSchema, resp.settings)
|
||||
: undefined,
|
||||
);
|
||||
},
|
||||
["complexitySettings", organization ?? "default"],
|
||||
{
|
||||
revalidate: CACHE_REVALIDATION_INTERVAL_IN_SECONDS,
|
||||
tags: ["complexitySettings"],
|
||||
},
|
||||
)().then((resp) =>
|
||||
resp ? fromJson(PasswordComplexitySettingsSchema, resp) : undefined,
|
||||
);
|
||||
"use cache";
|
||||
return settingsService
|
||||
.getPasswordComplexitySettings({ ctx: makeReqCtx(organization) })
|
||||
.then((resp) => (resp.settings ? resp.settings : undefined));
|
||||
}
|
||||
|
||||
export async function createSessionFromChecks(
|
||||
|
||||
Reference in New Issue
Block a user