wtfai 1.7.1 → 1.7.3

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/ui/code.js CHANGED
@@ -51,6 +51,7 @@ const Code = (props)=>{
51
51
  });
52
52
  } else node = /*#__PURE__*/ jsx(CodeHighlighter, {
53
53
  lang: lang,
54
+ prismLightMode: true,
54
55
  children: children
55
56
  });
56
57
  if (null == contentWrapper ? void 0 : contentWrapper.code) {
package/dist/upload.d.ts CHANGED
@@ -35,4 +35,10 @@ export declare class UploadService {
35
35
  * 上传图片(自动压缩)
36
36
  */
37
37
  uploadImage(params: UploadImageParams): Promise<string>;
38
+ /**
39
+ * 获取文件签名 URL
40
+ */
41
+ getSignedUrl(key: string, bucketTypeCode?: 'public' | 'private'): Promise<{
42
+ url: string;
43
+ }>;
38
44
  }
package/dist/upload.js CHANGED
@@ -1,4 +1,3 @@
1
- import cos_js_sdk_v5 from "cos-js-sdk-v5";
2
1
  import compressorjs from "compressorjs";
3
2
  function _define_property(obj, key, value) {
4
3
  if (key in obj) Object.defineProperty(obj, key, {
@@ -86,7 +85,8 @@ class UploadService {
86
85
  throw new Error(error.message || '获取上传凭证失败');
87
86
  }
88
87
  const data = await response.json();
89
- const cos = new cos_js_sdk_v5({
88
+ const COS = (await import("cos-js-sdk-v5")).default;
89
+ const cos = new COS({
90
90
  getAuthorization: (_options, callback)=>{
91
91
  callback({
92
92
  TmpSecretId: data.credentials.tmpSecretId,
@@ -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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wtfai",
3
- "version": "1.7.1",
3
+ "version": "1.7.3",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -15,28 +15,28 @@
15
15
  "devDependencies": {
16
16
  "@eslint/js": "^9.39.4",
17
17
  "@rsbuild/plugin-react": "^1.4.6",
18
- "@rslib/core": "^0.20.0",
18
+ "@rslib/core": "^0.21.0",
19
19
  "@types/react": "^19.2.14",
20
20
  "eslint": "^9.39.4",
21
21
  "eslint-config-prettier": "^10.1.8",
22
22
  "eslint-plugin-prettier": "^5.5.5",
23
23
  "globals": "^17.4.0",
24
- "prettier": "^3.8.1",
25
- "react": "^19.2.4",
24
+ "prettier": "^3.8.2",
25
+ "react": "^19.2.5",
26
26
  "typescript": "^5.9.3",
27
- "typescript-eslint": "^8.57.0"
27
+ "typescript-eslint": "^8.58.1"
28
28
  },
29
29
  "peerDependencies": {
30
30
  "react": ">=16.9.0",
31
31
  "react-dom": ">=16.9.0"
32
32
  },
33
33
  "dependencies": {
34
- "@ant-design/icons": "^6.1.0",
35
- "@ant-design/x": "^2.4.0",
36
- "@ant-design/x-markdown": "^2.4.0",
34
+ "@ant-design/icons": "^6.1.1",
35
+ "@ant-design/x": "^2.5.0",
36
+ "@ant-design/x-markdown": "^2.5.0",
37
37
  "@microsoft/fetch-event-source": "^2.0.1",
38
38
  "clsx": "^2.1.1",
39
- "compressorjs": "^1.2.1",
39
+ "compressorjs": "^1.3.0",
40
40
  "cos-js-sdk-v5": "^1.10.1",
41
41
  "jsonrepair": "^3.13.3",
42
42
  "uuid": "^13.0.0",