modules inc

This commit is contained in:
nannal
2021-07-15 23:10:20 +03:00
parent 6bb353de89
commit 5921b02b7c
845 changed files with 105299 additions and 121 deletions

View File

@@ -0,0 +1,16 @@
import { AccountInfo } from "@azure/msal-common";
/**
* Token cache interface for the client, giving access to cache APIs
* @public
*/
export interface ITokenCache {
/** API that retrieves all accounts currently in cache to the user */
getAllAccounts(): Promise<AccountInfo[]>;
/** Returns the signed in account matching homeAccountId */
getAccountByHomeId(homeAccountId: string): Promise<AccountInfo | null>;
/** Returns the signed in account matching localAccountId */
getAccountByLocalId(localAccountId: string): Promise<AccountInfo | null>;
/** API to remove a specific account and the relevant data from cache */
removeAccount(account: AccountInfo): Promise<void>;
}
//# sourceMappingURL=ITokenCache.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ITokenCache.d.ts","sourceRoot":"","sources":["../src/cache/ITokenCache.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD;;;GAGG;AACH,MAAM,WAAW,WAAW;IAExB,qEAAqE;IACrE,cAAc,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;IAEzC,2DAA2D;IAC3D,kBAAkB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAEvE,4DAA4D;IAC5D,mBAAmB,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAEzE,wEAAwE;IACxE,aAAa,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACtD"}

View File

