@things-factory/figure-library 10.1.281 → 10.1.282

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 (35) hide show
  1. package/dist-client/index.d.ts +1 -0
  2. package/dist-client/index.js +1 -0
  3. package/dist-client/pages/figure-library-page.d.ts +6 -0
  4. package/dist-client/pages/figure-library-page.js +42 -2
  5. package/dist-client/settings/figure-source-setting-let.d.ts +25 -0
  6. package/dist-client/settings/figure-source-setting-let.js +190 -0
  7. package/dist-client/viewparts/figure-import-result.d.ts +20 -0
  8. package/dist-client/viewparts/figure-import-result.js +50 -0
  9. package/dist-client/viewparts/figure-package-import.d.ts +3 -14
  10. package/dist-client/viewparts/figure-package-import.js +3 -28
  11. package/dist-client/viewparts/figure-source-install.d.ts +24 -0
  12. package/dist-client/viewparts/figure-source-install.js +313 -0
  13. package/dist-server/routers/figure-source-thumbnail-router.d.ts +5 -0
  14. package/dist-server/routers/figure-source-thumbnail-router.js +39 -0
  15. package/dist-server/routes.js +3 -0
  16. package/dist-server/service/figure-library-resolver.js +2 -4
  17. package/dist-server/service/index.d.ts +6 -1
  18. package/dist-server/service/index.js +6 -1
  19. package/dist-server/service/library/import.d.ts +2 -0
  20. package/dist-server/service/library/import.js +3 -0
  21. package/dist-server/service/source/figure-source-resolver.d.ts +57 -0
  22. package/dist-server/service/source/figure-source-resolver.js +287 -0
  23. package/dist-server/service/source/source-client.d.ts +27 -0
  24. package/dist-server/service/source/source-client.js +109 -0
  25. package/dist-server/service/source/source-install.d.ts +57 -0
  26. package/dist-server/service/source/source-install.js +83 -0
  27. package/dist-server/service/source/source-setting-rules.d.ts +39 -0
  28. package/dist-server/service/source/source-setting-rules.js +71 -0
  29. package/package.json +8 -6
  30. package/translations/en.json +33 -1
  31. package/translations/es.json +33 -1
  32. package/translations/ja.json +33 -1
  33. package/translations/ko.json +33 -1
  34. package/translations/ms.json +33 -1
  35. package/translations/zh.json +33 -1
