@knkcs/importhub-ui 0.1.0 → 0.3.0

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/dist/index.d.ts CHANGED
@@ -1,8 +1,18 @@
1
1
  import { JSX } from 'react';
2
2
  import { LucideIcon } from 'lucide-react';
3
3
  import { ReactNode } from 'react';
4
+ import { Schema } from '@knkcs/fieldkit/schema';
4
5
  import { Transport } from '@connectrpc/connect';
5
6
 
7
+ /** What moving a Mapping's draft to another Blueprint Release would lose. */
8
+ export declare interface BlueprintReleaseCheck {
9
+ blueprintId: string;
10
+ /** Every mapped field path the Release does not have. */
11
+ missingFieldPaths: string[];
12
+ /** Every Release Spec field read or matched on that it does not have. */
13
+ missingReleaseSpecFields: string[];
14
+ }
15
+
6
16
  /**
7
17
  * The link out to a Change Set in contenthub, where the host says it is
8
18
  * (`ImporthubHost.changeSetHref`). Nothing when the host has no address for
@@ -14,6 +24,126 @@ export declare interface ChangeSetLinkProps {
14
24
  changeSetId: string;
15
25
  }
16
26
 
27
+ /** Two Revisions of one configuration, and how each top-level field differs. */
28
+ export declare interface ConfigurationComparison {
29
+ from: ConfigurationVersion;
30
+ to: ConfigurationVersion;
31
+ fields: {
32
+ field: string;
33
+ status: FieldComparisonStatus;
34
+ }[];
35
+ }
36
+
37
+ /**
38
+ * A configuration's history (release-a-configuration:AC6, AC7): every
39
+ * Revision, newest first, with who saved it and when, the Releases cut from
40
+ * it with who cut them and when, and whether it was valid. Choosing two
41
+ * compares them side by side; an admin restores an older one as a new draft.
42
+ * A panel, not a page: the configuration's page renders it as its History
43
+ * tab, and a host may place it elsewhere. The table reaches both edges, as
44
+ * anker's flush tab bodies do.
45
+ */
46
+ export declare function ConfigurationHistory({ client, kind, id, draftRevisionId, onRestored, }: ConfigurationHistoryProps): JSX.Element;
47
+
48
+ /** One page of a configuration's history. */
49
+ export declare interface ConfigurationHistoryPage {
50
+ /** This page's Revisions, newest first. */
51
+ revisions: ConfigurationRevision[];
52
+ /** Every Release, newest first, on every page. */
53
+ releases: ConfigurationReleaseRecord[];
54
+ /** The token of the next page; "" on the last. */
55
+ nextPageToken: string;
56
+ }
57
+
58
+ export declare interface ConfigurationHistoryProps {
59
+ client: ImporthubClient;
60
+ kind: ConfigurationKind;
61
+ /** The Import Profile's, Mapping's or Entity Set's id. */
62
+ id: string;
63
+ /** The draft as the page last read it: a restore builds on it. */
64
+ draftRevisionId: string;
65
+ /**
66
+ * A restore saved a new draft: the page reads it again, and drops edits
67
+ * it holds on the old one.
68
+ */
69
+ onRestored?: () => void | Promise<void>;
70
+ }
71
+
72
+ /**
73
+ * A delete importhub refused because Import Profiles still include the
74
+ * Mapping, or name the Entity Set (manage-mappings:AC4,
75
+ * manage-entity-sets:AC3). Carries the Profiles, so the screen names them.
76
+ */
77
+ export declare class ConfigurationInUseError extends Error {
78
+ readonly importProfiles: ImportProfileRef[];
79
+ constructor(importProfiles: ImportProfileRef[], message?: string);
80
+ }
81
+
82
+ /** The kinds of versioned configuration (ADR 0016). */
83
+ export declare type ConfigurationKind = "importProfile" | "mapping" | "entitySet";
84
+
85
+ /** A Configuration Release, as a list names it: "Release 3". */
86
+ export declare interface ConfigurationRelease {
87
+ id: string;
88
+ number: number;
89
+ }
90
+
91
+ /** A Configuration Release as the history lists it: who cut it, when, from what. */
92
+ export declare interface ConfigurationReleaseRecord extends ConfigurationRelease {
93
+ /** The Revision it pins. */
94
+ revisionId: string;
95
+ /** The odon user id of the admin who cut it. */
96
+ releasedBy: string;
97
+ /** When it was cut, as an ISO 8601 timestamp. */
98
+ releasedAt: string;
99
+ }
100
+
101
+ /** One saved Revision of a configuration, as its history lists it. */
102
+ export declare interface ConfigurationRevision {
103
+ id: string;
104
+ /** The odon user id of who saved it; the host's members name them. */
105
+ savedBy: string;
106
+ /** When it was saved, as an ISO 8601 timestamp. */
107
+ savedAt: string;
108
+ /** Whether it could be released, as decided when it was saved. */
109
+ validity: Validity;
110
+ /** The Revision it restored; "" for an ordinary save. */
111
+ restoredFromRevisionId: string;
112
+ }
113
+
114
+ /** Where a configuration stands: its draft and its latest Release. */
115
+ export declare interface ConfigurationState {
116
+ draftRevisionId: string;
117
+ /** Unset while the configuration has none. */
118
+ latestRelease?: ConfigurationRelease;
119
+ /** True when the draft differs from the latest Release, and while there is none. */
120
+ draftDiffersFromRelease: boolean;
121
+ }
122
+
123
+ /**
124
+ * One side of a comparison: a Revision's content, keyed as importhub keys
125
+ * the compared fields (the proto's field names, such as `mapping_ids`).
126
+ */
127
+ export declare interface ConfigurationVersion {
128
+ revisionId: string;
129
+ content: Record<string, unknown>;
130
+ }
131
+
132
+ /** One configuration of a kind, at its draft. */
133
+ declare interface Configured<C> {
134
+ id: string;
135
+ /** The draft's content. */
136
+ content: C;
137
+ /**
138
+ * Whether it is valid now: for Profiles and Mappings the service's
139
+ * `current_validity`, which counts what changed since the save (an
140
+ * included Mapping turned invalid, a Blueprint gone); for Entity Sets the
141
+ * validity as saved, the only one they have.
142
+ */
143
+ validity: Validity;
144
+ state: ConfigurationState;
145
+ }
146
+
17
147
  /**
18
148
  * The one call a host makes to talk to importhub (knkcms/core ADR 0003):
19
149
  * an `ImporthubClient` over Connect.
@@ -36,12 +166,56 @@ export declare interface CreateConnectImporthubClientOptions {
36
166
  transport?: Transport;
37
167
  }
38
168
 
39
- /** An Entity Set, as a list names it: its draft's name. */
40
- export declare interface EntitySetSummary {
41
- id: string;
169
+ /** A Release cut, and for a Mapping the Import Profiles that take it. */
170
+ export declare interface CutReleaseResult {
171
+ release: ConfigurationReleaseRecord;
172
+ /** The Profiles that include the Mapping; empty for other kinds. */
173
+ importProfiles: ImportProfileRef[];
174
+ }
175
+
176
+ export declare type EntitySet = Configured<EntitySetContent>;
177
+
178
+ /** What an admin edits of an Entity Set. */
179
+ export declare interface EntitySetContent {
42
180
  name: string;
181
+ description: string;
182
+ /** Entity names without `&` and `;`, to the text each stands for. */
183
+ entities: Record<string, string>;
43
184
  }
44
185
 
186
+ /**
187
+ * One Entity Set (manage-entity-sets:AC1): its name and its table of
188
+ * entities, each with the text it stands for. An admin edits the table and
189
+ * saves with the header's Save, and deletes from the rail, which importhub
190
+ * refuses while a Profile names it, naming them (AC3). It shows whether its
191
+ * draft differs from its latest Release, an admin cuts a Release from the
192
+ * rail, and its History tab lists, compares and restores its Revisions
193
+ * (release-a-configuration).
194
+ */
195
+ export declare function EntitySetDetail({ client, id, onDeleted }: EntitySetDetailProps): JSX.Element;
196
+
197
+ export declare interface EntitySetDetailProps {
198
+ client: ImporthubClient;
199
+ /** The Entity Set's id. */
200
+ id: string;
201
+ /** It was deleted: the host leaves its page. */
202
+ onDeleted: () => void;
203
+ }
204
+
205
+ /**
206
+ * Every Entity Set of the workspace, with how many entities each defines
207
+ * (manage-entity-sets:AC1); an admin creates one from the header.
208
+ */
209
+ export declare function EntitySetsIndex({ client, onOpen }: EntitySetsIndexProps): JSX.Element;
210
+
211
+ export declare interface EntitySetsIndexProps {
212
+ client: ImporthubClient;
213
+ /** Opens an Entity Set's page: the host navigates, after a create too. */
214
+ onOpen: (id: string) => void;
215
+ }
216
+
217
+ export declare type FieldComparisonStatus = "unchanged" | "added" | "removed" | "changed";
218
+
45
219
  /** The package's bundled translations, keyed by language, then by namespace. */
46
220
  export declare const i18nResources: {
47
221
  en: {
@@ -67,6 +241,12 @@ export declare const i18nResources: {
67
241
  summary_one: string;
68
242
  summary_other: string;
69
243
  };
244
+ processors: {
245
+ title: string;
246
+ summary_zero: string;
247
+ summary_one: string;
248
+ summary_other: string;
249
+ };
70
250
  };
71
251
  startPage: {
72
252
  loading: string;
@@ -75,6 +255,214 @@ export declare const i18nResources: {
75
255
  changeSet: {
76
256
  open: string;
77
257
  };
258
+ common: {
259
+ cancel: string;
260
+ delete: string;
261
+ create: string;
262
+ save: string;
263
+ apply: string;
264
+ close: string;
265
+ };
266
+ fields: {
267
+ name: string;
268
+ description: string;
269
+ };
270
+ validity: {
271
+ column: string;
272
+ valid: string;
273
+ invalid: string;
274
+ invalidTitle: string;
275
+ };
276
+ release: {
277
+ column: string;
278
+ number: string;
279
+ none: string;
280
+ state: {
281
+ none: string;
282
+ differs: string;
283
+ current: string;
284
+ };
285
+ };
286
+ delete: {
287
+ inUse: string;
288
+ failed: string;
289
+ };
290
+ create: {
291
+ nameTaken: string;
292
+ nameRequired: string;
293
+ failed: string;
294
+ };
295
+ save: {
296
+ failed: string;
297
+ };
298
+ rail: {
299
+ title: string;
300
+ actions: string;
301
+ };
302
+ order: {
303
+ moveUp: string;
304
+ moveDown: string;
305
+ remove: string;
306
+ };
307
+ profiles: {
308
+ new: string;
309
+ empty: string;
310
+ general: string;
311
+ entitySet: string;
312
+ entitySetHelp: string;
313
+ noEntitySet: string;
314
+ autoPublish: string;
315
+ autoPublishHelp: string;
316
+ deleteOnSuccess: string;
317
+ deleteOnSuccessHelp: string;
318
+ preprocessors: string;
319
+ mappings: string;
320
+ postProcessors: string;
321
+ noPreprocessors: string;
322
+ noPostProcessors: string;
323
+ noMappings: string;
324
+ addPreprocessor: string;
325
+ addPostProcessor: string;
326
+ addMapping: string;
327
+ missingMapping: string;
328
+ delete: string;
329
+ deleteTitle: string;
330
+ deleteMessage: string;
331
+ };
332
+ processors: {
333
+ empty: string;
334
+ kindColumn: string;
335
+ targetColumn: string;
336
+ settingsColumn: string;
337
+ noSettings: string;
338
+ kind: {
339
+ preprocessor: string;
340
+ post_processor: string;
341
+ };
342
+ target: {
343
+ source_file: string;
344
+ rich_text_field: string;
345
+ };
346
+ unknown: string;
347
+ settingsOf: string;
348
+ configure: string;
349
+ viewSettings: string;
350
+ settingsCount_zero: string;
351
+ settingsCount_one: string;
352
+ settingsCount_other: string;
353
+ };
354
+ mappings: {
355
+ new: string;
356
+ empty: string;
357
+ general: string;
358
+ blueprint: string;
359
+ release: string;
360
+ blueprintId: string;
361
+ releaseId: string;
362
+ idsHelp: string;
363
+ newRelease: string;
364
+ newReleaseId: string;
365
+ elementSelector: string;
366
+ elementSelectorHelp: string;
367
+ sourceKeySelector: string;
368
+ sourceKeyTemplate: string;
369
+ sourceKeyTemplateHelp: string;
370
+ fieldCount_zero: string;
371
+ fieldCount_one: string;
372
+ fieldCount_other: string;
373
+ target: string;
374
+ move: string;
375
+ moveTitle: string;
376
+ check: string;
377
+ checkFailed: string;
378
+ nothingLost: string;
379
+ lost_one: string;
380
+ lost_other: string;
381
+ lostFields: string;
382
+ lostReleaseSpec: string;
383
+ moveConfirm: string;
384
+ includedBy: string;
385
+ noProfiles: string;
386
+ delete: string;
387
+ deleteTitle: string;
388
+ deleteMessage: string;
389
+ };
390
+ entitySets: {
391
+ new: string;
392
+ empty: string;
393
+ general: string;
394
+ entities: string;
395
+ entity: string;
396
+ noEntities: string;
397
+ entityName: string;
398
+ entityText: string;
399
+ addEntity: string;
400
+ removeEntity: string;
401
+ delete: string;
402
+ deleteTitle: string;
403
+ deleteMessage: string;
404
+ };
405
+ tabs: {
406
+ settings: string;
407
+ history: string;
408
+ };
409
+ cut: {
410
+ action: string;
411
+ title: string;
412
+ confirm: string;
413
+ message: string;
414
+ unchanged: string;
415
+ unsaved: string;
416
+ profilesIntro: string;
417
+ profiles: string;
418
+ noProfiles: string;
419
+ refused: string;
420
+ failed: string;
421
+ done: string;
422
+ doneBody: string;
423
+ };
424
+ history: {
425
+ hint: string;
426
+ none: string;
427
+ loadMore: string;
428
+ columns: {
429
+ revision: string;
430
+ release: string;
431
+ savedBy: string;
432
+ savedAt: string;
433
+ };
434
+ draft: string;
435
+ revision: string;
436
+ revisionOf: string;
437
+ restoredFrom: string;
438
+ cutBy: string;
439
+ unknownPerson: string;
440
+ restore: string;
441
+ restoreTitle: string;
442
+ restoreConfirm: string;
443
+ restoreMessage: string;
444
+ restoreFailed: string;
445
+ olderRelease: string;
446
+ earlierRevision: string;
447
+ };
448
+ compare: {
449
+ title: string;
450
+ between: string;
451
+ field: string;
452
+ same: string;
453
+ differing_one: string;
454
+ differing_other: string;
455
+ status: {
456
+ unchanged: string;
457
+ added: string;
458
+ removed: string;
459
+ changed: string;
460
+ };
461
+ absent: string;
462
+ missingEntitySet: string;
463
+ yes: string;
464
+ no: string;
465
+ };
78
466
  };
79
467
  };
80
468
  de: {
@@ -100,6 +488,12 @@ export declare const i18nResources: {
100
488
  summary_one: string;
101
489
  summary_other: string;
102
490
  };
491
+ processors: {
492
+ title: string;
493
+ summary_zero: string;
494
+ summary_one: string;
495
+ summary_other: string;
496
+ };
103
497
  };
104
498
  startPage: {
105
499
  loading: string;
@@ -108,6 +502,214 @@ export declare const i18nResources: {
108
502
  changeSet: {
109
503
  open: string;
110
504
  };
505
+ common: {
506
+ cancel: string;
507
+ delete: string;
508
+ create: string;
509
+ save: string;
510
+ apply: string;
511
+ close: string;
512
+ };
513
+ fields: {
514
+ name: string;
515
+ description: string;
516
+ };
517
+ validity: {
518
+ column: string;
519
+ valid: string;
520
+ invalid: string;
521
+ invalidTitle: string;
522
+ };
523
+ release: {
524
+ column: string;
525
+ number: string;
526
+ none: string;
527
+ state: {
528
+ none: string;
529
+ differs: string;
530
+ current: string;
531
+ };
532
+ };
533
+ delete: {
534
+ inUse: string;
535
+ failed: string;
536
+ };
537
+ create: {
538
+ nameTaken: string;
539
+ nameRequired: string;
540
+ failed: string;
541
+ };
542
+ save: {
543
+ failed: string;
544
+ };
545
+ rail: {
546
+ title: string;
547
+ actions: string;
548
+ };
549
+ order: {
550
+ moveUp: string;
551
+ moveDown: string;
552
+ remove: string;
553
+ };
554
+ profiles: {
555
+ new: string;
556
+ empty: string;
557
+ general: string;
558
+ entitySet: string;
559
+ entitySetHelp: string;
560
+ noEntitySet: string;
561
+ autoPublish: string;
562
+ autoPublishHelp: string;
563
+ deleteOnSuccess: string;
564
+ deleteOnSuccessHelp: string;
565
+ preprocessors: string;
566
+ mappings: string;
567
+ postProcessors: string;
568
+ noPreprocessors: string;
569
+ noPostProcessors: string;
570
+ noMappings: string;
571
+ addPreprocessor: string;
572
+ addPostProcessor: string;
573
+ addMapping: string;
574
+ missingMapping: string;
575
+ delete: string;
576
+ deleteTitle: string;
577
+ deleteMessage: string;
578
+ };
579
+ processors: {
580
+ empty: string;
581
+ kindColumn: string;
582
+ targetColumn: string;
583
+ settingsColumn: string;
584
+ noSettings: string;
585
+ kind: {
586
+ preprocessor: string;
587
+ post_processor: string;
588
+ };
589
+ target: {
590
+ source_file: string;
591
+ rich_text_field: string;
592
+ };
593
+ unknown: string;
594
+ settingsOf: string;
595
+ configure: string;
596
+ viewSettings: string;
597
+ settingsCount_zero: string;
598
+ settingsCount_one: string;
599
+ settingsCount_other: string;
600
+ };
601
+ mappings: {
602
+ new: string;
603
+ empty: string;
604
+ general: string;
605
+ blueprint: string;
606
+ release: string;
607
+ blueprintId: string;
608
+ releaseId: string;
609
+ idsHelp: string;
610
+ newRelease: string;
611
+ newReleaseId: string;
612
+ elementSelector: string;
613
+ elementSelectorHelp: string;
614
+ sourceKeySelector: string;
615
+ sourceKeyTemplate: string;
616
+ sourceKeyTemplateHelp: string;
617
+ fieldCount_zero: string;
618
+ fieldCount_one: string;
619
+ fieldCount_other: string;
620
+ target: string;
621
+ move: string;
622
+ moveTitle: string;
623
+ check: string;
624
+ checkFailed: string;
625
+ nothingLost: string;
626
+ lost_one: string;
627
+ lost_other: string;
628
+ lostFields: string;
629
+ lostReleaseSpec: string;
630
+ moveConfirm: string;
631
+ includedBy: string;
632
+ noProfiles: string;
633
+ delete: string;
634
+ deleteTitle: string;
635
+ deleteMessage: string;
636
+ };
637
+ entitySets: {
638
+ new: string;
639
+ empty: string;
640
+ general: string;
641
+ entities: string;
642
+ entity: string;
643
+ noEntities: string;
644
+ entityName: string;
645
+ entityText: string;
646
+ addEntity: string;
647
+ removeEntity: string;
648
+ delete: string;
649
+ deleteTitle: string;
650
+ deleteMessage: string;
651
+ };
652
+ tabs: {
653
+ settings: string;
654
+ history: string;
655
+ };
656
+ cut: {
657
+ action: string;
658
+ title: string;
659
+ confirm: string;
660
+ message: string;
661
+ unchanged: string;
662
+ unsaved: string;
663
+ profilesIntro: string;
664
+ profiles: string;
665
+ noProfiles: string;
666
+ refused: string;
667
+ failed: string;
668
+ done: string;
669
+ doneBody: string;
670
+ };
671
+ history: {
672
+ hint: string;
673
+ none: string;
674
+ loadMore: string;
675
+ columns: {
676
+ revision: string;
677
+ release: string;
678
+ savedBy: string;
679
+ savedAt: string;
680
+ };
681
+ draft: string;
682
+ revision: string;
683
+ revisionOf: string;
684
+ restoredFrom: string;
685
+ cutBy: string;
686
+ unknownPerson: string;
687
+ restore: string;
688
+ restoreTitle: string;
689
+ restoreConfirm: string;
690
+ restoreMessage: string;
691
+ restoreFailed: string;
692
+ olderRelease: string;
693
+ earlierRevision: string;
694
+ };
695
+ compare: {
696
+ title: string;
697
+ between: string;
698
+ field: string;
699
+ same: string;
700
+ differing_one: string;
701
+ differing_other: string;
702
+ status: {
703
+ unchanged: string;
704
+ added: string;
705
+ removed: string;
706
+ changed: string;
707
+ };
708
+ absent: string;
709
+ missingEntitySet: string;
710
+ yes: string;
711
+ no: string;
712
+ };
111
713
  };
112
714
  };
113
715
  };
@@ -126,16 +728,76 @@ export declare const IMPORTHUB_SECTIONS: readonly ImporthubSection[];
126
728
  */
127
729
  export declare const IMPORTHUB_UI_NS = "importhub-ui";
128
730
 
731
+ /** A Blueprint, as a Mapping's target is picked and named. */
732
+ export declare interface ImporthubBlueprint {
733
+ id: string;
734
+ name: string;
735
+ }
736
+
737
+ /** A Blueprint Release, as a Mapping pins it: `label` names it, such as "Release 3". */
738
+ export declare interface ImporthubBlueprintRelease {
739
+ id: string;
740
+ label: string;
741
+ }
742
+
743
+ /**
744
+ * Where the screens find Blueprints and their Releases, which live in
745
+ * blueprinthub, not importhub: importhub stores only their ids. A host that
746
+ * reaches blueprinthub (core does) answers from it; one that does not leaves
747
+ * `ImporthubHost.blueprints` out, and the Mapping screens then take and show
748
+ * the two as labelled ids, the technical detail anker's id rule allows.
749
+ */
750
+ export declare interface ImporthubBlueprints {
751
+ /** The workspace's Blueprints a Mapping may target, by name. */
752
+ listBlueprints(): Promise<ImporthubBlueprint[]>;
753
+ /** A Blueprint's Releases, newest first. */
754
+ listReleases(blueprintId: string): Promise<ImporthubBlueprintRelease[]>;
755
+ }
756
+
129
757
  /**
130
758
  * What the screens ask of importhub. Every call acts on the caller's
131
759
  * workspace, which importhub takes from the token's active workspace and
132
760
  * never from an argument: a host switches workspace by switching the token.
761
+ * An update names the draft it was made on, and is refused when somebody
762
+ * saved in between.
133
763
  */
134
764
  export declare interface ImporthubClient {
135
765
  /** Every Import Profile of the workspace, by name. */
136
- listImportProfiles(): Promise<ImportProfileSummary[]>;
766
+ listImportProfiles(): Promise<ImportProfile[]>;
767
+ getImportProfile(id: string): Promise<ImportProfile>;
768
+ createImportProfile(content: ImportProfileContent): Promise<ImportProfile>;
769
+ updateImportProfile(id: string, content: ImportProfileContent, draftRevisionId: string): Promise<ImportProfile>;
770
+ deleteImportProfile(id: string): Promise<void>;
771
+ /** The Processor catalogue, by name; the same in every workspace. */
772
+ listProcessors(): Promise<Processor[]>;
773
+ /** Every Mapping of the workspace, by name. */
774
+ listMappings(): Promise<Mapping[]>;
775
+ getMapping(id: string): Promise<Mapping>;
776
+ createMapping(content: MappingContent): Promise<Mapping>;
777
+ updateMapping(id: string, content: MappingContent, draftRevisionId: string): Promise<Mapping>;
778
+ /** Throws ConfigurationInUseError while a Profile includes it. */
779
+ deleteMapping(id: string): Promise<void>;
780
+ /** The Import Profiles whose draft or latest Release includes it. */
781
+ listMappingImportProfiles(id: string): Promise<ImportProfileRef[]>;
782
+ /** Checks moving the draft to another Blueprint Release, saving nothing. */
783
+ checkMappingBlueprintRelease(id: string, blueprintReleaseId: string): Promise<BlueprintReleaseCheck>;
137
784
  /** Every Entity Set of the workspace, by name. */
138
- listEntitySets(): Promise<EntitySetSummary[]>;
785
+ listEntitySets(): Promise<EntitySet[]>;
786
+ getEntitySet(id: string): Promise<EntitySet>;
787
+ createEntitySet(content: EntitySetContent): Promise<EntitySet>;
788
+ updateEntitySet(id: string, content: EntitySetContent, draftRevisionId: string): Promise<EntitySet>;
789
+ /** Throws ConfigurationInUseError while a Profile names it. */
790
+ deleteEntitySet(id: string): Promise<void>;
791
+ /**
792
+ * Cuts a Configuration Release from the draft named. Throws
793
+ * ReleaseRefusedError, with the reasons when the draft is invalid.
794
+ */
795
+ cutRelease(kind: ConfigurationKind, id: string, draftRevisionId: string): Promise<CutReleaseResult>;
796
+ /** One page of the history; pageToken "" for the first. */
797
+ listHistory(kind: ConfigurationKind, id: string, pageToken: string): Promise<ConfigurationHistoryPage>;
798
+ compareRevisions(kind: ConfigurationKind, id: string, fromRevisionId: string, toRevisionId: string): Promise<ConfigurationComparison>;
799
+ /** Saves an older Revision's content as a new draft, on the draft named. */
800
+ restoreRevision(kind: ConfigurationKind, id: string, revisionId: string, draftRevisionId: string): Promise<void>;
139
801
  }
140
802
 
141
803
  export declare interface ImporthubHost {
@@ -147,6 +809,16 @@ export declare interface ImporthubHost {
147
809
  * link to: the screen then shows no link rather than a broken one.
148
810
  */
149
811
  changeSetHref: (changeSetId: string) => string | null;
812
+ /**
813
+ * Whether the viewer may change configuration: importhub's `admin`
814
+ * (ADR 0010), which only the host's session knows. Unset, the screens
815
+ * show configuration read-only, as to a `viewer`; either way importhub
816
+ * authorizes every write itself, so this hides actions and guards
817
+ * nothing.
818
+ */
819
+ canConfigure?: boolean;
820
+ /** Where Blueprints and their Releases are found; see ImporthubBlueprints. */
821
+ blueprints?: ImporthubBlueprints;
150
822
  }
151
823
 
152
824
  /** Provides the host's decisions to every importhub screen beneath it. */
@@ -160,24 +832,42 @@ export declare interface ImporthubHostProviderProps {
160
832
  export declare const importhubKeys: {
161
833
  all: (workspaceId: string) => readonly ["importhub", string];
162
834
  importProfiles: (workspaceId: string) => readonly ["importhub", string, "importProfiles"];
835
+ importProfile: (workspaceId: string, id: string) => readonly ["importhub", string, "importProfiles", string];
836
+ processors: (workspaceId: string) => readonly ["importhub", string, "processors"];
837
+ mappings: (workspaceId: string) => readonly ["importhub", string, "mappings"];
838
+ mapping: (workspaceId: string, id: string) => readonly ["importhub", string, "mappings", string];
839
+ mappingImportProfiles: (workspaceId: string, id: string) => readonly ["importhub", string, "mappings", string, "importProfiles"];
163
840
  entitySets: (workspaceId: string) => readonly ["importhub", string, "entitySets"];
841
+ entitySet: (workspaceId: string, id: string) => readonly ["importhub", string, "entitySets", string];
842
+ blueprints: (workspaceId: string) => readonly ["importhub", string, "blueprints"];
843
+ blueprintReleases: (workspaceId: string, blueprintId: string) => readonly ["importhub", string, "blueprints", string, "releases"];
844
+ /** One configuration of a kind, as its page reads it. */
845
+ configuration: (workspaceId: string, kind: ConfigurationKind, id: string) => readonly ["importhub", string, "importProfiles", string] | readonly ["importhub", string, "mappings", string] | readonly ["importhub", string, "entitySets", string];
846
+ /** Every list of a kind, so one change refreshes them all. */
847
+ configurations: (workspaceId: string, kind: ConfigurationKind) => readonly ["importhub", string, "importProfiles"] | readonly ["importhub", string, "mappings"] | readonly ["importhub", string, "entitySets"];
848
+ history: (workspaceId: string, kind: ConfigurationKind, id: string) => readonly ["importhub", string, "importProfiles", string, "history"] | readonly ["importhub", string, "mappings", string, "history"] | readonly ["importhub", string, "entitySets", string, "history"];
849
+ comparison: (workspaceId: string, kind: ConfigurationKind, id: string, fromRevisionId: string, toRevisionId: string) => readonly ["importhub", string, "importProfiles", string, "comparison", string, string] | readonly ["importhub", string, "mappings", string, "comparison", string, string] | readonly ["importhub", string, "entitySets", string, "comparison", string, string];
164
850
  };
165
851
 
166
- /** Where the host mounts each section's index. */
852
+ /**
853
+ * Where the host mounts each section's index. An item of a section (one
854
+ * Import Profile, Mapping or Entity Set) lives under it, at
855
+ * `<index>/<id>` (`itemPath`), so a host mounts one route per section and its
856
+ * items, and the screens link to both without asking.
857
+ */
167
858
  export declare type ImporthubPaths = Record<ImporthubSection, string>;
168
859
 
169
860
  /**
170
861
  * importhub's sections: Imports, the host's own work, and the configuration
171
862
  * an admin manages (CONTEXT.md, "Configuration").
172
863
  */
173
- export declare type ImporthubSection = "imports" | "profiles" | "mappings" | "entitySets";
864
+ export declare type ImporthubSection = "imports" | "profiles" | "mappings" | "entitySets" | "processors";
174
865
 
175
866
  /**
176
- * A section's start page, until its screens exist: the section's
867
+ * A section's start page, for a host that has no screen for it yet: the section's
177
868
  * title in the frame, and a body saying what the workspace holds of it. Where
178
- * importhub can already list a section (Import Profiles, Entity Sets) it
179
- * says how many there are, read for the host's active workspace; Imports and
180
- * Mappings have nothing to read yet.
869
+ * importhub can already list a section it says how many there are, read for the host's active workspace; Imports have
870
+ * nothing to read yet, and Mappings are counted on their own screen.
181
871
  */
182
872
  export declare function ImporthubStartPage({ client, section }: ImporthubStartPageProps): JSX.Element;
183
873
 
@@ -187,10 +877,174 @@ export declare interface ImporthubStartPageProps {
187
877
  section: ImporthubSection;
188
878
  }
189
879
 
190
- /** An Import Profile, as a list names it. */
191
- export declare interface ImportProfileSummary {
880
+ export declare type ImportProfile = Configured<ImportProfileContent>;
881
+
882
+ /** What an admin edits of an Import Profile. */
883
+ export declare interface ImportProfileContent {
884
+ name: string;
885
+ description: string;
886
+ /** The Entity Set the Source File is read with; "" for none. */
887
+ entitySetId: string;
888
+ /** In the order they run. */
889
+ preprocessors: ProcessorStep[];
890
+ /** The Mappings it includes, by id, in the order they run. */
891
+ mappingIds: string[];
892
+ /** In the order they run. */
893
+ postProcessors: ProcessorStep[];
894
+ autoPublish: boolean;
895
+ deleteSourceFileOnSuccess: boolean;
896
+ }
897
+
898
+ /**
899
+ * One Import Profile with every setting (manage-import-profiles:AC3): its
900
+ * Entity Set, its Preprocessors, Mappings and Post-processors in order, each
901
+ * Processor configured in a form generated from its settings spec (AC4), and
902
+ * what happens to the result. An admin edits all of it as one draft and
903
+ * saves it with the header's one Save, and deletes the Profile from the rail
904
+ * (anker ADR 0004); a viewer sees the same page read-only. Why it is invalid
905
+ * heads the page (AC6).
906
+ */
907
+ export declare function ImportProfileDetail({ client, id, onDeleted }: ImportProfileDetailProps): JSX.Element;
908
+
909
+ export declare interface ImportProfileDetailProps {
910
+ client: ImporthubClient;
911
+ /** The Import Profile's id. */
912
+ id: string;
913
+ /** It was deleted: the host leaves its page, for the list, say. */
914
+ onDeleted: () => void;
915
+ }
916
+
917
+ /** An Import Profile, named where another configuration is used. */
918
+ export declare interface ImportProfileRef {
919
+ id: string;
920
+ name: string;
921
+ }
922
+
923
+ /**
924
+ * Every Import Profile of the workspace, with its validity and its latest
925
+ * Release (manage-import-profiles:AC1, AC6); an admin creates one from the
926
+ * header (AC2).
927
+ */
928
+ export declare function ImportProfilesIndex({ client, onOpen }: ImportProfilesIndexProps): JSX.Element;
929
+
930
+ export declare interface ImportProfilesIndexProps {
931
+ client: ImporthubClient;
932
+ /** Opens an Import Profile's page: the host navigates, after a create too. */
933
+ onOpen: (id: string) => void;
934
+ }
935
+
936
+ /** Where an item of a section lives: its index's path, then its id. */
937
+ export declare function itemPath(paths: ImporthubPaths, section: ImporthubSection, id: string): string;
938
+
939
+ export declare type Mapping = Configured<MappingContent>;
940
+
941
+ /**
942
+ * What an admin edits of a Mapping, in the JSON shape of importhub.v1's
943
+ * MappingContent (its camelCase keys). The screens here edit only the
944
+ * fields they name; every other setting (field mappings, Version Match,
945
+ * Title Contributions, …) is the structured editor's (F4), and travels
946
+ * through as given, so a save here never drops it.
947
+ */
948
+ export declare interface MappingContent {
949
+ name: string;
950
+ description?: string;
951
+ blueprintId: string;
952
+ blueprintReleaseId: string;
953
+ elementSelector?: string;
954
+ sourceKey?: {
955
+ selector?: string;
956
+ template?: string;
957
+ [key: string]: unknown;
958
+ };
959
+ /** Each an xmlmapper FieldMapping; `name` is the field path. */
960
+ fields?: Array<Record<string, unknown>>;
961
+ [key: string]: unknown;
962
+ }
963
+
964
+ /**
965
+ * One Mapping (manage-mappings:AC2): its name, what it selects and its
966
+ * Source Key, the Blueprint Release it pins with the move to another one
967
+ * (AC5), the Import Profiles that include it (AC3), and why it is invalid.
968
+ * An admin saves with the header's Save and deletes from the rail, which
969
+ * importhub refuses while a Profile includes it, naming them (AC4). It
970
+ * shows whether its draft differs from its latest Release; an admin cuts a
971
+ * Release from the rail, seeing the Profiles that take it first, and its
972
+ * History tab lists, compares and restores its Revisions
973
+ * (release-a-configuration).
974
+ */
975
+ export declare function MappingDetail({ client, id, onDeleted }: MappingDetailProps): JSX.Element;
976
+
977
+ export declare interface MappingDetailProps {
978
+ client: ImporthubClient;
979
+ /** The Mapping's id. */
192
980
  id: string;
981
+ /** It was deleted: the host leaves its page. */
982
+ onDeleted: () => void;
983
+ }
984
+
985
+ /**
986
+ * Every Mapping of the workspace with its target Blueprint, its pinned
987
+ * Blueprint Release and its validity (manage-mappings:AC1); an admin creates
988
+ * one, naming the Blueprint and the Release, from the header (AC2).
989
+ */
990
+ export declare function MappingsIndex({ client, onOpen }: MappingsIndexProps): JSX.Element;
991
+
992
+ export declare interface MappingsIndexProps {
993
+ client: ImporthubClient;
994
+ /** Opens a Mapping's page: the host navigates, after a create too. */
995
+ onOpen: (id: string) => void;
996
+ }
997
+
998
+ /** A create or rename refused: another configuration of the kind has the name. */
999
+ export declare class NameTakenError extends Error {
1000
+ constructor(message?: string);
1001
+ }
1002
+
1003
+ /** One entry of the Processor catalogue. */
1004
+ export declare interface Processor {
1005
+ /** How a Profile names it, such as `entity-element`. */
193
1006
  name: string;
1007
+ kind: ProcessorKind;
1008
+ /** What it works on: a Profile lists only `source_file` ones. */
1009
+ target: ProcessorTarget;
1010
+ /** In English, from the service. */
1011
+ description: string;
1012
+ /** Its settings as fieldkit Fields, in form order; empty for none. */
1013
+ settingsSpec: Schema;
1014
+ }
1015
+
1016
+ /**
1017
+ * The Processor catalogue (manage-import-profiles:AC5): every Processor with
1018
+ * its kind, where it is configured, what it does and the settings it takes,
1019
+ * by their names. Read-only for everyone: the catalogue is importhub's.
1020
+ */
1021
+ export declare function ProcessorCatalogue({ client }: ProcessorCatalogueProps): JSX.Element;
1022
+
1023
+ export declare interface ProcessorCatalogueProps {
1024
+ client: ImporthubClient;
1025
+ }
1026
+
1027
+ export declare type ProcessorKind = "preprocessor" | "post_processor";
1028
+
1029
+ /** One Processor in a Profile's pipeline, with its settings. */
1030
+ export declare interface ProcessorStep {
1031
+ /** The Processor, by its name in the catalogue. */
1032
+ processor: string;
1033
+ /** One value per setting of its settings spec, by `api_accessor`. */
1034
+ settings: Record<string, unknown>;
1035
+ }
1036
+
1037
+ export declare type ProcessorTarget = "source_file" | "rich_text_field";
1038
+
1039
+ /**
1040
+ * A cut importhub refused (release-a-configuration:AC3): the draft is
1041
+ * invalid now, it does not differ from the latest Release, or somebody saved
1042
+ * in between. Carries the draft's validity when that was the reason, so the
1043
+ * screen lists why.
1044
+ */
1045
+ export declare class ReleaseRefusedError extends Error {
1046
+ readonly validity?: Validity;
1047
+ constructor(message: string, validity?: Validity);
194
1048
  }
195
1049
 
196
1050
  /**
@@ -206,4 +1060,20 @@ export declare const STANDALONE_IMPORTHUB_PATHS: ImporthubPaths;
206
1060
  */
207
1061
  export declare function useImporthubHost(): ImporthubHost;
208
1062
 
1063
+ /** Whether a configuration may be released, and if not, why. */
1064
+ export declare interface Validity {
1065
+ valid: boolean;
1066
+ reasons: ValidityReason[];
1067
+ }
1068
+
1069
+ /** One thing that makes a configuration invalid (importhub.v1.ValidityReason). */
1070
+ export declare interface ValidityReason {
1071
+ /** Where, as a JSON Pointer into the content; empty for the whole. */
1072
+ path: string;
1073
+ /** A stable code, such as `no_mappings`; the type's service lists them. */
1074
+ code: string;
1075
+ /** What is wrong, in English, for a person. */
1076
+ message: string;
1077
+ }
1078
+
209
1079
  export { }