@things-factory/figure-library 10.1.306 → 10.1.308

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 (32) hide show
  1. package/dist-client/pages/figure-library-page.js +31 -3
  2. package/dist-client/viewparts/figure-import-result.d.ts +6 -0
  3. package/dist-client/viewparts/figure-import-result.js +44 -2
  4. package/dist-client/viewparts/figure-package-import.js +1 -0
  5. package/dist-client/viewparts/figure-releases-popup.d.ts +11 -1
  6. package/dist-client/viewparts/figure-releases-popup.js +48 -8
  7. package/dist-client/viewparts/figure-source-install.js +1 -0
  8. package/dist-client/viewparts/figure-tidy.d.ts +2 -0
  9. package/dist-client/viewparts/figure-tidy.js +17 -0
  10. package/dist-server/service/figure-library-resolver.d.ts +1 -0
  11. package/dist-server/service/figure-library-resolver.js +21 -1
  12. package/dist-server/service/figure-library-types.d.ts +2 -0
  13. package/dist-server/service/figure-library-types.js +8 -0
  14. package/dist-server/service/index.d.ts +3 -2
  15. package/dist-server/service/index.js +1 -0
  16. package/dist-server/service/library/figures.d.ts +12 -0
  17. package/dist-server/service/library/figures.js +9 -2
  18. package/dist-server/service/library/import.d.ts +5 -0
  19. package/dist-server/service/library/import.js +8 -4
  20. package/dist-server/service/library/library-files.d.ts +7 -0
  21. package/dist-server/service/library/library-files.js +27 -1
  22. package/dist-server/service/library/tidy.d.ts +14 -0
  23. package/dist-server/service/library/tidy.js +57 -0
  24. package/dist-server/service/library/type-map.d.ts +5 -0
  25. package/dist-server/service/library/type-map.js +5 -3
  26. package/package.json +4 -4
  27. package/translations/en.json +17 -7
  28. package/translations/es.json +17 -7
  29. package/translations/ja.json +17 -7
  30. package/translations/ko.json +17 -7
  31. package/translations/ms.json +17 -7
  32. package/translations/zh.json +17 -7
@@ -27,6 +27,10 @@ import { figureLibraryFileUrl, figureSourceOnLibrary } from '../figure-library-f
27
27
  * The library is expected to grow to many figures, so the list pages from the server and the filters (category,
28
28
  * capability) are drop-down lists in the filter bar beside the name search. Upload, the screen's one primary action, is
29
29
  * the FAB; it opens a popup whose drop box takes the package and says what it came to.
30
+ *
31
+ * Tidying (ADR-0114 개정 2026-11-23): the pills 「활성 · 비활성」 and the filter 「보드에서 안 쓰는 것」 find what can go;
32
+ * each figure goes 활성 → 비활성 → 영구 삭제 from its own releases popup, one at a time. Nothing here is done to many
33
+ * figures together (user, 2026-11-23: 「집단으로 선택해서 하지말자」).
30
34
  */
31
35
  const FIGURES = gql `
32
36
  query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
@@ -35,6 +39,7 @@ const FIGURES = gql `
35
39
  name
36
40
  archivedAt
37
41
  item
42
+ inUse
38
43
  latestVersion
39
44
  releaseCount
40
45
  release {
@@ -211,11 +216,31 @@ let FigureLibraryPage = class FigureLibraryPage extends localize(i18next)(PageVi
211
216
  record: { editable: false },
212
217
  filter: { operator: 'eq' }
213
218
  },
214
- /* Archived figures are left out unless this box is checked (ADR-0114 결정 18, 화면; user 2026-10-22). */
219
+ /*
220
+ Two pills, 「활성」 (the default) or 「비활성」 (archived), never both (ADR-0114 개정 2026-11-23; user: 「활성 ·
221
+ 비활성으로 하자」): the two states a figure is in on its way 활성 → 비활성 → 영구 삭제. With 「보드에서 안 쓰는
222
+ 것」, 「비활성」 lists what can be deleted for good.
223
+ */
224
+ {
225
+ type: 'select',
226
+ name: 'state',
227
+ header: i18next.t('figure-library.label.state'),
228
+ hidden: true,
229
+ record: { editable: false },
230
+ filter: {
231
+ operator: 'eq',
232
+ value: 'active',
233
+ options: [
234
+ { display: i18next.t('figure-library.state.active'), value: 'active' },
235
+ { display: i18next.t('figure-library.state.inactive'), value: 'inactive' }
236
+ ]
237
+ }
238
+ },
239
+ /* Only the names no board of this domain uses (ADR-0114 결정 27): what is safe to archive and then delete. */
215
240
  {
216
241
  type: 'boolean',
217
- name: 'archived',
218
- header: i18next.t('figure-library.label.archived'),
242
+ name: 'unused',
243
+ header: i18next.t('figure-library.label.unused'),
219
244
  hidden: true,
220
245
  record: { editable: false },
221
246
  filter: { operator: 'eq' }
@@ -289,6 +314,7 @@ let FigureLibraryPage = class FigureLibraryPage extends localize(i18next)(PageVi
289
314
  .name=${record.name}
290
315
  .drawing=${record.release?.id ?? ''}
291
316
  .archived=${!!record.archivedAt}
317
+ .inUse=${!!record.inUse}
292
318
  @saved=${() => this.grist.fetch()}
293
319
  ></figure-releases-popup>`, {
294
320
  backdrop: true,
@@ -302,6 +328,7 @@ let FigureLibraryPage = class FigureLibraryPage extends localize(i18next)(PageVi
302
328
  await this.configure();
303
329
  this.grist.fetch();
304
330
  }}
331
+ @unarchived=${() => this.grist.fetch()}
305
332
  @close=${() => popup.close()}
306
333
  ></figure-source-install>`, { backdrop: true, size: 'large', closable: true, title: i18next.t('figure-library.button.install-from-source') });
307
334
  }
@@ -311,6 +338,7 @@ let FigureLibraryPage = class FigureLibraryPage extends localize(i18next)(PageVi
311
338
  await this.configure();
312
339
  this.grist.fetch();
313
340
  }}
341
+ @unarchived=${() => this.grist.fetch()}
314
342
  ></figure-package-import>`, { backdrop: true, size: 'small', closable: true, title: i18next.t('figure-library.button.upload') });
315
343
  }
316
344
  };
@@ -1,3 +1,4 @@
1
+ import '@material/web/button/text-button.js';
1
2
  import { LitElement, nothing } from 'lit';
2
3
  export type ImportResult = {
3
4
  problems: {
@@ -9,12 +10,17 @@ export type ImportResult = {
9
10
  outcome: string;
10
11
  code?: string;
11
12
  differs?: string[];
13
+ archived?: boolean;
12
14
  }[];
13
15
  };
14
16
  declare const FigureImportResultView_base: (new (...args: any[]) => LitElement) & typeof LitElement;
15
17
  export declare class FigureImportResultView extends FigureImportResultView_base {
16
18
  static styles: import("lit").CSSResult;
17
19
  result?: ImportResult;
20
+ /** The names unarchived from here: their line no longer says archived. */
21
+ private unarchived;
18
22
  render(): import("lit-html").TemplateResult<1> | typeof nothing;
23
+ private renderArchived;
24
+ private unarchive;
19
25
  }
20
26
  export {};
@@ -1,12 +1,32 @@
1
1
  import { __decorate, __metadata } from "tslib";
2
+ import '@material/web/button/text-button.js';
3
+ import gql from 'graphql-tag';
2
4
  import { css, html, LitElement, nothing } from 'lit';
3
- import { customElement, property } from 'lit/decorators.js';
5
+ import { customElement, property, state } from 'lit/decorators.js';
6
+ import { client } from '@operato/graphql';
4
7
  import { i18next, localize } from '@operato/i18n';
8
+ import { announceLibraryChanged } from '../figure-library-changed.js';
9
+ const UNARCHIVE = gql `
10
+ mutation ($name: String!) {
11
+ unarchiveFigure(name: $name) {
12
+ name
13
+ }
14
+ }
15
+ `;
16
+ /** The full name a release reference `{namespace}/{type}@{version}` is of. */
17
+ const nameOf = (ref) => ref.replace(/@\d+$/, '');
5
18
  /*
6
19
  * What became of each figure a package brought (ADR-0114): added, skipped or refused with the reason. A package file
7
- * and an install from the figure server are one import, so both show their result with this.
20
+ * and an install from the figure server are one import, so both show their result with this. A name that is archived
21
+ * here says so, with its unarchive beside it (결정 28): the import never unarchives it (결정 20), so it is not in the
22
+ * tray until a person does.
8
23
  */
9
24
  let FigureImportResultView = class FigureImportResultView extends localize(i18next)(LitElement) {
25
+ constructor() {
26
+ super(...arguments);
27
+ /** The names unarchived from here: their line no longer says archived. */
28
+ this.unarchived = new Set();
29
+ }
10
30
  static { this.styles = css `
