@amerged/ohmyhost-cli 0.1.67 → 0.1.68
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/README.md +1 -1
- package/dist/bin.js +1 -1
- package/dist/{chunk-TTY2P5HM.js → chunk-IHGPMLZF.js} +10 -2
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/apps/product-cli/package.json +1 -1
- package/src/packages/contracts/src/database-migration-admission.ts +23 -1
- package/src/packages/sdk-ts/package.json +1 -1
- package/src/packages/sdk-ts/src/generated/mcp-remote.gen.ts +1 -1
package/README.md
CHANGED
package/dist/bin.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { createRequire as __ohmyhostCreateRequire } from "node:module"; const require = __ohmyhostCreateRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
runProductionCli
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-IHGPMLZF.js";
|
|
6
6
|
import "./chunk-7D2RFLWM.js";
|
|
7
7
|
|
|
8
8
|
// apps/product-cli/dist/bin.js
|
|
@@ -46656,7 +46656,7 @@ function exact4(v, keys) {
|
|
|
46656
46656
|
// apps/product-cli/package.json
|
|
46657
46657
|
var package_default = {
|
|
46658
46658
|
name: "@ohmyhost/product-cli",
|
|
46659
|
-
version: "0.1.
|
|
46659
|
+
version: "0.1.68",
|
|
46660
46660
|
private: true,
|
|
46661
46661
|
ohmyhost: {
|
|
46662
46662
|
deployment: "production",
|
|
@@ -57433,13 +57433,19 @@ var MAX_MIGRATION_BYTES = 256 * 1024;
|
|
|
57433
57433
|
var MAX_MIGRATION_TOTAL_BYTES = 2 * 1024 * 1024;
|
|
57434
57434
|
var MIGRATION_PATH = /^(?:[A-Za-z0-9][A-Za-z0-9._-]*\/)*\d{14}_[a-z0-9][a-z0-9_-]*\.sql$/u;
|
|
57435
57435
|
function admitExpandOnlyMigrations(migrations) {
|
|
57436
|
+
return admitMigrationsAfterAppliedPrefix(migrations, 0);
|
|
57437
|
+
}
|
|
57438
|
+
function admitMigrationsAfterAppliedPrefix(migrations, appliedCount) {
|
|
57439
|
+
if (!Number.isSafeInteger(appliedCount) || appliedCount < 0 || Array.isArray(migrations) && appliedCount > migrations.length) {
|
|
57440
|
+
throw new DatabaseMigrationAdmissionError("invalid");
|
|
57441
|
+
}
|
|
57436
57442
|
if (!Array.isArray(migrations) || migrations.length === 0 || migrations.length > MAX_MIGRATION_COUNT) {
|
|
57437
57443
|
throw new DatabaseMigrationAdmissionError("invalid");
|
|
57438
57444
|
}
|
|
57439
57445
|
let previousPath = "";
|
|
57440
57446
|
let totalBytes = 0;
|
|
57441
57447
|
let statementCount = 0;
|
|
57442
|
-
const files = migrations.map((migration) => {
|
|
57448
|
+
const files = migrations.map((migration, index) => {
|
|
57443
57449
|
if (typeof migration !== "object" || migration === null || !MIGRATION_PATH.test(migration.path) || migration.path <= previousPath || !(migration.body instanceof Uint8Array) || migration.body.byteLength === 0 || migration.body.byteLength > MAX_MIGRATION_BYTES) {
|
|
57444
57450
|
throw new DatabaseMigrationAdmissionError("invalid");
|
|
57445
57451
|
}
|
|
@@ -57448,6 +57454,8 @@ function admitExpandOnlyMigrations(migrations) {
|
|
|
57448
57454
|
if (totalBytes > MAX_MIGRATION_TOTAL_BYTES || migration.body.includes(0)) {
|
|
57449
57455
|
throw new DatabaseMigrationAdmissionError("invalid");
|
|
57450
57456
|
}
|
|
57457
|
+
if (index < appliedCount)
|
|
57458
|
+
return Object.freeze({ path: migration.path, statementCount: 0 });
|
|
57451
57459
|
let sql;
|
|
57452
57460
|
try {
|
|
57453
57461
|
sql = new TextDecoder("utf-8", { fatal: true }).decode(migration.body);
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -38,6 +38,26 @@ export interface DatabaseMigrationAdmission {
|
|
|
38
38
|
export function admitExpandOnlyMigrations(
|
|
39
39
|
migrations: readonly DatabaseMigrationInput[],
|
|
40
40
|
): DatabaseMigrationAdmission {
|
|
41
|
+
return admitMigrationsAfterAppliedPrefix(migrations, 0);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Admits a bundle whose first `appliedCount` files are already proven applied by the immutable ledger. Every file keeps
|
|
46
|
+
* the structural rules (count, ordered unique paths, sizes); only the pending files are parsed against the current SQL
|
|
47
|
+
* policy. The caller must derive `appliedCount` from a ledger it has read under the migrations lock and matched
|
|
48
|
+
* path-by-path and digest-by-digest against these files; the count itself proves nothing.
|
|
49
|
+
*/
|
|
50
|
+
export function admitMigrationsAfterAppliedPrefix(
|
|
51
|
+
migrations: readonly DatabaseMigrationInput[],
|
|
52
|
+
appliedCount: number,
|
|
53
|
+
): DatabaseMigrationAdmission {
|
|
54
|
+
if (
|
|
55
|
+
!Number.isSafeInteger(appliedCount) ||
|
|
56
|
+
appliedCount < 0 ||
|
|
57
|
+
(Array.isArray(migrations) && appliedCount > migrations.length)
|
|
58
|
+
) {
|
|
59
|
+
throw new DatabaseMigrationAdmissionError("invalid");
|
|
60
|
+
}
|
|
41
61
|
if (
|
|
42
62
|
!Array.isArray(migrations) ||
|
|
43
63
|
migrations.length === 0 ||
|
|
@@ -48,7 +68,7 @@ export function admitExpandOnlyMigrations(
|
|
|
48
68
|
let previousPath = "";
|
|
49
69
|
let totalBytes = 0;
|
|
50
70
|
let statementCount = 0;
|
|
51
|
-
const files = migrations.map((migration) => {
|
|
71
|
+
const files = migrations.map((migration, index) => {
|
|
52
72
|
if (
|
|
53
73
|
typeof migration !== "object" ||
|
|
54
74
|
migration === null ||
|
|
@@ -65,6 +85,8 @@ export function admitExpandOnlyMigrations(
|
|
|
65
85
|
if (totalBytes > MAX_MIGRATION_TOTAL_BYTES || migration.body.includes(0)) {
|
|
66
86
|
throw new DatabaseMigrationAdmissionError("invalid");
|
|
67
87
|
}
|
|
88
|
+
// Its bytes are the ones the ledger digest proved applied; today's SQL policy never ran against them again.
|
|
89
|
+
if (index < appliedCount) return Object.freeze({ path: migration.path, statementCount: 0 });
|
|
68
90
|
let sql: string;
|
|
69
91
|
try {
|
|
70
92
|
sql = new TextDecoder("utf-8", { fatal: true }).decode(migration.body);
|
|
@@ -74,7 +74,7 @@ import {
|
|
|
74
74
|
export const remoteMcpContractSha256 =
|
|
75
75
|
"169544a84c5bf8e63c5261d2aa895adccfd1a34807db4e57d7e94fdd8817ba09";
|
|
76
76
|
export const remoteMcpContractVersion = "0.0.0";
|
|
77
|
-
export const remoteMcpReleaseVersion = "0.1.
|
|
77
|
+
export const remoteMcpReleaseVersion = "0.1.68";
|
|
78
78
|
export interface RemoteMcpOperation {
|
|
79
79
|
operationId: string;
|
|
80
80
|
method: string;
|