@authup/client-web-kit 1.0.0-beta.14 → 1.0.0-beta.15
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/index.cjs +65 -705
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +62 -702
- package/dist/index.mjs.map +1 -1
- package/dist/module.d.ts.map +1 -1
- package/package.json +2 -1
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { toRaw, isRef, isReactive, toRef, hasInjectionContext, inject as inject$2, getCurrentInstance, ref, watch, reactive, markRaw, effectScope, nextTick, computed, getCurrentScope, onScopeDispose, toRefs, provide as provide$1, unref, h, onMounted, onUnmounted, shallowRef, watchEffect, defineComponent, resolveDynamicComponent, mergeProps } from 'vue';
|
|
2
1
|
import { REALM_MASTER_NAME, DomainEventName, buildDomainChannelName, DomainType, isRealmResourceWritable, IdentityProviderProtocol, IdentityProviderPreset, getIdentityProviderProtocolForPreset } from '@authup/core-kit';
|
|
2
|
+
import { hasInjectionContext, inject as inject$2, provide as provide$1, ref, computed, getCurrentScope, onScopeDispose, toRaw, isRef, isReactive, toRef, unref, h, onMounted, onUnmounted, watch, shallowRef, watchEffect, defineComponent, reactive, nextTick, getCurrentInstance, resolveDynamicComponent, mergeProps } from 'vue';
|
|
3
3
|
import { Client, isClientTokenExpiredError, CookieName, ClientResponseErrorTokenHook } from '@authup/core-http-kit';
|
|
4
|
+
import { defineStore, storeToRefs as storeToRefs$1 } from 'pinia';
|
|
4
5
|
import { Abilities, buildEventFullName, EventNameSuffix, hasOwnProperty, createNanoID, isOAuth2OpenIDProviderMetadata, isObject as isObject$1 } from '@authup/kit';
|
|
5
6
|
import { merge, isObject, createMerger } from 'smob';
|
|
6
7
|
import { buildList, SlotName } from '@vuecs/list-controls';
|
|
@@ -13,644 +14,6 @@ import useVuelidate from '@vuelidate/core';
|
|
|
13
14
|
import { buildPagination as buildPagination$1 } from '@vuecs/pagination';
|
|
14
15
|
import Cookie from 'universal-cookie';
|
|
15
16
|
|
|
16
|
-
var isVue2 = false;
|
|
17
|
-
function set(target, key, val) {
|
|
18
|
-
if (Array.isArray(target)) {
|
|
19
|
-
target.length = Math.max(target.length, key);
|
|
20
|
-
target.splice(key, 1, val);
|
|
21
|
-
return val;
|
|
22
|
-
}
|
|
23
|
-
target[key] = val;
|
|
24
|
-
return val;
|
|
25
|
-
}
|
|
26
|
-
function del(target, key) {
|
|
27
|
-
if (Array.isArray(target)) {
|
|
28
|
-
target.splice(key, 1);
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
delete target[key];
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* setActivePinia must be called to handle SSR at the top of functions like
|
|
36
|
-
* `fetch`, `setup`, `serverPrefetch` and others
|
|
37
|
-
*/ let activePinia;
|
|
38
|
-
/**
|
|
39
|
-
* Sets or unsets the active pinia. Used in SSR and internally when calling
|
|
40
|
-
* actions and getters
|
|
41
|
-
*
|
|
42
|
-
* @param pinia - Pinia instance
|
|
43
|
-
*/ // @ts-expect-error: cannot constrain the type of the return
|
|
44
|
-
const setActivePinia = (pinia)=>activePinia = pinia;
|
|
45
|
-
const piniaSymbol = process.env.NODE_ENV !== 'production' ? Symbol('pinia') : /* istanbul ignore next */ Symbol();
|
|
46
|
-
function isPlainObject(// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
47
|
-
o) {
|
|
48
|
-
return o && typeof o === 'object' && Object.prototype.toString.call(o) === '[object Object]' && typeof o.toJSON !== 'function';
|
|
49
|
-
}
|
|
50
|
-
// type DeepReadonly<T> = { readonly [P in keyof T]: DeepReadonly<T[P]> }
|
|
51
|
-
// TODO: can we change these to numbers?
|
|
52
|
-
/**
|
|
53
|
-
* Possible types for SubscriptionCallback
|
|
54
|
-
*/ var MutationType;
|
|
55
|
-
(function(MutationType) {
|
|
56
|
-
/**
|
|
57
|
-
* Direct mutation of the state:
|
|
58
|
-
*
|
|
59
|
-
* - `store.name = 'new name'`
|
|
60
|
-
* - `store.$state.name = 'new name'`
|
|
61
|
-
* - `store.list.push('new item')`
|
|
62
|
-
*/ MutationType["direct"] = "direct";
|
|
63
|
-
/**
|
|
64
|
-
* Mutated the state with `$patch` and an object
|
|
65
|
-
*
|
|
66
|
-
* - `store.$patch({ name: 'newName' })`
|
|
67
|
-
*/ MutationType["patchObject"] = "patch object";
|
|
68
|
-
/**
|
|
69
|
-
* Mutated the state with `$patch` and a function
|
|
70
|
-
*
|
|
71
|
-
* - `store.$patch(state => state.name = 'newName')`
|
|
72
|
-
*/ MutationType["patchFunction"] = "patch function";
|
|
73
|
-
// maybe reset? for $state = {} and $reset
|
|
74
|
-
})(MutationType || (MutationType = {}));
|
|
75
|
-
const IS_CLIENT = typeof window !== 'undefined';
|
|
76
|
-
/**
|
|
77
|
-
* Should we add the devtools plugins.
|
|
78
|
-
* - only if dev mode or forced through the prod devtools flag
|
|
79
|
-
* - not in test
|
|
80
|
-
* - only if window exists (could change in the future)
|
|
81
|
-
*/ const USE_DEVTOOLS = (process.env.NODE_ENV !== 'production' || typeof __VUE_PROD_DEVTOOLS__ !== 'undefined' && __VUE_PROD_DEVTOOLS__) && !(process.env.NODE_ENV === 'test') && IS_CLIENT;
|
|
82
|
-
/**
|
|
83
|
-
* Mutates in place `newState` with `oldState` to _hot update_ it. It will
|
|
84
|
-
* remove any key not existing in `newState` and recursively merge plain
|
|
85
|
-
* objects.
|
|
86
|
-
*
|
|
87
|
-
* @param newState - new state object to be patched
|
|
88
|
-
* @param oldState - old state that should be used to patch newState
|
|
89
|
-
* @returns - newState
|
|
90
|
-
*/ function patchObject(newState, oldState) {
|
|
91
|
-
// no need to go through symbols because they cannot be serialized anyway
|
|
92
|
-
for(const key in oldState){
|
|
93
|
-
const subPatch = oldState[key];
|
|
94
|
-
// skip the whole sub tree
|
|
95
|
-
if (!(key in newState)) {
|
|
96
|
-
continue;
|
|
97
|
-
}
|
|
98
|
-
const targetValue = newState[key];
|
|
99
|
-
if (isPlainObject(targetValue) && isPlainObject(subPatch) && !isRef(subPatch) && !isReactive(subPatch)) {
|
|
100
|
-
newState[key] = patchObject(targetValue, subPatch);
|
|
101
|
-
} else {
|
|
102
|
-
// objects are either a bit more complex (e.g. refs) or primitives, so we
|
|
103
|
-
// just set the whole thing
|
|
104
|
-
{
|
|
105
|
-
newState[key] = subPatch;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
return newState;
|
|
110
|
-
}
|
|
111
|
-
const noop$1 = ()=>{};
|
|
112
|
-
function addSubscription(subscriptions, callback, detached, onCleanup = noop$1) {
|
|
113
|
-
subscriptions.push(callback);
|
|
114
|
-
const removeSubscription = ()=>{
|
|
115
|
-
const idx = subscriptions.indexOf(callback);
|
|
116
|
-
if (idx > -1) {
|
|
117
|
-
subscriptions.splice(idx, 1);
|
|
118
|
-
onCleanup();
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
if (!detached && getCurrentScope()) {
|
|
122
|
-
onScopeDispose(removeSubscription);
|
|
123
|
-
}
|
|
124
|
-
return removeSubscription;
|
|
125
|
-
}
|
|
126
|
-
function triggerSubscriptions(subscriptions, ...args) {
|
|
127
|
-
subscriptions.slice().forEach((callback)=>{
|
|
128
|
-
callback(...args);
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
const fallbackRunWithContext = (fn)=>fn();
|
|
132
|
-
function mergeReactiveObjects(target, patchToApply) {
|
|
133
|
-
// Handle Map instances
|
|
134
|
-
if (target instanceof Map && patchToApply instanceof Map) {
|
|
135
|
-
patchToApply.forEach((value, key)=>target.set(key, value));
|
|
136
|
-
}
|
|
137
|
-
// Handle Set instances
|
|
138
|
-
if (target instanceof Set && patchToApply instanceof Set) {
|
|
139
|
-
patchToApply.forEach(target.add, target);
|
|
140
|
-
}
|
|
141
|
-
// no need to go through symbols because they cannot be serialized anyway
|
|
142
|
-
for(const key in patchToApply){
|
|
143
|
-
if (!patchToApply.hasOwnProperty(key)) continue;
|
|
144
|
-
const subPatch = patchToApply[key];
|
|
145
|
-
const targetValue = target[key];
|
|
146
|
-
if (isPlainObject(targetValue) && isPlainObject(subPatch) && target.hasOwnProperty(key) && !isRef(subPatch) && !isReactive(subPatch)) {
|
|
147
|
-
// NOTE: here I wanted to warn about inconsistent types but it's not possible because in setup stores one might
|
|
148
|
-
// start the value of a property as a certain type e.g. a Map, and then for some reason, during SSR, change that
|
|
149
|
-
// to `undefined`. When trying to hydrate, we want to override the Map with `undefined`.
|
|
150
|
-
target[key] = mergeReactiveObjects(targetValue, subPatch);
|
|
151
|
-
} else {
|
|
152
|
-
// @ts-expect-error: subPatch is a valid value
|
|
153
|
-
target[key] = subPatch;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
return target;
|
|
157
|
-
}
|
|
158
|
-
const skipHydrateSymbol = process.env.NODE_ENV !== 'production' ? Symbol('pinia:skipHydration') : /* istanbul ignore next */ Symbol();
|
|
159
|
-
/**
|
|
160
|
-
* Returns whether a value should be hydrated
|
|
161
|
-
*
|
|
162
|
-
* @param obj - target variable
|
|
163
|
-
* @returns true if `obj` should be hydrated
|
|
164
|
-
*/ function shouldHydrate(obj) {
|
|
165
|
-
return !isPlainObject(obj) || !obj.hasOwnProperty(skipHydrateSymbol);
|
|
166
|
-
}
|
|
167
|
-
const { assign } = Object;
|
|
168
|
-
function isComputed(o) {
|
|
169
|
-
return !!(isRef(o) && o.effect);
|
|
170
|
-
}
|
|
171
|
-
function createOptionsStore(id, options, pinia, hot) {
|
|
172
|
-
const { state, actions, getters } = options;
|
|
173
|
-
const initialState = pinia.state.value[id];
|
|
174
|
-
let store;
|
|
175
|
-
function setup() {
|
|
176
|
-
if (!initialState && (!(process.env.NODE_ENV !== 'production') || !hot)) {
|
|
177
|
-
/* istanbul ignore if */ {
|
|
178
|
-
pinia.state.value[id] = state ? state() : {};
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
// avoid creating a state in pinia.state.value
|
|
182
|
-
const localState = process.env.NODE_ENV !== 'production' && hot ? toRefs(ref(state ? state() : {}).value) : toRefs(pinia.state.value[id]);
|
|
183
|
-
return assign(localState, actions, Object.keys(getters || {}).reduce((computedGetters, name)=>{
|
|
184
|
-
if (process.env.NODE_ENV !== 'production' && name in localState) {
|
|
185
|
-
console.warn(`[🍍]: A getter cannot have the same name as another state property. Rename one of them. Found with "${name}" in store "${id}".`);
|
|
186
|
-
}
|
|
187
|
-
computedGetters[name] = markRaw(computed(()=>{
|
|
188
|
-
setActivePinia(pinia);
|
|
189
|
-
// it was created just before
|
|
190
|
-
const store = pinia._s.get(id);
|
|
191
|
-
// @ts-expect-error
|
|
192
|
-
// return getters![name].call(context, context)
|
|
193
|
-
// TODO: avoid reading the getter while assigning with a global variable
|
|
194
|
-
return getters[name].call(store, store);
|
|
195
|
-
}));
|
|
196
|
-
return computedGetters;
|
|
197
|
-
}, {}));
|
|
198
|
-
}
|
|
199
|
-
store = createSetupStore(id, setup, options, pinia, hot, true);
|
|
200
|
-
return store;
|
|
201
|
-
}
|
|
202
|
-
function createSetupStore($id, setup, options = {}, pinia, hot, isOptionsStore) {
|
|
203
|
-
let scope;
|
|
204
|
-
const optionsForPlugin = assign({
|
|
205
|
-
actions: {}
|
|
206
|
-
}, options);
|
|
207
|
-
/* istanbul ignore if */ if (process.env.NODE_ENV !== 'production' && !pinia._e.active) {
|
|
208
|
-
throw new Error('Pinia destroyed');
|
|
209
|
-
}
|
|
210
|
-
// watcher options for $subscribe
|
|
211
|
-
const $subscribeOptions = {
|
|
212
|
-
deep: true
|
|
213
|
-
};
|
|
214
|
-
/* istanbul ignore else */ if (process.env.NODE_ENV !== 'production' && !isVue2) {
|
|
215
|
-
$subscribeOptions.onTrigger = (event)=>{
|
|
216
|
-
/* istanbul ignore else */ if (isListening) {
|
|
217
|
-
debuggerEvents = event;
|
|
218
|
-
// avoid triggering this while the store is being built and the state is being set in pinia
|
|
219
|
-
} else if (isListening == false && !store._hotUpdating) {
|
|
220
|
-
// let patch send all the events together later
|
|
221
|
-
/* istanbul ignore else */ if (Array.isArray(debuggerEvents)) {
|
|
222
|
-
debuggerEvents.push(event);
|
|
223
|
-
} else {
|
|
224
|
-
console.error('🍍 debuggerEvents should be an array. This is most likely an internal Pinia bug.');
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
};
|
|
228
|
-
}
|
|
229
|
-
// internal state
|
|
230
|
-
let isListening; // set to true at the end
|
|
231
|
-
let isSyncListening; // set to true at the end
|
|
232
|
-
let subscriptions = [];
|
|
233
|
-
let actionSubscriptions = [];
|
|
234
|
-
let debuggerEvents;
|
|
235
|
-
const initialState = pinia.state.value[$id];
|
|
236
|
-
// avoid setting the state for option stores if it is set
|
|
237
|
-
// by the setup
|
|
238
|
-
if (!isOptionsStore && !initialState && (!(process.env.NODE_ENV !== 'production') || !hot)) {
|
|
239
|
-
/* istanbul ignore if */ {
|
|
240
|
-
pinia.state.value[$id] = {};
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
const hotState = ref({});
|
|
244
|
-
// avoid triggering too many listeners
|
|
245
|
-
// https://github.com/vuejs/pinia/issues/1129
|
|
246
|
-
let activeListener;
|
|
247
|
-
function $patch(partialStateOrMutator) {
|
|
248
|
-
let subscriptionMutation;
|
|
249
|
-
isListening = isSyncListening = false;
|
|
250
|
-
// reset the debugger events since patches are sync
|
|
251
|
-
/* istanbul ignore else */ if (process.env.NODE_ENV !== 'production') {
|
|
252
|
-
debuggerEvents = [];
|
|
253
|
-
}
|
|
254
|
-
if (typeof partialStateOrMutator === 'function') {
|
|
255
|
-
partialStateOrMutator(pinia.state.value[$id]);
|
|
256
|
-
subscriptionMutation = {
|
|
257
|
-
type: MutationType.patchFunction,
|
|
258
|
-
storeId: $id,
|
|
259
|
-
events: debuggerEvents
|
|
260
|
-
};
|
|
261
|
-
} else {
|
|
262
|
-
mergeReactiveObjects(pinia.state.value[$id], partialStateOrMutator);
|
|
263
|
-
subscriptionMutation = {
|
|
264
|
-
type: MutationType.patchObject,
|
|
265
|
-
payload: partialStateOrMutator,
|
|
266
|
-
storeId: $id,
|
|
267
|
-
events: debuggerEvents
|
|
268
|
-
};
|
|
269
|
-
}
|
|
270
|
-
const myListenerId = activeListener = Symbol();
|
|
271
|
-
nextTick().then(()=>{
|
|
272
|
-
if (activeListener === myListenerId) {
|
|
273
|
-
isListening = true;
|
|
274
|
-
}
|
|
275
|
-
});
|
|
276
|
-
isSyncListening = true;
|
|
277
|
-
// because we paused the watcher, we need to manually call the subscriptions
|
|
278
|
-
triggerSubscriptions(subscriptions, subscriptionMutation, pinia.state.value[$id]);
|
|
279
|
-
}
|
|
280
|
-
const $reset = isOptionsStore ? function $reset() {
|
|
281
|
-
const { state } = options;
|
|
282
|
-
const newState = state ? state() : {};
|
|
283
|
-
// we use a patch to group all changes into one single subscription
|
|
284
|
-
this.$patch(($state)=>{
|
|
285
|
-
assign($state, newState);
|
|
286
|
-
});
|
|
287
|
-
} : /* istanbul ignore next */ process.env.NODE_ENV !== 'production' ? ()=>{
|
|
288
|
-
throw new Error(`🍍: Store "${$id}" is built using the setup syntax and does not implement $reset().`);
|
|
289
|
-
} : noop$1;
|
|
290
|
-
function $dispose() {
|
|
291
|
-
scope.stop();
|
|
292
|
-
subscriptions = [];
|
|
293
|
-
actionSubscriptions = [];
|
|
294
|
-
pinia._s.delete($id);
|
|
295
|
-
}
|
|
296
|
-
/**
|
|
297
|
-
* Wraps an action to handle subscriptions.
|
|
298
|
-
*
|
|
299
|
-
* @param name - name of the action
|
|
300
|
-
* @param action - action to wrap
|
|
301
|
-
* @returns a wrapped action to handle subscriptions
|
|
302
|
-
*/ function wrapAction(name, action) {
|
|
303
|
-
return function() {
|
|
304
|
-
setActivePinia(pinia);
|
|
305
|
-
const args = Array.from(arguments);
|
|
306
|
-
const afterCallbackList = [];
|
|
307
|
-
const onErrorCallbackList = [];
|
|
308
|
-
function after(callback) {
|
|
309
|
-
afterCallbackList.push(callback);
|
|
310
|
-
}
|
|
311
|
-
function onError(callback) {
|
|
312
|
-
onErrorCallbackList.push(callback);
|
|
313
|
-
}
|
|
314
|
-
// @ts-expect-error
|
|
315
|
-
triggerSubscriptions(actionSubscriptions, {
|
|
316
|
-
args,
|
|
317
|
-
name,
|
|
318
|
-
store,
|
|
319
|
-
after,
|
|
320
|
-
onError
|
|
321
|
-
});
|
|
322
|
-
let ret;
|
|
323
|
-
try {
|
|
324
|
-
ret = action.apply(this && this.$id === $id ? this : store, args);
|
|
325
|
-
// handle sync errors
|
|
326
|
-
} catch (error) {
|
|
327
|
-
triggerSubscriptions(onErrorCallbackList, error);
|
|
328
|
-
throw error;
|
|
329
|
-
}
|
|
330
|
-
if (ret instanceof Promise) {
|
|
331
|
-
return ret.then((value)=>{
|
|
332
|
-
triggerSubscriptions(afterCallbackList, value);
|
|
333
|
-
return value;
|
|
334
|
-
}).catch((error)=>{
|
|
335
|
-
triggerSubscriptions(onErrorCallbackList, error);
|
|
336
|
-
return Promise.reject(error);
|
|
337
|
-
});
|
|
338
|
-
}
|
|
339
|
-
// trigger after callbacks
|
|
340
|
-
triggerSubscriptions(afterCallbackList, ret);
|
|
341
|
-
return ret;
|
|
342
|
-
};
|
|
343
|
-
}
|
|
344
|
-
const _hmrPayload = /*#__PURE__*/ markRaw({
|
|
345
|
-
actions: {},
|
|
346
|
-
getters: {},
|
|
347
|
-
state: [],
|
|
348
|
-
hotState
|
|
349
|
-
});
|
|
350
|
-
const partialStore = {
|
|
351
|
-
_p: pinia,
|
|
352
|
-
// _s: scope,
|
|
353
|
-
$id,
|
|
354
|
-
$onAction: addSubscription.bind(null, actionSubscriptions),
|
|
355
|
-
$patch,
|
|
356
|
-
$reset,
|
|
357
|
-
$subscribe (callback, options = {}) {
|
|
358
|
-
const removeSubscription = addSubscription(subscriptions, callback, options.detached, ()=>stopWatcher());
|
|
359
|
-
const stopWatcher = scope.run(()=>watch(()=>pinia.state.value[$id], (state)=>{
|
|
360
|
-
if (options.flush === 'sync' ? isSyncListening : isListening) {
|
|
361
|
-
callback({
|
|
362
|
-
storeId: $id,
|
|
363
|
-
type: MutationType.direct,
|
|
364
|
-
events: debuggerEvents
|
|
365
|
-
}, state);
|
|
366
|
-
}
|
|
367
|
-
}, assign({}, $subscribeOptions, options)));
|
|
368
|
-
return removeSubscription;
|
|
369
|
-
},
|
|
370
|
-
$dispose
|
|
371
|
-
};
|
|
372
|
-
const store = reactive(process.env.NODE_ENV !== 'production' || USE_DEVTOOLS ? assign({
|
|
373
|
-
_hmrPayload,
|
|
374
|
-
_customProperties: markRaw(new Set())
|
|
375
|
-
}, partialStore) : partialStore);
|
|
376
|
-
// store the partial store now so the setup of stores can instantiate each other before they are finished without
|
|
377
|
-
// creating infinite loops.
|
|
378
|
-
pinia._s.set($id, store);
|
|
379
|
-
const runWithContext = pinia._a && pinia._a.runWithContext || fallbackRunWithContext;
|
|
380
|
-
// TODO: idea create skipSerialize that marks properties as non serializable and they are skipped
|
|
381
|
-
const setupStore = runWithContext(()=>pinia._e.run(()=>(scope = effectScope()).run(setup)));
|
|
382
|
-
// overwrite existing actions to support $onAction
|
|
383
|
-
for(const key in setupStore){
|
|
384
|
-
const prop = setupStore[key];
|
|
385
|
-
if (isRef(prop) && !isComputed(prop) || isReactive(prop)) {
|
|
386
|
-
// mark it as a piece of state to be serialized
|
|
387
|
-
if (process.env.NODE_ENV !== 'production' && hot) {
|
|
388
|
-
set(hotState.value, key, toRef(setupStore, key));
|
|
389
|
-
// createOptionStore directly sets the state in pinia.state.value so we
|
|
390
|
-
// can just skip that
|
|
391
|
-
} else if (!isOptionsStore) {
|
|
392
|
-
// in setup stores we must hydrate the state and sync pinia state tree with the refs the user just created
|
|
393
|
-
if (initialState && shouldHydrate(prop)) {
|
|
394
|
-
if (isRef(prop)) {
|
|
395
|
-
prop.value = initialState[key];
|
|
396
|
-
} else {
|
|
397
|
-
// probably a reactive object, lets recursively assign
|
|
398
|
-
// @ts-expect-error: prop is unknown
|
|
399
|
-
mergeReactiveObjects(prop, initialState[key]);
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
// transfer the ref to the pinia state to keep everything in sync
|
|
403
|
-
/* istanbul ignore if */ {
|
|
404
|
-
pinia.state.value[$id][key] = prop;
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
/* istanbul ignore else */ if (process.env.NODE_ENV !== 'production') {
|
|
408
|
-
_hmrPayload.state.push(key);
|
|
409
|
-
}
|
|
410
|
-
// action
|
|
411
|
-
} else if (typeof prop === 'function') {
|
|
412
|
-
// @ts-expect-error: we are overriding the function we avoid wrapping if
|
|
413
|
-
const actionValue = process.env.NODE_ENV !== 'production' && hot ? prop : wrapAction(key, prop);
|
|
414
|
-
// this a hot module replacement store because the hotUpdate method needs
|
|
415
|
-
// to do it with the right context
|
|
416
|
-
/* istanbul ignore if */ {
|
|
417
|
-
// @ts-expect-error
|
|
418
|
-
setupStore[key] = actionValue;
|
|
419
|
-
}
|
|
420
|
-
/* istanbul ignore else */ if (process.env.NODE_ENV !== 'production') {
|
|
421
|
-
_hmrPayload.actions[key] = prop;
|
|
422
|
-
}
|
|
423
|
-
// list actions so they can be used in plugins
|
|
424
|
-
// @ts-expect-error
|
|
425
|
-
optionsForPlugin.actions[key] = prop;
|
|
426
|
-
} else if (process.env.NODE_ENV !== 'production') {
|
|
427
|
-
// add getters for devtools
|
|
428
|
-
if (isComputed(prop)) {
|
|
429
|
-
_hmrPayload.getters[key] = isOptionsStore ? options.getters[key] : prop;
|
|
430
|
-
if (IS_CLIENT) {
|
|
431
|
-
const getters = setupStore._getters || // @ts-expect-error: same
|
|
432
|
-
(setupStore._getters = markRaw([]));
|
|
433
|
-
getters.push(key);
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
// add the state, getters, and action properties
|
|
439
|
-
/* istanbul ignore if */ {
|
|
440
|
-
assign(store, setupStore);
|
|
441
|
-
// allows retrieving reactive objects with `storeToRefs()`. Must be called after assigning to the reactive object.
|
|
442
|
-
// Make `storeToRefs()` work with `reactive()` #799
|
|
443
|
-
assign(toRaw(store), setupStore);
|
|
444
|
-
}
|
|
445
|
-
// use this instead of a computed with setter to be able to create it anywhere
|
|
446
|
-
// without linking the computed lifespan to wherever the store is first
|
|
447
|
-
// created.
|
|
448
|
-
Object.defineProperty(store, '$state', {
|
|
449
|
-
get: ()=>process.env.NODE_ENV !== 'production' && hot ? hotState.value : pinia.state.value[$id],
|
|
450
|
-
set: (state)=>{
|
|
451
|
-
/* istanbul ignore if */ if (process.env.NODE_ENV !== 'production' && hot) {
|
|
452
|
-
throw new Error('cannot set hotState');
|
|
453
|
-
}
|
|
454
|
-
$patch(($state)=>{
|
|
455
|
-
assign($state, state);
|
|
456
|
-
});
|
|
457
|
-
}
|
|
458
|
-
});
|
|
459
|
-
// add the hotUpdate before plugins to allow them to override it
|
|
460
|
-
/* istanbul ignore else */ if (process.env.NODE_ENV !== 'production') {
|
|
461
|
-
store._hotUpdate = markRaw((newStore)=>{
|
|
462
|
-
store._hotUpdating = true;
|
|
463
|
-
newStore._hmrPayload.state.forEach((stateKey)=>{
|
|
464
|
-
if (stateKey in store.$state) {
|
|
465
|
-
const newStateTarget = newStore.$state[stateKey];
|
|
466
|
-
const oldStateSource = store.$state[stateKey];
|
|
467
|
-
if (typeof newStateTarget === 'object' && isPlainObject(newStateTarget) && isPlainObject(oldStateSource)) {
|
|
468
|
-
patchObject(newStateTarget, oldStateSource);
|
|
469
|
-
} else {
|
|
470
|
-
// transfer the ref
|
|
471
|
-
newStore.$state[stateKey] = oldStateSource;
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
// patch direct access properties to allow store.stateProperty to work as
|
|
475
|
-
// store.$state.stateProperty
|
|
476
|
-
set(store, stateKey, toRef(newStore.$state, stateKey));
|
|
477
|
-
});
|
|
478
|
-
// remove deleted state properties
|
|
479
|
-
Object.keys(store.$state).forEach((stateKey)=>{
|
|
480
|
-
if (!(stateKey in newStore.$state)) {
|
|
481
|
-
del(store, stateKey);
|
|
482
|
-
}
|
|
483
|
-
});
|
|
484
|
-
// avoid devtools logging this as a mutation
|
|
485
|
-
isListening = false;
|
|
486
|
-
isSyncListening = false;
|
|
487
|
-
pinia.state.value[$id] = toRef(newStore._hmrPayload, 'hotState');
|
|
488
|
-
isSyncListening = true;
|
|
489
|
-
nextTick().then(()=>{
|
|
490
|
-
isListening = true;
|
|
491
|
-
});
|
|
492
|
-
for(const actionName in newStore._hmrPayload.actions){
|
|
493
|
-
const action = newStore[actionName];
|
|
494
|
-
set(store, actionName, wrapAction(actionName, action));
|
|
495
|
-
}
|
|
496
|
-
// TODO: does this work in both setup and option store?
|
|
497
|
-
for(const getterName in newStore._hmrPayload.getters){
|
|
498
|
-
const getter = newStore._hmrPayload.getters[getterName];
|
|
499
|
-
const getterValue = isOptionsStore ? computed(()=>{
|
|
500
|
-
setActivePinia(pinia);
|
|
501
|
-
return getter.call(store, store);
|
|
502
|
-
}) : getter;
|
|
503
|
-
set(store, getterName, getterValue);
|
|
504
|
-
}
|
|
505
|
-
// remove deleted getters
|
|
506
|
-
Object.keys(store._hmrPayload.getters).forEach((key)=>{
|
|
507
|
-
if (!(key in newStore._hmrPayload.getters)) {
|
|
508
|
-
del(store, key);
|
|
509
|
-
}
|
|
510
|
-
});
|
|
511
|
-
// remove old actions
|
|
512
|
-
Object.keys(store._hmrPayload.actions).forEach((key)=>{
|
|
513
|
-
if (!(key in newStore._hmrPayload.actions)) {
|
|
514
|
-
del(store, key);
|
|
515
|
-
}
|
|
516
|
-
});
|
|
517
|
-
// update the values used in devtools and to allow deleting new properties later on
|
|
518
|
-
store._hmrPayload = newStore._hmrPayload;
|
|
519
|
-
store._getters = newStore._getters;
|
|
520
|
-
store._hotUpdating = false;
|
|
521
|
-
});
|
|
522
|
-
}
|
|
523
|
-
if (USE_DEVTOOLS) {
|
|
524
|
-
const nonEnumerable = {
|
|
525
|
-
writable: true,
|
|
526
|
-
configurable: true,
|
|
527
|
-
// avoid warning on devtools trying to display this property
|
|
528
|
-
enumerable: false
|
|
529
|
-
};
|
|
530
|
-
[
|
|
531
|
-
'_p',
|
|
532
|
-
'_hmrPayload',
|
|
533
|
-
'_getters',
|
|
534
|
-
'_customProperties'
|
|
535
|
-
].forEach((p)=>{
|
|
536
|
-
Object.defineProperty(store, p, assign({
|
|
537
|
-
value: store[p]
|
|
538
|
-
}, nonEnumerable));
|
|
539
|
-
});
|
|
540
|
-
}
|
|
541
|
-
// apply all plugins
|
|
542
|
-
pinia._p.forEach((extender)=>{
|
|
543
|
-
/* istanbul ignore else */ if (USE_DEVTOOLS) {
|
|
544
|
-
const extensions = scope.run(()=>extender({
|
|
545
|
-
store,
|
|
546
|
-
app: pinia._a,
|
|
547
|
-
pinia,
|
|
548
|
-
options: optionsForPlugin
|
|
549
|
-
}));
|
|
550
|
-
Object.keys(extensions || {}).forEach((key)=>store._customProperties.add(key));
|
|
551
|
-
assign(store, extensions);
|
|
552
|
-
} else {
|
|
553
|
-
assign(store, scope.run(()=>extender({
|
|
554
|
-
store,
|
|
555
|
-
app: pinia._a,
|
|
556
|
-
pinia,
|
|
557
|
-
options: optionsForPlugin
|
|
558
|
-
})));
|
|
559
|
-
}
|
|
560
|
-
});
|
|
561
|
-
if (process.env.NODE_ENV !== 'production' && store.$state && typeof store.$state === 'object' && typeof store.$state.constructor === 'function' && !store.$state.constructor.toString().includes('[native code]')) {
|
|
562
|
-
console.warn(`[🍍]: The "state" must be a plain object. It cannot be\n` + `\tstate: () => new MyClass()\n` + `Found in store "${store.$id}".`);
|
|
563
|
-
}
|
|
564
|
-
// only apply hydrate to option stores with an initial state in pinia
|
|
565
|
-
if (initialState && isOptionsStore && options.hydrate) {
|
|
566
|
-
options.hydrate(store.$state, initialState);
|
|
567
|
-
}
|
|
568
|
-
isListening = true;
|
|
569
|
-
isSyncListening = true;
|
|
570
|
-
return store;
|
|
571
|
-
}
|
|
572
|
-
function defineStore(// TODO: add proper types from above
|
|
573
|
-
idOrOptions, setup, setupOptions) {
|
|
574
|
-
let id;
|
|
575
|
-
let options;
|
|
576
|
-
const isSetupStore = typeof setup === 'function';
|
|
577
|
-
{
|
|
578
|
-
id = idOrOptions;
|
|
579
|
-
// the option store setup will contain the actual options in this case
|
|
580
|
-
options = isSetupStore ? setupOptions : setup;
|
|
581
|
-
}
|
|
582
|
-
function useStore(pinia, hot) {
|
|
583
|
-
const hasContext = hasInjectionContext();
|
|
584
|
-
pinia = // in test mode, ignore the argument provided as we can always retrieve a
|
|
585
|
-
// pinia instance with getActivePinia()
|
|
586
|
-
(process.env.NODE_ENV === 'test' && activePinia && activePinia._testing ? null : pinia) || (hasContext ? inject$2(piniaSymbol, null) : null);
|
|
587
|
-
if (pinia) setActivePinia(pinia);
|
|
588
|
-
if (process.env.NODE_ENV !== 'production' && !activePinia) {
|
|
589
|
-
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.`);
|
|
590
|
-
}
|
|
591
|
-
pinia = activePinia;
|
|
592
|
-
if (!pinia._s.has(id)) {
|
|
593
|
-
// creating the store registers it in `pinia._s`
|
|
594
|
-
if (isSetupStore) {
|
|
595
|
-
createSetupStore(id, setup, options, pinia);
|
|
596
|
-
} else {
|
|
597
|
-
createOptionsStore(id, options, pinia);
|
|
598
|
-
}
|
|
599
|
-
/* istanbul ignore else */ if (process.env.NODE_ENV !== 'production') {
|
|
600
|
-
// @ts-expect-error: not the right inferred type
|
|
601
|
-
useStore._pinia = pinia;
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
|
-
const store = pinia._s.get(id);
|
|
605
|
-
if (process.env.NODE_ENV !== 'production' && hot) {
|
|
606
|
-
const hotId = '__hot:' + id;
|
|
607
|
-
const newStore = isSetupStore ? createSetupStore(hotId, setup, options, pinia, true) : createOptionsStore(hotId, assign({}, options), pinia, true);
|
|
608
|
-
hot._hotUpdate(newStore);
|
|
609
|
-
// cleanup the state properties and the store from the cache
|
|
610
|
-
delete pinia.state.value[hotId];
|
|
611
|
-
pinia._s.delete(hotId);
|
|
612
|
-
}
|
|
613
|
-
if (process.env.NODE_ENV !== 'production' && IS_CLIENT) {
|
|
614
|
-
const currentInstance = getCurrentInstance();
|
|
615
|
-
// save stores in instances to access them devtools
|
|
616
|
-
if (currentInstance && currentInstance.proxy && // avoid adding stores that are just built for hot module replacement
|
|
617
|
-
!hot) {
|
|
618
|
-
const vm = currentInstance.proxy;
|
|
619
|
-
const cache = '_pStores' in vm ? vm._pStores : vm._pStores = {};
|
|
620
|
-
cache[id] = store;
|
|
621
|
-
}
|
|
622
|
-
}
|
|
623
|
-
// StoreGeneric cannot be casted towards Store
|
|
624
|
-
return store;
|
|
625
|
-
}
|
|
626
|
-
useStore.$id = id;
|
|
627
|
-
return useStore;
|
|
628
|
-
}
|
|
629
|
-
/**
|
|
630
|
-
* Creates an object of references with all the state, getters, and plugin-added
|
|
631
|
-
* state properties of the store. Similar to `toRefs()` but specifically
|
|
632
|
-
* designed for Pinia stores so methods and non reactive properties are
|
|
633
|
-
* completely ignored.
|
|
634
|
-
*
|
|
635
|
-
* @param store - store to extract the refs from
|
|
636
|
-
*/ function storeToRefs$1(store) {
|
|
637
|
-
// See https://github.com/vuejs/pinia/issues/852
|
|
638
|
-
// It's easier to just use toRefs() even if it includes more stuff
|
|
639
|
-
{
|
|
640
|
-
store = toRaw(store);
|
|
641
|
-
const refs = {};
|
|
642
|
-
for(const key in store){
|
|
643
|
-
const value = store[key];
|
|
644
|
-
if (isRef(value) || isReactive(value)) {
|
|
645
|
-
// @ts-expect-error: the key is state or getter
|
|
646
|
-
refs[key] = // ---
|
|
647
|
-
toRef(store, key);
|
|
648
|
-
}
|
|
649
|
-
}
|
|
650
|
-
return refs;
|
|
651
|
-
}
|
|
652
|
-
}
|
|
653
|
-
|
|
654
17
|
function inject$1(key, instance) {
|
|
655
18
|
if (instance && instance._context && instance._context.provides && instance._context.provides[key]) {
|
|
656
19
|
return instance._context.provides[key];
|
|
@@ -7244,66 +6607,66 @@ const AEntityDelete = defineComponent({
|
|
|
7244
6607
|
});
|
|
7245
6608
|
|
|
7246
6609
|
var components = /*#__PURE__*/Object.freeze({
|
|
7247
|
-
|
|
7248
|
-
|
|
7249
|
-
|
|
7250
|
-
|
|
7251
|
-
|
|
7252
|
-
|
|
7253
|
-
|
|
7254
|
-
|
|
7255
|
-
|
|
7256
|
-
|
|
7257
|
-
|
|
7258
|
-
|
|
7259
|
-
|
|
7260
|
-
|
|
7261
|
-
|
|
7262
|
-
|
|
7263
|
-
|
|
7264
|
-
|
|
7265
|
-
|
|
7266
|
-
|
|
7267
|
-
|
|
7268
|
-
|
|
7269
|
-
|
|
7270
|
-
|
|
7271
|
-
|
|
7272
|
-
|
|
7273
|
-
|
|
7274
|
-
|
|
7275
|
-
|
|
7276
|
-
|
|
7277
|
-
|
|
7278
|
-
|
|
7279
|
-
|
|
7280
|
-
|
|
7281
|
-
|
|
7282
|
-
|
|
7283
|
-
|
|
7284
|
-
|
|
7285
|
-
|
|
7286
|
-
|
|
7287
|
-
|
|
7288
|
-
|
|
7289
|
-
|
|
7290
|
-
|
|
7291
|
-
|
|
7292
|
-
|
|
7293
|
-
|
|
7294
|
-
|
|
7295
|
-
|
|
7296
|
-
|
|
7297
|
-
|
|
7298
|
-
|
|
7299
|
-
|
|
7300
|
-
|
|
7301
|
-
|
|
7302
|
-
|
|
7303
|
-
|
|
7304
|
-
|
|
7305
|
-
|
|
7306
|
-
|
|
6610
|
+
__proto__: null,
|
|
6611
|
+
AClient: AClient,
|
|
6612
|
+
AClientForm: AClientForm,
|
|
6613
|
+
AClientRedirectUris: AClientRedirectUris,
|
|
6614
|
+
AClientRedirectUrisItem: AClientRedirectUrisItem,
|
|
6615
|
+
AClientScope: AClientScope,
|
|
6616
|
+
AClientScopeAssignment: AClientScopeAssignment,
|
|
6617
|
+
AClientScopeAssignments: AClientScopeAssignments,
|
|
6618
|
+
AClientScopes: AClientScopes,
|
|
6619
|
+
AClients: AClients,
|
|
6620
|
+
AEntityDelete: AEntityDelete,
|
|
6621
|
+
AIdentityProvider: AIdentityProvider,
|
|
6622
|
+
AIdentityProviderForm: AIdentityProviderForm,
|
|
6623
|
+
AIdentityProviderIcon: AIdentityProviderIcon,
|
|
6624
|
+
AIdentityProviderLdapForm: AIdentityProviderLdapForm,
|
|
6625
|
+
AIdentityProviderOAuth2Form: AIdentityProviderOAuth2Form,
|
|
6626
|
+
AIdentityProviderPreset: AIdentityProviderPreset,
|
|
6627
|
+
AIdentityProviderProtocol: AIdentityProviderProtocol,
|
|
6628
|
+
AIdentityProviderRoleAssignment: AIdentityProviderRoleAssignment,
|
|
6629
|
+
AIdentityProviderRoleAssignments: AIdentityProviderRoleAssignments,
|
|
6630
|
+
AIdentityProviders: AIdentityProviders,
|
|
6631
|
+
APagination: APagination,
|
|
6632
|
+
APermission: APermission,
|
|
6633
|
+
APermissionForm: APermissionForm,
|
|
6634
|
+
APermissionRobotAssignments: APermissionRobotAssignments,
|
|
6635
|
+
APermissionRoleAssignments: APermissionRoleAssignments,
|
|
6636
|
+
APermissionUserAssignments: APermissionUserAssignments,
|
|
6637
|
+
APermissions: APermissions,
|
|
6638
|
+
ARealm: ARealm,
|
|
6639
|
+
ARealmForm: ARealmForm,
|
|
6640
|
+
ARealms: ARealms,
|
|
6641
|
+
ARobot: ARobot,
|
|
6642
|
+
ARobotForm: ARobotForm,
|
|
6643
|
+
ARobotPermissionAssignment: ARobotPermissionAssignment,
|
|
6644
|
+
ARobotPermissionAssignments: ARobotPermissionAssignments,
|
|
6645
|
+
ARobotRoleAssignment: ARobotRoleAssignment,
|
|
6646
|
+
ARobotRoleAssignments: ARobotRoleAssignments,
|
|
6647
|
+
ARobots: ARobots,
|
|
6648
|
+
ARole: ARole,
|
|
6649
|
+
ARoleForm: ARoleForm,
|
|
6650
|
+
ARolePermissionAssignment: ARolePermissionAssignment,
|
|
6651
|
+
ARolePermissionAssignments: ARolePermissionAssignments,
|
|
6652
|
+
ARoleRobotAssignments: ARoleRobotAssignments,
|
|
6653
|
+
ARoleUserAssignments: ARoleUserAssignments,
|
|
6654
|
+
ARoles: ARoles,
|
|
6655
|
+
AScope: AScope,
|
|
6656
|
+
AScopeClientAssignments: AScopeClientAssignments,
|
|
6657
|
+
AScopeForm: AScopeForm,
|
|
6658
|
+
AScopes: AScopes,
|
|
6659
|
+
ASearch: ASearch,
|
|
6660
|
+
ATitle: ATitle,
|
|
6661
|
+
AUser: AUser,
|
|
6662
|
+
AUserForm: AUserForm,
|
|
6663
|
+
AUserPasswordForm: AUserPasswordForm,
|
|
6664
|
+
AUserPermissionAssignment: AUserPermissionAssignment,
|
|
6665
|
+
AUserPermissionAssignments: AUserPermissionAssignments,
|
|
6666
|
+
AUserRoleAssignment: AUserRoleAssignment,
|
|
6667
|
+
AUserRoleAssignments: AUserRoleAssignments,
|
|
6668
|
+
AUsers: AUsers,
|
|
6669
|
+
LanguageSwitcherDropdown: LanguageSwitcherDropdown
|
|
7307
6670
|
});
|
|
7308
6671
|
|
|
7309
6672
|
function installComponents(input) {
|
|
@@ -7328,9 +6691,6 @@ function install(app1, options) {
|
|
|
7328
6691
|
baseURL: options.realtimeURL || options.baseURL
|
|
7329
6692
|
});
|
|
7330
6693
|
}
|
|
7331
|
-
if (options.pinia) {
|
|
7332
|
-
setActivePinia(options.pinia);
|
|
7333
|
-
}
|
|
7334
6694
|
installStore(app1, {
|
|
7335
6695
|
baseURL: options.baseURL,
|
|
7336
6696
|
cookieSet: options.cookieSet,
|