@c8y/ngx-components 1018.0.152 → 1018.0.159
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
|
@@ -28664,6 +28664,20 @@ class RealtimeService {
|
|
|
28664
28664
|
get active() {
|
|
28665
28665
|
return this.isActive.value;
|
|
28666
28666
|
}
|
|
28667
|
+
/**
|
|
28668
|
+
* An observable emitting a value in case the realtime connection has been interrupted.
|
|
28669
|
+
* Can be used to reload data of e.g. a datapoint graph that wasn't received while realtime was interrupted.
|
|
28670
|
+
*/
|
|
28671
|
+
get reconnect$() {
|
|
28672
|
+
return this.realtimeSubject.reconnect$;
|
|
28673
|
+
}
|
|
28674
|
+
/**
|
|
28675
|
+
* An observable emitting either `connected` or `disconnected` depending on the state of the realtime connection.
|
|
28676
|
+
* Can be used to e.g. inform the user about the interrupted realtime connection.
|
|
28677
|
+
*/
|
|
28678
|
+
get connectionStatus$() {
|
|
28679
|
+
return this.realtimeSubject.connectionStatus$;
|
|
28680
|
+
}
|
|
28667
28681
|
/**
|
|
28668
28682
|
* Get an Observable of all realtime notifications.
|
|
28669
28683
|
*
|
|
@@ -28743,6 +28757,8 @@ class RealtimeSubjectService {
|
|
|
28743
28757
|
constructor(realtime) {
|
|
28744
28758
|
this.realtime = realtime;
|
|
28745
28759
|
this.subjects$ = new Map();
|
|
28760
|
+
this.reconnect$ = this.createObservableForReconnect().pipe(share());
|
|
28761
|
+
this.connectionStatus$ = this.createObservableForConnectionStatus().pipe(distinctUntilChanged(), shareReplay({ refCount: true, bufferSize: 1 }));
|
|
28746
28762
|
}
|
|
28747
28763
|
getObservableForChannel(channel) {
|
|
28748
28764
|
if (this.subjects$.has(channel)) {
|
|
@@ -28755,7 +28771,7 @@ class RealtimeSubjectService {
|
|
|
28755
28771
|
}
|
|
28756
28772
|
createObservableForChannel(channel, realtime) {
|
|
28757
28773
|
return new Observable(observer => {
|
|
28758
|
-
|
|
28774
|
+
let realtimeSubscription = realtime.subscribe(channel, msg => {
|
|
28759
28775
|
const data = {
|
|
28760
28776
|
channel: msg.channel,
|
|
28761
28777
|
data: msg.data.data,
|
|
@@ -28764,13 +28780,54 @@ class RealtimeSubjectService {
|
|
|
28764
28780
|
};
|
|
28765
28781
|
observer.next(data);
|
|
28766
28782
|
});
|
|
28783
|
+
/**
|
|
28784
|
+
* In (rare) case of a re-handshake, resubscribe valid subscriptions.
|
|
28785
|
+
* @see https://docs.cometd.org/current/reference/#_javascript_subscribe_resubscribe
|
|
28786
|
+
*/
|
|
28787
|
+
const reconnectSubscription = this.reconnect$.subscribe(() => {
|
|
28788
|
+
try {
|
|
28789
|
+
realtimeSubscription = this.realtime.resubscribe(realtimeSubscription);
|
|
28790
|
+
}
|
|
28791
|
+
catch (e) {
|
|
28792
|
+
console.warn(`Failed to resubscribe to channel: "${channel}" after reconnect.`, e);
|
|
28793
|
+
observer.error(e);
|
|
28794
|
+
}
|
|
28795
|
+
});
|
|
28767
28796
|
return {
|
|
28768
|
-
unsubscribe() {
|
|
28797
|
+
unsubscribe: () => {
|
|
28798
|
+
reconnectSubscription.unsubscribe();
|
|
28769
28799
|
realtime.unsubscribe(realtimeSubscription);
|
|
28770
28800
|
}
|
|
28771
28801
|
};
|
|
28772
28802
|
});
|
|
28773
28803
|
}
|
|
28804
|
+
createObservableForReconnect() {
|
|
28805
|
+
return new Observable(observer => {
|
|
28806
|
+
const handle = this.realtime.addHandshakeListener(msg => {
|
|
28807
|
+
if (msg.successful && msg.reestablish) {
|
|
28808
|
+
observer.next();
|
|
28809
|
+
}
|
|
28810
|
+
});
|
|
28811
|
+
return {
|
|
28812
|
+
unsubscribe: () => {
|
|
28813
|
+
this.realtime.removeListener(handle);
|
|
28814
|
+
}
|
|
28815
|
+
};
|
|
28816
|
+
});
|
|
28817
|
+
}
|
|
28818
|
+
createObservableForConnectionStatus() {
|
|
28819
|
+
return new Observable(observer => {
|
|
28820
|
+
observer.next(!this.realtime.isDisconnected() ? 'connected' : 'disconnected');
|
|
28821
|
+
const handle = this.realtime.addConnectListener(msg => {
|
|
28822
|
+
observer.next(msg.successful ? 'connected' : 'disconnected');
|
|
28823
|
+
});
|
|
28824
|
+
return {
|
|
28825
|
+
unsubscribe: () => {
|
|
28826
|
+
this.realtime.removeListener(handle);
|
|
28827
|
+
}
|
|
28828
|
+
};
|
|
28829
|
+
});
|
|
28830
|
+
}
|
|
28774
28831
|
}
|
|
28775
28832
|
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 });
|
|
28776
28833
|
RealtimeSubjectService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.6", ngImport: i0, type: RealtimeSubjectService, providedIn: 'root' });
|