@supacloud/cli 0.21.0 → 0.21.2
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.js +31 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7068,16 +7068,23 @@ function migrationIdentityKey(version, name) {
|
|
|
7068
7068
|
return `${version}\x00${name}`;
|
|
7069
7069
|
}
|
|
7070
7070
|
function migrationIdentities(data) {
|
|
7071
|
-
return migrationRows(data).flatMap((row) => row.version == null || row.name == null ? [] : [{ version: String(row.version), name: String(row.name) }]);
|
|
7071
|
+
return migrationRows(data).flatMap((row) => row.version == null || row.name == null ? [] : [{ version: String(row.version), name: String(row.name), statements: row.statements }]);
|
|
7072
7072
|
}
|
|
7073
|
-
function
|
|
7073
|
+
function isLegacyNameBoundMigration(local, remote, remoteMigrations) {
|
|
7074
|
+
return remoteMigrations.filter((candidate) => candidate.name === local.name).length === 1 && local.name === remote.name && local.version !== remote.version && Array.isArray(remote.statements) && remote.statements.length === 1 && typeof remote.statements[0] === "string" && remote.statements[0].trim() === local.sql.trim();
|
|
7075
|
+
}
|
|
7076
|
+
function identityConflicts(local, remote, remoteMigrations) {
|
|
7074
7077
|
const reusesVersionOrName = local.version === remote.version || local.name === remote.name;
|
|
7075
7078
|
const exactlyMatches = local.version === remote.version && local.name === remote.name;
|
|
7076
|
-
return reusesVersionOrName && !exactlyMatches;
|
|
7079
|
+
return reusesVersionOrName && !exactlyMatches && !isLegacyNameBoundMigration(local, remote, remoteMigrations);
|
|
7077
7080
|
}
|
|
7078
7081
|
function migrationIdentityConflicts(data, migrationFiles) {
|
|
7079
7082
|
const remoteMigrations = migrationIdentities(data);
|
|
7080
|
-
return migrationFiles.flatMap((localMigration) => remoteMigrations.filter((remoteMigration) => identityConflicts(localMigration, remoteMigration)).map((remoteMigration) => ({ file: localMigration.file, local: localMigration, remote: remoteMigration })));
|
|
7083
|
+
return migrationFiles.flatMap((localMigration) => remoteMigrations.filter((remoteMigration) => identityConflicts(localMigration, remoteMigration, remoteMigrations)).map((remoteMigration) => ({ file: localMigration.file, local: localMigration, remote: remoteMigration })));
|
|
7084
|
+
}
|
|
7085
|
+
function legacyNameBoundMigrationKeys(data, migrationFiles) {
|
|
7086
|
+
const remoteMigrations = migrationIdentities(data);
|
|
7087
|
+
return new Set(migrationFiles.flatMap((localMigration) => remoteMigrations.some((remoteMigration) => isLegacyNameBoundMigration(localMigration, remoteMigration, remoteMigrations)) ? [migrationIdentityKey(localMigration.version, localMigration.name)] : []));
|
|
7081
7088
|
}
|
|
7082
7089
|
function assertNoMigrationIdentityConflicts(data, migrationFiles) {
|
|
7083
7090
|
const conflicts = migrationIdentityConflicts(data, migrationFiles);
|
|
@@ -7382,9 +7389,10 @@ Actions: ${allActions.join(", ")}${readOnly ? " (read-only mode)" : ""}`, {
|
|
|
7382
7389
|
const skipped = [];
|
|
7383
7390
|
const nameBoundMarkerKeys = nameBoundMigrationMarkerKeys(migrationsResult.data);
|
|
7384
7391
|
const historicalChecksumKeys = historicalChecksumMarkerKeys(migrationsResult.data, migrationFiles);
|
|
7392
|
+
const legacyNameBoundKeys = legacyNameBoundMigrationKeys(migrationsResult.data, migrationFiles);
|
|
7385
7393
|
for (const { file, name, version, sql } of migrationFiles) {
|
|
7386
7394
|
const migrationKey = migrationIdentityKey(version, name);
|
|
7387
|
-
if (nameBoundMarkerKeys.has(migrationKey) || historicalChecksumKeys.has(migrationKey)) {
|
|
7395
|
+
if (nameBoundMarkerKeys.has(migrationKey) || historicalChecksumKeys.has(migrationKey) || legacyNameBoundKeys.has(migrationKey)) {
|
|
7388
7396
|
skipped.push(file);
|
|
7389
7397
|
continue;
|
|
7390
7398
|
}
|
|
@@ -11540,11 +11548,28 @@ function isCanonicalTimestamp(candidate) {
|
|
|
11540
11548
|
return Number.isFinite(milliseconds) && new Date(milliseconds).toISOString() === candidate;
|
|
11541
11549
|
}
|
|
11542
11550
|
function safeSchedulePayload(schedule) {
|
|
11551
|
+
const hasProjectedBody = Object.hasOwn(schedule, "body_empty");
|
|
11552
|
+
const hasProjectedHeaders = Object.hasOwn(schedule, "header_names");
|
|
11553
|
+
if (!hasProjectedBody && !hasProjectedHeaders)
|
|
11554
|
+
return legacySchedulePayload(schedule);
|
|
11555
|
+
if (!hasProjectedBody || !hasProjectedHeaders)
|
|
11556
|
+
return null;
|
|
11543
11557
|
const headerNames = safeHeaderNames(schedule.header_names);
|
|
11544
11558
|
if (typeof schedule.body_empty !== "boolean" || !headerNames)
|
|
11545
11559
|
return null;
|
|
11546
11560
|
return { body_empty: schedule.body_empty, header_names: headerNames };
|
|
11547
11561
|
}
|
|
11562
|
+
function legacySchedulePayload(schedule) {
|
|
11563
|
+
const body = objectRecord3(schedule.body);
|
|
11564
|
+
const headers = objectRecord3(schedule.headers);
|
|
11565
|
+
if (!body || !headers)
|
|
11566
|
+
return null;
|
|
11567
|
+
const headerNames = safeHeaderNames(Object.keys(headers));
|
|
11568
|
+
const stableHeaderValues = Object.entries(headers).every(([name, value]) => typeof value === "string" && headerValueIsStable(name.toLowerCase(), value));
|
|
11569
|
+
if (!headerNames || !stableHeaderValues)
|
|
11570
|
+
return null;
|
|
11571
|
+
return { body_empty: Object.keys(body).length === 0, header_names: headerNames };
|
|
11572
|
+
}
|
|
11548
11573
|
function safeHeaderNames(candidate) {
|
|
11549
11574
|
if (!Array.isArray(candidate) || candidate.length > MAX_HEADER_COUNT)
|
|
11550
11575
|
return null;
|
|
@@ -12022,7 +12047,7 @@ var MUTATION_TOOL_SCHEMA = {
|
|
|
12022
12047
|
// package.json
|
|
12023
12048
|
var package_default = {
|
|
12024
12049
|
name: "@supacloud/cli",
|
|
12025
|
-
version: "0.21.
|
|
12050
|
+
version: "0.21.2",
|
|
12026
12051
|
description: "Project-scoped CLI for SupaCloud users",
|
|
12027
12052
|
type: "module",
|
|
12028
12053
|
main: "./dist/index.js",
|