@knkcs/importhub-ui 0.5.0 → 0.7.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 +2 -1
- package/dist/{importhub-client-fCWgKH03.js → importhub-client-BS6F4DW2.js} +7 -5
- package/dist/importhub-client-BS6F4DW2.js.map +1 -0
- package/dist/index.d.ts +131 -0
- package/dist/index.js +1331 -1075
- package/dist/index.js.map +1 -1
- package/dist/mapping-editor.d.ts +50 -0
- package/dist/mapping-editor.js +1 -1
- package/dist/mapping-editor.js.map +1 -1
- package/dist/{mapping-page-D92XwUq5.js → mapping-page-Lu48SY_L.js} +275 -271
- package/dist/mapping-page-Lu48SY_L.js.map +1 -0
- package/dist/testing.d.ts +58 -0
- package/dist/testing.js +298 -242
- package/dist/testing.js.map +1 -1
- package/package.json +1 -1
- package/dist/importhub-client-fCWgKH03.js.map +0 -1
- package/dist/mapping-page-D92XwUq5.js.map +0 -1
package/dist/testing.js
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import { createHostMembers as
|
|
2
|
-
import { S as
|
|
3
|
-
const
|
|
4
|
-
function
|
|
1
|
+
import { createHostMembers as _e } from "@knkcs/anker/host";
|
|
2
|
+
import { A as ce, S as M, R as Q, C as le, N as ye } from "./importhub-client-BS6F4DW2.js";
|
|
3
|
+
const h = "user_stub_ada", q = "user_stub_grace", te = "ws_stub_main", Be = "ws_stub_other";
|
|
4
|
+
function Ae(r = te) {
|
|
5
5
|
return {
|
|
6
|
-
userId:
|
|
6
|
+
userId: h,
|
|
7
7
|
workspaceId: r,
|
|
8
|
-
members:
|
|
9
|
-
{ userId:
|
|
10
|
-
{ userId:
|
|
8
|
+
members: _e([
|
|
9
|
+
{ userId: h, displayName: "Ada Importer", email: "ada@example.com" },
|
|
10
|
+
{ userId: q, displayName: "Grace Hopper", email: "grace@example.com" }
|
|
11
11
|
])
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
|
-
const
|
|
14
|
+
const _ = (r, c, l, u = []) => ({
|
|
15
15
|
accessor: r.split(".").pop() ?? r,
|
|
16
16
|
path: r,
|
|
17
17
|
fieldType: c,
|
|
18
18
|
label: l,
|
|
19
19
|
children: u
|
|
20
|
-
}),
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
...r ? [
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
}), j = (r) => r.flatMap((c) => [c.path, ...j(c.children)]), pe = (r) => [
|
|
21
|
+
_("titel", "text", "Titel"),
|
|
22
|
+
_("abkuerzung", "text", "Abkürzung"),
|
|
23
|
+
...r ? [_("fussnote", "rich_text", "Fußnote")] : [],
|
|
24
|
+
_("stand", "fieldset", "Stand", [
|
|
25
|
+
_("stand.datum", "date", "Datum"),
|
|
26
|
+
_("stand.art", "select", "Art")
|
|
27
27
|
])
|
|
28
|
-
],
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
], de = () => [
|
|
29
|
+
_("fundstelle", "text", "Fundstelle"),
|
|
30
|
+
_("ausgabedatum", "date", "Ausgabedatum")
|
|
31
31
|
];
|
|
32
|
-
function
|
|
33
|
-
const r =
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
function ge() {
|
|
33
|
+
const r = pe(!1), c = pe(!0), l = [
|
|
34
|
+
_("aktenzeichen", "text", "Aktenzeichen"),
|
|
35
|
+
_("datum", "date", "Datum")
|
|
36
36
|
];
|
|
37
37
|
return [
|
|
38
38
|
{
|
|
@@ -40,30 +40,30 @@ function ue() {
|
|
|
40
40
|
blueprintId: "bp_stub_gesetz",
|
|
41
41
|
blueprintName: "Gesetz",
|
|
42
42
|
label: "Release 2",
|
|
43
|
-
fieldPaths:
|
|
43
|
+
fieldPaths: j(r),
|
|
44
44
|
fields: r,
|
|
45
|
-
releaseSpecFields:
|
|
45
|
+
releaseSpecFields: de()
|
|
46
46
|
},
|
|
47
47
|
{
|
|
48
48
|
id: "br_stub_gesetz_1",
|
|
49
49
|
blueprintId: "bp_stub_gesetz",
|
|
50
50
|
blueprintName: "Gesetz",
|
|
51
51
|
label: "Release 1",
|
|
52
|
-
fieldPaths:
|
|
52
|
+
fieldPaths: j(c),
|
|
53
53
|
fields: c,
|
|
54
|
-
releaseSpecFields:
|
|
54
|
+
releaseSpecFields: de()
|
|
55
55
|
},
|
|
56
56
|
{
|
|
57
57
|
id: "br_stub_entscheidung_1",
|
|
58
58
|
blueprintId: "bp_stub_entscheidung",
|
|
59
59
|
blueprintName: "Entscheidung",
|
|
60
60
|
label: "Release 1",
|
|
61
|
-
fieldPaths:
|
|
61
|
+
fieldPaths: j(l),
|
|
62
62
|
fields: l
|
|
63
63
|
}
|
|
64
64
|
];
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function Ie() {
|
|
67
67
|
return [
|
|
68
68
|
{
|
|
69
69
|
id: "mp_stub_norm",
|
|
@@ -95,7 +95,7 @@ function _e() {
|
|
|
95
95
|
}
|
|
96
96
|
];
|
|
97
97
|
}
|
|
98
|
-
function
|
|
98
|
+
function Se() {
|
|
99
99
|
return [
|
|
100
100
|
{
|
|
101
101
|
id: "es_stub_latin1",
|
|
@@ -108,7 +108,7 @@ function Ie() {
|
|
|
108
108
|
}
|
|
109
109
|
];
|
|
110
110
|
}
|
|
111
|
-
function
|
|
111
|
+
function we() {
|
|
112
112
|
return [
|
|
113
113
|
{
|
|
114
114
|
id: "ip_stub_gesetz",
|
|
@@ -139,12 +139,12 @@ function ye() {
|
|
|
139
139
|
}
|
|
140
140
|
];
|
|
141
141
|
}
|
|
142
|
-
const
|
|
142
|
+
const X = (r, c, l, u = "") => ({
|
|
143
143
|
field_type: "text",
|
|
144
144
|
config: { name: c, api_accessor: r, required: l, instructions: u },
|
|
145
145
|
system: !1
|
|
146
146
|
});
|
|
147
|
-
function
|
|
147
|
+
function Pe() {
|
|
148
148
|
return [
|
|
149
149
|
{
|
|
150
150
|
name: "citation-links",
|
|
@@ -166,8 +166,8 @@ function Se() {
|
|
|
166
166
|
target: "source_file",
|
|
167
167
|
description: "Renames every element of one name to another.",
|
|
168
168
|
settingsSpec: [
|
|
169
|
-
|
|
170
|
-
|
|
169
|
+
X("from", "Element", !0, "The element's name now."),
|
|
170
|
+
X("to", "New name", !0)
|
|
171
171
|
]
|
|
172
172
|
},
|
|
173
173
|
{
|
|
@@ -175,7 +175,7 @@ function Se() {
|
|
|
175
175
|
kind: "preprocessor",
|
|
176
176
|
target: "source_file",
|
|
177
177
|
description: "Wraps each sentence of an element in its own element.",
|
|
178
|
-
settingsSpec: [
|
|
178
|
+
settingsSpec: [X("element", "Element", !1)]
|
|
179
179
|
}
|
|
180
180
|
];
|
|
181
181
|
}
|
|
@@ -188,7 +188,7 @@ const $ = (r = {}) => ({
|
|
|
188
188
|
kept: 0,
|
|
189
189
|
unchanged: 0,
|
|
190
190
|
...r
|
|
191
|
-
}),
|
|
191
|
+
}), w = (r) => ({
|
|
192
192
|
importProfile: {
|
|
193
193
|
configurationId: "ip_stub_gesetz",
|
|
194
194
|
name: "Boorberg gesetz",
|
|
@@ -213,28 +213,28 @@ const $ = (r = {}) => ({
|
|
|
213
213
|
importProfileId: "ip_stub_gesetz",
|
|
214
214
|
importProfileName: "Boorberg gesetz",
|
|
215
215
|
sourceFileId: `sf_${r.id}`,
|
|
216
|
-
startedBy:
|
|
216
|
+
startedBy: h,
|
|
217
217
|
phase: "ended",
|
|
218
218
|
failureReason: "",
|
|
219
219
|
progress: { done: 0, total: 0 },
|
|
220
220
|
counts: $(),
|
|
221
221
|
changeSetId: "",
|
|
222
|
-
releases:
|
|
222
|
+
releases: w(2),
|
|
223
223
|
createTime: "2026-11-03T09:00:00.000Z",
|
|
224
224
|
startTime: "",
|
|
225
225
|
endTime: "",
|
|
226
226
|
cancelledBy: "",
|
|
227
227
|
effectiveDate: "",
|
|
228
228
|
...r
|
|
229
|
-
}), B = (r, c, l, u,
|
|
229
|
+
}), B = (r, c, l, u, b) => ({
|
|
230
230
|
id: `prob_stub_${r}`,
|
|
231
231
|
mappingId: c === "norm" ? "mp_stub_norm" : "mp_stub_title",
|
|
232
232
|
mappingName: c === "norm" ? "Gesetz norms" : "Gesetz titles",
|
|
233
233
|
sourceKey: l,
|
|
234
234
|
field: u,
|
|
235
|
-
reason:
|
|
235
|
+
reason: b
|
|
236
236
|
});
|
|
237
|
-
function
|
|
237
|
+
function ve() {
|
|
238
238
|
return [
|
|
239
239
|
T({
|
|
240
240
|
id: "im_stub_running",
|
|
@@ -248,8 +248,8 @@ function Pe() {
|
|
|
248
248
|
T({
|
|
249
249
|
id: "im_stub_queued",
|
|
250
250
|
phase: "queued",
|
|
251
|
-
startedBy:
|
|
252
|
-
releases:
|
|
251
|
+
startedBy: q,
|
|
252
|
+
releases: w(2),
|
|
253
253
|
createTime: "2026-11-04T10:05:00.000Z"
|
|
254
254
|
}),
|
|
255
255
|
T({
|
|
@@ -265,9 +265,9 @@ function Pe() {
|
|
|
265
265
|
}),
|
|
266
266
|
changeSetId: "cs_stub_problems",
|
|
267
267
|
releases: {
|
|
268
|
-
...
|
|
268
|
+
...w(2),
|
|
269
269
|
mappings: [
|
|
270
|
-
...
|
|
270
|
+
...w(2).mappings,
|
|
271
271
|
{
|
|
272
272
|
configurationId: "mp_stub_title",
|
|
273
273
|
name: "Gesetz titles",
|
|
@@ -294,7 +294,7 @@ function Pe() {
|
|
|
294
294
|
outcome: "succeeded",
|
|
295
295
|
counts: $({ matched: 64, created: 64 }),
|
|
296
296
|
changeSetId: "cs_stub_succeeded",
|
|
297
|
-
releases:
|
|
297
|
+
releases: w(1),
|
|
298
298
|
createTime: "2026-11-02T14:00:00.000Z",
|
|
299
299
|
startTime: "2026-11-02T14:00:01.000Z",
|
|
300
300
|
endTime: "2026-11-02T14:03:10.000Z"
|
|
@@ -304,7 +304,7 @@ function Pe() {
|
|
|
304
304
|
outcome: "failed",
|
|
305
305
|
failureReason: "The worker crashed three times running this Import.",
|
|
306
306
|
counts: $({ matched: 30 }),
|
|
307
|
-
releases:
|
|
307
|
+
releases: w(1),
|
|
308
308
|
createTime: "2026-11-02T11:00:00.000Z",
|
|
309
309
|
startTime: "2026-11-02T11:00:01.000Z",
|
|
310
310
|
endTime: "2026-11-02T11:20:00.000Z"
|
|
@@ -312,16 +312,36 @@ function Pe() {
|
|
|
312
312
|
T({
|
|
313
313
|
id: "im_stub_cancelled",
|
|
314
314
|
outcome: "cancelled",
|
|
315
|
-
cancelledBy:
|
|
315
|
+
cancelledBy: q,
|
|
316
316
|
counts: $({ matched: 12, created: 3 }),
|
|
317
|
-
releases:
|
|
317
|
+
releases: w(1),
|
|
318
318
|
createTime: "2026-11-01T16:00:00.000Z",
|
|
319
319
|
startTime: "2026-11-01T16:00:01.000Z",
|
|
320
320
|
endTime: "2026-11-01T16:01:00.000Z"
|
|
321
321
|
})
|
|
322
322
|
];
|
|
323
323
|
}
|
|
324
|
-
|
|
324
|
+
function Te() {
|
|
325
|
+
return [
|
|
326
|
+
{
|
|
327
|
+
id: "key_stub_nightly",
|
|
328
|
+
name: "Nightly gesetz feed",
|
|
329
|
+
keyPrefix: "ihk_7Qx2",
|
|
330
|
+
owner: q,
|
|
331
|
+
expireTime: "",
|
|
332
|
+
createTime: "2026-11-20T07:30:00.000Z"
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
id: "key_stub_pipeline",
|
|
336
|
+
name: "VRPML pipeline",
|
|
337
|
+
keyPrefix: "ihk_b91F",
|
|
338
|
+
owner: h,
|
|
339
|
+
expireTime: "2027-06-30T21:59:59.000Z",
|
|
340
|
+
createTime: "2026-11-03T12:00:00.000Z"
|
|
341
|
+
}
|
|
342
|
+
];
|
|
343
|
+
}
|
|
344
|
+
const Re = [
|
|
325
345
|
"listImportProfiles",
|
|
326
346
|
"getImportProfile",
|
|
327
347
|
"createImportProfile",
|
|
@@ -349,83 +369,94 @@ const we = [
|
|
|
349
369
|
"listImports",
|
|
350
370
|
"getImport",
|
|
351
371
|
"cancelImport",
|
|
352
|
-
"listItemProblems"
|
|
372
|
+
"listItemProblems",
|
|
373
|
+
"listApiKeys",
|
|
374
|
+
"createApiKey",
|
|
375
|
+
"revokeApiKey"
|
|
353
376
|
];
|
|
354
|
-
let
|
|
355
|
-
const
|
|
356
|
-
const l = Math.max(c.releaseNumber ?? 0, 1), u = Array.from({ length: l }, (
|
|
377
|
+
let me = Date.parse("2026-11-02T08:00:00Z");
|
|
378
|
+
const P = () => (me += 36e5, new Date(me).toISOString()), ee = (r = []) => r.map((c) => {
|
|
379
|
+
const l = Math.max(c.releaseNumber ?? 0, 1), u = Array.from({ length: l }, (y, p) => ({
|
|
357
380
|
id: `${c.id}_r${p + 1}`,
|
|
358
381
|
content: structuredClone(c.content),
|
|
359
|
-
savedBy:
|
|
360
|
-
savedAt:
|
|
382
|
+
savedBy: h,
|
|
383
|
+
savedAt: P(),
|
|
361
384
|
restoredFromRevisionId: ""
|
|
362
|
-
})),
|
|
385
|
+
})), b = Array.from({ length: c.releaseNumber ?? 0 }, (y, p) => ({
|
|
363
386
|
id: `${c.id}_rel${p + 1}`,
|
|
364
387
|
number: p + 1,
|
|
365
388
|
revisionId: `${c.id}_r${p + 1}`,
|
|
366
|
-
releasedBy:
|
|
367
|
-
releasedAt:
|
|
389
|
+
releasedBy: h,
|
|
390
|
+
releasedAt: P()
|
|
368
391
|
}));
|
|
369
|
-
return { id: c.id, content: structuredClone(c.content), revisions: u, releases:
|
|
370
|
-
}),
|
|
371
|
-
const c =
|
|
392
|
+
return { id: c.id, content: structuredClone(c.content), revisions: u, releases: b };
|
|
393
|
+
}), A = (r) => r.revisions[r.revisions.length - 1], he = (r) => r.releases[r.releases.length - 1], Z = (r) => {
|
|
394
|
+
const c = he(r), l = r.revisions.find((u) => u.id === c?.revisionId);
|
|
372
395
|
return {
|
|
373
|
-
draftRevisionId:
|
|
396
|
+
draftRevisionId: A(r).id,
|
|
374
397
|
// By content, as importhub compares: a draft that restored the
|
|
375
398
|
// released content does not differ.
|
|
376
|
-
draftDiffersFromRelease: !l || JSON.stringify(l.content) !== JSON.stringify(
|
|
399
|
+
draftDiffersFromRelease: !l || JSON.stringify(l.content) !== JSON.stringify(A(r).content),
|
|
377
400
|
...c ? { latestRelease: { id: c.id, number: c.number } } : {}
|
|
378
401
|
};
|
|
379
|
-
},
|
|
380
|
-
Object.entries(r).map(([c, l]) => [
|
|
402
|
+
}, $e = (r) => r.replace(/[A-Z]/g, (c) => `_${c.toLowerCase()}`), ue = (r) => Object.fromEntries(
|
|
403
|
+
Object.entries(r).map(([c, l]) => [$e(c), l])
|
|
381
404
|
), R = (r) => ({
|
|
382
405
|
valid: r.length === 0,
|
|
383
406
|
reasons: r
|
|
384
|
-
}),
|
|
385
|
-
let
|
|
386
|
-
function
|
|
407
|
+
}), D = (r) => [...r].sort((c, l) => c.content.name.localeCompare(l.content.name));
|
|
408
|
+
let fe = 0;
|
|
409
|
+
function Ne(r = {}) {
|
|
387
410
|
const c = Object.fromEntries(
|
|
388
411
|
Object.entries(
|
|
389
412
|
r.workspaces ?? {
|
|
390
413
|
[te]: {
|
|
391
|
-
importProfiles:
|
|
392
|
-
mappings:
|
|
393
|
-
entitySets:
|
|
394
|
-
imports:
|
|
414
|
+
importProfiles: we(),
|
|
415
|
+
mappings: Ie(),
|
|
416
|
+
entitySets: Se(),
|
|
417
|
+
imports: ve(),
|
|
418
|
+
apiKeys: Te()
|
|
395
419
|
}
|
|
396
420
|
}
|
|
397
421
|
).map(([e, t]) => [
|
|
398
422
|
e,
|
|
399
423
|
{
|
|
400
|
-
importProfiles:
|
|
401
|
-
mappings:
|
|
402
|
-
entitySets:
|
|
403
|
-
imports: structuredClone(t.imports ?? [])
|
|
424
|
+
importProfiles: ee(t.importProfiles),
|
|
425
|
+
mappings: ee(t.mappings),
|
|
426
|
+
entitySets: ee(t.entitySets),
|
|
427
|
+
imports: structuredClone(t.imports ?? []),
|
|
428
|
+
apiKeys: structuredClone(t.apiKeys ?? [])
|
|
404
429
|
}
|
|
405
430
|
])
|
|
406
|
-
), l = r.processors ??
|
|
407
|
-
let
|
|
408
|
-
const
|
|
409
|
-
|
|
431
|
+
), l = r.processors ?? Pe(), u = r.blueprintReleases ?? ge();
|
|
432
|
+
let b = r.activeWorkspaceId ?? te;
|
|
433
|
+
const y = Object.fromEntries(Re.map((e) => [e, 0])), p = () => (c[b] ??= {
|
|
434
|
+
importProfiles: [],
|
|
435
|
+
mappings: [],
|
|
436
|
+
entitySets: [],
|
|
437
|
+
imports: [],
|
|
438
|
+
apiKeys: []
|
|
439
|
+
}, c[b]), f = async (e, t) => {
|
|
440
|
+
if (y[e]++, r.fail) throw r.fail;
|
|
410
441
|
return structuredClone(t());
|
|
411
442
|
}, g = (e, t, s) => {
|
|
412
|
-
const n = e.find((
|
|
443
|
+
const n = e.find((i) => i.id === t);
|
|
413
444
|
if (!n) throw new Error(`${s} ${t} not found`);
|
|
414
445
|
return n;
|
|
415
446
|
}, v = (e, t, s) => {
|
|
416
447
|
if (!t.trim()) throw new Error("a name is required");
|
|
417
|
-
if (e.some((n) => n.id !== s && n.content.name === t)) throw new
|
|
418
|
-
}, ne = (e, t) => t !== "" && t !==
|
|
448
|
+
if (e.some((n) => n.id !== s && n.content.name === t)) throw new ye();
|
|
449
|
+
}, ne = (e, t) => t !== "" && t !== A(e).id, N = (e, t, s, n = "") => {
|
|
419
450
|
if (ne(e, s))
|
|
420
451
|
throw new Error("the draft moved: somebody saved in between");
|
|
421
452
|
e.content = structuredClone(t), e.revisions.push({
|
|
422
453
|
id: `${e.id}_r${e.revisions.length + 1}`,
|
|
423
454
|
content: structuredClone(t),
|
|
424
|
-
savedBy:
|
|
425
|
-
savedAt:
|
|
455
|
+
savedBy: h,
|
|
456
|
+
savedAt: P(),
|
|
426
457
|
restoredFromRevisionId: n
|
|
427
458
|
});
|
|
428
|
-
},
|
|
459
|
+
}, G = (e, t) => {
|
|
429
460
|
const s = H(e);
|
|
430
461
|
return {
|
|
431
462
|
id: s,
|
|
@@ -434,15 +465,15 @@ function Be(r = {}) {
|
|
|
434
465
|
{
|
|
435
466
|
id: `${s}_r1`,
|
|
436
467
|
content: structuredClone(t),
|
|
437
|
-
savedBy:
|
|
438
|
-
savedAt:
|
|
468
|
+
savedBy: h,
|
|
469
|
+
savedAt: P(),
|
|
439
470
|
restoredFromRevisionId: ""
|
|
440
471
|
}
|
|
441
472
|
],
|
|
442
473
|
releases: []
|
|
443
474
|
};
|
|
444
475
|
};
|
|
445
|
-
function
|
|
476
|
+
function J(e) {
|
|
446
477
|
const t = [], s = u.find((o) => o.id === e.blueprintReleaseId);
|
|
447
478
|
e.blueprintReleaseId ? s ? s.blueprintId !== e.blueprintId && t.push({
|
|
448
479
|
path: "/blueprintReleaseId",
|
|
@@ -461,15 +492,15 @@ function Be(r = {}) {
|
|
|
461
492
|
code: "no_element_selector",
|
|
462
493
|
message: "It has no element selector."
|
|
463
494
|
}), !e.sourceKey?.selector && !e.sourceKey?.template && t.push({ path: "/sourceKey", code: "no_source_key", message: "It has no Source Key." });
|
|
464
|
-
const n = (o,
|
|
465
|
-
typeof
|
|
495
|
+
const n = (o, a) => {
|
|
496
|
+
typeof a == "string" && a !== "" && !Ee(a) && t.push({ path: o, code: "invalid_xpath", message: `"${a}" is not an XPath.` });
|
|
466
497
|
};
|
|
467
498
|
n("/element_selector", e.elementSelector), n("/source_key/selector", e.sourceKey?.selector);
|
|
468
|
-
const
|
|
469
|
-
return (e.fields ?? []).forEach((o,
|
|
470
|
-
const m = `/fields/${
|
|
471
|
-
for (const { path: d, rel:
|
|
472
|
-
|
|
499
|
+
const i = [];
|
|
500
|
+
return (e.fields ?? []).forEach((o, a) => {
|
|
501
|
+
const m = `/fields/${a}`;
|
|
502
|
+
for (const { path: d, rel: k, mapping: S } of se(o, "", m))
|
|
503
|
+
i.push(d), n(`${k}/selector`, S.selector), s && !s.fieldPaths.includes(d) && t.push({
|
|
473
504
|
path: m,
|
|
474
505
|
code: "unknown_field_path",
|
|
475
506
|
message: `The pinned Release has no field ${d}.`
|
|
@@ -478,68 +509,68 @@ function Be(r = {}) {
|
|
|
478
509
|
code: "xmlmapper_schema",
|
|
479
510
|
message: `The select field ${d} has no select options.`
|
|
480
511
|
});
|
|
481
|
-
}), (e.versionMatch?.contentFields ?? []).forEach((o,
|
|
482
|
-
|
|
483
|
-
path: `/version_match/content_fields/${
|
|
512
|
+
}), (e.versionMatch?.contentFields ?? []).forEach((o, a) => {
|
|
513
|
+
i.includes(o) || t.push({
|
|
514
|
+
path: `/version_match/content_fields/${a}`,
|
|
484
515
|
code: "unknown_version_match_field",
|
|
485
516
|
message: `The Version Match compares ${o}, which the Mapping does not map.`
|
|
486
517
|
});
|
|
487
|
-
}), (e.titleContributions ?? []).forEach((o,
|
|
518
|
+
}), (e.titleContributions ?? []).forEach((o, a) => {
|
|
488
519
|
(!o.selector || !o.ausgabeCodeSelector) && t.push({
|
|
489
|
-
path: `/title_contributions/${
|
|
520
|
+
path: `/title_contributions/${a}`,
|
|
490
521
|
code: "incomplete_title_contribution",
|
|
491
522
|
message: "A Title Contribution needs a selector and an Ausgabe code selector."
|
|
492
|
-
}), n(`/title_contributions/${
|
|
493
|
-
}), (e.placeholderAssets ?? []).forEach((o,
|
|
523
|
+
}), n(`/title_contributions/${a}/selector`, o.selector);
|
|
524
|
+
}), (e.placeholderAssets ?? []).forEach((o, a) => {
|
|
494
525
|
(!o.selector || !o.assetType || !o.keyParts?.length || !o.nameSelector) && t.push({
|
|
495
|
-
path: `/placeholder_assets/${
|
|
526
|
+
path: `/placeholder_assets/${a}`,
|
|
496
527
|
code: "incomplete_placeholder_assets",
|
|
497
528
|
message: "Placeholder Assets need a selector, an asset type, the key's parts and a name selector."
|
|
498
|
-
}), n(`/placeholder_assets/${
|
|
499
|
-
n(`/placeholder_assets/${
|
|
529
|
+
}), n(`/placeholder_assets/${a}/selector`, o.selector), (o.keyParts ?? []).forEach((m, d) => {
|
|
530
|
+
n(`/placeholder_assets/${a}/key_parts/${d}`, m);
|
|
500
531
|
});
|
|
501
532
|
}), t;
|
|
502
533
|
}
|
|
503
534
|
function re(e, t, s) {
|
|
504
|
-
return e.flatMap((n,
|
|
505
|
-
const o = `/${t}/${
|
|
506
|
-
return
|
|
535
|
+
return e.flatMap((n, i) => {
|
|
536
|
+
const o = `/${t}/${i}`, a = l.find((d) => d.name === n.processor);
|
|
537
|
+
return a ? a.target !== "source_file" ? [
|
|
507
538
|
{
|
|
508
539
|
path: o,
|
|
509
540
|
code: "rich_text_processor",
|
|
510
|
-
message: `${
|
|
541
|
+
message: `${a.name} is configured on a rich-text field, not on a Profile.`
|
|
511
542
|
}
|
|
512
|
-
] :
|
|
543
|
+
] : a.kind !== s ? [{ path: o, code: "wrong_processor_kind", message: `${a.name} does not run here.` }] : a.settingsSpec.filter(
|
|
513
544
|
(d) => d.config.required && (n.settings[d.config.api_accessor] ?? "") === ""
|
|
514
545
|
).map((d) => ({
|
|
515
546
|
path: `${o}/settings/${d.config.api_accessor}`,
|
|
516
547
|
code: "invalid_processor_settings",
|
|
517
|
-
message: `${
|
|
548
|
+
message: `${a.name}: ${d.config.api_accessor} is required.`
|
|
518
549
|
})) : [
|
|
519
550
|
{ path: o, code: "unknown_processor", message: `No Processor is called ${n.processor}.` }
|
|
520
551
|
];
|
|
521
552
|
});
|
|
522
553
|
}
|
|
523
|
-
function
|
|
554
|
+
function L(e) {
|
|
524
555
|
const t = p(), s = [
|
|
525
556
|
...re(e.preprocessors, "preprocessors", "preprocessor"),
|
|
526
557
|
...re(e.postProcessors, "postProcessors", "post_processor")
|
|
527
558
|
];
|
|
528
|
-
return e.mappingIds.length === 0 && s.push({ path: "/mappingIds", code: "no_mappings", message: "It includes no Mapping." }), e.mappingIds.forEach((n,
|
|
559
|
+
return e.mappingIds.length === 0 && s.push({ path: "/mappingIds", code: "no_mappings", message: "It includes no Mapping." }), e.mappingIds.forEach((n, i) => {
|
|
529
560
|
const o = t.mappings.find((m) => m.id === n);
|
|
530
561
|
if (!o) {
|
|
531
562
|
s.push({
|
|
532
|
-
path: `/mappingIds/${
|
|
563
|
+
path: `/mappingIds/${i}`,
|
|
533
564
|
code: "mapping_missing",
|
|
534
565
|
message: "It includes a Mapping that does not exist."
|
|
535
566
|
});
|
|
536
567
|
return;
|
|
537
568
|
}
|
|
538
|
-
const
|
|
539
|
-
|
|
540
|
-
path: `/mappingIds/${
|
|
569
|
+
const a = J(o.content);
|
|
570
|
+
a.length > 0 && s.push({
|
|
571
|
+
path: `/mappingIds/${i}`,
|
|
541
572
|
code: "mapping_invalid",
|
|
542
|
-
message: `The Mapping ${o.content.name} is invalid: ${
|
|
573
|
+
message: `The Mapping ${o.content.name} is invalid: ${a.map((m) => m.message).join(" ")}`
|
|
543
574
|
});
|
|
544
575
|
}), e.entitySetId && !t.entitySets.some((n) => n.id === e.entitySetId) && s.push({
|
|
545
576
|
path: "/entitySetId",
|
|
@@ -547,63 +578,63 @@ function Be(r = {}) {
|
|
|
547
578
|
message: "It names an Entity Set that does not exist."
|
|
548
579
|
}), s;
|
|
549
580
|
}
|
|
550
|
-
const
|
|
581
|
+
const ie = (e) => Object.keys(e.entities).length === 0 ? [{ path: "/entities", code: "no_entities", message: "It defines no entity." }] : [], x = (e) => ({
|
|
551
582
|
id: e.id,
|
|
552
583
|
content: e.content,
|
|
553
|
-
validity: R(
|
|
554
|
-
state:
|
|
555
|
-
}),
|
|
584
|
+
validity: R(L(e.content)),
|
|
585
|
+
state: Z(e)
|
|
586
|
+
}), O = (e) => ({
|
|
556
587
|
id: e.id,
|
|
557
588
|
content: e.content,
|
|
558
|
-
validity: R(
|
|
559
|
-
state:
|
|
560
|
-
}),
|
|
589
|
+
validity: R(J(e.content)),
|
|
590
|
+
state: Z(e)
|
|
591
|
+
}), F = (e) => ({
|
|
561
592
|
id: e.id,
|
|
562
593
|
content: e.content,
|
|
563
|
-
validity: R(
|
|
564
|
-
state:
|
|
565
|
-
}),
|
|
594
|
+
validity: R(ie(e.content)),
|
|
595
|
+
state: Z(e)
|
|
596
|
+
}), K = (e) => D(p().importProfiles.filter((t) => e(t.content))).map((t) => ({
|
|
566
597
|
id: t.id,
|
|
567
598
|
name: t.content.name
|
|
568
|
-
})), H = (e) => `${e}_stub_new_${++
|
|
599
|
+
})), H = (e) => `${e}_stub_new_${++fe}`, E = (e) => {
|
|
569
600
|
const t = p();
|
|
570
601
|
switch (e) {
|
|
571
602
|
case "importProfile":
|
|
572
603
|
return {
|
|
573
604
|
items: t.importProfiles,
|
|
574
605
|
name: "Import Profile",
|
|
575
|
-
reasons: (s) =>
|
|
606
|
+
reasons: (s) => L(s)
|
|
576
607
|
};
|
|
577
608
|
case "mapping":
|
|
578
609
|
return {
|
|
579
610
|
items: t.mappings,
|
|
580
611
|
name: "Mapping",
|
|
581
|
-
reasons: (s) =>
|
|
612
|
+
reasons: (s) => J(s)
|
|
582
613
|
};
|
|
583
614
|
case "entitySet":
|
|
584
615
|
return {
|
|
585
616
|
items: t.entitySets,
|
|
586
617
|
name: "Entity Set",
|
|
587
|
-
reasons: (s) =>
|
|
618
|
+
reasons: (s) => ie(s)
|
|
588
619
|
};
|
|
589
620
|
}
|
|
590
|
-
},
|
|
591
|
-
|
|
592
|
-
},
|
|
621
|
+
}, I = (e, t) => {
|
|
622
|
+
A(t).validity = R(E(e).reasons(t.content));
|
|
623
|
+
}, U = (e, t) => {
|
|
593
624
|
const s = e.revisions.find((n) => n.id === t);
|
|
594
625
|
if (!s) throw new Error(`Revision ${t} not found`);
|
|
595
626
|
return s;
|
|
596
|
-
},
|
|
627
|
+
}, oe = /* @__PURE__ */ new Set(), ae = r.contenthubRights ?? ["editor", "publisher"], z = (e) => {
|
|
597
628
|
const t = p().imports.find((s) => s.id === e);
|
|
598
629
|
if (!t) throw new Error(`Import ${e} not found`);
|
|
599
630
|
return t;
|
|
600
|
-
},
|
|
601
|
-
e.cancelledBy && e.phase !== "ended" && (e.phase = "ended", e.outcome = "cancelled", e.endTime =
|
|
602
|
-
},
|
|
603
|
-
const s =
|
|
631
|
+
}, W = (e) => {
|
|
632
|
+
e.cancelledBy && e.phase !== "ended" && (e.phase = "ended", e.outcome = "cancelled", e.endTime = P());
|
|
633
|
+
}, C = ({ itemProblems: e, ...t }) => t, V = (e, t) => {
|
|
634
|
+
const s = he(e);
|
|
604
635
|
if (!s)
|
|
605
|
-
throw new
|
|
606
|
-
const n = e.revisions.find((
|
|
636
|
+
throw new M(`the ${t} ${e.content.name} has no Release yet`);
|
|
637
|
+
const n = e.revisions.find((i) => i.id === s.revisionId)?.content ?? e.content;
|
|
607
638
|
return {
|
|
608
639
|
content: n,
|
|
609
640
|
ref: {
|
|
@@ -615,173 +646,173 @@ function Be(r = {}) {
|
|
|
615
646
|
};
|
|
616
647
|
};
|
|
617
648
|
return {
|
|
618
|
-
calls:
|
|
649
|
+
calls: y,
|
|
619
650
|
switchWorkspace(e) {
|
|
620
|
-
|
|
651
|
+
b = e;
|
|
621
652
|
},
|
|
622
653
|
updateImport(e, t) {
|
|
623
|
-
Object.assign(
|
|
654
|
+
Object.assign(z(e), structuredClone(t));
|
|
624
655
|
},
|
|
625
|
-
listImportProfiles: () => f("listImportProfiles", () =>
|
|
626
|
-
getImportProfile: (e) => f("getImportProfile", () =>
|
|
656
|
+
listImportProfiles: () => f("listImportProfiles", () => D(p().importProfiles).map(x)),
|
|
657
|
+
getImportProfile: (e) => f("getImportProfile", () => x(g(p().importProfiles, e, "Import Profile"))),
|
|
627
658
|
createImportProfile: (e) => f("createImportProfile", () => {
|
|
628
659
|
v(p().importProfiles, e.name);
|
|
629
|
-
const t =
|
|
630
|
-
return
|
|
660
|
+
const t = G("ip", e);
|
|
661
|
+
return I("importProfile", t), p().importProfiles.push(t), x(t);
|
|
631
662
|
}),
|
|
632
663
|
updateImportProfile: (e, t, s) => f("updateImportProfile", () => {
|
|
633
664
|
const n = g(p().importProfiles, e, "Import Profile");
|
|
634
|
-
return v(p().importProfiles, t.name, e),
|
|
665
|
+
return v(p().importProfiles, t.name, e), N(n, t, s), I("importProfile", n), x(n);
|
|
635
666
|
}),
|
|
636
667
|
deleteImportProfile: (e) => f("deleteImportProfile", () => {
|
|
637
668
|
g(p().importProfiles, e, "Import Profile"), p().importProfiles = p().importProfiles.filter((t) => t.id !== e);
|
|
638
669
|
}),
|
|
639
670
|
listProcessors: () => f("listProcessors", () => [...l].sort((e, t) => e.name.localeCompare(t.name))),
|
|
640
|
-
listMappings: () => f("listMappings", () =>
|
|
641
|
-
getMapping: (e) => f("getMapping", () =>
|
|
671
|
+
listMappings: () => f("listMappings", () => D(p().mappings).map(O)),
|
|
672
|
+
getMapping: (e) => f("getMapping", () => O(g(p().mappings, e, "Mapping"))),
|
|
642
673
|
createMapping: (e) => f("createMapping", () => {
|
|
643
674
|
v(p().mappings, e.name);
|
|
644
|
-
const t =
|
|
645
|
-
return
|
|
675
|
+
const t = G("mp", e);
|
|
676
|
+
return I("mapping", t), p().mappings.push(t), O(t);
|
|
646
677
|
}),
|
|
647
678
|
updateMapping: (e, t, s) => f("updateMapping", () => {
|
|
648
679
|
const n = g(p().mappings, e, "Mapping");
|
|
649
|
-
return v(p().mappings, t.name, e),
|
|
680
|
+
return v(p().mappings, t.name, e), N(n, t, s), I("mapping", n), O(n);
|
|
650
681
|
}),
|
|
651
682
|
deleteMapping: (e) => f("deleteMapping", () => {
|
|
652
683
|
g(p().mappings, e, "Mapping");
|
|
653
|
-
const t =
|
|
684
|
+
const t = K((s) => s.mappingIds.includes(e));
|
|
654
685
|
if (t.length > 0)
|
|
655
|
-
throw new
|
|
686
|
+
throw new le(
|
|
656
687
|
t,
|
|
657
688
|
`the Mapping is included by ${t.map((s) => s.name).join(", ")}`
|
|
658
689
|
);
|
|
659
690
|
p().mappings = p().mappings.filter((s) => s.id !== e);
|
|
660
691
|
}),
|
|
661
|
-
listMappingImportProfiles: (e) => f("listMappingImportProfiles", () => (g(p().mappings, e, "Mapping"),
|
|
692
|
+
listMappingImportProfiles: (e) => f("listMappingImportProfiles", () => (g(p().mappings, e, "Mapping"), K((t) => t.mappingIds.includes(e)))),
|
|
662
693
|
checkMappingBlueprintRelease: (e, t) => f("checkMappingBlueprintRelease", () => {
|
|
663
|
-
const s = g(p().mappings, e, "Mapping"), n = u.find((
|
|
694
|
+
const s = g(p().mappings, e, "Mapping"), n = u.find((i) => i.id === t);
|
|
664
695
|
if (!n) throw new Error(`Blueprint Release ${t} not found`);
|
|
665
696
|
if (n.blueprintId !== s.content.blueprintId)
|
|
666
697
|
throw new Error("the Release is of another Blueprint");
|
|
667
698
|
return {
|
|
668
699
|
blueprintId: n.blueprintId,
|
|
669
|
-
missingFieldPaths: (s.content.fields ?? []).flatMap((
|
|
700
|
+
missingFieldPaths: (s.content.fields ?? []).flatMap((i, o) => se(i, "", `/fields/${o}`).map((a) => a.path)).filter((i) => !n.fieldPaths.includes(i)),
|
|
670
701
|
missingReleaseSpecFields: [
|
|
671
|
-
...(s.content.releaseSpec ?? []).map((
|
|
702
|
+
...(s.content.releaseSpec ?? []).map((i) => i.field ?? ""),
|
|
672
703
|
...s.content.versionMatch?.releaseSpecFields ?? []
|
|
673
704
|
].filter(
|
|
674
|
-
(
|
|
705
|
+
(i, o, a) => i !== "" && a.indexOf(i) === o && !(n.releaseSpecFields ?? []).some((m) => m.path === i)
|
|
675
706
|
)
|
|
676
707
|
};
|
|
677
708
|
}),
|
|
678
|
-
listEntitySets: () => f("listEntitySets", () =>
|
|
679
|
-
getEntitySet: (e) => f("getEntitySet", () =>
|
|
709
|
+
listEntitySets: () => f("listEntitySets", () => D(p().entitySets).map(F)),
|
|
710
|
+
getEntitySet: (e) => f("getEntitySet", () => F(g(p().entitySets, e, "Entity Set"))),
|
|
680
711
|
createEntitySet: (e) => f("createEntitySet", () => {
|
|
681
712
|
v(p().entitySets, e.name);
|
|
682
|
-
const t =
|
|
683
|
-
return
|
|
713
|
+
const t = G("es", e);
|
|
714
|
+
return I("entitySet", t), p().entitySets.push(t), F(t);
|
|
684
715
|
}),
|
|
685
716
|
updateEntitySet: (e, t, s) => f("updateEntitySet", () => {
|
|
686
717
|
const n = g(p().entitySets, e, "Entity Set");
|
|
687
|
-
return v(p().entitySets, t.name, e),
|
|
718
|
+
return v(p().entitySets, t.name, e), N(n, t, s), I("entitySet", n), F(n);
|
|
688
719
|
}),
|
|
689
720
|
deleteEntitySet: (e) => f("deleteEntitySet", () => {
|
|
690
721
|
g(p().entitySets, e, "Entity Set");
|
|
691
|
-
const t =
|
|
722
|
+
const t = K((s) => s.entitySetId === e);
|
|
692
723
|
if (t.length > 0)
|
|
693
|
-
throw new
|
|
724
|
+
throw new le(
|
|
694
725
|
t,
|
|
695
726
|
`the Entity Set is named by ${t.map((s) => s.name).join(", ")}`
|
|
696
727
|
);
|
|
697
728
|
p().entitySets = p().entitySets.filter((s) => s.id !== e);
|
|
698
729
|
}),
|
|
699
730
|
cutRelease: (e, t, s) => f("cutRelease", () => {
|
|
700
|
-
const n = E(e),
|
|
701
|
-
if (ne(
|
|
702
|
-
throw new
|
|
703
|
-
const o = R(n.reasons(
|
|
704
|
-
if (!o.valid) throw new
|
|
705
|
-
if (!
|
|
706
|
-
throw new
|
|
731
|
+
const n = E(e), i = g(n.items, t, n.name);
|
|
732
|
+
if (ne(i, s))
|
|
733
|
+
throw new Q("the draft moved: somebody saved in between");
|
|
734
|
+
const o = R(n.reasons(i.content));
|
|
735
|
+
if (!o.valid) throw new Q("the draft is invalid", o);
|
|
736
|
+
if (!Z(i).draftDiffersFromRelease)
|
|
737
|
+
throw new Q(
|
|
707
738
|
"the draft does not differ from the latest Release: there is nothing to release"
|
|
708
739
|
);
|
|
709
|
-
const
|
|
710
|
-
id: `${
|
|
711
|
-
number:
|
|
712
|
-
revisionId:
|
|
713
|
-
releasedBy:
|
|
714
|
-
releasedAt:
|
|
740
|
+
const a = i.releases.length + 1, m = {
|
|
741
|
+
id: `${i.id}_rel${a}`,
|
|
742
|
+
number: a,
|
|
743
|
+
revisionId: A(i).id,
|
|
744
|
+
releasedBy: h,
|
|
745
|
+
releasedAt: P()
|
|
715
746
|
};
|
|
716
|
-
return
|
|
747
|
+
return i.releases.push(m), {
|
|
717
748
|
release: m,
|
|
718
|
-
importProfiles: e === "mapping" ?
|
|
749
|
+
importProfiles: e === "mapping" ? K((d) => d.mappingIds.includes(t)) : []
|
|
719
750
|
};
|
|
720
751
|
}),
|
|
721
752
|
listHistory: (e, t, s) => f("listHistory", () => {
|
|
722
|
-
const n = E(e),
|
|
753
|
+
const n = E(e), i = g(n.items, t, n.name), o = [...i.revisions].reverse(), a = Number(s || "0");
|
|
723
754
|
return {
|
|
724
|
-
revisions: o.slice(
|
|
755
|
+
revisions: o.slice(a, a + 10).map((d) => ({
|
|
725
756
|
id: d.id,
|
|
726
757
|
savedBy: d.savedBy,
|
|
727
758
|
savedAt: d.savedAt,
|
|
728
759
|
validity: d.validity ?? R(n.reasons(d.content)),
|
|
729
760
|
restoredFromRevisionId: d.restoredFromRevisionId
|
|
730
761
|
})),
|
|
731
|
-
releases: [...
|
|
732
|
-
nextPageToken:
|
|
762
|
+
releases: [...i.releases].reverse(),
|
|
763
|
+
nextPageToken: a + 10 < o.length ? String(a + 10) : ""
|
|
733
764
|
};
|
|
734
765
|
}),
|
|
735
766
|
compareRevisions: (e, t, s, n) => f("compareRevisions", () => {
|
|
736
|
-
const
|
|
737
|
-
const S =
|
|
738
|
-
return { field:
|
|
767
|
+
const i = E(e), o = g(i.items, t, i.name), a = ue(U(o, s).content), m = ue(U(o, n).content), d = [.../* @__PURE__ */ new Set([...Object.keys(a), ...Object.keys(m)])].map((k) => {
|
|
768
|
+
const S = a[k], Y = m[k], be = S === void 0 && Y !== void 0 ? "added" : S !== void 0 && Y === void 0 ? "removed" : JSON.stringify(S) === JSON.stringify(Y) ? "unchanged" : "changed";
|
|
769
|
+
return { field: k, status: be };
|
|
739
770
|
});
|
|
740
771
|
return {
|
|
741
|
-
from: { revisionId: s, content:
|
|
772
|
+
from: { revisionId: s, content: a },
|
|
742
773
|
to: { revisionId: n, content: m },
|
|
743
774
|
fields: d
|
|
744
775
|
};
|
|
745
776
|
}),
|
|
746
777
|
restoreRevision: (e, t, s, n) => f("restoreRevision", () => {
|
|
747
|
-
const
|
|
748
|
-
|
|
778
|
+
const i = E(e), o = g(i.items, t, i.name);
|
|
779
|
+
N(o, U(o, s).content, n, s), I(e, o);
|
|
749
780
|
}),
|
|
750
781
|
async uploadSourceFile(e, t) {
|
|
751
|
-
if (
|
|
782
|
+
if (y.uploadSourceFile++, r.fail) throw r.fail;
|
|
752
783
|
for (const n of [0.25, 0.5, 0.75])
|
|
753
|
-
await new Promise((
|
|
784
|
+
await new Promise((i) => setTimeout(i, 20)), t(n);
|
|
754
785
|
if (r.uploadFails) throw r.uploadFails;
|
|
755
786
|
t(1);
|
|
756
787
|
const s = H("sf");
|
|
757
|
-
return
|
|
788
|
+
return oe.add(s), { id: s, fileName: e.name };
|
|
758
789
|
},
|
|
759
790
|
startImport: (e) => f("startImport", () => {
|
|
760
791
|
const t = p(), s = g(t.importProfiles, e.importProfileId, "Import Profile");
|
|
761
|
-
if (!
|
|
762
|
-
throw new
|
|
792
|
+
if (!oe.has(e.sourceFileId))
|
|
793
|
+
throw new M("nothing was uploaded to the Source File");
|
|
763
794
|
if (!ae.includes("editor"))
|
|
764
|
-
throw new
|
|
795
|
+
throw new M(
|
|
765
796
|
"starting an Import needs contenthub editor in the workspace"
|
|
766
797
|
);
|
|
767
|
-
const n =
|
|
798
|
+
const n = V(s, "Import Profile");
|
|
768
799
|
if (n.content.autoPublish && !ae.includes("publisher"))
|
|
769
|
-
throw new
|
|
800
|
+
throw new M(
|
|
770
801
|
"the Import Profile has Auto-publish, which needs contenthub publisher"
|
|
771
802
|
);
|
|
772
|
-
const
|
|
773
|
-
if (
|
|
774
|
-
throw new
|
|
775
|
-
`the Import Profile ${n.ref.name} is invalid: ${
|
|
803
|
+
const i = L(n.content);
|
|
804
|
+
if (i.length > 0)
|
|
805
|
+
throw new M(
|
|
806
|
+
`the Import Profile ${n.ref.name} is invalid: ${i.map((d) => d.message).join(" ")}`
|
|
776
807
|
);
|
|
777
808
|
const o = n.content.mappingIds.map(
|
|
778
|
-
(d) =>
|
|
779
|
-
),
|
|
809
|
+
(d) => V(g(t.mappings, d, "Mapping"), "Mapping").ref
|
|
810
|
+
), a = n.content.entitySetId ? V(g(t.entitySets, n.content.entitySetId, "Entity Set"), "Entity Set").ref : void 0, m = {
|
|
780
811
|
id: H("im"),
|
|
781
812
|
importProfileId: s.id,
|
|
782
813
|
importProfileName: n.ref.name,
|
|
783
814
|
sourceFileId: e.sourceFileId,
|
|
784
|
-
startedBy:
|
|
815
|
+
startedBy: h,
|
|
785
816
|
phase: "queued",
|
|
786
817
|
failureReason: "",
|
|
787
818
|
progress: { done: 0, total: 0 },
|
|
@@ -798,9 +829,9 @@ function Be(r = {}) {
|
|
|
798
829
|
releases: {
|
|
799
830
|
importProfile: n.ref,
|
|
800
831
|
mappings: o,
|
|
801
|
-
...
|
|
832
|
+
...a ? { entitySet: a } : {}
|
|
802
833
|
},
|
|
803
|
-
createTime:
|
|
834
|
+
createTime: P(),
|
|
804
835
|
startTime: "",
|
|
805
836
|
endTime: "",
|
|
806
837
|
cancelledBy: "",
|
|
@@ -808,28 +839,28 @@ function Be(r = {}) {
|
|
|
808
839
|
...e.source ? { source: e.source } : {},
|
|
809
840
|
itemProblems: []
|
|
810
841
|
};
|
|
811
|
-
return t.imports.unshift(m),
|
|
842
|
+
return t.imports.unshift(m), C(m);
|
|
812
843
|
}),
|
|
813
844
|
listImports: (e) => f("listImports", () => {
|
|
814
845
|
const t = p().imports;
|
|
815
|
-
t.forEach(
|
|
846
|
+
t.forEach(W);
|
|
816
847
|
const s = Number(e || "0");
|
|
817
848
|
return {
|
|
818
|
-
imports: t.slice(s, s + 50).map(
|
|
849
|
+
imports: t.slice(s, s + 50).map(C),
|
|
819
850
|
nextPageToken: s + 50 < t.length ? String(s + 50) : ""
|
|
820
851
|
};
|
|
821
852
|
}),
|
|
822
853
|
getImport: (e) => f("getImport", () => {
|
|
823
|
-
const t =
|
|
824
|
-
return
|
|
854
|
+
const t = z(e);
|
|
855
|
+
return W(t), C(t);
|
|
825
856
|
}),
|
|
826
857
|
cancelImport: (e) => f("cancelImport", () => {
|
|
827
|
-
const t =
|
|
858
|
+
const t = z(e);
|
|
828
859
|
if (t.phase === "ended") throw new Error("the Import has ended");
|
|
829
|
-
return t.cancelledBy ||=
|
|
860
|
+
return t.cancelledBy ||= h, t.phase === "queued" && W(t), C(t);
|
|
830
861
|
}),
|
|
831
862
|
listItemProblems: (e, t) => f("listItemProblems", () => {
|
|
832
|
-
const s =
|
|
863
|
+
const s = z(e).itemProblems ?? [], n = t.sourceKeyQuery.toLowerCase(), i = s.filter(
|
|
833
864
|
(m) => (!t.mappingId || m.mappingId === t.mappingId) && m.sourceKey.toLowerCase().includes(n)
|
|
834
865
|
), o = /* @__PURE__ */ new Map();
|
|
835
866
|
for (const m of s) {
|
|
@@ -840,18 +871,42 @@ function Be(r = {}) {
|
|
|
840
871
|
};
|
|
841
872
|
d.count++, o.set(m.mappingId, d);
|
|
842
873
|
}
|
|
843
|
-
const
|
|
874
|
+
const a = Number(t.pageToken || "0");
|
|
844
875
|
return {
|
|
845
|
-
itemProblems:
|
|
876
|
+
itemProblems: i.slice(a, a + 50),
|
|
846
877
|
totalCount: s.length,
|
|
847
|
-
matchingCount:
|
|
878
|
+
matchingCount: i.length,
|
|
848
879
|
mappings: [...o.values()].sort((m, d) => m.mappingName.localeCompare(d.mappingName)),
|
|
849
|
-
nextPageToken:
|
|
880
|
+
nextPageToken: a + 50 < i.length ? String(a + 50) : ""
|
|
850
881
|
};
|
|
882
|
+
}),
|
|
883
|
+
listApiKeys: () => f("listApiKeys", () => p().apiKeys),
|
|
884
|
+
createApiKey: (e) => f("createApiKey", () => {
|
|
885
|
+
const t = e.name.trim();
|
|
886
|
+
if (!t) throw new Error("a name is required");
|
|
887
|
+
if (t.length > ce)
|
|
888
|
+
throw new Error(`the name is longer than ${ce} characters`);
|
|
889
|
+
const s = e.expireTime ? new Date(e.expireTime).toISOString() : "";
|
|
890
|
+
if (s && Date.parse(s) <= Date.now())
|
|
891
|
+
throw new Error("the expiry must lie in the future");
|
|
892
|
+
const n = ++fe, i = {
|
|
893
|
+
id: `key_stub_new_${n}`,
|
|
894
|
+
name: t,
|
|
895
|
+
keyPrefix: `ihk_n${String(n).padStart(3, "0")}`,
|
|
896
|
+
owner: h,
|
|
897
|
+
expireTime: s,
|
|
898
|
+
createTime: (/* @__PURE__ */ new Date()).toISOString()
|
|
899
|
+
};
|
|
900
|
+
return p().apiKeys.unshift(i), { apiKey: i, secret: `${i.keyPrefix}_stub_secret_${n}` };
|
|
901
|
+
}),
|
|
902
|
+
revokeApiKey: (e) => f("revokeApiKey", () => {
|
|
903
|
+
const t = p();
|
|
904
|
+
if (!t.apiKeys.some((s) => s.id === e)) throw new Error(`API key ${e} not found`);
|
|
905
|
+
t.apiKeys = t.apiKeys.filter((s) => s.id !== e);
|
|
851
906
|
})
|
|
852
907
|
};
|
|
853
908
|
}
|
|
854
|
-
function
|
|
909
|
+
function Ee(r) {
|
|
855
910
|
const c = [], l = { "]": "[", ")": "(" };
|
|
856
911
|
for (const u of r)
|
|
857
912
|
if (u === "[" || u === "(") c.push(u);
|
|
@@ -863,13 +918,13 @@ function se(r, c, l) {
|
|
|
863
918
|
return [
|
|
864
919
|
{ path: u, rel: l, mapping: r },
|
|
865
920
|
...["fields", "virtualTableFields"].flatMap(
|
|
866
|
-
(
|
|
867
|
-
(
|
|
921
|
+
(b) => (Array.isArray(r[b]) ? r[b] : []).flatMap(
|
|
922
|
+
(y, p) => se(y, `${u}.`, `${l}/${b}/${p}`)
|
|
868
923
|
)
|
|
869
924
|
)
|
|
870
925
|
];
|
|
871
926
|
}
|
|
872
|
-
function
|
|
927
|
+
function xe(r = ge()) {
|
|
873
928
|
return {
|
|
874
929
|
async listBlueprints() {
|
|
875
930
|
return [...new Map(r.map((l) => [l.blueprintId, l.blueprintName]))].map(([l, u]) => ({ id: l, name: u })).sort((l, u) => l.name.localeCompare(u.name));
|
|
@@ -897,18 +952,19 @@ function Ne(r = ue()) {
|
|
|
897
952
|
};
|
|
898
953
|
}
|
|
899
954
|
export {
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
955
|
+
q as STUB_OTHER_USER_ID,
|
|
956
|
+
Be as STUB_OTHER_WORKSPACE_ID,
|
|
957
|
+
h as STUB_USER_ID,
|
|
903
958
|
te as STUB_WORKSPACE_ID,
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
959
|
+
xe as createStubBlueprints,
|
|
960
|
+
Ne as createStubImporthubClient,
|
|
961
|
+
Te as stubApiKeys,
|
|
962
|
+
ge as stubBlueprintReleases,
|
|
963
|
+
Se as stubEntitySets,
|
|
964
|
+
Ae as stubIdentity,
|
|
965
|
+
we as stubImportProfiles,
|
|
966
|
+
ve as stubImports,
|
|
967
|
+
Ie as stubMappings,
|
|
968
|
+
Pe as stubProcessors
|
|
913
969
|
};
|
|
914
970
|
//# sourceMappingURL=testing.js.map
|