@knkcs/importhub-ui 0.3.0 → 0.5.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 +11 -3
- package/dist/importhub-client-fCWgKH03.js +29 -0
- package/dist/importhub-client-fCWgKH03.js.map +1 -0
- package/dist/index.d.ts +940 -13
- package/dist/index.js +1451 -1725
- package/dist/index.js.map +1 -1
- package/dist/mapping-editor.d.ts +497 -0
- package/dist/mapping-editor.js +1149 -0
- package/dist/mapping-editor.js.map +1 -0
- package/dist/mapping-page-D92XwUq5.js +1074 -0
- package/dist/mapping-page-D92XwUq5.js.map +1 -0
- package/dist/testing.d.ts +298 -6
- package/dist/testing.js +590 -214
- package/dist/testing.js.map +1 -1
- package/package.json +5 -1
- package/dist/importhub-client-CrS-3Zuu.js +0 -23
- package/dist/importhub-client-CrS-3Zuu.js.map +0 -1
package/dist/testing.js
CHANGED
|
@@ -1,41 +1,69 @@
|
|
|
1
|
-
import { createHostMembers as
|
|
2
|
-
import { R as
|
|
3
|
-
const
|
|
4
|
-
function
|
|
1
|
+
import { createHostMembers as he } from "@knkcs/anker/host";
|
|
2
|
+
import { S as k, R as Y, C as ce, N as be } from "./importhub-client-fCWgKH03.js";
|
|
3
|
+
const _ = "user_stub_ada", ee = "user_stub_grace", te = "ws_stub_main", Me = "ws_stub_other";
|
|
4
|
+
function ke(r = te) {
|
|
5
5
|
return {
|
|
6
|
-
userId:
|
|
6
|
+
userId: _,
|
|
7
7
|
workspaceId: r,
|
|
8
|
-
members:
|
|
9
|
-
{ userId:
|
|
8
|
+
members: he([
|
|
9
|
+
{ userId: _, displayName: "Ada Importer", email: "ada@example.com" },
|
|
10
|
+
{ userId: ee, displayName: "Grace Hopper", email: "grace@example.com" }
|
|
10
11
|
])
|
|
11
12
|
};
|
|
12
13
|
}
|
|
13
|
-
|
|
14
|
+
const b = (r, c, l, u = []) => ({
|
|
15
|
+
accessor: r.split(".").pop() ?? r,
|
|
16
|
+
path: r,
|
|
17
|
+
fieldType: c,
|
|
18
|
+
label: l,
|
|
19
|
+
children: u
|
|
20
|
+
}), K = (r) => r.flatMap((c) => [c.path, ...K(c.children)]), le = (r) => [
|
|
21
|
+
b("titel", "text", "Titel"),
|
|
22
|
+
b("abkuerzung", "text", "Abkürzung"),
|
|
23
|
+
...r ? [b("fussnote", "rich_text", "Fußnote")] : [],
|
|
24
|
+
b("stand", "fieldset", "Stand", [
|
|
25
|
+
b("stand.datum", "date", "Datum"),
|
|
26
|
+
b("stand.art", "select", "Art")
|
|
27
|
+
])
|
|
28
|
+
], pe = () => [
|
|
29
|
+
b("fundstelle", "text", "Fundstelle"),
|
|
30
|
+
b("ausgabedatum", "date", "Ausgabedatum")
|
|
31
|
+
];
|
|
32
|
+
function ue() {
|
|
33
|
+
const r = le(!1), c = le(!0), l = [
|
|
34
|
+
b("aktenzeichen", "text", "Aktenzeichen"),
|
|
35
|
+
b("datum", "date", "Datum")
|
|
36
|
+
];
|
|
14
37
|
return [
|
|
15
38
|
{
|
|
16
39
|
id: "br_stub_gesetz_2",
|
|
17
40
|
blueprintId: "bp_stub_gesetz",
|
|
18
41
|
blueprintName: "Gesetz",
|
|
19
42
|
label: "Release 2",
|
|
20
|
-
fieldPaths:
|
|
43
|
+
fieldPaths: K(r),
|
|
44
|
+
fields: r,
|
|
45
|
+
releaseSpecFields: pe()
|
|
21
46
|
},
|
|
22
47
|
{
|
|
23
48
|
id: "br_stub_gesetz_1",
|
|
24
49
|
blueprintId: "bp_stub_gesetz",
|
|
25
50
|
blueprintName: "Gesetz",
|
|
26
51
|
label: "Release 1",
|
|
27
|
-
fieldPaths:
|
|
52
|
+
fieldPaths: K(c),
|
|
53
|
+
fields: c,
|
|
54
|
+
releaseSpecFields: pe()
|
|
28
55
|
},
|
|
29
56
|
{
|
|
30
57
|
id: "br_stub_entscheidung_1",
|
|
31
58
|
blueprintId: "bp_stub_entscheidung",
|
|
32
59
|
blueprintName: "Entscheidung",
|
|
33
60
|
label: "Release 1",
|
|
34
|
-
fieldPaths:
|
|
61
|
+
fieldPaths: K(l),
|
|
62
|
+
fields: l
|
|
35
63
|
}
|
|
36
64
|
];
|
|
37
65
|
}
|
|
38
|
-
function
|
|
66
|
+
function _e() {
|
|
39
67
|
return [
|
|
40
68
|
{
|
|
41
69
|
id: "mp_stub_norm",
|
|
@@ -67,7 +95,7 @@ function ee() {
|
|
|
67
95
|
}
|
|
68
96
|
];
|
|
69
97
|
}
|
|
70
|
-
function
|
|
98
|
+
function Ie() {
|
|
71
99
|
return [
|
|
72
100
|
{
|
|
73
101
|
id: "es_stub_latin1",
|
|
@@ -80,7 +108,7 @@ function te() {
|
|
|
80
108
|
}
|
|
81
109
|
];
|
|
82
110
|
}
|
|
83
|
-
function
|
|
111
|
+
function ye() {
|
|
84
112
|
return [
|
|
85
113
|
{
|
|
86
114
|
id: "ip_stub_gesetz",
|
|
@@ -111,12 +139,12 @@ function se() {
|
|
|
111
139
|
}
|
|
112
140
|
];
|
|
113
141
|
}
|
|
114
|
-
const
|
|
142
|
+
const Q = (r, c, l, u = "") => ({
|
|
115
143
|
field_type: "text",
|
|
116
|
-
config: { name:
|
|
144
|
+
config: { name: c, api_accessor: r, required: l, instructions: u },
|
|
117
145
|
system: !1
|
|
118
146
|
});
|
|
119
|
-
function
|
|
147
|
+
function Se() {
|
|
120
148
|
return [
|
|
121
149
|
{
|
|
122
150
|
name: "citation-links",
|
|
@@ -138,8 +166,8 @@ function ne() {
|
|
|
138
166
|
target: "source_file",
|
|
139
167
|
description: "Renames every element of one name to another.",
|
|
140
168
|
settingsSpec: [
|
|
141
|
-
|
|
142
|
-
|
|
169
|
+
Q("from", "Element", !0, "The element's name now."),
|
|
170
|
+
Q("to", "New name", !0)
|
|
143
171
|
]
|
|
144
172
|
},
|
|
145
173
|
{
|
|
@@ -147,11 +175,153 @@ function ne() {
|
|
|
147
175
|
kind: "preprocessor",
|
|
148
176
|
target: "source_file",
|
|
149
177
|
description: "Wraps each sentence of an element in its own element.",
|
|
150
|
-
settingsSpec: [
|
|
178
|
+
settingsSpec: [Q("element", "Element", !1)]
|
|
179
|
+
}
|
|
180
|
+
];
|
|
181
|
+
}
|
|
182
|
+
const $ = (r = {}) => ({
|
|
183
|
+
matched: 0,
|
|
184
|
+
created: 0,
|
|
185
|
+
problems: 0,
|
|
186
|
+
planned: 0,
|
|
187
|
+
corrected: 0,
|
|
188
|
+
kept: 0,
|
|
189
|
+
unchanged: 0,
|
|
190
|
+
...r
|
|
191
|
+
}), P = (r) => ({
|
|
192
|
+
importProfile: {
|
|
193
|
+
configurationId: "ip_stub_gesetz",
|
|
194
|
+
name: "Boorberg gesetz",
|
|
195
|
+
releaseId: `ip_stub_gesetz_rel${r}`,
|
|
196
|
+
number: r
|
|
197
|
+
},
|
|
198
|
+
mappings: [
|
|
199
|
+
{
|
|
200
|
+
configurationId: "mp_stub_norm",
|
|
201
|
+
name: "Gesetz norms",
|
|
202
|
+
releaseId: "mp_stub_norm_rel1",
|
|
203
|
+
number: 1
|
|
151
204
|
}
|
|
205
|
+
],
|
|
206
|
+
entitySet: {
|
|
207
|
+
configurationId: "es_stub_latin1",
|
|
208
|
+
name: "ISO Latin 1",
|
|
209
|
+
releaseId: "es_stub_latin1_rel1",
|
|
210
|
+
number: 1
|
|
211
|
+
}
|
|
212
|
+
}), T = (r) => ({
|
|
213
|
+
importProfileId: "ip_stub_gesetz",
|
|
214
|
+
importProfileName: "Boorberg gesetz",
|
|
215
|
+
sourceFileId: `sf_${r.id}`,
|
|
216
|
+
startedBy: _,
|
|
217
|
+
phase: "ended",
|
|
218
|
+
failureReason: "",
|
|
219
|
+
progress: { done: 0, total: 0 },
|
|
220
|
+
counts: $(),
|
|
221
|
+
changeSetId: "",
|
|
222
|
+
releases: P(2),
|
|
223
|
+
createTime: "2026-11-03T09:00:00.000Z",
|
|
224
|
+
startTime: "",
|
|
225
|
+
endTime: "",
|
|
226
|
+
cancelledBy: "",
|
|
227
|
+
effectiveDate: "",
|
|
228
|
+
...r
|
|
229
|
+
}), B = (r, c, l, u, h) => ({
|
|
230
|
+
id: `prob_stub_${r}`,
|
|
231
|
+
mappingId: c === "norm" ? "mp_stub_norm" : "mp_stub_title",
|
|
232
|
+
mappingName: c === "norm" ? "Gesetz norms" : "Gesetz titles",
|
|
233
|
+
sourceKey: l,
|
|
234
|
+
field: u,
|
|
235
|
+
reason: h
|
|
236
|
+
});
|
|
237
|
+
function Pe() {
|
|
238
|
+
return [
|
|
239
|
+
T({
|
|
240
|
+
id: "im_stub_running",
|
|
241
|
+
phase: "writing",
|
|
242
|
+
progress: { done: 48, total: 120 },
|
|
243
|
+
counts: $({ matched: 120, created: 40, planned: 8 }),
|
|
244
|
+
changeSetId: "cs_stub_running",
|
|
245
|
+
createTime: "2026-11-04T10:00:00.000Z",
|
|
246
|
+
startTime: "2026-11-04T10:00:05.000Z"
|
|
247
|
+
}),
|
|
248
|
+
T({
|
|
249
|
+
id: "im_stub_queued",
|
|
250
|
+
phase: "queued",
|
|
251
|
+
startedBy: ee,
|
|
252
|
+
releases: P(2),
|
|
253
|
+
createTime: "2026-11-04T10:05:00.000Z"
|
|
254
|
+
}),
|
|
255
|
+
T({
|
|
256
|
+
id: "im_stub_problems",
|
|
257
|
+
outcome: "succeeded_with_problems",
|
|
258
|
+
counts: $({
|
|
259
|
+
matched: 212,
|
|
260
|
+
created: 180,
|
|
261
|
+
planned: 20,
|
|
262
|
+
corrected: 6,
|
|
263
|
+
kept: 1,
|
|
264
|
+
problems: 5
|
|
265
|
+
}),
|
|
266
|
+
changeSetId: "cs_stub_problems",
|
|
267
|
+
releases: {
|
|
268
|
+
...P(2),
|
|
269
|
+
mappings: [
|
|
270
|
+
...P(2).mappings,
|
|
271
|
+
{
|
|
272
|
+
configurationId: "mp_stub_title",
|
|
273
|
+
name: "Gesetz titles",
|
|
274
|
+
releaseId: "mp_stub_title_rel3",
|
|
275
|
+
number: 3
|
|
276
|
+
}
|
|
277
|
+
]
|
|
278
|
+
},
|
|
279
|
+
createTime: "2026-11-03T09:00:00.000Z",
|
|
280
|
+
startTime: "2026-11-03T09:00:02.000Z",
|
|
281
|
+
endTime: "2026-11-03T09:12:40.000Z",
|
|
282
|
+
effectiveDate: "2026-10-01",
|
|
283
|
+
source: { date: "2026-09-20", reference: "BGBl. 2026 I Nr. 270" },
|
|
284
|
+
itemProblems: [
|
|
285
|
+
B(1, "norm", "BJNR000010001", "stand/datum", "“31.02.2026” is not a date."),
|
|
286
|
+
B(2, "norm", "BJNR000010002", "", "The Version Match found two Releases."),
|
|
287
|
+
B(3, "title", "BJNR000020001", "", "No Title has the Ausgabe code BY-7."),
|
|
288
|
+
B(4, "norm", "BJNR000030001", "titel", "The field is required."),
|
|
289
|
+
B(5, "title", "BJNR000030002", "", "No Title has the Ausgabe code BY-9.")
|
|
290
|
+
]
|
|
291
|
+
}),
|
|
292
|
+
T({
|
|
293
|
+
id: "im_stub_succeeded",
|
|
294
|
+
outcome: "succeeded",
|
|
295
|
+
counts: $({ matched: 64, created: 64 }),
|
|
296
|
+
changeSetId: "cs_stub_succeeded",
|
|
297
|
+
releases: P(1),
|
|
298
|
+
createTime: "2026-11-02T14:00:00.000Z",
|
|
299
|
+
startTime: "2026-11-02T14:00:01.000Z",
|
|
300
|
+
endTime: "2026-11-02T14:03:10.000Z"
|
|
301
|
+
}),
|
|
302
|
+
T({
|
|
303
|
+
id: "im_stub_failed",
|
|
304
|
+
outcome: "failed",
|
|
305
|
+
failureReason: "The worker crashed three times running this Import.",
|
|
306
|
+
counts: $({ matched: 30 }),
|
|
307
|
+
releases: P(1),
|
|
308
|
+
createTime: "2026-11-02T11:00:00.000Z",
|
|
309
|
+
startTime: "2026-11-02T11:00:01.000Z",
|
|
310
|
+
endTime: "2026-11-02T11:20:00.000Z"
|
|
311
|
+
}),
|
|
312
|
+
T({
|
|
313
|
+
id: "im_stub_cancelled",
|
|
314
|
+
outcome: "cancelled",
|
|
315
|
+
cancelledBy: ee,
|
|
316
|
+
counts: $({ matched: 12, created: 3 }),
|
|
317
|
+
releases: P(1),
|
|
318
|
+
createTime: "2026-11-01T16:00:00.000Z",
|
|
319
|
+
startTime: "2026-11-01T16:00:01.000Z",
|
|
320
|
+
endTime: "2026-11-01T16:01:00.000Z"
|
|
321
|
+
})
|
|
152
322
|
];
|
|
153
323
|
}
|
|
154
|
-
const
|
|
324
|
+
const we = [
|
|
155
325
|
"listImportProfiles",
|
|
156
326
|
"getImportProfile",
|
|
157
327
|
"createImportProfile",
|
|
@@ -173,82 +343,90 @@ const ie = [
|
|
|
173
343
|
"cutRelease",
|
|
174
344
|
"listHistory",
|
|
175
345
|
"compareRevisions",
|
|
176
|
-
"restoreRevision"
|
|
346
|
+
"restoreRevision",
|
|
347
|
+
"uploadSourceFile",
|
|
348
|
+
"startImport",
|
|
349
|
+
"listImports",
|
|
350
|
+
"getImport",
|
|
351
|
+
"cancelImport",
|
|
352
|
+
"listItemProblems"
|
|
177
353
|
];
|
|
178
|
-
let
|
|
179
|
-
const
|
|
180
|
-
const
|
|
181
|
-
id: `${
|
|
182
|
-
content: structuredClone(
|
|
183
|
-
savedBy:
|
|
184
|
-
savedAt:
|
|
354
|
+
let de = Date.parse("2026-11-02T08:00:00Z");
|
|
355
|
+
const w = () => (de += 36e5, new Date(de).toISOString()), X = (r = []) => r.map((c) => {
|
|
356
|
+
const l = Math.max(c.releaseNumber ?? 0, 1), u = Array.from({ length: l }, (I, p) => ({
|
|
357
|
+
id: `${c.id}_r${p + 1}`,
|
|
358
|
+
content: structuredClone(c.content),
|
|
359
|
+
savedBy: _,
|
|
360
|
+
savedAt: w(),
|
|
185
361
|
restoredFromRevisionId: ""
|
|
186
|
-
})),
|
|
187
|
-
id: `${
|
|
188
|
-
number:
|
|
189
|
-
revisionId: `${
|
|
190
|
-
releasedBy:
|
|
191
|
-
releasedAt:
|
|
362
|
+
})), h = Array.from({ length: c.releaseNumber ?? 0 }, (I, p) => ({
|
|
363
|
+
id: `${c.id}_rel${p + 1}`,
|
|
364
|
+
number: p + 1,
|
|
365
|
+
revisionId: `${c.id}_r${p + 1}`,
|
|
366
|
+
releasedBy: _,
|
|
367
|
+
releasedAt: w()
|
|
192
368
|
}));
|
|
193
|
-
return { id:
|
|
194
|
-
}),
|
|
195
|
-
const
|
|
369
|
+
return { id: c.id, content: structuredClone(c.content), revisions: u, releases: h };
|
|
370
|
+
}), N = (r) => r.revisions[r.revisions.length - 1], fe = (r) => r.releases[r.releases.length - 1], D = (r) => {
|
|
371
|
+
const c = fe(r), l = r.revisions.find((u) => u.id === c?.revisionId);
|
|
196
372
|
return {
|
|
197
|
-
draftRevisionId:
|
|
373
|
+
draftRevisionId: N(r).id,
|
|
198
374
|
// By content, as importhub compares: a draft that restored the
|
|
199
375
|
// released content does not differ.
|
|
200
|
-
draftDiffersFromRelease: !
|
|
201
|
-
...
|
|
376
|
+
draftDiffersFromRelease: !l || JSON.stringify(l.content) !== JSON.stringify(N(r).content),
|
|
377
|
+
...c ? { latestRelease: { id: c.id, number: c.number } } : {}
|
|
202
378
|
};
|
|
203
|
-
},
|
|
204
|
-
Object.entries(r).map(([
|
|
205
|
-
),
|
|
379
|
+
}, ve = (r) => r.replace(/[A-Z]/g, (c) => `_${c.toLowerCase()}`), me = (r) => Object.fromEntries(
|
|
380
|
+
Object.entries(r).map(([c, l]) => [ve(c), l])
|
|
381
|
+
), R = (r) => ({
|
|
206
382
|
valid: r.length === 0,
|
|
207
383
|
reasons: r
|
|
208
|
-
}),
|
|
209
|
-
let
|
|
210
|
-
function
|
|
211
|
-
const
|
|
384
|
+
}), j = (r) => [...r].sort((c, l) => c.content.name.localeCompare(l.content.name));
|
|
385
|
+
let Te = 0;
|
|
386
|
+
function Be(r = {}) {
|
|
387
|
+
const c = Object.fromEntries(
|
|
212
388
|
Object.entries(
|
|
213
389
|
r.workspaces ?? {
|
|
214
|
-
[
|
|
215
|
-
importProfiles:
|
|
216
|
-
mappings:
|
|
217
|
-
entitySets:
|
|
390
|
+
[te]: {
|
|
391
|
+
importProfiles: ye(),
|
|
392
|
+
mappings: _e(),
|
|
393
|
+
entitySets: Ie(),
|
|
394
|
+
imports: Pe()
|
|
218
395
|
}
|
|
219
396
|
}
|
|
220
397
|
).map(([e, t]) => [
|
|
221
398
|
e,
|
|
222
399
|
{
|
|
223
|
-
importProfiles:
|
|
224
|
-
mappings:
|
|
225
|
-
entitySets:
|
|
400
|
+
importProfiles: X(t.importProfiles),
|
|
401
|
+
mappings: X(t.mappings),
|
|
402
|
+
entitySets: X(t.entitySets),
|
|
403
|
+
imports: structuredClone(t.imports ?? [])
|
|
226
404
|
}
|
|
227
405
|
])
|
|
228
|
-
),
|
|
229
|
-
let
|
|
230
|
-
const
|
|
231
|
-
if (
|
|
406
|
+
), l = r.processors ?? Se(), u = r.blueprintReleases ?? ue();
|
|
407
|
+
let h = r.activeWorkspaceId ?? te;
|
|
408
|
+
const I = Object.fromEntries(we.map((e) => [e, 0])), p = () => (c[h] ??= { importProfiles: [], mappings: [], entitySets: [], imports: [] }, c[h]), f = async (e, t) => {
|
|
409
|
+
if (I[e]++, r.fail) throw r.fail;
|
|
232
410
|
return structuredClone(t());
|
|
233
|
-
},
|
|
234
|
-
const n = e.find((
|
|
411
|
+
}, g = (e, t, s) => {
|
|
412
|
+
const n = e.find((a) => a.id === t);
|
|
235
413
|
if (!n) throw new Error(`${s} ${t} not found`);
|
|
236
414
|
return n;
|
|
237
|
-
},
|
|
415
|
+
}, v = (e, t, s) => {
|
|
238
416
|
if (!t.trim()) throw new Error("a name is required");
|
|
239
|
-
if (e.some((n) => n.id !== s && n.content.name === t)) throw new
|
|
240
|
-
},
|
|
241
|
-
if (
|
|
417
|
+
if (e.some((n) => n.id !== s && n.content.name === t)) throw new be();
|
|
418
|
+
}, ne = (e, t) => t !== "" && t !== N(e).id, O = (e, t, s, n = "") => {
|
|
419
|
+
if (ne(e, s))
|
|
242
420
|
throw new Error("the draft moved: somebody saved in between");
|
|
243
421
|
e.content = structuredClone(t), e.revisions.push({
|
|
244
422
|
id: `${e.id}_r${e.revisions.length + 1}`,
|
|
245
423
|
content: structuredClone(t),
|
|
246
|
-
savedBy:
|
|
247
|
-
savedAt:
|
|
424
|
+
savedBy: _,
|
|
425
|
+
savedAt: w(),
|
|
248
426
|
restoredFromRevisionId: n
|
|
249
427
|
});
|
|
250
|
-
},
|
|
251
|
-
const s =
|
|
428
|
+
}, q = (e, t) => {
|
|
429
|
+
const s = H(e);
|
|
252
430
|
return {
|
|
253
431
|
id: s,
|
|
254
432
|
content: structuredClone(t),
|
|
@@ -256,17 +434,17 @@ function de(r = {}) {
|
|
|
256
434
|
{
|
|
257
435
|
id: `${s}_r1`,
|
|
258
436
|
content: structuredClone(t),
|
|
259
|
-
savedBy:
|
|
260
|
-
savedAt:
|
|
437
|
+
savedBy: _,
|
|
438
|
+
savedAt: w(),
|
|
261
439
|
restoredFromRevisionId: ""
|
|
262
440
|
}
|
|
263
441
|
],
|
|
264
442
|
releases: []
|
|
265
443
|
};
|
|
266
444
|
};
|
|
267
|
-
function
|
|
268
|
-
const t = [], s =
|
|
269
|
-
|
|
445
|
+
function G(e) {
|
|
446
|
+
const t = [], s = u.find((o) => o.id === e.blueprintReleaseId);
|
|
447
|
+
e.blueprintReleaseId ? s ? s.blueprintId !== e.blueprintId && t.push({
|
|
270
448
|
path: "/blueprintReleaseId",
|
|
271
449
|
code: "release_of_other_blueprint",
|
|
272
450
|
message: "The pinned Release is of another Blueprint."
|
|
@@ -282,55 +460,86 @@ function de(r = {}) {
|
|
|
282
460
|
path: "/elementSelector",
|
|
283
461
|
code: "no_element_selector",
|
|
284
462
|
message: "It has no element selector."
|
|
285
|
-
}), !e.sourceKey?.selector && !e.sourceKey?.template && t.push({ path: "/sourceKey", code: "no_source_key", message: "It has no Source Key." })
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
463
|
+
}), !e.sourceKey?.selector && !e.sourceKey?.template && t.push({ path: "/sourceKey", code: "no_source_key", message: "It has no Source Key." });
|
|
464
|
+
const n = (o, i) => {
|
|
465
|
+
typeof i == "string" && i !== "" && !Re(i) && t.push({ path: o, code: "invalid_xpath", message: `"${i}" is not an XPath.` });
|
|
466
|
+
};
|
|
467
|
+
n("/element_selector", e.elementSelector), n("/source_key/selector", e.sourceKey?.selector);
|
|
468
|
+
const a = [];
|
|
469
|
+
return (e.fields ?? []).forEach((o, i) => {
|
|
470
|
+
const m = `/fields/${i}`;
|
|
471
|
+
for (const { path: d, rel: M, mapping: S } of se(o, "", m))
|
|
472
|
+
a.push(d), n(`${M}/selector`, S.selector), s && !s.fieldPaths.includes(d) && t.push({
|
|
473
|
+
path: m,
|
|
474
|
+
code: "unknown_field_path",
|
|
475
|
+
message: `The pinned Release has no field ${d}.`
|
|
476
|
+
}), S.type === "select" && !S.selectOptions && t.push({
|
|
477
|
+
path: m,
|
|
478
|
+
code: "xmlmapper_schema",
|
|
479
|
+
message: `The select field ${d} has no select options.`
|
|
480
|
+
});
|
|
481
|
+
}), (e.versionMatch?.contentFields ?? []).forEach((o, i) => {
|
|
482
|
+
a.includes(o) || t.push({
|
|
483
|
+
path: `/version_match/content_fields/${i}`,
|
|
484
|
+
code: "unknown_version_match_field",
|
|
485
|
+
message: `The Version Match compares ${o}, which the Mapping does not map.`
|
|
486
|
+
});
|
|
487
|
+
}), (e.titleContributions ?? []).forEach((o, i) => {
|
|
488
|
+
(!o.selector || !o.ausgabeCodeSelector) && t.push({
|
|
489
|
+
path: `/title_contributions/${i}`,
|
|
490
|
+
code: "incomplete_title_contribution",
|
|
491
|
+
message: "A Title Contribution needs a selector and an Ausgabe code selector."
|
|
492
|
+
}), n(`/title_contributions/${i}/selector`, o.selector);
|
|
493
|
+
}), (e.placeholderAssets ?? []).forEach((o, i) => {
|
|
494
|
+
(!o.selector || !o.assetType || !o.keyParts?.length || !o.nameSelector) && t.push({
|
|
495
|
+
path: `/placeholder_assets/${i}`,
|
|
496
|
+
code: "incomplete_placeholder_assets",
|
|
497
|
+
message: "Placeholder Assets need a selector, an asset type, the key's parts and a name selector."
|
|
498
|
+
}), n(`/placeholder_assets/${i}/selector`, o.selector), (o.keyParts ?? []).forEach((m, d) => {
|
|
499
|
+
n(`/placeholder_assets/${i}/key_parts/${d}`, m);
|
|
291
500
|
});
|
|
292
501
|
}), t;
|
|
293
502
|
}
|
|
294
|
-
function
|
|
295
|
-
return e.flatMap((n,
|
|
296
|
-
const
|
|
297
|
-
return
|
|
503
|
+
function re(e, t, s) {
|
|
504
|
+
return e.flatMap((n, a) => {
|
|
505
|
+
const o = `/${t}/${a}`, i = l.find((d) => d.name === n.processor);
|
|
506
|
+
return i ? i.target !== "source_file" ? [
|
|
298
507
|
{
|
|
299
|
-
path:
|
|
508
|
+
path: o,
|
|
300
509
|
code: "rich_text_processor",
|
|
301
|
-
message: `${
|
|
510
|
+
message: `${i.name} is configured on a rich-text field, not on a Profile.`
|
|
302
511
|
}
|
|
303
|
-
] :
|
|
512
|
+
] : i.kind !== s ? [{ path: o, code: "wrong_processor_kind", message: `${i.name} does not run here.` }] : i.settingsSpec.filter(
|
|
304
513
|
(d) => d.config.required && (n.settings[d.config.api_accessor] ?? "") === ""
|
|
305
514
|
).map((d) => ({
|
|
306
|
-
path: `${
|
|
515
|
+
path: `${o}/settings/${d.config.api_accessor}`,
|
|
307
516
|
code: "invalid_processor_settings",
|
|
308
|
-
message: `${
|
|
517
|
+
message: `${i.name}: ${d.config.api_accessor} is required.`
|
|
309
518
|
})) : [
|
|
310
|
-
{ path:
|
|
519
|
+
{ path: o, code: "unknown_processor", message: `No Processor is called ${n.processor}.` }
|
|
311
520
|
];
|
|
312
521
|
});
|
|
313
522
|
}
|
|
314
|
-
function
|
|
315
|
-
const t =
|
|
316
|
-
...
|
|
317
|
-
...
|
|
523
|
+
function J(e) {
|
|
524
|
+
const t = p(), s = [
|
|
525
|
+
...re(e.preprocessors, "preprocessors", "preprocessor"),
|
|
526
|
+
...re(e.postProcessors, "postProcessors", "post_processor")
|
|
318
527
|
];
|
|
319
|
-
return e.mappingIds.length === 0 && s.push({ path: "/mappingIds", code: "no_mappings", message: "It includes no Mapping." }), e.mappingIds.forEach((n,
|
|
320
|
-
const
|
|
321
|
-
if (!
|
|
528
|
+
return e.mappingIds.length === 0 && s.push({ path: "/mappingIds", code: "no_mappings", message: "It includes no Mapping." }), e.mappingIds.forEach((n, a) => {
|
|
529
|
+
const o = t.mappings.find((m) => m.id === n);
|
|
530
|
+
if (!o) {
|
|
322
531
|
s.push({
|
|
323
|
-
path: `/mappingIds/${
|
|
532
|
+
path: `/mappingIds/${a}`,
|
|
324
533
|
code: "mapping_missing",
|
|
325
534
|
message: "It includes a Mapping that does not exist."
|
|
326
535
|
});
|
|
327
536
|
return;
|
|
328
537
|
}
|
|
329
|
-
const
|
|
330
|
-
|
|
331
|
-
path: `/mappingIds/${
|
|
538
|
+
const i = G(o.content);
|
|
539
|
+
i.length > 0 && s.push({
|
|
540
|
+
path: `/mappingIds/${a}`,
|
|
332
541
|
code: "mapping_invalid",
|
|
333
|
-
message: `The Mapping ${
|
|
542
|
+
message: `The Mapping ${o.content.name} is invalid: ${i.map((m) => m.message).join(" ")}`
|
|
334
543
|
});
|
|
335
544
|
}), e.entitySetId && !t.entitySets.some((n) => n.id === e.entitySetId) && s.push({
|
|
336
545
|
path: "/entitySetId",
|
|
@@ -338,201 +547,368 @@ function de(r = {}) {
|
|
|
338
547
|
message: "It names an Entity Set that does not exist."
|
|
339
548
|
}), s;
|
|
340
549
|
}
|
|
341
|
-
const
|
|
550
|
+
const oe = (e) => Object.keys(e.entities).length === 0 ? [{ path: "/entities", code: "no_entities", message: "It defines no entity." }] : [], F = (e) => ({
|
|
342
551
|
id: e.id,
|
|
343
552
|
content: e.content,
|
|
344
|
-
validity:
|
|
345
|
-
state:
|
|
346
|
-
}),
|
|
553
|
+
validity: R(J(e.content)),
|
|
554
|
+
state: D(e)
|
|
555
|
+
}), z = (e) => ({
|
|
347
556
|
id: e.id,
|
|
348
557
|
content: e.content,
|
|
349
|
-
validity:
|
|
350
|
-
state:
|
|
351
|
-
}),
|
|
558
|
+
validity: R(G(e.content)),
|
|
559
|
+
state: D(e)
|
|
560
|
+
}), C = (e) => ({
|
|
352
561
|
id: e.id,
|
|
353
562
|
content: e.content,
|
|
354
|
-
validity:
|
|
355
|
-
state:
|
|
356
|
-
}),
|
|
563
|
+
validity: R(oe(e.content)),
|
|
564
|
+
state: D(e)
|
|
565
|
+
}), A = (e) => j(p().importProfiles.filter((t) => e(t.content))).map((t) => ({
|
|
357
566
|
id: t.id,
|
|
358
567
|
name: t.content.name
|
|
359
|
-
})),
|
|
360
|
-
const t =
|
|
568
|
+
})), H = (e) => `${e}_stub_new_${++Te}`, E = (e) => {
|
|
569
|
+
const t = p();
|
|
361
570
|
switch (e) {
|
|
362
571
|
case "importProfile":
|
|
363
572
|
return {
|
|
364
573
|
items: t.importProfiles,
|
|
365
574
|
name: "Import Profile",
|
|
366
|
-
reasons: (s) =>
|
|
575
|
+
reasons: (s) => J(s)
|
|
367
576
|
};
|
|
368
577
|
case "mapping":
|
|
369
578
|
return {
|
|
370
579
|
items: t.mappings,
|
|
371
580
|
name: "Mapping",
|
|
372
|
-
reasons: (s) =>
|
|
581
|
+
reasons: (s) => G(s)
|
|
373
582
|
};
|
|
374
583
|
case "entitySet":
|
|
375
584
|
return {
|
|
376
585
|
items: t.entitySets,
|
|
377
586
|
name: "Entity Set",
|
|
378
|
-
reasons: (s) =>
|
|
587
|
+
reasons: (s) => oe(s)
|
|
379
588
|
};
|
|
380
589
|
}
|
|
381
|
-
},
|
|
382
|
-
|
|
383
|
-
},
|
|
590
|
+
}, y = (e, t) => {
|
|
591
|
+
N(t).validity = R(E(e).reasons(t.content));
|
|
592
|
+
}, L = (e, t) => {
|
|
384
593
|
const s = e.revisions.find((n) => n.id === t);
|
|
385
594
|
if (!s) throw new Error(`Revision ${t} not found`);
|
|
386
595
|
return s;
|
|
596
|
+
}, ie = /* @__PURE__ */ new Set(), ae = r.contenthubRights ?? ["editor", "publisher"], x = (e) => {
|
|
597
|
+
const t = p().imports.find((s) => s.id === e);
|
|
598
|
+
if (!t) throw new Error(`Import ${e} not found`);
|
|
599
|
+
return t;
|
|
600
|
+
}, U = (e) => {
|
|
601
|
+
e.cancelledBy && e.phase !== "ended" && (e.phase = "ended", e.outcome = "cancelled", e.endTime = w());
|
|
602
|
+
}, Z = ({ itemProblems: e, ...t }) => t, W = (e, t) => {
|
|
603
|
+
const s = fe(e);
|
|
604
|
+
if (!s)
|
|
605
|
+
throw new k(`the ${t} ${e.content.name} has no Release yet`);
|
|
606
|
+
const n = e.revisions.find((a) => a.id === s.revisionId)?.content ?? e.content;
|
|
607
|
+
return {
|
|
608
|
+
content: n,
|
|
609
|
+
ref: {
|
|
610
|
+
configurationId: e.id,
|
|
611
|
+
name: n.name,
|
|
612
|
+
releaseId: s.id,
|
|
613
|
+
number: s.number
|
|
614
|
+
}
|
|
615
|
+
};
|
|
387
616
|
};
|
|
388
617
|
return {
|
|
389
|
-
calls:
|
|
618
|
+
calls: I,
|
|
390
619
|
switchWorkspace(e) {
|
|
391
|
-
|
|
620
|
+
h = e;
|
|
621
|
+
},
|
|
622
|
+
updateImport(e, t) {
|
|
623
|
+
Object.assign(x(e), structuredClone(t));
|
|
392
624
|
},
|
|
393
|
-
listImportProfiles: () =>
|
|
394
|
-
getImportProfile: (e) =>
|
|
395
|
-
createImportProfile: (e) =>
|
|
396
|
-
|
|
397
|
-
const t =
|
|
398
|
-
return
|
|
625
|
+
listImportProfiles: () => f("listImportProfiles", () => j(p().importProfiles).map(F)),
|
|
626
|
+
getImportProfile: (e) => f("getImportProfile", () => F(g(p().importProfiles, e, "Import Profile"))),
|
|
627
|
+
createImportProfile: (e) => f("createImportProfile", () => {
|
|
628
|
+
v(p().importProfiles, e.name);
|
|
629
|
+
const t = q("ip", e);
|
|
630
|
+
return y("importProfile", t), p().importProfiles.push(t), F(t);
|
|
399
631
|
}),
|
|
400
|
-
updateImportProfile: (e, t, s) =>
|
|
401
|
-
const n =
|
|
402
|
-
return
|
|
632
|
+
updateImportProfile: (e, t, s) => f("updateImportProfile", () => {
|
|
633
|
+
const n = g(p().importProfiles, e, "Import Profile");
|
|
634
|
+
return v(p().importProfiles, t.name, e), O(n, t, s), y("importProfile", n), F(n);
|
|
403
635
|
}),
|
|
404
|
-
deleteImportProfile: (e) =>
|
|
405
|
-
|
|
636
|
+
deleteImportProfile: (e) => f("deleteImportProfile", () => {
|
|
637
|
+
g(p().importProfiles, e, "Import Profile"), p().importProfiles = p().importProfiles.filter((t) => t.id !== e);
|
|
406
638
|
}),
|
|
407
|
-
listProcessors: () =>
|
|
408
|
-
listMappings: () =>
|
|
409
|
-
getMapping: (e) =>
|
|
410
|
-
createMapping: (e) =>
|
|
411
|
-
|
|
412
|
-
const t =
|
|
413
|
-
return
|
|
639
|
+
listProcessors: () => f("listProcessors", () => [...l].sort((e, t) => e.name.localeCompare(t.name))),
|
|
640
|
+
listMappings: () => f("listMappings", () => j(p().mappings).map(z)),
|
|
641
|
+
getMapping: (e) => f("getMapping", () => z(g(p().mappings, e, "Mapping"))),
|
|
642
|
+
createMapping: (e) => f("createMapping", () => {
|
|
643
|
+
v(p().mappings, e.name);
|
|
644
|
+
const t = q("mp", e);
|
|
645
|
+
return y("mapping", t), p().mappings.push(t), z(t);
|
|
414
646
|
}),
|
|
415
|
-
updateMapping: (e, t, s) =>
|
|
416
|
-
const n =
|
|
417
|
-
return
|
|
647
|
+
updateMapping: (e, t, s) => f("updateMapping", () => {
|
|
648
|
+
const n = g(p().mappings, e, "Mapping");
|
|
649
|
+
return v(p().mappings, t.name, e), O(n, t, s), y("mapping", n), z(n);
|
|
418
650
|
}),
|
|
419
|
-
deleteMapping: (e) =>
|
|
420
|
-
|
|
421
|
-
const t =
|
|
651
|
+
deleteMapping: (e) => f("deleteMapping", () => {
|
|
652
|
+
g(p().mappings, e, "Mapping");
|
|
653
|
+
const t = A((s) => s.mappingIds.includes(e));
|
|
422
654
|
if (t.length > 0)
|
|
423
|
-
throw new
|
|
655
|
+
throw new ce(
|
|
424
656
|
t,
|
|
425
657
|
`the Mapping is included by ${t.map((s) => s.name).join(", ")}`
|
|
426
658
|
);
|
|
427
|
-
|
|
659
|
+
p().mappings = p().mappings.filter((s) => s.id !== e);
|
|
428
660
|
}),
|
|
429
|
-
listMappingImportProfiles: (e) =>
|
|
430
|
-
checkMappingBlueprintRelease: (e, t) =>
|
|
431
|
-
const s =
|
|
661
|
+
listMappingImportProfiles: (e) => f("listMappingImportProfiles", () => (g(p().mappings, e, "Mapping"), A((t) => t.mappingIds.includes(e)))),
|
|
662
|
+
checkMappingBlueprintRelease: (e, t) => f("checkMappingBlueprintRelease", () => {
|
|
663
|
+
const s = g(p().mappings, e, "Mapping"), n = u.find((a) => a.id === t);
|
|
432
664
|
if (!n) throw new Error(`Blueprint Release ${t} not found`);
|
|
433
665
|
if (n.blueprintId !== s.content.blueprintId)
|
|
434
666
|
throw new Error("the Release is of another Blueprint");
|
|
435
667
|
return {
|
|
436
668
|
blueprintId: n.blueprintId,
|
|
437
|
-
missingFieldPaths: (s.content.fields ?? []).
|
|
438
|
-
missingReleaseSpecFields: [
|
|
669
|
+
missingFieldPaths: (s.content.fields ?? []).flatMap((a, o) => se(a, "", `/fields/${o}`).map((i) => i.path)).filter((a) => !n.fieldPaths.includes(a)),
|
|
670
|
+
missingReleaseSpecFields: [
|
|
671
|
+
...(s.content.releaseSpec ?? []).map((a) => a.field ?? ""),
|
|
672
|
+
...s.content.versionMatch?.releaseSpecFields ?? []
|
|
673
|
+
].filter(
|
|
674
|
+
(a, o, i) => a !== "" && i.indexOf(a) === o && !(n.releaseSpecFields ?? []).some((m) => m.path === a)
|
|
675
|
+
)
|
|
439
676
|
};
|
|
440
677
|
}),
|
|
441
|
-
listEntitySets: () =>
|
|
442
|
-
getEntitySet: (e) =>
|
|
443
|
-
createEntitySet: (e) =>
|
|
444
|
-
|
|
445
|
-
const t =
|
|
446
|
-
return
|
|
678
|
+
listEntitySets: () => f("listEntitySets", () => j(p().entitySets).map(C)),
|
|
679
|
+
getEntitySet: (e) => f("getEntitySet", () => C(g(p().entitySets, e, "Entity Set"))),
|
|
680
|
+
createEntitySet: (e) => f("createEntitySet", () => {
|
|
681
|
+
v(p().entitySets, e.name);
|
|
682
|
+
const t = q("es", e);
|
|
683
|
+
return y("entitySet", t), p().entitySets.push(t), C(t);
|
|
447
684
|
}),
|
|
448
|
-
updateEntitySet: (e, t, s) =>
|
|
449
|
-
const n =
|
|
450
|
-
return
|
|
685
|
+
updateEntitySet: (e, t, s) => f("updateEntitySet", () => {
|
|
686
|
+
const n = g(p().entitySets, e, "Entity Set");
|
|
687
|
+
return v(p().entitySets, t.name, e), O(n, t, s), y("entitySet", n), C(n);
|
|
451
688
|
}),
|
|
452
|
-
deleteEntitySet: (e) =>
|
|
453
|
-
|
|
454
|
-
const t =
|
|
689
|
+
deleteEntitySet: (e) => f("deleteEntitySet", () => {
|
|
690
|
+
g(p().entitySets, e, "Entity Set");
|
|
691
|
+
const t = A((s) => s.entitySetId === e);
|
|
455
692
|
if (t.length > 0)
|
|
456
|
-
throw new
|
|
693
|
+
throw new ce(
|
|
457
694
|
t,
|
|
458
695
|
`the Entity Set is named by ${t.map((s) => s.name).join(", ")}`
|
|
459
696
|
);
|
|
460
|
-
|
|
697
|
+
p().entitySets = p().entitySets.filter((s) => s.id !== e);
|
|
461
698
|
}),
|
|
462
|
-
cutRelease: (e, t, s) =>
|
|
463
|
-
const n =
|
|
464
|
-
if (
|
|
465
|
-
throw new
|
|
466
|
-
const
|
|
467
|
-
if (!
|
|
468
|
-
if (!
|
|
469
|
-
throw new
|
|
699
|
+
cutRelease: (e, t, s) => f("cutRelease", () => {
|
|
700
|
+
const n = E(e), a = g(n.items, t, n.name);
|
|
701
|
+
if (ne(a, s))
|
|
702
|
+
throw new Y("the draft moved: somebody saved in between");
|
|
703
|
+
const o = R(n.reasons(a.content));
|
|
704
|
+
if (!o.valid) throw new Y("the draft is invalid", o);
|
|
705
|
+
if (!D(a).draftDiffersFromRelease)
|
|
706
|
+
throw new Y(
|
|
470
707
|
"the draft does not differ from the latest Release: there is nothing to release"
|
|
471
708
|
);
|
|
472
|
-
const
|
|
473
|
-
id: `${
|
|
474
|
-
number:
|
|
475
|
-
revisionId:
|
|
476
|
-
releasedBy:
|
|
477
|
-
releasedAt:
|
|
709
|
+
const i = a.releases.length + 1, m = {
|
|
710
|
+
id: `${a.id}_rel${i}`,
|
|
711
|
+
number: i,
|
|
712
|
+
revisionId: N(a).id,
|
|
713
|
+
releasedBy: _,
|
|
714
|
+
releasedAt: w()
|
|
478
715
|
};
|
|
479
|
-
return
|
|
480
|
-
release:
|
|
481
|
-
importProfiles: e === "mapping" ?
|
|
716
|
+
return a.releases.push(m), {
|
|
717
|
+
release: m,
|
|
718
|
+
importProfiles: e === "mapping" ? A((d) => d.mappingIds.includes(t)) : []
|
|
482
719
|
};
|
|
483
720
|
}),
|
|
484
|
-
listHistory: (e, t, s) =>
|
|
485
|
-
const n =
|
|
721
|
+
listHistory: (e, t, s) => f("listHistory", () => {
|
|
722
|
+
const n = E(e), a = g(n.items, t, n.name), o = [...a.revisions].reverse(), i = Number(s || "0");
|
|
486
723
|
return {
|
|
487
|
-
revisions:
|
|
724
|
+
revisions: o.slice(i, i + 10).map((d) => ({
|
|
488
725
|
id: d.id,
|
|
489
726
|
savedBy: d.savedBy,
|
|
490
727
|
savedAt: d.savedAt,
|
|
491
|
-
validity: d.validity ??
|
|
728
|
+
validity: d.validity ?? R(n.reasons(d.content)),
|
|
492
729
|
restoredFromRevisionId: d.restoredFromRevisionId
|
|
493
730
|
})),
|
|
494
|
-
releases: [...
|
|
495
|
-
nextPageToken:
|
|
731
|
+
releases: [...a.releases].reverse(),
|
|
732
|
+
nextPageToken: i + 10 < o.length ? String(i + 10) : ""
|
|
496
733
|
};
|
|
497
734
|
}),
|
|
498
|
-
compareRevisions: (e, t, s, n) =>
|
|
499
|
-
const
|
|
500
|
-
const
|
|
501
|
-
return { field:
|
|
735
|
+
compareRevisions: (e, t, s, n) => f("compareRevisions", () => {
|
|
736
|
+
const a = E(e), o = g(a.items, t, a.name), i = me(L(o, s).content), m = me(L(o, n).content), d = [.../* @__PURE__ */ new Set([...Object.keys(i), ...Object.keys(m)])].map((M) => {
|
|
737
|
+
const S = i[M], V = m[M], ge = S === void 0 && V !== void 0 ? "added" : S !== void 0 && V === void 0 ? "removed" : JSON.stringify(S) === JSON.stringify(V) ? "unchanged" : "changed";
|
|
738
|
+
return { field: M, status: ge };
|
|
502
739
|
});
|
|
503
740
|
return {
|
|
504
|
-
from: { revisionId: s, content:
|
|
505
|
-
to: { revisionId: n, content:
|
|
741
|
+
from: { revisionId: s, content: i },
|
|
742
|
+
to: { revisionId: n, content: m },
|
|
506
743
|
fields: d
|
|
507
744
|
};
|
|
508
745
|
}),
|
|
509
|
-
restoreRevision: (e, t, s, n) =>
|
|
510
|
-
const
|
|
511
|
-
|
|
746
|
+
restoreRevision: (e, t, s, n) => f("restoreRevision", () => {
|
|
747
|
+
const a = E(e), o = g(a.items, t, a.name);
|
|
748
|
+
O(o, L(o, s).content, n, s), y(e, o);
|
|
749
|
+
}),
|
|
750
|
+
async uploadSourceFile(e, t) {
|
|
751
|
+
if (I.uploadSourceFile++, r.fail) throw r.fail;
|
|
752
|
+
for (const n of [0.25, 0.5, 0.75])
|
|
753
|
+
await new Promise((a) => setTimeout(a, 20)), t(n);
|
|
754
|
+
if (r.uploadFails) throw r.uploadFails;
|
|
755
|
+
t(1);
|
|
756
|
+
const s = H("sf");
|
|
757
|
+
return ie.add(s), { id: s, fileName: e.name };
|
|
758
|
+
},
|
|
759
|
+
startImport: (e) => f("startImport", () => {
|
|
760
|
+
const t = p(), s = g(t.importProfiles, e.importProfileId, "Import Profile");
|
|
761
|
+
if (!ie.has(e.sourceFileId))
|
|
762
|
+
throw new k("nothing was uploaded to the Source File");
|
|
763
|
+
if (!ae.includes("editor"))
|
|
764
|
+
throw new k(
|
|
765
|
+
"starting an Import needs contenthub editor in the workspace"
|
|
766
|
+
);
|
|
767
|
+
const n = W(s, "Import Profile");
|
|
768
|
+
if (n.content.autoPublish && !ae.includes("publisher"))
|
|
769
|
+
throw new k(
|
|
770
|
+
"the Import Profile has Auto-publish, which needs contenthub publisher"
|
|
771
|
+
);
|
|
772
|
+
const a = J(n.content);
|
|
773
|
+
if (a.length > 0)
|
|
774
|
+
throw new k(
|
|
775
|
+
`the Import Profile ${n.ref.name} is invalid: ${a.map((d) => d.message).join(" ")}`
|
|
776
|
+
);
|
|
777
|
+
const o = n.content.mappingIds.map(
|
|
778
|
+
(d) => W(g(t.mappings, d, "Mapping"), "Mapping").ref
|
|
779
|
+
), i = n.content.entitySetId ? W(g(t.entitySets, n.content.entitySetId, "Entity Set"), "Entity Set").ref : void 0, m = {
|
|
780
|
+
id: H("im"),
|
|
781
|
+
importProfileId: s.id,
|
|
782
|
+
importProfileName: n.ref.name,
|
|
783
|
+
sourceFileId: e.sourceFileId,
|
|
784
|
+
startedBy: _,
|
|
785
|
+
phase: "queued",
|
|
786
|
+
failureReason: "",
|
|
787
|
+
progress: { done: 0, total: 0 },
|
|
788
|
+
counts: {
|
|
789
|
+
matched: 0,
|
|
790
|
+
created: 0,
|
|
791
|
+
problems: 0,
|
|
792
|
+
planned: 0,
|
|
793
|
+
corrected: 0,
|
|
794
|
+
kept: 0,
|
|
795
|
+
unchanged: 0
|
|
796
|
+
},
|
|
797
|
+
changeSetId: "",
|
|
798
|
+
releases: {
|
|
799
|
+
importProfile: n.ref,
|
|
800
|
+
mappings: o,
|
|
801
|
+
...i ? { entitySet: i } : {}
|
|
802
|
+
},
|
|
803
|
+
createTime: w(),
|
|
804
|
+
startTime: "",
|
|
805
|
+
endTime: "",
|
|
806
|
+
cancelledBy: "",
|
|
807
|
+
effectiveDate: e.effectiveDate ?? "",
|
|
808
|
+
...e.source ? { source: e.source } : {},
|
|
809
|
+
itemProblems: []
|
|
810
|
+
};
|
|
811
|
+
return t.imports.unshift(m), Z(m);
|
|
812
|
+
}),
|
|
813
|
+
listImports: (e) => f("listImports", () => {
|
|
814
|
+
const t = p().imports;
|
|
815
|
+
t.forEach(U);
|
|
816
|
+
const s = Number(e || "0");
|
|
817
|
+
return {
|
|
818
|
+
imports: t.slice(s, s + 50).map(Z),
|
|
819
|
+
nextPageToken: s + 50 < t.length ? String(s + 50) : ""
|
|
820
|
+
};
|
|
821
|
+
}),
|
|
822
|
+
getImport: (e) => f("getImport", () => {
|
|
823
|
+
const t = x(e);
|
|
824
|
+
return U(t), Z(t);
|
|
825
|
+
}),
|
|
826
|
+
cancelImport: (e) => f("cancelImport", () => {
|
|
827
|
+
const t = x(e);
|
|
828
|
+
if (t.phase === "ended") throw new Error("the Import has ended");
|
|
829
|
+
return t.cancelledBy ||= _, t.phase === "queued" && U(t), Z(t);
|
|
830
|
+
}),
|
|
831
|
+
listItemProblems: (e, t) => f("listItemProblems", () => {
|
|
832
|
+
const s = x(e).itemProblems ?? [], n = t.sourceKeyQuery.toLowerCase(), a = s.filter(
|
|
833
|
+
(m) => (!t.mappingId || m.mappingId === t.mappingId) && m.sourceKey.toLowerCase().includes(n)
|
|
834
|
+
), o = /* @__PURE__ */ new Map();
|
|
835
|
+
for (const m of s) {
|
|
836
|
+
const d = o.get(m.mappingId) ?? {
|
|
837
|
+
mappingId: m.mappingId,
|
|
838
|
+
mappingName: m.mappingName,
|
|
839
|
+
count: 0
|
|
840
|
+
};
|
|
841
|
+
d.count++, o.set(m.mappingId, d);
|
|
842
|
+
}
|
|
843
|
+
const i = Number(t.pageToken || "0");
|
|
844
|
+
return {
|
|
845
|
+
itemProblems: a.slice(i, i + 50),
|
|
846
|
+
totalCount: s.length,
|
|
847
|
+
matchingCount: a.length,
|
|
848
|
+
mappings: [...o.values()].sort((m, d) => m.mappingName.localeCompare(d.mappingName)),
|
|
849
|
+
nextPageToken: i + 50 < a.length ? String(i + 50) : ""
|
|
850
|
+
};
|
|
512
851
|
})
|
|
513
852
|
};
|
|
514
853
|
}
|
|
515
|
-
function
|
|
854
|
+
function Re(r) {
|
|
855
|
+
const c = [], l = { "]": "[", ")": "(" };
|
|
856
|
+
for (const u of r)
|
|
857
|
+
if (u === "[" || u === "(") c.push(u);
|
|
858
|
+
else if (u in l && c.pop() !== l[u]) return !1;
|
|
859
|
+
return c.length === 0;
|
|
860
|
+
}
|
|
861
|
+
function se(r, c, l) {
|
|
862
|
+
const u = `${c}${String(r.name ?? "")}`;
|
|
863
|
+
return [
|
|
864
|
+
{ path: u, rel: l, mapping: r },
|
|
865
|
+
...["fields", "virtualTableFields"].flatMap(
|
|
866
|
+
(h) => (Array.isArray(r[h]) ? r[h] : []).flatMap(
|
|
867
|
+
(I, p) => se(I, `${u}.`, `${l}/${h}/${p}`)
|
|
868
|
+
)
|
|
869
|
+
)
|
|
870
|
+
];
|
|
871
|
+
}
|
|
872
|
+
function Ne(r = ue()) {
|
|
516
873
|
return {
|
|
517
874
|
async listBlueprints() {
|
|
518
|
-
return [...new Map(r.map((
|
|
875
|
+
return [...new Map(r.map((l) => [l.blueprintId, l.blueprintName]))].map(([l, u]) => ({ id: l, name: u })).sort((l, u) => l.name.localeCompare(u.name));
|
|
876
|
+
},
|
|
877
|
+
async listReleases(c) {
|
|
878
|
+
return r.filter((l) => l.blueprintId === c).map((l) => ({ id: l.id, label: l.label }));
|
|
519
879
|
},
|
|
520
|
-
async
|
|
521
|
-
|
|
880
|
+
async getRelease(c) {
|
|
881
|
+
const l = r.find((u) => u.id === c);
|
|
882
|
+
if (!l) throw new Error(`Blueprint Release ${c} not found`);
|
|
883
|
+
return {
|
|
884
|
+
id: l.id,
|
|
885
|
+
blueprintId: l.blueprintId,
|
|
886
|
+
name: l.label,
|
|
887
|
+
fields: l.fields ?? l.fieldPaths.map((u) => ({
|
|
888
|
+
accessor: u,
|
|
889
|
+
path: u,
|
|
890
|
+
fieldType: "text",
|
|
891
|
+
label: "",
|
|
892
|
+
children: []
|
|
893
|
+
})),
|
|
894
|
+
releaseSpecFields: l.releaseSpecFields ?? []
|
|
895
|
+
};
|
|
522
896
|
}
|
|
523
897
|
};
|
|
524
898
|
}
|
|
525
899
|
export {
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
900
|
+
ee as STUB_OTHER_USER_ID,
|
|
901
|
+
Me as STUB_OTHER_WORKSPACE_ID,
|
|
902
|
+
_ as STUB_USER_ID,
|
|
903
|
+
te as STUB_WORKSPACE_ID,
|
|
904
|
+
Ne as createStubBlueprints,
|
|
905
|
+
Be as createStubImporthubClient,
|
|
906
|
+
ue as stubBlueprintReleases,
|
|
907
|
+
Ie as stubEntitySets,
|
|
908
|
+
ke as stubIdentity,
|
|
909
|
+
ye as stubImportProfiles,
|
|
910
|
+
Pe as stubImports,
|
|
911
|
+
_e as stubMappings,
|
|
912
|
+
Se as stubProcessors
|
|
537
913
|
};
|
|
538
914
|
//# sourceMappingURL=testing.js.map
|