@supacloud/lite 0.5.1 → 0.5.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/CHANGELOG.md +7 -0
- package/dist/cli.js +39 -15
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.5.2](https://github.com/zuohuadong/supacloud/compare/supacloud-lite-v0.5.1...supacloud-lite-v0.5.2) (2026-07-30)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **lite:** release shadow backend after lock conflicts ([c44e7a3](https://github.com/zuohuadong/supacloud/commit/c44e7a3c17f3a2d1ae9f285f7f9ad5187ebd178b))
|
|
9
|
+
|
|
3
10
|
## [0.5.1](https://github.com/zuohuadong/supacloud/compare/supacloud-lite-v0.5.0...supacloud-lite-v0.5.1) (2026-07-30)
|
|
4
11
|
|
|
5
12
|
|
package/dist/cli.js
CHANGED
|
@@ -8,7 +8,7 @@ import { dirname as dirname5, join as join9, resolve as resolve4 } from "path";
|
|
|
8
8
|
// package.json
|
|
9
9
|
var package_default = {
|
|
10
10
|
name: "@supacloud/lite",
|
|
11
|
-
version: "0.5.
|
|
11
|
+
version: "0.5.2",
|
|
12
12
|
description: "Bun-native, single-project Supabase-compatible backend powered by PGlite",
|
|
13
13
|
type: "module",
|
|
14
14
|
license: "Apache-2.0",
|
|
@@ -8063,18 +8063,27 @@ async function computeDbDiff(opts) {
|
|
|
8063
8063
|
engine: opts.makeShadowEngine ? await opts.makeShadowEngine() : undefined,
|
|
8064
8064
|
migrations: opts.migrations
|
|
8065
8065
|
});
|
|
8066
|
-
|
|
8067
|
-
|
|
8068
|
-
dataDir: opts.liveEngine ? undefined : opts.liveDataDir,
|
|
8069
|
-
migrations: opts.migrations
|
|
8070
|
-
});
|
|
8066
|
+
let live;
|
|
8067
|
+
let operationFailed = false;
|
|
8071
8068
|
try {
|
|
8069
|
+
live = await createBackend({
|
|
8070
|
+
engine: opts.liveEngine,
|
|
8071
|
+
dataDir: opts.liveEngine ? undefined : opts.liveDataDir,
|
|
8072
|
+
migrations: opts.migrations
|
|
8073
|
+
});
|
|
8072
8074
|
const shadowSnap = await snapshotSchema(shadow.db, schema);
|
|
8073
8075
|
const liveSnap = await snapshotSchema(live.db, schema);
|
|
8074
8076
|
return diffSchemas(shadowSnap, liveSnap, schema);
|
|
8077
|
+
} catch (error) {
|
|
8078
|
+
operationFailed = true;
|
|
8079
|
+
throw error;
|
|
8075
8080
|
} finally {
|
|
8076
|
-
|
|
8077
|
-
|
|
8081
|
+
try {
|
|
8082
|
+
await closeBackends(live, shadow);
|
|
8083
|
+
} catch (error) {
|
|
8084
|
+
if (!operationFailed)
|
|
8085
|
+
throw error;
|
|
8086
|
+
}
|
|
8078
8087
|
}
|
|
8079
8088
|
}
|
|
8080
8089
|
async function pullSchema(opts) {
|
|
@@ -8083,12 +8092,14 @@ async function pullSchema(opts) {
|
|
|
8083
8092
|
engine: opts.makeShadowEngine ? await opts.makeShadowEngine() : undefined,
|
|
8084
8093
|
migrations: opts.migrations
|
|
8085
8094
|
});
|
|
8086
|
-
|
|
8087
|
-
|
|
8088
|
-
dataDir: opts.liveEngine ? undefined : opts.liveDataDir,
|
|
8089
|
-
migrations: opts.migrations
|
|
8090
|
-
});
|
|
8095
|
+
let live;
|
|
8096
|
+
let operationFailed = false;
|
|
8091
8097
|
try {
|
|
8098
|
+
live = await createBackend({
|
|
8099
|
+
engine: opts.liveEngine,
|
|
8100
|
+
dataDir: opts.liveEngine ? undefined : opts.liveDataDir,
|
|
8101
|
+
migrations: opts.migrations
|
|
8102
|
+
});
|
|
8092
8103
|
const ddl = diffSchemas(await snapshotSchema(shadow.db, schema), await snapshotSchema(live.db, schema), schema);
|
|
8093
8104
|
if (ddl.length === 0)
|
|
8094
8105
|
return { ddl, version: null, path: null };
|
|
@@ -8107,11 +8118,24 @@ async function pullSchema(opts) {
|
|
|
8107
8118
|
await live.db.query(`insert into supabase_migrations.schema_migrations (version, name, statements)
|
|
8108
8119
|
values ($1, $2, $3) on conflict (version) do nothing`, [stamp, `${stamp}_${name}`, [body]]);
|
|
8109
8120
|
return { ddl, version: stamp, path };
|
|
8121
|
+
} catch (error) {
|
|
8122
|
+
operationFailed = true;
|
|
8123
|
+
throw error;
|
|
8110
8124
|
} finally {
|
|
8111
|
-
|
|
8112
|
-
|
|
8125
|
+
try {
|
|
8126
|
+
await closeBackends(live, shadow);
|
|
8127
|
+
} catch (error) {
|
|
8128
|
+
if (!operationFailed)
|
|
8129
|
+
throw error;
|
|
8130
|
+
}
|
|
8113
8131
|
}
|
|
8114
8132
|
}
|
|
8133
|
+
async function closeBackends(...backends) {
|
|
8134
|
+
const results = await Promise.allSettled(backends.filter((backend) => backend !== undefined).map(async (backend) => await backend.close()));
|
|
8135
|
+
const failed = results.find((result) => result.status === "rejected");
|
|
8136
|
+
if (failed?.status === "rejected")
|
|
8137
|
+
throw failed.reason;
|
|
8138
|
+
}
|
|
8115
8139
|
|
|
8116
8140
|
// src/vendor/tinbase/node/project.ts
|
|
8117
8141
|
import { readdir, readFile as readFile2 } from "fs/promises";
|
package/dist/index.js
CHANGED
|
@@ -71,7 +71,7 @@ function randomToken(bytes = 32) {
|
|
|
71
71
|
// package.json
|
|
72
72
|
var package_default = {
|
|
73
73
|
name: "@supacloud/lite",
|
|
74
|
-
version: "0.5.
|
|
74
|
+
version: "0.5.2",
|
|
75
75
|
description: "Bun-native, single-project Supabase-compatible backend powered by PGlite",
|
|
76
76
|
type: "module",
|
|
77
77
|
license: "Apache-2.0",
|