@knkcs/importhub-ui 0.7.0 → 0.9.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 +3 -3
- package/dist/field-tree-CghMgGKm.js +108 -0
- package/dist/field-tree-CghMgGKm.js.map +1 -0
- package/dist/{importhub-client-BS6F4DW2.js → importhub-client-Wrb4s3lw.js} +16 -10
- package/dist/importhub-client-Wrb4s3lw.js.map +1 -0
- package/dist/index.d.ts +161 -0
- package/dist/index.js +994 -966
- package/dist/index.js.map +1 -1
- package/dist/mapping-editor.d.ts +66 -0
- package/dist/mapping-editor.js +806 -662
- package/dist/mapping-editor.js.map +1 -1
- package/dist/{mapping-page-Lu48SY_L.js → mapping-page-BTEJR0-z.js} +136 -134
- package/dist/{mapping-page-Lu48SY_L.js.map → mapping-page-BTEJR0-z.js.map} +1 -1
- package/dist/testing.d.ts +72 -0
- package/dist/testing.js +572 -418
- package/dist/testing.js.map +1 -1
- package/package.json +1 -1
- package/dist/importhub-client-BS6F4DW2.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.9.0](https://github.com/knkCS/importhub/compare/importhub-ui-v0.8.0...importhub-ui-v0.9.0) (2026-12-05)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **ui:** Mapping Test panel in the Mapping editor (F5) ([#138](https://github.com/knkCS/importhub/issues/138)) ([5fba307](https://github.com/knkCS/importhub/commit/5fba3071b1100dab6419c577d1e8eaf04f44f879))
|
|
9
|
+
|
|
10
|
+
## [0.8.0](https://github.com/knkCS/importhub/compare/importhub-ui-v0.7.0...importhub-ui-v0.8.0) (2026-12-04)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* write the display name into the Blueprint field the Mapping names (B9b) ([#125](https://github.com/knkCS/importhub/issues/125)) ([07fe84c](https://github.com/knkCS/importhub/commit/07fe84cf6970503f9df150bdb39358e86f679e13))
|
|
16
|
+
|
|
3
17
|
## [0.7.0](https://github.com/knkCS/importhub/compare/importhub-ui-v0.6.0...importhub-ui-v0.7.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, the workspace's API keys, and the structured Mapping editor (the `./mapping-editor` subpath). The Dry Run report
|
|
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 with its Mapping Test (the `./mapping-editor` subpath). The Dry Run report follows.
|
|
8
8
|
|
|
9
9
|
## Install
|
|
10
10
|
|
|
@@ -72,7 +72,7 @@ An Import fills one contenthub Change Set, and its page links out to it (`Change
|
|
|
72
72
|
- `StartImport({ client, onStarted })`: the start flow. The importer picks a Profile that has a Release and uploads one XML file straight into importhub's storage, with its progress. They may add an effective date and a Source (date and reference), read what delegated access they grant, and Start from the header. A refused Start shows importhub's reason. `onStarted(importId)` opens the queued Import.
|
|
73
73
|
- `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.
|
|
74
74
|
- `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.
|
|
75
|
-
- `MappingEditor({ client, id, onDeleted })`, from `@knkcs/importhub-ui/mapping-editor`: the structured Mapping editor, a Mapping's page as `MappingDetail` shows it with
|
|
75
|
+
- `MappingEditor({ client, id, onDeleted })`, from `@knkcs/importhub-ui/mapping-editor`: the structured Mapping editor, a Mapping's page as `MappingDetail` shows it with four more tabs. **Fields** shows the pinned Release's field tree, fieldsets nested and each field marked mapped or not, beside the selected field's form: its XPath, its xmlmapper type and that type's options, and an Advanced (JSON) panel with the field mapping's full settings, whose keys the form does not cover survive every save. **Source Key & Source Versions** holds the Source Key's extraction, the Version Match, the Validity Period and Release Spec sources and the Changed Version handling; **Output** the Stub Mapping, the display-name template, target Collections and collection routing, Title Contributions and Placeholder Assets. **Mapping Test** runs the Mapping as the editor holds it, unsaved edits included, over a sample XML file the admin chooses, optionally read with an Entity Set's entities: it lists every matched element with its Source Key and mapped values, and each field that cannot be mapped with its error in the element's row for that field. It says, and importhub's `RunMappingTest` guarantees, that it touches nothing outside importhub; the sample goes with the request and is not kept. The reasons importhub gives for an invalid draft show at the fields they concern. It is its own entry, so load it lazily, where a Mapping's page goes: `lazy(() => import("@knkcs/importhub-ui/mapping-editor").then((m) => ({ default: m.MappingEditor })))`. The root entry never imports it.
|
|
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.
|
|
@@ -108,7 +108,7 @@ import { createStubImporthubClient, stubIdentity } from "@knkcs/importhub-ui/tes
|
|
|
108
108
|
</TestHost>;
|
|
109
109
|
```
|
|
110
110
|
|
|
111
|
-
`switchWorkspace(id)` makes the stub answer for another workspace, as a host's new token would.
|
|
111
|
+
`switchWorkspace(id)` makes the stub answer for another workspace, as a host's new token would. Its Mapping Test reads the sample with the DOM's own XPath (a field's XPath as a string, fieldsets nested), so it needs a browser or jsdom; `stubMappingTestSample` is a sample for the fixtures' "Gesetz norms" Mapping.
|
|
112
112
|
|
|
113
113
|
## Develop
|
|
114
114
|
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
const y = ["fields", "virtualTableFields"], o = (e) => Array.isArray(e) ? e : [];
|
|
2
|
+
function x(e, t = "", n = "fields") {
|
|
3
|
+
return o(e).flatMap((r, s) => {
|
|
4
|
+
const l = `${t}${String(r.name ?? "")}`, i = `${n}.${s}`;
|
|
5
|
+
return [
|
|
6
|
+
{ path: l, name: i },
|
|
7
|
+
...y.flatMap((a) => x(r[a], `${l}.`, `${i}.${a}`))
|
|
8
|
+
];
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
function _(e, t) {
|
|
12
|
+
return x(e).find((n) => n.path === t)?.name ?? null;
|
|
13
|
+
}
|
|
14
|
+
function g(e, t) {
|
|
15
|
+
for (const n of e) {
|
|
16
|
+
if (n.path === t) return [n];
|
|
17
|
+
if (t.startsWith(`${n.path}.`)) {
|
|
18
|
+
const r = g(n.children, t);
|
|
19
|
+
if (r) return [n, ...r];
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
function T(e, t = "") {
|
|
25
|
+
return { accessor: e.split(".").pop() ?? e, path: e, fieldType: t, label: "", children: [] };
|
|
26
|
+
}
|
|
27
|
+
const $ = (e) => e.fieldType.includes("table") ? "virtualTableFields" : "fields";
|
|
28
|
+
function I(e, t, n) {
|
|
29
|
+
const r = structuredClone(o(e)), s = _(r, n);
|
|
30
|
+
if (s) return { fields: r, name: s };
|
|
31
|
+
const l = g(t, n) ?? [{ ...T(n, "text"), accessor: n }];
|
|
32
|
+
let i = r, a = "fields", p = "";
|
|
33
|
+
return l.forEach((f, m) => {
|
|
34
|
+
const b = f.path.slice(p.length);
|
|
35
|
+
let u = i.findIndex((c) => String(c.name ?? "") === b);
|
|
36
|
+
const h = m === l.length - 1;
|
|
37
|
+
if (u < 0 && (i.push({
|
|
38
|
+
name: b,
|
|
39
|
+
selector: h ? "" : ".",
|
|
40
|
+
type: v(f.fieldType)
|
|
41
|
+
}), u = i.length - 1), a = `${a}.${u}`, !h) {
|
|
42
|
+
const c = $(f), d = i[u];
|
|
43
|
+
d[c] = o(d[c]), i = d[c], a = `${a}.${c}`, p = `${f.path}.`;
|
|
44
|
+
}
|
|
45
|
+
}), { fields: r, name: a };
|
|
46
|
+
}
|
|
47
|
+
function L(e, t) {
|
|
48
|
+
const n = structuredClone(o(e)), r = t.split(".").slice(1);
|
|
49
|
+
let s = n;
|
|
50
|
+
for (let l = 0; l < r.length - 1; l += 2) {
|
|
51
|
+
const i = s[Number(r[l])];
|
|
52
|
+
if (!i) return n;
|
|
53
|
+
s = o(i[r[l + 1]]);
|
|
54
|
+
}
|
|
55
|
+
return s.splice(Number(r[r.length - 1]), 1), n;
|
|
56
|
+
}
|
|
57
|
+
const P = [
|
|
58
|
+
"text",
|
|
59
|
+
"array",
|
|
60
|
+
"date",
|
|
61
|
+
"number",
|
|
62
|
+
"richtext",
|
|
63
|
+
"reference",
|
|
64
|
+
"toc_reference",
|
|
65
|
+
"concat",
|
|
66
|
+
"virtualtable",
|
|
67
|
+
"select",
|
|
68
|
+
"boolean",
|
|
69
|
+
"fieldset",
|
|
70
|
+
"title_scope",
|
|
71
|
+
"title_data",
|
|
72
|
+
"outline_tree",
|
|
73
|
+
"processing_instructions"
|
|
74
|
+
], M = {
|
|
75
|
+
date: "date",
|
|
76
|
+
number: "number",
|
|
77
|
+
boolean: "boolean",
|
|
78
|
+
select: "select",
|
|
79
|
+
radio: "select",
|
|
80
|
+
checkboxes: "array",
|
|
81
|
+
list: "array",
|
|
82
|
+
array: "array",
|
|
83
|
+
rich_text: "richtext",
|
|
84
|
+
reference: "reference",
|
|
85
|
+
single_reference: "reference",
|
|
86
|
+
fieldset: "fieldset",
|
|
87
|
+
group: "fieldset",
|
|
88
|
+
card: "fieldset",
|
|
89
|
+
section: "fieldset",
|
|
90
|
+
virtual_table: "virtualtable"
|
|
91
|
+
};
|
|
92
|
+
function v(e) {
|
|
93
|
+
return M[e] ?? "text";
|
|
94
|
+
}
|
|
95
|
+
const E = ["text", "textarea"];
|
|
96
|
+
function F(e) {
|
|
97
|
+
return e.flatMap((t) => t.fieldType === "virtual_table" ? [] : [...E.includes(t.fieldType) ? [t] : [], ...F(t.children)]);
|
|
98
|
+
}
|
|
99
|
+
export {
|
|
100
|
+
P as X,
|
|
101
|
+
T as a,
|
|
102
|
+
I as b,
|
|
103
|
+
g as f,
|
|
104
|
+
x as l,
|
|
105
|
+
F as p,
|
|
106
|
+
L as r
|
|
107
|
+
};
|
|
108
|
+
//# sourceMappingURL=field-tree-CghMgGKm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field-tree-CghMgGKm.js","sources":["../src/screens/mapping-editor/field-tree.ts"],"sourcesContent":["// The bookkeeping between a Blueprint Release's field tree and a Mapping's\n// field mappings, which are xmlmapper FieldMappings: `name` is the field\n// path, and a fieldset's (`fields`) or a virtual table's\n// (`virtualTableFields`) children are named relative to it, as importhub's\n// configstore reads them (fieldPaths in internal/configstore/mapping.go).\n// Pure functions over plain values, so the form's state stays the one copy.\nimport type { ImporthubBlueprintField } from \"../../common/host\";\n\n/** One field mapping as the form holds it: xmlmapper's open object. */\nexport type FieldMappingValue = Record<string, unknown>;\n\n/** A field mapping's place: the field path it writes and its form name. */\nexport interface MappingPlace {\n\tpath: string;\n\t/** Where the form holds it, such as `fields.1.fields.0`. */\n\tname: string;\n}\n\nconst CHILD_KEYS = [\"fields\", \"virtualTableFields\"] as const;\n\nconst asList = (value: unknown): FieldMappingValue[] =>\n\tArray.isArray(value) ? (value as FieldMappingValue[]) : [];\n\n/** Every field mapping, parents before their children, in the Mapping's order. */\nexport function listMappings(fields: unknown, prefix = \"\", base = \"fields\"): MappingPlace[] {\n\treturn asList(fields).flatMap((m, i) => {\n\t\tconst path = `${prefix}${String(m.name ?? \"\")}`;\n\t\tconst name = `${base}.${i}`;\n\t\treturn [\n\t\t\t{ path, name },\n\t\t\t...CHILD_KEYS.flatMap((key) => listMappings(m[key], `${path}.`, `${name}.${key}`)),\n\t\t];\n\t});\n}\n\n/** The form name of the mapping that writes `path`; null while none does. */\nexport function locateMapping(fields: unknown, path: string): string | null {\n\treturn listMappings(fields).find((p) => p.path === path)?.name ?? null;\n}\n\n/** The field and its ancestors, from the top; null when the tree lacks it. */\nexport function findField(\n\ttree: readonly ImporthubBlueprintField[],\n\tpath: string,\n): ImporthubBlueprintField[] | null {\n\tfor (const f of tree) {\n\t\tif (f.path === path) return [f];\n\t\tif (path.startsWith(`${f.path}.`)) {\n\t\t\tconst below = findField(f.children, path);\n\t\t\tif (below) return [f, ...below];\n\t\t}\n\t}\n\treturn null;\n}\n\n/**\n * A field known only by its path: one the Mapping maps that the Release does\n * not have, or every field where the Release cannot be read.\n */\nexport function leafField(path: string, fieldType = \"\"): ImporthubBlueprintField {\n\treturn { accessor: path.split(\".\").pop() ?? path, path, fieldType, label: \"\", children: [] };\n}\n\n/** Where a node's children are mapped: a virtual table's rows, or a fieldset's fields. */\nconst childKeyOf = (f: ImporthubBlueprintField) =>\n\tf.fieldType.includes(\"table\") ? \"virtualTableFields\" : \"fields\";\n\n/**\n * The field mappings with one more, for the field at `path`, and its form\n * name. Its ancestors get a mapping too where they have none (a fieldset's\n * selector `.`, its element's own context), since xmlmapper reads a child\n * only through its parent. Returns them unchanged when it is mapped already.\n */\nexport function addMapping(\n\tfields: unknown,\n\ttree: readonly ImporthubBlueprintField[],\n\tpath: string,\n): { fields: FieldMappingValue[]; name: string } {\n\tconst top = structuredClone(asList(fields));\n\tconst existing = locateMapping(top, path);\n\tif (existing) return { fields: top, name: existing };\n\tconst chain = findField(tree, path) ?? [{ ...leafField(path, \"text\"), accessor: path }];\n\tlet list = top;\n\tlet name = \"fields\";\n\tlet prefix = \"\";\n\tchain.forEach((node, depth) => {\n\t\tconst relative = node.path.slice(prefix.length);\n\t\tlet index = list.findIndex((m) => String(m.name ?? \"\") === relative);\n\t\tconst last = depth === chain.length - 1;\n\t\tif (index < 0) {\n\t\t\tlist.push({\n\t\t\t\tname: relative,\n\t\t\t\tselector: last ? \"\" : \".\",\n\t\t\t\ttype: xmlmapperTypeOf(node.fieldType),\n\t\t\t});\n\t\t\tindex = list.length - 1;\n\t\t}\n\t\tname = `${name}.${index}`;\n\t\tif (!last) {\n\t\t\tconst key = childKeyOf(node);\n\t\t\tconst parent = list[index] as FieldMappingValue;\n\t\t\tparent[key] = asList(parent[key]);\n\t\t\tlist = parent[key] as FieldMappingValue[];\n\t\t\tname = `${name}.${key}`;\n\t\t\tprefix = `${node.path}.`;\n\t\t}\n\t});\n\treturn { fields: top, name };\n}\n\n/** The field mappings without the one at the form name (and its children). */\nexport function removeMapping(fields: unknown, name: string): FieldMappingValue[] {\n\tconst top = structuredClone(asList(fields));\n\tconst tokens = name.split(\".\").slice(1);\n\tlet list: FieldMappingValue[] = top;\n\tfor (let i = 0; i < tokens.length - 1; i += 2) {\n\t\tconst parent = list[Number(tokens[i])];\n\t\tif (!parent) return top;\n\t\tlist = asList(parent[tokens[i + 1] as string]);\n\t}\n\tlist.splice(Number(tokens[tokens.length - 1]), 1);\n\treturn top;\n}\n\n/** The xmlmapper field types (xmlmapper's schema.go). */\nexport const XMLMAPPER_TYPES = [\n\t\"text\",\n\t\"array\",\n\t\"date\",\n\t\"number\",\n\t\"richtext\",\n\t\"reference\",\n\t\"toc_reference\",\n\t\"concat\",\n\t\"virtualtable\",\n\t\"select\",\n\t\"boolean\",\n\t\"fieldset\",\n\t\"title_scope\",\n\t\"title_data\",\n\t\"outline_tree\",\n\t\"processing_instructions\",\n] as const;\n\nconst BY_FIELDKIT_TYPE: Record<string, string> = {\n\tdate: \"date\",\n\tnumber: \"number\",\n\tboolean: \"boolean\",\n\tselect: \"select\",\n\tradio: \"select\",\n\tcheckboxes: \"array\",\n\tlist: \"array\",\n\tarray: \"array\",\n\trich_text: \"richtext\",\n\treference: \"reference\",\n\tsingle_reference: \"reference\",\n\tfieldset: \"fieldset\",\n\tgroup: \"fieldset\",\n\tcard: \"fieldset\",\n\tsection: \"fieldset\",\n\tvirtual_table: \"virtualtable\",\n};\n\n/** The xmlmapper type a new mapping of a fieldkit field starts with; text by default. */\nexport function xmlmapperTypeOf(fieldkitType: string): string {\n\treturn BY_FIELDKIT_TYPE[fieldkitType] ?? \"text\";\n}\n\n/** The field types whose value is one plain string a display name can be. */\nconst PLAIN_TEXT = [\"text\", \"textarea\"];\n\n/**\n * The fields of a Release a display name can be written into\n * (knkCS/importhub#119): its `text` and `textarea` fields, a fieldset's too,\n * but none in a virtual table's rows, which are one field per row. importhub\n * checks the same on save (checkDisplayName in internal/configstore/mapping.go).\n */\nexport function plainTextFields(tree: ImporthubBlueprintField[]): ImporthubBlueprintField[] {\n\treturn tree.flatMap((f) => {\n\t\tif (f.fieldType === \"virtual_table\") return [];\n\t\treturn [...(PLAIN_TEXT.includes(f.fieldType) ? [f] : []), ...plainTextFields(f.children)];\n\t});\n}\n"],"names":["CHILD_KEYS","asList","value","listMappings","fields","prefix","base","m","i","path","name","key","locateMapping","p","findField","tree","f","below","leafField","fieldType","childKeyOf","addMapping","top","existing","chain","list","node","depth","relative","index","last","xmlmapperTypeOf","parent","removeMapping","tokens","XMLMAPPER_TYPES","BY_FIELDKIT_TYPE","fieldkitType","PLAIN_TEXT","plainTextFields"],"mappings":"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"}
|
|
@@ -1,31 +1,37 @@
|
|
|
1
1
|
class t extends Error {
|
|
2
|
+
constructor(r) {
|
|
3
|
+
super(r), this.name = "MappingTestRefusedError";
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
class o extends Error {
|
|
2
7
|
importProfiles;
|
|
3
8
|
constructor(r, e = "in use by Import Profiles") {
|
|
4
9
|
super(e), this.name = "ConfigurationInUseError", this.importProfiles = r;
|
|
5
10
|
}
|
|
6
11
|
}
|
|
7
|
-
class
|
|
12
|
+
class a extends Error {
|
|
8
13
|
validity;
|
|
9
14
|
constructor(r, e) {
|
|
10
15
|
super(r), this.name = "ReleaseRefusedError", this.validity = e;
|
|
11
16
|
}
|
|
12
17
|
}
|
|
13
|
-
class
|
|
18
|
+
class n extends Error {
|
|
14
19
|
constructor(r = "the name is taken") {
|
|
15
20
|
super(r), this.name = "NameTakenError";
|
|
16
21
|
}
|
|
17
22
|
}
|
|
18
|
-
class
|
|
23
|
+
class i extends Error {
|
|
19
24
|
constructor(r) {
|
|
20
25
|
super(r), this.name = "StartRefusedError";
|
|
21
26
|
}
|
|
22
27
|
}
|
|
23
|
-
const
|
|
28
|
+
const u = 100;
|
|
24
29
|
export {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
+
u as A,
|
|
31
|
+
o as C,
|
|
32
|
+
t as M,
|
|
33
|
+
n as N,
|
|
34
|
+
a as R,
|
|
35
|
+
i as S
|
|
30
36
|
};
|
|
31
|
-
//# sourceMappingURL=importhub-client-
|
|
37
|
+
//# sourceMappingURL=importhub-client-Wrb4s3lw.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"importhub-client-Wrb4s3lw.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\t/**\n\t * The plain-text field of the pinned Release the display name is written\n\t * into; set with displayNameTemplate, or neither.\n\t */\n\tdisplayNameField?: 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 * What a Mapping Test runs (test-a-mapping-on-a-sample-file:AC1): a\n * Mapping's content as the editor holds it, saved or not, over a sample file.\n */\nexport interface MappingTestInput {\n\tcontent: MappingContent;\n\t/** The sample file, an XML file, sent whole. */\n\tsample: Uint8Array;\n\t/**\n\t * An Entity Set of the workspace whose draft's entities the sample uses;\n\t * \"\" or unset for none.\n\t */\n\tentitySetId?: string;\n}\n\n/** One problem of an element in a Mapping Test (importhub.v1.MappingTestProblem). */\nexport interface MappingTestProblem {\n\t/**\n\t * A field path, `.`-joined into fieldsets and virtual tables, or the\n\t * Mapping's setting that reads it (`display_name_template`, say); \"\" for\n\t * the element as a whole, such as an element without a Source Key.\n\t */\n\tfield: string;\n\t/** Why, for a person: xmlmapper's message for a field that cannot be mapped. */\n\treason: string;\n}\n\n/** One element a Mapping Test matched, as an Import would read it. */\nexport interface MappingTestElement {\n\t/** Its position among the elements matched, from 1. */\n\tposition: number;\n\t/** Its Source Key, verbatim; \"\" when it has none. */\n\tsourceKey: string;\n\t/** Its mapped values by field accessor; a field that cannot be mapped is left out. */\n\tvalues: Record<string, unknown>;\n\t/** The Validity Period the sample gives, as YYYY-MM-DD; \"\" for none. */\n\tfirstDay: string;\n\tlastDay: string;\n\t/** The Release Spec values the sample gives, by field. */\n\treleaseSpec: Record<string, unknown>;\n\t/** What the display-name template makes; \"\" without one. */\n\tdisplayName: string;\n\t/** The Collections it would be filed into, by name. */\n\tcollections: string[];\n\t/** Each field that cannot be mapped, and what an Import would report; none when clean. */\n\tproblems: MappingTestProblem[];\n}\n\n/** What a Mapping Test answers: every element the element selector matched. */\nexport interface MappingTestResult {\n\telements: MappingTestElement[];\n}\n\n/**\n * A Mapping Test that could not run at all: the sample is not XML, the\n * element selector or Source Key cannot be evaluated, or the Entity Set named\n * is unknown. Its message is importhub's, which names xmlmapper's reason.\n */\nexport class MappingTestRefusedError extends Error {\n\tconstructor(message: string) {\n\t\tsuper(message);\n\t\tthis.name = \"MappingTestRefusedError\";\n\t}\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\t/**\n\t * Runs a Mapping Test: the content given over the sample, read as an\n\t * Import reads a Source File. Stores nothing and touches nothing outside\n\t * importhub (test-a-mapping-on-a-sample-file:AC4). Throws with importhub's\n\t * reason when the test cannot run at all: a sample that is not XML, an\n\t * element selector or Source Key xmlmapper cannot evaluate.\n\t */\n\trunMappingTest(input: MappingTestInput): Promise<MappingTestResult>;\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":["MappingTestRefusedError","message","ConfigurationInUseError","importProfiles","ReleaseRefusedError","validity","NameTakenError","StartRefusedError","API_KEY_NAME_MAX"],"mappings":"AAqRO,MAAMA,UAAgC,MAAM;AAAA,EAClD,YAAYC,GAAiB;AAC5B,UAAMA,CAAO,GACb,KAAK,OAAO;AAAA,EACb;AACD;AAOO,MAAMC,UAAgC,MAAM;AAAA,EACzC;AAAA,EACT,YAAYC,GAAoCF,IAAU,6BAA6B;AACtF,UAAMA,CAAO,GACb,KAAK,OAAO,2BACZ,KAAK,iBAAiBE;AAAA,EACvB;AACD;AAQO,MAAMC,UAA4B,MAAM;AAAA,EACrC;AAAA,EACT,YAAYH,GAAiBI,GAAqB;AACjD,UAAMJ,CAAO,GACb,KAAK,OAAO,uBACZ,KAAK,WAAWI;AAAA,EACjB;AACD;AAGO,MAAMC,UAAuB,MAAM;AAAA,EACzC,YAAYL,IAAU,qBAAqB;AAC1C,UAAMA,CAAO,GACb,KAAK,OAAO;AAAA,EACb;AACD;AAiNO,MAAMM,UAA0B,MAAM;AAAA,EAC5C,YAAYN,GAAiB;AAC5B,UAAMA,CAAO,GACb,KAAK,OAAO;AAAA,EACb;AACD;AAuBO,MAAMO,IAAmB;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -529,6 +529,7 @@ export declare const i18nResources: {
|
|
|
529
529
|
fields: string;
|
|
530
530
|
versions: string;
|
|
531
531
|
output: string;
|
|
532
|
+
test: string;
|
|
532
533
|
};
|
|
533
534
|
reasonsHere: string;
|
|
534
535
|
tree: {
|
|
@@ -650,6 +651,10 @@ export declare const i18nResources: {
|
|
|
650
651
|
title: string;
|
|
651
652
|
displayNameTemplate: string;
|
|
652
653
|
displayNameTemplateHelp: string;
|
|
654
|
+
displayNameField: string;
|
|
655
|
+
displayNameFieldHelp: string;
|
|
656
|
+
displayNameFieldNone: string;
|
|
657
|
+
displayNameFieldPathHelp: string;
|
|
653
658
|
collections: string;
|
|
654
659
|
collectionsHelp: string;
|
|
655
660
|
};
|
|
@@ -711,6 +716,44 @@ export declare const i18nResources: {
|
|
|
711
716
|
folderPathSelector: string;
|
|
712
717
|
folderPathSelectorHelp: string;
|
|
713
718
|
};
|
|
719
|
+
test: {
|
|
720
|
+
title: string;
|
|
721
|
+
about: string;
|
|
722
|
+
aboutDerived: string;
|
|
723
|
+
adminOnly: string;
|
|
724
|
+
sampleCard: string;
|
|
725
|
+
sampleHelp: string;
|
|
726
|
+
dropHint: string;
|
|
727
|
+
dragActive: string;
|
|
728
|
+
chooseFile: string;
|
|
729
|
+
chosen: string;
|
|
730
|
+
notXml: string;
|
|
731
|
+
entitySet: string;
|
|
732
|
+
entitySetHelp: string;
|
|
733
|
+
noEntitySet: string;
|
|
734
|
+
run: string;
|
|
735
|
+
failed: string;
|
|
736
|
+
summary_one: string;
|
|
737
|
+
summary_other: string;
|
|
738
|
+
noElements: string;
|
|
739
|
+
onlyProblems: string;
|
|
740
|
+
element: string;
|
|
741
|
+
noSourceKey: string;
|
|
742
|
+
field: string;
|
|
743
|
+
value: string;
|
|
744
|
+
problem: string;
|
|
745
|
+
wholeElement: string;
|
|
746
|
+
validityPeriod: string;
|
|
747
|
+
validFromTo: string;
|
|
748
|
+
open: string;
|
|
749
|
+
displayName: string;
|
|
750
|
+
collections: string;
|
|
751
|
+
releaseSpec: string;
|
|
752
|
+
showMore: string;
|
|
753
|
+
shownOf: string;
|
|
754
|
+
problemCount_one: string;
|
|
755
|
+
problemCount_other: string;
|
|
756
|
+
};
|
|
714
757
|
};
|
|
715
758
|
imports: {
|
|
716
759
|
start: string;
|
|
@@ -1100,6 +1143,7 @@ export declare const i18nResources: {
|
|
|
1100
1143
|
fields: string;
|
|
1101
1144
|
versions: string;
|
|
1102
1145
|
output: string;
|
|
1146
|
+
test: string;
|
|
1103
1147
|
};
|
|
1104
1148
|
reasonsHere: string;
|
|
1105
1149
|
tree: {
|
|
@@ -1221,6 +1265,10 @@ export declare const i18nResources: {
|
|
|
1221
1265
|
title: string;
|
|
1222
1266
|
displayNameTemplate: string;
|
|
1223
1267
|
displayNameTemplateHelp: string;
|
|
1268
|
+
displayNameField: string;
|
|
1269
|
+
displayNameFieldHelp: string;
|
|
1270
|
+
displayNameFieldNone: string;
|
|
1271
|
+
displayNameFieldPathHelp: string;
|
|
1224
1272
|
collections: string;
|
|
1225
1273
|
collectionsHelp: string;
|
|
1226
1274
|
};
|
|
@@ -1282,6 +1330,44 @@ export declare const i18nResources: {
|
|
|
1282
1330
|
folderPathSelector: string;
|
|
1283
1331
|
folderPathSelectorHelp: string;
|
|
1284
1332
|
};
|
|
1333
|
+
test: {
|
|
1334
|
+
title: string;
|
|
1335
|
+
about: string;
|
|
1336
|
+
aboutDerived: string;
|
|
1337
|
+
adminOnly: string;
|
|
1338
|
+
sampleCard: string;
|
|
1339
|
+
sampleHelp: string;
|
|
1340
|
+
dropHint: string;
|
|
1341
|
+
dragActive: string;
|
|
1342
|
+
chooseFile: string;
|
|
1343
|
+
chosen: string;
|
|
1344
|
+
notXml: string;
|
|
1345
|
+
entitySet: string;
|
|
1346
|
+
entitySetHelp: string;
|
|
1347
|
+
noEntitySet: string;
|
|
1348
|
+
run: string;
|
|
1349
|
+
failed: string;
|
|
1350
|
+
summary_one: string;
|
|
1351
|
+
summary_other: string;
|
|
1352
|
+
noElements: string;
|
|
1353
|
+
onlyProblems: string;
|
|
1354
|
+
element: string;
|
|
1355
|
+
noSourceKey: string;
|
|
1356
|
+
field: string;
|
|
1357
|
+
value: string;
|
|
1358
|
+
problem: string;
|
|
1359
|
+
wholeElement: string;
|
|
1360
|
+
validityPeriod: string;
|
|
1361
|
+
validFromTo: string;
|
|
1362
|
+
open: string;
|
|
1363
|
+
displayName: string;
|
|
1364
|
+
collections: string;
|
|
1365
|
+
releaseSpec: string;
|
|
1366
|
+
showMore: string;
|
|
1367
|
+
shownOf: string;
|
|
1368
|
+
problemCount_one: string;
|
|
1369
|
+
problemCount_other: string;
|
|
1370
|
+
};
|
|
1285
1371
|
};
|
|
1286
1372
|
imports: {
|
|
1287
1373
|
start: string;
|
|
@@ -1607,6 +1693,14 @@ export declare interface ImporthubClient {
|
|
|
1607
1693
|
listMappingImportProfiles(id: string): Promise<ImportProfileRef[]>;
|
|
1608
1694
|
/** Checks moving the draft to another Blueprint Release, saving nothing. */
|
|
1609
1695
|
checkMappingBlueprintRelease(id: string, blueprintReleaseId: string): Promise<BlueprintReleaseCheck>;
|
|
1696
|
+
/**
|
|
1697
|
+
* Runs a Mapping Test: the content given over the sample, read as an
|
|
1698
|
+
* Import reads a Source File. Stores nothing and touches nothing outside
|
|
1699
|
+
* importhub (test-a-mapping-on-a-sample-file:AC4). Throws with importhub's
|
|
1700
|
+
* reason when the test cannot run at all: a sample that is not XML, an
|
|
1701
|
+
* element selector or Source Key xmlmapper cannot evaluate.
|
|
1702
|
+
*/
|
|
1703
|
+
runMappingTest(input: MappingTestInput): Promise<MappingTestResult>;
|
|
1610
1704
|
/** Every Entity Set of the workspace, by name. */
|
|
1611
1705
|
listEntitySets(): Promise<EntitySet[]>;
|
|
1612
1706
|
getEntitySet(id: string): Promise<EntitySet>;
|
|
@@ -1961,6 +2055,11 @@ export declare interface MappingContent {
|
|
|
1961
2055
|
};
|
|
1962
2056
|
collections?: string[];
|
|
1963
2057
|
displayNameTemplate?: string;
|
|
2058
|
+
/**
|
|
2059
|
+
* The plain-text field of the pinned Release the display name is written
|
|
2060
|
+
* into; set with displayNameTemplate, or neither.
|
|
2061
|
+
*/
|
|
2062
|
+
displayNameField?: string;
|
|
1964
2063
|
placeholderAssets?: Array<{
|
|
1965
2064
|
selector?: string;
|
|
1966
2065
|
assetType?: string;
|
|
@@ -2006,6 +2105,68 @@ export declare interface MappingsIndexProps {
|
|
|
2006
2105
|
onOpen: (id: string) => void;
|
|
2007
2106
|
}
|
|
2008
2107
|
|
|
2108
|
+
/** One element a Mapping Test matched, as an Import would read it. */
|
|
2109
|
+
export declare interface MappingTestElement {
|
|
2110
|
+
/** Its position among the elements matched, from 1. */
|
|
2111
|
+
position: number;
|
|
2112
|
+
/** Its Source Key, verbatim; "" when it has none. */
|
|
2113
|
+
sourceKey: string;
|
|
2114
|
+
/** Its mapped values by field accessor; a field that cannot be mapped is left out. */
|
|
2115
|
+
values: Record<string, unknown>;
|
|
2116
|
+
/** The Validity Period the sample gives, as YYYY-MM-DD; "" for none. */
|
|
2117
|
+
firstDay: string;
|
|
2118
|
+
lastDay: string;
|
|
2119
|
+
/** The Release Spec values the sample gives, by field. */
|
|
2120
|
+
releaseSpec: Record<string, unknown>;
|
|
2121
|
+
/** What the display-name template makes; "" without one. */
|
|
2122
|
+
displayName: string;
|
|
2123
|
+
/** The Collections it would be filed into, by name. */
|
|
2124
|
+
collections: string[];
|
|
2125
|
+
/** Each field that cannot be mapped, and what an Import would report; none when clean. */
|
|
2126
|
+
problems: MappingTestProblem[];
|
|
2127
|
+
}
|
|
2128
|
+
|
|
2129
|
+
/**
|
|
2130
|
+
* What a Mapping Test runs (test-a-mapping-on-a-sample-file:AC1): a
|
|
2131
|
+
* Mapping's content as the editor holds it, saved or not, over a sample file.
|
|
2132
|
+
*/
|
|
2133
|
+
export declare interface MappingTestInput {
|
|
2134
|
+
content: MappingContent;
|
|
2135
|
+
/** The sample file, an XML file, sent whole. */
|
|
2136
|
+
sample: Uint8Array;
|
|
2137
|
+
/**
|
|
2138
|
+
* An Entity Set of the workspace whose draft's entities the sample uses;
|
|
2139
|
+
* "" or unset for none.
|
|
2140
|
+
*/
|
|
2141
|
+
entitySetId?: string;
|
|
2142
|
+
}
|
|
2143
|
+
|
|
2144
|
+
/** One problem of an element in a Mapping Test (importhub.v1.MappingTestProblem). */
|
|
2145
|
+
export declare interface MappingTestProblem {
|
|
2146
|
+
/**
|
|
2147
|
+
* A field path, `.`-joined into fieldsets and virtual tables, or the
|
|
2148
|
+
* Mapping's setting that reads it (`display_name_template`, say); "" for
|
|
2149
|
+
* the element as a whole, such as an element without a Source Key.
|
|
2150
|
+
*/
|
|
2151
|
+
field: string;
|
|
2152
|
+
/** Why, for a person: xmlmapper's message for a field that cannot be mapped. */
|
|
2153
|
+
reason: string;
|
|
2154
|
+
}
|
|
2155
|
+
|
|
2156
|
+
/**
|
|
2157
|
+
* A Mapping Test that could not run at all: the sample is not XML, the
|
|
2158
|
+
* element selector or Source Key cannot be evaluated, or the Entity Set named
|
|
2159
|
+
* is unknown. Its message is importhub's, which names xmlmapper's reason.
|
|
2160
|
+
*/
|
|
2161
|
+
export declare class MappingTestRefusedError extends Error {
|
|
2162
|
+
constructor(message: string);
|
|
2163
|
+
}
|
|
2164
|
+
|
|
2165
|
+
/** What a Mapping Test answers: every element the element selector matched. */
|
|
2166
|
+
export declare interface MappingTestResult {
|
|
2167
|
+
elements: MappingTestElement[];
|
|
2168
|
+
}
|
|
2169
|
+
|
|
2009
2170
|
/** A create or rename refused: another configuration of the kind has the name. */
|
|
2010
2171
|
export declare class NameTakenError extends Error {
|
|
2011
2172
|
constructor(message?: string);
|