@knkcs/importhub-ui 0.4.0 → 0.6.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.
@@ -1,6 +1,26 @@
1
1
  import { JSX } from 'react';
2
2
  import { Schema } from '@knkcs/fieldkit/schema';
3
3
 
4
+ /**
5
+ * An importhub API key of the workspace (importhub.v1.APIKey): an odon API
6
+ * key with scope `importhub:workspace:<W>`, which importhub created with a
7
+ * standing Delegation Grant that ends with it (ADR 0006, amended). Never its
8
+ * secret.
9
+ */
10
+ declare interface ApiKey {
11
+ id: string;
12
+ /** What it is for, as people read it: "Nightly gesetz feed". */
13
+ name: string;
14
+ /** The secret's first characters, for telling keys apart. */
15
+ keyPrefix: string;
16
+ /** The odon user id of who created it, as whom it acts; the host's members name them. */
17
+ owner: string;
18
+ /** When it stops working, as an ISO 8601 timestamp; "" for never. */
19
+ expireTime: string;
20
+ /** When it was created, as an ISO 8601 timestamp. */
21
+ createTime: string;
22
+ }
23
+
4
24
  /** What moving a Mapping's draft to another Blueprint Release would lose. */
5
25
  declare interface BlueprintReleaseCheck {
6
26
  blueprintId: string;
@@ -98,6 +118,21 @@ declare interface Configured<C> {
98
118
  state: ConfigurationState;
99
119
  }
100
120
 
121
+ /** What creating an API key takes. */
122
+ declare interface CreateApiKeyInput {
123
+ /** Not blank, at most API_KEY_NAME_MAX characters. */
124
+ name: string;
125
+ /** When it stops working, as an ISO 8601 timestamp in the future; "" or unset for never. */
126
+ expireTime?: string;
127
+ }
128
+
129
+ /** A key just created, with its secret: the one time importhub returns it. */
130
+ declare interface CreatedApiKey {
131
+ apiKey: ApiKey;
132
+ /** To send as `Authorization: Bearer <secret>`; no later call returns it. */
133
+ secret: string;
134
+ }
135
+
101
136
  /** A Release cut, and for a Mapping the Import Profiles that take it. */
102
137
  declare interface CutReleaseResult {
103
138
  release: ConfigurationReleaseRecord;
@@ -117,6 +152,65 @@ declare interface EntitySetContent {
117
152
 
118
153
  declare type FieldComparisonStatus = "unchanged" | "added" | "removed" | "changed";
119
154
 
155
+ /** One run of an Import Profile's Release over one Source File. */
156
+ declare interface Import {
157
+ id: string;
158
+ importProfileId: string;
159
+ /** The Profile's name when the Import started. */
160
+ importProfileName: string;
161
+ sourceFileId: string;
162
+ /** The odon user id of who started it; the host's members name them. */
163
+ startedBy: string;
164
+ phase: ImportPhase;
165
+ /** Unset until it has ended. */
166
+ outcome?: ImportOutcome;
167
+ /** Why it Failed, as importhub words it; "" otherwise. */
168
+ failureReason: string;
169
+ /** How far the current phase is: done of total, both 0 while unknown. */
170
+ progress: {
171
+ done: number;
172
+ total: number;
173
+ };
174
+ counts: ImportCounts;
175
+ /** The contenthub Change Set it fills; "" until it opened one. */
176
+ changeSetId: string;
177
+ /** The exact Releases it runs with, pinned at Start (release-a-configuration:AC8). */
178
+ releases: {
179
+ importProfile?: ImportReleaseRef;
180
+ /** In the Profile's order. */
181
+ mappings: ImportReleaseRef[];
182
+ /** Unset when the Profile names no Entity Set. */
183
+ entitySet?: ImportReleaseRef;
184
+ };
185
+ /** ISO 8601 timestamps; start and end "" until they happen. */
186
+ createTime: string;
187
+ startTime: string;
188
+ endTime: string;
189
+ /** The odon user id of who cancelled it, as soon as they asked; "" for nobody. */
190
+ cancelledBy: string;
191
+ /** YYYY-MM-DD, or "" for none. */
192
+ effectiveDate: string;
193
+ source?: ImportSource;
194
+ }
195
+
196
+ /** What an Import has done (importhub.v1.ImportCounts). */
197
+ declare interface ImportCounts {
198
+ /** Source Versions its Mappings matched. */
199
+ matched: number;
200
+ /** Content it created. */
201
+ created: number;
202
+ /** Item Problems: Source Versions it skipped. */
203
+ problems: number;
204
+ /** New Planned Releases of Content that exists. */
205
+ planned: number;
206
+ /** Changed Versions planned as corrections. */
207
+ corrected: number;
208
+ /** Changed Versions kept. */
209
+ kept: number;
210
+ /** Source Versions already in contenthub. */
211
+ unchanged: number;
212
+ }
213
+
120
214
  /**
121
215
  * What the screens ask of importhub. Every call acts on the caller's
122
216
  * workspace, which importhub takes from the token's active workspace and
@@ -161,8 +255,43 @@ declare interface ImporthubClient {
161
255
  compareRevisions(kind: ConfigurationKind, id: string, fromRevisionId: string, toRevisionId: string): Promise<ConfigurationComparison>;
162
256
  /** Saves an older Revision's content as a new draft, on the draft named. */
163
257
  restoreRevision(kind: ConfigurationKind, id: string, revisionId: string, draftRevisionId: string): Promise<void>;
258
+ /**
259
+ * Uploads one file as a Source File: importhub hands out a direct upload
260
+ * URL into its blob store, and the file goes there, not through importhub
261
+ * (start-an-import:AC1). `onProgress` hears the share sent, 0 to 1.
262
+ */
263
+ uploadSourceFile(file: File, onProgress: (fraction: number) => void): Promise<SourceFile>;
264
+ /** Queues an Import. Throws StartRefusedError, with importhub's reason. */
265
+ startImport(input: StartImportInput): Promise<Import>;
266
+ /** One page of the workspace's Imports, newest first; pageToken "" for the first. */
267
+ listImports(pageToken: string): Promise<ImportsPage>;
268
+ getImport(id: string): Promise<Import>;
269
+ /** Asks a queued or running Import to stop; returns it as it is now. */
270
+ cancelImport(id: string): Promise<Import>;
271
+ listItemProblems(importId: string, filter: ItemProblemsFilter): Promise<ItemProblemsPage>;
272
+ /**
273
+ * Every API key of the workspace, every importer's, newest first, without
274
+ * their secrets. Needs importhub's `importer`, as all three key calls do.
275
+ */
276
+ listApiKeys(): Promise<ApiKey[]>;
277
+ /**
278
+ * Creates an API key acting as the caller, with its Delegation Grant, and
279
+ * returns its secret this once (import-with-an-api-key:AC5).
280
+ */
281
+ createApiKey(input: CreateApiKeyInput): Promise<CreatedApiKey>;
282
+ /**
283
+ * Revokes an API key in odon and releases its Grant: it stops working at
284
+ * once (import-with-an-api-key:AC7).
285
+ */
286
+ revokeApiKey(id: string): Promise<void>;
164
287
  }
165
288
 
289
+ /** How an Import ended (importhub.v1.ImportOutcome, CONTEXT.md "Import Outcome"). */
290
+ declare type ImportOutcome = "succeeded" | "succeeded_with_problems" | "failed" | "cancelled";
291
+
292
+ /** Where an Import is (importhub.v1.ImportPhase). */
293
+ declare type ImportPhase = "queued" | "reading" | "writing" | "ended";
294
+
166
295
  declare type ImportProfile = Configured<ImportProfileContent>;
167
296
 
168
297
  /** What an admin edits of an Import Profile. */
@@ -187,6 +316,72 @@ declare interface ImportProfileRef {
187
316
  name: string;
188
317
  }
189
318
 
319
+ /** One Configuration Release an Import runs with, named as it was then. */
320
+ declare interface ImportReleaseRef {
321
+ configurationId: string;
322
+ /** The configuration's name in that Release. */
323
+ name: string;
324
+ releaseId: string;
325
+ /** "Release 3". */
326
+ number: number;
327
+ }
328
+
329
+ /** The publication that triggered an Import: such as 2026-09-20, "BGBl. 2026 I Nr. 270". */
330
+ declare interface ImportSource {
331
+ /** The day it was published, as YYYY-MM-DD. */
332
+ date: string;
333
+ /** How it is cited. */
334
+ reference: string;
335
+ }
336
+
337
+ /** One page of the workspace's Imports, newest first. */
338
+ declare interface ImportsPage {
339
+ imports: Import[];
340
+ /** "" on the last page. */
341
+ nextPageToken: string;
342
+ }
343
+
344
+ /** One Source Version an Import could not save and skipped (CONTEXT.md "Item Problem"). */
345
+ declare interface ItemProblem {
346
+ id: string;
347
+ mappingId: string;
348
+ /** The Mapping's name in the Release the Import ran. */
349
+ mappingName: string;
350
+ /** "" when the element has none. */
351
+ sourceKey: string;
352
+ /** A /-separated path in the Content's data; "" for the Source Version as a whole. */
353
+ field: string;
354
+ /** Why, as importhub words it. */
355
+ reason: string;
356
+ }
357
+
358
+ /** How an Import's Item Problems are filtered: by Mapping, and by Source Key. */
359
+ declare interface ItemProblemsFilter {
360
+ /** "" for every Mapping. */
361
+ mappingId: string;
362
+ /** Matches Source Keys that contain it, ignoring case; "" for all. */
363
+ sourceKeyQuery: string;
364
+ /** "" for the first page. */
365
+ pageToken: string;
366
+ }
367
+
368
+ /** One page of an Import's Item Problems, with their counts. */
369
+ declare interface ItemProblemsPage {
370
+ itemProblems: ItemProblem[];
371
+ /** Every Item Problem of the Import, whatever the filter. */
372
+ totalCount: number;
373
+ /** The Item Problems the filter matches, on every page. */
374
+ matchingCount: number;
375
+ /** Every Mapping with Item Problems and how many, whatever the filter. */
376
+ mappings: {
377
+ mappingId: string;
378
+ mappingName: string;
379
+ count: number;
380
+ }[];
381
+ /** "" on the last page. */
382
+ nextPageToken: string;
383
+ }
384
+
190
385
  declare type Mapping = Configured<MappingContent>;
191
386
 
192
387
  /**
@@ -314,6 +509,22 @@ declare interface ProcessorStep {
314
509
 
315
510
  declare type ProcessorTarget = "source_file" | "rich_text_field";
316
511
 
512
+ /** A Source File uploaded and ready to be imported. */
513
+ declare interface SourceFile {
514
+ id: string;
515
+ fileName: string;
516
+ }
517
+
518
+ /** What starting an Import takes. */
519
+ declare interface StartImportInput {
520
+ importProfileId: string;
521
+ sourceFileId: string;
522
+ /** YYYY-MM-DD; "" or unset for none. */
523
+ effectiveDate?: string;
524
+ /** Both or neither. */
525
+ source?: ImportSource;
526
+ }
527
+
317
528
  /** The intent a Title Contribution writes (importhub.v1.TitleIntent). */
318
529
  declare type TitleIntent = "TITLE_INTENT_UNSPECIFIED" | "TITLE_INTENT_EXCLUDE" | "TITLE_INTENT_REPLACE" | "TITLE_INTENT_ANNOTATE";
319
530
 
@@ -1,7 +1,7 @@
1
1
  import { jsx as t, jsxs as s, Fragment as P } from "react/jsx-runtime";
2
2
  import { useState as _, useEffect as ue, useMemo as ve } from "react";
3
3
  import { useTranslation as $ } from "react-i18next";
4
- import { I as F, l as D, m as te, u as Se, i as xe, M as Ce } from "./mapping-page-v0GJAPjW.js";
4
+ import { I as F, l as D, m as te, u as Se, i as xe, M as Ce } from "./mapping-page-wJywO-hg.js";
5
5
  import { Button as H, StatusBadge as Ee, IconButton as B } from "@knkcs/anker/atoms";
6
6
  import { Card as y, NavList as Q } from "@knkcs/anker/components";
7
7
  import { Stack as h, Text as g, Textarea as me, Alert as K, Box as x, List as oe, HStack as ee, Heading as Ie, Code as $e, Separator as ae, Grid as he, RadioGroup as Fe, Radio as Ne } from "@knkcs/anker/primitives";