@tryvira/mcp 0.1.8 → 0.1.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/cli.js +14 -5
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1217,6 +1217,12 @@ DROP TRIGGER IF EXISTS worker_jobs_clear_lease ON worker_jobs;
|
|
|
1217
1217
|
CREATE TRIGGER worker_jobs_clear_lease BEFORE UPDATE OF state ON worker_jobs
|
|
1218
1218
|
FOR EACH ROW EXECUTE FUNCTION worker_jobs_clear_lease_fn();`;
|
|
1219
1219
|
}
|
|
1220
|
+
function migrationChecksums(sql) {
|
|
1221
|
+
const normalized = normalizePostgresMigrationSql(sql);
|
|
1222
|
+
const canonical3 = createHash6("sha256").update(normalized.replace(/\r\n?/g, "\n")).digest("hex");
|
|
1223
|
+
const legacy = createHash6("sha256").update(normalized.replace(/\r?\n/g, "\r\n")).digest("hex");
|
|
1224
|
+
return { canonical: canonical3, legacy };
|
|
1225
|
+
}
|
|
1220
1226
|
async function applyPostgresMigrations(client, migrations) {
|
|
1221
1227
|
if (!client || typeof client.query !== "function") throw new Error("POSTGRES_CLIENT_INVALID");
|
|
1222
1228
|
await client.query("BEGIN");
|
|
@@ -1234,10 +1240,13 @@ async function applyPostgresMigrations(client, migrations) {
|
|
|
1234
1240
|
const appliedIds = new Map(applied.rows.map((row) => [row.id, row.checksum]));
|
|
1235
1241
|
for (const migration of migrations) {
|
|
1236
1242
|
if (!migration.id.trim() || !migration.sql.trim()) throw new Error("POSTGRES_MIGRATION_INVALID");
|
|
1237
|
-
const checksum =
|
|
1243
|
+
const { canonical: checksum, legacy: legacyChecksum } = migrationChecksums(migration.sql);
|
|
1238
1244
|
if (appliedIds.has(migration.id)) {
|
|
1239
1245
|
const previous = appliedIds.get(migration.id);
|
|
1240
|
-
if (previous && previous !== checksum)
|
|
1246
|
+
if (previous && previous !== checksum) {
|
|
1247
|
+
if (previous !== legacyChecksum) throw new Error(`POSTGRES_MIGRATION_CHECKSUM_MISMATCH:${migration.id}`);
|
|
1248
|
+
await client.query("UPDATE vira_schema_migrations SET checksum=$1, code_version=$2 WHERE id=$3", [checksum, migration.codeVersion ?? process.env.VIRA_VERSION ?? null, migration.id]);
|
|
1249
|
+
}
|
|
1241
1250
|
if (!previous) await client.query("UPDATE vira_schema_migrations SET checksum=$1, code_version=$2 WHERE id=$3", [checksum, migration.codeVersion ?? process.env.VIRA_VERSION ?? null, migration.id]);
|
|
1242
1251
|
continue;
|
|
1243
1252
|
}
|
|
@@ -1299,17 +1308,17 @@ var init_postgres_runtime = __esm({
|
|
|
1299
1308
|
resolve(here, "../migrations/008_postgres_identity_session_repositories.sql"),
|
|
1300
1309
|
resolve(here, "../migrations/009_postgres_runtime_repair.sql"),
|
|
1301
1310
|
resolve(here, "../migrations/010_postgres_receipt_lineage_repair.sql"),
|
|
1302
|
-
resolve(here, "../migrations/010_semantic_registry_task_index.sql"),
|
|
1303
1311
|
resolve(here, "../migrations/011_postgres_semantic_activation_receipts.sql"),
|
|
1304
1312
|
resolve(here, "../migrations/012_strategy_release_lineage.sql"),
|
|
1305
1313
|
resolve(here, "../migrations/013_strategy_variant_definition.sql"),
|
|
1306
1314
|
resolve(here, "../migrations/014_strategy_step_recovery_action.sql"),
|
|
1307
1315
|
resolve(here, "../migrations/015_strategy_total_recoveries.sql"),
|
|
1308
1316
|
resolve(here, "../migrations/016_postgres_studio_tenant_auth.sql"),
|
|
1309
|
-
resolve(here, "../migrations/016_unique_ai_system_names.sql"),
|
|
1310
1317
|
resolve(here, "../migrations/017_postgres_security_advisor_hardening.sql"),
|
|
1311
1318
|
resolve(here, "../migrations/018_postgres_foreign_key_indexes.sql"),
|
|
1312
|
-
resolve(here, "../migrations/019_postgres_explicit_public_deny_policies.sql")
|
|
1319
|
+
resolve(here, "../migrations/019_postgres_explicit_public_deny_policies.sql"),
|
|
1320
|
+
resolve(here, "../migrations/020_semantic_registry_task_index.sql"),
|
|
1321
|
+
resolve(here, "../migrations/021_unique_ai_system_names.sql")
|
|
1313
1322
|
];
|
|
1314
1323
|
}
|
|
1315
1324
|
});
|