opacacms 0.3.10 → 0.3.11

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.
@@ -76,11 +76,22 @@ class PostgresAdapter extends BaseDatabaseAdapter {
76
76
  dialect: new PostgresDialect({
77
77
  pool: {
78
78
  connect: async () => {
79
+ const conn = await this._rawDb.reserve();
79
80
  const query = async (sqlStr, parameters) => {
80
- const res = await this._rawDb.unsafe(sqlStr, parameters || []);
81
- return { rows: res };
81
+ try {
82
+ const res = await conn.unsafe(sqlStr, parameters || []);
83
+ return { rows: res };
84
+ } catch (e) {
85
+ const wrapped = new Error(e.message);
86
+ wrapped.code = e.code;
87
+ wrapped.detail = e.detail;
88
+ wrapped.hint = e.hint;
89
+ wrapped.position = e.position;
90
+ wrapped.stack = e.stack;
91
+ throw wrapped;
92
+ }
82
93
  };
83
- return { query, release: () => {} };
94
+ return { query, release: () => conn.release() };
84
95
  },
85
96
  end: async () => {},
86
97
  on: () => {}
@@ -184,12 +195,11 @@ class PostgresAdapter extends BaseDatabaseAdapter {
184
195
  const unflattened = unflattenRow(row);
185
196
  const colDef = this._collections.find((c) => c.slug === collection);
186
197
  if (colDef) {
187
- const { getRelationalFields: getRelationalFields2, toSnakeCase: toSnakeCase2 } = await import("./chunk-z9ek88xr.js");
188
- const relationalFields = getRelationalFields2(colDef.fields);
198
+ const relationalFields = getRelationalFields(colDef.fields);
189
199
  for (const field of relationalFields) {
190
200
  if (!field.name)
191
201
  continue;
192
- const snakeName = toSnakeCase2(field.name);
202
+ const snakeName = toSnakeCase(field.name);
193
203
  if (field.type === "relationship" && "hasMany" in field && field.hasMany) {
194
204
  const joinTableName = `${collection}_${snakeName}_relations`.toLowerCase();
195
205
  try {
package/dist/db/index.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  import {
6
6
  PostgresAdapter,
7
7
  createPostgresAdapter
8
- } from "../chunk-h9ksxnrd.js";
8
+ } from "../chunk-5prjxes5.js";
9
9
  import {
10
10
  SQLiteAdapter,
11
11
  createSQLiteAdapter
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  PostgresAdapter,
3
3
  createPostgresAdapter
4
- } from "../chunk-h9ksxnrd.js";
4
+ } from "../chunk-5prjxes5.js";
5
5
  import"../chunk-re459gm9.js";
6
6
  import"../chunk-s8mqwnm1.js";
7
7
  import"../chunk-q5sb5dcr.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opacacms",
3
- "version": "0.3.10",
3
+ "version": "0.3.11",
4
4
  "license": "MIT",
5
5
  "description": "OpacaCMS: A lightweight, type-safe, and developer-first Headless CMS for the edge and beyond.",
6
6
  "keywords": [