@@ -0,0 +1,313 @@
1
+ import { __decorate, __metadata } from "tslib";
2
+ import '@material/web/button/text-button.js';
3
+ import '@material/web/button/filled-button.js';
4
+ import '@operato/popup/ox-popup-actions.js';
5
+ import './figure-import-result.js';
6
+ import gql from 'graphql-tag';
7
+ import { css, html, LitElement, nothing } from 'lit';
8
+ import { customElement, state } from 'lit/decorators.js';
9
+ import { client } from '@operato/graphql';
10
+ import { i18next, localize } from '@operato/i18n';
11
+ import { CommonPopupStyles, FormFieldStyles, PopupBodyStyles, PopupFieldStyles } from '@operato/styles';
12
+ import { getPathInfo } from '@operato/utils';
13
+ import { announceLibraryChanged } from '../figure-library-changed.js';
14
+ /** How many figures one read brings; 「더 보기」 reads the next. */
15
+ const PAGE = 50;
16
+ const CATALOG = gql `
17
+ query ($search: String, $pagination: Pagination) {
18
+ figureSourceCatalog(search: $search, pagination: $pagination) {
19
+ items {
20
+ figureId
21
+ fullName
22
+ ref
23
+ version
24
+ name
25
+ names
26
+ category
27
+ deprecated
28
+ thumbnailHash
29
+ installedVersion
30
+ status
31
+ }
32
+ total
33
+ }
34
+ }
35
+ `;
36
+ const INSTALL = gql `
37
+ mutation ($refs: [String!]!) {
38
+ installFigures(refs: $refs) {
39
+ problems {
40
+ code
41
+ path
42
+ }
43
+ outcomes {
44
+ ref
45
+ outcome
46
+ code
47
+ differs
48
+ }
49
+ }
50
+ }
51
+ `;
52
+ /** The status chip of a row: its words and how loud it is. */
53
+ const STATUS_TONE = {
54
+ 'not-installed': 'plain',
55
+ installed: 'muted',
56
+ newer: 'warn',
57
+ archived: 'muted',
58
+ 'format-unsupported': 'crit'
59
+ };
60
+ /*
61
+ * Installing figures straight from the figure server set in Settings (ADR-0114 amendment 2026-11-14). The board server
62
+ * reads the figure server's catalog and installs the chosen releases through the same import a package file goes
63
+ * through, so the result reads as a file import's does. The browser never talks to the figure server: the catalog, the
64
+ * pictures and the install are this server's doors.
65
+ */
66
+ let FigureSourceInstall = class FigureSourceInstall extends localize(i18next)(LitElement) {
67
+ constructor() {
68
+ super(...arguments);
69
+ this.search = '';
70
+ this.items = [];
71
+ this.total = 0;
72
+ this.reading = false;
73
+ this.installing = false;
74
+ this.failure = '';
75
+ this.chosen = new Set();
76
+ }
77
+ static { this.styles = [
78
+ CommonPopupStyles,
79
+ PopupBodyStyles,
80
+ FormFieldStyles,
81
+ PopupFieldStyles,
82
+ css `
83
+ ul[figures] {
84
+ list-style: none;
85
+ margin: 0;
86
+ padding: 0;
87
+ display: flex;
88
+ flex-direction: column;
89
+ }
90
+ ul[figures] li {
91
+ display: grid;
92
+ grid-template-columns: auto 48px minmax(0, 1fr) auto;
93
+ align-items: center;
94
+ gap: var(--spacing-medium, 8px);
95
+ padding: var(--spacing-small, 4px) 0;
96
+ border-bottom: 1px solid var(--ui-line-soft, var(--md-sys-color-surface-container));
97
+ }
98
+ [thumb] {
99
+ width: 48px;
100
+ height: 36px;
101
+ object-fit: contain;
102
+ border-radius: var(--border-radius, 4px);
103
+ background: var(--ui-line-soft, var(--md-sys-color-surface-container));
104
+ }
105
+ [title] {
106
+ display: flex;
107
+ flex-direction: column;
108
+ min-width: 0;
109
+ }
110
+ [title] strong,
111
+ [title] small {
112
+ overflow: hidden;
113
+ text-overflow: ellipsis;
114
+ white-space: nowrap;
115
+ }
116
+ [title] small {
117
+ color: var(--ui-muted);
118
+ font-family: var(--ui-mono, monospace);
119
+ font-size: var(--ui-t-small, 11.5px);
120
+ }
121
+ [chips] {
122
+ display: flex;
123
+ gap: var(--spacing-small, 4px);
124
+ justify-content: flex-end;
125
+ flex-wrap: wrap;
126
+ }
127
+ [chip] {
128
+ padding: 1px 6px;
129
+ border-radius: 999px;
130
+ font-size: var(--ui-t-small, 11.5px);
131
+ white-space: nowrap;
132
+ border: 1px solid currentColor;
133
+ }
134
+ [chip='plain'] {
135
+ color: var(--ui-ink, var(--md-sys-color-on-surface));
136
+ }
137
+ [chip='muted'] {
138
+ color: var(--ui-muted);
139
+ }
140
+ [chip='warn'] {
141
+ color: var(--ui-warn, #b26b00);
142
+ }
143
+ [chip='crit'] {
144
+ color: var(--ui-crit, var(--md-sys-color-error));
145
+ }
146
+ [refused] {
147
+ color: var(--ui-crit, var(--md-sys-color-error));
148
+ margin: 0;
149
+ }
150
+ [more] {
151
+ align-self: center;
152
+ }
153
+ `
154
+ ]; }
155
+ connectedCallback() {
156
+ super.connectedCallback();
157
+ this.read(true);
158
+ }
159
+ render() {
160
+ const count = this.chosen.size;
161
+ return html `
162
+ <div class="body">
163
+ <label class="field">
164
+ <span>${i18next.t('figure-library.label.search-source')}</span>
165
+ <input
166
+ type="search"
167
+ .value=${this.search}
168
+ placeholder=${i18next.t('figure-library.text.search')}
169
+ @change=${(e) => {
170
+ this.search = e.target.value.trim();
171
+ this.read(true);
172
+ }}
173
+ />
174
+ </label>
175
+
176
+ ${this.failure ? html `<p refused role="alert">${this.failure}</p>` : nothing}
177
+ ${!this.failure && !this.reading && !this.items.length ? html `<div class="note">${i18next.t('figure-library.text.source-empty')}</div>` : nothing}
178
+
179
+ <ul figures>
180
+ ${this.items.map(item => this.renderItem(item))}
181
+ </ul>
182
+ ${this.items.length < this.total
183
+ ? html `<md-text-button more ?disabled=${this.reading} @click=${() => this.read(false)}>${i18next.t('figure-library.button.more')}</md-text-button>`
184
+ : nothing}
185
+
186
+ <figure-import-result .result=${this.result}></figure-import-result>
187
+ </div>
188
+
189
+ <ox-popup-actions>
190
+ <md-text-button slot="cancel" @click=${() => this.dispatchEvent(new CustomEvent('close'))}>${i18next.t('figure-library.button.close')}</md-text-button>
191
+ <md-filled-button slot="confirm" ?disabled=${!count || this.installing} @click=${() => this.install()}>
192
+ ${i18next.t('figure-library.button.install', { count })}
193
+ </md-filled-button>
194
+ </ox-popup-actions>
195
+ `;
196
+ }
197
+ renderItem(item) {
198
+ const name = item.names?.[i18next.language] ?? item.name ?? item.fullName;
199
+ const picture = item.thumbnailHash ? `${getPathInfo(location.pathname).contextPath}/figure-library-source/thumbnail/${item.figureId}?v=${item.thumbnailHash}` : null;
200
+ const version = item.installedVersion && item.installedVersion !== item.version
201
+ ? i18next.t('figure-library.text.source-version-here', { version: item.version, here: item.installedVersion })
202
+ : i18next.t('figure-library.text.source-version', { version: item.version });
203
+ return html `<li>
204
+ <input
205
+ type="checkbox"
206
+ aria-label=${name}
207
+ .checked=${this.chosen.has(item.ref)}
208
+ ?disabled=${this.installing}
209
+ @change=${(e) => this.choose(item.ref, e.target.checked)}
210
+ />
211
+ ${picture ? html `<img thumb src=${picture} alt="" loading="lazy" />` : html `<span thumb></span>`}
212
+ <span title>
213
+ <strong>${name}</strong>
214
+ <small>${item.fullName} · ${version}</small>
215
+ </span>
216
+ <span chips>
217
+ ${item.deprecated ? html `<span chip="muted">${i18next.t('figure-library.text.deprecated')}</span>` : nothing}
218
+ <span chip=${STATUS_TONE[item.status]}>${i18next.t(`figure-library.source-status.${item.status}`)}</span>
219
+ </span>
220
+ </li>`;
221
+ }
222
+ choose(ref, on) {
223
+ const next = new Set(this.chosen);
224
+ on ? next.add(ref) : next.delete(ref);
225
+ this.chosen = next;
226
+ }
227
+ async read(fresh) {
228
+ this.reading = true;
229
+ this.failure = '';
230
+ const page = fresh ? 1 : Math.floor(this.items.length / PAGE) + 1;
231
+ try {
232
+ const response = await client.query({
233
+ query: CATALOG,
234
+ fetchPolicy: 'no-cache',
235
+ variables: {
236
+ search: this.search || null,
237
+ pagination: { page, limit: PAGE }
238
+ }
239
+ });
240
+ if (response.errors?.length)
241
+ throw new Error(response.errors[0].message);
242
+ const { items, total } = response.data.figureSourceCatalog;
243
+ this.items = fresh ? items : [...this.items, ...items];
244
+ this.total = total;
245
+ }
246
+ catch (e) {
247
+ this.failure = e?.message ?? String(e);
248
+ if (fresh)
249
+ this.items = [];
250
+ }
251
+ finally {
252
+ this.reading = false;
253
+ }
254
+ }
255
+ async install() {
256
+ this.installing = true;
257
+ this.result = undefined;
258
+ try {
259
+ const response = await client.mutate({ mutation: INSTALL, variables: { refs: [...this.chosen] } });
260
+ if (response.errors?.length)
261
+ throw new Error(response.errors[0].message);
262
+ this.result = response.data.installFigures;
263
+ if (this.result.outcomes.some(one => one.outcome === 'added'))
264
+ announceLibraryChanged();
265
+ this.chosen = new Set();
266
+ this.dispatchEvent(new CustomEvent('imported', { detail: this.result }));
267
+ await this.read(true);
268
+ }
269
+ catch (e) {
270
+ this.result = { problems: [{ code: e?.message ?? 'error' }], outcomes: [] };
271
+ }
272
+ finally {
273
+ this.installing = false;
274
+ }
275
+ }
276
+ };
277
+ __decorate([
278
+ state(),
279
+ __metadata("design:type", Object)
280
+ ], FigureSourceInstall.prototype, "search", void 0);
281
+ __decorate([
282
+ state(),
283
+ __metadata("design:type", Array)
284
+ ], FigureSourceInstall.prototype, "items", void 0);
285
+ __decorate([
286
+ state(),
287
+ __metadata("design:type", Object)
288
+ ], FigureSourceInstall.prototype, "total", void 0);
289
+ __decorate([
290
+ state(),
291
+ __metadata("design:type", Object)
292
+ ], FigureSourceInstall.prototype, "reading", void 0);
293
+ __decorate([
294
+ state(),
295
+ __metadata("design:type", Object)
296
+ ], FigureSourceInstall.prototype, "installing", void 0);
297
+ __decorate([
298
+ state(),
299
+ __metadata("design:type", Object)
300
+ ], FigureSourceInstall.prototype, "failure", void 0);
301
+ __decorate([
302
+ state(),
303
+ __metadata("design:type", Object)
304
+ ], FigureSourceInstall.prototype, "chosen", void 0);
305
+ __decorate([
306
+ state(),
307
+ __metadata("design:type", Object)
308
+ ], FigureSourceInstall.prototype, "result", void 0);
309
+ FigureSourceInstall = __decorate([
310
+ customElement('figure-source-install')
311
+ ], FigureSourceInstall);
312
+ export { FigureSourceInstall };
313
+ //# sourceMappingURL=figure-source-install.js.map
@@ -0,0 +1,5 @@
1
+ /**
2
+ * The picture of a figure server's release, relayed with this server's token (ADR-0114 decision 25): the browser
3
+ * never holds the token, so it asks here. Behind the library's own read door.
4
+ */
5
+ export declare const figureSourceThumbnailRouter: any;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.figureSourceThumbnailRouter = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const koa_router_1 = tslib_1.__importDefault(require("koa-router"));
6
+ const auth_base_1 = require("@things-factory/auth-base");
7
+ const shell_1 = require("@things-factory/shell");
8
+ const figure_source_resolver_1 = require("../service/source/figure-source-resolver");
9
+ const source_client_1 = require("../service/source/source-client");
10
+ /**
11
+ * The picture of a figure server's release, relayed with this server's token (ADR-0114 decision 25): the browser
12
+ * never holds the token, so it asks here. Behind the library's own read door.
13
+ */
14
+ exports.figureSourceThumbnailRouter = new koa_router_1.default();
15
+ exports.figureSourceThumbnailRouter.get('/figure-library-source/thumbnail/:figureId', async (context) => {
16
+ const { domain, user, unsafeIP, prohibitedPrivileges } = context.state;
17
+ const allowed = await (0, auth_base_1.checkPermission)({ category: 'figure-library', privilege: 'query', owner: true }, user, domain, unsafeIP, prohibitedPrivileges);
18
+ if (!allowed) {
19
+ context.status = 403;
20
+ return;
21
+ }
22
+ try {
23
+ const picture = await (0, source_client_1.sourceThumbnail)(await (0, figure_source_resolver_1.figureSourceOf)(domain, (0, shell_1.getDataSource)().manager), context.params.figureId);
24
+ if (!picture) {
25
+ context.status = 404;
26
+ return;
27
+ }
28
+ /* The caller adds `?v=<release picture hash>`, so a day of private cache never shows an old picture. */
29
+ context.set('Cache-Control', 'private, max-age=86400');
30
+ context.type = picture.contentType;
31
+ context.body = picture.bytes;
32
+ }
33
+ catch (error) {
34
+ if (!(error instanceof shell_1.Refusal))
35
+ throw error;
36
+ context.status = error.code === 'figure-source-not-set' ? 404 : 502;
37
+ }
38
+ });
39
+ //# sourceMappingURL=figure-source-thumbnail-router.js.map
@@ -3,14 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const env_1 = require("@things-factory/env");
4
4
  const shell_1 = require("@things-factory/shell");
