@webitel/ui-sdk 26.8.112 → 26.8.114
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/dist/{caseConverters-6cy_SaV5.js → caseConverters-DGri4uJo.js} +1 -1
- package/dist/{clients-Be8f1qoM.js → clients-CWniSi77.js} +255 -163
- package/dist/{components-GY1xFZWr.js → components-DJVzkzrr.js} +301 -301
- package/dist/{composables-Vg-QfE_2.js → composables-BeyROIj_.js} +2 -2
- package/dist/{convertDuration-heRoQzks.js → convertDuration-BOe9PsRT.js} +1 -1
- package/dist/{deep-copy-7O5ej7vT.js → deep-copy-BJdHBMNZ.js} +1 -1
- package/dist/{dist-DJZOILzq.js → dist-CnyqtIg9.js} +1 -1
- package/dist/{dist-DB8lC4KJ.js → dist-EXdgfpvN.js} +44 -44
- package/dist/{enums-BDtfwdQu.js → enums-CsINFPBu.js} +133 -11
- package/dist/{genClient-5JkKKac8.js → genClient-CvWlQ0TZ.js} +2 -2
- package/dist/ui-sdk.js +16 -16
- package/dist/ui-sdk.umd.cjs +691 -656
- package/dist/{useValidation-B4q8qUvG.js → useValidation-KcXmMBtR.js} +2 -2
- package/dist/{useWtTable-CUpN0LZ5.js → useWtTable-AYb1yHre.js} +1 -1
- package/dist/{utils-DaacyMAw.js → utils-DHSDTqJG.js} +1 -1
- package/dist/vue-i18n-VBiROMZ4.js +3031 -0
- package/dist/{vue-router-CobN9tLi.js → vue-router-C9sRzLyg.js} +1 -1
- package/dist/{wt-action-bar-DJ_xvqhE.js → wt-action-bar-TwclxZyb.js} +3 -3
- package/dist/{wt-badge-C8O4Oarp.js → wt-badge-DbplVXor.js} +1 -1
- package/dist/{wt-button-BmBqpEkp.js → wt-button-rUZKbswL.js} +4 -4
- package/dist/{wt-chat-emoji-E6MiDOCz.js → wt-chat-emoji-BATwPh2q.js} +4 -4
- package/dist/{wt-datepicker-C1kACub3.js → wt-datepicker-C4wrYXt9.js} +11 -11
- package/dist/{wt-display-chip-items-Dr6QjwFR.js → wt-display-chip-items-N20vx27z.js} +2 -2
- package/dist/{wt-dual-panel-D5TCilWN.js → wt-dual-panel-CjWwG7y6.js} +7 -7
- package/dist/{wt-expansion-card-2wdr_Hpi.js → wt-expansion-card-vv5ctpfw.js} +2 -2
- package/dist/{wt-expansion-panel-DP8zz2tS.js → wt-expansion-panel-3tx3DGUp.js} +1 -1
- package/dist/{wt-galleria-iRpRiDc6.js → wt-galleria-DcZRuekj.js} +2 -2
- package/dist/{wt-icon-CZlhT7Yb.js → wt-icon-B4wxzcVG.js} +4 -4
- package/dist/{wt-icon-action-BXg3jVf6.js → wt-icon-action-CTPCemTs.js} +2 -2
- package/dist/{wt-icon-btn-C8xuTCJR.js → wt-icon-btn-D3lG7Acn.js} +1 -1
- package/dist/{wt-notifications-bar-BDOKlHao.js → wt-notifications-bar-BMV-0Vmo.js} +2 -2
- package/dist/{wt-player-Dqlccj2F.js → wt-player-DBsbjt_l.js} +5 -5
- package/dist/{wt-popover-DuZFw3bg.js → wt-popover-BI6YyXy0.js} +1 -1
- package/dist/{wt-screen-recordings-action-biHVl6lR.js → wt-screen-recordings-action-D2PKGnNl.js} +1 -1
- package/dist/{wt-search-bar-ByF2Wjsg.js → wt-search-bar-CFANAMNQ.js} +1 -1
- package/dist/{wt-selection-popup-Bd4EuLl-.js → wt-selection-popup-Dei_JZah.js} +1 -1
- package/dist/{wt-send-message-popup-BL9aJz5t.js → wt-send-message-popup-DSZ7srx4.js} +7 -7
- package/dist/{wt-slider-Co6hZQu_.js → wt-slider-x-Tch7RT.js} +1 -1
- package/dist/{wt-start-page-Bp7b0ir-.js → wt-start-page-2Bdzg5V5.js} +1 -1
- package/dist/{wt-status-select-BOmAd__4.js → wt-status-select-Bgtu5WrX.js} +11 -11
- package/dist/{wt-table-RK0pOlzR.js → wt-table-DMEjT0xF.js} +6 -6
- package/dist/{wt-table-column-select-BtFhZKPT.js → wt-table-column-select-DzXaRs03.js} +3 -3
- package/dist/{wt-timepicker-C4kMPkNd.js → wt-timepicker-B-ZZUyDZ.js} +5 -5
- package/dist/{wt-toast-DbYB-u-k.js → wt-toast-pXV44Y3v.js} +10 -10
- package/dist/{wt-tree-BH2o2iCt.js → wt-tree-Cu_yRDjp.js} +98 -98
- package/dist/{wt-tree-table-CCaiVeY_.js → wt-tree-table-BET1GUgf.js} +2 -2
- package/dist/wt-type-extension-value-input-B1-ScgJm.js +14743 -0
- package/dist/{wt-vidstack-player-u4R9q51f.js → wt-vidstack-player-C_EdEZ8v.js} +6 -6
- package/package.json +1 -1
- package/src/components/on-demand/wt-type-extension-value-input/wt-type-extension-value-input.vue +19 -5
- package/src/modules/Userinfo/composables/useLookupFieldReadAccess.ts +54 -0
- package/src/modules/Userinfo/index.ts +10 -0
- package/src/modules/Userinfo/injection/filterReadAccess.ts +21 -0
- package/src/modules/Userinfo/mappings/lookupPathToScopeClass.ts +53 -0
- package/src/modules/Userinfo/scripts/typeObjectClass.ts +55 -0
- package/src/modules/Userinfo/stores/userinfoStore.ts +13 -2
- package/types/.tsbuildinfo +1 -1
- package/types/components/on-demand/wt-type-extension-value-input/wt-type-extension-value-input.vue.d.ts +11 -4
- package/types/components/wt-inline-add-panel/wt-inline-add-panel.vue.d.ts +1 -1
- package/types/modules/Flow/lookups/FlowTypeApplications.lookup.d.ts +5 -5
- package/types/modules/Userinfo/composables/useLookupFieldReadAccess.d.ts +14 -0
- package/types/modules/Userinfo/index.d.ts +2 -0
- package/types/modules/Userinfo/injection/filterReadAccess.d.ts +7 -0
- package/types/modules/Userinfo/mappings/lookupPathToScopeClass.d.ts +3 -0
- package/types/modules/Userinfo/scripts/typeObjectClass.d.ts +2 -0
- package/types/modules/Userinfo/stores/userinfoStore.d.ts +25 -15
- package/dist/vue-i18n-B88GcHzn.js +0 -2275
- package/dist/wt-type-extension-value-input-DaSIbXbu.js +0 -109
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { w as e } from "./components-
|
|
2
|
-
import "./convertDuration-
|
|
1
|
+
import { w as e } from "./components-DJVzkzrr.js";
|
|
2
|
+
import "./convertDuration-BOe9PsRT.js";
|
|
3
3
|
import { t } from "./_plugin-vue_export-helper-B3ysoDQm.js";
|
|
4
|
-
import {
|
|
5
|
-
import "./wt-button-
|
|
6
|
-
import { t as r } from "./wt-icon-btn-
|
|
4
|
+
import { m as n } from "./enums-CsINFPBu.js";
|
|
5
|
+
import "./wt-button-rUZKbswL.js";
|
|
6
|
+
import { t as r } from "./wt-icon-btn-D3lG7Acn.js";
|
|
7
7
|
import { $ as i, C as a, D as o, F as s, G as c, H as l, I as u, J as d, K as f, L as p, M as m, N as h, O as g, P as ee, Q as _, R as te, S as v, U as ne, V as y, W as b, X as x, Y as re, Z as S, _ as C, a as ie, b as ae, c as oe, d as se, et as ce, f as le, g as ue, h as de, i as w, it as fe, j as pe, k as me, l as T, m as he, n as E, nt as D, o as O, ot as ge, p as k, q as A, r as j, rt as _e, t as ve, tt as ye, u as be, v as M, w as xe, y as Se, z as Ce } from "./vidstack-D9mvYVIz-DesuYgKV.js";
|
|
8
8
|
import { _ as N, a as we, c as Te, d as Ee, f as De, g as Oe, h as ke, i as Ae, l as je, m as Me, n as Ne, o as Pe, p as Fe, r as Ie, s as Le, t as P, u as Re } from "./vidstack-CgfrU1hS-CNTJkyzm.js";
|
|
9
9
|
import { _ as ze, a as Be, c as Ve, f as He, g as Ue, h as We, i as Ge, l as Ke, n as qe, r as Je, s as Ye, t as Xe, u as Ze, v as Qe, x as $e, y as et } from "./useVidstackSrc-aQcqC_v0.js";
|
|
@@ -14,7 +14,7 @@ import { a as at, i as ot, n as L, o as st, r as R, t as ct } from "./vidstack-D
|
|
|
14
14
|
import { t as z } from "./vidstack-_E7LrUjK-DaCLs8ge.js";
|
|
15
15
|
import { n as lt, t as ut } from "./vidstack-CDOoBnJL-BCwLE1fB.js";
|
|
16
16
|
import { i as dt, n as ft, r as pt, t as mt } from "./vidstack-CdfyZegh-Bn47J4h6.js";
|
|
17
|
-
import { t as ht } from "./wt-slider-
|
|
17
|
+
import { t as ht } from "./wt-slider-x-Tch7RT.js";
|
|
18
18
|
import { computed as gt, createBlock as _t, createCommentVNode as vt, createElementBlock as yt, createElementVNode as bt, createSlots as xt, createVNode as B, defineComponent as St, inject as Ct, normalizeClass as wt, onBeforeUnmount as Tt, onMounted as Et, openBlock as V, provide as Dt, ref as Ot, renderSlot as H, resolveComponent as kt, toDisplayString as At, toRefs as jt, unref as U, useTemplateRef as Mt, withCtx as Nt } from "vue";
|
|
19
19
|
//#region node_modules/vidstack/prod/chunks/vidstack-CYE89tBD.js
|
|
20
20
|
var Pt = he();
|
package/package.json
CHANGED
package/src/components/on-demand/wt-type-extension-value-input/wt-type-extension-value-input.vue
CHANGED
|
@@ -32,10 +32,8 @@
|
|
|
32
32
|
}"
|
|
33
33
|
>
|
|
34
34
|
<wt-single-select
|
|
35
|
-
v-bind="sharedChildrenProps"
|
|
35
|
+
v-bind="{ ...sharedChildrenProps, ...selectProps }"
|
|
36
36
|
:model-value="value"
|
|
37
|
-
:search-method="loadLookupList(field.lookup)"
|
|
38
|
-
data-key="id"
|
|
39
37
|
@update:model-value="selectElement"
|
|
40
38
|
/>
|
|
41
39
|
</slot>
|
|
@@ -86,8 +84,12 @@ import {
|
|
|
86
84
|
import { computed } from 'vue';
|
|
87
85
|
import { useI18n } from 'vue-i18n';
|
|
88
86
|
|
|
89
|
-
import {
|
|
87
|
+
import {
|
|
88
|
+
WtTypeExtensionFieldKind as FieldType,
|
|
89
|
+
type WtObject,
|
|
90
|
+
} from '../../../enums';
|
|
90
91
|
import type { VuelidateFieldLike } from '../../../mixins/validationMixin/vuelidate/useVuelidateValidation';
|
|
92
|
+
import { useLookupFieldReadAccess } from '../../../modules/Userinfo';
|
|
91
93
|
|
|
92
94
|
const model = defineModel<unknown>();
|
|
93
95
|
|
|
@@ -95,6 +97,8 @@ const props = defineProps<{
|
|
|
95
97
|
field: DataField;
|
|
96
98
|
label?: string;
|
|
97
99
|
required?: boolean;
|
|
100
|
+
disabled?: boolean;
|
|
101
|
+
hasReadAccess?: (object?: WtObject) => boolean;
|
|
98
102
|
/**
|
|
99
103
|
* TODO: implement validation
|
|
100
104
|
*/
|
|
@@ -111,6 +115,11 @@ const props = defineProps<{
|
|
|
111
115
|
|
|
112
116
|
const { t } = useI18n();
|
|
113
117
|
|
|
118
|
+
const { hasReadAccess: hasLookupReadAccess } = useLookupFieldReadAccess(
|
|
119
|
+
() => props.field,
|
|
120
|
+
props.hasReadAccess,
|
|
121
|
+
);
|
|
122
|
+
|
|
114
123
|
const resolvedLabel = computed(() => {
|
|
115
124
|
return props.label || t(props.field?.name || 'vocabulary.labels');
|
|
116
125
|
});
|
|
@@ -119,6 +128,8 @@ const isRequired = computed(() => {
|
|
|
119
128
|
return props.required ?? props.field.required;
|
|
120
129
|
});
|
|
121
130
|
|
|
131
|
+
const isDisabled = computed(() => props.disabled || !hasLookupReadAccess.value);
|
|
132
|
+
|
|
122
133
|
// biome-ignore lint/suspicious/noExplicitAny: the value type follows `field.kind` at runtime
|
|
123
134
|
const value = computed<any>(() => {
|
|
124
135
|
return model.value;
|
|
@@ -127,6 +138,7 @@ const value = computed<any>(() => {
|
|
|
127
138
|
const sharedChildrenProps = computed(() => ({
|
|
128
139
|
label: resolvedLabel.value,
|
|
129
140
|
required: isRequired.value,
|
|
141
|
+
disabled: isDisabled.value,
|
|
130
142
|
v: props.v,
|
|
131
143
|
}));
|
|
132
144
|
|
|
@@ -139,7 +151,9 @@ const sharedChildrenProps = computed(() => ({
|
|
|
139
151
|
const selectProps = computed(() => ({
|
|
140
152
|
clearable: true,
|
|
141
153
|
dataKey: 'id',
|
|
142
|
-
searchMethod:
|
|
154
|
+
searchMethod: hasLookupReadAccess.value
|
|
155
|
+
? loadLookupList(props.field.lookup)
|
|
156
|
+
: undefined,
|
|
143
157
|
}));
|
|
144
158
|
|
|
145
159
|
const multiselectProps = computed(() => ({
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { computed, type MaybeRefOrGetter, type Ref, toValue } from 'vue';
|
|
2
|
+
|
|
3
|
+
import type { WtObject } from '../../../enums';
|
|
4
|
+
import { injectFilterReadAccess } from '../injection/filterReadAccess';
|
|
5
|
+
import {
|
|
6
|
+
getScopeClassByLookupPath,
|
|
7
|
+
getWtObjectByScopeClass,
|
|
8
|
+
} from '../mappings/lookupPathToScopeClass';
|
|
9
|
+
import {
|
|
10
|
+
normalizeLookupPath,
|
|
11
|
+
peekTypeObjectClass,
|
|
12
|
+
} from '../scripts/typeObjectClass';
|
|
13
|
+
|
|
14
|
+
export type LookupFieldHasReadAccess = (object?: WtObject) => boolean;
|
|
15
|
+
|
|
16
|
+
type LookupField = {
|
|
17
|
+
lookup?: {
|
|
18
|
+
path?: string;
|
|
19
|
+
objclass?: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const hasLookupFieldReadAccess = (
|
|
24
|
+
field?: LookupField | null,
|
|
25
|
+
hasReadAccess?: LookupFieldHasReadAccess,
|
|
26
|
+
): boolean => {
|
|
27
|
+
const path = normalizeLookupPath(field?.lookup?.path);
|
|
28
|
+
if (!path) return true;
|
|
29
|
+
|
|
30
|
+
const objectClass =
|
|
31
|
+
field?.lookup?.objclass ||
|
|
32
|
+
getScopeClassByLookupPath(path) ||
|
|
33
|
+
peekTypeObjectClass(path);
|
|
34
|
+
if (!objectClass) return false;
|
|
35
|
+
|
|
36
|
+
const wtObject = getWtObjectByScopeClass(objectClass);
|
|
37
|
+
return hasReadAccess?.(wtObject ?? (objectClass as WtObject)) ?? false;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const useLookupFieldReadAccess = (
|
|
41
|
+
field: MaybeRefOrGetter<LookupField | null | undefined>,
|
|
42
|
+
hasReadAccessFn?: LookupFieldHasReadAccess,
|
|
43
|
+
): {
|
|
44
|
+
hasReadAccess: Ref<boolean>;
|
|
45
|
+
} => {
|
|
46
|
+
const getInjected = injectFilterReadAccess();
|
|
47
|
+
const hasReadAccess = computed(() =>
|
|
48
|
+
hasLookupFieldReadAccess(toValue(field), hasReadAccessFn ?? getInjected()),
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
return {
|
|
52
|
+
hasReadAccess,
|
|
53
|
+
};
|
|
54
|
+
};
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
export { default as ApplicationsAccess } from './classes/ApplicationsAccess';
|
|
2
2
|
export { createUserAccessControlComposable } from './composables/createUserAccessControl';
|
|
3
|
+
export {
|
|
4
|
+
hasLookupFieldReadAccess,
|
|
5
|
+
useLookupFieldReadAccess,
|
|
6
|
+
} from './composables/useLookupFieldReadAccess';
|
|
3
7
|
|
|
4
8
|
export {
|
|
5
9
|
CrudGlobalAction,
|
|
@@ -7,4 +11,10 @@ export {
|
|
|
7
11
|
SpecialGlobalAction,
|
|
8
12
|
WebitelLicense,
|
|
9
13
|
} from './enums';
|
|
14
|
+
export {
|
|
15
|
+
type FilterHasReadAccess,
|
|
16
|
+
FilterReadAccessKey,
|
|
17
|
+
injectFilterReadAccess,
|
|
18
|
+
provideFilterReadAccess,
|
|
19
|
+
} from './injection/filterReadAccess';
|
|
10
20
|
export { createUserinfoStore } from './stores/userinfoStore';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { InjectionKey } from 'vue';
|
|
2
|
+
import { inject, provide } from 'vue';
|
|
3
|
+
|
|
4
|
+
import type { WtObject } from '../../../enums';
|
|
5
|
+
|
|
6
|
+
export type FilterHasReadAccess = (object?: WtObject) => boolean;
|
|
7
|
+
|
|
8
|
+
/** Getter around the checker: `provide` would call a bare function as a factory. */
|
|
9
|
+
export const FilterReadAccessKey: InjectionKey<
|
|
10
|
+
() => FilterHasReadAccess | undefined
|
|
11
|
+
> = Symbol('filterReadAccess');
|
|
12
|
+
|
|
13
|
+
export const provideFilterReadAccess = (
|
|
14
|
+
getHasReadAccess: () => FilterHasReadAccess | undefined,
|
|
15
|
+
) => {
|
|
16
|
+
const parent = inject(FilterReadAccessKey, undefined);
|
|
17
|
+
provide(FilterReadAccessKey, () => getHasReadAccess() ?? parent?.());
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const injectFilterReadAccess = () =>
|
|
21
|
+
inject(FilterReadAccessKey, () => undefined);
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { ScopeClass } from '../enums';
|
|
2
|
+
import { mapScopeClassToWtObjects } from './mappings';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Needed to resolve lookup Read access: checks use WtObject, but `lookup.path`
|
|
6
|
+
* is a type-registry path (`call_center/queues`) and often has no `objclass`.
|
|
7
|
+
* This table maps path → ScopeClass; `mapScopeClassToWtObjects` then gives
|
|
8
|
+
* WtObject. Paths not listed here go through `/types/{path}`.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const lookupPathToScopeClass: Partial<Record<string, ScopeClass>> = {
|
|
12
|
+
'call_center/queues': ScopeClass.Queue,
|
|
13
|
+
'call_center/agents': ScopeClass.Agent,
|
|
14
|
+
'call_center/list': ScopeClass.List,
|
|
15
|
+
'call_center/teams': ScopeClass.Team,
|
|
16
|
+
'call_center/skills': ScopeClass.Skills,
|
|
17
|
+
'contacts/groups': ScopeClass.ContactGroups,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/** Nested type-registry paths, e.g. `cases/priorities`. */
|
|
21
|
+
const lookupPathPrefixToScopeClass: Array<{
|
|
22
|
+
prefix: string;
|
|
23
|
+
scopeClass: ScopeClass;
|
|
24
|
+
}> = [
|
|
25
|
+
{
|
|
26
|
+
prefix: 'cases/',
|
|
27
|
+
scopeClass: ScopeClass.CaseLookups,
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
prefix: 'dictionaries/',
|
|
31
|
+
scopeClass: ScopeClass.Custom,
|
|
32
|
+
},
|
|
33
|
+
];
|
|
34
|
+
|
|
35
|
+
export const getScopeClassByLookupPath = (path?: string) => {
|
|
36
|
+
if (!path) return undefined;
|
|
37
|
+
|
|
38
|
+
if (mapScopeClassToWtObjects[path as ScopeClass]) {
|
|
39
|
+
return path as ScopeClass;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const exact = lookupPathToScopeClass[path];
|
|
43
|
+
if (exact) return exact;
|
|
44
|
+
|
|
45
|
+
return lookupPathPrefixToScopeClass.find(({ prefix }) =>
|
|
46
|
+
path.startsWith(prefix),
|
|
47
|
+
)?.scopeClass;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const getWtObjectByScopeClass = (objectClass?: string) =>
|
|
51
|
+
objectClass
|
|
52
|
+
? mapScopeClassToWtObjects[objectClass as ScopeClass]?.[0]
|
|
53
|
+
: undefined;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { ObjectsAPI } from '@webitel/api-services/api';
|
|
2
|
+
import type { ProtoDataStruct } from '@webitel/api-services/gen-wire/models';
|
|
3
|
+
import { reactive } from 'vue';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Type-registry `lookup.path` often has no RBAC class on the field itself.
|
|
7
|
+
* `/types/{path}` returns `objclass`; we cache it so lookup Read checks can
|
|
8
|
+
* fail closed while the request is in flight and re-enable when it lands.
|
|
9
|
+
*/
|
|
10
|
+
const objectClassByPath = reactive(new Map<string, string | undefined>());
|
|
11
|
+
const inflightByPath = new Map<string, Promise<string | undefined>>();
|
|
12
|
+
|
|
13
|
+
export const normalizeLookupPath = (path?: string) =>
|
|
14
|
+
path?.replace(/^\//, '') || undefined;
|
|
15
|
+
|
|
16
|
+
const fetchTypeObjectClass = async (
|
|
17
|
+
path: string,
|
|
18
|
+
): Promise<string | undefined> => {
|
|
19
|
+
if (objectClassByPath.has(path)) {
|
|
20
|
+
return objectClassByPath.get(path);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const inflight = inflightByPath.get(path);
|
|
24
|
+
if (inflight) return inflight;
|
|
25
|
+
|
|
26
|
+
const request = ObjectsAPI.get({
|
|
27
|
+
itemId: path,
|
|
28
|
+
})
|
|
29
|
+
.then((type: ProtoDataStruct) => {
|
|
30
|
+
const objectClass = type?.objclass;
|
|
31
|
+
objectClassByPath.set(path, objectClass);
|
|
32
|
+
return objectClass;
|
|
33
|
+
})
|
|
34
|
+
.catch(() => {
|
|
35
|
+
objectClassByPath.set(path, undefined);
|
|
36
|
+
return undefined;
|
|
37
|
+
})
|
|
38
|
+
.finally(() => {
|
|
39
|
+
inflightByPath.delete(path);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
inflightByPath.set(path, request);
|
|
43
|
+
return request;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const peekTypeObjectClass = (path?: string) => {
|
|
47
|
+
const normalized = normalizeLookupPath(path);
|
|
48
|
+
if (!normalized) return undefined;
|
|
49
|
+
|
|
50
|
+
if (!objectClassByPath.has(normalized)) {
|
|
51
|
+
void fetchTypeObjectClass(normalized);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return objectClassByPath.get(normalized);
|
|
55
|
+
};
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import { pick } from 'lodash-es';
|
|
2
2
|
import { defineStore, storeToRefs } from 'pinia';
|
|
3
3
|
import { ref } from 'vue';
|
|
4
|
+
|
|
5
|
+
import type { WtObject } from '../../../enums';
|
|
4
6
|
import { createUserNotificationsStore } from '../../UserNotifications/stores/userNotificationsStore';
|
|
5
7
|
import { getSession, getUiVisibilityAccess, logout } from '../api/UserinfoAPI';
|
|
6
8
|
import { createUserAccessStore } from './accessStore';
|
|
7
9
|
import { createSettingsStore } from './settingsStore';
|
|
8
10
|
|
|
11
|
+
type UserinfoStoreApi = {
|
|
12
|
+
hasReadAccess: (object?: WtObject) => boolean;
|
|
13
|
+
};
|
|
14
|
+
|
|
9
15
|
export const createUserinfoStore = () => {
|
|
10
16
|
const namespace = 'userinfo';
|
|
11
17
|
const useAccessStore = createUserAccessStore({
|
|
@@ -106,8 +112,13 @@ export const createUserinfoStore = () => {
|
|
|
106
112
|
};
|
|
107
113
|
});
|
|
108
114
|
|
|
109
|
-
|
|
110
|
-
window._userinfoStore = store;
|
|
115
|
+
window._userinfoStore = store as Window['_userinfoStore'];
|
|
111
116
|
|
|
112
117
|
return store;
|
|
113
118
|
};
|
|
119
|
+
|
|
120
|
+
declare global {
|
|
121
|
+
interface Window {
|
|
122
|
+
_userinfoStore?: () => UserinfoStoreApi;
|
|
123
|
+
}
|
|
124
|
+
}
|