@nocobase/plugin-file-manager 2.1.0-beta.9 → 2.1.0

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 (133) hide show
  1. package/client-v2.d.ts +2 -0
  2. package/client-v2.js +1 -0
  3. package/dist/client/867ada653cd02a3e.mjs +6 -0
  4. package/dist/client/876.ca16d7a6e6387862.js +11 -0
  5. package/dist/client/index.d.ts +2 -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/templates/file.d.ts +1 -1
  10. package/dist/client-v2/125.0b8eef1f19b87042.js +10 -0
  11. package/dist/client-v2/229.bd72c2d7aa088310.js +10 -0
  12. package/dist/client-v2/336.1dd1b32466d0c778.js +10 -0
  13. package/dist/client-v2/43.eb45d53ba3e9828b.js +10 -0
  14. package/dist/client-v2/450.30cc3ed6973d8c4d.js +10 -0
  15. package/dist/client-v2/867ada653cd02a3e.mjs +6 -0
  16. package/dist/client-v2/876.22cd8e41ac8631ed.js +11 -0
  17. package/dist/client-v2/929.d7e783304cc1f236.js +10 -0
  18. package/dist/client-v2/942.f36d807d763a1b53.js +10 -0
  19. package/dist/{client/StorageOptions.d.ts → client-v2/components/BaseUrlField.d.ts} +1 -1
  20. package/dist/client-v2/components/DefaultField.d.ts +18 -0
  21. package/dist/client-v2/components/FileSizeField.d.ts +10 -0
  22. package/dist/client-v2/components/MimetypeField.d.ts +10 -0
  23. package/dist/client-v2/components/NameField.d.ts +10 -0
  24. package/dist/client-v2/components/ParanoidField.d.ts +10 -0
  25. package/dist/client-v2/components/PathField.d.ts +18 -0
  26. package/dist/client-v2/components/RenameModeField.d.ts +10 -0
  27. package/dist/client-v2/components/TitleField.d.ts +10 -0
  28. package/dist/client-v2/components/index.d.ts +17 -0
  29. package/dist/client-v2/index.d.ts +17 -0
  30. package/dist/client-v2/index.js +10 -0
  31. package/dist/client-v2/locale.d.ts +10 -0
  32. package/dist/{client → client-v2}/models/DisplayPreviewFieldModel.d.ts +1 -1
  33. package/dist/{client → client-v2}/models/UploadActionModel.d.ts +4 -3
  34. package/dist/{client → client-v2}/models/UploadFieldModel.d.ts +1 -1
  35. package/dist/client-v2/models/index.d.ts +11 -0
  36. package/dist/{client → client-v2}/models/uploadFieldUtils.d.ts +8 -0
  37. package/dist/client-v2/pages/FileStoragePage.d.ts +10 -0
  38. package/dist/client-v2/plugin.d.ts +89 -0
  39. package/dist/client-v2/previewer/filePreviewTypes.d.ts +46 -0
  40. package/dist/client-v2/storage-forms/AliOssStorageForm.d.ts +10 -0
  41. package/dist/client-v2/storage-forms/LocalStorageForm.d.ts +10 -0
  42. package/dist/client-v2/storage-forms/S3StorageForm.d.ts +10 -0
  43. package/dist/client-v2/storage-forms/TxCosStorageForm.d.ts +10 -0
  44. package/dist/common/collections/attachments.d.ts +1 -0
  45. package/dist/common/collections/attachments.js +1 -0
  46. package/dist/common/collections/storages.d.ts +1 -0
  47. package/dist/common/collections/storages.js +1 -0
  48. package/dist/externalVersion.js +12 -12
  49. package/dist/locale/de-DE.json +3 -0
  50. package/dist/locale/en-US.json +4 -0
  51. package/dist/locale/es-ES.json +3 -0
  52. package/dist/locale/fr-FR.json +3 -0
  53. package/dist/locale/hu-HU.json +4 -1
  54. package/dist/locale/id-ID.json +4 -1
  55. package/dist/locale/it-IT.json +3 -0
  56. package/dist/locale/ja-JP.json +3 -0
  57. package/dist/locale/ko-KR.json +3 -0
  58. package/dist/locale/nl-NL.json +3 -0
  59. package/dist/locale/pt-BR.json +3 -0
  60. package/dist/locale/ru-RU.json +3 -0
  61. package/dist/locale/tr-TR.json +3 -0
  62. package/dist/locale/uk-UA.json +3 -0
  63. package/dist/locale/vi-VN.json +4 -1
  64. package/dist/locale/zh-CN.json +4 -0
  65. package/dist/locale/zh-TW.json +3 -0
  66. package/dist/node_modules/@aws-sdk/client-s3/dist-cjs/index.js +190 -190
  67. package/dist/node_modules/@aws-sdk/client-s3/package.json +1 -1
  68. package/dist/node_modules/@aws-sdk/lib-storage/dist-cjs/index.js +195 -195
  69. package/dist/node_modules/@aws-sdk/lib-storage/node_modules/buffer/index.d.ts +186 -0
  70. package/dist/node_modules/@aws-sdk/lib-storage/node_modules/buffer/index.js +1794 -0
  71. package/dist/node_modules/@aws-sdk/lib-storage/node_modules/buffer/package.json +82 -0
  72. package/dist/node_modules/@aws-sdk/lib-storage/package.json +1 -1
  73. package/dist/node_modules/ali-oss/lib/client.js +14 -14
  74. package/dist/node_modules/ali-oss/package.json +1 -1
  75. package/dist/node_modules/cos-nodejs-sdk-v5/.github/workflows/auto-changelog.yml +55 -0
  76. package/dist/node_modules/cos-nodejs-sdk-v5/.prettierrc +10 -0
  77. package/dist/node_modules/cos-nodejs-sdk-v5/.travis.yml +16 -0
  78. package/dist/node_modules/cos-nodejs-sdk-v5/LICENSE +21 -0
  79. package/dist/node_modules/cos-nodejs-sdk-v5/demo/crc64.js +9 -0
  80. package/dist/node_modules/cos-nodejs-sdk-v5/demo/demo-sts-scope.js +75 -0
  81. package/dist/node_modules/cos-nodejs-sdk-v5/demo/demo-sts.js +65 -0
  82. package/dist/node_modules/cos-nodejs-sdk-v5/demo/demo.js +4542 -0
  83. package/dist/node_modules/cos-nodejs-sdk-v5/demo/util.js +135 -0
  84. package/dist/node_modules/cos-nodejs-sdk-v5/index.d.ts +2610 -0
  85. package/dist/node_modules/cos-nodejs-sdk-v5/index.js +220 -0
  86. package/dist/node_modules/cos-nodejs-sdk-v5/package.json +1 -0
  87. package/dist/node_modules/cos-nodejs-sdk-v5/sdk/advance.js +1659 -0
  88. package/dist/node_modules/cos-nodejs-sdk-v5/sdk/async.js +59 -0
  89. package/dist/node_modules/cos-nodejs-sdk-v5/sdk/base.js +4404 -0
  90. package/dist/node_modules/cos-nodejs-sdk-v5/sdk/cos.js +137 -0
  91. package/dist/node_modules/cos-nodejs-sdk-v5/sdk/event.js +34 -0
  92. package/dist/node_modules/cos-nodejs-sdk-v5/sdk/select-stream.js +181 -0
  93. package/dist/node_modules/cos-nodejs-sdk-v5/sdk/session.js +126 -0
  94. package/dist/node_modules/cos-nodejs-sdk-v5/sdk/task.js +255 -0
  95. package/dist/node_modules/cos-nodejs-sdk-v5/sdk/util.js +776 -0
  96. package/dist/node_modules/cos-nodejs-sdk-v5/test/csp.js +1302 -0
  97. package/dist/node_modules/cos-nodejs-sdk-v5/test/test.js +6119 -0
  98. package/dist/node_modules/mime-match/index.js +1 -1
  99. package/dist/node_modules/mime-match/package.json +1 -1
  100. package/dist/node_modules/mime-types/index.js +3 -3
  101. package/dist/node_modules/mime-types/package.json +1 -1
  102. package/dist/node_modules/mkdirp/index.js +1 -1
  103. package/dist/node_modules/mkdirp/package.json +1 -1
  104. package/dist/node_modules/url-join/lib/url-join.js +1 -1
  105. package/dist/node_modules/url-join/package.json +1 -1
  106. package/dist/server/actions/attachments.js +2 -2
  107. package/dist/server/actions/index.js +8 -1
  108. package/dist/server/actions/storage-validation.d.ts +10 -0
  109. package/dist/server/actions/storage-validation.js +73 -0
  110. package/dist/server/commands/repair-filenames.d.ts +55 -0
  111. package/dist/server/commands/repair-filenames.js +283 -0
  112. package/dist/server/index.d.ts +1 -1
  113. package/dist/server/index.js +2 -0
  114. package/dist/server/server.d.ts +5 -2
  115. package/dist/server/server.js +19 -7
  116. package/dist/server/storages/ali-oss.d.ts +3 -1
  117. package/dist/server/storages/ali-oss.js +23 -2
  118. package/dist/server/storages/index.d.ts +7 -1
  119. package/dist/server/storages/index.js +8 -1
  120. package/dist/server/storages/local.d.ts +6 -0
  121. package/dist/server/storages/local.js +76 -11
  122. package/dist/server/storages/s3.d.ts +2 -0
  123. package/dist/server/storages/s3.js +26 -0
  124. package/dist/server/storages/tx-cos.d.ts +18 -1
  125. package/dist/server/storages/tx-cos.js +138 -10
  126. package/dist/server/utils.d.ts +3 -0
  127. package/dist/server/utils.js +72 -4
  128. package/package.json +8 -3
  129. package/dist/node_modules/multer-cos/LICENSE +0 -24
  130. package/dist/node_modules/multer-cos/demo/index.js +0 -39
  131. package/dist/node_modules/multer-cos/demo/myMulter.js +0 -88
  132. package/dist/node_modules/multer-cos/index.js +0 -220
  133. package/dist/node_modules/multer-cos/package.json +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-file-manager",
