brass-runtime 1.14.0 → 1.15.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 +6 -3
- package/dist/agent/cli/main.cjs +44 -43
- package/dist/agent/cli/main.js +5 -4
- package/dist/agent/cli/main.mjs +5 -4
- package/dist/agent/index.cjs +4 -3
- package/dist/agent/index.d.ts +1 -1
- package/dist/agent/index.js +3 -2
- package/dist/agent/index.mjs +3 -2
- package/dist/{chunk-WJESVBWN.js → chunk-3QMOKAS5.js} +9 -7
- package/dist/{chunk-BMRF4FN6.js → chunk-4NHES7VK.mjs} +59 -237
- package/dist/chunk-AR22SXML.js +1043 -0
- package/dist/{chunk-4N2JEK4H.mjs → chunk-BDF4AMWX.mjs} +27 -151
- package/dist/chunk-BDYEENHT.js +224 -0
- package/dist/{chunk-JT7D6M5H.js → chunk-BMH5AV44.js} +27 -151
- package/dist/chunk-ELOOF35R.mjs +131 -0
- package/dist/chunk-JFPU5GQI.mjs +1043 -0
- package/dist/{chunk-MQF7HZ7Y.mjs → chunk-K6M7MDZ4.mjs} +9 -7
- package/dist/chunk-MS34J5LY.cjs +224 -0
- package/dist/{chunk-UWMMYKVK.mjs → chunk-PPUXIH5R.js} +59 -237
- package/dist/chunk-R3R2FVLG.cjs +131 -0
- package/dist/chunk-STVLQ3XD.cjs +489 -0
- package/dist/{chunk-BKBFSOGT.cjs → chunk-TGIFUAK4.cjs} +26 -150
- package/dist/chunk-TO7IKXYT.js +131 -0
- package/dist/chunk-UMAZLXAB.mjs +224 -0
- package/dist/{chunk-XTMZTVIT.cjs → chunk-VEZNF5GZ.cjs} +136 -134
- package/dist/chunk-XPZNXSVN.cjs +1043 -0
- package/dist/core/index.cjs +216 -0
- package/dist/core/index.d.ts +673 -0
- package/dist/core/index.js +216 -0
- package/dist/core/index.mjs +216 -0
- package/dist/{effect-DM56H743.d.ts → effect-CMOQKX8y.d.ts} +12 -11
- package/dist/http/index.cjs +2557 -235
- package/dist/http/index.d.ts +1514 -4
- package/dist/http/index.js +2549 -227
- package/dist/http/index.mjs +2549 -227
- package/dist/index.cjs +237 -1168
- package/dist/index.d.ts +7 -673
- package/dist/index.js +77 -1008
- package/dist/index.mjs +77 -1008
- package/dist/stream-FQm9h4Mg.d.ts +74 -0
- package/dist/tracing-DNT9jEbr.d.ts +106 -0
- package/package.json +11 -3
- package/dist/chunk-SKVY72E5.cjs +0 -667
- package/dist/stream-Oqe6WeLE.d.ts +0 -173
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
2
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
|
+
}) : x)(function(x) {
|
|
4
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
5
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
6
|
+
});
|
|
7
|
+
|
|
1
8
|
// src/core/types/asyncEffect.ts
|
|
2
9
|
var Async = {
|
|
3
10
|
succeed: (value) => ({ _tag: "Succeed", value }),
|
|
@@ -6,21 +13,18 @@ var Async = {
|
|
|
6
13
|
async: (register) => ({ _tag: "Async", register })
|
|
7
14
|
};
|
|
8
15
|
function asyncFold(fa, onFailure, onSuccess) {
|
|
9
|
-
return {
|
|
16
|
+
return {
|
|
17
|
+
_tag: "Fold",
|
|
18
|
+
first: fa,
|
|
19
|
+
onFailure,
|
|
20
|
+
onSuccess
|
|
21
|
+
};
|
|
10
22
|
}
|
|
11
23
|
function asyncCatchAll(fa, handler) {
|
|
12
|
-
return asyncFold(
|
|
13
|
-
fa,
|
|
14
|
-
(e) => handler(e),
|
|
15
|
-
(a) => asyncSucceed(a)
|
|
16
|
-
);
|
|
24
|
+
return asyncFold(fa, handler, asyncSucceed);
|
|
17
25
|
}
|
|
18
26
|
function asyncMapError(fa, f) {
|
|
19
|
-
return asyncFold(
|
|
20
|
-
fa,
|
|
21
|
-
(e) => asyncFail(f(e)),
|
|
22
|
-
(a) => asyncSucceed(a)
|
|
23
|
-
);
|
|
27
|
+
return asyncFold(fa, (e) => asyncFail(f(e)), asyncSucceed);
|
|
24
28
|
}
|
|
25
29
|
var SUCCEED_UNDEFINED = { _tag: "Succeed", value: void 0 };
|
|
26
30
|
var SUCCEED_TRUE = { _tag: "Succeed", value: true };
|
|
@@ -43,7 +47,7 @@ var asyncSync = (thunk) => ({
|
|
|
43
47
|
thunk
|
|
44
48
|
});
|
|
45
49
|
var asyncTotal = (thunk) => asyncSync(() => thunk());
|
|
46
|
-
var
|
|
50
|
+
var asyncEffect = (register) => ({
|
|
47
51
|
_tag: "Async",
|
|
48
52
|
register
|
|
49
53
|
});
|
|
@@ -64,7 +68,7 @@ function acquireRelease(acquire, release, scope) {
|
|
|
64
68
|
});
|
|
65
69
|
}
|
|
66
70
|
function asyncInterruptible(register) {
|
|
67
|
-
return
|
|
71
|
+
return asyncEffect(register);
|
|
68
72
|
}
|
|
69
73
|
var withAsyncPromise = (run) => (eff) => {
|
|
70
74
|
const anyEff = eff;
|
|
@@ -101,18 +105,14 @@ var succeed = (value) => asyncSucceed(value);
|
|
|
101
105
|
var fail = (error) => asyncFail(error);
|
|
102
106
|
var sync = (thunk) => asyncSync((env) => thunk(env));
|
|
103
107
|
var map = (fa, f) => asyncMap(fa, f);
|
|
104
|
-
var flatMap = (fa, f) => asyncFlatMap(fa,
|
|
108
|
+
var flatMap = (fa, f) => asyncFlatMap(fa, f);
|
|
105
109
|
var mapError = (fa, f) => asyncMapError(fa, f);
|
|
106
|
-
var catchAll = (fa, handler) => asyncFold(
|
|
107
|
-
fa,
|
|
108
|
-
(e) => handler(e),
|
|
109
|
-
(a) => asyncSucceed(a)
|
|
110
|
-
);
|
|
110
|
+
var catchAll = (fa, handler) => asyncFold(fa, handler, asyncSucceed);
|
|
111
111
|
function orElseOptional(fa, that) {
|
|
112
112
|
return asyncFold(
|
|
113
113
|
fa,
|
|
114
114
|
(opt) => opt._tag === "Some" ? asyncFail(opt) : that(),
|
|
115
|
-
|
|
115
|
+
asyncSucceed
|
|
116
116
|
);
|
|
117
117
|
}
|
|
118
118
|
var end = () => fail(none);
|
|
@@ -2797,7 +2797,7 @@ var Runtime = class _Runtime {
|
|
|
2797
2797
|
});
|
|
2798
2798
|
}
|
|
2799
2799
|
delay(ms, eff) {
|
|
2800
|
-
return
|
|
2800
|
+
return asyncEffect((_env, cb) => {
|
|
2801
2801
|
const handle = setTimeout(() => {
|
|
2802
2802
|
this.unsafeRunAsync(eff, cb);
|
|
2803
2803
|
}, ms);
|
|
@@ -3517,7 +3517,7 @@ var JsFiberEngine = class {
|
|
|
3517
3517
|
// src/core/runtime/scope.ts
|
|
3518
3518
|
var nextScopeId = 1;
|
|
3519
3519
|
function awaitAll(fibers) {
|
|
3520
|
-
return
|
|
3520
|
+
return asyncEffect((_env, cb) => {
|
|
3521
3521
|
let remaining = fibers.length;
|
|
3522
3522
|
if (remaining === 0) {
|
|
3523
3523
|
cb({ _tag: "Success", value: void 0 });
|
|
@@ -3628,7 +3628,7 @@ var Scope = class _Scope {
|
|
|
3628
3628
|
closeAsync(exit = { _tag: "Success", value: void 0 }, opts = { awaitChildren: true }) {
|
|
3629
3629
|
return asyncFlatMap(
|
|
3630
3630
|
unit(),
|
|
3631
|
-
() =>
|
|
3631
|
+
() => asyncEffect((env, cb) => {
|
|
3632
3632
|
if (this.closed) {
|
|
3633
3633
|
cb({ _tag: "Success", value: void 0 });
|
|
3634
3634
|
return;
|
|
@@ -3663,7 +3663,7 @@ var Scope = class _Scope {
|
|
|
3663
3663
|
}
|
|
3664
3664
|
};
|
|
3665
3665
|
function withScopeAsync(runtime, f) {
|
|
3666
|
-
return
|
|
3666
|
+
return asyncEffect((_env, cb) => {
|
|
3667
3667
|
const scope = new Scope(runtime);
|
|
3668
3668
|
let done = false;
|
|
3669
3669
|
const completeAfterClose = (exit) => {
|
|
@@ -3690,128 +3690,8 @@ function withScope(runtime, f) {
|
|
|
3690
3690
|
});
|
|
3691
3691
|
}
|
|
3692
3692
|
|
|
3693
|
-
// src/core/stream/structuredConcurrency.ts
|
|
3694
|
-
function race(left, right, parentScope) {
|
|
3695
|
-
return async((env, cb) => {
|
|
3696
|
-
const scope = parentScope.subScope();
|
|
3697
|
-
let done = false;
|
|
3698
|
-
const onResult = (exit) => {
|
|
3699
|
-
if (done) return;
|
|
3700
|
-
done = true;
|
|
3701
|
-
scope.close(exit);
|
|
3702
|
-
cb(exit);
|
|
3703
|
-
};
|
|
3704
|
-
const fiberLeft = scope.fork(left);
|
|
3705
|
-
const fiberRight = scope.fork(right);
|
|
3706
|
-
fiberLeft.join(onResult);
|
|
3707
|
-
fiberRight.join(onResult);
|
|
3708
|
-
});
|
|
3709
|
-
}
|
|
3710
|
-
function zipPar(left, right, parentScope) {
|
|
3711
|
-
return async((env, cb) => {
|
|
3712
|
-
const scope = parentScope.subScope();
|
|
3713
|
-
let leftExit = null;
|
|
3714
|
-
let rightExit = null;
|
|
3715
|
-
let done = false;
|
|
3716
|
-
const checkDone = () => {
|
|
3717
|
-
if (!leftExit || !rightExit || done) return;
|
|
3718
|
-
done = true;
|
|
3719
|
-
if (leftExit._tag === "Success" && rightExit._tag === "Success") {
|
|
3720
|
-
scope.close({ _tag: "Success", value: void 0 });
|
|
3721
|
-
cb({
|
|
3722
|
-
_tag: "Success",
|
|
3723
|
-
value: [leftExit.value, rightExit.value]
|
|
3724
|
-
});
|
|
3725
|
-
return;
|
|
3726
|
-
}
|
|
3727
|
-
let cause;
|
|
3728
|
-
if (leftExit._tag === "Failure") {
|
|
3729
|
-
cause = leftExit.cause;
|
|
3730
|
-
} else if (rightExit._tag === "Failure") {
|
|
3731
|
-
cause = rightExit.cause;
|
|
3732
|
-
} else {
|
|
3733
|
-
throw new Error("zipPar: unreachable state (no Failure exit)");
|
|
3734
|
-
}
|
|
3735
|
-
const errExit = {
|
|
3736
|
-
_tag: "Failure",
|
|
3737
|
-
cause
|
|
3738
|
-
};
|
|
3739
|
-
scope.close(errExit);
|
|
3740
|
-
cb(errExit);
|
|
3741
|
-
};
|
|
3742
|
-
const f1 = scope.fork(left);
|
|
3743
|
-
const f2 = scope.fork(right);
|
|
3744
|
-
f1.join((exit) => {
|
|
3745
|
-
leftExit = exit;
|
|
3746
|
-
checkDone();
|
|
3747
|
-
});
|
|
3748
|
-
f2.join((exit) => {
|
|
3749
|
-
rightExit = exit;
|
|
3750
|
-
checkDone();
|
|
3751
|
-
});
|
|
3752
|
-
});
|
|
3753
|
-
}
|
|
3754
|
-
function collectAllPar(effects, parentScope) {
|
|
3755
|
-
return async((env, cb) => {
|
|
3756
|
-
const scope = parentScope.subScope();
|
|
3757
|
-
const results = new Array(effects.length);
|
|
3758
|
-
let completed = 0;
|
|
3759
|
-
let done = false;
|
|
3760
|
-
effects.forEach((eff, i) => {
|
|
3761
|
-
const f = scope.fork(eff);
|
|
3762
|
-
f.join((exit) => {
|
|
3763
|
-
if (done) return;
|
|
3764
|
-
if (exit._tag === "Failure") {
|
|
3765
|
-
done = true;
|
|
3766
|
-
const errExit = {
|
|
3767
|
-
_tag: "Failure",
|
|
3768
|
-
cause: exit.cause
|
|
3769
|
-
};
|
|
3770
|
-
scope.close(errExit);
|
|
3771
|
-
cb(errExit);
|
|
3772
|
-
return;
|
|
3773
|
-
}
|
|
3774
|
-
results[i] = exit.value;
|
|
3775
|
-
completed++;
|
|
3776
|
-
if (completed === effects.length) {
|
|
3777
|
-
done = true;
|
|
3778
|
-
const successExit = {
|
|
3779
|
-
_tag: "Success",
|
|
3780
|
-
value: results
|
|
3781
|
-
};
|
|
3782
|
-
scope.close({ _tag: "Success", value: void 0 });
|
|
3783
|
-
cb(successExit);
|
|
3784
|
-
}
|
|
3785
|
-
});
|
|
3786
|
-
});
|
|
3787
|
-
});
|
|
3788
|
-
}
|
|
3789
|
-
function raceWith(left, right, parentScope, onLeft, onRight) {
|
|
3790
|
-
return async((env, cb) => {
|
|
3791
|
-
const scope = parentScope.subScope();
|
|
3792
|
-
let done = false;
|
|
3793
|
-
const fiberLeft = scope.fork(left);
|
|
3794
|
-
const fiberRight = scope.fork(right);
|
|
3795
|
-
const finish = (next) => {
|
|
3796
|
-
scope.fork(next).join((exitNext) => {
|
|
3797
|
-
scope.close(exitNext);
|
|
3798
|
-
cb(exitNext);
|
|
3799
|
-
});
|
|
3800
|
-
};
|
|
3801
|
-
fiberLeft.join((exitL) => {
|
|
3802
|
-
if (done) return;
|
|
3803
|
-
done = true;
|
|
3804
|
-
finish(onLeft(exitL, fiberRight, scope));
|
|
3805
|
-
});
|
|
3806
|
-
fiberRight.join((exitR) => {
|
|
3807
|
-
if (done) return;
|
|
3808
|
-
done = true;
|
|
3809
|
-
finish(onRight(exitR, fiberLeft, scope));
|
|
3810
|
-
});
|
|
3811
|
-
});
|
|
3812
|
-
}
|
|
3813
|
-
|
|
3814
3693
|
export {
|
|
3694
|
+
__require,
|
|
3815
3695
|
Async,
|
|
3816
3696
|
asyncFold,
|
|
3817
3697
|
asyncCatchAll,
|
|
@@ -3821,7 +3701,7 @@ export {
|
|
|
3821
3701
|
asyncFail,
|
|
3822
3702
|
asyncSync,
|
|
3823
3703
|
asyncTotal,
|
|
3824
|
-
|
|
3704
|
+
asyncEffect,
|
|
3825
3705
|
asyncMap,
|
|
3826
3706
|
asyncFlatMap,
|
|
3827
3707
|
acquireRelease,
|
|
@@ -3889,9 +3769,5 @@ export {
|
|
|
3889
3769
|
withCurrentFiber,
|
|
3890
3770
|
Scope,
|
|
3891
3771
|
withScopeAsync,
|
|
3892
|
-
withScope
|
|
3893
|
-
race,
|
|
3894
|
-
zipPar,
|
|
3895
|
-
collectAllPar,
|
|
3896
|
-
raceWith
|
|
3772
|
+
withScope
|
|
3897
3773
|
};
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import {
|
|
2
|
+
asyncEffect
|
|
3
|
+
} from "./chunk-BDF4AMWX.mjs";
|
|
4
|
+
|
|
5
|
+
// src/core/stream/structuredConcurrency.ts
|
|
6
|
+
function race(left, right, parentScope) {
|
|
7
|
+
return asyncEffect((env, cb) => {
|
|
8
|
+
const scope = parentScope.subScope();
|
|
9
|
+
let done = false;
|
|
10
|
+
const onResult = (exit) => {
|
|
11
|
+
if (done) return;
|
|
12
|
+
done = true;
|
|
13
|
+
scope.close(exit);
|
|
14
|
+
cb(exit);
|
|
15
|
+
};
|
|
16
|
+
const fiberLeft = scope.fork(left);
|
|
17
|
+
const fiberRight = scope.fork(right);
|
|
18
|
+
fiberLeft.join(onResult);
|
|
19
|
+
fiberRight.join(onResult);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
function zipPar(left, right, parentScope) {
|
|
23
|
+
return asyncEffect((env, cb) => {
|
|
24
|
+
const scope = parentScope.subScope();
|
|
25
|
+
let leftExit = null;
|
|
26
|
+
let rightExit = null;
|
|
27
|
+
let done = false;
|
|
28
|
+
const checkDone = () => {
|
|
29
|
+
if (!leftExit || !rightExit || done) return;
|
|
30
|
+
done = true;
|
|
31
|
+
if (leftExit._tag === "Success" && rightExit._tag === "Success") {
|
|
32
|
+
scope.close({ _tag: "Success", value: void 0 });
|
|
33
|
+
cb({
|
|
34
|
+
_tag: "Success",
|
|
35
|
+
value: [leftExit.value, rightExit.value]
|
|
36
|
+
});
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
let cause;
|
|
40
|
+
if (leftExit._tag === "Failure") {
|
|
41
|
+
cause = leftExit.cause;
|
|
42
|
+
} else if (rightExit._tag === "Failure") {
|
|
43
|
+
cause = rightExit.cause;
|
|
44
|
+
} else {
|
|
45
|
+
throw new Error("zipPar: unreachable state (no Failure exit)");
|
|
46
|
+
}
|
|
47
|
+
const errExit = {
|
|
48
|
+
_tag: "Failure",
|
|
49
|
+
cause
|
|
50
|
+
};
|
|
51
|
+
scope.close(errExit);
|
|
52
|
+
cb(errExit);
|
|
53
|
+
};
|
|
54
|
+
const f1 = scope.fork(left);
|
|
55
|
+
const f2 = scope.fork(right);
|
|
56
|
+
f1.join((exit) => {
|
|
57
|
+
leftExit = exit;
|
|
58
|
+
checkDone();
|
|
59
|
+
});
|
|
60
|
+
f2.join((exit) => {
|
|
61
|
+
rightExit = exit;
|
|
62
|
+
checkDone();
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
function collectAllPar(effects, parentScope) {
|
|
67
|
+
return asyncEffect((env, cb) => {
|
|
68
|
+
const scope = parentScope.subScope();
|
|
69
|
+
const results = new Array(effects.length);
|
|
70
|
+
let completed = 0;
|
|
71
|
+
let done = false;
|
|
72
|
+
effects.forEach((eff, i) => {
|
|
73
|
+
const f = scope.fork(eff);
|
|
74
|
+
f.join((exit) => {
|
|
75
|
+
if (done) return;
|
|
76
|
+
if (exit._tag === "Failure") {
|
|
77
|
+
done = true;
|
|
78
|
+
const errExit = {
|
|
79
|
+
_tag: "Failure",
|
|
80
|
+
cause: exit.cause
|
|
81
|
+
};
|
|
82
|
+
scope.close(errExit);
|
|
83
|
+
cb(errExit);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
results[i] = exit.value;
|
|
87
|
+
completed++;
|
|
88
|
+
if (completed === effects.length) {
|
|
89
|
+
done = true;
|
|
90
|
+
const successExit = {
|
|
91
|
+
_tag: "Success",
|
|
92
|
+
value: results
|
|
93
|
+
};
|
|
94
|
+
scope.close({ _tag: "Success", value: void 0 });
|
|
95
|
+
cb(successExit);
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
function raceWith(left, right, parentScope, onLeft, onRight) {
|
|
102
|
+
return asyncEffect((env, cb) => {
|
|
103
|
+
const scope = parentScope.subScope();
|
|
104
|
+
let done = false;
|
|
105
|
+
const fiberLeft = scope.fork(left);
|
|
106
|
+
const fiberRight = scope.fork(right);
|
|
107
|
+
const finish = (next) => {
|
|
108
|
+
scope.fork(next).join((exitNext) => {
|
|
109
|
+
scope.close(exitNext);
|
|
110
|
+
cb(exitNext);
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
fiberLeft.join((exitL) => {
|
|
114
|
+
if (done) return;
|
|
115
|
+
done = true;
|
|
116
|
+
finish(onLeft(exitL, fiberRight, scope));
|
|
117
|
+
});
|
|
118
|
+
fiberRight.join((exitR) => {
|
|
119
|
+
if (done) return;
|
|
120
|
+
done = true;
|
|
121
|
+
finish(onRight(exitR, fiberLeft, scope));
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export {
|
|
127
|
+
race,
|
|
128
|
+
zipPar,
|
|
129
|
+
collectAllPar,
|
|
130
|
+
raceWith
|
|
131
|
+
};
|