@c8y/ngx-components 1018.0.152 → 1018.0.160
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/NOTICES +1 -1
- package/core/realtime/realtime-subject.service.d.ts +4 -0
- package/core/realtime/realtime.service.d.ts +10 -0
- package/device-protocols/device-protocols.guard.d.ts +12 -0
- package/device-protocols/device-protocols.module.d.ts +8 -0
- package/device-protocols/device-type-detail-edited.service.d.ts +8 -0
- package/device-protocols/device-type-detail.component.d.ts +12 -0
- package/device-protocols/device-type-detail.directive.d.ts +9 -0
- package/device-protocols/index.d.ts +5 -0
- package/esm2020/core/realtime/realtime-subject.service.mjs +47 -4
- package/esm2020/core/realtime/realtime.service.mjs +15 -1
- package/esm2020/device-protocols/c8y-ngx-components-device-protocols.mjs +5 -0
- package/esm2020/device-protocols/device-protocols.guard.mjs +40 -0
- package/esm2020/device-protocols/device-protocols.module.mjs +46 -0
- package/esm2020/device-protocols/device-type-detail-edited.service.mjs +19 -0
- package/esm2020/device-protocols/device-type-detail.component.mjs +45 -0
- package/esm2020/device-protocols/device-type-detail.directive.mjs +19 -0
- package/esm2020/device-protocols/index.mjs +6 -0
- package/esm2020/ecosystem/application-properties/subscription-modal/subscription-modal.component.mjs +4 -1
- package/esm2020/icon-selector/icons/ecommerce/index.mjs +2 -2
- package/esm2020/upgrade/ng1/downgraded.services.mjs +6 -4
- package/esm2020/upgrade/ng1/index.mjs +6 -5
- package/esm2020/upgrade/upgrade.module.mjs +10 -10
- package/fesm2015/c8y-ngx-components-device-protocols.mjs +162 -0
- package/fesm2015/c8y-ngx-components-device-protocols.mjs.map +1 -0
- package/fesm2015/c8y-ngx-components-ecosystem.mjs +3 -0
- package/fesm2015/c8y-ngx-components-ecosystem.mjs.map +1 -1
- package/fesm2015/c8y-ngx-components-icon-selector-icons-ecommerce.mjs +1 -1
- package/fesm2015/c8y-ngx-components-icon-selector-icons-ecommerce.mjs.map +1 -1
- package/fesm2015/c8y-ngx-components-upgrade.mjs +91 -88
- package/fesm2015/c8y-ngx-components-upgrade.mjs.map +1 -1
- package/fesm2015/c8y-ngx-components.mjs +59 -2
- package/fesm2015/c8y-ngx-components.mjs.map +1 -1
- package/fesm2020/c8y-ngx-components-device-protocols.mjs +159 -0
- package/fesm2020/c8y-ngx-components-device-protocols.mjs.map +1 -0
- package/fesm2020/c8y-ngx-components-ecosystem.mjs +3 -0
- package/fesm2020/c8y-ngx-components-ecosystem.mjs.map +1 -1
- package/fesm2020/c8y-ngx-components-icon-selector-icons-ecommerce.mjs +1 -1
- package/fesm2020/c8y-ngx-components-icon-selector-icons-ecommerce.mjs.map +1 -1
- package/fesm2020/c8y-ngx-components-upgrade.mjs +90 -87
- package/fesm2020/c8y-ngx-components-upgrade.mjs.map +1 -1
- package/fesm2020/c8y-ngx-components.mjs +59 -2
- package/fesm2020/c8y-ngx-components.mjs.map +1 -1
- package/icon-selector/icons/ecommerce/index.d.ts +1 -1
- package/locales/de.po +3 -0
- package/locales/en.po +80 -8
- package/locales/locales.pot +4 -4
- package/package.json +1 -1
- package/upgrade/ng1/downgraded.services.d.ts +1 -0
|
@@ -3701,6 +3701,20 @@ class RealtimeService {
|
|
|
3701
3701
|
get active() {
|
|
3702
3702
|
return this.isActive.value;
|
|
3703
3703
|
}
|
|
3704
|
+
/**
|
|
3705
|
+
* An observable emitting a value in case the realtime connection has been interrupted.
|
|
3706
|
+
* Can be used to reload data of e.g. a datapoint graph that wasn't received while realtime was interrupted.
|
|
3707
|
+
*/
|
|
3708
|
+
get reconnect$() {
|
|
3709
|
+
return this.realtimeSubject.reconnect$;
|
|
3710
|
+
}
|
|
3711
|
+
/**
|
|
3712
|
+
* An observable emitting either `connected` or `disconnected` depending on the state of the realtime connection.
|
|
3713
|
+
* Can be used to e.g. inform the user about the interrupted realtime connection.
|
|
3714
|
+
*/
|
|
3715
|
+
get connectionStatus$() {
|
|
3716
|
+
return this.realtimeSubject.connectionStatus$;
|
|
3717
|
+
}
|
|
3704
3718
|
/**
|
|
3705
3719
|
* Get an Observable of all realtime notifications.
|
|
3706
3720
|
*
|
|
@@ -28516,6 +28530,8 @@ class RealtimeSubjectService {
|
|
|
28516
28530
|
constructor(realtime) {
|
|
28517
28531
|
this.realtime = realtime;
|
|
28518
28532
|
this.subjects$ = new Map();
|
|
28533
|
+
this.reconnect$ = this.createObservableForReconnect().pipe(share());
|
|
28534
|
+
this.connectionStatus$ = this.createObservableForConnectionStatus().pipe(distinctUntilChanged(), shareReplay({ refCount: true, bufferSize: 1 }));
|
|
28519
28535
|
}
|
|
28520
28536
|
getObservableForChannel(channel) {
|
|
28521
28537
|
if (this.subjects$.has(channel)) {
|
|
@@ -28528,7 +28544,7 @@ class RealtimeSubjectService {
|
|
|
28528
28544
|
}
|
|
28529
28545
|
createObservableForChannel(channel, realtime) {
|
|
28530
28546
|
return new Observable(observer => {
|
|
28531
|
-
|
|
28547
|
+
let realtimeSubscription = realtime.subscribe(channel, msg => {
|
|
28532
28548
|
const data = {
|
|
28533
28549
|
channel: msg.channel,
|
|
28534
28550
|
data: msg.data.data,
|
|
@@ -28537,13 +28553,54 @@ class RealtimeSubjectService {
|
|
|
28537
28553
|
};
|
|
28538
28554
|
observer.next(data);
|
|
28539
28555
|
});
|
|
28556
|
+
/**
|
|
28557
|
+
* In (rare) case of a re-handshake, resubscribe valid subscriptions.
|
|
28558
|
+
* @see https://docs.cometd.org/current/reference/#_javascript_subscribe_resubscribe
|
|
28559
|
+
*/
|
|
28560
|
+
const reconnectSubscription = this.reconnect$.subscribe(() => {
|
|
28561
|
+
try {
|
|
28562
|
+
realtimeSubscription = this.realtime.resubscribe(realtimeSubscription);
|
|
28563
|
+
}
|
|
28564
|
+
catch (e) {
|
|
28565
|
+
console.warn(`Failed to resubscribe to channel: "${channel}" after reconnect.`, e);
|
|
28566
|
+
observer.error(e);
|
|
28567
|
+
}
|
|
28568
|
+
});
|
|
28540
28569
|
return {
|
|
28541
|
-
unsubscribe() {
|
|
28570
|
+
unsubscribe: () => {
|
|
28571
|
+
reconnectSubscription.unsubscribe();
|
|
28542
28572
|
realtime.unsubscribe(realtimeSubscription);
|
|
28543
28573
|
}
|
|
28544
28574
|
};
|
|
28545
28575
|
});
|
|
28546
28576
|
}
|
|
28577
|
+
createObservableForReconnect() {
|
|
28578
|
+
return new Observable(observer => {
|
|
28579
|
+
const handle = this.realtime.addHandshakeListener(msg => {
|
|
28580
|
+
if (msg.successful && msg.reestablish) {
|
|
28581
|
+
observer.next();
|
|
28582
|
+
}
|
|
28583
|
+
});
|
|
28584
|
+
return {
|
|
28585
|
+
unsubscribe: () => {
|
|
28586
|
+
this.realtime.removeListener(handle);
|
|
28587
|
+
}
|
|
28588
|
+
};
|
|
28589
|
+
});
|
|
28590
|
+
}
|
|
28591
|
+
createObservableForConnectionStatus() {
|
|
28592
|
+
return new Observable(observer => {
|
|
28593
|
+
observer.next(!this.realtime.isDisconnected() ? 'connected' : 'disconnected');
|
|
28594
|
+
const handle = this.realtime.addConnectListener(msg => {
|
|
28595
|
+
observer.next(msg.successful ? 'connected' : 'disconnected');
|
|
28596
|
+
});
|
|
28597
|
+
return {
|
|
28598
|
+
unsubscribe: () => {
|
|
28599
|
+
this.realtime.removeListener(handle);
|
|
28600
|
+
}
|
|
28601
|
+
};
|
|
28602
|
+
});
|
|
28603
|
+
}
|
|
28547
28604
|
}
|
|
28548
28605
|
RealtimeSubjectService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.6", ngImport: i0, type: RealtimeSubjectService, deps: [{ token: i1$1.Realtime }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
28549
28606
|
RealtimeSubjectService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.6", ngImport: i0, type: RealtimeSubjectService, providedIn: 'root' });
|