@mastra/client-js 0.0.0-vector-query-sources-20250516172905 → 0.0.0-vector-query-tool-provider-options-20250828222356

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 (91) hide show
  1. package/.turbo/turbo-build.log +18 -0
  2. package/CHANGELOG.md +1318 -2
  3. package/LICENSE.md +11 -42
  4. package/README.md +2 -1
  5. package/dist/adapters/agui.d.ts +23 -0
  6. package/dist/adapters/agui.d.ts.map +1 -0
  7. package/dist/client.d.ts +274 -0
  8. package/dist/client.d.ts.map +1 -0
  9. package/dist/example.d.ts +2 -0
  10. package/dist/example.d.ts.map +1 -0
  11. package/dist/index.cjs +1801 -137
  12. package/dist/index.cjs.map +1 -0
  13. package/dist/index.d.ts +4 -883
  14. package/dist/index.d.ts.map +1 -0
  15. package/dist/index.js +1803 -139
  16. package/dist/index.js.map +1 -0
  17. package/dist/resources/a2a.d.ts +41 -0
  18. package/dist/resources/a2a.d.ts.map +1 -0
  19. package/dist/resources/agent.d.ts +130 -0
  20. package/dist/resources/agent.d.ts.map +1 -0
  21. package/dist/resources/base.d.ts +13 -0
  22. package/dist/resources/base.d.ts.map +1 -0
  23. package/dist/resources/index.d.ts +12 -0
  24. package/dist/resources/index.d.ts.map +1 -0
  25. package/dist/resources/legacy-workflow.d.ts +87 -0
  26. package/dist/resources/legacy-workflow.d.ts.map +1 -0
  27. package/dist/resources/mcp-tool.d.ts +27 -0
  28. package/dist/resources/mcp-tool.d.ts.map +1 -0
  29. package/dist/resources/memory-thread.d.ts +53 -0
  30. package/dist/resources/memory-thread.d.ts.map +1 -0
  31. package/dist/resources/network-memory-thread.d.ts +47 -0
  32. package/dist/resources/network-memory-thread.d.ts.map +1 -0
  33. package/dist/resources/network.d.ts +30 -0
  34. package/dist/resources/network.d.ts.map +1 -0
  35. package/dist/resources/observability.d.ts +19 -0
  36. package/dist/resources/observability.d.ts.map +1 -0
  37. package/dist/resources/tool.d.ts +23 -0
  38. package/dist/resources/tool.d.ts.map +1 -0
  39. package/dist/resources/vNextNetwork.d.ts +42 -0
  40. package/dist/resources/vNextNetwork.d.ts.map +1 -0
  41. package/dist/resources/vector.d.ts +48 -0
  42. package/dist/resources/vector.d.ts.map +1 -0
  43. package/dist/resources/workflow.d.ts +154 -0
  44. package/dist/resources/workflow.d.ts.map +1 -0
  45. package/dist/types.d.ts +449 -0
  46. package/dist/types.d.ts.map +1 -0
  47. package/dist/utils/index.d.ts +3 -0
  48. package/dist/utils/index.d.ts.map +1 -0
  49. package/dist/utils/process-client-tools.d.ts +3 -0
  50. package/dist/utils/process-client-tools.d.ts.map +1 -0
  51. package/dist/utils/process-mastra-stream.d.ts +7 -0
  52. package/dist/utils/process-mastra-stream.d.ts.map +1 -0
  53. package/dist/utils/zod-to-json-schema.d.ts +3 -0
  54. package/dist/utils/zod-to-json-schema.d.ts.map +1 -0
  55. package/eslint.config.js +6 -1
  56. package/integration-tests/agui-adapter.test.ts +122 -0
  57. package/integration-tests/package.json +18 -0
  58. package/integration-tests/src/mastra/index.ts +35 -0
  59. package/integration-tests/vitest.config.ts +9 -0
  60. package/package.json +32 -19
  61. package/src/adapters/agui.test.ts +116 -3
  62. package/src/adapters/agui.ts +30 -12
  63. package/src/client.ts +333 -24
  64. package/src/example.ts +46 -15
  65. package/src/index.test.ts +429 -6
  66. package/src/index.ts +1 -0
  67. package/src/resources/a2a.ts +35 -25
  68. package/src/resources/agent.ts +1284 -20
  69. package/src/resources/base.ts +8 -1
  70. package/src/resources/index.ts +3 -2
  71. package/src/resources/{vnext-workflow.ts → legacy-workflow.ts} +124 -143
  72. package/src/resources/memory-thread.test.ts +285 -0
  73. package/src/resources/memory-thread.ts +37 -1
  74. package/src/resources/network-memory-thread.test.ts +269 -0
  75. package/src/resources/network-memory-thread.ts +81 -0
  76. package/src/resources/network.ts +7 -7
  77. package/src/resources/observability.ts +53 -0
  78. package/src/resources/tool.ts +4 -3
  79. package/src/resources/vNextNetwork.ts +194 -0
  80. package/src/resources/workflow.ts +255 -96
  81. package/src/types.ts +262 -36
  82. package/src/utils/index.ts +11 -0
  83. package/src/utils/process-client-tools.ts +32 -0
  84. package/src/utils/process-mastra-stream.test.ts +353 -0
  85. package/src/utils/process-mastra-stream.ts +49 -0
  86. package/src/utils/zod-to-json-schema.ts +23 -3
  87. package/src/v2-messages.test.ts +180 -0
  88. package/tsconfig.build.json +9 -0
  89. package/tsconfig.json +2 -2
  90. package/tsup.config.ts +17 -0
  91. package/dist/index.d.cts +0 -883
