brass-runtime 1.15.0 → 1.16.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/README.md +409 -137
- package/dist/agent/cli/main.cjs +40 -35
- package/dist/agent/cli/main.js +9 -4
- package/dist/agent/cli/main.mjs +9 -4
- package/dist/agent/index.cjs +8 -4
- package/dist/agent/index.d.ts +1 -1
- package/dist/agent/index.js +7 -3
- package/dist/agent/index.mjs +7 -3
- package/dist/{chunk-PPUXIH5R.js → chunk-2WC63LJK.mjs} +11 -7
- package/dist/chunk-3RG5ZIWI.js +10 -0
- package/dist/chunk-45F7OKGT.cjs +104 -0
- package/dist/chunk-5YOQOXEQ.cjs +2491 -0
- package/dist/{chunk-STVLQ3XD.cjs → chunk-7HUOJA4W.cjs} +78 -74
- package/dist/{chunk-BMH5AV44.js → chunk-7LVI2GIN.js} +251 -370
- package/dist/chunk-7TL2LHQJ.js +2491 -0
- package/dist/chunk-7V4KY4RL.mjs +104 -0
- package/dist/chunk-7XOPAB5Q.js +2143 -0
- package/dist/chunk-CCKHV5BT.mjs +193 -0
- package/dist/{chunk-AR22SXML.js → chunk-CY33PGEX.mjs} +488 -421
- package/dist/chunk-DJQ7OMMB.cjs +144 -0
- package/dist/chunk-F5EUMJL7.mjs +2143 -0
- package/dist/chunk-FM4W4QPL.js +193 -0
- package/dist/{chunk-TO7IKXYT.js → chunk-G3XGCZDQ.js} +1 -1
- package/dist/{chunk-BDF4AMWX.mjs → chunk-G6IQOE4P.mjs} +251 -370
- package/dist/chunk-GOV47PPB.mjs +552 -0
- package/dist/chunk-H55LI6WY.js +93 -0
- package/dist/chunk-IJT6RRQ5.cjs +93 -0
- package/dist/{chunk-ELOOF35R.mjs → chunk-J3H54ZRV.mjs} +1 -1
- package/dist/chunk-JF4XXPZ5.cjs +552 -0
- package/dist/chunk-JNFRRJYH.cjs +2143 -0
- package/dist/chunk-JX3LZQJH.cjs +354 -0
- package/dist/chunk-K2T3DV26.mjs +93 -0
- package/dist/chunk-KCPT2D6G.js +552 -0
- package/dist/chunk-MWXMNYJS.cjs +1110 -0
- package/dist/{chunk-VEZNF5GZ.cjs → chunk-N6VHMOWB.cjs} +130 -126
- package/dist/{chunk-3QMOKAS5.js → chunk-NC5SDRYE.js} +9 -5
- package/dist/chunk-NOYZIMUJ.mjs +144 -0
- package/dist/{chunk-R3R2FVLG.cjs → chunk-NYL4D7SK.cjs} +5 -5
- package/dist/chunk-OBGZSXTJ.cjs +10 -0
- package/dist/{chunk-4NHES7VK.mjs → chunk-OOGJ73B6.js} +11 -7
- package/dist/chunk-PNVFW245.js +144 -0
- package/dist/chunk-PRWCB3QL.mjs +2491 -0
- package/dist/{chunk-JFPU5GQI.mjs → chunk-QY5FKYEQ.js} +488 -421
- package/dist/chunk-ROJC3NBJ.js +104 -0
- package/dist/chunk-SPUEME2B.cjs +343 -0
- package/dist/chunk-TDVMADDN.js +343 -0
- package/dist/chunk-TVN5I4U6.cjs +193 -0
- package/dist/chunk-U5KWK3PX.mjs +343 -0
- package/dist/chunk-VFIUZG7J.mjs +354 -0
- package/dist/{chunk-TGIFUAK4.cjs → chunk-WQ5QNU5R.cjs} +459 -578
- package/dist/chunk-XDZOO4L5.js +354 -0
- package/dist/chunk-Y6FXYEAI.mjs +10 -0
- package/dist/{chunk-K6M7MDZ4.mjs → chunk-ZGLD4TVZ.mjs} +9 -5
- package/dist/client-CtFmoDvM.d.ts +645 -0
- package/dist/core/index.cjs +72 -4
- package/dist/core/index.d.ts +92 -198
- package/dist/core/index.js +106 -38
- package/dist/core/index.mjs +106 -38
- package/dist/{effect-CMOQKX8y.d.ts → effect-CGNl5Rqp.d.ts} +107 -1
- package/dist/effectRunner-3ZHAD3LE.cjs +8 -0
- package/dist/effectRunner-A4CHJXJI.js +8 -0
- package/dist/effectRunner-OPUF6QRN.mjs +8 -0
- package/dist/http/index.cjs +2189 -1271
- package/dist/http/index.d.ts +830 -270
- package/dist/http/index.js +2008 -1090
- package/dist/http/index.mjs +2008 -1090
- package/dist/http/testing.cjs +159 -0
- package/dist/http/testing.d.ts +42 -0
- package/dist/http/testing.js +159 -0
- package/dist/http/testing.mjs +159 -0
- package/dist/index.cjs +246 -178
- package/dist/index.d.ts +9 -35
- package/dist/index.js +120 -52
- package/dist/index.mjs +120 -52
- package/dist/observability/index.cjs +677 -0
- package/dist/observability/index.d.ts +79 -0
- package/dist/observability/index.js +677 -0
- package/dist/observability/index.mjs +677 -0
- package/dist/schedule-Fque9Abz.d.ts +70 -0
- package/dist/schema/index.cjs +25 -0
- package/dist/schema/index.d.ts +177 -0
- package/dist/schema/index.js +25 -0
- package/dist/schema/index.mjs +25 -0
- package/dist/server-C8hDXA74.d.ts +674 -0
- package/dist/{stream-FQm9h4Mg.d.ts → stream-dvSs0QS5.d.ts} +1 -1
- package/dist/tracer-B5tRH9H7.d.ts +230 -0
- package/dist/tracing-Dt9S_6V8.d.ts +148 -0
- package/package.json +27 -1
- package/dist/chunk-BDYEENHT.js +0 -224
- package/dist/chunk-MS34J5LY.cjs +0 -224
- package/dist/chunk-UMAZLXAB.mjs +0 -224
- package/dist/chunk-XPZNXSVN.cjs +0 -1043
- package/dist/tracing-DNT9jEbr.d.ts +0 -106
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkNYL4D7SKcjs = require('./chunk-NYL4D7SK.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
+
var _chunkTVN5I4U6cjs = require('./chunk-TVN5I4U6.cjs');
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
|
|
11
|
+
var _chunkWQ5QNU5Rcjs = require('./chunk-WQ5QNU5R.cjs');
|
|
10
12
|
|
|
11
13
|
|
|
12
14
|
|
|
@@ -24,10 +26,12 @@ var _chunkR3R2FVLGcjs = require('./chunk-R3R2FVLG.cjs');
|
|
|
24
26
|
|
|
25
27
|
|
|
26
28
|
|
|
27
|
-
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
var _chunkDJQ7OMMBcjs = require('./chunk-DJQ7OMMB.cjs');
|
|
28
32
|
|
|
29
33
|
// src/core/stream/stream.ts
|
|
30
|
-
var widenOpt = (opt) => opt._tag === "None" ?
|
|
34
|
+
var widenOpt = (opt) => opt._tag === "None" ? _chunkDJQ7OMMBcjs.none : _chunkDJQ7OMMBcjs.some.call(void 0, opt.value);
|
|
31
35
|
var fromPull = (pull) => ({
|
|
32
36
|
_tag: "FromPull",
|
|
33
37
|
pull
|
|
@@ -72,28 +76,28 @@ function streamToRaceWithHandler(winnerSide, leftStream, rightStream, flip, id)
|
|
|
72
76
|
const [a, tailWin] = exit.value;
|
|
73
77
|
otherFiber.interrupt();
|
|
74
78
|
const next = winnerSide === "L" ? fromPull(makeMergePull(tailWin, rightStream, !flip, id)) : fromPull(makeMergePull(leftStream, tailWin, !flip, id));
|
|
75
|
-
return
|
|
79
|
+
return _chunkDJQ7OMMBcjs.asyncSucceed.call(void 0, [a, next]);
|
|
76
80
|
}
|
|
77
81
|
if (exit.cause._tag === "Interrupt") {
|
|
78
|
-
return
|
|
79
|
-
cb(
|
|
82
|
+
return _chunkDJQ7OMMBcjs.asyncEffect.call(void 0, (_env, cb) => {
|
|
83
|
+
cb(_chunkDJQ7OMMBcjs.Exit.failCause(_chunkDJQ7OMMBcjs.Cause.interrupt()));
|
|
80
84
|
});
|
|
81
85
|
}
|
|
82
86
|
const opt = exit.cause.error;
|
|
83
87
|
if (opt._tag === "None") {
|
|
84
88
|
return winnerSide === "L" ? uncons(rightStream) : uncons(leftStream);
|
|
85
89
|
}
|
|
86
|
-
return
|
|
90
|
+
return _chunkDJQ7OMMBcjs.asyncFail.call(void 0, opt);
|
|
87
91
|
};
|
|
88
92
|
}
|
|
89
93
|
function makeMergePull(onLeft, onRight, flip, mergePullId) {
|
|
90
94
|
const id = ++mergePullId;
|
|
91
95
|
const onLeftHandler = streamToRaceWithHandler("L", onLeft, onRight, flip, id);
|
|
92
96
|
const onRightHandler = streamToRaceWithHandler("R", onLeft, onRight, flip, id);
|
|
93
|
-
return
|
|
94
|
-
const runtime =
|
|
95
|
-
const scope = new (0,
|
|
96
|
-
const handler =
|
|
97
|
+
return _chunkDJQ7OMMBcjs.asyncEffect.call(void 0, (_env, cb) => {
|
|
98
|
+
const runtime = _chunkWQ5QNU5Rcjs.unsafeGetCurrentRuntime.call(void 0, );
|
|
99
|
+
const scope = new (0, _chunkTVN5I4U6cjs.Scope)(runtime);
|
|
100
|
+
const handler = _chunkNYL4D7SKcjs.raceWith.call(void 0,
|
|
97
101
|
uncons(onLeft),
|
|
98
102
|
uncons(onRight),
|
|
99
103
|
scope,
|
|
@@ -112,33 +116,33 @@ function merge(left, right) {
|
|
|
112
116
|
function uncons(self) {
|
|
113
117
|
switch (self._tag) {
|
|
114
118
|
case "Empty":
|
|
115
|
-
return
|
|
119
|
+
return _chunkDJQ7OMMBcjs.fail.call(void 0, _chunkDJQ7OMMBcjs.none);
|
|
116
120
|
case "FromArray": {
|
|
117
121
|
const arr = self.values;
|
|
118
|
-
if (arr.length === 0) return
|
|
122
|
+
if (arr.length === 0) return _chunkDJQ7OMMBcjs.fail.call(void 0, _chunkDJQ7OMMBcjs.none);
|
|
119
123
|
const tail = arr.length === 1 ? EMPTY_STREAM : { _tag: "FromArray", values: arr.slice(1) };
|
|
120
|
-
return
|
|
124
|
+
return _chunkDJQ7OMMBcjs.succeed.call(void 0, [arr[0], tail]);
|
|
121
125
|
}
|
|
122
126
|
case "Emit":
|
|
123
|
-
return
|
|
124
|
-
|
|
127
|
+
return _chunkDJQ7OMMBcjs.map.call(void 0,
|
|
128
|
+
_chunkDJQ7OMMBcjs.mapError.call(void 0, self.value, (e) => _chunkDJQ7OMMBcjs.some.call(void 0, e)),
|
|
125
129
|
(a) => [a, EMPTY_STREAM]
|
|
126
130
|
);
|
|
127
131
|
case "FromPull":
|
|
128
132
|
return self.pull;
|
|
129
133
|
case "Concat":
|
|
130
|
-
return
|
|
131
|
-
|
|
134
|
+
return _chunkDJQ7OMMBcjs.orElseOptional.call(void 0,
|
|
135
|
+
_chunkDJQ7OMMBcjs.map.call(void 0,
|
|
132
136
|
uncons(self.left),
|
|
133
137
|
([a, tail]) => [a, concatStream(tail, self.right)]
|
|
134
138
|
),
|
|
135
139
|
() => uncons(self.right)
|
|
136
140
|
);
|
|
137
141
|
case "Flatten":
|
|
138
|
-
return
|
|
142
|
+
return _chunkDJQ7OMMBcjs.flatMap.call(void 0,
|
|
139
143
|
uncons(self.stream),
|
|
140
|
-
([head, tail]) =>
|
|
141
|
-
|
|
144
|
+
([head, tail]) => _chunkDJQ7OMMBcjs.orElseOptional.call(void 0,
|
|
145
|
+
_chunkDJQ7OMMBcjs.map.call(void 0,
|
|
142
146
|
uncons(head),
|
|
143
147
|
([a, as]) => [
|
|
144
148
|
a,
|
|
@@ -151,10 +155,10 @@ function uncons(self) {
|
|
|
151
155
|
case "Merge":
|
|
152
156
|
return makeMergePull(self.left, self.right, self.flip, 0);
|
|
153
157
|
case "Scoped":
|
|
154
|
-
return
|
|
155
|
-
const runtime =
|
|
156
|
-
const scope = new (0,
|
|
157
|
-
const fiber =
|
|
158
|
+
return _chunkDJQ7OMMBcjs.asyncEffect.call(void 0, (env, cb) => {
|
|
159
|
+
const runtime = _chunkWQ5QNU5Rcjs.unsafeGetCurrentRuntime.call(void 0, );
|
|
160
|
+
const scope = new (0, _chunkTVN5I4U6cjs.Scope)(runtime);
|
|
161
|
+
const fiber = _chunkWQ5QNU5Rcjs.getCurrentFiber.call(void 0, );
|
|
158
162
|
_optionalChain([fiber, 'optionalAccess', _2 => _2.addFinalizer, 'call', _3 => _3((exit) => {
|
|
159
163
|
try {
|
|
160
164
|
scope.close(exit);
|
|
@@ -172,18 +176,18 @@ function uncons(self) {
|
|
|
172
176
|
scope.close(exit);
|
|
173
177
|
};
|
|
174
178
|
const wrap = (s) => fromPull(
|
|
175
|
-
|
|
179
|
+
_chunkDJQ7OMMBcjs.asyncEffect.call(void 0, (env2, cb2) => {
|
|
176
180
|
const pull = uncons(s);
|
|
177
|
-
|
|
181
|
+
_chunkWQ5QNU5Rcjs.unsafeRunFoldWithEnv.call(void 0,
|
|
178
182
|
pull,
|
|
179
183
|
env2,
|
|
180
184
|
(cause) => {
|
|
181
|
-
const ex =
|
|
185
|
+
const ex = _chunkDJQ7OMMBcjs.Exit.failCause(cause);
|
|
182
186
|
closeWith(ex);
|
|
183
187
|
cb2(ex);
|
|
184
188
|
},
|
|
185
189
|
([a, tail]) => {
|
|
186
|
-
cb2(
|
|
190
|
+
cb2(_chunkDJQ7OMMBcjs.Exit.succeed([a, wrap(tail)]));
|
|
187
191
|
}
|
|
188
192
|
);
|
|
189
193
|
})
|
|
@@ -191,19 +195,19 @@ function uncons(self) {
|
|
|
191
195
|
scope.fork(self.acquire).join((ex) => {
|
|
192
196
|
if (ex._tag === "Failure") {
|
|
193
197
|
closeWith(ex);
|
|
194
|
-
cb({ _tag: "Failure", cause: { _tag: "Fail", error:
|
|
198
|
+
cb({ _tag: "Failure", cause: { _tag: "Fail", error: _chunkDJQ7OMMBcjs.some.call(void 0, ex.cause.error) } });
|
|
195
199
|
return;
|
|
196
200
|
}
|
|
197
201
|
scope.addFinalizer((exit) => self.release(exit));
|
|
198
202
|
const inner = ex.value;
|
|
199
|
-
|
|
203
|
+
_chunkWQ5QNU5Rcjs.unsafeGetCurrentRuntime.call(void 0, ).fork(uncons(wrap(inner))).join(cb);
|
|
200
204
|
});
|
|
201
205
|
});
|
|
202
206
|
case "Managed":
|
|
203
|
-
return
|
|
204
|
-
const runtime =
|
|
205
|
-
const scope = new (0,
|
|
206
|
-
_optionalChain([
|
|
207
|
+
return _chunkDJQ7OMMBcjs.asyncEffect.call(void 0, (env, cb) => {
|
|
208
|
+
const runtime = _chunkWQ5QNU5Rcjs.unsafeGetCurrentRuntime.call(void 0, );
|
|
209
|
+
const scope = new (0, _chunkTVN5I4U6cjs.Scope)(runtime);
|
|
210
|
+
_optionalChain([_chunkWQ5QNU5Rcjs.getCurrentFiber.call(void 0, ), 'optionalAccess', _4 => _4.addFinalizer, 'call', _5 => _5((exit) => {
|
|
207
211
|
try {
|
|
208
212
|
scope.close(exit);
|
|
209
213
|
} catch (e4) {
|
|
@@ -222,28 +226,28 @@ function uncons(self) {
|
|
|
222
226
|
scope.fork(self.acquire).join((ex) => {
|
|
223
227
|
if (ex._tag === "Failure") {
|
|
224
228
|
scope.close(ex);
|
|
225
|
-
cb({ _tag: "Failure", cause: { _tag: "Fail", error:
|
|
229
|
+
cb({ _tag: "Failure", cause: { _tag: "Fail", error: _chunkDJQ7OMMBcjs.some.call(void 0, ex.cause.error) } });
|
|
226
230
|
return;
|
|
227
231
|
}
|
|
228
232
|
const { stream: inner, release } = ex.value;
|
|
229
233
|
scope.addFinalizer((exit) => release(exit));
|
|
230
234
|
const wrap = (s) => fromPull(
|
|
231
|
-
|
|
232
|
-
|
|
235
|
+
_chunkDJQ7OMMBcjs.asyncEffect.call(void 0, (env2, cb2) => {
|
|
236
|
+
_chunkWQ5QNU5Rcjs.unsafeRunFoldWithEnv.call(void 0,
|
|
233
237
|
uncons(s),
|
|
234
238
|
env2,
|
|
235
239
|
(cause) => {
|
|
236
|
-
const ex2 =
|
|
240
|
+
const ex2 = _chunkDJQ7OMMBcjs.Exit.failCause(cause);
|
|
237
241
|
closeWith(ex2);
|
|
238
242
|
cb2(ex2);
|
|
239
243
|
},
|
|
240
244
|
([a, tail]) => {
|
|
241
|
-
cb2(
|
|
245
|
+
cb2(_chunkDJQ7OMMBcjs.Exit.succeed([a, wrap(tail)]));
|
|
242
246
|
}
|
|
243
247
|
);
|
|
244
248
|
})
|
|
245
249
|
);
|
|
246
|
-
|
|
250
|
+
_chunkWQ5QNU5Rcjs.unsafeGetCurrentRuntime.call(void 0, ).fork(uncons(wrap(inner))).join(cb);
|
|
247
251
|
});
|
|
248
252
|
});
|
|
249
253
|
}
|
|
@@ -258,10 +262,10 @@ function mapStream(self, f) {
|
|
|
258
262
|
case "FromArray":
|
|
259
263
|
return { _tag: "FromArray", values: self.values.map(f) };
|
|
260
264
|
case "Emit":
|
|
261
|
-
return emitStream(
|
|
265
|
+
return emitStream(_chunkDJQ7OMMBcjs.map.call(void 0, self.value, f));
|
|
262
266
|
case "FromPull":
|
|
263
267
|
return fromPull(
|
|
264
|
-
|
|
268
|
+
_chunkDJQ7OMMBcjs.map.call(void 0, self.pull, ([a, tail]) => [f(a), mapStream(tail, f)])
|
|
265
269
|
);
|
|
266
270
|
case "Concat":
|
|
267
271
|
return concatStream(mapStream(self.left, f), mapStream(self.right, f));
|
|
@@ -280,12 +284,12 @@ function mapStream(self, f) {
|
|
|
280
284
|
);
|
|
281
285
|
case "Scoped":
|
|
282
286
|
return unwrapScoped(
|
|
283
|
-
|
|
287
|
+
_chunkDJQ7OMMBcjs.map.call(void 0, self.acquire, (s) => mapStream(s, f)),
|
|
284
288
|
self.release
|
|
285
289
|
);
|
|
286
290
|
case "Managed":
|
|
287
291
|
return managedStream(
|
|
288
|
-
|
|
292
|
+
_chunkDJQ7OMMBcjs.map.call(void 0, self.acquire, ({ stream, release }) => ({
|
|
289
293
|
stream: mapStream(stream, f),
|
|
290
294
|
release
|
|
291
295
|
}))
|
|
@@ -296,19 +300,19 @@ function mapStream(self, f) {
|
|
|
296
300
|
}
|
|
297
301
|
function rangeStream(start, end) {
|
|
298
302
|
const go = (i) => fromPull(
|
|
299
|
-
i > end ?
|
|
303
|
+
i > end ? _chunkDJQ7OMMBcjs.asyncFail.call(void 0, _chunkDJQ7OMMBcjs.none) : _chunkDJQ7OMMBcjs.asyncSucceed.call(void 0, [i, go(i + 1)])
|
|
300
304
|
);
|
|
301
305
|
return go(start);
|
|
302
306
|
}
|
|
303
307
|
function zip(left, right) {
|
|
304
|
-
const pull =
|
|
305
|
-
|
|
308
|
+
const pull = _chunkDJQ7OMMBcjs.asyncFold.call(void 0,
|
|
309
|
+
_chunkDJQ7OMMBcjs.asyncMapError.call(void 0, uncons(left), (opt) => widenOpt(opt)),
|
|
306
310
|
// si left termina o falla, el zip termina/falla igual
|
|
307
|
-
(opt) =>
|
|
308
|
-
([a, tailL]) =>
|
|
309
|
-
|
|
310
|
-
(opt) =>
|
|
311
|
-
([b, tailR]) =>
|
|
311
|
+
(opt) => _chunkDJQ7OMMBcjs.asyncFail.call(void 0, opt),
|
|
312
|
+
([a, tailL]) => _chunkDJQ7OMMBcjs.asyncFold.call(void 0,
|
|
313
|
+
_chunkDJQ7OMMBcjs.asyncMapError.call(void 0, uncons(right), (opt) => widenOpt(opt)),
|
|
314
|
+
(opt) => _chunkDJQ7OMMBcjs.asyncFail.call(void 0, opt),
|
|
315
|
+
([b, tailR]) => _chunkDJQ7OMMBcjs.asyncSucceed.call(void 0, [
|
|
312
316
|
[a, b],
|
|
313
317
|
zip(tailL, tailR)
|
|
314
318
|
])
|
|
@@ -317,26 +321,26 @@ function zip(left, right) {
|
|
|
317
321
|
return fromPull(pull);
|
|
318
322
|
}
|
|
319
323
|
function foreachStream(stream, f) {
|
|
320
|
-
const loop = (cur) =>
|
|
324
|
+
const loop = (cur) => _chunkDJQ7OMMBcjs.asyncFold.call(void 0,
|
|
321
325
|
// uncons: Option<E> -> Option<E|E2>
|
|
322
|
-
|
|
326
|
+
_chunkDJQ7OMMBcjs.asyncMapError.call(void 0, uncons(cur), (opt) => widenOpt(opt)),
|
|
323
327
|
(opt) => {
|
|
324
|
-
if (opt._tag === "None") return
|
|
325
|
-
return
|
|
328
|
+
if (opt._tag === "None") return _chunkDJQ7OMMBcjs.asyncSucceed.call(void 0, void 0);
|
|
329
|
+
return _chunkDJQ7OMMBcjs.asyncFail.call(void 0, opt);
|
|
326
330
|
},
|
|
327
|
-
([a, tail]) =>
|
|
331
|
+
([a, tail]) => _chunkDJQ7OMMBcjs.asyncFlatMap.call(void 0,
|
|
328
332
|
// f(a): E2 -> Option<E|E2>
|
|
329
|
-
|
|
333
|
+
_chunkDJQ7OMMBcjs.asyncMapError.call(void 0, f(a), (e2) => _chunkDJQ7OMMBcjs.some.call(void 0, e2)),
|
|
330
334
|
() => loop(tail)
|
|
331
335
|
)
|
|
332
336
|
);
|
|
333
|
-
return
|
|
337
|
+
return _chunkDJQ7OMMBcjs.asyncFold.call(void 0,
|
|
334
338
|
loop(stream),
|
|
335
339
|
(opt) => {
|
|
336
|
-
if (opt._tag === "None") return
|
|
337
|
-
return
|
|
340
|
+
if (opt._tag === "None") return _chunkDJQ7OMMBcjs.asyncSucceed.call(void 0, void 0);
|
|
341
|
+
return _chunkDJQ7OMMBcjs.asyncFail.call(void 0, opt.value);
|
|
338
342
|
},
|
|
339
|
-
() =>
|
|
343
|
+
() => _chunkDJQ7OMMBcjs.asyncSucceed.call(void 0, void 0)
|
|
340
344
|
);
|
|
341
345
|
}
|
|
342
346
|
function fromArray(values) {
|
|
@@ -346,20 +350,20 @@ function fromArray(values) {
|
|
|
346
350
|
function collectStream(stream) {
|
|
347
351
|
const syncResult = drainStreamSyncFull(stream);
|
|
348
352
|
if (syncResult !== null) {
|
|
349
|
-
return
|
|
353
|
+
return _chunkDJQ7OMMBcjs.asyncSucceed.call(void 0, syncResult);
|
|
350
354
|
}
|
|
351
|
-
const loop = (cur, acc) =>
|
|
355
|
+
const loop = (cur, acc) => _chunkDJQ7OMMBcjs.asyncFold.call(void 0,
|
|
352
356
|
uncons(cur),
|
|
353
357
|
(opt) => {
|
|
354
|
-
if (opt._tag === "None") return
|
|
355
|
-
return
|
|
358
|
+
if (opt._tag === "None") return _chunkDJQ7OMMBcjs.succeed.call(void 0, acc);
|
|
359
|
+
return _chunkDJQ7OMMBcjs.fail.call(void 0, opt);
|
|
356
360
|
},
|
|
357
361
|
([a, tail]) => {
|
|
358
362
|
acc.push(a);
|
|
359
363
|
return loop(tail, acc);
|
|
360
364
|
}
|
|
361
365
|
);
|
|
362
|
-
return
|
|
366
|
+
return _chunkDJQ7OMMBcjs.mapError.call(void 0, loop(stream, []), (opt) => {
|
|
363
367
|
if (opt._tag === "Some") return opt.value;
|
|
364
368
|
throw new Error("unreachable: stream end handled as success");
|
|
365
369
|
});
|
|
@@ -401,7 +405,7 @@ function drainStreamSyncFull(stream) {
|
|
|
401
405
|
}
|
|
402
406
|
}
|
|
403
407
|
function readerStream(reader, normalizeError, signal) {
|
|
404
|
-
const pull =
|
|
408
|
+
const pull = _chunkDJQ7OMMBcjs.asyncEffect.call(void 0, (_, cb) => {
|
|
405
409
|
let done = false;
|
|
406
410
|
const cleanup = () => _optionalChain([signal, 'optionalAccess', _6 => _6.removeEventListener, 'call', _7 => _7("abort", abort)]);
|
|
407
411
|
const finish = (exit) => {
|
|
@@ -416,7 +420,7 @@ function readerStream(reader, normalizeError, signal) {
|
|
|
416
420
|
} catch (e5) {
|
|
417
421
|
}
|
|
418
422
|
const error = typeof DOMException === "function" ? new DOMException("aborted", "AbortError") : new Error("aborted");
|
|
419
|
-
finish({ _tag: "Failure", cause: { _tag: "Fail", error:
|
|
423
|
+
finish({ _tag: "Failure", cause: { _tag: "Fail", error: _chunkDJQ7OMMBcjs.some.call(void 0, normalizeError(error)) } });
|
|
420
424
|
};
|
|
421
425
|
if (_optionalChain([signal, 'optionalAccess', _8 => _8.aborted])) {
|
|
422
426
|
abort();
|
|
@@ -425,7 +429,7 @@ function readerStream(reader, normalizeError, signal) {
|
|
|
425
429
|
_optionalChain([signal, 'optionalAccess', _9 => _9.addEventListener, 'call', _10 => _10("abort", abort, { once: true })]);
|
|
426
430
|
reader.read().then(({ done: done2, value }) => {
|
|
427
431
|
if (done2) {
|
|
428
|
-
finish({ _tag: "Failure", cause: { _tag: "Fail", error:
|
|
432
|
+
finish({ _tag: "Failure", cause: { _tag: "Fail", error: _chunkDJQ7OMMBcjs.none } });
|
|
429
433
|
return;
|
|
430
434
|
}
|
|
431
435
|
finish({
|
|
@@ -433,7 +437,7 @@ function readerStream(reader, normalizeError, signal) {
|
|
|
433
437
|
value: [value, fromPull(pull)]
|
|
434
438
|
});
|
|
435
439
|
}).catch((e) => {
|
|
436
|
-
finish({ _tag: "Failure", cause: { _tag: "Fail", error:
|
|
440
|
+
finish({ _tag: "Failure", cause: { _tag: "Fail", error: _chunkDJQ7OMMBcjs.some.call(void 0, normalizeError(e)) } });
|
|
437
441
|
});
|
|
438
442
|
return () => {
|
|
439
443
|
cleanup();
|
|
@@ -450,12 +454,12 @@ function streamFromReadableStream(body, normalizeError, options = {}) {
|
|
|
450
454
|
let reader;
|
|
451
455
|
return unwrapScoped(
|
|
452
456
|
// acquire: produce un ZStream
|
|
453
|
-
|
|
457
|
+
_chunkDJQ7OMMBcjs.sync.call(void 0, () => {
|
|
454
458
|
reader = body.getReader();
|
|
455
459
|
return readerStream(reader, normalizeError, options.signal);
|
|
456
460
|
}),
|
|
457
461
|
// release: se corre en fin / error / interrupción
|
|
458
|
-
() =>
|
|
462
|
+
() => _chunkDJQ7OMMBcjs.asyncSync.call(void 0, () => {
|
|
459
463
|
try {
|
|
460
464
|
_optionalChain([reader, 'optionalAccess', _11 => _11.cancel, 'call', _12 => _12()]);
|
|
461
465
|
} catch (e7) {
|