@effect/platform 0.77.1 → 0.77.3

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 (38) hide show
  1. package/dist/cjs/Effectify.js.map +1 -1
  2. package/dist/cjs/HttpApiBuilder.js +4 -2
  3. package/dist/cjs/HttpApiBuilder.js.map +1 -1
  4. package/dist/cjs/HttpClient.js.map +1 -1
  5. package/dist/cjs/HttpMiddleware.js.map +1 -1
  6. package/dist/cjs/HttpMultiplex.js.map +1 -1
  7. package/dist/cjs/HttpRouter.js.map +1 -1
  8. package/dist/cjs/HttpServer.js.map +1 -1
  9. package/dist/cjs/HttpServerResponse.js.map +1 -1
  10. package/dist/dts/Effectify.d.ts.map +1 -1
  11. package/dist/dts/HttpApiBuilder.d.ts.map +1 -1
  12. package/dist/dts/HttpClient.d.ts.map +1 -1
  13. package/dist/dts/HttpClientRequest.d.ts.map +1 -1
  14. package/dist/dts/HttpMiddleware.d.ts.map +1 -1
  15. package/dist/dts/HttpMultiplex.d.ts.map +1 -1
  16. package/dist/dts/HttpRouter.d.ts.map +1 -1
  17. package/dist/dts/HttpServer.d.ts.map +1 -1
  18. package/dist/dts/HttpServerResponse.d.ts.map +1 -1
  19. package/dist/dts/WorkerError.d.ts +1 -1
  20. package/dist/esm/Effectify.js.map +1 -1
  21. package/dist/esm/HttpApiBuilder.js +4 -2
  22. package/dist/esm/HttpApiBuilder.js.map +1 -1
  23. package/dist/esm/HttpClient.js.map +1 -1
  24. package/dist/esm/HttpMiddleware.js.map +1 -1
  25. package/dist/esm/HttpMultiplex.js.map +1 -1
  26. package/dist/esm/HttpRouter.js.map +1 -1
  27. package/dist/esm/HttpServer.js.map +1 -1
  28. package/dist/esm/HttpServerResponse.js.map +1 -1
  29. package/package.json +2 -2
  30. package/src/Effectify.ts +1 -4
  31. package/src/HttpApiBuilder.ts +4 -2
  32. package/src/HttpClient.ts +7 -21
  33. package/src/HttpClientRequest.ts +13 -13
  34. package/src/HttpMiddleware.ts +2 -6
  35. package/src/HttpMultiplex.ts +4 -20
  36. package/src/HttpRouter.ts +8 -30
  37. package/src/HttpServer.ts +2 -6
  38. package/src/HttpServerResponse.ts +1 -4
