@lovrozagar/honey 0.1.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.
Files changed (131) hide show
  1. package/README.md +51 -0
  2. package/docs/api-ref/go.md +399 -0
  3. package/docs/api-ref/python.md +399 -0
  4. package/docs/api-ref/rust.md +399 -0
  5. package/docs/api-ref/typescript.md +399 -0
  6. package/docs/invalidate-spec.md +303 -0
  7. package/docs/sdk.md +722 -0
  8. package/package.json +120 -0
  9. package/src/accepts.ts +78 -0
  10. package/src/body-limit.ts +100 -0
  11. package/src/build/index.ts +174 -0
  12. package/src/cli-go/auth.go +15 -0
  13. package/src/cli-go/config.go +165 -0
  14. package/src/cli-go/errors.go +57 -0
  15. package/src/cli-go/multipart.go +55 -0
  16. package/src/cli-go/output.go +109 -0
  17. package/src/cli-go/root.go +30 -0
  18. package/src/cli-go/stream.go +88 -0
  19. package/src/cli-go/version.go +5 -0
  20. package/src/cli.ts +204 -0
  21. package/src/client/error.ts +27 -0
  22. package/src/client/http.ts +502 -0
  23. package/src/client/index.ts +127 -0
  24. package/src/client/sdk.ts +265 -0
  25. package/src/client/sse.ts +102 -0
  26. package/src/client/types.ts +211 -0
  27. package/src/client/ws.ts +115 -0
  28. package/src/client-go/errors.go +207 -0
  29. package/src/client-go/invalidation.go +373 -0
  30. package/src/client-go/realtime.go +317 -0
  31. package/src/client-go/result.go +20 -0
  32. package/src/client-go/runtime.go +413 -0
  33. package/src/client-go/sse.go +149 -0
  34. package/src/client-go/transport.go +452 -0
  35. package/src/client-go/ws.go +104 -0
  36. package/src/client-mcp/README.md +10 -0
  37. package/src/client-mcp/server.ts +94 -0
  38. package/src/client-mcp/types.ts +19 -0
  39. package/src/client-python/_errors.py +115 -0
  40. package/src/client-python/_invalidation.py +578 -0
  41. package/src/client-python/_realtime.py +156 -0
  42. package/src/client-python/_runtime.py +469 -0
  43. package/src/client-python/_sse.py +99 -0
  44. package/src/client-python/_transport.py +335 -0
  45. package/src/client-python/_ws.py +131 -0
  46. package/src/client-python/py.typed +0 -0
  47. package/src/client-rust/errors.rs +200 -0
  48. package/src/client-rust/invalidation.rs +441 -0
  49. package/src/client-rust/invalidation_sync.rs +306 -0
  50. package/src/client-rust/realtime.rs +695 -0
  51. package/src/client-rust/result.rs +22 -0
  52. package/src/client-rust/runtime.rs +547 -0
  53. package/src/client-rust/runtime_sync.rs +452 -0
  54. package/src/client-rust/sse.rs +167 -0
  55. package/src/client-rust/ws.rs +143 -0
  56. package/src/cloudflare/realtime.ts +236 -0
  57. package/src/codegen-go-cli.ts +1180 -0
  58. package/src/codegen-go.ts +1010 -0
  59. package/src/codegen-hash.ts +8 -0
  60. package/src/codegen-ir.ts +517 -0
  61. package/src/codegen-loaders.ts +53 -0
  62. package/src/codegen-mcp.ts +364 -0
  63. package/src/codegen-python.ts +1028 -0
  64. package/src/codegen-rust.ts +1652 -0
  65. package/src/codegen-sanitize.ts +67 -0
  66. package/src/codegen-schema-naming.ts +146 -0
  67. package/src/codegen.ts +5015 -0
  68. package/src/context.ts +210 -0
  69. package/src/cookie-sign.ts +58 -0
  70. package/src/cookie.ts +89 -0
  71. package/src/cors.ts +96 -0
  72. package/src/crypto.ts +19 -0
  73. package/src/csrf.ts +54 -0
  74. package/src/curl-logger.ts +235 -0
  75. package/src/detect-runtime.ts +19 -0
  76. package/src/error.ts +52 -0
  77. package/src/errors.ts +87 -0
  78. package/src/etag.ts +74 -0
  79. package/src/feature-load.ts +23 -0
  80. package/src/go-type-emitter.ts +404 -0
  81. package/src/honey-response.ts +354 -0
  82. package/src/i18n-slot.ts +20 -0
  83. package/src/i18n.ts +234 -0
  84. package/src/index.ts +3843 -0
  85. package/src/init.ts +149 -0
  86. package/src/input.ts +8 -0
  87. package/src/ip-restrict.ts +192 -0
  88. package/src/logger.ts +149 -0
  89. package/src/middleware.ts +199 -0
  90. package/src/node-request.ts +240 -0
  91. package/src/node.ts +212 -0
  92. package/src/openapi/register.ts +19 -0
  93. package/src/openapi/scalar.ts +33 -0
  94. package/src/openapi/spec-factory.ts +46 -0
  95. package/src/openapi/spec.ts +31 -0
  96. package/src/openapi/swagger.ts +34 -0
  97. package/src/plugin.ts +771 -0
  98. package/src/powered-by.ts +17 -0
  99. package/src/pretty-json.ts +39 -0
  100. package/src/proxy.ts +155 -0
  101. package/src/python-type-emitter.ts +144 -0
  102. package/src/realtime/buffer.ts +101 -0
  103. package/src/realtime/bus.ts +93 -0
  104. package/src/realtime/longpoll.ts +148 -0
  105. package/src/realtime/protocol.ts +128 -0
  106. package/src/realtime/route.ts +104 -0
  107. package/src/realtime/runtime.ts +430 -0
  108. package/src/request-id.ts +23 -0
  109. package/src/request-to-curl.ts +34 -0
  110. package/src/response.ts +414 -0
  111. package/src/rust-type-emitter.ts +412 -0
  112. package/src/secure-headers.ts +69 -0
  113. package/src/serve-register.ts +8 -0
  114. package/src/serve-slot.ts +20 -0
  115. package/src/serve.ts +141 -0
  116. package/src/server-timing.ts +66 -0
  117. package/src/static.ts +60 -0
  118. package/src/telemetry/otel.ts +139 -0
  119. package/src/testing.ts +114 -0
  120. package/src/timeout.ts +36 -0
  121. package/src/tree.ts +464 -0
  122. package/src/ts-type-emitter.ts +106 -0
  123. package/src/type-emitter.ts +524 -0
  124. package/src/type-extractor.ts +749 -0
  125. package/src/types.ts +638 -0
  126. package/src/validation.ts +300 -0
  127. package/src/ws/bun.ts +89 -0
  128. package/src/ws/cloudflare.ts +133 -0
  129. package/src/ws/deno.ts +109 -0
  130. package/src/ws/node.ts +161 -0
  131. package/src/yaml.ts +80 -0