@@ -0,0 +1,177 @@
import { AccountEntity, IdTokenEntity, AccessTokenEntity, RefreshTokenEntity, AppMetadataEntity, ServerTelemetryEntity, ThrottlingEntity, CacheManager, Logger, ValidCacheType, ICrypto, AuthorityMetadataEntity } from "@azure/msal-common";
import { InMemoryCache, JsonCache, CacheKVStore } from "./serializer/SerializerTypes";
/**
* This class implements Storage for node, reading cache from user specified storage location or an extension library
* @public
*/
export declare class NodeStorage extends CacheManager {
private logger;
private cache;
private changeEmitters;
constructor(logger: Logger, clientId: string, cryptoImpl: ICrypto);
/**
* Queue up callbacks
* @param func - a callback function for cache change indication
*/
registerChangeEmitter(func: () => void): void;
/**
* Invoke the callback when cache changes
*/
emitChange(): void;
/**
* Converts cacheKVStore to InMemoryCache
* @param cache - key value store
*/
cacheToInMemoryCache(cache: CacheKVStore): InMemoryCache;
/**
* converts inMemoryCache to CacheKVStore
* @param inMemoryCache - kvstore map for inmemory
*/
inMemoryCacheToCache(inMemoryCache: InMemoryCache): CacheKVStore;
/**
* gets the current in memory cache for the client
*/
getInMemoryCache(): InMemoryCache;
/**
* sets the current in memory cache for the client
* @param inMemoryCache - key value map in memory
*/
setInMemoryCache(inMemoryCache: InMemoryCache): void;
/**
* get the current cache key-value store
*/
getCache(): CacheKVStore;
/**
* sets the current cache (key value store)
* @param cacheMap - key value map
*/
setCache(cache: CacheKVStore): void;
/**
* Gets cache item with given key.
* @param key - lookup key for the cache entry
*/
getItem(key: string): ValidCacheType;
/**
* Gets cache item with given key-value
* @param key - lookup key for the cache entry
* @param value - value of the cache entry
*/
setItem(key: string, value: ValidCacheType): void;
/**
* fetch the account entity
* @param accountKey - lookup key to fetch cache type AccountEntity
*/
getAccount(accountKey: string): AccountEntity | null;
/**
* set account entity
* @param account - cache value to be set of type AccountEntity
*/
setAccount(account: AccountEntity): void;
/**
* fetch the idToken credential
* @param idTokenKey - lookup key to fetch cache type IdTokenEntity
*/
getIdTokenCredential(idTokenKey: string): IdTokenEntity | null;
/**
* set idToken credential
* @param idToken - cache value to be set of type IdTokenEntity
*/
setIdTokenCredential(idToken: IdTokenEntity): void;
/**
* fetch the accessToken credential
* @param accessTokenKey - lookup key to fetch cache type AccessTokenEntity
*/
getAccessTokenCredential(accessTokenKey: string): AccessTokenEntity | null;
/**
* set accessToken credential
* @param accessToken - cache value to be set of type AccessTokenEntity
*/
setAccessTokenCredential(accessToken: AccessTokenEntity): void;
/**
* fetch the refreshToken credential
* @param refreshTokenKey - lookup key to fetch cache type RefreshTokenEntity
*/
getRefreshTokenCredential(refreshTokenKey: string): RefreshTokenEntity | null;
/**
* set refreshToken credential
* @param refreshToken - cache value to be set of type RefreshTokenEntity
*/
setRefreshTokenCredential(refreshToken: RefreshTokenEntity): void;
/**
* fetch appMetadata entity from the platform cache
* @param appMetadataKey - lookup key to fetch cache type AppMetadataEntity
*/
getAppMetadata(appMetadataKey: string): AppMetadataEntity | null;
/**
* set appMetadata entity to the platform cache
* @param appMetadata - cache value to be set of type AppMetadataEntity
*/
setAppMetadata(appMetadata: AppMetadataEntity): void;
/**
* fetch server telemetry entity from the platform cache
* @param serverTelemetrykey - lookup key to fetch cache type ServerTelemetryEntity
*/
getServerTelemetry(serverTelemetrykey: string): ServerTelemetryEntity | null;
/**
* set server telemetry entity to the platform cache
* @param serverTelemetryKey - lookup key to fetch cache type ServerTelemetryEntity
* @param serverTelemetry - cache value to be set of type ServerTelemetryEntity
*/
setServerTelemetry(serverTelemetryKey: string, serverTelemetry: ServerTelemetryEntity): void;
/**
* fetch authority metadata entity from the platform cache
* @param key - lookup key to fetch cache type AuthorityMetadataEntity
*/
getAuthorityMetadata(key: string): AuthorityMetadataEntity | null;
/**
* Get all authority metadata keys
*/
getAuthorityMetadataKeys(): Array<string>;
/**
* set authority metadata entity to the platform cache
* @param key - lookup key to fetch cache type AuthorityMetadataEntity
* @param metadata - cache value to be set of type AuthorityMetadataEntity
*/
setAuthorityMetadata(key: string, metadata: AuthorityMetadataEntity): void;
/**
* fetch throttling entity from the platform cache
* @param throttlingCacheKey - lookup key to fetch cache type ThrottlingEntity
*/
getThrottlingCache(throttlingCacheKey: string): ThrottlingEntity | null;
/**
* set throttling entity to the platform cache
* @param throttlingCacheKey - lookup key to fetch cache type ThrottlingEntity
* @param throttlingCache - cache value to be set of type ThrottlingEntity
*/
setThrottlingCache(throttlingCacheKey: string, throttlingCache: ThrottlingEntity): void;
/**
* Removes the cache item from memory with the given key.
* @param key - lookup key to remove a cache entity
* @param inMemory - key value map of the cache
*/
removeItem(key: string): boolean;
/**
* Checks whether key is in cache.
* @param key - look up key for a cache entity
*/
containsKey(key: string): boolean;
/**
* Gets all keys in window.
*/
getKeys(): string[];
/**
* Clears all cache entries created by MSAL (except tokens).
*/
clear(): void;
/**
* Initialize in memory cache from an exisiting cache vault
* @param cache - blob formatted cache (JSON)
*/
static generateInMemoryCache(cache: string): InMemoryCache;
/**
* retrieves the final JSON
* @param inMemoryCache - itemised cache read from the JSON
*/
static generateJsonCache(inMemoryCache: InMemoryCache): JsonCache;
}
//# sourceMappingURL=NodeStorage.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"NodeStorage.d.ts","sourceRoot":"","sources":["../src/cache/NodeStorage.ts"],"names":[],"mappings":"AAKA,OAAO,EACH,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,gBAAgB,EAChB,YAAY,EACZ,MAAM,EACN,cAAc,EACd,OAAO,EACP,uBAAuB,EAC1B,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAEtF;;;GAGG;AACH,qBAAa,WAAY,SAAQ,YAAY;IAEzC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,KAAK,CAAoB;IACjC,OAAO,CAAC,cAAc,CAAuB;gBAEjC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO;IAKjE;;;OAGG;IACH,qBAAqB,CAAC,IAAI,EAAE,MAAM,IAAI,GAAG,IAAI;IAI7C;;OAEG;IACH,UAAU,IAAI,IAAI;IAIlB;;;OAGG;IACH,oBAAoB,CAAC,KAAK,EAAE,YAAY,GAAG,aAAa;IA6BxD;;;OAGG;IACH,oBAAoB,CAAC,aA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AE,MAAM,EAAE,eAAe,EAAE,qBAAqB,GAAG,IAAI;IAI5F;;;OAGG;IACH,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,uBAAuB,GAAG,IAAI;IAQjE;;OAEG;IACH,wBAAwB,IAAI,KAAK,CAAC,MAAM,CAAC;IAMzC;;;;OAIG;IACH,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,uBAAuB,GAAG,IAAI;IAI1E;;;OAGG;IACH,kBAAkB,CAAC,kBAAkB,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI;IAQvE;;;;OAIG;IACH,kBAAkB,CAAC,kBAAkB,EAAE,MAAM,EAAE,eAAe,EAAE,gBAAgB,GAAG,IAAI;IAIvF;;;;OAIG;IACH,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAoBhC;;;OAGG;IACH,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAIjC;;OAEG;IACH,OAAO,IAAI,MAAM,EAAE;IAQnB;;OAEG;IACH,KAAK,IAAI,IAAI;IAab;;;OAGG;IACH,MAAM,CAAC,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa;IAM1D;;;OAGG;IACH,MAAM,CAAC,iBAAiB,CAAC,aAAa,EAAE,aAAa,GAAG,SAAS;CAGpE"}

