@knkcs/importhub-ui 0.5.0 → 0.7.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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.7.0](https://github.com/knkCS/importhub/compare/importhub-ui-v0.6.0...importhub-ui-v0.7.0) (2026-12-04)
4
+
5
+
6
+ ### Features
7
+
8
+ * file imported Content into Collections and name it by template (B9) ([#118](https://github.com/knkCS/importhub/issues/118)) ([1814bc1](https://github.com/knkCS/importhub/commit/1814bc1f92aadbf28664282e5aaa71671da43522))
9
+
10
+ ## [0.6.0](https://github.com/knkCS/importhub/compare/importhub-ui-v0.5.0...importhub-ui-v0.6.0) (2026-12-04)
11
+
12
+
13
+ ### Features
14
+
15
+ * **ui:** API keys screen to create, list and revoke importhub API keys (F9) ([#117](https://github.com/knkCS/importhub/issues/117)) ([4cf1c6e](https://github.com/knkCS/importhub/commit/4cf1c6e985126c7ae2f1eefdead55e4c150f742b))
16
+
3
17
  ## [0.5.0](https://github.com/knkCS/importhub/compare/importhub-ui-v0.4.0...importhub-ui-v0.5.0) (2026-12-04)
4
18
 
5
19
 
package/README.md CHANGED
@@ -4,7 +4,7 @@ importhub's screens for knk hosts, built on [anker](https://github.com/knkCS/ank
4
4
 
5
5
  The package exports **screens, not routes**. The host draws the page frame (anker's host contract, knkcms/core ADR 0003): a screen reports its title, breadcrumbs and header actions, reads the viewer and the active workspace from `@knkcs/anker/host`, and asks the host for everything only the host knows through `ImporthubHostProvider`. The package never navigates on its own.
6
6
 
7
- So far it holds the Import list, an Import's page and the start flow, the configuration screens (Import Profiles, Mappings, Entity Sets and the Processor catalogue) with their release and history, and the structured Mapping editor (the `./mapping-editor` subpath). The Dry Run report and the Mapping Test follow.
7
+ So far it holds the Import list, an Import's page and the start flow, the configuration screens (Import Profiles, Mappings, Entity Sets and the Processor catalogue) with their release and history, the workspace's API keys, and the structured Mapping editor (the `./mapping-editor` subpath). The Dry Run report and the Mapping Test follow.
8
8
 
9
9
  ## Install
10
10
 
@@ -76,6 +76,7 @@ An Import fills one contenthub Change Set, and its page links out to it (`Change
76
76
  - `EntitySetsIndex({ client, onOpen })` and `EntitySetDetail({ client, id, onDeleted })`: the Entity Sets and their tables of entities.
77
77
  - `ConfigurationHistory({ client, kind, id, draftRevisionId, onRestored })`: a configuration's Revisions, newest first, with who saved each and when and the Releases cut from them; any two compared side by side, and an older one restored as a new draft. Each detail page above renders it as its History tab (`?tab=history`); a host may place it elsewhere.
78
78
  - `ProcessorCatalogue({ client })`: every Processor with its kind, description and settings.
79
+ - `ApiKeysIndex({ client })`: the workspace's importhub API keys, every importer's, with name, prefix, owner, creation and expiry, never a secret. Under `canImport`, a header action creates one from a name and an optional expiry, saying first that the key acts as its creator and that importhub holds a Delegation Grant for it, and then shows the secret this once with a copy action; each row revokes its key after a confirmation. Without `canImport` it lists nothing and says who manages keys, as importhub lets only an `importer` list them.
79
80
  - `ImporthubStartPage({ client, section })`: a section's start page, for a host that has no screen for a section yet.
80
81
 
81
82
  Every configuration screen shows why a configuration is invalid and whether its draft differs from its latest Release, saves with the header's one Save, and cuts a Release and deletes from the rail (anker ADR 0004); a Mapping's cut names the Import Profiles that take the Release first. It is read-only, with no Cut Release or restore, unless the host says `canConfigure`. `onOpen` runs after a create too; `onDeleted` once the item is gone.
@@ -1,13 +1,13 @@
1
1
  class t extends Error {
2
2
  importProfiles;
3
- constructor(r, s = "in use by Import Profiles") {
4
- super(s), this.name = "ConfigurationInUseError", this.importProfiles = r;
3
+ constructor(r, e = "in use by Import Profiles") {
4
+ super(e), this.name = "ConfigurationInUseError", this.importProfiles = r;
5
5
  }
6
6
  }
7
7
  class o extends Error {
8
8
  validity;
9
- constructor(r, s) {
10
- super(r), this.name = "ReleaseRefusedError", this.validity = s;
9
+ constructor(r, e) {
10
+ super(r), this.name = "ReleaseRefusedError", this.validity = e;
11
11
  }
12
12
  }
13
13
  class a extends Error {
@@ -20,10 +20,12 @@ class n extends Error {
20
20
  super(r), this.name = "StartRefusedError";
21
21
  }
22
22
  }
23
+ const i = 100;
23
24
  export {
25
+ i as A,
24
26
  t as C,
25
27
  a as N,
26
28
  o as R,
27
29
  n as S
28
30
  };
29
- //# sourceMappingURL=importhub-client-fCWgKH03.js.map
31
+ //# sourceMappingURL=importhub-client-BS6F4DW2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"importhub-client-BS6F4DW2.js","sources":["../src/client/importhub-client.ts"],"sourcesContent":["// The client the screens are handed: a small, hand-written interface over\n// importhub's Connect API, as every hub package has (blueprinthub-ui,\n// contenthub-ui). Proto types never leave it, so a host or a test can supply\n// any implementation (`createConnectImporthubClient`, or the stub in\n// `@knkcs/importhub-ui/testing`), and a screen never learns the wire.\n//\n// It grows with the screens: the configuration screens (F2) read and write\n// Import Profiles, Mappings and Entity Sets and read the Processor catalogue;\n// release and history (F3, release-a-configuration) cut Releases, list,\n// compare and restore Revisions, alike for every kind of configuration.\n// Imports (F6, start-an-import, follow-an-import) upload a Source File,\n// start, list, read and cancel Imports, and list their Item Problems. API\n// keys (F9, import-with-an-api-key) are created, listed and revoked.\n\nimport type { Schema } from \"@knkcs/fieldkit/schema\";\n\n/** One thing that makes a configuration invalid (importhub.v1.ValidityReason). */\nexport interface ValidityReason {\n\t/** Where, as a JSON Pointer into the content; empty for the whole. */\n\tpath: string;\n\t/** A stable code, such as `no_mappings`; the type's service lists them. */\n\tcode: string;\n\t/** What is wrong, in English, for a person. */\n\tmessage: string;\n}\n\n/** Whether a configuration may be released, and if not, why. */\nexport interface Validity {\n\tvalid: boolean;\n\treasons: ValidityReason[];\n}\n\n/** A Configuration Release, as a list names it: \"Release 3\". */\nexport interface ConfigurationRelease {\n\tid: string;\n\tnumber: number;\n}\n\n/** Where a configuration stands: its draft and its latest Release. */\nexport interface ConfigurationState {\n\tdraftRevisionId: string;\n\t/** Unset while the configuration has none. */\n\tlatestRelease?: ConfigurationRelease;\n\t/** True when the draft differs from the latest Release, and while there is none. */\n\tdraftDiffersFromRelease: boolean;\n}\n\n/** One configuration of a kind, at its draft. */\ninterface Configured<C> {\n\tid: string;\n\t/** The draft's content. */\n\tcontent: C;\n\t/**\n\t * Whether it is valid now: for Profiles and Mappings the service's\n\t * `current_validity`, which counts what changed since the save (an\n\t * included Mapping turned invalid, a Blueprint gone); for Entity Sets the\n\t * validity as saved, the only one they have.\n\t */\n\tvalidity: Validity;\n\tstate: ConfigurationState;\n}\n\n/** One Processor in a Profile's pipeline, with its settings. */\nexport interface ProcessorStep {\n\t/** The Processor, by its name in the catalogue. */\n\tprocessor: string;\n\t/** One value per setting of its settings spec, by `api_accessor`. */\n\tsettings: Record<string, unknown>;\n}\n\n/** What an admin edits of an Import Profile. */\nexport interface ImportProfileContent {\n\tname: string;\n\tdescription: string;\n\t/** The Entity Set the Source File is read with; \"\" for none. */\n\tentitySetId: string;\n\t/** In the order they run. */\n\tpreprocessors: ProcessorStep[];\n\t/** The Mappings it includes, by id, in the order they run. */\n\tmappingIds: string[];\n\t/** In the order they run. */\n\tpostProcessors: ProcessorStep[];\n\tautoPublish: boolean;\n\tdeleteSourceFileOnSuccess: boolean;\n}\n\nexport type ImportProfile = Configured<ImportProfileContent>;\n\n/**\n * What an admin edits of a Mapping, in the JSON shape of importhub.v1's\n * MappingContent: its camelCase keys, enums by their names\n * (`CHANGED_VERSION_HANDLING_KEEP`), unset settings left out. The settings are\n * typed as the structured editor (F4) edits them; every key travels through\n * as given, typed or not, so a save never drops one a screen does not show.\n */\nexport interface MappingContent {\n\tname: string;\n\tdescription?: string;\n\tblueprintId: string;\n\tblueprintReleaseId: string;\n\telementSelector?: string;\n\tsourceKey?: {\n\t\tselector?: string;\n\t\ttemplate?: string;\n\t\textractPattern?: string;\n\t\t/** `-` when unset; \"\" joins the groups with nothing. */\n\t\textractSeparator?: string;\n\t\tnormalize?: boolean;\n\t\t[key: string]: unknown;\n\t};\n\t/** Each an xmlmapper FieldMapping; `name` is the field path. */\n\tfields?: Array<Record<string, unknown>>;\n\tversionMatch?: {\n\t\tvalidityPeriod?: boolean;\n\t\treleaseSpecFields?: string[];\n\t\tcontentFields?: string[];\n\t};\n\tvalidityPeriod?: {\n\t\tvalidFromSelector?: string;\n\t\tvalidToSelector?: string;\n\t\tdateFormats?: string[];\n\t};\n\treleaseSpec?: Array<{ field?: string; selector?: string }>;\n\t/** Unset: Correct. */\n\tchangedVersion?: ChangedVersionHandling;\n\tstub?: boolean;\n\ttitleContributions?: Array<{\n\t\tselector?: string;\n\t\tausgabeCodeSelector?: string;\n\t\treferenceSpecValues?: Array<{ field?: string; selector?: string }>;\n\t\treferenceFilterSelector?: string;\n\t\tintent?: TitleIntent;\n\t\tintentTextSelector?: string;\n\t}>;\n\tcollectionRouting?: {\n\t\tselector?: string;\n\t\tcollectionMap?: Record<string, string>;\n\t\tidPattern?: string;\n\t\tcollectionTemplate?: string;\n\t\tsuffix?: string;\n\t\tfallback?: string;\n\t};\n\tcollections?: string[];\n\tdisplayNameTemplate?: string;\n\tplaceholderAssets?: Array<{\n\t\tselector?: string;\n\t\tassetType?: string;\n\t\tkeyParts?: string[];\n\t\tnameSelector?: string;\n\t\tdescriptionSelector?: string;\n\t\tmetadata?: Record<string, string>;\n\t\tfolderRoot?: string;\n\t\tfolderPathSelector?: string;\n\t}>;\n\t[key: string]: unknown;\n}\n\n/** What happens to a Changed Version (importhub.v1.ChangedVersionHandling). */\nexport type ChangedVersionHandling =\n\t| \"CHANGED_VERSION_HANDLING_UNSPECIFIED\"\n\t| \"CHANGED_VERSION_HANDLING_CORRECT\"\n\t| \"CHANGED_VERSION_HANDLING_KEEP\"\n\t| \"CHANGED_VERSION_HANDLING_FAIL\";\n\n/** The intent a Title Contribution writes (importhub.v1.TitleIntent). */\nexport type TitleIntent =\n\t| \"TITLE_INTENT_UNSPECIFIED\"\n\t| \"TITLE_INTENT_EXCLUDE\"\n\t| \"TITLE_INTENT_REPLACE\"\n\t| \"TITLE_INTENT_ANNOTATE\";\n\nexport type Mapping = Configured<MappingContent>;\n\n/** What an admin edits of an Entity Set. */\nexport interface EntitySetContent {\n\tname: string;\n\tdescription: string;\n\t/** Entity names without `&` and `;`, to the text each stands for. */\n\tentities: Record<string, string>;\n}\n\nexport type EntitySet = Configured<EntitySetContent>;\n\n/** An Import Profile, named where another configuration is used. */\nexport interface ImportProfileRef {\n\tid: string;\n\tname: string;\n}\n\nexport type ProcessorKind = \"preprocessor\" | \"post_processor\";\nexport type ProcessorTarget = \"source_file\" | \"rich_text_field\";\n\n/** One entry of the Processor catalogue. */\nexport interface Processor {\n\t/** How a Profile names it, such as `entity-element`. */\n\tname: string;\n\tkind: ProcessorKind;\n\t/** What it works on: a Profile lists only `source_file` ones. */\n\ttarget: ProcessorTarget;\n\t/** In English, from the service. */\n\tdescription: string;\n\t/** Its settings as fieldkit Fields, in form order; empty for none. */\n\tsettingsSpec: Schema;\n}\n\n/** What moving a Mapping's draft to another Blueprint Release would lose. */\nexport interface BlueprintReleaseCheck {\n\tblueprintId: string;\n\t/** Every mapped field path the Release does not have. */\n\tmissingFieldPaths: string[];\n\t/** Every Release Spec field read or matched on that it does not have. */\n\tmissingReleaseSpecFields: string[];\n}\n\n/**\n * A delete importhub refused because Import Profiles still include the\n * Mapping, or name the Entity Set (manage-mappings:AC4,\n * manage-entity-sets:AC3). Carries the Profiles, so the screen names them.\n */\nexport class ConfigurationInUseError extends Error {\n\treadonly importProfiles: ImportProfileRef[];\n\tconstructor(importProfiles: ImportProfileRef[], message = \"in use by Import Profiles\") {\n\t\tsuper(message);\n\t\tthis.name = \"ConfigurationInUseError\";\n\t\tthis.importProfiles = importProfiles;\n\t}\n}\n\n/**\n * A cut importhub refused (release-a-configuration:AC3): the draft is\n * invalid now, it does not differ from the latest Release, or somebody saved\n * in between. Carries the draft's validity when that was the reason, so the\n * screen lists why.\n */\nexport class ReleaseRefusedError extends Error {\n\treadonly validity?: Validity;\n\tconstructor(message: string, validity?: Validity) {\n\t\tsuper(message);\n\t\tthis.name = \"ReleaseRefusedError\";\n\t\tthis.validity = validity;\n\t}\n}\n\n/** A create or rename refused: another configuration of the kind has the name. */\nexport class NameTakenError extends Error {\n\tconstructor(message = \"the name is taken\") {\n\t\tsuper(message);\n\t\tthis.name = \"NameTakenError\";\n\t}\n}\n\n/** The kinds of versioned configuration (ADR 0016). */\nexport type ConfigurationKind = \"importProfile\" | \"mapping\" | \"entitySet\";\n\n/** One saved Revision of a configuration, as its history lists it. */\nexport interface ConfigurationRevision {\n\tid: string;\n\t/** The odon user id of who saved it; the host's members name them. */\n\tsavedBy: string;\n\t/** When it was saved, as an ISO 8601 timestamp. */\n\tsavedAt: string;\n\t/** Whether it could be released, as decided when it was saved. */\n\tvalidity: Validity;\n\t/** The Revision it restored; \"\" for an ordinary save. */\n\trestoredFromRevisionId: string;\n}\n\n/** A Configuration Release as the history lists it: who cut it, when, from what. */\nexport interface ConfigurationReleaseRecord extends ConfigurationRelease {\n\t/** The Revision it pins. */\n\trevisionId: string;\n\t/** The odon user id of the admin who cut it. */\n\treleasedBy: string;\n\t/** When it was cut, as an ISO 8601 timestamp. */\n\treleasedAt: string;\n}\n\n/** One page of a configuration's history. */\nexport interface ConfigurationHistoryPage {\n\t/** This page's Revisions, newest first. */\n\trevisions: ConfigurationRevision[];\n\t/** Every Release, newest first, on every page. */\n\treleases: ConfigurationReleaseRecord[];\n\t/** The token of the next page; \"\" on the last. */\n\tnextPageToken: string;\n}\n\n/**\n * One side of a comparison: a Revision's content, keyed as importhub keys\n * the compared fields (the proto's field names, such as `mapping_ids`).\n */\nexport interface ConfigurationVersion {\n\trevisionId: string;\n\tcontent: Record<string, unknown>;\n}\n\nexport type FieldComparisonStatus = \"unchanged\" | \"added\" | \"removed\" | \"changed\";\n\n/** Two Revisions of one configuration, and how each top-level field differs. */\nexport interface ConfigurationComparison {\n\tfrom: ConfigurationVersion;\n\tto: ConfigurationVersion;\n\tfields: { field: string; status: FieldComparisonStatus }[];\n}\n\n/** A Release cut, and for a Mapping the Import Profiles that take it. */\nexport interface CutReleaseResult {\n\trelease: ConfigurationReleaseRecord;\n\t/** The Profiles that include the Mapping; empty for other kinds. */\n\timportProfiles: ImportProfileRef[];\n}\n\n/** Where an Import is (importhub.v1.ImportPhase). */\nexport type ImportPhase = \"queued\" | \"reading\" | \"writing\" | \"ended\";\n\n/** How an Import ended (importhub.v1.ImportOutcome, CONTEXT.md \"Import Outcome\"). */\nexport type ImportOutcome = \"succeeded\" | \"succeeded_with_problems\" | \"failed\" | \"cancelled\";\n\n/** The publication that triggered an Import: such as 2026-09-20, \"BGBl. 2026 I Nr. 270\". */\nexport interface ImportSource {\n\t/** The day it was published, as YYYY-MM-DD. */\n\tdate: string;\n\t/** How it is cited. */\n\treference: string;\n}\n\n/** One Configuration Release an Import runs with, named as it was then. */\nexport interface ImportReleaseRef {\n\tconfigurationId: string;\n\t/** The configuration's name in that Release. */\n\tname: string;\n\treleaseId: string;\n\t/** \"Release 3\". */\n\tnumber: number;\n}\n\n/** What an Import has done (importhub.v1.ImportCounts). */\nexport interface ImportCounts {\n\t/** Source Versions its Mappings matched. */\n\tmatched: number;\n\t/** Content it created. */\n\tcreated: number;\n\t/** Item Problems: Source Versions it skipped. */\n\tproblems: number;\n\t/** New Planned Releases of Content that exists. */\n\tplanned: number;\n\t/** Changed Versions planned as corrections. */\n\tcorrected: number;\n\t/** Changed Versions kept. */\n\tkept: number;\n\t/** Source Versions already in contenthub. */\n\tunchanged: number;\n}\n\n/** One run of an Import Profile's Release over one Source File. */\nexport interface Import {\n\tid: string;\n\timportProfileId: string;\n\t/** The Profile's name when the Import started. */\n\timportProfileName: string;\n\tsourceFileId: string;\n\t/** The odon user id of who started it; the host's members name them. */\n\tstartedBy: string;\n\tphase: ImportPhase;\n\t/** Unset until it has ended. */\n\toutcome?: ImportOutcome;\n\t/** Why it Failed, as importhub words it; \"\" otherwise. */\n\tfailureReason: string;\n\t/** How far the current phase is: done of total, both 0 while unknown. */\n\tprogress: { done: number; total: number };\n\tcounts: ImportCounts;\n\t/** The contenthub Change Set it fills; \"\" until it opened one. */\n\tchangeSetId: string;\n\t/** The exact Releases it runs with, pinned at Start (release-a-configuration:AC8). */\n\treleases: {\n\t\timportProfile?: ImportReleaseRef;\n\t\t/** In the Profile's order. */\n\t\tmappings: ImportReleaseRef[];\n\t\t/** Unset when the Profile names no Entity Set. */\n\t\tentitySet?: ImportReleaseRef;\n\t};\n\t/** ISO 8601 timestamps; start and end \"\" until they happen. */\n\tcreateTime: string;\n\tstartTime: string;\n\tendTime: string;\n\t/** The odon user id of who cancelled it, as soon as they asked; \"\" for nobody. */\n\tcancelledBy: string;\n\t/** YYYY-MM-DD, or \"\" for none. */\n\teffectiveDate: string;\n\tsource?: ImportSource;\n}\n\n/** One page of the workspace's Imports, newest first. */\nexport interface ImportsPage {\n\timports: Import[];\n\t/** \"\" on the last page. */\n\tnextPageToken: string;\n}\n\n/** A Source File uploaded and ready to be imported. */\nexport interface SourceFile {\n\tid: string;\n\tfileName: string;\n}\n\n/** What starting an Import takes. */\nexport interface StartImportInput {\n\timportProfileId: string;\n\tsourceFileId: string;\n\t/** YYYY-MM-DD; \"\" or unset for none. */\n\teffectiveDate?: string;\n\t/** Both or neither. */\n\tsource?: ImportSource;\n}\n\n/** One Source Version an Import could not save and skipped (CONTEXT.md \"Item Problem\"). */\nexport interface ItemProblem {\n\tid: string;\n\tmappingId: string;\n\t/** The Mapping's name in the Release the Import ran. */\n\tmappingName: string;\n\t/** \"\" when the element has none. */\n\tsourceKey: string;\n\t/** A /-separated path in the Content's data; \"\" for the Source Version as a whole. */\n\tfield: string;\n\t/** Why, as importhub words it. */\n\treason: string;\n}\n\n/** How an Import's Item Problems are filtered: by Mapping, and by Source Key. */\nexport interface ItemProblemsFilter {\n\t/** \"\" for every Mapping. */\n\tmappingId: string;\n\t/** Matches Source Keys that contain it, ignoring case; \"\" for all. */\n\tsourceKeyQuery: string;\n\t/** \"\" for the first page. */\n\tpageToken: string;\n}\n\n/** One page of an Import's Item Problems, with their counts. */\nexport interface ItemProblemsPage {\n\titemProblems: ItemProblem[];\n\t/** Every Item Problem of the Import, whatever the filter. */\n\ttotalCount: number;\n\t/** The Item Problems the filter matches, on every page. */\n\tmatchingCount: number;\n\t/** Every Mapping with Item Problems and how many, whatever the filter. */\n\tmappings: { mappingId: string; mappingName: string; count: number }[];\n\t/** \"\" on the last page. */\n\tnextPageToken: string;\n}\n\n/**\n * A Start importhub refused (start-an-import:AC4, release-a-configuration:AC5):\n * the starter lacks contenthub `editor`, or `publisher` for an Auto-publish\n * Profile, or what the Import would run has no Release or is invalid now. Its\n * message is importhub's, which names what stands in the way.\n */\nexport class StartRefusedError extends Error {\n\tconstructor(message: string) {\n\t\tsuper(message);\n\t\tthis.name = \"StartRefusedError\";\n\t}\n}\n\n/**\n * An importhub API key of the workspace (importhub.v1.APIKey): an odon API\n * key with scope `importhub:workspace:<W>`, which importhub created with a\n * standing Delegation Grant that ends with it (ADR 0006, amended). Never its\n * secret.\n */\nexport interface ApiKey {\n\tid: string;\n\t/** What it is for, as people read it: \"Nightly gesetz feed\". */\n\tname: string;\n\t/** The secret's first characters, for telling keys apart. */\n\tkeyPrefix: string;\n\t/** The odon user id of who created it, as whom it acts; the host's members name them. */\n\towner: string;\n\t/** When it stops working, as an ISO 8601 timestamp; \"\" for never. */\n\texpireTime: string;\n\t/** When it was created, as an ISO 8601 timestamp. */\n\tcreateTime: string;\n}\n\n/** The longest name CreateAPIKey takes. */\nexport const API_KEY_NAME_MAX = 100;\n\n/** What creating an API key takes. */\nexport interface CreateApiKeyInput {\n\t/** Not blank, at most API_KEY_NAME_MAX characters. */\n\tname: string;\n\t/** When it stops working, as an ISO 8601 timestamp in the future; \"\" or unset for never. */\n\texpireTime?: string;\n}\n\n/** A key just created, with its secret: the one time importhub returns it. */\nexport interface CreatedApiKey {\n\tapiKey: ApiKey;\n\t/** To send as `Authorization: Bearer <secret>`; no later call returns it. */\n\tsecret: string;\n}\n\n/**\n * What the screens ask of importhub. Every call acts on the caller's\n * workspace, which importhub takes from the token's active workspace and\n * never from an argument: a host switches workspace by switching the token.\n * An update names the draft it was made on, and is refused when somebody\n * saved in between.\n */\nexport interface ImporthubClient {\n\t/** Every Import Profile of the workspace, by name. */\n\tlistImportProfiles(): Promise<ImportProfile[]>;\n\tgetImportProfile(id: string): Promise<ImportProfile>;\n\tcreateImportProfile(content: ImportProfileContent): Promise<ImportProfile>;\n\tupdateImportProfile(\n\t\tid: string,\n\t\tcontent: ImportProfileContent,\n\t\tdraftRevisionId: string,\n\t): Promise<ImportProfile>;\n\tdeleteImportProfile(id: string): Promise<void>;\n\n\t/** The Processor catalogue, by name; the same in every workspace. */\n\tlistProcessors(): Promise<Processor[]>;\n\n\t/** Every Mapping of the workspace, by name. */\n\tlistMappings(): Promise<Mapping[]>;\n\tgetMapping(id: string): Promise<Mapping>;\n\tcreateMapping(content: MappingContent): Promise<Mapping>;\n\tupdateMapping(id: string, content: MappingContent, draftRevisionId: string): Promise<Mapping>;\n\t/** Throws ConfigurationInUseError while a Profile includes it. */\n\tdeleteMapping(id: string): Promise<void>;\n\t/** The Import Profiles whose draft or latest Release includes it. */\n\tlistMappingImportProfiles(id: string): Promise<ImportProfileRef[]>;\n\t/** Checks moving the draft to another Blueprint Release, saving nothing. */\n\tcheckMappingBlueprintRelease(\n\t\tid: string,\n\t\tblueprintReleaseId: string,\n\t): Promise<BlueprintReleaseCheck>;\n\n\t/** Every Entity Set of the workspace, by name. */\n\tlistEntitySets(): Promise<EntitySet[]>;\n\tgetEntitySet(id: string): Promise<EntitySet>;\n\tcreateEntitySet(content: EntitySetContent): Promise<EntitySet>;\n\tupdateEntitySet(\n\t\tid: string,\n\t\tcontent: EntitySetContent,\n\t\tdraftRevisionId: string,\n\t): Promise<EntitySet>;\n\t/** Throws ConfigurationInUseError while a Profile names it. */\n\tdeleteEntitySet(id: string): Promise<void>;\n\n\t/**\n\t * Cuts a Configuration Release from the draft named. Throws\n\t * ReleaseRefusedError, with the reasons when the draft is invalid.\n\t */\n\tcutRelease(\n\t\tkind: ConfigurationKind,\n\t\tid: string,\n\t\tdraftRevisionId: string,\n\t): Promise<CutReleaseResult>;\n\t/** One page of the history; pageToken \"\" for the first. */\n\tlistHistory(\n\t\tkind: ConfigurationKind,\n\t\tid: string,\n\t\tpageToken: string,\n\t): Promise<ConfigurationHistoryPage>;\n\tcompareRevisions(\n\t\tkind: ConfigurationKind,\n\t\tid: string,\n\t\tfromRevisionId: string,\n\t\ttoRevisionId: string,\n\t): Promise<ConfigurationComparison>;\n\t/** Saves an older Revision's content as a new draft, on the draft named. */\n\trestoreRevision(\n\t\tkind: ConfigurationKind,\n\t\tid: string,\n\t\trevisionId: string,\n\t\tdraftRevisionId: string,\n\t): Promise<void>;\n\n\t/**\n\t * Uploads one file as a Source File: importhub hands out a direct upload\n\t * URL into its blob store, and the file goes there, not through importhub\n\t * (start-an-import:AC1). `onProgress` hears the share sent, 0 to 1.\n\t */\n\tuploadSourceFile(file: File, onProgress: (fraction: number) => void): Promise<SourceFile>;\n\t/** Queues an Import. Throws StartRefusedError, with importhub's reason. */\n\tstartImport(input: StartImportInput): Promise<Import>;\n\t/** One page of the workspace's Imports, newest first; pageToken \"\" for the first. */\n\tlistImports(pageToken: string): Promise<ImportsPage>;\n\tgetImport(id: string): Promise<Import>;\n\t/** Asks a queued or running Import to stop; returns it as it is now. */\n\tcancelImport(id: string): Promise<Import>;\n\tlistItemProblems(importId: string, filter: ItemProblemsFilter): Promise<ItemProblemsPage>;\n\n\t/**\n\t * Every API key of the workspace, every importer's, newest first, without\n\t * their secrets. Needs importhub's `importer`, as all three key calls do.\n\t */\n\tlistApiKeys(): Promise<ApiKey[]>;\n\t/**\n\t * Creates an API key acting as the caller, with its Delegation Grant, and\n\t * returns its secret this once (import-with-an-api-key:AC5).\n\t */\n\tcreateApiKey(input: CreateApiKeyInput): Promise<CreatedApiKey>;\n\t/**\n\t * Revokes an API key in odon and releases its Grant: it stops working at\n\t * once (import-with-an-api-key:AC7).\n\t */\n\trevokeApiKey(id: string): Promise<void>;\n}\n"],"names":["ConfigurationInUseError","importProfiles","message","ReleaseRefusedError","validity","NameTakenError","StartRefusedError","API_KEY_NAME_MAX"],"mappings":"AA2NO,MAAMA,UAAgC,MAAM;AAAA,EACzC;AAAA,EACT,YAAYC,GAAoCC,IAAU,6BAA6B;AACtF,UAAMA,CAAO,GACb,KAAK,OAAO,2BACZ,KAAK,iBAAiBD;AAAA,EACvB;AACD;AAQO,MAAME,UAA4B,MAAM;AAAA,EACrC;AAAA,EACT,YAAYD,GAAiBE,GAAqB;AACjD,UAAMF,CAAO,GACb,KAAK,OAAO,uBACZ,KAAK,WAAWE;AAAA,EACjB;AACD;AAGO,MAAMC,UAAuB,MAAM;AAAA,EACzC,YAAYH,IAAU,qBAAqB;AAC1C,UAAMA,CAAO,GACb,KAAK,OAAO;AAAA,EACb;AACD;AAiNO,MAAMI,UAA0B,MAAM;AAAA,EAC5C,YAAYJ,GAAiB;AAC5B,UAAMA,CAAO,GACb,KAAK,OAAO;AAAA,EACb;AACD;AAuBO,MAAMK,IAAmB;"}
package/dist/index.d.ts CHANGED
@@ -4,6 +4,43 @@ import { ReactNode } from 'react';
4
4
  import { Schema } from '@knkcs/fieldkit/schema';
5
5
  import { Transport } from '@connectrpc/connect';
6
6
 
7
+ /**
8
+ * An importhub API key of the workspace (importhub.v1.APIKey): an odon API
9
+ * key with scope `importhub:workspace:<W>`, which importhub created with a
10
+ * standing Delegation Grant that ends with it (ADR 0006, amended). Never its
11
+ * secret.
12
+ */
13
+ export declare interface ApiKey {
14
+ id: string;
15
+ /** What it is for, as people read it: "Nightly gesetz feed". */
16
+ name: string;
17
+ /** The secret's first characters, for telling keys apart. */
18
+ keyPrefix: string;
19
+ /** The odon user id of who created it, as whom it acts; the host's members name them. */
20
+ owner: string;
21
+ /** When it stops working, as an ISO 8601 timestamp; "" for never. */
22
+ expireTime: string;
23
+ /** When it was created, as an ISO 8601 timestamp. */
24
+ createTime: string;
25
+ }
26
+
27
+ /**
28
+ * The workspace's importhub API keys, every importer's, with their name,
29
+ * owner, creation and expiry, never a secret (import-with-an-api-key:AC5,
30
+ * AC7). An importer creates one from the header and revokes one from its
31
+ * row.
32
+ *
33
+ * A viewer sees neither, nor the keys: every API key RPC needs importhub's
34
+ * `importer` (ADR 0010), ListAPIKeys too, so the screen does not ask for a
35
+ * list importhub would refuse and says who manages keys instead. As with
36
+ * Start and Cancel, `canImport` hides actions and guards nothing.
37
+ */
38
+ export declare function ApiKeysIndex({ client }: ApiKeysIndexProps): JSX.Element;
39
+
40
+ export declare interface ApiKeysIndexProps {
41
+ client: ImporthubClient;
42
+ }
43
+
7
44
  /** What moving a Mapping's draft to another Blueprint Release would lose. */
8
45
  export declare interface BlueprintReleaseCheck {
9
46
  blueprintId: string;
@@ -147,6 +184,14 @@ declare interface Configured<C> {
147
184
  state: ConfigurationState;
148
185
  }
149
186
 
187
+ /** What creating an API key takes. */
188
+ export declare interface CreateApiKeyInput {
189
+ /** Not blank, at most API_KEY_NAME_MAX characters. */
190
+ name: string;
191
+ /** When it stops working, as an ISO 8601 timestamp in the future; "" or unset for never. */
192
+ expireTime?: string;
193
+ }
194
+
150
195
  /**
151
196
  * The one call a host makes to talk to importhub (knkcms/core ADR 0003):
152
197
  * an `ImporthubClient` over Connect.
@@ -175,6 +220,13 @@ export declare interface CreateConnectImporthubClientOptions {
175
220
  putFile?: (url: string, file: File, onProgress: (fraction: number) => void) => Promise<void>;
176
221
  }
177
222
 
223
+ /** A key just created, with its secret: the one time importhub returns it. */
224
+ export declare interface CreatedApiKey {
225
+ apiKey: ApiKey;
226
+ /** To send as `Authorization: Bearer <secret>`; no later call returns it. */
227
+ secret: string;
228
+ }
229
+
178
230
  /** A Release cut, and for a Mapping the Import Profiles that take it. */
179
231
  export declare interface CutReleaseResult {
180
232
  release: ConfigurationReleaseRecord;
@@ -765,6 +817,37 @@ export declare const i18nResources: {
765
817
  notAllowed: string;
766
818
  noProfiles: string;
767
819
  };
820
+ apiKeys: {
821
+ title: string;
822
+ subtitle: string;
823
+ new: string;
824
+ empty: string;
825
+ importersOnly: string;
826
+ prefix: string;
827
+ owner: string;
828
+ created: string;
829
+ expires: string;
830
+ never: string;
831
+ nameHelp: string;
832
+ nameRequired: string;
833
+ nameTooLong: string;
834
+ expiresOn: string;
835
+ expiresOnHelp: string;
836
+ expiryPast: string;
837
+ consentTitle: string;
838
+ consent: string;
839
+ createFailed: string;
840
+ secretTitle: string;
841
+ secret: string;
842
+ secretOnce: string;
843
+ copySecret: string;
844
+ done: string;
845
+ revoke: string;
846
+ revokeKey: string;
847
+ revokeTitle: string;
848
+ revokeMessage: string;
849
+ revokeFailed: string;
850
+ };
768
851
  };
769
852
  };
770
853
  de: {
@@ -1305,6 +1388,37 @@ export declare const i18nResources: {
1305
1388
  notAllowed: string;
1306
1389
  noProfiles: string;
1307
1390
  };
1391
+ apiKeys: {
1392
+ title: string;
1393
+ subtitle: string;
1394
+ new: string;
1395
+ empty: string;
1396
+ importersOnly: string;
1397
+ prefix: string;
1398
+ owner: string;
1399
+ created: string;
1400
+ expires: string;
1401
+ never: string;
1402
+ nameHelp: string;
1403
+ nameRequired: string;
1404
+ nameTooLong: string;
1405
+ expiresOn: string;
1406
+ expiresOnHelp: string;
1407
+ expiryPast: string;
1408
+ consentTitle: string;
1409
+ consent: string;
1410
+ createFailed: string;
1411
+ secretTitle: string;
1412
+ secret: string;
1413
+ secretOnce: string;
1414
+ copySecret: string;
1415
+ done: string;
1416
+ revoke: string;
1417
+ revokeKey: string;
1418
+ revokeTitle: string;
1419
+ revokeMessage: string;
1420
+ revokeFailed: string;
1421
+ };
1308
1422
  };
1309
1423
  };
1310
1424
  };
@@ -1524,6 +1638,21 @@ export declare interface ImporthubClient {
1524
1638
  /** Asks a queued or running Import to stop; returns it as it is now. */
1525
1639
  cancelImport(id: string): Promise<Import>;
1526
1640
  listItemProblems(importId: string, filter: ItemProblemsFilter): Promise<ItemProblemsPage>;
1641
+ /**
1642
+ * Every API key of the workspace, every importer's, newest first, without
1643
+ * their secrets. Needs importhub's `importer`, as all three key calls do.
1644
+ */
1645
+ listApiKeys(): Promise<ApiKey[]>;
1646
+ /**
1647
+ * Creates an API key acting as the caller, with its Delegation Grant, and
1648
+ * returns its secret this once (import-with-an-api-key:AC5).
1649
+ */
1650
+ createApiKey(input: CreateApiKeyInput): Promise<CreatedApiKey>;
1651
+ /**
1652
+ * Revokes an API key in odon and releases its Grant: it stops working at
1653
+ * once (import-with-an-api-key:AC7).
1654
+ */
1655
+ revokeApiKey(id: string): Promise<void>;
1527
1656
  }
1528
1657
 
1529
1658
  export declare interface ImporthubHost {
@@ -1576,6 +1705,8 @@ export declare const importhubKeys: {
1576
1705
  import: (workspaceId: string, id: string) => readonly ["importhub", string, "imports", string];
1577
1706
  /** An Import's Item Problems under a filter, one entry per filter. */
1578
1707
  itemProblems: (workspaceId: string, id: string, mappingId: string, sourceKeyQuery: string) => readonly ["importhub", string, "imports", string, "itemProblems", string, string];
1708
+ /** The workspace's importhub API keys. */
1709
+ apiKeys: (workspaceId: string) => readonly ["importhub", string, "apiKeys"];
1579
1710
  blueprints: (workspaceId: string) => readonly ["importhub", string, "blueprints"];
1580
1711
  blueprintReleases: (workspaceId: string, blueprintId: string) => readonly ["importhub", string, "blueprints", string, "releases"];
1581
1712
  /** A Blueprint Release with its field tree; a Release never changes once cut. */