@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/CHANGELOG.md +7 -0
- package/README.md +5 -4
- package/dist/{importhub-client-Wrb4s3lw.js → importhub-client-BzOVIXA4.js} +16 -7
- package/dist/importhub-client-BzOVIXA4.js.map +1 -0
- package/dist/index.d.ts +298 -5
- package/dist/index.js +1781 -1411
- package/dist/index.js.map +1 -1
- package/dist/mapping-editor.d.ts +96 -1
- package/dist/mapping-editor.js +1 -1
- package/dist/{mapping-page-BTEJR0-z.js → mapping-page-Bl2rA1SR.js} +301 -291
- package/dist/mapping-page-Bl2rA1SR.js.map +1 -0
- package/dist/testing.d.ts +100 -2
- package/dist/testing.js +580 -481
- package/dist/testing.js.map +1 -1
- package/package.json +1 -1
- package/dist/importhub-client-Wrb4s3lw.js.map +0 -1
- package/dist/mapping-page-BTEJR0-z.js.map +0 -1
package/dist/testing.js
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import { createHostMembers as
|
|
2
|
-
import { M as
|
|
3
|
-
import { p as
|
|
4
|
-
const
|
|
5
|
-
function
|
|
1
|
+
import { createHostMembers as 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:
|
|
8
|
-
workspaceId:
|
|
9
|
-
members:
|
|
10
|
-
{ userId:
|
|
11
|
-
{ userId:
|
|
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 = (
|
|
16
|
-
accessor:
|
|
17
|
-
path:
|
|
15
|
+
const S = (s, a, i, m = []) => ({
|
|
16
|
+
accessor: s.split(".").pop() ?? s,
|
|
17
|
+
path: s,
|
|
18
18
|
fieldType: a,
|
|
19
|
-
label:
|
|
19
|
+
label: i,
|
|
20
20
|
children: m
|
|
21
|
-
}),
|
|
21
|
+
}), H = (s) => s.flatMap((a) => [a.path, ...H(a.children)]), ue = (s) => [
|
|
22
22
|
S("titel", "text", "Titel"),
|
|
23
23
|
S("abkuerzung", "text", "Abkürzung"),
|
|
24
24
|
S("anzeigename", "textarea", "Anzeigename"),
|
|
25
|
-
...
|
|
25
|
+
...s ? [S("fussnote", "rich_text", "Fußnote")] : [],
|
|
26
26
|
S("stand", "fieldset", "Stand", [
|
|
27
27
|
S("stand.datum", "date", "Datum"),
|
|
28
28
|
S("stand.art", "select", "Art")
|
|
29
29
|
])
|
|
30
|
-
],
|
|
30
|
+
], fe = () => [
|
|
31
31
|
S("fundstelle", "text", "Fundstelle"),
|
|
32
32
|
S("ausgabedatum", "date", "Ausgabedatum")
|
|
33
33
|
];
|
|
34
|
-
function
|
|
35
|
-
const
|
|
34
|
+
function be() {
|
|
35
|
+
const s = ue(!1), a = ue(!0), i = [
|
|
36
36
|
S("aktenzeichen", "text", "Aktenzeichen"),
|
|
37
37
|
S("datum", "date", "Datum")
|
|
38
38
|
];
|
|
@@ -42,30 +42,30 @@ function ge() {
|
|
|
42
42
|
blueprintId: "bp_stub_gesetz",
|
|
43
43
|
blueprintName: "Gesetz",
|
|
44
44
|
label: "Release 2",
|
|
45
|
-
fieldPaths:
|
|
46
|
-
fields:
|
|
47
|
-
releaseSpecFields:
|
|
45
|
+
fieldPaths: H(s),
|
|
46
|
+
fields: s,
|
|
47
|
+
releaseSpecFields: fe()
|
|
48
48
|
},
|
|
49
49
|
{
|
|
50
50
|
id: "br_stub_gesetz_1",
|
|
51
51
|
blueprintId: "bp_stub_gesetz",
|
|
52
52
|
blueprintName: "Gesetz",
|
|
53
53
|
label: "Release 1",
|
|
54
|
-
fieldPaths:
|
|
54
|
+
fieldPaths: H(a),
|
|
55
55
|
fields: a,
|
|
56
|
-
releaseSpecFields:
|
|
56
|
+
releaseSpecFields: fe()
|
|
57
57
|
},
|
|
58
58
|
{
|
|
59
59
|
id: "br_stub_entscheidung_1",
|
|
60
60
|
blueprintId: "bp_stub_entscheidung",
|
|
61
61
|
blueprintName: "Entscheidung",
|
|
62
62
|
label: "Release 1",
|
|
63
|
-
fieldPaths:
|
|
64
|
-
fields:
|
|
63
|
+
fieldPaths: H(i),
|
|
64
|
+
fields: i
|
|
65
65
|
}
|
|
66
66
|
];
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function $e() {
|
|
69
69
|
return [
|
|
70
70
|
{
|
|
71
71
|
id: "mp_stub_norm",
|
|
@@ -103,7 +103,7 @@ const je = `<?xml version="1.0" encoding="UTF-8"?>
|
|
|
103
103
|
<norm id="n2"><titel>§ 2 Begriffsbestimmungen</titel></norm>
|
|
104
104
|
</gesetz>
|
|
105
105
|
`;
|
|
106
|
-
function
|
|
106
|
+
function Ee() {
|
|
107
107
|
return [
|
|
108
108
|
{
|
|
109
109
|
id: "es_stub_latin1",
|
|
@@ -116,7 +116,7 @@ function ve() {
|
|
|
116
116
|
}
|
|
117
117
|
];
|
|
118
118
|
}
|
|
119
|
-
function
|
|
119
|
+
function 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
|
|
150
|
+
const ne = (s, a, i, m = "") => ({
|
|
151
151
|
field_type: "text",
|
|
152
|
-
config: { name: a, api_accessor:
|
|
152
|
+
config: { name: a, api_accessor: s, required: i, instructions: m },
|
|
153
153
|
system: !1
|
|
154
154
|
});
|
|
155
|
-
function
|
|
155
|
+
function 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
|
-
|
|
178
|
-
|
|
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: [
|
|
186
|
+
settingsSpec: [ne("element", "Element", !1)]
|
|
187
187
|
}
|
|
188
188
|
];
|
|
189
189
|
}
|
|
190
|
-
const M = (
|
|
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
|
-
|
|
199
|
-
|
|
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${
|
|
204
|
-
number:
|
|
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 = (
|
|
222
|
+
}), E = (s) => ({
|
|
221
223
|
importProfileId: "ip_stub_gesetz",
|
|
222
224
|
importProfileName: "Boorberg gesetz",
|
|
223
|
-
sourceFileId: `sf_${
|
|
224
|
-
startedBy:
|
|
225
|
+
sourceFileId: `sf_${s.id}`,
|
|
226
|
+
startedBy: y,
|
|
225
227
|
phase: "ended",
|
|
226
228
|
failureReason: "",
|
|
227
229
|
progress: { done: 0, total: 0 },
|
|
228
230
|
counts: M(),
|
|
229
231
|
changeSetId: "",
|
|
230
|
-
releases:
|
|
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
|
-
|
|
237
|
-
|
|
238
|
-
|
|
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:
|
|
245
|
+
sourceKey: i,
|
|
242
246
|
field: m,
|
|
243
|
-
reason:
|
|
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
|
|
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:
|
|
260
|
-
releases:
|
|
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
|
-
...
|
|
346
|
+
...R(2),
|
|
277
347
|
mappings: [
|
|
278
|
-
...
|
|
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
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
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:
|
|
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:
|
|
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:
|
|
393
|
+
cancelledBy: U,
|
|
324
394
|
counts: M({ matched: 12, created: 3 }),
|
|
325
|
-
releases:
|
|
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
|
|
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:
|
|
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:
|
|
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
|
|
353
|
-
function
|
|
354
|
-
return
|
|
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
|
-
(
|
|
426
|
+
(i, m) => !Ae.has(m) && m in a ? a[m] ?? i : i
|
|
357
427
|
);
|
|
358
428
|
}
|
|
359
|
-
function
|
|
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
|
|
432
|
+
const i = new DOMParser().parseFromString(a, "application/xml"), m = i.getElementsByTagName("parsererror")[0];
|
|
363
433
|
if (m)
|
|
364
|
-
throw new
|
|
434
|
+
throw new F(
|
|
365
435
|
`the sample is not XML: ${(m.textContent ?? "").split(`
|
|
366
436
|
`)[0]}`
|
|
367
437
|
);
|
|
368
|
-
const
|
|
369
|
-
if (!
|
|
370
|
-
const
|
|
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 =
|
|
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
|
|
445
|
+
throw new F(`the element selector ${f} cannot be evaluated`);
|
|
376
446
|
}
|
|
377
|
-
})(),
|
|
447
|
+
})(), o = s.sourceKey?.selector?.trim() ?? "";
|
|
378
448
|
return {
|
|
379
|
-
elements:
|
|
449
|
+
elements: b.map((d, h) => {
|
|
380
450
|
const _ = [];
|
|
381
451
|
let w = "";
|
|
382
|
-
if (
|
|
452
|
+
if (o)
|
|
383
453
|
try {
|
|
384
|
-
w =
|
|
454
|
+
w = ye(i, o, d).trim();
|
|
385
455
|
} catch {
|
|
386
|
-
throw new
|
|
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 =
|
|
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: [...
|
|
468
|
+
collections: [...s.collections ?? []],
|
|
399
469
|
problems: _
|
|
400
470
|
};
|
|
401
471
|
})
|
|
402
472
|
};
|
|
403
473
|
}
|
|
404
|
-
function
|
|
405
|
-
return
|
|
474
|
+
function ye(s, a, i) {
|
|
475
|
+
return s.evaluate(`string(${a})`, i, null, XPathResult.STRING_TYPE, null).stringValue;
|
|
406
476
|
}
|
|
407
|
-
function
|
|
408
|
-
const
|
|
409
|
-
for (const
|
|
410
|
-
const d = typeof
|
|
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
|
|
413
|
-
if (
|
|
414
|
-
let I =
|
|
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 =
|
|
487
|
+
I = s.evaluate(
|
|
418
488
|
_,
|
|
419
|
-
|
|
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
|
-
|
|
498
|
+
o.optional || f.push({ field: h, reason: `nothing at ${_}` });
|
|
429
499
|
continue;
|
|
430
500
|
}
|
|
431
|
-
const
|
|
432
|
-
|
|
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
|
-
|
|
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 =
|
|
511
|
+
w = ye(s, _, i).trim();
|
|
442
512
|
} catch {
|
|
443
|
-
|
|
513
|
+
f.push({ field: h, reason: `the XPath ${_} cannot be evaluated` });
|
|
444
514
|
continue;
|
|
445
515
|
}
|
|
446
516
|
if (!w) {
|
|
447
|
-
|
|
517
|
+
o.optional || f.push({ field: h, reason: `nothing at ${_}` });
|
|
448
518
|
continue;
|
|
449
519
|
}
|
|
450
|
-
|
|
520
|
+
b[d] = w;
|
|
451
521
|
}
|
|
452
|
-
return
|
|
522
|
+
return b;
|
|
453
523
|
}
|
|
454
|
-
const
|
|
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
|
|
489
|
-
const
|
|
490
|
-
const
|
|
491
|
-
id: `${a.id}_r${
|
|
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:
|
|
494
|
-
savedAt:
|
|
565
|
+
savedBy: y,
|
|
566
|
+
savedAt: N(),
|
|
495
567
|
restoredFromRevisionId: ""
|
|
496
|
-
})),
|
|
497
|
-
id: `${a.id}_rel${
|
|
498
|
-
number:
|
|
499
|
-
revisionId: `${a.id}_r${
|
|
500
|
-
releasedBy:
|
|
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:
|
|
504
|
-
}),
|
|
505
|
-
const a =
|
|
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:
|
|
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: !
|
|
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
|
-
},
|
|
514
|
-
Object.entries(
|
|
515
|
-
),
|
|
516
|
-
valid:
|
|
517
|
-
reasons:
|
|
518
|
-
}),
|
|
519
|
-
let
|
|
520
|
-
function
|
|
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
|
-
|
|
524
|
-
[
|
|
525
|
-
importProfiles:
|
|
526
|
-
mappings:
|
|
527
|
-
entitySets:
|
|
528
|
-
imports:
|
|
529
|
-
apiKeys:
|
|
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
|
-
),
|
|
543
|
-
let
|
|
544
|
-
const
|
|
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[
|
|
551
|
-
if (
|
|
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,
|
|
554
|
-
const
|
|
555
|
-
if (!
|
|
556
|
-
return
|
|
557
|
-
}, _ = (e, t,
|
|
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((
|
|
560
|
-
}, w = (e, t) => t !== "" && t !==
|
|
561
|
-
if (w(e,
|
|
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:
|
|
567
|
-
savedAt:
|
|
568
|
-
restoredFromRevisionId:
|
|
638
|
+
savedBy: y,
|
|
639
|
+
savedAt: N(),
|
|
640
|
+
restoredFromRevisionId: r
|
|
569
641
|
});
|
|
570
|
-
},
|
|
571
|
-
const
|
|
642
|
+
}, C = (e, t) => {
|
|
643
|
+
const n = Y(e);
|
|
572
644
|
return {
|
|
573
|
-
id:
|
|
645
|
+
id: n,
|
|
574
646
|
content: structuredClone(t),
|
|
575
647
|
revisions: [
|
|
576
648
|
{
|
|
577
|
-
id: `${
|
|
649
|
+
id: `${n}_r1`,
|
|
578
650
|
content: structuredClone(t),
|
|
579
|
-
savedBy:
|
|
580
|
-
savedAt:
|
|
651
|
+
savedBy: y,
|
|
652
|
+
savedAt: N(),
|
|
581
653
|
restoredFromRevisionId: ""
|
|
582
654
|
}
|
|
583
655
|
],
|
|
584
656
|
releases: []
|
|
585
657
|
};
|
|
586
658
|
};
|
|
587
|
-
function
|
|
588
|
-
const t = [],
|
|
589
|
-
e.blueprintReleaseId ?
|
|
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
|
|
607
|
-
typeof
|
|
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
|
-
|
|
610
|
-
const
|
|
611
|
-
return (e.fields ?? []).forEach((p,
|
|
612
|
-
const
|
|
613
|
-
for (const { path:
|
|
614
|
-
|
|
615
|
-
path:
|
|
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 ${
|
|
618
|
-
}),
|
|
619
|
-
path:
|
|
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 ${
|
|
693
|
+
message: `The select field ${g} has no select options.`
|
|
622
694
|
});
|
|
623
|
-
}), (e.versionMatch?.contentFields ?? []).forEach((p,
|
|
624
|
-
|
|
625
|
-
path: `/version_match/content_fields/${
|
|
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,
|
|
701
|
+
}), (e.titleContributions ?? []).forEach((p, l) => {
|
|
630
702
|
(!p.selector || !p.ausgabeCodeSelector) && t.push({
|
|
631
|
-
path: `/title_contributions/${
|
|
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
|
-
}),
|
|
635
|
-
}), (e.placeholderAssets ?? []).forEach((p,
|
|
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/${
|
|
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
|
-
}),
|
|
641
|
-
|
|
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(...
|
|
715
|
+
}), t.push(...De(e, n?.fields, c)), t;
|
|
644
716
|
}
|
|
645
|
-
function
|
|
646
|
-
return e.flatMap((
|
|
647
|
-
const p = `/${t}/${
|
|
648
|
-
return
|
|
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: `${
|
|
724
|
+
message: `${l.name} is configured on a rich-text field, not on a Profile.`
|
|
653
725
|
}
|
|
654
|
-
] :
|
|
655
|
-
(
|
|
656
|
-
).map((
|
|
657
|
-
path: `${p}/settings/${
|
|
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: `${
|
|
731
|
+
message: `${l.name}: ${g.config.api_accessor} is required.`
|
|
660
732
|
})) : [
|
|
661
|
-
{ path: p, code: "unknown_processor", message: `No Processor is called ${
|
|
733
|
+
{ path: p, code: "unknown_processor", message: `No Processor is called ${r.processor}.` }
|
|
662
734
|
];
|
|
663
735
|
});
|
|
664
736
|
}
|
|
665
|
-
function
|
|
666
|
-
const t =
|
|
667
|
-
...
|
|
668
|
-
...
|
|
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 &&
|
|
671
|
-
const p = t.mappings.find((
|
|
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
|
-
|
|
674
|
-
path: `/mappingIds/${
|
|
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
|
|
681
|
-
|
|
682
|
-
path: `/mappingIds/${
|
|
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: ${
|
|
756
|
+
message: `The Mapping ${p.content.name} is invalid: ${l.map((u) => u.message).join(" ")}`
|
|
685
757
|
});
|
|
686
|
-
}), e.entitySetId && !t.entitySets.some((
|
|
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
|
-
}),
|
|
762
|
+
}), n;
|
|
691
763
|
}
|
|
692
|
-
const
|
|
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:
|
|
696
|
-
state:
|
|
697
|
-
}),
|
|
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:
|
|
701
|
-
state:
|
|
702
|
-
}),
|
|
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:
|
|
706
|
-
state:
|
|
707
|
-
}),
|
|
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
|
-
})),
|
|
711
|
-
const t =
|
|
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: (
|
|
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: (
|
|
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: (
|
|
801
|
+
reasons: (n) => ae(n)
|
|
730
802
|
};
|
|
731
803
|
}
|
|
732
|
-
},
|
|
733
|
-
|
|
734
|
-
},
|
|
735
|
-
const
|
|
736
|
-
if (!
|
|
737
|
-
return
|
|
738
|
-
},
|
|
739
|
-
const t =
|
|
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
|
-
},
|
|
743
|
-
e.cancelledBy && e.phase !== "ended" && (e.phase = "ended", e.outcome = "cancelled", e.endTime =
|
|
744
|
-
},
|
|
745
|
-
const
|
|
746
|
-
if (!
|
|
747
|
-
throw new
|
|
748
|
-
const
|
|
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:
|
|
822
|
+
content: r,
|
|
751
823
|
ref: {
|
|
752
824
|
configurationId: e.id,
|
|
753
|
-
name:
|
|
754
|
-
releaseId:
|
|
755
|
-
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:
|
|
897
|
+
calls: b,
|
|
761
898
|
switchWorkspace(e) {
|
|
762
|
-
|
|
899
|
+
f = e;
|
|
763
900
|
},
|
|
764
901
|
updateImport(e, t) {
|
|
765
|
-
Object.assign(
|
|
902
|
+
Object.assign(K(e), structuredClone(t));
|
|
766
903
|
},
|
|
767
|
-
listImportProfiles: () => d("listImportProfiles", () =>
|
|
768
|
-
getImportProfile: (e) => d("getImportProfile", () =>
|
|
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
|
-
_(
|
|
771
|
-
const t =
|
|
772
|
-
return
|
|
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,
|
|
775
|
-
const
|
|
776
|
-
return _(
|
|
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(
|
|
916
|
+
h(o().importProfiles, e, "Import Profile"), o().importProfiles = o().importProfiles.filter((t) => t.id !== e);
|
|
780
917
|
}),
|
|
781
|
-
listProcessors: () => d("listProcessors", () => [...
|
|
782
|
-
listMappings: () => d("listMappings", () =>
|
|
783
|
-
getMapping: (e) => d("getMapping", () =>
|
|
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
|
-
_(
|
|
786
|
-
const t =
|
|
787
|
-
return
|
|
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,
|
|
790
|
-
const
|
|
791
|
-
return _(
|
|
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(
|
|
795
|
-
const t =
|
|
931
|
+
h(o().mappings, e, "Mapping");
|
|
932
|
+
const t = L((n) => n.mappingIds.includes(e));
|
|
796
933
|
if (t.length > 0)
|
|
797
|
-
throw new
|
|
934
|
+
throw new me(
|
|
798
935
|
t,
|
|
799
|
-
`the Mapping is included by ${t.map((
|
|
936
|
+
`the Mapping is included by ${t.map((n) => n.name).join(", ")}`
|
|
800
937
|
);
|
|
801
|
-
|
|
938
|
+
o().mappings = o().mappings.filter((n) => n.id !== e);
|
|
802
939
|
}),
|
|
803
|
-
listMappingImportProfiles: (e) => d("listMappingImportProfiles", () => (h(
|
|
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
|
|
806
|
-
if (!
|
|
807
|
-
if (
|
|
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:
|
|
811
|
-
missingFieldPaths: (
|
|
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
|
-
...(
|
|
814
|
-
...
|
|
950
|
+
...(n.content.releaseSpec ?? []).map((c) => c.field ?? ""),
|
|
951
|
+
...n.content.versionMatch?.releaseSpecFields ?? []
|
|
815
952
|
].filter(
|
|
816
|
-
(
|
|
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:
|
|
821
|
-
let
|
|
822
|
-
if (
|
|
823
|
-
const
|
|
824
|
-
if (!
|
|
825
|
-
|
|
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
|
|
964
|
+
return Ce(e, r);
|
|
828
965
|
}),
|
|
829
|
-
listEntitySets: () => d("listEntitySets", () =>
|
|
830
|
-
getEntitySet: (e) => d("getEntitySet", () =>
|
|
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
|
-
_(
|
|
833
|
-
const t =
|
|
834
|
-
return
|
|
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,
|
|
837
|
-
const
|
|
838
|
-
return _(
|
|
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(
|
|
842
|
-
const t =
|
|
978
|
+
h(o().entitySets, e, "Entity Set");
|
|
979
|
+
const t = L((n) => n.entitySetId === e);
|
|
843
980
|
if (t.length > 0)
|
|
844
|
-
throw new
|
|
981
|
+
throw new me(
|
|
845
982
|
t,
|
|
846
|
-
`the Entity Set is named by ${t.map((
|
|
983
|
+
`the Entity Set is named by ${t.map((n) => n.name).join(", ")}`
|
|
847
984
|
);
|
|
848
|
-
|
|
985
|
+
o().entitySets = o().entitySets.filter((n) => n.id !== e);
|
|
849
986
|
}),
|
|
850
|
-
cutRelease: (e, t,
|
|
851
|
-
const
|
|
852
|
-
if (w(
|
|
853
|
-
throw new
|
|
854
|
-
const p =
|
|
855
|
-
if (!p.valid) throw new
|
|
856
|
-
if (!
|
|
857
|
-
throw new
|
|
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
|
|
861
|
-
id: `${
|
|
862
|
-
number:
|
|
863
|
-
revisionId:
|
|
864
|
-
releasedBy:
|
|
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
|
|
868
|
-
release:
|
|
869
|
-
importProfiles: e === "mapping" ?
|
|
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,
|
|
873
|
-
const
|
|
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(
|
|
876
|
-
id:
|
|
877
|
-
savedBy:
|
|
878
|
-
savedAt:
|
|
879
|
-
validity:
|
|
880
|
-
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: [...
|
|
883
|
-
nextPageToken:
|
|
1019
|
+
releases: [...c.releases].reverse(),
|
|
1020
|
+
nextPageToken: l + 10 < p.length ? String(l + 10) : ""
|
|
884
1021
|
};
|
|
885
1022
|
}),
|
|
886
|
-
compareRevisions: (e, t,
|
|
887
|
-
const
|
|
888
|
-
const
|
|
889
|
-
return { field:
|
|
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:
|
|
893
|
-
to: { revisionId:
|
|
894
|
-
fields:
|
|
1029
|
+
from: { revisionId: n, content: l },
|
|
1030
|
+
to: { revisionId: r, content: u },
|
|
1031
|
+
fields: g
|
|
895
1032
|
};
|
|
896
1033
|
}),
|
|
897
|
-
restoreRevision: (e, t,
|
|
898
|
-
const
|
|
899
|
-
I(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 (
|
|
903
|
-
for (const
|
|
904
|
-
await new Promise((
|
|
905
|
-
if (
|
|
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
|
|
908
|
-
return
|
|
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 =
|
|
966
|
-
t.forEach(
|
|
967
|
-
const
|
|
1049
|
+
const t = o().imports;
|
|
1050
|
+
t.forEach(Q);
|
|
1051
|
+
const n = Number(e || "0");
|
|
968
1052
|
return {
|
|
969
|
-
imports: t.slice(
|
|
970
|
-
nextPageToken:
|
|
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 =
|
|
975
|
-
return
|
|
1058
|
+
const t = K(e);
|
|
1059
|
+
return Q(t), z(t);
|
|
976
1060
|
}),
|
|
977
1061
|
cancelImport: (e) => d("cancelImport", () => {
|
|
978
|
-
const t =
|
|
1062
|
+
const t = K(e);
|
|
979
1063
|
if (t.phase === "ended") throw new Error("the Import has ended");
|
|
980
|
-
return t.cancelledBy ||=
|
|
1064
|
+
return t.cancelledBy ||= y, t.phase === "queued" && Q(t), z(t);
|
|
981
1065
|
}),
|
|
982
1066
|
listItemProblems: (e, t) => d("listItemProblems", () => {
|
|
983
|
-
const
|
|
984
|
-
(
|
|
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
|
|
987
|
-
const
|
|
988
|
-
mappingId:
|
|
989
|
-
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
|
-
|
|
1076
|
+
g.count++, p.set(u.mappingId, g);
|
|
993
1077
|
}
|
|
994
|
-
const
|
|
1078
|
+
const l = Number(t.pageToken || "0");
|
|
995
1079
|
return {
|
|
996
|
-
itemProblems:
|
|
997
|
-
totalCount:
|
|
998
|
-
matchingCount:
|
|
999
|
-
mappings: [...p.values()].sort((
|
|
1000
|
-
|
|
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
|
-
|
|
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 >
|
|
1008
|
-
throw new Error(`the name is longer than ${
|
|
1009
|
-
const
|
|
1010
|
-
if (
|
|
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
|
|
1013
|
-
id: `key_stub_new_${
|
|
1111
|
+
const r = ++_e, c = {
|
|
1112
|
+
id: `key_stub_new_${r}`,
|
|
1014
1113
|
name: t,
|
|
1015
|
-
keyPrefix: `ihk_n${String(
|
|
1016
|
-
owner:
|
|
1017
|
-
expireTime:
|
|
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
|
|
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 =
|
|
1024
|
-
if (!t.apiKeys.some((
|
|
1025
|
-
t.apiKeys = t.apiKeys.filter((
|
|
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
|
|
1030
|
-
const a = [],
|
|
1031
|
-
for (const m of
|
|
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
|
|
1132
|
+
else if (m in i && a.pop() !== i[m]) return !1;
|
|
1034
1133
|
return a.length === 0;
|
|
1035
1134
|
}
|
|
1036
|
-
function ie(
|
|
1037
|
-
const m = `${a}${String(
|
|
1135
|
+
function ie(s, a, i) {
|
|
1136
|
+
const m = `${a}${String(s.name ?? "")}`;
|
|
1038
1137
|
return [
|
|
1039
|
-
{ path: m, rel:
|
|
1138
|
+
{ path: m, rel: i, mapping: s },
|
|
1040
1139
|
...["fields", "virtualTableFields"].flatMap(
|
|
1041
|
-
(
|
|
1042
|
-
(
|
|
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
|
|
1146
|
+
function He(s = be()) {
|
|
1048
1147
|
return {
|
|
1049
1148
|
async listBlueprints() {
|
|
1050
|
-
return [...new Map(
|
|
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
|
|
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
|
|
1057
|
-
if (!
|
|
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:
|
|
1060
|
-
blueprintId:
|
|
1061
|
-
name:
|
|
1062
|
-
fields:
|
|
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:
|
|
1168
|
+
releaseSpecFields: i.releaseSpecFields ?? []
|
|
1070
1169
|
};
|
|
1071
1170
|
}
|
|
1072
1171
|
};
|
|
1073
1172
|
}
|
|
1074
|
-
function
|
|
1075
|
-
const m = (
|
|
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 && !
|
|
1079
|
-
if (!
|
|
1080
|
-
return
|
|
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
|
|
1185
|
+
return b(
|
|
1087
1186
|
"/display_name_template",
|
|
1088
1187
|
"incomplete_display_name",
|
|
1089
|
-
`the display-name field "${
|
|
1188
|
+
`the display-name field "${f}" has no display-name template to fill it`
|
|
1090
1189
|
);
|
|
1091
1190
|
if (!a) return [];
|
|
1092
|
-
const
|
|
1093
|
-
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(
|
|
1094
1193
|
"/display_name_field",
|
|
1095
1194
|
"display_name_field_mapped",
|
|
1096
|
-
`the field "${
|
|
1097
|
-
) : [] :
|
|
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 "${
|
|
1101
|
-
) :
|
|
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 "${
|
|
1203
|
+
`the Blueprint Release has no field "${f}" to write the display name into`
|
|
1105
1204
|
);
|
|
1106
1205
|
}
|
|
1107
1206
|
export {
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
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
|
-
|
|
1122
|
-
|
|
1220
|
+
$e as stubMappings,
|
|
1221
|
+
Me as stubProcessors
|
|
1123
1222
|
};
|
|
1124
1223
|
//# sourceMappingURL=testing.js.map
|