@knkcs/importhub-ui 0.1.0 → 0.2.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,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.2.0](https://github.com/knkCS/importhub/compare/importhub-ui-v0.1.0...importhub-ui-v0.2.0) (2026-12-04)
4
+
5
+
6
+ ### Features
7
+
8
+ * **ui:** configuration screens for Import Profiles, Processors, Mappings and Entity Sets (F2) ([#88](https://github.com/knkCS/importhub/issues/88)) ([7b879f9](https://github.com/knkCS/importhub/commit/7b879f9a6886440b22fef845706f6e3ba2928b06))
9
+
3
10
  ## 0.1.0 (2026-12-04)
4
11
 
5
12
 
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 a start page per section (Imports, Import Profiles, Mappings, Entity Sets). The screens for Imports, the start flow, the Dry Run report, Profiles, Mappings with the Mapping editor and Mapping Test, Entity Sets and configuration history follow.
7
+ So far it holds the configuration screens (Import Profiles, Mappings, Entity Sets and the Processor catalogue) and a start page for Imports. The screens for Imports, the start flow, the Dry Run report, the Mapping editor and Mapping Test, and configuration history follow.
8
8
 
9
9
  ## Install
10
10
 
@@ -12,7 +12,7 @@ So far it holds a start page per section (Imports, Import Profiles, Mappings, En
12
12
  npm install @knkcs/importhub-ui
13
13
  ```
14
14
 
15
- Peer dependencies: `react` and `react-dom` 19, `@knkcs/anker` ^5.20, `@tanstack/react-query` 5, `i18next` 26, `react-i18next` 17, `@bufbuild/protobuf` 2, `@connectrpc/connect` 2, `@connectrpc/connect-web` 2 and `lucide-react`. `package.json` has the exact ranges. anker brings its own peers (Chakra UI 3, react-router, react-hook-form, …).
15
+ Peer dependencies: `react` and `react-dom` 19, `@knkcs/anker` ^5.20, `@tanstack/react-query` 5, `i18next` 26, `react-i18next` 17, `@bufbuild/protobuf` 2, `@connectrpc/connect` 2, `@connectrpc/connect-web` 2, `@knkcs/fieldkit` 0.18 (the Processor settings forms), `react-hook-form` 7, `@hookform/resolvers` 3, `zod` 3, `@tanstack/react-table` 8, `react-router` 7 and `lucide-react`. `package.json` has the exact ranges. anker brings its own peers (Chakra UI 3, react-router, react-hook-form, …).
16
16
 
17
17
  ## Host contract
18
18
 
@@ -43,10 +43,16 @@ import { ImporthubHostProvider, STANDALONE_IMPORTHUB_PATHS } from "@knkcs/import
43
43
 
44
44
  <ImporthubHostProvider
45
45
  host={{
46
- // Where the host mounts each section's index: imports, profiles, mappings, entitySets.
46
+ // Where the host mounts each section's index: imports, profiles, mappings, entitySets,
47
+ // processors. An item of a section lives at `<index>/<id>` (`itemPath`).
47
48
  paths: STANDALONE_IMPORTHUB_PATHS,
48
49
  // Where a Change Set lives in contenthub, or null when the host has no contenthub to link to.
49
50
  changeSetHref: (changeSetId) => `/change-sets/${changeSetId}`,
51
+ // Whether the viewer may change configuration (importhub's `admin`). Unset: read-only.
52
+ canConfigure: true,
53
+ // Optional: where Blueprints and their Releases are found, to name a Mapping's target.
54
+ // Without it, the Mapping screens take and show their ids, labelled as such.
55
+ blueprints: { listBlueprints, listReleases },
50
56
  }}
51
57
  >
52
58
  {routes}
@@ -57,7 +63,13 @@ An Import fills one contenthub Change Set, and its page links out to it (`Change
57
63
 
58
64
  ### Screens
59
65
 
60
- - `ImporthubStartPage({ client, section })`: a section's start page, until its screens exist.
66
+ - `ImportProfilesIndex({ client, onOpen })` and `ImportProfileDetail({ client, id, onDeleted })`: the Import Profiles, each with its Entity Set, its Preprocessors, Mappings and Post-processors in order (each Processor configured in a form fieldkit generates from its settings spec), Auto-publish and delete-on-success.
67
+ - `MappingsIndex({ client, onOpen })` and `MappingDetail({ client, id, onDeleted })`: the Mappings with their target Blueprint and pinned Release, the Profiles that include each, and the move to another Release, which lists the field paths it would lose first.
68
+ - `EntitySetsIndex({ client, onOpen })` and `EntitySetDetail({ client, id, onDeleted })`: the Entity Sets and their tables of entities.
69
+ - `ProcessorCatalogue({ client })`: every Processor with its kind, description and settings.
70
+ - `ImporthubStartPage({ client, section })`: a section's start page, for a section with no screen yet (Imports).
71
+
72
+ Every configuration screen shows why a configuration is invalid, saves with the header's one Save and deletes from the rail (anker ADR 0004), and is read-only unless the host says `canConfigure`. `onOpen` runs after a create too; `onDeleted` once the item is gone.
61
73
 
62
74
  ### Translations
63
75
 
@@ -0,0 +1,16 @@
1
+ class o extends Error {
2
+ importProfiles;
3
+ constructor(r, s = "in use by Import Profiles") {
4
+ super(s), this.name = "ConfigurationInUseError", this.importProfiles = r;
5
+ }
6
+ }
7
+ class n extends Error {
8
+ constructor(r = "the name is taken") {
9
+ super(r), this.name = "NameTakenError";
10
+ }
11
+ }
12
+ export {
13
+ o as C,
14
+ n as N
15
+ };
16
+ //# sourceMappingURL=importhub-client-CYqd7Eeq.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"importhub-client-CYqd7Eeq.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// Releases, history and comparison are later screens' (release-a-configuration).\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). The screens here edit only the\n * fields they name; every other setting (field mappings, Version Match,\n * Title Contributions, …) is the structured editor's (F4), and travels\n * through as given, so a save here never drops it.\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\t[key: string]: unknown;\n\t};\n\t/** Each an xmlmapper FieldMapping; `name` is the field path. */\n\tfields?: Array<Record<string, unknown>>;\n\t[key: string]: unknown;\n}\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/** 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/**\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"],"names":["ConfigurationInUseError","importProfiles","message","NameTakenError"],"mappings":"AA2JO,MAAMA,UAAgC,MAAM;AAAA,EACzC;AAAA,EACT,YAAYC,GAAoCC,IAAU,6BAA6B;AACtF,UAAMA,CAAO,GACb,KAAK,OAAO,2BACZ,KAAK,iBAAiBD;AAAA,EACvB;AACD;AAGO,MAAME,UAAuB,MAAM;AAAA,EACzC,YAAYD,IAAU,qBAAqB;AAC1C,UAAMA,CAAO,GACb,KAAK,OAAO;AAAA,EACb;AACD;"}