@@ -569,6 +569,7 @@ function isSingleStringType(ast: AST.AST, key?: PropertyKey): boolean {
569
569
  case "StringKeyword":
570
570
  case "Literal":
571
571
  case "TemplateLiteral":
572
+ case "Enums":
572
573
  return true
573
574
  case "TypeLiteral": {
574
575
  if (key !== undefined) {
@@ -995,8 +996,9 @@ export const securityDecode = <Security extends HttpApiSecurity.HttpApiSecurity>
995
996
  )
996
997
  }
997
998
  case "ApiKey": {
999
+ const key = self.in === "header" ? self.key.toLowerCase() : self.key
998
1000
  const schema = Schema.Struct({
999
- [self.key]: Schema.String
1001
+ [key]: Schema.String
1000
1002
  })
1001
1003
  const decode = unify(
1002
1004
  self.in === "query"
@@ -1007,7 +1009,7 @@ export const securityDecode = <Security extends HttpApiSecurity.HttpApiSecurity>
1007
1009
  )
1008
1010
  return Effect.match(decode, {
1009
1011
  onFailure: () => Redacted.make("") as any,
1010
- onSuccess: (match) => Redacted.make(match[self.key])
1012
+ onSuccess: (match) => Redacted.make(match[key])
1011
1013
  })
1012
1014
  }
1013
1015
  case "Basic": {
package/src/HttpClient.ts CHANGED
@@ -213,9 +213,7 @@ export const catchAll: {
213
213
  * @since 1.0.0
214
214
  * @category error handling
215
215
  */
216
- <E, E2, R2>(
217
- f: (e: E) => Effect.Effect<ClientResponse.HttpClientResponse, E2, R2>
218
- ): <R>(self: HttpClient.With<E, R>) => HttpClient.With<E2, R2 | R>
216
+ <E, E2, R2>(f: (e: E) => Effect.Effect<ClientResponse.HttpClientResponse, E2, R2>): <R>(self: HttpClient.With<E, R>) => HttpClient.With<E2, R2 | R>
219
217
  /**
220
218
  * @since 1.0.0
221
219
  * @category error handling
@@ -486,9 +484,7 @@ export const mapRequest: {
486
484
  * @since 1.0.0
487
485
  * @category mapping & sequencing
488
486
  */
489
- (
490
- f: (a: ClientRequest.HttpClientRequest) => ClientRequest.HttpClientRequest
491
- ): <E, R>(self: HttpClient.With<E, R>) => HttpClient.With<E, R>
487
+ (f: (a: ClientRequest.HttpClientRequest) => ClientRequest.HttpClientRequest): <E, R>(self: HttpClient.With<E, R>) => HttpClient.With<E, R>
492
488
  /**
493
489
  * Appends a transformation of the request object before sending it.
494
490
  *
@@ -542,9 +538,7 @@ export const mapRequestInput: {
542
538
  * @since 1.0.0
543
539
  * @category mapping & sequencing
544
540
  */
545
- (
546
- f: (a: ClientRequest.HttpClientRequest) => ClientRequest.HttpClientRequest
547
- ): <E, R>(self: HttpClient.With<E, R>) => HttpClient.With<E, R>
541
+ (f: (a: ClientRequest.HttpClientRequest) => ClientRequest.HttpClientRequest): <E, R>(self: HttpClient.With<E, R>) => HttpClient.With<E, R>
548
542
  /**
549
543
  * Prepends a transformation of the request object before sending it.
550
544
  *
@@ -627,9 +621,7 @@ export const retry: {
627
621
  * @since 1.0.0
628
622
  * @category error handling
629
623
  */
630
- <B, E, R1>(
631
- policy: Schedule.Schedule<B, NoInfer<E>, R1>
632
- ): <R>(self: HttpClient.With<E, R>) => HttpClient.With<E, R1 | R>
624
+ <B, E, R1>(policy: Schedule.Schedule<B, NoInfer<E>, R1>): <R>(self: HttpClient.With<E, R>) => HttpClient.With<E, R1 | R>
633
625
  /**
634
626
  * Retries the request based on a provided schedule or policy.
635
627
  *
@@ -732,9 +724,7 @@ export const tapError: {
732
724
  * @since 1.0.0
733
725
  * @category mapping & sequencing
734
726
  */
735
- <_, E, E2, R2>(
736
- f: (e: NoInfer<E>) => Effect.Effect<_, E2, R2>
737
- ): <R>(self: HttpClient.With<E, R>) => HttpClient.With<E | E2, R | R2>
727
+ <_, E, E2, R2>(f: (e: NoInfer<E>) => Effect.Effect<_, E2, R2>): <R>(self: HttpClient.With<E, R>) => HttpClient.With<E | E2, R | R2>
738
728
  /**
739
729
  * Performs an additional effect after an unsuccessful request.
740
730
  *
@@ -760,9 +750,7 @@ export const tapRequest: {
760
750
  * @since 1.0.0
761
751
  * @category mapping & sequencing
762
752
  */
763
- <_, E2, R2>(
764
- f: (a: ClientRequest.HttpClientRequest) => Effect.Effect<_, E2, R2>
765
- ): <E, R>(self: HttpClient.With<E, R>) => HttpClient.With<E | E2, R | R2>
753
+ <_, E2, R2>(f: (a: ClientRequest.HttpClientRequest) => Effect.Effect<_, E2, R2>): <E, R>(self: HttpClient.With<E, R>) => HttpClient.With<E | E2, R | R2>
766
754
  /**
767
755
  * Performs an additional effect on the request before sending it.
768
756
  *
@@ -841,9 +829,7 @@ export const withTracerDisabledWhen: {
841
829
  * @since 1.0.0
842
830
  * @category fiber refs
843
831
  */
844
- (
845
- predicate: Predicate.Predicate<ClientRequest.HttpClientRequest>
846
- ): <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>
832
+ (predicate: Predicate.Predicate<ClientRequest.HttpClientRequest>): <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>
847
833
  /**
848
834
  * Disables tracing for specific requests based on a provided predicate.
849
835
  *
@@ -211,9 +211,9 @@ export const basicAuth: {
211
211
  * @category combinators
212
212
  */
213
213
  (
214
- self: HttpClientRequest,
215
- username: string | Redacted,
216
- password: string | Redacted
214
+ self: HttpClientRequest,
215
+ username: string | Redacted,
216
+ password: string | Redacted
217
217
  ): HttpClientRequest
218
218
  } = internal.basicAuth
219
219
 
@@ -557,17 +557,17 @@ export const bodyStream: {
557
557
  * @category combinators
558
558
  */
559
559
  (
560
- body: Stream.Stream<Uint8Array, unknown>,
561
- options?: { readonly contentType?: string | undefined; readonly contentLength?: number | undefined } | undefined
560
+ body: Stream.Stream<Uint8Array, unknown>,
561
+ options?: { readonly contentType?: string | undefined; readonly contentLength?: number | undefined } | undefined
562
562
  ): (self: HttpClientRequest) => HttpClientRequest
563
563
  /**
564
564
  * @since 1.0.0
565
565
  * @category combinators
566
566
  */
567
567
  (
568
- self: HttpClientRequest,
569
- body: Stream.Stream<Uint8Array, unknown>,
570
- options?: { readonly contentType?: string | undefined; readonly contentLength?: number | undefined } | undefined
568
+ self: HttpClientRequest,
569
+ body: Stream.Stream<Uint8Array, unknown>,
570
+ options?: { readonly contentType?: string | undefined; readonly contentLength?: number | undefined } | undefined
571
571
  ): HttpClientRequest
572
572
  } = internal.bodyStream
573
573
 
@@ -581,17 +581,17 @@ export const bodyFile: {
581
581
  * @category combinators
582
582
  */
583
583
  (
584
- path: string,
585
- options?: FileSystem.StreamOptions & { readonly contentType?: string }
584
+ path: string,
585
+ options?: FileSystem.StreamOptions & { readonly contentType?: string }
586
586
  ): (self: HttpClientRequest) => Effect.Effect<HttpClientRequest, PlatformError.PlatformError, FileSystem.FileSystem>
587
587
  /**
588
588
  * @since 1.0.0
589
589
  * @category combinators
590
590
  */
591
591
  (
592
- self: HttpClientRequest,
593
- path: string,
594
- options?: FileSystem.StreamOptions & { readonly contentType?: string }
592
+ self: HttpClientRequest,
593
+ path: string,
594
+ options?: FileSystem.StreamOptions & { readonly contentType?: string }
595
595
  ): Effect.Effect<HttpClientRequest, PlatformError.PlatformError, FileSystem.FileSystem>
596
596
  } = internal.bodyFile
597
597
 
@@ -70,9 +70,7 @@ export const withTracerDisabledWhen: {
70
70
  * @since 1.0.0
71
71
  * @category fiber refs
72
72
  */
73
- (
74
- predicate: Predicate.Predicate<ServerRequest.HttpServerRequest>
75
- ): <A, E, R>(layer: Layer.Layer<A, E, R>) => Layer.Layer<A, E, R>
73
+ (predicate: Predicate.Predicate<ServerRequest.HttpServerRequest>): <A, E, R>(layer: Layer.Layer<A, E, R>) => Layer.Layer<A, E, R>
76
74
  /**
77
75
  * @since 1.0.0
78
76
  * @category fiber refs
@@ -92,9 +90,7 @@ export const withTracerDisabledWhenEffect: {
92
90
  * @since 1.0.0
93
91
  * @category fiber refs
94
92
  */
95
- (
96
- predicate: Predicate.Predicate<ServerRequest.HttpServerRequest>
97
- ): <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>
93
+ (predicate: Predicate.Predicate<ServerRequest.HttpServerRequest>): <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>
98
94
  /**
99
95
  * @since 1.0.0
100
96
  * @category fiber refs
@@ -86,11 +86,7 @@ export const headerExact: {
86
86
  * @since 1.0.0
87
87
  * @category combinators
88
88
  */
89
- <E2, R2>(
90
- header: string,
91
- value: string,
92
- app: App.Default<E2, R2>
93
- ): <E, R>(self: HttpMultiplex<E, R>) => HttpMultiplex<E2 | E, R2 | R>
89
+ <E2, R2>(header: string, value: string, app: App.Default<E2, R2>): <E, R>(self: HttpMultiplex<E, R>) => HttpMultiplex<E2 | E, R2 | R>
94
90
  /**
95
91
  * @since 1.0.0
96
92
  * @category combinators
@@ -112,11 +108,7 @@ export const headerRegex: {
112
108
  * @since 1.0.0
113
109
  * @category combinators
114
110
  */
115
- <E2, R2>(
116
- header: string,
117
- regex: RegExp,
118
- app: App.Default<E2, R2>
119
- ): <E, R>(self: HttpMultiplex<E, R>) => HttpMultiplex<E2 | E, R2 | R>
111
+ <E2, R2>(header: string, regex: RegExp, app: App.Default<E2, R2>): <E, R>(self: HttpMultiplex<E, R>) => HttpMultiplex<E2 | E, R2 | R>
120
112
  /**
121
113
  * @since 1.0.0
122
114
  * @category combinators
@@ -138,11 +130,7 @@ export const headerStartsWith: {
138
130
  * @since 1.0.0
139
131
  * @category combinators
140
132
  */
141
- <E2, R2>(
142
- header: string,
143
- prefix: string,
144
- app: App.Default<E2, R2>
145
- ): <E, R>(self: HttpMultiplex<E, R>) => HttpMultiplex<E2 | E, R2 | R>
133
+ <E2, R2>(header: string, prefix: string, app: App.Default<E2, R2>): <E, R>(self: HttpMultiplex<E, R>) => HttpMultiplex<E2 | E, R2 | R>
146
134
  /**
147
135
  * @since 1.0.0
148
136
  * @category combinators
@@ -164,11 +152,7 @@ export const headerEndsWith: {
164
152
  * @since 1.0.0
165
153
  * @category combinators
166
154
  */
167
- <E2, R2>(
168
- header: string,
169
- suffix: string,
170
- app: App.Default<E2, R2>
171
- ): <E, R>(self: HttpMultiplex<E, R>) => HttpMultiplex<E2 | E, R2 | R>
155
+ <E2, R2>(header: string, suffix: string, app: App.Default<E2, R2>): <E, R>(self: HttpMultiplex<E, R>) => HttpMultiplex<E2 | E, R2 | R>
172
156
  /**
173
157
  * @since 1.0.0
174
158
  * @category combinators
package/src/HttpRouter.ts CHANGED
@@ -767,9 +767,7 @@ export const use: {
767
767
  * @since 1.0.0
768
768
  * @category combinators
769
769
  */
770
- <E, R, R1, E1>(
771
- f: (self: Route.Middleware<E, R>) => App.Default<E1, R1>
772
- ): (self: HttpRouter<E, R>) => HttpRouter<E1, HttpRouter.ExcludeProvided<R1>>
770
+ <E, R, R1, E1>(f: (self: Route.Middleware<E, R>) => App.Default<E1, R1>): (self: HttpRouter<E, R>) => HttpRouter<E1, HttpRouter.ExcludeProvided<R1>>
773
771
  /**
774
772
  * @since 1.0.0
775
773
  * @category combinators
@@ -811,17 +809,12 @@ export const catchAll: {
811
809
  * @since 1.0.0
812
810
  * @category combinators
813
811
  */
814
- <E, E2, R2>(
815
- f: (e: E) => Route.Handler<E2, R2>
816
- ): <R>(self: HttpRouter<E, R>) => HttpRouter<E2, R | HttpRouter.ExcludeProvided<R2>>
812
+ <E, E2, R2>(f: (e: E) => Route.Handler<E2, R2>): <R>(self: HttpRouter<E, R>) => HttpRouter<E2, R | HttpRouter.ExcludeProvided<R2>>
817
813
  /**
818
814
  * @since 1.0.0
819
815
  * @category combinators
820
816
  */
821
- <E, R, E2, R2>(
822
- self: HttpRouter<E, R>,
823
- f: (e: E) => Route.Handler<E2, R2>
824
- ): HttpRouter<E2, R | HttpRouter.ExcludeProvided<R2>>
817
+ <E, R, E2, R2>(self: HttpRouter<E, R>, f: (e: E) => Route.Handler<E2, R2>): HttpRouter<E2, R | HttpRouter.ExcludeProvided<R2>>
825
818
  } = internal.catchAll
826
819
 
827
820
  /**
@@ -833,17 +826,12 @@ export const catchAllCause: {
833
826
  * @since 1.0.0
834
827
  * @category combinators
835
828
  */
836
- <E, E2, R2>(
837
- f: (e: Cause.Cause<E>) => Route.Handler<E2, R2>
838
- ): <R>(self: HttpRouter<E, R>) => HttpRouter<E2, R | HttpRouter.ExcludeProvided<R2>>
829
+ <E, E2, R2>(f: (e: Cause.Cause<E>) => Route.Handler<E2, R2>): <R>(self: HttpRouter<E, R>) => HttpRouter<E2, R | HttpRouter.ExcludeProvided<R2>>
839
830
  /**
840
831
  * @since 1.0.0
841
832
  * @category combinators
842
833
  */
843
- <E, R, E2, R2>(
844
- self: HttpRouter<E, R>,
845
- f: (e: Cause.Cause<E>) => Route.Handler<E2, R2>
846
- ): HttpRouter<E2, R | HttpRouter.ExcludeProvided<R2>>
834
+ <E, R, E2, R2>(self: HttpRouter<E, R>, f: (e: Cause.Cause<E>) => Route.Handler<E2, R2>): HttpRouter<E2, R | HttpRouter.ExcludeProvided<R2>>
847
835
  } = internal.catchAllCause
848
836
 
849
837
  /**
@@ -855,10 +843,7 @@ export const catchTag: {
855
843
  * @since 1.0.0
856
844
  * @category combinators
857
845
  */
858
- <K extends E extends { _tag: string } ? E["_tag"] : never, E, E1, R1>(
859
- k: K,
860
- f: (e: Extract<E, { _tag: K }>) => Route.Handler<E1, R1>
861
- ): <R>(
846
+ <K extends E extends { _tag: string } ? E["_tag"] : never, E, E1, R1>(k: K, f: (e: Extract<E, { _tag: K }>) => Route.Handler<E1, R1>): <R>(
862
847
  self: HttpRouter<E, R>
863
848
  ) => HttpRouter<E1 | Exclude<E, { _tag: K }>, R | HttpRouter.ExcludeProvided<R1>>
864
849
  /**
@@ -933,19 +918,12 @@ export const provideService: {
933
918
  * @since 1.0.0
934
919
  * @category combinators
935
920
  */
936
- <T extends Context.Tag<any, any>>(
937
- tag: T,
938
- service: Context.Tag.Service<T>
939
- ): <E, R>(self: HttpRouter<E, R>) => HttpRouter<E, Exclude<R, Context.Tag.Identifier<T>>>
921
+ <T extends Context.Tag<any, any>>(tag: T, service: Context.Tag.Service<T>): <E, R>(self: HttpRouter<E, R>) => HttpRouter<E, Exclude<R, Context.Tag.Identifier<T>>>
940
922
  /**
941
923
  * @since 1.0.0
942
924
  * @category combinators
943
925
  */
944
- <E, R, T extends Context.Tag<any, any>>(
945
- self: HttpRouter<E, R>,
946
- tag: T,
947
- service: Context.Tag.Service<T>
948
- ): HttpRouter<E, Exclude<R, Context.Tag.Identifier<T>>>
926
+ <E, R, T extends Context.Tag<any, any>>(self: HttpRouter<E, R>, tag: T, service: Context.Tag.Service<T>): HttpRouter<E, Exclude<R, Context.Tag.Identifier<T>>>
949
927
  } = internal.provideService
950
928
 
951
929
  /**
package/src/HttpServer.ts CHANGED
@@ -131,9 +131,7 @@ export const serve: {
131
131
  * @since 1.0.0
132
132
  * @category accessors
133
133
  */
134
- <E, R>(
135
- httpApp: App.Default<E, R>
136
- ): Layer.Layer<never, never, HttpServer | Exclude<R, ServerRequest.HttpServerRequest | Scope.Scope>>
134
+ <E, R>(httpApp: App.Default<E, R>): Layer.Layer<never, never, HttpServer | Exclude<R, ServerRequest.HttpServerRequest | Scope.Scope>>
137
135
  /**
138
136
  * @since 1.0.0
139
137
  * @category accessors
@@ -175,9 +173,7 @@ export const serveEffect: {
175
173
  * @since 1.0.0
176
174
  * @category accessors
177
175
  */
178
- <E, R>(
179
- httpApp: App.Default<E, R>
180
- ): Effect.Effect<void, never, Scope.Scope | HttpServer | Exclude<R, ServerRequest.HttpServerRequest>>
176
+ <E, R>(httpApp: App.Default<E, R>): Effect.Effect<void, never, Scope.Scope | HttpServer | Exclude<R, ServerRequest.HttpServerRequest>>
181
177
  /**
182
178
  * @since 1.0.0
183
179
  * @category accessors
@@ -113,10 +113,7 @@ export const html: {
113
113
  * @since 1.0.0
114
114
  * @category constructors
115
115
  */
116
- <A extends ReadonlyArray<Template.Interpolated>>(
117
- strings: TemplateStringsArray,
118
- ...args: A
119
- ): Effect.Effect<HttpServerResponse, Template.Interpolated.Error<A[number]>, Template.Interpolated.Context<A[number]>>
116
+ <A extends ReadonlyArray<Template.Interpolated>>(strings: TemplateStringsArray, ...args: A): Effect.Effect<HttpServerResponse, Template.Interpolated.Error<A[number]>, Template.Interpolated.Context<A[number]>>
120
117
  /**
121
118
  * @since 1.0.0
122
119
  * @category constructors