@knkcs/importhub-ui 0.2.0 → 0.3.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 +3 -2
- package/dist/importhub-client-CrS-3Zuu.js +23 -0
- package/dist/importhub-client-CrS-3Zuu.js.map +1 -0
- package/dist/index.d.ts +257 -2
- package/dist/index.js +1473 -781
- package/dist/index.js.map +1 -1
- package/dist/testing.d.ts +74 -0
- package/dist/testing.js +289 -178
- package/dist/testing.js.map +1 -1
- package/package.json +1 -1
- package/dist/importhub-client-CYqd7Eeq.js +0 -16
- package/dist/importhub-client-CYqd7Eeq.js.map +0 -1
package/dist/testing.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { createHostMembers as
|
|
2
|
-
import { C as
|
|
3
|
-
const
|
|
4
|
-
function
|
|
1
|
+
import { createHostMembers as X } from "@knkcs/anker/host";
|
|
2
|
+
import { R as j, C as J, N as Y } from "./importhub-client-CrS-3Zuu.js";
|
|
3
|
+
const b = "user_stub_ada", D = "ws_stub_main", ce = "ws_stub_other";
|
|
4
|
+
function me(r = D) {
|
|
5
5
|
return {
|
|
6
|
-
userId:
|
|
6
|
+
userId: b,
|
|
7
7
|
workspaceId: r,
|
|
8
|
-
members:
|
|
9
|
-
{ userId:
|
|
8
|
+
members: X([
|
|
9
|
+
{ userId: b, displayName: "Ada Importer", email: "ada@example.com" }
|
|
10
10
|
])
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function Z() {
|
|
14
14
|
return [
|
|
15
15
|
{
|
|
16
16
|
id: "br_stub_gesetz_2",
|
|
@@ -35,7 +35,7 @@ function x() {
|
|
|
35
35
|
}
|
|
36
36
|
];
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function ee() {
|
|
39
39
|
return [
|
|
40
40
|
{
|
|
41
41
|
id: "mp_stub_norm",
|
|
@@ -67,7 +67,7 @@ function U() {
|
|
|
67
67
|
}
|
|
68
68
|
];
|
|
69
69
|
}
|
|
70
|
-
function
|
|
70
|
+
function te() {
|
|
71
71
|
return [
|
|
72
72
|
{
|
|
73
73
|
id: "es_stub_latin1",
|
|
@@ -80,7 +80,7 @@ function D() {
|
|
|
80
80
|
}
|
|
81
81
|
];
|
|
82
82
|
}
|
|
83
|
-
function
|
|
83
|
+
function se() {
|
|
84
84
|
return [
|
|
85
85
|
{
|
|
86
86
|
id: "ip_stub_gesetz",
|
|
@@ -111,12 +111,12 @@ function W() {
|
|
|
111
111
|
}
|
|
112
112
|
];
|
|
113
113
|
}
|
|
114
|
-
const
|
|
114
|
+
const F = (r, a, p, f = "") => ({
|
|
115
115
|
field_type: "text",
|
|
116
|
-
config: { name:
|
|
116
|
+
config: { name: a, api_accessor: r, required: p, instructions: f },
|
|
117
117
|
system: !1
|
|
118
118
|
});
|
|
119
|
-
function
|
|
119
|
+
function ne() {
|
|
120
120
|
return [
|
|
121
121
|
{
|
|
122
122
|
name: "citation-links",
|
|
@@ -138,8 +138,8 @@ function L() {
|
|
|
138
138
|
target: "source_file",
|
|
139
139
|
description: "Renames every element of one name to another.",
|
|
140
140
|
settingsSpec: [
|
|
141
|
-
|
|
142
|
-
|
|
141
|
+
F("from", "Element", !0, "The element's name now."),
|
|
142
|
+
F("to", "New name", !0)
|
|
143
143
|
]
|
|
144
144
|
},
|
|
145
145
|
{
|
|
@@ -147,11 +147,11 @@ function L() {
|
|
|
147
147
|
kind: "preprocessor",
|
|
148
148
|
target: "source_file",
|
|
149
149
|
description: "Wraps each sentence of an element in its own element.",
|
|
150
|
-
settingsSpec: [
|
|
150
|
+
settingsSpec: [F("element", "Element", !1)]
|
|
151
151
|
}
|
|
152
152
|
];
|
|
153
153
|
}
|
|
154
|
-
const
|
|
154
|
+
const ie = [
|
|
155
155
|
"listImportProfiles",
|
|
156
156
|
"getImportProfile",
|
|
157
157
|
"createImportProfile",
|
|
@@ -169,60 +169,104 @@ const q = [
|
|
|
169
169
|
"getEntitySet",
|
|
170
170
|
"createEntitySet",
|
|
171
171
|
"updateEntitySet",
|
|
172
|
-
"deleteEntitySet"
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
172
|
+
"deleteEntitySet",
|
|
173
|
+
"cutRelease",
|
|
174
|
+
"listHistory",
|
|
175
|
+
"compareRevisions",
|
|
176
|
+
"restoreRevision"
|
|
177
|
+
];
|
|
178
|
+
let q = Date.parse("2026-11-02T08:00:00Z");
|
|
179
|
+
const P = () => (q += 36e5, new Date(q).toISOString()), K = (r = []) => r.map((a) => {
|
|
180
|
+
const p = Math.max(a.releaseNumber ?? 0, 1), f = Array.from({ length: p }, (w, i) => ({
|
|
181
|
+
id: `${a.id}_r${i + 1}`,
|
|
182
|
+
content: structuredClone(a.content),
|
|
183
|
+
savedBy: b,
|
|
184
|
+
savedAt: P(),
|
|
185
|
+
restoredFromRevisionId: ""
|
|
186
|
+
})), I = Array.from({ length: a.releaseNumber ?? 0 }, (w, i) => ({
|
|
187
|
+
id: `${a.id}_rel${i + 1}`,
|
|
188
|
+
number: i + 1,
|
|
189
|
+
revisionId: `${a.id}_r${i + 1}`,
|
|
190
|
+
releasedBy: b,
|
|
191
|
+
releasedAt: P()
|
|
192
|
+
}));
|
|
193
|
+
return { id: a.id, content: structuredClone(a.content), revisions: f, releases: I };
|
|
194
|
+
}), v = (r) => r.revisions[r.revisions.length - 1], re = (r) => r.releases[r.releases.length - 1], O = (r) => {
|
|
195
|
+
const a = re(r), p = r.revisions.find((f) => f.id === a?.revisionId);
|
|
196
|
+
return {
|
|
197
|
+
draftRevisionId: v(r).id,
|
|
198
|
+
// By content, as importhub compares: a draft that restored the
|
|
199
|
+
// released content does not differ.
|
|
200
|
+
draftDiffersFromRelease: !p || JSON.stringify(p.content) !== JSON.stringify(v(r).content),
|
|
201
|
+
...a ? { latestRelease: { id: a.id, number: a.number } } : {}
|
|
202
|
+
};
|
|
203
|
+
}, oe = (r) => r.replace(/[A-Z]/g, (a) => `_${a.toLowerCase()}`), G = (r) => Object.fromEntries(
|
|
204
|
+
Object.entries(r).map(([a, p]) => [oe(a), p])
|
|
205
|
+
), y = (r) => ({
|
|
184
206
|
valid: r.length === 0,
|
|
185
207
|
reasons: r
|
|
186
|
-
}),
|
|
187
|
-
let
|
|
188
|
-
function
|
|
189
|
-
const
|
|
208
|
+
}), B = (r) => [...r].sort((a, p) => a.content.name.localeCompare(p.content.name));
|
|
209
|
+
let ae = 0;
|
|
210
|
+
function de(r = {}) {
|
|
211
|
+
const a = Object.fromEntries(
|
|
190
212
|
Object.entries(
|
|
191
213
|
r.workspaces ?? {
|
|
192
|
-
[
|
|
193
|
-
importProfiles:
|
|
194
|
-
mappings:
|
|
195
|
-
entitySets:
|
|
214
|
+
[D]: {
|
|
215
|
+
importProfiles: se(),
|
|
216
|
+
mappings: ee(),
|
|
217
|
+
entitySets: te()
|
|
196
218
|
}
|
|
197
219
|
}
|
|
198
220
|
).map(([e, t]) => [
|
|
199
221
|
e,
|
|
200
222
|
{
|
|
201
|
-
importProfiles:
|
|
202
|
-
mappings:
|
|
203
|
-
entitySets:
|
|
223
|
+
importProfiles: K(t.importProfiles),
|
|
224
|
+
mappings: K(t.mappings),
|
|
225
|
+
entitySets: K(t.entitySets)
|
|
204
226
|
}
|
|
205
227
|
])
|
|
206
|
-
),
|
|
207
|
-
let
|
|
208
|
-
const
|
|
209
|
-
if (
|
|
228
|
+
), p = r.processors ?? ne(), f = r.blueprintReleases ?? Z();
|
|
229
|
+
let I = r.activeWorkspaceId ?? D;
|
|
230
|
+
const w = Object.fromEntries(ie.map((e) => [e, 0])), i = () => (a[I] ??= { importProfiles: [], mappings: [], entitySets: [] }, a[I]), c = async (e, t) => {
|
|
231
|
+
if (w[e]++, r.fail) throw r.fail;
|
|
210
232
|
return structuredClone(t());
|
|
211
|
-
},
|
|
212
|
-
const
|
|
213
|
-
if (!
|
|
214
|
-
return
|
|
215
|
-
},
|
|
233
|
+
}, u = (e, t, s) => {
|
|
234
|
+
const n = e.find((o) => o.id === t);
|
|
235
|
+
if (!n) throw new Error(`${s} ${t} not found`);
|
|
236
|
+
return n;
|
|
237
|
+
}, _ = (e, t, s) => {
|
|
216
238
|
if (!t.trim()) throw new Error("a name is required");
|
|
217
|
-
if (e.some((
|
|
218
|
-
},
|
|
219
|
-
if (
|
|
239
|
+
if (e.some((n) => n.id !== s && n.content.name === t)) throw new Y();
|
|
240
|
+
}, H = (e, t) => t !== "" && t !== v(e).id, R = (e, t, s, n = "") => {
|
|
241
|
+
if (H(e, s))
|
|
220
242
|
throw new Error("the draft moved: somebody saved in between");
|
|
221
|
-
e.content = structuredClone(t), e.
|
|
243
|
+
e.content = structuredClone(t), e.revisions.push({
|
|
244
|
+
id: `${e.id}_r${e.revisions.length + 1}`,
|
|
245
|
+
content: structuredClone(t),
|
|
246
|
+
savedBy: b,
|
|
247
|
+
savedAt: P(),
|
|
248
|
+
restoredFromRevisionId: n
|
|
249
|
+
});
|
|
250
|
+
}, N = (e, t) => {
|
|
251
|
+
const s = V(e);
|
|
252
|
+
return {
|
|
253
|
+
id: s,
|
|
254
|
+
content: structuredClone(t),
|
|
255
|
+
revisions: [
|
|
256
|
+
{
|
|
257
|
+
id: `${s}_r1`,
|
|
258
|
+
content: structuredClone(t),
|
|
259
|
+
savedBy: b,
|
|
260
|
+
savedAt: P(),
|
|
261
|
+
restoredFromRevisionId: ""
|
|
262
|
+
}
|
|
263
|
+
],
|
|
264
|
+
releases: []
|
|
265
|
+
};
|
|
222
266
|
};
|
|
223
|
-
function
|
|
224
|
-
const t = [],
|
|
225
|
-
return e.blueprintReleaseId ?
|
|
267
|
+
function C(e) {
|
|
268
|
+
const t = [], s = f.find((n) => n.id === e.blueprintReleaseId);
|
|
269
|
+
return e.blueprintReleaseId ? s ? s.blueprintId !== e.blueprintId && t.push({
|
|
226
270
|
path: "/blueprintReleaseId",
|
|
227
271
|
code: "release_of_other_blueprint",
|
|
228
272
|
message: "The pinned Release is of another Blueprint."
|
|
@@ -238,190 +282,257 @@ function Q(r = {}) {
|
|
|
238
282
|
path: "/elementSelector",
|
|
239
283
|
code: "no_element_selector",
|
|
240
284
|
message: "It has no element selector."
|
|
241
|
-
}), !e.sourceKey?.selector && !e.sourceKey?.template && t.push({ path: "/sourceKey", code: "no_source_key", message: "It has no Source Key." }), (e.fields ?? []).forEach((
|
|
242
|
-
const
|
|
243
|
-
|
|
244
|
-
path: `/fields/${
|
|
285
|
+
}), !e.sourceKey?.selector && !e.sourceKey?.template && t.push({ path: "/sourceKey", code: "no_source_key", message: "It has no Source Key." }), (e.fields ?? []).forEach((n, o) => {
|
|
286
|
+
const l = String(n.name ?? "");
|
|
287
|
+
s && !s.fieldPaths.includes(l) && t.push({
|
|
288
|
+
path: `/fields/${o}`,
|
|
245
289
|
code: "unknown_field_path",
|
|
246
|
-
message: `The pinned Release has no field ${
|
|
290
|
+
message: `The pinned Release has no field ${l}.`
|
|
247
291
|
});
|
|
248
292
|
}), t;
|
|
249
293
|
}
|
|
250
|
-
function
|
|
251
|
-
return e.flatMap((
|
|
252
|
-
const
|
|
253
|
-
return
|
|
294
|
+
function U(e, t, s) {
|
|
295
|
+
return e.flatMap((n, o) => {
|
|
296
|
+
const l = `/${t}/${o}`, m = p.find((d) => d.name === n.processor);
|
|
297
|
+
return m ? m.target !== "source_file" ? [
|
|
254
298
|
{
|
|
255
|
-
path:
|
|
299
|
+
path: l,
|
|
256
300
|
code: "rich_text_processor",
|
|
257
|
-
message: `${
|
|
301
|
+
message: `${m.name} is configured on a rich-text field, not on a Profile.`
|
|
258
302
|
}
|
|
259
|
-
] :
|
|
260
|
-
(
|
|
261
|
-
).map((
|
|
262
|
-
path: `${
|
|
303
|
+
] : m.kind !== s ? [{ path: l, code: "wrong_processor_kind", message: `${m.name} does not run here.` }] : m.settingsSpec.filter(
|
|
304
|
+
(d) => d.config.required && (n.settings[d.config.api_accessor] ?? "") === ""
|
|
305
|
+
).map((d) => ({
|
|
306
|
+
path: `${l}/settings/${d.config.api_accessor}`,
|
|
263
307
|
code: "invalid_processor_settings",
|
|
264
|
-
message: `${
|
|
308
|
+
message: `${m.name}: ${d.config.api_accessor} is required.`
|
|
265
309
|
})) : [
|
|
266
|
-
{ path:
|
|
310
|
+
{ path: l, code: "unknown_processor", message: `No Processor is called ${n.processor}.` }
|
|
267
311
|
];
|
|
268
312
|
});
|
|
269
313
|
}
|
|
270
|
-
function
|
|
271
|
-
const t =
|
|
272
|
-
...
|
|
273
|
-
...
|
|
314
|
+
function L(e) {
|
|
315
|
+
const t = i(), s = [
|
|
316
|
+
...U(e.preprocessors, "preprocessors", "preprocessor"),
|
|
317
|
+
...U(e.postProcessors, "postProcessors", "post_processor")
|
|
274
318
|
];
|
|
275
|
-
return e.mappingIds.length === 0 &&
|
|
276
|
-
const
|
|
277
|
-
if (!
|
|
278
|
-
|
|
279
|
-
path: `/mappingIds/${
|
|
319
|
+
return e.mappingIds.length === 0 && s.push({ path: "/mappingIds", code: "no_mappings", message: "It includes no Mapping." }), e.mappingIds.forEach((n, o) => {
|
|
320
|
+
const l = t.mappings.find((g) => g.id === n);
|
|
321
|
+
if (!l) {
|
|
322
|
+
s.push({
|
|
323
|
+
path: `/mappingIds/${o}`,
|
|
280
324
|
code: "mapping_missing",
|
|
281
325
|
message: "It includes a Mapping that does not exist."
|
|
282
326
|
});
|
|
283
327
|
return;
|
|
284
328
|
}
|
|
285
|
-
const
|
|
286
|
-
|
|
287
|
-
path: `/mappingIds/${
|
|
329
|
+
const m = C(l.content);
|
|
330
|
+
m.length > 0 && s.push({
|
|
331
|
+
path: `/mappingIds/${o}`,
|
|
288
332
|
code: "mapping_invalid",
|
|
289
|
-
message: `The Mapping ${
|
|
333
|
+
message: `The Mapping ${l.content.name} is invalid: ${m.map((g) => g.message).join(" ")}`
|
|
290
334
|
});
|
|
291
|
-
}), e.entitySetId && !t.entitySets.some((
|
|
335
|
+
}), e.entitySetId && !t.entitySets.some((n) => n.id === e.entitySetId) && s.push({
|
|
292
336
|
path: "/entitySetId",
|
|
293
337
|
code: "entity_set_missing",
|
|
294
338
|
message: "It names an Entity Set that does not exist."
|
|
295
|
-
}),
|
|
339
|
+
}), s;
|
|
296
340
|
}
|
|
297
|
-
const
|
|
341
|
+
const W = (e) => Object.keys(e.entities).length === 0 ? [{ path: "/entities", code: "no_entities", message: "It defines no entity." }] : [], E = (e) => ({
|
|
298
342
|
id: e.id,
|
|
299
343
|
content: e.content,
|
|
300
|
-
validity:
|
|
301
|
-
state:
|
|
302
|
-
}),
|
|
344
|
+
validity: y(L(e.content)),
|
|
345
|
+
state: O(e)
|
|
346
|
+
}), M = (e) => ({
|
|
303
347
|
id: e.id,
|
|
304
348
|
content: e.content,
|
|
305
|
-
validity:
|
|
306
|
-
state:
|
|
307
|
-
}),
|
|
349
|
+
validity: y(C(e.content)),
|
|
350
|
+
state: O(e)
|
|
351
|
+
}), $ = (e) => ({
|
|
308
352
|
id: e.id,
|
|
309
353
|
content: e.content,
|
|
310
|
-
validity:
|
|
311
|
-
state:
|
|
312
|
-
}),
|
|
354
|
+
validity: y(W(e.content)),
|
|
355
|
+
state: O(e)
|
|
356
|
+
}), k = (e) => B(i().importProfiles.filter((t) => e(t.content))).map((t) => ({
|
|
313
357
|
id: t.id,
|
|
314
358
|
name: t.content.name
|
|
315
|
-
})),
|
|
359
|
+
})), V = (e) => `${e}_stub_new_${++ae}`, S = (e) => {
|
|
360
|
+
const t = i();
|
|
361
|
+
switch (e) {
|
|
362
|
+
case "importProfile":
|
|
363
|
+
return {
|
|
364
|
+
items: t.importProfiles,
|
|
365
|
+
name: "Import Profile",
|
|
366
|
+
reasons: (s) => L(s)
|
|
367
|
+
};
|
|
368
|
+
case "mapping":
|
|
369
|
+
return {
|
|
370
|
+
items: t.mappings,
|
|
371
|
+
name: "Mapping",
|
|
372
|
+
reasons: (s) => C(s)
|
|
373
|
+
};
|
|
374
|
+
case "entitySet":
|
|
375
|
+
return {
|
|
376
|
+
items: t.entitySets,
|
|
377
|
+
name: "Entity Set",
|
|
378
|
+
reasons: (s) => W(s)
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
}, h = (e, t) => {
|
|
382
|
+
v(t).validity = y(S(e).reasons(t.content));
|
|
383
|
+
}, x = (e, t) => {
|
|
384
|
+
const s = e.revisions.find((n) => n.id === t);
|
|
385
|
+
if (!s) throw new Error(`Revision ${t} not found`);
|
|
386
|
+
return s;
|
|
387
|
+
};
|
|
316
388
|
return {
|
|
317
|
-
calls:
|
|
389
|
+
calls: w,
|
|
318
390
|
switchWorkspace(e) {
|
|
319
|
-
|
|
391
|
+
I = e;
|
|
320
392
|
},
|
|
321
|
-
listImportProfiles: () =>
|
|
322
|
-
getImportProfile: (e) =>
|
|
323
|
-
createImportProfile: (e) =>
|
|
324
|
-
|
|
325
|
-
const t =
|
|
326
|
-
|
|
327
|
-
content: structuredClone(e),
|
|
328
|
-
revision: 1
|
|
329
|
-
};
|
|
330
|
-
return s().importProfiles.push(t), b(t);
|
|
393
|
+
listImportProfiles: () => c("listImportProfiles", () => B(i().importProfiles).map(E)),
|
|
394
|
+
getImportProfile: (e) => c("getImportProfile", () => E(u(i().importProfiles, e, "Import Profile"))),
|
|
395
|
+
createImportProfile: (e) => c("createImportProfile", () => {
|
|
396
|
+
_(i().importProfiles, e.name);
|
|
397
|
+
const t = N("ip", e);
|
|
398
|
+
return h("importProfile", t), i().importProfiles.push(t), E(t);
|
|
331
399
|
}),
|
|
332
|
-
updateImportProfile: (e, t,
|
|
333
|
-
const
|
|
334
|
-
return
|
|
400
|
+
updateImportProfile: (e, t, s) => c("updateImportProfile", () => {
|
|
401
|
+
const n = u(i().importProfiles, e, "Import Profile");
|
|
402
|
+
return _(i().importProfiles, t.name, e), R(n, t, s), h("importProfile", n), E(n);
|
|
335
403
|
}),
|
|
336
|
-
deleteImportProfile: (e) =>
|
|
337
|
-
|
|
404
|
+
deleteImportProfile: (e) => c("deleteImportProfile", () => {
|
|
405
|
+
u(i().importProfiles, e, "Import Profile"), i().importProfiles = i().importProfiles.filter((t) => t.id !== e);
|
|
338
406
|
}),
|
|
339
|
-
listProcessors: () =>
|
|
340
|
-
listMappings: () =>
|
|
341
|
-
getMapping: (e) =>
|
|
342
|
-
createMapping: (e) =>
|
|
343
|
-
|
|
344
|
-
const t =
|
|
345
|
-
|
|
346
|
-
content: structuredClone(e),
|
|
347
|
-
revision: 1
|
|
348
|
-
};
|
|
349
|
-
return s().mappings.push(t), h(t);
|
|
407
|
+
listProcessors: () => c("listProcessors", () => [...p].sort((e, t) => e.name.localeCompare(t.name))),
|
|
408
|
+
listMappings: () => c("listMappings", () => B(i().mappings).map(M)),
|
|
409
|
+
getMapping: (e) => c("getMapping", () => M(u(i().mappings, e, "Mapping"))),
|
|
410
|
+
createMapping: (e) => c("createMapping", () => {
|
|
411
|
+
_(i().mappings, e.name);
|
|
412
|
+
const t = N("mp", e);
|
|
413
|
+
return h("mapping", t), i().mappings.push(t), M(t);
|
|
350
414
|
}),
|
|
351
|
-
updateMapping: (e, t,
|
|
352
|
-
const
|
|
353
|
-
return
|
|
415
|
+
updateMapping: (e, t, s) => c("updateMapping", () => {
|
|
416
|
+
const n = u(i().mappings, e, "Mapping");
|
|
417
|
+
return _(i().mappings, t.name, e), R(n, t, s), h("mapping", n), M(n);
|
|
354
418
|
}),
|
|
355
|
-
deleteMapping: (e) =>
|
|
356
|
-
|
|
357
|
-
const t =
|
|
419
|
+
deleteMapping: (e) => c("deleteMapping", () => {
|
|
420
|
+
u(i().mappings, e, "Mapping");
|
|
421
|
+
const t = k((s) => s.mappingIds.includes(e));
|
|
358
422
|
if (t.length > 0)
|
|
359
|
-
throw new
|
|
423
|
+
throw new J(
|
|
360
424
|
t,
|
|
361
|
-
`the Mapping is included by ${t.map((
|
|
425
|
+
`the Mapping is included by ${t.map((s) => s.name).join(", ")}`
|
|
362
426
|
);
|
|
363
|
-
|
|
427
|
+
i().mappings = i().mappings.filter((s) => s.id !== e);
|
|
364
428
|
}),
|
|
365
|
-
listMappingImportProfiles: (e) =>
|
|
366
|
-
checkMappingBlueprintRelease: (e, t) =>
|
|
367
|
-
const
|
|
368
|
-
if (!
|
|
369
|
-
if (
|
|
429
|
+
listMappingImportProfiles: (e) => c("listMappingImportProfiles", () => (u(i().mappings, e, "Mapping"), k((t) => t.mappingIds.includes(e)))),
|
|
430
|
+
checkMappingBlueprintRelease: (e, t) => c("checkMappingBlueprintRelease", () => {
|
|
431
|
+
const s = u(i().mappings, e, "Mapping"), n = f.find((o) => o.id === t);
|
|
432
|
+
if (!n) throw new Error(`Blueprint Release ${t} not found`);
|
|
433
|
+
if (n.blueprintId !== s.content.blueprintId)
|
|
370
434
|
throw new Error("the Release is of another Blueprint");
|
|
371
435
|
return {
|
|
372
|
-
blueprintId:
|
|
373
|
-
missingFieldPaths: (
|
|
436
|
+
blueprintId: n.blueprintId,
|
|
437
|
+
missingFieldPaths: (s.content.fields ?? []).map((o) => String(o.name ?? "")).filter((o) => !n.fieldPaths.includes(o)),
|
|
374
438
|
missingReleaseSpecFields: []
|
|
375
439
|
};
|
|
376
440
|
}),
|
|
377
|
-
listEntitySets: () =>
|
|
378
|
-
getEntitySet: (e) =>
|
|
379
|
-
createEntitySet: (e) =>
|
|
380
|
-
|
|
381
|
-
const t =
|
|
382
|
-
|
|
383
|
-
content: structuredClone(e),
|
|
384
|
-
revision: 1
|
|
385
|
-
};
|
|
386
|
-
return s().entitySets.push(t), _(t);
|
|
441
|
+
listEntitySets: () => c("listEntitySets", () => B(i().entitySets).map($)),
|
|
442
|
+
getEntitySet: (e) => c("getEntitySet", () => $(u(i().entitySets, e, "Entity Set"))),
|
|
443
|
+
createEntitySet: (e) => c("createEntitySet", () => {
|
|
444
|
+
_(i().entitySets, e.name);
|
|
445
|
+
const t = N("es", e);
|
|
446
|
+
return h("entitySet", t), i().entitySets.push(t), $(t);
|
|
387
447
|
}),
|
|
388
|
-
updateEntitySet: (e, t,
|
|
389
|
-
const
|
|
390
|
-
return
|
|
448
|
+
updateEntitySet: (e, t, s) => c("updateEntitySet", () => {
|
|
449
|
+
const n = u(i().entitySets, e, "Entity Set");
|
|
450
|
+
return _(i().entitySets, t.name, e), R(n, t, s), h("entitySet", n), $(n);
|
|
391
451
|
}),
|
|
392
|
-
deleteEntitySet: (e) =>
|
|
393
|
-
|
|
394
|
-
const t =
|
|
452
|
+
deleteEntitySet: (e) => c("deleteEntitySet", () => {
|
|
453
|
+
u(i().entitySets, e, "Entity Set");
|
|
454
|
+
const t = k((s) => s.entitySetId === e);
|
|
395
455
|
if (t.length > 0)
|
|
396
|
-
throw new
|
|
456
|
+
throw new J(
|
|
397
457
|
t,
|
|
398
|
-
`the Entity Set is named by ${t.map((
|
|
458
|
+
`the Entity Set is named by ${t.map((s) => s.name).join(", ")}`
|
|
459
|
+
);
|
|
460
|
+
i().entitySets = i().entitySets.filter((s) => s.id !== e);
|
|
461
|
+
}),
|
|
462
|
+
cutRelease: (e, t, s) => c("cutRelease", () => {
|
|
463
|
+
const n = S(e), o = u(n.items, t, n.name);
|
|
464
|
+
if (H(o, s))
|
|
465
|
+
throw new j("the draft moved: somebody saved in between");
|
|
466
|
+
const l = y(n.reasons(o.content));
|
|
467
|
+
if (!l.valid) throw new j("the draft is invalid", l);
|
|
468
|
+
if (!O(o).draftDiffersFromRelease)
|
|
469
|
+
throw new j(
|
|
470
|
+
"the draft does not differ from the latest Release: there is nothing to release"
|
|
399
471
|
);
|
|
400
|
-
|
|
472
|
+
const m = o.releases.length + 1, g = {
|
|
473
|
+
id: `${o.id}_rel${m}`,
|
|
474
|
+
number: m,
|
|
475
|
+
revisionId: v(o).id,
|
|
476
|
+
releasedBy: b,
|
|
477
|
+
releasedAt: P()
|
|
478
|
+
};
|
|
479
|
+
return o.releases.push(g), {
|
|
480
|
+
release: g,
|
|
481
|
+
importProfiles: e === "mapping" ? k((d) => d.mappingIds.includes(t)) : []
|
|
482
|
+
};
|
|
483
|
+
}),
|
|
484
|
+
listHistory: (e, t, s) => c("listHistory", () => {
|
|
485
|
+
const n = S(e), o = u(n.items, t, n.name), l = [...o.revisions].reverse(), m = Number(s || "0");
|
|
486
|
+
return {
|
|
487
|
+
revisions: l.slice(m, m + 10).map((d) => ({
|
|
488
|
+
id: d.id,
|
|
489
|
+
savedBy: d.savedBy,
|
|
490
|
+
savedAt: d.savedAt,
|
|
491
|
+
validity: d.validity ?? y(n.reasons(d.content)),
|
|
492
|
+
restoredFromRevisionId: d.restoredFromRevisionId
|
|
493
|
+
})),
|
|
494
|
+
releases: [...o.releases].reverse(),
|
|
495
|
+
nextPageToken: m + 10 < l.length ? String(m + 10) : ""
|
|
496
|
+
};
|
|
497
|
+
}),
|
|
498
|
+
compareRevisions: (e, t, s, n) => c("compareRevisions", () => {
|
|
499
|
+
const o = S(e), l = u(o.items, t, o.name), m = G(x(l, s).content), g = G(x(l, n).content), d = [.../* @__PURE__ */ new Set([...Object.keys(m), ...Object.keys(g)])].map((z) => {
|
|
500
|
+
const A = m[z], T = g[z], Q = A === void 0 && T !== void 0 ? "added" : A !== void 0 && T === void 0 ? "removed" : JSON.stringify(A) === JSON.stringify(T) ? "unchanged" : "changed";
|
|
501
|
+
return { field: z, status: Q };
|
|
502
|
+
});
|
|
503
|
+
return {
|
|
504
|
+
from: { revisionId: s, content: m },
|
|
505
|
+
to: { revisionId: n, content: g },
|
|
506
|
+
fields: d
|
|
507
|
+
};
|
|
508
|
+
}),
|
|
509
|
+
restoreRevision: (e, t, s, n) => c("restoreRevision", () => {
|
|
510
|
+
const o = S(e), l = u(o.items, t, o.name);
|
|
511
|
+
R(l, x(l, s).content, n, s), h(e, l);
|
|
401
512
|
})
|
|
402
513
|
};
|
|
403
514
|
}
|
|
404
|
-
function
|
|
515
|
+
function ue(r = Z()) {
|
|
405
516
|
return {
|
|
406
517
|
async listBlueprints() {
|
|
407
|
-
return [...new Map(r.map((
|
|
518
|
+
return [...new Map(r.map((p) => [p.blueprintId, p.blueprintName]))].map(([p, f]) => ({ id: p, name: f })).sort((p, f) => p.name.localeCompare(f.name));
|
|
408
519
|
},
|
|
409
|
-
async listReleases(
|
|
410
|
-
return r.filter((
|
|
520
|
+
async listReleases(a) {
|
|
521
|
+
return r.filter((p) => p.blueprintId === a).map((p) => ({ id: p.id, label: p.label }));
|
|
411
522
|
}
|
|
412
523
|
};
|
|
413
524
|
}
|
|
414
525
|
export {
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
526
|
+
ce as STUB_OTHER_WORKSPACE_ID,
|
|
527
|
+
b as STUB_USER_ID,
|
|
528
|
+
D as STUB_WORKSPACE_ID,
|
|
529
|
+
ue as createStubBlueprints,
|
|
530
|
+
de as createStubImporthubClient,
|
|
531
|
+
Z as stubBlueprintReleases,
|
|
532
|
+
te as stubEntitySets,
|
|
533
|
+
me as stubIdentity,
|
|
534
|
+
se as stubImportProfiles,
|
|
535
|
+
ee as stubMappings,
|
|
536
|
+
ne as stubProcessors
|
|
426
537
|
};
|
|
427
538
|
//# sourceMappingURL=testing.js.map
|