@openfin/node-adapter 44.100.25 → 44.100.26

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.
Files changed (2) hide show
  1. package/out/node-adapter.js +22 -56
  2. package/package.json +2 -2
@@ -44,35 +44,6 @@ var system = {};
44
44
 
45
45
  var base = {};
46
46
 
47
- var promises = {};
48
-
49
- Object.defineProperty(promises, "__esModule", { value: true });
50
- promises.promiseMapSerial = promises.serial = promiseMap_1 = promises.promiseMap = promisify_1 = promises.promisify = void 0;
51
- function promisify(func) {
52
- return (...args) => new Promise((resolve, reject) => {
53
- func(...args, (err, val) => (err ? reject(err) : resolve(val)));
54
- });
55
- }
56
- var promisify_1 = promises.promisify = promisify;
57
- async function promiseMap(arr, asyncF) {
58
- return Promise.all(arr.map(asyncF));
59
- }
60
- var promiseMap_1 = promises.promiseMap = promiseMap;
61
- async function serial(arr) {
62
- const ret = [];
63
- for (const func of arr) {
64
- // eslint-disable-next-line no-await-in-loop
65
- const next = await func();
66
- ret.push(next);
67
- }
68
- return ret;
69
- }
70
- promises.serial = serial;
71
- async function promiseMapSerial(arr, func) {
72
- return serial(arr.map((value, index, array) => () => func(value, index, array)));
73
- }
74
- promises.promiseMapSerial = promiseMapSerial;
75
-
76
47
  var __classPrivateFieldSet$h = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
77
48
  if (kind === "m") throw new TypeError("Private method is not writable");
78
49
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
@@ -87,7 +58,6 @@ var __classPrivateFieldGet$i = (commonjsGlobal && commonjsGlobal.__classPrivateF
87
58
  var _EmitterBase_emitterAccessor, _EmitterBase_deregisterOnceListeners;
88
59
  Object.defineProperty(base, "__esModule", { value: true });
89
60
  base.Reply = base.EmitterBase = base.Base = void 0;
90
- const promises_1 = promises;
91
61
  class Base {
92
62
  /**
93
63
  * @internal
@@ -165,27 +135,8 @@ class EmitterBase extends Base {
165
135
  return this.hasEmitter() ? this.getOrCreateEmitter().emit(eventType, payload, ...args) : false;
166
136
  };
167
137
  this.hasEmitter = () => this.wire.eventAggregator.has(__classPrivateFieldGet$i(this, _EmitterBase_emitterAccessor, "f"));
168
- /**
169
- * Cleans up after removal of a listener, e.g. deleting any lingering deregistration handlers for a
170
- * `once` subscription.
171
- *
172
- * @remarks Implementing this as a `removeListener` handler ensures that direct removal of a listener
173
- * on the base emitter will not leak additional core handlers. We could do this in the forwarding method,
174
- * which would involve less "magic," but would be more-vulnerable to accidental re-introduction of a leak.
175
- */
176
- this.cleanUpRemovedListener = (eventType, listener) => {
177
- const deregister = __classPrivateFieldGet$i(this, _EmitterBase_deregisterOnceListeners, "f").get(listener);
178
- if (deregister) {
179
- const emitter = this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet$i(this, _EmitterBase_emitterAccessor, "f"));
180
- emitter.removeListener(eventType, deregister);
181
- }
182
- };
183
138
  this.getOrCreateEmitter = () => {
184
- const emitter = this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet$i(this, _EmitterBase_emitterAccessor, "f"));
185
- if (!emitter.listeners('removeListener').includes(this.cleanUpRemovedListener)) {
186
- emitter.on('removeListener', this.cleanUpRemovedListener);
187
- }
188
- return emitter;
139
+ return this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet$i(this, _EmitterBase_emitterAccessor, "f"));
189
140
  };
190
141
  this.listeners = (type) => this.hasEmitter() ? this.getOrCreateEmitter().listeners(type) : [];
191
142
  this.listenerCount = (type) => this.hasEmitter() ? this.getOrCreateEmitter().listenerCount(type) : 0;
@@ -225,7 +176,6 @@ class EmitterBase extends Base {
225
176
  };
226
177
  __classPrivateFieldSet$h(this, _EmitterBase_emitterAccessor, [topic, ...additionalAccessors], "f");
227
178
  __classPrivateFieldSet$h(this, _EmitterBase_deregisterOnceListeners, new WeakMap(), "f");
228
- this.listeners = (event) => this.hasEmitter() ? this.getOrCreateEmitter().listeners(event) : [];
229
179
  }
