qarpeo 0.3.4 → 0.3.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.
@@ -11,7 +11,7 @@ import { useRuntimeConfig } from 'nuxt/server';
11
11
  import { mkdir, writeFile, readFile } from 'node:fs/promises';
12
12
  import { defu } from 'defu';
13
13
 
14
- const version = "0.3.4";
14
+ const version = "0.3.5";
15
15
 
16
16
  function resolveBindingName(service, override, defaultName) {
17
17
  if (override && typeof override === "string") {
@@ -1,6 +1,5 @@
1
1
  import { defineRelations } from "drizzle-orm";
2
2
  import { drizzle as drizzleD1 } from "drizzle-orm/d1";
3
- import { drizzle as drizzlePostgres } from "drizzle-orm/postgres-js";
4
3
  import { getD1Binding, getDatabaseInfo } from "./db.mjs";
5
4
  const drizzleCache = /* @__PURE__ */ new WeakMap();
6
5
  const pgDrizzleCache = /* @__PURE__ */ new Map();
@@ -8,15 +7,18 @@ export function createDrizzle(schema, bindingName, event) {
8
7
  const dbInfo = getDatabaseInfo(bindingName, event);
9
8
  if (dbInfo.isPostgres && dbInfo.url) {
10
9
  let postgresLib;
10
+ let drizzlePostgres;
11
11
  try {
12
12
  const req = globalThis.require || (typeof globalThis.process !== "undefined" && typeof require !== "undefined" ? require : void 0);
13
13
  if (req) {
14
14
  const pgMod = req("postgres");
15
15
  postgresLib = pgMod?.default || pgMod;
16
+ const pgDrizzleMod = req("drizzle-orm/postgres-js");
17
+ drizzlePostgres = pgDrizzleMod?.drizzle || pgDrizzleMod?.default?.drizzle;
16
18
  }
17
19
  } catch {
18
20
  }
19
- if (!postgresLib) {
21
+ if (!postgresLib || !drizzlePostgres) {
20
22
  throw new Error(
21
23
  `[qarpeo] PostgreSQL runtime client requires the \`postgres\` package.
22
24
  Install it with: pnpm add postgres`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qarpeo",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
  "description": "Zero-config Cloudflare Edge Platform for Nuxt",
5
5
  "keywords": [
6
6
  "analytics-engine",