core-3nweb-client-lib 0.43.0 → 0.43.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.
@@ -48,13 +48,15 @@ class RemoteEvents {
48
48
  heartbeat.subscribe({
49
49
  next: ev => this.connectionEvents.next(toStorageConnectionStatus(ev))
50
50
  });
51
- return client;
51
+ return [
52
+ this.absorbObjChange(client),
53
+ this.absorbObjRemoval(client),
54
+ // XXX commenting out these for now, as server hasn't implemented these
55
+ // this.absorbObjVersionArchival(client),
56
+ // this.absorbArchVersionRemoval(client)
57
+ ];
52
58
  }))
53
- .pipe((0, operators_1.map)(client => (0, rxjs_1.merge)(this.absorbObjChange(client), this.absorbObjRemoval(client),
54
- // XXX commenting out to see if unknownEvent exception goes away
55
- // Is server doesn't know it?
56
- // this.absorbObjVersionArchival(client),
57
- this.absorbArchVersionRemoval(client))), (0, operators_1.mergeMap)(event$ => event$))
59
+ .pipe((0, operators_1.mergeMap)(event$ => event$), (0, operators_1.mergeMap)(event$ => event$))
58
60
  .subscribe({
59
61
  next: noop,
60
62
  error: async (err) => {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /*
3
- Copyright (C) 2016 - 2017 3NSoft Inc.
3
+ Copyright (C) 2016 - 2017, 2025 3NSoft Inc.
4
4
 
5
5
  This program is free software: you can redistribute it and/or modify it under
6
6
  the terms of the GNU General Public License as published by the Free Software
@@ -451,7 +451,7 @@ class EventsReceivingSide extends RequestingSide {
451
451
  * name, to which listener is attached.
452
452
  */
453
453
  this.listeners = new map_of_sets_1.MapOfSets();
454
- this.channels = new IpcEventChannels(ipcChannel => this.makeRequest(SUBSCRIBE_REQ_NAME, ipcChannel).catch(err => this.completeEvent(ipcChannel, err)), ipcChannel => this.makeRequest(UNSUBSCRIBE_REQ_NAME, ipcChannel).catch(_ => { }));
454
+ this.channels = new IpcEventChannels(ipcChannel => this.makeRequest(SUBSCRIBE_REQ_NAME, ipcChannel), ipcChannel => this.makeRequest(UNSUBSCRIBE_REQ_NAME, ipcChannel).catch(_ => { }));
455
455
  }
456
456
  handleMsg(env) {
457
457
  if (env.type === 'event') {
@@ -543,8 +543,19 @@ class EventsReceivingSide extends RequestingSide {
543
543
  }
544
544
  };
545
545
  const listener = new EventListener(channel, observer, detach);
546
- this.listeners.add(ipcChannel, listener);
547
- this.channels.subscribeTo(ipcChannel);
546
+ this.channels.subscribeTo(ipcChannel).then(() => this.listeners.add(ipcChannel, listener), err => {
547
+ var _a;
548
+ if (observer.error) {
549
+ observer.error(makeEventException({
550
+ cause: err,
551
+ failToSubscribe: true,
552
+ channel: ipcChannel
553
+ }));
554
+ }
555
+ else {
556
+ (_a = observer.complete) === null || _a === void 0 ? void 0 : _a.call(observer);
557
+ }
558
+ });
548
559
  return detach;
549
560
  }
550
561
  wrap() {
@@ -571,16 +582,22 @@ class IpcEventChannels {
571
582
  this.subscriptionProcs = new synced_1.NamedProcs();
572
583
  Object.freeze(this);
573
584
  }
574
- subscribeTo(ipcChannel) {
585
+ async subscribeTo(ipcChannel) {
575
586
  if (this.subscribedIpcChannels.has(ipcChannel)) {
576
587
  return;
577
588
  }
578
- this.subscriptionProcs.startOrChain(ipcChannel, async () => {
589
+ await this.subscriptionProcs.startOrChain(ipcChannel, async () => {
579
590
  if (this.subscribedIpcChannels.has(ipcChannel)) {
580
591
  return;
581
592
  }
582
593
  this.subscribedIpcChannels.add(ipcChannel);
583
- await this.subscribe(ipcChannel);
594
+ try {
595
+ await this.subscribe(ipcChannel);
596
+ }
597
+ catch (err) {
598
+ this.subscribedIpcChannels.delete(ipcChannel);
599
+ throw err;
600
+ }
584
601
  });
585
602
  }
586
603
  async unsubscribeFrom(ipcChannel) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "core-3nweb-client-lib",
3
- "version": "0.43.0",
3
+ "version": "0.43.2",
4
4
  "description": "3NWeb client core library, embeddable into different environments",
5
5
  "main": "build/lib-index.js",
6
6
  "types": "build/lib-index.d.ts",