@nocobase/plugin-file-manager 2.1.0-beta.30 → 2.1.0-beta.33

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 (67) hide show
  1. package/dist/client/index.js +1 -1
  2. package/dist/client-v2/125.01d5562df948d974.js +10 -0
  3. package/dist/client-v2/229.bd72c2d7aa088310.js +10 -0
  4. package/dist/client-v2/336.1dd1b32466d0c778.js +10 -0
  5. package/dist/client-v2/43.eb45d53ba3e9828b.js +10 -0
  6. package/dist/client-v2/450.f590b4c220108742.js +10 -0
  7. package/dist/client-v2/929.d7e783304cc1f236.js +10 -0
  8. package/dist/client-v2/942.c10c97317af6dd02.js +10 -0
  9. package/dist/{client/StorageOptions.d.ts → client-v2/components/BaseUrlField.d.ts} +1 -1
  10. package/dist/client-v2/components/DefaultField.d.ts +18 -0
  11. package/dist/client-v2/{storageTypes/index.d.ts → components/FileSizeField.d.ts} +2 -2
  12. package/dist/client-v2/components/MimetypeField.d.ts +10 -0
  13. package/dist/client-v2/components/NameField.d.ts +10 -0
  14. package/dist/client-v2/components/ParanoidField.d.ts +10 -0
  15. package/dist/client-v2/components/PathField.d.ts +18 -0
  16. package/dist/client-v2/components/RenameModeField.d.ts +10 -0
  17. package/dist/client-v2/components/TitleField.d.ts +10 -0
  18. package/dist/client-v2/components/index.d.ts +17 -0
  19. package/dist/client-v2/index.d.ts +5 -0
  20. package/dist/client-v2/index.js +1 -1
  21. package/dist/client-v2/plugin.d.ts +47 -6
  22. package/dist/client-v2/storage-forms/AliOssStorageForm.d.ts +10 -0
  23. package/dist/client-v2/storage-forms/LocalStorageForm.d.ts +10 -0
  24. package/dist/client-v2/storage-forms/S3StorageForm.d.ts +10 -0
  25. package/dist/client-v2/storage-forms/TxCosStorageForm.d.ts +10 -0
  26. package/dist/externalVersion.js +10 -13
  27. package/dist/node_modules/@aws-sdk/client-s3/package.json +1 -1
  28. package/dist/node_modules/@aws-sdk/lib-storage/package.json +1 -1
  29. package/dist/node_modules/ali-oss/package.json +1 -1
  30. package/dist/node_modules/cos-nodejs-sdk-v5/.github/workflows/auto-changelog.yml +55 -0
  31. package/dist/node_modules/cos-nodejs-sdk-v5/.prettierrc +10 -0
  32. package/dist/node_modules/cos-nodejs-sdk-v5/.travis.yml +16 -0
  33. package/dist/node_modules/cos-nodejs-sdk-v5/LICENSE +21 -0
  34. package/dist/node_modules/cos-nodejs-sdk-v5/demo/crc64.js +9 -0
  35. package/dist/node_modules/cos-nodejs-sdk-v5/demo/demo-sts-scope.js +75 -0
  36. package/dist/node_modules/cos-nodejs-sdk-v5/demo/demo-sts.js +65 -0
  37. package/dist/node_modules/cos-nodejs-sdk-v5/demo/demo.js +4542 -0
  38. package/dist/node_modules/cos-nodejs-sdk-v5/demo/util.js +135 -0
  39. package/dist/node_modules/cos-nodejs-sdk-v5/index.d.ts +2610 -0
  40. package/dist/node_modules/{multer-cos → cos-nodejs-sdk-v5}/index.js +2 -2
  41. package/dist/node_modules/cos-nodejs-sdk-v5/package.json +1 -0
  42. package/dist/node_modules/cos-nodejs-sdk-v5/sdk/advance.js +1659 -0
  43. package/dist/node_modules/cos-nodejs-sdk-v5/sdk/async.js +59 -0
  44. package/dist/node_modules/cos-nodejs-sdk-v5/sdk/base.js +4404 -0
  45. package/dist/node_modules/cos-nodejs-sdk-v5/sdk/cos.js +137 -0
  46. package/dist/node_modules/cos-nodejs-sdk-v5/sdk/event.js +34 -0
  47. package/dist/node_modules/cos-nodejs-sdk-v5/sdk/select-stream.js +181 -0
  48. package/dist/node_modules/cos-nodejs-sdk-v5/sdk/session.js +126 -0
  49. package/dist/node_modules/cos-nodejs-sdk-v5/sdk/task.js +255 -0
  50. package/dist/node_modules/cos-nodejs-sdk-v5/sdk/util.js +776 -0
  51. package/dist/node_modules/cos-nodejs-sdk-v5/test/csp.js +1302 -0
  52. package/dist/node_modules/cos-nodejs-sdk-v5/test/test.js +6119 -0
  53. package/dist/node_modules/mime-match/package.json +1 -1
  54. package/dist/node_modules/mime-types/package.json +1 -1
  55. package/dist/node_modules/mkdirp/package.json +1 -1
  56. package/dist/node_modules/url-join/package.json +1 -1
  57. package/dist/server/storages/tx-cos.d.ts +16 -1
  58. package/dist/server/storages/tx-cos.js +111 -10
  59. package/dist/shared/previewer/filePreviewTypes.d.ts +1 -0
  60. package/dist/shared/previewer/filePreviewTypes.js +21 -0
  61. package/package.json +2 -3
  62. package/dist/client-v2/855.e7d2e24a0b457a89.js +0 -10
  63. package/dist/client-v2/storageTypes/types.d.ts +0 -26
  64. package/dist/node_modules/multer-cos/LICENSE +0 -24
  65. package/dist/node_modules/multer-cos/demo/index.js +0 -39
  66. package/dist/node_modules/multer-cos/demo/myMulter.js +0 -88
  67. package/dist/node_modules/multer-cos/package.json +0 -1
