@nocobase/plugin-file-manager 0.13.0-alpha.4 → 0.13.0-alpha.6
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/client/index.js +1 -975
- package/dist/index.js +37 -16
- package/dist/locale/en-US.js +22 -4
- package/dist/locale/fr-FR.js +22 -4
- package/dist/locale/ja-JP.js +22 -4
- package/dist/locale/ru-RU.js +22 -4
- package/dist/locale/tr-TR.js +22 -4
- package/dist/locale/zh-CN.js +22 -4
- package/dist/node_modules/@aws-sdk/client-s3/dist-cjs/index.js +3 -3
- package/dist/node_modules/@aws-sdk/client-s3/package.json +1 -1
- package/dist/node_modules/mime-match/index.js +1 -1
- package/dist/node_modules/mime-match/package.json +1 -1
- package/dist/node_modules/mkdirp/index.js +1 -1
- package/dist/node_modules/mkdirp/package.json +1 -1
- package/dist/node_modules/multer-aliyun-oss/index.js +22 -22
- package/dist/node_modules/multer-aliyun-oss/package.json +1 -1
- package/dist/node_modules/multer-cos/index.js +15 -15
- package/dist/node_modules/multer-cos/package.json +1 -1
- package/dist/node_modules/multer-s3/index.js +5 -5
- package/dist/node_modules/multer-s3/package.json +1 -1
- package/dist/server/actions/attachments.js +54 -45
- package/dist/server/actions/index.js +37 -14
- package/dist/server/collections/attachments.js +22 -4
- package/dist/server/collections/storages.js +22 -4
- package/dist/server/constants.js +38 -10
- package/dist/server/index.js +37 -21
- package/dist/server/migrations/20230831160742-fix-attachment-field.d.ts +4 -0
- package/dist/server/migrations/20230831160742-fix-attachment-field.js +60 -0
- package/dist/server/rules/index.js +36 -13
- package/dist/server/rules/mimetype.js +34 -11
- package/dist/server/server.js +53 -24
- package/dist/server/storages/ali-oss.js +26 -9
- package/dist/server/storages/index.js +48 -26
- package/dist/server/storages/local.js +45 -25
- package/dist/server/storages/s3.js +26 -9
- package/dist/server/storages/tx-cos.js +28 -11
- package/dist/server/utils.js +42 -15
- package/dist/swagger/index.json +81 -0
- package/package.json +2 -2
- package/dist/swagger/index.js +0 -95
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"multer-s3","version":"3.0.1","description":"Streaming multer storage engine for AWS S3","main":"index.js","scripts":{"test":"standard && mocha test/basic.js"},"engines":{"node":">= 12.0.0"},"repository":{"type":"git","url":"git+https://github.com/badunk/multer-s3.git"},"keywords":["multer","s3","amazon","aws"],"author":"badunk","license":"MIT","bugs":{"url":"https://github.com/badunk/multer-s3/issues"},"homepage":"https://github.com/badunk/multer-s3#readme","dependencies":{"@aws-sdk/lib-storage":"^3.46.0","file-type":"^3.3.0","html-comment-regex":"^1.1.2","run-parallel":"^1.1.6"},"peerDependencies":{"@aws-sdk/client-s3":"^3.0.0"},"devDependencies":{"express":"^4.13.1","form-data":"^1.0.0-rc3","mocha":"^2.2.5","multer":"^1.1.0","on-finished":"^2.3.0","standard":"^5.4.1","xtend":"^4.0.1"},"_lastModified":"2023-
|
|
1
|
+
{"name":"multer-s3","version":"3.0.1","description":"Streaming multer storage engine for AWS S3","main":"index.js","scripts":{"test":"standard && mocha test/basic.js"},"engines":{"node":">= 12.0.0"},"repository":{"type":"git","url":"git+https://github.com/badunk/multer-s3.git"},"keywords":["multer","s3","amazon","aws"],"author":"badunk","license":"MIT","bugs":{"url":"https://github.com/badunk/multer-s3/issues"},"homepage":"https://github.com/badunk/multer-s3#readme","dependencies":{"@aws-sdk/lib-storage":"^3.46.0","file-type":"^3.3.0","html-comment-regex":"^1.1.2","run-parallel":"^1.1.6"},"peerDependencies":{"@aws-sdk/client-s3":"^3.0.0"},"devDependencies":{"express":"^4.13.1","form-data":"^1.0.0-rc3","mocha":"^2.2.5","multer":"^1.1.0","on-finished":"^2.3.0","standard":"^5.4.1","xtend":"^4.0.1"},"_lastModified":"2023-09-04T12:59:51.890Z"}
|
|
@@ -1,51 +1,58 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
if (
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
if (k !== 'default') {
|
|
17
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
18
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function () { return e[k]; }
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
});
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
24
16
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var attachments_exports = {};
|
|
29
|
+
__export(attachments_exports, {
|
|
30
|
+
createMiddleware: () => createMiddleware,
|
|
31
|
+
destroyMiddleware: () => destroyMiddleware
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(attachments_exports);
|
|
34
|
+
var import_utils = require("@nocobase/utils");
|
|
35
|
+
var import_path = __toESM(require("path"));
|
|
36
|
+
var import_constants = require("../constants");
|
|
37
|
+
var Rules = __toESM(require("../rules"));
|
|
38
|
+
var import_storages = require("../storages");
|
|
32
39
|
function getFileFilter(storage) {
|
|
33
40
|
return (req, file, cb) => {
|
|
34
41
|
const { size, ...rules } = storage.rules;
|
|
35
42
|
const ruleKeys = Object.keys(rules);
|
|
36
|
-
const result = !ruleKeys.length || !ruleKeys.some((key) => typeof
|
|
43
|
+
const result = !ruleKeys.length || !ruleKeys.some((key) => typeof Rules[key] !== "function" || !Rules[key](file, rules[key]));
|
|
37
44
|
cb(null, result);
|
|
38
45
|
};
|
|
39
46
|
}
|
|
40
47
|
function getFileData(ctx) {
|
|
41
|
-
const { [
|
|
48
|
+
const { [import_constants.FILE_FIELD_NAME]: file, storage } = ctx;
|
|
42
49
|
if (!file) {
|
|
43
50
|
return ctx.throw(400, "file validation failed");
|
|
44
51
|
}
|
|
45
|
-
const storageConfig =
|
|
52
|
+
const storageConfig = (0, import_storages.getStorageConfig)(storage.type);
|
|
46
53
|
const { [storageConfig.filenameKey || "filename"]: name } = file;
|
|
47
|
-
const filename =
|
|
48
|
-
const extname =
|
|
54
|
+
const filename = import_path.default.basename(name);
|
|
55
|
+
const extname = import_path.default.extname(filename);
|
|
49
56
|
const urlPath = storage.path ? storage.path.replace(/^([^/])/, "/$1") : "";
|
|
50
57
|
return {
|
|
51
58
|
title: Buffer.from(file.originalname, "latin1").toString("utf8").replace(extname, ""),
|
|
@@ -69,7 +76,7 @@ async function multipart(ctx, next) {
|
|
|
69
76
|
ctx.logger.error("[file-manager] no linked or default storage provided");
|
|
70
77
|
return ctx.throw(500);
|
|
71
78
|
}
|
|
72
|
-
const storageConfig =
|
|
79
|
+
const storageConfig = (0, import_storages.getStorageConfig)(storage.type);
|
|
73
80
|
if (!storageConfig) {
|
|
74
81
|
ctx.logger.error(`[file-manager] storage type "${storage.type}" is not defined`);
|
|
75
82
|
return ctx.throw(500);
|
|
@@ -77,13 +84,13 @@ async function multipart(ctx, next) {
|
|
|
77
84
|
const multerOptions = {
|
|
78
85
|
fileFilter: getFileFilter(storage),
|
|
79
86
|
limits: {
|
|
80
|
-
fileSize: storage.rules.size ??
|
|
87
|
+
fileSize: storage.rules.size ?? import_constants.DEFAULT_MAX_FILE_SIZE,
|
|
81
88
|
// 每次只允许提交一个文件
|
|
82
|
-
files:
|
|
89
|
+
files: import_constants.LIMIT_FILES
|
|
83
90
|
},
|
|
84
91
|
storage: storageConfig.make(storage)
|
|
85
92
|
};
|
|
86
|
-
const upload =
|
|
93
|
+
const upload = (0, import_utils.koaMulter)(multerOptions).single(import_constants.FILE_FIELD_NAME);
|
|
87
94
|
try {
|
|
88
95
|
await upload(ctx, () => {
|
|
89
96
|
});
|
|
@@ -136,7 +143,7 @@ async function destroyMiddleware(ctx, next) {
|
|
|
136
143
|
result[storageId].push(record);
|
|
137
144
|
return result;
|
|
138
145
|
}, {});
|
|
139
|
-
const storages
|
|
146
|
+
const storages = await ctx.db.getRepository("storages").find({
|
|
140
147
|
filter: {
|
|
141
148
|
id: [...storageIds],
|
|
142
149
|
paranoid: {
|
|
@@ -146,9 +153,9 @@ async function destroyMiddleware(ctx, next) {
|
|
|
146
153
|
});
|
|
147
154
|
let count = 0;
|
|
148
155
|
const undeleted = [];
|
|
149
|
-
await storages
|
|
156
|
+
await storages.reduce(
|
|
150
157
|
(promise, storage) => promise.then(async () => {
|
|
151
|
-
const storageConfig =
|
|
158
|
+
const storageConfig = (0, import_storages.getStorageConfig)(storage.type);
|
|
152
159
|
const result = await storageConfig.delete(storage, storageGroupedRecords[storage.id]);
|
|
153
160
|
count += result[0];
|
|
154
161
|
undeleted.push(...result[1]);
|
|
@@ -168,6 +175,8 @@ async function destroyMiddleware(ctx, next) {
|
|
|
168
175
|
}
|
|
169
176
|
await next();
|
|
170
177
|
}
|
|
171
|
-
|
|
172
|
-
exports
|
|
173
|
-
|
|
178
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
179
|
+
0 && (module.exports = {
|
|
180
|
+
createMiddleware,
|
|
181
|
+
destroyMiddleware
|
|
182
|
+
});
|
|
@@ -1,16 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var
|
|
9
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var actions_exports = {};
|
|
29
|
+
__export(actions_exports, {
|
|
30
|
+
default: () => actions_default
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(actions_exports);
|
|
33
|
+
var import_actions = __toESM(require("@nocobase/actions"));
|
|
34
|
+
var import_attachments = require("./attachments");
|
|
10
35
|
function actions_default({ app }) {
|
|
11
|
-
app.resourcer.use(
|
|
12
|
-
app.resourcer.registerActionHandler("upload",
|
|
13
|
-
app.resourcer.use(
|
|
36
|
+
app.resourcer.use(import_attachments.createMiddleware);
|
|
37
|
+
app.resourcer.registerActionHandler("upload", import_actions.default.create);
|
|
38
|
+
app.resourcer.use(import_attachments.destroyMiddleware);
|
|
14
39
|
}
|
|
15
|
-
|
|
16
|
-
module.exports = actions_default;
|
|
@@ -1,5 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var attachments_exports = {};
|
|
19
|
+
__export(attachments_exports, {
|
|
20
|
+
default: () => attachments_default
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(attachments_exports);
|
|
3
23
|
var attachments_default = {
|
|
4
24
|
namespace: "file-manager.attachmentRecords",
|
|
5
25
|
duplicator: "optional",
|
|
@@ -63,5 +83,3 @@ var attachments_default = {
|
|
|
63
83
|
}
|
|
64
84
|
]
|
|
65
85
|
};
|
|
66
|
-
|
|
67
|
-
module.exports = attachments_default;
|
|
@@ -1,5 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var storages_exports = {};
|
|
19
|
+
__export(storages_exports, {
|
|
20
|
+
default: () => storages_default
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(storages_exports);
|
|
3
23
|
var storages_default = {
|
|
4
24
|
namespace: "file-manager.storageSetting",
|
|
5
25
|
duplicator: "optional",
|
|
@@ -63,5 +83,3 @@ var storages_default = {
|
|
|
63
83
|
}
|
|
64
84
|
]
|
|
65
85
|
};
|
|
66
|
-
|
|
67
|
-
module.exports = storages_default;
|
package/dist/server/constants.js
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var constants_exports = {};
|
|
19
|
+
__export(constants_exports, {
|
|
20
|
+
DEFAULT_MAX_FILE_SIZE: () => DEFAULT_MAX_FILE_SIZE,
|
|
21
|
+
FILE_FIELD_NAME: () => FILE_FIELD_NAME,
|
|
22
|
+
LIMIT_FILES: () => LIMIT_FILES,
|
|
23
|
+
STORAGE_TYPE_ALI_OSS: () => STORAGE_TYPE_ALI_OSS,
|
|
24
|
+
STORAGE_TYPE_LOCAL: () => STORAGE_TYPE_LOCAL,
|
|
25
|
+
STORAGE_TYPE_S3: () => STORAGE_TYPE_S3,
|
|
26
|
+
STORAGE_TYPE_TX_COS: () => STORAGE_TYPE_TX_COS
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(constants_exports);
|
|
3
29
|
const FILE_FIELD_NAME = "file";
|
|
4
30
|
const LIMIT_FILES = 1;
|
|
5
31
|
const DEFAULT_MAX_FILE_SIZE = 1024 * 1024 * 1024;
|
|
@@ -7,11 +33,13 @@ const STORAGE_TYPE_LOCAL = "local";
|
|
|
7
33
|
const STORAGE_TYPE_ALI_OSS = "ali-oss";
|
|
8
34
|
const STORAGE_TYPE_S3 = "s3";
|
|
9
35
|
const STORAGE_TYPE_TX_COS = "tx-cos";
|
|
10
|
-
|
|
11
|
-
exports
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
36
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
DEFAULT_MAX_FILE_SIZE,
|
|
39
|
+
FILE_FIELD_NAME,
|
|
40
|
+
LIMIT_FILES,
|
|
41
|
+
STORAGE_TYPE_ALI_OSS,
|
|
42
|
+
STORAGE_TYPE_LOCAL,
|
|
43
|
+
STORAGE_TYPE_S3,
|
|
44
|
+
STORAGE_TYPE_TX_COS
|
|
45
|
+
});
|
package/dist/server/index.js
CHANGED
|
@@ -1,23 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var server_exports = {};
|
|
30
|
+
__export(server_exports, {
|
|
31
|
+
default: () => import_server.default
|
|
17
32
|
});
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
33
|
+
module.exports = __toCommonJS(server_exports);
|
|
34
|
+
__reExport(server_exports, require("./constants"), module.exports);
|
|
35
|
+
var import_server = __toESM(require("./server"));
|
|
36
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
...require("./constants")
|
|
23
39
|
});
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var fix_attachment_field_exports = {};
|
|
19
|
+
__export(fix_attachment_field_exports, {
|
|
20
|
+
default: () => fix_attachment_field_default
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(fix_attachment_field_exports);
|
|
23
|
+
var import_server = require("@nocobase/server");
|
|
24
|
+
var import_database = require("@nocobase/database");
|
|
25
|
+
class fix_attachment_field_default extends import_server.Migration {
|
|
26
|
+
async up() {
|
|
27
|
+
const result = await this.app.version.satisfies("<0.13.0-alpha.5");
|
|
28
|
+
if (!result) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const r = this.db.getRepository("uiSchemas");
|
|
32
|
+
const items = await r.find({
|
|
33
|
+
filter: {
|
|
34
|
+
"schema.x-component": "CollectionField",
|
|
35
|
+
"schema.x-component-props.action": {
|
|
36
|
+
[import_database.Op.like]: "%:create?attachementField%"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
console.log(items == null ? void 0 : items.length);
|
|
41
|
+
await this.db.sequelize.transaction(async (transaction) => {
|
|
42
|
+
for (const item of items) {
|
|
43
|
+
const schema = item.schema;
|
|
44
|
+
if (!schema["x-collection-field"]) {
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
const field = this.db.getFieldByPath(schema["x-collection-field"]);
|
|
48
|
+
if (!field) {
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
schema["x-component-props"].action = schema["x-component-props"].action.replace(
|
|
52
|
+
"attachementField",
|
|
53
|
+
"attachmentField"
|
|
54
|
+
);
|
|
55
|
+
item.set("schema", schema);
|
|
56
|
+
await item.save({ transaction });
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -1,14 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var rules_exports = {};
|
|
29
|
+
__export(rules_exports, {
|
|
30
|
+
mimetype: () => import_mimetype.default
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(rules_exports);
|
|
33
|
+
var import_mimetype = __toESM(require("./mimetype"));
|
|
34
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
35
|
+
0 && (module.exports = {
|
|
36
|
+
mimetype
|
|
14
37
|
});
|
|
@@ -1,13 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var mimetype_exports = {};
|
|
29
|
+
__export(mimetype_exports, {
|
|
30
|
+
default: () => mimetype_default
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(mimetype_exports);
|
|
33
|
+
var import_mime_match = __toESM(require("mime-match"));
|
|
9
34
|
function mimetype_default(file, options = "*") {
|
|
10
|
-
return options.toString().split(",").some(
|
|
35
|
+
return options.toString().split(",").some((0, import_mime_match.default)(file.mimetype));
|
|
11
36
|
}
|
|
12
|
-
|
|
13
|
-
module.exports = mimetype_default;
|