@nocobase/plugin-file-manager 2.1.0-alpha.4 → 2.1.0-alpha.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/LICENSE +201 -661
  2. package/README.md +79 -10
  3. package/client-v2.d.ts +2 -0
  4. package/client-v2.js +1 -0
  5. package/dist/client/index.d.ts +1 -1
  6. package/dist/client/index.js +1 -1
  7. package/dist/client/locale/index.d.ts +2 -1
  8. package/dist/client/previewer/filePreviewTypes.d.ts +1 -31
  9. package/dist/client-v2/125.01d5562df948d974.js +10 -0
  10. package/dist/client-v2/229.bd72c2d7aa088310.js +10 -0
  11. package/dist/client-v2/336.1dd1b32466d0c778.js +10 -0
  12. package/dist/client-v2/43.eb45d53ba3e9828b.js +10 -0
  13. package/dist/client-v2/450.f590b4c220108742.js +10 -0
  14. package/dist/client-v2/929.d7e783304cc1f236.js +10 -0
  15. package/dist/client-v2/942.9dc2d49980a4dd9e.js +10 -0
  16. package/dist/{client/StorageOptions.d.ts → client-v2/components/BaseUrlField.d.ts} +1 -1
  17. package/dist/client-v2/components/DefaultField.d.ts +18 -0
  18. package/dist/client-v2/components/FileSizeField.d.ts +10 -0
  19. package/dist/client-v2/components/MimetypeField.d.ts +10 -0
  20. package/dist/client-v2/components/NameField.d.ts +10 -0
  21. package/dist/client-v2/components/ParanoidField.d.ts +10 -0
  22. package/dist/client-v2/components/PathField.d.ts +18 -0
  23. package/dist/client-v2/components/RenameModeField.d.ts +10 -0
  24. package/dist/client-v2/components/TitleField.d.ts +10 -0
  25. package/dist/client-v2/components/index.d.ts +17 -0
  26. package/dist/client-v2/index.d.ts +15 -0
  27. package/dist/client-v2/index.js +10 -0
  28. package/dist/client-v2/locale.d.ts +10 -0
  29. package/dist/{client → client-v2}/models/DisplayPreviewFieldModel.d.ts +1 -1
  30. package/dist/{client → client-v2}/models/UploadActionModel.d.ts +2 -2
  31. package/dist/{client → client-v2}/models/UploadFieldModel.d.ts +1 -1
  32. package/dist/client-v2/models/index.d.ts +11 -0
  33. package/dist/client-v2/models/uploadFieldUtils.d.ts +64 -0
  34. package/dist/client-v2/pages/FileStoragePage.d.ts +10 -0
  35. package/dist/client-v2/plugin.d.ts +87 -0
  36. package/dist/client-v2/storage-forms/AliOssStorageForm.d.ts +10 -0
  37. package/dist/client-v2/storage-forms/LocalStorageForm.d.ts +10 -0
  38. package/dist/client-v2/storage-forms/S3StorageForm.d.ts +10 -0
  39. package/dist/client-v2/storage-forms/TxCosStorageForm.d.ts +10 -0
  40. package/dist/externalVersion.js +12 -12
  41. package/dist/locale/en-US.json +1 -0
  42. package/dist/locale/zh-CN.json +1 -0
  43. package/dist/node_modules/@aws-sdk/client-s3/dist-cjs/index.js +190 -190
  44. package/dist/node_modules/@aws-sdk/client-s3/package.json +1 -1
  45. package/dist/node_modules/@aws-sdk/lib-storage/dist-cjs/index.js +195 -195
  46. package/dist/node_modules/@aws-sdk/lib-storage/node_modules/buffer/index.d.ts +186 -0
  47. package/dist/node_modules/@aws-sdk/lib-storage/node_modules/buffer/index.js +1794 -0
  48. package/dist/node_modules/@aws-sdk/lib-storage/node_modules/buffer/package.json +82 -0
  49. package/dist/node_modules/@aws-sdk/lib-storage/package.json +1 -1
  50. package/dist/node_modules/ali-oss/lib/client.js +14 -14
  51. package/dist/node_modules/ali-oss/package.json +1 -1
  52. package/dist/node_modules/cos-nodejs-sdk-v5/.github/workflows/auto-changelog.yml +55 -0
  53. package/dist/node_modules/cos-nodejs-sdk-v5/.prettierrc +10 -0
  54. package/dist/node_modules/cos-nodejs-sdk-v5/.travis.yml +16 -0
  55. package/dist/node_modules/cos-nodejs-sdk-v5/LICENSE +21 -0
  56. package/dist/node_modules/cos-nodejs-sdk-v5/demo/crc64.js +9 -0
  57. package/dist/node_modules/cos-nodejs-sdk-v5/demo/demo-sts-scope.js +75 -0
  58. package/dist/node_modules/cos-nodejs-sdk-v5/demo/demo-sts.js +65 -0
  59. package/dist/node_modules/cos-nodejs-sdk-v5/demo/demo.js +4542 -0
  60. package/dist/node_modules/cos-nodejs-sdk-v5/demo/util.js +135 -0
  61. package/dist/node_modules/cos-nodejs-sdk-v5/index.d.ts +2610 -0
  62. package/dist/node_modules/cos-nodejs-sdk-v5/index.js +220 -0
  63. package/dist/node_modules/cos-nodejs-sdk-v5/package.json +1 -0
  64. package/dist/node_modules/cos-nodejs-sdk-v5/sdk/advance.js +1659 -0
  65. package/dist/node_modules/cos-nodejs-sdk-v5/sdk/async.js +59 -0
  66. package/dist/node_modules/cos-nodejs-sdk-v5/sdk/base.js +4404 -0
  67. package/dist/node_modules/cos-nodejs-sdk-v5/sdk/cos.js +137 -0
  68. package/dist/node_modules/cos-nodejs-sdk-v5/sdk/event.js +34 -0
  69. package/dist/node_modules/cos-nodejs-sdk-v5/sdk/select-stream.js +181 -0
  70. package/dist/node_modules/cos-nodejs-sdk-v5/sdk/session.js +126 -0
  71. package/dist/node_modules/cos-nodejs-sdk-v5/sdk/task.js +255 -0
  72. package/dist/node_modules/cos-nodejs-sdk-v5/sdk/util.js +776 -0
  73. package/dist/node_modules/cos-nodejs-sdk-v5/test/csp.js +1302 -0
  74. package/dist/node_modules/cos-nodejs-sdk-v5/test/test.js +6119 -0
  75. package/dist/node_modules/mime-match/index.js +1 -1
  76. package/dist/node_modules/mime-match/package.json +1 -1
  77. package/dist/node_modules/mime-types/index.js +3 -3
  78. package/dist/node_modules/mime-types/package.json +1 -1
  79. package/dist/node_modules/mkdirp/index.js +1 -1
  80. package/dist/node_modules/mkdirp/package.json +1 -1
  81. package/dist/node_modules/url-join/lib/url-join.js +1 -1
  82. package/dist/node_modules/url-join/package.json +1 -1
  83. package/dist/server/index.d.ts +1 -1
  84. package/dist/server/index.js +2 -0
  85. package/dist/server/server.d.ts +2 -2
  86. package/dist/server/server.js +2 -2
  87. package/dist/server/storages/index.d.ts +4 -1
  88. package/dist/server/storages/index.js +2 -1
  89. package/dist/server/storages/local.js +7 -3
  90. package/dist/server/storages/tx-cos.d.ts +16 -1
  91. package/dist/server/storages/tx-cos.js +111 -10
  92. package/dist/server/utils.d.ts +1 -0
  93. package/dist/server/utils.js +21 -2
  94. package/dist/shared/locale.d.ts +9 -0
  95. package/dist/shared/locale.js +36 -0
  96. package/dist/shared/previewer/filePreviewTypes.d.ts +42 -0
  97. package/dist/shared/previewer/filePreviewTypes.js +459 -0
  98. package/package.json +7 -4
  99. package/dist/node_modules/multer-cos/LICENSE +0 -24
  100. package/dist/node_modules/multer-cos/demo/index.js +0 -39
  101. package/dist/node_modules/multer-cos/demo/myMulter.js +0 -88
  102. package/dist/node_modules/multer-cos/index.js +0 -220
  103. package/dist/node_modules/multer-cos/package.json +0 -1
