@musnows/scriverse 1.1.3 → 1.1.5
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/app.js +37 -3
- package/dist/app.js.map +1 -1
- package/dist/chapter-title-numbering.js +210 -0
- package/dist/chapter-title-numbering.js.map +1 -1
- package/dist/cli-contract.js +15 -6
- package/dist/cli-contract.js.map +1 -1
- package/dist/cli-core.js +37 -1
- package/dist/cli-core.js.map +1 -1
- package/dist/database.js +21 -2
- package/dist/database.js.map +1 -1
- package/dist/image-captcha.js +35 -9
- package/dist/image-captcha.js.map +1 -1
- package/dist/public/app.js +509 -65
- package/dist/public/index.html +22 -3
- package/dist/public/styles.css +16 -2
- package/dist/store.js +190 -10
- package/dist/store.js.map +1 -1
- package/dist/user-auth.js +5 -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
|
@@ -36,7 +36,7 @@ import { isOfficialGoogleVertexBaseUrl, parseGoogleServiceAccount } from "./goog
|
|
|
36
36
|
import { HYBRID_SEARCH_TYPES, MAXIMUM_WORK_SEARCH_QUERY_LENGTH, readableHybridSearchTypes } from "./hybrid-search.js";
|
|
37
37
|
import { applyImportFileHints, parseNovelText } from "./parser.js";
|
|
38
38
|
import { MAX_CHAPTER_LINE_IDS } from "./chapter-annotation-anchor.js";
|
|
39
|
-
import { isChapterNumberTemplate } from "./chapter-title-numbering.js";
|
|
39
|
+
import { chapterTitlePreferences, isChapterNumberTemplate } from "./chapter-title-numbering.js";
|
|
40
40
|
import { aiConversationTaskTypes, attachmentPermissionModules, RECYCLE_BIN_RETENTION_DAYS, Store, versionedEntityTypes, WORK_AGENT_TOOL_IDS } from "./store.js";
|
|
41
41
|
import { composeRoleplayStoredUserContent } from "./roleplay-turn.js";
|
|
42
42
|
import { ROLEPLAY_MEMORY_CATEGORIES, ROLEPLAY_MEMORY_CERTAINTY, ROLEPLAY_MEMORY_IMPORTANCE, ROLEPLAY_MEMORY_STATUSES } from "./roleplay-memory.js";
|
|
@@ -257,7 +257,8 @@ const workSchema = z.object({
|
|
|
257
257
|
coverUrl: z.string().url().nullable().optional(),
|
|
258
258
|
tags: optionalStrings,
|
|
259
259
|
editorAutoIndentEnabled: z.boolean().optional(),
|
|
260
|
-
editorTypewriterModeEnabled: z.boolean().optional()
|
|
260
|
+
editorTypewriterModeEnabled: z.boolean().optional(),
|
|
261
|
+
chapterTitleFormat: z.enum(chapterTitlePreferences).optional()
|
|
261
262
|
});
|
|
262
263
|
const workOfflineAccessSchema = z.object({ enabled: z.boolean() }).strict();
|
|
263
264
|
const settingSchema = z.object({
|
|
@@ -2436,6 +2437,9 @@ export function createRuntime(options) {
|
|
|
2436
2437
|
store.deleteVolume(request.params.volumeId, input.expectedVersionNo);
|
|
2437
2438
|
noContent(response);
|
|
2438
2439
|
});
|
|
2440
|
+
app.post("/api/volumes/:volumeId/renumber-titles", (request, response) => {
|
|
2441
|
+
data(response, store.renumberVolumeChapterTitles(request.params.volumeId));
|
|
2442
|
+
});
|
|
2439
2443
|
app.post("/api/volumes/:volumeId/restore", (request, response) => {
|
|
2440
2444
|
const input = parse(z.object({ expectedVersionNo: expectedVersionNoSchema }).strict(), request.body ?? {});
|
|
2441
2445
|
data(response, store.restoreVolume(request.params.volumeId, input.expectedVersionNo));
|
|
@@ -2446,8 +2450,32 @@ export function createRuntime(options) {
|
|
|
2446
2450
|
await cleanupAttachments();
|
|
2447
2451
|
noContent(response);
|
|
2448
2452
|
});
|
|
2453
|
+
app.get("/api/works/:workId/chapter-title-format", (request, response) => {
|
|
2454
|
+
data(response, store.describeChapterTitleFormat(request.params.workId));
|
|
2455
|
+
});
|
|
2456
|
+
app.patch("/api/works/:workId/chapter-title-format", (request, response) => {
|
|
2457
|
+
const input = parse(z.object({
|
|
2458
|
+
chapterTitleFormat: z.enum(chapterTitlePreferences),
|
|
2459
|
+
expectedVersionNo: expectedVersionNoSchema
|
|
2460
|
+
}).strict(), request.body);
|
|
2461
|
+
const work = store.updateWork(request.params.workId, { chapterTitleFormat: input.chapterTitleFormat }, input.expectedVersionNo, "manual", null, "更新章节标题编号格式");
|
|
2462
|
+
data(response, {
|
|
2463
|
+
...store.describeChapterTitleFormat(request.params.workId),
|
|
2464
|
+
versionNo: Number(work.versionNo)
|
|
2465
|
+
});
|
|
2466
|
+
});
|
|
2449
2467
|
app.post("/api/works/:workId/chapters", (request, response) => {
|
|
2450
|
-
const input = parse(z.object({
|
|
2468
|
+
const input = parse(z.object({
|
|
2469
|
+
volumeId: identifier,
|
|
2470
|
+
title: nonEmpty.max(300),
|
|
2471
|
+
content: z.string().max(2_000_000).optional(),
|
|
2472
|
+
chapterType: chapterTypeSchema.optional(),
|
|
2473
|
+
insertAfterChapterId: identifier.optional(),
|
|
2474
|
+
insertBeforeChapterId: identifier.optional(),
|
|
2475
|
+
numberTitle: z.boolean().optional()
|
|
2476
|
+
}).strict().refine((value) => value.insertAfterChapterId === undefined || value.insertBeforeChapterId === undefined, {
|
|
2477
|
+
message: "不能同时指定章节前后插入位置"
|
|
2478
|
+
}), request.body);
|
|
2451
2479
|
data(response, store.createChapter(request.params.workId, input), 201);
|
|
2452
2480
|
});
|
|
2453
2481
|
app.get("/api/works/:workId/deleted-chapters", (request, response) => {
|
|
@@ -2460,6 +2488,12 @@ export function createRuntime(options) {
|
|
|
2460
2488
|
data(response, store.getRecycleBin(request.params.workId));
|
|
2461
2489
|
});
|
|
2462
2490
|
app.get("/api/chapters/:chapterId", (request, response) => data(response, store.getChapter(request.params.chapterId)));
|
|
2491
|
+
app.post("/api/chapters/:chapterId/apply-title-number", (request, response) => {
|
|
2492
|
+
const input = parse(z.object({ title: nonEmpty.max(300), expectedVersionNo: expectedVersionNoSchema }).strict(), request.body);
|
|
2493
|
+
const chapter = store.applyChapterTitleNumber(request.params.chapterId, input.title, input.expectedVersionNo);
|
|
2494
|
+
publishEditorChange(String(chapter.workId), String(chapter.id));
|
|
2495
|
+
data(response, chapter);
|
|
2496
|
+
});
|
|
2463
2497
|
app.patch("/api/chapters/:chapterId", (request, response) => {
|
|
2464
2498
|
const input = parse(z.object({ title: nonEmpty.max(300).optional(), content: z.string().max(2_000_000).optional(), lineIds: z.array(z.union([identifier, z.null()])).max(MAX_CHAPTER_LINE_IDS).optional(), excludedFromAnalysis: z.boolean().optional(), chapterType: chapterTypeSchema.optional(), source: z.enum(["manual", "auto"]).optional(), changeNote: changeNoteSchema, expectedVersionNo: expectedVersionNoSchema }).strict(), request.body);
|
|
2465
2499
|
const { source, changeNote, expectedVersionNo, ...chapterInput } = input;
|