@ts-core/angular 15.0.35 → 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/VIModule.d.ts +3 -3
- package/esm2020/VIModule.mjs +6 -6
- package/esm2020/login/LoginTokenStorage.mjs +5 -27
- package/esm2020/public-api.mjs +5 -2
- package/esm2020/storage/DateValueStorage.mjs +27 -0
- package/esm2020/storage/IValueStorage.mjs +2 -0
- package/esm2020/storage/LocalStorageService.mjs +57 -0
- package/esm2020/storage/ValueStorage.mjs +66 -0
- package/fesm2015/ts-core-angular.mjs +80 -13
- package/fesm2015/ts-core-angular.mjs.map +1 -1
- package/fesm2020/ts-core-angular.mjs +80 -13
- package/fesm2020/ts-core-angular.mjs.map +1 -1
- package/login/LoginTokenStorage.d.ts +4 -9
- package/package.json +1 -1
- package/public-api.d.ts +4 -1
- package/storage/DateValueStorage.d.ts +6 -0
- package/storage/IValueStorage.d.ts +8 -0
- package/storage/{StorageService.d.ts → LocalStorageService.d.ts} +1 -1
- package/storage/ValueStorage.d.ts +17 -0
- package/esm2020/storage/StorageService.mjs +0 -57
|
@@ -3342,36 +3342,78 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
3342
3342
|
args: [LoginBaseService]
|
|
3343
3343
|
}] }]; } });
|
|
3344
3344
|
|
|
3345
|
-
class
|
|
3345
|
+
class ValueStorage extends DestroyableContainer {
|
|
3346
3346
|
//--------------------------------------------------------------------------
|
|
3347
3347
|
//
|
|
3348
3348
|
// Constructor
|
|
3349
3349
|
//
|
|
3350
3350
|
//--------------------------------------------------------------------------
|
|
3351
|
-
constructor(storage, cookies) {
|
|
3351
|
+
constructor(name, storage, cookies) {
|
|
3352
3352
|
super();
|
|
3353
3353
|
this.storage = storage;
|
|
3354
3354
|
this.cookies = cookies;
|
|
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;
|
|
3355
3367
|
}
|
|
3356
3368
|
//--------------------------------------------------------------------------
|
|
3357
3369
|
//
|
|
3358
3370
|
// Public Methods
|
|
3359
3371
|
//
|
|
3360
3372
|
//--------------------------------------------------------------------------
|
|
3361
|
-
get() {
|
|
3362
|
-
|
|
3373
|
+
get(defaultValue) {
|
|
3374
|
+
let item = null;
|
|
3375
|
+
if (this.storage.has(this.name)) {
|
|
3376
|
+
item = this.storage.get(this.name);
|
|
3377
|
+
}
|
|
3378
|
+
else if (this.cookies.has(this.name)) {
|
|
3379
|
+
item = this.cookies.get(this.name);
|
|
3380
|
+
}
|
|
3381
|
+
return !_.isNil(item) ? this.serialize(item) : defaultValue;
|
|
3382
|
+
}
|
|
3383
|
+
has() {
|
|
3384
|
+
return this.storage.has(this.name) || this.cookies.has(this.name);
|
|
3363
3385
|
}
|
|
3364
3386
|
set(value) {
|
|
3365
|
-
this.
|
|
3366
|
-
this.cookies.put(
|
|
3387
|
+
let item = !_.isNil(value) ? this.deserialize(value) : null;
|
|
3388
|
+
this.cookies.put(this.name, item);
|
|
3389
|
+
this.storage.set(this.name, item);
|
|
3367
3390
|
}
|
|
3368
3391
|
destroy() {
|
|
3369
3392
|
if (this.isDestroyed) {
|
|
3370
3393
|
return;
|
|
3371
3394
|
}
|
|
3372
3395
|
super.destroy();
|
|
3373
|
-
this.storage = null;
|
|
3374
3396
|
this.cookies = null;
|
|
3397
|
+
this.storage = null;
|
|
3398
|
+
}
|
|
3399
|
+
//--------------------------------------------------------------------------
|
|
3400
|
+
//
|
|
3401
|
+
// Public Properties
|
|
3402
|
+
//
|
|
3403
|
+
//--------------------------------------------------------------------------
|
|
3404
|
+
get name() {
|
|
3405
|
+
return this._name;
|
|
3406
|
+
}
|
|
3407
|
+
}
|
|
3408
|
+
|
|
3409
|
+
class LoginTokenStorage extends ValueStorage {
|
|
3410
|
+
//--------------------------------------------------------------------------
|
|
3411
|
+
//
|
|
3412
|
+
// Constructor
|
|
3413
|
+
//
|
|
3414
|
+
//--------------------------------------------------------------------------
|
|
3415
|
+
constructor(localStorage, cookies) {
|
|
3416
|
+
super(LoginTokenStorage.TOKEN_KEY, localStorage, cookies);
|
|
3375
3417
|
}
|
|
3376
3418
|
}
|
|
3377
3419
|
//--------------------------------------------------------------------------
|
|
@@ -6356,7 +6398,7 @@ var NotificationServiceEvent;
|
|
|
6356
6398
|
class BottomSheetService extends Destroyable {
|
|
6357
6399
|
}
|
|
6358
6400
|
|
|
6359
|
-
class
|
|
6401
|
+
class LocalStorageService extends DestroyableContainer {
|
|
6360
6402
|
//--------------------------------------------------------------------------
|
|
6361
6403
|
//
|
|
6362
6404
|
// Constructor
|
|
@@ -6411,6 +6453,31 @@ class StorageService extends DestroyableContainer {
|
|
|
6411
6453
|
}
|
|
6412
6454
|
}
|
|
6413
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
|
+
|
|
6414
6481
|
class LazyModuleLoader extends Loadable {
|
|
6415
6482
|
//--------------------------------------------------------------------------
|
|
6416
6483
|
//
|
|
@@ -6677,8 +6744,8 @@ class VIModule {
|
|
|
6677
6744
|
{ provide: VI_ANGULAR_OPTIONS, useValue: options || {} },
|
|
6678
6745
|
{ provide: Logger, deps: [VI_ANGULAR_OPTIONS], useFactory: loggerServiceFactory },
|
|
6679
6746
|
{ provide: NativeWindowService, deps: [DOCUMENT], useFactory: nativeWindowServiceFactory },
|
|
6680
|
-
{ provide:
|
|
6681
|
-
{ provide: LoginTokenStorage, deps: [
|
|
6747
|
+
{ provide: LocalStorageService, deps: [NativeWindowService], useFactory: localStorageServiceFactory },
|
|
6748
|
+
{ provide: LoginTokenStorage, deps: [LocalStorageService, CookieService], useFactory: loginTokenStorageServiceFactory },
|
|
6682
6749
|
...CookieModule.forRoot(options).providers,
|
|
6683
6750
|
...ThemeModule.forRoot(options ? options.themeOptions : null).providers,
|
|
6684
6751
|
...LanguageModule.forRoot(options ? options.languageOptions : null).providers
|
|
@@ -6760,8 +6827,8 @@ function loggerServiceFactory(options) {
|
|
|
6760
6827
|
function nativeWindowServiceFactory(document) {
|
|
6761
6828
|
return new NativeWindowService(document);
|
|
6762
6829
|
}
|
|
6763
|
-
function
|
|
6764
|
-
return new
|
|
6830
|
+
function localStorageServiceFactory(nativeWindow) {
|
|
6831
|
+
return new LocalStorageService(nativeWindow);
|
|
6765
6832
|
}
|
|
6766
6833
|
function loginTokenStorageServiceFactory(storage, cookies) {
|
|
6767
6834
|
return new LoginTokenStorage(storage, cookies);
|
|
@@ -6774,5 +6841,5 @@ const VI_ANGULAR_OPTIONS = new InjectionToken(`VI_ANGULAR_OPTIONS`);
|
|
|
6774
6841
|
* Generated bundle index. Do not edit.
|
|
6775
6842
|
*/
|
|
6776
6843
|
|
|
6777
|
-
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, 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,
|
|
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 };
|
|
6778
6845
|
//# sourceMappingURL=ts-core-angular.mjs.map
|