supabase-test 0.0.9 → 0.0.11

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/esm/helpers.js ADDED
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Helper function to insert a new user into auth.users
3
+ * @param client - The PgTestClient to use (pg or db)
4
+ * @param email - The user's email address
5
+ * @param id - Optional user ID (UUID). If not provided, a random UUID will be generated.
6
+ * @returns The inserted user object with id and email
7
+ */
8
+ export async function insertUser(client, email, id) {
9
+ if (id) {
10
+ return await client.one(`INSERT INTO auth.users (id, email)
11
+ VALUES ($1, $2)
12
+ RETURNING id, email`, [id, email]);
13
+ }
14
+ else {
15
+ return await client.one(`INSERT INTO auth.users (id, email)
16
+ VALUES (gen_random_uuid(), $1)
17
+ RETURNING id, email`, [email]);
18
+ }
19
+ }
package/esm/index.js CHANGED
@@ -1,4 +1,6 @@
1
1
  // Re-export everything from pgsql-test
2
2
  export * from 'pgsql-test';
3
+ // Re-export everything from helpers.ts
4
+ export * from './helpers';
3
5
  // Export Supabase-specific getConnections with defaults baked in
4
6
  export { getConnections } from './connect';
package/helpers.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ import { PgTestClient } from 'pgsql-test';
2
+ /**
3
+ * Helper function to insert a new user into auth.users
4
+ * @param client - The PgTestClient to use (pg or db)
5
+ * @param email - The user's email address
6
+ * @param id - Optional user ID (UUID). If not provided, a random UUID will be generated.
7
+ * @returns The inserted user object with id and email
8
+ */
9
+ export declare function insertUser(client: PgTestClient, email: string, id?: string): Promise<{
10
+ id: string;
11
+ email: string;
12
+ }>;
package/helpers.js ADDED
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.insertUser = insertUser;
4
+ /**
5
+ * Helper function to insert a new user into auth.users
6
+ * @param client - The PgTestClient to use (pg or db)
7
+ * @param email - The user's email address
8
+ * @param id - Optional user ID (UUID). If not provided, a random UUID will be generated.
9
+ * @returns The inserted user object with id and email
10
+ */
11
+ async function insertUser(client, email, id) {
12
+ if (id) {
13
+ return await client.one(`INSERT INTO auth.users (id, email)
14
+ VALUES ($1, $2)
15
+ RETURNING id, email`, [id, email]);
16
+ }
17
+ else {
18
+ return await client.one(`INSERT INTO auth.users (id, email)
19
+ VALUES (gen_random_uuid(), $1)
20
+ RETURNING id, email`, [email]);
21
+ }
22
+ }
package/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from 'pgsql-test';
2
+ export * from './helpers';
2
3
  export { getConnections } from './connect';
3
4
  export type { GetConnectionOpts, GetConnectionResult } from './connect';
package/index.js CHANGED
@@ -17,6 +17,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.getConnections = void 0;
18
18
  // Re-export everything from pgsql-test
19
19
  __exportStar(require("pgsql-test"), exports);
20
+ // Re-export everything from helpers.ts
21
+ __exportStar(require("./helpers"), exports);
20
22
  // Export Supabase-specific getConnections with defaults baked in
21
23
  var connect_1 = require("./connect");
22
24
  Object.defineProperty(exports, "getConnections", { enumerable: true, get: function () { return connect_1.getConnections; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "supabase-test",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
4
4
  "author": "Interweb <developers@interweb.io>",
5
5
  "description": "supabase-test offers isolated, role-aware, and rollback-friendly PostgreSQL environments for integration tests with Supabase defaults baked in",
6
6
  "main": "index.js",
@@ -54,7 +54,7 @@
54
54
  "dependencies": {
55
55
  "@launchql/types": "^2.6.2",
56
56
  "pg-env": "^1.1.0",
57
- "pgsql-test": "^2.11.10"
57
+ "pgsql-test": "^2.11.11"
58
58
  },
59
- "gitHead": "870ab4d6b6b501ac6bdda660d44a0581e2145ad4"
59
+ "gitHead": "2df3130634373390ff11d875cdfc7556d0e218d4"
60
60
  }