mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-13 21:01:21 +08:00
rename
This commit is contained in:
parent
9ceb0acac3
commit
1afbf069c4
@ -1,6 +1,6 @@
|
||||
/* eslint-disable no-restricted-syntax */
|
||||
import { usersCrudHandlers } from '@/app/api/latest/users/crud';
|
||||
import { createOrUpdateProject, getProject } from '@/lib/projects';
|
||||
import { createOrUpdateProjectWithLegacyConfig, getProject } from '@/lib/projects';
|
||||
import { DEFAULT_BRANCH_ID, getSoleTenancyFromProjectBranch } from '@/lib/tenancies';
|
||||
import { getPrismaClientForTenancy } from '@/prisma-client';
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
@ -34,7 +34,7 @@ async function seed() {
|
||||
let internalProject = await getProject('internal');
|
||||
|
||||
if (!internalProject) {
|
||||
internalProject = await createOrUpdateProject({
|
||||
internalProject = await createOrUpdateProjectWithLegacyConfig({
|
||||
type: 'create',
|
||||
projectId: 'internal',
|
||||
data: {
|
||||
@ -60,7 +60,7 @@ async function seed() {
|
||||
const internalTenancy = await getSoleTenancyFromProjectBranch("internal", DEFAULT_BRANCH_ID);
|
||||
const internalPrisma = await getPrismaClientForTenancy(internalTenancy);
|
||||
|
||||
internalProject = await createOrUpdateProject({
|
||||
internalProject = await createOrUpdateProjectWithLegacyConfig({
|
||||
projectId: 'internal',
|
||||
branchId: DEFAULT_BRANCH_ID,
|
||||
type: 'update',
|
||||
@ -237,7 +237,7 @@ async function seed() {
|
||||
if (existingProject) {
|
||||
console.log('Emulator project already exists, skipping creation');
|
||||
} else {
|
||||
await createOrUpdateProject({
|
||||
await createOrUpdateProjectWithLegacyConfig({
|
||||
projectId: emulatorProjectId,
|
||||
type: 'create',
|
||||
data: {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { createApiKeySet } from "@/lib/internal-api-keys";
|
||||
import { createOrUpdateProject } from "@/lib/projects";
|
||||
import { createOrUpdateProjectWithLegacyConfig } from "@/lib/projects";
|
||||
import { globalPrismaClient } from "@/prisma-client";
|
||||
import { createSmartRouteHandler } from "@/route-handlers/smart-route-handler";
|
||||
import { neonAuthorizationHeaderSchema, projectDisplayNameSchema, yupNumber, yupObject, yupString, yupTuple } from "@stackframe/stack-shared/dist/schema-fields";
|
||||
@ -28,7 +28,7 @@ export const POST = createSmartRouteHandler({
|
||||
handler: async (req) => {
|
||||
const [clientId] = decodeBasicAuthorizationHeader(req.headers.authorization[0])!;
|
||||
|
||||
const createdProject = await createOrUpdateProject({
|
||||
const createdProject = await createOrUpdateProjectWithLegacyConfig({
|
||||
ownerIds: [],
|
||||
type: 'create',
|
||||
data: {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { createOrUpdateProject } from "@/lib/projects";
|
||||
import { createOrUpdateProjectWithLegacyConfig } from "@/lib/projects";
|
||||
import { Tenancy, getTenancy } from "@/lib/tenancies";
|
||||
import { createCrudHandlers } from "@/route-handlers/crud-handler";
|
||||
import { createCrud } from "@stackframe/stack-shared/dist/crud";
|
||||
@ -97,7 +97,7 @@ export const oauthProvidersCrudHandlers = createLazyProxy(() => createCrudHandle
|
||||
throw new StatusError(StatusError.BadRequest, 'OAuth provider already exists');
|
||||
}
|
||||
|
||||
await createOrUpdateProject({
|
||||
await createOrUpdateProjectWithLegacyConfig({
|
||||
type: 'update',
|
||||
projectId: auth.project.id,
|
||||
branchId: auth.branchId,
|
||||
@ -124,7 +124,7 @@ export const oauthProvidersCrudHandlers = createLazyProxy(() => createCrudHandle
|
||||
throw new StatusError(StatusError.NotFound, 'OAuth provider not found');
|
||||
}
|
||||
|
||||
await createOrUpdateProject({
|
||||
await createOrUpdateProjectWithLegacyConfig({
|
||||
type: 'update',
|
||||
projectId: auth.project.id,
|
||||
branchId: auth.branchId,
|
||||
@ -153,7 +153,7 @@ export const oauthProvidersCrudHandlers = createLazyProxy(() => createCrudHandle
|
||||
throw new StatusError(StatusError.NotFound, 'OAuth provider not found');
|
||||
}
|
||||
|
||||
await createOrUpdateProject({
|
||||
await createOrUpdateProjectWithLegacyConfig({
|
||||
type: 'update',
|
||||
projectId: auth.project.id,
|
||||
branchId: auth.branchId,
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { createApiKeySet } from "@/lib/internal-api-keys";
|
||||
import { createOrUpdateProject } from "@/lib/projects";
|
||||
import { createOrUpdateProjectWithLegacyConfig } from "@/lib/projects";
|
||||
import { globalPrismaClient } from "@/prisma-client";
|
||||
import { createSmartRouteHandler } from "@/route-handlers/smart-route-handler";
|
||||
import { neonAuthorizationHeaderSchema, projectDisplayNameSchema, yupArray, yupNumber, yupObject, yupString, yupTuple } from "@stackframe/stack-shared/dist/schema-fields";
|
||||
@ -32,7 +32,7 @@ export const POST = createSmartRouteHandler({
|
||||
handler: async (req) => {
|
||||
const [clientId] = decodeBasicAuthorizationHeader(req.headers.authorization[0])!;
|
||||
|
||||
const createdProject = await createOrUpdateProject({
|
||||
const createdProject = await createOrUpdateProjectWithLegacyConfig({
|
||||
ownerIds: [],
|
||||
sourceOfTruth: req.body.connection_strings ? {
|
||||
type: 'neon',
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { renderedOrganizationConfigToProjectCrud } from "@/lib/config";
|
||||
import { createOrUpdateProject, getProjectQuery, listManagedProjectIds } from "@/lib/projects";
|
||||
import { createOrUpdateProjectWithLegacyConfig, getProjectQuery, listManagedProjectIds } from "@/lib/projects";
|
||||
import { DEFAULT_BRANCH_ID, getSoleTenancyFromProjectBranch } from "@/lib/tenancies";
|
||||
import { globalPrismaClient, rawQueryAll } from "@/prisma-client";
|
||||
import { createCrudHandlers } from "@/route-handlers/crud-handler";
|
||||
@ -30,7 +30,7 @@ export const adminUserProjectsCrudHandlers = createLazyProxy(() => createCrudHan
|
||||
const ownerPack = ownerPacks.find(p => p.has(user.id));
|
||||
const userIds = ownerPack ? [...ownerPack] : [user.id];
|
||||
|
||||
const project = await createOrUpdateProject({
|
||||
const project = await createOrUpdateProjectWithLegacyConfig({
|
||||
ownerIds: userIds,
|
||||
type: 'create',
|
||||
data,
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { renderedOrganizationConfigToProjectCrud } from "@/lib/config";
|
||||
import { createOrUpdateProject } from "@/lib/projects";
|
||||
import { createOrUpdateProjectWithLegacyConfig } from "@/lib/projects";
|
||||
import { getTenancy } from "@/lib/tenancies";
|
||||
import { getPrismaClientForTenancy, globalPrismaClient } from "@/prisma-client";
|
||||
import { createCrudHandlers } from "@/route-handlers/crud-handler";
|
||||
@ -17,7 +17,7 @@ export const projectsCrudHandlers = createLazyProxy(() => createCrudHandlers(pro
|
||||
) {
|
||||
throw new StatusError(400, "Invalid email theme");
|
||||
}
|
||||
const project = await createOrUpdateProject({
|
||||
const project = await createOrUpdateProjectWithLegacyConfig({
|
||||
type: "update",
|
||||
projectId: auth.project.id,
|
||||
branchId: auth.branchId,
|
||||
|
||||
@ -60,7 +60,7 @@ export async function getProject(projectId: string): Promise<Omit<ProjectsCrud["
|
||||
return result;
|
||||
}
|
||||
|
||||
export async function createOrUpdateProject(
|
||||
export async function createOrUpdateProjectWithLegacyConfig(
|
||||
options: {
|
||||
ownerIds?: string[],
|
||||
sourceOfTruth?: ProjectConfigOverrideOverride["sourceOfTruth"],
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import { InternalSession } from "../sessions";
|
||||
import { ConfigOverridesCrud } from "./crud/config-overrides";
|
||||
import { EmailTemplateCrud, EmailTemplateType } from "./crud/email-templates";
|
||||
import { InternalEmailsCrud } from "./crud/emails";
|
||||
import { InternalApiKeysCrud } from "./crud/internal-api-keys";
|
||||
@ -471,4 +472,22 @@ export class StackAdminInterface extends StackServerInterface {
|
||||
);
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
async getConfigOverrides(): Promise<ConfigOverridesCrud["Admin"]["Read"]> {
|
||||
const response = await this.sendAdminRequest(
|
||||
`/internal/config-overrides`,
|
||||
{ method: "GET" },
|
||||
null,
|
||||
);
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
async updateConfigOverrides(data: ConfigOverridesCrud["Admin"]["Update"]): Promise<ConfigOverridesCrud["Admin"]["Read"]> {
|
||||
const response = await this.sendAdminRequest(
|
||||
`/internal/config-overrides`,
|
||||
{ method: "PATCH", body: JSON.stringify(data) },
|
||||
null,
|
||||
);
|
||||
return await response.json();
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user