@things-factory/figure-service 10.1.66 → 10.1.67

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.
Files changed (60) hide show
  1. package/README.md +5 -8
  2. package/dist-server/service/figure/figure-format.d.ts +49 -31
  3. package/dist-server/service/figure/figure-format.js +47 -90
  4. package/dist-server/service/figure/figure-format.js.map +1 -1
  5. package/dist-server/service/figure/figure-history.js +1 -1
  6. package/dist-server/service/figure/figure-history.js.map +1 -1
  7. package/dist-server/service/figure/figure-mutation.js +5 -5
  8. package/dist-server/service/figure/figure-mutation.js.map +1 -1
  9. package/dist-server/service/figure/figure-propose-v3.d.ts +1 -1
  10. package/dist-server/service/figure/figure-propose-v3.js +1 -1
  11. package/dist-server/service/figure/figure-propose-v3.js.map +1 -1
  12. package/dist-server/service/figure/figure-query.d.ts +6 -11
  13. package/dist-server/service/figure/figure-query.js +12 -40
  14. package/dist-server/service/figure/figure-query.js.map +1 -1
  15. package/dist-server/service/figure/figure-rename.js +2 -11
  16. package/dist-server/service/figure/figure-rename.js.map +1 -1
  17. package/dist-server/service/figure/figure-tools.js +32 -112
  18. package/dist-server/service/figure/figure-tools.js.map +1 -1
  19. package/dist-server/service/figure/figure-type.d.ts +0 -17
  20. package/dist-server/service/figure/figure-type.js +4 -71
  21. package/dist-server/service/figure/figure-type.js.map +1 -1
  22. package/dist-server/service/figure/figure-v3-write.d.ts +1 -1
  23. package/dist-server/service/figure/figure-v3-write.js +2 -3
  24. package/dist-server/service/figure/figure-v3-write.js.map +1 -1
  25. package/dist-server/service/figure/figure.d.ts +5 -10
  26. package/dist-server/service/figure/figure.js +6 -11
  27. package/dist-server/service/figure/figure.js.map +1 -1
  28. package/dist-server/service/index.d.ts +1 -1
  29. package/dist-server/service/index.js +1 -1
  30. package/dist-server/service/index.js.map +1 -1
  31. package/dist-server/tsconfig.tsbuildinfo +1 -1
  32. package/package.json +3 -3
  33. package/server/service/figure/figure-blueprint-query.test.ts +29 -48
  34. package/server/service/figure/figure-format.test.ts +54 -110
  35. package/server/service/figure/figure-format.ts +77 -87
  36. package/server/service/figure/figure-history.ts +1 -1
  37. package/server/service/figure/figure-inspect-db.test.ts +1 -11
  38. package/server/service/figure/figure-mutation.ts +7 -7
  39. package/server/service/figure/figure-propose-v3.test.ts +2 -2
  40. package/server/service/figure/figure-propose-v3.ts +1 -1
  41. package/server/service/figure/figure-query.ts +14 -36
  42. package/server/service/figure/figure-rename-db.test.ts +1 -1
  43. package/server/service/figure/figure-rename.test.ts +4 -18
  44. package/server/service/figure/figure-rename.ts +2 -12
  45. package/server/service/figure/figure-tools.test.ts +17 -80
  46. package/server/service/figure/figure-tools.ts +30 -125
  47. package/server/service/figure/figure-type.ts +3 -52
  48. package/server/service/figure/figure-v3-write.ts +3 -4
  49. package/server/service/figure/figure.ts +7 -12
  50. package/server/service/index.ts +1 -1
  51. package/dist-server/service/figure/figure-gate.d.ts +0 -93
  52. package/dist-server/service/figure/figure-gate.js +0 -302
  53. package/dist-server/service/figure/figure-gate.js.map +0 -1
  54. package/dist-server/service/figure/figure-source.d.ts +0 -45
  55. package/dist-server/service/figure/figure-source.js +0 -59
  56. package/dist-server/service/figure/figure-source.js.map +0 -1
  57. package/server/service/figure/figure-gate.test.ts +0 -155
  58. package/server/service/figure/figure-gate.ts +0 -392
  59. package/server/service/figure/figure-source.test.ts +0 -149
  60. package/server/service/figure/figure-source.ts +0 -94
package/README.md CHANGED
@@ -3,18 +3,15 @@
3
3
  저작된 3D 컴포넌트 한 종류(**Figure**)를 저장·검증·조회한다. 컴포넌트 저작도구의
4
4
  서버 몫이고, 화면 몫은 `@things-factory/figure-ui` 다.
5
5
 
6
- ## 무엇을 담나 — `FigureSource` 다
6
+ ## 무엇을 담나 — 도형 자산이다
7
7
 
8
- 정본 형식은 `@hatiolab/figure-model` 이 정한다. **씬 컴포넌트 트리를 담지 않는다.**
9
- 청사진(`FigureBlueprint`)도 저장하지 않는다 — 정본에서 파생되는 캐시이므로 소비하는
10
- 쪽이 `compile()` 로 만든다.
8
+ 형식은 `@hatiolab/figure-model` 이 정한다(`figure-v3-asset-1`). **씬 컴포넌트 트리를 담지 않는다.**
9
+ 컴파일한 것도 저장하지 않는다 — 원본에서 파생되므로 소비하는 쪽이 커널로 컴파일한다.
11
10
 
12
11
  ## 저장 전에 검증한다
13
12
 
14
- `createFigure`·`updateFigure` 는 `figure-model` 의 `validate()` 를 돌린다.
15
-
16
- - `errors` — 형식을 어긴 것. **거절한다**
17
- - `violations` — 한도를 넘은 것. 거절하지 않고 응답에 실어 보낸다
13
+ `createFigure`·`updateFigure` 는 자산을 커널로 컴파일해 본다(`parseSource`). 형식을 어기면 **거절한다.**
14
+ 발행은 따로 판정한다(`inspectSource` — 부품이 선언한 공간 안에 있나, 장착면에 닿나, 크기를 바꿔도 붙어 있나).
18
15
 
19
16
  저작 화면을 못 믿어서가 아니다. **저작 화면을 거치지 않는 길**(가져오기·API·AI)이
20
17
  있기 때문이다.
@@ -1,49 +1,67 @@
1
- import type { Inspection } from './figure-gate.js';
2
- import type { ParsedSource } from './figure-source.js';
3
- export type FigureFormat = 'v2' | 'v3';
4
- /** The version each format stamps on its own source. */
1
+ import type { V3Asset } from '@hatiolab/figure-model';
2
+ import type { FigureFinding } from './figure-type.js';
3
+ /** The version the format stamps on its own source. */
5
4
  export declare const V3_ASSET_VERSION = "figure-v3-asset-1";
