wtfai 1.7.1 → 1.7.2
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/dist/upload.d.ts +4 -0
- package/dist/upload.js +19 -0
- package/package.json +1 -1
package/dist/upload.d.ts
CHANGED
package/dist/upload.js
CHANGED
|
@@ -157,6 +157,25 @@ class UploadService {
|
|
|
157
157
|
...rest
|
|
158
158
|
});
|
|
159
159
|
}
|
|
160
|
+
async getSignedUrl(key, bucketTypeCode = 'private') {
|
|
161
|
+
const searchParams = new URLSearchParams({
|
|
162
|
+
key,
|
|
163
|
+
bucketType: bucketTypeCode
|
|
164
|
+
});
|
|
165
|
+
const res = await fetch(`${this.baseUrl}/workflows/signed-url?${searchParams.toString()}`, {
|
|
166
|
+
method: 'GET',
|
|
167
|
+
headers: {
|
|
168
|
+
'Content-Type': 'application/json',
|
|
169
|
+
...this.headers
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
if (!res.ok) {
|
|
173
|
+
const error = await res.json().catch(()=>({}));
|
|
174
|
+
throw new Error(error.message || '获取签名 URL 失败');
|
|
175
|
+
}
|
|
176
|
+
const data = await res.json();
|
|
177
|
+
return data;
|
|
178
|
+
}
|
|
160
179
|
constructor(baseUrl, headers = {}){
|
|
161
180
|
_define_property(this, "baseUrl", void 0);
|
|
162
181
|
_define_property(this, "headers", void 0);
|