effect 4.0.0-beta.27 → 4.0.0-beta.29
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/dist/Brand.d.ts +1 -1
- package/dist/Brand.d.ts.map +1 -1
- package/dist/Brand.js +1 -1
- package/dist/Brand.js.map +1 -1
- package/dist/ConfigProvider.d.ts +1 -1
- package/dist/Cron.d.ts +1 -1
- package/dist/Data.d.ts +1 -1
- package/dist/Data.d.ts.map +1 -1
- package/dist/Data.js.map +1 -1
- package/dist/Effect.d.ts +300 -184
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +99 -61
- package/dist/Effect.js.map +1 -1
- package/dist/Encoding.d.ts +1 -1
- package/dist/Exit.d.ts +24 -12
- package/dist/Exit.d.ts.map +1 -1
- package/dist/Exit.js +8 -4
- package/dist/Exit.js.map +1 -1
- package/dist/Fiber.d.ts +1 -0
- package/dist/Fiber.d.ts.map +1 -1
- package/dist/Fiber.js.map +1 -1
- package/dist/Function.d.ts +1 -9
- package/dist/Function.d.ts.map +1 -1
- package/dist/Function.js +2 -10
- package/dist/Function.js.map +1 -1
- package/dist/Graph.d.ts +1 -1
- package/dist/Newtype.d.ts +291 -0
- package/dist/Newtype.d.ts.map +1 -0
- package/dist/Newtype.js +161 -0
- package/dist/Newtype.js.map +1 -0
- package/dist/PlatformError.d.ts +2 -2
- package/dist/References.d.ts +6 -1
- package/dist/References.d.ts.map +1 -1
- package/dist/References.js +6 -1
- package/dist/References.js.map +1 -1
- package/dist/RequestResolver.d.ts +19 -19
- package/dist/RequestResolver.js +10 -10
- package/dist/RequestResolver.js.map +1 -1
- package/dist/Schedule.d.ts +142 -80
- package/dist/Schedule.d.ts.map +1 -1
- package/dist/Schedule.js +58 -32
- package/dist/Schedule.js.map +1 -1
- package/dist/Scheduler.d.ts +9 -0
- package/dist/Scheduler.d.ts.map +1 -1
- package/dist/Scheduler.js +11 -0
- package/dist/Scheduler.js.map +1 -1
- package/dist/Schema.d.ts +1 -1
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +3 -1
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +1 -1
- package/dist/SchemaAST.js.map +1 -1
- package/dist/Stdio.d.ts +6 -2
- package/dist/Stdio.d.ts.map +1 -1
- package/dist/Stdio.js +2 -2
- package/dist/Stdio.js.map +1 -1
- package/dist/Stream.d.ts +8 -4
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +8 -4
- package/dist/Stream.js.map +1 -1
- package/dist/Types.d.ts +1 -22
- package/dist/Types.d.ts.map +1 -1
- package/dist/index.d.ts +71 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +71 -3
- package/dist/index.js.map +1 -1
- package/dist/internal/effect.js +3 -1
- package/dist/internal/effect.js.map +1 -1
- package/dist/unstable/ai/LanguageModel.d.ts +12 -28
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/ai/LanguageModel.js +4 -18
- package/dist/unstable/ai/LanguageModel.js.map +1 -1
- package/dist/unstable/ai/McpSchema.d.ts +20 -1
- package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
- package/dist/unstable/ai/McpSchema.js +8 -0
- package/dist/unstable/ai/McpSchema.js.map +1 -1
- package/dist/unstable/ai/McpServer.d.ts +65 -12
- package/dist/unstable/ai/McpServer.d.ts.map +1 -1
- package/dist/unstable/ai/McpServer.js +159 -45
- package/dist/unstable/ai/McpServer.js.map +1 -1
- package/dist/unstable/ai/Toolkit.d.ts +1 -1
- package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
- package/dist/unstable/ai/Toolkit.js +4 -11
- package/dist/unstable/ai/Toolkit.js.map +1 -1
- package/dist/unstable/ai/internal/codec-transformer.js +0 -5
- package/dist/unstable/ai/internal/codec-transformer.js.map +1 -1
- package/dist/unstable/cli/Prompt.js +35 -8
- package/dist/unstable/cli/Prompt.js.map +1 -1
- package/dist/unstable/cluster/Message.d.ts +5 -5
- package/dist/unstable/cluster/Reply.d.ts +3 -3
- package/dist/unstable/encoding/Msgpack.d.ts +1 -1
- package/dist/unstable/encoding/Ndjson.d.ts +1 -1
- package/dist/unstable/encoding/Sse.d.ts +1 -1
- package/dist/unstable/eventlog/EventJournal.d.ts +1 -1
- package/dist/unstable/eventlog/EventLogRemote.d.ts +1 -1
- package/dist/unstable/http/Cookies.d.ts +45 -1
- package/dist/unstable/http/Cookies.d.ts.map +1 -1
- package/dist/unstable/http/Cookies.js +22 -0
- package/dist/unstable/http/Cookies.js.map +1 -1
- package/dist/unstable/http/HttpBody.d.ts +1 -1
- package/dist/unstable/http/HttpClient.d.ts.map +1 -1
- package/dist/unstable/http/HttpClient.js +3 -7
- package/dist/unstable/http/HttpClient.js.map +1 -1
- package/dist/unstable/http/HttpClientError.d.ts +7 -7
- package/dist/unstable/http/HttpClientRequest.d.ts +5 -0
- package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientRequest.js +21 -17
- package/dist/unstable/http/HttpClientRequest.js.map +1 -1
- package/dist/unstable/http/HttpEffect.d.ts +7 -0
- package/dist/unstable/http/HttpEffect.d.ts.map +1 -1
- package/dist/unstable/http/HttpEffect.js +6 -0
- package/dist/unstable/http/HttpEffect.js.map +1 -1
- package/dist/unstable/http/HttpServerError.d.ts +6 -6
- package/dist/unstable/http/HttpServerRequest.d.ts +11 -0
- package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRequest.js +291 -1
- package/dist/unstable/http/HttpServerRequest.js.map +1 -1
- package/dist/unstable/http/HttpServerResponse.d.ts +47 -1
- package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerResponse.js +227 -0
- package/dist/unstable/http/HttpServerResponse.js.map +1 -1
- package/dist/unstable/http/HttpStaticServer.d.ts +69 -0
- package/dist/unstable/http/HttpStaticServer.d.ts.map +1 -0
- package/dist/unstable/http/HttpStaticServer.js +353 -0
- package/dist/unstable/http/HttpStaticServer.js.map +1 -0
- package/dist/unstable/http/Multipart.d.ts +1 -1
- package/dist/unstable/http/UrlParams.d.ts +1 -1
- package/dist/unstable/http/index.d.ts +4 -0
- package/dist/unstable/http/index.d.ts.map +1 -1
- package/dist/unstable/http/index.js +4 -0
- package/dist/unstable/http/index.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.d.ts +1 -0
- package/dist/unstable/httpapi/HttpApiGroup.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.js.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.d.ts +1 -1
- package/dist/unstable/reactivity/Atom.d.ts +7 -2
- package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.js +33 -15
- package/dist/unstable/reactivity/Atom.js.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.d.ts +4 -6
- package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.js +39 -9
- package/dist/unstable/reactivity/AtomHttpApi.js.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.js +26 -2
- package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.d.ts +8 -8
- package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.js +46 -20
- package/dist/unstable/reactivity/AtomRpc.js.map +1 -1
- package/dist/unstable/rpc/Rpc.d.ts +1 -1
- package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
- package/dist/unstable/rpc/Rpc.js.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.d.ts +5 -5
- package/dist/unstable/rpc/RpcMiddleware.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
- package/dist/unstable/rpc/RpcServer.js +2 -2
- package/dist/unstable/rpc/RpcServer.js.map +1 -1
- package/dist/unstable/rpc/Utils.js +1 -1
- package/dist/unstable/rpc/Utils.js.map +1 -1
- package/dist/unstable/socket/SocketServer.d.ts +3 -3
- package/dist/unstable/sql/Migrator.d.ts +1 -1
- package/dist/unstable/sql/SqlResolver.js +2 -2
- package/dist/unstable/sql/SqlResolver.js.map +1 -1
- package/dist/unstable/workflow/Workflow.d.ts +1 -1
- package/package.json +1 -1
- package/src/Brand.ts +1 -1
- package/src/Data.ts +1 -2
- package/src/Effect.ts +300 -184
- package/src/Exit.ts +24 -12
- package/src/Fiber.ts +1 -0
- package/src/Function.ts +2 -10
- package/src/Newtype.ts +308 -0
- package/src/References.ts +6 -1
- package/src/RequestResolver.ts +20 -20
- package/src/Schedule.ts +142 -80
- package/src/Scheduler.ts +12 -0
- package/src/Schema.ts +4 -2
- package/src/SchemaAST.ts +1 -4
- package/src/Stdio.ts +8 -4
- package/src/Stream.ts +8 -4
- package/src/Types.ts +1 -23
- package/src/index.ts +72 -3
- package/src/internal/effect.ts +3 -0
- package/src/unstable/ai/LanguageModel.ts +16 -37
- package/src/unstable/ai/McpSchema.ts +14 -0
- package/src/unstable/ai/McpServer.ts +224 -53
- package/src/unstable/ai/Toolkit.ts +5 -14
- package/src/unstable/ai/internal/codec-transformer.ts +0 -7
- package/src/unstable/cli/Prompt.ts +31 -9
- package/src/unstable/http/Cookies.ts +84 -0
- package/src/unstable/http/HttpClient.ts +5 -6
- package/src/unstable/http/HttpClientRequest.ts +21 -17
- package/src/unstable/http/HttpEffect.ts +8 -0
- package/src/unstable/http/HttpServerRequest.ts +388 -1
- package/src/unstable/http/HttpServerResponse.ts +328 -1
- package/src/unstable/http/HttpStaticServer.ts +456 -0
- package/src/unstable/http/index.ts +5 -0
- package/src/unstable/httpapi/HttpApiGroup.ts +1 -0
- package/src/unstable/reactivity/Atom.ts +62 -35
- package/src/unstable/reactivity/AtomHttpApi.ts +45 -11
- package/src/unstable/reactivity/AtomRegistry.ts +30 -2
- package/src/unstable/reactivity/AtomRpc.ts +48 -17
- package/src/unstable/rpc/Rpc.ts +1 -3
- package/src/unstable/rpc/RpcMiddleware.ts +12 -6
- package/src/unstable/rpc/RpcServer.ts +2 -2
- package/src/unstable/rpc/Utils.ts +1 -1
- package/src/unstable/sql/SqlResolver.ts +2 -2
|
@@ -2489,6 +2489,11 @@ const processNumberBackspace = (state: NumberState) => {
|
|
|
2489
2489
|
}))
|
|
2490
2490
|
}
|
|
2491
2491
|
|
|
2492
|
+
const processNumberClear = (state: NumberState) =>
|
|
2493
|
+
Effect.succeed(Action.NextFrame({
|
|
2494
|
+
state: { ...state, cursor: 0, value: "", error: undefined }
|
|
2495
|
+
}))
|
|
2496
|
+
|
|
2492
2497
|
const defaultIntProcessor = (input: string, state: NumberState) => {
|
|
2493
2498
|
if (state.value.length === 0 && input === "-") {
|
|
2494
2499
|
return Effect.succeed(Action.NextFrame({
|
|
@@ -2542,6 +2547,9 @@ const handleRenderInteger = (options: IntegerOptionsReq) => {
|
|
|
2542
2547
|
|
|
2543
2548
|
const handleProcessInteger = (options: IntegerOptionsReq) => {
|
|
2544
2549
|
return (input: Terminal.UserInput, state: NumberState) => {
|
|
2550
|
+
if (input.key.ctrl && input.key.name === "u") {
|
|
2551
|
+
return processNumberClear(state)
|
|
2552
|
+
}
|
|
2545
2553
|
switch (input.key.name) {
|
|
2546
2554
|
case "backspace": {
|
|
2547
2555
|
return processNumberBackspace(state)
|
|
@@ -2612,6 +2620,9 @@ const handleRenderFloat = (options: FloatOptionsReq) => {
|
|
|
2612
2620
|
|
|
2613
2621
|
const handleProcessFloat = (options: FloatOptionsReq) => {
|
|
2614
2622
|
return (input: Terminal.UserInput, state: NumberState) => {
|
|
2623
|
+
if (input.key.ctrl && input.key.name === "u") {
|
|
2624
|
+
return processNumberClear(state)
|
|
2625
|
+
}
|
|
2615
2626
|
switch (input.key.name) {
|
|
2616
2627
|
case "backspace": {
|
|
2617
2628
|
return processNumberBackspace(state)
|
|
@@ -2962,6 +2973,9 @@ const processAutoCompleteBackspace = <A>(state: AutoCompleteState, options: Auto
|
|
|
2962
2973
|
return Effect.succeed(Action.NextFrame({ state: updateAutoCompleteState(state, options, query) }))
|
|
2963
2974
|
}
|
|
2964
2975
|
|
|
2976
|
+
const processAutoCompleteClear = <A>(state: AutoCompleteState, options: AutoCompleteOptionsReq<A>) =>
|
|
2977
|
+
Effect.succeed(Action.NextFrame({ state: updateAutoCompleteState(state, options, "") }))
|
|
2978
|
+
|
|
2965
2979
|
const processAutoCompleteInput = <A>(input: string, state: AutoCompleteState, options: AutoCompleteOptionsReq<A>) => {
|
|
2966
2980
|
if (input.length === 0) {
|
|
2967
2981
|
return Effect.succeed(Action.Beep())
|
|
@@ -3045,6 +3059,9 @@ const handleSelectProcess = <A>(options: SelectOptionsReq<A>) => {
|
|
|
3045
3059
|
|
|
3046
3060
|
const handleAutoCompleteProcess = <A>(options: AutoCompleteOptionsReq<A>) => {
|
|
3047
3061
|
return (input: Terminal.UserInput, state: AutoCompleteState) => {
|
|
3062
|
+
if (input.key.ctrl && input.key.name === "u") {
|
|
3063
|
+
return processAutoCompleteClear(state, options)
|
|
3064
|
+
}
|
|
3048
3065
|
switch (input.key.name) {
|
|
3049
3066
|
case "k":
|
|
3050
3067
|
case "up": {
|
|
@@ -3091,10 +3108,6 @@ interface TextState {
|
|
|
3091
3108
|
readonly error: string | undefined
|
|
3092
3109
|
}
|
|
3093
3110
|
|
|
3094
|
-
const getValue = (state: TextState, options: TextOptionsReq): string => {
|
|
3095
|
-
return state.value.length > 0 ? state.value : options.default
|
|
3096
|
-
}
|
|
3097
|
-
|
|
3098
3111
|
const renderClearScreen = Effect.fnUntraced(function*(state: TextState, options: TextOptionsReq) {
|
|
3099
3112
|
const terminal = yield* Terminal.Terminal
|
|
3100
3113
|
const columns = yield* terminal.columns
|
|
@@ -3115,7 +3128,7 @@ const renderTextInput = (
|
|
|
3115
3128
|
submitted: boolean,
|
|
3116
3129
|
renderOptions?: RenderOptions | undefined
|
|
3117
3130
|
) => {
|
|
3118
|
-
const text =
|
|
3131
|
+
const text = nextState.value
|
|
3119
3132
|
if (renderOptions?.plain === true) {
|
|
3120
3133
|
switch (options.type) {
|
|
3121
3134
|
case "hidden": {
|
|
@@ -3217,6 +3230,13 @@ const processTextBackspace = (state: TextState) => {
|
|
|
3217
3230
|
)
|
|
3218
3231
|
}
|
|
3219
3232
|
|
|
3233
|
+
const processTextClear = (state: TextState) =>
|
|
3234
|
+
Effect.succeed(
|
|
3235
|
+
Action.NextFrame({
|
|
3236
|
+
state: { ...state, cursor: 0, value: "", error: undefined }
|
|
3237
|
+
})
|
|
3238
|
+
)
|
|
3239
|
+
|
|
3220
3240
|
const processTextCursorLeft = (state: TextState) => {
|
|
3221
3241
|
if (state.cursor <= 0) {
|
|
3222
3242
|
return Effect.succeed(Action.Beep())
|
|
@@ -3245,11 +3265,10 @@ const processTab = (state: TextState, options: TextOptionsReq) => {
|
|
|
3245
3265
|
if (state.value === options.default) {
|
|
3246
3266
|
return Effect.succeed(Action.Beep())
|
|
3247
3267
|
}
|
|
3248
|
-
const value =
|
|
3249
|
-
const cursor = value.length
|
|
3268
|
+
const value = state.value.length === 0 ? options.default : state.value
|
|
3250
3269
|
return Effect.succeed(
|
|
3251
3270
|
Action.NextFrame({
|
|
3252
|
-
state: { ...state, value, cursor, error: undefined }
|
|
3271
|
+
state: { ...state, value, cursor: value.length, error: undefined }
|
|
3253
3272
|
})
|
|
3254
3273
|
)
|
|
3255
3274
|
}
|
|
@@ -3278,6 +3297,9 @@ const handleTextRender = (options: TextOptionsReq) => {
|
|
|
3278
3297
|
|
|
3279
3298
|
const handleTextProcess = (options: TextOptionsReq) => {
|
|
3280
3299
|
return (input: Terminal.UserInput, state: TextState) => {
|
|
3300
|
+
if (input.key.ctrl && input.key.name === "u") {
|
|
3301
|
+
return processTextClear(state)
|
|
3302
|
+
}
|
|
3281
3303
|
switch (input.key.name) {
|
|
3282
3304
|
case "backspace": {
|
|
3283
3305
|
return processTextBackspace(state)
|
|
@@ -3290,7 +3312,7 @@ const handleTextProcess = (options: TextOptionsReq) => {
|
|
|
3290
3312
|
}
|
|
3291
3313
|
case "enter":
|
|
3292
3314
|
case "return": {
|
|
3293
|
-
const value =
|
|
3315
|
+
const value = state.value
|
|
3294
3316
|
return Effect.match(options.validate(value), {
|
|
3295
3317
|
onFailure: (error) =>
|
|
3296
3318
|
Action.NextFrame({
|
|
@@ -668,6 +668,90 @@ export const setUnsafe: {
|
|
|
668
668
|
))
|
|
669
669
|
)
|
|
670
670
|
|
|
671
|
+
/**
|
|
672
|
+
* Add an expired cookie to a Cookies object
|
|
673
|
+
*
|
|
674
|
+
* @since 4.0.0
|
|
675
|
+
* @category combinators
|
|
676
|
+
*/
|
|
677
|
+
export const expireCookie: {
|
|
678
|
+
/**
|
|
679
|
+
* Add an expired cookie to a Cookies object
|
|
680
|
+
*
|
|
681
|
+
* @since 4.0.0
|
|
682
|
+
* @category combinators
|
|
683
|
+
*/
|
|
684
|
+
(
|
|
685
|
+
name: string,
|
|
686
|
+
options?: Omit<NonNullable<Cookie["options"]>, "expires" | "maxAge">
|
|
687
|
+
): (self: Cookies) => Result.Result<Cookies, CookiesError>
|
|
688
|
+
/**
|
|
689
|
+
* Add an expired cookie to a Cookies object
|
|
690
|
+
*
|
|
691
|
+
* @since 4.0.0
|
|
692
|
+
* @category combinators
|
|
693
|
+
*/
|
|
694
|
+
(
|
|
695
|
+
self: Cookies,
|
|
696
|
+
name: string,
|
|
697
|
+
options?: Omit<NonNullable<Cookie["options"]>, "expires" | "maxAge">
|
|
698
|
+
): Result.Result<Cookies, CookiesError>
|
|
699
|
+
} = dual(
|
|
700
|
+
(args) => isCookies(args[0]),
|
|
701
|
+
(
|
|
702
|
+
self: Cookies,
|
|
703
|
+
name: string,
|
|
704
|
+
options?: Omit<NonNullable<Cookie["options"]>, "expires" | "maxAge">
|
|
705
|
+
) =>
|
|
706
|
+
set(self, name, "", {
|
|
707
|
+
...options,
|
|
708
|
+
maxAge: 0,
|
|
709
|
+
expires: new Date(0)
|
|
710
|
+
})
|
|
711
|
+
)
|
|
712
|
+
|
|
713
|
+
/**
|
|
714
|
+
* Add an expired cookie to a Cookies object, throwing an error if invalid
|
|
715
|
+
*
|
|
716
|
+
* @since 4.0.0
|
|
717
|
+
* @category combinators
|
|
718
|
+
*/
|
|
719
|
+
export const expireCookieUnsafe: {
|
|
720
|
+
/**
|
|
721
|
+
* Add an expired cookie to a Cookies object, throwing an error if invalid
|
|
722
|
+
*
|
|
723
|
+
* @since 4.0.0
|
|
724
|
+
* @category combinators
|
|
725
|
+
*/
|
|
726
|
+
(
|
|
727
|
+
name: string,
|
|
728
|
+
options?: Omit<NonNullable<Cookie["options"]>, "expires" | "maxAge">
|
|
729
|
+
): (self: Cookies) => Cookies
|
|
730
|
+
/**
|
|
731
|
+
* Add an expired cookie to a Cookies object, throwing an error if invalid
|
|
732
|
+
*
|
|
733
|
+
* @since 4.0.0
|
|
734
|
+
* @category combinators
|
|
735
|
+
*/
|
|
736
|
+
(
|
|
737
|
+
self: Cookies,
|
|
738
|
+
name: string,
|
|
739
|
+
options?: Omit<NonNullable<Cookie["options"]>, "expires" | "maxAge">
|
|
740
|
+
): Cookies
|
|
741
|
+
} = dual(
|
|
742
|
+
(args) => isCookies(args[0]),
|
|
743
|
+
(
|
|
744
|
+
self: Cookies,
|
|
745
|
+
name: string,
|
|
746
|
+
options?: Omit<NonNullable<Cookie["options"]>, "expires" | "maxAge">
|
|
747
|
+
): Cookies =>
|
|
748
|
+
setUnsafe(self, name, "", {
|
|
749
|
+
...options,
|
|
750
|
+
maxAge: 0,
|
|
751
|
+
expires: new Date(0)
|
|
752
|
+
})
|
|
753
|
+
)
|
|
754
|
+
|
|
671
755
|
/**
|
|
672
756
|
* Add multiple cookies to a Cookies object
|
|
673
757
|
*
|
|
@@ -6,7 +6,6 @@ import * as Cause from "../../Cause.ts"
|
|
|
6
6
|
import { Clock } from "../../Clock.ts"
|
|
7
7
|
import * as Duration from "../../Duration.ts"
|
|
8
8
|
import * as Effect from "../../Effect.ts"
|
|
9
|
-
import * as Exit from "../../Exit.ts"
|
|
10
9
|
import * as Fiber from "../../Fiber.ts"
|
|
11
10
|
import { constant, constFalse, constTrue, dual, flow, identity } from "../../Function.ts"
|
|
12
11
|
import * as Inspectable from "../../Inspectable.ts"
|
|
@@ -1735,12 +1734,12 @@ class InterruptibleResponse implements HttpClientResponse.HttpClientResponse {
|
|
|
1735
1734
|
get stream() {
|
|
1736
1735
|
return Stream.suspend(() => {
|
|
1737
1736
|
responseRegistry.unregister(this.original)
|
|
1738
|
-
return Stream.
|
|
1739
|
-
|
|
1737
|
+
return Stream.ensuring(
|
|
1738
|
+
this.original.stream,
|
|
1739
|
+
Effect.sync(() => {
|
|
1740
1740
|
this.controller.abort()
|
|
1741
|
-
}
|
|
1742
|
-
|
|
1743
|
-
})
|
|
1741
|
+
})
|
|
1742
|
+
)
|
|
1744
1743
|
})
|
|
1745
1744
|
}
|
|
1746
1745
|
|
|
@@ -87,7 +87,11 @@ const Proto = {
|
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
|
|
90
|
+
/**
|
|
91
|
+
* @since 4.0.0
|
|
92
|
+
* @category constructors
|
|
93
|
+
*/
|
|
94
|
+
export function makeWith(
|
|
91
95
|
method: HttpMethod,
|
|
92
96
|
url: string,
|
|
93
97
|
urlParams: UrlParams.UrlParams,
|
|
@@ -109,7 +113,7 @@ function makeProto(
|
|
|
109
113
|
* @since 4.0.0
|
|
110
114
|
* @category constructors
|
|
111
115
|
*/
|
|
112
|
-
export const empty: HttpClientRequest =
|
|
116
|
+
export const empty: HttpClientRequest = makeWith(
|
|
113
117
|
"GET",
|
|
114
118
|
"",
|
|
115
119
|
UrlParams.empty,
|
|
@@ -251,7 +255,7 @@ export const setMethod: {
|
|
|
251
255
|
} = dual(
|
|
252
256
|
2,
|
|
253
257
|
(self: HttpClientRequest, method: HttpMethod): HttpClientRequest =>
|
|
254
|
-
|
|
258
|
+
makeWith(method, self.url, self.urlParams, self.hash, self.headers, self.body)
|
|
255
259
|
)
|
|
256
260
|
|
|
257
261
|
/**
|
|
@@ -270,7 +274,7 @@ export const setHeader: {
|
|
|
270
274
|
*/
|
|
271
275
|
(self: HttpClientRequest, key: string, value: string): HttpClientRequest
|
|
272
276
|
} = dual(3, (self: HttpClientRequest, key: string, value: string): HttpClientRequest =>
|
|
273
|
-
|
|
277
|
+
makeWith(
|
|
274
278
|
self.method,
|
|
275
279
|
self.url,
|
|
276
280
|
self.urlParams,
|
|
@@ -295,7 +299,7 @@ export const setHeaders: {
|
|
|
295
299
|
*/
|
|
296
300
|
(self: HttpClientRequest, input: Headers.Input): HttpClientRequest
|
|
297
301
|
} = dual(2, (self: HttpClientRequest, input: Headers.Input): HttpClientRequest =>
|
|
298
|
-
|
|
302
|
+
makeWith(
|
|
299
303
|
self.method,
|
|
300
304
|
self.url,
|
|
301
305
|
self.urlParams,
|
|
@@ -394,7 +398,7 @@ export const setUrl: {
|
|
|
394
398
|
(self: HttpClientRequest, url: string | URL): HttpClientRequest
|
|
395
399
|
} = dual(2, (self: HttpClientRequest, url: string | URL): HttpClientRequest => {
|
|
396
400
|
if (typeof url === "string") {
|
|
397
|
-
return
|
|
401
|
+
return makeWith(
|
|
398
402
|
self.method,
|
|
399
403
|
url,
|
|
400
404
|
self.urlParams,
|
|
@@ -408,7 +412,7 @@ export const setUrl: {
|
|
|
408
412
|
const hash = clone.hash ? clone.hash.slice(1) : undefined
|
|
409
413
|
clone.search = ""
|
|
410
414
|
clone.hash = ""
|
|
411
|
-
return
|
|
415
|
+
return makeWith(
|
|
412
416
|
self.method,
|
|
413
417
|
clone.toString(),
|
|
414
418
|
urlParams,
|
|
@@ -435,7 +439,7 @@ export const prependUrl: {
|
|
|
435
439
|
(self: HttpClientRequest, path: string): HttpClientRequest
|
|
436
440
|
} = dual(2, (self: HttpClientRequest, path: string): HttpClientRequest => {
|
|
437
441
|
if (path === "") return self
|
|
438
|
-
return
|
|
442
|
+
return makeWith(
|
|
439
443
|
self.method,
|
|
440
444
|
joinSegments(path, self.url),
|
|
441
445
|
self.urlParams,
|
|
@@ -462,7 +466,7 @@ export const appendUrl: {
|
|
|
462
466
|
(self: HttpClientRequest, path: string): HttpClientRequest
|
|
463
467
|
} = dual(2, (self: HttpClientRequest, path: string): HttpClientRequest => {
|
|
464
468
|
if (path === "") return self
|
|
465
|
-
return
|
|
469
|
+
return makeWith(
|
|
466
470
|
self.method,
|
|
467
471
|
joinSegments(self.url, path),
|
|
468
472
|
self.urlParams,
|
|
@@ -500,7 +504,7 @@ export const updateUrl: {
|
|
|
500
504
|
*/
|
|
501
505
|
(self: HttpClientRequest, f: (url: string) => string): HttpClientRequest
|
|
502
506
|
} = dual(2, (self: HttpClientRequest, f: (url: string) => string): HttpClientRequest =>
|
|
503
|
-
|
|
507
|
+
makeWith(
|
|
504
508
|
self.method,
|
|
505
509
|
f(self.url),
|
|
506
510
|
self.urlParams,
|
|
@@ -525,7 +529,7 @@ export const setUrlParam: {
|
|
|
525
529
|
*/
|
|
526
530
|
(self: HttpClientRequest, key: string, value: string): HttpClientRequest
|
|
527
531
|
} = dual(3, (self: HttpClientRequest, key: string, value: string): HttpClientRequest =>
|
|
528
|
-
|
|
532
|
+
makeWith(
|
|
529
533
|
self.method,
|
|
530
534
|
self.url,
|
|
531
535
|
UrlParams.set(self.urlParams, key, value),
|
|
@@ -550,7 +554,7 @@ export const setUrlParams: {
|
|
|
550
554
|
*/
|
|
551
555
|
(self: HttpClientRequest, input: UrlParams.Input): HttpClientRequest
|
|
552
556
|
} = dual(2, (self: HttpClientRequest, input: UrlParams.Input): HttpClientRequest =>
|
|
553
|
-
|
|
557
|
+
makeWith(
|
|
554
558
|
self.method,
|
|
555
559
|
self.url,
|
|
556
560
|
UrlParams.setAll(self.urlParams, input),
|
|
@@ -575,7 +579,7 @@ export const appendUrlParam: {
|
|
|
575
579
|
*/
|
|
576
580
|
(self: HttpClientRequest, key: string, value: string): HttpClientRequest
|
|
577
581
|
} = dual(3, (self: HttpClientRequest, key: string, value: string): HttpClientRequest =>
|
|
578
|
-
|
|
582
|
+
makeWith(
|
|
579
583
|
self.method,
|
|
580
584
|
self.url,
|
|
581
585
|
UrlParams.append(self.urlParams, key, value),
|
|
@@ -600,7 +604,7 @@ export const appendUrlParams: {
|
|
|
600
604
|
*/
|
|
601
605
|
(self: HttpClientRequest, input: UrlParams.Input): HttpClientRequest
|
|
602
606
|
} = dual(2, (self: HttpClientRequest, input: UrlParams.Input): HttpClientRequest =>
|
|
603
|
-
|
|
607
|
+
makeWith(
|
|
604
608
|
self.method,
|
|
605
609
|
self.url,
|
|
606
610
|
UrlParams.appendAll(self.urlParams, input),
|
|
@@ -625,7 +629,7 @@ export const setHash: {
|
|
|
625
629
|
*/
|
|
626
630
|
(self: HttpClientRequest, hash: string): HttpClientRequest
|
|
627
631
|
} = dual(2, (self: HttpClientRequest, hash: string): HttpClientRequest =>
|
|
628
|
-
|
|
632
|
+
makeWith(
|
|
629
633
|
self.method,
|
|
630
634
|
self.url,
|
|
631
635
|
self.urlParams,
|
|
@@ -639,7 +643,7 @@ export const setHash: {
|
|
|
639
643
|
* @category combinators
|
|
640
644
|
*/
|
|
641
645
|
export const removeHash = (self: HttpClientRequest): HttpClientRequest =>
|
|
642
|
-
|
|
646
|
+
makeWith(
|
|
643
647
|
self.method,
|
|
644
648
|
self.url,
|
|
645
649
|
self.urlParams,
|
|
@@ -675,7 +679,7 @@ export const setBody: {
|
|
|
675
679
|
headers = Headers.set(headers, "content-length", body.contentLength.toString())
|
|
676
680
|
}
|
|
677
681
|
}
|
|
678
|
-
return
|
|
682
|
+
return makeWith(
|
|
679
683
|
self.method,
|
|
680
684
|
self.url,
|
|
681
685
|
self.urlParams,
|
|
@@ -173,6 +173,14 @@ export const appendPreResponseHandler = (handler: PreResponseHandler): Effect.Ef
|
|
|
173
173
|
return Effect.void
|
|
174
174
|
})
|
|
175
175
|
|
|
176
|
+
export {
|
|
177
|
+
/**
|
|
178
|
+
* @since 4.0.0
|
|
179
|
+
* @category fiber refs
|
|
180
|
+
*/
|
|
181
|
+
appendPreResponseHandlerUnsafe
|
|
182
|
+
}
|
|
183
|
+
|
|
176
184
|
/**
|
|
177
185
|
* @since 4.0.0
|
|
178
186
|
* @category fiber refs
|