gingersnap 0.22.0
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/_virtual/_tslib.cjs +102 -0
- package/_virtual/_tslib.mjs +93 -0
- package/data/AtomicValue.d.ts +15 -0
- package/data/bus.cjs +179 -0
- package/data/bus.d.ts +72 -0
- package/data/bus.mjs +177 -0
- package/data/decoders/index.d.ts +4 -0
- package/data/decoders/json.cjs +12 -0
- package/data/decoders/json.d.ts +7 -0
- package/data/decoders/json.mjs +10 -0
- package/data/decoders/msgpack.cjs +14 -0
- package/data/decoders/msgpack.d.ts +7 -0
- package/data/decoders/msgpack.mjs +12 -0
- package/data/decoders/protobuf.d.ts +13 -0
- package/data/decoders/string.cjs +12 -0
- package/data/decoders/string.d.ts +7 -0
- package/data/decoders/string.mjs +10 -0
- package/data/decoders/type.d.ts +7 -0
- package/data/decoders.cjs +11 -0
- package/data/decoders.mjs +3 -0
- package/data/model/credentials.cjs +114 -0
- package/data/model/credentials.d.ts +61 -0
- package/data/model/credentials.mjs +109 -0
- package/data/model/extra.cjs +88 -0
- package/data/model/extra.d.ts +5 -0
- package/data/model/extra.mjs +66 -0
- package/data/model/index.d.ts +6 -0
- package/data/model/model.cjs +541 -0
- package/data/model/model.d.ts +207 -0
- package/data/model/model.mjs +518 -0
- package/data/model/plugin.cjs +96 -0
- package/data/model/plugin.d.ts +38 -0
- package/data/model/plugin.mjs +72 -0
- package/data/model/property.cjs +310 -0
- package/data/model/property.d.ts +83 -0
- package/data/model/property.mjs +278 -0
- package/data/model/types.cjs +32 -0
- package/data/model/types.d.ts +28 -0
- package/data/model/types.mjs +32 -0
- package/data/model.cjs +43 -0
- package/data/model.mjs +6 -0
- package/data/signal.cjs +47 -0
- package/data/signal.d.ts +17 -0
- package/data/signal.mjs +45 -0
- package/data/store/index.d.ts +4 -0
- package/data/store/json.cjs +58 -0
- package/data/store/json.d.ts +18 -0
- package/data/store/json.mjs +56 -0
- package/data/store/manager.cjs +206 -0
- package/data/store/manager.d.ts +44 -0
- package/data/store/manager.mjs +203 -0
- package/data/store/web.cjs +92 -0
- package/data/store/web.d.ts +25 -0
- package/data/store/web.mjs +89 -0
- package/data/value.cjs +66 -0
- package/data/value.mjs +64 -0
- package/data-structures/array/CyclicalList.cjs +57 -0
- package/data-structures/array/CyclicalList.d.ts +12 -0
- package/data-structures/array/CyclicalList.mjs +55 -0
- package/data-structures/array/Pair.cjs +30 -0
- package/data-structures/array/Pair.d.ts +17 -0
- package/data-structures/array/Pair.mjs +27 -0
- package/data-structures/array/Stack.cjs +96 -0
- package/data-structures/array/Stack.d.ts +41 -0
- package/data-structures/array/Stack.mjs +94 -0
- package/data-structures/array/Triple.cjs +34 -0
- package/data-structures/array/Triple.d.ts +19 -0
- package/data-structures/array/Triple.mjs +31 -0
- package/data-structures/array/Tuple.d.ts +8 -0
- package/data-structures/array/index.d.ts +5 -0
- package/data-structures/array.cjs +15 -0
- package/data-structures/array.mjs +4 -0
- package/data-structures/object/BufferQueue.cjs +98 -0
- package/data-structures/object/BufferQueue.d.ts +21 -0
- package/data-structures/object/BufferQueue.mjs +77 -0
- package/data-structures/object/CyclicalObject.cjs +155 -0
- package/data-structures/object/CyclicalObject.d.ts +74 -0
- package/data-structures/object/CyclicalObject.mjs +134 -0
- package/data-structures/object/Queue.cjs +178 -0
- package/data-structures/object/Queue.d.ts +31 -0
- package/data-structures/object/Queue.mjs +176 -0
- package/data-structures/object/SimpleQueue.cjs +53 -0
- package/data-structures/object/SimpleQueue.d.ts +13 -0
- package/data-structures/object/SimpleQueue.mjs +51 -0
- package/data-structures/object/TimeableObject.cjs +73 -0
- package/data-structures/object/TimeableObject.d.ts +30 -0
- package/data-structures/object/TimeableObject.mjs +71 -0
- package/data-structures/object/WaitableObject.cjs +61 -0
- package/data-structures/object/WaitableObject.d.ts +29 -0
- package/data-structures/object/WaitableObject.mjs +59 -0
- package/data-structures/object/WatchableObject.cjs +251 -0
- package/data-structures/object/WatchableObject.d.ts +88 -0
- package/data-structures/object/WatchableObject.mjs +230 -0
- package/data-structures/object/index.d.ts +7 -0
- package/data-structures/object.cjs +23 -0
- package/data-structures/object.mjs +7 -0
- package/errors/AbortError.cjs +9 -0
- package/errors/AbortError.d.ts +5 -0
- package/errors/AbortError.mjs +7 -0
- package/errors/CallExecutionError.cjs +13 -0
- package/errors/CallExecutionError.d.ts +7 -0
- package/errors/CallExecutionError.mjs +11 -0
- package/errors/FutureCancelled.cjs +11 -0
- package/errors/FutureCancelled.d.ts +6 -0
- package/errors/FutureCancelled.mjs +9 -0
- package/errors/FutureError.cjs +11 -0
- package/errors/FutureError.d.ts +6 -0
- package/errors/FutureError.mjs +9 -0
- package/errors/IllegalArgumentsError.cjs +13 -0
- package/errors/IllegalArgumentsError.d.ts +7 -0
- package/errors/IllegalArgumentsError.mjs +11 -0
- package/errors/IllegalOperationError.cjs +6 -0
- package/errors/IllegalOperationError.d.ts +2 -0
- package/errors/IllegalOperationError.mjs +4 -0
- package/errors/InvalidType.cjs +6 -0
- package/errors/InvalidType.d.ts +2 -0
- package/errors/InvalidType.mjs +4 -0
- package/errors/InvalidValue.cjs +11 -0
- package/errors/InvalidValue.d.ts +4 -0
- package/errors/InvalidValue.mjs +9 -0
- package/errors/MissingArgumentsError.cjs +13 -0
- package/errors/MissingArgumentsError.d.ts +7 -0
- package/errors/MissingArgumentsError.mjs +11 -0
- package/errors/NetworkError.cjs +13 -0
- package/errors/NetworkError.d.ts +8 -0
- package/errors/NetworkError.mjs +11 -0
- package/errors/NoSuchElement.cjs +6 -0
- package/errors/NoSuchElement.d.ts +2 -0
- package/errors/NoSuchElement.mjs +4 -0
- package/errors/NotImplemented.cjs +9 -0
- package/errors/NotImplemented.d.ts +5 -0
- package/errors/NotImplemented.mjs +7 -0
- package/errors/ParsingError.cjs +10 -0
- package/errors/ParsingError.d.ts +5 -0
- package/errors/ParsingError.mjs +8 -0
- package/errors/QueueEmptyError.cjs +6 -0
- package/errors/QueueEmptyError.d.ts +2 -0
- package/errors/QueueEmptyError.mjs +4 -0
- package/errors/QueueFullError.cjs +6 -0
- package/errors/QueueFullError.d.ts +2 -0
- package/errors/QueueFullError.mjs +4 -0
- package/errors/StackEmptyError.cjs +6 -0
- package/errors/StackEmptyError.d.ts +2 -0
- package/errors/StackEmptyError.mjs +4 -0
- package/errors/StackFullError.cjs +6 -0
- package/errors/StackFullError.d.ts +2 -0
- package/errors/StackFullError.mjs +4 -0
- package/errors/StreamEnded.cjs +6 -0
- package/errors/StreamEnded.d.ts +2 -0
- package/errors/StreamEnded.mjs +4 -0
- package/errors/TimeoutError.cjs +11 -0
- package/errors/TimeoutError.d.ts +6 -0
- package/errors/TimeoutError.mjs +9 -0
- package/errors/ValueDestroyedError.cjs +6 -0
- package/errors/ValueDestroyedError.d.ts +2 -0
- package/errors/ValueDestroyedError.mjs +4 -0
- package/errors/VerificationError.cjs +9 -0
- package/errors/VerificationError.d.ts +5 -0
- package/errors/VerificationError.mjs +7 -0
- package/errors/index.d.ts +18 -0
- package/errors.cjs +41 -0
- package/errors.mjs +18 -0
- package/files.cjs +201 -0
- package/files.d.ts +31 -0
- package/files.mjs +180 -0
- package/functools/index.d.ts +31 -0
- package/functools.cjs +371 -0
- package/functools.mjs +334 -0
- package/future/future.cjs +570 -0
- package/future/future.d.ts +208 -0
- package/future/future.mjs +548 -0
- package/future/group.cjs +180 -0
- package/future/group.d.ts +82 -0
- package/future/group.mjs +159 -0
- package/future/index.d.ts +3 -0
- package/future/result.cjs +19 -0
- package/future/result.d.ts +18 -0
- package/future/result.mjs +17 -0
- package/future.cjs +11 -0
- package/future.mjs +3 -0
- package/managers/context.d.ts +8 -0
- package/managers/index.d.ts +1 -0
- package/managers.cjs +2 -0
- package/managers.mjs +1 -0
- package/mocks.cjs +301 -0
- package/mocks.d.ts +125 -0
- package/mocks.mjs +293 -0
- package/networking/EventSourceService.cjs +104 -0
- package/networking/EventSourceService.d.ts +11 -0
- package/networking/EventSourceService.mjs +83 -0
- package/networking/NetworkService.cjs +394 -0
- package/networking/NetworkService.d.ts +97 -0
- package/networking/NetworkService.mjs +373 -0
- package/networking/SocketService.cjs +218 -0
- package/networking/SocketService.d.ts +23 -0
- package/networking/SocketService.mjs +197 -0
- package/networking/decorators/index.d.ts +4 -0
- package/networking/decorators/options.cjs +289 -0
- package/networking/decorators/options.d.ts +148 -0
- package/networking/decorators/options.mjs +242 -0
- package/networking/decorators/requests.cjs +80 -0
- package/networking/decorators/requests.d.ts +34 -0
- package/networking/decorators/requests.mjs +52 -0
- package/networking/decorators/socket.cjs +81 -0
- package/networking/decorators/socket.d.ts +13 -0
- package/networking/decorators/socket.mjs +51 -0
- package/networking/http.cjs +69 -0
- package/networking/http.d.ts +66 -0
- package/networking/http.mjs +69 -0
- package/networking/index.d.ts +39 -0
- package/networking/request.cjs +18 -0
- package/networking/request.d.ts +9 -0
- package/networking/request.mjs +16 -0
- package/networking/types.cjs +37 -0
- package/networking/types.d.ts +132 -0
- package/networking/types.mjs +35 -0
- package/networking.cjs +91 -0
- package/networking.mjs +33 -0
- package/package.json +1 -0
- package/reflection/injector.cjs +43 -0
- package/reflection/injector.d.ts +3 -0
- package/reflection/injector.mjs +40 -0
- package/socket.cjs +239 -0
- package/socket.d.ts +65 -0
- package/socket.mjs +237 -0
- package/store.cjs +12 -0
- package/store.mjs +3 -0
- package/stream/call.cjs +157 -0
- package/stream/call.d.ts +66 -0
- package/stream/call.mjs +154 -0
- package/stream/collector.cjs +217 -0
- package/stream/collector.d.ts +14 -0
- package/stream/collector.mjs +215 -0
- package/stream/index.d.ts +257 -0
- package/stream/observable.cjs +110 -0
- package/stream/observable.d.ts +65 -0
- package/stream/observable.mjs +106 -0
- package/stream/state.cjs +10 -0
- package/stream/state.d.ts +5 -0
- package/stream/state.mjs +8 -0
- package/stream.cjs +1153 -0
- package/stream.mjs +1132 -0
- package/synchronize.cjs +106 -0
- package/synchronize.d.ts +54 -0
- package/synchronize.mjs +103 -0
- package/typing/types.d.ts +24 -0
- package/typing.cjs +2 -0
- package/typing.mjs +1 -0
- package/utils/parser.cjs +37 -0
- package/utils/parser.d.ts +7 -0
- package/utils/parser.mjs +16 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Stream } from "../stream";
|
|
2
|
+
import { Future } from "../future";
|
|
3
|
+
/**
|
|
4
|
+
* Returns true if all elements of the stream match the predicate, false if there are any that don't.
|
|
5
|
+
*/
|
|
6
|
+
export declare const all: <T>(predicate: (v: T) => boolean | Future<boolean>, stream: Stream<T>) => Future<boolean>;
|
|
7
|
+
/**
|
|
8
|
+
* Returns a new stream containing the contents of the given stream, followed by the given element.
|
|
9
|
+
*/
|
|
10
|
+
export declare const append: <T>(value: T | Future<T>, stream: Stream<T>) => Stream<T>;
|
|
11
|
+
/**
|
|
12
|
+
* Returns a new stream with the given element at the front, followed by the contents of the stream.
|
|
13
|
+
*/
|
|
14
|
+
export declare const prepend: <T>(value: T | Future<T>, stream: Stream<T>) => Stream<T>;
|
|
15
|
+
/**
|
|
16
|
+
* Returns the result of concatenating the given streams.
|
|
17
|
+
*/
|
|
18
|
+
export declare const concat: <T>(value: Stream<T>, stream: Stream<T>) => Stream<T>;
|
|
19
|
+
export declare const head: <T>(stream: Stream<T>) => Future<T>;
|
|
20
|
+
export declare const tail: <T>(stream: Stream<T>) => Future<T>;
|
|
21
|
+
export declare const filter: <T>(predicate: (v: T) => boolean | Future<boolean>, stream: Stream<T>) => Stream<T>;
|
|
22
|
+
export declare const map: <T, V>(predicate: (v: T) => V | Future<V>, stream: Stream<T>) => Stream<import("../typing/types").InferStreamResult<V>>;
|
|
23
|
+
export declare const insert: <T>(index: number, value: T | Future<T>, stream: Stream<T>) => Stream<T>;
|
|
24
|
+
export declare const insertAll: <T>(index: number, value: Future<T>[] | Stream<T> | T[], stream: Stream<T>) => Stream<T>;
|
|
25
|
+
export declare const slice: <T>(start: number, end: number, stream: Stream<T>) => Stream<T>;
|
|
26
|
+
export declare const repeat: <T>(value: Future<T>, count: number) => Stream<T>;
|
|
27
|
+
export declare const join: (separator: string, stream: Stream<string>) => Future<string>;
|
|
28
|
+
export declare const without: <T>(value: T[] | Future<T[]>, stream: Stream<T>) => Stream<T> | Stream<Awaited<T>>;
|
|
29
|
+
export declare const repeatUntilSuccess: <T>(retries: number, waitPeriodInSeconds: number, backoffFactor: number, functor: () => Future<T>) => Future<T>;
|
|
30
|
+
export declare const range: (start: number, stop?: number | undefined, step?: number) => Stream<number>;
|
|
31
|
+
export declare const nth: <T>(index: number, stream: Stream<T>) => Future<T>;
|
package/functools.cjs
ADDED
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _tslib = require('./_virtual/_tslib.cjs');
|
|
4
|
+
var R = require('ramda');
|
|
5
|
+
var stream = require('./stream.cjs');
|
|
6
|
+
var future = require('./future/future.cjs');
|
|
7
|
+
var stream_collector = require('./stream/collector.cjs');
|
|
8
|
+
var FutureCancelled = require('./errors/FutureCancelled.cjs');
|
|
9
|
+
|
|
10
|
+
function _interopNamespaceDefault(e) {
|
|
11
|
+
var n = Object.create(null);
|
|
12
|
+
if (e) {
|
|
13
|
+
Object.keys(e).forEach(function (k) {
|
|
14
|
+
if (k !== 'default') {
|
|
15
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
16
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () { return e[k]; }
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
n.default = e;
|
|
24
|
+
return Object.freeze(n);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
var R__namespace = /*#__PURE__*/_interopNamespaceDefault(R);
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Returns true if all elements of the stream match the predicate, false if there are any that don't.
|
|
31
|
+
*/
|
|
32
|
+
const all = (predicate, stream) => stream
|
|
33
|
+
.map(predicate)
|
|
34
|
+
.skipWhile(R__namespace.equals(true))
|
|
35
|
+
.take(1)
|
|
36
|
+
.collect(stream_collector.Collectors.counting())
|
|
37
|
+
.thenApply(({ value }) => value === 0);
|
|
38
|
+
/**
|
|
39
|
+
* Returns a new stream containing the contents of the given stream, followed by the given element.
|
|
40
|
+
*/
|
|
41
|
+
const append = (value, stream$1) => {
|
|
42
|
+
return stream.Stream.of(function (signal) {
|
|
43
|
+
return _tslib.__asyncGenerator(this, arguments, function* () {
|
|
44
|
+
var _a, e_1, _b, _c;
|
|
45
|
+
stream$1.cancelOnSignal(signal);
|
|
46
|
+
try {
|
|
47
|
+
for (var _d = true, stream_1 = _tslib.__asyncValues(stream$1), stream_1_1; stream_1_1 = yield _tslib.__await(stream_1.next()), _a = stream_1_1.done, !_a;) {
|
|
48
|
+
_c = stream_1_1.value;
|
|
49
|
+
_d = false;
|
|
50
|
+
try {
|
|
51
|
+
const data = _c;
|
|
52
|
+
yield yield _tslib.__await(data);
|
|
53
|
+
}
|
|
54
|
+
finally {
|
|
55
|
+
_d = true;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
60
|
+
finally {
|
|
61
|
+
try {
|
|
62
|
+
if (!_d && !_a && (_b = stream_1.return)) yield _tslib.__await(_b.call(stream_1));
|
|
63
|
+
}
|
|
64
|
+
finally { if (e_1) throw e_1.error; }
|
|
65
|
+
}
|
|
66
|
+
if (value instanceof future.Future) {
|
|
67
|
+
yield yield _tslib.__await(yield _tslib.__await(value));
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
yield yield _tslib.__await(value);
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Returns a new stream with the given element at the front, followed by the contents of the stream.
|
|
77
|
+
*/
|
|
78
|
+
const prepend = (value, stream$1) => {
|
|
79
|
+
return stream.Stream.of(function (signal) {
|
|
80
|
+
return _tslib.__asyncGenerator(this, arguments, function* () {
|
|
81
|
+
var _a, e_2, _b, _c;
|
|
82
|
+
stream$1.cancelOnSignal(signal);
|
|
83
|
+
if (value instanceof future.Future) {
|
|
84
|
+
yield yield _tslib.__await(yield _tslib.__await(value));
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
yield yield _tslib.__await(value);
|
|
88
|
+
}
|
|
89
|
+
try {
|
|
90
|
+
for (var _d = true, stream_2 = _tslib.__asyncValues(stream$1), stream_2_1; stream_2_1 = yield _tslib.__await(stream_2.next()), _a = stream_2_1.done, !_a;) {
|
|
91
|
+
_c = stream_2_1.value;
|
|
92
|
+
_d = false;
|
|
93
|
+
try {
|
|
94
|
+
const data = _c;
|
|
95
|
+
yield yield _tslib.__await(data);
|
|
96
|
+
}
|
|
97
|
+
finally {
|
|
98
|
+
_d = true;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
103
|
+
finally {
|
|
104
|
+
try {
|
|
105
|
+
if (!_d && !_a && (_b = stream_2.return)) yield _tslib.__await(_b.call(stream_2));
|
|
106
|
+
}
|
|
107
|
+
finally { if (e_2) throw e_2.error; }
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* Returns the result of concatenating the given streams.
|
|
114
|
+
*/
|
|
115
|
+
const concat = (value, stream$1) => {
|
|
116
|
+
return stream.Stream.of(function (signal) {
|
|
117
|
+
return _tslib.__asyncGenerator(this, arguments, function* () {
|
|
118
|
+
var _a, e_3, _b, _c, _d, e_4, _e, _f;
|
|
119
|
+
value.cancelOnSignal(signal);
|
|
120
|
+
stream$1.cancelOnSignal(signal);
|
|
121
|
+
try {
|
|
122
|
+
for (var _g = true, value_1 = _tslib.__asyncValues(value), value_1_1; value_1_1 = yield _tslib.__await(value_1.next()), _a = value_1_1.done, !_a;) {
|
|
123
|
+
_c = value_1_1.value;
|
|
124
|
+
_g = false;
|
|
125
|
+
try {
|
|
126
|
+
const data = _c;
|
|
127
|
+
yield yield _tslib.__await(data);
|
|
128
|
+
}
|
|
129
|
+
finally {
|
|
130
|
+
_g = true;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
135
|
+
finally {
|
|
136
|
+
try {
|
|
137
|
+
if (!_g && !_a && (_b = value_1.return)) yield _tslib.__await(_b.call(value_1));
|
|
138
|
+
}
|
|
139
|
+
finally { if (e_3) throw e_3.error; }
|
|
140
|
+
}
|
|
141
|
+
try {
|
|
142
|
+
for (var _h = true, stream_3 = _tslib.__asyncValues(stream$1), stream_3_1; stream_3_1 = yield _tslib.__await(stream_3.next()), _d = stream_3_1.done, !_d;) {
|
|
143
|
+
_f = stream_3_1.value;
|
|
144
|
+
_h = false;
|
|
145
|
+
try {
|
|
146
|
+
const data = _f;
|
|
147
|
+
yield yield _tslib.__await(data);
|
|
148
|
+
}
|
|
149
|
+
finally {
|
|
150
|
+
_h = true;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
155
|
+
finally {
|
|
156
|
+
try {
|
|
157
|
+
if (!_h && !_d && (_e = stream_3.return)) yield _tslib.__await(_e.call(stream_3));
|
|
158
|
+
}
|
|
159
|
+
finally { if (e_4) throw e_4.error; }
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
};
|
|
164
|
+
const head = (stream) => stream.head().execute();
|
|
165
|
+
const tail = (stream) => stream.tail().execute();
|
|
166
|
+
const filter = (predicate, stream) => stream.filter(predicate);
|
|
167
|
+
const map = (predicate, stream) => stream.map(predicate);
|
|
168
|
+
const insert = (index, value, stream$1) => stream.Stream.of(function (signal) {
|
|
169
|
+
return _tslib.__asyncGenerator(this, arguments, function* () {
|
|
170
|
+
var _a, e_5, _b, _c;
|
|
171
|
+
stream$1.cancelOnSignal(signal);
|
|
172
|
+
let i = -1;
|
|
173
|
+
let inserted = false;
|
|
174
|
+
try {
|
|
175
|
+
for (var _d = true, stream_4 = _tslib.__asyncValues(stream$1), stream_4_1; stream_4_1 = yield _tslib.__await(stream_4.next()), _a = stream_4_1.done, !_a;) {
|
|
176
|
+
_c = stream_4_1.value;
|
|
177
|
+
_d = false;
|
|
178
|
+
try {
|
|
179
|
+
const data = _c;
|
|
180
|
+
if (!inserted) {
|
|
181
|
+
i++;
|
|
182
|
+
}
|
|
183
|
+
if (i === index) {
|
|
184
|
+
inserted = true;
|
|
185
|
+
if (value instanceof future.Future) {
|
|
186
|
+
yield yield _tslib.__await(yield _tslib.__await(value));
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
yield yield _tslib.__await(value);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
yield yield _tslib.__await(data);
|
|
193
|
+
}
|
|
194
|
+
finally {
|
|
195
|
+
_d = true;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
200
|
+
finally {
|
|
201
|
+
try {
|
|
202
|
+
if (!_d && !_a && (_b = stream_4.return)) yield _tslib.__await(_b.call(stream_4));
|
|
203
|
+
}
|
|
204
|
+
finally { if (e_5) throw e_5.error; }
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
const insertAll = (index, value, stream$1) => stream.Stream.of(function (signal) {
|
|
209
|
+
return _tslib.__asyncGenerator(this, arguments, function* () {
|
|
210
|
+
var _a, e_6, _b, _c, _d, e_7, _e, _f;
|
|
211
|
+
stream$1.cancelOnSignal(signal);
|
|
212
|
+
let i = -1;
|
|
213
|
+
let inserted = false;
|
|
214
|
+
try {
|
|
215
|
+
for (var _g = true, stream_5 = _tslib.__asyncValues(stream$1), stream_5_1; stream_5_1 = yield _tslib.__await(stream_5.next()), _a = stream_5_1.done, !_a;) {
|
|
216
|
+
_c = stream_5_1.value;
|
|
217
|
+
_g = false;
|
|
218
|
+
try {
|
|
219
|
+
const data = _c;
|
|
220
|
+
if (!inserted) {
|
|
221
|
+
i++;
|
|
222
|
+
}
|
|
223
|
+
if (i === index) {
|
|
224
|
+
inserted = true;
|
|
225
|
+
if (value instanceof stream.Stream) {
|
|
226
|
+
value.cancelOnSignal(signal);
|
|
227
|
+
try {
|
|
228
|
+
for (var _h = true, value_2 = (e_7 = void 0, _tslib.__asyncValues(value)), value_2_1; value_2_1 = yield _tslib.__await(value_2.next()), _d = value_2_1.done, !_d;) {
|
|
229
|
+
_f = value_2_1.value;
|
|
230
|
+
_h = false;
|
|
231
|
+
try {
|
|
232
|
+
const data = _f;
|
|
233
|
+
yield yield _tslib.__await(data);
|
|
234
|
+
}
|
|
235
|
+
finally {
|
|
236
|
+
_h = true;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
241
|
+
finally {
|
|
242
|
+
try {
|
|
243
|
+
if (!_h && !_d && (_e = value_2.return)) yield _tslib.__await(_e.call(value_2));
|
|
244
|
+
}
|
|
245
|
+
finally { if (e_7) throw e_7.error; }
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
else {
|
|
249
|
+
for (const data of value) {
|
|
250
|
+
if (data instanceof future.Future) {
|
|
251
|
+
yield yield _tslib.__await(yield _tslib.__await(data));
|
|
252
|
+
}
|
|
253
|
+
else {
|
|
254
|
+
yield yield _tslib.__await(data);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
yield yield _tslib.__await(data);
|
|
260
|
+
}
|
|
261
|
+
finally {
|
|
262
|
+
_g = true;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
267
|
+
finally {
|
|
268
|
+
try {
|
|
269
|
+
if (!_g && !_a && (_b = stream_5.return)) yield _tslib.__await(_b.call(stream_5));
|
|
270
|
+
}
|
|
271
|
+
finally { if (e_6) throw e_6.error; }
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
});
|
|
275
|
+
const slice = (start, end, stream) => stream.skip(start).take(end - start);
|
|
276
|
+
const repeat = (value, count) => stream.Stream.of(function (signal) {
|
|
277
|
+
return _tslib.__asyncGenerator(this, arguments, function* () {
|
|
278
|
+
const result = yield _tslib.__await(value.registerSignal(signal));
|
|
279
|
+
for (let i = 0; i < count; i++) {
|
|
280
|
+
yield yield _tslib.__await(result);
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
});
|
|
284
|
+
const join = (separator, stream) => {
|
|
285
|
+
let result = "";
|
|
286
|
+
return stream
|
|
287
|
+
.forEach((value) => {
|
|
288
|
+
result += value + separator;
|
|
289
|
+
})
|
|
290
|
+
.thenApply(() => {
|
|
291
|
+
if (result !== "") {
|
|
292
|
+
return result.substring(0, result.lastIndexOf(separator));
|
|
293
|
+
}
|
|
294
|
+
return result;
|
|
295
|
+
});
|
|
296
|
+
};
|
|
297
|
+
const without = (value, stream$1) => value instanceof future.Future
|
|
298
|
+
? stream.Stream.of(function (signal) {
|
|
299
|
+
return _tslib.__asyncGenerator(this, arguments, function* () {
|
|
300
|
+
var _a, e_8, _b, _c;
|
|
301
|
+
const result = yield _tslib.__await(value.registerSignal(signal));
|
|
302
|
+
try {
|
|
303
|
+
for (var _d = true, _e = _tslib.__asyncValues(stream$1.filter((v) => !result.includes(v))), _f; _f = yield _tslib.__await(_e.next()), _a = _f.done, !_a;) {
|
|
304
|
+
_c = _f.value;
|
|
305
|
+
_d = false;
|
|
306
|
+
try {
|
|
307
|
+
const v = _c;
|
|
308
|
+
yield yield _tslib.__await(v);
|
|
309
|
+
}
|
|
310
|
+
finally {
|
|
311
|
+
_d = true;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
316
|
+
finally {
|
|
317
|
+
try {
|
|
318
|
+
if (!_d && !_a && (_b = _e.return)) yield _tslib.__await(_b.call(_e));
|
|
319
|
+
}
|
|
320
|
+
finally { if (e_8) throw e_8.error; }
|
|
321
|
+
}
|
|
322
|
+
});
|
|
323
|
+
})
|
|
324
|
+
: stream$1.filter((v) => !value.includes(v));
|
|
325
|
+
const repeatUntilSuccess = (retries, waitPeriodInSeconds, backoffFactor, functor) => future.Future.of((_, __, signal) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
326
|
+
let lastError;
|
|
327
|
+
let i = 0;
|
|
328
|
+
let waitPeriod = waitPeriodInSeconds;
|
|
329
|
+
while (i < retries && !signal.aborted) {
|
|
330
|
+
try {
|
|
331
|
+
return yield functor().registerSignal(signal);
|
|
332
|
+
}
|
|
333
|
+
catch (e) {
|
|
334
|
+
lastError = e;
|
|
335
|
+
i++;
|
|
336
|
+
yield future.Future.sleep({ seconds: waitPeriod });
|
|
337
|
+
waitPeriod *= backoffFactor;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
throw lastError || new FutureCancelled.FutureCancelled();
|
|
341
|
+
}));
|
|
342
|
+
const range = (start, stop = undefined, step = 1) => stream.Stream.of(function (signal) {
|
|
343
|
+
return _tslib.__asyncGenerator(this, arguments, function* () {
|
|
344
|
+
const begin = stop === undefined ? 0 : start;
|
|
345
|
+
const end = stop !== null && stop !== void 0 ? stop : start;
|
|
346
|
+
for (let i = begin; i < end; i += step) {
|
|
347
|
+
if (signal.aborted)
|
|
348
|
+
break;
|
|
349
|
+
yield yield _tslib.__await(i);
|
|
350
|
+
}
|
|
351
|
+
});
|
|
352
|
+
});
|
|
353
|
+
const nth = (index, stream) => stream.skip(index).future;
|
|
354
|
+
|
|
355
|
+
exports.all = all;
|
|
356
|
+
exports.append = append;
|
|
357
|
+
exports.concat = concat;
|
|
358
|
+
exports.filter = filter;
|
|
359
|
+
exports.head = head;
|
|
360
|
+
exports.insert = insert;
|
|
361
|
+
exports.insertAll = insertAll;
|
|
362
|
+
exports.join = join;
|
|
363
|
+
exports.map = map;
|
|
364
|
+
exports.nth = nth;
|
|
365
|
+
exports.prepend = prepend;
|
|
366
|
+
exports.range = range;
|
|
367
|
+
exports.repeat = repeat;
|
|
368
|
+
exports.repeatUntilSuccess = repeatUntilSuccess;
|
|
369
|
+
exports.slice = slice;
|
|
370
|
+
exports.tail = tail;
|
|
371
|
+
exports.without = without;
|