@knkcs/importhub-ui 0.10.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 +7 -0
- package/dist/importhub-client-BzOVIXA4.js.map +1 -1
- package/dist/index.d.ts +87 -3
- package/dist/index.js +1322 -1173
- package/dist/index.js.map +1 -1
- package/dist/mapping-editor.d.ts +39 -0
- package/dist/mapping-editor.js +1 -1
- package/dist/{mapping-page-Bl2rA1SR.js → mapping-page-CABgzLlj.js} +303 -298
- package/dist/mapping-page-CABgzLlj.js.map +1 -0
- package/dist/testing.d.ts +41 -0
- package/dist/testing.js +257 -202
- package/dist/testing.js.map +1 -1
- package/package.json +1 -1
- package/dist/mapping-page-Bl2rA1SR.js.map +0 -1
package/dist/testing.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { createHostMembers as
|
|
2
|
-
import { M as
|
|
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
3
|
import { p as ve } from "./field-tree-CghMgGKm.js";
|
|
4
|
-
const y = "user_stub_ada", U = "user_stub_grace",
|
|
5
|
-
function Le(s =
|
|
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
7
|
userId: y,
|
|
8
8
|
workspaceId: s,
|
|
9
|
-
members:
|
|
9
|
+
members: Re([
|
|
10
10
|
{ userId: y, displayName: "Ada Importer", email: "ada@example.com" },
|
|
11
11
|
{ userId: U, displayName: "Grace Hopper", email: "grace@example.com" }
|
|
12
12
|
])
|
|
@@ -116,7 +116,7 @@ function Ee() {
|
|
|
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 ke() {
|
|
|
147
147
|
}
|
|
148
148
|
];
|
|
149
149
|
}
|
|
150
|
-
const
|
|
150
|
+
const re = (s, a, i, m = "") => ({
|
|
151
151
|
field_type: "text",
|
|
152
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 Me() {
|
|
|
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 Me() {
|
|
|
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,
|
|
@@ -198,7 +198,7 @@ const M = (s = {}) => ({
|
|
|
198
198
|
stubbed: 0,
|
|
199
199
|
pendingReferences: 0,
|
|
200
200
|
...s
|
|
201
|
-
}),
|
|
201
|
+
}), T = (s) => ({
|
|
202
202
|
importProfile: {
|
|
203
203
|
configurationId: "ip_stub_gesetz",
|
|
204
204
|
name: "Boorberg gesetz",
|
|
@@ -219,7 +219,7 @@ const M = (s = {}) => ({
|
|
|
219
219
|
releaseId: "es_stub_latin1_rel1",
|
|
220
220
|
number: 1
|
|
221
221
|
}
|
|
222
|
-
}),
|
|
222
|
+
}), M = (s) => ({
|
|
223
223
|
importProfileId: "ip_stub_gesetz",
|
|
224
224
|
importProfileName: "Boorberg gesetz",
|
|
225
225
|
sourceFileId: `sf_${s.id}`,
|
|
@@ -227,9 +227,9 @@ const M = (s = {}) => ({
|
|
|
227
227
|
phase: "ended",
|
|
228
228
|
failureReason: "",
|
|
229
229
|
progress: { done: 0, total: 0 },
|
|
230
|
-
counts:
|
|
230
|
+
counts: k(),
|
|
231
231
|
changeSetId: "",
|
|
232
|
-
releases:
|
|
232
|
+
releases: T(2),
|
|
233
233
|
createTime: "2026-11-03T09:00:00.000Z",
|
|
234
234
|
startTime: "",
|
|
235
235
|
endTime: "",
|
|
@@ -237,15 +237,19 @@ const M = (s = {}) => ({
|
|
|
237
237
|
effectiveDate: "",
|
|
238
238
|
dryRun: !1,
|
|
239
239
|
draft: !1,
|
|
240
|
+
assetMoves: [],
|
|
241
|
+
sourceFileDeleteTime: "",
|
|
242
|
+
sourceFileDeletionReason: "",
|
|
240
243
|
...s
|
|
241
|
-
}),
|
|
244
|
+
}), $ = (s, a, i, m, f, b = "") => ({
|
|
242
245
|
id: `prob_stub_${s}`,
|
|
243
246
|
mappingId: a === "norm" ? "mp_stub_norm" : "mp_stub_title",
|
|
244
247
|
mappingName: a === "norm" ? "Gesetz norms" : "Gesetz titles",
|
|
245
248
|
sourceKey: i,
|
|
246
249
|
field: m,
|
|
247
|
-
reason: f
|
|
248
|
-
|
|
250
|
+
reason: f,
|
|
251
|
+
displayName: b
|
|
252
|
+
}), A = (s, a, i, m, f = "") => ({
|
|
249
253
|
mappingId: s === "norm" ? "mp_stub_norm" : "mp_stub_title",
|
|
250
254
|
mappingName: s === "norm" ? "Gesetz norms" : "Gesetz titles",
|
|
251
255
|
sourceKey: a,
|
|
@@ -258,27 +262,27 @@ const M = (s = {}) => ({
|
|
|
258
262
|
});
|
|
259
263
|
function Ne() {
|
|
260
264
|
return [
|
|
261
|
-
|
|
265
|
+
M({
|
|
262
266
|
id: "im_stub_running",
|
|
263
267
|
phase: "writing",
|
|
264
268
|
progress: { done: 48, total: 120 },
|
|
265
|
-
counts:
|
|
269
|
+
counts: k({ matched: 120, created: 40, planned: 8 }),
|
|
266
270
|
changeSetId: "cs_stub_running",
|
|
267
271
|
createTime: "2026-11-04T10:00:00.000Z",
|
|
268
272
|
startTime: "2026-11-04T10:00:05.000Z"
|
|
269
273
|
}),
|
|
270
|
-
|
|
274
|
+
M({
|
|
271
275
|
id: "im_stub_queued",
|
|
272
276
|
phase: "queued",
|
|
273
277
|
startedBy: U,
|
|
274
|
-
releases:
|
|
278
|
+
releases: T(2),
|
|
275
279
|
createTime: "2026-11-04T10:05:00.000Z"
|
|
276
280
|
}),
|
|
277
|
-
|
|
281
|
+
M({
|
|
278
282
|
id: "im_stub_dry_run",
|
|
279
283
|
dryRun: !0,
|
|
280
284
|
outcome: "succeeded_with_problems",
|
|
281
|
-
counts:
|
|
285
|
+
counts: k({
|
|
282
286
|
matched: 8,
|
|
283
287
|
created: 1,
|
|
284
288
|
planned: 1,
|
|
@@ -290,9 +294,9 @@ function Ne() {
|
|
|
290
294
|
pendingReferences: 1
|
|
291
295
|
}),
|
|
292
296
|
releases: {
|
|
293
|
-
...
|
|
297
|
+
...T(2),
|
|
294
298
|
mappings: [
|
|
295
|
-
...
|
|
299
|
+
...T(2).mappings,
|
|
296
300
|
{
|
|
297
301
|
configurationId: "mp_stub_title",
|
|
298
302
|
name: "Gesetz titles",
|
|
@@ -305,17 +309,17 @@ function Ne() {
|
|
|
305
309
|
startTime: "2026-11-03T15:00:01.000Z",
|
|
306
310
|
endTime: "2026-11-03T15:01:30.000Z",
|
|
307
311
|
dryRunContents: [
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
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")
|
|
314
318
|
],
|
|
315
319
|
itemProblems: [
|
|
316
|
-
|
|
320
|
+
$(6, "norm", "BJNR000040006", "stand/datum", "“30.02.2026” is not a date."),
|
|
317
321
|
{
|
|
318
|
-
|
|
322
|
+
...$(
|
|
319
323
|
7,
|
|
320
324
|
"norm",
|
|
321
325
|
"BJNR000040007",
|
|
@@ -330,22 +334,23 @@ function Ne() {
|
|
|
330
334
|
}
|
|
331
335
|
]
|
|
332
336
|
}),
|
|
333
|
-
|
|
337
|
+
M({
|
|
334
338
|
id: "im_stub_problems",
|
|
335
339
|
outcome: "succeeded_with_problems",
|
|
336
|
-
counts:
|
|
340
|
+
counts: k({
|
|
337
341
|
matched: 212,
|
|
338
342
|
created: 180,
|
|
339
343
|
planned: 20,
|
|
340
344
|
corrected: 6,
|
|
341
345
|
kept: 1,
|
|
342
|
-
problems:
|
|
346
|
+
problems: 6,
|
|
347
|
+
pendingReferences: 1
|
|
343
348
|
}),
|
|
344
349
|
changeSetId: "cs_stub_problems",
|
|
345
350
|
releases: {
|
|
346
|
-
...
|
|
351
|
+
...T(2),
|
|
347
352
|
mappings: [
|
|
348
|
-
...
|
|
353
|
+
...T(2).mappings,
|
|
349
354
|
{
|
|
350
355
|
configurationId: "mp_stub_title",
|
|
351
356
|
name: "Gesetz titles",
|
|
@@ -360,39 +365,64 @@ function Ne() {
|
|
|
360
365
|
effectiveDate: "2026-10-01",
|
|
361
366
|
source: { date: "2026-09-20", reference: "BGBl. 2026 I Nr. 270" },
|
|
362
367
|
itemProblems: [
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
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" }
|
|
368
394
|
]
|
|
369
395
|
}),
|
|
370
|
-
|
|
396
|
+
M({
|
|
371
397
|
id: "im_stub_succeeded",
|
|
372
398
|
outcome: "succeeded",
|
|
373
|
-
counts:
|
|
399
|
+
counts: k({ matched: 64, created: 64 }),
|
|
374
400
|
changeSetId: "cs_stub_succeeded",
|
|
375
|
-
releases:
|
|
401
|
+
releases: T(1),
|
|
376
402
|
createTime: "2026-11-02T14:00:00.000Z",
|
|
377
403
|
startTime: "2026-11-02T14:00:01.000Z",
|
|
378
|
-
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."
|
|
379
409
|
}),
|
|
380
|
-
|
|
410
|
+
M({
|
|
381
411
|
id: "im_stub_failed",
|
|
382
412
|
outcome: "failed",
|
|
383
413
|
failureReason: "The worker crashed three times running this Import.",
|
|
384
|
-
counts:
|
|
385
|
-
releases:
|
|
414
|
+
counts: k({ matched: 30 }),
|
|
415
|
+
releases: T(1),
|
|
386
416
|
createTime: "2026-11-02T11:00:00.000Z",
|
|
387
417
|
startTime: "2026-11-02T11:00:01.000Z",
|
|
388
418
|
endTime: "2026-11-02T11:20:00.000Z"
|
|
389
419
|
}),
|
|
390
|
-
|
|
420
|
+
M({
|
|
391
421
|
id: "im_stub_cancelled",
|
|
392
422
|
outcome: "cancelled",
|
|
393
423
|
cancelledBy: U,
|
|
394
|
-
counts:
|
|
395
|
-
releases:
|
|
424
|
+
counts: k({ matched: 12, created: 3 }),
|
|
425
|
+
releases: T(1),
|
|
396
426
|
createTime: "2026-11-01T16:00:00.000Z",
|
|
397
427
|
startTime: "2026-11-01T16:00:01.000Z",
|
|
398
428
|
endTime: "2026-11-01T16:01:00.000Z"
|
|
@@ -419,46 +449,46 @@ function Be() {
|
|
|
419
449
|
}
|
|
420
450
|
];
|
|
421
451
|
}
|
|
422
|
-
const
|
|
423
|
-
function
|
|
452
|
+
const Fe = /* @__PURE__ */ new Set(["amp", "lt", "gt", "quot", "apos"]);
|
|
453
|
+
function De(s, a) {
|
|
424
454
|
return s.replace(
|
|
425
455
|
/&([A-Za-z_][\w.-]*);/g,
|
|
426
|
-
(i, m) => !
|
|
456
|
+
(i, m) => !Fe.has(m) && m in a ? a[m] ?? i : i
|
|
427
457
|
);
|
|
428
458
|
}
|
|
429
|
-
function
|
|
459
|
+
function Ae(s, a) {
|
|
430
460
|
if (typeof DOMParser > "u")
|
|
431
461
|
throw new Error("the stub's Mapping Test reads the sample with the DOM: run it in a browser");
|
|
432
462
|
const i = new DOMParser().parseFromString(a, "application/xml"), m = i.getElementsByTagName("parsererror")[0];
|
|
433
463
|
if (m)
|
|
434
|
-
throw new
|
|
464
|
+
throw new z(
|
|
435
465
|
`the sample is not XML: ${(m.textContent ?? "").split(`
|
|
436
466
|
`)[0]}`
|
|
437
467
|
);
|
|
438
468
|
const f = s.elementSelector?.trim() ?? "";
|
|
439
|
-
if (!f) throw new
|
|
469
|
+
if (!f) throw new z("the Mapping has no element selector");
|
|
440
470
|
const b = (() => {
|
|
441
471
|
try {
|
|
442
472
|
const d = i.evaluate(f, i, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
|
|
443
|
-
return Array.from({ length: d.snapshotLength }, (
|
|
473
|
+
return Array.from({ length: d.snapshotLength }, (g, _) => d.snapshotItem(_));
|
|
444
474
|
} catch {
|
|
445
|
-
throw new
|
|
475
|
+
throw new z(`the element selector ${f} cannot be evaluated`);
|
|
446
476
|
}
|
|
447
477
|
})(), o = s.sourceKey?.selector?.trim() ?? "";
|
|
448
478
|
return {
|
|
449
|
-
elements: b.map((d,
|
|
479
|
+
elements: b.map((d, g) => {
|
|
450
480
|
const _ = [];
|
|
451
481
|
let w = "";
|
|
452
482
|
if (o)
|
|
453
483
|
try {
|
|
454
484
|
w = ye(i, o, d).trim();
|
|
455
485
|
} catch {
|
|
456
|
-
throw new
|
|
486
|
+
throw new z(`the Source Key ${o} cannot be evaluated`);
|
|
457
487
|
}
|
|
458
488
|
w || _.push({ field: "", reason: "the element has no Source Key" });
|
|
459
489
|
const I = Ie(i, s.fields ?? [], d, "", _);
|
|
460
490
|
return {
|
|
461
|
-
position:
|
|
491
|
+
position: g + 1,
|
|
462
492
|
sourceKey: w,
|
|
463
493
|
values: I,
|
|
464
494
|
firstDay: "",
|
|
@@ -479,7 +509,7 @@ function Ie(s, a, i, m, f) {
|
|
|
479
509
|
for (const o of a) {
|
|
480
510
|
const d = typeof o.name == "string" ? o.name : "";
|
|
481
511
|
if (!d) continue;
|
|
482
|
-
const
|
|
512
|
+
const g = m ? `${m}.${d}` : d, _ = typeof o.selector == "string" ? o.selector.trim() : "";
|
|
483
513
|
if (o.type === "fieldset") {
|
|
484
514
|
let I = i;
|
|
485
515
|
if (_ && _ !== ".")
|
|
@@ -495,33 +525,33 @@ function Ie(s, a, i, m, f) {
|
|
|
495
525
|
I = null;
|
|
496
526
|
}
|
|
497
527
|
if (!I) {
|
|
498
|
-
o.optional || f.push({ field:
|
|
528
|
+
o.optional || f.push({ field: g, reason: `nothing at ${_}` });
|
|
499
529
|
continue;
|
|
500
530
|
}
|
|
501
|
-
const
|
|
502
|
-
b[d] = Ie(s,
|
|
531
|
+
const O = Array.isArray(o.fields) ? o.fields : [];
|
|
532
|
+
b[d] = Ie(s, O, I, g, f);
|
|
503
533
|
continue;
|
|
504
534
|
}
|
|
505
535
|
if (!_) {
|
|
506
|
-
f.push({ field:
|
|
536
|
+
f.push({ field: g, reason: "the field has no XPath" });
|
|
507
537
|
continue;
|
|
508
538
|
}
|
|
509
539
|
let w;
|
|
510
540
|
try {
|
|
511
541
|
w = ye(s, _, i).trim();
|
|
512
542
|
} catch {
|
|
513
|
-
f.push({ field:
|
|
543
|
+
f.push({ field: g, reason: `the XPath ${_} cannot be evaluated` });
|
|
514
544
|
continue;
|
|
515
545
|
}
|
|
516
546
|
if (!w) {
|
|
517
|
-
o.optional || f.push({ field:
|
|
547
|
+
o.optional || f.push({ field: g, reason: `nothing at ${_}` });
|
|
518
548
|
continue;
|
|
519
549
|
}
|
|
520
550
|
b[d] = w;
|
|
521
551
|
}
|
|
522
552
|
return b;
|
|
523
553
|
}
|
|
524
|
-
const
|
|
554
|
+
const xe = [
|
|
525
555
|
"listImportProfiles",
|
|
526
556
|
"getImportProfile",
|
|
527
557
|
"createImportProfile",
|
|
@@ -550,6 +580,7 @@ const Oe = [
|
|
|
550
580
|
"listImports",
|
|
551
581
|
"getImport",
|
|
552
582
|
"cancelImport",
|
|
583
|
+
"rerunImport",
|
|
553
584
|
"listItemProblems",
|
|
554
585
|
"startDryRun",
|
|
555
586
|
"listDryRunContents",
|
|
@@ -557,8 +588,8 @@ const Oe = [
|
|
|
557
588
|
"createApiKey",
|
|
558
589
|
"revokeApiKey"
|
|
559
590
|
];
|
|
560
|
-
let
|
|
561
|
-
const N = () => (
|
|
591
|
+
let ge = Date.parse("2026-11-02T08:00:00Z");
|
|
592
|
+
const N = () => (ge += 36e5, new Date(ge).toISOString()), ie = (s = []) => s.map((a) => {
|
|
562
593
|
const i = Math.max(a.releaseNumber ?? 0, 1), m = Array.from({ length: i }, (b, o) => ({
|
|
563
594
|
id: `${a.id}_r${o + 1}`,
|
|
564
595
|
content: structuredClone(a.content),
|
|
@@ -573,18 +604,18 @@ const N = () => (he += 36e5, new Date(he).toISOString()), se = (s = []) => s.map
|
|
|
573
604
|
releasedAt: N()
|
|
574
605
|
}));
|
|
575
606
|
return { id: a.id, content: structuredClone(a.content), revisions: m, releases: f };
|
|
576
|
-
}),
|
|
607
|
+
}), C = (s) => s.revisions[s.revisions.length - 1], Se = (s) => s.releases[s.releases.length - 1], j = (s) => {
|
|
577
608
|
const a = Se(s), i = s.revisions.find((m) => m.id === a?.revisionId);
|
|
578
609
|
return {
|
|
579
|
-
draftRevisionId:
|
|
610
|
+
draftRevisionId: C(s).id,
|
|
580
611
|
// By content, as importhub compares: a draft that restored the
|
|
581
612
|
// released content does not differ.
|
|
582
|
-
draftDiffersFromRelease: !i || JSON.stringify(i.content) !== JSON.stringify(
|
|
613
|
+
draftDiffersFromRelease: !i || JSON.stringify(i.content) !== JSON.stringify(C(s).content),
|
|
583
614
|
...a ? { latestRelease: { id: a.id, number: a.number } } : {}
|
|
584
615
|
};
|
|
585
|
-
},
|
|
586
|
-
Object.entries(s).map(([a, i]) => [
|
|
587
|
-
),
|
|
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) => ({
|
|
588
619
|
valid: s.length === 0,
|
|
589
620
|
reasons: s
|
|
590
621
|
}), q = (s) => [...s].sort((a, i) => a.content.name.localeCompare(i.content.name));
|
|
@@ -593,8 +624,8 @@ function qe(s = {}) {
|
|
|
593
624
|
const a = Object.fromEntries(
|
|
594
625
|
Object.entries(
|
|
595
626
|
s.workspaces ?? {
|
|
596
|
-
[
|
|
597
|
-
importProfiles:
|
|
627
|
+
[oe]: {
|
|
628
|
+
importProfiles: Me(),
|
|
598
629
|
mappings: $e(),
|
|
599
630
|
entitySets: Ee(),
|
|
600
631
|
imports: Ne(),
|
|
@@ -604,16 +635,16 @@ function qe(s = {}) {
|
|
|
604
635
|
).map(([e, t]) => [
|
|
605
636
|
e,
|
|
606
637
|
{
|
|
607
|
-
importProfiles:
|
|
608
|
-
mappings:
|
|
609
|
-
entitySets:
|
|
638
|
+
importProfiles: ie(t.importProfiles),
|
|
639
|
+
mappings: ie(t.mappings),
|
|
640
|
+
entitySets: ie(t.entitySets),
|
|
610
641
|
imports: structuredClone(t.imports ?? []),
|
|
611
642
|
apiKeys: structuredClone(t.apiKeys ?? [])
|
|
612
643
|
}
|
|
613
644
|
])
|
|
614
|
-
), i = s.processors ??
|
|
615
|
-
let f = s.activeWorkspaceId ??
|
|
616
|
-
const b = Object.fromEntries(
|
|
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] ??= {
|
|
617
648
|
importProfiles: [],
|
|
618
649
|
mappings: [],
|
|
619
650
|
entitySets: [],
|
|
@@ -622,14 +653,14 @@ function qe(s = {}) {
|
|
|
622
653
|
}, a[f]), d = async (e, t) => {
|
|
623
654
|
if (b[e]++, s.fail) throw s.fail;
|
|
624
655
|
return structuredClone(t());
|
|
625
|
-
},
|
|
656
|
+
}, g = (e, t, n) => {
|
|
626
657
|
const r = e.find((c) => c.id === t);
|
|
627
658
|
if (!r) throw new Error(`${n} ${t} not found`);
|
|
628
659
|
return r;
|
|
629
660
|
}, _ = (e, t, n) => {
|
|
630
661
|
if (!t.trim()) throw new Error("a name is required");
|
|
631
|
-
if (e.some((r) => r.id !== n && r.content.name === t)) throw new
|
|
632
|
-
}, w = (e, t) => t !== "" && t !==
|
|
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 = "") => {
|
|
633
664
|
if (w(e, n))
|
|
634
665
|
throw new Error("the draft moved: somebody saved in between");
|
|
635
666
|
e.content = structuredClone(t), e.revisions.push({
|
|
@@ -639,7 +670,7 @@ function qe(s = {}) {
|
|
|
639
670
|
savedAt: N(),
|
|
640
671
|
restoredFromRevisionId: r
|
|
641
672
|
});
|
|
642
|
-
},
|
|
673
|
+
}, O = (e, t) => {
|
|
643
674
|
const n = Y(e);
|
|
644
675
|
return {
|
|
645
676
|
id: n,
|
|
@@ -676,21 +707,21 @@ function qe(s = {}) {
|
|
|
676
707
|
message: "It has no element selector."
|
|
677
708
|
}), !e.sourceKey?.selector && !e.sourceKey?.template && t.push({ path: "/sourceKey", code: "no_source_key", message: "It has no Source Key." });
|
|
678
709
|
const r = (p, l) => {
|
|
679
|
-
typeof l == "string" && l !== "" && !
|
|
710
|
+
typeof l == "string" && l !== "" && !Oe(l) && t.push({ path: p, code: "invalid_xpath", message: `"${l}" is not an XPath.` });
|
|
680
711
|
};
|
|
681
712
|
r("/element_selector", e.elementSelector), r("/source_key/selector", e.sourceKey?.selector);
|
|
682
713
|
const c = [];
|
|
683
714
|
return (e.fields ?? []).forEach((p, l) => {
|
|
684
715
|
const u = `/fields/${l}`;
|
|
685
|
-
for (const { path:
|
|
686
|
-
c.push(
|
|
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({
|
|
687
718
|
path: u,
|
|
688
719
|
code: "unknown_field_path",
|
|
689
|
-
message: `The pinned Release has no field ${
|
|
720
|
+
message: `The pinned Release has no field ${h}.`
|
|
690
721
|
}), P.type === "select" && !P.selectOptions && t.push({
|
|
691
722
|
path: u,
|
|
692
723
|
code: "xmlmapper_schema",
|
|
693
|
-
message: `The select field ${
|
|
724
|
+
message: `The select field ${h} has no select options.`
|
|
694
725
|
});
|
|
695
726
|
}), (e.versionMatch?.contentFields ?? []).forEach((p, l) => {
|
|
696
727
|
c.includes(p) || t.push({
|
|
@@ -709,14 +740,14 @@ function qe(s = {}) {
|
|
|
709
740
|
path: `/placeholder_assets/${l}`,
|
|
710
741
|
code: "incomplete_placeholder_assets",
|
|
711
742
|
message: "Placeholder Assets need a selector, an asset type, the key's parts and a name selector."
|
|
712
|
-
}), r(`/placeholder_assets/${l}/selector`, p.selector), (p.keyParts ?? []).forEach((u,
|
|
713
|
-
r(`/placeholder_assets/${l}/key_parts/${
|
|
743
|
+
}), r(`/placeholder_assets/${l}/selector`, p.selector), (p.keyParts ?? []).forEach((u, h) => {
|
|
744
|
+
r(`/placeholder_assets/${l}/key_parts/${h}`, u);
|
|
714
745
|
});
|
|
715
|
-
}), t.push(...
|
|
746
|
+
}), t.push(...Ke(e, n?.fields, c)), t;
|
|
716
747
|
}
|
|
717
|
-
function
|
|
748
|
+
function le(e, t, n) {
|
|
718
749
|
return e.flatMap((r, c) => {
|
|
719
|
-
const p = `/${t}/${c}`, l = i.find((
|
|
750
|
+
const p = `/${t}/${c}`, l = i.find((h) => h.name === r.processor);
|
|
720
751
|
return l ? l.target !== "source_file" ? [
|
|
721
752
|
{
|
|
722
753
|
path: p,
|
|
@@ -724,11 +755,11 @@ function qe(s = {}) {
|
|
|
724
755
|
message: `${l.name} is configured on a rich-text field, not on a Profile.`
|
|
725
756
|
}
|
|
726
757
|
] : l.kind !== n ? [{ path: p, code: "wrong_processor_kind", message: `${l.name} does not run here.` }] : l.settingsSpec.filter(
|
|
727
|
-
(
|
|
728
|
-
).map((
|
|
729
|
-
path: `${p}/settings/${
|
|
758
|
+
(h) => h.config.required && (r.settings[h.config.api_accessor] ?? "") === ""
|
|
759
|
+
).map((h) => ({
|
|
760
|
+
path: `${p}/settings/${h.config.api_accessor}`,
|
|
730
761
|
code: "invalid_processor_settings",
|
|
731
|
-
message: `${l.name}: ${
|
|
762
|
+
message: `${l.name}: ${h.config.api_accessor} is required.`
|
|
732
763
|
})) : [
|
|
733
764
|
{ path: p, code: "unknown_processor", message: `No Processor is called ${r.processor}.` }
|
|
734
765
|
];
|
|
@@ -736,8 +767,8 @@ function qe(s = {}) {
|
|
|
736
767
|
}
|
|
737
768
|
function V(e) {
|
|
738
769
|
const t = o(), n = [
|
|
739
|
-
...
|
|
740
|
-
...
|
|
770
|
+
...le(e.preprocessors, "preprocessors", "preprocessor"),
|
|
771
|
+
...le(e.postProcessors, "postProcessors", "post_processor")
|
|
741
772
|
];
|
|
742
773
|
return e.mappingIds.length === 0 && n.push({ path: "/mappingIds", code: "no_mappings", message: "It includes no Mapping." }), e.mappingIds.forEach((r, c) => {
|
|
743
774
|
const p = t.mappings.find((u) => u.id === r);
|
|
@@ -761,25 +792,25 @@ function qe(s = {}) {
|
|
|
761
792
|
message: "It names an Entity Set that does not exist."
|
|
762
793
|
}), n;
|
|
763
794
|
}
|
|
764
|
-
const
|
|
795
|
+
const ce = (e) => Object.keys(e.entities).length === 0 ? [{ path: "/entities", code: "no_entities", message: "It defines no entity." }] : [], Z = (e) => ({
|
|
765
796
|
id: e.id,
|
|
766
797
|
content: e.content,
|
|
767
|
-
validity:
|
|
798
|
+
validity: x(V(e.content)),
|
|
768
799
|
state: j(e)
|
|
769
800
|
}), J = (e) => ({
|
|
770
801
|
id: e.id,
|
|
771
802
|
content: e.content,
|
|
772
|
-
validity:
|
|
803
|
+
validity: x(X(e.content)),
|
|
773
804
|
state: j(e)
|
|
774
805
|
}), G = (e) => ({
|
|
775
806
|
id: e.id,
|
|
776
807
|
content: e.content,
|
|
777
|
-
validity:
|
|
808
|
+
validity: x(ce(e.content)),
|
|
778
809
|
state: j(e)
|
|
779
810
|
}), L = (e) => q(o().importProfiles.filter((t) => e(t.content))).map((t) => ({
|
|
780
811
|
id: t.id,
|
|
781
812
|
name: t.content.name
|
|
782
|
-
})), Y = (e) => `${e}_stub_new_${++_e}`,
|
|
813
|
+
})), Y = (e) => `${e}_stub_new_${++_e}`, K = (e) => {
|
|
783
814
|
const t = o();
|
|
784
815
|
switch (e) {
|
|
785
816
|
case "importProfile":
|
|
@@ -798,22 +829,22 @@ function qe(s = {}) {
|
|
|
798
829
|
return {
|
|
799
830
|
items: t.entitySets,
|
|
800
831
|
name: "Entity Set",
|
|
801
|
-
reasons: (n) =>
|
|
832
|
+
reasons: (n) => ce(n)
|
|
802
833
|
};
|
|
803
834
|
}
|
|
804
|
-
},
|
|
805
|
-
|
|
835
|
+
}, E = (e, t) => {
|
|
836
|
+
C(t).validity = x(K(e).reasons(t.content));
|
|
806
837
|
}, W = (e, t) => {
|
|
807
838
|
const n = e.revisions.find((r) => r.id === t);
|
|
808
839
|
if (!n) throw new Error(`Revision ${t} not found`);
|
|
809
840
|
return n;
|
|
810
|
-
},
|
|
841
|
+
}, Q = /* @__PURE__ */ new Set(), pe = s.contenthubRights ?? ["editor", "publisher"], B = (e) => {
|
|
811
842
|
const t = o().imports.find((n) => n.id === e);
|
|
812
843
|
if (!t) throw new Error(`Import ${e} not found`);
|
|
813
844
|
return t;
|
|
814
|
-
},
|
|
845
|
+
}, ee = (e) => {
|
|
815
846
|
e.cancelledBy && e.phase !== "ended" && (e.phase = "ended", e.outcome = "cancelled", e.endTime = N());
|
|
816
|
-
},
|
|
847
|
+
}, F = ({ itemProblems: e, dryRunContents: t, ...n }) => n, we = (e, t) => {
|
|
817
848
|
const n = Se(e);
|
|
818
849
|
if (!n)
|
|
819
850
|
throw new D(`the ${t} ${e.content.name} has no Release yet`);
|
|
@@ -834,27 +865,27 @@ function qe(s = {}) {
|
|
|
834
865
|
name: e.content.name,
|
|
835
866
|
releaseId: "",
|
|
836
867
|
number: 0,
|
|
837
|
-
revisionId:
|
|
868
|
+
revisionId: C(e).id
|
|
838
869
|
}
|
|
839
|
-
}),
|
|
840
|
-
const n = o(), r = t && (e.draft ?? !1), c =
|
|
841
|
-
if (!
|
|
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))
|
|
842
873
|
throw new D("nothing was uploaded to the Source File");
|
|
843
|
-
if (!t && !
|
|
874
|
+
if (!t && !pe.includes("editor"))
|
|
844
875
|
throw new D("starting an Import needs contenthub editor in the workspace");
|
|
845
|
-
const p = (
|
|
846
|
-
if (!t && l.content.autoPublish && !
|
|
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"))
|
|
847
878
|
throw new D(
|
|
848
879
|
"the Import Profile has Auto-publish, which needs contenthub publisher"
|
|
849
880
|
);
|
|
850
881
|
const u = V(l.content);
|
|
851
882
|
if (u.length > 0)
|
|
852
883
|
throw new D(
|
|
853
|
-
`the ${r ? "draft of the " : ""}Import Profile ${l.ref.name} is invalid: ${u.map((
|
|
884
|
+
`the ${r ? "draft of the " : ""}Import Profile ${l.ref.name} is invalid: ${u.map((R) => R.message).join(" ")}`
|
|
854
885
|
);
|
|
855
|
-
const
|
|
856
|
-
(
|
|
857
|
-
), v = l.content.entitySetId ? p(
|
|
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 = {
|
|
858
889
|
id: Y("im"),
|
|
859
890
|
importProfileId: c.id,
|
|
860
891
|
importProfileName: l.ref.name,
|
|
@@ -877,7 +908,7 @@ function qe(s = {}) {
|
|
|
877
908
|
changeSetId: "",
|
|
878
909
|
releases: {
|
|
879
910
|
importProfile: l.ref,
|
|
880
|
-
mappings:
|
|
911
|
+
mappings: h,
|
|
881
912
|
...v ? { entitySet: v } : {}
|
|
882
913
|
},
|
|
883
914
|
createTime: N(),
|
|
@@ -888,6 +919,9 @@ function qe(s = {}) {
|
|
|
888
919
|
...e.source ? { source: e.source } : {},
|
|
889
920
|
dryRun: t,
|
|
890
921
|
draft: r,
|
|
922
|
+
assetMoves: [],
|
|
923
|
+
sourceFileDeleteTime: "",
|
|
924
|
+
sourceFileDeletionReason: "",
|
|
891
925
|
itemProblems: [],
|
|
892
926
|
...t ? { dryRunContents: [] } : {}
|
|
893
927
|
};
|
|
@@ -899,36 +933,36 @@ function qe(s = {}) {
|
|
|
899
933
|
f = e;
|
|
900
934
|
},
|
|
901
935
|
updateImport(e, t) {
|
|
902
|
-
Object.assign(
|
|
936
|
+
Object.assign(B(e), structuredClone(t));
|
|
903
937
|
},
|
|
904
938
|
listImportProfiles: () => d("listImportProfiles", () => q(o().importProfiles).map(Z)),
|
|
905
|
-
getImportProfile: (e) => d("getImportProfile", () => Z(
|
|
939
|
+
getImportProfile: (e) => d("getImportProfile", () => Z(g(o().importProfiles, e, "Import Profile"))),
|
|
906
940
|
createImportProfile: (e) => d("createImportProfile", () => {
|
|
907
941
|
_(o().importProfiles, e.name);
|
|
908
|
-
const t =
|
|
909
|
-
return
|
|
942
|
+
const t = O("ip", e);
|
|
943
|
+
return E("importProfile", t), o().importProfiles.push(t), Z(t);
|
|
910
944
|
}),
|
|
911
945
|
updateImportProfile: (e, t, n) => d("updateImportProfile", () => {
|
|
912
|
-
const r =
|
|
913
|
-
return _(o().importProfiles, t.name, e), I(r, t, n),
|
|
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);
|
|
914
948
|
}),
|
|
915
949
|
deleteImportProfile: (e) => d("deleteImportProfile", () => {
|
|
916
|
-
|
|
950
|
+
g(o().importProfiles, e, "Import Profile"), o().importProfiles = o().importProfiles.filter((t) => t.id !== e);
|
|
917
951
|
}),
|
|
918
952
|
listProcessors: () => d("listProcessors", () => [...i].sort((e, t) => e.name.localeCompare(t.name))),
|
|
919
953
|
listMappings: () => d("listMappings", () => q(o().mappings).map(J)),
|
|
920
|
-
getMapping: (e) => d("getMapping", () => J(
|
|
954
|
+
getMapping: (e) => d("getMapping", () => J(g(o().mappings, e, "Mapping"))),
|
|
921
955
|
createMapping: (e) => d("createMapping", () => {
|
|
922
956
|
_(o().mappings, e.name);
|
|
923
|
-
const t =
|
|
924
|
-
return
|
|
957
|
+
const t = O("mp", e);
|
|
958
|
+
return E("mapping", t), o().mappings.push(t), J(t);
|
|
925
959
|
}),
|
|
926
960
|
updateMapping: (e, t, n) => d("updateMapping", () => {
|
|
927
|
-
const r =
|
|
928
|
-
return _(o().mappings, t.name, e), I(r, t, n),
|
|
961
|
+
const r = g(o().mappings, e, "Mapping");
|
|
962
|
+
return _(o().mappings, t.name, e), I(r, t, n), E("mapping", r), J(r);
|
|
929
963
|
}),
|
|
930
964
|
deleteMapping: (e) => d("deleteMapping", () => {
|
|
931
|
-
|
|
965
|
+
g(o().mappings, e, "Mapping");
|
|
932
966
|
const t = L((n) => n.mappingIds.includes(e));
|
|
933
967
|
if (t.length > 0)
|
|
934
968
|
throw new me(
|
|
@@ -937,15 +971,15 @@ function qe(s = {}) {
|
|
|
937
971
|
);
|
|
938
972
|
o().mappings = o().mappings.filter((n) => n.id !== e);
|
|
939
973
|
}),
|
|
940
|
-
listMappingImportProfiles: (e) => d("listMappingImportProfiles", () => (
|
|
974
|
+
listMappingImportProfiles: (e) => d("listMappingImportProfiles", () => (g(o().mappings, e, "Mapping"), L((t) => t.mappingIds.includes(e)))),
|
|
941
975
|
checkMappingBlueprintRelease: (e, t) => d("checkMappingBlueprintRelease", () => {
|
|
942
|
-
const n =
|
|
976
|
+
const n = g(o().mappings, e, "Mapping"), r = m.find((c) => c.id === t);
|
|
943
977
|
if (!r) throw new Error(`Blueprint Release ${t} not found`);
|
|
944
978
|
if (r.blueprintId !== n.content.blueprintId)
|
|
945
979
|
throw new Error("the Release is of another Blueprint");
|
|
946
980
|
return {
|
|
947
981
|
blueprintId: r.blueprintId,
|
|
948
|
-
missingFieldPaths: (n.content.fields ?? []).flatMap((c, p) =>
|
|
982
|
+
missingFieldPaths: (n.content.fields ?? []).flatMap((c, p) => ae(c, "", `/fields/${p}`).map((l) => l.path)).filter((c) => !r.fieldPaths.includes(c)),
|
|
949
983
|
missingReleaseSpecFields: [
|
|
950
984
|
...(n.content.releaseSpec ?? []).map((c) => c.field ?? ""),
|
|
951
985
|
...n.content.versionMatch?.releaseSpecFields ?? []
|
|
@@ -958,24 +992,24 @@ function qe(s = {}) {
|
|
|
958
992
|
let r = new TextDecoder().decode(t);
|
|
959
993
|
if (n) {
|
|
960
994
|
const c = o().entitySets.find((p) => p.id === n);
|
|
961
|
-
if (!c) throw new
|
|
962
|
-
r =
|
|
995
|
+
if (!c) throw new z(`Entity Set ${n} not found`);
|
|
996
|
+
r = De(r, c.content.entities);
|
|
963
997
|
}
|
|
964
|
-
return
|
|
998
|
+
return Ae(e, r);
|
|
965
999
|
}),
|
|
966
1000
|
listEntitySets: () => d("listEntitySets", () => q(o().entitySets).map(G)),
|
|
967
|
-
getEntitySet: (e) => d("getEntitySet", () => G(
|
|
1001
|
+
getEntitySet: (e) => d("getEntitySet", () => G(g(o().entitySets, e, "Entity Set"))),
|
|
968
1002
|
createEntitySet: (e) => d("createEntitySet", () => {
|
|
969
1003
|
_(o().entitySets, e.name);
|
|
970
|
-
const t =
|
|
971
|
-
return
|
|
1004
|
+
const t = O("es", e);
|
|
1005
|
+
return E("entitySet", t), o().entitySets.push(t), G(t);
|
|
972
1006
|
}),
|
|
973
1007
|
updateEntitySet: (e, t, n) => d("updateEntitySet", () => {
|
|
974
|
-
const r =
|
|
975
|
-
return _(o().entitySets, t.name, e), I(r, t, n),
|
|
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);
|
|
976
1010
|
}),
|
|
977
1011
|
deleteEntitySet: (e) => d("deleteEntitySet", () => {
|
|
978
|
-
|
|
1012
|
+
g(o().entitySets, e, "Entity Set");
|
|
979
1013
|
const t = L((n) => n.entitySetId === e);
|
|
980
1014
|
if (t.length > 0)
|
|
981
1015
|
throw new me(
|
|
@@ -985,55 +1019,55 @@ function qe(s = {}) {
|
|
|
985
1019
|
o().entitySets = o().entitySets.filter((n) => n.id !== e);
|
|
986
1020
|
}),
|
|
987
1021
|
cutRelease: (e, t, n) => d("cutRelease", () => {
|
|
988
|
-
const r =
|
|
1022
|
+
const r = K(e), c = g(r.items, t, r.name);
|
|
989
1023
|
if (w(c, n))
|
|
990
|
-
throw new
|
|
991
|
-
const p =
|
|
992
|
-
if (!p.valid) throw new
|
|
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);
|
|
993
1027
|
if (!j(c).draftDiffersFromRelease)
|
|
994
|
-
throw new
|
|
1028
|
+
throw new se(
|
|
995
1029
|
"the draft does not differ from the latest Release: there is nothing to release"
|
|
996
1030
|
);
|
|
997
1031
|
const l = c.releases.length + 1, u = {
|
|
998
1032
|
id: `${c.id}_rel${l}`,
|
|
999
1033
|
number: l,
|
|
1000
|
-
revisionId:
|
|
1034
|
+
revisionId: C(c).id,
|
|
1001
1035
|
releasedBy: y,
|
|
1002
1036
|
releasedAt: N()
|
|
1003
1037
|
};
|
|
1004
1038
|
return c.releases.push(u), {
|
|
1005
1039
|
release: u,
|
|
1006
|
-
importProfiles: e === "mapping" ? L((
|
|
1040
|
+
importProfiles: e === "mapping" ? L((h) => h.mappingIds.includes(t)) : []
|
|
1007
1041
|
};
|
|
1008
1042
|
}),
|
|
1009
1043
|
listHistory: (e, t, n) => d("listHistory", () => {
|
|
1010
|
-
const r =
|
|
1044
|
+
const r = K(e), c = g(r.items, t, r.name), p = [...c.revisions].reverse(), l = Number(n || "0");
|
|
1011
1045
|
return {
|
|
1012
|
-
revisions: p.slice(l, l + 10).map((
|
|
1013
|
-
id:
|
|
1014
|
-
savedBy:
|
|
1015
|
-
savedAt:
|
|
1016
|
-
validity:
|
|
1017
|
-
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
|
|
1018
1052
|
})),
|
|
1019
1053
|
releases: [...c.releases].reverse(),
|
|
1020
1054
|
nextPageToken: l + 10 < p.length ? String(l + 10) : ""
|
|
1021
1055
|
};
|
|
1022
1056
|
}),
|
|
1023
1057
|
compareRevisions: (e, t, n, r) => d("compareRevisions", () => {
|
|
1024
|
-
const c =
|
|
1025
|
-
const P = l[v],
|
|
1026
|
-
return { field: v, status:
|
|
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 };
|
|
1027
1061
|
});
|
|
1028
1062
|
return {
|
|
1029
1063
|
from: { revisionId: n, content: l },
|
|
1030
1064
|
to: { revisionId: r, content: u },
|
|
1031
|
-
fields:
|
|
1065
|
+
fields: h
|
|
1032
1066
|
};
|
|
1033
1067
|
}),
|
|
1034
1068
|
restoreRevision: (e, t, n, r) => d("restoreRevision", () => {
|
|
1035
|
-
const c =
|
|
1036
|
-
I(p, W(p, n).content, r, n),
|
|
1069
|
+
const c = K(e), p = g(c.items, t, c.name);
|
|
1070
|
+
I(p, W(p, n).content, r, n), E(e, p);
|
|
1037
1071
|
}),
|
|
1038
1072
|
async uploadSourceFile(e, t) {
|
|
1039
1073
|
if (b.uploadSourceFile++, s.fail) throw s.fail;
|
|
@@ -1042,52 +1076,73 @@ function qe(s = {}) {
|
|
|
1042
1076
|
if (s.uploadFails) throw s.uploadFails;
|
|
1043
1077
|
t(1);
|
|
1044
1078
|
const n = Y("sf");
|
|
1045
|
-
return
|
|
1079
|
+
return Q.add(n), { id: n, fileName: e.name };
|
|
1046
1080
|
},
|
|
1047
|
-
startImport: (e) => d("startImport", () =>
|
|
1081
|
+
startImport: (e) => d("startImport", () => F(te(e, !1))),
|
|
1048
1082
|
listImports: (e) => d("listImports", () => {
|
|
1049
1083
|
const t = o().imports;
|
|
1050
|
-
t.forEach(
|
|
1084
|
+
t.forEach(ee);
|
|
1051
1085
|
const n = Number(e || "0");
|
|
1052
1086
|
return {
|
|
1053
|
-
|
|
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: [] })),
|
|
1054
1090
|
nextPageToken: n + 50 < t.length ? String(n + 50) : ""
|
|
1055
1091
|
};
|
|
1056
1092
|
}),
|
|
1057
1093
|
getImport: (e) => d("getImport", () => {
|
|
1058
|
-
const t =
|
|
1059
|
-
return
|
|
1094
|
+
const t = B(e);
|
|
1095
|
+
return ee(t), F(t);
|
|
1060
1096
|
}),
|
|
1061
1097
|
cancelImport: (e) => d("cancelImport", () => {
|
|
1062
|
-
const t =
|
|
1098
|
+
const t = B(e);
|
|
1063
1099
|
if (t.phase === "ended") throw new Error("the Import has ended");
|
|
1064
|
-
return t.cancelledBy ||= y, t.phase === "queued" &&
|
|
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
|
+
);
|
|
1065
1120
|
}),
|
|
1066
1121
|
listItemProblems: (e, t) => d("listItemProblems", () => {
|
|
1067
|
-
const n =
|
|
1122
|
+
const n = B(e).itemProblems ?? [], r = t.sourceKeyQuery.toLowerCase(), c = n.filter(
|
|
1068
1123
|
(u) => (!t.mappingId || u.mappingId === t.mappingId) && u.sourceKey.toLowerCase().includes(r)
|
|
1069
1124
|
), p = /* @__PURE__ */ new Map();
|
|
1070
1125
|
for (const u of n) {
|
|
1071
|
-
const
|
|
1126
|
+
const h = p.get(u.mappingId) ?? {
|
|
1072
1127
|
mappingId: u.mappingId,
|
|
1073
1128
|
mappingName: u.mappingName,
|
|
1074
1129
|
count: 0
|
|
1075
1130
|
};
|
|
1076
|
-
|
|
1131
|
+
h.count++, p.set(u.mappingId, h);
|
|
1077
1132
|
}
|
|
1078
1133
|
const l = Number(t.pageToken || "0");
|
|
1079
1134
|
return {
|
|
1080
1135
|
itemProblems: c.slice(l, l + 50),
|
|
1081
1136
|
totalCount: n.length,
|
|
1082
1137
|
matchingCount: c.length,
|
|
1083
|
-
mappings: [...p.values()].sort((u,
|
|
1138
|
+
mappings: [...p.values()].sort((u, h) => u.mappingName.localeCompare(h.mappingName)),
|
|
1084
1139
|
pendingReferenceCount: n.filter((u) => u.pendingReference).length,
|
|
1085
1140
|
nextPageToken: l + 50 < c.length ? String(l + 50) : ""
|
|
1086
1141
|
};
|
|
1087
1142
|
}),
|
|
1088
|
-
startDryRun: (e) => d("startDryRun", () =>
|
|
1143
|
+
startDryRun: (e) => d("startDryRun", () => F(te(e, !0))),
|
|
1089
1144
|
listDryRunContents: (e, t) => d("listDryRunContents", () => {
|
|
1090
|
-
const n =
|
|
1145
|
+
const n = B(e);
|
|
1091
1146
|
if (!n.dryRun) throw new Error("the Import is no Dry Run");
|
|
1092
1147
|
const r = n.dryRunContents ?? [], c = t.sourceKeyQuery.toLowerCase(), p = r.filter(
|
|
1093
1148
|
(u) => (!t.action || u.action === t.action) && (!t.mappingId || u.mappingId === t.mappingId) && u.sourceKey.toLowerCase().includes(c)
|
|
@@ -1125,20 +1180,20 @@ function qe(s = {}) {
|
|
|
1125
1180
|
})
|
|
1126
1181
|
};
|
|
1127
1182
|
}
|
|
1128
|
-
function
|
|
1183
|
+
function Oe(s) {
|
|
1129
1184
|
const a = [], i = { "]": "[", ")": "(" };
|
|
1130
1185
|
for (const m of s)
|
|
1131
1186
|
if (m === "[" || m === "(") a.push(m);
|
|
1132
1187
|
else if (m in i && a.pop() !== i[m]) return !1;
|
|
1133
1188
|
return a.length === 0;
|
|
1134
1189
|
}
|
|
1135
|
-
function
|
|
1190
|
+
function ae(s, a, i) {
|
|
1136
1191
|
const m = `${a}${String(s.name ?? "")}`;
|
|
1137
1192
|
return [
|
|
1138
1193
|
{ path: m, rel: i, mapping: s },
|
|
1139
1194
|
...["fields", "virtualTableFields"].flatMap(
|
|
1140
1195
|
(f) => (Array.isArray(s[f]) ? s[f] : []).flatMap(
|
|
1141
|
-
(b, o) =>
|
|
1196
|
+
(b, o) => ae(b, `${m}.`, `${i}/${f}/${o}`)
|
|
1142
1197
|
)
|
|
1143
1198
|
)
|
|
1144
1199
|
];
|
|
@@ -1170,9 +1225,9 @@ function He(s = be()) {
|
|
|
1170
1225
|
}
|
|
1171
1226
|
};
|
|
1172
1227
|
}
|
|
1173
|
-
function
|
|
1174
|
-
const m = (s.displayNameTemplate ?? "").trim(), f = (s.displayNameField ?? "").trim(), b = (d,
|
|
1175
|
-
{ 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: _ }
|
|
1176
1231
|
];
|
|
1177
1232
|
if (!m && !f) return [];
|
|
1178
1233
|
if (!f)
|
|
@@ -1188,7 +1243,7 @@ function De(s, a, i) {
|
|
|
1188
1243
|
`the display-name field "${f}" has no display-name template to fill it`
|
|
1189
1244
|
);
|
|
1190
1245
|
if (!a) return [];
|
|
1191
|
-
const o = (d) => d.flatMap((
|
|
1246
|
+
const o = (d) => d.flatMap((g) => [g.path, ...o(g.children)]);
|
|
1192
1247
|
return o(a).includes(f) ? ve(a).some((d) => d.path === f) ? i.includes(f) ? b(
|
|
1193
1248
|
"/display_name_field",
|
|
1194
1249
|
"display_name_field_mapped",
|
|
@@ -1207,17 +1262,17 @@ export {
|
|
|
1207
1262
|
U as STUB_OTHER_USER_ID,
|
|
1208
1263
|
Ge as STUB_OTHER_WORKSPACE_ID,
|
|
1209
1264
|
y as STUB_USER_ID,
|
|
1210
|
-
|
|
1265
|
+
oe as STUB_WORKSPACE_ID,
|
|
1211
1266
|
He as createStubBlueprints,
|
|
1212
1267
|
qe as createStubImporthubClient,
|
|
1213
1268
|
Be as stubApiKeys,
|
|
1214
1269
|
be as stubBlueprintReleases,
|
|
1215
1270
|
Ee as stubEntitySets,
|
|
1216
1271
|
Le as stubIdentity,
|
|
1217
|
-
|
|
1272
|
+
Me as stubImportProfiles,
|
|
1218
1273
|
Ne as stubImports,
|
|
1219
1274
|
je as stubMappingTestSample,
|
|
1220
1275
|
$e as stubMappings,
|
|
1221
|
-
|
|
1276
|
+
ke as stubProcessors
|
|
1222
1277
|
};
|
|
1223
1278
|
//# sourceMappingURL=testing.js.map
|