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