@knkcs/importhub-ui 0.2.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/testing.d.ts CHANGED
@@ -10,12 +10,58 @@ declare interface BlueprintReleaseCheck {
10
10
  missingReleaseSpecFields: string[];
11
11
  }
12
12
 
13
+ /** Two Revisions of one configuration, and how each top-level field differs. */
14
+ declare interface ConfigurationComparison {
15
+ from: ConfigurationVersion;
16
+ to: ConfigurationVersion;
17
+ fields: {
18
+ field: string;
19
+ status: FieldComparisonStatus;
20
+ }[];
21
+ }
22
+
23
+ /** One page of a configuration's history. */
24
+ declare interface ConfigurationHistoryPage {
25
+ /** This page's Revisions, newest first. */
26
+ revisions: ConfigurationRevision[];
27
+ /** Every Release, newest first, on every page. */
28
+ releases: ConfigurationReleaseRecord[];
29
+ /** The token of the next page; "" on the last. */
30
+ nextPageToken: string;
31
+ }
32
+
33
+ /** The kinds of versioned configuration (ADR 0016). */
34
+ declare type ConfigurationKind = "importProfile" | "mapping" | "entitySet";
35
+
13
36
  /** A Configuration Release, as a list names it: "Release 3". */
14
37
  declare interface ConfigurationRelease {
15
38
  id: string;
16
39
  number: number;
17
40
  }
18
41
 
42
+ /** A Configuration Release as the history lists it: who cut it, when, from what. */
43
+ declare interface ConfigurationReleaseRecord extends ConfigurationRelease {
44
+ /** The Revision it pins. */
45
+ revisionId: string;
46
+ /** The odon user id of the admin who cut it. */
47
+ releasedBy: string;
48
+ /** When it was cut, as an ISO 8601 timestamp. */
49
+ releasedAt: string;
50
+ }
51
+
52
+ /** One saved Revision of a configuration, as its history lists it. */
53
+ declare interface ConfigurationRevision {
54
+ id: string;
55
+ /** The odon user id of who saved it; the host's members name them. */
56
+ savedBy: string;
57
+ /** When it was saved, as an ISO 8601 timestamp. */
58
+ savedAt: string;
59
+ /** Whether it could be released, as decided when it was saved. */
60
+ validity: Validity;
61
+ /** The Revision it restored; "" for an ordinary save. */
62
+ restoredFromRevisionId: string;
63
+ }
64
+
19
65
  /** Where a configuration stands: its draft and its latest Release. */
20
66
  declare interface ConfigurationState {
21
67
  draftRevisionId: string;
@@ -25,6 +71,15 @@ declare interface ConfigurationState {
25
71
  draftDiffersFromRelease: boolean;
26
72
  }
27
73
 
74
+ /**
75
+ * One side of a comparison: a Revision's content, keyed as importhub keys
76
+ * the compared fields (the proto's field names, such as `mapping_ids`).
77
+ */
78
+ declare interface ConfigurationVersion {
79
+ revisionId: string;
80
+ content: Record<string, unknown>;
81
+ }
82
+
28
83
  /** One configuration of a kind, at its draft. */
29
84
  declare interface Configured<C> {
30
85
  id: string;
@@ -48,6 +103,13 @@ export declare function createStubBlueprints(blueprintReleases?: StubBlueprintRe
48
103
 
49
104
  export declare function createStubImporthubClient(options?: StubImporthubClientOptions): StubImporthubClient;
50
105
 
106
+ /** A Release cut, and for a Mapping the Import Profiles that take it. */
107
+ declare interface CutReleaseResult {
108
+ release: ConfigurationReleaseRecord;
109
+ /** The Profiles that include the Mapping; empty for other kinds. */
110
+ importProfiles: ImportProfileRef[];
111
+ }
112
+
51
113
  declare type EntitySet = Configured<EntitySetContent>;
52
114
 
53
115
  /** What an admin edits of an Entity Set. */
@@ -58,6 +120,8 @@ declare interface EntitySetContent {
58
120
  entities: Record<string, string>;
59
121
  }
60
122
 
123
+ declare type FieldComparisonStatus = "unchanged" | "added" | "removed" | "changed";
124
+
61
125
  /** A Blueprint, as a Mapping's target is picked and named. */
62
126
  declare interface ImporthubBlueprint {
63
127
  id: string;
@@ -118,6 +182,16 @@ declare interface ImporthubClient {
118
182
  updateEntitySet(id: string, content: EntitySetContent, draftRevisionId: string): Promise<EntitySet>;
119
183
  /** Throws ConfigurationInUseError while a Profile names it. */
120
184
  deleteEntitySet(id: string): Promise<void>;
185
+ /**
186
+ * Cuts a Configuration Release from the draft named. Throws
187
+ * ReleaseRefusedError, with the reasons when the draft is invalid.
188
+ */
189
+ cutRelease(kind: ConfigurationKind, id: string, draftRevisionId: string): Promise<CutReleaseResult>;
190
+ /** One page of the history; pageToken "" for the first. */
191
+ listHistory(kind: ConfigurationKind, id: string, pageToken: string): Promise<ConfigurationHistoryPage>;
192
+ compareRevisions(kind: ConfigurationKind, id: string, fromRevisionId: string, toRevisionId: string): Promise<ConfigurationComparison>;
193
+ /** Saves an older Revision's content as a new draft, on the draft named. */
194
+ restoreRevision(kind: ConfigurationKind, id: string, revisionId: string, draftRevisionId: string): Promise<void>;
121
195
  }
122
196
 
123
197
  declare type ImportProfile = Configured<ImportProfileContent>;