@ts-pf/protocol 0.1.1 → 0.1.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.
Files changed (2) hide show
  1. package/PROTOCOL.md +3 -3
  2. package/package.json +1 -1
package/PROTOCOL.md CHANGED
@@ -67,15 +67,15 @@ x-ts-pf-protocol: 1
67
67
  | Code | Status | When |
68
68
  |---|---|---|
69
69
  | `BAD_REQUEST` | 400 | Invalid JSON or envelope |
70
- | `VALIDATION` | 422 | Input schema failed. `error.data.issues` is `{ message, path }[]` |
70
+ | `VALIDATION` | 422 | Input schema failed, or a stream item schema failed after the stream started. `error.data.issues` is `{ message, path }[]` |
71
71
  | `NOT_FOUND` | 404 | Prefix matched, procedure missing |
72
72
  | `METHOD_NOT_ALLOWED` | 405 | Non-POST |
73
73
  | `PAYLOAD_TOO_LARGE` | 413 | Request body larger than the configured handler limit |
74
- | `INTERNAL` | 500 | Unknown throw. Output schema failures also use 500 (server bug). |
74
+ | `INTERNAL` | 500 | Unknown throw. A unary output schema failure is also 500 (server bug). Output schema checks are optional. |
75
75
 
76
76
  The discriminator is `error.code`. HTTP status is unary transport only; it is not in the JSON body.
77
77
 
78
- The table above is a **closed** set. Procedure-declared codes are application-defined strings with optional `data`. `VALIDATION` is the only protocol code with a specified `data` shape: `{ issues: { message, path }[] }` where `path` is `(string | number)[]`. Other protocol codes omit `data`. `INTERNAL` never includes a stack or output-schema issues.
78
+ The table above is a **closed** set. Procedure-declared codes are application-defined strings with optional `data`. `VALIDATION` is the only protocol code with a specified `data` shape: `{ issues: { message, path }[] }` where `path` is `(string | number)[]`. Other protocol codes omit `data`. `INTERNAL` never includes a stack or output-schema issues. Servers may skip output schema checks. When a server checks a unary output schema and it fails, the code is `INTERNAL` and `data` is omitted. When a server checks a stream item and it fails, the code is `VALIDATION` with `issues`, in-band after the stream has started.
79
79
 
80
80
  Unknown `code` values are valid JSON; clients must catch-all. A procedure may reuse `NOT_FOUND` for a missing entity. Do not redeclare `VALIDATION`, `INTERNAL`, `BAD_REQUEST`, `METHOD_NOT_ALLOWED`, or `PAYLOAD_TOO_LARGE`.
81
81
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ts-pf/protocol",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Portable JSON RPC envelope, PFError, and PROTOCOL_VERSION",
5
5
  "keywords": [
6
6
  "ts-pf",