effect 4.0.0-beta.98 → 4.0.0-rc.108
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/AGENTS.md +381 -0
- package/CLAUDE.md +381 -0
- package/README.md +13 -20
- package/ai-docs/README.md +44 -0
- package/ai-docs/package.json +36 -0
- package/ai-docs/src/01_effect/01_basics/01_effect-gen.ts +30 -0
- package/ai-docs/src/01_effect/01_basics/02_effect-fn.ts +39 -0
- package/ai-docs/src/01_effect/01_basics/10_creating-effects.ts +74 -0
- package/ai-docs/src/01_effect/01_basics/index.md +5 -0
- package/ai-docs/src/01_effect/02_schema/10_schema-basics.ts +43 -0
- package/ai-docs/src/01_effect/02_schema/index.md +7 -0
- package/ai-docs/src/01_effect/03_services/01_service.ts +45 -0
- package/ai-docs/src/01_effect/03_services/10_reference.ts +10 -0
- package/ai-docs/src/01_effect/03_services/20_layer-composition.ts +70 -0
- package/ai-docs/src/01_effect/03_services/20_layer-unwrap.ts +66 -0
- package/ai-docs/src/01_effect/03_services/index.md +5 -0
- package/ai-docs/src/01_effect/04_errors/01_error-handling.ts +30 -0
- package/ai-docs/src/01_effect/04_errors/10_catch-tags.ts +24 -0
- package/ai-docs/src/01_effect/04_errors/20_reason-errors.ts +64 -0
- package/ai-docs/src/01_effect/04_errors/index.md +1 -0
- package/ai-docs/src/01_effect/05_resources/10_acquire-release.ts +105 -0
- package/ai-docs/src/01_effect/05_resources/20_layer-side-effects.ts +31 -0
- package/ai-docs/src/01_effect/05_resources/30_layer-map.ts +86 -0
- package/ai-docs/src/01_effect/05_resources/index.md +3 -0
- package/ai-docs/src/01_effect/06_running/10_run-main.ts +30 -0
- package/ai-docs/src/01_effect/06_running/20_layer-launch.ts +27 -0
- package/ai-docs/src/01_effect/06_running/index.md +1 -0
- package/ai-docs/src/01_effect/07_pubsub/10_pubsub.ts +56 -0
- package/ai-docs/src/01_effect/07_pubsub/index.md +3 -0
- package/ai-docs/src/03_stream/10_creating-streams.ts +103 -0
- package/ai-docs/src/03_stream/20_consuming-streams.ts +137 -0
- package/ai-docs/src/03_stream/30_encoding.ts +165 -0
- package/ai-docs/src/03_stream/index.md +4 -0
- package/ai-docs/src/04_integration/10_managed-runtime.ts +129 -0
- package/ai-docs/src/04_integration/index.md +5 -0
- package/ai-docs/src/05_batching/10_request-resolver.ts +89 -0
- package/ai-docs/src/05_batching/index.md +3 -0
- package/ai-docs/src/06_schedule/10_schedules.ts +110 -0
- package/ai-docs/src/06_schedule/index.md +3 -0
- package/ai-docs/src/07_datetime/10_creating-and-formatting.ts +30 -0
- package/ai-docs/src/07_datetime/20_time-zones.ts +44 -0
- package/ai-docs/src/07_datetime/index.md +5 -0
- package/ai-docs/src/08_observability/10_logging.ts +66 -0
- package/ai-docs/src/08_observability/20_otlp-tracing.ts +95 -0
- package/ai-docs/src/08_observability/index.md +7 -0
- package/ai-docs/src/09_testing/10_effect-tests.ts +55 -0
- package/ai-docs/src/09_testing/20_layer-tests.ts +138 -0
- package/ai-docs/src/09_testing/index.md +1 -0
- package/ai-docs/src/10_predicate/01_basics.ts +14 -0
- package/ai-docs/src/10_predicate/index.md +9 -0
- package/ai-docs/src/50_http-client/10_basics.ts +102 -0
- package/ai-docs/src/50_http-client/index.md +3 -0
- package/ai-docs/src/51_http-server/10_basics.ts +116 -0
- package/ai-docs/src/51_http-server/fixtures/api/Api.ts +14 -0
- package/ai-docs/src/51_http-server/fixtures/api/Authorization.ts +36 -0
- package/ai-docs/src/51_http-server/fixtures/api/System.ts +10 -0
- package/ai-docs/src/51_http-server/fixtures/api/Users.ts +91 -0
- package/ai-docs/src/51_http-server/fixtures/domain/User.ts +12 -0
- package/ai-docs/src/51_http-server/fixtures/domain/UserErrors.ts +22 -0
- package/ai-docs/src/51_http-server/fixtures/server/Authorization.ts +36 -0
- package/ai-docs/src/51_http-server/fixtures/server/Users/http.ts +71 -0
- package/ai-docs/src/51_http-server/fixtures/server/Users.ts +62 -0
- package/ai-docs/src/51_http-server/index.md +3 -0
- package/ai-docs/src/60_child-process/10_working-with-child-processes.ts +117 -0
- package/ai-docs/src/60_child-process/index.md +3 -0
- package/ai-docs/src/70_cli/10_basics.ts +136 -0
- package/ai-docs/src/70_cli/index.md +5 -0
- package/ai-docs/src/71_ai/10_language-model.ts +156 -0
- package/ai-docs/src/71_ai/20_tools.ts +226 -0
- package/ai-docs/src/71_ai/30_chat.ts +158 -0
- package/ai-docs/src/71_ai/fixtures/domain/LaunchPlan.ts +9 -0
- package/ai-docs/src/71_ai/index.md +5 -0
- package/ai-docs/src/80_cluster/10_entities.ts +97 -0
- package/ai-docs/src/80_cluster/index.md +4 -0
- package/ai-docs/src/index.md +10 -0
- package/ai-docs/tsconfig.json +24 -0
- package/dist/Array.d.ts +971 -1037
- package/dist/Array.d.ts.map +1 -1
- package/dist/Array.js +463 -413
- 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.d.ts +3 -3
- package/dist/Brand.d.ts.map +1 -1
- package/dist/Brand.js +4 -3
- package/dist/Brand.js.map +1 -1
- package/dist/Cache.d.ts +409 -256
- package/dist/Cache.d.ts.map +1 -1
- package/dist/Cache.js +213 -134
- 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 +756 -769
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js +588 -449
- 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 +226 -174
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +361 -267
- package/dist/Config.js.map +1 -1
- package/dist/ConfigProvider.d.ts +229 -71
- package/dist/ConfigProvider.d.ts.map +1 -1
- package/dist/ConfigProvider.js +164 -95
- 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 +153 -277
- package/dist/Context.d.ts.map +1 -1
- package/dist/Context.js +172 -236
- package/dist/Context.js.map +1 -1
- package/dist/Cron.d.ts +144 -176
- package/dist/Cron.d.ts.map +1 -1
- package/dist/Cron.js +227 -162
- 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 +22 -15
- 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 +18 -24
- 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 +110 -98
- 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 +157 -188
- package/dist/Duration.js.map +1 -1
- package/dist/Effect.d.ts +3142 -3345
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +1452 -1570
- 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 +39 -23
- 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 +86 -55
- package/dist/ExecutionPlan.d.ts.map +1 -1
- package/dist/ExecutionPlan.js +8 -29
- 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 +83 -147
- 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 +109 -75
- 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 +86 -60
- package/dist/FiberSet.js.map +1 -1
- package/dist/FileSystem.d.ts +154 -265
- 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 +24 -32
- package/dist/Formatter.d.ts.map +1 -1
- package/dist/Formatter.js +55 -60
- package/dist/Formatter.js.map +1 -1
- package/dist/Function.d.ts +106 -148
- package/dist/Function.d.ts.map +1 -1
- package/dist/Function.js +81 -62
- package/dist/Function.js.map +1 -1
- package/dist/Graph.d.ts +1412 -775
- package/dist/Graph.d.ts.map +1 -1
- package/dist/Graph.js +1180 -561
- 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 +19 -18
- package/dist/Inspectable.d.ts.map +1 -1
- package/dist/Inspectable.js +20 -16
- 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 +282 -318
- 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 +46 -103
- 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 +319 -241
- 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 +202 -180
- 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 +208 -453
- package/dist/Logger.js.map +1 -1
- package/dist/ManagedRuntime.d.ts +16 -5
- package/dist/ManagedRuntime.d.ts.map +1 -1
- package/dist/ManagedRuntime.js +10 -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 +202 -645
- 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 +63 -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 +132 -210
- package/dist/Optic.d.ts.map +1 -1
- package/dist/Optic.js +221 -324
- 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 +213 -393
- 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.d.ts.map +1 -1
- package/dist/PartitionedSemaphore.js +1 -4
- 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 +166 -138
- 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 +361 -466
- package/dist/Record.d.ts.map +1 -1
- package/dist/Record.js +163 -216
- 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 -213
- package/dist/References.d.ts.map +1 -1
- package/dist/References.js +102 -213
- 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 +25 -19
- 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 +135 -218
- 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 +292 -1638
- package/dist/Schedule.d.ts.map +1 -1
- package/dist/Schedule.js +164 -805
- 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 +2056 -1269
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +2869 -1136
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +64 -72
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +698 -468
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaGetter.d.ts +236 -188
- package/dist/SchemaGetter.d.ts.map +1 -1
- package/dist/SchemaGetter.js +281 -234
- package/dist/SchemaGetter.js.map +1 -1
- package/dist/SchemaIssue.d.ts +219 -190
- package/dist/SchemaIssue.d.ts.map +1 -1
- package/dist/SchemaIssue.js +303 -309
- package/dist/SchemaIssue.js.map +1 -1
- package/dist/SchemaParser.d.ts +32 -2
- package/dist/SchemaParser.d.ts.map +1 -1
- package/dist/SchemaParser.js +170 -118
- package/dist/SchemaParser.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +433 -1511
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +301 -2854
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts +117 -77
- package/dist/SchemaTransformation.d.ts.map +1 -1
- package/dist/SchemaTransformation.js +139 -104
- 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 +1 -1
- package/dist/ScopedCache.js.map +1 -1
- package/dist/ScopedRef.d.ts +3 -3
- package/dist/ScopedRef.d.ts.map +1 -1
- package/dist/ScopedRef.js +2 -2
- package/dist/ScopedRef.js.map +1 -1
- package/dist/Semaphore.d.ts +101 -13
- 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 +118 -108
- 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 +18 -5
- package/dist/Stdio.d.ts.map +1 -1
- package/dist/Stdio.js +6 -3
- package/dist/Stdio.js.map +1 -1
- package/dist/Stream.d.ts +2467 -2962
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +1154 -1413
- 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 +46 -54
- 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 +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 +2 -2
- 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 +98 -131
- 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 +161 -137
- package/dist/TxQueue.js.map +1 -1
- package/dist/TxReentrantLock.d.ts +89 -114
- package/dist/TxReentrantLock.d.ts.map +1 -1
- package/dist/TxReentrantLock.js +75 -53
- 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 +127 -70
- 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.d.ts +0 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -8
- package/dist/index.js.map +1 -1
- package/dist/internal/array.js.map +1 -1
- package/dist/internal/core.js +4 -3
- package/dist/internal/core.js.map +1 -1
- package/dist/internal/dateTime.js +5 -1
- package/dist/internal/dateTime.js.map +1 -1
- package/dist/internal/doNotation.js.map +1 -1
- package/dist/internal/effect.js +261 -111
- 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 +52 -3
- package/dist/internal/executionPlan.js.map +1 -1
- package/dist/internal/hashMap.js +12 -8
- 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 +2 -2
- 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 +18 -13
- package/dist/internal/rcRef.js.map +1 -1
- package/dist/internal/record.d.ts +0 -3
- package/dist/internal/record.d.ts.map +1 -1
- package/dist/internal/record.js +10 -5
- package/dist/internal/record.js.map +1 -1
- package/dist/internal/redacted.js.map +1 -1
- package/dist/internal/references.js +3 -4
- 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 +15 -1
- package/dist/internal/schema/annotations.js.map +1 -1
- package/dist/internal/schema/cause.js.map +1 -1
- package/dist/internal/schema/fromJsonSchemaDocument.d.ts +2 -0
- package/dist/internal/schema/fromJsonSchemaDocument.d.ts.map +1 -0
- package/dist/internal/schema/fromJsonSchemaDocument.js +761 -0
- package/dist/internal/schema/fromJsonSchemaDocument.js.map +1 -0
- package/dist/internal/schema/fromRepresentation.d.ts +2 -0
- package/dist/internal/schema/fromRepresentation.d.ts.map +1 -0
- package/dist/internal/schema/fromRepresentation.js +245 -0
- package/dist/internal/schema/fromRepresentation.js.map +1 -0
- 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 +29 -49
- package/dist/internal/schema/schema.js.map +1 -1
- package/dist/internal/schema/toArbitrary.d.ts +2 -0
- package/dist/internal/schema/toArbitrary.d.ts.map +1 -0
- package/dist/internal/schema/{arbitrary.js → toArbitrary.js} +8 -83
- package/dist/internal/schema/toArbitrary.js.map +1 -0
- package/dist/internal/schema/toCodeDocument.d.ts +2 -0
- package/dist/internal/schema/toCodeDocument.d.ts.map +1 -0
- package/dist/internal/schema/toCodeDocument.js +438 -0
- package/dist/internal/schema/toCodeDocument.js.map +1 -0
- package/dist/internal/schema/toEquivalence.d.ts +2 -0
- package/dist/internal/schema/toEquivalence.d.ts.map +1 -0
- package/dist/internal/schema/{equivalence.js → toEquivalence.js} +15 -13
- package/dist/internal/schema/toEquivalence.js.map +1 -0
- package/dist/internal/schema/toJsonSchemaDocument.d.ts +2 -0
- package/dist/internal/schema/toJsonSchemaDocument.d.ts.map +1 -0
- package/dist/internal/schema/toJsonSchemaDocument.js +522 -0
- package/dist/internal/schema/toJsonSchemaDocument.js.map +1 -0
- package/dist/internal/schema/toRepresentation.d.ts +2 -0
- package/dist/internal/schema/toRepresentation.d.ts.map +1 -0
- package/dist/internal/schema/toRepresentation.js +351 -0
- package/dist/internal/schema/toRepresentation.js.map +1 -0
- package/dist/internal/stackTraceLimit.js +3 -6
- 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 +24 -10
- 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 +65 -20
- 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 +31 -31
- package/dist/testing/TestSchema.d.ts.map +1 -1
- package/dist/testing/TestSchema.js +35 -34
- package/dist/testing/TestSchema.js.map +1 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/unstable/ai/AiError.d.ts +121 -144
- package/dist/unstable/ai/AiError.d.ts.map +1 -1
- package/dist/unstable/ai/AiError.js +118 -140
- package/dist/unstable/ai/AiError.js.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts +22 -7
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.js +87 -317
- 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 +56 -52
- package/dist/unstable/ai/Chat.js.map +1 -1
- package/dist/unstable/ai/EmbeddingModel.d.ts +1 -1
- package/dist/unstable/ai/EmbeddingModel.js +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 +111 -68
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/ai/LanguageModel.js +127 -83
- 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 +198 -132
- package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
- package/dist/unstable/ai/McpSchema.js +79 -71
- package/dist/unstable/ai/McpSchema.js.map +1 -1
- package/dist/unstable/ai/McpServer.d.ts +71 -62
- package/dist/unstable/ai/McpServer.d.ts.map +1 -1
- package/dist/unstable/ai/McpServer.js +777 -245
- 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 +33 -11
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js +194 -378
- package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Prompt.d.ts +131 -44
- package/dist/unstable/ai/Prompt.d.ts.map +1 -1
- package/dist/unstable/ai/Prompt.js +100 -36
- package/dist/unstable/ai/Prompt.js.map +1 -1
- package/dist/unstable/ai/Response.d.ts +47 -33
- package/dist/unstable/ai/Response.d.ts.map +1 -1
- package/dist/unstable/ai/Response.js +23 -18
- 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 +63 -44
- package/dist/unstable/ai/Tool.d.ts.map +1 -1
- package/dist/unstable/ai/Tool.js +70 -55
- package/dist/unstable/ai/Tool.js.map +1 -1
- package/dist/unstable/ai/Toolkit.d.ts +35 -9
- package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
- package/dist/unstable/ai/Toolkit.js +32 -14
- 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 +15 -12
- 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.d.ts +2 -0
- package/dist/unstable/ai/internal/structured-output.d.ts.map +1 -0
- package/dist/unstable/ai/internal/structured-output.js +315 -0
- package/dist/unstable/ai/internal/structured-output.js.map +1 -0
- package/dist/unstable/cli/Argument.d.ts +279 -72
- package/dist/unstable/cli/Argument.d.ts.map +1 -1
- package/dist/unstable/cli/Argument.js +113 -34
- package/dist/unstable/cli/Argument.js.map +1 -1
- package/dist/unstable/cli/CliConfig.d.ts +76 -0
- package/dist/unstable/cli/CliConfig.d.ts.map +1 -0
- package/dist/unstable/cli/CliConfig.js +63 -0
- package/dist/unstable/cli/CliConfig.js.map +1 -0
- package/dist/unstable/cli/CliError.d.ts +126 -76
- package/dist/unstable/cli/CliError.d.ts.map +1 -1
- package/dist/unstable/cli/CliError.js +138 -75
- 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 +765 -109
- package/dist/unstable/cli/Command.d.ts.map +1 -1
- package/dist/unstable/cli/Command.js +335 -52
- 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 +24 -3
- package/dist/unstable/cli/GlobalFlag.d.ts.map +1 -1
- package/dist/unstable/cli/GlobalFlag.js +20 -4
- 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 +299 -83
- package/dist/unstable/cli/Param.d.ts.map +1 -1
- package/dist/unstable/cli/Param.js +152 -62
- 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 +377 -162
- 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 +54 -31
- package/dist/unstable/cli/Prompt.js.map +1 -1
- package/dist/unstable/cli/index.d.ts +4 -0
- package/dist/unstable/cli/index.d.ts.map +1 -1
- package/dist/unstable/cli/index.js +4 -0
- package/dist/unstable/cli/index.js.map +1 -1
- package/dist/unstable/cli/internal/ansi.d.ts.map +1 -1
- package/dist/unstable/cli/internal/ansi.js +4 -2
- 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.d.ts +5 -3
- package/dist/unstable/cli/internal/command.d.ts.map +1 -1
- package/dist/unstable/cli/internal/command.js +21 -13
- package/dist/unstable/cli/internal/command.js.map +1 -1
- package/dist/unstable/cli/internal/completions/bash.js +69 -9
- package/dist/unstable/cli/internal/completions/bash.js.map +1 -1
- package/dist/unstable/cli/internal/completions/descriptor.js +24 -18
- package/dist/unstable/cli/internal/completions/descriptor.js.map +1 -1
- package/dist/unstable/cli/internal/completions/fish.js +5 -5
- 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.d.ts +0 -48
- package/dist/unstable/cli/internal/config.d.ts.map +1 -1
- package/dist/unstable/cli/internal/config.js +8 -10
- package/dist/unstable/cli/internal/config.js.map +1 -1
- package/dist/unstable/cli/internal/help.d.ts.map +1 -1
- package/dist/unstable/cli/internal/help.js +4 -2
- 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 +16 -7
- package/dist/unstable/cli/internal/parser.js.map +1 -1
- package/dist/unstable/cli/internal/wizard.d.ts +13 -0
- package/dist/unstable/cli/internal/wizard.d.ts.map +1 -0
- package/dist/unstable/cli/internal/wizard.js +212 -0
- package/dist/unstable/cli/internal/wizard.js.map +1 -0
- package/dist/unstable/cluster/ClusterCron.js.map +1 -1
- package/dist/unstable/cluster/ClusterError.js +7 -7
- 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 +32 -16
- 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 +12 -12
- package/dist/unstable/cluster/Entity.d.ts.map +1 -1
- package/dist/unstable/cluster/Entity.js +9 -9
- 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 +7 -5
- package/dist/unstable/cluster/EntityProxy.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityProxy.js +8 -5
- 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.d.ts.map +1 -1
- package/dist/unstable/cluster/Envelope.js +5 -4
- 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.d.ts.map +1 -1
- package/dist/unstable/cluster/MessageStorage.js +13 -6
- package/dist/unstable/cluster/MessageStorage.js.map +1 -1
- package/dist/unstable/cluster/Reply.d.ts +8 -0
- package/dist/unstable/cluster/Reply.d.ts.map +1 -1
- package/dist/unstable/cluster/Reply.js +17 -5
- package/dist/unstable/cluster/Reply.js.map +1 -1
- package/dist/unstable/cluster/Runner.d.ts +1 -1
- package/dist/unstable/cluster/Runner.js +1 -1
- package/dist/unstable/cluster/Runner.js.map +1 -1
- package/dist/unstable/cluster/RunnerAddress.d.ts +1 -1
- package/dist/unstable/cluster/RunnerAddress.js +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 +29 -23
- package/dist/unstable/cluster/RunnerServer.js.map +1 -1
- package/dist/unstable/cluster/RunnerStorage.d.ts +3 -4
- package/dist/unstable/cluster/RunnerStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerStorage.js +9 -8
- package/dist/unstable/cluster/RunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/Runners.d.ts +11 -15
- package/dist/unstable/cluster/Runners.d.ts.map +1 -1
- package/dist/unstable/cluster/Runners.js +32 -22
- package/dist/unstable/cluster/Runners.js.map +1 -1
- package/dist/unstable/cluster/ShardId.js +1 -1
- package/dist/unstable/cluster/ShardId.js.map +1 -1
- package/dist/unstable/cluster/Sharding.d.ts +2 -2
- package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
- package/dist/unstable/cluster/Sharding.js +164 -31
- package/dist/unstable/cluster/Sharding.js.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.d.ts +13 -5
- package/dist/unstable/cluster/ShardingConfig.d.ts.map +1 -1
- 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.d.ts +4 -2
- package/dist/unstable/cluster/SingleRunner.d.ts.map +1 -1
- package/dist/unstable/cluster/SingleRunner.js +2 -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.d.ts +7 -4
- package/dist/unstable/cluster/SqlMessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.js +56 -25
- 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 +141 -79
- 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 +25 -13
- 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 +2 -2
- package/dist/unstable/cluster/internal/resourceMap.js.map +1 -1
- package/dist/unstable/cluster/internal/resourceRef.js +17 -0
- package/dist/unstable/cluster/internal/resourceRef.js.map +1 -1
- package/dist/unstable/cluster/internal/shardLock.d.ts +2 -0
- package/dist/unstable/cluster/internal/shardLock.d.ts.map +1 -0
- package/dist/unstable/cluster/internal/shardLock.js +4 -0
- package/dist/unstable/cluster/internal/shardLock.js.map +1 -0
- package/dist/unstable/devtools/DevTools.js.map +1 -1
- package/dist/unstable/devtools/DevToolsClient.d.ts.map +1 -1
- package/dist/unstable/devtools/DevToolsClient.js +7 -2
- package/dist/unstable/devtools/DevToolsClient.js.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.d.ts +20 -20
- package/dist/unstable/devtools/DevToolsSchema.d.ts.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.js +8 -5
- 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/Ini.d.ts +20 -0
- package/dist/unstable/encoding/Ini.d.ts.map +1 -0
- package/dist/unstable/encoding/Ini.js +153 -0
- package/dist/unstable/encoding/Ini.js.map +1 -0
- package/dist/unstable/encoding/Msgpack.d.ts +2 -1
- package/dist/unstable/encoding/Msgpack.d.ts.map +1 -1
- package/dist/unstable/encoding/Msgpack.js +31 -19
- package/dist/unstable/encoding/Msgpack.js.map +1 -1
- package/dist/unstable/encoding/Ndjson.d.ts.map +1 -1
- package/dist/unstable/encoding/Ndjson.js +7 -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 +72 -31
- package/dist/unstable/encoding/Sse.js.map +1 -1
- package/dist/unstable/encoding/Toml.d.ts +19 -0
- package/dist/unstable/encoding/Toml.d.ts.map +1 -0
- package/dist/unstable/encoding/Toml.js +434 -0
- package/dist/unstable/encoding/Toml.js.map +1 -0
- package/dist/unstable/encoding/Yaml.d.ts +19 -0
- package/dist/unstable/encoding/Yaml.d.ts.map +1 -0
- package/dist/unstable/encoding/Yaml.js +461 -0
- package/dist/unstable/encoding/Yaml.js.map +1 -0
- package/dist/unstable/encoding/index.d.ts +12 -0
- package/dist/unstable/encoding/index.d.ts.map +1 -1
- package/dist/unstable/encoding/index.js +12 -0
- 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 +17 -17
- package/dist/unstable/eventlog/EventJournal.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventJournal.js +27 -19
- package/dist/unstable/eventlog/EventJournal.js.map +1 -1
- package/dist/unstable/eventlog/EventLog.d.ts +3 -3
- package/dist/unstable/eventlog/EventLog.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLog.js +18 -14
- package/dist/unstable/eventlog/EventLog.js.map +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.d.ts +8 -7
- package/dist/unstable/eventlog/EventLogEncryption.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.js +16 -14
- package/dist/unstable/eventlog/EventLogEncryption.js.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.d.ts +31 -31
- package/dist/unstable/eventlog/EventLogMessage.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.js +12 -8
- package/dist/unstable/eventlog/EventLogMessage.js.map +1 -1
- package/dist/unstable/eventlog/EventLogRemote.d.ts +15 -15
- package/dist/unstable/eventlog/EventLogRemote.js +5 -5
- 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 +16 -7
- 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 +15 -7
- 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.d.ts.map +1 -1
- package/dist/unstable/eventlog/SqlEventJournal.js +3 -6
- package/dist/unstable/eventlog/SqlEventJournal.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js +3 -3
- 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 +54 -40
- 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/FindMyWay/internal/queryString.d.ts +11 -0
- package/dist/unstable/http/FindMyWay/internal/queryString.d.ts.map +1 -0
- package/dist/unstable/http/FindMyWay/internal/queryString.js +259 -0
- package/dist/unstable/http/FindMyWay/internal/queryString.js.map +1 -0
- package/dist/unstable/http/FindMyWay/internal/router.d.ts +2 -0
- package/dist/unstable/http/FindMyWay/internal/router.d.ts.map +1 -0
- package/dist/unstable/http/FindMyWay/internal/router.js +665 -0
- package/dist/unstable/http/FindMyWay/internal/router.js.map +1 -0
- package/dist/unstable/http/FindMyWay.d.ts +33 -8
- package/dist/unstable/http/FindMyWay.d.ts.map +1 -1
- package/dist/unstable/http/FindMyWay.js +4 -7
- package/dist/unstable/http/FindMyWay.js.map +1 -1
- package/dist/unstable/http/Headers.d.ts +2 -2
- package/dist/unstable/http/Headers.js +10 -10
- 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 +110 -47
- package/dist/unstable/http/HttpClient.d.ts.map +1 -1
- package/dist/unstable/http/HttpClient.js +79 -36
- package/dist/unstable/http/HttpClient.js.map +1 -1
- package/dist/unstable/http/HttpClientError.js +1 -1
- package/dist/unstable/http/HttpClientError.js.map +1 -1
- package/dist/unstable/http/HttpClientRequest.d.ts +44 -0
- package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientRequest.js +16 -12
- package/dist/unstable/http/HttpClientRequest.js.map +1 -1
- package/dist/unstable/http/HttpClientResponse.d.ts +4 -4
- package/dist/unstable/http/HttpClientResponse.js +3 -18
- package/dist/unstable/http/HttpClientResponse.js.map +1 -1
- package/dist/unstable/http/HttpEffect.d.ts +7 -9
- package/dist/unstable/http/HttpEffect.d.ts.map +1 -1
- package/dist/unstable/http/HttpEffect.js +7 -8
- 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 +53 -3
- package/dist/unstable/http/HttpPlatform.js.map +1 -1
- package/dist/unstable/http/HttpRouter.d.ts +91 -92
- 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.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRequest.js +23 -15
- 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 +17 -5
- 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 +28 -9
- package/dist/unstable/http/Multipart.d.ts.map +1 -1
- package/dist/unstable/http/Multipart.js +68 -36
- package/dist/unstable/http/Multipart.js.map +1 -1
- package/dist/unstable/http/MultipartParser/HeadersParser.d.ts +53 -0
- package/dist/unstable/http/MultipartParser/HeadersParser.d.ts.map +1 -0
- package/dist/unstable/http/MultipartParser/HeadersParser.js +14 -0
- package/dist/unstable/http/MultipartParser/HeadersParser.js.map +1 -0
- package/dist/unstable/http/MultipartParser/Search.d.ts +11 -0
- package/dist/unstable/http/MultipartParser/Search.d.ts.map +1 -0
- package/dist/unstable/http/MultipartParser/Search.js +14 -0
- package/dist/unstable/http/MultipartParser/Search.js.map +1 -0
- package/dist/unstable/http/MultipartParser/internal/contentType.d.ts +5 -0
- package/dist/unstable/http/MultipartParser/internal/contentType.d.ts.map +1 -0
- package/dist/unstable/http/MultipartParser/internal/contentType.js +82 -0
- package/dist/unstable/http/MultipartParser/internal/contentType.js.map +1 -0
- package/dist/unstable/http/MultipartParser/internal/headers.d.ts +3 -0
- package/dist/unstable/http/MultipartParser/internal/headers.d.ts.map +1 -0
- package/dist/unstable/http/MultipartParser/internal/headers.js +208 -0
- package/dist/unstable/http/MultipartParser/internal/headers.js.map +1 -0
- package/dist/unstable/http/MultipartParser/internal/multipart.d.ts +8 -0
- package/dist/unstable/http/MultipartParser/internal/multipart.d.ts.map +1 -0
- package/dist/unstable/http/MultipartParser/internal/multipart.js +241 -0
- package/dist/unstable/http/MultipartParser/internal/multipart.js.map +1 -0
- package/dist/unstable/http/MultipartParser/internal/search.d.ts +5 -0
- package/dist/unstable/http/MultipartParser/internal/search.d.ts.map +1 -0
- package/dist/unstable/http/MultipartParser/internal/search.js +120 -0
- package/dist/unstable/http/MultipartParser/internal/search.js.map +1 -0
- package/dist/unstable/http/MultipartParser.d.ts +98 -0
- package/dist/unstable/http/MultipartParser.d.ts.map +1 -0
- package/dist/unstable/http/MultipartParser.js +23 -0
- package/dist/unstable/http/MultipartParser.js.map +1 -0
- package/dist/unstable/http/Template.d.ts.map +1 -1
- package/dist/unstable/http/Template.js +3 -3
- 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 +26 -31
- package/dist/unstable/http/UrlParams.js.map +1 -1
- package/dist/unstable/http/index.d.ts +1 -1
- package/dist/unstable/http/index.d.ts.map +1 -1
- package/dist/unstable/http/index.js +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/httpBody.d.ts +2 -0
- package/dist/unstable/http/internal/httpBody.d.ts.map +1 -0
- package/dist/unstable/http/internal/httpBody.js +10 -0
- package/dist/unstable/http/internal/httpBody.js.map +1 -0
- package/dist/unstable/http/internal/preResponseHandler.js.map +1 -1
- package/dist/unstable/httpapi/HttpApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApi.js +9 -9
- package/dist/unstable/httpapi/HttpApi.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts +2 -2
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.js +82 -30
- 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 +89 -51
- package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +48 -46
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.js +73 -16
- package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.d.ts +18 -18
- package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.js +30 -30
- package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.d.ts +15 -15
- package/dist/unstable/httpapi/HttpApiGroup.js +2 -2
- 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 +225 -6
- package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.js +174 -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 +21 -13
- package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/OpenApi.js +110 -57
- 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 +71 -2
- package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpExporter.js +86 -7
- package/dist/unstable/observability/OtlpExporter.js.map +1 -1
- package/dist/unstable/observability/OtlpLogger.d.ts +4 -3
- package/dist/unstable/observability/OtlpLogger.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpLogger.js +4 -4
- package/dist/unstable/observability/OtlpLogger.js.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.d.ts +11 -4
- package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.js +31 -15
- 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.d.ts +4 -3
- package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpTracer.js +3 -3
- 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.d.ts.map +1 -1
- package/dist/unstable/persistence/Persistable.js +2 -1
- 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.d.ts.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.js +15 -15
- 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 +108 -22
- package/dist/unstable/persistence/Persistence.js.map +1 -1
- package/dist/unstable/persistence/RateLimiter.d.ts +47 -26
- package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
- package/dist/unstable/persistence/RateLimiter.js +31 -47
- package/dist/unstable/persistence/RateLimiter.js.map +1 -1
- package/dist/unstable/persistence/Redis.d.ts +2 -2
- package/dist/unstable/persistence/Redis.d.ts.map +1 -1
- package/dist/unstable/persistence/Redis.js +9 -7
- 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 +72 -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 +4 -2
- 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 +14 -13
- package/dist/unstable/reactivity/AsyncResult.js.map +1 -1
- package/dist/unstable/reactivity/Atom.d.ts +131 -30
- package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.js +53 -34
- 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 +25 -4
- 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 +26 -12
- package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClient.js +40 -22
- package/dist/unstable/rpc/RpcClient.js.map +1 -1
- package/dist/unstable/rpc/RpcClientError.js +2 -2
- 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 +177 -96
- package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
- package/dist/unstable/rpc/RpcServer.d.ts +13 -13
- package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcServer.js +20 -15
- 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 +53 -51
- 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 +11 -12
- package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
- package/dist/unstable/schema/VariantSchema.js +28 -17
- 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 +12 -4
- package/dist/unstable/socket/Socket.d.ts.map +1 -1
- package/dist/unstable/socket/Socket.js +38 -17
- 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.d.ts +9 -1
- package/dist/unstable/sql/Migrator.d.ts.map +1 -1
- package/dist/unstable/sql/Migrator.js +15 -2
- package/dist/unstable/sql/Migrator.js.map +1 -1
- package/dist/unstable/sql/SqlClient.d.ts +2 -3
- package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
- package/dist/unstable/sql/SqlClient.js +8 -4
- package/dist/unstable/sql/SqlClient.js.map +1 -1
- package/dist/unstable/sql/SqlConnection.js.map +1 -1
- package/dist/unstable/sql/SqlError.d.ts +2 -2
- package/dist/unstable/sql/SqlError.js +15 -15
- 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.d.ts.map +1 -1
- package/dist/unstable/sql/SqlResolver.js +30 -24
- 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.d.ts.map +1 -1
- package/dist/unstable/sql/Statement.js +30 -27
- 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.d.ts.map +1 -1
- package/dist/unstable/workers/Worker.js +13 -14
- package/dist/unstable/workers/Worker.js.map +1 -1
- package/dist/unstable/workers/WorkerError.d.ts +7 -7
- package/dist/unstable/workers/WorkerError.js +11 -11
- 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.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.js +13 -8
- 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 +26 -3
- package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js +72 -6
- 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 +12 -16
- package/src/Array.ts +1069 -1071
- package/src/BigDecimal.ts +433 -756
- package/src/BigInt.ts +213 -269
- package/src/Boolean.ts +146 -188
- package/src/Brand.ts +4 -4
- package/src/Cache.ts +469 -851
- package/src/Cause.ts +167 -277
- package/src/Channel.ts +982 -831
- 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 +642 -335
- package/src/ConfigProvider.ts +267 -135
- package/src/Console.ts +289 -39
- package/src/Context.ts +323 -404
- package/src/Cron.ts +271 -219
- package/src/Crypto.ts +30 -23
- package/src/Data.ts +63 -82
- package/src/DateTime.ts +564 -660
- package/src/Deferred.ts +259 -258
- package/src/Duration.ts +244 -311
- package/src/Effect.ts +3215 -3394
- package/src/Encoding.ts +22 -40
- package/src/Equal.ts +59 -41
- package/src/Equivalence.ts +103 -105
- package/src/ErrorReporter.ts +51 -27
- package/src/ExecutionPlan.ts +91 -56
- package/src/Exit.ts +116 -192
- package/src/Fiber.ts +82 -149
- package/src/FiberHandle.ts +155 -107
- package/src/FiberMap.ts +225 -174
- package/src/FiberSet.ts +125 -83
- package/src/FileSystem.ts +156 -264
- package/src/Filter.ts +61 -33
- package/src/Formatter.ts +69 -76
- package/src/Function.ts +119 -151
- package/src/Graph.ts +3258 -1102
- 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 +22 -20
- package/src/Iterable.ts +665 -799
- package/src/JsonPatch.ts +60 -113
- package/src/JsonPointer.ts +8 -8
- package/src/JsonSchema.ts +408 -251
- package/src/Latch.ts +23 -35
- package/src/Layer.ts +366 -265
- package/src/LayerMap.ts +49 -29
- package/src/LayerRef.ts +6 -2
- package/src/LogLevel.ts +114 -214
- package/src/Logger.ts +348 -700
- package/src/ManagedRuntime.ts +20 -5
- package/src/Match.ts +217 -252
- package/src/Metric.ts +520 -1092
- package/src/MutableHashMap.ts +218 -255
- package/src/MutableHashSet.ts +84 -89
- package/src/MutableList.ts +77 -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 +303 -441
- package/src/Option.ts +449 -813
- package/src/Order.ts +109 -109
- package/src/Ordering.ts +20 -23
- package/src/PartitionedSemaphore.ts +1 -4
- 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 +204 -165
- package/src/Random.ts +49 -74
- package/src/RcMap.ts +121 -63
- package/src/RcRef.ts +24 -13
- package/src/Record.ts +387 -487
- 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 -214
- package/src/RegExp.ts +10 -14
- package/src/Request.ts +36 -28
- package/src/RequestResolver.ts +202 -91
- package/src/Result.ts +314 -485
- package/src/Runtime.ts +50 -75
- package/src/Schedule.ts +311 -1737
- package/src/Scheduler.ts +20 -7
- package/src/Schema.ts +3476 -1914
- package/src/SchemaAST.ts +902 -573
- package/src/SchemaGetter.ts +351 -233
- package/src/SchemaIssue.ts +367 -334
- package/src/SchemaParser.ts +254 -148
- package/src/SchemaRepresentation.ts +732 -3414
- package/src/SchemaTransformation.ts +186 -97
- package/src/Scope.ts +123 -151
- package/src/ScopedCache.ts +1 -1
- package/src/ScopedRef.ts +6 -4
- package/src/Semaphore.ts +157 -54
- package/src/Sink.ts +129 -114
- package/src/Stdio.ts +24 -5
- package/src/Stream.ts +2745 -3173
- package/src/String.ts +275 -312
- package/src/Struct.ts +114 -118
- package/src/SubscriptionRef.ts +284 -252
- package/src/Symbol.ts +3 -3
- package/src/SynchronizedRef.ts +1 -1
- package/src/Terminal.ts +3 -3
- package/src/Tracer.ts +102 -55
- package/src/Trie.ts +287 -679
- package/src/Tuple.ts +99 -131
- 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 +215 -184
- package/src/TxReentrantLock.ts +136 -101
- package/src/TxRef.ts +51 -32
- package/src/TxSemaphore.ts +129 -95
- package/src/TxSubscriptionRef.ts +97 -70
- package/src/Types.ts +127 -70
- package/src/Unify.ts +45 -65
- package/src/Utils.ts +23 -16
- package/src/index.ts +0 -10
- package/src/internal/core.ts +6 -5
- package/src/internal/dateTime.ts +7 -1
- package/src/internal/effect.ts +313 -137
- package/src/internal/executionPlan.ts +106 -10
- package/src/internal/hashMap.ts +20 -14
- package/src/internal/matcher.ts +3 -3
- package/src/internal/persistence.ts +2 -0
- package/src/internal/rcRef.ts +24 -16
- package/src/internal/record.ts +11 -7
- package/src/internal/references.ts +3 -7
- package/src/internal/schedule.ts +4 -4
- package/src/internal/schema/annotations.ts +48 -1
- package/src/internal/schema/fromJsonSchemaDocument.ts +977 -0
- package/src/internal/schema/fromRepresentation.ts +339 -0
- package/src/internal/schema/parser.ts +22 -0
- package/src/internal/schema/schema.ts +46 -63
- package/src/internal/schema/{arbitrary.ts → toArbitrary.ts} +9 -81
- package/src/internal/schema/toCodeDocument.ts +572 -0
- package/src/internal/schema/{equivalence.ts → toEquivalence.ts} +12 -7
- package/src/internal/schema/toJsonSchemaDocument.ts +549 -0
- package/src/internal/schema/toRepresentation.ts +404 -0
- package/src/internal/stackTraceLimit.ts +3 -7
- package/src/internal/trie.ts +21 -12
- package/src/testing/FastCheck.ts +8 -7
- package/src/testing/TestClock.ts +86 -32
- package/src/testing/TestConsole.ts +32 -31
- package/src/testing/TestSchema.ts +40 -40
- package/src/unstable/ai/AiError.ts +119 -141
- package/src/unstable/ai/AnthropicStructuredOutput.ts +103 -334
- package/src/unstable/ai/Chat.ts +133 -98
- package/src/unstable/ai/EmbeddingModel.ts +1 -1
- package/src/unstable/ai/IdGenerator.ts +32 -28
- package/src/unstable/ai/LanguageModel.ts +141 -97
- package/src/unstable/ai/McpProtocol.ts +48 -0
- package/src/unstable/ai/McpSchema.ts +92 -81
- package/src/unstable/ai/McpServer.ts +1057 -303
- package/src/unstable/ai/Model.ts +9 -20
- package/src/unstable/ai/OpenAiStructuredOutput.ts +231 -396
- package/src/unstable/ai/Prompt.ts +212 -63
- package/src/unstable/ai/Response.ts +52 -38
- package/src/unstable/ai/Telemetry.ts +46 -13
- package/src/unstable/ai/Tokenizer.ts +14 -3
- package/src/unstable/ai/Tool.ts +94 -64
- package/src/unstable/ai/Toolkit.ts +45 -15
- package/src/unstable/ai/index.ts +5 -0
- package/src/unstable/ai/internal/codec-transformer.ts +13 -7
- 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 +453 -0
- package/src/unstable/cli/Argument.ts +279 -72
- package/src/unstable/cli/CliConfig.ts +85 -0
- package/src/unstable/cli/CliError.ts +161 -90
- package/src/unstable/cli/CliOutput.ts +44 -58
- package/src/unstable/cli/Command.ts +839 -123
- package/src/unstable/cli/Flag.ts +418 -138
- package/src/unstable/cli/GlobalFlag.ts +34 -6
- package/src/unstable/cli/HelpDoc.ts +12 -4
- package/src/unstable/cli/Param.ts +351 -103
- package/src/unstable/cli/Primitive.ts +383 -156
- package/src/unstable/cli/Prompt.ts +64 -34
- package/src/unstable/cli/index.ts +5 -0
- package/src/unstable/cli/internal/ansi.ts +5 -2
- package/src/unstable/cli/internal/command.ts +28 -15
- package/src/unstable/cli/internal/completions/bash.ts +59 -9
- package/src/unstable/cli/internal/completions/descriptor.ts +14 -20
- package/src/unstable/cli/internal/completions/fish.ts +5 -7
- package/src/unstable/cli/internal/config.ts +8 -10
- package/src/unstable/cli/internal/help.ts +4 -2
- package/src/unstable/cli/internal/lexer.ts +8 -2
- package/src/unstable/cli/internal/parser.ts +19 -7
- package/src/unstable/cli/internal/wizard.ts +283 -0
- package/src/unstable/cluster/ClusterError.ts +7 -7
- package/src/unstable/cluster/ClusterSchema.ts +8 -8
- package/src/unstable/cluster/ClusterWorkflowEngine.ts +36 -20
- package/src/unstable/cluster/Entity.ts +23 -19
- package/src/unstable/cluster/EntityProxy.ts +16 -7
- package/src/unstable/cluster/EntityResource.ts +2 -2
- package/src/unstable/cluster/Envelope.ts +5 -4
- package/src/unstable/cluster/HttpRunner.ts +6 -4
- package/src/unstable/cluster/Message.ts +9 -9
- package/src/unstable/cluster/MessageStorage.ts +24 -20
- package/src/unstable/cluster/Reply.ts +26 -7
- package/src/unstable/cluster/Runner.ts +1 -1
- package/src/unstable/cluster/RunnerAddress.ts +1 -1
- package/src/unstable/cluster/RunnerHealth.ts +1 -1
- package/src/unstable/cluster/RunnerServer.ts +45 -18
- package/src/unstable/cluster/RunnerStorage.ts +12 -10
- package/src/unstable/cluster/Runners.ts +48 -26
- package/src/unstable/cluster/ShardId.ts +1 -1
- package/src/unstable/cluster/Sharding.ts +223 -55
- package/src/unstable/cluster/ShardingConfig.ts +8 -4
- package/src/unstable/cluster/SingleRunner.ts +4 -2
- package/src/unstable/cluster/SingletonAddress.ts +1 -1
- package/src/unstable/cluster/Snowflake.ts +8 -8
- package/src/unstable/cluster/SqlMessageStorage.ts +84 -36
- package/src/unstable/cluster/SqlRunnerStorage.ts +223 -133
- package/src/unstable/cluster/internal/entityManager.ts +43 -26
- package/src/unstable/cluster/internal/resourceMap.ts +5 -2
- package/src/unstable/cluster/internal/resourceRef.ts +27 -5
- package/src/unstable/cluster/internal/shardLock.ts +9 -0
- package/src/unstable/devtools/DevToolsClient.ts +3 -2
- package/src/unstable/devtools/DevToolsSchema.ts +10 -5
- package/src/unstable/encoding/Ini.ts +174 -0
- package/src/unstable/encoding/Msgpack.ts +61 -40
- package/src/unstable/encoding/Ndjson.ts +9 -1
- package/src/unstable/encoding/Sse.ts +109 -37
- package/src/unstable/encoding/Toml.ts +504 -0
- package/src/unstable/encoding/Yaml.ts +541 -0
- package/src/unstable/encoding/index.ts +15 -0
- package/src/unstable/eventlog/Event.ts +20 -20
- package/src/unstable/eventlog/EventGroup.ts +4 -4
- package/src/unstable/eventlog/EventJournal.ts +30 -22
- package/src/unstable/eventlog/EventLog.ts +24 -14
- package/src/unstable/eventlog/EventLogEncryption.ts +17 -18
- package/src/unstable/eventlog/EventLogMessage.ts +15 -9
- package/src/unstable/eventlog/EventLogRemote.ts +5 -5
- package/src/unstable/eventlog/EventLogServer.ts +41 -7
- package/src/unstable/eventlog/EventLogServerEncrypted.ts +15 -7
- package/src/unstable/eventlog/EventLogServerUnencrypted.ts +15 -7
- package/src/unstable/eventlog/EventLogSessionAuth.ts +1 -1
- package/src/unstable/eventlog/SqlEventJournal.ts +8 -6
- package/src/unstable/eventlog/SqlEventLogServerEncrypted.ts +1 -1
- package/src/unstable/eventlog/SqlEventLogServerUnencrypted.ts +6 -3
- package/src/unstable/http/Cookies.ts +64 -45
- package/src/unstable/http/Etag.ts +1 -1
- package/src/unstable/http/FetchHttpClient.ts +3 -1
- package/src/unstable/http/FindMyWay/internal/queryString.ts +420 -0
- package/src/unstable/http/FindMyWay/internal/router.ts +950 -0
- package/src/unstable/http/FindMyWay.ts +65 -6
- package/src/unstable/http/Headers.ts +10 -10
- package/src/unstable/http/HttpBody.ts +20 -5
- package/src/unstable/http/HttpClient.ts +215 -78
- package/src/unstable/http/HttpClientError.ts +1 -1
- package/src/unstable/http/HttpClientRequest.ts +59 -12
- package/src/unstable/http/HttpClientResponse.ts +5 -21
- package/src/unstable/http/HttpEffect.ts +20 -19
- package/src/unstable/http/HttpMethod.ts +6 -9
- package/src/unstable/http/HttpMiddleware.ts +202 -39
- package/src/unstable/http/HttpPlatform.ts +129 -6
- package/src/unstable/http/HttpRouter.ts +109 -101
- package/src/unstable/http/HttpServer.ts +13 -13
- package/src/unstable/http/HttpServerError.ts +2 -2
- package/src/unstable/http/HttpServerRequest.ts +31 -17
- package/src/unstable/http/HttpServerResponse.ts +38 -6
- package/src/unstable/http/HttpStaticServer.ts +35 -7
- package/src/unstable/http/Multipart.ts +70 -37
- package/src/unstable/http/MultipartParser/HeadersParser.ts +68 -0
- package/src/unstable/http/MultipartParser/Search.ts +17 -0
- package/src/unstable/http/MultipartParser/internal/contentType.ts +103 -0
- package/src/unstable/http/MultipartParser/internal/headers.ts +244 -0
- package/src/unstable/http/MultipartParser/internal/multipart.ts +279 -0
- package/src/unstable/http/MultipartParser/internal/search.ts +167 -0
- package/src/unstable/http/MultipartParser.ts +115 -0
- package/src/unstable/http/Template.ts +7 -6
- package/src/unstable/http/Url.ts +33 -63
- package/src/unstable/http/UrlParams.ts +27 -32
- package/src/unstable/http/index.ts +1 -1
- package/src/unstable/http/internal/compression.ts +196 -0
- package/src/unstable/http/internal/httpBody.ts +15 -0
- package/src/unstable/httpapi/HttpApi.ts +10 -11
- package/src/unstable/httpapi/HttpApiBuilder.ts +155 -34
- package/src/unstable/httpapi/HttpApiClient.ts +142 -61
- package/src/unstable/httpapi/HttpApiEndpoint.ts +159 -71
- package/src/unstable/httpapi/HttpApiError.ts +46 -52
- package/src/unstable/httpapi/HttpApiGroup.ts +17 -17
- package/src/unstable/httpapi/HttpApiMiddleware.ts +71 -24
- package/src/unstable/httpapi/HttpApiScalar.ts +0 -12
- package/src/unstable/httpapi/HttpApiSchema.ts +359 -6
- package/src/unstable/httpapi/OpenApi.ts +153 -62
- package/src/unstable/observability/OtlpExporter.ts +130 -12
- package/src/unstable/observability/OtlpLogger.ts +8 -6
- package/src/unstable/observability/OtlpMetrics.ts +42 -21
- package/src/unstable/observability/OtlpResource.ts +26 -17
- package/src/unstable/observability/OtlpTracer.ts +9 -5
- 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 +11 -10
- package/src/unstable/persistence/PersistedQueue.ts +18 -15
- package/src/unstable/persistence/Persistence.ts +153 -26
- package/src/unstable/persistence/RateLimiter.ts +79 -45
- package/src/unstable/persistence/Redis.ts +14 -9
- package/src/unstable/process/ChildProcess.ts +72 -21
- package/src/unstable/process/ChildProcessSpawner.ts +22 -11
- package/src/unstable/reactivity/AsyncResult.ts +23 -18
- package/src/unstable/reactivity/Atom.ts +161 -47
- package/src/unstable/reactivity/AtomHttpApi.ts +5 -4
- package/src/unstable/reactivity/AtomRegistry.ts +25 -4
- 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 +65 -29
- package/src/unstable/rpc/RpcClientError.ts +2 -2
- 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 +22 -17
- package/src/unstable/rpc/RpcWorker.ts +5 -5
- package/src/unstable/schema/Model.ts +52 -50
- package/src/unstable/schema/VariantSchema.ts +51 -43
- package/src/unstable/socket/Socket.ts +42 -19
- package/src/unstable/sql/Migrator.ts +22 -9
- package/src/unstable/sql/SqlClient.ts +65 -58
- package/src/unstable/sql/SqlError.ts +15 -15
- package/src/unstable/sql/SqlModel.ts +2 -2
- package/src/unstable/sql/SqlResolver.ts +41 -31
- package/src/unstable/sql/Statement.ts +44 -37
- package/src/unstable/workers/Transferable.ts +1 -1
- package/src/unstable/workers/Worker.ts +15 -16
- package/src/unstable/workers/WorkerError.ts +12 -12
- 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 +18 -13
- package/src/unstable/workflow/DurableQueue.ts +22 -20
- package/src/unstable/workflow/Workflow.ts +23 -26
- package/src/unstable/workflow/WorkflowEngine.ts +111 -8
- package/src/unstable/workflow/WorkflowProxy.ts +4 -2
- package/dist/SchemaError.d.ts +0 -53
- package/dist/SchemaError.d.ts.map +0 -1
- package/dist/SchemaError.js +0 -61
- package/dist/SchemaError.js.map +0 -1
- package/dist/SchemaUtils.d.ts +0 -28
- package/dist/SchemaUtils.d.ts.map +0 -1
- package/dist/SchemaUtils.js +0 -45
- package/dist/SchemaUtils.js.map +0 -1
- package/dist/internal/schema/arbitrary.d.ts +0 -5
- package/dist/internal/schema/arbitrary.d.ts.map +0 -1
- package/dist/internal/schema/arbitrary.js.map +0 -1
- package/dist/internal/schema/equivalence.d.ts +0 -2
- package/dist/internal/schema/equivalence.d.ts.map +0 -1
- package/dist/internal/schema/equivalence.js.map +0 -1
- package/dist/internal/schema/representation.d.ts +0 -2
- package/dist/internal/schema/representation.d.ts.map +0 -1
- package/dist/internal/schema/representation.js +0 -865
- package/dist/internal/schema/representation.js.map +0 -1
- 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/dist/unstable/http/Multipasta/HeadersParser.d.ts +0 -14
- package/dist/unstable/http/Multipasta/HeadersParser.d.ts.map +0 -1
- package/dist/unstable/http/Multipasta/HeadersParser.js +0 -14
- package/dist/unstable/http/Multipasta/HeadersParser.js.map +0 -1
- package/dist/unstable/http/Multipasta/Node.d.ts +0 -14
- package/dist/unstable/http/Multipasta/Node.d.ts.map +0 -1
- package/dist/unstable/http/Multipasta/Node.js +0 -14
- package/dist/unstable/http/Multipasta/Node.js.map +0 -1
- package/dist/unstable/http/Multipasta/Search.d.ts +0 -14
- package/dist/unstable/http/Multipasta/Search.d.ts.map +0 -1
- package/dist/unstable/http/Multipasta/Search.js +0 -14
- package/dist/unstable/http/Multipasta/Search.js.map +0 -1
- package/dist/unstable/http/Multipasta/Web.d.ts +0 -14
- package/dist/unstable/http/Multipasta/Web.d.ts.map +0 -1
- package/dist/unstable/http/Multipasta/Web.js +0 -14
- package/dist/unstable/http/Multipasta/Web.js.map +0 -1
- package/dist/unstable/http/Multipasta.d.ts +0 -15
- package/dist/unstable/http/Multipasta.d.ts.map +0 -1
- package/dist/unstable/http/Multipasta.js +0 -15
- package/dist/unstable/http/Multipasta.js.map +0 -1
- package/src/SchemaError.ts +0 -64
- package/src/SchemaUtils.ts +0 -51
- package/src/internal/schema/representation.ts +0 -795
- package/src/internal/version.ts +0 -2
- package/src/unstable/http/Multipasta/HeadersParser.ts +0 -14
- package/src/unstable/http/Multipasta/Node.ts +0 -14
- package/src/unstable/http/Multipasta/Search.ts +0 -14
- package/src/unstable/http/Multipasta/Web.ts +0 -14
- package/src/unstable/http/Multipasta.ts +0 -15
package/dist/Graph.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ import * as Equal from "./Equal.ts";
|
|
|
13
13
|
import type { Inspectable } from "./Inspectable.ts";
|
|
14
14
|
import * as Option from "./Option.ts";
|
|
15
15
|
import type { Pipeable } from "./Pipeable.ts";
|
|
16
|
+
import type { Covariant, Invariant } from "./Types.ts";
|
|
16
17
|
declare const TypeId = "~effect/collections/Graph";
|
|
17
18
|
/**
|
|
18
19
|
* Node index for node identification using plain numbers.
|
|
@@ -97,25 +98,19 @@ export declare class Edge<E> extends Data.Class<{
|
|
|
97
98
|
*/
|
|
98
99
|
export type Kind = "directed" | "undirected";
|
|
99
100
|
/**
|
|
100
|
-
* Common
|
|
101
|
+
* Common public protocol for graph values.
|
|
101
102
|
*
|
|
102
103
|
* **Details**
|
|
103
104
|
*
|
|
104
|
-
* Contains the
|
|
105
|
-
*
|
|
105
|
+
* Contains only the runtime marker and shared protocols. Graph storage is kept
|
|
106
|
+
* internal; use module functions such as `nodes`, `edges`, `getNode`, and
|
|
107
|
+
* `getEdge` to inspect graph contents.
|
|
106
108
|
*
|
|
107
109
|
* @category models
|
|
108
110
|
* @since 3.18.0
|
|
109
111
|
*/
|
|
110
112
|
export interface Proto<out N, out E> extends Iterable<readonly [NodeIndex, N]>, Equal.Equal, Pipeable, Inspectable {
|
|
111
|
-
readonly [TypeId]:
|
|
112
|
-
readonly nodes: Map<NodeIndex, N>;
|
|
113
|
-
readonly edges: Map<EdgeIndex, Edge<E>>;
|
|
114
|
-
readonly adjacency: Map<NodeIndex, Array<EdgeIndex>>;
|
|
115
|
-
readonly reverseAdjacency: Map<NodeIndex, Array<EdgeIndex>>;
|
|
116
|
-
nextNodeIndex: NodeIndex;
|
|
117
|
-
nextEdgeIndex: EdgeIndex;
|
|
118
|
-
acyclic: Option.Option<boolean>;
|
|
113
|
+
readonly [TypeId]: Graph.Variance<N, E>;
|
|
119
114
|
}
|
|
120
115
|
/**
|
|
121
116
|
* Immutable graph interface.
|
|
@@ -136,6 +131,24 @@ export interface Graph<out N, out E, T extends Kind = "directed"> extends Proto<
|
|
|
136
131
|
readonly type: T;
|
|
137
132
|
readonly mutable: false;
|
|
138
133
|
}
|
|
134
|
+
/**
|
|
135
|
+
* Companion namespace containing type-level metadata for immutable graphs.
|
|
136
|
+
*
|
|
137
|
+
* @category models
|
|
138
|
+
* @since 4.0.0
|
|
139
|
+
*/
|
|
140
|
+
export declare namespace Graph {
|
|
141
|
+
/**
|
|
142
|
+
* Type-level variance marker for immutable graphs.
|
|
143
|
+
*
|
|
144
|
+
* @category models
|
|
145
|
+
* @since 4.0.0
|
|
146
|
+
*/
|
|
147
|
+
interface Variance<out N, out E> {
|
|
148
|
+
readonly _N: Covariant<N>;
|
|
149
|
+
readonly _E: Covariant<E>;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
139
152
|
/**
|
|
140
153
|
* Mutable graph interface.
|
|
141
154
|
*
|
|
@@ -152,10 +165,29 @@ export interface Graph<out N, out E, T extends Kind = "directed"> extends Proto<
|
|
|
152
165
|
* @category models
|
|
153
166
|
* @since 3.18.0
|
|
154
167
|
*/
|
|
155
|
-
export interface MutableGraph<out N, out E, T extends Kind = "directed"> extends
|
|
168
|
+
export interface MutableGraph<in out N, in out E, T extends Kind = "directed"> extends Iterable<readonly [NodeIndex, N]>, Equal.Equal, Pipeable, Inspectable {
|
|
169
|
+
readonly [TypeId]: MutableGraph.Variance<N, E>;
|
|
156
170
|
readonly type: T;
|
|
157
171
|
readonly mutable: true;
|
|
158
172
|
}
|
|
173
|
+
/**
|
|
174
|
+
* Companion namespace containing type-level metadata for scoped mutable graphs.
|
|
175
|
+
*
|
|
176
|
+
* @category models
|
|
177
|
+
* @since 4.0.0
|
|
178
|
+
*/
|
|
179
|
+
export declare namespace MutableGraph {
|
|
180
|
+
/**
|
|
181
|
+
* Type-level variance marker for scoped mutable graphs.
|
|
182
|
+
*
|
|
183
|
+
* @category models
|
|
184
|
+
* @since 4.0.0
|
|
185
|
+
*/
|
|
186
|
+
interface Variance<in out N, in out E> {
|
|
187
|
+
readonly _N: Invariant<N>;
|
|
188
|
+
readonly _E: Invariant<E>;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
159
191
|
/**
|
|
160
192
|
* Immutable graph type for source-to-target relationships.
|
|
161
193
|
*
|
|
@@ -252,7 +284,7 @@ export declare class GraphError extends GraphError_base<{
|
|
|
252
284
|
}
|
|
253
285
|
/**
|
|
254
286
|
* Returns `true` if a value has the graph runtime type identifier, narrowing
|
|
255
|
-
* it to
|
|
287
|
+
* it to an immutable or mutable graph.
|
|
256
288
|
*
|
|
257
289
|
* **When to use**
|
|
258
290
|
*
|
|
@@ -261,18 +293,46 @@ export declare class GraphError extends GraphError_base<{
|
|
|
261
293
|
* **Gotchas**
|
|
262
294
|
*
|
|
263
295
|
* This guard checks the shared graph runtime type identifier and does not
|
|
264
|
-
* distinguish immutable graphs from mutable graphs
|
|
296
|
+
* distinguish immutable graphs from mutable graphs or directed graphs from
|
|
297
|
+
* undirected graphs.
|
|
265
298
|
*
|
|
266
299
|
* @category guards
|
|
267
300
|
* @since 4.0.0
|
|
268
301
|
*/
|
|
269
|
-
export declare const isGraph: (u:
|
|
302
|
+
export declare const isGraph: <N = unknown, E = unknown, T extends Kind = Kind, U = never>(u: U | Graph<N, E, T> | MutableGraph<N, E, T>) => u is Graph<N, E, T> | MutableGraph<N, E, T>;
|
|
303
|
+
/**
|
|
304
|
+
* Creates a graph constructor for the specified graph kind.
|
|
305
|
+
*
|
|
306
|
+
* **When to use**
|
|
307
|
+
*
|
|
308
|
+
* Use when the graph kind is selected dynamically. Prefer `directed` or
|
|
309
|
+
* `undirected` when the kind is known statically.
|
|
310
|
+
*
|
|
311
|
+
* **Example** (Constructing by kind)
|
|
312
|
+
*
|
|
313
|
+
* ```ts import.meta.vitest
|
|
314
|
+
* import { Graph } from "effect"
|
|
315
|
+
*
|
|
316
|
+
* const makeGraph = Graph.make("directed")
|
|
317
|
+
* const graph = makeGraph<string, number>((mutable) => {
|
|
318
|
+
* Graph.addNode(mutable, "A")
|
|
319
|
+
* })
|
|
320
|
+
*
|
|
321
|
+
* graph.type // => "directed"
|
|
322
|
+
* ```
|
|
323
|
+
*
|
|
324
|
+
* @see {@link directed} for constructing a directed graph directly
|
|
325
|
+
* @see {@link undirected} for constructing an undirected graph directly
|
|
326
|
+
* @category constructors
|
|
327
|
+
* @since 4.0.0
|
|
328
|
+
*/
|
|
329
|
+
export declare const make: <T extends Kind>(type: T) => <N, E>(mutate?: (mutable: MutableGraph<N, E, T>) => undefined) => Graph<N, E, T>;
|
|
270
330
|
/**
|
|
271
331
|
* Creates a directed graph, optionally with initial mutations.
|
|
272
332
|
*
|
|
273
333
|
* **Example** (Creating a directed graph)
|
|
274
334
|
*
|
|
275
|
-
* ```ts
|
|
335
|
+
* ```ts import.meta.vitest
|
|
276
336
|
* import { Graph } from "effect"
|
|
277
337
|
*
|
|
278
338
|
* // Directed graph with initial nodes and edges
|
|
@@ -283,18 +343,19 @@ export declare const isGraph: (u: unknown) => u is Graph<unknown, unknown>;
|
|
|
283
343
|
* Graph.addEdge(mutable, a, b, "A->B")
|
|
284
344
|
* Graph.addEdge(mutable, b, c, "B->C")
|
|
285
345
|
* })
|
|
346
|
+
* Array.of(Graph.nodeCount(graph), Graph.edgeCount(graph)) // => [3, 2]
|
|
286
347
|
* ```
|
|
287
348
|
*
|
|
288
349
|
* @category constructors
|
|
289
350
|
* @since 3.18.0
|
|
290
351
|
*/
|
|
291
|
-
export declare const directed: <N, E>(mutate?: (mutable: MutableDirectedGraph<N, E>) =>
|
|
352
|
+
export declare const directed: <N, E>(mutate?: (mutable: MutableDirectedGraph<N, E>) => undefined) => DirectedGraph<N, E>;
|
|
292
353
|
/**
|
|
293
354
|
* Creates an undirected graph, optionally with initial mutations.
|
|
294
355
|
*
|
|
295
356
|
* **Example** (Creating an undirected graph)
|
|
296
357
|
*
|
|
297
|
-
* ```ts
|
|
358
|
+
* ```ts import.meta.vitest
|
|
298
359
|
* import { Graph } from "effect"
|
|
299
360
|
*
|
|
300
361
|
* // Undirected graph with initial nodes and edges
|
|
@@ -305,23 +366,25 @@ export declare const directed: <N, E>(mutate?: (mutable: MutableDirectedGraph<N,
|
|
|
305
366
|
* Graph.addEdge(mutable, a, b, "A-B")
|
|
306
367
|
* Graph.addEdge(mutable, b, c, "B-C")
|
|
307
368
|
* })
|
|
369
|
+
* Array.of(Graph.nodeCount(graph), Graph.edgeCount(graph)) // => [3, 2]
|
|
308
370
|
* ```
|
|
309
371
|
*
|
|
310
372
|
* @category constructors
|
|
311
373
|
* @since 3.18.0
|
|
312
374
|
*/
|
|
313
|
-
export declare const undirected: <N, E>(mutate?: (mutable: MutableUndirectedGraph<N, E>) =>
|
|
375
|
+
export declare const undirected: <N, E>(mutate?: (mutable: MutableUndirectedGraph<N, E>) => undefined) => UndirectedGraph<N, E>;
|
|
314
376
|
/**
|
|
315
377
|
* Creates a mutable scope for safe graph mutations by copying the data structure.
|
|
316
378
|
*
|
|
317
379
|
* **Example** (Beginning a mutation scope)
|
|
318
380
|
*
|
|
319
|
-
* ```ts
|
|
381
|
+
* ```ts import.meta.vitest
|
|
320
382
|
* import { Graph } from "effect"
|
|
321
383
|
*
|
|
322
384
|
* const graph = Graph.directed<string, number>()
|
|
323
385
|
* const mutable = Graph.beginMutation(graph)
|
|
324
386
|
* // Now mutable can be safely modified without affecting original graph
|
|
387
|
+
* Array.of(Graph.nodeCount(mutable), Graph.nodeCount(graph)) // => [0, 0]
|
|
325
388
|
* ```
|
|
326
389
|
*
|
|
327
390
|
* @category mutations
|
|
@@ -331,15 +394,20 @@ export declare const beginMutation: <N, E, T extends Kind = "directed">(graph: G
|
|
|
331
394
|
/**
|
|
332
395
|
* Converts a mutable graph back to an immutable graph, ending the mutation scope.
|
|
333
396
|
*
|
|
397
|
+
* **Details**
|
|
398
|
+
*
|
|
399
|
+
* Finalizes the mutable handle. Later public mutation operations on that handle
|
|
400
|
+
* fail with a `GraphError`.
|
|
401
|
+
*
|
|
334
402
|
* **Example** (Ending a mutation scope)
|
|
335
403
|
*
|
|
336
|
-
* ```ts
|
|
404
|
+
* ```ts import.meta.vitest
|
|
337
405
|
* import { Graph } from "effect"
|
|
338
406
|
*
|
|
339
407
|
* const graph = Graph.directed<string, number>()
|
|
340
408
|
* const mutable = Graph.beginMutation(graph)
|
|
341
409
|
* // ... perform mutations on mutable ...
|
|
342
|
-
*
|
|
410
|
+
* Graph.nodeCount(Graph.endMutation(mutable)) // => 0
|
|
343
411
|
* ```
|
|
344
412
|
*
|
|
345
413
|
* @category mutations
|
|
@@ -347,74 +415,934 @@ export declare const beginMutation: <N, E, T extends Kind = "directed">(graph: G
|
|
|
347
415
|
*/
|
|
348
416
|
export declare const endMutation: <N, E, T extends Kind = "directed">(mutable: MutableGraph<N, E, T>) => Graph<N, E, T>;
|
|
349
417
|
/**
|
|
350
|
-
* Performs scoped mutations on a graph, automatically managing the mutation lifecycle.
|
|
418
|
+
* Performs scoped mutations on a graph, automatically managing the mutation lifecycle.
|
|
419
|
+
*
|
|
420
|
+
* **Example** (Applying scoped mutations)
|
|
421
|
+
*
|
|
422
|
+
* ```ts import.meta.vitest
|
|
423
|
+
* import { Graph } from "effect"
|
|
424
|
+
*
|
|
425
|
+
* const graph = Graph.directed<string, number>()
|
|
426
|
+
* const newGraph = Graph.mutate(graph, (mutable) => {
|
|
427
|
+
* const nodeA = Graph.addNode(mutable, "A")
|
|
428
|
+
* const nodeB = Graph.addNode(mutable, "B")
|
|
429
|
+
* Graph.addEdge(mutable, nodeA, nodeB, 1)
|
|
430
|
+
* })
|
|
431
|
+
*
|
|
432
|
+
* Graph.nodeCount(newGraph) // => 2
|
|
433
|
+
* Graph.edgeCount(newGraph) // => 1
|
|
434
|
+
* ```
|
|
435
|
+
*
|
|
436
|
+
* @category mutations
|
|
437
|
+
* @since 3.18.0
|
|
438
|
+
*/
|
|
439
|
+
export declare const mutate: {
|
|
440
|
+
/**
|
|
441
|
+
* Performs scoped mutations on a graph, automatically managing the mutation lifecycle.
|
|
442
|
+
*
|
|
443
|
+
* **Example** (Applying scoped mutations)
|
|
444
|
+
*
|
|
445
|
+
* ```ts import.meta.vitest
|
|
446
|
+
* import { Graph } from "effect"
|
|
447
|
+
*
|
|
448
|
+
* const graph = Graph.directed<string, number>()
|
|
449
|
+
* const newGraph = Graph.mutate(graph, (mutable) => {
|
|
450
|
+
* const nodeA = Graph.addNode(mutable, "A")
|
|
451
|
+
* const nodeB = Graph.addNode(mutable, "B")
|
|
452
|
+
* Graph.addEdge(mutable, nodeA, nodeB, 1)
|
|
453
|
+
* })
|
|
454
|
+
*
|
|
455
|
+
* Graph.nodeCount(newGraph) // => 2
|
|
456
|
+
* Graph.edgeCount(newGraph) // => 1
|
|
457
|
+
* ```
|
|
458
|
+
*
|
|
459
|
+
* @category mutations
|
|
460
|
+
* @since 3.18.0
|
|
461
|
+
*/
|
|
462
|
+
<N, E, T extends Kind = "directed">(f: (mutable: MutableGraph<N, E, T>) => undefined): (graph: Graph<N, E, T>) => Graph<N, E, T>;
|
|
463
|
+
/**
|
|
464
|
+
* Performs scoped mutations on a graph, automatically managing the mutation lifecycle.
|
|
465
|
+
*
|
|
466
|
+
* **Example** (Applying scoped mutations)
|
|
467
|
+
*
|
|
468
|
+
* ```ts import.meta.vitest
|
|
469
|
+
* import { Graph } from "effect"
|
|
470
|
+
*
|
|
471
|
+
* const graph = Graph.directed<string, number>()
|
|
472
|
+
* const newGraph = Graph.mutate(graph, (mutable) => {
|
|
473
|
+
* const nodeA = Graph.addNode(mutable, "A")
|
|
474
|
+
* const nodeB = Graph.addNode(mutable, "B")
|
|
475
|
+
* Graph.addEdge(mutable, nodeA, nodeB, 1)
|
|
476
|
+
* })
|
|
477
|
+
*
|
|
478
|
+
* Graph.nodeCount(newGraph) // => 2
|
|
479
|
+
* Graph.edgeCount(newGraph) // => 1
|
|
480
|
+
* ```
|
|
481
|
+
*
|
|
482
|
+
* @category mutations
|
|
483
|
+
* @since 3.18.0
|
|
484
|
+
*/
|
|
485
|
+
<N, E, T extends Kind = "directed">(graph: Graph<N, E, T>, f: (mutable: MutableGraph<N, E, T>) => undefined): Graph<N, E, T>;
|
|
486
|
+
};
|
|
487
|
+
/**
|
|
488
|
+
* Configures node and edge identity for graph set operations.
|
|
489
|
+
*
|
|
490
|
+
* **Details**
|
|
491
|
+
*
|
|
492
|
+
* Both functions default to using the complete node or edge data. Edge identity
|
|
493
|
+
* also includes the identities of its endpoint nodes and the graph kind.
|
|
494
|
+
*
|
|
495
|
+
* **Gotchas**
|
|
496
|
+
*
|
|
497
|
+
* Edge identity defines set membership, not edge multiplicity. Parallel edges
|
|
498
|
+
* with the same endpoint identities and projected edge identity are treated as
|
|
499
|
+
* the same member by graph set operations.
|
|
500
|
+
*
|
|
501
|
+
* @category models
|
|
502
|
+
* @since 4.0.0
|
|
503
|
+
*/
|
|
504
|
+
export interface IdentityOptions<N, E, NI = N, EI = E> {
|
|
505
|
+
readonly nodeIdentity?: (node: N) => NI;
|
|
506
|
+
readonly edgeIdentity?: (edge: E) => EI;
|
|
507
|
+
}
|
|
508
|
+
/**
|
|
509
|
+
* Composes two graphs, merging nodes by identity.
|
|
510
|
+
*
|
|
511
|
+
* **Details**
|
|
512
|
+
*
|
|
513
|
+
* Nodes and edges present in both graphs use data from `that`. The result has
|
|
514
|
+
* the same graph kind as `self`. Throws a `GraphError` when the graph kinds do
|
|
515
|
+
* not match. `nodeIdentity` and `edgeIdentity` default to the complete node and
|
|
516
|
+
* edge data. Edge identity also includes the endpoint identities.
|
|
517
|
+
*
|
|
518
|
+
* `G1 ∪ G2 = {V1 ∪ V2, E1 ∪ E2}`
|
|
519
|
+
*
|
|
520
|
+
* **Gotchas**
|
|
521
|
+
*
|
|
522
|
+
* Nodes with equal identities in one input graph are coalesced. The last node
|
|
523
|
+
* supplies the data, and redirected edges can collapse or become self-loops.
|
|
524
|
+
* Parallel edges with equal identities are also coalesced, with the last edge
|
|
525
|
+
* supplying the data.
|
|
526
|
+
*
|
|
527
|
+
* **Example** (Combining graphs)
|
|
528
|
+
*
|
|
529
|
+
* ```ts import.meta.vitest
|
|
530
|
+
* import { Graph } from "effect"
|
|
531
|
+
*
|
|
532
|
+
* const left = Graph.directed<{ id: string }, string>((mutable) => {
|
|
533
|
+
* const a = Graph.addNode(mutable, { id: "A" })
|
|
534
|
+
* const b = Graph.addNode(mutable, { id: "B" })
|
|
535
|
+
* Graph.addEdge(mutable, a, b, "A-B")
|
|
536
|
+
* })
|
|
537
|
+
*
|
|
538
|
+
* const right = Graph.directed<{ id: string }, string>((mutable) => {
|
|
539
|
+
* const b = Graph.addNode(mutable, { id: "B" })
|
|
540
|
+
* const c = Graph.addNode(mutable, { id: "C" })
|
|
541
|
+
* Graph.addEdge(mutable, b, c, "B-C")
|
|
542
|
+
* })
|
|
543
|
+
*
|
|
544
|
+
* const result = Graph.compose(left, right, {
|
|
545
|
+
* nodeIdentity: (node) => node.id
|
|
546
|
+
* })
|
|
547
|
+
*
|
|
548
|
+
* Graph.nodeCount(result) // => 3
|
|
549
|
+
* Graph.edgeCount(result) // => 2
|
|
550
|
+
* ```
|
|
551
|
+
*
|
|
552
|
+
* @category set operations
|
|
553
|
+
* @since 4.0.0
|
|
554
|
+
*/
|
|
555
|
+
export declare const compose: {
|
|
556
|
+
/**
|
|
557
|
+
* Composes two graphs, merging nodes by identity.
|
|
558
|
+
*
|
|
559
|
+
* **Details**
|
|
560
|
+
*
|
|
561
|
+
* Nodes and edges present in both graphs use data from `that`. The result has
|
|
562
|
+
* the same graph kind as `self`. Throws a `GraphError` when the graph kinds do
|
|
563
|
+
* not match. `nodeIdentity` and `edgeIdentity` default to the complete node and
|
|
564
|
+
* edge data. Edge identity also includes the endpoint identities.
|
|
565
|
+
*
|
|
566
|
+
* `G1 ∪ G2 = {V1 ∪ V2, E1 ∪ E2}`
|
|
567
|
+
*
|
|
568
|
+
* **Gotchas**
|
|
569
|
+
*
|
|
570
|
+
* Nodes with equal identities in one input graph are coalesced. The last node
|
|
571
|
+
* supplies the data, and redirected edges can collapse or become self-loops.
|
|
572
|
+
* Parallel edges with equal identities are also coalesced, with the last edge
|
|
573
|
+
* supplying the data.
|
|
574
|
+
*
|
|
575
|
+
* **Example** (Combining graphs)
|
|
576
|
+
*
|
|
577
|
+
* ```ts import.meta.vitest
|
|
578
|
+
* import { Graph } from "effect"
|
|
579
|
+
*
|
|
580
|
+
* const left = Graph.directed<{ id: string }, string>((mutable) => {
|
|
581
|
+
* const a = Graph.addNode(mutable, { id: "A" })
|
|
582
|
+
* const b = Graph.addNode(mutable, { id: "B" })
|
|
583
|
+
* Graph.addEdge(mutable, a, b, "A-B")
|
|
584
|
+
* })
|
|
585
|
+
*
|
|
586
|
+
* const right = Graph.directed<{ id: string }, string>((mutable) => {
|
|
587
|
+
* const b = Graph.addNode(mutable, { id: "B" })
|
|
588
|
+
* const c = Graph.addNode(mutable, { id: "C" })
|
|
589
|
+
* Graph.addEdge(mutable, b, c, "B-C")
|
|
590
|
+
* })
|
|
591
|
+
*
|
|
592
|
+
* const result = Graph.compose(left, right, {
|
|
593
|
+
* nodeIdentity: (node) => node.id
|
|
594
|
+
* })
|
|
595
|
+
*
|
|
596
|
+
* Graph.nodeCount(result) // => 3
|
|
597
|
+
* Graph.edgeCount(result) // => 2
|
|
598
|
+
* ```
|
|
599
|
+
*
|
|
600
|
+
* @category set operations
|
|
601
|
+
* @since 4.0.0
|
|
602
|
+
*/
|
|
603
|
+
<N, E, T extends Kind = "directed", NI = N, EI = E>(that: Graph<N, E, T>, options?: IdentityOptions<N, E, NI, EI>): (self: Graph<N, E, NoInfer<T>>) => Graph<N, E, T>;
|
|
604
|
+
/**
|
|
605
|
+
* Composes two graphs, merging nodes by identity.
|
|
606
|
+
*
|
|
607
|
+
* **Details**
|
|
608
|
+
*
|
|
609
|
+
* Nodes and edges present in both graphs use data from `that`. The result has
|
|
610
|
+
* the same graph kind as `self`. Throws a `GraphError` when the graph kinds do
|
|
611
|
+
* not match. `nodeIdentity` and `edgeIdentity` default to the complete node and
|
|
612
|
+
* edge data. Edge identity also includes the endpoint identities.
|
|
613
|
+
*
|
|
614
|
+
* `G1 ∪ G2 = {V1 ∪ V2, E1 ∪ E2}`
|
|
615
|
+
*
|
|
616
|
+
* **Gotchas**
|
|
617
|
+
*
|
|
618
|
+
* Nodes with equal identities in one input graph are coalesced. The last node
|
|
619
|
+
* supplies the data, and redirected edges can collapse or become self-loops.
|
|
620
|
+
* Parallel edges with equal identities are also coalesced, with the last edge
|
|
621
|
+
* supplying the data.
|
|
622
|
+
*
|
|
623
|
+
* **Example** (Combining graphs)
|
|
624
|
+
*
|
|
625
|
+
* ```ts import.meta.vitest
|
|
626
|
+
* import { Graph } from "effect"
|
|
627
|
+
*
|
|
628
|
+
* const left = Graph.directed<{ id: string }, string>((mutable) => {
|
|
629
|
+
* const a = Graph.addNode(mutable, { id: "A" })
|
|
630
|
+
* const b = Graph.addNode(mutable, { id: "B" })
|
|
631
|
+
* Graph.addEdge(mutable, a, b, "A-B")
|
|
632
|
+
* })
|
|
633
|
+
*
|
|
634
|
+
* const right = Graph.directed<{ id: string }, string>((mutable) => {
|
|
635
|
+
* const b = Graph.addNode(mutable, { id: "B" })
|
|
636
|
+
* const c = Graph.addNode(mutable, { id: "C" })
|
|
637
|
+
* Graph.addEdge(mutable, b, c, "B-C")
|
|
638
|
+
* })
|
|
639
|
+
*
|
|
640
|
+
* const result = Graph.compose(left, right, {
|
|
641
|
+
* nodeIdentity: (node) => node.id
|
|
642
|
+
* })
|
|
643
|
+
*
|
|
644
|
+
* Graph.nodeCount(result) // => 3
|
|
645
|
+
* Graph.edgeCount(result) // => 2
|
|
646
|
+
* ```
|
|
647
|
+
*
|
|
648
|
+
* @category set operations
|
|
649
|
+
* @since 4.0.0
|
|
650
|
+
*/
|
|
651
|
+
<N, E, T extends Kind = "directed", NI = N, EI = E>(self: Graph<N, E, T>, that: Graph<N, E, NoInfer<T>>, options?: IdentityOptions<N, E, NI, EI>): Graph<N, E, T>;
|
|
652
|
+
};
|
|
653
|
+
/**
|
|
654
|
+
* Returns the intersection of two graphs, matching nodes by identity.
|
|
655
|
+
*
|
|
656
|
+
* **Details**
|
|
657
|
+
*
|
|
658
|
+
* Node data comes from `self`, and edge data comes from `that`. The result has
|
|
659
|
+
* the same graph kind as `self`. Throws a `GraphError` when the graph kinds do
|
|
660
|
+
* not match. `nodeIdentity` and `edgeIdentity` default to the complete node and
|
|
661
|
+
* edge data. Edge identity also includes the endpoint identities.
|
|
662
|
+
*
|
|
663
|
+
* `G1 ∩ G2 = {V1 ∩ V2, E1 ∩ E2}`
|
|
664
|
+
*
|
|
665
|
+
* **Gotchas**
|
|
666
|
+
*
|
|
667
|
+
* Nodes with equal identities in one input graph are coalesced. The last node
|
|
668
|
+
* supplies the data, and redirected edges can collapse or become self-loops.
|
|
669
|
+
* The result contains at most one edge for each shared edge identity.
|
|
670
|
+
*
|
|
671
|
+
* **Example** (Finding shared structure)
|
|
672
|
+
*
|
|
673
|
+
* ```ts import.meta.vitest
|
|
674
|
+
* import { Graph } from "effect"
|
|
675
|
+
*
|
|
676
|
+
* const left = Graph.directed<string, string>((mutable) => {
|
|
677
|
+
* const a = Graph.addNode(mutable, "A")
|
|
678
|
+
* const b = Graph.addNode(mutable, "B")
|
|
679
|
+
* Graph.addEdge(mutable, a, b, "shared")
|
|
680
|
+
* })
|
|
681
|
+
*
|
|
682
|
+
* const right = Graph.directed<string, string>((mutable) => {
|
|
683
|
+
* const a = Graph.addNode(mutable, "A")
|
|
684
|
+
* const b = Graph.addNode(mutable, "B")
|
|
685
|
+
* Graph.addEdge(mutable, a, b, "shared")
|
|
686
|
+
* })
|
|
687
|
+
*
|
|
688
|
+
* const result = Graph.intersection(left, right)
|
|
689
|
+
*
|
|
690
|
+
* Graph.nodeCount(result) // => 2
|
|
691
|
+
* Graph.edgeCount(result) // => 1
|
|
692
|
+
* ```
|
|
693
|
+
*
|
|
694
|
+
* @category set operations
|
|
695
|
+
* @since 4.0.0
|
|
696
|
+
*/
|
|
697
|
+
export declare const intersection: {
|
|
698
|
+
/**
|
|
699
|
+
* Returns the intersection of two graphs, matching nodes by identity.
|
|
700
|
+
*
|
|
701
|
+
* **Details**
|
|
702
|
+
*
|
|
703
|
+
* Node data comes from `self`, and edge data comes from `that`. The result has
|
|
704
|
+
* the same graph kind as `self`. Throws a `GraphError` when the graph kinds do
|
|
705
|
+
* not match. `nodeIdentity` and `edgeIdentity` default to the complete node and
|
|
706
|
+
* edge data. Edge identity also includes the endpoint identities.
|
|
707
|
+
*
|
|
708
|
+
* `G1 ∩ G2 = {V1 ∩ V2, E1 ∩ E2}`
|
|
709
|
+
*
|
|
710
|
+
* **Gotchas**
|
|
711
|
+
*
|
|
712
|
+
* Nodes with equal identities in one input graph are coalesced. The last node
|
|
713
|
+
* supplies the data, and redirected edges can collapse or become self-loops.
|
|
714
|
+
* The result contains at most one edge for each shared edge identity.
|
|
715
|
+
*
|
|
716
|
+
* **Example** (Finding shared structure)
|
|
717
|
+
*
|
|
718
|
+
* ```ts import.meta.vitest
|
|
719
|
+
* import { Graph } from "effect"
|
|
720
|
+
*
|
|
721
|
+
* const left = Graph.directed<string, string>((mutable) => {
|
|
722
|
+
* const a = Graph.addNode(mutable, "A")
|
|
723
|
+
* const b = Graph.addNode(mutable, "B")
|
|
724
|
+
* Graph.addEdge(mutable, a, b, "shared")
|
|
725
|
+
* })
|
|
726
|
+
*
|
|
727
|
+
* const right = Graph.directed<string, string>((mutable) => {
|
|
728
|
+
* const a = Graph.addNode(mutable, "A")
|
|
729
|
+
* const b = Graph.addNode(mutable, "B")
|
|
730
|
+
* Graph.addEdge(mutable, a, b, "shared")
|
|
731
|
+
* })
|
|
732
|
+
*
|
|
733
|
+
* const result = Graph.intersection(left, right)
|
|
734
|
+
*
|
|
735
|
+
* Graph.nodeCount(result) // => 2
|
|
736
|
+
* Graph.edgeCount(result) // => 1
|
|
737
|
+
* ```
|
|
738
|
+
*
|
|
739
|
+
* @category set operations
|
|
740
|
+
* @since 4.0.0
|
|
741
|
+
*/
|
|
742
|
+
<N, E, T extends Kind = "directed", NI = N, EI = E>(that: Graph<N, E, T>, options?: IdentityOptions<N, E, NI, EI>): (self: Graph<N, E, NoInfer<T>>) => Graph<N, E, T>;
|
|
743
|
+
/**
|
|
744
|
+
* Returns the intersection of two graphs, matching nodes by identity.
|
|
745
|
+
*
|
|
746
|
+
* **Details**
|
|
747
|
+
*
|
|
748
|
+
* Node data comes from `self`, and edge data comes from `that`. The result has
|
|
749
|
+
* the same graph kind as `self`. Throws a `GraphError` when the graph kinds do
|
|
750
|
+
* not match. `nodeIdentity` and `edgeIdentity` default to the complete node and
|
|
751
|
+
* edge data. Edge identity also includes the endpoint identities.
|
|
752
|
+
*
|
|
753
|
+
* `G1 ∩ G2 = {V1 ∩ V2, E1 ∩ E2}`
|
|
754
|
+
*
|
|
755
|
+
* **Gotchas**
|
|
756
|
+
*
|
|
757
|
+
* Nodes with equal identities in one input graph are coalesced. The last node
|
|
758
|
+
* supplies the data, and redirected edges can collapse or become self-loops.
|
|
759
|
+
* The result contains at most one edge for each shared edge identity.
|
|
760
|
+
*
|
|
761
|
+
* **Example** (Finding shared structure)
|
|
762
|
+
*
|
|
763
|
+
* ```ts import.meta.vitest
|
|
764
|
+
* import { Graph } from "effect"
|
|
765
|
+
*
|
|
766
|
+
* const left = Graph.directed<string, string>((mutable) => {
|
|
767
|
+
* const a = Graph.addNode(mutable, "A")
|
|
768
|
+
* const b = Graph.addNode(mutable, "B")
|
|
769
|
+
* Graph.addEdge(mutable, a, b, "shared")
|
|
770
|
+
* })
|
|
771
|
+
*
|
|
772
|
+
* const right = Graph.directed<string, string>((mutable) => {
|
|
773
|
+
* const a = Graph.addNode(mutable, "A")
|
|
774
|
+
* const b = Graph.addNode(mutable, "B")
|
|
775
|
+
* Graph.addEdge(mutable, a, b, "shared")
|
|
776
|
+
* })
|
|
777
|
+
*
|
|
778
|
+
* const result = Graph.intersection(left, right)
|
|
779
|
+
*
|
|
780
|
+
* Graph.nodeCount(result) // => 2
|
|
781
|
+
* Graph.edgeCount(result) // => 1
|
|
782
|
+
* ```
|
|
783
|
+
*
|
|
784
|
+
* @category set operations
|
|
785
|
+
* @since 4.0.0
|
|
786
|
+
*/
|
|
787
|
+
<N, E, T extends Kind = "directed", NI = N, EI = E>(self: Graph<N, E, T>, that: Graph<N, E, NoInfer<T>>, options?: IdentityOptions<N, E, NI, EI>): Graph<N, E, T>;
|
|
788
|
+
};
|
|
789
|
+
/**
|
|
790
|
+
* Returns `self` without edges also present in `that`.
|
|
791
|
+
*
|
|
792
|
+
* **Details**
|
|
793
|
+
*
|
|
794
|
+
* All nodes from `self` are preserved. Edges are matched by endpoint and edge
|
|
795
|
+
* identities. The result has the same graph kind as `self`. Throws a
|
|
796
|
+
* `GraphError` when the graph kinds do not match. `nodeIdentity` and
|
|
797
|
+
* `edgeIdentity` default to the complete node and edge data.
|
|
798
|
+
*
|
|
799
|
+
* `G1 \ G2 = {V1, E1 \ E2}`
|
|
800
|
+
*
|
|
801
|
+
* **Gotchas**
|
|
802
|
+
*
|
|
803
|
+
* Nodes with equal identities in one input graph are coalesced. The last node
|
|
804
|
+
* supplies the data, and redirected edges can collapse or become self-loops.
|
|
805
|
+
* If `that` contains an edge identity, every parallel edge with that identity
|
|
806
|
+
* is removed from `self`.
|
|
807
|
+
*
|
|
808
|
+
* **Example** (Removing shared edges)
|
|
809
|
+
*
|
|
810
|
+
* ```ts import.meta.vitest
|
|
811
|
+
* import { Graph } from "effect"
|
|
812
|
+
*
|
|
813
|
+
* const left = Graph.directed<string, string>((mutable) => {
|
|
814
|
+
* const a = Graph.addNode(mutable, "A")
|
|
815
|
+
* const b = Graph.addNode(mutable, "B")
|
|
816
|
+
* const c = Graph.addNode(mutable, "C")
|
|
817
|
+
* Graph.addEdge(mutable, a, b, "A-B")
|
|
818
|
+
* Graph.addEdge(mutable, b, c, "B-C")
|
|
819
|
+
* })
|
|
820
|
+
*
|
|
821
|
+
* const right = Graph.directed<string, string>((mutable) => {
|
|
822
|
+
* const b = Graph.addNode(mutable, "B")
|
|
823
|
+
* const c = Graph.addNode(mutable, "C")
|
|
824
|
+
* Graph.addEdge(mutable, b, c, "B-C")
|
|
825
|
+
* })
|
|
826
|
+
*
|
|
827
|
+
* const result = Graph.difference(left, right)
|
|
828
|
+
*
|
|
829
|
+
* Graph.nodeCount(result) // => 3
|
|
830
|
+
* Graph.edgeCount(result) // => 1
|
|
831
|
+
* ```
|
|
832
|
+
*
|
|
833
|
+
* @category set operations
|
|
834
|
+
* @since 4.0.0
|
|
835
|
+
*/
|
|
836
|
+
export declare const difference: {
|
|
837
|
+
/**
|
|
838
|
+
* Returns `self` without edges also present in `that`.
|
|
839
|
+
*
|
|
840
|
+
* **Details**
|
|
841
|
+
*
|
|
842
|
+
* All nodes from `self` are preserved. Edges are matched by endpoint and edge
|
|
843
|
+
* identities. The result has the same graph kind as `self`. Throws a
|
|
844
|
+
* `GraphError` when the graph kinds do not match. `nodeIdentity` and
|
|
845
|
+
* `edgeIdentity` default to the complete node and edge data.
|
|
846
|
+
*
|
|
847
|
+
* `G1 \ G2 = {V1, E1 \ E2}`
|
|
848
|
+
*
|
|
849
|
+
* **Gotchas**
|
|
850
|
+
*
|
|
851
|
+
* Nodes with equal identities in one input graph are coalesced. The last node
|
|
852
|
+
* supplies the data, and redirected edges can collapse or become self-loops.
|
|
853
|
+
* If `that` contains an edge identity, every parallel edge with that identity
|
|
854
|
+
* is removed from `self`.
|
|
855
|
+
*
|
|
856
|
+
* **Example** (Removing shared edges)
|
|
857
|
+
*
|
|
858
|
+
* ```ts import.meta.vitest
|
|
859
|
+
* import { Graph } from "effect"
|
|
860
|
+
*
|
|
861
|
+
* const left = Graph.directed<string, string>((mutable) => {
|
|
862
|
+
* const a = Graph.addNode(mutable, "A")
|
|
863
|
+
* const b = Graph.addNode(mutable, "B")
|
|
864
|
+
* const c = Graph.addNode(mutable, "C")
|
|
865
|
+
* Graph.addEdge(mutable, a, b, "A-B")
|
|
866
|
+
* Graph.addEdge(mutable, b, c, "B-C")
|
|
867
|
+
* })
|
|
868
|
+
*
|
|
869
|
+
* const right = Graph.directed<string, string>((mutable) => {
|
|
870
|
+
* const b = Graph.addNode(mutable, "B")
|
|
871
|
+
* const c = Graph.addNode(mutable, "C")
|
|
872
|
+
* Graph.addEdge(mutable, b, c, "B-C")
|
|
873
|
+
* })
|
|
874
|
+
*
|
|
875
|
+
* const result = Graph.difference(left, right)
|
|
876
|
+
*
|
|
877
|
+
* Graph.nodeCount(result) // => 3
|
|
878
|
+
* Graph.edgeCount(result) // => 1
|
|
879
|
+
* ```
|
|
880
|
+
*
|
|
881
|
+
* @category set operations
|
|
882
|
+
* @since 4.0.0
|
|
883
|
+
*/
|
|
884
|
+
<N, E, T extends Kind = "directed", NI = N, EI = E>(that: Graph<N, E, T>, options?: IdentityOptions<N, E, NI, EI>): (self: Graph<N, E, NoInfer<T>>) => Graph<N, E, T>;
|
|
885
|
+
/**
|
|
886
|
+
* Returns `self` without edges also present in `that`.
|
|
887
|
+
*
|
|
888
|
+
* **Details**
|
|
889
|
+
*
|
|
890
|
+
* All nodes from `self` are preserved. Edges are matched by endpoint and edge
|
|
891
|
+
* identities. The result has the same graph kind as `self`. Throws a
|
|
892
|
+
* `GraphError` when the graph kinds do not match. `nodeIdentity` and
|
|
893
|
+
* `edgeIdentity` default to the complete node and edge data.
|
|
894
|
+
*
|
|
895
|
+
* `G1 \ G2 = {V1, E1 \ E2}`
|
|
896
|
+
*
|
|
897
|
+
* **Gotchas**
|
|
898
|
+
*
|
|
899
|
+
* Nodes with equal identities in one input graph are coalesced. The last node
|
|
900
|
+
* supplies the data, and redirected edges can collapse or become self-loops.
|
|
901
|
+
* If `that` contains an edge identity, every parallel edge with that identity
|
|
902
|
+
* is removed from `self`.
|
|
903
|
+
*
|
|
904
|
+
* **Example** (Removing shared edges)
|
|
905
|
+
*
|
|
906
|
+
* ```ts import.meta.vitest
|
|
907
|
+
* import { Graph } from "effect"
|
|
908
|
+
*
|
|
909
|
+
* const left = Graph.directed<string, string>((mutable) => {
|
|
910
|
+
* const a = Graph.addNode(mutable, "A")
|
|
911
|
+
* const b = Graph.addNode(mutable, "B")
|
|
912
|
+
* const c = Graph.addNode(mutable, "C")
|
|
913
|
+
* Graph.addEdge(mutable, a, b, "A-B")
|
|
914
|
+
* Graph.addEdge(mutable, b, c, "B-C")
|
|
915
|
+
* })
|
|
916
|
+
*
|
|
917
|
+
* const right = Graph.directed<string, string>((mutable) => {
|
|
918
|
+
* const b = Graph.addNode(mutable, "B")
|
|
919
|
+
* const c = Graph.addNode(mutable, "C")
|
|
920
|
+
* Graph.addEdge(mutable, b, c, "B-C")
|
|
921
|
+
* })
|
|
922
|
+
*
|
|
923
|
+
* const result = Graph.difference(left, right)
|
|
924
|
+
*
|
|
925
|
+
* Graph.nodeCount(result) // => 3
|
|
926
|
+
* Graph.edgeCount(result) // => 1
|
|
927
|
+
* ```
|
|
928
|
+
*
|
|
929
|
+
* @category set operations
|
|
930
|
+
* @since 4.0.0
|
|
931
|
+
*/
|
|
932
|
+
<N, E, T extends Kind = "directed", NI = N, EI = E>(self: Graph<N, E, T>, that: Graph<N, E, NoInfer<T>>, options?: IdentityOptions<N, E, NI, EI>): Graph<N, E, T>;
|
|
933
|
+
};
|
|
934
|
+
/**
|
|
935
|
+
* Returns edges present in exactly one of two graphs.
|
|
936
|
+
*
|
|
937
|
+
* **Details**
|
|
938
|
+
*
|
|
939
|
+
* Keeps nodes from both graphs. Overlapping nodes use data from `that`. The
|
|
940
|
+
* result has the same graph kind as `self`. Throws a `GraphError` when the
|
|
941
|
+
* graph kinds do not match. `nodeIdentity` and `edgeIdentity` default to the
|
|
942
|
+
* complete node and edge data. Edge identity also includes the endpoint
|
|
943
|
+
* identities.
|
|
944
|
+
*
|
|
945
|
+
* `G1 Δ G2 = {V1 ∪ V2, (E1 ∪ E2) \ (E1 ∩ E2)}`
|
|
946
|
+
*
|
|
947
|
+
* **Gotchas**
|
|
948
|
+
*
|
|
949
|
+
* Edges with different projected identities are distinct.
|
|
950
|
+
* Nodes with equal identities in one input graph are coalesced. The last node
|
|
951
|
+
* supplies the data, and redirected edges can collapse or become self-loops.
|
|
952
|
+
* Parallel edges with equal identities are coalesced before the graphs are
|
|
953
|
+
* compared.
|
|
954
|
+
*
|
|
955
|
+
* **Example** (Finding differing edges)
|
|
956
|
+
*
|
|
957
|
+
* ```ts import.meta.vitest
|
|
958
|
+
* import { Graph } from "effect"
|
|
959
|
+
*
|
|
960
|
+
* const left = Graph.directed<string, string>((mutable) => {
|
|
961
|
+
* const a = Graph.addNode(mutable, "A")
|
|
962
|
+
* const b = Graph.addNode(mutable, "B")
|
|
963
|
+
* const c = Graph.addNode(mutable, "C")
|
|
964
|
+
* Graph.addEdge(mutable, a, b, "A-B")
|
|
965
|
+
* Graph.addEdge(mutable, b, c, "B-C")
|
|
966
|
+
* })
|
|
967
|
+
*
|
|
968
|
+
* const right = Graph.directed<string, string>((mutable) => {
|
|
969
|
+
* const b = Graph.addNode(mutable, "B")
|
|
970
|
+
* const c = Graph.addNode(mutable, "C")
|
|
971
|
+
* const d = Graph.addNode(mutable, "D")
|
|
972
|
+
* Graph.addEdge(mutable, b, c, "B-C")
|
|
973
|
+
* Graph.addEdge(mutable, c, d, "C-D")
|
|
974
|
+
* })
|
|
975
|
+
*
|
|
976
|
+
* const result = Graph.symmetricDifference(left, right)
|
|
977
|
+
*
|
|
978
|
+
* Graph.nodeCount(result) // => 4
|
|
979
|
+
* Graph.edgeCount(result) // => 2
|
|
980
|
+
* ```
|
|
981
|
+
*
|
|
982
|
+
* @category set operations
|
|
983
|
+
* @since 4.0.0
|
|
984
|
+
*/
|
|
985
|
+
export declare const symmetricDifference: {
|
|
986
|
+
/**
|
|
987
|
+
* Returns edges present in exactly one of two graphs.
|
|
988
|
+
*
|
|
989
|
+
* **Details**
|
|
990
|
+
*
|
|
991
|
+
* Keeps nodes from both graphs. Overlapping nodes use data from `that`. The
|
|
992
|
+
* result has the same graph kind as `self`. Throws a `GraphError` when the
|
|
993
|
+
* graph kinds do not match. `nodeIdentity` and `edgeIdentity` default to the
|
|
994
|
+
* complete node and edge data. Edge identity also includes the endpoint
|
|
995
|
+
* identities.
|
|
996
|
+
*
|
|
997
|
+
* `G1 Δ G2 = {V1 ∪ V2, (E1 ∪ E2) \ (E1 ∩ E2)}`
|
|
998
|
+
*
|
|
999
|
+
* **Gotchas**
|
|
1000
|
+
*
|
|
1001
|
+
* Edges with different projected identities are distinct.
|
|
1002
|
+
* Nodes with equal identities in one input graph are coalesced. The last node
|
|
1003
|
+
* supplies the data, and redirected edges can collapse or become self-loops.
|
|
1004
|
+
* Parallel edges with equal identities are coalesced before the graphs are
|
|
1005
|
+
* compared.
|
|
1006
|
+
*
|
|
1007
|
+
* **Example** (Finding differing edges)
|
|
1008
|
+
*
|
|
1009
|
+
* ```ts import.meta.vitest
|
|
1010
|
+
* import { Graph } from "effect"
|
|
1011
|
+
*
|
|
1012
|
+
* const left = Graph.directed<string, string>((mutable) => {
|
|
1013
|
+
* const a = Graph.addNode(mutable, "A")
|
|
1014
|
+
* const b = Graph.addNode(mutable, "B")
|
|
1015
|
+
* const c = Graph.addNode(mutable, "C")
|
|
1016
|
+
* Graph.addEdge(mutable, a, b, "A-B")
|
|
1017
|
+
* Graph.addEdge(mutable, b, c, "B-C")
|
|
1018
|
+
* })
|
|
1019
|
+
*
|
|
1020
|
+
* const right = Graph.directed<string, string>((mutable) => {
|
|
1021
|
+
* const b = Graph.addNode(mutable, "B")
|
|
1022
|
+
* const c = Graph.addNode(mutable, "C")
|
|
1023
|
+
* const d = Graph.addNode(mutable, "D")
|
|
1024
|
+
* Graph.addEdge(mutable, b, c, "B-C")
|
|
1025
|
+
* Graph.addEdge(mutable, c, d, "C-D")
|
|
1026
|
+
* })
|
|
1027
|
+
*
|
|
1028
|
+
* const result = Graph.symmetricDifference(left, right)
|
|
1029
|
+
*
|
|
1030
|
+
* Graph.nodeCount(result) // => 4
|
|
1031
|
+
* Graph.edgeCount(result) // => 2
|
|
1032
|
+
* ```
|
|
1033
|
+
*
|
|
1034
|
+
* @category set operations
|
|
1035
|
+
* @since 4.0.0
|
|
1036
|
+
*/
|
|
1037
|
+
<N, E, T extends Kind = "directed", NI = N, EI = E>(that: Graph<N, E, T>, options?: IdentityOptions<N, E, NI, EI>): (self: Graph<N, E, NoInfer<T>>) => Graph<N, E, T>;
|
|
1038
|
+
/**
|
|
1039
|
+
* Returns edges present in exactly one of two graphs.
|
|
1040
|
+
*
|
|
1041
|
+
* **Details**
|
|
1042
|
+
*
|
|
1043
|
+
* Keeps nodes from both graphs. Overlapping nodes use data from `that`. The
|
|
1044
|
+
* result has the same graph kind as `self`. Throws a `GraphError` when the
|
|
1045
|
+
* graph kinds do not match. `nodeIdentity` and `edgeIdentity` default to the
|
|
1046
|
+
* complete node and edge data. Edge identity also includes the endpoint
|
|
1047
|
+
* identities.
|
|
1048
|
+
*
|
|
1049
|
+
* `G1 Δ G2 = {V1 ∪ V2, (E1 ∪ E2) \ (E1 ∩ E2)}`
|
|
1050
|
+
*
|
|
1051
|
+
* **Gotchas**
|
|
1052
|
+
*
|
|
1053
|
+
* Edges with different projected identities are distinct.
|
|
1054
|
+
* Nodes with equal identities in one input graph are coalesced. The last node
|
|
1055
|
+
* supplies the data, and redirected edges can collapse or become self-loops.
|
|
1056
|
+
* Parallel edges with equal identities are coalesced before the graphs are
|
|
1057
|
+
* compared.
|
|
1058
|
+
*
|
|
1059
|
+
* **Example** (Finding differing edges)
|
|
1060
|
+
*
|
|
1061
|
+
* ```ts import.meta.vitest
|
|
1062
|
+
* import { Graph } from "effect"
|
|
1063
|
+
*
|
|
1064
|
+
* const left = Graph.directed<string, string>((mutable) => {
|
|
1065
|
+
* const a = Graph.addNode(mutable, "A")
|
|
1066
|
+
* const b = Graph.addNode(mutable, "B")
|
|
1067
|
+
* const c = Graph.addNode(mutable, "C")
|
|
1068
|
+
* Graph.addEdge(mutable, a, b, "A-B")
|
|
1069
|
+
* Graph.addEdge(mutable, b, c, "B-C")
|
|
1070
|
+
* })
|
|
1071
|
+
*
|
|
1072
|
+
* const right = Graph.directed<string, string>((mutable) => {
|
|
1073
|
+
* const b = Graph.addNode(mutable, "B")
|
|
1074
|
+
* const c = Graph.addNode(mutable, "C")
|
|
1075
|
+
* const d = Graph.addNode(mutable, "D")
|
|
1076
|
+
* Graph.addEdge(mutable, b, c, "B-C")
|
|
1077
|
+
* Graph.addEdge(mutable, c, d, "C-D")
|
|
1078
|
+
* })
|
|
1079
|
+
*
|
|
1080
|
+
* const result = Graph.symmetricDifference(left, right)
|
|
1081
|
+
*
|
|
1082
|
+
* Graph.nodeCount(result) // => 4
|
|
1083
|
+
* Graph.edgeCount(result) // => 2
|
|
1084
|
+
* ```
|
|
1085
|
+
*
|
|
1086
|
+
* @category set operations
|
|
1087
|
+
* @since 4.0.0
|
|
1088
|
+
*/
|
|
1089
|
+
<N, E, T extends Kind = "directed", NI = N, EI = E>(self: Graph<N, E, T>, that: Graph<N, E, NoInfer<T>>, options?: IdentityOptions<N, E, NI, EI>): Graph<N, E, T>;
|
|
1090
|
+
};
|
|
1091
|
+
/**
|
|
1092
|
+
* Returns the complement over the existing node set.
|
|
1093
|
+
*
|
|
1094
|
+
* **Details**
|
|
1095
|
+
*
|
|
1096
|
+
* Adds every missing edge between distinct nodes. The `createEdge` function
|
|
1097
|
+
* receives the source and target node data for each added edge. The result has
|
|
1098
|
+
* the same graph kind as `self`.
|
|
1099
|
+
*
|
|
1100
|
+
* `G' = {V, (V x V) \ E}`
|
|
1101
|
+
*
|
|
1102
|
+
* **Example** (Finding missing relationships)
|
|
1103
|
+
*
|
|
1104
|
+
* ```ts import.meta.vitest
|
|
1105
|
+
* import { Graph } from "effect"
|
|
1106
|
+
*
|
|
1107
|
+
* const graph = Graph.directed<string, string>((mutable) => {
|
|
1108
|
+
* const a = Graph.addNode(mutable, "A")
|
|
1109
|
+
* const b = Graph.addNode(mutable, "B")
|
|
1110
|
+
* Graph.addEdge(mutable, a, b, "A-B")
|
|
1111
|
+
* })
|
|
1112
|
+
*
|
|
1113
|
+
* const result = Graph.complement(graph, (source, target) => `${source}-${target}`)
|
|
1114
|
+
*
|
|
1115
|
+
* Graph.edgeCount(result) // => 1
|
|
1116
|
+
* ```
|
|
1117
|
+
*
|
|
1118
|
+
* @category set operations
|
|
1119
|
+
* @since 4.0.0
|
|
1120
|
+
*/
|
|
1121
|
+
export declare const complement: {
|
|
1122
|
+
/**
|
|
1123
|
+
* Returns the complement over the existing node set.
|
|
1124
|
+
*
|
|
1125
|
+
* **Details**
|
|
1126
|
+
*
|
|
1127
|
+
* Adds every missing edge between distinct nodes. The `createEdge` function
|
|
1128
|
+
* receives the source and target node data for each added edge. The result has
|
|
1129
|
+
* the same graph kind as `self`.
|
|
1130
|
+
*
|
|
1131
|
+
* `G' = {V, (V x V) \ E}`
|
|
1132
|
+
*
|
|
1133
|
+
* **Example** (Finding missing relationships)
|
|
1134
|
+
*
|
|
1135
|
+
* ```ts import.meta.vitest
|
|
1136
|
+
* import { Graph } from "effect"
|
|
1137
|
+
*
|
|
1138
|
+
* const graph = Graph.directed<string, string>((mutable) => {
|
|
1139
|
+
* const a = Graph.addNode(mutable, "A")
|
|
1140
|
+
* const b = Graph.addNode(mutable, "B")
|
|
1141
|
+
* Graph.addEdge(mutable, a, b, "A-B")
|
|
1142
|
+
* })
|
|
1143
|
+
*
|
|
1144
|
+
* const result = Graph.complement(graph, (source, target) => `${source}-${target}`)
|
|
1145
|
+
*
|
|
1146
|
+
* Graph.edgeCount(result) // => 1
|
|
1147
|
+
* ```
|
|
1148
|
+
*
|
|
1149
|
+
* @category set operations
|
|
1150
|
+
* @since 4.0.0
|
|
1151
|
+
*/
|
|
1152
|
+
<N, E>(createEdge: (source: N, target: N) => E): <T extends Kind = "directed">(self: Graph<N, E, T>) => Graph<N, E, T>;
|
|
1153
|
+
/**
|
|
1154
|
+
* Returns the complement over the existing node set.
|
|
1155
|
+
*
|
|
1156
|
+
* **Details**
|
|
1157
|
+
*
|
|
1158
|
+
* Adds every missing edge between distinct nodes. The `createEdge` function
|
|
1159
|
+
* receives the source and target node data for each added edge. The result has
|
|
1160
|
+
* the same graph kind as `self`.
|
|
1161
|
+
*
|
|
1162
|
+
* `G' = {V, (V x V) \ E}`
|
|
1163
|
+
*
|
|
1164
|
+
* **Example** (Finding missing relationships)
|
|
1165
|
+
*
|
|
1166
|
+
* ```ts import.meta.vitest
|
|
1167
|
+
* import { Graph } from "effect"
|
|
1168
|
+
*
|
|
1169
|
+
* const graph = Graph.directed<string, string>((mutable) => {
|
|
1170
|
+
* const a = Graph.addNode(mutable, "A")
|
|
1171
|
+
* const b = Graph.addNode(mutable, "B")
|
|
1172
|
+
* Graph.addEdge(mutable, a, b, "A-B")
|
|
1173
|
+
* })
|
|
1174
|
+
*
|
|
1175
|
+
* const result = Graph.complement(graph, (source, target) => `${source}-${target}`)
|
|
1176
|
+
*
|
|
1177
|
+
* Graph.edgeCount(result) // => 1
|
|
1178
|
+
* ```
|
|
1179
|
+
*
|
|
1180
|
+
* @category set operations
|
|
1181
|
+
* @since 4.0.0
|
|
1182
|
+
*/
|
|
1183
|
+
<N, E, T extends Kind = "directed">(self: Graph<N, E, T>, createEdge: (source: N, target: N) => E): Graph<N, E, T>;
|
|
1184
|
+
};
|
|
1185
|
+
/**
|
|
1186
|
+
* Configuration for selecting a graph neighborhood.
|
|
1187
|
+
*
|
|
1188
|
+
* **Details**
|
|
1189
|
+
*
|
|
1190
|
+
* `radius` limits the edge distance from the center node and defaults to `1`.
|
|
1191
|
+
* `direction` controls how directed edges are traversed and defaults to
|
|
1192
|
+
* `"outgoing"`.
|
|
1193
|
+
*
|
|
1194
|
+
* @category models
|
|
1195
|
+
* @since 4.0.0
|
|
1196
|
+
*/
|
|
1197
|
+
export interface NeighborhoodConfig {
|
|
1198
|
+
readonly radius?: number;
|
|
1199
|
+
readonly direction?: TraversalDirection;
|
|
1200
|
+
}
|
|
1201
|
+
/**
|
|
1202
|
+
* Returns the induced subgraph containing nodes within a radius of a node.
|
|
351
1203
|
*
|
|
352
|
-
* **
|
|
1204
|
+
* **Details**
|
|
1205
|
+
*
|
|
1206
|
+
* The `radius` option is the maximum edge distance from `nodeIndex` and
|
|
1207
|
+
* defaults to `1`. The `direction` option controls directed graph traversal and
|
|
1208
|
+
* defaults to `"outgoing"`. The result has the same graph kind as `self` and
|
|
1209
|
+
* keeps all original edges whose endpoints are both reached. `"undirected"`
|
|
1210
|
+
* ignores edge direction while finding reachable nodes.
|
|
353
1211
|
*
|
|
354
|
-
*
|
|
1212
|
+
* **Example** (Getting a local neighborhood)
|
|
1213
|
+
*
|
|
1214
|
+
* ```ts import.meta.vitest
|
|
355
1215
|
* import { Graph } from "effect"
|
|
356
1216
|
*
|
|
357
|
-
* const graph = Graph.directed<string,
|
|
358
|
-
*
|
|
359
|
-
* const
|
|
360
|
-
* const
|
|
361
|
-
* Graph.addEdge(mutable,
|
|
1217
|
+
* const graph = Graph.directed<string, string>((mutable) => {
|
|
1218
|
+
* const a = Graph.addNode(mutable, "A")
|
|
1219
|
+
* const b = Graph.addNode(mutable, "B")
|
|
1220
|
+
* const c = Graph.addNode(mutable, "C")
|
|
1221
|
+
* Graph.addEdge(mutable, a, b, "A-B")
|
|
1222
|
+
* Graph.addEdge(mutable, b, c, "B-C")
|
|
362
1223
|
* })
|
|
363
1224
|
*
|
|
364
|
-
*
|
|
365
|
-
*
|
|
1225
|
+
* const result = Graph.neighborhood(graph, 1, { radius: 1 })
|
|
1226
|
+
*
|
|
1227
|
+
* Graph.nodeCount(result) // => 2
|
|
366
1228
|
* ```
|
|
367
1229
|
*
|
|
368
|
-
* @category
|
|
369
|
-
* @since
|
|
1230
|
+
* @category set operations
|
|
1231
|
+
* @since 4.0.0
|
|
370
1232
|
*/
|
|
371
|
-
export declare const
|
|
1233
|
+
export declare const neighborhood: {
|
|
372
1234
|
/**
|
|
373
|
-
*
|
|
1235
|
+
* Returns the induced subgraph containing nodes within a radius of a node.
|
|
374
1236
|
*
|
|
375
|
-
* **
|
|
1237
|
+
* **Details**
|
|
376
1238
|
*
|
|
377
|
-
*
|
|
1239
|
+
* The `radius` option is the maximum edge distance from `nodeIndex` and
|
|
1240
|
+
* defaults to `1`. The `direction` option controls directed graph traversal and
|
|
1241
|
+
* defaults to `"outgoing"`. The result has the same graph kind as `self` and
|
|
1242
|
+
* keeps all original edges whose endpoints are both reached. `"undirected"`
|
|
1243
|
+
* ignores edge direction while finding reachable nodes.
|
|
1244
|
+
*
|
|
1245
|
+
* **Example** (Getting a local neighborhood)
|
|
1246
|
+
*
|
|
1247
|
+
* ```ts import.meta.vitest
|
|
378
1248
|
* import { Graph } from "effect"
|
|
379
1249
|
*
|
|
380
|
-
* const graph = Graph.directed<string,
|
|
381
|
-
*
|
|
382
|
-
* const
|
|
383
|
-
* const
|
|
384
|
-
* Graph.addEdge(mutable,
|
|
1250
|
+
* const graph = Graph.directed<string, string>((mutable) => {
|
|
1251
|
+
* const a = Graph.addNode(mutable, "A")
|
|
1252
|
+
* const b = Graph.addNode(mutable, "B")
|
|
1253
|
+
* const c = Graph.addNode(mutable, "C")
|
|
1254
|
+
* Graph.addEdge(mutable, a, b, "A-B")
|
|
1255
|
+
* Graph.addEdge(mutable, b, c, "B-C")
|
|
385
1256
|
* })
|
|
386
1257
|
*
|
|
387
|
-
*
|
|
388
|
-
*
|
|
1258
|
+
* const result = Graph.neighborhood(graph, 1, { radius: 1 })
|
|
1259
|
+
*
|
|
1260
|
+
* Graph.nodeCount(result) // => 2
|
|
389
1261
|
* ```
|
|
390
1262
|
*
|
|
391
|
-
* @category
|
|
392
|
-
* @since
|
|
1263
|
+
* @category set operations
|
|
1264
|
+
* @since 4.0.0
|
|
393
1265
|
*/
|
|
394
|
-
<N, E, T extends Kind = "directed">(
|
|
1266
|
+
(nodeIndex: NodeIndex, options?: NeighborhoodConfig): <N, E, T extends Kind = "directed">(self: Graph<N, E, T>) => Graph<N, E, T>;
|
|
395
1267
|
/**
|
|
396
|
-
*
|
|
1268
|
+
* Returns the induced subgraph containing nodes within a radius of a node.
|
|
397
1269
|
*
|
|
398
|
-
* **
|
|
1270
|
+
* **Details**
|
|
1271
|
+
*
|
|
1272
|
+
* The `radius` option is the maximum edge distance from `nodeIndex` and
|
|
1273
|
+
* defaults to `1`. The `direction` option controls directed graph traversal and
|
|
1274
|
+
* defaults to `"outgoing"`. The result has the same graph kind as `self` and
|
|
1275
|
+
* keeps all original edges whose endpoints are both reached. `"undirected"`
|
|
1276
|
+
* ignores edge direction while finding reachable nodes.
|
|
1277
|
+
*
|
|
1278
|
+
* **Example** (Getting a local neighborhood)
|
|
399
1279
|
*
|
|
400
|
-
* ```ts
|
|
1280
|
+
* ```ts import.meta.vitest
|
|
401
1281
|
* import { Graph } from "effect"
|
|
402
1282
|
*
|
|
403
|
-
* const graph = Graph.directed<string,
|
|
404
|
-
*
|
|
405
|
-
* const
|
|
406
|
-
* const
|
|
407
|
-
* Graph.addEdge(mutable,
|
|
1283
|
+
* const graph = Graph.directed<string, string>((mutable) => {
|
|
1284
|
+
* const a = Graph.addNode(mutable, "A")
|
|
1285
|
+
* const b = Graph.addNode(mutable, "B")
|
|
1286
|
+
* const c = Graph.addNode(mutable, "C")
|
|
1287
|
+
* Graph.addEdge(mutable, a, b, "A-B")
|
|
1288
|
+
* Graph.addEdge(mutable, b, c, "B-C")
|
|
408
1289
|
* })
|
|
409
1290
|
*
|
|
410
|
-
*
|
|
411
|
-
*
|
|
1291
|
+
* const result = Graph.neighborhood(graph, 1, { radius: 1 })
|
|
1292
|
+
*
|
|
1293
|
+
* Graph.nodeCount(result) // => 2
|
|
412
1294
|
* ```
|
|
413
1295
|
*
|
|
414
|
-
* @category
|
|
415
|
-
* @since
|
|
1296
|
+
* @category set operations
|
|
1297
|
+
* @since 4.0.0
|
|
1298
|
+
*/
|
|
1299
|
+
<N, E, T extends Kind = "directed">(self: Graph<N, E, T>, nodeIndex: NodeIndex, options?: NeighborhoodConfig): Graph<N, E, T>;
|
|
1300
|
+
};
|
|
1301
|
+
/**
|
|
1302
|
+
* Returns the disjoint union of two graphs.
|
|
1303
|
+
*
|
|
1304
|
+
* **Details**
|
|
1305
|
+
*
|
|
1306
|
+
* Copies all nodes and edges from both graphs without merging equal node data.
|
|
1307
|
+
* The result has the same graph kind as `self`. Throws a `GraphError` when the
|
|
1308
|
+
* graph kinds do not match.
|
|
1309
|
+
*
|
|
1310
|
+
* `G1 + G2 = {disjoint V1 + V2, disjoint E1 + E2}`
|
|
1311
|
+
*
|
|
1312
|
+
* @category set operations
|
|
1313
|
+
* @since 4.0.0
|
|
1314
|
+
*/
|
|
1315
|
+
export declare const sum: {
|
|
1316
|
+
/**
|
|
1317
|
+
* Returns the disjoint union of two graphs.
|
|
1318
|
+
*
|
|
1319
|
+
* **Details**
|
|
1320
|
+
*
|
|
1321
|
+
* Copies all nodes and edges from both graphs without merging equal node data.
|
|
1322
|
+
* The result has the same graph kind as `self`. Throws a `GraphError` when the
|
|
1323
|
+
* graph kinds do not match.
|
|
1324
|
+
*
|
|
1325
|
+
* `G1 + G2 = {disjoint V1 + V2, disjoint E1 + E2}`
|
|
1326
|
+
*
|
|
1327
|
+
* @category set operations
|
|
1328
|
+
* @since 4.0.0
|
|
1329
|
+
*/
|
|
1330
|
+
<N, E, T extends Kind>(that: Graph<N, E, T>): (self: Graph<N, E, NoInfer<T>>) => Graph<N, E, T>;
|
|
1331
|
+
/**
|
|
1332
|
+
* Returns the disjoint union of two graphs.
|
|
1333
|
+
*
|
|
1334
|
+
* **Details**
|
|
1335
|
+
*
|
|
1336
|
+
* Copies all nodes and edges from both graphs without merging equal node data.
|
|
1337
|
+
* The result has the same graph kind as `self`. Throws a `GraphError` when the
|
|
1338
|
+
* graph kinds do not match.
|
|
1339
|
+
*
|
|
1340
|
+
* `G1 + G2 = {disjoint V1 + V2, disjoint E1 + E2}`
|
|
1341
|
+
*
|
|
1342
|
+
* @category set operations
|
|
1343
|
+
* @since 4.0.0
|
|
416
1344
|
*/
|
|
417
|
-
<N, E, T extends Kind
|
|
1345
|
+
<N, E, T extends Kind>(self: Graph<N, E, T>, that: Graph<N, E, NoInfer<T>>): Graph<N, E, T>;
|
|
418
1346
|
};
|
|
419
1347
|
/**
|
|
420
1348
|
* Adds a new node to a mutable graph and returns its index.
|
|
@@ -436,14 +1364,12 @@ export declare const mutate: {
|
|
|
436
1364
|
*
|
|
437
1365
|
* **Example** (Adding nodes)
|
|
438
1366
|
*
|
|
439
|
-
* ```ts
|
|
1367
|
+
* ```ts import.meta.vitest
|
|
440
1368
|
* import { Graph } from "effect"
|
|
441
1369
|
*
|
|
442
|
-
*
|
|
443
|
-
*
|
|
444
|
-
*
|
|
445
|
-
* console.log(nodeA) // NodeIndex with value 0
|
|
446
|
-
* console.log(nodeB) // NodeIndex with value 1
|
|
1370
|
+
* Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
1371
|
+
* Graph.addNode(mutable, "Node A") // => 0
|
|
1372
|
+
* Graph.addNode(mutable, "Node B") // => 1
|
|
447
1373
|
* })
|
|
448
1374
|
* ```
|
|
449
1375
|
*
|
|
@@ -460,19 +1386,14 @@ export declare const addNode: <N, E, T extends Kind = "directed">(mutable: Mutab
|
|
|
460
1386
|
*
|
|
461
1387
|
* **Example** (Getting node data)
|
|
462
1388
|
*
|
|
463
|
-
* ```ts
|
|
1389
|
+
* ```ts import.meta.vitest
|
|
464
1390
|
* import { Graph, Option } from "effect"
|
|
465
1391
|
*
|
|
466
1392
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
467
1393
|
* Graph.addNode(mutable, "Node A")
|
|
468
1394
|
* })
|
|
469
1395
|
*
|
|
470
|
-
*
|
|
471
|
-
* const nodeData = Graph.getNode(graph, nodeIndex)
|
|
472
|
-
*
|
|
473
|
-
* if (Option.isSome(nodeData)) {
|
|
474
|
-
* console.log(nodeData.value) // "Node A"
|
|
475
|
-
* }
|
|
1396
|
+
* Graph.getNode(graph, 0) // => Option.some("Node A")
|
|
476
1397
|
* ```
|
|
477
1398
|
*
|
|
478
1399
|
* @category getters
|
|
@@ -484,43 +1405,33 @@ export declare const getNode: {
|
|
|
484
1405
|
*
|
|
485
1406
|
* **Example** (Getting node data)
|
|
486
1407
|
*
|
|
487
|
-
* ```ts
|
|
1408
|
+
* ```ts import.meta.vitest
|
|
488
1409
|
* import { Graph, Option } from "effect"
|
|
489
1410
|
*
|
|
490
1411
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
491
1412
|
* Graph.addNode(mutable, "Node A")
|
|
492
1413
|
* })
|
|
493
1414
|
*
|
|
494
|
-
*
|
|
495
|
-
* const nodeData = Graph.getNode(graph, nodeIndex)
|
|
496
|
-
*
|
|
497
|
-
* if (Option.isSome(nodeData)) {
|
|
498
|
-
* console.log(nodeData.value) // "Node A"
|
|
499
|
-
* }
|
|
1415
|
+
* Graph.getNode(graph, 0) // => Option.some("Node A")
|
|
500
1416
|
* ```
|
|
501
1417
|
*
|
|
502
1418
|
* @category getters
|
|
503
1419
|
* @since 3.18.0
|
|
504
1420
|
*/
|
|
505
|
-
<N, E, T extends Kind = "directed">(
|
|
1421
|
+
(nodeIndex: NodeIndex): <N, E, T extends Kind = "directed">(graph: Graph<N, E, T> | MutableGraph<N, E, T>) => Option.Option<N>;
|
|
506
1422
|
/**
|
|
507
1423
|
* Gets the data associated with a node index safely, if it exists.
|
|
508
1424
|
*
|
|
509
1425
|
* **Example** (Getting node data)
|
|
510
1426
|
*
|
|
511
|
-
* ```ts
|
|
1427
|
+
* ```ts import.meta.vitest
|
|
512
1428
|
* import { Graph, Option } from "effect"
|
|
513
1429
|
*
|
|
514
1430
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
515
1431
|
* Graph.addNode(mutable, "Node A")
|
|
516
1432
|
* })
|
|
517
1433
|
*
|
|
518
|
-
*
|
|
519
|
-
* const nodeData = Graph.getNode(graph, nodeIndex)
|
|
520
|
-
*
|
|
521
|
-
* if (Option.isSome(nodeData)) {
|
|
522
|
-
* console.log(nodeData.value) // "Node A"
|
|
523
|
-
* }
|
|
1434
|
+
* Graph.getNode(graph, 0) // => Option.some("Node A")
|
|
524
1435
|
* ```
|
|
525
1436
|
*
|
|
526
1437
|
* @category getters
|
|
@@ -533,20 +1444,15 @@ export declare const getNode: {
|
|
|
533
1444
|
*
|
|
534
1445
|
* **Example** (Checking node existence)
|
|
535
1446
|
*
|
|
536
|
-
* ```ts
|
|
1447
|
+
* ```ts import.meta.vitest
|
|
537
1448
|
* import { Graph } from "effect"
|
|
538
1449
|
*
|
|
539
1450
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
540
1451
|
* Graph.addNode(mutable, "Node A")
|
|
541
1452
|
* })
|
|
542
1453
|
*
|
|
543
|
-
*
|
|
544
|
-
*
|
|
545
|
-
* console.log(exists) // true
|
|
546
|
-
*
|
|
547
|
-
* const nonExistentIndex = 999
|
|
548
|
-
* const notExists = Graph.hasNode(graph, nonExistentIndex)
|
|
549
|
-
* console.log(notExists) // false
|
|
1454
|
+
* Graph.hasNode(graph, 0) // => true
|
|
1455
|
+
* Graph.hasNode(graph, 999) // => false
|
|
550
1456
|
* ```
|
|
551
1457
|
*
|
|
552
1458
|
* @category getters
|
|
@@ -558,20 +1464,15 @@ export declare const hasNode: {
|
|
|
558
1464
|
*
|
|
559
1465
|
* **Example** (Checking node existence)
|
|
560
1466
|
*
|
|
561
|
-
* ```ts
|
|
1467
|
+
* ```ts import.meta.vitest
|
|
562
1468
|
* import { Graph } from "effect"
|
|
563
1469
|
*
|
|
564
1470
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
565
1471
|
* Graph.addNode(mutable, "Node A")
|
|
566
1472
|
* })
|
|
567
1473
|
*
|
|
568
|
-
*
|
|
569
|
-
*
|
|
570
|
-
* console.log(exists) // true
|
|
571
|
-
*
|
|
572
|
-
* const nonExistentIndex = 999
|
|
573
|
-
* const notExists = Graph.hasNode(graph, nonExistentIndex)
|
|
574
|
-
* console.log(notExists) // false
|
|
1474
|
+
* Graph.hasNode(graph, 0) // => true
|
|
1475
|
+
* Graph.hasNode(graph, 999) // => false
|
|
575
1476
|
* ```
|
|
576
1477
|
*
|
|
577
1478
|
* @category getters
|
|
@@ -583,20 +1484,15 @@ export declare const hasNode: {
|
|
|
583
1484
|
*
|
|
584
1485
|
* **Example** (Checking node existence)
|
|
585
1486
|
*
|
|
586
|
-
* ```ts
|
|
1487
|
+
* ```ts import.meta.vitest
|
|
587
1488
|
* import { Graph } from "effect"
|
|
588
1489
|
*
|
|
589
1490
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
590
1491
|
* Graph.addNode(mutable, "Node A")
|
|
591
1492
|
* })
|
|
592
1493
|
*
|
|
593
|
-
*
|
|
594
|
-
*
|
|
595
|
-
* console.log(exists) // true
|
|
596
|
-
*
|
|
597
|
-
* const nonExistentIndex = 999
|
|
598
|
-
* const notExists = Graph.hasNode(graph, nonExistentIndex)
|
|
599
|
-
* console.log(notExists) // false
|
|
1494
|
+
* Graph.hasNode(graph, 0) // => true
|
|
1495
|
+
* Graph.hasNode(graph, 999) // => false
|
|
600
1496
|
* ```
|
|
601
1497
|
*
|
|
602
1498
|
* @category getters
|
|
@@ -609,11 +1505,11 @@ export declare const hasNode: {
|
|
|
609
1505
|
*
|
|
610
1506
|
* **Example** (Counting nodes)
|
|
611
1507
|
*
|
|
612
|
-
* ```ts
|
|
1508
|
+
* ```ts import.meta.vitest
|
|
613
1509
|
* import { Graph } from "effect"
|
|
614
1510
|
*
|
|
615
1511
|
* const emptyGraph = Graph.directed<string, number>()
|
|
616
|
-
*
|
|
1512
|
+
* Graph.nodeCount(emptyGraph) // => 0
|
|
617
1513
|
*
|
|
618
1514
|
* const graphWithNodes = Graph.mutate(emptyGraph, (mutable) => {
|
|
619
1515
|
* Graph.addNode(mutable, "Node A")
|
|
@@ -621,7 +1517,7 @@ export declare const hasNode: {
|
|
|
621
1517
|
* Graph.addNode(mutable, "Node C")
|
|
622
1518
|
* })
|
|
623
1519
|
*
|
|
624
|
-
*
|
|
1520
|
+
* Graph.nodeCount(graphWithNodes) // => 3
|
|
625
1521
|
* ```
|
|
626
1522
|
*
|
|
627
1523
|
* @category getters
|
|
@@ -633,8 +1529,8 @@ export declare const nodeCount: <N, E, T extends Kind = "directed">(graph: Graph
|
|
|
633
1529
|
*
|
|
634
1530
|
* **Example** (Finding the first matching node)
|
|
635
1531
|
*
|
|
636
|
-
* ```ts
|
|
637
|
-
* import { Graph } from "effect"
|
|
1532
|
+
* ```ts import.meta.vitest
|
|
1533
|
+
* import { Graph, Option } from "effect"
|
|
638
1534
|
*
|
|
639
1535
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
640
1536
|
* Graph.addNode(mutable, "Node A")
|
|
@@ -642,11 +1538,8 @@ export declare const nodeCount: <N, E, T extends Kind = "directed">(graph: Graph
|
|
|
642
1538
|
* Graph.addNode(mutable, "Node C")
|
|
643
1539
|
* })
|
|
644
1540
|
*
|
|
645
|
-
*
|
|
646
|
-
*
|
|
647
|
-
*
|
|
648
|
-
* const notFound = Graph.findNode(graph, (data) => data === "Node D")
|
|
649
|
-
* console.log(notFound) // Option.none()
|
|
1541
|
+
* Graph.findNode(graph, (data) => data.startsWith("Node B")) // => Option.some(1)
|
|
1542
|
+
* Graph.findNode(graph, (data) => data === "Node D") // => Option.none()
|
|
650
1543
|
* ```
|
|
651
1544
|
*
|
|
652
1545
|
* @category getters
|
|
@@ -658,8 +1551,8 @@ export declare const findNode: {
|
|
|
658
1551
|
*
|
|
659
1552
|
* **Example** (Finding the first matching node)
|
|
660
1553
|
*
|
|
661
|
-
* ```ts
|
|
662
|
-
* import { Graph } from "effect"
|
|
1554
|
+
* ```ts import.meta.vitest
|
|
1555
|
+
* import { Graph, Option } from "effect"
|
|
663
1556
|
*
|
|
664
1557
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
665
1558
|
* Graph.addNode(mutable, "Node A")
|
|
@@ -667,11 +1560,8 @@ export declare const findNode: {
|
|
|
667
1560
|
* Graph.addNode(mutable, "Node C")
|
|
668
1561
|
* })
|
|
669
1562
|
*
|
|
670
|
-
*
|
|
671
|
-
*
|
|
672
|
-
*
|
|
673
|
-
* const notFound = Graph.findNode(graph, (data) => data === "Node D")
|
|
674
|
-
* console.log(notFound) // Option.none()
|
|
1563
|
+
* Graph.findNode(graph, (data) => data.startsWith("Node B")) // => Option.some(1)
|
|
1564
|
+
* Graph.findNode(graph, (data) => data === "Node D") // => Option.none()
|
|
675
1565
|
* ```
|
|
676
1566
|
*
|
|
677
1567
|
* @category getters
|
|
@@ -683,8 +1573,8 @@ export declare const findNode: {
|
|
|
683
1573
|
*
|
|
684
1574
|
* **Example** (Finding the first matching node)
|
|
685
1575
|
*
|
|
686
|
-
* ```ts
|
|
687
|
-
* import { Graph } from "effect"
|
|
1576
|
+
* ```ts import.meta.vitest
|
|
1577
|
+
* import { Graph, Option } from "effect"
|
|
688
1578
|
*
|
|
689
1579
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
690
1580
|
* Graph.addNode(mutable, "Node A")
|
|
@@ -692,11 +1582,8 @@ export declare const findNode: {
|
|
|
692
1582
|
* Graph.addNode(mutable, "Node C")
|
|
693
1583
|
* })
|
|
694
1584
|
*
|
|
695
|
-
*
|
|
696
|
-
*
|
|
697
|
-
*
|
|
698
|
-
* const notFound = Graph.findNode(graph, (data) => data === "Node D")
|
|
699
|
-
* console.log(notFound) // Option.none()
|
|
1585
|
+
* Graph.findNode(graph, (data) => data.startsWith("Node B")) // => Option.some(1)
|
|
1586
|
+
* Graph.findNode(graph, (data) => data === "Node D") // => Option.none()
|
|
700
1587
|
* ```
|
|
701
1588
|
*
|
|
702
1589
|
* @category getters
|
|
@@ -709,7 +1596,7 @@ export declare const findNode: {
|
|
|
709
1596
|
*
|
|
710
1597
|
* **Example** (Finding matching nodes)
|
|
711
1598
|
*
|
|
712
|
-
* ```ts
|
|
1599
|
+
* ```ts import.meta.vitest
|
|
713
1600
|
* import { Graph } from "effect"
|
|
714
1601
|
*
|
|
715
1602
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
@@ -718,11 +1605,8 @@ export declare const findNode: {
|
|
|
718
1605
|
* Graph.addNode(mutable, "Start C")
|
|
719
1606
|
* })
|
|
720
1607
|
*
|
|
721
|
-
*
|
|
722
|
-
*
|
|
723
|
-
*
|
|
724
|
-
* const empty = Graph.findNodes(graph, (data) => data === "Not Found")
|
|
725
|
-
* console.log(empty) // []
|
|
1608
|
+
* Graph.findNodes(graph, (data) => data.startsWith("Start")) // => [0, 2]
|
|
1609
|
+
* Graph.findNodes(graph, (data) => data === "Not Found") // => []
|
|
726
1610
|
* ```
|
|
727
1611
|
*
|
|
728
1612
|
* @category getters
|
|
@@ -734,7 +1618,7 @@ export declare const findNodes: {
|
|
|
734
1618
|
*
|
|
735
1619
|
* **Example** (Finding matching nodes)
|
|
736
1620
|
*
|
|
737
|
-
* ```ts
|
|
1621
|
+
* ```ts import.meta.vitest
|
|
738
1622
|
* import { Graph } from "effect"
|
|
739
1623
|
*
|
|
740
1624
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
@@ -743,11 +1627,8 @@ export declare const findNodes: {
|
|
|
743
1627
|
* Graph.addNode(mutable, "Start C")
|
|
744
1628
|
* })
|
|
745
1629
|
*
|
|
746
|
-
*
|
|
747
|
-
*
|
|
748
|
-
*
|
|
749
|
-
* const empty = Graph.findNodes(graph, (data) => data === "Not Found")
|
|
750
|
-
* console.log(empty) // []
|
|
1630
|
+
* Graph.findNodes(graph, (data) => data.startsWith("Start")) // => [0, 2]
|
|
1631
|
+
* Graph.findNodes(graph, (data) => data === "Not Found") // => []
|
|
751
1632
|
* ```
|
|
752
1633
|
*
|
|
753
1634
|
* @category getters
|
|
@@ -759,7 +1640,7 @@ export declare const findNodes: {
|
|
|
759
1640
|
*
|
|
760
1641
|
* **Example** (Finding matching nodes)
|
|
761
1642
|
*
|
|
762
|
-
* ```ts
|
|
1643
|
+
* ```ts import.meta.vitest
|
|
763
1644
|
* import { Graph } from "effect"
|
|
764
1645
|
*
|
|
765
1646
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
@@ -768,11 +1649,8 @@ export declare const findNodes: {
|
|
|
768
1649
|
* Graph.addNode(mutable, "Start C")
|
|
769
1650
|
* })
|
|
770
1651
|
*
|
|
771
|
-
*
|
|
772
|
-
*
|
|
773
|
-
*
|
|
774
|
-
* const empty = Graph.findNodes(graph, (data) => data === "Not Found")
|
|
775
|
-
* console.log(empty) // []
|
|
1652
|
+
* Graph.findNodes(graph, (data) => data.startsWith("Start")) // => [0, 2]
|
|
1653
|
+
* Graph.findNodes(graph, (data) => data === "Not Found") // => []
|
|
776
1654
|
* ```
|
|
777
1655
|
*
|
|
778
1656
|
* @category getters
|
|
@@ -785,8 +1663,8 @@ export declare const findNodes: {
|
|
|
785
1663
|
*
|
|
786
1664
|
* **Example** (Finding the first matching edge)
|
|
787
1665
|
*
|
|
788
|
-
* ```ts
|
|
789
|
-
* import { Graph } from "effect"
|
|
1666
|
+
* ```ts import.meta.vitest
|
|
1667
|
+
* import { Graph, Option } from "effect"
|
|
790
1668
|
*
|
|
791
1669
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
792
1670
|
* const nodeA = Graph.addNode(mutable, "Node A")
|
|
@@ -796,11 +1674,8 @@ export declare const findNodes: {
|
|
|
796
1674
|
* Graph.addEdge(mutable, nodeB, nodeC, 20)
|
|
797
1675
|
* })
|
|
798
1676
|
*
|
|
799
|
-
*
|
|
800
|
-
*
|
|
801
|
-
*
|
|
802
|
-
* const notFound = Graph.findEdge(graph, (data) => data > 100)
|
|
803
|
-
* console.log(notFound) // Option.none()
|
|
1677
|
+
* Graph.findEdge(graph, (data) => data > 15) // => Option.some(1)
|
|
1678
|
+
* Graph.findEdge(graph, (data) => data > 100) // => Option.none()
|
|
804
1679
|
* ```
|
|
805
1680
|
*
|
|
806
1681
|
* @category getters
|
|
@@ -812,8 +1687,8 @@ export declare const findEdge: {
|
|
|
812
1687
|
*
|
|
813
1688
|
* **Example** (Finding the first matching edge)
|
|
814
1689
|
*
|
|
815
|
-
* ```ts
|
|
816
|
-
* import { Graph } from "effect"
|
|
1690
|
+
* ```ts import.meta.vitest
|
|
1691
|
+
* import { Graph, Option } from "effect"
|
|
817
1692
|
*
|
|
818
1693
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
819
1694
|
* const nodeA = Graph.addNode(mutable, "Node A")
|
|
@@ -823,11 +1698,8 @@ export declare const findEdge: {
|
|
|
823
1698
|
* Graph.addEdge(mutable, nodeB, nodeC, 20)
|
|
824
1699
|
* })
|
|
825
1700
|
*
|
|
826
|
-
*
|
|
827
|
-
*
|
|
828
|
-
*
|
|
829
|
-
* const notFound = Graph.findEdge(graph, (data) => data > 100)
|
|
830
|
-
* console.log(notFound) // Option.none()
|
|
1701
|
+
* Graph.findEdge(graph, (data) => data > 15) // => Option.some(1)
|
|
1702
|
+
* Graph.findEdge(graph, (data) => data > 100) // => Option.none()
|
|
831
1703
|
* ```
|
|
832
1704
|
*
|
|
833
1705
|
* @category getters
|
|
@@ -839,8 +1711,8 @@ export declare const findEdge: {
|
|
|
839
1711
|
*
|
|
840
1712
|
* **Example** (Finding the first matching edge)
|
|
841
1713
|
*
|
|
842
|
-
* ```ts
|
|
843
|
-
* import { Graph } from "effect"
|
|
1714
|
+
* ```ts import.meta.vitest
|
|
1715
|
+
* import { Graph, Option } from "effect"
|
|
844
1716
|
*
|
|
845
1717
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
846
1718
|
* const nodeA = Graph.addNode(mutable, "Node A")
|
|
@@ -850,11 +1722,8 @@ export declare const findEdge: {
|
|
|
850
1722
|
* Graph.addEdge(mutable, nodeB, nodeC, 20)
|
|
851
1723
|
* })
|
|
852
1724
|
*
|
|
853
|
-
*
|
|
854
|
-
*
|
|
855
|
-
*
|
|
856
|
-
* const notFound = Graph.findEdge(graph, (data) => data > 100)
|
|
857
|
-
* console.log(notFound) // Option.none()
|
|
1725
|
+
* Graph.findEdge(graph, (data) => data > 15) // => Option.some(1)
|
|
1726
|
+
* Graph.findEdge(graph, (data) => data > 100) // => Option.none()
|
|
858
1727
|
* ```
|
|
859
1728
|
*
|
|
860
1729
|
* @category getters
|
|
@@ -867,7 +1736,7 @@ export declare const findEdge: {
|
|
|
867
1736
|
*
|
|
868
1737
|
* **Example** (Finding matching edges)
|
|
869
1738
|
*
|
|
870
|
-
* ```ts
|
|
1739
|
+
* ```ts import.meta.vitest
|
|
871
1740
|
* import { Graph } from "effect"
|
|
872
1741
|
*
|
|
873
1742
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
@@ -879,11 +1748,8 @@ export declare const findEdge: {
|
|
|
879
1748
|
* Graph.addEdge(mutable, nodeC, nodeA, 30)
|
|
880
1749
|
* })
|
|
881
1750
|
*
|
|
882
|
-
*
|
|
883
|
-
*
|
|
884
|
-
*
|
|
885
|
-
* const empty = Graph.findEdges(graph, (data) => data > 100)
|
|
886
|
-
* console.log(empty) // []
|
|
1751
|
+
* Graph.findEdges(graph, (data) => data >= 20) // => [1, 2]
|
|
1752
|
+
* Graph.findEdges(graph, (data) => data > 100) // => []
|
|
887
1753
|
* ```
|
|
888
1754
|
*
|
|
889
1755
|
* @category getters
|
|
@@ -895,7 +1761,7 @@ export declare const findEdges: {
|
|
|
895
1761
|
*
|
|
896
1762
|
* **Example** (Finding matching edges)
|
|
897
1763
|
*
|
|
898
|
-
* ```ts
|
|
1764
|
+
* ```ts import.meta.vitest
|
|
899
1765
|
* import { Graph } from "effect"
|
|
900
1766
|
*
|
|
901
1767
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
@@ -907,11 +1773,8 @@ export declare const findEdges: {
|
|
|
907
1773
|
* Graph.addEdge(mutable, nodeC, nodeA, 30)
|
|
908
1774
|
* })
|
|
909
1775
|
*
|
|
910
|
-
*
|
|
911
|
-
*
|
|
912
|
-
*
|
|
913
|
-
* const empty = Graph.findEdges(graph, (data) => data > 100)
|
|
914
|
-
* console.log(empty) // []
|
|
1776
|
+
* Graph.findEdges(graph, (data) => data >= 20) // => [1, 2]
|
|
1777
|
+
* Graph.findEdges(graph, (data) => data > 100) // => []
|
|
915
1778
|
* ```
|
|
916
1779
|
*
|
|
917
1780
|
* @category getters
|
|
@@ -923,7 +1786,7 @@ export declare const findEdges: {
|
|
|
923
1786
|
*
|
|
924
1787
|
* **Example** (Finding matching edges)
|
|
925
1788
|
*
|
|
926
|
-
* ```ts
|
|
1789
|
+
* ```ts import.meta.vitest
|
|
927
1790
|
* import { Graph } from "effect"
|
|
928
1791
|
*
|
|
929
1792
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
@@ -935,11 +1798,8 @@ export declare const findEdges: {
|
|
|
935
1798
|
* Graph.addEdge(mutable, nodeC, nodeA, 30)
|
|
936
1799
|
* })
|
|
937
1800
|
*
|
|
938
|
-
*
|
|
939
|
-
*
|
|
940
|
-
*
|
|
941
|
-
* const empty = Graph.findEdges(graph, (data) => data > 100)
|
|
942
|
-
* console.log(empty) // []
|
|
1801
|
+
* Graph.findEdges(graph, (data) => data >= 20) // => [1, 2]
|
|
1802
|
+
* Graph.findEdges(graph, (data) => data > 100) // => []
|
|
943
1803
|
* ```
|
|
944
1804
|
*
|
|
945
1805
|
* @category getters
|
|
@@ -952,8 +1812,8 @@ export declare const findEdges: {
|
|
|
952
1812
|
*
|
|
953
1813
|
* **Example** (Updating node data)
|
|
954
1814
|
*
|
|
955
|
-
* ```ts
|
|
956
|
-
* import { Graph } from "effect"
|
|
1815
|
+
* ```ts import.meta.vitest
|
|
1816
|
+
* import { Graph, Option } from "effect"
|
|
957
1817
|
*
|
|
958
1818
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
959
1819
|
* Graph.addNode(mutable, "Node A")
|
|
@@ -961,8 +1821,7 @@ export declare const findEdges: {
|
|
|
961
1821
|
* Graph.updateNode(mutable, 0, (data) => data.toUpperCase())
|
|
962
1822
|
* })
|
|
963
1823
|
*
|
|
964
|
-
*
|
|
965
|
-
* console.log(nodeData) // Option.some("NODE A")
|
|
1824
|
+
* Graph.getNode(graph, 0) // => Option.some("NODE A")
|
|
966
1825
|
* ```
|
|
967
1826
|
*
|
|
968
1827
|
* @category transforming
|
|
@@ -974,8 +1833,8 @@ export declare const updateNode: <N, E, T extends Kind = "directed">(mutable: Mu
|
|
|
974
1833
|
*
|
|
975
1834
|
* **Example** (Updating edge data)
|
|
976
1835
|
*
|
|
977
|
-
* ```ts
|
|
978
|
-
* import { Graph } from "effect"
|
|
1836
|
+
* ```ts import.meta.vitest
|
|
1837
|
+
* import { Graph, Option } from "effect"
|
|
979
1838
|
*
|
|
980
1839
|
* const result = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
981
1840
|
* const nodeA = Graph.addNode(mutable, "Node A")
|
|
@@ -984,8 +1843,7 @@ export declare const updateNode: <N, E, T extends Kind = "directed">(mutable: Mu
|
|
|
984
1843
|
* Graph.updateEdge(mutable, edgeIndex, (data) => data * 2)
|
|
985
1844
|
* })
|
|
986
1845
|
*
|
|
987
|
-
*
|
|
988
|
-
* console.log(edgeData) // Option.some(new Graph.Edge({ source: 0, target: 1, data: 20 }))
|
|
1846
|
+
* Option.map(Graph.getEdge(result, 0), (edge) => edge.data) // => Option.some(20)
|
|
989
1847
|
* ```
|
|
990
1848
|
*
|
|
991
1849
|
* @category mutations
|
|
@@ -1002,8 +1860,8 @@ export declare const updateEdge: <N, E, T extends Kind = "directed">(mutable: Mu
|
|
|
1002
1860
|
*
|
|
1003
1861
|
* **Example** (Mapping node data)
|
|
1004
1862
|
*
|
|
1005
|
-
* ```ts
|
|
1006
|
-
* import { Graph } from "effect"
|
|
1863
|
+
* ```ts import.meta.vitest
|
|
1864
|
+
* import { Graph, Option } from "effect"
|
|
1007
1865
|
*
|
|
1008
1866
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
1009
1867
|
* Graph.addNode(mutable, "node a")
|
|
@@ -1012,8 +1870,7 @@ export declare const updateEdge: <N, E, T extends Kind = "directed">(mutable: Mu
|
|
|
1012
1870
|
* Graph.mapNodes(mutable, (data) => data.toUpperCase())
|
|
1013
1871
|
* })
|
|
1014
1872
|
*
|
|
1015
|
-
*
|
|
1016
|
-
* console.log(nodeData) // Option.some("NODE A")
|
|
1873
|
+
* Graph.getNode(graph, 0) // => Option.some("NODE A")
|
|
1017
1874
|
* ```
|
|
1018
1875
|
*
|
|
1019
1876
|
* @category transforming
|
|
@@ -1025,8 +1882,8 @@ export declare const mapNodes: <N, E, T extends Kind = "directed">(mutable: Muta
|
|
|
1025
1882
|
*
|
|
1026
1883
|
* **Example** (Mapping edge data)
|
|
1027
1884
|
*
|
|
1028
|
-
* ```ts
|
|
1029
|
-
* import { Graph } from "effect"
|
|
1885
|
+
* ```ts import.meta.vitest
|
|
1886
|
+
* import { Graph, Option } from "effect"
|
|
1030
1887
|
*
|
|
1031
1888
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
1032
1889
|
* const a = Graph.addNode(mutable, "A")
|
|
@@ -1037,8 +1894,7 @@ export declare const mapNodes: <N, E, T extends Kind = "directed">(mutable: Muta
|
|
|
1037
1894
|
* Graph.mapEdges(mutable, (data) => data * 2)
|
|
1038
1895
|
* })
|
|
1039
1896
|
*
|
|
1040
|
-
*
|
|
1041
|
-
* console.log(edgeData) // Option.some(new Graph.Edge({ source: 0, target: 1, data: 20 }))
|
|
1897
|
+
* Option.map(Graph.getEdge(graph, 0), (edge) => edge.data) // => Option.some(20)
|
|
1042
1898
|
* ```
|
|
1043
1899
|
*
|
|
1044
1900
|
* @category transforming
|
|
@@ -1050,8 +1906,8 @@ export declare const mapEdges: <N, E, T extends Kind = "directed">(mutable: Muta
|
|
|
1050
1906
|
*
|
|
1051
1907
|
* **Example** (Reversing edge directions)
|
|
1052
1908
|
*
|
|
1053
|
-
* ```ts
|
|
1054
|
-
* import { Graph } from "effect"
|
|
1909
|
+
* ```ts import.meta.vitest
|
|
1910
|
+
* import { Graph, Option } from "effect"
|
|
1055
1911
|
*
|
|
1056
1912
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
1057
1913
|
* const a = Graph.addNode(mutable, "A")
|
|
@@ -1062,8 +1918,7 @@ export declare const mapEdges: <N, E, T extends Kind = "directed">(mutable: Muta
|
|
|
1062
1918
|
* Graph.reverse(mutable) // Now B -> A, C -> B
|
|
1063
1919
|
* })
|
|
1064
1920
|
*
|
|
1065
|
-
*
|
|
1066
|
-
* console.log(edge0) // Option.some(new Graph.Edge({ source: 1, target: 0, data: 1 }))
|
|
1921
|
+
* Option.map(Graph.getEdge(graph, 0), (edge) => edge.source) // => Option.some(1)
|
|
1067
1922
|
* ```
|
|
1068
1923
|
*
|
|
1069
1924
|
* @category transforming
|
|
@@ -1076,7 +1931,7 @@ export declare const reverse: <N, E, T extends Kind = "directed">(mutable: Mutab
|
|
|
1076
1931
|
*
|
|
1077
1932
|
* **Example** (Filtering and mapping nodes)
|
|
1078
1933
|
*
|
|
1079
|
-
* ```ts
|
|
1934
|
+
* ```ts import.meta.vitest
|
|
1080
1935
|
* import { Graph, Option } from "effect"
|
|
1081
1936
|
*
|
|
1082
1937
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -1094,7 +1949,7 @@ export declare const reverse: <N, E, T extends Kind = "directed">(mutable: Mutab
|
|
|
1094
1949
|
* )
|
|
1095
1950
|
* })
|
|
1096
1951
|
*
|
|
1097
|
-
*
|
|
1952
|
+
* Graph.nodeCount(graph) // => 2
|
|
1098
1953
|
* ```
|
|
1099
1954
|
*
|
|
1100
1955
|
* @category transforming
|
|
@@ -1107,7 +1962,7 @@ export declare const filterMapNodes: <N, E, T extends Kind = "directed">(mutable
|
|
|
1107
1962
|
*
|
|
1108
1963
|
* **Example** (Filtering and mapping edges)
|
|
1109
1964
|
*
|
|
1110
|
-
* ```ts
|
|
1965
|
+
* ```ts import.meta.vitest
|
|
1111
1966
|
* import { Graph, Option } from "effect"
|
|
1112
1967
|
*
|
|
1113
1968
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -1125,7 +1980,7 @@ export declare const filterMapNodes: <N, E, T extends Kind = "directed">(mutable
|
|
|
1125
1980
|
* )
|
|
1126
1981
|
* })
|
|
1127
1982
|
*
|
|
1128
|
-
*
|
|
1983
|
+
* Graph.edgeCount(graph) // => 2
|
|
1129
1984
|
* ```
|
|
1130
1985
|
*
|
|
1131
1986
|
* @category transforming
|
|
@@ -1138,7 +1993,7 @@ export declare const filterMapEdges: <N, E, T extends Kind = "directed">(mutable
|
|
|
1138
1993
|
*
|
|
1139
1994
|
* **Example** (Filtering nodes)
|
|
1140
1995
|
*
|
|
1141
|
-
* ```ts
|
|
1996
|
+
* ```ts import.meta.vitest
|
|
1142
1997
|
* import { Graph } from "effect"
|
|
1143
1998
|
*
|
|
1144
1999
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -1151,7 +2006,7 @@ export declare const filterMapEdges: <N, E, T extends Kind = "directed">(mutable
|
|
|
1151
2006
|
* Graph.filterNodes(mutable, (data) => data === "active")
|
|
1152
2007
|
* })
|
|
1153
2008
|
*
|
|
1154
|
-
*
|
|
2009
|
+
* Graph.nodeCount(graph) // => 2
|
|
1155
2010
|
* ```
|
|
1156
2011
|
*
|
|
1157
2012
|
* @category transforming
|
|
@@ -1164,7 +2019,7 @@ export declare const filterNodes: <N, E, T extends Kind = "directed">(mutable: M
|
|
|
1164
2019
|
*
|
|
1165
2020
|
* **Example** (Filtering edges)
|
|
1166
2021
|
*
|
|
1167
|
-
* ```ts
|
|
2022
|
+
* ```ts import.meta.vitest
|
|
1168
2023
|
* import { Graph } from "effect"
|
|
1169
2024
|
*
|
|
1170
2025
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -1180,7 +2035,7 @@ export declare const filterNodes: <N, E, T extends Kind = "directed">(mutable: M
|
|
|
1180
2035
|
* Graph.filterEdges(mutable, (data) => data >= 10)
|
|
1181
2036
|
* })
|
|
1182
2037
|
*
|
|
1183
|
-
*
|
|
2038
|
+
* Graph.edgeCount(graph) // => 2
|
|
1184
2039
|
* ```
|
|
1185
2040
|
*
|
|
1186
2041
|
* @category transforming
|
|
@@ -1208,14 +2063,13 @@ export declare const filterEdges: <N, E, T extends Kind = "directed">(mutable: M
|
|
|
1208
2063
|
*
|
|
1209
2064
|
* **Example** (Adding edges)
|
|
1210
2065
|
*
|
|
1211
|
-
* ```ts
|
|
2066
|
+
* ```ts import.meta.vitest
|
|
1212
2067
|
* import { Graph } from "effect"
|
|
1213
2068
|
*
|
|
1214
|
-
*
|
|
2069
|
+
* Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
1215
2070
|
* const nodeA = Graph.addNode(mutable, "Node A")
|
|
1216
2071
|
* const nodeB = Graph.addNode(mutable, "Node B")
|
|
1217
|
-
*
|
|
1218
|
-
* console.log(edge) // EdgeIndex with value 0
|
|
2072
|
+
* Graph.addEdge(mutable, nodeA, nodeB, 42) // => 0
|
|
1219
2073
|
* })
|
|
1220
2074
|
* ```
|
|
1221
2075
|
*
|
|
@@ -1233,7 +2087,7 @@ export declare const addEdge: <N, E, T extends Kind = "directed">(mutable: Mutab
|
|
|
1233
2087
|
*
|
|
1234
2088
|
* **Example** (Removing a node)
|
|
1235
2089
|
*
|
|
1236
|
-
* ```ts
|
|
2090
|
+
* ```ts import.meta.vitest
|
|
1237
2091
|
* import { Graph } from "effect"
|
|
1238
2092
|
*
|
|
1239
2093
|
* const result = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
@@ -1244,6 +2098,7 @@ export declare const addEdge: <N, E, T extends Kind = "directed">(mutable: Mutab
|
|
|
1244
2098
|
* // Remove nodeA and all edges connected to it
|
|
1245
2099
|
* Graph.removeNode(mutable, nodeA)
|
|
1246
2100
|
* })
|
|
2101
|
+
* Array.of(Graph.nodeCount(result), Graph.edgeCount(result)) // => [1, 0]
|
|
1247
2102
|
* ```
|
|
1248
2103
|
*
|
|
1249
2104
|
* @category mutations
|
|
@@ -1255,7 +2110,7 @@ export declare const removeNode: <N, E, T extends Kind = "directed">(mutable: Mu
|
|
|
1255
2110
|
*
|
|
1256
2111
|
* **Example** (Removing an edge)
|
|
1257
2112
|
*
|
|
1258
|
-
* ```ts
|
|
2113
|
+
* ```ts import.meta.vitest
|
|
1259
2114
|
* import { Graph } from "effect"
|
|
1260
2115
|
*
|
|
1261
2116
|
* const result = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
@@ -1266,6 +2121,7 @@ export declare const removeNode: <N, E, T extends Kind = "directed">(mutable: Mu
|
|
|
1266
2121
|
* // Remove the edge
|
|
1267
2122
|
* Graph.removeEdge(mutable, edge)
|
|
1268
2123
|
* })
|
|
2124
|
+
* Array.of(Graph.nodeCount(result), Graph.edgeCount(result)) // => [2, 0]
|
|
1269
2125
|
* ```
|
|
1270
2126
|
*
|
|
1271
2127
|
* @category mutations
|
|
@@ -1277,8 +2133,8 @@ export declare const removeEdge: <N, E, T extends Kind = "directed">(mutable: Mu
|
|
|
1277
2133
|
*
|
|
1278
2134
|
* **Example** (Getting edge data)
|
|
1279
2135
|
*
|
|
1280
|
-
* ```ts
|
|
1281
|
-
* import { Graph } from "effect"
|
|
2136
|
+
* ```ts import.meta.vitest
|
|
2137
|
+
* import { Graph, Option } from "effect"
|
|
1282
2138
|
*
|
|
1283
2139
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
1284
2140
|
* const nodeA = Graph.addNode(mutable, "Node A")
|
|
@@ -1286,14 +2142,7 @@ export declare const removeEdge: <N, E, T extends Kind = "directed">(mutable: Mu
|
|
|
1286
2142
|
* Graph.addEdge(mutable, nodeA, nodeB, 42)
|
|
1287
2143
|
* })
|
|
1288
2144
|
*
|
|
1289
|
-
*
|
|
1290
|
-
* const edgeData = Graph.getEdge(graph, edgeIndex)
|
|
1291
|
-
*
|
|
1292
|
-
* if (edgeData._tag === "Some") {
|
|
1293
|
-
* console.log(edgeData.value.data) // 42
|
|
1294
|
-
* console.log(edgeData.value.source) // 0
|
|
1295
|
-
* console.log(edgeData.value.target) // 1
|
|
1296
|
-
* }
|
|
2145
|
+
* Graph.getEdge(graph, 0) // => Option.some(new Graph.Edge({ source: 0, target: 1, data: 42 }))
|
|
1297
2146
|
* ```
|
|
1298
2147
|
*
|
|
1299
2148
|
* @category getters
|
|
@@ -1305,8 +2154,8 @@ export declare const getEdge: {
|
|
|
1305
2154
|
*
|
|
1306
2155
|
* **Example** (Getting edge data)
|
|
1307
2156
|
*
|
|
1308
|
-
* ```ts
|
|
1309
|
-
* import { Graph } from "effect"
|
|
2157
|
+
* ```ts import.meta.vitest
|
|
2158
|
+
* import { Graph, Option } from "effect"
|
|
1310
2159
|
*
|
|
1311
2160
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
1312
2161
|
* const nodeA = Graph.addNode(mutable, "Node A")
|
|
@@ -1314,27 +2163,20 @@ export declare const getEdge: {
|
|
|
1314
2163
|
* Graph.addEdge(mutable, nodeA, nodeB, 42)
|
|
1315
2164
|
* })
|
|
1316
2165
|
*
|
|
1317
|
-
*
|
|
1318
|
-
* const edgeData = Graph.getEdge(graph, edgeIndex)
|
|
1319
|
-
*
|
|
1320
|
-
* if (edgeData._tag === "Some") {
|
|
1321
|
-
* console.log(edgeData.value.data) // 42
|
|
1322
|
-
* console.log(edgeData.value.source) // 0
|
|
1323
|
-
* console.log(edgeData.value.target) // 1
|
|
1324
|
-
* }
|
|
2166
|
+
* Graph.getEdge(graph, 0) // => Option.some(new Graph.Edge({ source: 0, target: 1, data: 42 }))
|
|
1325
2167
|
* ```
|
|
1326
2168
|
*
|
|
1327
2169
|
* @category getters
|
|
1328
2170
|
* @since 3.18.0
|
|
1329
2171
|
*/
|
|
1330
|
-
|
|
2172
|
+
(edgeIndex: EdgeIndex): <N, E, T extends Kind = "directed">(graph: Graph<N, E, T> | MutableGraph<N, E, T>) => Option.Option<Edge<E>>;
|
|
1331
2173
|
/**
|
|
1332
2174
|
* Gets the edge data associated with an edge index safely, if it exists.
|
|
1333
2175
|
*
|
|
1334
2176
|
* **Example** (Getting edge data)
|
|
1335
2177
|
*
|
|
1336
|
-
* ```ts
|
|
1337
|
-
* import { Graph } from "effect"
|
|
2178
|
+
* ```ts import.meta.vitest
|
|
2179
|
+
* import { Graph, Option } from "effect"
|
|
1338
2180
|
*
|
|
1339
2181
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
1340
2182
|
* const nodeA = Graph.addNode(mutable, "Node A")
|
|
@@ -1342,14 +2184,7 @@ export declare const getEdge: {
|
|
|
1342
2184
|
* Graph.addEdge(mutable, nodeA, nodeB, 42)
|
|
1343
2185
|
* })
|
|
1344
2186
|
*
|
|
1345
|
-
*
|
|
1346
|
-
* const edgeData = Graph.getEdge(graph, edgeIndex)
|
|
1347
|
-
*
|
|
1348
|
-
* if (edgeData._tag === "Some") {
|
|
1349
|
-
* console.log(edgeData.value.data) // 42
|
|
1350
|
-
* console.log(edgeData.value.source) // 0
|
|
1351
|
-
* console.log(edgeData.value.target) // 1
|
|
1352
|
-
* }
|
|
2187
|
+
* Graph.getEdge(graph, 0) // => Option.some(new Graph.Edge({ source: 0, target: 1, data: 42 }))
|
|
1353
2188
|
* ```
|
|
1354
2189
|
*
|
|
1355
2190
|
* @category getters
|
|
@@ -1362,7 +2197,7 @@ export declare const getEdge: {
|
|
|
1362
2197
|
*
|
|
1363
2198
|
* **Example** (Checking edge existence)
|
|
1364
2199
|
*
|
|
1365
|
-
* ```ts
|
|
2200
|
+
* ```ts import.meta.vitest
|
|
1366
2201
|
* import { Graph } from "effect"
|
|
1367
2202
|
*
|
|
1368
2203
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
@@ -1372,15 +2207,8 @@ export declare const getEdge: {
|
|
|
1372
2207
|
* Graph.addEdge(mutable, nodeA, nodeB, 42)
|
|
1373
2208
|
* })
|
|
1374
2209
|
*
|
|
1375
|
-
*
|
|
1376
|
-
*
|
|
1377
|
-
* const nodeC = 2
|
|
1378
|
-
*
|
|
1379
|
-
* const hasAB = Graph.hasEdge(graph, nodeA, nodeB)
|
|
1380
|
-
* console.log(hasAB) // true
|
|
1381
|
-
*
|
|
1382
|
-
* const hasAC = Graph.hasEdge(graph, nodeA, nodeC)
|
|
1383
|
-
* console.log(hasAC) // false
|
|
2210
|
+
* Graph.hasEdge(graph, 0, 1) // => true
|
|
2211
|
+
* Graph.hasEdge(graph, 0, 2) // => false
|
|
1384
2212
|
* ```
|
|
1385
2213
|
*
|
|
1386
2214
|
* @category getters
|
|
@@ -1392,7 +2220,7 @@ export declare const hasEdge: {
|
|
|
1392
2220
|
*
|
|
1393
2221
|
* **Example** (Checking edge existence)
|
|
1394
2222
|
*
|
|
1395
|
-
* ```ts
|
|
2223
|
+
* ```ts import.meta.vitest
|
|
1396
2224
|
* import { Graph } from "effect"
|
|
1397
2225
|
*
|
|
1398
2226
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
@@ -1402,15 +2230,8 @@ export declare const hasEdge: {
|
|
|
1402
2230
|
* Graph.addEdge(mutable, nodeA, nodeB, 42)
|
|
1403
2231
|
* })
|
|
1404
2232
|
*
|
|
1405
|
-
*
|
|
1406
|
-
*
|
|
1407
|
-
* const nodeC = 2
|
|
1408
|
-
*
|
|
1409
|
-
* const hasAB = Graph.hasEdge(graph, nodeA, nodeB)
|
|
1410
|
-
* console.log(hasAB) // true
|
|
1411
|
-
*
|
|
1412
|
-
* const hasAC = Graph.hasEdge(graph, nodeA, nodeC)
|
|
1413
|
-
* console.log(hasAC) // false
|
|
2233
|
+
* Graph.hasEdge(graph, 0, 1) // => true
|
|
2234
|
+
* Graph.hasEdge(graph, 0, 2) // => false
|
|
1414
2235
|
* ```
|
|
1415
2236
|
*
|
|
1416
2237
|
* @category getters
|
|
@@ -1422,7 +2243,7 @@ export declare const hasEdge: {
|
|
|
1422
2243
|
*
|
|
1423
2244
|
* **Example** (Checking edge existence)
|
|
1424
2245
|
*
|
|
1425
|
-
* ```ts
|
|
2246
|
+
* ```ts import.meta.vitest
|
|
1426
2247
|
* import { Graph } from "effect"
|
|
1427
2248
|
*
|
|
1428
2249
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
@@ -1432,15 +2253,8 @@ export declare const hasEdge: {
|
|
|
1432
2253
|
* Graph.addEdge(mutable, nodeA, nodeB, 42)
|
|
1433
2254
|
* })
|
|
1434
2255
|
*
|
|
1435
|
-
*
|
|
1436
|
-
*
|
|
1437
|
-
* const nodeC = 2
|
|
1438
|
-
*
|
|
1439
|
-
* const hasAB = Graph.hasEdge(graph, nodeA, nodeB)
|
|
1440
|
-
* console.log(hasAB) // true
|
|
1441
|
-
*
|
|
1442
|
-
* const hasAC = Graph.hasEdge(graph, nodeA, nodeC)
|
|
1443
|
-
* console.log(hasAC) // false
|
|
2256
|
+
* Graph.hasEdge(graph, 0, 1) // => true
|
|
2257
|
+
* Graph.hasEdge(graph, 0, 2) // => false
|
|
1444
2258
|
* ```
|
|
1445
2259
|
*
|
|
1446
2260
|
* @category getters
|
|
@@ -1453,11 +2267,11 @@ export declare const hasEdge: {
|
|
|
1453
2267
|
*
|
|
1454
2268
|
* **Example** (Counting edges)
|
|
1455
2269
|
*
|
|
1456
|
-
* ```ts
|
|
2270
|
+
* ```ts import.meta.vitest
|
|
1457
2271
|
* import { Graph } from "effect"
|
|
1458
2272
|
*
|
|
1459
2273
|
* const emptyGraph = Graph.directed<string, number>()
|
|
1460
|
-
*
|
|
2274
|
+
* Graph.edgeCount(emptyGraph) // => 0
|
|
1461
2275
|
*
|
|
1462
2276
|
* const graphWithEdges = Graph.mutate(emptyGraph, (mutable) => {
|
|
1463
2277
|
* const nodeA = Graph.addNode(mutable, "Node A")
|
|
@@ -1468,7 +2282,7 @@ export declare const hasEdge: {
|
|
|
1468
2282
|
* Graph.addEdge(mutable, nodeC, nodeA, 3)
|
|
1469
2283
|
* })
|
|
1470
2284
|
*
|
|
1471
|
-
*
|
|
2285
|
+
* Graph.edgeCount(graphWithEdges) // => 3
|
|
1472
2286
|
* ```
|
|
1473
2287
|
*
|
|
1474
2288
|
* @category getters
|
|
@@ -1485,7 +2299,7 @@ export declare const edgeCount: <N, E, T extends Kind = "directed">(graph: Graph
|
|
|
1485
2299
|
*
|
|
1486
2300
|
* **Example** (Getting outgoing neighbors)
|
|
1487
2301
|
*
|
|
1488
|
-
* ```ts
|
|
2302
|
+
* ```ts import.meta.vitest
|
|
1489
2303
|
* import { Graph } from "effect"
|
|
1490
2304
|
*
|
|
1491
2305
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
@@ -1496,15 +2310,8 @@ export declare const edgeCount: <N, E, T extends Kind = "directed">(graph: Graph
|
|
|
1496
2310
|
* Graph.addEdge(mutable, nodeA, nodeC, 2)
|
|
1497
2311
|
* })
|
|
1498
2312
|
*
|
|
1499
|
-
*
|
|
1500
|
-
*
|
|
1501
|
-
* const nodeC = 2
|
|
1502
|
-
*
|
|
1503
|
-
* const neighborsA = Graph.neighbors(graph, nodeA)
|
|
1504
|
-
* console.log(neighborsA) // [1, 2]
|
|
1505
|
-
*
|
|
1506
|
-
* const neighborsB = Graph.neighbors(graph, nodeB)
|
|
1507
|
-
* console.log(neighborsB) // []
|
|
2313
|
+
* Graph.neighbors(graph, 0) // => [1, 2]
|
|
2314
|
+
* Graph.neighbors(graph, 1) // => []
|
|
1508
2315
|
* ```
|
|
1509
2316
|
*
|
|
1510
2317
|
* @category getters
|
|
@@ -1521,7 +2328,7 @@ export declare const neighbors: {
|
|
|
1521
2328
|
*
|
|
1522
2329
|
* **Example** (Getting outgoing neighbors)
|
|
1523
2330
|
*
|
|
1524
|
-
* ```ts
|
|
2331
|
+
* ```ts import.meta.vitest
|
|
1525
2332
|
* import { Graph } from "effect"
|
|
1526
2333
|
*
|
|
1527
2334
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
@@ -1532,15 +2339,8 @@ export declare const neighbors: {
|
|
|
1532
2339
|
* Graph.addEdge(mutable, nodeA, nodeC, 2)
|
|
1533
2340
|
* })
|
|
1534
2341
|
*
|
|
1535
|
-
*
|
|
1536
|
-
*
|
|
1537
|
-
* const nodeC = 2
|
|
1538
|
-
*
|
|
1539
|
-
* const neighborsA = Graph.neighbors(graph, nodeA)
|
|
1540
|
-
* console.log(neighborsA) // [1, 2]
|
|
1541
|
-
*
|
|
1542
|
-
* const neighborsB = Graph.neighbors(graph, nodeB)
|
|
1543
|
-
* console.log(neighborsB) // []
|
|
2342
|
+
* Graph.neighbors(graph, 0) // => [1, 2]
|
|
2343
|
+
* Graph.neighbors(graph, 1) // => []
|
|
1544
2344
|
* ```
|
|
1545
2345
|
*
|
|
1546
2346
|
* @category getters
|
|
@@ -1557,7 +2357,7 @@ export declare const neighbors: {
|
|
|
1557
2357
|
*
|
|
1558
2358
|
* **Example** (Getting outgoing neighbors)
|
|
1559
2359
|
*
|
|
1560
|
-
* ```ts
|
|
2360
|
+
* ```ts import.meta.vitest
|
|
1561
2361
|
* import { Graph } from "effect"
|
|
1562
2362
|
*
|
|
1563
2363
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
@@ -1568,15 +2368,8 @@ export declare const neighbors: {
|
|
|
1568
2368
|
* Graph.addEdge(mutable, nodeA, nodeC, 2)
|
|
1569
2369
|
* })
|
|
1570
2370
|
*
|
|
1571
|
-
*
|
|
1572
|
-
*
|
|
1573
|
-
* const nodeC = 2
|
|
1574
|
-
*
|
|
1575
|
-
* const neighborsA = Graph.neighbors(graph, nodeA)
|
|
1576
|
-
* console.log(neighborsA) // [1, 2]
|
|
1577
|
-
*
|
|
1578
|
-
* const neighborsB = Graph.neighbors(graph, nodeB)
|
|
1579
|
-
* console.log(neighborsB) // []
|
|
2371
|
+
* Graph.neighbors(graph, 0) // => [1, 2]
|
|
2372
|
+
* Graph.neighbors(graph, 1) // => []
|
|
1580
2373
|
* ```
|
|
1581
2374
|
*
|
|
1582
2375
|
* @category getters
|
|
@@ -1599,7 +2392,7 @@ export declare const neighbors: {
|
|
|
1599
2392
|
* @see {@link predecessors} for incoming neighbors in a directed graph
|
|
1600
2393
|
* @see {@link neighbors} for generic neighbor lookup across graph kinds
|
|
1601
2394
|
*
|
|
1602
|
-
* @category
|
|
2395
|
+
* @category getters
|
|
1603
2396
|
* @since 4.0.0
|
|
1604
2397
|
*/
|
|
1605
2398
|
export declare const successors: {
|
|
@@ -1618,7 +2411,7 @@ export declare const successors: {
|
|
|
1618
2411
|
* @see {@link predecessors} for incoming neighbors in a directed graph
|
|
1619
2412
|
* @see {@link neighbors} for generic neighbor lookup across graph kinds
|
|
1620
2413
|
*
|
|
1621
|
-
* @category
|
|
2414
|
+
* @category getters
|
|
1622
2415
|
* @since 4.0.0
|
|
1623
2416
|
*/
|
|
1624
2417
|
(nodeIndex: NodeIndex): <N, E>(graph: Graph<N, E, "directed"> | MutableGraph<N, E, "directed">) => Array<NodeIndex>;
|
|
@@ -1637,7 +2430,7 @@ export declare const successors: {
|
|
|
1637
2430
|
* @see {@link predecessors} for incoming neighbors in a directed graph
|
|
1638
2431
|
* @see {@link neighbors} for generic neighbor lookup across graph kinds
|
|
1639
2432
|
*
|
|
1640
|
-
* @category
|
|
2433
|
+
* @category getters
|
|
1641
2434
|
* @since 4.0.0
|
|
1642
2435
|
*/
|
|
1643
2436
|
<N, E>(graph: Graph<N, E, "directed"> | MutableGraph<N, E, "directed">, nodeIndex: NodeIndex): Array<NodeIndex>;
|
|
@@ -1657,7 +2450,7 @@ export declare const successors: {
|
|
|
1657
2450
|
* @see {@link successors} for outgoing neighbors in a directed graph
|
|
1658
2451
|
* @see {@link neighbors} for generic neighbor lookup across graph kinds
|
|
1659
2452
|
*
|
|
1660
|
-
* @category
|
|
2453
|
+
* @category getters
|
|
1661
2454
|
* @since 4.0.0
|
|
1662
2455
|
*/
|
|
1663
2456
|
export declare const predecessors: {
|
|
@@ -1676,7 +2469,7 @@ export declare const predecessors: {
|
|
|
1676
2469
|
* @see {@link successors} for outgoing neighbors in a directed graph
|
|
1677
2470
|
* @see {@link neighbors} for generic neighbor lookup across graph kinds
|
|
1678
2471
|
*
|
|
1679
|
-
* @category
|
|
2472
|
+
* @category getters
|
|
1680
2473
|
* @since 4.0.0
|
|
1681
2474
|
*/
|
|
1682
2475
|
(nodeIndex: NodeIndex): <N, E>(graph: Graph<N, E, "directed"> | MutableGraph<N, E, "directed">) => Array<NodeIndex>;
|
|
@@ -1695,7 +2488,7 @@ export declare const predecessors: {
|
|
|
1695
2488
|
* @see {@link successors} for outgoing neighbors in a directed graph
|
|
1696
2489
|
* @see {@link neighbors} for generic neighbor lookup across graph kinds
|
|
1697
2490
|
*
|
|
1698
|
-
* @category
|
|
2491
|
+
* @category getters
|
|
1699
2492
|
* @since 4.0.0
|
|
1700
2493
|
*/
|
|
1701
2494
|
<N, E>(graph: Graph<N, E, "directed"> | MutableGraph<N, E, "directed">, nodeIndex: NodeIndex): Array<NodeIndex>;
|
|
@@ -1714,7 +2507,7 @@ export declare const predecessors: {
|
|
|
1714
2507
|
*
|
|
1715
2508
|
* **Example** (Traversing directed neighbors)
|
|
1716
2509
|
*
|
|
1717
|
-
* ```ts
|
|
2510
|
+
* ```ts import.meta.vitest
|
|
1718
2511
|
* import { Graph } from "effect"
|
|
1719
2512
|
*
|
|
1720
2513
|
* const graph = Graph.directed<string, string>((mutable) => {
|
|
@@ -1731,12 +2524,13 @@ export declare const predecessors: {
|
|
|
1731
2524
|
*
|
|
1732
2525
|
* // Get incoming neighbors (nodes that point to nodeB)
|
|
1733
2526
|
* const incoming = Graph.neighborsDirected(graph, nodeB, "incoming")
|
|
2527
|
+
* Array.of(outgoing, incoming) // => [[1], [0]]
|
|
1734
2528
|
* ```
|
|
1735
2529
|
*
|
|
1736
2530
|
* @deprecated Use {@link successors} for outgoing neighbors or {@link predecessors} for incoming neighbors.
|
|
1737
2531
|
* @see {@link successors} for outgoing neighbors in a directed graph
|
|
1738
2532
|
* @see {@link predecessors} for incoming neighbors in a directed graph
|
|
1739
|
-
* @category
|
|
2533
|
+
* @category getters
|
|
1740
2534
|
* @since 3.18.0
|
|
1741
2535
|
*/
|
|
1742
2536
|
export declare const neighborsDirected: {
|
|
@@ -1754,7 +2548,7 @@ export declare const neighborsDirected: {
|
|
|
1754
2548
|
*
|
|
1755
2549
|
* **Example** (Traversing directed neighbors)
|
|
1756
2550
|
*
|
|
1757
|
-
* ```ts
|
|
2551
|
+
* ```ts import.meta.vitest
|
|
1758
2552
|
* import { Graph } from "effect"
|
|
1759
2553
|
*
|
|
1760
2554
|
* const graph = Graph.directed<string, string>((mutable) => {
|
|
@@ -1771,12 +2565,13 @@ export declare const neighborsDirected: {
|
|
|
1771
2565
|
*
|
|
1772
2566
|
* // Get incoming neighbors (nodes that point to nodeB)
|
|
1773
2567
|
* const incoming = Graph.neighborsDirected(graph, nodeB, "incoming")
|
|
2568
|
+
* Array.of(outgoing, incoming) // => [[1], [0]]
|
|
1774
2569
|
* ```
|
|
1775
2570
|
*
|
|
1776
2571
|
* @deprecated Use {@link successors} for outgoing neighbors or {@link predecessors} for incoming neighbors.
|
|
1777
2572
|
* @see {@link successors} for outgoing neighbors in a directed graph
|
|
1778
2573
|
* @see {@link predecessors} for incoming neighbors in a directed graph
|
|
1779
|
-
* @category
|
|
2574
|
+
* @category getters
|
|
1780
2575
|
* @since 3.18.0
|
|
1781
2576
|
*/
|
|
1782
2577
|
(nodeIndex: NodeIndex, direction: Direction): <N, E>(graph: Graph<N, E, "directed"> | MutableGraph<N, E, "directed">) => Array<NodeIndex>;
|
|
@@ -1794,7 +2589,7 @@ export declare const neighborsDirected: {
|
|
|
1794
2589
|
*
|
|
1795
2590
|
* **Example** (Traversing directed neighbors)
|
|
1796
2591
|
*
|
|
1797
|
-
* ```ts
|
|
2592
|
+
* ```ts import.meta.vitest
|
|
1798
2593
|
* import { Graph } from "effect"
|
|
1799
2594
|
*
|
|
1800
2595
|
* const graph = Graph.directed<string, string>((mutable) => {
|
|
@@ -1811,12 +2606,13 @@ export declare const neighborsDirected: {
|
|
|
1811
2606
|
*
|
|
1812
2607
|
* // Get incoming neighbors (nodes that point to nodeB)
|
|
1813
2608
|
* const incoming = Graph.neighborsDirected(graph, nodeB, "incoming")
|
|
2609
|
+
* Array.of(outgoing, incoming) // => [[1], [0]]
|
|
1814
2610
|
* ```
|
|
1815
2611
|
*
|
|
1816
2612
|
* @deprecated Use {@link successors} for outgoing neighbors or {@link predecessors} for incoming neighbors.
|
|
1817
2613
|
* @see {@link successors} for outgoing neighbors in a directed graph
|
|
1818
2614
|
* @see {@link predecessors} for incoming neighbors in a directed graph
|
|
1819
|
-
* @category
|
|
2615
|
+
* @category getters
|
|
1820
2616
|
* @since 3.18.0
|
|
1821
2617
|
*/
|
|
1822
2618
|
<N, E>(graph: Graph<N, E, "directed"> | MutableGraph<N, E, "directed">, nodeIndex: NodeIndex, direction: Direction): Array<NodeIndex>;
|
|
@@ -1831,7 +2627,7 @@ export declare const neighborsDirected: {
|
|
|
1831
2627
|
*
|
|
1832
2628
|
* **Example** (Configuring GraphViz labels)
|
|
1833
2629
|
*
|
|
1834
|
-
* ```ts
|
|
2630
|
+
* ```ts import.meta.vitest
|
|
1835
2631
|
* import type { Graph } from "effect"
|
|
1836
2632
|
*
|
|
1837
2633
|
* // Basic options with custom labels
|
|
@@ -1846,6 +2642,7 @@ export declare const neighborsDirected: {
|
|
|
1846
2642
|
* edgeLabel: (data) => data,
|
|
1847
2643
|
* graphName: "MyDependencyGraph"
|
|
1848
2644
|
* }
|
|
2645
|
+
* Array.of(basicOptions.nodeLabel?.("A"), namedOptions.graphName) // => ["Node: A", "MyDependencyGraph"]
|
|
1849
2646
|
* ```
|
|
1850
2647
|
*
|
|
1851
2648
|
* @category options
|
|
@@ -1873,7 +2670,7 @@ export interface GraphVizOptions<N, E> {
|
|
|
1873
2670
|
*
|
|
1874
2671
|
* **Example** (Exporting GraphViz DOT)
|
|
1875
2672
|
*
|
|
1876
|
-
* ```ts
|
|
2673
|
+
* ```ts import.meta.vitest
|
|
1877
2674
|
* import { Graph } from "effect"
|
|
1878
2675
|
*
|
|
1879
2676
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
@@ -1885,16 +2682,7 @@ export interface GraphVizOptions<N, E> {
|
|
|
1885
2682
|
* Graph.addEdge(mutable, nodeC, nodeA, 3)
|
|
1886
2683
|
* })
|
|
1887
2684
|
*
|
|
1888
|
-
*
|
|
1889
|
-
* console.log(dot)
|
|
1890
|
-
* // digraph G {
|
|
1891
|
-
* // "0" [label="Node A"];
|
|
1892
|
-
* // "1" [label="Node B"];
|
|
1893
|
-
* // "2" [label="Node C"];
|
|
1894
|
-
* // "0" -> "1" [label="1"];
|
|
1895
|
-
* // "1" -> "2" [label="2"];
|
|
1896
|
-
* // "2" -> "0" [label="3"];
|
|
1897
|
-
* // }
|
|
2685
|
+
* 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"];', "}"]
|
|
1898
2686
|
* ```
|
|
1899
2687
|
*
|
|
1900
2688
|
* @category converting
|
|
@@ -1906,7 +2694,7 @@ export declare const toGraphViz: {
|
|
|
1906
2694
|
*
|
|
1907
2695
|
* **Example** (Exporting GraphViz DOT)
|
|
1908
2696
|
*
|
|
1909
|
-
* ```ts
|
|
2697
|
+
* ```ts import.meta.vitest
|
|
1910
2698
|
* import { Graph } from "effect"
|
|
1911
2699
|
*
|
|
1912
2700
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
@@ -1918,16 +2706,7 @@ export declare const toGraphViz: {
|
|
|
1918
2706
|
* Graph.addEdge(mutable, nodeC, nodeA, 3)
|
|
1919
2707
|
* })
|
|
1920
2708
|
*
|
|
1921
|
-
*
|
|
1922
|
-
* console.log(dot)
|
|
1923
|
-
* // digraph G {
|
|
1924
|
-
* // "0" [label="Node A"];
|
|
1925
|
-
* // "1" [label="Node B"];
|
|
1926
|
-
* // "2" [label="Node C"];
|
|
1927
|
-
* // "0" -> "1" [label="1"];
|
|
1928
|
-
* // "1" -> "2" [label="2"];
|
|
1929
|
-
* // "2" -> "0" [label="3"];
|
|
1930
|
-
* // }
|
|
2709
|
+
* 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"];', "}"]
|
|
1931
2710
|
* ```
|
|
1932
2711
|
*
|
|
1933
2712
|
* @category converting
|
|
@@ -1939,7 +2718,7 @@ export declare const toGraphViz: {
|
|
|
1939
2718
|
*
|
|
1940
2719
|
* **Example** (Exporting GraphViz DOT)
|
|
1941
2720
|
*
|
|
1942
|
-
* ```ts
|
|
2721
|
+
* ```ts import.meta.vitest
|
|
1943
2722
|
* import { Graph } from "effect"
|
|
1944
2723
|
*
|
|
1945
2724
|
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
|
@@ -1951,16 +2730,7 @@ export declare const toGraphViz: {
|
|
|
1951
2730
|
* Graph.addEdge(mutable, nodeC, nodeA, 3)
|
|
1952
2731
|
* })
|
|
1953
2732
|
*
|
|
1954
|
-
*
|
|
1955
|
-
* console.log(dot)
|
|
1956
|
-
* // digraph G {
|
|
1957
|
-
* // "0" [label="Node A"];
|
|
1958
|
-
* // "1" [label="Node B"];
|
|
1959
|
-
* // "2" [label="Node C"];
|
|
1960
|
-
* // "0" -> "1" [label="1"];
|
|
1961
|
-
* // "1" -> "2" [label="2"];
|
|
1962
|
-
* // "2" -> "0" [label="3"];
|
|
1963
|
-
* // }
|
|
2733
|
+
* 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"];', "}"]
|
|
1964
2734
|
* ```
|
|
1965
2735
|
*
|
|
1966
2736
|
* @category converting
|
|
@@ -1985,7 +2755,7 @@ export declare const toGraphViz: {
|
|
|
1985
2755
|
*
|
|
1986
2756
|
* **Example** (Selecting Mermaid node shapes)
|
|
1987
2757
|
*
|
|
1988
|
-
* ```ts
|
|
2758
|
+
* ```ts import.meta.vitest
|
|
1989
2759
|
* import type { Graph } from "effect"
|
|
1990
2760
|
*
|
|
1991
2761
|
* // Shape selector function for different node types
|
|
@@ -2000,6 +2770,7 @@ export declare const toGraphViz: {
|
|
|
2000
2770
|
* const options: Graph.MermaidOptions<string, string> = {
|
|
2001
2771
|
* nodeShape: shapeSelector
|
|
2002
2772
|
* }
|
|
2773
|
+
* options.nodeShape?.("decision") // => "diamond"
|
|
2003
2774
|
* ```
|
|
2004
2775
|
*
|
|
2005
2776
|
* @category models
|
|
@@ -2019,7 +2790,7 @@ export type MermaidNodeShape = "rectangle" | "rounded" | "circle" | "diamond" |
|
|
|
2019
2790
|
*
|
|
2020
2791
|
* **Example** (Configuring Mermaid directions)
|
|
2021
2792
|
*
|
|
2022
|
-
* ```ts
|
|
2793
|
+
* ```ts import.meta.vitest
|
|
2023
2794
|
* import type { Graph } from "effect"
|
|
2024
2795
|
*
|
|
2025
2796
|
* // Horizontal workflow diagram
|
|
@@ -2036,6 +2807,7 @@ export type MermaidNodeShape = "rectangle" | "rounded" | "circle" | "diamond" |
|
|
|
2036
2807
|
* const bottomUpOptions: Graph.MermaidOptions<string, string> = {
|
|
2037
2808
|
* direction: "BT"
|
|
2038
2809
|
* }
|
|
2810
|
+
* Array.of(horizontalOptions.direction, verticalOptions.direction, bottomUpOptions.direction) // => ["LR", "TB", "BT"]
|
|
2039
2811
|
* ```
|
|
2040
2812
|
*
|
|
2041
2813
|
* @category models
|
|
@@ -2056,7 +2828,7 @@ export type MermaidDirection = "TB" | "TD" | "BT" | "RL" | "LR";
|
|
|
2056
2828
|
*
|
|
2057
2829
|
* **Example** (Selecting Mermaid diagram types)
|
|
2058
2830
|
*
|
|
2059
|
-
* ```ts
|
|
2831
|
+
* ```ts import.meta.vitest
|
|
2060
2832
|
* import type { Graph } from "effect"
|
|
2061
2833
|
*
|
|
2062
2834
|
* // Force flowchart format (even for undirected graphs)
|
|
@@ -2071,6 +2843,7 @@ export type MermaidDirection = "TB" | "TD" | "BT" | "RL" | "LR";
|
|
|
2071
2843
|
*
|
|
2072
2844
|
* // Auto-detection (recommended, default behavior)
|
|
2073
2845
|
* const autoOptions: Graph.MermaidOptions<string, string> = {}
|
|
2846
|
+
* Array.of(flowchartOptions.diagramType, graphOptions.diagramType, autoOptions.diagramType) // => ["flowchart", "graph", undefined]
|
|
2074
2847
|
* ```
|
|
2075
2848
|
*
|
|
2076
2849
|
* @category models
|
|
@@ -2093,7 +2866,7 @@ export type MermaidDiagramType = "flowchart" | "graph";
|
|
|
2093
2866
|
*
|
|
2094
2867
|
* **Example** (Configuring Mermaid output)
|
|
2095
2868
|
*
|
|
2096
|
-
* ```ts
|
|
2869
|
+
* ```ts import.meta.vitest
|
|
2097
2870
|
* import type { Graph } from "effect"
|
|
2098
2871
|
*
|
|
2099
2872
|
* // Basic options with custom labels
|
|
@@ -2110,6 +2883,7 @@ export type MermaidDiagramType = "flowchart" | "graph";
|
|
|
2110
2883
|
* direction: "LR",
|
|
2111
2884
|
* nodeShape: (data) => data.includes("start") ? "circle" : "rectangle"
|
|
2112
2885
|
* }
|
|
2886
|
+
* Array.of(basicOptions.nodeLabel?.("A"), advancedOptions.nodeShape?.("start")) // => ["Node: A", "circle"]
|
|
2113
2887
|
* ```
|
|
2114
2888
|
*
|
|
2115
2889
|
* @category options
|
|
@@ -2155,7 +2929,7 @@ export interface MermaidOptions<N, E> {
|
|
|
2155
2929
|
*
|
|
2156
2930
|
* **Example** (Exporting a directed Mermaid diagram)
|
|
2157
2931
|
*
|
|
2158
|
-
* ```ts
|
|
2932
|
+
* ```ts import.meta.vitest
|
|
2159
2933
|
* import { Graph } from "effect"
|
|
2160
2934
|
*
|
|
2161
2935
|
* // Basic directed graph export
|
|
@@ -2167,19 +2941,12 @@ export interface MermaidOptions<N, E> {
|
|
|
2167
2941
|
* Graph.addEdge(mutable, app, cache, 2)
|
|
2168
2942
|
* })
|
|
2169
2943
|
*
|
|
2170
|
-
*
|
|
2171
|
-
* console.log(mermaid)
|
|
2172
|
-
* // flowchart TD
|
|
2173
|
-
* // 0["App"]
|
|
2174
|
-
* // 1["Database"]
|
|
2175
|
-
* // 2["Cache"]
|
|
2176
|
-
* // 0 -->|"1"| 1
|
|
2177
|
-
* // 0 -->|"2"| 2
|
|
2944
|
+
* Graph.toMermaid(graph).split("\n") // => ["flowchart TD", ' 0["App"]', ' 1["Database"]', ' 2["Cache"]', ' 0 -->|"1"| 1', ' 0 -->|"2"| 2']
|
|
2178
2945
|
* ```
|
|
2179
2946
|
*
|
|
2180
2947
|
* **Example** (Exporting an undirected Mermaid diagram)
|
|
2181
2948
|
*
|
|
2182
|
-
* ```ts
|
|
2949
|
+
* ```ts import.meta.vitest
|
|
2183
2950
|
* import { Graph } from "effect"
|
|
2184
2951
|
*
|
|
2185
2952
|
* // Undirected graph with custom labels and direction
|
|
@@ -2196,18 +2963,12 @@ export interface MermaidOptions<N, E> {
|
|
|
2196
2963
|
* edgeLabel: (relationship) => relationship,
|
|
2197
2964
|
* direction: "LR"
|
|
2198
2965
|
* })
|
|
2199
|
-
*
|
|
2200
|
-
* // graph LR
|
|
2201
|
-
* // 0["Alice"]
|
|
2202
|
-
* // 1["Bob"]
|
|
2203
|
-
* // 2["Charlie"]
|
|
2204
|
-
* // 0 ---|"friends"| 1
|
|
2205
|
-
* // 1 ---|"colleagues"| 2
|
|
2966
|
+
* mermaid.split("\n") // => ["graph LR", ' 0["Alice"]', ' 1["Bob"]', ' 2["Charlie"]', ' 0 ---|"friends"| 1', ' 1 ---|"colleagues"| 2']
|
|
2206
2967
|
* ```
|
|
2207
2968
|
*
|
|
2208
2969
|
* **Example** (Customizing Mermaid node shapes)
|
|
2209
2970
|
*
|
|
2210
|
-
* ```ts
|
|
2971
|
+
* ```ts import.meta.vitest
|
|
2211
2972
|
* import { Graph } from "effect"
|
|
2212
2973
|
*
|
|
2213
2974
|
* // Advanced styling with node shapes for flowchart
|
|
@@ -2246,20 +3007,12 @@ export interface MermaidOptions<N, E> {
|
|
|
2246
3007
|
* }
|
|
2247
3008
|
* }
|
|
2248
3009
|
* })
|
|
2249
|
-
*
|
|
2250
|
-
* // flowchart TD
|
|
2251
|
-
* // 0(["Begin"])
|
|
2252
|
-
* // 1["Process Data"]
|
|
2253
|
-
* // 2{"Valid?"}
|
|
2254
|
-
* // 3(["Complete"])
|
|
2255
|
-
* // 0 --> 1
|
|
2256
|
-
* // 1 --> 2
|
|
2257
|
-
* // 2 --> 3
|
|
3010
|
+
* mermaid.split("\n") // => ["flowchart TD", ' 0(["Begin"])', ' 1["Process Data"]', ' 2{"Valid?"}', ' 3(["Complete"])', " 0 --> 1", " 1 --> 2", ' 2 -->|"yes"| 3']
|
|
2258
3011
|
* ```
|
|
2259
3012
|
*
|
|
2260
3013
|
* **Example** (Visualizing dependency graphs)
|
|
2261
3014
|
*
|
|
2262
|
-
* ```ts
|
|
3015
|
+
* ```ts import.meta.vitest
|
|
2263
3016
|
* import { Graph } from "effect"
|
|
2264
3017
|
*
|
|
2265
3018
|
* // Real-world example: Software dependency graph
|
|
@@ -2274,22 +3027,22 @@ export interface MermaidOptions<N, E> {
|
|
|
2274
3027
|
* name: "MyApp",
|
|
2275
3028
|
* version: "1.0.0",
|
|
2276
3029
|
* type: "library"
|
|
2277
|
-
* })
|
|
3030
|
+
* } satisfies Dependency)
|
|
2278
3031
|
* const react = Graph.addNode(mutable, {
|
|
2279
3032
|
* name: "React",
|
|
2280
3033
|
* version: "18.0.0",
|
|
2281
3034
|
* type: "framework"
|
|
2282
|
-
* })
|
|
3035
|
+
* } satisfies Dependency)
|
|
2283
3036
|
* const lodash = Graph.addNode(mutable, {
|
|
2284
3037
|
* name: "Lodash",
|
|
2285
3038
|
* version: "4.17.0",
|
|
2286
3039
|
* type: "library"
|
|
2287
|
-
* })
|
|
3040
|
+
* } satisfies Dependency)
|
|
2288
3041
|
* const webpack = Graph.addNode(mutable, {
|
|
2289
3042
|
* name: "Webpack",
|
|
2290
3043
|
* version: "5.0.0",
|
|
2291
3044
|
* type: "tool"
|
|
2292
|
-
* })
|
|
3045
|
+
* } satisfies Dependency)
|
|
2293
3046
|
*
|
|
2294
3047
|
* Graph.addEdge(mutable, app, react, "depends on")
|
|
2295
3048
|
* Graph.addEdge(mutable, app, lodash, "depends on")
|
|
@@ -2308,15 +3061,7 @@ export interface MermaidOptions<N, E> {
|
|
|
2308
3061
|
* direction: "TB"
|
|
2309
3062
|
* })
|
|
2310
3063
|
*
|
|
2311
|
-
*
|
|
2312
|
-
* // flowchart TB
|
|
2313
|
-
* // 0["MyApp\nv1.0.0"]
|
|
2314
|
-
* // 1{{"React\nv18.0.0"}}
|
|
2315
|
-
* // 2["Lodash\nv4.17.0"]
|
|
2316
|
-
* // 3{"Webpack\nv5.0.0"}
|
|
2317
|
-
* // 0 -->|"depends on"| 1
|
|
2318
|
-
* // 0 -->|"depends on"| 2
|
|
2319
|
-
* // 0 -->|"builds with"| 3
|
|
3064
|
+
* 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']
|
|
2320
3065
|
* ```
|
|
2321
3066
|
*
|
|
2322
3067
|
* @category converting
|
|
@@ -2335,7 +3080,7 @@ export declare const toMermaid: {
|
|
|
2335
3080
|
*
|
|
2336
3081
|
* **Example** (Exporting a directed Mermaid diagram)
|
|
2337
3082
|
*
|
|
2338
|
-
* ```ts
|
|
3083
|
+
* ```ts import.meta.vitest
|
|
2339
3084
|
* import { Graph } from "effect"
|
|
2340
3085
|
*
|
|
2341
3086
|
* // Basic directed graph export
|
|
@@ -2347,19 +3092,12 @@ export declare const toMermaid: {
|
|
|
2347
3092
|
* Graph.addEdge(mutable, app, cache, 2)
|
|
2348
3093
|
* })
|
|
2349
3094
|
*
|
|
2350
|
-
*
|
|
2351
|
-
* console.log(mermaid)
|
|
2352
|
-
* // flowchart TD
|
|
2353
|
-
* // 0["App"]
|
|
2354
|
-
* // 1["Database"]
|
|
2355
|
-
* // 2["Cache"]
|
|
2356
|
-
* // 0 -->|"1"| 1
|
|
2357
|
-
* // 0 -->|"2"| 2
|
|
3095
|
+
* Graph.toMermaid(graph).split("\n") // => ["flowchart TD", ' 0["App"]', ' 1["Database"]', ' 2["Cache"]', ' 0 -->|"1"| 1', ' 0 -->|"2"| 2']
|
|
2358
3096
|
* ```
|
|
2359
3097
|
*
|
|
2360
3098
|
* **Example** (Exporting an undirected Mermaid diagram)
|
|
2361
3099
|
*
|
|
2362
|
-
* ```ts
|
|
3100
|
+
* ```ts import.meta.vitest
|
|
2363
3101
|
* import { Graph } from "effect"
|
|
2364
3102
|
*
|
|
2365
3103
|
* // Undirected graph with custom labels and direction
|
|
@@ -2376,18 +3114,12 @@ export declare const toMermaid: {
|
|
|
2376
3114
|
* edgeLabel: (relationship) => relationship,
|
|
2377
3115
|
* direction: "LR"
|
|
2378
3116
|
* })
|
|
2379
|
-
*
|
|
2380
|
-
* // graph LR
|
|
2381
|
-
* // 0["Alice"]
|
|
2382
|
-
* // 1["Bob"]
|
|
2383
|
-
* // 2["Charlie"]
|
|
2384
|
-
* // 0 ---|"friends"| 1
|
|
2385
|
-
* // 1 ---|"colleagues"| 2
|
|
3117
|
+
* mermaid.split("\n") // => ["graph LR", ' 0["Alice"]', ' 1["Bob"]', ' 2["Charlie"]', ' 0 ---|"friends"| 1', ' 1 ---|"colleagues"| 2']
|
|
2386
3118
|
* ```
|
|
2387
3119
|
*
|
|
2388
3120
|
* **Example** (Customizing Mermaid node shapes)
|
|
2389
3121
|
*
|
|
2390
|
-
* ```ts
|
|
3122
|
+
* ```ts import.meta.vitest
|
|
2391
3123
|
* import { Graph } from "effect"
|
|
2392
3124
|
*
|
|
2393
3125
|
* // Advanced styling with node shapes for flowchart
|
|
@@ -2426,20 +3158,12 @@ export declare const toMermaid: {
|
|
|
2426
3158
|
* }
|
|
2427
3159
|
* }
|
|
2428
3160
|
* })
|
|
2429
|
-
*
|
|
2430
|
-
* // flowchart TD
|
|
2431
|
-
* // 0(["Begin"])
|
|
2432
|
-
* // 1["Process Data"]
|
|
2433
|
-
* // 2{"Valid?"}
|
|
2434
|
-
* // 3(["Complete"])
|
|
2435
|
-
* // 0 --> 1
|
|
2436
|
-
* // 1 --> 2
|
|
2437
|
-
* // 2 --> 3
|
|
3161
|
+
* mermaid.split("\n") // => ["flowchart TD", ' 0(["Begin"])', ' 1["Process Data"]', ' 2{"Valid?"}', ' 3(["Complete"])', " 0 --> 1", " 1 --> 2", ' 2 -->|"yes"| 3']
|
|
2438
3162
|
* ```
|
|
2439
3163
|
*
|
|
2440
3164
|
* **Example** (Visualizing dependency graphs)
|
|
2441
3165
|
*
|
|
2442
|
-
* ```ts
|
|
3166
|
+
* ```ts import.meta.vitest
|
|
2443
3167
|
* import { Graph } from "effect"
|
|
2444
3168
|
*
|
|
2445
3169
|
* // Real-world example: Software dependency graph
|
|
@@ -2454,22 +3178,22 @@ export declare const toMermaid: {
|
|
|
2454
3178
|
* name: "MyApp",
|
|
2455
3179
|
* version: "1.0.0",
|
|
2456
3180
|
* type: "library"
|
|
2457
|
-
* })
|
|
3181
|
+
* } satisfies Dependency)
|
|
2458
3182
|
* const react = Graph.addNode(mutable, {
|
|
2459
3183
|
* name: "React",
|
|
2460
3184
|
* version: "18.0.0",
|
|
2461
3185
|
* type: "framework"
|
|
2462
|
-
* })
|
|
3186
|
+
* } satisfies Dependency)
|
|
2463
3187
|
* const lodash = Graph.addNode(mutable, {
|
|
2464
3188
|
* name: "Lodash",
|
|
2465
3189
|
* version: "4.17.0",
|
|
2466
3190
|
* type: "library"
|
|
2467
|
-
* })
|
|
3191
|
+
* } satisfies Dependency)
|
|
2468
3192
|
* const webpack = Graph.addNode(mutable, {
|
|
2469
3193
|
* name: "Webpack",
|
|
2470
3194
|
* version: "5.0.0",
|
|
2471
3195
|
* type: "tool"
|
|
2472
|
-
* })
|
|
3196
|
+
* } satisfies Dependency)
|
|
2473
3197
|
*
|
|
2474
3198
|
* Graph.addEdge(mutable, app, react, "depends on")
|
|
2475
3199
|
* Graph.addEdge(mutable, app, lodash, "depends on")
|
|
@@ -2488,15 +3212,7 @@ export declare const toMermaid: {
|
|
|
2488
3212
|
* direction: "TB"
|
|
2489
3213
|
* })
|
|
2490
3214
|
*
|
|
2491
|
-
*
|
|
2492
|
-
* // flowchart TB
|
|
2493
|
-
* // 0["MyApp\nv1.0.0"]
|
|
2494
|
-
* // 1{{"React\nv18.0.0"}}
|
|
2495
|
-
* // 2["Lodash\nv4.17.0"]
|
|
2496
|
-
* // 3{"Webpack\nv5.0.0"}
|
|
2497
|
-
* // 0 -->|"depends on"| 1
|
|
2498
|
-
* // 0 -->|"depends on"| 2
|
|
2499
|
-
* // 0 -->|"builds with"| 3
|
|
3215
|
+
* 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']
|
|
2500
3216
|
* ```
|
|
2501
3217
|
*
|
|
2502
3218
|
* @category converting
|
|
@@ -2515,7 +3231,7 @@ export declare const toMermaid: {
|
|
|
2515
3231
|
*
|
|
2516
3232
|
* **Example** (Exporting a directed Mermaid diagram)
|
|
2517
3233
|
*
|
|
2518
|
-
* ```ts
|
|
3234
|
+
* ```ts import.meta.vitest
|
|
2519
3235
|
* import { Graph } from "effect"
|
|
2520
3236
|
*
|
|
2521
3237
|
* // Basic directed graph export
|
|
@@ -2527,19 +3243,12 @@ export declare const toMermaid: {
|
|
|
2527
3243
|
* Graph.addEdge(mutable, app, cache, 2)
|
|
2528
3244
|
* })
|
|
2529
3245
|
*
|
|
2530
|
-
*
|
|
2531
|
-
* console.log(mermaid)
|
|
2532
|
-
* // flowchart TD
|
|
2533
|
-
* // 0["App"]
|
|
2534
|
-
* // 1["Database"]
|
|
2535
|
-
* // 2["Cache"]
|
|
2536
|
-
* // 0 -->|"1"| 1
|
|
2537
|
-
* // 0 -->|"2"| 2
|
|
3246
|
+
* Graph.toMermaid(graph).split("\n") // => ["flowchart TD", ' 0["App"]', ' 1["Database"]', ' 2["Cache"]', ' 0 -->|"1"| 1', ' 0 -->|"2"| 2']
|
|
2538
3247
|
* ```
|
|
2539
3248
|
*
|
|
2540
3249
|
* **Example** (Exporting an undirected Mermaid diagram)
|
|
2541
3250
|
*
|
|
2542
|
-
* ```ts
|
|
3251
|
+
* ```ts import.meta.vitest
|
|
2543
3252
|
* import { Graph } from "effect"
|
|
2544
3253
|
*
|
|
2545
3254
|
* // Undirected graph with custom labels and direction
|
|
@@ -2556,18 +3265,12 @@ export declare const toMermaid: {
|
|
|
2556
3265
|
* edgeLabel: (relationship) => relationship,
|
|
2557
3266
|
* direction: "LR"
|
|
2558
3267
|
* })
|
|
2559
|
-
*
|
|
2560
|
-
* // graph LR
|
|
2561
|
-
* // 0["Alice"]
|
|
2562
|
-
* // 1["Bob"]
|
|
2563
|
-
* // 2["Charlie"]
|
|
2564
|
-
* // 0 ---|"friends"| 1
|
|
2565
|
-
* // 1 ---|"colleagues"| 2
|
|
3268
|
+
* mermaid.split("\n") // => ["graph LR", ' 0["Alice"]', ' 1["Bob"]', ' 2["Charlie"]', ' 0 ---|"friends"| 1', ' 1 ---|"colleagues"| 2']
|
|
2566
3269
|
* ```
|
|
2567
3270
|
*
|
|
2568
3271
|
* **Example** (Customizing Mermaid node shapes)
|
|
2569
3272
|
*
|
|
2570
|
-
* ```ts
|
|
3273
|
+
* ```ts import.meta.vitest
|
|
2571
3274
|
* import { Graph } from "effect"
|
|
2572
3275
|
*
|
|
2573
3276
|
* // Advanced styling with node shapes for flowchart
|
|
@@ -2606,20 +3309,12 @@ export declare const toMermaid: {
|
|
|
2606
3309
|
* }
|
|
2607
3310
|
* }
|
|
2608
3311
|
* })
|
|
2609
|
-
*
|
|
2610
|
-
* // flowchart TD
|
|
2611
|
-
* // 0(["Begin"])
|
|
2612
|
-
* // 1["Process Data"]
|
|
2613
|
-
* // 2{"Valid?"}
|
|
2614
|
-
* // 3(["Complete"])
|
|
2615
|
-
* // 0 --> 1
|
|
2616
|
-
* // 1 --> 2
|
|
2617
|
-
* // 2 --> 3
|
|
3312
|
+
* mermaid.split("\n") // => ["flowchart TD", ' 0(["Begin"])', ' 1["Process Data"]', ' 2{"Valid?"}', ' 3(["Complete"])', " 0 --> 1", " 1 --> 2", ' 2 -->|"yes"| 3']
|
|
2618
3313
|
* ```
|
|
2619
3314
|
*
|
|
2620
3315
|
* **Example** (Visualizing dependency graphs)
|
|
2621
3316
|
*
|
|
2622
|
-
* ```ts
|
|
3317
|
+
* ```ts import.meta.vitest
|
|
2623
3318
|
* import { Graph } from "effect"
|
|
2624
3319
|
*
|
|
2625
3320
|
* // Real-world example: Software dependency graph
|
|
@@ -2634,22 +3329,22 @@ export declare const toMermaid: {
|
|
|
2634
3329
|
* name: "MyApp",
|
|
2635
3330
|
* version: "1.0.0",
|
|
2636
3331
|
* type: "library"
|
|
2637
|
-
* })
|
|
3332
|
+
* } satisfies Dependency)
|
|
2638
3333
|
* const react = Graph.addNode(mutable, {
|
|
2639
3334
|
* name: "React",
|
|
2640
3335
|
* version: "18.0.0",
|
|
2641
3336
|
* type: "framework"
|
|
2642
|
-
* })
|
|
3337
|
+
* } satisfies Dependency)
|
|
2643
3338
|
* const lodash = Graph.addNode(mutable, {
|
|
2644
3339
|
* name: "Lodash",
|
|
2645
3340
|
* version: "4.17.0",
|
|
2646
3341
|
* type: "library"
|
|
2647
|
-
* })
|
|
3342
|
+
* } satisfies Dependency)
|
|
2648
3343
|
* const webpack = Graph.addNode(mutable, {
|
|
2649
3344
|
* name: "Webpack",
|
|
2650
3345
|
* version: "5.0.0",
|
|
2651
3346
|
* type: "tool"
|
|
2652
|
-
* })
|
|
3347
|
+
* } satisfies Dependency)
|
|
2653
3348
|
*
|
|
2654
3349
|
* Graph.addEdge(mutable, app, react, "depends on")
|
|
2655
3350
|
* Graph.addEdge(mutable, app, lodash, "depends on")
|
|
@@ -2668,15 +3363,7 @@ export declare const toMermaid: {
|
|
|
2668
3363
|
* direction: "TB"
|
|
2669
3364
|
* })
|
|
2670
3365
|
*
|
|
2671
|
-
*
|
|
2672
|
-
* // flowchart TB
|
|
2673
|
-
* // 0["MyApp\nv1.0.0"]
|
|
2674
|
-
* // 1{{"React\nv18.0.0"}}
|
|
2675
|
-
* // 2["Lodash\nv4.17.0"]
|
|
2676
|
-
* // 3{"Webpack\nv5.0.0"}
|
|
2677
|
-
* // 0 -->|"depends on"| 1
|
|
2678
|
-
* // 0 -->|"depends on"| 2
|
|
2679
|
-
* // 0 -->|"builds with"| 3
|
|
3366
|
+
* 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']
|
|
2680
3367
|
* ```
|
|
2681
3368
|
*
|
|
2682
3369
|
* @category converting
|
|
@@ -2685,34 +3372,48 @@ export declare const toMermaid: {
|
|
|
2685
3372
|
<N, E, T extends Kind = "directed">(graph: Graph<N, E, T> | MutableGraph<N, E, T>, options?: MermaidOptions<N, E>): string;
|
|
2686
3373
|
};
|
|
2687
3374
|
/**
|
|
2688
|
-
* Direction
|
|
3375
|
+
* Direction of directed edges relative to a node.
|
|
3376
|
+
*
|
|
3377
|
+
* **Details**
|
|
3378
|
+
*
|
|
3379
|
+
* `"outgoing"` selects edges whose source is the node, while `"incoming"`
|
|
3380
|
+
* selects edges whose target is the node.
|
|
3381
|
+
*
|
|
3382
|
+
* @category models
|
|
3383
|
+
* @since 3.18.0
|
|
3384
|
+
*/
|
|
3385
|
+
export type Direction = "outgoing" | "incoming";
|
|
3386
|
+
/**
|
|
3387
|
+
* Controls how traversal follows directed edges.
|
|
3388
|
+
*
|
|
3389
|
+
* **Details**
|
|
3390
|
+
*
|
|
3391
|
+
* `"outgoing"` follows edges from source to target, `"incoming"` follows them
|
|
3392
|
+
* from target to source, and `"undirected"` allows traversal in either
|
|
3393
|
+
* direction.
|
|
2689
3394
|
*
|
|
2690
3395
|
* **Example** (Traversing by direction)
|
|
2691
3396
|
*
|
|
2692
|
-
* ```ts
|
|
3397
|
+
* ```ts import.meta.vitest
|
|
2693
3398
|
* import { Graph } from "effect"
|
|
2694
3399
|
*
|
|
2695
3400
|
* const graph = Graph.directed<string, string>((mutable) => {
|
|
2696
3401
|
* const a = Graph.addNode(mutable, "A")
|
|
2697
3402
|
* const b = Graph.addNode(mutable, "B")
|
|
2698
|
-
* Graph.
|
|
3403
|
+
* const c = Graph.addNode(mutable, "C")
|
|
3404
|
+
* Graph.addEdge(mutable, a, b, "A-B")
|
|
3405
|
+
* Graph.addEdge(mutable, a, c, "A-C")
|
|
2699
3406
|
* })
|
|
2700
3407
|
*
|
|
2701
|
-
*
|
|
2702
|
-
*
|
|
2703
|
-
*
|
|
2704
|
-
* )
|
|
2705
|
-
*
|
|
2706
|
-
* // Follow incoming edges (reverse direction)
|
|
2707
|
-
* const incomingNodes = Array.from(
|
|
2708
|
-
* Graph.indices(Graph.dfs(graph, { start: [1], direction: "incoming" }))
|
|
2709
|
-
* )
|
|
3408
|
+
* Array.from(Graph.indices(Graph.bfs(graph, { start: [0], direction: "outgoing" }))) // => [0, 1, 2]
|
|
3409
|
+
* Array.from(Graph.indices(Graph.bfs(graph, { start: [1], direction: "incoming" }))) // => [1, 0]
|
|
3410
|
+
* Array.from(Graph.indices(Graph.bfs(graph, { start: [1], direction: "undirected" }))) // => [1, 0, 2]
|
|
2710
3411
|
* ```
|
|
2711
3412
|
*
|
|
2712
3413
|
* @category models
|
|
2713
|
-
* @since
|
|
3414
|
+
* @since 4.0.0
|
|
2714
3415
|
*/
|
|
2715
|
-
export type
|
|
3416
|
+
export type TraversalDirection = Direction | "undirected";
|
|
2716
3417
|
/**
|
|
2717
3418
|
* Checks whether the graph is acyclic (contains no cycles).
|
|
2718
3419
|
*
|
|
@@ -2720,11 +3421,12 @@ export type Direction = "outgoing" | "incoming";
|
|
|
2720
3421
|
*
|
|
2721
3422
|
* Uses depth-first search to detect back edges, which indicate cycles.
|
|
2722
3423
|
* For directed graphs, any back edge creates a cycle. For undirected graphs,
|
|
2723
|
-
* a back edge that doesn't
|
|
3424
|
+
* a back edge that doesn't use the same edge used to enter the current node
|
|
3425
|
+
* creates a cycle.
|
|
2724
3426
|
*
|
|
2725
3427
|
* **Example** (Checking cycles)
|
|
2726
3428
|
*
|
|
2727
|
-
* ```ts
|
|
3429
|
+
* ```ts import.meta.vitest
|
|
2728
3430
|
* import { Graph } from "effect"
|
|
2729
3431
|
*
|
|
2730
3432
|
* // Acyclic directed graph (DAG)
|
|
@@ -2735,7 +3437,7 @@ export type Direction = "outgoing" | "incoming";
|
|
|
2735
3437
|
* Graph.addEdge(mutable, a, b, "A->B")
|
|
2736
3438
|
* Graph.addEdge(mutable, b, c, "B->C")
|
|
2737
3439
|
* })
|
|
2738
|
-
*
|
|
3440
|
+
* Graph.isAcyclic(dag) // => true
|
|
2739
3441
|
*
|
|
2740
3442
|
* // Cyclic directed graph
|
|
2741
3443
|
* const cyclic = Graph.directed<string, string>((mutable) => {
|
|
@@ -2744,7 +3446,7 @@ export type Direction = "outgoing" | "incoming";
|
|
|
2744
3446
|
* Graph.addEdge(mutable, a, b, "A->B")
|
|
2745
3447
|
* Graph.addEdge(mutable, b, a, "B->A") // Creates cycle
|
|
2746
3448
|
* })
|
|
2747
|
-
*
|
|
3449
|
+
* Graph.isAcyclic(cyclic) // => false
|
|
2748
3450
|
* ```
|
|
2749
3451
|
*
|
|
2750
3452
|
* @category algorithms
|
|
@@ -2762,7 +3464,7 @@ export declare const isAcyclic: <N, E, T extends Kind = "directed">(graph: Graph
|
|
|
2762
3464
|
*
|
|
2763
3465
|
* **Example** (Checking bipartite graphs)
|
|
2764
3466
|
*
|
|
2765
|
-
* ```ts
|
|
3467
|
+
* ```ts import.meta.vitest
|
|
2766
3468
|
* import { Graph } from "effect"
|
|
2767
3469
|
*
|
|
2768
3470
|
* // Bipartite graph (alternating coloring possible)
|
|
@@ -2775,7 +3477,7 @@ export declare const isAcyclic: <N, E, T extends Kind = "directed">(graph: Graph
|
|
|
2775
3477
|
* Graph.addEdge(mutable, b, c, "edge")
|
|
2776
3478
|
* Graph.addEdge(mutable, c, d, "edge")
|
|
2777
3479
|
* })
|
|
2778
|
-
*
|
|
3480
|
+
* Graph.isBipartite(bipartite) // => true
|
|
2779
3481
|
*
|
|
2780
3482
|
* // Non-bipartite graph (odd cycle)
|
|
2781
3483
|
* const triangle = Graph.undirected<string, string>((mutable) => {
|
|
@@ -2786,7 +3488,7 @@ export declare const isAcyclic: <N, E, T extends Kind = "directed">(graph: Graph
|
|
|
2786
3488
|
* Graph.addEdge(mutable, b, c, "edge")
|
|
2787
3489
|
* Graph.addEdge(mutable, c, a, "edge") // Triangle (3-cycle)
|
|
2788
3490
|
* })
|
|
2789
|
-
*
|
|
3491
|
+
* Graph.isBipartite(triangle) // => false
|
|
2790
3492
|
* ```
|
|
2791
3493
|
*
|
|
2792
3494
|
* @category algorithms
|
|
@@ -2799,7 +3501,7 @@ export declare const isBipartite: <N, E>(graph: Graph<N, E, "undirected"> | Muta
|
|
|
2799
3501
|
*
|
|
2800
3502
|
* **Example** (Finding connected components)
|
|
2801
3503
|
*
|
|
2802
|
-
* ```ts
|
|
3504
|
+
* ```ts import.meta.vitest
|
|
2803
3505
|
* import { Graph } from "effect"
|
|
2804
3506
|
*
|
|
2805
3507
|
* const graph = Graph.undirected<string, string>((mutable) => {
|
|
@@ -2811,8 +3513,7 @@ export declare const isBipartite: <N, E>(graph: Graph<N, E, "undirected"> | Muta
|
|
|
2811
3513
|
* Graph.addEdge(mutable, c, d, "edge") // Component 2: C-D
|
|
2812
3514
|
* })
|
|
2813
3515
|
*
|
|
2814
|
-
*
|
|
2815
|
-
* console.log(components) // [[0, 1], [2, 3]]
|
|
3516
|
+
* Graph.connectedComponents(graph) // => [[0, 1], [2, 3]]
|
|
2816
3517
|
* ```
|
|
2817
3518
|
*
|
|
2818
3519
|
* @category algorithms
|
|
@@ -2829,7 +3530,7 @@ export declare const connectedComponents: <N, E>(graph: Graph<N, E, "undirected"
|
|
|
2829
3530
|
*
|
|
2830
3531
|
* **Example** (Finding strongly connected components)
|
|
2831
3532
|
*
|
|
2832
|
-
* ```ts
|
|
3533
|
+
* ```ts import.meta.vitest
|
|
2833
3534
|
* import { Graph } from "effect"
|
|
2834
3535
|
*
|
|
2835
3536
|
* const graph = Graph.directed<string, string>((mutable) => {
|
|
@@ -2841,8 +3542,7 @@ export declare const connectedComponents: <N, E>(graph: Graph<N, E, "undirected"
|
|
|
2841
3542
|
* Graph.addEdge(mutable, c, a, "C->A") // Creates SCC: A-B-C
|
|
2842
3543
|
* })
|
|
2843
3544
|
*
|
|
2844
|
-
*
|
|
2845
|
-
* console.log(sccs) // [[0, 1, 2]]
|
|
3545
|
+
* Graph.stronglyConnectedComponents(graph) // => [[0, 2, 1]]
|
|
2846
3546
|
* ```
|
|
2847
3547
|
*
|
|
2848
3548
|
* @category algorithms
|
|
@@ -2892,12 +3592,13 @@ export interface PathResult<E> {
|
|
|
2892
3592
|
* **Details**
|
|
2893
3593
|
*
|
|
2894
3594
|
* Specifies the source and target node indices, plus a cost function that maps
|
|
2895
|
-
* each edge's data to a non-negative numeric weight.
|
|
3595
|
+
* each edge's data to a non-negative numeric weight. `Infinity` is allowed and
|
|
3596
|
+
* behaves like an impassable edge.
|
|
2896
3597
|
*
|
|
2897
3598
|
* **Gotchas**
|
|
2898
3599
|
*
|
|
2899
3600
|
* `dijkstra` throws a `GraphError` when either endpoint does not exist or when
|
|
2900
|
-
* the cost function returns a negative weight
|
|
3601
|
+
* the cost function returns a negative weight or `NaN`.
|
|
2901
3602
|
*
|
|
2902
3603
|
* @see {@link dijkstra} for the algorithm that consumes this configuration
|
|
2903
3604
|
* @see {@link AstarConfig} for heuristic shortest-path search
|
|
@@ -2917,14 +3618,15 @@ export interface DijkstraConfig<E> {
|
|
|
2917
3618
|
*
|
|
2918
3619
|
* **Details**
|
|
2919
3620
|
*
|
|
2920
|
-
* Edge costs must be non-negative
|
|
2921
|
-
*
|
|
2922
|
-
*
|
|
3621
|
+
* Edge costs must be non-negative and not `NaN`. `Infinity` is allowed and
|
|
3622
|
+
* behaves like an impassable edge. Returns `Option.none()` when the target is
|
|
3623
|
+
* not reachable, and throws a `GraphError` when either endpoint is missing or an
|
|
3624
|
+
* edge cost is negative or `NaN`.
|
|
2923
3625
|
*
|
|
2924
3626
|
* **Example** (Finding shortest paths with Dijkstra)
|
|
2925
3627
|
*
|
|
2926
|
-
* ```ts
|
|
2927
|
-
* import { Graph } from "effect"
|
|
3628
|
+
* ```ts import.meta.vitest
|
|
3629
|
+
* import { Graph, Option } from "effect"
|
|
2928
3630
|
*
|
|
2929
3631
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
2930
3632
|
* const a = Graph.addNode(mutable, "A")
|
|
@@ -2941,10 +3643,7 @@ export interface DijkstraConfig<E> {
|
|
|
2941
3643
|
* cost: (edgeData) => edgeData
|
|
2942
3644
|
* })
|
|
2943
3645
|
*
|
|
2944
|
-
*
|
|
2945
|
-
* console.log(result.value.path) // [0, 1, 2] - shortest path A->B->C
|
|
2946
|
-
* console.log(result.value.distance) // 7 - total distance
|
|
2947
|
-
* }
|
|
3646
|
+
* Option.map(result, ({ distance, path }) => [distance, path] as const) // => Option.some([7, [0, 1, 2]])
|
|
2948
3647
|
* ```
|
|
2949
3648
|
*
|
|
2950
3649
|
* @category algorithms
|
|
@@ -2957,14 +3656,15 @@ export declare const dijkstra: {
|
|
|
2957
3656
|
*
|
|
2958
3657
|
* **Details**
|
|
2959
3658
|
*
|
|
2960
|
-
* Edge costs must be non-negative
|
|
2961
|
-
*
|
|
2962
|
-
*
|
|
3659
|
+
* Edge costs must be non-negative and not `NaN`. `Infinity` is allowed and
|
|
3660
|
+
* behaves like an impassable edge. Returns `Option.none()` when the target is
|
|
3661
|
+
* not reachable, and throws a `GraphError` when either endpoint is missing or an
|
|
3662
|
+
* edge cost is negative or `NaN`.
|
|
2963
3663
|
*
|
|
2964
3664
|
* **Example** (Finding shortest paths with Dijkstra)
|
|
2965
3665
|
*
|
|
2966
|
-
* ```ts
|
|
2967
|
-
* import { Graph } from "effect"
|
|
3666
|
+
* ```ts import.meta.vitest
|
|
3667
|
+
* import { Graph, Option } from "effect"
|
|
2968
3668
|
*
|
|
2969
3669
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
2970
3670
|
* const a = Graph.addNode(mutable, "A")
|
|
@@ -2981,10 +3681,7 @@ export declare const dijkstra: {
|
|
|
2981
3681
|
* cost: (edgeData) => edgeData
|
|
2982
3682
|
* })
|
|
2983
3683
|
*
|
|
2984
|
-
*
|
|
2985
|
-
* console.log(result.value.path) // [0, 1, 2] - shortest path A->B->C
|
|
2986
|
-
* console.log(result.value.distance) // 7 - total distance
|
|
2987
|
-
* }
|
|
3684
|
+
* Option.map(result, ({ distance, path }) => [distance, path] as const) // => Option.some([7, [0, 1, 2]])
|
|
2988
3685
|
* ```
|
|
2989
3686
|
*
|
|
2990
3687
|
* @category algorithms
|
|
@@ -2997,14 +3694,15 @@ export declare const dijkstra: {
|
|
|
2997
3694
|
*
|
|
2998
3695
|
* **Details**
|
|
2999
3696
|
*
|
|
3000
|
-
* Edge costs must be non-negative
|
|
3001
|
-
*
|
|
3002
|
-
*
|
|
3697
|
+
* Edge costs must be non-negative and not `NaN`. `Infinity` is allowed and
|
|
3698
|
+
* behaves like an impassable edge. Returns `Option.none()` when the target is
|
|
3699
|
+
* not reachable, and throws a `GraphError` when either endpoint is missing or an
|
|
3700
|
+
* edge cost is negative or `NaN`.
|
|
3003
3701
|
*
|
|
3004
3702
|
* **Example** (Finding shortest paths with Dijkstra)
|
|
3005
3703
|
*
|
|
3006
|
-
* ```ts
|
|
3007
|
-
* import { Graph } from "effect"
|
|
3704
|
+
* ```ts import.meta.vitest
|
|
3705
|
+
* import { Graph, Option } from "effect"
|
|
3008
3706
|
*
|
|
3009
3707
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
3010
3708
|
* const a = Graph.addNode(mutable, "A")
|
|
@@ -3021,10 +3719,7 @@ export declare const dijkstra: {
|
|
|
3021
3719
|
* cost: (edgeData) => edgeData
|
|
3022
3720
|
* })
|
|
3023
3721
|
*
|
|
3024
|
-
*
|
|
3025
|
-
* console.log(result.value.path) // [0, 1, 2] - shortest path A->B->C
|
|
3026
|
-
* console.log(result.value.distance) // 7 - total distance
|
|
3027
|
-
* }
|
|
3722
|
+
* Option.map(result, ({ distance, path }) => [distance, path] as const) // => Option.some([7, [0, 1, 2]])
|
|
3028
3723
|
* ```
|
|
3029
3724
|
*
|
|
3030
3725
|
* @category algorithms
|
|
@@ -3064,12 +3759,13 @@ export interface AllPairsResult<E> {
|
|
|
3064
3759
|
* **Details**
|
|
3065
3760
|
*
|
|
3066
3761
|
* Computes distances, reconstructed node paths, and edge-data paths for every
|
|
3067
|
-
* source and target pair in O(V^3) time. Negative edge weights are allowed,
|
|
3068
|
-
*
|
|
3762
|
+
* source and target pair in O(V^3) time. Negative edge weights are allowed, and
|
|
3763
|
+
* `Infinity` behaves like an impassable edge. A `GraphError` is thrown if any
|
|
3764
|
+
* edge weight is `NaN` or `-Infinity`, or if any negative cycle is detected.
|
|
3069
3765
|
*
|
|
3070
3766
|
* **Example** (Finding all-pairs shortest paths)
|
|
3071
3767
|
*
|
|
3072
|
-
* ```ts
|
|
3768
|
+
* ```ts import.meta.vitest
|
|
3073
3769
|
* import { Graph } from "effect"
|
|
3074
3770
|
*
|
|
3075
3771
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -3082,8 +3778,8 @@ export interface AllPairsResult<E> {
|
|
|
3082
3778
|
* })
|
|
3083
3779
|
*
|
|
3084
3780
|
* const result = Graph.floydWarshall(graph, (edgeData) => edgeData)
|
|
3085
|
-
* const
|
|
3086
|
-
*
|
|
3781
|
+
* const shortest = { distance: result.distances.get(0)?.get(2), path: result.paths.get(0)?.get(2) }
|
|
3782
|
+
* shortest // => { distance: 5, path: [0, 1, 2] }
|
|
3087
3783
|
* ```
|
|
3088
3784
|
*
|
|
3089
3785
|
* @category algorithms
|
|
@@ -3097,12 +3793,13 @@ export declare const floydWarshall: {
|
|
|
3097
3793
|
* **Details**
|
|
3098
3794
|
*
|
|
3099
3795
|
* Computes distances, reconstructed node paths, and edge-data paths for every
|
|
3100
|
-
* source and target pair in O(V^3) time. Negative edge weights are allowed,
|
|
3101
|
-
*
|
|
3796
|
+
* source and target pair in O(V^3) time. Negative edge weights are allowed, and
|
|
3797
|
+
* `Infinity` behaves like an impassable edge. A `GraphError` is thrown if any
|
|
3798
|
+
* edge weight is `NaN` or `-Infinity`, or if any negative cycle is detected.
|
|
3102
3799
|
*
|
|
3103
3800
|
* **Example** (Finding all-pairs shortest paths)
|
|
3104
3801
|
*
|
|
3105
|
-
* ```ts
|
|
3802
|
+
* ```ts import.meta.vitest
|
|
3106
3803
|
* import { Graph } from "effect"
|
|
3107
3804
|
*
|
|
3108
3805
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -3115,8 +3812,8 @@ export declare const floydWarshall: {
|
|
|
3115
3812
|
* })
|
|
3116
3813
|
*
|
|
3117
3814
|
* const result = Graph.floydWarshall(graph, (edgeData) => edgeData)
|
|
3118
|
-
* const
|
|
3119
|
-
*
|
|
3815
|
+
* const shortest = { distance: result.distances.get(0)?.get(2), path: result.paths.get(0)?.get(2) }
|
|
3816
|
+
* shortest // => { distance: 5, path: [0, 1, 2] }
|
|
3120
3817
|
* ```
|
|
3121
3818
|
*
|
|
3122
3819
|
* @category algorithms
|
|
@@ -3130,12 +3827,13 @@ export declare const floydWarshall: {
|
|
|
3130
3827
|
* **Details**
|
|
3131
3828
|
*
|
|
3132
3829
|
* Computes distances, reconstructed node paths, and edge-data paths for every
|
|
3133
|
-
* source and target pair in O(V^3) time. Negative edge weights are allowed,
|
|
3134
|
-
*
|
|
3830
|
+
* source and target pair in O(V^3) time. Negative edge weights are allowed, and
|
|
3831
|
+
* `Infinity` behaves like an impassable edge. A `GraphError` is thrown if any
|
|
3832
|
+
* edge weight is `NaN` or `-Infinity`, or if any negative cycle is detected.
|
|
3135
3833
|
*
|
|
3136
3834
|
* **Example** (Finding all-pairs shortest paths)
|
|
3137
3835
|
*
|
|
3138
|
-
* ```ts
|
|
3836
|
+
* ```ts import.meta.vitest
|
|
3139
3837
|
* import { Graph } from "effect"
|
|
3140
3838
|
*
|
|
3141
3839
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -3148,8 +3846,8 @@ export declare const floydWarshall: {
|
|
|
3148
3846
|
* })
|
|
3149
3847
|
*
|
|
3150
3848
|
* const result = Graph.floydWarshall(graph, (edgeData) => edgeData)
|
|
3151
|
-
* const
|
|
3152
|
-
*
|
|
3849
|
+
* const shortest = { distance: result.distances.get(0)?.get(2), path: result.paths.get(0)?.get(2) }
|
|
3850
|
+
* shortest // => { distance: 5, path: [0, 1, 2] }
|
|
3153
3851
|
* ```
|
|
3154
3852
|
*
|
|
3155
3853
|
* @category algorithms
|
|
@@ -3167,8 +3865,9 @@ export declare const floydWarshall: {
|
|
|
3167
3865
|
*
|
|
3168
3866
|
* **Details**
|
|
3169
3867
|
*
|
|
3170
|
-
* Specifies the source and target node indices, an edge-cost function
|
|
3171
|
-
*
|
|
3868
|
+
* Specifies the source and target node indices, an edge-cost function that maps
|
|
3869
|
+
* edge data to non-negative weights, and a heuristic that estimates the
|
|
3870
|
+
* remaining cost from a node to the target.
|
|
3172
3871
|
*
|
|
3173
3872
|
* @see {@link astar} for the algorithm that consumes this configuration
|
|
3174
3873
|
* @see {@link DijkstraConfig} for shortest paths without a heuristic
|
|
@@ -3189,15 +3888,16 @@ export interface AstarConfig<E, N> {
|
|
|
3189
3888
|
*
|
|
3190
3889
|
* **Details**
|
|
3191
3890
|
*
|
|
3192
|
-
* The edge-cost function must return non-negative weights
|
|
3891
|
+
* The edge-cost function must return non-negative weights and not `NaN`.
|
|
3892
|
+
* `Infinity` is allowed and behaves like an impassable edge. The heuristic
|
|
3193
3893
|
* should be consistent to preserve shortest-path guarantees. Returns
|
|
3194
3894
|
* `Option.none()` when the target is not reachable, and throws a `GraphError`
|
|
3195
|
-
* when either endpoint is missing or
|
|
3895
|
+
* when either endpoint is missing or an edge cost is negative or `NaN`.
|
|
3196
3896
|
*
|
|
3197
3897
|
* **Example** (Finding shortest paths with A-star)
|
|
3198
3898
|
*
|
|
3199
|
-
* ```ts
|
|
3200
|
-
* import { Graph } from "effect"
|
|
3899
|
+
* ```ts import.meta.vitest
|
|
3900
|
+
* import { Graph, Option } from "effect"
|
|
3201
3901
|
*
|
|
3202
3902
|
* const graph = Graph.directed<{ x: number; y: number }, number>((mutable) => {
|
|
3203
3903
|
* const a = Graph.addNode(mutable, { x: 0, y: 0 })
|
|
@@ -3220,10 +3920,7 @@ export interface AstarConfig<E, N> {
|
|
|
3220
3920
|
* heuristic
|
|
3221
3921
|
* })
|
|
3222
3922
|
*
|
|
3223
|
-
*
|
|
3224
|
-
* console.log(result.value.path) // [0, 1, 2] - shortest path
|
|
3225
|
-
* console.log(result.value.distance) // 2 - total distance
|
|
3226
|
-
* }
|
|
3923
|
+
* Option.map(result, ({ distance, path }) => [distance, path] as const) // => Option.some([2, [0, 1, 2]])
|
|
3227
3924
|
* ```
|
|
3228
3925
|
*
|
|
3229
3926
|
* @category algorithms
|
|
@@ -3236,15 +3933,16 @@ export declare const astar: {
|
|
|
3236
3933
|
*
|
|
3237
3934
|
* **Details**
|
|
3238
3935
|
*
|
|
3239
|
-
* The edge-cost function must return non-negative weights
|
|
3936
|
+
* The edge-cost function must return non-negative weights and not `NaN`.
|
|
3937
|
+
* `Infinity` is allowed and behaves like an impassable edge. The heuristic
|
|
3240
3938
|
* should be consistent to preserve shortest-path guarantees. Returns
|
|
3241
3939
|
* `Option.none()` when the target is not reachable, and throws a `GraphError`
|
|
3242
|
-
* when either endpoint is missing or
|
|
3940
|
+
* when either endpoint is missing or an edge cost is negative or `NaN`.
|
|
3243
3941
|
*
|
|
3244
3942
|
* **Example** (Finding shortest paths with A-star)
|
|
3245
3943
|
*
|
|
3246
|
-
* ```ts
|
|
3247
|
-
* import { Graph } from "effect"
|
|
3944
|
+
* ```ts import.meta.vitest
|
|
3945
|
+
* import { Graph, Option } from "effect"
|
|
3248
3946
|
*
|
|
3249
3947
|
* const graph = Graph.directed<{ x: number; y: number }, number>((mutable) => {
|
|
3250
3948
|
* const a = Graph.addNode(mutable, { x: 0, y: 0 })
|
|
@@ -3267,10 +3965,7 @@ export declare const astar: {
|
|
|
3267
3965
|
* heuristic
|
|
3268
3966
|
* })
|
|
3269
3967
|
*
|
|
3270
|
-
*
|
|
3271
|
-
* console.log(result.value.path) // [0, 1, 2] - shortest path
|
|
3272
|
-
* console.log(result.value.distance) // 2 - total distance
|
|
3273
|
-
* }
|
|
3968
|
+
* Option.map(result, ({ distance, path }) => [distance, path] as const) // => Option.some([2, [0, 1, 2]])
|
|
3274
3969
|
* ```
|
|
3275
3970
|
*
|
|
3276
3971
|
* @category algorithms
|
|
@@ -3283,15 +3978,16 @@ export declare const astar: {
|
|
|
3283
3978
|
*
|
|
3284
3979
|
* **Details**
|
|
3285
3980
|
*
|
|
3286
|
-
* The edge-cost function must return non-negative weights
|
|
3981
|
+
* The edge-cost function must return non-negative weights and not `NaN`.
|
|
3982
|
+
* `Infinity` is allowed and behaves like an impassable edge. The heuristic
|
|
3287
3983
|
* should be consistent to preserve shortest-path guarantees. Returns
|
|
3288
3984
|
* `Option.none()` when the target is not reachable, and throws a `GraphError`
|
|
3289
|
-
* when either endpoint is missing or
|
|
3985
|
+
* when either endpoint is missing or an edge cost is negative or `NaN`.
|
|
3290
3986
|
*
|
|
3291
3987
|
* **Example** (Finding shortest paths with A-star)
|
|
3292
3988
|
*
|
|
3293
|
-
* ```ts
|
|
3294
|
-
* import { Graph } from "effect"
|
|
3989
|
+
* ```ts import.meta.vitest
|
|
3990
|
+
* import { Graph, Option } from "effect"
|
|
3295
3991
|
*
|
|
3296
3992
|
* const graph = Graph.directed<{ x: number; y: number }, number>((mutable) => {
|
|
3297
3993
|
* const a = Graph.addNode(mutable, { x: 0, y: 0 })
|
|
@@ -3314,10 +4010,7 @@ export declare const astar: {
|
|
|
3314
4010
|
* heuristic
|
|
3315
4011
|
* })
|
|
3316
4012
|
*
|
|
3317
|
-
*
|
|
3318
|
-
* console.log(result.value.path) // [0, 1, 2] - shortest path
|
|
3319
|
-
* console.log(result.value.distance) // 2 - total distance
|
|
3320
|
-
* }
|
|
4013
|
+
* Option.map(result, ({ distance, path }) => [distance, path] as const) // => Option.some([2, [0, 1, 2]])
|
|
3321
4014
|
* ```
|
|
3322
4015
|
*
|
|
3323
4016
|
* @category algorithms
|
|
@@ -3356,14 +4049,15 @@ export interface BellmanFordConfig<E> {
|
|
|
3356
4049
|
*
|
|
3357
4050
|
* **Details**
|
|
3358
4051
|
*
|
|
3359
|
-
* Negative edge weights are allowed
|
|
3360
|
-
*
|
|
3361
|
-
*
|
|
4052
|
+
* Negative edge weights are allowed, and `Infinity` behaves like an impassable
|
|
4053
|
+
* edge. Returns `Option.none()` when the target is unreachable or when a
|
|
4054
|
+
* negative cycle affects the path to the target. Throws a `GraphError` when
|
|
4055
|
+
* either endpoint is missing or an edge weight is `NaN` or `-Infinity`.
|
|
3362
4056
|
*
|
|
3363
4057
|
* **Example** (Finding shortest paths with Bellman-Ford)
|
|
3364
4058
|
*
|
|
3365
|
-
* ```ts
|
|
3366
|
-
* import { Graph } from "effect"
|
|
4059
|
+
* ```ts import.meta.vitest
|
|
4060
|
+
* import { Graph, Option } from "effect"
|
|
3367
4061
|
*
|
|
3368
4062
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
3369
4063
|
* const a = Graph.addNode(mutable, "A")
|
|
@@ -3380,10 +4074,7 @@ export interface BellmanFordConfig<E> {
|
|
|
3380
4074
|
* cost: (edgeData) => edgeData
|
|
3381
4075
|
* })
|
|
3382
4076
|
*
|
|
3383
|
-
*
|
|
3384
|
-
* console.log(result.value.path) // [0, 1, 2] - shortest path A->B->C
|
|
3385
|
-
* console.log(result.value.distance) // 2 - total distance
|
|
3386
|
-
* }
|
|
4077
|
+
* Option.map(result, ({ distance, path }) => [distance, path] as const) // => Option.some([2, [0, 1, 2]])
|
|
3387
4078
|
* ```
|
|
3388
4079
|
*
|
|
3389
4080
|
* @category algorithms
|
|
@@ -3396,14 +4087,15 @@ export declare const bellmanFord: {
|
|
|
3396
4087
|
*
|
|
3397
4088
|
* **Details**
|
|
3398
4089
|
*
|
|
3399
|
-
* Negative edge weights are allowed
|
|
3400
|
-
*
|
|
3401
|
-
*
|
|
4090
|
+
* Negative edge weights are allowed, and `Infinity` behaves like an impassable
|
|
4091
|
+
* edge. Returns `Option.none()` when the target is unreachable or when a
|
|
4092
|
+
* negative cycle affects the path to the target. Throws a `GraphError` when
|
|
4093
|
+
* either endpoint is missing or an edge weight is `NaN` or `-Infinity`.
|
|
3402
4094
|
*
|
|
3403
4095
|
* **Example** (Finding shortest paths with Bellman-Ford)
|
|
3404
4096
|
*
|
|
3405
|
-
* ```ts
|
|
3406
|
-
* import { Graph } from "effect"
|
|
4097
|
+
* ```ts import.meta.vitest
|
|
4098
|
+
* import { Graph, Option } from "effect"
|
|
3407
4099
|
*
|
|
3408
4100
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
3409
4101
|
* const a = Graph.addNode(mutable, "A")
|
|
@@ -3420,10 +4112,7 @@ export declare const bellmanFord: {
|
|
|
3420
4112
|
* cost: (edgeData) => edgeData
|
|
3421
4113
|
* })
|
|
3422
4114
|
*
|
|
3423
|
-
*
|
|
3424
|
-
* console.log(result.value.path) // [0, 1, 2] - shortest path A->B->C
|
|
3425
|
-
* console.log(result.value.distance) // 2 - total distance
|
|
3426
|
-
* }
|
|
4115
|
+
* Option.map(result, ({ distance, path }) => [distance, path] as const) // => Option.some([2, [0, 1, 2]])
|
|
3427
4116
|
* ```
|
|
3428
4117
|
*
|
|
3429
4118
|
* @category algorithms
|
|
@@ -3436,14 +4125,15 @@ export declare const bellmanFord: {
|
|
|
3436
4125
|
*
|
|
3437
4126
|
* **Details**
|
|
3438
4127
|
*
|
|
3439
|
-
* Negative edge weights are allowed
|
|
3440
|
-
*
|
|
3441
|
-
*
|
|
4128
|
+
* Negative edge weights are allowed, and `Infinity` behaves like an impassable
|
|
4129
|
+
* edge. Returns `Option.none()` when the target is unreachable or when a
|
|
4130
|
+
* negative cycle affects the path to the target. Throws a `GraphError` when
|
|
4131
|
+
* either endpoint is missing or an edge weight is `NaN` or `-Infinity`.
|
|
3442
4132
|
*
|
|
3443
4133
|
* **Example** (Finding shortest paths with Bellman-Ford)
|
|
3444
4134
|
*
|
|
3445
|
-
* ```ts
|
|
3446
|
-
* import { Graph } from "effect"
|
|
4135
|
+
* ```ts import.meta.vitest
|
|
4136
|
+
* import { Graph, Option } from "effect"
|
|
3447
4137
|
*
|
|
3448
4138
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
3449
4139
|
* const a = Graph.addNode(mutable, "A")
|
|
@@ -3460,10 +4150,7 @@ export declare const bellmanFord: {
|
|
|
3460
4150
|
* cost: (edgeData) => edgeData
|
|
3461
4151
|
* })
|
|
3462
4152
|
*
|
|
3463
|
-
*
|
|
3464
|
-
* console.log(result.value.path) // [0, 1, 2] - shortest path A->B->C
|
|
3465
|
-
* console.log(result.value.distance) // 2 - total distance
|
|
3466
|
-
* }
|
|
4153
|
+
* Option.map(result, ({ distance, path }) => [distance, path] as const) // => Option.some([2, [0, 1, 2]])
|
|
3467
4154
|
* ```
|
|
3468
4155
|
*
|
|
3469
4156
|
* @category algorithms
|
|
@@ -3482,7 +4169,7 @@ export declare const bellmanFord: {
|
|
|
3482
4169
|
*
|
|
3483
4170
|
* **Example** (Working with node walkers)
|
|
3484
4171
|
*
|
|
3485
|
-
* ```ts
|
|
4172
|
+
* ```ts import.meta.vitest
|
|
3486
4173
|
* import { Graph } from "effect"
|
|
3487
4174
|
*
|
|
3488
4175
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -3501,8 +4188,8 @@ export declare const bellmanFord: {
|
|
|
3501
4188
|
* }
|
|
3502
4189
|
*
|
|
3503
4190
|
* // Access node data using values() or entries()
|
|
3504
|
-
*
|
|
3505
|
-
*
|
|
4191
|
+
* Array.from(Graph.values(dfsNodes)) // => ["A", "B"]
|
|
4192
|
+
* Array.from(Graph.entries(allNodes)) // => [[0, "A"], [1, "B"]]
|
|
3506
4193
|
* ```
|
|
3507
4194
|
*
|
|
3508
4195
|
* @category models
|
|
@@ -3521,7 +4208,7 @@ export declare class Walker<T, N> implements Iterable<[T, N]> {
|
|
|
3521
4208
|
*
|
|
3522
4209
|
* **Example** (Visiting walker elements)
|
|
3523
4210
|
*
|
|
3524
|
-
* ```ts
|
|
4211
|
+
* ```ts import.meta.vitest
|
|
3525
4212
|
* import { Graph } from "effect"
|
|
3526
4213
|
*
|
|
3527
4214
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -3533,14 +4220,10 @@ export declare class Walker<T, N> implements Iterable<[T, N]> {
|
|
|
3533
4220
|
* const dfs = Graph.dfs(graph, { start: [0] })
|
|
3534
4221
|
*
|
|
3535
4222
|
* // Map to just the node data
|
|
3536
|
-
*
|
|
3537
|
-
* console.log(values) // ["A", "B"]
|
|
4223
|
+
* Array.from(dfs.visit((index, data) => data)) // => ["A", "B"]
|
|
3538
4224
|
*
|
|
3539
4225
|
* // Map to custom objects
|
|
3540
|
-
*
|
|
3541
|
-
* dfs.visit((index, data) => ({ id: index, name: data }))
|
|
3542
|
-
* )
|
|
3543
|
-
* console.log(custom) // [{ id: 0, name: "A" }, { id: 1, name: "B" }]
|
|
4226
|
+
* Array.from(dfs.visit((index, data) => ({ id: index, name: data }))) // => [{ id: 0, name: "A" }, { id: 1, name: "B" }]
|
|
3544
4227
|
* ```
|
|
3545
4228
|
*
|
|
3546
4229
|
* @since 4.0.0
|
|
@@ -3556,7 +4239,7 @@ export declare class Walker<T, N> implements Iterable<[T, N]> {
|
|
|
3556
4239
|
*
|
|
3557
4240
|
* **Example** (Visiting walker elements)
|
|
3558
4241
|
*
|
|
3559
|
-
* ```ts
|
|
4242
|
+
* ```ts import.meta.vitest
|
|
3560
4243
|
* import { Graph } from "effect"
|
|
3561
4244
|
*
|
|
3562
4245
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -3568,14 +4251,10 @@ export declare class Walker<T, N> implements Iterable<[T, N]> {
|
|
|
3568
4251
|
* const dfs = Graph.dfs(graph, { start: [0] })
|
|
3569
4252
|
*
|
|
3570
4253
|
* // Map to just the node data
|
|
3571
|
-
*
|
|
3572
|
-
* console.log(values) // ["A", "B"]
|
|
4254
|
+
* Array.from(dfs.visit((index, data) => data)) // => ["A", "B"]
|
|
3573
4255
|
*
|
|
3574
4256
|
* // Map to custom objects
|
|
3575
|
-
*
|
|
3576
|
-
* dfs.visit((index, data) => ({ id: index, name: data }))
|
|
3577
|
-
* )
|
|
3578
|
-
* console.log(custom) // [{ id: 0, name: "A" }, { id: 1, name: "B" }]
|
|
4257
|
+
* Array.from(dfs.visit((index, data) => ({ id: index, name: data }))) // => [{ id: 0, name: "A" }, { id: 1, name: "B" }]
|
|
3579
4258
|
* ```
|
|
3580
4259
|
*
|
|
3581
4260
|
* @category iterators
|
|
@@ -3622,7 +4301,7 @@ export type EdgeWalker<E> = Walker<EdgeIndex, Edge<E>>;
|
|
|
3622
4301
|
*
|
|
3623
4302
|
* **Example** (Iterating walker indices)
|
|
3624
4303
|
*
|
|
3625
|
-
* ```ts
|
|
4304
|
+
* ```ts import.meta.vitest
|
|
3626
4305
|
* import { Graph } from "effect"
|
|
3627
4306
|
*
|
|
3628
4307
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -3632,8 +4311,7 @@ export type EdgeWalker<E> = Walker<EdgeIndex, Edge<E>>;
|
|
|
3632
4311
|
* })
|
|
3633
4312
|
*
|
|
3634
4313
|
* const dfs = Graph.dfs(graph, { start: [0] })
|
|
3635
|
-
*
|
|
3636
|
-
* console.log(indices) // [0, 1]
|
|
4314
|
+
* Array.from(Graph.indices(dfs)) // => [0, 1]
|
|
3637
4315
|
* ```
|
|
3638
4316
|
*
|
|
3639
4317
|
* @category iterators
|
|
@@ -3645,7 +4323,7 @@ export declare const indices: <T, N>(walker: Walker<T, N>) => Iterable<T>;
|
|
|
3645
4323
|
*
|
|
3646
4324
|
* **Example** (Iterating walker values)
|
|
3647
4325
|
*
|
|
3648
|
-
* ```ts
|
|
4326
|
+
* ```ts import.meta.vitest
|
|
3649
4327
|
* import { Graph } from "effect"
|
|
3650
4328
|
*
|
|
3651
4329
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -3655,8 +4333,7 @@ export declare const indices: <T, N>(walker: Walker<T, N>) => Iterable<T>;
|
|
|
3655
4333
|
* })
|
|
3656
4334
|
*
|
|
3657
4335
|
* const dfs = Graph.dfs(graph, { start: [0] })
|
|
3658
|
-
*
|
|
3659
|
-
* console.log(values) // ["A", "B"]
|
|
4336
|
+
* Array.from(Graph.values(dfs)) // => ["A", "B"]
|
|
3660
4337
|
* ```
|
|
3661
4338
|
*
|
|
3662
4339
|
* @category iterators
|
|
@@ -3668,7 +4345,7 @@ export declare const values: <T, N>(walker: Walker<T, N>) => Iterable<N>;
|
|
|
3668
4345
|
*
|
|
3669
4346
|
* **Example** (Iterating walker entries)
|
|
3670
4347
|
*
|
|
3671
|
-
* ```ts
|
|
4348
|
+
* ```ts import.meta.vitest
|
|
3672
4349
|
* import { Graph } from "effect"
|
|
3673
4350
|
*
|
|
3674
4351
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -3678,8 +4355,7 @@ export declare const values: <T, N>(walker: Walker<T, N>) => Iterable<N>;
|
|
|
3678
4355
|
* })
|
|
3679
4356
|
*
|
|
3680
4357
|
* const dfs = Graph.dfs(graph, { start: [0] })
|
|
3681
|
-
*
|
|
3682
|
-
* console.log(entries) // [[0, "A"], [1, "B"]]
|
|
4358
|
+
* Array.from(Graph.entries(dfs)) // => [[0, "A"], [1, "B"]]
|
|
3683
4359
|
* ```
|
|
3684
4360
|
*
|
|
3685
4361
|
* @category iterators
|
|
@@ -3698,7 +4374,8 @@ export declare const entries: <T, N>(walker: Walker<T, N>) => Iterable<[T, N]>;
|
|
|
3698
4374
|
*
|
|
3699
4375
|
* `start` supplies the node indices where traversal begins. If it is omitted,
|
|
3700
4376
|
* the iterator is empty. `direction` chooses whether traversal follows
|
|
3701
|
-
* outgoing
|
|
4377
|
+
* outgoing edges, incoming edges, or ignores edge direction. `radius` limits
|
|
4378
|
+
* traversal by edge distance from the nearest start node.
|
|
3702
4379
|
*
|
|
3703
4380
|
* **Gotchas**
|
|
3704
4381
|
*
|
|
@@ -3714,7 +4391,8 @@ export declare const entries: <T, N>(walker: Walker<T, N>) => Iterable<[T, N]>;
|
|
|
3714
4391
|
*/
|
|
3715
4392
|
export interface SearchConfig {
|
|
3716
4393
|
readonly start?: Array<NodeIndex>;
|
|
3717
|
-
readonly direction?:
|
|
4394
|
+
readonly direction?: TraversalDirection;
|
|
4395
|
+
readonly radius?: number;
|
|
3718
4396
|
}
|
|
3719
4397
|
/**
|
|
3720
4398
|
* Creates a lazy depth-first traversal iterator from the configured start
|
|
@@ -3723,12 +4401,13 @@ export interface SearchConfig {
|
|
|
3723
4401
|
* **Details**
|
|
3724
4402
|
*
|
|
3725
4403
|
* If no start nodes are supplied, the iterator is empty. The `direction` option
|
|
3726
|
-
* chooses whether to follow outgoing or incoming edges.
|
|
4404
|
+
* chooses whether to follow outgoing or incoming edges. The `radius` option
|
|
4405
|
+
* limits traversal by edge distance from the start nodes. Throws a `GraphError`
|
|
3727
4406
|
* if any configured start node does not exist.
|
|
3728
4407
|
*
|
|
3729
4408
|
* **Example** (Traversing depth-first)
|
|
3730
4409
|
*
|
|
3731
|
-
* ```ts
|
|
4410
|
+
* ```ts import.meta.vitest
|
|
3732
4411
|
* import { Graph } from "effect"
|
|
3733
4412
|
*
|
|
3734
4413
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -3740,14 +4419,10 @@ export interface SearchConfig {
|
|
|
3740
4419
|
* })
|
|
3741
4420
|
*
|
|
3742
4421
|
* // Start from a specific node
|
|
3743
|
-
*
|
|
3744
|
-
* for (const nodeIndex of Graph.indices(dfs1)) {
|
|
3745
|
-
* console.log(nodeIndex) // Traverses in DFS order: 0, 1, 2
|
|
3746
|
-
* }
|
|
4422
|
+
* Array.from(Graph.indices(Graph.dfs(graph, { start: [0] }))) // => [0, 1, 2]
|
|
3747
4423
|
*
|
|
3748
4424
|
* // Empty iterator (no starting nodes)
|
|
3749
|
-
*
|
|
3750
|
-
* // Can be used programmatically
|
|
4425
|
+
* Graph.dfs(graph)
|
|
3751
4426
|
* ```
|
|
3752
4427
|
*
|
|
3753
4428
|
* @category iterators
|
|
@@ -3761,12 +4436,13 @@ export declare const dfs: {
|
|
|
3761
4436
|
* **Details**
|
|
3762
4437
|
*
|
|
3763
4438
|
* If no start nodes are supplied, the iterator is empty. The `direction` option
|
|
3764
|
-
* chooses whether to follow outgoing or incoming edges.
|
|
4439
|
+
* chooses whether to follow outgoing or incoming edges. The `radius` option
|
|
4440
|
+
* limits traversal by edge distance from the start nodes. Throws a `GraphError`
|
|
3765
4441
|
* if any configured start node does not exist.
|
|
3766
4442
|
*
|
|
3767
4443
|
* **Example** (Traversing depth-first)
|
|
3768
4444
|
*
|
|
3769
|
-
* ```ts
|
|
4445
|
+
* ```ts import.meta.vitest
|
|
3770
4446
|
* import { Graph } from "effect"
|
|
3771
4447
|
*
|
|
3772
4448
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -3778,14 +4454,10 @@ export declare const dfs: {
|
|
|
3778
4454
|
* })
|
|
3779
4455
|
*
|
|
3780
4456
|
* // Start from a specific node
|
|
3781
|
-
*
|
|
3782
|
-
* for (const nodeIndex of Graph.indices(dfs1)) {
|
|
3783
|
-
* console.log(nodeIndex) // Traverses in DFS order: 0, 1, 2
|
|
3784
|
-
* }
|
|
4457
|
+
* Array.from(Graph.indices(Graph.dfs(graph, { start: [0] }))) // => [0, 1, 2]
|
|
3785
4458
|
*
|
|
3786
4459
|
* // Empty iterator (no starting nodes)
|
|
3787
|
-
*
|
|
3788
|
-
* // Can be used programmatically
|
|
4460
|
+
* Graph.dfs(graph)
|
|
3789
4461
|
* ```
|
|
3790
4462
|
*
|
|
3791
4463
|
* @category iterators
|
|
@@ -3799,12 +4471,13 @@ export declare const dfs: {
|
|
|
3799
4471
|
* **Details**
|
|
3800
4472
|
*
|
|
3801
4473
|
* If no start nodes are supplied, the iterator is empty. The `direction` option
|
|
3802
|
-
* chooses whether to follow outgoing or incoming edges.
|
|
4474
|
+
* chooses whether to follow outgoing or incoming edges. The `radius` option
|
|
4475
|
+
* limits traversal by edge distance from the start nodes. Throws a `GraphError`
|
|
3803
4476
|
* if any configured start node does not exist.
|
|
3804
4477
|
*
|
|
3805
4478
|
* **Example** (Traversing depth-first)
|
|
3806
4479
|
*
|
|
3807
|
-
* ```ts
|
|
4480
|
+
* ```ts import.meta.vitest
|
|
3808
4481
|
* import { Graph } from "effect"
|
|
3809
4482
|
*
|
|
3810
4483
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -3816,14 +4489,10 @@ export declare const dfs: {
|
|
|
3816
4489
|
* })
|
|
3817
4490
|
*
|
|
3818
4491
|
* // Start from a specific node
|
|
3819
|
-
*
|
|
3820
|
-
* for (const nodeIndex of Graph.indices(dfs1)) {
|
|
3821
|
-
* console.log(nodeIndex) // Traverses in DFS order: 0, 1, 2
|
|
3822
|
-
* }
|
|
4492
|
+
* Array.from(Graph.indices(Graph.dfs(graph, { start: [0] }))) // => [0, 1, 2]
|
|
3823
4493
|
*
|
|
3824
4494
|
* // Empty iterator (no starting nodes)
|
|
3825
|
-
*
|
|
3826
|
-
* // Can be used programmatically
|
|
4495
|
+
* Graph.dfs(graph)
|
|
3827
4496
|
* ```
|
|
3828
4497
|
*
|
|
3829
4498
|
* @category iterators
|
|
@@ -3838,12 +4507,13 @@ export declare const dfs: {
|
|
|
3838
4507
|
* **Details**
|
|
3839
4508
|
*
|
|
3840
4509
|
* If no start nodes are supplied, the iterator is empty. The `direction` option
|
|
3841
|
-
* chooses whether to follow outgoing or incoming edges.
|
|
4510
|
+
* chooses whether to follow outgoing or incoming edges. The `radius` option
|
|
4511
|
+
* limits traversal by edge distance from the start nodes. Throws a `GraphError`
|
|
3842
4512
|
* if any configured start node does not exist.
|
|
3843
4513
|
*
|
|
3844
4514
|
* **Example** (Traversing breadth-first)
|
|
3845
4515
|
*
|
|
3846
|
-
* ```ts
|
|
4516
|
+
* ```ts import.meta.vitest
|
|
3847
4517
|
* import { Graph } from "effect"
|
|
3848
4518
|
*
|
|
3849
4519
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -3855,14 +4525,10 @@ export declare const dfs: {
|
|
|
3855
4525
|
* })
|
|
3856
4526
|
*
|
|
3857
4527
|
* // Start from a specific node
|
|
3858
|
-
*
|
|
3859
|
-
* for (const nodeIndex of Graph.indices(bfs1)) {
|
|
3860
|
-
* console.log(nodeIndex) // Traverses in BFS order: 0, 1, 2
|
|
3861
|
-
* }
|
|
4528
|
+
* Array.from(Graph.indices(Graph.bfs(graph, { start: [0] }))) // => [0, 1, 2]
|
|
3862
4529
|
*
|
|
3863
4530
|
* // Empty iterator (no starting nodes)
|
|
3864
|
-
*
|
|
3865
|
-
* // Can be used programmatically
|
|
4531
|
+
* Graph.bfs(graph)
|
|
3866
4532
|
* ```
|
|
3867
4533
|
*
|
|
3868
4534
|
* @category iterators
|
|
@@ -3876,12 +4542,13 @@ export declare const bfs: {
|
|
|
3876
4542
|
* **Details**
|
|
3877
4543
|
*
|
|
3878
4544
|
* If no start nodes are supplied, the iterator is empty. The `direction` option
|
|
3879
|
-
* chooses whether to follow outgoing or incoming edges.
|
|
4545
|
+
* chooses whether to follow outgoing or incoming edges. The `radius` option
|
|
4546
|
+
* limits traversal by edge distance from the start nodes. Throws a `GraphError`
|
|
3880
4547
|
* if any configured start node does not exist.
|
|
3881
4548
|
*
|
|
3882
4549
|
* **Example** (Traversing breadth-first)
|
|
3883
4550
|
*
|
|
3884
|
-
* ```ts
|
|
4551
|
+
* ```ts import.meta.vitest
|
|
3885
4552
|
* import { Graph } from "effect"
|
|
3886
4553
|
*
|
|
3887
4554
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -3893,14 +4560,10 @@ export declare const bfs: {
|
|
|
3893
4560
|
* })
|
|
3894
4561
|
*
|
|
3895
4562
|
* // Start from a specific node
|
|
3896
|
-
*
|
|
3897
|
-
* for (const nodeIndex of Graph.indices(bfs1)) {
|
|
3898
|
-
* console.log(nodeIndex) // Traverses in BFS order: 0, 1, 2
|
|
3899
|
-
* }
|
|
4563
|
+
* Array.from(Graph.indices(Graph.bfs(graph, { start: [0] }))) // => [0, 1, 2]
|
|
3900
4564
|
*
|
|
3901
4565
|
* // Empty iterator (no starting nodes)
|
|
3902
|
-
*
|
|
3903
|
-
* // Can be used programmatically
|
|
4566
|
+
* Graph.bfs(graph)
|
|
3904
4567
|
* ```
|
|
3905
4568
|
*
|
|
3906
4569
|
* @category iterators
|
|
@@ -3914,12 +4577,13 @@ export declare const bfs: {
|
|
|
3914
4577
|
* **Details**
|
|
3915
4578
|
*
|
|
3916
4579
|
* If no start nodes are supplied, the iterator is empty. The `direction` option
|
|
3917
|
-
* chooses whether to follow outgoing or incoming edges.
|
|
4580
|
+
* chooses whether to follow outgoing or incoming edges. The `radius` option
|
|
4581
|
+
* limits traversal by edge distance from the start nodes. Throws a `GraphError`
|
|
3918
4582
|
* if any configured start node does not exist.
|
|
3919
4583
|
*
|
|
3920
4584
|
* **Example** (Traversing breadth-first)
|
|
3921
4585
|
*
|
|
3922
|
-
* ```ts
|
|
4586
|
+
* ```ts import.meta.vitest
|
|
3923
4587
|
* import { Graph } from "effect"
|
|
3924
4588
|
*
|
|
3925
4589
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -3931,14 +4595,10 @@ export declare const bfs: {
|
|
|
3931
4595
|
* })
|
|
3932
4596
|
*
|
|
3933
4597
|
* // Start from a specific node
|
|
3934
|
-
*
|
|
3935
|
-
* for (const nodeIndex of Graph.indices(bfs1)) {
|
|
3936
|
-
* console.log(nodeIndex) // Traverses in BFS order: 0, 1, 2
|
|
3937
|
-
* }
|
|
4598
|
+
* Array.from(Graph.indices(Graph.bfs(graph, { start: [0] }))) // => [0, 1, 2]
|
|
3938
4599
|
*
|
|
3939
4600
|
* // Empty iterator (no starting nodes)
|
|
3940
|
-
*
|
|
3941
|
-
* // Can be used programmatically
|
|
4601
|
+
* Graph.bfs(graph)
|
|
3942
4602
|
* ```
|
|
3943
4603
|
*
|
|
3944
4604
|
* @category iterators
|
|
@@ -3981,7 +4641,7 @@ export interface TopoConfig {
|
|
|
3981
4641
|
*
|
|
3982
4642
|
* **Example** (Sorting topologically)
|
|
3983
4643
|
*
|
|
3984
|
-
* ```ts
|
|
4644
|
+
* ```ts import.meta.vitest
|
|
3985
4645
|
* import { Graph } from "effect"
|
|
3986
4646
|
*
|
|
3987
4647
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -3993,13 +4653,10 @@ export interface TopoConfig {
|
|
|
3993
4653
|
* })
|
|
3994
4654
|
*
|
|
3995
4655
|
* // Standard topological sort
|
|
3996
|
-
*
|
|
3997
|
-
* for (const nodeIndex of Graph.indices(topo1)) {
|
|
3998
|
-
* console.log(nodeIndex) // 0, 1, 2 (topological order)
|
|
3999
|
-
* }
|
|
4656
|
+
* Array.from(Graph.indices(Graph.topo(graph))) // => [0, 1, 2]
|
|
4000
4657
|
*
|
|
4001
4658
|
* // With initial nodes
|
|
4002
|
-
*
|
|
4659
|
+
* Graph.topo(graph, { initials: [0] })
|
|
4003
4660
|
*
|
|
4004
4661
|
* // Check before sorting a cyclic graph
|
|
4005
4662
|
* const cyclicGraph = Graph.directed<string, number>((mutable) => {
|
|
@@ -4009,9 +4666,7 @@ export interface TopoConfig {
|
|
|
4009
4666
|
* Graph.addEdge(mutable, b, a, 2) // Creates cycle
|
|
4010
4667
|
* })
|
|
4011
4668
|
*
|
|
4012
|
-
*
|
|
4013
|
-
* console.log("cyclic graph") // cyclic graph
|
|
4014
|
-
* }
|
|
4669
|
+
* Graph.isAcyclic(cyclicGraph) // => false
|
|
4015
4670
|
* ```
|
|
4016
4671
|
*
|
|
4017
4672
|
* @category iterators
|
|
@@ -4028,7 +4683,7 @@ export declare const topo: {
|
|
|
4028
4683
|
*
|
|
4029
4684
|
* **Example** (Sorting topologically)
|
|
4030
4685
|
*
|
|
4031
|
-
* ```ts
|
|
4686
|
+
* ```ts import.meta.vitest
|
|
4032
4687
|
* import { Graph } from "effect"
|
|
4033
4688
|
*
|
|
4034
4689
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -4040,13 +4695,10 @@ export declare const topo: {
|
|
|
4040
4695
|
* })
|
|
4041
4696
|
*
|
|
4042
4697
|
* // Standard topological sort
|
|
4043
|
-
*
|
|
4044
|
-
* for (const nodeIndex of Graph.indices(topo1)) {
|
|
4045
|
-
* console.log(nodeIndex) // 0, 1, 2 (topological order)
|
|
4046
|
-
* }
|
|
4698
|
+
* Array.from(Graph.indices(Graph.topo(graph))) // => [0, 1, 2]
|
|
4047
4699
|
*
|
|
4048
4700
|
* // With initial nodes
|
|
4049
|
-
*
|
|
4701
|
+
* Graph.topo(graph, { initials: [0] })
|
|
4050
4702
|
*
|
|
4051
4703
|
* // Check before sorting a cyclic graph
|
|
4052
4704
|
* const cyclicGraph = Graph.directed<string, number>((mutable) => {
|
|
@@ -4056,15 +4708,13 @@ export declare const topo: {
|
|
|
4056
4708
|
* Graph.addEdge(mutable, b, a, 2) // Creates cycle
|
|
4057
4709
|
* })
|
|
4058
4710
|
*
|
|
4059
|
-
*
|
|
4060
|
-
* console.log("cyclic graph") // cyclic graph
|
|
4061
|
-
* }
|
|
4711
|
+
* Graph.isAcyclic(cyclicGraph) // => false
|
|
4062
4712
|
* ```
|
|
4063
4713
|
*
|
|
4064
4714
|
* @category iterators
|
|
4065
4715
|
* @since 3.18.0
|
|
4066
4716
|
*/
|
|
4067
|
-
(config?: TopoConfig): <N, E
|
|
4717
|
+
(config?: TopoConfig): <N, E>(graph: Graph<N, E, "directed"> | MutableGraph<N, E, "directed">) => NodeWalker<N>;
|
|
4068
4718
|
/**
|
|
4069
4719
|
* Creates a new topological sort iterator with optional configuration.
|
|
4070
4720
|
*
|
|
@@ -4075,7 +4725,7 @@ export declare const topo: {
|
|
|
4075
4725
|
*
|
|
4076
4726
|
* **Example** (Sorting topologically)
|
|
4077
4727
|
*
|
|
4078
|
-
* ```ts
|
|
4728
|
+
* ```ts import.meta.vitest
|
|
4079
4729
|
* import { Graph } from "effect"
|
|
4080
4730
|
*
|
|
4081
4731
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -4087,13 +4737,10 @@ export declare const topo: {
|
|
|
4087
4737
|
* })
|
|
4088
4738
|
*
|
|
4089
4739
|
* // Standard topological sort
|
|
4090
|
-
*
|
|
4091
|
-
* for (const nodeIndex of Graph.indices(topo1)) {
|
|
4092
|
-
* console.log(nodeIndex) // 0, 1, 2 (topological order)
|
|
4093
|
-
* }
|
|
4740
|
+
* Array.from(Graph.indices(Graph.topo(graph))) // => [0, 1, 2]
|
|
4094
4741
|
*
|
|
4095
4742
|
* // With initial nodes
|
|
4096
|
-
*
|
|
4743
|
+
* Graph.topo(graph, { initials: [0] })
|
|
4097
4744
|
*
|
|
4098
4745
|
* // Check before sorting a cyclic graph
|
|
4099
4746
|
* const cyclicGraph = Graph.directed<string, number>((mutable) => {
|
|
@@ -4103,15 +4750,13 @@ export declare const topo: {
|
|
|
4103
4750
|
* Graph.addEdge(mutable, b, a, 2) // Creates cycle
|
|
4104
4751
|
* })
|
|
4105
4752
|
*
|
|
4106
|
-
*
|
|
4107
|
-
* console.log("cyclic graph") // cyclic graph
|
|
4108
|
-
* }
|
|
4753
|
+
* Graph.isAcyclic(cyclicGraph) // => false
|
|
4109
4754
|
* ```
|
|
4110
4755
|
*
|
|
4111
4756
|
* @category iterators
|
|
4112
4757
|
* @since 3.18.0
|
|
4113
4758
|
*/
|
|
4114
|
-
<N, E
|
|
4759
|
+
<N, E>(graph: Graph<N, E, "directed"> | MutableGraph<N, E, "directed">, config?: TopoConfig): NodeWalker<N>;
|
|
4115
4760
|
};
|
|
4116
4761
|
/**
|
|
4117
4762
|
* Creates a lazy depth-first postorder traversal iterator from the configured
|
|
@@ -4121,11 +4766,18 @@ export declare const topo: {
|
|
|
4121
4766
|
*
|
|
4122
4767
|
* Nodes are emitted after their reachable descendants have been processed. If
|
|
4123
4768
|
* no start nodes are supplied, the iterator is empty. The `direction` option
|
|
4124
|
-
* chooses whether to follow outgoing or incoming edges.
|
|
4769
|
+
* chooses whether to follow outgoing or incoming edges. The `radius` option
|
|
4770
|
+
* limits traversal by edge distance from the start nodes.
|
|
4771
|
+
*
|
|
4772
|
+
* **Gotchas**
|
|
4773
|
+
*
|
|
4774
|
+
* With a finite `radius`, iteration first performs a bounded breadth-first
|
|
4775
|
+
* traversal to determine shortest-distance membership before emitting nodes in
|
|
4776
|
+
* postorder.
|
|
4125
4777
|
*
|
|
4126
4778
|
* **Example** (Traversing in postorder)
|
|
4127
4779
|
*
|
|
4128
|
-
* ```ts
|
|
4780
|
+
* ```ts import.meta.vitest
|
|
4129
4781
|
* import { Graph } from "effect"
|
|
4130
4782
|
*
|
|
4131
4783
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -4137,10 +4789,7 @@ export declare const topo: {
|
|
|
4137
4789
|
* })
|
|
4138
4790
|
*
|
|
4139
4791
|
* // Postorder: children before parents
|
|
4140
|
-
*
|
|
4141
|
-
* for (const node of postOrder) {
|
|
4142
|
-
* console.log(node) // 1, 2, 0
|
|
4143
|
-
* }
|
|
4792
|
+
* Array.from(Graph.indices(Graph.dfsPostOrder(graph, { start: [0] }))) // => [1, 2, 0]
|
|
4144
4793
|
* ```
|
|
4145
4794
|
*
|
|
4146
4795
|
* @category iterators
|
|
@@ -4155,11 +4804,18 @@ export declare const dfsPostOrder: {
|
|
|
4155
4804
|
*
|
|
4156
4805
|
* Nodes are emitted after their reachable descendants have been processed. If
|
|
4157
4806
|
* no start nodes are supplied, the iterator is empty. The `direction` option
|
|
4158
|
-
* chooses whether to follow outgoing or incoming edges.
|
|
4807
|
+
* chooses whether to follow outgoing or incoming edges. The `radius` option
|
|
4808
|
+
* limits traversal by edge distance from the start nodes.
|
|
4809
|
+
*
|
|
4810
|
+
* **Gotchas**
|
|
4811
|
+
*
|
|
4812
|
+
* With a finite `radius`, iteration first performs a bounded breadth-first
|
|
4813
|
+
* traversal to determine shortest-distance membership before emitting nodes in
|
|
4814
|
+
* postorder.
|
|
4159
4815
|
*
|
|
4160
4816
|
* **Example** (Traversing in postorder)
|
|
4161
4817
|
*
|
|
4162
|
-
* ```ts
|
|
4818
|
+
* ```ts import.meta.vitest
|
|
4163
4819
|
* import { Graph } from "effect"
|
|
4164
4820
|
*
|
|
4165
4821
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -4171,10 +4827,7 @@ export declare const dfsPostOrder: {
|
|
|
4171
4827
|
* })
|
|
4172
4828
|
*
|
|
4173
4829
|
* // Postorder: children before parents
|
|
4174
|
-
*
|
|
4175
|
-
* for (const node of postOrder) {
|
|
4176
|
-
* console.log(node) // 1, 2, 0
|
|
4177
|
-
* }
|
|
4830
|
+
* Array.from(Graph.indices(Graph.dfsPostOrder(graph, { start: [0] }))) // => [1, 2, 0]
|
|
4178
4831
|
* ```
|
|
4179
4832
|
*
|
|
4180
4833
|
* @category iterators
|
|
@@ -4189,11 +4842,18 @@ export declare const dfsPostOrder: {
|
|
|
4189
4842
|
*
|
|
4190
4843
|
* Nodes are emitted after their reachable descendants have been processed. If
|
|
4191
4844
|
* no start nodes are supplied, the iterator is empty. The `direction` option
|
|
4192
|
-
* chooses whether to follow outgoing or incoming edges.
|
|
4845
|
+
* chooses whether to follow outgoing or incoming edges. The `radius` option
|
|
4846
|
+
* limits traversal by edge distance from the start nodes.
|
|
4847
|
+
*
|
|
4848
|
+
* **Gotchas**
|
|
4849
|
+
*
|
|
4850
|
+
* With a finite `radius`, iteration first performs a bounded breadth-first
|
|
4851
|
+
* traversal to determine shortest-distance membership before emitting nodes in
|
|
4852
|
+
* postorder.
|
|
4193
4853
|
*
|
|
4194
4854
|
* **Example** (Traversing in postorder)
|
|
4195
4855
|
*
|
|
4196
|
-
* ```ts
|
|
4856
|
+
* ```ts import.meta.vitest
|
|
4197
4857
|
* import { Graph } from "effect"
|
|
4198
4858
|
*
|
|
4199
4859
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -4205,10 +4865,7 @@ export declare const dfsPostOrder: {
|
|
|
4205
4865
|
* })
|
|
4206
4866
|
*
|
|
4207
4867
|
* // Postorder: children before parents
|
|
4208
|
-
*
|
|
4209
|
-
* for (const node of postOrder) {
|
|
4210
|
-
* console.log(node) // 1, 2, 0
|
|
4211
|
-
* }
|
|
4868
|
+
* Array.from(Graph.indices(Graph.dfsPostOrder(graph, { start: [0] }))) // => [1, 2, 0]
|
|
4212
4869
|
* ```
|
|
4213
4870
|
*
|
|
4214
4871
|
* @category iterators
|
|
@@ -4226,7 +4883,7 @@ export declare const dfsPostOrder: {
|
|
|
4226
4883
|
*
|
|
4227
4884
|
* **Example** (Iterating all nodes)
|
|
4228
4885
|
*
|
|
4229
|
-
* ```ts
|
|
4886
|
+
* ```ts import.meta.vitest
|
|
4230
4887
|
* import { Graph } from "effect"
|
|
4231
4888
|
*
|
|
4232
4889
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -4236,8 +4893,7 @@ export declare const dfsPostOrder: {
|
|
|
4236
4893
|
* Graph.addEdge(mutable, a, b, 1)
|
|
4237
4894
|
* })
|
|
4238
4895
|
*
|
|
4239
|
-
*
|
|
4240
|
-
* console.log(indices) // [0, 1, 2]
|
|
4896
|
+
* Array.from(Graph.indices(Graph.nodes(graph))) // => [0, 1, 2]
|
|
4241
4897
|
* ```
|
|
4242
4898
|
*
|
|
4243
4899
|
* @category iterators
|
|
@@ -4254,7 +4910,7 @@ export declare const nodes: <N, E, T extends Kind = "directed">(graph: Graph<N,
|
|
|
4254
4910
|
*
|
|
4255
4911
|
* **Example** (Iterating all edges)
|
|
4256
4912
|
*
|
|
4257
|
-
* ```ts
|
|
4913
|
+
* ```ts import.meta.vitest
|
|
4258
4914
|
* import { Graph } from "effect"
|
|
4259
4915
|
*
|
|
4260
4916
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -4265,8 +4921,7 @@ export declare const nodes: <N, E, T extends Kind = "directed">(graph: Graph<N,
|
|
|
4265
4921
|
* Graph.addEdge(mutable, b, c, 2)
|
|
4266
4922
|
* })
|
|
4267
4923
|
*
|
|
4268
|
-
*
|
|
4269
|
-
* console.log(indices) // [0, 1]
|
|
4924
|
+
* Array.from(Graph.indices(Graph.edges(graph))) // => [0, 1]
|
|
4270
4925
|
* ```
|
|
4271
4926
|
*
|
|
4272
4927
|
* @category iterators
|
|
@@ -4307,7 +4962,7 @@ export interface ExternalsConfig {
|
|
|
4307
4962
|
*
|
|
4308
4963
|
* **Example** (Iterating external nodes)
|
|
4309
4964
|
*
|
|
4310
|
-
* ```ts
|
|
4965
|
+
* ```ts import.meta.vitest
|
|
4311
4966
|
* import { Graph } from "effect"
|
|
4312
4967
|
*
|
|
4313
4968
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -4321,16 +4976,10 @@ export interface ExternalsConfig {
|
|
|
4321
4976
|
* })
|
|
4322
4977
|
*
|
|
4323
4978
|
* // Nodes with no outgoing edges (sinks + isolated)
|
|
4324
|
-
*
|
|
4325
|
-
* Graph.indices(Graph.externals(graph, { direction: "outgoing" }))
|
|
4326
|
-
* )
|
|
4327
|
-
* console.log(sinks) // [2, 3]
|
|
4979
|
+
* Array.from(Graph.indices(Graph.externals(graph, { direction: "outgoing" }))) // => [2, 3]
|
|
4328
4980
|
*
|
|
4329
4981
|
* // Nodes with no incoming edges (sources + isolated)
|
|
4330
|
-
*
|
|
4331
|
-
* Graph.indices(Graph.externals(graph, { direction: "incoming" }))
|
|
4332
|
-
* )
|
|
4333
|
-
* console.log(sources) // [0, 3]
|
|
4982
|
+
* Array.from(Graph.indices(Graph.externals(graph, { direction: "incoming" }))) // => [0, 3]
|
|
4334
4983
|
* ```
|
|
4335
4984
|
*
|
|
4336
4985
|
* @category iterators
|
|
@@ -4348,7 +4997,7 @@ export declare const externals: {
|
|
|
4348
4997
|
*
|
|
4349
4998
|
* **Example** (Iterating external nodes)
|
|
4350
4999
|
*
|
|
4351
|
-
* ```ts
|
|
5000
|
+
* ```ts import.meta.vitest
|
|
4352
5001
|
* import { Graph } from "effect"
|
|
4353
5002
|
*
|
|
4354
5003
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -4362,16 +5011,10 @@ export declare const externals: {
|
|
|
4362
5011
|
* })
|
|
4363
5012
|
*
|
|
4364
5013
|
* // Nodes with no outgoing edges (sinks + isolated)
|
|
4365
|
-
*
|
|
4366
|
-
* Graph.indices(Graph.externals(graph, { direction: "outgoing" }))
|
|
4367
|
-
* )
|
|
4368
|
-
* console.log(sinks) // [2, 3]
|
|
5014
|
+
* Array.from(Graph.indices(Graph.externals(graph, { direction: "outgoing" }))) // => [2, 3]
|
|
4369
5015
|
*
|
|
4370
5016
|
* // Nodes with no incoming edges (sources + isolated)
|
|
4371
|
-
*
|
|
4372
|
-
* Graph.indices(Graph.externals(graph, { direction: "incoming" }))
|
|
4373
|
-
* )
|
|
4374
|
-
* console.log(sources) // [0, 3]
|
|
5017
|
+
* Array.from(Graph.indices(Graph.externals(graph, { direction: "incoming" }))) // => [0, 3]
|
|
4375
5018
|
* ```
|
|
4376
5019
|
*
|
|
4377
5020
|
* @category iterators
|
|
@@ -4389,7 +5032,7 @@ export declare const externals: {
|
|
|
4389
5032
|
*
|
|
4390
5033
|
* **Example** (Iterating external nodes)
|
|
4391
5034
|
*
|
|
4392
|
-
* ```ts
|
|
5035
|
+
* ```ts import.meta.vitest
|
|
4393
5036
|
* import { Graph } from "effect"
|
|
4394
5037
|
*
|
|
4395
5038
|
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -4403,16 +5046,10 @@ export declare const externals: {
|
|
|
4403
5046
|
* })
|
|
4404
5047
|
*
|
|
4405
5048
|
* // Nodes with no outgoing edges (sinks + isolated)
|
|
4406
|
-
*
|
|
4407
|
-
* Graph.indices(Graph.externals(graph, { direction: "outgoing" }))
|
|
4408
|
-
* )
|
|
4409
|
-
* console.log(sinks) // [2, 3]
|
|
5049
|
+
* Array.from(Graph.indices(Graph.externals(graph, { direction: "outgoing" }))) // => [2, 3]
|
|
4410
5050
|
*
|
|
4411
5051
|
* // Nodes with no incoming edges (sources + isolated)
|
|
4412
|
-
*
|
|
4413
|
-
* Graph.indices(Graph.externals(graph, { direction: "incoming" }))
|
|
4414
|
-
* )
|
|
4415
|
-
* console.log(sources) // [0, 3]
|
|
5052
|
+
* Array.from(Graph.indices(Graph.externals(graph, { direction: "incoming" }))) // => [0, 3]
|
|
4416
5053
|
* ```
|
|
4417
5054
|
*
|
|
4418
5055
|
* @category iterators
|