cloneforce 0.0.2 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (200) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/client.d.mts +1 -1
  3. package/client.d.ts +1 -1
  4. package/client.js +3 -3
  5. package/client.mjs +3 -3
  6. package/core/streaming.d.mts +33 -0
  7. package/core/streaming.d.mts.map +1 -0
  8. package/core/streaming.d.ts +33 -0
  9. package/core/streaming.d.ts.map +1 -0
  10. package/core/streaming.js +263 -0
  11. package/core/streaming.js.map +1 -0
  12. package/core/streaming.mjs +258 -0
  13. package/core/streaming.mjs.map +1 -0
  14. package/internal/decoders/line.d.mts +17 -0
  15. package/internal/decoders/line.d.mts.map +1 -0
  16. package/internal/decoders/line.d.ts +17 -0
  17. package/internal/decoders/line.d.ts.map +1 -0
  18. package/internal/decoders/line.js +113 -0
  19. package/internal/decoders/line.js.map +1 -0
  20. package/internal/decoders/line.mjs +108 -0
  21. package/internal/decoders/line.mjs.map +1 -0
  22. package/internal/parse.d.mts.map +1 -1
  23. package/internal/parse.d.ts.map +1 -1
  24. package/internal/parse.js +10 -0
  25. package/internal/parse.js.map +1 -1
  26. package/internal/parse.mjs +10 -0
  27. package/internal/parse.mjs.map +1 -1
  28. package/internal/request-options.d.mts +2 -0
  29. package/internal/request-options.d.mts.map +1 -1
  30. package/internal/request-options.d.ts +2 -0
  31. package/internal/request-options.d.ts.map +1 -1
  32. package/internal/request-options.js.map +1 -1
  33. package/internal/request-options.mjs.map +1 -1
  34. package/internal/tslib.js +17 -17
  35. package/package.json +12 -2
  36. package/resources/v1/clones/activity.js +3 -3
  37. package/resources/v1/clones/activity.js.map +1 -1
  38. package/resources/v1/clones/activity.mjs +3 -3
  39. package/resources/v1/clones/activity.mjs.map +1 -1
  40. package/resources/v1/clones/chats/chats.d.mts +39 -0
  41. package/resources/v1/clones/chats/chats.d.mts.map +1 -0
  42. package/resources/v1/clones/chats/chats.d.ts +39 -0
  43. package/resources/v1/clones/chats/chats.d.ts.map +1 -0
  44. package/resources/v1/clones/chats/chats.js +27 -0
  45. package/resources/v1/clones/chats/chats.js.map +1 -0
  46. package/resources/v1/clones/chats/chats.mjs +22 -0
  47. package/resources/v1/clones/chats/chats.mjs.map +1 -0
  48. package/resources/v1/clones/chats/completions.d.mts +77 -0
  49. package/resources/v1/clones/chats/completions.d.mts.map +1 -0
  50. package/resources/v1/clones/chats/completions.d.ts +77 -0
  51. package/resources/v1/clones/chats/completions.d.ts.map +1 -0
  52. package/resources/v1/clones/chats/completions.js +21 -0
  53. package/resources/v1/clones/chats/completions.js.map +1 -0
  54. package/resources/v1/clones/chats/completions.mjs +17 -0
  55. package/resources/v1/clones/chats/completions.mjs.map +1 -0
  56. package/resources/v1/clones/chats/index.d.mts +3 -0
  57. package/resources/v1/clones/chats/index.d.mts.map +1 -0
  58. package/resources/v1/clones/chats/index.d.ts +3 -0
  59. package/resources/v1/clones/chats/index.d.ts.map +1 -0
  60. package/resources/v1/clones/chats/index.js +9 -0
  61. package/resources/v1/clones/chats/index.js.map +1 -0
  62. package/resources/v1/clones/chats/index.mjs +4 -0
  63. package/resources/v1/clones/chats/index.mjs.map +1 -0
  64. package/resources/v1/clones/chats.d.mts +2 -0
  65. package/resources/v1/clones/chats.d.mts.map +1 -0
  66. package/resources/v1/clones/chats.d.ts +2 -0
  67. package/resources/v1/clones/chats.d.ts.map +1 -0
  68. package/resources/v1/clones/chats.js +6 -0
  69. package/resources/v1/clones/chats.js.map +1 -0
  70. package/resources/v1/clones/chats.mjs +3 -0
  71. package/resources/v1/clones/chats.mjs.map +1 -0
  72. package/resources/v1/clones/clones.d.mts +8 -4
  73. package/resources/v1/clones/clones.d.mts.map +1 -1
  74. package/resources/v1/clones/clones.d.ts +8 -4
  75. package/resources/v1/clones/clones.d.ts.map +1 -1
  76. package/resources/v1/clones/clones.js +5 -1
  77. package/resources/v1/clones/clones.js.map +1 -1
  78. package/resources/v1/clones/clones.mjs +5 -1
  79. package/resources/v1/clones/clones.mjs.map +1 -1
  80. package/resources/v1/clones/files.js +4 -4
  81. package/resources/v1/clones/files.js.map +1 -1
  82. package/resources/v1/clones/files.mjs +4 -4
  83. package/resources/v1/clones/files.mjs.map +1 -1
  84. package/resources/v1/clones/gallery.js +4 -4
  85. package/resources/v1/clones/gallery.js.map +1 -1
  86. package/resources/v1/clones/gallery.mjs +4 -4
  87. package/resources/v1/clones/gallery.mjs.map +1 -1
  88. package/resources/v1/clones/headshot.js +1 -1
  89. package/resources/v1/clones/headshot.js.map +1 -1
  90. package/resources/v1/clones/headshot.mjs +1 -1
  91. package/resources/v1/clones/headshot.mjs.map +1 -1
  92. package/resources/v1/clones/index.d.mts +3 -2
  93. package/resources/v1/clones/index.d.mts.map +1 -1
  94. package/resources/v1/clones/index.d.ts +3 -2
  95. package/resources/v1/clones/index.d.ts.map +1 -1
  96. package/resources/v1/clones/index.js +7 -5
  97. package/resources/v1/clones/index.js.map +1 -1
  98. package/resources/v1/clones/index.mjs +1 -0
  99. package/resources/v1/clones/index.mjs.map +1 -1
  100. package/resources/v1/clones/integrations/index.d.mts +1 -1
  101. package/resources/v1/clones/integrations/index.d.mts.map +1 -1
  102. package/resources/v1/clones/integrations/index.d.ts +1 -1
  103. package/resources/v1/clones/integrations/index.d.ts.map +1 -1
  104. package/resources/v1/clones/integrations/integrations.d.mts +7 -7
  105. package/resources/v1/clones/integrations/integrations.d.mts.map +1 -1
  106. package/resources/v1/clones/integrations/integrations.d.ts +7 -7
  107. package/resources/v1/clones/integrations/integrations.d.ts.map +1 -1
  108. package/resources/v1/clones/integrations/integrations.js +7 -7
  109. package/resources/v1/clones/integrations/integrations.js.map +1 -1
  110. package/resources/v1/clones/integrations/integrations.mjs +7 -7
  111. package/resources/v1/clones/integrations/integrations.mjs.map +1 -1
  112. package/resources/v1/clones/integrations/msteams.js +1 -1
  113. package/resources/v1/clones/integrations/msteams.js.map +1 -1
  114. package/resources/v1/clones/integrations/msteams.mjs +1 -1
  115. package/resources/v1/clones/integrations/msteams.mjs.map +1 -1
  116. package/resources/v1/clones/integrations/slack.js +2 -2
  117. package/resources/v1/clones/integrations/slack.js.map +1 -1
  118. package/resources/v1/clones/integrations/slack.mjs +2 -2
  119. package/resources/v1/clones/integrations/slack.mjs.map +1 -1
  120. package/resources/v1/clones/profile.d.mts +4 -4
  121. package/resources/v1/clones/profile.d.mts.map +1 -1
  122. package/resources/v1/clones/profile.d.ts +4 -4
  123. package/resources/v1/clones/profile.d.ts.map +1 -1
  124. package/resources/v1/clones/profile.js +4 -4
  125. package/resources/v1/clones/profile.js.map +1 -1
  126. package/resources/v1/clones/profile.mjs +4 -4
  127. package/resources/v1/clones/profile.mjs.map +1 -1
  128. package/resources/v1/clones/skills/connections.js +2 -5
  129. package/resources/v1/clones/skills/connections.js.map +1 -1
  130. package/resources/v1/clones/skills/connections.mjs +2 -5
  131. package/resources/v1/clones/skills/connections.mjs.map +1 -1
  132. package/resources/v1/clones/skills/skills.js +4 -4
  133. package/resources/v1/clones/skills/skills.js.map +1 -1
  134. package/resources/v1/clones/skills/skills.mjs +4 -4
  135. package/resources/v1/clones/skills/skills.mjs.map +1 -1
  136. package/resources/v1/clones/tasks.js +5 -5
  137. package/resources/v1/clones/tasks.js.map +1 -1
  138. package/resources/v1/clones/tasks.mjs +5 -5
  139. package/resources/v1/clones/tasks.mjs.map +1 -1
  140. package/resources/v1/clones/voice.js +1 -1
  141. package/resources/v1/clones/voice.js.map +1 -1
  142. package/resources/v1/clones/voice.mjs +1 -1
  143. package/resources/v1/clones/voice.mjs.map +1 -1
  144. package/resources/v1/connections.d.mts +1 -1
  145. package/resources/v1/connections.d.mts.map +1 -1
  146. package/resources/v1/connections.d.ts +1 -1
  147. package/resources/v1/connections.d.ts.map +1 -1
  148. package/resources/v1/connections.js +9 -9
  149. package/resources/v1/connections.js.map +1 -1
  150. package/resources/v1/connections.mjs +9 -9
  151. package/resources/v1/connections.mjs.map +1 -1
  152. package/resources/v1/integrations/phone.js +1 -1
  153. package/resources/v1/integrations/phone.js.map +1 -1
  154. package/resources/v1/integrations/phone.mjs +1 -1
  155. package/resources/v1/integrations/phone.mjs.map +1 -1
  156. package/resources/v1/skills.js +2 -2
  157. package/resources/v1/skills.js.map +1 -1
  158. package/resources/v1/skills.mjs +2 -2
  159. package/resources/v1/skills.mjs.map +1 -1
  160. package/src/client.ts +3 -3
  161. package/src/core/streaming.ts +315 -0
  162. package/src/internal/decoders/line.ts +135 -0
  163. package/src/internal/parse.ts +14 -0
  164. package/src/internal/request-options.ts +2 -0
  165. package/src/resources/v1/clones/activity.ts +3 -3
  166. package/src/resources/v1/clones/chats/chats.ts +77 -0
  167. package/src/resources/v1/clones/chats/completions.ts +125 -0
  168. package/src/resources/v1/clones/chats/index.ts +11 -0
  169. package/src/resources/v1/clones/chats.ts +3 -0
  170. package/src/resources/v1/clones/clones.ts +22 -11
  171. package/src/resources/v1/clones/files.ts +4 -4
  172. package/src/resources/v1/clones/gallery.ts +4 -4
  173. package/src/resources/v1/clones/headshot.ts +1 -1
  174. package/src/resources/v1/clones/index.ts +11 -5
  175. package/src/resources/v1/clones/integrations/index.ts +4 -4
  176. package/src/resources/v1/clones/integrations/integrations.ts +20 -20
  177. package/src/resources/v1/clones/integrations/msteams.ts +1 -1
  178. package/src/resources/v1/clones/integrations/slack.ts +2 -2
  179. package/src/resources/v1/clones/profile.ts +6 -6
  180. package/src/resources/v1/clones/skills/connections.ts +5 -5
  181. package/src/resources/v1/clones/skills/skills.ts +4 -4
  182. package/src/resources/v1/clones/tasks.ts +5 -5
  183. package/src/resources/v1/clones/voice.ts +1 -1
  184. package/src/resources/v1/connections.ts +10 -10
  185. package/src/resources/v1/integrations/phone.ts +1 -1
  186. package/src/resources/v1/skills.ts +2 -2
  187. package/src/streaming.ts +2 -0
  188. package/src/version.ts +1 -1
  189. package/streaming.d.mts +2 -0
  190. package/streaming.d.mts.map +1 -0
  191. package/streaming.d.ts +2 -0
  192. package/streaming.d.ts.map +1 -0
  193. package/streaming.js +6 -0
  194. package/streaming.js.map +1 -0
  195. package/streaming.mjs +2 -0
  196. package/streaming.mjs.map +1 -0
  197. package/version.d.mts +1 -1
  198. package/version.d.ts +1 -1
  199. package/version.js +1 -1
  200. package/version.mjs +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.1 (2026-03-22)
