@langchain/langgraph-sdk 1.4.4 → 1.4.5
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/dist/_virtual/rolldown_runtime.cjs +29 -0
- package/dist/auth/error.cjs +79 -0
- package/dist/auth/error.cjs.map +1 -0
- package/dist/auth/error.d.cts +13 -0
- package/dist/auth/error.d.cts.map +1 -0
- package/dist/auth/error.d.ts +13 -0
- package/dist/auth/error.d.ts.map +1 -0
- package/dist/auth/error.js +78 -0
- package/dist/auth/error.js.map +1 -0
- package/dist/auth/index.cjs +39 -0
- package/dist/auth/index.cjs.map +1 -0
- package/dist/auth/index.d.cts +29 -0
- package/dist/auth/index.d.cts.map +1 -0
- package/dist/auth/index.d.ts +29 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +37 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/types.d.cts +294 -0
- package/dist/auth/types.d.cts.map +1 -0
- package/dist/auth/types.d.ts +294 -0
- package/dist/auth/types.d.ts.map +1 -0
- package/dist/client.cjs +1210 -0
- package/dist/client.cjs.map +1 -0
- package/dist/client.d.cts +799 -0
- package/dist/client.d.cts.map +1 -0
- package/dist/client.d.ts +799 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +1203 -0
- package/dist/client.js.map +1 -0
- package/dist/index.cjs +6 -0
- package/dist/index.d.cts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +4 -0
- package/dist/logging/index.cjs +35 -0
- package/dist/logging/index.cjs.map +1 -0
- package/dist/logging/index.d.cts +46 -0
- package/dist/logging/index.d.cts.map +1 -0
- package/dist/logging/index.d.ts +46 -0
- package/dist/logging/index.d.ts.map +1 -0
- package/dist/logging/index.js +34 -0
- package/dist/logging/index.js.map +1 -0
- package/dist/react/index.cjs +5 -0
- package/dist/react/index.d.cts +5 -0
- package/dist/react/index.d.ts +5 -0
- package/dist/react/index.js +4 -0
- package/dist/react/stream.cjs +18 -0
- package/dist/react/stream.cjs.map +1 -0
- package/dist/react/stream.custom.cjs +135 -0
- package/dist/react/stream.custom.cjs.map +1 -0
- package/dist/react/stream.custom.d.cts +40 -0
- package/dist/react/stream.custom.d.cts.map +1 -0
- package/dist/react/stream.custom.d.ts +40 -0
- package/dist/react/stream.custom.d.ts.map +1 -0
- package/dist/react/stream.custom.js +133 -0
- package/dist/react/stream.custom.js.map +1 -0
- package/dist/react/stream.d.cts +155 -0
- package/dist/react/stream.d.cts.map +1 -0
- package/dist/react/stream.d.ts +155 -0
- package/dist/react/stream.d.ts.map +1 -0
- package/dist/react/stream.js +17 -0
- package/dist/react/stream.js.map +1 -0
- package/dist/react/stream.lgp.cjs +448 -0
- package/dist/react/stream.lgp.cjs.map +1 -0
- package/dist/react/stream.lgp.js +447 -0
- package/dist/react/stream.lgp.js.map +1 -0
- package/dist/react/thread.cjs +21 -0
- package/dist/react/thread.cjs.map +1 -0
- package/dist/react/thread.js +20 -0
- package/dist/react/thread.js.map +1 -0
- package/dist/react/types.d.cts +152 -0
- package/dist/react/types.d.cts.map +1 -0
- package/dist/react/types.d.ts +152 -0
- package/dist/react/types.d.ts.map +1 -0
- package/dist/react-ui/client.cjs +138 -0
- package/dist/react-ui/client.cjs.map +1 -0
- package/dist/react-ui/client.d.cts +73 -0
- package/dist/react-ui/client.d.cts.map +1 -0
- package/dist/react-ui/client.d.ts +73 -0
- package/dist/react-ui/client.d.ts.map +1 -0
- package/dist/react-ui/client.js +132 -0
- package/dist/react-ui/client.js.map +1 -0
- package/dist/react-ui/index.cjs +14 -0
- package/dist/react-ui/index.cjs.map +1 -0
- package/dist/react-ui/index.d.cts +3 -0
- package/dist/react-ui/index.d.ts +3 -0
- package/dist/react-ui/index.js +9 -0
- package/dist/react-ui/index.js.map +1 -0
- package/dist/react-ui/server/index.cjs +5 -0
- package/dist/react-ui/server/index.d.cts +3 -0
- package/dist/react-ui/server/index.d.ts +3 -0
- package/dist/react-ui/server/index.js +4 -0
- package/dist/react-ui/server/server.cjs +57 -0
- package/dist/react-ui/server/server.cjs.map +1 -0
- package/dist/react-ui/server/server.d.cts +55 -0
- package/dist/react-ui/server/server.d.cts.map +1 -0
- package/dist/react-ui/server/server.d.ts +55 -0
- package/dist/react-ui/server/server.d.ts.map +1 -0
- package/dist/react-ui/server/server.js +56 -0
- package/dist/react-ui/server/server.js.map +1 -0
- package/dist/react-ui/types.cjs +38 -0
- package/dist/react-ui/types.cjs.map +1 -0
- package/dist/react-ui/types.d.cts +25 -0
- package/dist/react-ui/types.d.cts.map +1 -0
- package/dist/react-ui/types.d.ts +25 -0
- package/dist/react-ui/types.d.ts.map +1 -0
- package/dist/react-ui/types.js +35 -0
- package/dist/react-ui/types.js.map +1 -0
- package/dist/schema.d.cts +284 -0
- package/dist/schema.d.cts.map +1 -0
- package/dist/schema.d.ts +284 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/singletons/fetch.cjs +24 -0
- package/dist/singletons/fetch.cjs.map +1 -0
- package/dist/singletons/fetch.d.cts +14 -0
- package/dist/singletons/fetch.d.cts.map +1 -0
- package/dist/singletons/fetch.d.ts +14 -0
- package/dist/singletons/fetch.d.ts.map +1 -0
- package/dist/singletons/fetch.js +22 -0
- package/dist/singletons/fetch.js.map +1 -0
- package/dist/types.d.cts +187 -0
- package/dist/types.d.cts.map +1 -0
- package/dist/types.d.ts +187 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.messages.d.cts +264 -0
- package/dist/types.messages.d.cts.map +1 -0
- package/dist/types.messages.d.ts +264 -0
- package/dist/types.messages.d.ts.map +1 -0
- package/dist/types.stream.d.cts +233 -0
- package/dist/types.stream.d.cts.map +1 -0
- package/dist/types.stream.d.ts +233 -0
- package/dist/types.stream.d.ts.map +1 -0
- package/dist/types.template.d.cts +19 -0
- package/dist/types.template.d.cts.map +1 -0
- package/dist/types.template.d.ts +19 -0
- package/dist/types.template.d.ts.map +1 -0
- package/dist/ui/branching.cjs +153 -0
- package/dist/ui/branching.cjs.map +1 -0
- package/dist/ui/branching.d.cts +19 -0
- package/dist/ui/branching.d.cts.map +1 -0
- package/dist/ui/branching.d.ts +19 -0
- package/dist/ui/branching.d.ts.map +1 -0
- package/dist/ui/branching.js +152 -0
- package/dist/ui/branching.js.map +1 -0
- package/dist/ui/errors.cjs +15 -0
- package/dist/ui/errors.cjs.map +1 -0
- package/dist/ui/errors.js +14 -0
- package/dist/ui/errors.js.map +1 -0
- package/dist/ui/manager.cjs +188 -0
- package/dist/ui/manager.cjs.map +1 -0
- package/dist/ui/manager.js +188 -0
- package/dist/ui/manager.js.map +1 -0
- package/dist/ui/messages.cjs +70 -0
- package/dist/ui/messages.cjs.map +1 -0
- package/dist/ui/messages.js +68 -0
- package/dist/ui/messages.js.map +1 -0
- package/dist/ui/types.d.cts +420 -0
- package/dist/ui/types.d.cts.map +1 -0
- package/dist/ui/types.d.ts +420 -0
- package/dist/ui/types.d.ts.map +1 -0
- package/dist/ui/utils.cjs +13 -0
- package/dist/ui/utils.cjs.map +1 -0
- package/dist/ui/utils.js +11 -0
- package/dist/ui/utils.js.map +1 -0
- package/dist/utils/async_caller.cjs +119 -0
- package/dist/utils/async_caller.cjs.map +1 -0
- package/dist/utils/async_caller.d.cts +51 -0
- package/dist/utils/async_caller.d.cts.map +1 -0
- package/dist/utils/async_caller.d.ts +51 -0
- package/dist/utils/async_caller.d.ts.map +1 -0
- package/dist/utils/async_caller.js +116 -0
- package/dist/utils/async_caller.js.map +1 -0
- package/dist/utils/env.cjs +13 -0
- package/dist/utils/env.cjs.map +1 -0
- package/dist/utils/env.js +12 -0
- package/dist/utils/env.js.map +1 -0
- package/dist/utils/error.cjs +17 -0
- package/dist/utils/error.cjs.map +1 -0
- package/dist/utils/error.js +16 -0
- package/dist/utils/error.js.map +1 -0
- package/dist/utils/signals.cjs +20 -0
- package/dist/utils/signals.cjs.map +1 -0
- package/dist/utils/signals.js +19 -0
- package/dist/utils/signals.js.map +1 -0
- package/dist/utils/sse.cjs +124 -0
- package/dist/utils/sse.cjs.map +1 -0
- package/dist/utils/sse.js +122 -0
- package/dist/utils/sse.js.map +1 -0
- package/dist/utils/stream.cjs +174 -0
- package/dist/utils/stream.cjs.map +1 -0
- package/dist/utils/stream.js +173 -0
- package/dist/utils/stream.js.map +1 -0
- package/dist/utils/tools.cjs +52 -0
- package/dist/utils/tools.cjs.map +1 -0
- package/dist/utils/tools.js +51 -0
- package/dist/utils/tools.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
//#region src/utils/async_caller.d.ts
|
|
2
|
+
type ResponseCallback = (response?: Response) => Promise<boolean>;
|
|
3
|
+
interface AsyncCallerParams {
|
|
4
|
+
/**
|
|
5
|
+
* The maximum number of concurrent calls that can be made.
|
|
6
|
+
* Defaults to `Infinity`, which means no limit.
|
|
7
|
+
*/
|
|
8
|
+
maxConcurrency?: number;
|
|
9
|
+
/**
|
|
10
|
+
* The maximum number of retries that can be made for a single call,
|
|
11
|
+
* with an exponential backoff between each attempt. Defaults to 6.
|
|
12
|
+
*/
|
|
13
|
+
maxRetries?: number;
|
|
14
|
+
onFailedResponseHook?: ResponseCallback;
|
|
15
|
+
/**
|
|
16
|
+
* Specify a custom fetch implementation.
|
|
17
|
+
*
|
|
18
|
+
* By default we expect the `fetch` is available in the global scope.
|
|
19
|
+
*/
|
|
20
|
+
fetch?: typeof fetch | ((...args: any[]) => any);
|
|
21
|
+
}
|
|
22
|
+
interface AsyncCallerCallOptions {
|
|
23
|
+
signal?: AbortSignal;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* A class that can be used to make async calls with concurrency and retry logic.
|
|
27
|
+
*
|
|
28
|
+
* This is useful for making calls to any kind of "expensive" external resource,
|
|
29
|
+
* be it because it's rate-limited, subject to network issues, etc.
|
|
30
|
+
*
|
|
31
|
+
* Concurrent calls are limited by the `maxConcurrency` parameter, which defaults
|
|
32
|
+
* to `Infinity`. This means that by default, all calls will be made in parallel.
|
|
33
|
+
*
|
|
34
|
+
* Retries are limited by the `maxRetries` parameter, which defaults to 5. This
|
|
35
|
+
* means that by default, each call will be retried up to 5 times, with an
|
|
36
|
+
* exponential backoff between each attempt.
|
|
37
|
+
*/
|
|
38
|
+
declare class AsyncCaller {
|
|
39
|
+
protected maxConcurrency: AsyncCallerParams["maxConcurrency"];
|
|
40
|
+
protected maxRetries: AsyncCallerParams["maxRetries"];
|
|
41
|
+
private queue;
|
|
42
|
+
private onFailedResponseHook?;
|
|
43
|
+
private customFetch?;
|
|
44
|
+
constructor(params: AsyncCallerParams);
|
|
45
|
+
call<A extends any[], T extends (...args: A) => Promise<any>>(callable: T, ...args: Parameters<T>): Promise<Awaited<ReturnType<T>>>;
|
|
46
|
+
callWithOptions<A extends any[], T extends (...args: A) => Promise<any>>(options: AsyncCallerCallOptions, callable: T, ...args: Parameters<T>): Promise<Awaited<ReturnType<T>>>;
|
|
47
|
+
fetch(...args: Parameters<typeof fetch>): ReturnType<typeof fetch>;
|
|
48
|
+
}
|
|
49
|
+
//#endregion
|
|
50
|
+
export { AsyncCaller, AsyncCallerParams };
|
|
51
|
+
//# sourceMappingURL=async_caller.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"async_caller.d.cts","names":["ResponseCallback","Response","Promise","AsyncCallerParams","fetch","AsyncCallerCallOptions","AbortSignal","AsyncCaller","A","T","Parameters","ReturnType","Awaited"],"sources":["../../src/utils/async_caller.d.ts"],"sourcesContent":["type ResponseCallback = (response?: Response) => Promise<boolean>;\nexport interface AsyncCallerParams {\n /**\n * The maximum number of concurrent calls that can be made.\n * Defaults to `Infinity`, which means no limit.\n */\n maxConcurrency?: number;\n /**\n * The maximum number of retries that can be made for a single call,\n * with an exponential backoff between each attempt. Defaults to 6.\n */\n maxRetries?: number;\n onFailedResponseHook?: ResponseCallback;\n /**\n * Specify a custom fetch implementation.\n *\n * By default we expect the `fetch` is available in the global scope.\n */\n fetch?: typeof fetch | ((...args: any[]) => any);\n}\nexport interface AsyncCallerCallOptions {\n signal?: AbortSignal;\n}\n/**\n * A class that can be used to make async calls with concurrency and retry logic.\n *\n * This is useful for making calls to any kind of \"expensive\" external resource,\n * be it because it's rate-limited, subject to network issues, etc.\n *\n * Concurrent calls are limited by the `maxConcurrency` parameter, which defaults\n * to `Infinity`. This means that by default, all calls will be made in parallel.\n *\n * Retries are limited by the `maxRetries` parameter, which defaults to 5. This\n * means that by default, each call will be retried up to 5 times, with an\n * exponential backoff between each attempt.\n */\nexport declare class AsyncCaller {\n protected maxConcurrency: AsyncCallerParams[\"maxConcurrency\"];\n protected maxRetries: AsyncCallerParams[\"maxRetries\"];\n private queue;\n private onFailedResponseHook?;\n private customFetch?;\n constructor(params: AsyncCallerParams);\n call<A extends any[], T extends (...args: A) => Promise<any>>(callable: T, ...args: Parameters<T>): Promise<Awaited<ReturnType<T>>>;\n callWithOptions<A extends any[], T extends (...args: A) => Promise<any>>(options: AsyncCallerCallOptions, callable: T, ...args: Parameters<T>): Promise<Awaited<ReturnType<T>>>;\n fetch(...args: Parameters<typeof fetch>): ReturnType<typeof fetch>;\n}\nexport {};\n"],"mappings":";KAAKA,gBAAAA,eAA+BC,aAAaC;AAA5CF,UACYG,iBAAAA,CADI;EAAA;;;;EACJA,cAAAA,CAAAA,EAAAA,MAAiB;EAAA;;;;EAmBjBE,UAAAA,CAAAA,EAAAA,MAAAA;EAgBIE,oBAAW,CAAA,EAxBLP,gBAwBK;EAAA;;;;;OAOoBE,CAAAA,EAAAA,OAzBjCE,KAyBiCF,GAAAA,CAAAA,CAAAA,GAAAA,IAAAA,EAAAA,GAAAA,EAAAA,EAAAA,GAAAA,GAAAA,CAAAA;;AAA+CO,UAvBlFJ,sBAAAA,CAuBkFI;QAAXC,CAAAA,EAtB3EJ,WAsB2EI;;;;;;;;;;;;;;;AAEnDN,cAThBG,WAAAA,CASgBH;YAAlBM,cAAAA,EARWP,iBAQXO,CAAAA,gBAAAA,CAAAA;YAA6CN,UAAAA,EAPtCD,iBAOsCC,CAAAA,YAAAA,CAAAA;UAAlBO,KAAAA;EAAU,QAAA,oBAAA;;sBAHhCR;4CACsBK,MAAMN,wBAAwBO,YAAYC,WAAWD,KAAKP,QAAQU,QAAQD,WAAWF;uDAC1ED,MAAMN,uBAAuBG,kCAAkCI,YAAYC,WAAWD,KAAKP,QAAQU,QAAQD,WAAWF;iBAC5JC,kBAAkBN,SAASO,kBAAkBP"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
//#region src/utils/async_caller.d.ts
|
|
2
|
+
type ResponseCallback = (response?: Response) => Promise<boolean>;
|
|
3
|
+
interface AsyncCallerParams {
|
|
4
|
+
/**
|
|
5
|
+
* The maximum number of concurrent calls that can be made.
|
|
6
|
+
* Defaults to `Infinity`, which means no limit.
|
|
7
|
+
*/
|
|
8
|
+
maxConcurrency?: number;
|
|
9
|
+
/**
|
|
10
|
+
* The maximum number of retries that can be made for a single call,
|
|
11
|
+
* with an exponential backoff between each attempt. Defaults to 6.
|
|
12
|
+
*/
|
|
13
|
+
maxRetries?: number;
|
|
14
|
+
onFailedResponseHook?: ResponseCallback;
|
|
15
|
+
/**
|
|
16
|
+
* Specify a custom fetch implementation.
|
|
17
|
+
*
|
|
18
|
+
* By default we expect the `fetch` is available in the global scope.
|
|
19
|
+
*/
|
|
20
|
+
fetch?: typeof fetch | ((...args: any[]) => any);
|
|
21
|
+
}
|
|
22
|
+
interface AsyncCallerCallOptions {
|
|
23
|
+
signal?: AbortSignal;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* A class that can be used to make async calls with concurrency and retry logic.
|
|
27
|
+
*
|
|
28
|
+
* This is useful for making calls to any kind of "expensive" external resource,
|
|
29
|
+
* be it because it's rate-limited, subject to network issues, etc.
|
|
30
|
+
*
|
|
31
|
+
* Concurrent calls are limited by the `maxConcurrency` parameter, which defaults
|
|
32
|
+
* to `Infinity`. This means that by default, all calls will be made in parallel.
|
|
33
|
+
*
|
|
34
|
+
* Retries are limited by the `maxRetries` parameter, which defaults to 5. This
|
|
35
|
+
* means that by default, each call will be retried up to 5 times, with an
|
|
36
|
+
* exponential backoff between each attempt.
|
|
37
|
+
*/
|
|
38
|
+
declare class AsyncCaller {
|
|
39
|
+
protected maxConcurrency: AsyncCallerParams["maxConcurrency"];
|
|
40
|
+
protected maxRetries: AsyncCallerParams["maxRetries"];
|
|
41
|
+
private queue;
|
|
42
|
+
private onFailedResponseHook?;
|
|
43
|
+
private customFetch?;
|
|
44
|
+
constructor(params: AsyncCallerParams);
|
|
45
|
+
call<A extends any[], T extends (...args: A) => Promise<any>>(callable: T, ...args: Parameters<T>): Promise<Awaited<ReturnType<T>>>;
|
|
46
|
+
callWithOptions<A extends any[], T extends (...args: A) => Promise<any>>(options: AsyncCallerCallOptions, callable: T, ...args: Parameters<T>): Promise<Awaited<ReturnType<T>>>;
|
|
47
|
+
fetch(...args: Parameters<typeof fetch>): ReturnType<typeof fetch>;
|
|
48
|
+
}
|
|
49
|
+
//#endregion
|
|
50
|
+
export { AsyncCaller, AsyncCallerParams };
|
|
51
|
+
//# sourceMappingURL=async_caller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"async_caller.d.ts","names":["ResponseCallback","Response","Promise","AsyncCallerParams","fetch","AsyncCallerCallOptions","AbortSignal","AsyncCaller","A","T","Parameters","ReturnType","Awaited"],"sources":["../../src/utils/async_caller.d.ts"],"sourcesContent":["type ResponseCallback = (response?: Response) => Promise<boolean>;\nexport interface AsyncCallerParams {\n /**\n * The maximum number of concurrent calls that can be made.\n * Defaults to `Infinity`, which means no limit.\n */\n maxConcurrency?: number;\n /**\n * The maximum number of retries that can be made for a single call,\n * with an exponential backoff between each attempt. Defaults to 6.\n */\n maxRetries?: number;\n onFailedResponseHook?: ResponseCallback;\n /**\n * Specify a custom fetch implementation.\n *\n * By default we expect the `fetch` is available in the global scope.\n */\n fetch?: typeof fetch | ((...args: any[]) => any);\n}\nexport interface AsyncCallerCallOptions {\n signal?: AbortSignal;\n}\n/**\n * A class that can be used to make async calls with concurrency and retry logic.\n *\n * This is useful for making calls to any kind of \"expensive\" external resource,\n * be it because it's rate-limited, subject to network issues, etc.\n *\n * Concurrent calls are limited by the `maxConcurrency` parameter, which defaults\n * to `Infinity`. This means that by default, all calls will be made in parallel.\n *\n * Retries are limited by the `maxRetries` parameter, which defaults to 5. This\n * means that by default, each call will be retried up to 5 times, with an\n * exponential backoff between each attempt.\n */\nexport declare class AsyncCaller {\n protected maxConcurrency: AsyncCallerParams[\"maxConcurrency\"];\n protected maxRetries: AsyncCallerParams[\"maxRetries\"];\n private queue;\n private onFailedResponseHook?;\n private customFetch?;\n constructor(params: AsyncCallerParams);\n call<A extends any[], T extends (...args: A) => Promise<any>>(callable: T, ...args: Parameters<T>): Promise<Awaited<ReturnType<T>>>;\n callWithOptions<A extends any[], T extends (...args: A) => Promise<any>>(options: AsyncCallerCallOptions, callable: T, ...args: Parameters<T>): Promise<Awaited<ReturnType<T>>>;\n fetch(...args: Parameters<typeof fetch>): ReturnType<typeof fetch>;\n}\nexport {};\n"],"mappings":";KAAKA,gBAAAA,eAA+BC,aAAaC;AAA5CF,UACYG,iBAAAA,CADI;EAAA;;;;EACJA,cAAAA,CAAAA,EAAAA,MAAiB;EAAA;;;;EAmBjBE,UAAAA,CAAAA,EAAAA,MAAAA;EAgBIE,oBAAW,CAAA,EAxBLP,gBAwBK;EAAA;;;;;OAOoBE,CAAAA,EAAAA,OAzBjCE,KAyBiCF,GAAAA,CAAAA,CAAAA,GAAAA,IAAAA,EAAAA,GAAAA,EAAAA,EAAAA,GAAAA,GAAAA,CAAAA;;AAA+CO,UAvBlFJ,sBAAAA,CAuBkFI;QAAXC,CAAAA,EAtB3EJ,WAsB2EI;;;;;;;;;;;;;;;AAEnDN,cAThBG,WAAAA,CASgBH;YAAlBM,cAAAA,EARWP,iBAQXO,CAAAA,gBAAAA,CAAAA;YAA6CN,UAAAA,EAPtCD,iBAOsCC,CAAAA,YAAAA,CAAAA;UAAlBO,KAAAA;EAAU,QAAA,oBAAA;;sBAHhCR;4CACsBK,MAAMN,wBAAwBO,YAAYC,WAAWD,KAAKP,QAAQU,QAAQD,WAAWF;uDAC1ED,MAAMN,uBAAuBG,kCAAkCI,YAAYC,WAAWD,KAAKP,QAAQU,QAAQD,WAAWF;iBAC5JC,kBAAkBN,SAASO,kBAAkBP"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { _getFetchImplementation } from "../singletons/fetch.js";
|
|
2
|
+
import pRetry from "p-retry";
|
|
3
|
+
import PQueueMod from "p-queue";
|
|
4
|
+
|
|
5
|
+
//#region src/utils/async_caller.ts
|
|
6
|
+
const STATUS_NO_RETRY = [
|
|
7
|
+
400,
|
|
8
|
+
401,
|
|
9
|
+
402,
|
|
10
|
+
403,
|
|
11
|
+
404,
|
|
12
|
+
405,
|
|
13
|
+
406,
|
|
14
|
+
407,
|
|
15
|
+
408,
|
|
16
|
+
409,
|
|
17
|
+
422
|
|
18
|
+
];
|
|
19
|
+
/**
|
|
20
|
+
* Do not rely on globalThis.Response, rather just
|
|
21
|
+
* do duck typing
|
|
22
|
+
*/
|
|
23
|
+
function isResponse(x) {
|
|
24
|
+
if (x == null || typeof x !== "object") return false;
|
|
25
|
+
return "status" in x && "statusText" in x && "text" in x;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Utility error to properly handle failed requests
|
|
29
|
+
*/
|
|
30
|
+
var HTTPError = class HTTPError extends Error {
|
|
31
|
+
status;
|
|
32
|
+
text;
|
|
33
|
+
response;
|
|
34
|
+
constructor(status, message, response) {
|
|
35
|
+
super(`HTTP ${status}: ${message}`);
|
|
36
|
+
this.status = status;
|
|
37
|
+
this.text = message;
|
|
38
|
+
this.response = response;
|
|
39
|
+
}
|
|
40
|
+
static async fromResponse(response, options) {
|
|
41
|
+
try {
|
|
42
|
+
return new HTTPError(response.status, await response.text(), options?.includeResponse ? response : void 0);
|
|
43
|
+
} catch {
|
|
44
|
+
return new HTTPError(response.status, response.statusText, options?.includeResponse ? response : void 0);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* A class that can be used to make async calls with concurrency and retry logic.
|
|
50
|
+
*
|
|
51
|
+
* This is useful for making calls to any kind of "expensive" external resource,
|
|
52
|
+
* be it because it's rate-limited, subject to network issues, etc.
|
|
53
|
+
*
|
|
54
|
+
* Concurrent calls are limited by the `maxConcurrency` parameter, which defaults
|
|
55
|
+
* to `Infinity`. This means that by default, all calls will be made in parallel.
|
|
56
|
+
*
|
|
57
|
+
* Retries are limited by the `maxRetries` parameter, which defaults to 5. This
|
|
58
|
+
* means that by default, each call will be retried up to 5 times, with an
|
|
59
|
+
* exponential backoff between each attempt.
|
|
60
|
+
*/
|
|
61
|
+
var AsyncCaller = class {
|
|
62
|
+
maxConcurrency;
|
|
63
|
+
maxRetries;
|
|
64
|
+
queue;
|
|
65
|
+
onFailedResponseHook;
|
|
66
|
+
customFetch;
|
|
67
|
+
constructor(params) {
|
|
68
|
+
this.maxConcurrency = params.maxConcurrency ?? Infinity;
|
|
69
|
+
this.maxRetries = params.maxRetries ?? 4;
|
|
70
|
+
if ("default" in PQueueMod) this.queue = new PQueueMod.default({ concurrency: this.maxConcurrency });
|
|
71
|
+
else this.queue = new PQueueMod({ concurrency: this.maxConcurrency });
|
|
72
|
+
this.onFailedResponseHook = params?.onFailedResponseHook;
|
|
73
|
+
this.customFetch = params.fetch;
|
|
74
|
+
}
|
|
75
|
+
call(callable, ...args) {
|
|
76
|
+
const { onFailedResponseHook } = this;
|
|
77
|
+
return this.queue.add(() => pRetry(() => callable(...args).catch(async (error) => {
|
|
78
|
+
if (error instanceof Error) throw error;
|
|
79
|
+
else if (isResponse(error)) throw await HTTPError.fromResponse(error, { includeResponse: !!onFailedResponseHook });
|
|
80
|
+
else throw new Error(error);
|
|
81
|
+
}), {
|
|
82
|
+
async onFailedAttempt({ error }) {
|
|
83
|
+
const errorMessage = error.message ?? "";
|
|
84
|
+
if (errorMessage.startsWith("Cancel") || errorMessage.startsWith("TimeoutError") || errorMessage.startsWith("AbortError")) throw error;
|
|
85
|
+
if (error?.code === "ECONNABORTED") throw error;
|
|
86
|
+
if (errorMessage.includes("ECONNREFUSED") || errorMessage.includes("fetch failed") || errorMessage.includes("Failed to fetch") || errorMessage.includes("NetworkError")) {
|
|
87
|
+
const connectionError = /* @__PURE__ */ new Error(`Unable to connect to LangGraph server. Please ensure the server is running and accessible. Original error: ${errorMessage}`);
|
|
88
|
+
connectionError.name = "ConnectionError";
|
|
89
|
+
throw connectionError;
|
|
90
|
+
}
|
|
91
|
+
if (error instanceof HTTPError) {
|
|
92
|
+
if (STATUS_NO_RETRY.includes(error.status)) throw error;
|
|
93
|
+
if (onFailedResponseHook && error.response) await onFailedResponseHook(error.response);
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
retries: this.maxRetries,
|
|
97
|
+
randomize: true
|
|
98
|
+
}), { throwOnTimeout: true });
|
|
99
|
+
}
|
|
100
|
+
callWithOptions(options, callable, ...args) {
|
|
101
|
+
if (options.signal) return Promise.race([this.call(callable, ...args), new Promise((_, reject) => {
|
|
102
|
+
options.signal?.addEventListener("abort", () => {
|
|
103
|
+
reject(/* @__PURE__ */ new Error("AbortError"));
|
|
104
|
+
});
|
|
105
|
+
})]);
|
|
106
|
+
return this.call(callable, ...args);
|
|
107
|
+
}
|
|
108
|
+
fetch(...args) {
|
|
109
|
+
const fetchFn = this.customFetch ?? _getFetchImplementation();
|
|
110
|
+
return this.call(() => fetchFn(...args).then((res) => res.ok ? res : Promise.reject(res)));
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
//#endregion
|
|
115
|
+
export { AsyncCaller };
|
|
116
|
+
//# sourceMappingURL=async_caller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"async_caller.js","names":[],"sources":["../../src/utils/async_caller.ts"],"sourcesContent":["import pRetry from \"p-retry\";\nimport PQueueMod from \"p-queue\";\nimport { _getFetchImplementation } from \"../singletons/fetch.js\";\n\nconst STATUS_NO_RETRY = [\n 400, // Bad Request\n 401, // Unauthorized\n 402, // Payment required\n 403, // Forbidden\n 404, // Not Found\n 405, // Method Not Allowed\n 406, // Not Acceptable\n 407, // Proxy Authentication Required\n 408, // Request Timeout\n 409, // Conflict\n 422, // Unprocessable Entity\n];\n\ntype ResponseCallback = (response?: Response) => Promise<boolean>;\n\nexport interface AsyncCallerParams {\n /**\n * The maximum number of concurrent calls that can be made.\n * Defaults to `Infinity`, which means no limit.\n */\n maxConcurrency?: number;\n /**\n * The maximum number of retries that can be made for a single call,\n * with an exponential backoff between each attempt. Defaults to 6.\n */\n maxRetries?: number;\n\n onFailedResponseHook?: ResponseCallback;\n\n /**\n * Specify a custom fetch implementation.\n *\n * By default we expect the `fetch` is available in the global scope.\n */\n fetch?: typeof fetch | ((...args: any[]) => any); // eslint-disable-line @typescript-eslint/no-explicit-any\n}\n\nexport interface AsyncCallerCallOptions {\n signal?: AbortSignal;\n}\n\n/**\n * Do not rely on globalThis.Response, rather just\n * do duck typing\n */\nfunction isResponse(x: unknown): x is Response {\n if (x == null || typeof x !== \"object\") return false;\n return \"status\" in x && \"statusText\" in x && \"text\" in x;\n}\n\n/**\n * Utility error to properly handle failed requests\n */\nclass HTTPError extends Error {\n status: number;\n\n text: string;\n\n response?: Response;\n\n constructor(status: number, message: string, response?: Response) {\n super(`HTTP ${status}: ${message}`);\n this.status = status;\n this.text = message;\n this.response = response;\n }\n\n static async fromResponse(\n response: Response,\n options?: { includeResponse?: boolean }\n ): Promise<HTTPError> {\n try {\n return new HTTPError(\n response.status,\n await response.text(),\n options?.includeResponse ? response : undefined\n );\n } catch {\n return new HTTPError(\n response.status,\n response.statusText,\n options?.includeResponse ? response : undefined\n );\n }\n }\n}\n\n/**\n * A class that can be used to make async calls with concurrency and retry logic.\n *\n * This is useful for making calls to any kind of \"expensive\" external resource,\n * be it because it's rate-limited, subject to network issues, etc.\n *\n * Concurrent calls are limited by the `maxConcurrency` parameter, which defaults\n * to `Infinity`. This means that by default, all calls will be made in parallel.\n *\n * Retries are limited by the `maxRetries` parameter, which defaults to 5. This\n * means that by default, each call will be retried up to 5 times, with an\n * exponential backoff between each attempt.\n */\nexport class AsyncCaller {\n protected maxConcurrency: AsyncCallerParams[\"maxConcurrency\"];\n\n protected maxRetries: AsyncCallerParams[\"maxRetries\"];\n\n private queue: typeof import(\"p-queue\")[\"default\"][\"prototype\"];\n\n private onFailedResponseHook?: ResponseCallback;\n\n private customFetch?: typeof fetch;\n\n constructor(params: AsyncCallerParams) {\n this.maxConcurrency = params.maxConcurrency ?? Infinity;\n this.maxRetries = params.maxRetries ?? 4;\n\n if (\"default\" in PQueueMod) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n this.queue = new (PQueueMod.default as any)({\n concurrency: this.maxConcurrency,\n });\n } else {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n this.queue = new (PQueueMod as any)({ concurrency: this.maxConcurrency });\n }\n this.onFailedResponseHook = params?.onFailedResponseHook;\n this.customFetch = params.fetch;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n call<A extends any[], T extends (...args: A) => Promise<any>>(\n callable: T,\n ...args: Parameters<T>\n ): Promise<Awaited<ReturnType<T>>> {\n const { onFailedResponseHook } = this;\n return this.queue.add(\n () =>\n pRetry(\n () =>\n callable(...(args as Parameters<T>)).catch(async (error) => {\n // eslint-disable-next-line no-instanceof/no-instanceof\n if (error instanceof Error) {\n throw error;\n } else if (isResponse(error)) {\n throw await HTTPError.fromResponse(error, {\n includeResponse: !!onFailedResponseHook,\n });\n } else {\n throw new Error(error);\n }\n }),\n {\n async onFailedAttempt({ error }) {\n const errorMessage = error.message ?? \"\";\n if (\n errorMessage.startsWith(\"Cancel\") ||\n errorMessage.startsWith(\"TimeoutError\") ||\n errorMessage.startsWith(\"AbortError\")\n ) {\n throw error;\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if ((error as any)?.code === \"ECONNABORTED\") {\n throw error;\n }\n\n // Check for connection refused errors (server not running)\n if (\n errorMessage.includes(\"ECONNREFUSED\") ||\n errorMessage.includes(\"fetch failed\") ||\n errorMessage.includes(\"Failed to fetch\") ||\n errorMessage.includes(\"NetworkError\")\n ) {\n const connectionError = new Error(\n `Unable to connect to LangGraph server. Please ensure the server is running and accessible. Original error: ${errorMessage}`\n );\n connectionError.name = \"ConnectionError\";\n throw connectionError;\n }\n\n // eslint-disable-next-line no-instanceof/no-instanceof\n if (error instanceof HTTPError) {\n if (STATUS_NO_RETRY.includes(error.status)) {\n throw error;\n }\n if (onFailedResponseHook && error.response) {\n await onFailedResponseHook(error.response);\n }\n }\n },\n // If needed we can change some of the defaults here,\n // but they're quite sensible.\n retries: this.maxRetries,\n randomize: true,\n }\n ),\n { throwOnTimeout: true }\n );\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n callWithOptions<A extends any[], T extends (...args: A) => Promise<any>>(\n options: AsyncCallerCallOptions,\n callable: T,\n ...args: Parameters<T>\n ): Promise<Awaited<ReturnType<T>>> {\n // Note this doesn't cancel the underlying request,\n // when available prefer to use the signal option of the underlying call\n if (options.signal) {\n return Promise.race([\n this.call<A, T>(callable, ...args),\n new Promise<never>((_, reject) => {\n options.signal?.addEventListener(\"abort\", () => {\n reject(new Error(\"AbortError\"));\n });\n }),\n ]);\n }\n return this.call<A, T>(callable, ...args);\n }\n\n fetch(...args: Parameters<typeof fetch>): ReturnType<typeof fetch> {\n const fetchFn =\n this.customFetch ?? (_getFetchImplementation() as typeof fetch);\n return this.call(() =>\n fetchFn(...args).then((res) => (res.ok ? res : Promise.reject(res)))\n );\n }\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/utils/env.ts
|
|
3
|
+
function getEnvironmentVariable(name) {
|
|
4
|
+
try {
|
|
5
|
+
return typeof process !== "undefined" ? process.env?.[name] : void 0;
|
|
6
|
+
} catch (e) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
exports.getEnvironmentVariable = getEnvironmentVariable;
|
|
13
|
+
//# sourceMappingURL=env.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.cjs","names":[],"sources":["../../src/utils/env.ts"],"sourcesContent":["export function getEnvironmentVariable(name: string): string | undefined {\n // Certain setups (Deno, frontend) will throw an error if you try to access environment variables\n try {\n return typeof process !== \"undefined\"\n ? // eslint-disable-next-line no-process-env\n process.env?.[name]\n : undefined;\n } catch (e) {\n return undefined;\n }\n}\n"],"mappings":";;AAAA,SAAgB,uBAAuB,MAAkC;AAEvE,KAAI;AACF,SAAO,OAAO,YAAY,cAEtB,QAAQ,MAAM,QACd;UACG,GAAG;AACV"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/utils/env.ts
|
|
2
|
+
function getEnvironmentVariable(name) {
|
|
3
|
+
try {
|
|
4
|
+
return typeof process !== "undefined" ? process.env?.[name] : void 0;
|
|
5
|
+
} catch (e) {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
export { getEnvironmentVariable };
|
|
12
|
+
//# sourceMappingURL=env.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.js","names":[],"sources":["../../src/utils/env.ts"],"sourcesContent":["export function getEnvironmentVariable(name: string): string | undefined {\n // Certain setups (Deno, frontend) will throw an error if you try to access environment variables\n try {\n return typeof process !== \"undefined\"\n ? // eslint-disable-next-line no-process-env\n process.env?.[name]\n : undefined;\n } catch (e) {\n return undefined;\n }\n}\n"],"mappings":";AAAA,SAAgB,uBAAuB,MAAkC;AAEvE,KAAI;AACF,SAAO,OAAO,YAAY,cAEtB,QAAQ,MAAM,QACd;UACG,GAAG;AACV"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/utils/error.ts
|
|
3
|
+
const isError = (error) => {
|
|
4
|
+
if ("isError" in Error && typeof Error.isError === "function") return Error.isError(error);
|
|
5
|
+
const stringTag = Object.prototype.toString.call(error);
|
|
6
|
+
return stringTag === "[object Error]" || stringTag === "[object DOMException]" || stringTag === "[object DOMError]" || stringTag === "[object Exception]";
|
|
7
|
+
};
|
|
8
|
+
const isNetworkError = (error) => {
|
|
9
|
+
if (!isError(error)) return false;
|
|
10
|
+
if (error.name !== "TypeError" || typeof error.message !== "string") return false;
|
|
11
|
+
const msg = error.message.toLowerCase();
|
|
12
|
+
return msg.includes("fetch") || msg.includes("network") || msg.includes("connection") || msg.includes("error sending request") || msg.includes("load failed");
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
exports.isNetworkError = isNetworkError;
|
|
17
|
+
//# sourceMappingURL=error.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.cjs","names":[],"sources":["../../src/utils/error.ts"],"sourcesContent":["export const isError = (error: unknown): error is Error => {\n // check for presence of `Error.isError` for newer browsers\n if (\"isError\" in Error && typeof Error.isError === \"function\") {\n return Error.isError(error);\n }\n\n // Resort to checking string tag\n const stringTag = Object.prototype.toString.call(error);\n return (\n stringTag === \"[object Error]\" ||\n stringTag === \"[object DOMException]\" ||\n stringTag === \"[object DOMError]\" ||\n stringTag === \"[object Exception]\"\n );\n};\n\nexport const isNetworkError = (error: unknown): error is Error => {\n if (!isError(error)) return false;\n if (error.name !== \"TypeError\" || typeof error.message !== \"string\") {\n return false;\n }\n const msg = error.message.toLowerCase();\n return (\n msg.includes(\"fetch\") ||\n msg.includes(\"network\") ||\n msg.includes(\"connection\") ||\n msg.includes(\"error sending request\") ||\n msg.includes(\"load failed\")\n );\n};\n"],"mappings":";;AAAA,MAAa,WAAW,UAAmC;AAEzD,KAAI,aAAa,SAAS,OAAO,MAAM,YAAY,WACjD,QAAO,MAAM,QAAQ,MAAM;CAI7B,MAAM,YAAY,OAAO,UAAU,SAAS,KAAK,MAAM;AACvD,QACE,cAAc,oBACd,cAAc,2BACd,cAAc,uBACd,cAAc;;AAIlB,MAAa,kBAAkB,UAAmC;AAChE,KAAI,CAAC,QAAQ,MAAM,CAAE,QAAO;AAC5B,KAAI,MAAM,SAAS,eAAe,OAAO,MAAM,YAAY,SACzD,QAAO;CAET,MAAM,MAAM,MAAM,QAAQ,aAAa;AACvC,QACE,IAAI,SAAS,QAAQ,IACrB,IAAI,SAAS,UAAU,IACvB,IAAI,SAAS,aAAa,IAC1B,IAAI,SAAS,wBAAwB,IACrC,IAAI,SAAS,cAAc"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/utils/error.ts
|
|
2
|
+
const isError = (error) => {
|
|
3
|
+
if ("isError" in Error && typeof Error.isError === "function") return Error.isError(error);
|
|
4
|
+
const stringTag = Object.prototype.toString.call(error);
|
|
5
|
+
return stringTag === "[object Error]" || stringTag === "[object DOMException]" || stringTag === "[object DOMError]" || stringTag === "[object Exception]";
|
|
6
|
+
};
|
|
7
|
+
const isNetworkError = (error) => {
|
|
8
|
+
if (!isError(error)) return false;
|
|
9
|
+
if (error.name !== "TypeError" || typeof error.message !== "string") return false;
|
|
10
|
+
const msg = error.message.toLowerCase();
|
|
11
|
+
return msg.includes("fetch") || msg.includes("network") || msg.includes("connection") || msg.includes("error sending request") || msg.includes("load failed");
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
export { isNetworkError };
|
|
16
|
+
//# sourceMappingURL=error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.js","names":[],"sources":["../../src/utils/error.ts"],"sourcesContent":["export const isError = (error: unknown): error is Error => {\n // check for presence of `Error.isError` for newer browsers\n if (\"isError\" in Error && typeof Error.isError === \"function\") {\n return Error.isError(error);\n }\n\n // Resort to checking string tag\n const stringTag = Object.prototype.toString.call(error);\n return (\n stringTag === \"[object Error]\" ||\n stringTag === \"[object DOMException]\" ||\n stringTag === \"[object DOMError]\" ||\n stringTag === \"[object Exception]\"\n );\n};\n\nexport const isNetworkError = (error: unknown): error is Error => {\n if (!isError(error)) return false;\n if (error.name !== \"TypeError\" || typeof error.message !== \"string\") {\n return false;\n }\n const msg = error.message.toLowerCase();\n return (\n msg.includes(\"fetch\") ||\n msg.includes(\"network\") ||\n msg.includes(\"connection\") ||\n msg.includes(\"error sending request\") ||\n msg.includes(\"load failed\")\n );\n};\n"],"mappings":";AAAA,MAAa,WAAW,UAAmC;AAEzD,KAAI,aAAa,SAAS,OAAO,MAAM,YAAY,WACjD,QAAO,MAAM,QAAQ,MAAM;CAI7B,MAAM,YAAY,OAAO,UAAU,SAAS,KAAK,MAAM;AACvD,QACE,cAAc,oBACd,cAAc,2BACd,cAAc,uBACd,cAAc;;AAIlB,MAAa,kBAAkB,UAAmC;AAChE,KAAI,CAAC,QAAQ,MAAM,CAAE,QAAO;AAC5B,KAAI,MAAM,SAAS,eAAe,OAAO,MAAM,YAAY,SACzD,QAAO;CAET,MAAM,MAAM,MAAM,QAAQ,aAAa;AACvC,QACE,IAAI,SAAS,QAAQ,IACrB,IAAI,SAAS,UAAU,IACvB,IAAI,SAAS,aAAa,IAC1B,IAAI,SAAS,wBAAwB,IACrC,IAAI,SAAS,cAAc"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/utils/signals.ts
|
|
3
|
+
function mergeSignals(...signals) {
|
|
4
|
+
const nonZeroSignals = signals.filter((signal) => signal != null);
|
|
5
|
+
if (nonZeroSignals.length === 0) return void 0;
|
|
6
|
+
if (nonZeroSignals.length === 1) return nonZeroSignals[0];
|
|
7
|
+
const controller = new AbortController();
|
|
8
|
+
for (const signal of signals) {
|
|
9
|
+
if (signal?.aborted) {
|
|
10
|
+
controller.abort(signal.reason);
|
|
11
|
+
return controller.signal;
|
|
12
|
+
}
|
|
13
|
+
signal?.addEventListener("abort", () => controller.abort(signal.reason), { once: true });
|
|
14
|
+
}
|
|
15
|
+
return controller.signal;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
exports.mergeSignals = mergeSignals;
|
|
20
|
+
//# sourceMappingURL=signals.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signals.cjs","names":[],"sources":["../../src/utils/signals.ts"],"sourcesContent":["export function mergeSignals(...signals: (AbortSignal | null | undefined)[]) {\n const nonZeroSignals = signals.filter(\n (signal): signal is AbortSignal => signal != null\n );\n\n if (nonZeroSignals.length === 0) return undefined;\n if (nonZeroSignals.length === 1) return nonZeroSignals[0];\n\n const controller = new AbortController();\n for (const signal of signals) {\n if (signal?.aborted) {\n controller.abort(signal.reason);\n return controller.signal;\n }\n\n signal?.addEventListener(\"abort\", () => controller.abort(signal.reason), {\n once: true,\n });\n }\n\n return controller.signal;\n}\n"],"mappings":";;AAAA,SAAgB,aAAa,GAAG,SAA6C;CAC3E,MAAM,iBAAiB,QAAQ,QAC5B,WAAkC,UAAU,KAC9C;AAED,KAAI,eAAe,WAAW,EAAG,QAAO;AACxC,KAAI,eAAe,WAAW,EAAG,QAAO,eAAe;CAEvD,MAAM,aAAa,IAAI,iBAAiB;AACxC,MAAK,MAAM,UAAU,SAAS;AAC5B,MAAI,QAAQ,SAAS;AACnB,cAAW,MAAM,OAAO,OAAO;AAC/B,UAAO,WAAW;;AAGpB,UAAQ,iBAAiB,eAAe,WAAW,MAAM,OAAO,OAAO,EAAE,EACvE,MAAM,MACP,CAAC;;AAGJ,QAAO,WAAW"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//#region src/utils/signals.ts
|
|
2
|
+
function mergeSignals(...signals) {
|
|
3
|
+
const nonZeroSignals = signals.filter((signal) => signal != null);
|
|
4
|
+
if (nonZeroSignals.length === 0) return void 0;
|
|
5
|
+
if (nonZeroSignals.length === 1) return nonZeroSignals[0];
|
|
6
|
+
const controller = new AbortController();
|
|
7
|
+
for (const signal of signals) {
|
|
8
|
+
if (signal?.aborted) {
|
|
9
|
+
controller.abort(signal.reason);
|
|
10
|
+
return controller.signal;
|
|
11
|
+
}
|
|
12
|
+
signal?.addEventListener("abort", () => controller.abort(signal.reason), { once: true });
|
|
13
|
+
}
|
|
14
|
+
return controller.signal;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
export { mergeSignals };
|
|
19
|
+
//# sourceMappingURL=signals.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signals.js","names":[],"sources":["../../src/utils/signals.ts"],"sourcesContent":["export function mergeSignals(...signals: (AbortSignal | null | undefined)[]) {\n const nonZeroSignals = signals.filter(\n (signal): signal is AbortSignal => signal != null\n );\n\n if (nonZeroSignals.length === 0) return undefined;\n if (nonZeroSignals.length === 1) return nonZeroSignals[0];\n\n const controller = new AbortController();\n for (const signal of signals) {\n if (signal?.aborted) {\n controller.abort(signal.reason);\n return controller.signal;\n }\n\n signal?.addEventListener(\"abort\", () => controller.abort(signal.reason), {\n once: true,\n });\n }\n\n return controller.signal;\n}\n"],"mappings":";AAAA,SAAgB,aAAa,GAAG,SAA6C;CAC3E,MAAM,iBAAiB,QAAQ,QAC5B,WAAkC,UAAU,KAC9C;AAED,KAAI,eAAe,WAAW,EAAG,QAAO;AACxC,KAAI,eAAe,WAAW,EAAG,QAAO,eAAe;CAEvD,MAAM,aAAa,IAAI,iBAAiB;AACxC,MAAK,MAAM,UAAU,SAAS;AAC5B,MAAI,QAAQ,SAAS;AACnB,cAAW,MAAM,OAAO,OAAO;AAC/B,UAAO,WAAW;;AAGpB,UAAQ,iBAAiB,eAAe,WAAW,MAAM,OAAO,OAAO,EAAE,EACvE,MAAM,MACP,CAAC;;AAGJ,QAAO,WAAW"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/utils/sse.ts
|
|
3
|
+
const CR = "\r".charCodeAt(0);
|
|
4
|
+
const LF = "\n".charCodeAt(0);
|
|
5
|
+
const NULL = "\0".charCodeAt(0);
|
|
6
|
+
const COLON = ":".charCodeAt(0);
|
|
7
|
+
const SPACE = " ".charCodeAt(0);
|
|
8
|
+
const TRAILING_NEWLINE = [CR, LF];
|
|
9
|
+
function BytesLineDecoder() {
|
|
10
|
+
let buffer = [];
|
|
11
|
+
let trailingCr = false;
|
|
12
|
+
return new TransformStream({
|
|
13
|
+
start() {
|
|
14
|
+
buffer = [];
|
|
15
|
+
trailingCr = false;
|
|
16
|
+
},
|
|
17
|
+
transform(chunk, controller) {
|
|
18
|
+
let text = chunk;
|
|
19
|
+
if (trailingCr) {
|
|
20
|
+
text = joinArrays([[CR], text]);
|
|
21
|
+
trailingCr = false;
|
|
22
|
+
}
|
|
23
|
+
if (text.length > 0 && text.at(-1) === CR) {
|
|
24
|
+
trailingCr = true;
|
|
25
|
+
text = text.subarray(0, -1);
|
|
26
|
+
}
|
|
27
|
+
if (!text.length) return;
|
|
28
|
+
const trailingNewline = TRAILING_NEWLINE.includes(text.at(-1));
|
|
29
|
+
const lastIdx = text.length - 1;
|
|
30
|
+
const { lines } = text.reduce((acc, cur, idx) => {
|
|
31
|
+
if (acc.from > idx) return acc;
|
|
32
|
+
if (cur === CR || cur === LF) {
|
|
33
|
+
acc.lines.push(text.subarray(acc.from, idx));
|
|
34
|
+
if (cur === CR && text[idx + 1] === LF) acc.from = idx + 2;
|
|
35
|
+
else acc.from = idx + 1;
|
|
36
|
+
}
|
|
37
|
+
if (idx === lastIdx && acc.from <= lastIdx) acc.lines.push(text.subarray(acc.from));
|
|
38
|
+
return acc;
|
|
39
|
+
}, {
|
|
40
|
+
lines: [],
|
|
41
|
+
from: 0
|
|
42
|
+
});
|
|
43
|
+
if (lines.length === 1 && !trailingNewline) {
|
|
44
|
+
buffer.push(lines[0]);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (buffer.length) {
|
|
48
|
+
buffer.push(lines[0]);
|
|
49
|
+
lines[0] = joinArrays(buffer);
|
|
50
|
+
buffer = [];
|
|
51
|
+
}
|
|
52
|
+
if (!trailingNewline) {
|
|
53
|
+
if (lines.length) buffer = [lines.pop()];
|
|
54
|
+
}
|
|
55
|
+
for (const line of lines) controller.enqueue(line);
|
|
56
|
+
},
|
|
57
|
+
flush(controller) {
|
|
58
|
+
if (buffer.length) controller.enqueue(joinArrays(buffer));
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
function SSEDecoder() {
|
|
63
|
+
let event = "";
|
|
64
|
+
let data = [];
|
|
65
|
+
let lastEventId = "";
|
|
66
|
+
let retry = null;
|
|
67
|
+
const decoder = new TextDecoder();
|
|
68
|
+
return new TransformStream({
|
|
69
|
+
transform(chunk, controller) {
|
|
70
|
+
if (!chunk.length) {
|
|
71
|
+
if (!event && !data.length && !lastEventId && retry == null) return;
|
|
72
|
+
const sse = {
|
|
73
|
+
id: lastEventId || void 0,
|
|
74
|
+
event,
|
|
75
|
+
data: data.length ? decodeArraysToJson(decoder, data) : null
|
|
76
|
+
};
|
|
77
|
+
event = "";
|
|
78
|
+
data = [];
|
|
79
|
+
retry = null;
|
|
80
|
+
controller.enqueue(sse);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if (chunk[0] === COLON) return;
|
|
84
|
+
const sepIdx = chunk.indexOf(COLON);
|
|
85
|
+
if (sepIdx === -1) return;
|
|
86
|
+
const fieldName = decoder.decode(chunk.subarray(0, sepIdx));
|
|
87
|
+
let value = chunk.subarray(sepIdx + 1);
|
|
88
|
+
if (value[0] === SPACE) value = value.subarray(1);
|
|
89
|
+
if (fieldName === "event") event = decoder.decode(value);
|
|
90
|
+
else if (fieldName === "data") data.push(value);
|
|
91
|
+
else if (fieldName === "id") {
|
|
92
|
+
if (value.indexOf(NULL) === -1) lastEventId = decoder.decode(value);
|
|
93
|
+
} else if (fieldName === "retry") {
|
|
94
|
+
const retryNum = Number.parseInt(decoder.decode(value), 10);
|
|
95
|
+
if (!Number.isNaN(retryNum)) retry = retryNum;
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
flush(controller) {
|
|
99
|
+
if (event) controller.enqueue({
|
|
100
|
+
id: lastEventId || void 0,
|
|
101
|
+
event,
|
|
102
|
+
data: data.length ? decodeArraysToJson(decoder, data) : null
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
function joinArrays(data) {
|
|
108
|
+
const totalLength = data.reduce((acc, curr) => acc + curr.length, 0);
|
|
109
|
+
const merged = new Uint8Array(totalLength);
|
|
110
|
+
let offset = 0;
|
|
111
|
+
for (const c of data) {
|
|
112
|
+
merged.set(c, offset);
|
|
113
|
+
offset += c.length;
|
|
114
|
+
}
|
|
115
|
+
return merged;
|
|
116
|
+
}
|
|
117
|
+
function decodeArraysToJson(decoder, data) {
|
|
118
|
+
return JSON.parse(decoder.decode(joinArrays(data)));
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
//#endregion
|
|
122
|
+
exports.BytesLineDecoder = BytesLineDecoder;
|
|
123
|
+
exports.SSEDecoder = SSEDecoder;
|
|
124
|
+
//# sourceMappingURL=sse.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sse.cjs","names":[],"sources":["../../src/utils/sse.ts"],"sourcesContent":["const CR = \"\\r\".charCodeAt(0);\nconst LF = \"\\n\".charCodeAt(0);\nconst NULL = \"\\0\".charCodeAt(0);\nconst COLON = \":\".charCodeAt(0);\nconst SPACE = \" \".charCodeAt(0);\n\nconst TRAILING_NEWLINE = [CR, LF];\n\nexport function BytesLineDecoder() {\n let buffer: Uint8Array[] = [];\n let trailingCr = false;\n\n return new TransformStream<Uint8Array, Uint8Array>({\n start() {\n buffer = [];\n trailingCr = false;\n },\n\n transform(chunk, controller) {\n // See https://docs.python.org/3/glossary.html#term-universal-newlines\n let text = chunk;\n\n // Handle trailing CR from previous chunk\n if (trailingCr) {\n text = joinArrays([[CR], text]);\n trailingCr = false;\n }\n\n // Check for trailing CR in current chunk\n if (text.length > 0 && text.at(-1) === CR) {\n trailingCr = true;\n text = text.subarray(0, -1);\n }\n\n if (!text.length) return;\n const trailingNewline = TRAILING_NEWLINE.includes(text.at(-1)!);\n\n const lastIdx = text.length - 1;\n const { lines } = text.reduce<{ lines: Uint8Array[]; from: number }>(\n (acc, cur, idx) => {\n if (acc.from > idx) return acc;\n\n if (cur === CR || cur === LF) {\n acc.lines.push(text.subarray(acc.from, idx));\n if (cur === CR && text[idx + 1] === LF) {\n acc.from = idx + 2;\n } else {\n acc.from = idx + 1;\n }\n }\n\n if (idx === lastIdx && acc.from <= lastIdx) {\n acc.lines.push(text.subarray(acc.from));\n }\n\n return acc;\n },\n { lines: [], from: 0 }\n );\n\n if (lines.length === 1 && !trailingNewline) {\n buffer.push(lines[0]);\n return;\n }\n\n if (buffer.length) {\n // Include existing buffer in first line\n buffer.push(lines[0]);\n lines[0] = joinArrays(buffer);\n buffer = [];\n }\n\n if (!trailingNewline) {\n // If the last segment is not newline terminated,\n // buffer it for the next chunk\n if (lines.length) buffer = [lines.pop()!];\n }\n\n // Enqueue complete lines\n for (const line of lines) {\n controller.enqueue(line);\n }\n },\n\n flush(controller) {\n if (buffer.length) {\n controller.enqueue(joinArrays(buffer));\n }\n },\n });\n}\n\ninterface StreamPart {\n id: string | undefined;\n event: string;\n data: unknown;\n}\n\nexport function SSEDecoder() {\n let event = \"\";\n let data: Uint8Array[] = [];\n let lastEventId = \"\";\n let retry: number | null = null;\n\n const decoder = new TextDecoder();\n\n return new TransformStream<Uint8Array, StreamPart>({\n transform(chunk, controller) {\n // Handle empty line case\n if (!chunk.length) {\n if (!event && !data.length && !lastEventId && retry == null) return;\n\n const sse = {\n id: lastEventId || undefined,\n event,\n data: data.length ? decodeArraysToJson(decoder, data) : null,\n };\n\n // NOTE: as per the SSE spec, do not reset lastEventId\n event = \"\";\n data = [];\n retry = null;\n\n controller.enqueue(sse);\n return;\n }\n\n // Ignore comments\n if (chunk[0] === COLON) return;\n\n const sepIdx = chunk.indexOf(COLON);\n if (sepIdx === -1) return;\n\n const fieldName = decoder.decode(chunk.subarray(0, sepIdx));\n let value = chunk.subarray(sepIdx + 1);\n if (value[0] === SPACE) value = value.subarray(1);\n\n if (fieldName === \"event\") {\n event = decoder.decode(value);\n } else if (fieldName === \"data\") {\n data.push(value);\n } else if (fieldName === \"id\") {\n if (value.indexOf(NULL) === -1) lastEventId = decoder.decode(value);\n } else if (fieldName === \"retry\") {\n const retryNum = Number.parseInt(decoder.decode(value), 10);\n if (!Number.isNaN(retryNum)) retry = retryNum;\n }\n },\n\n flush(controller) {\n if (event) {\n controller.enqueue({\n id: lastEventId || undefined,\n event,\n data: data.length ? decodeArraysToJson(decoder, data) : null,\n });\n }\n },\n });\n}\n\nfunction joinArrays(data: ArrayLike<number>[]) {\n const totalLength = data.reduce((acc, curr) => acc + curr.length, 0);\n const merged = new Uint8Array(totalLength);\n let offset = 0;\n for (const c of data) {\n merged.set(c, offset);\n offset += c.length;\n }\n return merged;\n}\n\nfunction decodeArraysToJson(decoder: TextDecoder, data: ArrayLike<number>[]) {\n return JSON.parse(decoder.decode(joinArrays(data)));\n}\n"],"mappings":"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"}
|