@supabase/supabase-js 2.76.2-canary.2 → 2.77.0
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/README.md +1 -274
- package/dist/main/lib/version.d.ts +1 -1
- package/dist/main/lib/version.d.ts.map +1 -1
- package/dist/main/lib/version.js +1 -1
- package/dist/main/lib/version.js.map +1 -1
- package/dist/module/lib/version.d.ts +1 -1
- package/dist/module/lib/version.d.ts.map +1 -1
- package/dist/module/lib/version.js +1 -1
- package/dist/module/lib/version.js.map +1 -1
- package/dist/umd/supabase.js +1 -1
- package/package.json +10 -8
- package/src/lib/version.ts +1 -1
package/README.md
CHANGED
|
@@ -146,280 +146,7 @@ npx nx build supabase-js --watch
|
|
|
146
146
|
|
|
147
147
|
### Testing
|
|
148
148
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
#### Prerequisites for All Integration Tests
|
|
152
|
-
|
|
153
|
-
1. **Docker** must be installed and running
|
|
154
|
-
2. **Supabase CLI** must be installed (`npm install -g supabase` or via package manager)
|
|
155
|
-
3. **Local Supabase instance** must be started:
|
|
156
|
-
|
|
157
|
-
```bash
|
|
158
|
-
# Navigate to the supabase-js package directory
|
|
159
|
-
cd packages/core/supabase-js
|
|
160
|
-
|
|
161
|
-
# Start Supabase (downloads and starts all required containers)
|
|
162
|
-
npx supabase start
|
|
163
|
-
|
|
164
|
-
# The output will show:
|
|
165
|
-
# - API URL: http://127.0.0.1:54321
|
|
166
|
-
# - Database URL: postgresql://postgres:postgres@127.0.0.1:54322/postgres
|
|
167
|
-
# - Studio URL: http://127.0.0.1:54323
|
|
168
|
-
# - Anon key: [your-anon-key]
|
|
169
|
-
# - Service role key: [your-service-role-key] # Important for some tests!
|
|
170
|
-
|
|
171
|
-
# Return to monorepo root for running tests
|
|
172
|
-
cd ../../..
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
#### Test Scripts Overview
|
|
176
|
-
|
|
177
|
-
| Script | Description | Requirements |
|
|
178
|
-
| -------------------------- | ----------------------------------------- | --------------------------------------- |
|
|
179
|
-
| `test` | Runs unit tests + type checking | None |
|
|
180
|
-
| `test:all` | Unit + integration + browser tests | Supabase running |
|
|
181
|
-
| `test:run` | Jest unit tests only | None |
|
|
182
|
-
| `test:unit` | Jest unit tests in test/unit directory | None |
|
|
183
|
-
| `test:coverage` | Unit tests with coverage report | None |
|
|
184
|
-
| `test:integration` | Node.js integration tests | Supabase running + SERVICE_ROLE_KEY |
|
|
185
|
-
| `test:integration:browser` | Browser tests using Deno + Puppeteer | Supabase running + Deno installed |
|
|
186
|
-
| `test:edge-functions` | Edge Functions tests | Supabase running + Deno installed |
|
|
187
|
-
| `test:types` | TypeScript type checking + JSR validation | None |
|
|
188
|
-
| `test:bun` | Bun runtime compatibility tests | Supabase running + Bun installed |
|
|
189
|
-
| `test:node:playwright` | WebSocket browser tests | Supabase running + Playwright |
|
|
190
|
-
| Deno (see section below) | Deno runtime compatibility tests | Supabase running + Deno installed |
|
|
191
|
-
| Expo (see section below) | React Native/Expo tests | Supabase running + dependencies updated |
|
|
192
|
-
| Next.js (see below) | Next.js SSR tests | Supabase running + dependencies updated |
|
|
193
|
-
|
|
194
|
-
#### Unit Testing
|
|
195
|
-
|
|
196
|
-
```bash
|
|
197
|
-
# Run all unit tests (Jest)
|
|
198
|
-
npx nx test supabase-js
|
|
199
|
-
|
|
200
|
-
# Run only unit tests in test/unit directory
|
|
201
|
-
npx nx test:unit supabase-js
|
|
202
|
-
|
|
203
|
-
# Run tests in watch mode during development
|
|
204
|
-
npx nx test supabase-js --watch
|
|
205
|
-
|
|
206
|
-
# Run tests with coverage report
|
|
207
|
-
npx nx test:coverage supabase-js
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
#### Integration Testing
|
|
211
|
-
|
|
212
|
-
```bash
|
|
213
|
-
# Prerequisites: Start Supabase first (see above)
|
|
214
|
-
|
|
215
|
-
# Run Node.js integration tests
|
|
216
|
-
# IMPORTANT: Requires SUPABASE_SERVICE_ROLE_KEY environment variable
|
|
217
|
-
cd packages/core/supabase-js
|
|
218
|
-
export SUPABASE_SERVICE_ROLE_KEY="$(npx supabase status --output json | jq -r '.SERVICE_ROLE_KEY')"
|
|
219
|
-
cd ../../..
|
|
220
|
-
npx nx test:integration supabase-js
|
|
221
|
-
|
|
222
|
-
# Run browser-based integration tests (requires Deno)
|
|
223
|
-
npx nx test:integration:browser supabase-js
|
|
224
|
-
```
|
|
225
|
-
|
|
226
|
-
#### Running All Tests
|
|
227
|
-
|
|
228
|
-
```bash
|
|
229
|
-
# This runs type checking, unit tests, and integration tests sequentially
|
|
230
|
-
# NOTE: Will fail if Supabase is not running or dependencies not updated
|
|
231
|
-
npx nx test:all supabase-js
|
|
232
|
-
```
|
|
233
|
-
|
|
234
|
-
**Common Issues and Solutions:**
|
|
235
|
-
|
|
236
|
-
| Issue | Solution |
|
|
237
|
-
| -------------------------------------------- | --------------------------------------------------------------- |
|
|
238
|
-
| "Cannot find module 'https://deno.land/...'" | Deno tests incorrectly run by Jest - check `jest.config.ts` |
|
|
239
|
-
| "Port 54322 already allocated" | Stop existing Supabase: `npx supabase stop --project-id <name>` |
|
|
240
|
-
| "503 Service Unavailable" for Edge Functions | Supabase not running - start with `npx supabase start` |
|
|
241
|
-
| "Uncommitted changes" during type check | Commit changes or add `--allow-dirty` to JSR publish |
|
|
242
|
-
| Integration tests fail with auth errors | Export `SUPABASE_SERVICE_ROLE_KEY` (see Integration Testing) |
|
|
243
|
-
|
|
244
|
-
### Platform-Specific Testing
|
|
245
|
-
|
|
246
|
-
#### Expo Testing (React Native)
|
|
247
|
-
|
|
248
|
-
```bash
|
|
249
|
-
# Prerequisites:
|
|
250
|
-
# 1. Supabase must be running (see Prerequisites)
|
|
251
|
-
# 2. Update test dependencies and pack current build
|
|
252
|
-
cd packages/core/supabase-js
|
|
253
|
-
npm run update:test-deps:expo
|
|
254
|
-
|
|
255
|
-
# Run Expo tests from the Expo test project
|
|
256
|
-
cd test/integration/expo
|
|
257
|
-
npm install
|
|
258
|
-
npm test
|
|
259
|
-
cd ../../..
|
|
260
|
-
```
|
|
261
|
-
|
|
262
|
-
#### Next.js Testing (SSR)
|
|
263
|
-
|
|
264
|
-
```bash
|
|
265
|
-
# Prerequisites:
|
|
266
|
-
# 1. Supabase must be running (see Prerequisites)
|
|
267
|
-
# 2. Update test dependencies and pack current build
|
|
268
|
-
npx nx update:test-deps:next supabase-js
|
|
269
|
-
|
|
270
|
-
# 3. Install Playwright browsers and dependencies
|
|
271
|
-
npx playwright install --with-deps
|
|
272
|
-
|
|
273
|
-
# Run Next.js tests from the Next test project
|
|
274
|
-
cd packages/core/supabase-js/test/integration/next
|
|
275
|
-
npm install --legacy-peer-deps
|
|
276
|
-
npm run test
|
|
277
|
-
cd ../../..
|
|
278
|
-
```
|
|
279
|
-
|
|
280
|
-
#### Deno Testing
|
|
281
|
-
|
|
282
|
-
```bash
|
|
283
|
-
# Prerequisites:
|
|
284
|
-
# 1. Deno must be installed (https://deno.land)
|
|
285
|
-
# 2. Supabase must be running (see Prerequisites)
|
|
286
|
-
# 3. Update test dependencies:
|
|
287
|
-
npx nx update:test-deps:deno supabase-js
|
|
288
|
-
|
|
289
|
-
# Run Deno tests
|
|
290
|
-
npx nx test:deno supabase-js
|
|
291
|
-
```
|
|
292
|
-
|
|
293
|
-
### Edge Functions Testing
|
|
294
|
-
|
|
295
|
-
The project includes Edge Functions integration tests that require a local Supabase instance to be running.
|
|
296
|
-
|
|
297
|
-
```bash
|
|
298
|
-
# Prerequisites:
|
|
299
|
-
# 1. Ensure Docker is installed and running
|
|
300
|
-
# 2. Navigate to the supabase-js package directory
|
|
301
|
-
cd packages/core/supabase-js
|
|
302
|
-
|
|
303
|
-
# 3. Start Supabase locally (this will download and start all required containers)
|
|
304
|
-
npx supabase start
|
|
305
|
-
|
|
306
|
-
# Wait for the output showing all services are ready, including:
|
|
307
|
-
# - API URL: http://127.0.0.1:54321
|
|
308
|
-
# - Database URL: postgresql://postgres:postgres@127.0.0.1:54322/postgres
|
|
309
|
-
# - Edge Runtime container
|
|
310
|
-
|
|
311
|
-
# 4. Run the Edge Functions tests from the monorepo root
|
|
312
|
-
cd ../../../ # Back to monorepo root
|
|
313
|
-
npx nx test:edge-functions supabase-js
|
|
314
|
-
```
|
|
315
|
-
|
|
316
|
-
**Important Notes:**
|
|
317
|
-
|
|
318
|
-
- The Edge Functions tests will fail with 503 errors if Supabase is not running
|
|
319
|
-
- If you encounter port conflicts (e.g., "port 54322 already allocated"), stop any existing Supabase instances:
|
|
320
|
-
|
|
321
|
-
```bash
|
|
322
|
-
npx supabase stop --project-id <project-name>
|
|
323
|
-
# Or stop all Docker containers if unsure:
|
|
324
|
-
docker ps | grep supabase # List all Supabase containers
|
|
325
|
-
```
|
|
326
|
-
|
|
327
|
-
- The tests use the default local development credentials (anon key)
|
|
328
|
-
- Edge Functions are automatically served when `supabase start` is run
|
|
329
|
-
|
|
330
|
-
#### Bun Testing
|
|
331
|
-
|
|
332
|
-
```bash
|
|
333
|
-
# Prerequisites:
|
|
334
|
-
# 1. Bun must be installed (https://bun.sh)
|
|
335
|
-
# 2. Supabase must be running (see Prerequisites)
|
|
336
|
-
# 3. Update test dependencies:
|
|
337
|
-
npx nx update:test-deps:bun supabase-js
|
|
338
|
-
|
|
339
|
-
# Run Bun tests
|
|
340
|
-
npx nx test:bun supabase-js
|
|
341
|
-
```
|
|
342
|
-
|
|
343
|
-
#### WebSocket Browser Testing
|
|
344
|
-
|
|
345
|
-
```bash
|
|
346
|
-
# Prerequisites:
|
|
347
|
-
# 1. Supabase must be running (see Prerequisites)
|
|
348
|
-
# 2. Build the UMD bundle first:
|
|
349
|
-
npx nx build supabase-js
|
|
350
|
-
|
|
351
|
-
# Run WebSocket browser tests with Playwright
|
|
352
|
-
cd packages/core/supabase-js/test/integration/node-browser
|
|
353
|
-
npm install
|
|
354
|
-
cp ../../../dist/umd/supabase.js .
|
|
355
|
-
npm run test
|
|
356
|
-
cd ../../..
|
|
357
|
-
```
|
|
358
|
-
|
|
359
|
-
#### CI/CD Testing
|
|
360
|
-
|
|
361
|
-
When running on CI, the tests automatically use the latest dependencies from the root project. The CI pipeline:
|
|
362
|
-
|
|
363
|
-
1. Builds the main project with current dependencies
|
|
364
|
-
2. Creates a package archive (`.tgz`) with the latest versions
|
|
365
|
-
3. Uses this archive in Expo, Next.js, Deno, and Bun tests to ensure consistency
|
|
366
|
-
|
|
367
|
-
### Updating Test Dependencies
|
|
368
|
-
|
|
369
|
-
The platform-specific tests (Expo, Next.js, Deno, Bun) use a packaged version of supabase-js rather than directly importing from source. This ensures they test the actual built package as it would be consumed by users.
|
|
370
|
-
|
|
371
|
-
#### How It Works
|
|
372
|
-
|
|
373
|
-
1. **Build** the current supabase-js package
|
|
374
|
-
2. **Pack** it into a `.tgz` file (like `npm pack` does)
|
|
375
|
-
3. **Copy** the `.tgz` to the test directory
|
|
376
|
-
4. **Install** it in the test project
|
|
377
|
-
|
|
378
|
-
This mimics how real users would install and use the package.
|
|
379
|
-
|
|
380
|
-
#### Update Scripts
|
|
381
|
-
|
|
382
|
-
```bash
|
|
383
|
-
# Update ALL test environment dependencies at once
|
|
384
|
-
# This builds, packs, and installs in all test directories
|
|
385
|
-
npx nx update:test-deps supabase-js
|
|
386
|
-
|
|
387
|
-
# Or update specific test environments:
|
|
388
|
-
npx nx update:test-deps:expo supabase-js # Expo/React Native only
|
|
389
|
-
npx nx update:test-deps:next supabase-js # Next.js only
|
|
390
|
-
npx nx update:test-deps:deno supabase-js # Deno only
|
|
391
|
-
npx nx update:test-deps:bun supabase-js # Bun only
|
|
392
|
-
```
|
|
393
|
-
|
|
394
|
-
**When to Update:**
|
|
395
|
-
|
|
396
|
-
- After making changes to the source code
|
|
397
|
-
- Before running platform-specific tests locally
|
|
398
|
-
- When debugging test failures that might be due to stale dependencies
|
|
399
|
-
|
|
400
|
-
**Note:** CI automatically handles this, so manual updates are only needed for local development.
|
|
401
|
-
|
|
402
|
-
### Test Coverage
|
|
403
|
-
|
|
404
|
-
#### Viewing Coverage Reports
|
|
405
|
-
|
|
406
|
-
```bash
|
|
407
|
-
# Generate coverage report
|
|
408
|
-
npx nx test:coverage supabase-js
|
|
409
|
-
|
|
410
|
-
# Serve coverage report locally (opens interactive HTML report)
|
|
411
|
-
npx nx serve:coverage supabase-js
|
|
412
|
-
# This starts a local server at http://localhost:3000 with the coverage report
|
|
413
|
-
```
|
|
414
|
-
|
|
415
|
-
The coverage report shows:
|
|
416
|
-
|
|
417
|
-
- Line coverage
|
|
418
|
-
- Branch coverage
|
|
419
|
-
- Function coverage
|
|
420
|
-
- Uncovered lines with highlights
|
|
421
|
-
|
|
422
|
-
Coverage results are also automatically uploaded to Coveralls in CI for tracking over time.
|
|
149
|
+
There's a complete guide on how to set up your environment for running locally the `supabase-js` integration tests. Please refer to [TESTING.md](./TESTING.md).
|
|
423
150
|
|
|
424
151
|
### Contributing
|
|
425
152
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "2.
|
|
1
|
+
export declare const version = "2.77.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../src/lib/version.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../src/lib/version.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,OAAO,WAAW,CAAA"}
|
package/dist/main/lib/version.js
CHANGED
|
@@ -7,5 +7,5 @@ exports.version = void 0;
|
|
|
7
7
|
// - Debugging and support (identifying which version is running)
|
|
8
8
|
// - Telemetry and logging (version reporting in errors/analytics)
|
|
9
9
|
// - Ensuring build artifacts match the published package version
|
|
10
|
-
exports.version = '2.
|
|
10
|
+
exports.version = '2.77.0';
|
|
11
11
|
//# sourceMappingURL=version.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../../src/lib/version.ts"],"names":[],"mappings":";;;AAAA,6EAA6E;AAC7E,gEAAgE;AAChE,uEAAuE;AACvE,iEAAiE;AACjE,kEAAkE;AAClE,iEAAiE;AACpD,QAAA,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../../src/lib/version.ts"],"names":[],"mappings":";;;AAAA,6EAA6E;AAC7E,gEAAgE;AAChE,uEAAuE;AACvE,iEAAiE;AACjE,kEAAkE;AAClE,iEAAiE;AACpD,QAAA,OAAO,GAAG,QAAQ,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "2.
|
|
1
|
+
export declare const version = "2.77.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../src/lib/version.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../src/lib/version.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,OAAO,WAAW,CAAA"}
|
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
// - Debugging and support (identifying which version is running)
|
|
5
5
|
// - Telemetry and logging (version reporting in errors/analytics)
|
|
6
6
|
// - Ensuring build artifacts match the published package version
|
|
7
|
-
export const version = '2.
|
|
7
|
+
export const version = '2.77.0';
|
|
8
8
|
//# sourceMappingURL=version.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../../src/lib/version.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,gEAAgE;AAChE,uEAAuE;AACvE,iEAAiE;AACjE,kEAAkE;AAClE,iEAAiE;AACjE,MAAM,CAAC,MAAM,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../../src/lib/version.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,gEAAgE;AAChE,uEAAuE;AACvE,iEAAiE;AACjE,kEAAkE;AAClE,iEAAiE;AACjE,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAA"}
|