brass-runtime 1.18.0 → 1.18.1
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/dist/agent/cli/main.cjs +30 -30
- package/dist/agent/cli/main.js +2 -2
- package/dist/agent/cli/main.mjs +2 -2
- package/dist/agent/index.cjs +3 -3
- package/dist/agent/index.d.ts +1 -1
- package/dist/agent/index.js +2 -2
- package/dist/agent/index.mjs +2 -2
- package/dist/{chunk-PSEU65ND.js → chunk-22HZQG5F.js} +6 -6
- package/dist/{chunk-SSQJKDN3.cjs → chunk-2JHJ4YHS.cjs} +227 -117
- package/dist/{chunk-IFRBVMWJ.cjs → chunk-2OW6IFY2.cjs} +19 -19
- package/dist/{chunk-YTX2JYYP.cjs → chunk-5LC7V2OZ.cjs} +18 -18
- package/dist/{chunk-7TXQJFZX.cjs → chunk-5RZ7YITF.cjs} +13 -13
- package/dist/{chunk-OT2TESZU.mjs → chunk-6V2AWT4R.mjs} +1 -1
- package/dist/{chunk-BG5RNEA2.js → chunk-7DU7IQHK.js} +3 -3
- package/dist/{chunk-QCOLAHU3.mjs → chunk-7GBJYOX7.mjs} +5 -5
- package/dist/{chunk-ITG6I7ZS.js → chunk-7VQLEN37.js} +1 -1
- package/dist/{chunk-QZ6QFJNM.mjs → chunk-B5FKOLTB.mjs} +3 -3
- package/dist/{chunk-RREBJX2S.mjs → chunk-BC6Q6BCO.mjs} +1 -1
- package/dist/{chunk-KRYP6CAE.mjs → chunk-COOW7BJX.mjs} +2 -2
- package/dist/{chunk-ELLF55ER.mjs → chunk-EEN5OTCR.mjs} +1 -1
- package/dist/{chunk-3PFZGP23.cjs → chunk-EICAJDNX.cjs} +13 -13
- package/dist/{chunk-5XADBMSU.cjs → chunk-ELIECDYN.cjs} +5 -5
- package/dist/{chunk-2QNREG6K.mjs → chunk-H626ZTDZ.mjs} +211 -101
- package/dist/{chunk-JH4GI3DW.js → chunk-IPSMXUWA.js} +1 -1
- package/dist/{chunk-2SLT3X6G.cjs → chunk-J6DUHITE.cjs} +6 -6
- package/dist/{chunk-OI4ESUMC.mjs → chunk-JWIEMBE6.mjs} +6 -6
- package/dist/{chunk-N6QNSTWD.cjs → chunk-KNTJ7FQB.cjs} +5 -5
- package/dist/{chunk-W6WR37HN.js → chunk-LSYQ3C2M.js} +2 -2
- package/dist/{chunk-AADFFVYS.js → chunk-OW5VHAOE.js} +1 -1
- package/dist/{chunk-G5JTCFMI.mjs → chunk-RBHNOKH4.mjs} +2 -2
- package/dist/{chunk-IBRHSH5H.js → chunk-S4HXADU4.js} +1 -1
- package/dist/{chunk-XSAHV5HQ.js → chunk-TTSPIU3U.js} +211 -101
- package/dist/{chunk-S4HHFUYP.js → chunk-UAKAF32U.js} +2 -2
- package/dist/{chunk-R6WDSZA6.mjs → chunk-WCBNXPN6.mjs} +1 -1
- package/dist/{chunk-AJMKZXRB.cjs → chunk-WGE2FEZE.cjs} +2 -2
- package/dist/{chunk-LXBU5E77.cjs → chunk-WI7GZF3B.cjs} +16 -16
- package/dist/{chunk-H5GYX7RZ.js → chunk-WUDHOZIH.js} +113 -5
- package/dist/{chunk-KHACHFBQ.cjs → chunk-WVSZOPGQ.cjs} +54 -54
- package/dist/{chunk-VIFA4DPN.cjs → chunk-XPIMJQYS.cjs} +193 -85
- package/dist/{chunk-3PHU7FWS.js → chunk-YGR2IN4R.js} +5 -5
- package/dist/{chunk-ITZQ526U.mjs → chunk-YWLLH27R.mjs} +2 -2
- package/dist/{chunk-4YQHPIWJ.js → chunk-YZ5LQ32F.js} +2 -2
- package/dist/{chunk-Z3PSSXP3.mjs → chunk-Z3ZZMQUZ.mjs} +113 -5
- package/dist/core/index.cjs +13 -7
- package/dist/core/index.d.ts +6 -6
- package/dist/core/index.js +12 -6
- package/dist/core/index.mjs +12 -6
- package/dist/{defaultClient-DhpCQW9m.d.ts → defaultClient-Cid0JoUR.d.ts} +29 -4
- package/dist/{effect-CtUDl5M5.d.ts → effect-DnGUuhw6.d.ts} +22 -1
- package/dist/http/index.cjs +52 -48
- package/dist/http/index.d.ts +8 -8
- package/dist/http/index.js +10 -6
- package/dist/http/index.mjs +10 -6
- package/dist/http/testing.cjs +8 -8
- package/dist/http/testing.d.ts +4 -4
- package/dist/http/testing.js +4 -4
- package/dist/http/testing.mjs +4 -4
- package/dist/index.cjs +91 -85
- package/dist/index.d.ts +7 -7
- package/dist/index.js +13 -7
- package/dist/index.mjs +13 -7
- package/dist/{layer-BalPI6cN.d.ts → layer-D2LFcBVx.d.ts} +1 -1
- package/dist/observability/index.cjs +9 -9
- package/dist/observability/index.d.ts +7 -7
- package/dist/observability/index.js +8 -8
- package/dist/observability/index.mjs +8 -8
- package/dist/perf/cli.cjs +25 -25
- package/dist/perf/cli.js +10 -10
- package/dist/perf/cli.mjs +10 -10
- package/dist/perf/index.cjs +12 -12
- package/dist/perf/index.js +10 -10
- package/dist/perf/index.mjs +10 -10
- package/dist/{server-C1zVmqE6.d.ts → server-Bf1zNYZk.d.ts} +4 -4
- package/dist/{stream-Bb4FTejt.d.ts → stream-I7bkvF7a.d.ts} +1 -1
- package/dist/{tracer-DzfuE6um.d.ts → tracer-DF83nLn6.d.ts} +2 -2
- package/dist/{tracing-BABA5arE.d.ts → tracing-CWV4gT0u.d.ts} +1 -1
- package/package.json +3 -2
|
@@ -2950,31 +2950,43 @@ var Runtime = class _Runtime {
|
|
|
2950
2950
|
const fiber = this.fork(effect);
|
|
2951
2951
|
fiber.join(cb);
|
|
2952
2952
|
}
|
|
2953
|
+
static exitToError(exit) {
|
|
2954
|
+
if (exit._tag === "Success") return void 0;
|
|
2955
|
+
const failure = _chunkMVGUEJ5Zcjs.Cause.firstFailure(exit.cause);
|
|
2956
|
+
if (failure._tag === "Some") return failure.value;
|
|
2957
|
+
const defect = _chunkMVGUEJ5Zcjs.Cause.firstDefect(exit.cause);
|
|
2958
|
+
if (defect._tag === "Some") {
|
|
2959
|
+
return defect.value instanceof Error ? defect.value : new Error(String(defect.value));
|
|
2960
|
+
}
|
|
2961
|
+
if (_chunkMVGUEJ5Zcjs.Cause.containsInterrupt(exit.cause)) return new Error("Interrupted");
|
|
2962
|
+
return _chunkMVGUEJ5Zcjs.Cause.toError(exit.cause);
|
|
2963
|
+
}
|
|
2953
2964
|
toPromise(effect) {
|
|
2965
|
+
let syncExit;
|
|
2966
|
+
let promiseResolve;
|
|
2967
|
+
let promiseReject;
|
|
2968
|
+
const complete = (exit) => {
|
|
2969
|
+
if (promiseResolve) {
|
|
2970
|
+
if (exit._tag === "Success") promiseResolve(exit.value);
|
|
2971
|
+
else promiseReject(_Runtime.exitToError(exit));
|
|
2972
|
+
} else {
|
|
2973
|
+
syncExit = exit;
|
|
2974
|
+
}
|
|
2975
|
+
};
|
|
2976
|
+
if (this.tryRunNativeTopLevel(effect, complete)) {
|
|
2977
|
+
if (syncExit) {
|
|
2978
|
+
return syncExit._tag === "Success" ? Promise.resolve(syncExit.value) : Promise.reject(_Runtime.exitToError(syncExit));
|
|
2979
|
+
}
|
|
2980
|
+
return new Promise((resolve, reject) => {
|
|
2981
|
+
promiseResolve = resolve;
|
|
2982
|
+
promiseReject = reject;
|
|
2983
|
+
});
|
|
2984
|
+
}
|
|
2954
2985
|
return new Promise((resolve, reject) => {
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
resolve(exit.value);
|
|
2958
|
-
return;
|
|
2959
|
-
}
|
|
2960
|
-
const failure = _chunkMVGUEJ5Zcjs.Cause.firstFailure(exit.cause);
|
|
2961
|
-
if (failure._tag === "Some") reject(failure.value);
|
|
2962
|
-
else {
|
|
2963
|
-
const defect = _chunkMVGUEJ5Zcjs.Cause.firstDefect(exit.cause);
|
|
2964
|
-
if (defect._tag === "Some") {
|
|
2965
|
-
reject(defect.value instanceof Error ? defect.value : new Error(String(defect.value)));
|
|
2966
|
-
} else if (_chunkMVGUEJ5Zcjs.Cause.containsInterrupt(exit.cause)) {
|
|
2967
|
-
reject(new Error("Interrupted"));
|
|
2968
|
-
} else {
|
|
2969
|
-
reject(_chunkMVGUEJ5Zcjs.Cause.toError(exit.cause));
|
|
2970
|
-
}
|
|
2971
|
-
}
|
|
2972
|
-
};
|
|
2973
|
-
if (this.tryRunNativeTopLevel(effect, complete)) return;
|
|
2986
|
+
promiseResolve = resolve;
|
|
2987
|
+
promiseReject = reject;
|
|
2974
2988
|
const fiber = this.fork(effect);
|
|
2975
|
-
fiber.join(
|
|
2976
|
-
complete(exit);
|
|
2977
|
-
});
|
|
2989
|
+
fiber.join(complete);
|
|
2978
2990
|
});
|
|
2979
2991
|
}
|
|
2980
2992
|
tryRunNativeTopLevel(effect, cb) {
|
|
@@ -3274,6 +3286,12 @@ var abortablePromiseTotals = {
|
|
|
3274
3286
|
lateSettlements: 0
|
|
3275
3287
|
};
|
|
3276
3288
|
var abortablePromiseLabels = /* @__PURE__ */ new Map();
|
|
3289
|
+
var perLabelTrackingEnabled = false;
|
|
3290
|
+
function setAbortablePromisePerLabelTracking(enabled) {
|
|
3291
|
+
const previous = perLabelTrackingEnabled;
|
|
3292
|
+
perLabelTrackingEnabled = enabled;
|
|
3293
|
+
return previous;
|
|
3294
|
+
}
|
|
3277
3295
|
var getAbortablePromiseLabelStats = (label) => {
|
|
3278
3296
|
const existing = abortablePromiseLabels.get(label);
|
|
3279
3297
|
if (existing) return existing;
|
|
@@ -3291,44 +3309,60 @@ var getAbortablePromiseLabelStats = (label) => {
|
|
|
3291
3309
|
return created;
|
|
3292
3310
|
};
|
|
3293
3311
|
var recordAbortablePromiseStart = (label) => {
|
|
3294
|
-
const byLabel = getAbortablePromiseLabelStats(label);
|
|
3295
3312
|
abortablePromiseTotals.active++;
|
|
3296
3313
|
abortablePromiseTotals.started++;
|
|
3297
|
-
|
|
3298
|
-
|
|
3314
|
+
if (perLabelTrackingEnabled) {
|
|
3315
|
+
const byLabel = getAbortablePromiseLabelStats(label);
|
|
3316
|
+
byLabel.active++;
|
|
3317
|
+
byLabel.started++;
|
|
3318
|
+
}
|
|
3299
3319
|
};
|
|
3300
3320
|
var recordAbortablePromiseFinish = (label, outcome) => {
|
|
3301
|
-
const byLabel = getAbortablePromiseLabelStats(label);
|
|
3302
3321
|
if (abortablePromiseTotals.active > 0) abortablePromiseTotals.active--;
|
|
3303
|
-
if (byLabel.active > 0) byLabel.active--;
|
|
3304
3322
|
switch (outcome) {
|
|
3305
3323
|
case "success":
|
|
3306
3324
|
abortablePromiseTotals.succeeded++;
|
|
3307
|
-
|
|
3308
|
-
return;
|
|
3325
|
+
break;
|
|
3309
3326
|
case "failure":
|
|
3310
3327
|
abortablePromiseTotals.failed++;
|
|
3311
|
-
|
|
3312
|
-
return;
|
|
3328
|
+
break;
|
|
3313
3329
|
case "interrupt":
|
|
3314
3330
|
abortablePromiseTotals.interrupted++;
|
|
3315
|
-
|
|
3316
|
-
return;
|
|
3331
|
+
break;
|
|
3317
3332
|
case "timeout":
|
|
3318
3333
|
abortablePromiseTotals.timedOut++;
|
|
3319
|
-
|
|
3320
|
-
|
|
3334
|
+
break;
|
|
3335
|
+
}
|
|
3336
|
+
if (perLabelTrackingEnabled) {
|
|
3337
|
+
const byLabel = getAbortablePromiseLabelStats(label);
|
|
3338
|
+
if (byLabel.active > 0) byLabel.active--;
|
|
3339
|
+
switch (outcome) {
|
|
3340
|
+
case "success":
|
|
3341
|
+
byLabel.succeeded++;
|
|
3342
|
+
return;
|
|
3343
|
+
case "failure":
|
|
3344
|
+
byLabel.failed++;
|
|
3345
|
+
return;
|
|
3346
|
+
case "interrupt":
|
|
3347
|
+
byLabel.interrupted++;
|
|
3348
|
+
return;
|
|
3349
|
+
case "timeout":
|
|
3350
|
+
byLabel.timedOut++;
|
|
3351
|
+
return;
|
|
3352
|
+
}
|
|
3321
3353
|
}
|
|
3322
3354
|
};
|
|
3323
3355
|
var recordAbortablePromiseLateSettlement = (label) => {
|
|
3324
|
-
const byLabel = getAbortablePromiseLabelStats(label);
|
|
3325
3356
|
abortablePromiseTotals.lateSettlements++;
|
|
3326
|
-
|
|
3357
|
+
if (perLabelTrackingEnabled) {
|
|
3358
|
+
const byLabel = getAbortablePromiseLabelStats(label);
|
|
3359
|
+
byLabel.lateSettlements++;
|
|
3360
|
+
}
|
|
3327
3361
|
};
|
|
3328
3362
|
function abortablePromiseStats() {
|
|
3329
3363
|
return {
|
|
3330
3364
|
...abortablePromiseTotals,
|
|
3331
|
-
byLabel: Array.from(abortablePromiseLabels.values()).map((x) => ({ ...x })).sort((a, b) => b.active - a.active || b.started - a.started || a.label.localeCompare(b.label))
|
|
3365
|
+
byLabel: perLabelTrackingEnabled ? Array.from(abortablePromiseLabels.values()).map((x) => ({ ...x })).sort((a, b) => b.active - a.active || b.started - a.started || a.label.localeCompare(b.label)) : []
|
|
3332
3366
|
};
|
|
3333
3367
|
}
|
|
3334
3368
|
function resetAbortablePromiseStats() {
|
|
@@ -3350,76 +3384,149 @@ var makeTimeoutReason = (timeoutMs, label) => ({
|
|
|
3350
3384
|
timeoutMs,
|
|
3351
3385
|
message: `Abortable promise '${label}' timed out after ${timeoutMs}ms`
|
|
3352
3386
|
});
|
|
3387
|
+
function registerWithTimeout(make, onReject, options, env, cb, timeoutMs) {
|
|
3388
|
+
const controller = new AbortController();
|
|
3389
|
+
const label = normalizeAbortablePromiseLabel(options.label);
|
|
3390
|
+
const startedAt = performance.now();
|
|
3391
|
+
let done = false;
|
|
3392
|
+
let cleanup;
|
|
3393
|
+
const hasHooks = options.onStart !== void 0 || options.onFinish !== void 0;
|
|
3394
|
+
const finish = hasHooks ? (outcome, exit, error) => {
|
|
3395
|
+
if (done) return;
|
|
3396
|
+
done = true;
|
|
3397
|
+
cleanup();
|
|
3398
|
+
recordAbortablePromiseFinish(label, outcome);
|
|
3399
|
+
_optionalChain([options, 'access', _189 => _189.onFinish, 'optionalCall', _190 => _190({
|
|
3400
|
+
label,
|
|
3401
|
+
outcome,
|
|
3402
|
+
durationMs: Math.round(performance.now() - startedAt),
|
|
3403
|
+
error
|
|
3404
|
+
})]);
|
|
3405
|
+
cb(exit);
|
|
3406
|
+
} : (outcome, exit, _error) => {
|
|
3407
|
+
if (done) return;
|
|
3408
|
+
done = true;
|
|
3409
|
+
cleanup();
|
|
3410
|
+
recordAbortablePromiseFinish(label, outcome);
|
|
3411
|
+
cb(exit);
|
|
3412
|
+
};
|
|
3413
|
+
recordAbortablePromiseStart(label);
|
|
3414
|
+
if (hasHooks) _optionalChain([options, 'access', _191 => _191.onStart, 'optionalCall', _192 => _192(label)]);
|
|
3415
|
+
const onTimeout = () => {
|
|
3416
|
+
const reason = _nullishCoalesce(_optionalChain([options, 'access', _193 => _193.timeoutReason, 'optionalCall', _194 => _194()]), () => ( makeTimeoutReason(timeoutMs, label)));
|
|
3417
|
+
try {
|
|
3418
|
+
controller.abort(reason);
|
|
3419
|
+
} catch (e10) {
|
|
3420
|
+
controller.abort();
|
|
3421
|
+
}
|
|
3422
|
+
finish("timeout", _chunkMVGUEJ5Zcjs.Exit.failCause(_chunkMVGUEJ5Zcjs.Cause.fail(onReject(reason))), reason);
|
|
3423
|
+
};
|
|
3424
|
+
if (options.timerWheel) {
|
|
3425
|
+
const handle = options.timerWheel.schedule(timeoutMs, onTimeout);
|
|
3426
|
+
cleanup = () => {
|
|
3427
|
+
handle.cancel();
|
|
3428
|
+
};
|
|
3429
|
+
} else {
|
|
3430
|
+
let timeoutHandle = setTimeout(onTimeout, timeoutMs);
|
|
3431
|
+
cleanup = () => {
|
|
3432
|
+
if (timeoutHandle !== void 0) {
|
|
3433
|
+
clearTimeout(timeoutHandle);
|
|
3434
|
+
timeoutHandle = void 0;
|
|
3435
|
+
}
|
|
3436
|
+
};
|
|
3437
|
+
}
|
|
3438
|
+
let promise;
|
|
3439
|
+
try {
|
|
3440
|
+
promise = make(controller.signal, env);
|
|
3441
|
+
} catch (err) {
|
|
3442
|
+
finish("failure", _chunkMVGUEJ5Zcjs.Exit.failCause(_chunkMVGUEJ5Zcjs.Cause.fail(onReject(err))), err);
|
|
3443
|
+
return () => void 0;
|
|
3444
|
+
}
|
|
3445
|
+
promise.then((value) => {
|
|
3446
|
+
if (done) {
|
|
3447
|
+
recordAbortablePromiseLateSettlement(label);
|
|
3448
|
+
return;
|
|
3449
|
+
}
|
|
3450
|
+
finish("success", _chunkMVGUEJ5Zcjs.Exit.succeed(value));
|
|
3451
|
+
}).catch((err) => {
|
|
3452
|
+
if (done) {
|
|
3453
|
+
recordAbortablePromiseLateSettlement(label);
|
|
3454
|
+
return;
|
|
3455
|
+
}
|
|
3456
|
+
finish("failure", _chunkMVGUEJ5Zcjs.Exit.failCause(_chunkMVGUEJ5Zcjs.Cause.fail(onReject(err))), err);
|
|
3457
|
+
});
|
|
3458
|
+
return () => {
|
|
3459
|
+
if (done) return;
|
|
3460
|
+
try {
|
|
3461
|
+
controller.abort();
|
|
3462
|
+
} catch (e11) {
|
|
3463
|
+
}
|
|
3464
|
+
finish("interrupt", _chunkMVGUEJ5Zcjs.Exit.failCause(_chunkMVGUEJ5Zcjs.Cause.interrupt()));
|
|
3465
|
+
};
|
|
3466
|
+
}
|
|
3467
|
+
function registerWithoutTimeout(make, onReject, options, env, cb) {
|
|
3468
|
+
const controller = new AbortController();
|
|
3469
|
+
const label = normalizeAbortablePromiseLabel(options.label);
|
|
3470
|
+
const startedAt = performance.now();
|
|
3471
|
+
let done = false;
|
|
3472
|
+
const hasHooks = options.onStart !== void 0 || options.onFinish !== void 0;
|
|
3473
|
+
const finish = hasHooks ? (outcome, exit, error) => {
|
|
3474
|
+
if (done) return;
|
|
3475
|
+
done = true;
|
|
3476
|
+
recordAbortablePromiseFinish(label, outcome);
|
|
3477
|
+
_optionalChain([options, 'access', _195 => _195.onFinish, 'optionalCall', _196 => _196({
|
|
3478
|
+
label,
|
|
3479
|
+
outcome,
|
|
3480
|
+
durationMs: Math.round(performance.now() - startedAt),
|
|
3481
|
+
error
|
|
3482
|
+
})]);
|
|
3483
|
+
cb(exit);
|
|
3484
|
+
} : (outcome, exit, _error) => {
|
|
3485
|
+
if (done) return;
|
|
3486
|
+
done = true;
|
|
3487
|
+
recordAbortablePromiseFinish(label, outcome);
|
|
3488
|
+
cb(exit);
|
|
3489
|
+
};
|
|
3490
|
+
recordAbortablePromiseStart(label);
|
|
3491
|
+
if (hasHooks) _optionalChain([options, 'access', _197 => _197.onStart, 'optionalCall', _198 => _198(label)]);
|
|
3492
|
+
let promise;
|
|
3493
|
+
try {
|
|
3494
|
+
promise = make(controller.signal, env);
|
|
3495
|
+
} catch (err) {
|
|
3496
|
+
finish("failure", _chunkMVGUEJ5Zcjs.Exit.failCause(_chunkMVGUEJ5Zcjs.Cause.fail(onReject(err))), err);
|
|
3497
|
+
return () => void 0;
|
|
3498
|
+
}
|
|
3499
|
+
promise.then((value) => {
|
|
3500
|
+
if (done) {
|
|
3501
|
+
recordAbortablePromiseLateSettlement(label);
|
|
3502
|
+
return;
|
|
3503
|
+
}
|
|
3504
|
+
finish("success", _chunkMVGUEJ5Zcjs.Exit.succeed(value));
|
|
3505
|
+
}).catch((err) => {
|
|
3506
|
+
if (done) {
|
|
3507
|
+
recordAbortablePromiseLateSettlement(label);
|
|
3508
|
+
return;
|
|
3509
|
+
}
|
|
3510
|
+
finish("failure", _chunkMVGUEJ5Zcjs.Exit.failCause(_chunkMVGUEJ5Zcjs.Cause.fail(onReject(err))), err);
|
|
3511
|
+
});
|
|
3512
|
+
return () => {
|
|
3513
|
+
if (done) return;
|
|
3514
|
+
try {
|
|
3515
|
+
controller.abort();
|
|
3516
|
+
} catch (e12) {
|
|
3517
|
+
}
|
|
3518
|
+
finish("interrupt", _chunkMVGUEJ5Zcjs.Exit.failCause(_chunkMVGUEJ5Zcjs.Cause.interrupt()));
|
|
3519
|
+
};
|
|
3520
|
+
}
|
|
3353
3521
|
function fromPromiseAbortable(make, onReject, options = {}) {
|
|
3354
3522
|
return {
|
|
3355
3523
|
_tag: "Async",
|
|
3356
3524
|
register: (env, cb) => {
|
|
3357
|
-
const controller = new AbortController();
|
|
3358
|
-
const label = normalizeAbortablePromiseLabel(options.label);
|
|
3359
3525
|
const timeoutMs = options.timeoutMs !== void 0 && Number.isFinite(options.timeoutMs) ? Math.max(0, Math.floor(options.timeoutMs)) : void 0;
|
|
3360
|
-
const startedAt = performance.now();
|
|
3361
|
-
let done = false;
|
|
3362
|
-
let timeoutHandle;
|
|
3363
|
-
const cleanup = () => {
|
|
3364
|
-
if (timeoutHandle !== void 0) {
|
|
3365
|
-
clearTimeout(timeoutHandle);
|
|
3366
|
-
timeoutHandle = void 0;
|
|
3367
|
-
}
|
|
3368
|
-
};
|
|
3369
|
-
const finish = (outcome, exit, error) => {
|
|
3370
|
-
if (done) return;
|
|
3371
|
-
done = true;
|
|
3372
|
-
cleanup();
|
|
3373
|
-
recordAbortablePromiseFinish(label, outcome);
|
|
3374
|
-
_optionalChain([options, 'access', _189 => _189.onFinish, 'optionalCall', _190 => _190({
|
|
3375
|
-
label,
|
|
3376
|
-
outcome,
|
|
3377
|
-
durationMs: Math.round(performance.now() - startedAt),
|
|
3378
|
-
error
|
|
3379
|
-
})]);
|
|
3380
|
-
cb(exit);
|
|
3381
|
-
};
|
|
3382
|
-
recordAbortablePromiseStart(label);
|
|
3383
|
-
_optionalChain([options, 'access', _191 => _191.onStart, 'optionalCall', _192 => _192(label)]);
|
|
3384
3526
|
if (timeoutMs !== void 0 && timeoutMs > 0) {
|
|
3385
|
-
|
|
3386
|
-
const reason = _nullishCoalesce(_optionalChain([options, 'access', _193 => _193.timeoutReason, 'optionalCall', _194 => _194()]), () => ( makeTimeoutReason(timeoutMs, label)));
|
|
3387
|
-
try {
|
|
3388
|
-
controller.abort(reason);
|
|
3389
|
-
} catch (e10) {
|
|
3390
|
-
controller.abort();
|
|
3391
|
-
}
|
|
3392
|
-
finish("timeout", _chunkMVGUEJ5Zcjs.Exit.failCause(_chunkMVGUEJ5Zcjs.Cause.fail(onReject(reason))), reason);
|
|
3393
|
-
}, timeoutMs);
|
|
3527
|
+
return registerWithTimeout(make, onReject, options, env, cb, timeoutMs);
|
|
3394
3528
|
}
|
|
3395
|
-
|
|
3396
|
-
try {
|
|
3397
|
-
promise = make(controller.signal, env);
|
|
3398
|
-
} catch (err) {
|
|
3399
|
-
finish("failure", _chunkMVGUEJ5Zcjs.Exit.failCause(_chunkMVGUEJ5Zcjs.Cause.fail(onReject(err))), err);
|
|
3400
|
-
return () => void 0;
|
|
3401
|
-
}
|
|
3402
|
-
promise.then((value) => {
|
|
3403
|
-
if (done) {
|
|
3404
|
-
recordAbortablePromiseLateSettlement(label);
|
|
3405
|
-
return;
|
|
3406
|
-
}
|
|
3407
|
-
finish("success", _chunkMVGUEJ5Zcjs.Exit.succeed(value));
|
|
3408
|
-
}).catch((err) => {
|
|
3409
|
-
if (done) {
|
|
3410
|
-
recordAbortablePromiseLateSettlement(label);
|
|
3411
|
-
return;
|
|
3412
|
-
}
|
|
3413
|
-
finish("failure", _chunkMVGUEJ5Zcjs.Exit.failCause(_chunkMVGUEJ5Zcjs.Cause.fail(onReject(err))), err);
|
|
3414
|
-
});
|
|
3415
|
-
return () => {
|
|
3416
|
-
if (done) return;
|
|
3417
|
-
try {
|
|
3418
|
-
controller.abort();
|
|
3419
|
-
} catch (e11) {
|
|
3420
|
-
}
|
|
3421
|
-
finish("interrupt", _chunkMVGUEJ5Zcjs.Exit.failCause(_chunkMVGUEJ5Zcjs.Cause.interrupt()));
|
|
3422
|
-
};
|
|
3529
|
+
return registerWithoutTimeout(make, onReject, options, env, cb);
|
|
3423
3530
|
}
|
|
3424
3531
|
};
|
|
3425
3532
|
}
|
|
@@ -3507,7 +3614,7 @@ var RuntimeFiber = (_class17 = class {
|
|
|
3507
3614
|
return;
|
|
3508
3615
|
}
|
|
3509
3616
|
this._syncResolved = true;
|
|
3510
|
-
_optionalChain([this, 'access',
|
|
3617
|
+
_optionalChain([this, 'access', _199 => _199._asyncDetach, 'optionalCall', _200 => _200()]);
|
|
3511
3618
|
this._asyncDetach = void 0;
|
|
3512
3619
|
if (exit._tag === "Success") {
|
|
3513
3620
|
this.current = _chunkMVGUEJ5Zcjs.Async.succeed(exit.value);
|
|
@@ -3549,12 +3656,12 @@ var RuntimeFiber = (_class17 = class {
|
|
|
3549
3656
|
this.runtime.hooks.emit(ev, {
|
|
3550
3657
|
fiberId: this.id,
|
|
3551
3658
|
scopeId: this.scopeId,
|
|
3552
|
-
traceId: _optionalChain([this, 'access',
|
|
3553
|
-
spanId: _optionalChain([this, 'access',
|
|
3554
|
-
parentSpanId: _optionalChain([this, 'access',
|
|
3555
|
-
traceState: _optionalChain([this, 'access',
|
|
3556
|
-
baggage: _optionalChain([this, 'access',
|
|
3557
|
-
sampled: _optionalChain([this, 'access',
|
|
3659
|
+
traceId: _optionalChain([this, 'access', _201 => _201.fiberContext, 'optionalAccess', _202 => _202.trace, 'optionalAccess', _203 => _203.traceId]),
|
|
3660
|
+
spanId: _optionalChain([this, 'access', _204 => _204.fiberContext, 'optionalAccess', _205 => _205.trace, 'optionalAccess', _206 => _206.spanId]),
|
|
3661
|
+
parentSpanId: _optionalChain([this, 'access', _207 => _207.fiberContext, 'optionalAccess', _208 => _208.trace, 'optionalAccess', _209 => _209.parentSpanId]),
|
|
3662
|
+
traceState: _optionalChain([this, 'access', _210 => _210.fiberContext, 'optionalAccess', _211 => _211.trace, 'optionalAccess', _212 => _212.traceState]),
|
|
3663
|
+
baggage: _optionalChain([this, 'access', _213 => _213.fiberContext, 'optionalAccess', _214 => _214.trace, 'optionalAccess', _215 => _215.baggage]),
|
|
3664
|
+
sampled: _optionalChain([this, 'access', _216 => _216.fiberContext, 'optionalAccess', _217 => _217.trace, 'optionalAccess', _218 => _218.sampled])
|
|
3558
3665
|
});
|
|
3559
3666
|
}
|
|
3560
3667
|
addFinalizer(f) {
|
|
@@ -3619,7 +3726,7 @@ var RuntimeFiber = (_class17 = class {
|
|
|
3619
3726
|
unsafeRunAsync(eff, this.env, () => {
|
|
3620
3727
|
});
|
|
3621
3728
|
}
|
|
3622
|
-
} catch (
|
|
3729
|
+
} catch (e13) {
|
|
3623
3730
|
}
|
|
3624
3731
|
}
|
|
3625
3732
|
}
|
|
@@ -3808,7 +3915,7 @@ var RuntimeFiber = (_class17 = class {
|
|
|
3808
3915
|
this._asyncDetach = void 0;
|
|
3809
3916
|
try {
|
|
3810
3917
|
canceler();
|
|
3811
|
-
} catch (
|
|
3918
|
+
} catch (e14) {
|
|
3812
3919
|
}
|
|
3813
3920
|
});
|
|
3814
3921
|
}
|
|
@@ -3893,7 +4000,7 @@ var RuntimeFiber = (_class17 = class {
|
|
|
3893
4000
|
syncTrampoline() {
|
|
3894
4001
|
while (this.budget-- > 0) {
|
|
3895
4002
|
let cur = this.current;
|
|
3896
|
-
while (cur._tag === "FlatMap" && _optionalChain([cur, 'access',
|
|
4003
|
+
while (cur._tag === "FlatMap" && _optionalChain([cur, 'access', _219 => _219.first, 'optionalAccess', _220 => _220._tag]) === "FlatMap") {
|
|
3897
4004
|
this.stack.push({ _tag: "SuccessCont", k: cur.andThen });
|
|
3898
4005
|
cur = cur.first;
|
|
3899
4006
|
}
|
|
@@ -3963,7 +4070,7 @@ var RuntimeFiber = (_class17 = class {
|
|
|
3963
4070
|
this._asyncDetach = void 0;
|
|
3964
4071
|
try {
|
|
3965
4072
|
canceler();
|
|
3966
|
-
} catch (
|
|
4073
|
+
} catch (e15) {
|
|
3967
4074
|
}
|
|
3968
4075
|
});
|
|
3969
4076
|
}
|
|
@@ -3994,7 +4101,7 @@ function getCurrentFiber() {
|
|
|
3994
4101
|
}
|
|
3995
4102
|
function unsafeGetCurrentRuntime() {
|
|
3996
4103
|
const f = getCurrentFiber();
|
|
3997
|
-
if (!_optionalChain([f, 'optionalAccess',
|
|
4104
|
+
if (!_optionalChain([f, 'optionalAccess', _221 => _221.runtime])) {
|
|
3998
4105
|
throw new Error("unsafeGetCurrentRuntime: no current fiber/runtime");
|
|
3999
4106
|
}
|
|
4000
4107
|
return f.runtime;
|
|
@@ -4060,7 +4167,7 @@ var Scope = (_class19 = class _Scope {
|
|
|
4060
4167
|
this.runtime = runtime;
|
|
4061
4168
|
this.parentScopeId = parentScopeId;
|
|
4062
4169
|
this.id = nextScopeId++;
|
|
4063
|
-
const inferredParent = _nullishCoalesce(this.parentScopeId, () => ( _optionalChain([getCurrentFiber, 'call',
|
|
4170
|
+
const inferredParent = _nullishCoalesce(this.parentScopeId, () => ( _optionalChain([getCurrentFiber, 'call', _222 => _222(), 'optionalAccess', _223 => _223.scopeId])));
|
|
4064
4171
|
if (this.runtime.hasActiveHooks()) {
|
|
4065
4172
|
this.runtime.emit({
|
|
4066
4173
|
type: "scope.open",
|
|
@@ -4111,7 +4218,7 @@ var Scope = (_class19 = class _Scope {
|
|
|
4111
4218
|
type: "scope.close",
|
|
4112
4219
|
scopeId: this.id,
|
|
4113
4220
|
status,
|
|
4114
|
-
error: _optionalChain([failure, 'optionalAccess',
|
|
4221
|
+
error: _optionalChain([failure, 'optionalAccess', _224 => _224._tag]) === "Some" ? failure.value : exit._tag === "Failure" ? exit.cause : void 0
|
|
4115
4222
|
});
|
|
4116
4223
|
}
|
|
4117
4224
|
}
|
|
@@ -4135,7 +4242,7 @@ var Scope = (_class19 = class _Scope {
|
|
|
4135
4242
|
let result;
|
|
4136
4243
|
try {
|
|
4137
4244
|
result = fin(exit);
|
|
4138
|
-
} catch (
|
|
4245
|
+
} catch (e16) {
|
|
4139
4246
|
return _chunkMVGUEJ5Zcjs.unit.call(void 0, );
|
|
4140
4247
|
}
|
|
4141
4248
|
if (result._tag === "Succeed") {
|
|
@@ -4269,4 +4376,7 @@ function withScope(runtime, f) {
|
|
|
4269
4376
|
|
|
4270
4377
|
|
|
4271
4378
|
|
|
4272
|
-
|
|
4379
|
+
|
|
4380
|
+
|
|
4381
|
+
|
|
4382
|
+
exports.PushStatus = PushStatus; exports.RingBuffer = RingBuffer; exports.resolveWasmModule = resolveWasmModule; exports.makeBoundedRingBuffer = makeBoundedRingBuffer; exports.sanitizeLaneKey = sanitizeLaneKey; exports.laneTag = laneTag; exports.inferCallerLaneFromStack = inferCallerLaneFromStack; exports.Scheduler = Scheduler; exports.globalScheduler = globalScheduler; exports.emptyContext = emptyContext; exports.ctxExtend = ctxExtend; exports.ctxToObject = ctxToObject; exports.DefaultHostExecutor = DefaultHostExecutor; exports.JsFiberEngine = JsFiberEngine; exports.HostRegistry = HostRegistry; exports.ProgramBuilder = ProgramBuilder; exports.EngineFiberHandle = EngineFiberHandle; exports.ABI_VERSION = ABI_VERSION; exports.EVENT_WORDS = EVENT_WORDS; exports.NONE_U32 = NONE_U32; exports.OpcodeTagCode = OpcodeTagCode; exports.EventKindCode = EventKindCode; exports.encodeOpcodeProgram = encodeOpcodeProgram; exports.encodeOpcodeNodes = encodeOpcodeNodes; exports.decodeEvent = decodeEvent; exports.decodeEventBatch = decodeEventBatch; exports.WasmPackFiberBridge = WasmPackFiberBridge; exports.WasmFiberRegistryBridge = WasmFiberRegistryBridge; exports.makeFiberReadyQueue = makeFiberReadyQueue; exports.WasmFiberEngine = WasmFiberEngine; exports.runtimeCapabilities = runtimeCapabilities; exports.liveClock = liveClock; exports.runtimeClockFromEnv = runtimeClockFromEnv; exports.NoopHooks = NoopHooks; exports.Runtime = Runtime; exports.fork = fork; exports.runtimeForCaller = runtimeForCaller; exports.toPromiseByCaller = toPromiseByCaller; exports.unsafeRunAsync = unsafeRunAsync; exports.toPromise = toPromise; exports.setAbortablePromisePerLabelTracking = setAbortablePromisePerLabelTracking; exports.recordAbortablePromiseStart = recordAbortablePromiseStart; exports.recordAbortablePromiseFinish = recordAbortablePromiseFinish; exports.abortablePromiseStats = abortablePromiseStats; exports.resetAbortablePromiseStats = resetAbortablePromiseStats; exports.fromPromiseAbortable = fromPromiseAbortable; exports.unsafeRunFoldWithEnv = unsafeRunFoldWithEnv; exports.setBenchmarkBudget = setBenchmarkBudget; exports.getBenchmarkBudget = getBenchmarkBudget; exports.RuntimeFiber = RuntimeFiber; exports.getCurrentFiber = getCurrentFiber; exports.unsafeGetCurrentRuntime = unsafeGetCurrentRuntime; exports.withCurrentFiber = withCurrentFiber; exports.Scope = Scope; exports.withScopeAsync = withScopeAsync; exports.withScope = withScope;
|
|
@@ -1,10 +1,10 @@
|
|
|
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; } var _class; var _class2; var _class3; var _class4; var _class5;
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkWGE2FEZEcjs = require('./chunk-WGE2FEZE.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunk5RZ7YITFcjs = require('./chunk-5RZ7YITF.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
@@ -12,7 +12,7 @@ var _chunk7TXQJFZXcjs = require('./chunk-7TXQJFZX.cjs');
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _chunk2JHJ4YHScjs = require('./chunk-2JHJ4YHS.cjs');
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
@@ -63,19 +63,19 @@ function linkAbortController(token, ac) {
|
|
|
63
63
|
|
|
64
64
|
// src/core/runtime/dx.ts
|
|
65
65
|
function makeRuntime(env = {}, options = {}) {
|
|
66
|
-
return new (0,
|
|
66
|
+
return new (0, _chunk2JHJ4YHScjs.Runtime)({ ...options, env });
|
|
67
67
|
}
|
|
68
68
|
function runPromise(effect, envOrRuntime) {
|
|
69
|
-
if (envOrRuntime instanceof
|
|
70
|
-
return
|
|
69
|
+
if (envOrRuntime instanceof _chunk2JHJ4YHScjs.Runtime) return envOrRuntime.toPromise(effect);
|
|
70
|
+
return _chunk2JHJ4YHScjs.toPromise.call(void 0, effect, envOrRuntime);
|
|
71
71
|
}
|
|
72
72
|
function runExit(effect, envOrRuntime) {
|
|
73
73
|
return new Promise((resolve) => {
|
|
74
|
-
if (envOrRuntime instanceof
|
|
74
|
+
if (envOrRuntime instanceof _chunk2JHJ4YHScjs.Runtime) {
|
|
75
75
|
envOrRuntime.unsafeRunAsync(effect, resolve);
|
|
76
76
|
return;
|
|
77
77
|
}
|
|
78
|
-
|
|
78
|
+
_chunk2JHJ4YHScjs.unsafeRunAsync.call(void 0, effect, envOrRuntime, resolve);
|
|
79
79
|
});
|
|
80
80
|
}
|
|
81
81
|
var runEffect = runPromise;
|
|
@@ -162,7 +162,7 @@ function makeSemaphore(n) {
|
|
|
162
162
|
released = true;
|
|
163
163
|
release();
|
|
164
164
|
};
|
|
165
|
-
const fiber =
|
|
165
|
+
const fiber = _chunk2JHJ4YHScjs.getCurrentFiber.call(void 0, );
|
|
166
166
|
_optionalChain([fiber, 'optionalAccess', _2 => _2.addFinalizer, 'call', _3 => _3(() => {
|
|
167
167
|
releaseOnce();
|
|
168
168
|
})]);
|
|
@@ -496,7 +496,7 @@ function makeTestRuntime(env, options = {}) {
|
|
|
496
496
|
const scheduler = new TestScheduler(options);
|
|
497
497
|
const clock = new TestClock(options.initialTimeMs, () => scheduler.flushAll(options.maxSteps), options.maxSteps);
|
|
498
498
|
const testEnv = withTestClock(_nullishCoalesce(env, () => ( {})), clock);
|
|
499
|
-
const runtime =
|
|
499
|
+
const runtime = _chunk2JHJ4YHScjs.Runtime.makeWithEngine(testEnv, "ts", { scheduler });
|
|
500
500
|
const flush = (maxTasks) => scheduler.flush(maxTasks);
|
|
501
501
|
const flushAll = (maxSteps) => scheduler.flushAll(maxSteps);
|
|
502
502
|
const advance = (ms) => clock.advance(ms);
|
|
@@ -567,7 +567,7 @@ function firstFailureValue(exit) {
|
|
|
567
567
|
return failure._tag === "Some" ? failure.value : void 0;
|
|
568
568
|
}
|
|
569
569
|
function makeAssertionRuntime(runtime) {
|
|
570
|
-
return _nullishCoalesce(runtime, () => (
|
|
570
|
+
return _nullishCoalesce(runtime, () => ( _chunk2JHJ4YHScjs.Runtime.make({})));
|
|
571
571
|
}
|
|
572
572
|
async function assertSucceeds(effect, expected, runtime) {
|
|
573
573
|
const rt = makeAssertionRuntime(runtime);
|
|
@@ -603,9 +603,9 @@ async function assertFailsWith(effect, predicate, runtime) {
|
|
|
603
603
|
}
|
|
604
604
|
async function assertCompletesWithin(effect, maxMs, runtime) {
|
|
605
605
|
const rt = makeAssertionRuntime(runtime);
|
|
606
|
-
const start =
|
|
606
|
+
const start = _chunk2JHJ4YHScjs.runtimeClockFromEnv.call(void 0, rt.env).now();
|
|
607
607
|
const result = await rt.toPromise(effect);
|
|
608
|
-
const elapsed =
|
|
608
|
+
const elapsed = _chunk2JHJ4YHScjs.runtimeClockFromEnv.call(void 0, rt.env).now() - start;
|
|
609
609
|
if (elapsed > maxMs) {
|
|
610
610
|
throw new Error(`Effect took ${elapsed.toFixed(1)}ms, expected < ${maxMs}ms`);
|
|
611
611
|
}
|
|
@@ -624,7 +624,7 @@ function flakyEffect(failCount, successValue, errorValue) {
|
|
|
624
624
|
}
|
|
625
625
|
function delayedEffect(ms, value) {
|
|
626
626
|
return _chunkMVGUEJ5Zcjs.asyncEffect.call(void 0, (env, cb) => {
|
|
627
|
-
const clock =
|
|
627
|
+
const clock = _chunk2JHJ4YHScjs.runtimeClockFromEnv.call(void 0, env);
|
|
628
628
|
const id = clock.setTimeout(() => cb(_chunkMVGUEJ5Zcjs.Exit.succeed(value)), ms);
|
|
629
629
|
return () => clock.clearTimeout(id);
|
|
630
630
|
});
|
|
@@ -638,7 +638,7 @@ function neverEffect() {
|
|
|
638
638
|
|
|
639
639
|
// src/core/runtime/configLayer.ts
|
|
640
640
|
function makeConfigLayer(tag, schema, source, options = {}) {
|
|
641
|
-
return
|
|
641
|
+
return _chunk5RZ7YITFcjs.layerEffect.call(void 0,
|
|
642
642
|
tag,
|
|
643
643
|
(context) => _chunkMVGUEJ5Zcjs.asyncSync.call(void 0,
|
|
644
644
|
() => _chunkUUMKZJRJcjs.parseConfig.call(void 0, _nullishCoalesce(options.name, () => ( tag.name)), schema, readConfigSource(source, context))
|
|
@@ -829,7 +829,7 @@ var RuntimeRegistry = (_class4 = class {constructor() { _class4.prototype.__init
|
|
|
829
829
|
__init18() {this.recent = []}
|
|
830
830
|
__init19() {this.recentCap = 2e3}
|
|
831
831
|
emit(ev, ctx) {
|
|
832
|
-
const rec =
|
|
832
|
+
const rec = _chunkWGE2FEZEcjs.makeRuntimeEventRecord.call(void 0, ev, ctx, this.seq++);
|
|
833
833
|
this.recent.push(rec);
|
|
834
834
|
if (this.recent.length > this.recentCap) this.recent.shift();
|
|
835
835
|
switch (rec.type) {
|
|
@@ -1174,7 +1174,7 @@ var Supervisor = (_class5 = class {
|
|
|
1174
1174
|
}
|
|
1175
1175
|
record.restartTimes.push(now);
|
|
1176
1176
|
if (record.restart.schedule) {
|
|
1177
|
-
record.scheduleDriver ??=
|
|
1177
|
+
record.scheduleDriver ??= _chunk5RZ7YITFcjs.makeScheduleDriver.call(void 0, record.restart.schedule, {
|
|
1178
1178
|
name: _nullishCoalesce(record.restart.schedule.name, () => ( "supervisor.restart")),
|
|
1179
1179
|
clock: this.scheduleClock()
|
|
1180
1180
|
});
|
|
@@ -1224,8 +1224,8 @@ var Supervisor = (_class5 = class {
|
|
|
1224
1224
|
scheduleClock() {
|
|
1225
1225
|
return {
|
|
1226
1226
|
now: this.clock,
|
|
1227
|
-
setTimeout:
|
|
1228
|
-
clearTimeout:
|
|
1227
|
+
setTimeout: _chunk2JHJ4YHScjs.liveClock.setTimeout,
|
|
1228
|
+
clearTimeout: _chunk2JHJ4YHScjs.liveClock.clearTimeout
|
|
1229
1229
|
};
|
|
1230
1230
|
}
|
|
1231
1231
|
}, _class5);
|