@@ -0,0 +1,87 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import type { Application } from '@nocobase/client-v2';
10
+ import { Plugin } from '@nocobase/client-v2';
11
+ import type React from 'react';
12
+ type UploadFileResult = {
13
+ errorMessage?: string;
14
+ data?: unknown;
15
+ };
16
+ type StorageUploadOptions = {
17
+ file: File;
18
+ apiClient: Application['apiClient'];
19
+ storageType?: string;
20
+ storageId?: number;
21
+ storageRules?: {
22
+ size?: number;
23
+ mimetype?: string | string[];
24
+ };
25
+ fileCollectionName: string;
26
+ query?: Record<string, string | number | boolean>;
27
+ };
28
+ /**
29
+ * Unified storage type definition. A single entry describes both the
30
+ * settings-page form (UI: `title` + `formLoader` + `defaultValues`) and the
31
+ * optional runtime upload override (`upload` / `createUploadCustomRequest`).
32
+ *
33
+ * Built-in storages register the UI fields only and fall back to the default
34
+ * `apiClient.request` multipart upload. Commercial / third-party storage
35
+ * plugins (e.g. S3 Pro) layer a presigned-PUT pipeline on top by populating
36
+ * the optional runtime fields.
37
+ */
38
+ export interface StorageType {
39
+ /** Server-side storage type identifier — must match the persisted `storages.type` value. */
40
+ name: string;
41
+ /** Display title shown in the "Add new" dropdown and drawer header. Wrapped with `t(...)` at render time. */
42
+ title: string;
43
+ /**
44
+ * Async loader for the form body — the list of `<Form.Item>` fields inside
45
+ * the storage drawer. The loaded module's default export is used, matching
46
+ * the convention of `componentLoader` and `registerModelLoaders` elsewhere
47
+ * in the codebase.
48
+ */
49
+ formLoader: () => Promise<{
50
+ default: React.ComponentType;
51
+ }>;
52
+ /**
53
+ * Optional per-storage initial values merged on top of the page-level
54
+ * defaults (`type` + generated `name`) when creating a new record.
55
+ */
56
+ defaultValues?: Record<string, any>;
57
+ /**
58
+ * Optional override of the `PluginFileManagerClientV2.uploadFile` pipeline,
59
+ * used when editors (Markdown, Vditor, etc.) paste / drop files outside of
60
+ * an attachment field. When absent, uploads go through the default
61
+ * multipart `apiClient.request` path.
62
+ */
63
+ upload?: (options: StorageUploadOptions) => Promise<UploadFileResult>;
64
+ /**
65
+ * Optional `customRequest` factory consumed by `UploadFieldModel` for the
66
+ * inline attachment Upload component. When absent, `UploadFieldModel` falls
67
+ * back to `uploadFile`.
68
+ */
69
+ createUploadCustomRequest?: (options: any) => (option: any) => void;
70
+ }
71
+ export declare class PluginFileManagerClientV2 extends Plugin<Record<string, never>, Application> {
72
+ static buildInStorage: string[];
73
+ storageTypes: Map<string, StorageType>;
74
+ load(): Promise<void>;
75
+ registerStorageType(name: string, storageType: Omit<StorageType, 'name'>): void;
76
+ getStorageType(name?: string): StorageType;
77
+ private registerBuiltInStorageTypes;
78
+ uploadFile(options?: {
79
+ file: File;
80
+ fileCollectionName?: string;
81
+ storageType?: string;
82
+ storageId?: number;
83
+ storageRules?: StorageUploadOptions['storageRules'];
84
+ query?: StorageUploadOptions['query'];
85
+ }): Promise<UploadFileResult>;
86
+ }
87
+ export default PluginFileManagerClientV2;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import React from 'react';
10
+ export default function AliOssStorageForm(): React.JSX.Element;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import React from 'react';
10
+ export default function LocalStorageForm(): React.JSX.Element;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import React from 'react';
10
+ export default function S3StorageForm(): React.JSX.Element;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import React from 'react';
10
+ export default function TxCosStorageForm(): React.JSX.Element;
@@ -8,25 +8,25 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "2.1.0-alpha.4",
11
+ "@nocobase/client": "2.1.0-alpha.40",
12
12
  "react": "18.2.0",
