@fusebase/fusebase-gate-sdk 2.2.13-sdk.3 → 2.2.13-sdk.5
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.
|
@@ -9,5 +9,6 @@ export interface BuildSqlMigrationBundleInput {
|
|
|
9
9
|
bundleVersion?: string | null;
|
|
10
10
|
migrations: BuildSqlMigrationBundleEntryInput[];
|
|
11
11
|
}
|
|
12
|
+
export declare function canonicalizeSqlMigrationContent(sql: string): string;
|
|
12
13
|
export declare function calculateSqlMigrationChecksum(sql: string): Promise<string>;
|
|
13
14
|
export declare function buildSqlMigrationBundle(input: BuildSqlMigrationBundleInput): Promise<IsolatedStoreSqlMigrationBundleContract>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.canonicalizeSqlMigrationContent = canonicalizeSqlMigrationContent;
|
|
3
4
|
exports.calculateSqlMigrationChecksum = calculateSqlMigrationChecksum;
|
|
4
5
|
exports.buildSqlMigrationBundle = buildSqlMigrationBundle;
|
|
5
6
|
function normalizePositiveInteger(value, field) {
|
|
@@ -20,12 +21,16 @@ function toSha256Hex(buffer) {
|
|
|
20
21
|
.map((byte) => byte.toString(16).padStart(2, "0"))
|
|
21
22
|
.join("");
|
|
22
23
|
}
|
|
24
|
+
function canonicalizeSqlMigrationContent(sql) {
|
|
25
|
+
return sql.replace(/\r\n/g, "\n").trimEnd();
|
|
26
|
+
}
|
|
23
27
|
async function calculateSqlMigrationChecksum(sql) {
|
|
24
28
|
if (typeof globalThis.crypto === "undefined" ||
|
|
25
29
|
typeof globalThis.crypto.subtle === "undefined") {
|
|
26
30
|
throw new Error("SQL migration checksum requires globalThis.crypto.subtle (available in modern browsers and Node.js 20+)");
|
|
27
31
|
}
|
|
28
|
-
const
|
|
32
|
+
const canonicalSql = canonicalizeSqlMigrationContent(sql);
|
|
33
|
+
const bytes = new TextEncoder().encode(canonicalSql);
|
|
29
34
|
const digest = await globalThis.crypto.subtle.digest("SHA-256", bytes);
|
|
30
35
|
return toSha256Hex(digest);
|
|
31
36
|
}
|
|
@@ -48,7 +53,7 @@ async function buildSqlMigrationBundle(input) {
|
|
|
48
53
|
throw new Error(`Migrations must be strictly increasing by version; got ${String(version)} after ${String(previousVersion)}`);
|
|
49
54
|
}
|
|
50
55
|
const name = normalizeNonEmptyString(entry.name, `migrations[${index}].name`);
|
|
51
|
-
const sql = entry.sql;
|
|
56
|
+
const sql = canonicalizeSqlMigrationContent(entry.sql);
|
|
52
57
|
const checksum = await calculateSqlMigrationChecksum(sql);
|
|
53
58
|
const expectedChecksum = entry.expectedChecksum == null ? null : entry.expectedChecksum.trim();
|
|
54
59
|
if (expectedChecksum !== null && expectedChecksum !== checksum) {
|
package/package.json
CHANGED
package/release-notes/latest.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
# Release Notes 2.2.13-sdk.
|
|
1
|
+
# Release Notes 2.2.13-sdk.5
|
|
2
2
|
|
|
3
3
|
- Current ref: `HEAD`
|
|
4
|
-
- Previous tag: `v2.2.13-sdk.
|
|
5
|
-
- Generated at: 2026-05-
|
|
4
|
+
- Previous tag: `v2.2.13-sdk.5`
|
|
5
|
+
- Generated at: 2026-05-08T11:10:38.008Z
|
|
6
6
|
|
|
7
7
|
## Included Drafts
|
|
8
8
|
|