@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/CHANGELOG.md +14 -0
- package/README.md +7 -6
- package/dist/importhub-client-BzOVIXA4.js +46 -0
- package/dist/importhub-client-BzOVIXA4.js.map +1 -0
- package/dist/index.d.ts +446 -5
- package/dist/index.js +1638 -1240
- package/dist/index.js.map +1 -1
- package/dist/mapping-editor.d.ts +157 -1
- package/dist/mapping-editor.js +613 -397
- package/dist/mapping-editor.js.map +1 -1
- package/dist/mapping-page-Bl2rA1SR.js +1090 -0
- package/dist/mapping-page-Bl2rA1SR.js.map +1 -0
- package/dist/testing.d.ts +167 -2
- package/dist/testing.js +695 -477
- package/dist/testing.js.map +1 -1
- package/package.json +1 -1
- package/dist/importhub-client-BS6F4DW2.js +0 -31
- package/dist/importhub-client-BS6F4DW2.js.map +0 -1
- package/dist/mapping-page-tIHPNu7C.js +0 -1078
- package/dist/mapping-page-tIHPNu7C.js.map +0 -1
package/dist/testing.js
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
import { createHostMembers as
|
|
2
|
-
import {
|
|
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
|
|
16
|
-
accessor:
|
|
17
|
-
path:
|
|
18
|
-
fieldType:
|
|
19
|
-
label:
|
|
20
|
-
children:
|
|
21
|
-
}),
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
...
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
-
],
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
], fe = () => [
|
|
31
|
+
S("fundstelle", "text", "Fundstelle"),
|
|
32
|
+
S("ausgabedatum", "date", "Ausgabedatum")
|
|
33
33
|
];
|
|
34
|
-
function
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
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:
|
|
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:
|
|
55
|
-
fields:
|
|
56
|
-
releaseSpecFields:
|
|
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:
|
|
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",
|
|
@@ -97,7 +97,13 @@ function Se() {
|
|
|
97
97
|
}
|
|
98
98
|
];
|
|
99
99
|
}
|
|
100
|
-
|
|
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
|
|
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
|
|
150
|
+
const ne = (s, a, i, m = "") => ({
|
|
145
151
|
field_type: "text",
|
|
146
|
-
config: { name:
|
|
152
|
+
config: { name: a, api_accessor: s, required: i, instructions: m },
|
|
147
153
|
system: !1
|
|
148
154
|
});
|
|
149
|
-
function
|
|
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
|
-
|
|
172
|
-
|
|
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: [
|
|
186
|
+
settingsSpec: [ne("element", "Element", !1)]
|
|
181
187
|
}
|
|
182
188
|
];
|
|
183
189
|
}
|
|
184
|
-
const
|
|
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
|
-
|
|
193
|
-
|
|
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${
|
|
198
|
-
number:
|
|
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
|
-
}),
|
|
222
|
+
}), E = (s) => ({
|
|
215
223
|
importProfileId: "ip_stub_gesetz",
|
|
216
224
|
importProfileName: "Boorberg gesetz",
|
|
217
|
-
sourceFileId: `sf_${
|
|
218
|
-
startedBy:
|
|
225
|
+
sourceFileId: `sf_${s.id}`,
|
|
226
|
+
startedBy: y,
|
|
219
227
|
phase: "ended",
|
|
220
228
|
failureReason: "",
|
|
221
229
|
progress: { done: 0, total: 0 },
|
|
222
|
-
counts:
|
|
230
|
+
counts: M(),
|
|
223
231
|
changeSetId: "",
|
|
224
|
-
releases:
|
|
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
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
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
|
|
259
|
+
function Ne() {
|
|
240
260
|
return [
|
|
241
|
-
|
|
261
|
+
E({
|
|
242
262
|
id: "im_stub_running",
|
|
243
263
|
phase: "writing",
|
|
244
264
|
progress: { done: 48, total: 120 },
|
|
245
|
-
counts:
|
|
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
|
-
|
|
270
|
+
E({
|
|
251
271
|
id: "im_stub_queued",
|
|
252
272
|
phase: "queued",
|
|
253
|
-
startedBy:
|
|
254
|
-
releases:
|
|
273
|
+
startedBy: U,
|
|
274
|
+
releases: R(2),
|
|
255
275
|
createTime: "2026-11-04T10:05:00.000Z"
|
|
256
276
|
}),
|
|
257
|
-
|
|
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:
|
|
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
|
-
...
|
|
346
|
+
...R(2),
|
|
271
347
|
mappings: [
|
|
272
|
-
...
|
|
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
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
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
|
-
|
|
370
|
+
E({
|
|
295
371
|
id: "im_stub_succeeded",
|
|
296
372
|
outcome: "succeeded",
|
|
297
|
-
counts:
|
|
373
|
+
counts: M({ matched: 64, created: 64 }),
|
|
298
374
|
changeSetId: "cs_stub_succeeded",
|
|
299
|
-
releases:
|
|
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
|
-
|
|
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:
|
|
309
|
-
releases:
|
|
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
|
-
|
|
390
|
+
E({
|
|
315
391
|
id: "im_stub_cancelled",
|
|
316
392
|
outcome: "cancelled",
|
|
317
|
-
cancelledBy:
|
|
318
|
-
counts:
|
|
319
|
-
releases:
|
|
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
|
|
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:
|
|
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:
|
|
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
|
|
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
|
|
380
|
-
const
|
|
381
|
-
const
|
|
382
|
-
id: `${
|
|
383
|
-
content: structuredClone(
|
|
384
|
-
savedBy:
|
|
385
|
-
savedAt:
|
|
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
|
-
})),
|
|
388
|
-
id: `${
|
|
389
|
-
number:
|
|
390
|
-
revisionId: `${
|
|
391
|
-
releasedBy:
|
|
392
|
-
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()
|
|
393
574
|
}));
|
|
394
|
-
return { id:
|
|
395
|
-
}),
|
|
396
|
-
const
|
|
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:
|
|
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: !
|
|
402
|
-
...
|
|
582
|
+
draftDiffersFromRelease: !i || JSON.stringify(i.content) !== JSON.stringify(x(s).content),
|
|
583
|
+
...a ? { latestRelease: { id: a.id, number: a.number } } : {}
|
|
403
584
|
};
|
|
404
|
-
},
|
|
405
|
-
Object.entries(
|
|
406
|
-
),
|
|
407
|
-
valid:
|
|
408
|
-
reasons:
|
|
409
|
-
}),
|
|
410
|
-
let
|
|
411
|
-
function
|
|
412
|
-
const
|
|
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
|
-
|
|
415
|
-
[
|
|
416
|
-
importProfiles:
|
|
417
|
-
mappings:
|
|
418
|
-
entitySets:
|
|
419
|
-
imports:
|
|
420
|
-
apiKeys:
|
|
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:
|
|
427
|
-
mappings:
|
|
428
|
-
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
|
-
),
|
|
434
|
-
let
|
|
435
|
-
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] ??= {
|
|
436
617
|
importProfiles: [],
|
|
437
618
|
mappings: [],
|
|
438
619
|
entitySets: [],
|
|
439
620
|
imports: [],
|
|
440
621
|
apiKeys: []
|
|
441
|
-
},
|
|
442
|
-
if (
|
|
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,
|
|
445
|
-
const
|
|
446
|
-
if (!
|
|
447
|
-
return
|
|
448
|
-
},
|
|
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((
|
|
451
|
-
},
|
|
452
|
-
if (
|
|
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:
|
|
458
|
-
savedAt:
|
|
459
|
-
restoredFromRevisionId:
|
|
638
|
+
savedBy: y,
|
|
639
|
+
savedAt: N(),
|
|
640
|
+
restoredFromRevisionId: r
|
|
460
641
|
});
|
|
461
|
-
},
|
|
462
|
-
const
|
|
642
|
+
}, C = (e, t) => {
|
|
643
|
+
const n = Y(e);
|
|
463
644
|
return {
|
|
464
|
-
id:
|
|
645
|
+
id: n,
|
|
465
646
|
content: structuredClone(t),
|
|
466
647
|
revisions: [
|
|
467
648
|
{
|
|
468
|
-
id: `${
|
|
649
|
+
id: `${n}_r1`,
|
|
469
650
|
content: structuredClone(t),
|
|
470
|
-
savedBy:
|
|
471
|
-
savedAt:
|
|
651
|
+
savedBy: y,
|
|
652
|
+
savedAt: N(),
|
|
472
653
|
restoredFromRevisionId: ""
|
|
473
654
|
}
|
|
474
655
|
],
|
|
475
656
|
releases: []
|
|
476
657
|
};
|
|
477
658
|
};
|
|
478
|
-
function
|
|
479
|
-
const t = [],
|
|
480
|
-
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({
|
|
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
|
|
498
|
-
typeof l == "string" && l !== "" && !
|
|
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
|
-
|
|
501
|
-
const
|
|
502
|
-
return (e.fields ?? []).forEach((
|
|
503
|
-
const
|
|
504
|
-
for (const { path:
|
|
505
|
-
|
|
506
|
-
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,
|
|
507
688
|
code: "unknown_field_path",
|
|
508
|
-
message: `The pinned Release has no field ${
|
|
509
|
-
}),
|
|
510
|
-
path:
|
|
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 ${
|
|
693
|
+
message: `The select field ${g} has no select options.`
|
|
513
694
|
});
|
|
514
|
-
}), (e.versionMatch?.contentFields ?? []).forEach((
|
|
515
|
-
|
|
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 ${
|
|
699
|
+
message: `The Version Match compares ${p}, which the Mapping does not map.`
|
|
519
700
|
});
|
|
520
|
-
}), (e.titleContributions ?? []).forEach((
|
|
521
|
-
(!
|
|
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
|
-
}),
|
|
526
|
-
}), (e.placeholderAssets ?? []).forEach((
|
|
527
|
-
(!
|
|
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
|
-
}),
|
|
532
|
-
|
|
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(...
|
|
715
|
+
}), t.push(...De(e, n?.fields, c)), t;
|
|
535
716
|
}
|
|
536
|
-
function
|
|
537
|
-
return e.flatMap((
|
|
538
|
-
const
|
|
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:
|
|
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 !==
|
|
546
|
-
(
|
|
547
|
-
).map((
|
|
548
|
-
path: `${
|
|
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}: ${
|
|
731
|
+
message: `${l.name}: ${g.config.api_accessor} is required.`
|
|
551
732
|
})) : [
|
|
552
|
-
{ path:
|
|
733
|
+
{ path: p, code: "unknown_processor", message: `No Processor is called ${r.processor}.` }
|
|
553
734
|
];
|
|
554
735
|
});
|
|
555
736
|
}
|
|
556
|
-
function
|
|
557
|
-
const t =
|
|
558
|
-
...
|
|
559
|
-
...
|
|
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 &&
|
|
562
|
-
const
|
|
563
|
-
if (!
|
|
564
|
-
|
|
565
|
-
path: `/mappingIds/${
|
|
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 =
|
|
572
|
-
l.length > 0 &&
|
|
573
|
-
path: `/mappingIds/${
|
|
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 ${
|
|
756
|
+
message: `The Mapping ${p.content.name} is invalid: ${l.map((u) => u.message).join(" ")}`
|
|
576
757
|
});
|
|
577
|
-
}), e.entitySetId && !t.entitySets.some((
|
|
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
|
-
}),
|
|
762
|
+
}), n;
|
|
582
763
|
}
|
|
583
|
-
const
|
|
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:
|
|
587
|
-
state:
|
|
588
|
-
}),
|
|
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:
|
|
592
|
-
state:
|
|
593
|
-
}),
|
|
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:
|
|
597
|
-
state:
|
|
598
|
-
}),
|
|
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
|
-
})),
|
|
602
|
-
const t =
|
|
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: (
|
|
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: (
|
|
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: (
|
|
801
|
+
reasons: (n) => ae(n)
|
|
621
802
|
};
|
|
622
803
|
}
|
|
623
|
-
},
|
|
624
|
-
|
|
625
|
-
},
|
|
626
|
-
const
|
|
627
|
-
if (!
|
|
628
|
-
return
|
|
629
|
-
},
|
|
630
|
-
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);
|
|
631
812
|
if (!t) throw new Error(`Import ${e} not found`);
|
|
632
813
|
return t;
|
|
633
|
-
},
|
|
634
|
-
e.cancelledBy && e.phase !== "ended" && (e.phase = "ended", e.outcome = "cancelled", e.endTime =
|
|
635
|
-
},
|
|
636
|
-
const
|
|
637
|
-
if (!
|
|
638
|
-
throw new
|
|
639
|
-
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;
|
|
640
821
|
return {
|
|
641
|
-
content:
|
|
822
|
+
content: r,
|
|
642
823
|
ref: {
|
|
643
824
|
configurationId: e.id,
|
|
644
|
-
name:
|
|
645
|
-
releaseId:
|
|
646
|
-
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
|
-
|
|
899
|
+
f = e;
|
|
654
900
|
},
|
|
655
901
|
updateImport(e, t) {
|
|
656
|
-
Object.assign(
|
|
902
|
+
Object.assign(K(e), structuredClone(t));
|
|
657
903
|
},
|
|
658
|
-
listImportProfiles: () => d("listImportProfiles", () =>
|
|
659
|
-
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"))),
|
|
660
906
|
createImportProfile: (e) => d("createImportProfile", () => {
|
|
661
|
-
|
|
662
|
-
const t =
|
|
663
|
-
return
|
|
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,
|
|
666
|
-
const
|
|
667
|
-
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);
|
|
668
914
|
}),
|
|
669
915
|
deleteImportProfile: (e) => d("deleteImportProfile", () => {
|
|
670
|
-
h(
|
|
916
|
+
h(o().importProfiles, e, "Import Profile"), o().importProfiles = o().importProfiles.filter((t) => t.id !== e);
|
|
671
917
|
}),
|
|
672
|
-
listProcessors: () => d("listProcessors", () => [...
|
|
673
|
-
listMappings: () => d("listMappings", () =>
|
|
674
|
-
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"))),
|
|
675
921
|
createMapping: (e) => d("createMapping", () => {
|
|
676
|
-
|
|
677
|
-
const t =
|
|
678
|
-
return
|
|
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,
|
|
681
|
-
const
|
|
682
|
-
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);
|
|
683
929
|
}),
|
|
684
930
|
deleteMapping: (e) => d("deleteMapping", () => {
|
|
685
|
-
h(
|
|
686
|
-
const t =
|
|
931
|
+
h(o().mappings, e, "Mapping");
|
|
932
|
+
const t = L((n) => n.mappingIds.includes(e));
|
|
687
933
|
if (t.length > 0)
|
|
688
|
-
throw new
|
|
934
|
+
throw new me(
|
|
689
935
|
t,
|
|
690
|
-
`the Mapping is included by ${t.map((
|
|
936
|
+
`the Mapping is included by ${t.map((n) => n.name).join(", ")}`
|
|
691
937
|
);
|
|
692
|
-
|
|
938
|
+
o().mappings = o().mappings.filter((n) => n.id !== e);
|
|
693
939
|
}),
|
|
694
|
-
listMappingImportProfiles: (e) => d("listMappingImportProfiles", () => (h(
|
|
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
|
|
697
|
-
if (!
|
|
698
|
-
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)
|
|
699
945
|
throw new Error("the Release is of another Blueprint");
|
|
700
946
|
return {
|
|
701
|
-
blueprintId:
|
|
702
|
-
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)),
|
|
703
949
|
missingReleaseSpecFields: [
|
|
704
|
-
...(
|
|
705
|
-
...
|
|
950
|
+
...(n.content.releaseSpec ?? []).map((c) => c.field ?? ""),
|
|
951
|
+
...n.content.versionMatch?.releaseSpecFields ?? []
|
|
706
952
|
].filter(
|
|
707
|
-
(
|
|
953
|
+
(c, p, l) => c !== "" && l.indexOf(c) === p && !(r.releaseSpecFields ?? []).some((u) => u.path === c)
|
|
708
954
|
)
|
|
709
955
|
};
|
|
710
956
|
}),
|
|
711
|
-
|
|
712
|
-
|
|
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
|
-
|
|
715
|
-
const t =
|
|
716
|
-
return
|
|
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,
|
|
719
|
-
const
|
|
720
|
-
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);
|
|
721
976
|
}),
|
|
722
977
|
deleteEntitySet: (e) => d("deleteEntitySet", () => {
|
|
723
|
-
h(
|
|
724
|
-
const t =
|
|
978
|
+
h(o().entitySets, e, "Entity Set");
|
|
979
|
+
const t = L((n) => n.entitySetId === e);
|
|
725
980
|
if (t.length > 0)
|
|
726
|
-
throw new
|
|
981
|
+
throw new me(
|
|
727
982
|
t,
|
|
728
|
-
`the Entity Set is named by ${t.map((
|
|
983
|
+
`the Entity Set is named by ${t.map((n) => n.name).join(", ")}`
|
|
729
984
|
);
|
|
730
|
-
|
|
985
|
+
o().entitySets = o().entitySets.filter((n) => n.id !== e);
|
|
731
986
|
}),
|
|
732
|
-
cutRelease: (e, t,
|
|
733
|
-
const
|
|
734
|
-
if (
|
|
735
|
-
throw new
|
|
736
|
-
const
|
|
737
|
-
if (!
|
|
738
|
-
if (!
|
|
739
|
-
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(
|
|
740
995
|
"the draft does not differ from the latest Release: there is nothing to release"
|
|
741
996
|
);
|
|
742
|
-
const l =
|
|
743
|
-
id: `${
|
|
997
|
+
const l = c.releases.length + 1, u = {
|
|
998
|
+
id: `${c.id}_rel${l}`,
|
|
744
999
|
number: l,
|
|
745
|
-
revisionId:
|
|
746
|
-
releasedBy:
|
|
747
|
-
releasedAt:
|
|
1000
|
+
revisionId: x(c).id,
|
|
1001
|
+
releasedBy: y,
|
|
1002
|
+
releasedAt: N()
|
|
748
1003
|
};
|
|
749
|
-
return
|
|
750
|
-
release:
|
|
751
|
-
importProfiles: e === "mapping" ?
|
|
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,
|
|
755
|
-
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");
|
|
756
1011
|
return {
|
|
757
|
-
revisions:
|
|
758
|
-
id:
|
|
759
|
-
savedBy:
|
|
760
|
-
savedAt:
|
|
761
|
-
validity:
|
|
762
|
-
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: [...
|
|
765
|
-
nextPageToken: l + 10 <
|
|
1019
|
+
releases: [...c.releases].reverse(),
|
|
1020
|
+
nextPageToken: l + 10 < p.length ? String(l + 10) : ""
|
|
766
1021
|
};
|
|
767
1022
|
}),
|
|
768
|
-
compareRevisions: (e, t,
|
|
769
|
-
const
|
|
770
|
-
const
|
|
771
|
-
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 };
|
|
772
1027
|
});
|
|
773
1028
|
return {
|
|
774
|
-
from: { revisionId:
|
|
775
|
-
to: { revisionId:
|
|
776
|
-
fields:
|
|
1029
|
+
from: { revisionId: n, content: l },
|
|
1030
|
+
to: { revisionId: r, content: u },
|
|
1031
|
+
fields: g
|
|
777
1032
|
};
|
|
778
1033
|
}),
|
|
779
|
-
restoreRevision: (e, t,
|
|
780
|
-
const
|
|
781
|
-
|
|
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 (
|
|
785
|
-
for (const
|
|
786
|
-
await new Promise((
|
|
787
|
-
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;
|
|
788
1043
|
t(1);
|
|
789
|
-
const
|
|
790
|
-
return
|
|
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 =
|
|
848
|
-
t.forEach(
|
|
849
|
-
const
|
|
1049
|
+
const t = o().imports;
|
|
1050
|
+
t.forEach(Q);
|
|
1051
|
+
const n = Number(e || "0");
|
|
850
1052
|
return {
|
|
851
|
-
imports: t.slice(
|
|
852
|
-
nextPageToken:
|
|
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 =
|
|
857
|
-
return
|
|
1058
|
+
const t = K(e);
|
|
1059
|
+
return Q(t), z(t);
|
|
858
1060
|
}),
|
|
859
1061
|
cancelImport: (e) => d("cancelImport", () => {
|
|
860
|
-
const t =
|
|
1062
|
+
const t = K(e);
|
|
861
1063
|
if (t.phase === "ended") throw new Error("the Import has ended");
|
|
862
|
-
return t.cancelledBy ||=
|
|
1064
|
+
return t.cancelledBy ||= y, t.phase === "queued" && Q(t), z(t);
|
|
863
1065
|
}),
|
|
864
1066
|
listItemProblems: (e, t) => d("listItemProblems", () => {
|
|
865
|
-
const
|
|
866
|
-
(
|
|
867
|
-
),
|
|
868
|
-
for (const
|
|
869
|
-
const
|
|
870
|
-
mappingId:
|
|
871
|
-
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
|
-
|
|
1076
|
+
g.count++, p.set(u.mappingId, g);
|
|
875
1077
|
}
|
|
876
1078
|
const l = Number(t.pageToken || "0");
|
|
877
1079
|
return {
|
|
878
|
-
itemProblems:
|
|
879
|
-
totalCount:
|
|
880
|
-
matchingCount:
|
|
881
|
-
mappings: [...
|
|
882
|
-
|
|
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
|
-
|
|
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 >
|
|
890
|
-
throw new Error(`the name is longer than ${
|
|
891
|
-
const
|
|
892
|
-
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())
|
|
893
1110
|
throw new Error("the expiry must lie in the future");
|
|
894
|
-
const
|
|
895
|
-
id: `key_stub_new_${
|
|
1111
|
+
const r = ++_e, c = {
|
|
1112
|
+
id: `key_stub_new_${r}`,
|
|
896
1113
|
name: t,
|
|
897
|
-
keyPrefix: `ihk_n${String(
|
|
898
|
-
owner:
|
|
899
|
-
expireTime:
|
|
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
|
|
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 =
|
|
906
|
-
if (!t.apiKeys.some((
|
|
907
|
-
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);
|
|
908
1125
|
})
|
|
909
1126
|
};
|
|
910
1127
|
}
|
|
911
|
-
function
|
|
912
|
-
const
|
|
913
|
-
for (const
|
|
914
|
-
if (
|
|
915
|
-
else if (
|
|
916
|
-
return
|
|
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
|
|
919
|
-
const
|
|
1135
|
+
function ie(s, a, i) {
|
|
1136
|
+
const m = `${a}${String(s.name ?? "")}`;
|
|
920
1137
|
return [
|
|
921
|
-
{ path:
|
|
1138
|
+
{ path: m, rel: i, mapping: s },
|
|
922
1139
|
...["fields", "virtualTableFields"].flatMap(
|
|
923
|
-
(
|
|
924
|
-
(
|
|
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
|
|
1146
|
+
function He(s = be()) {
|
|
930
1147
|
return {
|
|
931
1148
|
async listBlueprints() {
|
|
932
|
-
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));
|
|
933
1150
|
},
|
|
934
|
-
async listReleases(
|
|
935
|
-
return
|
|
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(
|
|
938
|
-
const
|
|
939
|
-
if (!
|
|
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:
|
|
942
|
-
blueprintId:
|
|
943
|
-
name:
|
|
944
|
-
fields:
|
|
945
|
-
accessor:
|
|
946
|
-
path:
|
|
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:
|
|
1168
|
+
releaseSpecFields: i.releaseSpecFields ?? []
|
|
952
1169
|
};
|
|
953
1170
|
}
|
|
954
1171
|
};
|
|
955
1172
|
}
|
|
956
|
-
function
|
|
957
|
-
const
|
|
958
|
-
{ path: d, code: h, message:
|
|
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 (!
|
|
961
|
-
if (!
|
|
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 (!
|
|
968
|
-
return
|
|
1184
|
+
if (!m)
|
|
1185
|
+
return b(
|
|
969
1186
|
"/display_name_template",
|
|
970
1187
|
"incomplete_display_name",
|
|
971
|
-
`the display-name field "${
|
|
1188
|
+
`the display-name field "${f}" has no display-name template to fill it`
|
|
972
1189
|
);
|
|
973
|
-
if (!
|
|
974
|
-
const
|
|
975
|
-
return
|
|
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 "${
|
|
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 "${
|
|
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 "${
|
|
1203
|
+
`the Blueprint Release has no field "${f}" to write the display name into`
|
|
987
1204
|
);
|
|
988
1205
|
}
|
|
989
1206
|
export {
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
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
|