@uploadista/adapters-express 0.0.7 → 0.0.9
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 +68 -0
- package/README.md +269 -336
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +58 -121
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +75 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +2 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +12 -10
- package/src/express-adapter.ts +122 -0
- package/src/express-http-handler.ts +252 -0
- package/src/express-websocket-handler.ts +299 -0
- package/src/index.ts +1 -14
- package/dist/index.d.ts +0 -136
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -2
- package/dist/index.js.map +0 -1
- package/src/error-types.ts +0 -103
- package/src/flow-http-handlers.ts +0 -267
- package/src/upload-http-handlers.ts +0 -186
- package/src/uploadista-adapter-layer.ts +0 -32
- package/src/uploadista-adapter.ts +0 -642
- package/src/uploadista-websocket-handler.ts +0 -209
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@uploadista/adapters-express` 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
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **New Adapter Pattern**: Implemented `expressAdapter()` factory following unified `ServerAdapter` interface
|
|
13
|
+
- **Request Extraction** in `express-http-handler.ts`:
|
|
14
|
+
- `extractExpressRequest()` - Converts Express Request to typed `UploadistaRequest`
|
|
15
|
+
- Full routing logic for upload, flow, and jobs endpoints
|
|
16
|
+
- Support for all HTTP methods (POST, GET, PATCH)
|
|
17
|
+
- Manual JSON body parsing when needed
|
|
18
|
+
- Node.js stream to web ReadableStream conversion
|
|
19
|
+
- Query parameter and path segment parsing
|
|
20
|
+
- **Response Handling** in `express-http-handler.ts`:
|
|
21
|
+
- `sendExpressResponse()` - Converts `UploadistaResponse` to Express Response
|
|
22
|
+
- Proper header setting via `reply.header()`
|
|
23
|
+
- Status code and body handling via Express API
|
|
24
|
+
- **WebSocket Support** in `express-websocket-handler.ts`:
|
|
25
|
+
- `expressWebSocketHandler()` - Creates WebSocket handler for `ws` package
|
|
26
|
+
- Token-based and cookie-based authentication
|
|
27
|
+
- Connection lifecycle management with Node.js IncomingMessage
|
|
28
|
+
- Event subscription/unsubscription for uploads and flows
|
|
29
|
+
- Auth context caching per connection
|
|
30
|
+
- Proper cleanup on connection close
|
|
31
|
+
- **Context Type**: Introduced `ExpressContext` wrapping Request and Response
|
|
32
|
+
|
|
33
|
+
### Changed
|
|
34
|
+
|
|
35
|
+
- **Architecture**: Refactored to modular adapter pattern using `@uploadista/server`
|
|
36
|
+
- **Dependencies**: Now delegates to `@uploadista/server` for all business logic
|
|
37
|
+
- **API**: New `expressAdapter()` replaces legacy adapter creation (V1 API removed after cleanup)
|
|
38
|
+
- **Stream Handling**: Proper Node.js to Web ReadableStream conversion for chunked uploads
|
|
39
|
+
|
|
40
|
+
### Removed
|
|
41
|
+
|
|
42
|
+
- Legacy monolithic adapter implementation (removed during cleanup)
|
|
43
|
+
- Duplicated routing logic (now in `extractExpressRequest()`)
|
|
44
|
+
- Duplicated auth middleware execution (delegated to core server)
|
|
45
|
+
- Duplicated layer composition (handled by core server)
|
|
46
|
+
- Duplicated error handling (unified via core server)
|
|
47
|
+
|
|
48
|
+
### Benefits
|
|
49
|
+
|
|
50
|
+
- **Consistency**: Behavior identical across all framework adapters
|
|
51
|
+
- **Code Reduction**: Significant reduction in adapter-specific code
|
|
52
|
+
- **Maintainability**: Changes only needed in adapter-specific translation code
|
|
53
|
+
- **WebSocket Integration**: Seamless integration with standard `ws` package
|
|
54
|
+
|
|
55
|
+
### Technical Details
|
|
56
|
+
|
|
57
|
+
- Works with Express 4.x and 5.x
|
|
58
|
+
- Compatible with `ws` package for WebSocket support
|
|
59
|
+
- Properly handles Express middleware chain
|
|
60
|
+
- Supports both JSON and streaming request bodies
|
|
61
|
+
|
|
62
|
+
### Migration
|
|
63
|
+
|
|
64
|
+
See adapter documentation for migration from previous versions.
|
|
65
|
+
|
|
66
|
+
## [0.0.8] - Previous Version
|
|
67
|
+
|
|
68
|
+
Monolithic adapter implementation with all logic embedded.
|