fundus 0.0.2 → 0.0.3
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 +58 -0
- 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/2.wavcNhPC.css +1 -0
- package/build/client/_app/immutable/assets/2.wavcNhPC.css.br +0 -0
- package/build/client/_app/immutable/assets/2.wavcNhPC.css.gz +0 -0
- package/build/client/_app/immutable/assets/3.Cjh_fXPY.css +1 -0
- package/build/client/_app/immutable/assets/3.Cjh_fXPY.css.br +0 -0
- package/build/client/_app/immutable/assets/3.Cjh_fXPY.css.gz +0 -0
- package/build/client/_app/immutable/assets/4.p004hmEN.css +1 -0
- package/build/client/_app/immutable/assets/4.p004hmEN.css.br +0 -0
- package/build/client/_app/immutable/assets/4.p004hmEN.css.gz +0 -0
- package/build/client/_app/immutable/assets/ConfirmDialog.BdKlitwi.css +1 -0
- package/build/client/_app/immutable/assets/ConfirmDialog.BdKlitwi.css.br +0 -0
- package/build/client/_app/immutable/assets/ConfirmDialog.BdKlitwi.css.gz +0 -0
- package/build/client/_app/immutable/assets/LibraryContextMenu.zyZtpKzC.css +1 -0
- package/build/client/_app/immutable/assets/LibraryContextMenu.zyZtpKzC.css.br +0 -0
- package/build/client/_app/immutable/assets/LibraryContextMenu.zyZtpKzC.css.gz +0 -0
- package/build/client/_app/immutable/chunks/BiIto6ft.js +1 -0
- package/build/client/_app/immutable/chunks/BiIto6ft.js.br +0 -0
- package/build/client/_app/immutable/chunks/BiIto6ft.js.gz +0 -0
- package/build/client/_app/immutable/chunks/Bjy-W4x2.js.br +0 -0
- package/build/client/_app/immutable/chunks/Bjy-W4x2.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/CO4RBJfa.js.br +0 -0
- package/build/client/_app/immutable/chunks/CO4RBJfa.js.gz +0 -0
- package/{dist/editor/_app/immutable/chunks/DjvOiDmq.js → build/client/_app/immutable/chunks/CvY6YsFE.js} +1 -1
- package/build/client/_app/immutable/chunks/CvY6YsFE.js.br +0 -0
- package/build/client/_app/immutable/chunks/CvY6YsFE.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DL0_39Ys.js +5 -0
- package/build/client/_app/immutable/chunks/DL0_39Ys.js.br +0 -0
- package/build/client/_app/immutable/chunks/DL0_39Ys.js.gz +0 -0
- package/{dist/editor/_app/immutable/chunks/BfPE5wdt.js → build/client/_app/immutable/chunks/DQ8SXFaX.js} +1 -1
- package/build/client/_app/immutable/chunks/DQ8SXFaX.js.br +0 -0
- package/build/client/_app/immutable/chunks/DQ8SXFaX.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DjdrdRzT.js.br +0 -0
- package/build/client/_app/immutable/chunks/DjdrdRzT.js.gz +0 -0
- package/build/client/_app/immutable/chunks/xihTtKlq.js.br +1 -0
- package/build/client/_app/immutable/chunks/xihTtKlq.js.gz +0 -0
- package/{dist/editor/_app/immutable/entry/app.BkqbfI8n.js → build/client/_app/immutable/entry/app.ubN0v9bN.js} +2 -2
- package/build/client/_app/immutable/entry/app.ubN0v9bN.js.br +0 -0
- package/build/client/_app/immutable/entry/app.ubN0v9bN.js.gz +0 -0
- package/build/client/_app/immutable/entry/start.BW8dBDh6.js +1 -0
- package/build/client/_app/immutable/entry/start.BW8dBDh6.js.br +0 -0
- package/build/client/_app/immutable/entry/start.BW8dBDh6.js.gz +0 -0
- package/{dist/editor/_app/immutable/nodes/0.xdMI5GEU.js → build/client/_app/immutable/nodes/0.Dr5ijCIl.js} +1 -1
- package/build/client/_app/immutable/nodes/0.Dr5ijCIl.js.br +0 -0
- package/build/client/_app/immutable/nodes/0.Dr5ijCIl.js.gz +0 -0
- package/{dist/editor/_app/immutable/nodes/1.D9p2tfoJ.js → build/client/_app/immutable/nodes/1.DiIGIRAb.js} +1 -1
- package/build/client/_app/immutable/nodes/1.DiIGIRAb.js.br +3 -0
- package/build/client/_app/immutable/nodes/1.DiIGIRAb.js.gz +0 -0
- package/{dist/editor/_app/immutable/nodes/2.BrA0Hyzu.js → build/client/_app/immutable/nodes/2.B8KYmQcV.js} +3 -3
- package/build/client/_app/immutable/nodes/2.B8KYmQcV.js.br +0 -0
- package/build/client/_app/immutable/nodes/2.B8KYmQcV.js.gz +0 -0
- package/build/client/_app/immutable/nodes/3.B1jc7arT.js +104 -0
- package/build/client/_app/immutable/nodes/3.B1jc7arT.js.br +0 -0
- package/build/client/_app/immutable/nodes/3.B1jc7arT.js.gz +0 -0
- package/build/client/_app/immutable/nodes/4.BPK9n1mH.js +2 -0
- package/build/client/_app/immutable/nodes/4.BPK9n1mH.js.br +0 -0
- package/build/client/_app/immutable/nodes/4.BPK9n1mH.js.gz +0 -0
- package/build/client/_app/version.json +1 -0
- package/build/client/_app/version.json.br +0 -0
- package/build/client/_app/version.json.gz +0 -0
- package/build/env.js +100 -0
- package/build/env.js.map +1 -0
- package/build/handler.js +22 -0
- package/build/handler.js.map +1 -0
- package/build/index.js +145 -0
- package/build/index.js.map +1 -0
- package/build/server/chunks/chunks/context.js-Bw4WWLhG.js +443 -0
- package/build/server/chunks/chunks/context.js-Bw4WWLhG.js.map +1 -0
- package/build/server/chunks/chunks/core.js-DDntpb72.js +409 -0
- package/build/server/chunks/chunks/core.js-DDntpb72.js.map +1 -0
- package/build/server/chunks/chunks/env.js-l0sNRNKZ.js +2 -0
- package/build/server/chunks/chunks/env.js-l0sNRNKZ.js.map +1 -0
- package/build/server/chunks/chunks/exports.js-CLTzaOxn.js +152 -0
- package/build/server/chunks/chunks/exports.js-CLTzaOxn.js.map +1 -0
- package/build/server/chunks/chunks/folder-path.js-ytx9ucgg.js +64 -0
- package/build/server/chunks/chunks/folder-path.js-ytx9ucgg.js.map +1 -0
- package/build/server/chunks/chunks/http.js-Dxoa-jtP.js +100 -0
- package/build/server/chunks/chunks/http.js-Dxoa-jtP.js.map +1 -0
- package/build/server/chunks/chunks/internal.js-BDBSzJId.js +5753 -0
- package/build/server/chunks/chunks/internal.js-BDBSzJId.js.map +1 -0
- package/build/server/chunks/chunks/internal2.js-BlXt2rfE.js +22 -0
- package/build/server/chunks/chunks/internal2.js-BlXt2rfE.js.map +1 -0
- package/{dist/operations-DYM-5KVl.js → build/server/chunks/chunks/library-store.js-BP8cL-qD.js} +344 -444
- package/build/server/chunks/chunks/library-store.js-BP8cL-qD.js.map +1 -0
- package/build/server/chunks/chunks/manifest-appearance.js-DTk355LQ.js +146 -0
- package/build/server/chunks/chunks/manifest-appearance.js-DTk355LQ.js.map +1 -0
- package/build/server/chunks/chunks/routing.js-y-tryuip.js +213 -0
- package/build/server/chunks/chunks/routing.js-y-tryuip.js.map +1 -0
- package/build/server/chunks/chunks/shared.js-BWXgl1Xf.js +255 -0
- package/build/server/chunks/chunks/shared.js-BWXgl1Xf.js.map +1 -0
- package/build/server/chunks/chunks/utils.js-9oI5Oz0w.js +1048 -0
- package/build/server/chunks/chunks/utils.js-9oI5Oz0w.js.map +1 -0
- package/build/server/chunks/entries/endpoints/api/_...path_/_server.ts.js-WknZVW_S.js +27 -0
- package/build/server/chunks/entries/endpoints/api/_...path_/_server.ts.js-WknZVW_S.js.map +1 -0
- package/build/server/chunks/entries/endpoints/api/assets/_id_/_server.ts.js-BrZ__-HZ.js +24 -0
- package/build/server/chunks/entries/endpoints/api/assets/_id_/_server.ts.js-BrZ__-HZ.js.map +1 -0
- package/build/server/chunks/entries/endpoints/api/assets/_server.ts.js-PqADGPXc.js +45 -0
- package/build/server/chunks/entries/endpoints/api/assets/_server.ts.js-PqADGPXc.js.map +1 -0
- package/build/server/chunks/entries/endpoints/api/assets/delete/_server.ts.js-OqoE5PN-.js +31 -0
- package/build/server/chunks/entries/endpoints/api/assets/delete/_server.ts.js-OqoE5PN-.js.map +1 -0
- package/build/server/chunks/entries/endpoints/api/assets/move/_server.ts.js-CJ08e1ho.js +31 -0
- package/build/server/chunks/entries/endpoints/api/assets/move/_server.ts.js-CJ08e1ho.js.map +1 -0
- package/build/server/chunks/entries/endpoints/api/folders/_path_/_server.ts.js-DdF3eK2I.js +38 -0
- package/build/server/chunks/entries/endpoints/api/folders/_path_/_server.ts.js-DdF3eK2I.js.map +1 -0
- package/build/server/chunks/entries/endpoints/api/folders/_server.ts.js-Cxt6jsJ5.js +31 -0
- package/build/server/chunks/entries/endpoints/api/folders/_server.ts.js-Cxt6jsJ5.js.map +1 -0
- package/build/server/chunks/entries/endpoints/api/manifests/_name_/_server.ts.js-BWVM2Ntl.js +24 -0
- package/build/server/chunks/entries/endpoints/api/manifests/_name_/_server.ts.js-BWVM2Ntl.js.map +1 -0
- package/build/server/chunks/entries/endpoints/api/manifests/_server.ts.js-Z2bM-qHM.js +31 -0
- package/build/server/chunks/entries/endpoints/api/manifests/_server.ts.js-Z2bM-qHM.js.map +1 -0
- package/build/server/chunks/entries/endpoints/api/state/_server.ts.js-BX9H2Z34.js +24 -0
- package/build/server/chunks/entries/endpoints/api/state/_server.ts.js-BX9H2Z34.js.map +1 -0
- package/build/server/chunks/entries/endpoints/files/_...path_/_server.ts.js-BWHDZ8mz.js +27 -0
- package/build/server/chunks/entries/endpoints/files/_...path_/_server.ts.js-BWHDZ8mz.js.map +1 -0
- package/build/server/chunks/entries/endpoints/files/proxy/_...path_/_server.ts.js-CR_7mndO.js +24 -0
- package/build/server/chunks/entries/endpoints/files/proxy/_...path_/_server.ts.js-CR_7mndO.js.map +1 -0
- package/build/server/chunks/entries/endpoints/files/raw/_...path_/_server.ts.js-Cw1PDBvb.js +24 -0
- package/build/server/chunks/entries/endpoints/files/raw/_...path_/_server.ts.js-Cw1PDBvb.js.map +1 -0
- package/build/server/chunks/entries/hooks.server.js-BHoE0yBi.js +23 -0
- package/build/server/chunks/entries/hooks.server.js-BHoE0yBi.js.map +1 -0
- package/build/server/chunks/handler-10cx4zHn.js +1475 -0
- package/build/server/chunks/handler-10cx4zHn.js.map +1 -0
- package/build/server/chunks/index.js-DvPfiC00.js +3789 -0
- package/build/server/chunks/index.js-DvPfiC00.js.map +1 -0
- package/build/server/chunks/manifest.js-DoPjUnzD.js +149 -0
- package/build/server/chunks/manifest.js-DoPjUnzD.js.map +1 -0
- package/build/server/chunks/nodes/0.js-Di3qgAtW.js +11 -0
- package/build/server/chunks/nodes/0.js-Di3qgAtW.js.map +1 -0
- package/build/server/chunks/nodes/1.js-BlWSFIA8.js +7 -0
- package/build/server/chunks/nodes/1.js-BlWSFIA8.js.map +1 -0
- package/build/server/chunks/nodes/2.js-CO9nSPUN.js +7 -0
- package/build/server/chunks/nodes/2.js-CO9nSPUN.js.map +1 -0
- package/build/server/chunks/nodes/3.js-C2D6xpEO.js +7 -0
- package/build/server/chunks/nodes/3.js-C2D6xpEO.js.map +1 -0
- package/build/server/chunks/nodes/4.js-B3IuagJW.js +7 -0
- package/build/server/chunks/nodes/4.js-B3IuagJW.js.map +1 -0
- package/build/shims.js +33 -0
- package/build/shims.js.map +1 -0
- package/dist/cli.d.ts +2 -1
- package/dist/cli.js +109 -1332
- package/dist/config.d.ts +3 -2
- package/dist/config.js +2 -2
- package/dist/core/api-types.d.ts +141 -0
- package/dist/core/api-types.js +1 -0
- package/dist/core/asset-id.d.ts +28 -0
- package/dist/core/asset-id.js +59 -0
- package/dist/core/asset-reference.d.ts +23 -0
- package/dist/core/asset-reference.js +15 -0
- package/dist/core/canonicalize.d.ts +9 -0
- package/dist/core/canonicalize.js +36 -0
- package/dist/core/chroma-key.d.ts +30 -0
- package/dist/core/chroma-key.js +55 -0
- package/dist/core/config.d.ts +35 -0
- package/dist/core/config.js +4 -0
- package/dist/core/folder-path.d.ts +19 -0
- package/dist/core/folder-path.js +86 -0
- package/dist/core/index.d.ts +33 -499
- package/dist/core/index.js +17 -962
- package/dist/core/ingest.d.ts +18 -0
- package/dist/core/ingest.js +58 -0
- package/dist/core/library.d.ts +54 -0
- package/dist/core/library.js +138 -0
- package/dist/core/manifest-appearance.d.ts +35 -0
- package/dist/core/manifest-appearance.js +123 -0
- package/dist/core/manifest-entry.d.ts +104 -0
- package/dist/core/manifest-entry.js +1 -0
- package/dist/core/manifest-membership.d.ts +56 -0
- package/dist/core/manifest-membership.js +54 -0
- package/dist/core/plugins/audio.d.ts +26 -0
- package/dist/core/plugins/audio.js +44 -0
- package/dist/core/plugins/chroma-key-video.d.ts +29 -0
- package/dist/core/plugins/chroma-key-video.js +69 -0
- package/dist/core/plugins/contract.d.ts +35 -0
- package/dist/core/plugins/contract.js +1 -0
- package/dist/core/plugins/image.d.ts +30 -0
- package/dist/core/plugins/image.js +45 -0
- package/dist/core/plugins/slice.d.ts +22 -0
- package/dist/core/plugins/slice.js +60 -0
- package/dist/core/plugins/video.d.ts +45 -0
- package/dist/core/plugins/video.js +77 -0
- package/dist/core/reference-graph.d.ts +41 -0
- package/dist/core/reference-graph.js +138 -0
- package/dist/core/slice-data.d.ts +61 -0
- package/dist/core/slice-data.js +49 -0
- package/dist/runtime/chroma-key-gl.d.ts +40 -22
- package/dist/runtime/chroma-key-gl.js +189 -183
- package/dist/runtime/components/ChromaKeyVideo.svelte +3 -3
- package/dist/runtime/components/ChromaKeyVideo.svelte.d.ts +21 -0
- package/dist/runtime/components/Image.svelte +1 -1
- package/dist/runtime/components/Image.svelte.d.ts +9 -0
- package/dist/runtime/components/Slice.svelte +1 -1
- package/dist/runtime/components/Slice.svelte.d.ts +19 -0
- package/dist/runtime/components/SliceCanvas.svelte +3 -3
- package/dist/runtime/components/SliceCanvas.svelte.d.ts +10 -0
- package/dist/runtime/components/SliceDom.svelte +3 -3
- package/dist/runtime/components/SliceDom.svelte.d.ts +10 -0
- package/dist/runtime/components/Video.svelte +2 -2
- package/dist/runtime/components/Video.svelte.d.ts +18 -0
- package/dist/runtime/geometry.d.ts +55 -35
- package/dist/runtime/geometry.js +186 -191
- package/dist/runtime/index.d.ts +9 -9
- package/dist/runtime/index.js +9 -9
- package/dist/runtime/kind-handlers.d.ts +33 -24
- package/dist/runtime/kind-handlers.js +74 -65
- package/dist/runtime/manifest.d.ts +53 -47
- package/dist/runtime/manifest.js +133 -113
- package/dist/runtime/observe-border-box-size.d.ts +1 -4
- package/dist/runtime/observe-border-box-size.js +9 -10
- package/dist/runtime/preload-registry.d.ts +22 -8
- package/dist/runtime/preload-registry.js +65 -62
- package/dist/server/build.d.ts +8 -0
- package/dist/server/build.js +25 -0
- package/dist/server/check.d.ts +24 -0
- package/dist/server/check.js +199 -0
- package/dist/server/cli-commands.d.ts +25 -0
- package/dist/server/cli-commands.js +1178 -0
- package/dist/server/cli-init.d.ts +3 -0
- package/dist/server/cli-init.js +53 -0
- package/dist/server/cli-io.d.ts +46 -0
- package/dist/server/cli-io.js +105 -0
- package/dist/server/codegen.d.ts +58 -0
- package/dist/server/codegen.js +185 -0
- package/dist/server/config-loader.d.ts +34 -0
- package/dist/server/config-loader.js +103 -0
- package/dist/server/context.d.ts +8 -0
- package/dist/server/context.js +19 -0
- package/dist/server/folder-filesystem.d.ts +7 -0
- package/dist/server/folder-filesystem.js +39 -0
- package/dist/server/http.d.ts +12 -0
- package/dist/server/http.js +100 -0
- package/dist/server/index.d.ts +16 -0
- package/dist/server/index.js +9 -0
- package/dist/server/job-hash.d.ts +10 -0
- package/dist/server/job-hash.js +23 -0
- package/dist/server/library-store.d.ts +82 -0
- package/dist/server/library-store.js +763 -0
- package/dist/server/operations.d.ts +87 -0
- package/dist/server/operations.js +427 -0
- package/dist/server/plugins/audio.d.ts +7 -0
- package/dist/server/plugins/audio.js +27 -0
- package/dist/server/plugins/chroma-key-video.d.ts +9 -0
- package/dist/server/plugins/chroma-key-video.js +38 -0
- package/dist/server/plugins/contract.d.ts +100 -0
- package/dist/server/plugins/contract.js +16 -0
- package/dist/server/plugins/image.d.ts +8 -0
- package/dist/server/plugins/image.js +30 -0
- package/dist/server/plugins/slice.d.ts +14 -0
- package/dist/server/plugins/slice.js +63 -0
- package/dist/server/plugins/video.d.ts +6 -0
- package/dist/server/plugins/video.js +29 -0
- package/dist/server/plugins.d.ts +23 -0
- package/dist/server/plugins.js +33 -0
- package/dist/server/processing/audio-processing.d.ts +17 -0
- package/dist/server/processing/audio-processing.js +46 -0
- package/dist/server/processing/ffmpeg.d.ts +9 -0
- package/dist/server/processing/ffmpeg.js +50 -0
- package/dist/server/processing/image-processing.d.ts +16 -0
- package/dist/server/processing/image-processing.js +26 -0
- package/dist/server/processing/media-probe.d.ts +15 -0
- package/dist/server/processing/media-probe.js +27 -0
- package/dist/server/processing/processor.d.ts +50 -0
- package/dist/server/processing/processor.js +158 -0
- package/dist/server/processing/video-processing.d.ts +35 -0
- package/dist/server/processing/video-processing.js +87 -0
- package/dist/server/server.d.ts +13 -0
- package/dist/server/server.js +57 -0
- package/dist/server/start.d.ts +1 -0
- package/dist/server/start.js +33 -0
- package/package.json +29 -16
- package/dist/build-CZYFLLvl.js +0 -191
- package/dist/core/image-Dqmz8FXS.js +0 -54
- package/dist/core/reference-graph-CjuHbLDw.d.ts +0 -280
- package/dist/core/testing.d.ts +0 -27
- package/dist/core/testing.js +0 -80
- package/dist/editor/200.html +0 -37
- package/dist/editor/_app/immutable/assets/2.DIbbW7U1.css +0 -1
- package/dist/editor/_app/immutable/assets/3.C-9vFQ9A.css +0 -1
- package/dist/editor/_app/immutable/assets/4.BS8ElpOV.css +0 -1
- package/dist/editor/_app/immutable/assets/ConfirmDialog.CHEISE-L.css +0 -1
- package/dist/editor/_app/immutable/assets/LibraryContextMenu.CDjCmdV-.css +0 -1
- package/dist/editor/_app/immutable/chunks/Cx6qtxJg.js +0 -1
- package/dist/editor/_app/immutable/chunks/n7mvYc42.js +0 -5
- package/dist/editor/_app/immutable/entry/start.C8HHOLly.js +0 -1
- package/dist/editor/_app/immutable/nodes/3.WO7tZH_d.js +0 -104
- package/dist/editor/_app/immutable/nodes/4.DQtx17aW.js +0 -2
- package/dist/editor/_app/version.json +0 -1
- package/dist/index.d.ts +0 -370
- package/dist/index.js +0 -4
- package/dist/start-Bhnqt9Dc.js +0 -279
- package/dist/start-D2IXOrni.js +0 -2
- /package/{dist/editor → build/client}/_app/immutable/assets/0.DLhIsYA_.css +0 -0
- /package/{dist/editor → build/client}/_app/immutable/chunks/Bjy-W4x2.js +0 -0
- /package/{dist/editor → build/client}/_app/immutable/chunks/CNRz3sSw.js +0 -0
- /package/{dist/editor → build/client}/_app/immutable/chunks/CO4RBJfa.js +0 -0
- /package/{dist/editor → build/client}/_app/immutable/chunks/DjdrdRzT.js +0 -0
- /package/{dist/editor → build/client}/_app/immutable/chunks/xihTtKlq.js +0 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ResolvedFundusConfig } from './config-loader.js';
|
|
2
|
+
export declare function errorResponse(cause: unknown, status: number): Response;
|
|
3
|
+
export declare function routeNotFound(event: {
|
|
4
|
+
request: Request;
|
|
5
|
+
url: URL;
|
|
6
|
+
}): Response;
|
|
7
|
+
export declare function apiResponse(run: () => Promise<unknown>): Promise<Response>;
|
|
8
|
+
export declare function parseByteRange(rangeHeader: string | null, size: number): {
|
|
9
|
+
start: number;
|
|
10
|
+
end: number;
|
|
11
|
+
} | null | 'unsatisfiable';
|
|
12
|
+
export declare function serveFundusFile(config: ResolvedFundusConfig, kind: 'raw' | 'proxy', fileName: string, request: Request): Promise<Response>;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import { readFile } from 'node:fs/promises';
|
|
3
|
+
import { extname, join } from 'node:path';
|
|
4
|
+
import { assertSafeRelativeFilePath } from './library-store.js';
|
|
5
|
+
const CONTENT_TYPES = {
|
|
6
|
+
'.png': 'image/png',
|
|
7
|
+
'.jpg': 'image/jpeg',
|
|
8
|
+
'.jpeg': 'image/jpeg',
|
|
9
|
+
'.webp': 'image/webp',
|
|
10
|
+
'.gif': 'image/gif',
|
|
11
|
+
'.avif': 'image/avif',
|
|
12
|
+
'.svg': 'image/svg+xml',
|
|
13
|
+
'.mp4': 'video/mp4',
|
|
14
|
+
'.m4v': 'video/mp4',
|
|
15
|
+
'.mov': 'video/quicktime',
|
|
16
|
+
'.webm': 'video/webm',
|
|
17
|
+
'.mp3': 'audio/mpeg',
|
|
18
|
+
'.wav': 'audio/wav',
|
|
19
|
+
'.m4a': 'audio/mp4',
|
|
20
|
+
'.ogg': 'audio/ogg',
|
|
21
|
+
'.flac': 'audio/flac'
|
|
22
|
+
};
|
|
23
|
+
export function errorResponse(cause, status) {
|
|
24
|
+
const body = {
|
|
25
|
+
error: { message: cause instanceof Error ? cause.message : String(cause) }
|
|
26
|
+
};
|
|
27
|
+
return Response.json(body, { status });
|
|
28
|
+
}
|
|
29
|
+
export function routeNotFound(event) {
|
|
30
|
+
return errorResponse(new Error(`No route for ${event.request.method.toUpperCase()} ${event.url.pathname}.`), 404);
|
|
31
|
+
}
|
|
32
|
+
export async function apiResponse(run) {
|
|
33
|
+
try {
|
|
34
|
+
return Response.json(await run());
|
|
35
|
+
}
|
|
36
|
+
catch (cause) {
|
|
37
|
+
return errorResponse(cause, 400);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export function parseByteRange(rangeHeader, size) {
|
|
41
|
+
if (!rangeHeader)
|
|
42
|
+
return null;
|
|
43
|
+
const match = /^bytes=(\d*)-(\d*)$/.exec(rangeHeader.trim());
|
|
44
|
+
if (!match || (match[1] === '' && match[2] === ''))
|
|
45
|
+
return null;
|
|
46
|
+
if (size === 0)
|
|
47
|
+
return 'unsatisfiable';
|
|
48
|
+
let start;
|
|
49
|
+
let end;
|
|
50
|
+
if (match[1] === '') {
|
|
51
|
+
start = Math.max(0, size - Number(match[2]));
|
|
52
|
+
end = size - 1;
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
start = Number(match[1]);
|
|
56
|
+
end = match[2] === '' ? size - 1 : Math.min(Number(match[2]), size - 1);
|
|
57
|
+
}
|
|
58
|
+
if (start > end || start >= size)
|
|
59
|
+
return 'unsatisfiable';
|
|
60
|
+
return { start, end };
|
|
61
|
+
}
|
|
62
|
+
export async function serveFundusFile(config, kind, fileName, request) {
|
|
63
|
+
try {
|
|
64
|
+
assertSafeRelativeFilePath(fileName);
|
|
65
|
+
}
|
|
66
|
+
catch (cause) {
|
|
67
|
+
return errorResponse(cause, 400);
|
|
68
|
+
}
|
|
69
|
+
const directory = kind === 'raw' ? config.rawDir : config.proxyDir;
|
|
70
|
+
const filePath = join(directory, fileName);
|
|
71
|
+
if (!existsSync(filePath)) {
|
|
72
|
+
return errorResponse(new Error(`File "${fileName}" not found.`), 404);
|
|
73
|
+
}
|
|
74
|
+
const bytes = new Uint8Array(await readFile(filePath));
|
|
75
|
+
const size = bytes.byteLength;
|
|
76
|
+
const headers = {
|
|
77
|
+
'Content-Type': CONTENT_TYPES[extname(fileName).toLowerCase()] ?? 'application/octet-stream',
|
|
78
|
+
'Cache-Control': 'no-store',
|
|
79
|
+
'Accept-Ranges': 'bytes'
|
|
80
|
+
};
|
|
81
|
+
const range = parseByteRange(request.headers.get('Range'), size);
|
|
82
|
+
if (range === 'unsatisfiable') {
|
|
83
|
+
return new Response(null, {
|
|
84
|
+
status: 416,
|
|
85
|
+
headers: { ...headers, 'Content-Range': `bytes */${size}` }
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
if (range) {
|
|
89
|
+
const slice = bytes.subarray(range.start, range.end + 1);
|
|
90
|
+
return new Response(slice, {
|
|
91
|
+
status: 206,
|
|
92
|
+
headers: {
|
|
93
|
+
...headers,
|
|
94
|
+
'Content-Range': `bytes ${range.start}-${range.end}/${size}`,
|
|
95
|
+
'Content-Length': String(slice.byteLength)
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
return new Response(bytes, { headers: { ...headers, 'Content-Length': String(size) } });
|
|
100
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type { ResolvedFundusConfig, ResolvedPresetPluginConfig, ResolvedVideoPluginConfig, ResolvedAudioPluginConfig } from './config-loader.js';
|
|
2
|
+
export { loadConfig, resolveConfig } from './config-loader.js';
|
|
3
|
+
export { LibraryStore } from './library-store.js';
|
|
4
|
+
export type { IngestOptions } from './library-store.js';
|
|
5
|
+
export type { AssetProxyInfo, ProxyOutputInfo, ProcessingReport } from './processing/processor.js';
|
|
6
|
+
export { processAssets, expectedProxyFileName, expectedProxyRelativePath, deliveredAssetIds, isProxyFileName, readProxyOutputInfo } from './processing/processor.js';
|
|
7
|
+
export { ffmpegBinaryPath, runToolchainBinary } from './processing/ffmpeg.js';
|
|
8
|
+
export type { CodegenReport } from './codegen.js';
|
|
9
|
+
export { generateManifestModules } from './codegen.js';
|
|
10
|
+
export type { BuildReport } from './build.js';
|
|
11
|
+
export { runBuild } from './build.js';
|
|
12
|
+
export type { CheckFinding, CheckReport } from './check.js';
|
|
13
|
+
export { formatCheckFinding, runCheck } from './check.js';
|
|
14
|
+
export type { AssetChangeOptions } from './operations.js';
|
|
15
|
+
export { FundusOperations } from './operations.js';
|
|
16
|
+
export { runStart } from './start.js';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { loadConfig, resolveConfig } from './config-loader.js';
|
|
2
|
+
export { LibraryStore } from './library-store.js';
|
|
3
|
+
export { processAssets, expectedProxyFileName, expectedProxyRelativePath, deliveredAssetIds, isProxyFileName, readProxyOutputInfo } from './processing/processor.js';
|
|
4
|
+
export { ffmpegBinaryPath, runToolchainBinary } from './processing/ffmpeg.js';
|
|
5
|
+
export { generateManifestModules } from './codegen.js';
|
|
6
|
+
export { runBuild } from './build.js';
|
|
7
|
+
export { formatCheckFinding, runCheck } from './check.js';
|
|
8
|
+
export { FundusOperations } from './operations.js';
|
|
9
|
+
export { runStart } from './start.js';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bump when processing behavior or a sharp/ffmpeg toolchain upgrade changes
|
|
3
|
+
* output bytes; toolchain versions are deliberately not part of each hash.
|
|
4
|
+
*/
|
|
5
|
+
export declare const PIPELINE_VERSION = 1;
|
|
6
|
+
/**
|
|
7
|
+
* First 8 hex chars of sha256 over rawHash + canonical parameters + pipeline
|
|
8
|
+
* version — the `<jobHash>` segment of a proxy file name.
|
|
9
|
+
*/
|
|
10
|
+
export declare function jobHash(rawHash: string, parameters: unknown, pipelineVersion?: number): string;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deterministic processing identity: a proxy's name derives from
|
|
3
|
+
* everything that influences its bytes — raw content, canonicalized
|
|
4
|
+
* parameters (including resolved preset settings), and the pipeline version —
|
|
5
|
+
* so staleness is a pure name check.
|
|
6
|
+
*/
|
|
7
|
+
import { createHash } from 'node:crypto';
|
|
8
|
+
import { canonicalizeParameters } from '../core/index.js';
|
|
9
|
+
/**
|
|
10
|
+
* Bump when processing behavior or a sharp/ffmpeg toolchain upgrade changes
|
|
11
|
+
* output bytes; toolchain versions are deliberately not part of each hash.
|
|
12
|
+
*/
|
|
13
|
+
export const PIPELINE_VERSION = 1;
|
|
14
|
+
/**
|
|
15
|
+
* First 8 hex chars of sha256 over rawHash + canonical parameters + pipeline
|
|
16
|
+
* version — the `<jobHash>` segment of a proxy file name.
|
|
17
|
+
*/
|
|
18
|
+
export function jobHash(rawHash, parameters, pipelineVersion = PIPELINE_VERSION) {
|
|
19
|
+
return createHash('sha256')
|
|
20
|
+
.update(rawHash + canonicalizeParameters(parameters) + String(pipelineVersion))
|
|
21
|
+
.digest('hex')
|
|
22
|
+
.slice(0, 8);
|
|
23
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { type Library, type ValidationIssueDto } from '../core/index.js';
|
|
2
|
+
import type { ResolvedFundusConfig } from './config-loader.js';
|
|
3
|
+
import type { ServerPluginRegistry } from './plugins/contract.js';
|
|
4
|
+
export declare function assertSafeFileName(fileName: string): void;
|
|
5
|
+
/** Validate a persisted/served file path without allowing traversal outside its root. */
|
|
6
|
+
export declare function assertSafeRelativeFilePath(filePath: string): void;
|
|
7
|
+
/**
|
|
8
|
+
* Turn an arbitrary uploaded file name (spaces, umlauts, parentheses, nested
|
|
9
|
+
* paths) into a safe single segment: strip the directory, transliterate to
|
|
10
|
+
* ASCII-ish, replace runs of disallowed characters with `-`, and lower-case
|
|
11
|
+
* the extension. Never throws for a normal image name.
|
|
12
|
+
*/
|
|
13
|
+
export declare function sanitizeFileName(original: string): string;
|
|
14
|
+
export declare function sha256Hex(bytes: Uint8Array): string;
|
|
15
|
+
export interface IngestOptions {
|
|
16
|
+
/** Original file name of the upload (sanitized before storing). */
|
|
17
|
+
fileName: string;
|
|
18
|
+
bytes: Uint8Array;
|
|
19
|
+
/** Asset type (must be a known plugin type). */
|
|
20
|
+
type: string;
|
|
21
|
+
/** The chosen asset id (validated; must be unique). */
|
|
22
|
+
id: string;
|
|
23
|
+
/** Registered destination folder; empty string means the implicit root. */
|
|
24
|
+
folder?: string;
|
|
25
|
+
}
|
|
26
|
+
export declare class LibraryStore {
|
|
27
|
+
#private;
|
|
28
|
+
constructor(config: ResolvedFundusConfig, registry?: ServerPluginRegistry);
|
|
29
|
+
get config(): ResolvedFundusConfig;
|
|
30
|
+
/** Read + parse the library file; a missing file is an empty library. */
|
|
31
|
+
read(): Promise<Library>;
|
|
32
|
+
/** Deterministically serialize + write the library file. */
|
|
33
|
+
write(library: Library): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Ingest a new asset: write the raw file into `rawDir` (under a sanitized,
|
|
36
|
+
* non-colliding name), hash its content, and create the library record with
|
|
37
|
+
* the owning plugin's default parameters. Returns the updated library.
|
|
38
|
+
*/
|
|
39
|
+
ingest(options: IngestOptions): Promise<Library>;
|
|
40
|
+
/** Replace an asset's parameters (validated by the owning plugin). */
|
|
41
|
+
updateParameters(id: string, parameters: unknown): Promise<Library>;
|
|
42
|
+
/** Replace an asset's manifest membership (every name must exist). */
|
|
43
|
+
setManifests(id: string, manifests: string[]): Promise<Library>;
|
|
44
|
+
/** Rename an asset id (the raw file keeps its name — ids are the stable key). */
|
|
45
|
+
renameAsset(id: string, newId: string): Promise<Library>;
|
|
46
|
+
/** Move an asset's raw file and current proxies without changing its stable id. */
|
|
47
|
+
moveAsset(id: string, folder: string): Promise<Library>;
|
|
48
|
+
createFolder(path: string): Promise<Library>;
|
|
49
|
+
renameFolder(path: string, newName: string): Promise<Library>;
|
|
50
|
+
/** Move a complete folder subtree below another folder (or the implicit root). */
|
|
51
|
+
moveFolder(path: string, parent: string): Promise<Library>;
|
|
52
|
+
/** Recursively delete a folder and every asset stored below it. */
|
|
53
|
+
deleteFolder(path: string): Promise<{
|
|
54
|
+
library: Library;
|
|
55
|
+
deletedAssetIds: string[];
|
|
56
|
+
}>;
|
|
57
|
+
/** Delete an asset: remove the record, its raw file, and its proxies. */
|
|
58
|
+
deleteAsset(id: string): Promise<Library>;
|
|
59
|
+
/** Delete several assets as one library/file transaction. */
|
|
60
|
+
deleteAssets(ids: string[]): Promise<Library>;
|
|
61
|
+
createManifest(name: string): Promise<Library>;
|
|
62
|
+
/**
|
|
63
|
+
* Set (or clear) a manifest's editor appearance — its color and/or emoji.
|
|
64
|
+
* An `undefined` field is left unchanged; a `null` field clears it. Values
|
|
65
|
+
* are validated against the fixed palettes.
|
|
66
|
+
*/
|
|
67
|
+
setManifestAppearance(name: string, appearance: {
|
|
68
|
+
color?: string | null;
|
|
69
|
+
emoji?: string | null;
|
|
70
|
+
}): Promise<Library>;
|
|
71
|
+
/** Rename a manifest and rewrite every asset's membership to the new name. */
|
|
72
|
+
renameManifest(name: string, newName: string): Promise<Library>;
|
|
73
|
+
/** Delete a manifest and strip it from every asset's membership. */
|
|
74
|
+
deleteManifest(name: string): Promise<Library>;
|
|
75
|
+
/**
|
|
76
|
+
* Structural + referential validation, listed per asset: invalid id, unknown
|
|
77
|
+
* type, dangling raw pointer, invalid parameters, unknown manifest names,
|
|
78
|
+
* and reference errors (dangling target, type mismatch, cycles).
|
|
79
|
+
*/
|
|
80
|
+
validate(library: Library): Promise<ValidationIssueDto[]>;
|
|
81
|
+
syncFolders(library: Library): Promise<void>;
|
|
82
|
+
}
|