@wowsql/sdk 3.4.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/CHANGELOG.md +296 -0
- package/LICENSE +22 -0
- package/README.md +990 -0
- package/dist/auth.d.ts +160 -0
- package/dist/auth.js +320 -0
- package/dist/errors.d.ts +5 -0
- package/dist/errors.js +12 -0
- package/dist/index.d.ts +180 -0
- package/dist/index.js +264 -0
- package/dist/schema.d.ts +58 -0
- package/dist/schema.js +116 -0
- package/dist/storage.d.ts +395 -0
- package/dist/storage.js +404 -0
- package/package.json +65 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to the WOWSQL TypeScript SDK will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [3.4.0] - 2025-11-22
|
|
9
|
+
|
|
10
|
+
### Added - Schema Management 🔧
|
|
11
|
+
|
|
12
|
+
- **New `WOWSQLSchema` class** for programmatic database schema management
|
|
13
|
+
- Full schema CRUD operations with service role key authentication
|
|
14
|
+
- Schema modification capabilities for production databases
|
|
15
|
+
|
|
16
|
+
#### Schema Features
|
|
17
|
+
- **Create Tables**: Define tables with columns, primary keys, and indexes
|
|
18
|
+
- **Alter Tables**: Add, modify, drop, or rename columns
|
|
19
|
+
- **Drop Tables**: Remove tables with optional CASCADE support
|
|
20
|
+
- **Execute SQL**: Run raw SQL for custom schema operations
|
|
21
|
+
|
|
22
|
+
#### Schema API Methods
|
|
23
|
+
- `createTable(options)` - Create new tables with full column definitions
|
|
24
|
+
- `alterTable(options)` - Modify existing table structure
|
|
25
|
+
- `dropTable(tableName, cascade?)` - Drop tables safely
|
|
26
|
+
- `executeSQL(sql)` - Execute custom schema SQL statements
|
|
27
|
+
|
|
28
|
+
#### Security & Validation
|
|
29
|
+
- **Service Role Key Required**: Schema operations strictly require service role keys
|
|
30
|
+
- **403 Error Handling**: Clear error messages when using anonymous keys
|
|
31
|
+
- **Permission Validation**: Automatic validation of API key permissions
|
|
32
|
+
- **Safe Operations**: Built-in safeguards for destructive operations
|
|
33
|
+
|
|
34
|
+
#### TypeScript Interfaces
|
|
35
|
+
- `ColumnDefinition` - Column specification with constraints
|
|
36
|
+
- `CreateTableOptions` - Table creation configuration
|
|
37
|
+
- `AlterTableOptions` - Table alteration specification
|
|
38
|
+
- Complete type definitions for all schema operations
|
|
39
|
+
|
|
40
|
+
#### Examples & Documentation
|
|
41
|
+
- Backend migration script examples (Next.js API routes)
|
|
42
|
+
- Schema management best practices
|
|
43
|
+
- Security guidelines for service key usage
|
|
44
|
+
- Comprehensive README section with code examples
|
|
45
|
+
|
|
46
|
+
### Updated
|
|
47
|
+
- README with comprehensive schema management documentation
|
|
48
|
+
- Export statements to include schema classes and interfaces
|
|
49
|
+
- Version bumped to 3.4.0
|
|
50
|
+
|
|
51
|
+
### Documentation
|
|
52
|
+
- Schema management quick start guide
|
|
53
|
+
- Service role key vs anonymous key usage
|
|
54
|
+
- Migration script templates
|
|
55
|
+
- Error handling patterns
|
|
56
|
+
|
|
57
|
+
## [3.3.0] - 2025-11-11
|
|
58
|
+
|
|
59
|
+
### Added - API Keys Documentation
|
|
60
|
+
|
|
61
|
+
- Comprehensive API keys documentation section in README
|
|
62
|
+
- Clear separation between Database Operations keys and Authentication Operations keys
|
|
63
|
+
- Documentation for Service Role Key, Public API Key, and Anonymous Key
|
|
64
|
+
- Usage examples for each key type
|
|
65
|
+
- Security best practices guide
|
|
66
|
+
- Troubleshooting section for common key-related errors
|
|
67
|
+
|
|
68
|
+
### Updated
|
|
69
|
+
|
|
70
|
+
- Enhanced `WOWSQLClient` class documentation to clarify it's for DATABASE OPERATIONS
|
|
71
|
+
- Enhanced `ProjectAuthClient` class documentation to clarify it's for AUTHENTICATION OPERATIONS
|
|
72
|
+
- Updated FAQ section with improved browser usage guidance
|
|
73
|
+
- Version bumped to 3.3.0
|
|
74
|
+
|
|
75
|
+
### Documentation
|
|
76
|
+
|
|
77
|
+
- README now includes comprehensive API keys section with:
|
|
78
|
+
- Key types overview table
|
|
79
|
+
- Where to find keys in dashboard
|
|
80
|
+
- Database operations examples
|
|
81
|
+
- Authentication operations examples
|
|
82
|
+
- Environment variables best practices
|
|
83
|
+
- Security best practices
|
|
84
|
+
- Troubleshooting guide
|
|
85
|
+
|
|
86
|
+
## [2.2.0] - 2025-11-10
|
|
87
|
+
|
|
88
|
+
### Added - Project Authentication
|
|
89
|
+
|
|
90
|
+
- New `ProjectAuthClient` for signup/login/OAuth flows against the project auth service
|
|
91
|
+
- Session helpers (`getSession`, `setSession`, `clearSession`) to persist tokens client-side
|
|
92
|
+
- Utility to generate provider authorization URLs per project
|
|
93
|
+
|
|
94
|
+
### Updated
|
|
95
|
+
- Exports now include the auth client alongside the database/storage clients
|
|
96
|
+
- Package metadata and docs mention project auth support
|
|
97
|
+
|
|
98
|
+
### Documentation
|
|
99
|
+
- README and publishing guides now include auth quick-start snippets and notes
|
|
100
|
+
|
|
101
|
+
## [2.1.0] - 2025-10-16
|
|
102
|
+
|
|
103
|
+
### Added - S3 Storage Support 🚀
|
|
104
|
+
|
|
105
|
+
#### Storage Client
|
|
106
|
+
- **New `WOWSQLStorage` class** for S3-compatible object storage
|
|
107
|
+
- Full CRUD operations for file management
|
|
108
|
+
- Storage quota tracking and enforcement
|
|
109
|
+
- Client-side storage limit validation
|
|
110
|
+
- Multi-region support
|
|
111
|
+
|
|
112
|
+
#### Storage Features
|
|
113
|
+
- **File Upload**: Upload files with automatic quota checking
|
|
114
|
+
- **File Download**: Get presigned URLs or download files directly
|
|
115
|
+
- **File Listing**: List all files with metadata (size, type, modified date)
|
|
116
|
+
- **File Deletion**: Delete files and free up storage space
|
|
117
|
+
- **Quota Management**: Check available storage and usage limits
|
|
118
|
+
|
|
119
|
+
#### Storage API Methods
|
|
120
|
+
- `upload(file, key, options?)` - Upload file to S3
|
|
121
|
+
- `download(key)` - Get presigned download URL
|
|
122
|
+
- `list(prefix?, limit?)` - List files with optional filtering
|
|
123
|
+
- `delete(key)` - Delete file from storage
|
|
124
|
+
- `getQuota()` - Get storage quota information
|
|
125
|
+
- `getFileInfo(key)` - Get detailed file metadata
|
|
126
|
+
|
|
127
|
+
#### Storage Error Handling
|
|
128
|
+
- `StorageLimitExceededError` - Thrown when storage quota is exceeded
|
|
129
|
+
- `StorageError` - Base error class for storage operations
|
|
130
|
+
- Comprehensive error messages with suggestions
|
|
131
|
+
|
|
132
|
+
#### Storage Types
|
|
133
|
+
- `StorageQuota` - Storage limit and usage information
|
|
134
|
+
- `StorageFile` - File metadata interface
|
|
135
|
+
- `UploadOptions` - Configuration for file uploads
|
|
136
|
+
- Complete TypeScript type definitions
|
|
137
|
+
|
|
138
|
+
#### Examples
|
|
139
|
+
- Complete storage usage examples
|
|
140
|
+
- File upload/download workflows
|
|
141
|
+
- Quota management patterns
|
|
142
|
+
- Error handling best practices
|
|
143
|
+
|
|
144
|
+
### Updated
|
|
145
|
+
- Package description to mention S3 Storage support
|
|
146
|
+
- README with storage documentation
|
|
147
|
+
- Version bumped to 2.1.0
|
|
148
|
+
- Export statements to include storage classes
|
|
149
|
+
|
|
150
|
+
### Documentation
|
|
151
|
+
- Storage SDK architecture diagram
|
|
152
|
+
- Quick start guide for storage
|
|
153
|
+
- API reference for storage methods
|
|
154
|
+
- Implementation examples
|
|
155
|
+
|
|
156
|
+
## [2.0.0] - 2025-10-10
|
|
157
|
+
|
|
158
|
+
### Added
|
|
159
|
+
- Complete TypeScript SDK with full type safety
|
|
160
|
+
- Fluent query builder API
|
|
161
|
+
- Support for all CRUD operations (Create, Read, Update, Delete)
|
|
162
|
+
- Advanced filtering with multiple operators (eq, neq, gt, gte, lt, lte, like, is)
|
|
163
|
+
- Pagination support (limit, offset)
|
|
164
|
+
- Sorting capabilities (order, orderDirection)
|
|
165
|
+
- Raw SQL query execution
|
|
166
|
+
- Table schema introspection
|
|
167
|
+
- Health check endpoint
|
|
168
|
+
- Comprehensive error handling with `WOWSQLError` class
|
|
169
|
+
- TypeScript generics support for type-safe queries
|
|
170
|
+
- Configurable timeout option
|
|
171
|
+
- Full JSDoc documentation
|
|
172
|
+
- Tree-shakeable exports
|
|
173
|
+
|
|
174
|
+
### Features
|
|
175
|
+
- **Zero Configuration**: Simple initialization with projectUrl and apiKey
|
|
176
|
+
- **Type-Safe**: Full TypeScript support with generics for all operations
|
|
177
|
+
- **Fluent API**: Chainable query builder pattern for intuitive querying
|
|
178
|
+
- **Lightweight**: Minimal dependencies (only axios)
|
|
179
|
+
- **Error Handling**: Comprehensive error messages with status codes
|
|
180
|
+
|
|
181
|
+
### Examples
|
|
182
|
+
- Next.js App Router integration
|
|
183
|
+
- React hooks
|
|
184
|
+
- Express.js API
|
|
185
|
+
- TypeScript with generics
|
|
186
|
+
|
|
187
|
+
### Documentation
|
|
188
|
+
- Complete README with usage examples
|
|
189
|
+
- API reference
|
|
190
|
+
- Best practices guide
|
|
191
|
+
- Publishing guide for npm
|
|
192
|
+
|
|
193
|
+
## [1.0.0] - Initial Release (Legacy)
|
|
194
|
+
|
|
195
|
+
### Added
|
|
196
|
+
- Basic REST API client
|
|
197
|
+
- Simple query methods
|
|
198
|
+
- Authentication with API keys
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## Upgrade Guide
|
|
203
|
+
|
|
204
|
+
### From 1.x to 2.x
|
|
205
|
+
|
|
206
|
+
The 2.0.0 release is a complete rewrite with breaking changes.
|
|
207
|
+
|
|
208
|
+
#### Breaking Changes
|
|
209
|
+
|
|
210
|
+
1. **Import changed**
|
|
211
|
+
```typescript
|
|
212
|
+
// Old (1.x)
|
|
213
|
+
import { WOWSQL } from 'WOWSQL-sdk';
|
|
214
|
+
|
|
215
|
+
// New (2.x)
|
|
216
|
+
import WOWSQLClient from '@wowsql/sdk';
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
2. **Initialization changed**
|
|
220
|
+
```typescript
|
|
221
|
+
// Old (1.x)
|
|
222
|
+
const client = new WOWSQL('projectUrl', 'apiKey');
|
|
223
|
+
|
|
224
|
+
// New (2.x)
|
|
225
|
+
const client = new WOWSQLClient({
|
|
226
|
+
projectUrl: 'projectUrl',
|
|
227
|
+
apiKey: 'apiKey'
|
|
228
|
+
});
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
3. **Query API changed**
|
|
232
|
+
```typescript
|
|
233
|
+
// Old (1.x)
|
|
234
|
+
const users = await client.query('users', { limit: 10 });
|
|
235
|
+
|
|
236
|
+
// New (2.x)
|
|
237
|
+
const users = await client.table('users').limit(10).get();
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
#### New Features in 2.0
|
|
241
|
+
|
|
242
|
+
- Full TypeScript support with generics
|
|
243
|
+
- Fluent query builder
|
|
244
|
+
- Advanced filtering
|
|
245
|
+
- Better error handling
|
|
246
|
+
- Type-safe responses
|
|
247
|
+
|
|
248
|
+
#### Migration Steps
|
|
249
|
+
|
|
250
|
+
1. Update package name:
|
|
251
|
+
```bash
|
|
252
|
+
npm uninstall WOWSQL-sdk
|
|
253
|
+
npm install @wowsql/sdk
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
2. Update imports in your code
|
|
257
|
+
|
|
258
|
+
3. Update client initialization
|
|
259
|
+
|
|
260
|
+
4. Update query methods to use new fluent API
|
|
261
|
+
|
|
262
|
+
5. Add TypeScript interfaces for your data models
|
|
263
|
+
|
|
264
|
+
6. Test thoroughly before deploying
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
## Future Roadmap
|
|
269
|
+
|
|
270
|
+
### Planned Features
|
|
271
|
+
|
|
272
|
+
- [ ] WebSocket support for real-time data
|
|
273
|
+
- [ ] Transaction support
|
|
274
|
+
- [ ] Batch operations
|
|
275
|
+
- [ ] Query caching
|
|
276
|
+
- [ ] Retry logic with exponential backoff
|
|
277
|
+
- [ ] Request/response interceptors
|
|
278
|
+
- [ ] Query performance monitoring
|
|
279
|
+
- [ ] GraphQL-like nested queries
|
|
280
|
+
- [ ] File upload support
|
|
281
|
+
- [ ] Aggregation functions (COUNT, SUM, AVG, etc.)
|
|
282
|
+
|
|
283
|
+
### Under Consideration
|
|
284
|
+
|
|
285
|
+
- [ ] React hooks package (`@wowsql/react`)
|
|
286
|
+
- [ ] Vue composables (`@wowsql/vue`)
|
|
287
|
+
- [ ] Svelte stores (`@wowsql/svelte`)
|
|
288
|
+
- [ ] CLI tool for migrations
|
|
289
|
+
- [ ] Code generation from schema
|
|
290
|
+
- [ ] Query builder UI
|
|
291
|
+
|
|
292
|
+
---
|
|
293
|
+
|
|
294
|
+
For more information, visit [https://wowsql.com](https://wowsql.com)
|
|
295
|
+
|
|
296
|
+
|
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 WowMySQL
|
|
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.
|
|
22
|
+
|