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