@nocobase/plugin-file-manager 0.7.6-alpha.2 → 0.7.7-alpha.1

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.
@@ -114,6 +114,38 @@ const schema = {
114
114
  }
115
115
  }
116
116
  },
117
+ 'tx-cos': {
118
+ properties: {
119
+ Region: {
120
+ title: '{{t("Region")}}',
121
+ type: 'string',
122
+ 'x-decorator': 'FormItem',
123
+ 'x-component': 'Input',
124
+ required: true
125
+ },
126
+ SecretId: {
127
+ title: '{{t("SecretId")}}',
128
+ type: 'string',
129
+ 'x-decorator': 'FormItem',
130
+ 'x-component': 'Input',
131
+ required: true
132
+ },
133
+ SecretKey: {
134
+ title: '{{t("SecretKey")}}',
135
+ type: 'string',
136
+ 'x-decorator': 'FormItem',
137
+ 'x-component': 'Password',
138
+ required: true
139
+ },
140
+ Bucket: {
141
+ title: '{{t("Bucket")}}',
142
+ type: 'string',
143
+ 'x-decorator': 'FormItem',
144
+ 'x-component': 'Input',
145
+ required: true
146
+ }
147
+ }
148
+ },
117
149
  s3: {
118
150
  properties: {
119
151
  region: {
@@ -70,6 +70,9 @@ const collection = {
70
70
  }, {
71
71
  label: '{{t("Amazon S3")}}',
72
72
  value: 's3'
73
+ }, {
74
+ label: '{{t("Tencent COS")}}',
75
+ value: 'tx-cos'
73
76
  }]
74
77
  }
75
78
  }, {
@@ -4,3 +4,4 @@ export declare const LIMIT_MAX_FILE_SIZE: number;
4
4
  export declare const STORAGE_TYPE_LOCAL = "local";
5
5
  export declare const STORAGE_TYPE_ALI_OSS = "ali-oss";
6
6
  export declare const STORAGE_TYPE_S3 = "s3";
7
+ export declare const STORAGE_TYPE_TX_COS = "tx-cos";
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.STORAGE_TYPE_S3 = exports.STORAGE_TYPE_LOCAL = exports.STORAGE_TYPE_ALI_OSS = exports.LIMIT_MAX_FILE_SIZE = exports.LIMIT_FILES = exports.FILE_FIELD_NAME = void 0;
6
+ exports.STORAGE_TYPE_TX_COS = exports.STORAGE_TYPE_S3 = exports.STORAGE_TYPE_LOCAL = exports.STORAGE_TYPE_ALI_OSS = exports.LIMIT_MAX_FILE_SIZE = exports.LIMIT_FILES = exports.FILE_FIELD_NAME = void 0;
7
7
  const FILE_FIELD_NAME = 'file';
8
8
  exports.FILE_FIELD_NAME = FILE_FIELD_NAME;
9
9
  const LIMIT_FILES = 1;
@@ -15,4 +15,6 @@ exports.STORAGE_TYPE_LOCAL = STORAGE_TYPE_LOCAL;
15
15
  const STORAGE_TYPE_ALI_OSS = 'ali-oss';
16
16
  exports.STORAGE_TYPE_ALI_OSS = STORAGE_TYPE_ALI_OSS;
17
17
  const STORAGE_TYPE_S3 = 's3';
18
- exports.STORAGE_TYPE_S3 = STORAGE_TYPE_S3;
18
+ exports.STORAGE_TYPE_S3 = STORAGE_TYPE_S3;
19
+ const STORAGE_TYPE_TX_COS = 'tx-cos';
20
+ exports.STORAGE_TYPE_TX_COS = STORAGE_TYPE_TX_COS;
@@ -11,6 +11,8 @@ var _aliOss = _interopRequireDefault(require("./ali-oss"));
11
11
 
12
12
  var _s = _interopRequireDefault(require("./s3"));
13
13
 
14
+ var _txCos = _interopRequireDefault(require("./tx-cos"));
15
+
14
16
  var _constants = require("../constants");
15
17
 
16
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -19,6 +21,7 @@ const map = new Map();
19
21
  map.set(_constants.STORAGE_TYPE_LOCAL, _local.default);
20
22
  map.set(_constants.STORAGE_TYPE_ALI_OSS, _aliOss.default);
21
23
  map.set(_constants.STORAGE_TYPE_S3, _s.default);
24
+ map.set(_constants.STORAGE_TYPE_TX_COS, _txCos.default);
22
25
 
23
26
  function getStorageConfig(key) {
24
27
  return map.get(key);
@@ -0,0 +1,17 @@
1
+ declare const _default: {
2
+ filenameKey: string;
3
+ make(storage: any): any;
4
+ defaults(): {
5
+ title: string;
6
+ type: string;
7
+ name: string;
8
+ baseUrl: string;
9
+ options: {
10
+ Region: string;
11
+ SecretId: string;
12
+ SecretKey: string;
13
+ Bucket: string;
14
+ };
15
+ };
16
+ };
17
+ export default _default;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _constants = require("../constants");
9
+
10
+ var _utils = require("../utils");
11
+
12
+ var _default = {
13
+ filenameKey: 'url',
14
+
15
+ make(storage) {
16
+ const createTxCosStorage = require('multer-cos');
17
+
18
+ return new createTxCosStorage({
19
+ cos: storage.options,
20
+ filename: (0, _utils.cloudFilenameGetter)(storage)
21
+ });
22
+ },
23
+
24
+ defaults() {
25
+ return {
26
+ title: '腾讯云对象存储',
27
+ type: _constants.STORAGE_TYPE_TX_COS,
28
+ name: 'tx-cos-1',
29
+ baseUrl: process.env.TX_COS_STORAGE_BASE_URL,
30
+ options: {
31
+ Region: process.env.TX_COS_REGION,
32
+ SecretId: process.env.TX_COS_SECRET_ID,
33
+ SecretKey: process.env.TX_COS_SECRET_KEY,
34
+ Bucket: process.env.TX_COS_BUCKET
35
+ }
36
+ };
37
+ }
38
+
39
+ };
40
+ exports.default = _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-file-manager",
3
- "version": "0.7.6-alpha.2",
3
+ "version": "0.7.7-alpha.1",
4
4
  "main": "lib/index.js",
5
5
  "license": "Apache-2.0",
6
6
  "licenses": [
@@ -11,22 +11,24 @@
11
11
  ],
12
12
  "dependencies": {
13
13
  "@koa/multer": "^3.0.0",
14
- "@nocobase/actions": "0.7.6-alpha.2",
15
- "@nocobase/client": "0.7.6-alpha.2",
16
- "@nocobase/database": "0.7.6-alpha.2",
17
- "@nocobase/server": "0.7.6-alpha.2",
14
+ "@nocobase/actions": "0.7.7-alpha.1",
15
+ "@nocobase/client": "0.7.7-alpha.1",
16
+ "@nocobase/database": "0.7.7-alpha.1",
17
+ "@nocobase/server": "0.7.7-alpha.1",
18
18
  "aws-sdk": "^2.2.32",
19
+ "cos-nodejs-sdk-v5": "^2.11.14",
19
20
  "koa-static": "^5.0.0",
20
21
  "mime-match": "^1.0.2",
21
22
  "mkdirp": "~0.5.4",
22
23
  "multer": "^1.4.2",
23
24
  "multer-aliyun-oss": "2.1.1",
25
+ "multer-cos": "^1.0.3",
24
26
  "multer-s3": "^2.10.0"
25
27
  },
26
28
  "devDependencies": {
27
- "@nocobase/test": "0.7.6-alpha.2",
29
+ "@nocobase/test": "0.7.7-alpha.1",
28
30
  "@types/koa-multer": "^1.0.1",
29
31
  "@types/multer": "^1.4.5"
30
32
  },
31
- "gitHead": "2cfccff9d3ff14c521bf317fa7ee4efa18444c92"
33
+ "gitHead": "f82374e6f9daaf71ba63eaf156468ea7ddc042da"
32
34
  }