postgresai 0.14.0-dev.74 → 0.14.0-dev.76

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.
Files changed (32) hide show
  1. package/bin/postgres-ai.ts +312 -6
  2. package/dist/bin/postgres-ai.js +327 -21
  3. package/dist/sql/02.extensions.sql +8 -0
  4. package/dist/sql/{02.permissions.sql → 03.permissions.sql} +1 -0
  5. package/dist/sql/sql/02.extensions.sql +8 -0
  6. package/dist/sql/sql/{02.permissions.sql → 03.permissions.sql} +1 -0
  7. package/dist/sql/sql/uninit/01.helpers.sql +5 -0
  8. package/dist/sql/sql/uninit/02.permissions.sql +30 -0
  9. package/dist/sql/sql/uninit/03.role.sql +27 -0
  10. package/dist/sql/uninit/01.helpers.sql +5 -0
  11. package/dist/sql/uninit/02.permissions.sql +30 -0
  12. package/dist/sql/uninit/03.role.sql +27 -0
  13. package/lib/init.ts +109 -8
  14. package/lib/metrics-embedded.ts +1 -1
  15. package/lib/supabase.ts +2 -10
  16. package/package.json +1 -1
  17. package/sql/02.extensions.sql +8 -0
  18. package/sql/{02.permissions.sql → 03.permissions.sql} +1 -0
  19. package/sql/uninit/01.helpers.sql +5 -0
  20. package/sql/uninit/02.permissions.sql +30 -0
  21. package/sql/uninit/03.role.sql +27 -0
  22. package/test/init.test.ts +245 -11
  23. package/test/supabase.test.ts +0 -59
  24. /package/dist/sql/{03.optional_rds.sql → 04.optional_rds.sql} +0 -0
  25. /package/dist/sql/{04.optional_self_managed.sql → 05.optional_self_managed.sql} +0 -0
  26. /package/dist/sql/{05.helpers.sql → 06.helpers.sql} +0 -0
  27. /package/dist/sql/sql/{03.optional_rds.sql → 04.optional_rds.sql} +0 -0
  28. /package/dist/sql/sql/{04.optional_self_managed.sql → 05.optional_self_managed.sql} +0 -0
  29. /package/dist/sql/sql/{05.helpers.sql → 06.helpers.sql} +0 -0
  30. /package/sql/{03.optional_rds.sql → 04.optional_rds.sql} +0 -0
  31. /package/sql/{04.optional_self_managed.sql → 05.optional_self_managed.sql} +0 -0
  32. /package/sql/{05.helpers.sql → 06.helpers.sql} +0 -0
@@ -2,7 +2,6 @@ import { describe, expect, test, beforeEach, afterEach, mock } from "bun:test";
2
2
  import {
3
3
  resolveSupabaseConfig,
4
4
  extractProjectRefFromUrl,
5
- fetchPoolerDatabaseUrl,
6
5
  SupabaseClient,
7
6
  applyInitPlanViaSupabase,
8
7
  verifyInitSetupViaSupabase,
@@ -138,64 +137,6 @@ describe("Supabase module", () => {
138
137
  });
139
138
  });
140
139
 
141
- describe("fetchPoolerDatabaseUrl", () => {
142
- const originalFetch = globalThis.fetch;
143
-
144
- afterEach(() => {
145
- globalThis.fetch = originalFetch;
146
- });
147
-
148
- test("returns pooler db url with username including project ref (db_host/db_port/db_name response)", async () => {
149
- globalThis.fetch = mock(() =>
150
- Promise.resolve(
151
- new Response(
152
- JSON.stringify([
153
- {
154
- db_host: "aws-1-eu-west-1.pooler.supabase.com",
155
- db_port: 6543,
156
- db_name: "postgres",
157
- },
158
- ]),
159
- { status: 200 }
160
- )
161
- )
162
- ) as unknown as typeof fetch;
163
-
164
- const url = await fetchPoolerDatabaseUrl(
165
- { projectRef: "xhaqmsvczjkkvkgdyast", accessToken: "token" },
166
- "postgres_ai_mon"
167
- );
168
- expect(url).toBe(
169
- "postgresql://postgres_ai_mon.xhaqmsvczjkkvkgdyast@aws-1-eu-west-1.pooler.supabase.com:6543/postgres"
170
- );
171
- });
172
-
173
- test("does not double-append project ref if username already has it", async () => {
174
- globalThis.fetch = mock(() =>
175
- Promise.resolve(
176
- new Response(
177
- JSON.stringify([
178
- {
179
- db_host: "aws-1-eu-west-1.pooler.supabase.com",
180
- db_port: 6543,
181
- db_name: "postgres",
182
- },
183
- ]),
184
- { status: 200 }
185
- )
186
- )
187
- ) as unknown as typeof fetch;
188
-
189
- const url = await fetchPoolerDatabaseUrl(
190
- { projectRef: "xhaqmsvczjkkvkgdyast", accessToken: "token" },
191
- "postgres_ai_mon.xhaqmsvczjkkvkgdyast"
192
- );
193
- expect(url).toBe(
194
- "postgresql://postgres_ai_mon.xhaqmsvczjkkvkgdyast@aws-1-eu-west-1.pooler.supabase.com:6543/postgres"
195
- );
196
- });
197
- });
198
-
199
140
  describe("SupabaseClient", () => {
200
141
  test("throws error when project ref is empty", () => {
201
142
  expect(() => new SupabaseClient({ projectRef: "", accessToken: "token" })).toThrow(
File without changes
File without changes
File without changes