@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/CHANGELOG.md +14 -0
- package/README.md +17 -4
- package/dist/importhub-client-CrS-3Zuu.js +23 -0
- package/dist/importhub-client-CrS-3Zuu.js.map +1 -0
- package/dist/index.d.ts +883 -13
- package/dist/index.js +2408 -95
- package/dist/index.js.map +1 -1
- package/dist/testing.d.ts +309 -14
- package/dist/testing.js +522 -41
- package/dist/testing.js.map +1 -1
- package/package.json +10 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.3.0](https://github.com/knkCS/importhub/compare/importhub-ui-v0.2.0...importhub-ui-v0.3.0) (2026-12-04)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **ui:** release state, Cut Release and history of configuration (F3) ([#96](https://github.com/knkCS/importhub/issues/96)) ([babf756](https://github.com/knkCS/importhub/commit/babf7563edade0a91c7cc199072d1e7b16f6442c))
|
|
9
|
+
|
|
10
|
+
## [0.2.0](https://github.com/knkCS/importhub/compare/importhub-ui-v0.1.0...importhub-ui-v0.2.0) (2026-12-04)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* **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))
|
|
16
|
+
|
|
3
17
|
## 0.1.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
|
|
7
|
+
So far it holds the configuration screens (Import Profiles, Mappings, Entity Sets and the Processor catalogue) with their release and history, and a start page for Imports. The screens for Imports, the start flow, the Dry Run report, and the Mapping editor and Mapping Test 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,14 @@ An Import fills one contenthub Change Set, and its page links out to it (`Change
|
|
|
57
63
|
|
|
58
64
|
### Screens
|
|
59
65
|
|
|
60
|
-
- `
|
|
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
|
+
- `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.
|
|
70
|
+
- `ProcessorCatalogue({ client })`: every Processor with its kind, description and settings.
|
|
71
|
+
- `ImporthubStartPage({ client, section })`: a section's start page, for a section with no screen yet (Imports).
|
|
72
|
+
|
|
73
|
+
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.
|
|
61
74
|
|
|
62
75
|
### Translations
|
|
63
76
|
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
class o extends Error {
|
|
2
|
+
importProfiles;
|
|
3
|
+
constructor(r, e = "in use by Import Profiles") {
|
|
4
|
+
super(e), this.name = "ConfigurationInUseError", this.importProfiles = r;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
class t extends Error {
|
|
8
|
+
validity;
|
|
9
|
+
constructor(r, e) {
|
|
10
|
+
super(r), this.name = "ReleaseRefusedError", this.validity = e;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
class a extends Error {
|
|
14
|
+
constructor(r = "the name is taken") {
|
|
15
|
+
super(r), this.name = "NameTakenError";
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
o as C,
|
|
20
|
+
a as N,
|
|
21
|
+
t as R
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=importhub-client-CrS-3Zuu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"importhub-client-CrS-3Zuu.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\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/**\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/**\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"],"names":["ConfigurationInUseError","importProfiles","message","ReleaseRefusedError","validity","NameTakenError"],"mappings":"AA4JO,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;"}
|