@things-factory/figure-service 10.1.208 → 10.1.212
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 +1 -1
- package/dist-server/service/figure/event-subscriber.js +2 -2
- package/dist-server/service/figure/event-subscriber.js.map +1 -1
- package/dist-server/service/figure/figure-context.d.ts +2 -1
- package/dist-server/service/figure/figure-context.js +2 -1
- package/dist-server/service/figure/figure-context.js.map +1 -1
- package/dist-server/service/figure/figure-format.js +1 -1
- package/dist-server/service/figure/figure-format.js.map +1 -1
- package/dist-server/service/figure/figure-mutation.d.ts +5 -5
- package/dist-server/service/figure/figure-mutation.js +6 -6
- package/dist-server/service/figure/figure-mutation.js.map +1 -1
- package/dist-server/service/figure/figure-query.d.ts +3 -3
- package/dist-server/service/figure/figure-query.js +4 -4
- package/dist-server/service/figure/figure-query.js.map +1 -1
- package/dist-server/service/figure/figure-rename.d.ts +4 -4
- package/dist-server/service/figure/figure-rename.js +2 -2
- package/dist-server/service/figure/figure-rename.js.map +1 -1
- package/dist-server/service/figure/figure-tools.js +9 -9
- package/dist-server/service/figure/figure-tools.js.map +1 -1
- package/dist-server/service/figure/figure-type.d.ts +2 -2
- package/dist-server/service/figure/figure-type.js +2 -2
- package/dist-server/service/figure/figure-type.js.map +1 -1
- package/dist-server/service/figure/figure.d.ts +2 -2
- package/dist-server/service/figure/figure.js +1 -1
- package/dist-server/service/figure/figure.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -7
- package/recipes/_lib/model.mts +12 -8
- package/recipes/air-cylinder/models/default.json +1 -1
- package/recipes/air-cylinder/recipe.json +13 -10
- package/recipes/air-cylinder/spec.json +1 -1
- package/recipes/air-shower/models/default.json +1 -1
- package/recipes/air-shower/recipe.json +11 -8
- package/recipes/barrier-gate/models/default.json +1 -1
- package/recipes/barrier-gate/recipe.json +11 -7
- package/recipes/base-frame/models/default.json +1 -1
- package/recipes/base-frame/recipe.json +0 -4
- package/recipes/belt-surface/guide.ko.md +1 -1
- package/recipes/belt-surface/models/default.json +1 -1
- package/recipes/belt-surface/recipe.json +0 -1
- package/recipes/bin-row/models/default.json +1 -1
- package/recipes/bin-row/recipe.json +0 -1
- package/recipes/bollard-row/models/default.json +1 -1
- package/recipes/bollard-row/recipe.json +0 -1
- package/recipes/buzzer/models/default.json +1 -1
- package/recipes/buzzer/recipe.json +0 -1
- package/recipes/cabinet-doors/build.mts +1 -1
- package/recipes/cabinet-doors/models/default.json +1 -1
- package/recipes/cabinet-doors/models/doors=1.json +1 -1
- package/recipes/cabinet-doors/models/doors=2.json +1 -1
- package/recipes/cabinet-doors/recipe.json +21 -13
- package/recipes/cable-tray/models/default.json +1 -1
- package/recipes/cable-tray/recipe.json +0 -3
- package/recipes/camera-mount/models/default.json +1 -1
- package/recipes/camera-mount/recipe.json +11 -8
- package/recipes/canopy/models/default.json +1 -1
- package/recipes/canopy/recipe.json +0 -5
- package/recipes/cart/models/default.json +1 -1
- package/recipes/cart/recipe.json +0 -12
- package/recipes/cart-handle/models/default.json +1 -1
- package/recipes/cart-handle/recipe.json +0 -3
- package/recipes/casters-four/models/default.json +1 -1
- package/recipes/casters-four/recipe.json +0 -8
- package/recipes/ceiling-rail-carriage/build.mts +1 -1
- package/recipes/ceiling-rail-carriage/models/default.json +1 -1
- package/recipes/ceiling-rail-carriage/recipe.json +19 -16
- package/recipes/chain-rails/models/default.json +1 -1
- package/recipes/chain-rails/recipe.json +0 -2
- package/recipes/charging-station/models/default.json +1 -1
- package/recipes/charging-station/recipe.json +0 -2
- package/recipes/column-row/models/default.json +1 -1
- package/recipes/column-row/recipe.json +0 -1
- package/recipes/control-cabinet/models/default.json +1 -1
- package/recipes/control-cabinet/recipe.json +11 -8
- package/recipes/conveyor-skirts/models/default.json +1 -1
- package/recipes/conveyor-skirts/recipe.json +0 -2
- package/recipes/counter-display/models/default.json +1 -1
- package/recipes/counter-display/recipe.json +0 -2
- package/recipes/dock-bumpers/models/default.json +1 -1
- package/recipes/dock-bumpers/recipe.json +0 -2
- package/recipes/dock-leveler/models/default.json +1 -1
- package/recipes/dock-leveler/recipe.json +11 -7
- package/recipes/double-hinged-door/build.mts +1 -1
- package/recipes/double-hinged-door/models/default.json +1 -1
- package/recipes/double-hinged-door/recipe.json +21 -14
- package/recipes/drawer-stack/models/default.json +1 -1
- package/recipes/drawer-stack/models/drawers=2.json +1 -1
- package/recipes/drawer-stack/models/drawers=3.json +1 -1
- package/recipes/drawer-stack/models/drawers=4.json +1 -1
- package/recipes/drawer-stack/recipe.json +99 -63
- package/recipes/drip-tray/models/default.json +1 -1
- package/recipes/drip-tray/recipe.json +0 -1
- package/recipes/duct-fan/models/default.json +1 -1
- package/recipes/duct-fan/recipe.json +11 -8
- package/recipes/emergency-stop/models/default.json +1 -1
- package/recipes/emergency-stop/recipe.json +11 -8
- package/recipes/end-covers/models/default.json +1 -1
- package/recipes/end-covers/recipe.json +0 -2
- package/recipes/ffu-row/models/default.json +1 -1
- package/recipes/ffu-row/recipe.json +0 -1
- package/recipes/fire-extinguisher/models/default.json +1 -1
- package/recipes/fire-extinguisher/recipe.json +0 -2
- package/recipes/first-aid-box/models/default.json +1 -1
- package/recipes/first-aid-box/recipe.json +0 -2
- package/recipes/floor-zone/models/default.json +1 -1
- package/recipes/floor-zone/recipe.json +0 -4
- package/recipes/folding-door/build.mts +1 -1
- package/recipes/folding-door/models/default.json +1 -1
- package/recipes/folding-door/recipe.json +21 -14
- package/recipes/fork/build.mts +1 -1
- package/recipes/fork/models/default.json +1 -1
- package/recipes/fork/recipe.json +23 -15
- package/recipes/fork/spec.json +1 -1
- package/recipes/gantry-frame/models/default.json +1 -1
- package/recipes/gantry-frame/recipe.json +0 -3
- package/recipes/gripper-2f/build.mts +1 -1
- package/recipes/gripper-2f/models/default.json +1 -1
- package/recipes/gripper-2f/recipe.json +23 -16
- package/recipes/gripper-2f/spec.json +1 -1
- package/recipes/guard-cover/models/default.json +1 -1
- package/recipes/guard-cover/recipe.json +11 -7
- package/recipes/handrail/models/default.json +1 -1
- package/recipes/handrail/recipe.json +0 -2
- package/recipes/hatch/models/default.json +1 -1
- package/recipes/hatch/recipe.json +11 -8
- package/recipes/hinged-door/build.mts +2 -3
- package/recipes/hinged-door/models/default.json +1 -1
- package/recipes/hinged-door/models/hinge=left.json +1 -1
- package/recipes/hinged-door/models/hinge=right.json +1 -1
- package/recipes/hinged-door/recipe.json +22 -15
- package/recipes/hmi-monitor/models/default.json +1 -1
- package/recipes/hmi-monitor/recipe.json +11 -8
- package/recipes/hopper/models/default.json +1 -1
- package/recipes/hopper/recipe.json +0 -2
- package/recipes/interlock-switch/models/default.json +1 -1
- package/recipes/interlock-switch/recipe.json +0 -1
- package/recipes/junction-box/models/default.json +1 -1
- package/recipes/junction-box/recipe.json +0 -1
- package/recipes/ladder/models/default.json +1 -1
- package/recipes/ladder/recipe.json +0 -3
- package/recipes/legs-four/models/default.json +1 -1
- package/recipes/legs-four/recipe.json +0 -4
- package/recipes/leveling-feet/models/default.json +1 -1
- package/recipes/leveling-feet/recipe.json +0 -4
- package/recipes/lift-updown/models/default.json +1 -1
- package/recipes/lift-updown/recipe.json +13 -9
- package/recipes/lift-updown/spec.json +1 -1
- package/recipes/light-curtain/models/default.json +1 -1
- package/recipes/light-curtain/recipe.json +0 -2
- package/recipes/limit-switch/models/default.json +1 -1
- package/recipes/limit-switch/recipe.json +11 -8
- package/recipes/linear-guide/build.mts +1 -1
- package/recipes/linear-guide/models/default.json +1 -1
- package/recipes/linear-guide/recipe.json +19 -16
- package/recipes/locker-row/models/default.json +1 -1
- package/recipes/locker-row/recipe.json +0 -1
- package/recipes/motor-box/models/default.json +1 -1
- package/recipes/motor-box/recipe.json +0 -1
- package/recipes/observation-window/models/default.json +1 -1
- package/recipes/observation-window/recipe.json +0 -2
- package/recipes/operator-panel/models/buttons=2.json +1 -1
- package/recipes/operator-panel/models/buttons=3.json +1 -1
- package/recipes/operator-panel/models/buttons=4.json +1 -1
- package/recipes/operator-panel/models/buttons=5.json +1 -1
- package/recipes/operator-panel/models/default.json +1 -1
- package/recipes/operator-panel/recipe.json +0 -5
- package/recipes/pallet/models/default.json +1 -1
- package/recipes/pallet/recipe.json +0 -4
- package/recipes/partition-wall/models/default.json +1 -1
- package/recipes/partition-wall/recipe.json +0 -3
- package/recipes/pass-box/models/default.json +1 -1
- package/recipes/pass-box/recipe.json +11 -8
- package/recipes/peg-board/models/default.json +1 -1
- package/recipes/peg-board/recipe.json +0 -2
- package/recipes/photo-sensor-pair/models/default.json +1 -1
- package/recipes/photo-sensor-pair/recipe.json +0 -2
- package/recipes/pipe-run/models/default.json +1 -1
- package/recipes/pipe-run/recipe.json +0 -1
- package/recipes/platform/models/default.json +1 -1
- package/recipes/platform/recipe.json +0 -5
- package/recipes/power-box/models/default.json +1 -1
- package/recipes/power-box/recipe.json +0 -1
- package/recipes/pressure-gauge/models/default.json +1 -1
- package/recipes/pressure-gauge/recipe.json +0 -1
- package/recipes/pull-cord/models/default.json +1 -1
- package/recipes/pull-cord/recipe.json +0 -1
- package/recipes/pump/models/default.json +1 -1
- package/recipes/pump/recipe.json +0 -2
- package/recipes/pusher/build.mts +1 -1
- package/recipes/pusher/models/default.json +1 -1
- package/recipes/pusher/recipe.json +19 -15
- package/recipes/robot-plinth/models/default.json +1 -1
- package/recipes/robot-plinth/recipe.json +0 -2
- package/recipes/roll-up-shutter/build.mts +1 -1
- package/recipes/roll-up-shutter/models/default.json +1 -1
- package/recipes/roll-up-shutter/recipe.json +19 -16
- package/recipes/roller-row/facts.md +1 -1
- package/recipes/roller-row/guide.ko.md +1 -1
- package/recipes/roller-row/models/default.json +1 -1
- package/recipes/roller-row/recipe.json +11 -7
- package/recipes/room-shell/models/default.json +1 -1
- package/recipes/room-shell/recipe.json +0 -5
- package/recipes/rotating-beacon/models/default.json +1 -1
- package/recipes/rotating-beacon/recipe.json +11 -9
- package/recipes/safety-fence/models/default.json +1 -1
- package/recipes/safety-fence/recipe.json +0 -2
- package/recipes/safety-mat/models/default.json +1 -1
- package/recipes/safety-mat/recipe.json +0 -1
- package/recipes/safety-sign-stand/models/default.json +1 -1
- package/recipes/safety-sign-stand/recipe.json +0 -3
- package/recipes/scanner-mount/models/default.json +1 -1
- package/recipes/scanner-mount/recipe.json +0 -3
- package/recipes/selector-switch/models/default.json +1 -1
- package/recipes/selector-switch/recipe.json +11 -8
- package/recipes/shelf-tiers/models/default.json +1 -1
- package/recipes/shelf-tiers/models/tiers=2.json +1 -1
- package/recipes/shelf-tiers/models/tiers=3.json +1 -1
- package/recipes/shelf-tiers/models/tiers=4.json +1 -1
- package/recipes/shelf-tiers/models/tiers=5.json +1 -1
- package/recipes/shelf-tiers/recipe.json +0 -4
- package/recipes/side-guides/models/default.json +1 -1
- package/recipes/side-guides/recipe.json +0 -2
- package/recipes/sign-board/models/default.json +1 -1
- package/recipes/sign-board/recipe.json +0 -1
- package/recipes/signal-tower-3/build.mts +1 -1
- package/recipes/signal-tower-3/models/default.json +1 -1
- package/recipes/signal-tower-3/recipe.json +11 -10
- package/recipes/sliding-door/build.mts +4 -7
- package/recipes/sliding-door/facts.md +1 -1
- package/recipes/sliding-door/guide.ko.md +1 -1
- package/recipes/sliding-door/models/default.json +1 -1
- package/recipes/sliding-door/models/leaves=1,lamp=false.json +1 -1
- package/recipes/sliding-door/models/leaves=1,lamp=true.json +1 -1
- package/recipes/sliding-door/models/leaves=2,lamp=false.json +1 -1
- package/recipes/sliding-door/models/leaves=2,lamp=true.json +1 -1
- package/recipes/sliding-door/recipe.json +48 -38
- package/recipes/stairs/models/default.json +1 -1
- package/recipes/stairs/recipe.json +0 -1
- package/recipes/status-lamp/models/default.json +1 -1
- package/recipes/status-lamp/recipe.json +11 -9
- package/recipes/stopper/models/default.json +1 -1
- package/recipes/stopper/recipe.json +11 -7
- package/recipes/suction-pads/models/default.json +1 -1
- package/recipes/suction-pads/recipe.json +0 -1
- package/recipes/tank/models/default.json +1 -1
- package/recipes/tank/recipe.json +0 -1
- package/recipes/telescopic-arm/build.mts +1 -1
- package/recipes/telescopic-arm/models/default.json +1 -1
- package/recipes/telescopic-arm/recipe.json +21 -13
- package/recipes/toe-board/models/default.json +1 -1
- package/recipes/toe-board/recipe.json +0 -1
- package/recipes/tote/models/default.json +1 -1
- package/recipes/tote/recipe.json +0 -1
- package/recipes/traffic-cones/models/default.json +1 -1
- package/recipes/traffic-cones/recipe.json +0 -2
- package/recipes/transfer-belts/build.mts +1 -1
- package/recipes/transfer-belts/models/default.json +1 -1
- package/recipes/transfer-belts/recipe.json +23 -15
- package/recipes/transfer-belts/spec.json +1 -1
- package/recipes/tray-stack/models/default.json +1 -1
- package/recipes/tray-stack/models/trays=3.json +1 -1
- package/recipes/tray-stack/models/trays=4.json +1 -1
- package/recipes/tray-stack/models/trays=5.json +1 -1
- package/recipes/tray-stack/recipe.json +0 -5
- package/recipes/trough/models/default.json +1 -1
- package/recipes/trough/recipe.json +0 -1
- package/recipes/turntable/models/default.json +1 -1
- package/recipes/turntable/recipe.json +11 -8
- package/recipes/valve-handle/models/default.json +1 -1
- package/recipes/valve-handle/recipe.json +11 -9
- package/recipes/waste-bin/models/default.json +1 -1
- package/recipes/waste-bin/recipe.json +0 -1
- package/recipes/work-light/models/default.json +1 -1
- package/recipes/work-light/recipe.json +11 -9
- package/recipes/workbench-top/models/default.json +1 -1
- package/recipes/workbench-top/recipe.json +0 -1
- package/server/service/figure/catalog-db.test.ts +1 -1
- package/server/service/figure/event-subscriber.ts +2 -2
- package/server/service/figure/figure-blueprint-query.test.ts +3 -3
- package/server/service/figure/figure-context.test.ts +3 -3
- package/server/service/figure/figure-context.ts +4 -2
- package/server/service/figure/figure-format.test.ts +7 -7
- package/server/service/figure/figure-format.ts +1 -1
- package/server/service/figure/figure-llm-smoke.test.ts +1 -1
- package/server/service/figure/figure-mutation.ts +6 -6
- package/server/service/figure/figure-propose-clips.test.ts +1 -1
- package/server/service/figure/figure-propose-steps.test.ts +2 -2
- package/server/service/figure/figure-query.ts +4 -4
- package/server/service/figure/figure-release-record-db.test.ts +3 -3
- package/server/service/figure/figure-rename-db.test.ts +2 -2
- package/server/service/figure/figure-rename.test.ts +3 -3
- package/server/service/figure/figure-rename.ts +6 -6
- package/server/service/figure/figure-subject.test.ts +1 -1
- package/server/service/figure/figure-tools.test.ts +19 -19
- package/server/service/figure/figure-tools.ts +9 -9
- package/server/service/figure/figure-type.ts +2 -2
- package/server/service/figure/figure.ts +2 -2
- package/translations/ko.json +31 -31
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
저작된 3D 컴포넌트 한 종류(**Figure**)를 저장·검증·조회한다. 컴포넌트 저작도구의
|
|
4
4
|
서버 몫이고, 화면 몫은 `@things-factory/figure-ui` 다.
|
|
5
5
|
|
|
6
|
-
## 무엇을 담나 —
|
|
6
|
+
## 무엇을 담나 — 피규어 자산이다
|
|
7
7
|
|
|
8
8
|
형식은 `@hatiolab/figure-model` 이 정한다(`figure-asset-1`). **씬 컴포넌트 트리를 담지 않는다.**
|
|
9
9
|
컴파일한 것도 저장하지 않는다 — 원본에서 파생되므로 소비하는 쪽이 커널로 컴파일한다.
|
|
@@ -9,14 +9,14 @@ const figure_history_js_1 = require("./figure-history.js");
|
|
|
9
9
|
/**
|
|
10
10
|
* 판본을 남긴다 — **발행된 저장에만.**
|
|
11
11
|
*
|
|
12
|
-
* `@operato/typeorm-history` 는 원래 모든 저장을 베낀다. 그런데
|
|
12
|
+
* `@operato/typeorm-history` 는 원래 모든 저장을 베낀다. 그런데 피규어는 저작 중에 수십 번 저장되고,
|
|
13
13
|
* 그 전부를 남기면 판본 목록이 「내가 오늘 몇 번 눌렀나」가 된다. 사람이 판이라고 부르는 것은
|
|
14
14
|
* **발행한 것**이므로 그때만 베낀다. board 가 같은 규칙으로 돈다(`board-service` 의 같은 이름 파일).
|
|
15
15
|
*
|
|
16
16
|
* 발행판의 정본(`__releaseSource`)은 크기 범위를 적은 발행판 사본이다 — Figure 행에는 작성자가 좁힌 끝만 남는다.
|
|
17
17
|
*
|
|
18
18
|
* 발행 메모는 Figure 의 칸이 아니다. `releaseFigure` 가 저장할 엔티티에 `__releaseComment` 로 얹어
|
|
19
|
-
* 두면 여기서 판본의 `comment` 로 옮긴다 — 메모는 그 판의 것이지
|
|
19
|
+
* 두면 여기서 판본의 `comment` 로 옮긴다 — 메모는 그 판의 것이지 피규어의 것이 아니다. 정본 형식
|
|
20
20
|
* (`__releaseFormat`), 잰 커널의 판(`__releaseKernel`, ADR-0109 C1), 직전 판에 견준 변경(`__releaseChanges`), 발행 때 잰 값(`__releaseMetrics`)과
|
|
21
21
|
* 윗모습(`__releaseTopView`)도 같은 길로 옮긴다(ADR-0104).
|
|
22
22
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-subscriber.js","sourceRoot":"","sources":["../../../server/service/figure/event-subscriber.ts"],"names":[],"mappings":";;;;AAAA,qCAAyC;AAEzC,8DAAkE;AAElE,2CAAoC;AACpC,2DAAmD;AAEnD;;;;;;;;;;;;;GAaG;AACH,4FAA4F;AAC5F,SAAS,iBAAiB,CAAC,OAAsB,EAAE,MAAc;IAC/D,MAAM,CAAC,GAAG,MAAa,CAAA;IACvB,+GAA+G;IAC/G,IAAI,CAAC,CAAC,eAAe;QAAE,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,eAAe,CACxD;IAAC,OAAe,CAAC,OAAO,GAAG,CAAC,CAAC,gBAAgB,IAAI,IAAI,CAAA;IACtD,OAAO,CAAC,WAAW,GAAG,CAAC,CAAC,eAAe,IAAI,IAAI,CAAA;IAC/C,OAAO,CAAC,aAAa,GAAG,CAAC,CAAC,eAAe,IAAI,IAAI,CAAA;IACjD,sEAAsE;IACtE,OAAO,CAAC,OAAO,GAAG,CAAC,CAAC,gBAAgB,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAA;IACxF,OAAO,CA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riber } from '@operato/typeorm-history'\n\nimport { Figure } from './figure.js'\nimport { FigureHistory } from './figure-history.js'\n\n/**\n * 판본을 남긴다 — **발행된 저장에만.**\n *\n * `@operato/typeorm-history` 는 원래 모든 저장을 베낀다. 그런데
|
|
1
|
+
{"version":3,"file":"event-subscriber.js","sourceRoot":"","sources":["../../../server/service/figure/event-subscriber.ts"],"names":[],"mappings":";;;;AAAA,qCAAyC;AAEzC,8DAAkE;AAElE,2CAAoC;AACpC,2DAAmD;AAEnD;;;;;;;;;;;;;GAaG;AACH,4FAA4F;AAC5F,SAAS,iBAAiB,CAAC,OAAsB,EAAE,MAAc;IAC/D,MAAM,CAAC,GAAG,MAAa,CAAA;IACvB,+GAA+G;IAC/G,IAAI,CAAC,CAAC,eAAe;QAAE,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,eAAe,CACxD;IAAC,OAAe,CAAC,OAAO,GAAG,CAAC,CAAC,gBAAgB,IAAI,IAAI,CAAA;IACtD,OAAO,CAAC,WAAW,GAAG,CAAC,CAAC,eAAe,IAAI,IAAI,CAAA;IAC/C,OAAO,CAAC,aAAa,GAAG,CAAC,CAAC,eAAe,IAAI,IAAI,CAAA;IACjD,sEAAsE;IACtE,OAAO,CAAC,OAAO,GAAG,CAAC,CAAC,gBAAgB,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAA;IACxF,OAAO,CAAC,OAAO,GAAG,CAAC,CAAC,gBAAgB,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAA;IACxF,OAAO,CAAC,OAAO,GAAG,CAAC,CAAC,gBAAgB,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAA;IACxF,OAAO,OAAO,CAAA;AAChB,CAAC;AAGM,IAAM,6BAA6B,GAAnC,MAAM,6BAA8B,SAAQ,yCAA8C;IAC/F,IAAW,MAAM;QACf,OAAO,kBAAM,CAAA;IACf,CAAC;IAED,IAAW,aAAa;QACtB,OAAO,iCAAa,CAAA;IACtB,CAAC;IAEM,mBAAmB,CAAC,OAAsB,EAAE,MAAc;QAC/D,OAAO,iBAAiB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;IAC3C,CAAC;IAEM,mBAAmB,CAAC,OAAsB,EAAE,MAAc;QAC/D,OAAO,iBAAiB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;IAC3C,CAAC;IAEM,KAAK,CAAC,WAAW,CAAC,KAAU;QACjC,IAAI,KAAK,CAAC,MAAM,EAAE,KAAK,IAAI,UAAU,EAAE,CAAC;YACtC,MAAM,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAA;QAChC,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,WAAW,CAAC,KAAU;QACjC,IAAI,KAAK,CAAC,MAAM,EAAE,KAAK,IAAI,UAAU,EAAE,CAAC;YACtC,MAAM,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAA;QAChC,CAAC;IACH,CAAC;CACF,CAAA;AA5BY,sEAA6B;wCAA7B,6BAA6B;IADzC,IAAA,yBAAe,GAAE;GACL,6BAA6B,CA4BzC","sourcesContent":["import { EventSubscriber } from 'typeorm'\n\nimport { HistoryEntitySubscriber } from '@operato/typeorm-history'\n\nimport { Figure } from './figure.js'\nimport { FigureHistory } from './figure-history.js'\n\n/**\n * 판본을 남긴다 — **발행된 저장에만.**\n *\n * `@operato/typeorm-history` 는 원래 모든 저장을 베낀다. 그런데 피규어는 저작 중에 수십 번 저장되고,\n * 그 전부를 남기면 판본 목록이 「내가 오늘 몇 번 눌렀나」가 된다. 사람이 판이라고 부르는 것은\n * **발행한 것**이므로 그때만 베낀다. board 가 같은 규칙으로 돈다(`board-service` 의 같은 이름 파일).\n *\n * 발행판의 정본(`__releaseSource`)은 크기 범위를 적은 발행판 사본이다 — Figure 행에는 작성자가 좁힌 끝만 남는다.\n *\n * 발행 메모는 Figure 의 칸이 아니다. `releaseFigure` 가 저장할 엔티티에 `__releaseComment` 로 얹어\n * 두면 여기서 판본의 `comment` 로 옮긴다 — 메모는 그 판의 것이지 피규어의 것이 아니다. 정본 형식\n * (`__releaseFormat`), 잰 커널의 판(`__releaseKernel`, ADR-0109 C1), 직전 판에 견준 변경(`__releaseChanges`), 발행 때 잰 값(`__releaseMetrics`)과\n * 윗모습(`__releaseTopView`)도 같은 길로 옮긴다(ADR-0104).\n */\n/** What `releaseFigure` laid on the entity for this release, moved onto the history row. */\nfunction releaseRecordOnto(history: FigureHistory, entity: Figure): FigureHistory {\n const e = entity as any\n /* What a board reads of this release: its own copy, with the size range written down (ADR-0087 decision 6). */\n if (e.__releaseSource) history.source = e.__releaseSource\n ;(history as any).comment = e.__releaseComment ?? null\n history.assetFormat = e.__releaseFormat ?? null\n history.kernelVersion = e.__releaseKernel ?? null\n /* [] stays \"[]\" (nothing changed); null stays null (not compared). */\n history.changes = e.__releaseChanges == null ? null : JSON.stringify(e.__releaseChanges)\n history.metrics = e.__releaseMetrics == null ? null : JSON.stringify(e.__releaseMetrics)\n history.topView = e.__releaseTopView == null ? null : JSON.stringify(e.__releaseTopView)\n return history\n}\n\n@EventSubscriber()\nexport class FigureHistoryEntitySubscriber extends HistoryEntitySubscriber<Figure, FigureHistory> {\n public get entity() {\n return Figure\n }\n\n public get historyEntity() {\n return FigureHistory\n }\n\n public beforeInsertHistory(history: FigureHistory, entity: Figure): FigureHistory {\n return releaseRecordOnto(history, entity)\n }\n\n public beforeUpdateHistory(history: FigureHistory, entity: Figure): FigureHistory {\n return releaseRecordOnto(history, entity)\n }\n\n public async afterInsert(event: any): Promise<void> {\n if (event.entity?.state == 'released') {\n await super.afterInsert(event)\n }\n }\n\n public async afterUpdate(event: any): Promise<void> {\n if (event.entity?.state == 'released') {\n await super.afterUpdate(event)\n }\n }\n}\n"]}
|
|
@@ -21,9 +21,10 @@ export interface FigureOutlinePart {
|
|
|
21
21
|
shape?: string;
|
|
22
22
|
/** What it is fastened to: `<part>.<face>`, `mounting-plane`, or nothing when unfastened. */
|
|
23
23
|
on?: string;
|
|
24
|
+
/** Its joint, and how it moves: each axis's type in order (ADR-0159); no motion for a fastening. */
|
|
24
25
|
joint?: {
|
|
25
26
|
id: string;
|
|
26
|
-
|
|
27
|
+
motion?: string[];
|
|
27
28
|
};
|
|
28
29
|
material?: string;
|
|
29
30
|
/** How long its part read is: what reading it costs. */
|
|
@@ -102,7 +102,8 @@ function outlinePartsOf(asset) {
|
|
|
102
102
|
id,
|
|
103
103
|
...(shape ? { shape } : {}),
|
|
104
104
|
...(on ? { on } : {}),
|
|
105
|
-
|
|
105
|
+
/* How it moves: each axis of its joint in order (ADR-0159); none for a fastening. */
|
|
106
|
+
...(joint ? { joint: { id: joint.id, ...(joint.motion?.length ? { motion: joint.motion.map((m) => m.type) } : {}) } } : {}),
|
|
106
107
|
...(look.material?.token ? { material: look.material.token } : {}),
|
|
107
108
|
chars: length(figurePartReadOf(asset, id))
|
|
108
109
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"figure-context.js","sourceRoot":"","sources":["../../../server/service/figure/figure-context.ts"],"names":[],"mappings":";;;AAyHA,4CAWC;AAwED,0CAuCC;AAQD,oCA2DC;AA4ED,0CAiBC;AAoBD,gDA4BC;AApbD,oHAAoH;AACvG,QAAA,qBAAqB,GAAG,OAAO,CAAA;AAE5C,kHAAkH;AAClH,MAAM,aAAa,GAAG,6BAAqB,GAAG,CAAC,CAAA;AAE/C,qGAAqG;AACrG,MAAM,aAAa,GAAG,EAAE,CAAA;AAiExB,MAAM,MAAM,GAAG,CAAC,KAAc,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC,CAAA;AACrE,MAAM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;IACD,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,OAAO,EAAE,OAAO,IAAI,EAAE,EAAE,CAAC;QAClD,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAE,CAAA;QACzC,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,KAAK,CAAC,CAAA;IACnF,CAAC;IACD,OAAO,OAAO,CAAA;AAChB,CAAC","sourcesContent":["/**\n * What of a figure the model is shown (ADR-0061 2026-10-16 decision 4).\n *\n * The kernel keeps a figure up to 1 MiB (`FIGURE_JSON_MAX_BYTES`); that is whether the figure is valid. How much of it the\n * model reads at once is another question with its own number. A figure that fits is shown whole. One that does not is\n * shown as an outline -- its sections, and every part by name, shape and what it is fastened to -- and in full only the\n * parts and sections asked for, while they fit. A section too large for the outline is left out, named by its JSON\n * Pointer with the entries inside it, and read by pointer. The full source stays on the server: a proposal is applied\n * and judged on it, on the version the request was made on.\n *\n * A proposal on a figure shown in part changes only what it was shown: no part not read in full, and nothing inside a\n * section left out and not read. Read is what the server put before the writer, never what a model says it read.\n */\nimport type { FigureAsset, FigureProposalStep } from '@hatiolab/figure-model'\n\n/** The most of a figure, serialized, the model is shown in one read. Not a validity limit: that is the kernel's. */\nexport const FIGURE_CONTEXT_BUDGET = 100_000\n\n/** Of the budget, what the outline's sections may take; the rest is for the parts and sections read beside it. */\nconst OUTLINE_SHARE = FIGURE_CONTEXT_BUDGET / 2\n\n/** How many entries of a section left out, or pointers in a reason, are named: the largest first. */\nconst ENTRIES_NAMED = 20\n\ntype Dynamic = any\n\nexport interface FigureOutlinePart {\n id: string\n /** The operation that makes its shape (`box@1`, `extrude@1`, ...). */\n shape?: string\n /** What it is fastened to: `<part>.<face>`, `mounting-plane`, or nothing when unfastened. */\n on?: string\n joint?: { id: string; type: string }\n material?: string\n /** How long its part read is: what reading it costs. */\n chars: number\n}\n\nexport interface FigureOmittedSection {\n /** The JSON Pointer of the section left out. */\n section: string\n chars: number\n /** Its largest entries, by pointer: what to read when the whole does not fit. */\n entries?: { section: string; chars: number }[]\n}\n\nexport interface FigureOutline {\n /** The whole source's length, and the budget it does not fit. */\n chars: number\n budget: number\n parts: FigureOutlinePart[]\n /** Parts the outline had no room to list, past the ones listed. */\n partsNotListed?: number\n /** Sections left out because they would crowd the outline. */\n omitted?: FigureOmittedSection[]\n [section: string]: unknown\n}\n\nexport interface FigurePartRead {\n appearance: Dynamic\n /** The fastenings that name it: its own (body1) and its children's (body0). */\n joints: Dynamic[]\n /** The graph nodes and constants under its name: `<part>` and `<part>.*` (a part id has no dot). */\n nodes: Dynamic[]\n constants: Dynamic[]\n}\n\nexport interface FigureReadRequest {\n parts?: readonly string[]\n /** JSON Pointers (RFC 6901) into the source, such as `/document/capabilities/bindings/0`. */\n sections?: readonly string[]\n}\n\nexport interface FigureView {\n whole: boolean\n /** Whole: the source as it is. */\n source?: FigureAsset\n outline?: FigureOutline\n /** The parts shown in full, by id, in the order asked. */\n parts?: Record<string, FigurePartRead>\n shown?: string[]\n /** The sections read, by pointer. */\n sections?: Record<string, unknown>\n /** What was asked for and not shown, with why and what to read instead. */\n notRead?: ({ part: string; reason: string } | { section: string; reason: string })[]\n}\n\nconst length = (value: unknown) => JSON.stringify(value)?.length ?? 0\nconst under = (part: string) => (id: unknown) => id === part || (typeof id === 'string' && id.startsWith(`${part}.`))\n\n/* ── JSON Pointer (RFC 6901) ─────────────────────────────────────────────────────────── */\n\nconst escapeToken = (token: string) => token.replace(/~/g, '~0').replace(/\\//g, '~1')\nconst pointerOf = (tokens: readonly (string | number)[]) => tokens.map(t => `/${escapeToken(String(t))}`).join('')\nfunction tokensOf(pointer: string): string[] | undefined {\n if (typeof pointer !== 'string' || !pointer.startsWith('/')) return undefined\n return pointer.slice(1).split('/').map(t => t.replace(/~1/g, '/').replace(/~0/g, '~'))\n}\nfunction valueAt(root: unknown, tokens: readonly string[]): { found: boolean; value?: unknown } {\n let at: Dynamic = root\n for (const token of tokens) {\n if (at === null || typeof at !== 'object' || !Object.prototype.hasOwnProperty.call(at, token)) return { found: false }\n at = at[token]\n }\n return { found: true, value: at }\n}\n/** `inner` is `outer` or inside it. */\nconst within = (inner: string, outer: string) => inner === outer || inner.startsWith(`${outer}/`)\n\n/** A value's entries by pointer, largest first, the first ENTRIES_NAMED of them. */\nfunction entriesOf(pointer: string, value: unknown): { section: string; chars: number }[] {\n if (value === null || typeof value !== 'object') return []\n const tokens = tokensOf(pointer)!\n return Object.entries(value as object)\n .map(([key, entry]) => ({ section: pointerOf([...tokens, key]), chars: length(entry) }))\n .sort((a, b) => b.chars - a.chars)\n .slice(0, ENTRIES_NAMED)\n}\n\n/* ── Parts ───────────────────────────────────────────────────────────────────────────── */\n\nexport function figurePartReadOf(asset: FigureAsset, part: string): FigurePartRead | undefined {\n const appearance = asset.appearance.find(a => a.target === part)\n if (!appearance) return undefined\n const model = asset.document.model as Dynamic\n const own = under(part)\n return {\n appearance,\n joints: ((asset as Dynamic).joints ?? []).filter((j: Dynamic) => j?.body1?.part === part || j?.body0?.part === part),\n nodes: model.nodes.filter((n: Dynamic) => own(n.id)),\n constants: model.constants.filter((c: Dynamic) => own(c.id))\n }\n}\n\n/** Where a part's records are, by pointer: for a part too large to read as one. */\nfunction partPointers(asset: FigureAsset, part: string): string[] {\n const model = asset.document.model as Dynamic\n const own = under(part)\n return [\n ...asset.appearance.flatMap((a, i) => (a.target === part ? [pointerOf(['appearance', i])] : [])),\n ...((asset as Dynamic).joints ?? []).flatMap((j: Dynamic, i: number) => (j?.body1?.part === part || j?.body0?.part === part ? [pointerOf(['joints', i])] : [])),\n ...model.nodes.flatMap((n: Dynamic, i: number) => (own(n.id) ? [pointerOf(['document', 'model', 'nodes', i])] : [])),\n ...model.constants.flatMap((c: Dynamic, i: number) => (own(c.id) ? [pointerOf(['document', 'model', 'constants', i])] : []))\n ]\n}\n\n/* ── The outline ─────────────────────────────────────────────────────────────────────── */\n\n/*\n The sections of an outline: every top-level field but the parts' records, the document's fields but its model, and the\n model's fields but its graph. Each may be left out by its pointer.\n*/\nconst PART_RECORDS = ['/document', '/appearance', '/joints', '/document/model', '/document/model/nodes', '/document/model/constants']\nfunction sectionsOf(asset: FigureAsset): string[] {\n const out: string[] = []\n const walk = (tokens: string[]) => {\n const { value } = valueAt(asset, tokens)\n for (const key of Object.keys(value as object)) {\n const pointer = pointerOf([...tokens, key])\n if (pointer === '/document' || pointer === '/document/model') walk([...tokens, key])\n else if (!PART_RECORDS.includes(pointer)) out.push(pointer)\n }\n }\n walk([])\n return out\n}\n\nfunction outlinePartsOf(asset: FigureAsset): FigureOutlinePart[] {\n const nodes = (asset.document.model as Dynamic).nodes\n const joints = (asset as Dynamic).joints ?? []\n return asset.appearance.map((look: Dynamic) => {\n const id = look.target\n const joint = joints.find((j: Dynamic) => j?.body1?.part === id)\n const body0 = joint?.body0\n const on = !joint ? undefined : body0?.part ? `${body0.part}.${body0.face}` : (body0?.plane ?? 'mounting-plane')\n const shape = nodes.find((n: Dynamic) => n.id === `${id}.shape`)?.op\n return {\n id,\n ...(shape ? { shape } : {}),\n ...(on ? { on } : {}),\n ...(joint ? { joint: { id: joint.id, type: joint.type } } : {}),\n ...(look.material?.token ? { material: look.material.token } : {}),\n chars: length(figurePartReadOf(asset, id))\n }\n })\n}\n\n/** Writes a section into the outline at its pointer, making the objects on the way. */\nfunction place(outline: Dynamic, tokens: readonly string[], value: unknown) {\n let at = outline\n tokens.slice(0, -1).forEach(token => (at = at[token] ??= {}))\n at[tokens[tokens.length - 1]!] = value\n}\n\n/**\n * What the view wraps the outline in, read or not: an outline that took the whole budget left the view over it by these\n * (53 characters, a figure of 3000 long-named parts, 2026-10-19).\n */\nconst VIEW_ENVELOPE = () => length({ whole: false, outline: {}, parts: {}, shown: [], sections: {}, notRead: [] }) - length({})\n\n/**\n * The outline: within OUTLINE_SHARE for its sections, the largest left out first; and, every field counted, within the\n * budget less what the view wraps it in -- a figure of very many parts lists them by id only, then as many as fit.\n */\nexport function figureOutlineOf(asset: FigureAsset, chars = length(asset)): FigureOutline {\n const limit = FIGURE_CONTEXT_BUDGET - VIEW_ENVELOPE()\n const model = asset.document.model as Dynamic\n const sections = sectionsOf(asset).map(pointer => ({ pointer, value: valueAt(asset, tokensOf(pointer)!).value }))\n const sized = sections.map(s => ({ ...s, chars: length(s.value) })).sort((a, b) => b.chars - a.chars)\n\n let total = sized.reduce((sum, s) => sum + s.chars, 0)\n const omitted: FigureOmittedSection[] = []\n const kept = new Set(sized.map(s => s.pointer))\n for (const s of sized) {\n if (total <= OUTLINE_SHARE) break\n kept.delete(s.pointer)\n total -= s.chars\n const entries = entriesOf(s.pointer, s.value)\n omitted.push({ section: s.pointer, chars: s.chars, ...(entries.length ? { entries } : {}) })\n }\n\n const outline: Dynamic = { chars, budget: FIGURE_CONTEXT_BUDGET }\n place(outline, ['document', 'model', 'nodes'], model.nodes.length)\n place(outline, ['document', 'model', 'constants'], model.constants.length)\n for (const s of sections) if (kept.has(s.pointer)) place(outline, tokensOf(s.pointer)!, s.value)\n if (omitted.length) outline.omitted = omitted\n\n let parts: Dynamic[] = outlinePartsOf(asset)\n outline.parts = parts\n if (length(outline) > limit) outline.parts = parts = parts.map(p => ({ id: p.id }))\n if (length(outline) > limit) {\n /* As many as fit, in part order, with how many more there are. */\n let room = limit - length({ ...outline, parts: [], partsNotListed: parts.length })\n const listed: Dynamic[] = []\n for (const p of parts) {\n room -= length(p) + 1\n if (room < 0) break\n listed.push(p)\n }\n outline.parts = listed\n outline.partsNotListed = parts.length - listed.length\n }\n return outline as FigureOutline\n}\n\n/* ── The view ────────────────────────────────────────────────────────────────────────── */\n\n/**\n * The view of a figure the model is shown: whole when it fits, else the outline and what was asked for -- parts, then\n * sections, each in the order asked -- while it fits beside it. Every field counted, the view is within the budget.\n */\nexport function figureViewOf(asset: FigureAsset, request: FigureReadRequest = {}): FigureView {\n const chars = length(asset)\n if (chars <= FIGURE_CONTEXT_BUDGET) return { whole: true, source: asset }\n\n const outline = figureOutlineOf(asset, chars)\n const view: FigureView = { whole: false, outline, parts: {}, shown: [], sections: {}, notRead: [] }\n const room = () => FIGURE_CONTEXT_BUDGET - length(view)\n const refuse = (one: { part: string; reason: string } | { section: string; reason: string }) => {\n if (length(one) + 1 <= room()) view.notRead!.push(one)\n }\n\n for (const part of [...new Set(request.parts ?? [])]) {\n const one = figurePartReadOf(asset, part)\n if (!one) {\n refuse({ part, reason: `${part} is not a part of this figure; the outline lists its parts` })\n continue\n }\n const cost = length(one) + length(part) + length(part) + 3\n view.parts![part] = one\n view.shown!.push(part)\n if (room() >= 0) continue\n delete view.parts![part]\n view.shown!.pop()\n if (cost <= FIGURE_CONTEXT_BUDGET - length(outline)) {\n refuse({ part, reason: `${part} (${cost} characters) does not fit beside what is already read; read it in another call with fewer parts or sections` })\n } else {\n const pointers = partPointers(asset, part)\n refuse({\n part,\n reason:\n `${part} (${cost} characters) is too large to show beside the outline; read its records as sections: ` +\n `${pointers.slice(0, ENTRIES_NAMED).join(', ')}${pointers.length > ENTRIES_NAMED ? ` and ${pointers.length - ENTRIES_NAMED} more` : ''}. ` +\n 'Parts read as sections are not counted as read in full: they cannot be changed'\n })\n }\n }\n\n for (const section of [...new Set(request.sections ?? [])]) {\n const tokens = tokensOf(section)\n const at = tokens && tokens.length ? valueAt(asset, tokens) : { found: false }\n if (!at.found) {\n refuse({ section, reason: `there is no section ${section}; a section is a JSON Pointer such as /document/capabilities/bindings/0` })\n continue\n }\n const cost = length(at.value) + length(section) + 2\n view.sections![section] = at.value\n if (room() >= 0) continue\n delete view.sections![section]\n const entries = entriesOf(section, at.value)\n refuse({\n section,\n reason: entries.length\n ? `${section} (${cost} characters) is too large to show at once here; read its entries: ${entries.map(e => `${e.section} (${e.chars})`).join(', ')}`\n : `${section} is one value of ${length(at.value)} characters, larger than can be shown here; it cannot be read or changed by a proposal`\n })\n }\n\n if (!view.notRead!.length) delete view.notRead\n return view\n}\n\n/* ── What a proposal may change ──────────────────────────────────────────────────────── */\n\ntype StepOf<K extends FigureProposalStep['kind']> = Extract<FigureProposalStep, { kind: K }>\ntype Subject = string | undefined\n\n/**\n * The part each kind of step changes, read from the field the kernel reads for that kind (audit D4-R1: a `part` beside a\n * `set-material`'s `target` is not read by the kernel, so it may not stand in for it). Every kind of the kernel's step\n * type is here, or this does not compile. A step that changes no one part says so with undefined: what it does to the\n * figure's sections is held by `unreadSectionEdits`.\n */\nconst SUBJECT: { [K in FigureProposalStep['kind']]: (step: StepOf<K>, base: FigureAsset) => Subject } = {\n 'add-part': () => undefined,\n 'set-section-corner': step => step.part,\n 'set-cavity': step => step.part,\n 'set-section': step => step.part,\n attach: step => step.part,\n 'link-dimension': step => step.part,\n 'follow-size': step => step.part,\n 'unlink-dimension': step => step.part,\n 'scale-position': step => step.part,\n 'fix-position': step => step.part,\n 'nudge-part': step => step.part,\n detach: step => step.part,\n 'make-repeat': step => step.part,\n 'set-repeat': step => step.part,\n 'remove-repeat': step => step.part,\n 'set-mounting-face': step => step.part,\n 'add-binding': step => step.part,\n 'set-joint': step => step.joint?.body1?.part,\n 'remove-joint': (step, base) => ((base as Dynamic).joints ?? []).find((j: Dynamic) => j?.id === step.id)?.body1?.part,\n 'set-material': step => step.target,\n 'set-segments': step => step.target,\n 'rename-part': step => step.target,\n 'set-visibility': step => step.target,\n 'remove-part': step => step.target,\n 'duplicate-part': step => step.target,\n 'move-part': step => step.target,\n 'set-placement': () => undefined,\n 'declare-instance-size': () => undefined,\n 'clear-mounting-face': () => undefined,\n 'scale-uniformly': () => undefined,\n 'follow-size-in-proportion': () => undefined,\n 'set-detail-level': () => undefined,\n 'add-design-input': () => undefined,\n 'set-input-range': () => undefined,\n 'publish-input': () => undefined,\n 'unpublish-input': () => undefined,\n 'remove-binding': () => undefined,\n 'set-slot-layout': () => undefined,\n 'remove-slot-layout': () => undefined,\n 'set-extension': () => undefined,\n rename: () => undefined,\n 'set-capabilities': () => undefined,\n 'set-state-input': () => undefined,\n 'set-state-defaults': () => undefined,\n 'set-driver': () => undefined,\n 'remove-driver': () => undefined,\n 'set-clip': () => undefined,\n 'set-motion-group': () => undefined,\n 'remove-motion-group': () => undefined,\n 'set-data-schema': () => undefined,\n 'rename-data-field': () => undefined,\n 'set-data-binding': () => undefined,\n 'remove-data-binding': () => undefined,\n 'set-status-port': () => undefined,\n 'remove-status-port': () => undefined\n}\n\n/**\n * The steps that change a part of the base not shown in full, as reasons said back to the writer. A part may still be\n * named to fasten to or to follow -- the kernel works from it, nothing about it is guessed -- and a new part is the\n * steps' own. A kind this table does not know is refused: it is not let through unjudged.\n */\nexport function unreadPartEdits(base: FigureAsset, steps: readonly FigureProposalStep[], view: FigureView): string[] {\n const existing = new Set(base.appearance.map(a => a.target))\n const shown = new Set(view.shown ?? [])\n const allowed = [...shown].join(', ') || 'none'\n return steps.flatMap((step, i) => {\n const kind = (step as Dynamic)?.kind\n if (typeof kind !== 'string') return []\n const judge = (SUBJECT as Record<string, (step: Dynamic, base: FigureAsset) => Subject>)[kind]\n if (!Object.prototype.hasOwnProperty.call(SUBJECT, kind) || !judge)\n return [`UNKNOWN_STEP: steps[${i}] has the kind \"${kind}\", which is not one of the commands; use only the commands taught.`]\n const part = judge(step, base)\n if (typeof part !== 'string' || !existing.has(part) || shown.has(part)) return []\n return [\n `UNREAD_PART: steps[${i}] (${kind}) changes \"${part}\", which was not shown in full, so its source is not known here. ` +\n `Change only the parts shown in full (${allowed}) or parts the steps add. To change ${part}, read it with getFigureSource parts and pass it in parts to proposeFigureCandidate.`\n ]\n })\n}\n\n/** Entries of a value, keyed by `id` when every entry of a list has a distinct one, else by place. */\nfunction keyedEntries(value: unknown): Map<string, { token: string; value: unknown }> {\n const out = new Map<string, { token: string; value: unknown }>()\n if (Array.isArray(value)) {\n const ids = value.map(v => (v && typeof v === 'object' && typeof (v as Dynamic).id === 'string' ? (v as Dynamic).id : undefined))\n const byId = ids.every(Boolean) && new Set(ids).size === ids.length\n value.forEach((v, i) => out.set(byId ? `id:${ids[i]}` : `at:${i}`, { token: String(i), value: v }))\n } else if (value && typeof value === 'object') {\n for (const [key, v] of Object.entries(value)) out.set(`key:${key}`, { token: key, value: v })\n }\n return out\n}\n\n/**\n * What of the sections left out of the outline and not read the steps changed, as reasons said back to the writer. Judged\n * on what the steps made, not on what they say: nothing that was there may be changed or taken away. A new entry -- a\n * record in a list, a key in a map -- is the steps' own.\n */\nexport function unreadSectionEdits(base: FigureAsset, after: FigureAsset, view: FigureView): string[] {\n const read = Object.keys(view.sections ?? {})\n const reasons: string[] = []\n const say = (pointer: string, what: string) =>\n reasons.push(\n `UNREAD_SECTION: the steps ${what} ${pointer}, which was left out of the outline and not read, so it is not known here. ` +\n `Leave it as it is; to change it, read it with getFigureSource sections and pass it in sections to proposeFigureCandidate.`\n )\n const check = (pointer: string, before: unknown, now: unknown) => {\n if (reasons.length >= ENTRIES_NAMED || read.some(r => within(pointer, r))) return\n const records = (v: unknown) => v !== null && typeof v === 'object'\n if (!records(before) || !records(now) || Array.isArray(before) !== Array.isArray(now)) {\n if (JSON.stringify(before) !== JSON.stringify(now)) say(pointer, 'change')\n return\n }\n const later = keyedEntries(now)\n for (const [key, entry] of keyedEntries(before)) {\n const child = `${pointer}/${escapeToken(entry.token)}`\n const kept = later.get(key)\n if (kept) check(child, entry.value, kept.value)\n else if (!read.some(r => within(child, r))) say(child, 'remove')\n }\n }\n for (const omitted of view.outline?.omitted ?? []) {\n const tokens = tokensOf(omitted.section)!\n check(omitted.section, valueAt(base, tokens).value, valueAt(after, tokens).value)\n }\n return reasons\n}\n"]}
|
|
1
|
+
{"version":3,"file":"figure-context.js","sourceRoot":"","sources":["../../../server/service/figure/figure-context.ts"],"names":[],"mappings":";;;AA0HA,4CAWC;AAyED,0CAuCC;AAQD,oCA2DC;AA4ED,0CAiBC;AAoBD,gDA4BC;AAtbD,oHAAoH;AACvG,QAAA,qBAAqB,GAAG,OAAO,CAA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M,KAAK,GAAG,GAAG,OAAO,IAAI,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAA;YACtD,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;YAC3B,IAAI,IAAI;gBAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAA;iBAC1C,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;gBAAE,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;QAClE,CAAC;IACH,CAAC,CAAA;IACD,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,OAAO,EAAE,OAAO,IAAI,EAAE,EAAE,CAAC;QAClD,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAE,CAAA;QACzC,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,KAAK,CAAC,CAAA;IACnF,CAAC;IACD,OAAO,OAAO,CAAA;AAChB,CAAC","sourcesContent":["/**\n * What of a figure the model is shown (ADR-0061 2026-10-16 decision 4).\n *\n * The kernel keeps a figure up to 1 MiB (`FIGURE_JSON_MAX_BYTES`); that is whether the figure is valid. How much of it the\n * model reads at once is another question with its own number. A figure that fits is shown whole. One that does not is\n * shown as an outline -- its sections, and every part by name, shape and what it is fastened to -- and in full only the\n * parts and sections asked for, while they fit. A section too large for the outline is left out, named by its JSON\n * Pointer with the entries inside it, and read by pointer. The full source stays on the server: a proposal is applied\n * and judged on it, on the version the request was made on.\n *\n * A proposal on a figure shown in part changes only what it was shown: no part not read in full, and nothing inside a\n * section left out and not read. Read is what the server put before the writer, never what a model says it read.\n */\nimport type { FigureAsset, FigureProposalStep } from '@hatiolab/figure-model'\n\n/** The most of a figure, serialized, the model is shown in one read. Not a validity limit: that is the kernel's. */\nexport const FIGURE_CONTEXT_BUDGET = 100_000\n\n/** Of the budget, what the outline's sections may take; the rest is for the parts and sections read beside it. */\nconst OUTLINE_SHARE = FIGURE_CONTEXT_BUDGET / 2\n\n/** How many entries of a section left out, or pointers in a reason, are named: the largest first. */\nconst ENTRIES_NAMED = 20\n\ntype Dynamic = any\n\nexport interface FigureOutlinePart {\n id: string\n /** The operation that makes its shape (`box@1`, `extrude@1`, ...). */\n shape?: string\n /** What it is fastened to: `<part>.<face>`, `mounting-plane`, or nothing when unfastened. */\n on?: string\n /** Its joint, and how it moves: each axis's type in order (ADR-0159); no motion for a fastening. */\n joint?: { id: string; motion?: string[] }\n material?: string\n /** How long its part read is: what reading it costs. */\n chars: number\n}\n\nexport interface FigureOmittedSection {\n /** The JSON Pointer of the section left out. */\n section: string\n chars: number\n /** Its largest entries, by pointer: what to read when the whole does not fit. */\n entries?: { section: string; chars: number }[]\n}\n\nexport interface FigureOutline {\n /** The whole source's length, and the budget it does not fit. */\n chars: number\n budget: number\n parts: FigureOutlinePart[]\n /** Parts the outline had no room to list, past the ones listed. */\n partsNotListed?: number\n /** Sections left out because they would crowd the outline. */\n omitted?: FigureOmittedSection[]\n [section: string]: unknown\n}\n\nexport interface FigurePartRead {\n appearance: Dynamic\n /** The fastenings that name it: its own (body1) and its children's (body0). */\n joints: Dynamic[]\n /** The graph nodes and constants under its name: `<part>` and `<part>.*` (a part id has no dot). */\n nodes: Dynamic[]\n constants: Dynamic[]\n}\n\nexport interface FigureReadRequest {\n parts?: readonly string[]\n /** JSON Pointers (RFC 6901) into the source, such as `/document/capabilities/bindings/0`. */\n sections?: readonly string[]\n}\n\nexport interface FigureView {\n whole: boolean\n /** Whole: the source as it is. */\n source?: FigureAsset\n outline?: FigureOutline\n /** The parts shown in full, by id, in the order asked. */\n parts?: Record<string, FigurePartRead>\n shown?: string[]\n /** The sections read, by pointer. */\n sections?: Record<string, unknown>\n /** What was asked for and not shown, with why and what to read instead. */\n notRead?: ({ part: string; reason: string } | { section: string; reason: string })[]\n}\n\nconst length = (value: unknown) => JSON.stringify(value)?.length ?? 0\nconst under = (part: string) => (id: unknown) => id === part || (typeof id === 'string' && id.startsWith(`${part}.`))\n\n/* ── JSON Pointer (RFC 6901) ─────────────────────────────────────────────────────────── */\n\nconst escapeToken = (token: string) => token.replace(/~/g, '~0').replace(/\\//g, '~1')\nconst pointerOf = (tokens: readonly (string | number)[]) => tokens.map(t => `/${escapeToken(String(t))}`).join('')\nfunction tokensOf(pointer: string): string[] | undefined {\n if (typeof pointer !== 'string' || !pointer.startsWith('/')) return undefined\n return pointer.slice(1).split('/').map(t => t.replace(/~1/g, '/').replace(/~0/g, '~'))\n}\nfunction valueAt(root: unknown, tokens: readonly string[]): { found: boolean; value?: unknown } {\n let at: Dynamic = root\n for (const token of tokens) {\n if (at === null || typeof at !== 'object' || !Object.prototype.hasOwnProperty.call(at, token)) return { found: false }\n at = at[token]\n }\n return { found: true, value: at }\n}\n/** `inner` is `outer` or inside it. */\nconst within = (inner: string, outer: string) => inner === outer || inner.startsWith(`${outer}/`)\n\n/** A value's entries by pointer, largest first, the first ENTRIES_NAMED of them. */\nfunction entriesOf(pointer: string, value: unknown): { section: string; chars: number }[] {\n if (value === null || typeof value !== 'object') return []\n const tokens = tokensOf(pointer)!\n return Object.entries(value as object)\n .map(([key, entry]) => ({ section: pointerOf([...tokens, key]), chars: length(entry) }))\n .sort((a, b) => b.chars - a.chars)\n .slice(0, ENTRIES_NAMED)\n}\n\n/* ── Parts ───────────────────────────────────────────────────────────────────────────── */\n\nexport function figurePartReadOf(asset: FigureAsset, part: string): FigurePartRead | undefined {\n const appearance = asset.appearance.find(a => a.target === part)\n if (!appearance) return undefined\n const model = asset.document.model as Dynamic\n const own = under(part)\n return {\n appearance,\n joints: ((asset as Dynamic).joints ?? []).filter((j: Dynamic) => j?.body1?.part === part || j?.body0?.part === part),\n nodes: model.nodes.filter((n: Dynamic) => own(n.id)),\n constants: model.constants.filter((c: Dynamic) => own(c.id))\n }\n}\n\n/** Where a part's records are, by pointer: for a part too large to read as one. */\nfunction partPointers(asset: FigureAsset, part: string): string[] {\n const model = asset.document.model as Dynamic\n const own = under(part)\n return [\n ...asset.appearance.flatMap((a, i) => (a.target === part ? [pointerOf(['appearance', i])] : [])),\n ...((asset as Dynamic).joints ?? []).flatMap((j: Dynamic, i: number) => (j?.body1?.part === part || j?.body0?.part === part ? [pointerOf(['joints', i])] : [])),\n ...model.nodes.flatMap((n: Dynamic, i: number) => (own(n.id) ? [pointerOf(['document', 'model', 'nodes', i])] : [])),\n ...model.constants.flatMap((c: Dynamic, i: number) => (own(c.id) ? [pointerOf(['document', 'model', 'constants', i])] : []))\n ]\n}\n\n/* ── The outline ─────────────────────────────────────────────────────────────────────── */\n\n/*\n The sections of an outline: every top-level field but the parts' records, the document's fields but its model, and the\n model's fields but its graph. Each may be left out by its pointer.\n*/\nconst PART_RECORDS = ['/document', '/appearance', '/joints', '/document/model', '/document/model/nodes', '/document/model/constants']\nfunction sectionsOf(asset: FigureAsset): string[] {\n const out: string[] = []\n const walk = (tokens: string[]) => {\n const { value } = valueAt(asset, tokens)\n for (const key of Object.keys(value as object)) {\n const pointer = pointerOf([...tokens, key])\n if (pointer === '/document' || pointer === '/document/model') walk([...tokens, key])\n else if (!PART_RECORDS.includes(pointer)) out.push(pointer)\n }\n }\n walk([])\n return out\n}\n\nfunction outlinePartsOf(asset: FigureAsset): FigureOutlinePart[] {\n const nodes = (asset.document.model as Dynamic).nodes\n const joints = (asset as Dynamic).joints ?? []\n return asset.appearance.map((look: Dynamic) => {\n const id = look.target\n const joint = joints.find((j: Dynamic) => j?.body1?.part === id)\n const body0 = joint?.body0\n const on = !joint ? undefined : body0?.part ? `${body0.part}.${body0.face}` : (body0?.plane ?? 'mounting-plane')\n const shape = nodes.find((n: Dynamic) => n.id === `${id}.shape`)?.op\n return {\n id,\n ...(shape ? { shape } : {}),\n ...(on ? { on } : {}),\n /* How it moves: each axis of its joint in order (ADR-0159); none for a fastening. */\n ...(joint ? { joint: { id: joint.id, ...(joint.motion?.length ? { motion: joint.motion.map((m: Dynamic) => m.type) } : {}) } } : {}),\n ...(look.material?.token ? { material: look.material.token } : {}),\n chars: length(figurePartReadOf(asset, id))\n }\n })\n}\n\n/** Writes a section into the outline at its pointer, making the objects on the way. */\nfunction place(outline: Dynamic, tokens: readonly string[], value: unknown) {\n let at = outline\n tokens.slice(0, -1).forEach(token => (at = at[token] ??= {}))\n at[tokens[tokens.length - 1]!] = value\n}\n\n/**\n * What the view wraps the outline in, read or not: an outline that took the whole budget left the view over it by these\n * (53 characters, a figure of 3000 long-named parts, 2026-10-19).\n */\nconst VIEW_ENVELOPE = () => length({ whole: false, outline: {}, parts: {}, shown: [], sections: {}, notRead: [] }) - length({})\n\n/**\n * The outline: within OUTLINE_SHARE for its sections, the largest left out first; and, every field counted, within the\n * budget less what the view wraps it in -- a figure of very many parts lists them by id only, then as many as fit.\n */\nexport function figureOutlineOf(asset: FigureAsset, chars = length(asset)): FigureOutline {\n const limit = FIGURE_CONTEXT_BUDGET - VIEW_ENVELOPE()\n const model = asset.document.model as Dynamic\n const sections = sectionsOf(asset).map(pointer => ({ pointer, value: valueAt(asset, tokensOf(pointer)!).value }))\n const sized = sections.map(s => ({ ...s, chars: length(s.value) })).sort((a, b) => b.chars - a.chars)\n\n let total = sized.reduce((sum, s) => sum + s.chars, 0)\n const omitted: FigureOmittedSection[] = []\n const kept = new Set(sized.map(s => s.pointer))\n for (const s of sized) {\n if (total <= OUTLINE_SHARE) break\n kept.delete(s.pointer)\n total -= s.chars\n const entries = entriesOf(s.pointer, s.value)\n omitted.push({ section: s.pointer, chars: s.chars, ...(entries.length ? { entries } : {}) })\n }\n\n const outline: Dynamic = { chars, budget: FIGURE_CONTEXT_BUDGET }\n place(outline, ['document', 'model', 'nodes'], model.nodes.length)\n place(outline, ['document', 'model', 'constants'], model.constants.length)\n for (const s of sections) if (kept.has(s.pointer)) place(outline, tokensOf(s.pointer)!, s.value)\n if (omitted.length) outline.omitted = omitted\n\n let parts: Dynamic[] = outlinePartsOf(asset)\n outline.parts = parts\n if (length(outline) > limit) outline.parts = parts = parts.map(p => ({ id: p.id }))\n if (length(outline) > limit) {\n /* As many as fit, in part order, with how many more there are. */\n let room = limit - length({ ...outline, parts: [], partsNotListed: parts.length })\n const listed: Dynamic[] = []\n for (const p of parts) {\n room -= length(p) + 1\n if (room < 0) break\n listed.push(p)\n }\n outline.parts = listed\n outline.partsNotListed = parts.length - listed.length\n }\n return outline as FigureOutline\n}\n\n/* ── The view ────────────────────────────────────────────────────────────────────────── */\n\n/**\n * The view of a figure the model is shown: whole when it fits, else the outline and what was asked for -- parts, then\n * sections, each in the order asked -- while it fits beside it. Every field counted, the view is within the budget.\n */\nexport function figureViewOf(asset: FigureAsset, request: FigureReadRequest = {}): FigureView {\n const chars = length(asset)\n if (chars <= FIGURE_CONTEXT_BUDGET) return { whole: true, source: asset }\n\n const outline = figureOutlineOf(asset, chars)\n const view: FigureView = { whole: false, outline, parts: {}, shown: [], sections: {}, notRead: [] }\n const room = () => FIGURE_CONTEXT_BUDGET - length(view)\n const refuse = (one: { part: string; reason: string } | { section: string; reason: string }) => {\n if (length(one) + 1 <= room()) view.notRead!.push(one)\n }\n\n for (const part of [...new Set(request.parts ?? [])]) {\n const one = figurePartReadOf(asset, part)\n if (!one) {\n refuse({ part, reason: `${part} is not a part of this figure; the outline lists its parts` })\n continue\n }\n const cost = length(one) + length(part) + length(part) + 3\n view.parts![part] = one\n view.shown!.push(part)\n if (room() >= 0) continue\n delete view.parts![part]\n view.shown!.pop()\n if (cost <= FIGURE_CONTEXT_BUDGET - length(outline)) {\n refuse({ part, reason: `${part} (${cost} characters) does not fit beside what is already read; read it in another call with fewer parts or sections` })\n } else {\n const pointers = partPointers(asset, part)\n refuse({\n part,\n reason:\n `${part} (${cost} characters) is too large to show beside the outline; read its records as sections: ` +\n `${pointers.slice(0, ENTRIES_NAMED).join(', ')}${pointers.length > ENTRIES_NAMED ? ` and ${pointers.length - ENTRIES_NAMED} more` : ''}. ` +\n 'Parts read as sections are not counted as read in full: they cannot be changed'\n })\n }\n }\n\n for (const section of [...new Set(request.sections ?? [])]) {\n const tokens = tokensOf(section)\n const at = tokens && tokens.length ? valueAt(asset, tokens) : { found: false }\n if (!at.found) {\n refuse({ section, reason: `there is no section ${section}; a section is a JSON Pointer such as /document/capabilities/bindings/0` })\n continue\n }\n const cost = length(at.value) + length(section) + 2\n view.sections![section] = at.value\n if (room() >= 0) continue\n delete view.sections![section]\n const entries = entriesOf(section, at.value)\n refuse({\n section,\n reason: entries.length\n ? `${section} (${cost} characters) is too large to show at once here; read its entries: ${entries.map(e => `${e.section} (${e.chars})`).join(', ')}`\n : `${section} is one value of ${length(at.value)} characters, larger than can be shown here; it cannot be read or changed by a proposal`\n })\n }\n\n if (!view.notRead!.length) delete view.notRead\n return view\n}\n\n/* ── What a proposal may change ──────────────────────────────────────────────────────── */\n\ntype StepOf<K extends FigureProposalStep['kind']> = Extract<FigureProposalStep, { kind: K }>\ntype Subject = string | undefined\n\n/**\n * The part each kind of step changes, read from the field the kernel reads for that kind (audit D4-R1: a `part` beside a\n * `set-material`'s `target` is not read by the kernel, so it may not stand in for it). Every kind of the kernel's step\n * type is here, or this does not compile. A step that changes no one part says so with undefined: what it does to the\n * figure's sections is held by `unreadSectionEdits`.\n */\nconst SUBJECT: { [K in FigureProposalStep['kind']]: (step: StepOf<K>, base: FigureAsset) => Subject } = {\n 'add-part': () => undefined,\n 'set-section-corner': step => step.part,\n 'set-cavity': step => step.part,\n 'set-section': step => step.part,\n attach: step => step.part,\n 'link-dimension': step => step.part,\n 'follow-size': step => step.part,\n 'unlink-dimension': step => step.part,\n 'scale-position': step => step.part,\n 'fix-position': step => step.part,\n 'nudge-part': step => step.part,\n detach: step => step.part,\n 'make-repeat': step => step.part,\n 'set-repeat': step => step.part,\n 'remove-repeat': step => step.part,\n 'set-mounting-face': step => step.part,\n 'add-binding': step => step.part,\n 'set-joint': step => step.joint?.body1?.part,\n 'remove-joint': (step, base) => ((base as Dynamic).joints ?? []).find((j: Dynamic) => j?.id === step.id)?.body1?.part,\n 'set-material': step => step.target,\n 'set-segments': step => step.target,\n 'rename-part': step => step.target,\n 'set-visibility': step => step.target,\n 'remove-part': step => step.target,\n 'duplicate-part': step => step.target,\n 'move-part': step => step.target,\n 'set-placement': () => undefined,\n 'declare-instance-size': () => undefined,\n 'clear-mounting-face': () => undefined,\n 'scale-uniformly': () => undefined,\n 'follow-size-in-proportion': () => undefined,\n 'set-detail-level': () => undefined,\n 'add-design-input': () => undefined,\n 'set-input-range': () => undefined,\n 'publish-input': () => undefined,\n 'unpublish-input': () => undefined,\n 'remove-binding': () => undefined,\n 'set-slot-layout': () => undefined,\n 'remove-slot-layout': () => undefined,\n 'set-extension': () => undefined,\n rename: () => undefined,\n 'set-capabilities': () => undefined,\n 'set-state-input': () => undefined,\n 'set-state-defaults': () => undefined,\n 'set-driver': () => undefined,\n 'remove-driver': () => undefined,\n 'set-clip': () => undefined,\n 'set-motion-group': () => undefined,\n 'remove-motion-group': () => undefined,\n 'set-data-schema': () => undefined,\n 'rename-data-field': () => undefined,\n 'set-data-binding': () => undefined,\n 'remove-data-binding': () => undefined,\n 'set-status-port': () => undefined,\n 'remove-status-port': () => undefined\n}\n\n/**\n * The steps that change a part of the base not shown in full, as reasons said back to the writer. A part may still be\n * named to fasten to or to follow -- the kernel works from it, nothing about it is guessed -- and a new part is the\n * steps' own. A kind this table does not know is refused: it is not let through unjudged.\n */\nexport function unreadPartEdits(base: FigureAsset, steps: readonly FigureProposalStep[], view: FigureView): string[] {\n const existing = new Set(base.appearance.map(a => a.target))\n const shown = new Set(view.shown ?? [])\n const allowed = [...shown].join(', ') || 'none'\n return steps.flatMap((step, i) => {\n const kind = (step as Dynamic)?.kind\n if (typeof kind !== 'string') return []\n const judge = (SUBJECT as Record<string, (step: Dynamic, base: FigureAsset) => Subject>)[kind]\n if (!Object.prototype.hasOwnProperty.call(SUBJECT, kind) || !judge)\n return [`UNKNOWN_STEP: steps[${i}] has the kind \"${kind}\", which is not one of the commands; use only the commands taught.`]\n const part = judge(step, base)\n if (typeof part !== 'string' || !existing.has(part) || shown.has(part)) return []\n return [\n `UNREAD_PART: steps[${i}] (${kind}) changes \"${part}\", which was not shown in full, so its source is not known here. ` +\n `Change only the parts shown in full (${allowed}) or parts the steps add. To change ${part}, read it with getFigureSource parts and pass it in parts to proposeFigureCandidate.`\n ]\n })\n}\n\n/** Entries of a value, keyed by `id` when every entry of a list has a distinct one, else by place. */\nfunction keyedEntries(value: unknown): Map<string, { token: string; value: unknown }> {\n const out = new Map<string, { token: string; value: unknown }>()\n if (Array.isArray(value)) {\n const ids = value.map(v => (v && typeof v === 'object' && typeof (v as Dynamic).id === 'string' ? (v as Dynamic).id : undefined))\n const byId = ids.every(Boolean) && new Set(ids).size === ids.length\n value.forEach((v, i) => out.set(byId ? `id:${ids[i]}` : `at:${i}`, { token: String(i), value: v }))\n } else if (value && typeof value === 'object') {\n for (const [key, v] of Object.entries(value)) out.set(`key:${key}`, { token: key, value: v })\n }\n return out\n}\n\n/**\n * What of the sections left out of the outline and not read the steps changed, as reasons said back to the writer. Judged\n * on what the steps made, not on what they say: nothing that was there may be changed or taken away. A new entry -- a\n * record in a list, a key in a map -- is the steps' own.\n */\nexport function unreadSectionEdits(base: FigureAsset, after: FigureAsset, view: FigureView): string[] {\n const read = Object.keys(view.sections ?? {})\n const reasons: string[] = []\n const say = (pointer: string, what: string) =>\n reasons.push(\n `UNREAD_SECTION: the steps ${what} ${pointer}, which was left out of the outline and not read, so it is not known here. ` +\n `Leave it as it is; to change it, read it with getFigureSource sections and pass it in sections to proposeFigureCandidate.`\n )\n const check = (pointer: string, before: unknown, now: unknown) => {\n if (reasons.length >= ENTRIES_NAMED || read.some(r => within(pointer, r))) return\n const records = (v: unknown) => v !== null && typeof v === 'object'\n if (!records(before) || !records(now) || Array.isArray(before) !== Array.isArray(now)) {\n if (JSON.stringify(before) !== JSON.stringify(now)) say(pointer, 'change')\n return\n }\n const later = keyedEntries(now)\n for (const [key, entry] of keyedEntries(before)) {\n const child = `${pointer}/${escapeToken(entry.token)}`\n const kept = later.get(key)\n if (kept) check(child, entry.value, kept.value)\n else if (!read.some(r => within(child, r))) say(child, 'remove')\n }\n }\n for (const omitted of view.outline?.omitted ?? []) {\n const tokens = tokensOf(omitted.section)!\n check(omitted.section, valueAt(base, tokens).value, valueAt(after, tokens).value)\n }\n return reasons\n}\n"]}
|
|
@@ -65,7 +65,7 @@ function assertFormat(sourceJson) {
|
|
|
65
65
|
}
|
|
66
66
|
if (parsed?.version !== exports.FIGURE_ASSET_VERSION)
|
|
67
67
|
throw new FigureSourceError([
|
|
68
|
-
{ code: 'source-format-unknown', message: `정본의 판을 알 수 없다 —
|
|
68
|
+
{ code: 'source-format-unknown', message: `정본의 판을 알 수 없다 — 피규어 자산은 version '${exports.FIGURE_ASSET_VERSION}' 을 적는다`, at: 'version' }
|
|
69
69
|
]);
|
|
70
70
|
}
|
|
71
71
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"figure-format.js","sourceRoot":"","sources":["../../../server/service/figure/figure-format.ts"],"names":[],"mappings":";;;AAwEA,gEAMC;AA0CD,kCAmBC;AAuFD,sCAyDC;AAqXD,0CAyBC;AAOD,oDAGC;AAMD,kDAKC;AA9rBD;;;;;GAKG;AACH,yDAAsU;AAKtU,uDAAuD;AAC1C,QAAA,oBAAoB,GAAG,gBAAgB,CAAA;AAYpD,sDAAsD;AACtD,MAAa,iBAAkB,SAAQ,KAAK;IAG1C,YAAY,QAAyB;QACnC,KAAK,CAAC,iBAAiB,QAAQ,CAAC,MAAM,MAAM,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAA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C,CAAA;IACzB,OAAO,EAAE,KAAK,EAAE,CAAA;AAClB,CAAC","sourcesContent":["/*\n * The doors a stored source goes through: saving (`parseSource`), publishing (`inspectSource`, and the release's own\n * copy in `releaseRecordOf`), bringing a release back as a draft (`draftSourceOfRelease`) and handing it to a board\n * (`consumablePayloadOf`). The format is `figure-asset-1`, and the asset says so in its `version`; a source\n * that does not is refused by name, because a source the server cannot identify is one it must not save.\n */\nimport { FIGURE_KERNEL_VERSION, compileFigureAsset, inspectFigureAsset, isPlaceholderType, parseFigureAsset, serializeFigureAsset, figureContractChanges, figureCostOf, figurePlaneGapOf, figureReleaseMetricsOf, figureScoreOf, figureTopViewOf, forgetRecordedInstanceSize, recordFigureInstanceSize } from '@hatiolab/figure-model'\nimport type { FigureAsset, FigureContractChange, FigureContractError, FigureReleaseMetrics, FigureTopView, FigureViolation } from '@hatiolab/figure-model'\n\nimport type { FigureFinding } from './figure-type.js'\n\n/** The version the format stamps on its own source. */\nexport const FIGURE_ASSET_VERSION = 'figure-asset-1'\n\n/** A source that passed the save door: what is stored, and the numbers the catalogue shows, computed here. */\nexport interface ParsedSource {\n /** The source to store, as the kernel serializes it. */\n source: string\n /** Computed from the source, never taken from the client -- a client's numbers could lie to the catalogue. */\n derived: { score: number; triangles: number; groups: number }\n /** Findings that do not block the save; the caller returns them with the answer. */\n violations: FigureFinding[]\n}\n\n/** The source breaks the format. It is not stored. */\nexport class FigureSourceError extends Error {\n readonly findings: FigureFinding[]\n\n constructor(findings: FigureFinding[]) {\n super(`정본이 형식을 어겼다 — ${findings.length}건: ${findings.map(f => f.code).join(', ')}`)\n this.name = 'FigureSourceError'\n this.findings = findings\n }\n}\n\n/** One thing the release gate found. `blocking` true means the figure cannot be published. */\nexport interface GateFinding {\n code: string\n message: string\n /** **Why it matters.** A measurement alone leaves the reader at \"so what?\". */\n why?: string\n /** **What to change.** By part name and value. */\n how?: string\n /** Where it points: the parts, or the path in the source. */\n at?: string\n blocking: boolean\n}\n\nexport interface Inspection {\n findings: GateFinding[]\n /** Whether anything blocks. The screen locks the button with this. */\n blocked: boolean\n}\n\n/** What an app's release check is shown: the figure's asset, its row's type and category, and the reader's words. */\nexport interface FigureReleaseCheckInput {\n asset: FigureAsset\n type?: string\n category?: string | null\n t?: Translate\n}\n\n/**\n * A check an app adds to releasing (LV figure-server design G10): findings in the gate's own shape, blocking or said.\n * The LV figure-server refuses an origin off the middle of the floor, a receiving side's check (ADR-0104 decision 4),\n * and says its carrier and budget advice.\n */\nexport type FigureReleaseCheck = (input: FigureReleaseCheckInput) => GateFinding[]\n\nconst releaseChecks: FigureReleaseCheck[] = []\n\n/** Adds a check to every release verdict (`inspectFigure`, `releaseFigure`). Returns the way to take it off again. */\nexport function registerFigureReleaseCheck(check: FigureReleaseCheck): () => void {\n releaseChecks.push(check)\n return () => {\n const at = releaseChecks.indexOf(check)\n if (at >= 0) releaseChecks.splice(at, 1)\n }\n}\n\n/** The app's checks on an asset the kernel passed. A check that throws blocks, by name: a check is never skipped. */\nfunction appFindings(input: FigureReleaseCheckInput): GateFinding[] {\n const found: GateFinding[] = []\n for (const check of releaseChecks) {\n try {\n found.push(...check(input))\n } catch (e) {\n found.push({ code: 'release-check-failed', message: `a release check failed: ${(e as Error)?.message ?? String(e)}`, blocking: true })\n }\n }\n return found\n}\n\n/**\n * That the source is JSON and names the format.\n *\n * @throws {FigureSourceError} when the text is not JSON, or does not carry `version: 'figure-asset-1'`.\n */\nfunction assertFormat(sourceJson: string): void {\n let parsed: unknown\n try {\n parsed = JSON.parse(sourceJson)\n } catch (e) {\n throw new FigureSourceError([\n { code: 'source-not-json', message: `정본이 JSON 이 아니다: ${(e as Error).message}`, at: 'source' }\n ])\n }\n if ((parsed as { version?: unknown } | null)?.version !== FIGURE_ASSET_VERSION)\n throw new FigureSourceError([\n { code: 'source-format-unknown', message: `정본의 판을 알 수 없다 — 도형 자산은 version '${FIGURE_ASSET_VERSION}' 을 적는다`, at: 'version' }\n ])\n}\n\n/**\n * Validates a source and computes what the catalogue shows: the cost from `figureCostOf`, and the score from `figureScoreOf`\n * -- the headroom against placing `LIMITS.screenInstances` of it on one screen (chief architect, 2026-09-24), the\n * same number the modeller's maturity tab shows. An asset that draws nothing has no score, not a full one.\n *\n * @throws {FigureSourceError} when the source breaks the format.\n */\nexport function parseSource(sourceJson: string): ParsedSource {\n assertFormat(sourceJson)\n let asset\n try {\n asset = parseFigureAsset(sourceJson)\n compileFigureAsset(asset)\n } catch (e) {\n const error = e as FigureContractError & { path?: string }\n throw new FigureSourceError([\n { code: error.code ?? 'asset-invalid', message: error.message ?? String(e), at: error.path }\n ])\n }\n const cost = figureCostOf(asset)\n const score = figureScoreOf(asset)\n return {\n source: serializeFigureAsset(asset),\n derived: { score: (score?.score ?? null) as unknown as number, triangles: cost.triangles, groups: cost.groups },\n violations: []\n }\n}\n\n/**\n * Whether this source may be published, and why not.\n *\n * The judgement is `inspectFigureAsset`: every part inside the volume the asset declares, over the whole\n * state range, and the face it says it is mounted on lying in that plane. A verdict reached by sampling is\n * reported as a finding of its own rather than hidden — an author releasing a figure the gate could only\n * sample should be told so, because nothing proved it holds between the states that were checked.\n */\n/** The request's translator. Always called with params — `t(key, undefined)` loses the locale. */\nexport type Translate = (key: string, options?: Record<string, unknown>) => string\n\n/**\n * A finding in the words of the release panel.\n *\n * The gate says what it measured as a code and values (`part`, `axis`, `mm`, `degrees`) and an English `detail`\n * for logs. The sentence an author reads is made here, where the request's language is known (ADR-0054) — not in\n * figure-model, which knows no locale, and not on the screen, which would then have a second account of the same\n * refusal. The English line is the fallback when a key is missing, so a missing translation reads as English\n * rather than as the key printed raw.\n *\n * The words are the modeller's (ADR-0097 §9 Q2 A): 「차지하는 공간」 for the volume a figure takes up, 「부품에 맞추기」 for\n * setting it from the parts, and 「장착면」 for the face it stands on (`figure.text.mounting-face-explained`). A fact, then the way out.\n */\nfunction figureWording(violation: FigureViolation, say: Say): Pick<GateFinding, 'message' | 'why' | 'how'> {\n const part = violation.part ?? ''\n const axis = (violation.axis ?? '').toUpperCase()\n const mm = violation.mm ?? 0\n const degrees = violation.degrees ?? 0\n const key = (field: string) => `figure.gate.${violation.code.toLowerCase().replace(/_/g, '-')}.${field}`\n\n switch (violation.code) {\n case 'PARTS_OFF_PLACEMENT_FACE':\n return {\n message: say(key('message'), { part, mm }, `The mounting face of '${part}' is ${mm} mm off the plane the figure stands on.`),\n why: say(key('why'), {}, 'The figure is declared to stand on that face. If the face does not reach the plane, the figure floats on the board by that much, and whatever is placed on it floats too.'),\n how: say(key('how'), { part, mm }, `Move '${part}' ${mm} mm on Y so the face meets the plane, or choose a different mounting face.`)\n }\n case 'PLACEMENT_FACE_TILTED':\n return {\n message: say(key('message'), { part, degrees }, `The mounting face of '${part}' is tilted ${degrees}° from the plane the figure stands on.`),\n why: say(key('why'), {}, 'A tilted face cannot lie on the plane, so how the figure stands is not settled.'),\n how: say(key('how'), { part }, `Choose a mounting face parallel to the plane, or turn '${part}' upright.`)\n }\n case 'PARTS_SPLIT_ON_RESIZE': {\n /*\n What comes off is every piece but the largest — the figure as the author sees it is the big piece, and the\n small ones are what they will see hanging in the air (2026-09-24).\n */\n const resize = violation.resize!\n const pieces = [...resize.pieces].sort((a, b) => b.length - a.length)\n const parts = pieces.slice(1).flat().map(one => `'${one}'`).join(', ')\n const axes = resize.axes.map(one => one.toUpperCase()).join('·')\n const factor = resize.factor\n return {\n message: say(key('message'), { parts, axes, factor }, `At ${factor}x on ${axes}, ${parts} come away from the rest of the figure.`),\n why: say(key('why'), {}, 'A figure placed at another size shows those parts hanging in the air — to a person, it looks broken.'),\n how: say(key('how'), { parts }, `Fasten ${parts} to a face of the part they rest on, or press \"fix here\" under position in the responsive tab, so they stay put when the figure is resized.`)\n }\n }\n case 'SIZING_NOT_UNIFORM': {\n /* The figure declares it grows by one ratio; these parts keep a size or place of their own (ruling 2026-09-24). */\n const resize = violation.resize!\n const parts = (violation.parts ?? []).map(one => `'${one}'`).join(', ')\n const axes = resize.axes.map(one => one.toUpperCase()).join('·')\n const factor = resize.factor\n return {\n message: say(key('message'), { parts, axes, factor }, `The figure grows by one ratio, but at ${factor}x on ${axes} ${parts} do not grow with it.`),\n why: say(key('why'), {}, 'A figure that grows by one ratio keeps its proportions at any size. A part with a size or place of its own comes apart from the rest.'),\n how: say(key('how'), { parts }, `Let ${parts} follow the figure's size (\"in proportion\" under position in the responsive tab), or remove their own fixed numbers.`)\n }\n }\n }\n}\n\ntype Say = (key: string, params: Record<string, string | number>, english: string) => string\n\n/*\n The sentence is shown as text, never as HTML, so the values go in as they are. i18next escapes interpolated\n values by default, and the screen then showed `'lamp-in'` as `'lamp-in'`.\n*/\nfunction sayerOf(t?: Translate): Say {\n return (key, params, english) =>\n t ? t(key, { ...params, defaultValue: english, interpolation: { escapeValue: false } }) : english\n}\n\nexport function inspectSource(\n sourceJson?: string | null,\n releasedJson?: string | null,\n t?: Translate,\n /** The row's `type` -- the only place the name lives, since the asset carries none. */\n rowType?: string,\n /** The row's category, for an app's release checks (G10). */\n rowCategory?: string | null\n): Inspection {\n if (!sourceJson) {\n return { blocked: true, findings: [{ code: 'no-source', message: '저장된 정본이 없다. 저장하면 발행할 수 있다', blocking: true }] }\n }\n try {\n assertFormat(sourceJson)\n } catch (e) {\n const findings = (e as FigureSourceError).findings ?? [{ code: 'source-unreadable', message: String(e) }]\n return { blocked: true, findings: findings.map(f => ({ ...f, blocking: true })) }\n }\n\n let inspection\n let asset: FigureAsset | undefined\n try {\n asset = parseFigureAsset(sourceJson)\n inspection = inspectFigureAsset(asset)\n } catch (e) {\n const error = e as FigureContractError & { path?: string }\n return {\n blocked: true,\n findings: [{ code: error.code ?? 'asset-invalid', message: error.message ?? String(e), at: error.path, blocking: true }]\n }\n }\n\n const say = sayerOf(t)\n const findings: GateFinding[] = inspection.violations.map(violation => ({\n code: violation.code.toLowerCase().replace(/_/g, '-'),\n ...figureWording(violation, say),\n at: violation.part,\n blocking: true\n }))\n /*\n A machine-made name is refused at release. The asset has no `type`, so the name is read off the row; a new figure\n was once published as `FIGURE_<uuid>` (:3300, 2026-09-24). Publishing freezes the name (ADR-0063 decision 4) and\n boards call a figure by it.\n */\n if (rowType && isPlaceholderType(rowType)) {\n findings.push({\n code: 'type-is-placeholder',\n message: say('figure.gate.type-is-placeholder.message', { type: rowType }, `'${rowType}' is a temporary type given when the figure was first saved.`),\n why: say('figure.gate.type-is-placeholder.why', {}, 'Boards call a figure by its type, and it cannot change once the figure is published.'),\n how: say('figure.gate.type-is-placeholder.how', {}, 'Set the type in the type field, then publish.'),\n blocking: true\n })\n }\n findings.push(...planeGapFindings(asset!, say))\n if (releasedJson) findings.push(...figureContractFindings(asset!, releasedJson, say))\n findings.push(...appFindings({ asset: asset!, type: rowType, category: rowCategory, t }))\n return { blocked: findings.some(finding => finding.blocking), findings }\n}\n\n/*\n Said, never refused: a figure off the plane it is mounted on stands off it on every board -- a conveyor in the air, a\n hoist hung below a floor figure (the walk of 2026-10-18 found each passing release with no word). A gap can be meant,\n and so can a part through the plane, so it does not block. A figure that names its mounting face is checked on that\n face by the gate already; this is for the one that names none.\n*/\ntype Gap = { part: string; mm: number }\nconst PLANE_ENGLISH = {\n floor: {\n clear: (g: Gap) => `'${g.part}' is ${g.mm} mm above the floor.`,\n through: (g: Gap) => `'${g.part}' goes ${g.mm} mm below the floor.`,\n beyond: 'Every part is below the floor.',\n why: 'A board stands this figure on the floor, so it stands so on every board.',\n beyondHow: 'If it hangs from the ceiling, set where it stands to the ceiling.'\n },\n ceiling: {\n clear: (g: Gap) => `'${g.part}' is ${g.mm} mm below the ceiling.`,\n through: (g: Gap) => `'${g.part}' goes ${g.mm} mm above the ceiling.`,\n beyond: 'Every part is above the ceiling.',\n why: 'A board hangs this figure from the ceiling, so it hangs so on every board.',\n beyondHow: 'If it stands on the floor, set where it stands to the floor.'\n },\n wall: {\n clear: (g: Gap) => `'${g.part}' is ${g.mm} mm out from the wall.`,\n through: (g: Gap) => `'${g.part}' goes ${g.mm} mm into the wall.`,\n beyond: 'Every part is behind the wall.',\n why: 'A board puts this figure on the wall, so it sits so on every board.',\n beyondHow: 'Bring the parts out in front of the wall, or choose again where it stands.'\n }\n} as const\nfunction planeGapFindings(asset: FigureAsset, say: Say): GateFinding[] {\n if (asset.mountingFace) return []\n const gap = figurePlaneGapOf(asset)\n if (!gap || gap.touches) return []\n const english = PLANE_ENGLISH[gap.placement]\n const key = `figure.gate.off-mounting-plane.${gap.placement}`\n const kind = gap.beyond ? 'beyond' : gap.mm > 0 ? 'clear' : 'through'\n const said = { part: gap.part, mm: Math.round(Math.abs(gap.mm)) }\n return [\n {\n code: 'off-mounting-plane',\n message: say(`${key}.${kind}.message`, said, kind === 'beyond' ? english.beyond : english[kind](said)),\n why: say(`${key}.why`, {}, english.why),\n how:\n kind === 'beyond'\n ? say(`${key}.beyond.how`, {}, english.beyondHow)\n : say('figure.gate.off-mounting-plane.how', {}, 'Keep it if it is meant. Otherwise fasten that part to the mounting plane, or move it until it meets the plane.'),\n at: gap.part,\n blocking: false\n }\n ]\n}\n\n/**\n * The last release against this one — what the drawings that already hold this type lean on (ADR-0063 decision 3).\n *\n * figure-model names the changes and whether each blocks (`figureContractChanges`); the sentence is made here. When\n * the last release no longer parses, the gate says so rather than passing in silence: a release that was not checked\n * against the last one is a different fact from one that was checked and found safe.\n */\nfunction figureContractFindings(asset: FigureAsset, releasedJson: string, say: Say): GateFinding[] {\n let before: FigureAsset\n try {\n before = parseFigureAsset(releasedJson)\n } catch (e) {\n return [\n {\n code: 'released-unreadable',\n message: say('figure.gate.released-not-compared.message', { reason: (e as Error).message }, `The last release could not be read, so this release was not compared with it: ${(e as Error).message}`),\n why: say('figure.gate.released-not-compared.why', {}, 'Whether this release breaks the instances already placed has not been checked.'),\n blocking: false\n }\n ]\n }\n return figureContractChanges(before, asset).map(change => ({\n code: change.code,\n ...figureContractWording(change, say),\n at: change.subject,\n blocking: change.blocking\n }))\n}\n\n/** One contract change in the words of the release panel. The English line is the fallback for a missing key. */\nfunction figureContractWording(change: FigureContractChange, say: Say): Pick<GateFinding, 'message' | 'why' | 'how'> {\n const v = change.values\n const key = (field: string) => `figure.gate.contract.${change.code}.${field}`\n const gone = {\n how: say('figure.gate.contract.gone.how', {}, 'Put it back as it was, or publish this as a new figure type so the placed ones keep the old one.')\n }\n switch (change.code) {\n case 'placement-changed':\n return {\n message: say(key('message'), v, `Placement changed from ${v.before} to ${v.after}.`),\n why: say(key('why'), {}, 'Placement sets the height of every placed instance. They all move with it.'),\n ...gone\n }\n case 'size-inputs-gone':\n return {\n message: say(key('message'), v, 'The figure no longer takes its size from the place it is given.'),\n why: say(key('why'), {}, 'Placed instances were sized on the board. After this release they all draw at the authored size.'),\n ...gone\n }\n case 'size-inputs-added':\n return {\n message: say(key('message'), v, 'The figure now takes its size from the place it is given.'),\n why: say(key('why'), {}, 'Placed instances now follow their own size on the board.')\n }\n case 'size-range-narrowed':\n return {\n message: say(key('message'), { ...v, input: change.subject ?? '' }, `The size range of ${change.subject} narrowed from ${v.before} to ${v.after}.`),\n why: say(key('why'), {}, 'An instance placed at a size outside the new range will not draw. Which sizes are placed is not recorded.')\n }\n case 'authored-size-changed':\n return {\n message: say(key('message'), v, `The authored size changed from ${v.before} to ${v.after}.`),\n why: say(key('why'), {}, 'Placed instances keep their own size. An instance with no depth of its own takes its depth from this.')\n }\n case 'state-input-gone':\n return {\n message: say(key('message'), v, `The control '${v.id}' is gone.`),\n why: say(key('why'), {}, 'Placed instances and connectors give values under this name. After this release those values do nothing, and nothing on screen says why.'),\n ...gone\n }\n case 'state-unit-changed':\n return {\n message: say(key('message'), v, `The unit of the control '${v.id}' changed from ${v.before} to ${v.after}.`),\n why: say(key('why'), {}, 'Stored values keep their number. With another unit the same number means something else.'),\n ...gone\n }\n case 'state-range-narrowed':\n return {\n message: say(key('message'), v, `The range of the control '${v.id}' narrowed from ${v.before} to ${v.after}.`),\n why: say(key('why'), {}, 'A value outside the new range may already be stored on a placed instance.')\n }\n case 'state-input-added':\n return {\n message: say(key('message'), v, `The control '${v.id}' is new.`),\n why: say(key('why'), {}, 'Placed instances that give no value stand at its default.')\n }\n case 'clip-gone':\n return {\n message: say(key('message'), v, `The clip '${v.clip}' is gone.`),\n why: say(key('why'), {}, 'Placed instances play clips by name. After this release that one plays nothing.'),\n ...gone\n }\n case 'clip-added':\n return {\n message: say(key('message'), v, `The clip '${v.clip}' is new.`),\n why: say(key('why'), {}, 'It stays still until an instance plays it.')\n }\n case 'binding-gone':\n return {\n message: say(key('message'), v, `The place '${v.binding}' is gone.`),\n why: say(key('why'), {}, 'What sits in it on a placed instance loses its place.'),\n ...gone\n }\n case 'binding-role-changed':\n return {\n message: say(key('message'), v, `The place '${v.binding}' changed from ${v.before} to ${v.after}.`),\n why: say(key('why'), {}, 'What sits in it was placed for the old role.'),\n ...gone\n }\n case 'binding-capacity-reduced':\n return {\n message: say(key('message'), v, `The place '${v.binding}' holds ${v.after} instead of ${v.before}.`),\n why: say(key('why'), {}, 'What sits in the places that went has nowhere to go.'),\n ...gone\n }\n case 'binding-accepts-narrowed':\n return {\n message: say(key('message'), v, `The place '${v.binding}' no longer accepts ${v.types}.`),\n why: say(key('why'), {}, 'What already sits there stays. The next one of that type is refused.')\n }\n case 'binding-added':\n return {\n message: say(key('message'), v, `The place '${v.binding}' is new.`),\n why: say(key('why'), {}, 'Placed instances do not know it yet and stand as they are.')\n }\n /* Slots a slot layout unfolds into, and the anchors they stand on (ADR-0051 §4.1, the old ADR-0118 decision 6). */\n case 'slot-moved':\n return {\n message: say(key('message'), v, `The slot '${v.binding}' is somewhere else on its anchor.`),\n why: say(key('why'), {}, 'What sits in it moves with it. Data that names the slot by its address now means the new place.')\n }\n case 'slot-anchor-gone':\n return {\n message: say(key('message'), v, `The anchor '${v.anchor}' that slots stand on is gone.`),\n why: say(key('why'), {}, 'A placement that lays its own slots on this anchor holds nothing after this release.'),\n ...gone\n }\n case 'slot-anchor-moved':\n return {\n message: say(key('message'), v, `The anchor '${v.anchor}' moved from the ${v.before} face to the ${v.after} face.`),\n why: say(key('why'), {}, 'Every slot on it, and what sits there, stands on the new face after this release.')\n }\n case 'capability-gone':\n return {\n message: say(key('message'), v, `The capability '${v.name}' is gone.`),\n why: say(key('why'), {}, 'Scenes attach behaviour by this name. Placed instances lose what it did.'),\n ...gone\n }\n case 'capability-added':\n return {\n message: say(key('message'), v, `The capability '${v.name}' is new.`),\n why: say(key('why'), {}, 'It adds what the figure can do. Placed instances stand as they are.')\n }\n /* Said, never refused (ADR-0104): a consumer that pins a release reads these before it moves to this one. */\n case 'size-changed':\n return {\n message: say(key('message'), v, `The figure's size changed from ${v.before || 'none'} to ${v.after || 'none'}.`),\n why: say(key('why'), {}, 'A board gives the figure a box of this size. One that moves to this release sees its box change.')\n }\n case 'motion-range-changed':\n return {\n message: say(key('message'), v, `The room the figure sweeps as it moves changed from ${v.before || 'none'} to ${v.after || 'none'}.`),\n why: say(key('why'), {}, 'It is what the figure reaches when it moves. One that moves to this release sees it reach differently.')\n }\n case 'contact-face-changed':\n return {\n message: say(key('message'), v, 'The face the figure is mounted by changed.'),\n why: say(key('why'), {}, 'A consumer that moves to this release sees it stand on the new face.')\n }\n case 'public-input-gone':\n return {\n message: say(key('message'), { ...v, input: change.subject ?? '' }, `'${change.subject}' is no longer set on a board.`),\n why: say(key('why'), {}, 'Values placed instances give it do nothing after this release.')\n }\n case 'public-input-range-narrowed':\n return {\n message: say(key('message'), { ...v, input: change.subject ?? '' }, `The range of '${change.subject}' narrowed from ${v.before} to ${v.after}.`),\n why: say(key('why'), {}, 'An instance may have set a value outside the new range. Which values are placed is not recorded.')\n }\n case 'public-input-added':\n return {\n message: say(key('message'), { ...v, input: change.subject ?? '' }, `'${change.subject}' can now be set on a board.`),\n why: say(key('why'), {}, 'Placed instances that give no value stand at its default.')\n }\n /* A value another product reads by its key (ADR-0123): only a key that goes refuses; what a change means is its owner's. */\n case 'extension-gone':\n return {\n message: say(key('message'), v, `The extension '${v.key}' is gone.`),\n why: say(key('why'), {}, 'Another product reads this value by its key. After this release it finds none.'),\n ...gone\n }\n case 'extension-changed':\n return {\n message: say(key('message'), v, `The value of the extension '${v.key}' changed.`),\n why: say(key('why'), {}, 'The product that owns this key reads the new value and judges the change.')\n }\n case 'extension-added':\n return {\n message: say(key('message'), v, `The extension '${v.key}' is new.`),\n why: say(key('why'), {}, 'The product that owns this key reads this value.')\n }\n /* What a consumer's data mapping and a board's motion selection lean on (ADR-0051 §2.2, §3.2). */\n case 'data-field-gone':\n return {\n message: say(key('message'), v, `The data field '${v.id}' is gone.`),\n why: say(key('why'), {}, 'Boards map their data onto this id. After this release that data moves nothing.'),\n ...gone\n }\n case 'data-field-kind-changed':\n return {\n message: say(key('message'), v, `The data field '${v.id}' changed from ${v.before} to ${v.after}.`),\n why: say(key('why'), {}, 'Mapped data was written for the old kind or unit. After this release the same data is refused or means something else.'),\n ...gone\n }\n case 'data-field-narrowed':\n return {\n message: say(key('message'), v, `The data field '${v.id}' takes less: ${v.before} → ${v.after}.`),\n why: say(key('why'), {}, 'Data with a value it no longer takes is refused whole, and the figure keeps what it showed.'),\n ...gone\n }\n case 'data-field-added':\n return {\n message: say(key('message'), v, `The data field '${v.id}' is new.`),\n why: say(key('why'), {}, 'Until a board maps data onto it, it stands at its default.')\n }\n case 'data-field-label-changed':\n return {\n message: say(key('message'), v, `The data field '${v.id}' is now called '${v.after}'.`),\n why: say(key('why'), {}, 'Mappings name the id, so they keep working.')\n }\n case 'data-field-default-changed':\n return {\n message: say(key('message'), v, `The default of the data field '${v.id}' changed from ${v.before} to ${v.after}.`),\n why: say(key('why'), {}, 'A placed figure with no data or saved value for it stands differently after this release.')\n }\n case 'data-bindings-changed':\n return {\n message: say(key('message'), v, 'What the data moves (its bindings) changed.'),\n why: say(key('why'), {}, 'The same data gives another pose, colour or clip after this release.')\n }\n case 'motion-group-gone':\n return {\n message: say(key('message'), v, `The motion group '${v.group}' is gone.`),\n why: say(key('why'), {}, 'Boards and data choose its clip by this id. After this release that choice does nothing.'),\n ...gone\n }\n case 'motion-group-clip-removed':\n return {\n message: say(key('message'), v, `The motion group '${v.group}' no longer holds '${v.clip}'.`),\n why: say(key('why'), {}, 'A board or data that chooses this clip in the group is refused after this release.'),\n ...gone\n }\n case 'motion-clip-group-changed':\n return {\n message: say(key('message'), v, `The clip '${v.clip}' played on its own and is now in the motion group '${v.group}'.`),\n why: say(key('why'), {}, \"Boards played it by its own speed. After this release it plays only when the group's choice is this clip.\"),\n ...gone\n }\n case 'motion-group-added':\n return {\n message: say(key('message'), v, `The motion group '${v.group}' is new.`),\n why: say(key('why'), {}, 'Placed instances play its default clip until a board or data chooses another.')\n }\n case 'motion-group-clip-added':\n return {\n message: say(key('message'), v, `The motion group '${v.group}' now holds '${v.clip}'.`),\n why: say(key('why'), {}, 'It plays when a board or data chooses it.')\n }\n case 'motion-group-default-changed':\n return {\n message: say(key('message'), v, `The motion group '${v.group}' now starts with '${v.after}', not '${v.before}'.`),\n why: say(key('why'), {}, 'Placed instances with no choice of their own play the new default after this release.')\n }\n case 'motion-group-transition-changed':\n return {\n message: say(key('message'), v, `A change of clip in '${v.group}' now blends over ${v.after} s, not ${v.before} s.`),\n why: say(key('why'), {}, 'Only how a change of clip looks changes; which clip plays does not.')\n }\n /* The joints a controller drives (ADR-0107 decision 7): what writing a state input moves, compared release to release. */\n case 'state-input-joints-changed': {\n const after = v.after || say('figure.gate.contract.joints-none', {}, 'nothing')\n return {\n message: say(key('message'), { ...v, after }, `The control '${v.id}' moved ${v.before}. It now moves ${after}.`),\n why: say(key('why'), {}, 'A controller writes this value to drive those joints. After this release the same value moves other joints, or by other amounts.'),\n ...gone\n }\n }\n case 'joint-axis-changed':\n return {\n message: say(key('message'), v, `The axis of the joint '${v.joint}' changed from ${v.before} to ${v.after}.`),\n why: say(key('why'), {}, \"A controller's stored values turn or slide the joint about this axis. After this release the same value moves it another way.\"),\n ...gone\n }\n case 'joint-motion-unit-changed':\n return {\n message: say(key('message'), v, `The joint '${v.joint}' now moves in ${v.after}, not ${v.before}.`),\n why: say(key('why'), {}, \"A controller's stored values were written for the old unit. After this release the same value means another motion.\"),\n ...gone\n }\n case 'joint-child-changed':\n return {\n message: say(key('message'), v, `The joint '${v.joint}' now moves '${v.after}' instead of '${v.before}'.`),\n why: say(key('why'), {}, \"A controller's values keep their meaning. On screen the joint now moves the new part.\")\n }\n case 'joint-list-unread':\n return {\n message: say(key('message'), v, `The last release's joint list could not be read, so its joints were not compared: ${v.reason}`),\n why: say(key('why'), {}, \"Whether this release changes what a controller's values move has not been checked. The last release was made by a kernel that did not measure joints.\")\n }\n }\n}\n\n/**\n * What a release records about itself (ADR-0104 decision 5): the format its asset is written in, what it measured\n * (its cost at its largest, whether resizing is stretching), its plan from above, and what changed against the previous release -- the kernel's own comparison, kept as it was then so a consumer that pins releases\n * reads it rather than computing it again. `[]` for a first release; `null` when the previous release could not be\n * read, which is a different fact from \"nothing changed\".\n */\nexport function releaseRecordOf(\n sourceJson: string,\n releasedJson?: string | null\n): { source: string; format: string; kernel: string; changes: FigureContractChange[] | null; metrics: FigureReleaseMetrics; topView: FigureTopView } {\n const asset = parseFigureAsset(sourceJson)\n /*\n The release's own copy carries its size range as it is now: the author's ends, and the rest as far as the parts\n allow (ADR-0087 decision 6). A board reads the ends from it and does not measure; the figure's row keeps only what\n the author narrowed.\n */\n const measured = {\n source: serializeFigureAsset(recordFigureInstanceSize(asset)),\n format: asset.version,\n kernel: FIGURE_KERNEL_VERSION,\n metrics: figureReleaseMetricsOf(asset),\n topView: figureTopViewOf(asset, null)\n }\n if (!releasedJson) return { ...measured, changes: [] }\n let before: FigureAsset\n try {\n before = parseFigureAsset(releasedJson)\n } catch {\n return { ...measured, changes: null }\n }\n return { ...measured, changes: figureContractChanges(before, asset) }\n}\n\n/**\n * A release's source made a draft's again (a revert): the size ends its release wrote down, as far as the parts allow,\n * are opened, and the author's own are kept (ADR-0087 decision 6). An author's end that equals the computed one is\n * opened with them.\n */\nexport function draftSourceOfRelease(releasedJson: string): string {\n assertFormat(releasedJson)\n return serializeFigureAsset(forgetRecordedInstanceSize(parseFigureAsset(releasedJson)))\n}\n\n/**\n * What a consumer is handed for a released figure: the asset itself, because what draws it -- `registerFigure` in\n * things-scene -- takes the asset and compiles it with the kernel.\n */\nexport function consumablePayloadOf(sourceJson: string): { asset: FigureAsset } {\n assertFormat(sourceJson)\n const asset = parseFigureAsset(sourceJson)\n compileFigureAsset(asset)\n return { asset }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"figure-format.js","sourceRoot":"","sources":["../../../server/service/figure/figure-format.ts"],"names":[],"mappings":";;;AAwEA,gEAMC;AA0CD,kCAmBC;AAuFD,sCAyDC;AAqXD,0CAyBC;AAOD,oDAGC;AAMD,kDAKC;AA9rBD;;;;;GAKG;AACH,yDAAsU;AAKtU,uDAAuD;AAC1C,QAAA,oBAAoB,GAAG,gBAAgB,CAAA;AAYpD,sDAAsD;AACtD,MAAa,iBAAkB,SAAQ,KAAK;IAG1C,YAAY,QAAyB;QACnC,KAAK,CAAC,iBAAiB,QAAQ,CAAC,MAAM,MAAM,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;QACnF,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAA;QAC/B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAC1B,CAAC;CACF;AARD,8CAQC;AAoCD,MAAM,aAAa,GAAyB,EAAE,CAAA;AAE9C,sHAAsH;AACtH,SAAgB,0BAA0B,CAAC,KAAyB;IAClE,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IACzB,OAAO,GAAG,EAAE;QACV,MAAM,EAAE,GAAG,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;QACvC,IAAI,EAAE,IAAI,CAAC;YAAE,aAAa,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;IAC1C,CAAC,CAAA;AACH,CAAC;AAED,q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GAAG,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE,CAAA;IACtD,IAAI,MAAmB,CAAA;IACvB,IAAI,CAAC;QACH,MAAM,GAAG,IAAA,+BAAgB,EAAC,YAAY,CAAC,CAAA;IACzC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,GAAG,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,CAAA;IACvC,CAAC;IACD,OAAO,EAAE,GAAG,QAAQ,EAAE,OAAO,EAAE,IAAA,oCAAqB,EAAC,MAAM,EAAE,KAAK,CAAC,EAAE,CAAA;AACvE,CAAC;AAED;;;;GAIG;AACH,SAAgB,oBAAoB,CAAC,YAAoB;IACvD,YAAY,CAAC,YAAY,CAAC,CAAA;IAC1B,OAAO,IAAA,mCAAoB,EAAC,IAAA,yCAA0B,EAAC,IAAA,+BAAgB,EAAC,YAAY,CAAC,CAAC,CAAC,CAAA;AACzF,CAAC;AAED;;;GAGG;AACH,SAAgB,mBAAmB,CAAC,UAAkB;IACpD,YAAY,CAAC,UAAU,CAAC,CAAA;IACxB,MAAM,KAAK,GAAG,IAAA,+BAAgB,EAAC,UAAU,CAAC,CAAA;IAC1C,IAAA,iCAAkB,EAAC,KAAK,CAAC,CAAA;IACzB,OAAO,EAAE,KAAK,EAAE,CAAA;AAClB,CAAC","sourcesContent":["/*\n * The doors a stored source goes through: saving (`parseSource`), publishing (`inspectSource`, and the release's own\n * copy in `releaseRecordOf`), bringing a release back as a draft (`draftSourceOfRelease`) and handing it to a board\n * (`consumablePayloadOf`). The format is `figure-asset-1`, and the asset says so in its `version`; a source\n * that does not is refused by name, because a source the server cannot identify is one it must not save.\n */\nimport { FIGURE_KERNEL_VERSION, compileFigureAsset, inspectFigureAsset, isPlaceholderType, parseFigureAsset, serializeFigureAsset, figureContractChanges, figureCostOf, figurePlaneGapOf, figureReleaseMetricsOf, figureScoreOf, figureTopViewOf, forgetRecordedInstanceSize, recordFigureInstanceSize } from '@hatiolab/figure-model'\nimport type { FigureAsset, FigureContractChange, FigureContractError, FigureReleaseMetrics, FigureTopView, FigureViolation } from '@hatiolab/figure-model'\n\nimport type { FigureFinding } from './figure-type.js'\n\n/** The version the format stamps on its own source. */\nexport const FIGURE_ASSET_VERSION = 'figure-asset-1'\n\n/** A source that passed the save door: what is stored, and the numbers the catalogue shows, computed here. */\nexport interface ParsedSource {\n /** The source to store, as the kernel serializes it. */\n source: string\n /** Computed from the source, never taken from the client -- a client's numbers could lie to the catalogue. */\n derived: { score: number; triangles: number; groups: number }\n /** Findings that do not block the save; the caller returns them with the answer. */\n violations: FigureFinding[]\n}\n\n/** The source breaks the format. It is not stored. */\nexport class FigureSourceError extends Error {\n readonly findings: FigureFinding[]\n\n constructor(findings: FigureFinding[]) {\n super(`정본이 형식을 어겼다 — ${findings.length}건: ${findings.map(f => f.code).join(', ')}`)\n this.name = 'FigureSourceError'\n this.findings = findings\n }\n}\n\n/** One thing the release gate found. `blocking` true means the figure cannot be published. */\nexport interface GateFinding {\n code: string\n message: string\n /** **Why it matters.** A measurement alone leaves the reader at \"so what?\". */\n why?: string\n /** **What to change.** By part name and value. */\n how?: string\n /** Where it points: the parts, or the path in the source. */\n at?: string\n blocking: boolean\n}\n\nexport interface Inspection {\n findings: GateFinding[]\n /** Whether anything blocks. The screen locks the button with this. */\n blocked: boolean\n}\n\n/** What an app's release check is shown: the figure's asset, its row's type and category, and the reader's words. */\nexport interface FigureReleaseCheckInput {\n asset: FigureAsset\n type?: string\n category?: string | null\n t?: Translate\n}\n\n/**\n * A check an app adds to releasing (LV figure-server design G10): findings in the gate's own shape, blocking or said.\n * The LV figure-server refuses an origin off the middle of the floor, a receiving side's check (ADR-0104 decision 4),\n * and says its carrier and budget advice.\n */\nexport type FigureReleaseCheck = (input: FigureReleaseCheckInput) => GateFinding[]\n\nconst releaseChecks: FigureReleaseCheck[] = []\n\n/** Adds a check to every release verdict (`inspectFigure`, `releaseFigure`). Returns the way to take it off again. */\nexport function registerFigureReleaseCheck(check: FigureReleaseCheck): () => void {\n releaseChecks.push(check)\n return () => {\n const at = releaseChecks.indexOf(check)\n if (at >= 0) releaseChecks.splice(at, 1)\n }\n}\n\n/** The app's checks on an asset the kernel passed. A check that throws blocks, by name: a check is never skipped. */\nfunction appFindings(input: FigureReleaseCheckInput): GateFinding[] {\n const found: GateFinding[] = []\n for (const check of releaseChecks) {\n try {\n found.push(...check(input))\n } catch (e) {\n found.push({ code: 'release-check-failed', message: `a release check failed: ${(e as Error)?.message ?? String(e)}`, blocking: true })\n }\n }\n return found\n}\n\n/**\n * That the source is JSON and names the format.\n *\n * @throws {FigureSourceError} when the text is not JSON, or does not carry `version: 'figure-asset-1'`.\n */\nfunction assertFormat(sourceJson: string): void {\n let parsed: unknown\n try {\n parsed = JSON.parse(sourceJson)\n } catch (e) {\n throw new FigureSourceError([\n { code: 'source-not-json', message: `정본이 JSON 이 아니다: ${(e as Error).message}`, at: 'source' }\n ])\n }\n if ((parsed as { version?: unknown } | null)?.version !== FIGURE_ASSET_VERSION)\n throw new FigureSourceError([\n { code: 'source-format-unknown', message: `정본의 판을 알 수 없다 — 피규어 자산은 version '${FIGURE_ASSET_VERSION}' 을 적는다`, at: 'version' }\n ])\n}\n\n/**\n * Validates a source and computes what the catalogue shows: the cost from `figureCostOf`, and the score from `figureScoreOf`\n * -- the headroom against placing `LIMITS.screenInstances` of it on one screen (chief architect, 2026-09-24), the\n * same number the modeller's maturity tab shows. An asset that draws nothing has no score, not a full one.\n *\n * @throws {FigureSourceError} when the source breaks the format.\n */\nexport function parseSource(sourceJson: string): ParsedSource {\n assertFormat(sourceJson)\n let asset\n try {\n asset = parseFigureAsset(sourceJson)\n compileFigureAsset(asset)\n } catch (e) {\n const error = e as FigureContractError & { path?: string }\n throw new FigureSourceError([\n { code: error.code ?? 'asset-invalid', message: error.message ?? String(e), at: error.path }\n ])\n }\n const cost = figureCostOf(asset)\n const score = figureScoreOf(asset)\n return {\n source: serializeFigureAsset(asset),\n derived: { score: (score?.score ?? null) as unknown as number, triangles: cost.triangles, groups: cost.groups },\n violations: []\n }\n}\n\n/**\n * Whether this source may be published, and why not.\n *\n * The judgement is `inspectFigureAsset`: every part inside the volume the asset declares, over the whole\n * state range, and the face it says it is mounted on lying in that plane. A verdict reached by sampling is\n * reported as a finding of its own rather than hidden — an author releasing a figure the gate could only\n * sample should be told so, because nothing proved it holds between the states that were checked.\n */\n/** The request's translator. Always called with params — `t(key, undefined)` loses the locale. */\nexport type Translate = (key: string, options?: Record<string, unknown>) => string\n\n/**\n * A finding in the words of the release panel.\n *\n * The gate says what it measured as a code and values (`part`, `axis`, `mm`, `degrees`) and an English `detail`\n * for logs. The sentence an author reads is made here, where the request's language is known (ADR-0054) — not in\n * figure-model, which knows no locale, and not on the screen, which would then have a second account of the same\n * refusal. The English line is the fallback when a key is missing, so a missing translation reads as English\n * rather than as the key printed raw.\n *\n * The words are the modeller's (ADR-0097 §9 Q2 A): 「차지하는 공간」 for the volume a figure takes up, 「부품에 맞추기」 for\n * setting it from the parts, and 「장착면」 for the face it stands on (`figure.text.mounting-face-explained`). A fact, then the way out.\n */\nfunction figureWording(violation: FigureViolation, say: Say): Pick<GateFinding, 'message' | 'why' | 'how'> {\n const part = violation.part ?? ''\n const axis = (violation.axis ?? '').toUpperCase()\n const mm = violation.mm ?? 0\n const degrees = violation.degrees ?? 0\n const key = (field: string) => `figure.gate.${violation.code.toLowerCase().replace(/_/g, '-')}.${field}`\n\n switch (violation.code) {\n case 'PARTS_OFF_PLACEMENT_FACE':\n return {\n message: say(key('message'), { part, mm }, `The mounting face of '${part}' is ${mm} mm off the plane the figure stands on.`),\n why: say(key('why'), {}, 'The figure is declared to stand on that face. If the face does not reach the plane, the figure floats on the board by that much, and whatever is placed on it floats too.'),\n how: say(key('how'), { part, mm }, `Move '${part}' ${mm} mm on Y so the face meets the plane, or choose a different mounting face.`)\n }\n case 'PLACEMENT_FACE_TILTED':\n return {\n message: say(key('message'), { part, degrees }, `The mounting face of '${part}' is tilted ${degrees}° from the plane the figure stands on.`),\n why: say(key('why'), {}, 'A tilted face cannot lie on the plane, so how the figure stands is not settled.'),\n how: say(key('how'), { part }, `Choose a mounting face parallel to the plane, or turn '${part}' upright.`)\n }\n case 'PARTS_SPLIT_ON_RESIZE': {\n /*\n What comes off is every piece but the largest — the figure as the author sees it is the big piece, and the\n small ones are what they will see hanging in the air (2026-09-24).\n */\n const resize = violation.resize!\n const pieces = [...resize.pieces].sort((a, b) => b.length - a.length)\n const parts = pieces.slice(1).flat().map(one => `'${one}'`).join(', ')\n const axes = resize.axes.map(one => one.toUpperCase()).join('·')\n const factor = resize.factor\n return {\n message: say(key('message'), { parts, axes, factor }, `At ${factor}x on ${axes}, ${parts} come away from the rest of the figure.`),\n why: say(key('why'), {}, 'A figure placed at another size shows those parts hanging in the air — to a person, it looks broken.'),\n how: say(key('how'), { parts }, `Fasten ${parts} to a face of the part they rest on, or press \"fix here\" under position in the responsive tab, so they stay put when the figure is resized.`)\n }\n }\n case 'SIZING_NOT_UNIFORM': {\n /* The figure declares it grows by one ratio; these parts keep a size or place of their own (ruling 2026-09-24). */\n const resize = violation.resize!\n const parts = (violation.parts ?? []).map(one => `'${one}'`).join(', ')\n const axes = resize.axes.map(one => one.toUpperCase()).join('·')\n const factor = resize.factor\n return {\n message: say(key('message'), { parts, axes, factor }, `The figure grows by one ratio, but at ${factor}x on ${axes} ${parts} do not grow with it.`),\n why: say(key('why'), {}, 'A figure that grows by one ratio keeps its proportions at any size. A part with a size or place of its own comes apart from the rest.'),\n how: say(key('how'), { parts }, `Let ${parts} follow the figure's size (\"in proportion\" under position in the responsive tab), or remove their own fixed numbers.`)\n }\n }\n }\n}\n\ntype Say = (key: string, params: Record<string, string | number>, english: string) => string\n\n/*\n The sentence is shown as text, never as HTML, so the values go in as they are. i18next escapes interpolated\n values by default, and the screen then showed `'lamp-in'` as `'lamp-in'`.\n*/\nfunction sayerOf(t?: Translate): Say {\n return (key, params, english) =>\n t ? t(key, { ...params, defaultValue: english, interpolation: { escapeValue: false } }) : english\n}\n\nexport function inspectSource(\n sourceJson?: string | null,\n releasedJson?: string | null,\n t?: Translate,\n /** The row's `type` -- the only place the name lives, since the asset carries none. */\n rowType?: string,\n /** The row's category, for an app's release checks (G10). */\n rowCategory?: string | null\n): Inspection {\n if (!sourceJson) {\n return { blocked: true, findings: [{ code: 'no-source', message: '저장된 정본이 없다. 저장하면 발행할 수 있다', blocking: true }] }\n }\n try {\n assertFormat(sourceJson)\n } catch (e) {\n const findings = (e as FigureSourceError).findings ?? [{ code: 'source-unreadable', message: String(e) }]\n return { blocked: true, findings: findings.map(f => ({ ...f, blocking: true })) }\n }\n\n let inspection\n let asset: FigureAsset | undefined\n try {\n asset = parseFigureAsset(sourceJson)\n inspection = inspectFigureAsset(asset)\n } catch (e) {\n const error = e as FigureContractError & { path?: string }\n return {\n blocked: true,\n findings: [{ code: error.code ?? 'asset-invalid', message: error.message ?? String(e), at: error.path, blocking: true }]\n }\n }\n\n const say = sayerOf(t)\n const findings: GateFinding[] = inspection.violations.map(violation => ({\n code: violation.code.toLowerCase().replace(/_/g, '-'),\n ...figureWording(violation, say),\n at: violation.part,\n blocking: true\n }))\n /*\n A machine-made name is refused at release. The asset has no `type`, so the name is read off the row; a new figure\n was once published as `FIGURE_<uuid>` (:3300, 2026-09-24). Publishing freezes the name (ADR-0063 decision 4) and\n boards call a figure by it.\n */\n if (rowType && isPlaceholderType(rowType)) {\n findings.push({\n code: 'type-is-placeholder',\n message: say('figure.gate.type-is-placeholder.message', { type: rowType }, `'${rowType}' is a temporary type given when the figure was first saved.`),\n why: say('figure.gate.type-is-placeholder.why', {}, 'Boards call a figure by its type, and it cannot change once the figure is published.'),\n how: say('figure.gate.type-is-placeholder.how', {}, 'Set the type in the type field, then publish.'),\n blocking: true\n })\n }\n findings.push(...planeGapFindings(asset!, say))\n if (releasedJson) findings.push(...figureContractFindings(asset!, releasedJson, say))\n findings.push(...appFindings({ asset: asset!, type: rowType, category: rowCategory, t }))\n return { blocked: findings.some(finding => finding.blocking), findings }\n}\n\n/*\n Said, never refused: a figure off the plane it is mounted on stands off it on every board -- a conveyor in the air, a\n hoist hung below a floor figure (the walk of 2026-10-18 found each passing release with no word). A gap can be meant,\n and so can a part through the plane, so it does not block. A figure that names its mounting face is checked on that\n face by the gate already; this is for the one that names none.\n*/\ntype Gap = { part: string; mm: number }\nconst PLANE_ENGLISH = {\n floor: {\n clear: (g: Gap) => `'${g.part}' is ${g.mm} mm above the floor.`,\n through: (g: Gap) => `'${g.part}' goes ${g.mm} mm below the floor.`,\n beyond: 'Every part is below the floor.',\n why: 'A board stands this figure on the floor, so it stands so on every board.',\n beyondHow: 'If it hangs from the ceiling, set where it stands to the ceiling.'\n },\n ceiling: {\n clear: (g: Gap) => `'${g.part}' is ${g.mm} mm below the ceiling.`,\n through: (g: Gap) => `'${g.part}' goes ${g.mm} mm above the ceiling.`,\n beyond: 'Every part is above the ceiling.',\n why: 'A board hangs this figure from the ceiling, so it hangs so on every board.',\n beyondHow: 'If it stands on the floor, set where it stands to the floor.'\n },\n wall: {\n clear: (g: Gap) => `'${g.part}' is ${g.mm} mm out from the wall.`,\n through: (g: Gap) => `'${g.part}' goes ${g.mm} mm into the wall.`,\n beyond: 'Every part is behind the wall.',\n why: 'A board puts this figure on the wall, so it sits so on every board.',\n beyondHow: 'Bring the parts out in front of the wall, or choose again where it stands.'\n }\n} as const\nfunction planeGapFindings(asset: FigureAsset, say: Say): GateFinding[] {\n if (asset.mountingFace) return []\n const gap = figurePlaneGapOf(asset)\n if (!gap || gap.touches) return []\n const english = PLANE_ENGLISH[gap.placement]\n const key = `figure.gate.off-mounting-plane.${gap.placement}`\n const kind = gap.beyond ? 'beyond' : gap.mm > 0 ? 'clear' : 'through'\n const said = { part: gap.part, mm: Math.round(Math.abs(gap.mm)) }\n return [\n {\n code: 'off-mounting-plane',\n message: say(`${key}.${kind}.message`, said, kind === 'beyond' ? english.beyond : english[kind](said)),\n why: say(`${key}.why`, {}, english.why),\n how:\n kind === 'beyond'\n ? say(`${key}.beyond.how`, {}, english.beyondHow)\n : say('figure.gate.off-mounting-plane.how', {}, 'Keep it if it is meant. Otherwise fasten that part to the mounting plane, or move it until it meets the plane.'),\n at: gap.part,\n blocking: false\n }\n ]\n}\n\n/**\n * The last release against this one — what the drawings that already hold this type lean on (ADR-0063 decision 3).\n *\n * figure-model names the changes and whether each blocks (`figureContractChanges`); the sentence is made here. When\n * the last release no longer parses, the gate says so rather than passing in silence: a release that was not checked\n * against the last one is a different fact from one that was checked and found safe.\n */\nfunction figureContractFindings(asset: FigureAsset, releasedJson: string, say: Say): GateFinding[] {\n let before: FigureAsset\n try {\n before = parseFigureAsset(releasedJson)\n } catch (e) {\n return [\n {\n code: 'released-unreadable',\n message: say('figure.gate.released-not-compared.message', { reason: (e as Error).message }, `The last release could not be read, so this release was not compared with it: ${(e as Error).message}`),\n why: say('figure.gate.released-not-compared.why', {}, 'Whether this release breaks the instances already placed has not been checked.'),\n blocking: false\n }\n ]\n }\n return figureContractChanges(before, asset).map(change => ({\n code: change.code,\n ...figureContractWording(change, say),\n at: change.subject,\n blocking: change.blocking\n }))\n}\n\n/** One contract change in the words of the release panel. The English line is the fallback for a missing key. */\nfunction figureContractWording(change: FigureContractChange, say: Say): Pick<GateFinding, 'message' | 'why' | 'how'> {\n const v = change.values\n const key = (field: string) => `figure.gate.contract.${change.code}.${field}`\n const gone = {\n how: say('figure.gate.contract.gone.how', {}, 'Put it back as it was, or publish this as a new figure type so the placed ones keep the old one.')\n }\n switch (change.code) {\n case 'placement-changed':\n return {\n message: say(key('message'), v, `Placement changed from ${v.before} to ${v.after}.`),\n why: say(key('why'), {}, 'Placement sets the height of every placed instance. They all move with it.'),\n ...gone\n }\n case 'size-inputs-gone':\n return {\n message: say(key('message'), v, 'The figure no longer takes its size from the place it is given.'),\n why: say(key('why'), {}, 'Placed instances were sized on the board. After this release they all draw at the authored size.'),\n ...gone\n }\n case 'size-inputs-added':\n return {\n message: say(key('message'), v, 'The figure now takes its size from the place it is given.'),\n why: say(key('why'), {}, 'Placed instances now follow their own size on the board.')\n }\n case 'size-range-narrowed':\n return {\n message: say(key('message'), { ...v, input: change.subject ?? '' }, `The size range of ${change.subject} narrowed from ${v.before} to ${v.after}.`),\n why: say(key('why'), {}, 'An instance placed at a size outside the new range will not draw. Which sizes are placed is not recorded.')\n }\n case 'authored-size-changed':\n return {\n message: say(key('message'), v, `The authored size changed from ${v.before} to ${v.after}.`),\n why: say(key('why'), {}, 'Placed instances keep their own size. An instance with no depth of its own takes its depth from this.')\n }\n case 'state-input-gone':\n return {\n message: say(key('message'), v, `The control '${v.id}' is gone.`),\n why: say(key('why'), {}, 'Placed instances and connectors give values under this name. After this release those values do nothing, and nothing on screen says why.'),\n ...gone\n }\n case 'state-unit-changed':\n return {\n message: say(key('message'), v, `The unit of the control '${v.id}' changed from ${v.before} to ${v.after}.`),\n why: say(key('why'), {}, 'Stored values keep their number. With another unit the same number means something else.'),\n ...gone\n }\n case 'state-range-narrowed':\n return {\n message: say(key('message'), v, `The range of the control '${v.id}' narrowed from ${v.before} to ${v.after}.`),\n why: say(key('why'), {}, 'A value outside the new range may already be stored on a placed instance.')\n }\n case 'state-input-added':\n return {\n message: say(key('message'), v, `The control '${v.id}' is new.`),\n why: say(key('why'), {}, 'Placed instances that give no value stand at its default.')\n }\n case 'clip-gone':\n return {\n message: say(key('message'), v, `The clip '${v.clip}' is gone.`),\n why: say(key('why'), {}, 'Placed instances play clips by name. After this release that one plays nothing.'),\n ...gone\n }\n case 'clip-added':\n return {\n message: say(key('message'), v, `The clip '${v.clip}' is new.`),\n why: say(key('why'), {}, 'It stays still until an instance plays it.')\n }\n case 'binding-gone':\n return {\n message: say(key('message'), v, `The place '${v.binding}' is gone.`),\n why: say(key('why'), {}, 'What sits in it on a placed instance loses its place.'),\n ...gone\n }\n case 'binding-role-changed':\n return {\n message: say(key('message'), v, `The place '${v.binding}' changed from ${v.before} to ${v.after}.`),\n why: say(key('why'), {}, 'What sits in it was placed for the old role.'),\n ...gone\n }\n case 'binding-capacity-reduced':\n return {\n message: say(key('message'), v, `The place '${v.binding}' holds ${v.after} instead of ${v.before}.`),\n why: say(key('why'), {}, 'What sits in the places that went has nowhere to go.'),\n ...gone\n }\n case 'binding-accepts-narrowed':\n return {\n message: say(key('message'), v, `The place '${v.binding}' no longer accepts ${v.types}.`),\n why: say(key('why'), {}, 'What already sits there stays. The next one of that type is refused.')\n }\n case 'binding-added':\n return {\n message: say(key('message'), v, `The place '${v.binding}' is new.`),\n why: say(key('why'), {}, 'Placed instances do not know it yet and stand as they are.')\n }\n /* Slots a slot layout unfolds into, and the anchors they stand on (ADR-0051 §4.1, the old ADR-0118 decision 6). */\n case 'slot-moved':\n return {\n message: say(key('message'), v, `The slot '${v.binding}' is somewhere else on its anchor.`),\n why: say(key('why'), {}, 'What sits in it moves with it. Data that names the slot by its address now means the new place.')\n }\n case 'slot-anchor-gone':\n return {\n message: say(key('message'), v, `The anchor '${v.anchor}' that slots stand on is gone.`),\n why: say(key('why'), {}, 'A placement that lays its own slots on this anchor holds nothing after this release.'),\n ...gone\n }\n case 'slot-anchor-moved':\n return {\n message: say(key('message'), v, `The anchor '${v.anchor}' moved from the ${v.before} face to the ${v.after} face.`),\n why: say(key('why'), {}, 'Every slot on it, and what sits there, stands on the new face after this release.')\n }\n case 'capability-gone':\n return {\n message: say(key('message'), v, `The capability '${v.name}' is gone.`),\n why: say(key('why'), {}, 'Scenes attach behaviour by this name. Placed instances lose what it did.'),\n ...gone\n }\n case 'capability-added':\n return {\n message: say(key('message'), v, `The capability '${v.name}' is new.`),\n why: say(key('why'), {}, 'It adds what the figure can do. Placed instances stand as they are.')\n }\n /* Said, never refused (ADR-0104): a consumer that pins a release reads these before it moves to this one. */\n case 'size-changed':\n return {\n message: say(key('message'), v, `The figure's size changed from ${v.before || 'none'} to ${v.after || 'none'}.`),\n why: say(key('why'), {}, 'A board gives the figure a box of this size. One that moves to this release sees its box change.')\n }\n case 'motion-range-changed':\n return {\n message: say(key('message'), v, `The room the figure sweeps as it moves changed from ${v.before || 'none'} to ${v.after || 'none'}.`),\n why: say(key('why'), {}, 'It is what the figure reaches when it moves. One that moves to this release sees it reach differently.')\n }\n case 'contact-face-changed':\n return {\n message: say(key('message'), v, 'The face the figure is mounted by changed.'),\n why: say(key('why'), {}, 'A consumer that moves to this release sees it stand on the new face.')\n }\n case 'public-input-gone':\n return {\n message: say(key('message'), { ...v, input: change.subject ?? '' }, `'${change.subject}' is no longer set on a board.`),\n why: say(key('why'), {}, 'Values placed instances give it do nothing after this release.')\n }\n case 'public-input-range-narrowed':\n return {\n message: say(key('message'), { ...v, input: change.subject ?? '' }, `The range of '${change.subject}' narrowed from ${v.before} to ${v.after}.`),\n why: say(key('why'), {}, 'An instance may have set a value outside the new range. Which values are placed is not recorded.')\n }\n case 'public-input-added':\n return {\n message: say(key('message'), { ...v, input: change.subject ?? '' }, `'${change.subject}' can now be set on a board.`),\n why: say(key('why'), {}, 'Placed instances that give no value stand at its default.')\n }\n /* A value another product reads by its key (ADR-0123): only a key that goes refuses; what a change means is its owner's. */\n case 'extension-gone':\n return {\n message: say(key('message'), v, `The extension '${v.key}' is gone.`),\n why: say(key('why'), {}, 'Another product reads this value by its key. After this release it finds none.'),\n ...gone\n }\n case 'extension-changed':\n return {\n message: say(key('message'), v, `The value of the extension '${v.key}' changed.`),\n why: say(key('why'), {}, 'The product that owns this key reads the new value and judges the change.')\n }\n case 'extension-added':\n return {\n message: say(key('message'), v, `The extension '${v.key}' is new.`),\n why: say(key('why'), {}, 'The product that owns this key reads this value.')\n }\n /* What a consumer's data mapping and a board's motion selection lean on (ADR-0051 §2.2, §3.2). */\n case 'data-field-gone':\n return {\n message: say(key('message'), v, `The data field '${v.id}' is gone.`),\n why: say(key('why'), {}, 'Boards map their data onto this id. After this release that data moves nothing.'),\n ...gone\n }\n case 'data-field-kind-changed':\n return {\n message: say(key('message'), v, `The data field '${v.id}' changed from ${v.before} to ${v.after}.`),\n why: say(key('why'), {}, 'Mapped data was written for the old kind or unit. After this release the same data is refused or means something else.'),\n ...gone\n }\n case 'data-field-narrowed':\n return {\n message: say(key('message'), v, `The data field '${v.id}' takes less: ${v.before} → ${v.after}.`),\n why: say(key('why'), {}, 'Data with a value it no longer takes is refused whole, and the figure keeps what it showed.'),\n ...gone\n }\n case 'data-field-added':\n return {\n message: say(key('message'), v, `The data field '${v.id}' is new.`),\n why: say(key('why'), {}, 'Until a board maps data onto it, it stands at its default.')\n }\n case 'data-field-label-changed':\n return {\n message: say(key('message'), v, `The data field '${v.id}' is now called '${v.after}'.`),\n why: say(key('why'), {}, 'Mappings name the id, so they keep working.')\n }\n case 'data-field-default-changed':\n return {\n message: say(key('message'), v, `The default of the data field '${v.id}' changed from ${v.before} to ${v.after}.`),\n why: say(key('why'), {}, 'A placed figure with no data or saved value for it stands differently after this release.')\n }\n case 'data-bindings-changed':\n return {\n message: say(key('message'), v, 'What the data moves (its bindings) changed.'),\n why: say(key('why'), {}, 'The same data gives another pose, colour or clip after this release.')\n }\n case 'motion-group-gone':\n return {\n message: say(key('message'), v, `The motion group '${v.group}' is gone.`),\n why: say(key('why'), {}, 'Boards and data choose its clip by this id. After this release that choice does nothing.'),\n ...gone\n }\n case 'motion-group-clip-removed':\n return {\n message: say(key('message'), v, `The motion group '${v.group}' no longer holds '${v.clip}'.`),\n why: say(key('why'), {}, 'A board or data that chooses this clip in the group is refused after this release.'),\n ...gone\n }\n case 'motion-clip-group-changed':\n return {\n message: say(key('message'), v, `The clip '${v.clip}' played on its own and is now in the motion group '${v.group}'.`),\n why: say(key('why'), {}, \"Boards played it by its own speed. After this release it plays only when the group's choice is this clip.\"),\n ...gone\n }\n case 'motion-group-added':\n return {\n message: say(key('message'), v, `The motion group '${v.group}' is new.`),\n why: say(key('why'), {}, 'Placed instances play its default clip until a board or data chooses another.')\n }\n case 'motion-group-clip-added':\n return {\n message: say(key('message'), v, `The motion group '${v.group}' now holds '${v.clip}'.`),\n why: say(key('why'), {}, 'It plays when a board or data chooses it.')\n }\n case 'motion-group-default-changed':\n return {\n message: say(key('message'), v, `The motion group '${v.group}' now starts with '${v.after}', not '${v.before}'.`),\n why: say(key('why'), {}, 'Placed instances with no choice of their own play the new default after this release.')\n }\n case 'motion-group-transition-changed':\n return {\n message: say(key('message'), v, `A change of clip in '${v.group}' now blends over ${v.after} s, not ${v.before} s.`),\n why: say(key('why'), {}, 'Only how a change of clip looks changes; which clip plays does not.')\n }\n /* The joints a controller drives (ADR-0107 decision 7): what writing a state input moves, compared release to release. */\n case 'state-input-joints-changed': {\n const after = v.after || say('figure.gate.contract.joints-none', {}, 'nothing')\n return {\n message: say(key('message'), { ...v, after }, `The control '${v.id}' moved ${v.before}. It now moves ${after}.`),\n why: say(key('why'), {}, 'A controller writes this value to drive those joints. After this release the same value moves other joints, or by other amounts.'),\n ...gone\n }\n }\n case 'joint-axis-changed':\n return {\n message: say(key('message'), v, `The axis of the joint '${v.joint}' changed from ${v.before} to ${v.after}.`),\n why: say(key('why'), {}, \"A controller's stored values turn or slide the joint about this axis. After this release the same value moves it another way.\"),\n ...gone\n }\n case 'joint-motion-unit-changed':\n return {\n message: say(key('message'), v, `The joint '${v.joint}' now moves in ${v.after}, not ${v.before}.`),\n why: say(key('why'), {}, \"A controller's stored values were written for the old unit. After this release the same value means another motion.\"),\n ...gone\n }\n case 'joint-child-changed':\n return {\n message: say(key('message'), v, `The joint '${v.joint}' now moves '${v.after}' instead of '${v.before}'.`),\n why: say(key('why'), {}, \"A controller's values keep their meaning. On screen the joint now moves the new part.\")\n }\n case 'joint-list-unread':\n return {\n message: say(key('message'), v, `The last release's joint list could not be read, so its joints were not compared: ${v.reason}`),\n why: say(key('why'), {}, \"Whether this release changes what a controller's values move has not been checked. The last release was made by a kernel that did not measure joints.\")\n }\n }\n}\n\n/**\n * What a release records about itself (ADR-0104 decision 5): the format its asset is written in, what it measured\n * (its cost at its largest, whether resizing is stretching), its plan from above, and what changed against the previous release -- the kernel's own comparison, kept as it was then so a consumer that pins releases\n * reads it rather than computing it again. `[]` for a first release; `null` when the previous release could not be\n * read, which is a different fact from \"nothing changed\".\n */\nexport function releaseRecordOf(\n sourceJson: string,\n releasedJson?: string | null\n): { source: string; format: string; kernel: string; changes: FigureContractChange[] | null; metrics: FigureReleaseMetrics; topView: FigureTopView } {\n const asset = parseFigureAsset(sourceJson)\n /*\n The release's own copy carries its size range as it is now: the author's ends, and the rest as far as the parts\n allow (ADR-0087 decision 6). A board reads the ends from it and does not measure; the figure's row keeps only what\n the author narrowed.\n */\n const measured = {\n source: serializeFigureAsset(recordFigureInstanceSize(asset)),\n format: asset.version,\n kernel: FIGURE_KERNEL_VERSION,\n metrics: figureReleaseMetricsOf(asset),\n topView: figureTopViewOf(asset, null)\n }\n if (!releasedJson) return { ...measured, changes: [] }\n let before: FigureAsset\n try {\n before = parseFigureAsset(releasedJson)\n } catch {\n return { ...measured, changes: null }\n }\n return { ...measured, changes: figureContractChanges(before, asset) }\n}\n\n/**\n * A release's source made a draft's again (a revert): the size ends its release wrote down, as far as the parts allow,\n * are opened, and the author's own are kept (ADR-0087 decision 6). An author's end that equals the computed one is\n * opened with them.\n */\nexport function draftSourceOfRelease(releasedJson: string): string {\n assertFormat(releasedJson)\n return serializeFigureAsset(forgetRecordedInstanceSize(parseFigureAsset(releasedJson)))\n}\n\n/**\n * What a consumer is handed for a released figure: the asset itself, because what draws it -- `registerFigure` in\n * things-scene -- takes the asset and compiles it with the kernel.\n */\nexport function consumablePayloadOf(sourceJson: string): { asset: FigureAsset } {\n assertFormat(sourceJson)\n const asset = parseFigureAsset(sourceJson)\n compileFigureAsset(asset)\n return { asset }\n}\n"]}
|