@authup/client-web-kit 1.0.0-beta.13 → 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/index.mjs CHANGED
@@ -1,5 +1,5 @@
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';
1
2
  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, toRaw, isRef, isReactive, toRef, getCurrentInstance, ref, watch, reactive, markRaw, effectScope, nextTick, computed, getCurrentScope, onScopeDispose, toRefs, unref, h, onMounted, onUnmounted, shallowRef, watchEffect, defineComponent, resolveDynamicComponent, mergeProps } from 'vue';
3
3
  import { Client, isClientTokenExpiredError, CookieName, ClientResponseErrorTokenHook } from '@authup/core-http-kit';
4
4
  import { Abilities, buildEventFullName, EventNameSuffix, hasOwnProperty, createNanoID, isOAuth2OpenIDProviderMetadata, isObject as isObject$1 } from '@authup/kit';
5
5
  import { merge, isObject, createMerger } from 'smob';
@@ -13,46 +13,6 @@ import useVuelidate from '@vuelidate/core';
13
13
  import { buildPagination as buildPagination$1 } from '@vuecs/pagination';
14
14
  import Cookie from 'universal-cookie';
15
15
 
16
- function inject$1(key, instance) {
17
- if (instance && instance._context && instance._context.provides && instance._context.provides[key]) {
18
- return instance._context.provides[key];
19
- }
20
- if (hasInjectionContext()) {
21
- return inject$2(key, undefined);
22
- }
23
- return undefined;
24
- }
25
-
26
- function provide(key, value, app) {
27
- if (typeof app === 'undefined') {
28
- const val = inject$1(key);
29
- if (typeof val !== 'undefined') {
30
- return;
31
- }
32
- provide$1(key, value);
33
- return;
34
- }
35
- if (app && app._context && app._context.provides && app._context.provides[key]) {
36
- return;
37
- }
38
- app.provide(key, value);
39
- }
40
-
41
- const HTTPClientSymbol = Symbol.for('AuthupHTTPClient');
42
- function provideHTTPClient(client, app) {
43
- provide(HTTPClientSymbol, client, app);
44
- }
45
- function hasHTTPClient(app) {
46
- return !!inject$1(HTTPClientSymbol, app);
47
- }
48
- function injectHTTPClient(app) {
49
- const instance = inject$1(HTTPClientSymbol, app);
50
- if (!instance) {
51
- throw new Error('The api client has not been injected.');
52
- }
53
- return instance;
54
- }
55
-
56
16
  var isVue2 = false;
57
17
  function set(target, key, val) {
58
18
  if (Array.isArray(target)) {
@@ -691,6 +651,46 @@ idOrOptions, setup, setupOptions) {
691
651
  }
692
652
  }
693
653
 
