(
config: Partial<CallOptions> = {},
{
callbacks,
maxConcurrency,
recursionLimit,
runName,
configurable,
runId,
}: RunnableConfig = {}
)
| 243 | * Helper function that patches runnable configs with updated properties. |
| 244 | */ |
| 245 | export function patchConfig<CallOptions extends RunnableConfig>( |
| 246 | config: Partial<CallOptions> = {}, |
| 247 | { |
| 248 | callbacks, |
| 249 | maxConcurrency, |
| 250 | recursionLimit, |
| 251 | runName, |
| 252 | configurable, |
| 253 | runId, |
| 254 | }: RunnableConfig = {} |
| 255 | ): Partial<CallOptions> { |
| 256 | const newConfig = ensureConfig(config); |
| 257 | if (callbacks !== undefined) { |
| 258 | /** |
| 259 | * If we're replacing callbacks we need to unset runName |
| 260 | * since that should apply only to the same run as the original callbacks |
| 261 | */ |
| 262 | delete newConfig.runName; |
| 263 | newConfig.callbacks = callbacks; |
| 264 | } |
| 265 | if (recursionLimit !== undefined) { |
| 266 | newConfig.recursionLimit = recursionLimit; |
| 267 | } |
| 268 | if (maxConcurrency !== undefined) { |
| 269 | newConfig.maxConcurrency = maxConcurrency; |
| 270 | } |
| 271 | if (runName !== undefined) { |
| 272 | newConfig.runName = runName; |
| 273 | } |
| 274 | if (configurable !== undefined) { |
| 275 | newConfig.configurable = { ...newConfig.configurable, ...configurable }; |
| 276 | } |
| 277 | if (runId !== undefined) { |
| 278 | delete newConfig.runId; |
| 279 | } |
| 280 | return newConfig; |
| 281 | } |
| 282 | |
| 283 | // oxlint-disable-next-line @typescript-eslint/no-explicit-any |
| 284 | export function pickRunnableConfigKeys<CallOptions extends Record<string, any>>( |
no test coverage detected