5
5
  const figure_library_file_router_1 = require("./routers/figure-library-file-router");
6
+ const figure_source_thumbnail_router_1 = require("./routers/figure-source-thumbnail-router");
6
7
  /* With subdomains the domain is in the host name; otherwise in the path, as figure-service and board-service do. */
7
8
  const isPathBaseDomain = !env_1.config.get('subdomain');
8
9
  process.on('bootstrap-module-domain-private-route', (app, domainPrivateRouter) => {
9
10
  if (isPathBaseDomain) {
10
11
  domainPrivateRouter.use(`/${(0, shell_1.getRoutePrefixForDomainType)()}/:domain`, figure_library_file_router_1.figureLibraryFileRouter.routes(), figure_library_file_router_1.figureLibraryFileRouter.allowedMethods());
12
+ domainPrivateRouter.use(`/${(0, shell_1.getRoutePrefixForDomainType)()}/:domain`, figure_source_thumbnail_router_1.figureSourceThumbnailRouter.routes(), figure_source_thumbnail_router_1.figureSourceThumbnailRouter.allowedMethods());
11
13
  }
12
14
  else {
13
15
  domainPrivateRouter.use('', figure_library_file_router_1.figureLibraryFileRouter.routes(), figure_library_file_router_1.figureLibraryFileRouter.allowedMethods());
16
+ domainPrivateRouter.use('', figure_source_thumbnail_router_1.figureSourceThumbnailRouter.routes(), figure_source_thumbnail_router_1.figureSourceThumbnailRouter.allowedMethods());
14
17
  }
15
18
  });