654
+ function inject$1(key, instance) {
655
+ if (instance && instance._context && instance._context.provides && instance._context.provides[key]) {
656
+ return instance._context.provides[key];
657
+ }
658
+ if (hasInjectionContext()) {
659
+ return inject$2(key, undefined);
660
+ }
661
+ return undefined;
662
+ }
663
+
664
+ function provide(key, value, app) {
665
+ if (typeof app === 'undefined') {
666
+ const val = inject$1(key);
667
+ if (typeof val !== 'undefined') {
668
+ return;
669
+ }
670
+ provide$1(key, value);
671
+ return;
672
+ }
673
+ if (app && app._context && app._context.provides && app._context.provides[key]) {
674
+ return;
675
+ }
676
+ app.provide(key, value);
677
+ }
678
+
679
+ const HTTPClientSymbol = Symbol.for('AuthupHTTPClient');
680
+ function provideHTTPClient(client, app) {
681
+ provide(HTTPClientSymbol, client, app);
682
+ }
683
+ function hasHTTPClient(app) {
684
+ return !!inject$1(HTTPClientSymbol, app);
685
+ }
686
+ function injectHTTPClient(app) {
687
+ const instance = inject$1(HTTPClientSymbol, app);
688
+ if (!instance) {
689
+ throw new Error('The api client has not been injected.');
690
+ }
691
+ return instance;
692
+ }
693
+
694
694
  /*
695
695
  * Copyright (c) 2024.
696
696
  * Author Peter Placzek (tada5hi)
@@ -988,7 +988,7 @@ function installStore(app, options = {}) {
988
988
  const storeCreator = defineStore(STORE_ID, ()=>createStore({
989
989
  baseURL: options.baseURL
990
990
  }));
991
- const store = storeCreator();
991
+ const store = storeCreator(options.pinia);
992
992
  const cookies = useCookies();
993
993
  let cookieGet;
994
994
  if (options.cookieGet) {
@@ -1119,7 +1119,7 @@ function installHTTPClient(app, options = {}) {
1119
1119
  baseURL: options.baseURL
1120
1120
  });
1121
1121
  const storeCreator = injectStore(app);
1122
- const store = storeCreator();
1122
+ const store = storeCreator(options.pinia);
1123
1123
  const { refreshToken } = storeToRefs$1(store);
1124
1124
  const tokenHook = new ClientResponseErrorTokenHook(client, {
1125
1125
  baseURL: options.baseURL,
@@ -7244,66 +7244,66 @@ const AEntityDelete = defineComponent({
7244
7244
  });
7245
7245
 
7246
7246
  var components = /*#__PURE__*/Object.freeze({
7247
- __proto__: null,
7248
- AClient: AClient,
7249
- AClientForm: AClientForm,
7250
- AClientRedirectUris: AClientRedirectUris,
7251
- AClientRedirectUrisItem: AClientRedirectUrisItem,
7252
- AClientScope: AClientScope,
7253
- AClientScopeAssignment: AClientScopeAssignment,
7254
- AClientScopeAssignments: AClientScopeAssignments,
7255
- AClientScopes: AClientScopes,
7256
- AClients: AClients,
7257
- AEntityDelete: AEntityDelete,
7258
- AIdentityProvider: AIdentityProvider,
7259
- AIdentityProviderForm: AIdentityProviderForm,
7260
- AIdentityProviderIcon: AIdentityProviderIcon,
7261
- AIdentityProviderLdapForm: AIdentityProviderLdapForm,
7262
- AIdentityProviderOAuth2Form: AIdentityProviderOAuth2Form,
7263
- AIdentityProviderPreset: AIdentityProviderPreset,
7264
- AIdentityProviderProtocol: AIdentityProviderProtocol,
7265
- AIdentityProviderRoleAssignment: AIdentityProviderRoleAssignment,
7266
- AIdentityProviderRoleAssignments: AIdentityProviderRoleAssignments,
7267
- AIdentityProviders: AIdentityProviders,
7268
- APagination: APagination,
7269
- APermission: APermission,
7270
- APermissionForm: APermissionForm,
7271
- APermissionRobotAssignments: APermissionRobotAssignments,
7272
- APermissionRoleAssignments: APermissionRoleAssignments,
7273
- APermissionUserAssignments: APermissionUserAssignments,
7274
- APermissions: APermissions,
7275
- ARealm: ARealm,
7276
- ARealmForm: ARealmForm,
7277
- ARealms: ARealms,
7278
- ARobot: ARobot,
7279
- ARobotForm: ARobotForm,
7280
- ARobotPermissionAssignment: ARobotPermissionAssignment,
7281
- ARobotPermissionAssignments: ARobotPermissionAssignments,
7282
- ARobotRoleAssignment: ARobotRoleAssignment,
7283
- ARobotRoleAssignments: ARobotRoleAssignments,
7284
- ARobots: ARobots,
7285
- ARole: ARole,
7286
- ARoleForm: ARoleForm,
7287
- ARolePermissionAssignment: ARolePermissionAssignment,
7288
- ARolePermissionAssignments: ARolePermissionAssignments,
7289
- ARoleRobotAssignments: ARoleRobotAssignments,
7290
- ARoleUserAssignments: ARoleUserAssignments,
7291
- ARoles: ARoles,
7292
- AScope: AScope,
7293
- AScopeClientAssignments: AScopeClientAssignments,
7294
- AScopeForm: AScopeForm,
7295
- AScopes: AScopes,
7296
- ASearch: ASearch,
7297
- ATitle: ATitle,
7298
- AUser: AUser,
7299
- AUserForm: AUserForm,
7300
- AUserPasswordForm: AUserPasswordForm,
7301
- AUserPermissionAssignment: AUserPermissionAssignment,
7302
- AUserPermissionAssignments: AUserPermissionAssignments,
7303
- AUserRoleAssignment: AUserRoleAssignment,
7304
- AUserRoleAssignments: AUserRoleAssignments,
7305
- AUsers: AUsers,
7306
- LanguageSwitcherDropdown: LanguageSwitcherDropdown
7247
+ __proto__: null,
7248
+ AClient: AClient,
7249
+ AClientForm: AClientForm,
7250
+ AClientRedirectUris: AClientRedirectUris,
7251
+ AClientRedirectUrisItem: AClientRedirectUrisItem,
7252
+ AClientScope: AClientScope,
7253
+ AClientScopeAssignment: AClientScopeAssignment,
7254
+ AClientScopeAssignments: AClientScopeAssignments,
7255
+ AClientScopes: AClientScopes,
7256
+ AClients: AClients,
7257
+ AEntityDelete: AEntityDelete,
7258
+ AIdentityProvider: AIdentityProvider,
7259
+ AIdentityProviderForm: AIdentityProviderForm,
7260
+ AIdentityProviderIcon: AIdentityProviderIcon,
7261
+ AIdentityProviderLdapForm: AIdentityProviderLdapForm,
7262
+ AIdentityProviderOAuth2Form: AIdentityProviderOAuth2Form,
7263
+ AIdentityProviderPreset: AIdentityProviderPreset,
7264
+ AIdentityProviderProtocol: AIdentityProviderProtocol,
7265
+ AIdentityProviderRoleAssignment: AIdentityProviderRoleAssignment,
7266
+ AIdentityProviderRoleAssignments: AIdentityProviderRoleAssignments,
7267
+ AIdentityProviders: AIdentityProviders,
7268
+ APagination: APagination,
7269
+ APermission: APermission,
7270
+ APermissionForm: APermissionForm,
7271
+ APermissionRobotAssignments: APermissionRobotAssignments,
7272
+ APermissionRoleAssignments: APermissionRoleAssignments,
7273
+ APermissionUserAssignments: APermissionUserAssignments,
7274
+ APermissions: APermissions,
7275
+ ARealm: ARealm,
7276
+ ARealmForm: ARealmForm,
7277
+ ARealms: ARealms,
7278
+ ARobot: ARobot,
7279
+ ARobotForm: ARobotForm,
7280
+ ARobotPermissionAssignment: ARobotPermissionAssignment,
7281
+ ARobotPermissionAssignments: ARobotPermissionAssignments,
7282
+ ARobotRoleAssignment: ARobotRoleAssignment,
7283
+ ARobotRoleAssignments: ARobotRoleAssignments,
7284
+ ARobots: ARobots,
7285
+ ARole: ARole,
7286
+ ARoleForm: ARoleForm,
7287
+ ARolePermissionAssignment: ARolePermissionAssignment,
7288
+ ARolePermissionAssignments: ARolePermissionAssignments,
7289
+ ARoleRobotAssignments: ARoleRobotAssignments,
7290
+ ARoleUserAssignments: ARoleUserAssignments,
7291
+ ARoles: ARoles,
7292
+ AScope: AScope,
7293
+ AScopeClientAssignments: AScopeClientAssignments,
7294
+ AScopeForm: AScopeForm,
7295
+ AScopes: AScopes,
7296
+ ASearch: ASearch,
7297
+ ATitle: ATitle,
7298
+ AUser: AUser,
7299
+ AUserForm: AUserForm,
7300
+ AUserPasswordForm: AUserPasswordForm,
7301
+ AUserPermissionAssignment: AUserPermissionAssignment,
7302
+ AUserPermissionAssignments: AUserPermissionAssignments,
7303
+ AUserRoleAssignment: AUserRoleAssignment,
7304
+ AUserRoleAssignments: AUserRoleAssignments,
7305
+ AUsers: AUsers,
7306
+ LanguageSwitcherDropdown: LanguageSwitcherDropdown
7307
7307
  });
7308
7308
 
7309
7309
  function installComponents(input) {
@@ -7328,14 +7328,19 @@ function install(app1, options) {
7328
7328
  baseURL: options.realtimeURL || options.baseURL
7329
7329
  });
7330
7330
  }
7331
+ if (options.pinia) {
7332
+ setActivePinia(options.pinia);
7333
+ }
7331
7334
  installStore(app1, {
7332
7335
  baseURL: options.baseURL,
7333
7336
  cookieSet: options.cookieSet,
7334
7337
  cookieGet: options.cookieGet,
7335
- cookieUnset: options.cookieUnset
7338
+ cookieUnset: options.cookieUnset,
7339
+ pinia: options.pinia
7336
7340
  });
7337
7341
  installHTTPClient(app1, {
7338
- baseURL: options.baseURL
7342
+ baseURL: options.baseURL,
7343
+ pinia: options.pinia
7339
7344
  });
7340
7345
  installTranslator(app1, {
7341
7346
  locale: options.translatorLocale