View File

@@ -0,0 +1,91 @@
import { NodeStorage } from "./NodeStorage";
import { AccountInfo, Logger, ISerializableTokenCache, ICachePlugin } from "@azure/msal-common";
import { CacheKVStore } from "./serializer/SerializerTypes";
import { ITokenCache } from "./ITokenCache";
/**
* In-memory token cache manager
* @public
*/
export declare class TokenCache implements ISerializableTokenCache, ITokenCache {
private storage;
private cacheHasChanged;
private cacheSnapshot;
private readonly persistence;
private logger;
constructor(storage: NodeStorage, logger: Logger, cachePlugin?: ICachePlugin);
/**
* Set to true if cache state has changed since last time serialize or writeToPersistence was called
*/
hasChanged(): boolean;
/**
* Serializes in memory cache to JSON
*/
serialize(): string;
/**
* Deserializes JSON to in-memory cache. JSON should be in MSAL cache schema format
* @param cache - blob formatted cache
*/
deserialize(cache: string): void;
/**
* Fetches the cache key-value map
*/
getKVStore(): CacheKVStore;
/**
* API that retrieves all accounts currently in cache to the user
*/
getAllAccounts(): Promise<AccountInfo[]>;
/**
* Returns the signed in account matching homeAccountId.
* (the account object is created at the time of successful login)
* or null when no matching account is found
* @param homeAccountId - unique identifier for an account (uid.utid)
*/
getAccountByHomeId(homeAccountId: string): Promise<AccountInfo | null>;
/**
* Returns the signed in account matching localAccountId.
* (the account object is created at the time of successful login)
* or null when no matching account is found
* @param localAccountId - unique identifier of an account (sub/obj when homeAccountId cannot be populated)
*/
getAccountByLocalId(localAccountId: string): Promise<AccountInfo | null>;
/**
* API to remove a specific account and the relevant data from cache
* @param account - AccountInfo passed by the user
*/
removeAccount(account: AccountInfo): Promise<void>;
/**
* Called when the cache has changed state.
*/
private handleChangeEvent;
/**
* Merge in memory cache with the cache snapshot.
* @param oldState - cache before changes
* @param currentState - current cache state in the library
*/
private mergeState;
/**
* Deep update of oldState based on newState values
* @param oldState - cache before changes
* @param newState - updated cache
*/
private mergeUpdates;
/**
* Removes entities in oldState that the were removed from newState. If there are any unknown values in root of
* oldState that are not recognized, they are left untouched.
* @param oldState - cache before changes
* @param newState - updated cache
*/
private mergeRemovals;
/**
* Helper to merge new cache with the old one
* @param oldState - cache before changes
* @param newState - updated cache
*/
private mergeRemovalsDict;
/**
* Helper to overlay as a part of cache merge
* @param passedInCache - cache read from the blob
*/
private overlayDefaults;
}
//# sourceMappingURL=TokenCache.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"TokenCache.d.ts","sourceRoot":"","sources":["../src/cache/TokenCache.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAA8B,WAAW,EAAE,MAAM,EAAE,uBAAuB,EAAE,YAAY,EAAqB,MAAM,oBAAoB,CAAC;AAC/I,OAAO,EA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adataCache } from "@azure/msal-common";
import { JsonCache, InMemoryCache, SerializedAccountEntity, SerializedIdTokenEntity, SerializedAccessTokenEntity, SerializedRefreshTokenEntity, SerializedAppMetadataEntity } from "./SerializerTypes";
/**
* This class deserializes cache entities read from the file into in memory object types defined internally
*/
export declare class Deserializer {
/**
* Parse the JSON blob in memory and deserialize the content
* @param cachedJson
*/
static deserializeJSONBlob(jsonFile: string): JsonCache;
/**
* Deserializes accounts to AccountEntity objects
* @param accounts
*/
static deserializeAccounts(accounts: Record<string, SerializedAccountEntity>): AccountCache;
/**
* Deserializes id tokens to IdTokenEntity objects
* @param idTokens
*/
static deserializeIdTokens(idTokens: Record<string, SerializedIdTokenEntity>): IdTokenCache;
/**
* Deserializes access tokens to AccessTokenEntity objects
* @param accessTokens
*/
static deserializeAccessTokens(accessTokens: Record<string, SerializedAccessTokenEntity>): AccessTokenCache;
/**
* Deserializes refresh tokens to RefreshTokenEntity objects
* @param refreshTokens
*/
static deserializeRefreshTokens(refreshTokens: Record<string, SerializedRefreshTokenEntity>): RefreshTokenCache;
/**
* Deserializes appMetadata to AppMetaData objects
* @param appMetadata
*/
static deserializeAppMetadata(appMetadata: Record<string, SerializedAppMetadataEntity>): AppMetadataCache;
/**
* Deserialize an inMemory Cache
* @param jsonCache
*/
static deserializeAllCache(jsonCache: JsonCache): InMemoryCache;
}
//# sourceMappingURL=Deserializer.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"Deserializer.d.ts","sourceRoot":"","sources":["../../src/cache/serializer/Deserializer.ts"],"names":[],"mappings":"AAKA,OAAO,EAAe,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,gBAAgB,EAAwG,MAAM,oBAAoB,CAAC;AAC1O,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,2BAA2B,EAAE,4BAA4B,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAC;AAEvM;;GAEG;AACH,qBAAa,YAAY;IACrB;;;OAGG;IACH,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS;IAOvD;;;OAGG;IACH,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,GAAG,YAAY;IA0B3F;;;OAGG;IACH,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,GAAG,YAAY;IAqB3F;;;OAGG;IACH,MAAM,CAAC,uBAAuB,CAAC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,2BAA2B,CAAC,GAAG,gBAAgB;IA6B3G;;;OAGG;IACH,MAAM,CAAC,wBAAwB,CAAC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,4BAA4B,CAAC,GAAG,iBAAiB;IAwB/G;;;OAGG;IACH,MAAM,CAAC,sBAAsB,CAAC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,2BAA2B,CAAC,GAAG,gBAAgB;IAmBzG;;;OAGG;IACH,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,SAAS,GAAG,aAAa;CAmBlE"}

