@musnows/scriverse 0.5.5 → 0.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai.js +7 -7
- package/dist/ai.js.map +1 -1
- package/dist/app.js +46 -0
- package/dist/app.js.map +1 -1
- package/dist/database.js +81 -0
- package/dist/database.js.map +1 -1
- package/dist/public/app.js +559 -5
- package/dist/public/index.html +70 -3
- package/dist/public/styles.css +59 -0
- package/dist/store.js +425 -30
- package/dist/store.js.map +1 -1
- package/dist/user-auth.js +11 -1
- package/dist/user-auth.js.map +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/app.js
CHANGED
|
@@ -993,6 +993,12 @@ export function createRuntime(options) {
|
|
|
993
993
|
const input = parse(z.object({ volumeId: identifier, title: nonEmpty.max(300), content: z.string().max(2_000_000).optional(), chapterType: chapterTypeSchema.optional() }), request.body);
|
|
994
994
|
data(response, store.createChapter(request.params.workId, input), 201);
|
|
995
995
|
});
|
|
996
|
+
app.get("/api/works/:workId/deleted-chapters", (request, response) => {
|
|
997
|
+
const pagination = parsePagination(request.query);
|
|
998
|
+
data(response, pagination
|
|
999
|
+
? store.listDeletedChaptersPage(request.params.workId, pagination)
|
|
1000
|
+
: store.listDeletedChapters(request.params.workId));
|
|
1001
|
+
});
|
|
996
1002
|
app.get("/api/chapters/:chapterId", (request, response) => data(response, store.getChapter(request.params.chapterId)));
|
|
997
1003
|
app.patch("/api/chapters/:chapterId", (request, response) => {
|
|
998
1004
|
const input = parse(z.object({ title: nonEmpty.max(300).optional(), content: z.string().max(2_000_000).optional(), excludedFromAnalysis: z.boolean().optional(), chapterType: chapterTypeSchema.optional(), source: z.enum(["manual", "auto"]).optional(), changeNote: changeNoteSchema, expectedVersionNo: expectedVersionNoSchema }).strict(), request.body);
|
|
@@ -1013,6 +1019,26 @@ export function createRuntime(options) {
|
|
|
1013
1019
|
const pagination = parsePagination(request.query);
|
|
1014
1020
|
data(response, pagination ? store.listChapterInsightsPage(request.params.chapterId, pagination) : store.listChapterInsights(request.params.chapterId));
|
|
1015
1021
|
});
|
|
1022
|
+
app.get("/api/chapters/:chapterId/annotations", (request, response) => data(response, store.listChapterAnnotations(request.params.chapterId)));
|
|
1023
|
+
app.post("/api/chapters/:chapterId/annotations", (request, response) => {
|
|
1024
|
+
const input = parse(z.object({
|
|
1025
|
+
kind: z.enum(["note", "todo"]),
|
|
1026
|
+
startLine: z.number().int().positive(),
|
|
1027
|
+
endLine: z.number().int().positive(),
|
|
1028
|
+
note: z.string().trim().min(1).max(2000)
|
|
1029
|
+
}).strict().refine((value) => value.endLine >= value.startLine, { message: "结束行不能早于开始行", path: ["endLine"] }), request.body);
|
|
1030
|
+
data(response, store.createChapterAnnotation(request.params.chapterId, input), 201);
|
|
1031
|
+
});
|
|
1032
|
+
app.patch("/api/chapter-annotations/:annotationId", (request, response) => {
|
|
1033
|
+
const input = parse(z.object({ note: z.string().trim().min(1).max(2000).optional(), status: z.enum(["open", "resolved"]).optional(), expectedVersionNo: expectedVersionNoSchema }).strict().refine((value) => value.note !== undefined || value.status !== undefined, { message: "至少需要修改一项" }), request.body);
|
|
1034
|
+
const { expectedVersionNo, ...update } = input;
|
|
1035
|
+
data(response, store.updateChapterAnnotation(request.params.annotationId, update, expectedVersionNo));
|
|
1036
|
+
});
|
|
1037
|
+
app.delete("/api/chapter-annotations/:annotationId", (request, response) => {
|
|
1038
|
+
const input = parse(z.object({ expectedVersionNo: expectedVersionNoSchema }).strict(), request.body ?? {});
|
|
1039
|
+
store.deleteChapterAnnotation(request.params.annotationId, input.expectedVersionNo);
|
|
1040
|
+
noContent(response);
|
|
1041
|
+
});
|
|
1016
1042
|
app.post("/api/chapters/:chapterId/restore", (request, response) => {
|
|
1017
1043
|
const input = parse(z.object({ versionNo: z.number().int().positive(), expectedVersionNo: expectedVersionNoSchema }).strict(), request.body);
|
|
1018
1044
|
const chapter = store.restoreChapter(request.params.chapterId, input.versionNo, input.expectedVersionNo);
|
|
@@ -1023,6 +1049,17 @@ export function createRuntime(options) {
|
|
|
1023
1049
|
const { expectedVersionNo, ...moveInput } = input;
|
|
1024
1050
|
data(response, store.moveChapter(request.params.chapterId, moveInput, expectedVersionNo));
|
|
1025
1051
|
});
|
|
1052
|
+
app.post("/api/works/:workId/chapters/batch", (request, response) => {
|
|
1053
|
+
const selectedChapters = z.array(z.object({ id: identifier, expectedVersionNo: z.number().int().positive() }).strict()).min(1).max(200);
|
|
1054
|
+
const action = z.discriminatedUnion("type", [
|
|
1055
|
+
z.object({ type: z.literal("move"), volumeId: identifier }).strict(),
|
|
1056
|
+
z.object({ type: z.literal("setType"), chapterType: chapterTypeSchema }).strict(),
|
|
1057
|
+
z.object({ type: z.literal("setAnalysisExclusion"), excludedFromAnalysis: z.boolean() }).strict(),
|
|
1058
|
+
z.object({ type: z.literal("delete") }).strict()
|
|
1059
|
+
]);
|
|
1060
|
+
const input = parse(z.object({ chapters: selectedChapters, action }).strict(), request.body);
|
|
1061
|
+
data(response, store.batchManageChapters(request.params.workId, input.chapters, input.action));
|
|
1062
|
+
});
|
|
1026
1063
|
app.get("/api/works/:workId/outlines", (request, response) => {
|
|
1027
1064
|
const pagination = parsePagination(request.query);
|
|
1028
1065
|
data(response, pagination ? store.listChapterOutlinesPage(request.params.workId, pagination) : store.listChapterOutlines(request.params.workId));
|
|
@@ -1833,6 +1870,15 @@ export function createRuntime(options) {
|
|
|
1833
1870
|
const pagination = parsePagination(request.query);
|
|
1834
1871
|
data(response, pagination ? store.listAuditLogsPage(request.params.workId, pagination) : store.listAuditLogs(request.params.workId));
|
|
1835
1872
|
});
|
|
1873
|
+
app.get("/api/works/:workId/writing-progress", (request, response) => data(response, store.getWritingProgress(request.params.workId)));
|
|
1874
|
+
app.put("/api/works/:workId/writing-goal", (request, response) => {
|
|
1875
|
+
const input = parse(z.object({
|
|
1876
|
+
dailyGoal: z.number().int().min(0).max(1_000_000),
|
|
1877
|
+
targetTotal: z.number().int().min(0).max(100_000_000),
|
|
1878
|
+
deadline: z.string().date().nullable()
|
|
1879
|
+
}).strict(), request.body);
|
|
1880
|
+
data(response, store.updateWritingGoal(request.params.workId, input));
|
|
1881
|
+
});
|
|
1836
1882
|
if (options.serveUi ?? true) {
|
|
1837
1883
|
const publicPath = options.publicPath ?? join(process.cwd(), "src", "public");
|
|
1838
1884
|
// index.html 按登录态动态下发:未登录时注入 login-route 类,首帧直接渲染登录页;
|