11
31
  :host {
12
32
  display: flex;
@@ -22,6 +42,9 @@ let FigureImportResultView = class FigureImportResultView extends localize(i18ne
22
42
  p {
23
43
  margin: 0;
24
44
  }
45
+ md-text-button {
46
+ --md-text-button-container-height: 24px;
47
+ }
25
48
  `; }
26
49
  render() {
27
50
  const result = this.result;
@@ -33,16 +56,35 @@ let FigureImportResultView = class FigureImportResultView extends localize(i18ne
33
56
  : result.outcomes.map(o => html `<div>
34
57
  <span ref>${o.ref}</span> ·
35
58
  <strong ?refused=${o.outcome === 'refused'}>${i18next.t(`figure-library.outcome.${o.outcome}`)}</strong>
59
+ ${o.archived && o.outcome !== 'refused' ? this.renderArchived(nameOf(o.ref)) : nothing}
36
60
  ${o.differs?.length ? html `<div>${i18next.t('figure-library.text.differs', { fields: o.differs.join(', ') })}</div>` : nothing}
37
61
  ${o.outcome === 'refused' && o.code ? html `<div>${i18next.t(`error.${o.code}`, { defaultValue: o.code })}</div>` : nothing}
38
62
  </div>`)}
39
63
  </div>`;
40
64
  }
65
+ renderArchived(name) {
66
+ if (this.unarchived.has(name))
67
+ return html ` · ${i18next.t('figure-library.text.unarchived')}`;
68
+ return html ` · ${i18next.t('figure-library.text.archived')}
69
+ <md-text-button @click=${() => this.unarchive(name)}>${i18next.t('figure-library.button.unarchive')}</md-text-button>`;
70
+ }
71
+ async unarchive(name) {
72
+ const response = await client.mutate({ mutation: UNARCHIVE, variables: { name } });
73
+ if (!response.data?.unarchiveFigure)
74
+ return;
75
+ this.unarchived = new Set([...this.unarchived, name]);
76
+ announceLibraryChanged();
77
+ this.dispatchEvent(new CustomEvent('unarchived', { bubbles: true, composed: true, detail: { name } }));
78
+ }
41
79
  };
42
80
  __decorate([
43
81
  property({ attribute: false }),
44
82
  __metadata("design:type", Object)
45
83
  ], FigureImportResultView.prototype, "result", void 0);
84
+ __decorate([
85
+ state(),
86
+ __metadata("design:type", Object)
87
+ ], FigureImportResultView.prototype, "unarchived", void 0);
46
88
  FigureImportResultView = __decorate([
47
89
  customElement('figure-import-result')
48
90
  ], FigureImportResultView);
@@ -19,6 +19,7 @@ const IMPORT = gql `
19
19
  outcome
20
20
  code
21
21
  differs
22
+ archived
22
23
  }
23
24
  }
24
25
  }
@@ -17,6 +17,11 @@ export declare class FigureReleasesPopup extends FigureReleasesPopup_base {
17
17
  name: string;
18
18
  /** Whether the name is archived: the action row offers to unarchive it instead of archiving it. */
19
19
  archived: boolean;
20
+ /**
21
+ * Whether a board uses it. The action row goes 일반 → 아카이브 → 영구 삭제 and offers only what can be done: archive
22
+ * for a name on no board, delete for an archived name on no board; a name a board uses says so instead.
23
+ */
24
+ inUse: boolean;
20
25
  /** The id of the release it draws with now; '' when nothing is in use. */
21
26
  drawing: string;
22
27
  private releasesOf;
@@ -42,7 +47,12 @@ export declare class FigureReleasesPopup extends FigureReleasesPopup_base {
42
47
  private archive;
43
48
  private unarchive;
44
49
  private save;
45
- /** Once the library took it, the catalogue is told and the popup closes. */
50
+ /** Deletes the archived name for good, after asking (ADR-0114 결정 29); a name a board uses is refused, said at the top. */
51
+ private purge;
52
+ /**
53
+ * Once the library took it, the catalogue is told. A choice of release or a delete closes the popup; making the name
54
+ * inactive or active again keeps it open in its new state, so the next step (영구 삭제, or back) is one press away.
55
+ */
46
56
  private run;
47
57
  }
48
58
  export {};
@@ -13,6 +13,7 @@ import { ButtonStyles, CommonPopupStyles, FormFieldStyles, ScrollbarStyles } fro
13
13
  import { announceLibraryChanged } from '../figure-library-changed.js';
14
14
  import { versionText } from './figure-version.js';
15
15
  import { defaultPair, SIDE_BY_SIDE } from './release-pair.js';
16
+ import { sureToPurge } from './figure-tidy.js';
16
17
  const RELEASES_OF = gql `