13
13
  "antd": "5.24.2",
14
14
  "@ant-design/icons": "5.6.1",
15
15
  "@formily/shared": "2.3.7",
16
- "lodash": "4.17.21",
16
+ "lodash": "4.18.1",
17
17
  "react-i18next": "11.18.6",
18
- "@formily/antd-v5": "1.2.3",
19
- "@formily/core": "2.3.7",
20
- "@formily/react": "2.3.7",
18
+ "@nocobase/flow-engine": "2.1.0-alpha.40",
19
+ "@nocobase/client-v2": "2.1.0-alpha.40",
21
20
  "multer": "1.4.5-lts.2",
22
- "@nocobase/database": "2.1.0-alpha.4",
23
- "@nocobase/server": "2.1.0-alpha.4",
24
- "@nocobase/utils": "2.1.0-alpha.4",
25
- "@nocobase/test": "2.1.0-alpha.4",
26
- "@nocobase/flow-engine": "2.1.0-alpha.4",
21
+ "@nocobase/database": "2.1.0-alpha.40",
22
+ "@nocobase/server": "2.1.0-alpha.40",
23
+ "@nocobase/utils": "2.1.0-alpha.40",
24
+ "@nocobase/test": "2.1.0-alpha.40",
25
+ "@formily/react": "2.3.7",
27
26
  "@emotion/css": "11.13.0",
