@mastra/s3 0.0.0-studio-deploy-20260404182525 → 0.0.0-studio-cli-20260504022012
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 +175 -3
- package/README.md +27 -0
- package/dist/blob-store/index.d.ts +17 -6
- package/dist/blob-store/index.d.ts.map +1 -1
- package/dist/filesystem/index.d.ts +25 -2
- package/dist/filesystem/index.d.ts.map +1 -1
- package/dist/index.cjs +39 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +39 -20
- package/dist/index.js.map +1 -1
- package/package.json +13 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,183 @@
|
|
|
1
1
|
# @mastra/s3
|
|
2
2
|
|
|
3
|
-
## 0.0.0-studio-
|
|
3
|
+
## 0.0.0-studio-cli-20260504022012
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
- Updated dependencies [[`
|
|
8
|
-
- @mastra/core@0.0.0-studio-
|
|
7
|
+
- Updated dependencies [[`6dcd65f`](https://github.com/mastra-ai/mastra/commit/6dcd65f2a34069e6dc43ba35f1d11119b9b40bef), [`c05c9a1`](https://github.com/mastra-ai/mastra/commit/c05c9a13230988cef6d438a62f37760f31927bc7), [`e24aacb`](https://github.com/mastra-ai/mastra/commit/e24aacba07bd66f5d95b636dc24016fca26b52cf), [`1c2dda8`](https://github.com/mastra-ai/mastra/commit/1c2dda805fbfccc0abf55d4cb20cc34402dc3f0c), [`c721164`](https://github.com/mastra-ai/mastra/commit/c7211643f7ac861f83b19a3757cc921487fc9d75), [`1b55954`](https://github.com/mastra-ai/mastra/commit/1b559541c1e08a10e49d01ffc51a634dfc37a286), [`5adc55e`](https://github.com/mastra-ai/mastra/commit/5adc55e63407be8ee977914957d68bcc2a075ceb), [`70017d7`](https://github.com/mastra-ai/mastra/commit/70017d72ab741b5d7040e2a15c251a317782e39e), [`e4942bc`](https://github.com/mastra-ai/mastra/commit/e4942bc7fdc903572f7d84f26d5e15f9d39c763d)]:
|
|
8
|
+
- @mastra/core@0.0.0-studio-cli-20260504022012
|
|
9
|
+
|
|
10
|
+
## 0.5.0
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- Added AWS credential provider chain support to S3Filesystem and S3BlobStore. You can now pass a `credentials` option with a credential provider function (e.g. `fromNodeProviderChain()`) for auto-refreshing credentials on ECS, Lambda, SSO, or AssumeRole deployments. When all credential options are omitted, the AWS SDK default credential provider chain is used automatically instead of falling back to anonymous access. Static `accessKeyId`/`secretAccessKey` credentials continue to work as before. ([#15437](https://github.com/mastra-ai/mastra/pull/15437))
|
|
15
|
+
|
|
16
|
+
**New `credentials` option**
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
import { S3Filesystem } from '@mastra/s3';
|
|
20
|
+
import { fromNodeProviderChain } from '@aws-sdk/credential-providers';
|
|
21
|
+
|
|
22
|
+
// Auto-refreshing credentials (ECS task role, SSO, etc.)
|
|
23
|
+
const fs = new S3Filesystem({
|
|
24
|
+
bucket: 'my-bucket',
|
|
25
|
+
region: 'us-east-1',
|
|
26
|
+
credentials: fromNodeProviderChain(),
|
|
27
|
+
});
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
**SDK default credential chain (no credentials needed)**
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
// Credentials discovered from environment automatically
|
|
34
|
+
const fs = new S3Filesystem({
|
|
35
|
+
bucket: 'my-bucket',
|
|
36
|
+
region: 'us-east-1',
|
|
37
|
+
});
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Fixes https://github.com/mastra-ai/mastra/issues/14289
|
|
41
|
+
|
|
42
|
+
### Patch Changes
|
|
43
|
+
|
|
44
|
+
- Updated dependencies [[`28caa5b`](https://github.com/mastra-ai/mastra/commit/28caa5b032358545af2589ed90636eccb4dd9d2f), [`c1ae974`](https://github.com/mastra-ai/mastra/commit/c1ae97491f6e57378ce880c3a397778c42adcdf1), [`b510d36`](https://github.com/mastra-ai/mastra/commit/b510d368f73dab6be2e2c2bc99035aaef1fb7d7a), [`13b4d7c`](https://github.com/mastra-ai/mastra/commit/13b4d7c16de34dff9095d1cd80f22f544b6cfe75), [`7a7b313`](https://github.com/mastra-ai/mastra/commit/7a7b3138fb3bcf0b0c740eaea07971e43d330ef3), [`c04417b`](https://github.com/mastra-ai/mastra/commit/c04417ba0a2e4ded66da4352331ef29cd4bd1d79), [`cf25a03`](https://github.com/mastra-ai/mastra/commit/cf25a03132164b9dc1e5dccf7394824e33007c51), [`8a71261`](https://github.com/mastra-ai/mastra/commit/8a71261e3954ae617c6f8e25767b951f99438ab2), [`9e973b0`](https://github.com/mastra-ai/mastra/commit/9e973b010dacfa15ac82b0072897319f5234b90a), [`dd934a0`](https://github.com/mastra-ai/mastra/commit/dd934a0982ce0f78712fbd559e4f2410bf594b39), [`ba6b0c5`](https://github.com/mastra-ai/mastra/commit/ba6b0c51bfce358554fd33c7f2bcd5593633f2ff), [`a6dac0a`](https://github.com/mastra-ai/mastra/commit/a6dac0a40c7181161b1add4e8534f962bcbc9aa7), [`5a4b1ee`](https://github.com/mastra-ai/mastra/commit/5a4b1ee80212969621228104995589c0fa59e575), [`5a4b1ee`](https://github.com/mastra-ai/mastra/commit/5a4b1ee80212969621228104995589c0fa59e575), [`5a4b1ee`](https://github.com/mastra-ai/mastra/commit/5a4b1ee80212969621228104995589c0fa59e575), [`6c8c6c7`](https://github.com/mastra-ai/mastra/commit/6c8c6c71518394321a4692614aa4b11f3bb0a343), [`5a4b1ee`](https://github.com/mastra-ai/mastra/commit/5a4b1ee80212969621228104995589c0fa59e575), [`7d056b6`](https://github.com/mastra-ai/mastra/commit/7d056b6ecf603cacaa0f663ff1df025ed885b6c1), [`9cef83b`](https://github.com/mastra-ai/mastra/commit/9cef83b8a642b8098747772921e3523b492bafbc), [`d30e215`](https://github.com/mastra-ai/mastra/commit/d30e2156c746bc9fd791745cec1cc24377b66789), [`021a60f`](https://github.com/mastra-ai/mastra/commit/021a60f1f3e0135a70ef23c58be7a9b3aaffe6b4), [`73f2809`](https://github.com/mastra-ai/mastra/commit/73f2809721db24e98cdf122539652a455211b450), [`aedeea4`](https://github.com/mastra-ai/mastra/commit/aedeea48a94f728323f040478775076b9574be50), [`26f1f94`](https://github.com/mastra-ai/mastra/commit/26f1f9490574b864ba1ecedf2c9632e0767a23bd), [`8126d86`](https://github.com/mastra-ai/mastra/commit/8126d8638411eacfafdc29036ac998e8757ea66f), [`73b45fa`](https://github.com/mastra-ai/mastra/commit/73b45facdef4fbcb8af710c50f0646f18619dbaa), [`ae97520`](https://github.com/mastra-ai/mastra/commit/ae975206fdb0f6ef03c4d5bf94f7dc7c3f706c02), [`7a7b313`](https://github.com/mastra-ai/mastra/commit/7a7b3138fb3bcf0b0c740eaea07971e43d330ef3), [`441670a`](https://github.com/mastra-ai/mastra/commit/441670a02c9dc7731c52674f55481e7848a84523)]:
|
|
45
|
+
- @mastra/core@1.29.0
|
|
46
|
+
|
|
47
|
+
## 0.5.0-alpha.0
|
|
48
|
+
|
|
49
|
+
### Minor Changes
|
|
50
|
+
|
|
51
|
+
- Added AWS credential provider chain support to S3Filesystem and S3BlobStore. You can now pass a `credentials` option with a credential provider function (e.g. `fromNodeProviderChain()`) for auto-refreshing credentials on ECS, Lambda, SSO, or AssumeRole deployments. When all credential options are omitted, the AWS SDK default credential provider chain is used automatically instead of falling back to anonymous access. Static `accessKeyId`/`secretAccessKey` credentials continue to work as before. ([#15437](https://github.com/mastra-ai/mastra/pull/15437))
|
|
52
|
+
|
|
53
|
+
**New `credentials` option**
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
import { S3Filesystem } from '@mastra/s3';
|
|
57
|
+
import { fromNodeProviderChain } from '@aws-sdk/credential-providers';
|
|
58
|
+
|
|
59
|
+
// Auto-refreshing credentials (ECS task role, SSO, etc.)
|
|
60
|
+
const fs = new S3Filesystem({
|
|
61
|
+
bucket: 'my-bucket',
|
|
62
|
+
region: 'us-east-1',
|
|
63
|
+
credentials: fromNodeProviderChain(),
|
|
64
|
+
});
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
**SDK default credential chain (no credentials needed)**
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
// Credentials discovered from environment automatically
|
|
71
|
+
const fs = new S3Filesystem({
|
|
72
|
+
bucket: 'my-bucket',
|
|
73
|
+
region: 'us-east-1',
|
|
74
|
+
});
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Fixes https://github.com/mastra-ai/mastra/issues/14289
|
|
78
|
+
|
|
79
|
+
### Patch Changes
|
|
80
|
+
|
|
81
|
+
- Updated dependencies [[`c1ae974`](https://github.com/mastra-ai/mastra/commit/c1ae97491f6e57378ce880c3a397778c42adcdf1), [`13b4d7c`](https://github.com/mastra-ai/mastra/commit/13b4d7c16de34dff9095d1cd80f22f544b6cfe75), [`5a4b1ee`](https://github.com/mastra-ai/mastra/commit/5a4b1ee80212969621228104995589c0fa59e575), [`5a4b1ee`](https://github.com/mastra-ai/mastra/commit/5a4b1ee80212969621228104995589c0fa59e575), [`5a4b1ee`](https://github.com/mastra-ai/mastra/commit/5a4b1ee80212969621228104995589c0fa59e575), [`6c8c6c7`](https://github.com/mastra-ai/mastra/commit/6c8c6c71518394321a4692614aa4b11f3bb0a343), [`5a4b1ee`](https://github.com/mastra-ai/mastra/commit/5a4b1ee80212969621228104995589c0fa59e575), [`ec4cb26`](https://github.com/mastra-ai/mastra/commit/ec4cb26919972eb2031fea510f8f013e1d5b7ee2)]:
|
|
82
|
+
- @mastra/core@1.29.0-alpha.6
|
|
83
|
+
|
|
84
|
+
## 0.4.1
|
|
85
|
+
|
|
86
|
+
### Patch Changes
|
|
87
|
+
|
|
88
|
+
- Fix `toKey()` to resolve `"."` and `"./"` as the root path ([#14824](https://github.com/mastra-ai/mastra/pull/14824))
|
|
89
|
+
|
|
90
|
+
Both `GCSFilesystem` and `S3Filesystem` produced invalid object keys when called with `path: "."` (e.g. `prefix/.` instead of `prefix/`). Since the built-in `mastra_workspace_list_files` tool and Mastra Studio both default to `path: "."`, workspace directory listings returned empty results when backed by GCS or S3.
|
|
91
|
+
|
|
92
|
+
`toKey()` now normalises `"."` and `"./"` to empty string before prepending the prefix, matching the existing behaviour of `"/"`. Dotfiles like `.env` or `.gitignore` are unaffected.
|
|
93
|
+
|
|
94
|
+
- Updated dependencies [[`733bf53`](https://github.com/mastra-ai/mastra/commit/733bf53d9352aedd3ef38c3d501edb275b65b43c), [`5405b3b`](https://github.com/mastra-ai/mastra/commit/5405b3b35325c5b8fb34fc7ac109bd2feb7bb6fe), [`45e29cb`](https://github.com/mastra-ai/mastra/commit/45e29cb5b5737f3083eb3852db02b944b9cf37ed), [`750b4d3`](https://github.com/mastra-ai/mastra/commit/750b4d3d8231f92e769b2c485921ac5a8ca639b9), [`c321127`](https://github.com/mastra-ai/mastra/commit/c3211275fc195de9ad1ead2746b354beb8eae6e8), [`a07bcef`](https://github.com/mastra-ai/mastra/commit/a07bcefea77c03d6d322caad973dca49b4b15fa1), [`696694e`](https://github.com/mastra-ai/mastra/commit/696694e00f29241a25dd1a1b749afa06c3a626b4), [`b084a80`](https://github.com/mastra-ai/mastra/commit/b084a800db0f82d62e1fc3d6e3e3480da1ba5a53), [`82b7a96`](https://github.com/mastra-ai/mastra/commit/82b7a964169636c1d1e0c694fc892a213b0179d5), [`df97812`](https://github.com/mastra-ai/mastra/commit/df97812bd949dcafeb074b80ecab501724b49c3b), [`8bbe360`](https://github.com/mastra-ai/mastra/commit/8bbe36042af7fc4be0244dffd8913f6795179421), [`f6b8ba8`](https://github.com/mastra-ai/mastra/commit/f6b8ba8dbf533b7a8db90c72b6805ddc804a3a72), [`a07bcef`](https://github.com/mastra-ai/mastra/commit/a07bcefea77c03d6d322caad973dca49b4b15fa1)]:
|
|
95
|
+
- @mastra/core@1.28.0
|
|
96
|
+
|
|
97
|
+
## 0.4.1-alpha.0
|
|
98
|
+
|
|
99
|
+
### Patch Changes
|
|
100
|
+
|
|
101
|
+
- Fix `toKey()` to resolve `"."` and `"./"` as the root path ([#14824](https://github.com/mastra-ai/mastra/pull/14824))
|
|
102
|
+
|
|
103
|
+
Both `GCSFilesystem` and `S3Filesystem` produced invalid object keys when called with `path: "."` (e.g. `prefix/.` instead of `prefix/`). Since the built-in `mastra_workspace_list_files` tool and Mastra Studio both default to `path: "."`, workspace directory listings returned empty results when backed by GCS or S3.
|
|
104
|
+
|
|
105
|
+
`toKey()` now normalises `"."` and `"./"` to empty string before prepending the prefix, matching the existing behaviour of `"/"`. Dotfiles like `.env` or `.gitignore` are unaffected.
|
|
106
|
+
|
|
107
|
+
- Updated dependencies [[`733bf53`](https://github.com/mastra-ai/mastra/commit/733bf53d9352aedd3ef38c3d501edb275b65b43c), [`5405b3b`](https://github.com/mastra-ai/mastra/commit/5405b3b35325c5b8fb34fc7ac109bd2feb7bb6fe), [`c321127`](https://github.com/mastra-ai/mastra/commit/c3211275fc195de9ad1ead2746b354beb8eae6e8), [`a07bcef`](https://github.com/mastra-ai/mastra/commit/a07bcefea77c03d6d322caad973dca49b4b15fa1), [`b084a80`](https://github.com/mastra-ai/mastra/commit/b084a800db0f82d62e1fc3d6e3e3480da1ba5a53), [`82b7a96`](https://github.com/mastra-ai/mastra/commit/82b7a964169636c1d1e0c694fc892a213b0179d5), [`df97812`](https://github.com/mastra-ai/mastra/commit/df97812bd949dcafeb074b80ecab501724b49c3b), [`8bbe360`](https://github.com/mastra-ai/mastra/commit/8bbe36042af7fc4be0244dffd8913f6795179421), [`f6b8ba8`](https://github.com/mastra-ai/mastra/commit/f6b8ba8dbf533b7a8db90c72b6805ddc804a3a72), [`a07bcef`](https://github.com/mastra-ai/mastra/commit/a07bcefea77c03d6d322caad973dca49b4b15fa1)]:
|
|
108
|
+
- @mastra/core@1.28.0-alpha.0
|
|
109
|
+
|
|
110
|
+
## 0.4.0
|
|
111
|
+
|
|
112
|
+
### Minor Changes
|
|
113
|
+
|
|
114
|
+
- Added S3 prefix (subdirectory) mount support. You can now mount a specific folder within an S3 bucket instead of the entire bucket by setting the `prefix` option on your S3 filesystem. ([#15171](https://github.com/mastra-ai/mastra/pull/15171))
|
|
115
|
+
|
|
116
|
+
**Example:**
|
|
117
|
+
|
|
118
|
+
```typescript
|
|
119
|
+
const fs = new S3Filesystem({
|
|
120
|
+
bucket: 'my-bucket',
|
|
121
|
+
region: 'us-east-1',
|
|
122
|
+
prefix: 'workspace/data',
|
|
123
|
+
accessKeyId: process.env.AWS_ACCESS_KEY_ID!,
|
|
124
|
+
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY!,
|
|
125
|
+
});
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
When mounted in a sandbox, only the contents under `workspace/data/` in the bucket will be visible at the mount path. This uses the s3fs `bucket:/path` syntax under the hood.
|
|
129
|
+
|
|
130
|
+
Closes #15147.
|
|
131
|
+
|
|
132
|
+
### Patch Changes
|
|
133
|
+
|
|
134
|
+
- Updated dependencies [[`f112db1`](https://github.com/mastra-ai/mastra/commit/f112db179557ae9b5a0f1d25dc47f928d7d61cd9), [`21d9706`](https://github.com/mastra-ai/mastra/commit/21d970604d89eee970cbf8013d26d7551aff6ea5), [`0a0aa94`](https://github.com/mastra-ai/mastra/commit/0a0aa94729592e99885af2efb90c56aaada62247), [`ed07df3`](https://github.com/mastra-ai/mastra/commit/ed07df32a9d539c8261e892fc1bade783f5b41a6), [`01a7d51`](https://github.com/mastra-ai/mastra/commit/01a7d513493d21562f677f98550f7ceb165ba78c)]:
|
|
135
|
+
- @mastra/core@1.27.0
|
|
136
|
+
|
|
137
|
+
## 0.4.0-alpha.0
|
|
138
|
+
|
|
139
|
+
### Minor Changes
|
|
140
|
+
|
|
141
|
+
- Added S3 prefix (subdirectory) mount support. You can now mount a specific folder within an S3 bucket instead of the entire bucket by setting the `prefix` option on your S3 filesystem. ([#15171](https://github.com/mastra-ai/mastra/pull/15171))
|
|
142
|
+
|
|
143
|
+
**Example:**
|
|
144
|
+
|
|
145
|
+
```typescript
|
|
146
|
+
const fs = new S3Filesystem({
|
|
147
|
+
bucket: 'my-bucket',
|
|
148
|
+
region: 'us-east-1',
|
|
149
|
+
prefix: 'workspace/data',
|
|
150
|
+
accessKeyId: process.env.AWS_ACCESS_KEY_ID!,
|
|
151
|
+
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY!,
|
|
152
|
+
});
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
When mounted in a sandbox, only the contents under `workspace/data/` in the bucket will be visible at the mount path. This uses the s3fs `bucket:/path` syntax under the hood.
|
|
156
|
+
|
|
157
|
+
Closes #15147.
|
|
158
|
+
|
|
159
|
+
### Patch Changes
|
|
160
|
+
|
|
161
|
+
- Updated dependencies [[`f112db1`](https://github.com/mastra-ai/mastra/commit/f112db179557ae9b5a0f1d25dc47f928d7d61cd9), [`21d9706`](https://github.com/mastra-ai/mastra/commit/21d970604d89eee970cbf8013d26d7551aff6ea5)]:
|
|
162
|
+
- @mastra/core@1.26.1-alpha.0
|
|
163
|
+
|
|
164
|
+
## 0.3.1
|
|
165
|
+
|
|
166
|
+
### Patch Changes
|
|
167
|
+
|
|
168
|
+
- dependencies updates: ([#15529](https://github.com/mastra-ai/mastra/pull/15529))
|
|
169
|
+
- Updated dependency [`@aws-sdk/client-s3@^3.1032.0` ↗︎](https://www.npmjs.com/package/@aws-sdk/client-s3/v/3.1032.0) (from `^3.1009.0`, in `dependencies`)
|
|
170
|
+
- Updated dependencies [[`20f59b8`](https://github.com/mastra-ai/mastra/commit/20f59b876cf91199efbc49a0e36b391240708f08), [`aba393e`](https://github.com/mastra-ai/mastra/commit/aba393e2da7390c69b80e516a4f153cda6f09376), [`3d83d06`](https://github.com/mastra-ai/mastra/commit/3d83d06f776f00fb5f4163dddd32a030c5c20844), [`e2687a7`](https://github.com/mastra-ai/mastra/commit/e2687a7408790c384563816a9a28ed06735684c9), [`fdd54cf`](https://github.com/mastra-ai/mastra/commit/fdd54cf612a9af876e9fdd85e534454f6e7dd518), [`6315317`](https://github.com/mastra-ai/mastra/commit/63153175fe9a7b224e5be7c209bbebc01dd9b0d5), [`a371ac5`](https://github.com/mastra-ai/mastra/commit/a371ac534aa1bb368a1acf9d8b313378dfdc787e), [`0474c2b`](https://github.com/mastra-ai/mastra/commit/0474c2b2e7c7e1ad8691dca031284841391ff1ef), [`0a5fa1d`](https://github.com/mastra-ai/mastra/commit/0a5fa1d3cb0583889d06687155f26fd7d2edc76c), [`7e0e63e`](https://github.com/mastra-ai/mastra/commit/7e0e63e2e485e84442351f4c7a79a424c83539dc), [`ea43e64`](https://github.com/mastra-ai/mastra/commit/ea43e646dd95d507694b6112b0bf1df22ad552b2), [`f607106`](https://github.com/mastra-ai/mastra/commit/f607106854c6416c4a07d4082604b9f66d047221), [`30456b6`](https://github.com/mastra-ai/mastra/commit/30456b6b08c8fd17e109dd093b73d93b65e83bc5), [`9d11a8c`](https://github.com/mastra-ai/mastra/commit/9d11a8c1c8924eb975a245a5884d40ca1b7e0491), [`9d3b24b`](https://github.com/mastra-ai/mastra/commit/9d3b24b19407ae9c09586cf7766d38dc4dff4a69), [`00d1b16`](https://github.com/mastra-ai/mastra/commit/00d1b16b401199cb294fa23f43336547db4dca9b), [`47cee3e`](https://github.com/mastra-ai/mastra/commit/47cee3e137fe39109cf7fffd2a8cf47b76dc702e), [`62919a6`](https://github.com/mastra-ai/mastra/commit/62919a6ee0fbf3779ad21a97b1ec6696515d5104), [`d246696`](https://github.com/mastra-ai/mastra/commit/d246696139a3144a5b21b042d41c532688e957e1), [`354f9ce`](https://github.com/mastra-ai/mastra/commit/354f9ce1ca6af2074b6a196a23f8ec30012dccca), [`16e34ca`](https://github.com/mastra-ai/mastra/commit/16e34caa98b9a114b17a6125e4e3fd87f169d0d0), [`7020c06`](https://github.com/mastra-ai/mastra/commit/7020c0690b199d9da337f0e805f16948e557922e), [`8786a61`](https://github.com/mastra-ai/mastra/commit/8786a61fa54ba265f85eeff9985ca39863d18bb6), [`9467ea8`](https://github.com/mastra-ai/mastra/commit/9467ea87695749a53dfc041576410ebf9ee7bb67), [`7338d94`](https://github.com/mastra-ai/mastra/commit/7338d949380cf68b095342e8e42610dc51d557c1), [`c80dc16`](https://github.com/mastra-ai/mastra/commit/c80dc16e113e6cc159f510ffde501ad4711b2189), [`af8a57e`](https://github.com/mastra-ai/mastra/commit/af8a57ed9ba9685ad8601d5b71ae3706da6222f9), [`d63ffdb`](https://github.com/mastra-ai/mastra/commit/d63ffdbb2c11e76fe5ea45faab44bc15460f010c), [`47cee3e`](https://github.com/mastra-ai/mastra/commit/47cee3e137fe39109cf7fffd2a8cf47b76dc702e), [`1bd5104`](https://github.com/mastra-ai/mastra/commit/1bd51048b6da93507276d6623e3fd96a9e1a8944), [`e9837b5`](https://github.com/mastra-ai/mastra/commit/e9837b53699e18711b09e0ca010a4106376f2653), [`8f1b280`](https://github.com/mastra-ai/mastra/commit/8f1b280b7fe6999ec654f160cb69c1a8719e7a57), [`92dcf02`](https://github.com/mastra-ai/mastra/commit/92dcf029294210ac91b090900c1a0555a425c57a), [`0fd90a2`](https://github.com/mastra-ai/mastra/commit/0fd90a215caf5fca8099c15a67ca03e4427747a3), [`8fb2405`](https://github.com/mastra-ai/mastra/commit/8fb2405138f2d208b7962ad03f121ca25bcc28c5), [`12df98c`](https://github.com/mastra-ai/mastra/commit/12df98c4904643d9481f5c78f3bed443725b4c96)]:
|
|
171
|
+
- @mastra/core@1.26.0
|
|
172
|
+
|
|
173
|
+
## 0.3.1-alpha.0
|
|
174
|
+
|
|
175
|
+
### Patch Changes
|
|
176
|
+
|
|
177
|
+
- dependencies updates: ([#15529](https://github.com/mastra-ai/mastra/pull/15529))
|
|
178
|
+
- Updated dependency [`@aws-sdk/client-s3@^3.1032.0` ↗︎](https://www.npmjs.com/package/@aws-sdk/client-s3/v/3.1032.0) (from `^3.1009.0`, in `dependencies`)
|
|
179
|
+
- Updated dependencies [[`20f59b8`](https://github.com/mastra-ai/mastra/commit/20f59b876cf91199efbc49a0e36b391240708f08), [`e2687a7`](https://github.com/mastra-ai/mastra/commit/e2687a7408790c384563816a9a28ed06735684c9), [`8f1b280`](https://github.com/mastra-ai/mastra/commit/8f1b280b7fe6999ec654f160cb69c1a8719e7a57), [`12df98c`](https://github.com/mastra-ai/mastra/commit/12df98c4904643d9481f5c78f3bed443725b4c96)]:
|
|
180
|
+
- @mastra/core@1.26.0-alpha.11
|
|
9
181
|
|
|
10
182
|
## 0.3.0
|
|
11
183
|
|
package/README.md
CHANGED
|
@@ -31,6 +31,33 @@ const agent = new Agent({
|
|
|
31
31
|
});
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
+
### AWS credential provider chain
|
|
35
|
+
|
|
36
|
+
When no credentials are provided, `S3Filesystem` uses the AWS SDK default credential provider chain to discover credentials from the environment automatically (environment variables, `~/.aws` config, ECS container credentials, EC2 instance profiles, etc.).
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
import { S3Filesystem } from '@mastra/s3';
|
|
40
|
+
|
|
41
|
+
// SDK discovers credentials from the environment
|
|
42
|
+
const filesystem = new S3Filesystem({
|
|
43
|
+
bucket: 'my-bucket',
|
|
44
|
+
region: 'us-east-1',
|
|
45
|
+
});
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
You can also pass a credential provider function for auto-refreshing credentials, which is useful for ECS, Lambda, SSO, or AssumeRole deployments:
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
import { S3Filesystem } from '@mastra/s3';
|
|
52
|
+
import { fromNodeProviderChain } from '@aws-sdk/credential-providers';
|
|
53
|
+
|
|
54
|
+
const filesystem = new S3Filesystem({
|
|
55
|
+
bucket: 'my-bucket',
|
|
56
|
+
region: 'us-east-1',
|
|
57
|
+
credentials: fromNodeProviderChain(),
|
|
58
|
+
});
|
|
59
|
+
```
|
|
60
|
+
|
|
34
61
|
### Cloudflare R2
|
|
35
62
|
|
|
36
63
|
```typescript
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AwsCredentialIdentity, AwsCredentialIdentityProvider } from '@aws-sdk/types';
|
|
1
2
|
import { BlobStore } from '@mastra/core/storage';
|
|
2
3
|
import type { StorageBlobEntry } from '@mastra/core/storage';
|
|
3
4
|
/**
|
|
@@ -10,10 +11,19 @@ export interface S3BlobStoreOptions {
|
|
|
10
11
|
bucket: string;
|
|
11
12
|
/** AWS region (use 'auto' for R2) */
|
|
12
13
|
region: string;
|
|
13
|
-
/**
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
/**
|
|
15
|
+
* AWS credentials or credential provider function.
|
|
16
|
+
* Accepts static credentials or a provider that auto-refreshes
|
|
17
|
+
* (e.g. fromNodeProviderChain() from @aws-sdk/credential-providers).
|
|
18
|
+
* When set, takes precedence over accessKeyId/secretAccessKey/sessionToken.
|
|
19
|
+
* When ALL credential options are omitted, the SDK default credential
|
|
20
|
+
* provider chain is used (env vars, ~/.aws, IMDS, ECS container credentials).
|
|
21
|
+
*/
|
|
22
|
+
credentials?: AwsCredentialIdentity | AwsCredentialIdentityProvider;
|
|
23
|
+
/** AWS access key ID. Optional - omit to use the SDK default credential provider chain. */
|
|
24
|
+
accessKeyId?: string;
|
|
25
|
+
/** AWS secret access key. Optional - omit to use the SDK default credential provider chain. */
|
|
26
|
+
secretAccessKey?: string;
|
|
17
27
|
/** AWS session token for temporary credentials (SSO, AssumeRole, container credentials, etc.) */
|
|
18
28
|
sessionToken?: string;
|
|
19
29
|
/**
|
|
@@ -72,8 +82,9 @@ export declare class S3BlobStore extends BlobStore {
|
|
|
72
82
|
private readonly prefix;
|
|
73
83
|
private _client;
|
|
74
84
|
private readonly region;
|
|
75
|
-
private readonly
|
|
76
|
-
private readonly
|
|
85
|
+
private readonly credentials?;
|
|
86
|
+
private readonly accessKeyId?;
|
|
87
|
+
private readonly secretAccessKey?;
|
|
77
88
|
private readonly sessionToken?;
|
|
78
89
|
private readonly endpoint?;
|
|
79
90
|
private readonly forcePathStyle;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/blob-store/index.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7D;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,qBAAqB;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,qCAAqC;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/blob-store/index.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,qBAAqB,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAC;AAE3F,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7D;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,qBAAqB;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,qCAAqC;IACrC,MAAM,EAAE,MAAM,CAAC;IACf;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,qBAAqB,GAAG,6BAA6B,CAAC;IACpE,2FAA2F;IAC3F,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+FAA+F;IAC/F,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iGAAiG;IACjG,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kFAAkF;IAClF,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAWD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,qBAAa,WAAY,SAAQ,SAAS;IACxC,OAAO,CAA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import type { FileContent, FileStat, FileEntry, ReadOptions, WriteOptions, ListOptions, RemoveOptions, CopyOptions, FilesystemMountConfig, FilesystemIcon, FilesystemInfo, ProviderStatus, MastraFilesystemOptions } from '@mastra/core/workspace';
|
|
3
4
|
import { MastraFilesystem } from '@mastra/core/workspace';
|
|
4
5
|
/**
|
|
@@ -19,6 +20,12 @@ export interface S3MountConfig extends FilesystemMountConfig {
|
|
|
19
20
|
secretAccessKey?: string;
|
|
20
21
|
/** AWS session token for temporary credentials (SSO, AssumeRole, container credentials, etc.) */
|
|
21
22
|
sessionToken?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Optional prefix (subdirectory) to mount instead of the entire bucket.
|
|
25
|
+
* Uses s3fs `bucket:/prefix` syntax to scope the mount to a specific path.
|
|
26
|
+
* Leading/trailing slashes are normalized automatically.
|
|
27
|
+
*/
|
|
28
|
+
prefix?: string;
|
|
22
29
|
/** Mount as read-only */
|
|
23
30
|
readOnly?: boolean;
|
|
24
31
|
}
|
|
@@ -38,14 +45,23 @@ export interface S3FilesystemOptions extends MastraFilesystemOptions {
|
|
|
38
45
|
description?: string;
|
|
39
46
|
/** AWS region (use 'auto' for R2) */
|
|
40
47
|
region: string;
|
|
48
|
+
/**
|
|
49
|
+
* AWS credentials or credential provider function.
|
|
50
|
+
* Accepts static credentials or a provider that auto-refreshes
|
|
51
|
+
* (e.g. fromNodeProviderChain() from @aws-sdk/credential-providers).
|
|
52
|
+
* When set, takes precedence over accessKeyId/secretAccessKey/sessionToken.
|
|
53
|
+
* When ALL credential options are omitted, the SDK default credential
|
|
54
|
+
* provider chain is used (env vars, ~/.aws, IMDS, ECS container credentials).
|
|
55
|
+
*/
|
|
56
|
+
credentials?: AwsCredentialIdentity | AwsCredentialIdentityProvider;
|
|
41
57
|
/**
|
|
42
58
|
* AWS access key ID.
|
|
43
|
-
* Optional - omit
|
|
59
|
+
* Optional - omit to use the SDK default credential provider chain.
|
|
44
60
|
*/
|
|
45
61
|
accessKeyId?: string;
|
|
46
62
|
/**
|
|
47
63
|
* AWS secret access key.
|
|
48
|
-
* Optional - omit
|
|
64
|
+
* Optional - omit to use the SDK default credential provider chain.
|
|
49
65
|
*/
|
|
50
66
|
secretAccessKey?: string;
|
|
51
67
|
/**
|
|
@@ -80,6 +96,7 @@ export declare class S3Filesystem extends MastraFilesystem {
|
|
|
80
96
|
readonly description?: string;
|
|
81
97
|
private readonly bucket;
|
|
82
98
|
private readonly region;
|
|
99
|
+
private readonly credentials?;
|
|
83
100
|
private readonly accessKeyId?;
|
|
84
101
|
private readonly secretAccessKey?;
|
|
85
102
|
private readonly sessionToken?;
|
|
@@ -111,6 +128,12 @@ export declare class S3Filesystem extends MastraFilesystem {
|
|
|
111
128
|
/**
|
|
112
129
|
* Get mount configuration for E2B sandbox.
|
|
113
130
|
* Returns S3-compatible config that works with s3fs-fuse.
|
|
131
|
+
*
|
|
132
|
+
* Only static `accessKeyId`/`secretAccessKey`/`sessionToken` are included in the
|
|
133
|
+
* returned config. If credentials are provided only via the `credentials` option
|
|
134
|
+
* (provider function), the returned config will have no credentials because FUSE
|
|
135
|
+
* mounts cannot call a provider function. Use static credentials for sandbox
|
|
136
|
+
* mount compatibility.
|
|
114
137
|
*/
|
|
115
138
|
getMountConfig(): S3MountConfig;
|
|
116
139
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/filesystem/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EACV,WAAW,EACX,QAAQ,EACR,SAAS,EACT,WAAW,EACX,YAAY,EACZ,WAAW,EACX,aAAa,EACb,WAAW,EACX,qBAAqB,EACrB,cAAc,EACd,cAAc,EACd,cAAc,EACd,uBAAuB,EACxB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,gBAAgB,EAAsC,MAAM,wBAAwB,CAAC;AAE9F;;;GAGG;AACH,MAAM,WAAW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AAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IAqDrC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAoBtC,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAqBjD;;;OAGG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IA+B3B;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAG/B"}
|
package/dist/index.cjs
CHANGED
|
@@ -76,6 +76,7 @@ var S3Filesystem = class extends workspace.MastraFilesystem {
|
|
|
76
76
|
description;
|
|
77
77
|
bucket;
|
|
78
78
|
region;
|
|
79
|
+
credentials;
|
|
79
80
|
accessKeyId;
|
|
80
81
|
secretAccessKey;
|
|
81
82
|
sessionToken;
|
|
@@ -88,12 +89,14 @@ var S3Filesystem = class extends workspace.MastraFilesystem {
|
|
|
88
89
|
this.id = options.id ?? `s3-fs-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
89
90
|
this.bucket = options.bucket;
|
|
90
91
|
this.region = options.region;
|
|
92
|
+
this.credentials = options.credentials;
|
|
91
93
|
this.accessKeyId = options.accessKeyId;
|
|
92
94
|
this.secretAccessKey = options.secretAccessKey;
|
|
93
95
|
this.sessionToken = options.sessionToken;
|
|
94
96
|
this.endpoint = options.endpoint;
|
|
95
97
|
this.forcePathStyle = options.forcePathStyle ?? !!options.endpoint;
|
|
96
|
-
|
|
98
|
+
const trimmedPrefix = options.prefix ? trimSlashes(options.prefix) : "";
|
|
99
|
+
this.prefix = trimmedPrefix ? trimmedPrefix + "/" : "";
|
|
97
100
|
this.icon = options.icon ?? this.detectIconFromEndpoint(options.endpoint);
|
|
98
101
|
this.displayName = options.displayName ?? this.getDefaultDisplayName(this.icon);
|
|
99
102
|
this.description = options.description;
|
|
@@ -124,6 +127,12 @@ var S3Filesystem = class extends workspace.MastraFilesystem {
|
|
|
124
127
|
/**
|
|
125
128
|
* Get mount configuration for E2B sandbox.
|
|
126
129
|
* Returns S3-compatible config that works with s3fs-fuse.
|
|
130
|
+
*
|
|
131
|
+
* Only static `accessKeyId`/`secretAccessKey`/`sessionToken` are included in the
|
|
132
|
+
* returned config. If credentials are provided only via the `credentials` option
|
|
133
|
+
* (provider function), the returned config will have no credentials because FUSE
|
|
134
|
+
* mounts cannot call a provider function. Use static credentials for sandbox
|
|
135
|
+
* mount compatibility.
|
|
127
136
|
*/
|
|
128
137
|
getMountConfig() {
|
|
129
138
|
const config = {
|
|
@@ -139,6 +148,9 @@ var S3Filesystem = class extends workspace.MastraFilesystem {
|
|
|
139
148
|
config.sessionToken = this.sessionToken;
|
|
140
149
|
}
|
|
141
150
|
}
|
|
151
|
+
if (this.prefix) {
|
|
152
|
+
config.prefix = this.prefix;
|
|
153
|
+
}
|
|
142
154
|
if (this.readOnly) {
|
|
143
155
|
config.readOnly = true;
|
|
144
156
|
}
|
|
@@ -240,24 +252,22 @@ var S3Filesystem = class extends workspace.MastraFilesystem {
|
|
|
240
252
|
}
|
|
241
253
|
getClient() {
|
|
242
254
|
if (this._client) return this._client;
|
|
243
|
-
const
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
credentials
|
|
255
|
+
const hasStaticCredentials = this.accessKeyId && this.secretAccessKey;
|
|
256
|
+
let credentials;
|
|
257
|
+
if (this.credentials) {
|
|
258
|
+
credentials = this.credentials;
|
|
259
|
+
} else if (hasStaticCredentials) {
|
|
260
|
+
credentials = {
|
|
247
261
|
accessKeyId: this.accessKeyId,
|
|
248
262
|
secretAccessKey: this.secretAccessKey,
|
|
249
263
|
...this.sessionToken && { sessionToken: this.sessionToken }
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
this._client = new clientS3.S3Client({
|
|
267
|
+
region: this.region,
|
|
268
|
+
...credentials !== void 0 && { credentials },
|
|
255
269
|
endpoint: this.endpoint,
|
|
256
|
-
forcePathStyle: this.forcePathStyle
|
|
257
|
-
// Skip signing for anonymous access (public buckets).
|
|
258
|
-
// No-op signer passes the request through unsigned. Uses `any` because
|
|
259
|
-
// the correct type (HttpRequest from @smithy/types) is not a direct dependency.
|
|
260
|
-
...hasCredentials ? {} : { signer: { sign: async (request) => request } }
|
|
270
|
+
forcePathStyle: this.forcePathStyle
|
|
261
271
|
});
|
|
262
272
|
return this._client;
|
|
263
273
|
}
|
|
@@ -270,7 +280,7 @@ var S3Filesystem = class extends workspace.MastraFilesystem {
|
|
|
270
280
|
return this.getClient();
|
|
271
281
|
}
|
|
272
282
|
toKey(path) {
|
|
273
|
-
const cleanPath = path.replace(/^\/+/, "");
|
|
283
|
+
const cleanPath = path.replace(/^\/+/, "").replace(/^\.(?:\/|$)/, "");
|
|
274
284
|
return this.prefix + cleanPath;
|
|
275
285
|
}
|
|
276
286
|
// ---------------------------------------------------------------------------
|
|
@@ -628,6 +638,7 @@ var S3BlobStore = class extends storage.BlobStore {
|
|
|
628
638
|
prefix;
|
|
629
639
|
_client = null;
|
|
630
640
|
region;
|
|
641
|
+
credentials;
|
|
631
642
|
accessKeyId;
|
|
632
643
|
secretAccessKey;
|
|
633
644
|
sessionToken;
|
|
@@ -637,6 +648,7 @@ var S3BlobStore = class extends storage.BlobStore {
|
|
|
637
648
|
super();
|
|
638
649
|
this.bucket = options.bucket;
|
|
639
650
|
this.region = options.region;
|
|
651
|
+
this.credentials = options.credentials;
|
|
640
652
|
this.accessKeyId = options.accessKeyId;
|
|
641
653
|
this.secretAccessKey = options.secretAccessKey;
|
|
642
654
|
this.sessionToken = options.sessionToken;
|
|
@@ -646,13 +658,20 @@ var S3BlobStore = class extends storage.BlobStore {
|
|
|
646
658
|
}
|
|
647
659
|
getClient() {
|
|
648
660
|
if (this._client) return this._client;
|
|
649
|
-
this.
|
|
650
|
-
|
|
651
|
-
|
|
661
|
+
const hasStaticCredentials = this.accessKeyId && this.secretAccessKey;
|
|
662
|
+
let credentials;
|
|
663
|
+
if (this.credentials) {
|
|
664
|
+
credentials = this.credentials;
|
|
665
|
+
} else if (hasStaticCredentials) {
|
|
666
|
+
credentials = {
|
|
652
667
|
accessKeyId: this.accessKeyId,
|
|
653
668
|
secretAccessKey: this.secretAccessKey,
|
|
654
669
|
...this.sessionToken && { sessionToken: this.sessionToken }
|
|
655
|
-
}
|
|
670
|
+
};
|
|
671
|
+
}
|
|
672
|
+
this._client = new clientS3.S3Client({
|
|
673
|
+
region: this.region,
|
|
674
|
+
...credentials !== void 0 && { credentials },
|
|
656
675
|
endpoint: this.endpoint,
|
|
657
676
|
forcePathStyle: this.forcePathStyle
|
|
658
677
|
});
|