Skip to content
This repository has been archived by the owner on Jul 16, 2024. It is now read-only.

Commit

Permalink
Stream: replace Duration.Duration with Duration.DurationInput in publ… (
Browse files Browse the repository at this point in the history
  • Loading branch information
gcanti authored Sep 15, 2023
1 parent a6973e4 commit 81e2d51
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 81 deletions.
5 changes: 5 additions & 0 deletions .changeset/old-cars-divide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@effect/stream": patch
---

Stream: replace Duration.Duration with Duration.DurationInput in public APIs
44 changes: 23 additions & 21 deletions docs/modules/Stream.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -1114,7 +1114,7 @@ A stream that emits Unit values spaced by the specified duration.
**Signature**
```ts
export declare const tick: (interval: Duration.Duration) => Stream<never, never, void>
export declare const tick: (interval: Duration.DurationInput) => Stream<never, never, void>
```
Added in v1.0.0
Expand Down Expand Up @@ -3785,8 +3785,8 @@ has paused typing so as to not prematurely recommend results.
```ts
export declare const debounce: {
(duration: Duration.Duration): <R, E, A>(self: Stream<R, E, A>) => Stream<R, E, A>
<R, E, A>(self: Stream<R, E, A>, duration: Duration.Duration): Stream<R, E, A>
(duration: Duration.DurationInput): <R, E, A>(self: Stream<R, E, A>) => Stream<R, E, A>
<R, E, A>(self: Stream<R, E, A>, duration: Duration.DurationInput): Stream<R, E, A>
}
```
Expand Down Expand Up @@ -4204,8 +4204,10 @@ Partitions the stream with the specified `chunkSize` or until the specified
```ts
export declare const groupedWithin: {
(chunkSize: number, duration: Duration.Duration): <R, E, A>(self: Stream<R, E, A>) => Stream<R, E, Chunk.Chunk<A>>
<R, E, A>(self: Stream<R, E, A>, chunkSize: number, duration: Duration.Duration): Stream<R, E, Chunk.Chunk<A>>
(chunkSize: number, duration: Duration.DurationInput): <R, E, A>(
self: Stream<R, E, A>
) => Stream<R, E, Chunk.Chunk<A>>
<R, E, A>(self: Stream<R, E, A>, chunkSize: number, duration: Duration.DurationInput): Stream<R, E, Chunk.Chunk<A>>
}
```
Expand All @@ -4223,8 +4225,8 @@ given duration completes. See `interruptAfter` for this behavior.
```ts
export declare const haltAfter: {
(duration: Duration.Duration): <R, E, A>(self: Stream<R, E, A>) => Stream<R, E, A>
<R, E, A>(self: Stream<R, E, A>, duration: Duration.Duration): Stream<R, E, A>
(duration: Duration.DurationInput): <R, E, A>(self: Stream<R, E, A>) => Stream<R, E, A>
<R, E, A>(self: Stream<R, E, A>, duration: Duration.DurationInput): Stream<R, E, A>
}
```
Expand Down Expand Up @@ -4335,8 +4337,8 @@ evaluation of this stream after the given `Duration`.
```ts
export declare const interruptAfter: {
(duration: Duration.Duration): <R, E, A>(self: Stream<R, E, A>) => Stream<R, E, A>
<R, E, A>(self: Stream<R, E, A>, duration: Duration.Duration): Stream<R, E, A>
(duration: Duration.DurationInput): <R, E, A>(self: Stream<R, E, A>) => Stream<R, E, A>
<R, E, A>(self: Stream<R, E, A>, duration: Duration.DurationInput): Stream<R, E, A>
}
```
Expand Down Expand Up @@ -5286,7 +5288,7 @@ export declare const throttle: {
<A>(options: {
readonly cost: (chunk: Chunk.Chunk<A>) => number
readonly units: number
readonly duration: Duration.Duration
readonly duration: Duration.DurationInput
readonly burst?: number | undefined
readonly strategy?: 'enforce' | 'shape' | undefined
}): <R, E>(self: Stream<R, E, A>) => Stream<R, E, A>
Expand All @@ -5295,7 +5297,7 @@ export declare const throttle: {
options: {
readonly cost: (chunk: Chunk.Chunk<A>) => number
readonly units: number
readonly duration: Duration.Duration
readonly duration: Duration.DurationInput
readonly burst?: number | undefined
readonly strategy?: 'enforce' | 'shape' | undefined
}
Expand Down Expand Up @@ -5326,7 +5328,7 @@ export declare const throttleEffect: {
<A, R2, E2>(options: {
readonly cost: (chunk: Chunk.Chunk<A>) => Effect.Effect<R2, E2, number>
readonly units: number
readonly duration: Duration.Duration
readonly duration: Duration.DurationInput
readonly burst?: number | undefined
readonly strategy?: 'enforce' | 'shape' | undefined
}): <R, E>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, A>
Expand All @@ -5335,7 +5337,7 @@ export declare const throttleEffect: {
options: {
readonly cost: (chunk: Chunk.Chunk<A>) => Effect.Effect<R2, E2, number>
readonly units: number
readonly duration: Duration.Duration
readonly duration: Duration.DurationInput
readonly burst?: number | undefined
readonly strategy?: 'enforce' | 'shape' | undefined
}
Expand All @@ -5353,8 +5355,8 @@ Ends the stream if it does not produce a value after the specified duration.
```ts
export declare const timeout: {
(duration: Duration.Duration): <R, E, A>(self: Stream<R, E, A>) => Stream<R, E, A>
<R, E, A>(self: Stream<R, E, A>, duration: Duration.Duration): Stream<R, E, A>
(duration: Duration.DurationInput): <R, E, A>(self: Stream<R, E, A>) => Stream<R, E, A>
<R, E, A>(self: Stream<R, E, A>, duration: Duration.DurationInput): Stream<R, E, A>
}
```
Expand All @@ -5369,8 +5371,8 @@ duration.
```ts
export declare const timeoutFail: {
<E2>(error: LazyArg<E2>, duration: Duration.Duration): <R, E, A>(self: Stream<R, E, A>) => Stream<R, E2 | E, A>
<R, E, A, E2>(self: Stream<R, E, A>, error: LazyArg<E2>, duration: Duration.Duration): Stream<R, E | E2, A>
<E2>(error: LazyArg<E2>, duration: Duration.DurationInput): <R, E, A>(self: Stream<R, E, A>) => Stream<R, E2 | E, A>
<R, E, A, E2>(self: Stream<R, E, A>, error: LazyArg<E2>, duration: Duration.DurationInput): Stream<R, E | E2, A>
}
```
Expand All @@ -5385,10 +5387,10 @@ duration.
```ts
export declare const timeoutFailCause: {
<E2>(cause: LazyArg<Cause.Cause<E2>>, duration: Duration.Duration): <R, E, A>(
<E2>(cause: LazyArg<Cause.Cause<E2>>, duration: Duration.DurationInput): <R, E, A>(
self: Stream<R, E, A>
) => Stream<R, E2 | E, A>
<R, E, A, E2>(self: Stream<R, E, A>, cause: LazyArg<Cause.Cause<E2>>, duration: Duration.Duration): Stream<
<R, E, A, E2>(self: Stream<R, E, A>, cause: LazyArg<Cause.Cause<E2>>, duration: Duration.DurationInput): Stream<
R,
E | E2,
A
Expand All @@ -5407,10 +5409,10 @@ duration.
```ts
export declare const timeoutTo: {
<R2, E2, A2>(duration: Duration.Duration, that: Stream<R2, E2, A2>): <R, E, A>(
<R2, E2, A2>(duration: Duration.DurationInput, that: Stream<R2, E2, A2>): <R, E, A>(
self: Stream<R, E, A>
) => Stream<R2 | R, E2 | E, A2 | A>
<R, E, A, R2, E2, A2>(self: Stream<R, E, A>, duration: Duration.Duration, that: Stream<R2, E2, A2>): Stream<
<R, E, A, R2, E2, A2>(self: Stream<R, E, A>, duration: Duration.DurationInput, that: Stream<R2, E2, A2>): Stream<
R | R2,
E | E2,
A | A2
Expand Down
45 changes: 24 additions & 21 deletions src/Stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -830,8 +830,8 @@ export const crossWith: {
* @category utils
*/
export const debounce: {
(duration: Duration.Duration): <R, E, A>(self: Stream<R, E, A>) => Stream<R, E, A>
<R, E, A>(self: Stream<R, E, A>, duration: Duration.Duration): Stream<R, E, A>
(duration: Duration.DurationInput): <R, E, A>(self: Stream<R, E, A>) => Stream<R, E, A>
<R, E, A>(self: Stream<R, E, A>, duration: Duration.DurationInput): Stream<R, E, A>
} = internal.debounce

/**
Expand Down Expand Up @@ -1695,8 +1695,11 @@ export const grouped: {
* @category utils
*/
export const groupedWithin: {
(chunkSize: number, duration: Duration.Duration): <R, E, A>(self: Stream<R, E, A>) => Stream<R, E, Chunk.Chunk<A>>
<R, E, A>(self: Stream<R, E, A>, chunkSize: number, duration: Duration.Duration): Stream<R, E, Chunk.Chunk<A>>
(
chunkSize: number,
duration: Duration.DurationInput
): <R, E, A>(self: Stream<R, E, A>) => Stream<R, E, Chunk.Chunk<A>>
<R, E, A>(self: Stream<R, E, A>, chunkSize: number, duration: Duration.DurationInput): Stream<R, E, Chunk.Chunk<A>>
} = internal.groupedWithin

/**
Expand All @@ -1710,8 +1713,8 @@ export const groupedWithin: {
* @category utils
*/
export const haltAfter: {
(duration: Duration.Duration): <R, E, A>(self: Stream<R, E, A>) => Stream<R, E, A>
<R, E, A>(self: Stream<R, E, A>, duration: Duration.Duration): Stream<R, E, A>
(duration: Duration.DurationInput): <R, E, A>(self: Stream<R, E, A>) => Stream<R, E, A>
<R, E, A>(self: Stream<R, E, A>, duration: Duration.DurationInput): Stream<R, E, A>
} = internal.haltAfter

/**
Expand Down Expand Up @@ -1826,8 +1829,8 @@ export const intersperseAffixes: {
* @category utils
*/
export const interruptAfter: {
(duration: Duration.Duration): <R, E, A>(self: Stream<R, E, A>) => Stream<R, E, A>
<R, E, A>(self: Stream<R, E, A>, duration: Duration.Duration): Stream<R, E, A>
(duration: Duration.DurationInput): <R, E, A>(self: Stream<R, E, A>) => Stream<R, E, A>
<R, E, A>(self: Stream<R, E, A>, duration: Duration.DurationInput): Stream<R, E, A>
} = internal.interruptAfter

/**
Expand Down Expand Up @@ -3635,7 +3638,7 @@ export const throttle: {
options: {
readonly cost: (chunk: Chunk.Chunk<A>) => number
readonly units: number
readonly duration: Duration.Duration
readonly duration: Duration.DurationInput
readonly burst?: number
readonly strategy?: "enforce" | "shape"
}
Expand All @@ -3645,7 +3648,7 @@ export const throttle: {
options: {
readonly cost: (chunk: Chunk.Chunk<A>) => number
readonly units: number
readonly duration: Duration.Duration
readonly duration: Duration.DurationInput
readonly burst?: number
readonly strategy?: "enforce" | "shape"
}
Expand Down Expand Up @@ -3673,7 +3676,7 @@ export const throttleEffect: {
options: {
readonly cost: (chunk: Chunk.Chunk<A>) => Effect.Effect<R2, E2, number>
readonly units: number
readonly duration: Duration.Duration
readonly duration: Duration.DurationInput
readonly burst?: number
readonly strategy?: "enforce" | "shape"
}
Expand All @@ -3683,7 +3686,7 @@ export const throttleEffect: {
options: {
readonly cost: (chunk: Chunk.Chunk<A>) => Effect.Effect<R2, E2, number>
readonly units: number
readonly duration: Duration.Duration
readonly duration: Duration.DurationInput
readonly burst?: number
readonly strategy?: "enforce" | "shape"
}
Expand All @@ -3696,7 +3699,7 @@ export const throttleEffect: {
* @since 1.0.0
* @category constructors
*/
export const tick: (interval: Duration.Duration) => Stream<never, never, void> = internal.tick
export const tick: (interval: Duration.DurationInput) => Stream<never, never, void> = internal.tick

/**
* Ends the stream if it does not produce a value after the specified duration.
Expand All @@ -3705,8 +3708,8 @@ export const tick: (interval: Duration.Duration) => Stream<never, never, void> =
* @category utils
*/
export const timeout: {
(duration: Duration.Duration): <R, E, A>(self: Stream<R, E, A>) => Stream<R, E, A>
<R, E, A>(self: Stream<R, E, A>, duration: Duration.Duration): Stream<R, E, A>
(duration: Duration.DurationInput): <R, E, A>(self: Stream<R, E, A>) => Stream<R, E, A>
<R, E, A>(self: Stream<R, E, A>, duration: Duration.DurationInput): Stream<R, E, A>
} = internal.timeout

/**
Expand All @@ -3717,8 +3720,8 @@ export const timeout: {
* @category utils
*/
export const timeoutFail: {
<E2>(error: LazyArg<E2>, duration: Duration.Duration): <R, E, A>(self: Stream<R, E, A>) => Stream<R, E2 | E, A>
<R, E, A, E2>(self: Stream<R, E, A>, error: LazyArg<E2>, duration: Duration.Duration): Stream<R, E | E2, A>
<E2>(error: LazyArg<E2>, duration: Duration.DurationInput): <R, E, A>(self: Stream<R, E, A>) => Stream<R, E2 | E, A>
<R, E, A, E2>(self: Stream<R, E, A>, error: LazyArg<E2>, duration: Duration.DurationInput): Stream<R, E | E2, A>
} = internal.timeoutFail

/**
Expand All @@ -3731,12 +3734,12 @@ export const timeoutFail: {
export const timeoutFailCause: {
<E2>(
cause: LazyArg<Cause.Cause<E2>>,
duration: Duration.Duration
duration: Duration.DurationInput
): <R, E, A>(self: Stream<R, E, A>) => Stream<R, E2 | E, A>
<R, E, A, E2>(
self: Stream<R, E, A>,
cause: LazyArg<Cause.Cause<E2>>,
duration: Duration.Duration
duration: Duration.DurationInput
): Stream<R, E | E2, A>
} = internal.timeoutFailCause

Expand All @@ -3749,12 +3752,12 @@ export const timeoutFailCause: {
*/
export const timeoutTo: {
<R2, E2, A2>(
duration: Duration.Duration,
duration: Duration.DurationInput,
that: Stream<R2, E2, A2>
): <R, E, A>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, A2 | A>
<R, E, A, R2, E2, A2>(
self: Stream<R, E, A>,
duration: Duration.Duration,
duration: Duration.DurationInput,
that: Stream<R2, E2, A2>
): Stream<R | R2, E | E2, A | A2>
} = internal.timeoutTo
Expand Down
Loading

0 comments on commit 81e2d51

Please sign in to comment.