@knkcs/importhub-ui 0.6.0 → 0.8.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/dist/field-tree-CghMgGKm.js +108 -0
- package/dist/field-tree-CghMgGKm.js.map +1 -0
- package/dist/importhub-client-BS6F4DW2.js.map +1 -1
- package/dist/index.d.ts +13 -0
- package/dist/index.js +555 -555
- package/dist/index.js.map +1 -1
- package/dist/mapping-editor.d.ts +5 -0
- package/dist/mapping-editor.js +536 -608
- package/dist/mapping-editor.js.map +1 -1
- package/dist/{mapping-page-wJywO-hg.js → mapping-page-tIHPNu7C.js} +279 -279
- package/dist/{mapping-page-wJywO-hg.js.map → mapping-page-tIHPNu7C.js.map} +1 -1
- package/dist/testing.d.ts +5 -0
- package/dist/testing.js +364 -329
- package/dist/testing.js.map +1 -1
- package/package.json +1 -1
package/dist/testing.js
CHANGED
|
@@ -1,38 +1,40 @@
|
|
|
1
|
-
import { createHostMembers as
|
|
2
|
-
import { A as
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { createHostMembers as be } from "@knkcs/anker/host";
|
|
2
|
+
import { A as le, S as M, R as Q, C as pe, N as ye } from "./importhub-client-BS6F4DW2.js";
|
|
3
|
+
import { p as Ie } from "./field-tree-CghMgGKm.js";
|
|
4
|
+
const b = "user_stub_ada", q = "user_stub_grace", te = "ws_stub_main", Ae = "ws_stub_other";
|
|
5
|
+
function Fe(i = te) {
|
|
5
6
|
return {
|
|
6
|
-
userId:
|
|
7
|
-
workspaceId:
|
|
8
|
-
members:
|
|
9
|
-
{ userId:
|
|
7
|
+
userId: b,
|
|
8
|
+
workspaceId: i,
|
|
9
|
+
members: be([
|
|
10
|
+
{ userId: b, displayName: "Ada Importer", email: "ada@example.com" },
|
|
10
11
|
{ userId: q, displayName: "Grace Hopper", email: "grace@example.com" }
|
|
11
12
|
])
|
|
12
13
|
};
|
|
13
14
|
}
|
|
14
|
-
const
|
|
15
|
-
accessor:
|
|
16
|
-
path:
|
|
17
|
-
fieldType:
|
|
18
|
-
label:
|
|
15
|
+
const y = (i, o, c, u = []) => ({
|
|
16
|
+
accessor: i.split(".").pop() ?? i,
|
|
17
|
+
path: i,
|
|
18
|
+
fieldType: o,
|
|
19
|
+
label: c,
|
|
19
20
|
children: u
|
|
20
|
-
}), j = (
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
}), j = (i) => i.flatMap((o) => [o.path, ...j(o.children)]), ce = (i) => [
|
|
22
|
+
y("titel", "text", "Titel"),
|
|
23
|
+
y("abkuerzung", "text", "Abkürzung"),
|
|
24
|
+
y("anzeigename", "textarea", "Anzeigename"),
|
|
25
|
+
...i ? [y("fussnote", "rich_text", "Fußnote")] : [],
|
|
26
|
+
y("stand", "fieldset", "Stand", [
|
|
27
|
+
y("stand.datum", "date", "Datum"),
|
|
28
|
+
y("stand.art", "select", "Art")
|
|
27
29
|
])
|
|
28
30
|
], de = () => [
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
y("fundstelle", "text", "Fundstelle"),
|
|
32
|
+
y("ausgabedatum", "date", "Ausgabedatum")
|
|
31
33
|
];
|
|
32
|
-
function
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
function he() {
|
|
35
|
+
const i = ce(!1), o = ce(!0), c = [
|
|
36
|
+
y("aktenzeichen", "text", "Aktenzeichen"),
|
|
37
|
+
y("datum", "date", "Datum")
|
|
36
38
|
];
|
|
37
39
|
return [
|
|
38
40
|
{
|
|
@@ -40,8 +42,8 @@ function ge() {
|
|
|
40
42
|
blueprintId: "bp_stub_gesetz",
|
|
41
43
|
blueprintName: "Gesetz",
|
|
42
44
|
label: "Release 2",
|
|
43
|
-
fieldPaths: j(
|
|
44
|
-
fields:
|
|
45
|
+
fieldPaths: j(i),
|
|
46
|
+
fields: i,
|
|
45
47
|
releaseSpecFields: de()
|
|
46
48
|
},
|
|
47
49
|
{
|
|
@@ -49,8 +51,8 @@ function ge() {
|
|
|
49
51
|
blueprintId: "bp_stub_gesetz",
|
|
50
52
|
blueprintName: "Gesetz",
|
|
51
53
|
label: "Release 1",
|
|
52
|
-
fieldPaths: j(
|
|
53
|
-
fields:
|
|
54
|
+
fieldPaths: j(o),
|
|
55
|
+
fields: o,
|
|
54
56
|
releaseSpecFields: de()
|
|
55
57
|
},
|
|
56
58
|
{
|
|
@@ -58,12 +60,12 @@ function ge() {
|
|
|
58
60
|
blueprintId: "bp_stub_entscheidung",
|
|
59
61
|
blueprintName: "Entscheidung",
|
|
60
62
|
label: "Release 1",
|
|
61
|
-
fieldPaths: j(
|
|
62
|
-
fields:
|
|
63
|
+
fieldPaths: j(c),
|
|
64
|
+
fields: c
|
|
63
65
|
}
|
|
64
66
|
];
|
|
65
67
|
}
|
|
66
|
-
function
|
|
68
|
+
function Se() {
|
|
67
69
|
return [
|
|
68
70
|
{
|
|
69
71
|
id: "mp_stub_norm",
|
|
@@ -95,7 +97,7 @@ function Ie() {
|
|
|
95
97
|
}
|
|
96
98
|
];
|
|
97
99
|
}
|
|
98
|
-
function
|
|
100
|
+
function we() {
|
|
99
101
|
return [
|
|
100
102
|
{
|
|
101
103
|
id: "es_stub_latin1",
|
|
@@ -108,7 +110,7 @@ function Se() {
|
|
|
108
110
|
}
|
|
109
111
|
];
|
|
110
112
|
}
|
|
111
|
-
function
|
|
113
|
+
function Pe() {
|
|
112
114
|
return [
|
|
113
115
|
{
|
|
114
116
|
id: "ip_stub_gesetz",
|
|
@@ -139,12 +141,12 @@ function we() {
|
|
|
139
141
|
}
|
|
140
142
|
];
|
|
141
143
|
}
|
|
142
|
-
const X = (
|
|
144
|
+
const X = (i, o, c, u = "") => ({
|
|
143
145
|
field_type: "text",
|
|
144
|
-
config: { name:
|
|
146
|
+
config: { name: o, api_accessor: i, required: c, instructions: u },
|
|
145
147
|
system: !1
|
|
146
148
|
});
|
|
147
|
-
function
|
|
149
|
+
function ve() {
|
|
148
150
|
return [
|
|
149
151
|
{
|
|
150
152
|
name: "citation-links",
|
|
@@ -179,7 +181,7 @@ function Pe() {
|
|
|
179
181
|
}
|
|
180
182
|
];
|
|
181
183
|
}
|
|
182
|
-
const
|
|
184
|
+
const R = (i = {}) => ({
|
|
183
185
|
matched: 0,
|
|
184
186
|
created: 0,
|
|
185
187
|
problems: 0,
|
|
@@ -187,13 +189,13 @@ const $ = (r = {}) => ({
|
|
|
187
189
|
corrected: 0,
|
|
188
190
|
kept: 0,
|
|
189
191
|
unchanged: 0,
|
|
190
|
-
...
|
|
191
|
-
}),
|
|
192
|
+
...i
|
|
193
|
+
}), P = (i) => ({
|
|
192
194
|
importProfile: {
|
|
193
195
|
configurationId: "ip_stub_gesetz",
|
|
194
196
|
name: "Boorberg gesetz",
|
|
195
|
-
releaseId: `ip_stub_gesetz_rel${
|
|
196
|
-
number:
|
|
197
|
+
releaseId: `ip_stub_gesetz_rel${i}`,
|
|
198
|
+
number: i
|
|
197
199
|
},
|
|
198
200
|
mappings: [
|
|
199
201
|
{
|
|
@@ -209,38 +211,38 @@ const $ = (r = {}) => ({
|
|
|
209
211
|
releaseId: "es_stub_latin1_rel1",
|
|
210
212
|
number: 1
|
|
211
213
|
}
|
|
212
|
-
}), T = (
|
|
214
|
+
}), T = (i) => ({
|
|
213
215
|
importProfileId: "ip_stub_gesetz",
|
|
214
216
|
importProfileName: "Boorberg gesetz",
|
|
215
|
-
sourceFileId: `sf_${
|
|
216
|
-
startedBy:
|
|
217
|
+
sourceFileId: `sf_${i.id}`,
|
|
218
|
+
startedBy: b,
|
|
217
219
|
phase: "ended",
|
|
218
220
|
failureReason: "",
|
|
219
221
|
progress: { done: 0, total: 0 },
|
|
220
|
-
counts:
|
|
222
|
+
counts: R(),
|
|
221
223
|
changeSetId: "",
|
|
222
|
-
releases:
|
|
224
|
+
releases: P(2),
|
|
223
225
|
createTime: "2026-11-03T09:00:00.000Z",
|
|
224
226
|
startTime: "",
|
|
225
227
|
endTime: "",
|
|
226
228
|
cancelledBy: "",
|
|
227
229
|
effectiveDate: "",
|
|
228
|
-
...
|
|
229
|
-
}), B = (
|
|
230
|
-
id: `prob_stub_${
|
|
231
|
-
mappingId:
|
|
232
|
-
mappingName:
|
|
233
|
-
sourceKey:
|
|
230
|
+
...i
|
|
231
|
+
}), B = (i, o, c, u, g) => ({
|
|
232
|
+
id: `prob_stub_${i}`,
|
|
233
|
+
mappingId: o === "norm" ? "mp_stub_norm" : "mp_stub_title",
|
|
234
|
+
mappingName: o === "norm" ? "Gesetz norms" : "Gesetz titles",
|
|
235
|
+
sourceKey: c,
|
|
234
236
|
field: u,
|
|
235
|
-
reason:
|
|
237
|
+
reason: g
|
|
236
238
|
});
|
|
237
|
-
function
|
|
239
|
+
function Te() {
|
|
238
240
|
return [
|
|
239
241
|
T({
|
|
240
242
|
id: "im_stub_running",
|
|
241
243
|
phase: "writing",
|
|
242
244
|
progress: { done: 48, total: 120 },
|
|
243
|
-
counts:
|
|
245
|
+
counts: R({ matched: 120, created: 40, planned: 8 }),
|
|
244
246
|
changeSetId: "cs_stub_running",
|
|
245
247
|
createTime: "2026-11-04T10:00:00.000Z",
|
|
246
248
|
startTime: "2026-11-04T10:00:05.000Z"
|
|
@@ -249,13 +251,13 @@ function ve() {
|
|
|
249
251
|
id: "im_stub_queued",
|
|
250
252
|
phase: "queued",
|
|
251
253
|
startedBy: q,
|
|
252
|
-
releases:
|
|
254
|
+
releases: P(2),
|
|
253
255
|
createTime: "2026-11-04T10:05:00.000Z"
|
|
254
256
|
}),
|
|
255
257
|
T({
|
|
256
258
|
id: "im_stub_problems",
|
|
257
259
|
outcome: "succeeded_with_problems",
|
|
258
|
-
counts:
|
|
260
|
+
counts: R({
|
|
259
261
|
matched: 212,
|
|
260
262
|
created: 180,
|
|
261
263
|
planned: 20,
|
|
@@ -265,9 +267,9 @@ function ve() {
|
|
|
265
267
|
}),
|
|
266
268
|
changeSetId: "cs_stub_problems",
|
|
267
269
|
releases: {
|
|
268
|
-
...
|
|
270
|
+
...P(2),
|
|
269
271
|
mappings: [
|
|
270
|
-
...
|
|
272
|
+
...P(2).mappings,
|
|
271
273
|
{
|
|
272
274
|
configurationId: "mp_stub_title",
|
|
273
275
|
name: "Gesetz titles",
|
|
@@ -292,9 +294,9 @@ function ve() {
|
|
|
292
294
|
T({
|
|
293
295
|
id: "im_stub_succeeded",
|
|
294
296
|
outcome: "succeeded",
|
|
295
|
-
counts:
|
|
297
|
+
counts: R({ matched: 64, created: 64 }),
|
|
296
298
|
changeSetId: "cs_stub_succeeded",
|
|
297
|
-
releases:
|
|
299
|
+
releases: P(1),
|
|
298
300
|
createTime: "2026-11-02T14:00:00.000Z",
|
|
299
301
|
startTime: "2026-11-02T14:00:01.000Z",
|
|
300
302
|
endTime: "2026-11-02T14:03:10.000Z"
|
|
@@ -303,8 +305,8 @@ function ve() {
|
|
|
303
305
|
id: "im_stub_failed",
|
|
304
306
|
outcome: "failed",
|
|
305
307
|
failureReason: "The worker crashed three times running this Import.",
|
|
306
|
-
counts:
|
|
307
|
-
releases:
|
|
308
|
+
counts: R({ matched: 30 }),
|
|
309
|
+
releases: P(1),
|
|
308
310
|
createTime: "2026-11-02T11:00:00.000Z",
|
|
309
311
|
startTime: "2026-11-02T11:00:01.000Z",
|
|
310
312
|
endTime: "2026-11-02T11:20:00.000Z"
|
|
@@ -313,15 +315,15 @@ function ve() {
|
|
|
313
315
|
id: "im_stub_cancelled",
|
|
314
316
|
outcome: "cancelled",
|
|
315
317
|
cancelledBy: q,
|
|
316
|
-
counts:
|
|
317
|
-
releases:
|
|
318
|
+
counts: R({ matched: 12, created: 3 }),
|
|
319
|
+
releases: P(1),
|
|
318
320
|
createTime: "2026-11-01T16:00:00.000Z",
|
|
319
321
|
startTime: "2026-11-01T16:00:01.000Z",
|
|
320
322
|
endTime: "2026-11-01T16:01:00.000Z"
|
|
321
323
|
})
|
|
322
324
|
];
|
|
323
325
|
}
|
|
324
|
-
function
|
|
326
|
+
function $e() {
|
|
325
327
|
return [
|
|
326
328
|
{
|
|
327
329
|
id: "key_stub_nightly",
|
|
@@ -335,7 +337,7 @@ function Te() {
|
|
|
335
337
|
id: "key_stub_pipeline",
|
|
336
338
|
name: "VRPML pipeline",
|
|
337
339
|
keyPrefix: "ihk_b91F",
|
|
338
|
-
owner:
|
|
340
|
+
owner: b,
|
|
339
341
|
expireTime: "2027-06-30T21:59:59.000Z",
|
|
340
342
|
createTime: "2026-11-03T12:00:00.000Z"
|
|
341
343
|
}
|
|
@@ -375,47 +377,47 @@ const Re = [
|
|
|
375
377
|
"revokeApiKey"
|
|
376
378
|
];
|
|
377
379
|
let me = Date.parse("2026-11-02T08:00:00Z");
|
|
378
|
-
const
|
|
379
|
-
const
|
|
380
|
-
id: `${
|
|
381
|
-
content: structuredClone(
|
|
382
|
-
savedBy:
|
|
383
|
-
savedAt:
|
|
380
|
+
const v = () => (me += 36e5, new Date(me).toISOString()), ee = (i = []) => i.map((o) => {
|
|
381
|
+
const c = Math.max(o.releaseNumber ?? 0, 1), u = Array.from({ length: c }, (_, p) => ({
|
|
382
|
+
id: `${o.id}_r${p + 1}`,
|
|
383
|
+
content: structuredClone(o.content),
|
|
384
|
+
savedBy: b,
|
|
385
|
+
savedAt: v(),
|
|
384
386
|
restoredFromRevisionId: ""
|
|
385
|
-
})),
|
|
386
|
-
id: `${
|
|
387
|
+
})), g = Array.from({ length: o.releaseNumber ?? 0 }, (_, p) => ({
|
|
388
|
+
id: `${o.id}_rel${p + 1}`,
|
|
387
389
|
number: p + 1,
|
|
388
|
-
revisionId: `${
|
|
389
|
-
releasedBy:
|
|
390
|
-
releasedAt:
|
|
390
|
+
revisionId: `${o.id}_r${p + 1}`,
|
|
391
|
+
releasedBy: b,
|
|
392
|
+
releasedAt: v()
|
|
391
393
|
}));
|
|
392
|
-
return { id:
|
|
393
|
-
}),
|
|
394
|
-
const
|
|
394
|
+
return { id: o.id, content: structuredClone(o.content), revisions: u, releases: g };
|
|
395
|
+
}), N = (i) => i.revisions[i.revisions.length - 1], ge = (i) => i.releases[i.releases.length - 1], Z = (i) => {
|
|
396
|
+
const o = ge(i), c = i.revisions.find((u) => u.id === o?.revisionId);
|
|
395
397
|
return {
|
|
396
|
-
draftRevisionId:
|
|
398
|
+
draftRevisionId: N(i).id,
|
|
397
399
|
// By content, as importhub compares: a draft that restored the
|
|
398
400
|
// released content does not differ.
|
|
399
|
-
draftDiffersFromRelease: !
|
|
400
|
-
...
|
|
401
|
+
draftDiffersFromRelease: !c || JSON.stringify(c.content) !== JSON.stringify(N(i).content),
|
|
402
|
+
...o ? { latestRelease: { id: o.id, number: o.number } } : {}
|
|
401
403
|
};
|
|
402
|
-
},
|
|
403
|
-
Object.entries(
|
|
404
|
-
),
|
|
405
|
-
valid:
|
|
406
|
-
reasons:
|
|
407
|
-
}), D = (
|
|
404
|
+
}, ke = (i) => i.replace(/[A-Z]/g, (o) => `_${o.toLowerCase()}`), ue = (i) => Object.fromEntries(
|
|
405
|
+
Object.entries(i).map(([o, c]) => [ke(o), c])
|
|
406
|
+
), $ = (i) => ({
|
|
407
|
+
valid: i.length === 0,
|
|
408
|
+
reasons: i
|
|
409
|
+
}), D = (i) => [...i].sort((o, c) => o.content.name.localeCompare(c.content.name));
|
|
408
410
|
let fe = 0;
|
|
409
|
-
function
|
|
410
|
-
const
|
|
411
|
+
function Oe(i = {}) {
|
|
412
|
+
const o = Object.fromEntries(
|
|
411
413
|
Object.entries(
|
|
412
|
-
|
|
414
|
+
i.workspaces ?? {
|
|
413
415
|
[te]: {
|
|
414
|
-
importProfiles:
|
|
415
|
-
mappings:
|
|
416
|
-
entitySets:
|
|
417
|
-
imports:
|
|
418
|
-
apiKeys:
|
|
416
|
+
importProfiles: Pe(),
|
|
417
|
+
mappings: Se(),
|
|
418
|
+
entitySets: we(),
|
|
419
|
+
imports: Te(),
|
|
420
|
+
apiKeys: $e()
|
|
419
421
|
}
|
|
420
422
|
}
|
|
421
423
|
).map(([e, t]) => [
|
|
@@ -428,32 +430,32 @@ function Ne(r = {}) {
|
|
|
428
430
|
apiKeys: structuredClone(t.apiKeys ?? [])
|
|
429
431
|
}
|
|
430
432
|
])
|
|
431
|
-
),
|
|
432
|
-
let
|
|
433
|
-
const
|
|
433
|
+
), c = i.processors ?? ve(), u = i.blueprintReleases ?? he();
|
|
434
|
+
let g = i.activeWorkspaceId ?? te;
|
|
435
|
+
const _ = Object.fromEntries(Re.map((e) => [e, 0])), p = () => (o[g] ??= {
|
|
434
436
|
importProfiles: [],
|
|
435
437
|
mappings: [],
|
|
436
438
|
entitySets: [],
|
|
437
439
|
imports: [],
|
|
438
440
|
apiKeys: []
|
|
439
|
-
},
|
|
440
|
-
if (
|
|
441
|
+
}, o[g]), d = async (e, t) => {
|
|
442
|
+
if (_[e]++, i.fail) throw i.fail;
|
|
441
443
|
return structuredClone(t());
|
|
442
|
-
},
|
|
443
|
-
const n = e.find((
|
|
444
|
+
}, h = (e, t, s) => {
|
|
445
|
+
const n = e.find((r) => r.id === t);
|
|
444
446
|
if (!n) throw new Error(`${s} ${t} not found`);
|
|
445
447
|
return n;
|
|
446
|
-
},
|
|
448
|
+
}, I = (e, t, s) => {
|
|
447
449
|
if (!t.trim()) throw new Error("a name is required");
|
|
448
450
|
if (e.some((n) => n.id !== s && n.content.name === t)) throw new ye();
|
|
449
|
-
}, ne = (e, t) => t !== "" && t !==
|
|
451
|
+
}, ne = (e, t) => t !== "" && t !== N(e).id, x = (e, t, s, n = "") => {
|
|
450
452
|
if (ne(e, s))
|
|
451
453
|
throw new Error("the draft moved: somebody saved in between");
|
|
452
454
|
e.content = structuredClone(t), e.revisions.push({
|
|
453
455
|
id: `${e.id}_r${e.revisions.length + 1}`,
|
|
454
456
|
content: structuredClone(t),
|
|
455
|
-
savedBy:
|
|
456
|
-
savedAt:
|
|
457
|
+
savedBy: b,
|
|
458
|
+
savedAt: v(),
|
|
457
459
|
restoredFromRevisionId: n
|
|
458
460
|
});
|
|
459
461
|
}, G = (e, t) => {
|
|
@@ -465,8 +467,8 @@ function Ne(r = {}) {
|
|
|
465
467
|
{
|
|
466
468
|
id: `${s}_r1`,
|
|
467
469
|
content: structuredClone(t),
|
|
468
|
-
savedBy:
|
|
469
|
-
savedAt:
|
|
470
|
+
savedBy: b,
|
|
471
|
+
savedAt: v(),
|
|
470
472
|
restoredFromRevisionId: ""
|
|
471
473
|
}
|
|
472
474
|
],
|
|
@@ -474,7 +476,7 @@ function Ne(r = {}) {
|
|
|
474
476
|
};
|
|
475
477
|
};
|
|
476
478
|
function J(e) {
|
|
477
|
-
const t = [], s = u.find((
|
|
479
|
+
const t = [], s = u.find((a) => a.id === e.blueprintReleaseId);
|
|
478
480
|
e.blueprintReleaseId ? s ? s.blueprintId !== e.blueprintId && t.push({
|
|
479
481
|
path: "/blueprintReleaseId",
|
|
480
482
|
code: "release_of_other_blueprint",
|
|
@@ -492,85 +494,85 @@ function Ne(r = {}) {
|
|
|
492
494
|
code: "no_element_selector",
|
|
493
495
|
message: "It has no element selector."
|
|
494
496
|
}), !e.sourceKey?.selector && !e.sourceKey?.template && t.push({ path: "/sourceKey", code: "no_source_key", message: "It has no Source Key." });
|
|
495
|
-
const n = (
|
|
496
|
-
typeof
|
|
497
|
+
const n = (a, l) => {
|
|
498
|
+
typeof l == "string" && l !== "" && !Ee(l) && t.push({ path: a, code: "invalid_xpath", message: `"${l}" is not an XPath.` });
|
|
497
499
|
};
|
|
498
500
|
n("/element_selector", e.elementSelector), n("/source_key/selector", e.sourceKey?.selector);
|
|
499
|
-
const
|
|
500
|
-
return (e.fields ?? []).forEach((
|
|
501
|
-
const
|
|
502
|
-
for (const { path:
|
|
503
|
-
|
|
504
|
-
path:
|
|
501
|
+
const r = [];
|
|
502
|
+
return (e.fields ?? []).forEach((a, l) => {
|
|
503
|
+
const f = `/fields/${l}`;
|
|
504
|
+
for (const { path: m, rel: E, mapping: w } of se(a, "", f))
|
|
505
|
+
r.push(m), n(`${E}/selector`, w.selector), s && !s.fieldPaths.includes(m) && t.push({
|
|
506
|
+
path: f,
|
|
505
507
|
code: "unknown_field_path",
|
|
506
|
-
message: `The pinned Release has no field ${
|
|
507
|
-
}),
|
|
508
|
-
path:
|
|
508
|
+
message: `The pinned Release has no field ${m}.`
|
|
509
|
+
}), w.type === "select" && !w.selectOptions && t.push({
|
|
510
|
+
path: f,
|
|
509
511
|
code: "xmlmapper_schema",
|
|
510
|
-
message: `The select field ${
|
|
512
|
+
message: `The select field ${m} has no select options.`
|
|
511
513
|
});
|
|
512
|
-
}), (e.versionMatch?.contentFields ?? []).forEach((
|
|
513
|
-
|
|
514
|
-
path: `/version_match/content_fields/${
|
|
514
|
+
}), (e.versionMatch?.contentFields ?? []).forEach((a, l) => {
|
|
515
|
+
r.includes(a) || t.push({
|
|
516
|
+
path: `/version_match/content_fields/${l}`,
|
|
515
517
|
code: "unknown_version_match_field",
|
|
516
|
-
message: `The Version Match compares ${
|
|
518
|
+
message: `The Version Match compares ${a}, which the Mapping does not map.`
|
|
517
519
|
});
|
|
518
|
-
}), (e.titleContributions ?? []).forEach((
|
|
519
|
-
(!
|
|
520
|
-
path: `/title_contributions/${
|
|
520
|
+
}), (e.titleContributions ?? []).forEach((a, l) => {
|
|
521
|
+
(!a.selector || !a.ausgabeCodeSelector) && t.push({
|
|
522
|
+
path: `/title_contributions/${l}`,
|
|
521
523
|
code: "incomplete_title_contribution",
|
|
522
524
|
message: "A Title Contribution needs a selector and an Ausgabe code selector."
|
|
523
|
-
}), n(`/title_contributions/${
|
|
524
|
-
}), (e.placeholderAssets ?? []).forEach((
|
|
525
|
-
(!
|
|
526
|
-
path: `/placeholder_assets/${
|
|
525
|
+
}), n(`/title_contributions/${l}/selector`, a.selector);
|
|
526
|
+
}), (e.placeholderAssets ?? []).forEach((a, l) => {
|
|
527
|
+
(!a.selector || !a.assetType || !a.keyParts?.length || !a.nameSelector) && t.push({
|
|
528
|
+
path: `/placeholder_assets/${l}`,
|
|
527
529
|
code: "incomplete_placeholder_assets",
|
|
528
530
|
message: "Placeholder Assets need a selector, an asset type, the key's parts and a name selector."
|
|
529
|
-
}), n(`/placeholder_assets/${
|
|
530
|
-
n(`/placeholder_assets/${
|
|
531
|
+
}), n(`/placeholder_assets/${l}/selector`, a.selector), (a.keyParts ?? []).forEach((f, m) => {
|
|
532
|
+
n(`/placeholder_assets/${l}/key_parts/${m}`, f);
|
|
531
533
|
});
|
|
532
|
-
}), t;
|
|
534
|
+
}), t.push(...Me(e, s?.fields, r)), t;
|
|
533
535
|
}
|
|
534
|
-
function
|
|
535
|
-
return e.flatMap((n,
|
|
536
|
-
const
|
|
537
|
-
return
|
|
536
|
+
function ie(e, t, s) {
|
|
537
|
+
return e.flatMap((n, r) => {
|
|
538
|
+
const a = `/${t}/${r}`, l = c.find((m) => m.name === n.processor);
|
|
539
|
+
return l ? l.target !== "source_file" ? [
|
|
538
540
|
{
|
|
539
|
-
path:
|
|
541
|
+
path: a,
|
|
540
542
|
code: "rich_text_processor",
|
|
541
|
-
message: `${
|
|
543
|
+
message: `${l.name} is configured on a rich-text field, not on a Profile.`
|
|
542
544
|
}
|
|
543
|
-
] :
|
|
544
|
-
(
|
|
545
|
-
).map((
|
|
546
|
-
path: `${
|
|
545
|
+
] : l.kind !== s ? [{ path: a, code: "wrong_processor_kind", message: `${l.name} does not run here.` }] : l.settingsSpec.filter(
|
|
546
|
+
(m) => m.config.required && (n.settings[m.config.api_accessor] ?? "") === ""
|
|
547
|
+
).map((m) => ({
|
|
548
|
+
path: `${a}/settings/${m.config.api_accessor}`,
|
|
547
549
|
code: "invalid_processor_settings",
|
|
548
|
-
message: `${
|
|
550
|
+
message: `${l.name}: ${m.config.api_accessor} is required.`
|
|
549
551
|
})) : [
|
|
550
|
-
{ path:
|
|
552
|
+
{ path: a, code: "unknown_processor", message: `No Processor is called ${n.processor}.` }
|
|
551
553
|
];
|
|
552
554
|
});
|
|
553
555
|
}
|
|
554
556
|
function L(e) {
|
|
555
557
|
const t = p(), s = [
|
|
556
|
-
...
|
|
557
|
-
...
|
|
558
|
+
...ie(e.preprocessors, "preprocessors", "preprocessor"),
|
|
559
|
+
...ie(e.postProcessors, "postProcessors", "post_processor")
|
|
558
560
|
];
|
|
559
|
-
return e.mappingIds.length === 0 && s.push({ path: "/mappingIds", code: "no_mappings", message: "It includes no Mapping." }), e.mappingIds.forEach((n,
|
|
560
|
-
const
|
|
561
|
-
if (!
|
|
561
|
+
return e.mappingIds.length === 0 && s.push({ path: "/mappingIds", code: "no_mappings", message: "It includes no Mapping." }), e.mappingIds.forEach((n, r) => {
|
|
562
|
+
const a = t.mappings.find((f) => f.id === n);
|
|
563
|
+
if (!a) {
|
|
562
564
|
s.push({
|
|
563
|
-
path: `/mappingIds/${
|
|
565
|
+
path: `/mappingIds/${r}`,
|
|
564
566
|
code: "mapping_missing",
|
|
565
567
|
message: "It includes a Mapping that does not exist."
|
|
566
568
|
});
|
|
567
569
|
return;
|
|
568
570
|
}
|
|
569
|
-
const
|
|
570
|
-
|
|
571
|
-
path: `/mappingIds/${
|
|
571
|
+
const l = J(a.content);
|
|
572
|
+
l.length > 0 && s.push({
|
|
573
|
+
path: `/mappingIds/${r}`,
|
|
572
574
|
code: "mapping_invalid",
|
|
573
|
-
message: `The Mapping ${
|
|
575
|
+
message: `The Mapping ${a.content.name} is invalid: ${l.map((f) => f.message).join(" ")}`
|
|
574
576
|
});
|
|
575
577
|
}), e.entitySetId && !t.entitySets.some((n) => n.id === e.entitySetId) && s.push({
|
|
576
578
|
path: "/entitySetId",
|
|
@@ -578,25 +580,25 @@ function Ne(r = {}) {
|
|
|
578
580
|
message: "It names an Entity Set that does not exist."
|
|
579
581
|
}), s;
|
|
580
582
|
}
|
|
581
|
-
const
|
|
583
|
+
const re = (e) => Object.keys(e.entities).length === 0 ? [{ path: "/entities", code: "no_entities", message: "It defines no entity." }] : [], A = (e) => ({
|
|
582
584
|
id: e.id,
|
|
583
585
|
content: e.content,
|
|
584
|
-
validity:
|
|
586
|
+
validity: $(L(e.content)),
|
|
585
587
|
state: Z(e)
|
|
586
|
-
}),
|
|
588
|
+
}), F = (e) => ({
|
|
587
589
|
id: e.id,
|
|
588
590
|
content: e.content,
|
|
589
|
-
validity:
|
|
591
|
+
validity: $(J(e.content)),
|
|
590
592
|
state: Z(e)
|
|
591
|
-
}),
|
|
593
|
+
}), O = (e) => ({
|
|
592
594
|
id: e.id,
|
|
593
595
|
content: e.content,
|
|
594
|
-
validity:
|
|
596
|
+
validity: $(re(e.content)),
|
|
595
597
|
state: Z(e)
|
|
596
598
|
}), K = (e) => D(p().importProfiles.filter((t) => e(t.content))).map((t) => ({
|
|
597
599
|
id: t.id,
|
|
598
600
|
name: t.content.name
|
|
599
|
-
})), H = (e) => `${e}_stub_new_${++fe}`,
|
|
601
|
+
})), H = (e) => `${e}_stub_new_${++fe}`, k = (e) => {
|
|
600
602
|
const t = p();
|
|
601
603
|
switch (e) {
|
|
602
604
|
case "importProfile":
|
|
@@ -615,26 +617,26 @@ function Ne(r = {}) {
|
|
|
615
617
|
return {
|
|
616
618
|
items: t.entitySets,
|
|
617
619
|
name: "Entity Set",
|
|
618
|
-
reasons: (s) =>
|
|
620
|
+
reasons: (s) => re(s)
|
|
619
621
|
};
|
|
620
622
|
}
|
|
621
|
-
},
|
|
622
|
-
|
|
623
|
+
}, S = (e, t) => {
|
|
624
|
+
N(t).validity = $(k(e).reasons(t.content));
|
|
623
625
|
}, U = (e, t) => {
|
|
624
626
|
const s = e.revisions.find((n) => n.id === t);
|
|
625
627
|
if (!s) throw new Error(`Revision ${t} not found`);
|
|
626
628
|
return s;
|
|
627
|
-
}, oe = /* @__PURE__ */ new Set(), ae =
|
|
629
|
+
}, oe = /* @__PURE__ */ new Set(), ae = i.contenthubRights ?? ["editor", "publisher"], z = (e) => {
|
|
628
630
|
const t = p().imports.find((s) => s.id === e);
|
|
629
631
|
if (!t) throw new Error(`Import ${e} not found`);
|
|
630
632
|
return t;
|
|
631
633
|
}, W = (e) => {
|
|
632
|
-
e.cancelledBy && e.phase !== "ended" && (e.phase = "ended", e.outcome = "cancelled", e.endTime =
|
|
634
|
+
e.cancelledBy && e.phase !== "ended" && (e.phase = "ended", e.outcome = "cancelled", e.endTime = v());
|
|
633
635
|
}, C = ({ itemProblems: e, ...t }) => t, V = (e, t) => {
|
|
634
|
-
const s =
|
|
636
|
+
const s = ge(e);
|
|
635
637
|
if (!s)
|
|
636
638
|
throw new M(`the ${t} ${e.content.name} has no Release yet`);
|
|
637
|
-
const n = e.revisions.find((
|
|
639
|
+
const n = e.revisions.find((r) => r.id === s.revisionId)?.content ?? e.content;
|
|
638
640
|
return {
|
|
639
641
|
content: n,
|
|
640
642
|
ref: {
|
|
@@ -646,149 +648,149 @@ function Ne(r = {}) {
|
|
|
646
648
|
};
|
|
647
649
|
};
|
|
648
650
|
return {
|
|
649
|
-
calls:
|
|
651
|
+
calls: _,
|
|
650
652
|
switchWorkspace(e) {
|
|
651
|
-
|
|
653
|
+
g = e;
|
|
652
654
|
},
|
|
653
655
|
updateImport(e, t) {
|
|
654
656
|
Object.assign(z(e), structuredClone(t));
|
|
655
657
|
},
|
|
656
|
-
listImportProfiles: () =>
|
|
657
|
-
getImportProfile: (e) =>
|
|
658
|
-
createImportProfile: (e) =>
|
|
659
|
-
|
|
658
|
+
listImportProfiles: () => d("listImportProfiles", () => D(p().importProfiles).map(A)),
|
|
659
|
+
getImportProfile: (e) => d("getImportProfile", () => A(h(p().importProfiles, e, "Import Profile"))),
|
|
660
|
+
createImportProfile: (e) => d("createImportProfile", () => {
|
|
661
|
+
I(p().importProfiles, e.name);
|
|
660
662
|
const t = G("ip", e);
|
|
661
|
-
return
|
|
663
|
+
return S("importProfile", t), p().importProfiles.push(t), A(t);
|
|
662
664
|
}),
|
|
663
|
-
updateImportProfile: (e, t, s) =>
|
|
664
|
-
const n =
|
|
665
|
-
return
|
|
665
|
+
updateImportProfile: (e, t, s) => d("updateImportProfile", () => {
|
|
666
|
+
const n = h(p().importProfiles, e, "Import Profile");
|
|
667
|
+
return I(p().importProfiles, t.name, e), x(n, t, s), S("importProfile", n), A(n);
|
|
666
668
|
}),
|
|
667
|
-
deleteImportProfile: (e) =>
|
|
668
|
-
|
|
669
|
+
deleteImportProfile: (e) => d("deleteImportProfile", () => {
|
|
670
|
+
h(p().importProfiles, e, "Import Profile"), p().importProfiles = p().importProfiles.filter((t) => t.id !== e);
|
|
669
671
|
}),
|
|
670
|
-
listProcessors: () =>
|
|
671
|
-
listMappings: () =>
|
|
672
|
-
getMapping: (e) =>
|
|
673
|
-
createMapping: (e) =>
|
|
674
|
-
|
|
672
|
+
listProcessors: () => d("listProcessors", () => [...c].sort((e, t) => e.name.localeCompare(t.name))),
|
|
673
|
+
listMappings: () => d("listMappings", () => D(p().mappings).map(F)),
|
|
674
|
+
getMapping: (e) => d("getMapping", () => F(h(p().mappings, e, "Mapping"))),
|
|
675
|
+
createMapping: (e) => d("createMapping", () => {
|
|
676
|
+
I(p().mappings, e.name);
|
|
675
677
|
const t = G("mp", e);
|
|
676
|
-
return
|
|
678
|
+
return S("mapping", t), p().mappings.push(t), F(t);
|
|
677
679
|
}),
|
|
678
|
-
updateMapping: (e, t, s) =>
|
|
679
|
-
const n =
|
|
680
|
-
return
|
|
680
|
+
updateMapping: (e, t, s) => d("updateMapping", () => {
|
|
681
|
+
const n = h(p().mappings, e, "Mapping");
|
|
682
|
+
return I(p().mappings, t.name, e), x(n, t, s), S("mapping", n), F(n);
|
|
681
683
|
}),
|
|
682
|
-
deleteMapping: (e) =>
|
|
683
|
-
|
|
684
|
+
deleteMapping: (e) => d("deleteMapping", () => {
|
|
685
|
+
h(p().mappings, e, "Mapping");
|
|
684
686
|
const t = K((s) => s.mappingIds.includes(e));
|
|
685
687
|
if (t.length > 0)
|
|
686
|
-
throw new
|
|
688
|
+
throw new pe(
|
|
687
689
|
t,
|
|
688
690
|
`the Mapping is included by ${t.map((s) => s.name).join(", ")}`
|
|
689
691
|
);
|
|
690
692
|
p().mappings = p().mappings.filter((s) => s.id !== e);
|
|
691
693
|
}),
|
|
692
|
-
listMappingImportProfiles: (e) =>
|
|
693
|
-
checkMappingBlueprintRelease: (e, t) =>
|
|
694
|
-
const s =
|
|
694
|
+
listMappingImportProfiles: (e) => d("listMappingImportProfiles", () => (h(p().mappings, e, "Mapping"), K((t) => t.mappingIds.includes(e)))),
|
|
695
|
+
checkMappingBlueprintRelease: (e, t) => d("checkMappingBlueprintRelease", () => {
|
|
696
|
+
const s = h(p().mappings, e, "Mapping"), n = u.find((r) => r.id === t);
|
|
695
697
|
if (!n) throw new Error(`Blueprint Release ${t} not found`);
|
|
696
698
|
if (n.blueprintId !== s.content.blueprintId)
|
|
697
699
|
throw new Error("the Release is of another Blueprint");
|
|
698
700
|
return {
|
|
699
701
|
blueprintId: n.blueprintId,
|
|
700
|
-
missingFieldPaths: (s.content.fields ?? []).flatMap((
|
|
702
|
+
missingFieldPaths: (s.content.fields ?? []).flatMap((r, a) => se(r, "", `/fields/${a}`).map((l) => l.path)).filter((r) => !n.fieldPaths.includes(r)),
|
|
701
703
|
missingReleaseSpecFields: [
|
|
702
|
-
...(s.content.releaseSpec ?? []).map((
|
|
704
|
+
...(s.content.releaseSpec ?? []).map((r) => r.field ?? ""),
|
|
703
705
|
...s.content.versionMatch?.releaseSpecFields ?? []
|
|
704
706
|
].filter(
|
|
705
|
-
(
|
|
707
|
+
(r, a, l) => r !== "" && l.indexOf(r) === a && !(n.releaseSpecFields ?? []).some((f) => f.path === r)
|
|
706
708
|
)
|
|
707
709
|
};
|
|
708
710
|
}),
|
|
709
|
-
listEntitySets: () =>
|
|
710
|
-
getEntitySet: (e) =>
|
|
711
|
-
createEntitySet: (e) =>
|
|
712
|
-
|
|
711
|
+
listEntitySets: () => d("listEntitySets", () => D(p().entitySets).map(O)),
|
|
712
|
+
getEntitySet: (e) => d("getEntitySet", () => O(h(p().entitySets, e, "Entity Set"))),
|
|
713
|
+
createEntitySet: (e) => d("createEntitySet", () => {
|
|
714
|
+
I(p().entitySets, e.name);
|
|
713
715
|
const t = G("es", e);
|
|
714
|
-
return
|
|
716
|
+
return S("entitySet", t), p().entitySets.push(t), O(t);
|
|
715
717
|
}),
|
|
716
|
-
updateEntitySet: (e, t, s) =>
|
|
717
|
-
const n =
|
|
718
|
-
return
|
|
718
|
+
updateEntitySet: (e, t, s) => d("updateEntitySet", () => {
|
|
719
|
+
const n = h(p().entitySets, e, "Entity Set");
|
|
720
|
+
return I(p().entitySets, t.name, e), x(n, t, s), S("entitySet", n), O(n);
|
|
719
721
|
}),
|
|
720
|
-
deleteEntitySet: (e) =>
|
|
721
|
-
|
|
722
|
+
deleteEntitySet: (e) => d("deleteEntitySet", () => {
|
|
723
|
+
h(p().entitySets, e, "Entity Set");
|
|
722
724
|
const t = K((s) => s.entitySetId === e);
|
|
723
725
|
if (t.length > 0)
|
|
724
|
-
throw new
|
|
726
|
+
throw new pe(
|
|
725
727
|
t,
|
|
726
728
|
`the Entity Set is named by ${t.map((s) => s.name).join(", ")}`
|
|
727
729
|
);
|
|
728
730
|
p().entitySets = p().entitySets.filter((s) => s.id !== e);
|
|
729
731
|
}),
|
|
730
|
-
cutRelease: (e, t, s) =>
|
|
731
|
-
const n =
|
|
732
|
-
if (ne(
|
|
732
|
+
cutRelease: (e, t, s) => d("cutRelease", () => {
|
|
733
|
+
const n = k(e), r = h(n.items, t, n.name);
|
|
734
|
+
if (ne(r, s))
|
|
733
735
|
throw new Q("the draft moved: somebody saved in between");
|
|
734
|
-
const
|
|
735
|
-
if (!
|
|
736
|
-
if (!Z(
|
|
736
|
+
const a = $(n.reasons(r.content));
|
|
737
|
+
if (!a.valid) throw new Q("the draft is invalid", a);
|
|
738
|
+
if (!Z(r).draftDiffersFromRelease)
|
|
737
739
|
throw new Q(
|
|
738
740
|
"the draft does not differ from the latest Release: there is nothing to release"
|
|
739
741
|
);
|
|
740
|
-
const
|
|
741
|
-
id: `${
|
|
742
|
-
number:
|
|
743
|
-
revisionId:
|
|
744
|
-
releasedBy:
|
|
745
|
-
releasedAt:
|
|
742
|
+
const l = r.releases.length + 1, f = {
|
|
743
|
+
id: `${r.id}_rel${l}`,
|
|
744
|
+
number: l,
|
|
745
|
+
revisionId: N(r).id,
|
|
746
|
+
releasedBy: b,
|
|
747
|
+
releasedAt: v()
|
|
746
748
|
};
|
|
747
|
-
return
|
|
748
|
-
release:
|
|
749
|
-
importProfiles: e === "mapping" ? K((
|
|
749
|
+
return r.releases.push(f), {
|
|
750
|
+
release: f,
|
|
751
|
+
importProfiles: e === "mapping" ? K((m) => m.mappingIds.includes(t)) : []
|
|
750
752
|
};
|
|
751
753
|
}),
|
|
752
|
-
listHistory: (e, t, s) =>
|
|
753
|
-
const n =
|
|
754
|
+
listHistory: (e, t, s) => d("listHistory", () => {
|
|
755
|
+
const n = k(e), r = h(n.items, t, n.name), a = [...r.revisions].reverse(), l = Number(s || "0");
|
|
754
756
|
return {
|
|
755
|
-
revisions:
|
|
756
|
-
id:
|
|
757
|
-
savedBy:
|
|
758
|
-
savedAt:
|
|
759
|
-
validity:
|
|
760
|
-
restoredFromRevisionId:
|
|
757
|
+
revisions: a.slice(l, l + 10).map((m) => ({
|
|
758
|
+
id: m.id,
|
|
759
|
+
savedBy: m.savedBy,
|
|
760
|
+
savedAt: m.savedAt,
|
|
761
|
+
validity: m.validity ?? $(n.reasons(m.content)),
|
|
762
|
+
restoredFromRevisionId: m.restoredFromRevisionId
|
|
761
763
|
})),
|
|
762
|
-
releases: [...
|
|
763
|
-
nextPageToken:
|
|
764
|
+
releases: [...r.releases].reverse(),
|
|
765
|
+
nextPageToken: l + 10 < a.length ? String(l + 10) : ""
|
|
764
766
|
};
|
|
765
767
|
}),
|
|
766
|
-
compareRevisions: (e, t, s, n) =>
|
|
767
|
-
const
|
|
768
|
-
const
|
|
769
|
-
return { field:
|
|
768
|
+
compareRevisions: (e, t, s, n) => d("compareRevisions", () => {
|
|
769
|
+
const r = k(e), a = h(r.items, t, r.name), l = ue(U(a, s).content), f = ue(U(a, n).content), m = [.../* @__PURE__ */ new Set([...Object.keys(l), ...Object.keys(f)])].map((E) => {
|
|
770
|
+
const w = l[E], Y = f[E], _e = w === void 0 && Y !== void 0 ? "added" : w !== void 0 && Y === void 0 ? "removed" : JSON.stringify(w) === JSON.stringify(Y) ? "unchanged" : "changed";
|
|
771
|
+
return { field: E, status: _e };
|
|
770
772
|
});
|
|
771
773
|
return {
|
|
772
|
-
from: { revisionId: s, content:
|
|
773
|
-
to: { revisionId: n, content:
|
|
774
|
-
fields:
|
|
774
|
+
from: { revisionId: s, content: l },
|
|
775
|
+
to: { revisionId: n, content: f },
|
|
776
|
+
fields: m
|
|
775
777
|
};
|
|
776
778
|
}),
|
|
777
|
-
restoreRevision: (e, t, s, n) =>
|
|
778
|
-
const
|
|
779
|
-
|
|
779
|
+
restoreRevision: (e, t, s, n) => d("restoreRevision", () => {
|
|
780
|
+
const r = k(e), a = h(r.items, t, r.name);
|
|
781
|
+
x(a, U(a, s).content, n, s), S(e, a);
|
|
780
782
|
}),
|
|
781
783
|
async uploadSourceFile(e, t) {
|
|
782
|
-
if (
|
|
784
|
+
if (_.uploadSourceFile++, i.fail) throw i.fail;
|
|
783
785
|
for (const n of [0.25, 0.5, 0.75])
|
|
784
|
-
await new Promise((
|
|
785
|
-
if (
|
|
786
|
+
await new Promise((r) => setTimeout(r, 20)), t(n);
|
|
787
|
+
if (i.uploadFails) throw i.uploadFails;
|
|
786
788
|
t(1);
|
|
787
789
|
const s = H("sf");
|
|
788
790
|
return oe.add(s), { id: s, fileName: e.name };
|
|
789
791
|
},
|
|
790
|
-
startImport: (e) =>
|
|
791
|
-
const t = p(), s =
|
|
792
|
+
startImport: (e) => d("startImport", () => {
|
|
793
|
+
const t = p(), s = h(t.importProfiles, e.importProfileId, "Import Profile");
|
|
792
794
|
if (!oe.has(e.sourceFileId))
|
|
793
795
|
throw new M("nothing was uploaded to the Source File");
|
|
794
796
|
if (!ae.includes("editor"))
|
|
@@ -800,19 +802,19 @@ function Ne(r = {}) {
|
|
|
800
802
|
throw new M(
|
|
801
803
|
"the Import Profile has Auto-publish, which needs contenthub publisher"
|
|
802
804
|
);
|
|
803
|
-
const
|
|
804
|
-
if (
|
|
805
|
+
const r = L(n.content);
|
|
806
|
+
if (r.length > 0)
|
|
805
807
|
throw new M(
|
|
806
|
-
`the Import Profile ${n.ref.name} is invalid: ${
|
|
808
|
+
`the Import Profile ${n.ref.name} is invalid: ${r.map((m) => m.message).join(" ")}`
|
|
807
809
|
);
|
|
808
|
-
const
|
|
809
|
-
(
|
|
810
|
-
),
|
|
810
|
+
const a = n.content.mappingIds.map(
|
|
811
|
+
(m) => V(h(t.mappings, m, "Mapping"), "Mapping").ref
|
|
812
|
+
), l = n.content.entitySetId ? V(h(t.entitySets, n.content.entitySetId, "Entity Set"), "Entity Set").ref : void 0, f = {
|
|
811
813
|
id: H("im"),
|
|
812
814
|
importProfileId: s.id,
|
|
813
815
|
importProfileName: n.ref.name,
|
|
814
816
|
sourceFileId: e.sourceFileId,
|
|
815
|
-
startedBy:
|
|
817
|
+
startedBy: b,
|
|
816
818
|
phase: "queued",
|
|
817
819
|
failureReason: "",
|
|
818
820
|
progress: { done: 0, total: 0 },
|
|
@@ -828,10 +830,10 @@ function Ne(r = {}) {
|
|
|
828
830
|
changeSetId: "",
|
|
829
831
|
releases: {
|
|
830
832
|
importProfile: n.ref,
|
|
831
|
-
mappings:
|
|
832
|
-
...
|
|
833
|
+
mappings: a,
|
|
834
|
+
...l ? { entitySet: l } : {}
|
|
833
835
|
},
|
|
834
|
-
createTime:
|
|
836
|
+
createTime: v(),
|
|
835
837
|
startTime: "",
|
|
836
838
|
endTime: "",
|
|
837
839
|
cancelledBy: "",
|
|
@@ -839,9 +841,9 @@ function Ne(r = {}) {
|
|
|
839
841
|
...e.source ? { source: e.source } : {},
|
|
840
842
|
itemProblems: []
|
|
841
843
|
};
|
|
842
|
-
return t.imports.unshift(
|
|
844
|
+
return t.imports.unshift(f), C(f);
|
|
843
845
|
}),
|
|
844
|
-
listImports: (e) =>
|
|
846
|
+
listImports: (e) => d("listImports", () => {
|
|
845
847
|
const t = p().imports;
|
|
846
848
|
t.forEach(W);
|
|
847
849
|
const s = Number(e || "0");
|
|
@@ -850,121 +852,154 @@ function Ne(r = {}) {
|
|
|
850
852
|
nextPageToken: s + 50 < t.length ? String(s + 50) : ""
|
|
851
853
|
};
|
|
852
854
|
}),
|
|
853
|
-
getImport: (e) =>
|
|
855
|
+
getImport: (e) => d("getImport", () => {
|
|
854
856
|
const t = z(e);
|
|
855
857
|
return W(t), C(t);
|
|
856
858
|
}),
|
|
857
|
-
cancelImport: (e) =>
|
|
859
|
+
cancelImport: (e) => d("cancelImport", () => {
|
|
858
860
|
const t = z(e);
|
|
859
861
|
if (t.phase === "ended") throw new Error("the Import has ended");
|
|
860
|
-
return t.cancelledBy ||=
|
|
862
|
+
return t.cancelledBy ||= b, t.phase === "queued" && W(t), C(t);
|
|
861
863
|
}),
|
|
862
|
-
listItemProblems: (e, t) =>
|
|
863
|
-
const s = z(e).itemProblems ?? [], n = t.sourceKeyQuery.toLowerCase(),
|
|
864
|
-
(
|
|
865
|
-
),
|
|
866
|
-
for (const
|
|
867
|
-
const
|
|
868
|
-
mappingId:
|
|
869
|
-
mappingName:
|
|
864
|
+
listItemProblems: (e, t) => d("listItemProblems", () => {
|
|
865
|
+
const s = z(e).itemProblems ?? [], n = t.sourceKeyQuery.toLowerCase(), r = s.filter(
|
|
866
|
+
(f) => (!t.mappingId || f.mappingId === t.mappingId) && f.sourceKey.toLowerCase().includes(n)
|
|
867
|
+
), a = /* @__PURE__ */ new Map();
|
|
868
|
+
for (const f of s) {
|
|
869
|
+
const m = a.get(f.mappingId) ?? {
|
|
870
|
+
mappingId: f.mappingId,
|
|
871
|
+
mappingName: f.mappingName,
|
|
870
872
|
count: 0
|
|
871
873
|
};
|
|
872
|
-
|
|
874
|
+
m.count++, a.set(f.mappingId, m);
|
|
873
875
|
}
|
|
874
|
-
const
|
|
876
|
+
const l = Number(t.pageToken || "0");
|
|
875
877
|
return {
|
|
876
|
-
itemProblems:
|
|
878
|
+
itemProblems: r.slice(l, l + 50),
|
|
877
879
|
totalCount: s.length,
|
|
878
|
-
matchingCount:
|
|
879
|
-
mappings: [...
|
|
880
|
-
nextPageToken:
|
|
880
|
+
matchingCount: r.length,
|
|
881
|
+
mappings: [...a.values()].sort((f, m) => f.mappingName.localeCompare(m.mappingName)),
|
|
882
|
+
nextPageToken: l + 50 < r.length ? String(l + 50) : ""
|
|
881
883
|
};
|
|
882
884
|
}),
|
|
883
|
-
listApiKeys: () =>
|
|
884
|
-
createApiKey: (e) =>
|
|
885
|
+
listApiKeys: () => d("listApiKeys", () => p().apiKeys),
|
|
886
|
+
createApiKey: (e) => d("createApiKey", () => {
|
|
885
887
|
const t = e.name.trim();
|
|
886
888
|
if (!t) throw new Error("a name is required");
|
|
887
|
-
if (t.length >
|
|
888
|
-
throw new Error(`the name is longer than ${
|
|
889
|
+
if (t.length > le)
|
|
890
|
+
throw new Error(`the name is longer than ${le} characters`);
|
|
889
891
|
const s = e.expireTime ? new Date(e.expireTime).toISOString() : "";
|
|
890
892
|
if (s && Date.parse(s) <= Date.now())
|
|
891
893
|
throw new Error("the expiry must lie in the future");
|
|
892
|
-
const n = ++fe,
|
|
894
|
+
const n = ++fe, r = {
|
|
893
895
|
id: `key_stub_new_${n}`,
|
|
894
896
|
name: t,
|
|
895
897
|
keyPrefix: `ihk_n${String(n).padStart(3, "0")}`,
|
|
896
|
-
owner:
|
|
898
|
+
owner: b,
|
|
897
899
|
expireTime: s,
|
|
898
900
|
createTime: (/* @__PURE__ */ new Date()).toISOString()
|
|
899
901
|
};
|
|
900
|
-
return p().apiKeys.unshift(
|
|
902
|
+
return p().apiKeys.unshift(r), { apiKey: r, secret: `${r.keyPrefix}_stub_secret_${n}` };
|
|
901
903
|
}),
|
|
902
|
-
revokeApiKey: (e) =>
|
|
904
|
+
revokeApiKey: (e) => d("revokeApiKey", () => {
|
|
903
905
|
const t = p();
|
|
904
906
|
if (!t.apiKeys.some((s) => s.id === e)) throw new Error(`API key ${e} not found`);
|
|
905
907
|
t.apiKeys = t.apiKeys.filter((s) => s.id !== e);
|
|
906
908
|
})
|
|
907
909
|
};
|
|
908
910
|
}
|
|
909
|
-
function Ee(
|
|
910
|
-
const
|
|
911
|
-
for (const u of
|
|
912
|
-
if (u === "[" || u === "(")
|
|
913
|
-
else if (u in
|
|
914
|
-
return
|
|
911
|
+
function Ee(i) {
|
|
912
|
+
const o = [], c = { "]": "[", ")": "(" };
|
|
913
|
+
for (const u of i)
|
|
914
|
+
if (u === "[" || u === "(") o.push(u);
|
|
915
|
+
else if (u in c && o.pop() !== c[u]) return !1;
|
|
916
|
+
return o.length === 0;
|
|
915
917
|
}
|
|
916
|
-
function se(
|
|
917
|
-
const u = `${
|
|
918
|
+
function se(i, o, c) {
|
|
919
|
+
const u = `${o}${String(i.name ?? "")}`;
|
|
918
920
|
return [
|
|
919
|
-
{ path: u, rel:
|
|
921
|
+
{ path: u, rel: c, mapping: i },
|
|
920
922
|
...["fields", "virtualTableFields"].flatMap(
|
|
921
|
-
(
|
|
922
|
-
(
|
|
923
|
+
(g) => (Array.isArray(i[g]) ? i[g] : []).flatMap(
|
|
924
|
+
(_, p) => se(_, `${u}.`, `${c}/${g}/${p}`)
|
|
923
925
|
)
|
|
924
926
|
)
|
|
925
927
|
];
|
|
926
928
|
}
|
|
927
|
-
function
|
|
929
|
+
function Ke(i = he()) {
|
|
928
930
|
return {
|
|
929
931
|
async listBlueprints() {
|
|
930
|
-
return [...new Map(
|
|
932
|
+
return [...new Map(i.map((c) => [c.blueprintId, c.blueprintName]))].map(([c, u]) => ({ id: c, name: u })).sort((c, u) => c.name.localeCompare(u.name));
|
|
931
933
|
},
|
|
932
|
-
async listReleases(
|
|
933
|
-
return
|
|
934
|
+
async listReleases(o) {
|
|
935
|
+
return i.filter((c) => c.blueprintId === o).map((c) => ({ id: c.id, label: c.label }));
|
|
934
936
|
},
|
|
935
|
-
async getRelease(
|
|
936
|
-
const
|
|
937
|
-
if (!
|
|
937
|
+
async getRelease(o) {
|
|
938
|
+
const c = i.find((u) => u.id === o);
|
|
939
|
+
if (!c) throw new Error(`Blueprint Release ${o} not found`);
|
|
938
940
|
return {
|
|
939
|
-
id:
|
|
940
|
-
blueprintId:
|
|
941
|
-
name:
|
|
942
|
-
fields:
|
|
941
|
+
id: c.id,
|
|
942
|
+
blueprintId: c.blueprintId,
|
|
943
|
+
name: c.label,
|
|
944
|
+
fields: c.fields ?? c.fieldPaths.map((u) => ({
|
|
943
945
|
accessor: u,
|
|
944
946
|
path: u,
|
|
945
947
|
fieldType: "text",
|
|
946
948
|
label: "",
|
|
947
949
|
children: []
|
|
948
950
|
})),
|
|
949
|
-
releaseSpecFields:
|
|
951
|
+
releaseSpecFields: c.releaseSpecFields ?? []
|
|
950
952
|
};
|
|
951
953
|
}
|
|
952
954
|
};
|
|
953
955
|
}
|
|
956
|
+
function Me(i, o, c) {
|
|
957
|
+
const u = (i.displayNameTemplate ?? "").trim(), g = (i.displayNameField ?? "").trim(), _ = (d, h, I) => [
|
|
958
|
+
{ path: d, code: h, message: I }
|
|
959
|
+
];
|
|
960
|
+
if (!u && !g) return [];
|
|
961
|
+
if (!g)
|
|
962
|
+
return _(
|
|
963
|
+
"/display_name_field",
|
|
964
|
+
"incomplete_display_name",
|
|
965
|
+
"the display-name template names no field to write the display name into"
|
|
966
|
+
);
|
|
967
|
+
if (!u)
|
|
968
|
+
return _(
|
|
969
|
+
"/display_name_template",
|
|
970
|
+
"incomplete_display_name",
|
|
971
|
+
`the display-name field "${g}" has no display-name template to fill it`
|
|
972
|
+
);
|
|
973
|
+
if (!o) return [];
|
|
974
|
+
const p = (d) => d.flatMap((h) => [h.path, ...p(h.children)]);
|
|
975
|
+
return p(o).includes(g) ? Ie(o).some((d) => d.path === g) ? c.includes(g) ? _(
|
|
976
|
+
"/display_name_field",
|
|
977
|
+
"display_name_field_mapped",
|
|
978
|
+
`the field "${g}" is mapped too: it takes the display name or a mapped value, not both`
|
|
979
|
+
) : [] : _(
|
|
980
|
+
"/display_name_field",
|
|
981
|
+
"display_name_field_not_plain_text",
|
|
982
|
+
`the display-name field "${g}" is not a plain-text one (text or textarea)`
|
|
983
|
+
) : _(
|
|
984
|
+
"/display_name_field",
|
|
985
|
+
"unknown_display_name_field",
|
|
986
|
+
`the Blueprint Release has no field "${g}" to write the display name into`
|
|
987
|
+
);
|
|
988
|
+
}
|
|
954
989
|
export {
|
|
955
990
|
q as STUB_OTHER_USER_ID,
|
|
956
|
-
|
|
957
|
-
|
|
991
|
+
Ae as STUB_OTHER_WORKSPACE_ID,
|
|
992
|
+
b as STUB_USER_ID,
|
|
958
993
|
te as STUB_WORKSPACE_ID,
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
994
|
+
Ke as createStubBlueprints,
|
|
995
|
+
Oe as createStubImporthubClient,
|
|
996
|
+
$e as stubApiKeys,
|
|
997
|
+
he as stubBlueprintReleases,
|
|
998
|
+
we as stubEntitySets,
|
|
999
|
+
Fe as stubIdentity,
|
|
1000
|
+
Pe as stubImportProfiles,
|
|
1001
|
+
Te as stubImports,
|
|
1002
|
+
Se as stubMappings,
|
|
1003
|
+
ve as stubProcessors
|
|
969
1004
|
};
|
|
970
1005
|
//# sourceMappingURL=testing.js.map
|