@mastra/react 0.2.7-alpha.0 → 0.2.7

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 (20) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/{chunk-REDZDNFN-B6_m0Vw5.cjs → chunk-REDZDNFN-8Zc7Z9Ng.cjs} +2 -2
  3. package/dist/{chunk-REDZDNFN-B6_m0Vw5.cjs.map → chunk-REDZDNFN-8Zc7Z9Ng.cjs.map} +1 -1
  4. package/dist/{chunk-REDZDNFN-B3BKm5Q3.js → chunk-REDZDNFN-ByJ-H6Es.js} +2 -2
  5. package/dist/{chunk-REDZDNFN-B3BKm5Q3.js.map → chunk-REDZDNFN-ByJ-H6Es.js.map} +1 -1
  6. package/dist/{index-D3vBmpgO.js → index--xXlugUp.js} +122 -122
  7. package/dist/{index-D3vBmpgO.js.map → index--xXlugUp.js.map} +1 -1
  8. package/dist/{index-0ViTRi6s.cjs → index-DlzF_2Lc.cjs} +122 -122
  9. package/dist/{index-0ViTRi6s.cjs.map → index-DlzF_2Lc.cjs.map} +1 -1
  10. package/dist/index.cjs +1 -1
  11. package/dist/index.js +1 -1
  12. package/dist/{token-6GSAFR2W-XRCSVUPZ-DHFPWxwn.cjs → token-6GSAFR2W-XRCSVUPZ-BJL0Ab9b.cjs} +3 -3
  13. package/dist/{token-6GSAFR2W-XRCSVUPZ-DHFPWxwn.cjs.map → token-6GSAFR2W-XRCSVUPZ-BJL0Ab9b.cjs.map} +1 -1
  14. package/dist/{token-6GSAFR2W-XRCSVUPZ-PJRK45Cx.js → token-6GSAFR2W-XRCSVUPZ-CDxnj2bf.js} +3 -3
  15. package/dist/{token-6GSAFR2W-XRCSVUPZ-PJRK45Cx.js.map → token-6GSAFR2W-XRCSVUPZ-CDxnj2bf.js.map} +1 -1
  16. package/dist/{token-util-NEHG7TUY-U7CX7GS4-B0wfFQ5e.cjs → token-util-NEHG7TUY-U7CX7GS4-Btt5t18D.cjs} +2 -2
  17. package/dist/{token-util-NEHG7TUY-U7CX7GS4-B0wfFQ5e.cjs.map → token-util-NEHG7TUY-U7CX7GS4-Btt5t18D.cjs.map} +1 -1
  18. package/dist/{token-util-NEHG7TUY-U7CX7GS4-C_BDhp1r.js → token-util-NEHG7TUY-U7CX7GS4-C_eotjlG.js} +2 -2
  19. package/dist/{token-util-NEHG7TUY-U7CX7GS4-C_BDhp1r.js.map → token-util-NEHG7TUY-U7CX7GS4-C_eotjlG.js.map} +1 -1
  20. package/package.json +3 -3
@@ -51,125 +51,6 @@ const MastraReactProvider = ({ children, baseUrl, headers, apiPrefix }) => {
51
51
  return /* @__PURE__ */ jsxRuntime.jsx(MastraClientProvider, { baseUrl, headers, apiPrefix, children });
52
52
  };
53
53
 
