@ts-pf/file 0.6.1 → 1.0.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 -1
- package/dist/codec.js +2 -2
- package/package.json +8 -8
- package/skills/ts-pf-file/SKILL.md +1 -1
package/README.md
CHANGED
|
@@ -63,7 +63,7 @@ const image = new File(['…'], 'me.png', { type: 'image/png' })
|
|
|
63
63
|
await client.avatar.upload({ userId: 'u1', image }) // sent as multipart/form-data
|
|
64
64
|
```
|
|
65
65
|
|
|
66
|
-
`MultipartCodec` wraps `
|
|
66
|
+
`MultipartCodec` wraps `JsonCodec` (override with `{ inner }`). Wire details: [`PROTOCOL.md`](https://github.com/crobinson42/ts-pf/blob/main/packages/protocol/PROTOCOL.md) (Binary attachments). Serving `handler`: [root README](https://github.com/crobinson42/ts-pf#serving-fetchhandler).
|
|
67
67
|
|
|
68
68
|
## Agent skills
|
|
69
69
|
|
package/dist/codec.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isJsonContentType,
|
|
1
|
+
import { isJsonContentType, JsonCodec, jsonBodySource, mimeType, } from '@ts-pf/http';
|
|
2
2
|
import { PFError } from '@ts-pf/protocol';
|
|
3
3
|
import { assertNoPlaceholders, extractFiles, fileFromPart, injectFiles, } from './files.js';
|
|
4
4
|
const DEFAULT_MAX_FILES = 32;
|
|
@@ -15,7 +15,7 @@ export class MultipartCodec {
|
|
|
15
15
|
maxFiles;
|
|
16
16
|
maxFileSize;
|
|
17
17
|
constructor(options) {
|
|
18
|
-
this.inner = options?.inner ?? new
|
|
18
|
+
this.inner = options?.inner ?? new JsonCodec();
|
|
19
19
|
this.maxFiles = options?.maxFiles ?? DEFAULT_MAX_FILES;
|
|
20
20
|
this.maxFileSize = options?.maxFileSize ?? DEFAULT_MAX_FILE_SIZE;
|
|
21
21
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ts-pf/file",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Opt-in MultipartCodec for File/Blob attachments",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ts-pf",
|
|
@@ -50,15 +50,15 @@
|
|
|
50
50
|
"lint": "biome check src tests"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@ts-pf/http": "0.
|
|
54
|
-
"@ts-pf/protocol": "0.
|
|
53
|
+
"@ts-pf/http": "^1.0.0",
|
|
54
|
+
"@ts-pf/protocol": "^1.0.0"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@ts-pf/client": "0.
|
|
58
|
-
"@ts-pf/client-http": "0.
|
|
59
|
-
"@ts-pf/contract": "0.
|
|
60
|
-
"@ts-pf/server": "0.
|
|
61
|
-
"@ts-pf/server-http": "0.
|
|
57
|
+
"@ts-pf/client": "^1.0.0",
|
|
58
|
+
"@ts-pf/client-http": "^1.0.0",
|
|
59
|
+
"@ts-pf/contract": "^1.0.0",
|
|
60
|
+
"@ts-pf/server": "^1.0.0",
|
|
61
|
+
"@ts-pf/server-http": "^1.0.0",
|
|
62
62
|
"zod": "^4.0.0"
|
|
63
63
|
}
|
|
64
64
|
}
|
|
@@ -38,4 +38,4 @@ Values that contain `File`/`Blob` are sent as `multipart/form-data` with the JSO
|
|
|
38
38
|
|
|
39
39
|
- `PFFile`, `file()`, or exported walk helpers.
|
|
40
40
|
- File size caps as a `HandlerPlugin` — they are codec options.
|
|
41
|
-
- Serve `stream()` procedures through it (`streams: false`; `FetchHandler` answers `400 BAD_REQUEST`) — that is `ts-pf-stream` / `
|
|
41
|
+
- Serve `stream()` procedures through it (`streams: false`; `FetchHandler` answers `400 BAD_REQUEST`) — that is `ts-pf-stream` (`StreamCodec` / `SseCodec`).
|