230
180
  /**
231
181
  * Adds a listener to the end of the listeners array for the specified event.
@@ -303,6 +253,10 @@ class EmitterBase extends Base {
303
253
  const emitter = await this.deregisterEventListener(eventType, options);
304
254
  if (emitter) {
305
255
  emitter.removeListener(eventType, listener);
256
+ const deregister = __classPrivateFieldGet$i(this, _EmitterBase_deregisterOnceListeners, "f").get(listener);
257
+ if (deregister) {
258
+ emitter.removeListener(eventType, deregister);
259
+ }
306
260
  this.deleteEmitterIfNothingRegistered(emitter);
307
261
  }
308
262
  return this;
@@ -338,12 +292,13 @@ class EmitterBase extends Base {
338
292
  }
339
293
  else if (this.hasEmitter()) {
340
294
  const events = this.getOrCreateEmitter().eventNames();
341
- await (0, promises_1.promiseMap)(events, removeByEvent);
295
+ await Promise.all(events.map(removeByEvent));
342
296
  }
343
297
  return this;
344
298
  }
345
299
  deleteEmitterIfNothingRegistered(emitter) {
346
- if (emitter.eventNames().every((type) => type === 'removeListener')) {
300
+ // TODO: maybe emitterMap should clean up itself..
301
+ if (emitter.eventNames().length === 0) {
347
302
  this.wire.eventAggregator.delete(__classPrivateFieldGet$i(this, _EmitterBase_emitterAccessor, "f"));
348
303
  }
349
304
  }
@@ -17348,6 +17303,17 @@ Object.defineProperty(environment$1, "__esModule", { value: true });
17348
17303
  var notImplementedEnvErrorMsg = environment$1.notImplementedEnvErrorMsg = void 0;
17349
17304
  notImplementedEnvErrorMsg = environment$1.notImplementedEnvErrorMsg = 'Not implemented in this environment';
17350
17305
 
17306
+ var promises = {};
17307
+
17308
+ Object.defineProperty(promises, "__esModule", { value: true });
17309
+ var promisify_1 = promises.promisify = void 0;
17310
+ function promisify(func) {
17311
+ return (...args) => new Promise((resolve, reject) => {
17312
+ func(...args, (err, val) => (err ? reject(err) : resolve(val)));
17313
+ });
17314
+ }
17315
+ promisify_1 = promises.promisify = promisify;
17316
+
17351
17317
  const getProxyVar = () => {
17352
17318
  return process.env.HTTPS_PROXY || process.env.https_proxy || process.env.HTTP_PROXY || process.env.http_proxy;
17353
17319
  };
@@ -17467,7 +17433,7 @@ async function rmDir(dirPath, removeSelf = true) {
17467
17433
  return;
17468
17434
  }
17469
17435
  if (files.length > 0) {
17470
- await promiseMap_1(files, async (f) => {
17436
+ await Promise.all(files.map(async (f) => {
17471
17437
  const filePath = `${dirPath}/${f}`;
17472
17438
  const file = await lstat(filePath);
17473
17439
  if (file.isFile() || file.isSymbolicLink()) {
@@ -17476,7 +17442,7 @@ async function rmDir(dirPath, removeSelf = true) {
17476
17442
  else {
17477
17443
  await rmDir(filePath, true);
17478
17444
  }
17479
- });
17445
+ }));
17480
17446
  }
17481
17447
  if (removeSelf) {
17482
17448
  await rmdir(dirPath);
@@ -18058,7 +18024,7 @@ class NodeEnvironment extends BaseEnvironment_1 {
18058
18024
  };
18059
18025
  }
18060
18026
  getAdapterVersionSync() {
18061
- return "44.100.25";
18027
+ return "44.100.26";
18062
18028
  }
18063
18029
  observeBounds(element, onChange) {
18064
18030
  throw new Error('Method not implemented.');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfin/node-adapter",
3
- "version": "44.100.25",
3
+ "version": "44.100.26",
4
4
  "description": "See README.md",
5
5
  "main": "out/node-adapter.js",
6
6
  "types": "out/node-adapter.d.ts",
@@ -24,7 +24,7 @@
24
24
  "author": "OpenFin",
25
25
  "dependencies": {
26
26
  "@types/node": "^20.14.2",
27
- "@openfin/core": "44.100.25",
27
+ "@openfin/core": "44.100.26",
28
28
  "lodash": "^4.17.21",
29
29
  "ws": "^7.3.0"
30
30
  }