3
- "version": "2.1.0-beta.9",
3
+ "version": "2.1.0",
4
4
  "displayName": "File manager",
5
5
  "displayName.ru-RU": "Менеджер файлов",
6
6
  "displayName.zh-CN": "文件管理器",
@@ -32,9 +32,9 @@
32
32
  "mime-types": "^3.0.1",
33
33
  "mkdirp": "~0.5.4",
34
34
  "multer": "^1.4.5-lts.2",
35
- "multer-cos": "^1.0.3",
36
35
  "multer-s3": "^3.0.1",
37
36
  "multistream": "^4.1.0",
37
+ "pdfjs-dist": "^5.3.31",
38
38
  "react": "^18.2.0",
39
39
  "react-i18next": "^11.15.1",
40
40
  "supertest": "^6.1.6",
@@ -46,7 +46,12 @@
46
46
  "peerDependencies": {
47
47
  "@nocobase/actions": "2.x",
48
48
  "@nocobase/client": "2.x",
49
+ "@nocobase/client-v2": "2.x",
49
50
  "@nocobase/database": "2.x",
51
+ "@nocobase/flow-engine": "2.x",
52
+ "@nocobase/plugin-data-source-main": "2.x",
53
+ "@nocobase/plugin-data-source-manager": "2.x",
54
+ "@nocobase/plugin-environment-variables": "2.x",
50
55
  "@nocobase/server": "2.x",
51
56
  "@nocobase/test": "2.x",
52
57
  "@nocobase/utils": "2.x"
@@ -55,5 +60,5 @@
55
60
  "Collections",
56
61
  "Collection fields"
57
62
  ],
