Skip to content

Commit 8fc8d26

Browse files
authored
Upgrade staging (#202)
* processor service * adds schema reference * switch to Json type * steperror * logging * logger * fmt * fix dev * healing step, fix moderator * args logs * curator notes * convert to submission * enhanced module federation
1 parent 53e87b9 commit 8fc8d26

27 files changed

+2341
-205
lines changed

apps/api/scripts/dev-server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const dotenv = require("dotenv");
66

77
// Path to the dist directory
88
const distDir = path.join(__dirname, "../dist");
9-
const mainJsPath = path.join(distDir, "main.js");
9+
const mainJsPath = path.join(distDir, "main.cjs");
1010
const envPath = path.join(__dirname, "../.env");
1111

1212
// Load environment variables from .env file

apps/api/src/routes/api/plugins.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ import {
55
selectPluginSchema,
66
updatePluginSchema,
77
} from "@curatedotfun/shared-db";
8+
import { AppErrorCode, ServiceError } from "@curatedotfun/utils";
89
import { zValidator } from "@hono/zod-validator";
910
import { Hono } from "hono";
1011
import { HTTPException } from "hono/http-exception";
1112
import { z } from "zod";
1213
import { db } from "../../db";
1314
import { Env } from "../../types/app";
14-
import { ServiceError } from "@curatedotfun/utils";
1515

1616
const pluginsRoutes = new Hono<Env>();
1717
const pluginRepository = new PluginRepository(db);
@@ -33,7 +33,7 @@ pluginsRoutes.post(
3333
console.error("Error registering plugin:", { error, pluginData });
3434
if (
3535
error instanceof ServiceError &&
36-
error.code === "PLUGIN_ALREADY_EXISTS"
36+
error.errorCode === AppErrorCode.RESOURCE_CONFLICT
3737
) {
3838
throw new HTTPException(409, { message: error.message });
3939
}

apps/api/src/routes/api/submission.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ submissionRoutes.get("/single/:submissionId", async (c) => {
129129
const db = c.get("db");
130130
const submissionRepository = new SubmissionRepository(db);
131131
const submissionId = c.req.param("submissionId");
132-
const richSubmission = await submissionRepository.getSubmission(submissionId);
132+
const richSubmission =
133+
await submissionRepository.getRichSubmission(submissionId);
133134

134135
if (!richSubmission) {
135136
return c.notFound();

apps/app/src/components/content-progress/data.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ export const templateElements: TemplateElement[] = [
3838
{
3939
id: "curatorNotes",
4040
title: "Curator Notes",
41-
description: "Notes from the curator ({{curator.notes}})",
42-
template: "💬 Curator notes: {{curator.notes}}",
41+
description: "Notes from the curator ({{curatorNotes}})",
42+
template: "💬 Curator notes: {{curatorNotes}}",
4343
},
4444
];
4545

apps/app/src/components/processing/ProcessingHistory.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
useProcessingSteps,
44
useRetryProcessingJob,
55
} from "@/lib/api";
6-
import { ProcessingJob, ProcessingStep } from "@/types/processing";
6+
import { ProcessingJob, ProcessingStep } from "@curatedotfun/types";
77
import {
88
createColumnHelper,
99
flexRender,

apps/app/src/components/processing/ProcessingStepDetails.tsx

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { ProcessingStep } from "@curatedotfun/types";
2-
import { Link } from "@tanstack/react-router";
32
import {
43
Dialog,
54
DialogContent,
@@ -57,16 +56,7 @@ export function ProcessingStepDetails({
5756
<DialogHeader>
5857
<DialogTitle className="flex items-center justify-between">
5958
<div className="flex items-center gap-2">
60-
Processing Step:{" "}
61-
<Link
62-
to="/plugin/$pluginId"
63-
params={{
64-
pluginId: step.plugin.id,
65-
}}
66-
className="text-blue-600 hover:underline"
67-
>
68-
{step.plugin.name}
69-
</Link>
59+
Processing Step: {step.stepName}
7060
<Badge
7161
variant={
7262
step.status === "success"
@@ -135,6 +125,7 @@ export function ProcessingStepDetails({
135125
<TabsList>
136126
<TabsTrigger value="input">Input</TabsTrigger>
137127
<TabsTrigger value="output">Output</TabsTrigger>
128+
{step.config && <TabsTrigger value="config">Config</TabsTrigger>}
138129
{step.error && <TabsTrigger value="error">Error</TabsTrigger>}
139130
</TabsList>
140131
<TabsContent value="input" className="flex-1 overflow-hidden">
@@ -149,6 +140,13 @@ export function ProcessingStepDetails({
149140
</pre>
150141
</div>
151142
</TabsContent>
143+
{step.config && (
144+
<TabsContent value="config" className="flex-1 overflow-hidden">
145+
<div className="h-[300px] w-full rounded-md border p-4 overflow-auto">
146+
<pre className="text-sm">{formatJson(step.config)}</pre>
147+
</div>
148+
</TabsContent>
149+
)}
152150
{step.error && (
153151
<TabsContent value="error" className="flex-1 overflow-hidden">
154152
<div className="h-[300px] w-full rounded-md border p-4 bg-red-50 dark:bg-red-950 overflow-auto">

apps/app/src/store/feed-creation-store.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const feedCreationStateCreator: StateCreator<
4545
plugin: "@curatedotfun/object-transform",
4646
config: {
4747
mappings: {
48-
notes: "{{curator.notes}}",
48+
notes: "{{curatorNotes}}",
4949
author: "{{username}}",
5050
source: "https://x.com/{{username}}/status/{{tweetId}}",
5151
content: "{{content}}",

apps/worker/rspack.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,8 @@ module.exports = {
3434
new rspack.IgnorePlugin({
3535
resourceRegExp: /^pg-native$|^cloudflare:sockets$/,
3636
}),
37+
new rspack.container.ModuleFederationPlugin({
38+
name: "host",
39+
}),
3740
].filter(Boolean),
3841
};

packages/core-services/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
"@curatedotfun/types": "workspace:*",
1818
"@curatedotfun/utils": "workspace:*",
1919
"@fastnear/utils": "^0.9.7",
20-
"@module-federation/node": "^2.7.7",
21-
"@module-federation/runtime": "^0.11.4",
20+
"@module-federation/enhanced": "^0.15.0",
21+
"@rspack/core": "1.2.8",
2222
"@t3-oss/env-core": "^0.13.8",
2323
"@types/mustache": "^4.2.6",
2424
"agent-twitter-client": "0.0.16",

packages/core-services/src/services/feed.service.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,6 @@ export class FeedService implements IBaseService {
266266
);
267267
}
268268
}
269-
270-
// The enqueueing is now handled by the moderation service
271-
// await this.processingService.process(submission, streamConfig);
272269
processedCount++;
273270
} catch (error) {
274271
this.logger.error(

0 commit comments

Comments
 (0)