28
- "@nocobase/actions": "2.1.0-alpha.4",
27
+ "ahooks": "3.7.8",
28
+ "@nocobase/actions": "2.1.0-alpha.40",
29
29
  "sequelize": "6.35.2",
30
- "@nocobase/plugin-data-source-main": "2.1.0-alpha.4",
30
+ "@nocobase/plugin-data-source-main": "2.1.0-alpha.40",
31
31
  "axios": "1.7.7"
32
32
  };
@@ -25,6 +25,7 @@
25
25
  "File size limit": "File size limit",
26
26
  "File storage": "File storage",
27
27
  "File type allowed (in MIME type format)": "File type allowed (in MIME type format)",
28
+ "File download failed": "File download failed",
28
29
  "Filename": "Filename",
29
30
  "Files are only removed when their corresponding records in the file collection are deleted. If a record from another collection includes an associating field referencing the file collection, the file will not be deleted unless cascade deletion is enabled for that association.": "Files are only removed when their corresponding records in the file collection are deleted. If a record from another collection includes an associating field referencing the file collection, the file will not be deleted unless cascade deletion is enabled for that association.",
30
31
  "Keep file in storage when destroy record": "Keep file in storage when destroy record",
@@ -20,6 +20,7 @@
20
20
  "File name": "文件名",
21
21
  "File pre-process parameters": "文件预处理参数",
22
22
  "File size limit": "文件大小限制",
23
+ "File download failed": "文件下载失败",
23
24
  "File storage": "文件存储器",
24
25
  "File type allowed (in MIME type format)": "允许的文件类型(MIME 格式)",
25
26
  "File type is not supported for previewing, please <1>download it to preview</1>": "文件类型不支持预览,请<1>下载后查看</1>",