58
- "gitHead": "c3a2875e4cbbb43b1f2361e6f9f5f84a7d3f3c3c"
63
+ "gitHead": "9373212dd0f22cd985be1e23674d6b454944b9ee"
59
64
  }
@@ -1,24 +0,0 @@
1
- (The MIT License)
2
-
3
- Copyright (c) 2009-2014 TJ Holowaychuk <tj@vision-media.ca>
4
- Copyright (c) 2013-2014 Roman Shtylman <shtylman+expressjs@gmail.com>
5
- Copyright (c) 2014-2015 Douglas Christopher Wilson <doug@somethingdoug.com>
6
-
7
- Permission is hereby granted, free of charge, to any person obtaining
8
- a copy of this software and associated documentation files (the
9
- 'Software'), to deal in the Software without restriction, including
10
- without limitation the rights to use, copy, modify, merge, publish,
11
- distribute, sublicense, and/or sell copies of the Software, and to
12
- permit persons to whom the Software is furnished to do so, subject to
13
- the following conditions:
14
-
15
- The above copyright notice and this permission notice shall be
16
- included in all copies or substantial portions of the Software.
17
-
18
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
19
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
22
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,39 +0,0 @@
1
- let express= require('express');
2
- let myMulter = require('./myMulter');
3
-
4
-
5
- let app = express();
6
- let server = require('http').Server(app);
7
-
8
-
9
- //文件上传服务
10
- app.post('/upload', function (req, res, next) {
11
-
12
- let responseData; //响应的数据
13
-
14
- var upload=myMulter('file',1);
15
-
16
- upload(req, res, function (err) {
17
-
18
- try {
19
- if (err) throw err;
20
- if(req.files.length==0) throw new Error("不能上传空文件");
21
-
22
- responseData={msg:"上传成功",code:2000};
23
- responseData.url=req.files[0].url;
24
- res.json(responseData);
25
-
26
-
27
- }
28
- catch (err) {
29
- responseData={msg:"上传失败",code:4000};;
30
- responseData.error=err.message;
31
- res.status(500).json(responseData);
32
- }
33
- });
34
- });
35
-
36
-
37
-
38
-
39
- server.listen(3000);
@@ -1,88 +0,0 @@
1
- let path=require('path');
2
- let multer = require('multer');
3
- let multerCOS = require('multer-COS');
4
- require( 'dotenv' ).config();
5
- /**
6
- * multer
7
- * https://github.com/expressjs/multer/blob/master/doc/README-zh-cn.md
8
- * cos
9
- * https://cloud.tencent.com/document/product/436/12264#options-object
10
- */
11
-
12
-
13
- //定义临时文件
14
- let dir=path.resolve(__dirname,'./tmp');
15
-
16
- //定义mimes-type
17
- const mimes = {
18
- '.png': 'image/png',
19
- '.gif': 'image/gif',
20
- '.jpg': 'image/jpeg',
21
- '.jpeg': 'image/jpeg',
22
- '.zip':'application/zip',
23
- '.txt':'text/plain'
24
- };
25
-
26
-
27
- const cosConfig={
28
- //id和key是必须
29
-
30
- //SecretId: AKIXXXXXXXXXXX,
31
- //SecretKey:XXXXXXXXXXXXXX,
32
- //Bucket:test-bucket-125XXXXXXXXX
33
- //Region=ap-shanghai
34
- // 可选参数
35
- FileParallelLimit: 3, // 控制文件上传并发数
36
- ChunkParallelLimit: 3, // 控制单个文件下分片上传并发数
37
- ChunkSize: 1024 * 1024, // 控制分片大小,单位 B
38
- domain:'static.dorodoro-lab.com', //cos域名
39
- dir:'upload', //cos文件路径
40
- onProgress:function(progressData){//进度回调函数,回调是一个对象,包含进度信息
41
- //console.log(progressData);
42
- }
43
-
44
- };
45
-
46
-
47
- //定义仓库
48
- const storage = multerCOS({
49
- cos:cosConfig,
50
- //Note:如果你传递的是一个函数,你负责创建文件夹,如果你传递的是一个字符串,multer会自动创建 如果什么都不传 系统自己会生成tmp目录
51
- destination: function (req, file, cb) {
52
- cb(null, dir);
53
- },
54
- //自己会生成个随机16字母的文件名和后缀
55
- filename:'auto'
56
- });
57
-
58
- //测试cos
59
- //storage.test();
60
-
61
-
62
- //定义过滤器
63
- const fileFilter =function (req, file, cb) {
64
-
65
- // 指示是否应接受该文件
66
- let test = Object.values(mimes).filter(type=>type===file.mimetype);
67
-
68
- // 接受这个文件,使用`true`,像这样:
69
- if(test.length>0){
70
- cb(null, true);
71
- }else{ // 拒绝这个文件,使用`false`,像这样:
72
- cb(new Error('file mimes not allow!'), false);
73
- }
74
- };
75
-
76
- //定义限制
77
- const limits={
78
- fileSize:1024 * 1024 * 30
79
- };
80
-
81
-
82
- module.exports=function(opt) {
83
- return multer({
84
- storage: storage,
85
- fileFilter:fileFilter,
86
- limits: limits,
87
- }).array(opt);
88
- };