5
+ /** A source that passed the save door: what is stored, and the numbers the catalogue shows, computed here. */
6
+ export interface ParsedSource {
7
+ /** The source to store, as the kernel serializes it. */
8
+ source: string;
9
+ /** Computed from the source, never taken from the client -- a client's numbers could lie to the catalogue. */
10
+ derived: {
11
+ score: number;
12
+ triangles: number;
13
+ groups: number;
14
+ };
15
+ /** Findings that do not block the save; the caller returns them with the answer. */
16
+ violations: FigureFinding[];
17
+ }
18
+ /** The source breaks the format. It is not stored. */
19
+ export declare class FigureSourceError extends Error {
20
+ readonly findings: FigureFinding[];
21
+ constructor(findings: FigureFinding[]);
22
+ }
23
+ /** One thing the release gate found. `blocking` true means the figure cannot be published. */
24
+ export interface GateFinding {
25
+ code: string;
26
+ message: string;
27
+ /** **Why it matters.** A measurement alone leaves the reader at "so what?". */
28
+ why?: string;
29
+ /** **What to change.** By part name and value. */
30
+ how?: string;
31
+ /** Where it points: the parts, or the path in the source. */
32
+ at?: string;
33
+ blocking: boolean;
34
+ }
35
+ export interface Inspection {
36
+ findings: GateFinding[];
37
+ /** Whether anything blocks. The screen locks the button with this. */
38
+ blocked: boolean;
39
+ }
6
40
  /**
7
- * Which format this source is written in, read from the `version` the asset carries.
41
+ * Validates a source and computes what the catalogue shows: the cost from `v3CostOf`, and the score from `v3ScoreOf`
42
+ * -- the headroom against placing `LIMITS.screenInstances` of it on one screen (chief architect, 2026-09-24), the
43
+ * same number the modeller's maturity tab shows. An asset that draws nothing has no score, not a full one.
8
44
  *
9
- * @throws {FigureSourceError} when the text is not JSON, or carries no version this server knows.
45
+ * @throws {FigureSourceError} when the source breaks the format.
10
46
  */
11
- export declare function formatOf(sourceJson: string): FigureFormat;
12
- /**
13
- * Validates a source of either format and computes what the catalogue shows.
14
- *
15
- * A V3 asset is measured with `v3CostOf`, which charges the same per-shape estimate V2 charges, so the
16
- * budget columns mean one thing across the two formats. Its `score` is `v3ScoreOf`'s -- the headroom against
17
- * placing `LIMITS.screenInstances` of it on one screen (chief architect, 2026-09-24), the same number the
18
- * modeller's maturity tab shows. An asset that draws nothing has no score, not a full one.
19
- *
20
- * @throws {FigureSourceError} when the source breaks its own format.
21
- */
22
- export declare function parseAnySource(sourceJson: string): ParsedSource & {
23
- format: FigureFormat;
24
- };
47
+ export declare function parseSource(sourceJson: string): ParsedSource;
25
48
  /**
26
49
  * Whether this source may be published, and why not.
27
50
  *
28
- * For V3 the judgement is `inspectV3Asset`: every part inside the volume the asset declares, over the whole
51
+ * The judgement is `inspectV3Asset`: every part inside the volume the asset declares, over the whole
29
52
  * state range, and the face it says it is mounted on lying in that plane. A verdict reached by sampling is
30
53
  * reported as a finding of its own rather than hidden — an author releasing a figure the gate could only
31
54
  * sample should be told so, because nothing proved it holds between the states that were checked.
32
55
  */
33
56
  /** The request's translator. Always called with params — `t(key, undefined)` loses the locale. */
34
57
  export type Translate = (key: string, options?: Record<string, unknown>) => string;