4
+
5
+ Full Changelog: [v0.1.0...v0.1.1](https://github.com/clone-global/cloneforce-typescript/compare/v0.1.0...v0.1.1)
6
+
7
+ ### Chores
8
+
9
+ * update SDK settings ([f4ce60b](https://github.com/clone-global/cloneforce-typescript/commit/f4ce60b9e5b8b50e83784875c07e25e3a2816931))
10
+
11
+ ## 0.1.0 (2026-03-22)
12
+
13
+ Full Changelog: [v0.0.3...v0.1.0](https://github.com/clone-global/cloneforce-typescript/compare/v0.0.3...v0.1.0)
14
+
15
+ ### Features
16
+
17
+ * update SDK versions ([50a145d](https://github.com/clone-global/cloneforce-typescript/commit/50a145d1217ce87c591446c680fe9ad524f4e506))
18
+
19
+ ## 0.0.3 (2026-03-21)
20
+
21
+ Full Changelog: [v0.0.2...v0.0.3](https://github.com/clone-global/cloneforce-typescript/compare/v0.0.2...v0.0.3)
22
+
23
+ ### Chores
24
+
25
+ * update SDK settings ([5b82c53](https://github.com/clone-global/cloneforce-typescript/commit/5b82c53942948df76a02b6a76a3244285d3e9184))
26
+
3
27
  ## 0.0.2 (2026-03-21)
4
28
 
5
29
  Full Changelog: [v0.0.1...v0.0.2](https://github.com/clone-global/cloneforce-typescript/compare/v0.0.1...v0.0.2)
package/client.d.mts CHANGED
@@ -96,7 +96,7 @@ export declare class Cloneforce {
96
96
  * API Client for interfacing with the Cloneforce API.
97
97
  *
98
98
  * @param {string | undefined} [opts.apiKey=process.env['CLONEFORCE_API_KEY'] ?? undefined]
99
- * @param {string} [opts.baseURL=process.env['CLONEFORCE_BASE_URL'] ?? https://app.cloneforce.com] - Override the default base URL for the API.
99
+ * @param {string} [opts.baseURL=process.env['CLONEFORCE_BASE_URL'] ?? https://api.cloneforce.com] - Override the default base URL for the API.
100
100
  * @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
101
101
  * @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
102
102
  * @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
package/client.d.ts CHANGED
@@ -96,7 +96,7 @@ export declare class Cloneforce {
96
96
  * API Client for interfacing with the Cloneforce API.
97
97
  *
98
98
  * @param {string | undefined} [opts.apiKey=process.env['CLONEFORCE_API_KEY'] ?? undefined]
99
- * @param {string} [opts.baseURL=process.env['CLONEFORCE_BASE_URL'] ?? https://app.cloneforce.com] - Override the default base URL for the API.
99
+ * @param {string} [opts.baseURL=process.env['CLONEFORCE_BASE_URL'] ?? https://api.cloneforce.com] - Override the default base URL for the API.
100
100
  * @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
101
101
  * @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
102
102
  * @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
package/client.js CHANGED
@@ -30,7 +30,7 @@ class Cloneforce {
30
30
  * API Client for interfacing with the Cloneforce API.
31
31
  *
32
32
  * @param {string | undefined} [opts.apiKey=process.env['CLONEFORCE_API_KEY'] ?? undefined]
33
- * @param {string} [opts.baseURL=process.env['CLONEFORCE_BASE_URL'] ?? https://app.cloneforce.com] - Override the default base URL for the API.
33
+ * @param {string} [opts.baseURL=process.env['CLONEFORCE_BASE_URL'] ?? https://api.cloneforce.com] - Override the default base URL for the API.
34
34
  * @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
35
35
  * @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
36
36
  * @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
@@ -48,7 +48,7 @@ class Cloneforce {
48
48
  const options = {
49
49
  apiKey,
50
50
  ...opts,
51
- baseURL: baseURL || `https://app.cloneforce.com`,
51
+ baseURL: baseURL || `https://api.cloneforce.com`,
52
52
  };
53
53
  this.baseURL = options.baseURL;
54
54
  this.timeout = options.timeout ?? _a.DEFAULT_TIMEOUT /* 1 minute */;
@@ -443,7 +443,7 @@ class Cloneforce {
443
443
  }
444
444
  exports.Cloneforce = Cloneforce;
445
445
  _a = Cloneforce, _Cloneforce_encoder = new WeakMap(), _Cloneforce_instances = new WeakSet(), _Cloneforce_baseURLOverridden = function _Cloneforce_baseURLOverridden() {
446
- return this.baseURL !== 'https://app.cloneforce.com';
446
+ return this.baseURL !== 'https://api.cloneforce.com';
447
447
  };
448
448
  Cloneforce.Cloneforce = _a;
449
449
  Cloneforce.DEFAULT_TIMEOUT = 60000; // 1 minute
package/client.mjs CHANGED
@@ -27,7 +27,7 @@ export class Cloneforce {
27
27
  * API Client for interfacing with the Cloneforce API.
28
28
  *
29
29
  * @param {string | undefined} [opts.apiKey=process.env['CLONEFORCE_API_KEY'] ?? undefined]
30
- * @param {string} [opts.baseURL=process.env['CLONEFORCE_BASE_URL'] ?? https://app.cloneforce.com] - Override the default base URL for the API.
30
+ * @param {string} [opts.baseURL=process.env['CLONEFORCE_BASE_URL'] ?? https://api.cloneforce.com] - Override the default base URL for the API.
31
31
  * @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
32
32
  * @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
33
33
  * @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
@@ -45,7 +45,7 @@ export class Cloneforce {
45
45
  const options = {
46
46
  apiKey,
47
47
  ...opts,
48
- baseURL: baseURL || `https://app.cloneforce.com`,
48
+ baseURL: baseURL || `https://api.cloneforce.com`,
49
49
  };
50
50
  this.baseURL = options.baseURL;
51
51
  this.timeout = options.timeout ?? _a.DEFAULT_TIMEOUT /* 1 minute */;
@@ -439,7 +439,7 @@ export class Cloneforce {
439
439
  }
440
440
  }
441
441
  _a = Cloneforce, _Cloneforce_encoder = new WeakMap(), _Cloneforce_instances = new WeakSet(), _Cloneforce_baseURLOverridden = function _Cloneforce_baseURLOverridden() {
442
- return this.baseURL !== 'https://app.cloneforce.com';
442
+ return this.baseURL !== 'https://api.cloneforce.com';
443
443
  };
444
444
  Cloneforce.Cloneforce = _a;
445
445
  Cloneforce.DEFAULT_TIMEOUT = 60000; // 1 minute
@@ -0,0 +1,33 @@
1
+ import { type ReadableStream } from "../internal/shim-types.mjs";
2
+ import type { Cloneforce } from "../client.mjs";
3
+ export type ServerSentEvent = {
4
+ event: string | null;
5
+ data: string;
6
+ raw: string[];
7
+ };
8
+ export declare class Stream<Item> implements AsyncIterable<Item> {
9
+ #private;
10
+ private iterator;
11
+ controller: AbortController;
12
+ constructor(iterator: () => AsyncIterator<Item>, controller: AbortController, client?: Cloneforce);
13
+ static fromSSEResponse<Item>(response: Response, controller: AbortController, client?: Cloneforce): Stream<Item>;
14
+ /**
15
+ * Generates a Stream from a newline-separated ReadableStream
16
+ * where each item is a JSON value.
17
+ */
18
+ static fromReadableStream<Item>(readableStream: ReadableStream, controller: AbortController, client?: Cloneforce): Stream<Item>;
19
+ [Symbol.asyncIterator](): AsyncIterator<Item>;
20
+ /**
21
+ * Splits the stream into two streams which can be
22
+ * independently read from at different speeds.
23
+ */
24
+ tee(): [Stream<Item>, Stream<Item>];
25
+ /**
26
+ * Converts this stream to a newline-separated ReadableStream of
27
+ * JSON stringified values in the stream
28
+ * which can be turned back into a Stream with `Stream.fromReadableStream()`.
29
+ */
30
+ toReadableStream(): ReadableStream;
31
+ }
32
+ export declare function _iterSSEMessages(response: Response, controller: AbortController): AsyncGenerator<ServerSentEvent, void, unknown>;
33
+ //# sourceMappingURL=streaming.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"streaming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loneforce } from "../client.js";
3
+ export type ServerSentEvent = {
4
+ event: string | null;
5
+ data: string;
6
+ raw: string[];
7
+ };
8
+ export declare class Stream<Item> implements AsyncIterable<Item> {
9
+ #private;
10
+ private iterator;
11
+ controller: AbortController;
12
+ constructor(iterator: () => AsyncIterator<Item>, controller: AbortController, client?: Cloneforce);
13
+ static fromSSEResponse<Item>(response: Response, controller: AbortController, client?: Cloneforce): Stream<Item>;
14
+ /**
15
+ * Generates a Stream from a newline-separated ReadableStream
16
+ * where each item is a JSON value.
17
+ */
18
+ static fromReadableStream<Item>(readableStream: ReadableStream, controller: AbortController, client?: Cloneforce): Stream<Item>;
19
+ [Symbol.asyncIterator](): AsyncIterator<Item>;
20
+ /**
21
+ * Splits the stream into two streams which can be
22
+ * independently read from at different speeds.
23
+ */
24
+ tee(): [Stream<Item>, Stream<Item>];
25
+ /**
26
+ * Converts this stream to a newline-separated ReadableStream of
27
+ * JSON stringified values in the stream
28
+ * which can be turned back into a Stream with `Stream.fromReadableStream()`.
29
+ */
30
+ toReadableStream(): ReadableStream;
31
+ }
32
+ export declare function _iterSSEMessages(response: Response, controller: AbortController): AsyncGenerator<ServerSentEvent, void, unknown>;
33
+ //# sourceMappingURL=streaming.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"streaming.d.ts","sourceRoot":"","sources":["../src/core/streaming.ts"],"names":[],"mappings":"OACO,EAAE,KAAK,cAAc,EAAE;OAOvB,KAAK,EAAE,UAAU,EAAE;AAI1B,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,EAAE,CAAC;CACf,CAAC;AAEF,qBAAa,MAAM,CAAC,IAAI,CAAE,YAAW,aAAa,CAAC,IAAI,CAAC;;IAKpD,OAAO,CAAC,QAAQ;IAJlB,UAAU,EAAE,eAAe,CAAC;gBAIlB,QAAQ,EAAE,MAAM,aAAa,CAAC,IAAI,CAAC,EAC3C,UAAU,EAAE,eAAe,EAC3B,MAAM,CAAC,EAAE,UAAU;IAMrB,MAAM,CAAC,eAAe,CAAC,IAAI,EACzB,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,eAAe,EAC3B,MAAM,CAAC,EAAE,UAAU,GAClB,MAAM,CAAC,IAAI,CAAC;IAkCf;;;OAGG;IACH,MAAM,CAAC,kBAAkB,CAAC,IAAI,EAC5B,cAAc,EAAE,cAAc,EAC9B,UAAU,EAAE,eAAe,EAC3B,MAAM,CAAC,EAAE,UAAU,GAClB,MAAM,CAAC,IAAI,CAAC;IA2Cf,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,aAAa,CAAC,IAAI,CAAC;IAI7C;;;OAGG;IACH,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;IAwBnC;;;;OAIG;IACH,gBAAgB,IAAI,cAAc;CAyBnC;AAED,wBAAuB,gBAAgB,CACrC,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,eAAe,GAC1B,cAAc,CAAC,eAAe,EAAE,IAAI,EAAE,OAAO,CAAC,CA6BhD"}
@@ -0,0 +1,263 @@
1
+ "use strict";
2
+ var _Stream_client;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Stream = void 0;
5
+ exports._iterSSEMessages = _iterSSEMessages;
6
+ const tslib_1 = require("../internal/tslib.js");
7
+ const error_1 = require("./error.js");
8
+ const shims_1 = require("../internal/shims.js");
9
+ const line_1 = require("../internal/decoders/line.js");
10
+ const shims_2 = require("../internal/shims.js");
11
+ const errors_1 = require("../internal/errors.js");
12
+ const bytes_1 = require("../internal/utils/bytes.js");
13
+ const log_1 = require("../internal/utils/log.js");
14
+ class Stream {
15
+ constructor(iterator, controller, client) {
16
+ this.iterator = iterator;
17
+ _Stream_client.set(this, void 0);
18
+ this.controller = controller;
19
+ tslib_1.__classPrivateFieldSet(this, _Stream_client, client, "f");
20
+ }
21
+ static fromSSEResponse(response, controller, client) {
22
+ let consumed = false;
23
+ const logger = client ? (0, log_1.loggerFor)(client) : console;
24
+ async function* iterator() {
25
+ if (consumed) {
26
+ throw new error_1.CloneforceError('Cannot iterate over a consumed stream, use `.tee()` to split the stream.');
27
+ }
28
+ consumed = true;
29
+ let done = false;
30
+ try {
31
+ for await (const sse of _iterSSEMessages(response, controller)) {
32
+ try {
33
+ yield JSON.parse(sse.data);
34
+ }
35
+ catch (e) {
36
+ logger.error(`Could not parse message into JSON:`, sse.data);
37
+ logger.error(`From chunk:`, sse.raw);
38
+ throw e;
39
+ }
40
+ }
41
+ done = true;
42
+ }
43
+ catch (e) {
44
+ // If the user calls `stream.controller.abort()`, we should exit without throwing.
45
+ if ((0, errors_1.isAbortError)(e))
46
+ return;
47
+ throw e;
48
+ }
49
+ finally {
50
+ // If the user `break`s, abort the ongoing request.
51
+ if (!done)
52
+ controller.abort();
53
+ }
54
+ }
55
+ return new Stream(iterator, controller, client);
56
+ }
57
+ /**
58
+ * Generates a Stream from a newline-separated ReadableStream
59
+ * where each item is a JSON value.
60
+ */
61
+ static fromReadableStream(readableStream, controller, client) {
62
+ let consumed = false;
63
+ async function* iterLines() {
64
+ const lineDecoder = new line_1.LineDecoder();
65
+ const iter = (0, shims_2.ReadableStreamToAsyncIterable)(readableStream);
66
+ for await (const chunk of iter) {
67
+ for (const line of lineDecoder.decode(chunk)) {
68
+ yield line;
69
+ }
70
+ }
71
+ for (const line of lineDecoder.flush()) {
72
+ yield line;
73
+ }
74
+ }
75
+ async function* iterator() {
76
+ if (consumed) {
77
+ throw new error_1.CloneforceError('Cannot iterate over a consumed stream, use `.tee()` to split the stream.');
78
+ }
79
+ consumed = true;
80
+ let done = false;
81
+ try {
82
+ for await (const line of iterLines()) {
83
+ if (done)
84
+ continue;
85
+ if (line)
86
+ yield JSON.parse(line);
87
+ }
88
+ done = true;
89
+ }
90
+ catch (e) {
91
+ // If the user calls `stream.controller.abort()`, we should exit without throwing.
92
+ if ((0, errors_1.isAbortError)(e))
93
+ return;
94
+ throw e;
95
+ }
96
+ finally {
97
+ // If the user `break`s, abort the ongoing request.
98
+ if (!done)
99
+ controller.abort();
100
+ }
101
+ }
102
+ return new Stream(iterator, controller, client);
103
+ }
104
+ [(_Stream_client = new WeakMap(), Symbol.asyncIterator)]() {
105
+ return this.iterator();
106
+ }
107
+ /**
108
+ * Splits the stream into two streams which can be
109
+ * independently read from at different speeds.
110
+ */
111
+ tee() {
112
+ const left = [];
113
+ const right = [];
114
+ const iterator = this.iterator();
115
+ const teeIterator = (queue) => {
116
+ return {
117
+ next: () => {
118
+ if (queue.length === 0) {
119
+ const result = iterator.next();
120
+ left.push(result);
121
+ right.push(result);
122
+ }
123
+ return queue.shift();
124
+ },
125
+ };
126
+ };
127
+ return [
128
+ new Stream(() => teeIterator(left), this.controller, tslib_1.__classPrivateFieldGet(this, _Stream_client, "f")),
129
+ new Stream(() => teeIterator(right), this.controller, tslib_1.__classPrivateFieldGet(this, _Stream_client, "f")),
130
+ ];
131
+ }
132
+ /**
133
+ * Converts this stream to a newline-separated ReadableStream of
134
+ * JSON stringified values in the stream
135
+ * which can be turned back into a Stream with `Stream.fromReadableStream()`.
136
+ */
137
+ toReadableStream() {
138
+ const self = this;
139
+ let iter;
140
+ return (0, shims_1.makeReadableStream)({
141
+ async start() {
142
+ iter = self[Symbol.asyncIterator]();
143
+ },
144
+ async pull(ctrl) {
145
+ try {
146
+ const { value, done } = await iter.next();
147
+ if (done)
148
+ return ctrl.close();
149
+ const bytes = (0, bytes_1.encodeUTF8)(JSON.stringify(value) + '\n');
150
+ ctrl.enqueue(bytes);
151
+ }
152
+ catch (err) {
153
+ ctrl.error(err);
154
+ }
155
+ },
156
+ async cancel() {
157
+ await iter.return?.();
158
+ },
159
+ });
160
+ }
161
+ }
162
+ exports.Stream = Stream;
163
+ async function* _iterSSEMessages(response, controller) {
164
+ if (!response.body) {
165
+ controller.abort();
166
+ if (typeof globalThis.navigator !== 'undefined' &&
167
+ globalThis.navigator.product === 'ReactNative') {
168
+ throw new error_1.CloneforceError(`The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api`);
169
+ }
170
+ throw new error_1.CloneforceError(`Attempted to iterate over a response with no body`);
171
+ }
172
+ const sseDecoder = new SSEDecoder();
173
+ const lineDecoder = new line_1.LineDecoder();
174
+ const iter = (0, shims_2.ReadableStreamToAsyncIterable)(response.body);
175
+ for await (const sseChunk of iterSSEChunks(iter)) {
176
+ for (const line of lineDecoder.decode(sseChunk)) {
177
+ const sse = sseDecoder.decode(line);
178
+ if (sse)
179
+ yield sse;
180
+ }
181
+ }
182
+ for (const line of lineDecoder.flush()) {
183
+ const sse = sseDecoder.decode(line);
184
+ if (sse)
185
+ yield sse;
186
+ }
187
+ }
188
+ /**
189
+ * Given an async iterable iterator, iterates over it and yields full
190
+ * SSE chunks, i.e. yields when a double new-line is encountered.
191
+ */
192
+ async function* iterSSEChunks(iterator) {
193
+ let data = new Uint8Array();
194
+ for await (const chunk of iterator) {
195
+ if (chunk == null) {
196
+ continue;
197
+ }
198
+ const binaryChunk = chunk instanceof ArrayBuffer ? new Uint8Array(chunk)
199
+ : typeof chunk === 'string' ? (0, bytes_1.encodeUTF8)(chunk)
200
+ : chunk;
201
+ let newData = new Uint8Array(data.length + binaryChunk.length);
202
+ newData.set(data);
203
+ newData.set(binaryChunk, data.length);
204
+ data = newData;
205
+ let patternIndex;
206
+ while ((patternIndex = (0, line_1.findDoubleNewlineIndex)(data)) !== -1) {
207
+ yield data.slice(0, patternIndex);
208
+ data = data.slice(patternIndex);
209
+ }
210
+ }
211
+ if (data.length > 0) {
212
+ yield data;
213
+ }
214
+ }
215
+ class SSEDecoder {
216
+ constructor() {
217
+ this.event = null;
218
+ this.data = [];
219
+ this.chunks = [];
220
+ }
221
+ decode(line) {
222
+ if (line.endsWith('\r')) {
223
+ line = line.substring(0, line.length - 1);
224
+ }
225
+ if (!line) {
226
+ // empty line and we didn't previously encounter any messages
227
+ if (!this.event && !this.data.length)
228
+ return null;
229
+ const sse = {
230
+ event: this.event,
231
+ data: this.data.join('\n'),
232
+ raw: this.chunks,
233
+ };
234
+ this.event = null;
235
+ this.data = [];
236
+ this.chunks = [];
237
+ return sse;
238
+ }
239
+ this.chunks.push(line);
240
+ if (line.startsWith(':')) {
241
+ return null;
242
+ }
243
+ let [fieldname, _, value] = partition(line, ':');
244
+ if (value.startsWith(' ')) {
245
+ value = value.substring(1);
246
+ }
247
+ if (fieldname === 'event') {
248
+ this.event = value;
249
+ }
250
+ else if (fieldname === 'data') {
251
+ this.data.push(value);
252
+ }
253
+ return null;
254
+ }
255
+ }
256
+ function partition(str, delimiter) {
257
+ const index = str.indexOf(delimiter);
258
+ if (index !== -1) {
259
+ return [str.substring(0, index), delimiter, str.substring(index + delimiter.length)];
260
+ }
261
+ return [str, '', ''];
262
+ }
263
+ //# sourceMappingURL=streaming.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"streaming.js","sourceRoot":"","sources":["../src/core/streaming.ts"],"names":[],"mappings":";;;;AAwLA,4CAgCC;;AAxND,sCAA0C;AAE1C,gDAAuD;AACvD,uDAAgF;AAChF,gDAAkE;AAClE,kDAAkD;AAClD,sDAAqD;AACrD,kDAAkD;AAWlD,MAAa,MAAM;IAIjB,YACU,QAAmC,EAC3C,UAA2B,EAC3B,MAAmB;QAFX,aAAQ,GAAR,QAAQ,CAA2B;QAH7C,iCAAgC;QAO9B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,+BAAA,IAAI,kBAAW,MAAM,MAAA,CAAC;IACxB,CAAC;IAED,MAAM,CAAC,eAAe,CACpB,QAAkB,EAClB,UAA2B,EAC3B,MAAmB;QAEnB,IAAI,QAAQ,GAAG,KAAK,CAAC;QACrB,MAAM,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,IAAA,eAAS,EAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,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