@effect/platform 0.66.2 → 0.67.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 (178) hide show
  1. package/dist/cjs/Command.js.map +1 -1
  2. package/dist/cjs/Cookies.js.map +1 -1
  3. package/dist/cjs/Effectify.js.map +1 -1
  4. package/dist/cjs/Headers.js.map +1 -1
  5. package/dist/cjs/HttpApi.js.map +1 -1
  6. package/dist/cjs/HttpApiBuilder.js.map +1 -1
  7. package/dist/cjs/HttpApiEndpoint.js.map +1 -1
  8. package/dist/cjs/HttpApiGroup.js.map +1 -1
  9. package/dist/cjs/HttpApiSchema.js.map +1 -1
  10. package/dist/cjs/HttpApiSecurity.js.map +1 -1
  11. package/dist/cjs/HttpApp.js.map +1 -1
  12. package/dist/cjs/HttpClient.js +8 -1
  13. package/dist/cjs/HttpClient.js.map +1 -1
  14. package/dist/cjs/HttpClientError.js +8 -1
  15. package/dist/cjs/HttpClientError.js.map +1 -1
  16. package/dist/cjs/HttpClientRequest.js.map +1 -1
  17. package/dist/cjs/HttpClientResponse.js +11 -1
  18. package/dist/cjs/HttpClientResponse.js.map +1 -1
  19. package/dist/cjs/HttpIncomingMessage.js.map +1 -1
  20. package/dist/cjs/HttpMiddleware.js.map +1 -1
  21. package/dist/cjs/HttpMultiplex.js.map +1 -1
  22. package/dist/cjs/HttpRouter.js.map +1 -1
  23. package/dist/cjs/HttpServer.js.map +1 -1
  24. package/dist/cjs/HttpServerResponse.js.map +1 -1
  25. package/dist/cjs/KeyValueStore.js.map +1 -1
  26. package/dist/cjs/Multipart.js.map +1 -1
  27. package/dist/cjs/OpenApi.js.map +1 -1
  28. package/dist/cjs/PlatformLogger.js.map +1 -1
  29. package/dist/cjs/Socket.js +4 -1
  30. package/dist/cjs/Socket.js.map +1 -1
  31. package/dist/cjs/Transferable.js.map +1 -1
  32. package/dist/cjs/UrlParams.js.map +1 -1
  33. package/dist/cjs/internal/httpBody.js +3 -0
  34. package/dist/cjs/internal/httpBody.js.map +1 -1
  35. package/dist/cjs/internal/httpClient.js +12 -14
  36. package/dist/cjs/internal/httpClient.js.map +1 -1
  37. package/dist/cjs/internal/httpClientResponse.js +16 -1
  38. package/dist/cjs/internal/httpClientResponse.js.map +1 -1
  39. package/dist/cjs/internal/httpMultiplex.js +3 -0
  40. package/dist/cjs/internal/httpMultiplex.js.map +1 -1
  41. package/dist/cjs/internal/httpRouter.js +3 -0
  42. package/dist/cjs/internal/httpRouter.js.map +1 -1
  43. package/dist/cjs/internal/httpServerResponse.js +3 -0
  44. package/dist/cjs/internal/httpServerResponse.js.map +1 -1
  45. package/dist/dts/Command.d.ts +134 -0
  46. package/dist/dts/Command.d.ts.map +1 -1
  47. package/dist/dts/Cookies.d.ts +120 -0
  48. package/dist/dts/Cookies.d.ts.map +1 -1
  49. package/dist/dts/Effectify.d.ts +9 -0
  50. package/dist/dts/Effectify.d.ts.map +1 -1
  51. package/dist/dts/Headers.d.ts +56 -0
  52. package/dist/dts/Headers.d.ts.map +1 -1
  53. package/dist/dts/HttpApi.d.ts +58 -0
  54. package/dist/dts/HttpApi.d.ts.map +1 -1
  55. package/dist/dts/HttpApiBuilder.d.ts +84 -0
  56. package/dist/dts/HttpApiBuilder.d.ts.map +1 -1
  57. package/dist/dts/HttpApiEndpoint.d.ts +118 -0
  58. package/dist/dts/HttpApiEndpoint.d.ts.map +1 -1
  59. package/dist/dts/HttpApiGroup.d.ts +100 -0
  60. package/dist/dts/HttpApiGroup.d.ts.map +1 -1
  61. package/dist/dts/HttpApiSchema.d.ts +16 -0
  62. package/dist/dts/HttpApiSchema.d.ts.map +1 -1
  63. package/dist/dts/HttpApiSecurity.d.ts +16 -0
  64. package/dist/dts/HttpApiSecurity.d.ts.map +1 -1
  65. package/dist/dts/HttpApp.d.ts.map +1 -1
  66. package/dist/dts/HttpClient.d.ts +308 -0
  67. package/dist/dts/HttpClient.d.ts.map +1 -1
  68. package/dist/dts/HttpClientError.d.ts +5 -0
  69. package/dist/dts/HttpClientError.d.ts.map +1 -1
  70. package/dist/dts/HttpClientRequest.d.ts +208 -0
  71. package/dist/dts/HttpClientRequest.d.ts.map +1 -1
  72. package/dist/dts/HttpClientResponse.d.ts +30 -0
  73. package/dist/dts/HttpClientResponse.d.ts.map +1 -1
  74. package/dist/dts/HttpIncomingMessage.d.ts.map +1 -1
  75. package/dist/dts/HttpMiddleware.d.ts +24 -0
  76. package/dist/dts/HttpMiddleware.d.ts.map +1 -1
  77. package/dist/dts/HttpMultiplex.d.ts +72 -0
  78. package/dist/dts/HttpMultiplex.d.ts.map +1 -1
  79. package/dist/dts/HttpRouter.d.ts +184 -0
  80. package/dist/dts/HttpRouter.d.ts.map +1 -1
  81. package/dist/dts/HttpServer.d.ts +32 -0
  82. package/dist/dts/HttpServer.d.ts.map +1 -1
  83. package/dist/dts/HttpServerResponse.d.ts +96 -0
  84. package/dist/dts/HttpServerResponse.d.ts.map +1 -1
  85. package/dist/dts/KeyValueStore.d.ts +8 -0
  86. package/dist/dts/KeyValueStore.d.ts.map +1 -1
  87. package/dist/dts/Multipart.d.ts +32 -0
  88. package/dist/dts/Multipart.d.ts.map +1 -1
  89. package/dist/dts/OpenApi.d.ts +8 -0
  90. package/dist/dts/OpenApi.d.ts.map +1 -1
  91. package/dist/dts/PlatformLogger.d.ts +46 -0
  92. package/dist/dts/PlatformLogger.d.ts.map +1 -1
  93. package/dist/dts/Socket.d.ts +8 -0
  94. package/dist/dts/Socket.d.ts.map +1 -1
  95. package/dist/dts/Transferable.d.ts +8 -0
  96. package/dist/dts/Transferable.d.ts.map +1 -1
  97. package/dist/dts/UrlParams.d.ts +64 -0
  98. package/dist/dts/UrlParams.d.ts.map +1 -1
  99. package/dist/dts/internal/httpRouter.d.ts.map +1 -1
  100. package/dist/esm/Command.js.map +1 -1
  101. package/dist/esm/Cookies.js.map +1 -1
  102. package/dist/esm/Effectify.js.map +1 -1
  103. package/dist/esm/Headers.js.map +1 -1
  104. package/dist/esm/HttpApi.js.map +1 -1
  105. package/dist/esm/HttpApiBuilder.js.map +1 -1
  106. package/dist/esm/HttpApiEndpoint.js.map +1 -1
  107. package/dist/esm/HttpApiGroup.js.map +1 -1
  108. package/dist/esm/HttpApiSchema.js.map +1 -1
  109. package/dist/esm/HttpApiSecurity.js.map +1 -1
  110. package/dist/esm/HttpApp.js.map +1 -1
  111. package/dist/esm/HttpClient.js +7 -0
  112. package/dist/esm/HttpClient.js.map +1 -1
  113. package/dist/esm/HttpClientError.js +6 -0
  114. package/dist/esm/HttpClientError.js.map +1 -1
  115. package/dist/esm/HttpClientRequest.js.map +1 -1
  116. package/dist/esm/HttpClientResponse.js +10 -0
  117. package/dist/esm/HttpClientResponse.js.map +1 -1
  118. package/dist/esm/HttpIncomingMessage.js.map +1 -1
  119. package/dist/esm/HttpMiddleware.js.map +1 -1
  120. package/dist/esm/HttpMultiplex.js.map +1 -1
  121. package/dist/esm/HttpRouter.js.map +1 -1
  122. package/dist/esm/HttpServer.js.map +1 -1
  123. package/dist/esm/HttpServerResponse.js.map +1 -1
  124. package/dist/esm/KeyValueStore.js.map +1 -1
  125. package/dist/esm/Multipart.js.map +1 -1
  126. package/dist/esm/OpenApi.js.map +1 -1
  127. package/dist/esm/PlatformLogger.js.map +1 -1
  128. package/dist/esm/Socket.js +4 -1
  129. package/dist/esm/Socket.js.map +1 -1
  130. package/dist/esm/Transferable.js.map +1 -1
  131. package/dist/esm/UrlParams.js.map +1 -1
  132. package/dist/esm/internal/httpBody.js +3 -0
  133. package/dist/esm/internal/httpBody.js.map +1 -1
  134. package/dist/esm/internal/httpClient.js +11 -13
  135. package/dist/esm/internal/httpClient.js.map +1 -1
  136. package/dist/esm/internal/httpClientResponse.js +14 -0
  137. package/dist/esm/internal/httpClientResponse.js.map +1 -1
  138. package/dist/esm/internal/httpMultiplex.js +3 -0
  139. package/dist/esm/internal/httpMultiplex.js.map +1 -1
  140. package/dist/esm/internal/httpRouter.js +3 -0
  141. package/dist/esm/internal/httpRouter.js.map +1 -1
  142. package/dist/esm/internal/httpServerResponse.js +3 -0
  143. package/dist/esm/internal/httpServerResponse.js.map +1 -1
  144. package/package.json +3 -3
  145. package/src/Command.ts +134 -0
  146. package/src/Cookies.ts +128 -38
  147. package/src/Effectify.ts +9 -0
  148. package/src/Headers.ts +106 -7
  149. package/src/HttpApi.ts +58 -0
  150. package/src/HttpApiBuilder.ts +85 -3
  151. package/src/HttpApiEndpoint.ts +121 -9
  152. package/src/HttpApiGroup.ts +102 -7
  153. package/src/HttpApiSchema.ts +22 -4
  154. package/src/HttpApiSecurity.ts +16 -0
  155. package/src/HttpApp.ts +8 -0
  156. package/src/HttpClient.ts +315 -11
  157. package/src/HttpClientError.ts +7 -0
  158. package/src/HttpClientRequest.ts +213 -1
  159. package/src/HttpClientResponse.ts +33 -0
  160. package/src/HttpIncomingMessage.ts +8 -0
  161. package/src/HttpMiddleware.ts +24 -0
  162. package/src/HttpMultiplex.ts +72 -0
  163. package/src/HttpRouter.ts +189 -18
  164. package/src/HttpServer.ts +34 -6
  165. package/src/HttpServerResponse.ts +98 -10
  166. package/src/KeyValueStore.ts +8 -0
  167. package/src/Multipart.ts +32 -0
  168. package/src/OpenApi.ts +31 -18
  169. package/src/PlatformLogger.ts +46 -0
  170. package/src/Socket.ts +19 -13
  171. package/src/Transferable.ts +9 -3
  172. package/src/UrlParams.ts +64 -0
  173. package/src/internal/httpBody.ts +3 -0
  174. package/src/internal/httpClient.ts +41 -26
  175. package/src/internal/httpClientResponse.ts +40 -1
  176. package/src/internal/httpMultiplex.ts +3 -0
  177. package/src/internal/httpRouter.ts +3 -0
  178. package/src/internal/httpServerResponse.ts +3 -0
