@musnows/scriverse 0.6.13 → 0.7.0

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(),
@@ -1299,6 +1304,9 @@ export function createRuntime(options) {
1299
1304
  const expectedVersionNo = parse(expectedVersionNoSchema, request.body.expectedVersionNo);
1300
1305
  data(response, store.importNovel(String(request.params.workId), originalFileName, extension.slice(1), parsed, mode, expectedVersionNo), 201);
1301
1306
  });
1307
+ app.post("/api/works/:workId/replace", (request, response) => {
1308
+ data(response, store.replaceWorkText(request.params.workId, parse(globalReplaceSchema, request.body)));
1309
+ });
1302
1310
  app.post("/api/works/:workId/volumes", (request, response) => {
1303
1311
  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
1312
  data(response, store.createVolume(request.params.workId, input), 201);