@hasna/uptime 0.1.22 → 0.1.24
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/CHANGELOG.md +22 -0
- package/NOTICE +1 -1
- package/README.md +4 -1
- package/THIRD_PARTY_NOTICES.md +4 -1
- package/dist/api.d.ts +1 -0
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +271 -56
- package/dist/checks.d.ts +4 -0
- package/dist/checks.d.ts.map +1 -1
- package/dist/checks.js +26 -3
- package/dist/cli/index.js +301 -60
- package/dist/cloud-plan.d.ts +3 -1
- package/dist/cloud-plan.d.ts.map +1 -1
- package/dist/cloud-plan.js +5 -2
- package/dist/imports.d.ts +5 -1
- package/dist/imports.d.ts.map +1 -1
- package/dist/imports.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +277 -58
- package/dist/mcp/index.js +225 -51
- package/dist/service.d.ts +23 -1
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +225 -51
- package/dist/store.d.ts +6 -1
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +79 -12
- package/dist/types.d.ts +3 -0
- package/dist/types.d.ts.map +1 -1
- package/docs/aws-deployment-runbook.md +16 -10
- package/docs/aws-runtime-security.md +2 -1
- package/docs/cloud-source-of-truth.md +13 -10
- package/docs/deployment-metadata.example.json +1 -1
- package/docs/operational-tracking.md +2 -2
- package/infra/aws/terraform.tfvars.example +1 -1
- package/infra/aws/variables.tf +1 -1
- package/package.json +1 -1
package/dist/mcp/index.js
CHANGED
|
@@ -14532,8 +14532,9 @@ async function runMonitorCheck(monitor, options = {}) {
|
|
|
14532
14532
|
}
|
|
14533
14533
|
if (monitor.kind === "browser_page")
|
|
14534
14534
|
return runBrowserPageCheck(monitor, { fetch: options.fetch, runner: options.browserPage });
|
|
14535
|
-
if (monitor.kind === "tcp")
|
|
14536
|
-
return runTcpCheck(monitor);
|
|
14535
|
+
if (monitor.kind === "tcp") {
|
|
14536
|
+
return options.hostedTargetPolicy ? runHostedTcpCheck(monitor, { resolveHost: options.resolveHost }) : runTcpCheck(monitor);
|
|
14537
|
+
}
|
|
14537
14538
|
return { status: "down", latencyMs: null, error: `unsupported monitor kind: ${monitor.kind ?? "unknown"}` };
|
|
14538
14539
|
}
|
|
14539
14540
|
async function runHttpCheck(monitor, fetchImpl = fetch) {
|
|
@@ -14645,9 +14646,30 @@ async function runHostedHttpCheck(monitor, options = {}) {
|
|
|
14645
14646
|
async function runTcpCheck(monitor) {
|
|
14646
14647
|
if (!monitor.host || !monitor.port)
|
|
14647
14648
|
return { status: "down", latencyMs: null, error: "missing host or port" };
|
|
14649
|
+
return runTcpSocket(monitor.host, monitor.port, monitor.timeoutMs);
|
|
14650
|
+
}
|
|
14651
|
+
async function runHostedTcpCheck(monitor, options = {}) {
|
|
14652
|
+
if (!monitor.host || !monitor.port)
|
|
14653
|
+
return { status: "down", latencyMs: null, error: "missing host or port" };
|
|
14654
|
+
const resolver = options.resolveHost ?? resolveHostedHost;
|
|
14655
|
+
try {
|
|
14656
|
+
const addresses = normalizeResolvedAddresses(await resolver(normalizeHostedHost(monitor.host)));
|
|
14657
|
+
assertHostedResolvedAddressesAllowed(monitor.host, addresses, "TCP resolved address");
|
|
14658
|
+
const address = addresses[0];
|
|
14659
|
+
return runTcpSocket(address.address, monitor.port, monitor.timeoutMs, address.family);
|
|
14660
|
+
} catch (error51) {
|
|
14661
|
+
return {
|
|
14662
|
+
status: "down",
|
|
14663
|
+
latencyMs: null,
|
|
14664
|
+
statusCode: null,
|
|
14665
|
+
error: error51 instanceof Error ? error51.message : String(error51)
|
|
14666
|
+
};
|
|
14667
|
+
}
|
|
14668
|
+
}
|
|
14669
|
+
async function runTcpSocket(host, port, timeoutMs, family) {
|
|
14648
14670
|
const started = performance.now();
|
|
14649
14671
|
return new Promise((resolve) => {
|
|
14650
|
-
const socket = net2.createConnection({ host
|
|
14672
|
+
const socket = net2.createConnection({ host, port, timeout: timeoutMs, family });
|
|
14651
14673
|
let settled = false;
|
|
14652
14674
|
const finish = (result) => {
|
|
14653
14675
|
if (settled)
|
|
@@ -15063,7 +15085,7 @@ function previewRecord(store, source, record2, defaults, options) {
|
|
|
15063
15085
|
};
|
|
15064
15086
|
}
|
|
15065
15087
|
const monitorOptions = options.workspaceId ? { workspaceId: options.workspaceId } : undefined;
|
|
15066
|
-
const rawProvenance = store.getProvenance(candidate.source, candidate.sourceId);
|
|
15088
|
+
const rawProvenance = store.getProvenance(candidate.source, candidate.sourceId, monitorOptions);
|
|
15067
15089
|
const provenanceMonitor = rawProvenance ? store.getMonitor(rawProvenance.monitorId, monitorOptions) : null;
|
|
15068
15090
|
const provenance = provenanceMonitor ? rawProvenance : null;
|
|
15069
15091
|
const monitor = provenanceMonitor ?? store.getMonitor(candidate.name, monitorOptions);
|
|
@@ -15526,7 +15548,7 @@ var REQUIRED_TABLES = [
|
|
|
15526
15548
|
];
|
|
15527
15549
|
var PROBE_TABLES = new Set(["probe_identities", "probe_check_jobs", "probe_submissions"]);
|
|
15528
15550
|
var REPORT_AUDIT_TABLES = new Set(["report_schedules", "report_runs", "audit_events"]);
|
|
15529
|
-
var CURRENT_SCHEMA_VERSION = "
|
|
15551
|
+
var CURRENT_SCHEMA_VERSION = "5";
|
|
15530
15552
|
|
|
15531
15553
|
class StaleCheckResultError extends Error {
|
|
15532
15554
|
constructor(message) {
|
|
@@ -15639,15 +15661,17 @@ class UptimeStore {
|
|
|
15639
15661
|
`);
|
|
15640
15662
|
this.db.run(`
|
|
15641
15663
|
CREATE TABLE IF NOT EXISTS monitor_provenance (
|
|
15664
|
+
workspace_id TEXT NOT NULL DEFAULT 'local',
|
|
15642
15665
|
monitor_id TEXT NOT NULL REFERENCES monitors(id) ON DELETE CASCADE,
|
|
15643
15666
|
source TEXT NOT NULL,
|
|
15644
15667
|
source_id TEXT NOT NULL,
|
|
15645
15668
|
source_label TEXT,
|
|
15646
15669
|
imported_at TEXT NOT NULL,
|
|
15647
15670
|
snapshot_json TEXT NOT NULL,
|
|
15648
|
-
PRIMARY KEY (source, source_id)
|
|
15671
|
+
PRIMARY KEY (workspace_id, source, source_id)
|
|
15649
15672
|
)
|
|
15650
15673
|
`);
|
|
15674
|
+
this.ensureMonitorProvenanceWorkspaceScoped();
|
|
15651
15675
|
this.db.run(`
|
|
15652
15676
|
CREATE TABLE IF NOT EXISTS import_batches (
|
|
15653
15677
|
id TEXT PRIMARY KEY,
|
|
@@ -15739,6 +15763,7 @@ class UptimeStore {
|
|
|
15739
15763
|
this.db.run(`
|
|
15740
15764
|
CREATE TABLE IF NOT EXISTS audit_events (
|
|
15741
15765
|
id TEXT PRIMARY KEY,
|
|
15766
|
+
workspace_id TEXT,
|
|
15742
15767
|
action TEXT NOT NULL,
|
|
15743
15768
|
resource_type TEXT,
|
|
15744
15769
|
resource_id TEXT,
|
|
@@ -15748,6 +15773,7 @@ class UptimeStore {
|
|
|
15748
15773
|
created_at TEXT NOT NULL
|
|
15749
15774
|
)
|
|
15750
15775
|
`);
|
|
15776
|
+
this.ensureColumn("audit_events", "workspace_id", "TEXT");
|
|
15751
15777
|
this.db.run(`
|
|
15752
15778
|
CREATE TABLE IF NOT EXISTS schema_migrations (
|
|
15753
15779
|
key TEXT PRIMARY KEY,
|
|
@@ -15761,6 +15787,7 @@ class UptimeStore {
|
|
|
15761
15787
|
this.db.run("CREATE INDEX IF NOT EXISTS idx_incidents_monitor_status ON incidents(monitor_id, status)");
|
|
15762
15788
|
this.db.run("CREATE INDEX IF NOT EXISTS idx_check_leases_until ON check_leases(leased_until)");
|
|
15763
15789
|
this.db.run("CREATE INDEX IF NOT EXISTS idx_monitor_provenance_monitor ON monitor_provenance(monitor_id)");
|
|
15790
|
+
this.db.run("CREATE INDEX IF NOT EXISTS idx_monitor_provenance_workspace_source ON monitor_provenance(workspace_id, source, source_id)");
|
|
15764
15791
|
this.db.run("CREATE INDEX IF NOT EXISTS idx_probe_jobs_status_due ON probe_check_jobs(status, due_at)");
|
|
15765
15792
|
this.db.run("CREATE INDEX IF NOT EXISTS idx_probe_jobs_probe_status ON probe_check_jobs(claimed_by_probe_id, status)");
|
|
15766
15793
|
this.db.run("CREATE INDEX IF NOT EXISTS idx_probe_submissions_probe_time ON probe_submissions(probe_id, submitted_at DESC)");
|
|
@@ -15769,6 +15796,7 @@ class UptimeStore {
|
|
|
15769
15796
|
this.db.run("CREATE INDEX IF NOT EXISTS idx_report_schedules_due ON report_schedules(enabled, next_run_at)");
|
|
15770
15797
|
this.db.run("CREATE INDEX IF NOT EXISTS idx_report_runs_schedule_time ON report_runs(schedule_id, started_at DESC)");
|
|
15771
15798
|
this.db.run("CREATE INDEX IF NOT EXISTS idx_audit_events_resource_time ON audit_events(resource_type, resource_id, created_at DESC)");
|
|
15799
|
+
this.db.run("CREATE INDEX IF NOT EXISTS idx_audit_events_workspace_time ON audit_events(workspace_id, created_at DESC)");
|
|
15772
15800
|
this.db.run("CREATE INDEX IF NOT EXISTS idx_audit_events_time ON audit_events(created_at DESC)");
|
|
15773
15801
|
}
|
|
15774
15802
|
backup(destinationPath) {
|
|
@@ -15818,6 +15846,9 @@ class UptimeStore {
|
|
|
15818
15846
|
const normalized = normalizeCreateMonitor(input, options.allowBrowserPage === true);
|
|
15819
15847
|
if (this.mode === "hosted")
|
|
15820
15848
|
assertHostedTargetAllowed(normalized);
|
|
15849
|
+
if (this.mode === "hosted" && normalized.kind === "browser_page" && normalized.enabled !== false) {
|
|
15850
|
+
throw new Error("hosted browser_page monitors must remain disabled until browser evidence workers are configured");
|
|
15851
|
+
}
|
|
15821
15852
|
const now = new Date().toISOString();
|
|
15822
15853
|
const workspaceId = normalizeWorkspaceId(options.workspaceId ?? input.workspaceId ?? "local");
|
|
15823
15854
|
const monitor = {
|
|
@@ -15882,6 +15913,9 @@ class UptimeStore {
|
|
|
15882
15913
|
const next = normalizeUpdateMonitor(current, input, updatedAt, options.allowBrowserPage === true);
|
|
15883
15914
|
if (this.mode === "hosted")
|
|
15884
15915
|
assertHostedTargetAllowed(next);
|
|
15916
|
+
if (this.mode === "hosted" && next.kind === "browser_page" && next.enabled) {
|
|
15917
|
+
throw new Error("hosted browser_page monitors must remain disabled until browser evidence workers are configured");
|
|
15918
|
+
}
|
|
15885
15919
|
this.db.query(`UPDATE monitors SET
|
|
15886
15920
|
name = ?, kind = ?, url = ?, host = ?, port = ?, method = ?,
|
|
15887
15921
|
expected_status = ?, interval_seconds = ?, timeout_ms = ?,
|
|
@@ -16178,8 +16212,10 @@ class UptimeStore {
|
|
|
16178
16212
|
const action = normalizeAuditText(input.action, "Audit action", 160);
|
|
16179
16213
|
const createdAt = input.createdAt ?? new Date().toISOString();
|
|
16180
16214
|
assertIsoTimestamp(createdAt, "Audit event createdAt");
|
|
16215
|
+
const workspaceId = input.workspaceId == null ? null : normalizeWorkspaceId(input.workspaceId);
|
|
16181
16216
|
const event = {
|
|
16182
16217
|
id: newId("aud"),
|
|
16218
|
+
workspaceId,
|
|
16183
16219
|
action,
|
|
16184
16220
|
resourceType: normalizeNullableAuditText(input.resourceType, "Audit resourceType", 80),
|
|
16185
16221
|
resourceId: normalizeNullableAuditText(input.resourceId, "Audit resourceId", 160),
|
|
@@ -16189,13 +16225,17 @@ class UptimeStore {
|
|
|
16189
16225
|
createdAt
|
|
16190
16226
|
};
|
|
16191
16227
|
this.db.query(`INSERT INTO audit_events (
|
|
16192
|
-
id, action, resource_type, resource_id, message, metadata_json, actor, created_at
|
|
16193
|
-
) VALUES (?, ?, ?, ?, ?, ?, ?, ?)`).run(event.id, event.action, event.resourceType, event.resourceId, event.message, JSON.stringify(event.metadata), event.actor, event.createdAt);
|
|
16228
|
+
id, workspace_id, action, resource_type, resource_id, message, metadata_json, actor, created_at
|
|
16229
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(event.id, event.workspaceId, event.action, event.resourceType, event.resourceId, event.message, JSON.stringify(event.metadata), event.actor, event.createdAt);
|
|
16194
16230
|
return event;
|
|
16195
16231
|
}
|
|
16196
16232
|
listAuditEvents(options = {}) {
|
|
16197
16233
|
const clauses = [];
|
|
16198
16234
|
const args = [];
|
|
16235
|
+
if (options.workspaceId) {
|
|
16236
|
+
clauses.push("workspace_id = ?");
|
|
16237
|
+
args.push(normalizeWorkspaceId(options.workspaceId));
|
|
16238
|
+
}
|
|
16199
16239
|
if (options.resourceType) {
|
|
16200
16240
|
clauses.push("resource_type = ?");
|
|
16201
16241
|
args.push(options.resourceType);
|
|
@@ -16287,21 +16327,24 @@ class UptimeStore {
|
|
|
16287
16327
|
const rows = this.db.query(`SELECT check_results.* FROM check_results JOIN monitors ON monitors.id = check_results.monitor_id ${where} ORDER BY checked_at DESC LIMIT ?`).all(...args);
|
|
16288
16328
|
return rows.map(checkResultFromRow);
|
|
16289
16329
|
}
|
|
16290
|
-
getProvenance(source, sourceId) {
|
|
16291
|
-
const
|
|
16330
|
+
getProvenance(source, sourceId, options = {}) {
|
|
16331
|
+
const workspaceId = options.workspaceId ? normalizeWorkspaceId(options.workspaceId) : undefined;
|
|
16332
|
+
const row = workspaceId ? this.db.query("SELECT * FROM monitor_provenance WHERE workspace_id = ? AND source = ? AND source_id = ?").get(workspaceId, source, sourceId) : this.db.query("SELECT * FROM monitor_provenance WHERE source = ? AND source_id = ? ORDER BY imported_at DESC LIMIT 1").get(source, sourceId);
|
|
16292
16333
|
return row ? provenanceFromRow(row) : null;
|
|
16293
16334
|
}
|
|
16294
16335
|
upsertMonitorProvenance(input) {
|
|
16295
16336
|
const importedAt = new Date().toISOString();
|
|
16337
|
+
const monitor = this.getMonitor(input.monitorId);
|
|
16338
|
+
const workspaceId = normalizeWorkspaceId(input.workspaceId ?? monitor?.workspaceId ?? "local");
|
|
16296
16339
|
this.db.query(`INSERT INTO monitor_provenance (
|
|
16297
|
-
monitor_id, source, source_id, source_label, imported_at, snapshot_json
|
|
16298
|
-
) VALUES (?, ?, ?, ?, ?, ?)
|
|
16299
|
-
ON CONFLICT(source, source_id) DO UPDATE SET
|
|
16340
|
+
workspace_id, monitor_id, source, source_id, source_label, imported_at, snapshot_json
|
|
16341
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
16342
|
+
ON CONFLICT(workspace_id, source, source_id) DO UPDATE SET
|
|
16300
16343
|
monitor_id = excluded.monitor_id,
|
|
16301
16344
|
source_label = excluded.source_label,
|
|
16302
16345
|
imported_at = excluded.imported_at,
|
|
16303
|
-
snapshot_json = excluded.snapshot_json`).run(input.monitorId, input.source, input.sourceId, input.sourceLabel ?? null, importedAt, JSON.stringify(input.snapshot));
|
|
16304
|
-
return this.getProvenance(input.source, input.sourceId);
|
|
16346
|
+
snapshot_json = excluded.snapshot_json`).run(workspaceId, input.monitorId, input.source, input.sourceId, input.sourceLabel ?? null, importedAt, JSON.stringify(input.snapshot));
|
|
16347
|
+
return this.getProvenance(input.source, input.sourceId, { workspaceId });
|
|
16305
16348
|
}
|
|
16306
16349
|
saveImportBatch(input) {
|
|
16307
16350
|
const createdAt = new Date().toISOString();
|
|
@@ -16484,6 +16527,49 @@ class UptimeStore {
|
|
|
16484
16527
|
this.db.run("PRAGMA foreign_keys = ON");
|
|
16485
16528
|
}
|
|
16486
16529
|
}
|
|
16530
|
+
ensureMonitorProvenanceWorkspaceScoped() {
|
|
16531
|
+
const row = this.db.query("SELECT sql FROM sqlite_master WHERE type = 'table' AND name = 'monitor_provenance'").get();
|
|
16532
|
+
const columns = this.db.query("PRAGMA table_info(monitor_provenance)").all();
|
|
16533
|
+
const hasWorkspaceId = columns.some((column) => column.name === "workspace_id");
|
|
16534
|
+
const hasWorkspacePrimaryKey = Boolean(row?.sql?.includes("PRIMARY KEY (workspace_id, source, source_id)"));
|
|
16535
|
+
if (hasWorkspaceId && hasWorkspacePrimaryKey)
|
|
16536
|
+
return;
|
|
16537
|
+
this.db.run("PRAGMA foreign_keys = OFF");
|
|
16538
|
+
this.db.run("PRAGMA legacy_alter_table = ON");
|
|
16539
|
+
try {
|
|
16540
|
+
const migrate = this.db.transaction(() => {
|
|
16541
|
+
this.db.run("ALTER TABLE monitor_provenance RENAME TO monitor_provenance_old_workspace");
|
|
16542
|
+
this.db.run(`
|
|
16543
|
+
CREATE TABLE monitor_provenance (
|
|
16544
|
+
workspace_id TEXT NOT NULL DEFAULT 'local',
|
|
16545
|
+
monitor_id TEXT NOT NULL REFERENCES monitors(id) ON DELETE CASCADE,
|
|
16546
|
+
source TEXT NOT NULL,
|
|
16547
|
+
source_id TEXT NOT NULL,
|
|
16548
|
+
source_label TEXT,
|
|
16549
|
+
imported_at TEXT NOT NULL,
|
|
16550
|
+
snapshot_json TEXT NOT NULL,
|
|
16551
|
+
PRIMARY KEY (workspace_id, source, source_id)
|
|
16552
|
+
)
|
|
16553
|
+
`);
|
|
16554
|
+
const workspaceSelect = hasWorkspaceId ? "COALESCE(old.workspace_id, monitors.workspace_id, 'local')" : "COALESCE(monitors.workspace_id, 'local')";
|
|
16555
|
+
this.db.run(`
|
|
16556
|
+
INSERT OR REPLACE INTO monitor_provenance (
|
|
16557
|
+
workspace_id, monitor_id, source, source_id, source_label, imported_at, snapshot_json
|
|
16558
|
+
)
|
|
16559
|
+
SELECT
|
|
16560
|
+
${workspaceSelect}, old.monitor_id, old.source, old.source_id, old.source_label,
|
|
16561
|
+
old.imported_at, old.snapshot_json
|
|
16562
|
+
FROM monitor_provenance_old_workspace old
|
|
16563
|
+
LEFT JOIN monitors ON monitors.id = old.monitor_id
|
|
16564
|
+
`);
|
|
16565
|
+
this.db.run("DROP TABLE monitor_provenance_old_workspace");
|
|
16566
|
+
});
|
|
16567
|
+
migrate();
|
|
16568
|
+
} finally {
|
|
16569
|
+
this.db.run("PRAGMA legacy_alter_table = OFF");
|
|
16570
|
+
this.db.run("PRAGMA foreign_keys = ON");
|
|
16571
|
+
}
|
|
16572
|
+
}
|
|
16487
16573
|
vacuumInto(backupPath) {
|
|
16488
16574
|
const quoted = backupPath.replace(/'/g, "''");
|
|
16489
16575
|
this.db.run(`VACUUM INTO '${quoted}'`);
|
|
@@ -16513,10 +16599,11 @@ function verifyBackupFile(backupPath) {
|
|
|
16513
16599
|
const missingTables = REQUIRED_TABLES.filter((table) => !tableExists(db, table));
|
|
16514
16600
|
const schemaVersion = missingTables.includes("schema_migrations") ? null : db.query("SELECT value FROM schema_migrations WHERE key = 'schema_version'").get()?.value ?? null;
|
|
16515
16601
|
const currentOk = missingTables.length === 0 && schemaVersion === CURRENT_SCHEMA_VERSION;
|
|
16602
|
+
const restorableV4 = schemaVersion === "4" && missingTables.length === 0;
|
|
16516
16603
|
const restorableV1 = schemaVersion === "1" && missingTables.every((table) => PROBE_TABLES.has(table) || REPORT_AUDIT_TABLES.has(table));
|
|
16517
16604
|
const restorableV2 = schemaVersion === "2" && missingTables.every((table) => REPORT_AUDIT_TABLES.has(table));
|
|
16518
16605
|
return {
|
|
16519
|
-
ok: integrity === "ok" && (currentOk || restorableV1 || restorableV2),
|
|
16606
|
+
ok: integrity === "ok" && (currentOk || restorableV4 || restorableV1 || restorableV2),
|
|
16520
16607
|
backupPath,
|
|
16521
16608
|
integrity,
|
|
16522
16609
|
schemaVersion,
|
|
@@ -16901,6 +16988,7 @@ function checkResultFromRow(row) {
|
|
|
16901
16988
|
}
|
|
16902
16989
|
function provenanceFromRow(row) {
|
|
16903
16990
|
return {
|
|
16991
|
+
workspaceId: row.workspace_id,
|
|
16904
16992
|
monitorId: row.monitor_id,
|
|
16905
16993
|
source: row.source,
|
|
16906
16994
|
sourceId: row.source_id,
|
|
@@ -16988,6 +17076,7 @@ function reportRunFromRow(row) {
|
|
|
16988
17076
|
function auditEventFromRow(row) {
|
|
16989
17077
|
return {
|
|
16990
17078
|
id: row.id,
|
|
17079
|
+
workspaceId: row.workspace_id,
|
|
16991
17080
|
action: row.action,
|
|
16992
17081
|
resourceType: row.resource_type,
|
|
16993
17082
|
resourceId: row.resource_id,
|
|
@@ -17349,12 +17438,18 @@ var MAX_PROBE_RESULT_FUTURE_MS = 5 * 60000;
|
|
|
17349
17438
|
class UptimeService {
|
|
17350
17439
|
store;
|
|
17351
17440
|
checkRunner;
|
|
17441
|
+
hostedResolveHost;
|
|
17442
|
+
hostedHttpRequest;
|
|
17443
|
+
hostedMaxRedirects;
|
|
17352
17444
|
leaseOwner = `svc_${randomUUID3().replace(/-/g, "").slice(0, 18)}`;
|
|
17353
17445
|
inFlightChecks = new Set;
|
|
17354
17446
|
inFlightReportSchedules = new Set;
|
|
17355
17447
|
constructor(options = {}) {
|
|
17356
17448
|
this.store = options.store ?? new UptimeStore({ mode: "local", ...options });
|
|
17357
17449
|
this.checkRunner = options.checkRunner ?? runMonitorCheck;
|
|
17450
|
+
this.hostedResolveHost = options.hostedResolveHost;
|
|
17451
|
+
this.hostedHttpRequest = options.hostedHttpRequest;
|
|
17452
|
+
this.hostedMaxRedirects = options.hostedMaxRedirects;
|
|
17358
17453
|
}
|
|
17359
17454
|
close() {
|
|
17360
17455
|
this.store.close();
|
|
@@ -17489,10 +17584,10 @@ class UptimeService {
|
|
|
17489
17584
|
return this.reportStore().listReportRuns(options);
|
|
17490
17585
|
}
|
|
17491
17586
|
listAuditEvents(options = {}) {
|
|
17492
|
-
return this.
|
|
17587
|
+
return this.auditStore().listAuditEvents(options);
|
|
17493
17588
|
}
|
|
17494
17589
|
recordAuditEvent(input) {
|
|
17495
|
-
return this.
|
|
17590
|
+
return this.auditStore().recordAuditEvent(input);
|
|
17496
17591
|
}
|
|
17497
17592
|
async runReportSchedule(idOrName, options = {}) {
|
|
17498
17593
|
const store = this.reportStore();
|
|
@@ -17561,39 +17656,7 @@ class UptimeService {
|
|
|
17561
17656
|
const monitor = this.store.getMonitor(idOrName);
|
|
17562
17657
|
if (!monitor)
|
|
17563
17658
|
throw new Error(`Monitor not found: ${idOrName}`);
|
|
17564
|
-
|
|
17565
|
-
throw new Error(`Monitor is disabled: ${monitor.name}`);
|
|
17566
|
-
if (this.inFlightChecks.has(monitor.id))
|
|
17567
|
-
throw new Error(`Monitor check already in progress: ${monitor.name}`);
|
|
17568
|
-
const leaseTtlMs = Math.max(60000, (monitor.retryCount + 1) * monitor.timeoutMs + 1e4);
|
|
17569
|
-
if (!this.store.acquireCheckLease(monitor.id, this.leaseOwner, leaseTtlMs)) {
|
|
17570
|
-
throw new MonitorCheckBusyError(`Monitor check already in progress: ${monitor.name}`);
|
|
17571
|
-
}
|
|
17572
|
-
this.inFlightChecks.add(monitor.id);
|
|
17573
|
-
try {
|
|
17574
|
-
let attemptCount = 0;
|
|
17575
|
-
let last = null;
|
|
17576
|
-
const maxAttempts = Math.max(1, monitor.retryCount + 1);
|
|
17577
|
-
while (attemptCount < maxAttempts) {
|
|
17578
|
-
attemptCount += 1;
|
|
17579
|
-
last = await this.checkRunner(monitor);
|
|
17580
|
-
if (last.status === "up")
|
|
17581
|
-
break;
|
|
17582
|
-
}
|
|
17583
|
-
return this.store.recordCheckResult({
|
|
17584
|
-
monitorId: monitor.id,
|
|
17585
|
-
status: last.status,
|
|
17586
|
-
latencyMs: last.latencyMs,
|
|
17587
|
-
statusCode: last.statusCode ?? null,
|
|
17588
|
-
error: last.error ?? null,
|
|
17589
|
-
evidence: last.evidence ?? null,
|
|
17590
|
-
attemptCount,
|
|
17591
|
-
expectedMonitorRevision: monitor.revision
|
|
17592
|
-
});
|
|
17593
|
-
} finally {
|
|
17594
|
-
this.inFlightChecks.delete(monitor.id);
|
|
17595
|
-
this.store.releaseCheckLease(monitor.id, this.leaseOwner);
|
|
17596
|
-
}
|
|
17659
|
+
return this.recordMonitorCheck(monitor, { hostedTargetPolicy: false });
|
|
17597
17660
|
}
|
|
17598
17661
|
async checkAll() {
|
|
17599
17662
|
if (this.store.mode === "hosted")
|
|
@@ -17605,6 +17668,49 @@ class UptimeService {
|
|
|
17605
17668
|
}
|
|
17606
17669
|
return results;
|
|
17607
17670
|
}
|
|
17671
|
+
async checkHostedPublicMonitor(idOrName, options = {}) {
|
|
17672
|
+
this.assertHostedPublicChecksEnabled();
|
|
17673
|
+
const workspaceId = this.requireHostedWorkerWorkspaceId(options.workspaceId);
|
|
17674
|
+
const monitor = this.store.getMonitor(idOrName, { workspaceId });
|
|
17675
|
+
if (!monitor)
|
|
17676
|
+
throw new Error(`Monitor not found: ${idOrName}`);
|
|
17677
|
+
this.assertHostedPublicMonitor(monitor);
|
|
17678
|
+
const result = await this.recordMonitorCheck(monitor, { hostedTargetPolicy: true });
|
|
17679
|
+
this.auditStore().recordAuditEvent({
|
|
17680
|
+
workspaceId,
|
|
17681
|
+
action: "hosted_public_check.run",
|
|
17682
|
+
resourceType: "monitor",
|
|
17683
|
+
resourceId: monitor.id,
|
|
17684
|
+
message: `Ran hosted public check for ${monitor.name}`,
|
|
17685
|
+
metadata: {
|
|
17686
|
+
checkResultId: result.id,
|
|
17687
|
+
status: result.status,
|
|
17688
|
+
monitorKind: monitor.kind,
|
|
17689
|
+
operatorPath: "hosted_public_check"
|
|
17690
|
+
},
|
|
17691
|
+
actor: "hosted-public-check-worker"
|
|
17692
|
+
});
|
|
17693
|
+
return result;
|
|
17694
|
+
}
|
|
17695
|
+
async runDueHostedPublicChecks(now = new Date, options = {}) {
|
|
17696
|
+
this.assertHostedPublicChecksEnabled();
|
|
17697
|
+
const workspaceId = this.requireHostedWorkerWorkspaceId(options.workspaceId);
|
|
17698
|
+
const due = this.store.listMonitors({ workspaceId }).filter((monitor) => this.isHostedPublicMonitor(monitor) && this.isDue(monitor, now));
|
|
17699
|
+
const results = [];
|
|
17700
|
+
for (const monitor of due) {
|
|
17701
|
+
const current = this.store.getMonitor(monitor.id, { workspaceId });
|
|
17702
|
+
if (!current || !this.isHostedPublicMonitor(current) || !this.isDue(current, now))
|
|
17703
|
+
continue;
|
|
17704
|
+
try {
|
|
17705
|
+
results.push(await this.checkHostedPublicMonitor(current.id, { workspaceId }));
|
|
17706
|
+
} catch (error51) {
|
|
17707
|
+
if (error51 instanceof MonitorCheckBusyError || error51 instanceof StaleCheckResultError)
|
|
17708
|
+
continue;
|
|
17709
|
+
throw error51;
|
|
17710
|
+
}
|
|
17711
|
+
}
|
|
17712
|
+
return results;
|
|
17713
|
+
}
|
|
17608
17714
|
startScheduler(options = {}) {
|
|
17609
17715
|
if (this.store.mode === "hosted")
|
|
17610
17716
|
throw new Error("hosted scheduler requires check_jobs and probes");
|
|
@@ -17650,6 +17756,67 @@ class UptimeService {
|
|
|
17650
17756
|
const last = new Date(monitor.lastCheckedAt).getTime();
|
|
17651
17757
|
return now.getTime() - last >= monitor.intervalSeconds * 1000;
|
|
17652
17758
|
}
|
|
17759
|
+
async recordMonitorCheck(monitor, options) {
|
|
17760
|
+
if (!monitor.enabled)
|
|
17761
|
+
throw new Error(`Monitor is disabled: ${monitor.name}`);
|
|
17762
|
+
if (this.inFlightChecks.has(monitor.id))
|
|
17763
|
+
throw new Error(`Monitor check already in progress: ${monitor.name}`);
|
|
17764
|
+
const leaseTtlMs = Math.max(60000, (monitor.retryCount + 1) * monitor.timeoutMs + 1e4);
|
|
17765
|
+
if (!this.store.acquireCheckLease(monitor.id, this.leaseOwner, leaseTtlMs)) {
|
|
17766
|
+
throw new MonitorCheckBusyError(`Monitor check already in progress: ${monitor.name}`);
|
|
17767
|
+
}
|
|
17768
|
+
this.inFlightChecks.add(monitor.id);
|
|
17769
|
+
try {
|
|
17770
|
+
let attemptCount = 0;
|
|
17771
|
+
let last = null;
|
|
17772
|
+
const maxAttempts = Math.max(1, monitor.retryCount + 1);
|
|
17773
|
+
while (attemptCount < maxAttempts) {
|
|
17774
|
+
attemptCount += 1;
|
|
17775
|
+
last = options.hostedTargetPolicy ? await this.runHostedPublicCheckAttempt(monitor) : await this.checkRunner(monitor);
|
|
17776
|
+
if (last.status === "up")
|
|
17777
|
+
break;
|
|
17778
|
+
}
|
|
17779
|
+
return this.store.recordCheckResult({
|
|
17780
|
+
monitorId: monitor.id,
|
|
17781
|
+
status: last.status,
|
|
17782
|
+
latencyMs: last.latencyMs,
|
|
17783
|
+
statusCode: last.statusCode ?? null,
|
|
17784
|
+
error: last.error ?? null,
|
|
17785
|
+
evidence: last.evidence ?? null,
|
|
17786
|
+
attemptCount,
|
|
17787
|
+
expectedMonitorRevision: monitor.revision
|
|
17788
|
+
});
|
|
17789
|
+
} finally {
|
|
17790
|
+
this.inFlightChecks.delete(monitor.id);
|
|
17791
|
+
this.store.releaseCheckLease(monitor.id, this.leaseOwner);
|
|
17792
|
+
}
|
|
17793
|
+
}
|
|
17794
|
+
runHostedPublicCheckAttempt(monitor) {
|
|
17795
|
+
return runMonitorCheck(monitor, {
|
|
17796
|
+
hostedTargetPolicy: true,
|
|
17797
|
+
resolveHost: this.hostedResolveHost,
|
|
17798
|
+
hostedHttpRequest: this.hostedHttpRequest,
|
|
17799
|
+
maxRedirects: this.hostedMaxRedirects
|
|
17800
|
+
});
|
|
17801
|
+
}
|
|
17802
|
+
assertHostedPublicChecksEnabled() {
|
|
17803
|
+
if (this.store.mode !== "hosted")
|
|
17804
|
+
throw new Error("hosted public checks require hosted mode");
|
|
17805
|
+
}
|
|
17806
|
+
requireHostedWorkerWorkspaceId(workspaceId) {
|
|
17807
|
+
const value = workspaceId?.trim() || process.env.HASNA_UPTIME_WORKSPACE_ID?.trim();
|
|
17808
|
+
if (!value)
|
|
17809
|
+
throw new Error("hosted public checks require a workspace id");
|
|
17810
|
+
return value;
|
|
17811
|
+
}
|
|
17812
|
+
assertHostedPublicMonitor(monitor) {
|
|
17813
|
+
if (!this.isHostedPublicMonitor(monitor)) {
|
|
17814
|
+
throw new Error("hosted public checks support only HTTP and TCP monitors");
|
|
17815
|
+
}
|
|
17816
|
+
}
|
|
17817
|
+
isHostedPublicMonitor(monitor) {
|
|
17818
|
+
return monitor.kind === "http" || monitor.kind === "tcp";
|
|
17819
|
+
}
|
|
17653
17820
|
probeStore() {
|
|
17654
17821
|
if (this.store.mode === "hosted") {
|
|
17655
17822
|
throw new Error("hosted probe APIs require cloud check_jobs, workspace stores, and audit logging");
|
|
@@ -17699,6 +17866,13 @@ class UptimeService {
|
|
|
17699
17866
|
}
|
|
17700
17867
|
return store;
|
|
17701
17868
|
}
|
|
17869
|
+
auditStore() {
|
|
17870
|
+
const store = this.store;
|
|
17871
|
+
if (typeof store.recordAuditEvent !== "function" || typeof store.listAuditEvents !== "function") {
|
|
17872
|
+
throw new Error("audit logging requires an audit-capable store");
|
|
17873
|
+
}
|
|
17874
|
+
return store;
|
|
17875
|
+
}
|
|
17702
17876
|
audit(action, resourceType, resourceId, message, metadata) {
|
|
17703
17877
|
this.reportStore().recordAuditEvent({
|
|
17704
17878
|
action,
|
package/dist/service.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type HostedDnsResolver, type HostedHttpRequestLike } from "./checks.js";
|
|
1
2
|
import { type ImportApplyResult, type ImportPreview, type ImportRequest, type ImportRollbackResult } from "./imports.js";
|
|
2
3
|
import { type MonitorProvenance, type SaveImportBatchInput, type StoredImportBatch, type UpsertMonitorProvenanceInput, type UptimeBackup, type UptimeBackupCheck, type UptimeStoreOptions } from "./store.js";
|
|
3
4
|
import { type BuildUptimeReportOptions, type SendUptimeReportOptions, type UptimeReport, type UptimeReportDelivery } from "./report.js";
|
|
@@ -5,6 +6,9 @@ import type { AuditEvent, CheckAttemptResult, CheckResult, CreateReportScheduleI
|
|
|
5
6
|
export interface UptimeServiceOptions extends UptimeStoreOptions {
|
|
6
7
|
store?: UptimeStoreLike;
|
|
7
8
|
checkRunner?: (monitor: Monitor) => Promise<CheckAttemptResult>;
|
|
9
|
+
hostedResolveHost?: HostedDnsResolver;
|
|
10
|
+
hostedHttpRequest?: HostedHttpRequestLike;
|
|
11
|
+
hostedMaxRedirects?: number;
|
|
8
12
|
}
|
|
9
13
|
export interface UptimeStoreLike {
|
|
10
14
|
readonly dbPath: string;
|
|
@@ -48,7 +52,9 @@ export interface UptimeStoreLike {
|
|
|
48
52
|
checkedAt?: string;
|
|
49
53
|
expectedMonitorRevision?: number;
|
|
50
54
|
}): CheckResult;
|
|
51
|
-
getProvenance(source: string, sourceId: string
|
|
55
|
+
getProvenance(source: string, sourceId: string, options?: {
|
|
56
|
+
workspaceId?: string;
|
|
57
|
+
}): MonitorProvenance | null;
|
|
52
58
|
upsertMonitorProvenance(input: UpsertMonitorProvenanceInput): MonitorProvenance;
|
|
53
59
|
saveImportBatch(input: SaveImportBatchInput): StoredImportBatch;
|
|
54
60
|
getImportBatch(batchId: string): StoredImportBatch | null;
|
|
@@ -115,6 +121,9 @@ export interface UptimeStoreLike {
|
|
|
115
121
|
export declare class UptimeService {
|
|
116
122
|
readonly store: UptimeStoreLike;
|
|
117
123
|
private readonly checkRunner;
|
|
124
|
+
private readonly hostedResolveHost?;
|
|
125
|
+
private readonly hostedHttpRequest?;
|
|
126
|
+
private readonly hostedMaxRedirects?;
|
|
118
127
|
private readonly leaseOwner;
|
|
119
128
|
private readonly inFlightChecks;
|
|
120
129
|
private readonly inFlightReportSchedules;
|
|
@@ -199,14 +208,27 @@ export declare class UptimeService {
|
|
|
199
208
|
}): Promise<ReportRun[]>;
|
|
200
209
|
checkMonitor(idOrName: string): Promise<CheckResult>;
|
|
201
210
|
checkAll(): Promise<CheckResult[]>;
|
|
211
|
+
checkHostedPublicMonitor(idOrName: string, options?: {
|
|
212
|
+
workspaceId?: string;
|
|
213
|
+
}): Promise<CheckResult>;
|
|
214
|
+
runDueHostedPublicChecks(now?: Date, options?: {
|
|
215
|
+
workspaceId?: string;
|
|
216
|
+
}): Promise<CheckResult[]>;
|
|
202
217
|
startScheduler(options?: {
|
|
203
218
|
tickMs?: number;
|
|
204
219
|
reportFetchImpl?: typeof fetch;
|
|
205
220
|
}): SchedulerHandle;
|
|
206
221
|
runDueChecks(now?: Date): Promise<CheckResult[]>;
|
|
207
222
|
private isDue;
|
|
223
|
+
private recordMonitorCheck;
|
|
224
|
+
private runHostedPublicCheckAttempt;
|
|
225
|
+
private assertHostedPublicChecksEnabled;
|
|
226
|
+
private requireHostedWorkerWorkspaceId;
|
|
227
|
+
private assertHostedPublicMonitor;
|
|
228
|
+
private isHostedPublicMonitor;
|
|
208
229
|
private probeStore;
|
|
209
230
|
private reportStore;
|
|
231
|
+
private auditStore;
|
|
210
232
|
private audit;
|
|
211
233
|
private submitProbeResultInTransaction;
|
|
212
234
|
}
|
package/dist/service.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgF,KAAK,iBAAiB,EAAE,KAAK,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAE/J,OAAO,EAA8C,KAAK,iBAAiB,EAAE,KAAK,aAAa,EAAE,KAAK,aAAa,EAAE,KAAK,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAErK,OAAO,EAAsC,KAAK,iBAAiB,EAAE,KAAK,oBAAoB,EAAE,KAAK,iBAAiB,EAAE,KAAK,4BAA4B,EAAE,KAAK,YAAY,EAAE,KAAK,iBAAiB,EAAE,KAAK,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAClP,OAAO,EAAuC,KAAK,wBAAwB,EAAE,KAAK,uBAAuB,EAAE,KAAK,YAAY,EAAE,KAAK,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAC7K,OAAO,KAAK,EACV,UAAU,EACV,kBAAkB,EAElB,WAAW,EACX,yBAAyB,EACzB,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,QAAQ,EACR,oBAAoB,EACpB,0BAA0B,EAC1B,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,EAClB,OAAO,EACP,aAAa,EACb,aAAa,EACb,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,EACrB,oBAAoB,EACpB,SAAS,EACT,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,yBAAyB,EACzB,aAAa,EACd,MAAM,YAAY,CAAC;AAKpB,MAAM,WAAW,oBAAqB,SAAQ,kBAAkB;IAC9D,KAAK,CAAC,E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