17
18
  query ($name: String!) {
18
19
  figureLibraryReleasesOf(name: $name) {
@@ -50,6 +51,12 @@ const UNARCHIVE = gql `
50
51
  }
51
52
  }
52
53
  `;
54
+ /* Deleting for good, one archived name at a time (ADR-0114 결정 29). */
55
+ const PURGE = gql `
56
+ mutation ($name: String!) {
57
+ purgeFigure(name: $name)
58
+ }
59
+ `;
53
60
  const CHOOSE = gql `
54
61
  mutation ($name: String!, $releaseId: String!) {
55
62
  chooseFigureRelease(name: $name, releaseId: $releaseId) {
@@ -90,6 +97,11 @@ let FigureReleasesPopup = class FigureReleasesPopup extends localize(i18next)(Li
90
97
  this.name = '';
91
98
  /** Whether the name is archived: the action row offers to unarchive it instead of archiving it. */
92
99
  this.archived = false;
100
+ /**
101
+ * Whether a board uses it. The action row goes 일반 → 아카이브 → 영구 삭제 and offers only what can be done: archive
102
+ * for a name on no board, delete for an archived name on no board; a name a board uses says so instead.
103
+ */
104
+ this.inUse = false;
93
105
  /** The id of the release it draws with now; '' when nothing is in use. */
94
106
  this.drawing = '';
95
107
  /* The name's releases, newest first (ADR-0190). */
@@ -98,15 +110,22 @@ let FigureReleasesPopup = class FigureReleasesPopup extends localize(i18next)(Li
98
110
  this.saves = {
99
111
  archive: new MutationController(this, ARCHIVE, { showsError: true }),
100
112
  unarchive: new MutationController(this, UNARCHIVE, { showsError: true }),
113
+ purge: new MutationController(this, PURGE, { showsError: true }),
101
114
  choose: new MutationController(this, CHOOSE, { showsError: true })
102
115
  };
103
116
  this.picked = '';
104
117
  /** The tab both columns show: choosing one in a column turns the other to it, so both are compared on one view. */
105
118
  this.tab = 'info';
106
119
  this.assets = new Map();
107
- this.archive = () => this.run(this.saves.archive, { name: this.name });
108
- this.unarchive = () => this.run(this.saves.unarchive, { name: this.name });
120
+ this.archive = () => this.run(this.saves.archive, { name: this.name }, () => (this.archived = true));
121
+ this.unarchive = () => this.run(this.saves.unarchive, { name: this.name }, () => (this.archived = false));
109
122
  this.save = () => this.run(this.saves.choose, { name: this.name, releaseId: this.picked });
123
+ /** Deletes the archived name for good, after asking (ADR-0114 결정 29); a name a board uses is refused, said at the top. */
124
+ this.purge = async () => {
125
+ if (!(await sureToPurge(this.name)))
126
+ return;
127
+ await this.run(this.saves.purge, { name: this.name });
128
+ };
110
129
  }
111
130
  static { this.styles = [
112
131
  CommonPopupStyles,
@@ -114,6 +133,12 @@ let FigureReleasesPopup = class FigureReleasesPopup extends localize(i18next)(Li
114
133
  ButtonStyles,
115
134
  FormFieldStyles,
116
135
  css `
136
+ /* Why a name a board uses offers neither archive nor delete: one quiet line where the button would be. */
137
+ [in-use] {
138
+ align-self: center;
139
+ color: var(--md-sys-color-on-surface-variant);
140
+ font-size: var(--ui-t-caption, 12px);
141
+ }
117
142
  /*
118
143
  The popup takes the overlay's width (a share of the window, all of it on a narrow one) and never more: the two
119
144
  columns sit side by side when they have room and stack when they do not, and the actions stay in view.
@@ -312,9 +337,14 @@ let FigureReleasesPopup = class FigureReleasesPopup extends localize(i18next)(Li
312
337
  </div>
313
338
  </div>
314
339
  <ox-popup-actions>
315
- <md-text-button slot="start" ?disabled=${this.saving} @click=${this.archived ? this.unarchive : this.archive}>
316
- ${i18next.t(this.archived ? 'figure-library.button.unarchive' : 'figure-library.button.archive')}
317
- </md-text-button>
340
+ ${this.archived
341
+ ? html `<md-text-button slot="start" ?disabled=${this.saving} @click=${this.unarchive}>${i18next.t('figure-library.button.unarchive')}</md-text-button>`
342
+ : nothing}
343
+ ${!this.inUse
344
+ ? html `<md-text-button slot="start" ?disabled=${this.saving} @click=${this.archived ? this.purge : this.archive}>
345
+ ${i18next.t(this.archived ? 'figure-library.button.purge' : 'figure-library.button.archive')}
346
+ </md-text-button>`
347
+ : html `<span slot="start" in-use>${i18next.t(this.archived ? 'figure-library.text.in-use-no-purge' : 'figure-library.text.in-use-no-archive')}</span>`}
318
348
  <button slot="cancel" @click=${() => closePopup(this)}>${i18next.t('figure-library.button.cancel')}</button>
319
349
  <button slot="confirm" raised ?disabled=${!changed || this.saving} @click=${this.save}>${i18next.t('figure-library.button.save')}</button>
320
350
  </ox-popup-actions>
@@ -402,14 +432,20 @@ let FigureReleasesPopup = class FigureReleasesPopup extends localize(i18next)(Li
402
432
  next[column] = id;
403
433
  this.columns = next;
404
434
  }
405
- /** Once the library took it, the catalogue is told and the popup closes. */
406
- async run(save, variables) {
435
+ /**
436
+ * Once the library took it, the catalogue is told. A choice of release or a delete closes the popup; making the name
437
+ * inactive or active again keeps it open in its new state, so the next step (영구 삭제, or back) is one press away.
438
+ */
439
+ async run(save, variables, stay) {
407
440
  this.sent = save;
408
441
  if (!(await save.run(variables)))
409
442
  return;
410
443
  announceLibraryChanged();
411
444
  this.dispatchEvent(new CustomEvent('saved', { bubbles: true, composed: true }));
412
- closePopup(this);
445
+ if (stay)
446
+ stay();
447
+ else
448
+ closePopup(this);
413
449
  }
414
450
  };
415
451
  __decorate([
@@ -420,6 +456,10 @@ __decorate([
420
456
  property({ type: Boolean }),
421
457
  __metadata("design:type", Object)
422
458
  ], FigureReleasesPopup.prototype, "archived", void 0);
459
+ __decorate([
460
+ property({ type: Boolean }),
461
+ __metadata("design:type", Object)
462
+ ], FigureReleasesPopup.prototype, "inUse", void 0);
423
463
  __decorate([
424
464
  property(),
425
465
  __metadata("design:type", Object)
@@ -55,6 +55,7 @@ const INSTALL = gql `
55
55
  outcome
56
56
  code
57
57
  differs
58
+ archived
58
59
  }
59
60
  }
60
61
  }
@@ -0,0 +1,2 @@
1
+ /** Asks before deleting `name` for good: it cannot be undone. */
2
+ export declare function sureToPurge(name: string): Promise<boolean>;
@@ -0,0 +1,17 @@
1
+ import { i18next } from '@operato/i18n';
2
+ import { OxPrompt } from '@operato/popup';
3
+ /*
4
+ * Deleting a figure for good (ADR-0114 결정 29): one inactive name at a time, from its releases popup, after asking.
5
+ * Nothing in the library is archived or deleted for many figures together (user, 2026-11-23).
6
+ */
7
+ /** Asks before deleting `name` for good: it cannot be undone. */
8
+ export function sureToPurge(name) {
9
+ return OxPrompt.open({
10
+ type: 'warning',
11
+ title: i18next.t('figure-library.title.purge-confirm'),
12
+ text: i18next.t('figure-library.text.purge-confirm', { name }),
13
+ confirmButton: { text: i18next.t('figure-library.button.purge') },
14
+ cancelButton: { text: i18next.t('figure-library.button.cancel') }
15
+ });
16
+ }
17
+ //# sourceMappingURL=figure-tidy.js.map
@@ -20,4 +20,5 @@ export declare class FigureLibraryResolver {
20
20
  chooseFigureRelease(name: string, releaseId: string, context: ResolverContext): Promise<FigureTypeMapEntry>;
21
21
  archiveFigure(name: string, context: ResolverContext): Promise<FigureTypeMapEntry>;
22
22
  unarchiveFigure(name: string, context: ResolverContext): Promise<FigureTypeMapEntry>;
23
+ purgeFigure(name: string, context: ResolverContext): Promise<boolean>;
23
24
  }
@@ -14,6 +14,7 @@ const blueprints_1 = require("./library/blueprints");
14
14
  const extensions_1 = require("./library/extensions");
15
15
  const import_1 = require("./library/import");
16
16
  const inspection_1 = require("./library/inspection");
17
+ const tidy_1 = require("./library/tidy");
17
18
  const type_map_1 = require("./library/type-map");
18
19
  /**
19
20
  * A refusal in the asker's language as plain text: a board draws it on a canvas, not into HTML, so the values in it
@@ -67,7 +68,9 @@ let FigureLibraryResolver = class FigureLibraryResolver {
67
68
  capability: value('capability'),
68
69
  search: value('name'),
69
70
  includeArchived: value('archived') === true || value('archived') === 'true',
71
+ state: value('state') === 'inactive' ? 'inactive' : value('state') === 'active' ? 'active' : undefined,
70
72
  onlyItems: value('item') === true || value('item') === 'true',
73
+ unused: value('unused') === true || value('unused') === 'true',
71
74
  page: params.pagination?.page,
72
75
  limit: params.pagination?.limit
73
76
  });
@@ -119,6 +122,11 @@ let FigureLibraryResolver = class FigureLibraryResolver {
119
122
  const { domain, user, tx } = context.state;
120
123
  return await (0, type_map_1.unarchiveFigure)(tx, domain, user, name);
121
124
  }
125
+ async purgeFigure(name, context) {
126
+ const { domain, user, tx } = context.state;
127
+ await (0, tidy_1.purgeFigure)(tx, domain, user, name, context);
128
+ return true;
129
+ }
122
130
  };
123
131
  exports.FigureLibraryResolver = FigureLibraryResolver;
124
132
  tslib_1.__decorate([
@@ -133,7 +141,7 @@ tslib_1.__decorate([
133
141
  tslib_1.__decorate([
134
142
  (0, type_graphql_1.Directive)('@privilege(category: "figure-library", privilege: "query", domainOwnerGranted: true)'),
135
143
  (0, type_graphql_1.Query)(returns => figure_library_types_1.FigureLibraryFigureList, {
136
- description: 'Imported figures, one per full name, with the release each draws with. Filters: category, capability ("-" for none), name (search), archived (true to include archived figures; left out by default), item (true for only the names drawn as items).'
144
+ description: 'Imported figures, one per full name, with the release each draws with. Filters: category, capability ("-" for none), name (search), archived (true to include archived figures; left out by default), state (active or inactive: the names not archived, or archived, only), item (true for only the names drawn as items), unused (true for only the names no board of this domain uses).'
137
145
  }),
138
146
  tslib_1.__param(0, (0, type_graphql_1.Args)()),
139
147
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
@@ -238,6 +246,18 @@ tslib_1.__decorate([
238
246
  tslib_1.__metadata("design:paramtypes", [String, Object]),
239
247
  tslib_1.__metadata("design:returntype", Promise)
240
248
  ], FigureLibraryResolver.prototype, "unarchiveFigure", null);
249
+ tslib_1.__decorate([
250
+ (0, type_graphql_1.Directive)('@transaction'),
251
+ (0, type_graphql_1.Directive)('@privilege(category: "figure-library", privilege: "mutation", domainOwnerGranted: true)'),
252
+ (0, type_graphql_1.Mutation)(returns => Boolean, {
253
+ description: 'Deletes one full figure name for good: only a name that is archived and on no board of this domain; its line, its releases and the files no other release names go. Cannot be undone; import it again to bring it back. One name at a time, never many (ADR-0114 결정 29).'
254
+ }),
255
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('name', { description: 'Full figure name {namespace}/{type}.' })),
256
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
257
+ tslib_1.__metadata("design:type", Function),
258
+ tslib_1.__metadata("design:paramtypes", [String, Object]),
259
+ tslib_1.__metadata("design:returntype", Promise)
260
+ ], FigureLibraryResolver.prototype, "purgeFigure", null);
241
261
  exports.FigureLibraryResolver = FigureLibraryResolver = tslib_1.__decorate([
242
262
  (0, type_graphql_1.Resolver)(),
243
263
  (0, type_graphql_1.UseMiddleware)(shell_1.SpeakRefusals)
@@ -8,6 +8,7 @@ export declare class FigureImportOutcome {
8
8
  outcome: string;
9
9
  code?: string;
10
10
  differs?: string[];
11
+ archived: boolean;
11
12
  }
12
13
  export declare class FigureImportProblem {
13
14
  code: string;
@@ -25,6 +26,7 @@ export declare class FigureLibraryFigure {
25
26
  releaseCount: number;
26
27
  archivedAt?: Date | null;
27
28
  item: boolean;
29
+ inUse: boolean;
28
30
  }
29
31
  export declare class FigureLibraryFigureList {
30
32
  items: FigureLibraryFigure[];
@@ -37,6 +37,10 @@ tslib_1.__decorate([
37
37
  (0, type_graphql_1.Field)(type => [String], { nullable: true, description: 'For a skipped release: the fields the package gave differently.' }),
38
38
  tslib_1.__metadata("design:type", Array)
39
39
  ], FigureImportOutcome.prototype, "differs", void 0);
40
+ tslib_1.__decorate([
41
+ (0, type_graphql_1.Field)({ description: 'Whether its full name is archived in this domain; an import never unarchives a name.' }),
42
+ tslib_1.__metadata("design:type", Boolean)
43
+ ], FigureImportOutcome.prototype, "archived", void 0);
40
44
  exports.FigureImportOutcome = FigureImportOutcome = tslib_1.__decorate([
41
45
  (0, type_graphql_1.ObjectType)({ description: 'What became of one release of an imported package.' })
42
46
  ], FigureImportOutcome);
@@ -99,6 +103,10 @@ tslib_1.__decorate([
99
103
  (0, type_graphql_1.Field)({ description: 'Whether the release in use is tagged as the look of an item a holder holds (fmsim: a carrier).' }),
100
104
  tslib_1.__metadata("design:type", Boolean)
101
105
  ], FigureLibraryFigure.prototype, "item", void 0);
106
+ tslib_1.__decorate([
107
+ (0, type_graphql_1.Field)({ description: 'Whether a board of this domain holds a node of it: such a name is neither archived nor deleted.' }),
108
+ tslib_1.__metadata("design:type", Boolean)
109
+ ], FigureLibraryFigure.prototype, "inUse", void 0);
102
110
  exports.FigureLibraryFigure = FigureLibraryFigure = tslib_1.__decorate([
103
111
  (0, type_graphql_1.ObjectType)({ description: 'An imported figure: its full name, the release it draws with, its latest version and how many releases are imported.' })
104
112
  ], FigureLibraryFigure);
@@ -15,12 +15,13 @@ export * from './library/import';
15
15
  export * from './library/inspection';
16
16
  export * from './library/library-files';
17
17
  export * from './library/type-map';
18
+ export * from './library/tidy';
18
19
  export * from './source/source-setting-rules';
19
20
  export * from './source/source-client';
20
21
  export * from './source/source-install';
21
22
  export * from './source/figure-source-resolver';
22
23
  export * from './source/capability-push';
23
- export declare const entities: (typeof FigureTypeMapEntry | typeof FigureLibraryRelease)[];
24
+ export declare const entities: (typeof FigureLibraryRelease | typeof FigureTypeMapEntry)[];
24
25
  export declare const schema: {
25
- resolverClasses: (typeof FigureSourceResolver | typeof FigureLibraryResolver)[];
26
+ resolverClasses: (typeof FigureLibraryResolver | typeof FigureSourceResolver)[];
26
27
  };
@@ -23,6 +23,7 @@ tslib_1.__exportStar(require("./library/import"), exports);
23
23
  tslib_1.__exportStar(require("./library/inspection"), exports);
24
24
  tslib_1.__exportStar(require("./library/library-files"), exports);
25
25
  tslib_1.__exportStar(require("./library/type-map"), exports);
26
+ tslib_1.__exportStar(require("./library/tidy"), exports);
26
27
  tslib_1.__exportStar(require("./source/source-setting-rules"), exports);
27
28
  tslib_1.__exportStar(require("./source/source-client"), exports);
28
29
  tslib_1.__exportStar(require("./source/source-install"), exports);
@@ -14,8 +14,15 @@ export interface FiguresQuery {
14
14
  search?: string;
15
15
  /** Archived names (ADR-0114 결정 18) are left out unless this is true. */
16
16
  includeArchived?: boolean;
17
+ /**
18
+ * Which names by their state, as the screen's two pills 「활성 · 비활성」 say it (ADR-0114 개정 2026-11-23): active (not
19
+ * archived, the default) or inactive (archived) only. Given, it decides over `includeArchived`.
20
+ */
21
+ state?: 'active' | 'inactive';
17
22
  /** Only the names whose release in use is tagged as an item (ADR-0155 amendment 2). */
18
23
  onlyItems?: boolean;
24
+ /** Only the names no board of this domain holds a node of (ADR-0114 결정 27). */
25
+ unused?: boolean;
19
26
  page?: number;
20
27
  limit?: number;
21
28
  }
@@ -31,6 +38,11 @@ export interface FigureOfLibrary {
31
38
  archivedAt: Date | null;
32
39
  /** Whether the release in use is tagged as an item, the look of a thing a holder holds. */
33
40
  item: boolean;
41
+ /**
42
+ * Whether a board of this domain holds a node of it (ADR-0114 결정 19 · 29): such a name is neither archived nor
43
+ * deleted, so the screen offers neither.
44
+ */
45
+ inUse: boolean;
34
46
  }
35
47
  /**
36
48
  * The library by figure (ADR-0114, amended 2026-10-12): one item per full name with the release it draws with, its
@@ -7,6 +7,7 @@ exports.releasesOfName = releasesOfName;
7
7
  const typeorm_1 = require("typeorm");
8
8
  const figure_library_release_1 = require("../figure-library-release/figure-library-release");
9
9
  const figure_type_map_entry_1 = require("../figure-type-map/figure-type-map-entry");
10
+ const tidy_1 = require("./tidy");
10
11
  const type_map_1 = require("./type-map");
11
12
  /** The filter value for a figure with no category, or one that declares no capability. */
12
13
  exports.FIGURE_FILTER_NONE = '-';
@@ -22,10 +23,16 @@ async function figuresOf(tx, domain, query) {
22
23
  .createQueryBuilder('line')
23
24
  .leftJoinAndSelect('line.release', 'release')
24
25
  .where('line.domain_id = :domain', { domain: domain.id });
25
- if (!query.includeArchived)
26
+ if (query.state === 'inactive')
27
+ builder.andWhere('line.archived_at IS NOT NULL');
28
+ else if (query.state === 'active' || !query.includeArchived)
26
29
  builder.andWhere('line.archived_at IS NULL');
27
30
  if (query.onlyItems)
28
31
  builder.andWhere('release.item = :item', { item: true });
32
+ /* The boards are read once: for the unused filter and for each item's inUse. */
33
+ const usedNames = await (0, tidy_1.namesInUse)(tx, domain);
34
+ if (query.unused && usedNames.size)
35
+ builder.andWhere('line.name NOT IN (:...used)', { used: [...usedNames] });
29
36
  if (query.category === exports.FIGURE_FILTER_NONE)
30
37
  builder.andWhere(`(release.category IS NULL OR release.category = '')`);
31
38
  else if (query.category)
@@ -63,7 +70,7 @@ async function figuresOf(tx, domain, query) {
63
70
  items: lines.map(line => {
64
71
  const all = byName.get(line.name) ?? [];
65
72
  const latest = all[0] ?? line.release;
66
- return { name: line.name, release: line.release ?? null, latest, latestVersion: latest.version, releaseCount: all.length, archivedAt: line.archivedAt ?? null, item: !!line.release?.item };
73
+ return { name: line.name, release: line.release ?? null, latest, latestVersion: latest.version, releaseCount: all.length, archivedAt: line.archivedAt ?? null, item: !!line.release?.item, inUse: usedNames.has(line.name) };
67
74
  })
68
75
  };
69
76
  }
@@ -9,6 +9,11 @@ export interface ImportOutcome {
9
9
  code?: string;
10
10
  /** For a skipped release: the fields the package gave differently from the row already here. */
11
11
  differs?: string[];
12
+ /**
13
+ * Whether its name is archived here (ADR-0114 결정 28): an import never unarchives (결정 20), so an added release of an
14
+ * archived name is not in the tray until a person unarchives it, and the result says so.
15
+ */
16
+ archived: boolean;
12
17
  }
13
18
  export interface ImportResult {
14
19
  /** Problems that refuse the whole package; nothing is imported when there is one. */
@@ -36,20 +36,24 @@ async function importFigurePackage(tx, domain, user, bytes, packageName, files =
36
36
  const read = (0, figure_model_1.readFigurePackage)(packed, library_files_1.sha256Of);
37
37
  if (read.problems.length)
38
38
  return { problems: read.problems.map(p => ({ code: p.code, path: p.path })), outcomes: [] };
39
- const outcomes = read.refused.map(p => ({ ref: p.ref ?? '', outcome: 'refused', code: p.code }));
39
+ const outcomes = read.refused.map(p => ({ ref: p.ref ?? '', outcome: 'refused', code: p.code, archived: false }));
40
40
  const entries = new Map(read.manifest.releases.map(entry => [entry.ref, entry]));
41
41
  const repository = tx.getRepository(figure_library_release_1.FigureLibraryRelease);
42
+ const archived = async (ref) => {
43
+ const name = (0, figure_model_1.parseFigureRef)(ref);
44
+ return name ? !!(await (0, type_map_1.lineOf)(tx, domain, `${name.namespace}/${name.type}`))?.archivedAt : false;
45
+ };
42
46
  for (const release of read.releases) {
43
47
  const entry = entries.get(release.ref);
44
48
  const contentHash = entry.contentHash;
45
49
  const existing = await repository.findOne({ where: { domain: { id: domain.id }, ref: release.ref } });
46
50
  if (existing) {
47
51
  if (existing.contentHash !== contentHash) {
48
- outcomes.push({ ref: release.ref, outcome: 'refused', code: 'figure-import-conflict' });
52
+ outcomes.push({ ref: release.ref, outcome: 'refused', code: 'figure-import-conflict', archived: await archived(release.ref) });
49
53
  continue;
50
54
  }
51
55
  const differs = differingFields(existing, release, entry.blobs);
52
- outcomes.push({ ref: release.ref, outcome: 'skipped', ...(differs.length ? { code: 'skipped-metadata-differs', differs } : {}) });
56
+ outcomes.push({ ref: release.ref, outcome: 'skipped', ...(differs.length ? { code: 'skipped-metadata-differs', differs } : {}), archived: await archived(release.ref) });
53
57
  continue;
54
58
  }
55
59
  for (const blob of entry.blobs) {
@@ -87,7 +91,7 @@ async function importFigurePackage(tx, domain, user, bytes, packageName, files =
87
91
  updater: user
88
92
  });
89
93
  await (0, type_map_1.putIntoTypeMap)(tx, domain, user, saved);
90
- outcomes.push({ ref: release.ref, outcome: 'added' });
94
+ outcomes.push({ ref: release.ref, outcome: 'added', archived: await archived(release.ref) });
91
95
  }
92
96
  return { problems: [], outcomes };
93
97
  }
@@ -11,6 +11,8 @@ export interface LibraryFiles {
11
11
  contents?: Buffer;
12
12
  }>;
13
13
  read(path: string): Promise<Buffer>;
14
+ /** Removes the bytes at `path`: once the transaction in `context` commits, so a rollback still finds them. */
15
+ remove(path: string, context: any): Promise<void>;
14
16
  }
15
17
  export declare const attachmentFiles: LibraryFiles;
16
18
  export declare const libraryFiles: () => LibraryFiles;
@@ -29,4 +31,9 @@ export declare function keepLibraryFile(tx: Tx, domain: {
29
31
  bytes: Uint8Array;
30
32
  contentType: string;
31
33
  }, files?: LibraryFiles): Promise<void>;
34
+ /**
35
+ * Drops the files of `hashes` this domain keeps, but those a release still here depends on: files are shared by content,
36
+ * so one goes only when no release of the domain names it any more.
37
+ */
38
+ export declare function dropLibraryFiles(tx: Tx, domainId: string, hashes: Iterable<string>, stillUsed: ReadonlySet<string>, context: any, files?: LibraryFiles): Promise<number>;
32
39
  export {};
@@ -4,9 +4,11 @@ exports.libraryFiles = exports.attachmentFiles = exports.sha256Of = exports.LIBR
4
4
  exports.useLibraryFiles = useLibraryFiles;
5
5
  exports.libraryFileOf = libraryFileOf;
6
6
  exports.keepLibraryFile = keepLibraryFile;
7
+ exports.dropLibraryFiles = dropLibraryFiles;
7
8
  const crypto_1 = require("crypto");
8
9
  const stream_1 = require("stream");
9
10
  const attachment_base_1 = require("@things-factory/attachment-base");
11
+ const shell_1 = require("@things-factory/shell");
10
12
  /** Attachments that hold the files imported releases depend on, one per (domain, content hash). */
11
13
  exports.LIBRARY_FILE_REF_TYPE = 'figure-library-file';
12
14
  const sha256Of = (bytes) => (0, crypto_1.createHash)('sha256').update(bytes).digest('hex');
@@ -17,7 +19,12 @@ exports.attachmentFiles = {
17
19
  const { id, path, size, contents } = await attachment_base_1.STORAGE.uploadFile({ file, context });
18
20
  return { id, path, size, contents };
19
21
  },
20
- read: async (path) => Buffer.from(await attachment_base_1.STORAGE.readFile(path))
22
+ read: async (path) => Buffer.from(await attachment_base_1.STORAGE.readFile(path)),
23
+ async remove(path, context) {
24
+ /* The row goes in the transaction; the file waits for the commit, as attachment-base deletes one (ADR-0091 결정 8). */
25
+ if (!(0, shell_1.whenCommitted)(context?.state?.afterCommit, `delete figure library file ${path}`, () => attachment_base_1.STORAGE.deleteFile(path)))
26
+ await attachment_base_1.STORAGE.deleteFile(path);
27
+ }
21
28
  };
22
29
  let inUse = exports.attachmentFiles;
23
30
  const libraryFiles = () => inUse;
@@ -55,4 +62,23 @@ async function keepLibraryFile(tx, domain, user, file, files = (0, exports.libra
55
62
  ...(put.contents ? { contents: put.contents } : {})
56
63
  });
57
64
  }
65
+ /**
66
+ * Drops the files of `hashes` this domain keeps, but those a release still here depends on: files are shared by content,
67
+ * so one goes only when no release of the domain names it any more.
68
+ */
69
+ async function dropLibraryFiles(tx, domainId, hashes, stillUsed, context, files = (0, exports.libraryFiles)()) {
70
+ let dropped = 0;
71
+ for (const hash of new Set(hashes)) {
72
+ if (stillUsed.has(hash))
73
+ continue;
74
+ const file = await libraryFileOf(tx, domainId, hash);
75
+ if (!file)
76
+ continue;
77
+ await tx.getRepository(attachment_base_1.Attachment).delete({ id: file.id });
78
+ if (file.path)
79
+ await files.remove(file.path, context);
80
+ dropped++;
81
+ }
82
+ return dropped;
83
+ }
58
84
  //# sourceMappingURL=library-files.js.map
@@ -0,0 +1,14 @@
1
+ import { EntityManager } from 'typeorm';
2
+ import { type LibraryFiles } from './library-files';
3
+ type Domain = {
4
+ id: string;
5
+ };
6
+ /** The full figure names the boards of this domain hold a node of: every board read once. */
7
+ export declare function namesInUse(tx: EntityManager, domain: Domain): Promise<Set<string>>;
8
+ /**
9
+ * Deletes a name for good (결정 29): it must be archived and on no board of this domain. Its type map line and every
10
+ * release of it go, and the files those releases kept that no other release of the domain names. Cannot be undone; the
11
+ * name comes back by importing it again.
12
+ */
13
+ export declare function purgeFigure(tx: EntityManager, domain: Domain, user: unknown, name: string, context?: any, files?: LibraryFiles): Promise<void>;
14
+ export {};
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.namesInUse = namesInUse;
4
+ exports.purgeFigure = purgeFigure;
5
+ const typeorm_1 = require("typeorm");
6
+ const board_service_1 = require("@things-factory/board-service");
7
+ const shell_1 = require("@things-factory/shell");
8
+ const figure_library_release_1 = require("../figure-library-release/figure-library-release");
9
+ const figure_type_map_entry_1 = require("../figure-type-map/figure-type-map-entry");
10
+ const board_walk_1 = require("./board-walk");
11
+ const library_files_1 = require("./library-files");
12
+ const type_map_1 = require("./type-map");
13
+ /*
14
+ * Archive as the way to tidy a library (ADR-0114 개정 2026-11-23, 결정 27 · 29): the names no board uses, and a name
15
+ * that is archived (「비활성」) and on no board deleted for good. One name at a time: nothing is archived or deleted
16
+ * for many names together (user, 2026-11-23).
17
+ */
18
+ /** The full figure names the boards of this domain hold a node of: every board read once. */
19
+ async function namesInUse(tx, domain) {
20
+ const boards = await tx.getRepository(board_service_1.Board).find({ where: { domain: { id: domain.id } }, select: { id: true, model: true } });
21
+ const names = new Set();
22
+ for (const board of boards)
23
+ for (const name of (0, board_walk_1.figureNodesOf)(board.model).keys())
24
+ names.add(name);
25
+ return names;
26
+ }
27
+ /**
28
+ * Deletes a name for good (결정 29): it must be archived and on no board of this domain. Its type map line and every
29
+ * release of it go, and the files those releases kept that no other release of the domain names. Cannot be undone; the
30
+ * name comes back by importing it again.
31
+ */
32
+ async function purgeFigure(tx, domain, user, name, context, files = (0, library_files_1.libraryFiles)()) {
33
+ const line = await (0, type_map_1.lineOf)(tx, domain, name);
34
+ if (!line)
35
+ throw new shell_1.Refusal('figure-not-in-type-map', { type: name }, 'not in the type map of this domain.');
36
+ if (!line.archivedAt)
37
+ throw new shell_1.Refusal('figure-not-archived', { name }, '{name} is not archived. Archive it first; only an archived figure is deleted.');
38
+ const boards = await (0, type_map_1.boardsUsing)(tx, domain, name);
39
+ if (boards.length) {
40
+ const shown = boards.slice(0, type_map_1.BOARDS_NAMED).join(', ') + (boards.length > type_map_1.BOARDS_NAMED ? ` +${boards.length - type_map_1.BOARDS_NAMED}` : '');
41
+ throw new shell_1.Refusal('figure-in-use', { name, count: boards.length, boards: shown }, '{name} is on {count} board(s): {boards}. Take it off them first.');
42
+ }
43
+ const slash = name.indexOf('/');
44
+ const releases = await tx.getRepository(figure_library_release_1.FigureLibraryRelease).find({
45
+ where: { domain: { id: domain.id }, namespace: name.slice(0, slash), type: name.slice(slash + 1) },
46
+ withDeleted: true
47
+ });
48
+ /* The line points at a release: it goes first. */
49
+ await tx.getRepository(figure_type_map_entry_1.FigureTypeMapEntry).delete({ id: line.id });
50
+ if (releases.length)
51
+ await tx.getRepository(figure_library_release_1.FigureLibraryRelease).delete({ id: (0, typeorm_1.In)(releases.map(release => release.id)) });
52
+ const left = await tx.getRepository(figure_library_release_1.FigureLibraryRelease).find({ where: { domain: { id: domain.id } }, select: { id: true, dependencies: true }, withDeleted: true });
53
+ const stillUsed = new Set(left.flatMap(release => (release.dependencies ?? []).map(dependency => dependency.hash)));
54
+ const theirs = releases.flatMap(release => (release.dependencies ?? []).map(dependency => dependency.hash));
55
+ await (0, library_files_1.dropLibraryFiles)(tx, domain.id, theirs, stillUsed, context ?? { state: { domain, user, tx } }, files);
56
+ }
57
+ //# sourceMappingURL=tidy.js.map
@@ -10,6 +10,7 @@ export declare const fullNameOf: (release: Pick<FigureLibraryRelease, "namespace
10
10
  export declare function linesOf(tx: EntityManager, domain: Domain): Promise<FigureTypeMapEntry[]>;
11
11
  /** The lines a board may draw from: the type map without its archived names (ADR-0114 결정 18) -- what the tray offers. */
12
12
  export declare function inUseLinesOf(tx: EntityManager, domain: Domain): Promise<FigureTypeMapEntry[]>;
13
+ export declare function lineOf(tx: EntityManager, domain: Domain, name: string): Promise<FigureTypeMapEntry | null>;
13
14
  /**
14
15
  * Makes `releaseId` the release `name` draws with (ADR-0114 결정 15): a release of this domain's library, and the
15
16
  * release of that very name. Refused by the first fault, named.
@@ -22,6 +23,10 @@ export declare function chooseRelease(tx: EntityManager, domain: Domain, user: u
22
23
  * over: a name that has only such releases keeps a line with no release, so it is listed and boards are told why.
23
24
  */
24
25
  export declare function putIntoTypeMap(tx: EntityManager, domain: Domain, user: unknown, release: FigureLibraryRelease): Promise<void>;
26
+ /** How many boards a refusal names before it says how many more there are. */
27
+ export declare const BOARDS_NAMED = 5;
28
+ /** The boards of this domain that hold a node of `name`, by board name. */
29
+ export declare function boardsUsing(tx: EntityManager, domain: Domain, name: string): Promise<string[]>;
25
30
  /**
26
31
  * Archives `name` (ADR-0114 결정 18 · 19, 2026-10-22): the line and its releases stay, the name leaves the tray, the type
27
32
  * map and the batch door. Refused while a board of this domain holds a node of it, naming those boards. Archiving a
@@ -1,10 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fullNameOf = void 0;
3
+ exports.BOARDS_NAMED = exports.fullNameOf = void 0;
4
4
  exports.linesOf = linesOf;
5
5
  exports.inUseLinesOf = inUseLinesOf;
6
+ exports.lineOf = lineOf;
6
7
  exports.chooseRelease = chooseRelease;
7
8
  exports.putIntoTypeMap = putIntoTypeMap;
9
+ exports.boardsUsing = boardsUsing;
8
10
  exports.archiveFigure = archiveFigure;
9
11
  exports.unarchiveFigure = unarchiveFigure;
10
12
  const figure_model_1 = require("@hatiolab/figure-model");
@@ -76,7 +78,7 @@ async function setLine(tx, domain, user, name, release) {
76
78
  return (await lineOf(tx, domain, name));
77
79
  }
78
80
  /** How many boards a refusal names before it says how many more there are. */
79
- const BOARDS_NAMED = 5;
81
+ exports.BOARDS_NAMED = 5;
80
82
  /** The boards of this domain that hold a node of `name`, by board name. */
81
83
  async function boardsUsing(tx, domain, name) {
82
84
  const boards = await tx.getRepository(board_service_1.Board).find({ where: { domain: { id: domain.id } }, select: { id: true, name: true, model: true } });
@@ -95,7 +97,7 @@ async function archiveFigure(tx, domain, user, name) {
95
97
  return line;
96
98
  const boards = await boardsUsing(tx, domain, name);
97
99
  if (boards.length) {
98
- const shown = boards.slice(0, BOARDS_NAMED).join(', ') + (boards.length > BOARDS_NAMED ? ` +${boards.length - BOARDS_NAMED}` : '');
100
+ const shown = boards.slice(0, exports.BOARDS_NAMED).join(', ') + (boards.length > exports.BOARDS_NAMED ? ` +${boards.length - exports.BOARDS_NAMED}` : '');
99
101
  throw new shell_1.Refusal('figure-in-use', { name, count: boards.length, boards: shown }, '{name} is on {count} board(s): {boards}. Take it off them first.');
100
102
  }
101
103
  await tx.getRepository(figure_type_map_entry_1.FigureTypeMapEntry).update({ id: line.id }, { archivedAt: new Date(), archivedBy: user, updater: user });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/figure-library",
3
- "version": "10.1.306",
3
+ "version": "10.1.308",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "dist-client/index.js",
6
6
  "files": [
@@ -41,7 +41,7 @@
41
41
  "test": "node --import ./test/resolve-ts-siblings.mjs --test test/*.test.ts"
42
42
  },
43
43
  "dependencies": {
44
- "@hatiolab/figure-model": "^0.12.26",
44
+ "@hatiolab/figure-model": "^0.12.28",
45
45
  "@hatiolab/things-scene": "^10.1.123",
46
46
  "@material/web": "^2.0.0",
47
47
  "@operato/data-grist": "^10.29.69",
@@ -59,7 +59,7 @@
59
59
  "@things-factory/auth-base": "^10.1.304",
60
60
  "@things-factory/board-service": "^10.1.305",
61
61
  "@things-factory/env": "^10.1.298",
62
- "@things-factory/figure-viewer": "^10.1.306",
62
+ "@things-factory/figure-viewer": "^10.1.308",
63
63
  "@things-factory/setting-base": "^10.1.304",
64
64
  "@things-factory/shell": "^10.1.304",
65
65
  "graphql-scalars": "^1.22.4",
@@ -69,5 +69,5 @@
69
69
  "koa-router": "^7.4.0",
70
70
  "lit": "^3.1.2"
71
71
  },
72
- "gitHead": "439681f1596540031c5e6446e659277029ce2eb2"
72
+ "gitHead": "fb1e5f82471a206f641bcc5b79bbb9db909cc0a1"
73
73
  }
@@ -85,12 +85,11 @@
85
85
  "figure-library.text.not-latest": "not latest",
86
86
  "figure-library.label.release-shown": "release shown",
87
87
  "label.figure-data": "figure data",
88
- "error.figure-archived": "archived in this domain.",
88
+ "error.figure-archived": "inactive in this domain.",
89
89
  "error.figure-in-use": "{name} is on {count} board(s): {boards}. Take it off them first.",
90
- "figure-library.label.archived": "Include archived",
91
- "figure-library.text.archived": "archived",
92
- "figure-library.button.archive": "Archive",
93
- "figure-library.button.unarchive": "Unarchive",
90
+ "figure-library.text.archived": "inactive",
91
+ "figure-library.button.archive": "Make inactive",
92
+ "figure-library.button.unarchive": "Make active again",
94
93
  "figure-library.label.item-only": "Items only",
95
94
  "figure-library.text.item": "item",
96
95
  "figure-library.item-types.title": "Item types",
@@ -161,7 +160,7 @@
161
160
  "figure-library.source-status.not-installed": "not installed",
162
161
  "figure-library.source-status.installed": "installed",
163
162
  "figure-library.source-status.newer": "newer version",
164
- "figure-library.source-status.archived": "archived",
163
+ "figure-library.source-status.archived": "Inactive",
165
164
  "figure-library.source-status.format-unsupported": "format not supported",
166
165
  "figure-library.setting.title": "Figure server",
167
166
  "figure-library.setting.url": "server address",
@@ -188,5 +187,16 @@
188
187
  "figure-library.setting.missing": "Needed to connect.",
189
188
  "figure-library.setting.capability-pushed": "This app's capability module ({provider} {version}) is on the figure server.",
190
189
  "figure-library.setting.capability-not-pushed": "This app's capability module ({provider} {version}) is not on the figure server yet. Saving or checking the link pushes it.",
191
- "figure-library.setting.capability-push-failed": "This app's capability module ({provider} {version}) could not be pushed to the figure server. The app works on. Reason: {reason}"
190
+ "figure-library.setting.capability-push-failed": "This app's capability module ({provider} {version}) could not be pushed to the figure server. The app works on. Reason: {reason}",
191
+ "figure-library.label.unused": "Not on any board",
192
+ "figure-library.button.purge": "Delete permanently",
193
+ "figure-library.title.purge-confirm": "Delete figure permanently",
194
+ "figure-library.text.purge-confirm": "Permanently delete all installed versions of {name} from this domain’s library, along with related files not used by other versions. This cannot be undone. To use it again, import its package again.",
195
+ "figure-library.text.unarchived": "active again",
196
+ "error.figure-not-archived": "{name} is active. Only a figure made inactive can be deleted permanently.",
197
+ "figure-library.text.in-use-no-archive": "A board uses it, so it cannot be made inactive. Take it off the boards first.",
198
+ "figure-library.text.in-use-no-purge": "A board uses it, so it cannot be deleted. Take it off the boards first.",
199
+ "figure-library.label.state": "State",
200
+ "figure-library.state.active": "Active",
201
+ "figure-library.state.inactive": "Inactive"
192
202
  }
@@ -85,12 +85,11 @@
85
85
  "figure-library.text.not-latest": "no es la última",
86
86
  "figure-library.label.release-shown": "publicación mostrada",
87
87
  "label.figure-data": "datos de la figura",
88
- "error.figure-archived": "archivada en este dominio.",
88
+ "error.figure-archived": "inactiva en este dominio.",
89
89
  "error.figure-in-use": "{name} está en {count} tablero(s): {boards}. Quítela de ellos primero.",
90
- "figure-library.label.archived": "Incluir archivadas",
91
- "figure-library.text.archived": "archivada",
92
- "figure-library.button.archive": "Archivar",
93
- "figure-library.button.unarchive": "Desarchivar",
90
+ "figure-library.text.archived": "inactiva",
91
+ "figure-library.button.archive": "Desactivar",
92
+ "figure-library.button.unarchive": "Volver a activar",
94
93
  "figure-library.label.item-only": "Solo artículos",
95
94
  "figure-library.text.item": "artículo",
96
95
  "figure-library.item-types.title": "Tipos de artículo",
@@ -161,7 +160,7 @@
161
160
  "figure-library.source-status.not-installed": "no instalada",
162
161
  "figure-library.source-status.installed": "instalada",
163
162
  "figure-library.source-status.newer": "versión nueva",
164
- "figure-library.source-status.archived": "archivada",
163
+ "figure-library.source-status.archived": "Inactiva",
165
164
  "figure-library.source-status.format-unsupported": "formato no admitido",
166
165
  "figure-library.setting.title": "Servidor de figuras",
167
166
  "figure-library.setting.url": "dirección del servidor",
@@ -188,5 +187,16 @@
188
187
  "figure-library.setting.missing": "Necesario para conectar.",
189
188
  "figure-library.setting.capability-pushed": "This app's capability module ({provider} {version}) is on the figure server.",
190
189
  "figure-library.setting.capability-not-pushed": "This app's capability module ({provider} {version}) is not on the figure server yet. Saving or checking the link pushes it.",
191
- "figure-library.setting.capability-push-failed": "This app's capability module ({provider} {version}) could not be pushed to the figure server. The app works on. Reason: {reason}"
190
+ "figure-library.setting.capability-push-failed": "This app's capability module ({provider} {version}) could not be pushed to the figure server. The app works on. Reason: {reason}",
191
+ "figure-library.label.unused": "En ningún tablero",
192
+ "figure-library.button.purge": "Eliminar definitivamente",
193
+ "figure-library.title.purge-confirm": "Eliminar figura definitivamente",
194
+ "figure-library.text.purge-confirm": "Se eliminarán permanentemente todas las versiones instaladas de {name} de la biblioteca de este dominio, junto con los archivos relacionados que no utilicen otras versiones. Esta acción no se puede deshacer. Para volver a usarlo, importe su paquete de nuevo.",
195
+ "figure-library.text.unarchived": "activa de nuevo",
196
+ "error.figure-not-archived": "{name} está activa. Solo una figura desactivada se puede eliminar definitivamente.",
197
+ "figure-library.text.in-use-no-archive": "Un tablero la usa, así que no se puede desactivar. Quítela primero de los tableros.",
198
+ "figure-library.text.in-use-no-purge": "Un tablero la usa, así que no se puede eliminar. Quítela primero de los tableros.",
199
+ "figure-library.label.state": "Estado",
200
+ "figure-library.state.active": "Activa",
201
+ "figure-library.state.inactive": "Inactiva"
192
202
  }
@@ -85,12 +85,11 @@
85
85
  "figure-library.text.not-latest": "最新でない",
86
86
  "figure-library.label.release-shown": "表示するバージョン",
87
87
  "label.figure-data": "Figureデータ",
88
- "error.figure-archived": "このドメインでアーカイブされています。",
88
+ "error.figure-archived": "このドメインでは無効です。",
89
89
  "error.figure-in-use": "{name} は {count} 個のボードに置かれています: {boards}。先にボードから外してください。",
90
- "figure-library.label.archived": "アーカイブを含める",
91
- "figure-library.text.archived": "アーカイブ済み",
92
- "figure-library.button.archive": "アーカイブ",
93
- "figure-library.button.unarchive": "アーカイブ解除",
90
+ "figure-library.text.archived": "無効",
91
+ "figure-library.button.archive": "無効にする",
92
+ "figure-library.button.unarchive": "再び有効にする",
94
93
  "figure-library.label.item-only": "アイテムのみ",
95
94
  "figure-library.text.item": "アイテム",
96
95
  "figure-library.item-types.title": "アイテムタイプ",
@@ -161,7 +160,7 @@
161
160
  "figure-library.source-status.not-installed": "未インストール",
162
161
  "figure-library.source-status.installed": "インストール済み",
163
162
  "figure-library.source-status.newer": "新しいバージョン",
164
- "figure-library.source-status.archived": "アーカイブ済み",
163
+ "figure-library.source-status.archived": "無効",
165
164
  "figure-library.source-status.format-unsupported": "形式未対応",
166
165
  "figure-library.setting.title": "Figure サーバー接続",
167
166
  "figure-library.setting.url": "サーバーアドレス",
@@ -188,5 +187,16 @@
188
187
  "figure-library.setting.missing": "入力すると接続されます。",
189
188
  "figure-library.setting.capability-pushed": "This app's capability module ({provider} {version}) is on the figure server.",
190
189
  "figure-library.setting.capability-not-pushed": "This app's capability module ({provider} {version}) is not on the figure server yet. Saving or checking the link pushes it.",
191
- "figure-library.setting.capability-push-failed": "This app's capability module ({provider} {version}) could not be pushed to the figure server. The app works on. Reason: {reason}"
190
+ "figure-library.setting.capability-push-failed": "This app's capability module ({provider} {version}) could not be pushed to the figure server. The app works on. Reason: {reason}",
191
+ "figure-library.label.unused": "どのボードにもないもの",
192
+ "figure-library.button.purge": "完全に削除",
193
+ "figure-library.title.purge-confirm": "フィギュアを完全に削除",
194
+ "figure-library.text.purge-confirm": "このドメインのライブラリから、{name} のインストール済みの全バージョンと、他のバージョンで使用されていない関連ファイルを完全に削除します。元に戻せません。再び使用するにはパッケージを再インポートしてください。",
195
+ "figure-library.text.unarchived": "再び有効",
196
+ "error.figure-not-archived": "{name} は有効です。完全に削除できるのは無効にしたフィギュアだけです。",
197
+ "figure-library.text.in-use-no-archive": "ボードで使用中のため無効にできません。先にボードから外してください。",
198
+ "figure-library.text.in-use-no-purge": "ボードで使用中のため完全に削除できません。先にボードから外してください。",
199
+ "figure-library.label.state": "状態",
200
+ "figure-library.state.active": "有効",
201
+ "figure-library.state.inactive": "無効"
192
202
  }
@@ -85,12 +85,11 @@
85
85
  "figure-library.text.not-latest": "최신 아님",
86
86
  "figure-library.label.release-shown": "보이는 버전",
87
87
  "label.figure-data": "피규어 데이터",
88
- "error.figure-archived": "이 도메인에서 아카이브되었습니다.",
88
+ "error.figure-archived": "이 도메인에서 비활성 상태인 피규어입니다.",
89
89
  "error.figure-in-use": "{name} 은 보드 {count}개에 놓여 있습니다: {boards}. 보드에서 먼저 빼세요.",
90
- "figure-library.label.archived": "아카이브 포함",
91
- "figure-library.text.archived": "아카이브됨",
92
- "figure-library.button.archive": "아카이브",
93
- "figure-library.button.unarchive": "아카이브 해제",
90
+ "figure-library.text.archived": "비활성",
91
+ "figure-library.button.archive": "비활성화",
92
+ "figure-library.button.unarchive": "활성화",
94
93
  "figure-library.label.item-only": "아이템만",
95
94
  "figure-library.text.item": "아이템",
96
95
  "figure-library.item-types.title": "아이템 타입",
@@ -161,7 +160,7 @@
161
160
  "figure-library.source-status.not-installed": "설치 안 됨",
162
161
  "figure-library.source-status.installed": "설치됨",
163
162
  "figure-library.source-status.newer": "새 버전",
164
- "figure-library.source-status.archived": "아카이브됨",
163
+ "figure-library.source-status.archived": "비활성",
165
164
  "figure-library.source-status.format-unsupported": "형식 미지원",
166
165
  "figure-library.setting.title": "피규어 서버 연결",
167
166
  "figure-library.setting.url": "서버 주소",
@@ -188,5 +187,16 @@
188
187
  "figure-library.setting.missing": "입력해야 연결됩니다.",
189
188
  "figure-library.setting.capability-pushed": "이 앱의 능력 모듈({provider} {version})을 피규어 서버에 올렸습니다.",
190
189
  "figure-library.setting.capability-not-pushed": "이 앱의 능력 모듈({provider} {version})을 아직 피규어 서버에 올리지 않았습니다. 연결을 저장하거나 확인하면 올립니다.",
191
- "figure-library.setting.capability-push-failed": "이 앱의 능력 모듈({provider} {version})을 피규어 서버에 올리지 못했습니다. 앱은 그대로 동작합니다. 사유: {reason}"
190
+ "figure-library.setting.capability-push-failed": "이 앱의 능력 모듈({provider} {version})을 피규어 서버에 업로드하지 못했습니다. 앱은 계속 사용할 수 있습니다. 사유: {reason}",
191
+ "figure-library.label.unused": "보드 미사용",
192
+ "figure-library.button.purge": "영구 삭제",
193
+ "figure-library.title.purge-confirm": "피규어 영구 삭제",
194
+ "figure-library.text.purge-confirm": "현재 도메인의 라이브러리에서 「{name}」의 모든 설치 버전과 다른 버전에서 사용하지 않는 관련 파일을 영구 삭제합니다. 되돌릴 수 없습니다. 다시 사용하려면 패키지를 다시 가져와야 합니다.",
195
+ "figure-library.text.unarchived": "활성화됨",
196
+ "error.figure-not-archived": "「{name}」은 활성 상태입니다. 비활성화한 피규어만 영구 삭제할 수 있습니다.",
197
+ "figure-library.text.in-use-no-archive": "보드에서 사용 중인 피규어는 비활성화할 수 없습니다. 해당 보드에서 피규어를 제거한 뒤 다시 시도하세요.",
198
+ "figure-library.text.in-use-no-purge": "보드에서 사용 중인 피규어는 영구 삭제할 수 없습니다. 해당 보드에서 피규어를 제거한 뒤 다시 시도하세요.",
199
+ "figure-library.label.state": "상태",
200
+ "figure-library.state.active": "활성",
201
+ "figure-library.state.inactive": "비활성"
192
202
  }
@@ -85,12 +85,11 @@
85
85
  "figure-library.text.not-latest": "bukan terbaharu",
86
86
  "figure-library.label.release-shown": "terbitan ditunjukkan",
87
87
  "label.figure-data": "data figure",
88
- "error.figure-archived": "telah diarkibkan dalam domain ini.",
88
+ "error.figure-archived": "tidak aktif dalam domain ini.",
89
89
  "error.figure-in-use": "{name} berada pada {count} papan: {boards}. Keluarkan daripadanya dahulu.",
90
- "figure-library.label.archived": "Sertakan yang diarkibkan",
91
- "figure-library.text.archived": "diarkibkan",
92
- "figure-library.button.archive": "Arkibkan",
93
- "figure-library.button.unarchive": "Nyaharkib",
90
+ "figure-library.text.archived": "tidak aktif",
91
+ "figure-library.button.archive": "Nyahaktifkan",
92
+ "figure-library.button.unarchive": "Aktifkan semula",
94
93
  "figure-library.label.item-only": "Item sahaja",
95
94
  "figure-library.text.item": "item",
96
95
  "figure-library.item-types.title": "Jenis item",
@@ -161,7 +160,7 @@
161
160
  "figure-library.source-status.not-installed": "belum dipasang",
162
161
  "figure-library.source-status.installed": "dipasang",
163
162
  "figure-library.source-status.newer": "versi baharu",
164
- "figure-library.source-status.archived": "diarkibkan",
163
+ "figure-library.source-status.archived": "Tidak aktif",
165
164
  "figure-library.source-status.format-unsupported": "format tidak disokong",
166
165
  "figure-library.setting.title": "Pelayan figure",
167
166
  "figure-library.setting.url": "alamat pelayan",
@@ -188,5 +187,16 @@
188
187
  "figure-library.setting.missing": "Diperlukan untuk menyambung.",
189
188
  "figure-library.setting.capability-pushed": "This app's capability module ({provider} {version}) is on the figure server.",
190
189
  "figure-library.setting.capability-not-pushed": "This app's capability module ({provider} {version}) is not on the figure server yet. Saving or checking the link pushes it.",
191
- "figure-library.setting.capability-push-failed": "This app's capability module ({provider} {version}) could not be pushed to the figure server. The app works on. Reason: {reason}"
190
+ "figure-library.setting.capability-push-failed": "This app's capability module ({provider} {version}) could not be pushed to the figure server. The app works on. Reason: {reason}",
191
+ "figure-library.label.unused": "Tiada pada mana-mana papan",
192
+ "figure-library.button.purge": "Padam kekal",
193
+ "figure-library.title.purge-confirm": "Padam figura secara kekal",
194
+ "figure-library.text.purge-confirm": "Padam semua versi {name} yang dipasang daripada pustaka domain ini secara kekal, bersama fail berkaitan yang tidak digunakan oleh versi lain. Tindakan ini tidak boleh dibuat asal. Untuk menggunakannya semula, import pakejnya sekali lagi.",
195
+ "figure-library.text.unarchived": "aktif semula",
196
+ "error.figure-not-archived": "{name} masih aktif. Hanya figura yang dinyahaktifkan boleh dipadam secara kekal.",
197
+ "figure-library.text.in-use-no-archive": "Papan menggunakannya, jadi ia tidak boleh dinyahaktifkan. Keluarkan daripada papan dahulu.",
198
+ "figure-library.text.in-use-no-purge": "Papan menggunakannya, jadi ia tidak boleh dipadam. Keluarkan daripada papan dahulu.",
199
+ "figure-library.label.state": "Keadaan",
200
+ "figure-library.state.active": "Aktif",
201
+ "figure-library.state.inactive": "Tidak aktif"
192
202
  }
@@ -85,12 +85,11 @@
85
85
  "figure-library.text.not-latest": "非最新",
86
86
  "figure-library.label.release-shown": "显示的版本",
87
87
  "label.figure-data": "Figure 数据",
88
- "error.figure-archived": "已在此域中归档。",
88
+ "error.figure-archived": "在此域中已停用。",
89
89
  "error.figure-in-use": "{name} 位于 {count} 个看板上: {boards}。请先从看板中移除。",
90
- "figure-library.label.archived": "包含已归档",
91
- "figure-library.text.archived": "已归档",
92
- "figure-library.button.archive": "归档",
93
- "figure-library.button.unarchive": "取消归档",
90
+ "figure-library.text.archived": "已停用",
91
+ "figure-library.button.archive": "停用",
92
+ "figure-library.button.unarchive": "重新启用",
94
93
  "figure-library.label.item-only": "仅物品",
95
94
  "figure-library.text.item": "物品",
96
95
  "figure-library.item-types.title": "物品类型",
@@ -161,7 +160,7 @@
161
160
  "figure-library.source-status.not-installed": "未安装",
162
161
  "figure-library.source-status.installed": "已安装",
163
162
  "figure-library.source-status.newer": "有新版本",
164
- "figure-library.source-status.archived": "已归档",
163
+ "figure-library.source-status.archived": "已停用",
165
164
  "figure-library.source-status.format-unsupported": "格式不受支持",
166
165
  "figure-library.setting.title": "图形服务器连接",
167
166
  "figure-library.setting.url": "服务器地址",
@@ -188,5 +187,16 @@
188
187
  "figure-library.setting.missing": "需要填写才能连接。",
189
188
  "figure-library.setting.capability-pushed": "This app's capability module ({provider} {version}) is on the figure server.",
190
189
  "figure-library.setting.capability-not-pushed": "This app's capability module ({provider} {version}) is not on the figure server yet. Saving or checking the link pushes it.",
191
- "figure-library.setting.capability-push-failed": "This app's capability module ({provider} {version}) could not be pushed to the figure server. The app works on. Reason: {reason}"
190
+ "figure-library.setting.capability-push-failed": "This app's capability module ({provider} {version}) could not be pushed to the figure server. The app works on. Reason: {reason}",
191
+ "figure-library.label.unused": "未在任何看板上",
192
+ "figure-library.button.purge": "永久删除",
193
+ "figure-library.title.purge-confirm": "永久删除图元",
194
+ "figure-library.text.purge-confirm": "将从当前域的库中永久删除 {name} 的所有已安装版本,以及其他版本未使用的相关文件。此操作无法撤销。若要再次使用,请重新导入其包。",
195
+ "figure-library.text.unarchived": "已重新启用",
196
+ "error.figure-not-archived": "{name} 处于启用状态。只有已停用的图元才能永久删除。",
197
+ "figure-library.text.in-use-no-archive": "看板正在使用,无法停用。请先从看板中移除。",
198
+ "figure-library.text.in-use-no-purge": "看板正在使用,无法永久删除。请先从看板中移除。",
199
+ "figure-library.label.state": "状态",
200
+ "figure-library.state.active": "启用",
201
+ "figure-library.state.inactive": "停用"
192
202
  }