opacacms 0.3.10 → 0.3.12
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/{chunk-5a6cjmfz.js → chunk-0njhbe4a.js} +2 -1
- package/dist/{chunk-ec6wz44n.js → chunk-1vtdkx5e.js} +2 -1
- package/dist/{chunk-h9ksxnrd.js → chunk-2ec9fsgr.js} +18 -7
- package/dist/{chunk-g7bgnpy4.js → chunk-8hhzvesq.js} +2 -1
- package/dist/{chunk-swa093n5.js → chunk-xdmw9vzq.js} +2 -1
- package/dist/db/better-sqlite.js +1 -1
- package/dist/db/bun-sqlite.js +1 -1
- package/dist/db/d1.js +1 -1
- package/dist/db/index.js +5 -5
- package/dist/db/postgres.js +1 -1
- package/dist/db/sqlite.js +1 -1
- package/package.json +1 -1
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
// src/db/bun-sqlite.ts
|
|
26
26
|
import fs from "node:fs/promises";
|
|
27
27
|
import path from "node:path";
|
|
28
|
+
import { pathToFileURL } from "node:url";
|
|
28
29
|
import { FileMigrationProvider, Migrator, sql } from "kysely";
|
|
29
30
|
class BunSQLiteAdapter extends BaseDatabaseAdapter {
|
|
30
31
|
path;
|
|
@@ -555,7 +556,7 @@ class BunSQLiteAdapter extends BaseDatabaseAdapter {
|
|
|
555
556
|
provider: new FileMigrationProvider({
|
|
556
557
|
fs,
|
|
557
558
|
path,
|
|
558
|
-
migrationFolder: path.resolve(process.cwd(), this.migrationDir)
|
|
559
|
+
migrationFolder: pathToFileURL(path.resolve(process.cwd(), this.migrationDir)).href
|
|
559
560
|
})
|
|
560
561
|
});
|
|
561
562
|
const { error, results } = await migrator.migrateToLatest();
|
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
// src/db/better-sqlite.ts
|
|
26
26
|
import fs from "node:fs/promises";
|
|
27
27
|
import path from "node:path";
|
|
28
|
+
import { pathToFileURL } from "node:url";
|
|
28
29
|
import {
|
|
29
30
|
CompiledQuery,
|
|
30
31
|
FileMigrationProvider,
|
|
@@ -548,7 +549,7 @@ class BetterSQLiteAdapter extends BaseDatabaseAdapter {
|
|
|
548
549
|
provider: new FileMigrationProvider({
|
|
549
550
|
fs,
|
|
550
551
|
path,
|
|
551
|
-
migrationFolder: path.resolve(process.cwd(), this.migrationDir)
|
|
552
|
+
migrationFolder: pathToFileURL(path.resolve(process.cwd(), this.migrationDir)).href
|
|
552
553
|
})
|
|
553
554
|
});
|
|
554
555
|
const { error, results } = await migrator.migrateToLatest();
|
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
// src/db/postgres.ts
|
|
25
25
|
import fs from "node:fs/promises";
|
|
26
26
|
import path from "node:path";
|
|
27
|
+
import { pathToFileURL } from "node:url";
|
|
27
28
|
import {
|
|
28
29
|
CompiledQuery,
|
|
29
30
|
FileMigrationProvider,
|
|
@@ -76,11 +77,22 @@ class PostgresAdapter extends BaseDatabaseAdapter {
|
|
|
76
77
|
dialect: new PostgresDialect({
|
|
77
78
|
pool: {
|
|
78
79
|
connect: async () => {
|
|
80
|
+
const conn = await this._rawDb.reserve();
|
|
79
81
|
const query = async (sqlStr, parameters) => {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
+
try {
|
|
83
|
+
const res = await conn.unsafe(sqlStr, parameters || []);
|
|
84
|
+
return { rows: res };
|
|
85
|
+
} catch (e) {
|
|
86
|
+
const wrapped = new Error(e.message);
|
|
87
|
+
wrapped.code = e.code;
|
|
88
|
+
wrapped.detail = e.detail;
|
|
89
|
+
wrapped.hint = e.hint;
|
|
90
|
+
wrapped.position = e.position;
|
|
91
|
+
wrapped.stack = e.stack;
|
|
92
|
+
throw wrapped;
|
|
93
|
+
}
|
|
82
94
|
};
|
|
83
|
-
return { query, release: () =>
|
|
95
|
+
return { query, release: () => conn.release() };
|
|
84
96
|
},
|
|
85
97
|
end: async () => {},
|
|
86
98
|
on: () => {}
|
|
@@ -184,12 +196,11 @@ class PostgresAdapter extends BaseDatabaseAdapter {
|
|
|
184
196
|
const unflattened = unflattenRow(row);
|
|
185
197
|
const colDef = this._collections.find((c) => c.slug === collection);
|
|
186
198
|
if (colDef) {
|
|
187
|
-
const
|
|
188
|
-
const relationalFields = getRelationalFields2(colDef.fields);
|
|
199
|
+
const relationalFields = getRelationalFields(colDef.fields);
|
|
189
200
|
for (const field of relationalFields) {
|
|
190
201
|
if (!field.name)
|
|
191
202
|
continue;
|
|
192
|
-
const snakeName =
|
|
203
|
+
const snakeName = toSnakeCase(field.name);
|
|
193
204
|
if (field.type === "relationship" && "hasMany" in field && field.hasMany) {
|
|
194
205
|
const joinTableName = `${collection}_${snakeName}_relations`.toLowerCase();
|
|
195
206
|
try {
|
|
@@ -568,7 +579,7 @@ class PostgresAdapter extends BaseDatabaseAdapter {
|
|
|
568
579
|
provider: new FileMigrationProvider({
|
|
569
580
|
fs,
|
|
570
581
|
path,
|
|
571
|
-
migrationFolder: path.resolve(process.cwd(), this.migrationDir)
|
|
582
|
+
migrationFolder: pathToFileURL(path.resolve(process.cwd(), this.migrationDir)).href
|
|
572
583
|
})
|
|
573
584
|
});
|
|
574
585
|
const { error, results } = await migrator.migrateToLatest();
|
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
// src/db/d1.ts
|
|
26
26
|
import fs from "node:fs/promises";
|
|
27
27
|
import path from "node:path";
|
|
28
|
+
import { pathToFileURL } from "node:url";
|
|
28
29
|
import { CompiledQuery, FileMigrationProvider, Migrator } from "kysely";
|
|
29
30
|
class D1Adapter extends BaseDatabaseAdapter {
|
|
30
31
|
name = "d1";
|
|
@@ -574,7 +575,7 @@ class D1Adapter extends BaseDatabaseAdapter {
|
|
|
574
575
|
provider: new FileMigrationProvider({
|
|
575
576
|
fs,
|
|
576
577
|
path,
|
|
577
|
-
migrationFolder: path.resolve(process.cwd(), this.migrationDir)
|
|
578
|
+
migrationFolder: pathToFileURL(path.resolve(process.cwd(), this.migrationDir)).href
|
|
578
579
|
})
|
|
579
580
|
});
|
|
580
581
|
const { error, results } = await migrator.migrateToLatest();
|
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
// src/db/sqlite.ts
|
|
26
26
|
import fs from "node:fs/promises";
|
|
27
27
|
import path from "node:path";
|
|
28
|
+
import { pathToFileURL } from "node:url";
|
|
28
29
|
import {
|
|
29
30
|
CompiledQuery,
|
|
30
31
|
FileMigrationProvider,
|
|
@@ -563,7 +564,7 @@ class SQLiteAdapter extends BaseDatabaseAdapter {
|
|
|
563
564
|
provider: new FileMigrationProvider({
|
|
564
565
|
fs,
|
|
565
566
|
path,
|
|
566
|
-
migrationFolder: path.resolve(process.cwd(), this.migrationDir)
|
|
567
|
+
migrationFolder: pathToFileURL(path.resolve(process.cwd(), this.migrationDir)).href
|
|
567
568
|
})
|
|
568
569
|
});
|
|
569
570
|
const { error, results } = await migrator.migrateToLatest();
|
package/dist/db/better-sqlite.js
CHANGED
package/dist/db/bun-sqlite.js
CHANGED
package/dist/db/d1.js
CHANGED
package/dist/db/index.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import {
|
|
2
2
|
D1Adapter,
|
|
3
3
|
createD1Adapter
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-8hhzvesq.js";
|
|
5
5
|
import {
|
|
6
6
|
PostgresAdapter,
|
|
7
7
|
createPostgresAdapter
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-2ec9fsgr.js";
|
|
9
9
|
import {
|
|
10
10
|
SQLiteAdapter,
|
|
11
11
|
createSQLiteAdapter
|
|
12
|
-
} from "../chunk-
|
|
12
|
+
} from "../chunk-xdmw9vzq.js";
|
|
13
13
|
import {
|
|
14
14
|
BunSQLiteAdapter,
|
|
15
15
|
createBunSQLiteAdapter
|
|
16
|
-
} from "../chunk-
|
|
16
|
+
} from "../chunk-0njhbe4a.js";
|
|
17
17
|
import {
|
|
18
18
|
BetterSQLiteAdapter,
|
|
19
19
|
createBetterSQLiteAdapter
|
|
20
|
-
} from "../chunk-
|
|
20
|
+
} from "../chunk-1vtdkx5e.js";
|
|
21
21
|
import"../chunk-re459gm9.js";
|
|
22
22
|
import {
|
|
23
23
|
BaseDatabaseAdapter
|
package/dist/db/postgres.js
CHANGED
package/dist/db/sqlite.js
CHANGED