@knkcs/importhub-ui 0.9.0 → 0.11.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 +5 -4
- package/dist/{importhub-client-Wrb4s3lw.js → importhub-client-BzOVIXA4.js} +16 -7
- package/dist/importhub-client-BzOVIXA4.js.map +1 -0
- package/dist/index.d.ts +385 -8
- package/dist/index.js +1870 -1351
- package/dist/index.js.map +1 -1
- package/dist/mapping-editor.d.ts +135 -1
- package/dist/mapping-editor.js +1 -1
- package/dist/{mapping-page-BTEJR0-z.js → mapping-page-CABgzLlj.js} +402 -387
- package/dist/mapping-page-CABgzLlj.js.map +1 -0
- package/dist/testing.d.ts +141 -2
- package/dist/testing.js +655 -501
- package/dist/testing.js.map +1 -1
- package/package.json +1 -1
- package/dist/importhub-client-Wrb4s3lw.js.map +0 -1
- package/dist/mapping-page-BTEJR0-z.js.map +0 -1
package/dist/testing.js
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import { createHostMembers as
|
|
2
|
-
import { M as
|
|
3
|
-
import { p as
|
|
4
|
-
const
|
|
5
|
-
function
|
|
1
|
+
import { createHostMembers as Re } from "@knkcs/anker/host";
|
|
2
|
+
import { M as z, A as de, S as D, R as se, C as me, N as Te } from "./importhub-client-BzOVIXA4.js";
|
|
3
|
+
import { p as ve } from "./field-tree-CghMgGKm.js";
|
|
4
|
+
const y = "user_stub_ada", U = "user_stub_grace", oe = "ws_stub_main", Ge = "ws_stub_other";
|
|
5
|
+
function Le(s = oe) {
|
|
6
6
|
return {
|
|
7
|
-
userId:
|
|
8
|
-
workspaceId:
|
|
9
|
-
members:
|
|
10
|
-
{ userId:
|
|
11
|
-
{ userId:
|
|
7
|
+
userId: y,
|
|
8
|
+
workspaceId: s,
|
|
9
|
+
members: Re([
|
|
10
|
+
{ userId: y, displayName: "Ada Importer", email: "ada@example.com" },
|
|
11
|
+
{ userId: U, displayName: "Grace Hopper", email: "grace@example.com" }
|
|
12
12
|
])
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
|
-
const S = (
|
|
16
|
-
accessor:
|
|
17
|
-
path:
|
|
15
|
+
const S = (s, a, i, m = []) => ({
|
|
16
|
+
accessor: s.split(".").pop() ?? s,
|
|
17
|
+
path: s,
|
|
18
18
|
fieldType: a,
|
|
19
|
-
label:
|
|
19
|
+
label: i,
|
|
20
20
|
children: m
|
|
21
|
-
}),
|
|
21
|
+
}), H = (s) => s.flatMap((a) => [a.path, ...H(a.children)]), ue = (s) => [
|
|
22
22
|
S("titel", "text", "Titel"),
|
|
23
23
|
S("abkuerzung", "text", "Abkürzung"),
|
|
24
24
|
S("anzeigename", "textarea", "Anzeigename"),
|
|
25
|
-
...
|
|
25
|
+
...s ? [S("fussnote", "rich_text", "Fußnote")] : [],
|
|
26
26
|
S("stand", "fieldset", "Stand", [
|
|
27
27
|
S("stand.datum", "date", "Datum"),
|
|
28
28
|
S("stand.art", "select", "Art")
|
|
29
29
|
])
|
|
30
|
-
],
|
|
30
|
+
], fe = () => [
|
|
31
31
|
S("fundstelle", "text", "Fundstelle"),
|
|
32
32
|
S("ausgabedatum", "date", "Ausgabedatum")
|
|
33
33
|
];
|
|
34
|
-
function
|
|
35
|
-
const
|
|
34
|
+
function be() {
|
|
35
|
+
const s = ue(!1), a = ue(!0), i = [
|
|
36
36
|
S("aktenzeichen", "text", "Aktenzeichen"),
|
|
37
37
|
S("datum", "date", "Datum")
|
|
38
38
|
];
|
|
@@ -42,30 +42,30 @@ function ge() {
|
|
|
42
42
|
blueprintId: "bp_stub_gesetz",
|
|
43
43
|
blueprintName: "Gesetz",
|
|
44
44
|
label: "Release 2",
|
|
45
|
-
fieldPaths:
|
|
46
|
-
fields:
|
|
47
|
-
releaseSpecFields:
|
|
45
|
+
fieldPaths: H(s),
|
|
46
|
+
fields: s,
|
|
47
|
+
releaseSpecFields: fe()
|
|
48
48
|
},
|
|
49
49
|
{
|
|
50
50
|
id: "br_stub_gesetz_1",
|
|
51
51
|
blueprintId: "bp_stub_gesetz",
|
|
52
52
|
blueprintName: "Gesetz",
|
|
53
53
|
label: "Release 1",
|
|
54
|
-
fieldPaths:
|
|
54
|
+
fieldPaths: H(a),
|
|
55
55
|
fields: a,
|
|
56
|
-
releaseSpecFields:
|
|
56
|
+
releaseSpecFields: fe()
|
|
57
57
|
},
|
|
58
58
|
{
|
|
59
59
|
id: "br_stub_entscheidung_1",
|
|
60
60
|
blueprintId: "bp_stub_entscheidung",
|
|
61
61
|
blueprintName: "Entscheidung",
|
|
62
62
|
label: "Release 1",
|
|
63
|
-
fieldPaths:
|
|
64
|
-
fields:
|
|
63
|
+
fieldPaths: H(i),
|
|
64
|
+
fields: i
|
|
65
65
|
}
|
|
66
66
|
];
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function $e() {
|
|
69
69
|
return [
|
|
70
70
|
{
|
|
71
71
|
id: "mp_stub_norm",
|
|
@@ -103,7 +103,7 @@ const je = `<?xml version="1.0" encoding="UTF-8"?>
|
|
|
103
103
|
<norm id="n2"><titel>§ 2 Begriffsbestimmungen</titel></norm>
|
|
104
104
|
</gesetz>
|
|
105
105
|
`;
|
|
106
|
-
function
|
|
106
|
+
function Ee() {
|
|
107
107
|
return [
|
|
108
108
|
{
|
|
109
109
|
id: "es_stub_latin1",
|
|
@@ -116,7 +116,7 @@ function ve() {
|
|
|
116
116
|
}
|
|
117
117
|
];
|
|
118
118
|
}
|
|
119
|
-
function
|
|
119
|
+
function Me() {
|
|
120
120
|
return [
|
|
121
121
|
{
|
|
122
122
|
id: "ip_stub_gesetz",
|
|
@@ -147,12 +147,12 @@ function $e() {
|
|
|
147
147
|
}
|
|
148
148
|
];
|
|
149
149
|
}
|
|
150
|
-
const
|
|
150
|
+
const re = (s, a, i, m = "") => ({
|
|
151
151
|
field_type: "text",
|
|
152
|
-
config: { name: a, api_accessor:
|
|
152
|
+
config: { name: a, api_accessor: s, required: i, instructions: m },
|
|
153
153
|
system: !1
|
|
154
154
|
});
|
|
155
|
-
function
|
|
155
|
+
function ke() {
|
|
156
156
|
return [
|
|
157
157
|
{
|
|
158
158
|
name: "citation-links",
|
|
@@ -174,8 +174,8 @@ function Ee() {
|
|
|
174
174
|
target: "source_file",
|
|
175
175
|
description: "Renames every element of one name to another.",
|
|
176
176
|
settingsSpec: [
|
|
177
|
-
|
|
178
|
-
|
|
177
|
+
re("from", "Element", !0, "The element's name now."),
|
|
178
|
+
re("to", "New name", !0)
|
|
179
179
|
]
|
|
180
180
|
},
|
|
181
181
|
{
|
|
@@ -183,11 +183,11 @@ function Ee() {
|
|
|
183
183
|
kind: "preprocessor",
|
|
184
184
|
target: "source_file",
|
|
185
185
|
description: "Wraps each sentence of an element in its own element.",
|
|
186
|
-
settingsSpec: [
|
|
186
|
+
settingsSpec: [re("element", "Element", !1)]
|
|
187
187
|
}
|
|
188
188
|
];
|
|
189
189
|
}
|
|
190
|
-
const
|
|
190
|
+
const k = (s = {}) => ({
|
|
191
191
|
matched: 0,
|
|
192
192
|
created: 0,
|
|
193
193
|
problems: 0,
|
|
@@ -195,13 +195,15 @@ const M = (n = {}) => ({
|
|
|
195
195
|
corrected: 0,
|
|
196
196
|
kept: 0,
|
|
197
197
|
unchanged: 0,
|
|
198
|
-
|
|
199
|
-
|
|
198
|
+
stubbed: 0,
|
|
199
|
+
pendingReferences: 0,
|
|
200
|
+
...s
|
|
201
|
+
}), T = (s) => ({
|
|
200
202
|
importProfile: {
|
|
201
203
|
configurationId: "ip_stub_gesetz",
|
|
202
204
|
name: "Boorberg gesetz",
|
|
203
|
-
releaseId: `ip_stub_gesetz_rel${
|
|
204
|
-
number:
|
|
205
|
+
releaseId: `ip_stub_gesetz_rel${s}`,
|
|
206
|
+
number: s
|
|
205
207
|
},
|
|
206
208
|
mappings: [
|
|
207
209
|
{
|
|
@@ -217,65 +219,138 @@ const M = (n = {}) => ({
|
|
|
217
219
|
releaseId: "es_stub_latin1_rel1",
|
|
218
220
|
number: 1
|
|
219
221
|
}
|
|
220
|
-
}),
|
|
222
|
+
}), M = (s) => ({
|
|
221
223
|
importProfileId: "ip_stub_gesetz",
|
|
222
224
|
importProfileName: "Boorberg gesetz",
|
|
223
|
-
sourceFileId: `sf_${
|
|
224
|
-
startedBy:
|
|
225
|
+
sourceFileId: `sf_${s.id}`,
|
|
226
|
+
startedBy: y,
|
|
225
227
|
phase: "ended",
|
|
226
228
|
failureReason: "",
|
|
227
229
|
progress: { done: 0, total: 0 },
|
|
228
|
-
counts:
|
|
230
|
+
counts: k(),
|
|
229
231
|
changeSetId: "",
|
|
230
|
-
releases:
|
|
232
|
+
releases: T(2),
|
|
231
233
|
createTime: "2026-11-03T09:00:00.000Z",
|
|
232
234
|
startTime: "",
|
|
233
235
|
endTime: "",
|
|
234
236
|
cancelledBy: "",
|
|
235
237
|
effectiveDate: "",
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
238
|
+
dryRun: !1,
|
|
239
|
+
draft: !1,
|
|
240
|
+
assetMoves: [],
|
|
241
|
+
sourceFileDeleteTime: "",
|
|
242
|
+
sourceFileDeletionReason: "",
|
|
243
|
+
...s
|
|
244
|
+
}), $ = (s, a, i, m, f, b = "") => ({
|
|
245
|
+
id: `prob_stub_${s}`,
|
|
239
246
|
mappingId: a === "norm" ? "mp_stub_norm" : "mp_stub_title",
|
|
240
247
|
mappingName: a === "norm" ? "Gesetz norms" : "Gesetz titles",
|
|
241
|
-
sourceKey:
|
|
248
|
+
sourceKey: i,
|
|
242
249
|
field: m,
|
|
243
|
-
reason:
|
|
250
|
+
reason: f,
|
|
251
|
+
displayName: b
|
|
252
|
+
}), A = (s, a, i, m, f = "") => ({
|
|
253
|
+
mappingId: s === "norm" ? "mp_stub_norm" : "mp_stub_title",
|
|
254
|
+
mappingName: s === "norm" ? "Gesetz norms" : "Gesetz titles",
|
|
255
|
+
sourceKey: a,
|
|
256
|
+
displayName: i,
|
|
257
|
+
action: m,
|
|
258
|
+
// Content it would create or stub has none yet.
|
|
259
|
+
contentId: m === "created" || m === "stubbed" ? "" : `ct_${a}`,
|
|
260
|
+
firstDay: f,
|
|
261
|
+
lastDay: ""
|
|
244
262
|
});
|
|
245
|
-
function
|
|
263
|
+
function Ne() {
|
|
246
264
|
return [
|
|
247
|
-
|
|
265
|
+
M({
|
|
248
266
|
id: "im_stub_running",
|
|
249
267
|
phase: "writing",
|
|
250
268
|
progress: { done: 48, total: 120 },
|
|
251
|
-
counts:
|
|
269
|
+
counts: k({ matched: 120, created: 40, planned: 8 }),
|
|
252
270
|
changeSetId: "cs_stub_running",
|
|
253
271
|
createTime: "2026-11-04T10:00:00.000Z",
|
|
254
272
|
startTime: "2026-11-04T10:00:05.000Z"
|
|
255
273
|
}),
|
|
256
|
-
|
|
274
|
+
M({
|
|
257
275
|
id: "im_stub_queued",
|
|
258
276
|
phase: "queued",
|
|
259
|
-
startedBy:
|
|
260
|
-
releases:
|
|
277
|
+
startedBy: U,
|
|
278
|
+
releases: T(2),
|
|
261
279
|
createTime: "2026-11-04T10:05:00.000Z"
|
|
262
280
|
}),
|
|
263
|
-
|
|
281
|
+
M({
|
|
282
|
+
id: "im_stub_dry_run",
|
|
283
|
+
dryRun: !0,
|
|
284
|
+
outcome: "succeeded_with_problems",
|
|
285
|
+
counts: k({
|
|
286
|
+
matched: 8,
|
|
287
|
+
created: 1,
|
|
288
|
+
planned: 1,
|
|
289
|
+
corrected: 1,
|
|
290
|
+
kept: 1,
|
|
291
|
+
stubbed: 1,
|
|
292
|
+
unchanged: 1,
|
|
293
|
+
problems: 2,
|
|
294
|
+
pendingReferences: 1
|
|
295
|
+
}),
|
|
296
|
+
releases: {
|
|
297
|
+
...T(2),
|
|
298
|
+
mappings: [
|
|
299
|
+
...T(2).mappings,
|
|
300
|
+
{
|
|
301
|
+
configurationId: "mp_stub_title",
|
|
302
|
+
name: "Gesetz titles",
|
|
303
|
+
releaseId: "mp_stub_title_rel3",
|
|
304
|
+
number: 3
|
|
305
|
+
}
|
|
306
|
+
]
|
|
307
|
+
},
|
|
308
|
+
createTime: "2026-11-03T15:00:00.000Z",
|
|
309
|
+
startTime: "2026-11-03T15:00:01.000Z",
|
|
310
|
+
endTime: "2026-11-03T15:01:30.000Z",
|
|
311
|
+
dryRunContents: [
|
|
312
|
+
A("norm", "BJNR000040001", "§ 1 Geltungsbereich", "created", "2026-10-01"),
|
|
313
|
+
A("norm", "BJNR000040002", "§ 2 Begriffe", "planned", "2026-10-01"),
|
|
314
|
+
A("norm", "BJNR000040003", "§ 3 Zuständigkeit", "corrected", "2025-01-01"),
|
|
315
|
+
A("norm", "BJNR000040004", "§ 4 Verfahren", "kept", "2025-01-01"),
|
|
316
|
+
A("title", "BY-4", "Bayern, Ausgabe 4", "stubbed"),
|
|
317
|
+
A("norm", "BJNR000040005", "§ 5 Inkrafttreten", "unchanged", "2024-01-01")
|
|
318
|
+
],
|
|
319
|
+
itemProblems: [
|
|
320
|
+
$(6, "norm", "BJNR000040006", "stand/datum", "“30.02.2026” is not a date."),
|
|
321
|
+
{
|
|
322
|
+
...$(
|
|
323
|
+
7,
|
|
324
|
+
"norm",
|
|
325
|
+
"BJNR000040007",
|
|
326
|
+
"verweise/0",
|
|
327
|
+
"No Content has the Source Key BJNR000099001."
|
|
328
|
+
),
|
|
329
|
+
pendingReference: {
|
|
330
|
+
targetMappingId: "mp_stub_norm",
|
|
331
|
+
targetBlueprintId: "bp_stub_gesetz",
|
|
332
|
+
targetSourceKey: "BJNR000099001"
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
]
|
|
336
|
+
}),
|
|
337
|
+
M({
|
|
264
338
|
id: "im_stub_problems",
|
|
265
339
|
outcome: "succeeded_with_problems",
|
|
266
|
-
counts:
|
|
340
|
+
counts: k({
|
|
267
341
|
matched: 212,
|
|
268
342
|
created: 180,
|
|
269
343
|
planned: 20,
|
|
270
344
|
corrected: 6,
|
|
271
345
|
kept: 1,
|
|
272
|
-
problems:
|
|
346
|
+
problems: 6,
|
|
347
|
+
pendingReferences: 1
|
|
273
348
|
}),
|
|
274
349
|
changeSetId: "cs_stub_problems",
|
|
275
350
|
releases: {
|
|
276
|
-
...
|
|
351
|
+
...T(2),
|
|
277
352
|
mappings: [
|
|
278
|
-
...
|
|
353
|
+
...T(2).mappings,
|
|
279
354
|
{
|
|
280
355
|
configurationId: "mp_stub_title",
|
|
281
356
|
name: "Gesetz titles",
|
|
@@ -290,52 +365,77 @@ function Re() {
|
|
|
290
365
|
effectiveDate: "2026-10-01",
|
|
291
366
|
source: { date: "2026-09-20", reference: "BGBl. 2026 I Nr. 270" },
|
|
292
367
|
itemProblems: [
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
368
|
+
$(1, "norm", "BJNR000010001", "stand/datum", "“31.02.2026” is not a date."),
|
|
369
|
+
$(2, "norm", "BJNR000010002", "", "The Version Match found two Releases."),
|
|
370
|
+
$(3, "title", "BJNR000020001", "", "No Title has the Ausgabe code BY-7."),
|
|
371
|
+
$(4, "norm", "BJNR000030001", "titel", "The field is required."),
|
|
372
|
+
$(5, "title", "BJNR000030002", "", "No Title has the Ausgabe code BY-9."),
|
|
373
|
+
{
|
|
374
|
+
...$(
|
|
375
|
+
8,
|
|
376
|
+
"norm",
|
|
377
|
+
"BJNR000050003",
|
|
378
|
+
"verweise/1",
|
|
379
|
+
"No Content has the Source Key BJNR000099002.",
|
|
380
|
+
"§ 3 Anwendungsbereich"
|
|
381
|
+
),
|
|
382
|
+
pendingReference: {
|
|
383
|
+
targetMappingId: "mp_stub_norm",
|
|
384
|
+
targetBlueprintId: "bp_stub_gesetz",
|
|
385
|
+
targetSourceKey: "BJNR000099002"
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
],
|
|
389
|
+
// Two Placeholder Assets found outside the folder mirroring their
|
|
390
|
+
// path (link-placeholder-assets-in-mediahub:AC7).
|
|
391
|
+
assetMoves: [
|
|
392
|
+
{ key: "grafik/bgbl-2026-270-abb1.png", from: "(no folder)", to: "Grafiken / BGBl / 2026" },
|
|
393
|
+
{ key: "formel/f12.mml", from: "Import / alt", to: "Formeln / 2026" }
|
|
298
394
|
]
|
|
299
395
|
}),
|
|
300
|
-
|
|
396
|
+
M({
|
|
301
397
|
id: "im_stub_succeeded",
|
|
302
398
|
outcome: "succeeded",
|
|
303
|
-
counts:
|
|
399
|
+
counts: k({ matched: 64, created: 64 }),
|
|
304
400
|
changeSetId: "cs_stub_succeeded",
|
|
305
|
-
releases:
|
|
401
|
+
releases: T(1),
|
|
306
402
|
createTime: "2026-11-02T14:00:00.000Z",
|
|
307
403
|
startTime: "2026-11-02T14:00:01.000Z",
|
|
308
|
-
endTime: "2026-11-02T14:03:10.000Z"
|
|
404
|
+
endTime: "2026-11-02T14:03:10.000Z",
|
|
405
|
+
// Its Profile deletes the Source File once an Import Succeeds without
|
|
406
|
+
// Item Problems (re-run-a-source-file:AC2), so it offers no Re-run.
|
|
407
|
+
sourceFileDeleteTime: "2026-11-02T14:03:11.000Z",
|
|
408
|
+
sourceFileDeletionReason: "Deleted when the Import succeeded without Item Problems, as its Import Profile says."
|
|
309
409
|
}),
|
|
310
|
-
|
|
410
|
+
M({
|
|
311
411
|
id: "im_stub_failed",
|
|
312
412
|
outcome: "failed",
|
|
313
413
|
failureReason: "The worker crashed three times running this Import.",
|
|
314
|
-
counts:
|
|
315
|
-
releases:
|
|
414
|
+
counts: k({ matched: 30 }),
|
|
415
|
+
releases: T(1),
|
|
316
416
|
createTime: "2026-11-02T11:00:00.000Z",
|
|
317
417
|
startTime: "2026-11-02T11:00:01.000Z",
|
|
318
418
|
endTime: "2026-11-02T11:20:00.000Z"
|
|
319
419
|
}),
|
|
320
|
-
|
|
420
|
+
M({
|
|
321
421
|
id: "im_stub_cancelled",
|
|
322
422
|
outcome: "cancelled",
|
|
323
|
-
cancelledBy:
|
|
324
|
-
counts:
|
|
325
|
-
releases:
|
|
423
|
+
cancelledBy: U,
|
|
424
|
+
counts: k({ matched: 12, created: 3 }),
|
|
425
|
+
releases: T(1),
|
|
326
426
|
createTime: "2026-11-01T16:00:00.000Z",
|
|
327
427
|
startTime: "2026-11-01T16:00:01.000Z",
|
|
328
428
|
endTime: "2026-11-01T16:01:00.000Z"
|
|
329
429
|
})
|
|
330
430
|
];
|
|
331
431
|
}
|
|
332
|
-
function
|
|
432
|
+
function Be() {
|
|
333
433
|
return [
|
|
334
434
|
{
|
|
335
435
|
id: "key_stub_nightly",
|
|
336
436
|
name: "Nightly gesetz feed",
|
|
337
437
|
keyPrefix: "ihk_7Qx2",
|
|
338
|
-
owner:
|
|
438
|
+
owner: U,
|
|
339
439
|
expireTime: "",
|
|
340
440
|
createTime: "2026-11-20T07:30:00.000Z"
|
|
341
441
|
},
|
|
@@ -343,80 +443,80 @@ function Me() {
|
|
|
343
443
|
id: "key_stub_pipeline",
|
|
344
444
|
name: "VRPML pipeline",
|
|
345
445
|
keyPrefix: "ihk_b91F",
|
|
346
|
-
owner:
|
|
446
|
+
owner: y,
|
|
347
447
|
expireTime: "2027-06-30T21:59:59.000Z",
|
|
348
448
|
createTime: "2026-11-03T12:00:00.000Z"
|
|
349
449
|
}
|
|
350
450
|
];
|
|
351
451
|
}
|
|
352
|
-
const
|
|
353
|
-
function
|
|
354
|
-
return
|
|
452
|
+
const Fe = /* @__PURE__ */ new Set(["amp", "lt", "gt", "quot", "apos"]);
|
|
453
|
+
function De(s, a) {
|
|
454
|
+
return s.replace(
|
|
355
455
|
/&([A-Za-z_][\w.-]*);/g,
|
|
356
|
-
(
|
|
456
|
+
(i, m) => !Fe.has(m) && m in a ? a[m] ?? i : i
|
|
357
457
|
);
|
|
358
458
|
}
|
|
359
|
-
function Ae(
|
|
459
|
+
function Ae(s, a) {
|
|
360
460
|
if (typeof DOMParser > "u")
|
|
361
461
|
throw new Error("the stub's Mapping Test reads the sample with the DOM: run it in a browser");
|
|
362
|
-
const
|
|
462
|
+
const i = new DOMParser().parseFromString(a, "application/xml"), m = i.getElementsByTagName("parsererror")[0];
|
|
363
463
|
if (m)
|
|
364
|
-
throw new
|
|
464
|
+
throw new z(
|
|
365
465
|
`the sample is not XML: ${(m.textContent ?? "").split(`
|
|
366
466
|
`)[0]}`
|
|
367
467
|
);
|
|
368
|
-
const
|
|
369
|
-
if (!
|
|
370
|
-
const
|
|
468
|
+
const f = s.elementSelector?.trim() ?? "";
|
|
469
|
+
if (!f) throw new z("the Mapping has no element selector");
|
|
470
|
+
const b = (() => {
|
|
371
471
|
try {
|
|
372
|
-
const d =
|
|
373
|
-
return Array.from({ length: d.snapshotLength }, (
|
|
472
|
+
const d = i.evaluate(f, i, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
|
|
473
|
+
return Array.from({ length: d.snapshotLength }, (g, _) => d.snapshotItem(_));
|
|
374
474
|
} catch {
|
|
375
|
-
throw new
|
|
475
|
+
throw new z(`the element selector ${f} cannot be evaluated`);
|
|
376
476
|
}
|
|
377
|
-
})(),
|
|
477
|
+
})(), o = s.sourceKey?.selector?.trim() ?? "";
|
|
378
478
|
return {
|
|
379
|
-
elements:
|
|
479
|
+
elements: b.map((d, g) => {
|
|
380
480
|
const _ = [];
|
|
381
481
|
let w = "";
|
|
382
|
-
if (
|
|
482
|
+
if (o)
|
|
383
483
|
try {
|
|
384
|
-
w =
|
|
484
|
+
w = ye(i, o, d).trim();
|
|
385
485
|
} catch {
|
|
386
|
-
throw new
|
|
486
|
+
throw new z(`the Source Key ${o} cannot be evaluated`);
|
|
387
487
|
}
|
|
388
488
|
w || _.push({ field: "", reason: "the element has no Source Key" });
|
|
389
|
-
const I =
|
|
489
|
+
const I = Ie(i, s.fields ?? [], d, "", _);
|
|
390
490
|
return {
|
|
391
|
-
position:
|
|
491
|
+
position: g + 1,
|
|
392
492
|
sourceKey: w,
|
|
393
493
|
values: I,
|
|
394
494
|
firstDay: "",
|
|
395
495
|
lastDay: "",
|
|
396
496
|
releaseSpec: {},
|
|
397
497
|
displayName: "",
|
|
398
|
-
collections: [...
|
|
498
|
+
collections: [...s.collections ?? []],
|
|
399
499
|
problems: _
|
|
400
500
|
};
|
|
401
501
|
})
|
|
402
502
|
};
|
|
403
503
|
}
|
|
404
|
-
function
|
|
405
|
-
return
|
|
504
|
+
function ye(s, a, i) {
|
|
505
|
+
return s.evaluate(`string(${a})`, i, null, XPathResult.STRING_TYPE, null).stringValue;
|
|
406
506
|
}
|
|
407
|
-
function
|
|
408
|
-
const
|
|
409
|
-
for (const
|
|
410
|
-
const d = typeof
|
|
507
|
+
function Ie(s, a, i, m, f) {
|
|
508
|
+
const b = {};
|
|
509
|
+
for (const o of a) {
|
|
510
|
+
const d = typeof o.name == "string" ? o.name : "";
|
|
411
511
|
if (!d) continue;
|
|
412
|
-
const
|
|
413
|
-
if (
|
|
414
|
-
let I =
|
|
512
|
+
const g = m ? `${m}.${d}` : d, _ = typeof o.selector == "string" ? o.selector.trim() : "";
|
|
513
|
+
if (o.type === "fieldset") {
|
|
514
|
+
let I = i;
|
|
415
515
|
if (_ && _ !== ".")
|
|
416
516
|
try {
|
|
417
|
-
I =
|
|
517
|
+
I = s.evaluate(
|
|
418
518
|
_,
|
|
419
|
-
|
|
519
|
+
i,
|
|
420
520
|
null,
|
|
421
521
|
XPathResult.FIRST_ORDERED_NODE_TYPE,
|
|
422
522
|
null
|
|
@@ -425,33 +525,33 @@ function ye(n, a, o, m, g) {
|
|
|
425
525
|
I = null;
|
|
426
526
|
}
|
|
427
527
|
if (!I) {
|
|
428
|
-
|
|
528
|
+
o.optional || f.push({ field: g, reason: `nothing at ${_}` });
|
|
429
529
|
continue;
|
|
430
530
|
}
|
|
431
|
-
const
|
|
432
|
-
|
|
531
|
+
const O = Array.isArray(o.fields) ? o.fields : [];
|
|
532
|
+
b[d] = Ie(s, O, I, g, f);
|
|
433
533
|
continue;
|
|
434
534
|
}
|
|
435
535
|
if (!_) {
|
|
436
|
-
|
|
536
|
+
f.push({ field: g, reason: "the field has no XPath" });
|
|
437
537
|
continue;
|
|
438
538
|
}
|
|
439
539
|
let w;
|
|
440
540
|
try {
|
|
441
|
-
w =
|
|
541
|
+
w = ye(s, _, i).trim();
|
|
442
542
|
} catch {
|
|
443
|
-
|
|
543
|
+
f.push({ field: g, reason: `the XPath ${_} cannot be evaluated` });
|
|
444
544
|
continue;
|
|
445
545
|
}
|
|
446
546
|
if (!w) {
|
|
447
|
-
|
|
547
|
+
o.optional || f.push({ field: g, reason: `nothing at ${_}` });
|
|
448
548
|
continue;
|
|
449
549
|
}
|
|
450
|
-
|
|
550
|
+
b[d] = w;
|
|
451
551
|
}
|
|
452
|
-
return
|
|
552
|
+
return b;
|
|
453
553
|
}
|
|
454
|
-
const
|
|
554
|
+
const xe = [
|
|
455
555
|
"listImportProfiles",
|
|
456
556
|
"getImportProfile",
|
|
457
557
|
"createImportProfile",
|
|
@@ -480,113 +580,116 @@ const Be = [
|
|
|
480
580
|
"listImports",
|
|
481
581
|
"getImport",
|
|
482
582
|
"cancelImport",
|
|
583
|
+
"rerunImport",
|
|
483
584
|
"listItemProblems",
|
|
585
|
+
"startDryRun",
|
|
586
|
+
"listDryRunContents",
|
|
484
587
|
"listApiKeys",
|
|
485
588
|
"createApiKey",
|
|
486
589
|
"revokeApiKey"
|
|
487
590
|
];
|
|
488
|
-
let
|
|
489
|
-
const
|
|
490
|
-
const
|
|
491
|
-
id: `${a.id}_r${
|
|
591
|
+
let ge = Date.parse("2026-11-02T08:00:00Z");
|
|
592
|
+
const N = () => (ge += 36e5, new Date(ge).toISOString()), ie = (s = []) => s.map((a) => {
|
|
593
|
+
const i = Math.max(a.releaseNumber ?? 0, 1), m = Array.from({ length: i }, (b, o) => ({
|
|
594
|
+
id: `${a.id}_r${o + 1}`,
|
|
492
595
|
content: structuredClone(a.content),
|
|
493
|
-
savedBy:
|
|
494
|
-
savedAt:
|
|
596
|
+
savedBy: y,
|
|
597
|
+
savedAt: N(),
|
|
495
598
|
restoredFromRevisionId: ""
|
|
496
|
-
})),
|
|
497
|
-
id: `${a.id}_rel${
|
|
498
|
-
number:
|
|
499
|
-
revisionId: `${a.id}_r${
|
|
500
|
-
releasedBy:
|
|
501
|
-
releasedAt:
|
|
599
|
+
})), f = Array.from({ length: a.releaseNumber ?? 0 }, (b, o) => ({
|
|
600
|
+
id: `${a.id}_rel${o + 1}`,
|
|
601
|
+
number: o + 1,
|
|
602
|
+
revisionId: `${a.id}_r${o + 1}`,
|
|
603
|
+
releasedBy: y,
|
|
604
|
+
releasedAt: N()
|
|
502
605
|
}));
|
|
503
|
-
return { id: a.id, content: structuredClone(a.content), revisions: m, releases:
|
|
504
|
-
}),
|
|
505
|
-
const a =
|
|
606
|
+
return { id: a.id, content: structuredClone(a.content), revisions: m, releases: f };
|
|
607
|
+
}), C = (s) => s.revisions[s.revisions.length - 1], Se = (s) => s.releases[s.releases.length - 1], j = (s) => {
|
|
608
|
+
const a = Se(s), i = s.revisions.find((m) => m.id === a?.revisionId);
|
|
506
609
|
return {
|
|
507
|
-
draftRevisionId:
|
|
610
|
+
draftRevisionId: C(s).id,
|
|
508
611
|
// By content, as importhub compares: a draft that restored the
|
|
509
612
|
// released content does not differ.
|
|
510
|
-
draftDiffersFromRelease: !
|
|
613
|
+
draftDiffersFromRelease: !i || JSON.stringify(i.content) !== JSON.stringify(C(s).content),
|
|
511
614
|
...a ? { latestRelease: { id: a.id, number: a.number } } : {}
|
|
512
615
|
};
|
|
513
|
-
},
|
|
514
|
-
Object.entries(
|
|
515
|
-
),
|
|
516
|
-
valid:
|
|
517
|
-
reasons:
|
|
518
|
-
}),
|
|
519
|
-
let
|
|
520
|
-
function
|
|
616
|
+
}, Ce = (s) => s.replace(/[A-Z]/g, (a) => `_${a.toLowerCase()}`), he = (s) => Object.fromEntries(
|
|
617
|
+
Object.entries(s).map(([a, i]) => [Ce(a), i])
|
|
618
|
+
), x = (s) => ({
|
|
619
|
+
valid: s.length === 0,
|
|
620
|
+
reasons: s
|
|
621
|
+
}), q = (s) => [...s].sort((a, i) => a.content.name.localeCompare(i.content.name));
|
|
622
|
+
let _e = 0;
|
|
623
|
+
function qe(s = {}) {
|
|
521
624
|
const a = Object.fromEntries(
|
|
522
625
|
Object.entries(
|
|
523
|
-
|
|
524
|
-
[
|
|
525
|
-
importProfiles:
|
|
526
|
-
mappings:
|
|
527
|
-
entitySets:
|
|
528
|
-
imports:
|
|
529
|
-
apiKeys:
|
|
626
|
+
s.workspaces ?? {
|
|
627
|
+
[oe]: {
|
|
628
|
+
importProfiles: Me(),
|
|
629
|
+
mappings: $e(),
|
|
630
|
+
entitySets: Ee(),
|
|
631
|
+
imports: Ne(),
|
|
632
|
+
apiKeys: Be()
|
|
530
633
|
}
|
|
531
634
|
}
|
|
532
635
|
).map(([e, t]) => [
|
|
533
636
|
e,
|
|
534
637
|
{
|
|
535
|
-
importProfiles:
|
|
536
|
-
mappings:
|
|
537
|
-
entitySets:
|
|
638
|
+
importProfiles: ie(t.importProfiles),
|
|
639
|
+
mappings: ie(t.mappings),
|
|
640
|
+
entitySets: ie(t.entitySets),
|
|
538
641
|
imports: structuredClone(t.imports ?? []),
|
|
539
642
|
apiKeys: structuredClone(t.apiKeys ?? [])
|
|
540
643
|
}
|
|
541
644
|
])
|
|
542
|
-
),
|
|
543
|
-
let
|
|
544
|
-
const
|
|
645
|
+
), i = s.processors ?? ke(), m = s.blueprintReleases ?? be();
|
|
646
|
+
let f = s.activeWorkspaceId ?? oe;
|
|
647
|
+
const b = Object.fromEntries(xe.map((e) => [e, 0])), o = () => (a[f] ??= {
|
|
545
648
|
importProfiles: [],
|
|
546
649
|
mappings: [],
|
|
547
650
|
entitySets: [],
|
|
548
651
|
imports: [],
|
|
549
652
|
apiKeys: []
|
|
550
|
-
}, a[
|
|
551
|
-
if (
|
|
653
|
+
}, a[f]), d = async (e, t) => {
|
|
654
|
+
if (b[e]++, s.fail) throw s.fail;
|
|
552
655
|
return structuredClone(t());
|
|
553
|
-
},
|
|
554
|
-
const
|
|
555
|
-
if (!
|
|
556
|
-
return
|
|
557
|
-
}, _ = (e, t,
|
|
656
|
+
}, g = (e, t, n) => {
|
|
657
|
+
const r = e.find((c) => c.id === t);
|
|
658
|
+
if (!r) throw new Error(`${n} ${t} not found`);
|
|
659
|
+
return r;
|
|
660
|
+
}, _ = (e, t, n) => {
|
|
558
661
|
if (!t.trim()) throw new Error("a name is required");
|
|
559
|
-
if (e.some((
|
|
560
|
-
}, w = (e, t) => t !== "" && t !==
|
|
561
|
-
if (w(e,
|
|
662
|
+
if (e.some((r) => r.id !== n && r.content.name === t)) throw new Te();
|
|
663
|
+
}, w = (e, t) => t !== "" && t !== C(e).id, I = (e, t, n, r = "") => {
|
|
664
|
+
if (w(e, n))
|
|
562
665
|
throw new Error("the draft moved: somebody saved in between");
|
|
563
666
|
e.content = structuredClone(t), e.revisions.push({
|
|
564
667
|
id: `${e.id}_r${e.revisions.length + 1}`,
|
|
565
668
|
content: structuredClone(t),
|
|
566
|
-
savedBy:
|
|
567
|
-
savedAt:
|
|
568
|
-
restoredFromRevisionId:
|
|
669
|
+
savedBy: y,
|
|
670
|
+
savedAt: N(),
|
|
671
|
+
restoredFromRevisionId: r
|
|
569
672
|
});
|
|
570
|
-
},
|
|
571
|
-
const
|
|
673
|
+
}, O = (e, t) => {
|
|
674
|
+
const n = Y(e);
|
|
572
675
|
return {
|
|
573
|
-
id:
|
|
676
|
+
id: n,
|
|
574
677
|
content: structuredClone(t),
|
|
575
678
|
revisions: [
|
|
576
679
|
{
|
|
577
|
-
id: `${
|
|
680
|
+
id: `${n}_r1`,
|
|
578
681
|
content: structuredClone(t),
|
|
579
|
-
savedBy:
|
|
580
|
-
savedAt:
|
|
682
|
+
savedBy: y,
|
|
683
|
+
savedAt: N(),
|
|
581
684
|
restoredFromRevisionId: ""
|
|
582
685
|
}
|
|
583
686
|
],
|
|
584
687
|
releases: []
|
|
585
688
|
};
|
|
586
689
|
};
|
|
587
|
-
function
|
|
588
|
-
const t = [],
|
|
589
|
-
e.blueprintReleaseId ?
|
|
690
|
+
function X(e) {
|
|
691
|
+
const t = [], n = m.find((p) => p.id === e.blueprintReleaseId);
|
|
692
|
+
e.blueprintReleaseId ? n ? n.blueprintId !== e.blueprintId && t.push({
|
|
590
693
|
path: "/blueprintReleaseId",
|
|
591
694
|
code: "release_of_other_blueprint",
|
|
592
695
|
message: "The pinned Release is of another Blueprint."
|
|
@@ -603,522 +706,573 @@ function Ge(n = {}) {
|
|
|
603
706
|
code: "no_element_selector",
|
|
604
707
|
message: "It has no element selector."
|
|
605
708
|
}), !e.sourceKey?.selector && !e.sourceKey?.template && t.push({ path: "/sourceKey", code: "no_source_key", message: "It has no Source Key." });
|
|
606
|
-
const
|
|
607
|
-
typeof
|
|
709
|
+
const r = (p, l) => {
|
|
710
|
+
typeof l == "string" && l !== "" && !Oe(l) && t.push({ path: p, code: "invalid_xpath", message: `"${l}" is not an XPath.` });
|
|
608
711
|
};
|
|
609
|
-
|
|
610
|
-
const
|
|
611
|
-
return (e.fields ?? []).forEach((p,
|
|
612
|
-
const
|
|
613
|
-
for (const { path:
|
|
614
|
-
|
|
615
|
-
path:
|
|
712
|
+
r("/element_selector", e.elementSelector), r("/source_key/selector", e.sourceKey?.selector);
|
|
713
|
+
const c = [];
|
|
714
|
+
return (e.fields ?? []).forEach((p, l) => {
|
|
715
|
+
const u = `/fields/${l}`;
|
|
716
|
+
for (const { path: h, rel: v, mapping: P } of ae(p, "", u))
|
|
717
|
+
c.push(h), r(`${v}/selector`, P.selector), n && !n.fieldPaths.includes(h) && t.push({
|
|
718
|
+
path: u,
|
|
616
719
|
code: "unknown_field_path",
|
|
617
|
-
message: `The pinned Release has no field ${
|
|
618
|
-
}),
|
|
619
|
-
path:
|
|
720
|
+
message: `The pinned Release has no field ${h}.`
|
|
721
|
+
}), P.type === "select" && !P.selectOptions && t.push({
|
|
722
|
+
path: u,
|
|
620
723
|
code: "xmlmapper_schema",
|
|
621
|
-
message: `The select field ${
|
|
724
|
+
message: `The select field ${h} has no select options.`
|
|
622
725
|
});
|
|
623
|
-
}), (e.versionMatch?.contentFields ?? []).forEach((p,
|
|
624
|
-
|
|
625
|
-
path: `/version_match/content_fields/${
|
|
726
|
+
}), (e.versionMatch?.contentFields ?? []).forEach((p, l) => {
|
|
727
|
+
c.includes(p) || t.push({
|
|
728
|
+
path: `/version_match/content_fields/${l}`,
|
|
626
729
|
code: "unknown_version_match_field",
|
|
627
730
|
message: `The Version Match compares ${p}, which the Mapping does not map.`
|
|
628
731
|
});
|
|
629
|
-
}), (e.titleContributions ?? []).forEach((p,
|
|
732
|
+
}), (e.titleContributions ?? []).forEach((p, l) => {
|
|
630
733
|
(!p.selector || !p.ausgabeCodeSelector) && t.push({
|
|
631
|
-
path: `/title_contributions/${
|
|
734
|
+
path: `/title_contributions/${l}`,
|
|
632
735
|
code: "incomplete_title_contribution",
|
|
633
736
|
message: "A Title Contribution needs a selector and an Ausgabe code selector."
|
|
634
|
-
}),
|
|
635
|
-
}), (e.placeholderAssets ?? []).forEach((p,
|
|
737
|
+
}), r(`/title_contributions/${l}/selector`, p.selector);
|
|
738
|
+
}), (e.placeholderAssets ?? []).forEach((p, l) => {
|
|
636
739
|
(!p.selector || !p.assetType || !p.keyParts?.length || !p.nameSelector) && t.push({
|
|
637
|
-
path: `/placeholder_assets/${
|
|
740
|
+
path: `/placeholder_assets/${l}`,
|
|
638
741
|
code: "incomplete_placeholder_assets",
|
|
639
742
|
message: "Placeholder Assets need a selector, an asset type, the key's parts and a name selector."
|
|
640
|
-
}),
|
|
641
|
-
|
|
743
|
+
}), r(`/placeholder_assets/${l}/selector`, p.selector), (p.keyParts ?? []).forEach((u, h) => {
|
|
744
|
+
r(`/placeholder_assets/${l}/key_parts/${h}`, u);
|
|
642
745
|
});
|
|
643
|
-
}), t.push(...
|
|
746
|
+
}), t.push(...Ke(e, n?.fields, c)), t;
|
|
644
747
|
}
|
|
645
|
-
function
|
|
646
|
-
return e.flatMap((
|
|
647
|
-
const p = `/${t}/${
|
|
648
|
-
return
|
|
748
|
+
function le(e, t, n) {
|
|
749
|
+
return e.flatMap((r, c) => {
|
|
750
|
+
const p = `/${t}/${c}`, l = i.find((h) => h.name === r.processor);
|
|
751
|
+
return l ? l.target !== "source_file" ? [
|
|
649
752
|
{
|
|
650
753
|
path: p,
|
|
651
754
|
code: "rich_text_processor",
|
|
652
|
-
message: `${
|
|
755
|
+
message: `${l.name} is configured on a rich-text field, not on a Profile.`
|
|
653
756
|
}
|
|
654
|
-
] :
|
|
655
|
-
(
|
|
656
|
-
).map((
|
|
657
|
-
path: `${p}/settings/${
|
|
757
|
+
] : l.kind !== n ? [{ path: p, code: "wrong_processor_kind", message: `${l.name} does not run here.` }] : l.settingsSpec.filter(
|
|
758
|
+
(h) => h.config.required && (r.settings[h.config.api_accessor] ?? "") === ""
|
|
759
|
+
).map((h) => ({
|
|
760
|
+
path: `${p}/settings/${h.config.api_accessor}`,
|
|
658
761
|
code: "invalid_processor_settings",
|
|
659
|
-
message: `${
|
|
762
|
+
message: `${l.name}: ${h.config.api_accessor} is required.`
|
|
660
763
|
})) : [
|
|
661
|
-
{ path: p, code: "unknown_processor", message: `No Processor is called ${
|
|
764
|
+
{ path: p, code: "unknown_processor", message: `No Processor is called ${r.processor}.` }
|
|
662
765
|
];
|
|
663
766
|
});
|
|
664
767
|
}
|
|
665
|
-
function
|
|
666
|
-
const t =
|
|
667
|
-
...
|
|
668
|
-
...
|
|
768
|
+
function V(e) {
|
|
769
|
+
const t = o(), n = [
|
|
770
|
+
...le(e.preprocessors, "preprocessors", "preprocessor"),
|
|
771
|
+
...le(e.postProcessors, "postProcessors", "post_processor")
|
|
669
772
|
];
|
|
670
|
-
return e.mappingIds.length === 0 &&
|
|
671
|
-
const p = t.mappings.find((
|
|
773
|
+
return e.mappingIds.length === 0 && n.push({ path: "/mappingIds", code: "no_mappings", message: "It includes no Mapping." }), e.mappingIds.forEach((r, c) => {
|
|
774
|
+
const p = t.mappings.find((u) => u.id === r);
|
|
672
775
|
if (!p) {
|
|
673
|
-
|
|
674
|
-
path: `/mappingIds/${
|
|
776
|
+
n.push({
|
|
777
|
+
path: `/mappingIds/${c}`,
|
|
675
778
|
code: "mapping_missing",
|
|
676
779
|
message: "It includes a Mapping that does not exist."
|
|
677
780
|
});
|
|
678
781
|
return;
|
|
679
782
|
}
|
|
680
|
-
const
|
|
681
|
-
|
|
682
|
-
path: `/mappingIds/${
|
|
783
|
+
const l = X(p.content);
|
|
784
|
+
l.length > 0 && n.push({
|
|
785
|
+
path: `/mappingIds/${c}`,
|
|
683
786
|
code: "mapping_invalid",
|
|
684
|
-
message: `The Mapping ${p.content.name} is invalid: ${
|
|
787
|
+
message: `The Mapping ${p.content.name} is invalid: ${l.map((u) => u.message).join(" ")}`
|
|
685
788
|
});
|
|
686
|
-
}), e.entitySetId && !t.entitySets.some((
|
|
789
|
+
}), e.entitySetId && !t.entitySets.some((r) => r.id === e.entitySetId) && n.push({
|
|
687
790
|
path: "/entitySetId",
|
|
688
791
|
code: "entity_set_missing",
|
|
689
792
|
message: "It names an Entity Set that does not exist."
|
|
690
|
-
}),
|
|
793
|
+
}), n;
|
|
691
794
|
}
|
|
692
|
-
const
|
|
795
|
+
const ce = (e) => Object.keys(e.entities).length === 0 ? [{ path: "/entities", code: "no_entities", message: "It defines no entity." }] : [], Z = (e) => ({
|
|
693
796
|
id: e.id,
|
|
694
797
|
content: e.content,
|
|
695
|
-
validity:
|
|
696
|
-
state:
|
|
697
|
-
}),
|
|
798
|
+
validity: x(V(e.content)),
|
|
799
|
+
state: j(e)
|
|
800
|
+
}), J = (e) => ({
|
|
698
801
|
id: e.id,
|
|
699
802
|
content: e.content,
|
|
700
|
-
validity:
|
|
701
|
-
state:
|
|
702
|
-
}),
|
|
803
|
+
validity: x(X(e.content)),
|
|
804
|
+
state: j(e)
|
|
805
|
+
}), G = (e) => ({
|
|
703
806
|
id: e.id,
|
|
704
807
|
content: e.content,
|
|
705
|
-
validity:
|
|
706
|
-
state:
|
|
707
|
-
}),
|
|
808
|
+
validity: x(ce(e.content)),
|
|
809
|
+
state: j(e)
|
|
810
|
+
}), L = (e) => q(o().importProfiles.filter((t) => e(t.content))).map((t) => ({
|
|
708
811
|
id: t.id,
|
|
709
812
|
name: t.content.name
|
|
710
|
-
})),
|
|
711
|
-
const t =
|
|
813
|
+
})), Y = (e) => `${e}_stub_new_${++_e}`, K = (e) => {
|
|
814
|
+
const t = o();
|
|
712
815
|
switch (e) {
|
|
713
816
|
case "importProfile":
|
|
714
817
|
return {
|
|
715
818
|
items: t.importProfiles,
|
|
716
819
|
name: "Import Profile",
|
|
717
|
-
reasons: (
|
|
820
|
+
reasons: (n) => V(n)
|
|
718
821
|
};
|
|
719
822
|
case "mapping":
|
|
720
823
|
return {
|
|
721
824
|
items: t.mappings,
|
|
722
825
|
name: "Mapping",
|
|
723
|
-
reasons: (
|
|
826
|
+
reasons: (n) => X(n)
|
|
724
827
|
};
|
|
725
828
|
case "entitySet":
|
|
726
829
|
return {
|
|
727
830
|
items: t.entitySets,
|
|
728
831
|
name: "Entity Set",
|
|
729
|
-
reasons: (
|
|
832
|
+
reasons: (n) => ce(n)
|
|
730
833
|
};
|
|
731
834
|
}
|
|
732
|
-
},
|
|
733
|
-
|
|
734
|
-
},
|
|
735
|
-
const
|
|
736
|
-
if (!
|
|
737
|
-
return
|
|
738
|
-
},
|
|
739
|
-
const t =
|
|
835
|
+
}, E = (e, t) => {
|
|
836
|
+
C(t).validity = x(K(e).reasons(t.content));
|
|
837
|
+
}, W = (e, t) => {
|
|
838
|
+
const n = e.revisions.find((r) => r.id === t);
|
|
839
|
+
if (!n) throw new Error(`Revision ${t} not found`);
|
|
840
|
+
return n;
|
|
841
|
+
}, Q = /* @__PURE__ */ new Set(), pe = s.contenthubRights ?? ["editor", "publisher"], B = (e) => {
|
|
842
|
+
const t = o().imports.find((n) => n.id === e);
|
|
740
843
|
if (!t) throw new Error(`Import ${e} not found`);
|
|
741
844
|
return t;
|
|
742
|
-
},
|
|
743
|
-
e.cancelledBy && e.phase !== "ended" && (e.phase = "ended", e.outcome = "cancelled", e.endTime =
|
|
744
|
-
},
|
|
745
|
-
const
|
|
746
|
-
if (!
|
|
747
|
-
throw new
|
|
748
|
-
const
|
|
845
|
+
}, ee = (e) => {
|
|
846
|
+
e.cancelledBy && e.phase !== "ended" && (e.phase = "ended", e.outcome = "cancelled", e.endTime = N());
|
|
847
|
+
}, F = ({ itemProblems: e, dryRunContents: t, ...n }) => n, we = (e, t) => {
|
|
848
|
+
const n = Se(e);
|
|
849
|
+
if (!n)
|
|
850
|
+
throw new D(`the ${t} ${e.content.name} has no Release yet`);
|
|
851
|
+
const r = e.revisions.find((c) => c.id === n.revisionId)?.content ?? e.content;
|
|
749
852
|
return {
|
|
750
|
-
content:
|
|
853
|
+
content: r,
|
|
751
854
|
ref: {
|
|
752
855
|
configurationId: e.id,
|
|
753
|
-
name:
|
|
754
|
-
releaseId:
|
|
755
|
-
number:
|
|
856
|
+
name: r.name,
|
|
857
|
+
releaseId: n.id,
|
|
858
|
+
number: n.number
|
|
756
859
|
}
|
|
757
860
|
};
|
|
861
|
+
}, Pe = (e) => ({
|
|
862
|
+
content: e.content,
|
|
863
|
+
ref: {
|
|
864
|
+
configurationId: e.id,
|
|
865
|
+
name: e.content.name,
|
|
866
|
+
releaseId: "",
|
|
867
|
+
number: 0,
|
|
868
|
+
revisionId: C(e).id
|
|
869
|
+
}
|
|
870
|
+
}), te = (e, t) => {
|
|
871
|
+
const n = o(), r = t && (e.draft ?? !1), c = g(n.importProfiles, e.importProfileId, "Import Profile");
|
|
872
|
+
if (!Q.has(e.sourceFileId))
|
|
873
|
+
throw new D("nothing was uploaded to the Source File");
|
|
874
|
+
if (!t && !pe.includes("editor"))
|
|
875
|
+
throw new D("starting an Import needs contenthub editor in the workspace");
|
|
876
|
+
const p = (R, ne) => r ? Pe(R) : we(R, ne), l = p(c, "Import Profile");
|
|
877
|
+
if (!t && l.content.autoPublish && !pe.includes("publisher"))
|
|
878
|
+
throw new D(
|
|
879
|
+
"the Import Profile has Auto-publish, which needs contenthub publisher"
|
|
880
|
+
);
|
|
881
|
+
const u = V(l.content);
|
|
882
|
+
if (u.length > 0)
|
|
883
|
+
throw new D(
|
|
884
|
+
`the ${r ? "draft of the " : ""}Import Profile ${l.ref.name} is invalid: ${u.map((R) => R.message).join(" ")}`
|
|
885
|
+
);
|
|
886
|
+
const h = l.content.mappingIds.map(
|
|
887
|
+
(R) => p(g(n.mappings, R, "Mapping"), "Mapping").ref
|
|
888
|
+
), v = l.content.entitySetId ? p(g(n.entitySets, l.content.entitySetId, "Entity Set"), "Entity Set").ref : void 0, P = {
|
|
889
|
+
id: Y("im"),
|
|
890
|
+
importProfileId: c.id,
|
|
891
|
+
importProfileName: l.ref.name,
|
|
892
|
+
sourceFileId: e.sourceFileId,
|
|
893
|
+
startedBy: y,
|
|
894
|
+
phase: "queued",
|
|
895
|
+
failureReason: "",
|
|
896
|
+
progress: { done: 0, total: 0 },
|
|
897
|
+
counts: {
|
|
898
|
+
matched: 0,
|
|
899
|
+
created: 0,
|
|
900
|
+
problems: 0,
|
|
901
|
+
planned: 0,
|
|
902
|
+
corrected: 0,
|
|
903
|
+
kept: 0,
|
|
904
|
+
unchanged: 0,
|
|
905
|
+
stubbed: 0,
|
|
906
|
+
pendingReferences: 0
|
|
907
|
+
},
|
|
908
|
+
changeSetId: "",
|
|
909
|
+
releases: {
|
|
910
|
+
importProfile: l.ref,
|
|
911
|
+
mappings: h,
|
|
912
|
+
...v ? { entitySet: v } : {}
|
|
913
|
+
},
|
|
914
|
+
createTime: N(),
|
|
915
|
+
startTime: "",
|
|
916
|
+
endTime: "",
|
|
917
|
+
cancelledBy: "",
|
|
918
|
+
effectiveDate: e.effectiveDate ?? "",
|
|
919
|
+
...e.source ? { source: e.source } : {},
|
|
920
|
+
dryRun: t,
|
|
921
|
+
draft: r,
|
|
922
|
+
assetMoves: [],
|
|
923
|
+
sourceFileDeleteTime: "",
|
|
924
|
+
sourceFileDeletionReason: "",
|
|
925
|
+
itemProblems: [],
|
|
926
|
+
...t ? { dryRunContents: [] } : {}
|
|
927
|
+
};
|
|
928
|
+
return n.imports.unshift(P), P;
|
|
758
929
|
};
|
|
759
930
|
return {
|
|
760
|
-
calls:
|
|
931
|
+
calls: b,
|
|
761
932
|
switchWorkspace(e) {
|
|
762
|
-
|
|
933
|
+
f = e;
|
|
763
934
|
},
|
|
764
935
|
updateImport(e, t) {
|
|
765
|
-
Object.assign(
|
|
936
|
+
Object.assign(B(e), structuredClone(t));
|
|
766
937
|
},
|
|
767
|
-
listImportProfiles: () => d("listImportProfiles", () =>
|
|
768
|
-
getImportProfile: (e) => d("getImportProfile", () =>
|
|
938
|
+
listImportProfiles: () => d("listImportProfiles", () => q(o().importProfiles).map(Z)),
|
|
939
|
+
getImportProfile: (e) => d("getImportProfile", () => Z(g(o().importProfiles, e, "Import Profile"))),
|
|
769
940
|
createImportProfile: (e) => d("createImportProfile", () => {
|
|
770
|
-
_(
|
|
771
|
-
const t =
|
|
772
|
-
return
|
|
941
|
+
_(o().importProfiles, e.name);
|
|
942
|
+
const t = O("ip", e);
|
|
943
|
+
return E("importProfile", t), o().importProfiles.push(t), Z(t);
|
|
773
944
|
}),
|
|
774
|
-
updateImportProfile: (e, t,
|
|
775
|
-
const
|
|
776
|
-
return _(
|
|
945
|
+
updateImportProfile: (e, t, n) => d("updateImportProfile", () => {
|
|
946
|
+
const r = g(o().importProfiles, e, "Import Profile");
|
|
947
|
+
return _(o().importProfiles, t.name, e), I(r, t, n), E("importProfile", r), Z(r);
|
|
777
948
|
}),
|
|
778
949
|
deleteImportProfile: (e) => d("deleteImportProfile", () => {
|
|
779
|
-
|
|
950
|
+
g(o().importProfiles, e, "Import Profile"), o().importProfiles = o().importProfiles.filter((t) => t.id !== e);
|
|
780
951
|
}),
|
|
781
|
-
listProcessors: () => d("listProcessors", () => [...
|
|
782
|
-
listMappings: () => d("listMappings", () =>
|
|
783
|
-
getMapping: (e) => d("getMapping", () =>
|
|
952
|
+
listProcessors: () => d("listProcessors", () => [...i].sort((e, t) => e.name.localeCompare(t.name))),
|
|
953
|
+
listMappings: () => d("listMappings", () => q(o().mappings).map(J)),
|
|
954
|
+
getMapping: (e) => d("getMapping", () => J(g(o().mappings, e, "Mapping"))),
|
|
784
955
|
createMapping: (e) => d("createMapping", () => {
|
|
785
|
-
_(
|
|
786
|
-
const t =
|
|
787
|
-
return
|
|
956
|
+
_(o().mappings, e.name);
|
|
957
|
+
const t = O("mp", e);
|
|
958
|
+
return E("mapping", t), o().mappings.push(t), J(t);
|
|
788
959
|
}),
|
|
789
|
-
updateMapping: (e, t,
|
|
790
|
-
const
|
|
791
|
-
return _(
|
|
960
|
+
updateMapping: (e, t, n) => d("updateMapping", () => {
|
|
961
|
+
const r = g(o().mappings, e, "Mapping");
|
|
962
|
+
return _(o().mappings, t.name, e), I(r, t, n), E("mapping", r), J(r);
|
|
792
963
|
}),
|
|
793
964
|
deleteMapping: (e) => d("deleteMapping", () => {
|
|
794
|
-
|
|
795
|
-
const t =
|
|
965
|
+
g(o().mappings, e, "Mapping");
|
|
966
|
+
const t = L((n) => n.mappingIds.includes(e));
|
|
796
967
|
if (t.length > 0)
|
|
797
|
-
throw new
|
|
968
|
+
throw new me(
|
|
798
969
|
t,
|
|
799
|
-
`the Mapping is included by ${t.map((
|
|
970
|
+
`the Mapping is included by ${t.map((n) => n.name).join(", ")}`
|
|
800
971
|
);
|
|
801
|
-
|
|
972
|
+
o().mappings = o().mappings.filter((n) => n.id !== e);
|
|
802
973
|
}),
|
|
803
|
-
listMappingImportProfiles: (e) => d("listMappingImportProfiles", () => (
|
|
974
|
+
listMappingImportProfiles: (e) => d("listMappingImportProfiles", () => (g(o().mappings, e, "Mapping"), L((t) => t.mappingIds.includes(e)))),
|
|
804
975
|
checkMappingBlueprintRelease: (e, t) => d("checkMappingBlueprintRelease", () => {
|
|
805
|
-
const
|
|
806
|
-
if (!
|
|
807
|
-
if (
|
|
976
|
+
const n = g(o().mappings, e, "Mapping"), r = m.find((c) => c.id === t);
|
|
977
|
+
if (!r) throw new Error(`Blueprint Release ${t} not found`);
|
|
978
|
+
if (r.blueprintId !== n.content.blueprintId)
|
|
808
979
|
throw new Error("the Release is of another Blueprint");
|
|
809
980
|
return {
|
|
810
|
-
blueprintId:
|
|
811
|
-
missingFieldPaths: (
|
|
981
|
+
blueprintId: r.blueprintId,
|
|
982
|
+
missingFieldPaths: (n.content.fields ?? []).flatMap((c, p) => ae(c, "", `/fields/${p}`).map((l) => l.path)).filter((c) => !r.fieldPaths.includes(c)),
|
|
812
983
|
missingReleaseSpecFields: [
|
|
813
|
-
...(
|
|
814
|
-
...
|
|
984
|
+
...(n.content.releaseSpec ?? []).map((c) => c.field ?? ""),
|
|
985
|
+
...n.content.versionMatch?.releaseSpecFields ?? []
|
|
815
986
|
].filter(
|
|
816
|
-
(
|
|
987
|
+
(c, p, l) => c !== "" && l.indexOf(c) === p && !(r.releaseSpecFields ?? []).some((u) => u.path === c)
|
|
817
988
|
)
|
|
818
989
|
};
|
|
819
990
|
}),
|
|
820
|
-
runMappingTest: ({ content: e, sample: t, entitySetId:
|
|
821
|
-
let
|
|
822
|
-
if (
|
|
823
|
-
const
|
|
824
|
-
if (!
|
|
825
|
-
|
|
991
|
+
runMappingTest: ({ content: e, sample: t, entitySetId: n }) => d("runMappingTest", () => {
|
|
992
|
+
let r = new TextDecoder().decode(t);
|
|
993
|
+
if (n) {
|
|
994
|
+
const c = o().entitySets.find((p) => p.id === n);
|
|
995
|
+
if (!c) throw new z(`Entity Set ${n} not found`);
|
|
996
|
+
r = De(r, c.content.entities);
|
|
826
997
|
}
|
|
827
|
-
return Ae(e,
|
|
998
|
+
return Ae(e, r);
|
|
828
999
|
}),
|
|
829
|
-
listEntitySets: () => d("listEntitySets", () =>
|
|
830
|
-
getEntitySet: (e) => d("getEntitySet", () =>
|
|
1000
|
+
listEntitySets: () => d("listEntitySets", () => q(o().entitySets).map(G)),
|
|
1001
|
+
getEntitySet: (e) => d("getEntitySet", () => G(g(o().entitySets, e, "Entity Set"))),
|
|
831
1002
|
createEntitySet: (e) => d("createEntitySet", () => {
|
|
832
|
-
_(
|
|
833
|
-
const t =
|
|
834
|
-
return
|
|
1003
|
+
_(o().entitySets, e.name);
|
|
1004
|
+
const t = O("es", e);
|
|
1005
|
+
return E("entitySet", t), o().entitySets.push(t), G(t);
|
|
835
1006
|
}),
|
|
836
|
-
updateEntitySet: (e, t,
|
|
837
|
-
const
|
|
838
|
-
return _(
|
|
1007
|
+
updateEntitySet: (e, t, n) => d("updateEntitySet", () => {
|
|
1008
|
+
const r = g(o().entitySets, e, "Entity Set");
|
|
1009
|
+
return _(o().entitySets, t.name, e), I(r, t, n), E("entitySet", r), G(r);
|
|
839
1010
|
}),
|
|
840
1011
|
deleteEntitySet: (e) => d("deleteEntitySet", () => {
|
|
841
|
-
|
|
842
|
-
const t =
|
|
1012
|
+
g(o().entitySets, e, "Entity Set");
|
|
1013
|
+
const t = L((n) => n.entitySetId === e);
|
|
843
1014
|
if (t.length > 0)
|
|
844
|
-
throw new
|
|
1015
|
+
throw new me(
|
|
845
1016
|
t,
|
|
846
|
-
`the Entity Set is named by ${t.map((
|
|
1017
|
+
`the Entity Set is named by ${t.map((n) => n.name).join(", ")}`
|
|
847
1018
|
);
|
|
848
|
-
|
|
1019
|
+
o().entitySets = o().entitySets.filter((n) => n.id !== e);
|
|
849
1020
|
}),
|
|
850
|
-
cutRelease: (e, t,
|
|
851
|
-
const
|
|
852
|
-
if (w(
|
|
853
|
-
throw new
|
|
854
|
-
const p =
|
|
855
|
-
if (!p.valid) throw new
|
|
856
|
-
if (!
|
|
857
|
-
throw new
|
|
1021
|
+
cutRelease: (e, t, n) => d("cutRelease", () => {
|
|
1022
|
+
const r = K(e), c = g(r.items, t, r.name);
|
|
1023
|
+
if (w(c, n))
|
|
1024
|
+
throw new se("the draft moved: somebody saved in between");
|
|
1025
|
+
const p = x(r.reasons(c.content));
|
|
1026
|
+
if (!p.valid) throw new se("the draft is invalid", p);
|
|
1027
|
+
if (!j(c).draftDiffersFromRelease)
|
|
1028
|
+
throw new se(
|
|
858
1029
|
"the draft does not differ from the latest Release: there is nothing to release"
|
|
859
1030
|
);
|
|
860
|
-
const
|
|
861
|
-
id: `${
|
|
862
|
-
number:
|
|
863
|
-
revisionId:
|
|
864
|
-
releasedBy:
|
|
865
|
-
releasedAt:
|
|
1031
|
+
const l = c.releases.length + 1, u = {
|
|
1032
|
+
id: `${c.id}_rel${l}`,
|
|
1033
|
+
number: l,
|
|
1034
|
+
revisionId: C(c).id,
|
|
1035
|
+
releasedBy: y,
|
|
1036
|
+
releasedAt: N()
|
|
866
1037
|
};
|
|
867
|
-
return
|
|
868
|
-
release:
|
|
869
|
-
importProfiles: e === "mapping" ?
|
|
1038
|
+
return c.releases.push(u), {
|
|
1039
|
+
release: u,
|
|
1040
|
+
importProfiles: e === "mapping" ? L((h) => h.mappingIds.includes(t)) : []
|
|
870
1041
|
};
|
|
871
1042
|
}),
|
|
872
|
-
listHistory: (e, t,
|
|
873
|
-
const
|
|
1043
|
+
listHistory: (e, t, n) => d("listHistory", () => {
|
|
1044
|
+
const r = K(e), c = g(r.items, t, r.name), p = [...c.revisions].reverse(), l = Number(n || "0");
|
|
874
1045
|
return {
|
|
875
|
-
revisions: p.slice(
|
|
876
|
-
id:
|
|
877
|
-
savedBy:
|
|
878
|
-
savedAt:
|
|
879
|
-
validity:
|
|
880
|
-
restoredFromRevisionId:
|
|
1046
|
+
revisions: p.slice(l, l + 10).map((h) => ({
|
|
1047
|
+
id: h.id,
|
|
1048
|
+
savedBy: h.savedBy,
|
|
1049
|
+
savedAt: h.savedAt,
|
|
1050
|
+
validity: h.validity ?? x(r.reasons(h.content)),
|
|
1051
|
+
restoredFromRevisionId: h.restoredFromRevisionId
|
|
881
1052
|
})),
|
|
882
|
-
releases: [...
|
|
883
|
-
nextPageToken:
|
|
1053
|
+
releases: [...c.releases].reverse(),
|
|
1054
|
+
nextPageToken: l + 10 < p.length ? String(l + 10) : ""
|
|
884
1055
|
};
|
|
885
1056
|
}),
|
|
886
|
-
compareRevisions: (e, t,
|
|
887
|
-
const
|
|
888
|
-
const
|
|
889
|
-
return { field:
|
|
1057
|
+
compareRevisions: (e, t, n, r) => d("compareRevisions", () => {
|
|
1058
|
+
const c = K(e), p = g(c.items, t, c.name), l = he(W(p, n).content), u = he(W(p, r).content), h = [.../* @__PURE__ */ new Set([...Object.keys(l), ...Object.keys(u)])].map((v) => {
|
|
1059
|
+
const P = l[v], R = u[v], ne = P === void 0 && R !== void 0 ? "added" : P !== void 0 && R === void 0 ? "removed" : JSON.stringify(P) === JSON.stringify(R) ? "unchanged" : "changed";
|
|
1060
|
+
return { field: v, status: ne };
|
|
890
1061
|
});
|
|
891
1062
|
return {
|
|
892
|
-
from: { revisionId:
|
|
893
|
-
to: { revisionId:
|
|
894
|
-
fields:
|
|
1063
|
+
from: { revisionId: n, content: l },
|
|
1064
|
+
to: { revisionId: r, content: u },
|
|
1065
|
+
fields: h
|
|
895
1066
|
};
|
|
896
1067
|
}),
|
|
897
|
-
restoreRevision: (e, t,
|
|
898
|
-
const
|
|
899
|
-
I(p,
|
|
1068
|
+
restoreRevision: (e, t, n, r) => d("restoreRevision", () => {
|
|
1069
|
+
const c = K(e), p = g(c.items, t, c.name);
|
|
1070
|
+
I(p, W(p, n).content, r, n), E(e, p);
|
|
900
1071
|
}),
|
|
901
1072
|
async uploadSourceFile(e, t) {
|
|
902
|
-
if (
|
|
903
|
-
for (const
|
|
904
|
-
await new Promise((
|
|
905
|
-
if (
|
|
1073
|
+
if (b.uploadSourceFile++, s.fail) throw s.fail;
|
|
1074
|
+
for (const r of [0.25, 0.5, 0.75])
|
|
1075
|
+
await new Promise((c) => setTimeout(c, 20)), t(r);
|
|
1076
|
+
if (s.uploadFails) throw s.uploadFails;
|
|
906
1077
|
t(1);
|
|
907
|
-
const
|
|
908
|
-
return
|
|
1078
|
+
const n = Y("sf");
|
|
1079
|
+
return Q.add(n), { id: n, fileName: e.name };
|
|
909
1080
|
},
|
|
910
|
-
startImport: (e) => d("startImport", () =>
|
|
911
|
-
const t = r(), s = h(t.importProfiles, e.importProfileId, "Import Profile");
|
|
912
|
-
if (!ae.has(e.sourceFileId))
|
|
913
|
-
throw new B("nothing was uploaded to the Source File");
|
|
914
|
-
if (!le.includes("editor"))
|
|
915
|
-
throw new B(
|
|
916
|
-
"starting an Import needs contenthub editor in the workspace"
|
|
917
|
-
);
|
|
918
|
-
const i = W(s, "Import Profile");
|
|
919
|
-
if (i.content.autoPublish && !le.includes("publisher"))
|
|
920
|
-
throw new B(
|
|
921
|
-
"the Import Profile has Auto-publish, which needs contenthub publisher"
|
|
922
|
-
);
|
|
923
|
-
const l = U(i.content);
|
|
924
|
-
if (l.length > 0)
|
|
925
|
-
throw new B(
|
|
926
|
-
`the Import Profile ${i.ref.name} is invalid: ${l.map((u) => u.message).join(" ")}`
|
|
927
|
-
);
|
|
928
|
-
const p = i.content.mappingIds.map(
|
|
929
|
-
(u) => W(h(t.mappings, u, "Mapping"), "Mapping").ref
|
|
930
|
-
), c = i.content.entitySetId ? W(h(t.entitySets, i.content.entitySetId, "Entity Set"), "Entity Set").ref : void 0, f = {
|
|
931
|
-
id: X("im"),
|
|
932
|
-
importProfileId: s.id,
|
|
933
|
-
importProfileName: i.ref.name,
|
|
934
|
-
sourceFileId: e.sourceFileId,
|
|
935
|
-
startedBy: b,
|
|
936
|
-
phase: "queued",
|
|
937
|
-
failureReason: "",
|
|
938
|
-
progress: { done: 0, total: 0 },
|
|
939
|
-
counts: {
|
|
940
|
-
matched: 0,
|
|
941
|
-
created: 0,
|
|
942
|
-
problems: 0,
|
|
943
|
-
planned: 0,
|
|
944
|
-
corrected: 0,
|
|
945
|
-
kept: 0,
|
|
946
|
-
unchanged: 0
|
|
947
|
-
},
|
|
948
|
-
changeSetId: "",
|
|
949
|
-
releases: {
|
|
950
|
-
importProfile: i.ref,
|
|
951
|
-
mappings: p,
|
|
952
|
-
...c ? { entitySet: c } : {}
|
|
953
|
-
},
|
|
954
|
-
createTime: $(),
|
|
955
|
-
startTime: "",
|
|
956
|
-
endTime: "",
|
|
957
|
-
cancelledBy: "",
|
|
958
|
-
effectiveDate: e.effectiveDate ?? "",
|
|
959
|
-
...e.source ? { source: e.source } : {},
|
|
960
|
-
itemProblems: []
|
|
961
|
-
};
|
|
962
|
-
return t.imports.unshift(f), j(f);
|
|
963
|
-
}),
|
|
1081
|
+
startImport: (e) => d("startImport", () => F(te(e, !1))),
|
|
964
1082
|
listImports: (e) => d("listImports", () => {
|
|
965
|
-
const t =
|
|
966
|
-
t.forEach(
|
|
967
|
-
const
|
|
1083
|
+
const t = o().imports;
|
|
1084
|
+
t.forEach(ee);
|
|
1085
|
+
const n = Number(e || "0");
|
|
968
1086
|
return {
|
|
969
|
-
|
|
970
|
-
|
|
1087
|
+
// As importhub's ListImports, without the asset moves, which
|
|
1088
|
+
// grow with the Source File; getImport reads them.
|
|
1089
|
+
imports: t.slice(n, n + 50).map((r) => ({ ...F(r), assetMoves: [] })),
|
|
1090
|
+
nextPageToken: n + 50 < t.length ? String(n + 50) : ""
|
|
971
1091
|
};
|
|
972
1092
|
}),
|
|
973
1093
|
getImport: (e) => d("getImport", () => {
|
|
974
|
-
const t =
|
|
975
|
-
return
|
|
1094
|
+
const t = B(e);
|
|
1095
|
+
return ee(t), F(t);
|
|
976
1096
|
}),
|
|
977
1097
|
cancelImport: (e) => d("cancelImport", () => {
|
|
978
|
-
const t =
|
|
1098
|
+
const t = B(e);
|
|
979
1099
|
if (t.phase === "ended") throw new Error("the Import has ended");
|
|
980
|
-
return t.cancelledBy ||=
|
|
1100
|
+
return t.cancelledBy ||= y, t.phase === "queued" && ee(t), F(t);
|
|
1101
|
+
}),
|
|
1102
|
+
rerunImport: (e) => d("rerunImport", () => {
|
|
1103
|
+
const t = B(e);
|
|
1104
|
+
if (t.sourceFileDeleteTime)
|
|
1105
|
+
throw new D(
|
|
1106
|
+
`the Source File was deleted at ${t.sourceFileDeleteTime}: ${t.sourceFileDeletionReason}`
|
|
1107
|
+
);
|
|
1108
|
+
return Q.add(t.sourceFileId), F(
|
|
1109
|
+
te(
|
|
1110
|
+
{
|
|
1111
|
+
importProfileId: t.importProfileId,
|
|
1112
|
+
sourceFileId: t.sourceFileId,
|
|
1113
|
+
effectiveDate: t.effectiveDate,
|
|
1114
|
+
...t.source ? { source: t.source } : {},
|
|
1115
|
+
draft: t.draft
|
|
1116
|
+
},
|
|
1117
|
+
t.dryRun
|
|
1118
|
+
)
|
|
1119
|
+
);
|
|
981
1120
|
}),
|
|
982
1121
|
listItemProblems: (e, t) => d("listItemProblems", () => {
|
|
983
|
-
const
|
|
984
|
-
(
|
|
1122
|
+
const n = B(e).itemProblems ?? [], r = t.sourceKeyQuery.toLowerCase(), c = n.filter(
|
|
1123
|
+
(u) => (!t.mappingId || u.mappingId === t.mappingId) && u.sourceKey.toLowerCase().includes(r)
|
|
985
1124
|
), p = /* @__PURE__ */ new Map();
|
|
986
|
-
for (const
|
|
987
|
-
const
|
|
988
|
-
mappingId:
|
|
989
|
-
mappingName:
|
|
1125
|
+
for (const u of n) {
|
|
1126
|
+
const h = p.get(u.mappingId) ?? {
|
|
1127
|
+
mappingId: u.mappingId,
|
|
1128
|
+
mappingName: u.mappingName,
|
|
990
1129
|
count: 0
|
|
991
1130
|
};
|
|
992
|
-
|
|
1131
|
+
h.count++, p.set(u.mappingId, h);
|
|
993
1132
|
}
|
|
994
|
-
const
|
|
1133
|
+
const l = Number(t.pageToken || "0");
|
|
1134
|
+
return {
|
|
1135
|
+
itemProblems: c.slice(l, l + 50),
|
|
1136
|
+
totalCount: n.length,
|
|
1137
|
+
matchingCount: c.length,
|
|
1138
|
+
mappings: [...p.values()].sort((u, h) => u.mappingName.localeCompare(h.mappingName)),
|
|
1139
|
+
pendingReferenceCount: n.filter((u) => u.pendingReference).length,
|
|
1140
|
+
nextPageToken: l + 50 < c.length ? String(l + 50) : ""
|
|
1141
|
+
};
|
|
1142
|
+
}),
|
|
1143
|
+
startDryRun: (e) => d("startDryRun", () => F(te(e, !0))),
|
|
1144
|
+
listDryRunContents: (e, t) => d("listDryRunContents", () => {
|
|
1145
|
+
const n = B(e);
|
|
1146
|
+
if (!n.dryRun) throw new Error("the Import is no Dry Run");
|
|
1147
|
+
const r = n.dryRunContents ?? [], c = t.sourceKeyQuery.toLowerCase(), p = r.filter(
|
|
1148
|
+
(u) => (!t.action || u.action === t.action) && (!t.mappingId || u.mappingId === t.mappingId) && u.sourceKey.toLowerCase().includes(c)
|
|
1149
|
+
), l = Number(t.pageToken || "0");
|
|
995
1150
|
return {
|
|
996
|
-
|
|
997
|
-
totalCount:
|
|
998
|
-
matchingCount:
|
|
999
|
-
|
|
1000
|
-
nextPageToken: c + 50 < l.length ? String(c + 50) : ""
|
|
1151
|
+
contents: p.slice(l, l + 50),
|
|
1152
|
+
totalCount: r.length,
|
|
1153
|
+
matchingCount: p.length,
|
|
1154
|
+
nextPageToken: l + 50 < p.length ? String(l + 50) : ""
|
|
1001
1155
|
};
|
|
1002
1156
|
}),
|
|
1003
|
-
listApiKeys: () => d("listApiKeys", () =>
|
|
1157
|
+
listApiKeys: () => d("listApiKeys", () => o().apiKeys),
|
|
1004
1158
|
createApiKey: (e) => d("createApiKey", () => {
|
|
1005
1159
|
const t = e.name.trim();
|
|
1006
1160
|
if (!t) throw new Error("a name is required");
|
|
1007
|
-
if (t.length >
|
|
1008
|
-
throw new Error(`the name is longer than ${
|
|
1009
|
-
const
|
|
1010
|
-
if (
|
|
1161
|
+
if (t.length > de)
|
|
1162
|
+
throw new Error(`the name is longer than ${de} characters`);
|
|
1163
|
+
const n = e.expireTime ? new Date(e.expireTime).toISOString() : "";
|
|
1164
|
+
if (n && Date.parse(n) <= Date.now())
|
|
1011
1165
|
throw new Error("the expiry must lie in the future");
|
|
1012
|
-
const
|
|
1013
|
-
id: `key_stub_new_${
|
|
1166
|
+
const r = ++_e, c = {
|
|
1167
|
+
id: `key_stub_new_${r}`,
|
|
1014
1168
|
name: t,
|
|
1015
|
-
keyPrefix: `ihk_n${String(
|
|
1016
|
-
owner:
|
|
1017
|
-
expireTime:
|
|
1169
|
+
keyPrefix: `ihk_n${String(r).padStart(3, "0")}`,
|
|
1170
|
+
owner: y,
|
|
1171
|
+
expireTime: n,
|
|
1018
1172
|
createTime: (/* @__PURE__ */ new Date()).toISOString()
|
|
1019
1173
|
};
|
|
1020
|
-
return
|
|
1174
|
+
return o().apiKeys.unshift(c), { apiKey: c, secret: `${c.keyPrefix}_stub_secret_${r}` };
|
|
1021
1175
|
}),
|
|
1022
1176
|
revokeApiKey: (e) => d("revokeApiKey", () => {
|
|
1023
|
-
const t =
|
|
1024
|
-
if (!t.apiKeys.some((
|
|
1025
|
-
t.apiKeys = t.apiKeys.filter((
|
|
1177
|
+
const t = o();
|
|
1178
|
+
if (!t.apiKeys.some((n) => n.id === e)) throw new Error(`API key ${e} not found`);
|
|
1179
|
+
t.apiKeys = t.apiKeys.filter((n) => n.id !== e);
|
|
1026
1180
|
})
|
|
1027
1181
|
};
|
|
1028
1182
|
}
|
|
1029
|
-
function Oe(
|
|
1030
|
-
const a = [],
|
|
1031
|
-
for (const m of
|
|
1183
|
+
function Oe(s) {
|
|
1184
|
+
const a = [], i = { "]": "[", ")": "(" };
|
|
1185
|
+
for (const m of s)
|
|
1032
1186
|
if (m === "[" || m === "(") a.push(m);
|
|
1033
|
-
else if (m in
|
|
1187
|
+
else if (m in i && a.pop() !== i[m]) return !1;
|
|
1034
1188
|
return a.length === 0;
|
|
1035
1189
|
}
|
|
1036
|
-
function
|
|
1037
|
-
const m = `${a}${String(
|
|
1190
|
+
function ae(s, a, i) {
|
|
1191
|
+
const m = `${a}${String(s.name ?? "")}`;
|
|
1038
1192
|
return [
|
|
1039
|
-
{ path: m, rel:
|
|
1193
|
+
{ path: m, rel: i, mapping: s },
|
|
1040
1194
|
...["fields", "virtualTableFields"].flatMap(
|
|
1041
|
-
(
|
|
1042
|
-
(
|
|
1195
|
+
(f) => (Array.isArray(s[f]) ? s[f] : []).flatMap(
|
|
1196
|
+
(b, o) => ae(b, `${m}.`, `${i}/${f}/${o}`)
|
|
1043
1197
|
)
|
|
1044
1198
|
)
|
|
1045
1199
|
];
|
|
1046
1200
|
}
|
|
1047
|
-
function
|
|
1201
|
+
function He(s = be()) {
|
|
1048
1202
|
return {
|
|
1049
1203
|
async listBlueprints() {
|
|
1050
|
-
return [...new Map(
|
|
1204
|
+
return [...new Map(s.map((i) => [i.blueprintId, i.blueprintName]))].map(([i, m]) => ({ id: i, name: m })).sort((i, m) => i.name.localeCompare(m.name));
|
|
1051
1205
|
},
|
|
1052
1206
|
async listReleases(a) {
|
|
1053
|
-
return
|
|
1207
|
+
return s.filter((i) => i.blueprintId === a).map((i) => ({ id: i.id, label: i.label }));
|
|
1054
1208
|
},
|
|
1055
1209
|
async getRelease(a) {
|
|
1056
|
-
const
|
|
1057
|
-
if (!
|
|
1210
|
+
const i = s.find((m) => m.id === a);
|
|
1211
|
+
if (!i) throw new Error(`Blueprint Release ${a} not found`);
|
|
1058
1212
|
return {
|
|
1059
|
-
id:
|
|
1060
|
-
blueprintId:
|
|
1061
|
-
name:
|
|
1062
|
-
fields:
|
|
1213
|
+
id: i.id,
|
|
1214
|
+
blueprintId: i.blueprintId,
|
|
1215
|
+
name: i.label,
|
|
1216
|
+
fields: i.fields ?? i.fieldPaths.map((m) => ({
|
|
1063
1217
|
accessor: m,
|
|
1064
1218
|
path: m,
|
|
1065
1219
|
fieldType: "text",
|
|
1066
1220
|
label: "",
|
|
1067
1221
|
children: []
|
|
1068
1222
|
})),
|
|
1069
|
-
releaseSpecFields:
|
|
1223
|
+
releaseSpecFields: i.releaseSpecFields ?? []
|
|
1070
1224
|
};
|
|
1071
1225
|
}
|
|
1072
1226
|
};
|
|
1073
1227
|
}
|
|
1074
|
-
function
|
|
1075
|
-
const m = (
|
|
1076
|
-
{ path: d, code:
|
|
1228
|
+
function Ke(s, a, i) {
|
|
1229
|
+
const m = (s.displayNameTemplate ?? "").trim(), f = (s.displayNameField ?? "").trim(), b = (d, g, _) => [
|
|
1230
|
+
{ path: d, code: g, message: _ }
|
|
1077
1231
|
];
|
|
1078
|
-
if (!m && !
|
|
1079
|
-
if (!
|
|
1080
|
-
return
|
|
1232
|
+
if (!m && !f) return [];
|
|
1233
|
+
if (!f)
|
|
1234
|
+
return b(
|
|
1081
1235
|
"/display_name_field",
|
|
1082
1236
|
"incomplete_display_name",
|
|
1083
1237
|
"the display-name template names no field to write the display name into"
|
|
1084
1238
|
);
|
|
1085
1239
|
if (!m)
|
|
1086
|
-
return
|
|
1240
|
+
return b(
|
|
1087
1241
|
"/display_name_template",
|
|
1088
1242
|
"incomplete_display_name",
|
|
1089
|
-
`the display-name field "${
|
|
1243
|
+
`the display-name field "${f}" has no display-name template to fill it`
|
|
1090
1244
|
);
|
|
1091
1245
|
if (!a) return [];
|
|
1092
|
-
const
|
|
1093
|
-
return
|
|
1246
|
+
const o = (d) => d.flatMap((g) => [g.path, ...o(g.children)]);
|
|
1247
|
+
return o(a).includes(f) ? ve(a).some((d) => d.path === f) ? i.includes(f) ? b(
|
|
1094
1248
|
"/display_name_field",
|
|
1095
1249
|
"display_name_field_mapped",
|
|
1096
|
-
`the field "${
|
|
1097
|
-
) : [] :
|
|
1250
|
+
`the field "${f}" is mapped too: it takes the display name or a mapped value, not both`
|
|
1251
|
+
) : [] : b(
|
|
1098
1252
|
"/display_name_field",
|
|
1099
1253
|
"display_name_field_not_plain_text",
|
|
1100
|
-
`the display-name field "${
|
|
1101
|
-
) :
|
|
1254
|
+
`the display-name field "${f}" is not a plain-text one (text or textarea)`
|
|
1255
|
+
) : b(
|
|
1102
1256
|
"/display_name_field",
|
|
1103
1257
|
"unknown_display_name_field",
|
|
1104
|
-
`the Blueprint Release has no field "${
|
|
1258
|
+
`the Blueprint Release has no field "${f}" to write the display name into`
|
|
1105
1259
|
);
|
|
1106
1260
|
}
|
|
1107
1261
|
export {
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1262
|
+
U as STUB_OTHER_USER_ID,
|
|
1263
|
+
Ge as STUB_OTHER_WORKSPACE_ID,
|
|
1264
|
+
y as STUB_USER_ID,
|
|
1265
|
+
oe as STUB_WORKSPACE_ID,
|
|
1266
|
+
He as createStubBlueprints,
|
|
1267
|
+
qe as createStubImporthubClient,
|
|
1268
|
+
Be as stubApiKeys,
|
|
1269
|
+
be as stubBlueprintReleases,
|
|
1270
|
+
Ee as stubEntitySets,
|
|
1271
|
+
Le as stubIdentity,
|
|
1272
|
+
Me as stubImportProfiles,
|
|
1273
|
+
Ne as stubImports,
|
|
1120
1274
|
je as stubMappingTestSample,
|
|
1121
|
-
|
|
1122
|
-
|
|
1275
|
+
$e as stubMappings,
|
|
1276
|
+
ke as stubProcessors
|
|
1123
1277
|
};
|
|
1124
1278
|
//# sourceMappingURL=testing.js.map
|