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 = Cause.firstFailure(exit.cause);
|
|
2956
|
+
if (failure._tag === "Some") return failure.value;
|
|
2957
|
+
const defect = 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 (Cause.containsInterrupt(exit.cause)) return new Error("Interrupted");
|
|
2962
|
+
return 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 = Cause.firstFailure(exit.cause);
|
|
2961
|
-
if (failure._tag === "Some") reject(failure.value);
|
|
2962
|
-
else {
|
|
2963
|
-
const defect = 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 (Cause.containsInterrupt(exit.cause)) {
|
|
2967
|
-
reject(new Error("Interrupted"));
|
|
2968
|
-
} else {
|
|
2969
|
-
reject(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
|
+
options.onFinish?.({
|
|
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) options.onStart?.(label);
|
|
3415
|
+
const onTimeout = () => {
|
|
3416
|
+
const reason = options.timeoutReason?.() ?? makeTimeoutReason(timeoutMs, label);
|
|
3417
|
+
try {
|
|
3418
|
+
controller.abort(reason);
|
|
3419
|
+
} catch {
|
|
3420
|
+
controller.abort();
|
|
3421
|
+
}
|
|
3422
|
+
finish("timeout", Exit.failCause(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", Exit.failCause(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", Exit.succeed(value));
|
|
3451
|
+
}).catch((err) => {
|
|
3452
|
+
if (done) {
|
|
3453
|
+
recordAbortablePromiseLateSettlement(label);
|
|
3454
|
+
return;
|
|
3455
|
+
}
|
|
3456
|
+
finish("failure", Exit.failCause(Cause.fail(onReject(err))), err);
|
|
3457
|
+
});
|
|
3458
|
+
return () => {
|
|
3459
|
+
if (done) return;
|
|
3460
|
+
try {
|
|
3461
|
+
controller.abort();
|
|
3462
|
+
} catch {
|
|
3463
|
+
}
|
|
3464
|
+
finish("interrupt", Exit.failCause(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
|
+
options.onFinish?.({
|
|
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) options.onStart?.(label);
|
|
3492
|
+
let promise;
|
|
3493
|
+
try {
|
|
3494
|
+
promise = make(controller.signal, env);
|
|
3495
|
+
} catch (err) {
|
|
3496
|
+
finish("failure", Exit.failCause(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", Exit.succeed(value));
|
|
3505
|
+
}).catch((err) => {
|
|
3506
|
+
if (done) {
|
|
3507
|
+
recordAbortablePromiseLateSettlement(label);
|
|
3508
|
+
return;
|
|
3509
|
+
}
|
|
3510
|
+
finish("failure", Exit.failCause(Cause.fail(onReject(err))), err);
|
|
3511
|
+
});
|
|
3512
|
+
return () => {
|
|
3513
|
+
if (done) return;
|
|
3514
|
+
try {
|
|
3515
|
+
controller.abort();
|
|
3516
|
+
} catch {
|
|
3517
|
+
}
|
|
3518
|
+
finish("interrupt", Exit.failCause(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
|
-
options.onFinish?.({
|
|
3375
|
-
label,
|
|
3376
|
-
outcome,
|
|
3377
|
-
durationMs: Math.round(performance.now() - startedAt),
|
|
3378
|
-
error
|
|
3379
|
-
});
|
|
3380
|
-
cb(exit);
|
|
3381
|
-
};
|
|
3382
|
-
recordAbortablePromiseStart(label);
|
|
3383
|
-
options.onStart?.(label);
|
|
3384
3526
|
if (timeoutMs !== void 0 && timeoutMs > 0) {
|
|
3385
|
-
|
|
3386
|
-
const reason = options.timeoutReason?.() ?? makeTimeoutReason(timeoutMs, label);
|
|
3387
|
-
try {
|
|
3388
|
-
controller.abort(reason);
|
|
3389
|
-
} catch {
|
|
3390
|
-
controller.abort();
|
|
3391
|
-
}
|
|
3392
|
-
finish("timeout", Exit.failCause(Cause.fail(onReject(reason))), reason);
|
|
3393
|
-
}, timeoutMs);
|
|
3394
|
-
}
|
|
3395
|
-
let promise;
|
|
3396
|
-
try {
|
|
3397
|
-
promise = make(controller.signal, env);
|
|
3398
|
-
} catch (err) {
|
|
3399
|
-
finish("failure", Exit.failCause(Cause.fail(onReject(err))), err);
|
|
3400
|
-
return () => void 0;
|
|
3527
|
+
return registerWithTimeout(make, onReject, options, env, cb, timeoutMs);
|
|
3401
3528
|
}
|
|
3402
|
-
|
|
3403
|
-
if (done) {
|
|
3404
|
-
recordAbortablePromiseLateSettlement(label);
|
|
3405
|
-
return;
|
|
3406
|
-
}
|
|
3407
|
-
finish("success", Exit.succeed(value));
|
|
3408
|
-
}).catch((err) => {
|
|
3409
|
-
if (done) {
|
|
3410
|
-
recordAbortablePromiseLateSettlement(label);
|
|
3411
|
-
return;
|
|
3412
|
-
}
|
|
3413
|
-
finish("failure", Exit.failCause(Cause.fail(onReject(err))), err);
|
|
3414
|
-
});
|
|
3415
|
-
return () => {
|
|
3416
|
-
if (done) return;
|
|
3417
|
-
try {
|
|
3418
|
-
controller.abort();
|
|
3419
|
-
} catch {
|
|
3420
|
-
}
|
|
3421
|
-
finish("interrupt", Exit.failCause(Cause.interrupt()));
|
|
3422
|
-
};
|
|
3529
|
+
return registerWithoutTimeout(make, onReject, options, env, cb);
|
|
3423
3530
|
}
|
|
3424
3531
|
};
|
|
3425
3532
|
}
|
|
@@ -4256,6 +4363,9 @@ export {
|
|
|
4256
4363
|
toPromiseByCaller,
|
|
4257
4364
|
unsafeRunAsync,
|
|
4258
4365
|
toPromise,
|
|
4366
|
+
setAbortablePromisePerLabelTracking,
|
|
4367
|
+
recordAbortablePromiseStart,
|
|
4368
|
+
recordAbortablePromiseFinish,
|
|
4259
4369
|
abortablePromiseStats,
|
|
4260
4370
|
resetAbortablePromiseStats,
|
|
4261
4371
|
fromPromiseAbortable,
|
|
@@ -1,6 +1,6 @@
|
|
|
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;
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk2JHJ4YHScjs = require('./chunk-2JHJ4YHS.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _chunkMVGUEJ5Zcjs = require('./chunk-MVGUEJ5Z.cjs');
|
|
@@ -164,7 +164,7 @@ var EventBus = (_class = class {
|
|
|
164
164
|
subscribe(handler, perSubscriberCapacity = 2048) {
|
|
165
165
|
this.subs.push({
|
|
166
166
|
handler,
|
|
167
|
-
q:
|
|
167
|
+
q: _chunk2JHJ4YHScjs.makeBoundedRingBuffer.call(void 0, perSubscriberCapacity, perSubscriberCapacity, this.options),
|
|
168
168
|
dropped: 0
|
|
169
169
|
});
|
|
170
170
|
return () => {
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkWGE2FEZEcjs = require('./chunk-WGE2FEZE.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunk2JHJ4YHScjs = require('./chunk-2JHJ4YHS.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
@@ -796,10 +796,10 @@ function makeOtlpHttpLogExporter(source, options) {
|
|
|
796
796
|
}
|
|
797
797
|
function logEffect(level, message, fields = {}) {
|
|
798
798
|
return _chunkMVGUEJ5Zcjs.asyncSync.call(void 0, () => {
|
|
799
|
-
const fiber =
|
|
799
|
+
const fiber = _chunk2JHJ4YHScjs.getCurrentFiber.call(void 0, );
|
|
800
800
|
const runtime = _optionalChain([fiber, 'optionalAccess', _34 => _34.runtime]);
|
|
801
801
|
if (!runtime) return;
|
|
802
|
-
const inherited = _optionalChain([fiber, 'access', _35 => _35.fiberContext, 'optionalAccess', _36 => _36.log]) ?
|
|
802
|
+
const inherited = _optionalChain([fiber, 'access', _35 => _35.fiberContext, 'optionalAccess', _36 => _36.log]) ? _chunk2JHJ4YHScjs.ctxToObject.call(void 0, fiber.fiberContext.log) : {};
|
|
803
803
|
runtime.log(level, message, { ...inherited, ...fields });
|
|
804
804
|
});
|
|
805
805
|
}
|
|
@@ -815,11 +815,11 @@ function withLogContext(patch, effect) {
|
|
|
815
815
|
}
|
|
816
816
|
function startLogContext(patch) {
|
|
817
817
|
return _chunkMVGUEJ5Zcjs.asyncSync.call(void 0, () => {
|
|
818
|
-
const fiber =
|
|
818
|
+
const fiber = _chunk2JHJ4YHScjs.getCurrentFiber.call(void 0, );
|
|
819
819
|
if (!_optionalChain([fiber, 'optionalAccess', _37 => _37.fiberContext])) return void 0;
|
|
820
|
-
const previous = _nullishCoalesce(fiber.fiberContext.log, () => (
|
|
820
|
+
const previous = _nullishCoalesce(fiber.fiberContext.log, () => ( _chunk2JHJ4YHScjs.emptyContext));
|
|
821
821
|
const state = { fiber, previous, ended: false };
|
|
822
|
-
fiber.fiberContext = { ...fiber.fiberContext, log:
|
|
822
|
+
fiber.fiberContext = { ...fiber.fiberContext, log: _chunk2JHJ4YHScjs.ctxExtend.call(void 0, previous, patch) };
|
|
823
823
|
_optionalChain([fiber, 'access', _38 => _38.addFinalizer, 'optionalCall', _39 => _39(() => restoreLogContext(state))]);
|
|
824
824
|
return state;
|
|
825
825
|
});
|
|
@@ -994,7 +994,7 @@ function spanLink(trace, attributes) {
|
|
|
994
994
|
};
|
|
995
995
|
}
|
|
996
996
|
function currentSpanLink(attributes) {
|
|
997
|
-
const fiber =
|
|
997
|
+
const fiber = _chunk2JHJ4YHScjs.getCurrentFiber.call(void 0, );
|
|
998
998
|
const trace = _optionalChain([fiber, 'optionalAccess', _46 => _46.fiberContext, 'optionalAccess', _47 => _47.trace]);
|
|
999
999
|
return _optionalChain([trace, 'optionalAccess', _48 => _48.traceId]) && _optionalChain([trace, 'optionalAccess', _49 => _49.spanId]) ? spanLink(trace, attributes) : void 0;
|
|
1000
1000
|
}
|
|
@@ -1009,13 +1009,13 @@ function withBaggage(baggage, effect) {
|
|
|
1009
1009
|
);
|
|
1010
1010
|
}
|
|
1011
1011
|
function currentBaggage() {
|
|
1012
|
-
const fiber =
|
|
1012
|
+
const fiber = _chunk2JHJ4YHScjs.getCurrentFiber.call(void 0, );
|
|
1013
1013
|
const baggage = _optionalChain([fiber, 'optionalAccess', _50 => _50.fiberContext, 'optionalAccess', _51 => _51.trace, 'optionalAccess', _52 => _52.baggage]);
|
|
1014
1014
|
return baggage ? { ...baggage } : void 0;
|
|
1015
1015
|
}
|
|
1016
1016
|
function spanEvent(name, attributes = {}) {
|
|
1017
1017
|
return _chunkMVGUEJ5Zcjs.asyncSync.call(void 0, () => {
|
|
1018
|
-
const fiber =
|
|
1018
|
+
const fiber = _chunk2JHJ4YHScjs.getCurrentFiber.call(void 0, );
|
|
1019
1019
|
const trace = _optionalChain([fiber, 'optionalAccess', _53 => _53.fiberContext, 'optionalAccess', _54 => _54.trace]);
|
|
1020
1020
|
if (!_optionalChain([fiber, 'optionalAccess', _55 => _55.runtime]) || !trace || trace.sampled === false) return;
|
|
1021
1021
|
fiber.runtime.hooks.emit(
|
|
@@ -1049,7 +1049,7 @@ function makeOtlpHttpSpanExporter(source, options) {
|
|
|
1049
1049
|
}
|
|
1050
1050
|
function startSpan(name, options) {
|
|
1051
1051
|
return _chunkMVGUEJ5Zcjs.asyncSync.call(void 0, () => {
|
|
1052
|
-
const fiber =
|
|
1052
|
+
const fiber = _chunk2JHJ4YHScjs.getCurrentFiber.call(void 0, );
|
|
1053
1053
|
const runtime = _optionalChain([fiber, 'optionalAccess', _56 => _56.runtime]);
|
|
1054
1054
|
if (!_optionalChain([fiber, 'optionalAccess', _57 => _57.fiberContext]) || !runtime) return void 0;
|
|
1055
1055
|
const previousTrace = _nullishCoalesce(fiber.fiberContext.trace, () => ( null));
|
|
@@ -1132,7 +1132,7 @@ function spanContext(fiber, trace) {
|
|
|
1132
1132
|
}
|
|
1133
1133
|
function startBaggage(baggage) {
|
|
1134
1134
|
return _chunkMVGUEJ5Zcjs.asyncSync.call(void 0, () => {
|
|
1135
|
-
const fiber =
|
|
1135
|
+
const fiber = _chunk2JHJ4YHScjs.getCurrentFiber.call(void 0, );
|
|
1136
1136
|
if (!_optionalChain([fiber, 'optionalAccess', _76 => _76.fiberContext])) return void 0;
|
|
1137
1137
|
const previousTrace = _nullishCoalesce(fiber.fiberContext.trace, () => ( null));
|
|
1138
1138
|
if (!previousTrace) return void 0;
|
|
@@ -1620,12 +1620,12 @@ function normalizeOtlpEndpoint(endpoint) {
|
|
|
1620
1620
|
function makeObservability(options = {}) {
|
|
1621
1621
|
validateObservabilityOptions(options);
|
|
1622
1622
|
const serviceName = _nullishCoalesce(options.serviceName, () => ( "brass-runtime"));
|
|
1623
|
-
const eventBus = _nullishCoalesce(options.eventBus, () => ( new (0,
|
|
1624
|
-
const rawMetrics =
|
|
1623
|
+
const eventBus = _nullishCoalesce(options.eventBus, () => ( new (0, _chunkWGE2FEZEcjs.EventBus)()));
|
|
1624
|
+
const rawMetrics = _chunkWGE2FEZEcjs.makeMetrics.call(void 0, );
|
|
1625
1625
|
const metrics = options.cardinality === false ? rawMetrics : makeCardinalityLimitedMetrics(rawMetrics, _nullishCoalesce(options.cardinality, () => ( {})));
|
|
1626
1626
|
const redactor = makeObservabilityRedactor(options.redaction);
|
|
1627
1627
|
const traceOptions = options.traces && typeof options.traces === "object" ? options.traces : {};
|
|
1628
|
-
const tracer = new (0,
|
|
1628
|
+
const tracer = new (0, _chunkWGE2FEZEcjs.InMemoryTracer)({
|
|
1629
1629
|
maxFinishedSpans: _nullishCoalesce(traceOptions.maxFinishedSpans, () => ( 1e4)),
|
|
1630
1630
|
maxSpanAgeMs: _nullishCoalesce(traceOptions.maxSpanAgeMs, () => ( 10 * 6e4)),
|
|
1631
1631
|
clock: traceOptions.clock,
|
|
@@ -1982,7 +1982,7 @@ function makeRequestObservabilityContext(observability, input = {}) {
|
|
|
1982
1982
|
const env = observability.envForRequest(input);
|
|
1983
1983
|
const attributes = requestSpanAttributes(input);
|
|
1984
1984
|
const defaultSpanName = _nullishCoalesce(input.spanName, () => ( (input.method && input.route ? `${input.method} ${input.route}` : _nullishCoalesce(input.route, () => ( "request")))));
|
|
1985
|
-
const makeRuntime = (extraEnv, options = {}) => new (0,
|
|
1985
|
+
const makeRuntime = (extraEnv, options = {}) => new (0, _chunk2JHJ4YHScjs.Runtime)({
|
|
1986
1986
|
...options,
|
|
1987
1987
|
env: mergeEnv(extraEnv, env),
|
|
1988
1988
|
hooks: observability.hooks
|