package/src/client.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  import type { AbstractAgent } from '@ag-ui/client';
2
+ import type { AITraceRecord, AITracesPaginatedArg } from '@mastra/core';
3
+ import type { ServerDetailInfo } from '@mastra/core/mcp';
2
4
  import { AGUIAdapter } from './adapters/agui';
3
5
  import {
4
6
  Agent,
@@ -8,10 +10,13 @@ import {
8
10
  Vector,
9
11
  BaseResource,
10
12
  Network,
11
- VNextWorkflow,
12
13
  A2A,
13
14
  MCPTool,
15
+ LegacyWorkflow,
16
+ Observability,
14
17
  } from './resources';
18
+ import { NetworkMemoryThread } from './resources/network-memory-thread';
19
+ import { VNextNetwork } from './resources/vNextNetwork';
15
20
  import type {
16
21
  ClientOptions,
17
22
  CreateMemoryThreadParams,
@@ -26,19 +31,31 @@ import type {
26
31
  GetTelemetryParams,
27
32
  GetTelemetryResponse,
28
33
  GetToolResponse,
29
- GetVNextWorkflowResponse,
30
34
  GetWorkflowResponse,
31
35
  SaveMessageToMemoryParams,
32
36
  SaveMessageToMemoryResponse,
33
37
  McpServerListResponse,
34
38
  McpServerToolListResponse,
35
- McpToolInfo,
39
+ GetLegacyWorkflowResponse,
40
+ GetVNextNetworkResponse,
41
+ GetNetworkMemoryThreadParams,
42
+ CreateNetworkMemoryThreadParams,
43
+ SaveNetworkMessageToMemoryParams,
44
+ GetScorerResponse,
45
+ GetScoresByScorerIdParams,
46
+ GetScoresResponse,
47
+ GetScoresByRunIdParams,
48
+ GetScoresByEntityIdParams,
49
+ SaveScoreParams,
50
+ SaveScoreResponse,
51
+ GetAITracesResponse,
36
52
  } from './types';
37
- import type { ServerDetailInfo } from '@mastra/core/mcp';
38
53
 
39
54
  export class MastraClient extends BaseResource {
55
+ private observability: Observability;
40
56
  constructor(options: ClientOptions) {
41
57
  super(options);
58
+ this.observability = new Observability(options);
42
59
  }
43
60
 
44
61
  /**
@@ -124,6 +141,53 @@ export class MastraClient extends BaseResource {
124
141
  return this.request(`/api/memory/status?agentId=${agentId}`);
125
142
  }
126
143
 
144
+ /**
145
+ * Retrieves memory threads for a resource
146
+ * @param params - Parameters containing the resource ID
147
+ * @returns Promise containing array of memory threads
148
+ */
149
+ public getNetworkMemoryThreads(params: GetNetworkMemoryThreadParams): Promise<GetMemoryThreadResponse> {
150
+ return this.request(`/api/memory/network/threads?resourceid=${params.resourceId}&networkId=${params.networkId}`);
151
+ }
152
+
153
+ /**
154
+ * Creates a new memory thread
155
+ * @param params - Parameters for creating the memory thread
156
+ * @returns Promise containing the created memory thread
157
+ */
158
+ public createNetworkMemoryThread(params: CreateNetworkMemoryThreadParams): Promise<CreateMemoryThreadResponse> {
159
+ return this.request(`/api/memory/network/threads?networkId=${params.networkId}`, { method: 'POST', body: params });
160
+ }
161
+
162
+ /**
163
+ * Gets a memory thread instance by ID
164
+ * @param threadId - ID of the memory thread to retrieve
165
+ * @returns MemoryThread instance
166
+ */
167
+ public getNetworkMemoryThread(threadId: string, networkId: string) {
168
+ return new NetworkMemoryThread(this.options, threadId, networkId);
169
+ }
170
+
171
+ /**
172
+ * Saves messages to memory
173
+ * @param params - Parameters containing messages to save
174
+ * @returns Promise containing the saved messages
175
+ */
176
+ public saveNetworkMessageToMemory(params: SaveNetworkMessageToMemoryParams): Promise<SaveMessageToMemoryResponse> {
177
+ return this.request(`/api/memory/network/save-messages?networkId=${params.networkId}`, {
178
+ method: 'POST',
179
+ body: params,
180
+ });
181
+ }
182
+
183
+ /**
184
+ * Gets the status of the memory system
185
+ * @returns Promise containing memory system status
186
+ */
187
+ public getNetworkMemoryStatus(networkId: string): Promise<{ result: boolean }> {
188
+ return this.request(`/api/memory/network/status?networkId=${networkId}`);
189
+ }
190
+
127
191
  /**
128
192
  * Retrieves all available tools
129
193
  * @returns Promise containing map of tool IDs to tool details
@@ -141,6 +205,23 @@ export class MastraClient extends BaseResource {
141
205
  return new Tool(this.options, toolId);
142
206
  }
143
207
 
208
+ /**
209
+ * Retrieves all available legacy workflows
210
+ * @returns Promise containing map of legacy workflow IDs to legacy workflow details
211
+ */
212
+ public getLegacyWorkflows(): Promise<Record<string, GetLegacyWorkflowResponse>> {
213
+ return this.request('/api/workflows/legacy');
214
+ }
215
+
216
+ /**
217
+ * Gets a legacy workflow instance by ID
218
+ * @param workflowId - ID of the legacy workflow to retrieve
219
+ * @returns Legacy Workflow instance
220
+ */
221
+ public getLegacyWorkflow(workflowId: string) {
222
+ return new LegacyWorkflow(this.options, workflowId);
223
+ }
224
+
144
225
  /**
145
226
  * Retrieves all available workflows
146
227
  * @returns Promise containing map of workflow IDs to workflow details
@@ -158,23 +239,6 @@ export class MastraClient extends BaseResource {
158
239
  return new Workflow(this.options, workflowId);
159
240
  }
160
241
 
161
- /**
162
- * Retrieves all available vNext workflows
163
- * @returns Promise containing map of vNext workflow IDs to vNext workflow details
164
- */
165
- public getVNextWorkflows(): Promise<Record<string, GetVNextWorkflowResponse>> {
166
- return this.request('/api/workflows/v-next');
167
- }
168
-
169
- /**
170
- * Gets a vNext workflow instance by ID
171
- * @param workflowId - ID of the vNext workflow to retrieve
172
- * @returns vNext Workflow instance
173
- */
174
- public getVNextWorkflow(workflowId: string) {
175
- return new VNextWorkflow(this.options, workflowId);
176
- }
177
-
178
242
  /**
179
243
  * Gets a vector instance by name
180
244
  * @param vectorName - Name of the vector to retrieve
@@ -190,7 +254,43 @@ export class MastraClient extends BaseResource {
190
254
  * @returns Promise containing array of log messages
191
255
  */
192
256
  public getLogs(params: GetLogsParams): Promise<GetLogsResponse> {
193
- return this.request(`/api/logs?transportId=${params.transportId}`);
257
+ const { transportId, fromDate, toDate, logLevel, filters, page, perPage } = params;
258
+ const _filters = filters ? Object.entries(filters).map(([key, value]) => `${key}:${value}`) : [];
259
+
260
+ const searchParams = new URLSearchParams();
261
+ if (transportId) {
262
+ searchParams.set('transportId', transportId);
263
+ }
264
+ if (fromDate) {
265
+ searchParams.set('fromDate', fromDate.toISOString());
266
+ }
267
+ if (toDate) {
268
+ searchParams.set('toDate', toDate.toISOString());
269
+ }
270
+ if (logLevel) {
271
+ searchParams.set('logLevel', logLevel);
272
+ }
273
+ if (page) {
274
+ searchParams.set('page', String(page));
275
+ }
276
+ if (perPage) {
277
+ searchParams.set('perPage', String(perPage));
278
+ }
279
+ if (_filters) {
280
+ if (Array.isArray(_filters)) {
281
+ for (const filter of _filters) {
282
+ searchParams.append('filters', filter);
283
+ }
284
+ } else {
285
+ searchParams.set('filters', _filters);
286
+ }
287
+ }
288
+
289
+ if (searchParams.size) {
290
+ return this.request(`/api/logs?${searchParams}`);
291
+ } else {
292
+ return this.request(`/api/logs`);
293
+ }
194
294
  }
195
295
 
196
296
  /**
@@ -199,7 +299,47 @@ export class MastraClient extends BaseResource {
199
299
  * @returns Promise containing array of log messages
200
300
  */
201
301
  public getLogForRun(params: GetLogParams): Promise<GetLogsResponse> {
202
- return this.request(`/api/logs/${params.runId}?transportId=${params.transportId}`);
302
+ const { runId, transportId, fromDate, toDate, logLevel, filters, page, perPage } = params;
303
+
304
+ const _filters = filters ? Object.entries(filters).map(([key, value]) => `${key}:${value}`) : [];
305
+ const searchParams = new URLSearchParams();
306
+ if (runId) {
307
+ searchParams.set('runId', runId);
308
+ }
309
+ if (transportId) {
310
+ searchParams.set('transportId', transportId);
311
+ }
312
+ if (fromDate) {
313
+ searchParams.set('fromDate', fromDate.toISOString());
314
+ }
315
+ if (toDate) {
316
+ searchParams.set('toDate', toDate.toISOString());
317
+ }
318
+ if (logLevel) {
319
+ searchParams.set('logLevel', logLevel);
320
+ }
321
+ if (page) {
322
+ searchParams.set('page', String(page));
323
+ }
324
+ if (perPage) {
325
+ searchParams.set('perPage', String(perPage));
326
+ }
327
+
328
+ if (_filters) {
329
+ if (Array.isArray(_filters)) {
330
+ for (const filter of _filters) {
331
+ searchParams.append('filters', filter);
332
+ }
333
+ } else {
334
+ searchParams.set('filters', _filters);
335
+ }
336
+ }
337
+
338
+ if (searchParams.size) {
339
+ return this.request(`/api/logs/${runId}?${searchParams}`);
340
+ } else {
341
+ return this.request(`/api/logs/${runId}`);
342
+ }
203
343
  }
204
344
 
205
345
  /**
@@ -259,10 +399,18 @@ export class MastraClient extends BaseResource {
259
399
  * Retrieves all available networks
260
400
  * @returns Promise containing map of network IDs to network details
261
401
  */
262
- public getNetworks(): Promise<Record<string, GetNetworkResponse>> {
402
+ public getNetworks(): Promise<Array<GetNetworkResponse>> {
263
403
  return this.request('/api/networks');
264
404
  }
265
405
 
406
+ /**
407
+ * Retrieves all available vNext networks
408
+ * @returns Promise containing map of vNext network IDs to vNext network details
409
+ */
410
+ public getVNextNetworks(): Promise<Array<GetVNextNetworkResponse>> {
411
+ return this.request('/api/networks/v-next');
412
+ }
413
+
266
414
  /**
267
415
  * Gets a network instance by ID
268
416
  * @param networkId - ID of the network to retrieve
@@ -272,6 +420,15 @@ export class MastraClient extends BaseResource {
272
420
  return new Network(this.options, networkId);
273
421
  }
274
422
 
423
+ /**
424
+ * Gets a vNext network instance by ID
425
+ * @param networkId - ID of the vNext network to retrieve
426
+ * @returns vNext Network instance
427
+ */
428
+ public getVNextNetwork(networkId: string) {
429
+ return new VNextNetwork(this.options, networkId);
430
+ }
431
+
275
432
  /**
276
433
  * Retrieves a list of available MCP servers.
277
434
  * @param params - Optional parameters for pagination (limit, offset).
@@ -332,4 +489,156 @@ export class MastraClient extends BaseResource {
332
489
  public getA2A(agentId: string) {
333
490
  return new A2A(this.options, agentId);
334
491
  }
492
+
493
+ /**
494
+ * Retrieves the working memory for a specific thread (optionally resource-scoped).
495
+ * @param agentId - ID of the agent.
496
+ * @param threadId - ID of the thread.
497
+ * @param resourceId - Optional ID of the resource.
498
+ * @returns Working memory for the specified thread or resource.
499
+ */
500
+ public getWorkingMemory({
501
+ agentId,
502
+ threadId,
503
+ resourceId,
504
+ }: {
505
+ agentId: string;
506
+ threadId: string;
507
+ resourceId?: string;
508
+ }) {
509
+ return this.request(`/api/memory/threads/${threadId}/working-memory?agentId=${agentId}&resourceId=${resourceId}`);
510
+ }
511
+
512
+ /**
513
+ * Updates the working memory for a specific thread (optionally resource-scoped).
514
+ * @param agentId - ID of the agent.
515
+ * @param threadId - ID of the thread.
516
+ * @param workingMemory - The new working memory content.
517
+ * @param resourceId - Optional ID of the resource.
518
+ */
519
+ public updateWorkingMemory({
520
+ agentId,
521
+ threadId,
522
+ workingMemory,
523
+ resourceId,
524
+ }: {
525
+ agentId: string;
526
+ threadId: string;
527
+ workingMemory: string;
528
+ resourceId?: string;
529
+ }) {
530
+ return this.request(`/api/memory/threads/${threadId}/working-memory?agentId=${agentId}`, {
531
+ method: 'POST',
532
+ body: {
533
+ workingMemory,
534
+ resourceId,
535
+ },
536
+ });
537
+ }
538
+
539
+ /**
540
+ * Retrieves all available scorers
541
+ * @returns Promise containing list of available scorers
542
+ */
543
+ public getScorers(): Promise<Record<string, GetScorerResponse>> {
544
+ return this.request('/api/scores/scorers');
545
+ }
546
+
547
+ /**
548
+ * Retrieves a scorer by ID
549
+ * @param scorerId - ID of the scorer to retrieve
550
+ * @returns Promise containing the scorer
551
+ */
552
+ public getScorer(scorerId: string): Promise<GetScorerResponse> {
553
+ return this.request(`/api/scores/scorers/${scorerId}`);
554
+ }
555
+
556
+ public getScoresByScorerId(params: GetScoresByScorerIdParams): Promise<GetScoresResponse> {
557
+ const { page, perPage, scorerId, entityId, entityType } = params;
558
+ const searchParams = new URLSearchParams();
559
+
560
+ if (entityId) {
561
+ searchParams.set('entityId', entityId);
562
+ }
563
+ if (entityType) {
564
+ searchParams.set('entityType', entityType);
565
+ }
566
+
567
+ if (page !== undefined) {
568
+ searchParams.set('page', String(page));
569
+ }
570
+ if (perPage !== undefined) {
571
+ searchParams.set('perPage', String(perPage));
572
+ }
573
+ const queryString = searchParams.toString();
574
+ return this.request(`/api/scores/scorer/${scorerId}${queryString ? `?${queryString}` : ''}`);
575
+ }
576
+
577
+ /**
578
+ * Retrieves scores by run ID
579
+ * @param params - Parameters containing run ID and pagination options
580
+ * @returns Promise containing scores and pagination info
581
+ */
582
+ public getScoresByRunId(params: GetScoresByRunIdParams): Promise<GetScoresResponse> {
583
+ const { runId, page, perPage } = params;
584
+ const searchParams = new URLSearchParams();
585
+
586
+ if (page !== undefined) {
587
+ searchParams.set('page', String(page));
588
+ }
589
+ if (perPage !== undefined) {
590
+ searchParams.set('perPage', String(perPage));
591
+ }
592
+
593
+ const queryString = searchParams.toString();
594
+ return this.request(`/api/scores/run/${runId}${queryString ? `?${queryString}` : ''}`);
595
+ }
596
+
597
+ /**
598
+ * Retrieves scores by entity ID and type
599
+ * @param params - Parameters containing entity ID, type, and pagination options
600
+ * @returns Promise containing scores and pagination info
601
+ */
602
+ public getScoresByEntityId(params: GetScoresByEntityIdParams): Promise<GetScoresResponse> {
603
+ const { entityId, entityType, page, perPage } = params;
604
+ const searchParams = new URLSearchParams();
605
+
606
+ if (page !== undefined) {
607
+ searchParams.set('page', String(page));
608
+ }
609
+ if (perPage !== undefined) {
610
+ searchParams.set('perPage', String(perPage));
611
+ }
612
+
613
+ const queryString = searchParams.toString();
614
+ return this.request(`/api/scores/entity/${entityType}/${entityId}${queryString ? `?${queryString}` : ''}`);
615
+ }
616
+
617
+ /**
618
+ * Saves a score
619
+ * @param params - Parameters containing the score data to save
620
+ * @returns Promise containing the saved score
621
+ */
622
+ public saveScore(params: SaveScoreParams): Promise<SaveScoreResponse> {
623
+ return this.request('/api/scores', {
624
+ method: 'POST',
625
+ body: params,
626
+ });
627
+ }
628
+
629
+ /**
630
+ * Retrieves model providers with available keys
631
+ * @returns Promise containing model providers with available keys
632
+ */
633
+ getModelProviders(): Promise<string[]> {
634
+ return this.request(`/api/model-providers`);
635
+ }
636
+
637
+ getAITrace(traceId: string): Promise<AITraceRecord> {
638
+ return this.observability.getTrace(traceId);
639
+ }
640
+
641
+ getAITraces(params: AITracesPaginatedArg): Promise<GetAITracesResponse> {
642
+ return this.observability.getTraces(params);
643
+ }
335
644
  }
package/src/example.ts CHANGED
@@ -1,8 +1,8 @@
1
+ import z from 'zod';
1
2
  import { MastraClient } from './client';
2
3
  // import type { WorkflowRunResult } from './types';
3
4
 
4
5
  // Agent
5
-
6
6
  (async () => {
7
7
  const client = new MastraClient({
8
8
  baseUrl: 'http://localhost:4111',
@@ -14,22 +14,53 @@ import { MastraClient } from './client';
14
14
  const agent = client.getAgent('weatherAgent');
15
15
  const response = await agent.stream({
16
16
  messages: 'what is the weather in new york?',
17
+ output: z.object({
18
+ weather: z.string(),
19
+ temperature: z.number(),
20
+ humidity: z.number(),
21
+ windSpeed: z.number(),
22
+ windDirection: z.string(),
23
+ windGust: z.number(),
24
+ windChill: z.number(),
25
+ }),
17
26
  });
18
27
 
19
- response.processDataStream({
20
- onTextPart: text => {
21
- process.stdout.write(text);
22
- },
23
- onFilePart: file => {
24
- console.log(file);
25
- },
26
- onDataPart: data => {
27
- console.log(data);
28
- },
29
- onErrorPart: error => {
30
- console.error(error);
31
- },
32
- });
28
+ // Process data stream - unstructured output
29
+
30
+ // response.processDataStream({
31
+ // onTextPart: text => {
32
+ // process.stdout.write(text);
33
+ // },
34
+ // onFilePart: file => {
35
+ // console.log(file);
36
+ // },
37
+ // onDataPart: data => {
38
+ // console.log(data);
39
+ // },
40
+ // onErrorPart: error => {
41
+ // console.error(error);
42
+ // },
43
+ // onToolCallPart(streamPart) {
44
+ // console.log(streamPart);
45
+ // },
46
+ // });
47
+
48
+ // Process text stream - structured output
49
+
50
+ // response.processTextStream({
51
+ // onTextPart: text => {
52
+ // process.stdout.write(text);
53
+ // },
54
+ // });
55
+
56
+ // read the response body directly
57
+
58
+ // const reader = response.body!.getReader();
59
+ // while (true) {
60
+ // const { done, value } = await reader.read();
61
+ // if (done) break;
62
+ // console.log(new TextDecoder().decode(value));
63
+ // }
33
64
  } catch (error) {
34
65
  console.error(error);
35
66
  }