@@ -0,0 +1,399 @@
1
+ # Python API Reference
2
+
3
+ Generated from OpenAPI via the shared codegen IR. Do not edit by hand —
4
+ run `bun run public/honey/core/scripts/gen-api-ref.ts` to regenerate.
5
+
6
+ ## Typed Errors
7
+
8
+ Every operation's error channel surfaces one of:
9
+
10
+ | Canonical | Status | Lang symbol | Notes |
11
+ | --------- | ------ | ----------- | ----- |
12
+ | `BadRequest` | 400 | `BadRequest` | invalid request payload |
13
+ | `Unauthorized` | 401 | `Unauthorized` | missing/invalid auth; triggers onAuthExpired + 1 retry |
14
+ | `Forbidden` | 403 | `Forbidden` | authenticated but not permitted |
15
+ | `NotFound` | 404 | `NotFound` | resource does not exist |
16
+ | `Conflict` | 409 | `Conflict` | state conflict / unique violation |
17
+ | `UnprocessableEntity` | 422 | `UnprocessableEntity` | schema-valid but semantically rejected |
18
+ | `TooManyRequests` | 429 | `TooManyRequests` | rate-limited; consumer handles backoff via hooks |
19
+ | `InternalServerError` | 500 | `InternalServerError` | server crash |
20
+ | `BadGateway` | 502 | `BadGateway` | upstream failure |
21
+ | `ServiceUnavailable` | 503 | `ServiceUnavailable` | server temporarily unavailable |
22
+ | `GatewayTimeout` | 504 | `GatewayTimeout` | upstream timeout |
23
+ | `StatusError` | * | `StatusError` | fallback for undeclared/other statuses |
24
+
25
+ Operations with declared `responses: { 4xx: { schema } }` parse the response body into the error's typed `data` field.
26
+
27
+ ## Operations
28
+
29
+ ### refresh_token
30
+
31
+ `POST /auth/refresh`
32
+
33
+ **Signature**
34
+
35
+ ```
36
+ async def refresh_token(self, body: { refresh_token: str }) -> { access_token: str, expires_in: int }
37
+ ```
38
+
39
+ **Request body**
40
+
41
+ - Content-type: `application/json`
42
+ - Required: yes
43
+ - Type: `{ refresh_token: str }`
44
+
45
+ **Responses**
46
+
47
+ | Status | Content-type | Type |
48
+ | ------ | ------------ | ---- |
49
+ | `200` | `application/json` | `{ access_token: str, expires_in: int }` |
50
+ | `401` | `application/json` | `{ status: int, message: str }` |
51
+
52
+ ---
53
+
54
+ ### get_declared_error
55
+
56
+ `GET /declared-errors/{status}`
57
+
58
+ **Signature**
59
+
60
+ ```
61
+ async def get_declared_error(self, status: str) -> None
62
+ ```
63
+
64
+ **Path params**
65
+
66
+ | Name | Type |
67
+ | ---- | ---- |
68
+ | `status` | `str` |
69
+
70
+ **Responses**
71
+
72
+ | Status | Content-type | Type |
73
+ | ------ | ------------ | ---- |
74
+ | `400` | `application/json` | `{ status: int, message: str }` |
75
+ | `404` | `application/json` | `{ status: int, message: str }` |
76
+ | `default` | `application/json` | `{ status: int, message: str }` |
77
+
78
+ ---
79
+
80
+ ### get_error
81
+
82
+ `GET /errors/{status}`
83
+
84
+ **Signature**
85
+
86
+ ```
87
+ async def get_error(self, status: int) -> None
88
+ ```
89
+
90
+ **Path params**
91
+
92
+ | Name | Type |
93
+ | ---- | ---- |
94
+ | `status` | `int` |
95
+
96
+ **Responses**
97
+
98
+ | Status | Content-type | Type |
99
+ | ------ | ------------ | ---- |
100
+ | `default` | `application/json` | `{ status: int, message: str }` |
101
+
102
+ ---
103
+
104
+ ### idempotent_create
105
+
106
+ `POST /idempotent-create`
107
+
108
+ **Signature**
109
+
110
+ ```
111
+ async def idempotent_create(self) -> { idempotencyKey: str }
112
+ ```
113
+
114
+ **Responses**
115
+
116
+ | Status | Content-type | Type |
117
+ | ------ | ------------ | ---- |
118
+ | `200` | `application/json` | `{ idempotencyKey: str }` |
119
+
120
+ **Extensions**
121
+
122
+ - `x-idempotency-key`: yes — auto-sent if omitted
123
+
124
+ ---
125
+
126
+ ### connect_realtime
127
+
128
+ `GET /realtime`
129
+
130
+ **Signature**
131
+
132
+ ```
133
+ async def connect_realtime(self, reconnect_token: str) -> ResumableConnection
134
+ ```
135
+
136
+ **Query params**
137
+
138
+ | Name | Type |
139
+ | ---- | ---- |
140
+ | `reconnect_token` | `str` |
141
+
142
+ **Responses**
143
+
144
+ | Status | Content-type | Type |
145
+ | ------ | ------------ | ---- |
146
+ | `101` | `—` | — |
147
+
148
+ **Extensions**
149
+
150
+ - `x-realtime`: yes
151
+
152
+ ---
153
+
154
+ ### slow
155
+
156
+ `GET /slow`
157
+
158
+ **Signature**
159
+
160
+ ```
161
+ async def slow(self, ms: int) -> { ok: bool }
162
+ ```
163
+
164
+ **Query params**
165
+
166
+ | Name | Type |
167
+ | ---- | ---- |
168
+ | `ms` | `int` |
169
+
170
+ **Responses**
171
+
172
+ | Status | Content-type | Type |
173
+ | ------ | ------------ | ---- |
174
+ | `200` | `application/json` | `{ ok: bool }` |
175
+
176
+ ---
177
+
178
+ ### stream_events
179
+
180
+ `GET /stream`
181
+
182
+ **Signature**
183
+
184
+ ```
185
+ async def stream_events(self, last_event_id: str) -> AsyncIterator[{ event: Optional[str], data: Optional[str], id: Optional[str] }]
186
+ ```
187
+
188
+ **Header params**
189
+
190
+ | Name | Type |
191
+ | ---- | ---- |
192
+ | `Last-Event-ID` | `str` |
193
+
194
+ **Responses**
195
+
196
+ | Status | Content-type | Type |
197
+ | ------ | ------------ | ---- |
198
+ | `200` | `text/event-stream` | `{ event: Optional[str], data: Optional[str], id: Optional[str] }` |
199
+ | `401` | `application/json` | `{ status: int, message: str }` |
200
+
201
+ **Extensions**
202
+
203
+ - SSE response detected (`text/event-stream`)
204
+
205
+ ---
206
+
207
+ ### upload_blob
208
+
209
+ `POST /upload`
210
+
211
+ **Signature**
212
+
213
+ ```
214
+ async def upload_blob(self, body: AsyncIterator[bytes]) -> { size: int, hash: str }
215
+ ```
216
+
217
+ **Request body**
218
+
219
+ - Content-type: `application/octet-stream`
220
+ - Required: yes
221
+ - Type: `AsyncIterator[bytes]`
222
+
223
+ **Responses**
224
+
225
+ | Status | Content-type | Type |
226
+ | ------ | ------------ | ---- |
227
+ | `200` | `application/json` | `{ size: int, hash: str }` |
228
+ | `401` | `application/json` | `{ status: int, message: str }` |
229
+
230
+ ---
231
+
232
+ ### list_users
233
+
234
+ `GET /users`
235
+
236
+ **Signature**
237
+
238
+ ```
239
+ async def list_users(self) -> { items: List[{ id: str, name: str, email: str }], total: int }
240
+ ```
241
+
242
+ **Responses**
243
+
244
+ | Status | Content-type | Type |
245
+ | ------ | ------------ | ---- |
246
+ | `200` | `application/json` | `{ items: List[{ id: str, name: str, email: str }], total: int }` |
247
+ | `401` | `application/json` | `{ status: int, message: str }` |
248
+
249
+ ---
250
+
251
+ ### create_user
252
+
253
+ `POST /users`
254
+
255
+ **Signature**
256
+
257
+ ```
258
+ async def create_user(self, body: { name: str, email: str }) -> { id: str, name: str, email: str }
259
+ ```
260
+
261
+ **Request body**
262
+
263
+ - Content-type: `application/json`
264
+ - Required: yes
265
+ - Type: `{ name: str, email: str }`
266
+
267
+ **Responses**
268
+
269
+ | Status | Content-type | Type |
270
+ | ------ | ------------ | ---- |
271
+ | `201` | `application/json` | `{ id: str, name: str, email: str }` |
272
+ | `401` | `application/json` | `{ status: int, message: str }` |
273
+ | `422` | `application/json` | `{ status: int, message: str }` |
274
+
275
+ **Extensions**
276
+
277
+ - `x-invalidate`: `GET /users`
278
+
279
+ ---
280
+
281
+ ### delete_user
282
+
283
+ `DELETE /users/{id}`
284
+
285
+ **Signature**
286
+
287
+ ```
288
+ async def delete_user(self, id: str) -> None
289
+ ```
290
+
291
+ **Path params**
292
+
293
+ | Name | Type |
294
+ | ---- | ---- |
295
+ | `id` | `str` |
296
+
297
+ **Responses**
298
+
299
+ | Status | Content-type | Type |
300
+ | ------ | ------------ | ---- |
301
+ | `204` | `—` | — |
302
+ | `401` | `application/json` | `{ status: int, message: str }` |
303
+ | `404` | `application/json` | `{ status: int, message: str }` |
304
+
305
+ **Extensions**
306
+
307
+ - `x-invalidate`: `GET /users`, `GET /users/{id}`
308
+
309
+ ---
310
+
311
+ ### get_user
312
+
313
+ `GET /users/{id}`
314
+
315
+ **Signature**
316
+
317
+ ```
318
+ async def get_user(self, id: str) -> { id: str, name: str, email: str }
319
+ ```
320
+
321
+ **Path params**
322
+
323
+ | Name | Type |
324
+ | ---- | ---- |
325
+ | `id` | `str` |
326
+
327
+ **Responses**
328
+
329
+ | Status | Content-type | Type |
330
+ | ------ | ------------ | ---- |
331
+ | `200` | `application/json` | `{ id: str, name: str, email: str }` |
332
+ | `401` | `application/json` | `{ status: int, message: str }` |
333
+ | `404` | `application/json` | `{ status: int, message: str }` |
334
+
335
+ ---
336
+
337
+ ### update_user
338
+
339
+ `PUT /users/{id}`
340
+
341
+ **Signature**
342
+
343
+ ```
344
+ async def update_user(self, id: str, body: { name: Optional[str], email: Optional[str] }) -> { id: str, name: str, email: str }
345
+ ```
346
+
347
+ **Path params**
348
+
349
+ | Name | Type |
350
+ | ---- | ---- |
351
+ | `id` | `str` |
352
+
353
+ **Request body**
354
+
355
+ - Content-type: `application/json`
356
+ - Required: yes
357
+ - Type: `{ name: Optional[str], email: Optional[str] }`
358
+
359
+ **Responses**
360
+
361
+ | Status | Content-type | Type |
362
+ | ------ | ------------ | ---- |
363
+ | `200` | `application/json` | `{ id: str, name: str, email: str }` |
364
+ | `401` | `application/json` | `{ status: int, message: str }` |
365
+ | `404` | `application/json` | `{ status: int, message: str }` |
366
+
367
+ **Extensions**
368
+
369
+ - `x-invalidate`: `GET /users`, `GET /users/{id}`
370
+
371
+ ---
372
+
373
+ ### connect_ws
374
+
375
+ `GET /ws`
376
+
377
+ **Signature**
378
+
379
+ ```
380
+ async def connect_ws(self, token: str) -> ResumableConnection
381
+ ```
382
+
383
+ **Query params**
384
+
385
+ | Name | Type |
386
+ | ---- | ---- |
387
+ | `token` | `str` |
388
+
389
+ **Responses**
390
+
391
+ | Status | Content-type | Type |
392
+ | ------ | ------------ | ---- |
393
+ | `101` | `—` | — |
394
+
395
+ **Extensions**
396
+
397
+ - `x-websocket`: yes
398
+
399
+ ---