Skip to content

Commit d07a900

Browse files
committed
Merge package:stream_transform into the tools monorepo
2 parents 5590447 + d83abd9 commit d07a900

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+5912
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Dependabot configuration file.
2+
version: 2
3+
4+
updates:
5+
- package-ecosystem: github-actions
6+
directory: /
7+
schedule:
8+
interval: monthly
9+
labels:
10+
- autosubmit
11+
groups:
12+
github-actions:
13+
patterns:
14+
- "*"
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Dart CI
2+
3+
on:
4+
# Run on PRs and pushes to the default branch.
5+
push:
6+
branches: [ master ]
7+
pull_request:
8+
branches: [ master ]
9+
schedule:
10+
- cron: "0 0 * * 0"
11+
12+
env:
13+
PUB_ENVIRONMENT: bot.github
14+
15+
jobs:
16+
# Check code formatting and static analysis on a single OS (linux)
17+
# against Dart dev.
18+
analyze:
19+
runs-on: ubuntu-latest
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
sdk: [dev]
24+
steps:
25+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
26+
- uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94
27+
with:
28+
sdk: ${{ matrix.sdk }}
29+
- id: install
30+
name: Install dependencies
31+
run: dart pub get
32+
- name: Check formatting
33+
run: dart format --output=none --set-exit-if-changed .
34+
if: always() && steps.install.outcome == 'success'
35+
- name: Analyze code
36+
run: dart analyze --fatal-infos
37+
if: always() && steps.install.outcome == 'success'
38+
39+
# Run tests on a matrix consisting of two dimensions:
40+
# 1. OS: ubuntu-latest, (macos-latest, windows-latest)
41+
# 2. release channel: dev
42+
test:
43+
needs: analyze
44+
runs-on: ${{ matrix.os }}
45+
strategy:
46+
fail-fast: false
47+
matrix:
48+
# Add macos-latest and/or windows-latest if relevant for this package.
49+
os: [ubuntu-latest]
50+
# Bump SDK for Legacy tests when changing min SDK.
51+
sdk: [3.1, dev]
52+
steps:
53+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
54+
- uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94
55+
with:
56+
sdk: ${{ matrix.sdk }}
57+
- id: install
58+
name: Install dependencies
59+
run: dart pub get
60+
- name: Run tests
61+
run: dart test -p chrome,vm --test-randomize-ordering-seed=random
62+
if: always() && steps.install.outcome == 'success'

pkgs/stream_transform/.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.pub/
2+
.dart_tool/
3+
build/
4+
packages
5+
pubspec.lock
6+
.packages

