@mastra/deployer-cloudflare 0.14.26 → 1.0.0-beta.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.
- package/CHANGELOG.md +21 -203
- package/README.md +1 -1
- package/dist/index.cjs +3 -45
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -45
- package/dist/index.js.map +1 -1
- package/dist/plugins/__fixtures__/basic.d.ts +1 -1
- package/dist/plugins/__fixtures__/basic.d.ts.map +1 -1
- package/dist/plugins/__fixtures__/empty-mastra.d.ts +1 -1
- package/dist/plugins/__fixtures__/empty-mastra.d.ts.map +1 -1
- package/dist/plugins/__fixtures__/multiple-postgres-stores.d.ts +1 -1
- package/dist/plugins/__fixtures__/multiple-postgres-stores.d.ts.map +1 -1
- package/package.json +14 -17
package/CHANGELOG.md
CHANGED
|
@@ -1,226 +1,44 @@
|
|
|
1
1
|
# @mastra/deployer-cloudflare
|
|
2
2
|
|
|
3
|
-
## 0.
|
|
3
|
+
## 1.0.0-beta.1
|
|
4
4
|
|
|
5
|
-
###
|
|
6
|
-
|
|
7
|
-
- Updated dependencies [[`cc28b2f`](https://github.com/mastra-ai/mastra/commit/cc28b2fef43d8509d93dc1b66f7d8017fa89f645), [`c56f64b`](https://github.com/mastra-ai/mastra/commit/c56f64b0d7365d744cfe99f54369795917c057b7)]:
|
|
8
|
-
- @mastra/deployer@0.24.9
|
|
9
|
-
- @mastra/core@0.24.9
|
|
10
|
-
|
|
11
|
-
## 0.14.26-alpha.0
|
|
12
|
-
|
|
13
|
-
### Patch Changes
|
|
14
|
-
|
|
15
|
-
- Updated dependencies [[`c56f64b`](https://github.com/mastra-ai/mastra/commit/c56f64b0d7365d744cfe99f54369795917c057b7)]:
|
|
16
|
-
- @mastra/core@0.24.9-alpha.0
|
|
17
|
-
- @mastra/deployer@0.24.9-alpha.0
|
|
18
|
-
|
|
19
|
-
## 0.14.25
|
|
20
|
-
|
|
21
|
-
### Patch Changes
|
|
22
|
-
|
|
23
|
-
- Updated dependencies [[`32ff95a`](https://github.com/mastra-ai/mastra/commit/32ff95ab1f5cdd3b21a460f58db466b77e58dfbd)]:
|
|
24
|
-
- @mastra/deployer@0.24.8
|
|
25
|
-
- @mastra/core@0.24.8
|
|
26
|
-
|
|
27
|
-
## 0.14.25-alpha.0
|
|
28
|
-
|
|
29
|
-
### Patch Changes
|
|
30
|
-
|
|
31
|
-
- Updated dependencies [[`32ff95a`](https://github.com/mastra-ai/mastra/commit/32ff95ab1f5cdd3b21a460f58db466b77e58dfbd)]:
|
|
32
|
-
- @mastra/deployer@0.24.8-alpha.0
|
|
33
|
-
- @mastra/core@0.24.8-alpha.0
|
|
34
|
-
|
|
35
|
-
## 0.14.24
|
|
36
|
-
|
|
37
|
-
### Patch Changes
|
|
38
|
-
|
|
39
|
-
- Updated dependencies [[`5cc85aa`](https://github.com/mastra-ai/mastra/commit/5cc85aa4329773cac8314f3aa0146227b6b158e4), [`c901d6d`](https://github.com/mastra-ai/mastra/commit/c901d6db4ddb069ccba91071b49635bdf79c6049), [`64fba3c`](https://github.com/mastra-ai/mastra/commit/64fba3c672418d9c1ca505703221a50b3ad286a9), [`c53f8e6`](https://github.com/mastra-ai/mastra/commit/c53f8e68df42464935f9a63eb0fc765a65aacb83), [`35c172e`](https://github.com/mastra-ai/mastra/commit/35c172e42c804e6bdc1e5d75435516229ffc0203), [`ceb04d6`](https://github.com/mastra-ai/mastra/commit/ceb04d6d20d2fe7d97b8bd80a308cac7bf612810), [`386ab43`](https://github.com/mastra-ai/mastra/commit/386ab4350cf2a814fb4ac0a5fc6983ca93158ffe), [`2b62302`](https://github.com/mastra-ai/mastra/commit/2b623027a9d65c1dbc963bf651e9e6a9d09da1fa), [`7d85da4`](https://github.com/mastra-ai/mastra/commit/7d85da42a5fab56009a959a9c20328558d14f4b5), [`3d7c5bd`](https://github.com/mastra-ai/mastra/commit/3d7c5bdbee1b2693cd45bf207b960dd9b7277680), [`ba9a5ad`](https://github.com/mastra-ai/mastra/commit/ba9a5ad3482e941ca8599104448a7c412f41757c), [`31b381e`](https://github.com/mastra-ai/mastra/commit/31b381efb48e031c0ecc46bc6e410ae6e67b88e5), [`54cc99c`](https://github.com/mastra-ai/mastra/commit/54cc99cb99483b9e08ec41fa1502f43b71b4c351), [`e77a5f9`](https://github.com/mastra-ai/mastra/commit/e77a5f9718dc418e29e3c8a389299ed6dc0a6401), [`b685c9c`](https://github.com/mastra-ai/mastra/commit/b685c9c0b89f49e0d4542c4ac72569682db69794), [`b069af5`](https://github.com/mastra-ai/mastra/commit/b069af514c4dcfc4fdcb164303569bfff1c26e3d), [`6c13ef3`](https://github.com/mastra-ai/mastra/commit/6c13ef39887dca28f1393dd6ac33be562fcd8731), [`7dc8304`](https://github.com/mastra-ai/mastra/commit/7dc830420296db516b86dcec663e54d0309b8fb8), [`6942109`](https://github.com/mastra-ai/mastra/commit/694210903c70e3c26b5ce8ca4f4637ca2d9eb369), [`ae6c0f8`](https://github.com/mastra-ai/mastra/commit/ae6c0f87231cd4f0a6204f2ce188f05875fd9bf5), [`62d13f4`](https://github.com/mastra-ai/mastra/commit/62d13f4d1db1c16742831f210fe4c2caf8a26d57), [`358ab98`](https://github.com/mastra-ai/mastra/commit/358ab98024c388e383aca15616e8988bf4a5b66e)]:
|
|
40
|
-
- @mastra/core@0.24.7
|
|
41
|
-
- @mastra/deployer@0.24.7
|
|
42
|
-
|
|
43
|
-
## 0.14.24-alpha.0
|
|
44
|
-
|
|
45
|
-
### Patch Changes
|
|
46
|
-
|
|
47
|
-
- Updated dependencies [[`ba9a5ad`](https://github.com/mastra-ai/mastra/commit/ba9a5ad3482e941ca8599104448a7c412f41757c), [`54cc99c`](https://github.com/mastra-ai/mastra/commit/54cc99cb99483b9e08ec41fa1502f43b71b4c351)]:
|
|
48
|
-
- @mastra/deployer@0.24.7-alpha.0
|
|
49
|
-
- @mastra/core@0.24.7-alpha.0
|
|
50
|
-
|
|
51
|
-
## 0.14.23
|
|
52
|
-
|
|
53
|
-
### Patch Changes
|
|
54
|
-
|
|
55
|
-
- Updated dependencies [[`ccb7552`](https://github.com/mastra-ai/mastra/commit/ccb75528339b4dbf3cf3adcf430f9b3a563948ff), [`5657314`](https://github.com/mastra-ai/mastra/commit/5657314a1f9d49019bb53f357fa48f75a69247ca), [`e5aca78`](https://github.com/mastra-ai/mastra/commit/e5aca78bb7f263bb8b470bedae81efe9805d7544), [`33a607a`](https://github.com/mastra-ai/mastra/commit/33a607a1f716c2029d4a1ff1603dd756129a33b3), [`cc10fc1`](https://github.com/mastra-ai/mastra/commit/cc10fc192d9f527c71a23cc9def10d8718935ee1), [`1f7ee84`](https://github.com/mastra-ai/mastra/commit/1f7ee841a643ef12d90392125881f06fdf877293), [`e7d5149`](https://github.com/mastra-ai/mastra/commit/e7d514995260b63b2108308e85c64de37dcd0f71), [`f195082`](https://github.com/mastra-ai/mastra/commit/f1950822a2425d5ccae78c5d010e02ddb027a869), [`d9986dd`](https://github.com/mastra-ai/mastra/commit/d9986dd3513f7ca3244a8e599a440ccf4d8bc28b), [`a45b0f0`](https://github.com/mastra-ai/mastra/commit/a45b0f0cd19eab1fe4deceae3abf029442c22f74), [`f6e8eb3`](https://github.com/mastra-ai/mastra/commit/f6e8eb3dac53b70b06e906b2818b1d2a5b0486d7), [`ce57a2b`](https://github.com/mastra-ai/mastra/commit/ce57a2b62fd0d5f6532e4ecd1ba9ba93ac9b95fc), [`3236f35`](https://github.com/mastra-ai/mastra/commit/3236f352ae13cc8552c2965164e97bd125dae48d), [`ce57a2b`](https://github.com/mastra-ai/mastra/commit/ce57a2b62fd0d5f6532e4ecd1ba9ba93ac9b95fc), [`0230321`](https://github.com/mastra-ai/mastra/commit/02303217870bedea0ef009bea9a952f24ed38aaf), [`7b541f4`](https://github.com/mastra-ai/mastra/commit/7b541f49eda6f5a87b738198edbd136927599475), [`0eea842`](https://github.com/mastra-ai/mastra/commit/0eea8423cbdd37f2111593c6f7d2efcde4b7e4ce), [`4ea5bc8`](https://github.com/mastra-ai/mastra/commit/4ea5bc8bab1b2ecd3e8cee62dbdd3a8dc081fd03), [`63ae8a2`](https://github.com/mastra-ai/mastra/commit/63ae8a22c0c09bbb8b9779f5f38934cd75f616af), [`bf810c5`](https://github.com/mastra-ai/mastra/commit/bf810c5c561bd8ef221c0f6bd84e69770b9a38cc), [`ac7ef07`](https://github.com/mastra-ai/mastra/commit/ac7ef07633caee89707142171d2873c888ffef85), [`522f0b4`](https://github.com/mastra-ai/mastra/commit/522f0b45330719858794eabffffde4f343f55549), [`bf810c5`](https://github.com/mastra-ai/mastra/commit/bf810c5c561bd8ef221c0f6bd84e69770b9a38cc), [`8b51d55`](https://github.com/mastra-ai/mastra/commit/8b51d55bae531edf7e383958d7ecee04df31f5d5), [`2131ac5`](https://github.com/mastra-ai/mastra/commit/2131ac571d5065f0a656c57494bca98691bb7609)]:
|
|
56
|
-
- @mastra/deployer@0.24.6
|
|
57
|
-
- @mastra/core@0.24.6
|
|
58
|
-
|
|
59
|
-
## 0.14.23-alpha.0
|
|
60
|
-
|
|
61
|
-
### Patch Changes
|
|
62
|
-
|
|
63
|
-
- Updated dependencies [[`ccb7552`](https://github.com/mastra-ai/mastra/commit/ccb75528339b4dbf3cf3adcf430f9b3a563948ff), [`5657314`](https://github.com/mastra-ai/mastra/commit/5657314a1f9d49019bb53f357fa48f75a69247ca), [`e5aca78`](https://github.com/mastra-ai/mastra/commit/e5aca78bb7f263bb8b470bedae81efe9805d7544), [`33a607a`](https://github.com/mastra-ai/mastra/commit/33a607a1f716c2029d4a1ff1603dd756129a33b3), [`cc10fc1`](https://github.com/mastra-ai/mastra/commit/cc10fc192d9f527c71a23cc9def10d8718935ee1), [`1f7ee84`](https://github.com/mastra-ai/mastra/commit/1f7ee841a643ef12d90392125881f06fdf877293), [`e7d5149`](https://github.com/mastra-ai/mastra/commit/e7d514995260b63b2108308e85c64de37dcd0f71), [`f195082`](https://github.com/mastra-ai/mastra/commit/f1950822a2425d5ccae78c5d010e02ddb027a869), [`d9986dd`](https://github.com/mastra-ai/mastra/commit/d9986dd3513f7ca3244a8e599a440ccf4d8bc28b), [`a45b0f0`](https://github.com/mastra-ai/mastra/commit/a45b0f0cd19eab1fe4deceae3abf029442c22f74), [`f6e8eb3`](https://github.com/mastra-ai/mastra/commit/f6e8eb3dac53b70b06e906b2818b1d2a5b0486d7), [`ce57a2b`](https://github.com/mastra-ai/mastra/commit/ce57a2b62fd0d5f6532e4ecd1ba9ba93ac9b95fc), [`3236f35`](https://github.com/mastra-ai/mastra/commit/3236f352ae13cc8552c2965164e97bd125dae48d), [`ce57a2b`](https://github.com/mastra-ai/mastra/commit/ce57a2b62fd0d5f6532e4ecd1ba9ba93ac9b95fc), [`0230321`](https://github.com/mastra-ai/mastra/commit/02303217870bedea0ef009bea9a952f24ed38aaf), [`7b541f4`](https://github.com/mastra-ai/mastra/commit/7b541f49eda6f5a87b738198edbd136927599475), [`0eea842`](https://github.com/mastra-ai/mastra/commit/0eea8423cbdd37f2111593c6f7d2efcde4b7e4ce), [`4ea5bc8`](https://github.com/mastra-ai/mastra/commit/4ea5bc8bab1b2ecd3e8cee62dbdd3a8dc081fd03), [`63ae8a2`](https://github.com/mastra-ai/mastra/commit/63ae8a22c0c09bbb8b9779f5f38934cd75f616af), [`bf810c5`](https://github.com/mastra-ai/mastra/commit/bf810c5c561bd8ef221c0f6bd84e69770b9a38cc), [`ac7ef07`](https://github.com/mastra-ai/mastra/commit/ac7ef07633caee89707142171d2873c888ffef85), [`522f0b4`](https://github.com/mastra-ai/mastra/commit/522f0b45330719858794eabffffde4f343f55549), [`bf810c5`](https://github.com/mastra-ai/mastra/commit/bf810c5c561bd8ef221c0f6bd84e69770b9a38cc), [`8b51d55`](https://github.com/mastra-ai/mastra/commit/8b51d55bae531edf7e383958d7ecee04df31f5d5), [`2131ac5`](https://github.com/mastra-ai/mastra/commit/2131ac571d5065f0a656c57494bca98691bb7609)]:
|
|
64
|
-
- @mastra/deployer@0.24.6-alpha.0
|
|
65
|
-
- @mastra/core@0.24.6-alpha.0
|
|
66
|
-
|
|
67
|
-
## 0.14.22
|
|
68
|
-
|
|
69
|
-
### Patch Changes
|
|
70
|
-
|
|
71
|
-
- Updated dependencies [[`880f12b`](https://github.com/mastra-ai/mastra/commit/880f12bb45a3d49faf8d22969744ffb6e01c66fd)]:
|
|
72
|
-
- @mastra/core@0.24.5
|
|
73
|
-
- @mastra/deployer@0.24.5
|
|
74
|
-
|
|
75
|
-
## 0.14.22-alpha.0
|
|
76
|
-
|
|
77
|
-
### Patch Changes
|
|
78
|
-
|
|
79
|
-
- Updated dependencies [[`880f12b`](https://github.com/mastra-ai/mastra/commit/880f12bb45a3d49faf8d22969744ffb6e01c66fd)]:
|
|
80
|
-
- @mastra/core@0.24.5-alpha.0
|
|
81
|
-
- @mastra/deployer@0.24.5-alpha.0
|
|
82
|
-
|
|
83
|
-
## 0.14.21
|
|
84
|
-
|
|
85
|
-
### Patch Changes
|
|
86
|
-
|
|
87
|
-
- Updated dependencies [[`418420f`](https://github.com/mastra-ai/mastra/commit/418420fc10a9e2b95c7bae0e1dd08876bb7aa473)]:
|
|
88
|
-
- @mastra/core@0.24.4
|
|
89
|
-
- @mastra/deployer@0.24.4
|
|
90
|
-
|
|
91
|
-
## 0.14.21-alpha.0
|
|
92
|
-
|
|
93
|
-
### Patch Changes
|
|
94
|
-
|
|
95
|
-
- Updated dependencies [[`418420f`](https://github.com/mastra-ai/mastra/commit/418420fc10a9e2b95c7bae0e1dd08876bb7aa473)]:
|
|
96
|
-
- @mastra/core@0.24.4-alpha.0
|
|
97
|
-
- @mastra/deployer@0.24.4-alpha.0
|
|
98
|
-
|
|
99
|
-
## 0.14.20
|
|
100
|
-
|
|
101
|
-
### Patch Changes
|
|
102
|
-
|
|
103
|
-
- Updated dependencies [[`7491cc0`](https://github.com/mastra-ai/mastra/commit/7491cc0350b2ba067f98c4915bf607119bd0150f), [`0d10ac7`](https://github.com/mastra-ai/mastra/commit/0d10ac7b8efa03c2f0c330eb2520148bfa6091e9), [`e3e899c`](https://github.com/mastra-ai/mastra/commit/e3e899c650f4c435445303bd97a66f5840a52a1e)]:
|
|
104
|
-
- @mastra/core@0.24.3
|
|
105
|
-
- @mastra/deployer@0.24.3
|
|
106
|
-
|
|
107
|
-
## 0.14.20-alpha.0
|
|
108
|
-
|
|
109
|
-
### Patch Changes
|
|
110
|
-
|
|
111
|
-
- Updated dependencies [[`7491cc0`](https://github.com/mastra-ai/mastra/commit/7491cc0350b2ba067f98c4915bf607119bd0150f), [`0d10ac7`](https://github.com/mastra-ai/mastra/commit/0d10ac7b8efa03c2f0c330eb2520148bfa6091e9), [`e3e899c`](https://github.com/mastra-ai/mastra/commit/e3e899c650f4c435445303bd97a66f5840a52a1e)]:
|
|
112
|
-
- @mastra/core@0.24.3-alpha.0
|
|
113
|
-
- @mastra/deployer@0.24.3-alpha.0
|
|
114
|
-
|
|
115
|
-
## 0.14.19
|
|
116
|
-
|
|
117
|
-
### Patch Changes
|
|
118
|
-
|
|
119
|
-
- Updated dependencies [[`eebb7bb`](https://github.com/mastra-ai/mastra/commit/eebb7bb407c57342a3be3a2efbe68c696589feeb), [`c6e6d07`](https://github.com/mastra-ai/mastra/commit/c6e6d071ecf346a80dceab410af2c567c7e66a57), [`0e6df8f`](https://github.com/mastra-ai/mastra/commit/0e6df8f66340992cb1b319834657deb17368de52), [`6295fd7`](https://github.com/mastra-ai/mastra/commit/6295fd783d49075d5bf2c18ff9486e94d36aaa56), [`d813cf7`](https://github.com/mastra-ai/mastra/commit/d813cf7251695d85cc60469058384ffa74974484)]:
|
|
120
|
-
- @mastra/core@0.24.2
|
|
121
|
-
- @mastra/deployer@0.24.2
|
|
122
|
-
|
|
123
|
-
## 0.14.19-alpha.0
|
|
124
|
-
|
|
125
|
-
### Patch Changes
|
|
126
|
-
|
|
127
|
-
- Updated dependencies [[`eebb7bb`](https://github.com/mastra-ai/mastra/commit/eebb7bb407c57342a3be3a2efbe68c696589feeb), [`c6e6d07`](https://github.com/mastra-ai/mastra/commit/c6e6d071ecf346a80dceab410af2c567c7e66a57), [`0e6df8f`](https://github.com/mastra-ai/mastra/commit/0e6df8f66340992cb1b319834657deb17368de52), [`6295fd7`](https://github.com/mastra-ai/mastra/commit/6295fd783d49075d5bf2c18ff9486e94d36aaa56), [`d813cf7`](https://github.com/mastra-ai/mastra/commit/d813cf7251695d85cc60469058384ffa74974484)]:
|
|
128
|
-
- @mastra/core@0.24.2-alpha.0
|
|
129
|
-
- @mastra/deployer@0.24.2-alpha.0
|
|
130
|
-
|
|
131
|
-
## 0.14.18
|
|
132
|
-
|
|
133
|
-
### Patch Changes
|
|
134
|
-
|
|
135
|
-
- Updated dependencies [[`0a0aa87`](https://github.com/mastra-ai/mastra/commit/0a0aa87910dd9234ae11e8146fbf54d71f0b1516), [`56bbbd0`](https://github.com/mastra-ai/mastra/commit/56bbbd0eb4510455ff03d6bf2827fdbd307938be), [`83b1ab1`](https://github.com/mastra-ai/mastra/commit/83b1ab13a44dd6733a401c9cf46bfbd40ae36e9f), [`d576fd8`](https://github.com/mastra-ai/mastra/commit/d576fd8f2a3c61bcf2f7d5d2bdfb496d442c46c2), [`5e48406`](https://github.com/mastra-ai/mastra/commit/5e48406766fa94e2b7c56b70fb7d6068cf7f3989), [`7fcce62`](https://github.com/mastra-ai/mastra/commit/7fcce62880c3525fbf752d59c0ac2c478cffe024), [`16a324f`](https://github.com/mastra-ai/mastra/commit/16a324f8c30a07d0d899bc2e4e7998c6b40a4cb6), [`26aee16`](https://github.com/mastra-ai/mastra/commit/26aee160149e7acb84a533bf45631aaed6dd7077), [`b063a81`](https://github.com/mastra-ai/mastra/commit/b063a8144176915a766ea15888e1e8a06a020776), [`5ff9462`](https://github.com/mastra-ai/mastra/commit/5ff9462691c80a6841b014bcc68f6a85c3fd3fbf)]:
|
|
136
|
-
- @mastra/core@0.24.1
|
|
137
|
-
- @mastra/deployer@0.24.1
|
|
138
|
-
|
|
139
|
-
## 0.14.18-alpha.0
|
|
140
|
-
|
|
141
|
-
### Patch Changes
|
|
142
|
-
|
|
143
|
-
- Updated dependencies [[`0a0aa87`](https://github.com/mastra-ai/mastra/commit/0a0aa87910dd9234ae11e8146fbf54d71f0b1516), [`56bbbd0`](https://github.com/mastra-ai/mastra/commit/56bbbd0eb4510455ff03d6bf2827fdbd307938be), [`83b1ab1`](https://github.com/mastra-ai/mastra/commit/83b1ab13a44dd6733a401c9cf46bfbd40ae36e9f), [`d576fd8`](https://github.com/mastra-ai/mastra/commit/d576fd8f2a3c61bcf2f7d5d2bdfb496d442c46c2), [`5e48406`](https://github.com/mastra-ai/mastra/commit/5e48406766fa94e2b7c56b70fb7d6068cf7f3989), [`7fcce62`](https://github.com/mastra-ai/mastra/commit/7fcce62880c3525fbf752d59c0ac2c478cffe024), [`16a324f`](https://github.com/mastra-ai/mastra/commit/16a324f8c30a07d0d899bc2e4e7998c6b40a4cb6), [`26aee16`](https://github.com/mastra-ai/mastra/commit/26aee160149e7acb84a533bf45631aaed6dd7077), [`b063a81`](https://github.com/mastra-ai/mastra/commit/b063a8144176915a766ea15888e1e8a06a020776), [`5ff9462`](https://github.com/mastra-ai/mastra/commit/5ff9462691c80a6841b014bcc68f6a85c3fd3fbf)]:
|
|
144
|
-
- @mastra/core@0.24.1-alpha.0
|
|
145
|
-
- @mastra/deployer@0.24.1-alpha.0
|
|
146
|
-
|
|
147
|
-
## 0.14.17
|
|
148
|
-
|
|
149
|
-
### Patch Changes
|
|
150
|
-
|
|
151
|
-
- update peerdeps ([`5ca1cca`](https://github.com/mastra-ai/mastra/commit/5ca1ccac61ffa7141e6d9fa8f22d3ad4d03bf5dc))
|
|
152
|
-
|
|
153
|
-
- Updated dependencies [[`5ca1cca`](https://github.com/mastra-ai/mastra/commit/5ca1ccac61ffa7141e6d9fa8f22d3ad4d03bf5dc), [`2437a90`](https://github.com/mastra-ai/mastra/commit/2437a90d94a0ff94fa8dd42d2558d73c124972d3), [`6d7e90d`](https://github.com/mastra-ai/mastra/commit/6d7e90db09713e6250f4d6c3d3cff1b4740e50f9), [`23c2614`](https://github.com/mastra-ai/mastra/commit/23c26140fdbf04b8c59e8d7d52106d67dad962ec), [`f78b908`](https://github.com/mastra-ai/mastra/commit/f78b9080e11af765969b36b4a619761056030840), [`23c2614`](https://github.com/mastra-ai/mastra/commit/23c26140fdbf04b8c59e8d7d52106d67dad962ec), [`3e6c29a`](https://github.com/mastra-ai/mastra/commit/3e6c29a8924f63da4def2cf95180f671b3b2c89c), [`139588d`](https://github.com/mastra-ai/mastra/commit/139588df7755c9111a3060f72a789c1a8c95e091), [`186b29b`](https://github.com/mastra-ai/mastra/commit/186b29bd51ac1dcc24ad3825fdb7207a6d6391a6), [`4e92a19`](https://github.com/mastra-ai/mastra/commit/4e92a19aef1bd7f608482b366b1e46873a9dc6c7), [`e365eda`](https://github.com/mastra-ai/mastra/commit/e365eda45795b43707310531cac1e2ce4e5a0712), [`dbb705e`](https://github.com/mastra-ai/mastra/commit/dbb705e61999ec655b912ea8b5d77ae4792989a7)]:
|
|
154
|
-
- @mastra/deployer@0.24.0
|
|
155
|
-
- @mastra/core@0.24.0
|
|
156
|
-
|
|
157
|
-
## 0.14.17-alpha.0
|
|
158
|
-
|
|
159
|
-
### Patch Changes
|
|
160
|
-
|
|
161
|
-
- update peerdeps ([`5ca1cca`](https://github.com/mastra-ai/mastra/commit/5ca1ccac61ffa7141e6d9fa8f22d3ad4d03bf5dc))
|
|
162
|
-
|
|
163
|
-
- Updated dependencies [[`5ca1cca`](https://github.com/mastra-ai/mastra/commit/5ca1ccac61ffa7141e6d9fa8f22d3ad4d03bf5dc), [`2437a90`](https://github.com/mastra-ai/mastra/commit/2437a90d94a0ff94fa8dd42d2558d73c124972d3), [`6d7e90d`](https://github.com/mastra-ai/mastra/commit/6d7e90db09713e6250f4d6c3d3cff1b4740e50f9), [`23c2614`](https://github.com/mastra-ai/mastra/commit/23c26140fdbf04b8c59e8d7d52106d67dad962ec), [`f78b908`](https://github.com/mastra-ai/mastra/commit/f78b9080e11af765969b36b4a619761056030840), [`23c2614`](https://github.com/mastra-ai/mastra/commit/23c26140fdbf04b8c59e8d7d52106d67dad962ec), [`3e6c29a`](https://github.com/mastra-ai/mastra/commit/3e6c29a8924f63da4def2cf95180f671b3b2c89c), [`139588d`](https://github.com/mastra-ai/mastra/commit/139588df7755c9111a3060f72a789c1a8c95e091), [`186b29b`](https://github.com/mastra-ai/mastra/commit/186b29bd51ac1dcc24ad3825fdb7207a6d6391a6), [`4e92a19`](https://github.com/mastra-ai/mastra/commit/4e92a19aef1bd7f608482b366b1e46873a9dc6c7), [`e365eda`](https://github.com/mastra-ai/mastra/commit/e365eda45795b43707310531cac1e2ce4e5a0712), [`dbb705e`](https://github.com/mastra-ai/mastra/commit/dbb705e61999ec655b912ea8b5d77ae4792989a7)]:
|
|
164
|
-
- @mastra/deployer@0.24.0-alpha.0
|
|
165
|
-
- @mastra/core@0.24.0-alpha.0
|
|
166
|
-
|
|
167
|
-
## 0.14.16
|
|
168
|
-
|
|
169
|
-
### Patch Changes
|
|
5
|
+
### Minor Changes
|
|
170
6
|
|
|
171
|
-
-
|
|
172
|
-
- @mastra/deployer@0.23.3
|
|
173
|
-
- @mastra/core@0.23.3
|
|
7
|
+
- Set `externals: true` as the default for `mastra build` and cloud-deployer to reduce bundle issues with native dependencies. ([`0dbf199`](https://github.com/mastra-ai/mastra/commit/0dbf199110f22192ce5c95b1c8148d4872b4d119))
|
|
174
8
|
|
|
175
|
-
|
|
9
|
+
**Note:** If you previously relied on the default bundling behavior (all dependencies bundled), you can explicitly set `externals: false` in your bundler configuration.
|
|
176
10
|
|
|
177
11
|
### Patch Changes
|
|
178
12
|
|
|
179
|
-
- Updated dependencies [[`
|
|
180
|
-
- @mastra/
|
|
181
|
-
- @mastra/
|
|
182
|
-
|
|
183
|
-
## 0.14.15
|
|
184
|
-
|
|
185
|
-
### Patch Changes
|
|
13
|
+
- Updated dependencies [[`4f94ed8`](https://github.com/mastra-ai/mastra/commit/4f94ed8177abfde3ec536e3574883e075423350c), [`ac3cc23`](https://github.com/mastra-ai/mastra/commit/ac3cc2397d1966bc0fc2736a223abc449d3c7719), [`a86f4df`](https://github.com/mastra-ai/mastra/commit/a86f4df0407311e0d2ea49b9a541f0938810d6a9), [`029540c`](https://github.com/mastra-ai/mastra/commit/029540ca1e582fc2dd8d288ecd4a9b0f31a954ef), [`66741d1`](https://github.com/mastra-ai/mastra/commit/66741d1a99c4f42cf23a16109939e8348ac6852e), [`01b20fe`](https://github.com/mastra-ai/mastra/commit/01b20fefb7c67c2b7d79417598ef4e60256d1225), [`0dbf199`](https://github.com/mastra-ai/mastra/commit/0dbf199110f22192ce5c95b1c8148d4872b4d119), [`a7ce182`](https://github.com/mastra-ai/mastra/commit/a7ce1822a8785ce45d62dd5c911af465e144f7d7)]:
|
|
14
|
+
- @mastra/core@1.0.0-beta.14
|
|
15
|
+
- @mastra/deployer@1.0.0-beta.14
|
|
186
16
|
|
|
187
|
-
|
|
188
|
-
- @mastra/core@0.23.2
|
|
189
|
-
- @mastra/deployer@0.23.2
|
|
17
|
+
## 1.0.0-beta.0
|
|
190
18
|
|
|
191
|
-
|
|
19
|
+
### Major Changes
|
|
192
20
|
|
|
193
|
-
|
|
21
|
+
- Moving scorers under the eval domain, api method consistency, prebuilt evals, scorers require ids. ([#9589](https://github.com/mastra-ai/mastra/pull/9589))
|
|
194
22
|
|
|
195
|
-
-
|
|
196
|
-
- @mastra/deployer@0.23.2-alpha.0
|
|
197
|
-
- @mastra/core@0.23.2-alpha.0
|
|
23
|
+
- Bump minimum required Node.js version to 22.13.0 ([#9706](https://github.com/mastra-ai/mastra/pull/9706))
|
|
198
24
|
|
|
199
|
-
|
|
25
|
+
- Removed old tracing code based on OpenTelemetry ([#9237](https://github.com/mastra-ai/mastra/pull/9237))
|
|
200
26
|
|
|
201
|
-
|
|
27
|
+
- Mark as stable ([`83d5942`](https://github.com/mastra-ai/mastra/commit/83d5942669ce7bba4a6ca4fd4da697a10eb5ebdc))
|
|
202
28
|
|
|
203
|
-
-
|
|
29
|
+
- Remove legacy evals from Mastra ([#9491](https://github.com/mastra-ai/mastra/pull/9491))
|
|
204
30
|
|
|
205
|
-
|
|
206
|
-
- @mastra/deployer@0.23.1
|
|
207
|
-
- @mastra/core@0.23.1
|
|
208
|
-
|
|
209
|
-
## 0.14.13
|
|
210
|
-
|
|
211
|
-
### Patch Changes
|
|
212
|
-
|
|
213
|
-
- Updated dependencies [[`f743dbb`](https://github.com/mastra-ai/mastra/commit/f743dbb8b40d1627b5c10c0e6fc154f4ebb6e394), [`5df9cce`](https://github.com/mastra-ai/mastra/commit/5df9cce1a753438413f64c11eeef8f845745c2a8), [`5df9cce`](https://github.com/mastra-ai/mastra/commit/5df9cce1a753438413f64c11eeef8f845745c2a8), [`2060766`](https://github.com/mastra-ai/mastra/commit/20607667bf78ea104cca3e15dfb93ae0b62c9d18), [`2060766`](https://github.com/mastra-ai/mastra/commit/20607667bf78ea104cca3e15dfb93ae0b62c9d18), [`2c4438b`](https://github.com/mastra-ai/mastra/commit/2c4438b87817ab7eed818c7990fef010475af1a3)]:
|
|
214
|
-
- @mastra/core@0.23.0
|
|
215
|
-
- @mastra/deployer@0.23.0
|
|
31
|
+
### Minor Changes
|
|
216
32
|
|
|
217
|
-
|
|
33
|
+
- Update peer dependencies to match core package version bump (1.0.0) ([#9237](https://github.com/mastra-ai/mastra/pull/9237))
|
|
218
34
|
|
|
219
35
|
### Patch Changes
|
|
220
36
|
|
|
221
|
-
-
|
|
222
|
-
-
|
|
223
|
-
|
|
37
|
+
- dependencies updates: ([`77ff370`](https://github.com/mastra-ai/mastra/commit/77ff370186ba77955620c465fd2e95360e1947ea))
|
|
38
|
+
- Updated dependency [`@babel/core@^7.28.5` ↗︎](https://www.npmjs.com/package/@babel/core/v/7.28.5) (from `^7.28.4`, in `dependencies`)
|
|
39
|
+
- Updated dependencies [[`77ff370`](https://github.com/mastra-ai/mastra/commit/77ff370186ba77955620c465fd2e95360e1947ea), [`39c9743`](https://github.com/mastra-ai/mastra/commit/39c97432d084294f8ba85fbf3ef28098ff21459e), [`f743dbb`](https://github.com/mastra-ai/mastra/commit/f743dbb8b40d1627b5c10c0e6fc154f4ebb6e394), [`3852192`](https://github.com/mastra-ai/mastra/commit/3852192c81b2a4f1f883f17d80ce50e0c60dba55), [`fec5129`](https://github.com/mastra-ai/mastra/commit/fec5129de7fc64423ea03661a56cef31dc747a0d), [`5540775`](https://github.com/mastra-ai/mastra/commit/5540775f68685e19ddb6972ad73297f117656f59), [`0491e7c`](https://github.com/mastra-ai/mastra/commit/0491e7c9b714cb0ba22187ee062147ec2dd7c712), [`f6f4903`](https://github.com/mastra-ai/mastra/commit/f6f4903397314f73362061dc5a3e8e7c61ea34aa), [`0e8ed46`](https://github.com/mastra-ai/mastra/commit/0e8ed467c54d6901a6a365f270ec15d6faadb36c), [`6c049d9`](https://github.com/mastra-ai/mastra/commit/6c049d94063fdcbd5b81c4912a2bf82a92c9cc0b), [`2f897df`](https://github.com/mastra-ai/mastra/commit/2f897df208508f46f51b7625e5dd20c37f93e0e3), [`f0f8f12`](https://github.com/mastra-ai/mastra/commit/f0f8f125c308f2d0fd36942ef652fd852df7522f), [`3443770`](https://github.com/mastra-ai/mastra/commit/3443770662df8eb24c9df3589b2792d78cfcb811), [`f0a07e0`](https://github.com/mastra-ai/mastra/commit/f0a07e0111b3307c5fabfa4094c5c2cfb734fbe6), [`aaa40e7`](https://github.com/mastra-ai/mastra/commit/aaa40e788628b319baa8e889407d11ad626547fa), [`1521d71`](https://github.com/mastra-ai/mastra/commit/1521d716e5daedc74690c983fbd961123c56756b), [`9e1911d`](https://github.com/mastra-ai/mastra/commit/9e1911db2b4db85e0e768c3f15e0d61e319869f6), [`ebac155`](https://github.com/mastra-ai/mastra/commit/ebac15564a590117db7078233f927a7e28a85106), [`dd1c38d`](https://github.com/mastra-ai/mastra/commit/dd1c38d1b75f1b695c27b40d8d9d6ed00d5e0f6f), [`5948e6a`](https://github.com/mastra-ai/mastra/commit/5948e6a5146c83666ba3f294b2be576c82a513fb), [`2ef1f3c`](https://github.com/mastra-ai/mastra/commit/2ef1f3cc1f9785998197571478821326b2a528ee), [`8940859`](https://github.com/mastra-ai/mastra/commit/89408593658199b4ad67f7b65e888f344e64a442), [`e629310`](https://github.com/mastra-ai/mastra/commit/e629310f1a73fa236d49ec7a1d1cceb6229dc7cc), [`5df9cce`](https://github.com/mastra-ai/mastra/commit/5df9cce1a753438413f64c11eeef8f845745c2a8), [`4c6b492`](https://github.com/mastra-ai/mastra/commit/4c6b492c4dd591c6a592520c1f6855d6e936d71f), [`dff01d8`](https://github.com/mastra-ai/mastra/commit/dff01d81ce1f4e4087cfac20fa868e6db138dd14), [`9d819d5`](https://github.com/mastra-ai/mastra/commit/9d819d54b61481639f4008e4694791bddf187edd), [`b7de533`](https://github.com/mastra-ai/mastra/commit/b7de53361667eb51fefd89fcaed924f3c57cee8d), [`71c8d6c`](https://github.com/mastra-ai/mastra/commit/71c8d6c161253207b2b9588bdadb7eed604f7253), [`6179a9b`](https://github.com/mastra-ai/mastra/commit/6179a9ba36ffac326de3cc3c43cdc8028d37c251), [`00f4921`](https://github.com/mastra-ai/mastra/commit/00f4921dd2c91a1e5446799599ef7116a8214a1a), [`ca8041c`](https://github.com/mastra-ai/mastra/commit/ca8041cce0379fda22ed293a565bcb5b6ddca68a), [`7051bf3`](https://github.com/mastra-ai/mastra/commit/7051bf38b3b122a069008f861f7bfc004a6d9f6e), [`a8f1494`](https://github.com/mastra-ai/mastra/commit/a8f1494f4bbdc2770bcf327d4c7d869e332183f1), [`0793497`](https://github.com/mastra-ai/mastra/commit/079349753620c40246ffd673e3f9d7d9820beff3), [`5df9cce`](https://github.com/mastra-ai/mastra/commit/5df9cce1a753438413f64c11eeef8f845745c2a8), [`a854ede`](https://github.com/mastra-ai/mastra/commit/a854ede62bf5ac0945a624ac48913dd69c73aabf), [`c576fc0`](https://github.com/mastra-ai/mastra/commit/c576fc0b100b2085afded91a37c97a0ea0ec09c7), [`3defc80`](https://github.com/mastra-ai/mastra/commit/3defc80cf2b88a1b7fc1cc4ddcb91e982a614609), [`16153fe`](https://github.com/mastra-ai/mastra/commit/16153fe7eb13c99401f48e6ca32707c965ee28b9), [`9f4a683`](https://github.com/mastra-ai/mastra/commit/9f4a6833e88b52574665c028fd5508ad5c2f6004), [`bc94344`](https://github.com/mastra-ai/mastra/commit/bc943444a1342d8a662151b7bce1df7dae32f59c), [`87f9f96`](https://github.com/mastra-ai/mastra/commit/87f9f96c772117fb868c9ea17a9eda664d41a35e), [`57d157f`](https://github.com/mastra-ai/mastra/commit/57d157f0b163a95c3e6c9eae31bdb11d1bfc64f9), [`903f67d`](https://github.com/mastra-ai/mastra/commit/903f67d184504a273893818c02b961f5423a79ad), [`2a90c55`](https://github.com/mastra-ai/mastra/commit/2a90c55a86a9210697d5adaab5ee94584b079adc), [`eb09742`](https://github.com/mastra-ai/mastra/commit/eb09742197f66c4c38154c3beec78313e69760b2), [`9e0a85d`](https://github.com/mastra-ai/mastra/commit/9e0a85d11d02ca5918463ab5c2ec55d4eebf3769), [`96d35f6`](https://github.com/mastra-ai/mastra/commit/96d35f61376bc2b1bf148648a2c1985bd51bef55), [`5cbe88a`](https://github.com/mastra-ai/mastra/commit/5cbe88aefbd9f933bca669fd371ea36bf939ac6d), [`a1bd7b8`](https://github.com/mastra-ai/mastra/commit/a1bd7b8571db16b94eb01588f451a74758c96d65), [`d78b38d`](https://github.com/mastra-ai/mastra/commit/d78b38d898fce285260d3bbb4befade54331617f), [`e41f852`](https://github.com/mastra-ai/mastra/commit/e41f852a3068be9c65818d9ab2218bae06ed0237), [`c576fc0`](https://github.com/mastra-ai/mastra/commit/c576fc0b100b2085afded91a37c97a0ea0ec09c7), [`0633100`](https://github.com/mastra-ai/mastra/commit/0633100a911ad22f5256471bdf753da21c104742), [`c710c16`](https://github.com/mastra-ai/mastra/commit/c710c1652dccfdc4111c8412bca7a6bb1d48b441), [`354ad0b`](https://github.com/mastra-ai/mastra/commit/354ad0b7b1b8183ac567f236a884fc7ede6d7138), [`cfae733`](https://github.com/mastra-ai/mastra/commit/cfae73394f4920635e6c919c8e95ff9a0788e2e5), [`e3dfda7`](https://github.com/mastra-ai/mastra/commit/e3dfda7b11bf3b8c4bb55637028befb5f387fc74), [`844ea5d`](https://github.com/mastra-ai/mastra/commit/844ea5dc0c248961e7bf73629ae7dcff503e853c), [`398fde3`](https://github.com/mastra-ai/mastra/commit/398fde3f39e707cda79372cdae8f9870e3b57c8d), [`dfe3f8c`](https://github.com/mastra-ai/mastra/commit/dfe3f8c7376ffe159236819e19ca522143c1f972), [`f0f8f12`](https://github.com/mastra-ai/mastra/commit/f0f8f125c308f2d0fd36942ef652fd852df7522f), [`0d7618b`](https://github.com/mastra-ai/mastra/commit/0d7618bc650bf2800934b243eca5648f4aeed9c2), [`7b763e5`](https://github.com/mastra-ai/mastra/commit/7b763e52fc3eaf699c2a99f2adf418dd46e4e9a5), [`d36cfbb`](https://github.com/mastra-ai/mastra/commit/d36cfbbb6565ba5f827883cc9bb648eb14befdc1), [`3697853`](https://github.com/mastra-ai/mastra/commit/3697853deeb72017d90e0f38a93c1e29221aeca0), [`c23200d`](https://github.com/mastra-ai/mastra/commit/c23200ddfd60830effb39329674ba4ca93be6aac), [`b2e45ec`](https://github.com/mastra-ai/mastra/commit/b2e45eca727a8db01a81ba93f1a5219c7183c839), [`d6d49f7`](https://github.com/mastra-ai/mastra/commit/d6d49f7b8714fa19a52ff9c7cf7fb7e73751901e), [`a534e95`](https://github.com/mastra-ai/mastra/commit/a534e9591f83b3cc1ebff99c67edf4cda7bf81d3), [`9d0e7fe`](https://github.com/mastra-ai/mastra/commit/9d0e7feca8ed98de959f53476ee1456073673348), [`53d927c`](https://github.com/mastra-ai/mastra/commit/53d927cc6f03bff33655b7e2b788da445a08731d), [`3f2faf2`](https://github.com/mastra-ai/mastra/commit/3f2faf2e2d685d6c053cc5af1bf9fedf267b2ce5), [`22f64bc`](https://github.com/mastra-ai/mastra/commit/22f64bc1d37149480b58bf2fefe35b79a1e3e7d5), [`363284b`](https://github.com/mastra-ai/mastra/commit/363284bb974e850f06f40f89a28c79d9f432d7e4), [`6c7ffcd`](https://github.com/mastra-ai/mastra/commit/6c7ffcdf9a5b0a4435eb3f934c22c05b9e2fedb3), [`83d5942`](https://github.com/mastra-ai/mastra/commit/83d5942669ce7bba4a6ca4fd4da697a10eb5ebdc), [`b7959e6`](https://github.com/mastra-ai/mastra/commit/b7959e6e25a46b480f9ea2217c4c6c588c423791), [`bda6370`](https://github.com/mastra-ai/mastra/commit/bda637009360649aaf579919e7873e33553c273e), [`d7acd8e`](https://github.com/mastra-ai/mastra/commit/d7acd8e987b5d7eff4fd98b0906c17c06a2e83d5), [`056d075`](https://github.com/mastra-ai/mastra/commit/056d075598761a47c4f6f48c0ba8f793ca915c7f), [`c7f1f7d`](https://github.com/mastra-ai/mastra/commit/c7f1f7d24f61f247f018cc2d1f33bf63212959a7), [`0bddc6d`](https://github.com/mastra-ai/mastra/commit/0bddc6d8dbd6f6008c0cba2e4960a2da75a55af1), [`4a8cade`](https://github.com/mastra-ai/mastra/commit/4a8cade69b4616da04d78e6f76649b52d843997e), [`735d8c1`](https://github.com/mastra-ai/mastra/commit/735d8c1c0d19fbc09e6f8b66cf41bc7655993838), [`acf322e`](https://github.com/mastra-ai/mastra/commit/acf322e0f1fd0189684cf529d91c694bea918a45), [`c942802`](https://github.com/mastra-ai/mastra/commit/c942802a477a925b01859a7b8688d4355715caaa), [`a0c8c1b`](https://github.com/mastra-ai/mastra/commit/a0c8c1b87d4fee252aebda73e8637fbe01d761c9), [`cc34739`](https://github.com/mastra-ai/mastra/commit/cc34739c34b6266a91bea561119240a7acf47887), [`c218bd3`](https://github.com/mastra-ai/mastra/commit/c218bd3759e32423735b04843a09404572631014), [`2c4438b`](https://github.com/mastra-ai/mastra/commit/2c4438b87817ab7eed818c7990fef010475af1a3), [`2b8893c`](https://github.com/mastra-ai/mastra/commit/2b8893cb108ef9acb72ee7835cd625610d2c1a4a), [`8e5c75b`](https://github.com/mastra-ai/mastra/commit/8e5c75bdb1d08a42d45309a4c72def4b6890230f), [`e59e0d3`](https://github.com/mastra-ai/mastra/commit/e59e0d32afb5fcf2c9f3c00c8f81f6c21d3a63fa), [`fa8409b`](https://github.com/mastra-ai/mastra/commit/fa8409bc39cfd8ba6643b9db5269b90b22e2a2f7), [`173c535`](https://github.com/mastra-ai/mastra/commit/173c535c0645b0da404fe09f003778f0b0d4e019), [`1176e03`](https://github.com/mastra-ai/mastra/commit/1176e03a0db4b8f5b0a85afbaf45d3cc7ab2d94a)]:
|
|
40
|
+
- @mastra/deployer@1.0.0-beta.0
|
|
41
|
+
- @mastra/core@1.0.0-beta.0
|
|
224
42
|
|
|
225
43
|
## 0.14.12
|
|
226
44
|
|
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ pnpm add @mastra/deployer-cloudflare
|
|
|
20
20
|
The Cloudflare deployer is used as part of the Mastra framework:
|
|
21
21
|
|
|
22
22
|
```typescript
|
|
23
|
-
import { Mastra } from '@mastra/core';
|
|
23
|
+
import { Mastra } from '@mastra/core/mastra';
|
|
24
24
|
import { CloudflareDeployer } from '@mastra/deployer-cloudflare';
|
|
25
25
|
|
|
26
26
|
const deployer = new CloudflareDeployer({
|
package/dist/index.cjs
CHANGED
|
@@ -184,11 +184,7 @@ var CloudflareDeployer = class extends deployer.Deployer {
|
|
|
184
184
|
getEntry() {
|
|
185
185
|
return `
|
|
186
186
|
import '#polyfills';
|
|
187
|
-
import {
|
|
188
|
-
import { AvailableHooks, registerHook } from '@mastra/core/hooks';
|
|
189
|
-
import { TABLE_EVALS } from '@mastra/core/storage';
|
|
190
|
-
import { scoreTracesWorkflow } from '@mastra/core/scores/scoreTraces';
|
|
191
|
-
import { checkEvalStorageFields } from '@mastra/core/utils';
|
|
187
|
+
import { scoreTracesWorkflow } from '@mastra/core/evals/scoreTraces';
|
|
192
188
|
|
|
193
189
|
export default {
|
|
194
190
|
fetch: async (request, env, context) => {
|
|
@@ -201,44 +197,6 @@ var CloudflareDeployer = class extends deployer.Deployer {
|
|
|
201
197
|
_mastra.__registerInternalWorkflow(scoreTracesWorkflow);
|
|
202
198
|
}
|
|
203
199
|
|
|
204
|
-
registerHook(AvailableHooks.ON_GENERATION, ({ input, output, metric, runId, agentName, instructions }) => {
|
|
205
|
-
evaluate({
|
|
206
|
-
agentName,
|
|
207
|
-
input,
|
|
208
|
-
metric,
|
|
209
|
-
output,
|
|
210
|
-
runId,
|
|
211
|
-
globalRunId: runId,
|
|
212
|
-
instructions,
|
|
213
|
-
});
|
|
214
|
-
});
|
|
215
|
-
|
|
216
|
-
registerHook(AvailableHooks.ON_EVALUATION, async traceObject => {
|
|
217
|
-
const storage = _mastra.getStorage();
|
|
218
|
-
if (storage) {
|
|
219
|
-
// Check for required fields
|
|
220
|
-
const logger = _mastra?.getLogger();
|
|
221
|
-
const areFieldsValid = checkEvalStorageFields(traceObject, logger);
|
|
222
|
-
if (!areFieldsValid) return;
|
|
223
|
-
|
|
224
|
-
await storage.insert({
|
|
225
|
-
tableName: TABLE_EVALS,
|
|
226
|
-
record: {
|
|
227
|
-
input: traceObject.input,
|
|
228
|
-
output: traceObject.output,
|
|
229
|
-
result: JSON.stringify(traceObject.result || {}),
|
|
230
|
-
agent_name: traceObject.agentName,
|
|
231
|
-
metric_name: traceObject.metricName,
|
|
232
|
-
instructions: traceObject.instructions,
|
|
233
|
-
test_info: null,
|
|
234
|
-
global_run_id: traceObject.globalRunId,
|
|
235
|
-
run_id: traceObject.runId,
|
|
236
|
-
created_at: new Date().toISOString(),
|
|
237
|
-
},
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
|
-
});
|
|
241
|
-
|
|
242
200
|
const app = await createHonoServer(_mastra, { tools: getToolExports(tools) });
|
|
243
201
|
return app.fetch(request, env, context);
|
|
244
202
|
}
|
|
@@ -249,9 +207,9 @@ var CloudflareDeployer = class extends deployer.Deployer {
|
|
|
249
207
|
await super.prepare(outputDirectory);
|
|
250
208
|
await this.writeFiles(outputDirectory);
|
|
251
209
|
}
|
|
252
|
-
async getBundlerOptions(serverFile, mastraEntryFile, analyzedBundleInfo, toolsPaths,
|
|
210
|
+
async getBundlerOptions(serverFile, mastraEntryFile, analyzedBundleInfo, toolsPaths, bundlerOptions) {
|
|
253
211
|
const inputOptions = await super.getBundlerOptions(serverFile, mastraEntryFile, analyzedBundleInfo, toolsPaths, {
|
|
254
|
-
|
|
212
|
+
...bundlerOptions,
|
|
255
213
|
enableEsmShim: false
|
|
256
214
|
});
|
|
257
215
|
const hasPostgresStore = await this.deps.checkDependencies(["@mastra/pg"]) === `ok`;
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/babel/mastra-instance-wrapper.ts","../src/plugins/mastra-instance-wrapper.ts","../src/babel/postgres-store-instance-checker.ts","../src/plugins/postgres-store-instance-checker.ts","../src/index.ts"],"names":["babel","mastraInstanceWrapper","transformSync","babel2","postgresStoreInstanceChecker","Deployer","writeFile","join","virtual"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBO,SAAS,qBAAA,GAAmC;AACjD,EAAA,MAAM,UAAA,GAAa,QAAA;AACnB,EAAA,MAAM,SAAA,GAAY,QAAA;AAClB,EAAA,MAAM,CAAA,GAAUA,gBAAA,CAAA,KAAA;AAEhB,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,aAAA;AAAA,IACN,OAAA,EAAS;AAAA,MACP,uBAAuB,IAAA,EAAM;AAC3B,QAAA,IAAI,CAAA,CAAE,qBAAA,CAAsB,IAAA,CAAK,IAAA,EAAM,WAAW,CAAA,EAAG;AACnD,UAAA,KAAA,MAAW,WAAA,IAAe,IAAA,CAAK,IAAA,CAAK,WAAA,CAAY,YAAA,EAAc;AAC5D,YAAA,IACE,CAAA,CAAE,aAAa,WAAA,EAAa,EAAA,EAAI,EAAE,IAAA,E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Y,EACX;AACf,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,IAAA,CAAK,QAAA,EAAS,EAAG,SAAA,EAAW,EAAE,eAAA,EAAiB,WAAA,EAAa,aAAA,EAAe,KAAA,EAAM,EAAG,UAAU,CAAA;AAAA,EACpH;AAAA,EAEA,MAAM,MAAA,GAAwB;AAC5B,IAAA,IAAA,CAAK,MAAA,EAAQ,KAAK,gFAAgF,CAAA;AAAA,EACpG;AAAA,EAEA,MAAM,SAAA,GAA2B;AAC/B,IAAA,MAAM,IAAI,MAAM,wFAAwF,CAAA;AAAA,EAC1G;AAAA,EAEA,MAAM,IAAA,CAAK,SAAA,EAAmB,eAAA,EAAyB,UAAA,EAAkD;AACvG,IAAA,MAAM,KAAA,CAAM,IAAA,CAAK,SAAA,EAAW,eAAA,EAAiB,UAAU,CAAA;AAEvD,IAAA,MAAM,SAAA,GAAa,MAAM,IAAA,CAAK,IAAA,CAAK,kBAAkB,CAAC,gBAAgB,CAAC,CAAA,KAAO,CAAA,EAAA,CAAA;AAE9E,IAAA,IAAI,SAAA,EAAW;AACb,MAAA,IAAA,CAAK,MAAA,CAAO,KAAA;AAAA,QACV;AAAA,OACF;AACA,MAAA,OAAA,CAAQ,KAAK,CAAC,CAAA;AAAA,IAChB;AAAA,EACF;AACF","file":"index.cjs","sourcesContent":["import type { PluginObj } from '@babel/core';\nimport * as babel from '@babel/core';\n\n/**\n * Babel plugin that transforms Mastra exports for Cloudflare Workers compatibility.\n *\n * This plugin:\n * 1. Identifies named exports of the 'mastra' variable\n * 2. Checks if the export is a new instance of the 'Mastra' class\n * 3. Wraps the Mastra instantiation in an arrow function to ensure proper initialization\n * in the Cloudflare Workers environment\n *\n * The transformation ensures the Mastra instance is properly scoped and initialized\n * for each request in the Cloudflare Workers environment.\n *\n * @returns {PluginObj} A Babel plugin object with a visitor that performs the transformation\n *\n * @example\n * // Before transformation:\n * export const mastra = new Mastra();\n *\n * // After transformation:\n * export const mastra = () => new Mastra();\n */\nexport function mastraInstanceWrapper(): PluginObj {\n const exportName = 'mastra';\n const className = 'Mastra';\n const t = babel.types;\n\n return {\n name: 'wrap-mastra',\n visitor: {\n ExportNamedDeclaration(path) {\n if (t.isVariableDeclaration(path.node?.declaration)) {\n for (const declaration of path.node.declaration.declarations) {\n if (\n t.isIdentifier(declaration?.id, { name: exportName }) &&\n t.isNewExpression(declaration?.init) &&\n t.isIdentifier(declaration.init.callee, { name: className })\n ) {\n declaration.init = t.arrowFunctionExpression([], declaration.init);\n // there should be only one \"mastra\" export, so we can exit the loop\n break;\n }\n }\n }\n },\n },\n } as PluginObj;\n}\n","import { transformSync } from '@babel/core';\nimport type { Plugin } from 'rollup';\nimport { mastraInstanceWrapper as mastraInstanceWrapperBabel } from '../babel/mastra-instance-wrapper';\n\nexport function mastraInstanceWrapper(mastraEntryFile: string): Plugin {\n return {\n name: 'mastra-wrapper',\n transform(code, id) {\n if (id !== mastraEntryFile) {\n return null;\n }\n\n const result = transformSync(code, {\n filename: id,\n babelrc: false,\n configFile: false,\n plugins: [mastraInstanceWrapperBabel],\n });\n\n if (!result?.code) {\n throw new Error('mastra-wrapper plugin did not return code, there is likely a bug in the plugin.');\n }\n\n return {\n code: result.code,\n map: result?.map,\n };\n },\n };\n}\n","import type { NodePath, PluginObj } from '@babel/core';\nimport * as babel from '@babel/core';\nimport type { NewExpression } from '@babel/types';\n\n/**\n * Babel plugin that enforces singleton PostgresStore instances in Cloudflare Workers.\n *\n * This plugin:\n * 1. Scans for all `new PostgresStore()` instantiations\n * 2. Records their file locations\n * 3. Throws an error if multiple instances are found\n *\n * Cloudflare Workers should only create one PostgresStore instance to avoid connection\n * pool exhaustion and ensure proper resource management.\n *\n * @returns {PluginObj} A Babel plugin object that validates PostgresStore usage\n *\n * @example\n * // Throws error if multiple instances found:\n * const store1 = new PostgresStore();\n * const store2 = new PostgresStore(); // Error thrown here\n */\nexport function postgresStoreInstanceChecker(): PluginObj {\n const t = babel.types;\n const instances: { path: NodePath<NewExpression>; location: string }[] = [];\n\n return {\n name: 'postgresstore-instance-checker',\n visitor: {\n NewExpression(path, state) {\n if (t.isIdentifier(path.node.callee) && path.node.callee.name === 'PostgresStore') {\n const filename = state.file?.opts?.filename || 'unknown file';\n const location = path.node.loc\n ? `${filename}: line ${path.node.loc.start.line}, column ${path.node.loc.start.column}`\n : 'unknown location';\n\n instances.push({\n path,\n location,\n });\n }\n },\n },\n post() {\n if (instances.length > 1) {\n const errorMessage = [\n `Found ${instances.length} PostgresStore instantiations:`,\n ...instances.map((instance, i) => ` ${i + 1}. At ${instance.location}`),\n 'Only one PostgresStore instance should be created per Cloudflare Worker.',\n ].join('\\n');\n\n const lastInstance = instances[instances.length - 1];\n throw lastInstance?.path.buildCodeFrameError(errorMessage);\n }\n },\n } as PluginObj;\n}\n","import { transformSync } from '@babel/core';\nimport type { Plugin } from 'rollup';\nimport { postgresStoreInstanceChecker as postgresStoreInstanceCheckerBabel } from '../babel/postgres-store-instance-checker';\n\nexport function postgresStoreInstanceChecker(): Plugin {\n return {\n name: 'postgres-store-instance-checker',\n transform(code, id) {\n const result = transformSync(code, {\n filename: id,\n babelrc: false,\n configFile: false,\n plugins: [postgresStoreInstanceCheckerBabel],\n });\n\n // If Babel didn't transform anything or returned no code, pass through original source.\n if (!result || typeof result.code !== 'string') {\n return null;\n }\n\n return {\n code: result.code,\n map: result.map ?? null,\n };\n },\n };\n}\n","import { writeFile } from 'fs/promises';\nimport { join } from 'path';\nimport { Deployer } from '@mastra/deployer';\nimport type { analyzeBundle } from '@mastra/deployer/analyze';\nimport virtual from '@rollup/plugin-virtual';\nimport { mastraInstanceWrapper } from './plugins/mastra-instance-wrapper';\nimport { postgresStoreInstanceChecker } from './plugins/postgres-store-instance-checker';\n\ninterface CFRoute {\n pattern: string;\n zone_name: string;\n custom_domain?: boolean;\n}\n\ninterface D1DatabaseBinding {\n binding: string;\n database_name: string;\n database_id: string;\n preview_database_id?: string;\n}\n\ninterface KVNamespaceBinding {\n binding: string;\n id: string;\n}\n\nexport class CloudflareDeployer extends Deployer {\n routes?: CFRoute[] = [];\n workerNamespace?: string;\n env?: Record<string, any>;\n projectName?: string;\n d1Databases?: D1DatabaseBinding[];\n kvNamespaces?: KVNamespaceBinding[];\n\n constructor({\n env,\n projectName = 'mastra',\n routes,\n workerNamespace,\n d1Databases,\n kvNamespaces,\n }: {\n env?: Record<string, any>;\n projectName?: string;\n routes?: CFRoute[];\n workerNamespace?: string;\n d1Databases?: D1DatabaseBinding[];\n kvNamespaces?: KVNamespaceBinding[];\n }) {\n super({ name: 'CLOUDFLARE' });\n\n this.projectName = projectName;\n this.routes = routes;\n this.workerNamespace = workerNamespace;\n\n if (env) {\n this.env = env;\n }\n\n if (d1Databases) this.d1Databases = d1Databases;\n if (kvNamespaces) this.kvNamespaces = kvNamespaces;\n }\n\n async writeFiles(outputDirectory: string): Promise<void> {\n const env = await this.loadEnvVars();\n const envsAsObject = Object.assign({}, Object.fromEntries(env.entries()), this.env);\n\n const cfWorkerName = this.projectName;\n\n const wranglerConfig: Record<string, any> = {\n name: cfWorkerName,\n main: './index.mjs',\n compatibility_date: '2025-04-01',\n compatibility_flags: ['nodejs_compat', 'nodejs_compat_populate_process_env'],\n observability: {\n logs: {\n enabled: true,\n },\n },\n vars: envsAsObject,\n };\n\n if (!this.workerNamespace && this.routes) {\n wranglerConfig.routes = this.routes;\n }\n\n if (this.d1Databases?.length) {\n wranglerConfig.d1_databases = this.d1Databases;\n }\n if (this.kvNamespaces?.length) {\n wranglerConfig.kv_namespaces = this.kvNamespaces;\n }\n await writeFile(join(outputDirectory, this.outputDir, 'wrangler.json'), JSON.stringify(wranglerConfig));\n }\n\n private getEntry(): string {\n return `\n import '#polyfills';\n import { evaluate } from '@mastra/core/eval';\n import { AvailableHooks, registerHook } from '@mastra/core/hooks';\n import { TABLE_EVALS } from '@mastra/core/storage';\n import { scoreTracesWorkflow } from '@mastra/core/scores/scoreTraces';\n import { checkEvalStorageFields } from '@mastra/core/utils';\n\n export default {\n fetch: async (request, env, context) => {\n const { mastra } = await import('#mastra');\n const { tools } = await import('#tools');\n const {createHonoServer, getToolExports} = await import('#server');\n const _mastra = mastra();\n\n if (_mastra.getStorage()) {\n _mastra.__registerInternalWorkflow(scoreTracesWorkflow);\n }\n\n registerHook(AvailableHooks.ON_GENERATION, ({ input, output, metric, runId, agentName, instructions }) => {\n evaluate({\n agentName,\n input,\n metric,\n output,\n runId,\n globalRunId: runId,\n instructions,\n });\n });\n\n registerHook(AvailableHooks.ON_EVALUATION, async traceObject => {\n const storage = _mastra.getStorage();\n if (storage) {\n // Check for required fields\n const logger = _mastra?.getLogger();\n const areFieldsValid = checkEvalStorageFields(traceObject, logger);\n if (!areFieldsValid) return;\n\n await storage.insert({\n tableName: TABLE_EVALS,\n record: {\n input: traceObject.input,\n output: traceObject.output,\n result: JSON.stringify(traceObject.result || {}),\n agent_name: traceObject.agentName,\n metric_name: traceObject.metricName,\n instructions: traceObject.instructions,\n test_info: null,\n global_run_id: traceObject.globalRunId,\n run_id: traceObject.runId,\n created_at: new Date().toISOString(),\n },\n });\n }\n });\n \n const app = await createHonoServer(_mastra, { tools: getToolExports(tools) });\n return app.fetch(request, env, context);\n }\n }\n`;\n }\n async prepare(outputDirectory: string): Promise<void> {\n await super.prepare(outputDirectory);\n await this.writeFiles(outputDirectory);\n }\n\n async getBundlerOptions(\n serverFile: string,\n mastraEntryFile: string,\n analyzedBundleInfo: Awaited<ReturnType<typeof analyzeBundle>>,\n toolsPaths: (string | string[])[],\n { enableSourcemap = false }: { enableSourcemap?: boolean } = {},\n ) {\n const inputOptions = await super.getBundlerOptions(serverFile, mastraEntryFile, analyzedBundleInfo, toolsPaths, {\n enableSourcemap,\n enableEsmShim: false,\n });\n\n const hasPostgresStore = (await this.deps.checkDependencies(['@mastra/pg'])) === `ok`;\n\n if (Array.isArray(inputOptions.plugins)) {\n inputOptions.plugins = [\n virtual({\n '#polyfills': `\nprocess.versions = process.versions || {};\nprocess.versions.node = '${process.versions.node}';\n `,\n }),\n ...inputOptions.plugins,\n mastraInstanceWrapper(mastraEntryFile),\n ];\n\n if (hasPostgresStore) {\n inputOptions.plugins.push(postgresStoreInstanceChecker());\n }\n }\n\n return inputOptions;\n }\n\n async bundle(\n entryFile: string,\n outputDirectory: string,\n { toolsPaths, projectRoot }: { toolsPaths: (string | string[])[]; projectRoot: string },\n ): Promise<void> {\n return this._bundle(this.getEntry(), entryFile, { outputDirectory, projectRoot, enableEsmShim: false }, toolsPaths);\n }\n\n async deploy(): Promise<void> {\n this.logger?.info('Deploying to Cloudflare failed. Please use the Cloudflare dashboard to deploy.');\n }\n\n async tagWorker(): Promise<void> {\n throw new Error('tagWorker method is no longer supported. Use the Cloudflare dashboard or API directly.');\n }\n\n async lint(entryFile: string, outputDirectory: string, toolsPaths: (string | string[])[]): Promise<void> {\n await super.lint(entryFile, outputDirectory, toolsPaths);\n\n const hasLibsql = (await this.deps.checkDependencies(['@mastra/libsql'])) === `ok`;\n\n if (hasLibsql) {\n this.logger.error(\n 'Cloudflare Deployer does not support @libsql/client (which may have been installed by @mastra/libsql) as a dependency. Please use Cloudflare D1 instead: @mastra/cloudflare-d1.',\n );\n process.exit(1);\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/babel/mastra-instance-wrapper.ts","../src/plugins/mastra-instance-wrapper.ts","../src/babel/postgres-store-instance-checker.ts","../src/plugins/postgres-store-instance-checker.ts","../src/index.ts"],"names":["babel","mastraInstanceWrapper","transformSync","babel2","postgresStoreInstanceChecker","Deployer","writeFile","join","virtual"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBO,SAAS,qBAAA,GAAmC;AACjD,EAAA,MAAM,UAAA,GAAa,QAAA;AACnB,EAAA,MAAM,SAAA,GAAY,QAAA;AAClB,EAAA,MAAM,CAAA,GAAUA,gBAAA,CAAA,KAAA;AAEhB,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,aAAA;AAAA,IACN,OAAA,EAAS;AAAA,MACP,uB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AO,IAAA,CAAK,OAAA,CAAQ,IAAA,CAAK,QAAA,EAAS,EAAG,SAAA,EAAW,EAAE,eAAA,EAAiB,WAAA,EAAa,aAAA,EAAe,KAAA,EAAM,EAAG,UAAU,CAAA;AAAA,EACpH;AAAA,EAEA,MAAM,MAAA,GAAwB;AAC5B,IAAA,IAAA,CAAK,MAAA,EAAQ,KAAK,gFAAgF,CAAA;AAAA,EACpG;AAAA,EAEA,MAAM,SAAA,GAA2B;AAC/B,IAAA,MAAM,IAAI,MAAM,wFAAwF,CAAA;AAAA,EAC1G;AAAA,EAEA,MAAM,IAAA,CAAK,SAAA,EAAmB,eAAA,EAAyB,UAAA,EAAkD;AACvG,IAAA,MAAM,KAAA,CAAM,IAAA,CAAK,SAAA,EAAW,eAAA,EAAiB,UAAU,CAAA;AAEvD,IAAA,MAAM,SAAA,GAAa,MAAM,IAAA,CAAK,IAAA,CAAK,kBAAkB,CAAC,gBAAgB,CAAC,CAAA,KAAO,CAAA,EAAA,CAAA;AAE9E,IAAA,IAAI,SAAA,EAAW;AACb,MAAA,IAAA,CAAK,MAAA,CAAO,KAAA;AAAA,QACV;AAAA,OACF;AACA,MAAA,OAAA,CAAQ,KAAK,CAAC,CAAA;AAAA,IAChB;AAAA,EACF;AACF","file":"index.cjs","sourcesContent":["import type { PluginObj } from '@babel/core';\nimport * as babel from '@babel/core';\n\n/**\n * Babel plugin that transforms Mastra exports for Cloudflare Workers compatibility.\n *\n * This plugin:\n * 1. Identifies named exports of the 'mastra' variable\n * 2. Checks if the export is a new instance of the 'Mastra' class\n * 3. Wraps the Mastra instantiation in an arrow function to ensure proper initialization\n * in the Cloudflare Workers environment\n *\n * The transformation ensures the Mastra instance is properly scoped and initialized\n * for each request in the Cloudflare Workers environment.\n *\n * @returns {PluginObj} A Babel plugin object with a visitor that performs the transformation\n *\n * @example\n * // Before transformation:\n * export const mastra = new Mastra();\n *\n * // After transformation:\n * export const mastra = () => new Mastra();\n */\nexport function mastraInstanceWrapper(): PluginObj {\n const exportName = 'mastra';\n const className = 'Mastra';\n const t = babel.types;\n\n return {\n name: 'wrap-mastra',\n visitor: {\n ExportNamedDeclaration(path) {\n if (t.isVariableDeclaration(path.node?.declaration)) {\n for (const declaration of path.node.declaration.declarations) {\n if (\n t.isIdentifier(declaration?.id, { name: exportName }) &&\n t.isNewExpression(declaration?.init) &&\n t.isIdentifier(declaration.init.callee, { name: className })\n ) {\n declaration.init = t.arrowFunctionExpression([], declaration.init);\n // there should be only one \"mastra\" export, so we can exit the loop\n break;\n }\n }\n }\n },\n },\n } as PluginObj;\n}\n","import { transformSync } from '@babel/core';\nimport type { Plugin } from 'rollup';\nimport { mastraInstanceWrapper as mastraInstanceWrapperBabel } from '../babel/mastra-instance-wrapper';\n\nexport function mastraInstanceWrapper(mastraEntryFile: string): Plugin {\n return {\n name: 'mastra-wrapper',\n transform(code, id) {\n if (id !== mastraEntryFile) {\n return null;\n }\n\n const result = transformSync(code, {\n filename: id,\n babelrc: false,\n configFile: false,\n plugins: [mastraInstanceWrapperBabel],\n });\n\n if (!result?.code) {\n throw new Error('mastra-wrapper plugin did not return code, there is likely a bug in the plugin.');\n }\n\n return {\n code: result.code,\n map: result?.map,\n };\n },\n };\n}\n","import type { NodePath, PluginObj } from '@babel/core';\nimport * as babel from '@babel/core';\nimport type { NewExpression } from '@babel/types';\n\n/**\n * Babel plugin that enforces singleton PostgresStore instances in Cloudflare Workers.\n *\n * This plugin:\n * 1. Scans for all `new PostgresStore()` instantiations\n * 2. Records their file locations\n * 3. Throws an error if multiple instances are found\n *\n * Cloudflare Workers should only create one PostgresStore instance to avoid connection\n * pool exhaustion and ensure proper resource management.\n *\n * @returns {PluginObj} A Babel plugin object that validates PostgresStore usage\n *\n * @example\n * // Throws error if multiple instances found:\n * const store1 = new PostgresStore();\n * const store2 = new PostgresStore(); // Error thrown here\n */\nexport function postgresStoreInstanceChecker(): PluginObj {\n const t = babel.types;\n const instances: { path: NodePath<NewExpression>; location: string }[] = [];\n\n return {\n name: 'postgresstore-instance-checker',\n visitor: {\n NewExpression(path, state) {\n if (t.isIdentifier(path.node.callee) && path.node.callee.name === 'PostgresStore') {\n const filename = state.file?.opts?.filename || 'unknown file';\n const location = path.node.loc\n ? `${filename}: line ${path.node.loc.start.line}, column ${path.node.loc.start.column}`\n : 'unknown location';\n\n instances.push({\n path,\n location,\n });\n }\n },\n },\n post() {\n if (instances.length > 1) {\n const errorMessage = [\n `Found ${instances.length} PostgresStore instantiations:`,\n ...instances.map((instance, i) => ` ${i + 1}. At ${instance.location}`),\n 'Only one PostgresStore instance should be created per Cloudflare Worker.',\n ].join('\\n');\n\n const lastInstance = instances[instances.length - 1];\n throw lastInstance?.path.buildCodeFrameError(errorMessage);\n }\n },\n } as PluginObj;\n}\n","import { transformSync } from '@babel/core';\nimport type { Plugin } from 'rollup';\nimport { postgresStoreInstanceChecker as postgresStoreInstanceCheckerBabel } from '../babel/postgres-store-instance-checker';\n\nexport function postgresStoreInstanceChecker(): Plugin {\n return {\n name: 'postgres-store-instance-checker',\n transform(code, id) {\n const result = transformSync(code, {\n filename: id,\n babelrc: false,\n configFile: false,\n plugins: [postgresStoreInstanceCheckerBabel],\n });\n\n // If Babel didn't transform anything or returned no code, pass through original source.\n if (!result || typeof result.code !== 'string') {\n return null;\n }\n\n return {\n code: result.code,\n map: result.map ?? null,\n };\n },\n };\n}\n","import { writeFile } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { Deployer } from '@mastra/deployer';\nimport type { analyzeBundle } from '@mastra/deployer/analyze';\nimport type { BundlerOptions } from '@mastra/deployer/bundler';\nimport virtual from '@rollup/plugin-virtual';\nimport { mastraInstanceWrapper } from './plugins/mastra-instance-wrapper';\nimport { postgresStoreInstanceChecker } from './plugins/postgres-store-instance-checker';\n\ninterface CFRoute {\n pattern: string;\n zone_name: string;\n custom_domain?: boolean;\n}\n\ninterface D1DatabaseBinding {\n binding: string;\n database_name: string;\n database_id: string;\n preview_database_id?: string;\n}\n\ninterface KVNamespaceBinding {\n binding: string;\n id: string;\n}\n\nexport class CloudflareDeployer extends Deployer {\n routes?: CFRoute[] = [];\n workerNamespace?: string;\n env?: Record<string, any>;\n projectName?: string;\n d1Databases?: D1DatabaseBinding[];\n kvNamespaces?: KVNamespaceBinding[];\n\n constructor({\n env,\n projectName = 'mastra',\n routes,\n workerNamespace,\n d1Databases,\n kvNamespaces,\n }: {\n env?: Record<string, any>;\n projectName?: string;\n routes?: CFRoute[];\n workerNamespace?: string;\n d1Databases?: D1DatabaseBinding[];\n kvNamespaces?: KVNamespaceBinding[];\n }) {\n super({ name: 'CLOUDFLARE' });\n\n this.projectName = projectName;\n this.routes = routes;\n this.workerNamespace = workerNamespace;\n\n if (env) {\n this.env = env;\n }\n\n if (d1Databases) this.d1Databases = d1Databases;\n if (kvNamespaces) this.kvNamespaces = kvNamespaces;\n }\n\n async writeFiles(outputDirectory: string): Promise<void> {\n const env = await this.loadEnvVars();\n const envsAsObject = Object.assign({}, Object.fromEntries(env.entries()), this.env);\n\n const cfWorkerName = this.projectName;\n\n const wranglerConfig: Record<string, any> = {\n name: cfWorkerName,\n main: './index.mjs',\n compatibility_date: '2025-04-01',\n compatibility_flags: ['nodejs_compat', 'nodejs_compat_populate_process_env'],\n observability: {\n logs: {\n enabled: true,\n },\n },\n vars: envsAsObject,\n };\n\n if (!this.workerNamespace && this.routes) {\n wranglerConfig.routes = this.routes;\n }\n\n if (this.d1Databases?.length) {\n wranglerConfig.d1_databases = this.d1Databases;\n }\n if (this.kvNamespaces?.length) {\n wranglerConfig.kv_namespaces = this.kvNamespaces;\n }\n await writeFile(join(outputDirectory, this.outputDir, 'wrangler.json'), JSON.stringify(wranglerConfig));\n }\n\n private getEntry(): string {\n return `\n import '#polyfills';\n import { scoreTracesWorkflow } from '@mastra/core/evals/scoreTraces';\n\n export default {\n fetch: async (request, env, context) => {\n const { mastra } = await import('#mastra');\n const { tools } = await import('#tools');\n const {createHonoServer, getToolExports} = await import('#server');\n const _mastra = mastra();\n\n if (_mastra.getStorage()) {\n _mastra.__registerInternalWorkflow(scoreTracesWorkflow);\n }\n\n const app = await createHonoServer(_mastra, { tools: getToolExports(tools) });\n return app.fetch(request, env, context);\n }\n }\n`;\n }\n async prepare(outputDirectory: string): Promise<void> {\n await super.prepare(outputDirectory);\n await this.writeFiles(outputDirectory);\n }\n\n protected async getBundlerOptions(\n serverFile: string,\n mastraEntryFile: string,\n analyzedBundleInfo: Awaited<ReturnType<typeof analyzeBundle>>,\n toolsPaths: (string | string[])[],\n bundlerOptions: BundlerOptions,\n ) {\n const inputOptions = await super.getBundlerOptions(serverFile, mastraEntryFile, analyzedBundleInfo, toolsPaths, {\n ...bundlerOptions,\n enableEsmShim: false,\n });\n\n const hasPostgresStore = (await this.deps.checkDependencies(['@mastra/pg'])) === `ok`;\n\n if (Array.isArray(inputOptions.plugins)) {\n inputOptions.plugins = [\n virtual({\n '#polyfills': `\nprocess.versions = process.versions || {};\nprocess.versions.node = '${process.versions.node}';\n `,\n }),\n ...inputOptions.plugins,\n mastraInstanceWrapper(mastraEntryFile),\n ];\n\n if (hasPostgresStore) {\n inputOptions.plugins.push(postgresStoreInstanceChecker());\n }\n }\n\n return inputOptions;\n }\n\n async bundle(\n entryFile: string,\n outputDirectory: string,\n { toolsPaths, projectRoot }: { toolsPaths: (string | string[])[]; projectRoot: string },\n ): Promise<void> {\n return this._bundle(this.getEntry(), entryFile, { outputDirectory, projectRoot, enableEsmShim: false }, toolsPaths);\n }\n\n async deploy(): Promise<void> {\n this.logger?.info('Deploying to Cloudflare failed. Please use the Cloudflare dashboard to deploy.');\n }\n\n async tagWorker(): Promise<void> {\n throw new Error('tagWorker method is no longer supported. Use the Cloudflare dashboard or API directly.');\n }\n\n async lint(entryFile: string, outputDirectory: string, toolsPaths: (string | string[])[]): Promise<void> {\n await super.lint(entryFile, outputDirectory, toolsPaths);\n\n const hasLibsql = (await this.deps.checkDependencies(['@mastra/libsql'])) === `ok`;\n\n if (hasLibsql) {\n this.logger.error(\n 'Cloudflare Deployer does not support @libsql/client (which may have been installed by @mastra/libsql) as a dependency. Please use Cloudflare D1 instead: @mastra/cloudflare-d1.',\n );\n process.exit(1);\n }\n }\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Deployer } from '@mastra/deployer';
|
|
2
2
|
import type { analyzeBundle } from '@mastra/deployer/analyze';
|
|
3
|
+
import type { BundlerOptions } from '@mastra/deployer/bundler';
|
|
3
4
|
interface CFRoute {
|
|
4
5
|
pattern: string;
|
|
5
6
|
zone_name: string;
|
|
@@ -33,9 +34,7 @@ export declare class CloudflareDeployer extends Deployer {
|
|
|
33
34
|
writeFiles(outputDirectory: string): Promise<void>;
|
|
34
35
|
private getEntry;
|
|
35
36
|
prepare(outputDirectory: string): Promise<void>;
|
|
36
|
-
getBundlerOptions(serverFile: string, mastraEntryFile: string, analyzedBundleInfo: Awaited<ReturnType<typeof analyzeBundle>>, toolsPaths: (string | string[])[],
|
|
37
|
-
enableSourcemap?: boolean;
|
|
38
|
-
}): Promise<import("rollup").InputOptions>;
|
|
37
|
+
protected getBundlerOptions(serverFile: string, mastraEntryFile: string, analyzedBundleInfo: Awaited<ReturnType<typeof analyzeBundle>>, toolsPaths: (string | string[])[], bundlerOptions: BundlerOptions): Promise<import("rollup").InputOptions>;
|
|
39
38
|
bundle(entryFile: string, outputDirectory: string, { toolsPaths, projectRoot }: {
|
|
40
39
|
toolsPaths: (string | string[])[];
|
|
41
40
|
projectRoot: string;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"A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GAAG,OAAO,CAAC,IAAI,CAAC;IAgCxD,OAAO,CAAC,QAAQ;IAsBV,OAAO,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;cAKrC,iBAAiB,CAC/B,UAAU,EAAE,MAAM,EAClB,eAAe,EAAE,MAAM,EACvB,kBAAkB,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC,EAC7D,UAAU,EAAE,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC,EAAE,EACjC,cAAc,EAAE,cAAc;IA6B1B,MAAM,CACV,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,MAAM,EACvB,EAAE,UAAU,EAAE,WAAW,EAAE,EAAE;QAAE,UAAU,EAAE,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC,EAAE,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,GACtF,OAAO,CAAC,IAAI,CAAC;IAIV,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAIvB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAI1B,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAYzG"}
|
package/dist/index.js
CHANGED
|
@@ -160,11 +160,7 @@ var CloudflareDeployer = class extends Deployer {
|
|
|
160
160
|
getEntry() {
|
|
161
161
|
return `
|
|
162
162
|
import '#polyfills';
|
|
163
|
-
import {
|
|
164
|
-
import { AvailableHooks, registerHook } from '@mastra/core/hooks';
|
|
165
|
-
import { TABLE_EVALS } from '@mastra/core/storage';
|
|
166
|
-
import { scoreTracesWorkflow } from '@mastra/core/scores/scoreTraces';
|
|
167
|
-
import { checkEvalStorageFields } from '@mastra/core/utils';
|
|
163
|
+
import { scoreTracesWorkflow } from '@mastra/core/evals/scoreTraces';
|
|
168
164
|
|
|
169
165
|
export default {
|
|
170
166
|
fetch: async (request, env, context) => {
|
|
@@ -177,44 +173,6 @@ var CloudflareDeployer = class extends Deployer {
|
|
|
177
173
|
_mastra.__registerInternalWorkflow(scoreTracesWorkflow);
|
|
178
174
|
}
|
|
179
175
|
|
|
180
|
-
registerHook(AvailableHooks.ON_GENERATION, ({ input, output, metric, runId, agentName, instructions }) => {
|
|
181
|
-
evaluate({
|
|
182
|
-
agentName,
|
|
183
|
-
input,
|
|
184
|
-
metric,
|
|
185
|
-
output,
|
|
186
|
-
runId,
|
|
187
|
-
globalRunId: runId,
|
|
188
|
-
instructions,
|
|
189
|
-
});
|
|
190
|
-
});
|
|
191
|
-
|
|
192
|
-
registerHook(AvailableHooks.ON_EVALUATION, async traceObject => {
|
|
193
|
-
const storage = _mastra.getStorage();
|
|
194
|
-
if (storage) {
|
|
195
|
-
// Check for required fields
|
|
196
|
-
const logger = _mastra?.getLogger();
|
|
197
|
-
const areFieldsValid = checkEvalStorageFields(traceObject, logger);
|
|
198
|
-
if (!areFieldsValid) return;
|
|
199
|
-
|
|
200
|
-
await storage.insert({
|
|
201
|
-
tableName: TABLE_EVALS,
|
|
202
|
-
record: {
|
|
203
|
-
input: traceObject.input,
|
|
204
|
-
output: traceObject.output,
|
|
205
|
-
result: JSON.stringify(traceObject.result || {}),
|
|
206
|
-
agent_name: traceObject.agentName,
|
|
207
|
-
metric_name: traceObject.metricName,
|
|
208
|
-
instructions: traceObject.instructions,
|
|
209
|
-
test_info: null,
|
|
210
|
-
global_run_id: traceObject.globalRunId,
|
|
211
|
-
run_id: traceObject.runId,
|
|
212
|
-
created_at: new Date().toISOString(),
|
|
213
|
-
},
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
});
|
|
217
|
-
|
|
218
176
|
const app = await createHonoServer(_mastra, { tools: getToolExports(tools) });
|
|
219
177
|
return app.fetch(request, env, context);
|
|
220
178
|
}
|
|
@@ -225,9 +183,9 @@ var CloudflareDeployer = class extends Deployer {
|
|
|
225
183
|
await super.prepare(outputDirectory);
|
|
226
184
|
await this.writeFiles(outputDirectory);
|
|
227
185
|
}
|
|
228
|
-
async getBundlerOptions(serverFile, mastraEntryFile, analyzedBundleInfo, toolsPaths,
|
|
186
|
+
async getBundlerOptions(serverFile, mastraEntryFile, analyzedBundleInfo, toolsPaths, bundlerOptions) {
|
|
229
187
|
const inputOptions = await super.getBundlerOptions(serverFile, mastraEntryFile, analyzedBundleInfo, toolsPaths, {
|
|
230
|
-
|
|
188
|
+
...bundlerOptions,
|
|
231
189
|
enableEsmShim: false
|
|
232
190
|
});
|
|
233
191
|
const hasPostgresStore = await this.deps.checkDependencies(["@mastra/pg"]) === `ok`;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/babel/mastra-instance-wrapper.ts","../src/plugins/mastra-instance-wrapper.ts","../src/babel/postgres-store-instance-checker.ts","../src/plugins/postgres-store-instance-checker.ts","../src/index.ts"],"names":["mastraInstanceWrapper","babel2","postgresStoreInstanceChecker","transformSync"],"mappings":";;;;;;;;AAwBO,SAAS,qBAAA,GAAmC;AACjD,EAAA,MAAM,UAAA,GAAa,QAAA;AACnB,EAAA,MAAM,SAAA,GAAY,QAAA;AAClB,EAAA,MAAM,CAAA,GAAU,KAAA,CAAA,KAAA;AAEhB,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,aAAA;AAAA,IACN,OAAA,EAAS;AAAA,MACP,uBAAuB,IAAA,EAAM;AAC3B,QAAA,IAAI,CAAA,CAAE,qBAAA,CAAsB,IAAA,CAAK,IAAA,EAAM,WAAW,CAAA,EAAG;AACnD,UAAA,KAAA,MAAW,WAAA,IAAe,IAAA,CAAK,IAAA,CAAK,WAAA,CAAY,YAAA,EAAc;AAC5D,YAAA,IACE,CAAA,CAAE,aAAa,WAAA,EAAa,EAAA,EAAI,EAAE,IAAA,EAAM,UAAA,EAAY,CAAA,IACpD,CAAA,CAAE,eAAA,CAAgB,aAAa,IAAI,CAAA,I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EAAW,EAAE,eAAA,EAAiB,WAAA,EAAa,aAAA,EAAe,KAAA,EAAM,EAAG,UAAU,CAAA;AAAA,EACpH;AAAA,EAEA,MAAM,MAAA,GAAwB;AAC5B,IAAA,IAAA,CAAK,MAAA,EAAQ,KAAK,gFAAgF,CAAA;AAAA,EACpG;AAAA,EAEA,MAAM,SAAA,GAA2B;AAC/B,IAAA,MAAM,IAAI,MAAM,wFAAwF,CAAA;AAAA,EAC1G;AAAA,EAEA,MAAM,IAAA,CAAK,SAAA,EAAmB,eAAA,EAAyB,UAAA,EAAkD;AACvG,IAAA,MAAM,KAAA,CAAM,IAAA,CAAK,SAAA,EAAW,eAAA,EAAiB,UAAU,CAAA;AAEvD,IAAA,MAAM,SAAA,GAAa,MAAM,IAAA,CAAK,IAAA,CAAK,kBAAkB,CAAC,gBAAgB,CAAC,CAAA,KAAO,CAAA,EAAA,CAAA;AAE9E,IAAA,IAAI,SAAA,EAAW;AACb,MAAA,IAAA,CAAK,MAAA,CAAO,KAAA;AAAA,QACV;AAAA,OACF;AACA,MAAA,OAAA,CAAQ,KAAK,CAAC,CAAA;AAAA,IAChB;AAAA,EACF;AACF","file":"index.js","sourcesContent":["import type { PluginObj } from '@babel/core';\nimport * as babel from '@babel/core';\n\n/**\n * Babel plugin that transforms Mastra exports for Cloudflare Workers compatibility.\n *\n * This plugin:\n * 1. Identifies named exports of the 'mastra' variable\n * 2. Checks if the export is a new instance of the 'Mastra' class\n * 3. Wraps the Mastra instantiation in an arrow function to ensure proper initialization\n * in the Cloudflare Workers environment\n *\n * The transformation ensures the Mastra instance is properly scoped and initialized\n * for each request in the Cloudflare Workers environment.\n *\n * @returns {PluginObj} A Babel plugin object with a visitor that performs the transformation\n *\n * @example\n * // Before transformation:\n * export const mastra = new Mastra();\n *\n * // After transformation:\n * export const mastra = () => new Mastra();\n */\nexport function mastraInstanceWrapper(): PluginObj {\n const exportName = 'mastra';\n const className = 'Mastra';\n const t = babel.types;\n\n return {\n name: 'wrap-mastra',\n visitor: {\n ExportNamedDeclaration(path) {\n if (t.isVariableDeclaration(path.node?.declaration)) {\n for (const declaration of path.node.declaration.declarations) {\n if (\n t.isIdentifier(declaration?.id, { name: exportName }) &&\n t.isNewExpression(declaration?.init) &&\n t.isIdentifier(declaration.init.callee, { name: className })\n ) {\n declaration.init = t.arrowFunctionExpression([], declaration.init);\n // there should be only one \"mastra\" export, so we can exit the loop\n break;\n }\n }\n }\n },\n },\n } as PluginObj;\n}\n","import { transformSync } from '@babel/core';\nimport type { Plugin } from 'rollup';\nimport { mastraInstanceWrapper as mastraInstanceWrapperBabel } from '../babel/mastra-instance-wrapper';\n\nexport function mastraInstanceWrapper(mastraEntryFile: string): Plugin {\n return {\n name: 'mastra-wrapper',\n transform(code, id) {\n if (id !== mastraEntryFile) {\n return null;\n }\n\n const result = transformSync(code, {\n filename: id,\n babelrc: false,\n configFile: false,\n plugins: [mastraInstanceWrapperBabel],\n });\n\n if (!result?.code) {\n throw new Error('mastra-wrapper plugin did not return code, there is likely a bug in the plugin.');\n }\n\n return {\n code: result.code,\n map: result?.map,\n };\n },\n };\n}\n","import type { NodePath, PluginObj } from '@babel/core';\nimport * as babel from '@babel/core';\nimport type { NewExpression } from '@babel/types';\n\n/**\n * Babel plugin that enforces singleton PostgresStore instances in Cloudflare Workers.\n *\n * This plugin:\n * 1. Scans for all `new PostgresStore()` instantiations\n * 2. Records their file locations\n * 3. Throws an error if multiple instances are found\n *\n * Cloudflare Workers should only create one PostgresStore instance to avoid connection\n * pool exhaustion and ensure proper resource management.\n *\n * @returns {PluginObj} A Babel plugin object that validates PostgresStore usage\n *\n * @example\n * // Throws error if multiple instances found:\n * const store1 = new PostgresStore();\n * const store2 = new PostgresStore(); // Error thrown here\n */\nexport function postgresStoreInstanceChecker(): PluginObj {\n const t = babel.types;\n const instances: { path: NodePath<NewExpression>; location: string }[] = [];\n\n return {\n name: 'postgresstore-instance-checker',\n visitor: {\n NewExpression(path, state) {\n if (t.isIdentifier(path.node.callee) && path.node.callee.name === 'PostgresStore') {\n const filename = state.file?.opts?.filename || 'unknown file';\n const location = path.node.loc\n ? `${filename}: line ${path.node.loc.start.line}, column ${path.node.loc.start.column}`\n : 'unknown location';\n\n instances.push({\n path,\n location,\n });\n }\n },\n },\n post() {\n if (instances.length > 1) {\n const errorMessage = [\n `Found ${instances.length} PostgresStore instantiations:`,\n ...instances.map((instance, i) => ` ${i + 1}. At ${instance.location}`),\n 'Only one PostgresStore instance should be created per Cloudflare Worker.',\n ].join('\\n');\n\n const lastInstance = instances[instances.length - 1];\n throw lastInstance?.path.buildCodeFrameError(errorMessage);\n }\n },\n } as PluginObj;\n}\n","import { transformSync } from '@babel/core';\nimport type { Plugin } from 'rollup';\nimport { postgresStoreInstanceChecker as postgresStoreInstanceCheckerBabel } from '../babel/postgres-store-instance-checker';\n\nexport function postgresStoreInstanceChecker(): Plugin {\n return {\n name: 'postgres-store-instance-checker',\n transform(code, id) {\n const result = transformSync(code, {\n filename: id,\n babelrc: false,\n configFile: false,\n plugins: [postgresStoreInstanceCheckerBabel],\n });\n\n // If Babel didn't transform anything or returned no code, pass through original source.\n if (!result || typeof result.code !== 'string') {\n return null;\n }\n\n return {\n code: result.code,\n map: result.map ?? null,\n };\n },\n };\n}\n","import { writeFile } from 'fs/promises';\nimport { join } from 'path';\nimport { Deployer } from '@mastra/deployer';\nimport type { analyzeBundle } from '@mastra/deployer/analyze';\nimport virtual from '@rollup/plugin-virtual';\nimport { mastraInstanceWrapper } from './plugins/mastra-instance-wrapper';\nimport { postgresStoreInstanceChecker } from './plugins/postgres-store-instance-checker';\n\ninterface CFRoute {\n pattern: string;\n zone_name: string;\n custom_domain?: boolean;\n}\n\ninterface D1DatabaseBinding {\n binding: string;\n database_name: string;\n database_id: string;\n preview_database_id?: string;\n}\n\ninterface KVNamespaceBinding {\n binding: string;\n id: string;\n}\n\nexport class CloudflareDeployer extends Deployer {\n routes?: CFRoute[] = [];\n workerNamespace?: string;\n env?: Record<string, any>;\n projectName?: string;\n d1Databases?: D1DatabaseBinding[];\n kvNamespaces?: KVNamespaceBinding[];\n\n constructor({\n env,\n projectName = 'mastra',\n routes,\n workerNamespace,\n d1Databases,\n kvNamespaces,\n }: {\n env?: Record<string, any>;\n projectName?: string;\n routes?: CFRoute[];\n workerNamespace?: string;\n d1Databases?: D1DatabaseBinding[];\n kvNamespaces?: KVNamespaceBinding[];\n }) {\n super({ name: 'CLOUDFLARE' });\n\n this.projectName = projectName;\n this.routes = routes;\n this.workerNamespace = workerNamespace;\n\n if (env) {\n this.env = env;\n }\n\n if (d1Databases) this.d1Databases = d1Databases;\n if (kvNamespaces) this.kvNamespaces = kvNamespaces;\n }\n\n async writeFiles(outputDirectory: string): Promise<void> {\n const env = await this.loadEnvVars();\n const envsAsObject = Object.assign({}, Object.fromEntries(env.entries()), this.env);\n\n const cfWorkerName = this.projectName;\n\n const wranglerConfig: Record<string, any> = {\n name: cfWorkerName,\n main: './index.mjs',\n compatibility_date: '2025-04-01',\n compatibility_flags: ['nodejs_compat', 'nodejs_compat_populate_process_env'],\n observability: {\n logs: {\n enabled: true,\n },\n },\n vars: envsAsObject,\n };\n\n if (!this.workerNamespace && this.routes) {\n wranglerConfig.routes = this.routes;\n }\n\n if (this.d1Databases?.length) {\n wranglerConfig.d1_databases = this.d1Databases;\n }\n if (this.kvNamespaces?.length) {\n wranglerConfig.kv_namespaces = this.kvNamespaces;\n }\n await writeFile(join(outputDirectory, this.outputDir, 'wrangler.json'), JSON.stringify(wranglerConfig));\n }\n\n private getEntry(): string {\n return `\n import '#polyfills';\n import { evaluate } from '@mastra/core/eval';\n import { AvailableHooks, registerHook } from '@mastra/core/hooks';\n import { TABLE_EVALS } from '@mastra/core/storage';\n import { scoreTracesWorkflow } from '@mastra/core/scores/scoreTraces';\n import { checkEvalStorageFields } from '@mastra/core/utils';\n\n export default {\n fetch: async (request, env, context) => {\n const { mastra } = await import('#mastra');\n const { tools } = await import('#tools');\n const {createHonoServer, getToolExports} = await import('#server');\n const _mastra = mastra();\n\n if (_mastra.getStorage()) {\n _mastra.__registerInternalWorkflow(scoreTracesWorkflow);\n }\n\n registerHook(AvailableHooks.ON_GENERATION, ({ input, output, metric, runId, agentName, instructions }) => {\n evaluate({\n agentName,\n input,\n metric,\n output,\n runId,\n globalRunId: runId,\n instructions,\n });\n });\n\n registerHook(AvailableHooks.ON_EVALUATION, async traceObject => {\n const storage = _mastra.getStorage();\n if (storage) {\n // Check for required fields\n const logger = _mastra?.getLogger();\n const areFieldsValid = checkEvalStorageFields(traceObject, logger);\n if (!areFieldsValid) return;\n\n await storage.insert({\n tableName: TABLE_EVALS,\n record: {\n input: traceObject.input,\n output: traceObject.output,\n result: JSON.stringify(traceObject.result || {}),\n agent_name: traceObject.agentName,\n metric_name: traceObject.metricName,\n instructions: traceObject.instructions,\n test_info: null,\n global_run_id: traceObject.globalRunId,\n run_id: traceObject.runId,\n created_at: new Date().toISOString(),\n },\n });\n }\n });\n \n const app = await createHonoServer(_mastra, { tools: getToolExports(tools) });\n return app.fetch(request, env, context);\n }\n }\n`;\n }\n async prepare(outputDirectory: string): Promise<void> {\n await super.prepare(outputDirectory);\n await this.writeFiles(outputDirectory);\n }\n\n async getBundlerOptions(\n serverFile: string,\n mastraEntryFile: string,\n analyzedBundleInfo: Awaited<ReturnType<typeof analyzeBundle>>,\n toolsPaths: (string | string[])[],\n { enableSourcemap = false }: { enableSourcemap?: boolean } = {},\n ) {\n const inputOptions = await super.getBundlerOptions(serverFile, mastraEntryFile, analyzedBundleInfo, toolsPaths, {\n enableSourcemap,\n enableEsmShim: false,\n });\n\n const hasPostgresStore = (await this.deps.checkDependencies(['@mastra/pg'])) === `ok`;\n\n if (Array.isArray(inputOptions.plugins)) {\n inputOptions.plugins = [\n virtual({\n '#polyfills': `\nprocess.versions = process.versions || {};\nprocess.versions.node = '${process.versions.node}';\n `,\n }),\n ...inputOptions.plugins,\n mastraInstanceWrapper(mastraEntryFile),\n ];\n\n if (hasPostgresStore) {\n inputOptions.plugins.push(postgresStoreInstanceChecker());\n }\n }\n\n return inputOptions;\n }\n\n async bundle(\n entryFile: string,\n outputDirectory: string,\n { toolsPaths, projectRoot }: { toolsPaths: (string | string[])[]; projectRoot: string },\n ): Promise<void> {\n return this._bundle(this.getEntry(), entryFile, { outputDirectory, projectRoot, enableEsmShim: false }, toolsPaths);\n }\n\n async deploy(): Promise<void> {\n this.logger?.info('Deploying to Cloudflare failed. Please use the Cloudflare dashboard to deploy.');\n }\n\n async tagWorker(): Promise<void> {\n throw new Error('tagWorker method is no longer supported. Use the Cloudflare dashboard or API directly.');\n }\n\n async lint(entryFile: string, outputDirectory: string, toolsPaths: (string | string[])[]): Promise<void> {\n await super.lint(entryFile, outputDirectory, toolsPaths);\n\n const hasLibsql = (await this.deps.checkDependencies(['@mastra/libsql'])) === `ok`;\n\n if (hasLibsql) {\n this.logger.error(\n 'Cloudflare Deployer does not support @libsql/client (which may have been installed by @mastra/libsql) as a dependency. Please use Cloudflare D1 instead: @mastra/cloudflare-d1.',\n );\n process.exit(1);\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/babel/mastra-instance-wrapper.ts","../src/plugins/mastra-instance-wrapper.ts","../src/babel/postgres-store-instance-checker.ts","../src/plugins/postgres-store-instance-checker.ts","../src/index.ts"],"names":["mastraInstanceWrapper","babel2","postgresStoreInstanceChecker","transformSync"],"mappings":";;;;;;;;AAwBO,SAAS,qBAAA,GAAmC;AACjD,EAAA,MAAM,UAAA,GAAa,QAAA;AACnB,EAAA,MAAM,SAAA,GAAY,QAAA;AAClB,EAAA,MAAM,CAAA,GAAU,KAAA,CAAA,KAAA;AAEhB,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,aAAA;AAAA,IACN,OAAA,EAAS;AAAA,MACP,uBAAuB,IAAA,EAAM;AAC3B,QAAA,IAAI,CAAA,CAAE,qBAAA,CAAsB,IAAA,CAAK,IAAA,EAAM,WAAW,CAAA,EAAG;AACnD,UAAA,KAAA,MAAW,WAAA,IAAe,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H;AAAA,EAEA,MAAM,MAAA,GAAwB;AAC5B,IAAA,IAAA,CAAK,MAAA,EAAQ,KAAK,gFAAgF,CAAA;AAAA,EACpG;AAAA,EAEA,MAAM,SAAA,GAA2B;AAC/B,IAAA,MAAM,IAAI,MAAM,wFAAwF,CAAA;AAAA,EAC1G;AAAA,EAEA,MAAM,IAAA,CAAK,SAAA,EAAmB,eAAA,EAAyB,UAAA,EAAkD;AACvG,IAAA,MAAM,KAAA,CAAM,IAAA,CAAK,SAAA,EAAW,eAAA,EAAiB,UAAU,CAAA;AAEvD,IAAA,MAAM,SAAA,GAAa,MAAM,IAAA,CAAK,IAAA,CAAK,kBAAkB,CAAC,gBAAgB,CAAC,CAAA,KAAO,CAAA,EAAA,CAAA;AAE9E,IAAA,IAAI,SAAA,EAAW;AACb,MAAA,IAAA,CAAK,MAAA,CAAO,KAAA;AAAA,QACV;AAAA,OACF;AACA,MAAA,OAAA,CAAQ,KAAK,CAAC,CAAA;AAAA,IAChB;AAAA,EACF;AACF","file":"index.js","sourcesContent":["import type { PluginObj } from '@babel/core';\nimport * as babel from '@babel/core';\n\n/**\n * Babel plugin that transforms Mastra exports for Cloudflare Workers compatibility.\n *\n * This plugin:\n * 1. Identifies named exports of the 'mastra' variable\n * 2. Checks if the export is a new instance of the 'Mastra' class\n * 3. Wraps the Mastra instantiation in an arrow function to ensure proper initialization\n * in the Cloudflare Workers environment\n *\n * The transformation ensures the Mastra instance is properly scoped and initialized\n * for each request in the Cloudflare Workers environment.\n *\n * @returns {PluginObj} A Babel plugin object with a visitor that performs the transformation\n *\n * @example\n * // Before transformation:\n * export const mastra = new Mastra();\n *\n * // After transformation:\n * export const mastra = () => new Mastra();\n */\nexport function mastraInstanceWrapper(): PluginObj {\n const exportName = 'mastra';\n const className = 'Mastra';\n const t = babel.types;\n\n return {\n name: 'wrap-mastra',\n visitor: {\n ExportNamedDeclaration(path) {\n if (t.isVariableDeclaration(path.node?.declaration)) {\n for (const declaration of path.node.declaration.declarations) {\n if (\n t.isIdentifier(declaration?.id, { name: exportName }) &&\n t.isNewExpression(declaration?.init) &&\n t.isIdentifier(declaration.init.callee, { name: className })\n ) {\n declaration.init = t.arrowFunctionExpression([], declaration.init);\n // there should be only one \"mastra\" export, so we can exit the loop\n break;\n }\n }\n }\n },\n },\n } as PluginObj;\n}\n","import { transformSync } from '@babel/core';\nimport type { Plugin } from 'rollup';\nimport { mastraInstanceWrapper as mastraInstanceWrapperBabel } from '../babel/mastra-instance-wrapper';\n\nexport function mastraInstanceWrapper(mastraEntryFile: string): Plugin {\n return {\n name: 'mastra-wrapper',\n transform(code, id) {\n if (id !== mastraEntryFile) {\n return null;\n }\n\n const result = transformSync(code, {\n filename: id,\n babelrc: false,\n configFile: false,\n plugins: [mastraInstanceWrapperBabel],\n });\n\n if (!result?.code) {\n throw new Error('mastra-wrapper plugin did not return code, there is likely a bug in the plugin.');\n }\n\n return {\n code: result.code,\n map: result?.map,\n };\n },\n };\n}\n","import type { NodePath, PluginObj } from '@babel/core';\nimport * as babel from '@babel/core';\nimport type { NewExpression } from '@babel/types';\n\n/**\n * Babel plugin that enforces singleton PostgresStore instances in Cloudflare Workers.\n *\n * This plugin:\n * 1. Scans for all `new PostgresStore()` instantiations\n * 2. Records their file locations\n * 3. Throws an error if multiple instances are found\n *\n * Cloudflare Workers should only create one PostgresStore instance to avoid connection\n * pool exhaustion and ensure proper resource management.\n *\n * @returns {PluginObj} A Babel plugin object that validates PostgresStore usage\n *\n * @example\n * // Throws error if multiple instances found:\n * const store1 = new PostgresStore();\n * const store2 = new PostgresStore(); // Error thrown here\n */\nexport function postgresStoreInstanceChecker(): PluginObj {\n const t = babel.types;\n const instances: { path: NodePath<NewExpression>; location: string }[] = [];\n\n return {\n name: 'postgresstore-instance-checker',\n visitor: {\n NewExpression(path, state) {\n if (t.isIdentifier(path.node.callee) && path.node.callee.name === 'PostgresStore') {\n const filename = state.file?.opts?.filename || 'unknown file';\n const location = path.node.loc\n ? `${filename}: line ${path.node.loc.start.line}, column ${path.node.loc.start.column}`\n : 'unknown location';\n\n instances.push({\n path,\n location,\n });\n }\n },\n },\n post() {\n if (instances.length > 1) {\n const errorMessage = [\n `Found ${instances.length} PostgresStore instantiations:`,\n ...instances.map((instance, i) => ` ${i + 1}. At ${instance.location}`),\n 'Only one PostgresStore instance should be created per Cloudflare Worker.',\n ].join('\\n');\n\n const lastInstance = instances[instances.length - 1];\n throw lastInstance?.path.buildCodeFrameError(errorMessage);\n }\n },\n } as PluginObj;\n}\n","import { transformSync } from '@babel/core';\nimport type { Plugin } from 'rollup';\nimport { postgresStoreInstanceChecker as postgresStoreInstanceCheckerBabel } from '../babel/postgres-store-instance-checker';\n\nexport function postgresStoreInstanceChecker(): Plugin {\n return {\n name: 'postgres-store-instance-checker',\n transform(code, id) {\n const result = transformSync(code, {\n filename: id,\n babelrc: false,\n configFile: false,\n plugins: [postgresStoreInstanceCheckerBabel],\n });\n\n // If Babel didn't transform anything or returned no code, pass through original source.\n if (!result || typeof result.code !== 'string') {\n return null;\n }\n\n return {\n code: result.code,\n map: result.map ?? null,\n };\n },\n };\n}\n","import { writeFile } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { Deployer } from '@mastra/deployer';\nimport type { analyzeBundle } from '@mastra/deployer/analyze';\nimport type { BundlerOptions } from '@mastra/deployer/bundler';\nimport virtual from '@rollup/plugin-virtual';\nimport { mastraInstanceWrapper } from './plugins/mastra-instance-wrapper';\nimport { postgresStoreInstanceChecker } from './plugins/postgres-store-instance-checker';\n\ninterface CFRoute {\n pattern: string;\n zone_name: string;\n custom_domain?: boolean;\n}\n\ninterface D1DatabaseBinding {\n binding: string;\n database_name: string;\n database_id: string;\n preview_database_id?: string;\n}\n\ninterface KVNamespaceBinding {\n binding: string;\n id: string;\n}\n\nexport class CloudflareDeployer extends Deployer {\n routes?: CFRoute[] = [];\n workerNamespace?: string;\n env?: Record<string, any>;\n projectName?: string;\n d1Databases?: D1DatabaseBinding[];\n kvNamespaces?: KVNamespaceBinding[];\n\n constructor({\n env,\n projectName = 'mastra',\n routes,\n workerNamespace,\n d1Databases,\n kvNamespaces,\n }: {\n env?: Record<string, any>;\n projectName?: string;\n routes?: CFRoute[];\n workerNamespace?: string;\n d1Databases?: D1DatabaseBinding[];\n kvNamespaces?: KVNamespaceBinding[];\n }) {\n super({ name: 'CLOUDFLARE' });\n\n this.projectName = projectName;\n this.routes = routes;\n this.workerNamespace = workerNamespace;\n\n if (env) {\n this.env = env;\n }\n\n if (d1Databases) this.d1Databases = d1Databases;\n if (kvNamespaces) this.kvNamespaces = kvNamespaces;\n }\n\n async writeFiles(outputDirectory: string): Promise<void> {\n const env = await this.loadEnvVars();\n const envsAsObject = Object.assign({}, Object.fromEntries(env.entries()), this.env);\n\n const cfWorkerName = this.projectName;\n\n const wranglerConfig: Record<string, any> = {\n name: cfWorkerName,\n main: './index.mjs',\n compatibility_date: '2025-04-01',\n compatibility_flags: ['nodejs_compat', 'nodejs_compat_populate_process_env'],\n observability: {\n logs: {\n enabled: true,\n },\n },\n vars: envsAsObject,\n };\n\n if (!this.workerNamespace && this.routes) {\n wranglerConfig.routes = this.routes;\n }\n\n if (this.d1Databases?.length) {\n wranglerConfig.d1_databases = this.d1Databases;\n }\n if (this.kvNamespaces?.length) {\n wranglerConfig.kv_namespaces = this.kvNamespaces;\n }\n await writeFile(join(outputDirectory, this.outputDir, 'wrangler.json'), JSON.stringify(wranglerConfig));\n }\n\n private getEntry(): string {\n return `\n import '#polyfills';\n import { scoreTracesWorkflow } from '@mastra/core/evals/scoreTraces';\n\n export default {\n fetch: async (request, env, context) => {\n const { mastra } = await import('#mastra');\n const { tools } = await import('#tools');\n const {createHonoServer, getToolExports} = await import('#server');\n const _mastra = mastra();\n\n if (_mastra.getStorage()) {\n _mastra.__registerInternalWorkflow(scoreTracesWorkflow);\n }\n\n const app = await createHonoServer(_mastra, { tools: getToolExports(tools) });\n return app.fetch(request, env, context);\n }\n }\n`;\n }\n async prepare(outputDirectory: string): Promise<void> {\n await super.prepare(outputDirectory);\n await this.writeFiles(outputDirectory);\n }\n\n protected async getBundlerOptions(\n serverFile: string,\n mastraEntryFile: string,\n analyzedBundleInfo: Awaited<ReturnType<typeof analyzeBundle>>,\n toolsPaths: (string | string[])[],\n bundlerOptions: BundlerOptions,\n ) {\n const inputOptions = await super.getBundlerOptions(serverFile, mastraEntryFile, analyzedBundleInfo, toolsPaths, {\n ...bundlerOptions,\n enableEsmShim: false,\n });\n\n const hasPostgresStore = (await this.deps.checkDependencies(['@mastra/pg'])) === `ok`;\n\n if (Array.isArray(inputOptions.plugins)) {\n inputOptions.plugins = [\n virtual({\n '#polyfills': `\nprocess.versions = process.versions || {};\nprocess.versions.node = '${process.versions.node}';\n `,\n }),\n ...inputOptions.plugins,\n mastraInstanceWrapper(mastraEntryFile),\n ];\n\n if (hasPostgresStore) {\n inputOptions.plugins.push(postgresStoreInstanceChecker());\n }\n }\n\n return inputOptions;\n }\n\n async bundle(\n entryFile: string,\n outputDirectory: string,\n { toolsPaths, projectRoot }: { toolsPaths: (string | string[])[]; projectRoot: string },\n ): Promise<void> {\n return this._bundle(this.getEntry(), entryFile, { outputDirectory, projectRoot, enableEsmShim: false }, toolsPaths);\n }\n\n async deploy(): Promise<void> {\n this.logger?.info('Deploying to Cloudflare failed. Please use the Cloudflare dashboard to deploy.');\n }\n\n async tagWorker(): Promise<void> {\n throw new Error('tagWorker method is no longer supported. Use the Cloudflare dashboard or API directly.');\n }\n\n async lint(entryFile: string, outputDirectory: string, toolsPaths: (string | string[])[]): Promise<void> {\n await super.lint(entryFile, outputDirectory, toolsPaths);\n\n const hasLibsql = (await this.deps.checkDependencies(['@mastra/libsql'])) === `ok`;\n\n if (hasLibsql) {\n this.logger.error(\n 'Cloudflare Deployer does not support @libsql/client (which may have been installed by @mastra/libsql) as a dependency. Please use Cloudflare D1 instead: @mastra/cloudflare-d1.',\n );\n process.exit(1);\n }\n }\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const mastra: Mastra<{
|
|
2
2
|
weatherAgent: any;
|
|
3
|
-
}, Record<string, import("@mastra/core/workflows
|
|
3
|
+
}, Record<string, import("@mastra/core/workflows").Workflow<any, any, any, any, any, any, any>>, Record<string, import("@mastra/core/vector").MastraVector<any>>, Record<string, import("@mastra/core/tts").MastraTTS>, import("@mastra/core/logger").ConsoleLogger, Record<string, import("@mastra/core/mcp").MCPServerBase<any>>, Record<string, import("@mastra/core/evals").MastraScorer<any, any, any, any>>, Record<string, import("@mastra/core/tools").ToolAction<any, any, any, any, any, any>>, Record<string, import("@mastra/core/processors").Processor<any, unknown>>, Record<string, import("@mastra/core/memory").MastraMemory>>;
|
|
4
4
|
import { Mastra } from '@mastra/core/mastra';
|
|
5
5
|
//# sourceMappingURL=basic.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"basic.d.ts","sourceRoot":"","sources":["../../../src/plugins/__fixtures__/basic.js"],"names":[],"mappings":"AAOA;;
|
|
1
|
+
{"version":3,"file":"basic.d.ts","sourceRoot":"","sources":["../../../src/plugins/__fixtures__/basic.js"],"names":[],"mappings":"AAOA;;inBAuBG;uBA7BoB,qBAAqB"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export const mastra: Mastra<Record<string, import("@mastra/core/agent").Agent<any, import("@mastra/core/agent").ToolsInput
|
|
1
|
+
export const mastra: Mastra<Record<string, import("@mastra/core/agent").Agent<any, import("@mastra/core/agent").ToolsInput>>, Record<string, import("@mastra/core/workflows").Workflow<any, any, any, any, any, any, any>>, Record<string, import("@mastra/core/vector").MastraVector<any>>, Record<string, import("@mastra/core/tts").MastraTTS>, import("@mastra/core/logger").IMastraLogger, Record<string, import("@mastra/core/mcp").MCPServerBase<any>>, Record<string, import("@mastra/core/evals").MastraScorer<any, any, any, any>>, Record<string, import("@mastra/core/tools").ToolAction<any, any, any, any, any, any>>, Record<string, import("@mastra/core/processors").Processor<any, unknown>>, Record<string, import("@mastra/core/memory").MastraMemory>>;
|
|
2
2
|
import { Mastra } from '@mastra/core/mastra';
|
|
3
3
|
//# sourceMappingURL=empty-mastra.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"empty-mastra.d.ts","sourceRoot":"","sources":["../../../src/plugins/__fixtures__/empty-mastra.js"],"names":[],"mappings":"AACA,
|
|
1
|
+
{"version":3,"file":"empty-mastra.d.ts","sourceRoot":"","sources":["../../../src/plugins/__fixtures__/empty-mastra.js"],"names":[],"mappings":"AACA,4uBAAmC;uBADZ,qBAAqB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const storage: any;
|
|
2
2
|
export const mastra: Mastra<{
|
|
3
3
|
weatherAgent: any;
|
|
4
|
-
}, Record<string, import("@mastra/core/workflows
|
|
4
|
+
}, Record<string, import("@mastra/core/workflows").Workflow<any, any, any, any, any, any, any>>, Record<string, import("@mastra/core/vector").MastraVector<any>>, Record<string, import("@mastra/core/tts").MastraTTS>, import("@mastra/core/logger").ConsoleLogger, Record<string, import("@mastra/core/mcp").MCPServerBase<any>>, Record<string, import("@mastra/core/evals").MastraScorer<any, any, any, any>>, Record<string, import("@mastra/core/tools").ToolAction<any, any, any, any, any, any>>, Record<string, import("@mastra/core/processors").Processor<any, unknown>>, Record<string, import("@mastra/core/memory").MastraMemory>>;
|
|
5
5
|
import { Mastra } from '@mastra/core/mastra';
|
|
6
6
|
//# sourceMappingURL=multiple-postgres-stores.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multiple-postgres-stores.d.ts","sourceRoot":"","sources":["../../../src/plugins/__fixtures__/multiple-postgres-stores.js"],"names":[],"mappings":"AAOA,0BAEG;AAEH;;
|
|
1
|
+
{"version":3,"file":"multiple-postgres-stores.d.ts","sourceRoot":"","sources":["../../../src/plugins/__fixtures__/multiple-postgres-stores.js"],"names":[],"mappings":"AAOA,0BAEG;AAEH;;inBAuBG;uBAjCoB,qBAAqB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/deployer-cloudflare",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-beta.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -36,26 +36,27 @@
|
|
|
36
36
|
"author": "",
|
|
37
37
|
"license": "Apache-2.0",
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@babel/core": "^7.28.
|
|
39
|
+
"@babel/core": "^7.28.5",
|
|
40
40
|
"@rollup/plugin-virtual": "3.0.2",
|
|
41
41
|
"cloudflare": "^4.5.0",
|
|
42
42
|
"rollup": "~4.50.2",
|
|
43
43
|
"rollup-plugin-esbuild": "^6.2.1",
|
|
44
|
-
"@mastra/deployer": "^0.
|
|
44
|
+
"@mastra/deployer": "^1.0.0-beta.14"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@babel/types": "^7.28.
|
|
48
|
-
"@microsoft/api-extractor": "^7.52.8",
|
|
47
|
+
"@babel/types": "^7.28.5",
|
|
49
48
|
"@types/babel__core": "^7.20.5",
|
|
50
|
-
"@types/node": "
|
|
49
|
+
"@types/node": "22.13.17",
|
|
50
|
+
"@vitest/coverage-v8": "4.0.12",
|
|
51
|
+
"@vitest/ui": "4.0.12",
|
|
51
52
|
"eslint": "^9.37.0",
|
|
52
53
|
"tsup": "^8.5.0",
|
|
53
54
|
"typescript": "^5.8.3",
|
|
54
|
-
"vitest": "
|
|
55
|
+
"vitest": "4.0.12",
|
|
55
56
|
"zod": "^3.25.76",
|
|
56
|
-
"@internal/lint": "0.0.
|
|
57
|
-
"@internal/types-builder": "0.0.
|
|
58
|
-
"@mastra/core": "0.
|
|
57
|
+
"@internal/lint": "0.0.53",
|
|
58
|
+
"@internal/types-builder": "0.0.28",
|
|
59
|
+
"@mastra/core": "1.0.0-beta.14"
|
|
59
60
|
},
|
|
60
61
|
"homepage": "https://mastra.ai",
|
|
61
62
|
"repository": {
|
|
@@ -67,15 +68,11 @@
|
|
|
67
68
|
"url": "https://github.com/mastra-ai/mastra/issues"
|
|
68
69
|
},
|
|
69
70
|
"peerDependencies": {
|
|
70
|
-
"@mastra/core": ">=0.
|
|
71
|
+
"@mastra/core": ">=1.0.0-0 <2.0.0-0",
|
|
71
72
|
"zod": "^3.25.0 || ^4.0.0"
|
|
72
73
|
},
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"publish-branch": [
|
|
76
|
-
"main",
|
|
77
|
-
"0.x"
|
|
78
|
-
]
|
|
74
|
+
"engines": {
|
|
75
|
+
"node": ">=22.13.0"
|
|
79
76
|
},
|
|
80
77
|
"scripts": {
|
|
81
78
|
"build": "tsup --silent --config tsup.config.ts",
|