@knkcs/importhub-ui 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/README.md +7 -2
- package/dist/importhub-client-fCWgKH03.js +29 -0
- package/dist/importhub-client-fCWgKH03.js.map +1 -0
- package/dist/index.d.ts +457 -0
- package/dist/index.js +1547 -849
- package/dist/index.js.map +1 -1
- package/dist/mapping-editor.d.ts +161 -0
- package/dist/mapping-editor.js +1 -1
- package/dist/{mapping-page-v0GJAPjW.js → mapping-page-D92XwUq5.js} +426 -418
- package/dist/mapping-page-D92XwUq5.js.map +1 -0
- package/dist/testing.d.ts +192 -0
- package/dist/testing.js +548 -270
- package/dist/testing.js.map +1 -1
- package/package.json +1 -1
- package/dist/importhub-client-CrS-3Zuu.js +0 -23
- 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 he } from "@knkcs/anker/host";
|
|
2
|
+
import { S as k, R as Y, C as ce, N as be } from "./importhub-client-fCWgKH03.js";
|
|
3
|
+
const _ = "user_stub_ada", ee = "user_stub_grace", te = "ws_stub_main", Me = "ws_stub_other";
|
|
4
|
+
function ke(r = te) {
|
|
5
5
|
return {
|
|
6
|
-
userId:
|
|
7
|
-
workspaceId:
|
|
8
|
-
members:
|
|
9
|
-
{ userId:
|
|
6
|
+
userId: _,
|
|
7
|
+
workspaceId: r,
|
|
8
|
+
members: he([
|
|
9
|
+
{ userId: _, displayName: "Ada Importer", email: "ada@example.com" },
|
|
10
|
+
{ userId: ee, 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 b = (r, c, l, u = []) => ({
|
|
15
|
+
accessor: r.split(".").pop() ?? r,
|
|
16
|
+
path: r,
|
|
17
|
+
fieldType: c,
|
|
18
|
+
label: l,
|
|
19
|
+
children: u
|
|
20
|
+
}), K = (r) => r.flatMap((c) => [c.path, ...K(c.children)]), le = (r) => [
|
|
21
|
+
b("titel", "text", "Titel"),
|
|
22
|
+
b("abkuerzung", "text", "Abkürzung"),
|
|
23
|
+
...r ? [b("fussnote", "rich_text", "Fußnote")] : [],
|
|
24
|
+
b("stand", "fieldset", "Stand", [
|
|
25
|
+
b("stand.datum", "date", "Datum"),
|
|
26
|
+
b("stand.art", "select", "Art")
|
|
26
27
|
])
|
|
27
|
-
],
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
], pe = () => [
|
|
29
|
+
b("fundstelle", "text", "Fundstelle"),
|
|
30
|
+
b("ausgabedatum", "date", "Ausgabedatum")
|
|
30
31
|
];
|
|
31
|
-
function
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
function ue() {
|
|
33
|
+
const r = le(!1), c = le(!0), l = [
|
|
34
|
+
b("aktenzeichen", "text", "Aktenzeichen"),
|
|
35
|
+
b("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: K(r),
|
|
44
|
+
fields: r,
|
|
45
|
+
releaseSpecFields: pe()
|
|
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: K(c),
|
|
53
|
+
fields: c,
|
|
54
|
+
releaseSpecFields: pe()
|
|
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: K(l),
|
|
62
|
+
fields: l
|
|
62
63
|
}
|
|
63
64
|
];
|
|
64
65
|
}
|
|
65
|
-
function
|
|
66
|
+
function _e() {
|
|
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 Ie() {
|
|
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 ye() {
|
|
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 Q = (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 Se() {
|
|
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
|
+
Q("from", "Element", !0, "The element's name now."),
|
|
170
|
+
Q("to", "New name", !0)
|
|
170
171
|
]
|
|
171
172
|
},
|
|
172
173
|
{
|
|
@@ -174,11 +175,153 @@ 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: [Q("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
|
+
}), P = (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: _,
|
|
217
|
+
phase: "ended",
|
|
218
|
+
failureReason: "",
|
|
219
|
+
progress: { done: 0, total: 0 },
|
|
220
|
+
counts: $(),
|
|
221
|
+
changeSetId: "",
|
|
222
|
+
releases: P(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, h) => ({
|
|
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: h
|
|
236
|
+
});
|
|
237
|
+
function Pe() {
|
|
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: ee,
|
|
252
|
+
releases: P(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
|
+
...P(2),
|
|
269
|
+
mappings: [
|
|
270
|
+
...P(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: P(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: P(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: ee,
|
|
316
|
+
counts: $({ matched: 12, created: 3 }),
|
|
317
|
+
releases: P(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
|
+
const we = [
|
|
182
325
|
"listImportProfiles",
|
|
183
326
|
"getImportProfile",
|
|
184
327
|
"createImportProfile",
|
|
@@ -200,82 +343,90 @@ const pe = [
|
|
|
200
343
|
"cutRelease",
|
|
201
344
|
"listHistory",
|
|
202
345
|
"compareRevisions",
|
|
203
|
-
"restoreRevision"
|
|
346
|
+
"restoreRevision",
|
|
347
|
+
"uploadSourceFile",
|
|
348
|
+
"startImport",
|
|
349
|
+
"listImports",
|
|
350
|
+
"getImport",
|
|
351
|
+
"cancelImport",
|
|
352
|
+
"listItemProblems"
|
|
204
353
|
];
|
|
205
|
-
let
|
|
206
|
-
const
|
|
207
|
-
const
|
|
208
|
-
id: `${
|
|
209
|
-
content: structuredClone(
|
|
210
|
-
savedBy:
|
|
211
|
-
savedAt:
|
|
354
|
+
let de = Date.parse("2026-11-02T08:00:00Z");
|
|
355
|
+
const w = () => (de += 36e5, new Date(de).toISOString()), X = (r = []) => r.map((c) => {
|
|
356
|
+
const l = Math.max(c.releaseNumber ?? 0, 1), u = Array.from({ length: l }, (I, p) => ({
|
|
357
|
+
id: `${c.id}_r${p + 1}`,
|
|
358
|
+
content: structuredClone(c.content),
|
|
359
|
+
savedBy: _,
|
|
360
|
+
savedAt: w(),
|
|
212
361
|
restoredFromRevisionId: ""
|
|
213
|
-
})),
|
|
214
|
-
id: `${
|
|
362
|
+
})), h = Array.from({ length: c.releaseNumber ?? 0 }, (I, p) => ({
|
|
363
|
+
id: `${c.id}_rel${p + 1}`,
|
|
215
364
|
number: p + 1,
|
|
216
|
-
revisionId: `${
|
|
217
|
-
releasedBy:
|
|
218
|
-
releasedAt:
|
|
365
|
+
revisionId: `${c.id}_r${p + 1}`,
|
|
366
|
+
releasedBy: _,
|
|
367
|
+
releasedAt: w()
|
|
219
368
|
}));
|
|
220
|
-
return { id:
|
|
221
|
-
}),
|
|
222
|
-
const
|
|
369
|
+
return { id: c.id, content: structuredClone(c.content), revisions: u, releases: h };
|
|
370
|
+
}), N = (r) => r.revisions[r.revisions.length - 1], fe = (r) => r.releases[r.releases.length - 1], D = (r) => {
|
|
371
|
+
const c = fe(r), l = r.revisions.find((u) => u.id === c?.revisionId);
|
|
223
372
|
return {
|
|
224
|
-
draftRevisionId:
|
|
373
|
+
draftRevisionId: N(r).id,
|
|
225
374
|
// By content, as importhub compares: a draft that restored the
|
|
226
375
|
// released content does not differ.
|
|
227
|
-
draftDiffersFromRelease: !
|
|
228
|
-
...
|
|
376
|
+
draftDiffersFromRelease: !l || JSON.stringify(l.content) !== JSON.stringify(N(r).content),
|
|
377
|
+
...c ? { latestRelease: { id: c.id, number: c.number } } : {}
|
|
229
378
|
};
|
|
230
|
-
},
|
|
231
|
-
Object.entries(
|
|
232
|
-
),
|
|
233
|
-
valid:
|
|
234
|
-
reasons:
|
|
235
|
-
}),
|
|
236
|
-
let
|
|
237
|
-
function
|
|
238
|
-
const
|
|
379
|
+
}, ve = (r) => r.replace(/[A-Z]/g, (c) => `_${c.toLowerCase()}`), me = (r) => Object.fromEntries(
|
|
380
|
+
Object.entries(r).map(([c, l]) => [ve(c), l])
|
|
381
|
+
), R = (r) => ({
|
|
382
|
+
valid: r.length === 0,
|
|
383
|
+
reasons: r
|
|
384
|
+
}), j = (r) => [...r].sort((c, l) => c.content.name.localeCompare(l.content.name));
|
|
385
|
+
let Te = 0;
|
|
386
|
+
function Be(r = {}) {
|
|
387
|
+
const c = Object.fromEntries(
|
|
239
388
|
Object.entries(
|
|
240
|
-
|
|
241
|
-
[
|
|
242
|
-
importProfiles:
|
|
243
|
-
mappings:
|
|
244
|
-
entitySets:
|
|
389
|
+
r.workspaces ?? {
|
|
390
|
+
[te]: {
|
|
391
|
+
importProfiles: ye(),
|
|
392
|
+
mappings: _e(),
|
|
393
|
+
entitySets: Ie(),
|
|
394
|
+
imports: Pe()
|
|
245
395
|
}
|
|
246
396
|
}
|
|
247
397
|
).map(([e, t]) => [
|
|
248
398
|
e,
|
|
249
399
|
{
|
|
250
|
-
importProfiles:
|
|
251
|
-
mappings:
|
|
252
|
-
entitySets:
|
|
400
|
+
importProfiles: X(t.importProfiles),
|
|
401
|
+
mappings: X(t.mappings),
|
|
402
|
+
entitySets: X(t.entitySets),
|
|
403
|
+
imports: structuredClone(t.imports ?? [])
|
|
253
404
|
}
|
|
254
405
|
])
|
|
255
|
-
),
|
|
256
|
-
let
|
|
257
|
-
const I = Object.fromEntries(
|
|
258
|
-
if (I[e]++,
|
|
406
|
+
), l = r.processors ?? Se(), u = r.blueprintReleases ?? ue();
|
|
407
|
+
let h = r.activeWorkspaceId ?? te;
|
|
408
|
+
const I = Object.fromEntries(we.map((e) => [e, 0])), p = () => (c[h] ??= { importProfiles: [], mappings: [], entitySets: [], imports: [] }, c[h]), f = async (e, t) => {
|
|
409
|
+
if (I[e]++, r.fail) throw r.fail;
|
|
259
410
|
return structuredClone(t());
|
|
260
411
|
}, g = (e, t, s) => {
|
|
261
|
-
const n = e.find((
|
|
412
|
+
const n = e.find((a) => a.id === t);
|
|
262
413
|
if (!n) throw new Error(`${s} ${t} not found`);
|
|
263
414
|
return n;
|
|
264
415
|
}, v = (e, t, s) => {
|
|
265
416
|
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 (
|
|
417
|
+
if (e.some((n) => n.id !== s && n.content.name === t)) throw new be();
|
|
418
|
+
}, ne = (e, t) => t !== "" && t !== N(e).id, O = (e, t, s, n = "") => {
|
|
419
|
+
if (ne(e, s))
|
|
269
420
|
throw new Error("the draft moved: somebody saved in between");
|
|
270
421
|
e.content = structuredClone(t), e.revisions.push({
|
|
271
422
|
id: `${e.id}_r${e.revisions.length + 1}`,
|
|
272
423
|
content: structuredClone(t),
|
|
273
|
-
savedBy:
|
|
274
|
-
savedAt:
|
|
424
|
+
savedBy: _,
|
|
425
|
+
savedAt: w(),
|
|
275
426
|
restoredFromRevisionId: n
|
|
276
427
|
});
|
|
277
|
-
},
|
|
278
|
-
const s =
|
|
428
|
+
}, q = (e, t) => {
|
|
429
|
+
const s = H(e);
|
|
279
430
|
return {
|
|
280
431
|
id: s,
|
|
281
432
|
content: structuredClone(t),
|
|
@@ -283,16 +434,16 @@ function _e(i = {}) {
|
|
|
283
434
|
{
|
|
284
435
|
id: `${s}_r1`,
|
|
285
436
|
content: structuredClone(t),
|
|
286
|
-
savedBy:
|
|
287
|
-
savedAt:
|
|
437
|
+
savedBy: _,
|
|
438
|
+
savedAt: w(),
|
|
288
439
|
restoredFromRevisionId: ""
|
|
289
440
|
}
|
|
290
441
|
],
|
|
291
442
|
releases: []
|
|
292
443
|
};
|
|
293
444
|
};
|
|
294
|
-
function
|
|
295
|
-
const t = [], s =
|
|
445
|
+
function G(e) {
|
|
446
|
+
const t = [], s = u.find((o) => o.id === e.blueprintReleaseId);
|
|
296
447
|
e.blueprintReleaseId ? s ? s.blueprintId !== e.blueprintId && t.push({
|
|
297
448
|
path: "/blueprintReleaseId",
|
|
298
449
|
code: "release_of_other_blueprint",
|
|
@@ -310,85 +461,85 @@ function _e(i = {}) {
|
|
|
310
461
|
code: "no_element_selector",
|
|
311
462
|
message: "It has no element selector."
|
|
312
463
|
}), !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
|
|
464
|
+
const n = (o, i) => {
|
|
465
|
+
typeof i == "string" && i !== "" && !Re(i) && t.push({ path: o, code: "invalid_xpath", message: `"${i}" is not an XPath.` });
|
|
315
466
|
};
|
|
316
467
|
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:
|
|
468
|
+
const a = [];
|
|
469
|
+
return (e.fields ?? []).forEach((o, i) => {
|
|
470
|
+
const m = `/fields/${i}`;
|
|
471
|
+
for (const { path: d, rel: M, mapping: S } of se(o, "", m))
|
|
472
|
+
a.push(d), n(`${M}/selector`, S.selector), s && !s.fieldPaths.includes(d) && t.push({
|
|
473
|
+
path: m,
|
|
323
474
|
code: "unknown_field_path",
|
|
324
|
-
message: `The pinned Release has no field ${
|
|
325
|
-
}),
|
|
326
|
-
path:
|
|
475
|
+
message: `The pinned Release has no field ${d}.`
|
|
476
|
+
}), S.type === "select" && !S.selectOptions && t.push({
|
|
477
|
+
path: m,
|
|
327
478
|
code: "xmlmapper_schema",
|
|
328
|
-
message: `The select field ${
|
|
479
|
+
message: `The select field ${d} has no select options.`
|
|
329
480
|
});
|
|
330
|
-
}), (e.versionMatch?.contentFields ?? []).forEach((
|
|
331
|
-
|
|
332
|
-
path: `/version_match/content_fields/${
|
|
481
|
+
}), (e.versionMatch?.contentFields ?? []).forEach((o, i) => {
|
|
482
|
+
a.includes(o) || t.push({
|
|
483
|
+
path: `/version_match/content_fields/${i}`,
|
|
333
484
|
code: "unknown_version_match_field",
|
|
334
|
-
message: `The Version Match compares ${
|
|
485
|
+
message: `The Version Match compares ${o}, which the Mapping does not map.`
|
|
335
486
|
});
|
|
336
|
-
}), (e.titleContributions ?? []).forEach((
|
|
337
|
-
(!
|
|
338
|
-
path: `/title_contributions/${
|
|
487
|
+
}), (e.titleContributions ?? []).forEach((o, i) => {
|
|
488
|
+
(!o.selector || !o.ausgabeCodeSelector) && t.push({
|
|
489
|
+
path: `/title_contributions/${i}`,
|
|
339
490
|
code: "incomplete_title_contribution",
|
|
340
491
|
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/${
|
|
492
|
+
}), n(`/title_contributions/${i}/selector`, o.selector);
|
|
493
|
+
}), (e.placeholderAssets ?? []).forEach((o, i) => {
|
|
494
|
+
(!o.selector || !o.assetType || !o.keyParts?.length || !o.nameSelector) && t.push({
|
|
495
|
+
path: `/placeholder_assets/${i}`,
|
|
345
496
|
code: "incomplete_placeholder_assets",
|
|
346
497
|
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/${
|
|
498
|
+
}), n(`/placeholder_assets/${i}/selector`, o.selector), (o.keyParts ?? []).forEach((m, d) => {
|
|
499
|
+
n(`/placeholder_assets/${i}/key_parts/${d}`, m);
|
|
349
500
|
});
|
|
350
501
|
}), t;
|
|
351
502
|
}
|
|
352
|
-
function
|
|
353
|
-
return e.flatMap((n,
|
|
354
|
-
const
|
|
355
|
-
return
|
|
503
|
+
function re(e, t, s) {
|
|
504
|
+
return e.flatMap((n, a) => {
|
|
505
|
+
const o = `/${t}/${a}`, i = l.find((d) => d.name === n.processor);
|
|
506
|
+
return i ? i.target !== "source_file" ? [
|
|
356
507
|
{
|
|
357
|
-
path:
|
|
508
|
+
path: o,
|
|
358
509
|
code: "rich_text_processor",
|
|
359
|
-
message: `${
|
|
510
|
+
message: `${i.name} is configured on a rich-text field, not on a Profile.`
|
|
360
511
|
}
|
|
361
|
-
] :
|
|
362
|
-
(
|
|
363
|
-
).map((
|
|
364
|
-
path: `${
|
|
512
|
+
] : i.kind !== s ? [{ path: o, code: "wrong_processor_kind", message: `${i.name} does not run here.` }] : i.settingsSpec.filter(
|
|
513
|
+
(d) => d.config.required && (n.settings[d.config.api_accessor] ?? "") === ""
|
|
514
|
+
).map((d) => ({
|
|
515
|
+
path: `${o}/settings/${d.config.api_accessor}`,
|
|
365
516
|
code: "invalid_processor_settings",
|
|
366
|
-
message: `${
|
|
517
|
+
message: `${i.name}: ${d.config.api_accessor} is required.`
|
|
367
518
|
})) : [
|
|
368
|
-
{ path:
|
|
519
|
+
{ path: o, code: "unknown_processor", message: `No Processor is called ${n.processor}.` }
|
|
369
520
|
];
|
|
370
521
|
});
|
|
371
522
|
}
|
|
372
|
-
function
|
|
523
|
+
function J(e) {
|
|
373
524
|
const t = p(), s = [
|
|
374
|
-
...
|
|
375
|
-
...
|
|
525
|
+
...re(e.preprocessors, "preprocessors", "preprocessor"),
|
|
526
|
+
...re(e.postProcessors, "postProcessors", "post_processor")
|
|
376
527
|
];
|
|
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 (!
|
|
528
|
+
return e.mappingIds.length === 0 && s.push({ path: "/mappingIds", code: "no_mappings", message: "It includes no Mapping." }), e.mappingIds.forEach((n, a) => {
|
|
529
|
+
const o = t.mappings.find((m) => m.id === n);
|
|
530
|
+
if (!o) {
|
|
380
531
|
s.push({
|
|
381
|
-
path: `/mappingIds/${
|
|
532
|
+
path: `/mappingIds/${a}`,
|
|
382
533
|
code: "mapping_missing",
|
|
383
534
|
message: "It includes a Mapping that does not exist."
|
|
384
535
|
});
|
|
385
536
|
return;
|
|
386
537
|
}
|
|
387
|
-
const
|
|
388
|
-
|
|
389
|
-
path: `/mappingIds/${
|
|
538
|
+
const i = G(o.content);
|
|
539
|
+
i.length > 0 && s.push({
|
|
540
|
+
path: `/mappingIds/${a}`,
|
|
390
541
|
code: "mapping_invalid",
|
|
391
|
-
message: `The Mapping ${
|
|
542
|
+
message: `The Mapping ${o.content.name} is invalid: ${i.map((m) => m.message).join(" ")}`
|
|
392
543
|
});
|
|
393
544
|
}), e.entitySetId && !t.entitySets.some((n) => n.id === e.entitySetId) && s.push({
|
|
394
545
|
path: "/entitySetId",
|
|
@@ -396,241 +547,368 @@ function _e(i = {}) {
|
|
|
396
547
|
message: "It names an Entity Set that does not exist."
|
|
397
548
|
}), s;
|
|
398
549
|
}
|
|
399
|
-
const
|
|
550
|
+
const oe = (e) => Object.keys(e.entities).length === 0 ? [{ path: "/entities", code: "no_entities", message: "It defines no entity." }] : [], F = (e) => ({
|
|
400
551
|
id: e.id,
|
|
401
552
|
content: e.content,
|
|
402
|
-
validity:
|
|
403
|
-
state:
|
|
404
|
-
}),
|
|
553
|
+
validity: R(J(e.content)),
|
|
554
|
+
state: D(e)
|
|
555
|
+
}), z = (e) => ({
|
|
405
556
|
id: e.id,
|
|
406
557
|
content: e.content,
|
|
407
|
-
validity:
|
|
408
|
-
state:
|
|
409
|
-
}),
|
|
558
|
+
validity: R(G(e.content)),
|
|
559
|
+
state: D(e)
|
|
560
|
+
}), C = (e) => ({
|
|
410
561
|
id: e.id,
|
|
411
562
|
content: e.content,
|
|
412
|
-
validity:
|
|
413
|
-
state:
|
|
414
|
-
}), A = (e) =>
|
|
563
|
+
validity: R(oe(e.content)),
|
|
564
|
+
state: D(e)
|
|
565
|
+
}), A = (e) => j(p().importProfiles.filter((t) => e(t.content))).map((t) => ({
|
|
415
566
|
id: t.id,
|
|
416
567
|
name: t.content.name
|
|
417
|
-
})),
|
|
568
|
+
})), H = (e) => `${e}_stub_new_${++Te}`, E = (e) => {
|
|
418
569
|
const t = p();
|
|
419
570
|
switch (e) {
|
|
420
571
|
case "importProfile":
|
|
421
572
|
return {
|
|
422
573
|
items: t.importProfiles,
|
|
423
574
|
name: "Import Profile",
|
|
424
|
-
reasons: (s) =>
|
|
575
|
+
reasons: (s) => J(s)
|
|
425
576
|
};
|
|
426
577
|
case "mapping":
|
|
427
578
|
return {
|
|
428
579
|
items: t.mappings,
|
|
429
580
|
name: "Mapping",
|
|
430
|
-
reasons: (s) =>
|
|
581
|
+
reasons: (s) => G(s)
|
|
431
582
|
};
|
|
432
583
|
case "entitySet":
|
|
433
584
|
return {
|
|
434
585
|
items: t.entitySets,
|
|
435
586
|
name: "Entity Set",
|
|
436
|
-
reasons: (s) =>
|
|
587
|
+
reasons: (s) => oe(s)
|
|
437
588
|
};
|
|
438
589
|
}
|
|
439
|
-
},
|
|
440
|
-
|
|
441
|
-
},
|
|
590
|
+
}, y = (e, t) => {
|
|
591
|
+
N(t).validity = R(E(e).reasons(t.content));
|
|
592
|
+
}, L = (e, t) => {
|
|
442
593
|
const s = e.revisions.find((n) => n.id === t);
|
|
443
594
|
if (!s) throw new Error(`Revision ${t} not found`);
|
|
444
595
|
return s;
|
|
596
|
+
}, ie = /* @__PURE__ */ new Set(), ae = r.contenthubRights ?? ["editor", "publisher"], x = (e) => {
|
|
597
|
+
const t = p().imports.find((s) => s.id === e);
|
|
598
|
+
if (!t) throw new Error(`Import ${e} not found`);
|
|
599
|
+
return t;
|
|
600
|
+
}, U = (e) => {
|
|
601
|
+
e.cancelledBy && e.phase !== "ended" && (e.phase = "ended", e.outcome = "cancelled", e.endTime = w());
|
|
602
|
+
}, Z = ({ itemProblems: e, ...t }) => t, W = (e, t) => {
|
|
603
|
+
const s = fe(e);
|
|
604
|
+
if (!s)
|
|
605
|
+
throw new k(`the ${t} ${e.content.name} has no Release yet`);
|
|
606
|
+
const n = e.revisions.find((a) => a.id === s.revisionId)?.content ?? e.content;
|
|
607
|
+
return {
|
|
608
|
+
content: n,
|
|
609
|
+
ref: {
|
|
610
|
+
configurationId: e.id,
|
|
611
|
+
name: n.name,
|
|
612
|
+
releaseId: s.id,
|
|
613
|
+
number: s.number
|
|
614
|
+
}
|
|
615
|
+
};
|
|
445
616
|
};
|
|
446
617
|
return {
|
|
447
618
|
calls: I,
|
|
448
619
|
switchWorkspace(e) {
|
|
449
|
-
|
|
620
|
+
h = e;
|
|
621
|
+
},
|
|
622
|
+
updateImport(e, t) {
|
|
623
|
+
Object.assign(x(e), structuredClone(t));
|
|
450
624
|
},
|
|
451
|
-
listImportProfiles: () =>
|
|
452
|
-
getImportProfile: (e) =>
|
|
453
|
-
createImportProfile: (e) =>
|
|
625
|
+
listImportProfiles: () => f("listImportProfiles", () => j(p().importProfiles).map(F)),
|
|
626
|
+
getImportProfile: (e) => f("getImportProfile", () => F(g(p().importProfiles, e, "Import Profile"))),
|
|
627
|
+
createImportProfile: (e) => f("createImportProfile", () => {
|
|
454
628
|
v(p().importProfiles, e.name);
|
|
455
|
-
const t =
|
|
456
|
-
return
|
|
629
|
+
const t = q("ip", e);
|
|
630
|
+
return y("importProfile", t), p().importProfiles.push(t), F(t);
|
|
457
631
|
}),
|
|
458
|
-
updateImportProfile: (e, t, s) =>
|
|
632
|
+
updateImportProfile: (e, t, s) => f("updateImportProfile", () => {
|
|
459
633
|
const n = g(p().importProfiles, e, "Import Profile");
|
|
460
|
-
return v(p().importProfiles, t.name, e),
|
|
634
|
+
return v(p().importProfiles, t.name, e), O(n, t, s), y("importProfile", n), F(n);
|
|
461
635
|
}),
|
|
462
|
-
deleteImportProfile: (e) =>
|
|
636
|
+
deleteImportProfile: (e) => f("deleteImportProfile", () => {
|
|
463
637
|
g(p().importProfiles, e, "Import Profile"), p().importProfiles = p().importProfiles.filter((t) => t.id !== e);
|
|
464
638
|
}),
|
|
465
|
-
listProcessors: () =>
|
|
466
|
-
listMappings: () =>
|
|
467
|
-
getMapping: (e) =>
|
|
468
|
-
createMapping: (e) =>
|
|
639
|
+
listProcessors: () => f("listProcessors", () => [...l].sort((e, t) => e.name.localeCompare(t.name))),
|
|
640
|
+
listMappings: () => f("listMappings", () => j(p().mappings).map(z)),
|
|
641
|
+
getMapping: (e) => f("getMapping", () => z(g(p().mappings, e, "Mapping"))),
|
|
642
|
+
createMapping: (e) => f("createMapping", () => {
|
|
469
643
|
v(p().mappings, e.name);
|
|
470
|
-
const t =
|
|
471
|
-
return
|
|
644
|
+
const t = q("mp", e);
|
|
645
|
+
return y("mapping", t), p().mappings.push(t), z(t);
|
|
472
646
|
}),
|
|
473
|
-
updateMapping: (e, t, s) =>
|
|
647
|
+
updateMapping: (e, t, s) => f("updateMapping", () => {
|
|
474
648
|
const n = g(p().mappings, e, "Mapping");
|
|
475
|
-
return v(p().mappings, t.name, e),
|
|
649
|
+
return v(p().mappings, t.name, e), O(n, t, s), y("mapping", n), z(n);
|
|
476
650
|
}),
|
|
477
|
-
deleteMapping: (e) =>
|
|
651
|
+
deleteMapping: (e) => f("deleteMapping", () => {
|
|
478
652
|
g(p().mappings, e, "Mapping");
|
|
479
653
|
const t = A((s) => s.mappingIds.includes(e));
|
|
480
654
|
if (t.length > 0)
|
|
481
|
-
throw new
|
|
655
|
+
throw new ce(
|
|
482
656
|
t,
|
|
483
657
|
`the Mapping is included by ${t.map((s) => s.name).join(", ")}`
|
|
484
658
|
);
|
|
485
659
|
p().mappings = p().mappings.filter((s) => s.id !== e);
|
|
486
660
|
}),
|
|
487
|
-
listMappingImportProfiles: (e) =>
|
|
488
|
-
checkMappingBlueprintRelease: (e, t) =>
|
|
489
|
-
const s = g(p().mappings, e, "Mapping"), n =
|
|
661
|
+
listMappingImportProfiles: (e) => f("listMappingImportProfiles", () => (g(p().mappings, e, "Mapping"), A((t) => t.mappingIds.includes(e)))),
|
|
662
|
+
checkMappingBlueprintRelease: (e, t) => f("checkMappingBlueprintRelease", () => {
|
|
663
|
+
const s = g(p().mappings, e, "Mapping"), n = u.find((a) => a.id === t);
|
|
490
664
|
if (!n) throw new Error(`Blueprint Release ${t} not found`);
|
|
491
665
|
if (n.blueprintId !== s.content.blueprintId)
|
|
492
666
|
throw new Error("the Release is of another Blueprint");
|
|
493
667
|
return {
|
|
494
668
|
blueprintId: n.blueprintId,
|
|
495
|
-
missingFieldPaths: (s.content.fields ?? []).flatMap((
|
|
669
|
+
missingFieldPaths: (s.content.fields ?? []).flatMap((a, o) => se(a, "", `/fields/${o}`).map((i) => i.path)).filter((a) => !n.fieldPaths.includes(a)),
|
|
496
670
|
missingReleaseSpecFields: [
|
|
497
|
-
...(s.content.releaseSpec ?? []).map((
|
|
671
|
+
...(s.content.releaseSpec ?? []).map((a) => a.field ?? ""),
|
|
498
672
|
...s.content.versionMatch?.releaseSpecFields ?? []
|
|
499
673
|
].filter(
|
|
500
|
-
(
|
|
674
|
+
(a, o, i) => a !== "" && i.indexOf(a) === o && !(n.releaseSpecFields ?? []).some((m) => m.path === a)
|
|
501
675
|
)
|
|
502
676
|
};
|
|
503
677
|
}),
|
|
504
|
-
listEntitySets: () =>
|
|
505
|
-
getEntitySet: (e) =>
|
|
506
|
-
createEntitySet: (e) =>
|
|
678
|
+
listEntitySets: () => f("listEntitySets", () => j(p().entitySets).map(C)),
|
|
679
|
+
getEntitySet: (e) => f("getEntitySet", () => C(g(p().entitySets, e, "Entity Set"))),
|
|
680
|
+
createEntitySet: (e) => f("createEntitySet", () => {
|
|
507
681
|
v(p().entitySets, e.name);
|
|
508
|
-
const t =
|
|
509
|
-
return
|
|
682
|
+
const t = q("es", e);
|
|
683
|
+
return y("entitySet", t), p().entitySets.push(t), C(t);
|
|
510
684
|
}),
|
|
511
|
-
updateEntitySet: (e, t, s) =>
|
|
685
|
+
updateEntitySet: (e, t, s) => f("updateEntitySet", () => {
|
|
512
686
|
const n = g(p().entitySets, e, "Entity Set");
|
|
513
|
-
return v(p().entitySets, t.name, e),
|
|
687
|
+
return v(p().entitySets, t.name, e), O(n, t, s), y("entitySet", n), C(n);
|
|
514
688
|
}),
|
|
515
|
-
deleteEntitySet: (e) =>
|
|
689
|
+
deleteEntitySet: (e) => f("deleteEntitySet", () => {
|
|
516
690
|
g(p().entitySets, e, "Entity Set");
|
|
517
691
|
const t = A((s) => s.entitySetId === e);
|
|
518
692
|
if (t.length > 0)
|
|
519
|
-
throw new
|
|
693
|
+
throw new ce(
|
|
520
694
|
t,
|
|
521
695
|
`the Entity Set is named by ${t.map((s) => s.name).join(", ")}`
|
|
522
696
|
);
|
|
523
697
|
p().entitySets = p().entitySets.filter((s) => s.id !== e);
|
|
524
698
|
}),
|
|
525
|
-
cutRelease: (e, t, s) =>
|
|
526
|
-
const n =
|
|
527
|
-
if (
|
|
528
|
-
throw new
|
|
529
|
-
const
|
|
530
|
-
if (!
|
|
531
|
-
if (!
|
|
532
|
-
throw new
|
|
699
|
+
cutRelease: (e, t, s) => f("cutRelease", () => {
|
|
700
|
+
const n = E(e), a = g(n.items, t, n.name);
|
|
701
|
+
if (ne(a, s))
|
|
702
|
+
throw new Y("the draft moved: somebody saved in between");
|
|
703
|
+
const o = R(n.reasons(a.content));
|
|
704
|
+
if (!o.valid) throw new Y("the draft is invalid", o);
|
|
705
|
+
if (!D(a).draftDiffersFromRelease)
|
|
706
|
+
throw new Y(
|
|
533
707
|
"the draft does not differ from the latest Release: there is nothing to release"
|
|
534
708
|
);
|
|
535
|
-
const
|
|
536
|
-
id: `${
|
|
537
|
-
number:
|
|
538
|
-
revisionId:
|
|
539
|
-
releasedBy:
|
|
540
|
-
releasedAt:
|
|
709
|
+
const i = a.releases.length + 1, m = {
|
|
710
|
+
id: `${a.id}_rel${i}`,
|
|
711
|
+
number: i,
|
|
712
|
+
revisionId: N(a).id,
|
|
713
|
+
releasedBy: _,
|
|
714
|
+
releasedAt: w()
|
|
541
715
|
};
|
|
542
|
-
return
|
|
543
|
-
release:
|
|
544
|
-
importProfiles: e === "mapping" ? A((
|
|
716
|
+
return a.releases.push(m), {
|
|
717
|
+
release: m,
|
|
718
|
+
importProfiles: e === "mapping" ? A((d) => d.mappingIds.includes(t)) : []
|
|
545
719
|
};
|
|
546
720
|
}),
|
|
547
|
-
listHistory: (e, t, s) =>
|
|
548
|
-
const n =
|
|
721
|
+
listHistory: (e, t, s) => f("listHistory", () => {
|
|
722
|
+
const n = E(e), a = g(n.items, t, n.name), o = [...a.revisions].reverse(), i = Number(s || "0");
|
|
549
723
|
return {
|
|
550
|
-
revisions:
|
|
551
|
-
id:
|
|
552
|
-
savedBy:
|
|
553
|
-
savedAt:
|
|
554
|
-
validity:
|
|
555
|
-
restoredFromRevisionId:
|
|
724
|
+
revisions: o.slice(i, i + 10).map((d) => ({
|
|
725
|
+
id: d.id,
|
|
726
|
+
savedBy: d.savedBy,
|
|
727
|
+
savedAt: d.savedAt,
|
|
728
|
+
validity: d.validity ?? R(n.reasons(d.content)),
|
|
729
|
+
restoredFromRevisionId: d.restoredFromRevisionId
|
|
556
730
|
})),
|
|
557
|
-
releases: [...
|
|
558
|
-
nextPageToken:
|
|
731
|
+
releases: [...a.releases].reverse(),
|
|
732
|
+
nextPageToken: i + 10 < o.length ? String(i + 10) : ""
|
|
559
733
|
};
|
|
560
734
|
}),
|
|
561
|
-
compareRevisions: (e, t, s, n) =>
|
|
562
|
-
const
|
|
563
|
-
const
|
|
564
|
-
return { field:
|
|
735
|
+
compareRevisions: (e, t, s, n) => f("compareRevisions", () => {
|
|
736
|
+
const a = E(e), o = g(a.items, t, a.name), i = me(L(o, s).content), m = me(L(o, n).content), d = [.../* @__PURE__ */ new Set([...Object.keys(i), ...Object.keys(m)])].map((M) => {
|
|
737
|
+
const S = i[M], V = m[M], ge = S === void 0 && V !== void 0 ? "added" : S !== void 0 && V === void 0 ? "removed" : JSON.stringify(S) === JSON.stringify(V) ? "unchanged" : "changed";
|
|
738
|
+
return { field: M, status: ge };
|
|
565
739
|
});
|
|
566
740
|
return {
|
|
567
|
-
from: { revisionId: s, content:
|
|
568
|
-
to: { revisionId: n, content:
|
|
569
|
-
fields:
|
|
741
|
+
from: { revisionId: s, content: i },
|
|
742
|
+
to: { revisionId: n, content: m },
|
|
743
|
+
fields: d
|
|
744
|
+
};
|
|
745
|
+
}),
|
|
746
|
+
restoreRevision: (e, t, s, n) => f("restoreRevision", () => {
|
|
747
|
+
const a = E(e), o = g(a.items, t, a.name);
|
|
748
|
+
O(o, L(o, s).content, n, s), y(e, o);
|
|
749
|
+
}),
|
|
750
|
+
async uploadSourceFile(e, t) {
|
|
751
|
+
if (I.uploadSourceFile++, r.fail) throw r.fail;
|
|
752
|
+
for (const n of [0.25, 0.5, 0.75])
|
|
753
|
+
await new Promise((a) => setTimeout(a, 20)), t(n);
|
|
754
|
+
if (r.uploadFails) throw r.uploadFails;
|
|
755
|
+
t(1);
|
|
756
|
+
const s = H("sf");
|
|
757
|
+
return ie.add(s), { id: s, fileName: e.name };
|
|
758
|
+
},
|
|
759
|
+
startImport: (e) => f("startImport", () => {
|
|
760
|
+
const t = p(), s = g(t.importProfiles, e.importProfileId, "Import Profile");
|
|
761
|
+
if (!ie.has(e.sourceFileId))
|
|
762
|
+
throw new k("nothing was uploaded to the Source File");
|
|
763
|
+
if (!ae.includes("editor"))
|
|
764
|
+
throw new k(
|
|
765
|
+
"starting an Import needs contenthub editor in the workspace"
|
|
766
|
+
);
|
|
767
|
+
const n = W(s, "Import Profile");
|
|
768
|
+
if (n.content.autoPublish && !ae.includes("publisher"))
|
|
769
|
+
throw new k(
|
|
770
|
+
"the Import Profile has Auto-publish, which needs contenthub publisher"
|
|
771
|
+
);
|
|
772
|
+
const a = J(n.content);
|
|
773
|
+
if (a.length > 0)
|
|
774
|
+
throw new k(
|
|
775
|
+
`the Import Profile ${n.ref.name} is invalid: ${a.map((d) => d.message).join(" ")}`
|
|
776
|
+
);
|
|
777
|
+
const o = n.content.mappingIds.map(
|
|
778
|
+
(d) => W(g(t.mappings, d, "Mapping"), "Mapping").ref
|
|
779
|
+
), i = n.content.entitySetId ? W(g(t.entitySets, n.content.entitySetId, "Entity Set"), "Entity Set").ref : void 0, m = {
|
|
780
|
+
id: H("im"),
|
|
781
|
+
importProfileId: s.id,
|
|
782
|
+
importProfileName: n.ref.name,
|
|
783
|
+
sourceFileId: e.sourceFileId,
|
|
784
|
+
startedBy: _,
|
|
785
|
+
phase: "queued",
|
|
786
|
+
failureReason: "",
|
|
787
|
+
progress: { done: 0, total: 0 },
|
|
788
|
+
counts: {
|
|
789
|
+
matched: 0,
|
|
790
|
+
created: 0,
|
|
791
|
+
problems: 0,
|
|
792
|
+
planned: 0,
|
|
793
|
+
corrected: 0,
|
|
794
|
+
kept: 0,
|
|
795
|
+
unchanged: 0
|
|
796
|
+
},
|
|
797
|
+
changeSetId: "",
|
|
798
|
+
releases: {
|
|
799
|
+
importProfile: n.ref,
|
|
800
|
+
mappings: o,
|
|
801
|
+
...i ? { entitySet: i } : {}
|
|
802
|
+
},
|
|
803
|
+
createTime: w(),
|
|
804
|
+
startTime: "",
|
|
805
|
+
endTime: "",
|
|
806
|
+
cancelledBy: "",
|
|
807
|
+
effectiveDate: e.effectiveDate ?? "",
|
|
808
|
+
...e.source ? { source: e.source } : {},
|
|
809
|
+
itemProblems: []
|
|
810
|
+
};
|
|
811
|
+
return t.imports.unshift(m), Z(m);
|
|
812
|
+
}),
|
|
813
|
+
listImports: (e) => f("listImports", () => {
|
|
814
|
+
const t = p().imports;
|
|
815
|
+
t.forEach(U);
|
|
816
|
+
const s = Number(e || "0");
|
|
817
|
+
return {
|
|
818
|
+
imports: t.slice(s, s + 50).map(Z),
|
|
819
|
+
nextPageToken: s + 50 < t.length ? String(s + 50) : ""
|
|
570
820
|
};
|
|
571
821
|
}),
|
|
572
|
-
|
|
573
|
-
const
|
|
574
|
-
|
|
822
|
+
getImport: (e) => f("getImport", () => {
|
|
823
|
+
const t = x(e);
|
|
824
|
+
return U(t), Z(t);
|
|
825
|
+
}),
|
|
826
|
+
cancelImport: (e) => f("cancelImport", () => {
|
|
827
|
+
const t = x(e);
|
|
828
|
+
if (t.phase === "ended") throw new Error("the Import has ended");
|
|
829
|
+
return t.cancelledBy ||= _, t.phase === "queued" && U(t), Z(t);
|
|
830
|
+
}),
|
|
831
|
+
listItemProblems: (e, t) => f("listItemProblems", () => {
|
|
832
|
+
const s = x(e).itemProblems ?? [], n = t.sourceKeyQuery.toLowerCase(), a = s.filter(
|
|
833
|
+
(m) => (!t.mappingId || m.mappingId === t.mappingId) && m.sourceKey.toLowerCase().includes(n)
|
|
834
|
+
), o = /* @__PURE__ */ new Map();
|
|
835
|
+
for (const m of s) {
|
|
836
|
+
const d = o.get(m.mappingId) ?? {
|
|
837
|
+
mappingId: m.mappingId,
|
|
838
|
+
mappingName: m.mappingName,
|
|
839
|
+
count: 0
|
|
840
|
+
};
|
|
841
|
+
d.count++, o.set(m.mappingId, d);
|
|
842
|
+
}
|
|
843
|
+
const i = Number(t.pageToken || "0");
|
|
844
|
+
return {
|
|
845
|
+
itemProblems: a.slice(i, i + 50),
|
|
846
|
+
totalCount: s.length,
|
|
847
|
+
matchingCount: a.length,
|
|
848
|
+
mappings: [...o.values()].sort((m, d) => m.mappingName.localeCompare(d.mappingName)),
|
|
849
|
+
nextPageToken: i + 50 < a.length ? String(i + 50) : ""
|
|
850
|
+
};
|
|
575
851
|
})
|
|
576
852
|
};
|
|
577
853
|
}
|
|
578
|
-
function
|
|
579
|
-
const
|
|
580
|
-
for (const
|
|
581
|
-
if (
|
|
582
|
-
else if (
|
|
583
|
-
return
|
|
854
|
+
function Re(r) {
|
|
855
|
+
const c = [], l = { "]": "[", ")": "(" };
|
|
856
|
+
for (const u of r)
|
|
857
|
+
if (u === "[" || u === "(") c.push(u);
|
|
858
|
+
else if (u in l && c.pop() !== l[u]) return !1;
|
|
859
|
+
return c.length === 0;
|
|
584
860
|
}
|
|
585
|
-
function
|
|
586
|
-
const
|
|
861
|
+
function se(r, c, l) {
|
|
862
|
+
const u = `${c}${String(r.name ?? "")}`;
|
|
587
863
|
return [
|
|
588
|
-
{ path:
|
|
864
|
+
{ path: u, rel: l, mapping: r },
|
|
589
865
|
...["fields", "virtualTableFields"].flatMap(
|
|
590
|
-
(
|
|
591
|
-
(I, p) =>
|
|
866
|
+
(h) => (Array.isArray(r[h]) ? r[h] : []).flatMap(
|
|
867
|
+
(I, p) => se(I, `${u}.`, `${l}/${h}/${p}`)
|
|
592
868
|
)
|
|
593
869
|
)
|
|
594
870
|
];
|
|
595
871
|
}
|
|
596
|
-
function
|
|
872
|
+
function Ne(r = ue()) {
|
|
597
873
|
return {
|
|
598
874
|
async listBlueprints() {
|
|
599
|
-
return [...new Map(
|
|
875
|
+
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
876
|
},
|
|
601
|
-
async listReleases(
|
|
602
|
-
return
|
|
877
|
+
async listReleases(c) {
|
|
878
|
+
return r.filter((l) => l.blueprintId === c).map((l) => ({ id: l.id, label: l.label }));
|
|
603
879
|
},
|
|
604
|
-
async getRelease(
|
|
605
|
-
const
|
|
606
|
-
if (!
|
|
880
|
+
async getRelease(c) {
|
|
881
|
+
const l = r.find((u) => u.id === c);
|
|
882
|
+
if (!l) throw new Error(`Blueprint Release ${c} not found`);
|
|
607
883
|
return {
|
|
608
|
-
id:
|
|
609
|
-
blueprintId:
|
|
610
|
-
name:
|
|
611
|
-
fields:
|
|
612
|
-
accessor:
|
|
613
|
-
path:
|
|
884
|
+
id: l.id,
|
|
885
|
+
blueprintId: l.blueprintId,
|
|
886
|
+
name: l.label,
|
|
887
|
+
fields: l.fields ?? l.fieldPaths.map((u) => ({
|
|
888
|
+
accessor: u,
|
|
889
|
+
path: u,
|
|
614
890
|
fieldType: "text",
|
|
615
891
|
label: "",
|
|
616
892
|
children: []
|
|
617
893
|
})),
|
|
618
|
-
releaseSpecFields:
|
|
894
|
+
releaseSpecFields: l.releaseSpecFields ?? []
|
|
619
895
|
};
|
|
620
896
|
}
|
|
621
897
|
};
|
|
622
898
|
}
|
|
623
899
|
export {
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
900
|
+
ee as STUB_OTHER_USER_ID,
|
|
901
|
+
Me as STUB_OTHER_WORKSPACE_ID,
|
|
902
|
+
_ as STUB_USER_ID,
|
|
903
|
+
te as STUB_WORKSPACE_ID,
|
|
904
|
+
Ne as createStubBlueprints,
|
|
905
|
+
Be as createStubImporthubClient,
|
|
906
|
+
ue as stubBlueprintReleases,
|
|
907
|
+
Ie as stubEntitySets,
|
|
908
|
+
ke as stubIdentity,
|
|
909
|
+
ye as stubImportProfiles,
|
|
910
|
+
Pe as stubImports,
|
|
911
|
+
_e as stubMappings,
|
|
912
|
+
Se as stubProcessors
|
|
635
913
|
};
|
|
636
914
|
//# sourceMappingURL=testing.js.map
|