@supabase/postgrest-js 2.71.2-canary.7 → 2.72.1-canary.2
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 +131 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.d.ts.map +1 -1
- package/dist/cjs/version.js +7 -1
- package/dist/cjs/version.js.map +1 -1
- package/package.json +1 -1
- package/src/version.ts +7 -1
package/README.md
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
[](#license)
|
|
6
6
|
[](https://pkg.pr.new/~/supabase/postgrest-js)
|
|
7
7
|
|
|
8
|
-
|
|
9
8
|
Isomorphic JavaScript client for [PostgREST](https://postgrest.org). The goal of this library is to make an "ORM-like" restful interface.
|
|
10
9
|
|
|
11
10
|
Full documentation can be found [here](https://supabase.github.io/postgrest-js/v2).
|
|
@@ -45,6 +44,137 @@ const postgrest = new PostgrestClient(REST_URL, {
|
|
|
45
44
|
})
|
|
46
45
|
```
|
|
47
46
|
|
|
47
|
+
## Development
|
|
48
|
+
|
|
49
|
+
This package is part of the [Supabase JavaScript monorepo](https://github.com/supabase/supabase-js-libs). To work on this package:
|
|
50
|
+
|
|
51
|
+
### Building
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# Complete build (from monorepo root)
|
|
55
|
+
npx nx build postgrest-js
|
|
56
|
+
|
|
57
|
+
# Build with watch mode for development
|
|
58
|
+
npx nx build postgrest-js --watch
|
|
59
|
+
|
|
60
|
+
# Individual build targets
|
|
61
|
+
npx nx build:cjs postgrest-js # CommonJS build
|
|
62
|
+
npx nx build:esm postgrest-js # ES Modules wrapper
|
|
63
|
+
|
|
64
|
+
# Other useful commands
|
|
65
|
+
npx nx clean postgrest-js # Clean build artifacts
|
|
66
|
+
npx nx format postgrest-js # Format code with Prettier
|
|
67
|
+
npx nx lint postgrest-js # Run ESLint
|
|
68
|
+
npx nx type-check postgrest-js # TypeScript type checking
|
|
69
|
+
npx nx docs postgrest-js # Generate documentation
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
#### Build Outputs
|
|
73
|
+
|
|
74
|
+
- **CommonJS (`dist/cjs/`)** - For Node.js environments
|
|
75
|
+
- `index.js` - Main entry point
|
|
76
|
+
- `index.d.ts` - TypeScript definitions
|
|
77
|
+
- **ES Modules (`dist/esm/`)** - For modern bundlers
|
|
78
|
+
- `wrapper.mjs` - ESM wrapper that imports CommonJS
|
|
79
|
+
|
|
80
|
+
#### Special Build Setup
|
|
81
|
+
|
|
82
|
+
Unlike other packages, postgrest-js uses a hybrid approach:
|
|
83
|
+
|
|
84
|
+
- The main code is compiled to CommonJS
|
|
85
|
+
- An ESM wrapper (`wrapper.mjs`) is provided for ES Module environments
|
|
86
|
+
- This ensures maximum compatibility across different JavaScript environments
|
|
87
|
+
|
|
88
|
+
The `wrapper.mjs` file simply re-exports the CommonJS build, allowing the package to work seamlessly in both CommonJS and ESM contexts.
|
|
89
|
+
|
|
90
|
+
### Testing
|
|
91
|
+
|
|
92
|
+
**Docker Required!** The postgrest-js tests need a local PostgreSQL database and PostgREST server running in Docker containers.
|
|
93
|
+
|
|
94
|
+
#### Quick Start
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
# Run all tests (from monorepo root)
|
|
98
|
+
npx nx test postgrest-js
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
This single command automatically:
|
|
102
|
+
|
|
103
|
+
1. Cleans any existing test containers
|
|
104
|
+
2. Starts PostgreSQL database and PostgREST server in Docker
|
|
105
|
+
3. Waits for services to be ready
|
|
106
|
+
4. Runs format checking
|
|
107
|
+
5. Runs TypeScript type tests
|
|
108
|
+
6. Generates and validates TypeScript types from the database schema
|
|
109
|
+
7. Runs all Jest unit tests with coverage
|
|
110
|
+
8. Runs CommonJS and ESM smoke tests
|
|
111
|
+
9. Cleans up Docker containers
|
|
112
|
+
|
|
113
|
+
#### Individual Test Commands
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
# Run tests with coverage
|
|
117
|
+
npx nx test:run postgrest-js
|
|
118
|
+
|
|
119
|
+
# Update test snapshots and regenerate types
|
|
120
|
+
npx nx test:update postgrest-js
|
|
121
|
+
|
|
122
|
+
# Type checking only
|
|
123
|
+
npx nx test:types postgrest-js
|
|
124
|
+
|
|
125
|
+
# Format checking
|
|
126
|
+
npx nx format:check postgrest-js
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
#### Test Infrastructure
|
|
130
|
+
|
|
131
|
+
The tests use Docker Compose to spin up:
|
|
132
|
+
|
|
133
|
+
- **PostgreSQL** - Database with test schema and dummy data
|
|
134
|
+
- **PostgREST** - REST API server that the client connects to
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
# Manually manage test infrastructure
|
|
138
|
+
npx nx db:run postgrest-js # Start containers
|
|
139
|
+
npx nx db:clean postgrest-js # Stop and remove containers
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
#### What `test:update` Does
|
|
143
|
+
|
|
144
|
+
The `test:update` command is useful when:
|
|
145
|
+
|
|
146
|
+
- Database schema changes require updating TypeScript types
|
|
147
|
+
- Test snapshots need to be updated after intentional changes
|
|
148
|
+
|
|
149
|
+
It performs these steps:
|
|
150
|
+
|
|
151
|
+
1. Starts fresh database containers
|
|
152
|
+
2. **Regenerates TypeScript types** from the actual database schema
|
|
153
|
+
3. **Updates Jest snapshots** for all tests
|
|
154
|
+
4. Cleans up containers
|
|
155
|
+
|
|
156
|
+
#### Test Types Explained
|
|
157
|
+
|
|
158
|
+
- **Format Check** - Ensures code formatting with Prettier
|
|
159
|
+
- **Type Tests** - Validates TypeScript types using `tstyche`
|
|
160
|
+
- **Generated Types Test** - Ensures generated types match database schema
|
|
161
|
+
- **Unit Tests** - Jest tests covering all client functionality
|
|
162
|
+
- **Smoke Tests** - Basic import/require tests for CommonJS and ESM
|
|
163
|
+
|
|
164
|
+
#### Prerequisites
|
|
165
|
+
|
|
166
|
+
- **Docker** must be installed and running
|
|
167
|
+
- **Port 3000** - PostgREST server (API)
|
|
168
|
+
- **Port 8080** - Database schema endpoint (for type generation)
|
|
169
|
+
|
|
170
|
+
**Note:** Unlike a full Supabase instance, this uses a minimal PostgREST setup specifically for testing the client library.
|
|
171
|
+
|
|
172
|
+
### Contributing
|
|
173
|
+
|
|
174
|
+
We welcome contributions! Please see our [Contributing Guide](../../../CONTRIBUTING.md) for details on how to get started.
|
|
175
|
+
|
|
176
|
+
For major changes or if you're unsure about something, please open an issue first to discuss your proposed changes.
|
|
177
|
+
|
|
48
178
|
## License
|
|
49
179
|
|
|
50
180
|
This repo is licensed under MIT License.
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "
|
|
1
|
+
export declare const version = "2.72.1-canary.2";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,OAAO,oBAAoB,CAAA"}
|
package/dist/cjs/version.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.version = void 0;
|
|
4
|
-
|
|
4
|
+
// Generated automatically during releases by scripts/update-version-files.js
|
|
5
|
+
// This file provides runtime access to the package version for:
|
|
6
|
+
// - HTTP request headers (e.g., X-Client-Info header for API requests)
|
|
7
|
+
// - Debugging and support (identifying which version is running)
|
|
8
|
+
// - Telemetry and logging (version reporting in errors/analytics)
|
|
9
|
+
// - Ensuring build artifacts match the published package version
|
|
10
|
+
exports.version = '2.72.1-canary.2';
|
|
5
11
|
//# sourceMappingURL=version.js.map
|
package/dist/cjs/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;;AAAA,6EAA6E;AAC7E,gEAAgE;AAChE,uEAAuE;AACvE,iEAAiE;AACjE,kEAAkE;AAClE,iEAAiE;AACpD,QAAA,OAAO,GAAG,iBAAiB,CAAA"}
|
package/package.json
CHANGED
package/src/version.ts
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
// Generated automatically during releases by scripts/update-version-files.js
|
|
2
|
+
// This file provides runtime access to the package version for:
|
|
3
|
+
// - HTTP request headers (e.g., X-Client-Info header for API requests)
|
|
4
|
+
// - Debugging and support (identifying which version is running)
|
|
5
|
+
// - Telemetry and logging (version reporting in errors/analytics)
|
|
6
|
+
// - Ensuring build artifacts match the published package version
|
|
7
|
+
export const version = '2.72.1-canary.2'
|