effect 4.0.0-beta.38 → 4.0.0-beta.39
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/ErrorReporter.d.ts.map +1 -1
- package/dist/ErrorReporter.js +3 -2
- package/dist/ErrorReporter.js.map +1 -1
- package/dist/Queue.d.ts +5 -2
- package/dist/Queue.d.ts.map +1 -1
- package/dist/Queue.js +5 -2
- package/dist/Queue.js.map +1 -1
- package/dist/References.d.ts +235 -224
- package/dist/References.d.ts.map +1 -1
- package/dist/References.js +234 -246
- package/dist/References.js.map +1 -1
- package/dist/Schedule.d.ts +6 -202
- package/dist/Schedule.d.ts.map +1 -1
- package/dist/Schedule.js +6 -71
- package/dist/Schedule.js.map +1 -1
- package/dist/Stream.d.ts +1 -1
- package/dist/Stream.js +1 -1
- package/dist/Struct.d.ts +7 -7
- package/dist/Struct.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/internal/effect.js +1 -5
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/references.d.ts +2 -0
- package/dist/internal/references.d.ts.map +1 -0
- package/dist/internal/references.js +51 -0
- package/dist/internal/references.js.map +1 -0
- package/dist/unstable/httpapi/HttpApiClient.d.ts +1 -1
- package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
- package/package.json +1 -1
- package/src/ErrorReporter.ts +3 -2
- package/src/Queue.ts +5 -2
- package/src/References.ts +276 -285
- package/src/Schedule.ts +7 -212
- package/src/Stream.ts +1 -1
- package/src/Struct.ts +7 -7
- package/src/index.ts +1 -1
- package/src/internal/effect.ts +14 -21
- package/src/internal/references.ts +72 -0
- package/src/unstable/httpapi/HttpApiClient.ts +2 -2
package/src/Schedule.ts
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
*
|
|
13
13
|
* // Retry with exponential backoff
|
|
14
14
|
* const retryPolicy = Schedule.exponential("100 millis", 2.0)
|
|
15
|
-
* .pipe(Schedule.
|
|
15
|
+
* .pipe(Schedule.both(Schedule.recurs(3)))
|
|
16
16
|
*
|
|
17
17
|
* const program = Effect.gen(function*() {
|
|
18
18
|
* // This will retry up to 3 times with exponential backoff
|
|
@@ -59,7 +59,7 @@ const randomNext: Effect<number> = random.Random.useSync((random) => random.next
|
|
|
59
59
|
*
|
|
60
60
|
* // Basic retry schedule - retry up to 3 times with exponential backoff
|
|
61
61
|
* const retrySchedule = Schedule.exponential("100 millis").pipe(
|
|
62
|
-
* Schedule.
|
|
62
|
+
* Schedule.both(Schedule.recurs(3))
|
|
63
63
|
* )
|
|
64
64
|
*
|
|
65
65
|
* // Basic repeat schedule - repeat every 30 seconds forever
|
|
@@ -336,7 +336,7 @@ export const isSchedule = (u: unknown): u is Schedule<unknown, never, unknown, u
|
|
|
336
336
|
*
|
|
337
337
|
* // These can be combined and transformed as needed
|
|
338
338
|
* const complexSchedule = simpleSchedule.pipe(
|
|
339
|
-
* Schedule.
|
|
339
|
+
* Schedule.both(Schedule.recurs(3))
|
|
340
340
|
* )
|
|
341
341
|
* ```
|
|
342
342
|
*
|
|
@@ -1953,211 +1953,6 @@ export const bothWith: {
|
|
|
1953
1953
|
})
|
|
1954
1954
|
)))
|
|
1955
1955
|
|
|
1956
|
-
/**
|
|
1957
|
-
* Returns a new `Schedule` that combines two schedules by running them
|
|
1958
|
-
* sequentially. First the current schedule runs to completion, then the
|
|
1959
|
-
* other schedule runs to completion. The output is a tuple of both results.
|
|
1960
|
-
*
|
|
1961
|
-
* @example
|
|
1962
|
-
* ```ts
|
|
1963
|
-
* import { Console, Data, Effect, Schedule } from "effect"
|
|
1964
|
-
*
|
|
1965
|
-
* class RetryAttemptError extends Data.TaggedError("RetryAttemptError")<{ readonly message: string }> {}
|
|
1966
|
-
*
|
|
1967
|
-
* // Compose a quick retry phase followed by slower retry phase
|
|
1968
|
-
* const fastRetries = Schedule.exponential("100 millis").pipe(
|
|
1969
|
-
* Schedule.compose(Schedule.recurs(3)) // 3 fast retries
|
|
1970
|
-
* )
|
|
1971
|
-
*
|
|
1972
|
-
* const slowRetries = Schedule.exponential("2 seconds").pipe(
|
|
1973
|
-
* Schedule.compose(Schedule.recurs(2)) // 2 slow retries
|
|
1974
|
-
* )
|
|
1975
|
-
*
|
|
1976
|
-
* // Sequential composition: fast retries first, then slow retries
|
|
1977
|
-
* const composedRetry = Schedule.compose(fastRetries, slowRetries)
|
|
1978
|
-
* // Outputs: [number_from_fast_phase, number_from_slow_phase]
|
|
1979
|
-
*
|
|
1980
|
-
* const program = Effect.gen(function*() {
|
|
1981
|
-
* let attempt = 0
|
|
1982
|
-
*
|
|
1983
|
-
* const result = yield* Effect.retry(
|
|
1984
|
-
* Effect.gen(function*() {
|
|
1985
|
-
* attempt++
|
|
1986
|
-
* yield* Console.log(`Attempt ${attempt}`)
|
|
1987
|
-
*
|
|
1988
|
-
* if (attempt < 7) { // Needs both phases to succeed
|
|
1989
|
-
* return yield* Effect.fail(new RetryAttemptError({ message: `Attempt ${attempt} failed` }))
|
|
1990
|
-
* }
|
|
1991
|
-
*
|
|
1992
|
-
* return `Success on attempt ${attempt}`
|
|
1993
|
-
* }),
|
|
1994
|
-
* composedRetry.pipe(
|
|
1995
|
-
* Schedule.tapOutput(([fastResult, slowResult]) =>
|
|
1996
|
-
* Console.log(`Fast phase: ${fastResult}, Slow phase: ${slowResult}`)
|
|
1997
|
-
* )
|
|
1998
|
-
* )
|
|
1999
|
-
* )
|
|
2000
|
-
*
|
|
2001
|
-
* yield* Console.log(`Final result: ${result}`)
|
|
2002
|
-
* })
|
|
2003
|
-
*
|
|
2004
|
-
* // Compose different schedule types
|
|
2005
|
-
* const warmupAndMaintenance = Schedule.compose(
|
|
2006
|
-
* Schedule.fixed("500 millis").pipe(Schedule.take(5)), // 5 warmup cycles
|
|
2007
|
-
* Schedule.spaced("5 seconds") // then regular maintenance
|
|
2008
|
-
* )
|
|
2009
|
-
*
|
|
2010
|
-
* // Progressive backoff: fixed first, then exponential
|
|
2011
|
-
* const progressiveBackoff = Schedule.compose(
|
|
2012
|
-
* Schedule.fixed("100 millis").pipe(Schedule.take(3)), // Fixed: 100ms, 100ms, 100ms
|
|
2013
|
-
* Schedule.exponential("500 millis").pipe(Schedule.take(3)) // Then exponential: 500ms, 1s, 2s
|
|
2014
|
-
* )
|
|
2015
|
-
* ```
|
|
2016
|
-
*
|
|
2017
|
-
* @since 2.0.0
|
|
2018
|
-
* @category sequencing
|
|
2019
|
-
*/
|
|
2020
|
-
export const compose: {
|
|
2021
|
-
/**
|
|
2022
|
-
* Returns a new `Schedule` that combines two schedules by running them
|
|
2023
|
-
* sequentially. First the current schedule runs to completion, then the
|
|
2024
|
-
* other schedule runs to completion. The output is a tuple of both results.
|
|
2025
|
-
*
|
|
2026
|
-
* @example
|
|
2027
|
-
* ```ts
|
|
2028
|
-
* import { Console, Data, Effect, Schedule } from "effect"
|
|
2029
|
-
*
|
|
2030
|
-
* class RetryAttemptError extends Data.TaggedError("RetryAttemptError")<{ readonly message: string }> {}
|
|
2031
|
-
*
|
|
2032
|
-
* // Compose a quick retry phase followed by slower retry phase
|
|
2033
|
-
* const fastRetries = Schedule.exponential("100 millis").pipe(
|
|
2034
|
-
* Schedule.compose(Schedule.recurs(3)) // 3 fast retries
|
|
2035
|
-
* )
|
|
2036
|
-
*
|
|
2037
|
-
* const slowRetries = Schedule.exponential("2 seconds").pipe(
|
|
2038
|
-
* Schedule.compose(Schedule.recurs(2)) // 2 slow retries
|
|
2039
|
-
* )
|
|
2040
|
-
*
|
|
2041
|
-
* // Sequential composition: fast retries first, then slow retries
|
|
2042
|
-
* const composedRetry = Schedule.compose(fastRetries, slowRetries)
|
|
2043
|
-
* // Outputs: [number_from_fast_phase, number_from_slow_phase]
|
|
2044
|
-
*
|
|
2045
|
-
* const program = Effect.gen(function*() {
|
|
2046
|
-
* let attempt = 0
|
|
2047
|
-
*
|
|
2048
|
-
* const result = yield* Effect.retry(
|
|
2049
|
-
* Effect.gen(function*() {
|
|
2050
|
-
* attempt++
|
|
2051
|
-
* yield* Console.log(`Attempt ${attempt}`)
|
|
2052
|
-
*
|
|
2053
|
-
* if (attempt < 7) { // Needs both phases to succeed
|
|
2054
|
-
* return yield* Effect.fail(new RetryAttemptError({ message: `Attempt ${attempt} failed` }))
|
|
2055
|
-
* }
|
|
2056
|
-
*
|
|
2057
|
-
* return `Success on attempt ${attempt}`
|
|
2058
|
-
* }),
|
|
2059
|
-
* composedRetry.pipe(
|
|
2060
|
-
* Schedule.tapOutput(([fastResult, slowResult]) =>
|
|
2061
|
-
* Console.log(`Fast phase: ${fastResult}, Slow phase: ${slowResult}`)
|
|
2062
|
-
* )
|
|
2063
|
-
* )
|
|
2064
|
-
* )
|
|
2065
|
-
*
|
|
2066
|
-
* yield* Console.log(`Final result: ${result}`)
|
|
2067
|
-
* })
|
|
2068
|
-
*
|
|
2069
|
-
* // Compose different schedule types
|
|
2070
|
-
* const warmupAndMaintenance = Schedule.compose(
|
|
2071
|
-
* Schedule.fixed("500 millis").pipe(Schedule.take(5)), // 5 warmup cycles
|
|
2072
|
-
* Schedule.spaced("5 seconds") // then regular maintenance
|
|
2073
|
-
* )
|
|
2074
|
-
*
|
|
2075
|
-
* // Progressive backoff: fixed first, then exponential
|
|
2076
|
-
* const progressiveBackoff = Schedule.compose(
|
|
2077
|
-
* Schedule.fixed("100 millis").pipe(Schedule.take(3)), // Fixed: 100ms, 100ms, 100ms
|
|
2078
|
-
* Schedule.exponential("500 millis").pipe(Schedule.take(3)) // Then exponential: 500ms, 1s, 2s
|
|
2079
|
-
* )
|
|
2080
|
-
* ```
|
|
2081
|
-
*
|
|
2082
|
-
* @since 2.0.0
|
|
2083
|
-
* @category sequencing
|
|
2084
|
-
*/
|
|
2085
|
-
<Output2, Input2, Error2, Env2>(other: Schedule<Output2, Input2, Error2, Env2>): <Output, Input, Error, Env>(
|
|
2086
|
-
self: Schedule<Output, Input, Error, Env>
|
|
2087
|
-
) => Schedule<[Output, Output2], Input & Input2, Error | Error2, Env | Env2>
|
|
2088
|
-
/**
|
|
2089
|
-
* Returns a new `Schedule` that combines two schedules by running them
|
|
2090
|
-
* sequentially. First the current schedule runs to completion, then the
|
|
2091
|
-
* other schedule runs to completion. The output is a tuple of both results.
|
|
2092
|
-
*
|
|
2093
|
-
* @example
|
|
2094
|
-
* ```ts
|
|
2095
|
-
* import { Console, Data, Effect, Schedule } from "effect"
|
|
2096
|
-
*
|
|
2097
|
-
* class RetryAttemptError extends Data.TaggedError("RetryAttemptError")<{ readonly message: string }> {}
|
|
2098
|
-
*
|
|
2099
|
-
* // Compose a quick retry phase followed by slower retry phase
|
|
2100
|
-
* const fastRetries = Schedule.exponential("100 millis").pipe(
|
|
2101
|
-
* Schedule.compose(Schedule.recurs(3)) // 3 fast retries
|
|
2102
|
-
* )
|
|
2103
|
-
*
|
|
2104
|
-
* const slowRetries = Schedule.exponential("2 seconds").pipe(
|
|
2105
|
-
* Schedule.compose(Schedule.recurs(2)) // 2 slow retries
|
|
2106
|
-
* )
|
|
2107
|
-
*
|
|
2108
|
-
* // Sequential composition: fast retries first, then slow retries
|
|
2109
|
-
* const composedRetry = Schedule.compose(fastRetries, slowRetries)
|
|
2110
|
-
* // Outputs: [number_from_fast_phase, number_from_slow_phase]
|
|
2111
|
-
*
|
|
2112
|
-
* const program = Effect.gen(function*() {
|
|
2113
|
-
* let attempt = 0
|
|
2114
|
-
*
|
|
2115
|
-
* const result = yield* Effect.retry(
|
|
2116
|
-
* Effect.gen(function*() {
|
|
2117
|
-
* attempt++
|
|
2118
|
-
* yield* Console.log(`Attempt ${attempt}`)
|
|
2119
|
-
*
|
|
2120
|
-
* if (attempt < 7) { // Needs both phases to succeed
|
|
2121
|
-
* return yield* Effect.fail(new RetryAttemptError({ message: `Attempt ${attempt} failed` }))
|
|
2122
|
-
* }
|
|
2123
|
-
*
|
|
2124
|
-
* return `Success on attempt ${attempt}`
|
|
2125
|
-
* }),
|
|
2126
|
-
* composedRetry.pipe(
|
|
2127
|
-
* Schedule.tapOutput(([fastResult, slowResult]) =>
|
|
2128
|
-
* Console.log(`Fast phase: ${fastResult}, Slow phase: ${slowResult}`)
|
|
2129
|
-
* )
|
|
2130
|
-
* )
|
|
2131
|
-
* )
|
|
2132
|
-
*
|
|
2133
|
-
* yield* Console.log(`Final result: ${result}`)
|
|
2134
|
-
* })
|
|
2135
|
-
*
|
|
2136
|
-
* // Compose different schedule types
|
|
2137
|
-
* const warmupAndMaintenance = Schedule.compose(
|
|
2138
|
-
* Schedule.fixed("500 millis").pipe(Schedule.take(5)), // 5 warmup cycles
|
|
2139
|
-
* Schedule.spaced("5 seconds") // then regular maintenance
|
|
2140
|
-
* )
|
|
2141
|
-
*
|
|
2142
|
-
* // Progressive backoff: fixed first, then exponential
|
|
2143
|
-
* const progressiveBackoff = Schedule.compose(
|
|
2144
|
-
* Schedule.fixed("100 millis").pipe(Schedule.take(3)), // Fixed: 100ms, 100ms, 100ms
|
|
2145
|
-
* Schedule.exponential("500 millis").pipe(Schedule.take(3)) // Then exponential: 500ms, 1s, 2s
|
|
2146
|
-
* )
|
|
2147
|
-
* ```
|
|
2148
|
-
*
|
|
2149
|
-
* @since 2.0.0
|
|
2150
|
-
* @category sequencing
|
|
2151
|
-
*/
|
|
2152
|
-
<Output, Input, Error, Env, Output2, Input2, Error2, Env2>(
|
|
2153
|
-
self: Schedule<Output, Input, Error, Env>,
|
|
2154
|
-
other: Schedule<Output2, Input2, Error2, Env2>
|
|
2155
|
-
): Schedule<[Output, Output2], Input & Input2, Error | Error2, Env | Env2>
|
|
2156
|
-
} = dual(2, <Output, Input, Error, Env, Output2, Input2, Error2, Env2>(
|
|
2157
|
-
self: Schedule<Output, Input, Error, Env>,
|
|
2158
|
-
other: Schedule<Output2, Input2, Error2, Env2>
|
|
2159
|
-
): Schedule<[Output, Output2], Input & Input2, Error | Error2, Env | Env2> => both(self, other))
|
|
2160
|
-
|
|
2161
1956
|
/**
|
|
2162
1957
|
* Returns a new `Schedule` that always recurs, collecting all inputs of the
|
|
2163
1958
|
* schedule into an array.
|
|
@@ -3870,7 +3665,7 @@ export const elapsed: Schedule<Duration.Duration> = fromStepWithMetadata(
|
|
|
3870
3665
|
*
|
|
3871
3666
|
* // Retry with exponential backoff (limited to 5 attempts)
|
|
3872
3667
|
* const retryPolicy = Schedule.exponential("50 millis").pipe(
|
|
3873
|
-
* Schedule.
|
|
3668
|
+
* Schedule.both(Schedule.recurs(5))
|
|
3874
3669
|
* )
|
|
3875
3670
|
*
|
|
3876
3671
|
* const program = Effect.gen(function*() {
|
|
@@ -3939,7 +3734,7 @@ export const exponential = (
|
|
|
3939
3734
|
* return `Success on attempt ${attempt}`
|
|
3940
3735
|
* }),
|
|
3941
3736
|
* Schedule.fibonacci("50 millis").pipe(
|
|
3942
|
-
* Schedule.
|
|
3737
|
+
* Schedule.both(Schedule.recurs(6)), // Maximum 6 retries
|
|
3943
3738
|
* Schedule.tapOutput((delay) => Console.log(`Next retry in ${delay}`))
|
|
3944
3739
|
* )
|
|
3945
3740
|
* )
|
|
@@ -4505,7 +4300,7 @@ export const passthrough = <Output, Input, Error, Env>(
|
|
|
4505
4300
|
*
|
|
4506
4301
|
* // Combining recurs with other schedules for sophisticated retry logic
|
|
4507
4302
|
* const complexRetry = Schedule.exponential("100 millis").pipe(
|
|
4508
|
-
* Schedule.
|
|
4303
|
+
* Schedule.both(Schedule.recurs(3)) // At most 3 attempts
|
|
4509
4304
|
* )
|
|
4510
4305
|
*
|
|
4511
4306
|
* // Repeat an effect exactly 10 times
|
|
@@ -4932,7 +4727,7 @@ export const reduce: {
|
|
|
4932
4727
|
*
|
|
4933
4728
|
* // Simple spaced schedule with limited repetitions
|
|
4934
4729
|
* const limitedSpaced = Schedule.spaced("100 millis").pipe(
|
|
4935
|
-
* Schedule.
|
|
4730
|
+
* Schedule.both(Schedule.recurs(5)) // at most 5 times
|
|
4936
4731
|
* )
|
|
4937
4732
|
*
|
|
4938
4733
|
* const program = Effect.gen(function*() {
|
package/src/Stream.ts
CHANGED
|
@@ -1360,7 +1360,7 @@ export const fromAsyncIterable = <A, E>(
|
|
|
1360
1360
|
*
|
|
1361
1361
|
* const program = Effect.gen(function*() {
|
|
1362
1362
|
* const schedule = Schedule.spaced("50 millis").pipe(
|
|
1363
|
-
* Schedule.
|
|
1363
|
+
* Schedule.both(Schedule.recurs(2))
|
|
1364
1364
|
* )
|
|
1365
1365
|
* const stream = Stream.fromSchedule(schedule)
|
|
1366
1366
|
* const values = yield* Stream.runCollect(stream)
|
package/src/Struct.ts
CHANGED
|
@@ -157,7 +157,7 @@ export type Mutable<T> = { -readonly [K in keyof T]: T[K] } & {}
|
|
|
157
157
|
* @category Type-Level Programming
|
|
158
158
|
* @since 4.0.0
|
|
159
159
|
*/
|
|
160
|
-
export type Assign<T, U> = keyof T & keyof U extends never ? T & U : Omit<T, keyof T & keyof U> & U
|
|
160
|
+
export type Assign<T, U> = Simplify<keyof T & keyof U extends never ? T & U : Omit<T, keyof T & keyof U> & U>
|
|
161
161
|
|
|
162
162
|
/**
|
|
163
163
|
* Retrieves the value at `key` from a struct.
|
|
@@ -305,7 +305,7 @@ export const pick: {
|
|
|
305
305
|
* @category filtering
|
|
306
306
|
* @since 2.0.0
|
|
307
307
|
*/
|
|
308
|
-
<S extends object, const Keys extends ReadonlyArray<keyof S>>(keys: Keys): (self: S) => Pick<S, Keys[number]
|
|
308
|
+
<S extends object, const Keys extends ReadonlyArray<keyof S>>(keys: Keys): (self: S) => Simplify<Pick<S, Keys[number]>>
|
|
309
309
|
/**
|
|
310
310
|
* Creates a new struct containing only the specified keys.
|
|
311
311
|
*
|
|
@@ -329,7 +329,7 @@ export const pick: {
|
|
|
329
329
|
* @category filtering
|
|
330
330
|
* @since 2.0.0
|
|
331
331
|
*/
|
|
332
|
-
<S extends object, const Keys extends ReadonlyArray<keyof S>>(self: S, keys: Keys): Pick<S, Keys[number]
|
|
332
|
+
<S extends object, const Keys extends ReadonlyArray<keyof S>>(self: S, keys: Keys): Simplify<Pick<S, Keys[number]>>
|
|
333
333
|
} = dual(
|
|
334
334
|
2,
|
|
335
335
|
<S extends object, const Keys extends ReadonlyArray<keyof S>>(self: S, keys: Keys) => {
|
|
@@ -382,7 +382,7 @@ export const omit: {
|
|
|
382
382
|
* @category filtering
|
|
383
383
|
* @since 2.0.0
|
|
384
384
|
*/
|
|
385
|
-
<S extends object, const Keys extends ReadonlyArray<keyof S>>(keys: Keys): (self: S) => Omit<S, Keys[number]
|
|
385
|
+
<S extends object, const Keys extends ReadonlyArray<keyof S>>(keys: Keys): (self: S) => Simplify<Omit<S, Keys[number]>>
|
|
386
386
|
/**
|
|
387
387
|
* Creates a new struct with the specified keys removed.
|
|
388
388
|
*
|
|
@@ -405,7 +405,7 @@ export const omit: {
|
|
|
405
405
|
* @category filtering
|
|
406
406
|
* @since 2.0.0
|
|
407
407
|
*/
|
|
408
|
-
<S extends object, const Keys extends ReadonlyArray<keyof S>>(self: S, keys: Keys): Omit<S, Keys[number]
|
|
408
|
+
<S extends object, const Keys extends ReadonlyArray<keyof S>>(self: S, keys: Keys): Simplify<Omit<S, Keys[number]>>
|
|
409
409
|
} = dual(
|
|
410
410
|
2,
|
|
411
411
|
<S extends object, Keys extends ReadonlyArray<keyof S>>(self: S, keys: Keys) => {
|
|
@@ -464,7 +464,7 @@ export const assign: {
|
|
|
464
464
|
* @category combining
|
|
465
465
|
* @since 4.0.0
|
|
466
466
|
*/
|
|
467
|
-
<O extends object>(that: O): <S extends object>(self: S) =>
|
|
467
|
+
<O extends object>(that: O): <S extends object>(self: S) => Assign<S, O>
|
|
468
468
|
/**
|
|
469
469
|
* Merges two structs into a new struct. When both structs share a key, the
|
|
470
470
|
* value from `that` (the second struct) wins.
|
|
@@ -490,7 +490,7 @@ export const assign: {
|
|
|
490
490
|
* @category combining
|
|
491
491
|
* @since 4.0.0
|
|
492
492
|
*/
|
|
493
|
-
<O extends object, S extends object>(self: S, that: O):
|
|
493
|
+
<O extends object, S extends object>(self: S, that: O): Assign<S, O>
|
|
494
494
|
} = dual(
|
|
495
495
|
2,
|
|
496
496
|
<O extends object, S extends object>(self: S, that: O) => {
|
package/src/index.ts
CHANGED
|
@@ -3222,7 +3222,7 @@ export * as Runtime from "./Runtime.ts"
|
|
|
3222
3222
|
*
|
|
3223
3223
|
* // Retry with exponential backoff
|
|
3224
3224
|
* const retryPolicy = Schedule.exponential("100 millis", 2.0)
|
|
3225
|
-
* .pipe(Schedule.
|
|
3225
|
+
* .pipe(Schedule.both(Schedule.recurs(3)))
|
|
3226
3226
|
*
|
|
3227
3227
|
* const program = Effect.gen(function*() {
|
|
3228
3228
|
* // This will retry up to 3 times with exponential backoff
|
package/src/internal/effect.ts
CHANGED
|
@@ -5,7 +5,6 @@ import type * as Console from "../Console.ts"
|
|
|
5
5
|
import * as Duration from "../Duration.ts"
|
|
6
6
|
import type * as Effect from "../Effect.ts"
|
|
7
7
|
import * as Equal from "../Equal.ts"
|
|
8
|
-
import type { ErrorReporter } from "../ErrorReporter.ts"
|
|
9
8
|
import type * as Exit from "../Exit.ts"
|
|
10
9
|
import type * as Fiber from "../Fiber.ts"
|
|
11
10
|
import * as Filter from "../Filter.ts"
|
|
@@ -25,19 +24,7 @@ import { pipeArguments } from "../Pipeable.ts"
|
|
|
25
24
|
import type * as Predicate from "../Predicate.ts"
|
|
26
25
|
import { hasProperty, isIterable, isString, isTagged } from "../Predicate.ts"
|
|
27
26
|
import { currentFiberTypeId, redact } from "../Redactable.ts"
|
|
28
|
-
import {
|
|
29
|
-
CurrentConcurrency,
|
|
30
|
-
CurrentLogAnnotations,
|
|
31
|
-
CurrentLogLevel,
|
|
32
|
-
CurrentLogSpans,
|
|
33
|
-
CurrentStackFrame,
|
|
34
|
-
MinimumLogLevel,
|
|
35
|
-
type StackFrame,
|
|
36
|
-
TracerEnabled,
|
|
37
|
-
TracerSpanAnnotations,
|
|
38
|
-
TracerSpanLinks,
|
|
39
|
-
TracerTimingEnabled
|
|
40
|
-
} from "../References.ts"
|
|
27
|
+
import type { StackFrame } from "../References.ts"
|
|
41
28
|
import * as Result from "../Result.ts"
|
|
42
29
|
import * as Scheduler from "../Scheduler.ts"
|
|
43
30
|
import type * as Scope from "../Scope.ts"
|
|
@@ -97,6 +84,19 @@ import {
|
|
|
97
84
|
} from "./core.ts"
|
|
98
85
|
import * as doNotation from "./doNotation.ts"
|
|
99
86
|
import * as InternalMetric from "./metric.ts"
|
|
87
|
+
import {
|
|
88
|
+
CurrentConcurrency,
|
|
89
|
+
CurrentErrorReporters,
|
|
90
|
+
CurrentLogAnnotations,
|
|
91
|
+
CurrentLogLevel,
|
|
92
|
+
CurrentLogSpans,
|
|
93
|
+
CurrentStackFrame,
|
|
94
|
+
MinimumLogLevel,
|
|
95
|
+
TracerEnabled,
|
|
96
|
+
TracerSpanAnnotations,
|
|
97
|
+
TracerSpanLinks,
|
|
98
|
+
TracerTimingEnabled
|
|
99
|
+
} from "./references.ts"
|
|
100
100
|
import { addSpanStackTrace, type ErrorWithStackTraceLimit, makeStackCleaner } from "./tracer.ts"
|
|
101
101
|
import { version } from "./version.ts"
|
|
102
102
|
|
|
@@ -6192,13 +6192,6 @@ export { undefined_ as undefined }
|
|
|
6192
6192
|
// ErrorReporter
|
|
6193
6193
|
// ----------------------------------------------------------------------------
|
|
6194
6194
|
|
|
6195
|
-
/** @internal */
|
|
6196
|
-
export const CurrentErrorReporters = ServiceMap.Reference<
|
|
6197
|
-
ReadonlySet<ErrorReporter>
|
|
6198
|
-
>("effect/ErrorReporter/CurrentErrorReporters", {
|
|
6199
|
-
defaultValue: () => new Set()
|
|
6200
|
-
})
|
|
6201
|
-
|
|
6202
6195
|
/** @internal */
|
|
6203
6196
|
export const withErrorReporting: <
|
|
6204
6197
|
Arg extends Effect.Effect<any, any, any> | {
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { ErrorReporter } from "../ErrorReporter.ts"
|
|
2
|
+
import { constTrue, constUndefined } from "../Function.ts"
|
|
3
|
+
import type { LogLevel, Severity } from "../LogLevel.ts"
|
|
4
|
+
import type { ReadonlyRecord } from "../Record.ts"
|
|
5
|
+
import type { StackFrame } from "../References.ts"
|
|
6
|
+
import * as ServiceMap from "../ServiceMap.ts"
|
|
7
|
+
import type { SpanLink } from "../Tracer.ts"
|
|
8
|
+
|
|
9
|
+
/** @internal */
|
|
10
|
+
export const CurrentConcurrency = ServiceMap.Reference<"unbounded" | number>("effect/References/CurrentConcurrency", {
|
|
11
|
+
defaultValue: () => "unbounded"
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
/** @internal */
|
|
15
|
+
export const CurrentErrorReporters = ServiceMap.Reference<ReadonlySet<ErrorReporter>>(
|
|
16
|
+
"effect/ErrorReporter/CurrentErrorReporters",
|
|
17
|
+
{ defaultValue: () => new Set() }
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
/** @internal */
|
|
21
|
+
export const CurrentStackFrame = ServiceMap.Reference<StackFrame | undefined>("effect/References/CurrentStackFrame", {
|
|
22
|
+
defaultValue: constUndefined
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
/** @internal */
|
|
26
|
+
export const TracerEnabled = ServiceMap.Reference<boolean>("effect/References/TracerEnabled", {
|
|
27
|
+
defaultValue: constTrue
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
/** @internal */
|
|
31
|
+
export const TracerTimingEnabled = ServiceMap.Reference<boolean>("effect/References/TracerTimingEnabled", {
|
|
32
|
+
defaultValue: constTrue
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
/** @internal */
|
|
36
|
+
export const TracerSpanAnnotations = ServiceMap.Reference<ReadonlyRecord<string, unknown>>(
|
|
37
|
+
"effect/References/TracerSpanAnnotations",
|
|
38
|
+
{ defaultValue: () => ({}) }
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
/** @internal */
|
|
42
|
+
export const TracerSpanLinks = ServiceMap.Reference<ReadonlyArray<SpanLink>>("effect/References/TracerSpanLinks", {
|
|
43
|
+
defaultValue: () => []
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
/** @internal */
|
|
47
|
+
export const CurrentLogAnnotations = ServiceMap.Reference<ReadonlyRecord<string, unknown>>(
|
|
48
|
+
"effect/References/CurrentLogAnnotations",
|
|
49
|
+
{ defaultValue: () => ({}) }
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
/** @internal */
|
|
53
|
+
export const CurrentLogLevel: ServiceMap.Reference<Severity> = ServiceMap.Reference<Severity>(
|
|
54
|
+
"effect/References/CurrentLogLevel",
|
|
55
|
+
{ defaultValue: () => "Info" }
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
/** @internal */
|
|
59
|
+
export const MinimumLogLevel = ServiceMap.Reference<
|
|
60
|
+
LogLevel
|
|
61
|
+
>("effect/References/MinimumLogLevel", { defaultValue: () => "Info" })
|
|
62
|
+
|
|
63
|
+
/** @internal */
|
|
64
|
+
export const UnhandledLogLevel: ServiceMap.Reference<Severity | undefined> = ServiceMap.Reference(
|
|
65
|
+
"effect/References/UnhandledLogLevel",
|
|
66
|
+
{ defaultValue: (): Severity | undefined => "Error" }
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
/** @internal */
|
|
70
|
+
export const CurrentLogSpans = ServiceMap.Reference<
|
|
71
|
+
ReadonlyArray<[label: string, timestamp: number]>
|
|
72
|
+
>("effect/References/CurrentLogSpans", { defaultValue: () => [] })
|
|
@@ -526,12 +526,12 @@ export const endpoint = <
|
|
|
526
526
|
* @since 4.0.0
|
|
527
527
|
* @category constructors
|
|
528
528
|
*/
|
|
529
|
-
export const urlBuilder = <Api extends HttpApi.
|
|
529
|
+
export const urlBuilder = <Api extends HttpApi.Any>(api: Api, options?: {
|
|
530
530
|
readonly baseUrl?: URL | string | undefined
|
|
531
531
|
}): UrlBuilder<Api> => {
|
|
532
532
|
const builder: Record<string, any> = {}
|
|
533
533
|
|
|
534
|
-
HttpApi.reflect(api, {
|
|
534
|
+
HttpApi.reflect(api as unknown as HttpApi.AnyWithProps, {
|
|
535
535
|
onGroup({ group }) {
|
|
536
536
|
if (group.topLevel) return
|
|
537
537
|
builder[group.identifier] = {}
|