fundus 0.1.0 → 0.2.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 +31 -0
- package/build/client/_app/immutable/assets/0.inkPq3ni.css +1 -0
- package/build/client/_app/immutable/assets/0.inkPq3ni.css.br +0 -0
- package/build/client/_app/immutable/assets/0.inkPq3ni.css.gz +0 -0
- package/build/client/_app/immutable/assets/3.ChSpCG-T.css +1 -0
- package/build/client/_app/immutable/assets/3.ChSpCG-T.css.br +0 -0
- package/build/client/_app/immutable/assets/3.ChSpCG-T.css.gz +0 -0
- package/build/client/_app/immutable/assets/{LibraryContextMenu.CMefGNE2.css → LibraryContextMenu.BYvU4SY7.css} +1 -1
- package/build/client/_app/immutable/assets/LibraryContextMenu.BYvU4SY7.css.br +0 -0
- package/build/client/_app/immutable/assets/LibraryContextMenu.BYvU4SY7.css.gz +0 -0
- package/build/client/_app/immutable/assets/ManifestSelector.Il8p28r8.css +1 -0
- package/build/client/_app/immutable/assets/ManifestSelector.Il8p28r8.css.br +0 -0
- package/build/client/_app/immutable/assets/ManifestSelector.Il8p28r8.css.gz +0 -0
- package/build/client/_app/immutable/chunks/BAEZPv6c.js +1 -0
- package/build/client/_app/immutable/chunks/BAEZPv6c.js.br +0 -0
- package/build/client/_app/immutable/chunks/BAEZPv6c.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{D9-155C9.js → ByVSyIj7.js} +1 -1
- package/build/client/_app/immutable/chunks/ByVSyIj7.js.br +1 -0
- package/build/client/_app/immutable/chunks/ByVSyIj7.js.gz +0 -0
- package/build/client/_app/immutable/chunks/C8W3KwDq.js +1 -0
- package/build/client/_app/immutable/chunks/C8W3KwDq.js.br +0 -0
- package/build/client/_app/immutable/chunks/C8W3KwDq.js.gz +0 -0
- package/build/client/_app/immutable/chunks/CP-bnOxU.js +1 -0
- package/build/client/_app/immutable/chunks/CP-bnOxU.js.br +0 -0
- package/build/client/_app/immutable/chunks/CP-bnOxU.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{CNRz3sSw.js → D65cSBhe.js} +2 -2
- package/build/client/_app/immutable/chunks/D65cSBhe.js.br +0 -0
- package/build/client/_app/immutable/chunks/D65cSBhe.js.gz +0 -0
- package/build/client/_app/immutable/chunks/Db8LRH6X.js +108 -0
- package/build/client/_app/immutable/chunks/Db8LRH6X.js.br +0 -0
- package/build/client/_app/immutable/chunks/Db8LRH6X.js.gz +0 -0
- package/build/client/_app/immutable/chunks/TZFh8bT7.js +1 -0
- package/build/client/_app/immutable/chunks/TZFh8bT7.js.br +0 -0
- package/build/client/_app/immutable/chunks/TZFh8bT7.js.gz +0 -0
- package/build/client/_app/immutable/entry/app.nM6SgHKJ.js +2 -0
- package/build/client/_app/immutable/entry/app.nM6SgHKJ.js.br +0 -0
- package/build/client/_app/immutable/entry/app.nM6SgHKJ.js.gz +0 -0
- package/build/client/_app/immutable/entry/start.DNXvkhtP.js +1 -0
- package/build/client/_app/immutable/entry/start.DNXvkhtP.js.br +0 -0
- package/build/client/_app/immutable/entry/start.DNXvkhtP.js.gz +0 -0
- package/build/client/_app/immutable/nodes/0.QeXQNCp2.js +2 -0
- package/build/client/_app/immutable/nodes/0.QeXQNCp2.js.br +0 -0
- package/build/client/_app/immutable/nodes/0.QeXQNCp2.js.gz +0 -0
- package/build/client/_app/immutable/nodes/1.dMklHTc2.js +1 -0
- package/build/client/_app/immutable/nodes/1.dMklHTc2.js.br +0 -0
- package/build/client/_app/immutable/nodes/1.dMklHTc2.js.gz +0 -0
- package/build/client/_app/immutable/nodes/2.CW4VMcIP.js +3 -0
- package/build/client/_app/immutable/nodes/2.CW4VMcIP.js.br +0 -0
- package/build/client/_app/immutable/nodes/2.CW4VMcIP.js.gz +0 -0
- package/build/client/_app/immutable/nodes/3.CTiY_pbK.js +1 -0
- package/build/client/_app/immutable/nodes/3.CTiY_pbK.js.br +0 -0
- package/build/client/_app/immutable/nodes/3.CTiY_pbK.js.gz +0 -0
- package/build/client/_app/immutable/nodes/4.Dgxx52FJ.js +2 -0
- package/build/client/_app/immutable/nodes/4.Dgxx52FJ.js.br +0 -0
- package/build/client/_app/immutable/nodes/4.Dgxx52FJ.js.gz +0 -0
- package/build/client/_app/version.json +1 -1
- package/build/client/_app/version.json.br +0 -0
- package/build/client/_app/version.json.gz +0 -0
- package/build/client/favicon.svg +4 -0
- package/build/client/favicon.svg.br +0 -0
- package/build/client/favicon.svg.gz +0 -0
- package/build/handler.js +7 -7
- package/build/index.js +7 -7
- package/build/server/chunks/chunks/{context.js-CGD-b_vR.js → context.js-B77ZAVLi.js} +401 -31
- package/build/server/chunks/chunks/context.js-B77ZAVLi.js.map +1 -0
- package/build/server/chunks/chunks/{core.js-xfrkaQpS.js → core.js-EA_ysb1J.js} +130 -3
- package/build/server/chunks/chunks/core.js-EA_ysb1J.js.map +1 -0
- package/build/server/chunks/chunks/{exports.js-B4E0NJIt.js → exports.js-DvhE7Ffd.js} +2 -2
- package/build/server/chunks/chunks/{exports.js-B4E0NJIt.js.map → exports.js-DvhE7Ffd.js.map} +1 -1
- package/build/server/chunks/chunks/{http.js-Bu-Ao0Vk.js → http.js-DyoR9XRI.js} +5 -3
- package/build/server/chunks/chunks/http.js-DyoR9XRI.js.map +1 -0
- package/build/server/chunks/chunks/{internal.js-ClSxY3uX.js → internal.js-Dn37LrAW.js} +4 -4
- package/build/server/chunks/chunks/{internal.js-ClSxY3uX.js.map → internal.js-Dn37LrAW.js.map} +1 -1
- package/build/server/chunks/chunks/internal2.js-BlXt2rfE.js.map +1 -1
- package/build/server/chunks/chunks/{library-store.js-CZCDpai0.js → library-store.js-DJ-JRE-g.js} +337 -20
- package/build/server/chunks/chunks/library-store.js-DJ-JRE-g.js.map +1 -0
- package/build/server/chunks/chunks/{shared.js-CHQOW_GN.js → shared.js-Dob0TlTu.js} +2 -2
- package/build/server/chunks/chunks/{shared.js-CHQOW_GN.js.map → shared.js-Dob0TlTu.js.map} +1 -1
- package/build/server/chunks/chunks/{utils.js-B9L6I-_K.js → utils.js-B4YimMxv.js} +3 -3
- package/build/server/chunks/chunks/{utils.js-B9L6I-_K.js.map → utils.js-B4YimMxv.js.map} +1 -1
- package/build/server/chunks/entries/endpoints/api/_...path_/{_server.ts.js-PO5RpNzP.js → _server.ts.js-H4Pq1KAE.js} +4 -5
- package/build/server/chunks/entries/endpoints/api/_...path_/{_server.ts.js-PO5RpNzP.js.map → _server.ts.js-H4Pq1KAE.js.map} +1 -1
- package/build/server/chunks/entries/endpoints/api/assets/_id_/{_server.ts.js-BmgqGEXs.js → _server.ts.js-BI3KHSfE.js} +5 -6
- package/build/server/chunks/entries/endpoints/api/assets/_id_/{_server.ts.js-BmgqGEXs.js.map → _server.ts.js-BI3KHSfE.js.map} +1 -1
- package/build/server/chunks/entries/endpoints/api/assets/_id_/raw/{_server.ts.js-DnTOlfHs.js → _server.ts.js-BlNYUbXX.js} +5 -6
- package/build/server/chunks/entries/endpoints/api/assets/_id_/raw/{_server.ts.js-DnTOlfHs.js.map → _server.ts.js-BlNYUbXX.js.map} +1 -1
- package/build/server/chunks/entries/endpoints/api/assets/{_server.ts.js-DzdC6OJE.js → _server.ts.js-j-_N540j.js} +9 -7
- package/build/server/chunks/entries/endpoints/api/assets/_server.ts.js-j-_N540j.js.map +1 -0
- package/build/server/chunks/entries/endpoints/api/assets/delete/{_server.ts.js-DXJNoYAs.js → _server.ts.js-BHKobzAg.js} +5 -6
- package/build/server/chunks/entries/endpoints/api/assets/delete/{_server.ts.js-DXJNoYAs.js.map → _server.ts.js-BHKobzAg.js.map} +1 -1
- package/build/server/chunks/entries/endpoints/api/assets/move/{_server.ts.js-CqdKXoZL.js → _server.ts.js-BFKjIOCv.js} +5 -6
- package/build/server/chunks/entries/endpoints/api/assets/move/{_server.ts.js-CqdKXoZL.js.map → _server.ts.js-BFKjIOCv.js.map} +1 -1
- package/build/server/chunks/entries/endpoints/api/folders/_path_/{_server.ts.js-DIuY66jG.js → _server.ts.js-BxZeVw8y.js} +5 -6
- package/build/server/chunks/entries/endpoints/api/folders/_path_/{_server.ts.js-DIuY66jG.js.map → _server.ts.js-BxZeVw8y.js.map} +1 -1
- package/build/server/chunks/entries/endpoints/api/folders/{_server.ts.js-D9p-cdJQ.js → _server.ts.js-CO36U_CT.js} +5 -6
- package/build/server/chunks/entries/endpoints/api/folders/{_server.ts.js-D9p-cdJQ.js.map → _server.ts.js-CO36U_CT.js.map} +1 -1
- package/build/server/chunks/entries/endpoints/api/manifests/_name_/{_server.ts.js-DP1x-xAW.js → _server.ts.js-CBlg1Bkl.js} +5 -6
- package/build/server/chunks/entries/endpoints/api/manifests/_name_/{_server.ts.js-DP1x-xAW.js.map → _server.ts.js-CBlg1Bkl.js.map} +1 -1
- package/build/server/chunks/entries/endpoints/api/manifests/{_server.ts.js-r1eNMvPd.js → _server.ts.js-DcGLCjIs.js} +5 -6
- package/build/server/chunks/entries/endpoints/api/manifests/{_server.ts.js-r1eNMvPd.js.map → _server.ts.js-DcGLCjIs.js.map} +1 -1
- package/build/server/chunks/entries/endpoints/api/raw/adopt/_server.ts.js-AqhtjOiL.js +32 -0
- package/build/server/chunks/entries/endpoints/api/raw/adopt/_server.ts.js-AqhtjOiL.js.map +1 -0
- package/build/server/chunks/entries/endpoints/api/raw/edited/accept/_server.ts.js-CSa6-DcU.js +30 -0
- package/build/server/chunks/entries/endpoints/api/raw/edited/accept/_server.ts.js-CSa6-DcU.js.map +1 -0
- package/build/server/chunks/entries/endpoints/api/raw/edited/dismiss/_server.ts.js-DnzZUoAo.js +30 -0
- package/build/server/chunks/entries/endpoints/api/raw/edited/dismiss/_server.ts.js-DnzZUoAo.js.map +1 -0
- package/build/server/chunks/entries/endpoints/api/reconcile/_server.ts.js-B0KMprKq.js +33 -0
- package/build/server/chunks/entries/endpoints/api/reconcile/_server.ts.js-B0KMprKq.js.map +1 -0
- package/build/server/chunks/entries/endpoints/api/state/{_server.ts.js-D-m3BwRj.js → _server.ts.js-B1N9o1Ne.js} +5 -6
- package/build/server/chunks/entries/endpoints/api/state/{_server.ts.js-D-m3BwRj.js.map → _server.ts.js-B1N9o1Ne.js.map} +1 -1
- package/build/server/chunks/entries/endpoints/files/_...path_/{_server.ts.js-3nyAQ3f0.js → _server.ts.js-B6HbnRqq.js} +4 -5
- package/build/server/chunks/entries/endpoints/files/_...path_/{_server.ts.js-3nyAQ3f0.js.map → _server.ts.js-B6HbnRqq.js.map} +1 -1
- package/build/server/chunks/entries/endpoints/files/proxy/_...path_/{_server.ts.js-Ba285FiJ.js → _server.ts.js-7wzPyG9v.js} +5 -6
- package/build/server/chunks/entries/endpoints/files/proxy/_...path_/{_server.ts.js-Ba285FiJ.js.map → _server.ts.js-7wzPyG9v.js.map} +1 -1
- package/build/server/chunks/entries/endpoints/files/raw/_...path_/{_server.ts.js-X354l2NP.js → _server.ts.js-BWztxYge.js} +5 -6
- package/build/server/chunks/entries/endpoints/files/raw/_...path_/{_server.ts.js-X354l2NP.js.map → _server.ts.js-BWztxYge.js.map} +1 -1
- package/build/server/chunks/entries/{hooks.server.js-eZ7H27L4.js → hooks.server.js-CVKLksJ1.js} +4 -5
- package/build/server/chunks/entries/{hooks.server.js-eZ7H27L4.js.map → hooks.server.js-CVKLksJ1.js.map} +1 -1
- package/build/server/chunks/{handler-Dcc_-rVh.js → handler-DZ2Sps4a.js} +5 -5
- package/build/server/chunks/{handler-Dcc_-rVh.js.map → handler-DZ2Sps4a.js.map} +1 -1
- package/build/server/chunks/{index.js-DoVHd4mf.js → index.js-CdmTWQz8.js} +5 -5
- package/build/server/chunks/{index.js-DoVHd4mf.js.map → index.js-CdmTWQz8.js.map} +1 -1
- package/build/server/chunks/{manifest.js-C_MsDhaa.js → manifest.js-GhfNr35x.js} +51 -23
- package/build/server/chunks/manifest.js-GhfNr35x.js.map +1 -0
- package/build/server/chunks/nodes/0.js-DGT86_i-.js +11 -0
- package/build/server/chunks/nodes/0.js-DGT86_i-.js.map +1 -0
- package/build/server/chunks/nodes/1.js-DQgYreU0.js +7 -0
- package/build/server/chunks/nodes/{1.js-DKlcrAQP.js.map → 1.js-DQgYreU0.js.map} +1 -1
- package/build/server/chunks/nodes/2.js-DItreSrX.js +7 -0
- package/build/server/chunks/nodes/2.js-DItreSrX.js.map +1 -0
- package/build/server/chunks/nodes/3.js-bE1dJ_6v.js +7 -0
- package/build/server/chunks/nodes/3.js-bE1dJ_6v.js.map +1 -0
- package/build/server/chunks/nodes/4.js-BebbMVXy.js +7 -0
- package/build/server/chunks/nodes/{4.js-JQQZnHWZ.js.map → 4.js-BebbMVXy.js.map} +1 -1
- package/dist/core/api-types.d.ts +38 -0
- package/dist/core/index.d.ts +2 -1
- package/dist/core/index.js +1 -0
- package/dist/core/raw-path.d.ts +8 -0
- package/dist/core/raw-path.js +63 -0
- package/dist/server/build.js +11 -2
- package/dist/server/check.d.ts +5 -1
- package/dist/server/check.js +80 -28
- package/dist/server/cli-commands.d.ts +1 -1
- package/dist/server/cli-commands.js +5 -3
- package/dist/server/cli-init.js +16 -1
- package/dist/server/http.js +5 -1
- package/dist/server/library-store.d.ts +12 -0
- package/dist/server/library-store.js +25 -14
- package/dist/server/operations.d.ts +9 -1
- package/dist/server/operations.js +387 -31
- package/dist/server/processing/processor.js +3 -0
- package/dist/server/raw-reconciliation.d.ts +53 -0
- package/dist/server/raw-reconciliation.js +338 -0
- package/dist/server/raw-safety.d.ts +10 -0
- package/dist/server/raw-safety.js +73 -0
- package/package.json +1 -1
- package/build/client/_app/immutable/assets/0.DLhIsYA_.css +0 -1
- package/build/client/_app/immutable/assets/0.DLhIsYA_.css.br +0 -0
- package/build/client/_app/immutable/assets/0.DLhIsYA_.css.gz +0 -0
- package/build/client/_app/immutable/assets/3.C-toFWI4.css +0 -1
- package/build/client/_app/immutable/assets/3.C-toFWI4.css.br +0 -0
- package/build/client/_app/immutable/assets/3.C-toFWI4.css.gz +0 -0
- package/build/client/_app/immutable/assets/LibraryContextMenu.CMefGNE2.css.br +0 -0
- package/build/client/_app/immutable/assets/LibraryContextMenu.CMefGNE2.css.gz +0 -0
- package/build/client/_app/immutable/chunks/BA62n9FX.js +0 -108
- package/build/client/_app/immutable/chunks/BA62n9FX.js.br +0 -0
- package/build/client/_app/immutable/chunks/BA62n9FX.js.gz +0 -0
- package/build/client/_app/immutable/chunks/CNRz3sSw.js.br +0 -0
- package/build/client/_app/immutable/chunks/CNRz3sSw.js.gz +0 -0
- package/build/client/_app/immutable/chunks/CQsKwm8E.js +0 -1
- package/build/client/_app/immutable/chunks/CQsKwm8E.js.br +0 -0
- package/build/client/_app/immutable/chunks/CQsKwm8E.js.gz +0 -0
- package/build/client/_app/immutable/chunks/D9-155C9.js.br +0 -0
- package/build/client/_app/immutable/chunks/D9-155C9.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DVEDrSOn.js +0 -1
- package/build/client/_app/immutable/chunks/DVEDrSOn.js.br +0 -0
- package/build/client/_app/immutable/chunks/DVEDrSOn.js.gz +0 -0
- package/build/client/_app/immutable/chunks/cznBUb-E.js +0 -1
- package/build/client/_app/immutable/chunks/cznBUb-E.js.br +0 -0
- package/build/client/_app/immutable/chunks/cznBUb-E.js.gz +0 -0
- package/build/client/_app/immutable/entry/app.DwQWZs1F.js +0 -2
- package/build/client/_app/immutable/entry/app.DwQWZs1F.js.br +0 -0
- package/build/client/_app/immutable/entry/app.DwQWZs1F.js.gz +0 -0
- package/build/client/_app/immutable/entry/start.DEpAL_8Q.js +0 -1
- package/build/client/_app/immutable/entry/start.DEpAL_8Q.js.br +0 -0
- package/build/client/_app/immutable/entry/start.DEpAL_8Q.js.gz +0 -0
- package/build/client/_app/immutable/nodes/0.Sr1WDgiY.js +0 -2
- package/build/client/_app/immutable/nodes/0.Sr1WDgiY.js.br +0 -0
- package/build/client/_app/immutable/nodes/0.Sr1WDgiY.js.gz +0 -0
- package/build/client/_app/immutable/nodes/1.BwHqv728.js +0 -1
- package/build/client/_app/immutable/nodes/1.BwHqv728.js.br +0 -2
- package/build/client/_app/immutable/nodes/1.BwHqv728.js.gz +0 -0
- package/build/client/_app/immutable/nodes/2.DidxYIU-.js +0 -3
- package/build/client/_app/immutable/nodes/2.DidxYIU-.js.br +0 -0
- package/build/client/_app/immutable/nodes/2.DidxYIU-.js.gz +0 -0
- package/build/client/_app/immutable/nodes/3.C1AavoTf.js +0 -1
- package/build/client/_app/immutable/nodes/3.C1AavoTf.js.br +0 -0
- package/build/client/_app/immutable/nodes/3.C1AavoTf.js.gz +0 -0
- package/build/client/_app/immutable/nodes/4.D8UoOONM.js +0 -2
- package/build/client/_app/immutable/nodes/4.D8UoOONM.js.br +0 -0
- package/build/client/_app/immutable/nodes/4.D8UoOONM.js.gz +0 -0
- package/build/server/chunks/chunks/context.js-CGD-b_vR.js.map +0 -1
- package/build/server/chunks/chunks/core.js-xfrkaQpS.js.map +0 -1
- package/build/server/chunks/chunks/folder-path.js-ytx9ucgg.js +0 -64
- package/build/server/chunks/chunks/folder-path.js-ytx9ucgg.js.map +0 -1
- package/build/server/chunks/chunks/http.js-Bu-Ao0Vk.js.map +0 -1
- package/build/server/chunks/chunks/library-store.js-CZCDpai0.js.map +0 -1
- package/build/server/chunks/entries/endpoints/api/assets/_server.ts.js-DzdC6OJE.js.map +0 -1
- package/build/server/chunks/manifest.js-C_MsDhaa.js.map +0 -1
- package/build/server/chunks/nodes/0.js-BP6hHAK9.js +0 -11
- package/build/server/chunks/nodes/0.js-BP6hHAK9.js.map +0 -1
- package/build/server/chunks/nodes/1.js-DKlcrAQP.js +0 -7
- package/build/server/chunks/nodes/2.js-B-8TTZH_.js +0 -7
- package/build/server/chunks/nodes/2.js-B-8TTZH_.js.map +0 -1
- package/build/server/chunks/nodes/3.js-Cf7H6K5p.js +0 -7
- package/build/server/chunks/nodes/3.js-Cf7H6K5p.js.map +0 -1
- package/build/server/chunks/nodes/4.js-JQQZnHWZ.js +0 -7
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"
|
|
1
|
+
{"version":"1784103096725"}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/build/handler.js
CHANGED
|
@@ -2,9 +2,9 @@ import './shims.js';
|
|
|
2
2
|
import 'node:fs';
|
|
3
3
|
import 'node:path';
|
|
4
4
|
import 'node:process';
|
|
5
|
-
export { h as handler } from './server/chunks/handler-
|
|
6
|
-
import './server/chunks/index.js-
|
|
7
|
-
import './server/chunks/manifest.js-
|
|
5
|
+
export { h as handler } from './server/chunks/handler-DZ2Sps4a.js';
|
|
6
|
+
import './server/chunks/index.js-CdmTWQz8.js';
|
|
7
|
+
import './server/chunks/manifest.js-GhfNr35x.js';
|
|
8
8
|
import './env.js';
|
|
9
9
|
import 'node:buffer';
|
|
10
10
|
import 'node:crypto';
|
|
@@ -12,11 +12,11 @@ import 'node:http';
|
|
|
12
12
|
import 'node:timers';
|
|
13
13
|
import 'node:querystring';
|
|
14
14
|
import 'node:stream';
|
|
15
|
-
import './server/chunks/chunks/shared.js-
|
|
16
|
-
import './server/chunks/chunks/internal.js-
|
|
17
|
-
import './server/chunks/chunks/utils.js-
|
|
15
|
+
import './server/chunks/chunks/shared.js-Dob0TlTu.js';
|
|
16
|
+
import './server/chunks/chunks/internal.js-Dn37LrAW.js';
|
|
17
|
+
import './server/chunks/chunks/utils.js-B4YimMxv.js';
|
|
18
18
|
import 'node:url';
|
|
19
19
|
import './server/chunks/chunks/internal2.js-BlXt2rfE.js';
|
|
20
|
-
import './server/chunks/chunks/exports.js-
|
|
20
|
+
import './server/chunks/chunks/exports.js-DvhE7Ffd.js';
|
|
21
21
|
import './server/chunks/chunks/routing.js-y-tryuip.js';
|
|
22
22
|
//# sourceMappingURL=handler.js.map
|
package/build/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import http from 'node:http';
|
|
2
2
|
import fs__default from 'node:fs';
|
|
3
3
|
import process from 'node:process';
|
|
4
|
-
import { p as polka, h as handler, f as format_listening_address } from './server/chunks/handler-
|
|
4
|
+
import { p as polka, h as handler, f as format_listening_address } from './server/chunks/handler-DZ2Sps4a.js';
|
|
5
5
|
import { env, timeout_env } from './env.js';
|
|
6
6
|
import { rm } from 'node:fs/promises';
|
|
7
7
|
import './shims.js';
|
|
@@ -11,14 +11,14 @@ import 'node:path';
|
|
|
11
11
|
import 'node:timers';
|
|
12
12
|
import 'node:querystring';
|
|
13
13
|
import 'node:stream';
|
|
14
|
-
import './server/chunks/chunks/shared.js-
|
|
15
|
-
import './server/chunks/chunks/internal.js-
|
|
16
|
-
import './server/chunks/chunks/utils.js-
|
|
17
|
-
import './server/chunks/index.js-
|
|
14
|
+
import './server/chunks/chunks/shared.js-Dob0TlTu.js';
|
|
15
|
+
import './server/chunks/chunks/internal.js-Dn37LrAW.js';
|
|
16
|
+
import './server/chunks/chunks/utils.js-B4YimMxv.js';
|
|
17
|
+
import './server/chunks/index.js-CdmTWQz8.js';
|
|
18
18
|
import './server/chunks/chunks/internal2.js-BlXt2rfE.js';
|
|
19
|
-
import './server/chunks/chunks/exports.js-
|
|
19
|
+
import './server/chunks/chunks/exports.js-DvhE7Ffd.js';
|
|
20
20
|
import './server/chunks/chunks/routing.js-y-tryuip.js';
|
|
21
|
-
import './server/chunks/manifest.js-
|
|
21
|
+
import './server/chunks/manifest.js-GhfNr35x.js';
|
|
22
22
|
import 'node:url';
|
|
23
23
|
|
|
24
24
|
const path = env('SOCKET_PATH', false);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import './core.js-
|
|
2
|
-
import {
|
|
3
|
-
import { s as serverPluginsByType, i as isRecord, L as LibraryStore, a as serverPluginForType, p as processAssets, g as generateManifestModules, c as collectAllReferences, d as descriptorsByType, b as computeLibraryMembership, e as allDeliveredAssetIds, f as compareCodeUnits, r as readCurrentProxy, h as encodeRelativePathForUrl } from './library-store.js-CZCDpai0.js';
|
|
1
|
+
import { f as folderOfRawPath, r as rawFileNameOfPath, C as typesForFileName, D as proposeAssetId, e as parentFolderPath, m as portableFolderPathKey, b as assetIdError } from './core.js-EA_ysb1J.js';
|
|
2
|
+
import { s as serverPluginsByType, i as isRecord, L as LibraryStore, a as serverPluginForType, v as verifyStableRawFile, p as processAssets, g as generateManifestModules, c as collectAllReferences, d as descriptorsByType, b as computeLibraryMembership, e as allDeliveredAssetIds, f as compareCodeUnits, r as readCurrentProxy, h as encodeRelativePathForUrl, j as classifyRawDirectory } from './library-store.js-DJ-JRE-g.js';
|
|
4
3
|
import { isAbsolute, resolve, join } from 'node:path';
|
|
5
4
|
import { existsSync } from 'node:fs';
|
|
6
5
|
import { createJiti } from 'jiti';
|
|
@@ -63,6 +62,60 @@ async function loadConfig(projectRoot) {
|
|
|
63
62
|
return resolveConfig(root, isRecord(module) && "default" in module ? module.default : module);
|
|
64
63
|
}
|
|
65
64
|
//#endregion
|
|
65
|
+
//#region src/lib/server/raw-safety.ts
|
|
66
|
+
function rawSafetyIssueKey(issue) {
|
|
67
|
+
return `${issue.kind}|${issue.assetId ?? ""}|${issue.path}`;
|
|
68
|
+
}
|
|
69
|
+
/** Managed-source safety gate shared by editor operations and `fundus build`. */
|
|
70
|
+
function rawSafetyIssues(library, classification, compatibleTypes) {
|
|
71
|
+
const issues = [];
|
|
72
|
+
if (!classification.complete) for (const diagnostic of classification.diagnostics) issues.push({
|
|
73
|
+
kind: "incomplete",
|
|
74
|
+
path: diagnostic.path,
|
|
75
|
+
message: diagnostic.reason
|
|
76
|
+
});
|
|
77
|
+
for (const blocker of classification.blockers) {
|
|
78
|
+
const affected = blocker.assetId ? [blocker.assetId] : Object.entries(library.assets).filter(([, record]) => record.raw === blocker.path || record.raw.startsWith(`${blocker.path}/`)).map(([assetId]) => assetId);
|
|
79
|
+
for (const assetId of affected) issues.push({
|
|
80
|
+
kind: "blocker",
|
|
81
|
+
path: blocker.path,
|
|
82
|
+
assetId,
|
|
83
|
+
message: `Raw source "${blocker.path}" is unsafe: ${blocker.reason}`
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
for (const missing of classification.deletions) issues.push({
|
|
87
|
+
kind: "missing",
|
|
88
|
+
path: missing.path,
|
|
89
|
+
assetId: missing.assetId,
|
|
90
|
+
message: `Raw file "${missing.path}" is missing from the raw directory.`
|
|
91
|
+
});
|
|
92
|
+
for (const move of classification.moves) issues.push({
|
|
93
|
+
kind: "missing",
|
|
94
|
+
path: move.from,
|
|
95
|
+
assetId: move.assetId,
|
|
96
|
+
message: `Raw file "${move.from}" is missing from the raw directory.`
|
|
97
|
+
});
|
|
98
|
+
for (const edited of classification.edited) issues.push({
|
|
99
|
+
kind: "edited",
|
|
100
|
+
path: edited.path,
|
|
101
|
+
assetId: edited.assetId,
|
|
102
|
+
message: `Raw file "${edited.path}" changed outside Fundus.`
|
|
103
|
+
});
|
|
104
|
+
for (const [assetId, record] of Object.entries(library.assets)) if (!compatibleTypes(record.raw).includes(record.type)) issues.push({
|
|
105
|
+
kind: "type-incompatible",
|
|
106
|
+
path: record.raw,
|
|
107
|
+
assetId,
|
|
108
|
+
message: `Raw file "${record.raw}" is not compatible with its current ${record.type} type.`
|
|
109
|
+
});
|
|
110
|
+
const seen = /* @__PURE__ */ new Set();
|
|
111
|
+
return issues.filter((issue) => {
|
|
112
|
+
const key = rawSafetyIssueKey(issue);
|
|
113
|
+
if (seen.has(key)) return false;
|
|
114
|
+
seen.add(key);
|
|
115
|
+
return true;
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
//#endregion
|
|
66
119
|
//#region src/lib/server/operations.ts
|
|
67
120
|
/**
|
|
68
121
|
* The one operations layer: builds the state payload and runs
|
|
@@ -89,6 +142,8 @@ var FundusOperations = class {
|
|
|
89
142
|
#config;
|
|
90
143
|
#registry;
|
|
91
144
|
#store;
|
|
145
|
+
#operationQueue = Promise.resolve();
|
|
146
|
+
#pipelineQueue = Promise.resolve();
|
|
92
147
|
constructor(config, registry = serverPluginsByType) {
|
|
93
148
|
this.#config = config;
|
|
94
149
|
this.#registry = registry;
|
|
@@ -100,9 +155,146 @@ var FundusOperations = class {
|
|
|
100
155
|
get store() {
|
|
101
156
|
return this.#store;
|
|
102
157
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
158
|
+
#enqueueOperation(operation) {
|
|
159
|
+
const run = this.#operationQueue.then(operation, operation);
|
|
160
|
+
this.#operationQueue = run.then(() => {}, () => {});
|
|
161
|
+
return run;
|
|
162
|
+
}
|
|
163
|
+
/** Read-only state snapshot, serialized with mutations but never processing or writing. */
|
|
164
|
+
state() {
|
|
165
|
+
return this.#enqueueOperation(() => this.#state());
|
|
166
|
+
}
|
|
167
|
+
async #state() {
|
|
168
|
+
await this.#pipelineQueue;
|
|
169
|
+
const library = await this.#store.read();
|
|
170
|
+
const classification = await this.#classifyRawDirectory(library);
|
|
171
|
+
return this.#snapshotState(library, classification);
|
|
172
|
+
}
|
|
173
|
+
/** Reconcile only changes that are safe without a user decision: unique moves and deletions. */
|
|
174
|
+
reconcileRawState() {
|
|
175
|
+
return this.#enqueueOperation(async () => {
|
|
176
|
+
let library = await this.#store.read();
|
|
177
|
+
let classification = await this.#classifyRawDirectory(library);
|
|
178
|
+
if (!this.#canAutoReconcile(classification)) return this.#snapshotState(library, classification);
|
|
179
|
+
for (let pass = 0; pass < 2; pass++) {
|
|
180
|
+
const result = await this.#store.transactCandidate(async (candidate, current) => {
|
|
181
|
+
const fresh = await this.#classifyRawDirectory(current);
|
|
182
|
+
const affectedIds = [];
|
|
183
|
+
if (!this.#canAutoReconcile(fresh)) return {
|
|
184
|
+
classification: fresh,
|
|
185
|
+
affectedIds
|
|
186
|
+
};
|
|
187
|
+
for (const move of fresh.moves) {
|
|
188
|
+
candidate.assets[move.assetId].raw = move.path;
|
|
189
|
+
this.#registerFolderAncestors(candidate, folderOfRawPath(move.path));
|
|
190
|
+
affectedIds.push(move.assetId);
|
|
191
|
+
}
|
|
192
|
+
for (const deletion of fresh.deletions) {
|
|
193
|
+
delete candidate.assets[deletion.assetId];
|
|
194
|
+
affectedIds.push(deletion.assetId);
|
|
195
|
+
}
|
|
196
|
+
return {
|
|
197
|
+
classification: fresh,
|
|
198
|
+
affectedIds
|
|
199
|
+
};
|
|
200
|
+
});
|
|
201
|
+
library = result.library;
|
|
202
|
+
classification = result.value.classification;
|
|
203
|
+
if (!result.changed) return this.#snapshotState(library, classification);
|
|
204
|
+
await this.#store.syncFolders(library);
|
|
205
|
+
for (const id of result.value.affectedIds) await this.#store.deleteProxiesOf(id);
|
|
206
|
+
const snapshot = await this.#afterMutationSnapshot(library);
|
|
207
|
+
library = snapshot.library;
|
|
208
|
+
classification = snapshot.classification;
|
|
209
|
+
if (classification.moves.length === 0 && classification.deletions.length === 0) return snapshot.state;
|
|
210
|
+
if (!this.#canAutoReconcile(classification, true)) return snapshot.state;
|
|
211
|
+
}
|
|
212
|
+
return this.#snapshotState(library, classification, [{ message: "Raw directory kept changing during reconciliation; refresh again after external file operations settle." }]);
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
/** Adopt an already-existing raw file without copying, renaming, or deleting it. */
|
|
216
|
+
adoptRawFile(token, id, type, manifests = []) {
|
|
217
|
+
return this.#enqueueOperation(async () => {
|
|
218
|
+
const result = await this.#store.transactCandidate(async (candidate, current) => {
|
|
219
|
+
const file = (await this.#classifyRawDirectory(current)).unmanaged.find((entry) => this.#newToken(entry.path, entry.hash) === token);
|
|
220
|
+
if (!file) throw new Error("This ingestion item is stale; refresh the editor and try again.");
|
|
221
|
+
const idProblem = assetIdError(id);
|
|
222
|
+
if (idProblem) throw new Error(idProblem);
|
|
223
|
+
if (Object.hasOwn(candidate.assets, id)) throw new Error(`An asset with id "${id}" already exists.`);
|
|
224
|
+
if (!this.#compatibleTypes(file.path).includes(type)) throw new Error(`The ${type} type does not accept "${file.path}".`);
|
|
225
|
+
const uniqueManifests = [...new Set(manifests)];
|
|
226
|
+
for (const name of uniqueManifests) if (!Object.hasOwn(candidate.manifests, name)) throw new Error(`Unknown manifest "${name}".`);
|
|
227
|
+
const plugin = serverPluginForType(type, this.#registry);
|
|
228
|
+
let parameters = plugin.descriptor.defaultParameters(plugin.pluginConfig(this.#config));
|
|
229
|
+
parameters = plugin.descriptor.validateParameters(parameters);
|
|
230
|
+
if (plugin.seedIngestParameters) {
|
|
231
|
+
const seeded = await plugin.seedIngestParameters({
|
|
232
|
+
rawPath: join(this.#config.rawDir, file.path),
|
|
233
|
+
rawFileName: rawFileNameOfPath(file.path),
|
|
234
|
+
parameters,
|
|
235
|
+
config: this.#config
|
|
236
|
+
});
|
|
237
|
+
if (seeded !== void 0) parameters = plugin.descriptor.validateParameters(seeded);
|
|
238
|
+
}
|
|
239
|
+
await verifyStableRawFile(join(this.#config.rawDir, file.path), file.hash);
|
|
240
|
+
this.#registerFolderAncestors(candidate, folderOfRawPath(file.path));
|
|
241
|
+
candidate.assets[id] = {
|
|
242
|
+
type,
|
|
243
|
+
raw: file.path,
|
|
244
|
+
rawHash: file.hash,
|
|
245
|
+
parameters,
|
|
246
|
+
manifests: uniqueManifests.sort()
|
|
247
|
+
};
|
|
248
|
+
});
|
|
249
|
+
await this.#store.syncFolders(result.library);
|
|
250
|
+
return this.#afterMutation(result.library);
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
/** Reset/reseed edited bytes, optionally changing to another compatible type. */
|
|
254
|
+
acceptEditedRawFile(token, type) {
|
|
255
|
+
return this.#enqueueOperation(async () => {
|
|
256
|
+
const result = await this.#store.transactCandidate(async (candidate, current) => {
|
|
257
|
+
const classification = await this.#classifyRawDirectory(current);
|
|
258
|
+
const edited = this.#editedRawFiles(classification, current).find((entry) => this.#editedToken(entry.assetId, entry.path, entry.hash) === token);
|
|
259
|
+
if (!edited) throw new Error("This edited item is stale; refresh the editor and try again.");
|
|
260
|
+
if (!this.#compatibleTypes(edited.path).includes(type)) throw new Error(`The ${type} type does not accept "${edited.path}".`);
|
|
261
|
+
const plugin = serverPluginForType(type, this.#registry);
|
|
262
|
+
let parameters = plugin.descriptor.validateParameters(plugin.descriptor.defaultParameters(plugin.pluginConfig(this.#config)));
|
|
263
|
+
if (plugin.seedIngestParameters) {
|
|
264
|
+
const seeded = await plugin.seedIngestParameters({
|
|
265
|
+
rawPath: join(this.#config.rawDir, edited.path),
|
|
266
|
+
rawFileName: rawFileNameOfPath(edited.path),
|
|
267
|
+
parameters,
|
|
268
|
+
config: this.#config
|
|
269
|
+
});
|
|
270
|
+
if (seeded !== void 0) parameters = plugin.descriptor.validateParameters(seeded);
|
|
271
|
+
}
|
|
272
|
+
await verifyStableRawFile(join(this.#config.rawDir, edited.path), edited.hash);
|
|
273
|
+
const record = candidate.assets[edited.assetId];
|
|
274
|
+
record.type = type;
|
|
275
|
+
record.rawHash = edited.hash;
|
|
276
|
+
record.parameters = parameters;
|
|
277
|
+
return edited.assetId;
|
|
278
|
+
});
|
|
279
|
+
await this.#store.deleteProxiesOf(result.value);
|
|
280
|
+
return this.#afterMutation(result.library);
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
/** Accept edited bytes while preserving type, parameters, path and memberships. */
|
|
284
|
+
dismissEditedRawFile(token) {
|
|
285
|
+
return this.#enqueueOperation(async () => {
|
|
286
|
+
const result = await this.#store.transactCandidate(async (candidate, current) => {
|
|
287
|
+
const classification = await this.#classifyRawDirectory(current);
|
|
288
|
+
const edited = this.#editedRawFiles(classification, current).find((entry) => this.#editedToken(entry.assetId, entry.path, entry.hash) === token);
|
|
289
|
+
if (!edited) throw new Error("This edited item is stale; refresh the editor and try again.");
|
|
290
|
+
const record = current.assets[edited.assetId];
|
|
291
|
+
if (!this.#compatibleTypes(edited.path).includes(record.type)) throw new Error(`The moved file "${edited.path}" is not compatible with its current ${record.type} type; choose a compatible type and process it.`);
|
|
292
|
+
candidate.assets[edited.assetId].rawHash = edited.hash;
|
|
293
|
+
return edited.assetId;
|
|
294
|
+
});
|
|
295
|
+
await this.#store.deleteProxiesOf(result.value);
|
|
296
|
+
return this.#afterMutation(result.library);
|
|
297
|
+
});
|
|
106
298
|
}
|
|
107
299
|
/**
|
|
108
300
|
* Ingest an upload: store the raw file + record, then let the owning
|
|
@@ -113,7 +305,10 @@ var FundusOperations = class {
|
|
|
113
305
|
* explicit membership set in the same operation; a failing application
|
|
114
306
|
* rolls the whole ingest back, so a failed ingest leaves nothing behind.
|
|
115
307
|
*/
|
|
116
|
-
|
|
308
|
+
ingest(options) {
|
|
309
|
+
return this.#enqueueOperation(() => this.#ingest(options));
|
|
310
|
+
}
|
|
311
|
+
async #ingest(options) {
|
|
117
312
|
let library = await this.#store.ingest(options);
|
|
118
313
|
try {
|
|
119
314
|
const plugin = serverPluginForType(options.type, this.#registry);
|
|
@@ -138,7 +333,10 @@ var FundusOperations = class {
|
|
|
138
333
|
return this.#afterMutation(library);
|
|
139
334
|
}
|
|
140
335
|
/** Apply a PATCH body: parameters and/or manifests and/or a rename — in that order. */
|
|
141
|
-
|
|
336
|
+
patchAsset(id, body) {
|
|
337
|
+
return this.#enqueueOperation(() => this.#patchAsset(id, body));
|
|
338
|
+
}
|
|
339
|
+
async #patchAsset(id, body) {
|
|
142
340
|
let library = await this.#store.read();
|
|
143
341
|
this.#requireAsset(library, id);
|
|
144
342
|
if (body.parameters !== void 0) library = await this.#store.updateParameters(id, body.parameters);
|
|
@@ -156,15 +354,24 @@ var FundusOperations = class {
|
|
|
156
354
|
}
|
|
157
355
|
return this.#afterMutation(library);
|
|
158
356
|
}
|
|
159
|
-
|
|
357
|
+
moveAsset(id, folder) {
|
|
358
|
+
return this.#enqueueOperation(() => this.#moveAsset(id, folder));
|
|
359
|
+
}
|
|
360
|
+
async #moveAsset(id, folder) {
|
|
160
361
|
return this.#afterMutation(await this.#store.moveAsset(id, folder));
|
|
161
362
|
}
|
|
162
363
|
/** Replace the raw bytes/name and run the normal processing + codegen tail. */
|
|
163
|
-
|
|
364
|
+
replaceRawFile(id, options) {
|
|
365
|
+
return this.#enqueueOperation(() => this.#replaceRawFile(id, options));
|
|
366
|
+
}
|
|
367
|
+
async #replaceRawFile(id, options) {
|
|
164
368
|
return this.#afterMutation(await this.#store.replaceRawFile(id, options));
|
|
165
369
|
}
|
|
166
370
|
/** Move a selected asset set as one editor action and roll back on any failure. */
|
|
167
|
-
|
|
371
|
+
moveAssets(assetIds, folder) {
|
|
372
|
+
return this.#enqueueOperation(() => this.#moveAssets(assetIds, folder));
|
|
373
|
+
}
|
|
374
|
+
async #moveAssets(assetIds, folder) {
|
|
168
375
|
const uniqueIds = [...new Set(assetIds)];
|
|
169
376
|
if (uniqueIds.length === 0) throw new Error("At least one asset id is required.");
|
|
170
377
|
const originalFolders = /* @__PURE__ */ new Map();
|
|
@@ -187,16 +394,28 @@ var FundusOperations = class {
|
|
|
187
394
|
throw cause;
|
|
188
395
|
}
|
|
189
396
|
}
|
|
190
|
-
|
|
397
|
+
createFolder(path) {
|
|
398
|
+
return this.#enqueueOperation(() => this.#createFolder(path));
|
|
399
|
+
}
|
|
400
|
+
async #createFolder(path) {
|
|
191
401
|
return this.#afterMutation(await this.#store.createFolder(path));
|
|
192
402
|
}
|
|
193
|
-
|
|
403
|
+
renameFolder(path, newName) {
|
|
404
|
+
return this.#enqueueOperation(() => this.#renameFolder(path, newName));
|
|
405
|
+
}
|
|
406
|
+
async #renameFolder(path, newName) {
|
|
194
407
|
return this.#afterMutation(await this.#store.renameFolder(path, newName));
|
|
195
408
|
}
|
|
196
|
-
|
|
409
|
+
moveFolder(path, parent) {
|
|
410
|
+
return this.#enqueueOperation(() => this.#moveFolder(path, parent));
|
|
411
|
+
}
|
|
412
|
+
async #moveFolder(path, parent) {
|
|
197
413
|
return this.#afterMutation(await this.#store.moveFolder(path, parent));
|
|
198
414
|
}
|
|
199
|
-
|
|
415
|
+
deleteFolder(path) {
|
|
416
|
+
return this.#enqueueOperation(() => this.#deleteFolder(path));
|
|
417
|
+
}
|
|
418
|
+
async #deleteFolder(path) {
|
|
200
419
|
const result = await this.#store.deleteFolder(path);
|
|
201
420
|
return this.#afterMutation(result.library);
|
|
202
421
|
}
|
|
@@ -208,7 +427,10 @@ var FundusOperations = class {
|
|
|
208
427
|
* rejected with nothing written. The REST `patchAsset` keeps the editor's
|
|
209
428
|
* lenient replace semantics.
|
|
210
429
|
*/
|
|
211
|
-
|
|
430
|
+
setAsset(id, changes) {
|
|
431
|
+
return this.#enqueueOperation(() => this.#setAsset(id, changes));
|
|
432
|
+
}
|
|
433
|
+
async #setAsset(id, changes) {
|
|
212
434
|
const library = await this.#store.read();
|
|
213
435
|
this.#requireAsset(library, id);
|
|
214
436
|
return this.#afterMutation(await this.#applyAssetChanges(library, id, changes));
|
|
@@ -218,7 +440,10 @@ var FundusOperations = class {
|
|
|
218
440
|
* a referrer keeps pointing at the old id, so renaming a referenced asset
|
|
219
441
|
* introduces dangling-reference errors. Update the referrers first.
|
|
220
442
|
*/
|
|
221
|
-
|
|
443
|
+
renameAsset(id, newId) {
|
|
444
|
+
return this.#enqueueOperation(() => this.#renameAsset(id, newId));
|
|
445
|
+
}
|
|
446
|
+
async #renameAsset(id, newId) {
|
|
222
447
|
const library = await this.#store.read();
|
|
223
448
|
this.#requireAsset(library, id);
|
|
224
449
|
if (newId !== id && !Object.hasOwn(library.assets, newId)) {
|
|
@@ -235,7 +460,10 @@ var FundusOperations = class {
|
|
|
235
460
|
* (the asset is a reference target) is rejected before anything —
|
|
236
461
|
* including the raw file — is removed; the REST route stays lenient.
|
|
237
462
|
*/
|
|
238
|
-
|
|
463
|
+
deleteAsset(id, options) {
|
|
464
|
+
return this.#enqueueOperation(() => this.#deleteAsset(id, options));
|
|
465
|
+
}
|
|
466
|
+
async #deleteAsset(id, options) {
|
|
239
467
|
if (options?.failOnIntroducedIssues) {
|
|
240
468
|
const library = await this.#store.read();
|
|
241
469
|
this.#requireAsset(library, id);
|
|
@@ -246,19 +474,31 @@ var FundusOperations = class {
|
|
|
246
474
|
return this.#afterMutation(await this.#store.deleteAsset(id));
|
|
247
475
|
}
|
|
248
476
|
/** Delete a selected asset set as one lenient editor mutation. */
|
|
249
|
-
|
|
477
|
+
deleteAssets(assetIds) {
|
|
478
|
+
return this.#enqueueOperation(() => this.#deleteAssets(assetIds));
|
|
479
|
+
}
|
|
480
|
+
async #deleteAssets(assetIds) {
|
|
250
481
|
const uniqueIds = [...new Set(assetIds)];
|
|
251
482
|
if (uniqueIds.length === 0) throw new Error("At least one asset id is required.");
|
|
252
483
|
return this.#afterMutation(await this.#store.deleteAssets(uniqueIds));
|
|
253
484
|
}
|
|
254
|
-
|
|
485
|
+
createManifest(name) {
|
|
486
|
+
return this.#enqueueOperation(() => this.#createManifest(name));
|
|
487
|
+
}
|
|
488
|
+
async #createManifest(name) {
|
|
255
489
|
return this.#afterMutation(await this.#store.createManifest(name));
|
|
256
490
|
}
|
|
257
|
-
|
|
491
|
+
setManifestAppearance(name, appearance) {
|
|
492
|
+
return this.#enqueueOperation(() => this.#setManifestAppearance(name, appearance));
|
|
493
|
+
}
|
|
494
|
+
async #setManifestAppearance(name, appearance) {
|
|
258
495
|
return this.#afterMutation(await this.#store.setManifestAppearance(name, appearance));
|
|
259
496
|
}
|
|
260
497
|
/** Apply a PATCH body: appearance fields and/or a rename — in that order. */
|
|
261
|
-
|
|
498
|
+
patchManifest(name, body) {
|
|
499
|
+
return this.#enqueueOperation(() => this.#patchManifest(name, body));
|
|
500
|
+
}
|
|
501
|
+
async #patchManifest(name, body) {
|
|
262
502
|
let library = await this.#store.setManifestAppearance(name, {
|
|
263
503
|
color: body.color,
|
|
264
504
|
emoji: body.emoji
|
|
@@ -275,26 +515,47 @@ var FundusOperations = class {
|
|
|
275
515
|
* the module must be updated by hand — both the file name and the exported
|
|
276
516
|
* const change with the manifest name.
|
|
277
517
|
*/
|
|
278
|
-
|
|
518
|
+
renameManifest(name, newName) {
|
|
519
|
+
return this.#enqueueOperation(() => this.#renameManifest(name, newName));
|
|
520
|
+
}
|
|
521
|
+
async #renameManifest(name, newName) {
|
|
279
522
|
return this.#afterMutation(await this.#store.renameManifest(name, newName));
|
|
280
523
|
}
|
|
281
|
-
|
|
524
|
+
deleteManifest(name) {
|
|
525
|
+
return this.#enqueueOperation(() => this.#deleteManifest(name));
|
|
526
|
+
}
|
|
527
|
+
async #deleteManifest(name) {
|
|
282
528
|
return this.#afterMutation(await this.#store.deleteManifest(name));
|
|
283
529
|
}
|
|
284
530
|
/** The autosave chain tail: process + regenerate, then report fresh state. */
|
|
285
531
|
async #afterMutation(library) {
|
|
532
|
+
return (await this.#afterMutationSnapshot(library)).state;
|
|
533
|
+
}
|
|
534
|
+
async #afterMutationSnapshot(library) {
|
|
535
|
+
const run = this.#pipelineQueue.then(() => this.#runAfterMutation(library), () => this.#runAfterMutation(library));
|
|
536
|
+
this.#pipelineQueue = run.then(() => {}, () => {});
|
|
537
|
+
return run;
|
|
538
|
+
}
|
|
539
|
+
async #runAfterMutation(library) {
|
|
286
540
|
const pipelineIssues = [];
|
|
287
|
-
const
|
|
288
|
-
|
|
541
|
+
const classification = await this.#classifyRawDirectory(library);
|
|
542
|
+
const ordinaryIssues = await this.#store.validate(library);
|
|
543
|
+
const safetyIssues = this.#rawSafetyIssues(library, classification);
|
|
544
|
+
if (ordinaryIssues.length === 0 && safetyIssues.length === 0) try {
|
|
289
545
|
const report = await processAssets(this.#config, library, this.#registry);
|
|
290
546
|
await generateManifestModules(this.#config, library, report.proxies, this.#registry);
|
|
291
547
|
} catch (cause) {
|
|
292
548
|
pipelineIssues.push({ message: `Processing failed: ${cause instanceof Error ? cause.message : String(cause)}` });
|
|
293
549
|
}
|
|
294
|
-
|
|
550
|
+
const latestLibrary = await this.#store.read();
|
|
551
|
+
const latestClassification = await this.#classifyRawDirectory(latestLibrary);
|
|
552
|
+
return {
|
|
553
|
+
library: latestLibrary,
|
|
554
|
+
classification: latestClassification,
|
|
555
|
+
state: await this.#snapshotState(latestLibrary, latestClassification, pipelineIssues)
|
|
556
|
+
};
|
|
295
557
|
}
|
|
296
|
-
async #buildState(library,
|
|
297
|
-
const issues = [...precomputedIssues ?? await this.#store.validate(library), ...extraIssues];
|
|
558
|
+
async #buildState(library, issues, classification) {
|
|
298
559
|
const referencesByAsset = collectAllReferences(library, descriptorsByType(this.#registry));
|
|
299
560
|
const membershipByManifest = computeLibraryMembership(library, referencesByAsset);
|
|
300
561
|
const delivered = allDeliveredAssetIds(membershipByManifest);
|
|
@@ -376,9 +637,118 @@ var FundusOperations = class {
|
|
|
376
637
|
issues,
|
|
377
638
|
presetNames,
|
|
378
639
|
manifestMemberships,
|
|
379
|
-
manifestDeliveredBytes
|
|
640
|
+
manifestDeliveredBytes,
|
|
641
|
+
rawIngestionQueue: this.#buildRawIngestionQueue(library, classification)
|
|
380
642
|
};
|
|
381
643
|
}
|
|
644
|
+
#compatibleTypes(path) {
|
|
645
|
+
return typesForFileName(path, Object.values(this.#registry).map((plugin) => plugin.descriptor)).sort(compareCodeUnits);
|
|
646
|
+
}
|
|
647
|
+
#classifyRawDirectory(library) {
|
|
648
|
+
return classifyRawDirectory(this.#config.rawDir, library, (path) => this.#compatibleTypes(path).length > 0);
|
|
649
|
+
}
|
|
650
|
+
#rawSafetyIssues(library, classification) {
|
|
651
|
+
return rawSafetyIssues(library, classification, (path) => this.#compatibleTypes(path));
|
|
652
|
+
}
|
|
653
|
+
async #snapshotState(library, classification, extraIssues = []) {
|
|
654
|
+
const issues = [
|
|
655
|
+
...await this.#store.validate(library),
|
|
656
|
+
...this.#rawSafetyIssues(library, classification),
|
|
657
|
+
...extraIssues
|
|
658
|
+
];
|
|
659
|
+
const seen = /* @__PURE__ */ new Set();
|
|
660
|
+
const uniqueIssues = issues.filter((issue) => {
|
|
661
|
+
const key = `${issue.assetId ?? ""}|${issue.message}`;
|
|
662
|
+
if (seen.has(key)) return false;
|
|
663
|
+
seen.add(key);
|
|
664
|
+
return true;
|
|
665
|
+
});
|
|
666
|
+
return this.#buildState(library, uniqueIssues, classification);
|
|
667
|
+
}
|
|
668
|
+
#canAutoReconcile(classification, retry = false) {
|
|
669
|
+
return classification.complete && classification.blockers.length === 0 && classification.moves.length + classification.deletions.length > 0 && (!retry || classification.edited.length === 0 && classification.unmanaged.length === 0);
|
|
670
|
+
}
|
|
671
|
+
#newToken(path, hash) {
|
|
672
|
+
return `new:${path}:${hash}`;
|
|
673
|
+
}
|
|
674
|
+
#editedToken(assetId, path, hash) {
|
|
675
|
+
return `edited:${assetId}:${path}:${hash}`;
|
|
676
|
+
}
|
|
677
|
+
#proposedId(path, reservedIds) {
|
|
678
|
+
const base = proposeAssetId(rawFileNameOfPath(path));
|
|
679
|
+
if (!reservedIds.has(base)) return base;
|
|
680
|
+
for (let index = 2;; index++) {
|
|
681
|
+
const candidate = `${base}${index}`;
|
|
682
|
+
if (!reservedIds.has(candidate)) return candidate;
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
#buildRawIngestionQueue(library, classification) {
|
|
686
|
+
const queue = [];
|
|
687
|
+
const reservedIds = new Set(Object.keys(library.assets));
|
|
688
|
+
for (const file of classification.unmanaged) {
|
|
689
|
+
const compatibleTypes = this.#compatibleTypes(file.path);
|
|
690
|
+
const proposedId = this.#proposedId(file.path, reservedIds);
|
|
691
|
+
reservedIds.add(proposedId);
|
|
692
|
+
queue.push({
|
|
693
|
+
kind: "new",
|
|
694
|
+
token: this.#newToken(file.path, file.hash),
|
|
695
|
+
path: file.path,
|
|
696
|
+
hash: file.hash,
|
|
697
|
+
compatibleTypes,
|
|
698
|
+
proposedId
|
|
699
|
+
});
|
|
700
|
+
}
|
|
701
|
+
for (const edited of this.#editedRawFiles(classification, library)) {
|
|
702
|
+
const currentType = library.assets[edited.assetId].type;
|
|
703
|
+
queue.push({
|
|
704
|
+
kind: "edited",
|
|
705
|
+
token: this.#editedToken(edited.assetId, edited.path, edited.hash),
|
|
706
|
+
path: edited.path,
|
|
707
|
+
hash: edited.hash,
|
|
708
|
+
assetId: edited.assetId,
|
|
709
|
+
currentType,
|
|
710
|
+
compatibleTypes: this.#compatibleTypes(edited.path)
|
|
711
|
+
});
|
|
712
|
+
}
|
|
713
|
+
for (const blocker of classification.blockers) queue.push({
|
|
714
|
+
kind: "unsupported",
|
|
715
|
+
token: `unsupported:${blocker.path}:${blocker.reason}`,
|
|
716
|
+
path: blocker.path,
|
|
717
|
+
reason: blocker.reason
|
|
718
|
+
});
|
|
719
|
+
for (const diagnostic of classification.diagnostics) queue.push({
|
|
720
|
+
kind: "unsupported",
|
|
721
|
+
token: `unsupported:raw-directory:${diagnostic.reason}`,
|
|
722
|
+
path: diagnostic.path || "Raw directory",
|
|
723
|
+
reason: diagnostic.reason
|
|
724
|
+
});
|
|
725
|
+
return queue.sort((a, b) => compareCodeUnits(a.path, b.path));
|
|
726
|
+
}
|
|
727
|
+
#editedRawFiles(classification, library) {
|
|
728
|
+
const edited = new Map(classification.edited.map((entry) => [entry.assetId, entry]));
|
|
729
|
+
for (const assetId of classification.unchangedAssetIds) {
|
|
730
|
+
const record = library.assets[assetId];
|
|
731
|
+
if (!this.#compatibleTypes(record.raw).includes(record.type)) edited.set(assetId, {
|
|
732
|
+
assetId,
|
|
733
|
+
path: record.raw,
|
|
734
|
+
hash: record.rawHash
|
|
735
|
+
});
|
|
736
|
+
}
|
|
737
|
+
return [...edited.values()].sort((a, b) => compareCodeUnits(a.path, b.path));
|
|
738
|
+
}
|
|
739
|
+
#registerFolderAncestors(library, folder) {
|
|
740
|
+
if (folder === "") return;
|
|
741
|
+
const missing = [];
|
|
742
|
+
for (let current = folder; current !== ""; current = parentFolderPath(current)) if (!library.folders.includes(current)) missing.push(current);
|
|
743
|
+
const keys = new Map(library.folders.map((path) => [portableFolderPathKey(path), path]));
|
|
744
|
+
for (const path of missing.reverse()) {
|
|
745
|
+
const collision = keys.get(portableFolderPathKey(path));
|
|
746
|
+
if (collision !== void 0 && collision !== path) throw new Error(`Folder "${path}" collides with existing folder "${collision}".`);
|
|
747
|
+
library.folders.push(path);
|
|
748
|
+
keys.set(portableFolderPathKey(path), path);
|
|
749
|
+
}
|
|
750
|
+
library.folders.sort(compareCodeUnits);
|
|
751
|
+
}
|
|
382
752
|
#requireAsset(library, id) {
|
|
383
753
|
if (!Object.hasOwn(library.assets, id)) throw new Error(`Unknown asset "${id}".`);
|
|
384
754
|
}
|
|
@@ -430,4 +800,4 @@ async function createFundusContext() {
|
|
|
430
800
|
}
|
|
431
801
|
|
|
432
802
|
export { getFundusContext as g, initializeFundusContext as i };
|
|
433
|
-
//# sourceMappingURL=context.js-
|
|
803
|
+
//# sourceMappingURL=context.js-B77ZAVLi.js.map
|