fix(server-build): entferne Pfadalias '@/server/*' im Server-Code, nutze relative Imports; passe RPC-Route-Import und OpenAI-Import an; Server-Build nutzt CommonJS/Node Resolution
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import { RPCHandler } from "@orpc/server/fetch";
|
import { RPCHandler } from "@orpc/server/fetch";
|
||||||
|
|
||||||
import { router } from "@/server/rpc";
|
import { router } from "../rpc";
|
||||||
import { Hono } from "hono";
|
import { Hono } from "hono";
|
||||||
|
|
||||||
export const rpcApp = new Hono();
|
export const rpcApp = new Hono();
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import { call, os } from "@orpc/server";
|
import { call, os } from "@orpc/server";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { randomUUID } from "crypto";
|
import { randomUUID } from "crypto";
|
||||||
import { createKV } from "@/server/lib/create-kv";
|
import { createKV } from "../lib/create-kv";
|
||||||
|
|
||||||
const AvailabilitySchema = z.object({
|
const AvailabilitySchema = z.object({
|
||||||
id: z.string(),
|
id: z.string(),
|
||||||
|
@@ -1,15 +1,15 @@
|
|||||||
import { call, os } from "@orpc/server";
|
import { call, os } from "@orpc/server";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { randomUUID } from "crypto";
|
import { randomUUID } from "crypto";
|
||||||
import { createKV } from "@/server/lib/create-kv";
|
import { createKV } from "../lib/create-kv";
|
||||||
import { createKV as createAvailabilityKV } from "@/server/lib/create-kv";
|
import { createKV as createAvailabilityKV } from "../lib/create-kv";
|
||||||
import { sendEmail, sendEmailWithAGB, sendEmailWithAGBAndCalendar, sendEmailWithInspirationPhoto } from "@/server/lib/email";
|
import { sendEmail, sendEmailWithAGB, sendEmailWithAGBAndCalendar, sendEmailWithInspirationPhoto } from "../lib/email";
|
||||||
import { renderBookingPendingHTML, renderBookingConfirmedHTML, renderBookingCancelledHTML, renderAdminBookingNotificationHTML } from "@/server/lib/email-templates";
|
import { renderBookingPendingHTML, renderBookingConfirmedHTML, renderBookingCancelledHTML, renderAdminBookingNotificationHTML } from "../lib/email-templates";
|
||||||
import { router as rootRouter } from "@/server/rpc";
|
import { router as rootRouter } from "..";
|
||||||
import { createORPCClient } from "@orpc/client";
|
import { createORPCClient } from "@orpc/client";
|
||||||
import { RPCLink } from "@orpc/client/fetch";
|
import { RPCLink } from "@orpc/client/fetch";
|
||||||
import { checkBookingRateLimit, getClientIP } from "@/server/lib/rate-limiter";
|
import { checkBookingRateLimit, getClientIP } from "../lib/rate-limiter";
|
||||||
import { validateEmail } from "@/server/lib/email-validator";
|
import { validateEmail } from "../lib/email-validator";
|
||||||
|
|
||||||
// Create a server-side client to call other RPC endpoints
|
// Create a server-side client to call other RPC endpoints
|
||||||
const link = new RPCLink({ url: "http://localhost:5173/rpc" });
|
const link = new RPCLink({ url: "http://localhost:5173/rpc" });
|
||||||
@@ -59,7 +59,7 @@ type Availability = {
|
|||||||
const availabilityKV = createAvailabilityKV<Availability>("availability");
|
const availabilityKV = createAvailabilityKV<Availability>("availability");
|
||||||
|
|
||||||
// Import treatments KV for admin notifications
|
// Import treatments KV for admin notifications
|
||||||
import { createKV as createTreatmentsKV } from "@/server/lib/create-kv";
|
import { createKV as createTreatmentsKV } from "../lib/create-kv";
|
||||||
type Treatment = {
|
type Treatment = {
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import { call, os } from "@orpc/server";
|
import { call, os } from "@orpc/server";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { createKV } from "@/server/lib/create-kv";
|
import { createKV } from "../lib/create-kv";
|
||||||
import { createKV as createAvailabilityKV } from "@/server/lib/create-kv";
|
import { createKV as createAvailabilityKV } from "@/server/lib/create-kv";
|
||||||
import { randomUUID } from "crypto";
|
import { randomUUID } from "crypto";
|
||||||
|
|
||||||
|
@@ -2,7 +2,7 @@ import OpenAI from "openai";
|
|||||||
import { os } from "@orpc/server";
|
import { os } from "@orpc/server";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
||||||
import { zodResponseFormat } from "@/server/lib/openai";
|
import { zodResponseFormat } from "../../lib/openai";
|
||||||
|
|
||||||
if (!process.env.OPENAI_BASE_URL) {
|
if (!process.env.OPENAI_BASE_URL) {
|
||||||
throw new Error("OPENAI_BASE_URL is not set");
|
throw new Error("OPENAI_BASE_URL is not set");
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import { os } from "@orpc/server";
|
import { os } from "@orpc/server";
|
||||||
import { getLegalConfig } from "@/server/lib/legal-config";
|
import { getLegalConfig } from "../lib/legal-config";
|
||||||
|
|
||||||
export const router = {
|
export const router = {
|
||||||
getConfig: os.handler(async () => {
|
getConfig: os.handler(async () => {
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import { call, os } from "@orpc/server";
|
import { call, os } from "@orpc/server";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { randomUUID } from "crypto";
|
import { randomUUID } from "crypto";
|
||||||
import { createKV } from "@/server/lib/create-kv";
|
import { createKV } from "../lib/create-kv";
|
||||||
|
|
||||||
const TreatmentSchema = z.object({
|
const TreatmentSchema = z.object({
|
||||||
id: z.string(),
|
id: z.string(),
|
||||||
|
@@ -5,10 +5,11 @@
|
|||||||
"outDir": "server-dist",
|
"outDir": "server-dist",
|
||||||
"sourceMap": false,
|
"sourceMap": false,
|
||||||
"declaration": false,
|
"declaration": false,
|
||||||
"module": "NodeNext",
|
"module": "CommonJS",
|
||||||
"moduleResolution": "NodeNext",
|
"moduleResolution": "Node",
|
||||||
"allowImportingTsExtensions": false,
|
"allowImportingTsExtensions": false,
|
||||||
"target": "ES2022"
|
"target": "ES2022",
|
||||||
|
"baseUrl": "."
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"src/server/**/*.ts",
|
"src/server/**/*.ts",
|
||||||
|
Reference in New Issue
Block a user