@authup/client-web-kit 1.0.0-beta.12 → 1.0.0-beta.14
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/components/AEntityDelete.d.ts +7 -7
- package/dist/components/client/AClient.d.ts +2 -2
- package/dist/components/client/AClientForm.d.ts +3 -3
- package/dist/components/client/AClientRedirectUrisItem.d.ts +2 -2
- package/dist/components/client/AClients.d.ts +6 -6
- package/dist/components/client-scope/AClientScope.d.ts +2 -2
- package/dist/components/client-scope/AClientScopeAssignment.d.ts +2 -2
- package/dist/components/client-scope/AClientScopes.d.ts +6 -6
- package/dist/components/identity-provider/AIdentityProvider.d.ts +2 -2
- package/dist/components/identity-provider/AIdentityProviderBasicFields.d.ts +3 -1
- package/dist/components/identity-provider/AIdentityProviderBasicFields.d.ts.map +1 -1
- package/dist/components/identity-provider/AIdentityProviderForm.d.ts +3 -3
- package/dist/components/identity-provider/AIdentityProviderLdapForm.d.ts +3 -3
- package/dist/components/identity-provider/AIdentityProviderOAuth2Discovery.d.ts +3 -2
- package/dist/components/identity-provider/AIdentityProviderOAuth2Discovery.d.ts.map +1 -1
- package/dist/components/identity-provider/AIdentityProviderOAuth2Form.d.ts +3 -3
- package/dist/components/identity-provider/AIdentityProviders.d.ts +6 -6
- package/dist/components/identity-provider-role/AIdentityProviderRoleAssignment.d.ts +2 -2
- package/dist/components/permission/APermission.d.ts +2 -2
- package/dist/components/permission/APermissionForm.d.ts +4 -8
- package/dist/components/permission/APermissionForm.d.ts.map +1 -1
- package/dist/components/permission/APermissions.d.ts +6 -6
- package/dist/components/realm/ARealm.d.ts +2 -2
- package/dist/components/realm/ARealmForm.d.ts +2 -2
- package/dist/components/realm/ARealms.d.ts +6 -6
- package/dist/components/realm/helpers/form-picker.d.ts +7 -0
- package/dist/components/realm/helpers/form-picker.d.ts.map +1 -0
- package/dist/components/realm/helpers/index.d.ts +2 -0
- package/dist/components/realm/helpers/index.d.ts.map +1 -0
- package/dist/components/robot/ARobot.d.ts +2 -2
- package/dist/components/robot/ARobotForm.d.ts +3 -3
- package/dist/components/robot/ARobots.d.ts +6 -6
- package/dist/components/robot-permission/ARobotPermissionAssignment.d.ts +2 -2
- package/dist/components/robot-role/ARobotRoleAssignment.d.ts +2 -2
- package/dist/components/role/ARole.d.ts +2 -2
- package/dist/components/role/ARoleForm.d.ts +2 -2
- package/dist/components/role/ARoleForm.d.ts.map +1 -1
- package/dist/components/role/ARoles.d.ts +6 -6
- package/dist/components/role-permission/ARolePermissionAssignment.d.ts +2 -2
- package/dist/components/scope/AScope.d.ts +2 -2
- package/dist/components/scope/AScopeForm.d.ts +2 -14
- package/dist/components/scope/AScopeForm.d.ts.map +1 -1
- package/dist/components/scope/AScopes.d.ts +6 -6
- package/dist/components/user/AUser.d.ts +2 -2
- package/dist/components/user/AUserForm.d.ts +3 -3
- package/dist/components/user/AUserPasswordForm.d.ts +3 -3
- package/dist/components/user/AUsers.d.ts +6 -6
- package/dist/components/user-permission/AUserPermissionAssignment.d.ts +2 -2
- package/dist/components/user-role/AUserRoleAssignment.d.ts +2 -2
- package/dist/components/utility/search/ASearch.d.ts +3 -1
- package/dist/components/utility/search/ASearch.d.ts.map +1 -1
- package/dist/components/utility/search/module.d.ts +3 -2
- package/dist/components/utility/search/module.d.ts.map +1 -1
- package/dist/composables/index.d.ts +2 -0
- package/dist/composables/index.d.ts.map +1 -1
- package/dist/composables/use-ability-check.d.ts +3 -0
- package/dist/composables/use-ability-check.d.ts.map +1 -0
- package/dist/composables/use-realm-resource-writable-check.d.ts +3 -0
- package/dist/composables/use-realm-resource-writable-check.d.ts.map +1 -0
- package/dist/core/http-client/index.d.ts +4 -0
- package/dist/core/http-client/index.d.ts.map +1 -0
- package/dist/core/http-client/install.d.ts +4 -0
- package/dist/core/http-client/install.d.ts.map +1 -0
- package/dist/core/http-client/singleton.d.ts +7 -0
- package/dist/core/http-client/singleton.d.ts.map +1 -0
- package/dist/core/http-client/types.d.ts +6 -0
- package/dist/core/http-client/types.d.ts.map +1 -0
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/socket-client-manager/index.d.ts +1 -0
- package/dist/core/socket-client-manager/index.d.ts.map +1 -1
- package/dist/core/socket-client-manager/install.d.ts +6 -0
- package/dist/core/socket-client-manager/install.d.ts.map +1 -0
- package/dist/core/store/constants.d.ts +2 -0
- package/dist/core/store/constants.d.ts.map +1 -0
- package/dist/core/store/{module.d.ts → create.d.ts} +12 -7
- package/dist/core/store/create.d.ts.map +1 -0
- package/dist/core/store/index.d.ts +4 -2
- package/dist/core/store/index.d.ts.map +1 -1
- package/dist/core/store/install.d.ts +4 -0
- package/dist/core/store/install.d.ts.map +1 -0
- package/dist/core/store/singleton.d.ts +6 -7
- package/dist/core/store/singleton.d.ts.map +1 -1
- package/dist/core/store/types.d.ts +27 -0
- package/dist/core/store/types.d.ts.map +1 -0
- package/dist/core/vuelidate.d.ts +1 -1
- package/dist/core/vuelidate.d.ts.map +1 -1
- package/dist/index.cjs +1414 -550
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +1411 -559
- package/dist/index.mjs.map +1 -1
- package/dist/module.d.ts +5 -0
- package/dist/module.d.ts.map +1 -0
- package/dist/types.d.ts +11 -8
- package/dist/types.d.ts.map +1 -1
- package/package.json +16 -13
- package/dist/core/api-client.d.ts +0 -6
- package/dist/core/api-client.d.ts.map +0 -1
- package/dist/core/store/module.d.ts.map +0 -1
- package/dist/core/store/type.d.ts +0 -13
- package/dist/core/store/type.d.ts.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -2,152 +2,1167 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var smob = require('smob');
|
|
6
5
|
var vue = require('vue');
|
|
7
6
|
var coreKit = require('@authup/core-kit');
|
|
7
|
+
var coreHttpKit = require('@authup/core-http-kit');
|
|
8
8
|
var kit = require('@authup/kit');
|
|
9
|
+
var smob = require('smob');
|
|
9
10
|
var listControls = require('@vuecs/list-controls');
|
|
10
|
-
var
|
|
11
|
+
var coreRealtimeKit = require('@authup/core-realtime-kit');
|
|
11
12
|
var rapiq = require('rapiq');
|
|
12
13
|
var formControls = require('@vuecs/form-controls');
|
|
13
14
|
var vuelidate = require('@ilingo/vuelidate');
|
|
14
15
|
var validators = require('@vuelidate/validators');
|
|
15
16
|
var useVuelidate = require('@vuelidate/core');
|
|
16
17
|
var pagination = require('@vuecs/pagination');
|
|
18
|
+
var Cookie = require('universal-cookie');
|
|
17
19
|
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
var isVue2 = false;
|
|
21
|
+
function set(target, key, val) {
|
|
22
|
+
if (Array.isArray(target)) {
|
|
23
|
+
target.length = Math.max(target.length, key);
|
|
24
|
+
target.splice(key, 1, val);
|
|
25
|
+
return val;
|
|
26
|
+
}
|
|
27
|
+
target[key] = val;
|
|
28
|
+
return val;
|
|
29
|
+
}
|
|
30
|
+
function del(target, key) {
|
|
31
|
+
if (Array.isArray(target)) {
|
|
32
|
+
target.splice(key, 1);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
delete target[key];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* setActivePinia must be called to handle SSR at the top of functions like
|
|
40
|
+
* `fetch`, `setup`, `serverPrefetch` and others
|
|
41
|
+
*/ let activePinia;
|
|
42
|
+
/**
|
|
43
|
+
* Sets or unsets the active pinia. Used in SSR and internally when calling
|
|
44
|
+
* actions and getters
|
|
45
|
+
*
|
|
46
|
+
* @param pinia - Pinia instance
|
|
47
|
+
*/ // @ts-expect-error: cannot constrain the type of the return
|
|
48
|
+
const setActivePinia = (pinia)=>activePinia = pinia;
|
|
49
|
+
const piniaSymbol = process.env.NODE_ENV !== 'production' ? Symbol('pinia') : /* istanbul ignore next */ Symbol();
|
|
50
|
+
function isPlainObject(// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
51
|
+
o) {
|
|
52
|
+
return o && typeof o === 'object' && Object.prototype.toString.call(o) === '[object Object]' && typeof o.toJSON !== 'function';
|
|
53
|
+
}
|
|
54
|
+
// type DeepReadonly<T> = { readonly [P in keyof T]: DeepReadonly<T[P]> }
|
|
55
|
+
// TODO: can we change these to numbers?
|
|
56
|
+
/**
|
|
57
|
+
* Possible types for SubscriptionCallback
|
|
58
|
+
*/ var MutationType;
|
|
59
|
+
(function(MutationType) {
|
|
60
|
+
/**
|
|
61
|
+
* Direct mutation of the state:
|
|
62
|
+
*
|
|
63
|
+
* - `store.name = 'new name'`
|
|
64
|
+
* - `store.$state.name = 'new name'`
|
|
65
|
+
* - `store.list.push('new item')`
|
|
66
|
+
*/ MutationType["direct"] = "direct";
|
|
67
|
+
/**
|
|
68
|
+
* Mutated the state with `$patch` and an object
|
|
69
|
+
*
|
|
70
|
+
* - `store.$patch({ name: 'newName' })`
|
|
71
|
+
*/ MutationType["patchObject"] = "patch object";
|
|
72
|
+
/**
|
|
73
|
+
* Mutated the state with `$patch` and a function
|
|
74
|
+
*
|
|
75
|
+
* - `store.$patch(state => state.name = 'newName')`
|
|
76
|
+
*/ MutationType["patchFunction"] = "patch function";
|
|
77
|
+
// maybe reset? for $state = {} and $reset
|
|
78
|
+
})(MutationType || (MutationType = {}));
|
|
79
|
+
const IS_CLIENT = typeof window !== 'undefined';
|
|
80
|
+
/**
|
|
81
|
+
* Should we add the devtools plugins.
|
|
82
|
+
* - only if dev mode or forced through the prod devtools flag
|
|
83
|
+
* - not in test
|
|
84
|
+
* - only if window exists (could change in the future)
|
|
85
|
+
*/ const USE_DEVTOOLS = (process.env.NODE_ENV !== 'production' || typeof __VUE_PROD_DEVTOOLS__ !== 'undefined' && __VUE_PROD_DEVTOOLS__) && !(process.env.NODE_ENV === 'test') && IS_CLIENT;
|
|
86
|
+
/**
|
|
87
|
+
* Mutates in place `newState` with `oldState` to _hot update_ it. It will
|
|
88
|
+
* remove any key not existing in `newState` and recursively merge plain
|
|
89
|
+
* objects.
|
|
90
|
+
*
|
|
91
|
+
* @param newState - new state object to be patched
|
|
92
|
+
* @param oldState - old state that should be used to patch newState
|
|
93
|
+
* @returns - newState
|
|
94
|
+
*/ function patchObject(newState, oldState) {
|
|
95
|
+
// no need to go through symbols because they cannot be serialized anyway
|
|
96
|
+
for(const key in oldState){
|
|
97
|
+
const subPatch = oldState[key];
|
|
98
|
+
// skip the whole sub tree
|
|
99
|
+
if (!(key in newState)) {
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
const targetValue = newState[key];
|
|
103
|
+
if (isPlainObject(targetValue) && isPlainObject(subPatch) && !vue.isRef(subPatch) && !vue.isReactive(subPatch)) {
|
|
104
|
+
newState[key] = patchObject(targetValue, subPatch);
|
|
105
|
+
} else {
|
|
106
|
+
// objects are either a bit more complex (e.g. refs) or primitives, so we
|
|
107
|
+
// just set the whole thing
|
|
108
|
+
{
|
|
109
|
+
newState[key] = subPatch;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return newState;
|
|
114
|
+
}
|
|
115
|
+
const noop$1 = ()=>{};
|
|
116
|
+
function addSubscription(subscriptions, callback, detached, onCleanup = noop$1) {
|
|
117
|
+
subscriptions.push(callback);
|
|
118
|
+
const removeSubscription = ()=>{
|
|
119
|
+
const idx = subscriptions.indexOf(callback);
|
|
120
|
+
if (idx > -1) {
|
|
121
|
+
subscriptions.splice(idx, 1);
|
|
122
|
+
onCleanup();
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
if (!detached && vue.getCurrentScope()) {
|
|
126
|
+
vue.onScopeDispose(removeSubscription);
|
|
127
|
+
}
|
|
128
|
+
return removeSubscription;
|
|
129
|
+
}
|
|
130
|
+
function triggerSubscriptions(subscriptions, ...args) {
|
|
131
|
+
subscriptions.slice().forEach((callback)=>{
|
|
132
|
+
callback(...args);
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
const fallbackRunWithContext = (fn)=>fn();
|
|
136
|
+
function mergeReactiveObjects(target, patchToApply) {
|
|
137
|
+
// Handle Map instances
|
|
138
|
+
if (target instanceof Map && patchToApply instanceof Map) {
|
|
139
|
+
patchToApply.forEach((value, key)=>target.set(key, value));
|
|
140
|
+
}
|
|
141
|
+
// Handle Set instances
|
|
142
|
+
if (target instanceof Set && patchToApply instanceof Set) {
|
|
143
|
+
patchToApply.forEach(target.add, target);
|
|
144
|
+
}
|
|
145
|
+
// no need to go through symbols because they cannot be serialized anyway
|
|
146
|
+
for(const key in patchToApply){
|
|
147
|
+
if (!patchToApply.hasOwnProperty(key)) continue;
|
|
148
|
+
const subPatch = patchToApply[key];
|
|
149
|
+
const targetValue = target[key];
|
|
150
|
+
if (isPlainObject(targetValue) && isPlainObject(subPatch) && target.hasOwnProperty(key) && !vue.isRef(subPatch) && !vue.isReactive(subPatch)) {
|
|
151
|
+
// NOTE: here I wanted to warn about inconsistent types but it's not possible because in setup stores one might
|
|
152
|
+
// start the value of a property as a certain type e.g. a Map, and then for some reason, during SSR, change that
|
|
153
|
+
// to `undefined`. When trying to hydrate, we want to override the Map with `undefined`.
|
|
154
|
+
target[key] = mergeReactiveObjects(targetValue, subPatch);
|
|
155
|
+
} else {
|
|
156
|
+
// @ts-expect-error: subPatch is a valid value
|
|
157
|
+
target[key] = subPatch;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return target;
|
|
161
|
+
}
|
|
162
|
+
const skipHydrateSymbol = process.env.NODE_ENV !== 'production' ? Symbol('pinia:skipHydration') : /* istanbul ignore next */ Symbol();
|
|
163
|
+
/**
|
|
164
|
+
* Returns whether a value should be hydrated
|
|
165
|
+
*
|
|
166
|
+
* @param obj - target variable
|
|
167
|
+
* @returns true if `obj` should be hydrated
|
|
168
|
+
*/ function shouldHydrate(obj) {
|
|
169
|
+
return !isPlainObject(obj) || !obj.hasOwnProperty(skipHydrateSymbol);
|
|
170
|
+
}
|
|
171
|
+
const { assign } = Object;
|
|
172
|
+
function isComputed(o) {
|
|
173
|
+
return !!(vue.isRef(o) && o.effect);
|
|
174
|
+
}
|
|
175
|
+
function createOptionsStore(id, options, pinia, hot) {
|
|
176
|
+
const { state, actions, getters } = options;
|
|
177
|
+
const initialState = pinia.state.value[id];
|
|
178
|
+
let store;
|
|
179
|
+
function setup() {
|
|
180
|
+
if (!initialState && (!(process.env.NODE_ENV !== 'production') || !hot)) {
|
|
181
|
+
/* istanbul ignore if */ {
|
|
182
|
+
pinia.state.value[id] = state ? state() : {};
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
// avoid creating a state in pinia.state.value
|
|
186
|
+
const localState = process.env.NODE_ENV !== 'production' && hot ? vue.toRefs(vue.ref(state ? state() : {}).value) : vue.toRefs(pinia.state.value[id]);
|
|
187
|
+
return assign(localState, actions, Object.keys(getters || {}).reduce((computedGetters, name)=>{
|
|
188
|
+
if (process.env.NODE_ENV !== 'production' && name in localState) {
|
|
189
|
+
console.warn(`[🍍]: A getter cannot have the same name as another state property. Rename one of them. Found with "${name}" in store "${id}".`);
|
|
190
|
+
}
|
|
191
|
+
computedGetters[name] = vue.markRaw(vue.computed(()=>{
|
|
192
|
+
setActivePinia(pinia);
|
|
193
|
+
// it was created just before
|
|
194
|
+
const store = pinia._s.get(id);
|
|
195
|
+
// @ts-expect-error
|
|
196
|
+
// return getters![name].call(context, context)
|
|
197
|
+
// TODO: avoid reading the getter while assigning with a global variable
|
|
198
|
+
return getters[name].call(store, store);
|
|
199
|
+
}));
|
|
200
|
+
return computedGetters;
|
|
201
|
+
}, {}));
|
|
202
|
+
}
|
|
203
|
+
store = createSetupStore(id, setup, options, pinia, hot, true);
|
|
204
|
+
return store;
|
|
205
|
+
}
|
|
206
|
+
function createSetupStore($id, setup, options = {}, pinia, hot, isOptionsStore) {
|
|
207
|
+
let scope;
|
|
208
|
+
const optionsForPlugin = assign({
|
|
209
|
+
actions: {}
|
|
210
|
+
}, options);
|
|
211
|
+
/* istanbul ignore if */ if (process.env.NODE_ENV !== 'production' && !pinia._e.active) {
|
|
212
|
+
throw new Error('Pinia destroyed');
|
|
213
|
+
}
|
|
214
|
+
// watcher options for $subscribe
|
|
215
|
+
const $subscribeOptions = {
|
|
216
|
+
deep: true
|
|
217
|
+
};
|
|
218
|
+
/* istanbul ignore else */ if (process.env.NODE_ENV !== 'production' && !isVue2) {
|
|
219
|
+
$subscribeOptions.onTrigger = (event)=>{
|
|
220
|
+
/* istanbul ignore else */ if (isListening) {
|
|
221
|
+
debuggerEvents = event;
|
|
222
|
+
// avoid triggering this while the store is being built and the state is being set in pinia
|
|
223
|
+
} else if (isListening == false && !store._hotUpdating) {
|
|
224
|
+
// let patch send all the events together later
|
|
225
|
+
/* istanbul ignore else */ if (Array.isArray(debuggerEvents)) {
|
|
226
|
+
debuggerEvents.push(event);
|
|
227
|
+
} else {
|
|
228
|
+
console.error('🍍 debuggerEvents should be an array. This is most likely an internal Pinia bug.');
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
// internal state
|
|
234
|
+
let isListening; // set to true at the end
|
|
235
|
+
let isSyncListening; // set to true at the end
|
|
236
|
+
let subscriptions = [];
|
|
237
|
+
let actionSubscriptions = [];
|
|
238
|
+
let debuggerEvents;
|
|
239
|
+
const initialState = pinia.state.value[$id];
|
|
240
|
+
// avoid setting the state for option stores if it is set
|
|
241
|
+
// by the setup
|
|
242
|
+
if (!isOptionsStore && !initialState && (!(process.env.NODE_ENV !== 'production') || !hot)) {
|
|
243
|
+
/* istanbul ignore if */ {
|
|
244
|
+
pinia.state.value[$id] = {};
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
const hotState = vue.ref({});
|
|
248
|
+
// avoid triggering too many listeners
|
|
249
|
+
// https://github.com/vuejs/pinia/issues/1129
|
|
250
|
+
let activeListener;
|
|
251
|
+
function $patch(partialStateOrMutator) {
|
|
252
|
+
let subscriptionMutation;
|
|
253
|
+
isListening = isSyncListening = false;
|
|
254
|
+
// reset the debugger events since patches are sync
|
|
255
|
+
/* istanbul ignore else */ if (process.env.NODE_ENV !== 'production') {
|
|
256
|
+
debuggerEvents = [];
|
|
257
|
+
}
|
|
258
|
+
if (typeof partialStateOrMutator === 'function') {
|
|
259
|
+
partialStateOrMutator(pinia.state.value[$id]);
|
|
260
|
+
subscriptionMutation = {
|
|
261
|
+
type: MutationType.patchFunction,
|
|
262
|
+
storeId: $id,
|
|
263
|
+
events: debuggerEvents
|
|
264
|
+
};
|
|
265
|
+
} else {
|
|
266
|
+
mergeReactiveObjects(pinia.state.value[$id], partialStateOrMutator);
|
|
267
|
+
subscriptionMutation = {
|
|
268
|
+
type: MutationType.patchObject,
|
|
269
|
+
payload: partialStateOrMutator,
|
|
270
|
+
storeId: $id,
|
|
271
|
+
events: debuggerEvents
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
const myListenerId = activeListener = Symbol();
|
|
275
|
+
vue.nextTick().then(()=>{
|
|
276
|
+
if (activeListener === myListenerId) {
|
|
277
|
+
isListening = true;
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
isSyncListening = true;
|
|
281
|
+
// because we paused the watcher, we need to manually call the subscriptions
|
|
282
|
+
triggerSubscriptions(subscriptions, subscriptionMutation, pinia.state.value[$id]);
|
|
283
|
+
}
|
|
284
|
+
const $reset = isOptionsStore ? function $reset() {
|
|
285
|
+
const { state } = options;
|
|
286
|
+
const newState = state ? state() : {};
|
|
287
|
+
// we use a patch to group all changes into one single subscription
|
|
288
|
+
this.$patch(($state)=>{
|
|
289
|
+
assign($state, newState);
|
|
290
|
+
});
|
|
291
|
+
} : /* istanbul ignore next */ process.env.NODE_ENV !== 'production' ? ()=>{
|
|
292
|
+
throw new Error(`🍍: Store "${$id}" is built using the setup syntax and does not implement $reset().`);
|
|
293
|
+
} : noop$1;
|
|
294
|
+
function $dispose() {
|
|
295
|
+
scope.stop();
|
|
296
|
+
subscriptions = [];
|
|
297
|
+
actionSubscriptions = [];
|
|
298
|
+
pinia._s.delete($id);
|
|
299
|
+
}
|
|
23
300
|
/**
|
|
24
|
-
*
|
|
301
|
+
* Wraps an action to handle subscriptions.
|
|
25
302
|
*
|
|
26
|
-
* @param
|
|
27
|
-
|
|
28
|
-
|
|
303
|
+
* @param name - name of the action
|
|
304
|
+
* @param action - action to wrap
|
|
305
|
+
* @returns a wrapped action to handle subscriptions
|
|
306
|
+
*/ function wrapAction(name, action) {
|
|
307
|
+
return function() {
|
|
308
|
+
setActivePinia(pinia);
|
|
309
|
+
const args = Array.from(arguments);
|
|
310
|
+
const afterCallbackList = [];
|
|
311
|
+
const onErrorCallbackList = [];
|
|
312
|
+
function after(callback) {
|
|
313
|
+
afterCallbackList.push(callback);
|
|
314
|
+
}
|
|
315
|
+
function onError(callback) {
|
|
316
|
+
onErrorCallbackList.push(callback);
|
|
317
|
+
}
|
|
318
|
+
// @ts-expect-error
|
|
319
|
+
triggerSubscriptions(actionSubscriptions, {
|
|
320
|
+
args,
|
|
321
|
+
name,
|
|
322
|
+
store,
|
|
323
|
+
after,
|
|
324
|
+
onError
|
|
325
|
+
});
|
|
326
|
+
let ret;
|
|
327
|
+
try {
|
|
328
|
+
ret = action.apply(this && this.$id === $id ? this : store, args);
|
|
329
|
+
// handle sync errors
|
|
330
|
+
} catch (error) {
|
|
331
|
+
triggerSubscriptions(onErrorCallbackList, error);
|
|
332
|
+
throw error;
|
|
333
|
+
}
|
|
334
|
+
if (ret instanceof Promise) {
|
|
335
|
+
return ret.then((value)=>{
|
|
336
|
+
triggerSubscriptions(afterCallbackList, value);
|
|
337
|
+
return value;
|
|
338
|
+
}).catch((error)=>{
|
|
339
|
+
triggerSubscriptions(onErrorCallbackList, error);
|
|
340
|
+
return Promise.reject(error);
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
// trigger after callbacks
|
|
344
|
+
triggerSubscriptions(afterCallbackList, ret);
|
|
345
|
+
return ret;
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
const _hmrPayload = /*#__PURE__*/ vue.markRaw({
|
|
349
|
+
actions: {},
|
|
350
|
+
getters: {},
|
|
351
|
+
state: [],
|
|
352
|
+
hotState
|
|
353
|
+
});
|
|
354
|
+
const partialStore = {
|
|
355
|
+
_p: pinia,
|
|
356
|
+
// _s: scope,
|
|
357
|
+
$id,
|
|
358
|
+
$onAction: addSubscription.bind(null, actionSubscriptions),
|
|
359
|
+
$patch,
|
|
360
|
+
$reset,
|
|
361
|
+
$subscribe (callback, options = {}) {
|
|
362
|
+
const removeSubscription = addSubscription(subscriptions, callback, options.detached, ()=>stopWatcher());
|
|
363
|
+
const stopWatcher = scope.run(()=>vue.watch(()=>pinia.state.value[$id], (state)=>{
|
|
364
|
+
if (options.flush === 'sync' ? isSyncListening : isListening) {
|
|
365
|
+
callback({
|
|
366
|
+
storeId: $id,
|
|
367
|
+
type: MutationType.direct,
|
|
368
|
+
events: debuggerEvents
|
|
369
|
+
}, state);
|
|
370
|
+
}
|
|
371
|
+
}, assign({}, $subscribeOptions, options)));
|
|
372
|
+
return removeSubscription;
|
|
373
|
+
},
|
|
374
|
+
$dispose
|
|
375
|
+
};
|
|
376
|
+
const store = vue.reactive(process.env.NODE_ENV !== 'production' || USE_DEVTOOLS ? assign({
|
|
377
|
+
_hmrPayload,
|
|
378
|
+
_customProperties: vue.markRaw(new Set())
|
|
379
|
+
}, partialStore) : partialStore);
|
|
380
|
+
// store the partial store now so the setup of stores can instantiate each other before they are finished without
|
|
381
|
+
// creating infinite loops.
|
|
382
|
+
pinia._s.set($id, store);
|
|
383
|
+
const runWithContext = pinia._a && pinia._a.runWithContext || fallbackRunWithContext;
|
|
384
|
+
// TODO: idea create skipSerialize that marks properties as non serializable and they are skipped
|
|
385
|
+
const setupStore = runWithContext(()=>pinia._e.run(()=>(scope = vue.effectScope()).run(setup)));
|
|
386
|
+
// overwrite existing actions to support $onAction
|
|
387
|
+
for(const key in setupStore){
|
|
388
|
+
const prop = setupStore[key];
|
|
389
|
+
if (vue.isRef(prop) && !isComputed(prop) || vue.isReactive(prop)) {
|
|
390
|
+
// mark it as a piece of state to be serialized
|
|
391
|
+
if (process.env.NODE_ENV !== 'production' && hot) {
|
|
392
|
+
set(hotState.value, key, vue.toRef(setupStore, key));
|
|
393
|
+
// createOptionStore directly sets the state in pinia.state.value so we
|
|
394
|
+
// can just skip that
|
|
395
|
+
} else if (!isOptionsStore) {
|
|
396
|
+
// in setup stores we must hydrate the state and sync pinia state tree with the refs the user just created
|
|
397
|
+
if (initialState && shouldHydrate(prop)) {
|
|
398
|
+
if (vue.isRef(prop)) {
|
|
399
|
+
prop.value = initialState[key];
|
|
400
|
+
} else {
|
|
401
|
+
// probably a reactive object, lets recursively assign
|
|
402
|
+
// @ts-expect-error: prop is unknown
|
|
403
|
+
mergeReactiveObjects(prop, initialState[key]);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
// transfer the ref to the pinia state to keep everything in sync
|
|
407
|
+
/* istanbul ignore if */ {
|
|
408
|
+
pinia.state.value[$id][key] = prop;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
/* istanbul ignore else */ if (process.env.NODE_ENV !== 'production') {
|
|
412
|
+
_hmrPayload.state.push(key);
|
|
413
|
+
}
|
|
414
|
+
// action
|
|
415
|
+
} else if (typeof prop === 'function') {
|
|
416
|
+
// @ts-expect-error: we are overriding the function we avoid wrapping if
|
|
417
|
+
const actionValue = process.env.NODE_ENV !== 'production' && hot ? prop : wrapAction(key, prop);
|
|
418
|
+
// this a hot module replacement store because the hotUpdate method needs
|
|
419
|
+
// to do it with the right context
|
|
420
|
+
/* istanbul ignore if */ {
|
|
421
|
+
// @ts-expect-error
|
|
422
|
+
setupStore[key] = actionValue;
|
|
423
|
+
}
|
|
424
|
+
/* istanbul ignore else */ if (process.env.NODE_ENV !== 'production') {
|
|
425
|
+
_hmrPayload.actions[key] = prop;
|
|
426
|
+
}
|
|
427
|
+
// list actions so they can be used in plugins
|
|
428
|
+
// @ts-expect-error
|
|
429
|
+
optionsForPlugin.actions[key] = prop;
|
|
430
|
+
} else if (process.env.NODE_ENV !== 'production') {
|
|
431
|
+
// add getters for devtools
|
|
432
|
+
if (isComputed(prop)) {
|
|
433
|
+
_hmrPayload.getters[key] = isOptionsStore ? options.getters[key] : prop;
|
|
434
|
+
if (IS_CLIENT) {
|
|
435
|
+
const getters = setupStore._getters || // @ts-expect-error: same
|
|
436
|
+
(setupStore._getters = vue.markRaw([]));
|
|
437
|
+
getters.push(key);
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
// add the state, getters, and action properties
|
|
443
|
+
/* istanbul ignore if */ {
|
|
444
|
+
assign(store, setupStore);
|
|
445
|
+
// allows retrieving reactive objects with `storeToRefs()`. Must be called after assigning to the reactive object.
|
|
446
|
+
// Make `storeToRefs()` work with `reactive()` #799
|
|
447
|
+
assign(vue.toRaw(store), setupStore);
|
|
448
|
+
}
|
|
449
|
+
// use this instead of a computed with setter to be able to create it anywhere
|
|
450
|
+
// without linking the computed lifespan to wherever the store is first
|
|
451
|
+
// created.
|
|
452
|
+
Object.defineProperty(store, '$state', {
|
|
453
|
+
get: ()=>process.env.NODE_ENV !== 'production' && hot ? hotState.value : pinia.state.value[$id],
|
|
454
|
+
set: (state)=>{
|
|
455
|
+
/* istanbul ignore if */ if (process.env.NODE_ENV !== 'production' && hot) {
|
|
456
|
+
throw new Error('cannot set hotState');
|
|
457
|
+
}
|
|
458
|
+
$patch(($state)=>{
|
|
459
|
+
assign($state, state);
|
|
460
|
+
});
|
|
461
|
+
}
|
|
462
|
+
});
|
|
463
|
+
// add the hotUpdate before plugins to allow them to override it
|
|
464
|
+
/* istanbul ignore else */ if (process.env.NODE_ENV !== 'production') {
|
|
465
|
+
store._hotUpdate = vue.markRaw((newStore)=>{
|
|
466
|
+
store._hotUpdating = true;
|
|
467
|
+
newStore._hmrPayload.state.forEach((stateKey)=>{
|
|
468
|
+
if (stateKey in store.$state) {
|
|
469
|
+
const newStateTarget = newStore.$state[stateKey];
|
|
470
|
+
const oldStateSource = store.$state[stateKey];
|
|
471
|
+
if (typeof newStateTarget === 'object' && isPlainObject(newStateTarget) && isPlainObject(oldStateSource)) {
|
|
472
|
+
patchObject(newStateTarget, oldStateSource);
|
|
473
|
+
} else {
|
|
474
|
+
// transfer the ref
|
|
475
|
+
newStore.$state[stateKey] = oldStateSource;
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
// patch direct access properties to allow store.stateProperty to work as
|
|
479
|
+
// store.$state.stateProperty
|
|
480
|
+
set(store, stateKey, vue.toRef(newStore.$state, stateKey));
|
|
481
|
+
});
|
|
482
|
+
// remove deleted state properties
|
|
483
|
+
Object.keys(store.$state).forEach((stateKey)=>{
|
|
484
|
+
if (!(stateKey in newStore.$state)) {
|
|
485
|
+
del(store, stateKey);
|
|
486
|
+
}
|
|
487
|
+
});
|
|
488
|
+
// avoid devtools logging this as a mutation
|
|
489
|
+
isListening = false;
|
|
490
|
+
isSyncListening = false;
|
|
491
|
+
pinia.state.value[$id] = vue.toRef(newStore._hmrPayload, 'hotState');
|
|
492
|
+
isSyncListening = true;
|
|
493
|
+
vue.nextTick().then(()=>{
|
|
494
|
+
isListening = true;
|
|
495
|
+
});
|
|
496
|
+
for(const actionName in newStore._hmrPayload.actions){
|
|
497
|
+
const action = newStore[actionName];
|
|
498
|
+
set(store, actionName, wrapAction(actionName, action));
|
|
499
|
+
}
|
|
500
|
+
// TODO: does this work in both setup and option store?
|
|
501
|
+
for(const getterName in newStore._hmrPayload.getters){
|
|
502
|
+
const getter = newStore._hmrPayload.getters[getterName];
|
|
503
|
+
const getterValue = isOptionsStore ? vue.computed(()=>{
|
|
504
|
+
setActivePinia(pinia);
|
|
505
|
+
return getter.call(store, store);
|
|
506
|
+
}) : getter;
|
|
507
|
+
set(store, getterName, getterValue);
|
|
508
|
+
}
|
|
509
|
+
// remove deleted getters
|
|
510
|
+
Object.keys(store._hmrPayload.getters).forEach((key)=>{
|
|
511
|
+
if (!(key in newStore._hmrPayload.getters)) {
|
|
512
|
+
del(store, key);
|
|
513
|
+
}
|
|
514
|
+
});
|
|
515
|
+
// remove old actions
|
|
516
|
+
Object.keys(store._hmrPayload.actions).forEach((key)=>{
|
|
517
|
+
if (!(key in newStore._hmrPayload.actions)) {
|
|
518
|
+
del(store, key);
|
|
519
|
+
}
|
|
520
|
+
});
|
|
521
|
+
// update the values used in devtools and to allow deleting new properties later on
|
|
522
|
+
store._hmrPayload = newStore._hmrPayload;
|
|
523
|
+
store._getters = newStore._getters;
|
|
524
|
+
store._hotUpdating = false;
|
|
525
|
+
});
|
|
526
|
+
}
|
|
527
|
+
if (USE_DEVTOOLS) {
|
|
528
|
+
const nonEnumerable = {
|
|
529
|
+
writable: true,
|
|
530
|
+
configurable: true,
|
|
531
|
+
// avoid warning on devtools trying to display this property
|
|
532
|
+
enumerable: false
|
|
533
|
+
};
|
|
534
|
+
[
|
|
535
|
+
'_p',
|
|
536
|
+
'_hmrPayload',
|
|
537
|
+
'_getters',
|
|
538
|
+
'_customProperties'
|
|
539
|
+
].forEach((p)=>{
|
|
540
|
+
Object.defineProperty(store, p, assign({
|
|
541
|
+
value: store[p]
|
|
542
|
+
}, nonEnumerable));
|
|
543
|
+
});
|
|
544
|
+
}
|
|
545
|
+
// apply all plugins
|
|
546
|
+
pinia._p.forEach((extender)=>{
|
|
547
|
+
/* istanbul ignore else */ if (USE_DEVTOOLS) {
|
|
548
|
+
const extensions = scope.run(()=>extender({
|
|
549
|
+
store,
|
|
550
|
+
app: pinia._a,
|
|
551
|
+
pinia,
|
|
552
|
+
options: optionsForPlugin
|
|
553
|
+
}));
|
|
554
|
+
Object.keys(extensions || {}).forEach((key)=>store._customProperties.add(key));
|
|
555
|
+
assign(store, extensions);
|
|
556
|
+
} else {
|
|
557
|
+
assign(store, scope.run(()=>extender({
|
|
558
|
+
store,
|
|
559
|
+
app: pinia._a,
|
|
560
|
+
pinia,
|
|
561
|
+
options: optionsForPlugin
|
|
562
|
+
})));
|
|
563
|
+
}
|
|
564
|
+
});
|
|
565
|
+
if (process.env.NODE_ENV !== 'production' && store.$state && typeof store.$state === 'object' && typeof store.$state.constructor === 'function' && !store.$state.constructor.toString().includes('[native code]')) {
|
|
566
|
+
console.warn(`[🍍]: The "state" must be a plain object. It cannot be\n` + `\tstate: () => new MyClass()\n` + `Found in store "${store.$id}".`);
|
|
567
|
+
}
|
|
568
|
+
// only apply hydrate to option stores with an initial state in pinia
|
|
569
|
+
if (initialState && isOptionsStore && options.hydrate) {
|
|
570
|
+
options.hydrate(store.$state, initialState);
|
|
571
|
+
}
|
|
572
|
+
isListening = true;
|
|
573
|
+
isSyncListening = true;
|
|
574
|
+
return store;
|
|
575
|
+
}
|
|
576
|
+
function defineStore(// TODO: add proper types from above
|
|
577
|
+
idOrOptions, setup, setupOptions) {
|
|
578
|
+
let id;
|
|
579
|
+
let options;
|
|
580
|
+
const isSetupStore = typeof setup === 'function';
|
|
581
|
+
{
|
|
582
|
+
id = idOrOptions;
|
|
583
|
+
// the option store setup will contain the actual options in this case
|
|
584
|
+
options = isSetupStore ? setupOptions : setup;
|
|
585
|
+
}
|
|
586
|
+
function useStore(pinia, hot) {
|
|
587
|
+
const hasContext = vue.hasInjectionContext();
|
|
588
|
+
pinia = // in test mode, ignore the argument provided as we can always retrieve a
|
|
589
|
+
// pinia instance with getActivePinia()
|
|
590
|
+
(process.env.NODE_ENV === 'test' && activePinia && activePinia._testing ? null : pinia) || (hasContext ? vue.inject(piniaSymbol, null) : null);
|
|
591
|
+
if (pinia) setActivePinia(pinia);
|
|
592
|
+
if (process.env.NODE_ENV !== 'production' && !activePinia) {
|
|
593
|
+
throw new Error(`[🍍]: "getActivePinia()" was called but there was no active Pinia. Are you trying to use a store before calling "app.use(pinia)"?\n` + `See https://pinia.vuejs.org/core-concepts/outside-component-usage.html for help.\n` + `This will fail in production.`);
|
|
594
|
+
}
|
|
595
|
+
pinia = activePinia;
|
|
596
|
+
if (!pinia._s.has(id)) {
|
|
597
|
+
// creating the store registers it in `pinia._s`
|
|
598
|
+
if (isSetupStore) {
|
|
599
|
+
createSetupStore(id, setup, options, pinia);
|
|
600
|
+
} else {
|
|
601
|
+
createOptionsStore(id, options, pinia);
|
|
602
|
+
}
|
|
603
|
+
/* istanbul ignore else */ if (process.env.NODE_ENV !== 'production') {
|
|
604
|
+
// @ts-expect-error: not the right inferred type
|
|
605
|
+
useStore._pinia = pinia;
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
const store = pinia._s.get(id);
|
|
609
|
+
if (process.env.NODE_ENV !== 'production' && hot) {
|
|
610
|
+
const hotId = '__hot:' + id;
|
|
611
|
+
const newStore = isSetupStore ? createSetupStore(hotId, setup, options, pinia, true) : createOptionsStore(hotId, assign({}, options), pinia, true);
|
|
612
|
+
hot._hotUpdate(newStore);
|
|
613
|
+
// cleanup the state properties and the store from the cache
|
|
614
|
+
delete pinia.state.value[hotId];
|
|
615
|
+
pinia._s.delete(hotId);
|
|
616
|
+
}
|
|
617
|
+
if (process.env.NODE_ENV !== 'production' && IS_CLIENT) {
|
|
618
|
+
const currentInstance = vue.getCurrentInstance();
|
|
619
|
+
// save stores in instances to access them devtools
|
|
620
|
+
if (currentInstance && currentInstance.proxy && // avoid adding stores that are just built for hot module replacement
|
|
621
|
+
!hot) {
|
|
622
|
+
const vm = currentInstance.proxy;
|
|
623
|
+
const cache = '_pStores' in vm ? vm._pStores : vm._pStores = {};
|
|
624
|
+
cache[id] = store;
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
// StoreGeneric cannot be casted towards Store
|
|
628
|
+
return store;
|
|
629
|
+
}
|
|
630
|
+
useStore.$id = id;
|
|
631
|
+
return useStore;
|
|
632
|
+
}
|
|
633
|
+
/**
|
|
634
|
+
* Creates an object of references with all the state, getters, and plugin-added
|
|
635
|
+
* state properties of the store. Similar to `toRefs()` but specifically
|
|
636
|
+
* designed for Pinia stores so methods and non reactive properties are
|
|
637
|
+
* completely ignored.
|
|
638
|
+
*
|
|
639
|
+
* @param store - store to extract the refs from
|
|
640
|
+
*/ function storeToRefs$1(store) {
|
|
641
|
+
// See https://github.com/vuejs/pinia/issues/852
|
|
642
|
+
// It's easier to just use toRefs() even if it includes more stuff
|
|
643
|
+
{
|
|
644
|
+
store = vue.toRaw(store);
|
|
645
|
+
const refs = {};
|
|
646
|
+
for(const key in store){
|
|
647
|
+
const value = store[key];
|
|
648
|
+
if (vue.isRef(value) || vue.isReactive(value)) {
|
|
649
|
+
// @ts-expect-error: the key is state or getter
|
|
650
|
+
refs[key] = // ---
|
|
651
|
+
vue.toRef(store, key);
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
return refs;
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
function inject$1(key, instance) {
|
|
659
|
+
if (instance && instance._context && instance._context.provides && instance._context.provides[key]) {
|
|
660
|
+
return instance._context.provides[key];
|
|
661
|
+
}
|
|
662
|
+
if (vue.hasInjectionContext()) {
|
|
663
|
+
return vue.inject(key, undefined);
|
|
664
|
+
}
|
|
665
|
+
return undefined;
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
function provide(key, value, app) {
|
|
669
|
+
if (typeof app === 'undefined') {
|
|
670
|
+
const val = inject$1(key);
|
|
671
|
+
if (typeof val !== 'undefined') {
|
|
672
|
+
return;
|
|
673
|
+
}
|
|
674
|
+
vue.provide(key, value);
|
|
675
|
+
return;
|
|
676
|
+
}
|
|
677
|
+
if (app && app._context && app._context.provides && app._context.provides[key]) {
|
|
678
|
+
return;
|
|
679
|
+
}
|
|
680
|
+
app.provide(key, value);
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
const HTTPClientSymbol = Symbol.for('AuthupHTTPClient');
|
|
684
|
+
function provideHTTPClient(client, app) {
|
|
685
|
+
provide(HTTPClientSymbol, client, app);
|
|
686
|
+
}
|
|
687
|
+
function hasHTTPClient(app) {
|
|
688
|
+
return !!inject$1(HTTPClientSymbol, app);
|
|
689
|
+
}
|
|
690
|
+
function injectHTTPClient(app) {
|
|
691
|
+
const instance = inject$1(HTTPClientSymbol, app);
|
|
692
|
+
if (!instance) {
|
|
693
|
+
throw new Error('The api client has not been injected.');
|
|
694
|
+
}
|
|
695
|
+
return instance;
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
/*
|
|
699
|
+
* Copyright (c) 2024.
|
|
700
|
+
* Author Peter Placzek (tada5hi)
|
|
701
|
+
* For the full copyright and license information,
|
|
702
|
+
* view the LICENSE file that was distributed with this source code.
|
|
703
|
+
*/ const STORE_ID = 'authup';
|
|
704
|
+
|
|
705
|
+
function createStore(context = {}) {
|
|
706
|
+
const client = new coreHttpKit.Client({
|
|
707
|
+
baseURL: context.baseURL
|
|
708
|
+
});
|
|
709
|
+
const initialized = vue.ref(false);
|
|
710
|
+
const setInitialized = (value)=>{
|
|
711
|
+
initialized.value = value;
|
|
712
|
+
};
|
|
713
|
+
// --------------------------------------------------------------------
|
|
714
|
+
const accessToken = vue.ref(undefined);
|
|
715
|
+
const setAccessToken = (input)=>{
|
|
716
|
+
accessToken.value = input;
|
|
717
|
+
};
|
|
718
|
+
// --------------------------------------------------------------------
|
|
719
|
+
const accessTokenExpireDate = vue.ref(undefined);
|
|
720
|
+
const setAccessTokenExpireDate = (input)=>{
|
|
721
|
+
if (typeof input === 'number' || typeof input === 'string') {
|
|
722
|
+
accessTokenExpireDate.value = new Date(input); // verify microseconds or seconds
|
|
723
|
+
return;
|
|
724
|
+
}
|
|
725
|
+
accessTokenExpireDate.value = input;
|
|
726
|
+
};
|
|
727
|
+
// --------------------------------------------------------------------
|
|
728
|
+
const refreshToken = vue.ref(undefined);
|
|
729
|
+
const setRefreshToken = (input)=>{
|
|
730
|
+
refreshToken.value = input;
|
|
731
|
+
};
|
|
732
|
+
// --------------------------------------------------------------------
|
|
733
|
+
const handleTokenGrantResponse = (response)=>{
|
|
734
|
+
const expireDate = new Date(Date.now() + response.expires_in * 1000);
|
|
735
|
+
setAccessTokenExpireDate(expireDate);
|
|
736
|
+
setAccessToken(response.access_token);
|
|
737
|
+
setRefreshToken(response.refresh_token);
|
|
738
|
+
};
|
|
739
|
+
// --------------------------------------------------------------------
|
|
740
|
+
let refreshTokenPromise;
|
|
741
|
+
const attemptRefreshToken = ()=>{
|
|
742
|
+
if (!refreshToken.value) {
|
|
743
|
+
return Promise.reject(new Error('No refresh token is present.'));
|
|
744
|
+
}
|
|
745
|
+
if (refreshTokenPromise) {
|
|
746
|
+
return refreshTokenPromise;
|
|
747
|
+
}
|
|
748
|
+
refreshTokenPromise = client.token.createWithRefreshToken({
|
|
749
|
+
refresh_token: refreshToken.value
|
|
750
|
+
}).then((r)=>{
|
|
751
|
+
handleTokenGrantResponse(r);
|
|
752
|
+
return r;
|
|
753
|
+
}).finally(()=>{
|
|
754
|
+
refreshTokenPromise = undefined;
|
|
755
|
+
});
|
|
756
|
+
return refreshTokenPromise;
|
|
757
|
+
};
|
|
758
|
+
// --------------------------------------------------------------------
|
|
759
|
+
const user = vue.ref(undefined);
|
|
760
|
+
const userId = vue.computed(()=>user.value ? user.value.id : undefined);
|
|
761
|
+
const userResolved = vue.ref(false);
|
|
762
|
+
const setUser = (entity)=>{
|
|
763
|
+
user.value = entity;
|
|
764
|
+
userResolved.value = !!entity;
|
|
765
|
+
};
|
|
766
|
+
// --------------------------------------------------------------------
|
|
767
|
+
const realm = vue.ref(undefined);
|
|
768
|
+
const realmId = vue.computed(()=>realm.value ? realm.value.id : undefined);
|
|
769
|
+
const realmName = vue.computed(()=>realm.value ? realm.value.name : undefined);
|
|
770
|
+
const realmIsRoot = vue.computed(()=>{
|
|
771
|
+
if (realm.value) {
|
|
772
|
+
return realm.value.name === coreKit.REALM_MASTER_NAME;
|
|
773
|
+
}
|
|
774
|
+
return false;
|
|
775
|
+
});
|
|
776
|
+
const setRealm = (entity)=>{
|
|
777
|
+
realm.value = entity;
|
|
778
|
+
};
|
|
779
|
+
const realmManagement = vue.ref(undefined);
|
|
780
|
+
const realmManagementId = vue.computed(()=>realmManagement.value ? realmManagement.value.id : realmId.value);
|
|
781
|
+
const realmManagementName = vue.computed(()=>realmManagement.value ? realmManagement.value.name : realmName.value);
|
|
782
|
+
const setRealmManagement = (entity)=>{
|
|
783
|
+
realmManagement.value = entity;
|
|
784
|
+
};
|
|
785
|
+
const abilities = new kit.Abilities();
|
|
786
|
+
const tokenInfo = vue.ref(undefined);
|
|
787
|
+
const tokenResolved = vue.ref(false);
|
|
788
|
+
const setTokenInfo = (entity)=>{
|
|
789
|
+
tokenResolved.value = !!entity;
|
|
790
|
+
tokenInfo.value = entity;
|
|
791
|
+
if (!entity) {
|
|
792
|
+
setRealm(undefined);
|
|
793
|
+
setRealmManagement(undefined);
|
|
794
|
+
abilities.set([]);
|
|
795
|
+
return;
|
|
796
|
+
}
|
|
797
|
+
if (entity.exp) {
|
|
798
|
+
const expireDate = new Date(entity.exp * 1000);
|
|
799
|
+
setAccessTokenExpireDate(expireDate);
|
|
800
|
+
}
|
|
801
|
+
if (entity.realm_id && entity.realm_name) {
|
|
802
|
+
realm.value = {
|
|
803
|
+
id: entity.realm_id,
|
|
804
|
+
name: entity.realm_name
|
|
805
|
+
};
|
|
806
|
+
if (typeof realmManagement.value === 'undefined') {
|
|
807
|
+
setRealmManagement(realm.value);
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
if (entity.permissions) {
|
|
811
|
+
abilities.set(entity.permissions);
|
|
812
|
+
}
|
|
813
|
+
};
|
|
814
|
+
// --------------------------------------------------------------------
|
|
815
|
+
const resolve = async (ctx = {})=>{
|
|
816
|
+
if (!accessToken.value || ctx.attempts && ctx.attempts > 3) return;
|
|
817
|
+
try {
|
|
818
|
+
if (!tokenResolved.value || ctx.refresh) {
|
|
819
|
+
const token = await client.token.introspect({
|
|
820
|
+
token: accessToken.value
|
|
821
|
+
}, {
|
|
822
|
+
authorizationHeader: {
|
|
823
|
+
type: 'Bearer',
|
|
824
|
+
token: accessToken.value
|
|
825
|
+
}
|
|
826
|
+
});
|
|
827
|
+
setTokenInfo(token);
|
|
828
|
+
tokenResolved.value = true;
|
|
829
|
+
}
|
|
830
|
+
if (!userResolved.value || ctx.refresh) {
|
|
831
|
+
const entity = await client.userInfo.get(`Bearer ${accessToken.value}`);
|
|
832
|
+
setUser(entity);
|
|
833
|
+
userResolved.value = true;
|
|
834
|
+
}
|
|
835
|
+
} catch (e) {
|
|
836
|
+
if (coreHttpKit.isClientTokenExpiredError(e)) {
|
|
837
|
+
await attemptRefreshToken();
|
|
838
|
+
await resolve({
|
|
839
|
+
refresh: true,
|
|
840
|
+
attempts: ctx.attempts ? ctx.attempts++ : 1
|
|
841
|
+
});
|
|
842
|
+
return;
|
|
843
|
+
}
|
|
844
|
+
throw e;
|
|
845
|
+
}
|
|
846
|
+
};
|
|
847
|
+
const loggedIn = vue.computed(()=>!!accessToken.value);
|
|
848
|
+
const login = async (ctx)=>{
|
|
849
|
+
try {
|
|
850
|
+
const response = await client.token.createWithPasswordGrant({
|
|
851
|
+
username: ctx.name,
|
|
852
|
+
password: ctx.password,
|
|
853
|
+
...realmId.value ? {
|
|
854
|
+
realm_id: ctx.realmId
|
|
855
|
+
} : {}
|
|
856
|
+
});
|
|
857
|
+
handleTokenGrantResponse(response);
|
|
858
|
+
await resolve();
|
|
859
|
+
} catch (e) {
|
|
860
|
+
setUser(undefined);
|
|
861
|
+
throw e;
|
|
862
|
+
}
|
|
863
|
+
};
|
|
864
|
+
const logout = ()=>{
|
|
865
|
+
setAccessToken(undefined);
|
|
866
|
+
setAccessTokenExpireDate(undefined);
|
|
867
|
+
setRefreshToken(undefined);
|
|
868
|
+
setUser(undefined);
|
|
869
|
+
setTokenInfo(undefined);
|
|
870
|
+
};
|
|
871
|
+
return {
|
|
872
|
+
initialized,
|
|
873
|
+
setInitialized,
|
|
874
|
+
abilities,
|
|
875
|
+
login,
|
|
876
|
+
logout,
|
|
877
|
+
loggedIn,
|
|
878
|
+
resolve,
|
|
879
|
+
handleTokenGrantResponse,
|
|
880
|
+
accessToken,
|
|
881
|
+
setAccessToken,
|
|
882
|
+
accessTokenExpireDate,
|
|
883
|
+
setAccessTokenExpireDate,
|
|
884
|
+
refreshToken,
|
|
885
|
+
setRefreshToken,
|
|
886
|
+
tokenInfo,
|
|
887
|
+
setTokenInfo,
|
|
888
|
+
realm,
|
|
889
|
+
realmId,
|
|
890
|
+
realmIsRoot,
|
|
891
|
+
realmName,
|
|
892
|
+
setRealm,
|
|
893
|
+
realmManagement,
|
|
894
|
+
realmManagementId,
|
|
895
|
+
realmManagementName,
|
|
896
|
+
setRealmManagement,
|
|
897
|
+
user,
|
|
898
|
+
userId,
|
|
899
|
+
setUser
|
|
900
|
+
};
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
function tryOnScopeDispose(fn) {
|
|
904
|
+
if (vue.getCurrentScope()) {
|
|
905
|
+
vue.onScopeDispose(fn);
|
|
906
|
+
return true;
|
|
907
|
+
}
|
|
908
|
+
return false;
|
|
909
|
+
}
|
|
910
|
+
typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
|
|
911
|
+
const noop = ()=>{};
|
|
912
|
+
|
|
913
|
+
function useCookies(dependencies, { doNotParse = false, autoUpdateDependencies = false } = {}, cookies = new Cookie()) {
|
|
914
|
+
const watchingDependencies = autoUpdateDependencies ? [
|
|
915
|
+
...[]
|
|
916
|
+
] : dependencies;
|
|
917
|
+
let previousCookies = cookies.getAll({
|
|
918
|
+
doNotParse: true
|
|
919
|
+
});
|
|
920
|
+
const touches = vue.ref(0);
|
|
921
|
+
const onChange = ()=>{
|
|
922
|
+
const newCookies = cookies.getAll({
|
|
923
|
+
doNotParse: true
|
|
924
|
+
});
|
|
925
|
+
if (shouldUpdate(watchingDependencies || null, newCookies, previousCookies)) touches.value++;
|
|
926
|
+
previousCookies = newCookies;
|
|
927
|
+
};
|
|
928
|
+
cookies.addChangeListener(onChange);
|
|
929
|
+
tryOnScopeDispose(()=>{
|
|
930
|
+
cookies.removeChangeListener(onChange);
|
|
931
|
+
});
|
|
932
|
+
return {
|
|
933
|
+
/**
|
|
934
|
+
* Reactive get cookie by name. If **autoUpdateDependencies = true** then it will update watching dependencies
|
|
935
|
+
*/ get: (...args)=>{
|
|
936
|
+
if (autoUpdateDependencies && watchingDependencies && !watchingDependencies.includes(args[0])) watchingDependencies.push(args[0]);
|
|
937
|
+
touches.value;
|
|
938
|
+
return cookies.get(args[0], {
|
|
939
|
+
doNotParse,
|
|
940
|
+
...args[1]
|
|
941
|
+
});
|
|
942
|
+
},
|
|
943
|
+
/**
|
|
944
|
+
* Reactive get all cookies
|
|
945
|
+
*/ getAll: (...args)=>{
|
|
946
|
+
touches.value;
|
|
947
|
+
return cookies.getAll({
|
|
948
|
+
doNotParse,
|
|
949
|
+
...args[0]
|
|
950
|
+
});
|
|
951
|
+
},
|
|
952
|
+
set: (...args)=>cookies.set(...args),
|
|
953
|
+
remove: (...args)=>cookies.remove(...args),
|
|
954
|
+
addChangeListener: (...args)=>cookies.addChangeListener(...args),
|
|
955
|
+
removeChangeListener: (...args)=>cookies.removeChangeListener(...args)
|
|
956
|
+
};
|
|
957
|
+
}
|
|
958
|
+
function shouldUpdate(dependencies, newCookies, oldCookies) {
|
|
959
|
+
if (!dependencies) return true;
|
|
960
|
+
for (const dependency of dependencies){
|
|
961
|
+
if (newCookies[dependency] !== oldCookies[dependency]) return true;
|
|
962
|
+
}
|
|
963
|
+
return false;
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
const StoreSymbol = Symbol.for('AuthupStore');
|
|
967
|
+
function useStore(pinia, app) {
|
|
968
|
+
const instance = injectStore(app);
|
|
969
|
+
if (!instance) {
|
|
970
|
+
throw new Error('The store has not been injected in the app context.');
|
|
971
|
+
}
|
|
972
|
+
return instance(pinia);
|
|
973
|
+
}
|
|
974
|
+
function injectStore(app) {
|
|
975
|
+
const instance = inject$1(StoreSymbol, app);
|
|
976
|
+
if (!instance) {
|
|
977
|
+
throw new Error('The store has not been injected in the app context.');
|
|
978
|
+
}
|
|
979
|
+
return instance;
|
|
980
|
+
}
|
|
981
|
+
function hasStore(app) {
|
|
982
|
+
return !!inject$1(StoreSymbol, app);
|
|
983
|
+
}
|
|
984
|
+
function provideStore(store, app) {
|
|
985
|
+
provide(StoreSymbol, store, app);
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
function installStore(app, options = {}) {
|
|
989
|
+
if (hasStore(app)) {
|
|
990
|
+
return;
|
|
991
|
+
}
|
|
992
|
+
const storeCreator = defineStore(STORE_ID, ()=>createStore({
|
|
993
|
+
baseURL: options.baseURL
|
|
994
|
+
}));
|
|
995
|
+
const store = storeCreator(options.pinia);
|
|
996
|
+
const cookies = useCookies();
|
|
997
|
+
let cookieGet;
|
|
998
|
+
if (options.cookieGet) {
|
|
999
|
+
cookieGet = options.cookieGet;
|
|
1000
|
+
} else {
|
|
1001
|
+
cookieGet = cookies.get;
|
|
1002
|
+
}
|
|
1003
|
+
let cookieSet;
|
|
1004
|
+
if (options.cookieSet) {
|
|
1005
|
+
cookieSet = options.cookieSet;
|
|
1006
|
+
} else {
|
|
1007
|
+
cookieSet = cookies.set;
|
|
1008
|
+
}
|
|
1009
|
+
let cookieUnset;
|
|
1010
|
+
if (options.cookieUnset) {
|
|
1011
|
+
cookieUnset = options.cookieUnset;
|
|
1012
|
+
} else if (options.cookieSet) {
|
|
1013
|
+
cookieUnset = (key)=>{
|
|
1014
|
+
options.cookieSet(key, null);
|
|
1015
|
+
};
|
|
1016
|
+
} else {
|
|
1017
|
+
cookieUnset = cookies.remove;
|
|
1018
|
+
}
|
|
1019
|
+
const initStore = ()=>{
|
|
1020
|
+
if (store.initialized) {
|
|
1021
|
+
return;
|
|
1022
|
+
}
|
|
1023
|
+
store.setInitialized(true);
|
|
1024
|
+
const keys = Object.values(coreHttpKit.CookieName);
|
|
1025
|
+
let value;
|
|
29
1026
|
for(let i = 0; i < keys.length; i++){
|
|
30
|
-
|
|
1027
|
+
value = cookieGet(keys[i]);
|
|
1028
|
+
if (!value) {
|
|
1029
|
+
continue;
|
|
1030
|
+
}
|
|
1031
|
+
switch(keys[i]){
|
|
1032
|
+
case coreHttpKit.CookieName.ACCESS_TOKEN:
|
|
1033
|
+
if (!store.accessToken) {
|
|
1034
|
+
store.setAccessToken(value);
|
|
1035
|
+
}
|
|
1036
|
+
break;
|
|
1037
|
+
case coreHttpKit.CookieName.ACCESS_TOKEN_EXPIRE_DATE:
|
|
1038
|
+
if (!store.accessTokenExpireDate) {
|
|
1039
|
+
store.setAccessTokenExpireDate(value);
|
|
1040
|
+
}
|
|
1041
|
+
break;
|
|
1042
|
+
case coreHttpKit.CookieName.REFRESH_TOKEN:
|
|
1043
|
+
if (!store.refreshToken) {
|
|
1044
|
+
store.setRefreshToken(value);
|
|
1045
|
+
}
|
|
1046
|
+
break;
|
|
1047
|
+
case coreHttpKit.CookieName.USER:
|
|
1048
|
+
if (!store.user) {
|
|
1049
|
+
store.setUser(value);
|
|
1050
|
+
}
|
|
1051
|
+
break;
|
|
1052
|
+
case coreHttpKit.CookieName.REALM:
|
|
1053
|
+
if (!store.realm) {
|
|
1054
|
+
store.setRealm(value);
|
|
1055
|
+
}
|
|
1056
|
+
break;
|
|
1057
|
+
case coreHttpKit.CookieName.REALM_MANAGEMENT:
|
|
1058
|
+
if (!store.realmManagement) {
|
|
1059
|
+
store.setRealmManagement(value);
|
|
1060
|
+
}
|
|
1061
|
+
break;
|
|
1062
|
+
}
|
|
31
1063
|
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
* @param group
|
|
37
|
-
* @param options
|
|
38
|
-
*/ setOptions(group, options) {
|
|
39
|
-
if (typeof this.data[group] === 'undefined') {
|
|
40
|
-
this.data[group] = {};
|
|
1064
|
+
};
|
|
1065
|
+
store.$onAction((action)=>{
|
|
1066
|
+
if (action.store.$id !== STORE_ID) {
|
|
1067
|
+
return;
|
|
41
1068
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
return this.data[group];
|
|
1069
|
+
if (action.name === 'logout') {
|
|
1070
|
+
cookieUnset(coreHttpKit.CookieName.ACCESS_TOKEN);
|
|
1071
|
+
cookieUnset(coreHttpKit.CookieName.ACCESS_TOKEN_EXPIRE_DATE);
|
|
1072
|
+
cookieUnset(coreHttpKit.CookieName.REFRESH_TOKEN);
|
|
1073
|
+
cookieUnset(coreHttpKit.CookieName.USER);
|
|
1074
|
+
cookieUnset(coreHttpKit.CookieName.REALM);
|
|
1075
|
+
cookieUnset(coreHttpKit.CookieName.REALM_MANAGEMENT);
|
|
50
1076
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
getOption(group, option) {
|
|
57
|
-
if (typeof this.data[group] === 'undefined') {
|
|
58
|
-
return undefined;
|
|
1077
|
+
});
|
|
1078
|
+
initStore();
|
|
1079
|
+
store.$subscribe((mutation, state)=>{
|
|
1080
|
+
if (mutation.storeId !== STORE_ID) {
|
|
1081
|
+
return;
|
|
59
1082
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
constructor(){
|
|
63
|
-
this.data = {};
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
class StoreManager {
|
|
67
|
-
keys() {
|
|
68
|
-
return Object.keys(this.instances);
|
|
69
|
-
}
|
|
70
|
-
use(key) {
|
|
71
|
-
if (typeof this.instances[key] !== 'undefined') {
|
|
72
|
-
return this.instances[key];
|
|
1083
|
+
if (state.accessToken) {
|
|
1084
|
+
cookieSet(coreHttpKit.CookieName.ACCESS_TOKEN, state.accessToken);
|
|
73
1085
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
constructor(){
|
|
78
|
-
this.instances = {};
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
function applyStoreManagerOptions(manager, options) {
|
|
82
|
-
if (options.presets) {
|
|
83
|
-
const presetKeys = Object.keys(options.presets);
|
|
84
|
-
for(let i = 0; i < presetKeys.length; i++){
|
|
85
|
-
const store = manager.use(presetKeys[i]);
|
|
86
|
-
store.setAll(options.presets[presetKeys[i]]);
|
|
1086
|
+
if (state.accessTokenExpireDate) {
|
|
1087
|
+
cookieSet(coreHttpKit.CookieName.ACCESS_TOKEN_EXPIRE_DATE, state.accessTokenExpireDate);
|
|
87
1088
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
const store = manager.use(StoreName.DEFAULT);
|
|
91
|
-
store.setAll(options.defaults);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
function getSymbol(key) {
|
|
95
|
-
{
|
|
96
|
-
return Symbol.for(`VCStoreManager#${key}`);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
function installStoreManager(instance, key) {
|
|
100
|
-
let manager;
|
|
101
|
-
const symbol = getSymbol(key);
|
|
102
|
-
if (instance._context && instance._context.provides && instance._context.provides[symbol]) {
|
|
103
|
-
return instance._context.provides[symbol];
|
|
104
|
-
}
|
|
105
|
-
if (vue.hasInjectionContext()) {
|
|
106
|
-
manager = vue.inject(symbol, undefined);
|
|
107
|
-
if (manager) {
|
|
108
|
-
return manager;
|
|
1089
|
+
if (state.refreshToken) {
|
|
1090
|
+
cookieSet(coreHttpKit.CookieName.REFRESH_TOKEN, state.refreshToken);
|
|
109
1091
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
return vue.inject(key, undefined);
|
|
122
|
-
}
|
|
123
|
-
return undefined;
|
|
1092
|
+
if (state.user) {
|
|
1093
|
+
cookieSet(coreHttpKit.CookieName.USER, state.user);
|
|
1094
|
+
}
|
|
1095
|
+
if (state.realm) {
|
|
1096
|
+
cookieSet(coreHttpKit.CookieName.REALM, state.realm);
|
|
1097
|
+
}
|
|
1098
|
+
if (state.realmManagement) {
|
|
1099
|
+
cookieSet(coreHttpKit.CookieName.REALM_MANAGEMENT, state.realmManagement);
|
|
1100
|
+
}
|
|
1101
|
+
});
|
|
1102
|
+
provideStore(storeCreator, app);
|
|
124
1103
|
}
|
|
125
1104
|
|
|
126
|
-
function
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
1105
|
+
function storeToRefs(store) {
|
|
1106
|
+
store = vue.toRaw(store);
|
|
1107
|
+
const refs = {};
|
|
1108
|
+
const keys = Object.keys(store);
|
|
1109
|
+
for(let i = 0; i < keys.length; i++){
|
|
1110
|
+
const value = store[keys[i]];
|
|
1111
|
+
if (vue.isRef(value) || vue.isReactive(value)) {
|
|
1112
|
+
refs[keys[i]] = vue.toRef(store, keys[i]);
|
|
131
1113
|
}
|
|
132
|
-
vue.provide(key, value);
|
|
133
|
-
return;
|
|
134
1114
|
}
|
|
135
|
-
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
app.provide(key, value);
|
|
1115
|
+
return refs;
|
|
139
1116
|
}
|
|
140
1117
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
}
|
|
145
|
-
function injectAPIClient() {
|
|
146
|
-
const instance = inject$1(APIClientSymbol);
|
|
147
|
-
if (!instance) {
|
|
148
|
-
throw new Error('The api client has not been injected.');
|
|
1118
|
+
function installHTTPClient(app, options = {}) {
|
|
1119
|
+
if (hasHTTPClient(app)) {
|
|
1120
|
+
return;
|
|
149
1121
|
}
|
|
150
|
-
|
|
1122
|
+
const client = new coreHttpKit.Client({
|
|
1123
|
+
baseURL: options.baseURL
|
|
1124
|
+
});
|
|
1125
|
+
const storeCreator = injectStore(app);
|
|
1126
|
+
const store = storeCreator(options.pinia);
|
|
1127
|
+
const { refreshToken } = storeToRefs$1(store);
|
|
1128
|
+
const tokenHook = new coreHttpKit.ClientResponseErrorTokenHook(client, {
|
|
1129
|
+
baseURL: options.baseURL,
|
|
1130
|
+
tokenCreator: ()=>{
|
|
1131
|
+
if (!refreshToken.value) {
|
|
1132
|
+
throw new Error('No refresh token available.');
|
|
1133
|
+
}
|
|
1134
|
+
return client.token.createWithRefreshToken({
|
|
1135
|
+
refresh_token: refreshToken.value
|
|
1136
|
+
});
|
|
1137
|
+
},
|
|
1138
|
+
tokenCreated: (response)=>{
|
|
1139
|
+
store.handleTokenGrantResponse(response);
|
|
1140
|
+
},
|
|
1141
|
+
tokenFailed: ()=>{
|
|
1142
|
+
store.logout();
|
|
1143
|
+
}
|
|
1144
|
+
});
|
|
1145
|
+
store.$subscribe((mutation, state)=>{
|
|
1146
|
+
if (mutation.storeId !== STORE_ID) return;
|
|
1147
|
+
if (state.accessToken) {
|
|
1148
|
+
client.setAuthorizationHeader({
|
|
1149
|
+
type: 'Bearer',
|
|
1150
|
+
token: state.accessToken
|
|
1151
|
+
});
|
|
1152
|
+
tokenHook.mount();
|
|
1153
|
+
} else {
|
|
1154
|
+
client.unsetAuthorizationHeader();
|
|
1155
|
+
tokenHook.unmount();
|
|
1156
|
+
}
|
|
1157
|
+
if (state.refreshToken && state.accessTokenExpireDate) {
|
|
1158
|
+
const expiresIn = Math.floor((state.accessTokenExpireDate.getTime() - Date.now()) / 1000);
|
|
1159
|
+
tokenHook.setTimer({
|
|
1160
|
+
refresh_token: ()=>refreshToken.value,
|
|
1161
|
+
expires_in: expiresIn
|
|
1162
|
+
});
|
|
1163
|
+
}
|
|
1164
|
+
});
|
|
1165
|
+
provideHTTPClient(client, app);
|
|
151
1166
|
}
|
|
152
1167
|
|
|
153
1168
|
function renderEntityAssignAction(ctx) {
|
|
@@ -290,270 +1305,60 @@ function buildListCreatedHandler(items, cb) {
|
|
|
290
1305
|
index = -1;
|
|
291
1306
|
}
|
|
292
1307
|
if (index === -1) {
|
|
293
|
-
if (options.unshift) {
|
|
294
|
-
items.value.unshift(item);
|
|
295
|
-
} else {
|
|
296
|
-
items.value.push(item);
|
|
297
|
-
}
|
|
298
|
-
if (cb) {
|
|
299
|
-
cb(item);
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
};
|
|
303
|
-
}
|
|
304
|
-
function buildListUpdatedHandler(items, cb) {
|
|
305
|
-
return (item)=>{
|
|
306
|
-
if (!smob.isObject(item)) {
|
|
307
|
-
return;
|
|
308
|
-
}
|
|
309
|
-
const index = items.value.findIndex((el)=>el.id === item.id);
|
|
310
|
-
if (index !== -1) {
|
|
311
|
-
const keys = Object.keys(item);
|
|
312
|
-
for(let i = 0; i < keys.length; i++){
|
|
313
|
-
items.value[index][keys[i]] = item[keys[i]];
|
|
314
|
-
}
|
|
315
|
-
if (cb) {
|
|
316
|
-
cb(item);
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
};
|
|
320
|
-
}
|
|
321
|
-
function buildListDeletedHandler(items, cb) {
|
|
322
|
-
return (item)=>{
|
|
323
|
-
if (!smob.isObject(item)) {
|
|
324
|
-
return undefined;
|
|
325
|
-
}
|
|
326
|
-
const index = items.value.findIndex((el)=>el.id === item.id);
|
|
327
|
-
if (index !== -1) {
|
|
328
|
-
if (cb) {
|
|
329
|
-
cb(items.value[index]);
|
|
330
|
-
}
|
|
331
|
-
return items.value.splice(index, 1).pop();
|
|
332
|
-
}
|
|
333
|
-
return undefined;
|
|
334
|
-
};
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
/*
|
|
338
|
-
* Copyright (c) 2023.
|
|
339
|
-
* Author Peter Placzek (tada5hi)
|
|
340
|
-
* For the full copyright and license information,
|
|
341
|
-
* view the LICENSE file that was distributed with this source code.
|
|
342
|
-
*/ function boolableToObject(input) {
|
|
343
|
-
if (typeof input === 'boolean') {
|
|
344
|
-
return {};
|
|
345
|
-
}
|
|
346
|
-
return input;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
const createStore = (context)=>{
|
|
350
|
-
const client = new coreHttpKit.Client({
|
|
351
|
-
baseURL: context.baseURL
|
|
352
|
-
});
|
|
353
|
-
// --------------------------------------------------------------------
|
|
354
|
-
const accessToken = vue.ref(undefined);
|
|
355
|
-
const setAccessToken = (input)=>{
|
|
356
|
-
accessToken.value = input;
|
|
357
|
-
};
|
|
358
|
-
// --------------------------------------------------------------------
|
|
359
|
-
const accessTokenExpireDate = vue.ref(undefined);
|
|
360
|
-
const setAccessTokenExpireDate = (input)=>{
|
|
361
|
-
if (typeof input === 'number' || typeof input === 'string') {
|
|
362
|
-
accessTokenExpireDate.value = new Date(input); // verify microseconds or seconds
|
|
363
|
-
return;
|
|
364
|
-
}
|
|
365
|
-
accessTokenExpireDate.value = input;
|
|
366
|
-
};
|
|
367
|
-
// --------------------------------------------------------------------
|
|
368
|
-
const refreshToken = vue.ref(undefined);
|
|
369
|
-
const setRefreshToken = (input)=>{
|
|
370
|
-
refreshToken.value = input;
|
|
371
|
-
};
|
|
372
|
-
const handleTokenGrantResponse = (response)=>{
|
|
373
|
-
const expireDate = new Date(Date.now() + response.expires_in * 1000);
|
|
374
|
-
setAccessTokenExpireDate(expireDate);
|
|
375
|
-
setAccessToken(response.access_token);
|
|
376
|
-
setRefreshToken(response.refresh_token);
|
|
377
|
-
};
|
|
378
|
-
let refreshTokenPromise;
|
|
379
|
-
const attemptRefreshToken = ()=>{
|
|
380
|
-
if (!refreshToken.value) {
|
|
381
|
-
return Promise.reject(new Error('No refresh token is present.'));
|
|
382
|
-
}
|
|
383
|
-
if (refreshTokenPromise) {
|
|
384
|
-
return refreshTokenPromise;
|
|
385
|
-
}
|
|
386
|
-
refreshTokenPromise = client.token.createWithRefreshToken({
|
|
387
|
-
refresh_token: refreshToken.value
|
|
388
|
-
}).then((r)=>{
|
|
389
|
-
handleTokenGrantResponse(r);
|
|
390
|
-
refreshTokenPromise = undefined;
|
|
391
|
-
return r;
|
|
392
|
-
}).catch((e)=>{
|
|
393
|
-
refreshTokenPromise = undefined;
|
|
394
|
-
throw e;
|
|
395
|
-
});
|
|
396
|
-
return refreshTokenPromise;
|
|
397
|
-
};
|
|
398
|
-
// --------------------------------------------------------------------
|
|
399
|
-
const user = vue.ref(undefined);
|
|
400
|
-
const userId = vue.computed(()=>user.value ? user.value.id : undefined);
|
|
401
|
-
const userResolved = vue.ref(false);
|
|
402
|
-
const setUser = (entity)=>{
|
|
403
|
-
user.value = entity;
|
|
404
|
-
userResolved.value = !!entity;
|
|
405
|
-
};
|
|
406
|
-
// --------------------------------------------------------------------
|
|
407
|
-
const abilityManager = new kit.AbilityManager();
|
|
408
|
-
const tokenInfo = vue.ref(undefined);
|
|
409
|
-
const tokenResolved = vue.ref(false);
|
|
410
|
-
const has = (name)=>abilityManager.has(name);
|
|
411
|
-
const realm = vue.ref(undefined);
|
|
412
|
-
const realmId = vue.computed(()=>realm.value ? realm.value.id : undefined);
|
|
413
|
-
const realmName = vue.computed(()=>realm.value ? realm.value.name : undefined);
|
|
414
|
-
const setRealm = (entity)=>{
|
|
415
|
-
realm.value = entity;
|
|
416
|
-
};
|
|
417
|
-
const realmManagement = vue.ref(undefined);
|
|
418
|
-
const realmManagementId = vue.computed(()=>realmManagement.value ? realmManagement.value.id : realmId.value);
|
|
419
|
-
const realmManagementName = vue.computed(()=>realmManagement.value ? realmManagement.value.name : realmName.value);
|
|
420
|
-
const setRealmManagement = (entity)=>{
|
|
421
|
-
realmManagement.value = entity;
|
|
422
|
-
};
|
|
423
|
-
const setTokenInfo = (entity)=>{
|
|
424
|
-
tokenResolved.value = !!entity;
|
|
425
|
-
tokenInfo.value = entity;
|
|
426
|
-
if (!entity) {
|
|
427
|
-
setRealm(undefined);
|
|
428
|
-
setRealmManagement(undefined);
|
|
429
|
-
abilityManager.set([]);
|
|
430
|
-
return;
|
|
431
|
-
}
|
|
432
|
-
if (entity.exp) {
|
|
433
|
-
const expireDate = new Date(entity.exp * 1000);
|
|
434
|
-
setAccessTokenExpireDate(expireDate);
|
|
435
|
-
}
|
|
436
|
-
if (entity.realm_id && entity.realm_name) {
|
|
437
|
-
realm.value = {
|
|
438
|
-
id: entity.realm_id,
|
|
439
|
-
name: entity.realm_name
|
|
440
|
-
};
|
|
441
|
-
if (typeof realmManagement.value === 'undefined') {
|
|
442
|
-
setRealmManagement(realm.value);
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
if (entity.permissions) {
|
|
446
|
-
abilityManager.set(entity.permissions);
|
|
447
|
-
}
|
|
448
|
-
};
|
|
449
|
-
// --------------------------------------------------------------------
|
|
450
|
-
const resolve = async (ctx = {})=>{
|
|
451
|
-
if (!accessToken.value || ctx.attempts && ctx.attempts > 3) return;
|
|
452
|
-
try {
|
|
453
|
-
if (!tokenResolved.value || ctx.refresh) {
|
|
454
|
-
const token = await client.token.introspect({
|
|
455
|
-
token: accessToken.value
|
|
456
|
-
}, {
|
|
457
|
-
authorizationHeader: {
|
|
458
|
-
type: 'Bearer',
|
|
459
|
-
token: accessToken.value
|
|
460
|
-
}
|
|
461
|
-
});
|
|
462
|
-
setTokenInfo(token);
|
|
463
|
-
tokenResolved.value = true;
|
|
464
|
-
}
|
|
465
|
-
if (!userResolved.value || ctx.refresh) {
|
|
466
|
-
const entity = await client.userInfo.get(`Bearer ${accessToken.value}`);
|
|
467
|
-
setUser(entity);
|
|
468
|
-
userResolved.value = true;
|
|
1308
|
+
if (options.unshift) {
|
|
1309
|
+
items.value.unshift(item);
|
|
1310
|
+
} else {
|
|
1311
|
+
items.value.push(item);
|
|
469
1312
|
}
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
await attemptRefreshToken();
|
|
473
|
-
await resolve({
|
|
474
|
-
refresh: true,
|
|
475
|
-
attempts: ctx.attempts ? ctx.attempts++ : 1
|
|
476
|
-
});
|
|
477
|
-
return;
|
|
1313
|
+
if (cb) {
|
|
1314
|
+
cb(item);
|
|
478
1315
|
}
|
|
479
|
-
throw e;
|
|
480
1316
|
}
|
|
481
1317
|
};
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
1318
|
+
}
|
|
1319
|
+
function buildListUpdatedHandler(items, cb) {
|
|
1320
|
+
return (item)=>{
|
|
1321
|
+
if (!smob.isObject(item)) {
|
|
1322
|
+
return;
|
|
1323
|
+
}
|
|
1324
|
+
const index = items.value.findIndex((el)=>el.id === item.id);
|
|
1325
|
+
if (index !== -1) {
|
|
1326
|
+
const keys = Object.keys(item);
|
|
1327
|
+
for(let i = 0; i < keys.length; i++){
|
|
1328
|
+
items.value[index][keys[i]] = item[keys[i]];
|
|
1329
|
+
}
|
|
1330
|
+
if (cb) {
|
|
1331
|
+
cb(item);
|
|
1332
|
+
}
|
|
497
1333
|
}
|
|
498
1334
|
};
|
|
499
|
-
const logout = ()=>{
|
|
500
|
-
setAccessToken(undefined);
|
|
501
|
-
setRefreshToken(undefined);
|
|
502
|
-
setUser(undefined);
|
|
503
|
-
setTokenInfo(undefined);
|
|
504
|
-
};
|
|
505
|
-
return {
|
|
506
|
-
login,
|
|
507
|
-
logout,
|
|
508
|
-
loggedIn,
|
|
509
|
-
resolve,
|
|
510
|
-
handleTokenGrantResponse,
|
|
511
|
-
accessToken,
|
|
512
|
-
setAccessToken,
|
|
513
|
-
accessTokenExpireDate,
|
|
514
|
-
setAccessTokenExpireDate,
|
|
515
|
-
refreshToken,
|
|
516
|
-
setRefreshToken,
|
|
517
|
-
tokenInfo,
|
|
518
|
-
setTokenInfo,
|
|
519
|
-
realm,
|
|
520
|
-
realmId,
|
|
521
|
-
realmName,
|
|
522
|
-
setRealm,
|
|
523
|
-
realmManagement,
|
|
524
|
-
realmManagementId,
|
|
525
|
-
realmManagementName,
|
|
526
|
-
setRealmManagement,
|
|
527
|
-
user,
|
|
528
|
-
userId,
|
|
529
|
-
setUser,
|
|
530
|
-
has
|
|
531
|
-
};
|
|
532
|
-
};
|
|
533
|
-
|
|
534
|
-
const StoreSymbol = Symbol.for('AuthupStore');
|
|
535
|
-
function injectStore() {
|
|
536
|
-
const instance = inject$1(StoreSymbol);
|
|
537
|
-
if (!instance) {
|
|
538
|
-
throw new Error('The store has not been injected in the app context.');
|
|
539
|
-
}
|
|
540
|
-
return instance;
|
|
541
1335
|
}
|
|
542
|
-
function
|
|
543
|
-
|
|
1336
|
+
function buildListDeletedHandler(items, cb) {
|
|
1337
|
+
return (item)=>{
|
|
1338
|
+
if (!smob.isObject(item)) {
|
|
1339
|
+
return undefined;
|
|
1340
|
+
}
|
|
1341
|
+
const index = items.value.findIndex((el)=>el.id === item.id);
|
|
1342
|
+
if (index !== -1) {
|
|
1343
|
+
if (cb) {
|
|
1344
|
+
cb(items.value[index]);
|
|
1345
|
+
}
|
|
1346
|
+
return items.value.splice(index, 1).pop();
|
|
1347
|
+
}
|
|
1348
|
+
return undefined;
|
|
1349
|
+
};
|
|
544
1350
|
}
|
|
545
1351
|
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
}
|
|
1352
|
+
/*
|
|
1353
|
+
* Copyright (c) 2023.
|
|
1354
|
+
* Author Peter Placzek (tada5hi)
|
|
1355
|
+
* For the full copyright and license information,
|
|
1356
|
+
* view the LICENSE file that was distributed with this source code.
|
|
1357
|
+
*/ function boolableToObject(input) {
|
|
1358
|
+
if (typeof input === 'boolean') {
|
|
1359
|
+
return {};
|
|
555
1360
|
}
|
|
556
|
-
return
|
|
1361
|
+
return input;
|
|
557
1362
|
}
|
|
558
1363
|
|
|
559
1364
|
const SocketClientSymbol = Symbol.for('AuthupSocketClientManager');
|
|
@@ -575,6 +1380,13 @@ function injectSocketClientManager() {
|
|
|
575
1380
|
return manager;
|
|
576
1381
|
}
|
|
577
1382
|
|
|
1383
|
+
function installSocketClientManager(app, options) {
|
|
1384
|
+
const socketClientManager = new coreRealtimeKit.ClientManager({
|
|
1385
|
+
url: options.baseURL
|
|
1386
|
+
});
|
|
1387
|
+
provideSocketClientManager(socketClientManager, app);
|
|
1388
|
+
}
|
|
1389
|
+
|
|
578
1390
|
function createEntitySocket(ctx) {
|
|
579
1391
|
if (!isSocketClientManagerInjected()) {
|
|
580
1392
|
return {
|
|
@@ -582,7 +1394,7 @@ function createEntitySocket(ctx) {
|
|
|
582
1394
|
unmount () {}
|
|
583
1395
|
};
|
|
584
1396
|
}
|
|
585
|
-
const store =
|
|
1397
|
+
const store = useStore();
|
|
586
1398
|
const storeRefs = storeToRefs(store);
|
|
587
1399
|
const realmId = vue.computed(()=>{
|
|
588
1400
|
if (storeRefs.realmName.value === coreKit.REALM_MASTER_NAME) {
|
|
@@ -731,7 +1543,7 @@ function createList(context) {
|
|
|
731
1543
|
}
|
|
732
1544
|
return undefined;
|
|
733
1545
|
});
|
|
734
|
-
const client =
|
|
1546
|
+
const client = injectHTTPClient();
|
|
735
1547
|
let domainAPI;
|
|
736
1548
|
if (kit.hasOwnProperty(client, context.type)) {
|
|
737
1549
|
domainAPI = client[context.type];
|
|
@@ -998,7 +1810,7 @@ function defineEntityManagerProps() {
|
|
|
998
1810
|
}
|
|
999
1811
|
|
|
1000
1812
|
function createEntityManager(ctx) {
|
|
1001
|
-
const client =
|
|
1813
|
+
const client = injectHTTPClient();
|
|
1002
1814
|
let domainAPI;
|
|
1003
1815
|
if (kit.hasOwnProperty(client, ctx.type)) {
|
|
1004
1816
|
domainAPI = client[ctx.type];
|
|
@@ -1433,9 +2245,6 @@ class MemoryStore {
|
|
|
1433
2245
|
}
|
|
1434
2246
|
}
|
|
1435
2247
|
|
|
1436
|
-
typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
|
|
1437
|
-
const noop = ()=>{};
|
|
1438
|
-
|
|
1439
2248
|
function computedAsync(evaluationCallback, initialState, optionsOrRef) {
|
|
1440
2249
|
let options;
|
|
1441
2250
|
if (vue.isRef(optionsOrRef)) {
|
|
@@ -1815,6 +2624,33 @@ function useUpdatedAt(input) {
|
|
|
1815
2624
|
});
|
|
1816
2625
|
}
|
|
1817
2626
|
|
|
2627
|
+
function useAbilityCheck(name) {
|
|
2628
|
+
const { abilities } = useStore();
|
|
2629
|
+
const data = vue.ref(false);
|
|
2630
|
+
data.value = abilities.has(name);
|
|
2631
|
+
let removeListener;
|
|
2632
|
+
vue.onMounted(()=>{
|
|
2633
|
+
removeListener = abilities.on('updated', ()=>{
|
|
2634
|
+
data.value = abilities.has(name);
|
|
2635
|
+
});
|
|
2636
|
+
});
|
|
2637
|
+
vue.onUnmounted(()=>{
|
|
2638
|
+
if (typeof removeListener !== 'undefined') {
|
|
2639
|
+
removeListener();
|
|
2640
|
+
}
|
|
2641
|
+
});
|
|
2642
|
+
return data;
|
|
2643
|
+
}
|
|
2644
|
+
|
|
2645
|
+
function useRealmResourceWritableCheck(realmId) {
|
|
2646
|
+
const store = useStore();
|
|
2647
|
+
const { realm } = storeToRefs$1(store);
|
|
2648
|
+
return vue.computed(()=>{
|
|
2649
|
+
const realmIdRaw = vue.unref(realmId);
|
|
2650
|
+
return coreKit.isRealmResourceWritable(realm.value, realmIdRaw);
|
|
2651
|
+
});
|
|
2652
|
+
}
|
|
2653
|
+
|
|
1818
2654
|
const ARealm = vue.defineComponent({
|
|
1819
2655
|
props: defineEntityManagerProps(),
|
|
1820
2656
|
emits: defineEntityManagerEvents(),
|
|
@@ -2521,6 +3357,25 @@ const AClientScopes = vue.defineComponent({
|
|
|
2521
3357
|
}
|
|
2522
3358
|
});
|
|
2523
3359
|
|
|
3360
|
+
function createRealmFormPicker(form) {
|
|
3361
|
+
return formControls.buildFormGroup({
|
|
3362
|
+
label: true,
|
|
3363
|
+
labelContent: 'Realm',
|
|
3364
|
+
content: vue.h(ARealms, {}, {
|
|
3365
|
+
[listControls.SlotName.ITEM_ACTIONS]: (props)=>renderEntityAssignAction({
|
|
3366
|
+
item: form.realm_id === props.data.id,
|
|
3367
|
+
busy: props.busy,
|
|
3368
|
+
add () {
|
|
3369
|
+
form.realm_id = props.data.id;
|
|
3370
|
+
},
|
|
3371
|
+
drop () {
|
|
3372
|
+
form.realm_id = '';
|
|
3373
|
+
}
|
|
3374
|
+
})
|
|
3375
|
+
})
|
|
3376
|
+
});
|
|
3377
|
+
}
|
|
3378
|
+
|
|
2524
3379
|
const AScopeForm = vue.defineComponent({
|
|
2525
3380
|
props: {
|
|
2526
3381
|
name: {
|
|
@@ -2528,12 +3383,7 @@ const AScopeForm = vue.defineComponent({
|
|
|
2528
3383
|
default: undefined
|
|
2529
3384
|
},
|
|
2530
3385
|
entity: {
|
|
2531
|
-
type: Object
|
|
2532
|
-
default: undefined
|
|
2533
|
-
},
|
|
2534
|
-
realmId: {
|
|
2535
|
-
type: String,
|
|
2536
|
-
default: undefined
|
|
3386
|
+
type: Object
|
|
2537
3387
|
}
|
|
2538
3388
|
},
|
|
2539
3389
|
emits: defineEntityManagerEvents(),
|
|
@@ -2557,11 +3407,19 @@ const AScopeForm = vue.defineComponent({
|
|
|
2557
3407
|
},
|
|
2558
3408
|
realm_id: {}
|
|
2559
3409
|
}, form);
|
|
3410
|
+
const store = useStore();
|
|
3411
|
+
const storeRefs = storeToRefs(store);
|
|
2560
3412
|
const manager = createEntityManager({
|
|
2561
3413
|
type: `${coreKit.DomainType.SCOPE}`,
|
|
2562
3414
|
setup: ctx,
|
|
2563
3415
|
props
|
|
2564
3416
|
});
|
|
3417
|
+
const realmId = vue.computed(()=>{
|
|
3418
|
+
if (!storeRefs.realmIsRoot) {
|
|
3419
|
+
return storeRefs.realmId.value;
|
|
3420
|
+
}
|
|
3421
|
+
return manager.data.value ? manager.data.value.realm_id : null;
|
|
3422
|
+
});
|
|
2565
3423
|
const isEditing = useIsEditing(manager.data);
|
|
2566
3424
|
const updatedAt = useUpdatedAt(props.entity);
|
|
2567
3425
|
const isNameFixed = vue.computed(()=>{
|
|
@@ -2570,14 +3428,10 @@ const AScopeForm = vue.defineComponent({
|
|
|
2570
3428
|
}
|
|
2571
3429
|
return !!(manager.data.value && manager.data.value.built_in);
|
|
2572
3430
|
});
|
|
2573
|
-
const isRealmLocked = vue.computed(()=>!!props.realmId);
|
|
2574
3431
|
function initForm() {
|
|
2575
3432
|
if (props.name) {
|
|
2576
3433
|
form.name = props.name;
|
|
2577
3434
|
}
|
|
2578
|
-
if (props.realmId) {
|
|
2579
|
-
form.realm_id = props.realmId;
|
|
2580
|
-
}
|
|
2581
3435
|
initFormAttributesFromSource(form, manager.data.value);
|
|
2582
3436
|
}
|
|
2583
3437
|
vue.watch(updatedAt, (val, oldVal)=>{
|
|
@@ -2606,8 +3460,8 @@ const AScopeForm = vue.defineComponent({
|
|
|
2606
3460
|
key: exports.TranslatorTranslationDefaultKey.REALM
|
|
2607
3461
|
}
|
|
2608
3462
|
]);
|
|
2609
|
-
|
|
2610
|
-
const
|
|
3463
|
+
return ()=>{
|
|
3464
|
+
const children = [
|
|
2611
3465
|
formControls.buildFormGroup({
|
|
2612
3466
|
validationMessages: translationsValidation.name.value,
|
|
2613
3467
|
validationSeverity: getVuelidateSeverity($v.value.name),
|
|
@@ -2622,9 +3476,7 @@ const AScopeForm = vue.defineComponent({
|
|
|
2622
3476
|
disabled: isNameFixed.value
|
|
2623
3477
|
}
|
|
2624
3478
|
})
|
|
2625
|
-
})
|
|
2626
|
-
];
|
|
2627
|
-
const description = [
|
|
3479
|
+
}),
|
|
2628
3480
|
formControls.buildFormGroup({
|
|
2629
3481
|
validationMessages: translationsValidation.description.value,
|
|
2630
3482
|
validationSeverity: getVuelidateSeverity($v.value.description),
|
|
@@ -2641,52 +3493,22 @@ const AScopeForm = vue.defineComponent({
|
|
|
2641
3493
|
})
|
|
2642
3494
|
})
|
|
2643
3495
|
];
|
|
2644
|
-
|
|
2645
|
-
|
|
3496
|
+
if (!realmId.value && !isNameFixed.value && !isEditing.value) {
|
|
3497
|
+
children.push(createRealmFormPicker(form));
|
|
3498
|
+
}
|
|
3499
|
+
children.push(buildFormSubmitWithTranslations({
|
|
2646
3500
|
submit,
|
|
3501
|
+
busy,
|
|
2647
3502
|
isEditing: isEditing.value,
|
|
2648
3503
|
invalid: $v.value.$invalid
|
|
2649
|
-
}, translationsSubmit);
|
|
2650
|
-
let realm = [];
|
|
2651
|
-
if (!isRealmLocked.value && !isNameFixed.value) {
|
|
2652
|
-
realm = [
|
|
2653
|
-
vue.h('hr'),
|
|
2654
|
-
vue.h('label', {
|
|
2655
|
-
class: 'form-label'
|
|
2656
|
-
}, translationsDefault[exports.TranslatorTranslationDefaultKey.REALM].value),
|
|
2657
|
-
vue.h(ARealms, {
|
|
2658
|
-
headerTitle: false
|
|
2659
|
-
}, {
|
|
2660
|
-
[listControls.SlotName.ITEM_ACTIONS]: (props)=>renderEntityAssignAction({
|
|
2661
|
-
item: form.realm_id === props.data.id,
|
|
2662
|
-
busy: props.busy,
|
|
2663
|
-
add () {
|
|
2664
|
-
form.realm_id = props.data.id;
|
|
2665
|
-
},
|
|
2666
|
-
drop () {
|
|
2667
|
-
form.realm_id = '';
|
|
2668
|
-
}
|
|
2669
|
-
})
|
|
2670
|
-
})
|
|
2671
|
-
];
|
|
2672
|
-
}
|
|
3504
|
+
}, translationsSubmit));
|
|
2673
3505
|
return vue.h('form', {
|
|
2674
3506
|
onSubmit ($event) {
|
|
2675
3507
|
$event.preventDefault();
|
|
2676
3508
|
return submit.apply(null);
|
|
2677
3509
|
}
|
|
2678
|
-
},
|
|
2679
|
-
vue.h('div', [
|
|
2680
|
-
name,
|
|
2681
|
-
vue.h('hr'),
|
|
2682
|
-
description,
|
|
2683
|
-
realm,
|
|
2684
|
-
vue.h('hr'),
|
|
2685
|
-
submitForm
|
|
2686
|
-
])
|
|
2687
|
-
]);
|
|
3510
|
+
}, children);
|
|
2688
3511
|
};
|
|
2689
|
-
return ()=>render();
|
|
2690
3512
|
}
|
|
2691
3513
|
});
|
|
2692
3514
|
|
|
@@ -4006,7 +4828,7 @@ const AIdentityProviderOAuth2Form = vue.defineComponent({
|
|
|
4006
4828
|
},
|
|
4007
4829
|
emits: defineEntityManagerEvents(),
|
|
4008
4830
|
setup (props, ctx) {
|
|
4009
|
-
const apiClient =
|
|
4831
|
+
const apiClient = injectHTTPClient();
|
|
4010
4832
|
const manager = createEntityManager({
|
|
4011
4833
|
type: `${coreKit.DomainType.IDENTITY_PROVIDER}`,
|
|
4012
4834
|
setup: ctx,
|
|
@@ -4598,7 +5420,8 @@ const ARoleForm = vue.defineComponent({
|
|
|
4598
5420
|
const busy = vue.ref(false);
|
|
4599
5421
|
const form = vue.reactive({
|
|
4600
5422
|
name: '',
|
|
4601
|
-
description: ''
|
|
5423
|
+
description: '',
|
|
5424
|
+
realm_id: ''
|
|
4602
5425
|
});
|
|
4603
5426
|
const $v = useVuelidate({
|
|
4604
5427
|
name: {
|
|
@@ -4609,13 +5432,22 @@ const ARoleForm = vue.defineComponent({
|
|
|
4609
5432
|
description: {
|
|
4610
5433
|
minLength: validators.minLength(5),
|
|
4611
5434
|
maxLength: validators.maxLength(4096)
|
|
4612
|
-
}
|
|
5435
|
+
},
|
|
5436
|
+
realm_id: {}
|
|
4613
5437
|
}, form);
|
|
5438
|
+
const store = useStore();
|
|
5439
|
+
const storeRefs = storeToRefs(store);
|
|
4614
5440
|
const manager = createEntityManager({
|
|
4615
5441
|
type: `${coreKit.DomainType.ROLE}`,
|
|
4616
5442
|
setup: ctx,
|
|
4617
5443
|
props
|
|
4618
5444
|
});
|
|
5445
|
+
const realmId = vue.computed(()=>{
|
|
5446
|
+
if (!storeRefs.realmIsRoot) {
|
|
5447
|
+
return storeRefs.realmId.value;
|
|
5448
|
+
}
|
|
5449
|
+
return manager.data.value ? manager.data.value.realm_id : null;
|
|
5450
|
+
});
|
|
4619
5451
|
const isEditing = useIsEditing(manager.data);
|
|
4620
5452
|
const updatedAt = useUpdatedAt(props.entity);
|
|
4621
5453
|
function initForm() {
|
|
@@ -4645,7 +5477,8 @@ const ARoleForm = vue.defineComponent({
|
|
|
4645
5477
|
}
|
|
4646
5478
|
]);
|
|
4647
5479
|
const render = ()=>{
|
|
4648
|
-
const
|
|
5480
|
+
const children = [];
|
|
5481
|
+
children.push(formControls.buildFormGroup({
|
|
4649
5482
|
validationMessages: translationsValidation.name.value,
|
|
4650
5483
|
validationSeverity: getVuelidateSeverity($v.value.name),
|
|
4651
5484
|
label: true,
|
|
@@ -4656,8 +5489,8 @@ const ARoleForm = vue.defineComponent({
|
|
|
4656
5489
|
$v.value.name.$model = input;
|
|
4657
5490
|
}
|
|
4658
5491
|
})
|
|
4659
|
-
});
|
|
4660
|
-
|
|
5492
|
+
}));
|
|
5493
|
+
children.push(formControls.buildFormGroup({
|
|
4661
5494
|
validationMessages: translationsValidation.description.value,
|
|
4662
5495
|
validationSeverity: getVuelidateSeverity($v.value.description),
|
|
4663
5496
|
label: true,
|
|
@@ -4671,23 +5504,22 @@ const ARoleForm = vue.defineComponent({
|
|
|
4671
5504
|
rows: 6
|
|
4672
5505
|
}
|
|
4673
5506
|
})
|
|
4674
|
-
});
|
|
4675
|
-
|
|
5507
|
+
}));
|
|
5508
|
+
if (!realmId.value && !isEditing.value) {
|
|
5509
|
+
children.push(createRealmFormPicker(form));
|
|
5510
|
+
}
|
|
5511
|
+
children.push(buildFormSubmitWithTranslations({
|
|
4676
5512
|
submit,
|
|
4677
|
-
busy
|
|
5513
|
+
busy,
|
|
4678
5514
|
isEditing: isEditing.value,
|
|
4679
5515
|
invalid: $v.value.$invalid
|
|
4680
|
-
}, translationsSubmit);
|
|
5516
|
+
}, translationsSubmit));
|
|
4681
5517
|
return vue.h('form', {
|
|
4682
5518
|
onSubmit ($event) {
|
|
4683
5519
|
$event.preventDefault();
|
|
4684
5520
|
return submit.apply(null);
|
|
4685
5521
|
}
|
|
4686
|
-
},
|
|
4687
|
-
name,
|
|
4688
|
-
description,
|
|
4689
|
-
submitForm
|
|
4690
|
-
]);
|
|
5522
|
+
}, children);
|
|
4691
5523
|
};
|
|
4692
5524
|
return ()=>render();
|
|
4693
5525
|
}
|
|
@@ -4784,8 +5616,7 @@ const APermission = vue.defineComponent({
|
|
|
4784
5616
|
const APermissionForm = vue.defineComponent({
|
|
4785
5617
|
props: {
|
|
4786
5618
|
entity: {
|
|
4787
|
-
type: Object
|
|
4788
|
-
default: undefined
|
|
5619
|
+
type: Object
|
|
4789
5620
|
}
|
|
4790
5621
|
},
|
|
4791
5622
|
emits: defineEntityManagerEvents(),
|
|
@@ -4793,7 +5624,8 @@ const APermissionForm = vue.defineComponent({
|
|
|
4793
5624
|
const busy = vue.ref(false);
|
|
4794
5625
|
const form = vue.reactive({
|
|
4795
5626
|
name: '',
|
|
4796
|
-
description: ''
|
|
5627
|
+
description: '',
|
|
5628
|
+
realm_id: ''
|
|
4797
5629
|
});
|
|
4798
5630
|
const $v = useVuelidate({
|
|
4799
5631
|
name: {
|
|
@@ -4804,13 +5636,22 @@ const APermissionForm = vue.defineComponent({
|
|
|
4804
5636
|
description: {
|
|
4805
5637
|
minLength: validators.minLength(5),
|
|
4806
5638
|
maxLength: validators.maxLength(4096)
|
|
4807
|
-
}
|
|
5639
|
+
},
|
|
5640
|
+
realm_id: {}
|
|
4808
5641
|
}, form);
|
|
5642
|
+
const store = useStore();
|
|
5643
|
+
const storeRefs = storeToRefs(store);
|
|
4809
5644
|
const manager = createEntityManager({
|
|
4810
5645
|
type: `${coreKit.DomainType.PERMISSION}`,
|
|
4811
5646
|
setup: ctx,
|
|
4812
5647
|
props
|
|
4813
5648
|
});
|
|
5649
|
+
const realmId = vue.computed(()=>{
|
|
5650
|
+
if (!storeRefs.realmIsRoot) {
|
|
5651
|
+
return storeRefs.realmId.value;
|
|
5652
|
+
}
|
|
5653
|
+
return manager.data.value ? manager.data.value.realm_id : null;
|
|
5654
|
+
});
|
|
4814
5655
|
const isEditing = useIsEditing(manager.data);
|
|
4815
5656
|
const updatedAt = useUpdatedAt(props.entity);
|
|
4816
5657
|
function initForm() {
|
|
@@ -4840,7 +5681,8 @@ const APermissionForm = vue.defineComponent({
|
|
|
4840
5681
|
}
|
|
4841
5682
|
]);
|
|
4842
5683
|
const render = ()=>{
|
|
4843
|
-
const
|
|
5684
|
+
const children = [];
|
|
5685
|
+
children.push(formControls.buildFormGroup({
|
|
4844
5686
|
validationMessages: translationsValidation.name.value,
|
|
4845
5687
|
validationSeverity: getVuelidateSeverity($v.value.name),
|
|
4846
5688
|
label: true,
|
|
@@ -4854,8 +5696,8 @@ const APermissionForm = vue.defineComponent({
|
|
|
4854
5696
|
disabled: manager.data.value && manager.data.value.built_in
|
|
4855
5697
|
}
|
|
4856
5698
|
})
|
|
4857
|
-
});
|
|
4858
|
-
|
|
5699
|
+
}));
|
|
5700
|
+
children.push(formControls.buildFormGroup({
|
|
4859
5701
|
validationMessages: translationsValidation.description.value,
|
|
4860
5702
|
validationSeverity: getVuelidateSeverity($v.value.description),
|
|
4861
5703
|
label: true,
|
|
@@ -4869,23 +5711,22 @@ const APermissionForm = vue.defineComponent({
|
|
|
4869
5711
|
rows: 4
|
|
4870
5712
|
}
|
|
4871
5713
|
})
|
|
4872
|
-
});
|
|
4873
|
-
|
|
5714
|
+
}));
|
|
5715
|
+
if (!realmId.value && !isEditing.value) {
|
|
5716
|
+
children.push(createRealmFormPicker(form));
|
|
5717
|
+
}
|
|
5718
|
+
children.push(buildFormSubmitWithTranslations({
|
|
4874
5719
|
submit,
|
|
4875
5720
|
busy,
|
|
4876
5721
|
isEditing: isEditing.value,
|
|
4877
5722
|
invalid: $v.value.$invalid
|
|
4878
|
-
}, translationsSubmit);
|
|
5723
|
+
}, translationsSubmit));
|
|
4879
5724
|
return vue.h('form', {
|
|
4880
5725
|
onSubmit ($event) {
|
|
4881
5726
|
$event.preventDefault();
|
|
4882
5727
|
return submit.apply(null);
|
|
4883
5728
|
}
|
|
4884
|
-
},
|
|
4885
|
-
name,
|
|
4886
|
-
description,
|
|
4887
|
-
submitButton
|
|
4888
|
-
]);
|
|
5729
|
+
}, children);
|
|
4889
5730
|
};
|
|
4890
5731
|
return ()=>render();
|
|
4891
5732
|
}
|
|
@@ -5702,7 +6543,7 @@ const AUserPasswordForm = vue.defineComponent({
|
|
|
5702
6543
|
'failed'
|
|
5703
6544
|
],
|
|
5704
6545
|
setup (props, ctx) {
|
|
5705
|
-
const apiClient =
|
|
6546
|
+
const apiClient = injectHTTPClient();
|
|
5706
6547
|
const busy = vue.ref(false);
|
|
5707
6548
|
const form = vue.reactive({
|
|
5708
6549
|
password: '',
|
|
@@ -6336,7 +7177,7 @@ const AEntityDelete = vue.defineComponent({
|
|
|
6336
7177
|
'failed'
|
|
6337
7178
|
],
|
|
6338
7179
|
setup (props, ctx) {
|
|
6339
|
-
const apiClient =
|
|
7180
|
+
const apiClient = injectHTTPClient();
|
|
6340
7181
|
const instance = vue.getCurrentInstance();
|
|
6341
7182
|
const busy = vue.ref(false);
|
|
6342
7183
|
const submit = wrapFnWithBusyState(busy, async ()=>{
|
|
@@ -6407,99 +7248,110 @@ const AEntityDelete = vue.defineComponent({
|
|
|
6407
7248
|
});
|
|
6408
7249
|
|
|
6409
7250
|
var components = /*#__PURE__*/Object.freeze({
|
|
6410
|
-
|
|
6411
|
-
|
|
6412
|
-
|
|
6413
|
-
|
|
6414
|
-
|
|
6415
|
-
|
|
6416
|
-
|
|
6417
|
-
|
|
6418
|
-
|
|
6419
|
-
|
|
6420
|
-
|
|
6421
|
-
|
|
6422
|
-
|
|
6423
|
-
|
|
6424
|
-
|
|
6425
|
-
|
|
6426
|
-
|
|
6427
|
-
|
|
6428
|
-
|
|
6429
|
-
|
|
6430
|
-
|
|
6431
|
-
|
|
6432
|
-
|
|
6433
|
-
|
|
6434
|
-
|
|
6435
|
-
|
|
6436
|
-
|
|
6437
|
-
|
|
6438
|
-
|
|
6439
|
-
|
|
6440
|
-
|
|
6441
|
-
|
|
6442
|
-
|
|
6443
|
-
|
|
6444
|
-
|
|
6445
|
-
|
|
6446
|
-
|
|
6447
|
-
|
|
6448
|
-
|
|
6449
|
-
|
|
6450
|
-
|
|
6451
|
-
|
|
6452
|
-
|
|
6453
|
-
|
|
6454
|
-
|
|
6455
|
-
|
|
6456
|
-
|
|
6457
|
-
|
|
6458
|
-
|
|
6459
|
-
|
|
6460
|
-
|
|
6461
|
-
|
|
6462
|
-
|
|
6463
|
-
|
|
6464
|
-
|
|
6465
|
-
|
|
6466
|
-
|
|
6467
|
-
|
|
6468
|
-
|
|
6469
|
-
|
|
7251
|
+
__proto__: null,
|
|
7252
|
+
AClient: AClient,
|
|
7253
|
+
AClientForm: AClientForm,
|
|
7254
|
+
AClientRedirectUris: AClientRedirectUris,
|
|
7255
|
+
AClientRedirectUrisItem: AClientRedirectUrisItem,
|
|
7256
|
+
AClientScope: AClientScope,
|
|
7257
|
+
AClientScopeAssignment: AClientScopeAssignment,
|
|
7258
|
+
AClientScopeAssignments: AClientScopeAssignments,
|
|
7259
|
+
AClientScopes: AClientScopes,
|
|
7260
|
+
AClients: AClients,
|
|
7261
|
+
AEntityDelete: AEntityDelete,
|
|
7262
|
+
AIdentityProvider: AIdentityProvider,
|
|
7263
|
+
AIdentityProviderForm: AIdentityProviderForm,
|
|
7264
|
+
AIdentityProviderIcon: AIdentityProviderIcon,
|
|
7265
|
+
AIdentityProviderLdapForm: AIdentityProviderLdapForm,
|
|
7266
|
+
AIdentityProviderOAuth2Form: AIdentityProviderOAuth2Form,
|
|
7267
|
+
AIdentityProviderPreset: AIdentityProviderPreset,
|
|
7268
|
+
AIdentityProviderProtocol: AIdentityProviderProtocol,
|
|
7269
|
+
AIdentityProviderRoleAssignment: AIdentityProviderRoleAssignment,
|
|
7270
|
+
AIdentityProviderRoleAssignments: AIdentityProviderRoleAssignments,
|
|
7271
|
+
AIdentityProviders: AIdentityProviders,
|
|
7272
|
+
APagination: APagination,
|
|
7273
|
+
APermission: APermission,
|
|
7274
|
+
APermissionForm: APermissionForm,
|
|
7275
|
+
APermissionRobotAssignments: APermissionRobotAssignments,
|
|
7276
|
+
APermissionRoleAssignments: APermissionRoleAssignments,
|
|
7277
|
+
APermissionUserAssignments: APermissionUserAssignments,
|
|
7278
|
+
APermissions: APermissions,
|
|
7279
|
+
ARealm: ARealm,
|
|
7280
|
+
ARealmForm: ARealmForm,
|
|
7281
|
+
ARealms: ARealms,
|
|
7282
|
+
ARobot: ARobot,
|
|
7283
|
+
ARobotForm: ARobotForm,
|
|
7284
|
+
ARobotPermissionAssignment: ARobotPermissionAssignment,
|
|
7285
|
+
ARobotPermissionAssignments: ARobotPermissionAssignments,
|
|
7286
|
+
ARobotRoleAssignment: ARobotRoleAssignment,
|
|
7287
|
+
ARobotRoleAssignments: ARobotRoleAssignments,
|
|
7288
|
+
ARobots: ARobots,
|
|
7289
|
+
ARole: ARole,
|
|
7290
|
+
ARoleForm: ARoleForm,
|
|
7291
|
+
ARolePermissionAssignment: ARolePermissionAssignment,
|
|
7292
|
+
ARolePermissionAssignments: ARolePermissionAssignments,
|
|
7293
|
+
ARoleRobotAssignments: ARoleRobotAssignments,
|
|
7294
|
+
ARoleUserAssignments: ARoleUserAssignments,
|
|
7295
|
+
ARoles: ARoles,
|
|
7296
|
+
AScope: AScope,
|
|
7297
|
+
AScopeClientAssignments: AScopeClientAssignments,
|
|
7298
|
+
AScopeForm: AScopeForm,
|
|
7299
|
+
AScopes: AScopes,
|
|
7300
|
+
ASearch: ASearch,
|
|
7301
|
+
ATitle: ATitle,
|
|
7302
|
+
AUser: AUser,
|
|
7303
|
+
AUserForm: AUserForm,
|
|
7304
|
+
AUserPasswordForm: AUserPasswordForm,
|
|
7305
|
+
AUserPermissionAssignment: AUserPermissionAssignment,
|
|
7306
|
+
AUserPermissionAssignments: AUserPermissionAssignments,
|
|
7307
|
+
AUserRoleAssignment: AUserRoleAssignment,
|
|
7308
|
+
AUserRoleAssignments: AUserRoleAssignments,
|
|
7309
|
+
AUsers: AUsers,
|
|
7310
|
+
LanguageSwitcherDropdown: LanguageSwitcherDropdown
|
|
6470
7311
|
});
|
|
6471
7312
|
|
|
6472
|
-
function
|
|
6473
|
-
if (
|
|
6474
|
-
|
|
6475
|
-
}
|
|
6476
|
-
if (options.socketClientManager) {
|
|
6477
|
-
provideSocketClientManager(options.socketClientManager, app);
|
|
6478
|
-
}
|
|
6479
|
-
if (options.store) {
|
|
6480
|
-
provideStore(options.store, app);
|
|
7313
|
+
function installComponents(input) {
|
|
7314
|
+
if (!input) {
|
|
7315
|
+
return;
|
|
6481
7316
|
}
|
|
6482
|
-
|
|
6483
|
-
|
|
6484
|
-
|
|
6485
|
-
const storeManager = installStoreManager(app, 'authup');
|
|
6486
|
-
if (options.storeManager) {
|
|
6487
|
-
applyStoreManagerOptions(storeManager, options.storeManager);
|
|
7317
|
+
let componentsSelected;
|
|
7318
|
+
if (typeof input !== 'boolean') {
|
|
7319
|
+
componentsSelected = input;
|
|
6488
7320
|
}
|
|
6489
|
-
|
|
6490
|
-
|
|
6491
|
-
|
|
6492
|
-
|
|
7321
|
+
Object.entries(components).forEach(([componentName, component])=>{
|
|
7322
|
+
if (!Array.isArray(componentsSelected) || componentsSelected.indexOf(componentName) !== -1) {
|
|
7323
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
7324
|
+
// @ts-ignore
|
|
7325
|
+
app.component(componentName, component);
|
|
6493
7326
|
}
|
|
6494
|
-
|
|
6495
|
-
|
|
6496
|
-
|
|
6497
|
-
|
|
6498
|
-
|
|
6499
|
-
|
|
7327
|
+
});
|
|
7328
|
+
}
|
|
7329
|
+
function install(app1, options) {
|
|
7330
|
+
if (options.realtime) {
|
|
7331
|
+
installSocketClientManager(app1, {
|
|
7332
|
+
baseURL: options.realtimeURL || options.baseURL
|
|
6500
7333
|
});
|
|
6501
7334
|
}
|
|
7335
|
+
if (options.pinia) {
|
|
7336
|
+
setActivePinia(options.pinia);
|
|
7337
|
+
}
|
|
7338
|
+
installStore(app1, {
|
|
7339
|
+
baseURL: options.baseURL,
|
|
7340
|
+
cookieSet: options.cookieSet,
|
|
7341
|
+
cookieGet: options.cookieGet,
|
|
7342
|
+
cookieUnset: options.cookieUnset,
|
|
7343
|
+
pinia: options.pinia
|
|
7344
|
+
});
|
|
7345
|
+
installHTTPClient(app1, {
|
|
7346
|
+
baseURL: options.baseURL,
|
|
7347
|
+
pinia: options.pinia
|
|
7348
|
+
});
|
|
7349
|
+
installTranslator(app1, {
|
|
7350
|
+
locale: options.translatorLocale
|
|
7351
|
+
});
|
|
7352
|
+
installComponents(options.components);
|
|
6502
7353
|
}
|
|
7354
|
+
|
|
6503
7355
|
var index = {
|
|
6504
7356
|
install
|
|
6505
7357
|
};
|
|
@@ -6524,7 +7376,6 @@ exports.AIdentityProviderProtocol = AIdentityProviderProtocol;
|
|
|
6524
7376
|
exports.AIdentityProviderRoleAssignment = AIdentityProviderRoleAssignment;
|
|
6525
7377
|
exports.AIdentityProviderRoleAssignments = AIdentityProviderRoleAssignments;
|
|
6526
7378
|
exports.AIdentityProviders = AIdentityProviders;
|
|
6527
|
-
exports.APIClientSymbol = APIClientSymbol;
|
|
6528
7379
|
exports.APagination = APagination;
|
|
6529
7380
|
exports.APermission = APermission;
|
|
6530
7381
|
exports.APermissionForm = APermissionForm;
|
|
@@ -6564,7 +7415,9 @@ exports.AUserRoleAssignment = AUserRoleAssignment;
|
|
|
6564
7415
|
exports.AUserRoleAssignments = AUserRoleAssignments;
|
|
6565
7416
|
exports.AUsers = AUsers;
|
|
6566
7417
|
exports.EntityManagerError = EntityManagerError;
|
|
7418
|
+
exports.HTTPClientSymbol = HTTPClientSymbol;
|
|
6567
7419
|
exports.LanguageSwitcherDropdown = LanguageSwitcherDropdown;
|
|
7420
|
+
exports.STORE_ID = STORE_ID;
|
|
6568
7421
|
exports.SocketClientSymbol = SocketClientSymbol;
|
|
6569
7422
|
exports.StoreSymbol = StoreSymbol;
|
|
6570
7423
|
exports.VuelidateCustomRule = VuelidateCustomRule;
|
|
@@ -6585,29 +7438,40 @@ exports.defineListProps = defineListProps;
|
|
|
6585
7438
|
exports.extendObjectProperties = extendObjectProperties;
|
|
6586
7439
|
exports.extractVuelidateResultsFromChild = extractVuelidateResultsFromChild;
|
|
6587
7440
|
exports.getVuelidateSeverity = getVuelidateSeverity;
|
|
7441
|
+
exports.hasHTTPClient = hasHTTPClient;
|
|
6588
7442
|
exports.hasNormalizedSlot = hasNormalizedSlot;
|
|
7443
|
+
exports.hasStore = hasStore;
|
|
6589
7444
|
exports.initFormAttributesFromSource = initFormAttributesFromSource;
|
|
6590
7445
|
exports.inject = inject$1;
|
|
6591
|
-
exports.
|
|
7446
|
+
exports.injectHTTPClient = injectHTTPClient;
|
|
6592
7447
|
exports.injectSocketClientManager = injectSocketClientManager;
|
|
6593
7448
|
exports.injectStore = injectStore;
|
|
6594
7449
|
exports.injectTranslatorLocale = injectTranslatorLocale;
|
|
6595
7450
|
exports.install = install;
|
|
7451
|
+
exports.installHTTPClient = installHTTPClient;
|
|
7452
|
+
exports.installSocketClientManager = installSocketClientManager;
|
|
7453
|
+
exports.installStore = installStore;
|
|
6596
7454
|
exports.installTranslator = installTranslator;
|
|
6597
7455
|
exports.isQuerySortedDescByDate = isQuerySortedDescByDate;
|
|
6598
7456
|
exports.isSocketClientManagerInjected = isSocketClientManagerInjected;
|
|
6599
7457
|
exports.mergeListOptions = mergeListOptions;
|
|
6600
7458
|
exports.normalizeSlot = normalizeSlot;
|
|
7459
|
+
exports.onChange = onChange;
|
|
6601
7460
|
exports.provide = provide;
|
|
6602
|
-
exports.
|
|
7461
|
+
exports.provideHTTPClient = provideHTTPClient;
|
|
6603
7462
|
exports.provideSocketClientManager = provideSocketClientManager;
|
|
6604
7463
|
exports.provideStore = provideStore;
|
|
6605
7464
|
exports.renderEntityAssignAction = renderEntityAssignAction;
|
|
6606
7465
|
exports.storeToRefs = storeToRefs;
|
|
7466
|
+
exports.useAbilityCheck = useAbilityCheck;
|
|
7467
|
+
exports.useIsEditing = useIsEditing;
|
|
7468
|
+
exports.useRealmResourceWritableCheck = useRealmResourceWritableCheck;
|
|
7469
|
+
exports.useStore = useStore;
|
|
6607
7470
|
exports.useTranslation = useTranslation;
|
|
6608
7471
|
exports.useTranslationsForBaseValidation = useTranslationsForBaseValidation;
|
|
6609
7472
|
exports.useTranslationsForGroup = useTranslationsForGroup;
|
|
6610
7473
|
exports.useTranslationsForNestedValidation = useTranslationsForNestedValidation;
|
|
7474
|
+
exports.useUpdatedAt = useUpdatedAt;
|
|
6611
7475
|
exports.wrapFnWithBusyState = wrapFnWithBusyState;
|
|
6612
7476
|
module.exports = Object.assign(exports.default, exports);
|
|
6613
7477
|
//# sourceMappingURL=index.cjs.map
|