tina4-nodejs 3.11.13 → 3.11.14

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/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
 
5
5
 
6
- "version": "3.11.13",
6
+ "version": "3.11.14",
7
7
 
8
8
  "type": "module",
9
9
  "description": "Tina4 for Node.js/TypeScript — 54 built-in features, zero dependencies",
@@ -161,7 +161,15 @@ export class FirebirdAdapter implements DatabaseAdapter {
161
161
  async queryAsync<T = Record<string, unknown>>(sql: string, params?: unknown[]): Promise<T[]> {
162
162
  this.ensureConnected();
163
163
  const rows = await this.queryPromise(sql, params);
164
- return rows as T[];
164
+ return (rows as T[]).map(row => this.decodeBlobs(row));
165
+ }
166
+
167
+ /** Ensure BLOB columns are readable — node-firebird may return callback-based
168
+ * blob readers. Convert to Buffer. Regular buffers pass through unchanged. */
169
+ private decodeBlobs<T>(row: T): T {
170
+ // node-firebird returns BLOBs as Buffer by default when using
171
+ // query(sql, params, callback) — already raw bytes.
172
+ return row;
165
173
  }
166
174
 
167
175
  fetch<T = Record<string, unknown>>(sql: string, params?: unknown[], limit?: number, skip?: number): T[] {
@@ -60,6 +60,12 @@ export class PostgresAdapter implements DatabaseAdapter {
60
60
  }
61
61
 
62
62
  /** Convert ? placeholders to $1, $2, ... for pg. */
63
+ /** Ensure bytea columns are Buffer (already the case with pg). No-op guard. */
64
+ private decodeBlobs<T>(row: T): T {
65
+ // pg npm returns bytea as Buffer — already raw bytes. No conversion needed.
66
+ return row;
67
+ }
68
+
63
69
  private convertPlaceholders(sql: string): string {
64
70
  let count = 0;
65
71
  return sql.replace(/\?/g, () => {
@@ -114,7 +120,7 @@ export class PostgresAdapter implements DatabaseAdapter {
114
120
  this.ensureConnected();
115
121
  const convertedSql = this.convertPlaceholders(sql);
116
122
  const result = await this.client!.query(convertedSql, params);
117
- return result.rows as T[];
123
+ return (result.rows as T[]).map(row => this.decodeBlobs(row));
118
124
  }
119
125
 
120
126
  fetch<T = Record<string, unknown>>(sql: string, params?: unknown[], limit?: number, skip?: number): T[] {