@asgardeo/javascript 0.10.0 → 0.10.1

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.
@@ -38,6 +38,8 @@ declare class StorageManager<T> {
38
38
  getConfigData(userId?: string): Promise<AuthClientConfig<T>>;
39
39
  loadOpenIDProviderConfiguration(): Promise<OIDCDiscoveryApiResponse>;
40
40
  getTemporaryData(userId?: string): Promise<TemporaryStore>;
41
+ getPersistedData(userId?: string): Promise<TemporaryStore>;
42
+ setPersistedData(persistedData: Partial<TemporaryStore>, userId?: string): Promise<void>;
41
43
  getSessionData(userId?: string, instanceId?: string): Promise<SessionData>;
42
44
  getCustomData<K>(key: string, userId?: string): Promise<K>;
43
45
  setSessionStatus(status: string): void;
@@ -20,6 +20,10 @@ import { OIDCEndpoints } from '../../models/oidc-endpoints';
20
20
  export interface DefaultAuthClientConfig {
21
21
  afterSignInUrl: string;
22
22
  afterSignOutUrl?: string;
23
+ /**
24
+ * Application UUID for the client.
25
+ */
26
+ applicationId?: string;
23
27
  clientHost?: string;
24
28
  clientId?: string;
25
29
  clientSecret?: string;
package/dist/cjs/index.js CHANGED
@@ -978,6 +978,12 @@ var StorageManager = class _StorageManager {
978
978
  async getTemporaryData(userId) {
979
979
  return JSON.parse(await this.store.getData(this.resolveKey("temporary_data" /* TemporaryData */, userId)) ?? null);
980
980
  }
981
+ async getPersistedData(userId) {
982
+ return JSON.parse(await this.store.getData(this.resolveKey("persisted_data" /* PersistedData */, userId)) ?? null);
983
+ }
984
+ async setPersistedData(persistedData, userId) {
985
+ this.setDataInBulk(this.resolveKey("persisted_data" /* PersistedData */, userId), persistedData);
986
+ }
981
987
  async getSessionData(userId, instanceId) {
982
988
  return JSON.parse(await this.store.getData(this.resolveKey("session_data" /* SessionData */, userId, instanceId)) ?? null);
983
989
  }
@@ -1236,9 +1242,21 @@ var _AsgardeoAuthClient = class _AsgardeoAuthClient {
1236
1242
  this.configProvider = async () => this.storageManager.getConfigData();
1237
1243
  this.oidcProviderMetaDataProvider = async () => this.storageManager.loadOpenIDProviderConfiguration();
1238
1244
  _AsgardeoAuthClient.authHelperInstance = this.authHelper;
1245
+ let { applicationId } = config;
1246
+ if (applicationId) {
1247
+ await this.storageManager.setPersistedData({
1248
+ applicationId
1249
+ });
1250
+ } else {
1251
+ const persistedData = await this.storageManager.getPersistedData();
1252
+ if (persistedData["applicationId"]) {
1253
+ applicationId = persistedData["applicationId"];
1254
+ }
1255
+ }
1239
1256
  await this.storageManager.setConfigData({
1240
1257
  ...DefaultConfig,
1241
1258
  ...config,
1259
+ applicationId,
1242
1260
  scope: processOpenIDScopes_default(config.scopes)
1243
1261
  });
1244
1262
  }