@hasna/uptime 0.1.21 → 0.1.23
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 +21 -0
- package/README.md +2 -1
- package/dist/api.d.ts +1 -0
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +161 -24
- 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 +162 -25
- package/dist/cloud-plan.js +1 -1
- 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 +163 -25
- package/dist/mcp/index.js +114 -18
- package/dist/service.d.ts +4 -1
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +114 -18
- 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 +3 -2
- package/docs/aws-runtime-security.md +2 -1
- package/docs/cloud-source-of-truth.md +3 -3
- 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/cli/index.js
CHANGED
|
@@ -2813,8 +2813,9 @@ async function runMonitorCheck(monitor, options = {}) {
|
|
|
2813
2813
|
}
|
|
2814
2814
|
if (monitor.kind === "browser_page")
|
|
2815
2815
|
return runBrowserPageCheck(monitor, { fetch: options.fetch, runner: options.browserPage });
|
|
2816
|
-
if (monitor.kind === "tcp")
|
|
2817
|
-
return runTcpCheck(monitor);
|
|
2816
|
+
if (monitor.kind === "tcp") {
|
|
2817
|
+
return options.hostedTargetPolicy ? runHostedTcpCheck(monitor, { resolveHost: options.resolveHost }) : runTcpCheck(monitor);
|
|
2818
|
+
}
|
|
2818
2819
|
return { status: "down", latencyMs: null, error: `unsupported monitor kind: ${monitor.kind ?? "unknown"}` };
|
|
2819
2820
|
}
|
|
2820
2821
|
async function runHttpCheck(monitor, fetchImpl = fetch) {
|
|
@@ -2926,9 +2927,30 @@ async function runHostedHttpCheck(monitor, options = {}) {
|
|
|
2926
2927
|
async function runTcpCheck(monitor) {
|
|
2927
2928
|
if (!monitor.host || !monitor.port)
|
|
2928
2929
|
return { status: "down", latencyMs: null, error: "missing host or port" };
|
|
2930
|
+
return runTcpSocket(monitor.host, monitor.port, monitor.timeoutMs);
|
|
2931
|
+
}
|
|
2932
|
+
async function runHostedTcpCheck(monitor, options = {}) {
|
|
2933
|
+
if (!monitor.host || !monitor.port)
|
|
2934
|
+
return { status: "down", latencyMs: null, error: "missing host or port" };
|
|
2935
|
+
const resolver = options.resolveHost ?? resolveHostedHost;
|
|
2936
|
+
try {
|
|
2937
|
+
const addresses = normalizeResolvedAddresses(await resolver(normalizeHostedHost(monitor.host)));
|
|
2938
|
+
assertHostedResolvedAddressesAllowed(monitor.host, addresses, "TCP resolved address");
|
|
2939
|
+
const address = addresses[0];
|
|
2940
|
+
return runTcpSocket(address.address, monitor.port, monitor.timeoutMs, address.family);
|
|
2941
|
+
} catch (error) {
|
|
2942
|
+
return {
|
|
2943
|
+
status: "down",
|
|
2944
|
+
latencyMs: null,
|
|
2945
|
+
statusCode: null,
|
|
2946
|
+
error: error instanceof Error ? error.message : String(error)
|
|
2947
|
+
};
|
|
2948
|
+
}
|
|
2949
|
+
}
|
|
2950
|
+
async function runTcpSocket(host, port, timeoutMs, family) {
|
|
2929
2951
|
const started = performance.now();
|
|
2930
2952
|
return new Promise((resolve) => {
|
|
2931
|
-
const socket = net2.createConnection({ host
|
|
2953
|
+
const socket = net2.createConnection({ host, port, timeout: timeoutMs, family });
|
|
2932
2954
|
let settled = false;
|
|
2933
2955
|
const finish = (result) => {
|
|
2934
2956
|
if (settled)
|
|
@@ -3344,7 +3366,7 @@ function previewRecord(store, source, record, defaults, options) {
|
|
|
3344
3366
|
};
|
|
3345
3367
|
}
|
|
3346
3368
|
const monitorOptions = options.workspaceId ? { workspaceId: options.workspaceId } : undefined;
|
|
3347
|
-
const rawProvenance = store.getProvenance(candidate.source, candidate.sourceId);
|
|
3369
|
+
const rawProvenance = store.getProvenance(candidate.source, candidate.sourceId, monitorOptions);
|
|
3348
3370
|
const provenanceMonitor = rawProvenance ? store.getMonitor(rawProvenance.monitorId, monitorOptions) : null;
|
|
3349
3371
|
const provenance = provenanceMonitor ? rawProvenance : null;
|
|
3350
3372
|
const monitor = provenanceMonitor ?? store.getMonitor(candidate.name, monitorOptions);
|
|
@@ -3816,7 +3838,7 @@ var REQUIRED_TABLES = [
|
|
|
3816
3838
|
];
|
|
3817
3839
|
var PROBE_TABLES = new Set(["probe_identities", "probe_check_jobs", "probe_submissions"]);
|
|
3818
3840
|
var REPORT_AUDIT_TABLES = new Set(["report_schedules", "report_runs", "audit_events"]);
|
|
3819
|
-
var CURRENT_SCHEMA_VERSION = "
|
|
3841
|
+
var CURRENT_SCHEMA_VERSION = "5";
|
|
3820
3842
|
|
|
3821
3843
|
class StaleCheckResultError extends Error {
|
|
3822
3844
|
constructor(message) {
|
|
@@ -3929,15 +3951,17 @@ class UptimeStore {
|
|
|
3929
3951
|
`);
|
|
3930
3952
|
this.db.run(`
|
|
3931
3953
|
CREATE TABLE IF NOT EXISTS monitor_provenance (
|
|
3954
|
+
workspace_id TEXT NOT NULL DEFAULT 'local',
|
|
3932
3955
|
monitor_id TEXT NOT NULL REFERENCES monitors(id) ON DELETE CASCADE,
|
|
3933
3956
|
source TEXT NOT NULL,
|
|
3934
3957
|
source_id TEXT NOT NULL,
|
|
3935
3958
|
source_label TEXT,
|
|
3936
3959
|
imported_at TEXT NOT NULL,
|
|
3937
3960
|
snapshot_json TEXT NOT NULL,
|
|
3938
|
-
PRIMARY KEY (source, source_id)
|
|
3961
|
+
PRIMARY KEY (workspace_id, source, source_id)
|
|
3939
3962
|
)
|
|
3940
3963
|
`);
|
|
3964
|
+
this.ensureMonitorProvenanceWorkspaceScoped();
|
|
3941
3965
|
this.db.run(`
|
|
3942
3966
|
CREATE TABLE IF NOT EXISTS import_batches (
|
|
3943
3967
|
id TEXT PRIMARY KEY,
|
|
@@ -4029,6 +4053,7 @@ class UptimeStore {
|
|
|
4029
4053
|
this.db.run(`
|
|
4030
4054
|
CREATE TABLE IF NOT EXISTS audit_events (
|
|
4031
4055
|
id TEXT PRIMARY KEY,
|
|
4056
|
+
workspace_id TEXT,
|
|
4032
4057
|
action TEXT NOT NULL,
|
|
4033
4058
|
resource_type TEXT,
|
|
4034
4059
|
resource_id TEXT,
|
|
@@ -4038,6 +4063,7 @@ class UptimeStore {
|
|
|
4038
4063
|
created_at TEXT NOT NULL
|
|
4039
4064
|
)
|
|
4040
4065
|
`);
|
|
4066
|
+
this.ensureColumn("audit_events", "workspace_id", "TEXT");
|
|
4041
4067
|
this.db.run(`
|
|
4042
4068
|
CREATE TABLE IF NOT EXISTS schema_migrations (
|
|
4043
4069
|
key TEXT PRIMARY KEY,
|
|
@@ -4051,6 +4077,7 @@ class UptimeStore {
|
|
|
4051
4077
|
this.db.run("CREATE INDEX IF NOT EXISTS idx_incidents_monitor_status ON incidents(monitor_id, status)");
|
|
4052
4078
|
this.db.run("CREATE INDEX IF NOT EXISTS idx_check_leases_until ON check_leases(leased_until)");
|
|
4053
4079
|
this.db.run("CREATE INDEX IF NOT EXISTS idx_monitor_provenance_monitor ON monitor_provenance(monitor_id)");
|
|
4080
|
+
this.db.run("CREATE INDEX IF NOT EXISTS idx_monitor_provenance_workspace_source ON monitor_provenance(workspace_id, source, source_id)");
|
|
4054
4081
|
this.db.run("CREATE INDEX IF NOT EXISTS idx_probe_jobs_status_due ON probe_check_jobs(status, due_at)");
|
|
4055
4082
|
this.db.run("CREATE INDEX IF NOT EXISTS idx_probe_jobs_probe_status ON probe_check_jobs(claimed_by_probe_id, status)");
|
|
4056
4083
|
this.db.run("CREATE INDEX IF NOT EXISTS idx_probe_submissions_probe_time ON probe_submissions(probe_id, submitted_at DESC)");
|
|
@@ -4059,6 +4086,7 @@ class UptimeStore {
|
|
|
4059
4086
|
this.db.run("CREATE INDEX IF NOT EXISTS idx_report_schedules_due ON report_schedules(enabled, next_run_at)");
|
|
4060
4087
|
this.db.run("CREATE INDEX IF NOT EXISTS idx_report_runs_schedule_time ON report_runs(schedule_id, started_at DESC)");
|
|
4061
4088
|
this.db.run("CREATE INDEX IF NOT EXISTS idx_audit_events_resource_time ON audit_events(resource_type, resource_id, created_at DESC)");
|
|
4089
|
+
this.db.run("CREATE INDEX IF NOT EXISTS idx_audit_events_workspace_time ON audit_events(workspace_id, created_at DESC)");
|
|
4062
4090
|
this.db.run("CREATE INDEX IF NOT EXISTS idx_audit_events_time ON audit_events(created_at DESC)");
|
|
4063
4091
|
}
|
|
4064
4092
|
backup(destinationPath) {
|
|
@@ -4108,6 +4136,9 @@ class UptimeStore {
|
|
|
4108
4136
|
const normalized = normalizeCreateMonitor(input, options.allowBrowserPage === true);
|
|
4109
4137
|
if (this.mode === "hosted")
|
|
4110
4138
|
assertHostedTargetAllowed(normalized);
|
|
4139
|
+
if (this.mode === "hosted" && normalized.kind === "browser_page" && normalized.enabled !== false) {
|
|
4140
|
+
throw new Error("hosted browser_page monitors must remain disabled until browser evidence workers are configured");
|
|
4141
|
+
}
|
|
4111
4142
|
const now = new Date().toISOString();
|
|
4112
4143
|
const workspaceId = normalizeWorkspaceId(options.workspaceId ?? input.workspaceId ?? "local");
|
|
4113
4144
|
const monitor = {
|
|
@@ -4172,6 +4203,9 @@ class UptimeStore {
|
|
|
4172
4203
|
const next = normalizeUpdateMonitor(current, input, updatedAt, options.allowBrowserPage === true);
|
|
4173
4204
|
if (this.mode === "hosted")
|
|
4174
4205
|
assertHostedTargetAllowed(next);
|
|
4206
|
+
if (this.mode === "hosted" && next.kind === "browser_page" && next.enabled) {
|
|
4207
|
+
throw new Error("hosted browser_page monitors must remain disabled until browser evidence workers are configured");
|
|
4208
|
+
}
|
|
4175
4209
|
this.db.query(`UPDATE monitors SET
|
|
4176
4210
|
name = ?, kind = ?, url = ?, host = ?, port = ?, method = ?,
|
|
4177
4211
|
expected_status = ?, interval_seconds = ?, timeout_ms = ?,
|
|
@@ -4468,8 +4502,10 @@ class UptimeStore {
|
|
|
4468
4502
|
const action = normalizeAuditText(input.action, "Audit action", 160);
|
|
4469
4503
|
const createdAt = input.createdAt ?? new Date().toISOString();
|
|
4470
4504
|
assertIsoTimestamp(createdAt, "Audit event createdAt");
|
|
4505
|
+
const workspaceId = input.workspaceId == null ? null : normalizeWorkspaceId(input.workspaceId);
|
|
4471
4506
|
const event = {
|
|
4472
4507
|
id: newId("aud"),
|
|
4508
|
+
workspaceId,
|
|
4473
4509
|
action,
|
|
4474
4510
|
resourceType: normalizeNullableAuditText(input.resourceType, "Audit resourceType", 80),
|
|
4475
4511
|
resourceId: normalizeNullableAuditText(input.resourceId, "Audit resourceId", 160),
|
|
@@ -4479,13 +4515,17 @@ class UptimeStore {
|
|
|
4479
4515
|
createdAt
|
|
4480
4516
|
};
|
|
4481
4517
|
this.db.query(`INSERT INTO audit_events (
|
|
4482
|
-
id, action, resource_type, resource_id, message, metadata_json, actor, created_at
|
|
4483
|
-
) VALUES (?, ?, ?, ?, ?, ?, ?, ?)`).run(event.id, event.action, event.resourceType, event.resourceId, event.message, JSON.stringify(event.metadata), event.actor, event.createdAt);
|
|
4518
|
+
id, workspace_id, action, resource_type, resource_id, message, metadata_json, actor, created_at
|
|
4519
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(event.id, event.workspaceId, event.action, event.resourceType, event.resourceId, event.message, JSON.stringify(event.metadata), event.actor, event.createdAt);
|
|
4484
4520
|
return event;
|
|
4485
4521
|
}
|
|
4486
4522
|
listAuditEvents(options = {}) {
|
|
4487
4523
|
const clauses = [];
|
|
4488
4524
|
const args = [];
|
|
4525
|
+
if (options.workspaceId) {
|
|
4526
|
+
clauses.push("workspace_id = ?");
|
|
4527
|
+
args.push(normalizeWorkspaceId(options.workspaceId));
|
|
4528
|
+
}
|
|
4489
4529
|
if (options.resourceType) {
|
|
4490
4530
|
clauses.push("resource_type = ?");
|
|
4491
4531
|
args.push(options.resourceType);
|
|
@@ -4577,21 +4617,24 @@ class UptimeStore {
|
|
|
4577
4617
|
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);
|
|
4578
4618
|
return rows.map(checkResultFromRow);
|
|
4579
4619
|
}
|
|
4580
|
-
getProvenance(source, sourceId) {
|
|
4581
|
-
const
|
|
4620
|
+
getProvenance(source, sourceId, options = {}) {
|
|
4621
|
+
const workspaceId = options.workspaceId ? normalizeWorkspaceId(options.workspaceId) : undefined;
|
|
4622
|
+
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);
|
|
4582
4623
|
return row ? provenanceFromRow(row) : null;
|
|
4583
4624
|
}
|
|
4584
4625
|
upsertMonitorProvenance(input) {
|
|
4585
4626
|
const importedAt = new Date().toISOString();
|
|
4627
|
+
const monitor = this.getMonitor(input.monitorId);
|
|
4628
|
+
const workspaceId = normalizeWorkspaceId(input.workspaceId ?? monitor?.workspaceId ?? "local");
|
|
4586
4629
|
this.db.query(`INSERT INTO monitor_provenance (
|
|
4587
|
-
monitor_id, source, source_id, source_label, imported_at, snapshot_json
|
|
4588
|
-
) VALUES (?, ?, ?, ?, ?, ?)
|
|
4589
|
-
ON CONFLICT(source, source_id) DO UPDATE SET
|
|
4630
|
+
workspace_id, monitor_id, source, source_id, source_label, imported_at, snapshot_json
|
|
4631
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
4632
|
+
ON CONFLICT(workspace_id, source, source_id) DO UPDATE SET
|
|
4590
4633
|
monitor_id = excluded.monitor_id,
|
|
4591
4634
|
source_label = excluded.source_label,
|
|
4592
4635
|
imported_at = excluded.imported_at,
|
|
4593
|
-
snapshot_json = excluded.snapshot_json`).run(input.monitorId, input.source, input.sourceId, input.sourceLabel ?? null, importedAt, JSON.stringify(input.snapshot));
|
|
4594
|
-
return this.getProvenance(input.source, input.sourceId);
|
|
4636
|
+
snapshot_json = excluded.snapshot_json`).run(workspaceId, input.monitorId, input.source, input.sourceId, input.sourceLabel ?? null, importedAt, JSON.stringify(input.snapshot));
|
|
4637
|
+
return this.getProvenance(input.source, input.sourceId, { workspaceId });
|
|
4595
4638
|
}
|
|
4596
4639
|
saveImportBatch(input) {
|
|
4597
4640
|
const createdAt = new Date().toISOString();
|
|
@@ -4774,6 +4817,49 @@ class UptimeStore {
|
|
|
4774
4817
|
this.db.run("PRAGMA foreign_keys = ON");
|
|
4775
4818
|
}
|
|
4776
4819
|
}
|
|
4820
|
+
ensureMonitorProvenanceWorkspaceScoped() {
|
|
4821
|
+
const row = this.db.query("SELECT sql FROM sqlite_master WHERE type = 'table' AND name = 'monitor_provenance'").get();
|
|
4822
|
+
const columns = this.db.query("PRAGMA table_info(monitor_provenance)").all();
|
|
4823
|
+
const hasWorkspaceId = columns.some((column) => column.name === "workspace_id");
|
|
4824
|
+
const hasWorkspacePrimaryKey = Boolean(row?.sql?.includes("PRIMARY KEY (workspace_id, source, source_id)"));
|
|
4825
|
+
if (hasWorkspaceId && hasWorkspacePrimaryKey)
|
|
4826
|
+
return;
|
|
4827
|
+
this.db.run("PRAGMA foreign_keys = OFF");
|
|
4828
|
+
this.db.run("PRAGMA legacy_alter_table = ON");
|
|
4829
|
+
try {
|
|
4830
|
+
const migrate = this.db.transaction(() => {
|
|
4831
|
+
this.db.run("ALTER TABLE monitor_provenance RENAME TO monitor_provenance_old_workspace");
|
|
4832
|
+
this.db.run(`
|
|
4833
|
+
CREATE TABLE monitor_provenance (
|
|
4834
|
+
workspace_id TEXT NOT NULL DEFAULT 'local',
|
|
4835
|
+
monitor_id TEXT NOT NULL REFERENCES monitors(id) ON DELETE CASCADE,
|
|
4836
|
+
source TEXT NOT NULL,
|
|
4837
|
+
source_id TEXT NOT NULL,
|
|
4838
|
+
source_label TEXT,
|
|
4839
|
+
imported_at TEXT NOT NULL,
|
|
4840
|
+
snapshot_json TEXT NOT NULL,
|
|
4841
|
+
PRIMARY KEY (workspace_id, source, source_id)
|
|
4842
|
+
)
|
|
4843
|
+
`);
|
|
4844
|
+
const workspaceSelect = hasWorkspaceId ? "COALESCE(old.workspace_id, monitors.workspace_id, 'local')" : "COALESCE(monitors.workspace_id, 'local')";
|
|
4845
|
+
this.db.run(`
|
|
4846
|
+
INSERT OR REPLACE INTO monitor_provenance (
|
|
4847
|
+
workspace_id, monitor_id, source, source_id, source_label, imported_at, snapshot_json
|
|
4848
|
+
)
|
|
4849
|
+
SELECT
|
|
4850
|
+
${workspaceSelect}, old.monitor_id, old.source, old.source_id, old.source_label,
|
|
4851
|
+
old.imported_at, old.snapshot_json
|
|
4852
|
+
FROM monitor_provenance_old_workspace old
|
|
4853
|
+
LEFT JOIN monitors ON monitors.id = old.monitor_id
|
|
4854
|
+
`);
|
|
4855
|
+
this.db.run("DROP TABLE monitor_provenance_old_workspace");
|
|
4856
|
+
});
|
|
4857
|
+
migrate();
|
|
4858
|
+
} finally {
|
|
4859
|
+
this.db.run("PRAGMA legacy_alter_table = OFF");
|
|
4860
|
+
this.db.run("PRAGMA foreign_keys = ON");
|
|
4861
|
+
}
|
|
4862
|
+
}
|
|
4777
4863
|
vacuumInto(backupPath) {
|
|
4778
4864
|
const quoted = backupPath.replace(/'/g, "''");
|
|
4779
4865
|
this.db.run(`VACUUM INTO '${quoted}'`);
|
|
@@ -4803,10 +4889,11 @@ function verifyBackupFile(backupPath) {
|
|
|
4803
4889
|
const missingTables = REQUIRED_TABLES.filter((table) => !tableExists(db, table));
|
|
4804
4890
|
const schemaVersion = missingTables.includes("schema_migrations") ? null : db.query("SELECT value FROM schema_migrations WHERE key = 'schema_version'").get()?.value ?? null;
|
|
4805
4891
|
const currentOk = missingTables.length === 0 && schemaVersion === CURRENT_SCHEMA_VERSION;
|
|
4892
|
+
const restorableV4 = schemaVersion === "4" && missingTables.length === 0;
|
|
4806
4893
|
const restorableV1 = schemaVersion === "1" && missingTables.every((table) => PROBE_TABLES.has(table) || REPORT_AUDIT_TABLES.has(table));
|
|
4807
4894
|
const restorableV2 = schemaVersion === "2" && missingTables.every((table) => REPORT_AUDIT_TABLES.has(table));
|
|
4808
4895
|
return {
|
|
4809
|
-
ok: integrity === "ok" && (currentOk || restorableV1 || restorableV2),
|
|
4896
|
+
ok: integrity === "ok" && (currentOk || restorableV4 || restorableV1 || restorableV2),
|
|
4810
4897
|
backupPath,
|
|
4811
4898
|
integrity,
|
|
4812
4899
|
schemaVersion,
|
|
@@ -5191,6 +5278,7 @@ function checkResultFromRow(row) {
|
|
|
5191
5278
|
}
|
|
5192
5279
|
function provenanceFromRow(row) {
|
|
5193
5280
|
return {
|
|
5281
|
+
workspaceId: row.workspace_id,
|
|
5194
5282
|
monitorId: row.monitor_id,
|
|
5195
5283
|
source: row.source,
|
|
5196
5284
|
sourceId: row.source_id,
|
|
@@ -5278,6 +5366,7 @@ function reportRunFromRow(row) {
|
|
|
5278
5366
|
function auditEventFromRow(row) {
|
|
5279
5367
|
return {
|
|
5280
5368
|
id: row.id,
|
|
5369
|
+
workspaceId: row.workspace_id,
|
|
5281
5370
|
action: row.action,
|
|
5282
5371
|
resourceType: row.resource_type,
|
|
5283
5372
|
resourceId: row.resource_id,
|
|
@@ -5779,10 +5868,10 @@ class UptimeService {
|
|
|
5779
5868
|
return this.reportStore().listReportRuns(options);
|
|
5780
5869
|
}
|
|
5781
5870
|
listAuditEvents(options = {}) {
|
|
5782
|
-
return this.
|
|
5871
|
+
return this.auditStore().listAuditEvents(options);
|
|
5783
5872
|
}
|
|
5784
5873
|
recordAuditEvent(input) {
|
|
5785
|
-
return this.
|
|
5874
|
+
return this.auditStore().recordAuditEvent(input);
|
|
5786
5875
|
}
|
|
5787
5876
|
async runReportSchedule(idOrName, options = {}) {
|
|
5788
5877
|
const store = this.reportStore();
|
|
@@ -5989,6 +6078,13 @@ class UptimeService {
|
|
|
5989
6078
|
}
|
|
5990
6079
|
return store;
|
|
5991
6080
|
}
|
|
6081
|
+
auditStore() {
|
|
6082
|
+
const store = this.store;
|
|
6083
|
+
if (typeof store.recordAuditEvent !== "function" || typeof store.listAuditEvents !== "function") {
|
|
6084
|
+
throw new Error("audit logging requires an audit-capable store");
|
|
6085
|
+
}
|
|
6086
|
+
return store;
|
|
6087
|
+
}
|
|
5992
6088
|
audit(action, resourceType, resourceId, message, metadata) {
|
|
5993
6089
|
this.reportStore().recordAuditEvent({
|
|
5994
6090
|
action,
|
|
@@ -6712,7 +6808,10 @@ async function handleApiRoute(service, request, url, apiPath, options, hosted, a
|
|
|
6712
6808
|
return json(service.listMonitors({ includeDisabled: url.searchParams.get("includeDisabled") === "true", workspaceId: actor?.workspaceId }));
|
|
6713
6809
|
}
|
|
6714
6810
|
if (request.method === "POST" && apiPath === "/api/monitors") {
|
|
6715
|
-
|
|
6811
|
+
const monitor = service.createMonitor(await jsonBody(request), { workspaceId: actor?.workspaceId });
|
|
6812
|
+
if (hosted && actor)
|
|
6813
|
+
recordHostedMonitorAudit(service, actor, "monitor.create", monitor, { method: request.method, apiPath });
|
|
6814
|
+
return json(monitor, 201);
|
|
6716
6815
|
}
|
|
6717
6816
|
if (request.method === "GET" && apiPath === "/api/incidents") {
|
|
6718
6817
|
const status = url.searchParams.get("status");
|
|
@@ -6789,10 +6888,25 @@ async function handleApiRoute(service, request, url, apiPath, options, hosted, a
|
|
|
6789
6888
|
return monitor ? json(monitor) : json({ error: "not found" }, 404);
|
|
6790
6889
|
}
|
|
6791
6890
|
if (request.method === "PATCH" && !monitorMatch[2]) {
|
|
6792
|
-
|
|
6891
|
+
const before = hosted ? service.getMonitor(id, { workspaceId: actor?.workspaceId }) : null;
|
|
6892
|
+
const monitor = service.updateMonitor(id, await jsonBody(request), { workspaceId: actor?.workspaceId });
|
|
6893
|
+
if (hosted && actor) {
|
|
6894
|
+
recordHostedMonitorAudit(service, actor, "monitor.update", monitor, {
|
|
6895
|
+
method: request.method,
|
|
6896
|
+
apiPath,
|
|
6897
|
+
previousRevision: before?.revision ?? null,
|
|
6898
|
+
nextRevision: monitor.revision
|
|
6899
|
+
});
|
|
6900
|
+
}
|
|
6901
|
+
return json(monitor);
|
|
6793
6902
|
}
|
|
6794
6903
|
if (request.method === "DELETE" && !monitorMatch[2]) {
|
|
6795
|
-
|
|
6904
|
+
const before = hosted ? service.getMonitor(id, { workspaceId: actor?.workspaceId }) : null;
|
|
6905
|
+
const deleted = service.deleteMonitor(id, { workspaceId: actor?.workspaceId });
|
|
6906
|
+
if (hosted && actor && deleted && before) {
|
|
6907
|
+
recordHostedMonitorAudit(service, actor, "monitor.delete", before, { method: request.method, apiPath });
|
|
6908
|
+
}
|
|
6909
|
+
return json({ deleted });
|
|
6796
6910
|
}
|
|
6797
6911
|
if (request.method === "POST" && monitorMatch[2] === "check") {
|
|
6798
6912
|
if (hosted)
|
|
@@ -6836,7 +6950,29 @@ function requireHostedActor(request, url, options, scope) {
|
|
|
6836
6950
|
if (requestedWorkspace && requestedWorkspace !== workspaceId) {
|
|
6837
6951
|
throw new ApiError("workspace access denied", 403);
|
|
6838
6952
|
}
|
|
6839
|
-
return {
|
|
6953
|
+
return {
|
|
6954
|
+
scopes,
|
|
6955
|
+
workspaceId,
|
|
6956
|
+
actor: token.actor ?? `hosted-token:${workspaceId}:${[...scopes].sort().join(",")}`
|
|
6957
|
+
};
|
|
6958
|
+
}
|
|
6959
|
+
function recordHostedMonitorAudit(service, actor, action, monitor, metadata) {
|
|
6960
|
+
service.recordAuditEvent({
|
|
6961
|
+
workspaceId: actor.workspaceId,
|
|
6962
|
+
action,
|
|
6963
|
+
actor: actor.actor,
|
|
6964
|
+
resourceType: "monitor",
|
|
6965
|
+
resourceId: monitor.id,
|
|
6966
|
+
metadata: {
|
|
6967
|
+
...metadata,
|
|
6968
|
+
monitorName: monitor.name,
|
|
6969
|
+
monitorKind: monitor.kind,
|
|
6970
|
+
monitorEnabled: monitor.enabled,
|
|
6971
|
+
monitorRevision: monitor.revision,
|
|
6972
|
+
workspaceId: monitor.workspaceId,
|
|
6973
|
+
scopes: [...actor.scopes].sort()
|
|
6974
|
+
}
|
|
6975
|
+
});
|
|
6840
6976
|
}
|
|
6841
6977
|
function isLoopbackHost(hostname) {
|
|
6842
6978
|
const host = hostname.toLowerCase().replace(/^\[|\]$/g, "");
|
|
@@ -6880,7 +7016,7 @@ function parseHostedTokenValue(value, defaultWorkspaceId, source) {
|
|
|
6880
7016
|
return parseHostedTokensConfig(trimmed, defaultWorkspaceId, source);
|
|
6881
7017
|
}
|
|
6882
7018
|
if (isHostedProductionMode()) {
|
|
6883
|
-
throw new ApiError(`${source} must be scoped hosted token JSON when
|
|
7019
|
+
throw new ApiError(`${source} must be scoped hosted token JSON when hosted auth mode or NODE_ENV is production`, 500);
|
|
6884
7020
|
}
|
|
6885
7021
|
return [{
|
|
6886
7022
|
token: trimmed,
|
|
@@ -6914,7 +7050,8 @@ function normalizeHostedTokenEntry(entry, defaultWorkspaceId, source) {
|
|
|
6914
7050
|
}
|
|
6915
7051
|
const scopes = normalizeHostedScopes(entry.scopes, `${source}.scopes`);
|
|
6916
7052
|
const workspaceId = typeof entry.workspaceId === "string" && entry.workspaceId.trim() ? entry.workspaceId.trim() : defaultWorkspaceId;
|
|
6917
|
-
|
|
7053
|
+
const actor = typeof entry.actor === "string" && entry.actor.trim() ? entry.actor.trim() : typeof entry.subject === "string" && entry.subject.trim() ? entry.subject.trim() : typeof entry.id === "string" && entry.id.trim() ? entry.id.trim() : undefined;
|
|
7054
|
+
return { token: entry.token.trim(), scopes, workspaceId, actor };
|
|
6918
7055
|
}
|
|
6919
7056
|
function normalizeHostedScopes(value, source) {
|
|
6920
7057
|
if (!Array.isArray(value) || value.length === 0) {
|
|
@@ -7014,7 +7151,7 @@ function buildAwsDeploymentPlan(options = {}) {
|
|
|
7014
7151
|
const image = clean(options.image, `${imageRepositoryUri}@sha256:<image-digest>`);
|
|
7015
7152
|
const evidenceBucket = clean(options.evidenceBucket, `hasna-${stage}-${prefix}-evidence`);
|
|
7016
7153
|
const hostedSqliteDbPath = clean(options.hostedSqliteDbPath, DEFAULT_HOSTED_SQLITE_DB);
|
|
7017
|
-
const runtimePackageVersion = clean(options.runtimePackageVersion, "0.1.
|
|
7154
|
+
const runtimePackageVersion = clean(options.runtimePackageVersion, "0.1.23");
|
|
7018
7155
|
const protectedAccessMode = options.protectedAccessMode ?? DEFAULT_PROTECTED_ACCESS_MODE;
|
|
7019
7156
|
const protectedAccessUrl = protectedAccessMode === "cloudfront_default_domain" ? "https://<cloudfront-domain>" : `https://${hostname}`;
|
|
7020
7157
|
const cluster = `${prefix}-${stage}`;
|
package/dist/cloud-plan.js
CHANGED
|
@@ -21,7 +21,7 @@ function buildAwsDeploymentPlan(options = {}) {
|
|
|
21
21
|
const image = clean(options.image, `${imageRepositoryUri}@sha256:<image-digest>`);
|
|
22
22
|
const evidenceBucket = clean(options.evidenceBucket, `hasna-${stage}-${prefix}-evidence`);
|
|
23
23
|
const hostedSqliteDbPath = clean(options.hostedSqliteDbPath, DEFAULT_HOSTED_SQLITE_DB);
|
|
24
|
-
const runtimePackageVersion = clean(options.runtimePackageVersion, "0.1.
|
|
24
|
+
const runtimePackageVersion = clean(options.runtimePackageVersion, "0.1.23");
|
|
25
25
|
const protectedAccessMode = options.protectedAccessMode ?? DEFAULT_PROTECTED_ACCESS_MODE;
|
|
26
26
|
const protectedAccessUrl = protectedAccessMode === "cloudfront_default_domain" ? "https://<cloudfront-domain>" : `https://${hostname}`;
|
|
27
27
|
const cluster = `${prefix}-${stage}`;
|
package/dist/imports.d.ts
CHANGED
|
@@ -66,16 +66,20 @@ export interface UptimeImportStore {
|
|
|
66
66
|
readonly mode: "local" | "hosted";
|
|
67
67
|
createMonitor(input: ImportedMonitorInput, options?: {
|
|
68
68
|
allowBrowserPage?: boolean;
|
|
69
|
+
workspaceId?: string;
|
|
69
70
|
}): Monitor;
|
|
70
71
|
updateMonitor(idOrName: string, input: ImportedUpdateMonitorInput, options?: {
|
|
71
72
|
allowBrowserPage?: boolean;
|
|
73
|
+
workspaceId?: string;
|
|
72
74
|
}): Monitor;
|
|
73
75
|
deleteMonitor(idOrName: string): boolean;
|
|
74
76
|
getMonitor(idOrName: string, options?: {
|
|
75
77
|
workspaceId?: string;
|
|
76
78
|
}): Monitor | null;
|
|
77
79
|
listResults(options?: ListResultsOptions): unknown[];
|
|
78
|
-
getProvenance(source: string, sourceId: string
|
|
80
|
+
getProvenance(source: string, sourceId: string, options?: {
|
|
81
|
+
workspaceId?: string;
|
|
82
|
+
}): MonitorProvenance | null;
|
|
79
83
|
upsertMonitorProvenance(input: UpsertMonitorProvenanceInput): MonitorProvenance;
|
|
80
84
|
saveImportBatch(input: {
|
|
81
85
|
id: string;
|
package/dist/imports.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imports.d.ts","sourceRoot":"","sources":["../src/imports.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,4BAA4B,EAAE,MAAM,YAAY,CAAC;AACrG,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,kBAAkB,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEjJ,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,GAAG,YAAY,CAAC;AACxF,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,QAAQ,GAAG,WAAW,GAAG,SAAS,GAAG,UAAU,CAAC;AAEtF,MAAM,WAAW,aAAa;IA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@@ function previewRecord(store, source, record, defaults, options) {
|
|
|
326
326
|
};
|
|
327
327
|
}
|
|
328
328
|
const monitorOptions = options.workspaceId ? { workspaceId: options.workspaceId } : undefined;
|
|
329
|
-
const rawProvenance = store.getProvenance(candidate.source, candidate.sourceId);
|
|
329
|
+
const rawProvenance = store.getProvenance(candidate.source, candidate.sourceId, monitorOptions);
|
|
330
330
|
const provenanceMonitor = rawProvenance ? store.getMonitor(rawProvenance.monitorId, monitorOptions) : null;
|
|
331
331
|
const provenance = provenanceMonitor ? rawProvenance : null;
|
|
332
332
|
const monitor = provenanceMonitor ?? store.getMonitor(candidate.name, monitorOptions);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { createUptimeClient, UptimeService } from "./service.js";
|
|
2
2
|
export { UptimeStore } from "./store.js";
|
|
3
|
-
export { isBrowserPageEvidence, isHttpTargetPolicyEvidence, normalizeHttpTargetPolicyEvidence, runBrowserPageCheck, runHostedHttpCheck, runMonitorCheck, runHttpCheck, runTcpCheck, } from "./checks.js";
|
|
3
|
+
export { isBrowserPageEvidence, isHttpTargetPolicyEvidence, normalizeHttpTargetPolicyEvidence, runBrowserPageCheck, runHostedHttpCheck, runHostedTcpCheck, runMonitorCheck, runHttpCheck, runTcpCheck, } from "./checks.js";
|
|
4
4
|
export { createApiHandler, serveUptime } from "./api.js";
|
|
5
5
|
export { applyImport, previewImport, rollbackImport } from "./imports.js";
|
|
6
6
|
export { buildUptimeReport, sendUptimeReport } from "./report.js";
|
|
@@ -8,7 +8,7 @@ export { generateProbeKeyPair, probePublicKeyFingerprint, probeResultSigningPayl
|
|
|
8
8
|
export { buildAwsDeploymentPlan, buildPrivateProbeCloudConfig, renderPrivateProbeEnv } from "./cloud-plan.js";
|
|
9
9
|
export { uptimeHome, uptimeDbPath, uptimeHostedFallbackDbPath, ensureUptimeHome } from "./paths.js";
|
|
10
10
|
export type { UptimeBackup, UptimeBackupCheck, UptimeRuntimeMode, UptimeStoreOptions, MonitorProvenance, SaveImportBatchInput, StoredImportBatch, UpsertMonitorProvenanceInput, } from "./store.js";
|
|
11
|
-
export type { BrowserPageRunner, BrowserPageRunnerResult, FetchLike, HostedDnsResolver, HostedHttpCheckOptions, HostedHttpRequestContext, HostedHttpRequestLike, HostedHttpResponse, MonitorCheckOptions, } from "./checks.js";
|
|
11
|
+
export type { BrowserPageRunner, BrowserPageRunnerResult, FetchLike, HostedDnsResolver, HostedHttpCheckOptions, HostedHttpRequestContext, HostedHttpRequestLike, HostedHttpResponse, HostedTcpCheckOptions, MonitorCheckOptions, } from "./checks.js";
|
|
12
12
|
export type { ImportAction, ImportApplyItem, ImportApplyResult, ImportCandidate, ImportPreview, ImportPreviewItem, ImportRequest, ImportRollbackItem, ImportRollbackResult, ImportSource, } from "./imports.js";
|
|
13
13
|
export type { BrowserFailedRequest, BrowserPageEvidence, AuditEvent, CheckAttemptResult, CheckEvidence, CheckResult, CheckStatus, CreateMonitorKind, CreateMonitorInput, CreateReportScheduleInput, ImportedMonitorInput, ImportedUpdateMonitorInput, EvidenceArtifact, HttpTargetPolicyDecision, HttpTargetPolicyEvidence, Incident, IncidentStatus, ListAuditEventsOptions, ListReportRunsOptions, ListResultsOptions, Monitor, MonitorKind, MonitorStatus, MonitorSummary, ProbeCheckJob, ProbeCheckJobStatus, ProbeIdentity, ProbeResultSubmission, ProbeSubmissionReceipt, RecordAuditEventInput, ReportDeliveryChannel, ReportDeliveryRecord, ReportEmailChannelConfig, ReportLogsChannelConfig, ReportRun, ReportRunStatus, ReportSchedule, ReportScheduleChannels, ReportScheduleStatus, ReportSmsChannelConfig, SchedulerHandle, UpdateMonitorInput, UpdateReportScheduleInput, UptimeSummary, } from "./types.js";
|
|
14
14
|
export type { ProbeKeyPair, ProbeSigningInput } from "./probes.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":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pB,mBAAmB,EACnB,UAAU,EACV,kBAAkB,EAClB,aAAa,EACb,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,yBAAyB,EACzB,oBAAoB,EACpB,0BAA0B,EAC1B,gBAAgB,EAChB,wBAAwB,EACxB,wBAAwB,EACxB,QAAQ,EACR,cAAc,EACd,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,EAClB,OAAO,EACP,WAAW,EACX,aAAa,EACb,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,aAAa,EACb,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,wBAAwB,EACxB,uBAAuB,EACvB,SAAS,EACT,eAAe,EACf,cAAc,EACd,sBAAsB,EACtB,oBAAoB,EACpB,sBAAsB,EACtB,eAAe,EACf,kBAAkB,EAClB,yBAAyB,EACzB,aAAa,GACd,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACnE,YAAY,EACV,iBAAiB,EACjB,wBAAwB,EACxB,cAAc,EACd,uBAAuB,EACvB,8BAA8B,GAC/B,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,YAAY,EACZ,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EACL,qBAAqB,EACrB,0BAA0B,EAC1B,iCAAiC,EACjC,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,WAAW,GACZ,MAAM,aAAa,CAAC;AAC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