@langchain/langgraph 1.0.7 → 1.0.12
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/package.json +7 -7
- package/CHANGELOG.md +0 -286
- package/dist/_virtual/rolldown_runtime.cjs +0 -25
- package/dist/channels/any_value.cjs +0 -46
- package/dist/channels/any_value.cjs.map +0 -1
- package/dist/channels/any_value.d.cts +0 -24
- package/dist/channels/any_value.d.cts.map +0 -1
- package/dist/channels/any_value.d.ts +0 -24
- package/dist/channels/any_value.d.ts.map +0 -1
- package/dist/channels/any_value.js +0 -46
- package/dist/channels/any_value.js.map +0 -1
- package/dist/channels/base.cjs +0 -102
- package/dist/channels/base.cjs.map +0 -1
- package/dist/channels/base.d.cts +0 -79
- package/dist/channels/base.d.cts.map +0 -1
- package/dist/channels/base.d.ts +0 -79
- package/dist/channels/base.d.ts.map +0 -1
- package/dist/channels/base.js +0 -97
- package/dist/channels/base.js.map +0 -1
- package/dist/channels/binop.cjs +0 -49
- package/dist/channels/binop.cjs.map +0 -1
- package/dist/channels/binop.d.cts +0 -22
- package/dist/channels/binop.d.cts.map +0 -1
- package/dist/channels/binop.d.ts +0 -22
- package/dist/channels/binop.d.ts.map +0 -1
- package/dist/channels/binop.js +0 -49
- package/dist/channels/binop.js.map +0 -1
- package/dist/channels/dynamic_barrier_value.cjs +0 -76
- package/dist/channels/dynamic_barrier_value.cjs.map +0 -1
- package/dist/channels/dynamic_barrier_value.d.cts +0 -42
- package/dist/channels/dynamic_barrier_value.d.cts.map +0 -1
- package/dist/channels/dynamic_barrier_value.d.ts +0 -42
- package/dist/channels/dynamic_barrier_value.d.ts.map +0 -1
- package/dist/channels/dynamic_barrier_value.js +0 -76
- package/dist/channels/dynamic_barrier_value.js.map +0 -1
- package/dist/channels/ephemeral_value.cjs +0 -46
- package/dist/channels/ephemeral_value.cjs.map +0 -1
- package/dist/channels/ephemeral_value.d.cts +0 -22
- package/dist/channels/ephemeral_value.d.cts.map +0 -1
- package/dist/channels/ephemeral_value.d.ts +0 -22
- package/dist/channels/ephemeral_value.d.ts.map +0 -1
- package/dist/channels/ephemeral_value.js +0 -46
- package/dist/channels/ephemeral_value.js.map +0 -1
- package/dist/channels/index.cjs +0 -21
- package/dist/channels/index.d.cts +0 -9
- package/dist/channels/index.d.ts +0 -9
- package/dist/channels/index.js +0 -10
- package/dist/channels/last_value.cjs +0 -98
- package/dist/channels/last_value.cjs.map +0 -1
- package/dist/channels/last_value.d.cts +0 -44
- package/dist/channels/last_value.d.cts.map +0 -1
- package/dist/channels/last_value.d.ts +0 -44
- package/dist/channels/last_value.d.ts.map +0 -1
- package/dist/channels/last_value.js +0 -97
- package/dist/channels/last_value.js.map +0 -1
- package/dist/channels/named_barrier_value.cjs +0 -118
- package/dist/channels/named_barrier_value.cjs.map +0 -1
- package/dist/channels/named_barrier_value.d.cts +0 -46
- package/dist/channels/named_barrier_value.d.cts.map +0 -1
- package/dist/channels/named_barrier_value.d.ts +0 -46
- package/dist/channels/named_barrier_value.d.ts.map +0 -1
- package/dist/channels/named_barrier_value.js +0 -116
- package/dist/channels/named_barrier_value.js.map +0 -1
- package/dist/channels/topic.cjs +0 -65
- package/dist/channels/topic.cjs.map +0 -1
- package/dist/channels/topic.d.cts +0 -32
- package/dist/channels/topic.d.cts.map +0 -1
- package/dist/channels/topic.d.ts +0 -32
- package/dist/channels/topic.d.ts.map +0 -1
- package/dist/channels/topic.js +0 -65
- package/dist/channels/topic.js.map +0 -1
- package/dist/constants.cjs +0 -406
- package/dist/constants.cjs.map +0 -1
- package/dist/constants.d.cts +0 -285
- package/dist/constants.d.cts.map +0 -1
- package/dist/constants.d.ts +0 -285
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js +0 -362
- package/dist/constants.js.map +0 -1
- package/dist/errors.cjs +0 -163
- package/dist/errors.cjs.map +0 -1
- package/dist/errors.d.cts +0 -81
- package/dist/errors.d.cts.map +0 -1
- package/dist/errors.d.ts +0 -81
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -146
- package/dist/errors.js.map +0 -1
- package/dist/func/index.cjs +0 -301
- package/dist/func/index.cjs.map +0 -1
- package/dist/func/index.d.cts +0 -293
- package/dist/func/index.d.cts.map +0 -1
- package/dist/func/index.d.ts +0 -293
- package/dist/func/index.d.ts.map +0 -1
- package/dist/func/index.js +0 -298
- package/dist/func/index.js.map +0 -1
- package/dist/func/types.d.cts +0 -64
- package/dist/func/types.d.cts.map +0 -1
- package/dist/func/types.d.ts +0 -64
- package/dist/func/types.d.ts.map +0 -1
- package/dist/graph/annotation.cjs +0 -101
- package/dist/graph/annotation.cjs.map +0 -1
- package/dist/graph/annotation.d.cts +0 -116
- package/dist/graph/annotation.d.cts.map +0 -1
- package/dist/graph/annotation.d.ts +0 -116
- package/dist/graph/annotation.d.ts.map +0 -1
- package/dist/graph/annotation.js +0 -99
- package/dist/graph/annotation.js.map +0 -1
- package/dist/graph/graph.cjs +0 -423
- package/dist/graph/graph.cjs.map +0 -1
- package/dist/graph/graph.d.cts +0 -132
- package/dist/graph/graph.d.cts.map +0 -1
- package/dist/graph/graph.d.ts +0 -132
- package/dist/graph/graph.d.ts.map +0 -1
- package/dist/graph/graph.js +0 -420
- package/dist/graph/graph.js.map +0 -1
- package/dist/graph/index.cjs +0 -5
- package/dist/graph/index.js +0 -7
- package/dist/graph/message.cjs +0 -99
- package/dist/graph/message.cjs.map +0 -1
- package/dist/graph/message.d.cts +0 -40
- package/dist/graph/message.d.cts.map +0 -1
- package/dist/graph/message.d.ts +0 -40
- package/dist/graph/message.d.ts.map +0 -1
- package/dist/graph/message.js +0 -95
- package/dist/graph/message.js.map +0 -1
- package/dist/graph/messages_annotation.cjs +0 -110
- package/dist/graph/messages_annotation.cjs.map +0 -1
- package/dist/graph/messages_annotation.d.cts +0 -112
- package/dist/graph/messages_annotation.d.cts.map +0 -1
- package/dist/graph/messages_annotation.d.ts +0 -112
- package/dist/graph/messages_annotation.d.ts.map +0 -1
- package/dist/graph/messages_annotation.js +0 -107
- package/dist/graph/messages_annotation.js.map +0 -1
- package/dist/graph/state.cjs +0 -501
- package/dist/graph/state.cjs.map +0 -1
- package/dist/graph/state.d.cts +0 -236
- package/dist/graph/state.d.cts.map +0 -1
- package/dist/graph/state.d.ts +0 -236
- package/dist/graph/state.d.ts.map +0 -1
- package/dist/graph/state.js +0 -499
- package/dist/graph/state.js.map +0 -1
- package/dist/graph/zod/index.cjs +0 -10
- package/dist/graph/zod/index.d.cts +0 -3
- package/dist/graph/zod/index.d.ts +0 -3
- package/dist/graph/zod/index.js +0 -5
- package/dist/graph/zod/meta.cjs +0 -145
- package/dist/graph/zod/meta.cjs.map +0 -1
- package/dist/graph/zod/meta.d.cts +0 -116
- package/dist/graph/zod/meta.d.cts.map +0 -1
- package/dist/graph/zod/meta.d.ts +0 -116
- package/dist/graph/zod/meta.d.ts.map +0 -1
- package/dist/graph/zod/meta.js +0 -141
- package/dist/graph/zod/meta.js.map +0 -1
- package/dist/graph/zod/plugin.cjs +0 -41
- package/dist/graph/zod/plugin.cjs.map +0 -1
- package/dist/graph/zod/plugin.js +0 -41
- package/dist/graph/zod/plugin.js.map +0 -1
- package/dist/graph/zod/schema.cjs +0 -99
- package/dist/graph/zod/schema.cjs.map +0 -1
- package/dist/graph/zod/schema.d.cts +0 -38
- package/dist/graph/zod/schema.d.cts.map +0 -1
- package/dist/graph/zod/schema.d.ts +0 -38
- package/dist/graph/zod/schema.d.ts.map +0 -1
- package/dist/graph/zod/schema.js +0 -94
- package/dist/graph/zod/schema.js.map +0 -1
- package/dist/graph/zod/zod-registry.cjs +0 -43
- package/dist/graph/zod/zod-registry.cjs.map +0 -1
- package/dist/graph/zod/zod-registry.d.cts +0 -51
- package/dist/graph/zod/zod-registry.d.cts.map +0 -1
- package/dist/graph/zod/zod-registry.d.ts +0 -51
- package/dist/graph/zod/zod-registry.d.ts.map +0 -1
- package/dist/graph/zod/zod-registry.js +0 -41
- package/dist/graph/zod/zod-registry.js.map +0 -1
- package/dist/hash.cjs +0 -271
- package/dist/hash.cjs.map +0 -1
- package/dist/hash.js +0 -269
- package/dist/hash.js.map +0 -1
- package/dist/index.cjs +0 -112
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -26
- package/dist/index.d.ts +0 -26
- package/dist/index.js +0 -22
- package/dist/index.js.map +0 -1
- package/dist/interrupt.cjs +0 -82
- package/dist/interrupt.cjs.map +0 -1
- package/dist/interrupt.d.cts +0 -58
- package/dist/interrupt.d.cts.map +0 -1
- package/dist/interrupt.d.ts +0 -58
- package/dist/interrupt.d.ts.map +0 -1
- package/dist/interrupt.js +0 -81
- package/dist/interrupt.js.map +0 -1
- package/dist/prebuilt/agentName.cjs +0 -153
- package/dist/prebuilt/agentName.cjs.map +0 -1
- package/dist/prebuilt/agentName.d.cts +0 -42
- package/dist/prebuilt/agentName.d.cts.map +0 -1
- package/dist/prebuilt/agentName.d.ts +0 -42
- package/dist/prebuilt/agentName.d.ts.map +0 -1
- package/dist/prebuilt/agentName.js +0 -152
- package/dist/prebuilt/agentName.js.map +0 -1
- package/dist/prebuilt/agent_executor.cjs +0 -44
- package/dist/prebuilt/agent_executor.cjs.map +0 -1
- package/dist/prebuilt/agent_executor.d.cts +0 -58
- package/dist/prebuilt/agent_executor.d.cts.map +0 -1
- package/dist/prebuilt/agent_executor.d.ts +0 -58
- package/dist/prebuilt/agent_executor.d.ts.map +0 -1
- package/dist/prebuilt/agent_executor.js +0 -44
- package/dist/prebuilt/agent_executor.js.map +0 -1
- package/dist/prebuilt/chat_agent_executor.cjs +0 -68
- package/dist/prebuilt/chat_agent_executor.cjs.map +0 -1
- package/dist/prebuilt/chat_agent_executor.d.cts +0 -23
- package/dist/prebuilt/chat_agent_executor.d.cts.map +0 -1
- package/dist/prebuilt/chat_agent_executor.d.ts +0 -23
- package/dist/prebuilt/chat_agent_executor.d.ts.map +0 -1
- package/dist/prebuilt/chat_agent_executor.js +0 -67
- package/dist/prebuilt/chat_agent_executor.js.map +0 -1
- package/dist/prebuilt/index.cjs +0 -15
- package/dist/prebuilt/index.d.cts +0 -8
- package/dist/prebuilt/index.d.ts +0 -8
- package/dist/prebuilt/index.js +0 -8
- package/dist/prebuilt/interrupt.d.cts +0 -61
- package/dist/prebuilt/interrupt.d.cts.map +0 -1
- package/dist/prebuilt/interrupt.d.ts +0 -61
- package/dist/prebuilt/interrupt.d.ts.map +0 -1
- package/dist/prebuilt/react_agent_executor.cjs +0 -344
- package/dist/prebuilt/react_agent_executor.cjs.map +0 -1
- package/dist/prebuilt/react_agent_executor.d.cts +0 -230
- package/dist/prebuilt/react_agent_executor.d.cts.map +0 -1
- package/dist/prebuilt/react_agent_executor.d.ts +0 -230
- package/dist/prebuilt/react_agent_executor.d.ts.map +0 -1
- package/dist/prebuilt/react_agent_executor.js +0 -342
- package/dist/prebuilt/react_agent_executor.js.map +0 -1
- package/dist/prebuilt/tool_executor.cjs +0 -48
- package/dist/prebuilt/tool_executor.cjs.map +0 -1
- package/dist/prebuilt/tool_executor.d.cts +0 -42
- package/dist/prebuilt/tool_executor.d.cts.map +0 -1
- package/dist/prebuilt/tool_executor.d.ts +0 -42
- package/dist/prebuilt/tool_executor.d.ts.map +0 -1
- package/dist/prebuilt/tool_executor.js +0 -47
- package/dist/prebuilt/tool_executor.js.map +0 -1
- package/dist/prebuilt/tool_node.cjs +0 -248
- package/dist/prebuilt/tool_node.cjs.map +0 -1
- package/dist/prebuilt/tool_node.d.cts +0 -182
- package/dist/prebuilt/tool_node.d.cts.map +0 -1
- package/dist/prebuilt/tool_node.d.ts +0 -182
- package/dist/prebuilt/tool_node.d.ts.map +0 -1
- package/dist/prebuilt/tool_node.js +0 -246
- package/dist/prebuilt/tool_node.js.map +0 -1
- package/dist/pregel/algo.cjs +0 -573
- package/dist/pregel/algo.cjs.map +0 -1
- package/dist/pregel/algo.d.cts +0 -13
- package/dist/pregel/algo.d.cts.map +0 -1
- package/dist/pregel/algo.d.ts +0 -13
- package/dist/pregel/algo.d.ts.map +0 -1
- package/dist/pregel/algo.js +0 -567
- package/dist/pregel/algo.js.map +0 -1
- package/dist/pregel/call.cjs +0 -53
- package/dist/pregel/call.cjs.map +0 -1
- package/dist/pregel/call.js +0 -50
- package/dist/pregel/call.js.map +0 -1
- package/dist/pregel/debug.cjs +0 -175
- package/dist/pregel/debug.cjs.map +0 -1
- package/dist/pregel/debug.js +0 -169
- package/dist/pregel/debug.js.map +0 -1
- package/dist/pregel/index.cjs +0 -1170
- package/dist/pregel/index.cjs.map +0 -1
- package/dist/pregel/index.d.cts +0 -546
- package/dist/pregel/index.d.cts.map +0 -1
- package/dist/pregel/index.d.ts +0 -546
- package/dist/pregel/index.d.ts.map +0 -1
- package/dist/pregel/index.js +0 -1168
- package/dist/pregel/index.js.map +0 -1
- package/dist/pregel/io.cjs +0 -140
- package/dist/pregel/io.cjs.map +0 -1
- package/dist/pregel/io.js +0 -135
- package/dist/pregel/io.js.map +0 -1
- package/dist/pregel/loop.cjs +0 -548
- package/dist/pregel/loop.cjs.map +0 -1
- package/dist/pregel/loop.js +0 -547
- package/dist/pregel/loop.js.map +0 -1
- package/dist/pregel/messages.cjs +0 -108
- package/dist/pregel/messages.cjs.map +0 -1
- package/dist/pregel/messages.js +0 -107
- package/dist/pregel/messages.js.map +0 -1
- package/dist/pregel/read.cjs +0 -152
- package/dist/pregel/read.cjs.map +0 -1
- package/dist/pregel/read.d.cts +0 -51
- package/dist/pregel/read.d.cts.map +0 -1
- package/dist/pregel/read.d.ts +0 -51
- package/dist/pregel/read.d.ts.map +0 -1
- package/dist/pregel/read.js +0 -150
- package/dist/pregel/read.js.map +0 -1
- package/dist/pregel/remote.cjs +0 -349
- package/dist/pregel/remote.cjs.map +0 -1
- package/dist/pregel/remote.d.cts +0 -123
- package/dist/pregel/remote.d.cts.map +0 -1
- package/dist/pregel/remote.d.ts +0 -123
- package/dist/pregel/remote.d.ts.map +0 -1
- package/dist/pregel/remote.js +0 -348
- package/dist/pregel/remote.js.map +0 -1
- package/dist/pregel/retry.cjs +0 -92
- package/dist/pregel/retry.cjs.map +0 -1
- package/dist/pregel/retry.js +0 -92
- package/dist/pregel/retry.js.map +0 -1
- package/dist/pregel/runnable_types.d.cts +0 -49
- package/dist/pregel/runnable_types.d.cts.map +0 -1
- package/dist/pregel/runnable_types.d.ts +0 -49
- package/dist/pregel/runnable_types.d.ts.map +0 -1
- package/dist/pregel/runner.cjs +0 -228
- package/dist/pregel/runner.cjs.map +0 -1
- package/dist/pregel/runner.js +0 -228
- package/dist/pregel/runner.js.map +0 -1
- package/dist/pregel/stream.cjs +0 -199
- package/dist/pregel/stream.cjs.map +0 -1
- package/dist/pregel/stream.js +0 -196
- package/dist/pregel/stream.js.map +0 -1
- package/dist/pregel/types.cjs +0 -27
- package/dist/pregel/types.cjs.map +0 -1
- package/dist/pregel/types.d.cts +0 -453
- package/dist/pregel/types.d.cts.map +0 -1
- package/dist/pregel/types.d.ts +0 -453
- package/dist/pregel/types.d.ts.map +0 -1
- package/dist/pregel/types.js +0 -25
- package/dist/pregel/types.js.map +0 -1
- package/dist/pregel/utils/config.cjs +0 -122
- package/dist/pregel/utils/config.cjs.map +0 -1
- package/dist/pregel/utils/config.d.cts +0 -36
- package/dist/pregel/utils/config.d.cts.map +0 -1
- package/dist/pregel/utils/config.d.ts +0 -36
- package/dist/pregel/utils/config.d.ts.map +0 -1
- package/dist/pregel/utils/config.js +0 -115
- package/dist/pregel/utils/config.js.map +0 -1
- package/dist/pregel/utils/index.cjs +0 -103
- package/dist/pregel/utils/index.cjs.map +0 -1
- package/dist/pregel/utils/index.d.cts +0 -51
- package/dist/pregel/utils/index.d.cts.map +0 -1
- package/dist/pregel/utils/index.d.ts +0 -51
- package/dist/pregel/utils/index.d.ts.map +0 -1
- package/dist/pregel/utils/index.js +0 -97
- package/dist/pregel/utils/index.js.map +0 -1
- package/dist/pregel/utils/subgraph.cjs +0 -19
- package/dist/pregel/utils/subgraph.cjs.map +0 -1
- package/dist/pregel/utils/subgraph.js +0 -17
- package/dist/pregel/utils/subgraph.js.map +0 -1
- package/dist/pregel/validate.cjs +0 -45
- package/dist/pregel/validate.cjs.map +0 -1
- package/dist/pregel/validate.js +0 -44
- package/dist/pregel/validate.js.map +0 -1
- package/dist/pregel/write.cjs +0 -97
- package/dist/pregel/write.cjs.map +0 -1
- package/dist/pregel/write.d.cts +0 -35
- package/dist/pregel/write.d.cts.map +0 -1
- package/dist/pregel/write.d.ts +0 -35
- package/dist/pregel/write.d.ts.map +0 -1
- package/dist/pregel/write.js +0 -95
- package/dist/pregel/write.js.map +0 -1
- package/dist/remote.cjs +0 -3
- package/dist/remote.d.cts +0 -2
- package/dist/remote.d.ts +0 -2
- package/dist/remote.js +0 -3
- package/dist/setup/async_local_storage.cjs +0 -12
- package/dist/setup/async_local_storage.cjs.map +0 -1
- package/dist/setup/async_local_storage.js +0 -11
- package/dist/setup/async_local_storage.js.map +0 -1
- package/dist/utils.cjs +0 -88
- package/dist/utils.cjs.map +0 -1
- package/dist/utils.d.cts +0 -32
- package/dist/utils.d.cts.map +0 -1
- package/dist/utils.d.ts +0 -32
- package/dist/utils.d.ts.map +0 -1
- package/dist/utils.js +0 -81
- package/dist/utils.js.map +0 -1
- package/dist/web.cjs +0 -96
- package/dist/web.d.cts +0 -23
- package/dist/web.d.ts +0 -23
- package/dist/web.js +0 -15
- package/dist/writer.cjs +0 -15
- package/dist/writer.cjs.map +0 -1
- package/dist/writer.d.cts +0 -7
- package/dist/writer.d.cts.map +0 -1
- package/dist/writer.d.ts +0 -7
- package/dist/writer.d.ts.map +0 -1
- package/dist/writer.js +0 -14
- package/dist/writer.js.map +0 -1
package/dist/channels/base.d.cts
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { Checkpoint, ReadonlyCheckpoint } from "@langchain/langgraph-checkpoint";
|
|
2
|
-
|
|
3
|
-
//#region src/channels/base.d.ts
|
|
4
|
-
/** @internal */
|
|
5
|
-
declare abstract class BaseChannel<ValueType = unknown, UpdateType = unknown, CheckpointType = unknown> {
|
|
6
|
-
ValueType: ValueType;
|
|
7
|
-
UpdateType: UpdateType;
|
|
8
|
-
/**
|
|
9
|
-
* The name of the channel.
|
|
10
|
-
*/
|
|
11
|
-
abstract lc_graph_name: string;
|
|
12
|
-
/** @ignore */
|
|
13
|
-
lg_is_channel: boolean;
|
|
14
|
-
/**
|
|
15
|
-
* Return a new identical channel, optionally initialized from a checkpoint.
|
|
16
|
-
* Can be thought of as a "restoration" from a checkpoint which is a "snapshot" of the channel's state.
|
|
17
|
-
*
|
|
18
|
-
* @param {CheckpointType | undefined} checkpoint
|
|
19
|
-
* @param {CheckpointType | undefined} initialValue
|
|
20
|
-
* @returns {this}
|
|
21
|
-
*/
|
|
22
|
-
abstract fromCheckpoint(checkpoint?: CheckpointType): this;
|
|
23
|
-
/**
|
|
24
|
-
* Update the channel's value with the given sequence of updates.
|
|
25
|
-
* The order of the updates in the sequence is arbitrary.
|
|
26
|
-
* This method is called by Pregel for all channels at the end of each step.
|
|
27
|
-
* If there are no updates, it is called with an empty sequence.
|
|
28
|
-
*
|
|
29
|
-
* Raises InvalidUpdateError if the sequence of updates is invalid.
|
|
30
|
-
* Returns True if the channel was updated, False otherwise.
|
|
31
|
-
*
|
|
32
|
-
* @throws {InvalidUpdateError} if the sequence of updates is invalid.
|
|
33
|
-
* @param {Array<UpdateType>} values
|
|
34
|
-
* @returns {void}
|
|
35
|
-
*/
|
|
36
|
-
abstract update(values: UpdateType[]): boolean;
|
|
37
|
-
/**
|
|
38
|
-
* Return the current value of the channel.
|
|
39
|
-
*
|
|
40
|
-
* @throws {EmptyChannelError} if the channel is empty (never updated yet).
|
|
41
|
-
* @returns {ValueType}
|
|
42
|
-
*/
|
|
43
|
-
abstract get(): ValueType;
|
|
44
|
-
/**
|
|
45
|
-
* Return a string representation of the channel's current state.
|
|
46
|
-
*
|
|
47
|
-
* @throws {EmptyChannelError} if the channel is empty (never updated yet), or doesn't support checkpoints.
|
|
48
|
-
* @returns {CheckpointType | undefined}
|
|
49
|
-
*/
|
|
50
|
-
abstract checkpoint(): CheckpointType | undefined;
|
|
51
|
-
/**
|
|
52
|
-
* Mark the current value of the channel as consumed. By default, no-op.
|
|
53
|
-
* A channel can use this method to modify its state, preventing the value
|
|
54
|
-
* from being consumed again.
|
|
55
|
-
*
|
|
56
|
-
* Returns True if the channel was updated, False otherwise.
|
|
57
|
-
*/
|
|
58
|
-
consume(): boolean;
|
|
59
|
-
/**
|
|
60
|
-
* Notify the channel that the Pregel run is finishing. By default, no-op.
|
|
61
|
-
* A channel can use this method to modify its state, preventing finish.
|
|
62
|
-
*
|
|
63
|
-
* Returns True if the channel was updated, False otherwise.
|
|
64
|
-
*/
|
|
65
|
-
finish(): boolean;
|
|
66
|
-
/**
|
|
67
|
-
* Return True if the channel is available (not empty), False otherwise.
|
|
68
|
-
* Subclasses should override this method to provide a more efficient
|
|
69
|
-
* implementation than calling get() and catching EmptyChannelError.
|
|
70
|
-
*/
|
|
71
|
-
isAvailable(): boolean;
|
|
72
|
-
}
|
|
73
|
-
declare function emptyChannels<Cc extends Record<string, BaseChannel>>(channels: Cc, checkpoint: ReadonlyCheckpoint): Cc;
|
|
74
|
-
declare function createCheckpoint<ValueType>(checkpoint: ReadonlyCheckpoint, channels: Record<string, BaseChannel<ValueType>> | undefined, step: number, options?: {
|
|
75
|
-
id?: string;
|
|
76
|
-
}): Checkpoint;
|
|
77
|
-
//#endregion
|
|
78
|
-
export { BaseChannel, createCheckpoint, emptyChannels };
|
|
79
|
-
//# sourceMappingURL=base.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.cts","names":["ReadonlyCheckpoint","Checkpoint","isBaseChannel","BaseChannel","ValueType","UpdateType","CheckpointType","getOnlyChannels","Record","emptyChannels","Cc","createCheckpoint"],"sources":["../../src/channels/base.d.ts"],"sourcesContent":["import { ReadonlyCheckpoint, Checkpoint } from \"@langchain/langgraph-checkpoint\";\nexport declare function isBaseChannel(obj: unknown): obj is BaseChannel;\n/** @internal */\nexport declare abstract class BaseChannel<ValueType = unknown, UpdateType = unknown, CheckpointType = unknown> {\n ValueType: ValueType;\n UpdateType: UpdateType;\n /**\n * The name of the channel.\n */\n abstract lc_graph_name: string;\n /** @ignore */\n lg_is_channel: boolean;\n /**\n * Return a new identical channel, optionally initialized from a checkpoint.\n * Can be thought of as a \"restoration\" from a checkpoint which is a \"snapshot\" of the channel's state.\n *\n * @param {CheckpointType | undefined} checkpoint\n * @param {CheckpointType | undefined} initialValue\n * @returns {this}\n */\n abstract fromCheckpoint(checkpoint?: CheckpointType): this;\n /**\n * Update the channel's value with the given sequence of updates.\n * The order of the updates in the sequence is arbitrary.\n * This method is called by Pregel for all channels at the end of each step.\n * If there are no updates, it is called with an empty sequence.\n *\n * Raises InvalidUpdateError if the sequence of updates is invalid.\n * Returns True if the channel was updated, False otherwise.\n *\n * @throws {InvalidUpdateError} if the sequence of updates is invalid.\n * @param {Array<UpdateType>} values\n * @returns {void}\n */\n abstract update(values: UpdateType[]): boolean;\n /**\n * Return the current value of the channel.\n *\n * @throws {EmptyChannelError} if the channel is empty (never updated yet).\n * @returns {ValueType}\n */\n abstract get(): ValueType;\n /**\n * Return a string representation of the channel's current state.\n *\n * @throws {EmptyChannelError} if the channel is empty (never updated yet), or doesn't support checkpoints.\n * @returns {CheckpointType | undefined}\n */\n abstract checkpoint(): CheckpointType | undefined;\n /**\n * Mark the current value of the channel as consumed. By default, no-op.\n * A channel can use this method to modify its state, preventing the value\n * from being consumed again.\n *\n * Returns True if the channel was updated, False otherwise.\n */\n consume(): boolean;\n /**\n * Notify the channel that the Pregel run is finishing. By default, no-op.\n * A channel can use this method to modify its state, preventing finish.\n *\n * Returns True if the channel was updated, False otherwise.\n */\n finish(): boolean;\n /**\n * Return True if the channel is available (not empty), False otherwise.\n * Subclasses should override this method to provide a more efficient\n * implementation than calling get() and catching EmptyChannelError.\n */\n isAvailable(): boolean;\n}\nexport declare function getOnlyChannels(channels: Record<string, BaseChannel>): Record<string, BaseChannel>;\nexport declare function emptyChannels<Cc extends Record<string, BaseChannel>>(channels: Cc, checkpoint: ReadonlyCheckpoint): Cc;\nexport declare function createCheckpoint<ValueType>(checkpoint: ReadonlyCheckpoint, channels: Record<string, BaseChannel<ValueType>> | undefined, step: number, options?: {\n id?: string;\n}): Checkpoint;\n"],"mappings":";;;;AAG8BG,uBAAAA,WAAW,CAAA,YAAA,OAAA,EAAA,aAAA,OAAA,EAAA,iBAAA,OAAA,CAAA,CAAA;EAAA,SAAA,EAC1BC,SAD0B;YAC1BA,EACCC,UADDD;;;;WAqCKA,aAAAA,EAAAA,MAAAA;;;EA+BIK;;;;;;;;EACAE,SAAAA,cAAgB,CAAA,UAAA,CAAA,EArDCL,cAqDD,CAAA,EAAA,IAAA;EAAA;;;;;;;;;;;;;0BAvCZD;;;;;;;kBAORD;;;;;;;yBAOOE;;;;;;;;;;;;;;;;;;;;;;;iBAwBHG,yBAAyBD,eAAeL,wBAAwBO,gBAAgBV,qBAAqBU;iBACrGC,wCAAwCX,8BAA8BQ,eAAeL,YAAYC;;IAErHH"}
|
package/dist/channels/base.d.ts
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { Checkpoint, ReadonlyCheckpoint } from "@langchain/langgraph-checkpoint";
|
|
2
|
-
|
|
3
|
-
//#region src/channels/base.d.ts
|
|
4
|
-
/** @internal */
|
|
5
|
-
declare abstract class BaseChannel<ValueType = unknown, UpdateType = unknown, CheckpointType = unknown> {
|
|
6
|
-
ValueType: ValueType;
|
|
7
|
-
UpdateType: UpdateType;
|
|
8
|
-
/**
|
|
9
|
-
* The name of the channel.
|
|
10
|
-
*/
|
|
11
|
-
abstract lc_graph_name: string;
|
|
12
|
-
/** @ignore */
|
|
13
|
-
lg_is_channel: boolean;
|
|
14
|
-
/**
|
|
15
|
-
* Return a new identical channel, optionally initialized from a checkpoint.
|
|
16
|
-
* Can be thought of as a "restoration" from a checkpoint which is a "snapshot" of the channel's state.
|
|
17
|
-
*
|
|
18
|
-
* @param {CheckpointType | undefined} checkpoint
|
|
19
|
-
* @param {CheckpointType | undefined} initialValue
|
|
20
|
-
* @returns {this}
|
|
21
|
-
*/
|
|
22
|
-
abstract fromCheckpoint(checkpoint?: CheckpointType): this;
|
|
23
|
-
/**
|
|
24
|
-
* Update the channel's value with the given sequence of updates.
|
|
25
|
-
* The order of the updates in the sequence is arbitrary.
|
|
26
|
-
* This method is called by Pregel for all channels at the end of each step.
|
|
27
|
-
* If there are no updates, it is called with an empty sequence.
|
|
28
|
-
*
|
|
29
|
-
* Raises InvalidUpdateError if the sequence of updates is invalid.
|
|
30
|
-
* Returns True if the channel was updated, False otherwise.
|
|
31
|
-
*
|
|
32
|
-
* @throws {InvalidUpdateError} if the sequence of updates is invalid.
|
|
33
|
-
* @param {Array<UpdateType>} values
|
|
34
|
-
* @returns {void}
|
|
35
|
-
*/
|
|
36
|
-
abstract update(values: UpdateType[]): boolean;
|
|
37
|
-
/**
|
|
38
|
-
* Return the current value of the channel.
|
|
39
|
-
*
|
|
40
|
-
* @throws {EmptyChannelError} if the channel is empty (never updated yet).
|
|
41
|
-
* @returns {ValueType}
|
|
42
|
-
*/
|
|
43
|
-
abstract get(): ValueType;
|
|
44
|
-
/**
|
|
45
|
-
* Return a string representation of the channel's current state.
|
|
46
|
-
*
|
|
47
|
-
* @throws {EmptyChannelError} if the channel is empty (never updated yet), or doesn't support checkpoints.
|
|
48
|
-
* @returns {CheckpointType | undefined}
|
|
49
|
-
*/
|
|
50
|
-
abstract checkpoint(): CheckpointType | undefined;
|
|
51
|
-
/**
|
|
52
|
-
* Mark the current value of the channel as consumed. By default, no-op.
|
|
53
|
-
* A channel can use this method to modify its state, preventing the value
|
|
54
|
-
* from being consumed again.
|
|
55
|
-
*
|
|
56
|
-
* Returns True if the channel was updated, False otherwise.
|
|
57
|
-
*/
|
|
58
|
-
consume(): boolean;
|
|
59
|
-
/**
|
|
60
|
-
* Notify the channel that the Pregel run is finishing. By default, no-op.
|
|
61
|
-
* A channel can use this method to modify its state, preventing finish.
|
|
62
|
-
*
|
|
63
|
-
* Returns True if the channel was updated, False otherwise.
|
|
64
|
-
*/
|
|
65
|
-
finish(): boolean;
|
|
66
|
-
/**
|
|
67
|
-
* Return True if the channel is available (not empty), False otherwise.
|
|
68
|
-
* Subclasses should override this method to provide a more efficient
|
|
69
|
-
* implementation than calling get() and catching EmptyChannelError.
|
|
70
|
-
*/
|
|
71
|
-
isAvailable(): boolean;
|
|
72
|
-
}
|
|
73
|
-
declare function emptyChannels<Cc extends Record<string, BaseChannel>>(channels: Cc, checkpoint: ReadonlyCheckpoint): Cc;
|
|
74
|
-
declare function createCheckpoint<ValueType>(checkpoint: ReadonlyCheckpoint, channels: Record<string, BaseChannel<ValueType>> | undefined, step: number, options?: {
|
|
75
|
-
id?: string;
|
|
76
|
-
}): Checkpoint;
|
|
77
|
-
//#endregion
|
|
78
|
-
export { BaseChannel, createCheckpoint, emptyChannels };
|
|
79
|
-
//# sourceMappingURL=base.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","names":["ReadonlyCheckpoint","Checkpoint","isBaseChannel","BaseChannel","ValueType","UpdateType","CheckpointType","getOnlyChannels","Record","emptyChannels","Cc","createCheckpoint"],"sources":["../../src/channels/base.d.ts"],"sourcesContent":["import { ReadonlyCheckpoint, Checkpoint } from \"@langchain/langgraph-checkpoint\";\nexport declare function isBaseChannel(obj: unknown): obj is BaseChannel;\n/** @internal */\nexport declare abstract class BaseChannel<ValueType = unknown, UpdateType = unknown, CheckpointType = unknown> {\n ValueType: ValueType;\n UpdateType: UpdateType;\n /**\n * The name of the channel.\n */\n abstract lc_graph_name: string;\n /** @ignore */\n lg_is_channel: boolean;\n /**\n * Return a new identical channel, optionally initialized from a checkpoint.\n * Can be thought of as a \"restoration\" from a checkpoint which is a \"snapshot\" of the channel's state.\n *\n * @param {CheckpointType | undefined} checkpoint\n * @param {CheckpointType | undefined} initialValue\n * @returns {this}\n */\n abstract fromCheckpoint(checkpoint?: CheckpointType): this;\n /**\n * Update the channel's value with the given sequence of updates.\n * The order of the updates in the sequence is arbitrary.\n * This method is called by Pregel for all channels at the end of each step.\n * If there are no updates, it is called with an empty sequence.\n *\n * Raises InvalidUpdateError if the sequence of updates is invalid.\n * Returns True if the channel was updated, False otherwise.\n *\n * @throws {InvalidUpdateError} if the sequence of updates is invalid.\n * @param {Array<UpdateType>} values\n * @returns {void}\n */\n abstract update(values: UpdateType[]): boolean;\n /**\n * Return the current value of the channel.\n *\n * @throws {EmptyChannelError} if the channel is empty (never updated yet).\n * @returns {ValueType}\n */\n abstract get(): ValueType;\n /**\n * Return a string representation of the channel's current state.\n *\n * @throws {EmptyChannelError} if the channel is empty (never updated yet), or doesn't support checkpoints.\n * @returns {CheckpointType | undefined}\n */\n abstract checkpoint(): CheckpointType | undefined;\n /**\n * Mark the current value of the channel as consumed. By default, no-op.\n * A channel can use this method to modify its state, preventing the value\n * from being consumed again.\n *\n * Returns True if the channel was updated, False otherwise.\n */\n consume(): boolean;\n /**\n * Notify the channel that the Pregel run is finishing. By default, no-op.\n * A channel can use this method to modify its state, preventing finish.\n *\n * Returns True if the channel was updated, False otherwise.\n */\n finish(): boolean;\n /**\n * Return True if the channel is available (not empty), False otherwise.\n * Subclasses should override this method to provide a more efficient\n * implementation than calling get() and catching EmptyChannelError.\n */\n isAvailable(): boolean;\n}\nexport declare function getOnlyChannels(channels: Record<string, BaseChannel>): Record<string, BaseChannel>;\nexport declare function emptyChannels<Cc extends Record<string, BaseChannel>>(channels: Cc, checkpoint: ReadonlyCheckpoint): Cc;\nexport declare function createCheckpoint<ValueType>(checkpoint: ReadonlyCheckpoint, channels: Record<string, BaseChannel<ValueType>> | undefined, step: number, options?: {\n id?: string;\n}): Checkpoint;\n"],"mappings":";;;;AAG8BG,uBAAAA,WAAW,CAAA,YAAA,OAAA,EAAA,aAAA,OAAA,EAAA,iBAAA,OAAA,CAAA,CAAA;EAAA,SAAA,EAC1BC,SAD0B;YAC1BA,EACCC,UADDD;;;;WAqCKA,aAAAA,EAAAA,MAAAA;;;EA+BIK;;;;;;;;EACAE,SAAAA,cAAgB,CAAA,UAAA,CAAA,EArDCL,cAqDD,CAAA,EAAA,IAAA;EAAA;;;;;;;;;;;;;0BAvCZD;;;;;;;kBAORD;;;;;;;yBAOOE;;;;;;;;;;;;;;;;;;;;;;;iBAwBHG,yBAAyBD,eAAeL,wBAAwBO,gBAAgBV,qBAAqBU;iBACrGC,wCAAwCX,8BAA8BQ,eAAeL,YAAYC;;IAErHH"}
|
package/dist/channels/base.js
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { EmptyChannelError } from "../errors.js";
|
|
2
|
-
import { uuid6 } from "@langchain/langgraph-checkpoint";
|
|
3
|
-
|
|
4
|
-
//#region src/channels/base.ts
|
|
5
|
-
function isBaseChannel(obj) {
|
|
6
|
-
return obj != null && obj.lg_is_channel === true;
|
|
7
|
-
}
|
|
8
|
-
/** @internal */
|
|
9
|
-
var BaseChannel = class {
|
|
10
|
-
ValueType;
|
|
11
|
-
UpdateType;
|
|
12
|
-
/** @ignore */
|
|
13
|
-
lg_is_channel = true;
|
|
14
|
-
/**
|
|
15
|
-
* Mark the current value of the channel as consumed. By default, no-op.
|
|
16
|
-
* A channel can use this method to modify its state, preventing the value
|
|
17
|
-
* from being consumed again.
|
|
18
|
-
*
|
|
19
|
-
* Returns True if the channel was updated, False otherwise.
|
|
20
|
-
*/
|
|
21
|
-
consume() {
|
|
22
|
-
return false;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Notify the channel that the Pregel run is finishing. By default, no-op.
|
|
26
|
-
* A channel can use this method to modify its state, preventing finish.
|
|
27
|
-
*
|
|
28
|
-
* Returns True if the channel was updated, False otherwise.
|
|
29
|
-
*/
|
|
30
|
-
finish() {
|
|
31
|
-
return false;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Return True if the channel is available (not empty), False otherwise.
|
|
35
|
-
* Subclasses should override this method to provide a more efficient
|
|
36
|
-
* implementation than calling get() and catching EmptyChannelError.
|
|
37
|
-
*/
|
|
38
|
-
isAvailable() {
|
|
39
|
-
try {
|
|
40
|
-
this.get();
|
|
41
|
-
return true;
|
|
42
|
-
} catch (error) {
|
|
43
|
-
if (error.name === EmptyChannelError.unminifiable_name) return false;
|
|
44
|
-
throw error;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
const IS_ONLY_BASE_CHANNEL = Symbol.for("LG_IS_ONLY_BASE_CHANNEL");
|
|
49
|
-
function getOnlyChannels(channels) {
|
|
50
|
-
if (channels[IS_ONLY_BASE_CHANNEL] === true) return channels;
|
|
51
|
-
const newChannels = {};
|
|
52
|
-
for (const k in channels) {
|
|
53
|
-
if (!Object.prototype.hasOwnProperty.call(channels, k)) continue;
|
|
54
|
-
const value = channels[k];
|
|
55
|
-
if (isBaseChannel(value)) newChannels[k] = value;
|
|
56
|
-
}
|
|
57
|
-
Object.assign(newChannels, { [IS_ONLY_BASE_CHANNEL]: true });
|
|
58
|
-
return newChannels;
|
|
59
|
-
}
|
|
60
|
-
function emptyChannels(channels, checkpoint) {
|
|
61
|
-
const filteredChannels = getOnlyChannels(channels);
|
|
62
|
-
const newChannels = {};
|
|
63
|
-
for (const k in filteredChannels) {
|
|
64
|
-
if (!Object.prototype.hasOwnProperty.call(filteredChannels, k)) continue;
|
|
65
|
-
const channelValue = checkpoint.channel_values[k];
|
|
66
|
-
newChannels[k] = filteredChannels[k].fromCheckpoint(channelValue);
|
|
67
|
-
}
|
|
68
|
-
Object.assign(newChannels, { [IS_ONLY_BASE_CHANNEL]: true });
|
|
69
|
-
return newChannels;
|
|
70
|
-
}
|
|
71
|
-
function createCheckpoint(checkpoint, channels, step, options) {
|
|
72
|
-
let values;
|
|
73
|
-
if (channels === void 0) values = checkpoint.channel_values;
|
|
74
|
-
else {
|
|
75
|
-
values = {};
|
|
76
|
-
for (const k in channels) {
|
|
77
|
-
if (!Object.prototype.hasOwnProperty.call(channels, k)) continue;
|
|
78
|
-
try {
|
|
79
|
-
values[k] = channels[k].checkpoint();
|
|
80
|
-
} catch (error) {
|
|
81
|
-
if (error.name === EmptyChannelError.unminifiable_name) {} else throw error;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
return {
|
|
86
|
-
v: 4,
|
|
87
|
-
id: options?.id ?? uuid6(step),
|
|
88
|
-
ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
89
|
-
channel_values: values,
|
|
90
|
-
channel_versions: checkpoint.channel_versions,
|
|
91
|
-
versions_seen: checkpoint.versions_seen
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
//#endregion
|
|
96
|
-
export { BaseChannel, createCheckpoint, emptyChannels, getOnlyChannels, isBaseChannel };
|
|
97
|
-
//# sourceMappingURL=base.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","names":["error: any","values: Record<string, any>"],"sources":["../../src/channels/base.ts"],"sourcesContent":["import {\n ReadonlyCheckpoint,\n uuid6,\n Checkpoint,\n} from \"@langchain/langgraph-checkpoint\";\nimport { EmptyChannelError } from \"../errors.js\";\n\nexport function isBaseChannel(obj: unknown): obj is BaseChannel {\n return obj != null && (obj as BaseChannel).lg_is_channel === true;\n}\n\n/** @internal */\nexport abstract class BaseChannel<\n ValueType = unknown,\n UpdateType = unknown,\n CheckpointType = unknown\n> {\n ValueType: ValueType;\n\n UpdateType: UpdateType;\n\n /**\n * The name of the channel.\n */\n abstract lc_graph_name: string;\n\n /** @ignore */\n lg_is_channel = true;\n\n /**\n * Return a new identical channel, optionally initialized from a checkpoint.\n * Can be thought of as a \"restoration\" from a checkpoint which is a \"snapshot\" of the channel's state.\n *\n * @param {CheckpointType | undefined} checkpoint\n * @param {CheckpointType | undefined} initialValue\n * @returns {this}\n */\n abstract fromCheckpoint(checkpoint?: CheckpointType): this;\n\n /**\n * Update the channel's value with the given sequence of updates.\n * The order of the updates in the sequence is arbitrary.\n * This method is called by Pregel for all channels at the end of each step.\n * If there are no updates, it is called with an empty sequence.\n *\n * Raises InvalidUpdateError if the sequence of updates is invalid.\n * Returns True if the channel was updated, False otherwise.\n *\n * @throws {InvalidUpdateError} if the sequence of updates is invalid.\n * @param {Array<UpdateType>} values\n * @returns {void}\n */\n abstract update(values: UpdateType[]): boolean;\n\n /**\n * Return the current value of the channel.\n *\n * @throws {EmptyChannelError} if the channel is empty (never updated yet).\n * @returns {ValueType}\n */\n abstract get(): ValueType;\n\n /**\n * Return a string representation of the channel's current state.\n *\n * @throws {EmptyChannelError} if the channel is empty (never updated yet), or doesn't support checkpoints.\n * @returns {CheckpointType | undefined}\n */\n abstract checkpoint(): CheckpointType | undefined;\n\n /**\n * Mark the current value of the channel as consumed. By default, no-op.\n * A channel can use this method to modify its state, preventing the value\n * from being consumed again.\n *\n * Returns True if the channel was updated, False otherwise.\n */\n consume(): boolean {\n return false;\n }\n\n /**\n * Notify the channel that the Pregel run is finishing. By default, no-op.\n * A channel can use this method to modify its state, preventing finish.\n *\n * Returns True if the channel was updated, False otherwise.\n */\n finish(): boolean {\n return false;\n }\n\n /**\n * Return True if the channel is available (not empty), False otherwise.\n * Subclasses should override this method to provide a more efficient\n * implementation than calling get() and catching EmptyChannelError.\n */\n isAvailable(): boolean {\n try {\n this.get();\n return true;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n if (error.name === EmptyChannelError.unminifiable_name) {\n return false;\n }\n throw error;\n }\n }\n}\n\nconst IS_ONLY_BASE_CHANNEL = Symbol.for(\"LG_IS_ONLY_BASE_CHANNEL\");\nexport function getOnlyChannels(\n channels: Record<string, BaseChannel>\n): Record<string, BaseChannel> {\n // @ts-expect-error - we know it's a record of base channels\n if (channels[IS_ONLY_BASE_CHANNEL] === true) return channels;\n\n const newChannels = {} as Record<string, BaseChannel>;\n for (const k in channels) {\n if (!Object.prototype.hasOwnProperty.call(channels, k)) continue;\n const value = channels[k];\n if (isBaseChannel(value)) newChannels[k] = value;\n }\n\n Object.assign(newChannels, { [IS_ONLY_BASE_CHANNEL]: true });\n return newChannels;\n}\n\nexport function emptyChannels<Cc extends Record<string, BaseChannel>>(\n channels: Cc,\n checkpoint: ReadonlyCheckpoint\n): Cc {\n const filteredChannels = getOnlyChannels(channels) as Cc;\n\n const newChannels = {} as Cc;\n for (const k in filteredChannels) {\n if (!Object.prototype.hasOwnProperty.call(filteredChannels, k)) continue;\n const channelValue = checkpoint.channel_values[k];\n newChannels[k] = filteredChannels[k].fromCheckpoint(channelValue);\n }\n Object.assign(newChannels, { [IS_ONLY_BASE_CHANNEL]: true });\n return newChannels;\n}\n\nexport function createCheckpoint<ValueType>(\n checkpoint: ReadonlyCheckpoint,\n channels: Record<string, BaseChannel<ValueType>> | undefined,\n step: number,\n options?: { id?: string }\n): Checkpoint {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let values: Record<string, any>;\n if (channels === undefined) {\n values = checkpoint.channel_values;\n } else {\n values = {};\n for (const k in channels) {\n if (!Object.prototype.hasOwnProperty.call(channels, k)) continue;\n try {\n values[k] = channels[k].checkpoint();\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n if (error.name === EmptyChannelError.unminifiable_name) {\n // no-op\n } else {\n throw error; // Rethrow unexpected errors\n }\n }\n }\n }\n\n return {\n v: 4,\n id: options?.id ?? uuid6(step),\n ts: new Date().toISOString(),\n channel_values: values,\n channel_versions: checkpoint.channel_versions,\n versions_seen: checkpoint.versions_seen,\n };\n}\n"],"mappings":";;;;AAOA,SAAgB,cAAc,KAAkC;AAC9D,QAAO,OAAO,QAAS,IAAoB,kBAAkB;;;AAI/D,IAAsB,cAAtB,MAIE;CACA;CAEA;;CAQA,gBAAgB;;;;;;;;CAkDhB,UAAmB;AACjB,SAAO;;;;;;;;CAST,SAAkB;AAChB,SAAO;;;;;;;CAQT,cAAuB;AACrB,MAAI;AACF,QAAK;AACL,UAAO;WAEAA,OAAY;AACnB,OAAI,MAAM,SAAS,kBAAkB,kBACnC,QAAO;AAET,SAAM;;;;AAKZ,MAAM,uBAAuB,OAAO,IAAI;AACxC,SAAgB,gBACd,UAC6B;AAE7B,KAAI,SAAS,0BAA0B,KAAM,QAAO;CAEpD,MAAM,cAAc;AACpB,MAAK,MAAM,KAAK,UAAU;AACxB,MAAI,CAAC,OAAO,UAAU,eAAe,KAAK,UAAU,GAAI;EACxD,MAAM,QAAQ,SAAS;AACvB,MAAI,cAAc,OAAQ,aAAY,KAAK;;AAG7C,QAAO,OAAO,aAAa,GAAG,uBAAuB;AACrD,QAAO;;AAGT,SAAgB,cACd,UACA,YACI;CACJ,MAAM,mBAAmB,gBAAgB;CAEzC,MAAM,cAAc;AACpB,MAAK,MAAM,KAAK,kBAAkB;AAChC,MAAI,CAAC,OAAO,UAAU,eAAe,KAAK,kBAAkB,GAAI;EAChE,MAAM,eAAe,WAAW,eAAe;AAC/C,cAAY,KAAK,iBAAiB,GAAG,eAAe;;AAEtD,QAAO,OAAO,aAAa,GAAG,uBAAuB;AACrD,QAAO;;AAGT,SAAgB,iBACd,YACA,UACA,MACA,SACY;CAEZ,IAAIC;AACJ,KAAI,aAAa,OACf,UAAS,WAAW;MACf;AACL,WAAS;AACT,OAAK,MAAM,KAAK,UAAU;AACxB,OAAI,CAAC,OAAO,UAAU,eAAe,KAAK,UAAU,GAAI;AACxD,OAAI;AACF,WAAO,KAAK,SAAS,GAAG;YAEjBD,OAAY;AACnB,QAAI,MAAM,SAAS,kBAAkB,mBAAmB,OAGtD,OAAM;;;;AAMd,QAAO;EACL,GAAG;EACH,IAAI,SAAS,MAAM,MAAM;EACzB,qBAAI,IAAI,QAAO;EACf,gBAAgB;EAChB,kBAAkB,WAAW;EAC7B,eAAe,WAAW"}
|
package/dist/channels/binop.cjs
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
const require_errors = require('../errors.cjs');
|
|
2
|
-
const require_base = require('./base.cjs');
|
|
3
|
-
|
|
4
|
-
//#region src/channels/binop.ts
|
|
5
|
-
/**
|
|
6
|
-
* Stores the result of applying a binary operator to the current value and each new value.
|
|
7
|
-
*/
|
|
8
|
-
var BinaryOperatorAggregate = class BinaryOperatorAggregate extends require_base.BaseChannel {
|
|
9
|
-
lc_graph_name = "BinaryOperatorAggregate";
|
|
10
|
-
value;
|
|
11
|
-
operator;
|
|
12
|
-
initialValueFactory;
|
|
13
|
-
constructor(operator, initialValueFactory) {
|
|
14
|
-
super();
|
|
15
|
-
this.operator = operator;
|
|
16
|
-
this.initialValueFactory = initialValueFactory;
|
|
17
|
-
this.value = initialValueFactory?.();
|
|
18
|
-
}
|
|
19
|
-
fromCheckpoint(checkpoint) {
|
|
20
|
-
const empty = new BinaryOperatorAggregate(this.operator, this.initialValueFactory);
|
|
21
|
-
if (typeof checkpoint !== "undefined") empty.value = checkpoint;
|
|
22
|
-
return empty;
|
|
23
|
-
}
|
|
24
|
-
update(values) {
|
|
25
|
-
let newValues = values;
|
|
26
|
-
if (!newValues.length) return false;
|
|
27
|
-
if (this.value === void 0) {
|
|
28
|
-
[this.value] = newValues;
|
|
29
|
-
newValues = newValues.slice(1);
|
|
30
|
-
}
|
|
31
|
-
for (const value of newValues) if (this.value !== void 0) this.value = this.operator(this.value, value);
|
|
32
|
-
return true;
|
|
33
|
-
}
|
|
34
|
-
get() {
|
|
35
|
-
if (this.value === void 0) throw new require_errors.EmptyChannelError();
|
|
36
|
-
return this.value;
|
|
37
|
-
}
|
|
38
|
-
checkpoint() {
|
|
39
|
-
if (this.value === void 0) throw new require_errors.EmptyChannelError();
|
|
40
|
-
return this.value;
|
|
41
|
-
}
|
|
42
|
-
isAvailable() {
|
|
43
|
-
return this.value !== void 0;
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
//#endregion
|
|
48
|
-
exports.BinaryOperatorAggregate = BinaryOperatorAggregate;
|
|
49
|
-
//# sourceMappingURL=binop.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"binop.cjs","names":["BaseChannel","EmptyChannelError"],"sources":["../../src/channels/binop.ts"],"sourcesContent":["import { EmptyChannelError } from \"../errors.js\";\nimport { BaseChannel } from \"./base.js\";\n\nexport type BinaryOperator<ValueType, UpdateType> = (\n a: ValueType,\n b: UpdateType\n) => ValueType;\n\n/**\n * Stores the result of applying a binary operator to the current value and each new value.\n */\nexport class BinaryOperatorAggregate<\n ValueType,\n UpdateType = ValueType\n> extends BaseChannel<ValueType, UpdateType, ValueType> {\n lc_graph_name = \"BinaryOperatorAggregate\";\n\n value: ValueType | undefined;\n\n operator: BinaryOperator<ValueType, UpdateType>;\n\n initialValueFactory?: () => ValueType;\n\n constructor(\n operator: BinaryOperator<ValueType, UpdateType>,\n initialValueFactory?: () => ValueType\n ) {\n super();\n\n this.operator = operator;\n this.initialValueFactory = initialValueFactory;\n this.value = initialValueFactory?.();\n }\n\n public fromCheckpoint(checkpoint?: ValueType) {\n const empty = new BinaryOperatorAggregate(\n this.operator,\n this.initialValueFactory\n );\n if (typeof checkpoint !== \"undefined\") {\n empty.value = checkpoint;\n }\n return empty as this;\n }\n\n public update(values: UpdateType[]): boolean {\n let newValues = values;\n if (!newValues.length) return false;\n\n if (this.value === undefined) {\n [this.value as UpdateType] = newValues;\n newValues = newValues.slice(1);\n }\n\n for (const value of newValues) {\n if (this.value !== undefined) {\n this.value = this.operator(this.value, value);\n }\n }\n return true;\n }\n\n public get(): ValueType {\n if (this.value === undefined) {\n throw new EmptyChannelError();\n }\n return this.value;\n }\n\n public checkpoint(): ValueType {\n if (this.value === undefined) {\n throw new EmptyChannelError();\n }\n return this.value;\n }\n\n isAvailable(): boolean {\n return this.value !== undefined;\n }\n}\n"],"mappings":";;;;;;;AAWA,IAAa,0BAAb,MAAa,gCAGHA,yBAA8C;CACtD,gBAAgB;CAEhB;CAEA;CAEA;CAEA,YACE,UACA,qBACA;AACA;AAEA,OAAK,WAAW;AAChB,OAAK,sBAAsB;AAC3B,OAAK,QAAQ;;CAGf,AAAO,eAAe,YAAwB;EAC5C,MAAM,QAAQ,IAAI,wBAChB,KAAK,UACL,KAAK;AAEP,MAAI,OAAO,eAAe,YACxB,OAAM,QAAQ;AAEhB,SAAO;;CAGT,AAAO,OAAO,QAA+B;EAC3C,IAAI,YAAY;AAChB,MAAI,CAAC,UAAU,OAAQ,QAAO;AAE9B,MAAI,KAAK,UAAU,QAAW;AAC5B,IAAC,KAAK,SAAuB;AAC7B,eAAY,UAAU,MAAM;;AAG9B,OAAK,MAAM,SAAS,UAClB,KAAI,KAAK,UAAU,OACjB,MAAK,QAAQ,KAAK,SAAS,KAAK,OAAO;AAG3C,SAAO;;CAGT,AAAO,MAAiB;AACtB,MAAI,KAAK,UAAU,OACjB,OAAM,IAAIC;AAEZ,SAAO,KAAK;;CAGd,AAAO,aAAwB;AAC7B,MAAI,KAAK,UAAU,OACjB,OAAM,IAAIA;AAEZ,SAAO,KAAK;;CAGd,cAAuB;AACrB,SAAO,KAAK,UAAU"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { BaseChannel } from "./base.cjs";
|
|
2
|
-
|
|
3
|
-
//#region src/channels/binop.d.ts
|
|
4
|
-
type BinaryOperator<ValueType, UpdateType> = (a: ValueType, b: UpdateType) => ValueType;
|
|
5
|
-
/**
|
|
6
|
-
* Stores the result of applying a binary operator to the current value and each new value.
|
|
7
|
-
*/
|
|
8
|
-
declare class BinaryOperatorAggregate<ValueType, UpdateType = ValueType> extends BaseChannel<ValueType, UpdateType, ValueType> {
|
|
9
|
-
lc_graph_name: string;
|
|
10
|
-
value: ValueType | undefined;
|
|
11
|
-
operator: BinaryOperator<ValueType, UpdateType>;
|
|
12
|
-
initialValueFactory?: () => ValueType;
|
|
13
|
-
constructor(operator: BinaryOperator<ValueType, UpdateType>, initialValueFactory?: () => ValueType);
|
|
14
|
-
fromCheckpoint(checkpoint?: ValueType): this;
|
|
15
|
-
update(values: UpdateType[]): boolean;
|
|
16
|
-
get(): ValueType;
|
|
17
|
-
checkpoint(): ValueType;
|
|
18
|
-
isAvailable(): boolean;
|
|
19
|
-
}
|
|
20
|
-
//#endregion
|
|
21
|
-
export { BinaryOperator, BinaryOperatorAggregate };
|
|
22
|
-
//# sourceMappingURL=binop.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"binop.d.cts","names":["BaseChannel","BinaryOperator","ValueType","UpdateType","BinaryOperatorAggregate"],"sources":["../../src/channels/binop.d.ts"],"sourcesContent":["import { BaseChannel } from \"./base.js\";\nexport type BinaryOperator<ValueType, UpdateType> = (a: ValueType, b: UpdateType) => ValueType;\n/**\n * Stores the result of applying a binary operator to the current value and each new value.\n */\nexport declare class BinaryOperatorAggregate<ValueType, UpdateType = ValueType> extends BaseChannel<ValueType, UpdateType, ValueType> {\n lc_graph_name: string;\n value: ValueType | undefined;\n operator: BinaryOperator<ValueType, UpdateType>;\n initialValueFactory?: () => ValueType;\n constructor(operator: BinaryOperator<ValueType, UpdateType>, initialValueFactory?: () => ValueType);\n fromCheckpoint(checkpoint?: ValueType): this;\n update(values: UpdateType[]): boolean;\n get(): ValueType;\n checkpoint(): ValueType;\n isAvailable(): boolean;\n}\n"],"mappings":";;;KACYC,4CAA4CC,cAAcC,eAAeD;;AAArF;;AAAwDA,cAInCE,uBAJmCF,CAAAA,SAAAA,EAAAA,aAIaA,SAJbA,CAAAA,SAIgCF,WAJhCE,CAI4CA,SAJ5CA,EAIuDC,UAJvDD,EAImEA,SAJnEA,CAAAA,CAAAA;eAAcC,EAAAA,MAAAA;OAAeD,EAM1EA,SAN0EA,GAAAA,SAAAA;YAOvED,eAAeC,WAAWC;EAHnBC,mBAAAA,CAAAA,EAAAA,GAAAA,GAIWF,SAJY;EAAA,WAAA,CAAA,QAAA,EAKlBD,cALkB,CAKHC,SALG,EAKQC,UALR,CAAA,EAAA,mBAAA,CAAA,EAAA,GAAA,GAKiDD,SALjD;gBAAyBA,CAAAA,UAAAA,CAAAA,EAMrCA,SANqCA,CAAAA,EAAAA,IAAAA;QAA+BA,CAAAA,MAAAA,EAOjFC,UAPiFD,EAAAA,CAAAA,EAAAA,OAAAA;KAAWC,CAAAA,CAAAA,EAQpGD,SARoGC;YAAYD,CAAAA,CAAAA,EASzGA,SATyGA;aAEhHA,CAAAA,CAAAA,EAAAA,OAAAA"}
|
package/dist/channels/binop.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { BaseChannel } from "./base.js";
|
|
2
|
-
|
|
3
|
-
//#region src/channels/binop.d.ts
|
|
4
|
-
type BinaryOperator<ValueType, UpdateType> = (a: ValueType, b: UpdateType) => ValueType;
|
|
5
|
-
/**
|
|
6
|
-
* Stores the result of applying a binary operator to the current value and each new value.
|
|
7
|
-
*/
|
|
8
|
-
declare class BinaryOperatorAggregate<ValueType, UpdateType = ValueType> extends BaseChannel<ValueType, UpdateType, ValueType> {
|
|
9
|
-
lc_graph_name: string;
|
|
10
|
-
value: ValueType | undefined;
|
|
11
|
-
operator: BinaryOperator<ValueType, UpdateType>;
|
|
12
|
-
initialValueFactory?: () => ValueType;
|
|
13
|
-
constructor(operator: BinaryOperator<ValueType, UpdateType>, initialValueFactory?: () => ValueType);
|
|
14
|
-
fromCheckpoint(checkpoint?: ValueType): this;
|
|
15
|
-
update(values: UpdateType[]): boolean;
|
|
16
|
-
get(): ValueType;
|
|
17
|
-
checkpoint(): ValueType;
|
|
18
|
-
isAvailable(): boolean;
|
|
19
|
-
}
|
|
20
|
-
//#endregion
|
|
21
|
-
export { BinaryOperator, BinaryOperatorAggregate };
|
|
22
|
-
//# sourceMappingURL=binop.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"binop.d.ts","names":["BaseChannel","BinaryOperator","ValueType","UpdateType","BinaryOperatorAggregate"],"sources":["../../src/channels/binop.d.ts"],"sourcesContent":["import { BaseChannel } from \"./base.js\";\nexport type BinaryOperator<ValueType, UpdateType> = (a: ValueType, b: UpdateType) => ValueType;\n/**\n * Stores the result of applying a binary operator to the current value and each new value.\n */\nexport declare class BinaryOperatorAggregate<ValueType, UpdateType = ValueType> extends BaseChannel<ValueType, UpdateType, ValueType> {\n lc_graph_name: string;\n value: ValueType | undefined;\n operator: BinaryOperator<ValueType, UpdateType>;\n initialValueFactory?: () => ValueType;\n constructor(operator: BinaryOperator<ValueType, UpdateType>, initialValueFactory?: () => ValueType);\n fromCheckpoint(checkpoint?: ValueType): this;\n update(values: UpdateType[]): boolean;\n get(): ValueType;\n checkpoint(): ValueType;\n isAvailable(): boolean;\n}\n"],"mappings":";;;KACYC,4CAA4CC,cAAcC,eAAeD;;AAArF;;AAAwDA,cAInCE,uBAJmCF,CAAAA,SAAAA,EAAAA,aAIaA,SAJbA,CAAAA,SAIgCF,WAJhCE,CAI4CA,SAJ5CA,EAIuDC,UAJvDD,EAImEA,SAJnEA,CAAAA,CAAAA;eAAcC,EAAAA,MAAAA;OAAeD,EAM1EA,SAN0EA,GAAAA,SAAAA;YAOvED,eAAeC,WAAWC;EAHnBC,mBAAAA,CAAAA,EAAAA,GAAAA,GAIWF,SAJY;EAAA,WAAA,CAAA,QAAA,EAKlBD,cALkB,CAKHC,SALG,EAKQC,UALR,CAAA,EAAA,mBAAA,CAAA,EAAA,GAAA,GAKiDD,SALjD;gBAAyBA,CAAAA,UAAAA,CAAAA,EAMrCA,SANqCA,CAAAA,EAAAA,IAAAA;QAA+BA,CAAAA,MAAAA,EAOjFC,UAPiFD,EAAAA,CAAAA,EAAAA,OAAAA;KAAWC,CAAAA,CAAAA,EAQpGD,SARoGC;YAAYD,CAAAA,CAAAA,EASzGA,SATyGA;aAEhHA,CAAAA,CAAAA,EAAAA,OAAAA"}
|
package/dist/channels/binop.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { EmptyChannelError } from "../errors.js";
|
|
2
|
-
import { BaseChannel } from "./base.js";
|
|
3
|
-
|
|
4
|
-
//#region src/channels/binop.ts
|
|
5
|
-
/**
|
|
6
|
-
* Stores the result of applying a binary operator to the current value and each new value.
|
|
7
|
-
*/
|
|
8
|
-
var BinaryOperatorAggregate = class BinaryOperatorAggregate extends BaseChannel {
|
|
9
|
-
lc_graph_name = "BinaryOperatorAggregate";
|
|
10
|
-
value;
|
|
11
|
-
operator;
|
|
12
|
-
initialValueFactory;
|
|
13
|
-
constructor(operator, initialValueFactory) {
|
|
14
|
-
super();
|
|
15
|
-
this.operator = operator;
|
|
16
|
-
this.initialValueFactory = initialValueFactory;
|
|
17
|
-
this.value = initialValueFactory?.();
|
|
18
|
-
}
|
|
19
|
-
fromCheckpoint(checkpoint) {
|
|
20
|
-
const empty = new BinaryOperatorAggregate(this.operator, this.initialValueFactory);
|
|
21
|
-
if (typeof checkpoint !== "undefined") empty.value = checkpoint;
|
|
22
|
-
return empty;
|
|
23
|
-
}
|
|
24
|
-
update(values) {
|
|
25
|
-
let newValues = values;
|
|
26
|
-
if (!newValues.length) return false;
|
|
27
|
-
if (this.value === void 0) {
|
|
28
|
-
[this.value] = newValues;
|
|
29
|
-
newValues = newValues.slice(1);
|
|
30
|
-
}
|
|
31
|
-
for (const value of newValues) if (this.value !== void 0) this.value = this.operator(this.value, value);
|
|
32
|
-
return true;
|
|
33
|
-
}
|
|
34
|
-
get() {
|
|
35
|
-
if (this.value === void 0) throw new EmptyChannelError();
|
|
36
|
-
return this.value;
|
|
37
|
-
}
|
|
38
|
-
checkpoint() {
|
|
39
|
-
if (this.value === void 0) throw new EmptyChannelError();
|
|
40
|
-
return this.value;
|
|
41
|
-
}
|
|
42
|
-
isAvailable() {
|
|
43
|
-
return this.value !== void 0;
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
//#endregion
|
|
48
|
-
export { BinaryOperatorAggregate };
|
|
49
|
-
//# sourceMappingURL=binop.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"binop.js","names":[],"sources":["../../src/channels/binop.ts"],"sourcesContent":["import { EmptyChannelError } from \"../errors.js\";\nimport { BaseChannel } from \"./base.js\";\n\nexport type BinaryOperator<ValueType, UpdateType> = (\n a: ValueType,\n b: UpdateType\n) => ValueType;\n\n/**\n * Stores the result of applying a binary operator to the current value and each new value.\n */\nexport class BinaryOperatorAggregate<\n ValueType,\n UpdateType = ValueType\n> extends BaseChannel<ValueType, UpdateType, ValueType> {\n lc_graph_name = \"BinaryOperatorAggregate\";\n\n value: ValueType | undefined;\n\n operator: BinaryOperator<ValueType, UpdateType>;\n\n initialValueFactory?: () => ValueType;\n\n constructor(\n operator: BinaryOperator<ValueType, UpdateType>,\n initialValueFactory?: () => ValueType\n ) {\n super();\n\n this.operator = operator;\n this.initialValueFactory = initialValueFactory;\n this.value = initialValueFactory?.();\n }\n\n public fromCheckpoint(checkpoint?: ValueType) {\n const empty = new BinaryOperatorAggregate(\n this.operator,\n this.initialValueFactory\n );\n if (typeof checkpoint !== \"undefined\") {\n empty.value = checkpoint;\n }\n return empty as this;\n }\n\n public update(values: UpdateType[]): boolean {\n let newValues = values;\n if (!newValues.length) return false;\n\n if (this.value === undefined) {\n [this.value as UpdateType] = newValues;\n newValues = newValues.slice(1);\n }\n\n for (const value of newValues) {\n if (this.value !== undefined) {\n this.value = this.operator(this.value, value);\n }\n }\n return true;\n }\n\n public get(): ValueType {\n if (this.value === undefined) {\n throw new EmptyChannelError();\n }\n return this.value;\n }\n\n public checkpoint(): ValueType {\n if (this.value === undefined) {\n throw new EmptyChannelError();\n }\n return this.value;\n }\n\n isAvailable(): boolean {\n return this.value !== undefined;\n }\n}\n"],"mappings":";;;;;;;AAWA,IAAa,0BAAb,MAAa,gCAGH,YAA8C;CACtD,gBAAgB;CAEhB;CAEA;CAEA;CAEA,YACE,UACA,qBACA;AACA;AAEA,OAAK,WAAW;AAChB,OAAK,sBAAsB;AAC3B,OAAK,QAAQ;;CAGf,AAAO,eAAe,YAAwB;EAC5C,MAAM,QAAQ,IAAI,wBAChB,KAAK,UACL,KAAK;AAEP,MAAI,OAAO,eAAe,YACxB,OAAM,QAAQ;AAEhB,SAAO;;CAGT,AAAO,OAAO,QAA+B;EAC3C,IAAI,YAAY;AAChB,MAAI,CAAC,UAAU,OAAQ,QAAO;AAE9B,MAAI,KAAK,UAAU,QAAW;AAC5B,IAAC,KAAK,SAAuB;AAC7B,eAAY,UAAU,MAAM;;AAG9B,OAAK,MAAM,SAAS,UAClB,KAAI,KAAK,UAAU,OACjB,MAAK,QAAQ,KAAK,SAAS,KAAK,OAAO;AAG3C,SAAO;;CAGT,AAAO,MAAiB;AACtB,MAAI,KAAK,UAAU,OACjB,OAAM,IAAI;AAEZ,SAAO,KAAK;;CAGd,AAAO,aAAwB;AAC7B,MAAI,KAAK,UAAU,OACjB,OAAM,IAAI;AAEZ,SAAO,KAAK;;CAGd,cAAuB;AACrB,SAAO,KAAK,UAAU"}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
const require_errors = require('../errors.cjs');
|
|
2
|
-
const require_base = require('./base.cjs');
|
|
3
|
-
const require_named_barrier_value = require('./named_barrier_value.cjs');
|
|
4
|
-
|
|
5
|
-
//#region src/channels/dynamic_barrier_value.ts
|
|
6
|
-
function isWaitForNames(v) {
|
|
7
|
-
return v.__names !== void 0;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* A channel that switches between two states
|
|
11
|
-
*
|
|
12
|
-
* - in the "priming" state it can't be read from.
|
|
13
|
-
* - if it receives a WaitForNames update, it switches to the "waiting" state.
|
|
14
|
-
* - in the "waiting" state it collects named values until all are received.
|
|
15
|
-
* - once all named values are received, it can be read once, and it switches
|
|
16
|
-
* back to the "priming" state.
|
|
17
|
-
*/
|
|
18
|
-
var DynamicBarrierValue = class DynamicBarrierValue extends require_base.BaseChannel {
|
|
19
|
-
lc_graph_name = "DynamicBarrierValue";
|
|
20
|
-
names;
|
|
21
|
-
seen;
|
|
22
|
-
constructor() {
|
|
23
|
-
super();
|
|
24
|
-
this.names = void 0;
|
|
25
|
-
this.seen = /* @__PURE__ */ new Set();
|
|
26
|
-
}
|
|
27
|
-
fromCheckpoint(checkpoint) {
|
|
28
|
-
const empty = new DynamicBarrierValue();
|
|
29
|
-
if (typeof checkpoint !== "undefined") {
|
|
30
|
-
empty.names = new Set(checkpoint[0]);
|
|
31
|
-
empty.seen = new Set(checkpoint[1]);
|
|
32
|
-
}
|
|
33
|
-
return empty;
|
|
34
|
-
}
|
|
35
|
-
update(values) {
|
|
36
|
-
const waitForNames = values.filter(isWaitForNames);
|
|
37
|
-
if (waitForNames.length > 0) {
|
|
38
|
-
if (waitForNames.length > 1) throw new require_errors.InvalidUpdateError("Received multiple WaitForNames updates in the same step.");
|
|
39
|
-
this.names = new Set(waitForNames[0].__names);
|
|
40
|
-
return true;
|
|
41
|
-
} else if (this.names !== void 0) {
|
|
42
|
-
let updated = false;
|
|
43
|
-
for (const value of values) {
|
|
44
|
-
if (isWaitForNames(value)) throw new Error("Assertion Error: Received unexpected WaitForNames instance.");
|
|
45
|
-
if (this.names.has(value) && !this.seen.has(value)) {
|
|
46
|
-
this.seen.add(value);
|
|
47
|
-
updated = true;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
return updated;
|
|
51
|
-
}
|
|
52
|
-
return false;
|
|
53
|
-
}
|
|
54
|
-
consume() {
|
|
55
|
-
if (this.seen && this.names && require_named_barrier_value.areSetsEqual(this.seen, this.names)) {
|
|
56
|
-
this.seen = /* @__PURE__ */ new Set();
|
|
57
|
-
this.names = void 0;
|
|
58
|
-
return true;
|
|
59
|
-
}
|
|
60
|
-
return false;
|
|
61
|
-
}
|
|
62
|
-
get() {
|
|
63
|
-
if (!this.names || !require_named_barrier_value.areSetsEqual(this.names, this.seen)) throw new require_errors.EmptyChannelError();
|
|
64
|
-
return void 0;
|
|
65
|
-
}
|
|
66
|
-
checkpoint() {
|
|
67
|
-
return [this.names ? [...this.names] : void 0, [...this.seen]];
|
|
68
|
-
}
|
|
69
|
-
isAvailable() {
|
|
70
|
-
return !!this.names && require_named_barrier_value.areSetsEqual(this.names, this.seen);
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
//#endregion
|
|
75
|
-
exports.DynamicBarrierValue = DynamicBarrierValue;
|
|
76
|
-
//# sourceMappingURL=dynamic_barrier_value.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic_barrier_value.cjs","names":["BaseChannel","InvalidUpdateError","areSetsEqual","EmptyChannelError"],"sources":["../../src/channels/dynamic_barrier_value.ts"],"sourcesContent":["import { EmptyChannelError, InvalidUpdateError } from \"../errors.js\";\nimport { BaseChannel } from \"./base.js\";\nimport { areSetsEqual } from \"./named_barrier_value.js\";\n\nexport interface WaitForNames<Value> {\n __names: Value[];\n}\n\nfunction isWaitForNames<Value>(\n v: WaitForNames<Value> | Value\n): v is WaitForNames<Value> {\n return (v as WaitForNames<Value>).__names !== undefined;\n}\n\n/**\n * A channel that switches between two states\n *\n * - in the \"priming\" state it can't be read from.\n * - if it receives a WaitForNames update, it switches to the \"waiting\" state.\n * - in the \"waiting\" state it collects named values until all are received.\n * - once all named values are received, it can be read once, and it switches\n * back to the \"priming\" state.\n */\nexport class DynamicBarrierValue<Value> extends BaseChannel<\n void,\n Value | WaitForNames<Value>,\n [Value[] | undefined, Value[]]\n> {\n lc_graph_name = \"DynamicBarrierValue\";\n\n names?: Set<Value>; // Names of nodes that we want to wait for.\n\n seen: Set<Value>;\n\n constructor() {\n super();\n this.names = undefined;\n this.seen = new Set<Value>();\n }\n\n fromCheckpoint(checkpoint?: [Value[] | undefined, Value[]]) {\n const empty = new DynamicBarrierValue<Value>();\n if (typeof checkpoint !== \"undefined\") {\n empty.names = new Set(checkpoint[0]);\n empty.seen = new Set(checkpoint[1]);\n }\n return empty as this;\n }\n\n update(values: (Value | WaitForNames<Value>)[]): boolean {\n const waitForNames = values.filter(isWaitForNames);\n if (waitForNames.length > 0) {\n if (waitForNames.length > 1) {\n throw new InvalidUpdateError(\n \"Received multiple WaitForNames updates in the same step.\"\n );\n }\n this.names = new Set(waitForNames[0].__names);\n return true;\n } else if (this.names !== undefined) {\n let updated = false;\n for (const value of values) {\n if (isWaitForNames(value)) {\n throw new Error(\n \"Assertion Error: Received unexpected WaitForNames instance.\"\n );\n }\n if (this.names.has(value) && !this.seen.has(value)) {\n this.seen.add(value);\n updated = true;\n }\n }\n return updated;\n }\n return false;\n }\n\n consume(): boolean {\n if (this.seen && this.names && areSetsEqual(this.seen, this.names)) {\n this.seen = new Set<Value>();\n this.names = undefined;\n return true;\n }\n return false;\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 (!this.names || !areSetsEqual(this.names, this.seen)) {\n throw new EmptyChannelError();\n }\n return undefined;\n }\n\n checkpoint(): [Value[] | undefined, Value[]] {\n return [this.names ? [...this.names] : undefined, [...this.seen]];\n }\n\n isAvailable(): boolean {\n return !!this.names && areSetsEqual(this.names, this.seen);\n }\n}\n\n/**\n * A channel that switches between two states with an additional finished flag\n *\n * - in the \"priming\" state it can't be read from.\n * - if it receives a WaitForNames update, it switches to the \"waiting\" state.\n * - in the \"waiting\" state it collects named values until all are received.\n * - once all named values are received, and the finished flag is set, it can be read once, and it switches\n * back to the \"priming\" state.\n * @internal\n */\nexport class DynamicBarrierValueAfterFinish<Value> extends BaseChannel<\n void,\n Value | WaitForNames<Value>,\n [Value[] | undefined, Value[], boolean]\n> {\n lc_graph_name = \"DynamicBarrierValueAfterFinish\";\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() {\n super();\n this.names = undefined;\n this.seen = new Set<Value>();\n this.finished = false;\n }\n\n fromCheckpoint(checkpoint?: [Value[] | undefined, Value[], boolean]) {\n const empty = new DynamicBarrierValueAfterFinish<Value>();\n if (typeof checkpoint !== \"undefined\") {\n const [names, seen, finished] = checkpoint;\n empty.names = names ? new Set(names) : undefined;\n empty.seen = new Set(seen);\n empty.finished = finished;\n }\n return empty as this;\n }\n\n update(values: (Value | WaitForNames<Value>)[]): boolean {\n const waitForNames = values.filter(isWaitForNames);\n if (waitForNames.length > 0) {\n if (waitForNames.length > 1) {\n throw new InvalidUpdateError(\n \"Received multiple WaitForNames updates in the same step.\"\n );\n }\n this.names = new Set(waitForNames[0].__names);\n return true;\n } else if (this.names !== undefined) {\n let updated = false;\n for (const value of values) {\n if (isWaitForNames(value)) {\n throw new Error(\n \"Assertion Error: Received unexpected WaitForNames instance.\"\n );\n }\n if (this.names.has(value) && !this.seen.has(value)) {\n this.seen.add(value);\n updated = true;\n }\n }\n return updated;\n }\n return false;\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.names = undefined;\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 get(): void {\n if (!this.finished || !this.names || !areSetsEqual(this.names, this.seen)) {\n throw new EmptyChannelError();\n }\n return undefined;\n }\n\n checkpoint(): [Value[] | undefined, Value[], boolean] {\n return [\n this.names ? [...this.names] : undefined,\n [...this.seen],\n this.finished,\n ];\n }\n\n isAvailable(): boolean {\n return this.finished && !!this.names && areSetsEqual(this.names, this.seen);\n }\n}\n"],"mappings":";;;;;AAQA,SAAS,eACP,GAC0B;AAC1B,QAAQ,EAA0B,YAAY;;;;;;;;;;;AAYhD,IAAa,sBAAb,MAAa,4BAAmCA,yBAI9C;CACA,gBAAgB;CAEhB;CAEA;CAEA,cAAc;AACZ;AACA,OAAK,QAAQ;AACb,OAAK,uBAAO,IAAI;;CAGlB,eAAe,YAA6C;EAC1D,MAAM,QAAQ,IAAI;AAClB,MAAI,OAAO,eAAe,aAAa;AACrC,SAAM,QAAQ,IAAI,IAAI,WAAW;AACjC,SAAM,OAAO,IAAI,IAAI,WAAW;;AAElC,SAAO;;CAGT,OAAO,QAAkD;EACvD,MAAM,eAAe,OAAO,OAAO;AACnC,MAAI,aAAa,SAAS,GAAG;AAC3B,OAAI,aAAa,SAAS,EACxB,OAAM,IAAIC,kCACR;AAGJ,QAAK,QAAQ,IAAI,IAAI,aAAa,GAAG;AACrC,UAAO;aACE,KAAK,UAAU,QAAW;GACnC,IAAI,UAAU;AACd,QAAK,MAAM,SAAS,QAAQ;AAC1B,QAAI,eAAe,OACjB,OAAM,IAAI,MACR;AAGJ,QAAI,KAAK,MAAM,IAAI,UAAU,CAAC,KAAK,KAAK,IAAI,QAAQ;AAClD,UAAK,KAAK,IAAI;AACd,eAAU;;;AAGd,UAAO;;AAET,SAAO;;CAGT,UAAmB;AACjB,MAAI,KAAK,QAAQ,KAAK,SAASC,yCAAa,KAAK,MAAM,KAAK,QAAQ;AAClE,QAAK,uBAAO,IAAI;AAChB,QAAK,QAAQ;AACb,UAAO;;AAET,SAAO;;CAKT,MAAY;AACV,MAAI,CAAC,KAAK,SAAS,CAACA,yCAAa,KAAK,OAAO,KAAK,MAChD,OAAM,IAAIC;AAEZ,SAAO;;CAGT,aAA6C;AAC3C,SAAO,CAAC,KAAK,QAAQ,CAAC,GAAG,KAAK,SAAS,QAAW,CAAC,GAAG,KAAK;;CAG7D,cAAuB;AACrB,SAAO,CAAC,CAAC,KAAK,SAASD,yCAAa,KAAK,OAAO,KAAK"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { BaseChannel } from "./base.cjs";
|
|
2
|
-
|
|
3
|
-
//#region src/channels/dynamic_barrier_value.d.ts
|
|
4
|
-
interface WaitForNames<Value> {
|
|
5
|
-
__names: Value[];
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* A channel that switches between two states
|
|
9
|
-
*
|
|
10
|
-
* - in the "priming" state it can't be read from.
|
|
11
|
-
* - if it receives a WaitForNames update, it switches to the "waiting" state.
|
|
12
|
-
* - in the "waiting" state it collects named values until all are received.
|
|
13
|
-
* - once all named values are received, it can be read once, and it switches
|
|
14
|
-
* back to the "priming" state.
|
|
15
|
-
*/
|
|
16
|
-
declare class DynamicBarrierValue<Value> extends BaseChannel<void, Value | WaitForNames<Value>, [Value[] | undefined, Value[]]> {
|
|
17
|
-
lc_graph_name: string;
|
|
18
|
-
names?: Set<Value>; // Names of nodes that we want to wait for.
|
|
19
|
-
seen: Set<Value>;
|
|
20
|
-
constructor();
|
|
21
|
-
fromCheckpoint(checkpoint?: [Value[] | undefined, Value[]]): this;
|
|
22
|
-
update(values: (Value | WaitForNames<Value>)[]): boolean;
|
|
23
|
-
consume(): boolean;
|
|
24
|
-
// If we have not yet seen all the node names we want to wait for,
|
|
25
|
-
// throw an error to prevent continuing.
|
|
26
|
-
get(): void;
|
|
27
|
-
checkpoint(): [Value[] | undefined, Value[]];
|
|
28
|
-
isAvailable(): boolean;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* A channel that switches between two states with an additional finished flag
|
|
32
|
-
*
|
|
33
|
-
* - in the "priming" state it can't be read from.
|
|
34
|
-
* - if it receives a WaitForNames update, it switches to the "waiting" state.
|
|
35
|
-
* - in the "waiting" state it collects named values until all are received.
|
|
36
|
-
* - once all named values are received, and the finished flag is set, it can be read once, and it switches
|
|
37
|
-
* back to the "priming" state.
|
|
38
|
-
* @internal
|
|
39
|
-
*/
|
|
40
|
-
//#endregion
|
|
41
|
-
export { DynamicBarrierValue, WaitForNames };
|
|
42
|
-
//# sourceMappingURL=dynamic_barrier_value.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic_barrier_value.d.cts","names":["BaseChannel","WaitForNames","Value","DynamicBarrierValue","Set","DynamicBarrierValueAfterFinish"],"sources":["../../src/channels/dynamic_barrier_value.d.ts"],"sourcesContent":["import { BaseChannel } from \"./base.js\";\nexport interface WaitForNames<Value> {\n __names: Value[];\n}\n/**\n * A channel that switches between two states\n *\n * - in the \"priming\" state it can't be read from.\n * - if it receives a WaitForNames update, it switches to the \"waiting\" state.\n * - in the \"waiting\" state it collects named values until all are received.\n * - once all named values are received, it can be read once, and it switches\n * back to the \"priming\" state.\n */\nexport declare class DynamicBarrierValue<Value> extends BaseChannel<void, Value | WaitForNames<Value>, [\n Value[] | undefined,\n Value[]\n]> {\n lc_graph_name: string;\n names?: Set<Value>; // Names of nodes that we want to wait for.\n seen: Set<Value>;\n constructor();\n fromCheckpoint(checkpoint?: [Value[] | undefined, Value[]]): this;\n update(values: (Value | WaitForNames<Value>)[]): boolean;\n consume(): 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[] | undefined, Value[]];\n isAvailable(): boolean;\n}\n/**\n * A channel that switches between two states with an additional finished flag\n *\n * - in the \"priming\" state it can't be read from.\n * - if it receives a WaitForNames update, it switches to the \"waiting\" state.\n * - in the \"waiting\" state it collects named values until all are received.\n * - once all named values are received, and the finished flag is set, it can be read once, and it switches\n * back to the \"priming\" state.\n * @internal\n */\nexport declare class DynamicBarrierValueAfterFinish<Value> extends BaseChannel<void, Value | WaitForNames<Value>, [\n Value[] | undefined,\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();\n fromCheckpoint(checkpoint?: [Value[] | undefined, Value[], boolean]): this;\n update(values: (Value | WaitForNames<Value>)[]): boolean;\n consume(): boolean;\n finish(): boolean;\n get(): void;\n checkpoint(): [Value[] | undefined, Value[], boolean];\n isAvailable(): boolean;\n}\n"],"mappings":";;;UACiBC;WACJC;AADb;AAYA;;;;;;;;;AAMcA,cANOC,mBAMPD,CAAAA,KAAAA,CAAAA,SAN0CF,WAM1CE,CAAAA,IAAAA,EAN4DA,KAM5DA,GANoED,YAMpEC,CANiFA,KAMjFA,CAAAA,EAAAA,CALVA,KAKME,EAAAA,GAAAA,SAAAA,EAJNF,KAM6BA,EAAAA;eACbA,EAAAA,MAAAA;OAAqBA,CAAAA,EAJ7BE,GAI6BF,CAJzBA,KAIyBA,CAAAA,CAAAA,CAAAA;MAAbD,EAHlBG,GAGkBH,CAHdC,KAGcD,CAAAA;aAKTC,CAAAA;gBAAqBA,CAAAA,UAAAA,CAAAA,EAAAA,CANPA,KAMOA,EAAAA,GAAAA,SAAAA,EANcA,KAMdA,EAAAA,CAAAA,CAAAA,EAAAA,IAAAA;QAdgBF,CAAAA,MAAAA,EAAAA,CASpCE,KAToCF,GAS5BC,YAT4BD,CASfE,KATeF,CAAAA,CAAAA,EAAAA,CAAAA,EAAAA,OAAAA;;;;;iBAcrCE,qBAAqBA"}
|