@apibara/plugin-drizzle 2.1.0-beta.19 → 2.1.0-beta.20

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/index.cjs CHANGED
@@ -55,7 +55,7 @@ function drizzle(options) {
55
55
  config,
56
56
  poolConfig
57
57
  } = options ?? {};
58
- if (connectionString.startsWith("postgres://") || type === "node-postgres") {
58
+ if (isPostgresConnectionString(connectionString) || type === "node-postgres") {
59
59
  const pool = new pg__default.Pool({
60
60
  connectionString,
61
61
  ...poolConfig || {}
@@ -90,6 +90,9 @@ async function migrate(db, options) {
90
90
  );
91
91
  }
92
92
  }
93
+ function isPostgresConnectionString(conn) {
94
+ return conn.startsWith("postgres://") || conn.startsWith("postgresql://");
95
+ }
93
96
 
94
97
  const CHECKPOINTS_TABLE_NAME = "checkpoints";
95
98
  const FILTERS_TABLE_NAME = "filters";
package/dist/index.mjs CHANGED
@@ -49,7 +49,7 @@ function drizzle(options) {
49
49
  config,
50
50
  poolConfig
51
51
  } = options ?? {};
52
- if (connectionString.startsWith("postgres://") || type === "node-postgres") {
52
+ if (isPostgresConnectionString(connectionString) || type === "node-postgres") {
53
53
  const pool = new pg.Pool({
54
54
  connectionString,
55
55
  ...poolConfig || {}
@@ -84,6 +84,9 @@ async function migrate(db, options) {
84
84
  );
85
85
  }
86
86
  }
87
+ function isPostgresConnectionString(conn) {
88
+ return conn.startsWith("postgres://") || conn.startsWith("postgresql://");
89
+ }
87
90
 
88
91
  const CHECKPOINTS_TABLE_NAME = "checkpoints";
89
92
  const FILTERS_TABLE_NAME = "filters";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apibara/plugin-drizzle",
3
- "version": "2.1.0-beta.19",
3
+ "version": "2.1.0-beta.20",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",
@@ -45,8 +45,8 @@
45
45
  "vitest": "^1.6.0"
46
46
  },
47
47
  "dependencies": {
48
- "@apibara/indexer": "2.1.0-beta.19",
49
- "@apibara/protocol": "2.1.0-beta.19",
48
+ "@apibara/indexer": "2.1.0-beta.20",
49
+ "@apibara/protocol": "2.1.0-beta.20",
50
50
  "postgres-range": "^1.1.4"
51
51
  }
52
52
  }
package/src/helper.ts CHANGED
@@ -129,7 +129,10 @@ export function drizzle<
129
129
  poolConfig,
130
130
  } = options ?? {};
131
131
 
132
- if (connectionString.startsWith("postgres://") || type === "node-postgres") {
132
+ if (
133
+ isPostgresConnectionString(connectionString) ||
134
+ type === "node-postgres"
135
+ ) {
133
136
  const pool = new pg.Pool({
134
137
  connectionString,
135
138
  ...(poolConfig || {}),
@@ -193,3 +196,7 @@ export async function migrate<TSchema extends Record<string, unknown>>(
193
196
  );
194
197
  }
195
198
  }
199
+
200
+ function isPostgresConnectionString(conn: string) {
201
+ return conn.startsWith("postgres://") || conn.startsWith("postgresql://");
202
+ }