@musnows/scriverse 0.4.5 → 0.4.7
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 +0 -1
- package/dist/app.js.map +1 -1
- package/dist/cli-contract.js +0 -1
- package/dist/cli-contract.js.map +1 -1
- package/dist/database.js +15 -2
- package/dist/database.js.map +1 -1
- package/dist/public/app.js +90 -32
- package/dist/public/character-filters.d.ts +24 -0
- package/dist/public/character-filters.js +35 -0
- package/dist/public/character-version.js +0 -1
- package/dist/public/display-labels.d.ts +0 -1
- package/dist/public/display-labels.js +0 -4
- package/dist/public/index.html +3 -3
- package/dist/public/styles.css +52 -14
- package/dist/store.js +5 -7
- package/dist/store.js.map +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/public/styles.css
CHANGED
|
@@ -503,10 +503,11 @@ body.is-panel-resizing { cursor: col-resize; user-select: none; }
|
|
|
503
503
|
.app-shell.left-panel-collapsed .panel-heading { display: none; }
|
|
504
504
|
.app-shell.left-panel-collapsed .brand-block { padding: 0 4px; }.app-shell.left-panel-collapsed .brand-block > div { display: none; }
|
|
505
505
|
.main-panel { min-width: 0; min-height: 0; overflow: hidden; }
|
|
506
|
-
.app-shell.shelf-mode { grid-template-columns: 1fr; }
|
|
506
|
+
.app-shell.shelf-mode { grid-template-columns: minmax(0, 1fr); }
|
|
507
507
|
.app-shell.shelf-mode .topbar { grid-template-columns: 280px 1fr auto; }
|
|
508
508
|
.app-shell.shelf-mode .left-panel, .app-shell.shelf-mode .ai-panel { display: none; }
|
|
509
509
|
.app-shell.shelf-mode .save-state { display: none; }
|
|
510
|
+
.app-shell.shelf-mode #top-search-button { display: none; }
|
|
510
511
|
.app-shell.shelf-mode .main-panel { grid-column: 1 / -1; }
|
|
511
512
|
|
|
512
513
|
.shelf-view { display: flex; flex-direction: column; height: 100%; overflow-y: auto; padding: 48px clamp(32px, 7vw, 110px) 90px; }
|
|
@@ -758,7 +759,7 @@ body.work-viewer-mode .character-editor-actions { display: none !important; }
|
|
|
758
759
|
.api-key-result label { display: grid; gap: 6px; color: var(--muted); font-size: 11px; }
|
|
759
760
|
.api-key-result input { width: 100%; min-height: 38px; padding: 9px 10px; background: var(--surface); font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 11px; }
|
|
760
761
|
.api-key-result button { min-height: 38px; }
|
|
761
|
-
.book-access-badge { display: inline-flex; width: fit-content; margin-top: 7px; padding: 2px 7px; border-radius: 10px; background: var(--
|
|
762
|
+
.book-access-badge { display: inline-flex; width: fit-content; margin-top: 7px; padding: 2px 7px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--accent-dark); font-size: 9px; }
|
|
762
763
|
.book-shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(205px, 1fr)); gap: clamp(22px, 3vw, 38px); width: 100%; min-width: 0; max-width: 1400px; margin: 0 auto; }
|
|
763
764
|
.book-card { position: relative; min-width: 0; border: 0; background: transparent; text-align: left; }
|
|
764
765
|
.book-open { width: 100%; padding: 0; border: 0; background: transparent; text-align: left; }
|
|
@@ -877,13 +878,13 @@ select:focus, input:focus, textarea:focus { border-color: #a77768; box-shadow: 0
|
|
|
877
878
|
.chapter-add-button { flex: none; }
|
|
878
879
|
.volume-chapters { display: block; }
|
|
879
880
|
.volume-node.is-collapsed .volume-chapters { display: none; }
|
|
880
|
-
.chapter-node { display: grid; grid-template-columns: minmax(0, 1fr) max-content; gap: 8px; width: calc(100% + 6px); padding: 9px
|
|
881
|
+
.chapter-node { display: grid; grid-template-columns: minmax(0, 1fr) max-content; gap: 8px; width: calc(100% + 6px); padding: 9px 8px 9px 20px; border: 0; background: transparent; border-radius: 4px; text-align: left; font-size: 12px; }
|
|
881
882
|
.chapter-node:hover, .chapter-node.active { background: var(--row-active); }
|
|
882
883
|
.chapter-node.active { color: var(--accent-dark); font-weight: 700; }
|
|
883
884
|
.chapter-node > span:first-child { min-width: 0; overflow-wrap: anywhere; line-height: 1.45; white-space: normal; }
|
|
884
885
|
.chapter-node-meta { display: flex; flex: none; align-items: center; gap: 5px; margin-left: auto; overflow: visible; white-space: nowrap; }
|
|
885
886
|
.chapter-node small { color: var(--muted); font-size: 9px; }
|
|
886
|
-
.chapter-type-badge { max-width: 58px; overflow: hidden; padding: 2px 5px; border-radius: 9px; background:
|
|
887
|
+
.chapter-type-badge { max-width: 58px; overflow: hidden; padding: 2px 5px; border: 1px solid color-mix(in srgb, var(--accent) 42%, var(--line)); border-radius: 9px; background: color-mix(in srgb, var(--accent) 12%, var(--surface)); color: var(--accent-dark); font-size: 8px; font-style: normal; text-overflow: ellipsis; white-space: nowrap; }
|
|
887
888
|
|
|
888
889
|
.ghost-button, .primary-button { border-radius: 4px; padding: 8px 13px; font-size: 12px; }
|
|
889
890
|
.ghost-button { border: 1px solid var(--line); background: transparent; }
|
|
@@ -957,6 +958,11 @@ select:focus, input:focus, textarea:focus { border-color: #a77768; box-shadow: 0
|
|
|
957
958
|
.record-card p { color: var(--muted); font-size: 12px; line-height: 1.55; margin: 0; white-space: pre-wrap; }
|
|
958
959
|
.record-card small { color: var(--accent); font-size: 9px; letter-spacing: .1em; text-transform: uppercase; }
|
|
959
960
|
.settings-layout-toolbar, .module-layout-toolbar { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-bottom: 0; }
|
|
961
|
+
.module-filter-toggle { display: inline-grid; width: 36px; height: 36px; place-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 4px; background: transparent; color: var(--muted); }
|
|
962
|
+
.module-filter-toggle:hover, .module-filter-toggle[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }
|
|
963
|
+
.module-filter-toggle svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
|
|
964
|
+
.module-filter-toggle + .module-layout-toolbar { order: 2; }
|
|
965
|
+
.module-filter-toggle ~ #module-create-button { order: 3; }
|
|
960
966
|
.settings-layout-hint { color: var(--muted); font-size: 10px; }
|
|
961
967
|
.settings-layout-toggle, .module-layout-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; background: var(--surface); }
|
|
962
968
|
.settings-layout-toggle button { min-height: 34px; padding: 0 12px; border: 0; border-right: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 11px; }
|
|
@@ -977,10 +983,30 @@ select:focus, input:focus, textarea:focus { border-color: #a77768; box-shadow: 0
|
|
|
977
983
|
.setting-row .card-actions, .module-row .card-actions { margin-top: 0; flex-wrap: wrap; justify-content: flex-end; }
|
|
978
984
|
.module-row .card-actions > .record-card-edit { position: static; }
|
|
979
985
|
.character-card { cursor: pointer; }
|
|
986
|
+
.character-row { grid-template-columns: minmax(140px, .28fr) minmax(0, 1fr) auto; }
|
|
987
|
+
.character-card-heading { display: flex; min-width: 0; align-items: center; gap: 7px; }
|
|
988
|
+
.character-card-heading h3 { min-width: 0; }
|
|
989
|
+
.record-card.has-card-edit .character-card-heading { padding-right: 34px; }
|
|
990
|
+
.record-card.has-card-edit .character-card-heading h3 { padding-right: 0; }
|
|
991
|
+
.character-lock-badge { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 3px; min-height: 20px; padding: 2px 6px; border: 1px solid color-mix(in srgb, var(--accent) 42%, var(--line)); border-radius: 10px; background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--accent-dark); font-size: 9px; font-variant-numeric: tabular-nums; line-height: 1; }
|
|
992
|
+
.character-lock-badge svg { width: 11px; height: 11px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
|
|
993
|
+
.character-filter-toolbar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)) auto; gap: 12px; align-items: start; width: 100%; min-width: 0; box-sizing: border-box; margin-bottom: 18px; padding: 12px 14px; border: 1px solid var(--line); background: var(--surface-soft); }
|
|
994
|
+
.character-filter-dropdown { position: relative; min-width: 0; }
|
|
995
|
+
.character-filter-dropdown summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 38px; padding: 0 11px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--ink); cursor: pointer; list-style: none; }
|
|
996
|
+
.character-filter-dropdown summary::-webkit-details-marker { display: none; }
|
|
997
|
+
.character-filter-dropdown summary::after { content: "⌄"; color: var(--muted); font-size: 14px; }
|
|
998
|
+
.character-filter-dropdown[open] summary { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 14%, transparent); }
|
|
999
|
+
.character-filter-dropdown[open] summary::after { content: "⌃"; }
|
|
1000
|
+
.character-filter-dropdown summary span { color: var(--ink); font-size: 11px; }
|
|
1001
|
+
.character-filter-dropdown summary strong { overflow: hidden; color: var(--muted); font-size: 10px; font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
|
|
1002
|
+
.character-filter-options { display: grid; position: absolute; z-index: 20; top: calc(100% + 6px); right: 0; left: 0; max-height: 230px; overflow-y: auto; padding: 7px; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--surface); box-shadow: 0 12px 28px rgb(0 0 0 / 18%); }
|
|
1003
|
+
.character-filter-option { display: flex; grid-template-columns: auto 1fr; align-items: center; gap: 8px; padding: 7px 6px; color: var(--ink); cursor: pointer; font-size: 11px; line-height: 1.35; }
|
|
1004
|
+
.character-filter-option:hover { background: var(--surface-soft); }
|
|
1005
|
+
.character-filter-option input { accent-color: var(--accent); margin: 0; }
|
|
1006
|
+
.character-filter-toolbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; min-height: 38px; }
|
|
1007
|
+
.character-filter-result-count { color: var(--muted); font-size: 11px; white-space: nowrap; }
|
|
1008
|
+
.character-filter-toolbar-actions button:disabled { cursor: default; opacity: .45; }
|
|
980
1009
|
.character-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
|
|
981
|
-
.character-audit-panel { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 18px; padding: 15px 17px; border: 1px solid var(--line); background: var(--surface-soft); }
|
|
982
|
-
.character-audit-panel div { display: grid; gap: 5px; }
|
|
983
|
-
.character-audit-panel small { max-width: 760px; color: var(--muted); line-height: 1.55; }
|
|
984
1010
|
.character-duplicate-review { grid-column: 1 / -1; }
|
|
985
1011
|
.character-duplicate-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 14px 0; }
|
|
986
1012
|
.character-duplicate-pair section { display: grid; align-content: start; gap: 8px; min-width: 0; padding: 13px; border: 1px solid var(--line); background: var(--surface-soft); }
|
|
@@ -1007,8 +1033,8 @@ select:focus, input:focus, textarea:focus { border-color: #a77768; box-shadow: 0
|
|
|
1007
1033
|
.provider-card .model-pill { max-width: 100%; margin: 0; border: 0; text-align: left; white-space: normal; cursor: pointer; }
|
|
1008
1034
|
.provider-card .model-pill:hover, .provider-card .model-pill:focus-visible { background: var(--surface-hover); color: var(--ink); }
|
|
1009
1035
|
.provider-card .card-actions { flex-wrap: wrap; }
|
|
1010
|
-
.pill { display: inline-block; padding: 3px 7px; margin: 0 4px 4px 0; border-radius: 12px; background: var(--
|
|
1011
|
-
.organization-links { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; margin: 8px 0 6px; }.organization-links b { color: var(--muted); font-size: 9px; font-weight: 500; }.organization-links .pill { margin: 0; }.organization-empty { color: var(--muted); font-size: 9px; }.organization-pill { color: var(--accent-dark); background:
|
|
1036
|
+
.pill { display: inline-block; padding: 3px 7px; margin: 0 4px 4px 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--muted); font-size: 9px; }
|
|
1037
|
+
.organization-links { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; margin: 8px 0 6px; }.organization-links b { color: var(--muted); font-size: 9px; font-weight: 500; }.organization-links .pill { margin: 0; }.organization-empty { color: var(--muted); font-size: 9px; }.organization-pill { border: 1px solid color-mix(in srgb, var(--accent) 48%, var(--line)); color: var(--accent-dark); background: color-mix(in srgb, var(--accent) 20%, var(--surface)); }.organization-settings { margin: 10px 0 6px; }.organization-members { margin-top: 9px !important; }.relationship-keyword { white-space: nowrap; }
|
|
1012
1038
|
.race-settings { display: flex; flex-wrap: wrap; gap: 5px; margin: 10px 0 6px; }.race-settings .pill { margin: 0; }.race-members { margin-top: 9px !important; }
|
|
1013
1039
|
.race-tree { display: grid; gap: 12px; }
|
|
1014
1040
|
.race-tree-node { min-width: 0; }
|
|
@@ -1615,6 +1641,9 @@ select:focus, input:focus, textarea:focus { border-color: #a77768; box-shadow: 0
|
|
|
1615
1641
|
.merge-dialog-note { margin: 0; padding: 10px 12px; border-left: 2px solid var(--accent); background: var(--surface-soft); color: var(--muted); font-size: 11px; line-height: 1.6; }
|
|
1616
1642
|
.form-field { display: grid; gap: 6px; color: var(--muted); font-size: 11px; }
|
|
1617
1643
|
.analysis-type-description { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
|
|
1644
|
+
.task-chapter-field { transition: opacity .15s ease; }
|
|
1645
|
+
.task-chapter-field.is-disabled { opacity: .48; }
|
|
1646
|
+
.task-chapter-field select:disabled { cursor: not-allowed; }
|
|
1618
1647
|
.model-temperature-hint { margin: 0; color: var(--accent-dark); font-size: 10px; line-height: 1.55; }
|
|
1619
1648
|
.item-list-rows { display: grid; gap: 7px; }
|
|
1620
1649
|
.item-list-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; }
|
|
@@ -1640,7 +1669,8 @@ select:focus, input:focus, textarea:focus { border-color: #a77768; box-shadow: 0
|
|
|
1640
1669
|
.character-card h3 { margin-bottom: 5px; }
|
|
1641
1670
|
.character-identity { margin: 0 0 6px !important; color: var(--ink) !important; font-weight: 600; line-height: 1.55 !important; }
|
|
1642
1671
|
.character-aliases { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-width: 0; }
|
|
1643
|
-
.character-aliases
|
|
1672
|
+
.character-aliases b { margin-right: 2px; color: var(--muted); font-size: 9px; font-weight: 500; }
|
|
1673
|
+
.character-aliases .pill { margin: 0; border: 1px solid var(--line); background: var(--surface); }
|
|
1644
1674
|
.character-code { display: flex; align-items: center; gap: 7px; margin-top: 10px; color: var(--muted); font-size: 10px; }
|
|
1645
1675
|
.character-species { display: grid; grid-template-columns: max-content minmax(0, 1fr); align-items: center; gap: 6px; margin-top: 8px; color: var(--muted); font-size: 10px; }
|
|
1646
1676
|
.character-species b { font-weight: 500; }
|
|
@@ -1683,6 +1713,8 @@ select:focus, input:focus, textarea:focus { border-color: #a77768; box-shadow: 0
|
|
|
1683
1713
|
@media (max-width: 560px) {
|
|
1684
1714
|
.import-mode-options { grid-template-columns: 1fr; }
|
|
1685
1715
|
.import-mode-dialog .dialog-actions { flex-wrap: wrap; }
|
|
1716
|
+
.character-filter-toolbar { grid-template-columns: minmax(0, 1fr); }
|
|
1717
|
+
.character-filter-toolbar-actions { justify-content: flex-start; }
|
|
1686
1718
|
}
|
|
1687
1719
|
.entity-editor-open { overflow: hidden; }
|
|
1688
1720
|
.preview-record-card { cursor: pointer; }
|
|
@@ -1878,7 +1910,7 @@ select:focus, input:focus, textarea:focus { border-color: #a77768; box-shadow: 0
|
|
|
1878
1910
|
.character-version-card-heading span, .character-version-card-heading time { color: var(--muted); font-size: 8px; }
|
|
1879
1911
|
.character-version-card p { margin: 0; color: var(--ink); font-size: 10px; line-height: 1.5; overflow-wrap: anywhere; }
|
|
1880
1912
|
.character-version-changes { display: flex; flex-wrap: wrap; gap: 4px; }
|
|
1881
|
-
.character-version-changes span { padding: 2px 6px; border-radius: 10px; background: var(--
|
|
1913
|
+
.character-version-changes span { padding: 2px 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--muted); font-size: 8px; }
|
|
1882
1914
|
.character-version-card > button { justify-self: end; padding: 6px 8px; border: 1px solid var(--line); border-radius: 4px; background: transparent; color: var(--muted); font-size: 9px; }
|
|
1883
1915
|
.character-version-card > button:not(:disabled):hover { border-color: var(--accent); color: var(--accent-dark); }
|
|
1884
1916
|
.character-version-card > button.is-confirming { border-color: var(--accent); background: var(--accent); color: #fff; }
|
|
@@ -1993,8 +2025,13 @@ select:focus, input:focus, textarea:focus { border-color: #a77768; box-shadow: 0
|
|
|
1993
2025
|
}
|
|
1994
2026
|
|
|
1995
2027
|
@media (max-width: 640px) {
|
|
1996
|
-
|
|
1997
|
-
.
|
|
2028
|
+
#onboarding-dialog, #onboarding-menu-button { display: none !important; }
|
|
2029
|
+
.topbar .work-meta { display: none; }
|
|
2030
|
+
.top-actions .save-state { display: none; }
|
|
2031
|
+
.presence-button #presence-count { display: none; }
|
|
2032
|
+
.account-button > span:last-child { display: none; }
|
|
2033
|
+
.book-shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 14px; }
|
|
2034
|
+
.book-info > span, .book-access-badge { display: none; }
|
|
1998
2035
|
.ai-history-dialog-body { min-height: min(360px, 62vh); padding: 12px 14px 18px; }
|
|
1999
2036
|
.account-settings-body { padding: 16px; }
|
|
2000
2037
|
.account-settings-section { padding: 15px; }
|
|
@@ -2040,6 +2077,7 @@ select:focus, input:focus, textarea:focus { border-color: #a77768; box-shadow: 0
|
|
|
2040
2077
|
.brand-block strong { font-size: 14px; }
|
|
2041
2078
|
.brand-block small { display: none; }
|
|
2042
2079
|
.mobile-module-tab { position: fixed; z-index: 32; top: 132px; right: 0; display: grid; width: 34px; height: 42px; padding: 0; place-items: center; border: 1px solid var(--line); border-right: 0; border-radius: 5px 0 0 5px; background: var(--surface-soft); color: var(--accent-dark); font-size: 10px; writing-mode: vertical-rl; }
|
|
2080
|
+
.app-shell.shelf-mode .mobile-module-tab { display: none; }
|
|
2043
2081
|
.mobile-panel-backdrop { position: fixed; z-index: 30; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; background: rgba(20, 17, 14, .28); }
|
|
2044
2082
|
.app-shell:not(.shelf-mode):not(.left-panel-collapsed) .mobile-panel-backdrop { display: block; }
|
|
2045
2083
|
.work-meta {
|
|
@@ -2223,7 +2261,7 @@ select:focus, input:focus, textarea:focus { border-color: #a77768; box-shadow: 0
|
|
|
2223
2261
|
.editor-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
|
2224
2262
|
.editor-actions .chapter-stats { display: none; }
|
|
2225
2263
|
.editor-actions > button { width: auto; }
|
|
2226
|
-
.book-shelf { grid-template-columns: minmax(0, 1fr); max-width:
|
|
2264
|
+
.book-shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 12px; max-width: none; }
|
|
2227
2265
|
.book-add-card { min-height: 220px; }
|
|
2228
2266
|
.onboarding-popover { width: calc(100vw - 20px); }
|
|
2229
2267
|
}
|
package/dist/store.js
CHANGED
|
@@ -2221,7 +2221,6 @@ export class Store {
|
|
|
2221
2221
|
profile,
|
|
2222
2222
|
currentState: character.currentState,
|
|
2223
2223
|
lockedFields: [...character.lockedFields],
|
|
2224
|
-
visibility: String(character.visibility),
|
|
2225
2224
|
firstChapterId: character.firstChapterId
|
|
2226
2225
|
};
|
|
2227
2226
|
}
|
|
@@ -2266,8 +2265,8 @@ export class Store {
|
|
|
2266
2265
|
this.assertOrganizationsInWork(workId, organizationIds);
|
|
2267
2266
|
this.db.transaction(() => {
|
|
2268
2267
|
this.db.run(`INSERT INTO characters (id, work_id, name, code, aliases_json, species, race_id, attributes_json, profile_json, current_state_json,
|
|
2269
|
-
locked_fields_json,
|
|
2270
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
|
|
2268
|
+
locked_fields_json, first_chapter_id, created_at, updated_at)
|
|
2269
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, characterId, workId, names.name, input.code?.trim() ?? "", JSON.stringify(names.aliases), species, raceId, JSON.stringify(input.attributes ?? {}), JSON.stringify(input.profile ?? {}), JSON.stringify(input.currentState ?? {}), JSON.stringify(input.lockedFields ?? []), input.firstChapterId ?? null, timestamp, timestamp);
|
|
2271
2270
|
this.insertCharacterNames(workId, characterId, names.entries);
|
|
2272
2271
|
this.replaceCharacterOrganizations(characterId, organizationIds);
|
|
2273
2272
|
this.insertCharacterVersion(characterId, 1, "create", null, "建立人物档案", timestamp);
|
|
@@ -2617,7 +2616,7 @@ export class Store {
|
|
|
2617
2616
|
const lockedCurrent = this.getCharacter(characterId);
|
|
2618
2617
|
this.assertExpectedRevision("character", characterId, expectedVersionNo, "人物", Number(lockedCurrent.versionNo));
|
|
2619
2618
|
this.db.run(`UPDATE characters SET name = ?, code = ?, aliases_json = ?, species = ?, race_id = ?, attributes_json = ?, profile_json = ?, current_state_json = ?,
|
|
2620
|
-
locked_fields_json = ?,
|
|
2619
|
+
locked_fields_json = ?, first_chapter_id = ?, updated_at = ? WHERE id = ?`, names.name, input.code === undefined ? String(current.code) : input.code.trim(), JSON.stringify(names.aliases), species, raceId, JSON.stringify(attributes), JSON.stringify(input.profile ?? current.profile), JSON.stringify(input.currentState ?? current.currentState), JSON.stringify(input.lockedFields ?? current.lockedFields), input.firstChapterId === undefined ? current.firstChapterId : input.firstChapterId, now(), characterId);
|
|
2621
2620
|
this.db.run("DELETE FROM character_names WHERE character_id = ?", characterId);
|
|
2622
2621
|
this.insertCharacterNames(workId, characterId, names.entries);
|
|
2623
2622
|
if (organizationIds)
|
|
@@ -2704,8 +2703,8 @@ export class Store {
|
|
|
2704
2703
|
const nextVersionNo = numberValue(this.db.get("SELECT COALESCE(MAX(version_no), 0) AS version_no FROM character_versions WHERE character_id = ?", characterId) ?? {}, "version_no") + 1;
|
|
2705
2704
|
this.db.transaction(() => {
|
|
2706
2705
|
this.db.run(`INSERT INTO characters (id, work_id, name, code, aliases_json, species, race_id, attributes_json, profile_json, current_state_json,
|
|
2707
|
-
locked_fields_json,
|
|
2708
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
|
|
2706
|
+
locked_fields_json, first_chapter_id, version_no, created_at, updated_at)
|
|
2707
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, characterId, workId, names.name, snapshot.code ?? "", JSON.stringify(names.aliases), species, raceId, JSON.stringify(snapshot.attributes ?? {}), JSON.stringify(snapshot.profile ?? {}), JSON.stringify(snapshot.currentState ?? {}), JSON.stringify(snapshot.lockedFields ?? []), snapshot.firstChapterId ?? null, nextVersionNo, timestamp, timestamp);
|
|
2709
2708
|
this.insertCharacterNames(workId, characterId, names.entries);
|
|
2710
2709
|
this.replaceCharacterOrganizations(characterId, organizationIds);
|
|
2711
2710
|
this.insertCharacterVersion(characterId, nextVersionNo, "restore", requiredString(version, "id"), `恢复至 v${versionNo}`, timestamp, workId);
|
|
@@ -2797,7 +2796,6 @@ export class Store {
|
|
|
2797
2796
|
profileSectionCount,
|
|
2798
2797
|
currentState: json(requiredString(row, "current_state_json"), {}),
|
|
2799
2798
|
lockedFields: json(requiredString(row, "locked_fields_json"), []),
|
|
2800
|
-
visibility: requiredString(row, "visibility"),
|
|
2801
2799
|
firstChapterId: optionalString(row, "first_chapter_id"),
|
|
2802
2800
|
mergedIntoCharacterId: optionalString(row, "merged_into_character_id"),
|
|
2803
2801
|
mergedAt: optionalString(row, "merged_at"),
|