View File

@@ -0,0 +1,40 @@
import { AccountCache, IdTokenCache, AccessTokenCache, RefreshTokenCache, AppMetadataCache } from "@azure/msal-common";
import { InMemoryCache, JsonCache, SerializedAccountEntity, SerializedIdTokenEntity, SerializedAccessTokenEntity, SerializedRefreshTokenEntity, SerializedAppMetadataEntity } from "./SerializerTypes";
export declare class Serializer {
/**
* serialize the JSON blob
* @param data
*/
static serializeJSONBlob(data: JsonCache): string;
/**
* Serialize Accounts
* @param accCache
*/
static serializeAccounts(accCache: AccountCache): Record<string, SerializedAccountEntity>;
/**
* Serialize IdTokens
* @param idTCache
*/
static serializeIdTokens(idTCache: IdTokenCache): Record<string, SerializedIdTokenEntity>;
/**
* Serializes AccessTokens
* @param atCache
*/
static serializeAccessTokens(atCache: AccessTokenCache): Record<string, SerializedAccessTokenEntity>;
/**
* Serialize refreshTokens
* @param rtCache
*/
static serializeRefreshTokens(rtCache: RefreshTokenCache): Record<string, SerializedRefreshTokenEntity>;
/**
* Serialize amdtCache
* @param amdtCache
*/
static serializeAppMetadata(amdtCache: AppMetadataCache): Record<string, SerializedAppMetadataEntity>;
/**
* Serialize the cache
* @param jsonContent
*/
static serializeAllCache(inMemCache: InMemoryCache): JsonCache;
}
//# sourceMappingURL=Serializer.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"Serializer.d.ts","sourceRoot":"","sources":["../../src/cache/serializer/Serializer.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACvH,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,2BAA2B,EAAE,4BAA4B,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAC;AAEvM,qBAAa,UAAU;IACnB;;;OAGG;IACH,MAAM,CAAC,iBAAiB,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM;IAIjD;;;OAGG;IACH,MAAM,CAAC,iBAAiB,CAAC,QAAQ,EAAE,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC;IAqBzF;;;OAGG;IACH,MAAM,CAAC,iBAAiB,CAAC,QAAQ,EAAE,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC;IAiBzF;;;OAGG;IACH,MAAM,CAAC,qBAAqB,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,2BAA2B,CAAC;IAwBpG;;;OAGG;IACH,MAAM,CAAC,sBAAsB,CAAC,OAAO,EAAE,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,4BAA4B,CAAC;IAmBvG;;;OAGG;IACH,MAAM,CAAC,oBAAoB,CAAC,SAAS,EAAE,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,2BAA2B,CAAC;IAcrG;;;OAGG;IACH,MAAM,CAAC,iBAAiB,CAAC,UAAU,EAAE,aAAa,GAAG,SAAS;CASjE"}

