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