16
19
  //# sourceMappingURL=routes.js.map
@@ -24,15 +24,13 @@ function plainTextOf(refusal, context) {
24
24
  ? context.t((0, shell_1.refusalKey)(refusal.code), { ...refusal.params, defaultValue: refusal.message, interpolation: { escapeValue: false } })
25
25
  : refusal.message;
26
26
  }
27
- /** The most bytes one package upload may carry. */
28
- const PACKAGE_MAX_BYTES = 64 * 1024 * 1024;
29
27
  async function bytesOf(file) {
30
28
  const chunks = [];
31
29
  let size = 0;
32
30
  for await (const chunk of file.createReadStream()) {
33
31
  size += chunk.length;
34
- if (size > PACKAGE_MAX_BYTES)
35
- throw new shell_1.Refusal('figure-package-too-large', { max: PACKAGE_MAX_BYTES }, 'a figure package is at most {max} bytes.');
32
+ if (size > import_1.PACKAGE_MAX_BYTES)
33
+ throw new shell_1.Refusal('figure-package-too-large', { max: import_1.PACKAGE_MAX_BYTES }, 'a figure package is at most {max} bytes.');
36
34
  chunks.push(Buffer.from(chunk));
37
35
  }
38
36
  return Buffer.concat(chunks);
@@ -1,6 +1,7 @@
1
1
  import { FigureLibraryRelease } from './figure-library-release/figure-library-release';
2
2
  import { FigureTypeMapEntry } from './figure-type-map/figure-type-map-entry';
3
3
  import { FigureLibraryResolver } from './figure-library-resolver';
4
+ import { FigureSourceResolver } from './source/figure-source-resolver';
4
5
  export * from './figure-library-release/figure-library-release';
5
6
  export * from './figure-type-map/figure-type-map-entry';
6
7
  export * from './figure-library-types';
@@ -14,7 +15,11 @@ export * from './library/import';
14
15
  export * from './library/inspection';
15
16
  export * from './library/library-files';
16
17
  export * from './library/type-map';
18
+ export * from './source/source-setting-rules';
19
+ export * from './source/source-client';
20
+ export * from './source/source-install';
21
+ export * from './source/figure-source-resolver';
17
22
  export declare const entities: (typeof FigureLibraryRelease | typeof FigureTypeMapEntry)[];
18
23
  export declare const schema: {
19
- resolverClasses: (typeof FigureLibraryResolver)[];
24
+ resolverClasses: (typeof FigureSourceResolver | typeof FigureLibraryResolver)[];
20
25
  };
@@ -9,6 +9,7 @@ const tslib_1 = require("tslib");
9
9
  const figure_library_release_1 = require("./figure-library-release/figure-library-release");
10
10
  const figure_type_map_entry_1 = require("./figure-type-map/figure-type-map-entry");
11
11
  const figure_library_resolver_1 = require("./figure-library-resolver");
12
+ const figure_source_resolver_1 = require("./source/figure-source-resolver");
12
13
  tslib_1.__exportStar(require("./figure-library-release/figure-library-release"), exports);
13
14
  tslib_1.__exportStar(require("./figure-type-map/figure-type-map-entry"), exports);
14
15
  tslib_1.__exportStar(require("./figure-library-types"), exports);
@@ -22,7 +23,11 @@ tslib_1.__exportStar(require("./library/import"), exports);
22
23
  tslib_1.__exportStar(require("./library/inspection"), exports);
23
24
  tslib_1.__exportStar(require("./library/library-files"), exports);
24
25
  tslib_1.__exportStar(require("./library/type-map"), exports);
26
+ tslib_1.__exportStar(require("./source/source-setting-rules"), exports);
27
+ tslib_1.__exportStar(require("./source/source-client"), exports);
28
+ tslib_1.__exportStar(require("./source/source-install"), exports);
29
+ tslib_1.__exportStar(require("./source/figure-source-resolver"), exports);
25
30
  /* The shell builds the database and the schema from these two names; a module without them has no tables and no doors. */
26
31
  exports.entities = [figure_library_release_1.FigureLibraryRelease, figure_type_map_entry_1.FigureTypeMapEntry];
27
- exports.schema = { resolverClasses: [figure_library_resolver_1.FigureLibraryResolver] };
32
+ exports.schema = { resolverClasses: [figure_library_resolver_1.FigureLibraryResolver, figure_source_resolver_1.FigureSourceResolver] };
28
33
  //# sourceMappingURL=index.js.map
@@ -1,5 +1,7 @@
1
1
  import { EntityManager } from 'typeorm';
2
2
  import { type LibraryFiles } from './library-files';
3
+ /** The most bytes one package may carry, uploaded or fetched from a figure server. */
4
+ export declare const PACKAGE_MAX_BYTES: number;
3
5
  export type ImportOutcomeKind = 'added' | 'skipped' | 'refused';
4
6
  export interface ImportOutcome {
5
7
  ref: string;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PACKAGE_MAX_BYTES = void 0;
3
4
  exports.importFigurePackage = importFigurePackage;
4
5
  exports.assertPackageName = assertPackageName;
5
6
  const tslib_1 = require("tslib");
@@ -10,6 +11,8 @@ const figure_library_release_1 = require("../figure-library-release/figure-libra
10
11
  const derived_1 = require("./derived");
11
12
  const library_files_1 = require("./library-files");
12
13
  const type_map_1 = require("./type-map");
14
+ /** The most bytes one package may carry, uploaded or fetched from a figure server. */
15
+ exports.PACKAGE_MAX_BYTES = 64 * 1024 * 1024;
13
16
  const json = (value) => (value == null ? null : JSON.stringify(value));
14
17
  /**
15
18
  * Imports a figure package into this domain's library (ADR-0114 결정 5 · 16).
@@ -0,0 +1,57 @@
1
+ import { EntityManager } from 'typeorm';
2
+ import { ListParam } from '@things-factory/shell';
3
+ import { FigureImportResult } from '../figure-library-types';
4
+ import { type FigureSource } from './source-setting-rules';
5
+ export declare class FigureSourceSetting {
6
+ url?: string;
7
+ domain?: string;
8
+ tokenSet: boolean;
9
+ tokenHint?: string;
10
+ }
11
+ export declare class FigureSourceSettingPatch {
12
+ url?: string;
13
+ domain?: string;
14
+ token?: string;
15
+ }
16
+ export declare class FigureSourceCheck {
17
+ ok: boolean;
18
+ code?: string;
19
+ message?: string;
20
+ total?: number;
21
+ }
22
+ export declare class FigureSourceCatalogItem {
23
+ figureId: string;
24
+ fullName: string;
25
+ ref: string;
26
+ version: number;
27
+ name?: string;
28
+ names?: Record<string, string>;
29
+ description?: string;
30
+ category?: string;
31
+ deprecated: boolean;
32
+ supersededBy?: string;
33
+ public: boolean;
34
+ thumbnailHash?: string;
35
+ installedVersion?: number;
36
+ status: string;
37
+ }
38
+ export declare class FigureSourceCatalog {
39
+ items: FigureSourceCatalogItem[];
40
+ total: number;
41
+ }
42
+ /** The figure server this domain installs from; refused while it is not set. */
43
+ export declare function figureSourceOf(domain: any, manager: EntityManager): Promise<FigureSource>;
44
+ /**
45
+ * Installing figures straight from a figure server (ADR-0114 amendment 2026-11-14). The setting is domain attributes,
46
+ * opened by the EnvVar privilege as the other connection cards are; the catalog and the install are the library's
47
+ * own query and mutation, as a package file import is. Every call to the figure server is made here, never by the
48
+ * browser, so the token stays on this server.
49
+ */
50
+ export declare class FigureSourceResolver {
51
+ figureLibrarySource(context: ResolverContext): Promise<FigureSourceSetting>;
52
+ updateFigureLibrarySource(patch: FigureSourceSettingPatch, context: ResolverContext): Promise<FigureSourceSetting>;
53
+ checkFigureLibrarySource(context: ResolverContext): Promise<FigureSourceCheck>;
54
+ figureLibrarySourceSet(context: ResolverContext): Promise<boolean>;
55
+ figureSourceCatalog(params: ListParam, context: ResolverContext): Promise<FigureSourceCatalog>;
56
+ installFigures(refs: string[], context: ResolverContext): Promise<FigureImportResult>;
57
+ }