@ceon-oy/monitor-sdk 1.0.15 → 1.0.16

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/dist/index.d.mts CHANGED
@@ -45,6 +45,8 @@ interface MonitorClientConfig {
45
45
  includeDevDependencies?: boolean;
46
46
  /** Enable fetching latest versions from npm registry (default: true) */
47
47
  versionCheckEnabled?: boolean;
48
+ /** Timeout for npm audit command in ms (default: 60000, max: 300000) */
49
+ auditTimeoutMs?: number;
48
50
  }
49
51
  interface TechnologyItem {
50
52
  name: string;
@@ -182,6 +184,7 @@ declare class MonitorClient {
182
184
  private lastKnownScanRequestedAt;
183
185
  private lastKnownTechScanRequestedAt;
184
186
  private versionCheckEnabled;
187
+ private auditTimeoutMs;
185
188
  constructor(config: MonitorClientConfig);
186
189
  /**
187
190
  * Security: Validate and sanitize metadata to prevent oversized payloads
package/dist/index.d.ts CHANGED
@@ -45,6 +45,8 @@ interface MonitorClientConfig {
45
45
  includeDevDependencies?: boolean;
46
46
  /** Enable fetching latest versions from npm registry (default: true) */
47
47
  versionCheckEnabled?: boolean;
48
+ /** Timeout for npm audit command in ms (default: 60000, max: 300000) */
49
+ auditTimeoutMs?: number;
48
50
  }
49
51
  interface TechnologyItem {
50
52
  name: string;
@@ -182,6 +184,7 @@ declare class MonitorClient {
182
184
  private lastKnownScanRequestedAt;
183
185
  private lastKnownTechScanRequestedAt;
184
186
  private versionCheckEnabled;
187
+ private auditTimeoutMs;
185
188
  constructor(config: MonitorClientConfig);
186
189
  /**
187
190
  * Security: Validate and sanitize metadata to prevent oversized payloads
package/dist/index.js CHANGED
@@ -50,7 +50,9 @@ var CONFIG_LIMITS = {
50
50
  AUDIT_MAX_BUFFER: 10 * 1024 * 1024,
51
51
  // 10MB
52
52
  AUDIT_TIMEOUT_MS: 6e4,
53
- // 60 seconds
53
+ // 60 seconds (default)
54
+ MAX_AUDIT_TIMEOUT_MS: 3e5,
55
+ // 5 minutes (max configurable)
54
56
  SETTINGS_POLL_INTERVAL_MS: 5 * 60 * 1e3
55
57
  // 5 minutes
56
58
  };
@@ -118,6 +120,7 @@ var MonitorClient = class {
118
120
  this.auditPaths = config.auditPaths;
119
121
  this.includeDevDependencies = config.includeDevDependencies ?? false;
120
122
  this.versionCheckEnabled = config.versionCheckEnabled ?? true;
123
+ this.auditTimeoutMs = Math.min(CONFIG_LIMITS.MAX_AUDIT_TIMEOUT_MS, Math.max(1e3, config.auditTimeoutMs || CONFIG_LIMITS.AUDIT_TIMEOUT_MS));
121
124
  this.startFlushTimer();
122
125
  if (this.trackDependencies) {
123
126
  this.syncDependencies().catch((err) => {
@@ -770,7 +773,7 @@ var MonitorClient = class {
770
773
  encoding: "utf-8",
771
774
  stdio: ["pipe", "pipe", "pipe"],
772
775
  maxBuffer: CONFIG_LIMITS.AUDIT_MAX_BUFFER,
773
- timeout: CONFIG_LIMITS.AUDIT_TIMEOUT_MS
776
+ timeout: this.auditTimeoutMs
774
777
  });
775
778
  } catch (err) {
776
779
  const execError = err;
@@ -804,7 +807,7 @@ var MonitorClient = class {
804
807
  encoding: "utf-8",
805
808
  stdio: ["pipe", "pipe", "pipe"],
806
809
  maxBuffer: CONFIG_LIMITS.AUDIT_MAX_BUFFER,
807
- timeout: CONFIG_LIMITS.AUDIT_TIMEOUT_MS
810
+ timeout: this.auditTimeoutMs
808
811
  });
809
812
  } catch (err) {
810
813
  const execError = err;
@@ -828,7 +831,7 @@ var MonitorClient = class {
828
831
  encoding: "utf-8",
829
832
  stdio: ["pipe", "pipe", "pipe"],
830
833
  maxBuffer: CONFIG_LIMITS.AUDIT_MAX_BUFFER,
831
- timeout: CONFIG_LIMITS.AUDIT_TIMEOUT_MS
834
+ timeout: this.auditTimeoutMs
832
835
  });
833
836
  } catch (err) {
834
837
  const execError = err;
package/dist/index.mjs CHANGED
@@ -14,7 +14,9 @@ var CONFIG_LIMITS = {
14
14
  AUDIT_MAX_BUFFER: 10 * 1024 * 1024,
15
15
  // 10MB
16
16
  AUDIT_TIMEOUT_MS: 6e4,
17
- // 60 seconds
17
+ // 60 seconds (default)
18
+ MAX_AUDIT_TIMEOUT_MS: 3e5,
19
+ // 5 minutes (max configurable)
18
20
  SETTINGS_POLL_INTERVAL_MS: 5 * 60 * 1e3
19
21
  // 5 minutes
20
22
  };
@@ -82,6 +84,7 @@ var MonitorClient = class {
82
84
  this.auditPaths = config.auditPaths;
83
85
  this.includeDevDependencies = config.includeDevDependencies ?? false;
84
86
  this.versionCheckEnabled = config.versionCheckEnabled ?? true;
87
+ this.auditTimeoutMs = Math.min(CONFIG_LIMITS.MAX_AUDIT_TIMEOUT_MS, Math.max(1e3, config.auditTimeoutMs || CONFIG_LIMITS.AUDIT_TIMEOUT_MS));
85
88
  this.startFlushTimer();
86
89
  if (this.trackDependencies) {
87
90
  this.syncDependencies().catch((err) => {
@@ -734,7 +737,7 @@ var MonitorClient = class {
734
737
  encoding: "utf-8",
735
738
  stdio: ["pipe", "pipe", "pipe"],
736
739
  maxBuffer: CONFIG_LIMITS.AUDIT_MAX_BUFFER,
737
- timeout: CONFIG_LIMITS.AUDIT_TIMEOUT_MS
740
+ timeout: this.auditTimeoutMs
738
741
  });
739
742
  } catch (err) {
740
743
  const execError = err;
@@ -768,7 +771,7 @@ var MonitorClient = class {
768
771
  encoding: "utf-8",
769
772
  stdio: ["pipe", "pipe", "pipe"],
770
773
  maxBuffer: CONFIG_LIMITS.AUDIT_MAX_BUFFER,
771
- timeout: CONFIG_LIMITS.AUDIT_TIMEOUT_MS
774
+ timeout: this.auditTimeoutMs
772
775
  });
773
776
  } catch (err) {
774
777
  const execError = err;
@@ -792,7 +795,7 @@ var MonitorClient = class {
792
795
  encoding: "utf-8",
793
796
  stdio: ["pipe", "pipe", "pipe"],
794
797
  maxBuffer: CONFIG_LIMITS.AUDIT_MAX_BUFFER,
795
- timeout: CONFIG_LIMITS.AUDIT_TIMEOUT_MS
798
+ timeout: this.auditTimeoutMs
796
799
  });
797
800
  } catch (err) {
798
801
  const execError = err;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ceon-oy/monitor-sdk",
3
- "version": "1.0.15",
3
+ "version": "1.0.16",
4
4
  "description": "Client SDK for Ceon Monitor - Error tracking, health monitoring, security events, and vulnerability scanning",
5
5
  "author": "Ceon",
6
6
  "license": "MIT",