View File

@@ -0,0 +1,99 @@
import { AccountCache, IdTokenCache, AccessTokenCache, RefreshTokenCache, AppMetadataCache, ValidCacheType } from "@azure/msal-common";
/**
* Key value store for in-memory cache
* @public
*/
export declare type CacheKVStore = Record<string, ValidCacheType>;
/**
* Cache format read from the cache blob provided to the configuration during app instantiation
* @public
*/
export declare type JsonCache = {
Account: Record<string, SerializedAccountEntity>;
IdToken: Record<string, SerializedIdTokenEntity>;
AccessToken: Record<string, SerializedAccessTokenEntity>;
RefreshToken: Record<string, SerializedRefreshTokenEntity>;
AppMetadata: Record<string, SerializedAppMetadataEntity>;
};
/**
* Intermittent type to handle in-memory data objects with defined types
* @public
*/
export declare type InMemoryCache = {
accounts: AccountCache;
idTokens: IdTokenCache;
accessTokens: AccessTokenCache;
refreshTokens: RefreshTokenCache;
appMetadata: AppMetadataCache;
};
/**
* Account type
* @public
*/
export declare type SerializedAccountEntity = {
home_account_id: string;
environment: string;
realm: string;
local_account_id: string;
username: string;
authority_type: string;
name?: string;
client_info?: string;
last_modification_time?: string;
last_modification_app?: string;
};
/**
* Idtoken credential type
* @public
*/
export declare type SerializedIdTokenEntity = {
home_account_id: string;
environment: string;
credential_type: string;
client_id: string;
secret: string;
realm: string;
};
/**
* Access token credential type
* @public
*/
export declare type SerializedAccessTokenEntity = {
home_account_id: string;
environment: string;
credential_type: string;
client_id: string;
secret: string;
realm: string;
target: string;
cached_at: string;
expires_on: string;
extended_expires_on?: string;
refresh_on?: string;
key_id?: string;
token_type?: string;
};
/**
* Refresh token credential type
* @public
*/
export declare type SerializedRefreshTokenEntity = {
home_account_id: string;
environment: string;
credential_type: string;
client_id: string;
secret: string;
family_id?: string;
target?: string;
realm?: string;
};
/**
* AppMetadata type
* @public
*/
export declare type SerializedAppMetadataEntity = {
client_id: string;
environment: string;
family_id?: string;
};
//# sourceMappingURL=SerializerTypes.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"SerializerTypes.d.ts","sourceRoot":"","sources":["../../src/cache/serializer/SerializerTypes.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEvI;;;GAGG;AACH,oBAAY,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;AAE1D;;;GAGG;AACH,oBAAY,SAAS,GAAG;IACpB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC;IACjD,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC;IACjD,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,2BAA2B,CAAC,CAAC;IACzD,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,4BAA4B,CAAC,CAAC;IAC3D,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,2BAA2B,CAAC,CAAC;CAC5D,CAAC;AAEF;;;GAGG;AACH,oBAAY,aAAa,GAAG;IACxB,QAAQ,EAAE,YAAY,CAAC;IACvB,QAAQ,EAAE,YAAY,CAAC;IACvB,YAAY,EAAE,gBAAgB,CAAC;IAC/B,aAAa,EAAE,iBAAiB,CAAC;IACjC,WAAW,EAAE,gBAAgB,CAAC;CACjC,CAAC;AAEF;;;GAGG;AACH,oBAAY,uBAAuB,GAAG;IAClC,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,C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