package/src/HttpApi.ts CHANGED
@@ -134,21 +134,45 @@ export const empty: HttpApi = makeProto({
134
134
  * @category constructors
135
135
  */
136
136
  export const addGroup: {
137
+ /**
138
+ * Add a `HttpApiGroup` to an `HttpApi`.
139
+ *
140
+ * @since 1.0.0
141
+ * @category constructors
142
+ */
137
143
  <Group extends HttpApiGroup.HttpApiGroup.Any>(
138
144
  group: Group
139
145
  ): <Groups extends HttpApiGroup.HttpApiGroup.Any, Error, ErrorR>(
140
146
  self: HttpApi<Groups, Error, ErrorR>
141
147
  ) => HttpApi<Groups | Group, Error, ErrorR>
148
+ /**
149
+ * Add a `HttpApiGroup` to an `HttpApi`.
150
+ *
151
+ * @since 1.0.0
152
+ * @category constructors
153
+ */
142
154
  <Group extends HttpApiGroup.HttpApiGroup.Any>(
143
155
  path: HttpRouter.PathInput,
144
156
  group: Group
145
157
  ): <Groups extends HttpApiGroup.HttpApiGroup.Any, Error, ErrorR>(
146
158
  self: HttpApi<Groups, Error, ErrorR>
147
159
  ) => HttpApi<Groups | Group, Error, ErrorR>
160
+ /**
161
+ * Add a `HttpApiGroup` to an `HttpApi`.
162
+ *
163
+ * @since 1.0.0
164
+ * @category constructors
165
+ */
148
166
  <Groups extends HttpApiGroup.HttpApiGroup.Any, Error, ErrorR, Group extends HttpApiGroup.HttpApiGroup.Any>(
149
167
  self: HttpApi<Groups, Error, ErrorR>,
150
168
  group: Group
151
169
  ): HttpApi<Groups | Group, Error, ErrorR>
170
+ /**
171
+ * Add a `HttpApiGroup` to an `HttpApi`.
172
+ *
173
+ * @since 1.0.0
174
+ * @category constructors
175
+ */
152
176
  <Groups extends HttpApiGroup.HttpApiGroup.Any, Error, ErrorR, Group extends HttpApiGroup.HttpApiGroup.Any>(
153
177
  self: HttpApi<Groups, Error, ErrorR>,
154
178
  path: HttpRouter.PathInput,
@@ -178,6 +202,15 @@ export const addGroup: {
178
202
  * @category errors
179
203
  */
180
204
  export const addError: {
205
+ /**
206
+ * Add an error schema to an `HttpApi`, which is shared by all endpoints in the
207
+ * `HttpApi`.
208
+ *
209
+ * Useful for adding error types from middleware or other shared error types.
210
+ *
211
+ * @since 1.0.0
212
+ * @category errors
213
+ */
181
214
  <A, I, R>(
182
215
  schema: Schema.Schema<A, I, R>,
183
216
  annotations?: {
@@ -186,6 +219,15 @@ export const addError: {
186
219
  ): <Groups extends HttpApiGroup.HttpApiGroup.Any, Error, ErrorR>(
187
220
  self: HttpApi<Groups, Error, ErrorR>
188
221
  ) => HttpApi<Groups, Error | A, ErrorR | R>
222
+ /**
223
+ * Add an error schema to an `HttpApi`, which is shared by all endpoints in the
224
+ * `HttpApi`.
225
+ *
226
+ * Useful for adding error types from middleware or other shared error types.
227
+ *
228
+ * @since 1.0.0
229
+ * @category errors
230
+ */
189
231
  <Groups extends HttpApiGroup.HttpApiGroup.Any, Error, ErrorR, A, I, R>(
190
232
  self: HttpApi<Groups, Error, ErrorR>,
191
233
  schema: Schema.Schema<A, I, R>,
@@ -219,7 +261,15 @@ export const addError: {
219
261
  * @category annotations
220
262
  */
221
263
  export const annotateMerge: {
264
+ /**
265
+ * @since 1.0.0
266
+ * @category annotations
267
+ */
222
268
  <I>(context: Context.Context<I>): <A extends HttpApi.Any>(self: A) => A
269
+ /**
270
+ * @since 1.0.0
271
+ * @category annotations
272
+ */
223
273
  <A extends HttpApi.Any, I>(self: A, context: Context.Context<I>): A
224
274
  } = dual(
225
275
  2,
@@ -236,7 +286,15 @@ export const annotateMerge: {
236
286
  * @category annotations
237
287
  */
238
288
  export const annotate: {
289
+ /**
290
+ * @since 1.0.0
291
+ * @category annotations
292
+ */
239
293
  <I, S>(tag: Context.Tag<I, S>, value: S): <A extends HttpApi.Any>(self: A) => A
294
+ /**
295
+ * @since 1.0.0
296
+ * @category annotations
297
+ */
240
298
  <A extends HttpApi.Any, I, S>(self: A, tag: Context.Tag<I, S>, value: S): A
241
299
  } = dual(
242
300
  3,
@@ -57,10 +57,28 @@ export class Router extends HttpRouter.Tag("@effect/platform/HttpApiBuilder/Rout
57
57
  * @category constructors
58
58
  */
59
59
  export const serve: {
60
+ /**
61
+ * Build an `HttpApp` from an `HttpApi` instance, and serve it using an
62
+ * `HttpServer`.
63
+ *
64
+ * Optionally, you can provide a middleware function that will be applied to
65
+ * the `HttpApp` before serving.
66
+ *
67
+ * @since 1.0.0
68
+ * @category constructors
69
+ */
60
70
  (): Layer.Layer<never, never, HttpServer.HttpServer | HttpApi.HttpApi.Service | HttpRouter.HttpRouter.DefaultServices>
61
- <R>(
62
- middleware: (httpApp: HttpApp.Default) => HttpApp.Default<never, R>
63
- ): Layer.Layer<
71
+ /**
72
+ * Build an `HttpApp` from an `HttpApi` instance, and serve it using an
73
+ * `HttpServer`.
74
+ *
75
+ * Optionally, you can provide a middleware function that will be applied to
76
+ * the `HttpApp` before serving.
77
+ *
78
+ * @since 1.0.0
79
+ * @category constructors
80
+ */
81
+ <R>(middleware: (httpApp: HttpApp.Default) => HttpApp.Default<never, R>): Layer.Layer<
64
82
  never,
65
83
  never,
66
84
  | HttpServer.HttpServer
@@ -313,6 +331,12 @@ export const group = <
313
331
  * @category handlers
314
332
  */
315
333
  export const handle: {
334
+ /**
335
+ * Add the implementation for an `HttpApiEndpoint` to a `Handlers` group.
336
+ *
337
+ * @since 1.0.0
338
+ * @category handlers
339
+ */
316
340
  <Endpoints extends HttpApiEndpoint.HttpApiEndpoint.All, const Name extends Endpoints["name"], E, R>(
317
341
  name: Name,
318
342
  handler: HttpApiEndpoint.HttpApiEndpoint.HandlerWithName<Endpoints, Name, E, R>
@@ -321,6 +345,12 @@ export const handle: {
321
345
  RG | HttpApiEndpoint.HttpApiEndpoint.ExcludeProvided<R>,
322
346
  HttpApiEndpoint.HttpApiEndpoint.ExcludeName<Endpoints, Name>
323
347
  >
348
+ /**
349
+ * Add the implementation for an `HttpApiEndpoint` to a `Handlers` group.
350
+ *
351
+ * @since 1.0.0
352
+ * @category handlers
353
+ */
324
354
  <Endpoints extends HttpApiEndpoint.HttpApiEndpoint.All, const Name extends Endpoints["name"], E, R>(
325
355
  name: Name,
326
356
  handler: HttpApiEndpoint.HttpApiEndpoint.HandlerResponseWithName<Endpoints, Name, E, R>,
@@ -436,18 +466,36 @@ const middlewareAddNoContext = (
436
466
  * @category middleware
437
467
  */
438
468
  export const middlewareLayer: {
469
+ /**
470
+ * Create an `HttpApi` level middleware `Layer`.
471
+ *
472
+ * @since 1.0.0
473
+ * @category middleware
474
+ */
439
475
  <EX = never, RX = never>(
440
476
  middleware: ApiMiddleware.Fn<never> | Effect.Effect<ApiMiddleware.Fn<never>, EX, RX>,
441
477
  options?: {
442
478
  readonly withContext?: false | undefined
443
479
  }
444
480
  ): Layer.Layer<never, EX, RX>
481
+ /**
482
+ * Create an `HttpApi` level middleware `Layer`.
483
+ *
484
+ * @since 1.0.0
485
+ * @category middleware
486
+ */
445
487
  <R, EX = never, RX = never>(
446
488
  middleware: ApiMiddleware.Fn<never, R> | Effect.Effect<ApiMiddleware.Fn<never, R>, EX, RX>,
447
489
  options: {
448
490
  readonly withContext: true
449
491
  }
450
492
  ): Layer.Layer<never, EX, HttpRouter.HttpRouter.ExcludeProvided<R> | RX>
493
+ /**
494
+ * Create an `HttpApi` level middleware `Layer`.
495
+ *
496
+ * @since 1.0.0
497
+ * @category middleware
498
+ */
451
499
  <Groups extends HttpApiGroup.HttpApiGroup.Any, Error, ErrorR, EX = never, RX = never>(
452
500
  api: HttpApi.HttpApi<Groups, Error, ErrorR>,
453
501
  middleware: ApiMiddleware.Fn<NoInfer<Error>> | Effect.Effect<ApiMiddleware.Fn<NoInfer<Error>>, EX, RX>,
@@ -455,6 +503,12 @@ export const middlewareLayer: {
455
503
  readonly withContext?: false | undefined
456
504
  }
457
505
  ): Layer.Layer<never, EX, RX>
506
+ /**
507
+ * Create an `HttpApi` level middleware `Layer`.
508
+ *
509
+ * @since 1.0.0
510
+ * @category middleware
511
+ */
458
512
  <Groups extends HttpApiGroup.HttpApiGroup.Any, Error, ErrorR, R, EX = never, RX = never>(
459
513
  api: HttpApi.HttpApi<Groups, Error, ErrorR>,
460
514
  middleware: ApiMiddleware.Fn<NoInfer<Error>, R> | Effect.Effect<ApiMiddleware.Fn<NoInfer<Error>, R>, EX, RX>,
@@ -493,18 +547,39 @@ export const middlewareLayer: {
493
547
  * @category middleware
494
548
  */
495
549
  export const middlewareLayerScoped: {
550
+ /**
551
+ * Create an `HttpApi` level middleware `Layer`, that has a `Scope` provided to
552
+ * the constructor.
553
+ *
554
+ * @since 1.0.0
555
+ * @category middleware
556
+ */
496
557
  <EX, RX>(
497
558
  middleware: Effect.Effect<ApiMiddleware.Fn<never>, EX, RX>,
498
559
  options?: {
499
560
  readonly withContext?: false | undefined
500
561
  }
501
562
  ): Layer.Layer<never, EX, Exclude<RX, Scope>>
563
+ /**
564
+ * Create an `HttpApi` level middleware `Layer`, that has a `Scope` provided to
565
+ * the constructor.
566
+ *
567
+ * @since 1.0.0
568
+ * @category middleware
569
+ */
502
570
  <R, EX, RX>(
503
571
  middleware: Effect.Effect<ApiMiddleware.Fn<never, R>, EX, RX>,
504
572
  options: {
505
573
  readonly withContext: true
506
574
  }
507
575
  ): Layer.Layer<never, EX, HttpRouter.HttpRouter.ExcludeProvided<R> | Exclude<RX, Scope>>
576
+ /**
577
+ * Create an `HttpApi` level middleware `Layer`, that has a `Scope` provided to
578
+ * the constructor.
579
+ *
580
+ * @since 1.0.0
581
+ * @category middleware
582
+ */
508
583
  <Groups extends HttpApiGroup.HttpApiGroup.Any, Error, ErrorR, EX, RX>(
509
584
  api: HttpApi.HttpApi<Groups, Error, ErrorR>,
510
585
  middleware: Effect.Effect<ApiMiddleware.Fn<NoInfer<Error>>, EX, RX>,
@@ -512,6 +587,13 @@ export const middlewareLayerScoped: {
512
587
  readonly withContext?: false | undefined
513
588
  }
514
589
  ): Layer.Layer<never, EX, Exclude<RX, Scope>>
590
+ /**
591
+ * Create an `HttpApi` level middleware `Layer`, that has a `Scope` provided to
592
+ * the constructor.
593
+ *
594
+ * @since 1.0.0
595
+ * @category middleware
596
+ */
515
597
  <Groups extends HttpApiGroup.HttpApiGroup.Any, Error, ErrorR, R, EX, RX>(
516
598
  api: HttpApi.HttpApi<Groups, Error, ErrorR>,
517
599
  middleware: Effect.Effect<ApiMiddleware.Fn<NoInfer<Error>, R>, EX, RX>,
@@ -444,6 +444,13 @@ export const del: <const Name extends string>(
444
444
  * @category result
445
445
  */
446
446
  export const setSuccess: {
447
+ /**
448
+ * Set the schema for the success response of the endpoint. The status code
449
+ * will be inferred from the schema, otherwise it will default to 200.
450
+ *
451
+ * @since 1.0.0
452
+ * @category result
453
+ */
447
454
  <S extends Schema.Schema.Any>(
448
455
  schema: S,
449
456
  annotations?: {
@@ -461,6 +468,13 @@ export const setSuccess: {
461
468
  >(
462
469
  self: HttpApiEndpoint<Name, Method, _Path, _P, _H, _S, _E, _R>
463
470
  ) => HttpApiEndpoint<Name, Method, _Path, _P, _H, Schema.Schema.Type<S>, _E, _R | Schema.Schema.Context<S>>
471
+ /**
472
+ * Set the schema for the success response of the endpoint. The status code
473
+ * will be inferred from the schema, otherwise it will default to 200.
474
+ *
475
+ * @since 1.0.0
476
+ * @category result
477
+ */
464
478
  <
465
479
  Name extends string,
466
480
  Method extends HttpMethod,
@@ -513,6 +527,13 @@ export const setSuccess: {
513
527
  * @category result
514
528
  */
515
529
  export const addError: {
530
+ /**
531
+ * Add an error response schema to the endpoint. The status code
532
+ * will be inferred from the schema, otherwise it will default to 500.
533
+ *
534
+ * @since 1.0.0
535
+ * @category result
536
+ */
516
537
  <E extends Schema.Schema.All>(
517
538
  schema: E,
518
539
  annotations?: {
@@ -530,6 +551,13 @@ export const addError: {
530
551
  >(
531
552
  self: HttpApiEndpoint<Name, Method, _Path, _P, _H, _S, _E, _R>
532
553
  ) => HttpApiEndpoint<Name, Method, _Path, _P, _H, _S, _E | Schema.Schema.Type<E>, _R | Schema.Schema.Context<E>>
554
+ /**
555
+ * Add an error response schema to the endpoint. The status code
556
+ * will be inferred from the schema, otherwise it will default to 500.
557
+ *
558
+ * @since 1.0.0
559
+ * @category result
560
+ */
533
561
  <
534
562
  Name extends string,
535
563
  Method extends HttpMethod,
@@ -593,9 +621,20 @@ export const addError: {
593
621
  * @category request
594
622
  */
595
623
  export const setPayload: {
596
- <Method extends HttpMethod, P extends Schema.Schema.All>(
597
- schema: P & HttpApiEndpoint.ValidatePayload<Method, P>
598
- ): <
624
+ /**
625
+ * Set the schema for the request body of the endpoint. The schema will be
626
+ * used to validate the request body before the handler is called.
627
+ *
628
+ * For endpoints with no request body, the payload will use the url search
629
+ * parameters.
630
+ *
631
+ * You can set a multipart schema to handle file uploads by using the
632
+ * `HttpApiSchema.Multipart` combinator.
633
+ *
634
+ * @since 1.0.0
635
+ * @category request
636
+ */
637
+ <Method extends HttpMethod, P extends Schema.Schema.All>(schema: P & HttpApiEndpoint.ValidatePayload<Method, P>): <
599
638
  Name extends string,
600
639
  _Path,
601
640
  _P,
@@ -606,6 +645,19 @@ export const setPayload: {
606
645
  >(
607
646
  self: HttpApiEndpoint<Name, Method, _Path, _P, _H, _S, _E, _R>
608
647
  ) => HttpApiEndpoint<Name, Method, _Path, Schema.Schema.Type<P>, _H, _S, _E, _R | Schema.Schema.Context<P>>
648
+ /**
649
+ * Set the schema for the request body of the endpoint. The schema will be
650
+ * used to validate the request body before the handler is called.
651
+ *
652
+ * For endpoints with no request body, the payload will use the url search
653
+ * parameters.
654
+ *
655
+ * You can set a multipart schema to handle file uploads by using the
656
+ * `HttpApiSchema.Multipart` combinator.
657
+ *
658
+ * @since 1.0.0
659
+ * @category request
660
+ */
609
661
  <
610
662
  Name extends string,
611
663
  Method extends HttpMethod,
@@ -650,9 +702,14 @@ export const setPayload: {
650
702
  * @category request
651
703
  */
652
704
  export const setPath: {
653
- <Path extends Schema.Schema.Any>(
654
- schema: Path & HttpApiEndpoint.ValidatePath<Path>
655
- ): <
705
+ /**
706
+ * Set the schema for the path parameters of the endpoint. The schema will be
707
+ * used to validate the path parameters before the handler is called.
708
+ *
709
+ * @since 1.0.0
710
+ * @category request
711
+ */
712
+ <Path extends Schema.Schema.Any>(schema: Path & HttpApiEndpoint.ValidatePath<Path>): <
656
713
  Name extends string,
657
714
  Method extends HttpMethod,
658
715
  _Path,
@@ -664,6 +721,13 @@ export const setPath: {
664
721
  >(
665
722
  self: HttpApiEndpoint<Name, Method, _Path, _P, _H, _S, _E, _R>
666
723
  ) => HttpApiEndpoint<Name, Method, Schema.Schema.Type<Path>, _P, _H, _S, _E, _R | Schema.Schema.Context<Path>>
724
+ /**
725
+ * Set the schema for the path parameters of the endpoint. The schema will be
726
+ * used to validate the path parameters before the handler is called.
727
+ *
728
+ * @since 1.0.0
729
+ * @category request
730
+ */
667
731
  <
668
732
  Name extends string,
669
733
  Method extends HttpMethod,
@@ -708,9 +772,14 @@ export const setPath: {
708
772
  * @category request
709
773
  */
710
774
  export const setHeaders: {
711
- <Method extends HttpMethod, H extends Schema.Schema.Any>(
712
- schema: H & HttpApiEndpoint.ValidateHeaders<H>
713
- ): <
775
+ /**
776
+ * Set the schema for the headers of the endpoint. The schema will be
777
+ * used to validate the headers before the handler is called.
778
+ *
779
+ * @since 1.0.0
780
+ * @category request
781
+ */
782
+ <Method extends HttpMethod, H extends Schema.Schema.Any>(schema: H & HttpApiEndpoint.ValidateHeaders<H>): <
714
783
  Name extends string,
715
784
  _Path,
716
785
  _P,
@@ -721,6 +790,13 @@ export const setHeaders: {
721
790
  >(
722
791
  self: HttpApiEndpoint<Name, Method, _Path, _P, _H, _S, _E, _R>
723
792
  ) => HttpApiEndpoint<Name, Method, _Path, _P, Schema.Schema.Type<H>, _S, _E, _R | Schema.Schema.Context<H>>
793
+ /**
794
+ * Set the schema for the headers of the endpoint. The schema will be
795
+ * used to validate the headers before the handler is called.
796
+ *
797
+ * @since 1.0.0
798
+ * @category request
799
+ */
724
800
  <
725
801
  Name extends string,
726
802
  Method extends HttpMethod,
@@ -764,7 +840,19 @@ export const setHeaders: {
764
840
  * @category request
765
841
  */
766
842
  export const prefix: {
843
+ /**
844
+ * Add a prefix to the path of the endpoint.
845
+ *
846
+ * @since 1.0.0
847
+ * @category request
848
+ */
767
849
  (prefix: HttpRouter.PathInput): <A extends HttpApiEndpoint.All>(self: A) => A
850
+ /**
851
+ * Add a prefix to the path of the endpoint.
852
+ *
853
+ * @since 1.0.0
854
+ * @category request
855
+ */
768
856
  <A extends HttpApiEndpoint.All>(self: A, prefix: HttpRouter.PathInput): A
769
857
  } = dual(2, <A extends HttpApiEndpoint.All>(self: A, prefix: HttpRouter.PathInput): A =>
770
858
  makeProto({
@@ -788,7 +876,19 @@ export const schemaSuccess = <A extends HttpApiEndpoint.All>(
788
876
  * @category annotations
789
877
  */
790
878
  export const annotateMerge: {
879
+ /**
880
+ * Merge the annotations of the endpoint with the provided context.
881
+ *
882
+ * @since 1.0.0
883
+ * @category annotations
884
+ */
791
885
  <I>(context: Context.Context<I>): <A extends HttpApiEndpoint.All>(self: A) => A
886
+ /**
887
+ * Merge the annotations of the endpoint with the provided context.
888
+ *
889
+ * @since 1.0.0
890
+ * @category annotations
891
+ */
792
892
  <A extends HttpApiEndpoint.All, I>(self: A, context: Context.Context<I>): A
793
893
  } = dual(
794
894
  2,
@@ -806,7 +906,19 @@ export const annotateMerge: {
806
906
  * @category annotations
807
907
  */
808
908
  export const annotate: {
909
+ /**
910
+ * Add an annotation to the endpoint.
911
+ *
912
+ * @since 1.0.0
913
+ * @category annotations
914
+ */
809
915
  <I, S>(tag: Context.Tag<I, S>, value: S): <A extends HttpApiEndpoint.All>(self: A) => A
916
+ /**
917
+ * Add an annotation to the endpoint.
918
+ *
919
+ * @since 1.0.0
920
+ * @category annotations
921
+ */
810
922
  <A extends HttpApiEndpoint.All, I, S>(self: A, tag: Context.Tag<I, S>, value: S): A
811
923
  } = dual(
812
924
  3,
@@ -175,21 +175,30 @@ export const make = <Name extends string>(identifier: Name): HttpApiGroup<Name>
175
175
  * @category endpoints
176
176
  */
177
177
  export const add: {
178
+ /**
179
+ * Add an `HttpApiEndpoint` to an `HttpApiGroup`.
180
+ *
181
+ * @since 1.0.0
182
+ * @category endpoints
183
+ */
178
184
  <A extends HttpApiEndpoint.HttpApiEndpoint.All>(
179
185
  endpoint: A
180
186
  ): <Name extends string, Endpoints extends HttpApiEndpoint.HttpApiEndpoint.All, Error, ErrorR>(
181
187
  self: HttpApiGroup<Name, Endpoints, Error, ErrorR>
182
188
  ) => HttpApiGroup<Name, Endpoints | A, Error, ErrorR>
189
+ /**
190
+ * Add an `HttpApiEndpoint` to an `HttpApiGroup`.
191
+ *
192
+ * @since 1.0.0
193
+ * @category endpoints
194
+ */
183
195
  <
184
196
  Name extends string,
185
197
  Endpoints extends HttpApiEndpoint.HttpApiEndpoint.All,
186
198
  Error,
187
199
  ErrorR,
188
200
  A extends HttpApiEndpoint.HttpApiEndpoint.All
189
- >(
190
- self: HttpApiGroup<Name, Endpoints, Error, ErrorR>,
191
- endpoint: A
192
- ): HttpApiGroup<Name, Endpoints | A, Error, ErrorR>
201
+ >(self: HttpApiGroup<Name, Endpoints, Error, ErrorR>, endpoint: A): HttpApiGroup<Name, Endpoints | A, Error, ErrorR>
193
202
  } = dual(2, <
194
203
  Name extends string,
195
204
  Endpoints extends HttpApiEndpoint.HttpApiEndpoint.All,
@@ -215,6 +224,13 @@ export const add: {
215
224
  * @category errors
216
225
  */
217
226
  export const addError: {
227
+ /**
228
+ * Add an error schema to an `HttpApiGroup`, which is shared by all endpoints in the
229
+ * group.
230
+ *
231
+ * @since 1.0.0
232
+ * @category errors
233
+ */
218
234
  <A, I, R>(
219
235
  schema: Schema.Schema<A, I, R>,
220
236
  annotations?: {
@@ -223,6 +239,13 @@ export const addError: {
223
239
  ): <Name extends string, Endpoints extends HttpApiEndpoint.HttpApiEndpoint.All, Error, ErrorR>(
224
240
  self: HttpApiGroup<Name, Endpoints, Error, ErrorR>
225
241
  ) => HttpApiGroup<Name, Endpoints, Error | A, ErrorR | R>
242
+ /**
243
+ * Add an error schema to an `HttpApiGroup`, which is shared by all endpoints in the
244
+ * group.
245
+ *
246
+ * @since 1.0.0
247
+ * @category errors
248
+ */
226
249
  <Name extends string, Endpoints extends HttpApiEndpoint.HttpApiEndpoint.All, Error, ErrorR, A, I, R>(
227
250
  self: HttpApiGroup<Name, Endpoints, Error, ErrorR>,
228
251
  schema: Schema.Schema<A, I, R>,
@@ -260,11 +283,23 @@ export const addError: {
260
283
  * @category endpoints
261
284
  */
262
285
  export const prefix: {
263
- (
264
- prefix: PathInput
265
- ): <Name extends string, Endpoints extends HttpApiEndpoint.HttpApiEndpoint.All, Error, ErrorR>(
286
+ /**
287
+ * Add a path prefix to all endpoints in an `HttpApiGroup`. Note that this will only
288
+ * add the prefix to the endpoints before this api is called.
289
+ *
290
+ * @since 1.0.0
291
+ * @category endpoints
292
+ */
293
+ (prefix: PathInput): <Name extends string, Endpoints extends HttpApiEndpoint.HttpApiEndpoint.All, Error, ErrorR>(
266
294
  self: HttpApiGroup<Name, Endpoints, Error, ErrorR>
267
295
  ) => HttpApiGroup<Name, Endpoints, Error, ErrorR>
296
+ /**
297
+ * Add a path prefix to all endpoints in an `HttpApiGroup`. Note that this will only
298
+ * add the prefix to the endpoints before this api is called.
299
+ *
300
+ * @since 1.0.0
301
+ * @category endpoints
302
+ */
268
303
  <Name extends string, Endpoints extends HttpApiEndpoint.HttpApiEndpoint.All, Error, ErrorR>(
269
304
  self: HttpApiGroup<Name, Endpoints, Error, ErrorR>,
270
305
  prefix: PathInput
@@ -287,7 +322,19 @@ export const prefix: {
287
322
  * @category annotations
288
323
  */
289
324
  export const annotateMerge: {
325
+ /**
326
+ * Merge the annotations of an `HttpApiGroup` with a new context.
327
+ *
328
+ * @since 1.0.0
329
+ * @category annotations
330
+ */
290
331
  <I>(context: Context.Context<I>): <A extends HttpApiGroup.Any>(self: A) => A
332
+ /**
333
+ * Merge the annotations of an `HttpApiGroup` with a new context.
334
+ *
335
+ * @since 1.0.0
336
+ * @category annotations
337
+ */
291
338
  <A extends HttpApiGroup.Any, I>(self: A, context: Context.Context<I>): A
292
339
  } = dual(
293
340
  2,
@@ -305,7 +352,19 @@ export const annotateMerge: {
305
352
  * @category annotations
306
353
  */
307
354
  export const annotate: {
355
+ /**
356
+ * Add an annotation to an `HttpApiGroup`.
357
+ *
358
+ * @since 1.0.0
359
+ * @category annotations
360
+ */
308
361
  <I, S>(tag: Context.Tag<I, S>, value: S): <A extends HttpApiGroup.Any>(self: A) => A
362
+ /**
363
+ * Add an annotation to an `HttpApiGroup`.
364
+ *
365
+ * @since 1.0.0
366
+ * @category annotations
367
+ */
309
368
  <A extends HttpApiGroup.Any, I, S>(self: A, tag: Context.Tag<I, S>, value: S): A
310
369
  } = dual(
311
370
  3,
@@ -328,7 +387,25 @@ export const annotate: {
328
387
  * @category annotations
329
388
  */
330
389
  export const annotateEndpointsMerge: {
390
+ /**
391
+ * For each endpoint in an `HttpApiGroup`, update the annotations with a new
392
+ * context.
393
+ *
394
+ * Note that this will only update the annotations before this api is called.
395
+ *
396
+ * @since 1.0.0
397
+ * @category annotations
398
+ */
331
399
  <I>(context: Context.Context<I>): <A extends HttpApiGroup.Any>(self: A) => A
400
+ /**
401
+ * For each endpoint in an `HttpApiGroup`, update the annotations with a new
402
+ * context.
403
+ *
404
+ * Note that this will only update the annotations before this api is called.
405
+ *
406
+ * @since 1.0.0
407
+ * @category annotations
408
+ */
332
409
  <A extends HttpApiGroup.Any, I>(self: A, context: Context.Context<I>): A
333
410
  } = dual(
334
411
  2,
@@ -351,7 +428,25 @@ export const annotateEndpointsMerge: {
351
428
  * @category annotations
352
429
  */
353
430
  export const annotateEndpoints: {
431
+ /**
432
+ * For each endpoint in an `HttpApiGroup`, add an annotation.
433
+ *
434
+ * Note that this will only add the annotation to the endpoints before this api
435
+ * is called.
436
+ *
437
+ * @since 1.0.0
438
+ * @category annotations
439
+ */
354
440
  <I, S>(tag: Context.Tag<I, S>, value: S): <A extends HttpApiGroup.Any>(self: A) => A
441
+ /**
442
+ * For each endpoint in an `HttpApiGroup`, add an annotation.
443
+ *
444
+ * Note that this will only add the annotation to the endpoints before this api
445
+ * is called.
446
+ *
447
+ * @since 1.0.0
448
+ * @category annotations
449
+ */
355
450
  <A extends HttpApiGroup.Any, I, S>(self: A, tag: Context.Tag<I, S>, value: S): A
356
451
  } = dual(
357
452
  3,