@solidev/data 0.0.1-beta.0 → 0.0.1-beta.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.
- package/esm2020/lib/updates/update/update.component.mjs +17 -0
- package/esm2020/lib/updates/update.service.mjs +58 -0
- package/esm2020/public-api.mjs +3 -1
- package/fesm2015/solidev-data.mjs +70 -3
- package/fesm2015/solidev-data.mjs.map +1 -1
- package/fesm2020/solidev-data.mjs +70 -3
- package/fesm2020/solidev-data.mjs.map +1 -1
- package/lib/updates/update/update.component.d.ts +8 -0
- package/lib/updates/update.service.d.ts +16 -0
- package/package.json +1 -1
- package/public-api.d.ts +2 -0
|
@@ -3,8 +3,8 @@ import { InjectionToken, PLATFORM_ID, Injectable, Inject, Optional, Component, I
|
|
|
3
3
|
import 'reflect-metadata';
|
|
4
4
|
import * as i2$2 from '@angular/forms';
|
|
5
5
|
import { FormControl, Validators, FormGroup, UntypedFormControl, ReactiveFormsModule, NG_VALUE_ACCESSOR, UntypedFormGroup } from '@angular/forms';
|
|
6
|
-
import { throwError, ReplaySubject, share, combineLatest, of, takeUntil, NEVER, Subject, debounceTime, distinctUntilChanged, isObservable, firstValueFrom, timer, Observable, BehaviorSubject } from 'rxjs';
|
|
7
|
-
import { tap, switchMap, map, throttleTime, filter, mergeMap, finalize, catchError, take } from 'rxjs/operators';
|
|
6
|
+
import { throwError, ReplaySubject, share, combineLatest, of, takeUntil, NEVER, Subject, debounceTime, distinctUntilChanged, isObservable, firstValueFrom, timer, Observable, BehaviorSubject, merge } from 'rxjs';
|
|
7
|
+
import { tap, switchMap, map, throttleTime, filter, mergeMap, finalize, catchError, take, first } from 'rxjs/operators';
|
|
8
8
|
import * as i2 from '@angular/platform-browser';
|
|
9
9
|
import { makeStateKey } from '@angular/platform-browser';
|
|
10
10
|
import * as i1$1 from '@angular/common';
|
|
@@ -25,6 +25,7 @@ import { __decorate, __param } from 'tslib';
|
|
|
25
25
|
import jwt_decode from 'jwt-decode';
|
|
26
26
|
import * as i1$2 from '@angular/router';
|
|
27
27
|
import { NavigationEnd, RouterModule } from '@angular/router';
|
|
28
|
+
import * as i1$3 from '@angular/service-worker';
|
|
28
29
|
|
|
29
30
|
/**
|
|
30
31
|
* DATA_API_URL: stores data api base url
|
|
@@ -5480,6 +5481,71 @@ const slugify = (str) => {
|
|
|
5480
5481
|
return str;
|
|
5481
5482
|
};
|
|
5482
5483
|
|
|
5484
|
+
class UpdateService {
|
|
5485
|
+
constructor(appRef, swUpdate) {
|
|
5486
|
+
this.appRef = appRef;
|
|
5487
|
+
this.swUpdate = swUpdate;
|
|
5488
|
+
this.stable = false;
|
|
5489
|
+
this._available$ = new ReplaySubject(1);
|
|
5490
|
+
this._available$.next(false);
|
|
5491
|
+
const appIsStable$ = this.appRef.isStable
|
|
5492
|
+
.pipe(first((isStable) => isStable))
|
|
5493
|
+
.pipe(tap(() => console.log('App is stable')));
|
|
5494
|
+
const checkInterval$ = timer(10 * 1000, 5 * 60 * 1000);
|
|
5495
|
+
const checkWhenStable$ = merge(appIsStable$, checkInterval$);
|
|
5496
|
+
const updatesAvailable = swUpdate.versionUpdates.pipe(tap((evt) => console.log('Version updates event', evt)), filter((evt) => evt.type === 'VERSION_READY'), map((evt) => ({
|
|
5497
|
+
type: 'UPDATE_AVAILABLE',
|
|
5498
|
+
current: evt.currentVersion,
|
|
5499
|
+
available: evt.latestVersion,
|
|
5500
|
+
})));
|
|
5501
|
+
updatesAvailable.subscribe(async (evt) => {
|
|
5502
|
+
this._available$.next(true);
|
|
5503
|
+
});
|
|
5504
|
+
checkWhenStable$.subscribe(async () => {
|
|
5505
|
+
this.stable = true;
|
|
5506
|
+
try {
|
|
5507
|
+
console.log('Checking for update');
|
|
5508
|
+
const res = await swUpdate.checkForUpdate();
|
|
5509
|
+
console.log('Check for update result', res);
|
|
5510
|
+
}
|
|
5511
|
+
catch (e) {
|
|
5512
|
+
console.warn('No service worker');
|
|
5513
|
+
}
|
|
5514
|
+
});
|
|
5515
|
+
}
|
|
5516
|
+
get available$() {
|
|
5517
|
+
return this._available$.asObservable();
|
|
5518
|
+
}
|
|
5519
|
+
activate() {
|
|
5520
|
+
this._available$.next(false);
|
|
5521
|
+
console.log('RELOADING FULL PAGE');
|
|
5522
|
+
document.location.reload();
|
|
5523
|
+
}
|
|
5524
|
+
dismiss() {
|
|
5525
|
+
this._available$.next(false);
|
|
5526
|
+
}
|
|
5527
|
+
}
|
|
5528
|
+
UpdateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: UpdateService, deps: [{ token: i0.ApplicationRef }, { token: i1$3.SwUpdate }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
5529
|
+
UpdateService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: UpdateService, providedIn: 'root' });
|
|
5530
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: UpdateService, decorators: [{
|
|
5531
|
+
type: Injectable,
|
|
5532
|
+
args: [{
|
|
5533
|
+
providedIn: 'root',
|
|
5534
|
+
}]
|
|
5535
|
+
}], ctorParameters: function () { return [{ type: i0.ApplicationRef }, { type: i1$3.SwUpdate }]; } });
|
|
5536
|
+
|
|
5537
|
+
class UpdateComponent {
|
|
5538
|
+
constructor(update) {
|
|
5539
|
+
this.update = update;
|
|
5540
|
+
}
|
|
5541
|
+
}
|
|
5542
|
+
UpdateComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: UpdateComponent, deps: [{ token: UpdateService }], target: i0.ɵɵFactoryTarget.Component });
|
|
5543
|
+
UpdateComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.0", type: UpdateComponent, isStandalone: true, selector: "data-update", ngImport: i0, template: "\n<div class=\"snack\" *ngIf=\"update.available$|async\">\n <p>Une nouvelle version de l'application est disponible.</p>\n <div class=\"row\">\n <div class=\"col-sm-6\">\n <button class=\"btn btn-primary btn-block w-100\" (click)=\"update.activate()\">L'ACTIVER MAINTENANT</button>\n </div>\n <div class=\"col-sm-6\">\n <button class=\"btn btn-warning btn-block w-100\" (click)=\"update.dismiss()\">Plus tard</button>\n </div>\n </div>\n</div>", styles: [".snack{position:fixed;bottom:0;margin-left:auto;margin-right:auto;left:auto;right:auto;background-color:#ff7a00cc;padding:20px;z-index:2000;border-top:1px solid rgb(255,122,0);font-size:1.5rem;font-weight:700;color:#8b0000;width:100%;text-align:center}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }] });
|
|
5544
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: UpdateComponent, decorators: [{
|
|
5545
|
+
type: Component,
|
|
5546
|
+
args: [{ selector: 'data-update', standalone: true, imports: [CommonModule], template: "\n<div class=\"snack\" *ngIf=\"update.available$|async\">\n <p>Une nouvelle version de l'application est disponible.</p>\n <div class=\"row\">\n <div class=\"col-sm-6\">\n <button class=\"btn btn-primary btn-block w-100\" (click)=\"update.activate()\">L'ACTIVER MAINTENANT</button>\n </div>\n <div class=\"col-sm-6\">\n <button class=\"btn btn-warning btn-block w-100\" (click)=\"update.dismiss()\">Plus tard</button>\n </div>\n </div>\n</div>", styles: [".snack{position:fixed;bottom:0;margin-left:auto;margin-right:auto;left:auto;right:auto;background-color:#ff7a00cc;padding:20px;z-index:2000;border-top:1px solid rgb(255,122,0);font-size:1.5rem;font-weight:700;color:#8b0000;width:100%;text-align:center}\n"] }]
|
|
5547
|
+
}], ctorParameters: function () { return [{ type: UpdateService }]; } });
|
|
5548
|
+
|
|
5483
5549
|
/*
|
|
5484
5550
|
* Public API Surface of data
|
|
5485
5551
|
*/
|
|
@@ -5488,5 +5554,6 @@ const slugify = (str) => {
|
|
|
5488
5554
|
* Generated bundle index. Do not edit.
|
|
5489
5555
|
*/
|
|
5490
5556
|
|
|
5491
|
-
export { AuthInterceptor, AuthServiceBase, BanAdapter, BootstrapDataDisplayConfig, BreadcrumbComponent, ChoicePipe, Collection, CollectionMock, DATA_API_URL, DATA_AUTH_PARAMS, DATA_AUTH_SERVICE, DATA_AUTH_USER_SERVICE, DATA_DISPLAY_CONFIG, DATA_MAX_TRANSFERSTATE_TIME, DATA_MESSAGE_SOUNDS, DEFAULT_TIMEOUTS, DataBackend, DataMessageService, DataModel, DataUploaderService, DispeditComponent, FactorPipe, FactorcPipe, FkselectComponent, FlagsComponent, Jwt, Link, M2mselectComponent, Message, MessageZoneComponent, ModelList, ModelListAutocompleteFilter, ModelListAutocompleteMultiFilter, ModelListDateFilter, ModelListDatetimeFilter, ModelListDatetimerangeFilter, ModelListFieldHeaderComponent, ModelListFieldsSelectorComponent, ModelListFilters, ModelListFiltersComponent, ModelListFiltersSelectComponent, ModelListFlagsFilter, ModelListGeodistanceFilter, ModelListNumberFilter, ModelListNumberOperations, ModelListPaginatorComponent, ModelListSelectFilter, ModelListSelectMultiFilter, ModelListService, ModelListSorterComponent, ModelListTextFilter, ModelListTreeFilter, NavDriver, NgFileDropDirective, NgFileSelectDirective, NgxUploaderModule, PChoicePipe, PFactorPipe, PFactorcPipe, Queryset, RData, RicheditComponent, STATUS, SafeDeleteComponent, TabMemoryService, UploadStatus, booleanField, charField, computedField, dateField, datetimeField, decimalField, detailsField, emailField, floatField, foreignKeyField, humanizeBytes, integerField, isValue, manyToManyField, passwordField, primaryField, reverseForeignKeyField, slugify, strToNumber, textField };
|
|
5557
|
+
export { AuthInterceptor, AuthServiceBase, BanAdapter, BootstrapDataDisplayConfig, BreadcrumbComponent, ChoicePipe, Collection, CollectionMock, DATA_API_URL, DATA_AUTH_PARAMS, DATA_AUTH_SERVICE, DATA_AUTH_USER_SERVICE, DATA_DISPLAY_CONFIG, DATA_MAX_TRANSFERSTATE_TIME, DATA_MESSAGE_SOUNDS, DEFAULT_TIMEOUTS, DataBackend, DataMessageService, DataModel, DataUploaderService, DispeditComponent, FactorPipe, FactorcPipe, FkselectComponent, FlagsComponent, Jwt, Link, M2mselectComponent, Message, MessageZoneComponent, ModelList, ModelListAutocompleteFilter, ModelListAutocompleteMultiFilter, ModelListDateFilter, ModelListDatetimeFilter, ModelListDatetimerangeFilter, ModelListFieldHeaderComponent, ModelListFieldsSelectorComponent, ModelListFilters, ModelListFiltersComponent, ModelListFiltersSelectComponent, ModelListFlagsFilter, ModelListGeodistanceFilter, ModelListNumberFilter, ModelListNumberOperations, ModelListPaginatorComponent, ModelListSelectFilter, ModelListSelectMultiFilter, ModelListService, ModelListSorterComponent, ModelListTextFilter, ModelListTreeFilter, NavDriver, NgFileDropDirective, NgFileSelectDirective, NgxUploaderModule, PChoicePipe, PFactorPipe, PFactorcPipe, Queryset, RData, RicheditComponent, STATUS, SafeDeleteComponent, TabMemoryService, UpdateComponent, UpdateService, UploadStatus, booleanField, charField, computedField, dateField, datetimeField, decimalField, detailsField, emailField, floatField, foreignKeyField, humanizeBytes, integerField, isValue, manyToManyField, passwordField, primaryField, reverseForeignKeyField, slugify, strToNumber, textField };
|
|
5558
|
+
//# sourceMappingURL=solidev-data.mjs.map
|
|
5492
5559
|
//# sourceMappingURL=solidev-data.mjs.map
|