@langchain/langgraph 0.4.9 → 1.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -0
- package/README.md +1 -2
- package/dist/_virtual/rolldown_runtime.cjs +25 -0
- package/dist/channels/any_value.cjs +44 -63
- package/dist/channels/any_value.cjs.map +1 -0
- package/dist/channels/any_value.d.cts +24 -0
- package/dist/channels/any_value.d.cts.map +1 -0
- package/dist/channels/any_value.d.ts +16 -11
- package/dist/channels/any_value.d.ts.map +1 -0
- package/dist/channels/any_value.js +42 -57
- package/dist/channels/any_value.js.map +1 -1
- package/dist/channels/base.cjs +93 -133
- package/dist/channels/base.cjs.map +1 -0
- package/dist/channels/base.d.cts +79 -0
- package/dist/channels/base.d.cts.map +1 -0
- package/dist/channels/base.d.ts +77 -73
- package/dist/channels/base.d.ts.map +1 -0
- package/dist/channels/base.js +90 -127
- package/dist/channels/base.js.map +1 -1
- package/dist/channels/binop.cjs +47 -77
- package/dist/channels/binop.cjs.map +1 -0
- package/dist/channels/binop.d.cts +22 -0
- package/dist/channels/binop.d.cts.map +1 -0
- package/dist/channels/binop.d.ts +17 -12
- package/dist/channels/binop.d.ts.map +1 -0
- package/dist/channels/binop.js +45 -71
- package/dist/channels/binop.js.map +1 -1
- package/dist/channels/dynamic_barrier_value.cjs +72 -208
- package/dist/channels/dynamic_barrier_value.cjs.map +1 -0
- package/dist/channels/dynamic_barrier_value.d.cts +42 -0
- package/dist/channels/dynamic_barrier_value.d.cts.map +1 -0
- package/dist/channels/dynamic_barrier_value.d.ts +20 -35
- package/dist/channels/dynamic_barrier_value.d.ts.map +1 -0
- package/dist/channels/dynamic_barrier_value.js +69 -200
- package/dist/channels/dynamic_barrier_value.js.map +1 -1
- package/dist/channels/ephemeral_value.cjs +44 -70
- package/dist/channels/ephemeral_value.cjs.map +1 -0
- package/dist/channels/ephemeral_value.d.cts +22 -0
- package/dist/channels/ephemeral_value.d.cts.map +1 -0
- package/dist/channels/ephemeral_value.d.ts +18 -12
- package/dist/channels/ephemeral_value.d.ts.map +1 -0
- package/dist/channels/ephemeral_value.js +43 -65
- package/dist/channels/ephemeral_value.js.map +1 -1
- package/dist/channels/index.cjs +21 -10
- package/dist/channels/index.d.cts +9 -0
- package/dist/channels/index.d.ts +9 -7
- package/dist/channels/index.js +10 -3
- package/dist/channels/last_value.cjs +90 -140
- package/dist/channels/last_value.cjs.map +1 -0
- package/dist/channels/last_value.d.cts +42 -0
- package/dist/channels/last_value.d.cts.map +1 -0
- package/dist/channels/last_value.d.ts +27 -23
- package/dist/channels/last_value.d.ts.map +1 -0
- package/dist/channels/last_value.js +87 -133
- package/dist/channels/last_value.js.map +1 -1
- package/dist/channels/named_barrier_value.cjs +114 -170
- package/dist/channels/named_barrier_value.cjs.map +1 -0
- package/dist/channels/named_barrier_value.d.cts +46 -0
- package/dist/channels/named_barrier_value.d.cts.map +1 -0
- package/dist/channels/named_barrier_value.d.ts +32 -29
- package/dist/channels/named_barrier_value.d.ts.map +1 -0
- package/dist/channels/named_barrier_value.js +111 -163
- package/dist/channels/named_barrier_value.js.map +1 -1
- package/dist/channels/topic.cjs +63 -96
- package/dist/channels/topic.cjs.map +1 -0
- package/dist/channels/topic.d.cts +32 -0
- package/dist/channels/topic.d.cts.map +1 -0
- package/dist/channels/topic.d.ts +28 -19
- package/dist/channels/topic.d.ts.map +1 -0
- package/dist/channels/topic.js +61 -90
- package/dist/channels/topic.js.map +1 -1
- package/dist/constants.cjs +376 -452
- package/dist/constants.cjs.map +1 -0
- package/dist/constants.d.cts +285 -0
- package/dist/constants.d.cts.map +1 -0
- package/dist/constants.d.ts +113 -148
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +336 -444
- package/dist/constants.js.map +1 -1
- package/dist/errors.cjs +151 -179
- package/dist/errors.cjs.map +1 -0
- package/dist/errors.d.cts +81 -0
- package/dist/errors.d.cts.map +1 -0
- package/dist/errors.d.ts +56 -46
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +140 -165
- package/dist/errors.js.map +1 -1
- package/dist/func/index.cjs +292 -290
- package/dist/func/index.cjs.map +1 -0
- package/dist/func/index.d.cts +293 -0
- package/dist/func/index.d.cts.map +1 -0
- package/dist/func/index.d.ts +86 -72
- package/dist/func/index.d.ts.map +1 -0
- package/dist/func/index.js +288 -284
- package/dist/func/index.js.map +1 -1
- package/dist/func/types.d.cts +64 -0
- package/dist/func/types.d.cts.map +1 -0
- package/dist/func/types.d.ts +24 -19
- package/dist/func/types.d.ts.map +1 -0
- package/dist/graph/annotation.cjs +96 -120
- package/dist/graph/annotation.cjs.map +1 -0
- package/dist/graph/annotation.d.cts +116 -0
- package/dist/graph/annotation.d.cts.map +1 -0
- package/dist/graph/annotation.d.ts +33 -34
- package/dist/graph/annotation.d.ts.map +1 -0
- package/dist/graph/annotation.js +91 -112
- package/dist/graph/annotation.js.map +1 -1
- package/dist/graph/graph.cjs +419 -723
- package/dist/graph/graph.cjs.map +1 -0
- package/dist/graph/graph.d.cts +133 -0
- package/dist/graph/graph.d.cts.map +1 -0
- package/dist/graph/graph.d.ts +124 -91
- package/dist/graph/graph.d.ts.map +1 -0
- package/dist/graph/graph.js +412 -713
- package/dist/graph/graph.js.map +1 -1
- package/dist/graph/index.cjs +4 -17
- package/dist/graph/index.js +6 -5
- package/dist/graph/message.cjs +59 -104
- package/dist/graph/message.cjs.map +1 -0
- package/dist/graph/message.d.cts +19 -0
- package/dist/graph/message.d.cts.map +1 -0
- package/dist/graph/message.d.ts +11 -10
- package/dist/graph/message.d.ts.map +1 -0
- package/dist/graph/message.js +56 -98
- package/dist/graph/message.js.map +1 -1
- package/dist/graph/messages_annotation.cjs +106 -106
- package/dist/graph/messages_annotation.cjs.map +1 -0
- package/dist/graph/messages_annotation.d.cts +111 -0
- package/dist/graph/messages_annotation.d.cts.map +1 -0
- package/dist/graph/messages_annotation.d.ts +18 -9
- package/dist/graph/messages_annotation.d.ts.map +1 -0
- package/dist/graph/messages_annotation.js +100 -100
- package/dist/graph/messages_annotation.js.map +1 -1
- package/dist/graph/state.cjs +475 -779
- package/dist/graph/state.cjs.map +1 -0
- package/dist/graph/state.d.cts +231 -0
- package/dist/graph/state.d.cts.map +1 -0
- package/dist/graph/state.d.ts +148 -138
- package/dist/graph/state.d.ts.map +1 -0
- package/dist/graph/state.js +469 -769
- package/dist/graph/state.js.map +1 -1
- package/dist/graph/zod/index.cjs +10 -21
- package/dist/graph/zod/index.d.cts +3 -0
- package/dist/graph/zod/index.d.ts +3 -3
- package/dist/graph/zod/index.js +4 -4
- package/dist/graph/zod/meta.cjs +142 -177
- package/dist/graph/zod/meta.cjs.map +1 -0
- package/dist/graph/zod/meta.d.cts +116 -0
- package/dist/graph/zod/meta.d.cts.map +1 -0
- package/dist/graph/zod/meta.d.ts +99 -97
- package/dist/graph/zod/meta.d.ts.map +1 -0
- package/dist/graph/zod/meta.js +136 -170
- package/dist/graph/zod/meta.js.map +1 -1
- package/dist/graph/zod/plugin.cjs +36 -39
- package/dist/graph/zod/plugin.cjs.map +1 -0
- package/dist/graph/zod/plugin.js +34 -35
- package/dist/graph/zod/plugin.js.map +1 -1
- package/dist/graph/zod/schema.cjs +82 -110
- package/dist/graph/zod/schema.cjs.map +1 -0
- package/dist/graph/zod/schema.d.cts +38 -0
- package/dist/graph/zod/schema.d.cts.map +1 -0
- package/dist/graph/zod/schema.d.ts +12 -6
- package/dist/graph/zod/schema.d.ts.map +1 -0
- package/dist/graph/zod/schema.js +77 -103
- package/dist/graph/zod/schema.js.map +1 -1
- package/dist/graph/zod/zod-registry.cjs +41 -47
- package/dist/graph/zod/zod-registry.cjs.map +1 -0
- package/dist/graph/zod/zod-registry.d.cts +51 -0
- package/dist/graph/zod/zod-registry.d.cts.map +1 -0
- package/dist/graph/zod/zod-registry.d.ts +34 -26
- package/dist/graph/zod/zod-registry.d.ts.map +1 -0
- package/dist/graph/zod/zod-registry.js +37 -41
- package/dist/graph/zod/zod-registry.js.map +1 -1
- package/dist/hash.cjs +205 -267
- package/dist/hash.cjs.map +1 -0
- package/dist/hash.js +205 -265
- package/dist/hash.js.map +1 -1
- package/dist/index.cjs +111 -33
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +26 -0
- package/dist/index.d.ts +26 -5
- package/dist/index.js +19 -7
- package/dist/index.js.map +1 -1
- package/dist/interrupt.cjs +79 -85
- package/dist/interrupt.cjs.map +1 -0
- package/dist/interrupt.d.cts +49 -0
- package/dist/interrupt.d.cts.map +1 -0
- package/dist/interrupt.d.ts +6 -1
- package/dist/interrupt.d.ts.map +1 -0
- package/dist/interrupt.js +76 -80
- package/dist/interrupt.js.map +1 -1
- package/dist/prebuilt/agentName.cjs +139 -172
- package/dist/prebuilt/agentName.cjs.map +1 -0
- package/dist/prebuilt/agentName.d.cts +42 -0
- package/dist/prebuilt/agentName.d.cts.map +1 -0
- package/dist/prebuilt/agentName.d.ts +13 -21
- package/dist/prebuilt/agentName.d.ts.map +1 -0
- package/dist/prebuilt/agentName.js +139 -168
- package/dist/prebuilt/agentName.js.map +1 -1
- package/dist/prebuilt/agent_executor.cjs +42 -80
- package/dist/prebuilt/agent_executor.cjs.map +1 -0
- package/dist/prebuilt/agent_executor.d.cts +57 -0
- package/dist/prebuilt/agent_executor.d.cts.map +1 -0
- package/dist/prebuilt/agent_executor.d.ts +47 -38
- package/dist/prebuilt/agent_executor.d.ts.map +1 -0
- package/dist/prebuilt/agent_executor.js +40 -75
- package/dist/prebuilt/agent_executor.js.map +1 -1
- package/dist/prebuilt/chat_agent_executor.cjs +66 -128
- package/dist/prebuilt/chat_agent_executor.cjs.map +1 -0
- package/dist/prebuilt/chat_agent_executor.d.cts +23 -0
- package/dist/prebuilt/chat_agent_executor.d.cts.map +1 -0
- package/dist/prebuilt/chat_agent_executor.d.ts +18 -10
- package/dist/prebuilt/chat_agent_executor.d.ts.map +1 -0
- package/dist/prebuilt/chat_agent_executor.js +63 -123
- package/dist/prebuilt/chat_agent_executor.js.map +1 -1
- package/dist/prebuilt/index.cjs +15 -18
- package/dist/prebuilt/index.d.cts +8 -0
- package/dist/prebuilt/index.d.ts +8 -8
- package/dist/prebuilt/index.js +8 -7
- package/dist/prebuilt/interrupt.d.cts +73 -0
- package/dist/prebuilt/interrupt.d.cts.map +1 -0
- package/dist/prebuilt/interrupt.d.ts +32 -15
- package/dist/prebuilt/interrupt.d.ts.map +1 -0
- package/dist/prebuilt/react_agent_executor.cjs +317 -473
- package/dist/prebuilt/react_agent_executor.cjs.map +1 -0
- package/dist/prebuilt/react_agent_executor.d.cts +229 -0
- package/dist/prebuilt/react_agent_executor.d.cts.map +1 -0
- package/dist/prebuilt/react_agent_executor.d.ts +171 -143
- package/dist/prebuilt/react_agent_executor.d.ts.map +1 -0
- package/dist/prebuilt/react_agent_executor.js +315 -465
- package/dist/prebuilt/react_agent_executor.js.map +1 -1
- package/dist/prebuilt/tool_executor.cjs +45 -67
- package/dist/prebuilt/tool_executor.cjs.map +1 -0
- package/dist/prebuilt/tool_executor.d.cts +42 -0
- package/dist/prebuilt/tool_executor.d.cts.map +1 -0
- package/dist/prebuilt/tool_executor.d.ts +30 -24
- package/dist/prebuilt/tool_executor.d.ts.map +1 -0
- package/dist/prebuilt/tool_executor.js +44 -63
- package/dist/prebuilt/tool_executor.js.map +1 -1
- package/dist/prebuilt/tool_node.cjs +213 -275
- package/dist/prebuilt/tool_node.cjs.map +1 -0
- package/dist/prebuilt/tool_node.d.cts +151 -0
- package/dist/prebuilt/tool_node.d.cts.map +1 -0
- package/dist/prebuilt/tool_node.d.ts +30 -17
- package/dist/prebuilt/tool_node.d.ts.map +1 -0
- package/dist/prebuilt/tool_node.js +209 -268
- package/dist/prebuilt/tool_node.js.map +1 -1
- package/dist/pregel/algo.cjs +551 -692
- package/dist/pregel/algo.cjs.map +1 -0
- package/dist/pregel/algo.d.cts +13 -0
- package/dist/pregel/algo.d.cts.map +1 -0
- package/dist/pregel/algo.d.ts +8 -38
- package/dist/pregel/algo.d.ts.map +1 -0
- package/dist/pregel/algo.js +546 -683
- package/dist/pregel/algo.js.map +1 -1
- package/dist/pregel/call.cjs +46 -42
- package/dist/pregel/call.cjs.map +1 -0
- package/dist/pregel/call.js +43 -37
- package/dist/pregel/call.js.map +1 -1
- package/dist/pregel/debug.cjs +153 -223
- package/dist/pregel/debug.cjs.map +1 -0
- package/dist/pregel/debug.js +152 -215
- package/dist/pregel/debug.js.map +1 -1
- package/dist/pregel/index.cjs +1138 -1604
- package/dist/pregel/index.cjs.map +1 -0
- package/dist/pregel/index.d.cts +536 -0
- package/dist/pregel/index.d.cts.map +1 -0
- package/dist/pregel/index.d.ts +460 -422
- package/dist/pregel/index.d.ts.map +1 -0
- package/dist/pregel/index.js +1129 -1592
- package/dist/pregel/index.js.map +1 -1
- package/dist/pregel/io.cjs +127 -234
- package/dist/pregel/io.cjs.map +1 -0
- package/dist/pregel/io.js +122 -225
- package/dist/pregel/io.js.map +1 -1
- package/dist/pregel/loop.cjs +542 -954
- package/dist/pregel/loop.cjs.map +1 -0
- package/dist/pregel/loop.js +539 -948
- package/dist/pregel/loop.js.map +1 -1
- package/dist/pregel/messages.cjs +104 -196
- package/dist/pregel/messages.cjs.map +1 -0
- package/dist/pregel/messages.js +102 -191
- package/dist/pregel/messages.js.map +1 -1
- package/dist/pregel/read.cjs +150 -280
- package/dist/pregel/read.cjs.map +1 -0
- package/dist/pregel/read.d.cts +51 -0
- package/dist/pregel/read.d.cts.map +1 -0
- package/dist/pregel/read.d.ts +48 -46
- package/dist/pregel/read.d.ts.map +1 -0
- package/dist/pregel/read.js +147 -274
- package/dist/pregel/read.js.map +1 -1
- package/dist/pregel/remote.cjs +339 -458
- package/dist/pregel/remote.cjs.map +1 -0
- package/dist/pregel/remote.d.cts +121 -0
- package/dist/pregel/remote.d.cts.map +1 -0
- package/dist/pregel/remote.d.ts +79 -69
- package/dist/pregel/remote.d.ts.map +1 -0
- package/dist/pregel/remote.js +337 -453
- package/dist/pregel/remote.js.map +1 -1
- package/dist/pregel/retry.cjs +87 -138
- package/dist/pregel/retry.cjs.map +1 -0
- package/dist/pregel/retry.js +83 -130
- package/dist/pregel/retry.js.map +1 -1
- package/dist/pregel/runnable_types.d.cts +49 -0
- package/dist/pregel/runnable_types.d.cts.map +1 -0
- package/dist/pregel/runnable_types.d.ts +47 -17
- package/dist/pregel/runnable_types.d.ts.map +1 -0
- package/dist/pregel/runner.cjs +222 -315
- package/dist/pregel/runner.cjs.map +1 -0
- package/dist/pregel/runner.js +219 -308
- package/dist/pregel/runner.js.map +1 -1
- package/dist/pregel/stream.cjs +89 -130
- package/dist/pregel/stream.cjs.map +1 -0
- package/dist/pregel/stream.js +87 -125
- package/dist/pregel/stream.js.map +1 -1
- package/dist/pregel/types.cjs +25 -62
- package/dist/pregel/types.cjs.map +1 -0
- package/dist/pregel/types.d.cts +440 -0
- package/dist/pregel/types.d.cts.map +1 -0
- package/dist/pregel/types.d.ts +381 -432
- package/dist/pregel/types.d.ts.map +1 -0
- package/dist/pregel/types.js +23 -57
- package/dist/pregel/types.js.map +1 -1
- package/dist/pregel/utils/config.cjs +101 -147
- package/dist/pregel/utils/config.cjs.map +1 -0
- package/dist/pregel/utils/config.d.cts +36 -0
- package/dist/pregel/utils/config.d.cts.map +1 -0
- package/dist/pregel/utils/config.d.ts +12 -9
- package/dist/pregel/utils/config.d.ts.map +1 -0
- package/dist/pregel/utils/config.js +99 -143
- package/dist/pregel/utils/config.js.map +1 -1
- package/dist/pregel/utils/index.cjs +87 -125
- package/dist/pregel/utils/index.cjs.map +1 -0
- package/dist/pregel/utils/index.d.cts +51 -0
- package/dist/pregel/utils/index.d.cts.map +1 -0
- package/dist/pregel/utils/index.d.ts +45 -61
- package/dist/pregel/utils/index.d.ts.map +1 -0
- package/dist/pregel/utils/index.js +86 -120
- package/dist/pregel/utils/index.js.map +1 -1
- package/dist/pregel/utils/subgraph.cjs +15 -26
- package/dist/pregel/utils/subgraph.cjs.map +1 -0
- package/dist/pregel/utils/subgraph.js +12 -21
- package/dist/pregel/utils/subgraph.js.map +1 -1
- package/dist/pregel/validate.cjs +42 -92
- package/dist/pregel/validate.cjs.map +1 -0
- package/dist/pregel/validate.js +39 -84
- package/dist/pregel/validate.js.map +1 -1
- package/dist/pregel/write.cjs +87 -137
- package/dist/pregel/write.cjs.map +1 -0
- package/dist/pregel/write.d.cts +35 -0
- package/dist/pregel/write.d.cts.map +1 -0
- package/dist/pregel/write.d.ts +27 -23
- package/dist/pregel/write.d.ts.map +1 -0
- package/dist/pregel/write.js +83 -131
- package/dist/pregel/write.js.map +1 -1
- package/dist/remote.cjs +3 -6
- package/dist/remote.d.cts +2 -0
- package/dist/remote.d.ts +2 -1
- package/dist/remote.js +3 -2
- package/dist/setup/async_local_storage.cjs +10 -7
- package/dist/setup/async_local_storage.cjs.map +1 -0
- package/dist/setup/async_local_storage.js +7 -2
- package/dist/setup/async_local_storage.js.map +1 -1
- package/dist/ui/index.cjs +4 -0
- package/dist/ui/index.d.cts +5 -0
- package/dist/ui/index.d.ts +5 -0
- package/dist/ui/index.js +3 -0
- package/dist/ui/stream.cjs +145 -0
- package/dist/ui/stream.cjs.map +1 -0
- package/dist/ui/stream.d.cts +25 -0
- package/dist/ui/stream.d.cts.map +1 -0
- package/dist/ui/stream.d.ts +25 -0
- package/dist/ui/stream.d.ts.map +1 -0
- package/dist/ui/stream.js +143 -0
- package/dist/ui/stream.js.map +1 -0
- package/dist/ui/types.infer.d.cts +53 -0
- package/dist/ui/types.infer.d.cts.map +1 -0
- package/dist/ui/types.infer.d.ts +53 -0
- package/dist/ui/types.infer.d.ts.map +1 -0
- package/dist/ui/types.message.d.cts +95 -0
- package/dist/ui/types.message.d.cts.map +1 -0
- package/dist/ui/types.message.d.ts +95 -0
- package/dist/ui/types.message.d.ts.map +1 -0
- package/dist/ui/types.schema.d.cts +228 -0
- package/dist/ui/types.schema.d.cts.map +1 -0
- package/dist/ui/types.schema.d.ts +228 -0
- package/dist/ui/types.schema.d.ts.map +1 -0
- package/dist/utils.cjs +77 -147
- package/dist/utils.cjs.map +1 -0
- package/dist/utils.d.cts +32 -0
- package/dist/utils.d.cts.map +1 -0
- package/dist/utils.d.ts +29 -25
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +73 -140
- package/dist/utils.js.map +1 -1
- package/dist/web.cjs +96 -55
- package/dist/web.d.cts +23 -0
- package/dist/web.d.ts +23 -14
- package/dist/web.js +15 -8
- package/dist/writer.cjs +15 -0
- package/dist/writer.cjs.map +1 -0
- package/dist/writer.d.cts +5 -0
- package/dist/writer.d.cts.map +1 -0
- package/dist/writer.d.ts +5 -0
- package/dist/writer.d.ts.map +1 -0
- package/dist/writer.js +14 -0
- package/dist/writer.js.map +1 -0
- package/package.json +90 -83
- package/dist/channels/index.js.map +0 -1
- package/dist/func/types.cjs +0 -15
- package/dist/func/types.js +0 -12
- package/dist/func/types.js.map +0 -1
- package/dist/graph/index.d.ts +0 -4
- package/dist/graph/index.js.map +0 -1
- package/dist/graph/message.test.cjs +0 -196
- package/dist/graph/message.test.d.ts +0 -1
- package/dist/graph/message.test.js +0 -194
- package/dist/graph/message.test.js.map +0 -1
- package/dist/graph/zod/index.js.map +0 -1
- package/dist/graph/zod/plugin.d.ts +0 -28
- package/dist/hash.d.ts +0 -2
- package/dist/prebuilt/index.js.map +0 -1
- package/dist/prebuilt/interrupt.cjs +0 -3
- package/dist/prebuilt/interrupt.js +0 -2
- package/dist/prebuilt/interrupt.js.map +0 -1
- package/dist/pregel/call.d.ts +0 -16
- package/dist/pregel/debug.d.ts +0 -41
- package/dist/pregel/debug.test.cjs +0 -258
- package/dist/pregel/debug.test.d.ts +0 -1
- package/dist/pregel/debug.test.js +0 -256
- package/dist/pregel/debug.test.js.map +0 -1
- package/dist/pregel/io.d.ts +0 -30
- package/dist/pregel/io.mapCommand.test.cjs +0 -150
- package/dist/pregel/io.mapCommand.test.d.ts +0 -1
- package/dist/pregel/io.mapCommand.test.js +0 -148
- package/dist/pregel/io.mapCommand.test.js.map +0 -1
- package/dist/pregel/loop.d.ts +0 -147
- package/dist/pregel/messages.d.ts +0 -30
- package/dist/pregel/messages.test.cjs +0 -369
- package/dist/pregel/messages.test.d.ts +0 -1
- package/dist/pregel/messages.test.js +0 -367
- package/dist/pregel/messages.test.js.map +0 -1
- package/dist/pregel/read.test.cjs +0 -194
- package/dist/pregel/read.test.d.ts +0 -1
- package/dist/pregel/read.test.js +0 -192
- package/dist/pregel/read.test.js.map +0 -1
- package/dist/pregel/retry.d.ts +0 -17
- package/dist/pregel/runnable_types.cjs +0 -3
- package/dist/pregel/runnable_types.js +0 -2
- package/dist/pregel/runnable_types.js.map +0 -1
- package/dist/pregel/runner.d.ts +0 -79
- package/dist/pregel/runner.test.cjs +0 -66
- package/dist/pregel/runner.test.d.ts +0 -1
- package/dist/pregel/runner.test.js +0 -64
- package/dist/pregel/runner.test.js.map +0 -1
- package/dist/pregel/stream.d.ts +0 -40
- package/dist/pregel/utils/config.test.cjs +0 -214
- package/dist/pregel/utils/config.test.d.ts +0 -1
- package/dist/pregel/utils/config.test.js +0 -212
- package/dist/pregel/utils/config.test.js.map +0 -1
- package/dist/pregel/utils/subgraph.d.ts +0 -4
- package/dist/pregel/utils/subgraph.test.cjs +0 -83
- package/dist/pregel/utils/subgraph.test.d.ts +0 -1
- package/dist/pregel/utils/subgraph.test.js +0 -81
- package/dist/pregel/utils/subgraph.test.js.map +0 -1
- package/dist/pregel/validate.d.ts +0 -16
- package/dist/pregel/validate.test.cjs +0 -220
- package/dist/pregel/validate.test.d.ts +0 -1
- package/dist/pregel/validate.test.js +0 -218
- package/dist/pregel/validate.test.js.map +0 -1
- package/dist/pregel/write.test.cjs +0 -181
- package/dist/pregel/write.test.d.ts +0 -1
- package/dist/pregel/write.test.js +0 -179
- package/dist/pregel/write.test.js.map +0 -1
- package/dist/remote.js.map +0 -1
- package/dist/setup/async_local_storage.d.ts +0 -1
- package/dist/web.js.map +0 -1
- package/index.cjs +0 -1
- package/index.d.cts +0 -1
- package/index.d.ts +0 -1
- package/index.js +0 -1
- package/prebuilt.cjs +0 -1
- package/prebuilt.d.cts +0 -1
- package/prebuilt.d.ts +0 -1
- package/prebuilt.js +0 -1
- package/pregel.cjs +0 -1
- package/pregel.d.cts +0 -1
- package/pregel.d.ts +0 -1
- package/pregel.js +0 -1
- package/remote.cjs +0 -1
- package/remote.d.cts +0 -1
- package/remote.d.ts +0 -1
- package/remote.js +0 -1
- package/web.cjs +0 -1
- package/web.d.cts +0 -1
- package/web.d.ts +0 -1
- package/web.js +0 -1
- package/zod/schema.cjs +0 -1
- package/zod/schema.d.cts +0 -1
- package/zod/schema.d.ts +0 -1
- package/zod/schema.js +0 -1
- package/zod.cjs +0 -1
- package/zod.d.cts +0 -1
- package/zod.d.ts +0 -1
- package/zod.js +0 -1
|
@@ -1,43 +1,46 @@
|
|
|
1
1
|
import { BaseChannel } from "./base.js";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
//#region src/channels/named_barrier_value.d.ts
|
|
4
|
+
|
|
3
5
|
/**
|
|
4
6
|
* A channel that waits until all named values are received before making the value available.
|
|
5
7
|
*
|
|
6
8
|
* This ensures that if node N and node M both write to channel C, the value of C will not be updated
|
|
7
9
|
* until N and M have completed updating.
|
|
8
|
-
* @internal
|
|
9
10
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
11
|
+
declare class NamedBarrierValue<Value> extends BaseChannel<void, Value, Value[]> {
|
|
12
|
+
lc_graph_name: string;
|
|
13
|
+
names: Set<Value>; // Names of nodes that we want to wait for.
|
|
14
|
+
seen: Set<Value>;
|
|
15
|
+
constructor(names: Set<Value>);
|
|
16
|
+
fromCheckpoint(checkpoint?: Value[]): this;
|
|
17
|
+
update(values: Value[]): boolean;
|
|
18
|
+
// If we have not yet seen all the node names we want to wait for,
|
|
19
|
+
// throw an error to prevent continuing.
|
|
20
|
+
get(): void;
|
|
21
|
+
checkpoint(): Value[];
|
|
22
|
+
consume(): boolean;
|
|
23
|
+
isAvailable(): boolean;
|
|
21
24
|
}
|
|
22
25
|
/**
|
|
23
26
|
* A channel that waits until all named values are received before making the value ready to be made available.
|
|
24
27
|
* It is only made available after finish() is called.
|
|
25
28
|
* @internal
|
|
26
29
|
*/
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
consume(): boolean;
|
|
41
|
-
finish(): boolean;
|
|
42
|
-
isAvailable(): boolean;
|
|
30
|
+
declare class NamedBarrierValueAfterFinish<Value> extends BaseChannel<void, Value, [Value[], boolean]> {
|
|
31
|
+
lc_graph_name: string;
|
|
32
|
+
names: Set<Value>; // Names of nodes that we want to wait for.
|
|
33
|
+
seen: Set<Value>;
|
|
34
|
+
finished: boolean;
|
|
35
|
+
constructor(names: Set<Value>);
|
|
36
|
+
fromCheckpoint(checkpoint?: [Value[], boolean]): this;
|
|
37
|
+
update(values: Value[]): boolean;
|
|
38
|
+
get(): void;
|
|
39
|
+
checkpoint(): [Value[], boolean];
|
|
40
|
+
consume(): boolean;
|
|
41
|
+
finish(): boolean;
|
|
42
|
+
isAvailable(): boolean;
|
|
43
43
|
}
|
|
44
|
+
//#endregion
|
|
45
|
+
export { NamedBarrierValue, NamedBarrierValueAfterFinish };
|
|
46
|
+
//# sourceMappingURL=named_barrier_value.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"named_barrier_value.d.ts","names":["BaseChannel","areSetsEqual","T","Set","NamedBarrierValue","Value","NamedBarrierValueAfterFinish"],"sources":["../../src/channels/named_barrier_value.d.ts"],"sourcesContent":["import { BaseChannel } from \"./base.js\";\nexport declare const areSetsEqual: <T>(a: Set<T>, b: Set<T>) => boolean;\n/**\n * A channel that waits until all named values are received before making the value available.\n *\n * This ensures that if node N and node M both write to channel C, the value of C will not be updated\n * until N and M have completed updating.\n */\nexport declare class NamedBarrierValue<Value> extends BaseChannel<void, Value, Value[]> {\n lc_graph_name: string;\n names: Set<Value>; // Names of nodes that we want to wait for.\n seen: Set<Value>;\n constructor(names: Set<Value>);\n fromCheckpoint(checkpoint?: Value[]): this;\n update(values: Value[]): boolean;\n // If we have not yet seen all the node names we want to wait for,\n // throw an error to prevent continuing.\n get(): void;\n checkpoint(): Value[];\n consume(): boolean;\n isAvailable(): boolean;\n}\n/**\n * A channel that waits until all named values are received before making the value ready to be made available.\n * It is only made available after finish() is called.\n * @internal\n */\nexport declare class NamedBarrierValueAfterFinish<Value> extends BaseChannel<void, Value, [\n Value[],\n boolean\n]> {\n lc_graph_name: string;\n names: Set<Value>; // Names of nodes that we want to wait for.\n seen: Set<Value>;\n finished: boolean;\n constructor(names: Set<Value>);\n fromCheckpoint(checkpoint?: [Value[], boolean]): this;\n update(values: Value[]): boolean;\n get(): void;\n checkpoint(): [Value[], boolean];\n consume(): boolean;\n finish(): boolean;\n isAvailable(): boolean;\n}\n"],"mappings":";;;;;AAQA;;;;;AAEWG,cAFUC,iBAEVD,CAAAA,KAAAA,CAAAA,SAF2CH,WAE3CG,CAAAA,IAAAA,EAF6DE,KAE7DF,EAFoEE,KAEpEF,EAAAA,CAAAA,CAAAA;eACGE,EAAAA,MAAAA;OAAJF,EADCA,GACDA,CADKE,KACLF,CAAAA,CAAAA,CAAAA;MACiBE,EADjBF,GACiBE,CADbA,KACaA,CAAAA;aAAJF,CAAAA,KAAAA,EAAAA,GAAAA,CAAIE,KAAJF,CAAAA;gBACSE,CAAAA,UAAAA,CAAAA,EAAAA,KAAAA,EAAAA,CAAAA,EAAAA,IAAAA;QACbA,CAAAA,MAAAA,EAAAA,KAAAA,EAAAA,CAAAA,EAAAA,OAAAA;;;;EAaEC,UAAAA,CAAAA,CAAAA,EATHD,KASGC,EAAAA;EAA4B,OAAA,CAAA,CAAA,EAAA,OAAA;aAAkCD,CAAAA,CAAAA,EAAAA,OAAAA;;;;;;;AAQ5DF,cARFG,4BAQEH,CAAAA,KAAAA,CAAAA,SAR0CH,WAQ1CG,CAAAA,IAAAA,EAR4DE,KAQ5DF,EAAAA,CAPnBE,KAQ6BA,EAAAA,SACdA;eAV8CL,EAAAA,MAAAA;SAKtDG,IAAIE;QACLF,IAAIE;;qBAESF,IAAIE;+BACMA;iBACdA;;iBAEAA"}
|
|
@@ -1,168 +1,116 @@
|
|
|
1
1
|
import { EmptyChannelError, InvalidUpdateError } from "../errors.js";
|
|
2
2
|
import { BaseChannel } from "./base.js";
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
//#region src/channels/named_barrier_value.ts
|
|
5
|
+
const areSetsEqual = (a, b) => a.size === b.size && [...a].every((value) => b.has(value));
|
|
4
6
|
/**
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
throw new InvalidUpdateError(`Value ${JSON.stringify(nodeName)} not in names ${JSON.stringify(this.names)}`);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
return updated;
|
|
56
|
-
}
|
|
57
|
-
// If we have not yet seen all the node names we want to wait for,
|
|
58
|
-
// throw an error to prevent continuing.
|
|
59
|
-
get() {
|
|
60
|
-
if (!areSetsEqual(this.names, this.seen)) {
|
|
61
|
-
throw new EmptyChannelError();
|
|
62
|
-
}
|
|
63
|
-
return undefined;
|
|
64
|
-
}
|
|
65
|
-
checkpoint() {
|
|
66
|
-
return [...this.seen];
|
|
67
|
-
}
|
|
68
|
-
consume() {
|
|
69
|
-
if (this.seen && this.names && areSetsEqual(this.seen, this.names)) {
|
|
70
|
-
this.seen = new Set();
|
|
71
|
-
return true;
|
|
72
|
-
}
|
|
73
|
-
return false;
|
|
74
|
-
}
|
|
75
|
-
isAvailable() {
|
|
76
|
-
return !!this.names && areSetsEqual(this.names, this.seen);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
7
|
+
* A channel that waits until all named values are received before making the value available.
|
|
8
|
+
*
|
|
9
|
+
* This ensures that if node N and node M both write to channel C, the value of C will not be updated
|
|
10
|
+
* until N and M have completed updating.
|
|
11
|
+
*/
|
|
12
|
+
var NamedBarrierValue = class NamedBarrierValue extends BaseChannel {
|
|
13
|
+
lc_graph_name = "NamedBarrierValue";
|
|
14
|
+
names;
|
|
15
|
+
seen;
|
|
16
|
+
constructor(names) {
|
|
17
|
+
super();
|
|
18
|
+
this.names = names;
|
|
19
|
+
this.seen = /* @__PURE__ */ new Set();
|
|
20
|
+
}
|
|
21
|
+
fromCheckpoint(checkpoint) {
|
|
22
|
+
const empty = new NamedBarrierValue(this.names);
|
|
23
|
+
if (typeof checkpoint !== "undefined") empty.seen = new Set(checkpoint);
|
|
24
|
+
return empty;
|
|
25
|
+
}
|
|
26
|
+
update(values) {
|
|
27
|
+
let updated = false;
|
|
28
|
+
for (const nodeName of values) if (this.names.has(nodeName)) {
|
|
29
|
+
if (!this.seen.has(nodeName)) {
|
|
30
|
+
this.seen.add(nodeName);
|
|
31
|
+
updated = true;
|
|
32
|
+
}
|
|
33
|
+
} else throw new InvalidUpdateError(`Value ${JSON.stringify(nodeName)} not in names ${JSON.stringify(this.names)}`);
|
|
34
|
+
return updated;
|
|
35
|
+
}
|
|
36
|
+
get() {
|
|
37
|
+
if (!areSetsEqual(this.names, this.seen)) throw new EmptyChannelError();
|
|
38
|
+
return void 0;
|
|
39
|
+
}
|
|
40
|
+
checkpoint() {
|
|
41
|
+
return [...this.seen];
|
|
42
|
+
}
|
|
43
|
+
consume() {
|
|
44
|
+
if (this.seen && this.names && areSetsEqual(this.seen, this.names)) {
|
|
45
|
+
this.seen = /* @__PURE__ */ new Set();
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
isAvailable() {
|
|
51
|
+
return !!this.names && areSetsEqual(this.names, this.seen);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
79
54
|
/**
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
return undefined;
|
|
142
|
-
}
|
|
143
|
-
checkpoint() {
|
|
144
|
-
return [[...this.seen], this.finished];
|
|
145
|
-
}
|
|
146
|
-
consume() {
|
|
147
|
-
if (this.finished &&
|
|
148
|
-
this.seen &&
|
|
149
|
-
this.names &&
|
|
150
|
-
areSetsEqual(this.seen, this.names)) {
|
|
151
|
-
this.seen = new Set();
|
|
152
|
-
this.finished = false;
|
|
153
|
-
return true;
|
|
154
|
-
}
|
|
155
|
-
return false;
|
|
156
|
-
}
|
|
157
|
-
finish() {
|
|
158
|
-
if (!this.finished && !!this.names && areSetsEqual(this.names, this.seen)) {
|
|
159
|
-
this.finished = true;
|
|
160
|
-
return true;
|
|
161
|
-
}
|
|
162
|
-
return false;
|
|
163
|
-
}
|
|
164
|
-
isAvailable() {
|
|
165
|
-
return this.finished && !!this.names && areSetsEqual(this.names, this.seen);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
55
|
+
* A channel that waits until all named values are received before making the value ready to be made available.
|
|
56
|
+
* It is only made available after finish() is called.
|
|
57
|
+
* @internal
|
|
58
|
+
*/
|
|
59
|
+
var NamedBarrierValueAfterFinish = class NamedBarrierValueAfterFinish extends BaseChannel {
|
|
60
|
+
lc_graph_name = "NamedBarrierValueAfterFinish";
|
|
61
|
+
names;
|
|
62
|
+
seen;
|
|
63
|
+
finished;
|
|
64
|
+
constructor(names) {
|
|
65
|
+
super();
|
|
66
|
+
this.names = names;
|
|
67
|
+
this.seen = /* @__PURE__ */ new Set();
|
|
68
|
+
this.finished = false;
|
|
69
|
+
}
|
|
70
|
+
fromCheckpoint(checkpoint) {
|
|
71
|
+
const empty = new NamedBarrierValueAfterFinish(this.names);
|
|
72
|
+
if (typeof checkpoint !== "undefined") {
|
|
73
|
+
const [seen, finished] = checkpoint;
|
|
74
|
+
empty.seen = new Set(seen);
|
|
75
|
+
empty.finished = finished;
|
|
76
|
+
}
|
|
77
|
+
return empty;
|
|
78
|
+
}
|
|
79
|
+
update(values) {
|
|
80
|
+
let updated = false;
|
|
81
|
+
for (const nodeName of values) if (this.names.has(nodeName) && !this.seen.has(nodeName)) {
|
|
82
|
+
this.seen.add(nodeName);
|
|
83
|
+
updated = true;
|
|
84
|
+
} else if (!this.names.has(nodeName)) throw new InvalidUpdateError(`Value ${JSON.stringify(nodeName)} not in names ${JSON.stringify(this.names)}`);
|
|
85
|
+
return updated;
|
|
86
|
+
}
|
|
87
|
+
get() {
|
|
88
|
+
if (!this.finished || !areSetsEqual(this.names, this.seen)) throw new EmptyChannelError();
|
|
89
|
+
return void 0;
|
|
90
|
+
}
|
|
91
|
+
checkpoint() {
|
|
92
|
+
return [[...this.seen], this.finished];
|
|
93
|
+
}
|
|
94
|
+
consume() {
|
|
95
|
+
if (this.finished && this.seen && this.names && areSetsEqual(this.seen, this.names)) {
|
|
96
|
+
this.seen = /* @__PURE__ */ new Set();
|
|
97
|
+
this.finished = false;
|
|
98
|
+
return true;
|
|
99
|
+
}
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
finish() {
|
|
103
|
+
if (!this.finished && !!this.names && areSetsEqual(this.names, this.seen)) {
|
|
104
|
+
this.finished = true;
|
|
105
|
+
return true;
|
|
106
|
+
}
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
isAvailable() {
|
|
110
|
+
return this.finished && !!this.names && areSetsEqual(this.names, this.seen);
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
//#endregion
|
|
115
|
+
export { NamedBarrierValue, NamedBarrierValueAfterFinish, areSetsEqual };
|
|
168
116
|
//# sourceMappingURL=named_barrier_value.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"named_barrier_value.js","
|
|
1
|
+
{"version":3,"file":"named_barrier_value.js","names":[],"sources":["../../src/channels/named_barrier_value.ts"],"sourcesContent":["import { EmptyChannelError, InvalidUpdateError } from \"../errors.js\";\nimport { BaseChannel } from \"./base.js\";\n\nexport const areSetsEqual = <T>(a: Set<T>, b: Set<T>) =>\n a.size === b.size && [...a].every((value) => b.has(value));\n\n/**\n * A channel that waits until all named values are received before making the value available.\n *\n * This ensures that if node N and node M both write to channel C, the value of C will not be updated\n * until N and M have completed updating.\n */\nexport class NamedBarrierValue<Value> extends BaseChannel<\n void,\n Value,\n Value[]\n> {\n lc_graph_name = \"NamedBarrierValue\";\n\n names: Set<Value>; // Names of nodes that we want to wait for.\n\n seen: Set<Value>;\n\n constructor(names: Set<Value>) {\n super();\n this.names = names;\n this.seen = new Set<Value>();\n }\n\n fromCheckpoint(checkpoint?: Value[]) {\n const empty = new NamedBarrierValue<Value>(this.names);\n if (typeof checkpoint !== \"undefined\") {\n empty.seen = new Set(checkpoint);\n }\n return empty as this;\n }\n\n update(values: Value[]): boolean {\n let updated = false;\n for (const nodeName of values) {\n if (this.names.has(nodeName)) {\n if (!this.seen.has(nodeName)) {\n this.seen.add(nodeName);\n updated = true;\n }\n } else {\n throw new InvalidUpdateError(\n `Value ${JSON.stringify(nodeName)} not in names ${JSON.stringify(\n this.names\n )}`\n );\n }\n }\n return updated;\n }\n\n // If we have not yet seen all the node names we want to wait for,\n // throw an error to prevent continuing.\n get(): void {\n if (!areSetsEqual(this.names, this.seen)) {\n throw new EmptyChannelError();\n }\n return undefined;\n }\n\n checkpoint(): Value[] {\n return [...this.seen];\n }\n\n consume(): boolean {\n if (this.seen && this.names && areSetsEqual(this.seen, this.names)) {\n this.seen = new Set<Value>();\n return true;\n }\n return false;\n }\n\n isAvailable(): boolean {\n return !!this.names && areSetsEqual(this.names, this.seen);\n }\n}\n\n/**\n * A channel that waits until all named values are received before making the value ready to be made available.\n * It is only made available after finish() is called.\n * @internal\n */\nexport class NamedBarrierValueAfterFinish<Value> extends BaseChannel<\n void,\n Value,\n [Value[], boolean]\n> {\n lc_graph_name = \"NamedBarrierValueAfterFinish\";\n\n names: Set<Value>; // Names of nodes that we want to wait for.\n\n seen: Set<Value>;\n\n finished: boolean;\n\n constructor(names: Set<Value>) {\n super();\n this.names = names;\n this.seen = new Set<Value>();\n this.finished = false;\n }\n\n fromCheckpoint(checkpoint?: [Value[], boolean]) {\n const empty = new NamedBarrierValueAfterFinish<Value>(this.names);\n if (typeof checkpoint !== \"undefined\") {\n const [seen, finished] = checkpoint;\n empty.seen = new Set(seen);\n empty.finished = finished;\n }\n return empty as this;\n }\n\n update(values: Value[]): boolean {\n let updated = false;\n for (const nodeName of values) {\n if (this.names.has(nodeName) && !this.seen.has(nodeName)) {\n this.seen.add(nodeName);\n updated = true;\n } else if (!this.names.has(nodeName)) {\n throw new InvalidUpdateError(\n `Value ${JSON.stringify(nodeName)} not in names ${JSON.stringify(\n this.names\n )}`\n );\n }\n }\n return updated;\n }\n\n get(): void {\n if (!this.finished || !areSetsEqual(this.names, this.seen)) {\n throw new EmptyChannelError();\n }\n return undefined;\n }\n\n checkpoint(): [Value[], boolean] {\n return [[...this.seen], this.finished];\n }\n\n consume(): boolean {\n if (\n this.finished &&\n this.seen &&\n this.names &&\n areSetsEqual(this.seen, this.names)\n ) {\n this.seen = new Set<Value>();\n this.finished = false;\n return true;\n }\n return false;\n }\n\n finish(): boolean {\n if (!this.finished && !!this.names && areSetsEqual(this.names, this.seen)) {\n this.finished = true;\n return true;\n }\n return false;\n }\n\n isAvailable(): boolean {\n return this.finished && !!this.names && areSetsEqual(this.names, this.seen);\n }\n}\n"],"mappings":";;;;AAGA,MAAa,gBAAmB,GAAW,MACzC,EAAE,SAAS,EAAE,QAAQ,CAAC,GAAG,GAAG,OAAO,UAAU,EAAE,IAAI;;;;;;;AAQrD,IAAa,oBAAb,MAAa,0BAAiC,YAI5C;CACA,gBAAgB;CAEhB;CAEA;CAEA,YAAY,OAAmB;AAC7B;AACA,OAAK,QAAQ;AACb,OAAK,uBAAO,IAAI;;CAGlB,eAAe,YAAsB;EACnC,MAAM,QAAQ,IAAI,kBAAyB,KAAK;AAChD,MAAI,OAAO,eAAe,YACxB,OAAM,OAAO,IAAI,IAAI;AAEvB,SAAO;;CAGT,OAAO,QAA0B;EAC/B,IAAI,UAAU;AACd,OAAK,MAAM,YAAY,OACrB,KAAI,KAAK,MAAM,IAAI,WACjB;OAAI,CAAC,KAAK,KAAK,IAAI,WAAW;AAC5B,SAAK,KAAK,IAAI;AACd,cAAU;;QAGZ,OAAM,IAAI,mBACR,SAAS,KAAK,UAAU,UAAU,gBAAgB,KAAK,UACrD,KAAK;AAKb,SAAO;;CAKT,MAAY;AACV,MAAI,CAAC,aAAa,KAAK,OAAO,KAAK,MACjC,OAAM,IAAI;AAEZ,SAAO;;CAGT,aAAsB;AACpB,SAAO,CAAC,GAAG,KAAK;;CAGlB,UAAmB;AACjB,MAAI,KAAK,QAAQ,KAAK,SAAS,aAAa,KAAK,MAAM,KAAK,QAAQ;AAClE,QAAK,uBAAO,IAAI;AAChB,UAAO;;AAET,SAAO;;CAGT,cAAuB;AACrB,SAAO,CAAC,CAAC,KAAK,SAAS,aAAa,KAAK,OAAO,KAAK;;;;;;;;AASzD,IAAa,+BAAb,MAAa,qCAA4C,YAIvD;CACA,gBAAgB;CAEhB;CAEA;CAEA;CAEA,YAAY,OAAmB;AAC7B;AACA,OAAK,QAAQ;AACb,OAAK,uBAAO,IAAI;AAChB,OAAK,WAAW;;CAGlB,eAAe,YAAiC;EAC9C,MAAM,QAAQ,IAAI,6BAAoC,KAAK;AAC3D,MAAI,OAAO,eAAe,aAAa;GACrC,MAAM,CAAC,MAAM,YAAY;AACzB,SAAM,OAAO,IAAI,IAAI;AACrB,SAAM,WAAW;;AAEnB,SAAO;;CAGT,OAAO,QAA0B;EAC/B,IAAI,UAAU;AACd,OAAK,MAAM,YAAY,OACrB,KAAI,KAAK,MAAM,IAAI,aAAa,CAAC,KAAK,KAAK,IAAI,WAAW;AACxD,QAAK,KAAK,IAAI;AACd,aAAU;aACD,CAAC,KAAK,MAAM,IAAI,UACzB,OAAM,IAAI,mBACR,SAAS,KAAK,UAAU,UAAU,gBAAgB,KAAK,UACrD,KAAK;AAKb,SAAO;;CAGT,MAAY;AACV,MAAI,CAAC,KAAK,YAAY,CAAC,aAAa,KAAK,OAAO,KAAK,MACnD,OAAM,IAAI;AAEZ,SAAO;;CAGT,aAAiC;AAC/B,SAAO,CAAC,CAAC,GAAG,KAAK,OAAO,KAAK;;CAG/B,UAAmB;AACjB,MACE,KAAK,YACL,KAAK,QACL,KAAK,SACL,aAAa,KAAK,MAAM,KAAK,QAC7B;AACA,QAAK,uBAAO,IAAI;AAChB,QAAK,WAAW;AAChB,UAAO;;AAET,SAAO;;CAGT,SAAkB;AAChB,MAAI,CAAC,KAAK,YAAY,CAAC,CAAC,KAAK,SAAS,aAAa,KAAK,OAAO,KAAK,OAAO;AACzE,QAAK,WAAW;AAChB,UAAO;;AAET,SAAO;;CAGT,cAAuB;AACrB,SAAO,KAAK,YAAY,CAAC,CAAC,KAAK,SAAS,aAAa,KAAK,OAAO,KAAK"}
|
package/dist/channels/topic.cjs
CHANGED
|
@@ -1,98 +1,65 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const base_js_1 = require("./base.cjs");
|
|
1
|
+
const require_errors = require('../errors.cjs');
|
|
2
|
+
const require_base = require('./base.cjs');
|
|
3
|
+
|
|
4
|
+
//#region src/channels/topic.ts
|
|
6
5
|
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class Topic extends
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
const flatValues = values.flat();
|
|
67
|
-
if (flatValues.length > 0) {
|
|
68
|
-
if (this.unique) {
|
|
69
|
-
for (const value of flatValues) {
|
|
70
|
-
if (!this.seen.has(value)) {
|
|
71
|
-
updated = true;
|
|
72
|
-
this.seen.add(value);
|
|
73
|
-
this.values.push(value);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
78
|
-
updated = true;
|
|
79
|
-
this.values.push(...flatValues);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
return updated;
|
|
83
|
-
}
|
|
84
|
-
get() {
|
|
85
|
-
if (this.values.length === 0) {
|
|
86
|
-
throw new errors_js_1.EmptyChannelError();
|
|
87
|
-
}
|
|
88
|
-
return this.values;
|
|
89
|
-
}
|
|
90
|
-
checkpoint() {
|
|
91
|
-
return [[...this.seen], this.values];
|
|
92
|
-
}
|
|
93
|
-
isAvailable() {
|
|
94
|
-
return this.values.length !== 0;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
6
|
+
* A configurable PubSub Topic.
|
|
7
|
+
*/
|
|
8
|
+
var Topic = class Topic extends require_base.BaseChannel {
|
|
9
|
+
lc_graph_name = "Topic";
|
|
10
|
+
unique = false;
|
|
11
|
+
accumulate = false;
|
|
12
|
+
seen;
|
|
13
|
+
values;
|
|
14
|
+
constructor(fields) {
|
|
15
|
+
super();
|
|
16
|
+
this.unique = fields?.unique ?? this.unique;
|
|
17
|
+
this.accumulate = fields?.accumulate ?? this.accumulate;
|
|
18
|
+
this.seen = /* @__PURE__ */ new Set();
|
|
19
|
+
this.values = [];
|
|
20
|
+
}
|
|
21
|
+
fromCheckpoint(checkpoint) {
|
|
22
|
+
const empty = new Topic({
|
|
23
|
+
unique: this.unique,
|
|
24
|
+
accumulate: this.accumulate
|
|
25
|
+
});
|
|
26
|
+
if (typeof checkpoint !== "undefined") {
|
|
27
|
+
empty.seen = new Set(checkpoint[0]);
|
|
28
|
+
empty.values = checkpoint[1];
|
|
29
|
+
}
|
|
30
|
+
return empty;
|
|
31
|
+
}
|
|
32
|
+
update(values) {
|
|
33
|
+
let updated = false;
|
|
34
|
+
if (!this.accumulate) {
|
|
35
|
+
updated = this.values.length > 0;
|
|
36
|
+
this.values = [];
|
|
37
|
+
}
|
|
38
|
+
const flatValues = values.flat();
|
|
39
|
+
if (flatValues.length > 0) if (this.unique) {
|
|
40
|
+
for (const value of flatValues) if (!this.seen.has(value)) {
|
|
41
|
+
updated = true;
|
|
42
|
+
this.seen.add(value);
|
|
43
|
+
this.values.push(value);
|
|
44
|
+
}
|
|
45
|
+
} else {
|
|
46
|
+
updated = true;
|
|
47
|
+
this.values.push(...flatValues);
|
|
48
|
+
}
|
|
49
|
+
return updated;
|
|
50
|
+
}
|
|
51
|
+
get() {
|
|
52
|
+
if (this.values.length === 0) throw new require_errors.EmptyChannelError();
|
|
53
|
+
return this.values;
|
|
54
|
+
}
|
|
55
|
+
checkpoint() {
|
|
56
|
+
return [[...this.seen], this.values];
|
|
57
|
+
}
|
|
58
|
+
isAvailable() {
|
|
59
|
+
return this.values.length !== 0;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
//#endregion
|
|
97
64
|
exports.Topic = Topic;
|
|
98
|
-
//# sourceMappingURL=topic.
|
|
65
|
+
//# sourceMappingURL=topic.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"topic.cjs","names":["BaseChannel","EmptyChannelError"],"sources":["../../src/channels/topic.ts"],"sourcesContent":["import { EmptyChannelError } from \"../errors.js\";\nimport { BaseChannel } from \"./base.js\";\n\n/**\n * A configurable PubSub Topic.\n */\nexport class Topic<Value> extends BaseChannel<\n Array<Value>,\n Value | Value[],\n [Value[], Value[]]\n> {\n lc_graph_name = \"Topic\";\n\n unique = false;\n\n accumulate = false;\n\n seen: Set<Value>;\n\n values: Value[];\n\n constructor(fields?: {\n /**\n * Whether to only add unique values to the topic. If `true`, only unique values (using reference equality) will be added to the topic.\n */\n unique?: boolean;\n /**\n * Whether to accumulate values across steps. If `false`, the channel will be emptied after each step.\n */\n accumulate?: boolean;\n }) {\n super();\n\n this.unique = fields?.unique ?? this.unique;\n this.accumulate = fields?.accumulate ?? this.accumulate;\n // State\n this.seen = new Set<Value>();\n this.values = [];\n }\n\n public fromCheckpoint(checkpoint?: [Value[], Value[]]) {\n const empty = new Topic<Value>({\n unique: this.unique,\n accumulate: this.accumulate,\n });\n if (typeof checkpoint !== \"undefined\") {\n empty.seen = new Set(checkpoint[0]);\n // eslint-disable-next-line prefer-destructuring\n empty.values = checkpoint[1];\n }\n return empty as this;\n }\n\n public update(values: Array<Value | Value[]>): boolean {\n let updated = false;\n if (!this.accumulate) {\n updated = this.values.length > 0;\n this.values = [];\n }\n const flatValues = values.flat() as Value[];\n if (flatValues.length > 0) {\n if (this.unique) {\n for (const value of flatValues) {\n if (!this.seen.has(value)) {\n updated = true;\n this.seen.add(value);\n this.values.push(value);\n }\n }\n } else {\n updated = true;\n this.values.push(...flatValues);\n }\n }\n return updated;\n }\n\n public get(): Array<Value> {\n if (this.values.length === 0) {\n throw new EmptyChannelError();\n }\n return this.values;\n }\n\n public checkpoint(): [Value[], Value[]] {\n return [[...this.seen], this.values];\n }\n\n isAvailable(): boolean {\n return this.values.length !== 0;\n }\n}\n"],"mappings":";;;;;;;AAMA,IAAa,QAAb,MAAa,cAAqBA,yBAIhC;CACA,gBAAgB;CAEhB,SAAS;CAET,aAAa;CAEb;CAEA;CAEA,YAAY,QAST;AACD;AAEA,OAAK,SAAS,QAAQ,UAAU,KAAK;AACrC,OAAK,aAAa,QAAQ,cAAc,KAAK;AAE7C,OAAK,uBAAO,IAAI;AAChB,OAAK,SAAS;;CAGhB,AAAO,eAAe,YAAiC;EACrD,MAAM,QAAQ,IAAI,MAAa;GAC7B,QAAQ,KAAK;GACb,YAAY,KAAK;;AAEnB,MAAI,OAAO,eAAe,aAAa;AACrC,SAAM,OAAO,IAAI,IAAI,WAAW;AAEhC,SAAM,SAAS,WAAW;;AAE5B,SAAO;;CAGT,AAAO,OAAO,QAAyC;EACrD,IAAI,UAAU;AACd,MAAI,CAAC,KAAK,YAAY;AACpB,aAAU,KAAK,OAAO,SAAS;AAC/B,QAAK,SAAS;;EAEhB,MAAM,aAAa,OAAO;AAC1B,MAAI,WAAW,SAAS,EACtB,KAAI,KAAK,QACP;QAAK,MAAM,SAAS,WAClB,KAAI,CAAC,KAAK,KAAK,IAAI,QAAQ;AACzB,cAAU;AACV,SAAK,KAAK,IAAI;AACd,SAAK,OAAO,KAAK;;SAGhB;AACL,aAAU;AACV,QAAK,OAAO,KAAK,GAAG;;AAGxB,SAAO;;CAGT,AAAO,MAAoB;AACzB,MAAI,KAAK,OAAO,WAAW,EACzB,OAAM,IAAIC;AAEZ,SAAO,KAAK;;CAGd,AAAO,aAAiC;AACtC,SAAO,CAAC,CAAC,GAAG,KAAK,OAAO,KAAK;;CAG/B,cAAuB;AACrB,SAAO,KAAK,OAAO,WAAW"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { BaseChannel } from "./base.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/channels/topic.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A configurable PubSub Topic.
|
|
7
|
+
*/
|
|
8
|
+
declare class Topic<Value> extends BaseChannel<Array<Value>, Value | Value[], [Value[], Value[]]> {
|
|
9
|
+
lc_graph_name: string;
|
|
10
|
+
unique: boolean;
|
|
11
|
+
accumulate: boolean;
|
|
12
|
+
seen: Set<Value>;
|
|
13
|
+
values: Value[];
|
|
14
|
+
constructor(fields?: {
|
|
15
|
+
/**
|
|
16
|
+
* Whether to only add unique values to the topic. If `true`, only unique values (using reference equality) will be added to the topic.
|
|
17
|
+
*/
|
|
18
|
+
unique?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Whether to accumulate values across steps. If `false`, the channel will be emptied after each step.
|
|
21
|
+
*/
|
|
22
|
+
accumulate?: boolean;
|
|
23
|
+
});
|
|
24
|
+
fromCheckpoint(checkpoint?: [Value[], Value[]]): this;
|
|
25
|
+
update(values: Array<Value | Value[]>): boolean;
|
|
26
|
+
get(): Array<Value>;
|
|
27
|
+
checkpoint(): [Value[], Value[]];
|
|
28
|
+
isAvailable(): boolean;
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { Topic };
|
|
32
|
+
//# sourceMappingURL=topic.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"topic.d.cts","names":["BaseChannel","Topic","Value","Array","Set"],"sources":["../../src/channels/topic.d.ts"],"sourcesContent":["import { BaseChannel } from \"./base.js\";\n/**\n * A configurable PubSub Topic.\n */\nexport declare class Topic<Value> extends BaseChannel<Array<Value>, Value | Value[], [\n Value[],\n Value[]\n]> {\n lc_graph_name: string;\n unique: boolean;\n accumulate: boolean;\n seen: Set<Value>;\n values: Value[];\n constructor(fields?: {\n /**\n * Whether to only add unique values to the topic. If `true`, only unique values (using reference equality) will be added to the topic.\n */\n unique?: boolean;\n /**\n * Whether to accumulate values across steps. If `false`, the channel will be emptied after each step.\n */\n accumulate?: boolean;\n });\n fromCheckpoint(checkpoint?: [Value[], Value[]]): this;\n update(values: Array<Value | Value[]>): boolean;\n get(): Array<Value>;\n checkpoint(): [Value[], Value[]];\n isAvailable(): boolean;\n}\n"],"mappings":";;;;;;AAIA;AAA0B,cAALC,KAAK,CAAA,KAAA,CAAA,SAAgBD,WAAhB,CAA4BG,KAA5B,CAAkCD,KAAlC,CAAA,EAA0CA,KAA1C,GAAkDA,KAAlD,EAAA,EAAA,CACtBA,KADwDA,EAAAA,EAExDA,KAFkDC,EAAAA;eAAsBD,EAAAA,MAAAA;QACxEA,EAAAA,OAAAA;YACAA,EAAAA,OAAAA;MAKUA,EAAJE,GAAIF,CAAAA,KAAAA,CAAAA;QAAJE,EACEF,KADFE,EAAAA;aACEF,CAAAA,OAAAA,EAAAA;IAWqBA;;;IACAA,MAAAA,CAAAA,EAAAA,OAAAA;IAAdC;;;IAEAD,UAAAA,CAAAA,EAAAA,OAAAA;;gBAtBuBF,CAAAA,UAAAA,CAAAA,EAAAA,CAmBTE,KAnBSF,EAAAA,EAmBAE,KAnBAF,EAAAA,CAAAA,CAAAA,EAAAA,IAAAA;iBAoBvBG,MAAMD,QAAQA;SACtBC,MAAMD;iBACEA,SAASA"}
|