35
- export declare function inspectAnySource(sourceJson?: string | null, releasedJson?: string | null, t?: Translate,
36
- /** The row's `type` — for V3 the only place the name lives, since the asset carries none. */
58
+ export declare function inspectSource(sourceJson?: string | null, releasedJson?: string | null, t?: Translate,
59
+ /** The row's `type` -- the only place the name lives, since the asset carries none. */
37
60
  rowType?: string): Inspection;
38
61
  /**
39
- * What a consumer is handed for a released figure.
40
- *
41
- * V2 hands over a compiled blueprint; V3 hands over the asset itself, because the thing that draws a V3 asset
42
- * — `registerFigureV3` in things-scene — takes the asset and compiles it with the kernel. The format travels
43
- * with it so the consumer calls the right registration rather than sniffing the payload a second time.
62
+ * What a consumer is handed for a released figure: the asset itself, because what draws it -- `registerFigureV3` in
63
+ * things-scene -- takes the asset and compiles it with the kernel.
44
64
  */
45
65
  export declare function consumablePayloadOf(sourceJson: string): {
46
- format: FigureFormat;
47
- blueprint?: unknown;
48
- asset?: unknown;
66
+ asset: V3Asset;
49
67
  };
@@ -1,78 +1,55 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.V3_ASSET_VERSION = void 0;
4
- exports.formatOf = formatOf;
5
- exports.parseAnySource = parseAnySource;
6
- exports.inspectAnySource = inspectAnySource;
3
+ exports.FigureSourceError = exports.V3_ASSET_VERSION = void 0;
4
+ exports.parseSource = parseSource;
5
+ exports.inspectSource = inspectSource;
7
6
  exports.consumablePayloadOf = consumablePayloadOf;
8
7
  /*
9
- * Which format a stored source is written in, and one door per job that reads either.
10
- *
11
- * ## Why this exists
12
- *
13
- * The cutover (ADR-0087) converts assets to V3 and the `source` column holds one or the other while that
14
- * happens. Every server path that reads a source — saving, publishing, restoring a version, handing a
15
- * blueprint to a board — had exactly one implementation, the V2 one, so a V3 asset saved through
16
- * `saveFigureV3` could not be published, restored or drawn. Branching at each of those four places would put
17
- * the same question in four voices; it is asked once, here.
18
- *
19
- * ## How the format is known
20
- *
21
- * The asset says so. A V2 source carries `version: 2`; a V3 asset carries `version: 'figure-v3-asset-1'`.
22
- * Nothing is guessed from the shape of the object: a source that says neither is refused by name, because a
23
- * source the server cannot identify is one it must not save.
24
- *
25
- * ## What is not here
26
- *
27
- * No conversion. This door reads what is stored; turning a V2 asset into a V3 one is `convertV2ToV3`, run
28
- * deliberately against a recoverable copy (the designer's step 3), never as a side effect of a save.
8
+ * The doors a stored source goes through: saving (`parseSource`), publishing (`inspectSource`) and handing it to a
9
+ * board (`consumablePayloadOf`). The format is `figure-v3-asset-1`, and the asset says so in its `version`; a source
10
+ * that does not is refused by name, because a source the server cannot identify is one it must not save.
29
11
  */
30
12
  const figure_model_1 = require("@hatiolab/figure-model");
31
- const figure_gate_js_1 = require("./figure-gate.js");
32
- const figure_source_js_1 = require("./figure-source.js");
33
- /** The version each format stamps on its own source. */
13
+ /** The version the format stamps on its own source. */
34
14
  exports.V3_ASSET_VERSION = 'figure-v3-asset-1';
15
+ /** The source breaks the format. It is not stored. */
16
+ class FigureSourceError extends Error {
17
+ constructor(findings) {
18
+ super(`정본이 형식을 어겼다 — ${findings.length}건: ${findings.map(f => f.code).join(', ')}`);
19
+ this.name = 'FigureSourceError';
20
+ this.findings = findings;
21
+ }
22
+ }
23
+ exports.FigureSourceError = FigureSourceError;
35
24
  /**
36
- * Which format this source is written in, read from the `version` the asset carries.
25
+ * That the source is JSON and names the format.
37
26
  *
38
- * @throws {FigureSourceError} when the text is not JSON, or carries no version this server knows.
27
+ * @throws {FigureSourceError} when the text is not JSON, or does not carry `version: 'figure-v3-asset-1'`.
39
28
  */
40
- function formatOf(sourceJson) {
29
+ function assertFormat(sourceJson) {
41
30
  let parsed;
42
31
  try {
43
32
  parsed = JSON.parse(sourceJson);
44
33
  }
45
34
  catch (e) {
46
- throw new figure_source_js_1.FigureSourceError([
35
+ throw new FigureSourceError([
47
36
  { code: 'source-not-json', message: `정본이 JSON 이 아니다: ${e.message}`, at: 'source' }
48
37
  ]);
49
38
  }
50
- const version = parsed?.version;
51
- if (version === exports.V3_ASSET_VERSION)
52
- return 'v3';
53
- if (typeof version === 'number')
54
- return 'v2';
55
- throw new figure_source_js_1.FigureSourceError([
56
- {
57
- code: 'source-format-unknown',
58
- message: `정본의 판을 알 수 없다 — V2 는 숫자 version 을, V3 자산은 '${exports.V3_ASSET_VERSION}' 을 적는다`,
59
- at: 'version'
60
- }
61
- ]);
39
+ if (parsed?.version !== exports.V3_ASSET_VERSION)
40
+ throw new FigureSourceError([
41
+ { code: 'source-format-unknown', message: `정본의 판을 알 수 없다 — 도형 자산은 version '${exports.V3_ASSET_VERSION}' 을 적는다`, at: 'version' }
42
+ ]);
62
43
  }
63
44
  /**
64
- * Validates a source of either format and computes what the catalogue shows.
45
+ * Validates a source and computes what the catalogue shows: the cost from `v3CostOf`, and the score from `v3ScoreOf`
46
+ * -- the headroom against placing `LIMITS.screenInstances` of it on one screen (chief architect, 2026-09-24), the
47
+ * same number the modeller's maturity tab shows. An asset that draws nothing has no score, not a full one.
65
48
  *
66
- * A V3 asset is measured with `v3CostOf`, which charges the same per-shape estimate V2 charges, so the
67
- * budget columns mean one thing across the two formats. Its `score` is `v3ScoreOf`'s -- the headroom against
68
- * placing `LIMITS.screenInstances` of it on one screen (chief architect, 2026-09-24), the same number the
69
- * modeller's maturity tab shows. An asset that draws nothing has no score, not a full one.
70
- *
71
- * @throws {FigureSourceError} when the source breaks its own format.
49
+ * @throws {FigureSourceError} when the source breaks the format.
72
50
  */
73
- function parseAnySource(sourceJson) {
74
- if (formatOf(sourceJson) === 'v2')
75
- return { ...(0, figure_source_js_1.parseSource)(sourceJson), format: 'v2' };
51
+ function parseSource(sourceJson) {
52
+ assertFormat(sourceJson);
76
53
  let asset;
77
54
  try {
78
55
  asset = (0, figure_model_1.parseV3Asset)(sourceJson);
@@ -80,14 +57,13 @@ function parseAnySource(sourceJson) {
80
57
  }
81
58
  catch (e) {
82
59
  const error = e;
83
- throw new figure_source_js_1.FigureSourceError([
60
+ throw new FigureSourceError([
84
61
  { code: error.code ?? 'v3-asset-invalid', message: error.message ?? String(e), at: error.path }
85
62
  ]);
86
63
  }
87
64
  const cost = (0, figure_model_1.v3CostOf)(asset);
88
65
  const score = (0, figure_model_1.v3ScoreOf)(asset);
89
66
  return {
90
- format: 'v3',
91
67
  source: (0, figure_model_1.serializeV3Asset)(asset),
92
68
  derived: { score: (score?.score ?? null), triangles: cost.triangles, groups: cost.groups },
93
69
  violations: []
@@ -103,8 +79,7 @@ function parseAnySource(sourceJson) {
103
79
  * rather than as the key printed raw.
104
80
  *
105
81
  * The words are the modeller's: 「공간 선언」 for the volume a figure takes up and 「장착면」 for the face it stands on
106
- * (`figure.text.mounting-face-explained`). The same register as the V2 blockers since 2026-09-19 — a fact, then
107
- * the way out — because at ADR-0087 step 5 these become the only findings an author sees.
82
+ * (`figure.text.mounting-face-explained`). A fact, then the way out.
108
83
  */
109
84
  function v3Wording(violation, say, hasParts) {
110
85
  const part = violation.part ?? '';
@@ -153,7 +128,7 @@ function v3Wording(violation, say, hasParts) {
153
128
  case 'PARTS_SPLIT_ON_RESIZE': {
154
129
  /*
155
130
  What comes off is every piece but the largest — the figure as the author sees it is the big piece, and the
156
- small ones are what they will see hanging in the air (V2's sizing-splits, carried to V3 on 2026-09-24).
131
+ small ones are what they will see hanging in the air (2026-09-24).
157
132
  */
158
133
  const resize = violation.resize;
159
134
  const pieces = [...resize.pieces].sort((a, b) => b.length - a.length);
@@ -187,21 +162,19 @@ function v3Wording(violation, say, hasParts) {
187
162
  function sayerOf(t) {
188
163
  return (key, params, english) => t ? t(key, { ...params, defaultValue: english, interpolation: { escapeValue: false } }) : english;
189
164
  }
190
- function inspectAnySource(sourceJson, releasedJson, t,
191
- /** The row's `type` — for V3 the only place the name lives, since the asset carries none. */
165
+ function inspectSource(sourceJson, releasedJson, t,
166
+ /** The row's `type` -- the only place the name lives, since the asset carries none. */
192
167
  rowType) {
193
- if (!sourceJson)
194
- return (0, figure_gate_js_1.inspectSource)(sourceJson, releasedJson);
195
- let format;
168
+ if (!sourceJson) {
169
+ return { blocked: true, findings: [{ code: 'no-source', message: '저장된 정본이 없다. 저장하면 발행할 수 있다', blocking: true }] };
170
+ }
196
171
  try {
197
- format = formatOf(sourceJson);
172
+ assertFormat(sourceJson);
198
173
  }
199
174
  catch (e) {
200
175
  const findings = e.findings ?? [{ code: 'source-unreadable', message: String(e) }];
201
176
  return { blocked: true, findings: findings.map(f => ({ ...f, blocking: true })) };
202
177
  }
203
- if (format === 'v2')
204
- return (0, figure_gate_js_1.inspectSource)(sourceJson, releasedJson);
205
178
  let inspection;
206
179
  let asset;
207
180
  let hasParts = true;
@@ -226,10 +199,9 @@ rowType) {
226
199
  blocking: true
227
200
  }));
228
201
  /*
229
- V2 refuses a machine-made name at release (`type-is-placeholder`, from the source's own `type`). A V3 asset has
230
- no `type`, so that check never ran and a new V3 figure was published as `FIGURE_<uuid>` — seen on :3300,
231
- 2026-09-24. Publishing freezes the name (ADR-0063 decision 4) and boards call a figure by it, so the same
232
- refusal stands here, read off the row.
202
+ A machine-made name is refused at release. The asset has no `type`, so the name is read off the row; a new figure
203
+ was once published as `FIGURE_<uuid>` (:3300, 2026-09-24). Publishing freezes the name (ADR-0063 decision 4) and
204
+ boards call a figure by it.
233
205
  */
234
206
  if (rowType && (0, figure_model_1.isPlaceholderType)(rowType)) {
235
207
  findings.push({
@@ -264,23 +236,12 @@ rowType) {
264
236
  * The last release against this one — what the drawings that already hold this type lean on (ADR-0063 decision 3).
265
237
  *
266
238
  * figure-model names the changes and whether each blocks (`v3ContractChanges`); the sentence is made here. When
267
- * the last release cannot be compared — it was a V2 source, which is what every converted figure's last release
268
- * is, or it no longer parses — the gate says so rather than passing in silence: a release that was not checked
239
+ * the last release no longer parses, the gate says so rather than passing in silence: a release that was not checked
269
240
  * against the last one is a different fact from one that was checked and found safe.
270
241
  */
271
242
  function v3ContractFindings(asset, releasedJson, say) {
272
243
  let before;
273
244
  try {
274
- if (formatOf(releasedJson) === 'v2') {
275
- return [
276
- {
277
- code: 'released-unreadable',
278
- message: say('figure.gate.v3-released-was-v2.message', {}, 'The last release is a V2 figure, so this release was not compared with it.'),
279
- why: say('figure.gate.v3-released-not-compared.why', {}, 'Whether this release breaks the instances already placed has not been checked.'),
280
- blocking: false
281
- }
282
- ];
283
- }
284
245
  before = (0, figure_model_1.parseV3Asset)(releasedJson);
285
246
  }
286
247
  catch (e) {
@@ -410,17 +371,13 @@ function v3ContractWording(change, say) {
410
371
  }
411
372
  }
412
373
  /**
413
- * What a consumer is handed for a released figure.
414
- *
415
- * V2 hands over a compiled blueprint; V3 hands over the asset itself, because the thing that draws a V3 asset
416
- * — `registerFigureV3` in things-scene — takes the asset and compiles it with the kernel. The format travels
417
- * with it so the consumer calls the right registration rather than sniffing the payload a second time.
374
+ * What a consumer is handed for a released figure: the asset itself, because what draws it -- `registerFigureV3` in
375
+ * things-scene -- takes the asset and compiles it with the kernel.
418
376
  */
419
377
  function consumablePayloadOf(sourceJson) {
420
- if (formatOf(sourceJson) === 'v2')
421
- return { format: 'v2', blueprint: (0, figure_model_1.compile)(JSON.parse(sourceJson)) };
378
+ assertFormat(sourceJson);
422
379
  const asset = (0, figure_model_1.parseV3Asset)(sourceJson);
423
380
  (0, figure_model_1.compileV3Asset)(asset);
424
- return { format: 'v3', asset };
381
+ return { asset };
425
382
  }
426
383
  //# sourceMappingURL=figure-format.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"figure-format.js","sourceRoot":"","sources":["../../../server/service/figure/figure-format.ts"],"names":[],"mappings":";;;AAwCA,4BAmBC;AAYD,wCAqBC;AAiHD,4CA0EC;AA+JD,kDAKC;AA3bD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,yDAA2K;AAI3K,qDAAgD;AAChD,yDAAmE;AAKnE,wDAAwD;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EAAE,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,0EAA0E,CAAC;gBACpG,GAAG,IAAI;aACR,CAAA;QACH,KAAK,kBAAkB;YACrB,OAAO;gBACL,OAAO,EAAE,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,mBAAmB,CAAC,CAAC,IAAI,WAAW,CAAC;gBACrE,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,qEAAqE,CAAC;aAChG,CAAA;IACL,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,mBAAmB,CAAC,UAAkB;IACpD,IAAI,QAAQ,CAAC,UAAU,CAAC,KAAK,IAAI;QAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,IAAA,sBAAO,EAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,EAAE,CAAA;IACtG,MAAM,KAAK,GAAG,IAAA,2BAAY,EAAC,UAAU,CAAC,CAAA;IACtC,IAAA,6BAAc,EAAC,KAAK,CAAC,CAAA;IACrB,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAA;AAChC,CAAC","sourcesContent":["/*\n * Which format a stored source is written in, and one door per job that reads either.\n *\n * ## Why this exists\n *\n * The cutover (ADR-0087) converts assets to V3 and the `source` column holds one or the other while that\n * happens. Every server path that reads a source — saving, publishing, restoring a version, handing a\n * blueprint to a board — had exactly one implementation, the V2 one, so a V3 asset saved through\n * `saveFigureV3` could not be published, restored or drawn. Branching at each of those four places would put\n * the same question in four voices; it is asked once, here.\n *\n * ## How the format is known\n *\n * The asset says so. A V2 source carries `version: 2`; a V3 asset carries `version: 'figure-v3-asset-1'`.\n * Nothing is guessed from the shape of the object: a source that says neither is refused by name, because a\n * source the server cannot identify is one it must not save.\n *\n * ## What is not here\n *\n * No conversion. This door reads what is stored; turning a V2 asset into a V3 one is `convertV2ToV3`, run\n * deliberately against a recoverable copy (the designer's step 3), never as a side effect of a save.\n */\nimport { compile, compileV3Asset, inspectV3Asset, isPlaceholderType, parseV3Asset, serializeV3Asset, v3ContractChanges, v3CostOf, v3ScoreOf } from '@hatiolab/figure-model'\nimport type { V3Asset, V3ContractChange, V3ContractError, V3Violation } from '@hatiolab/figure-model'\n\nimport type { GateFinding, Inspection } from './figure-gate.js'\nimport { inspectSource } from './figure-gate.js'\nimport { FigureSourceError, parseSource } from './figure-source.js'\nimport type { ParsedSource } from './figure-source.js'\n\nexport type FigureFormat = 'v2' | 'v3'\n\n/** The version each format stamps on its own source. */\nexport const V3_ASSET_VERSION = 'figure-v3-asset-1'\n\n/**\n * Which format this source is written in, read from the `version` the asset carries.\n *\n * @throws {FigureSourceError} when the text is not JSON, or carries no version this server knows.\n */\nexport function formatOf(sourceJson: string): FigureFormat {\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 const version = (parsed as { version?: unknown } | null)?.version\n if (version === V3_ASSET_VERSION) return 'v3'\n if (typeof version === 'number') return 'v2'\n throw new FigureSourceError([\n {\n code: 'source-format-unknown',\n message: `정본의 판을 알 수 없다 — V2 는 숫자 version 을, V3 자산은 '${V3_ASSET_VERSION}' 을 적는다`,\n at: 'version'\n }\n ])\n}\n\n/**\n * Validates a source of either format and computes what the catalogue shows.\n *\n * A V3 asset is measured with `v3CostOf`, which charges the same per-shape estimate V2 charges, so the\n * budget columns mean one thing across the two formats. Its `score` is `v3ScoreOf`'s -- the headroom against\n * placing `LIMITS.screenInstances` of it on one screen (chief architect, 2026-09-24), the same number the\n * 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 its own format.\n */\nexport function parseAnySource(sourceJson: string): ParsedSource & { format: FigureFormat } {\n if (formatOf(sourceJson) === 'v2') return { ...parseSource(sourceJson), format: 'v2' }\n\n let asset\n try {\n asset = parseV3Asset(sourceJson)\n compileV3Asset(asset)\n } catch (e) {\n const error = e as V3ContractError & { path?: string }\n throw new FigureSourceError([\n { code: error.code ?? 'v3-asset-invalid', message: error.message ?? String(e), at: error.path }\n ])\n }\n const cost = v3CostOf(asset)\n const score = v3ScoreOf(asset)\n return {\n format: 'v3',\n source: serializeV3Asset(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 * For V3 the judgement is `inspectV3Asset`: 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 V3 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: 「공간 선언」 for the volume a figure takes up and 「장착면」 for the face it stands on\n * (`figure.text.mounting-face-explained`). The same register as the V2 blockers since 2026-09-19 — a fact, then\n * the way out — because at ADR-0087 step 5 these become the only findings an author sees.\n */\nfunction v3Wording(violation: V3Violation, say: Say, hasParts: boolean): 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 'PART_OUTSIDE_OCCUPANCY':\n return {\n message: say(key('message'), { part, axis, mm }, `'${part}' goes ${mm} mm past the declared space on ${axis}.`),\n why: say(key('why'), {}, 'The declared space sets the scale a figure is placed at. What lies past it is left out of that scale, so on a board this part lands outside the place given to the figure.'),\n how: say(key('how'), { part, axis, mm }, `Use \"fit to parts\" to declare the space from the parts again, or move '${part}' ${mm} mm inward on ${axis}.`)\n }\n case 'OCCUPANCY_UNDECLARED':\n return violation.axis\n ? {\n message: say(`figure.gate.occupancy-empty-axis.message`, { axis }, `The declared space is empty on ${axis}.`),\n why: say(key('why'), {}, 'Without a declared space the scale a figure is placed at cannot be set.'),\n how: say(key('how'), {}, 'Use \"fit to parts\" to declare the space from the parts as they are now.')\n }\n : {\n message: say(key('message'), {}, 'This figure has not declared the space it takes up.'),\n why: say(key('why'), {}, 'Without a declared space the scale a figure is placed at cannot be set.'),\n /*\n A new figure is refused this way before it has a part, and 「fit to parts」 has nothing to measure then —\n the screen does not offer it. Telling the author to press it sent them looking for a button that was not\n there (:3300, 2026-09-24).\n */\n how: hasParts\n ? say(key('how'), {}, 'Use \"fit to parts\" to declare the space from the parts as they are now.')\n : say(key('how-no-parts'), {}, 'Add a shape first, then use \"fit to parts\" to declare the space from it.')\n }\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 (V2's sizing-splits, carried to V3 on 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 placement, 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 to size\" under size and placement), 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 `&#39;lamp-in&#39;`.\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 inspectAnySource(\n sourceJson?: string | null,\n releasedJson?: string | null,\n t?: Translate,\n /** The row's `type` — for V3 the only place the name lives, since the asset carries none. */\n rowType?: string\n): Inspection {\n if (!sourceJson) return inspectSource(sourceJson, releasedJson)\n\n let format: FigureFormat\n try {\n format = formatOf(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 if (format === 'v2') return inspectSource(sourceJson, releasedJson)\n\n let inspection\n let asset: V3Asset | undefined\n let hasParts = true\n try {\n asset = parseV3Asset(sourceJson)\n inspection = inspectV3Asset(asset)\n const cost = v3CostOf(asset)\n hasParts = cost.groups + cost.hidden > 0\n } catch (e) {\n const error = e as V3ContractError & { path?: string }\n return {\n blocked: true,\n findings: [{ code: error.code ?? 'v3-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 ...v3Wording(violation, say, hasParts),\n at: violation.part,\n blocking: true\n }))\n /*\n V2 refuses a machine-made name at release (`type-is-placeholder`, from the source's own `type`). A V3 asset has\n no `type`, so that check never ran and a new V3 figure was published as `FIGURE_<uuid>` — seen on :3300,\n 2026-09-24. Publishing freezes the name (ADR-0063 decision 4) and boards call a figure by it, so the same\n refusal stands here, read off the row.\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 if (inspection.coverage.method === 'sampled') {\n const states = inspection.coverage.states\n findings.push({\n code: 'state-range-sampled',\n message: say('figure.gate.state-range-sampled.message', { states }, `The whole range of motion could not be proven, so ${states} poses were checked.`),\n why: say('figure.gate.state-range-sampled.why', {}, 'Between the poses that were checked, a part may still go past the declared space.'),\n how: say('figure.gate.state-range-sampled.how', {}, 'Re-author the motion that could not be proven, and the whole range can be proven.'),\n /*\n Which motions stopped the proof, by the name a person gave them: the kernel reports each operation it could\n not prove (`j2-shoulder.chain: compose@1 turns …`), and the screen showed that English list as it was. The\n name before the first dot is the joint or part; the operations stay in the logs.\n */\n at: [...new Set((inspection.coverage.unprovable ?? []).map(entry => entry.split(':')[0]!.split('.')[0]!.trim()).filter(Boolean))].join(' · ') || undefined,\n blocking: false\n })\n }\n if (releasedJson) findings.push(...v3ContractFindings(asset!, releasedJson, say))\n return { blocked: findings.some(finding => finding.blocking), findings }\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 (`v3ContractChanges`); the sentence is made here. When\n * the last release cannot be compared — it was a V2 source, which is what every converted figure's last release\n * is, or it 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 v3ContractFindings(asset: V3Asset, releasedJson: string, say: Say): GateFinding[] {\n let before: V3Asset\n try {\n if (formatOf(releasedJson) === 'v2') {\n return [\n {\n code: 'released-unreadable',\n message: say('figure.gate.v3-released-was-v2.message', {}, 'The last release is a V2 figure, so this release was not compared with it.'),\n why: say('figure.gate.v3-released-not-compared.why', {}, 'Whether this release breaks the instances already placed has not been checked.'),\n blocking: false\n }\n ]\n }\n before = parseV3Asset(releasedJson)\n } catch (e) {\n return [\n {\n code: 'released-unreadable',\n message: say('figure.gate.v3-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.v3-released-not-compared.why', {}, 'Whether this release breaks the instances already placed has not been checked.'),\n blocking: false\n }\n ]\n }\n return v3ContractChanges(before, asset).map(change => ({\n code: change.code,\n ...v3ContractWording(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 v3ContractWording(change: V3ContractChange, 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 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 }\n}\n\n/**\n * What a consumer is handed for a released figure.\n *\n * V2 hands over a compiled blueprint; V3 hands over the asset itself, because the thing that draws a V3 asset\n * — `registerFigureV3` in things-scene — takes the asset and compiles it with the kernel. The format travels\n * with it so the consumer calls the right registration rather than sniffing the payload a second time.\n */\nexport function consumablePayloadOf(sourceJson: string): { format: FigureFormat; blueprint?: unknown; asset?: unknown } {\n if (formatOf(sourceJson) === 'v2') return { format: 'v2', blueprint: compile(JSON.parse(sourceJson)) }\n const asset = parseV3Asset(sourceJson)\n compileV3Asset(asset)\n return { format: 'v3', asset }\n}\n"]}
1
+ {"version":3,"file":"figure-format.js","sourceRoot":"","sources":["../../../server/service/figure/figure-format.ts"],"names":[],"mappings":";;;AAgFA,kCAmBC;AAgHD,sCAwEC;AAiJD,kDAKC;AAjbD;;;;GAIG;AACH,yDAAkK;AAKlK,uDAAuD;AAC1C,QAAA,gBAAgB,GAAG,mBAAmB,CAAA;AAYnD,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;AAqBD;;;;GAIG;AACH,SAAS,YAAY,CAAC,UAAkB;IACtC,IAAI,MAAe,CAAA;IACnB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;IACjC,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,IAAI,iBAAiB,CAAC;YAC1B,EAAE,IAAI,EAAE,iBAAiB,EAAE,OAAO,EAAE,mBAAoB,CAAW,CAAC,OAAO,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE;SAC9F,CAAC,CAAA;IACJ,CAAC;IACD,IAAK,MAAuC,EAAE,OAAO,KAAK,wBAAgB;QACxE,MAAM,IAAI,iBAAiB,CAAC;YAC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AAA;QACH,KAAK,iBAAiB;YACpB,OAAO;gBACL,OAAO,EAAE,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,mBAAmB,CAAC,CAAC,IAAI,YAAY,CAAC;gBACtE,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,0EAA0E,CAAC;gBACpG,GAAG,IAAI;aACR,CAAA;QACH,KAAK,kBAAkB;YACrB,OAAO;gBACL,OAAO,EAAE,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,mBAAmB,CAAC,CAAC,IAAI,WAAW,CAAC;gBACrE,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,qEAAqE,CAAC;aAChG,CAAA;IACL,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,SAAgB,mBAAmB,CAAC,UAAkB;IACpD,YAAY,CAAC,UAAU,CAAC,CAAA;IACxB,MAAM,KAAK,GAAG,IAAA,2BAAY,EAAC,UAAU,CAAC,CAAA;IACtC,IAAA,6BAAc,EAAC,KAAK,CAAC,CAAA;IACrB,OAAO,EAAE,KAAK,EAAE,CAAA;AAClB,CAAC","sourcesContent":["/*\n * The doors a stored source goes through: saving (`parseSource`), publishing (`inspectSource`) and handing it to a\n * board (`consumablePayloadOf`). The format is `figure-v3-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 { compileV3Asset, inspectV3Asset, isPlaceholderType, parseV3Asset, serializeV3Asset, v3ContractChanges, v3CostOf, v3ScoreOf } from '@hatiolab/figure-model'\nimport type { V3Asset, V3ContractChange, V3ContractError, V3Violation } 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 V3_ASSET_VERSION = 'figure-v3-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/**\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-v3-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 !== V3_ASSET_VERSION)\n throw new FigureSourceError([\n { code: 'source-format-unknown', message: `정본의 판을 알 수 없다 — 도형 자산은 version '${V3_ASSET_VERSION}' 을 적는다`, at: 'version' }\n ])\n}\n\n/**\n * Validates a source and computes what the catalogue shows: the cost from `v3CostOf`, and the score from `v3ScoreOf`\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 = parseV3Asset(sourceJson)\n compileV3Asset(asset)\n } catch (e) {\n const error = e as V3ContractError & { path?: string }\n throw new FigureSourceError([\n { code: error.code ?? 'v3-asset-invalid', message: error.message ?? String(e), at: error.path }\n ])\n }\n const cost = v3CostOf(asset)\n const score = v3ScoreOf(asset)\n return {\n source: serializeV3Asset(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 `inspectV3Asset`: 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 V3 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: 「공간 선언」 for the volume a figure takes up and 「장착면」 for the face it stands on\n * (`figure.text.mounting-face-explained`). A fact, then the way out.\n */\nfunction v3Wording(violation: V3Violation, say: Say, hasParts: boolean): 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 'PART_OUTSIDE_OCCUPANCY':\n return {\n message: say(key('message'), { part, axis, mm }, `'${part}' goes ${mm} mm past the declared space on ${axis}.`),\n why: say(key('why'), {}, 'The declared space sets the scale a figure is placed at. What lies past it is left out of that scale, so on a board this part lands outside the place given to the figure.'),\n how: say(key('how'), { part, axis, mm }, `Use \"fit to parts\" to declare the space from the parts again, or move '${part}' ${mm} mm inward on ${axis}.`)\n }\n case 'OCCUPANCY_UNDECLARED':\n return violation.axis\n ? {\n message: say(`figure.gate.occupancy-empty-axis.message`, { axis }, `The declared space is empty on ${axis}.`),\n why: say(key('why'), {}, 'Without a declared space the scale a figure is placed at cannot be set.'),\n how: say(key('how'), {}, 'Use \"fit to parts\" to declare the space from the parts as they are now.')\n }\n : {\n message: say(key('message'), {}, 'This figure has not declared the space it takes up.'),\n why: say(key('why'), {}, 'Without a declared space the scale a figure is placed at cannot be set.'),\n /*\n A new figure is refused this way before it has a part, and 「fit to parts」 has nothing to measure then —\n the screen does not offer it. Telling the author to press it sent them looking for a button that was not\n there (:3300, 2026-09-24).\n */\n how: hasParts\n ? say(key('how'), {}, 'Use \"fit to parts\" to declare the space from the parts as they are now.')\n : say(key('how-no-parts'), {}, 'Add a shape first, then use \"fit to parts\" to declare the space from it.')\n }\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 placement, 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 to size\" under size and placement), 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 `&#39;lamp-in&#39;`.\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): 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: V3Asset | undefined\n let hasParts = true\n try {\n asset = parseV3Asset(sourceJson)\n inspection = inspectV3Asset(asset)\n const cost = v3CostOf(asset)\n hasParts = cost.groups + cost.hidden > 0\n } catch (e) {\n const error = e as V3ContractError & { path?: string }\n return {\n blocked: true,\n findings: [{ code: error.code ?? 'v3-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 ...v3Wording(violation, say, hasParts),\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 if (inspection.coverage.method === 'sampled') {\n const states = inspection.coverage.states\n findings.push({\n code: 'state-range-sampled',\n message: say('figure.gate.state-range-sampled.message', { states }, `The whole range of motion could not be proven, so ${states} poses were checked.`),\n why: say('figure.gate.state-range-sampled.why', {}, 'Between the poses that were checked, a part may still go past the declared space.'),\n how: say('figure.gate.state-range-sampled.how', {}, 'Re-author the motion that could not be proven, and the whole range can be proven.'),\n /*\n Which motions stopped the proof, by the name a person gave them: the kernel reports each operation it could\n not prove (`j2-shoulder.chain: compose@1 turns …`), and the screen showed that English list as it was. The\n name before the first dot is the joint or part; the operations stay in the logs.\n */\n at: [...new Set((inspection.coverage.unprovable ?? []).map(entry => entry.split(':')[0]!.split('.')[0]!.trim()).filter(Boolean))].join(' · ') || undefined,\n blocking: false\n })\n }\n if (releasedJson) findings.push(...v3ContractFindings(asset!, releasedJson, say))\n return { blocked: findings.some(finding => finding.blocking), findings }\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 (`v3ContractChanges`); 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 v3ContractFindings(asset: V3Asset, releasedJson: string, say: Say): GateFinding[] {\n let before: V3Asset\n try {\n before = parseV3Asset(releasedJson)\n } catch (e) {\n return [\n {\n code: 'released-unreadable',\n message: say('figure.gate.v3-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.v3-released-not-compared.why', {}, 'Whether this release breaks the instances already placed has not been checked.'),\n blocking: false\n }\n ]\n }\n return v3ContractChanges(before, asset).map(change => ({\n code: change.code,\n ...v3ContractWording(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 v3ContractWording(change: V3ContractChange, 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 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 }\n}\n\n/**\n * What a consumer is handed for a released figure: the asset itself, because what draws it -- `registerFigureV3` in\n * things-scene -- takes the asset and compiles it with the kernel.\n */\nexport function consumablePayloadOf(sourceJson: string): { asset: V3Asset } {\n assertFormat(sourceJson)\n const asset = parseV3Asset(sourceJson)\n compileV3Asset(asset)\n return { asset }\n}\n"]}
@@ -71,7 +71,7 @@ tslib_1.__decorate([
71
71
  ], FigureHistory.prototype, "state", void 0);
72
72
  tslib_1.__decorate([
73
73
  (0, typeorm_1.Column)({ nullable: true, ...(0, shell_1.longTextColumn)() }),
74
- (0, type_graphql_1.Field)({ nullable: true, description: 'The canonical FigureSource JSON at this version.' }),
74
+ (0, type_graphql_1.Field)({ nullable: true, description: 'The figure asset JSON (figure-v3-asset-1) at this version.' }),
75
75
  tslib_1.__metadata("design:type", String)
76
76
  ], FigureHistory.prototype, "source", void 0);
77
77
  tslib_1.__decor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EAAE,CAAC,OAAsB,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IACjH,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,uDAAuD,EAAE,CAAC;GACxE,aAAa,CAoGzB","sourcesContent":["import { Field, ID, ObjectType, Float, Int } from 'type-graphql'\nimport { Column, Entity, Index, ManyToOne, PrimaryGeneratedColumn, RelationId } from 'typeorm'\n\nimport {\n HistoryActionColumn,\n HistoryActionType,\n HistoryEntityInterface,\n HistoryOriginalIdColumn\n} from '@operato/typeorm-history'\nimport { User } from '@things-factory/auth-base'\nimport { Domain, longTextColumn } from '@things-factory/shell'\n\nimport { Figure } from './figure.js'\n\n/**\n * 발행된 판 하나 — **발행할 때만 남는다.**\n *\n * 저작 중 저장은 여기 오지 않는다. 스냅샷을 뜨는 subscriber 가 `state === 'released'` 인 저장에만\n * 움직인다(`event-subscriber.ts`) — board 가 같은 규칙으로 돈다.\n *\n * ## 왜 통째로 베끼나\n *\n * 판을 되세우려면 그때의 정본만으로는 모자란다. 이름·분류·그림·비용까지 함께 있어야 「그 판이\n * 무엇이었나」를 보여 주고 되돌릴 수 있다. 파생값(점수·삼각형·묶음)도 같이 둔다 — 다시 계산하면\n * 형식이 바뀐 오늘의 값이 나오고, 그것은 그 판의 값이 아니다.\n */\n@Entity()\n@Index('ix_figure_history_0', (history: FigureHistory) => [history.originalId, history.version], { unique: true })\n@ObjectType({ description: 'A released version of a figure — one row per release.' })\nexport class FigureHistory implements HistoryEntityInterface<Figure> {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID, { description: 'Unique identifier for this history record.' })\n readonly id: string\n\n @Column({ nullable: true, default: 1 })\n @Field(type => Int, { nullable: true, description: 'The published version number this record holds.' })\n version?: number = 1\n\n @ManyToOne(type => Domain)\n @Field(type => Domain, { nullable: true, description: 'The domain the figure belonged to.' })\n domain?: Domain\n\n @RelationId((history: FigureHistory) => history.domain)\n domainId?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'The stored identifier of the figure. It never changes.' })\n type?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'The display name at this version.' })\n name?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'The description at this version.' })\n description?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'The classification code at this version.' })\n category?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'The lifecycle state recorded with this version.' })\n state?: 'draft' | 'released'\n\n @Column({ nullable: true, ...longTextColumn() })\n @Field({ nullable: true, description: 'The canonical FigureSource JSON at this version.' })\n source?: string\n\n @Column({ nullable: true, ...longTextColumn() })\n @Field({ nullable: true, description: 'The master-data field definition at this version.' })\n properties?: string\n\n @Column({ nullable: true, ...longTextColumn() })\n @Field({ nullable: true, description: 'The thumbnail as it looked at this version.' })\n thumbnail?: string\n\n /*\n * 그때의 비용이다. 오늘 다시 계산하면 오늘의 형식으로 나온다 — 그 판을 설명하지 못한다.\n */\n @Column({ type: 'float', nullable: true })\n @Field(type => Float, { nullable: true, description: 'Reuse score as computed at this version.' })\n score?: number\n\n @Column({ nullable: true })\n @Field(type => Int, { nullable: true, description: 'Triangle count at this version.' })\n triangles?: number\n\n @Column({ nullable: true })\n @Field(type => Int, { nullable: true, description: 'Material group count at this version.' })\n groups?: number\n\n @Column({ nullable: true, ...longTextColumn() })\n @Field({ nullable: true, description: 'The note left when this version was released.' })\n comment?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'When the original figure was created.' })\n createdAt?: Date\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'When the figure was saved at this version.' })\n updatedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'Who created the original figure.' })\n creator?: User\n\n @RelationId((history: FigureHistory) => history.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'Who released this version.' })\n updater?: User\n\n @RelationId((history: FigureHistory) => history.updater)\n updaterId?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'When the original figure was deleted, if it was.' })\n deletedAt?: Date\n\n @HistoryOriginalIdColumn()\n @Field({ description: 'The id of the figure this version belongs to.' })\n public originalId!: string\n\n @HistoryActionColumn({ nullable: false, type: 'varchar', length: 10 })\n @Field(type => String, { description: 'What produced this record (created · updated · deleted).' })\n public action!: HistoryActionType\n}\n"]}
