mirror of
https://github.com/stack-auth/stack.git
synced 2026-07-20 21:29:36 +08:00
Fix agent-auth back-compat defaults
Co-Authored-By: madison@stack-auth.com <madison.w.kennedy@gmail.com>
This commit is contained in:
parent
6c75d8ff43
commit
a845c87242
@ -47,6 +47,7 @@ type App = {
|
||||
stage: "alpha" | "beta" | "stable",
|
||||
parentAppId?: ParentAppId,
|
||||
independentlyEnableable?: boolean,
|
||||
includedInDefaultInstalledApps?: boolean,
|
||||
};
|
||||
|
||||
export type AppId = keyof typeof ALL_APPS;
|
||||
@ -71,6 +72,7 @@ export const ALL_APPS = {
|
||||
stage: "alpha",
|
||||
parentAppId: "authentication",
|
||||
independentlyEnableable: true,
|
||||
includedInDefaultInstalledApps: false,
|
||||
},
|
||||
"fraud-protection": {
|
||||
displayName: "Fraud Protection",
|
||||
|
||||
24
packages/shared/src/config/schema.test.ts
Normal file
24
packages/shared/src/config/schema.test.ts
Normal file
@ -0,0 +1,24 @@
|
||||
import { ALL_APPS } from "../apps/apps-config";
|
||||
import { applyOrganizationDefaults } from "./schema";
|
||||
import { expect } from "vitest";
|
||||
|
||||
import.meta.vitest?.test("agent-auth is absent from default installed apps", () => {
|
||||
const defaults = applyOrganizationDefaults({});
|
||||
|
||||
expect(Object.keys(defaults.apps.installed)).not.toContain("agent-auth");
|
||||
});
|
||||
|
||||
import.meta.vitest?.test("agent-auth stays explicitly enableable", () => {
|
||||
const defaults = applyOrganizationDefaults({
|
||||
apps: {
|
||||
installed: {
|
||||
"agent-auth": {
|
||||
enabled: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
expect(defaults.apps.installed["agent-auth"].enabled).toBe(true);
|
||||
expect(ALL_APPS["agent-auth"].independentlyEnableable).toBe(true);
|
||||
});
|
||||
@ -293,6 +293,14 @@ const branchOnboardingSchema = yupObject({
|
||||
requireEmailVerification: yupBoolean(),
|
||||
});
|
||||
|
||||
const installedAppIdsByDefault = typedEntries(ALL_APPS)
|
||||
.filter(([, app]) => {
|
||||
if ("includedInDefaultInstalledApps" in app) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
})
|
||||
.map(([appId]) => appId);
|
||||
|
||||
export const branchConfigSchema = canNoLongerBeOverridden(projectConfigSchema, [
|
||||
"sourceOfTruth",
|
||||
@ -745,7 +753,7 @@ const organizationConfigDefaults = {
|
||||
},
|
||||
|
||||
apps: {
|
||||
installed: typedFromEntries(appIds.map(appId => [appId, { enabled: false }])) as Record<string, { enabled: boolean } | undefined>,
|
||||
installed: typedFromEntries(installedAppIdsByDefault.map((appId) => [appId, { enabled: false }])),
|
||||
},
|
||||
|
||||
teams: {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user