@@ -0,0 +1,135 @@
1
+ var Async = require('../sdk/async');
2
+ var Batch = require('batch');
3
+ var fs = require('fs');
4
+ var os = require('os');
5
+
6
+ var platform = os.platform();
7
+ var createFile = function (filepath, size, callback) {
8
+ var cb = function (err) {
9
+ callback && callback(err);
10
+ };
11
+ if (fs.existsSync(filepath)) {
12
+ cb('file existed.');
13
+ } else {
14
+ var cmd;
15
+ switch (platform) {
16
+ case 'win32':
17
+ cmd = 'fsutil file createnew ' + filepath + ' ' + size;
18
+ break;
19
+ case 'darwin':
20
+ case 'linux':
21
+ cmd = 'dd if=/dev/zero of=' + filepath + ' count=1 bs=' + size;
22
+ break;
23
+ }
24
+ var exec = require('child_process').exec;
25
+ exec(cmd, function (err, stdout, stderr) {
26
+ cb(err);
27
+ });
28
+ }
29
+ };
30
+
31
+ var simpleListFolder = function(rootPath, callback) {
32
+ var result = [];
33
+ var deep = function(dirPath, deepNext) {
34
+ fs.readdir(dirPath, function (err, list) {
35
+ if (err) return console.error(err);
36
+ Async.eachLimit(list, 10, function (fileName, asyncNext) {
37
+ var filePath = pathLib.resolve(dirPath, fileName);
38
+ fs.stat(filePath, function (err, stats) {
39
+ if (stats.isDirectory()) {
40
+ result.push(filePath + pathLib.sep);
41
+ deep(filePath, asyncNext);
42
+ } else {
43
+ result.push(filePath);
44
+ asyncNext();
45
+ }
46
+ });
47
+ }, deepNext);
48
+ });
49
+ };
50
+ deep(rootPath, function (err) {
51
+ result.sort();
52
+ callback(err, result);
53
+ });
54
+ };
55
+
56
+ const fastListFolder = function(options, callback) {
57
+ const pathJoin = function(dir, name, isDir) {
58
+ dir = dir.replace(/\\/g, '/');
59
+ const sep = dir.endsWith('/') ? '' : '/';
60
+ let p = dir + sep + name;
61
+ p = p.replace(/\\/g, '/');
62
+ isDir && name && (p += '/');
63
+ return p;
64
+ };
65
+
66
+ const readdir = function stat(dir, cb) {
67
+ if (!dir || !cb) throw new Error('stat(dir, cb[, concurrency])');
68
+ fs.readdir(dir, function(err, files) {
69
+ if (err) return cb(err);
70
+ const batch = new Batch();
71
+ batch.concurrency(16);
72
+ files.forEach(function(file) {
73
+ const filePath = pathJoin(dir, file);
74
+ batch.push(function(done) {
75
+ fs.stat(filePath, done);
76
+ });
77
+ });
78
+ batch.end(function(err, stats) {
79
+ if (err) {
80
+ console.log('readdir error:', err);
81
+ cb(err);
82
+ return;
83
+ }
84
+ stats.forEach(function(stat, i) {
85
+ stat.isDir = stat.isDirectory();
86
+ stat.path = pathJoin(dir, files[i], stat.isDir);
87
+ stat.isDir && (stat.size = 0);
88
+ });
89
+ cb(err, stats);
90
+ });
91
+ });
92
+ };
93
+
94
+ const statFormat = function(stat) {
95
+ return {
96
+ path: stat.path,
97
+ size: stat.size,
98
+ isDir: stat.isDir
99
+ };
100
+ };
101
+
102
+ if (typeof options !== 'object') options = { path: options };
103
+ const rootPath = options.path;
104
+ let list = [];
105
+ const _callback = function(err) {
106
+ if (err) {
107
+ callback(err);
108
+ } else if (list.length > 1000000) {
109
+ callback(window.lang.t('error.too_much_files'));
110
+ } else {
111
+ callback(null, list);
112
+ }
113
+ };
114
+ const deep = function(dirStat, deepNext) {
115
+ list.push(statFormat(dirStat));
116
+ readdir(dirStat.path, function(err, files) {
117
+ if (err) return deepNext();
118
+ const dirList = files.filter(file => file.isDir);
119
+ const fileList = files.filter(file => !file.isDir);
120
+ list = [].concat(list, fileList.map(statFormat));
121
+ Async.eachLimit(dirList, 1, deep, deepNext);
122
+ });
123
+ };
124
+ fs.stat(rootPath, function(err, stat) {
125
+ if (err) return _callback();
126
+ stat.isDir = true;
127
+ stat.path = pathJoin(rootPath, '', true);
128
+ stat.isDir && (stat.size = 0);
129
+ deep(stat, _callback);
130
+ });
131
+ };
132
+
133
+ exports.simpleListFolder = simpleListFolder;
134
+ exports.fastListFolder = fastListFolder;
135
+ exports.createFile = createFile;