File tree 2 files changed +16
-0
lines changed
2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " effect " : minor
3
+ ---
4
+
5
+ Add Layer.setRandom, for over-riding the default Random service
Original file line number Diff line number Diff line change @@ -32,9 +32,11 @@ import * as fiberRuntime from "./internal/fiberRuntime.js"
32
32
import * as internal from "./internal/layer.js"
33
33
import * as circularLayer from "./internal/layer/circular.js"
34
34
import * as query from "./internal/query.js"
35
+ import { randomTag } from "./internal/random.js"
35
36
import type { LogLevel } from "./LogLevel.js"
36
37
import type * as Option from "./Option.js"
37
38
import type { Pipeable } from "./Pipeable.js"
39
+ import type * as Random from "./Random.js"
38
40
import type * as Request from "./Request.js"
39
41
import type * as Runtime from "./Runtime.js"
40
42
import type * as Schedule from "./Schedule.js"
@@ -945,6 +947,15 @@ export const setConfigProvider: (configProvider: ConfigProvider) => Layer<never>
945
947
*/
946
948
export const parentSpan : ( span : Tracer . AnySpan ) => Layer < Tracer . ParentSpan > = circularLayer . parentSpan
947
949
950
+ /**
951
+ * @since 3.15.0
952
+ * @category Random
953
+ */
954
+ export const setRandom = < A extends Random . Random > ( random : A ) : Layer < never > =>
955
+ scopedDiscard (
956
+ fiberRuntime . fiberRefLocallyScopedWith ( defaultServices . currentServices , Context . add ( randomTag , random ) )
957
+ )
958
+
948
959
/**
949
960
* @since 2.0.0
950
961
* @category requests & batching
You can’t perform that action at this time.
0 commit comments