@angular/service-worker 13.0.0-next.8 → 13.0.0-rc.2
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/config/config.d.ts +1 -1
- package/config/package.json +5 -5
- package/{esm2015/config/config.js → esm2020/config/config.mjs} +0 -0
- package/{esm2015/config/index.js → esm2020/config/index.mjs} +0 -0
- package/{esm2015/config/public_api.js → esm2020/config/public_api.mjs} +0 -0
- package/{esm2015/config/src/duration.js → esm2020/config/src/duration.mjs} +0 -0
- package/{esm2015/config/src/filesystem.js → esm2020/config/src/filesystem.mjs} +0 -0
- package/esm2020/config/src/generator.mjs +153 -0
- package/{esm2015/config/src/glob.js → esm2020/config/src/glob.mjs} +0 -0
- package/{esm2015/config/src/in.js → esm2020/config/src/in.mjs} +0 -0
- package/{esm2015/index.js → esm2020/index.mjs} +0 -0
- package/{esm2015/public_api.js → esm2020/public_api.mjs} +0 -0
- package/esm2020/service-worker.mjs +5 -0
- package/{esm2015/src/index.js → esm2020/src/index.mjs} +1 -1
- package/esm2020/src/low_level.mjs +84 -0
- package/esm2020/src/module.mjs +128 -0
- package/esm2020/src/push.mjs +174 -0
- package/esm2020/src/update.mjs +87 -0
- package/fesm2015/{config.js → config.mjs} +25 -26
- package/fesm2015/config.mjs.map +1 -0
- package/fesm2015/{service-worker.js → service-worker.mjs} +67 -33
- package/fesm2015/service-worker.mjs.map +1 -0
- package/fesm2020/config.mjs +273 -0
- package/fesm2020/config.mjs.map +1 -0
- package/fesm2020/service-worker.mjs +494 -0
- package/fesm2020/service-worker.mjs.map +1 -0
- package/ngsw-config.js +169 -218
- package/ngsw-worker.js +1434 -1574
- package/package.json +40 -9
- package/service-worker.d.ts +139 -23
- package/bundles/service-worker-config.umd.js +0 -626
- package/bundles/service-worker-config.umd.js.map +0 -1
- package/bundles/service-worker.umd.js +0 -804
- package/bundles/service-worker.umd.js.map +0 -1
- package/config/config.metadata.json +0 -1
- package/config/index.ngfactory.d.ts +0 -2
- package/config/index.ngsummary.d.ts +0 -2
- package/config/public_api.ngfactory.d.ts +0 -2
- package/config/public_api.ngsummary.d.ts +0 -2
- package/config/src/duration.ngfactory.d.ts +0 -2
- package/config/src/duration.ngsummary.d.ts +0 -2
- package/config/src/filesystem.ngfactory.d.ts +0 -2
- package/config/src/filesystem.ngsummary.d.ts +0 -2
- package/config/src/generator.ngfactory.d.ts +0 -2
- package/config/src/generator.ngsummary.d.ts +0 -2
- package/config/src/glob.ngfactory.d.ts +0 -2
- package/config/src/glob.ngsummary.d.ts +0 -2
- package/config/src/in.ngfactory.d.ts +0 -2
- package/config/src/in.ngsummary.d.ts +0 -2
- package/config.d.ts +0 -7
- package/config.metadata.json +0 -1
- package/esm2015/config/config.externs.js +0 -6
- package/esm2015/config/src/generator.js +0 -150
- package/esm2015/service-worker.externs.js +0 -6
- package/esm2015/service-worker.js +0 -7
- package/esm2015/src/low_level.js +0 -75
- package/esm2015/src/module.js +0 -123
- package/esm2015/src/push.js +0 -173
- package/esm2015/src/update.js +0 -60
- package/fesm2015/config.js.map +0 -1
- package/fesm2015/service-worker.js.map +0 -1
- package/service-worker.metadata.json +0 -1
package/package.json
CHANGED
|
@@ -1,18 +1,48 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/service-worker",
|
|
3
|
-
"version": "13.0.0-
|
|
3
|
+
"version": "13.0.0-rc.2",
|
|
4
4
|
"description": "Angular - service worker tooling!",
|
|
5
5
|
"author": "angular",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"engines": {
|
|
8
|
-
"node": "^12.
|
|
8
|
+
"node": "^12.20.0 || ^14.15.0 || >=16.10.0"
|
|
9
|
+
},
|
|
10
|
+
"exports": {
|
|
11
|
+
"./ngsw-worker.js": {
|
|
12
|
+
"default": "./ngsw-worker.js"
|
|
13
|
+
},
|
|
14
|
+
"./safety-worker.js": {
|
|
15
|
+
"default": "./safety-worker.js"
|
|
16
|
+
},
|
|
17
|
+
"./config/schema.json": {
|
|
18
|
+
"default": "./config/schema.json"
|
|
19
|
+
},
|
|
20
|
+
"./package.json": {
|
|
21
|
+
"default": "./package.json"
|
|
22
|
+
},
|
|
23
|
+
".": {
|
|
24
|
+
"types": "./service-worker.d.ts",
|
|
25
|
+
"esm2020": "./esm2020/service-worker.mjs",
|
|
26
|
+
"es2020": "./fesm2020/service-worker.mjs",
|
|
27
|
+
"es2015": "./fesm2015/service-worker.mjs",
|
|
28
|
+
"node": "./fesm2015/service-worker.mjs",
|
|
29
|
+
"default": "./fesm2020/service-worker.mjs"
|
|
30
|
+
},
|
|
31
|
+
"./config": {
|
|
32
|
+
"types": "./config/config.d.ts",
|
|
33
|
+
"esm2020": "./esm2020/config/config.mjs",
|
|
34
|
+
"es2020": "./fesm2020/config.mjs",
|
|
35
|
+
"es2015": "./fesm2015/config.mjs",
|
|
36
|
+
"node": "./fesm2015/config.mjs",
|
|
37
|
+
"default": "./fesm2020/config.mjs"
|
|
38
|
+
}
|
|
9
39
|
},
|
|
10
40
|
"dependencies": {
|
|
11
41
|
"tslib": "^2.3.0"
|
|
12
42
|
},
|
|
13
43
|
"peerDependencies": {
|
|
14
|
-
"@angular/core": "13.0.0-
|
|
15
|
-
"@angular/common": "13.0.0-
|
|
44
|
+
"@angular/core": "13.0.0-rc.2",
|
|
45
|
+
"@angular/common": "13.0.0-rc.2"
|
|
16
46
|
},
|
|
17
47
|
"repository": {
|
|
18
48
|
"type": "git",
|
|
@@ -43,10 +73,11 @@
|
|
|
43
73
|
]
|
|
44
74
|
},
|
|
45
75
|
"sideEffects": false,
|
|
46
|
-
"
|
|
47
|
-
"fesm2015": "./fesm2015/service-worker.
|
|
48
|
-
"
|
|
76
|
+
"fesm2020": "./fesm2020/service-worker.mjs",
|
|
77
|
+
"fesm2015": "./fesm2015/service-worker.mjs",
|
|
78
|
+
"esm2020": "./esm2020/service-worker.mjs",
|
|
49
79
|
"typings": "./service-worker.d.ts",
|
|
50
|
-
"module": "./fesm2015/service-worker.
|
|
51
|
-
"
|
|
80
|
+
"module": "./fesm2015/service-worker.mjs",
|
|
81
|
+
"es2020": "./fesm2020/service-worker.mjs",
|
|
82
|
+
"type": "module"
|
|
52
83
|
}
|
package/service-worker.d.ts
CHANGED
|
@@ -1,14 +1,31 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v13.0.0-
|
|
2
|
+
* @license Angular v13.0.0-rc.2
|
|
3
3
|
* (c) 2010-2021 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import
|
|
8
|
-
import { Injector } from '@angular/core';
|
|
7
|
+
import * as i0 from '@angular/core';
|
|
9
8
|
import { ModuleWithProviders } from '@angular/core';
|
|
10
9
|
import { Observable } from 'rxjs';
|
|
11
10
|
|
|
11
|
+
/**
|
|
12
|
+
* @publicApi
|
|
13
|
+
*/
|
|
14
|
+
declare class NgswCommChannel {
|
|
15
|
+
private serviceWorker;
|
|
16
|
+
readonly worker: Observable<ServiceWorker>;
|
|
17
|
+
readonly registration: Observable<ServiceWorkerRegistration>;
|
|
18
|
+
readonly events: Observable<TypedEvent>;
|
|
19
|
+
constructor(serviceWorker: ServiceWorkerContainer | undefined);
|
|
20
|
+
postMessage(action: string, payload: Object): Promise<void>;
|
|
21
|
+
postMessageWithOperation(type: string, payload: Object, operationNonce: number): Promise<boolean>;
|
|
22
|
+
generateNonce(): number;
|
|
23
|
+
eventsOfType<T extends TypedEvent>(type: T['type'] | T['type'][]): Observable<T>;
|
|
24
|
+
nextEventOfType<T extends TypedEvent>(type: T['type']): Observable<T>;
|
|
25
|
+
waitForOperationCompleted(nonce: number): Promise<boolean>;
|
|
26
|
+
get isEnabled(): boolean;
|
|
27
|
+
}
|
|
28
|
+
|
|
12
29
|
/**
|
|
13
30
|
* @publicApi
|
|
14
31
|
*/
|
|
@@ -20,6 +37,9 @@ export declare class ServiceWorkerModule {
|
|
|
20
37
|
* workers are not supported by the browser, and the service worker will not be registered.
|
|
21
38
|
*/
|
|
22
39
|
static register(script: string, opts?: SwRegistrationOptions): ModuleWithProviders<ServiceWorkerModule>;
|
|
40
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ServiceWorkerModule, never>;
|
|
41
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<ServiceWorkerModule, never, never, never>;
|
|
42
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<ServiceWorkerModule>;
|
|
23
43
|
}
|
|
24
44
|
|
|
25
45
|
/**
|
|
@@ -137,7 +157,7 @@ export declare class SwPush {
|
|
|
137
157
|
get isEnabled(): boolean;
|
|
138
158
|
private pushManager;
|
|
139
159
|
private subscriptionChanges;
|
|
140
|
-
constructor(sw:
|
|
160
|
+
constructor(sw: NgswCommChannel);
|
|
141
161
|
/**
|
|
142
162
|
* Subscribes to Web Push Notifications,
|
|
143
163
|
* after requesting and receiving user permission.
|
|
@@ -156,6 +176,8 @@ export declare class SwPush {
|
|
|
156
176
|
*/
|
|
157
177
|
unsubscribe(): Promise<void>;
|
|
158
178
|
private decodeBase64;
|
|
179
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SwPush, never>;
|
|
180
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<SwPush>;
|
|
159
181
|
}
|
|
160
182
|
|
|
161
183
|
/**
|
|
@@ -226,12 +248,40 @@ export declare abstract class SwRegistrationOptions {
|
|
|
226
248
|
*/
|
|
227
249
|
export declare class SwUpdate {
|
|
228
250
|
private sw;
|
|
251
|
+
/**
|
|
252
|
+
* Emits a `VersionDetectedEvent` event whenever a new version is detected on the server.
|
|
253
|
+
*
|
|
254
|
+
* Emits a `VersionInstallationFailedEvent` event whenever checking for or downloading a new
|
|
255
|
+
* version fails.
|
|
256
|
+
*
|
|
257
|
+
* Emits a `VersionReadyEvent` event whenever a new version has been downloaded and is ready for
|
|
258
|
+
* activation.
|
|
259
|
+
*/
|
|
260
|
+
readonly versionUpdates: Observable<VersionEvent>;
|
|
229
261
|
/**
|
|
230
262
|
* Emits an `UpdateAvailableEvent` event whenever a new app version is available.
|
|
263
|
+
*
|
|
264
|
+
* @deprecated Use {@link versionUpdates} instead.
|
|
265
|
+
*
|
|
266
|
+
* The of behavior `available` can be rebuild by filtering for the `VersionReadyEvent`:
|
|
267
|
+
* ```
|
|
268
|
+
* import {filter, map} from 'rxjs/operators';
|
|
269
|
+
* // ...
|
|
270
|
+
* const updatesAvailable = swUpdate.versionUpdates.pipe(
|
|
271
|
+
* filter((evt): evt is VersionReadyEvent => evt.type === 'VERSION_READY'),
|
|
272
|
+
* map(evt => ({
|
|
273
|
+
* type: 'UPDATE_AVAILABLE',
|
|
274
|
+
* current: evt.currentVersion,
|
|
275
|
+
* available: evt.latestVersion,
|
|
276
|
+
* })));
|
|
277
|
+
* ```
|
|
231
278
|
*/
|
|
232
279
|
readonly available: Observable<UpdateAvailableEvent>;
|
|
233
280
|
/**
|
|
234
281
|
* Emits an `UpdateActivatedEvent` event whenever the app has been updated to a new version.
|
|
282
|
+
*
|
|
283
|
+
* @deprecated Use the return value of {@link SwUpdate#activateUpdate} instead.
|
|
284
|
+
*
|
|
235
285
|
*/
|
|
236
286
|
readonly activated: Observable<UpdateActivatedEvent>;
|
|
237
287
|
/**
|
|
@@ -245,9 +295,30 @@ export declare class SwUpdate {
|
|
|
245
295
|
* `ServiceWorkerModule`).
|
|
246
296
|
*/
|
|
247
297
|
get isEnabled(): boolean;
|
|
248
|
-
constructor(sw:
|
|
249
|
-
|
|
250
|
-
|
|
298
|
+
constructor(sw: NgswCommChannel);
|
|
299
|
+
/**
|
|
300
|
+
* Checks for an update and waits until the new version is downloaded from the server and ready
|
|
301
|
+
* for activation.
|
|
302
|
+
*
|
|
303
|
+
* @returns a promise that
|
|
304
|
+
* - resolves to `true` if a new version was found and is ready to be activated.
|
|
305
|
+
* - resolves to `false` if no new version was found
|
|
306
|
+
* - rejects if any error occurs
|
|
307
|
+
*/
|
|
308
|
+
checkForUpdate(): Promise<boolean>;
|
|
309
|
+
/**
|
|
310
|
+
* Updates the current client (i.e. browser tab) to the latest version that is ready for
|
|
311
|
+
* activation.
|
|
312
|
+
*
|
|
313
|
+
* @returns a promise that
|
|
314
|
+
* - resolves to `true` if an update was activated successfully
|
|
315
|
+
* - resolves to `false` if no update was available (for example, the client was already on the
|
|
316
|
+
* latest version).
|
|
317
|
+
* - rejects if any error occurs
|
|
318
|
+
*/
|
|
319
|
+
activateUpdate(): Promise<boolean>;
|
|
320
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SwUpdate, never>;
|
|
321
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<SwUpdate>;
|
|
251
322
|
}
|
|
252
323
|
|
|
253
324
|
declare interface TypedEvent {
|
|
@@ -277,6 +348,10 @@ export declare interface UnrecoverableStateEvent {
|
|
|
277
348
|
*
|
|
278
349
|
* @see {@link guide/service-worker-communications Service worker communication guide}
|
|
279
350
|
*
|
|
351
|
+
* @deprecated
|
|
352
|
+
* This event is only emitted by the deprecated {@link SwUpdate#activated}.
|
|
353
|
+
* Use the return value of {@link SwUpdate#activateUpdate} instead.
|
|
354
|
+
*
|
|
280
355
|
* @publicApi
|
|
281
356
|
*/
|
|
282
357
|
export declare interface UpdateActivatedEvent {
|
|
@@ -296,6 +371,11 @@ export declare interface UpdateActivatedEvent {
|
|
|
296
371
|
*
|
|
297
372
|
* @see {@link guide/service-worker-communications Service worker communication guide}
|
|
298
373
|
*
|
|
374
|
+
* @deprecated
|
|
375
|
+
* This event is only emitted by the deprecated {@link SwUpdate#available}.
|
|
376
|
+
* Use the {@link VersionReadyEvent} instead, which is emitted by {@link SwUpdate#versionUpdates}.
|
|
377
|
+
* See {@link SwUpdate#available} docs for an example.
|
|
378
|
+
*
|
|
299
379
|
* @publicApi
|
|
300
380
|
*/
|
|
301
381
|
export declare interface UpdateAvailableEvent {
|
|
@@ -311,27 +391,63 @@ export declare interface UpdateAvailableEvent {
|
|
|
311
391
|
}
|
|
312
392
|
|
|
313
393
|
/**
|
|
394
|
+
* An event emitted when the service worker has detected a new version of the app on the server and
|
|
395
|
+
* is about to start downloading it.
|
|
396
|
+
*
|
|
397
|
+
* @see {@link guide/service-worker-communications Service worker communication guide}
|
|
398
|
+
*
|
|
314
399
|
* @publicApi
|
|
315
400
|
*/
|
|
316
|
-
export declare
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
postMessage(action: string, payload: Object): Promise<void>;
|
|
323
|
-
postMessageWithStatus(type: string, payload: Object, nonce: number): Promise<void>;
|
|
324
|
-
generateNonce(): number;
|
|
325
|
-
eventsOfType<T extends TypedEvent>(type: T['type']): Observable<T>;
|
|
326
|
-
nextEventOfType<T extends TypedEvent>(type: T['type']): Observable<T>;
|
|
327
|
-
waitForStatus(nonce: number): Promise<void>;
|
|
328
|
-
get isEnabled(): boolean;
|
|
401
|
+
export declare interface VersionDetectedEvent {
|
|
402
|
+
type: 'VERSION_DETECTED';
|
|
403
|
+
version: {
|
|
404
|
+
hash: string;
|
|
405
|
+
appData?: object;
|
|
406
|
+
};
|
|
329
407
|
}
|
|
330
408
|
|
|
331
|
-
|
|
409
|
+
/**
|
|
410
|
+
* A union of all event types that can be emitted by
|
|
411
|
+
* {@link api/service-worker/SwUpdate#versionUpdates SwUpdate#versionUpdates}.
|
|
412
|
+
*
|
|
413
|
+
* @publicApi
|
|
414
|
+
*/
|
|
415
|
+
export declare type VersionEvent = VersionDetectedEvent | VersionInstallationFailedEvent | VersionReadyEvent;
|
|
332
416
|
|
|
333
|
-
|
|
417
|
+
/**
|
|
418
|
+
* An event emitted when the installation of a new version failed.
|
|
419
|
+
* It may be used for logging/monitoring purposes.
|
|
420
|
+
*
|
|
421
|
+
* @see {@link guide/service-worker-communications Service worker communication guide}
|
|
422
|
+
*
|
|
423
|
+
* @publicApi
|
|
424
|
+
*/
|
|
425
|
+
export declare interface VersionInstallationFailedEvent {
|
|
426
|
+
type: 'VERSION_INSTALLATION_FAILED';
|
|
427
|
+
version: {
|
|
428
|
+
hash: string;
|
|
429
|
+
appData?: object;
|
|
430
|
+
};
|
|
431
|
+
error: string;
|
|
432
|
+
}
|
|
334
433
|
|
|
335
|
-
|
|
434
|
+
/**
|
|
435
|
+
* An event emitted when a new version of the app is available.
|
|
436
|
+
*
|
|
437
|
+
* @see {@link guide/service-worker-communications Service worker communication guide}
|
|
438
|
+
*
|
|
439
|
+
* @publicApi
|
|
440
|
+
*/
|
|
441
|
+
export declare interface VersionReadyEvent {
|
|
442
|
+
type: 'VERSION_READY';
|
|
443
|
+
currentVersion: {
|
|
444
|
+
hash: string;
|
|
445
|
+
appData?: object;
|
|
446
|
+
};
|
|
447
|
+
latestVersion: {
|
|
448
|
+
hash: string;
|
|
449
|
+
appData?: object;
|
|
450
|
+
};
|
|
451
|
+
}
|
|
336
452
|
|
|
337
453
|
export { }
|