postgresdk 0.9.9 → 0.10.1
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/LICENSE +21 -0
- package/README.md +50 -0
- package/dist/cli.js +593 -85
- package/dist/emit-where-types.d.ts +4 -0
- package/dist/index.js +534 -42
- package/package.json +11 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 postgresdk contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -160,6 +160,7 @@ const authors = await sdk.authors.list({
|
|
|
160
160
|
### Filtering & Pagination
|
|
161
161
|
|
|
162
162
|
```typescript
|
|
163
|
+
// Simple equality filtering
|
|
163
164
|
const users = await sdk.users.list({
|
|
164
165
|
where: { status: "active" },
|
|
165
166
|
orderBy: "created_at",
|
|
@@ -167,8 +168,57 @@ const users = await sdk.users.list({
|
|
|
167
168
|
limit: 20,
|
|
168
169
|
offset: 40
|
|
169
170
|
});
|
|
171
|
+
|
|
172
|
+
// Advanced WHERE operators
|
|
173
|
+
const filtered = await sdk.users.list({
|
|
174
|
+
where: {
|
|
175
|
+
age: { $gte: 18, $lt: 65 }, // Range queries
|
|
176
|
+
email: { $ilike: '%@company.com' }, // Pattern matching
|
|
177
|
+
status: { $in: ['active', 'pending'] }, // Array matching
|
|
178
|
+
deleted_at: { $is: null } // NULL checks
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
// OR logic - match any condition
|
|
183
|
+
const results = await sdk.users.list({
|
|
184
|
+
where: {
|
|
185
|
+
$or: [
|
|
186
|
+
{ email: { $ilike: '%@gmail.com' } },
|
|
187
|
+
{ email: { $ilike: '%@yahoo.com' } },
|
|
188
|
+
{ status: 'premium' }
|
|
189
|
+
]
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
// Complex queries with AND/OR
|
|
194
|
+
const complex = await sdk.users.list({
|
|
195
|
+
where: {
|
|
196
|
+
status: 'active', // Implicit AND at root level
|
|
197
|
+
$or: [
|
|
198
|
+
{ age: { $lt: 18 } },
|
|
199
|
+
{ age: { $gt: 65 } }
|
|
200
|
+
]
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
// Nested logic (2 levels)
|
|
205
|
+
const nested = await sdk.users.list({
|
|
206
|
+
where: {
|
|
207
|
+
$and: [
|
|
208
|
+
{
|
|
209
|
+
$or: [
|
|
210
|
+
{ firstName: { $ilike: '%john%' } },
|
|
211
|
+
{ lastName: { $ilike: '%john%' } }
|
|
212
|
+
]
|
|
213
|
+
},
|
|
214
|
+
{ status: 'active' }
|
|
215
|
+
]
|
|
216
|
+
}
|
|
217
|
+
});
|
|
170
218
|
```
|
|
171
219
|
|
|
220
|
+
See the generated SDK documentation for all available operators: `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$in`, `$nin`, `$like`, `$ilike`, `$is`, `$isNot`, `$or`, `$and`.
|
|
221
|
+
|
|
172
222
|
## Authentication
|
|
173
223
|
|
|
174
224
|
postgresdk supports API key and JWT authentication:
|