54
- // src/request-context/index.ts
55
- var RequestContext = class {
56
- registry = /* @__PURE__ */ new Map();
57
- constructor(iterable) {
58
- this.registry = new Map(iterable);
59
- }
60
- /**
61
- * set a value with strict typing if `Values` is a Record and the key exists in it.
62
- */
63
- set(key, value) {
64
- this.registry.set(key, value);
65
- }
66
- /**
67
- * Get a value with its type
68
- */
69
- get(key) {
70
- return this.registry.get(key);
71
- }
72
- /**
73
- * Check if a key exists in the container
74
- */
75
- has(key) {
76
- return this.registry.has(key);
77
- }
78
- /**
79
- * Delete a value by key
80
- */
81
- delete(key) {
82
- return this.registry.delete(key);
83
- }
84
- /**
85
- * Clear all values from the container
86
- */
87
- clear() {
88
- this.registry.clear();
89
- }
90
- /**
91
- * Get all keys in the container
92
- */
93
- keys() {
94
- return this.registry.keys();
95
- }
96
- /**
97
- * Get all values in the container
98
- */
99
- values() {
100
- return this.registry.values();
101
- }
102
- /**
103
- * Get all entries in the container.
104
- * Returns a discriminated union of tuples for proper type narrowing when iterating.
105
- */
106
- entries() {
107
- return this.registry.entries();
108
- }
109
- /**
110
- * Get the size of the container
111
- */
112
- size() {
113
- return this.registry.size;
114
- }
115
- /**
116
- * Execute a function for each entry in the container.
117
- * The callback receives properly typed key-value pairs.
118
- */
119
- forEach(callbackfn) {
120
- this.registry.forEach(callbackfn);
121
- }
122
- /**
123
- * Custom JSON serialization method.
124
- * Converts the internal Map to a plain object for proper JSON serialization.
125
- * Non-serializable values (e.g., RPC proxies, functions, circular references)
126
- * are skipped to prevent serialization errors when storing to database.
127
- */
128
- toJSON() {
129
- const result = {};
130
- for (const [key, value] of this.registry.entries()) {
131
- if (this.isSerializable(value)) {
132
- result[key] = value;
133
- }
134
- }
135
- return result;
136
- }
137
- /**
138
- * Check if a value can be safely serialized to JSON.
139
- */
140
- isSerializable(value) {
141
- if (value === null || value === void 0) return true;
142
- if (typeof value === "function") return false;
143
- if (typeof value === "symbol") return false;
144
- if (typeof value !== "object") return true;
145
- try {
146
- JSON.stringify(value);
147
- return true;
148
- } catch {
149
- return false;
150
- }
151
- }
152
- /**
153
- * Get all values as a typed object for destructuring.
154
- * Returns Record<string, any> when untyped, or the Values type when typed.
155
- *
156
- * @example
157
- * ```typescript
158
- * const ctx = new RequestContext<{ userId: string; apiKey: string }>();
159
- * ctx.set('userId', 'user-123');
160
- * ctx.set('apiKey', 'key-456');
161
- * const { userId, apiKey } = ctx.all;
162
- * ```
163
- */
164
- get all() {
165
- return Object.fromEntries(this.registry);
166
- }
167
- };
168
-
169
- function getDefaultExportFromCjs (x) {
170
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
171
- }
172
-
173
54
  var __create$4 = Object.create;
174
55
  var __defProp$6 = Object.defineProperty;
175
56
  var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
