@piveau/dpi 0.2.0-alpha.24 → 0.2.0-alpha.26

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.
Files changed (33) hide show
  1. package/dist/assets/dpi.css +1 -1
  2. package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/DPIHome.vue.js +43 -38
  3. package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/HomeTable.vue.js +23 -22
  4. package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/Organisation.vue.js +3 -3
  5. package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/Organisation.vue2.js +44 -40
  6. package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ResourceTable.vue.js +7 -0
  7. package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ResourceTable.vue2.js +206 -0
  8. package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ui/BasicInfosStep/ProjectOrganisationStep.vue.js +2 -2
  9. package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ui/BasicInfosStep/ProjectOrganisationStep.vue2.js +76 -62
  10. package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ui/DataCollection/BasicInformationStep.vue.js +2 -2
  11. package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ui/DataCollection/BasicInformationStep.vue2.js +2 -2
  12. package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ui/DataProcessing/BasicInformationStep.vue.js +1 -1
  13. package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ui/DataProcessing/BasicInformationStep.vue2.js +7 -7
  14. package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ui/Findability/ApplicationsStep.vue.js +2 -2
  15. package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ui/Findability/ApplicationsStep.vue2.js +97 -128
  16. package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ui/ProcessSteps/AreYouSureToSkipCard.vue.js +1 -1
  17. package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ui/ProcessSteps/DatasetStep.vue.js +1 -1
  18. package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ui/ProcessSteps/DatasetStep.vue2.js +35 -28
  19. package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ui/ProcessSteps/HardwareForm.vue.js +3 -3
  20. package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ui/ProcessSteps/HardwareForm.vue2.js +114 -111
  21. package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ui/ProcessSteps/HardwareStep.vue.js +2 -2
  22. package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ui/ProcessSteps/HardwareStep.vue2.js +59 -52
  23. package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ui/ProcessSteps/ProcessStepBase.vue.js +44 -33
  24. package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ui/ReviewStep/ReviewStep.vue.js +2 -2
  25. package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ui/ReviewStep/ReviewStep.vue2.js +7 -7
  26. package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ui/StateTag.vue.js +2 -2
  27. package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ui/TableRowV3.vue.js +83 -75
  28. package/dist/packages/dpi/src/data-provider-interface/composables/useTwinbyHome.js +14 -14
  29. package/dist/packages/dpi/src/data-provider-interface/composables/useTwinbyUser.js +86 -73
  30. package/dist/packages/dpi/src/data-provider-interface/views/InputPageProject.vue.js +320 -317
  31. package/package.json +1 -1
  32. package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ProjectTable.vue.js +0 -7
  33. package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ProjectTable.vue2.js +0 -143
@@ -1,16 +1,16 @@
1
- import { ref as p, computed as R, watch as K, createElementBlock as N, openBlock as d, Fragment as q, createElementVNode as n, createBlock as b, createCommentVNode as h, withKeys as m, normalizeClass as F, withModifiers as w, unref as o, toDisplayString as H, isRef as z } from "vue";
2
- import { setResourcePublicationStatus as B, setDatasetPublicationStatus as I, deleteResource as L, deleteDataset as J } from "@piveau/sdk-core/hubRepo";
3
- import { useRouter as O, useRoute as W } from "vue-router";
4
- import { useStore as G } from "vuex";
5
- import { useRuntimeEnv as Q } from "../../../composables/useRuntimeEnv.js";
6
- import { useDpiUtils as X } from "../../composables/useDpiUtils.js";
7
- import Y from "./Dropdown.vue.js";
8
- import Z from "./ModalSimpleV3.vue.js";
1
+ import { ref as p, computed as R, watch as q, createElementBlock as F, openBlock as d, Fragment as H, createElementVNode as o, createBlock as b, createCommentVNode as h, withKeys as m, normalizeClass as L, withModifiers as y, unref as n, toDisplayString as z, isRef as B } from "vue";
2
+ import { setResourcePublicationStatus as j, setDatasetPublicationStatus as I, deleteResource as J, deleteDataset as O } from "@piveau/sdk-core/hubRepo";
3
+ import { useRouter as W, useRoute as G } from "vue-router";
4
+ import { useStore as Q } from "vuex";
5
+ import { useRuntimeEnv as X } from "../../../composables/useRuntimeEnv.js";
6
+ import { useDpiUtils as Y } from "../../composables/useDpiUtils.js";
7
+ import Z from "./Dropdown.vue.js";
8
+ import ee from "./ModalSimpleV3.vue.js";
9
9
  import k from "./StateTag.vue.js";
