@surf-ai/sdk 1.0.0-alpha.32 → 1.0.0-alpha.34

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.
@@ -34,12 +34,13 @@ declare function watchSchema(schemaPath: string, options?: {
34
34
  /**
35
35
  * @surf-ai/sdk/db — Database helpers via HTTP proxy to Neon PostgreSQL.
36
36
  *
37
- * All queries go through the Surf API proxy there is no direct database
38
- * connection or Drizzle ORM query builder. Use dbQuery() for all reads/writes.
37
+ * All queries go through the Surf API proxy. There is no locally-instantiated
38
+ * Drizzle ORM client `drizzle-orm/pg-core` is used only to declare the
39
+ * schema; reads and writes go through dbQuery().
39
40
  *
40
41
  * Usage:
41
42
  * const { dbQuery } = require('@surf-ai/sdk/db')
42
- * const users = await dbQuery('SELECT * FROM users WHERE id = $1', [userId])
43
+ * const { rows } = await dbQuery('SELECT * FROM users WHERE id = $1', [userId])
43
44
  */
44
45
 
45
46
  /**
@@ -54,14 +55,25 @@ declare function dbProvision(): Promise<{
54
55
  }>;
55
56
  /**
56
57
  * Execute a SQL query via db/query.
57
- * Uses pg-proxy driver under the hood — Drizzle ORM calls this automatically.
58
58
  *
59
- * @param options.arrayMode - When true, rows are returned as positional arrays
60
- * instead of objects. Required for Drizzle ORM pg-proxy compatibility.
59
+ * Returns a pg-style result use `result.rows` for the row data:
60
+ * const { rows } = await dbQuery('SELECT * FROM users')
61
+ * const [row] = (await dbQuery('INSERT ... RETURNING *', [...])).rows
62
+ *
63
+ * @param options.arrayMode - When true, each row is a positional array instead
64
+ * of an object keyed by column name. Default false (object rows).
61
65
  */
62
66
  declare function dbQuery(sql: string, params?: any[], options?: {
63
67
  arrayMode?: boolean;
64
- }): Promise<any>;
68
+ }): Promise<{
69
+ rows: any[];
70
+ rowCount?: number;
71
+ fields?: Array<{
72
+ name: string;
73
+ type: string;
74
+ }>;
75
+ truncated?: boolean;
76
+ }>;
65
77
  /**
66
78
  * List tables in the user's database.
67
79
  */
@@ -34,12 +34,13 @@ declare function watchSchema(schemaPath: string, options?: {
34
34
  /**
35
35
  * @surf-ai/sdk/db — Database helpers via HTTP proxy to Neon PostgreSQL.
36
36
  *
37
- * All queries go through the Surf API proxy there is no direct database
38
- * connection or Drizzle ORM query builder. Use dbQuery() for all reads/writes.
37
+ * All queries go through the Surf API proxy. There is no locally-instantiated
38
+ * Drizzle ORM client `drizzle-orm/pg-core` is used only to declare the
39
+ * schema; reads and writes go through dbQuery().
39
40
  *
40
41
  * Usage:
41
42
  * const { dbQuery } = require('@surf-ai/sdk/db')
42
- * const users = await dbQuery('SELECT * FROM users WHERE id = $1', [userId])
43
+ * const { rows } = await dbQuery('SELECT * FROM users WHERE id = $1', [userId])
43
44
  */
44
45
 
45
46
  /**
@@ -54,14 +55,25 @@ declare function dbProvision(): Promise<{
54
55
  }>;
55
56
  /**
56
57
  * Execute a SQL query via db/query.
57
- * Uses pg-proxy driver under the hood — Drizzle ORM calls this automatically.
58
58
  *
59
- * @param options.arrayMode - When true, rows are returned as positional arrays
60
- * instead of objects. Required for Drizzle ORM pg-proxy compatibility.
59
+ * Returns a pg-style result use `result.rows` for the row data:
60
+ * const { rows } = await dbQuery('SELECT * FROM users')
61
+ * const [row] = (await dbQuery('INSERT ... RETURNING *', [...])).rows
62
+ *
63
+ * @param options.arrayMode - When true, each row is a positional array instead
64
+ * of an object keyed by column name. Default false (object rows).
61
65
  */
62
66
  declare function dbQuery(sql: string, params?: any[], options?: {
63
67
  arrayMode?: boolean;
64
- }): Promise<any>;
68
+ }): Promise<{
69
+ rows: any[];
70
+ rowCount?: number;
71
+ fields?: Array<{
72
+ name: string;
73
+ type: string;
74
+ }>;
75
+ truncated?: boolean;
76
+ }>;
65
77
  /**
66
78
  * List tables in the user's database.
67
79
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@surf-ai/sdk",
3
- "version": "1.0.0-alpha.32",
3
+ "version": "1.0.0-alpha.34",
4
4
  "description": "Surf platform SDK — data API client, server runtime, and database helpers",
5
5
  "type": "module",
6
6
  "exports": {