@ceon-oy/monitor-sdk 1.0.7 → 1.0.9
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 +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +22 -8
- package/dist/index.mjs +22 -8
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -142,6 +142,7 @@ declare class MonitorClient {
|
|
|
142
142
|
private settingsPollingTimer;
|
|
143
143
|
private lastScanTime;
|
|
144
144
|
private lastKnownScanRequestedAt;
|
|
145
|
+
private lastKnownTechScanRequestedAt;
|
|
145
146
|
constructor(config: MonitorClientConfig);
|
|
146
147
|
captureError(error: Error, context?: ErrorContext): Promise<void>;
|
|
147
148
|
captureMessage(message: string, severity?: Severity, context?: ErrorContext): Promise<void>;
|
|
@@ -151,12 +152,13 @@ declare class MonitorClient {
|
|
|
151
152
|
private stopAuditIntervalTimer;
|
|
152
153
|
/**
|
|
153
154
|
* Fetch project settings from the monitoring server.
|
|
154
|
-
* Returns configuration including vulnerability scan interval and scan request
|
|
155
|
+
* Returns configuration including vulnerability scan interval and scan request timestamps.
|
|
155
156
|
*/
|
|
156
157
|
fetchProjectSettings(): Promise<{
|
|
157
158
|
name: string;
|
|
158
159
|
vulnerabilityScanIntervalHours: number;
|
|
159
160
|
scanRequestedAt: string | null;
|
|
161
|
+
techScanRequestedAt: string | null;
|
|
160
162
|
} | null>;
|
|
161
163
|
/**
|
|
162
164
|
* Setup automatic vulnerability scanning based on server-configured interval.
|
|
@@ -169,7 +171,7 @@ declare class MonitorClient {
|
|
|
169
171
|
*/
|
|
170
172
|
private runScanAndTrackTime;
|
|
171
173
|
/**
|
|
172
|
-
* Check if the server has requested an on-demand scan.
|
|
174
|
+
* Check if the server has requested an on-demand scan (vulnerability or technology).
|
|
173
175
|
*/
|
|
174
176
|
private checkForScanRequest;
|
|
175
177
|
private enqueue;
|
package/dist/index.d.ts
CHANGED
|
@@ -142,6 +142,7 @@ declare class MonitorClient {
|
|
|
142
142
|
private settingsPollingTimer;
|
|
143
143
|
private lastScanTime;
|
|
144
144
|
private lastKnownScanRequestedAt;
|
|
145
|
+
private lastKnownTechScanRequestedAt;
|
|
145
146
|
constructor(config: MonitorClientConfig);
|
|
146
147
|
captureError(error: Error, context?: ErrorContext): Promise<void>;
|
|
147
148
|
captureMessage(message: string, severity?: Severity, context?: ErrorContext): Promise<void>;
|
|
@@ -151,12 +152,13 @@ declare class MonitorClient {
|
|
|
151
152
|
private stopAuditIntervalTimer;
|
|
152
153
|
/**
|
|
153
154
|
* Fetch project settings from the monitoring server.
|
|
154
|
-
* Returns configuration including vulnerability scan interval and scan request
|
|
155
|
+
* Returns configuration including vulnerability scan interval and scan request timestamps.
|
|
155
156
|
*/
|
|
156
157
|
fetchProjectSettings(): Promise<{
|
|
157
158
|
name: string;
|
|
158
159
|
vulnerabilityScanIntervalHours: number;
|
|
159
160
|
scanRequestedAt: string | null;
|
|
161
|
+
techScanRequestedAt: string | null;
|
|
160
162
|
} | null>;
|
|
161
163
|
/**
|
|
162
164
|
* Setup automatic vulnerability scanning based on server-configured interval.
|
|
@@ -169,7 +171,7 @@ declare class MonitorClient {
|
|
|
169
171
|
*/
|
|
170
172
|
private runScanAndTrackTime;
|
|
171
173
|
/**
|
|
172
|
-
* Check if the server has requested an on-demand scan.
|
|
174
|
+
* Check if the server has requested an on-demand scan (vulnerability or technology).
|
|
173
175
|
*/
|
|
174
176
|
private checkForScanRequest;
|
|
175
177
|
private enqueue;
|
package/dist/index.js
CHANGED
|
@@ -46,6 +46,7 @@ var MonitorClient = class {
|
|
|
46
46
|
this.settingsPollingTimer = null;
|
|
47
47
|
this.lastScanTime = null;
|
|
48
48
|
this.lastKnownScanRequestedAt = null;
|
|
49
|
+
this.lastKnownTechScanRequestedAt = null;
|
|
49
50
|
if (!config.apiKey || config.apiKey.trim().length === 0) {
|
|
50
51
|
throw new Error("[MonitorClient] API key is required");
|
|
51
52
|
}
|
|
@@ -193,7 +194,7 @@ var MonitorClient = class {
|
|
|
193
194
|
}
|
|
194
195
|
/**
|
|
195
196
|
* Fetch project settings from the monitoring server.
|
|
196
|
-
* Returns configuration including vulnerability scan interval and scan request
|
|
197
|
+
* Returns configuration including vulnerability scan interval and scan request timestamps.
|
|
197
198
|
*/
|
|
198
199
|
async fetchProjectSettings() {
|
|
199
200
|
try {
|
|
@@ -229,6 +230,9 @@ var MonitorClient = class {
|
|
|
229
230
|
if (settings.scanRequestedAt) {
|
|
230
231
|
this.lastKnownScanRequestedAt = new Date(settings.scanRequestedAt);
|
|
231
232
|
}
|
|
233
|
+
if (settings.techScanRequestedAt) {
|
|
234
|
+
this.lastKnownTechScanRequestedAt = new Date(settings.techScanRequestedAt);
|
|
235
|
+
}
|
|
232
236
|
const intervalHours = settings.vulnerabilityScanIntervalHours;
|
|
233
237
|
if (intervalHours <= 0) {
|
|
234
238
|
console.log("[MonitorClient] Scheduled vulnerability scanning disabled by server configuration");
|
|
@@ -257,17 +261,27 @@ var MonitorClient = class {
|
|
|
257
261
|
}
|
|
258
262
|
}
|
|
259
263
|
/**
|
|
260
|
-
* Check if the server has requested an on-demand scan.
|
|
264
|
+
* Check if the server has requested an on-demand scan (vulnerability or technology).
|
|
261
265
|
*/
|
|
262
266
|
async checkForScanRequest() {
|
|
263
267
|
try {
|
|
264
268
|
const settings = await this.fetchProjectSettings();
|
|
265
|
-
if (!settings
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
269
|
+
if (!settings) return;
|
|
270
|
+
if (settings.scanRequestedAt) {
|
|
271
|
+
const scanRequestedAt = new Date(settings.scanRequestedAt);
|
|
272
|
+
if (!this.lastKnownScanRequestedAt || scanRequestedAt > this.lastKnownScanRequestedAt) {
|
|
273
|
+
console.log("[MonitorClient] On-demand vulnerability scan requested by server");
|
|
274
|
+
this.lastKnownScanRequestedAt = scanRequestedAt;
|
|
275
|
+
await this.runScanAndTrackTime();
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
if (settings.techScanRequestedAt) {
|
|
279
|
+
const techScanRequestedAt = new Date(settings.techScanRequestedAt);
|
|
280
|
+
if (!this.lastKnownTechScanRequestedAt || techScanRequestedAt > this.lastKnownTechScanRequestedAt) {
|
|
281
|
+
console.log("[MonitorClient] On-demand technology scan requested by server");
|
|
282
|
+
this.lastKnownTechScanRequestedAt = techScanRequestedAt;
|
|
283
|
+
await this.syncDependencies();
|
|
284
|
+
}
|
|
271
285
|
}
|
|
272
286
|
} catch (err) {
|
|
273
287
|
console.error("[MonitorClient] Failed to check for scan request:", err instanceof Error ? err.message : String(err));
|
package/dist/index.mjs
CHANGED
|
@@ -10,6 +10,7 @@ var MonitorClient = class {
|
|
|
10
10
|
this.settingsPollingTimer = null;
|
|
11
11
|
this.lastScanTime = null;
|
|
12
12
|
this.lastKnownScanRequestedAt = null;
|
|
13
|
+
this.lastKnownTechScanRequestedAt = null;
|
|
13
14
|
if (!config.apiKey || config.apiKey.trim().length === 0) {
|
|
14
15
|
throw new Error("[MonitorClient] API key is required");
|
|
15
16
|
}
|
|
@@ -157,7 +158,7 @@ var MonitorClient = class {
|
|
|
157
158
|
}
|
|
158
159
|
/**
|
|
159
160
|
* Fetch project settings from the monitoring server.
|
|
160
|
-
* Returns configuration including vulnerability scan interval and scan request
|
|
161
|
+
* Returns configuration including vulnerability scan interval and scan request timestamps.
|
|
161
162
|
*/
|
|
162
163
|
async fetchProjectSettings() {
|
|
163
164
|
try {
|
|
@@ -193,6 +194,9 @@ var MonitorClient = class {
|
|
|
193
194
|
if (settings.scanRequestedAt) {
|
|
194
195
|
this.lastKnownScanRequestedAt = new Date(settings.scanRequestedAt);
|
|
195
196
|
}
|
|
197
|
+
if (settings.techScanRequestedAt) {
|
|
198
|
+
this.lastKnownTechScanRequestedAt = new Date(settings.techScanRequestedAt);
|
|
199
|
+
}
|
|
196
200
|
const intervalHours = settings.vulnerabilityScanIntervalHours;
|
|
197
201
|
if (intervalHours <= 0) {
|
|
198
202
|
console.log("[MonitorClient] Scheduled vulnerability scanning disabled by server configuration");
|
|
@@ -221,17 +225,27 @@ var MonitorClient = class {
|
|
|
221
225
|
}
|
|
222
226
|
}
|
|
223
227
|
/**
|
|
224
|
-
* Check if the server has requested an on-demand scan.
|
|
228
|
+
* Check if the server has requested an on-demand scan (vulnerability or technology).
|
|
225
229
|
*/
|
|
226
230
|
async checkForScanRequest() {
|
|
227
231
|
try {
|
|
228
232
|
const settings = await this.fetchProjectSettings();
|
|
229
|
-
if (!settings
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
233
|
+
if (!settings) return;
|
|
234
|
+
if (settings.scanRequestedAt) {
|
|
235
|
+
const scanRequestedAt = new Date(settings.scanRequestedAt);
|
|
236
|
+
if (!this.lastKnownScanRequestedAt || scanRequestedAt > this.lastKnownScanRequestedAt) {
|
|
237
|
+
console.log("[MonitorClient] On-demand vulnerability scan requested by server");
|
|
238
|
+
this.lastKnownScanRequestedAt = scanRequestedAt;
|
|
239
|
+
await this.runScanAndTrackTime();
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
if (settings.techScanRequestedAt) {
|
|
243
|
+
const techScanRequestedAt = new Date(settings.techScanRequestedAt);
|
|
244
|
+
if (!this.lastKnownTechScanRequestedAt || techScanRequestedAt > this.lastKnownTechScanRequestedAt) {
|
|
245
|
+
console.log("[MonitorClient] On-demand technology scan requested by server");
|
|
246
|
+
this.lastKnownTechScanRequestedAt = techScanRequestedAt;
|
|
247
|
+
await this.syncDependencies();
|
|
248
|
+
}
|
|
235
249
|
}
|
|
236
250
|
} catch (err) {
|
|
237
251
|
console.error("[MonitorClient] Failed to check for scan request:", err instanceof Error ? err.message : String(err));
|
package/package.json
CHANGED