@codemation/host 0.0.1 → 0.0.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/{CodemationFrontendBootstrapRequest-CE6DjOWJ.js → CodemationFrontendBootstrapRequest-CNEk-C4D.js} +2 -2
- package/dist/{CodemationFrontendBootstrapRequest-CE6DjOWJ.js.map → CodemationFrontendBootstrapRequest-CNEk-C4D.js.map} +1 -1
- package/dist/{PrismaMigrationDeployer-B1E_gYz7.js → PrismaMigrationDeployer-B7cHGrXP.js} +22 -9
- package/dist/PrismaMigrationDeployer-B7cHGrXP.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -4
- package/dist/nextServer.js +2 -2
- package/dist/{persistenceServer-W9uRw0dJ.js → persistenceServer-8tcM2S48.js} +2 -2
- package/dist/{persistenceServer-W9uRw0dJ.js.map → persistenceServer-8tcM2S48.js.map} +1 -1
- package/dist/{persistenceServer-K5eqlZm3.d.ts → persistenceServer-DPSj_-oU.d.ts} +3 -2
- package/dist/persistenceServer.d.ts +1 -1
- package/dist/persistenceServer.js +2 -2
- package/dist/{server-BiHSuA13.js → server-Dd65rNm6.js} +2 -2
- package/dist/{server-BiHSuA13.js.map → server-Dd65rNm6.js.map} +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +4 -4
- package/package.json +6 -6
- package/src/infrastructure/persistence/PrismaMigrationDeployer.ts +24 -6
- package/dist/PrismaMigrationDeployer-B1E_gYz7.js.map +0 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { r as __require, t as __commonJS } from "./chunk-7V6ThxGB.js";
|
|
2
2
|
import { t as __decorate } from "./decorate-B-N_5S4p.js";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
|
+
import { mkdir } from "node:fs/promises";
|
|
4
5
|
import path from "node:path";
|
|
5
6
|
import { fileURLToPath } from "node:url";
|
|
6
7
|
import { injectable } from "@codemation/core";
|
|
@@ -5378,11 +5379,11 @@ how you used Prisma Client in the issue.
|
|
|
5378
5379
|
function Ka(e) {
|
|
5379
5380
|
return e.type === "List" ? `List<${Ka(e.inner)}>` : e.type;
|
|
5380
5381
|
}
|
|
5381
|
-
function rm(e) {
|
|
5382
|
+
function rm$1(e) {
|
|
5382
5383
|
return ArrayBuffer.isView(e) ? Buffer.from(e.buffer, e.byteOffset, e.byteLength).toString("base64") : JSON.stringify(e);
|
|
5383
5384
|
}
|
|
5384
5385
|
function nm(e, t) {
|
|
5385
|
-
return `${Ka(t)}:${rm(e)}`;
|
|
5386
|
+
return `${Ka(t)}:${rm$1(e)}`;
|
|
5386
5387
|
}
|
|
5387
5388
|
var im = 2 ** 31 - 1, om = -(2 ** 31);
|
|
5388
5389
|
function ii(e) {
|
|
@@ -8089,6 +8090,7 @@ let PrismaMigrationDeployer = class PrismaMigrationDeployer$1 {
|
|
|
8089
8090
|
await this.deployPostgres(args);
|
|
8090
8091
|
}
|
|
8091
8092
|
async deployPgliteViaPrismaCli(args) {
|
|
8093
|
+
await this.ensurePgliteParentDirectoryExists(args.dataDir);
|
|
8092
8094
|
let pglite;
|
|
8093
8095
|
try {
|
|
8094
8096
|
pglite = new PGlite(args.dataDir);
|
|
@@ -8115,15 +8117,16 @@ let PrismaMigrationDeployer = class PrismaMigrationDeployer$1 {
|
|
|
8115
8117
|
}
|
|
8116
8118
|
}
|
|
8117
8119
|
async deployPostgres(args) {
|
|
8120
|
+
const prismaConfigPath = this.resolveAbsolutePrismaConfigPath();
|
|
8118
8121
|
await new Promise((resolve, reject) => {
|
|
8119
8122
|
const command = spawn(process.execPath, [
|
|
8120
8123
|
this.resolvePrismaCliPath(),
|
|
8121
8124
|
"migrate",
|
|
8122
8125
|
"deploy",
|
|
8123
8126
|
"--config",
|
|
8124
|
-
|
|
8127
|
+
path.basename(prismaConfigPath)
|
|
8125
8128
|
], {
|
|
8126
|
-
cwd:
|
|
8129
|
+
cwd: path.dirname(prismaConfigPath),
|
|
8127
8130
|
env: this.createProcessEnvironment(args.databaseUrl, args.env),
|
|
8128
8131
|
stdio: [
|
|
8129
8132
|
"ignore",
|
|
@@ -8180,15 +8183,25 @@ let PrismaMigrationDeployer = class PrismaMigrationDeployer$1 {
|
|
|
8180
8183
|
throw new Error("Unable to resolve the Prisma CLI required for startup migrations. Ensure `prisma` is installed.");
|
|
8181
8184
|
}
|
|
8182
8185
|
}
|
|
8183
|
-
|
|
8186
|
+
resolveAbsolutePrismaConfigPath() {
|
|
8184
8187
|
const configuredPath = process.env.CODEMATION_PRISMA_CONFIG_PATH;
|
|
8185
|
-
if (configuredPath) return configuredPath;
|
|
8186
|
-
return path.resolve(
|
|
8188
|
+
if (configuredPath) return path.isAbsolute(configuredPath) ? configuredPath : path.resolve(this.resolvePackageRoot(), configuredPath);
|
|
8189
|
+
return path.resolve(this.resolvePackageRoot(), "prisma.config.ts");
|
|
8187
8190
|
}
|
|
8188
8191
|
resolvePackageRoot() {
|
|
8189
8192
|
const configuredRoot = process.env.CODEMATION_HOST_PACKAGE_ROOT;
|
|
8190
8193
|
if (configuredRoot) return configuredRoot;
|
|
8191
|
-
|
|
8194
|
+
let currentDirectory = path.dirname(fileURLToPath(import.meta.url));
|
|
8195
|
+
for (let depth = 0; depth < 8; depth += 1) {
|
|
8196
|
+
if (existsSync(path.join(currentDirectory, "prisma", "schema.prisma"))) return currentDirectory;
|
|
8197
|
+
const parentDirectory = path.dirname(currentDirectory);
|
|
8198
|
+
if (parentDirectory === currentDirectory) break;
|
|
8199
|
+
currentDirectory = parentDirectory;
|
|
8200
|
+
}
|
|
8201
|
+
throw new Error(`Could not locate prisma/schema.prisma near ${fileURLToPath(import.meta.url)}.`);
|
|
8202
|
+
}
|
|
8203
|
+
async ensurePgliteParentDirectoryExists(dataDir) {
|
|
8204
|
+
await mkdir(path.dirname(dataDir), { recursive: true });
|
|
8192
8205
|
}
|
|
8193
8206
|
createPgliteOpenFailureError(dataDir, cause) {
|
|
8194
8207
|
const underlying = cause instanceof Error ? cause.message : String(cause);
|
|
@@ -8209,4 +8222,4 @@ PrismaMigrationDeployer = __decorate([injectable()], PrismaMigrationDeployer);
|
|
|
8209
8222
|
|
|
8210
8223
|
//#endregion
|
|
8211
8224
|
export { DatabasePersistenceResolver as n, require_client as r, PrismaMigrationDeployer as t };
|
|
8212
|
-
//# sourceMappingURL=PrismaMigrationDeployer-
|
|
8225
|
+
//# sourceMappingURL=PrismaMigrationDeployer-B7cHGrXP.js.map
|