effect 4.0.0-beta.102 → 4.0.0-beta.103
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/Array.d.ts +971 -1037
- package/dist/Array.d.ts.map +1 -1
- package/dist/Array.js +381 -407
- package/dist/Array.js.map +1 -1
- package/dist/BigDecimal.d.ts +433 -756
- package/dist/BigDecimal.d.ts.map +1 -1
- package/dist/BigDecimal.js +200 -325
- package/dist/BigDecimal.js.map +1 -1
- package/dist/BigInt.d.ts +207 -267
- package/dist/BigInt.d.ts.map +1 -1
- package/dist/BigInt.js +107 -135
- package/dist/BigInt.js.map +1 -1
- package/dist/Boolean.d.ts +146 -188
- package/dist/Boolean.d.ts.map +1 -1
- package/dist/Boolean.js +64 -84
- package/dist/Boolean.js.map +1 -1
- package/dist/Brand.js.map +1 -1
- package/dist/Cache.d.ts +405 -254
- package/dist/Cache.d.ts.map +1 -1
- package/dist/Cache.js +166 -101
- package/dist/Cache.js.map +1 -1
- package/dist/Cause.d.ts +167 -277
- package/dist/Cause.d.ts.map +1 -1
- package/dist/Cause.js +122 -176
- package/dist/Cause.js.map +1 -1
- package/dist/Channel.d.ts +729 -768
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js +514 -440
- package/dist/Channel.js.map +1 -1
- package/dist/ChannelSchema.d.ts +1 -1
- package/dist/ChannelSchema.d.ts.map +1 -1
- package/dist/ChannelSchema.js.map +1 -1
- package/dist/Chunk.d.ts +834 -1173
- package/dist/Chunk.d.ts.map +1 -1
- package/dist/Chunk.js +326 -439
- package/dist/Chunk.js.map +1 -1
- package/dist/Clock.d.ts +180 -49
- package/dist/Clock.d.ts.map +1 -1
- package/dist/Clock.js +96 -31
- package/dist/Clock.js.map +1 -1
- package/dist/Combiner.d.ts +20 -33
- package/dist/Combiner.d.ts.map +1 -1
- package/dist/Combiner.js +18 -30
- package/dist/Combiner.js.map +1 -1
- package/dist/Config.d.ts +225 -173
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +336 -265
- package/dist/Config.js.map +1 -1
- package/dist/ConfigProvider.d.ts +194 -68
- package/dist/ConfigProvider.d.ts.map +1 -1
- package/dist/ConfigProvider.js +115 -80
- package/dist/ConfigProvider.js.map +1 -1
- package/dist/Console.d.ts +233 -33
- package/dist/Console.d.ts.map +1 -1
- package/dist/Console.js +232 -32
- package/dist/Console.js.map +1 -1
- package/dist/Context.d.ts +151 -274
- package/dist/Context.d.ts.map +1 -1
- package/dist/Context.js +171 -214
- package/dist/Context.js.map +1 -1
- package/dist/Cron.d.ts +68 -77
- package/dist/Cron.d.ts.map +1 -1
- package/dist/Cron.js +57 -66
- package/dist/Cron.js.map +1 -1
- package/dist/Crypto.d.ts +13 -15
- package/dist/Crypto.d.ts.map +1 -1
- package/dist/Crypto.js +9 -10
- package/dist/Crypto.js.map +1 -1
- package/dist/Data.d.ts +60 -80
- package/dist/Data.d.ts.map +1 -1
- package/dist/Data.js +16 -23
- package/dist/Data.js.map +1 -1
- package/dist/DateTime.d.ts +562 -660
- package/dist/DateTime.d.ts.map +1 -1
- package/dist/DateTime.js +307 -362
- package/dist/DateTime.js.map +1 -1
- package/dist/Deferred.d.ts +253 -256
- package/dist/Deferred.d.ts.map +1 -1
- package/dist/Deferred.js +104 -96
- package/dist/Deferred.js.map +1 -1
- package/dist/Duration.d.ts +216 -308
- package/dist/Duration.d.ts.map +1 -1
- package/dist/Duration.js +132 -186
- package/dist/Duration.js.map +1 -1
- package/dist/Effect.d.ts +2841 -3247
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +1322 -1546
- package/dist/Effect.js.map +1 -1
- package/dist/Effectable.js.map +1 -1
- package/dist/Encoding.d.ts +22 -40
- package/dist/Encoding.d.ts.map +1 -1
- package/dist/Encoding.js +22 -40
- package/dist/Encoding.js.map +1 -1
- package/dist/Equal.d.ts +33 -37
- package/dist/Equal.d.ts.map +1 -1
- package/dist/Equal.js +29 -21
- package/dist/Equal.js.map +1 -1
- package/dist/Equivalence.d.ts +103 -105
- package/dist/Equivalence.d.ts.map +1 -1
- package/dist/Equivalence.js +77 -79
- package/dist/Equivalence.js.map +1 -1
- package/dist/ErrorReporter.d.ts +51 -27
- package/dist/ErrorReporter.d.ts.map +1 -1
- package/dist/ErrorReporter.js +50 -26
- package/dist/ErrorReporter.js.map +1 -1
- package/dist/ExecutionPlan.d.ts +13 -55
- package/dist/ExecutionPlan.d.ts.map +1 -1
- package/dist/ExecutionPlan.js +7 -28
- package/dist/ExecutionPlan.js.map +1 -1
- package/dist/Exit.d.ts +116 -192
- package/dist/Exit.d.ts.map +1 -1
- package/dist/Exit.js +82 -130
- package/dist/Exit.js.map +1 -1
- package/dist/Fiber.d.ts +82 -146
- package/dist/Fiber.d.ts.map +1 -1
- package/dist/Fiber.js +48 -87
- package/dist/Fiber.js.map +1 -1
- package/dist/FiberHandle.d.ts +152 -105
- package/dist/FiberHandle.d.ts.map +1 -1
- package/dist/FiberHandle.js +106 -73
- package/dist/FiberHandle.js.map +1 -1
- package/dist/FiberMap.d.ts +213 -168
- package/dist/FiberMap.d.ts.map +1 -1
- package/dist/FiberMap.js +114 -89
- package/dist/FiberMap.js.map +1 -1
- package/dist/FiberSet.d.ts +123 -81
- package/dist/FiberSet.d.ts.map +1 -1
- package/dist/FiberSet.js +85 -59
- package/dist/FiberSet.js.map +1 -1
- package/dist/FileSystem.d.ts +153 -264
- package/dist/FileSystem.d.ts.map +1 -1
- package/dist/FileSystem.js +42 -147
- package/dist/FileSystem.js.map +1 -1
- package/dist/Filter.d.ts +61 -33
- package/dist/Filter.d.ts.map +1 -1
- package/dist/Filter.js +26 -15
- package/dist/Filter.js.map +1 -1
- package/dist/Formatter.d.ts +25 -33
- package/dist/Formatter.d.ts.map +1 -1
- package/dist/Formatter.js +48 -49
- package/dist/Formatter.js.map +1 -1
- package/dist/Function.d.ts +76 -145
- package/dist/Function.d.ts.map +1 -1
- package/dist/Function.js +40 -57
- package/dist/Function.js.map +1 -1
- package/dist/Graph.d.ts +360 -714
- package/dist/Graph.d.ts.map +1 -1
- package/dist/Graph.js +168 -297
- package/dist/Graph.js.map +1 -1
- package/dist/HKT.d.ts +12 -6
- package/dist/HKT.d.ts.map +1 -1
- package/dist/Hash.d.ts +47 -83
- package/dist/Hash.d.ts.map +1 -1
- package/dist/Hash.js +46 -68
- package/dist/Hash.js.map +1 -1
- package/dist/HashMap.d.ts +319 -411
- package/dist/HashMap.d.ts.map +1 -1
- package/dist/HashMap.js +122 -166
- package/dist/HashMap.js.map +1 -1
- package/dist/HashRing.d.ts.map +1 -1
- package/dist/HashRing.js +1 -0
- package/dist/HashRing.js.map +1 -1
- package/dist/HashSet.d.ts +177 -284
- package/dist/HashSet.d.ts.map +1 -1
- package/dist/HashSet.js +68 -109
- package/dist/HashSet.js.map +1 -1
- package/dist/Inspectable.d.ts +12 -12
- package/dist/Inspectable.js +8 -8
- package/dist/Inspectable.js.map +1 -1
- package/dist/Iterable.d.ts +620 -786
- package/dist/Iterable.d.ts.map +1 -1
- package/dist/Iterable.js +228 -306
- package/dist/Iterable.js.map +1 -1
- package/dist/JsonPatch.d.ts +11 -13
- package/dist/JsonPatch.d.ts.map +1 -1
- package/dist/JsonPatch.js +44 -102
- package/dist/JsonPatch.js.map +1 -1
- package/dist/JsonPointer.d.ts +8 -8
- package/dist/JsonPointer.js +8 -8
- package/dist/JsonPointer.js.map +1 -1
- package/dist/JsonSchema.d.ts +98 -44
- package/dist/JsonSchema.d.ts.map +1 -1
- package/dist/JsonSchema.js +297 -234
- package/dist/JsonSchema.js.map +1 -1
- package/dist/Latch.d.ts +23 -35
- package/dist/Latch.d.ts.map +1 -1
- package/dist/Latch.js +16 -28
- package/dist/Latch.js.map +1 -1
- package/dist/Layer.d.ts +359 -260
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +195 -175
- package/dist/Layer.js.map +1 -1
- package/dist/LayerMap.d.ts +42 -29
- package/dist/LayerMap.d.ts.map +1 -1
- package/dist/LayerMap.js +31 -21
- package/dist/LayerMap.js.map +1 -1
- package/dist/LayerRef.d.ts +6 -2
- package/dist/LayerRef.d.ts.map +1 -1
- package/dist/LayerRef.js +6 -2
- package/dist/LayerRef.js.map +1 -1
- package/dist/LogLevel.d.ts +114 -214
- package/dist/LogLevel.d.ts.map +1 -1
- package/dist/LogLevel.js +41 -76
- package/dist/LogLevel.js.map +1 -1
- package/dist/Logger.d.ts +218 -467
- package/dist/Logger.d.ts.map +1 -1
- package/dist/Logger.js +204 -450
- package/dist/Logger.js.map +1 -1
- package/dist/ManagedRuntime.d.ts +7 -5
- package/dist/ManagedRuntime.d.ts.map +1 -1
- package/dist/ManagedRuntime.js +7 -5
- package/dist/ManagedRuntime.js.map +1 -1
- package/dist/Match.d.ts +217 -252
- package/dist/Match.d.ts.map +1 -1
- package/dist/Match.js +150 -183
- package/dist/Match.js.map +1 -1
- package/dist/Metric.d.ts +442 -993
- package/dist/Metric.d.ts.map +1 -1
- package/dist/Metric.js +198 -642
- package/dist/Metric.js.map +1 -1
- package/dist/MutableHashMap.d.ts +144 -173
- package/dist/MutableHashMap.d.ts.map +1 -1
- package/dist/MutableHashMap.js +68 -79
- package/dist/MutableHashMap.js.map +1 -1
- package/dist/MutableHashSet.d.ts +84 -89
- package/dist/MutableHashSet.d.ts.map +1 -1
- package/dist/MutableHashSet.js +44 -47
- package/dist/MutableHashSet.js.map +1 -1
- package/dist/MutableList.d.ts +71 -370
- package/dist/MutableList.d.ts.map +1 -1
- package/dist/MutableList.js +59 -284
- package/dist/MutableList.js.map +1 -1
- package/dist/MutableRef.d.ts +420 -243
- package/dist/MutableRef.d.ts.map +1 -1
- package/dist/MutableRef.js +209 -120
- package/dist/MutableRef.js.map +1 -1
- package/dist/Newtype.d.ts +21 -14
- package/dist/Newtype.d.ts.map +1 -1
- package/dist/Newtype.js +15 -13
- package/dist/Newtype.js.map +1 -1
- package/dist/NonEmptyIterable.d.ts +7 -137
- package/dist/NonEmptyIterable.d.ts.map +1 -1
- package/dist/NonEmptyIterable.js +5 -93
- package/dist/NonEmptyIterable.js.map +1 -1
- package/dist/Number.d.ts +196 -233
- package/dist/Number.d.ts.map +1 -1
- package/dist/Number.js +90 -109
- package/dist/Number.js.map +1 -1
- package/dist/Optic.d.ts +97 -189
- package/dist/Optic.d.ts.map +1 -1
- package/dist/Optic.js +187 -290
- package/dist/Optic.js.map +1 -1
- package/dist/Option.d.ts +447 -812
- package/dist/Option.d.ts.map +1 -1
- package/dist/Option.js +211 -392
- package/dist/Option.js.map +1 -1
- package/dist/Order.d.ts +109 -109
- package/dist/Order.js +91 -91
- package/dist/Order.js.map +1 -1
- package/dist/Ordering.d.ts +20 -23
- package/dist/Ordering.d.ts.map +1 -1
- package/dist/Ordering.js +8 -9
- package/dist/Ordering.js.map +1 -1
- package/dist/PartitionedSemaphore.js.map +1 -1
- package/dist/Path.d.ts +38 -41
- package/dist/Path.d.ts.map +1 -1
- package/dist/Path.js +3 -4
- package/dist/Path.js.map +1 -1
- package/dist/Pipeable.d.ts +6 -5
- package/dist/Pipeable.d.ts.map +1 -1
- package/dist/Pipeable.js +2 -2
- package/dist/Pipeable.js.map +1 -1
- package/dist/PlatformError.d.ts +4 -4
- package/dist/PlatformError.js +3 -3
- package/dist/PlatformError.js.map +1 -1
- package/dist/Pool.d.ts +4 -2
- package/dist/Pool.d.ts.map +1 -1
- package/dist/Pool.js +4 -2
- package/dist/Pool.js.map +1 -1
- package/dist/Predicate.d.ts +200 -181
- package/dist/Predicate.d.ts.map +1 -1
- package/dist/Predicate.js +100 -108
- package/dist/Predicate.js.map +1 -1
- package/dist/PrimaryKey.d.ts +7 -7
- package/dist/PrimaryKey.js +5 -5
- package/dist/PrimaryKey.js.map +1 -1
- package/dist/PubSub.d.ts +425 -494
- package/dist/PubSub.d.ts.map +1 -1
- package/dist/PubSub.js +373 -362
- package/dist/PubSub.js.map +1 -1
- package/dist/Pull.d.ts +24 -18
- package/dist/Pull.d.ts.map +1 -1
- package/dist/Pull.js +11 -9
- package/dist/Pull.js.map +1 -1
- package/dist/Queue.d.ts +200 -159
- package/dist/Queue.d.ts.map +1 -1
- package/dist/Queue.js +162 -132
- package/dist/Queue.js.map +1 -1
- package/dist/Random.d.ts +49 -74
- package/dist/Random.d.ts.map +1 -1
- package/dist/Random.js +35 -54
- package/dist/Random.js.map +1 -1
- package/dist/RcMap.d.ts +121 -63
- package/dist/RcMap.d.ts.map +1 -1
- package/dist/RcMap.js +42 -21
- package/dist/RcMap.js.map +1 -1
- package/dist/RcRef.d.ts +24 -13
- package/dist/RcRef.d.ts.map +1 -1
- package/dist/RcRef.js +15 -9
- package/dist/RcRef.js.map +1 -1
- package/dist/Record.d.ts +291 -488
- package/dist/Record.d.ts.map +1 -1
- package/dist/Record.js +111 -202
- package/dist/Record.js.map +1 -1
- package/dist/Redactable.d.ts +6 -2
- package/dist/Redactable.d.ts.map +1 -1
- package/dist/Redactable.js +7 -2
- package/dist/Redactable.js.map +1 -1
- package/dist/Redacted.d.ts +25 -25
- package/dist/Redacted.d.ts.map +1 -1
- package/dist/Redacted.js +19 -20
- package/dist/Redacted.js.map +1 -1
- package/dist/Reducer.d.ts +8 -15
- package/dist/Reducer.d.ts.map +1 -1
- package/dist/Reducer.js +6 -12
- package/dist/Reducer.js.map +1 -1
- package/dist/Ref.d.ts +95 -165
- package/dist/Ref.d.ts.map +1 -1
- package/dist/Ref.js +75 -122
- package/dist/Ref.js.map +1 -1
- package/dist/References.d.ts +102 -168
- package/dist/References.d.ts.map +1 -1
- package/dist/References.js +102 -168
- package/dist/References.js.map +1 -1
- package/dist/RegExp.d.ts +10 -14
- package/dist/RegExp.d.ts.map +1 -1
- package/dist/RegExp.js +10 -14
- package/dist/RegExp.js.map +1 -1
- package/dist/Request.d.ts +31 -21
- package/dist/Request.d.ts.map +1 -1
- package/dist/Request.js +16 -13
- package/dist/Request.js.map +1 -1
- package/dist/RequestResolver.d.ts +201 -90
- package/dist/RequestResolver.d.ts.map +1 -1
- package/dist/RequestResolver.js +87 -41
- package/dist/RequestResolver.js.map +1 -1
- package/dist/Resource.js.map +1 -1
- package/dist/Result.d.ts +302 -470
- package/dist/Result.d.ts.map +1 -1
- package/dist/Result.js +133 -217
- package/dist/Result.js.map +1 -1
- package/dist/Runtime.d.ts +50 -75
- package/dist/Runtime.d.ts.map +1 -1
- package/dist/Runtime.js +39 -60
- package/dist/Runtime.js.map +1 -1
- package/dist/Schedule.d.ts +290 -1636
- package/dist/Schedule.d.ts.map +1 -1
- package/dist/Schedule.js +162 -803
- package/dist/Schedule.js.map +1 -1
- package/dist/Scheduler.d.ts +5 -5
- package/dist/Scheduler.d.ts.map +1 -1
- package/dist/Scheduler.js +18 -6
- package/dist/Scheduler.js.map +1 -1
- package/dist/Schema.d.ts +644 -642
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +491 -527
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +27 -50
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +366 -279
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaError.d.ts +7 -6
- package/dist/SchemaError.d.ts.map +1 -1
- package/dist/SchemaError.js +7 -6
- package/dist/SchemaError.js.map +1 -1
- package/dist/SchemaGetter.d.ts +217 -174
- package/dist/SchemaGetter.d.ts.map +1 -1
- package/dist/SchemaGetter.js +218 -185
- package/dist/SchemaGetter.js.map +1 -1
- package/dist/SchemaIssue.d.ts +62 -190
- package/dist/SchemaIssue.d.ts.map +1 -1
- package/dist/SchemaIssue.js +73 -265
- package/dist/SchemaIssue.js.map +1 -1
- package/dist/SchemaParser.d.ts +2 -2
- package/dist/SchemaParser.d.ts.map +1 -1
- package/dist/SchemaParser.js +123 -75
- package/dist/SchemaParser.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +22 -36
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +20 -26
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts +114 -74
- package/dist/SchemaTransformation.d.ts.map +1 -1
- package/dist/SchemaTransformation.js +120 -85
- package/dist/SchemaTransformation.js.map +1 -1
- package/dist/Scope.d.ts +123 -151
- package/dist/Scope.d.ts.map +1 -1
- package/dist/Scope.js +72 -92
- package/dist/Scope.js.map +1 -1
- package/dist/ScopedCache.js.map +1 -1
- package/dist/ScopedRef.d.ts +3 -3
- package/dist/ScopedRef.js +2 -2
- package/dist/ScopedRef.js.map +1 -1
- package/dist/Semaphore.d.ts +96 -10
- package/dist/Semaphore.d.ts.map +1 -1
- package/dist/Semaphore.js +78 -39
- package/dist/Semaphore.js.map +1 -1
- package/dist/Sink.d.ts +117 -107
- package/dist/Sink.d.ts.map +1 -1
- package/dist/Sink.js +107 -100
- package/dist/Sink.js.map +1 -1
- package/dist/Stdio.d.ts +1 -1
- package/dist/Stdio.js.map +1 -1
- package/dist/Stream.d.ts +2415 -2949
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +1078 -1381
- package/dist/Stream.js.map +1 -1
- package/dist/String.d.ts +262 -308
- package/dist/String.d.ts.map +1 -1
- package/dist/String.js +184 -215
- package/dist/String.js.map +1 -1
- package/dist/Struct.d.ts +109 -114
- package/dist/Struct.d.ts.map +1 -1
- package/dist/Struct.js +41 -50
- package/dist/Struct.js.map +1 -1
- package/dist/SubscriptionRef.d.ts +282 -250
- package/dist/SubscriptionRef.d.ts.map +1 -1
- package/dist/SubscriptionRef.js +104 -92
- package/dist/SubscriptionRef.js.map +1 -1
- package/dist/Symbol.d.ts +3 -3
- package/dist/Symbol.js +3 -3
- package/dist/Symbol.js.map +1 -1
- package/dist/SynchronizedRef.js.map +1 -1
- package/dist/Take.js.map +1 -1
- package/dist/Terminal.d.ts +2 -2
- package/dist/Terminal.js +1 -1
- package/dist/Terminal.js.map +1 -1
- package/dist/Tracer.d.ts +100 -54
- package/dist/Tracer.d.ts.map +1 -1
- package/dist/Tracer.js +41 -24
- package/dist/Tracer.js.map +1 -1
- package/dist/Trie.d.ts +287 -679
- package/dist/Trie.d.ts.map +1 -1
- package/dist/Trie.js +109 -251
- package/dist/Trie.js.map +1 -1
- package/dist/Tuple.d.ts +92 -127
- package/dist/Tuple.d.ts.map +1 -1
- package/dist/Tuple.js +42 -57
- package/dist/Tuple.js.map +1 -1
- package/dist/TxChunk.d.ts +201 -121
- package/dist/TxChunk.d.ts.map +1 -1
- package/dist/TxChunk.js +85 -56
- package/dist/TxChunk.js.map +1 -1
- package/dist/TxDeferred.d.ts +62 -46
- package/dist/TxDeferred.d.ts.map +1 -1
- package/dist/TxDeferred.js +30 -22
- package/dist/TxDeferred.js.map +1 -1
- package/dist/TxHashMap.d.ts +631 -779
- package/dist/TxHashMap.d.ts.map +1 -1
- package/dist/TxHashMap.js +268 -330
- package/dist/TxHashMap.js.map +1 -1
- package/dist/TxHashSet.d.ts +297 -236
- package/dist/TxHashSet.d.ts.map +1 -1
- package/dist/TxHashSet.js +130 -100
- package/dist/TxHashSet.js.map +1 -1
- package/dist/TxPriorityQueue.d.ts +126 -95
- package/dist/TxPriorityQueue.d.ts.map +1 -1
- package/dist/TxPriorityQueue.js +74 -56
- package/dist/TxPriorityQueue.js.map +1 -1
- package/dist/TxPubSub.d.ts +101 -88
- package/dist/TxPubSub.d.ts.map +1 -1
- package/dist/TxPubSub.js +87 -66
- package/dist/TxPubSub.js.map +1 -1
- package/dist/TxQueue.d.ts +200 -180
- package/dist/TxQueue.d.ts.map +1 -1
- package/dist/TxQueue.js +160 -136
- package/dist/TxQueue.js.map +1 -1
- package/dist/TxReentrantLock.d.ts +97 -66
- package/dist/TxReentrantLock.d.ts.map +1 -1
- package/dist/TxReentrantLock.js +67 -45
- package/dist/TxReentrantLock.js.map +1 -1
- package/dist/TxRef.d.ts +51 -32
- package/dist/TxRef.d.ts.map +1 -1
- package/dist/TxRef.js +23 -15
- package/dist/TxRef.js.map +1 -1
- package/dist/TxSemaphore.d.ts +129 -95
- package/dist/TxSemaphore.d.ts.map +1 -1
- package/dist/TxSemaphore.js +85 -70
- package/dist/TxSemaphore.js.map +1 -1
- package/dist/TxSubscriptionRef.d.ts +97 -70
- package/dist/TxSubscriptionRef.d.ts.map +1 -1
- package/dist/TxSubscriptionRef.js +44 -34
- package/dist/TxSubscriptionRef.js.map +1 -1
- package/dist/Types.d.ts +126 -67
- package/dist/Types.d.ts.map +1 -1
- package/dist/UndefinedOr.js.map +1 -1
- package/dist/Unify.d.ts +45 -65
- package/dist/Unify.d.ts.map +1 -1
- package/dist/Unify.js +6 -9
- package/dist/Unify.js.map +1 -1
- package/dist/Utils.d.ts +23 -16
- package/dist/Utils.d.ts.map +1 -1
- package/dist/Utils.js +3 -7
- package/dist/Utils.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/internal/array.js.map +1 -1
- package/dist/internal/core.js +1 -1
- package/dist/internal/core.js.map +1 -1
- package/dist/internal/dateTime.js +4 -0
- package/dist/internal/dateTime.js.map +1 -1
- package/dist/internal/doNotation.js.map +1 -1
- package/dist/internal/effect.js +77 -40
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/equal.js.map +1 -1
- package/dist/internal/errors.js.map +1 -1
- package/dist/internal/executionPlan.js.map +1 -1
- package/dist/internal/hashMap.js.map +1 -1
- package/dist/internal/hashSet.js.map +1 -1
- package/dist/internal/layer.js.map +1 -1
- package/dist/internal/matcher.js.map +1 -1
- package/dist/internal/metric.js.map +1 -1
- package/dist/internal/option.js.map +1 -1
- package/dist/internal/persistence.d.ts +2 -0
- package/dist/internal/persistence.d.ts.map +1 -0
- package/dist/internal/persistence.js +3 -0
- package/dist/internal/persistence.js.map +1 -0
- package/dist/internal/random.js.map +1 -1
- package/dist/internal/rcRef.js.map +1 -1
- package/dist/internal/record.js.map +1 -1
- package/dist/internal/redacted.js.map +1 -1
- package/dist/internal/references.js +3 -0
- package/dist/internal/references.js.map +1 -1
- package/dist/internal/request.js.map +1 -1
- package/dist/internal/result.js.map +1 -1
- package/dist/internal/schedule.js.map +1 -1
- package/dist/internal/schema/annotations.js.map +1 -1
- package/dist/internal/schema/cause.js.map +1 -1
- package/dist/internal/schema/fromJsonSchemaDocument.js +13 -11
- package/dist/internal/schema/fromJsonSchemaDocument.js.map +1 -1
- package/dist/internal/schema/fromRepresentation.js +8 -15
- package/dist/internal/schema/fromRepresentation.js.map +1 -1
- package/dist/internal/schema/parser.d.ts +14 -0
- package/dist/internal/schema/parser.d.ts.map +1 -0
- package/dist/internal/schema/parser.js +13 -0
- package/dist/internal/schema/parser.js.map +1 -0
- package/dist/internal/schema/schema.js.map +1 -1
- package/dist/internal/schema/toArbitrary.js.map +1 -1
- package/dist/internal/schema/toCodeDocument.js.map +1 -1
- package/dist/internal/schema/toEquivalence.js.map +1 -1
- package/dist/internal/schema/toJsonSchemaDocument.js +48 -6
- package/dist/internal/schema/toJsonSchemaDocument.js.map +1 -1
- package/dist/internal/schema/toRepresentation.js +87 -107
- package/dist/internal/schema/toRepresentation.js.map +1 -1
- package/dist/internal/stackTraceLimit.js.map +1 -1
- package/dist/internal/stream.js.map +1 -1
- package/dist/internal/tracer.js.map +1 -1
- package/dist/internal/trie.js +13 -9
- package/dist/internal/trie.js.map +1 -1
- package/dist/testing/FastCheck.d.ts +8 -7
- package/dist/testing/FastCheck.d.ts.map +1 -1
- package/dist/testing/FastCheck.js +8 -7
- package/dist/testing/FastCheck.js.map +1 -1
- package/dist/testing/TestClock.d.ts +57 -28
- package/dist/testing/TestClock.d.ts.map +1 -1
- package/dist/testing/TestClock.js +50 -18
- package/dist/testing/TestClock.js.map +1 -1
- package/dist/testing/TestConsole.d.ts +32 -31
- package/dist/testing/TestConsole.d.ts.map +1 -1
- package/dist/testing/TestConsole.js +24 -22
- package/dist/testing/TestConsole.js.map +1 -1
- package/dist/testing/TestSchema.d.ts +29 -29
- package/dist/testing/TestSchema.js +25 -25
- package/dist/testing/TestSchema.js.map +1 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/unstable/ai/AiError.d.ts +95 -118
- package/dist/unstable/ai/AiError.d.ts.map +1 -1
- package/dist/unstable/ai/AiError.js +94 -117
- package/dist/unstable/ai/AiError.js.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.js +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Chat.d.ts +132 -97
- package/dist/unstable/ai/Chat.d.ts.map +1 -1
- package/dist/unstable/ai/Chat.js +55 -51
- package/dist/unstable/ai/Chat.js.map +1 -1
- package/dist/unstable/ai/EmbeddingModel.js.map +1 -1
- package/dist/unstable/ai/IdGenerator.d.ts +32 -28
- package/dist/unstable/ai/IdGenerator.d.ts.map +1 -1
- package/dist/unstable/ai/IdGenerator.js +26 -21
- package/dist/unstable/ai/IdGenerator.js.map +1 -1
- package/dist/unstable/ai/LanguageModel.d.ts +107 -67
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/ai/LanguageModel.js +104 -64
- package/dist/unstable/ai/LanguageModel.js.map +1 -1
- package/dist/unstable/ai/McpProtocol.d.ts +30 -0
- package/dist/unstable/ai/McpProtocol.d.ts.map +1 -0
- package/dist/unstable/ai/McpProtocol.js +20 -0
- package/dist/unstable/ai/McpProtocol.js.map +1 -0
- package/dist/unstable/ai/McpSchema.d.ts +141 -75
- package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
- package/dist/unstable/ai/McpSchema.js +58 -50
- package/dist/unstable/ai/McpSchema.js.map +1 -1
- package/dist/unstable/ai/McpServer.d.ts +68 -59
- package/dist/unstable/ai/McpServer.d.ts.map +1 -1
- package/dist/unstable/ai/McpServer.js +694 -241
- package/dist/unstable/ai/McpServer.js.map +1 -1
- package/dist/unstable/ai/Model.d.ts +8 -19
- package/dist/unstable/ai/Model.d.ts.map +1 -1
- package/dist/unstable/ai/Model.js +9 -20
- package/dist/unstable/ai/Model.js.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Prompt.d.ts +112 -38
- package/dist/unstable/ai/Prompt.d.ts.map +1 -1
- package/dist/unstable/ai/Prompt.js +53 -17
- package/dist/unstable/ai/Prompt.js.map +1 -1
- package/dist/unstable/ai/Response.d.ts +28 -14
- package/dist/unstable/ai/Response.d.ts.map +1 -1
- package/dist/unstable/ai/Response.js +9 -4
- package/dist/unstable/ai/Response.js.map +1 -1
- package/dist/unstable/ai/ResponseIdTracker.js.map +1 -1
- package/dist/unstable/ai/Telemetry.d.ts +46 -13
- package/dist/unstable/ai/Telemetry.d.ts.map +1 -1
- package/dist/unstable/ai/Telemetry.js +18 -7
- package/dist/unstable/ai/Telemetry.js.map +1 -1
- package/dist/unstable/ai/Tokenizer.d.ts +14 -3
- package/dist/unstable/ai/Tokenizer.d.ts.map +1 -1
- package/dist/unstable/ai/Tokenizer.js +10 -2
- package/dist/unstable/ai/Tokenizer.js.map +1 -1
- package/dist/unstable/ai/Tool.d.ts +59 -44
- package/dist/unstable/ai/Tool.d.ts.map +1 -1
- package/dist/unstable/ai/Tool.js +48 -39
- package/dist/unstable/ai/Tool.js.map +1 -1
- package/dist/unstable/ai/Toolkit.d.ts +26 -8
- package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
- package/dist/unstable/ai/Toolkit.js +18 -4
- package/dist/unstable/ai/Toolkit.js.map +1 -1
- package/dist/unstable/ai/index.d.ts +4 -0
- package/dist/unstable/ai/index.d.ts.map +1 -1
- package/dist/unstable/ai/index.js +4 -0
- package/dist/unstable/ai/index.js.map +1 -1
- package/dist/unstable/ai/internal/codec-transformer.js.map +1 -1
- package/dist/unstable/ai/internal/mcpProtocol.d.ts +21 -0
- package/dist/unstable/ai/internal/mcpProtocol.d.ts.map +1 -0
- package/dist/unstable/ai/internal/mcpProtocol.js +22 -0
- package/dist/unstable/ai/internal/mcpProtocol.js.map +1 -0
- package/dist/unstable/ai/internal/mcpProtocolRegistry.d.ts +2 -0
- package/dist/unstable/ai/internal/mcpProtocolRegistry.d.ts.map +1 -0
- package/dist/unstable/ai/internal/mcpProtocolRegistry.js +32 -0
- package/dist/unstable/ai/internal/mcpProtocolRegistry.js.map +1 -0
- package/dist/unstable/ai/internal/structured-output.js +14 -15
- package/dist/unstable/ai/internal/structured-output.js.map +1 -1
- package/dist/unstable/cli/Argument.d.ts +273 -69
- package/dist/unstable/cli/Argument.d.ts.map +1 -1
- package/dist/unstable/cli/Argument.js +111 -33
- package/dist/unstable/cli/Argument.js.map +1 -1
- package/dist/unstable/cli/CliConfig.js.map +1 -1
- package/dist/unstable/cli/CliError.d.ts +69 -76
- package/dist/unstable/cli/CliError.d.ts.map +1 -1
- package/dist/unstable/cli/CliError.js +57 -61
- package/dist/unstable/cli/CliError.js.map +1 -1
- package/dist/unstable/cli/CliOutput.d.ts +35 -54
- package/dist/unstable/cli/CliOutput.d.ts.map +1 -1
- package/dist/unstable/cli/CliOutput.js +26 -42
- package/dist/unstable/cli/CliOutput.js.map +1 -1
- package/dist/unstable/cli/Command.d.ts +705 -107
- package/dist/unstable/cli/Command.d.ts.map +1 -1
- package/dist/unstable/cli/Command.js +238 -42
- package/dist/unstable/cli/Command.js.map +1 -1
- package/dist/unstable/cli/Completions.js.map +1 -1
- package/dist/unstable/cli/Flag.d.ts +418 -138
- package/dist/unstable/cli/Flag.d.ts.map +1 -1
- package/dist/unstable/cli/Flag.js +197 -71
- package/dist/unstable/cli/Flag.js.map +1 -1
- package/dist/unstable/cli/GlobalFlag.d.ts +1 -1
- package/dist/unstable/cli/GlobalFlag.js.map +1 -1
- package/dist/unstable/cli/HelpDoc.d.ts +12 -4
- package/dist/unstable/cli/HelpDoc.d.ts.map +1 -1
- package/dist/unstable/cli/Param.d.ts +292 -78
- package/dist/unstable/cli/Param.d.ts.map +1 -1
- package/dist/unstable/cli/Param.js +128 -46
- package/dist/unstable/cli/Param.js.map +1 -1
- package/dist/unstable/cli/Primitive.d.ts +370 -149
- package/dist/unstable/cli/Primitive.d.ts.map +1 -1
- package/dist/unstable/cli/Primitive.js +344 -136
- package/dist/unstable/cli/Primitive.js.map +1 -1
- package/dist/unstable/cli/Prompt.d.ts +23 -14
- package/dist/unstable/cli/Prompt.d.ts.map +1 -1
- package/dist/unstable/cli/Prompt.js +23 -14
- package/dist/unstable/cli/Prompt.js.map +1 -1
- package/dist/unstable/cli/index.js.map +1 -1
- package/dist/unstable/cli/internal/ansi.js.map +1 -1
- package/dist/unstable/cli/internal/auto-suggest.js.map +1 -1
- package/dist/unstable/cli/internal/command.js.map +1 -1
- package/dist/unstable/cli/internal/completions/bash.js.map +1 -1
- package/dist/unstable/cli/internal/completions/descriptor.js.map +1 -1
- package/dist/unstable/cli/internal/completions/fish.js.map +1 -1
- package/dist/unstable/cli/internal/completions/zsh.js.map +1 -1
- package/dist/unstable/cli/internal/config.js.map +1 -1
- package/dist/unstable/cli/internal/help.js.map +1 -1
- package/dist/unstable/cli/internal/lexer.js +17 -7
- package/dist/unstable/cli/internal/lexer.js.map +1 -1
- package/dist/unstable/cli/internal/parser.js +2 -2
- package/dist/unstable/cli/internal/parser.js.map +1 -1
- package/dist/unstable/cli/internal/wizard.js.map +1 -1
- package/dist/unstable/cluster/ClusterCron.js.map +1 -1
- package/dist/unstable/cluster/ClusterError.js.map +1 -1
- package/dist/unstable/cluster/ClusterMetrics.js.map +1 -1
- package/dist/unstable/cluster/ClusterSchema.d.ts +8 -8
- package/dist/unstable/cluster/ClusterSchema.js +8 -8
- package/dist/unstable/cluster/ClusterSchema.js.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js +5 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/unstable/cluster/DeliverAt.js.map +1 -1
- package/dist/unstable/cluster/Entity.d.ts +10 -10
- package/dist/unstable/cluster/Entity.d.ts.map +1 -1
- package/dist/unstable/cluster/Entity.js +8 -8
- package/dist/unstable/cluster/Entity.js.map +1 -1
- package/dist/unstable/cluster/EntityAddress.js.map +1 -1
- package/dist/unstable/cluster/EntityId.js.map +1 -1
- package/dist/unstable/cluster/EntityProxy.d.ts +4 -2
- package/dist/unstable/cluster/EntityProxy.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityProxy.js +4 -2
- package/dist/unstable/cluster/EntityProxy.js.map +1 -1
- package/dist/unstable/cluster/EntityProxyServer.js.map +1 -1
- package/dist/unstable/cluster/EntityResource.d.ts +2 -2
- package/dist/unstable/cluster/EntityResource.js +2 -2
- package/dist/unstable/cluster/EntityResource.js.map +1 -1
- package/dist/unstable/cluster/EntityType.js.map +1 -1
- package/dist/unstable/cluster/Envelope.d.ts +3 -3
- package/dist/unstable/cluster/Envelope.js +3 -3
- package/dist/unstable/cluster/Envelope.js.map +1 -1
- package/dist/unstable/cluster/HttpRunner.d.ts +2 -2
- package/dist/unstable/cluster/HttpRunner.d.ts.map +1 -1
- package/dist/unstable/cluster/HttpRunner.js +6 -4
- package/dist/unstable/cluster/HttpRunner.js.map +1 -1
- package/dist/unstable/cluster/K8sHttpClient.js.map +1 -1
- package/dist/unstable/cluster/MachineId.js.map +1 -1
- package/dist/unstable/cluster/Message.d.ts +9 -9
- package/dist/unstable/cluster/Message.js +6 -6
- package/dist/unstable/cluster/Message.js.map +1 -1
- package/dist/unstable/cluster/MessageStorage.d.ts +15 -15
- package/dist/unstable/cluster/MessageStorage.js +5 -5
- package/dist/unstable/cluster/MessageStorage.js.map +1 -1
- package/dist/unstable/cluster/Reply.d.ts.map +1 -1
- package/dist/unstable/cluster/Reply.js +4 -4
- package/dist/unstable/cluster/Reply.js.map +1 -1
- package/dist/unstable/cluster/Runner.js.map +1 -1
- package/dist/unstable/cluster/RunnerAddress.js.map +1 -1
- package/dist/unstable/cluster/RunnerHealth.d.ts +1 -1
- package/dist/unstable/cluster/RunnerHealth.js +1 -1
- package/dist/unstable/cluster/RunnerHealth.js.map +1 -1
- package/dist/unstable/cluster/RunnerServer.d.ts +2 -1
- package/dist/unstable/cluster/RunnerServer.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerServer.js +16 -16
- package/dist/unstable/cluster/RunnerServer.js.map +1 -1
- package/dist/unstable/cluster/RunnerStorage.d.ts +2 -2
- package/dist/unstable/cluster/RunnerStorage.js +1 -1
- package/dist/unstable/cluster/RunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/Runners.d.ts +6 -6
- package/dist/unstable/cluster/Runners.d.ts.map +1 -1
- package/dist/unstable/cluster/Runners.js +19 -10
- package/dist/unstable/cluster/Runners.js.map +1 -1
- package/dist/unstable/cluster/ShardId.js.map +1 -1
- package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
- package/dist/unstable/cluster/Sharding.js +3 -2
- package/dist/unstable/cluster/Sharding.js.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.d.ts +3 -3
- package/dist/unstable/cluster/ShardingConfig.js +3 -3
- package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
- package/dist/unstable/cluster/ShardingRegistrationEvent.js.map +1 -1
- package/dist/unstable/cluster/SingleRunner.js.map +1 -1
- package/dist/unstable/cluster/Singleton.js.map +1 -1
- package/dist/unstable/cluster/SingletonAddress.d.ts +1 -1
- package/dist/unstable/cluster/SingletonAddress.js +1 -1
- package/dist/unstable/cluster/SingletonAddress.js.map +1 -1
- package/dist/unstable/cluster/Snowflake.d.ts +8 -8
- package/dist/unstable/cluster/Snowflake.js +8 -8
- package/dist/unstable/cluster/Snowflake.js.map +1 -1
- package/dist/unstable/cluster/SocketRunner.js.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.js +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.js +20 -5
- package/dist/unstable/cluster/SqlRunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/TestRunner.js.map +1 -1
- package/dist/unstable/cluster/index.js.map +1 -1
- package/dist/unstable/cluster/internal/entityManager.js +5 -5
- package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
- package/dist/unstable/cluster/internal/entityReaper.js.map +1 -1
- package/dist/unstable/cluster/internal/hash.js.map +1 -1
- package/dist/unstable/cluster/internal/interruptors.js.map +1 -1
- package/dist/unstable/cluster/internal/resourceMap.js.map +1 -1
- package/dist/unstable/cluster/internal/resourceRef.js.map +1 -1
- package/dist/unstable/cluster/internal/shardLock.js.map +1 -1
- package/dist/unstable/devtools/DevTools.js.map +1 -1
- package/dist/unstable/devtools/DevToolsClient.js.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.js.map +1 -1
- package/dist/unstable/devtools/DevToolsServer.js.map +1 -1
- package/dist/unstable/devtools/index.js.map +1 -1
- package/dist/unstable/encoding/Msgpack.d.ts.map +1 -1
- package/dist/unstable/encoding/Msgpack.js +6 -8
- package/dist/unstable/encoding/Msgpack.js.map +1 -1
- package/dist/unstable/encoding/Ndjson.js.map +1 -1
- package/dist/unstable/encoding/Sse.d.ts +72 -8
- package/dist/unstable/encoding/Sse.d.ts.map +1 -1
- package/dist/unstable/encoding/Sse.js +58 -8
- package/dist/unstable/encoding/Sse.js.map +1 -1
- package/dist/unstable/encoding/index.js.map +1 -1
- package/dist/unstable/eventlog/Event.d.ts +20 -20
- package/dist/unstable/eventlog/Event.js.map +1 -1
- package/dist/unstable/eventlog/EventGroup.d.ts +4 -4
- package/dist/unstable/eventlog/EventGroup.js.map +1 -1
- package/dist/unstable/eventlog/EventJournal.d.ts +15 -15
- package/dist/unstable/eventlog/EventJournal.js +13 -13
- package/dist/unstable/eventlog/EventJournal.js.map +1 -1
- package/dist/unstable/eventlog/EventLog.d.ts +3 -3
- package/dist/unstable/eventlog/EventLog.js +3 -3
- package/dist/unstable/eventlog/EventLog.js.map +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.d.ts +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.js +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.js.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.d.ts +2 -2
- package/dist/unstable/eventlog/EventLogMessage.js +1 -1
- package/dist/unstable/eventlog/EventLogMessage.js.map +1 -1
- package/dist/unstable/eventlog/EventLogRemote.d.ts +15 -15
- package/dist/unstable/eventlog/EventLogRemote.js +1 -1
- package/dist/unstable/eventlog/EventLogRemote.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServer.d.ts +11 -2
- package/dist/unstable/eventlog/EventLogServer.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServer.js +45 -21
- package/dist/unstable/eventlog/EventLogServer.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts +4 -4
- package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServerEncrypted.js +13 -5
- package/dist/unstable/eventlog/EventLogServerEncrypted.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts +5 -5
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js +14 -6
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js.map +1 -1
- package/dist/unstable/eventlog/EventLogSessionAuth.d.ts +1 -1
- package/dist/unstable/eventlog/EventLogSessionAuth.js +1 -1
- package/dist/unstable/eventlog/EventLogSessionAuth.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventJournal.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js.map +1 -1
- package/dist/unstable/eventlog/index.js.map +1 -1
- package/dist/unstable/eventlog/internal/identityRootSecretDerivation.js.map +1 -1
- package/dist/unstable/http/Cookies.d.ts +2 -2
- package/dist/unstable/http/Cookies.d.ts.map +1 -1
- package/dist/unstable/http/Cookies.js +30 -18
- package/dist/unstable/http/Cookies.js.map +1 -1
- package/dist/unstable/http/Etag.d.ts +1 -1
- package/dist/unstable/http/Etag.js +1 -1
- package/dist/unstable/http/Etag.js.map +1 -1
- package/dist/unstable/http/FetchHttpClient.d.ts.map +1 -1
- package/dist/unstable/http/FetchHttpClient.js.map +1 -1
- package/dist/unstable/http/Headers.d.ts +2 -2
- package/dist/unstable/http/Headers.js +2 -2
- package/dist/unstable/http/Headers.js.map +1 -1
- package/dist/unstable/http/HttpBody.d.ts +5 -3
- package/dist/unstable/http/HttpBody.d.ts.map +1 -1
- package/dist/unstable/http/HttpBody.js +11 -5
- package/dist/unstable/http/HttpBody.js.map +1 -1
- package/dist/unstable/http/HttpClient.d.ts +51 -44
- package/dist/unstable/http/HttpClient.d.ts.map +1 -1
- package/dist/unstable/http/HttpClient.js +46 -17
- package/dist/unstable/http/HttpClient.js.map +1 -1
- package/dist/unstable/http/HttpClientError.js.map +1 -1
- package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientRequest.js +2 -0
- package/dist/unstable/http/HttpClientRequest.js.map +1 -1
- package/dist/unstable/http/HttpClientResponse.d.ts +4 -4
- package/dist/unstable/http/HttpClientResponse.js +2 -2
- package/dist/unstable/http/HttpClientResponse.js.map +1 -1
- package/dist/unstable/http/HttpEffect.d.ts +6 -6
- package/dist/unstable/http/HttpEffect.js +3 -3
- package/dist/unstable/http/HttpEffect.js.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
- package/dist/unstable/http/HttpMethod.d.ts +6 -9
- package/dist/unstable/http/HttpMethod.d.ts.map +1 -1
- package/dist/unstable/http/HttpMethod.js +6 -9
- package/dist/unstable/http/HttpMethod.js.map +1 -1
- package/dist/unstable/http/HttpMiddleware.d.ts +75 -9
- package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
- package/dist/unstable/http/HttpMiddleware.js +164 -39
- package/dist/unstable/http/HttpMiddleware.js.map +1 -1
- package/dist/unstable/http/HttpPlatform.d.ts +76 -0
- package/dist/unstable/http/HttpPlatform.d.ts.map +1 -1
- package/dist/unstable/http/HttpPlatform.js +32 -0
- package/dist/unstable/http/HttpPlatform.js.map +1 -1
- package/dist/unstable/http/HttpRouter.d.ts +88 -89
- package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
- package/dist/unstable/http/HttpRouter.js +78 -79
- package/dist/unstable/http/HttpRouter.js.map +1 -1
- package/dist/unstable/http/HttpServer.d.ts +13 -13
- package/dist/unstable/http/HttpServer.js +6 -6
- package/dist/unstable/http/HttpServer.js.map +1 -1
- package/dist/unstable/http/HttpServerError.d.ts +2 -2
- package/dist/unstable/http/HttpServerError.js +2 -2
- package/dist/unstable/http/HttpServerError.js.map +1 -1
- package/dist/unstable/http/HttpServerRequest.d.ts +4 -4
- package/dist/unstable/http/HttpServerRequest.js +4 -4
- package/dist/unstable/http/HttpServerRequest.js.map +1 -1
- package/dist/unstable/http/HttpServerRespondable.js.map +1 -1
- package/dist/unstable/http/HttpServerResponse.d.ts +22 -0
- package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerResponse.js +10 -0
- package/dist/unstable/http/HttpServerResponse.js.map +1 -1
- package/dist/unstable/http/HttpStaticServer.d.ts +35 -7
- package/dist/unstable/http/HttpStaticServer.d.ts.map +1 -1
- package/dist/unstable/http/HttpStaticServer.js +35 -7
- package/dist/unstable/http/HttpStaticServer.js.map +1 -1
- package/dist/unstable/http/HttpTraceContext.js.map +1 -1
- package/dist/unstable/http/Multipart.d.ts +6 -6
- package/dist/unstable/http/Multipart.js +5 -5
- package/dist/unstable/http/Multipart.js.map +1 -1
- package/dist/unstable/http/Template.js.map +1 -1
- package/dist/unstable/http/Url.d.ts +33 -63
- package/dist/unstable/http/Url.d.ts.map +1 -1
- package/dist/unstable/http/Url.js +14 -28
- package/dist/unstable/http/Url.js.map +1 -1
- package/dist/unstable/http/UrlParams.d.ts +10 -18
- package/dist/unstable/http/UrlParams.d.ts.map +1 -1
- package/dist/unstable/http/UrlParams.js +9 -17
- package/dist/unstable/http/UrlParams.js.map +1 -1
- package/dist/unstable/http/index.js.map +1 -1
- package/dist/unstable/http/internal/compression.d.ts +2 -0
- package/dist/unstable/http/internal/compression.d.ts.map +1 -0
- package/dist/unstable/http/internal/compression.js +155 -0
- package/dist/unstable/http/internal/compression.js.map +1 -0
- package/dist/unstable/http/internal/preResponseHandler.js.map +1 -1
- package/dist/unstable/httpapi/HttpApi.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.js +10 -11
- package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.d.ts +4 -5
- package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.js +11 -13
- package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +42 -42
- package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.d.ts +13 -13
- package/dist/unstable/httpapi/HttpApiError.js +13 -13
- package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.d.ts +15 -15
- package/dist/unstable/httpapi/HttpApiGroup.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +71 -24
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.js +57 -10
- package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.d.ts +0 -12
- package/dist/unstable/httpapi/HttpApiScalar.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.d.ts +6 -6
- package/dist/unstable/httpapi/HttpApiSchema.js +4 -4
- package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSecurity.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSwagger.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiTest.js.map +1 -1
- package/dist/unstable/httpapi/OpenApi.d.ts +13 -13
- package/dist/unstable/httpapi/OpenApi.js +13 -13
- package/dist/unstable/httpapi/OpenApi.js.map +1 -1
- package/dist/unstable/httpapi/index.js.map +1 -1
- package/dist/unstable/httpapi/internal/html.js.map +1 -1
- package/dist/unstable/httpapi/internal/httpApiScalar.js.map +1 -1
- package/dist/unstable/httpapi/internal/httpApiSwagger.js.map +1 -1
- package/dist/unstable/httpapi/internal/mediaType.js.map +1 -1
- package/dist/unstable/observability/Otlp.js.map +1 -1
- package/dist/unstable/observability/OtlpExporter.d.ts +12 -14
- package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpExporter.js +17 -4
- package/dist/unstable/observability/OtlpExporter.js.map +1 -1
- package/dist/unstable/observability/OtlpLogger.js.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.d.ts +4 -1
- package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.js.map +1 -1
- package/dist/unstable/observability/OtlpResource.d.ts +16 -7
- package/dist/unstable/observability/OtlpResource.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpResource.js +21 -12
- package/dist/unstable/observability/OtlpResource.js.map +1 -1
- package/dist/unstable/observability/OtlpSerialization.js.map +1 -1
- package/dist/unstable/observability/OtlpTracer.js.map +1 -1
- package/dist/unstable/observability/PrometheusMetrics.d.ts +13 -4
- package/dist/unstable/observability/PrometheusMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/PrometheusMetrics.js +10 -3
- package/dist/unstable/observability/PrometheusMetrics.js.map +1 -1
- package/dist/unstable/observability/index.js.map +1 -1
- package/dist/unstable/observability/internal/otlpEnv.js +1 -1
- package/dist/unstable/observability/internal/otlpEnv.js.map +1 -1
- package/dist/unstable/observability/internal/otlpProtobuf.js.map +1 -1
- package/dist/unstable/observability/internal/protobuf.js +3 -0
- package/dist/unstable/observability/internal/protobuf.js.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.d.ts +8 -3
- package/dist/unstable/persistence/KeyValueStore.d.ts.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.js +22 -13
- package/dist/unstable/persistence/KeyValueStore.js.map +1 -1
- package/dist/unstable/persistence/Persistable.d.ts +8 -8
- package/dist/unstable/persistence/Persistable.js.map +1 -1
- package/dist/unstable/persistence/PersistedCache.js.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.d.ts +6 -6
- package/dist/unstable/persistence/PersistedQueue.js +6 -6
- package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
- package/dist/unstable/persistence/Persistence.d.ts +3 -3
- package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
- package/dist/unstable/persistence/Persistence.js +91 -15
- package/dist/unstable/persistence/Persistence.js.map +1 -1
- package/dist/unstable/persistence/RateLimiter.d.ts +26 -15
- package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
- package/dist/unstable/persistence/RateLimiter.js +24 -13
- package/dist/unstable/persistence/RateLimiter.js.map +1 -1
- package/dist/unstable/persistence/Redis.d.ts +2 -2
- package/dist/unstable/persistence/Redis.js +1 -1
- package/dist/unstable/persistence/Redis.js.map +1 -1
- package/dist/unstable/persistence/index.js.map +1 -1
- package/dist/unstable/process/ChildProcess.d.ts +64 -21
- package/dist/unstable/process/ChildProcess.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcess.js +14 -5
- package/dist/unstable/process/ChildProcess.js.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.d.ts +21 -10
- package/dist/unstable/process/ChildProcessSpawner.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.js +1 -1
- package/dist/unstable/process/ChildProcessSpawner.js.map +1 -1
- package/dist/unstable/process/index.js.map +1 -1
- package/dist/unstable/reactivity/AsyncResult.d.ts +8 -8
- package/dist/unstable/reactivity/AsyncResult.d.ts.map +1 -1
- package/dist/unstable/reactivity/AsyncResult.js +10 -10
- package/dist/unstable/reactivity/AsyncResult.js.map +1 -1
- package/dist/unstable/reactivity/Atom.d.ts +25 -22
- package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.js +14 -13
- package/dist/unstable/reactivity/Atom.js.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.d.ts +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.js +4 -1
- package/dist/unstable/reactivity/AtomHttpApi.js.map +1 -1
- package/dist/unstable/reactivity/AtomRef.js.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.js +24 -3
- package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.d.ts +1 -1
- package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.js +4 -1
- package/dist/unstable/reactivity/AtomRpc.js.map +1 -1
- package/dist/unstable/reactivity/Hydration.d.ts +1 -1
- package/dist/unstable/reactivity/Hydration.js +1 -1
- package/dist/unstable/reactivity/Hydration.js.map +1 -1
- package/dist/unstable/reactivity/Reactivity.js.map +1 -1
- package/dist/unstable/reactivity/index.js.map +1 -1
- package/dist/unstable/rpc/Rpc.d.ts +35 -33
- package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
- package/dist/unstable/rpc/Rpc.js +4 -2
- package/dist/unstable/rpc/Rpc.js.map +1 -1
- package/dist/unstable/rpc/RpcClient.d.ts +12 -12
- package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClient.js +12 -11
- package/dist/unstable/rpc/RpcClient.js.map +1 -1
- package/dist/unstable/rpc/RpcClientError.js.map +1 -1
- package/dist/unstable/rpc/RpcGroup.d.ts +8 -8
- package/dist/unstable/rpc/RpcGroup.js +1 -1
- package/dist/unstable/rpc/RpcGroup.js.map +1 -1
- package/dist/unstable/rpc/RpcMessage.d.ts +31 -30
- package/dist/unstable/rpc/RpcMessage.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcMessage.js +6 -6
- package/dist/unstable/rpc/RpcMessage.js.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.d.ts +10 -10
- package/dist/unstable/rpc/RpcMiddleware.js +1 -1
- package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
- package/dist/unstable/rpc/RpcSchema.d.ts +4 -4
- package/dist/unstable/rpc/RpcSchema.js +3 -3
- package/dist/unstable/rpc/RpcSchema.js.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.d.ts +58 -7
- package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.js +175 -96
- package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
- package/dist/unstable/rpc/RpcServer.d.ts +13 -13
- package/dist/unstable/rpc/RpcServer.js +17 -13
- package/dist/unstable/rpc/RpcServer.js.map +1 -1
- package/dist/unstable/rpc/RpcTest.js.map +1 -1
- package/dist/unstable/rpc/RpcWorker.d.ts +5 -5
- package/dist/unstable/rpc/RpcWorker.js +4 -4
- package/dist/unstable/rpc/RpcWorker.js.map +1 -1
- package/dist/unstable/rpc/Utils.js.map +1 -1
- package/dist/unstable/rpc/index.js.map +1 -1
- package/dist/unstable/schema/Model.d.ts +52 -50
- package/dist/unstable/schema/Model.d.ts.map +1 -1
- package/dist/unstable/schema/Model.js +35 -33
- package/dist/unstable/schema/Model.js.map +1 -1
- package/dist/unstable/schema/VariantSchema.d.ts +5 -5
- package/dist/unstable/schema/VariantSchema.js +2 -2
- package/dist/unstable/schema/VariantSchema.js.map +1 -1
- package/dist/unstable/schema/index.js.map +1 -1
- package/dist/unstable/socket/Socket.d.ts +11 -3
- package/dist/unstable/socket/Socket.d.ts.map +1 -1
- package/dist/unstable/socket/Socket.js +9 -4
- package/dist/unstable/socket/Socket.js.map +1 -1
- package/dist/unstable/socket/SocketServer.js.map +1 -1
- package/dist/unstable/socket/index.js.map +1 -1
- package/dist/unstable/sql/Migrator.js.map +1 -1
- package/dist/unstable/sql/SqlClient.d.ts +1 -1
- package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
- package/dist/unstable/sql/SqlClient.js +2 -2
- package/dist/unstable/sql/SqlClient.js.map +1 -1
- package/dist/unstable/sql/SqlConnection.js.map +1 -1
- package/dist/unstable/sql/SqlError.js.map +1 -1
- package/dist/unstable/sql/SqlModel.d.ts +2 -2
- package/dist/unstable/sql/SqlModel.js +2 -2
- package/dist/unstable/sql/SqlModel.js.map +1 -1
- package/dist/unstable/sql/SqlResolver.d.ts +5 -5
- package/dist/unstable/sql/SqlResolver.js +2 -2
- package/dist/unstable/sql/SqlResolver.js.map +1 -1
- package/dist/unstable/sql/SqlSchema.js.map +1 -1
- package/dist/unstable/sql/SqlStream.js.map +1 -1
- package/dist/unstable/sql/Statement.d.ts +6 -6
- package/dist/unstable/sql/Statement.js +15 -15
- package/dist/unstable/sql/Statement.js.map +1 -1
- package/dist/unstable/sql/index.js.map +1 -1
- package/dist/unstable/workers/Transferable.d.ts +1 -1
- package/dist/unstable/workers/Transferable.js +1 -1
- package/dist/unstable/workers/Transferable.js.map +1 -1
- package/dist/unstable/workers/Worker.d.ts +2 -2
- package/dist/unstable/workers/Worker.js +2 -2
- package/dist/unstable/workers/Worker.js.map +1 -1
- package/dist/unstable/workers/WorkerError.d.ts +7 -7
- package/dist/unstable/workers/WorkerError.js +6 -6
- package/dist/unstable/workers/WorkerError.js.map +1 -1
- package/dist/unstable/workers/WorkerRunner.d.ts +1 -1
- package/dist/unstable/workers/WorkerRunner.js +1 -1
- package/dist/unstable/workers/WorkerRunner.js.map +1 -1
- package/dist/unstable/workers/index.js.map +1 -1
- package/dist/unstable/workflow/Activity.d.ts +2 -2
- package/dist/unstable/workflow/Activity.js +2 -2
- package/dist/unstable/workflow/Activity.js.map +1 -1
- package/dist/unstable/workflow/DurableClock.d.ts +1 -1
- package/dist/unstable/workflow/DurableClock.js +1 -1
- package/dist/unstable/workflow/DurableClock.js.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.d.ts +10 -10
- package/dist/unstable/workflow/DurableDeferred.js +5 -5
- package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
- package/dist/unstable/workflow/DurableQueue.d.ts +22 -20
- package/dist/unstable/workflow/DurableQueue.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableQueue.js +22 -20
- package/dist/unstable/workflow/DurableQueue.js.map +1 -1
- package/dist/unstable/workflow/Workflow.d.ts +21 -21
- package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
- package/dist/unstable/workflow/Workflow.js +13 -14
- package/dist/unstable/workflow/Workflow.js.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.d.ts +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
- package/dist/unstable/workflow/WorkflowProxy.d.ts +4 -2
- package/dist/unstable/workflow/WorkflowProxy.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowProxy.js +4 -2
- package/dist/unstable/workflow/WorkflowProxy.js.map +1 -1
- package/dist/unstable/workflow/WorkflowProxyServer.js.map +1 -1
- package/dist/unstable/workflow/index.js.map +1 -1
- package/dist/unstable/workflow/internal/crypto.js.map +1 -1
- package/package.json +5 -6
- package/src/Array.ts +982 -1045
- package/src/BigDecimal.ts +433 -756
- package/src/BigInt.ts +213 -269
- package/src/Boolean.ts +146 -188
- package/src/Cache.ts +409 -255
- package/src/Cause.ts +167 -277
- package/src/Channel.ts +891 -816
- package/src/ChannelSchema.ts +1 -1
- package/src/Chunk.ts +841 -1181
- package/src/Clock.ts +181 -49
- package/src/Combiner.ts +20 -33
- package/src/Config.ts +615 -332
- package/src/ConfigProvider.ts +214 -120
- package/src/Console.ts +289 -39
- package/src/Context.ts +319 -378
- package/src/Cron.ts +68 -77
- package/src/Crypto.ts +13 -15
- package/src/Data.ts +60 -80
- package/src/DateTime.ts +564 -660
- package/src/Deferred.ts +253 -256
- package/src/Duration.ts +216 -308
- package/src/Effect.ts +2893 -3279
- package/src/Encoding.ts +22 -40
- package/src/Equal.ts +49 -39
- package/src/Equivalence.ts +103 -105
- package/src/ErrorReporter.ts +51 -27
- package/src/ExecutionPlan.ts +13 -55
- package/src/Exit.ts +116 -192
- package/src/Fiber.ts +81 -148
- package/src/FiberHandle.ts +152 -105
- package/src/FiberMap.ts +225 -174
- package/src/FiberSet.ts +124 -82
- package/src/FileSystem.ts +155 -263
- package/src/Filter.ts +61 -33
- package/src/Formatter.ts +54 -56
- package/src/Function.ts +76 -145
- package/src/Graph.ts +416 -770
- package/src/HKT.ts +12 -6
- package/src/Hash.ts +52 -83
- package/src/HashMap.ts +319 -411
- package/src/HashRing.ts +1 -0
- package/src/HashSet.ts +177 -284
- package/src/Inspectable.ts +12 -12
- package/src/Iterable.ts +620 -786
- package/src/JsonPatch.ts +58 -112
- package/src/JsonPointer.ts +8 -8
- package/src/JsonSchema.ts +402 -244
- package/src/Latch.ts +23 -35
- package/src/Layer.ts +359 -260
- package/src/LayerMap.ts +49 -29
- package/src/LayerRef.ts +6 -2
- package/src/LogLevel.ts +114 -214
- package/src/Logger.ts +344 -697
- package/src/ManagedRuntime.ts +7 -5
- package/src/Match.ts +217 -252
- package/src/Metric.ts +516 -1089
- package/src/MutableHashMap.ts +218 -255
- package/src/MutableHashSet.ts +84 -89
- package/src/MutableList.ts +73 -370
- package/src/MutableRef.ts +420 -243
- package/src/Newtype.ts +21 -14
- package/src/NonEmptyIterable.ts +7 -137
- package/src/Number.ts +196 -233
- package/src/Optic.ts +243 -383
- package/src/Option.ts +447 -812
- package/src/Order.ts +109 -109
- package/src/Ordering.ts +20 -23
- package/src/Path.ts +38 -41
- package/src/Pipeable.ts +6 -5
- package/src/PlatformError.ts +4 -4
- package/src/Pool.ts +4 -2
- package/src/Predicate.ts +200 -181
- package/src/PrimaryKey.ts +7 -7
- package/src/PubSub.ts +526 -552
- package/src/Pull.ts +24 -18
- package/src/Queue.ts +200 -159
- package/src/Random.ts +49 -74
- package/src/RcMap.ts +121 -63
- package/src/RcRef.ts +24 -13
- package/src/Record.ts +291 -488
- package/src/Redactable.ts +10 -3
- package/src/Redacted.ts +25 -25
- package/src/Reducer.ts +8 -15
- package/src/Ref.ts +221 -361
- package/src/References.ts +102 -168
- package/src/RegExp.ts +10 -14
- package/src/Request.ts +31 -21
- package/src/RequestResolver.ts +202 -91
- package/src/Result.ts +312 -484
- package/src/Runtime.ts +50 -75
- package/src/Schedule.ts +308 -1734
- package/src/Scheduler.ts +20 -7
- package/src/Schema.ts +716 -745
- package/src/SchemaAST.ts +466 -358
- package/src/SchemaError.ts +7 -6
- package/src/SchemaGetter.ts +242 -190
- package/src/SchemaIssue.ts +89 -275
- package/src/SchemaParser.ts +180 -93
- package/src/SchemaRepresentation.ts +22 -40
- package/src/SchemaTransformation.ts +129 -88
- package/src/Scope.ts +123 -151
- package/src/ScopedRef.ts +4 -4
- package/src/Semaphore.ts +152 -51
- package/src/Sink.ts +128 -113
- package/src/Stdio.ts +1 -1
- package/src/Stream.ts +2602 -3123
- package/src/String.ts +275 -312
- package/src/Struct.ts +109 -114
- package/src/SubscriptionRef.ts +284 -252
- package/src/Symbol.ts +3 -3
- package/src/Terminal.ts +2 -2
- package/src/Tracer.ts +102 -55
- package/src/Trie.ts +287 -679
- package/src/Tuple.ts +92 -127
- package/src/TxChunk.ts +201 -121
- package/src/TxDeferred.ts +62 -46
- package/src/TxHashMap.ts +645 -799
- package/src/TxHashSet.ts +443 -356
- package/src/TxPriorityQueue.ts +130 -98
- package/src/TxPubSub.ts +107 -80
- package/src/TxQueue.ts +214 -183
- package/src/TxReentrantLock.ts +97 -66
- package/src/TxRef.ts +51 -32
- package/src/TxSemaphore.ts +129 -95
- package/src/TxSubscriptionRef.ts +97 -70
- package/src/Types.ts +126 -67
- package/src/Unify.ts +45 -65
- package/src/Utils.ts +23 -16
- package/src/internal/core.ts +2 -2
- package/src/internal/dateTime.ts +6 -0
- package/src/internal/effect.ts +93 -48
- package/src/internal/persistence.ts +2 -0
- package/src/internal/references.ts +3 -2
- package/src/internal/schema/fromJsonSchemaDocument.ts +15 -13
- package/src/internal/schema/fromRepresentation.ts +10 -16
- package/src/internal/schema/parser.ts +22 -0
- package/src/internal/schema/toJsonSchemaDocument.ts +60 -6
- package/src/internal/schema/toRepresentation.ts +104 -119
- package/src/internal/trie.ts +10 -11
- package/src/testing/FastCheck.ts +8 -7
- package/src/testing/TestClock.ts +72 -30
- package/src/testing/TestConsole.ts +32 -31
- package/src/testing/TestSchema.ts +29 -29
- package/src/unstable/ai/AiError.ts +95 -118
- package/src/unstable/ai/AnthropicStructuredOutput.ts +1 -1
- package/src/unstable/ai/Chat.ts +132 -97
- package/src/unstable/ai/IdGenerator.ts +32 -28
- package/src/unstable/ai/LanguageModel.ts +107 -67
- package/src/unstable/ai/McpProtocol.ts +48 -0
- package/src/unstable/ai/McpSchema.ts +60 -50
- package/src/unstable/ai/McpServer.ts +930 -304
- package/src/unstable/ai/Model.ts +9 -20
- package/src/unstable/ai/OpenAiStructuredOutput.ts +1 -1
- package/src/unstable/ai/Prompt.ts +145 -43
- package/src/unstable/ai/Response.ts +28 -14
- package/src/unstable/ai/Telemetry.ts +46 -13
- package/src/unstable/ai/Tokenizer.ts +14 -3
- package/src/unstable/ai/Tool.ts +59 -44
- package/src/unstable/ai/Toolkit.ts +26 -8
- package/src/unstable/ai/index.ts +5 -0
- package/src/unstable/ai/internal/mcpProtocol.ts +85 -0
- package/src/unstable/ai/internal/mcpProtocolRegistry.ts +70 -0
- package/src/unstable/ai/internal/structured-output.ts +13 -18
- package/src/unstable/cli/Argument.ts +273 -69
- package/src/unstable/cli/CliError.ts +69 -76
- package/src/unstable/cli/CliOutput.ts +44 -58
- package/src/unstable/cli/Command.ts +705 -107
- package/src/unstable/cli/Flag.ts +418 -138
- package/src/unstable/cli/GlobalFlag.ts +1 -1
- package/src/unstable/cli/HelpDoc.ts +12 -4
- package/src/unstable/cli/Param.ts +292 -78
- package/src/unstable/cli/Primitive.ts +370 -149
- package/src/unstable/cli/Prompt.ts +28 -14
- package/src/unstable/cli/internal/lexer.ts +8 -2
- package/src/unstable/cli/internal/parser.ts +2 -2
- package/src/unstable/cluster/ClusterSchema.ts +8 -8
- package/src/unstable/cluster/ClusterWorkflowEngine.ts +5 -1
- package/src/unstable/cluster/Entity.ts +15 -16
- package/src/unstable/cluster/EntityProxy.ts +4 -2
- package/src/unstable/cluster/EntityResource.ts +2 -2
- package/src/unstable/cluster/Envelope.ts +3 -3
- package/src/unstable/cluster/HttpRunner.ts +6 -4
- package/src/unstable/cluster/Message.ts +9 -9
- package/src/unstable/cluster/MessageStorage.ts +15 -15
- package/src/unstable/cluster/Reply.ts +4 -6
- package/src/unstable/cluster/RunnerHealth.ts +1 -1
- package/src/unstable/cluster/RunnerServer.ts +41 -8
- package/src/unstable/cluster/RunnerStorage.ts +2 -2
- package/src/unstable/cluster/Runners.ts +23 -12
- package/src/unstable/cluster/Sharding.ts +7 -8
- package/src/unstable/cluster/ShardingConfig.ts +3 -3
- package/src/unstable/cluster/SingletonAddress.ts +1 -1
- package/src/unstable/cluster/Snowflake.ts +8 -8
- package/src/unstable/cluster/SqlMessageStorage.ts +1 -1
- package/src/unstable/cluster/SqlRunnerStorage.ts +21 -5
- package/src/unstable/cluster/internal/entityManager.ts +11 -15
- package/src/unstable/encoding/Msgpack.ts +6 -8
- package/src/unstable/encoding/Sse.ts +98 -16
- package/src/unstable/eventlog/Event.ts +20 -20
- package/src/unstable/eventlog/EventGroup.ts +4 -4
- package/src/unstable/eventlog/EventJournal.ts +15 -15
- package/src/unstable/eventlog/EventLog.ts +3 -3
- package/src/unstable/eventlog/EventLogEncryption.ts +1 -1
- package/src/unstable/eventlog/EventLogMessage.ts +2 -2
- package/src/unstable/eventlog/EventLogRemote.ts +1 -1
- package/src/unstable/eventlog/EventLogServer.ts +41 -7
- package/src/unstable/eventlog/EventLogServerEncrypted.ts +13 -5
- package/src/unstable/eventlog/EventLogServerUnencrypted.ts +14 -6
- package/src/unstable/eventlog/EventLogSessionAuth.ts +1 -1
- package/src/unstable/http/Cookies.ts +35 -21
- package/src/unstable/http/Etag.ts +1 -1
- package/src/unstable/http/FetchHttpClient.ts +3 -1
- package/src/unstable/http/Headers.ts +2 -2
- package/src/unstable/http/HttpBody.ts +20 -5
- package/src/unstable/http/HttpClient.ts +83 -55
- package/src/unstable/http/HttpClientRequest.ts +2 -0
- package/src/unstable/http/HttpClientResponse.ts +4 -4
- package/src/unstable/http/HttpEffect.ts +8 -8
- package/src/unstable/http/HttpMethod.ts +6 -9
- package/src/unstable/http/HttpMiddleware.ts +202 -39
- package/src/unstable/http/HttpPlatform.ts +95 -0
- package/src/unstable/http/HttpRouter.ts +102 -98
- package/src/unstable/http/HttpServer.ts +13 -13
- package/src/unstable/http/HttpServerError.ts +2 -2
- package/src/unstable/http/HttpServerRequest.ts +4 -4
- package/src/unstable/http/HttpServerResponse.ts +30 -0
- package/src/unstable/http/HttpStaticServer.ts +35 -7
- package/src/unstable/http/Multipart.ts +6 -6
- package/src/unstable/http/Url.ts +33 -63
- package/src/unstable/http/UrlParams.ts +10 -18
- package/src/unstable/http/internal/compression.ts +196 -0
- package/src/unstable/httpapi/HttpApiBuilder.ts +10 -9
- package/src/unstable/httpapi/HttpApiClient.ts +14 -14
- package/src/unstable/httpapi/HttpApiEndpoint.ts +42 -42
- package/src/unstable/httpapi/HttpApiError.ts +13 -13
- package/src/unstable/httpapi/HttpApiGroup.ts +15 -15
- package/src/unstable/httpapi/HttpApiMiddleware.ts +71 -24
- package/src/unstable/httpapi/HttpApiScalar.ts +0 -12
- package/src/unstable/httpapi/HttpApiSchema.ts +6 -6
- package/src/unstable/httpapi/OpenApi.ts +13 -13
- package/src/unstable/observability/OtlpExporter.ts +31 -19
- package/src/unstable/observability/OtlpMetrics.ts +4 -1
- package/src/unstable/observability/OtlpResource.ts +26 -17
- package/src/unstable/observability/PrometheusMetrics.ts +13 -4
- package/src/unstable/observability/internal/otlpEnv.ts +1 -1
- package/src/unstable/observability/internal/protobuf.ts +3 -0
- package/src/unstable/persistence/KeyValueStore.ts +72 -49
- package/src/unstable/persistence/Persistable.ts +8 -8
- package/src/unstable/persistence/PersistedQueue.ts +6 -6
- package/src/unstable/persistence/Persistence.ts +126 -19
- package/src/unstable/persistence/RateLimiter.ts +26 -15
- package/src/unstable/persistence/Redis.ts +2 -2
- package/src/unstable/process/ChildProcess.ts +64 -21
- package/src/unstable/process/ChildProcessSpawner.ts +21 -10
- package/src/unstable/reactivity/AsyncResult.ts +12 -13
- package/src/unstable/reactivity/Atom.ts +28 -25
- package/src/unstable/reactivity/AtomHttpApi.ts +5 -4
- package/src/unstable/reactivity/AtomRegistry.ts +24 -3
- package/src/unstable/reactivity/AtomRpc.ts +5 -4
- package/src/unstable/reactivity/Hydration.ts +1 -1
- package/src/unstable/rpc/Rpc.ts +35 -33
- package/src/unstable/rpc/RpcClient.ts +16 -15
- package/src/unstable/rpc/RpcGroup.ts +8 -8
- package/src/unstable/rpc/RpcMessage.ts +31 -30
- package/src/unstable/rpc/RpcMiddleware.ts +10 -10
- package/src/unstable/rpc/RpcSchema.ts +4 -4
- package/src/unstable/rpc/RpcSerialization.ts +167 -68
- package/src/unstable/rpc/RpcServer.ts +18 -15
- package/src/unstable/rpc/RpcWorker.ts +5 -5
- package/src/unstable/schema/Model.ts +52 -50
- package/src/unstable/schema/VariantSchema.ts +5 -5
- package/src/unstable/socket/Socket.ts +17 -4
- package/src/unstable/sql/SqlClient.ts +5 -6
- package/src/unstable/sql/SqlModel.ts +2 -2
- package/src/unstable/sql/SqlResolver.ts +5 -5
- package/src/unstable/sql/Statement.ts +24 -23
- package/src/unstable/workers/Transferable.ts +1 -1
- package/src/unstable/workers/Worker.ts +2 -2
- package/src/unstable/workers/WorkerError.ts +7 -7
- package/src/unstable/workers/WorkerRunner.ts +1 -1
- package/src/unstable/workflow/Activity.ts +2 -2
- package/src/unstable/workflow/DurableClock.ts +1 -1
- package/src/unstable/workflow/DurableDeferred.ts +10 -10
- package/src/unstable/workflow/DurableQueue.ts +22 -20
- package/src/unstable/workflow/Workflow.ts +23 -23
- package/src/unstable/workflow/WorkflowEngine.ts +1 -1
- package/src/unstable/workflow/WorkflowProxy.ts +4 -2
- package/dist/internal/version.d.ts +0 -3
- package/dist/internal/version.d.ts.map +0 -1
- package/dist/internal/version.js +0 -2
- package/dist/internal/version.js.map +0 -1
- package/src/internal/version.ts +0 -2
package/src/Graph.ts
CHANGED
|
@@ -482,7 +482,7 @@ export const isGraph = <N = unknown, E = unknown, T extends Kind = Kind, U = nev
|
|
|
482
482
|
*
|
|
483
483
|
* **Example** (Constructing by kind)
|
|
484
484
|
*
|
|
485
|
-
* ```ts
|
|
485
|
+
* ```ts import.meta.vitest
|
|
486
486
|
* import { Graph } from "effect"
|
|
487
487
|
*
|
|
488
488
|
* const makeGraph = Graph.make("directed")
|
|
@@ -490,7 +490,7 @@ export const isGraph = <N = unknown, E = unknown, T extends Kind = Kind, U = nev
|
|
|
490
490
|
* Graph.addNode(mutable, "A")
|
|
491
491
|
* })
|
|
492
492
|
*
|
|
493
|
-
*
|
|
493
|
+
* graph.type // => "directed"
|
|
494
494
|
* ```
|
|
495
495
|
*
|
|
496
496
|
* @see {@link directed} for constructing a directed graph directly
|
|
@@ -525,7 +525,7 @@ export const make =
|
|
|
525
525
|
*
|
|
526
526
|
* **Example** (Creating a directed graph)
|
|
527
527
|
*
|
|
528
|
-
* ```ts
|
|
528
|
+
* ```ts import.meta.vitest
|
|
529
529
|
* import { Graph } from "effect"
|
|
530
530
|
*
|
|
531
531
|
* // Directed graph with initial nodes and edges
|
|
@@ -536,6 +536,7 @@ export const make =
|
|
|
536
536
|
* Graph.addEdge(mutable, a, b, "A->B")
|
|
537
537
|
* Graph.addEdge(mutable, b, c, "B->C")
|
|
538
538
|
* })
|
|
539
|
+
* Array.of(Graph.nodeCount(graph), Graph.edgeCount(graph)) // => [3, 2]
|
|
539
540
|
* ```
|
|
540
541
|
*
|
|
541
542
|
* @category constructors
|
|
@@ -550,7 +551,7 @@ export const directed: <N, E>(
|
|
|
550
551
|
*
|
|
551
552
|
* **Example** (Creating an undirected graph)
|
|
552
553
|
*
|
|
553
|
-
* ```ts
|
|
554
|
+
* ```ts import.meta.vitest
|
|
554
555
|
* import { Graph } from "effect"
|
|
555
556
|
*
|
|
556
557
|
* // Undirected graph with initial nodes and edges
|
|
@@ -561,6 +562,7 @@ export const directed: <N, E>(
|
|
|
561
562
|
* Graph.addEdge(mutable, a, b, "A-B")
|
|
562
563
|
* Graph.addEdge(mutable, b, c, "B-C")
|
|
563
564
|
* })
|
|
565
|
+
* Array.of(Graph.nodeCount(graph), Graph.edgeCount(graph)) // => [3, 2]
|
|
564
566
|
* ```
|
|
565
567
|
*
|
|
566
568
|
* @category constructors
|
|
@@ -579,12 +581,13 @@ export const undirected: <N, E>(
|
|
|
579
581
|
*
|
|
580
582
|
* **Example** (Beginning a mutation scope)
|
|
581
583
|
*
|
|
582
|
-
* ```ts
|
|
584
|
+
* ```ts import.meta.vitest
|
|
583
585
|
* import { Graph } from "effect"
|
|
584
586
|
*
|
|
585
587
|
* const graph = Graph.directed<string, number>()
|
|
586
588
|
* const mutable = Graph.beginMutation(graph)
|
|
587
589
|
* // Now mutable can be safely modified without affecting original graph
|
|
590
|
+
* Array.of(Graph.nodeCount(mutable), Graph.nodeCount(graph)) // => [0, 0]
|
|
588
591
|
* ```
|
|
589
592
|
*
|
|
590
593
|
* @category mutations
|
|
@@ -621,13 +624,13 @@ export const beginMutation = <N, E, T extends Kind = "directed">(
|
|
|
621
624
|
*
|
|
622
625
|
* **Example** (Ending a mutation scope)
|
|
623
626
|
*
|
|
624
|
-
* ```ts
|
|
627
|
+
* ```ts import.meta.vitest
|
|
625
628
|
* import { Graph } from "effect"
|
|
626
629
|
*
|
|
627
630
|
* const graph = Graph.directed<string, number>()
|
|
628
631
|
* const mutable = Graph.beginMutation(graph)
|
|
629
632
|
* // ... perform mutations on mutable ...
|
|
630
|
-
*
|
|
633
|
+
* Graph.nodeCount(Graph.endMutation(mutable)) // => 0
|
|
631
634
|
* ```
|
|
632
635
|
*
|
|
633
636
|
* @category mutations
|
|
@@ -673,7 +676,7 @@ const mutateScoped = <N, E, T extends Kind>(
|
|
|
673
676
|
*
|
|
674
677
|
* **Example** (Applying scoped mutations)
|
|
675
678
|
*
|
|
676
|
-
* ```ts
|
|
679
|
+
* ```ts import.meta.vitest
|
|
677
680
|
* import { Graph } from "effect"
|
|
678
681
|
*
|
|
679
682
|
* const graph = Graph.directed<string, number>()
|
|
@@ -683,8 +686,8 @@ const mutateScoped = <N, E, T extends Kind>(
|
|
|
683
686
|
* Graph.addEdge(mutable, nodeA, nodeB, 1)
|
|
684
687
|
* })
|
|
685
688
|
*
|
|
686
|
-
*
|
|
687
|
-
*
|
|
689
|
+
* Graph.nodeCount(newGraph) // => 2
|
|
690
|
+
* Graph.edgeCount(newGraph) // => 1
|
|
688
691
|
* ```
|
|
689
692
|
*
|
|
690
693
|
* @category mutations
|
|
@@ -696,7 +699,7 @@ export const mutate: {
|
|
|
696
699
|
*
|
|
697
700
|
* **Example** (Applying scoped mutations)
|
|
698
701
|
*
|
|
699
|
-
* ```ts
|
|
702
|
+
* ```ts import.meta.vitest
|
|
700
703
|
* import { Graph } from "effect"
|
|
701
704
|
*
|
|
702
705
|
* const graph = Graph.directed<string, number>()
|
|
@@ -706,8 +709,8 @@ export const mutate: {
|
|
|
706
709
|
* Graph.addEdge(mutable, nodeA, nodeB, 1)
|
|
707
710
|
* })
|
|
708
711
|
*
|
|
709
|
-
*
|
|
710
|
-
*
|
|
712
|
+
* Graph.nodeCount(newGraph) // => 2
|
|
713
|
+
* Graph.edgeCount(newGraph) // => 1
|
|
711
714
|
* ```
|
|
712
715
|
*
|
|
713
716
|
* @category mutations
|
|
@@ -719,7 +722,7 @@ export const mutate: {
|
|
|
719
722
|
*
|
|
720
723
|
* **Example** (Applying scoped mutations)
|
|
721
724
|
*
|
|
722
|
-
* ```ts
|
|
725
|
+
* ```ts import.meta.vitest
|
|
723
726
|
* import { Graph } from "effect"
|
|
724
727
|
*
|
|
725
728
|
* const graph = Graph.directed<string, number>()
|
|
@@ -729,8 +732,8 @@ export const mutate: {
|
|
|
729
732
|
* Graph.addEdge(mutable, nodeA, nodeB, 1)
|
|
730
733
|
* })
|
|
731
734
|
*
|
|
732
|
-
*
|
|
733
|
-
*
|
|
735
|
+
* Graph.nodeCount(newGraph) // => 2
|
|
736
|
+
* Graph.edgeCount(newGraph) // => 1
|
|
734
737
|
* ```
|
|
735
738
|
*
|
|
736
739
|
* @category mutations
|
|
@@ -914,7 +917,7 @@ const assertSameKind = <N, E>(self: Graph<N, E, Kind>, that: Graph<N, E, Kind>):
|
|
|
914
917
|
*
|
|
915
918
|
* **Example** (Combining graphs)
|
|
916
919
|
*
|
|
917
|
-
* ```ts
|
|
920
|
+
* ```ts import.meta.vitest
|
|
918
921
|
* import { Graph } from "effect"
|
|
919
922
|
*
|
|
920
923
|
* const left = Graph.directed<{ id: string }, string>((mutable) => {
|
|
@@ -933,8 +936,8 @@ const assertSameKind = <N, E>(self: Graph<N, E, Kind>, that: Graph<N, E, Kind>):
|
|
|
933
936
|
* nodeIdentity: (node) => node.id
|
|
934
937
|
* })
|
|
935
938
|
*
|
|
936
|
-
*
|
|
937
|
-
*
|
|
939
|
+
* Graph.nodeCount(result) // => 3
|
|
940
|
+
* Graph.edgeCount(result) // => 2
|
|
938
941
|
* ```
|
|
939
942
|
*
|
|
940
943
|
* @category set operations
|
|
@@ -962,7 +965,7 @@ export const compose: {
|
|
|
962
965
|
*
|
|
963
966
|
* **Example** (Combining graphs)
|
|
964
967
|
*
|
|
965
|
-
* ```ts
|
|
968
|
+
* ```ts import.meta.vitest
|
|
966
969
|
* import { Graph } from "effect"
|
|
967
970
|
*
|
|
968
971
|
* const left = Graph.directed<{ id: string }, string>((mutable) => {
|
|
@@ -981,8 +984,8 @@ export const compose: {
|
|
|
981
984
|
* nodeIdentity: (node) => node.id
|
|
982
985
|
* })
|
|
983
986
|
*
|
|
984
|
-
*
|
|
985
|
-
*
|
|
987
|
+
* Graph.nodeCount(result) // => 3
|
|
988
|
+
* Graph.edgeCount(result) // => 2
|
|
986
989
|
* ```
|
|
987
990
|
*
|
|
988
991
|
* @category set operations
|
|
@@ -1010,7 +1013,7 @@ export const compose: {
|
|
|
1010
1013
|
*
|
|
1011
1014
|
* **Example** (Combining graphs)
|
|
1012
1015
|
*
|
|
1013
|
-
* ```ts
|
|
1016
|
+
* ```ts import.meta.vitest
|
|
1014
1017
|
* import { Graph } from "effect"
|
|
1015
1018
|
*
|
|
1016
1019
|
* const left = Graph.directed<{ id: string }, string>((mutable) => {
|
|
@@ -1029,8 +1032,8 @@ export const compose: {
|
|
|
1029
1032
|
* nodeIdentity: (node) => node.id
|
|
1030
1033
|
* })
|
|
1031
1034
|
*
|
|
1032
|
-
*
|
|
1033
|
-
*
|
|
1035
|
+
* Graph.nodeCount(result) // => 3
|
|
1036
|
+
* Graph.edgeCount(result) // => 2
|
|
1034
1037
|
* ```
|
|
1035
1038
|
*
|
|
1036
1039
|
* @category set operations
|
|
@@ -1074,7 +1077,7 @@ export const compose: {
|
|
|
1074
1077
|
*
|
|
1075
1078
|
* **Example** (Combining graphs)
|
|
1076
1079
|
*
|
|
1077
|
-
* ```ts
|
|
1080
|
+
* ```ts import.meta.vitest
|
|
1078
1081
|
* import { Graph } from "effect"
|
|
1079
1082
|
*
|
|
1080
1083
|
* const left = Graph.directed<{ id: string }, string>((mutable) => {
|
|
@@ -1093,8 +1096,8 @@ export const compose: {
|
|
|
1093
1096
|
* nodeIdentity: (node) => node.id
|
|
1094
1097
|
* })
|
|
1095
1098
|
*
|
|
1096
|
-
*
|
|
1097
|
-
*
|
|
1099
|
+
* Graph.nodeCount(result) // => 3
|
|
1100
|
+
* Graph.edgeCount(result) // => 2
|
|
1098
1101
|
* ```
|
|
1099
1102
|
*
|
|
1100
1103
|
* @category set operations
|
|
@@ -1121,7 +1124,7 @@ export const compose: {
|
|
|
1121
1124
|
*
|
|
1122
1125
|
* **Example** (Combining graphs)
|
|
1123
1126
|
*
|
|
1124
|
-
* ```ts
|
|
1127
|
+
* ```ts import.meta.vitest
|
|
1125
1128
|
* import { Graph } from "effect"
|
|
1126
1129
|
*
|
|
1127
1130
|
* const left = Graph.directed<{ id: string }, string>((mutable) => {
|
|
@@ -1140,8 +1143,8 @@ export const compose: {
|
|
|
1140
1143
|
* nodeIdentity: (node) => node.id
|
|
1141
1144
|
* })
|
|
1142
1145
|
*
|
|
1143
|
-
*
|
|
1144
|
-
*
|
|
1146
|
+
* Graph.nodeCount(result) // => 3
|
|
1147
|
+
* Graph.edgeCount(result) // => 2
|
|
1145
1148
|
* ```
|
|
1146
1149
|
*
|
|
1147
1150
|
* @category set operations
|
|
@@ -1182,7 +1185,7 @@ export const compose: {
|
|
|
1182
1185
|
*
|
|
1183
1186
|
* **Example** (Combining graphs)
|
|
1184
1187
|
*
|
|
1185
|
-
* ```ts
|
|
1188
|
+
* ```ts import.meta.vitest
|
|
1186
1189
|
* import { Graph } from "effect"
|
|
1187
1190
|
*
|
|
1188
1191
|
* const left = Graph.directed<{ id: string }, string>((mutable) => {
|
|
@@ -1201,8 +1204,8 @@ export const compose: {
|
|
|
1201
1204
|
* nodeIdentity: (node) => node.id
|
|
1202
1205
|
* })
|
|
1203
1206
|
*
|
|
1204
|
-
*
|
|
1205
|
-
*
|
|
1207
|
+
* Graph.nodeCount(result) // => 3
|
|
1208
|
+
* Graph.edgeCount(result) // => 2
|
|
1206
1209
|
* ```
|
|
1207
1210
|
*
|
|
1208
1211
|
* @category set operations
|
|
@@ -1229,7 +1232,7 @@ export const compose: {
|
|
|
1229
1232
|
*
|
|
1230
1233
|
* **Example** (Combining graphs)
|
|
1231
1234
|
*
|
|
1232
|
-
* ```ts
|
|
1235
|
+
* ```ts import.meta.vitest
|
|
1233
1236
|
* import { Graph } from "effect"
|
|
1234
1237
|
*
|
|
1235
1238
|
* const left = Graph.directed<{ id: string }, string>((mutable) => {
|
|
@@ -1248,8 +1251,8 @@ export const compose: {
|
|
|
1248
1251
|
* nodeIdentity: (node) => node.id
|
|
1249
1252
|
* })
|
|
1250
1253
|
*
|
|
1251
|
-
*
|
|
1252
|
-
*
|
|
1254
|
+
* Graph.nodeCount(result) // => 3
|
|
1255
|
+
* Graph.edgeCount(result) // => 2
|
|
1253
1256
|
* ```
|
|
1254
1257
|
*
|
|
1255
1258
|
* @category set operations
|
|
@@ -1285,7 +1288,7 @@ export const compose: {
|
|
|
1285
1288
|
*
|
|
1286
1289
|
* **Example** (Finding shared structure)
|
|
1287
1290
|
*
|
|
1288
|
-
* ```ts
|
|
1291
|
+
* ```ts import.meta.vitest
|
|
1289
1292
|
* import { Graph } from "effect"
|
|
1290
1293
|
*
|
|
1291
1294
|
* const left = Graph.directed<string, string>((mutable) => {
|
|
@@ -1302,8 +1305,8 @@ export const compose: {
|
|
|
1302
1305
|
*
|
|
1303
1306
|
* const result = Graph.intersection(left, right)
|
|
1304
1307
|
*
|
|
1305
|
-
*
|
|
1306
|
-
*
|
|
1308
|
+
* Graph.nodeCount(result) // => 2
|
|
1309
|
+
* Graph.edgeCount(result) // => 1
|
|
1307
1310
|
* ```
|
|
1308
1311
|
*
|
|
1309
1312
|
* @category set operations
|
|
@@ -1330,7 +1333,7 @@ export const intersection: {
|
|
|
1330
1333
|
*
|
|
1331
1334
|
* **Example** (Finding shared structure)
|
|
1332
1335
|
*
|
|
1333
|
-
* ```ts
|
|
1336
|
+
* ```ts import.meta.vitest
|
|
1334
1337
|
* import { Graph } from "effect"
|
|
1335
1338
|
*
|
|
1336
1339
|
* const left = Graph.directed<string, string>((mutable) => {
|
|
@@ -1347,8 +1350,8 @@ export const intersection: {
|
|
|
1347
1350
|
*
|
|
1348
1351
|
* const result = Graph.intersection(left, right)
|
|
1349
1352
|
*
|
|
1350
|
-
*
|
|
1351
|
-
*
|
|
1353
|
+
* Graph.nodeCount(result) // => 2
|
|
1354
|
+
* Graph.edgeCount(result) // => 1
|
|
1352
1355
|
* ```
|
|
1353
1356
|
*
|
|
1354
1357
|
* @category set operations
|
|
@@ -1375,7 +1378,7 @@ export const intersection: {
|
|
|
1375
1378
|
*
|
|
1376
1379
|
* **Example** (Finding shared structure)
|
|
1377
1380
|
*
|
|
1378
|
-
* ```ts
|
|
1381
|
+
* ```ts import.meta.vitest
|
|
1379
1382
|
* import { Graph } from "effect"
|
|
1380
1383
|
*
|
|
1381
1384
|
* const left = Graph.directed<string, string>((mutable) => {
|
|
@@ -1392,8 +1395,8 @@ export const intersection: {
|
|
|
1392
1395
|
*
|
|
1393
1396
|
* const result = Graph.intersection(left, right)
|
|
1394
1397
|
*
|
|
1395
|
-
*
|
|
1396
|
-
*
|
|
1398
|
+
* Graph.nodeCount(result) // => 2
|
|
1399
|
+
* Graph.edgeCount(result) // => 1
|
|
1397
1400
|
* ```
|
|
1398
1401
|
*
|
|
1399
1402
|
* @category set operations
|
|
@@ -1435,7 +1438,7 @@ export const intersection: {
|
|
|
1435
1438
|
*
|
|
1436
1439
|
* **Example** (Finding shared structure)
|
|
1437
1440
|
*
|
|
1438
|
-
* ```ts
|
|
1441
|
+
* ```ts import.meta.vitest
|
|
1439
1442
|
* import { Graph } from "effect"
|
|
1440
1443
|
*
|
|
1441
1444
|
* const left = Graph.directed<string, string>((mutable) => {
|
|
@@ -1452,8 +1455,8 @@ export const intersection: {
|
|
|
1452
1455
|
*
|
|
1453
1456
|
* const result = Graph.intersection(left, right)
|
|
1454
1457
|
*
|
|
1455
|
-
*
|
|
1456
|
-
*
|
|
1458
|
+
* Graph.nodeCount(result) // => 2
|
|
1459
|
+
* Graph.edgeCount(result) // => 1
|
|
1457
1460
|
* ```
|
|
1458
1461
|
*
|
|
1459
1462
|
* @category set operations
|
|
@@ -1479,7 +1482,7 @@ export const intersection: {
|
|
|
1479
1482
|
*
|
|
1480
1483
|
* **Example** (Finding shared structure)
|
|
1481
1484
|
*
|
|
1482
|
-
* ```ts
|
|
1485
|
+
* ```ts import.meta.vitest
|
|
1483
1486
|
* import { Graph } from "effect"
|
|
1484
1487
|
*
|
|
1485
1488
|
* const left = Graph.directed<string, string>((mutable) => {
|
|
@@ -1496,8 +1499,8 @@ export const intersection: {
|
|
|
1496
1499
|
*
|
|
1497
1500
|
* const result = Graph.intersection(left, right)
|
|
1498
1501
|
*
|
|
1499
|
-
*
|
|
1500
|
-
*
|
|
1502
|
+
* Graph.nodeCount(result) // => 2
|
|
1503
|
+
* Graph.edgeCount(result) // => 1
|
|
1501
1504
|
* ```
|
|
1502
1505
|
*
|
|
1503
1506
|
* @category set operations
|
|
@@ -1525,7 +1528,7 @@ export const intersection: {
|
|
|
1525
1528
|
*
|
|
1526
1529
|
* **Example** (Finding shared structure)
|
|
1527
1530
|
*
|
|
1528
|
-
* ```ts
|
|
1531
|
+
* ```ts import.meta.vitest
|
|
1529
1532
|
* import { Graph } from "effect"
|
|
1530
1533
|
*
|
|
1531
1534
|
* const left = Graph.directed<string, string>((mutable) => {
|
|
@@ -1542,8 +1545,8 @@ export const intersection: {
|
|
|
1542
1545
|
*
|
|
1543
1546
|
* const result = Graph.intersection(left, right)
|
|
1544
1547
|
*
|
|
1545
|
-
*
|
|
1546
|
-
*
|
|
1548
|
+
* Graph.nodeCount(result) // => 2
|
|
1549
|
+
* Graph.edgeCount(result) // => 1
|
|
1547
1550
|
* ```
|
|
1548
1551
|
*
|
|
1549
1552
|
* @category set operations
|
|
@@ -1569,7 +1572,7 @@ export const intersection: {
|
|
|
1569
1572
|
*
|
|
1570
1573
|
* **Example** (Finding shared structure)
|
|
1571
1574
|
*
|
|
1572
|
-
* ```ts
|
|
1575
|
+
* ```ts import.meta.vitest
|
|
1573
1576
|
* import { Graph } from "effect"
|
|
1574
1577
|
*
|
|
1575
1578
|
* const left = Graph.directed<string, string>((mutable) => {
|
|
@@ -1586,8 +1589,8 @@ export const intersection: {
|
|
|
1586
1589
|
*
|
|
1587
1590
|
* const result = Graph.intersection(left, right)
|
|
1588
1591
|
*
|
|
1589
|
-
*
|
|
1590
|
-
*
|
|
1592
|
+
* Graph.nodeCount(result) // => 2
|
|
1593
|
+
* Graph.edgeCount(result) // => 1
|
|
1591
1594
|
* ```
|
|
1592
1595
|
*
|
|
1593
1596
|
* @category set operations
|
|
@@ -1630,7 +1633,7 @@ export const intersection: {
|
|
|
1630
1633
|
*
|
|
1631
1634
|
* **Example** (Finding shared structure)
|
|
1632
1635
|
*
|
|
1633
|
-
* ```ts
|
|
1636
|
+
* ```ts import.meta.vitest
|
|
1634
1637
|
* import { Graph } from "effect"
|
|
1635
1638
|
*
|
|
1636
1639
|
* const left = Graph.directed<string, string>((mutable) => {
|
|
@@ -1647,8 +1650,8 @@ export const intersection: {
|
|
|
1647
1650
|
*
|
|
1648
1651
|
* const result = Graph.intersection(left, right)
|
|
1649
1652
|
*
|
|
1650
|
-
*
|
|
1651
|
-
*
|
|
1653
|
+
* Graph.nodeCount(result) // => 2
|
|
1654
|
+
* Graph.edgeCount(result) // => 1
|
|
1652
1655
|
* ```
|
|
1653
1656
|
*
|
|
1654
1657
|
* @category set operations
|
|
@@ -1674,7 +1677,7 @@ export const intersection: {
|
|
|
1674
1677
|
*
|
|
1675
1678
|
* **Example** (Finding shared structure)
|
|
1676
1679
|
*
|
|
1677
|
-
* ```ts
|
|
1680
|
+
* ```ts import.meta.vitest
|
|
1678
1681
|
* import { Graph } from "effect"
|
|
1679
1682
|
*
|
|
1680
1683
|
* const left = Graph.directed<string, string>((mutable) => {
|
|
@@ -1691,8 +1694,8 @@ export const intersection: {
|
|
|
1691
1694
|
*
|
|
1692
1695
|
* const result = Graph.intersection(left, right)
|
|
1693
1696
|
*
|
|
1694
|
-
*
|
|
1695
|
-
*
|
|
1697
|
+
* Graph.nodeCount(result) // => 2
|
|
1698
|
+
* Graph.edgeCount(result) // => 1
|
|
1696
1699
|
* ```
|
|
1697
1700
|
*
|
|
1698
1701
|
* @category set operations
|
|
@@ -1730,7 +1733,7 @@ export const intersection: {
|
|
|
1730
1733
|
*
|
|
1731
1734
|
* **Example** (Removing shared edges)
|
|
1732
1735
|
*
|
|
1733
|
-
* ```ts
|
|
1736
|
+
* ```ts import.meta.vitest
|
|
1734
1737
|
* import { Graph } from "effect"
|
|
1735
1738
|
*
|
|
1736
1739
|
* const left = Graph.directed<string, string>((mutable) => {
|
|
@@ -1749,8 +1752,8 @@ export const intersection: {
|
|
|
1749
1752
|
*
|
|
1750
1753
|
* const result = Graph.difference(left, right)
|
|
1751
1754
|
*
|
|
1752
|
-
*
|
|
1753
|
-
*
|
|
1755
|
+
* Graph.nodeCount(result) // => 3
|
|
1756
|
+
* Graph.edgeCount(result) // => 1
|
|
1754
1757
|
* ```
|
|
1755
1758
|
*
|
|
1756
1759
|
* @category set operations
|
|
@@ -1778,7 +1781,7 @@ export const difference: {
|
|
|
1778
1781
|
*
|
|
1779
1782
|
* **Example** (Removing shared edges)
|
|
1780
1783
|
*
|
|
1781
|
-
* ```ts
|
|
1784
|
+
* ```ts import.meta.vitest
|
|
1782
1785
|
* import { Graph } from "effect"
|
|
1783
1786
|
*
|
|
1784
1787
|
* const left = Graph.directed<string, string>((mutable) => {
|
|
@@ -1797,8 +1800,8 @@ export const difference: {
|
|
|
1797
1800
|
*
|
|
1798
1801
|
* const result = Graph.difference(left, right)
|
|
1799
1802
|
*
|
|
1800
|
-
*
|
|
1801
|
-
*
|
|
1803
|
+
* Graph.nodeCount(result) // => 3
|
|
1804
|
+
* Graph.edgeCount(result) // => 1
|
|
1802
1805
|
* ```
|
|
1803
1806
|
*
|
|
1804
1807
|
* @category set operations
|
|
@@ -1826,7 +1829,7 @@ export const difference: {
|
|
|
1826
1829
|
*
|
|
1827
1830
|
* **Example** (Removing shared edges)
|
|
1828
1831
|
*
|
|
1829
|
-
* ```ts
|
|
1832
|
+
* ```ts import.meta.vitest
|
|
1830
1833
|
* import { Graph } from "effect"
|
|
1831
1834
|
*
|
|
1832
1835
|
* const left = Graph.directed<string, string>((mutable) => {
|
|
@@ -1845,8 +1848,8 @@ export const difference: {
|
|
|
1845
1848
|
*
|
|
1846
1849
|
* const result = Graph.difference(left, right)
|
|
1847
1850
|
*
|
|
1848
|
-
*
|
|
1849
|
-
*
|
|
1851
|
+
* Graph.nodeCount(result) // => 3
|
|
1852
|
+
* Graph.edgeCount(result) // => 1
|
|
1850
1853
|
* ```
|
|
1851
1854
|
*
|
|
1852
1855
|
* @category set operations
|
|
@@ -1891,7 +1894,7 @@ export const difference: {
|
|
|
1891
1894
|
*
|
|
1892
1895
|
* **Example** (Removing shared edges)
|
|
1893
1896
|
*
|
|
1894
|
-
* ```ts
|
|
1897
|
+
* ```ts import.meta.vitest
|
|
1895
1898
|
* import { Graph } from "effect"
|
|
1896
1899
|
*
|
|
1897
1900
|
* const left = Graph.directed<string, string>((mutable) => {
|
|
@@ -1910,8 +1913,8 @@ export const difference: {
|
|
|
1910
1913
|
*
|
|
1911
1914
|
* const result = Graph.difference(left, right)
|
|
1912
1915
|
*
|
|
1913
|
-
*
|
|
1914
|
-
*
|
|
1916
|
+
* Graph.nodeCount(result) // => 3
|
|
1917
|
+
* Graph.edgeCount(result) // => 1
|
|
1915
1918
|
* ```
|
|
1916
1919
|
*
|
|
1917
1920
|
* @category set operations
|
|
@@ -1938,7 +1941,7 @@ export const difference: {
|
|
|
1938
1941
|
*
|
|
1939
1942
|
* **Example** (Removing shared edges)
|
|
1940
1943
|
*
|
|
1941
|
-
* ```ts
|
|
1944
|
+
* ```ts import.meta.vitest
|
|
1942
1945
|
* import { Graph } from "effect"
|
|
1943
1946
|
*
|
|
1944
1947
|
* const left = Graph.directed<string, string>((mutable) => {
|
|
@@ -1957,8 +1960,8 @@ export const difference: {
|
|
|
1957
1960
|
*
|
|
1958
1961
|
* const result = Graph.difference(left, right)
|
|
1959
1962
|
*
|
|
1960
|
-
*
|
|
1961
|
-
*
|
|
1963
|
+
* Graph.nodeCount(result) // => 3
|
|
1964
|
+
* Graph.edgeCount(result) // => 1
|
|
1962
1965
|
* ```
|
|
1963
1966
|
*
|
|
1964
1967
|
* @category set operations
|
|
@@ -2001,7 +2004,7 @@ export const difference: {
|
|
|
2001
2004
|
*
|
|
2002
2005
|
* **Example** (Finding differing edges)
|
|
2003
2006
|
*
|
|
2004
|
-
* ```ts
|
|
2007
|
+
* ```ts import.meta.vitest
|
|
2005
2008
|
* import { Graph } from "effect"
|
|
2006
2009
|
*
|
|
2007
2010
|
* const left = Graph.directed<string, string>((mutable) => {
|
|
@@ -2022,8 +2025,8 @@ export const difference: {
|
|
|
2022
2025
|
*
|
|
2023
2026
|
* const result = Graph.symmetricDifference(left, right)
|
|
2024
2027
|
*
|
|
2025
|
-
*
|
|
2026
|
-
*
|
|
2028
|
+
* Graph.nodeCount(result) // => 4
|
|
2029
|
+
* Graph.edgeCount(result) // => 2
|
|
2027
2030
|
* ```
|
|
2028
2031
|
*
|
|
2029
2032
|
* @category set operations
|
|
@@ -2053,7 +2056,7 @@ export const symmetricDifference: {
|
|
|
2053
2056
|
*
|
|
2054
2057
|
* **Example** (Finding differing edges)
|
|
2055
2058
|
*
|
|
2056
|
-
* ```ts
|
|
2059
|
+
* ```ts import.meta.vitest
|
|
2057
2060
|
* import { Graph } from "effect"
|
|
2058
2061
|
*
|
|
2059
2062
|
* const left = Graph.directed<string, string>((mutable) => {
|
|
@@ -2074,8 +2077,8 @@ export const symmetricDifference: {
|
|
|
2074
2077
|
*
|
|
2075
2078
|
* const result = Graph.symmetricDifference(left, right)
|
|
2076
2079
|
*
|
|
2077
|
-
*
|
|
2078
|
-
*
|
|
2080
|
+
* Graph.nodeCount(result) // => 4
|
|
2081
|
+
* Graph.edgeCount(result) // => 2
|
|
2079
2082
|
* ```
|
|
2080
2083
|
*
|
|
2081
2084
|
* @category set operations
|
|
@@ -2105,7 +2108,7 @@ export const symmetricDifference: {
|
|
|
2105
2108
|
*
|
|
2106
2109
|
* **Example** (Finding differing edges)
|
|
2107
2110
|
*
|
|
2108
|
-
* ```ts
|
|
2111
|
+
* ```ts import.meta.vitest
|
|
2109
2112
|
* import { Graph } from "effect"
|
|
2110
2113
|
*
|
|
2111
2114
|
* const left = Graph.directed<string, string>((mutable) => {
|
|
@@ -2126,8 +2129,8 @@ export const symmetricDifference: {
|
|
|
2126
2129
|
*
|
|
2127
2130
|
* const result = Graph.symmetricDifference(left, right)
|
|
2128
2131
|
*
|
|
2129
|
-
*
|
|
2130
|
-
*
|
|
2132
|
+
* Graph.nodeCount(result) // => 4
|
|
2133
|
+
* Graph.edgeCount(result) // => 2
|
|
2131
2134
|
* ```
|
|
2132
2135
|
*
|
|
2133
2136
|
* @category set operations
|
|
@@ -2171,7 +2174,7 @@ export const symmetricDifference: {
|
|
|
2171
2174
|
*
|
|
2172
2175
|
* **Example** (Finding differing edges)
|
|
2173
2176
|
*
|
|
2174
|
-
* ```ts
|
|
2177
|
+
* ```ts import.meta.vitest
|
|
2175
2178
|
* import { Graph } from "effect"
|
|
2176
2179
|
*
|
|
2177
2180
|
* const left = Graph.directed<string, string>((mutable) => {
|
|
@@ -2192,8 +2195,8 @@ export const symmetricDifference: {
|
|
|
2192
2195
|
*
|
|
2193
2196
|
* const result = Graph.symmetricDifference(left, right)
|
|
2194
2197
|
*
|
|
2195
|
-
*
|
|
2196
|
-
*
|
|
2198
|
+
* Graph.nodeCount(result) // => 4
|
|
2199
|
+
* Graph.edgeCount(result) // => 2
|
|
2197
2200
|
* ```
|
|
2198
2201
|
*
|
|
2199
2202
|
* @category set operations
|
|
@@ -2222,7 +2225,7 @@ export const symmetricDifference: {
|
|
|
2222
2225
|
*
|
|
2223
2226
|
* **Example** (Finding differing edges)
|
|
2224
2227
|
*
|
|
2225
|
-
* ```ts
|
|
2228
|
+
* ```ts import.meta.vitest
|
|
2226
2229
|
* import { Graph } from "effect"
|
|
2227
2230
|
*
|
|
2228
2231
|
* const left = Graph.directed<string, string>((mutable) => {
|
|
@@ -2243,8 +2246,8 @@ export const symmetricDifference: {
|
|
|
2243
2246
|
*
|
|
2244
2247
|
* const result = Graph.symmetricDifference(left, right)
|
|
2245
2248
|
*
|
|
2246
|
-
*
|
|
2247
|
-
*
|
|
2249
|
+
* Graph.nodeCount(result) // => 4
|
|
2250
|
+
* Graph.edgeCount(result) // => 2
|
|
2248
2251
|
* ```
|
|
2249
2252
|
*
|
|
2250
2253
|
* @category set operations
|
|
@@ -2285,7 +2288,7 @@ export const symmetricDifference: {
|
|
|
2285
2288
|
*
|
|
2286
2289
|
* **Example** (Finding differing edges)
|
|
2287
2290
|
*
|
|
2288
|
-
* ```ts
|
|
2291
|
+
* ```ts import.meta.vitest
|
|
2289
2292
|
* import { Graph } from "effect"
|
|
2290
2293
|
*
|
|
2291
2294
|
* const left = Graph.directed<string, string>((mutable) => {
|
|
@@ -2306,8 +2309,8 @@ export const symmetricDifference: {
|
|
|
2306
2309
|
*
|
|
2307
2310
|
* const result = Graph.symmetricDifference(left, right)
|
|
2308
2311
|
*
|
|
2309
|
-
*
|
|
2310
|
-
*
|
|
2312
|
+
* Graph.nodeCount(result) // => 4
|
|
2313
|
+
* Graph.edgeCount(result) // => 2
|
|
2311
2314
|
* ```
|
|
2312
2315
|
*
|
|
2313
2316
|
* @category set operations
|
|
@@ -2336,7 +2339,7 @@ export const symmetricDifference: {
|
|
|
2336
2339
|
*
|
|
2337
2340
|
* **Example** (Finding differing edges)
|
|
2338
2341
|
*
|
|
2339
|
-
* ```ts
|
|
2342
|
+
* ```ts import.meta.vitest
|
|
2340
2343
|
* import { Graph } from "effect"
|
|
2341
2344
|
*
|
|
2342
2345
|
* const left = Graph.directed<string, string>((mutable) => {
|
|
@@ -2357,8 +2360,8 @@ export const symmetricDifference: {
|
|
|
2357
2360
|
*
|
|
2358
2361
|
* const result = Graph.symmetricDifference(left, right)
|
|
2359
2362
|
*
|
|
2360
|
-
*
|
|
2361
|
-
*
|
|
2363
|
+
* Graph.nodeCount(result) // => 4
|
|
2364
|
+
* Graph.edgeCount(result) // => 2
|
|
2362
2365
|
* ```
|
|
2363
2366
|
*
|
|
2364
2367
|
* @category set operations
|
|
@@ -2394,7 +2397,7 @@ export const symmetricDifference: {
|
|
|
2394
2397
|
*
|
|
2395
2398
|
* **Example** (Finding missing relationships)
|
|
2396
2399
|
*
|
|
2397
|
-
* ```ts
|
|
2400
|
+
* ```ts import.meta.vitest
|
|
2398
2401
|
* import { Graph } from "effect"
|
|
2399
2402
|
*
|
|
2400
2403
|
* const graph = Graph.directed<string, string>((mutable) => {
|
|
@@ -2405,7 +2408,7 @@ export const symmetricDifference: {
|
|
|
2405
2408
|
*
|
|
2406
2409
|
* const result = Graph.complement(graph, (source, target) => `${source}-${target}`)
|
|
2407
2410
|
*
|
|
2408
|
-
*
|
|
2411
|
+
* Graph.edgeCount(result) // => 1
|
|
2409
2412
|
* ```
|
|
2410
2413
|
*
|
|
2411
2414
|
* @category set operations
|
|
@@ -2425,7 +2428,7 @@ export const complement: {
|
|
|
2425
2428
|
*
|
|
2426
2429
|
* **Example** (Finding missing relationships)
|
|
2427
2430
|
*
|
|
2428
|
-
* ```ts
|
|
2431
|
+
* ```ts import.meta.vitest
|
|
2429
2432
|
* import { Graph } from "effect"
|
|
2430
2433
|
*
|
|
2431
2434
|
* const graph = Graph.directed<string, string>((mutable) => {
|
|
@@ -2436,7 +2439,7 @@ export const complement: {
|
|
|
2436
2439
|
*
|
|
2437
2440
|
* const result = Graph.complement(graph, (source, target) => `${source}-${target}`)
|
|
2438
2441
|
*
|
|
2439
|
-
*
|
|
2442
|
+
* Graph.edgeCount(result) // => 1
|
|
2440
2443
|
* ```
|
|
2441
2444
|
*
|
|
2442
2445
|
* @category set operations
|
|
@@ -2456,7 +2459,7 @@ export const complement: {
|
|
|
2456
2459
|
*
|
|
2457
2460
|
* **Example** (Finding missing relationships)
|
|
2458
2461
|
*
|
|
2459
|
-
* ```ts
|
|
2462
|
+
* ```ts import.meta.vitest
|
|
2460
2463
|
* import { Graph } from "effect"
|
|
2461
2464
|
*
|
|
2462
2465
|
* const graph = Graph.directed<string, string>((mutable) => {
|
|
@@ -2467,7 +2470,7 @@ export const complement: {
|
|
|
2467
2470
|
*
|
|
2468
2471
|
* const result = Graph.complement(graph, (source, target) => `${source}-${target}`)
|
|
2469
2472
|
*
|
|
2470
|
-
*
|
|
2473
|
+
* Graph.edgeCount(result) // => 1
|
|
2471
2474
|
* ```
|
|
2472
2475
|
*
|
|
2473
2476
|
* @category set operations
|
|
@@ -2494,7 +2497,7 @@ export const complement: {
|
|
|
2494
2497
|
*
|
|
2495
2498
|
* **Example** (Finding missing relationships)
|
|
2496
2499
|
*
|
|
2497
|
-
* ```ts
|
|
2500
|
+
* ```ts import.meta.vitest
|
|
2498
2501
|
* import { Graph } from "effect"
|
|
2499
2502
|
*
|
|
2500
2503
|
* const graph = Graph.directed<string, string>((mutable) => {
|
|
@@ -2505,7 +2508,7 @@ export const complement: {
|
|
|
2505
2508
|
*
|
|
2506
2509
|
* const result = Graph.complement(graph, (source, target) => `${source}-${target}`)
|
|
2507
2510
|
*
|
|
2508
|
-
*
|
|
2511
|
+
* Graph.edgeCount(result) // => 1
|
|
2509
2512
|
* ```
|
|
2510
2513
|
*
|
|
2511
2514
|
* @category set operations
|
|
@@ -2524,7 +2527,7 @@ export const complement: {
|
|
|
2524
2527
|
*
|
|
2525
2528
|
* **Example** (Finding missing relationships)
|
|
2526
2529
|
*
|
|
2527
|
-
* ```ts
|
|
2530
|
+
* ```ts import.meta.vitest
|
|
2528
2531
|
* import { Graph } from "effect"
|
|
2529
2532
|
*
|
|
2530
2533
|
* const graph = Graph.directed<string, string>((mutable) => {
|
|
@@ -2535,7 +2538,7 @@ export const complement: {
|
|
|
2535
2538
|
*
|
|
2536
2539
|
* const result = Graph.complement(graph, (source, target) => `${source}-${target}`)
|
|
2537
2540
|
*
|
|
2538
|
-
*
|
|
2541
|
+
* Graph.edgeCount(result) // => 1
|
|
2539
2542
|
* ```
|
|
2540
2543
|
*
|
|
2541
2544
|
* @category set operations
|
|
@@ -2598,7 +2601,7 @@ export interface NeighborhoodConfig {
|
|
|
2598
2601
|
*
|
|
2599
2602
|
* **Example** (Getting a local neighborhood)
|
|
2600
2603
|
*
|
|
2601
|
-
* ```ts
|
|
2604
|
+
* ```ts import.meta.vitest
|
|
2602
2605
|
* import { Graph } from "effect"
|
|
2603
2606
|
*
|
|
2604
2607
|
* const graph = Graph.directed<string, string>((mutable) => {
|
|
@@ -2611,7 +2614,7 @@ export interface NeighborhoodConfig {
|
|
|
2611
2614
|
*
|
|
2612
2615
|
* const result = Graph.neighborhood(graph, 1, { radius: 1 })
|
|
2613
2616
|
*
|
|
2614
|
-
*
|
|
2617
|
+
* Graph.nodeCount(result) // => 2
|
|
2615
2618
|
* ```
|
|
2616
2619
|
*
|
|
2617
2620
|
* @category set operations
|
|
@@ -2631,7 +2634,7 @@ export const neighborhood: {
|
|
|
2631
2634
|
*
|
|
2632
2635
|
* **Example** (Getting a local neighborhood)
|
|
2633
2636
|
*
|
|
2634
|
-
* ```ts
|
|
2637
|
+
* ```ts import.meta.vitest
|
|
2635
2638
|
* import { Graph } from "effect"
|
|
2636
2639
|
*
|
|
2637
2640
|
* const graph = Graph.directed<string, string>((mutable) => {
|
|
@@ -2644,7 +2647,7 @@ export const neighborhood: {
|
|
|
2644
2647
|
*
|
|
2645
2648
|
* const result = Graph.neighborhood(graph, 1, { radius: 1 })
|
|
2646
2649
|
*
|
|
2647
|
-
*
|
|
2650
|
+
* Graph.nodeCount(result) // => 2
|
|
2648
2651
|
* ```
|
|
2649
2652
|
*
|
|
2650
2653
|
* @category set operations
|
|
@@ -2664,7 +2667,7 @@ export const neighborhood: {
|
|
|
2664
2667
|
*
|
|
2665
2668
|
* **Example** (Getting a local neighborhood)
|
|
2666
2669
|
*
|
|
2667
|
-
* ```ts
|
|
2670
|
+
* ```ts import.meta.vitest
|
|
2668
2671
|
* import { Graph } from "effect"
|
|
2669
2672
|
*
|
|
2670
2673
|
* const graph = Graph.directed<string, string>((mutable) => {
|
|
@@ -2677,7 +2680,7 @@ export const neighborhood: {
|
|
|
2677
2680
|
*
|
|
2678
2681
|
* const result = Graph.neighborhood(graph, 1, { radius: 1 })
|
|
2679
2682
|
*
|
|
2680
|
-
*
|
|
2683
|
+
* Graph.nodeCount(result) // => 2
|
|
2681
2684
|
* ```
|
|
2682
2685
|
*
|
|
2683
2686
|
* @category set operations
|
|
@@ -2711,7 +2714,7 @@ export const neighborhood: {
|
|
|
2711
2714
|
*
|
|
2712
2715
|
* **Example** (Getting a local neighborhood)
|
|
2713
2716
|
*
|
|
2714
|
-
* ```ts
|
|
2717
|
+
* ```ts import.meta.vitest
|
|
2715
2718
|
* import { Graph } from "effect"
|
|
2716
2719
|
*
|
|
2717
2720
|
* const graph = Graph.directed<string, string>((mutable) => {
|
|
@@ -2724,7 +2727,7 @@ export const neighborhood: {
|
|
|
2724
2727
|
*
|
|
2725
2728
|
* const result = Graph.neighborhood(graph, 1, { radius: 1 })
|
|
2726
2729
|
*
|
|
2727
|
-
*
|
|
2730
|
+
* Graph.nodeCount(result) // => 2
|
|
2728
2731
|
* ```
|
|
2729
2732
|
*
|
|
2730
2733
|
* @category set operations
|
|
@@ -2743,7 +2746,7 @@ export const neighborhood: {
|
|
|
2743
2746
|
*
|
|
2744
2747
|
* **Example** (Getting a local neighborhood)
|
|
2745
2748
|
*
|
|
2746
|
-
* ```ts
|
|
2749
|
+
* ```ts import.meta.vitest
|
|
2747
2750
|
* import { Graph } from "effect"
|
|
2748
2751
|
*
|
|
2749
2752
|
* const graph = Graph.directed<string, string>((mutable) => {
|
|
@@ -2756,7 +2759,7 @@ export const neighborhood: {
|
|
|
2756
2759
|
*
|
|
2757
2760
|
* const result = Graph.neighborhood(graph, 1, { radius: 1 })
|
|
2758
2761
|
*
|
|
2759
|
-
*
|
|
2762
|
+
* Graph.nodeCount(result) // => 2
|
|
2760
2763
|
* ```
|
|
2761
2764
|
*
|
|
2762
2765
|
* @category set operations
|
|
@@ -2903,14 +2906,12 @@ export const sum: {
|
|
|
2903
2906
|
*
|
|
2904
2907
|
* **Example** (Adding nodes)
|
|
2905
2908
|
*
|
|
2906
|
-
* ```ts
|
|
2909
|
+
* ```ts import.meta.vitest
|
|
2907
2910
|
* import { Graph } from "effect"
|
|
2908
2911
|
*
|
|
2909
|
-
*
|
|
2910
|
-
*
|
|
2911
|
-
*
|
|
2912
|
-
* console.log(nodeA) // NodeIndex with value 0
|
|
2913
|
-
* console.log(nodeB) // NodeIndex with value 1
|
|
2912
|
+
* Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
2913
|
+
* Graph.addNode(mutable, "Node A") // => 0
|
|
2914
|
+
* Graph.addNode(mutable, "Node B") // => 1
|
|
2914
2915
|
* })
|
|
2915
2916
|
* ```
|
|
2916
2917
|
*
|
|
@@ -2948,19 +2949,14 @@ export const addNode = <N, E, T extends Kind = "directed">(
|
|
|
2948
2949
|
*
|
|
2949
2950
|
* **Example** (Getting node data)
|
|
2950
2951
|
*
|
|
2951
|
-
* ```ts
|
|
2952
|
+
* ```ts import.meta.vitest
|
|
2952
2953
|
* import { Graph, Option } from "effect"
|
|
2953
2954
|
*
|
|
2954
2955
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
2955
2956
|
* Graph.addNode(mutable, "Node A")
|
|
2956
2957
|
* })
|
|
2957
2958
|
*
|
|
2958
|
-
*
|
|
2959
|
-
* const nodeData = Graph.getNode(graph, nodeIndex)
|
|
2960
|
-
*
|
|
2961
|
-
* if (Option.isSome(nodeData)) {
|
|
2962
|
-
* console.log(nodeData.value) // "Node A"
|
|
2963
|
-
* }
|
|
2959
|
+
* Graph.getNode(graph, 0) // => Option.some("Node A")
|
|
2964
2960
|
* ```
|
|
2965
2961
|
*
|
|
2966
2962
|
* @category getters
|
|
@@ -2972,19 +2968,14 @@ export const getNode: {
|
|
|
2972
2968
|
*
|
|
2973
2969
|
* **Example** (Getting node data)
|
|
2974
2970
|
*
|
|
2975
|
-
* ```ts
|
|
2971
|
+
* ```ts import.meta.vitest
|
|
2976
2972
|
* import { Graph, Option } from "effect"
|
|
2977
2973
|
*
|
|
2978
2974
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
2979
2975
|
* Graph.addNode(mutable, "Node A")
|
|
2980
2976
|
* })
|
|
2981
2977
|
*
|
|
2982
|
-
*
|
|
2983
|
-
* const nodeData = Graph.getNode(graph, nodeIndex)
|
|
2984
|
-
*
|
|
2985
|
-
* if (Option.isSome(nodeData)) {
|
|
2986
|
-
* console.log(nodeData.value) // "Node A"
|
|
2987
|
-
* }
|
|
2978
|
+
* Graph.getNode(graph, 0) // => Option.some("Node A")
|
|
2988
2979
|
* ```
|
|
2989
2980
|
*
|
|
2990
2981
|
* @category getters
|
|
@@ -2998,19 +2989,14 @@ export const getNode: {
|
|
|
2998
2989
|
*
|
|
2999
2990
|
* **Example** (Getting node data)
|
|
3000
2991
|
*
|
|
3001
|
-
* ```ts
|
|
2992
|
+
* ```ts import.meta.vitest
|
|
3002
2993
|
* import { Graph, Option } from "effect"
|
|
3003
2994
|
*
|
|
3004
2995
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
3005
2996
|
* Graph.addNode(mutable, "Node A")
|
|
3006
2997
|
* })
|
|
3007
2998
|
*
|
|
3008
|
-
*
|
|
3009
|
-
* const nodeData = Graph.getNode(graph, nodeIndex)
|
|
3010
|
-
*
|
|
3011
|
-
* if (Option.isSome(nodeData)) {
|
|
3012
|
-
* console.log(nodeData.value) // "Node A"
|
|
3013
|
-
* }
|
|
2999
|
+
* Graph.getNode(graph, 0) // => Option.some("Node A")
|
|
3014
3000
|
* ```
|
|
3015
3001
|
*
|
|
3016
3002
|
* @category getters
|
|
@@ -3030,20 +3016,15 @@ export const getNode: {
|
|
|
3030
3016
|
*
|
|
3031
3017
|
* **Example** (Checking node existence)
|
|
3032
3018
|
*
|
|
3033
|
-
* ```ts
|
|
3019
|
+
* ```ts import.meta.vitest
|
|
3034
3020
|
* import { Graph } from "effect"
|
|
3035
3021
|
*
|
|
3036
3022
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
3037
3023
|
* Graph.addNode(mutable, "Node A")
|
|
3038
3024
|
* })
|
|
3039
3025
|
*
|
|
3040
|
-
*
|
|
3041
|
-
*
|
|
3042
|
-
* console.log(exists) // true
|
|
3043
|
-
*
|
|
3044
|
-
* const nonExistentIndex = 999
|
|
3045
|
-
* const notExists = Graph.hasNode(graph, nonExistentIndex)
|
|
3046
|
-
* console.log(notExists) // false
|
|
3026
|
+
* Graph.hasNode(graph, 0) // => true
|
|
3027
|
+
* Graph.hasNode(graph, 999) // => false
|
|
3047
3028
|
* ```
|
|
3048
3029
|
*
|
|
3049
3030
|
* @category getters
|
|
@@ -3055,20 +3036,15 @@ export const hasNode: {
|
|
|
3055
3036
|
*
|
|
3056
3037
|
* **Example** (Checking node existence)
|
|
3057
3038
|
*
|
|
3058
|
-
* ```ts
|
|
3039
|
+
* ```ts import.meta.vitest
|
|
3059
3040
|
* import { Graph } from "effect"
|
|
3060
3041
|
*
|
|
3061
3042
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
3062
3043
|
* Graph.addNode(mutable, "Node A")
|
|
3063
3044
|
* })
|
|
3064
3045
|
*
|
|
3065
|
-
*
|
|
3066
|
-
*
|
|
3067
|
-
* console.log(exists) // true
|
|
3068
|
-
*
|
|
3069
|
-
* const nonExistentIndex = 999
|
|
3070
|
-
* const notExists = Graph.hasNode(graph, nonExistentIndex)
|
|
3071
|
-
* console.log(notExists) // false
|
|
3046
|
+
* Graph.hasNode(graph, 0) // => true
|
|
3047
|
+
* Graph.hasNode(graph, 999) // => false
|
|
3072
3048
|
* ```
|
|
3073
3049
|
*
|
|
3074
3050
|
* @category getters
|
|
@@ -3080,20 +3056,15 @@ export const hasNode: {
|
|
|
3080
3056
|
*
|
|
3081
3057
|
* **Example** (Checking node existence)
|
|
3082
3058
|
*
|
|
3083
|
-
* ```ts
|
|
3059
|
+
* ```ts import.meta.vitest
|
|
3084
3060
|
* import { Graph } from "effect"
|
|
3085
3061
|
*
|
|
3086
3062
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
3087
3063
|
* Graph.addNode(mutable, "Node A")
|
|
3088
3064
|
* })
|
|
3089
3065
|
*
|
|
3090
|
-
*
|
|
3091
|
-
*
|
|
3092
|
-
* console.log(exists) // true
|
|
3093
|
-
*
|
|
3094
|
-
* const nonExistentIndex = 999
|
|
3095
|
-
* const notExists = Graph.hasNode(graph, nonExistentIndex)
|
|
3096
|
-
* console.log(notExists) // false
|
|
3066
|
+
* Graph.hasNode(graph, 0) // => true
|
|
3067
|
+
* Graph.hasNode(graph, 999) // => false
|
|
3097
3068
|
* ```
|
|
3098
3069
|
*
|
|
3099
3070
|
* @category getters
|
|
@@ -3110,11 +3081,11 @@ export const hasNode: {
|
|
|
3110
3081
|
*
|
|
3111
3082
|
* **Example** (Counting nodes)
|
|
3112
3083
|
*
|
|
3113
|
-
* ```ts
|
|
3084
|
+
* ```ts import.meta.vitest
|
|
3114
3085
|
* import { Graph } from "effect"
|
|
3115
3086
|
*
|
|
3116
3087
|
* const emptyGraph = Graph.directed<string, number>()
|
|
3117
|
-
*
|
|
3088
|
+
* Graph.nodeCount(emptyGraph) // => 0
|
|
3118
3089
|
*
|
|
3119
3090
|
* const graphWithNodes = Graph.mutate(emptyGraph, (mutable) => {
|
|
3120
3091
|
* Graph.addNode(mutable, "Node A")
|
|
@@ -3122,7 +3093,7 @@ export const hasNode: {
|
|
|
3122
3093
|
* Graph.addNode(mutable, "Node C")
|
|
3123
3094
|
* })
|
|
3124
3095
|
*
|
|
3125
|
-
*
|
|
3096
|
+
* Graph.nodeCount(graphWithNodes) // => 3
|
|
3126
3097
|
* ```
|
|
3127
3098
|
*
|
|
3128
3099
|
* @category getters
|
|
@@ -3137,8 +3108,8 @@ export const nodeCount = <N, E, T extends Kind = "directed">(
|
|
|
3137
3108
|
*
|
|
3138
3109
|
* **Example** (Finding the first matching node)
|
|
3139
3110
|
*
|
|
3140
|
-
* ```ts
|
|
3141
|
-
* import { Graph } from "effect"
|
|
3111
|
+
* ```ts import.meta.vitest
|
|
3112
|
+
* import { Graph, Option } from "effect"
|
|
3142
3113
|
*
|
|
3143
3114
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
3144
3115
|
* Graph.addNode(mutable, "Node A")
|
|
@@ -3146,11 +3117,8 @@ export const nodeCount = <N, E, T extends Kind = "directed">(
|
|
|
3146
3117
|
* Graph.addNode(mutable, "Node C")
|
|
3147
3118
|
* })
|
|
3148
3119
|
*
|
|
3149
|
-
*
|
|
3150
|
-
*
|
|
3151
|
-
*
|
|
3152
|
-
* const notFound = Graph.findNode(graph, (data) => data === "Node D")
|
|
3153
|
-
* console.log(notFound) // Option.none()
|
|
3120
|
+
* Graph.findNode(graph, (data) => data.startsWith("Node B")) // => Option.some(1)
|
|
3121
|
+
* Graph.findNode(graph, (data) => data === "Node D") // => Option.none()
|
|
3154
3122
|
* ```
|
|
3155
3123
|
*
|
|
3156
3124
|
* @category getters
|
|
@@ -3162,8 +3130,8 @@ export const findNode: {
|
|
|
3162
3130
|
*
|
|
3163
3131
|
* **Example** (Finding the first matching node)
|
|
3164
3132
|
*
|
|
3165
|
-
* ```ts
|
|
3166
|
-
* import { Graph } from "effect"
|
|
3133
|
+
* ```ts import.meta.vitest
|
|
3134
|
+
* import { Graph, Option } from "effect"
|
|
3167
3135
|
*
|
|
3168
3136
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
3169
3137
|
* Graph.addNode(mutable, "Node A")
|
|
@@ -3171,11 +3139,8 @@ export const findNode: {
|
|
|
3171
3139
|
* Graph.addNode(mutable, "Node C")
|
|
3172
3140
|
* })
|
|
3173
3141
|
*
|
|
3174
|
-
*
|
|
3175
|
-
*
|
|
3176
|
-
*
|
|
3177
|
-
* const notFound = Graph.findNode(graph, (data) => data === "Node D")
|
|
3178
|
-
* console.log(notFound) // Option.none()
|
|
3142
|
+
* Graph.findNode(graph, (data) => data.startsWith("Node B")) // => Option.some(1)
|
|
3143
|
+
* Graph.findNode(graph, (data) => data === "Node D") // => Option.none()
|
|
3179
3144
|
* ```
|
|
3180
3145
|
*
|
|
3181
3146
|
* @category getters
|
|
@@ -3187,8 +3152,8 @@ export const findNode: {
|
|
|
3187
3152
|
*
|
|
3188
3153
|
* **Example** (Finding the first matching node)
|
|
3189
3154
|
*
|
|
3190
|
-
* ```ts
|
|
3191
|
-
* import { Graph } from "effect"
|
|
3155
|
+
* ```ts import.meta.vitest
|
|
3156
|
+
* import { Graph, Option } from "effect"
|
|
3192
3157
|
*
|
|
3193
3158
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
3194
3159
|
* Graph.addNode(mutable, "Node A")
|
|
@@ -3196,11 +3161,8 @@ export const findNode: {
|
|
|
3196
3161
|
* Graph.addNode(mutable, "Node C")
|
|
3197
3162
|
* })
|
|
3198
3163
|
*
|
|
3199
|
-
*
|
|
3200
|
-
*
|
|
3201
|
-
*
|
|
3202
|
-
* const notFound = Graph.findNode(graph, (data) => data === "Node D")
|
|
3203
|
-
* console.log(notFound) // Option.none()
|
|
3164
|
+
* Graph.findNode(graph, (data) => data.startsWith("Node B")) // => Option.some(1)
|
|
3165
|
+
* Graph.findNode(graph, (data) => data === "Node D") // => Option.none()
|
|
3204
3166
|
* ```
|
|
3205
3167
|
*
|
|
3206
3168
|
* @category getters
|
|
@@ -3228,7 +3190,7 @@ export const findNode: {
|
|
|
3228
3190
|
*
|
|
3229
3191
|
* **Example** (Finding matching nodes)
|
|
3230
3192
|
*
|
|
3231
|
-
* ```ts
|
|
3193
|
+
* ```ts import.meta.vitest
|
|
3232
3194
|
* import { Graph } from "effect"
|
|
3233
3195
|
*
|
|
3234
3196
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
@@ -3237,11 +3199,8 @@ export const findNode: {
|
|
|
3237
3199
|
* Graph.addNode(mutable, "Start C")
|
|
3238
3200
|
* })
|
|
3239
3201
|
*
|
|
3240
|
-
*
|
|
3241
|
-
*
|
|
3242
|
-
*
|
|
3243
|
-
* const empty = Graph.findNodes(graph, (data) => data === "Not Found")
|
|
3244
|
-
* console.log(empty) // []
|
|
3202
|
+
* Graph.findNodes(graph, (data) => data.startsWith("Start")) // => [0, 2]
|
|
3203
|
+
* Graph.findNodes(graph, (data) => data === "Not Found") // => []
|
|
3245
3204
|
* ```
|
|
3246
3205
|
*
|
|
3247
3206
|
* @category getters
|
|
@@ -3253,7 +3212,7 @@ export const findNodes: {
|
|
|
3253
3212
|
*
|
|
3254
3213
|
* **Example** (Finding matching nodes)
|
|
3255
3214
|
*
|
|
3256
|
-
* ```ts
|
|
3215
|
+
* ```ts import.meta.vitest
|
|
3257
3216
|
* import { Graph } from "effect"
|
|
3258
3217
|
*
|
|
3259
3218
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
@@ -3262,11 +3221,8 @@ export const findNodes: {
|
|
|
3262
3221
|
* Graph.addNode(mutable, "Start C")
|
|
3263
3222
|
* })
|
|
3264
3223
|
*
|
|
3265
|
-
*
|
|
3266
|
-
*
|
|
3267
|
-
*
|
|
3268
|
-
* const empty = Graph.findNodes(graph, (data) => data === "Not Found")
|
|
3269
|
-
* console.log(empty) // []
|
|
3224
|
+
* Graph.findNodes(graph, (data) => data.startsWith("Start")) // => [0, 2]
|
|
3225
|
+
* Graph.findNodes(graph, (data) => data === "Not Found") // => []
|
|
3270
3226
|
* ```
|
|
3271
3227
|
*
|
|
3272
3228
|
* @category getters
|
|
@@ -3278,7 +3234,7 @@ export const findNodes: {
|
|
|
3278
3234
|
*
|
|
3279
3235
|
* **Example** (Finding matching nodes)
|
|
3280
3236
|
*
|
|
3281
|
-
* ```ts
|
|
3237
|
+
* ```ts import.meta.vitest
|
|
3282
3238
|
* import { Graph } from "effect"
|
|
3283
3239
|
*
|
|
3284
3240
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
@@ -3287,11 +3243,8 @@ export const findNodes: {
|
|
|
3287
3243
|
* Graph.addNode(mutable, "Start C")
|
|
3288
3244
|
* })
|
|
3289
3245
|
*
|
|
3290
|
-
*
|
|
3291
|
-
*
|
|
3292
|
-
*
|
|
3293
|
-
* const empty = Graph.findNodes(graph, (data) => data === "Not Found")
|
|
3294
|
-
* console.log(empty) // []
|
|
3246
|
+
* Graph.findNodes(graph, (data) => data.startsWith("Start")) // => [0, 2]
|
|
3247
|
+
* Graph.findNodes(graph, (data) => data === "Not Found") // => []
|
|
3295
3248
|
* ```
|
|
3296
3249
|
*
|
|
3297
3250
|
* @category getters
|
|
@@ -3320,8 +3273,8 @@ export const findNodes: {
|
|
|
3320
3273
|
*
|
|
3321
3274
|
* **Example** (Finding the first matching edge)
|
|
3322
3275
|
*
|
|
3323
|
-
* ```ts
|
|
3324
|
-
* import { Graph } from "effect"
|
|
3276
|
+
* ```ts import.meta.vitest
|
|
3277
|
+
* import { Graph, Option } from "effect"
|
|
3325
3278
|
*
|
|
3326
3279
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
3327
3280
|
* const nodeA = Graph.addNode(mutable, "Node A")
|
|
@@ -3331,11 +3284,8 @@ export const findNodes: {
|
|
|
3331
3284
|
* Graph.addEdge(mutable, nodeB, nodeC, 20)
|
|
3332
3285
|
* })
|
|
3333
3286
|
*
|
|
3334
|
-
*
|
|
3335
|
-
*
|
|
3336
|
-
*
|
|
3337
|
-
* const notFound = Graph.findEdge(graph, (data) => data > 100)
|
|
3338
|
-
* console.log(notFound) // Option.none()
|
|
3287
|
+
* Graph.findEdge(graph, (data) => data > 15) // => Option.some(1)
|
|
3288
|
+
* Graph.findEdge(graph, (data) => data > 100) // => Option.none()
|
|
3339
3289
|
* ```
|
|
3340
3290
|
*
|
|
3341
3291
|
* @category getters
|
|
@@ -3347,8 +3297,8 @@ export const findEdge: {
|
|
|
3347
3297
|
*
|
|
3348
3298
|
* **Example** (Finding the first matching edge)
|
|
3349
3299
|
*
|
|
3350
|
-
* ```ts
|
|
3351
|
-
* import { Graph } from "effect"
|
|
3300
|
+
* ```ts import.meta.vitest
|
|
3301
|
+
* import { Graph, Option } from "effect"
|
|
3352
3302
|
*
|
|
3353
3303
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
3354
3304
|
* const nodeA = Graph.addNode(mutable, "Node A")
|
|
@@ -3358,11 +3308,8 @@ export const findEdge: {
|
|
|
3358
3308
|
* Graph.addEdge(mutable, nodeB, nodeC, 20)
|
|
3359
3309
|
* })
|
|
3360
3310
|
*
|
|
3361
|
-
*
|
|
3362
|
-
*
|
|
3363
|
-
*
|
|
3364
|
-
* const notFound = Graph.findEdge(graph, (data) => data > 100)
|
|
3365
|
-
* console.log(notFound) // Option.none()
|
|
3311
|
+
* Graph.findEdge(graph, (data) => data > 15) // => Option.some(1)
|
|
3312
|
+
* Graph.findEdge(graph, (data) => data > 100) // => Option.none()
|
|
3366
3313
|
* ```
|
|
3367
3314
|
*
|
|
3368
3315
|
* @category getters
|
|
@@ -3374,8 +3321,8 @@ export const findEdge: {
|
|
|
3374
3321
|
*
|
|
3375
3322
|
* **Example** (Finding the first matching edge)
|
|
3376
3323
|
*
|
|
3377
|
-
* ```ts
|
|
3378
|
-
* import { Graph } from "effect"
|
|
3324
|
+
* ```ts import.meta.vitest
|
|
3325
|
+
* import { Graph, Option } from "effect"
|
|
3379
3326
|
*
|
|
3380
3327
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
3381
3328
|
* const nodeA = Graph.addNode(mutable, "Node A")
|
|
@@ -3385,11 +3332,8 @@ export const findEdge: {
|
|
|
3385
3332
|
* Graph.addEdge(mutable, nodeB, nodeC, 20)
|
|
3386
3333
|
* })
|
|
3387
3334
|
*
|
|
3388
|
-
*
|
|
3389
|
-
*
|
|
3390
|
-
*
|
|
3391
|
-
* const notFound = Graph.findEdge(graph, (data) => data > 100)
|
|
3392
|
-
* console.log(notFound) // Option.none()
|
|
3335
|
+
* Graph.findEdge(graph, (data) => data > 15) // => Option.some(1)
|
|
3336
|
+
* Graph.findEdge(graph, (data) => data > 100) // => Option.none()
|
|
3393
3337
|
* ```
|
|
3394
3338
|
*
|
|
3395
3339
|
* @category getters
|
|
@@ -3417,7 +3361,7 @@ export const findEdge: {
|
|
|
3417
3361
|
*
|
|
3418
3362
|
* **Example** (Finding matching edges)
|
|
3419
3363
|
*
|
|
3420
|
-
* ```ts
|
|
3364
|
+
* ```ts import.meta.vitest
|
|
3421
3365
|
* import { Graph } from "effect"
|
|
3422
3366
|
*
|
|
3423
3367
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
@@ -3429,11 +3373,8 @@ export const findEdge: {
|
|
|
3429
3373
|
* Graph.addEdge(mutable, nodeC, nodeA, 30)
|
|
3430
3374
|
* })
|
|
3431
3375
|
*
|
|
3432
|
-
*
|
|
3433
|
-
*
|
|
3434
|
-
*
|
|
3435
|
-
* const empty = Graph.findEdges(graph, (data) => data > 100)
|
|
3436
|
-
* console.log(empty) // []
|
|
3376
|
+
* Graph.findEdges(graph, (data) => data >= 20) // => [1, 2]
|
|
3377
|
+
* Graph.findEdges(graph, (data) => data > 100) // => []
|
|
3437
3378
|
* ```
|
|
3438
3379
|
*
|
|
3439
3380
|
* @category getters
|
|
@@ -3445,7 +3386,7 @@ export const findEdges: {
|
|
|
3445
3386
|
*
|
|
3446
3387
|
* **Example** (Finding matching edges)
|
|
3447
3388
|
*
|
|
3448
|
-
* ```ts
|
|
3389
|
+
* ```ts import.meta.vitest
|
|
3449
3390
|
* import { Graph } from "effect"
|
|
3450
3391
|
*
|
|
3451
3392
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
@@ -3457,11 +3398,8 @@ export const findEdges: {
|
|
|
3457
3398
|
* Graph.addEdge(mutable, nodeC, nodeA, 30)
|
|
3458
3399
|
* })
|
|
3459
3400
|
*
|
|
3460
|
-
*
|
|
3461
|
-
*
|
|
3462
|
-
*
|
|
3463
|
-
* const empty = Graph.findEdges(graph, (data) => data > 100)
|
|
3464
|
-
* console.log(empty) // []
|
|
3401
|
+
* Graph.findEdges(graph, (data) => data >= 20) // => [1, 2]
|
|
3402
|
+
* Graph.findEdges(graph, (data) => data > 100) // => []
|
|
3465
3403
|
* ```
|
|
3466
3404
|
*
|
|
3467
3405
|
* @category getters
|
|
@@ -3473,7 +3411,7 @@ export const findEdges: {
|
|
|
3473
3411
|
*
|
|
3474
3412
|
* **Example** (Finding matching edges)
|
|
3475
3413
|
*
|
|
3476
|
-
* ```ts
|
|
3414
|
+
* ```ts import.meta.vitest
|
|
3477
3415
|
* import { Graph } from "effect"
|
|
3478
3416
|
*
|
|
3479
3417
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
@@ -3485,11 +3423,8 @@ export const findEdges: {
|
|
|
3485
3423
|
* Graph.addEdge(mutable, nodeC, nodeA, 30)
|
|
3486
3424
|
* })
|
|
3487
3425
|
*
|
|
3488
|
-
*
|
|
3489
|
-
*
|
|
3490
|
-
*
|
|
3491
|
-
* const empty = Graph.findEdges(graph, (data) => data > 100)
|
|
3492
|
-
* console.log(empty) // []
|
|
3426
|
+
* Graph.findEdges(graph, (data) => data >= 20) // => [1, 2]
|
|
3427
|
+
* Graph.findEdges(graph, (data) => data > 100) // => []
|
|
3493
3428
|
* ```
|
|
3494
3429
|
*
|
|
3495
3430
|
* @category getters
|
|
@@ -3518,8 +3453,8 @@ export const findEdges: {
|
|
|
3518
3453
|
*
|
|
3519
3454
|
* **Example** (Updating node data)
|
|
3520
3455
|
*
|
|
3521
|
-
* ```ts
|
|
3522
|
-
* import { Graph } from "effect"
|
|
3456
|
+
* ```ts import.meta.vitest
|
|
3457
|
+
* import { Graph, Option } from "effect"
|
|
3523
3458
|
*
|
|
3524
3459
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
3525
3460
|
* Graph.addNode(mutable, "Node A")
|
|
@@ -3527,8 +3462,7 @@ export const findEdges: {
|
|
|
3527
3462
|
* Graph.updateNode(mutable, 0, (data) => data.toUpperCase())
|
|
3528
3463
|
* })
|
|
3529
3464
|
*
|
|
3530
|
-
*
|
|
3531
|
-
* console.log(nodeData) // Option.some("NODE A")
|
|
3465
|
+
* Graph.getNode(graph, 0) // => Option.some("NODE A")
|
|
3532
3466
|
* ```
|
|
3533
3467
|
*
|
|
3534
3468
|
* @category transforming
|
|
@@ -3556,8 +3490,8 @@ export const updateNode = <N, E, T extends Kind = "directed">(
|
|
|
3556
3490
|
*
|
|
3557
3491
|
* **Example** (Updating edge data)
|
|
3558
3492
|
*
|
|
3559
|
-
* ```ts
|
|
3560
|
-
* import { Graph } from "effect"
|
|
3493
|
+
* ```ts import.meta.vitest
|
|
3494
|
+
* import { Graph, Option } from "effect"
|
|
3561
3495
|
*
|
|
3562
3496
|
* const result = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
3563
3497
|
* const nodeA = Graph.addNode(mutable, "Node A")
|
|
@@ -3566,8 +3500,7 @@ export const updateNode = <N, E, T extends Kind = "directed">(
|
|
|
3566
3500
|
* Graph.updateEdge(mutable, edgeIndex, (data) => data * 2)
|
|
3567
3501
|
* })
|
|
3568
3502
|
*
|
|
3569
|
-
*
|
|
3570
|
-
* console.log(edgeData) // Option.some(new Graph.Edge({ source: 0, target: 1, data: 20 }))
|
|
3503
|
+
* Option.map(Graph.getEdge(result, 0), (edge) => edge.data) // => Option.some(20)
|
|
3571
3504
|
* ```
|
|
3572
3505
|
*
|
|
3573
3506
|
* @category mutations
|
|
@@ -3600,8 +3533,8 @@ export const updateEdge = <N, E, T extends Kind = "directed">(
|
|
|
3600
3533
|
*
|
|
3601
3534
|
* **Example** (Mapping node data)
|
|
3602
3535
|
*
|
|
3603
|
-
* ```ts
|
|
3604
|
-
* import { Graph } from "effect"
|
|
3536
|
+
* ```ts import.meta.vitest
|
|
3537
|
+
* import { Graph, Option } from "effect"
|
|
3605
3538
|
*
|
|
3606
3539
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
3607
3540
|
* Graph.addNode(mutable, "node a")
|
|
@@ -3610,8 +3543,7 @@ export const updateEdge = <N, E, T extends Kind = "directed">(
|
|
|
3610
3543
|
* Graph.mapNodes(mutable, (data) => data.toUpperCase())
|
|
3611
3544
|
* })
|
|
3612
3545
|
*
|
|
3613
|
-
*
|
|
3614
|
-
* console.log(nodeData) // Option.some("NODE A")
|
|
3546
|
+
* Graph.getNode(graph, 0) // => Option.some("NODE A")
|
|
3615
3547
|
* ```
|
|
3616
3548
|
*
|
|
3617
3549
|
* @category transforming
|
|
@@ -3636,8 +3568,8 @@ export const mapNodes = <N, E, T extends Kind = "directed">(
|
|
|
3636
3568
|
*
|
|
3637
3569
|
* **Example** (Mapping edge data)
|
|
3638
3570
|
*
|
|
3639
|
-
* ```ts
|
|
3640
|
-
* import { Graph } from "effect"
|
|
3571
|
+
* ```ts import.meta.vitest
|
|
3572
|
+
* import { Graph, Option } from "effect"
|
|
3641
3573
|
*
|
|
3642
3574
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
3643
3575
|
* const a = Graph.addNode(mutable, "A")
|
|
@@ -3648,8 +3580,7 @@ export const mapNodes = <N, E, T extends Kind = "directed">(
|
|
|
3648
3580
|
* Graph.mapEdges(mutable, (data) => data * 2)
|
|
3649
3581
|
* })
|
|
3650
3582
|
*
|
|
3651
|
-
*
|
|
3652
|
-
* console.log(edgeData) // Option.some(new Graph.Edge({ source: 0, target: 1, data: 20 }))
|
|
3583
|
+
* Option.map(Graph.getEdge(graph, 0), (edge) => edge.data) // => Option.some(20)
|
|
3653
3584
|
* ```
|
|
3654
3585
|
*
|
|
3655
3586
|
* @category transforming
|
|
@@ -3705,8 +3636,8 @@ const rebuildAdjacency = <N, E, T extends Kind = "directed">(
|
|
|
3705
3636
|
*
|
|
3706
3637
|
* **Example** (Reversing edge directions)
|
|
3707
3638
|
*
|
|
3708
|
-
* ```ts
|
|
3709
|
-
* import { Graph } from "effect"
|
|
3639
|
+
* ```ts import.meta.vitest
|
|
3640
|
+
* import { Graph, Option } from "effect"
|
|
3710
3641
|
*
|
|
3711
3642
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
3712
3643
|
* const a = Graph.addNode(mutable, "A")
|
|
@@ -3717,8 +3648,7 @@ const rebuildAdjacency = <N, E, T extends Kind = "directed">(
|
|
|
3717
3648
|
* Graph.reverse(mutable) // Now B -> A, C -> B
|
|
3718
3649
|
* })
|
|
3719
3650
|
*
|
|
3720
|
-
*
|
|
3721
|
-
* console.log(edge0) // Option.some(new Graph.Edge({ source: 1, target: 0, data: 1 }))
|
|
3651
|
+
* Option.map(Graph.getEdge(graph, 0), (edge) => edge.source) // => Option.some(1)
|
|
3722
3652
|
* ```
|
|
3723
3653
|
*
|
|
3724
3654
|
* @category transforming
|
|
@@ -3758,7 +3688,7 @@ export const reverse = <N, E, T extends Kind = "directed">(
|
|
|
3758
3688
|
*
|
|
3759
3689
|
* **Example** (Filtering and mapping nodes)
|
|
3760
3690
|
*
|
|
3761
|
-
* ```ts
|
|
3691
|
+
* ```ts import.meta.vitest
|
|
3762
3692
|
* import { Graph, Option } from "effect"
|
|
3763
3693
|
*
|
|
3764
3694
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -3776,7 +3706,7 @@ export const reverse = <N, E, T extends Kind = "directed">(
|
|
|
3776
3706
|
* )
|
|
3777
3707
|
* })
|
|
3778
3708
|
*
|
|
3779
|
-
*
|
|
3709
|
+
* Graph.nodeCount(graph) // => 2
|
|
3780
3710
|
* ```
|
|
3781
3711
|
*
|
|
3782
3712
|
* @category transforming
|
|
@@ -3815,7 +3745,7 @@ export const filterMapNodes = <N, E, T extends Kind = "directed">(
|
|
|
3815
3745
|
*
|
|
3816
3746
|
* **Example** (Filtering and mapping edges)
|
|
3817
3747
|
*
|
|
3818
|
-
* ```ts
|
|
3748
|
+
* ```ts import.meta.vitest
|
|
3819
3749
|
* import { Graph, Option } from "effect"
|
|
3820
3750
|
*
|
|
3821
3751
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -3833,7 +3763,7 @@ export const filterMapNodes = <N, E, T extends Kind = "directed">(
|
|
|
3833
3763
|
* )
|
|
3834
3764
|
* })
|
|
3835
3765
|
*
|
|
3836
|
-
*
|
|
3766
|
+
* Graph.edgeCount(graph) // => 2
|
|
3837
3767
|
* ```
|
|
3838
3768
|
*
|
|
3839
3769
|
* @category transforming
|
|
@@ -3878,7 +3808,7 @@ export const filterMapEdges = <N, E, T extends Kind = "directed">(
|
|
|
3878
3808
|
*
|
|
3879
3809
|
* **Example** (Filtering nodes)
|
|
3880
3810
|
*
|
|
3881
|
-
* ```ts
|
|
3811
|
+
* ```ts import.meta.vitest
|
|
3882
3812
|
* import { Graph } from "effect"
|
|
3883
3813
|
*
|
|
3884
3814
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -3891,7 +3821,7 @@ export const filterMapEdges = <N, E, T extends Kind = "directed">(
|
|
|
3891
3821
|
* Graph.filterNodes(mutable, (data) => data === "active")
|
|
3892
3822
|
* })
|
|
3893
3823
|
*
|
|
3894
|
-
*
|
|
3824
|
+
* Graph.nodeCount(graph) // => 2
|
|
3895
3825
|
* ```
|
|
3896
3826
|
*
|
|
3897
3827
|
* @category transforming
|
|
@@ -3925,7 +3855,7 @@ export const filterNodes = <N, E, T extends Kind = "directed">(
|
|
|
3925
3855
|
*
|
|
3926
3856
|
* **Example** (Filtering edges)
|
|
3927
3857
|
*
|
|
3928
|
-
* ```ts
|
|
3858
|
+
* ```ts import.meta.vitest
|
|
3929
3859
|
* import { Graph } from "effect"
|
|
3930
3860
|
*
|
|
3931
3861
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -3941,7 +3871,7 @@ export const filterNodes = <N, E, T extends Kind = "directed">(
|
|
|
3941
3871
|
* Graph.filterEdges(mutable, (data) => data >= 10)
|
|
3942
3872
|
* })
|
|
3943
3873
|
*
|
|
3944
|
-
*
|
|
3874
|
+
* Graph.edgeCount(graph) // => 2
|
|
3945
3875
|
* ```
|
|
3946
3876
|
*
|
|
3947
3877
|
* @category transforming
|
|
@@ -4018,14 +3948,13 @@ const invalidateCycleFlagOnAddition = <N, E, T extends Kind = "directed">(
|
|
|
4018
3948
|
*
|
|
4019
3949
|
* **Example** (Adding edges)
|
|
4020
3950
|
*
|
|
4021
|
-
* ```ts
|
|
3951
|
+
* ```ts import.meta.vitest
|
|
4022
3952
|
* import { Graph } from "effect"
|
|
4023
3953
|
*
|
|
4024
|
-
*
|
|
3954
|
+
* Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
4025
3955
|
* const nodeA = Graph.addNode(mutable, "Node A")
|
|
4026
3956
|
* const nodeB = Graph.addNode(mutable, "Node B")
|
|
4027
|
-
*
|
|
4028
|
-
* console.log(edge) // EdgeIndex with value 0
|
|
3957
|
+
* Graph.addEdge(mutable, nodeA, nodeB, 42) // => 0
|
|
4029
3958
|
* })
|
|
4030
3959
|
* ```
|
|
4031
3960
|
*
|
|
@@ -4099,7 +4028,7 @@ export const addEdge = <N, E, T extends Kind = "directed">(
|
|
|
4099
4028
|
*
|
|
4100
4029
|
* **Example** (Removing a node)
|
|
4101
4030
|
*
|
|
4102
|
-
* ```ts
|
|
4031
|
+
* ```ts import.meta.vitest
|
|
4103
4032
|
* import { Graph } from "effect"
|
|
4104
4033
|
*
|
|
4105
4034
|
* const result = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
@@ -4110,6 +4039,7 @@ export const addEdge = <N, E, T extends Kind = "directed">(
|
|
|
4110
4039
|
* // Remove nodeA and all edges connected to it
|
|
4111
4040
|
* Graph.removeNode(mutable, nodeA)
|
|
4112
4041
|
* })
|
|
4042
|
+
* Array.of(Graph.nodeCount(result), Graph.edgeCount(result)) // => [1, 0]
|
|
4113
4043
|
* ```
|
|
4114
4044
|
*
|
|
4115
4045
|
* @category mutations
|
|
@@ -4166,7 +4096,7 @@ export const removeNode = <N, E, T extends Kind = "directed">(
|
|
|
4166
4096
|
*
|
|
4167
4097
|
* **Example** (Removing an edge)
|
|
4168
4098
|
*
|
|
4169
|
-
* ```ts
|
|
4099
|
+
* ```ts import.meta.vitest
|
|
4170
4100
|
* import { Graph } from "effect"
|
|
4171
4101
|
*
|
|
4172
4102
|
* const result = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
@@ -4177,6 +4107,7 @@ export const removeNode = <N, E, T extends Kind = "directed">(
|
|
|
4177
4107
|
* // Remove the edge
|
|
4178
4108
|
* Graph.removeEdge(mutable, edge)
|
|
4179
4109
|
* })
|
|
4110
|
+
* Array.of(Graph.nodeCount(result), Graph.edgeCount(result)) // => [2, 0]
|
|
4180
4111
|
* ```
|
|
4181
4112
|
*
|
|
4182
4113
|
* @category mutations
|
|
@@ -4262,8 +4193,8 @@ const removeEdgeInternal = <N, E, T extends Kind = "directed">(
|
|
|
4262
4193
|
*
|
|
4263
4194
|
* **Example** (Getting edge data)
|
|
4264
4195
|
*
|
|
4265
|
-
* ```ts
|
|
4266
|
-
* import { Graph } from "effect"
|
|
4196
|
+
* ```ts import.meta.vitest
|
|
4197
|
+
* import { Graph, Option } from "effect"
|
|
4267
4198
|
*
|
|
4268
4199
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
4269
4200
|
* const nodeA = Graph.addNode(mutable, "Node A")
|
|
@@ -4271,14 +4202,7 @@ const removeEdgeInternal = <N, E, T extends Kind = "directed">(
|
|
|
4271
4202
|
* Graph.addEdge(mutable, nodeA, nodeB, 42)
|
|
4272
4203
|
* })
|
|
4273
4204
|
*
|
|
4274
|
-
*
|
|
4275
|
-
* const edgeData = Graph.getEdge(graph, edgeIndex)
|
|
4276
|
-
*
|
|
4277
|
-
* if (edgeData._tag === "Some") {
|
|
4278
|
-
* console.log(edgeData.value.data) // 42
|
|
4279
|
-
* console.log(edgeData.value.source) // 0
|
|
4280
|
-
* console.log(edgeData.value.target) // 1
|
|
4281
|
-
* }
|
|
4205
|
+
* Graph.getEdge(graph, 0) // => Option.some(new Graph.Edge({ source: 0, target: 1, data: 42 }))
|
|
4282
4206
|
* ```
|
|
4283
4207
|
*
|
|
4284
4208
|
* @category getters
|
|
@@ -4294,8 +4218,8 @@ export const getEdge: {
|
|
|
4294
4218
|
*
|
|
4295
4219
|
* **Example** (Getting edge data)
|
|
4296
4220
|
*
|
|
4297
|
-
* ```ts
|
|
4298
|
-
* import { Graph } from "effect"
|
|
4221
|
+
* ```ts import.meta.vitest
|
|
4222
|
+
* import { Graph, Option } from "effect"
|
|
4299
4223
|
*
|
|
4300
4224
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
4301
4225
|
* const nodeA = Graph.addNode(mutable, "Node A")
|
|
@@ -4303,14 +4227,7 @@ export const getEdge: {
|
|
|
4303
4227
|
* Graph.addEdge(mutable, nodeA, nodeB, 42)
|
|
4304
4228
|
* })
|
|
4305
4229
|
*
|
|
4306
|
-
*
|
|
4307
|
-
* const edgeData = Graph.getEdge(graph, edgeIndex)
|
|
4308
|
-
*
|
|
4309
|
-
* if (edgeData._tag === "Some") {
|
|
4310
|
-
* console.log(edgeData.value.data) // 42
|
|
4311
|
-
* console.log(edgeData.value.source) // 0
|
|
4312
|
-
* console.log(edgeData.value.target) // 1
|
|
4313
|
-
* }
|
|
4230
|
+
* Graph.getEdge(graph, 0) // => Option.some(new Graph.Edge({ source: 0, target: 1, data: 42 }))
|
|
4314
4231
|
* ```
|
|
4315
4232
|
*
|
|
4316
4233
|
* @category getters
|
|
@@ -4328,8 +4245,8 @@ export const getEdge: {
|
|
|
4328
4245
|
*
|
|
4329
4246
|
* **Example** (Getting edge data)
|
|
4330
4247
|
*
|
|
4331
|
-
* ```ts
|
|
4332
|
-
* import { Graph } from "effect"
|
|
4248
|
+
* ```ts import.meta.vitest
|
|
4249
|
+
* import { Graph, Option } from "effect"
|
|
4333
4250
|
*
|
|
4334
4251
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
4335
4252
|
* const nodeA = Graph.addNode(mutable, "Node A")
|
|
@@ -4337,14 +4254,7 @@ export const getEdge: {
|
|
|
4337
4254
|
* Graph.addEdge(mutable, nodeA, nodeB, 42)
|
|
4338
4255
|
* })
|
|
4339
4256
|
*
|
|
4340
|
-
*
|
|
4341
|
-
* const edgeData = Graph.getEdge(graph, edgeIndex)
|
|
4342
|
-
*
|
|
4343
|
-
* if (edgeData._tag === "Some") {
|
|
4344
|
-
* console.log(edgeData.value.data) // 42
|
|
4345
|
-
* console.log(edgeData.value.source) // 0
|
|
4346
|
-
* console.log(edgeData.value.target) // 1
|
|
4347
|
-
* }
|
|
4257
|
+
* Graph.getEdge(graph, 0) // => Option.some(new Graph.Edge({ source: 0, target: 1, data: 42 }))
|
|
4348
4258
|
* ```
|
|
4349
4259
|
*
|
|
4350
4260
|
* @category getters
|
|
@@ -4361,7 +4271,7 @@ export const getEdge: {
|
|
|
4361
4271
|
*
|
|
4362
4272
|
* **Example** (Checking edge existence)
|
|
4363
4273
|
*
|
|
4364
|
-
* ```ts
|
|
4274
|
+
* ```ts import.meta.vitest
|
|
4365
4275
|
* import { Graph } from "effect"
|
|
4366
4276
|
*
|
|
4367
4277
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
@@ -4371,15 +4281,8 @@ export const getEdge: {
|
|
|
4371
4281
|
* Graph.addEdge(mutable, nodeA, nodeB, 42)
|
|
4372
4282
|
* })
|
|
4373
4283
|
*
|
|
4374
|
-
*
|
|
4375
|
-
*
|
|
4376
|
-
* const nodeC = 2
|
|
4377
|
-
*
|
|
4378
|
-
* const hasAB = Graph.hasEdge(graph, nodeA, nodeB)
|
|
4379
|
-
* console.log(hasAB) // true
|
|
4380
|
-
*
|
|
4381
|
-
* const hasAC = Graph.hasEdge(graph, nodeA, nodeC)
|
|
4382
|
-
* console.log(hasAC) // false
|
|
4284
|
+
* Graph.hasEdge(graph, 0, 1) // => true
|
|
4285
|
+
* Graph.hasEdge(graph, 0, 2) // => false
|
|
4383
4286
|
* ```
|
|
4384
4287
|
*
|
|
4385
4288
|
* @category getters
|
|
@@ -4391,7 +4294,7 @@ export const hasEdge: {
|
|
|
4391
4294
|
*
|
|
4392
4295
|
* **Example** (Checking edge existence)
|
|
4393
4296
|
*
|
|
4394
|
-
* ```ts
|
|
4297
|
+
* ```ts import.meta.vitest
|
|
4395
4298
|
* import { Graph } from "effect"
|
|
4396
4299
|
*
|
|
4397
4300
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
@@ -4401,15 +4304,8 @@ export const hasEdge: {
|
|
|
4401
4304
|
* Graph.addEdge(mutable, nodeA, nodeB, 42)
|
|
4402
4305
|
* })
|
|
4403
4306
|
*
|
|
4404
|
-
*
|
|
4405
|
-
*
|
|
4406
|
-
* const nodeC = 2
|
|
4407
|
-
*
|
|
4408
|
-
* const hasAB = Graph.hasEdge(graph, nodeA, nodeB)
|
|
4409
|
-
* console.log(hasAB) // true
|
|
4410
|
-
*
|
|
4411
|
-
* const hasAC = Graph.hasEdge(graph, nodeA, nodeC)
|
|
4412
|
-
* console.log(hasAC) // false
|
|
4307
|
+
* Graph.hasEdge(graph, 0, 1) // => true
|
|
4308
|
+
* Graph.hasEdge(graph, 0, 2) // => false
|
|
4413
4309
|
* ```
|
|
4414
4310
|
*
|
|
4415
4311
|
* @category getters
|
|
@@ -4421,7 +4317,7 @@ export const hasEdge: {
|
|
|
4421
4317
|
*
|
|
4422
4318
|
* **Example** (Checking edge existence)
|
|
4423
4319
|
*
|
|
4424
|
-
* ```ts
|
|
4320
|
+
* ```ts import.meta.vitest
|
|
4425
4321
|
* import { Graph } from "effect"
|
|
4426
4322
|
*
|
|
4427
4323
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
@@ -4431,15 +4327,8 @@ export const hasEdge: {
|
|
|
4431
4327
|
* Graph.addEdge(mutable, nodeA, nodeB, 42)
|
|
4432
4328
|
* })
|
|
4433
4329
|
*
|
|
4434
|
-
*
|
|
4435
|
-
*
|
|
4436
|
-
* const nodeC = 2
|
|
4437
|
-
*
|
|
4438
|
-
* const hasAB = Graph.hasEdge(graph, nodeA, nodeB)
|
|
4439
|
-
* console.log(hasAB) // true
|
|
4440
|
-
*
|
|
4441
|
-
* const hasAC = Graph.hasEdge(graph, nodeA, nodeC)
|
|
4442
|
-
* console.log(hasAC) // false
|
|
4330
|
+
* Graph.hasEdge(graph, 0, 1) // => true
|
|
4331
|
+
* Graph.hasEdge(graph, 0, 2) // => false
|
|
4443
4332
|
* ```
|
|
4444
4333
|
*
|
|
4445
4334
|
* @category getters
|
|
@@ -4480,11 +4369,11 @@ export const hasEdge: {
|
|
|
4480
4369
|
*
|
|
4481
4370
|
* **Example** (Counting edges)
|
|
4482
4371
|
*
|
|
4483
|
-
* ```ts
|
|
4372
|
+
* ```ts import.meta.vitest
|
|
4484
4373
|
* import { Graph } from "effect"
|
|
4485
4374
|
*
|
|
4486
4375
|
* const emptyGraph = Graph.directed<string, number>()
|
|
4487
|
-
*
|
|
4376
|
+
* Graph.edgeCount(emptyGraph) // => 0
|
|
4488
4377
|
*
|
|
4489
4378
|
* const graphWithEdges = Graph.mutate(emptyGraph, (mutable) => {
|
|
4490
4379
|
* const nodeA = Graph.addNode(mutable, "Node A")
|
|
@@ -4495,7 +4384,7 @@ export const hasEdge: {
|
|
|
4495
4384
|
* Graph.addEdge(mutable, nodeC, nodeA, 3)
|
|
4496
4385
|
* })
|
|
4497
4386
|
*
|
|
4498
|
-
*
|
|
4387
|
+
* Graph.edgeCount(graphWithEdges) // => 3
|
|
4499
4388
|
* ```
|
|
4500
4389
|
*
|
|
4501
4390
|
* @category getters
|
|
@@ -4541,7 +4430,7 @@ const getDirectedNeighbors = <N, E>(
|
|
|
4541
4430
|
*
|
|
4542
4431
|
* **Example** (Getting outgoing neighbors)
|
|
4543
4432
|
*
|
|
4544
|
-
* ```ts
|
|
4433
|
+
* ```ts import.meta.vitest
|
|
4545
4434
|
* import { Graph } from "effect"
|
|
4546
4435
|
*
|
|
4547
4436
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
@@ -4552,15 +4441,8 @@ const getDirectedNeighbors = <N, E>(
|
|
|
4552
4441
|
* Graph.addEdge(mutable, nodeA, nodeC, 2)
|
|
4553
4442
|
* })
|
|
4554
4443
|
*
|
|
4555
|
-
*
|
|
4556
|
-
*
|
|
4557
|
-
* const nodeC = 2
|
|
4558
|
-
*
|
|
4559
|
-
* const neighborsA = Graph.neighbors(graph, nodeA)
|
|
4560
|
-
* console.log(neighborsA) // [1, 2]
|
|
4561
|
-
*
|
|
4562
|
-
* const neighborsB = Graph.neighbors(graph, nodeB)
|
|
4563
|
-
* console.log(neighborsB) // []
|
|
4444
|
+
* Graph.neighbors(graph, 0) // => [1, 2]
|
|
4445
|
+
* Graph.neighbors(graph, 1) // => []
|
|
4564
4446
|
* ```
|
|
4565
4447
|
*
|
|
4566
4448
|
* @category getters
|
|
@@ -4577,7 +4459,7 @@ export const neighbors: {
|
|
|
4577
4459
|
*
|
|
4578
4460
|
* **Example** (Getting outgoing neighbors)
|
|
4579
4461
|
*
|
|
4580
|
-
* ```ts
|
|
4462
|
+
* ```ts import.meta.vitest
|
|
4581
4463
|
* import { Graph } from "effect"
|
|
4582
4464
|
*
|
|
4583
4465
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
@@ -4588,15 +4470,8 @@ export const neighbors: {
|
|
|
4588
4470
|
* Graph.addEdge(mutable, nodeA, nodeC, 2)
|
|
4589
4471
|
* })
|
|
4590
4472
|
*
|
|
4591
|
-
*
|
|
4592
|
-
*
|
|
4593
|
-
* const nodeC = 2
|
|
4594
|
-
*
|
|
4595
|
-
* const neighborsA = Graph.neighbors(graph, nodeA)
|
|
4596
|
-
* console.log(neighborsA) // [1, 2]
|
|
4597
|
-
*
|
|
4598
|
-
* const neighborsB = Graph.neighbors(graph, nodeB)
|
|
4599
|
-
* console.log(neighborsB) // []
|
|
4473
|
+
* Graph.neighbors(graph, 0) // => [1, 2]
|
|
4474
|
+
* Graph.neighbors(graph, 1) // => []
|
|
4600
4475
|
* ```
|
|
4601
4476
|
*
|
|
4602
4477
|
* @category getters
|
|
@@ -4613,7 +4488,7 @@ export const neighbors: {
|
|
|
4613
4488
|
*
|
|
4614
4489
|
* **Example** (Getting outgoing neighbors)
|
|
4615
4490
|
*
|
|
4616
|
-
* ```ts
|
|
4491
|
+
* ```ts import.meta.vitest
|
|
4617
4492
|
* import { Graph } from "effect"
|
|
4618
4493
|
*
|
|
4619
4494
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
@@ -4624,15 +4499,8 @@ export const neighbors: {
|
|
|
4624
4499
|
* Graph.addEdge(mutable, nodeA, nodeC, 2)
|
|
4625
4500
|
* })
|
|
4626
4501
|
*
|
|
4627
|
-
*
|
|
4628
|
-
*
|
|
4629
|
-
* const nodeC = 2
|
|
4630
|
-
*
|
|
4631
|
-
* const neighborsA = Graph.neighbors(graph, nodeA)
|
|
4632
|
-
* console.log(neighborsA) // [1, 2]
|
|
4633
|
-
*
|
|
4634
|
-
* const neighborsB = Graph.neighbors(graph, nodeB)
|
|
4635
|
-
* console.log(neighborsB) // []
|
|
4502
|
+
* Graph.neighbors(graph, 0) // => [1, 2]
|
|
4503
|
+
* Graph.neighbors(graph, 1) // => []
|
|
4636
4504
|
* ```
|
|
4637
4505
|
*
|
|
4638
4506
|
* @category getters
|
|
@@ -4666,7 +4534,7 @@ export const neighbors: {
|
|
|
4666
4534
|
* @see {@link predecessors} for incoming neighbors in a directed graph
|
|
4667
4535
|
* @see {@link neighbors} for generic neighbor lookup across graph kinds
|
|
4668
4536
|
*
|
|
4669
|
-
* @category
|
|
4537
|
+
* @category getters
|
|
4670
4538
|
* @since 4.0.0
|
|
4671
4539
|
*/
|
|
4672
4540
|
export const successors: {
|
|
@@ -4685,7 +4553,7 @@ export const successors: {
|
|
|
4685
4553
|
* @see {@link predecessors} for incoming neighbors in a directed graph
|
|
4686
4554
|
* @see {@link neighbors} for generic neighbor lookup across graph kinds
|
|
4687
4555
|
*
|
|
4688
|
-
* @category
|
|
4556
|
+
* @category getters
|
|
4689
4557
|
* @since 4.0.0
|
|
4690
4558
|
*/
|
|
4691
4559
|
(nodeIndex: NodeIndex): <N, E>(graph: Graph<N, E, "directed"> | MutableGraph<N, E, "directed">) => Array<NodeIndex>
|
|
@@ -4704,7 +4572,7 @@ export const successors: {
|
|
|
4704
4572
|
* @see {@link predecessors} for incoming neighbors in a directed graph
|
|
4705
4573
|
* @see {@link neighbors} for generic neighbor lookup across graph kinds
|
|
4706
4574
|
*
|
|
4707
|
-
* @category
|
|
4575
|
+
* @category getters
|
|
4708
4576
|
* @since 4.0.0
|
|
4709
4577
|
*/
|
|
4710
4578
|
<N, E>(
|
|
@@ -4736,7 +4604,7 @@ export const successors: {
|
|
|
4736
4604
|
* @see {@link successors} for outgoing neighbors in a directed graph
|
|
4737
4605
|
* @see {@link neighbors} for generic neighbor lookup across graph kinds
|
|
4738
4606
|
*
|
|
4739
|
-
* @category
|
|
4607
|
+
* @category getters
|
|
4740
4608
|
* @since 4.0.0
|
|
4741
4609
|
*/
|
|
4742
4610
|
export const predecessors: {
|
|
@@ -4755,7 +4623,7 @@ export const predecessors: {
|
|
|
4755
4623
|
* @see {@link successors} for outgoing neighbors in a directed graph
|
|
4756
4624
|
* @see {@link neighbors} for generic neighbor lookup across graph kinds
|
|
4757
4625
|
*
|
|
4758
|
-
* @category
|
|
4626
|
+
* @category getters
|
|
4759
4627
|
* @since 4.0.0
|
|
4760
4628
|
*/
|
|
4761
4629
|
(nodeIndex: NodeIndex): <N, E>(graph: Graph<N, E, "directed"> | MutableGraph<N, E, "directed">) => Array<NodeIndex>
|
|
@@ -4774,7 +4642,7 @@ export const predecessors: {
|
|
|
4774
4642
|
* @see {@link successors} for outgoing neighbors in a directed graph
|
|
4775
4643
|
* @see {@link neighbors} for generic neighbor lookup across graph kinds
|
|
4776
4644
|
*
|
|
4777
|
-
* @category
|
|
4645
|
+
* @category getters
|
|
4778
4646
|
* @since 4.0.0
|
|
4779
4647
|
*/
|
|
4780
4648
|
<N, E>(
|
|
@@ -4805,7 +4673,7 @@ export const predecessors: {
|
|
|
4805
4673
|
*
|
|
4806
4674
|
* **Example** (Traversing directed neighbors)
|
|
4807
4675
|
*
|
|
4808
|
-
* ```ts
|
|
4676
|
+
* ```ts import.meta.vitest
|
|
4809
4677
|
* import { Graph } from "effect"
|
|
4810
4678
|
*
|
|
4811
4679
|
* const graph = Graph.directed<string, string>((mutable) => {
|
|
@@ -4822,12 +4690,13 @@ export const predecessors: {
|
|
|
4822
4690
|
*
|
|
4823
4691
|
* // Get incoming neighbors (nodes that point to nodeB)
|
|
4824
4692
|
* const incoming = Graph.neighborsDirected(graph, nodeB, "incoming")
|
|
4693
|
+
* Array.of(outgoing, incoming) // => [[1], [0]]
|
|
4825
4694
|
* ```
|
|
4826
4695
|
*
|
|
4827
4696
|
* @deprecated Use {@link successors} for outgoing neighbors or {@link predecessors} for incoming neighbors.
|
|
4828
4697
|
* @see {@link successors} for outgoing neighbors in a directed graph
|
|
4829
4698
|
* @see {@link predecessors} for incoming neighbors in a directed graph
|
|
4830
|
-
* @category
|
|
4699
|
+
* @category getters
|
|
4831
4700
|
* @since 3.18.0
|
|
4832
4701
|
*/
|
|
4833
4702
|
export const neighborsDirected: {
|
|
@@ -4845,7 +4714,7 @@ export const neighborsDirected: {
|
|
|
4845
4714
|
*
|
|
4846
4715
|
* **Example** (Traversing directed neighbors)
|
|
4847
4716
|
*
|
|
4848
|
-
* ```ts
|
|
4717
|
+
* ```ts import.meta.vitest
|
|
4849
4718
|
* import { Graph } from "effect"
|
|
4850
4719
|
*
|
|
4851
4720
|
* const graph = Graph.directed<string, string>((mutable) => {
|
|
@@ -4862,12 +4731,13 @@ export const neighborsDirected: {
|
|
|
4862
4731
|
*
|
|
4863
4732
|
* // Get incoming neighbors (nodes that point to nodeB)
|
|
4864
4733
|
* const incoming = Graph.neighborsDirected(graph, nodeB, "incoming")
|
|
4734
|
+
* Array.of(outgoing, incoming) // => [[1], [0]]
|
|
4865
4735
|
* ```
|
|
4866
4736
|
*
|
|
4867
4737
|
* @deprecated Use {@link successors} for outgoing neighbors or {@link predecessors} for incoming neighbors.
|
|
4868
4738
|
* @see {@link successors} for outgoing neighbors in a directed graph
|
|
4869
4739
|
* @see {@link predecessors} for incoming neighbors in a directed graph
|
|
4870
|
-
* @category
|
|
4740
|
+
* @category getters
|
|
4871
4741
|
* @since 3.18.0
|
|
4872
4742
|
*/
|
|
4873
4743
|
(nodeIndex: NodeIndex, direction: Direction): <N, E>(graph: Graph<N, E, "directed"> | MutableGraph<N, E, "directed">) => Array<NodeIndex>
|
|
@@ -4885,7 +4755,7 @@ export const neighborsDirected: {
|
|
|
4885
4755
|
*
|
|
4886
4756
|
* **Example** (Traversing directed neighbors)
|
|
4887
4757
|
*
|
|
4888
|
-
* ```ts
|
|
4758
|
+
* ```ts import.meta.vitest
|
|
4889
4759
|
* import { Graph } from "effect"
|
|
4890
4760
|
*
|
|
4891
4761
|
* const graph = Graph.directed<string, string>((mutable) => {
|
|
@@ -4902,12 +4772,13 @@ export const neighborsDirected: {
|
|
|
4902
4772
|
*
|
|
4903
4773
|
* // Get incoming neighbors (nodes that point to nodeB)
|
|
4904
4774
|
* const incoming = Graph.neighborsDirected(graph, nodeB, "incoming")
|
|
4775
|
+
* Array.of(outgoing, incoming) // => [[1], [0]]
|
|
4905
4776
|
* ```
|
|
4906
4777
|
*
|
|
4907
4778
|
* @deprecated Use {@link successors} for outgoing neighbors or {@link predecessors} for incoming neighbors.
|
|
4908
4779
|
* @see {@link successors} for outgoing neighbors in a directed graph
|
|
4909
4780
|
* @see {@link predecessors} for incoming neighbors in a directed graph
|
|
4910
|
-
* @category
|
|
4781
|
+
* @category getters
|
|
4911
4782
|
* @since 3.18.0
|
|
4912
4783
|
*/
|
|
4913
4784
|
<N, E>(
|
|
@@ -4940,7 +4811,7 @@ export const neighborsDirected: {
|
|
|
4940
4811
|
*
|
|
4941
4812
|
* **Example** (Configuring GraphViz labels)
|
|
4942
4813
|
*
|
|
4943
|
-
* ```ts
|
|
4814
|
+
* ```ts import.meta.vitest
|
|
4944
4815
|
* import type { Graph } from "effect"
|
|
4945
4816
|
*
|
|
4946
4817
|
* // Basic options with custom labels
|
|
@@ -4955,6 +4826,7 @@ export const neighborsDirected: {
|
|
|
4955
4826
|
* edgeLabel: (data) => data,
|
|
4956
4827
|
* graphName: "MyDependencyGraph"
|
|
4957
4828
|
* }
|
|
4829
|
+
* Array.of(basicOptions.nodeLabel?.("A"), namedOptions.graphName) // => ["Node: A", "MyDependencyGraph"]
|
|
4958
4830
|
* ```
|
|
4959
4831
|
*
|
|
4960
4832
|
* @category options
|
|
@@ -4988,7 +4860,7 @@ const escapeGraphVizString = (value: string): string =>
|
|
|
4988
4860
|
*
|
|
4989
4861
|
* **Example** (Exporting GraphViz DOT)
|
|
4990
4862
|
*
|
|
4991
|
-
* ```ts
|
|
4863
|
+
* ```ts import.meta.vitest
|
|
4992
4864
|
* import { Graph } from "effect"
|
|
4993
4865
|
*
|
|
4994
4866
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
@@ -5000,16 +4872,7 @@ const escapeGraphVizString = (value: string): string =>
|
|
|
5000
4872
|
* Graph.addEdge(mutable, nodeC, nodeA, 3)
|
|
5001
4873
|
* })
|
|
5002
4874
|
*
|
|
5003
|
-
*
|
|
5004
|
-
* console.log(dot)
|
|
5005
|
-
* // digraph "G" {
|
|
5006
|
-
* // "0" [label="Node A"];
|
|
5007
|
-
* // "1" [label="Node B"];
|
|
5008
|
-
* // "2" [label="Node C"];
|
|
5009
|
-
* // "0" -> "1" [label="1"];
|
|
5010
|
-
* // "1" -> "2" [label="2"];
|
|
5011
|
-
* // "2" -> "0" [label="3"];
|
|
5012
|
-
* // }
|
|
4875
|
+
* Graph.toGraphViz(graph).split("\n") // => ['digraph "G" {', ' "0" [label="Node A"];', ' "1" [label="Node B"];', ' "2" [label="Node C"];', ' "0" -> "1" [label="1"];', ' "1" -> "2" [label="2"];', ' "2" -> "0" [label="3"];', "}"]
|
|
5013
4876
|
* ```
|
|
5014
4877
|
*
|
|
5015
4878
|
* @category converting
|
|
@@ -5021,7 +4884,7 @@ export const toGraphViz: {
|
|
|
5021
4884
|
*
|
|
5022
4885
|
* **Example** (Exporting GraphViz DOT)
|
|
5023
4886
|
*
|
|
5024
|
-
* ```ts
|
|
4887
|
+
* ```ts import.meta.vitest
|
|
5025
4888
|
* import { Graph } from "effect"
|
|
5026
4889
|
*
|
|
5027
4890
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
@@ -5033,16 +4896,7 @@ export const toGraphViz: {
|
|
|
5033
4896
|
* Graph.addEdge(mutable, nodeC, nodeA, 3)
|
|
5034
4897
|
* })
|
|
5035
4898
|
*
|
|
5036
|
-
*
|
|
5037
|
-
* console.log(dot)
|
|
5038
|
-
* // digraph "G" {
|
|
5039
|
-
* // "0" [label="Node A"];
|
|
5040
|
-
* // "1" [label="Node B"];
|
|
5041
|
-
* // "2" [label="Node C"];
|
|
5042
|
-
* // "0" -> "1" [label="1"];
|
|
5043
|
-
* // "1" -> "2" [label="2"];
|
|
5044
|
-
* // "2" -> "0" [label="3"];
|
|
5045
|
-
* // }
|
|
4899
|
+
* Graph.toGraphViz(graph).split("\n") // => ['digraph "G" {', ' "0" [label="Node A"];', ' "1" [label="Node B"];', ' "2" [label="Node C"];', ' "0" -> "1" [label="1"];', ' "1" -> "2" [label="2"];', ' "2" -> "0" [label="3"];', "}"]
|
|
5046
4900
|
* ```
|
|
5047
4901
|
*
|
|
5048
4902
|
* @category converting
|
|
@@ -5054,7 +4908,7 @@ export const toGraphViz: {
|
|
|
5054
4908
|
*
|
|
5055
4909
|
* **Example** (Exporting GraphViz DOT)
|
|
5056
4910
|
*
|
|
5057
|
-
* ```ts
|
|
4911
|
+
* ```ts import.meta.vitest
|
|
5058
4912
|
* import { Graph } from "effect"
|
|
5059
4913
|
*
|
|
5060
4914
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
@@ -5066,16 +4920,7 @@ export const toGraphViz: {
|
|
|
5066
4920
|
* Graph.addEdge(mutable, nodeC, nodeA, 3)
|
|
5067
4921
|
* })
|
|
5068
4922
|
*
|
|
5069
|
-
*
|
|
5070
|
-
* console.log(dot)
|
|
5071
|
-
* // digraph "G" {
|
|
5072
|
-
* // "0" [label="Node A"];
|
|
5073
|
-
* // "1" [label="Node B"];
|
|
5074
|
-
* // "2" [label="Node C"];
|
|
5075
|
-
* // "0" -> "1" [label="1"];
|
|
5076
|
-
* // "1" -> "2" [label="2"];
|
|
5077
|
-
* // "2" -> "0" [label="3"];
|
|
5078
|
-
* // }
|
|
4923
|
+
* Graph.toGraphViz(graph).split("\n") // => ['digraph "G" {', ' "0" [label="Node A"];', ' "1" [label="Node B"];', ' "2" [label="Node C"];', ' "0" -> "1" [label="1"];', ' "1" -> "2" [label="2"];', ' "2" -> "0" [label="3"];', "}"]
|
|
5079
4924
|
* ```
|
|
5080
4925
|
*
|
|
5081
4926
|
* @category converting
|
|
@@ -5141,7 +4986,7 @@ export const toGraphViz: {
|
|
|
5141
4986
|
*
|
|
5142
4987
|
* **Example** (Selecting Mermaid node shapes)
|
|
5143
4988
|
*
|
|
5144
|
-
* ```ts
|
|
4989
|
+
* ```ts import.meta.vitest
|
|
5145
4990
|
* import type { Graph } from "effect"
|
|
5146
4991
|
*
|
|
5147
4992
|
* // Shape selector function for different node types
|
|
@@ -5156,6 +5001,7 @@ export const toGraphViz: {
|
|
|
5156
5001
|
* const options: Graph.MermaidOptions<string, string> = {
|
|
5157
5002
|
* nodeShape: shapeSelector
|
|
5158
5003
|
* }
|
|
5004
|
+
* options.nodeShape?.("decision") // => "diamond"
|
|
5159
5005
|
* ```
|
|
5160
5006
|
*
|
|
5161
5007
|
* @category models
|
|
@@ -5184,7 +5030,7 @@ export type MermaidNodeShape =
|
|
|
5184
5030
|
*
|
|
5185
5031
|
* **Example** (Configuring Mermaid directions)
|
|
5186
5032
|
*
|
|
5187
|
-
* ```ts
|
|
5033
|
+
* ```ts import.meta.vitest
|
|
5188
5034
|
* import type { Graph } from "effect"
|
|
5189
5035
|
*
|
|
5190
5036
|
* // Horizontal workflow diagram
|
|
@@ -5201,6 +5047,7 @@ export type MermaidNodeShape =
|
|
|
5201
5047
|
* const bottomUpOptions: Graph.MermaidOptions<string, string> = {
|
|
5202
5048
|
* direction: "BT"
|
|
5203
5049
|
* }
|
|
5050
|
+
* Array.of(horizontalOptions.direction, verticalOptions.direction, bottomUpOptions.direction) // => ["LR", "TB", "BT"]
|
|
5204
5051
|
* ```
|
|
5205
5052
|
*
|
|
5206
5053
|
* @category models
|
|
@@ -5227,7 +5074,7 @@ export type MermaidDirection =
|
|
|
5227
5074
|
*
|
|
5228
5075
|
* **Example** (Selecting Mermaid diagram types)
|
|
5229
5076
|
*
|
|
5230
|
-
* ```ts
|
|
5077
|
+
* ```ts import.meta.vitest
|
|
5231
5078
|
* import type { Graph } from "effect"
|
|
5232
5079
|
*
|
|
5233
5080
|
* // Force flowchart format (even for undirected graphs)
|
|
@@ -5242,6 +5089,7 @@ export type MermaidDirection =
|
|
|
5242
5089
|
*
|
|
5243
5090
|
* // Auto-detection (recommended, default behavior)
|
|
5244
5091
|
* const autoOptions: Graph.MermaidOptions<string, string> = {}
|
|
5092
|
+
* Array.of(flowchartOptions.diagramType, graphOptions.diagramType, autoOptions.diagramType) // => ["flowchart", "graph", undefined]
|
|
5245
5093
|
* ```
|
|
5246
5094
|
*
|
|
5247
5095
|
* @category models
|
|
@@ -5267,7 +5115,7 @@ export type MermaidDiagramType =
|
|
|
5267
5115
|
*
|
|
5268
5116
|
* **Example** (Configuring Mermaid output)
|
|
5269
5117
|
*
|
|
5270
|
-
* ```ts
|
|
5118
|
+
* ```ts import.meta.vitest
|
|
5271
5119
|
* import type { Graph } from "effect"
|
|
5272
5120
|
*
|
|
5273
5121
|
* // Basic options with custom labels
|
|
@@ -5284,6 +5132,7 @@ export type MermaidDiagramType =
|
|
|
5284
5132
|
* direction: "LR",
|
|
5285
5133
|
* nodeShape: (data) => data.includes("start") ? "circle" : "rectangle"
|
|
5286
5134
|
* }
|
|
5135
|
+
* Array.of(basicOptions.nodeLabel?.("A"), advancedOptions.nodeShape?.("start")) // => ["Node: A", "circle"]
|
|
5287
5136
|
* ```
|
|
5288
5137
|
*
|
|
5289
5138
|
* @category options
|
|
@@ -5387,7 +5236,7 @@ const formatMermaidNode = (
|
|
|
5387
5236
|
*
|
|
5388
5237
|
* **Example** (Exporting a directed Mermaid diagram)
|
|
5389
5238
|
*
|
|
5390
|
-
* ```ts
|
|
5239
|
+
* ```ts import.meta.vitest
|
|
5391
5240
|
* import { Graph } from "effect"
|
|
5392
5241
|
*
|
|
5393
5242
|
* // Basic directed graph export
|
|
@@ -5399,19 +5248,12 @@ const formatMermaidNode = (
|
|
|
5399
5248
|
* Graph.addEdge(mutable, app, cache, 2)
|
|
5400
5249
|
* })
|
|
5401
5250
|
*
|
|
5402
|
-
*
|
|
5403
|
-
* console.log(mermaid)
|
|
5404
|
-
* // flowchart TD
|
|
5405
|
-
* // 0["App"]
|
|
5406
|
-
* // 1["Database"]
|
|
5407
|
-
* // 2["Cache"]
|
|
5408
|
-
* // 0 -->|"1"| 1
|
|
5409
|
-
* // 0 -->|"2"| 2
|
|
5251
|
+
* Graph.toMermaid(graph).split("\n") // => ["flowchart TD", ' 0["App"]', ' 1["Database"]', ' 2["Cache"]', ' 0 -->|"1"| 1', ' 0 -->|"2"| 2']
|
|
5410
5252
|
* ```
|
|
5411
5253
|
*
|
|
5412
5254
|
* **Example** (Exporting an undirected Mermaid diagram)
|
|
5413
5255
|
*
|
|
5414
|
-
* ```ts
|
|
5256
|
+
* ```ts import.meta.vitest
|
|
5415
5257
|
* import { Graph } from "effect"
|
|
5416
5258
|
*
|
|
5417
5259
|
* // Undirected graph with custom labels and direction
|
|
@@ -5428,18 +5270,12 @@ const formatMermaidNode = (
|
|
|
5428
5270
|
* edgeLabel: (relationship) => relationship,
|
|
5429
5271
|
* direction: "LR"
|
|
5430
5272
|
* })
|
|
5431
|
-
*
|
|
5432
|
-
* // graph LR
|
|
5433
|
-
* // 0["Alice"]
|
|
5434
|
-
* // 1["Bob"]
|
|
5435
|
-
* // 2["Charlie"]
|
|
5436
|
-
* // 0 ---|"friends"| 1
|
|
5437
|
-
* // 1 ---|"colleagues"| 2
|
|
5273
|
+
* mermaid.split("\n") // => ["graph LR", ' 0["Alice"]', ' 1["Bob"]', ' 2["Charlie"]', ' 0 ---|"friends"| 1', ' 1 ---|"colleagues"| 2']
|
|
5438
5274
|
* ```
|
|
5439
5275
|
*
|
|
5440
5276
|
* **Example** (Customizing Mermaid node shapes)
|
|
5441
5277
|
*
|
|
5442
|
-
* ```ts
|
|
5278
|
+
* ```ts import.meta.vitest
|
|
5443
5279
|
* import { Graph } from "effect"
|
|
5444
5280
|
*
|
|
5445
5281
|
* // Advanced styling with node shapes for flowchart
|
|
@@ -5478,20 +5314,12 @@ const formatMermaidNode = (
|
|
|
5478
5314
|
* }
|
|
5479
5315
|
* }
|
|
5480
5316
|
* })
|
|
5481
|
-
*
|
|
5482
|
-
* // flowchart TD
|
|
5483
|
-
* // 0(["Begin"])
|
|
5484
|
-
* // 1["Process Data"]
|
|
5485
|
-
* // 2{"Valid?"}
|
|
5486
|
-
* // 3(["Complete"])
|
|
5487
|
-
* // 0 --> 1
|
|
5488
|
-
* // 1 --> 2
|
|
5489
|
-
* // 2 --> 3
|
|
5317
|
+
* mermaid.split("\n") // => ["flowchart TD", ' 0(["Begin"])', ' 1["Process Data"]', ' 2{"Valid?"}', ' 3(["Complete"])', " 0 --> 1", " 1 --> 2", ' 2 -->|"yes"| 3']
|
|
5490
5318
|
* ```
|
|
5491
5319
|
*
|
|
5492
5320
|
* **Example** (Visualizing dependency graphs)
|
|
5493
5321
|
*
|
|
5494
|
-
* ```ts
|
|
5322
|
+
* ```ts import.meta.vitest
|
|
5495
5323
|
* import { Graph } from "effect"
|
|
5496
5324
|
*
|
|
5497
5325
|
* // Real-world example: Software dependency graph
|
|
@@ -5540,15 +5368,7 @@ const formatMermaidNode = (
|
|
|
5540
5368
|
* direction: "TB"
|
|
5541
5369
|
* })
|
|
5542
5370
|
*
|
|
5543
|
-
*
|
|
5544
|
-
* // flowchart TB
|
|
5545
|
-
* // 0["MyApp\nv1.0.0"]
|
|
5546
|
-
* // 1{{"React\nv18.0.0"}}
|
|
5547
|
-
* // 2["Lodash\nv4.17.0"]
|
|
5548
|
-
* // 3{"Webpack\nv5.0.0"}
|
|
5549
|
-
* // 0 -->|"depends on"| 1
|
|
5550
|
-
* // 0 -->|"depends on"| 2
|
|
5551
|
-
* // 0 -->|"builds with"| 3
|
|
5371
|
+
* dependencyDiagram.split("\n") // => ["flowchart TB", ' 0["MyApp#92;nv1.0.0"]', ' 1{{"React#92;nv18.0.0"}}', ' 2["Lodash#92;nv4.17.0"]', ' 3{"Webpack#92;nv5.0.0"}', ' 0 -->|"depends on"| 1', ' 0 -->|"depends on"| 2', ' 0 -->|"builds with"| 3']
|
|
5552
5372
|
* ```
|
|
5553
5373
|
*
|
|
5554
5374
|
* @category converting
|
|
@@ -5567,7 +5387,7 @@ export const toMermaid: {
|
|
|
5567
5387
|
*
|
|
5568
5388
|
* **Example** (Exporting a directed Mermaid diagram)
|
|
5569
5389
|
*
|
|
5570
|
-
* ```ts
|
|
5390
|
+
* ```ts import.meta.vitest
|
|
5571
5391
|
* import { Graph } from "effect"
|
|
5572
5392
|
*
|
|
5573
5393
|
* // Basic directed graph export
|
|
@@ -5579,19 +5399,12 @@ export const toMermaid: {
|
|
|
5579
5399
|
* Graph.addEdge(mutable, app, cache, 2)
|
|
5580
5400
|
* })
|
|
5581
5401
|
*
|
|
5582
|
-
*
|
|
5583
|
-
* console.log(mermaid)
|
|
5584
|
-
* // flowchart TD
|
|
5585
|
-
* // 0["App"]
|
|
5586
|
-
* // 1["Database"]
|
|
5587
|
-
* // 2["Cache"]
|
|
5588
|
-
* // 0 -->|"1"| 1
|
|
5589
|
-
* // 0 -->|"2"| 2
|
|
5402
|
+
* Graph.toMermaid(graph).split("\n") // => ["flowchart TD", ' 0["App"]', ' 1["Database"]', ' 2["Cache"]', ' 0 -->|"1"| 1', ' 0 -->|"2"| 2']
|
|
5590
5403
|
* ```
|
|
5591
5404
|
*
|
|
5592
5405
|
* **Example** (Exporting an undirected Mermaid diagram)
|
|
5593
5406
|
*
|
|
5594
|
-
* ```ts
|
|
5407
|
+
* ```ts import.meta.vitest
|
|
5595
5408
|
* import { Graph } from "effect"
|
|
5596
5409
|
*
|
|
5597
5410
|
* // Undirected graph with custom labels and direction
|
|
@@ -5608,18 +5421,12 @@ export const toMermaid: {
|
|
|
5608
5421
|
* edgeLabel: (relationship) => relationship,
|
|
5609
5422
|
* direction: "LR"
|
|
5610
5423
|
* })
|
|
5611
|
-
*
|
|
5612
|
-
* // graph LR
|
|
5613
|
-
* // 0["Alice"]
|
|
5614
|
-
* // 1["Bob"]
|
|
5615
|
-
* // 2["Charlie"]
|
|
5616
|
-
* // 0 ---|"friends"| 1
|
|
5617
|
-
* // 1 ---|"colleagues"| 2
|
|
5424
|
+
* mermaid.split("\n") // => ["graph LR", ' 0["Alice"]', ' 1["Bob"]', ' 2["Charlie"]', ' 0 ---|"friends"| 1', ' 1 ---|"colleagues"| 2']
|
|
5618
5425
|
* ```
|
|
5619
5426
|
*
|
|
5620
5427
|
* **Example** (Customizing Mermaid node shapes)
|
|
5621
5428
|
*
|
|
5622
|
-
* ```ts
|
|
5429
|
+
* ```ts import.meta.vitest
|
|
5623
5430
|
* import { Graph } from "effect"
|
|
5624
5431
|
*
|
|
5625
5432
|
* // Advanced styling with node shapes for flowchart
|
|
@@ -5658,20 +5465,12 @@ export const toMermaid: {
|
|
|
5658
5465
|
* }
|
|
5659
5466
|
* }
|
|
5660
5467
|
* })
|
|
5661
|
-
*
|
|
5662
|
-
* // flowchart TD
|
|
5663
|
-
* // 0(["Begin"])
|
|
5664
|
-
* // 1["Process Data"]
|
|
5665
|
-
* // 2{"Valid?"}
|
|
5666
|
-
* // 3(["Complete"])
|
|
5667
|
-
* // 0 --> 1
|
|
5668
|
-
* // 1 --> 2
|
|
5669
|
-
* // 2 --> 3
|
|
5468
|
+
* mermaid.split("\n") // => ["flowchart TD", ' 0(["Begin"])', ' 1["Process Data"]', ' 2{"Valid?"}', ' 3(["Complete"])', " 0 --> 1", " 1 --> 2", ' 2 -->|"yes"| 3']
|
|
5670
5469
|
* ```
|
|
5671
5470
|
*
|
|
5672
5471
|
* **Example** (Visualizing dependency graphs)
|
|
5673
5472
|
*
|
|
5674
|
-
* ```ts
|
|
5473
|
+
* ```ts import.meta.vitest
|
|
5675
5474
|
* import { Graph } from "effect"
|
|
5676
5475
|
*
|
|
5677
5476
|
* // Real-world example: Software dependency graph
|
|
@@ -5720,15 +5519,7 @@ export const toMermaid: {
|
|
|
5720
5519
|
* direction: "TB"
|
|
5721
5520
|
* })
|
|
5722
5521
|
*
|
|
5723
|
-
*
|
|
5724
|
-
* // flowchart TB
|
|
5725
|
-
* // 0["MyApp\nv1.0.0"]
|
|
5726
|
-
* // 1{{"React\nv18.0.0"}}
|
|
5727
|
-
* // 2["Lodash\nv4.17.0"]
|
|
5728
|
-
* // 3{"Webpack\nv5.0.0"}
|
|
5729
|
-
* // 0 -->|"depends on"| 1
|
|
5730
|
-
* // 0 -->|"depends on"| 2
|
|
5731
|
-
* // 0 -->|"builds with"| 3
|
|
5522
|
+
* dependencyDiagram.split("\n") // => ["flowchart TB", ' 0["MyApp#92;nv1.0.0"]', ' 1{{"React#92;nv18.0.0"}}', ' 2["Lodash#92;nv4.17.0"]', ' 3{"Webpack#92;nv5.0.0"}', ' 0 -->|"depends on"| 1', ' 0 -->|"depends on"| 2', ' 0 -->|"builds with"| 3']
|
|
5732
5523
|
* ```
|
|
5733
5524
|
*
|
|
5734
5525
|
* @category converting
|
|
@@ -5747,7 +5538,7 @@ export const toMermaid: {
|
|
|
5747
5538
|
*
|
|
5748
5539
|
* **Example** (Exporting a directed Mermaid diagram)
|
|
5749
5540
|
*
|
|
5750
|
-
* ```ts
|
|
5541
|
+
* ```ts import.meta.vitest
|
|
5751
5542
|
* import { Graph } from "effect"
|
|
5752
5543
|
*
|
|
5753
5544
|
* // Basic directed graph export
|
|
@@ -5759,19 +5550,12 @@ export const toMermaid: {
|
|
|
5759
5550
|
* Graph.addEdge(mutable, app, cache, 2)
|
|
5760
5551
|
* })
|
|
5761
5552
|
*
|
|
5762
|
-
*
|
|
5763
|
-
* console.log(mermaid)
|
|
5764
|
-
* // flowchart TD
|
|
5765
|
-
* // 0["App"]
|
|
5766
|
-
* // 1["Database"]
|
|
5767
|
-
* // 2["Cache"]
|
|
5768
|
-
* // 0 -->|"1"| 1
|
|
5769
|
-
* // 0 -->|"2"| 2
|
|
5553
|
+
* Graph.toMermaid(graph).split("\n") // => ["flowchart TD", ' 0["App"]', ' 1["Database"]', ' 2["Cache"]', ' 0 -->|"1"| 1', ' 0 -->|"2"| 2']
|
|
5770
5554
|
* ```
|
|
5771
5555
|
*
|
|
5772
5556
|
* **Example** (Exporting an undirected Mermaid diagram)
|
|
5773
5557
|
*
|
|
5774
|
-
* ```ts
|
|
5558
|
+
* ```ts import.meta.vitest
|
|
5775
5559
|
* import { Graph } from "effect"
|
|
5776
5560
|
*
|
|
5777
5561
|
* // Undirected graph with custom labels and direction
|
|
@@ -5788,18 +5572,12 @@ export const toMermaid: {
|
|
|
5788
5572
|
* edgeLabel: (relationship) => relationship,
|
|
5789
5573
|
* direction: "LR"
|
|
5790
5574
|
* })
|
|
5791
|
-
*
|
|
5792
|
-
* // graph LR
|
|
5793
|
-
* // 0["Alice"]
|
|
5794
|
-
* // 1["Bob"]
|
|
5795
|
-
* // 2["Charlie"]
|
|
5796
|
-
* // 0 ---|"friends"| 1
|
|
5797
|
-
* // 1 ---|"colleagues"| 2
|
|
5575
|
+
* mermaid.split("\n") // => ["graph LR", ' 0["Alice"]', ' 1["Bob"]', ' 2["Charlie"]', ' 0 ---|"friends"| 1', ' 1 ---|"colleagues"| 2']
|
|
5798
5576
|
* ```
|
|
5799
5577
|
*
|
|
5800
5578
|
* **Example** (Customizing Mermaid node shapes)
|
|
5801
5579
|
*
|
|
5802
|
-
* ```ts
|
|
5580
|
+
* ```ts import.meta.vitest
|
|
5803
5581
|
* import { Graph } from "effect"
|
|
5804
5582
|
*
|
|
5805
5583
|
* // Advanced styling with node shapes for flowchart
|
|
@@ -5838,20 +5616,12 @@ export const toMermaid: {
|
|
|
5838
5616
|
* }
|
|
5839
5617
|
* }
|
|
5840
5618
|
* })
|
|
5841
|
-
*
|
|
5842
|
-
* // flowchart TD
|
|
5843
|
-
* // 0(["Begin"])
|
|
5844
|
-
* // 1["Process Data"]
|
|
5845
|
-
* // 2{"Valid?"}
|
|
5846
|
-
* // 3(["Complete"])
|
|
5847
|
-
* // 0 --> 1
|
|
5848
|
-
* // 1 --> 2
|
|
5849
|
-
* // 2 --> 3
|
|
5619
|
+
* mermaid.split("\n") // => ["flowchart TD", ' 0(["Begin"])', ' 1["Process Data"]', ' 2{"Valid?"}', ' 3(["Complete"])', " 0 --> 1", " 1 --> 2", ' 2 -->|"yes"| 3']
|
|
5850
5620
|
* ```
|
|
5851
5621
|
*
|
|
5852
5622
|
* **Example** (Visualizing dependency graphs)
|
|
5853
5623
|
*
|
|
5854
|
-
* ```ts
|
|
5624
|
+
* ```ts import.meta.vitest
|
|
5855
5625
|
* import { Graph } from "effect"
|
|
5856
5626
|
*
|
|
5857
5627
|
* // Real-world example: Software dependency graph
|
|
@@ -5900,15 +5670,7 @@ export const toMermaid: {
|
|
|
5900
5670
|
* direction: "TB"
|
|
5901
5671
|
* })
|
|
5902
5672
|
*
|
|
5903
|
-
*
|
|
5904
|
-
* // flowchart TB
|
|
5905
|
-
* // 0["MyApp\nv1.0.0"]
|
|
5906
|
-
* // 1{{"React\nv18.0.0"}}
|
|
5907
|
-
* // 2["Lodash\nv4.17.0"]
|
|
5908
|
-
* // 3{"Webpack\nv5.0.0"}
|
|
5909
|
-
* // 0 -->|"depends on"| 1
|
|
5910
|
-
* // 0 -->|"depends on"| 2
|
|
5911
|
-
* // 0 -->|"builds with"| 3
|
|
5673
|
+
* dependencyDiagram.split("\n") // => ["flowchart TB", ' 0["MyApp#92;nv1.0.0"]', ' 1{{"React#92;nv18.0.0"}}', ' 2["Lodash#92;nv4.17.0"]', ' 3{"Webpack#92;nv5.0.0"}', ' 0 -->|"depends on"| 1', ' 0 -->|"depends on"| 2', ' 0 -->|"builds with"| 3']
|
|
5912
5674
|
* ```
|
|
5913
5675
|
*
|
|
5914
5676
|
* @category converting
|
|
@@ -5994,7 +5756,7 @@ export type Direction = "outgoing" | "incoming"
|
|
|
5994
5756
|
*
|
|
5995
5757
|
* **Example** (Traversing by direction)
|
|
5996
5758
|
*
|
|
5997
|
-
* ```ts
|
|
5759
|
+
* ```ts import.meta.vitest
|
|
5998
5760
|
* import { Graph } from "effect"
|
|
5999
5761
|
*
|
|
6000
5762
|
* const graph = Graph.directed<string, string>((mutable) => {
|
|
@@ -6005,17 +5767,9 @@ export type Direction = "outgoing" | "incoming"
|
|
|
6005
5767
|
* Graph.addEdge(mutable, a, c, "A-C")
|
|
6006
5768
|
* })
|
|
6007
5769
|
*
|
|
6008
|
-
*
|
|
6009
|
-
*
|
|
6010
|
-
* ) // [
|
|
6011
|
-
*
|
|
6012
|
-
* const incoming = Array.from(
|
|
6013
|
-
* Graph.indices(Graph.bfs(graph, { start: [1], direction: "incoming" }))
|
|
6014
|
-
* ) // [1, 0]
|
|
6015
|
-
*
|
|
6016
|
-
* const undirected = Array.from(
|
|
6017
|
-
* Graph.indices(Graph.bfs(graph, { start: [1], direction: "undirected" }))
|
|
6018
|
-
* ) // [1, 0, 2]
|
|
5770
|
+
* Array.from(Graph.indices(Graph.bfs(graph, { start: [0], direction: "outgoing" }))) // => [0, 1, 2]
|
|
5771
|
+
* Array.from(Graph.indices(Graph.bfs(graph, { start: [1], direction: "incoming" }))) // => [1, 0]
|
|
5772
|
+
* Array.from(Graph.indices(Graph.bfs(graph, { start: [1], direction: "undirected" }))) // => [1, 0, 2]
|
|
6019
5773
|
* ```
|
|
6020
5774
|
*
|
|
6021
5775
|
* @category models
|
|
@@ -6039,7 +5793,7 @@ export type TraversalDirection = Direction | "undirected"
|
|
|
6039
5793
|
*
|
|
6040
5794
|
* **Example** (Checking cycles)
|
|
6041
5795
|
*
|
|
6042
|
-
* ```ts
|
|
5796
|
+
* ```ts import.meta.vitest
|
|
6043
5797
|
* import { Graph } from "effect"
|
|
6044
5798
|
*
|
|
6045
5799
|
* // Acyclic directed graph (DAG)
|
|
@@ -6050,7 +5804,7 @@ export type TraversalDirection = Direction | "undirected"
|
|
|
6050
5804
|
* Graph.addEdge(mutable, a, b, "A->B")
|
|
6051
5805
|
* Graph.addEdge(mutable, b, c, "B->C")
|
|
6052
5806
|
* })
|
|
6053
|
-
*
|
|
5807
|
+
* Graph.isAcyclic(dag) // => true
|
|
6054
5808
|
*
|
|
6055
5809
|
* // Cyclic directed graph
|
|
6056
5810
|
* const cyclic = Graph.directed<string, string>((mutable) => {
|
|
@@ -6059,7 +5813,7 @@ export type TraversalDirection = Direction | "undirected"
|
|
|
6059
5813
|
* Graph.addEdge(mutable, a, b, "A->B")
|
|
6060
5814
|
* Graph.addEdge(mutable, b, a, "B->A") // Creates cycle
|
|
6061
5815
|
* })
|
|
6062
|
-
*
|
|
5816
|
+
* Graph.isAcyclic(cyclic) // => false
|
|
6063
5817
|
* ```
|
|
6064
5818
|
*
|
|
6065
5819
|
* @category algorithms
|
|
@@ -6199,7 +5953,7 @@ export const isAcyclic = <N, E, T extends Kind = "directed">(
|
|
|
6199
5953
|
*
|
|
6200
5954
|
* **Example** (Checking bipartite graphs)
|
|
6201
5955
|
*
|
|
6202
|
-
* ```ts
|
|
5956
|
+
* ```ts import.meta.vitest
|
|
6203
5957
|
* import { Graph } from "effect"
|
|
6204
5958
|
*
|
|
6205
5959
|
* // Bipartite graph (alternating coloring possible)
|
|
@@ -6212,7 +5966,7 @@ export const isAcyclic = <N, E, T extends Kind = "directed">(
|
|
|
6212
5966
|
* Graph.addEdge(mutable, b, c, "edge")
|
|
6213
5967
|
* Graph.addEdge(mutable, c, d, "edge")
|
|
6214
5968
|
* })
|
|
6215
|
-
*
|
|
5969
|
+
* Graph.isBipartite(bipartite) // => true
|
|
6216
5970
|
*
|
|
6217
5971
|
* // Non-bipartite graph (odd cycle)
|
|
6218
5972
|
* const triangle = Graph.undirected<string, string>((mutable) => {
|
|
@@ -6223,7 +5977,7 @@ export const isAcyclic = <N, E, T extends Kind = "directed">(
|
|
|
6223
5977
|
* Graph.addEdge(mutable, b, c, "edge")
|
|
6224
5978
|
* Graph.addEdge(mutable, c, a, "edge") // Triangle (3-cycle)
|
|
6225
5979
|
* })
|
|
6226
|
-
*
|
|
5980
|
+
* Graph.isBipartite(triangle) // => false
|
|
6227
5981
|
* ```
|
|
6228
5982
|
*
|
|
6229
5983
|
* @category algorithms
|
|
@@ -6336,7 +6090,7 @@ const getTraversableNeighbor = <N, E, T extends Kind>(
|
|
|
6336
6090
|
*
|
|
6337
6091
|
* **Example** (Finding connected components)
|
|
6338
6092
|
*
|
|
6339
|
-
* ```ts
|
|
6093
|
+
* ```ts import.meta.vitest
|
|
6340
6094
|
* import { Graph } from "effect"
|
|
6341
6095
|
*
|
|
6342
6096
|
* const graph = Graph.undirected<string, string>((mutable) => {
|
|
@@ -6348,8 +6102,7 @@ const getTraversableNeighbor = <N, E, T extends Kind>(
|
|
|
6348
6102
|
* Graph.addEdge(mutable, c, d, "edge") // Component 2: C-D
|
|
6349
6103
|
* })
|
|
6350
6104
|
*
|
|
6351
|
-
*
|
|
6352
|
-
* console.log(components) // [[0, 1], [2, 3]]
|
|
6105
|
+
* Graph.connectedComponents(graph) // => [[0, 1], [2, 3]]
|
|
6353
6106
|
* ```
|
|
6354
6107
|
*
|
|
6355
6108
|
* @category algorithms
|
|
@@ -6400,7 +6153,7 @@ export const connectedComponents = <N, E>(
|
|
|
6400
6153
|
*
|
|
6401
6154
|
* **Example** (Finding strongly connected components)
|
|
6402
6155
|
*
|
|
6403
|
-
* ```ts
|
|
6156
|
+
* ```ts import.meta.vitest
|
|
6404
6157
|
* import { Graph } from "effect"
|
|
6405
6158
|
*
|
|
6406
6159
|
* const graph = Graph.directed<string, string>((mutable) => {
|
|
@@ -6412,8 +6165,7 @@ export const connectedComponents = <N, E>(
|
|
|
6412
6165
|
* Graph.addEdge(mutable, c, a, "C->A") // Creates SCC: A-B-C
|
|
6413
6166
|
* })
|
|
6414
6167
|
*
|
|
6415
|
-
*
|
|
6416
|
-
* console.log(sccs) // [[0, 1, 2]]
|
|
6168
|
+
* Graph.stronglyConnectedComponents(graph) // => [[0, 2, 1]]
|
|
6417
6169
|
* ```
|
|
6418
6170
|
*
|
|
6419
6171
|
* @category algorithms
|
|
@@ -6646,8 +6398,8 @@ export interface DijkstraConfig<E> {
|
|
|
6646
6398
|
*
|
|
6647
6399
|
* **Example** (Finding shortest paths with Dijkstra)
|
|
6648
6400
|
*
|
|
6649
|
-
* ```ts
|
|
6650
|
-
* import { Graph } from "effect"
|
|
6401
|
+
* ```ts import.meta.vitest
|
|
6402
|
+
* import { Graph, Option } from "effect"
|
|
6651
6403
|
*
|
|
6652
6404
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
6653
6405
|
* const a = Graph.addNode(mutable, "A")
|
|
@@ -6664,10 +6416,7 @@ export interface DijkstraConfig<E> {
|
|
|
6664
6416
|
* cost: (edgeData) => edgeData
|
|
6665
6417
|
* })
|
|
6666
6418
|
*
|
|
6667
|
-
*
|
|
6668
|
-
* console.log(result.value.path) // [0, 1, 2] - shortest path A->B->C
|
|
6669
|
-
* console.log(result.value.distance) // 7 - total distance
|
|
6670
|
-
* }
|
|
6419
|
+
* Option.map(result, ({ distance, path }) => [distance, path] as const) // => Option.some([7, [0, 1, 2]])
|
|
6671
6420
|
* ```
|
|
6672
6421
|
*
|
|
6673
6422
|
* @category algorithms
|
|
@@ -6687,8 +6436,8 @@ export const dijkstra: {
|
|
|
6687
6436
|
*
|
|
6688
6437
|
* **Example** (Finding shortest paths with Dijkstra)
|
|
6689
6438
|
*
|
|
6690
|
-
* ```ts
|
|
6691
|
-
* import { Graph } from "effect"
|
|
6439
|
+
* ```ts import.meta.vitest
|
|
6440
|
+
* import { Graph, Option } from "effect"
|
|
6692
6441
|
*
|
|
6693
6442
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
6694
6443
|
* const a = Graph.addNode(mutable, "A")
|
|
@@ -6705,10 +6454,7 @@ export const dijkstra: {
|
|
|
6705
6454
|
* cost: (edgeData) => edgeData
|
|
6706
6455
|
* })
|
|
6707
6456
|
*
|
|
6708
|
-
*
|
|
6709
|
-
* console.log(result.value.path) // [0, 1, 2] - shortest path A->B->C
|
|
6710
|
-
* console.log(result.value.distance) // 7 - total distance
|
|
6711
|
-
* }
|
|
6457
|
+
* Option.map(result, ({ distance, path }) => [distance, path] as const) // => Option.some([7, [0, 1, 2]])
|
|
6712
6458
|
* ```
|
|
6713
6459
|
*
|
|
6714
6460
|
* @category algorithms
|
|
@@ -6728,8 +6474,8 @@ export const dijkstra: {
|
|
|
6728
6474
|
*
|
|
6729
6475
|
* **Example** (Finding shortest paths with Dijkstra)
|
|
6730
6476
|
*
|
|
6731
|
-
* ```ts
|
|
6732
|
-
* import { Graph } from "effect"
|
|
6477
|
+
* ```ts import.meta.vitest
|
|
6478
|
+
* import { Graph, Option } from "effect"
|
|
6733
6479
|
*
|
|
6734
6480
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
6735
6481
|
* const a = Graph.addNode(mutable, "A")
|
|
@@ -6746,10 +6492,7 @@ export const dijkstra: {
|
|
|
6746
6492
|
* cost: (edgeData) => edgeData
|
|
6747
6493
|
* })
|
|
6748
6494
|
*
|
|
6749
|
-
*
|
|
6750
|
-
* console.log(result.value.path) // [0, 1, 2] - shortest path A->B->C
|
|
6751
|
-
* console.log(result.value.distance) // 7 - total distance
|
|
6752
|
-
* }
|
|
6495
|
+
* Option.map(result, ({ distance, path }) => [distance, path] as const) // => Option.some([7, [0, 1, 2]])
|
|
6753
6496
|
* ```
|
|
6754
6497
|
*
|
|
6755
6498
|
* @category algorithms
|
|
@@ -6917,7 +6660,7 @@ export interface AllPairsResult<E> {
|
|
|
6917
6660
|
*
|
|
6918
6661
|
* **Example** (Finding all-pairs shortest paths)
|
|
6919
6662
|
*
|
|
6920
|
-
* ```ts
|
|
6663
|
+
* ```ts import.meta.vitest
|
|
6921
6664
|
* import { Graph } from "effect"
|
|
6922
6665
|
*
|
|
6923
6666
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -6930,8 +6673,8 @@ export interface AllPairsResult<E> {
|
|
|
6930
6673
|
* })
|
|
6931
6674
|
*
|
|
6932
6675
|
* const result = Graph.floydWarshall(graph, (edgeData) => edgeData)
|
|
6933
|
-
* const
|
|
6934
|
-
*
|
|
6676
|
+
* const shortest = { distance: result.distances.get(0)?.get(2), path: result.paths.get(0)?.get(2) }
|
|
6677
|
+
* shortest // => { distance: 5, path: [0, 1, 2] }
|
|
6935
6678
|
* ```
|
|
6936
6679
|
*
|
|
6937
6680
|
* @category algorithms
|
|
@@ -6951,7 +6694,7 @@ export const floydWarshall: {
|
|
|
6951
6694
|
*
|
|
6952
6695
|
* **Example** (Finding all-pairs shortest paths)
|
|
6953
6696
|
*
|
|
6954
|
-
* ```ts
|
|
6697
|
+
* ```ts import.meta.vitest
|
|
6955
6698
|
* import { Graph } from "effect"
|
|
6956
6699
|
*
|
|
6957
6700
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -6964,8 +6707,8 @@ export const floydWarshall: {
|
|
|
6964
6707
|
* })
|
|
6965
6708
|
*
|
|
6966
6709
|
* const result = Graph.floydWarshall(graph, (edgeData) => edgeData)
|
|
6967
|
-
* const
|
|
6968
|
-
*
|
|
6710
|
+
* const shortest = { distance: result.distances.get(0)?.get(2), path: result.paths.get(0)?.get(2) }
|
|
6711
|
+
* shortest // => { distance: 5, path: [0, 1, 2] }
|
|
6969
6712
|
* ```
|
|
6970
6713
|
*
|
|
6971
6714
|
* @category algorithms
|
|
@@ -6985,7 +6728,7 @@ export const floydWarshall: {
|
|
|
6985
6728
|
*
|
|
6986
6729
|
* **Example** (Finding all-pairs shortest paths)
|
|
6987
6730
|
*
|
|
6988
|
-
* ```ts
|
|
6731
|
+
* ```ts import.meta.vitest
|
|
6989
6732
|
* import { Graph } from "effect"
|
|
6990
6733
|
*
|
|
6991
6734
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -6998,8 +6741,8 @@ export const floydWarshall: {
|
|
|
6998
6741
|
* })
|
|
6999
6742
|
*
|
|
7000
6743
|
* const result = Graph.floydWarshall(graph, (edgeData) => edgeData)
|
|
7001
|
-
* const
|
|
7002
|
-
*
|
|
6744
|
+
* const shortest = { distance: result.distances.get(0)?.get(2), path: result.paths.get(0)?.get(2) }
|
|
6745
|
+
* shortest // => { distance: 5, path: [0, 1, 2] }
|
|
7003
6746
|
* ```
|
|
7004
6747
|
*
|
|
7005
6748
|
* @category algorithms
|
|
@@ -7176,8 +6919,8 @@ export interface AstarConfig<E, N> {
|
|
|
7176
6919
|
*
|
|
7177
6920
|
* **Example** (Finding shortest paths with A-star)
|
|
7178
6921
|
*
|
|
7179
|
-
* ```ts
|
|
7180
|
-
* import { Graph } from "effect"
|
|
6922
|
+
* ```ts import.meta.vitest
|
|
6923
|
+
* import { Graph, Option } from "effect"
|
|
7181
6924
|
*
|
|
7182
6925
|
* const graph = Graph.directed<{ x: number; y: number }, number>((mutable) => {
|
|
7183
6926
|
* const a = Graph.addNode(mutable, { x: 0, y: 0 })
|
|
@@ -7200,10 +6943,7 @@ export interface AstarConfig<E, N> {
|
|
|
7200
6943
|
* heuristic
|
|
7201
6944
|
* })
|
|
7202
6945
|
*
|
|
7203
|
-
*
|
|
7204
|
-
* console.log(result.value.path) // [0, 1, 2] - shortest path
|
|
7205
|
-
* console.log(result.value.distance) // 2 - total distance
|
|
7206
|
-
* }
|
|
6946
|
+
* Option.map(result, ({ distance, path }) => [distance, path] as const) // => Option.some([2, [0, 1, 2]])
|
|
7207
6947
|
* ```
|
|
7208
6948
|
*
|
|
7209
6949
|
* @category algorithms
|
|
@@ -7224,8 +6964,8 @@ export const astar: {
|
|
|
7224
6964
|
*
|
|
7225
6965
|
* **Example** (Finding shortest paths with A-star)
|
|
7226
6966
|
*
|
|
7227
|
-
* ```ts
|
|
7228
|
-
* import { Graph } from "effect"
|
|
6967
|
+
* ```ts import.meta.vitest
|
|
6968
|
+
* import { Graph, Option } from "effect"
|
|
7229
6969
|
*
|
|
7230
6970
|
* const graph = Graph.directed<{ x: number; y: number }, number>((mutable) => {
|
|
7231
6971
|
* const a = Graph.addNode(mutable, { x: 0, y: 0 })
|
|
@@ -7248,10 +6988,7 @@ export const astar: {
|
|
|
7248
6988
|
* heuristic
|
|
7249
6989
|
* })
|
|
7250
6990
|
*
|
|
7251
|
-
*
|
|
7252
|
-
* console.log(result.value.path) // [0, 1, 2] - shortest path
|
|
7253
|
-
* console.log(result.value.distance) // 2 - total distance
|
|
7254
|
-
* }
|
|
6991
|
+
* Option.map(result, ({ distance, path }) => [distance, path] as const) // => Option.some([2, [0, 1, 2]])
|
|
7255
6992
|
* ```
|
|
7256
6993
|
*
|
|
7257
6994
|
* @category algorithms
|
|
@@ -7272,8 +7009,8 @@ export const astar: {
|
|
|
7272
7009
|
*
|
|
7273
7010
|
* **Example** (Finding shortest paths with A-star)
|
|
7274
7011
|
*
|
|
7275
|
-
* ```ts
|
|
7276
|
-
* import { Graph } from "effect"
|
|
7012
|
+
* ```ts import.meta.vitest
|
|
7013
|
+
* import { Graph, Option } from "effect"
|
|
7277
7014
|
*
|
|
7278
7015
|
* const graph = Graph.directed<{ x: number; y: number }, number>((mutable) => {
|
|
7279
7016
|
* const a = Graph.addNode(mutable, { x: 0, y: 0 })
|
|
@@ -7296,10 +7033,7 @@ export const astar: {
|
|
|
7296
7033
|
* heuristic
|
|
7297
7034
|
* })
|
|
7298
7035
|
*
|
|
7299
|
-
*
|
|
7300
|
-
* console.log(result.value.path) // [0, 1, 2] - shortest path
|
|
7301
|
-
* console.log(result.value.distance) // 2 - total distance
|
|
7302
|
-
* }
|
|
7036
|
+
* Option.map(result, ({ distance, path }) => [distance, path] as const) // => Option.some([2, [0, 1, 2]])
|
|
7303
7037
|
* ```
|
|
7304
7038
|
*
|
|
7305
7039
|
* @category algorithms
|
|
@@ -7495,8 +7229,8 @@ export interface BellmanFordConfig<E> {
|
|
|
7495
7229
|
*
|
|
7496
7230
|
* **Example** (Finding shortest paths with Bellman-Ford)
|
|
7497
7231
|
*
|
|
7498
|
-
* ```ts
|
|
7499
|
-
* import { Graph } from "effect"
|
|
7232
|
+
* ```ts import.meta.vitest
|
|
7233
|
+
* import { Graph, Option } from "effect"
|
|
7500
7234
|
*
|
|
7501
7235
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
7502
7236
|
* const a = Graph.addNode(mutable, "A")
|
|
@@ -7513,10 +7247,7 @@ export interface BellmanFordConfig<E> {
|
|
|
7513
7247
|
* cost: (edgeData) => edgeData
|
|
7514
7248
|
* })
|
|
7515
7249
|
*
|
|
7516
|
-
*
|
|
7517
|
-
* console.log(result.value.path) // [0, 1, 2] - shortest path A->B->C
|
|
7518
|
-
* console.log(result.value.distance) // 2 - total distance
|
|
7519
|
-
* }
|
|
7250
|
+
* Option.map(result, ({ distance, path }) => [distance, path] as const) // => Option.some([2, [0, 1, 2]])
|
|
7520
7251
|
* ```
|
|
7521
7252
|
*
|
|
7522
7253
|
* @category algorithms
|
|
@@ -7536,8 +7267,8 @@ export const bellmanFord: {
|
|
|
7536
7267
|
*
|
|
7537
7268
|
* **Example** (Finding shortest paths with Bellman-Ford)
|
|
7538
7269
|
*
|
|
7539
|
-
* ```ts
|
|
7540
|
-
* import { Graph } from "effect"
|
|
7270
|
+
* ```ts import.meta.vitest
|
|
7271
|
+
* import { Graph, Option } from "effect"
|
|
7541
7272
|
*
|
|
7542
7273
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
7543
7274
|
* const a = Graph.addNode(mutable, "A")
|
|
@@ -7554,10 +7285,7 @@ export const bellmanFord: {
|
|
|
7554
7285
|
* cost: (edgeData) => edgeData
|
|
7555
7286
|
* })
|
|
7556
7287
|
*
|
|
7557
|
-
*
|
|
7558
|
-
* console.log(result.value.path) // [0, 1, 2] - shortest path A->B->C
|
|
7559
|
-
* console.log(result.value.distance) // 2 - total distance
|
|
7560
|
-
* }
|
|
7288
|
+
* Option.map(result, ({ distance, path }) => [distance, path] as const) // => Option.some([2, [0, 1, 2]])
|
|
7561
7289
|
* ```
|
|
7562
7290
|
*
|
|
7563
7291
|
* @category algorithms
|
|
@@ -7577,8 +7305,8 @@ export const bellmanFord: {
|
|
|
7577
7305
|
*
|
|
7578
7306
|
* **Example** (Finding shortest paths with Bellman-Ford)
|
|
7579
7307
|
*
|
|
7580
|
-
* ```ts
|
|
7581
|
-
* import { Graph } from "effect"
|
|
7308
|
+
* ```ts import.meta.vitest
|
|
7309
|
+
* import { Graph, Option } from "effect"
|
|
7582
7310
|
*
|
|
7583
7311
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
7584
7312
|
* const a = Graph.addNode(mutable, "A")
|
|
@@ -7595,10 +7323,7 @@ export const bellmanFord: {
|
|
|
7595
7323
|
* cost: (edgeData) => edgeData
|
|
7596
7324
|
* })
|
|
7597
7325
|
*
|
|
7598
|
-
*
|
|
7599
|
-
* console.log(result.value.path) // [0, 1, 2] - shortest path A->B->C
|
|
7600
|
-
* console.log(result.value.distance) // 2 - total distance
|
|
7601
|
-
* }
|
|
7326
|
+
* Option.map(result, ({ distance, path }) => [distance, path] as const) // => Option.some([2, [0, 1, 2]])
|
|
7602
7327
|
* ```
|
|
7603
7328
|
*
|
|
7604
7329
|
* @category algorithms
|
|
@@ -7745,7 +7470,7 @@ export const bellmanFord: {
|
|
|
7745
7470
|
*
|
|
7746
7471
|
* **Example** (Working with node walkers)
|
|
7747
7472
|
*
|
|
7748
|
-
* ```ts
|
|
7473
|
+
* ```ts import.meta.vitest
|
|
7749
7474
|
* import { Graph } from "effect"
|
|
7750
7475
|
*
|
|
7751
7476
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -7764,8 +7489,8 @@ export const bellmanFord: {
|
|
|
7764
7489
|
* }
|
|
7765
7490
|
*
|
|
7766
7491
|
* // Access node data using values() or entries()
|
|
7767
|
-
*
|
|
7768
|
-
*
|
|
7492
|
+
* Array.from(Graph.values(dfsNodes)) // => ["A", "B"]
|
|
7493
|
+
* Array.from(Graph.entries(allNodes)) // => [[0, "A"], [1, "B"]]
|
|
7769
7494
|
* ```
|
|
7770
7495
|
*
|
|
7771
7496
|
* @category models
|
|
@@ -7786,7 +7511,7 @@ export class Walker<T, N> implements Iterable<[T, N]> {
|
|
|
7786
7511
|
*
|
|
7787
7512
|
* **Example** (Visiting walker elements)
|
|
7788
7513
|
*
|
|
7789
|
-
* ```ts
|
|
7514
|
+
* ```ts import.meta.vitest
|
|
7790
7515
|
* import { Graph } from "effect"
|
|
7791
7516
|
*
|
|
7792
7517
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -7798,14 +7523,10 @@ export class Walker<T, N> implements Iterable<[T, N]> {
|
|
|
7798
7523
|
* const dfs = Graph.dfs(graph, { start: [0] })
|
|
7799
7524
|
*
|
|
7800
7525
|
* // Map to just the node data
|
|
7801
|
-
*
|
|
7802
|
-
* console.log(values) // ["A", "B"]
|
|
7526
|
+
* Array.from(dfs.visit((index, data) => data)) // => ["A", "B"]
|
|
7803
7527
|
*
|
|
7804
7528
|
* // Map to custom objects
|
|
7805
|
-
*
|
|
7806
|
-
* dfs.visit((index, data) => ({ id: index, name: data }))
|
|
7807
|
-
* )
|
|
7808
|
-
* console.log(custom) // [{ id: 0, name: "A" }, { id: 1, name: "B" }]
|
|
7529
|
+
* Array.from(dfs.visit((index, data) => ({ id: index, name: data }))) // => [{ id: 0, name: "A" }, { id: 1, name: "B" }]
|
|
7809
7530
|
* ```
|
|
7810
7531
|
*
|
|
7811
7532
|
* @since 4.0.0
|
|
@@ -7822,7 +7543,7 @@ export class Walker<T, N> implements Iterable<[T, N]> {
|
|
|
7822
7543
|
*
|
|
7823
7544
|
* **Example** (Visiting walker elements)
|
|
7824
7545
|
*
|
|
7825
|
-
* ```ts
|
|
7546
|
+
* ```ts import.meta.vitest
|
|
7826
7547
|
* import { Graph } from "effect"
|
|
7827
7548
|
*
|
|
7828
7549
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -7834,14 +7555,10 @@ export class Walker<T, N> implements Iterable<[T, N]> {
|
|
|
7834
7555
|
* const dfs = Graph.dfs(graph, { start: [0] })
|
|
7835
7556
|
*
|
|
7836
7557
|
* // Map to just the node data
|
|
7837
|
-
*
|
|
7838
|
-
* console.log(values) // ["A", "B"]
|
|
7558
|
+
* Array.from(dfs.visit((index, data) => data)) // => ["A", "B"]
|
|
7839
7559
|
*
|
|
7840
7560
|
* // Map to custom objects
|
|
7841
|
-
*
|
|
7842
|
-
* dfs.visit((index, data) => ({ id: index, name: data }))
|
|
7843
|
-
* )
|
|
7844
|
-
* console.log(custom) // [{ id: 0, name: "A" }, { id: 1, name: "B" }]
|
|
7561
|
+
* Array.from(dfs.visit((index, data) => ({ id: index, name: data }))) // => [{ id: 0, name: "A" }, { id: 1, name: "B" }]
|
|
7845
7562
|
* ```
|
|
7846
7563
|
*
|
|
7847
7564
|
* @category iterators
|
|
@@ -7895,7 +7612,7 @@ export type EdgeWalker<E> = Walker<EdgeIndex, Edge<E>>
|
|
|
7895
7612
|
*
|
|
7896
7613
|
* **Example** (Iterating walker indices)
|
|
7897
7614
|
*
|
|
7898
|
-
* ```ts
|
|
7615
|
+
* ```ts import.meta.vitest
|
|
7899
7616
|
* import { Graph } from "effect"
|
|
7900
7617
|
*
|
|
7901
7618
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -7905,8 +7622,7 @@ export type EdgeWalker<E> = Walker<EdgeIndex, Edge<E>>
|
|
|
7905
7622
|
* })
|
|
7906
7623
|
*
|
|
7907
7624
|
* const dfs = Graph.dfs(graph, { start: [0] })
|
|
7908
|
-
*
|
|
7909
|
-
* console.log(indices) // [0, 1]
|
|
7625
|
+
* Array.from(Graph.indices(dfs)) // => [0, 1]
|
|
7910
7626
|
* ```
|
|
7911
7627
|
*
|
|
7912
7628
|
* @category iterators
|
|
@@ -7919,7 +7635,7 @@ export const indices = <T, N>(walker: Walker<T, N>): Iterable<T> => walker.visit
|
|
|
7919
7635
|
*
|
|
7920
7636
|
* **Example** (Iterating walker values)
|
|
7921
7637
|
*
|
|
7922
|
-
* ```ts
|
|
7638
|
+
* ```ts import.meta.vitest
|
|
7923
7639
|
* import { Graph } from "effect"
|
|
7924
7640
|
*
|
|
7925
7641
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -7929,8 +7645,7 @@ export const indices = <T, N>(walker: Walker<T, N>): Iterable<T> => walker.visit
|
|
|
7929
7645
|
* })
|
|
7930
7646
|
*
|
|
7931
7647
|
* const dfs = Graph.dfs(graph, { start: [0] })
|
|
7932
|
-
*
|
|
7933
|
-
* console.log(values) // ["A", "B"]
|
|
7648
|
+
* Array.from(Graph.values(dfs)) // => ["A", "B"]
|
|
7934
7649
|
* ```
|
|
7935
7650
|
*
|
|
7936
7651
|
* @category iterators
|
|
@@ -7943,7 +7658,7 @@ export const values = <T, N>(walker: Walker<T, N>): Iterable<N> => walker.visit(
|
|
|
7943
7658
|
*
|
|
7944
7659
|
* **Example** (Iterating walker entries)
|
|
7945
7660
|
*
|
|
7946
|
-
* ```ts
|
|
7661
|
+
* ```ts import.meta.vitest
|
|
7947
7662
|
* import { Graph } from "effect"
|
|
7948
7663
|
*
|
|
7949
7664
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -7953,8 +7668,7 @@ export const values = <T, N>(walker: Walker<T, N>): Iterable<N> => walker.visit(
|
|
|
7953
7668
|
* })
|
|
7954
7669
|
*
|
|
7955
7670
|
* const dfs = Graph.dfs(graph, { start: [0] })
|
|
7956
|
-
*
|
|
7957
|
-
* console.log(entries) // [[0, "A"], [1, "B"]]
|
|
7671
|
+
* Array.from(Graph.entries(dfs)) // => [[0, "A"], [1, "B"]]
|
|
7958
7672
|
* ```
|
|
7959
7673
|
*
|
|
7960
7674
|
* @category iterators
|
|
@@ -8009,7 +7723,7 @@ export interface SearchConfig {
|
|
|
8009
7723
|
*
|
|
8010
7724
|
* **Example** (Traversing depth-first)
|
|
8011
7725
|
*
|
|
8012
|
-
* ```ts
|
|
7726
|
+
* ```ts import.meta.vitest
|
|
8013
7727
|
* import { Graph } from "effect"
|
|
8014
7728
|
*
|
|
8015
7729
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -8021,14 +7735,10 @@ export interface SearchConfig {
|
|
|
8021
7735
|
* })
|
|
8022
7736
|
*
|
|
8023
7737
|
* // Start from a specific node
|
|
8024
|
-
*
|
|
8025
|
-
* for (const nodeIndex of Graph.indices(dfs1)) {
|
|
8026
|
-
* console.log(nodeIndex) // Traverses in DFS order: 0, 1, 2
|
|
8027
|
-
* }
|
|
7738
|
+
* Array.from(Graph.indices(Graph.dfs(graph, { start: [0] }))) // => [0, 1, 2]
|
|
8028
7739
|
*
|
|
8029
7740
|
* // Empty iterator (no starting nodes)
|
|
8030
|
-
*
|
|
8031
|
-
* // Can be used programmatically
|
|
7741
|
+
* Graph.dfs(graph)
|
|
8032
7742
|
* ```
|
|
8033
7743
|
*
|
|
8034
7744
|
* @category iterators
|
|
@@ -8048,7 +7758,7 @@ export const dfs: {
|
|
|
8048
7758
|
*
|
|
8049
7759
|
* **Example** (Traversing depth-first)
|
|
8050
7760
|
*
|
|
8051
|
-
* ```ts
|
|
7761
|
+
* ```ts import.meta.vitest
|
|
8052
7762
|
* import { Graph } from "effect"
|
|
8053
7763
|
*
|
|
8054
7764
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -8060,14 +7770,10 @@ export const dfs: {
|
|
|
8060
7770
|
* })
|
|
8061
7771
|
*
|
|
8062
7772
|
* // Start from a specific node
|
|
8063
|
-
*
|
|
8064
|
-
* for (const nodeIndex of Graph.indices(dfs1)) {
|
|
8065
|
-
* console.log(nodeIndex) // Traverses in DFS order: 0, 1, 2
|
|
8066
|
-
* }
|
|
7773
|
+
* Array.from(Graph.indices(Graph.dfs(graph, { start: [0] }))) // => [0, 1, 2]
|
|
8067
7774
|
*
|
|
8068
7775
|
* // Empty iterator (no starting nodes)
|
|
8069
|
-
*
|
|
8070
|
-
* // Can be used programmatically
|
|
7776
|
+
* Graph.dfs(graph)
|
|
8071
7777
|
* ```
|
|
8072
7778
|
*
|
|
8073
7779
|
* @category iterators
|
|
@@ -8087,7 +7793,7 @@ export const dfs: {
|
|
|
8087
7793
|
*
|
|
8088
7794
|
* **Example** (Traversing depth-first)
|
|
8089
7795
|
*
|
|
8090
|
-
* ```ts
|
|
7796
|
+
* ```ts import.meta.vitest
|
|
8091
7797
|
* import { Graph } from "effect"
|
|
8092
7798
|
*
|
|
8093
7799
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -8099,14 +7805,10 @@ export const dfs: {
|
|
|
8099
7805
|
* })
|
|
8100
7806
|
*
|
|
8101
7807
|
* // Start from a specific node
|
|
8102
|
-
*
|
|
8103
|
-
* for (const nodeIndex of Graph.indices(dfs1)) {
|
|
8104
|
-
* console.log(nodeIndex) // Traverses in DFS order: 0, 1, 2
|
|
8105
|
-
* }
|
|
7808
|
+
* Array.from(Graph.indices(Graph.dfs(graph, { start: [0] }))) // => [0, 1, 2]
|
|
8106
7809
|
*
|
|
8107
7810
|
* // Empty iterator (no starting nodes)
|
|
8108
|
-
*
|
|
8109
|
-
* // Can be used programmatically
|
|
7811
|
+
* Graph.dfs(graph)
|
|
8110
7812
|
* ```
|
|
8111
7813
|
*
|
|
8112
7814
|
* @category iterators
|
|
@@ -8217,7 +7919,7 @@ export const dfs: {
|
|
|
8217
7919
|
*
|
|
8218
7920
|
* **Example** (Traversing breadth-first)
|
|
8219
7921
|
*
|
|
8220
|
-
* ```ts
|
|
7922
|
+
* ```ts import.meta.vitest
|
|
8221
7923
|
* import { Graph } from "effect"
|
|
8222
7924
|
*
|
|
8223
7925
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -8229,14 +7931,10 @@ export const dfs: {
|
|
|
8229
7931
|
* })
|
|
8230
7932
|
*
|
|
8231
7933
|
* // Start from a specific node
|
|
8232
|
-
*
|
|
8233
|
-
* for (const nodeIndex of Graph.indices(bfs1)) {
|
|
8234
|
-
* console.log(nodeIndex) // Traverses in BFS order: 0, 1, 2
|
|
8235
|
-
* }
|
|
7934
|
+
* Array.from(Graph.indices(Graph.bfs(graph, { start: [0] }))) // => [0, 1, 2]
|
|
8236
7935
|
*
|
|
8237
7936
|
* // Empty iterator (no starting nodes)
|
|
8238
|
-
*
|
|
8239
|
-
* // Can be used programmatically
|
|
7937
|
+
* Graph.bfs(graph)
|
|
8240
7938
|
* ```
|
|
8241
7939
|
*
|
|
8242
7940
|
* @category iterators
|
|
@@ -8256,7 +7954,7 @@ export const bfs: {
|
|
|
8256
7954
|
*
|
|
8257
7955
|
* **Example** (Traversing breadth-first)
|
|
8258
7956
|
*
|
|
8259
|
-
* ```ts
|
|
7957
|
+
* ```ts import.meta.vitest
|
|
8260
7958
|
* import { Graph } from "effect"
|
|
8261
7959
|
*
|
|
8262
7960
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -8268,14 +7966,10 @@ export const bfs: {
|
|
|
8268
7966
|
* })
|
|
8269
7967
|
*
|
|
8270
7968
|
* // Start from a specific node
|
|
8271
|
-
*
|
|
8272
|
-
* for (const nodeIndex of Graph.indices(bfs1)) {
|
|
8273
|
-
* console.log(nodeIndex) // Traverses in BFS order: 0, 1, 2
|
|
8274
|
-
* }
|
|
7969
|
+
* Array.from(Graph.indices(Graph.bfs(graph, { start: [0] }))) // => [0, 1, 2]
|
|
8275
7970
|
*
|
|
8276
7971
|
* // Empty iterator (no starting nodes)
|
|
8277
|
-
*
|
|
8278
|
-
* // Can be used programmatically
|
|
7972
|
+
* Graph.bfs(graph)
|
|
8279
7973
|
* ```
|
|
8280
7974
|
*
|
|
8281
7975
|
* @category iterators
|
|
@@ -8295,7 +7989,7 @@ export const bfs: {
|
|
|
8295
7989
|
*
|
|
8296
7990
|
* **Example** (Traversing breadth-first)
|
|
8297
7991
|
*
|
|
8298
|
-
* ```ts
|
|
7992
|
+
* ```ts import.meta.vitest
|
|
8299
7993
|
* import { Graph } from "effect"
|
|
8300
7994
|
*
|
|
8301
7995
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -8307,14 +8001,10 @@ export const bfs: {
|
|
|
8307
8001
|
* })
|
|
8308
8002
|
*
|
|
8309
8003
|
* // Start from a specific node
|
|
8310
|
-
*
|
|
8311
|
-
* for (const nodeIndex of Graph.indices(bfs1)) {
|
|
8312
|
-
* console.log(nodeIndex) // Traverses in BFS order: 0, 1, 2
|
|
8313
|
-
* }
|
|
8004
|
+
* Array.from(Graph.indices(Graph.bfs(graph, { start: [0] }))) // => [0, 1, 2]
|
|
8314
8005
|
*
|
|
8315
8006
|
* // Empty iterator (no starting nodes)
|
|
8316
|
-
*
|
|
8317
|
-
* // Can be used programmatically
|
|
8007
|
+
* Graph.bfs(graph)
|
|
8318
8008
|
* ```
|
|
8319
8009
|
*
|
|
8320
8010
|
* @category iterators
|
|
@@ -8409,7 +8099,7 @@ export interface TopoConfig {
|
|
|
8409
8099
|
*
|
|
8410
8100
|
* **Example** (Sorting topologically)
|
|
8411
8101
|
*
|
|
8412
|
-
* ```ts
|
|
8102
|
+
* ```ts import.meta.vitest
|
|
8413
8103
|
* import { Graph } from "effect"
|
|
8414
8104
|
*
|
|
8415
8105
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -8421,13 +8111,10 @@ export interface TopoConfig {
|
|
|
8421
8111
|
* })
|
|
8422
8112
|
*
|
|
8423
8113
|
* // Standard topological sort
|
|
8424
|
-
*
|
|
8425
|
-
* for (const nodeIndex of Graph.indices(topo1)) {
|
|
8426
|
-
* console.log(nodeIndex) // 0, 1, 2 (topological order)
|
|
8427
|
-
* }
|
|
8114
|
+
* Array.from(Graph.indices(Graph.topo(graph))) // => [0, 1, 2]
|
|
8428
8115
|
*
|
|
8429
8116
|
* // With initial nodes
|
|
8430
|
-
*
|
|
8117
|
+
* Graph.topo(graph, { initials: [0] })
|
|
8431
8118
|
*
|
|
8432
8119
|
* // Check before sorting a cyclic graph
|
|
8433
8120
|
* const cyclicGraph = Graph.directed<string, number>((mutable) => {
|
|
@@ -8437,9 +8124,7 @@ export interface TopoConfig {
|
|
|
8437
8124
|
* Graph.addEdge(mutable, b, a, 2) // Creates cycle
|
|
8438
8125
|
* })
|
|
8439
8126
|
*
|
|
8440
|
-
*
|
|
8441
|
-
* console.log("cyclic graph") // cyclic graph
|
|
8442
|
-
* }
|
|
8127
|
+
* Graph.isAcyclic(cyclicGraph) // => false
|
|
8443
8128
|
* ```
|
|
8444
8129
|
*
|
|
8445
8130
|
* @category iterators
|
|
@@ -8456,7 +8141,7 @@ export const topo: {
|
|
|
8456
8141
|
*
|
|
8457
8142
|
* **Example** (Sorting topologically)
|
|
8458
8143
|
*
|
|
8459
|
-
* ```ts
|
|
8144
|
+
* ```ts import.meta.vitest
|
|
8460
8145
|
* import { Graph } from "effect"
|
|
8461
8146
|
*
|
|
8462
8147
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -8468,13 +8153,10 @@ export const topo: {
|
|
|
8468
8153
|
* })
|
|
8469
8154
|
*
|
|
8470
8155
|
* // Standard topological sort
|
|
8471
|
-
*
|
|
8472
|
-
* for (const nodeIndex of Graph.indices(topo1)) {
|
|
8473
|
-
* console.log(nodeIndex) // 0, 1, 2 (topological order)
|
|
8474
|
-
* }
|
|
8156
|
+
* Array.from(Graph.indices(Graph.topo(graph))) // => [0, 1, 2]
|
|
8475
8157
|
*
|
|
8476
8158
|
* // With initial nodes
|
|
8477
|
-
*
|
|
8159
|
+
* Graph.topo(graph, { initials: [0] })
|
|
8478
8160
|
*
|
|
8479
8161
|
* // Check before sorting a cyclic graph
|
|
8480
8162
|
* const cyclicGraph = Graph.directed<string, number>((mutable) => {
|
|
@@ -8484,9 +8166,7 @@ export const topo: {
|
|
|
8484
8166
|
* Graph.addEdge(mutable, b, a, 2) // Creates cycle
|
|
8485
8167
|
* })
|
|
8486
8168
|
*
|
|
8487
|
-
*
|
|
8488
|
-
* console.log("cyclic graph") // cyclic graph
|
|
8489
|
-
* }
|
|
8169
|
+
* Graph.isAcyclic(cyclicGraph) // => false
|
|
8490
8170
|
* ```
|
|
8491
8171
|
*
|
|
8492
8172
|
* @category iterators
|
|
@@ -8503,7 +8183,7 @@ export const topo: {
|
|
|
8503
8183
|
*
|
|
8504
8184
|
* **Example** (Sorting topologically)
|
|
8505
8185
|
*
|
|
8506
|
-
* ```ts
|
|
8186
|
+
* ```ts import.meta.vitest
|
|
8507
8187
|
* import { Graph } from "effect"
|
|
8508
8188
|
*
|
|
8509
8189
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -8515,13 +8195,10 @@ export const topo: {
|
|
|
8515
8195
|
* })
|
|
8516
8196
|
*
|
|
8517
8197
|
* // Standard topological sort
|
|
8518
|
-
*
|
|
8519
|
-
* for (const nodeIndex of Graph.indices(topo1)) {
|
|
8520
|
-
* console.log(nodeIndex) // 0, 1, 2 (topological order)
|
|
8521
|
-
* }
|
|
8198
|
+
* Array.from(Graph.indices(Graph.topo(graph))) // => [0, 1, 2]
|
|
8522
8199
|
*
|
|
8523
8200
|
* // With initial nodes
|
|
8524
|
-
*
|
|
8201
|
+
* Graph.topo(graph, { initials: [0] })
|
|
8525
8202
|
*
|
|
8526
8203
|
* // Check before sorting a cyclic graph
|
|
8527
8204
|
* const cyclicGraph = Graph.directed<string, number>((mutable) => {
|
|
@@ -8531,9 +8208,7 @@ export const topo: {
|
|
|
8531
8208
|
* Graph.addEdge(mutable, b, a, 2) // Creates cycle
|
|
8532
8209
|
* })
|
|
8533
8210
|
*
|
|
8534
|
-
*
|
|
8535
|
-
* console.log("cyclic graph") // cyclic graph
|
|
8536
|
-
* }
|
|
8211
|
+
* Graph.isAcyclic(cyclicGraph) // => false
|
|
8537
8212
|
* ```
|
|
8538
8213
|
*
|
|
8539
8214
|
* @category iterators
|
|
@@ -8663,7 +8338,7 @@ export const topo: {
|
|
|
8663
8338
|
*
|
|
8664
8339
|
* **Example** (Traversing in postorder)
|
|
8665
8340
|
*
|
|
8666
|
-
* ```ts
|
|
8341
|
+
* ```ts import.meta.vitest
|
|
8667
8342
|
* import { Graph } from "effect"
|
|
8668
8343
|
*
|
|
8669
8344
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -8675,10 +8350,7 @@ export const topo: {
|
|
|
8675
8350
|
* })
|
|
8676
8351
|
*
|
|
8677
8352
|
* // Postorder: children before parents
|
|
8678
|
-
*
|
|
8679
|
-
* for (const node of postOrder) {
|
|
8680
|
-
* console.log(node) // 1, 2, 0
|
|
8681
|
-
* }
|
|
8353
|
+
* Array.from(Graph.indices(Graph.dfsPostOrder(graph, { start: [0] }))) // => [1, 2, 0]
|
|
8682
8354
|
* ```
|
|
8683
8355
|
*
|
|
8684
8356
|
* @category iterators
|
|
@@ -8704,7 +8376,7 @@ export const dfsPostOrder: {
|
|
|
8704
8376
|
*
|
|
8705
8377
|
* **Example** (Traversing in postorder)
|
|
8706
8378
|
*
|
|
8707
|
-
* ```ts
|
|
8379
|
+
* ```ts import.meta.vitest
|
|
8708
8380
|
* import { Graph } from "effect"
|
|
8709
8381
|
*
|
|
8710
8382
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -8716,10 +8388,7 @@ export const dfsPostOrder: {
|
|
|
8716
8388
|
* })
|
|
8717
8389
|
*
|
|
8718
8390
|
* // Postorder: children before parents
|
|
8719
|
-
*
|
|
8720
|
-
* for (const node of postOrder) {
|
|
8721
|
-
* console.log(node) // 1, 2, 0
|
|
8722
|
-
* }
|
|
8391
|
+
* Array.from(Graph.indices(Graph.dfsPostOrder(graph, { start: [0] }))) // => [1, 2, 0]
|
|
8723
8392
|
* ```
|
|
8724
8393
|
*
|
|
8725
8394
|
* @category iterators
|
|
@@ -8745,7 +8414,7 @@ export const dfsPostOrder: {
|
|
|
8745
8414
|
*
|
|
8746
8415
|
* **Example** (Traversing in postorder)
|
|
8747
8416
|
*
|
|
8748
|
-
* ```ts
|
|
8417
|
+
* ```ts import.meta.vitest
|
|
8749
8418
|
* import { Graph } from "effect"
|
|
8750
8419
|
*
|
|
8751
8420
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -8757,10 +8426,7 @@ export const dfsPostOrder: {
|
|
|
8757
8426
|
* })
|
|
8758
8427
|
*
|
|
8759
8428
|
* // Postorder: children before parents
|
|
8760
|
-
*
|
|
8761
|
-
* for (const node of postOrder) {
|
|
8762
|
-
* console.log(node) // 1, 2, 0
|
|
8763
|
-
* }
|
|
8429
|
+
* Array.from(Graph.indices(Graph.dfsPostOrder(graph, { start: [0] }))) // => [1, 2, 0]
|
|
8764
8430
|
* ```
|
|
8765
8431
|
*
|
|
8766
8432
|
* @category iterators
|
|
@@ -8852,7 +8518,7 @@ export const dfsPostOrder: {
|
|
|
8852
8518
|
*
|
|
8853
8519
|
* **Example** (Iterating all nodes)
|
|
8854
8520
|
*
|
|
8855
|
-
* ```ts
|
|
8521
|
+
* ```ts import.meta.vitest
|
|
8856
8522
|
* import { Graph } from "effect"
|
|
8857
8523
|
*
|
|
8858
8524
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -8862,8 +8528,7 @@ export const dfsPostOrder: {
|
|
|
8862
8528
|
* Graph.addEdge(mutable, a, b, 1)
|
|
8863
8529
|
* })
|
|
8864
8530
|
*
|
|
8865
|
-
*
|
|
8866
|
-
* console.log(indices) // [0, 1, 2]
|
|
8531
|
+
* Array.from(Graph.indices(Graph.nodes(graph))) // => [0, 1, 2]
|
|
8867
8532
|
* ```
|
|
8868
8533
|
*
|
|
8869
8534
|
* @category iterators
|
|
@@ -8900,7 +8565,7 @@ export const nodes = <N, E, T extends Kind = "directed">(
|
|
|
8900
8565
|
*
|
|
8901
8566
|
* **Example** (Iterating all edges)
|
|
8902
8567
|
*
|
|
8903
|
-
* ```ts
|
|
8568
|
+
* ```ts import.meta.vitest
|
|
8904
8569
|
* import { Graph } from "effect"
|
|
8905
8570
|
*
|
|
8906
8571
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -8911,8 +8576,7 @@ export const nodes = <N, E, T extends Kind = "directed">(
|
|
|
8911
8576
|
* Graph.addEdge(mutable, b, c, 2)
|
|
8912
8577
|
* })
|
|
8913
8578
|
*
|
|
8914
|
-
*
|
|
8915
|
-
* console.log(indices) // [0, 1]
|
|
8579
|
+
* Array.from(Graph.indices(Graph.edges(graph))) // => [0, 1]
|
|
8916
8580
|
* ```
|
|
8917
8581
|
*
|
|
8918
8582
|
* @category iterators
|
|
@@ -8974,7 +8638,7 @@ export interface ExternalsConfig {
|
|
|
8974
8638
|
*
|
|
8975
8639
|
* **Example** (Iterating external nodes)
|
|
8976
8640
|
*
|
|
8977
|
-
* ```ts
|
|
8641
|
+
* ```ts import.meta.vitest
|
|
8978
8642
|
* import { Graph } from "effect"
|
|
8979
8643
|
*
|
|
8980
8644
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -8988,16 +8652,10 @@ export interface ExternalsConfig {
|
|
|
8988
8652
|
* })
|
|
8989
8653
|
*
|
|
8990
8654
|
* // Nodes with no outgoing edges (sinks + isolated)
|
|
8991
|
-
*
|
|
8992
|
-
* Graph.indices(Graph.externals(graph, { direction: "outgoing" }))
|
|
8993
|
-
* )
|
|
8994
|
-
* console.log(sinks) // [2, 3]
|
|
8655
|
+
* Array.from(Graph.indices(Graph.externals(graph, { direction: "outgoing" }))) // => [2, 3]
|
|
8995
8656
|
*
|
|
8996
8657
|
* // Nodes with no incoming edges (sources + isolated)
|
|
8997
|
-
*
|
|
8998
|
-
* Graph.indices(Graph.externals(graph, { direction: "incoming" }))
|
|
8999
|
-
* )
|
|
9000
|
-
* console.log(sources) // [0, 3]
|
|
8658
|
+
* Array.from(Graph.indices(Graph.externals(graph, { direction: "incoming" }))) // => [0, 3]
|
|
9001
8659
|
* ```
|
|
9002
8660
|
*
|
|
9003
8661
|
* @category iterators
|
|
@@ -9015,7 +8673,7 @@ export const externals: {
|
|
|
9015
8673
|
*
|
|
9016
8674
|
* **Example** (Iterating external nodes)
|
|
9017
8675
|
*
|
|
9018
|
-
* ```ts
|
|
8676
|
+
* ```ts import.meta.vitest
|
|
9019
8677
|
* import { Graph } from "effect"
|
|
9020
8678
|
*
|
|
9021
8679
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -9029,16 +8687,10 @@ export const externals: {
|
|
|
9029
8687
|
* })
|
|
9030
8688
|
*
|
|
9031
8689
|
* // Nodes with no outgoing edges (sinks + isolated)
|
|
9032
|
-
*
|
|
9033
|
-
* Graph.indices(Graph.externals(graph, { direction: "outgoing" }))
|
|
9034
|
-
* )
|
|
9035
|
-
* console.log(sinks) // [2, 3]
|
|
8690
|
+
* Array.from(Graph.indices(Graph.externals(graph, { direction: "outgoing" }))) // => [2, 3]
|
|
9036
8691
|
*
|
|
9037
8692
|
* // Nodes with no incoming edges (sources + isolated)
|
|
9038
|
-
*
|
|
9039
|
-
* Graph.indices(Graph.externals(graph, { direction: "incoming" }))
|
|
9040
|
-
* )
|
|
9041
|
-
* console.log(sources) // [0, 3]
|
|
8693
|
+
* Array.from(Graph.indices(Graph.externals(graph, { direction: "incoming" }))) // => [0, 3]
|
|
9042
8694
|
* ```
|
|
9043
8695
|
*
|
|
9044
8696
|
* @category iterators
|
|
@@ -9056,7 +8708,7 @@ export const externals: {
|
|
|
9056
8708
|
*
|
|
9057
8709
|
* **Example** (Iterating external nodes)
|
|
9058
8710
|
*
|
|
9059
|
-
* ```ts
|
|
8711
|
+
* ```ts import.meta.vitest
|
|
9060
8712
|
* import { Graph } from "effect"
|
|
9061
8713
|
*
|
|
9062
8714
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -9070,16 +8722,10 @@ export const externals: {
|
|
|
9070
8722
|
* })
|
|
9071
8723
|
*
|
|
9072
8724
|
* // Nodes with no outgoing edges (sinks + isolated)
|
|
9073
|
-
*
|
|
9074
|
-
* Graph.indices(Graph.externals(graph, { direction: "outgoing" }))
|
|
9075
|
-
* )
|
|
9076
|
-
* console.log(sinks) // [2, 3]
|
|
8725
|
+
* Array.from(Graph.indices(Graph.externals(graph, { direction: "outgoing" }))) // => [2, 3]
|
|
9077
8726
|
*
|
|
9078
8727
|
* // Nodes with no incoming edges (sources + isolated)
|
|
9079
|
-
*
|
|
9080
|
-
* Graph.indices(Graph.externals(graph, { direction: "incoming" }))
|
|
9081
|
-
* )
|
|
9082
|
-
* console.log(sources) // [0, 3]
|
|
8728
|
+
* Array.from(Graph.indices(Graph.externals(graph, { direction: "incoming" }))) // => [0, 3]
|
|
9083
8729
|
* ```
|
|
9084
8730
|
*
|
|
9085
8731
|
* @category iterators
|