pkgs/stream_transform/CHANGELOG.md

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
## 2.1.1-wip
2+
3+
- Require Dart 3.1 or greater
4+
- Forward errors from the `trigger` future through to the result stream in
5+
`takeUntil`. Previously an error would have not closed the stream, and instead
6+
raised as an unhandled async error.
7+
8+
## 2.1.0
9+
10+
- Add `whereNotNull`.
11+
12+
## 2.0.1
13+
14+
- Require Dart 2.14 or greater.
15+
- Wait for the future returned from `StreamSubscription.cancel()` before
16+
listening to the subsequent stream in `switchLatest` and `switchMap`.
17+
18+
## 2.0.0
19+
20+
- Migrate to null safety.
21+
- Improve tests of `switchMap` and improve documentation with links and
22+
clarification.
23+
- Add `trailing` argument to `throttle`.
24+
25+
## 1.2.0
26+
27+
- Add support for emitting the "leading" event in `debounce`.
28+
29+
## 1.1.1
30+
31+
- Fix a bug in `asyncMapSample`, `buffer`, `combineLatest`,
32+
`combineLatestAll`, `merge`, and `mergeAll` which would cause an exception
33+
when cancelling a subscription after using the transformer if the original
34+
stream(s) returned `null` from cancelling their subscriptions.
35+
36+
## 1.1.0
37+
38+
- Add `concurrentAsyncExpand` to interleave events emitted by multiple sub
39+
streams created by a callback.
40+
41+
## 1.0.0
42+
43+
- Remove the top level methods and retain the extensions only.
44+
45+
## 0.0.20
46+
47+
- Add extension methods for most transformers. These should be used in place
48+
of the current methods. All current implementations are deprecated and will
49+
be removed in the next major version bump.
50+
- Migrating typical use: Instead of
51+
`stream.transform(debounce(Duration(seconds: 1)))` use
52+
`stream.debounce(Duration(seconds: 1))`.
53+
- To migrate a usage where a `StreamTransformer` instance is stored or
54+
passed see "Getting a StreamTransformer instance" on the README.
55+
- The `map` and `chainTransformers` utilities are no longer useful with the
56+
new patterns so they are deprecated without a replacement. If you still have
57+
a need for them they can be replicated with `StreamTransformer.fromBind`:
58+
59+
```
60+
// Replace `map(convert)`
61+
StreamTransformer.fromBind((s) => s.map(convert));
62+
63+
// Replace `chainTransformers(first, second)`
64+
StreamTransformer.fromBind((s) => s.transform(first).transform(second));
65+
```
66+
67+
## 0.0.19
68+
69+
- Add `asyncMapSample` transform.
70+
71+
## 0.0.18
72+
73+
- Internal cleanup. Passed "trigger" streams or futures now allow `<void>`
74+
generic type rather than an implicit `dynamic>`
75+
76+
## 0.0.17
77+
78+
- Add concrete types to the `onError` callback in `tap`.
79+
80+
## 0.0.16+1
81+
82+
- Remove usage of Set literal which is not available before Dart 2.2.0
83+
84+
## 0.0.16
85+
86+
- Allow a `combine` callback to return a `FutureOr<T>` in `scan`. There are no
87+
behavior changes for synchronous callbacks. **Potential breaking change** In
88+
the unlikely situation where `scan` was used to produce a `Stream<Future>`
89+
inference may now fail and require explicit generic type arguments.
90+
- Add `combineLatest`.
91+
- Add `combineLatestAll`.
92+
93+
## 0.0.15
94+
95+
- Add `whereType`.
96+
97+
## 0.0.14+1
98+
99+
- Allow using non-dev Dart 2 SDK.
100+
101+
## 0.0.14
102+
103+
- `asyncWhere` will now forward exceptions thrown by the callback through the
104+
result Stream.
105+
- Added `concurrentAsyncMap`.
106+
107+
## 0.0.13
108+
109+
- `mergeAll` now accepts an `Iterable<Stream>` instead of only `List<Stream>`.
110+
111+
## 0.0.12
112+
113+
- Add `chainTransformers` and `map` for use cases where `StreamTransformer`
114+
instances are stored as variables or passed to methods other than `transform`.
115+
116+
## 0.0.11
117+
118+
- Renamed `concat` as `followedBy` to match the naming of `Iterable.followedBy`.
119+
`concat` is now deprecated.
120+
121+
## 0.0.10
122+
123+
- Updates to support Dart 2.0 core library changes (wave
124+
2.2). See [issue 31847][sdk#31847] for details.
125+
126+
[sdk#31847]: https://github.com/dart-lang/sdk/issues/31847
127+
128+
## 0.0.9
129+
130+
- Add `asyncMapBuffer`.
131+
132+
## 0.0.8
133+
134+
- Add `takeUntil`.
135+
136+
## 0.0.7
137+
138+
- Bug Fix: Streams produced with `scan` and `switchMap` now correctly report
139+
`isBroadcast`.
140+
- Add `startWith`, `startWithMany`, and `startWithStream`.
141+
142+
## 0.0.6
143+
144+
- Bug Fix: Some transformers did not correctly add data to all listeners on
145+
broadcast streams. Fixed for `throttle`, `debounce`, `asyncWhere` and `audit`.
146+
- Bug Fix: Only call the `tap` data callback once per event rather than once per
147+
listener.
148+
- Bug Fix: Allow canceling and re-listening to broadcast streams after a
149+
`merge` transform.
150+
- Bug Fix: Broadcast streams which are buffered using a single-subscription
151+
trigger can be canceled and re-listened.
152+
- Bug Fix: Buffer outputs one more value if there is a pending trigger before
153+
the trigger closes.
154+
- Bug Fix: Single-subscription streams concatted after broadcast streams are
155+
handled correctly.
156+
- Use sync `StreamControllers` for forwarding where possible.
157+
158+
## 0.0.5
159+
160+
- Bug Fix: Allow compiling switchLatest with Dart2Js.
161+
- Add `asyncWhere`: Like `where` but allows an asynchronous predicate.
162+
163+
## 0.0.4
164+
- Add `scan`: fold which returns intermediate values
165+
- Add `throttle`: block events for a duration after emitting a value
166+
- Add `audit`: emits the last event received after a duration
167+
168+
## 0.0.3
169+
170+
- Add `tap`: React to values as they pass without being a subscriber on a stream
171+
- Add `switchMap` and `switchLatest`: Flatten a Stream of Streams into a Stream
172+
which forwards values from the most recent Stream
173+
174+
## 0.0.2
175+
176+
- Add `concat`: Appends streams in series
177+
- Add `merge` and `mergeAll`: Interleaves streams
178+
179+
## 0.0.1
180+
181+
- Initial release with the following utilities:
182+
- `buffer`: Collects events in a `List` until a `trigger` stream fires.
183+
- `debounce`, `debounceBuffer`: Collect or drop events which occur closer in
184+
time than a given duration.

pkgs/stream_transform/LICENSE

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Copyright 2017, the Dart project authors.
2+
3+
Redistribution and use in source and binary forms, with or without
4+
modification, are permitted provided that the following conditions are
5+
met:
6+
7+
* Redistributions of source code must retain the above copyright
8+
notice, this list of conditions and the following disclaimer.
9+
* Redistributions in binary form must reproduce the above
10+
copyright notice, this list of conditions and the following
11+
disclaimer in the documentation and/or other materials provided
12+
with the distribution.
13+
* Neither the name of Google LLC nor the names of its
14+
contributors may be used to endorse or promote products derived
15+
from this software without specific prior written permission.
16+
17+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

0 commit comments

Comments
 (0)