stripe-experiment-sync 1.0.0 → 1.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/index.cjs +117 -102
- package/dist/index.d.cts +32 -39
- package/dist/index.d.ts +32 -39
- package/dist/index.js +117 -102
- package/dist/migrations/0055_bigint_money_columns.sql +72 -0
- package/dist/migrations/0056_sync_run_closed_at.sql +53 -0
- package/package.json +8 -32
- package/dist/adapter-BtXT5w9r.d.cts +0 -51
- package/dist/adapter-BtXT5w9r.d.ts +0 -51
- package/dist/pg.cjs +0 -87
- package/dist/pg.d.cts +0 -28
- package/dist/pg.d.ts +0 -28
- package/dist/pg.js +0 -50
- package/dist/postgres-js.cjs +0 -90
- package/dist/postgres-js.d.cts +0 -31
- package/dist/postgres-js.d.ts +0 -31
- package/dist/postgres-js.js +0 -53
package/dist/postgres-js.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
// src/database/postgres-js-adapter.ts
|
|
2
|
-
import postgres from "postgres";
|
|
3
|
-
var PostgresJsAdapter = class {
|
|
4
|
-
sql;
|
|
5
|
-
constructor(config) {
|
|
6
|
-
this.sql = postgres(config.connectionString, {
|
|
7
|
-
max: config.max ?? 10,
|
|
8
|
-
prepare: false
|
|
9
|
-
// Required for Supabase connection pooling
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
async query(sqlQuery, params) {
|
|
13
|
-
const result = await this.sql.unsafe(
|
|
14
|
-
sqlQuery,
|
|
15
|
-
params
|
|
16
|
-
);
|
|
17
|
-
return {
|
|
18
|
-
rows: [...result],
|
|
19
|
-
rowCount: result.count ?? result.length
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
async end() {
|
|
23
|
-
await this.sql.end();
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Execute a function while holding a PostgreSQL advisory lock.
|
|
27
|
-
* Uses a transaction to ensure lock is held for the duration.
|
|
28
|
-
*/
|
|
29
|
-
async withAdvisoryLock(lockId, fn) {
|
|
30
|
-
const result = await this.sql.begin(async (tx) => {
|
|
31
|
-
await tx`SELECT pg_advisory_xact_lock(${lockId})`;
|
|
32
|
-
return await fn();
|
|
33
|
-
});
|
|
34
|
-
return result;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Returns a pg-compatible client for use with libraries that expect pg.Client.
|
|
38
|
-
* Used by pg-node-migrations to run database migrations.
|
|
39
|
-
*/
|
|
40
|
-
toPgClient() {
|
|
41
|
-
return {
|
|
42
|
-
query: async (sql) => {
|
|
43
|
-
const text = typeof sql === "string" ? sql : sql.text;
|
|
44
|
-
const values = typeof sql === "string" ? void 0 : sql.values;
|
|
45
|
-
const rows = await this.sql.unsafe(text, values);
|
|
46
|
-
return { rows: [...rows], rowCount: rows.length };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
export {
|
|
52
|
-
PostgresJsAdapter
|
|
53
|
-
};
|