@ts-core/angular 15.0.36 → 15.0.37
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/esm2020/login/LoginTokenStorage.mjs +2 -2
- package/esm2020/public-api.mjs +3 -1
- package/esm2020/storage/DateValueStorage.mjs +27 -0
- package/esm2020/storage/IValueStorage.mjs +2 -0
- package/esm2020/storage/ValueStorage.mjs +35 -13
- package/fesm2015/ts-core-angular.mjs +60 -14
- package/fesm2015/ts-core-angular.mjs.map +1 -1
- package/fesm2020/ts-core-angular.mjs +60 -14
- package/fesm2020/ts-core-angular.mjs.map +1 -1
- package/package.json +1 -1
- package/public-api.d.ts +2 -0
- package/storage/DateValueStorage.d.ts +6 -0
- package/storage/IValueStorage.d.ts +8 -0
- package/storage/ValueStorage.d.ts +10 -6
|
@@ -3348,11 +3348,22 @@ class ValueStorage extends DestroyableContainer {
|
|
|
3348
3348
|
// Constructor
|
|
3349
3349
|
//
|
|
3350
3350
|
//--------------------------------------------------------------------------
|
|
3351
|
-
constructor(
|
|
3351
|
+
constructor(name, storage, cookies) {
|
|
3352
3352
|
super();
|
|
3353
|
-
this.
|
|
3353
|
+
this.storage = storage;
|
|
3354
3354
|
this.cookies = cookies;
|
|
3355
|
-
this.
|
|
3355
|
+
this._name = name;
|
|
3356
|
+
}
|
|
3357
|
+
//--------------------------------------------------------------------------
|
|
3358
|
+
//
|
|
3359
|
+
// Protected Methods
|
|
3360
|
+
//
|
|
3361
|
+
//--------------------------------------------------------------------------
|
|
3362
|
+
serialize(value) {
|
|
3363
|
+
return value;
|
|
3364
|
+
}
|
|
3365
|
+
deserialize(value) {
|
|
3366
|
+
return value;
|
|
3356
3367
|
}
|
|
3357
3368
|
//--------------------------------------------------------------------------
|
|
3358
3369
|
//
|
|
@@ -3360,20 +3371,22 @@ class ValueStorage extends DestroyableContainer {
|
|
|
3360
3371
|
//
|
|
3361
3372
|
//--------------------------------------------------------------------------
|
|
3362
3373
|
get(defaultValue) {
|
|
3363
|
-
|
|
3364
|
-
|
|
3374
|
+
let item = null;
|
|
3375
|
+
if (this.storage.has(this.name)) {
|
|
3376
|
+
item = this.storage.get(this.name);
|
|
3365
3377
|
}
|
|
3366
|
-
if (this.cookies.has(this.name)) {
|
|
3367
|
-
|
|
3378
|
+
else if (this.cookies.has(this.name)) {
|
|
3379
|
+
item = this.cookies.get(this.name);
|
|
3368
3380
|
}
|
|
3369
|
-
return defaultValue;
|
|
3381
|
+
return !_.isNil(item) ? this.serialize(item) : defaultValue;
|
|
3370
3382
|
}
|
|
3371
3383
|
has() {
|
|
3372
|
-
return this.
|
|
3384
|
+
return this.storage.has(this.name) || this.cookies.has(this.name);
|
|
3373
3385
|
}
|
|
3374
3386
|
set(value) {
|
|
3375
|
-
|
|
3376
|
-
this.
|
|
3387
|
+
let item = !_.isNil(value) ? this.deserialize(value) : null;
|
|
3388
|
+
this.cookies.put(this.name, item);
|
|
3389
|
+
this.storage.set(this.name, item);
|
|
3377
3390
|
}
|
|
3378
3391
|
destroy() {
|
|
3379
3392
|
if (this.isDestroyed) {
|
|
@@ -3381,7 +3394,15 @@ class ValueStorage extends DestroyableContainer {
|
|
|
3381
3394
|
}
|
|
3382
3395
|
super.destroy();
|
|
3383
3396
|
this.cookies = null;
|
|
3384
|
-
this.
|
|
3397
|
+
this.storage = null;
|
|
3398
|
+
}
|
|
3399
|
+
//--------------------------------------------------------------------------
|
|
3400
|
+
//
|
|
3401
|
+
// Public Properties
|
|
3402
|
+
//
|
|
3403
|
+
//--------------------------------------------------------------------------
|
|
3404
|
+
get name() {
|
|
3405
|
+
return this._name;
|
|
3385
3406
|
}
|
|
3386
3407
|
}
|
|
3387
3408
|
|
|
@@ -3392,7 +3413,7 @@ class LoginTokenStorage extends ValueStorage {
|
|
|
3392
3413
|
//
|
|
3393
3414
|
//--------------------------------------------------------------------------
|
|
3394
3415
|
constructor(localStorage, cookies) {
|
|
3395
|
-
super(localStorage, cookies
|
|
3416
|
+
super(LoginTokenStorage.TOKEN_KEY, localStorage, cookies);
|
|
3396
3417
|
}
|
|
3397
3418
|
}
|
|
3398
3419
|
//--------------------------------------------------------------------------
|
|
@@ -6432,6 +6453,31 @@ class LocalStorageService extends DestroyableContainer {
|
|
|
6432
6453
|
}
|
|
6433
6454
|
}
|
|
6434
6455
|
|
|
6456
|
+
class DateValueStorage extends ValueStorage {
|
|
6457
|
+
//--------------------------------------------------------------------------
|
|
6458
|
+
//
|
|
6459
|
+
// Protected Methods
|
|
6460
|
+
//
|
|
6461
|
+
//--------------------------------------------------------------------------
|
|
6462
|
+
serialize(value) {
|
|
6463
|
+
return new Date(value);
|
|
6464
|
+
}
|
|
6465
|
+
deserialize(value) {
|
|
6466
|
+
return value.toISOString();
|
|
6467
|
+
}
|
|
6468
|
+
//--------------------------------------------------------------------------
|
|
6469
|
+
//
|
|
6470
|
+
// Public Methods
|
|
6471
|
+
//
|
|
6472
|
+
//--------------------------------------------------------------------------
|
|
6473
|
+
isExpired(item) {
|
|
6474
|
+
if (_.isNil(item)) {
|
|
6475
|
+
item = new Date();
|
|
6476
|
+
}
|
|
6477
|
+
return this.has() ? this.get().getTime() < item.getTime() : true;
|
|
6478
|
+
}
|
|
6479
|
+
}
|
|
6480
|
+
|
|
6435
6481
|
class LazyModuleLoader extends Loadable {
|
|
6436
6482
|
//--------------------------------------------------------------------------
|
|
6437
6483
|
//
|
|
@@ -6795,5 +6841,5 @@ const VI_ANGULAR_OPTIONS = new InjectionToken(`VI_ANGULAR_OPTIONS`);
|
|
|
6795
6841
|
* Generated bundle index. Do not edit.
|
|
6796
6842
|
*/
|
|
6797
6843
|
|
|
6798
|
-
export { APPLICATION_INJECTOR, ApplicationBaseComponent, ApplicationComponent, AspectRatioResizeDirective, AssetBackgroundDirective, AssetBackgroundPipe, AssetFilePipe, AssetIconPipe, AssetImagePipe, AssetModule, AssetSoundPipe, AssetVideoPipe, AutoScrollBottomDirective, BottomSheetService, COOKIE_OPTIONS, CamelCasePipe, CanDeactivateGuard, ClickToCopyDirective, ClickToSelectDirective, CookieModule, CookieOptions, CookieService, Direction, FinancePipe, FocusDirective, FocusManager, FormElementAsync, FormElementSync, HTMLContentTitleDirective, HTMLTitleDirective, INotification, INotificationContent, IUser, IVIOptions, IWindow, IWindowContent, InfiniteScrollDirective, IsBrowserDirective, IsServerDirective, LANGUAGE_OPTIONS, LanguageDirective, LanguageHasDirective, LanguageModule, LanguagePipe, LanguagePipeHas, LanguagePipeHasPure, LanguagePipePure, LanguageRequireResolver, LanguageResolver, LazyModuleLoader, ListItem, ListItems, LocalStorageService, LoginBaseService, LoginBaseServiceEvent, LoginGuard, LoginIfCanGuard, LoginNotGuard, LoginRequireResolver, LoginResolver, LoginTokenStorage, MenuItem, MenuItemBase, MenuItems, MessageBaseComponent, MomentDateAdaptivePipe, MomentDateFromNowPipe, MomentDatePipe, MomentTimePipe, NavigationMenuItem, NgModelErrorPipe, NotificationConfig, NotificationEvent, NotificationService, NotificationServiceEvent, PipeBaseService, PlatformService, PrettifyPipe, QuestionEvent, QuestionManager, QuestionMode, ResizeDirective, ResizeManager, RouterBaseService, SanitizePipe, ScrollCheckDirective, ScrollDirective, SelectListItem, SelectListItems, SelectOnFocusDirective, StartCasePipe, StructureDirective, THEME_OPTIONS, ThemeAssetBackgroundDirective, ThemeAssetDirective, ThemeAssetIconDirective, ThemeAssetImageDirective, ThemeModule, ThemeStyleDirective, ThemeStyleHoverDirective, ThemeToggleDirective, TimePipe, TransportLazy, TransportLazyModule, TransportLazyModuleLoadedEvent, TruncatePipe, UserBaseService, UserBaseServiceEvent, VIModule, VI_ANGULAR_OPTIONS, ValueStorage, ViewUtil, WINDOW_CONTENT_CONTAINER, WindowAlign, WindowBase, WindowClosedError, WindowConfig, WindowEvent, WindowService, WindowServiceEvent, cookieServiceFactory, initializerFactory, languageServiceFactory, localStorageServiceFactory, loggerServiceFactory, loginTokenStorageServiceFactory, nativeWindowServiceFactory, themeAssetServiceFactory, themeServiceFactory };
|
|
6844
|
+
export { APPLICATION_INJECTOR, ApplicationBaseComponent, ApplicationComponent, AspectRatioResizeDirective, AssetBackgroundDirective, AssetBackgroundPipe, AssetFilePipe, AssetIconPipe, AssetImagePipe, AssetModule, AssetSoundPipe, AssetVideoPipe, AutoScrollBottomDirective, BottomSheetService, COOKIE_OPTIONS, CamelCasePipe, CanDeactivateGuard, ClickToCopyDirective, ClickToSelectDirective, CookieModule, CookieOptions, CookieService, DateValueStorage, Direction, FinancePipe, FocusDirective, FocusManager, FormElementAsync, FormElementSync, HTMLContentTitleDirective, HTMLTitleDirective, INotification, INotificationContent, IUser, IVIOptions, IWindow, IWindowContent, InfiniteScrollDirective, IsBrowserDirective, IsServerDirective, LANGUAGE_OPTIONS, LanguageDirective, LanguageHasDirective, LanguageModule, LanguagePipe, LanguagePipeHas, LanguagePipeHasPure, LanguagePipePure, LanguageRequireResolver, LanguageResolver, LazyModuleLoader, ListItem, ListItems, LocalStorageService, LoginBaseService, LoginBaseServiceEvent, LoginGuard, LoginIfCanGuard, LoginNotGuard, LoginRequireResolver, LoginResolver, LoginTokenStorage, MenuItem, MenuItemBase, MenuItems, MessageBaseComponent, MomentDateAdaptivePipe, MomentDateFromNowPipe, MomentDatePipe, MomentTimePipe, NavigationMenuItem, NgModelErrorPipe, NotificationConfig, NotificationEvent, NotificationService, NotificationServiceEvent, PipeBaseService, PlatformService, PrettifyPipe, QuestionEvent, QuestionManager, QuestionMode, ResizeDirective, ResizeManager, RouterBaseService, SanitizePipe, ScrollCheckDirective, ScrollDirective, SelectListItem, SelectListItems, SelectOnFocusDirective, StartCasePipe, StructureDirective, THEME_OPTIONS, ThemeAssetBackgroundDirective, ThemeAssetDirective, ThemeAssetIconDirective, ThemeAssetImageDirective, ThemeModule, ThemeStyleDirective, ThemeStyleHoverDirective, ThemeToggleDirective, TimePipe, TransportLazy, TransportLazyModule, TransportLazyModuleLoadedEvent, TruncatePipe, UserBaseService, UserBaseServiceEvent, VIModule, VI_ANGULAR_OPTIONS, ValueStorage, ViewUtil, WINDOW_CONTENT_CONTAINER, WindowAlign, WindowBase, WindowClosedError, WindowConfig, WindowEvent, WindowService, WindowServiceEvent, cookieServiceFactory, initializerFactory, languageServiceFactory, localStorageServiceFactory, loggerServiceFactory, loginTokenStorageServiceFactory, nativeWindowServiceFactory, themeAssetServiceFactory, themeServiceFactory };
|
|
6799
6845
|
//# sourceMappingURL=ts-core-angular.mjs.map
|