@mastra/client-js 0.1.0-alpha.1 → 0.1.0-alpha.10

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 (294) hide show
  1. package/.eslintrc.js +10 -0
  2. package/.prettierignore +3 -0
  3. package/.prettierrc.json +26 -0
  4. package/LICENSE +44 -201
  5. package/README.md +90 -271
  6. package/dist/index.d.mts +359 -0
  7. package/dist/index.mjs +410 -0
  8. package/package.json +32 -95
  9. package/src/client.ts +135 -0
  10. package/src/example.ts +47 -0
  11. package/src/index.test.ts +585 -0
  12. package/src/index.ts +2 -194
  13. package/src/resources/agent.ts +115 -0
  14. package/src/resources/base.ts +68 -0
  15. package/src/resources/index.ts +6 -9
  16. package/src/resources/memory-thread.ts +57 -0
  17. package/src/resources/tool.ts +31 -0
  18. package/src/resources/vector.ts +82 -0
  19. package/src/resources/workflow.ts +31 -0
  20. package/src/types.ts +142 -0
  21. package/tsconfig.json +29 -0
  22. package/vitest.config.js +8 -0
  23. package/CHANGELOG.md +0 -21
  24. package/_shims/MultipartBody.d.ts +0 -9
  25. package/_shims/MultipartBody.d.ts.map +0 -1
  26. package/_shims/MultipartBody.js +0 -16
  27. package/_shims/MultipartBody.js.map +0 -1
  28. package/_shims/MultipartBody.mjs +0 -12
  29. package/_shims/MultipartBody.mjs.map +0 -1
  30. package/_shims/README.md +0 -46
  31. package/_shims/auto/runtime-bun.d.ts +0 -5
  32. package/_shims/auto/runtime-bun.d.ts.map +0 -1
  33. package/_shims/auto/runtime-bun.js +0 -21
  34. package/_shims/auto/runtime-bun.js.map +0 -1
  35. package/_shims/auto/runtime-bun.mjs +0 -2
  36. package/_shims/auto/runtime-bun.mjs.map +0 -1
  37. package/_shims/auto/runtime-node.d.ts +0 -5
  38. package/_shims/auto/runtime-node.d.ts.map +0 -1
  39. package/_shims/auto/runtime-node.js +0 -21
  40. package/_shims/auto/runtime-node.js.map +0 -1
  41. package/_shims/auto/runtime-node.mjs +0 -2
  42. package/_shims/auto/runtime-node.mjs.map +0 -1
  43. package/_shims/auto/runtime.d.ts +0 -5
  44. package/_shims/auto/runtime.d.ts.map +0 -1
  45. package/_shims/auto/runtime.js +0 -21
  46. package/_shims/auto/runtime.js.map +0 -1
  47. package/_shims/auto/runtime.mjs +0 -2
  48. package/_shims/auto/runtime.mjs.map +0 -1
  49. package/_shims/auto/types-node.d.ts +0 -5
  50. package/_shims/auto/types-node.d.ts.map +0 -1
  51. package/_shims/auto/types-node.js +0 -21
  52. package/_shims/auto/types-node.js.map +0 -1
  53. package/_shims/auto/types-node.mjs +0 -2
  54. package/_shims/auto/types-node.mjs.map +0 -1
  55. package/_shims/auto/types.d.ts +0 -101
  56. package/_shims/auto/types.js +0 -3
  57. package/_shims/auto/types.mjs +0 -3
  58. package/_shims/bun-runtime.d.ts +0 -6
  59. package/_shims/bun-runtime.d.ts.map +0 -1
  60. package/_shims/bun-runtime.js +0 -14
  61. package/_shims/bun-runtime.js.map +0 -1
  62. package/_shims/bun-runtime.mjs +0 -10
  63. package/_shims/bun-runtime.mjs.map +0 -1
  64. package/_shims/index.d.ts +0 -81
  65. package/_shims/index.js +0 -13
  66. package/_shims/index.mjs +0 -7
  67. package/_shims/manual-types.d.ts +0 -12
  68. package/_shims/manual-types.js +0 -3
  69. package/_shims/manual-types.mjs +0 -3
  70. package/_shims/node-runtime.d.ts +0 -3
  71. package/_shims/node-runtime.d.ts.map +0 -1
  72. package/_shims/node-runtime.js +0 -89
  73. package/_shims/node-runtime.js.map +0 -1
  74. package/_shims/node-runtime.mjs +0 -56
  75. package/_shims/node-runtime.mjs.map +0 -1
  76. package/_shims/node-types.d.ts +0 -42
  77. package/_shims/node-types.js +0 -3
  78. package/_shims/node-types.mjs +0 -3
  79. package/_shims/registry.d.ts +0 -37
  80. package/_shims/registry.d.ts.map +0 -1
  81. package/_shims/registry.js +0 -41
  82. package/_shims/registry.js.map +0 -1
  83. package/_shims/registry.mjs +0 -37
  84. package/_shims/registry.mjs.map +0 -1
  85. package/_shims/web-runtime.d.ts +0 -5
  86. package/_shims/web-runtime.d.ts.map +0 -1
  87. package/_shims/web-runtime.js +0 -78
  88. package/_shims/web-runtime.js.map +0 -1
  89. package/_shims/web-runtime.mjs +0 -71
  90. package/_shims/web-runtime.mjs.map +0 -1
  91. package/_shims/web-types.d.ts +0 -83
  92. package/_shims/web-types.js +0 -3
  93. package/_shims/web-types.mjs +0 -3
  94. package/core.d.ts +0 -241
  95. package/core.d.ts.map +0 -1
  96. package/core.js +0 -908
  97. package/core.js.map +0 -1
  98. package/core.mjs +0 -876
  99. package/core.mjs.map +0 -1
  100. package/error.d.ts +0 -47
  101. package/error.d.ts.map +0 -1
  102. package/error.js +0 -113
  103. package/error.js.map +0 -1
  104. package/error.mjs +0 -97
  105. package/error.mjs.map +0 -1
  106. package/index.d.mts +0 -121
  107. package/index.d.ts +0 -121
  108. package/index.d.ts.map +0 -1
  109. package/index.js +0 -131
  110. package/index.js.map +0 -1
  111. package/index.mjs +0 -88
  112. package/index.mjs.map +0 -1
  113. package/resource.d.ts +0 -6
  114. package/resource.d.ts.map +0 -1
  115. package/resource.js +0 -11
  116. package/resource.js.map +0 -1
  117. package/resource.mjs +0 -7
  118. package/resource.mjs.map +0 -1
  119. package/resources/agents/agents.d.ts +0 -40
  120. package/resources/agents/agents.d.ts.map +0 -1
  121. package/resources/agents/agents.js +0 -74
  122. package/resources/agents/agents.js.map +0 -1
  123. package/resources/agents/agents.mjs +0 -47
  124. package/resources/agents/agents.mjs.map +0 -1
  125. package/resources/agents/index.d.ts +0 -3
  126. package/resources/agents/index.d.ts.map +0 -1
  127. package/resources/agents/index.js +0 -9
  128. package/resources/agents/index.js.map +0 -1
  129. package/resources/agents/index.mjs +0 -4
  130. package/resources/agents/index.mjs.map +0 -1
  131. package/resources/agents/tools.d.ts +0 -17
  132. package/resources/agents/tools.d.ts.map +0 -1
  133. package/resources/agents/tools.js +0 -19
  134. package/resources/agents/tools.js.map +0 -1
  135. package/resources/agents/tools.mjs +0 -15
  136. package/resources/agents/tools.mjs.map +0 -1
  137. package/resources/index.d.ts +0 -8
  138. package/resources/index.d.ts.map +0 -1
  139. package/resources/index.js +0 -19
  140. package/resources/index.js.map +0 -1
  141. package/resources/index.mjs +0 -9
  142. package/resources/index.mjs.map +0 -1
  143. package/resources/logs.d.ts +0 -13
  144. package/resources/logs.d.ts.map +0 -1
  145. package/resources/logs.js +0 -24
  146. package/resources/logs.js.map +0 -1
  147. package/resources/logs.mjs +0 -20
  148. package/resources/logs.mjs.map +0 -1
  149. package/resources/memory/index.d.ts +0 -4
  150. package/resources/memory/index.d.ts.map +0 -1
  151. package/resources/memory/index.js +0 -11
  152. package/resources/memory/index.js.map +0 -1
  153. package/resources/memory/index.mjs +0 -5
  154. package/resources/memory/index.mjs.map +0 -1
  155. package/resources/memory/memory.d.ts +0 -23
  156. package/resources/memory/memory.d.ts.map +0 -1
  157. package/resources/memory/memory.js +0 -53
  158. package/resources/memory/memory.js.map +0 -1
  159. package/resources/memory/memory.mjs +0 -26
  160. package/resources/memory/memory.mjs.map +0 -1
  161. package/resources/memory/status.d.ts +0 -9
  162. package/resources/memory/status.d.ts.map +0 -1
  163. package/resources/memory/status.js +0 -18
  164. package/resources/memory/status.js.map +0 -1
  165. package/resources/memory/status.mjs +0 -14
  166. package/resources/memory/status.mjs.map +0 -1
  167. package/resources/memory/threads/index.d.ts +0 -3
  168. package/resources/memory/threads/index.d.ts.map +0 -1
  169. package/resources/memory/threads/index.js +0 -9
  170. package/resources/memory/threads/index.js.map +0 -1
  171. package/resources/memory/threads/index.mjs +0 -4
  172. package/resources/memory/threads/index.mjs.map +0 -1
  173. package/resources/memory/threads/messages.d.ts +0 -9
  174. package/resources/memory/threads/messages.d.ts.map +0 -1
  175. package/resources/memory/threads/messages.js +0 -18
  176. package/resources/memory/threads/messages.js.map +0 -1
  177. package/resources/memory/threads/messages.mjs +0 -14
  178. package/resources/memory/threads/messages.mjs.map +0 -1
  179. package/resources/memory/threads/threads.d.ts +0 -45
  180. package/resources/memory/threads/threads.d.ts.map +0 -1
  181. package/resources/memory/threads/threads.js +0 -104
  182. package/resources/memory/threads/threads.js.map +0 -1
  183. package/resources/memory/threads/threads.mjs +0 -77
  184. package/resources/memory/threads/threads.mjs.map +0 -1
  185. package/resources/syncs.d.ts +0 -15
  186. package/resources/syncs.d.ts.map +0 -1
  187. package/resources/syncs.js +0 -19
  188. package/resources/syncs.js.map +0 -1
  189. package/resources/syncs.mjs +0 -15
  190. package/resources/syncs.mjs.map +0 -1
  191. package/resources/system.d.ts +0 -9
  192. package/resources/system.d.ts.map +0 -1
  193. package/resources/system.js +0 -15
  194. package/resources/system.js.map +0 -1
  195. package/resources/system.mjs +0 -11
  196. package/resources/system.mjs.map +0 -1
  197. package/resources/tools/index.d.ts +0 -3
  198. package/resources/tools/index.d.ts.map +0 -1
  199. package/resources/tools/index.js +0 -9
  200. package/resources/tools/index.js.map +0 -1
  201. package/resources/tools/index.mjs +0 -4
  202. package/resources/tools/index.mjs.map +0 -1
  203. package/resources/tools/result.d.ts +0 -9
  204. package/resources/tools/result.d.ts.map +0 -1
  205. package/resources/tools/result.js +0 -18
  206. package/resources/tools/result.js.map +0 -1
  207. package/resources/tools/result.mjs +0 -14
  208. package/resources/tools/result.mjs.map +0 -1
  209. package/resources/tools/tools.d.ts +0 -29
  210. package/resources/tools/tools.d.ts.map +0 -1
  211. package/resources/tools/tools.js +0 -64
  212. package/resources/tools/tools.js.map +0 -1
  213. package/resources/tools/tools.mjs +0 -37
  214. package/resources/tools/tools.mjs.map +0 -1
  215. package/resources/workflows.d.ts +0 -23
  216. package/resources/workflows.d.ts.map +0 -1
  217. package/resources/workflows.js +0 -37
  218. package/resources/workflows.js.map +0 -1
  219. package/resources/workflows.mjs +0 -33
  220. package/resources/workflows.mjs.map +0 -1
  221. package/shims/node.d.ts +0 -30
  222. package/shims/node.d.ts.map +0 -1
  223. package/shims/node.js +0 -31
  224. package/shims/node.js.map +0 -1
  225. package/shims/node.mjs +0 -5
  226. package/shims/node.mjs.map +0 -1
  227. package/shims/web.d.ts +0 -26
  228. package/shims/web.d.ts.map +0 -1
  229. package/shims/web.js +0 -31
  230. package/shims/web.js.map +0 -1
  231. package/shims/web.mjs +0 -5
  232. package/shims/web.mjs.map +0 -1
  233. package/src/_shims/MultipartBody.ts +0 -9
  234. package/src/_shims/README.md +0 -46
  235. package/src/_shims/auto/runtime-bun.ts +0 -4
  236. package/src/_shims/auto/runtime-node.ts +0 -4
  237. package/src/_shims/auto/runtime.ts +0 -4
  238. package/src/_shims/auto/types-node.ts +0 -4
  239. package/src/_shims/auto/types.d.ts +0 -101
  240. package/src/_shims/auto/types.js +0 -3
  241. package/src/_shims/auto/types.mjs +0 -3
  242. package/src/_shims/bun-runtime.ts +0 -14
  243. package/src/_shims/index.d.ts +0 -81
  244. package/src/_shims/index.js +0 -13
  245. package/src/_shims/index.mjs +0 -7
  246. package/src/_shims/manual-types.d.ts +0 -12
  247. package/src/_shims/manual-types.js +0 -3
  248. package/src/_shims/manual-types.mjs +0 -3
  249. package/src/_shims/node-runtime.ts +0 -81
  250. package/src/_shims/node-types.d.ts +0 -42
  251. package/src/_shims/node-types.js +0 -3
  252. package/src/_shims/node-types.mjs +0 -3
  253. package/src/_shims/registry.ts +0 -67
  254. package/src/_shims/web-runtime.ts +0 -103
  255. package/src/_shims/web-types.d.ts +0 -83
  256. package/src/_shims/web-types.js +0 -3
  257. package/src/_shims/web-types.mjs +0 -3
  258. package/src/core.ts +0 -1201
  259. package/src/error.ts +0 -130
  260. package/src/lib/.keep +0 -4
  261. package/src/resource.ts +0 -11
  262. package/src/resources/agents/agents.ts +0 -77
  263. package/src/resources/agents/index.ts +0 -4
  264. package/src/resources/agents/tools.ts +0 -34
  265. package/src/resources/logs.ts +0 -23
  266. package/src/resources/memory/index.ts +0 -5
  267. package/src/resources/memory/memory.ts +0 -43
  268. package/src/resources/memory/status.ts +0 -16
  269. package/src/resources/memory/threads/index.ts +0 -4
  270. package/src/resources/memory/threads/messages.ts +0 -16
  271. package/src/resources/memory/threads/threads.ts +0 -105
  272. package/src/resources/syncs.ts +0 -25
  273. package/src/resources/system.ts +0 -13
  274. package/src/resources/tools/index.ts +0 -4
  275. package/src/resources/tools/result.ts +0 -16
  276. package/src/resources/tools/tools.ts +0 -54
  277. package/src/resources/workflows.ts +0 -49
  278. package/src/shims/node.ts +0 -50
  279. package/src/shims/web.ts +0 -50
  280. package/src/tsconfig.json +0 -11
  281. package/src/uploads.ts +0 -255
  282. package/src/version.ts +0 -1
  283. package/uploads.d.ts +0 -75
  284. package/uploads.d.ts.map +0 -1
  285. package/uploads.js +0 -171
  286. package/uploads.js.map +0 -1
  287. package/uploads.mjs +0 -158
  288. package/uploads.mjs.map +0 -1
  289. package/version.d.ts +0 -2
  290. package/version.d.ts.map +0 -1
  291. package/version.js +0 -5
  292. package/version.js.map +0 -1
  293. package/version.mjs +0 -2
  294. package/version.mjs.map +0 -1
