@musnows/scriverse 0.6.11 → 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/README.md +2 -0
- package/dist/ai.js +43 -10
- package/dist/ai.js.map +1 -1
- package/dist/app.js +16 -0
- package/dist/app.js.map +1 -1
- package/dist/database.js +48 -3
- package/dist/database.js.map +1 -1
- package/dist/public/app.js +298 -15
- package/dist/public/display-labels.js +1 -1
- package/dist/public/entity-version.js +2 -1
- package/dist/public/index.html +29 -3
- package/dist/public/styles.css +56 -12
- package/dist/server-runtime.js +118 -4
- package/dist/server-runtime.js.map +1 -1
- package/dist/store.js +170 -16
- package/dist/store.js.map +1 -1
- package/dist/user-auth.js +8 -0
- package/dist/user-auth.js.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +1 -1
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(),
|
|
@@ -654,6 +659,9 @@ function redactTaskCharacterNames(record, permissions) {
|
|
|
654
659
|
const { targetCharacters: _targetCharacters, ...redactedScope } = scope;
|
|
655
660
|
result.scope = redactedScope;
|
|
656
661
|
}
|
|
662
|
+
const scopeTarget = recordValue(result.scopeTarget);
|
|
663
|
+
if (scopeTarget?.type === "character")
|
|
664
|
+
delete result.scopeTarget;
|
|
657
665
|
const taskResult = recordValue(result.result);
|
|
658
666
|
if (taskResult) {
|
|
659
667
|
const redactedTaskResult = { ...taskResult };
|
|
@@ -679,6 +687,11 @@ function redactTaskCharacterNames(record, permissions) {
|
|
|
679
687
|
result.result = redactedTaskResult;
|
|
680
688
|
}
|
|
681
689
|
}
|
|
690
|
+
if (proseRestricted) {
|
|
691
|
+
const scopeTarget = recordValue(result.scopeTarget);
|
|
692
|
+
if (scopeTarget?.type === "chapter")
|
|
693
|
+
delete result.scopeTarget;
|
|
694
|
+
}
|
|
682
695
|
if (permissions.relationships === "none") {
|
|
683
696
|
const taskResult = recordValue(result.result);
|
|
684
697
|
const changePreview = recordValue(taskResult?.relationshipChangePreview);
|
|
@@ -1291,6 +1304,9 @@ export function createRuntime(options) {
|
|
|
1291
1304
|
const expectedVersionNo = parse(expectedVersionNoSchema, request.body.expectedVersionNo);
|
|
1292
1305
|
data(response, store.importNovel(String(request.params.workId), originalFileName, extension.slice(1), parsed, mode, expectedVersionNo), 201);
|
|
1293
1306
|
});
|
|
1307
|
+
app.post("/api/works/:workId/replace", (request, response) => {
|
|
1308
|
+
data(response, store.replaceWorkText(request.params.workId, parse(globalReplaceSchema, request.body)));
|
|
1309
|
+
});
|
|
1294
1310
|
app.post("/api/works/:workId/volumes", (request, response) => {
|
|
1295
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);
|
|
1296
1312
|
data(response, store.createVolume(request.params.workId, input), 201);
|