querysub 0.322.0 → 0.324.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "querysub",
3
- "version": "0.322.0",
3
+ "version": "0.324.0",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "note1": "note on node-forge fork, see https://github.com/digitalbazaar/forge/issues/744 for details",
@@ -517,9 +517,9 @@ export class Querysub {
517
517
  public static getOwnMachineId = getOwnMachineId;
518
518
  public static getSelfMachineId = getOwnMachineId;
519
519
 
520
- public static getOwnNodeId = getOwnNodeId;
521
- public static getSelfNodeId = getOwnNodeId;
522
- public static getOwnThreadId = getOwnThreadId;
520
+ public static getOwnNodeId = () => getOwnNodeId();
521
+ public static getSelfNodeId = () => getOwnNodeId();
522
+ public static getOwnThreadId = () => getOwnThreadId();
523
523
 
524
524
  /** Set ClientWatcher.DEBUG_SOURCES to true for to be populated */
525
525
  public static getTriggerReason() {
@@ -177,7 +177,7 @@ function packageLogObj(type: string, args: unknown[]): LogDatum {
177
177
  let stringCount = 0;
178
178
  for (let i = 0; i < args.length; i++) {
179
179
  let param = args[i];
180
- if (canHaveChildren(param)) {
180
+ if (canHaveChildren(param) && !Array.isArray(param)) {
181
181
  Object.assign(logObj, param);
182
182
  } else {
183
183
  logObj["param" + stringCount] = param;
@@ -386,7 +386,8 @@ class RecentErrors {
386
386
  });
387
387
 
388
388
  private _recentErrors: LogDatum[] = [];
389
- private updateRecentErrors = (objs: LogDatum[]) => {
389
+ private updateRecentErrors = async (objs: LogDatum[]) => {
390
+ objs = await suppressionList.filterObjsToNonSuppressed(objs);
390
391
  let newRecentErrors = limitRecentErrors(objs);
391
392
  // If any changed
392
393
  let prev = new Set(this._recentErrors);
@@ -413,15 +414,15 @@ class RecentErrors {
413
414
  recentErrorsChannel.broadcast(true);
414
415
  });
415
416
 
416
- private addErrors(objs: LogDatum[]) {
417
+ private async addErrors(objs: LogDatum[]) {
417
418
  for (let obj of objs) {
418
419
  this._recentErrors.push(obj);
419
420
  }
420
- this.updateRecentErrors(this._recentErrors);
421
+ await this.updateRecentErrors(this._recentErrors);
421
422
  }
422
423
 
423
424
  public async onSuppressionChanged() {
424
- this.updateRecentErrors(await suppressionList.filterObjsToNonSuppressed(this._recentErrors));
425
+ await this.updateRecentErrors(this._recentErrors);
425
426
  }
426
427
 
427
428
  private scannedHashes = new Set<string>();
@@ -440,7 +441,7 @@ class RecentErrors {
440
441
  noLocalFiles: config.noLocalFiles,
441
442
  });
442
443
  // Filter again, as new suppressions change the errors
443
- this.updateRecentErrors(await suppressionList.filterObjsToNonSuppressed(this._recentErrors));
444
+ await this.updateRecentErrors(this._recentErrors);
444
445
  let recentLimit = 0;
445
446
  const applyRecentLimit = () => {
446
447
  if (this._recentErrors.length < MAX_RECENT_ERRORS) return;
@@ -512,7 +513,7 @@ class RecentErrors {
512
513
  await fd.close();
513
514
  }
514
515
  let newErrors = await scanner.finish();
515
- this.addErrors(newErrors);
516
+ await this.addErrors(newErrors);
516
517
  applyRecentLimit();
517
518
  } catch (e: any) {
518
519
  console.error(`Failed to scan file ${file.url}, size is ${size}, error is:\n${e.stack}`);