@@ -2353,8 +2234,8 @@ var require_get_vercel_oidc_token = __commonJS$3({
2353
2234
  }
2354
2235
  try {
2355
2236
  const [{ getTokenPayload, isExpired }, { refreshToken }] = await Promise.all([
2356
- await Promise.resolve().then(() => require('./token-util-NEHG7TUY-U7CX7GS4-B0wfFQ5e.cjs')),
2357
- await Promise.resolve().then(() => require('./token-6GSAFR2W-XRCSVUPZ-DHFPWxwn.cjs'))
2237
+ await Promise.resolve().then(() => require('./token-util-NEHG7TUY-U7CX7GS4-Btt5t18D.cjs')),
2238
+ await Promise.resolve().then(() => require('./token-6GSAFR2W-XRCSVUPZ-BJL0Ab9b.cjs'))
2358
2239
  ]);
2359
2240
  if (!token || isExpired(getTokenPayload(token))) {
2360
2241
  await refreshToken();
@@ -4950,6 +4831,125 @@ var MastraBaseError = class extends Error {
4950
4831
  var MastraError = class extends MastraBaseError {
4951
4832
  };
4952
4833
 
4834
+ // src/request-context/index.ts
4835
+ var RequestContext = class {
4836
+ registry = /* @__PURE__ */ new Map();
4837
+ constructor(iterable) {
4838
+ this.registry = new Map(iterable);
4839
+ }
4840
+ /**
4841
+ * set a value with strict typing if `Values` is a Record and the key exists in it.
4842
+ */
4843
+ set(key, value) {
4844
+ this.registry.set(key, value);
4845
+ }
4846
+ /**
4847
+ * Get a value with its type
4848
+ */
4849
+ get(key) {
4850
+ return this.registry.get(key);
4851
+ }
4852
+ /**
4853
+ * Check if a key exists in the container
4854
+ */
4855
+ has(key) {
4856
+ return this.registry.has(key);
4857
+ }
4858
+ /**
4859
+ * Delete a value by key
4860
+ */
4861
+ delete(key) {
4862
+ return this.registry.delete(key);
4863
+ }
4864
+ /**
4865
+ * Clear all values from the container
4866
+ */
4867
+ clear() {
4868
+ this.registry.clear();
4869
+ }
4870
+ /**
4871
+ * Get all keys in the container
4872
+ */
4873
+ keys() {
4874
+ return this.registry.keys();
4875
+ }
4876
+ /**
4877
+ * Get all values in the container
4878
+ */
4879
+ values() {
4880
+ return this.registry.values();
4881
+ }
4882
+ /**
4883
+ * Get all entries in the container.
4884
+ * Returns a discriminated union of tuples for proper type narrowing when iterating.
4885
+ */
4886
+ entries() {
4887
+ return this.registry.entries();
4888
+ }
4889
+ /**
4890
+ * Get the size of the container
4891
+ */
4892
+ size() {
4893
+ return this.registry.size;
4894
+ }
4895
+ /**
4896
+ * Execute a function for each entry in the container.
4897
+ * The callback receives properly typed key-value pairs.
4898
+ */
4899
+ forEach(callbackfn) {
4900
+ this.registry.forEach(callbackfn);
4901
+ }
4902
+ /**
4903
+ * Custom JSON serialization method.
4904
+ * Converts the internal Map to a plain object for proper JSON serialization.
4905
+ * Non-serializable values (e.g., RPC proxies, functions, circular references)
4906
+ * are skipped to prevent serialization errors when storing to database.
4907
+ */
4908
+ toJSON() {
4909
+ const result = {};
4910
+ for (const [key, value] of this.registry.entries()) {
4911
+ if (this.isSerializable(value)) {
4912
+ result[key] = value;
4913
+ }
4914
+ }
4915
+ return result;
4916
+ }
4917
+ /**
4918
+ * Check if a value can be safely serialized to JSON.
4919
+ */
4920
+ isSerializable(value) {
4921
+ if (value === null || value === void 0) return true;
4922
+ if (typeof value === "function") return false;
4923
+ if (typeof value === "symbol") return false;
4924
+ if (typeof value !== "object") return true;
4925
+ try {
4926
+ JSON.stringify(value);
4927
+ return true;
4928
+ } catch {
4929
+ return false;
4930
+ }
4931
+ }
4932
+ /**
4933
+ * Get all values as a typed object for destructuring.
4934
+ * Returns Record<string, any> when untyped, or the Values type when typed.
4935
+ *
4936
+ * @example
4937
+ * ```typescript
4938
+ * const ctx = new RequestContext<{ userId: string; apiKey: string }>();
4939
+ * ctx.set('userId', 'user-123');
4940
+ * ctx.set('apiKey', 'key-456');
4941
+ * const { userId, apiKey } = ctx.all;
4942
+ * ```
4943
+ */
4944
+ get all() {
4945
+ return Object.fromEntries(this.registry);
4946
+ }
4947
+ };
4948
+
4949
+ function getDefaultExportFromCjs (x) {
4950
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
4951
+ }
4952
+
4953
4953
  // ../_vendored/ai_v4/dist/chunk-OPIPXJLE.js
4954
4954
  var __create$2 = Object.create;
4955
4955
  var __defProp$3 = Object.defineProperty;
@@ -26371,4 +26371,4 @@ exports.useCreateWorkflowRun = useCreateWorkflowRun;
26371
26371
  exports.useEntity = useEntity;
26372
26372
  exports.useMastraClient = useMastraClient;
26373
26373
  exports.useStreamWorkflow = useStreamWorkflow;
26374
- //# sourceMappingURL=index-0ViTRi6s.cjs.map
26374
+ //# sourceMappingURL=index-DlzF_2Lc.cjs.map