@faicad/faijs 0.22.2 → 0.29.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/LICENSE +202 -28
- package/dist/api/api-namespace.d.ts +5 -5
- package/dist/api/api-namespace.d.ts.map +1 -1
- package/dist/api/api-namespace.js +4 -4
- package/dist/api/api-namespace.js.map +1 -1
- package/dist/api/assert.d.ts +2 -2
- package/dist/api/assert.js +8 -8
- package/dist/api/assert.js.map +1 -1
- package/dist/api/asset.d.ts +1 -1
- package/dist/api/asset.js +2 -2
- package/dist/api/asset.js.map +1 -1
- package/dist/api/boolean.d.ts +1 -1
- package/dist/api/boolean.d.ts.map +1 -1
- package/dist/api/boolean.js +128 -16
- package/dist/api/boolean.js.map +1 -1
- package/dist/api/cadquery-selectors/borrow-bridge.d.ts +14 -0
- package/dist/api/cadquery-selectors/borrow-bridge.d.ts.map +1 -0
- package/dist/api/cadquery-selectors/borrow-bridge.js +52 -0
- package/dist/api/cadquery-selectors/borrow-bridge.js.map +1 -0
- package/dist/api/cadquery-selectors/edge.d.ts +40 -0
- package/dist/api/cadquery-selectors/edge.d.ts.map +1 -0
- package/dist/api/cadquery-selectors/edge.js +70 -0
- package/dist/api/cadquery-selectors/edge.js.map +1 -0
- package/dist/api/cadquery-selectors/entity.d.ts +121 -0
- package/dist/api/cadquery-selectors/entity.d.ts.map +1 -0
- package/dist/api/cadquery-selectors/entity.js +167 -0
- package/dist/api/cadquery-selectors/entity.js.map +1 -0
- package/dist/api/cadquery-selectors/face.d.ts +33 -0
- package/dist/api/cadquery-selectors/face.d.ts.map +1 -0
- package/dist/api/cadquery-selectors/face.js +353 -0
- package/dist/api/cadquery-selectors/face.js.map +1 -0
- package/dist/api/cadquery-selectors/grammar.d.ts +50 -0
- package/dist/api/cadquery-selectors/grammar.d.ts.map +1 -0
- package/dist/api/cadquery-selectors/grammar.js +345 -0
- package/dist/api/cadquery-selectors/grammar.js.map +1 -0
- package/dist/api/cadquery-selectors/index.d.ts +18 -0
- package/dist/api/cadquery-selectors/index.d.ts.map +1 -0
- package/dist/api/cadquery-selectors/index.js +17 -0
- package/dist/api/cadquery-selectors/index.js.map +1 -0
- package/dist/api/cadquery-selectors/predicates.d.ts +76 -0
- package/dist/api/cadquery-selectors/predicates.d.ts.map +1 -0
- package/dist/api/cadquery-selectors/predicates.js +85 -0
- package/dist/api/cadquery-selectors/predicates.js.map +1 -0
- package/dist/api/cadquery-selectors/resolve.d.ts +41 -0
- package/dist/api/cadquery-selectors/resolve.d.ts.map +1 -0
- package/dist/api/cadquery-selectors/resolve.js +243 -0
- package/dist/api/cadquery-selectors/resolve.js.map +1 -0
- package/dist/api/cadquery-selectors/types.d.ts +96 -0
- package/dist/api/cadquery-selectors/types.d.ts.map +1 -0
- package/dist/api/cadquery-selectors/types.js +11 -0
- package/dist/api/cadquery-selectors/types.js.map +1 -0
- package/dist/api/chamfer.d.ts +13 -5
- package/dist/api/chamfer.d.ts.map +1 -1
- package/dist/api/chamfer.js +63 -7
- package/dist/api/chamfer.js.map +1 -1
- package/dist/api/compound-geom.d.ts +1 -1
- package/dist/api/compound-geom.js +1 -1
- package/dist/api/compound-geom.js.map +1 -1
- package/dist/api/draft.d.ts +1 -1
- package/dist/api/draft.js +1 -1
- package/dist/api/draft.js.map +1 -1
- package/dist/api/edge-ref.d.ts +1 -1
- package/dist/api/edge-ref.d.ts.map +1 -1
- package/dist/api/edge-ref.js +11 -3
- package/dist/api/edge-ref.js.map +1 -1
- package/dist/api/engrave.d.ts +1 -1
- package/dist/api/engrave.js +7 -7
- package/dist/api/engrave.js.map +1 -1
- package/dist/api/extrude.d.ts +6 -1
- package/dist/api/extrude.d.ts.map +1 -1
- package/dist/api/extrude.js +59 -5
- package/dist/api/extrude.js.map +1 -1
- package/dist/api/face-ref.d.ts +1 -1
- package/dist/api/face-ref.js +1 -1
- package/dist/api/face-ref.js.map +1 -1
- package/dist/api/feature-repair.d.ts +1 -1
- package/dist/api/feature-repair.js +1 -1
- package/dist/api/feature-repair.js.map +1 -1
- package/dist/api/fillet-variable.d.ts +1 -1
- package/dist/api/fillet-variable.js +1 -1
- package/dist/api/fillet-variable.js.map +1 -1
- package/dist/api/fillet.d.ts +28 -8
- package/dist/api/fillet.d.ts.map +1 -1
- package/dist/api/fillet.js +64 -9
- package/dist/api/fillet.js.map +1 -1
- package/dist/api/geom.d.ts +1 -1
- package/dist/api/geom.js +1 -1
- package/dist/api/geom.js.map +1 -1
- package/dist/api/helix.d.ts +1 -1
- package/dist/api/helix.js +1 -1
- package/dist/api/helix.js.map +1 -1
- package/dist/api/import-brep.d.ts +20 -2
- package/dist/api/import-brep.d.ts.map +1 -1
- package/dist/api/import-brep.js +28 -3
- package/dist/api/import-brep.js.map +1 -1
- package/dist/api/import-step.d.ts +17 -2
- package/dist/api/import-step.d.ts.map +1 -1
- package/dist/api/import-step.js +23 -3
- package/dist/api/import-step.js.map +1 -1
- package/dist/api/index.d.ts +2 -1
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +5 -2
- package/dist/api/index.js.map +1 -1
- package/dist/api/internal/compat-op.js +1 -1
- package/dist/api/internal/compat-op.js.map +1 -1
- package/dist/api/internal/mesh-solid-op.d.ts +236 -0
- package/dist/api/internal/mesh-solid-op.d.ts.map +1 -0
- package/dist/api/internal/mesh-solid-op.js +352 -0
- package/dist/api/internal/mesh-solid-op.js.map +1 -0
- package/dist/api/internal/svg-asset-resolver.d.ts +1 -1
- package/dist/api/internal/svg-asset-resolver.js +1 -1
- package/dist/api/internal/svg-asset-resolver.js.map +1 -1
- package/dist/api/knurl.d.ts +1 -1
- package/dist/api/knurl.js +2 -2
- package/dist/api/knurl.js.map +1 -1
- package/dist/api/loft.d.ts +1 -1
- package/dist/api/loft.js +1 -1
- package/dist/api/loft.js.map +1 -1
- package/dist/api/measurement/index.d.ts +9 -5
- package/dist/api/measurement/index.d.ts.map +1 -1
- package/dist/api/measurement/index.js +47 -20
- package/dist/api/measurement/index.js.map +1 -1
- package/dist/api/pattern.d.ts +5 -3
- package/dist/api/pattern.d.ts.map +1 -1
- package/dist/api/pattern.js +32 -4
- package/dist/api/pattern.js.map +1 -1
- package/dist/api/place.d.ts +1 -1
- package/dist/api/place.js +1 -1
- package/dist/api/place.js.map +1 -1
- package/dist/api/primitives.d.ts +1 -1
- package/dist/api/primitives.js +2 -2
- package/dist/api/primitives.js.map +1 -1
- package/dist/api/profile.d.ts +39 -12
- package/dist/api/profile.d.ts.map +1 -1
- package/dist/api/profile.js +4 -4
- package/dist/api/profile.js.map +1 -1
- package/dist/api/reconcile.d.ts +1 -1
- package/dist/api/reconcile.js +1 -1
- package/dist/api/reconcile.js.map +1 -1
- package/dist/api/replicate.d.ts.map +1 -1
- package/dist/api/replicate.js +122 -1
- package/dist/api/replicate.js.map +1 -1
- package/dist/api/screw.d.ts +1 -1
- package/dist/api/screw.js +3 -3
- package/dist/api/screw.js.map +1 -1
- package/dist/api/sdf.d.ts +1 -1
- package/dist/api/sdf.js +2 -2
- package/dist/api/sdf.js.map +1 -1
- package/dist/api/section-by-plane.d.ts +1 -1
- package/dist/api/section-by-plane.d.ts.map +1 -1
- package/dist/api/section-by-plane.js +2 -1
- package/dist/api/section-by-plane.js.map +1 -1
- package/dist/api/shell.d.ts +11 -4
- package/dist/api/shell.d.ts.map +1 -1
- package/dist/api/shell.js +53 -7
- package/dist/api/shell.js.map +1 -1
- package/dist/api/sketch-on-face.d.ts +41 -0
- package/dist/api/sketch-on-face.d.ts.map +1 -1
- package/dist/api/sketch-on-face.js +100 -1
- package/dist/api/sketch-on-face.js.map +1 -1
- package/dist/api/sketch-on-plane.d.ts +7 -5
- package/dist/api/sketch-on-plane.d.ts.map +1 -1
- package/dist/api/sketch-on-plane.js +6 -7
- package/dist/api/sketch-on-plane.js.map +1 -1
- package/dist/api/split-by-plane.d.ts +1 -1
- package/dist/api/split-by-plane.d.ts.map +1 -1
- package/dist/api/split-by-plane.js +2 -1
- package/dist/api/split-by-plane.js.map +1 -1
- package/dist/api/split.d.ts +1 -1
- package/dist/api/split.js +2 -2
- package/dist/api/split.js.map +1 -1
- package/dist/api/sweep.d.ts +1 -1
- package/dist/api/sweep.js +1 -1
- package/dist/api/sweep.js.map +1 -1
- package/dist/api/thicken.d.ts +1 -1
- package/dist/api/thicken.js +1 -1
- package/dist/api/thicken.js.map +1 -1
- package/dist/api/topo-resolve.d.ts +74 -1
- package/dist/api/topo-resolve.d.ts.map +1 -1
- package/dist/api/topo-resolve.js +180 -2
- package/dist/api/topo-resolve.js.map +1 -1
- package/dist/api/transform.d.ts +5 -1
- package/dist/api/transform.d.ts.map +1 -1
- package/dist/api/transform.js +62 -11
- package/dist/api/transform.js.map +1 -1
- package/dist/api/wire.d.ts +1 -1
- package/dist/api/wire.js +1 -1
- package/dist/api/wire.js.map +1 -1
- package/dist/brep/brep-ops.d.ts +9 -7
- package/dist/brep/brep-ops.d.ts.map +1 -1
- package/dist/brep/brep-ops.js +23 -24
- package/dist/brep/brep-ops.js.map +1 -1
- package/dist/brep/brep-topology.d.ts +5 -4
- package/dist/brep/brep-topology.d.ts.map +1 -1
- package/dist/brep/brep-topology.js +6 -5
- package/dist/brep/brep-topology.js.map +1 -1
- package/dist/brep/effective-deflection.d.ts +35 -0
- package/dist/brep/effective-deflection.d.ts.map +1 -0
- package/dist/brep/effective-deflection.js +49 -0
- package/dist/brep/effective-deflection.js.map +1 -0
- package/dist/brep/engine/adapters/brep-mock.d.ts.map +1 -1
- package/dist/brep/engine/adapters/brep-mock.js +27 -0
- package/dist/brep/engine/adapters/brep-mock.js.map +1 -1
- package/dist/brep/engine/adapters/brepkit.d.ts +18 -0
- package/dist/brep/engine/adapters/brepkit.d.ts.map +1 -1
- package/dist/brep/engine/adapters/brepkit.js +46 -1
- package/dist/brep/engine/adapters/brepkit.js.map +1 -1
- package/dist/brep/engine/adapters/occt.d.ts +1 -1
- package/dist/brep/engine/adapters/occt.d.ts.map +1 -1
- package/dist/brep/engine/adapters/occt.js +3 -1
- package/dist/brep/engine/adapters/occt.js.map +1 -1
- package/dist/brep/engine/primitives.d.ts +29 -7
- package/dist/brep/engine/primitives.d.ts.map +1 -1
- package/dist/brep/engine/primitives.js.map +1 -1
- package/dist/brep/engine/registry.d.ts +24 -1
- package/dist/brep/engine/registry.d.ts.map +1 -1
- package/dist/brep/engine/registry.js +24 -0
- package/dist/brep/engine/registry.js.map +1 -1
- package/dist/brep/engine/types.d.ts +54 -3
- package/dist/brep/engine/types.d.ts.map +1 -1
- package/dist/brep/engine/types.js +10 -0
- package/dist/brep/engine/types.js.map +1 -1
- package/dist/brep/export/export-model.d.ts.map +1 -1
- package/dist/brep/export/export-model.js +6 -5
- package/dist/brep/export/export-model.js.map +1 -1
- package/dist/brep/face-evolution.d.ts +1 -1
- package/dist/brep/face-evolution.d.ts.map +1 -1
- package/dist/brep/face-evolution.js +20 -1
- package/dist/brep/face-evolution.js.map +1 -1
- package/dist/brep/handle-bridge.d.ts +1 -1
- package/dist/brep/handle-bridge.js +1 -1
- package/dist/brep/handle-bridge.js.map +1 -1
- package/dist/brep/mesh-solid.d.ts +218 -0
- package/dist/brep/mesh-solid.d.ts.map +1 -0
- package/dist/brep/mesh-solid.js +229 -0
- package/dist/brep/mesh-solid.js.map +1 -0
- package/dist/brep/text/fontRegistry.d.ts +32 -1
- package/dist/brep/text/fontRegistry.d.ts.map +1 -1
- package/dist/brep/text/fontRegistry.js +51 -1
- package/dist/brep/text/fontRegistry.js.map +1 -1
- package/dist/brep/text/text-to-solid.d.ts.map +1 -1
- package/dist/brep/text/text-to-solid.js +8 -3
- package/dist/brep/text/text-to-solid.js.map +1 -1
- package/dist/brepkit-kernel/brepkitKernel.d.ts +18 -2
- package/dist/brepkit-kernel/brepkitKernel.d.ts.map +1 -1
- package/dist/brepkit-kernel/brepkitKernel.js +449 -123
- package/dist/brepkit-kernel/brepkitKernel.js.map +1 -1
- package/dist/brepkit-kernel/brepkitWasm.d.ts +8 -0
- package/dist/brepkit-kernel/brepkitWasm.d.ts.map +1 -1
- package/dist/brepkit-kernel/brepkitWasm.js +10 -0
- package/dist/brepkit-kernel/brepkitWasm.js.map +1 -1
- package/dist/browser-host/browser-font-provider.d.ts +12 -0
- package/dist/browser-host/browser-font-provider.d.ts.map +1 -1
- package/dist/browser-host/browser-font-provider.js +25 -0
- package/dist/browser-host/browser-font-provider.js.map +1 -1
- package/dist/browser.d.ts +6 -3
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +10 -3
- package/dist/browser.js.map +1 -1
- package/dist/cad-runtime/backend-dispatch.d.ts +28 -3
- package/dist/cad-runtime/backend-dispatch.d.ts.map +1 -1
- package/dist/cad-runtime/backend-dispatch.js +119 -4
- package/dist/cad-runtime/backend-dispatch.js.map +1 -1
- package/dist/cad-runtime/browser-lib-loader.js.map +1 -1
- package/dist/cad-runtime/direct-executor.d.ts +15 -3
- package/dist/cad-runtime/direct-executor.d.ts.map +1 -1
- package/dist/cad-runtime/direct-executor.js +33 -1
- package/dist/cad-runtime/direct-executor.js.map +1 -1
- package/dist/cad-runtime/ports.d.ts +3 -3
- package/dist/cad-runtime/ports.d.ts.map +1 -1
- package/dist/cad-runtime/ports.js.map +1 -1
- package/dist/cad-runtime/preview-exec.d.ts +4 -4
- package/dist/cad-runtime/preview-exec.js +2 -2
- package/dist/cad-runtime/preview-exec.js.map +1 -1
- package/dist/cad-runtime/runtime.d.ts +42 -7
- package/dist/cad-runtime/runtime.d.ts.map +1 -1
- package/dist/cad-runtime/runtime.js +68 -5
- package/dist/cad-runtime/runtime.js.map +1 -1
- package/dist/define-op.d.ts +15 -1
- package/dist/define-op.d.ts.map +1 -1
- package/dist/define-op.js +10 -1
- package/dist/define-op.js.map +1 -1
- package/dist/env-agnostic.d.ts +2 -2
- package/dist/env-agnostic.d.ts.map +1 -1
- package/dist/env-agnostic.js +1 -1
- package/dist/env-agnostic.js.map +1 -1
- package/dist/geometry2d/adapt.d.ts +39 -4
- package/dist/geometry2d/adapt.d.ts.map +1 -1
- package/dist/geometry2d/adapt.js +14 -3
- package/dist/geometry2d/adapt.js.map +1 -1
- package/dist/geometry2d/blueprint.d.ts +2 -2
- package/dist/geometry2d/blueprint.js +2 -2
- package/dist/geometry2d/blueprint.js.map +1 -1
- package/dist/geometry2d/bridge/lift-on-plane.d.ts +18 -8
- package/dist/geometry2d/bridge/lift-on-plane.d.ts.map +1 -1
- package/dist/geometry2d/bridge/lift-on-plane.js +65 -12
- package/dist/geometry2d/bridge/lift-on-plane.js.map +1 -1
- package/dist/geometry2d/bridge/plane.d.ts +17 -0
- package/dist/geometry2d/bridge/plane.d.ts.map +1 -1
- package/dist/geometry2d/bridge/plane.js +22 -0
- package/dist/geometry2d/bridge/plane.js.map +1 -1
- package/dist/geometry2d/curve2d.d.ts +25 -0
- package/dist/geometry2d/curve2d.d.ts.map +1 -1
- package/dist/geometry2d/curve2d.js +41 -5
- package/dist/geometry2d/curve2d.js.map +1 -1
- package/dist/index.d.ts +6 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -3
- package/dist/index.js.map +1 -1
- package/dist/io/bytes-node.d.ts +11 -0
- package/dist/io/bytes-node.d.ts.map +1 -0
- package/dist/io/bytes-node.js +28 -0
- package/dist/io/bytes-node.js.map +1 -0
- package/dist/io/bytes.d.ts +33 -0
- package/dist/io/bytes.d.ts.map +1 -0
- package/dist/io/bytes.js +41 -0
- package/dist/io/bytes.js.map +1 -0
- package/dist/io/fai-zip/container-read.d.ts +102 -0
- package/dist/io/fai-zip/container-read.d.ts.map +1 -0
- package/dist/io/fai-zip/container-read.js +305 -0
- package/dist/io/fai-zip/container-read.js.map +1 -0
- package/dist/io/fai-zip/container-write.d.ts +70 -0
- package/dist/io/fai-zip/container-write.d.ts.map +1 -0
- package/dist/io/fai-zip/container-write.js +186 -0
- package/dist/io/fai-zip/container-write.js.map +1 -0
- package/dist/io/fai-zip/container.d.ts +107 -0
- package/dist/io/fai-zip/container.d.ts.map +1 -0
- package/dist/io/fai-zip/container.js +89 -0
- package/dist/io/fai-zip/container.js.map +1 -0
- package/dist/io/fai-zip/index.d.ts +18 -0
- package/dist/io/fai-zip/index.d.ts.map +1 -0
- package/dist/io/fai-zip/index.js +4 -0
- package/dist/io/fai-zip/index.js.map +1 -0
- package/dist/io/index.d.ts +10 -0
- package/dist/io/index.d.ts.map +1 -0
- package/dist/io/index.js +13 -0
- package/dist/io/index.js.map +1 -0
- package/dist/io/zip.d.ts +68 -0
- package/dist/io/zip.d.ts.map +1 -0
- package/dist/io/zip.js +147 -0
- package/dist/io/zip.js.map +1 -0
- package/dist/lang/code-to-args.d.ts +1 -1
- package/dist/lang/code-to-args.js +1 -1
- package/dist/lang/code-to-args.js.map +1 -1
- package/dist/lang/statement-summary.d.ts +1 -1
- package/dist/lang/statement-summary.js +1 -1
- package/dist/lang/statement-summary.js.map +1 -1
- package/dist/lang/types.d.ts +1 -1
- package/dist/lang/types.js +1 -1
- package/dist/lang/types.js.map +1 -1
- package/dist/mesh/index.d.ts +2 -1
- package/dist/mesh/index.d.ts.map +1 -1
- package/dist/mesh/index.js +2 -1
- package/dist/mesh/index.js.map +1 -1
- package/dist/mesh/io.d.ts +7 -0
- package/dist/mesh/io.d.ts.map +1 -1
- package/dist/mesh/io.js +14 -17
- package/dist/mesh/io.js.map +1 -1
- package/dist/mesh/reconcile.d.ts +1 -1
- package/dist/mesh/reconcile.js +1 -1
- package/dist/mesh/reconcile.js.map +1 -1
- package/dist/mesh/rigid-transform.d.ts +3 -3
- package/dist/mesh/rigid-transform.js +3 -3
- package/dist/mesh/rigid-transform.js.map +1 -1
- package/dist/mesh/stl-unit.d.ts +24 -0
- package/dist/mesh/stl-unit.d.ts.map +1 -0
- package/dist/mesh/stl-unit.js +17 -0
- package/dist/mesh/stl-unit.js.map +1 -0
- package/dist/mesh/threemf-bambu.d.ts +142 -0
- package/dist/mesh/threemf-bambu.d.ts.map +1 -0
- package/dist/mesh/threemf-bambu.js +334 -0
- package/dist/mesh/threemf-bambu.js.map +1 -0
- package/dist/mesh/threemf-loader.d.ts +42 -7
- package/dist/mesh/threemf-loader.d.ts.map +1 -1
- package/dist/mesh/threemf-loader.js +565 -100
- package/dist/mesh/threemf-loader.js.map +1 -1
- package/dist/mesh/threemf-view.d.ts +71 -0
- package/dist/mesh/threemf-view.d.ts.map +1 -0
- package/dist/mesh/threemf-view.js +100 -0
- package/dist/mesh/threemf-view.js.map +1 -0
- package/dist/node-host/cli.d.ts +44 -6
- package/dist/node-host/cli.d.ts.map +1 -1
- package/dist/node-host/cli.js +76 -26
- package/dist/node-host/cli.js.map +1 -1
- package/dist/node-host/font-family-index.d.ts +93 -0
- package/dist/node-host/font-family-index.d.ts.map +1 -0
- package/dist/node-host/font-family-index.js +273 -0
- package/dist/node-host/font-family-index.js.map +1 -0
- package/dist/node-host/fs-asset-resolver.d.ts +8 -3
- package/dist/node-host/fs-asset-resolver.d.ts.map +1 -1
- package/dist/node-host/fs-asset-resolver.js +13 -5
- package/dist/node-host/fs-asset-resolver.js.map +1 -1
- package/dist/node-host/index.d.ts +8 -0
- package/dist/node-host/index.d.ts.map +1 -1
- package/dist/node-host/index.js +1 -0
- package/dist/node-host/index.js.map +1 -1
- package/dist/node-host/node-font-provider.d.ts +28 -0
- package/dist/node-host/node-font-provider.d.ts.map +1 -1
- package/dist/node-host/node-font-provider.js +49 -0
- package/dist/node-host/node-font-provider.js.map +1 -1
- package/dist/node.d.ts +1 -0
- package/dist/node.d.ts.map +1 -1
- package/dist/node.js +1 -0
- package/dist/node.js.map +1 -1
- package/dist/occt-kernel/occt-primitives.d.ts.map +1 -1
- package/dist/occt-kernel/occt-primitives.js +35 -2
- package/dist/occt-kernel/occt-primitives.js.map +1 -1
- package/dist/occt-kernel/occtKernel.d.ts +18 -13
- package/dist/occt-kernel/occtKernel.d.ts.map +1 -1
- package/dist/occt-kernel/occtKernel.js +18 -31
- package/dist/occt-kernel/occtKernel.js.map +1 -1
- package/dist/occt-kernel/stepColorParser.d.ts +18 -0
- package/dist/occt-kernel/stepColorParser.d.ts.map +1 -1
- package/dist/occt-kernel/stepColorParser.js +38 -0
- package/dist/occt-kernel/stepColorParser.js.map +1 -1
- package/dist/occt-kernel/topologyExt.d.ts +1 -1
- package/dist/occt-kernel/topologyExt.d.ts.map +1 -1
- package/dist/occt-kernel/topologyExt.js +4 -5
- package/dist/occt-kernel/topologyExt.js.map +1 -1
- package/dist/primitives/text/cjk-font.d.ts +2 -15
- package/dist/primitives/text/cjk-font.d.ts.map +1 -1
- package/dist/primitives/text/cjk-font.js +13 -1
- package/dist/primitives/text/cjk-font.js.map +1 -1
- package/dist/runtime-state.d.ts +85 -9
- package/dist/runtime-state.d.ts.map +1 -1
- package/dist/runtime-state.js +72 -2
- package/dist/runtime-state.js.map +1 -1
- package/dist/sdk.d.ts +3 -3
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +5 -5
- package/dist/sdk.js.map +1 -1
- package/dist/shape.d.ts +97 -2
- package/dist/shape.d.ts.map +1 -1
- package/dist/shape.js +126 -1
- package/dist/shape.js.map +1 -1
- package/dist/topology/naming/lineage.d.ts +6 -0
- package/dist/topology/naming/lineage.d.ts.map +1 -1
- package/dist/topology/naming/lineage.js +8 -0
- package/dist/topology/naming/lineage.js.map +1 -1
- package/dist/topology/naming/resolve-edge.d.ts +20 -1
- package/dist/topology/naming/resolve-edge.d.ts.map +1 -1
- package/dist/topology/naming/resolve-edge.js +54 -20
- package/dist/topology/naming/resolve-edge.js.map +1 -1
- package/dist/weapp.d.ts +6 -2
- package/dist/weapp.d.ts.map +1 -1
- package/dist/weapp.js +7 -1
- package/dist/weapp.js.map +1 -1
- package/package.json +18 -2
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,2DAA2D;AAC3D,4DAA4D;AAC5D,cAAc,gBAAgB,CAAA;AAK9B,OAAO,EACL,oBAAoB,EAA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,MAAM,8BAA8B,CAAA;AAC1G,OAAO,EACL,kBAAkB,EAAE,aAAa,EAAE,aAAa,EAAE,qBAAqB,EACvE,kBAAkB,EAAE,aAAa,EAAE,qBAAqB,EAAE,sBAAsB,GACjF,MAAM,wBAAwB,CAAA;AAQ/B,sBAAsB;AACtB,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAA;AAGhE,mDAAmD;AACnD,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,QAAQ,EAAE,iBAAiB,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAGzH,qBAAqB;AACrB,yDAAyD;AACzD,oDAAoD;AACpD,qEAAqE;AAErE,wBAAwB;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAEnD,yEAAyE;AACzE,kDAAkD;AAClD,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAA;AAI3F,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAA;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAA;AAE1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAA;AAGxE,4CAA4C;AAC5C,sDAAsD;AACtD,+CAA+C;AAC/C,2EAA2E;AAC3E,iDAAiD;AACjD,oEAAoE;AACpE,qEAAqE;AACrE,yBAAyB;AACzB,cAAc,OAAO,CAAA;AACrB,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA","sourcesContent":["/**\n * @faicad/faijs �?Faicad CAD execution engine\n *\n * 公开 API 统一入口。所有导出按层组织:\n * - L0 文本层:parser / codegen / symbol-table / types\n * - L1 几何执行层:BREP ops / Shape / 导出\n * - L1 Mesh 执行层:cad API\n * - L1 Boolean/CSG 辅助:cross-section / deriveNormals / extrude-helpers / joinery-shapes\n * - L1 Primitives:geometry / screw / svg-extrude / text / types\n * - L1 SDF:sdf-runner / templates / types\n * - L1 Knurl:KnurlGenerator / subdivision / textureLoader\n * - L1 Topology:build-face-ids / build-selector-runtime / types\n * - L2 编排层:CadRuntime / HostPorts\n * - L3 Node Host:createNodePorts / CLI\n * - OCCT Kernel:initOcctWasm / getKernel / setOcctWasmInitFn / ...\n * - CSG Backend:setCsgBackend / geoToManifoldMesh / ...\n */\n\n// ── 共享面(env-agnostic:identity + runtime-state + lang/*)──\n// 手写清单已收敛:三处 umbrella(index/browser/weapp)统一 re-export,防漂移。\nexport * from './env-agnostic'\n\n// ── L1 几何执行 ──\nexport type { Shape } from './mesh/types'\nexport type { BrepChainState } from './brep/brep-chain'\nexport {\n createBrepChainState, initBrepChainState, releaseBrepChainState,\n isCadFormat,\n} from './brep/brep-chain'\nexport {\n solidToShape, getSolidBoundingBox,\n translateBrep, rotateBrep, scaleBrep,\n fuseBrep, cutBrep, commonBrep,\n drillBrep, splitBrep, extrudeBrep,\n loadBrep, matrixToArray,\n} from './brep'\nexport type { DrillBrepParams, SplitBrepParams, SplitBrepResult, ExtrudeBrepParams } from './brep'\nexport { buildStlBufferFromMesh } from './brep/export/stl'\nexport { exportStepFromSolid, exportStepFromSolids } from './brep/export/step'\nexport type { StepExportEntry } from './brep/export/step'\n\n// ── L1 Mesh ──\nexport { cad } from './mesh'\n// 宿主注入的 mesh 装饰几何(cad.engrave 的文字/SVG 几何链在 @faicad/faijs-extra)\nexport { setEngraveDecorationProvider, getEngraveDecorationProvider } from './mesh/decoration-provider'\nexport type { EngraveDecorationProvider, EngraveDecorationParams } from './mesh/decoration-provider'\nexport { setManifoldWasmUrl, getManifoldWasmUrl, getManifoldModule } from './mesh/manifold-loader'\nexport type {\n BoundingBox, FaceDescriptor,\n BoxParams, SphereParams, CylinderParams, ConeParams, WedgeParams,\n TextParams, SvgExtrudeParams, SdfParams,\n DrillParams, ExtrudeParams, EngraveParams, KnurlParams,\n SplitPlane, SplitResult,\n} from './mesh/types'\nexport { NRAD_DEFAULT, NRAD_MIN, NRAD_MAX, clampNRad } from './mesh/types'\nexport { faceAt } from './mesh/query'\n\n// ── L1 Boolean/CSG 辅助 ──\nexport { computeSection, buildExtrudedProfile } from './boolean/cross-section'\nexport { manifoldToMeshData, weldPositionsWorker, dovetailBooleanSplit, dowelOrTenonBooleanSplit } from './boolean/csg-core'\nexport { deriveNormals } from './boolean/deriveNormals'\nexport { buildExtrudeParts, makeWorldPlane } from './boolean/extrude-helpers'\nexport type { ExtrudeParts, ExtrudeOffsetMode } from './boolean/extrude-helpers'\nexport {\n buildWedgeGeometry, buildDowelGeometry, buildStraightTenonGeometry,\n} from './boolean/joinery-shapes'\nexport type { JoineryMeshData } from './boolean/joinery-shapes'\n\n// ── CSG Backend ──\nexport { setCsgBackend } from './boolean/csg-backend'\nexport { geoToManifoldMesh, manifoldMeshToGeo } from './boolean/geo-convert'\nexport type {\n ManifoldMeshData, BooleanOperation,\n DovetailGrooveParams, DowelSplitParams, StraightTenonSplitParams,\n} from './boolean/geo-convert'\n\n// ── L1 Primitives ──\nexport { mergeBufferGeometries, makePrimitiveGeo, DEFAULT_SIZE, applyPrimitiveOffset } from './primitives/mesh-primitives'\nexport { makeScrew } from './primitives/screw/screw'\nexport { getScrewSpec, getScrewSpecs, threadToPitchMm, SCREW_HEAD_DIMS } from './primitives/screw/screw-db'\nexport type { ScrewParams, ScrewSpec, ScrewSystem } from './primitives/screw/screw-db'\nexport { parseSvgNaturalSize } from './primitives/parse-svg-size'\nexport {\n extractMeshData, primitiveToBrepSolid, geometryToBrepSolid,\n brepSolidToStep, primitiveToBrepStep,\n} from './primitives/brep-primitives'\nexport type { PrimitiveToBrepResult, PrimitiveParams } from './primitives/brep-primitives'\n// B 组(svg 挤出 / 3D 文字几何链)已随 @faicad/faijs-extra 迁出;\n// 留 core 的是零 three 的 CJK 字符判定与系统字体装载。\nexport { loadSystemCjkFont, containsCjk, isCjkChar } from './primitives/text/cjk-font'\nexport type { CjkFontResult } from './primitives/text/cjk-font'\nexport type {\n PrimitiveType, PrimitiveParamsRecord, PrimitiveArgsRecord, PrimitiveMeta,\n} from './primitives/types'\nexport { nextPrimitiveColor } from './primitives/types'\n\n// ── L1 SDF ──\nexport { runSdf } from './sdf/sdf-runner'\nexport type { SdfMeshData } from './sdf/sdf-runner'\nexport { runSdfInline } from './sdf/sdf-core'\nexport { SDF_TEMPLATES, DEFAULT_SDF_TEMPLATE } from './sdf/templates'\nexport type {\n SdfMeta, SdfBox, SdfParamDef, SdfTemplateCategory,\n SdfWorkerInput, SdfWorkerMessage,\n} from './sdf/types'\nexport { boxToTuple, parseParamDefs, defaultParamValues } from './sdf/types'\n\n// ── L1 Knurl ──\nexport { applyKnurlDisplacement, KNURL_DEFAULTS } from './mesh/knurl/KnurlGenerator'\nexport type { KnurlBounds } from './mesh/knurl/KnurlGenerator'\nexport { subdivide } from './mesh/knurl/subdivision'\nexport { loadKnurlingTexture, setKnurlTextureLoader } from './mesh/knurl/textureLoader'\nexport type { TextureData } from './mesh/knurl/textureLoader'\nexport { QuantizedPointMap, weldVertices } from './mesh/knurl/meshIndex'\nexport { computeUV, MODE_TRIPLANAR, getCubicBlendWeights, type MappingSettings } from './mesh/knurl/mapping'\nexport { applyDisplacement, type DisplacementSettings } from './mesh/knurl/displacement'\n\n// ── L1 Topology ──\nexport { TOPOLOGY_FACE_ID_NONE, buildFaceIdsForPart } from './topology/build-face-ids'\nexport {\n buildSelectorRuntime, buildSelectorRuntimeData, buildSelectorRuntimeMaps,\n} from './topology/build-selector-runtime'\nexport type { SelectorRuntimeData } from './topology/build-selector-runtime'\nexport type {\n SelectorRuntime, SelectorBundle, SelectorManifest, SelectorBuffers,\n FaceRow, EdgeRow, Reference,\n BufferViewDescriptor, SelectorProxy,\n} from './topology/types'\n\nexport * from './topology/naming'\n\n// ── L2 编排�?──\n// D1(2026-09-19):createRuntime 自注册 cad 默认命名空间(引擎 + 标准库定位)。\n// 需要纯引擎(不带 cad)的宿主可直接 import { createRuntime } from './cad-runtime/runtime'。\nexport { CadRuntime, createRuntime, computeContentKey, AppendPrefixError } from './cad-runtime/createRuntimeWithCad'\nexport { createPreviewExec } from './cad-runtime/preview-exec'\nexport type { PreviewExec } from './cad-runtime/preview-exec'\nexport type { ExecutionResult, ExecuteOptions, CheckResult, CheckError, CadRuntimeOptions } from './cad-runtime/runtime'\nexport type {\n HostPorts, CsgBackend, SdfBackend, FontProvider, TextureSampler,\n AssetResolver, EventSink, ExecutionMode,\n MeshData, PlaneParams, SplitResult as CsgSplitResult,\n DovetailGrooveParams as PortDovetailGrooveParams,\n DowelSplitParams as PortDowelSplitParams,\n StraightTenonSplitParams as PortStraightTenonSplitParams,\n LibLoader, ProjectLoader,\n} from './cad-runtime/ports'\n\n// ── OCCT Kernel ──\nexport {\n initOcctWasm, getKernel, disposeOcctWasm, setOcctWasmInitFn,\n computeEffectiveDeflection, importStepToMesh, importBrepToMesh,\n meshesToStep, releaseShape,\n importAssemblyFromStep, releaseAssemblyTree, collectLeafParts,\n} from './occt-kernel/occtKernel'\nexport type {\n WasmTessellatedMesh, WasmImportResult, AssemblyPartNode,\n MeshDeflectionOptions, ShapeHandle, OcctKernel,\n Mesh, EdgeData, SurfaceKind, CurveKind,\n} from './occt-kernel/occtKernel'\n\n// ── OCCT Mesh Reconstruct ──\nexport { reconstructSolidFromMesh, meshToAsciiStl, cadShapeIsValid, meshToStepBrep } from './occt-kernel/meshReconstruct'\n\n// ── OCCT 高层导出(多实体、零 fuse) ──\nexport { exportStepFromSolidsHighLevel } from './occt-kernel/highLevelApi'\n\n// ── OCCT Topology Extension ──\nexport { buildSelectorManifest, buildAssemblySelectorManifest, buildTopologyAdjacency } from './occt-kernel/topologyExt'\nexport type { SelectorManifestInput, PartTopologyInput, AssemblyTopologyResult, TopologyAdjacency } from './occt-kernel/topologyExt'\n\n// ── BREP 引擎注册(宿主装配;引擎可切换——occt 只是默认实现) ──\nexport { registerOcctBrepEngine, OCCT_BREP_ENGINE_ID } from './brep/engine/adapters/occt'\nexport { registerBrepMockEngine, BREP_MOCK_ENGINE_ID, createBrepMockApi } from './brep/engine/adapters/brep-mock'\n// brepkit 端侧 BREP 引擎(微信小程序等无 OCCT 环境):由宿主注入 wasm init 并抢先注册,\n// 使 ensureBrepChain 不回退 OCCT。setBrepkitWasmInitFn 注入自定义初始化(如 WXWebAssembly 实例化)。\nexport { registerBrepkitBrepEngine, BREPKIT_BREP_ENGINE_ID, ensureBrepkitDefaultEngine } from './brep/engine/adapters/brepkit'\nexport { setBrepkitWasmInitFn, initBrepkitWasm, isBrepkitInitialized } from './brepkit-kernel/brepkitWasm'\nexport {\n registerBrepEngine, getBrepEngine, hasBrepEngine, getActiveBrepEngineId,\n registerMeshEngine, getMeshEngine, getActiveMeshEngineId, freezeEngineRegistries,\n} from './brep/engine/registry'\nexport type { BrepEngine, BrepEngineProvider, MeshEngine } from './brep/engine/registry'\nexport type { BrepEngineApi } from './brep/engine/primitives'\nexport type {\n BrepHandle, BrepMeshResult, BrepBoundingBox, BrepVec3, BrepCapabilities,\n BrepEvolutionData, BrepXcafDocument,\n} from './brep/engine/types'\n\n// ── BREP Topology ──\nexport { buildSolidTopologyRuntime } from './brep/brep-topology'\nexport type { SolidTopologyResult } from './brep/brep-topology'\n\n// ── Font Registry (for browser host injection) ──\nexport { setFontLoader, getFontLoader, loadFont, ensureDefaultFont, getFont, clearFonts } from './brep/text/fontRegistry'\nexport type { FontLoader } from './brep/text/fontRegistry'\n\n// ── L3 Node Host ──\n// node-host 模块已移�?@faicad/faijs/node 入口,避免浏览器环境静�?import\n// node-host 模块(含 Node.js 专用代码�?fs/path)导致生产构�?404�?\n// �?Node.js 环境中:import { createNodePorts } from '@faicad/faijs/node'\n\n// ── L3 Browser Host ──\nexport { createBrowserPorts } from './browser-host'\nexport type { CreateBrowserPortsOptions } from './browser-host'\n// D3-Browser(§9.4):CDN 通用 libLoader 工厂(a/b 混合)。**不**被 createBrowserPorts\n// 默认装配——demo 的源码 alias HMR 路径必须零网络;CDN 装载由主机显式注入。\nexport { createBrowserLibLoader, DEFAULT_CDN_BASE } from './cad-runtime/browser-lib-loader'\nexport type {\n BrowserLibLoader, BrowserLibMeta, CreateBrowserLibLoaderOptions,\n} from './cad-runtime/browser-lib-loader'\nexport { BrowserEventSink } from './browser-host/browser-event-sink'\nexport { BrowserFontProvider } from './browser-host/browser-font-provider'\nexport type { BrowserFontProviderOptions } from './browser-host/browser-font-provider'\nexport { FetchAssetResolver } from './browser-host/fetch-asset-resolver'\nexport type { FetchAssetResolverOptions } from './browser-host/fetch-asset-resolver'\n\n// ── L3 API 面(原 packages/stdlib 迁入,P6/D1)──\n// P23 主导出切换(§4.2 / Q1):`export * from './api'` 现在同时带来\n// ① faijs 特有 dual op(mesh+brep 双路径,D11 双形态归一);\n// ② 生成脚本面 op(`api/generated/script-face.ts`,compatOp(projectBrepOp(…)) 包装的\n// brep-only 语句级 op——`cad.*` 脚本面与此同源,B1 三源一致);\n// ③ 2026-09-25 core-decouple:brepjsCompat 命名空间与 op 投影随 vendored 树删除\n// (裁决 9);`api/brepjs-compat` 仅保留 core 内联的 Result / 向量 / 平面 / 错误 /\n// 常量组合器(§5.2),顶层平铺不变。\nexport * from './api'\nexport { createApiNamespace } from './api/api-namespace'\n// Vec3 双源消歧:env-agnostic(lang/types)与 api(mesh/types)均有 Vec3,\n// 显式 re-export 定为 lang 版(与收敛前 index.ts 的具名导出一致)。\nexport type { Vec3 } from './lang/types'\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,2DAA2D;AAC3D,4DAA4D;AAC5D,cAAc,gBAAgB,CAAA;AAK9B,OAAO,EACL,oBAAoB,EAAE,kBAAkB,EAAE,qBAAqB,EAC/D,WAAW,GACZ,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EACL,YAAY,EAAE,mBAAmB,EACjC,aAAa,EAAE,UAAU,EAAE,SAAS,EACpC,QAAQ,EAAE,OAAO,EAAE,UAAU,EAC7B,SAAS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E,qBAAqB,EACvE,kBAAkB,EAAE,aAAa,EAAE,qBAAqB,EAAE,sBAAsB,EAChF,sBAAsB,EAAE,mBAAmB,GAC5C,MAAM,wBAAwB,CAAA;AAE/B,+BAA+B;AAC/B,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAItI,wBAAwB;AACxB,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAA;AAOzE,sBAAsB;AACtB,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAA;AAGhE,mDAAmD;AACnD,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,QAAQ,EAAE,iBAAiB,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAGrI,qBAAqB;AACrB,yDAAyD;AACzD,oDAAoD;AACpD,qEAAqE;AAErE,wBAAwB;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAEnD,yEAAyE;AACzE,kDAAkD;AAClD,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAA;AAI3F,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAA;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAA;AAE1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAA;AAGxE,wBAAwB;AACxB,sDAAsD;AACtD,+CAA+C;AAC/C,2EAA2E;AAC3E,iDAAiD;AACjD,oEAAoE;AACpE,qEAAqE;AACrE,yBAAyB;AACzB,cAAc,OAAO,CAAA;AACrB,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA","sourcesContent":["/**\n * @faicad/faijs �?Faicad CAD execution engine\n *\n * 公开 API 统一入口。所有导出按层组织:\n * - L0 文本层:parser / codegen / symbol-table / types\n * - L1 几何执行层:BREP ops / Shape / 导出\n * - L1 Mesh 执行层:cad API\n * - L1 Boolean/CSG 辅助:cross-section / deriveNormals / extrude-helpers / joinery-shapes\n * - L1 Primitives:geometry / screw / svg-extrude / text / types\n * - L1 SDF:sdf-runner / templates / types\n * - L1 Knurl:KnurlGenerator / subdivision / textureLoader\n * - L1 Topology:build-face-ids / build-selector-runtime / types\n * - L2 编排层:CadRuntime / HostPorts\n * - L3 Node Host:createNodePorts / CLI\n * - OCCT Kernel:initOcctWasm / getKernel / setOcctWasmInitFn / ...\n * - CSG Backend:setCsgBackend / geoToManifoldMesh / ...\n */\n\n// ── 共享面(env-agnostic:identity + runtime-state + lang/*)──\n// 手写清单已收敛:三处 umbrella(index/browser/weapp)统一 re-export,防漂移。\nexport * from './env-agnostic'\n\n// ── L1 几何执行 ──\nexport type { Shape } from './mesh/types'\nexport type { BrepChainState } from './brep/brep-chain'\nexport {\n createBrepChainState, initBrepChainState, releaseBrepChainState,\n isCadFormat,\n} from './brep/brep-chain'\nexport {\n solidToShape, getSolidBoundingBox,\n translateBrep, rotateBrep, scaleBrep,\n fuseBrep, cutBrep, commonBrep,\n drillBrep, splitBrep, extrudeBrep,\n loadBrep, matrixToArray,\n} from './brep'\nexport type { DrillBrepParams, SplitBrepParams, SplitBrepResult, ExtrudeBrepParams } from './brep'\nexport { buildStlBufferFromMesh } from './brep/export/stl'\nexport { exportStepFromSolid, exportStepFromSolids } from './brep/export/step'\nexport type { StepExportEntry } from './brep/export/step'\n\n// ── L1 Mesh ──\nexport { cad } from './mesh'\n// 宿主注入的 mesh 装饰几何(cad.engrave 的文字/SVG 几何链在 @faicad/faijs-extra)\nexport { setEngraveDecorationProvider, getEngraveDecorationProvider } from './mesh/decoration-provider'\nexport type { EngraveDecorationProvider, EngraveDecorationParams } from './mesh/decoration-provider'\nexport { setManifoldWasmUrl, getManifoldWasmUrl, getManifoldModule } from './mesh/manifold-loader'\nexport type {\n BoundingBox, FaceDescriptor,\n BoxParams, SphereParams, CylinderParams, ConeParams, WedgeParams,\n TextParams, SvgExtrudeParams, SdfParams,\n DrillParams, ExtrudeParams, EngraveParams, KnurlParams,\n SplitPlane, SplitResult,\n} from './mesh/types'\nexport { NRAD_DEFAULT, NRAD_MIN, NRAD_MAX, clampNRad } from './mesh/types'\nexport { faceAt } from './mesh/query'\n\n// ── L1 Boolean/CSG 辅助 ──\nexport { computeSection, buildExtrudedProfile } from './boolean/cross-section'\nexport { manifoldToMeshData, weldPositionsWorker, dovetailBooleanSplit, dowelOrTenonBooleanSplit } from './boolean/csg-core'\nexport { deriveNormals } from './boolean/deriveNormals'\nexport { buildExtrudeParts, makeWorldPlane } from './boolean/extrude-helpers'\nexport type { ExtrudeParts, ExtrudeOffsetMode } from './boolean/extrude-helpers'\nexport {\n buildWedgeGeometry, buildDowelGeometry, buildStraightTenonGeometry,\n} from './boolean/joinery-shapes'\nexport type { JoineryMeshData } from './boolean/joinery-shapes'\n\n// ── CSG Backend ──\nexport { setCsgBackend } from './boolean/csg-backend'\nexport { geoToManifoldMesh, manifoldMeshToGeo } from './boolean/geo-convert'\nexport type {\n ManifoldMeshData, BooleanOperation,\n DovetailGrooveParams, DowelSplitParams, StraightTenonSplitParams,\n} from './boolean/geo-convert'\n\n// ── L1 Primitives ──\nexport { mergeBufferGeometries, makePrimitiveGeo, DEFAULT_SIZE, applyPrimitiveOffset } from './primitives/mesh-primitives'\nexport { makeScrew } from './primitives/screw/screw'\nexport { getScrewSpec, getScrewSpecs, threadToPitchMm, SCREW_HEAD_DIMS } from './primitives/screw/screw-db'\nexport type { ScrewParams, ScrewSpec, ScrewSystem } from './primitives/screw/screw-db'\nexport { parseSvgNaturalSize } from './primitives/parse-svg-size'\nexport {\n extractMeshData, primitiveToBrepSolid, geometryToBrepSolid,\n brepSolidToStep, primitiveToBrepStep,\n} from './primitives/brep-primitives'\nexport type { PrimitiveToBrepResult, PrimitiveParams } from './primitives/brep-primitives'\n// B 组(svg 挤出 / 3D 文字几何链)已随 @faicad/faijs-extra 迁出;\n// 留 core 的是零 three 的 CJK 字符判定与系统字体装载。\nexport { loadSystemCjkFont, containsCjk, isCjkChar } from './primitives/text/cjk-font'\nexport type { CjkFontResult } from './primitives/text/cjk-font'\nexport type {\n PrimitiveType, PrimitiveParamsRecord, PrimitiveArgsRecord, PrimitiveMeta,\n} from './primitives/types'\nexport { nextPrimitiveColor } from './primitives/types'\n\n// ── L1 SDF ──\nexport { runSdf } from './sdf/sdf-runner'\nexport type { SdfMeshData } from './sdf/sdf-runner'\nexport { runSdfInline } from './sdf/sdf-core'\nexport { SDF_TEMPLATES, DEFAULT_SDF_TEMPLATE } from './sdf/templates'\nexport type {\n SdfMeta, SdfBox, SdfParamDef, SdfTemplateCategory,\n SdfWorkerInput, SdfWorkerMessage,\n} from './sdf/types'\nexport { boxToTuple, parseParamDefs, defaultParamValues } from './sdf/types'\n\n// ── L1 Knurl ──\nexport { applyKnurlDisplacement, KNURL_DEFAULTS } from './mesh/knurl/KnurlGenerator'\nexport type { KnurlBounds } from './mesh/knurl/KnurlGenerator'\nexport { subdivide } from './mesh/knurl/subdivision'\nexport { loadKnurlingTexture, setKnurlTextureLoader } from './mesh/knurl/textureLoader'\nexport type { TextureData } from './mesh/knurl/textureLoader'\nexport { QuantizedPointMap, weldVertices } from './mesh/knurl/meshIndex'\nexport { computeUV, MODE_TRIPLANAR, getCubicBlendWeights, type MappingSettings } from './mesh/knurl/mapping'\nexport { applyDisplacement, type DisplacementSettings } from './mesh/knurl/displacement'\n\n// ── L1 Topology ──\nexport { TOPOLOGY_FACE_ID_NONE, buildFaceIdsForPart } from './topology/build-face-ids'\nexport {\n buildSelectorRuntime, buildSelectorRuntimeData, buildSelectorRuntimeMaps,\n} from './topology/build-selector-runtime'\nexport type { SelectorRuntimeData } from './topology/build-selector-runtime'\nexport type {\n SelectorRuntime, SelectorBundle, SelectorManifest, SelectorBuffers,\n FaceRow, EdgeRow, Reference,\n BufferViewDescriptor, SelectorProxy,\n} from './topology/types'\n\nexport * from './topology/naming'\n\n// ── L2 编排�?──\n// D1(2026-09-19):createRuntime 自注册 cad 默认命名空间(引擎 + 标准库定位)。\n// 需要纯引擎(不带 cad)的宿主可直接 import { createRuntime } from './cad-runtime/runtime'。\nexport { CadRuntime, createRuntime, computeContentKey, AppendPrefixError } from './cad-runtime/createRuntimeWithCad'\nexport { createPreviewExec } from './cad-runtime/preview-exec'\nexport type { PreviewExec } from './cad-runtime/preview-exec'\nexport type { ExecutionResult, ExecuteOptions, CheckResult, CheckError, CadRuntimeOptions } from './cad-runtime/runtime'\nexport type {\n HostPorts, CsgBackend, SdfBackend, FontProvider, TextureSampler,\n AssetResolver, EventSink, ExecutionMode,\n MeshData, PlaneParams, SplitResult as CsgSplitResult,\n DovetailGrooveParams as PortDovetailGrooveParams,\n DowelSplitParams as PortDowelSplitParams,\n StraightTenonSplitParams as PortStraightTenonSplitParams,\n LibLoader, ProjectLoader,\n} from './cad-runtime/ports'\n\n// ── OCCT Kernel ──\nexport {\n initOcctWasm, getKernel, disposeOcctWasm, setOcctWasmInitFn,\n computeEffectiveDeflection, importStepToMesh, importBrepToMesh,\n meshesToStep, releaseShape,\n importAssemblyFromStep, releaseAssemblyTree, collectLeafParts,\n} from './occt-kernel/occtKernel'\nexport type {\n WasmTessellatedMesh, WasmImportResult, AssemblyPartNode,\n MeshDeflectionOptions, ShapeHandle, OcctKernel,\n Mesh, EdgeData, SurfaceKind, CurveKind,\n} from './occt-kernel/occtKernel'\n\n// ── OCCT Mesh Reconstruct ──\nexport { reconstructSolidFromMesh, meshToAsciiStl, cadShapeIsValid, meshToStepBrep } from './occt-kernel/meshReconstruct'\n\n// ── OCCT 高层导出(多实体、零 fuse) ──\nexport { exportStepFromSolidsHighLevel } from './occt-kernel/highLevelApi'\n\n// ── OCCT Topology Extension ──\nexport { buildSelectorManifest, buildAssemblySelectorManifest, buildTopologyAdjacency } from './occt-kernel/topologyExt'\nexport type { SelectorManifestInput, PartTopologyInput, AssemblyTopologyResult, TopologyAdjacency } from './occt-kernel/topologyExt'\n\n// ── BREP 引擎注册(宿主装配;引擎可切换——occt 只是默认实现) ──\nexport { registerOcctBrepEngine, OCCT_BREP_ENGINE_ID } from './brep/engine/adapters/occt'\nexport { registerBrepMockEngine, BREP_MOCK_ENGINE_ID, createBrepMockApi } from './brep/engine/adapters/brep-mock'\n// brepkit 端侧 BREP 引擎(微信小程序等无 OCCT 环境):由宿主注入 wasm init 并抢先注册,\n// 使 ensureBrepChain 不回退 OCCT。setBrepkitWasmInitFn 注入自定义初始化(如 WXWebAssembly 实例化)。\nexport { registerBrepkitBrepEngine, BREPKIT_BREP_ENGINE_ID, ensureBrepkitDefaultEngine } from './brep/engine/adapters/brepkit'\n// brepkit 网格实体后端(网格语义路径;与 BREP 槽独立注册)。装了它,`cad.load`\n// 的 STL/3MF 路径才产出「网格实体 + 近似拓扑」;不装则维持裸网格的历史行为。\nexport { registerBrepkitMeshEngine, BREPKIT_MESH_ENGINE_ID, ensureBrepkitMeshBackend } from './brep/engine/adapters/brepkit'\nexport { setBrepkitWasmInitFn, initBrepkitWasm, isBrepkitInitialized } from './brepkit-kernel/brepkitWasm'\nexport {\n registerBrepEngine, getBrepEngine, hasBrepEngine, getActiveBrepEngineId,\n registerMeshEngine, getMeshEngine, getActiveMeshEngineId, freezeEngineRegistries,\n isMeshEngineRegistered, getMeshSolidBackend,\n} from './brep/engine/registry'\nexport type { BrepEngine, BrepEngineProvider, MeshEngine } from './brep/engine/registry'\n// 网格实体(近似拓扑的载体):端口 + 注册表 + 驱动。\nexport { MeshSolidRegistry, normalizeMeshSolid, describeMeshSolid, buildMeshSolidTopology, weldToleranceFor } from './brep/mesh-solid'\nexport type {\n MeshSolidBackend, MeshSolidResult, MeshSolidKernelOps, MeshSolidInput, MeshSolidNormalizeOptions,\n} from './brep/mesh-solid'\n// 槽位互斥不变量(分派前置校验;缺陷即报错)\nexport { assertShapeSlotExclusive } from './cad-runtime/backend-dispatch'\nexport type { BrepEngineApi } from './brep/engine/primitives'\nexport type {\n BrepHandle, BrepMeshResult, BrepBoundingBox, BrepVec3, BrepCapabilities,\n BrepEvolutionData, BrepXcafDocument,\n} from './brep/engine/types'\n\n// ── BREP Topology ──\nexport { buildSolidTopologyRuntime } from './brep/brep-topology'\nexport type { SolidTopologyResult } from './brep/brep-topology'\n\n// ── Font Registry (for browser host injection) ──\nexport { setFontLoader, getFontLoader, loadFont, ensureDefaultFont, ensureFont, getFont, clearFonts } from './brep/text/fontRegistry'\nexport type { FontLoader } from './brep/text/fontRegistry'\n\n// ── L3 Node Host ──\n// node-host 模块已移�?@faicad/faijs/node 入口,避免浏览器环境静�?import\n// node-host 模块(含 Node.js 专用代码�?fs/path)导致生产构�?404�?\n// �?Node.js 环境中:import { createNodePorts } from '@faicad/faijs/node'\n\n// ── L3 Browser Host ──\nexport { createBrowserPorts } from './browser-host'\nexport type { CreateBrowserPortsOptions } from './browser-host'\n// D3-Browser(§9.4):CDN 通用 libLoader 工厂(a/b 混合)。**不**被 createBrowserPorts\n// 默认装配——demo 的源码 alias HMR 路径必须零网络;CDN 装载由主机显式注入。\nexport { createBrowserLibLoader, DEFAULT_CDN_BASE } from './cad-runtime/browser-lib-loader'\nexport type {\n BrowserLibLoader, BrowserLibMeta, CreateBrowserLibLoaderOptions,\n} from './cad-runtime/browser-lib-loader'\nexport { BrowserEventSink } from './browser-host/browser-event-sink'\nexport { BrowserFontProvider } from './browser-host/browser-font-provider'\nexport type { BrowserFontProviderOptions } from './browser-host/browser-font-provider'\nexport { FetchAssetResolver } from './browser-host/fetch-asset-resolver'\nexport type { FetchAssetResolverOptions } from './browser-host/fetch-asset-resolver'\n\n// ── L3 API 面(api/ 层)──\n// P23 主导出切换(§4.2 / Q1):`export * from './api'` 现在同时带来\n// ① faijs 特有 dual op(mesh+brep 双路径,D11 双形态归一);\n// ② 生成脚本面 op(`api/generated/script-face.ts`,compatOp(projectBrepOp(…)) 包装的\n// brep-only 语句级 op——`cad.*` 脚本面与此同源,B1 三源一致);\n// ③ 2026-09-25 core-decouple:brepjsCompat 命名空间与 op 投影随 vendored 树删除\n// (裁决 9);`api/brepjs-compat` 仅保留 core 内联的 Result / 向量 / 平面 / 错误 /\n// 常量组合器(§5.2),顶层平铺不变。\nexport * from './api'\nexport { createApiNamespace } from './api/api-namespace'\n// Vec3 双源消歧:env-agnostic(lang/types)与 api(mesh/types)均有 Vec3,\n// 显式 re-export 定为 lang 版(与收敛前 index.ts 的具名导出一致)。\nexport type { Vec3 } from './lang/types'\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read a file into a standalone ArrayBuffer sized exactly to the file.
|
|
3
|
+
*
|
|
4
|
+
* Equivalent to `toArrayBuffer(readFileSync(path))`; provided so filesystem
|
|
5
|
+
* callers do not have to remember why the `.buffer` shorthand is unsafe.
|
|
6
|
+
*
|
|
7
|
+
* @param path - filesystem path to read, as a string or a `file:` URL.
|
|
8
|
+
* @returns a new ArrayBuffer owned solely by the caller.
|
|
9
|
+
*/
|
|
10
|
+
export declare function readFileArrayBuffer(path: string | URL): ArrayBuffer;
|
|
11
|
+
//# sourceMappingURL=bytes-node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bytes-node.d.ts","sourceRoot":"","sources":["../../src/io/bytes-node.ts"],"names":[],"mappings":"AAgBA;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,GAAG,WAAW,CAEnE"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node-only file reader companion to `io/bytes.ts`.
|
|
3
|
+
*
|
|
4
|
+
* `Buffer.prototype.buffer` is the Buffer's *backing store*, not the file
|
|
5
|
+
* bytes: on Node 24 pooled buffers come from a shared store larger than the
|
|
6
|
+
* file and at a non-zero byteOffset. Handing that store to a kernel that
|
|
7
|
+
* decodes the whole ArrayBuffer also feeds it pool residue — seen as
|
|
8
|
+
* "Line 2: unexpected QUID, expecting STEP" in occt-wasm importStep.
|
|
9
|
+
*
|
|
10
|
+
* Node-only by design (top-level node: imports): exported from
|
|
11
|
+
* `@faicad/faijs/node`, never from `io/index.ts` / the browser entries.
|
|
12
|
+
*/
|
|
13
|
+
import { readFileSync } from 'node:fs';
|
|
14
|
+
import { fileURLToPath } from 'node:url';
|
|
15
|
+
import { toArrayBuffer } from './bytes.js';
|
|
16
|
+
/**
|
|
17
|
+
* Read a file into a standalone ArrayBuffer sized exactly to the file.
|
|
18
|
+
*
|
|
19
|
+
* Equivalent to `toArrayBuffer(readFileSync(path))`; provided so filesystem
|
|
20
|
+
* callers do not have to remember why the `.buffer` shorthand is unsafe.
|
|
21
|
+
*
|
|
22
|
+
* @param path - filesystem path to read, as a string or a `file:` URL.
|
|
23
|
+
* @returns a new ArrayBuffer owned solely by the caller.
|
|
24
|
+
*/
|
|
25
|
+
export function readFileArrayBuffer(path) {
|
|
26
|
+
return toArrayBuffer(readFileSync(fileURLToPath(path)));
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=bytes-node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bytes-node.js","sourceRoot":"","sources":["../../src/io/bytes-node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAEvC;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAkB;IACpD,OAAO,aAAa,CAAC,YAAY,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACzD,CAAC","sourcesContent":["/**\n * Node-only file reader companion to `io/bytes.ts`.\n *\n * `Buffer.prototype.buffer` is the Buffer's *backing store*, not the file\n * bytes: on Node 24 pooled buffers come from a shared store larger than the\n * file and at a non-zero byteOffset. Handing that store to a kernel that\n * decodes the whole ArrayBuffer also feeds it pool residue — seen as\n * \"Line 2: unexpected QUID, expecting STEP\" in occt-wasm importStep.\n *\n * Node-only by design (top-level node: imports): exported from\n * `@faicad/faijs/node`, never from `io/index.ts` / the browser entries.\n */\nimport { readFileSync } from 'node:fs'\nimport { fileURLToPath } from 'node:url'\nimport { toArrayBuffer } from './bytes'\n\n/**\n * Read a file into a standalone ArrayBuffer sized exactly to the file.\n *\n * Equivalent to `toArrayBuffer(readFileSync(path))`; provided so filesystem\n * callers do not have to remember why the `.buffer` shorthand is unsafe.\n *\n * @param path - filesystem path to read, as a string or a `file:` URL.\n * @returns a new ArrayBuffer owned solely by the caller.\n */\nexport function readFileArrayBuffer(path: string | URL): ArrayBuffer {\n return toArrayBuffer(readFileSync(fileURLToPath(path)))\n}\n"]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* io/bytes — normalise a BufferSource into an exactly-owned ArrayBuffer.
|
|
3
|
+
*
|
|
4
|
+
* faijs hands geometry kernels plain `ArrayBuffer`s (see the `assets.resolveFile`
|
|
5
|
+
* contract in `cad-runtime/ports`). That contract has no notion of a view
|
|
6
|
+
* offset, so a *pooled* or *offset* backing store must never cross it: a
|
|
7
|
+
* consumer that decodes the whole ArrayBuffer would also read whatever else
|
|
8
|
+
* shares that store.
|
|
9
|
+
*
|
|
10
|
+
* This is the single place that conversion is spelled out, because the failure
|
|
11
|
+
* it prevents is invisible: the kernel does not report a short read, it reports
|
|
12
|
+
* a corrupt-parse error far away from the call that caused it.
|
|
13
|
+
*
|
|
14
|
+
* Contract:
|
|
15
|
+
* - Always returns a fresh ArrayBuffer whose `byteLength` equals the source's
|
|
16
|
+
* `byteLength`; never aliases the input.
|
|
17
|
+
* - Accepts any BufferSource (ArrayBuffer or any ArrayBufferView), so a caller
|
|
18
|
+
* holding a `Buffer`/subarray does not have to slice it by hand.
|
|
19
|
+
* - Zero-copy is deliberately not attempted: the sources are whole-file reads,
|
|
20
|
+
* where one copy is cheaper than reasoning about who else owns the store.
|
|
21
|
+
*
|
|
22
|
+
* Browser-safe: this module must stay free of node: imports — it is
|
|
23
|
+
* re-exported from `io/index.ts`, which is imported by browser bundles. The
|
|
24
|
+
* Node-only file reader lives in `io/bytes-node.ts` (`@faicad/faijs/node`).
|
|
25
|
+
*/
|
|
26
|
+
/**
|
|
27
|
+
* Copy a BufferSource into a standalone ArrayBuffer sized exactly to its bytes.
|
|
28
|
+
*
|
|
29
|
+
* @param source - the bytes to normalise (ArrayBuffer or any ArrayBufferView).
|
|
30
|
+
* @returns a new ArrayBuffer owned solely by the caller.
|
|
31
|
+
*/
|
|
32
|
+
export declare function toArrayBuffer(source: BufferSource): ArrayBuffer;
|
|
33
|
+
//# sourceMappingURL=bytes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bytes.d.ts","sourceRoot":"","sources":["../../src/io/bytes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,YAAY,GAAG,WAAW,CAY/D"}
|
package/dist/io/bytes.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* io/bytes — normalise a BufferSource into an exactly-owned ArrayBuffer.
|
|
3
|
+
*
|
|
4
|
+
* faijs hands geometry kernels plain `ArrayBuffer`s (see the `assets.resolveFile`
|
|
5
|
+
* contract in `cad-runtime/ports`). That contract has no notion of a view
|
|
6
|
+
* offset, so a *pooled* or *offset* backing store must never cross it: a
|
|
7
|
+
* consumer that decodes the whole ArrayBuffer would also read whatever else
|
|
8
|
+
* shares that store.
|
|
9
|
+
*
|
|
10
|
+
* This is the single place that conversion is spelled out, because the failure
|
|
11
|
+
* it prevents is invisible: the kernel does not report a short read, it reports
|
|
12
|
+
* a corrupt-parse error far away from the call that caused it.
|
|
13
|
+
*
|
|
14
|
+
* Contract:
|
|
15
|
+
* - Always returns a fresh ArrayBuffer whose `byteLength` equals the source's
|
|
16
|
+
* `byteLength`; never aliases the input.
|
|
17
|
+
* - Accepts any BufferSource (ArrayBuffer or any ArrayBufferView), so a caller
|
|
18
|
+
* holding a `Buffer`/subarray does not have to slice it by hand.
|
|
19
|
+
* - Zero-copy is deliberately not attempted: the sources are whole-file reads,
|
|
20
|
+
* where one copy is cheaper than reasoning about who else owns the store.
|
|
21
|
+
*
|
|
22
|
+
* Browser-safe: this module must stay free of node: imports — it is
|
|
23
|
+
* re-exported from `io/index.ts`, which is imported by browser bundles. The
|
|
24
|
+
* Node-only file reader lives in `io/bytes-node.ts` (`@faicad/faijs/node`).
|
|
25
|
+
*/
|
|
26
|
+
/**
|
|
27
|
+
* Copy a BufferSource into a standalone ArrayBuffer sized exactly to its bytes.
|
|
28
|
+
*
|
|
29
|
+
* @param source - the bytes to normalise (ArrayBuffer or any ArrayBufferView).
|
|
30
|
+
* @returns a new ArrayBuffer owned solely by the caller.
|
|
31
|
+
*/
|
|
32
|
+
export function toArrayBuffer(source) {
|
|
33
|
+
if (source instanceof ArrayBuffer) {
|
|
34
|
+
// Already standalone in size, but callers may still hold another view onto
|
|
35
|
+
// it; copy so the result can never be mutated through another reference.
|
|
36
|
+
return source.slice(0);
|
|
37
|
+
}
|
|
38
|
+
const view = new Uint8Array(source.buffer, source.byteOffset, source.byteLength);
|
|
39
|
+
return view.slice().buffer;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=bytes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bytes.js","sourceRoot":"","sources":["../../src/io/bytes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,MAAoB;IAChD,IAAI,MAAM,YAAY,WAAW,EAAE,CAAC;QAClC,2EAA2E;QAC3E,yEAAyE;QACzE,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IACxB,CAAC;IACD,MAAM,IAAI,GAAG,IAAI,UAAU,CACxB,MAA0B,CAAC,MAAqB,EAChD,MAA0B,CAAC,UAAU,EACrC,MAA0B,CAAC,UAAU,CACvC,CAAA;IACD,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC,MAAqB,CAAA;AAC3C,CAAC","sourcesContent":["/**\n * io/bytes — normalise a BufferSource into an exactly-owned ArrayBuffer.\n *\n * faijs hands geometry kernels plain `ArrayBuffer`s (see the `assets.resolveFile`\n * contract in `cad-runtime/ports`). That contract has no notion of a view\n * offset, so a *pooled* or *offset* backing store must never cross it: a\n * consumer that decodes the whole ArrayBuffer would also read whatever else\n * shares that store.\n *\n * This is the single place that conversion is spelled out, because the failure\n * it prevents is invisible: the kernel does not report a short read, it reports\n * a corrupt-parse error far away from the call that caused it.\n *\n * Contract:\n * - Always returns a fresh ArrayBuffer whose `byteLength` equals the source's\n * `byteLength`; never aliases the input.\n * - Accepts any BufferSource (ArrayBuffer or any ArrayBufferView), so a caller\n * holding a `Buffer`/subarray does not have to slice it by hand.\n * - Zero-copy is deliberately not attempted: the sources are whole-file reads,\n * where one copy is cheaper than reasoning about who else owns the store.\n *\n * Browser-safe: this module must stay free of node: imports — it is\n * re-exported from `io/index.ts`, which is imported by browser bundles. The\n * Node-only file reader lives in `io/bytes-node.ts` (`@faicad/faijs/node`).\n */\n\n/**\n * Copy a BufferSource into a standalone ArrayBuffer sized exactly to its bytes.\n *\n * @param source - the bytes to normalise (ArrayBuffer or any ArrayBufferView).\n * @returns a new ArrayBuffer owned solely by the caller.\n */\nexport function toArrayBuffer(source: BufferSource): ArrayBuffer {\n if (source instanceof ArrayBuffer) {\n // Already standalone in size, but callers may still hold another view onto\n // it; copy so the result can never be mutated through another reference.\n return source.slice(0)\n }\n const view = new Uint8Array(\n (source as ArrayBufferView).buffer as ArrayBuffer,\n (source as ArrayBufferView).byteOffset,\n (source as ArrayBufferView).byteLength,\n )\n return view.slice().buffer as ArrayBuffer\n}\n"]}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified `.fai.zip` read API (docs/fai-zip-format.md §4–§9).
|
|
3
|
+
*
|
|
4
|
+
* Environment-independent by constraint: reading goes through `io/zip.ts`
|
|
5
|
+
* (`readZipEntries`) plus JSON parsing — no `node:*`, no DOM, no fs, and no
|
|
6
|
+
* direct ZIP library. Web workers, the weapp worker and node share this code.
|
|
7
|
+
*
|
|
8
|
+
* Contract highlights (spec §9 Reader obligations):
|
|
9
|
+
* - a missing/malformed manifest, `format !== 3`, a malformed `models` array,
|
|
10
|
+
* a missing entry, a missing named data member and a duplicate asset key are
|
|
11
|
+
* all errors carrying the offending value;
|
|
12
|
+
* - entry selection is `active` or `models[0]` — never a file-name heuristic;
|
|
13
|
+
* - members outside the table (§3), unknown manifest fields and unknown
|
|
14
|
+
* data-member keys are ignored, never errors, never decision inputs.
|
|
15
|
+
*/
|
|
16
|
+
import { type ZipReadOptions } from '../zip.js';
|
|
17
|
+
import type { ProjectLoader } from '../../cad-runtime/ports.js';
|
|
18
|
+
import { type ContainerAssetEntries, type ContainerManifest, type ContainerModel } from './container.js';
|
|
19
|
+
/** openContainer options. */
|
|
20
|
+
export interface OpenContainerOptions {
|
|
21
|
+
/** override `manifest.active`; default = `manifest.active`, else `models[0]` */
|
|
22
|
+
modelId?: string;
|
|
23
|
+
/** override the `io/zip.ts` read caps (maxEntries / maxTotalBytes) */
|
|
24
|
+
caps?: ZipReadOptions;
|
|
25
|
+
}
|
|
26
|
+
/** openContainer result: manifest, active model, loader and payloads. */
|
|
27
|
+
export interface OpenContainerResult {
|
|
28
|
+
manifest: ContainerManifest;
|
|
29
|
+
activeModel: ContainerModel;
|
|
30
|
+
/** project loader over the container's module graph (listModules/readSource) */
|
|
31
|
+
loader: ProjectLoader;
|
|
32
|
+
files: Record<string, Uint8Array>;
|
|
33
|
+
assets: Record<string, Uint8Array>;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Read and validate the container manifest (spec §4).
|
|
37
|
+
* @param bytes the .fai.zip archive bytes
|
|
38
|
+
* @returns the validated manifest
|
|
39
|
+
* @throws when the archive is not a ZIP, the manifest is missing/malformed,
|
|
40
|
+
* `format !== 3`, `units !== "mm"`, `models` is empty/malformed, ids/entries
|
|
41
|
+
* are duplicated, an entry is not under `model/` or does not exist, `active`
|
|
42
|
+
* is not in `models[].id`, or a named `data` member does not exist.
|
|
43
|
+
*/
|
|
44
|
+
export declare function readManifest(bytes: Uint8Array): ContainerManifest;
|
|
45
|
+
/**
|
|
46
|
+
* List the container models (validated). Same validation as readManifest.
|
|
47
|
+
* @param bytes the .fai.zip archive bytes
|
|
48
|
+
* @returns the validated model list
|
|
49
|
+
*/
|
|
50
|
+
export declare function listModels(bytes: Uint8Array): ContainerModel[];
|
|
51
|
+
/**
|
|
52
|
+
* List every module under `model/` (keys relative to `model/`, sorted).
|
|
53
|
+
* Members outside the table are ignored (§3), never an error.
|
|
54
|
+
* @param bytes the .fai.zip archive bytes
|
|
55
|
+
* @returns module keys relative to `model/`, sorted
|
|
56
|
+
*/
|
|
57
|
+
export declare function listModules(bytes: Uint8Array): string[];
|
|
58
|
+
/**
|
|
59
|
+
* Read one module's source text by module key (relative to `model/`).
|
|
60
|
+
* @param bytes the .fai.zip archive bytes
|
|
61
|
+
* @param key the module key relative to `model/` (e.g. `main.fai.js`)
|
|
62
|
+
* @returns the module source text
|
|
63
|
+
* @throws for a key outside `model/` or that does not exist
|
|
64
|
+
*/
|
|
65
|
+
export declare function readModule(bytes: Uint8Array, key: string): string;
|
|
66
|
+
/**
|
|
67
|
+
* Read one model data member's JSON text by member path (e.g. `data/main.json`).
|
|
68
|
+
*
|
|
69
|
+
* The path must be exactly what `models[].data` declares (spec §4): a safe,
|
|
70
|
+
* relative member under `data/` ending with `.json`. Content is validated to
|
|
71
|
+
* parse as JSON — the editor keeps data members pure JSON (§6.1), so a
|
|
72
|
+
* non-JSON member is a format violation and an error, never a silent skip.
|
|
73
|
+
*
|
|
74
|
+
* @param bytes the .fai.zip archive bytes
|
|
75
|
+
* @param memberPath the member path named by `models[].data`
|
|
76
|
+
* @returns the raw JSON text
|
|
77
|
+
* @throws for a non-string/unsafe path, a path outside `data/`, a missing
|
|
78
|
+
* member, or content that does not parse as JSON
|
|
79
|
+
*/
|
|
80
|
+
export declare function readDataMember(bytes: Uint8Array, memberPath: string): string;
|
|
81
|
+
/**
|
|
82
|
+
* Collect the payload bytes of a container.
|
|
83
|
+
* Keys are unique across `files/**` and `assets/**` together (spec §7.1);
|
|
84
|
+
* a duplicate key is an error rather than a pick.
|
|
85
|
+
* @param bytes the .fai.zip archive bytes
|
|
86
|
+
* @returns the payload entries keyed by asset key
|
|
87
|
+
*/
|
|
88
|
+
export declare function readAssetEntries(bytes: Uint8Array): ContainerAssetEntries;
|
|
89
|
+
/**
|
|
90
|
+
* Host entry point: open a container and return the manifest, the active
|
|
91
|
+
* model and a ProjectLoader over its module graph, plus the payloads.
|
|
92
|
+
*
|
|
93
|
+
* The archive is unpacked exactly once for the whole call.
|
|
94
|
+
*
|
|
95
|
+
* @param bytes the .fai.zip archive bytes
|
|
96
|
+
* @param opts optional active-model override and `io/zip.ts` read caps
|
|
97
|
+
* @returns manifest, active model, project loader and payload entries
|
|
98
|
+
* @throws when the container is invalid, the requested model id is unknown, or
|
|
99
|
+
* the read caps are exceeded
|
|
100
|
+
*/
|
|
101
|
+
export declare function openContainer(bytes: Uint8Array, opts?: OpenContainerOptions): OpenContainerResult;
|
|
102
|
+
//# sourceMappingURL=container-read.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"container-read.d.ts","sourceRoot":"","sources":["../../../src/io/fai-zip/container-read.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,QAAQ,CAAA;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB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|
1
|
+
/**
|
|
2
|
+
* Unified `.fai.zip` read API (docs/fai-zip-format.md §4–§9).
|
|
3
|
+
*
|
|
4
|
+
* Environment-independent by constraint: reading goes through `io/zip.ts`
|
|
5
|
+
* (`readZipEntries`) plus JSON parsing — no `node:*`, no DOM, no fs, and no
|
|
6
|
+
* direct ZIP library. Web workers, the weapp worker and node share this code.
|
|
7
|
+
*
|
|
8
|
+
* Contract highlights (spec §9 Reader obligations):
|
|
9
|
+
* - a missing/malformed manifest, `format !== 3`, a malformed `models` array,
|
|
10
|
+
* a missing entry, a missing named data member and a duplicate asset key are
|
|
11
|
+
* all errors carrying the offending value;
|
|
12
|
+
* - entry selection is `active` or `models[0]` — never a file-name heuristic;
|
|
13
|
+
* - members outside the table (§3), unknown manifest fields and unknown
|
|
14
|
+
* data-member keys are ignored, never errors, never decision inputs.
|
|
15
|
+
*/
|
|
16
|
+
import { readZipEntries } from '../zip.js';
|
|
17
|
+
import { assetKeyOf, assertDataMemberPath, assertModelMemberPath, assertSafeMemberPath, decodeMemberText, } from './container.js';
|
|
18
|
+
/** Path prefix of every model script member. */
|
|
19
|
+
const MODEL_PREFIX = 'model/';
|
|
20
|
+
/** Path prefix of the imported-file payloads. */
|
|
21
|
+
const FILES_PREFIX = 'files/';
|
|
22
|
+
/** Path prefix of the script-consumed payloads. */
|
|
23
|
+
const ASSETS_PREFIX = 'assets/';
|
|
24
|
+
/**
|
|
25
|
+
* Unpack the archive; a non-ZIP input is a hard error carrying the original
|
|
26
|
+
* failure as `cause`. Caps violations keep `io/zip.ts`'s wording.
|
|
27
|
+
*/
|
|
28
|
+
function unzipMembers(bytes, caps) {
|
|
29
|
+
try {
|
|
30
|
+
return readZipEntries(bytes, caps);
|
|
31
|
+
}
|
|
32
|
+
catch (e) {
|
|
33
|
+
const inner = (e instanceof Error ? e.message : String(e)).replace(/^zip read failed: /, '');
|
|
34
|
+
const err = new Error(`[fai-zip] cannot open container as ZIP: ${inner}`);
|
|
35
|
+
err.cause = e;
|
|
36
|
+
throw err;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/** Normalize a manifest field error into one message naming the offending value. */
|
|
40
|
+
function manifestError(reason, value) {
|
|
41
|
+
const shown = value === undefined ? '' : ` (observed: ${JSON.stringify(value)})`;
|
|
42
|
+
return new Error(`[fai-zip] invalid manifest: ${reason}${shown}`);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Read and validate the container manifest from already-unpacked members.
|
|
46
|
+
* @param members the unpacked container members
|
|
47
|
+
* @returns the validated manifest
|
|
48
|
+
*/
|
|
49
|
+
function readManifestFrom(members) {
|
|
50
|
+
const raw = members.get('manifest.json');
|
|
51
|
+
if (raw === undefined)
|
|
52
|
+
throw new Error('[fai-zip] invalid manifest: missing manifest.json — not a .fai.zip container');
|
|
53
|
+
let parsed;
|
|
54
|
+
try {
|
|
55
|
+
parsed = JSON.parse(decodeMemberText(raw));
|
|
56
|
+
}
|
|
57
|
+
catch (e) {
|
|
58
|
+
throw new Error(`[fai-zip] invalid manifest: manifest.json is not valid JSON: ${e instanceof Error ? e.message : String(e)}`, { cause: e });
|
|
59
|
+
}
|
|
60
|
+
if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) {
|
|
61
|
+
throw manifestError('manifest.json must be a JSON object');
|
|
62
|
+
}
|
|
63
|
+
const manifest = parsed;
|
|
64
|
+
if (manifest.format !== 3) {
|
|
65
|
+
throw manifestError('format must be the integer 3 (this revision); no other value is interpretable', manifest.format);
|
|
66
|
+
}
|
|
67
|
+
if (manifest.units !== 'mm') {
|
|
68
|
+
throw manifestError('units must be "mm"', manifest.units);
|
|
69
|
+
}
|
|
70
|
+
if (!Array.isArray(manifest.models) || manifest.models.length === 0) {
|
|
71
|
+
throw manifestError('models must be a non-empty array', manifest.models);
|
|
72
|
+
}
|
|
73
|
+
const models = manifest.models;
|
|
74
|
+
const seenIds = new Set();
|
|
75
|
+
const seenEntries = new Set();
|
|
76
|
+
const normalized = [];
|
|
77
|
+
for (let i = 0; i < models.length; i++) {
|
|
78
|
+
const m = models[i];
|
|
79
|
+
if (typeof m !== 'object' || m === null || Array.isArray(m)) {
|
|
80
|
+
throw manifestError(`models[${i}] must be an object`, m);
|
|
81
|
+
}
|
|
82
|
+
const rec = m;
|
|
83
|
+
const id = typeof rec.id === 'string' ? rec.id : '';
|
|
84
|
+
if (id === '')
|
|
85
|
+
throw manifestError(`models[${i}].id must be a non-empty string`, rec.id);
|
|
86
|
+
if (id.includes('/') || id.includes('\\'))
|
|
87
|
+
throw manifestError(`models[${i}].id must not contain "/" or "\\"`, id);
|
|
88
|
+
if (seenIds.has(id))
|
|
89
|
+
throw manifestError('models[].id must be unique', id);
|
|
90
|
+
seenIds.add(id);
|
|
91
|
+
const entry = typeof rec.entry === 'string' ? rec.entry : '';
|
|
92
|
+
if (entry === '')
|
|
93
|
+
throw manifestError(`models[${i}].entry must be a non-empty string`, rec.entry);
|
|
94
|
+
assertModelMemberPath(entry, `models[${i}].entry`);
|
|
95
|
+
if (seenEntries.has(entry))
|
|
96
|
+
throw manifestError('models[].entry must be unique', entry);
|
|
97
|
+
seenEntries.add(entry);
|
|
98
|
+
if (!members.has(entry)) {
|
|
99
|
+
throw manifestError(`models[${i}].entry does not exist in the container`, entry);
|
|
100
|
+
}
|
|
101
|
+
const data = typeof rec.data === 'string' ? rec.data : undefined;
|
|
102
|
+
if (data !== undefined) {
|
|
103
|
+
assertSafeMemberPath(data, `models[${i}].data`);
|
|
104
|
+
if (!members.has(data)) {
|
|
105
|
+
throw manifestError(`models[${i}].data names a member that does not exist`, data);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
normalized.push({
|
|
109
|
+
id,
|
|
110
|
+
entry,
|
|
111
|
+
...(typeof rec.label === 'string' ? { label: rec.label } : {}),
|
|
112
|
+
...(data !== undefined ? { data } : {}),
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
let active;
|
|
116
|
+
if (manifest.active !== undefined) {
|
|
117
|
+
if (typeof manifest.active !== 'string' || !seenIds.has(manifest.active)) {
|
|
118
|
+
throw manifestError('active must equal some models[].id', manifest.active);
|
|
119
|
+
}
|
|
120
|
+
active = manifest.active;
|
|
121
|
+
}
|
|
122
|
+
return {
|
|
123
|
+
format: 3,
|
|
124
|
+
units: 'mm',
|
|
125
|
+
models: normalized,
|
|
126
|
+
...(active !== undefined ? { active } : {}),
|
|
127
|
+
...(typeof manifest.createdAt === 'string' ? { createdAt: manifest.createdAt } : {}),
|
|
128
|
+
...(typeof manifest.appVersion === 'string' ? { appVersion: manifest.appVersion } : {}),
|
|
129
|
+
...(typeof manifest.label === 'string' ? { label: manifest.label } : {}),
|
|
130
|
+
...(typeof manifest.source === 'object' && manifest.source !== null ? { source: manifest.source } : {}),
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Collect the payload bytes of already-unpacked members.
|
|
135
|
+
* Keys are unique across `files/**` and `assets/**` together (spec §7.1);
|
|
136
|
+
* a duplicate key is an error rather than a pick.
|
|
137
|
+
* @param members the unpacked container members
|
|
138
|
+
* @returns the payload entries keyed by asset key
|
|
139
|
+
*/
|
|
140
|
+
function readAssetEntriesFrom(members) {
|
|
141
|
+
const files = {};
|
|
142
|
+
const assets = {};
|
|
143
|
+
const claimed = new Set();
|
|
144
|
+
for (const [path, body] of members) {
|
|
145
|
+
const prefix = path.startsWith(FILES_PREFIX)
|
|
146
|
+
? FILES_PREFIX
|
|
147
|
+
: path.startsWith(ASSETS_PREFIX)
|
|
148
|
+
? ASSETS_PREFIX
|
|
149
|
+
: undefined;
|
|
150
|
+
if (prefix === undefined)
|
|
151
|
+
continue;
|
|
152
|
+
const key = assetKeyOf(path, prefix);
|
|
153
|
+
if (claimed.has(key))
|
|
154
|
+
throw new Error(`[fai-zip] duplicate asset key across files//assets/: "${key}"`);
|
|
155
|
+
claimed.add(key);
|
|
156
|
+
if (prefix === FILES_PREFIX)
|
|
157
|
+
files[key] = body;
|
|
158
|
+
else
|
|
159
|
+
assets[key] = body;
|
|
160
|
+
}
|
|
161
|
+
return { files, assets };
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Read and validate the container manifest (spec §4).
|
|
165
|
+
* @param bytes the .fai.zip archive bytes
|
|
166
|
+
* @returns the validated manifest
|
|
167
|
+
* @throws when the archive is not a ZIP, the manifest is missing/malformed,
|
|
168
|
+
* `format !== 3`, `units !== "mm"`, `models` is empty/malformed, ids/entries
|
|
169
|
+
* are duplicated, an entry is not under `model/` or does not exist, `active`
|
|
170
|
+
* is not in `models[].id`, or a named `data` member does not exist.
|
|
171
|
+
*/
|
|
172
|
+
export function readManifest(bytes) {
|
|
173
|
+
return readManifestFrom(unzipMembers(bytes));
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* List the container models (validated). Same validation as readManifest.
|
|
177
|
+
* @param bytes the .fai.zip archive bytes
|
|
178
|
+
* @returns the validated model list
|
|
179
|
+
*/
|
|
180
|
+
export function listModels(bytes) {
|
|
181
|
+
return readManifest(bytes).models;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* List every module under `model/` (keys relative to `model/`, sorted).
|
|
185
|
+
* Members outside the table are ignored (§3), never an error.
|
|
186
|
+
* @param bytes the .fai.zip archive bytes
|
|
187
|
+
* @returns module keys relative to `model/`, sorted
|
|
188
|
+
*/
|
|
189
|
+
export function listModules(bytes) {
|
|
190
|
+
return listModulesFrom(unzipMembers(bytes));
|
|
191
|
+
}
|
|
192
|
+
/** Module keys (relative to `model/`, sorted) of already-unpacked members. */
|
|
193
|
+
function listModulesFrom(members) {
|
|
194
|
+
const keys = [];
|
|
195
|
+
for (const path of members.keys()) {
|
|
196
|
+
if (path.startsWith(MODEL_PREFIX) && path.endsWith('.fai.js') && path.length > MODEL_PREFIX.length) {
|
|
197
|
+
keys.push(path.slice(MODEL_PREFIX.length));
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return keys.sort();
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Read one module's source text by module key (relative to `model/`).
|
|
204
|
+
* @param bytes the .fai.zip archive bytes
|
|
205
|
+
* @param key the module key relative to `model/` (e.g. `main.fai.js`)
|
|
206
|
+
* @returns the module source text
|
|
207
|
+
* @throws for a key outside `model/` or that does not exist
|
|
208
|
+
*/
|
|
209
|
+
export function readModule(bytes, key) {
|
|
210
|
+
if (typeof key !== 'string' || key === '') {
|
|
211
|
+
throw new Error('[fai-zip] readModule: key must be a non-empty string');
|
|
212
|
+
}
|
|
213
|
+
assertSafeMemberPath(key, 'readModule key');
|
|
214
|
+
if (!key.endsWith('.fai.js')) {
|
|
215
|
+
throw new Error(`[fai-zip] readModule: key must name a module under model/ (ends with .fai.js): "${key}"`);
|
|
216
|
+
}
|
|
217
|
+
const member = unzipMembers(bytes).get(MODEL_PREFIX + key);
|
|
218
|
+
if (member === undefined) {
|
|
219
|
+
throw new Error(`[fai-zip] readModule: module "${key}" does not exist under model/`);
|
|
220
|
+
}
|
|
221
|
+
return decodeMemberText(member);
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Read one model data member's JSON text by member path (e.g. `data/main.json`).
|
|
225
|
+
*
|
|
226
|
+
* The path must be exactly what `models[].data` declares (spec §4): a safe,
|
|
227
|
+
* relative member under `data/` ending with `.json`. Content is validated to
|
|
228
|
+
* parse as JSON — the editor keeps data members pure JSON (§6.1), so a
|
|
229
|
+
* non-JSON member is a format violation and an error, never a silent skip.
|
|
230
|
+
*
|
|
231
|
+
* @param bytes the .fai.zip archive bytes
|
|
232
|
+
* @param memberPath the member path named by `models[].data`
|
|
233
|
+
* @returns the raw JSON text
|
|
234
|
+
* @throws for a non-string/unsafe path, a path outside `data/`, a missing
|
|
235
|
+
* member, or content that does not parse as JSON
|
|
236
|
+
*/
|
|
237
|
+
export function readDataMember(bytes, memberPath) {
|
|
238
|
+
if (typeof memberPath !== 'string' || memberPath === '') {
|
|
239
|
+
throw new Error('[fai-zip] readDataMember: memberPath must be a non-empty string');
|
|
240
|
+
}
|
|
241
|
+
assertDataMemberPath(memberPath, 'readDataMember path');
|
|
242
|
+
const member = unzipMembers(bytes).get(memberPath);
|
|
243
|
+
if (member === undefined) {
|
|
244
|
+
throw new Error(`[fai-zip] readDataMember: member "${memberPath}" does not exist in the container`);
|
|
245
|
+
}
|
|
246
|
+
const text = decodeMemberText(member);
|
|
247
|
+
try {
|
|
248
|
+
JSON.parse(text);
|
|
249
|
+
}
|
|
250
|
+
catch (e) {
|
|
251
|
+
throw new Error(`[fai-zip] readDataMember: "${memberPath}" is not valid JSON: ${e instanceof Error ? e.message : String(e)}`, { cause: e });
|
|
252
|
+
}
|
|
253
|
+
return text;
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Collect the payload bytes of a container.
|
|
257
|
+
* Keys are unique across `files/**` and `assets/**` together (spec §7.1);
|
|
258
|
+
* a duplicate key is an error rather than a pick.
|
|
259
|
+
* @param bytes the .fai.zip archive bytes
|
|
260
|
+
* @returns the payload entries keyed by asset key
|
|
261
|
+
*/
|
|
262
|
+
export function readAssetEntries(bytes) {
|
|
263
|
+
return readAssetEntriesFrom(unzipMembers(bytes));
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Host entry point: open a container and return the manifest, the active
|
|
267
|
+
* model and a ProjectLoader over its module graph, plus the payloads.
|
|
268
|
+
*
|
|
269
|
+
* The archive is unpacked exactly once for the whole call.
|
|
270
|
+
*
|
|
271
|
+
* @param bytes the .fai.zip archive bytes
|
|
272
|
+
* @param opts optional active-model override and `io/zip.ts` read caps
|
|
273
|
+
* @returns manifest, active model, project loader and payload entries
|
|
274
|
+
* @throws when the container is invalid, the requested model id is unknown, or
|
|
275
|
+
* the read caps are exceeded
|
|
276
|
+
*/
|
|
277
|
+
export function openContainer(bytes, opts = {}) {
|
|
278
|
+
const members = unzipMembers(bytes, opts.caps);
|
|
279
|
+
const manifest = readManifestFrom(members);
|
|
280
|
+
const activeModel = (() => {
|
|
281
|
+
if (opts.modelId === undefined) {
|
|
282
|
+
const byActive = manifest.models.find((m) => m.id === manifest.active);
|
|
283
|
+
return byActive ?? manifest.models[0];
|
|
284
|
+
}
|
|
285
|
+
const byParam = manifest.models.find((m) => m.id === opts.modelId);
|
|
286
|
+
if (byParam === undefined) {
|
|
287
|
+
throw new Error(`[fai-zip] openContainer: model "${opts.modelId}" is not in models[]`);
|
|
288
|
+
}
|
|
289
|
+
return byParam;
|
|
290
|
+
})();
|
|
291
|
+
const keys = listModulesFrom(members);
|
|
292
|
+
const loader = {
|
|
293
|
+
listModules: () => [...keys],
|
|
294
|
+
readSource: async (moduleKey) => {
|
|
295
|
+
const member = members.get(MODEL_PREFIX + moduleKey);
|
|
296
|
+
if (member === undefined) {
|
|
297
|
+
throw new Error(`[fai-zip] loader: module "${moduleKey}" does not exist under model/`);
|
|
298
|
+
}
|
|
299
|
+
return decodeMemberText(member);
|
|
300
|
+
},
|
|
301
|
+
};
|
|
302
|
+
const { files, assets } = readAssetEntriesFrom(members);
|
|
303
|
+
return { manifest, activeModel, loader, files, assets };
|
|
304
|
+
}
|
|
305
|
+
//# sourceMappingURL=container-read.js.map
|