1
+ {"version":3,"file":"figure-history.js","sourceRoot":"","sources":["../../../server/service/figure/figure-history.ts"],"names":[],"mappings":";;;;AAAA,+CAAgE;AAChE,qCAA8F;AAE9F,8DAKiC;AACjC,yDAAgD;AAChD,iDAA8D;AAI9D;;;;;;;;;;;GAWG;AAII,IAAM,aAAa,GAAnB,MAAM,aAAa;IAAnB;QAOL,YAAO,GAAY,CAAC,CAAA;IA6FtB,CAAC;CAAA,CAAA;AApGY,sCAAa;AAGf;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,EAAE,EAAE,WAAW,EAAE,4CAA4C,EAAE,CAAC;;yCAC9D;AAInB;IAFC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;IACtC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,iDAAiD,EAAE,CAAC;;8CACnF;AAIpB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IACzB,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,oCAAoC,EAAE,CAAC;sCACpF,cAAM;6CAAA;AAGf;IADC,IAAA,oBAAU,EAAC,CAA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N,IAAA,qCAAmB,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;IACrE,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,WAAW,EAAE,0DAA0D,EAAE,CAAC;;6CAClE;wBAnGtB,aAAa;IAHzB,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,qBAAqB,EAAE,CAAC,OAAsB,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IACjH,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,uDAAuD,EAAE,CAAC;GACxE,aAAa,CAoGzB","sourcesContent":["import { Field, ID, ObjectType, Float, Int } from 'type-graphql'\nimport { Column, Entity, Index, ManyToOne, PrimaryGeneratedColumn, RelationId } from 'typeorm'\n\nimport {\n HistoryActionColumn,\n HistoryActionType,\n HistoryEntityInterface,\n HistoryOriginalIdColumn\n} from '@operato/typeorm-history'\nimport { User } from '@things-factory/auth-base'\nimport { Domain, longTextColumn } from '@things-factory/shell'\n\nimport { Figure } from './figure.js'\n\n/**\n * 발행된 판 하나 — **발행할 때만 남는다.**\n *\n * 저작 중 저장은 여기 오지 않는다. 스냅샷을 뜨는 subscriber 가 `state === 'released'` 인 저장에만\n * 움직인다(`event-subscriber.ts`) — board 가 같은 규칙으로 돈다.\n *\n * ## 왜 통째로 베끼나\n *\n * 판을 되세우려면 그때의 정본만으로는 모자란다. 이름·분류·그림·비용까지 함께 있어야 「그 판이\n * 무엇이었나」를 보여 주고 되돌릴 수 있다. 파생값(점수·삼각형·묶음)도 같이 둔다 — 다시 계산하면\n * 형식이 바뀐 오늘의 값이 나오고, 그것은 그 판의 값이 아니다.\n */\n@Entity()\n@Index('ix_figure_history_0', (history: FigureHistory) => [history.originalId, history.version], { unique: true })\n@ObjectType({ description: 'A released version of a figure — one row per release.' })\nexport class FigureHistory implements HistoryEntityInterface<Figure> {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID, { description: 'Unique identifier for this history record.' })\n readonly id: string\n\n @Column({ nullable: true, default: 1 })\n @Field(type => Int, { nullable: true, description: 'The published version number this record holds.' })\n version?: number = 1\n\n @ManyToOne(type => Domain)\n @Field(type => Domain, { nullable: true, description: 'The domain the figure belonged to.' })\n domain?: Domain\n\n @RelationId((history: FigureHistory) => history.domain)\n domainId?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'The stored identifier of the figure. It never changes.' })\n type?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'The display name at this version.' })\n name?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'The description at this version.' })\n description?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'The classification code at this version.' })\n category?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'The lifecycle state recorded with this version.' })\n state?: 'draft' | 'released'\n\n @Column({ nullable: true, ...longTextColumn() })\n @Field({ nullable: true, description: 'The figure asset JSON (figure-v3-asset-1) at this version.' })\n source?: string\n\n @Column({ nullable: true, ...longTextColumn() })\n @Field({ nullable: true, description: 'The master-data field definition at this version.' })\n properties?: string\n\n @Column({ nullable: true, ...longTextColumn() })\n @Field({ nullable: true, description: 'The thumbnail as it looked at this version.' })\n thumbnail?: string\n\n /*\n * 그때의 비용이다. 오늘 다시 계산하면 오늘의 형식으로 나온다 — 그 판을 설명하지 못한다.\n */\n @Column({ type: 'float', nullable: true })\n @Field(type => Float, { nullable: true, description: 'Reuse score as computed at this version.' })\n score?: number\n\n @Column({ nullable: true })\n @Field(type => Int, { nullable: true, description: 'Triangle count at this version.' })\n triangles?: number\n\n @Column({ nullable: true })\n @Field(type => Int, { nullable: true, description: 'Material group count at this version.' })\n groups?: number\n\n @Column({ nullable: true, ...longTextColumn() })\n @Field({ nullable: true, description: 'The note left when this version was released.' })\n comment?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'When the original figure was created.' })\n createdAt?: Date\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'When the figure was saved at this version.' })\n updatedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'Who created the original figure.' })\n creator?: User\n\n @RelationId((history: FigureHistory) => history.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'Who released this version.' })\n updater?: User\n\n @RelationId((history: FigureHistory) => history.updater)\n updaterId?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'When the original figure was deleted, if it was.' })\n deletedAt?: Date\n\n @HistoryOriginalIdColumn()\n @Field({ description: 'The id of the figure this version belongs to.' })\n public originalId!: string\n\n @HistoryActionColumn({ nullable: false, type: 'varchar', length: 10 })\n @Field(type => String, { description: 'What produced this record (created · updated · deleted).' })\n public action!: HistoryActionType\n}\n"]}