@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,68 +1,46 @@
|
|
|
1
1
|
import { EmptyChannelError, InvalidUpdateError } from "../errors.js";
|
|
2
|
-
import { BaseChannel } from "./
|
|
2
|
+
import { BaseChannel } from "./base.js";
|
|
3
|
+
|
|
4
|
+
//#region src/channels/ephemeral_value.ts
|
|
3
5
|
/**
|
|
4
|
-
|
|
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
|
-
if (values.length !== 1 && this.guard) {
|
|
46
|
-
throw new InvalidUpdateError("EphemeralValue can only receive one value per step.");
|
|
47
|
-
}
|
|
48
|
-
// eslint-disable-next-line prefer-destructuring
|
|
49
|
-
this.value = [values[values.length - 1]];
|
|
50
|
-
return true;
|
|
51
|
-
}
|
|
52
|
-
get() {
|
|
53
|
-
if (this.value.length === 0) {
|
|
54
|
-
throw new EmptyChannelError();
|
|
55
|
-
}
|
|
56
|
-
return this.value[0];
|
|
57
|
-
}
|
|
58
|
-
checkpoint() {
|
|
59
|
-
if (this.value.length === 0) {
|
|
60
|
-
throw new EmptyChannelError();
|
|
61
|
-
}
|
|
62
|
-
return this.value[0];
|
|
63
|
-
}
|
|
64
|
-
isAvailable() {
|
|
65
|
-
return this.value.length !== 0;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
6
|
+
* Stores the value received in the step immediately preceding, clears after.
|
|
7
|
+
*/
|
|
8
|
+
var EphemeralValue = class EphemeralValue extends BaseChannel {
|
|
9
|
+
lc_graph_name = "EphemeralValue";
|
|
10
|
+
guard;
|
|
11
|
+
value = [];
|
|
12
|
+
constructor(guard = true) {
|
|
13
|
+
super();
|
|
14
|
+
this.guard = guard;
|
|
15
|
+
}
|
|
16
|
+
fromCheckpoint(checkpoint) {
|
|
17
|
+
const empty = new EphemeralValue(this.guard);
|
|
18
|
+
if (typeof checkpoint !== "undefined") empty.value = [checkpoint];
|
|
19
|
+
return empty;
|
|
20
|
+
}
|
|
21
|
+
update(values) {
|
|
22
|
+
if (values.length === 0) {
|
|
23
|
+
const updated = this.value.length > 0;
|
|
24
|
+
this.value = [];
|
|
25
|
+
return updated;
|
|
26
|
+
}
|
|
27
|
+
if (values.length !== 1 && this.guard) throw new InvalidUpdateError("EphemeralValue can only receive one value per step.");
|
|
28
|
+
this.value = [values[values.length - 1]];
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
get() {
|
|
32
|
+
if (this.value.length === 0) throw new EmptyChannelError();
|
|
33
|
+
return this.value[0];
|
|
34
|
+
}
|
|
35
|
+
checkpoint() {
|
|
36
|
+
if (this.value.length === 0) throw new EmptyChannelError();
|
|
37
|
+
return this.value[0];
|
|
38
|
+
}
|
|
39
|
+
isAvailable() {
|
|
40
|
+
return this.value.length !== 0;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
//#endregion
|
|
45
|
+
export { EphemeralValue };
|
|
68
46
|
//# sourceMappingURL=ephemeral_value.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ephemeral_value.js","
|
|
1
|
+
{"version":3,"file":"ephemeral_value.js","names":[],"sources":["../../src/channels/ephemeral_value.ts"],"sourcesContent":["import { EmptyChannelError, InvalidUpdateError } from \"../errors.js\";\nimport { BaseChannel } from \"./base.js\";\n\n/**\n * Stores the value received in the step immediately preceding, clears after.\n */\nexport class EphemeralValue<Value> extends BaseChannel<Value, Value, Value> {\n lc_graph_name = \"EphemeralValue\";\n\n guard: boolean;\n\n // value is an array so we don't misinterpret an update to undefined as no write\n value: [Value] | [] = [];\n\n constructor(guard: boolean = true) {\n super();\n this.guard = guard;\n }\n\n fromCheckpoint(checkpoint?: Value) {\n const empty = new EphemeralValue<Value>(this.guard);\n if (typeof checkpoint !== \"undefined\") {\n empty.value = [checkpoint];\n }\n return empty as this;\n }\n\n update(values: Value[]): boolean {\n if (values.length === 0) {\n const updated = this.value.length > 0;\n // If there are no updates for this specific channel at the end of the step, wipe it.\n this.value = [];\n return updated;\n }\n if (values.length !== 1 && this.guard) {\n throw new InvalidUpdateError(\n \"EphemeralValue can only receive one value per step.\"\n );\n }\n\n // eslint-disable-next-line prefer-destructuring\n this.value = [values[values.length - 1]];\n return true;\n }\n\n get(): Value {\n if (this.value.length === 0) {\n throw new EmptyChannelError();\n }\n return this.value[0];\n }\n\n checkpoint(): Value {\n if (this.value.length === 0) {\n throw new EmptyChannelError();\n }\n return this.value[0];\n }\n\n isAvailable(): boolean {\n return this.value.length !== 0;\n }\n}\n"],"mappings":";;;;;;;AAMA,IAAa,iBAAb,MAAa,uBAA8B,YAAiC;CAC1E,gBAAgB;CAEhB;CAGA,QAAsB;CAEtB,YAAY,QAAiB,MAAM;AACjC;AACA,OAAK,QAAQ;;CAGf,eAAe,YAAoB;EACjC,MAAM,QAAQ,IAAI,eAAsB,KAAK;AAC7C,MAAI,OAAO,eAAe,YACxB,OAAM,QAAQ,CAAC;AAEjB,SAAO;;CAGT,OAAO,QAA0B;AAC/B,MAAI,OAAO,WAAW,GAAG;GACvB,MAAM,UAAU,KAAK,MAAM,SAAS;AAEpC,QAAK,QAAQ;AACb,UAAO;;AAET,MAAI,OAAO,WAAW,KAAK,KAAK,MAC9B,OAAM,IAAI,mBACR;AAKJ,OAAK,QAAQ,CAAC,OAAO,OAAO,SAAS;AACrC,SAAO;;CAGT,MAAa;AACX,MAAI,KAAK,MAAM,WAAW,EACxB,OAAM,IAAI;AAEZ,SAAO,KAAK,MAAM;;CAGpB,aAAoB;AAClB,MAAI,KAAK,MAAM,WAAW,EACxB,OAAM,IAAI;AAEZ,SAAO,KAAK,MAAM;;CAGpB,cAAuB;AACrB,SAAO,KAAK,MAAM,WAAW"}
|
package/dist/channels/index.cjs
CHANGED
|
@@ -1,10 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
const require_base = require('./base.cjs');
|
|
2
|
+
const require_binop = require('./binop.cjs');
|
|
3
|
+
const require_last_value = require('./last_value.cjs');
|
|
4
|
+
const require_topic = require('./topic.cjs');
|
|
5
|
+
const require_ephemeral_value = require('./ephemeral_value.cjs');
|
|
6
|
+
const require_named_barrier_value = require('./named_barrier_value.cjs');
|
|
7
|
+
const require_any_value = require('./any_value.cjs');
|
|
8
|
+
const require_dynamic_barrier_value = require('./dynamic_barrier_value.cjs');
|
|
9
|
+
|
|
10
|
+
exports.AnyValue = require_any_value.AnyValue;
|
|
11
|
+
exports.BaseChannel = require_base.BaseChannel;
|
|
12
|
+
exports.BinaryOperatorAggregate = require_binop.BinaryOperatorAggregate;
|
|
13
|
+
exports.DynamicBarrierValue = require_dynamic_barrier_value.DynamicBarrierValue;
|
|
14
|
+
exports.EphemeralValue = require_ephemeral_value.EphemeralValue;
|
|
15
|
+
exports.LastValue = require_last_value.LastValue;
|
|
16
|
+
exports.LastValueAfterFinish = require_last_value.LastValueAfterFinish;
|
|
17
|
+
exports.NamedBarrierValue = require_named_barrier_value.NamedBarrierValue;
|
|
18
|
+
exports.NamedBarrierValueAfterFinish = require_named_barrier_value.NamedBarrierValueAfterFinish;
|
|
19
|
+
exports.Topic = require_topic.Topic;
|
|
20
|
+
exports.createCheckpoint = require_base.createCheckpoint;
|
|
21
|
+
exports.empty = require_base.emptyChannels;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseChannel, createCheckpoint, emptyChannels } from "./base.cjs";
|
|
2
|
+
import { BinaryOperator, BinaryOperatorAggregate } from "./binop.cjs";
|
|
3
|
+
import { AnyValue } from "./any_value.cjs";
|
|
4
|
+
import { LastValue, LastValueAfterFinish } from "./last_value.cjs";
|
|
5
|
+
import { DynamicBarrierValue, WaitForNames } from "./dynamic_barrier_value.cjs";
|
|
6
|
+
import { EphemeralValue } from "./ephemeral_value.cjs";
|
|
7
|
+
import { NamedBarrierValue, NamedBarrierValueAfterFinish } from "./named_barrier_value.cjs";
|
|
8
|
+
import { Topic } from "./topic.cjs";
|
|
9
|
+
export { AnyValue, BaseChannel, type BinaryOperator, BinaryOperatorAggregate, DynamicBarrierValue, EphemeralValue, LastValue, LastValueAfterFinish, NamedBarrierValue, NamedBarrierValueAfterFinish, Topic, type WaitForNames, createCheckpoint, emptyChannels as empty };
|
package/dist/channels/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { BaseChannel, createCheckpoint, emptyChannels } from "./base.js";
|
|
2
|
+
import { BinaryOperator, BinaryOperatorAggregate } from "./binop.js";
|
|
3
|
+
import { AnyValue } from "./any_value.js";
|
|
4
|
+
import { LastValue, LastValueAfterFinish } from "./last_value.js";
|
|
5
|
+
import { DynamicBarrierValue, WaitForNames } from "./dynamic_barrier_value.js";
|
|
6
|
+
import { EphemeralValue } from "./ephemeral_value.js";
|
|
7
|
+
import { NamedBarrierValue, NamedBarrierValueAfterFinish } from "./named_barrier_value.js";
|
|
8
|
+
import { Topic } from "./topic.js";
|
|
9
|
+
export { AnyValue, BaseChannel, type BinaryOperator, BinaryOperatorAggregate, DynamicBarrierValue, EphemeralValue, LastValue, LastValueAfterFinish, NamedBarrierValue, NamedBarrierValueAfterFinish, Topic, type WaitForNames, createCheckpoint, emptyChannels as empty };
|
package/dist/channels/index.js
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { BaseChannel, createCheckpoint, emptyChannels } from "./base.js";
|
|
2
|
+
import { BinaryOperatorAggregate } from "./binop.js";
|
|
3
|
+
import { LastValue, LastValueAfterFinish } from "./last_value.js";
|
|
4
|
+
import { Topic } from "./topic.js";
|
|
5
|
+
import { EphemeralValue } from "./ephemeral_value.js";
|
|
6
|
+
import { NamedBarrierValue, NamedBarrierValueAfterFinish } from "./named_barrier_value.js";
|
|
7
|
+
import { AnyValue } from "./any_value.js";
|
|
8
|
+
import { DynamicBarrierValue } from "./dynamic_barrier_value.js";
|
|
9
|
+
|
|
10
|
+
export { AnyValue, BaseChannel, BinaryOperatorAggregate, DynamicBarrierValue, EphemeralValue, LastValue, LastValueAfterFinish, NamedBarrierValue, NamedBarrierValueAfterFinish, Topic, createCheckpoint, emptyChannels as empty };
|
|
@@ -1,143 +1,93 @@
|
|
|
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/last_value.ts
|
|
6
5
|
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
class LastValue extends
|
|
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
|
-
return false;
|
|
41
|
-
}
|
|
42
|
-
if (values.length !== 1) {
|
|
43
|
-
throw new errors_js_1.InvalidUpdateError("LastValue can only receive one value per step.", { lc_error_code: "INVALID_CONCURRENT_GRAPH_UPDATE" });
|
|
44
|
-
}
|
|
45
|
-
// eslint-disable-next-line prefer-destructuring
|
|
46
|
-
this.value = [values[values.length - 1]];
|
|
47
|
-
return true;
|
|
48
|
-
}
|
|
49
|
-
get() {
|
|
50
|
-
if (this.value.length === 0) {
|
|
51
|
-
throw new errors_js_1.EmptyChannelError();
|
|
52
|
-
}
|
|
53
|
-
return this.value[0];
|
|
54
|
-
}
|
|
55
|
-
checkpoint() {
|
|
56
|
-
if (this.value.length === 0) {
|
|
57
|
-
throw new errors_js_1.EmptyChannelError();
|
|
58
|
-
}
|
|
59
|
-
return this.value[0];
|
|
60
|
-
}
|
|
61
|
-
isAvailable() {
|
|
62
|
-
return this.value.length !== 0;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
exports.LastValue = LastValue;
|
|
6
|
+
* Stores the last value received, can receive at most one value per step.
|
|
7
|
+
*
|
|
8
|
+
* Since `update` is only called once per step and value can only be of length 1,
|
|
9
|
+
* LastValue always stores the last value of a single node. If multiple nodes attempt to
|
|
10
|
+
* write to this channel in a single step, an error will be thrown.
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
var LastValue = class LastValue extends require_base.BaseChannel {
|
|
14
|
+
lc_graph_name = "LastValue";
|
|
15
|
+
value = [];
|
|
16
|
+
fromCheckpoint(checkpoint) {
|
|
17
|
+
const empty = new LastValue();
|
|
18
|
+
if (typeof checkpoint !== "undefined") empty.value = [checkpoint];
|
|
19
|
+
return empty;
|
|
20
|
+
}
|
|
21
|
+
update(values) {
|
|
22
|
+
if (values.length === 0) return false;
|
|
23
|
+
if (values.length !== 1) throw new require_errors.InvalidUpdateError("LastValue can only receive one value per step.", { lc_error_code: "INVALID_CONCURRENT_GRAPH_UPDATE" });
|
|
24
|
+
this.value = [values[values.length - 1]];
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
get() {
|
|
28
|
+
if (this.value.length === 0) throw new require_errors.EmptyChannelError();
|
|
29
|
+
return this.value[0];
|
|
30
|
+
}
|
|
31
|
+
checkpoint() {
|
|
32
|
+
if (this.value.length === 0) throw new require_errors.EmptyChannelError();
|
|
33
|
+
return this.value[0];
|
|
34
|
+
}
|
|
35
|
+
isAvailable() {
|
|
36
|
+
return this.value.length !== 0;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
66
39
|
/**
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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
|
-
if (this.value.length === 0)
|
|
120
|
-
return undefined;
|
|
121
|
-
return [this.value[0], this.finished];
|
|
122
|
-
}
|
|
123
|
-
consume() {
|
|
124
|
-
if (this.finished) {
|
|
125
|
-
this.finished = false;
|
|
126
|
-
this.value = [];
|
|
127
|
-
return true;
|
|
128
|
-
}
|
|
129
|
-
return false;
|
|
130
|
-
}
|
|
131
|
-
finish() {
|
|
132
|
-
if (!this.finished && this.value.length > 0) {
|
|
133
|
-
this.finished = true;
|
|
134
|
-
return true;
|
|
135
|
-
}
|
|
136
|
-
return false;
|
|
137
|
-
}
|
|
138
|
-
isAvailable() {
|
|
139
|
-
return this.value.length !== 0 && this.finished;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
40
|
+
* Stores the last value received, but only made available after finish().
|
|
41
|
+
* Once made available, clears the value.
|
|
42
|
+
*/
|
|
43
|
+
var LastValueAfterFinish = class LastValueAfterFinish extends require_base.BaseChannel {
|
|
44
|
+
lc_graph_name = "LastValueAfterFinish";
|
|
45
|
+
value = [];
|
|
46
|
+
finished = false;
|
|
47
|
+
fromCheckpoint(checkpoint) {
|
|
48
|
+
const empty = new LastValueAfterFinish();
|
|
49
|
+
if (typeof checkpoint !== "undefined") {
|
|
50
|
+
const [value, finished] = checkpoint;
|
|
51
|
+
empty.value = [value];
|
|
52
|
+
empty.finished = finished;
|
|
53
|
+
}
|
|
54
|
+
return empty;
|
|
55
|
+
}
|
|
56
|
+
update(values) {
|
|
57
|
+
if (values.length === 0) return false;
|
|
58
|
+
this.finished = false;
|
|
59
|
+
this.value = [values[values.length - 1]];
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
get() {
|
|
63
|
+
if (this.value.length === 0 || !this.finished) throw new require_errors.EmptyChannelError();
|
|
64
|
+
return this.value[0];
|
|
65
|
+
}
|
|
66
|
+
checkpoint() {
|
|
67
|
+
if (this.value.length === 0) return void 0;
|
|
68
|
+
return [this.value[0], this.finished];
|
|
69
|
+
}
|
|
70
|
+
consume() {
|
|
71
|
+
if (this.finished) {
|
|
72
|
+
this.finished = false;
|
|
73
|
+
this.value = [];
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
finish() {
|
|
79
|
+
if (!this.finished && this.value.length > 0) {
|
|
80
|
+
this.finished = true;
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
isAvailable() {
|
|
86
|
+
return this.value.length !== 0 && this.finished;
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
//#endregion
|
|
91
|
+
exports.LastValue = LastValue;
|
|
142
92
|
exports.LastValueAfterFinish = LastValueAfterFinish;
|
|
143
|
-
//# sourceMappingURL=last_value.
|
|
93
|
+
//# sourceMappingURL=last_value.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"last_value.cjs","names":["BaseChannel","InvalidUpdateError","EmptyChannelError"],"sources":["../../src/channels/last_value.ts"],"sourcesContent":["import { EmptyChannelError, InvalidUpdateError } from \"../errors.js\";\nimport { BaseChannel } from \"./base.js\";\n\n/**\n * Stores the last value received, can receive at most one value per step.\n *\n * Since `update` is only called once per step and value can only be of length 1,\n * LastValue always stores the last value of a single node. If multiple nodes attempt to\n * write to this channel in a single step, an error will be thrown.\n * @internal\n */\nexport class LastValue<Value> extends BaseChannel<Value, Value, Value> {\n lc_graph_name = \"LastValue\";\n\n // value is an array so we don't misinterpret an update to undefined as no write\n value: [Value] | [] = [];\n\n fromCheckpoint(checkpoint?: Value) {\n const empty = new LastValue<Value>();\n if (typeof checkpoint !== \"undefined\") {\n empty.value = [checkpoint];\n }\n\n return empty as this;\n }\n\n update(values: Value[]): boolean {\n if (values.length === 0) {\n return false;\n }\n if (values.length !== 1) {\n throw new InvalidUpdateError(\n \"LastValue can only receive one value per step.\",\n { lc_error_code: \"INVALID_CONCURRENT_GRAPH_UPDATE\" }\n );\n }\n\n // eslint-disable-next-line prefer-destructuring\n this.value = [values[values.length - 1]];\n return true;\n }\n\n get(): Value {\n if (this.value.length === 0) {\n throw new EmptyChannelError();\n }\n return this.value[0];\n }\n\n checkpoint(): Value {\n if (this.value.length === 0) {\n throw new EmptyChannelError();\n }\n return this.value[0];\n }\n\n isAvailable(): boolean {\n return this.value.length !== 0;\n }\n}\n\n/**\n * Stores the last value received, but only made available after finish().\n * Once made available, clears the value.\n */\nexport class LastValueAfterFinish<Value> extends BaseChannel<\n Value,\n Value,\n [Value, boolean]\n> {\n lc_graph_name = \"LastValueAfterFinish\";\n\n // value is an array so we don't misinterpret an update to undefined as no write\n value: [Value] | [] = [];\n\n finished: boolean = false;\n\n fromCheckpoint(checkpoint?: [Value, boolean]) {\n const empty = new LastValueAfterFinish<Value>();\n if (typeof checkpoint !== \"undefined\") {\n const [value, finished] = checkpoint;\n empty.value = [value];\n empty.finished = finished;\n }\n return empty as this;\n }\n\n update(values: Value[]): boolean {\n if (values.length === 0) {\n return false;\n }\n\n this.finished = false;\n // eslint-disable-next-line prefer-destructuring\n this.value = [values[values.length - 1]];\n return true;\n }\n\n get(): Value {\n if (this.value.length === 0 || !this.finished) {\n throw new EmptyChannelError();\n }\n return this.value[0];\n }\n\n checkpoint(): [Value, boolean] | undefined {\n if (this.value.length === 0) return undefined;\n return [this.value[0], this.finished];\n }\n\n consume(): boolean {\n if (this.finished) {\n this.finished = false;\n this.value = [];\n return true;\n }\n return false;\n }\n\n finish(): boolean {\n if (!this.finished && this.value.length > 0) {\n this.finished = true;\n return true;\n }\n return false;\n }\n\n isAvailable(): boolean {\n return this.value.length !== 0 && this.finished;\n }\n}\n"],"mappings":";;;;;;;;;;;;AAWA,IAAa,YAAb,MAAa,kBAAyBA,yBAAiC;CACrE,gBAAgB;CAGhB,QAAsB;CAEtB,eAAe,YAAoB;EACjC,MAAM,QAAQ,IAAI;AAClB,MAAI,OAAO,eAAe,YACxB,OAAM,QAAQ,CAAC;AAGjB,SAAO;;CAGT,OAAO,QAA0B;AAC/B,MAAI,OAAO,WAAW,EACpB,QAAO;AAET,MAAI,OAAO,WAAW,EACpB,OAAM,IAAIC,kCACR,kDACA,EAAE,eAAe;AAKrB,OAAK,QAAQ,CAAC,OAAO,OAAO,SAAS;AACrC,SAAO;;CAGT,MAAa;AACX,MAAI,KAAK,MAAM,WAAW,EACxB,OAAM,IAAIC;AAEZ,SAAO,KAAK,MAAM;;CAGpB,aAAoB;AAClB,MAAI,KAAK,MAAM,WAAW,EACxB,OAAM,IAAIA;AAEZ,SAAO,KAAK,MAAM;;CAGpB,cAAuB;AACrB,SAAO,KAAK,MAAM,WAAW;;;;;;;AAQjC,IAAa,uBAAb,MAAa,6BAAoCF,yBAI/C;CACA,gBAAgB;CAGhB,QAAsB;CAEtB,WAAoB;CAEpB,eAAe,YAA+B;EAC5C,MAAM,QAAQ,IAAI;AAClB,MAAI,OAAO,eAAe,aAAa;GACrC,MAAM,CAAC,OAAO,YAAY;AAC1B,SAAM,QAAQ,CAAC;AACf,SAAM,WAAW;;AAEnB,SAAO;;CAGT,OAAO,QAA0B;AAC/B,MAAI,OAAO,WAAW,EACpB,QAAO;AAGT,OAAK,WAAW;AAEhB,OAAK,QAAQ,CAAC,OAAO,OAAO,SAAS;AACrC,SAAO;;CAGT,MAAa;AACX,MAAI,KAAK,MAAM,WAAW,KAAK,CAAC,KAAK,SACnC,OAAM,IAAIE;AAEZ,SAAO,KAAK,MAAM;;CAGpB,aAA2C;AACzC,MAAI,KAAK,MAAM,WAAW,EAAG,QAAO;AACpC,SAAO,CAAC,KAAK,MAAM,IAAI,KAAK;;CAG9B,UAAmB;AACjB,MAAI,KAAK,UAAU;AACjB,QAAK,WAAW;AAChB,QAAK,QAAQ;AACb,UAAO;;AAET,SAAO;;CAGT,SAAkB;AAChB,MAAI,CAAC,KAAK,YAAY,KAAK,MAAM,SAAS,GAAG;AAC3C,QAAK,WAAW;AAChB,UAAO;;AAET,SAAO;;CAGT,cAAuB;AACrB,SAAO,KAAK,MAAM,WAAW,KAAK,KAAK"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { BaseChannel } from "./base.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/channels/last_value.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Stores the last value received, can receive at most one value per step.
|
|
7
|
+
*
|
|
8
|
+
* Since `update` is only called once per step and value can only be of length 1,
|
|
9
|
+
* LastValue always stores the last value of a single node. If multiple nodes attempt to
|
|
10
|
+
* write to this channel in a single step, an error will be thrown.
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
declare class LastValue<Value> extends BaseChannel<Value, Value, Value> {
|
|
14
|
+
lc_graph_name: string;
|
|
15
|
+
// value is an array so we don't misinterpret an update to undefined as no write
|
|
16
|
+
value: [Value] | [];
|
|
17
|
+
fromCheckpoint(checkpoint?: Value): this;
|
|
18
|
+
update(values: Value[]): boolean;
|
|
19
|
+
get(): Value;
|
|
20
|
+
checkpoint(): Value;
|
|
21
|
+
isAvailable(): boolean;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Stores the last value received, but only made available after finish().
|
|
25
|
+
* Once made available, clears the value.
|
|
26
|
+
*/
|
|
27
|
+
declare class LastValueAfterFinish<Value> extends BaseChannel<Value, Value, [Value, boolean]> {
|
|
28
|
+
lc_graph_name: string;
|
|
29
|
+
// value is an array so we don't misinterpret an update to undefined as no write
|
|
30
|
+
value: [Value] | [];
|
|
31
|
+
finished: boolean;
|
|
32
|
+
fromCheckpoint(checkpoint?: [Value, boolean]): this;
|
|
33
|
+
update(values: Value[]): boolean;
|
|
34
|
+
get(): Value;
|
|
35
|
+
checkpoint(): [Value, boolean] | undefined;
|
|
36
|
+
consume(): boolean;
|
|
37
|
+
finish(): boolean;
|
|
38
|
+
isAvailable(): boolean;
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
export { LastValue, LastValueAfterFinish };
|
|
42
|
+
//# sourceMappingURL=last_value.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"last_value.d.cts","names":["BaseChannel","LastValue","Value","LastValueAfterFinish"],"sources":["../../src/channels/last_value.d.ts"],"sourcesContent":["import { BaseChannel } from \"./base.js\";\n/**\n * Stores the last value received, can receive at most one value per step.\n *\n * Since `update` is only called once per step and value can only be of length 1,\n * LastValue always stores the last value of a single node. If multiple nodes attempt to\n * write to this channel in a single step, an error will be thrown.\n * @internal\n */\nexport declare class LastValue<Value> extends BaseChannel<Value, Value, Value> {\n lc_graph_name: string;\n // value is an array so we don't misinterpret an update to undefined as no write\n value: [Value] | [];\n fromCheckpoint(checkpoint?: Value): this;\n update(values: Value[]): boolean;\n get(): Value;\n checkpoint(): Value;\n isAvailable(): boolean;\n}\n/**\n * Stores the last value received, but only made available after finish().\n * Once made available, clears the value.\n */\nexport declare class LastValueAfterFinish<Value> extends BaseChannel<Value, Value, [\n Value,\n boolean\n]> {\n lc_graph_name: string;\n // value is an array so we don't misinterpret an update to undefined as no write\n value: [Value] | [];\n finished: boolean;\n fromCheckpoint(checkpoint?: [Value, boolean]): this;\n update(values: Value[]): boolean;\n get(): Value;\n checkpoint(): [Value, boolean] | undefined;\n consume(): boolean;\n finish(): boolean;\n isAvailable(): boolean;\n}\n"],"mappings":";;;;;;AASA;;;;;;AAIgCE,cAJXD,SAIWC,CAAAA,KAAAA,CAAAA,SAJcF,WAIdE,CAJ0BA,KAI1BA,EAJiCA,KAIjCA,EAJwCA,KAIxCA,CAAAA,CAAAA;eACbA,EAAAA,MAAAA;;OAEDA,EAAAA,CAJNA,KAIMA,CAAAA,GAAAA,EAAAA;gBAP4BF,CAAAA,UAAAA,CAAAA,EAIdE,KAJcF,CAAAA,EAAAA,IAAAA;iBAK3BE;EASEC,GAAAA,CAAAA,CAAAA,EARVD,KAQUC;EAAoB,UAAA,CAAA,CAAA,EAPvBD,KAOuB;aAA4BA,CAAAA,CAAAA,EAAAA,OAAAA;;;;;;AAU1DA,cAVUC,oBAUVD,CAAAA,KAAAA,CAAAA,SAV8CF,WAU9CE,CAV0DA,KAU1DA,EAViEA,KAUjEA,EAAAA,CATPA,KAUeA,SAXsCF;;;UAM7CE;;+BAEqBA;iBACdA;SACRA;iBACQA"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { BaseChannel } from "./base.js";
|
|
2
|
+
|
|
3
|
+
//#region src/channels/last_value.d.ts
|
|
4
|
+
|
|
2
5
|
/**
|
|
3
6
|
* Stores the last value received, can receive at most one value per step.
|
|
4
7
|
*
|
|
@@ -7,32 +10,33 @@ import { BaseChannel } from "./base.js";
|
|
|
7
10
|
* write to this channel in a single step, an error will be thrown.
|
|
8
11
|
* @internal
|
|
9
12
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
declare class LastValue<Value> extends BaseChannel<Value, Value, Value> {
|
|
14
|
+
lc_graph_name: string;
|
|
15
|
+
// value is an array so we don't misinterpret an update to undefined as no write
|
|
16
|
+
value: [Value] | [];
|
|
17
|
+
fromCheckpoint(checkpoint?: Value): this;
|
|
18
|
+
update(values: Value[]): boolean;
|
|
19
|
+
get(): Value;
|
|
20
|
+
checkpoint(): Value;
|
|
21
|
+
isAvailable(): boolean;
|
|
18
22
|
}
|
|
19
23
|
/**
|
|
20
24
|
* Stores the last value received, but only made available after finish().
|
|
21
25
|
* Once made available, clears the value.
|
|
22
|
-
* @internal
|
|
23
26
|
*/
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
]
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
finish(): boolean;
|
|
37
|
-
isAvailable(): boolean;
|
|
27
|
+
declare class LastValueAfterFinish<Value> extends BaseChannel<Value, Value, [Value, boolean]> {
|
|
28
|
+
lc_graph_name: string;
|
|
29
|
+
// value is an array so we don't misinterpret an update to undefined as no write
|
|
30
|
+
value: [Value] | [];
|
|
31
|
+
finished: boolean;
|
|
32
|
+
fromCheckpoint(checkpoint?: [Value, boolean]): this;
|
|
33
|
+
update(values: Value[]): boolean;
|
|
34
|
+
get(): Value;
|
|
35
|
+
checkpoint(): [Value, boolean] | undefined;
|
|
36
|
+
consume(): boolean;
|
|
37
|
+
finish(): boolean;
|
|
38
|
+
isAvailable(): boolean;
|
|
38
39
|
}
|
|
40
|
+
//#endregion
|
|
41
|
+
export { LastValue, LastValueAfterFinish };
|
|
42
|
+
//# sourceMappingURL=last_value.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"last_value.d.ts","names":["BaseChannel","LastValue","Value","LastValueAfterFinish"],"sources":["../../src/channels/last_value.d.ts"],"sourcesContent":["import { BaseChannel } from \"./base.js\";\n/**\n * Stores the last value received, can receive at most one value per step.\n *\n * Since `update` is only called once per step and value can only be of length 1,\n * LastValue always stores the last value of a single node. If multiple nodes attempt to\n * write to this channel in a single step, an error will be thrown.\n * @internal\n */\nexport declare class LastValue<Value> extends BaseChannel<Value, Value, Value> {\n lc_graph_name: string;\n // value is an array so we don't misinterpret an update to undefined as no write\n value: [Value] | [];\n fromCheckpoint(checkpoint?: Value): this;\n update(values: Value[]): boolean;\n get(): Value;\n checkpoint(): Value;\n isAvailable(): boolean;\n}\n/**\n * Stores the last value received, but only made available after finish().\n * Once made available, clears the value.\n */\nexport declare class LastValueAfterFinish<Value> extends BaseChannel<Value, Value, [\n Value,\n boolean\n]> {\n lc_graph_name: string;\n // value is an array so we don't misinterpret an update to undefined as no write\n value: [Value] | [];\n finished: boolean;\n fromCheckpoint(checkpoint?: [Value, boolean]): this;\n update(values: Value[]): boolean;\n get(): Value;\n checkpoint(): [Value, boolean] | undefined;\n consume(): boolean;\n finish(): boolean;\n isAvailable(): boolean;\n}\n"],"mappings":";;;;;;AASA;;;;;;AAIgCE,cAJXD,SAIWC,CAAAA,KAAAA,CAAAA,SAJcF,WAIdE,CAJ0BA,KAI1BA,EAJiCA,KAIjCA,EAJwCA,KAIxCA,CAAAA,CAAAA;eACbA,EAAAA,MAAAA;;OAEDA,EAAAA,CAJNA,KAIMA,CAAAA,GAAAA,EAAAA;gBAP4BF,CAAAA,UAAAA,CAAAA,EAIdE,KAJcF,CAAAA,EAAAA,IAAAA;iBAK3BE;EASEC,GAAAA,CAAAA,CAAAA,EARVD,KAQUC;EAAoB,UAAA,CAAA,CAAA,EAPvBD,KAOuB;aAA4BA,CAAAA,CAAAA,EAAAA,OAAAA;;;;;;AAU1DA,cAVUC,oBAUVD,CAAAA,KAAAA,CAAAA,SAV8CF,WAU9CE,CAV0DA,KAU1DA,EAViEA,KAUjEA,EAAAA,CATPA,KAUeA,SAXsCF;;;UAM7CE;;+BAEqBA;iBACdA;SACRA;iBACQA"}
|