@musnows/scriverse 0.6.13 → 0.7.1

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 CHANGED
@@ -150,6 +150,11 @@ const settingSchema = z.object({
150
150
  scope: jsonObject.optional(),
151
151
  authorNote: z.string().max(20_000).optional()
152
152
  });
153
+ const globalReplaceSchema = z.object({
154
+ find: z.string().min(1).max(500),
155
+ replacement: z.string().max(200_000),
156
+ scope: z.enum(["prose", "settings", "prose-and-settings"]).default("prose")
157
+ }).strict();
153
158
  const draftSchema = z.object({
154
159
  draftType: z.enum(["prose", "setting"]),
155
160
  volumeId: identifier.nullable().optional(),
@@ -383,8 +388,9 @@ const platformPageSizesSchema = z.object({
383
388
  }).strict();
384
389
  const platformUiSettingsSchema = z.object({
385
390
  toastPosition: z.enum(["bottom-right", "top-right"]).optional(),
386
- pageSizes: platformPageSizesSchema.optional()
387
- }).strict().refine((input) => input.toastPosition !== undefined || input.pageSizes !== undefined, {
391
+ pageSizes: platformPageSizesSchema.optional(),
392
+ galaxyFrameRate: z.union([z.literal(24), z.literal(30), z.literal(60)]).optional()
393
+ }).strict().refine((input) => input.toastPosition !== undefined || input.pageSizes !== undefined || input.galaxyFrameRate !== undefined, {
388
394
  message: "至少需要提供一项界面设置"
389
395
  });
390
396
  const s3EndpointSchema = z.string().trim().url().max(2_000).superRefine((value, context) => {
@@ -1299,6 +1305,9 @@ export function createRuntime(options) {
1299
1305
  const expectedVersionNo = parse(expectedVersionNoSchema, request.body.expectedVersionNo);
1300
1306
  data(response, store.importNovel(String(request.params.workId), originalFileName, extension.slice(1), parsed, mode, expectedVersionNo), 201);
1301
1307
  });
1308
+ app.post("/api/works/:workId/replace", (request, response) => {
1309
+ data(response, store.replaceWorkText(request.params.workId, parse(globalReplaceSchema, request.body)));
1310
+ });
1302
1311
  app.post("/api/works/:workId/volumes", (request, response) => {
1303
1312
  const input = parse(z.object({ title: nonEmpty.max(200), kind: z.enum(["main", "prequel", "extra", "epilogue", "appendix"]).optional(), description: z.string().max(5_000).optional(), keywords: z.array(nonEmpty.max(100)).max(100).optional() }), request.body);
1304
1313
  data(response, store.createVolume(request.params.workId, input), 201);