@things-factory/figure-ui 10.1.270 โ 10.1.271
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/client/graphql/index.ts +2 -0
- package/client/modeller/data-interface.ts +14 -0
- package/client/modeller/editor-styles.ts +11 -0
- package/client/modeller/editor.ts +39 -11
- package/client/modeller/fasten-form.ts +6 -1
- package/client/modeller/fasten-geometry.ts +11 -1
- package/client/modeller/figure-fasten-drawing.ts +2 -3
- package/client/modeller/figure-preview.ts +9 -1
- package/client/modeller/palette.ts +27 -0
- package/client/modeller/product-session.ts +5 -1
- package/client/types.ts +2 -0
- package/dist-client/graphql/index.js +2 -0
- package/dist-client/graphql/index.js.map +1 -1
- package/dist-client/modeller/clips.d.ts +4 -4
- package/dist-client/modeller/data-interface.d.ts +5 -0
- package/dist-client/modeller/data-interface.js +15 -0
- package/dist-client/modeller/data-interface.js.map +1 -1
- package/dist-client/modeller/editor-styles.js +11 -0
- package/dist-client/modeller/editor-styles.js.map +1 -1
- package/dist-client/modeller/editor.d.ts +6 -0
- package/dist-client/modeller/editor.js +35 -11
- package/dist-client/modeller/editor.js.map +1 -1
- package/dist-client/modeller/fasten-form.js +6 -2
- package/dist-client/modeller/fasten-form.js.map +1 -1
- package/dist-client/modeller/fasten-geometry.d.ts +6 -0
- package/dist-client/modeller/fasten-geometry.js +10 -1
- package/dist-client/modeller/fasten-geometry.js.map +1 -1
- package/dist-client/modeller/figure-fasten-drawing.js +2 -3
- package/dist-client/modeller/figure-fasten-drawing.js.map +1 -1
- package/dist-client/modeller/figure-preview.js +9 -1
- package/dist-client/modeller/figure-preview.js.map +1 -1
- package/dist-client/modeller/links.d.ts +1 -1
- package/dist-client/modeller/palette.d.ts +14 -0
- package/dist-client/modeller/palette.js +23 -0
- package/dist-client/modeller/palette.js.map +1 -1
- package/dist-client/modeller/product-session.js +6 -2
- package/dist-client/modeller/product-session.js.map +1 -1
- package/dist-client/route.d.ts +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-client/types.d.ts +2 -0
- package/dist-client/types.js.map +1 -1
- package/package.json +5 -5
- package/test/data-motion.test.ts +8 -0
- package/test/fasten-form.test.ts +13 -0
- package/test/fasten-geometry.test.ts +25 -1
- package/test/first-part-on-plane.test.ts +52 -0
- package/test/save-landed.test.ts +20 -1
- package/translations/en.json +1 -0
- package/translations/es.json +1 -0
- package/translations/ja.json +1 -0
- package/translations/ko.json +1 -0
- package/translations/ms.json +1 -0
- package/translations/zh.json +1 -0
package/client/graphql/index.ts
CHANGED
|
@@ -473,6 +473,7 @@ export async function inspectFigure(id: string): Promise<FigureInspection> {
|
|
|
473
473
|
how
|
|
474
474
|
at
|
|
475
475
|
blocking
|
|
476
|
+
asNewType
|
|
476
477
|
}
|
|
477
478
|
}
|
|
478
479
|
}
|
|
@@ -504,6 +505,7 @@ export async function inspectFigureDraft(source: string, id?: string): Promise<F
|
|
|
504
505
|
how
|
|
505
506
|
at
|
|
506
507
|
blocking
|
|
508
|
+
asNewType
|
|
507
509
|
}
|
|
508
510
|
}
|
|
509
511
|
}
|
|
@@ -387,6 +387,20 @@ export function sampleOf(
|
|
|
387
387
|
}
|
|
388
388
|
}
|
|
389
389
|
|
|
390
|
+
/**
|
|
391
|
+
* The state inputs a sample of data sets on this figure, by id: what the preview shows for them instead of a slider. None
|
|
392
|
+
* when there is no sample, or the figure refuses it.
|
|
393
|
+
*/
|
|
394
|
+
export function sampledStatesOf(asset: FigureAsset, sample: unknown): Record<string, number> {
|
|
395
|
+
if (sample === null || sample === undefined || !asset.dataInterface) return {}
|
|
396
|
+
try {
|
|
397
|
+
const read = sampleOf(asset, sample)
|
|
398
|
+
return read.issues.length ? {} : Object.fromEntries(Object.entries(read.result.states).map(([id, s]) => [id, s.value]))
|
|
399
|
+
} catch {
|
|
400
|
+
return {}
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
|
|
390
404
|
/** The rows a person gives a value by hand, as a board's saved values: one value, read by a binding, not inside a list. */
|
|
391
405
|
export const valueRowsOf = (asset: FigureAsset): FigureDataRow[] => schemaRowsOf(asset).filter(r => isValue(r.node) && r.bindings.length > 0 && !r.path.includes('[]'))
|
|
392
406
|
|
|
@@ -94,6 +94,17 @@ export const EditorStyles = css`
|
|
|
94
94
|
a promise to whoever draws the figure, is outlined.
|
|
95
95
|
*/
|
|
96
96
|
ox-canvas-bar button[save],
|
|
97
|
+
div[release-blockers] button[as-new-type] {
|
|
98
|
+
justify-self: start;
|
|
99
|
+
margin-top: 4px;
|
|
100
|
+
padding: 4px 10px;
|
|
101
|
+
border: 1px solid var(--md-sys-color-outline);
|
|
102
|
+
border-radius: 999px;
|
|
103
|
+
color: var(--md-sys-color-primary);
|
|
104
|
+
background: var(--md-sys-color-surface);
|
|
105
|
+
font: inherit;
|
|
106
|
+
cursor: pointer;
|
|
107
|
+
}
|
|
97
108
|
ox-canvas-bar button[publish] {
|
|
98
109
|
display: inline-flex;
|
|
99
110
|
align-items: center;
|
|
@@ -50,7 +50,7 @@ import { EditorStyles } from './editor-styles.js'
|
|
|
50
50
|
import { ScrollbarStyles } from '@operato/styles'
|
|
51
51
|
import { alignChanges, canMirror, mirrorEditOf, mirroredClipsOf, mirrorPlanOf, type AlignTool, type MirrorForm } from './align.js'
|
|
52
52
|
import type { FigurePaletteKind, FigurePartRow } from './figure-parts.js'
|
|
53
|
-
import { paletteRecipe } from './palette.js'
|
|
53
|
+
import { firstPartFastensToPlane, paletteRecipe } from './palette.js'
|
|
54
54
|
import { meshChoicesOf, meshPartOf } from './mesh-import.js'
|
|
55
55
|
import './figure-mesh-choice.js'
|
|
56
56
|
import { uploadFigureMesh } from '../graphql/index.js'
|
|
@@ -544,13 +544,8 @@ export class FigureEditor extends LitElement {
|
|
|
544
544
|
}).result as SaveConflictChoice | undefined
|
|
545
545
|
if (this.session !== session || !session.read().conflict) return
|
|
546
546
|
if (choice === 'latest') window.open(location.href, '_blank', 'noopener')
|
|
547
|
-
else if (choice === 'copy')
|
|
548
|
-
|
|
549
|
-
/* The page forgets the row of the figure left: the copy's identifier is asked, not the other's offered. */
|
|
550
|
-
this.dispatchEvent(new CustomEvent('figure-detached', { bubbles: true, composed: true }))
|
|
551
|
-
this.changed()
|
|
552
|
-
await this.save()
|
|
553
|
-
} else if (choice === 'overwrite') {
|
|
547
|
+
else if (choice === 'copy') await this.saveAsNewFigure()
|
|
548
|
+
else if (choice === 'overwrite') {
|
|
554
549
|
const agreed = await OxPrompt.open({
|
|
555
550
|
type: 'warning',
|
|
556
551
|
text: i18next.t('figure.text.overwrite-latest-warning'),
|
|
@@ -562,12 +557,35 @@ export class FigureEditor extends LitElement {
|
|
|
562
557
|
await this.save()
|
|
563
558
|
}
|
|
564
559
|
}
|
|
560
|
+
/**
|
|
561
|
+
* The edits kept apart as a new figure, the one opened left as the server has it: a copy after a save conflict, or a
|
|
562
|
+
* new figure type for edits a released figure cannot take (the release gate's way out, tutorial 2026-11-11). The first
|
|
563
|
+
* save asks its identifier.
|
|
564
|
+
*/
|
|
565
|
+
private async saveAsNewFigure() {
|
|
566
|
+
this.session!.detachAsCopy()
|
|
567
|
+
this.blockersOpen = false
|
|
568
|
+
/* The page forgets the row of the figure left: the copy's identifier is asked, not the other's offered. */
|
|
569
|
+
this.dispatchEvent(new CustomEvent('figure-detached', { bubbles: true, composed: true }))
|
|
570
|
+
this.changed()
|
|
571
|
+
await this.save()
|
|
572
|
+
}
|
|
565
573
|
private add(kind: FigurePaletteKind) {
|
|
566
574
|
if (!this.session) return
|
|
567
575
|
this.run(() => {
|
|
568
576
|
/* The id is figure-model's to choose: what is in use is its rule, not a list the screen keeps. */
|
|
569
|
-
const
|
|
570
|
-
|
|
577
|
+
const asset = this.session!.revisionNow()!.asset
|
|
578
|
+
const part = paletteRecipe(kind, figurePartIdFor(asset, kind))
|
|
579
|
+
/*
|
|
580
|
+
* The first part of a figure that stands on a plane (floor, ceiling, wall) is its base: it is added fastened to
|
|
581
|
+
* that plane, one step of the history, so a size typed next keeps it on the plane instead of sinking through it.
|
|
582
|
+
*/
|
|
583
|
+
if (firstPartFastensToPlane(this.session!.read().geometry ?? [], asset?.placement)) {
|
|
584
|
+
this.session!.applyRecipe([
|
|
585
|
+
{ kind: 'add-part', part },
|
|
586
|
+
{ kind: 'attach', part: part.id, to: { plane: 'mounting-plane' } }
|
|
587
|
+
])
|
|
588
|
+
} else this.session!.add(part)
|
|
571
589
|
this.selected = part.id
|
|
572
590
|
})
|
|
573
591
|
}
|
|
@@ -1615,7 +1633,17 @@ export class FigureEditor extends LitElement {
|
|
|
1615
1633
|
return html`<div release-blockers role="dialog" aria-label=${i18next.t('figure.text.must-fix-to-release')} @keydown=${(e: KeyboardEvent) => e.key === 'Escape' && (this.blockersOpen = false)}>
|
|
1616
1634
|
<ul gate>
|
|
1617
1635
|
<li head>${i18next.t('figure.text.must-fix-to-release')}</li>
|
|
1618
|
-
${blockers.map(finding =>
|
|
1636
|
+
${blockers.map(finding =>
|
|
1637
|
+
renderGateFinding(
|
|
1638
|
+
finding,
|
|
1639
|
+
true,
|
|
1640
|
+
/* A break of the released contract: the edits go out as a new figure type, the placed ones keep the old one. */
|
|
1641
|
+
finding.asNewType
|
|
1642
|
+
? html`<button as-new-type @click=${() => this.saveAsNewFigure()}>${i18next.t('figure.button.save-as-new-type')}</button>`
|
|
1643
|
+
: nothing,
|
|
1644
|
+
parts
|
|
1645
|
+
)
|
|
1646
|
+
)}
|
|
1619
1647
|
</ul>
|
|
1620
1648
|
</div>`
|
|
1621
1649
|
}
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
type Axis
|
|
20
20
|
} from './links.js'
|
|
21
21
|
import type { FigureRevision } from './revision.js'
|
|
22
|
+
import { standsWhereAdded } from './palette.js'
|
|
22
23
|
import { ownerOf } from './fields.js'
|
|
23
24
|
|
|
24
25
|
/*
|
|
@@ -67,7 +68,11 @@ export const freshFasten = (): FastenForm => ({
|
|
|
67
68
|
/** The part's own fastening as a form, or a fresh one: a window opens on what the part has (walk 1, 2026-09-26). */
|
|
68
69
|
export function fastenFormOf(revision: FigureRevision, part: string): FastenForm {
|
|
69
70
|
const own = fasteningOf(revision, part)
|
|
70
|
-
if (!own || own.atOrigin)
|
|
71
|
+
if (!own || own.atOrigin) {
|
|
72
|
+
/* A part still where it was added was put nowhere by the author: fastened, it goes on the face, no gap to keep. */
|
|
73
|
+
const pose = (revision.geometry.find(g => (g as { id: string }).id === part) as { pose?: { r: number[][]; t: number[] } } | undefined)?.pose
|
|
74
|
+
return !own && standsWhereAdded(pose) ? { ...freshFasten(), gapFrom: 'pressed' } : freshFasten()
|
|
75
|
+
}
|
|
71
76
|
/* A gap the record works out is the author's; a number is where the part stands, so aiming again keeps it there. */
|
|
72
77
|
return { ...freshFasten(), ...own, gapFrom: own.gapKept !== undefined ? 'typed' : 'kept' } as FastenForm
|
|
73
78
|
}
|
|
@@ -100,7 +100,8 @@ export function alignmentAt(d: number, face: number | undefined, part: number, e
|
|
|
100
100
|
[-inside, 'min'],
|
|
101
101
|
[inside, 'max']
|
|
102
102
|
] as const)
|
|
103
|
-
|
|
103
|
+
/* Level with an edge whatever the sizes: a part bigger than the face (a mast on a low body) lines up with it too. */
|
|
104
|
+
if (Math.abs(d - at) <= catchMm && inside !== 0) return edges ? { how, caught: 'inside' } : { how: 'mm', mm: Math.round(at), caught: 'inside' }
|
|
104
105
|
for (const at of [-outside, outside]) if (Math.abs(d - at) <= catchMm) return { how: 'mm', mm: Math.round(at), caught: 'outside' }
|
|
105
106
|
}
|
|
106
107
|
return { how: 'mm', mm: Math.round(d) }
|
|
@@ -183,3 +184,12 @@ export function fastenLabelsOf(
|
|
|
183
184
|
if (below - 11 < edge + 2 && below + 3 > edge - 2 && edge + 14 <= height - 4) return { face: facePlace, part: { x: part.x + part.w / 2, y: edge + 14, inside: false } }
|
|
184
185
|
return { face: facePlace, part: { x: part.x + part.w / 2, y: below <= height - 20 ? below : part.y - 5, inside: false } }
|
|
185
186
|
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* How much of an axis the face drawing shows, mm: room around the face for the part to go past its edges by about half
|
|
190
|
+
* itself, and for a part bigger than the face lined up with one of its edges (a mast flush with a low body's bottom) to
|
|
191
|
+
* show whole; a plane with no size, three parts wide.
|
|
192
|
+
*/
|
|
193
|
+
export function drawingSpanOf(face: number | undefined, part: number): number {
|
|
194
|
+
return face !== undefined ? Math.max(face + part, 2 * part - face) : part * 3
|
|
195
|
+
}
|
|
@@ -6,7 +6,7 @@ import { SidePanelStyles } from '@things-factory/figure-viewer/dist-client/side-
|
|
|
6
6
|
import { figureAroundNormalOf, figureAroundOf, figureCaughtAngleOf, figureSurfaceAnglesOf, figureSurfacePlaceOf } from '@hatiolab/figure-model'
|
|
7
7
|
import type { FigureFace, FigureSurfacePlace } from '@hatiolab/figure-model'
|
|
8
8
|
|
|
9
|
-
import { alignmentAt, fastenLabelsOf, offsetOf, overhangOf, screenOf, type FaceView, type FastenMode } from './fasten-geometry.js'
|
|
9
|
+
import { alignmentAt, drawingSpanOf, fastenLabelsOf, offsetOf, overhangOf, screenOf, type FaceView, type FastenMode } from './fasten-geometry.js'
|
|
10
10
|
import type { Alignment } from './links.js'
|
|
11
11
|
|
|
12
12
|
type Axis = 'x' | 'y' | 'z'
|
|
@@ -332,8 +332,7 @@ export class FigureFastenDrawing extends localize(i18next)(LitElement) {
|
|
|
332
332
|
const { h, v, sign } = screenOf(view.axes)
|
|
333
333
|
const W = WHERE_W,
|
|
334
334
|
H = WHERE_H
|
|
335
|
-
|
|
336
|
-
const span = (a: Axis) => (view.face[a] !== undefined ? view.face[a]! + view.part[a] : view.part[a] * 3)
|
|
335
|
+
const span = (a: Axis) => drawingSpanOf(view.face[a], view.part[a])
|
|
337
336
|
const k = Math.min((W - 40) / span(h), (H - 40) / span(v))
|
|
338
337
|
this.scale = k
|
|
339
338
|
const cx = W / 2,
|
|
@@ -12,7 +12,7 @@ import { DEFAULT_VIEW, previewBoardDepth, sceneLook, WORKBENCH, type ViewSetting
|
|
|
12
12
|
import { parametersForClip } from '@things-factory/figure-viewer/dist-client/detail-motion.js'
|
|
13
13
|
import { controlsOf } from '@things-factory/figure-viewer/dist-client/controls.js'
|
|
14
14
|
import { dialShape } from './angle-dial.js'
|
|
15
|
-
import { dataValueAt, domainOf, motionWrittenByData, typedValueOf, valueRowsOf } from './data-interface.js'
|
|
15
|
+
import { dataValueAt, domainOf, motionWrittenByData, sampledStatesOf, typedValueOf, valueRowsOf } from './data-interface.js'
|
|
16
16
|
import { derivedOf, type FigureRevision } from './revision.js'
|
|
17
17
|
import { authoredSizeOf, bodyAtSize, PREVIEW_FACTOR, PREVIEW_WAYS, previewClampsOf, previewInstances, previewOneInstance, previewTypeOf, setupPartOf, sizeSpanOf, sizeWithinRange } from '@things-factory/figure-viewer/dist-client/preview-model.js'
|
|
18
18
|
import { previewSizeWordsOf } from './preview-size.js'
|
|
@@ -550,6 +550,7 @@ export class FigurePreview extends localize(i18next)(LitElement) {
|
|
|
550
550
|
|
|
551
551
|
private renderDrivers(asset: FigureAsset, controls: FigureGraphStateInput[], clips: string[]) {
|
|
552
552
|
const steps = new Map(controlsOf(asset).map(c => [c.id, c.step]))
|
|
553
|
+
const sampledStates = sampledStatesOf(asset, this.sample)
|
|
553
554
|
const changed = controls.filter(c => this.giving[c.id] !== undefined && this.giving[c.id] !== asset.stateDefaults[c.id])
|
|
554
555
|
const fold = html`<button fold-controls aria-expanded=${String(!this.controlsFolded)} @click=${() => (this.controlsFolded = !this.controlsFolded)}>
|
|
555
556
|
${i18next.t(this.controlsFolded ? 'figure.button.controls-unfold' : 'figure.button.controls-fold')}
|
|
@@ -568,6 +569,13 @@ export class FigurePreview extends localize(i18next)(LitElement) {
|
|
|
568
569
|
</button>`
|
|
569
570
|
: nothing}
|
|
570
571
|
${controls.map(control => {
|
|
572
|
+
/* A control the data tab's sample sets is what the figure shows, as a value row the sample gives: said, not offered. */
|
|
573
|
+
const fromSample = sampledStates[control.id]
|
|
574
|
+
if (fromSample !== undefined)
|
|
575
|
+
return html`<label sampled title=${i18next.t('figure.text.data-value-from-sample')}>
|
|
576
|
+
<span>${asset.stateInputs?.[control.id]?.label ?? control.id} <span drive>${i18next.t('figure.label.data-value-from-sample')}</span></span>
|
|
577
|
+
<output>${Math.round(fromSample * 100) / 100} ${unitWord(control.unit)}</output>
|
|
578
|
+
</label>`
|
|
571
579
|
const value = this.giving[control.id] ?? asset.stateDefaults[control.id] ?? control.min
|
|
572
580
|
/* The step the editor's controls take (\`controlsOf\`): a degree for an angle, a hundredth of the range otherwise. */
|
|
573
581
|
const step = steps.get(control.id) ?? (control.max - control.min) / 100
|
|
@@ -69,3 +69,30 @@ export function paletteRecipe(kind: FigurePaletteKind, id: string): FigurePrimit
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Whether a part added now is the figure's base, added fastened to its mounting plane: the figure has no part yet and
|
|
75
|
+
* stands on a plane -- the floor (also when not said), the ceiling or a wall. A centred figure has no plane to stand on.
|
|
76
|
+
*/
|
|
77
|
+
export function firstPartFastensToPlane(drawn: readonly unknown[], placement: string | undefined): boolean {
|
|
78
|
+
return drawn.length === 0 && placement !== 'center'
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const PALETTE_KINDS: FigurePaletteKind[] = ['box', 'cylinder', 'rounded-box', 'sphere', 'frustum', 'polygon', 'pyramid', 'pipe', 'plate', 'wall', 'hollow-box', 'portal']
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Whether a drawn part still stands where the palette put it -- unturned, at one of the places a part is added at. Such a
|
|
85
|
+
* part was not placed by the author: fastening it has no place of theirs to keep (tutorial 2026-11-11, a mast added
|
|
86
|
+
* inside the body was fastened 550 mm deep in it).
|
|
87
|
+
*/
|
|
88
|
+
export function standsWhereAdded(pose: { r: number[][]; t: number[] } | undefined): boolean {
|
|
89
|
+
if (!pose) return false
|
|
90
|
+
const unturned = pose.r.every((row, i) => row.every((v, j) => Math.abs(v - (i === j ? 1 : 0)) < 1e-9))
|
|
91
|
+
return (
|
|
92
|
+
unturned &&
|
|
93
|
+
PALETTE_KINDS.some(kind => {
|
|
94
|
+
const { x, y, z } = paletteRecipe(kind, 'p').position
|
|
95
|
+
return [x, y, z].every((v, i) => Math.abs(v - pose.t[i]!) < 1e-6)
|
|
96
|
+
})
|
|
97
|
+
)
|
|
98
|
+
}
|
|
@@ -265,7 +265,11 @@ export function createFigureProductSession(store: FigureProductStore) {
|
|
|
265
265
|
*/
|
|
266
266
|
detachAsCopy() {
|
|
267
267
|
if (saving) throw refusal('SESSION_SAVING', '์ ์ฅ์ด ๋๋ ๋ค ํธ์งํด ์ฃผ์ธ์.')
|
|
268
|
-
|
|
268
|
+
/*
|
|
269
|
+
After a conflict, or to release edits that break the released contract as a new figure type (the release gate's
|
|
270
|
+
way out, tutorial 2026-11-11): either way the figure it came from stays as the server has it.
|
|
271
|
+
*/
|
|
272
|
+
if (!conflict && !id) throw refusal('SESSION_NOT_SAVED', '์ ์ฅ๋ ํผ๊ท์ด๊ฐ ์๋๋๋ค.')
|
|
269
273
|
id = undefined
|
|
270
274
|
baseline = undefined
|
|
271
275
|
creationId = crypto.randomUUID()
|
package/client/types.ts
CHANGED
|
@@ -122,6 +122,8 @@ export interface FigureGateFinding {
|
|
|
122
122
|
/** ๊ฐ๋ผ์ง ๋ถํ ์ด๋ฆ๋ค, ๋๋ ์ ๋ณธ ์์ ๊ฒฝ๋ก. */
|
|
123
123
|
at?: string
|
|
124
124
|
blocking: boolean
|
|
125
|
+
/** ๋ฐํ ๊ณ์ฝ์ด ๊นจ์ง โ ์ ํผ๊ท์ด ํ์
์ผ๋ก ์ ์ฅํ๋ฉด ๋ฐํ๋๊ณ , ๋์ธ ํผ๊ท์ด๋ ์ ์ ์๋ฅผ ์ ์งํ๋ค. */
|
|
126
|
+
asNewType?: boolean
|
|
125
127
|
}
|
|
126
128
|
|
|
127
129
|
/** ๋ฐํํด๋ ๋๋. `blocked` ๋ฉด ์๋ฒ๊ฐ ๊ฑฐ์ ํ๋ค. */
|
|
@@ -368,6 +368,7 @@ export async function inspectFigure(id) {
|
|
|
368
368
|
how
|
|
369
369
|
at
|
|
370
370
|
blocking
|
|
371
|
+
asNewType
|
|
371
372
|
}
|
|
372
373
|
}
|
|
373
374
|
}
|
|
@@ -397,6 +398,7 @@ export async function inspectFigureDraft(source, id) {
|
|
|
397
398
|
how
|
|
398
399
|
at
|
|
399
400
|
blocking
|
|
401
|
+
asNewType
|
|
400
402
|
}
|
|
401
403
|
}
|
|
402
404
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../client/graphql/index.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAuB,MAAM,kBAAkB,CAAA;AAE7E,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAYjD;;;;;;;;;;GAUG;AACH,SAAS,MAAM,CAAI,QAAqF,EAAE,KAAa;IACrH,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,CAAA;IAC1C,yHAAyH;IACzH,MAAM,UAAU,GAAI,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,CAAoD,EAAE,UAAU,CAAA;IACvG,IAAI,IAAI;QAAE,MAAM,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;IAE7G,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;QACnB,oGAAoG;QACpG,OAAO,CAAC,KAA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,EAAE,GAAG,CAAA;;;;;;;KAOZ;QACD,SAAS,EAAE,EAAE,IAAI,EAAE;QACnB,OAAO,EAAE,aAAa,CAAC,UAAU,CAAC;KACnC,CAAC,CAAA;IACF,OAAO,MAAM,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAA;AAC7C,CAAC","sourcesContent":["import gql from 'graphql-tag'\nimport { i18next } from '@operato/i18n'\nimport { client, uploadContext, type UploadProgress } from '@operato/graphql'\n\nimport { reached, refusedIn } from './reached.js'\n\nimport type {\n Figure,\n FigureFinding,\n FigureInspection,\n FigureListResult,\n FigurePatch,\n FigureVersion,\n NewFigure\n} from '../types.js'\n\n/**\n * ์๋ต์์ ๊ฐ์ ๊บผ๋ธ๋ค. **์๋ฒ๊ฐ ๋งํ ์ฌ์ ๋ฅผ ๊ทธ๋๋ก ์ฌ๋ฆฐ๋ค.**\n *\n * ์ ์๋ `response.data.figures` ์ฒ๋ผ ๋ฐ๋ก ๊บผ๋๋ค. ์๋ฒ๊ฐ ์ค๋ฅ๋ฅผ ๋๋ ค์ฃผ๋ฉด `data` ๊ฐ\n * ์์ผ๋ฏ๋ก `Cannot read properties of undefined (reading 'figures')` ๊ฐ ๋ฌ๊ณ , ํ๋ฉด์๋\n * ๊ทธ ๋ฌธ์ฅ์ด ๊ทธ๋๋ก ๋ด๋ค. ์ฌ์ฉ์๋ ์๊ธฐ๊ฐ ๋ฌด์์ ์๋ชปํ๋์ง ์ ์ ์๋ค โ ์ค์ ๋ก AI\n * ์์ฒญ์์ ๊ทธ๋ ๊ฒ ๋ฌ๋ค.\n *\n * ๊ฐ์ด `null` ์ธ ๊ฒ์ ์ค๋ฅ๊ฐ ์๋๋ค. ์ง์ด ๊ฒ์ ๋ฌผ์์ ๋์ฒ๋ผ ์๋ ๊ฒ์ด ๋ต์ธ ๊ฒฝ์ฐ๊ฐ ์๋ค.\n * ์ฌ๊ธฐ์ ๋ง๋ ๊ฒ์ **`data` ์์ฒด๊ฐ ์๋ ๊ฒ**์ด๋ค.\n */\nfunction unwrap<T>(response: { data?: Record<string, unknown>; errors?: readonly { message: string }[] }, field: string): T {\n const said = response.errors?.[0]?.message\n /* The server's code and details go with its words: a conflict is told apart from a refusal (FIGURE_CATALOG_CONFLICT). */\n const extensions = (response.errors?.[0] as { extensions?: { code?: string } } | undefined)?.extensions\n if (said) throw Object.assign(new Error(said), extensions?.code ? { code: extensions.code, extensions } : {})\n\n if (!response.data) {\n /* The field name stays off the screen because the user cannot act on it; it goes to the console. */\n console.error(`[figure-ui] the server returned no data for ${field}`)\n throw new Error(i18next.t('figure.text.server-returned-no-data'))\n }\n\n return response.data[field] as T\n}\n\n\n/**\n * ๋ชฉ๋ก์ ํ์ํ ํ๋๋ง ๊ฐ์ ธ์จ๋ค โ `source` ๋ ๋ฌด๊ฒ๊ณ ๋ชฉ๋ก์์ ์ฐ์ง ์๋๋ค.\n *\n * **`thumbnail` ๋ ์ฌ๊ธฐ ์๋ค.** base64 ๋ฌธ์์ด์ด๋ผ ๋ชฉ๋ก ์๋ต์ ์ค์ผ๋ฉด ์นดํ๋ก๊ทธ๋ฅผ ์ด ๋๋ง๋ค ๊ทธ๋ฆผ\n * ์ ๋ถ๊ฐ ๋ค์ ์ค๊ณ (ํ๋ณธ 14๊ฐ 227KB), data URL ์ ๋ธ๋ผ์ฐ์ ๊ฐ ์บ์ํ์ง ๋ชปํ๋ค. ๊ทธ๋ฆผ์ ์ฃผ์๋ก\n * ๋ถ๋ฅธ๋ค(`figure-thumbnail` ๋ผ์ฐํธ). ๋์ `thumbnailUpdatedAt` ์ ๋ฐ๋๋ค โ ๊ทธ๋ฆผ์ด ์๋ ์๋๋ฅผ\n * ๊ทธ๊ฒ์ผ๋ก ์๊ณ , ๋ฒ์ ์ ๊ฐ๋ฆฌ๋ ๊ฐ์ผ๋ก๋ ์ด๋ค.\n */\nconst FIGURE_LIST_FIELDS = `\n id\n namespace\n type\n name\n description\n category\n tags\n state\n version\n deprecated\n supersededBy\n public\n score\n triangles\n groups\n thumbnailUpdatedAt\n updatedAt\n updater { id name }\n`\n\n/**\n * ๋ชฉ๋ก์ ๊ฐ์ ธ์จ๋ค.\n *\n * ๊ฑธ๋ฌ ๋ณด๊ธฐยท์ ๋ ฌยท์ชฝ ๋๋๊ธฐ๋ฅผ **๊ทธ๋๋ก ๋๊ธด๋ค.** ํ๋ฉด์ด `search`ยท`state` ๊ฐ์ ์ด๋ฆ์ ๋ฐ๋ก ๋ง๋ค์ด\n * filter ๋ก ์ฎ๊ธฐ๋ ๊ฒ์ ๊ทธ๋ง๋์๋ค โ ๊ทธ ์ด๋ฆ๋ค์ ๊ฒฉ์(ox-grist)๊ฐ ์ด๋ฏธ ์ปฌ๋ผ ์ค์ ์์ ๋ง๋ค์ด ์ฃผ๊ณ ,\n * ์ค๊ฐ์ ํ ๋ฒ ๋ ๋๋ฉด ๊ฒฉ์๊ฐ ์๋ ์กฐ๊ฑด๊ณผ ์๋ฒ์ ๊ฐ๋ ์กฐ๊ฑด์ด ์ด๊ธ๋๋ค.\n */\n/** How many of the domain's figures each state chip would show (draft, released), under the list's other conditions. */\nexport async function fetchFigureStateCounts(filters: unknown[], signal?: AbortSignal): Promise<Record<string, number>> {\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!]) {\n figureStateCounts(filters: $filters) { value count }\n }\n `,\n variables: { filters },\n fetchPolicy: 'no-cache',\n context: { fetchOptions: { signal }, queryDeduplication: false }\n })\n if (response.errors?.length) throw new Error(response.errors.map(one => one.message).join(' ยท '))\n return Object.fromEntries((response.data?.figureStateCounts ?? []).map((row: { value: string; count: number }) => [row.value, row.count]))\n}\n\nexport async function fetchFigureList(params: {\n page?: number\n limit?: number\n filters?: unknown[]\n sortings?: { name: string; desc?: boolean }[]\n /** 'public': other domains' public figures, with their domain (LV figure-server design G2). The domain's own by default. */\n scope?: 'own' | 'public'\n}): Promise<FigureListResult> {\n const field = params.scope === 'public' ? 'publicFigures' : 'figures'\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {\n ${field}(filters: $filters, pagination: $pagination, sortings: $sortings) {\n items { ${FIGURE_LIST_FIELDS} ${params.scope === 'public' ? 'domain { id name subdomain }' : ''} }\n total\n }\n }\n `,\n variables: {\n filters: params.filters ?? [],\n pagination: { page: params.page ?? 1, limit: params.limit ?? 30 },\n sortings: params.sortings?.length ? params.sortings : [{ name: 'updatedAt', desc: true }]\n },\n fetchPolicy: 'network-only'\n })\n\n return unwrap<FigureListResult>(response, field)\n}\n\n/** ์ ์๋ฉด์ ํ์ํ ์ ๋ถ โ `source` ๋ฅผ ํฌํจํ๋ค. */\nexport async function fetchFigure(id: string): Promise<Figure> {\n const response = await client.query({\n query: gql`\n query ($id: String!) {\n figure(id: $id) {\n ${FIGURE_LIST_FIELDS}\n source\n properties\n }\n }\n `,\n variables: { id },\n fetchPolicy: 'network-only'\n })\n\n return unwrap<Figure>(response, 'figure')\n}\n\n/**\n * ์ด๋ฏธ ์ฐ์ด๊ณ ์๋ ํ์
์ด๋ฆ.\n *\n * `type` ์ ๋ง๋ ๋ค์ ๊ณ ์น ์ ์์ผ๋ฏ๋ก **๋ง๋ค๊ธฐ ์ ์** ์๋ ค ์ค์ผ ํ๋ค. ์ ์ฅ์ ๋๋ฌ\n * ๊ฑฐ์ ๋นํ๊ณ ๋์ ์๋ ๊ฒ์ ๋ฆ๋ค.\n */\nexport async function fetchFigureTypeNames(): Promise<string[]> {\n const response = await client.query({\n query: gql`\n query {\n figureTypeNames\n }\n `,\n fetchPolicy: 'network-only'\n })\n\n return unwrap<string[] | null>(response, 'figureTypeNames') ?? []\n}\n\nexport interface SaveResult {\n figure: Figure\n /** ๋ง์ง ์๋ ๋ฐ๊ฒฌ. ์ ์ฅ์ ๋์ง๋ง ํ๋ฉด์ด ๋ณด์ฌ ์ค์ผ ํ๋ค. */\n violations: FigureFinding[]\n}\n\nexport async function createFigure(figure: NewFigure): Promise<SaveResult> {\n const response = await client.mutate({\n mutation: gql`\n mutation ($figure: NewFigure!) {\n createFigure(figure: $figure) {\n figure { ${FIGURE_LIST_FIELDS} source }\n violations { code message at }\n }\n }\n `,\n variables: { figure }\n })\n\n return unwrap<SaveResult>(response, 'createFigure')\n}\n\n/** The type, category and tags as the editor saw them; null is \"was empty\". The update goes on only while the row holds them. */\nexport interface FigureCatalogSeen {\n type?: string | null\n category?: string | null\n tags?: string[] | null\n}\n\nexport async function updateFigure(id: string, patch: FigurePatch, seen?: FigureCatalogSeen): Promise<SaveResult> {\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $patch: FigurePatch!, $seen: FigureCatalogSeen) {\n updateFigure(id: $id, patch: $patch, seen: $seen) {\n figure { ${FIGURE_LIST_FIELDS} source }\n violations { code message at }\n }\n }\n `,\n variables: { id, patch, ...(seen ? { seen } : {}) }\n })\n\n return unwrap<SaveResult>(response, 'updateFigure')\n}\n\n/** Makes a released figure public to other domains, or private again (LV figure-server design G2). */\nexport async function setFigurePublic(id: string, isPublic: boolean): Promise<Figure> {\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $public: Boolean!) {\n setFigurePublic(id: $id, public: $public) {\n ${FIGURE_LIST_FIELDS}\n }\n }\n `,\n variables: { id, public: isPublic }\n })\n\n return unwrap<Figure>(response, 'setFigurePublic')\n}\n\n/** Retires a released figure, naming the type to use instead, or brings it back. Release rows are not touched. */\nexport async function setFigureDeprecation(id: string, deprecated: boolean, supersededBy?: string | null): Promise<Figure> {\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $deprecated: Boolean!, $supersededBy: String) {\n setFigureDeprecation(id: $id, deprecated: $deprecated, supersededBy: $supersededBy) {\n ${FIGURE_LIST_FIELDS}\n }\n }\n `,\n variables: { id, deprecated, supersededBy: supersededBy || null }\n })\n\n return unwrap<Figure>(response, 'setFigureDeprecation')\n}\n\nexport async function deleteFigure(id: string): Promise<boolean> {\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!) {\n deleteFigure(id: $id)\n }\n `,\n variables: { id }\n })\n\n return unwrap<boolean>(response, 'deleteFigure')\n}\n\n/**\n * ๋ฐํํ๋ค โ ๋ฒ์ ๋ฒํธ๊ฐ ์ค๋ฅด๊ณ , ๊ทธ ์๊ฐ์ด ๋ฒ์ ์ผ๋ก ๋จ๋๋ค.\n *\n * ์ด๋ฏธ ๋ฐํ๋ ๊ฒ์ ๋ค์ ๋ฐํํ๋ฉด ์๋ฒ๊ฐ ๊ฑฐ์ ํ๋ค. ๊ณ ์ณ์ ๋ค์ ๋ด๋ ค๋ฉด ์ ์ฅ์ด ๋จผ์ ์ด๊ณ , ์ ์ฅ์\n * ๋ฐํ์ ํผ๋ค(์ด์์ผ๋ก ๋์์จ๋ค).\n */\nexport async function releaseFigure(id: string, comment?: string): Promise<Figure> {\n const response = await client.mutate({\n mutation: gql`\n mutation ReleaseFigure($id: String!, $comment: String) {\n releaseFigure(id: $id, comment: $comment) {\n id\n version\n state\n updatedAt\n }\n }\n `,\n variables: { id, comment }\n })\n\n return unwrap<Figure>(response, 'releaseFigure')\n}\n\n/** A namespace the domain owns (LV figure-server design G1): the `{namespace}` of the full name `{namespace}/{type}`. */\nexport interface FigureNamespace {\n id: string\n name: string\n description?: string | null\n state: 'active' | 'suspended'\n isDefault: boolean\n}\n\nconst FIGURE_NAMESPACE_FIELDS = 'id name description state isDefault'\n\n/** The categories the server allows, or null when a category is free text (LV figure-server design G5). */\nexport async function fetchFigureCategories(): Promise<string[] | null> {\n const response = await client.query({\n query: gql`\n query {\n figureCategories\n }\n `,\n fetchPolicy: 'network-only'\n })\n return unwrap<string[] | null>(response, 'figureCategories') ?? null\n}\n\n/** The domain's namespaces, its default first. */\nexport async function fetchFigureNamespaces(): Promise<FigureNamespace[]> {\n const response = await client.query({\n query: gql`\n query {\n figureNamespaces { ${FIGURE_NAMESPACE_FIELDS} }\n }\n `,\n fetchPolicy: 'network-only'\n })\n return unwrap<FigureNamespace[]>(response, 'figureNamespaces') ?? []\n}\n\n/** Adds a namespace to the domain; the server says why when it refuses (not a namespace, another domain's). */\nexport async function createFigureNamespace(name: string, isDefault = false): Promise<FigureNamespace> {\n const response = await client.mutate({\n mutation: gql`\n mutation ($name: String!, $isDefault: Boolean) {\n createFigureNamespace(name: $name, isDefault: $isDefault) { ${FIGURE_NAMESPACE_FIELDS} }\n }\n `,\n variables: { name, isDefault }\n })\n return unwrap<FigureNamespace>(response, 'createFigureNamespace')\n}\n\n/** Makes one of the domain's active namespaces its default. */\nexport async function setDefaultFigureNamespace(name: string): Promise<FigureNamespace> {\n const response = await client.mutate({\n mutation: gql`\n mutation ($name: String!) {\n setDefaultFigureNamespace(name: $name) { ${FIGURE_NAMESPACE_FIELDS} }\n }\n `,\n variables: { name }\n })\n return unwrap<FigureNamespace>(response, 'setDefaultFigureNamespace')\n}\n\n/** Suspends a namespace or makes it active again. */\nexport async function setFigureNamespaceState(name: string, state: 'active' | 'suspended'): Promise<FigureNamespace> {\n const response = await client.mutate({\n mutation: gql`\n mutation ($name: String!, $state: String!) {\n setFigureNamespaceState(name: $name, state: $state) { ${FIGURE_NAMESPACE_FIELDS} }\n }\n `,\n variables: { name, state }\n })\n return unwrap<FigureNamespace>(response, 'setFigureNamespaceState')\n}\n\n/** A draft a revert kept when it wrote over it (ADR-0097 ยง5.6). Not a released version. */\nexport interface KeptDraft {\n id: string\n kind: 'revert' | 'undo'\n state?: string\n version?: number\n revertedToVersion?: number\n restoredAt?: string\n createdAt?: string\n creator?: { name?: string }\n}\n\nconst KEPT_FIELDS = `id kind state version revertedToVersion restoredAt createdAt creator { name }`\n\n/**\n * ์ ๋ฒ์ ์ ์ด์์ผ๋ก ๋์ด๋ฆฐ๋ค. ์ ๋ณธยท์์ฑยท๊ทธ๋ฆผ์ด ๋์์ค๊ณ ์ด๋ฆยท์ค๋ช
์ ๊ทธ๋๋ก๋ค. ๋ฎ์ด๋ ์ด์์ ๊ฐ์ ํธ๋์ญ์
์์ ์๋ฒ๊ฐ\n * ๋ณด๊ดํ๋ค. `expectedSource` ๋ ์๋ฒ๊ฐ ๋ค๊ณ ์๋ค๊ณ ํ์ธ๋ ์ ๋ณธ -- ๊ทธ ์ฌ์ด ๋ฐ๋์์ผ๋ฉด ๊ฑฐ์ ๋๋ค. ๋ต์ ๋ชป ๋ฐ์์ผ๋ฉด\n * (REVERT_UNREACHABLE) ๊ฐ์ `requestId` ๋ก ๋ค์ ๋ฌป๋๋ค: ์๋ฒ๋ ๊ฐ์ ๋๋๋ฆฌ๊ธฐ๋ก ๋ตํ๊ณ ๋ ๋ฒ ํ์ง ์๋๋ค.\n */\nexport async function revertFigureVersion(\n id: string,\n version: number,\n requestId: string,\n expectedSource: string\n): Promise<SaveResult & { kept: KeptDraft }> {\n const response = await reached(\n client.mutate({\n mutation: gql`\n mutation RevertFigureVersion($id: String!, $version: Float!, $requestId: String!, $expectedSource: String!) {\n revertFigureVersion(id: $id, version: $version, requestId: $requestId, expectedSource: $expectedSource) {\n figure { ${FIGURE_LIST_FIELDS} source }\n violations { code message at }\n kept { ${KEPT_FIELDS} }\n }\n }\n `,\n variables: { id, version, requestId, expectedSource }\n }),\n 'REVERT_UNREACHABLE'\n )\n refusedIn(response)\n return unwrap<SaveResult & { kept: KeptDraft }>(response, 'revertFigureVersion')\n}\n\n/** ๋๋๋ฆฌ๊ธฐ ์ทจ์ -- ๋ณด๊ดํ ์ด์์ ๋์ด๋ฆฐ๋ค. ๋๋๋ฆฐ ๋ค ๋ชจ๋ธ์ด ๋ฐ๋์์ผ๋ฉด ์๋ฒ๊ฐ ๊ฑฐ์ ํ๊ณ ๋ณด๊ด๋ณธ์ ๋จ๋๋ค. */\nexport async function undoFigureRevert(keptId: string, requestId: string): Promise<SaveResult & { kept: KeptDraft }> {\n const response = await reached(\n client.mutate({\n mutation: gql`\n mutation UndoFigureRevert($keptId: String!, $requestId: String!) {\n undoFigureRevert(keptId: $keptId, requestId: $requestId) {\n figure { ${FIGURE_LIST_FIELDS} source }\n violations { code message at }\n kept { ${KEPT_FIELDS} }\n }\n }\n `,\n variables: { keptId, requestId }\n }),\n 'REVERT_UNREACHABLE'\n )\n refusedIn(response)\n return unwrap<SaveResult & { kept: KeptDraft }>(response, 'undoFigureRevert')\n}\n\n/** A figure an AI proposal was saved into (ADR-0097 ยง5.6 item 5). */\nexport interface ProposalOutcome {\n figureId: string\n type?: string\n name?: string\n recordedAt?: string\n}\n\n/**\n * ์ ์์ด ๋ฌด์์ด ๋๋ -- ๊ทธ ์ ์์ ๋ด์ ์ ์ฅ์ด ๋ค์ด๊ฐ ํผ๊ท์ด๋ค. ๋น์์ผ๋ฉด ์ ์ฅ๋์ง ์์๋ค(์ ์ฉ๋ง ํ๊ณ ์ ์ฅ ์ ์ด๊ฑฐ๋, ๋๋๋ ธ๊ฑฐ๋,\n * ์ ์ฉํ์ง ์์๋ค). ๋ํฌ์ ใ๊ฒฐ๊ณผ ํ์ธใ์ด ์ด๊ฒ์ ๋ฌป๋๋ค: ๋ํฌ์ ๊ธฐ์ต์ด ์๋๋ผ ์๋ฒ์ ๊ธฐ๋ก์ด๋ค.\n */\nexport async function fetchProposalOutcome(proposalKey: string): Promise<ProposalOutcome[]> {\n const response = await client.query({\n query: gql`\n query FigureProposalOutcome($proposalKey: String!) {\n figureProposalOutcome(proposalKey: $proposalKey) { figureId type name recordedAt }\n }\n `,\n variables: { proposalKey },\n fetchPolicy: 'network-only'\n })\n return unwrap<ProposalOutcome[]>(response, 'figureProposalOutcome') ?? []\n}\n\n/** ๋๋๋ฆฌ๊ธฐ๊ฐ ๋ณด๊ดํ ์ด์๋ค, ์๊ฒ๋ถํฐ -- ๋ค์ ์ ์ํด๋ ์ฌ๊ธฐ์ ์ฐพ๋๋ค. */\nexport async function fetchReplacedDrafts(id: string): Promise<KeptDraft[]> {\n const response = await client.query({\n query: gql`\n query FigureReplacedDrafts($id: String!) {\n figureReplacedDrafts(id: $id) { ${KEPT_FIELDS} }\n }\n `,\n variables: { id },\n fetchPolicy: 'network-only'\n })\n return unwrap<KeptDraft[]>(response, 'figureReplacedDrafts')\n}\n\n/**\n * ๋ฐํํด๋ ๋๋ โ **๋๋ฅด๊ธฐ ์ ์** ๋ฌป๋๋ค.\n *\n * ๋ง๋ ๊ฒ์ ์๋ฒ์ `releaseFigure` ์ด๊ณ ์ด๊ฒ์ ์ด์ ๋ฅผ ๋ฏธ๋ฆฌ ๋ณด์ฌ ์ฃผ๊ธฐ ์ํ ๊ฒ์ด๋ค. ํ๊ฐ์ฆ์ด\n * ์๋๋ฏ๋ก ์ด ๋ต์ด ํต๊ณผ๋ผ ํด๋ ๋ฐํ์ ๋ค์ ํ์ ์ ๋ฐ๋๋ค.\n */\nexport async function inspectFigure(id: string): Promise<FigureInspection> {\n const response = await client.query({\n query: gql`\n query InspectFigure($id: String!) {\n inspectFigure(id: $id) {\n blocked\n findings {\n code\n message\n why\n how\n at\n blocking\n }\n }\n }\n `,\n variables: { id },\n fetchPolicy: 'network-only'\n })\n\n return unwrap<FigureInspection>(response, 'inspectFigure')\n}\n\n/**\n * ํธ์ง ์ค์ธ ์๋ณธ์ ๋ฐํ ํ์ โ ์ ์ฅํ์ง ์์ ๊ฒ์ ์ฐ๋ค.\n *\n * ๋ฐํ ํจ๋์ `inspectFigure` ๋ ์ ์ฅ๋ ์๋ณธ์ ์ฌ๋ฏ๋ก ๊ณ ์น ๊ฒฐ๊ณผ๋ฅผ ์ ์ฅํ ๋ค์์ผ ๋ณด์ฌ ์ค๋ค. ํธ์งํ๋ฉด์ ๋งํ๋\n * ๊ฒ์ ๋ณด๋ ค๋ฉด ํธ์ง ์ค์ธ ์๋ณธ์ ๋ณด๋ด์ผ ํ๋ค. ํ์ ์ ์๋ฒ์ ๊ฐ์ ๋ฌธ(`inspectAnySource`)์ด ํ๊ณ ๋ฌธ์ฅ๋ ๊ฐ๋ค โ\n * ํ๋ฉด์ด ์ ํ์ ์ ๋ฐ๋ก ๊ฐ์ง๋ฉด ๋ ์๋ฆฌ๊ฐ ๋ค๋ฅธ ๋ง์ ํ๋ค. `id` ๊ฐ ์์ผ๋ฉด ์๋ฒ๊ฐ ๊ทธ ํ์ ํ์
๊ณผ ์ง์ ๋ฐํ ๋ฒ์ ์ ์ฝ๋๋ค.\n */\nexport async function inspectFigureDraft(source: string, id?: string): Promise<FigureInspection> {\n const response = await client.query({\n query: gql`\n query InspectFigureDraft($source: String!, $id: String) {\n inspectFigureDraft(source: $source, id: $id) {\n blocked\n findings {\n code\n message\n why\n how\n at\n blocking\n }\n }\n }\n `,\n variables: { source, id },\n fetchPolicy: 'network-only'\n })\n\n return unwrap<FigureInspection>(response, 'inspectFigureDraft')\n}\n\n/** ๋ฐํ๋ ๋ฒ์ ๋ค โ ์ต๊ทผ ๊ฒ๋ถํฐ ์ด ๊ฐ. */\n/**\n * ์ง์ ๋ฐํ ๋ฒ์ ์ ์ ๋ณธ. ํ ๋ฒ๋ ๋ฐํ ์ ํ์ผ๋ฉด `undefined`.\n *\n * ์ ์ ์ค์ ใ์ด ๊ณ ์นจ์ด ์ด๋ฏธ ๋์ธ ๊ฒ์ ๊นจ๋ใ๋ฅผ ๊ทธ ์๋ฆฌ์์ ๋ณด์ฌ ์ฃผ๋ ค๋ฉด ๊ฒฌ์ค ๊ฒ์ด ํ์ํ๋ค. ์ ์ฅ\n * ์ ์ด์์ ์๋ฒ๊ฐ ๋ชจ๋ฅด๋ฏ๋ก ํ์ ๋ ํ๋ฉด์์ ํ๋ค โ ํ์์ `contractChanges` ๋ฅผ ๊ฐ์ด ์ด๋ค.\n */\nexport async function fetchReleasedSource(id: string): Promise<string | undefined> {\n return (await fetchReleasedFigure(id))?.source\n}\n\n/** Read-only catalogue preview: source and version come from the same released snapshot. */\nexport async function fetchReleasedFigure(id: string): Promise<{ version: number; source: string } | undefined> {\n const response = await client.query({\n query: gql`\n query FigureReleased($id: String!) {\n figureReleased(id: $id) {\n version\n source\n }\n }\n `,\n variables: { id },\n fetchPolicy: 'network-only'\n })\n\n return unwrap<{ version: number; source: string } | undefined>(response, 'figureReleased') ?? undefined\n}\n\nexport async function fetchFigureVersions(id: string): Promise<FigureVersion[]> {\n const response = await client.query({\n query: gql`\n query FigureVersions($id: String!) {\n figureVersions(id: $id) {\n version\n comment\n state\n updatedAt\n updater { id name }\n score\n triangles\n groups\n }\n }\n `,\n variables: { id },\n fetchPolicy: 'network-only'\n })\n\n return unwrap<FigureVersion[]>(response, 'figureVersions') ?? []\n}\n\n/** A recipe template as the server gives it (ADR-0095, amended): words in the language asked, the recipe as JSON. */\nexport interface RecipeTemplateRow {\n name: string\n category: string\n tags: string[]\n target: 'part' | 'figure'\n title: string\n description: string\n source: string\n hasThumbnail: boolean\n}\n\nexport async function fetchRecipeTemplates(lang: string): Promise<RecipeTemplateRow[]> {\n const response = await client.query({\n query: gql`\n query ($lang: String) {\n figureRecipeTemplates(lang: $lang) {\n name\n category\n tags\n target\n title\n description\n source\n hasThumbnail\n }\n }\n `,\n variables: { lang }\n })\n return unwrap<RecipeTemplateRow[] | null>(response, 'figureRecipeTemplates') ?? []\n}\n\n/** One template's guide in the language asked, or '' while none is written. */\nexport async function fetchRecipeGuide(name: string, lang: string): Promise<string> {\n const response = await client.query({\n query: gql`\n query ($name: String!, $lang: String) {\n figureRecipeTemplate(name: $name, lang: $lang) {\n guide\n }\n }\n `,\n variables: { name, lang }\n })\n return unwrap<{ guide?: string } | null>(response, 'figureRecipeTemplate')?.guide ?? ''\n}\n\n/**\n * A GLB for a mesh part (ADR-0129): the server reads it, keeps it by its hash and answers what it holds. A file a board\n * cannot draw is refused with the reason in the screen's words.\n */\nexport async function uploadFigureMesh(file: File, onProgress: UploadProgress): Promise<import('../modeller/mesh-import.js').MeshUpload> {\n const response = await client.mutate({\n mutation: gql`\n mutation UploadFigureMesh($file: Upload!) {\n uploadFigureMesh(file: $file) {\n hash\n summary\n }\n }\n `,\n variables: { file },\n context: uploadContext(onProgress)\n })\n return unwrap(response, 'uploadFigureMesh')\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../client/graphql/index.ts"],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;AAClE,CAAC;AAcD,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,IAAY;IACrD,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC;QAClC,KAAK,EAAE,GAAG,CAAA;;;;;;;;;;;;;KAaT;QACD,SAAS,EAAE,EAAE,IAAI,EAAE;KACpB,CAAC,CAAA;IACF,OAAO,MAAM,CAA6B,QAAQ,EAAE,uBAAuB,CAAC,IAAI,EAAE,CAAA;AACpF,CAAC;AAED,+EAA+E;AAC/E,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,IAAY,EAAE,IAAY;IAC/D,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC;QAClC,KAAK,EAAE,GAAG,CAAA;;;;;;KAMT;QACD,SAAS,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;KAC1B,CAAC,CAAA;IACF,OAAO,MAAM,CAA4B,QAAQ,EAAE,sBAAsB,CAAC,EAAE,KAAK,IAAI,EAAE,CAAA;AACzF,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,IAAU,EAAE,UAA0B;IAC3E,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC;QACnC,QAAQ,EAAE,GAAG,CAAA;;;;;;;KAOZ;QACD,SAAS,EAAE,EAAE,IAAI,EAAE;QACnB,OAAO,EAAE,aAAa,CAAC,UAAU,CAAC;KACnC,CAAC,CAAA;IACF,OAAO,MAAM,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAA;AAC7C,CAAC","sourcesContent":["import gql from 'graphql-tag'\nimport { i18next } from '@operato/i18n'\nimport { client, uploadContext, type UploadProgress } from '@operato/graphql'\n\nimport { reached, refusedIn } from './reached.js'\n\nimport type {\n Figure,\n FigureFinding,\n FigureInspection,\n FigureListResult,\n FigurePatch,\n FigureVersion,\n NewFigure\n} from '../types.js'\n\n/**\n * ์๋ต์์ ๊ฐ์ ๊บผ๋ธ๋ค. **์๋ฒ๊ฐ ๋งํ ์ฌ์ ๋ฅผ ๊ทธ๋๋ก ์ฌ๋ฆฐ๋ค.**\n *\n * ์ ์๋ `response.data.figures` ์ฒ๋ผ ๋ฐ๋ก ๊บผ๋๋ค. ์๋ฒ๊ฐ ์ค๋ฅ๋ฅผ ๋๋ ค์ฃผ๋ฉด `data` ๊ฐ\n * ์์ผ๋ฏ๋ก `Cannot read properties of undefined (reading 'figures')` ๊ฐ ๋ฌ๊ณ , ํ๋ฉด์๋\n * ๊ทธ ๋ฌธ์ฅ์ด ๊ทธ๋๋ก ๋ด๋ค. ์ฌ์ฉ์๋ ์๊ธฐ๊ฐ ๋ฌด์์ ์๋ชปํ๋์ง ์ ์ ์๋ค โ ์ค์ ๋ก AI\n * ์์ฒญ์์ ๊ทธ๋ ๊ฒ ๋ฌ๋ค.\n *\n * ๊ฐ์ด `null` ์ธ ๊ฒ์ ์ค๋ฅ๊ฐ ์๋๋ค. ์ง์ด ๊ฒ์ ๋ฌผ์์ ๋์ฒ๋ผ ์๋ ๊ฒ์ด ๋ต์ธ ๊ฒฝ์ฐ๊ฐ ์๋ค.\n * ์ฌ๊ธฐ์ ๋ง๋ ๊ฒ์ **`data` ์์ฒด๊ฐ ์๋ ๊ฒ**์ด๋ค.\n */\nfunction unwrap<T>(response: { data?: Record<string, unknown>; errors?: readonly { message: string }[] }, field: string): T {\n const said = response.errors?.[0]?.message\n /* The server's code and details go with its words: a conflict is told apart from a refusal (FIGURE_CATALOG_CONFLICT). */\n const extensions = (response.errors?.[0] as { extensions?: { code?: string } } | undefined)?.extensions\n if (said) throw Object.assign(new Error(said), extensions?.code ? { code: extensions.code, extensions } : {})\n\n if (!response.data) {\n /* The field name stays off the screen because the user cannot act on it; it goes to the console. */\n console.error(`[figure-ui] the server returned no data for ${field}`)\n throw new Error(i18next.t('figure.text.server-returned-no-data'))\n }\n\n return response.data[field] as T\n}\n\n\n/**\n * ๋ชฉ๋ก์ ํ์ํ ํ๋๋ง ๊ฐ์ ธ์จ๋ค โ `source` ๋ ๋ฌด๊ฒ๊ณ ๋ชฉ๋ก์์ ์ฐ์ง ์๋๋ค.\n *\n * **`thumbnail` ๋ ์ฌ๊ธฐ ์๋ค.** base64 ๋ฌธ์์ด์ด๋ผ ๋ชฉ๋ก ์๋ต์ ์ค์ผ๋ฉด ์นดํ๋ก๊ทธ๋ฅผ ์ด ๋๋ง๋ค ๊ทธ๋ฆผ\n * ์ ๋ถ๊ฐ ๋ค์ ์ค๊ณ (ํ๋ณธ 14๊ฐ 227KB), data URL ์ ๋ธ๋ผ์ฐ์ ๊ฐ ์บ์ํ์ง ๋ชปํ๋ค. ๊ทธ๋ฆผ์ ์ฃผ์๋ก\n * ๋ถ๋ฅธ๋ค(`figure-thumbnail` ๋ผ์ฐํธ). ๋์ `thumbnailUpdatedAt` ์ ๋ฐ๋๋ค โ ๊ทธ๋ฆผ์ด ์๋ ์๋๋ฅผ\n * ๊ทธ๊ฒ์ผ๋ก ์๊ณ , ๋ฒ์ ์ ๊ฐ๋ฆฌ๋ ๊ฐ์ผ๋ก๋ ์ด๋ค.\n */\nconst FIGURE_LIST_FIELDS = `\n id\n namespace\n type\n name\n description\n category\n tags\n state\n version\n deprecated\n supersededBy\n public\n score\n triangles\n groups\n thumbnailUpdatedAt\n updatedAt\n updater { id name }\n`\n\n/**\n * ๋ชฉ๋ก์ ๊ฐ์ ธ์จ๋ค.\n *\n * ๊ฑธ๋ฌ ๋ณด๊ธฐยท์ ๋ ฌยท์ชฝ ๋๋๊ธฐ๋ฅผ **๊ทธ๋๋ก ๋๊ธด๋ค.** ํ๋ฉด์ด `search`ยท`state` ๊ฐ์ ์ด๋ฆ์ ๋ฐ๋ก ๋ง๋ค์ด\n * filter ๋ก ์ฎ๊ธฐ๋ ๊ฒ์ ๊ทธ๋ง๋์๋ค โ ๊ทธ ์ด๋ฆ๋ค์ ๊ฒฉ์(ox-grist)๊ฐ ์ด๋ฏธ ์ปฌ๋ผ ์ค์ ์์ ๋ง๋ค์ด ์ฃผ๊ณ ,\n * ์ค๊ฐ์ ํ ๋ฒ ๋ ๋๋ฉด ๊ฒฉ์๊ฐ ์๋ ์กฐ๊ฑด๊ณผ ์๋ฒ์ ๊ฐ๋ ์กฐ๊ฑด์ด ์ด๊ธ๋๋ค.\n */\n/** How many of the domain's figures each state chip would show (draft, released), under the list's other conditions. */\nexport async function fetchFigureStateCounts(filters: unknown[], signal?: AbortSignal): Promise<Record<string, number>> {\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!]) {\n figureStateCounts(filters: $filters) { value count }\n }\n `,\n variables: { filters },\n fetchPolicy: 'no-cache',\n context: { fetchOptions: { signal }, queryDeduplication: false }\n })\n if (response.errors?.length) throw new Error(response.errors.map(one => one.message).join(' ยท '))\n return Object.fromEntries((response.data?.figureStateCounts ?? []).map((row: { value: string; count: number }) => [row.value, row.count]))\n}\n\nexport async function fetchFigureList(params: {\n page?: number\n limit?: number\n filters?: unknown[]\n sortings?: { name: string; desc?: boolean }[]\n /** 'public': other domains' public figures, with their domain (LV figure-server design G2). The domain's own by default. */\n scope?: 'own' | 'public'\n}): Promise<FigureListResult> {\n const field = params.scope === 'public' ? 'publicFigures' : 'figures'\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {\n ${field}(filters: $filters, pagination: $pagination, sortings: $sortings) {\n items { ${FIGURE_LIST_FIELDS} ${params.scope === 'public' ? 'domain { id name subdomain }' : ''} }\n total\n }\n }\n `,\n variables: {\n filters: params.filters ?? [],\n pagination: { page: params.page ?? 1, limit: params.limit ?? 30 },\n sortings: params.sortings?.length ? params.sortings : [{ name: 'updatedAt', desc: true }]\n },\n fetchPolicy: 'network-only'\n })\n\n return unwrap<FigureListResult>(response, field)\n}\n\n/** ์ ์๋ฉด์ ํ์ํ ์ ๋ถ โ `source` ๋ฅผ ํฌํจํ๋ค. */\nexport async function fetchFigure(id: string): Promise<Figure> {\n const response = await client.query({\n query: gql`\n query ($id: String!) {\n figure(id: $id) {\n ${FIGURE_LIST_FIELDS}\n source\n properties\n }\n }\n `,\n variables: { id },\n fetchPolicy: 'network-only'\n })\n\n return unwrap<Figure>(response, 'figure')\n}\n\n/**\n * ์ด๋ฏธ ์ฐ์ด๊ณ ์๋ ํ์
์ด๋ฆ.\n *\n * `type` ์ ๋ง๋ ๋ค์ ๊ณ ์น ์ ์์ผ๋ฏ๋ก **๋ง๋ค๊ธฐ ์ ์** ์๋ ค ์ค์ผ ํ๋ค. ์ ์ฅ์ ๋๋ฌ\n * ๊ฑฐ์ ๋นํ๊ณ ๋์ ์๋ ๊ฒ์ ๋ฆ๋ค.\n */\nexport async function fetchFigureTypeNames(): Promise<string[]> {\n const response = await client.query({\n query: gql`\n query {\n figureTypeNames\n }\n `,\n fetchPolicy: 'network-only'\n })\n\n return unwrap<string[] | null>(response, 'figureTypeNames') ?? []\n}\n\nexport interface SaveResult {\n figure: Figure\n /** ๋ง์ง ์๋ ๋ฐ๊ฒฌ. ์ ์ฅ์ ๋์ง๋ง ํ๋ฉด์ด ๋ณด์ฌ ์ค์ผ ํ๋ค. */\n violations: FigureFinding[]\n}\n\nexport async function createFigure(figure: NewFigure): Promise<SaveResult> {\n const response = await client.mutate({\n mutation: gql`\n mutation ($figure: NewFigure!) {\n createFigure(figure: $figure) {\n figure { ${FIGURE_LIST_FIELDS} source }\n violations { code message at }\n }\n }\n `,\n variables: { figure }\n })\n\n return unwrap<SaveResult>(response, 'createFigure')\n}\n\n/** The type, category and tags as the editor saw them; null is \"was empty\". The update goes on only while the row holds them. */\nexport interface FigureCatalogSeen {\n type?: string | null\n category?: string | null\n tags?: string[] | null\n}\n\nexport async function updateFigure(id: string, patch: FigurePatch, seen?: FigureCatalogSeen): Promise<SaveResult> {\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $patch: FigurePatch!, $seen: FigureCatalogSeen) {\n updateFigure(id: $id, patch: $patch, seen: $seen) {\n figure { ${FIGURE_LIST_FIELDS} source }\n violations { code message at }\n }\n }\n `,\n variables: { id, patch, ...(seen ? { seen } : {}) }\n })\n\n return unwrap<SaveResult>(response, 'updateFigure')\n}\n\n/** Makes a released figure public to other domains, or private again (LV figure-server design G2). */\nexport async function setFigurePublic(id: string, isPublic: boolean): Promise<Figure> {\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $public: Boolean!) {\n setFigurePublic(id: $id, public: $public) {\n ${FIGURE_LIST_FIELDS}\n }\n }\n `,\n variables: { id, public: isPublic }\n })\n\n return unwrap<Figure>(response, 'setFigurePublic')\n}\n\n/** Retires a released figure, naming the type to use instead, or brings it back. Release rows are not touched. */\nexport async function setFigureDeprecation(id: string, deprecated: boolean, supersededBy?: string | null): Promise<Figure> {\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $deprecated: Boolean!, $supersededBy: String) {\n setFigureDeprecation(id: $id, deprecated: $deprecated, supersededBy: $supersededBy) {\n ${FIGURE_LIST_FIELDS}\n }\n }\n `,\n variables: { id, deprecated, supersededBy: supersededBy || null }\n })\n\n return unwrap<Figure>(response, 'setFigureDeprecation')\n}\n\nexport async function deleteFigure(id: string): Promise<boolean> {\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!) {\n deleteFigure(id: $id)\n }\n `,\n variables: { id }\n })\n\n return unwrap<boolean>(response, 'deleteFigure')\n}\n\n/**\n * ๋ฐํํ๋ค โ ๋ฒ์ ๋ฒํธ๊ฐ ์ค๋ฅด๊ณ , ๊ทธ ์๊ฐ์ด ๋ฒ์ ์ผ๋ก ๋จ๋๋ค.\n *\n * ์ด๋ฏธ ๋ฐํ๋ ๊ฒ์ ๋ค์ ๋ฐํํ๋ฉด ์๋ฒ๊ฐ ๊ฑฐ์ ํ๋ค. ๊ณ ์ณ์ ๋ค์ ๋ด๋ ค๋ฉด ์ ์ฅ์ด ๋จผ์ ์ด๊ณ , ์ ์ฅ์\n * ๋ฐํ์ ํผ๋ค(์ด์์ผ๋ก ๋์์จ๋ค).\n */\nexport async function releaseFigure(id: string, comment?: string): Promise<Figure> {\n const response = await client.mutate({\n mutation: gql`\n mutation ReleaseFigure($id: String!, $comment: String) {\n releaseFigure(id: $id, comment: $comment) {\n id\n version\n state\n updatedAt\n }\n }\n `,\n variables: { id, comment }\n })\n\n return unwrap<Figure>(response, 'releaseFigure')\n}\n\n/** A namespace the domain owns (LV figure-server design G1): the `{namespace}` of the full name `{namespace}/{type}`. */\nexport interface FigureNamespace {\n id: string\n name: string\n description?: string | null\n state: 'active' | 'suspended'\n isDefault: boolean\n}\n\nconst FIGURE_NAMESPACE_FIELDS = 'id name description state isDefault'\n\n/** The categories the server allows, or null when a category is free text (LV figure-server design G5). */\nexport async function fetchFigureCategories(): Promise<string[] | null> {\n const response = await client.query({\n query: gql`\n query {\n figureCategories\n }\n `,\n fetchPolicy: 'network-only'\n })\n return unwrap<string[] | null>(response, 'figureCategories') ?? null\n}\n\n/** The domain's namespaces, its default first. */\nexport async function fetchFigureNamespaces(): Promise<FigureNamespace[]> {\n const response = await client.query({\n query: gql`\n query {\n figureNamespaces { ${FIGURE_NAMESPACE_FIELDS} }\n }\n `,\n fetchPolicy: 'network-only'\n })\n return unwrap<FigureNamespace[]>(response, 'figureNamespaces') ?? []\n}\n\n/** Adds a namespace to the domain; the server says why when it refuses (not a namespace, another domain's). */\nexport async function createFigureNamespace(name: string, isDefault = false): Promise<FigureNamespace> {\n const response = await client.mutate({\n mutation: gql`\n mutation ($name: String!, $isDefault: Boolean) {\n createFigureNamespace(name: $name, isDefault: $isDefault) { ${FIGURE_NAMESPACE_FIELDS} }\n }\n `,\n variables: { name, isDefault }\n })\n return unwrap<FigureNamespace>(response, 'createFigureNamespace')\n}\n\n/** Makes one of the domain's active namespaces its default. */\nexport async function setDefaultFigureNamespace(name: string): Promise<FigureNamespace> {\n const response = await client.mutate({\n mutation: gql`\n mutation ($name: String!) {\n setDefaultFigureNamespace(name: $name) { ${FIGURE_NAMESPACE_FIELDS} }\n }\n `,\n variables: { name }\n })\n return unwrap<FigureNamespace>(response, 'setDefaultFigureNamespace')\n}\n\n/** Suspends a namespace or makes it active again. */\nexport async function setFigureNamespaceState(name: string, state: 'active' | 'suspended'): Promise<FigureNamespace> {\n const response = await client.mutate({\n mutation: gql`\n mutation ($name: String!, $state: String!) {\n setFigureNamespaceState(name: $name, state: $state) { ${FIGURE_NAMESPACE_FIELDS} }\n }\n `,\n variables: { name, state }\n })\n return unwrap<FigureNamespace>(response, 'setFigureNamespaceState')\n}\n\n/** A draft a revert kept when it wrote over it (ADR-0097 ยง5.6). Not a released version. */\nexport interface KeptDraft {\n id: string\n kind: 'revert' | 'undo'\n state?: string\n version?: number\n revertedToVersion?: number\n restoredAt?: string\n createdAt?: string\n creator?: { name?: string }\n}\n\nconst KEPT_FIELDS = `id kind state version revertedToVersion restoredAt createdAt creator { name }`\n\n/**\n * ์ ๋ฒ์ ์ ์ด์์ผ๋ก ๋์ด๋ฆฐ๋ค. ์ ๋ณธยท์์ฑยท๊ทธ๋ฆผ์ด ๋์์ค๊ณ ์ด๋ฆยท์ค๋ช
์ ๊ทธ๋๋ก๋ค. ๋ฎ์ด๋ ์ด์์ ๊ฐ์ ํธ๋์ญ์
์์ ์๋ฒ๊ฐ\n * ๋ณด๊ดํ๋ค. `expectedSource` ๋ ์๋ฒ๊ฐ ๋ค๊ณ ์๋ค๊ณ ํ์ธ๋ ์ ๋ณธ -- ๊ทธ ์ฌ์ด ๋ฐ๋์์ผ๋ฉด ๊ฑฐ์ ๋๋ค. ๋ต์ ๋ชป ๋ฐ์์ผ๋ฉด\n * (REVERT_UNREACHABLE) ๊ฐ์ `requestId` ๋ก ๋ค์ ๋ฌป๋๋ค: ์๋ฒ๋ ๊ฐ์ ๋๋๋ฆฌ๊ธฐ๋ก ๋ตํ๊ณ ๋ ๋ฒ ํ์ง ์๋๋ค.\n */\nexport async function revertFigureVersion(\n id: string,\n version: number,\n requestId: string,\n expectedSource: string\n): Promise<SaveResult & { kept: KeptDraft }> {\n const response = await reached(\n client.mutate({\n mutation: gql`\n mutation RevertFigureVersion($id: String!, $version: Float!, $requestId: String!, $expectedSource: String!) {\n revertFigureVersion(id: $id, version: $version, requestId: $requestId, expectedSource: $expectedSource) {\n figure { ${FIGURE_LIST_FIELDS} source }\n violations { code message at }\n kept { ${KEPT_FIELDS} }\n }\n }\n `,\n variables: { id, version, requestId, expectedSource }\n }),\n 'REVERT_UNREACHABLE'\n )\n refusedIn(response)\n return unwrap<SaveResult & { kept: KeptDraft }>(response, 'revertFigureVersion')\n}\n\n/** ๋๋๋ฆฌ๊ธฐ ์ทจ์ -- ๋ณด๊ดํ ์ด์์ ๋์ด๋ฆฐ๋ค. ๋๋๋ฆฐ ๋ค ๋ชจ๋ธ์ด ๋ฐ๋์์ผ๋ฉด ์๋ฒ๊ฐ ๊ฑฐ์ ํ๊ณ ๋ณด๊ด๋ณธ์ ๋จ๋๋ค. */\nexport async function undoFigureRevert(keptId: string, requestId: string): Promise<SaveResult & { kept: KeptDraft }> {\n const response = await reached(\n client.mutate({\n mutation: gql`\n mutation UndoFigureRevert($keptId: String!, $requestId: String!) {\n undoFigureRevert(keptId: $keptId, requestId: $requestId) {\n figure { ${FIGURE_LIST_FIELDS} source }\n violations { code message at }\n kept { ${KEPT_FIELDS} }\n }\n }\n `,\n variables: { keptId, requestId }\n }),\n 'REVERT_UNREACHABLE'\n )\n refusedIn(response)\n return unwrap<SaveResult & { kept: KeptDraft }>(response, 'undoFigureRevert')\n}\n\n/** A figure an AI proposal was saved into (ADR-0097 ยง5.6 item 5). */\nexport interface ProposalOutcome {\n figureId: string\n type?: string\n name?: string\n recordedAt?: string\n}\n\n/**\n * ์ ์์ด ๋ฌด์์ด ๋๋ -- ๊ทธ ์ ์์ ๋ด์ ์ ์ฅ์ด ๋ค์ด๊ฐ ํผ๊ท์ด๋ค. ๋น์์ผ๋ฉด ์ ์ฅ๋์ง ์์๋ค(์ ์ฉ๋ง ํ๊ณ ์ ์ฅ ์ ์ด๊ฑฐ๋, ๋๋๋ ธ๊ฑฐ๋,\n * ์ ์ฉํ์ง ์์๋ค). ๋ํฌ์ ใ๊ฒฐ๊ณผ ํ์ธใ์ด ์ด๊ฒ์ ๋ฌป๋๋ค: ๋ํฌ์ ๊ธฐ์ต์ด ์๋๋ผ ์๋ฒ์ ๊ธฐ๋ก์ด๋ค.\n */\nexport async function fetchProposalOutcome(proposalKey: string): Promise<ProposalOutcome[]> {\n const response = await client.query({\n query: gql`\n query FigureProposalOutcome($proposalKey: String!) {\n figureProposalOutcome(proposalKey: $proposalKey) { figureId type name recordedAt }\n }\n `,\n variables: { proposalKey },\n fetchPolicy: 'network-only'\n })\n return unwrap<ProposalOutcome[]>(response, 'figureProposalOutcome') ?? []\n}\n\n/** ๋๋๋ฆฌ๊ธฐ๊ฐ ๋ณด๊ดํ ์ด์๋ค, ์๊ฒ๋ถํฐ -- ๋ค์ ์ ์ํด๋ ์ฌ๊ธฐ์ ์ฐพ๋๋ค. */\nexport async function fetchReplacedDrafts(id: string): Promise<KeptDraft[]> {\n const response = await client.query({\n query: gql`\n query FigureReplacedDrafts($id: String!) {\n figureReplacedDrafts(id: $id) { ${KEPT_FIELDS} }\n }\n `,\n variables: { id },\n fetchPolicy: 'network-only'\n })\n return unwrap<KeptDraft[]>(response, 'figureReplacedDrafts')\n}\n\n/**\n * ๋ฐํํด๋ ๋๋ โ **๋๋ฅด๊ธฐ ์ ์** ๋ฌป๋๋ค.\n *\n * ๋ง๋ ๊ฒ์ ์๋ฒ์ `releaseFigure` ์ด๊ณ ์ด๊ฒ์ ์ด์ ๋ฅผ ๋ฏธ๋ฆฌ ๋ณด์ฌ ์ฃผ๊ธฐ ์ํ ๊ฒ์ด๋ค. ํ๊ฐ์ฆ์ด\n * ์๋๋ฏ๋ก ์ด ๋ต์ด ํต๊ณผ๋ผ ํด๋ ๋ฐํ์ ๋ค์ ํ์ ์ ๋ฐ๋๋ค.\n */\nexport async function inspectFigure(id: string): Promise<FigureInspection> {\n const response = await client.query({\n query: gql`\n query InspectFigure($id: String!) {\n inspectFigure(id: $id) {\n blocked\n findings {\n code\n message\n why\n how\n at\n blocking\n asNewType\n }\n }\n }\n `,\n variables: { id },\n fetchPolicy: 'network-only'\n })\n\n return unwrap<FigureInspection>(response, 'inspectFigure')\n}\n\n/**\n * ํธ์ง ์ค์ธ ์๋ณธ์ ๋ฐํ ํ์ โ ์ ์ฅํ์ง ์์ ๊ฒ์ ์ฐ๋ค.\n *\n * ๋ฐํ ํจ๋์ `inspectFigure` ๋ ์ ์ฅ๋ ์๋ณธ์ ์ฌ๋ฏ๋ก ๊ณ ์น ๊ฒฐ๊ณผ๋ฅผ ์ ์ฅํ ๋ค์์ผ ๋ณด์ฌ ์ค๋ค. ํธ์งํ๋ฉด์ ๋งํ๋\n * ๊ฒ์ ๋ณด๋ ค๋ฉด ํธ์ง ์ค์ธ ์๋ณธ์ ๋ณด๋ด์ผ ํ๋ค. ํ์ ์ ์๋ฒ์ ๊ฐ์ ๋ฌธ(`inspectAnySource`)์ด ํ๊ณ ๋ฌธ์ฅ๋ ๊ฐ๋ค โ\n * ํ๋ฉด์ด ์ ํ์ ์ ๋ฐ๋ก ๊ฐ์ง๋ฉด ๋ ์๋ฆฌ๊ฐ ๋ค๋ฅธ ๋ง์ ํ๋ค. `id` ๊ฐ ์์ผ๋ฉด ์๋ฒ๊ฐ ๊ทธ ํ์ ํ์
๊ณผ ์ง์ ๋ฐํ ๋ฒ์ ์ ์ฝ๋๋ค.\n */\nexport async function inspectFigureDraft(source: string, id?: string): Promise<FigureInspection> {\n const response = await client.query({\n query: gql`\n query InspectFigureDraft($source: String!, $id: String) {\n inspectFigureDraft(source: $source, id: $id) {\n blocked\n findings {\n code\n message\n why\n how\n at\n blocking\n asNewType\n }\n }\n }\n `,\n variables: { source, id },\n fetchPolicy: 'network-only'\n })\n\n return unwrap<FigureInspection>(response, 'inspectFigureDraft')\n}\n\n/** ๋ฐํ๋ ๋ฒ์ ๋ค โ ์ต๊ทผ ๊ฒ๋ถํฐ ์ด ๊ฐ. */\n/**\n * ์ง์ ๋ฐํ ๋ฒ์ ์ ์ ๋ณธ. ํ ๋ฒ๋ ๋ฐํ ์ ํ์ผ๋ฉด `undefined`.\n *\n * ์ ์ ์ค์ ใ์ด ๊ณ ์นจ์ด ์ด๋ฏธ ๋์ธ ๊ฒ์ ๊นจ๋ใ๋ฅผ ๊ทธ ์๋ฆฌ์์ ๋ณด์ฌ ์ฃผ๋ ค๋ฉด ๊ฒฌ์ค ๊ฒ์ด ํ์ํ๋ค. ์ ์ฅ\n * ์ ์ด์์ ์๋ฒ๊ฐ ๋ชจ๋ฅด๋ฏ๋ก ํ์ ๋ ํ๋ฉด์์ ํ๋ค โ ํ์์ `contractChanges` ๋ฅผ ๊ฐ์ด ์ด๋ค.\n */\nexport async function fetchReleasedSource(id: string): Promise<string | undefined> {\n return (await fetchReleasedFigure(id))?.source\n}\n\n/** Read-only catalogue preview: source and version come from the same released snapshot. */\nexport async function fetchReleasedFigure(id: string): Promise<{ version: number; source: string } | undefined> {\n const response = await client.query({\n query: gql`\n query FigureReleased($id: String!) {\n figureReleased(id: $id) {\n version\n source\n }\n }\n `,\n variables: { id },\n fetchPolicy: 'network-only'\n })\n\n return unwrap<{ version: number; source: string } | undefined>(response, 'figureReleased') ?? undefined\n}\n\nexport async function fetchFigureVersions(id: string): Promise<FigureVersion[]> {\n const response = await client.query({\n query: gql`\n query FigureVersions($id: String!) {\n figureVersions(id: $id) {\n version\n comment\n state\n updatedAt\n updater { id name }\n score\n triangles\n groups\n }\n }\n `,\n variables: { id },\n fetchPolicy: 'network-only'\n })\n\n return unwrap<FigureVersion[]>(response, 'figureVersions') ?? []\n}\n\n/** A recipe template as the server gives it (ADR-0095, amended): words in the language asked, the recipe as JSON. */\nexport interface RecipeTemplateRow {\n name: string\n category: string\n tags: string[]\n target: 'part' | 'figure'\n title: string\n description: string\n source: string\n hasThumbnail: boolean\n}\n\nexport async function fetchRecipeTemplates(lang: string): Promise<RecipeTemplateRow[]> {\n const response = await client.query({\n query: gql`\n query ($lang: String) {\n figureRecipeTemplates(lang: $lang) {\n name\n category\n tags\n target\n title\n description\n source\n hasThumbnail\n }\n }\n `,\n variables: { lang }\n })\n return unwrap<RecipeTemplateRow[] | null>(response, 'figureRecipeTemplates') ?? []\n}\n\n/** One template's guide in the language asked, or '' while none is written. */\nexport async function fetchRecipeGuide(name: string, lang: string): Promise<string> {\n const response = await client.query({\n query: gql`\n query ($name: String!, $lang: String) {\n figureRecipeTemplate(name: $name, lang: $lang) {\n guide\n }\n }\n `,\n variables: { name, lang }\n })\n return unwrap<{ guide?: string } | null>(response, 'figureRecipeTemplate')?.guide ?? ''\n}\n\n/**\n * A GLB for a mesh part (ADR-0129): the server reads it, keeps it by its hash and answers what it holds. A file a board\n * cannot draw is refused with the reason in the screen's words.\n */\nexport async function uploadFigureMesh(file: File, onProgress: UploadProgress): Promise<import('../modeller/mesh-import.js').MeshUpload> {\n const response = await client.mutate({\n mutation: gql`\n mutation UploadFigureMesh($file: Upload!) {\n uploadFigureMesh(file: $file) {\n hash\n summary\n }\n }\n `,\n variables: { file },\n context: uploadContext(onProgress)\n })\n return unwrap(response, 'uploadFigureMesh')\n}\n"]}
|
|
@@ -83,8 +83,8 @@ export declare function copiedTrackEdit(asset: FigureAsset, clip: Clip, track: C
|
|
|
83
83
|
state: string;
|
|
84
84
|
clip: string;
|
|
85
85
|
keys: ClipKey[];
|
|
86
|
-
loop: "
|
|
87
|
-
interpolation: "
|
|
86
|
+
loop: "hold" | "wrap";
|
|
87
|
+
interpolation: "smooth" | "linear" | "step";
|
|
88
88
|
accumulates: boolean;
|
|
89
89
|
};
|
|
90
90
|
/** The edit that writes a track back. */
|
|
@@ -93,8 +93,8 @@ export declare const trackEdit: (clip: Clip, track: ClipTrack, patch?: Partial<P
|
|
|
93
93
|
state: string;
|
|
94
94
|
clip: string;
|
|
95
95
|
keys: ClipKey[];
|
|
96
|
-
loop: "
|
|
97
|
-
interpolation: "
|
|
96
|
+
loop: "hold" | "wrap";
|
|
97
|
+
interpolation: "smooth" | "linear" | "step";
|
|
98
98
|
};
|
|
99
99
|
/**
|
|
100
100
|
* A new track's keys. By default it holds the pose the figure stands in now, from start to end: a track added to a pose
|
|
@@ -122,6 +122,11 @@ export declare function sampleOf(asset: FigureAsset, sample: unknown, legends?:
|
|
|
122
122
|
uses: Readonly<Record<string, FigureTableUse>>;
|
|
123
123
|
notes: FigureRuntimeIssue[];
|
|
124
124
|
};
|
|
125
|
+
/**
|
|
126
|
+
* The state inputs a sample of data sets on this figure, by id: what the preview shows for them instead of a slider. None
|
|
127
|
+
* when there is no sample, or the figure refuses it.
|
|
128
|
+
*/
|
|
129
|
+
export declare function sampledStatesOf(asset: FigureAsset, sample: unknown): Record<string, number>;
|
|
125
130
|
/** The rows a person gives a value by hand, as a board's saved values: one value, read by a binding, not inside a list. */
|
|
126
131
|
export declare const valueRowsOf: (asset: FigureAsset) => FigureDataRow[];
|
|
127
132
|
/**
|
|
@@ -340,6 +340,21 @@ export function sampleOf(asset, sample, legends = {}) {
|
|
|
340
340
|
notes: inputs.diagnostics().filter(i => i.severity === 'note')
|
|
341
341
|
};
|
|
342
342
|
}
|
|
343
|
+
/**
|
|
344
|
+
* The state inputs a sample of data sets on this figure, by id: what the preview shows for them instead of a slider. None
|
|
345
|
+
* when there is no sample, or the figure refuses it.
|
|
346
|
+
*/
|
|
347
|
+
export function sampledStatesOf(asset, sample) {
|
|
348
|
+
if (sample === null || sample === undefined || !asset.dataInterface)
|
|
349
|
+
return {};
|
|
350
|
+
try {
|
|
351
|
+
const read = sampleOf(asset, sample);
|
|
352
|
+
return read.issues.length ? {} : Object.fromEntries(Object.entries(read.result.states).map(([id, s]) => [id, s.value]));
|
|
353
|
+
}
|
|
354
|
+
catch {
|
|
355
|
+
return {};
|
|
356
|
+
}
|
|
357
|
+
}
|
|
343
358
|
/** The rows a person gives a value by hand, as a board's saved values: one value, read by a binding, not inside a list. */
|
|
344
359
|
export const valueRowsOf = (asset) => schemaRowsOf(asset).filter(r => isValue(r.node) && r.bindings.length > 0 && !r.path.includes('[]'));
|
|
345
360
|
/**
|