10
- import ee from "./Toast.vue.js";
10
+ import te from "./Toast.vue.js";
11
11
  /* empty css */
12
- import te from "../../../../../../_virtual/_plugin-vue_export-helper.js";
13
- const ae = { class: "dpiV3_tableRowInner" }, le = { class: "dpiV3_TableRowDescContainer" }, oe = { class: "dpiV3_dsDesc" }, ne = { class: "dpiV3_TableRowStatus" }, se = { class: "dpiV3_TableRowStatus" }, ie = { class: "dpiV3_TableRowButtonWrap" }, re = {
12
+ import ae from "../../../../../../_virtual/_plugin-vue_export-helper.js";
13
+ const le = { class: "dpiV3_tableRowInner" }, ne = { class: "dpiV3_TableRowDescContainer" }, oe = { class: "dpiV3_dsDesc" }, se = { class: "dpiV3_TableRowStatus" }, ie = { class: "dpiV3_TableRowUpdated" }, re = { class: "dpiV3_TableRowStatus" }, ue = { class: "dpiV3_TableRowButtonWrap" }, de = {
14
14
  __name: "TableRowV3",
15
15
  props: {
16
16
  text: {
@@ -50,31 +50,35 @@ const ae = { class: "dpiV3_tableRowInner" }, le = { class: "dpiV3_TableRowDescCo
50
50
  allowDelete: {
51
51
  type: Boolean,
52
52
  default: !0
53
+ },
54
+ visibilityState: {
55
+ type: String,
56
+ default: "public"
53
57
  }
54
58
  },
55
59
  emits: ["complete", "start"],
56
- setup(y, { emit: j }) {
57
- const t = y, C = j, E = G();
58
- O();
59
- const U = W(), c = Q().api.hubUrl;
60
+ setup(w, { emit: _ }) {
61
+ const t = w, U = _, C = Q();
62
+ W();
63
+ const E = G(), c = X().api.hubUrl;
60
64
  let s = p(!1), i = p(!1), v = p(!1), r = p({}), u = p({});
61
65
  const D = R(() => {
62
66
  var a;
63
- return !!((a = U.query) != null && a.fromDraft);
67
+ return !!((a = E.query) != null && a.fromDraft);
64
68
  }), f = R(() => {
65
69
  var a, e;
66
- return (e = (a = E.getters) == null ? void 0 : a["auth/getUserData"]) == null ? void 0 : e.authToken;
67
- }), { toEditMode: P } = X();
68
- function _() {
70
+ return (e = (a = C.getters) == null ? void 0 : a["auth/getUserData"]) == null ? void 0 : e.authToken;
71
+ }), { toEditMode: A } = Y();
72
+ function P() {
69
73
  const a = t.draft || D.value, e = t.catalogue, l = t.id || t.dataset.id || t.catalogue.id;
70
- P({
71
- routeName: t.type === "project" ? "DataProviderInterface-InputProject" : "DataProviderInterface-Input",
74
+ A({
75
+ routeName: t.type === "projects" ? "DataProviderInterface-InputProject" : "DataProviderInterface-Input",
72
76
  id: l,
73
77
  catalogId: e,
74
78
  isDraft: a,
75
79
  locale: "de",
76
80
  additionalParams: {
77
- visibility: t.visibility
81
+ visibility: t.visibilityState
78
82
  }
79
83
  });
80
84
  }
@@ -83,12 +87,12 @@ const ae = { class: "dpiV3_tableRowInner" }, le = { class: "dpiV3_TableRowDescCo
83
87
  i.value = !1;
84
88
  }, 2e3);
85
89
  }
86
- K(i, (a) => {
90
+ q(i, (a) => {
87
91
  a && setTimeout(() => {
88
92
  v.value || (i.value = !1);
89
93
  }, 2e3);
90
94
  });
91
- function A() {
95
+ function M() {
92
96
  return t.draft ? [
93
97
  { "@value": "Ansehen", selected: !1, disabled: !1 },
94
98
  { "@value": "Bearbeiten", selected: !1, disabled: !t.allowEdit },
@@ -101,14 +105,14 @@ const ae = { class: "dpiV3_tableRowInner" }, le = { class: "dpiV3_TableRowDescCo
101
105
  { "@value": "Löschen", selected: !1, disabled: !t.allowDelete }
102
106
  ];
103
107
  }
104
- async function M(a, e) {
108
+ async function K(a, e) {
105
109
  switch (a) {
106
110
  case "goToDataset":
107
- window.open(`/${t.type === "project" ? "projects" : t.type}/${t.id}`, "_blank");
111
+ window.open(`/${t.type === "projects" ? "projects" : t.type}/${t.id}`, "_blank");
108
112
  break;
109
113
  case "publishDataset":
110
- if (e("start"), t.type === "project") {
111
- B({
114
+ if (e("start"), t.type === "projects") {
115
+ j({
112
116
  baseUrl: c,
113
117
  id: t.id,
114
118
  type: "project",
@@ -134,8 +138,8 @@ const ae = { class: "dpiV3_tableRowInner" }, le = { class: "dpiV3_TableRowDescCo
134
138
  }, e("complete");
135
139
  break;
136
140
  case "deleteDataset":
137
- if (e("start"), t.type === "project") {
138
- await L({
141
+ if (e("start"), t.type === "projects") {
142
+ await J({
139
143
  baseUrl: c,
140
144
  id: t.id,
141
145
  type: "project",
@@ -144,7 +148,7 @@ const ae = { class: "dpiV3_tableRowInner" }, le = { class: "dpiV3_TableRowDescCo
144
148
  }), e("complete");
145
149
  break;
146
150
  }
147
- await J({
151
+ await O({
148
152
  baseUrl: c,
149
153
  id: t.id,
150
154
  catalogId: t.catalogue,
@@ -157,8 +161,8 @@ const ae = { class: "dpiV3_tableRowInner" }, le = { class: "dpiV3_TableRowDescCo
157
161
  }, e("complete");
158
162
  break;
159
163
  case "setToDraft":
160
- if (e("start"), t.type === "project") {
161
- B({
164
+ if (e("start"), t.type === "projects") {
165
+ j({
162
166
  baseUrl: c,
163
167
  id: t.id,
164
168
  type: "project",
@@ -184,14 +188,17 @@ const ae = { class: "dpiV3_tableRowInner" }, le = { class: "dpiV3_TableRowDescCo
184
188
  }, e("complete");
185
189
  }
186
190
  }
187
- function T(a) {
191
+ function N(a, e) {
192
+ return `/${a === "projects" ? "projects" : a}/${e}`;
193
+ }
194
+ function S(a) {
188
195
  let e = "";
189
196
  switch (typeof a == "string" ? e = a : e = a.target.innerText, e) {
190
197
  case "Ansehen":
191
- window.location.href = `/${t.type}/${t.id}`;
198
+ window.open(N(t.type, t.id), "_blank");
192
199
  break;
193
200
  case "Bearbeiten":
194
- _();
201
+ P();
195
202
  break;
196
203
  case "Veröffentlichen":
197
204
  r.value = {
@@ -220,7 +227,7 @@ const ae = { class: "dpiV3_tableRowInner" }, le = { class: "dpiV3_TableRowDescCo
220
227
  }
221
228
  }
222
229
  let g = p(!1);
223
- function S(a, e) {
230
+ function T(a, e) {
224
231
  e ? g.value = !0 : g.value = !1;
225
232
  }
226
233
  function V(a) {
@@ -229,32 +236,32 @@ const ae = { class: "dpiV3_tableRowInner" }, le = { class: "dpiV3_TableRowDescCo
229
236
  function x(a) {
230
237
  a.target.className != "dpiV3_more-button dpiV3_activeState" && (g.value = !1);
231
238
  }
232
- return (a, e) => (d(), N(q, null, [
233
- n("button", {
234
- class: F(["dpiV3_tableRowWrapper", {
235
- dpiV3_pressedTableRow: o(g),
239
+ return (a, e) => (d(), F(H, null, [
240
+ o("button", {
241
+ class: L(["dpiV3_tableRowWrapper", {
242
+ dpiV3_pressedTableRow: n(g),
236
243
  tRowInDraft: t.fromDraft
237
244
  }]),
238
245
  onKeydown: [
239
- e[3] || (e[3] = m(w((l) => V(l), ["prevent"]), ["space"])),
240
- e[4] || (e[4] = m(w((l) => V(l), ["prevent"]), ["enter"]))
246
+ e[3] || (e[3] = m(y((l) => V(l), ["prevent"]), ["space"])),
247
+ e[4] || (e[4] = m(y((l) => V(l), ["prevent"]), ["enter"]))
241
248
  ],
242
249
  onKeyup: [
243
250
  e[5] || (e[5] = m((l) => x(l), ["space"])),
244
251
  e[6] || (e[6] = m((l) => x(l), ["enter"]))
245
252
  ]
246
253
  }, [
247
- n("div", ae, [
248
- n("div", {
254
+ o("div", le, [
255
+ o("div", {
249
256
  class: "dpiV3_tableRowContent",
250
- onMousedown: e[0] || (e[0] = w((l) => S(l, !0), ["prevent"])),
251
- onMouseup: e[1] || (e[1] = w((l) => S(l, !1), ["prevent"])),
252
- onClick: e[2] || (e[2] = (l) => T("Bearbeiten"))
257
+ onMousedown: e[0] || (e[0] = y((l) => T(l, !0), ["prevent"])),
258
+ onMouseup: e[1] || (e[1] = y((l) => T(l, !1), ["prevent"])),
259
+ onClick: e[2] || (e[2] = (l) => S("Ansehen"))
253
260
  }, [
254
- n("div", le, [
255
- n("span", oe, H(t.text), 1)
261
+ o("div", ne, [
262
+ o("span", oe, z(t.text), 1)
256
263
  ]),
257
- n("div", ne, [
264
+ o("div", se, [
258
265
  t.draft ? (d(), b(k, {
259
266
  key: 1,
260
267
  label: "Entwurf",
@@ -263,19 +270,20 @@ const ae = { class: "dpiV3_tableRowInner" }, le = { class: "dpiV3_TableRowDescCo
263
270
  key: 0,
264
271
  label: "Freigegeben",
265
272
  state: "published"
266
- }))
273
+ })),
274
+ o("span", ie, " Bearbeitet am: " + z(t.date), 1)
267
275
  ]),
268
- n("div", se, [
269
- y.visibility ? (d(), b(k, {
276
+ o("div", re, [
277
+ w.visibility ? (d(), b(k, {
270
278
  key: 0,
271
- label: y.visibility,
272
- state: t.draft ? "draft" : "published",
279
+ label: w.visibility,
280
+ state: t.draft ? "visibility-draft" : "visibility-published",
273
281
  "has-dot-icon": !1
274
282
  }, null, 8, ["label", "state"])) : h("", !0)
275
283
  ])
276
284
  ], 32),
277
- n("div", ie, [
278
- D.value ? h("", !0) : (d(), b(Y, {
285
+ o("div", ue, [
286
+ D.value ? h("", !0) : (d(), b(Z, {
279
287
  key: 0,
280
288
  type: "moreButton",
281
289
  "not-draft": !D.value,
@@ -283,34 +291,34 @@ const ae = { class: "dpiV3_tableRowInner" }, le = { class: "dpiV3_TableRowDescCo
283
291
  text: {
284
292
  support: "This is a supporting message"
285
293
  },
286
- data: A(),
287
- onClick: T
294
+ data: M(),
295
+ onClick: S
288
296
  }, null, 8, ["not-draft", "data"]))
289
297
  ])
290
298
  ])
291
299
  ], 34),
292
- o(s) ? (d(), b(Z, {
300
+ n(s) ? (d(), b(ee, {
293
301
  key: 0,
294
- buttons: o(r).button,
295
- "header-text": o(r).header,
296
- text: o(r).text,
297
- action: o(r).action,
298
- onClose: e[7] || (e[7] = (l) => z(s) ? s.value = !1 : s = !1),
299
- onActionHandling: e[8] || (e[8] = (l) => M(l, C))
302
+ buttons: n(r).button,
303
+ "header-text": n(r).header,
304
+ text: n(r).text,
305
+ action: n(r).action,
306
+ onClose: e[7] || (e[7] = (l) => B(s) ? s.value = !1 : s = !1),
307
+ onActionHandling: e[8] || (e[8] = (l) => K(l, U))
300
308
  }, null, 8, ["buttons", "header-text", "text", "action"])) : h("", !0),
301
- o(i) ? (d(), b(ee, {
309
+ n(i) ? (d(), b(te, {
302
310
  key: 1,
303
- type: o(u).type,
304
- text: o(u).text,
311
+ type: n(u).type,
312
+ text: n(u).text,
305
313
  class: "dpiV3_tableToast",
306
- button: o(u).button,
307
- action: o(u).action,
308
- onMouseenter: e[9] || (e[9] = (l) => z(v) ? v.value = !0 : v = !0),
314
+ button: n(u).button,
315
+ action: n(u).action,
316
+ onMouseenter: e[9] || (e[9] = (l) => B(v) ? v.value = !0 : v = !0),
309
317
  onMouseleave: $
310
318
  }, null, 8, ["type", "text", "button", "action"])) : h("", !0)
311
319
  ], 64));
312
320
  }
313
- }, ke = /* @__PURE__ */ te(re, [["__scopeId", "data-v-bcba9c89"]]);
321
+ }, Te = /* @__PURE__ */ ae(de, [["__scopeId", "data-v-e19eb221"]]);
314
322
  export {
315
- ke as default
323
+ Te as default
316
324
  };
@@ -1,8 +1,8 @@
1
1
  import { schemaDataset as D } from "@piveau/sdk-core";
2
- import { defineHubSearch as P, dcatApDataset as x, getTranslationFor as _ } from "@piveau/sdk-vue";
2
+ import { defineHubSearch as C, dcatApDataset as x, getTranslationFor as _ } from "@piveau/sdk-vue";
3
3
  import * as s from "zod";
4
4
  import { schemaProject as v } from "../../utils/schema/schemaProject.js";
5
- const d = s.object({
5
+ const P = s.object({
6
6
  accessControlPermissions: s.array(s.enum(["view", "edit", "publish", "delete"])).optional(),
7
7
  catalog_record: s.object({
8
8
  modified: s.string().optional(),
@@ -12,16 +12,16 @@ const d = s.object({
12
12
  })
13
13
  });
14
14
  function y(f) {
15
- const g = "project", a = P(
15
+ const h = "project", a = C(
16
16
  {
17
17
  baseUrl: f,
18
18
  index: "resource",
19
19
  indexDetails: "resources/project",
20
- schema: v.extend(d.shape),
21
- facets: ["theme"]
20
+ schema: v.extend(P.shape),
21
+ facets: ["superCatalog"]
22
22
  },
23
23
  (i, b) => {
24
- var l, o, e, u, c, m, r, h;
24
+ var l, o, e, u, c, m, r, g;
25
25
  const { currentLocale: n } = b;
26
26
  return {
27
27
  ...{
@@ -37,24 +37,24 @@ function y(f) {
37
37
  accessLevel: (c = i == null ? void 0 : i.catalog_record) == null ? void 0 : c.access_level,
38
38
  publicationStatus: (m = i == null ? void 0 : i.catalog_record) == null ? void 0 : m.publication_status,
39
39
  catalogId: (r = i == null ? void 0 : i.catalog) == null ? void 0 : r.id,
40
- superCatalogId: (h = i == null ? void 0 : i.catalog) == null ? void 0 : h.is_part_of
40
+ superCatalogId: (g = i == null ? void 0 : i.catalog) == null ? void 0 : g.is_part_of
41
41
  }
42
42
  };
43
43
  }
44
44
  );
45
45
  return {
46
- resource: g,
46
+ resource: h,
47
47
  ...a
48
48
  };
49
49
  }
50
50
  function E(f) {
51
- const g = "dataset", a = P({
51
+ const h = "dataset", a = C({
52
52
  baseUrl: f,
53
- index: g,
53
+ index: h,
54
54
  indexDetails: "datasets",
55
- schema: D.extend(d.shape)
55
+ schema: D.extend(P.shape)
56
56
  }, (i, b) => {
57
- var l, o, e, u, c, m, r, h;
57
+ var l, o, e, u, c, m, r, g;
58
58
  const n = x().setup(i, b);
59
59
  return {
60
60
  id: n.getId,
@@ -69,11 +69,11 @@ function E(f) {
69
69
  accessLevel: (c = i == null ? void 0 : i.catalog_record) == null ? void 0 : c.access_level,
70
70
  publicationStatus: (m = i == null ? void 0 : i.catalog_record) == null ? void 0 : m.publication_status,
71
71
  catalogId: (r = i == null ? void 0 : i.catalog) == null ? void 0 : r.id,
72
- superCatalogId: (h = i == null ? void 0 : i.catalog) == null ? void 0 : h.is_part_of
72
+ superCatalogId: (g = i == null ? void 0 : i.catalog) == null ? void 0 : g.is_part_of
73
73
  };
74
74
  });
75
75
  return {
76
- resource: g,
76
+ resource: h,
77
77
  ...a
78
78
  };
79
79
  }
@@ -1,46 +1,59 @@
1
- import { defineHubSearch as $, getTranslationFor as A } from "@piveau/sdk-vue";
2
- import { createGlobalState as j, useAsyncState as B } from "@vueuse/core";
3
- import E from "axios";
4
- import F from "qs";
5
- import { computed as o, toValue as d, watch as D, onBeforeUnmount as q, ref as V } from "vue";
6
- import { useStore as G } from "vuex";
7
- import H from "zod";
8
- import { useRuntimeEnv as I } from "../../composables/useRuntimeEnv.js";
9
- const N = j(() => {
10
- const u = V([]), t = o(() => {
11
- var a;
12
- return ((a = u.value.find((s) => s.rsname.endsWith("-orga"))) == null ? void 0 : a.rsname) || "";
13
- }), p = o(() => t.value ? t.value.replace("-orga", "-projects") : ""), m = o(() => t.value ? t.value.replace("-orga", "-datasets") : ""), i = o(() => {
1
+ import { defineHubSearch as R, getTranslationFor as T } from "@piveau/sdk-vue";
2
+ import { createGlobalState as S, useAsyncState as W } from "@vueuse/core";
3
+ import $ from "axios";
4
+ import B from "qs";
5
+ import { computed as o, toValue as d, watch as _, onBeforeUnmount as E, ref as F } from "vue";
6
+ import { useStore as q } from "vuex";
7
+ import V from "zod";
8
+ import { useRuntimeEnv as G } from "../../composables/useRuntimeEnv.js";
9
+ const H = S(() => {
10
+ const i = F([]), n = o(() => {
11
+ var t;
12
+ const e = i.value.find(
13
+ (a) => a.rsname.includes("/") && (a.rsname.endsWith("-projects") || a.rsname.endsWith("-datasets"))
14
+ );
15
+ return e ? e.rsname.split("/")[0] : ((t = i.value.find((a) => a.rsname.endsWith("-orga") && !a.rsname.includes("/"))) == null ? void 0 : t.rsname) || "";
16
+ }), m = o(() => {
17
+ const e = i.value.find(
18
+ (t) => t.rsname.includes("/") && t.rsname.endsWith("-projects")
19
+ );
20
+ return e ? e.rsname.split("/")[1] : n.value ? n.value.replace("-orga", "-projects") : "";
21
+ }), p = o(() => {
22
+ const e = i.value.find(
23
+ (t) => t.rsname.includes("/") && t.rsname.endsWith("-datasets")
24
+ );
25
+ return e ? e.rsname.split("/")[1] : n.value ? n.value.replace("-orga", "-datasets") : "";
26
+ }), u = o(() => {
14
27
  var f;
15
- if (!t.value)
28
+ if (!n.value)
16
29
  return [];
17
- const a = ((f = u.value.find((c) => c.rsname === t.value)) == null ? void 0 : f.scopes) || [], s = (c, w) => c.every((g) => w.includes(g)), n = [];
18
- return s(["catalog:update", "catalog:create", "catalog:delete"], a) && n.push("organizationAdmin"), a.includes("dataset:view_published") && n.push("dataViewer"), s(["dataset:delete", "dataset:view_draft", "dataset:publish"], a) && n.push("dataPublisher"), s(["dataset:view_draft", "dataset:create", "dataset:update"], a) && n.push("dataExpert"), n;
19
- }), k = o(() => i.value.includes("dataExpert") || i.value.includes("organizationAdmin"));
30
+ const e = ((f = i.value.find((c) => c.rsname === n.value)) == null ? void 0 : f.scopes) || [], t = (c, k) => c.every((h) => k.includes(h)), a = [];
31
+ return t(["catalog:update", "catalog:create", "catalog:delete"], e) && a.push("organizationAdmin"), e.includes("dataset:view_published") && a.push("dataViewer"), t(["dataset:delete", "dataset:view_draft", "dataset:publish"], e) && a.push("dataPublisher"), t(["dataset:view_draft", "dataset:create", "dataset:update"], e) && a.push("dataExpert"), a;
32
+ }), y = o(() => u.value.includes("dataExpert") || u.value.includes("organizationAdmin"));
20
33
  return {
21
- permissions: u,
22
- organization: t,
23
- catalogProject: p,
24
- catalogDataset: m,
25
- userRoles: i,
26
- allowedToCreate: k
34
+ permissions: i,
35
+ organization: n,
36
+ catalogProject: m,
37
+ catalogDataset: p,
38
+ userRoles: u,
39
+ allowedToCreate: y
27
40
  };
28
41
  });
29
- function Z(u) {
30
- var x, z, T, _;
31
- const t = I(), {
32
- keycloak: p = ((z = (x = t.authentication) == null ? void 0 : x.keycloak) == null ? void 0 : z.url) || "https://keycloak.twin.bydata.de",
33
- realm: m = ((_ = (T = t.authentication) == null ? void 0 : T.keycloak) == null ? void 0 : _.realm) || "",
34
- audience: i = "piveau",
35
- catalogId: k = void 0
36
- } = u || {}, { permissions: a, organization: s, catalogProject: n, catalogDataset: f, userRoles: c, allowedToCreate: w } = N(), g = G(), l = o(() => {
37
- var e, r;
38
- return ((r = (e = g.getters) == null ? void 0 : e["auth/getUserData"]) == null ? void 0 : r.authToken) || "";
39
- }), h = B(async () => (await E.post(
40
- `${d(p)}/realms/${d(m)}/protocol/openid-connect/token`,
41
- F.stringify({
42
+ function Y(i) {
43
+ var b, x, z, P;
44
+ const n = G(), {
45
+ keycloak: m = ((x = (b = n.authentication) == null ? void 0 : b.keycloak) == null ? void 0 : x.url) || "https://keycloak.twin.bydata.de",
46
+ realm: p = ((P = (z = n.authentication) == null ? void 0 : z.keycloak) == null ? void 0 : P.realm) || "",
47
+ audience: u = "piveau",
48
+ catalogId: y = void 0
49
+ } = i || {}, { permissions: e, organization: t, catalogProject: a, catalogDataset: f, userRoles: c, allowedToCreate: k } = H(), h = q(), l = o(() => {
50
+ var s, r;
51
+ return ((r = (s = h.getters) == null ? void 0 : s["auth/getUserData"]) == null ? void 0 : r.authToken) || "";
52
+ }), g = W(async () => (await $.post(
53
+ `${d(m)}/realms/${d(p)}/protocol/openid-connect/token`,
54
+ B.stringify({
42
55
  grant_type: "urn:ietf:params:oauth:grant-type:uma-ticket",
43
- audience: d(i),
56
+ audience: d(u),
44
57
  response_mode: "permissions"
45
58
  }),
46
59
  {
@@ -51,69 +64,69 @@ function Z(u) {
51
64
  }
52
65
  )).data, void 0, {
53
66
  immediate: !1
54
- }), U = o(() => {
55
- var e, r;
56
- return ((r = (e = g.getters) == null ? void 0 : e["auth/getUserData"]) == null ? void 0 : r.userName) || "";
67
+ }), A = o(() => {
68
+ var s, r;
69
+ return ((r = (s = h.getters) == null ? void 0 : s["auth/getUserData"]) == null ? void 0 : r.userName) || "";
57
70
  });
58
71
  let v = null;
59
- function C() {
60
- v = D(() => d(l), (e, r) => {
61
- e !== r && h.execute();
72
+ function D() {
73
+ v = _(() => d(l), (s, r) => {
74
+ s !== r && g.execute();
62
75
  }, {
63
76
  immediate: !0
64
77
  });
65
78
  }
66
- function b() {
79
+ function w() {
67
80
  v == null || v();
68
81
  }
69
- D(() => h.state.value, (e) => {
70
- e && h.isReady.value && (a.value = e || []);
82
+ _(() => g.state.value, (s) => {
83
+ s && g.isReady.value && (e.value = s || []);
71
84
  }, {
72
85
  immediate: !0
73
86
  });
74
- const { useResource: P } = $({
75
- baseUrl: t.api.baseUrl,
87
+ const { useResource: U } = R({
88
+ baseUrl: n.api.baseUrl,
76
89
  index: "catalogues",
77
90
  indexDetails: "catalogues",
78
- schema: H.any(),
91
+ schema: V.any(),
79
92
  facets: []
80
- }, (e, r) => {
81
- const y = e;
93
+ }, (s) => {
94
+ const r = s;
82
95
  return {
83
- id: y.id || "",
84
- issued: y.issued || "",
85
- title: A(y.title, "de") || "",
86
- description: A(y.description, "de") || "",
96
+ id: r.id || "",
97
+ issued: r.issued || "",
98
+ title: T(r.title, "de") || "",
99
+ description: T(r.description, "de") || "",
87
100
  img: void 0
88
101
  };
89
- }), R = o(() => ({
102
+ }), j = o(() => ({
90
103
  Authorization: `Bearer ${l.value}`
91
- })), S = P(o(() => d(k) || s.value || ""), {
92
- headers: R,
104
+ })), C = U(o(() => d(y) || t.value || ""), {
105
+ headers: j,
93
106
  queryOptions: {
94
107
  enabled: !!l.value
95
108
  }
96
109
  });
97
- return q(() => {
98
- b();
110
+ return E(() => {
111
+ w();
99
112
  }), {
100
113
  authToken: l,
101
- keycloak: p,
102
- realm: m,
103
- audience: i,
104
- fetchPermissions: h,
105
- organization: s,
106
- catalogProject: n,
114
+ keycloak: m,
115
+ realm: p,
116
+ audience: u,
117
+ fetchPermissions: g,
118
+ organization: t,
119
+ catalogProject: a,
107
120
  catalogDataset: f,
108
- username: U,
121
+ username: A,
109
122
  userRoles: c,
110
- startFetchPermissions: C,
111
- stopFetchPermissions: b,
112
- permissions: a,
113
- allowedToCreate: w,
114
- organizationDetails: S
123
+ startFetchPermissions: D,
124
+ stopFetchPermissions: w,
125
+ permissions: e,
126
+ allowedToCreate: k,
127
+ organizationDetails: C
115
128
  };
116
129
  }
117
130
  export {
118
- Z as useTwinbyUser
131
+ Y as useTwinbyUser
119
132
  };