package/src/types.ts ADDED
@@ -0,0 +1,142 @@
1
+ import type { MessageType, AiMessageType, CoreMessage, QueryResult, StepAction, StepGraph, StorageThreadType, BaseLogMessage, OutputType } from "@mastra/core";
2
+ import type { JSONSchema7 } from 'json-schema';
3
+ import { ZodSchema } from "zod";
4
+
5
+ export interface ClientOptions {
6
+ /** Base URL for API requests */
7
+ baseUrl: string;
8
+ /** Number of retry attempts for failed requests */
9
+ retries?: number;
10
+ /** Initial backoff time in milliseconds between retries */
11
+ backoffMs?: number;
12
+ /** Maximum backoff time in milliseconds between retries */
13
+ maxBackoffMs?: number;
14
+ /** Custom headers to include with requests */
15
+ headers?: Record<string, string>;
16
+ }
17
+
18
+ export interface RequestOptions {
19
+ method?: string;
20
+ headers?: Record<string, string>;
21
+ body?: any;
22
+ stream?: boolean;
23
+ }
24
+
25
+ export interface GetAgentResponse {
26
+ name: string
27
+ instructions: string;
28
+ tools: Record<string, GetToolResponse>;
29
+ provider: string;
30
+ }
31
+
32
+ export interface GenerateParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> {
33
+ messages: MessageType[];
34
+ threadId?: string;
35
+ resourceid?: string;
36
+ output?: OutputType | T
37
+ }
38
+
39
+ export interface StreamParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> {
40
+ messages: MessageType[];
41
+ threadId?: string;
42
+ resourceid?: string;
43
+ output?: OutputType | T
44
+ }
45
+
46
+ export interface GetEvalsByAgentIdResponse extends GetAgentResponse {
47
+ evals: any[];
48
+ }
49
+
50
+ export interface GetToolResponse {
51
+ id: string;
52
+ description: string;
53
+ inputSchema: string;
54
+ outputSchema: string;
55
+ }
56
+
57
+ export interface GetWorkflowResponse {
58
+ name: string;
59
+ triggerSchema: string;
60
+ steps: Record<string, StepAction<any, any, any, any>>;
61
+ stepGraph: StepGraph
62
+ stepSubscriberGraph: Record<string, StepGraph>
63
+ }
64
+
65
+ export interface UpsertVectorParams {
66
+ indexName: string;
67
+ vectors: number[][];
68
+ metadata?: Record<string, any>[];
69
+ ids?: string[];
70
+ }
71
+ export interface CreateIndexParams {
72
+ indexName: string;
73
+ dimension: number;
74
+ metric?: 'cosine' | 'euclidean' | 'dotproduct';
75
+ }
76
+
77
+ export interface QueryVectorParams {
78
+ indexName: string;
79
+ queryVector: number[];
80
+ topK?: number;
81
+ filter?: Record<string, any>;
82
+ includeVector?: boolean;
83
+ }
84
+
85
+ export interface QueryVectorResponse {
86
+ results: QueryResult[];
87
+ }
88
+
89
+ export interface GetVectorIndexResponse {
90
+ dimension: number;
91
+ metric: 'cosine' | 'euclidean' | 'dotproduct';
92
+ count: number;
93
+ }
94
+
95
+ export interface SaveMessageToMemoryParams {
96
+ messages: MessageType[];
97
+ }
98
+
99
+ export type SaveMessageToMemoryResponse = MessageType[]
100
+
101
+ export interface CreateMemoryThreadParams {
102
+ title: string;
103
+ metadata: Record<string, any>;
104
+ resourceid: string;
105
+ threadId: string;
106
+ }
107
+
108
+ export type CreateMemoryThreadResponse = StorageThreadType
109
+
110
+ export interface GetMemoryThreadParams {
111
+ resourceId: string;
112
+ }
113
+
114
+ export type GetMemoryThreadResponse = StorageThreadType[]
115
+
116
+ export interface UpdateMemoryThreadParams {
117
+ title: string;
118
+ metadata: Record<string, any>;
119
+ resourceid: string;
120
+ }
121
+
122
+
123
+ export interface GetMemoryThreadMessagesResponse {
124
+ messages: CoreMessage[];
125
+ uiMessages: AiMessageType[];
126
+ }
127
+
128
+ export interface GetLogsParams {
129
+ transportId: string;
130
+ }
131
+
132
+ export interface GetLogParams {
133
+ runId: string;
134
+ transportId: string;
135
+ }
136
+
137
+ export type GetLogsResponse = BaseLogMessage[]
138
+
139
+ export type RequestFunction = (
140
+ path: string,
141
+ options?: RequestOptions
142
+ ) => Promise<any>;
package/tsconfig.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "compilerOptions": {
4
+ /* Base Options: */
5
+ "esModuleInterop": true,
6
+ "skipLibCheck": true,
7
+ "target": "es2022",
8
+ "allowJs": true,
9
+ "resolveJsonModule": true,
10
+ "moduleDetection": "force",
11
+ "isolatedModules": true,
12
+ "verbatimModuleSyntax": true,
13
+ /* Strictness */
14
+ "strict": true,
15
+ "noUncheckedIndexedAccess": true,
16
+ // "noImplicitOverride": true,
17
+ /* AND if you're building for a library in a monorepo: */
18
+ // "composite": true,
19
+ "declaration": true,
20
+ "declarationMap": true,
21
+ /* If NOT transpiling with TypeScript: */
22
+ "module": "Preserve",
23
+ "noEmit": true,
24
+ /* If your code doesn't run in the DOM: */
25
+ "lib": [
26
+ "es2022"
27
+ ]
28
+ }
29
+ }
@@ -0,0 +1,8 @@
1
+ import { defineConfig } from 'vitest/config';
2
+
3
+ export default defineConfig({
4
+ test: {
5
+ environment: 'node',
6
+ include: ['src/**/*.test.ts'],
7
+ },
8
+ });
package/CHANGELOG.md DELETED
@@ -1,21 +0,0 @@
1
- # Changelog
2
-
3
- ## 0.1.0-alpha.1 (2025-01-24)
4
-
5
- Full Changelog: [v0.0.1-alpha.0...v0.1.0-alpha.1](https://github.com/mastra-ai/client-js/compare/v0.0.1-alpha.0...v0.1.0-alpha.1)
6
-
7
- ### Features
8
-
9
- * **api:** update via SDK Studio ([377c39d](https://github.com/mastra-ai/client-js/commit/377c39db0ccbc5a3470cc3bb89c0f422c6006cdd))
10
- * **api:** update via SDK Studio ([ea76249](https://github.com/mastra-ai/client-js/commit/ea76249925f0d8c050ab9c6395ae348a317a5249))
11
- * **api:** update via SDK Studio ([#3](https://github.com/mastra-ai/client-js/issues/3)) ([2bffdc1](https://github.com/mastra-ai/client-js/commit/2bffdc11f7598e32fd4c1708c62a328767040879))
12
- * **api:** update via SDK Studio ([#5](https://github.com/mastra-ai/client-js/issues/5)) ([23197c9](https://github.com/mastra-ai/client-js/commit/23197c9df2f49e17b225614ee1be46003683e6d9))
13
- * **api:** update via SDK Studio ([#6](https://github.com/mastra-ai/client-js/issues/6)) ([bccd0b5](https://github.com/mastra-ai/client-js/commit/bccd0b53bdac6496aaabe143b24f9d1b2488ceff))
14
- * **api:** update via SDK Studio ([#7](https://github.com/mastra-ai/client-js/issues/7)) ([ef9d08b](https://github.com/mastra-ai/client-js/commit/ef9d08b0905118589cc158059579170f0e8c78d6))
15
-
16
-
17
- ### Chores
18
-
19
- * go live ([#1](https://github.com/mastra-ai/client-js/issues/1)) ([344c629](https://github.com/mastra-ai/client-js/commit/344c629987c03d842f1b4389c1ab277d3351e859))
20
- * go live ([#4](https://github.com/mastra-ai/client-js/issues/4)) ([fc11d38](https://github.com/mastra-ai/client-js/commit/fc11d38ef54611ffb23102912c3daf0c203e8490))
21
- * update SDK settings ([c8936bb](https://github.com/mastra-ai/client-js/commit/c8936bba1b979cf858f0ebcb89ca181372993fc9))
@@ -1,9 +0,0 @@
1
- /**
2
- * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
3
- */
4
- export declare class MultipartBody {
5
- body: any;
6
- constructor(body: any);
7
- get [Symbol.toStringTag](): string;
8
- }
9
- //# sourceMappingURL=MultipartBody.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MultipartBody.d.ts","sourceRoot":"","sources":["../src/_shims/MultipartBody.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,aAAa;IACL,IAAI,EAAE,GAAG;gBAAT,IAAI,EAAE,GAAG;IAC5B,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAEjC;CACF"}
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MultipartBody = void 0;
4
- /**
5
- * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
6
- */
7
- class MultipartBody {
8
- constructor(body) {
9
- this.body = body;
10
- }
11
- get [Symbol.toStringTag]() {
12
- return 'MultipartBody';
13
- }
14
- }
15
- exports.MultipartBody = MultipartBody;
16
- //# sourceMappingURL=MultipartBody.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MultipartBody.js","sourceRoot":"","sources":["../src/_shims/MultipartBody.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,MAAa,aAAa;IACxB,YAAmB,IAAS;QAAT,SAAI,GAAJ,IAAI,CAAK;IAAG,CAAC;IAChC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC;QACtB,OAAO,eAAe,CAAC;IACzB,CAAC;CACF;AALD,sCAKC"}
@@ -1,12 +0,0 @@
1
- /**
2
- * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
3
- */
4
- export class MultipartBody {
5
- constructor(body) {
6
- this.body = body;
7
- }
8
- get [Symbol.toStringTag]() {
9
- return 'MultipartBody';
10
- }
11
- }
12
- //# sourceMappingURL=MultipartBody.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MultipartBody.mjs","sourceRoot":"","sources":["../src/_shims/MultipartBody.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,OAAO,aAAa;IACxB,YAAmB,IAAS;QAAT,SAAI,GAAJ,IAAI,CAAK;IAAG,CAAC;IAChC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC;QACtB,OAAO,eAAe,CAAC;IACzB,CAAC;CACF"}
package/_shims/README.md DELETED
@@ -1,46 +0,0 @@
1
- # 👋 Wondering what everything in here does?
2
-
3
- `@mastra/client-js` supports a wide variety of runtime environments like Node.js, Deno, Bun, browsers, and various
4
- edge runtimes, as well as both CommonJS (CJS) and EcmaScript Modules (ESM).
5
-
6
- To do this, `@mastra/client-js` provides shims for either using `node-fetch` when in Node (because `fetch` is still experimental there) or the global `fetch` API built into the environment when not in Node.
7
-
8
- It uses [conditional exports](https://nodejs.org/api/packages.html#conditional-exports) to
9
- automatically select the correct shims for each environment. However, conditional exports are a fairly new
10
- feature and not supported everywhere. For instance, the TypeScript `"moduleResolution": "node"`
11
-
12
- setting doesn't consult the `exports` map, compared to `"moduleResolution": "nodeNext"`, which does.
13
- Unfortunately that's still the default setting, and it can result in errors like
14
- getting the wrong raw `Response` type from `.asResponse()`, for example.
15
-
16
- The user can work around these issues by manually importing one of:
17
-
18
- - `import '@mastra/client-js/shims/node'`
19
- - `import '@mastra/client-js/shims/web'`
20
-
21
- All of the code here in `_shims` handles selecting the automatic default shims or manual overrides.
22
-
23
- ### How it works - Runtime
24
-
25
- Runtime shims get installed by calling `setShims` exported by `@mastra/client-js/_shims/registry`.
26
-
27
- Manually importing `@mastra/client-js/shims/node` or `@mastra/client-js/shims/web`, calls `setShims` with the respective runtime shims.
28
-
29
- All client code imports shims from `@mastra/client-js/_shims/index`, which:
30
-
31
- - checks if shims have been set manually
32
- - if not, calls `setShims` with the shims from `@mastra/client-js/_shims/auto/runtime`
33
- - re-exports the installed shims from `@mastra/client-js/_shims/registry`.
34
-
35
- `@mastra/client-js/_shims/auto/runtime` exports web runtime shims.
36
- If the `node` export condition is set, the export map replaces it with `@mastra/client-js/_shims/auto/runtime-node`.
37
-
38
- ### How it works - Type time
39
-
40
- All client code imports shim types from `@mastra/client-js/_shims/index`, which selects the manual types from `@mastra/client-js/_shims/manual-types` if they have been declared, otherwise it exports the auto types from `@mastra/client-js/_shims/auto/types`.
41
-
42
- `@mastra/client-js/_shims/manual-types` exports an empty namespace.
43
- Manually importing `@mastra/client-js/shims/node` or `@mastra/client-js/shims/web` merges declarations into this empty namespace, so they get picked up by `@mastra/client-js/_shims/index`.
44
-
45
- `@mastra/client-js/_shims/auto/types` exports web type definitions.
46
- If the `node` export condition is set, the export map replaces it with `@mastra/client-js/_shims/auto/types-node`, though TS only picks this up if `"moduleResolution": "nodenext"` or `"moduleResolution": "bundler"`.
@@ -1,5 +0,0 @@
1
- /**
2
- * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
3
- */
4
- export * from "../bun-runtime.js";
5
- //# sourceMappingURL=runtime-bun.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"runtime-bun.d.ts","sourceRoot":"","sources":["../../src/_shims/auto/runtime-bun.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,gBAAgB,CAAC"}
@@ -1,21 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- /**
18
- * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
19
- */
20
- __exportStar(require("../bun-runtime.js"), exports);
21
- //# sourceMappingURL=runtime-bun.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"runtime-bun.js","sourceRoot":"","sources":["../../src/_shims/auto/runtime-bun.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;GAEG;AACH,oDAA+B"}
@@ -1,2 +0,0 @@
1
- export * from "../bun-runtime.mjs";
2
- //# sourceMappingURL=runtime-bun.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"runtime-bun.mjs","sourceRoot":"","sources":["../../src/_shims/auto/runtime-bun.ts"],"names":[],"mappings":""}
@@ -1,5 +0,0 @@
1
- /**
2
- * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
3
- */
4
- export * from "../node-runtime.js";
5
- //# sourceMappingURL=runtime-node.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"runtime-node.d.ts","sourceRoot":"","sources":["../../src/_shims/auto/runtime-node.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,iBAAiB,CAAC"}
@@ -1,21 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- /**
18
- * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
19
- */
20
- __exportStar(require("../node-runtime.js"), exports);
21
- //# sourceMappingURL=runtime-node.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"runtime-node.js","sourceRoot":"","sources":["../../src/_shims/auto/runtime-node.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;GAEG;AACH,qDAAgC"}
@@ -1,2 +0,0 @@
1
- export * from "../node-runtime.mjs";
2
- //# sourceMappingURL=runtime-node.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"runtime-node.mjs","sourceRoot":"","sources":["../../src/_shims/auto/runtime-node.ts"],"names":[],"mappings":""}
@@ -1,5 +0,0 @@
1
- /**
2
- * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
3
- */
4
- export * from "../web-runtime.js";
5
- //# sourceMappingURL=runtime.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/_shims/auto/runtime.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,gBAAgB,CAAC"}
@@ -1,21 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- /**
18
- * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
19
- */
20
- __exportStar(require("../web-runtime.js"), exports);
21
- //# sourceMappingURL=runtime.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../src/_shims/auto/runtime.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;GAEG;AACH,oDAA+B"}
@@ -1,2 +0,0 @@
1
- export * from "../web-runtime.mjs";
2
- //# sourceMappingURL=runtime.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"runtime.mjs","sourceRoot":"","sources":["../../src/_shims/auto/runtime.ts"],"names":[],"mappings":""}
@@ -1,5 +0,0 @@
1
- /**
2
- * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
3
- */
4
- export * from "../node-types.js";
5
- //# sourceMappingURL=types-node.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types-node.d.ts","sourceRoot":"","sources":["../../src/_shims/auto/types-node.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,eAAe,CAAC"}
@@ -1,21 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- /**
18
- * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
19
- */
20
- __exportStar(require("../node-types.js"), exports);
21
- //# sourceMappingURL=types-node.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types-node.js","sourceRoot":"","sources":["../../src/_shims/auto/types-node.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;GAEG;AACH,mDAA8B"}
@@ -1,2 +0,0 @@
1
- export * from "../node-types.mjs";
2
- //# sourceMappingURL=types-node.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types-node.mjs","sourceRoot":"","sources":["../../src/_shims/auto/types-node.ts"],"names":[],"mappings":""}
@@ -1,101 +0,0 @@
1
- /**
2
- * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
3
- */
4
- export type Agent = any;
5
-
6
- // @ts-ignore
7
- declare const _fetch: unknown extends typeof fetch ? never : typeof fetch;
8
- export { _fetch as fetch };
9
-
10
- // @ts-ignore
11
- type _Request = unknown extends Request ? never : Request;
12
- export { _Request as Request };
13
-
14
- // @ts-ignore
15
- type _RequestInfo = unknown extends RequestInfo ? never : RequestInfo;
16
- export { type _RequestInfo as RequestInfo };
17
-
18
- // @ts-ignore
19
- type _RequestInit = unknown extends RequestInit ? never : RequestInit;
20
- export { type _RequestInit as RequestInit };
21
-
22
- // @ts-ignore
23
- type _Response = unknown extends Response ? never : Response;
24
- export { _Response as Response };
25
-
26
- // @ts-ignore
27
- type _ResponseInit = unknown extends ResponseInit ? never : ResponseInit;
28
- export { type _ResponseInit as ResponseInit };
29
-
30
- // @ts-ignore
31
- type _ResponseType = unknown extends ResponseType ? never : ResponseType;
32
- export { type _ResponseType as ResponseType };
33
-
34
- // @ts-ignore
35
- type _BodyInit = unknown extends BodyInit ? never : BodyInit;
36
- export { type _BodyInit as BodyInit };
37
-
38
- // @ts-ignore
39
- type _Headers = unknown extends Headers ? never : Headers;
40
- export { _Headers as Headers };
41
-
42
- // @ts-ignore
43
- type _HeadersInit = unknown extends HeadersInit ? never : HeadersInit;
44
- export { type _HeadersInit as HeadersInit };
45
-
46
- type EndingType = 'native' | 'transparent';
47
-
48
- export interface BlobPropertyBag {
49
- endings?: EndingType;
50
- type?: string;
51
- }
52
-
53
- export interface FilePropertyBag extends BlobPropertyBag {
54
- lastModified?: number;
55
- }
56
-
57
- export type FileFromPathOptions = Omit<FilePropertyBag, 'lastModified'>;
58
-
59
- // @ts-ignore
60
- type _FormData = unknown extends FormData ? never : FormData;
61
- // @ts-ignore
62
- declare const _FormData: unknown extends typeof FormData ? never : typeof FormData;
63
- export { _FormData as FormData };
64
-
65
- // @ts-ignore
66
- type _File = unknown extends File ? never : File;
67
- // @ts-ignore
68
- declare const _File: unknown extends typeof File ? never : typeof File;
69
- export { _File as File };
70
-
71
- // @ts-ignore
72
- type _Blob = unknown extends Blob ? never : Blob;
73
- // @ts-ignore
74
- declare const _Blob: unknown extends typeof Blob ? never : typeof Blob;
75
- export { _Blob as Blob };
76
-
77
- export declare class Readable {
78
- readable: boolean;
79
- readonly readableEnded: boolean;
80
- readonly readableFlowing: boolean | null;
81
- readonly readableHighWaterMark: number;
82
- readonly readableLength: number;
83
- readonly readableObjectMode: boolean;
84
- destroyed: boolean;
85
- read(size?: number): any;
86
- pause(): this;
87
- resume(): this;
88
- isPaused(): boolean;
89
- destroy(error?: Error): this;
90
- [Symbol.asyncIterator](): AsyncIterableIterator<any>;
91
- }
92
-
93
- export declare class FsReadStream extends Readable {
94
- path: {}; // node type is string | Buffer
95
- }
96
-
97
- // @ts-ignore
98
- type _ReadableStream<R = any> = unknown extends ReadableStream<R> ? never : ReadableStream<R>;
99
- // @ts-ignore
100
- declare const _ReadableStream: unknown extends typeof ReadableStream ? never : typeof ReadableStream;
101
- export { _ReadableStream as ReadableStream };
@@ -1,3 +0,0 @@
1
- /**
2
- * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
3
- */
@@ -1,3 +0,0 @@
1
- /**
2
- * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
3
- */
@@ -1,6 +0,0 @@
1
- /**
2
- * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
3
- */
4
- import { type Shims } from "./registry.js";
5
- export declare function getRuntime(): Shims;
6
- //# sourceMappingURL=bun-runtime.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bun-runtime.d.ts","sourceRoot":"","sources":["../src/_shims/bun-runtime.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAIxC,wBAAgB,UAAU,IAAI,KAAK,CAMlC"}
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getRuntime = void 0;
4
- const web_runtime_1 = require("./web-runtime.js");
5
- const node_fs_1 = require("node:fs");
6
- function getRuntime() {
7
- const runtime = (0, web_runtime_1.getRuntime)();
8
- function isFsReadStream(value) {
9
- return value instanceof node_fs_1.ReadStream;
10
- }
11
- return { ...runtime, isFsReadStream };
12
- }
13
- exports.getRuntime = getRuntime;
14
- //# sourceMappingURL=bun-runtime.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bun-runtime.js","sourceRoot":"","sources":["../src/_shims/bun-runtime.ts"],"names":[],"mappings":";;;AAIA,kDAA4D;AAC5D,qCAAqD;AAErD,SAAgB,UAAU;IACxB,MAAM,OAAO,GAAG,IAAA,wBAAa,GAAE,CAAC;IAChC,SAAS,cAAc,CAAC,KAAU;QAChC,OAAO,KAAK,YAAY,oBAAY,CAAC;IACvC,CAAC;IACD,OAAO,EAAE,GAAG,OAAO,EAAE,cAAc,EAAE,CAAC;AACxC,CAAC;AAND,gCAMC"}
@@ -1,10 +0,0 @@
1
- import { getRuntime as getWebRuntime } from "./web-runtime.mjs";
2
- import { ReadStream as FsReadStream } from 'node:fs';
3
- export function getRuntime() {
4
- const runtime = getWebRuntime();
5
- function isFsReadStream(value) {
6
- return value instanceof FsReadStream;
7
- }
8
- return { ...runtime, isFsReadStream };
9
- }
10
- //# sourceMappingURL=bun-runtime.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bun-runtime.mjs","sourceRoot":"","sources":["../src/_shims/bun-runtime.ts"],"names":[],"mappings":"OAIO,EAAE,UAAU,IAAI,aAAa,EAAE;OAC/B,EAAE,UAAU,IAAI,YAAY,EAAE,MAAM,SAAS;AAEpD,MAAM,UAAU,UAAU;IACxB,MAAM,OAAO,GAAG,aAAa,EAAE,CAAC;IAChC,SAAS,cAAc,CAAC,KAAU;QAChC,OAAO,KAAK,YAAY,YAAY,CAAC;IACvC,CAAC;IACD,OAAO,EAAE,GAAG,OAAO,EAAE,cAAc,EAAE,CAAC;AACxC,CAAC"}