@nocobase/plugin-file-manager 2.4.0-alpha.2 → 2.4.0-alpha.20
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/README.md +4 -4
- package/build.config.ts +6 -0
- package/dist/client/index.js +1 -1
- package/dist/client/pdfjs/pdf.min.mjs +4 -4
- package/dist/client/pdfjs/pdf.worker.min.mjs +4 -4
- package/dist/client/pdfjs/standard_fonts/LICENSE_LIBERATION +362 -101
- package/dist/client/pdfjs/wasm/LICENSE_OPENJPEG +39 -0
- package/dist/client/pdfjs/wasm/LICENSE_PDFJS_OPENJPEG +22 -0
- package/dist/client/pdfjs/wasm/openjpeg_nowasm_fallback.js +26 -0
- package/dist/client-v2/125.a8dd12309b00dcab.js +10 -0
- package/dist/client-v2/index.d.ts +1 -1
- package/dist/client-v2/index.js +1 -1
- package/dist/client-v2/previewer/filePreviewTypes.d.ts +1 -1
- package/dist/externalVersion.js +13 -13
- package/dist/node_modules/@aws-sdk/client-s3/dist-cjs/index.js +672 -730
- package/dist/node_modules/@aws-sdk/client-s3/package.json +1 -1
- package/dist/node_modules/@aws-sdk/lib-storage/dist-cjs/index.js +675 -733
- package/dist/node_modules/@aws-sdk/lib-storage/package.json +1 -1
- package/dist/node_modules/@aws-sdk/s3-request-presigner/package.json +1 -1
- package/dist/node_modules/ali-oss/lib/client.js +14 -14
- package/dist/node_modules/ali-oss/package.json +1 -1
- package/dist/node_modules/cos-nodejs-sdk-v5/index.js +7 -7
- package/dist/node_modules/cos-nodejs-sdk-v5/package.json +1 -1
- package/dist/node_modules/mime-match/package.json +1 -1
- package/dist/node_modules/mime-types/package.json +1 -1
- package/dist/node_modules/mkdirp/package.json +1 -1
- package/dist/node_modules/url-join/package.json +1 -1
- package/dist/server/actions/attachments.js +1 -1
- package/dist/server/actions/get-file.js +1 -0
- package/dist/server/actions/index.js +2 -0
- package/dist/server/actions/project-storage-associations.d.ts +10 -0
- package/dist/server/actions/project-storage-associations.js +126 -0
- package/dist/server/commands/repair-filenames.d.ts +1 -1
- package/dist/server/commands/repair-filenames.js +5 -0
- package/package.json +4 -4
- package/dist/client-v2/125.9cdb7cf3ef4712ef.js +0 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"cos-nodejs-sdk-v5","version":"2.12.6","description":"cos nodejs sdk v5","main":"index.js","types":"index.d.ts","scripts":{"prettier":"prettier --write sdk demo/demo.js test/test.js index.d.ts","demo":"node demo/demo.js","demo-sts":"node demo/demo-sts.js","demo-sts-scope":"node demo/demo-sts-scope.js","test":"mocha test/test.js","cov":"istanbul cover _mocha -- -u exports 'test/test.js'","nyc":"nyc --reporter=clover --reporter=cobertura mocha --reporter xunit --reporter-options output=mocha.xml test/test.js","csp":"mocha test/csp.js"},"repository":{"type":"git","url":"git+https://github.com/tencentyun/cos-nodejs-sdk-v5.git"},"keywords":["tencent","tencent cloud","qcloud","cos","cos-sdk"],"author":"carsonxu","license":"ISC","bugs":{"url":"https://github.com/tencentyun/cos-nodejs-sdk-v5/issues"},"homepage":"https://github.com/tencentyun/cos-nodejs-sdk-v5#readme","dependencies":{"conf":"^9.0.0","fast-xml-parser":"4.2.5","mime-types":"^2.1.24","request":"^2.88.2"},"devDependencies":{"@types/node":"^14.14.20","batch":"^0.6.1","crc64-ecma182.js":"^1.0.0","mocha":"^4.0.1","nyc":"^15.1.0","prettier":"^3.0.1","qcloud-cos-sts":"^3.0.0"},"engines":{"node":">= 6"},"_lastModified":"2026-
|
|
1
|
+
{"name":"cos-nodejs-sdk-v5","version":"2.12.6","description":"cos nodejs sdk v5","main":"index.js","types":"index.d.ts","scripts":{"prettier":"prettier --write sdk demo/demo.js test/test.js index.d.ts","demo":"node demo/demo.js","demo-sts":"node demo/demo-sts.js","demo-sts-scope":"node demo/demo-sts-scope.js","test":"mocha test/test.js","cov":"istanbul cover _mocha -- -u exports 'test/test.js'","nyc":"nyc --reporter=clover --reporter=cobertura mocha --reporter xunit --reporter-options output=mocha.xml test/test.js","csp":"mocha test/csp.js"},"repository":{"type":"git","url":"git+https://github.com/tencentyun/cos-nodejs-sdk-v5.git"},"keywords":["tencent","tencent cloud","qcloud","cos","cos-sdk"],"author":"carsonxu","license":"ISC","bugs":{"url":"https://github.com/tencentyun/cos-nodejs-sdk-v5/issues"},"homepage":"https://github.com/tencentyun/cos-nodejs-sdk-v5#readme","dependencies":{"conf":"^9.0.0","fast-xml-parser":"4.2.5","mime-types":"^2.1.24","request":"^2.88.2"},"devDependencies":{"@types/node":"^14.14.20","batch":"^0.6.1","crc64-ecma182.js":"^1.0.0","mocha":"^4.0.1","nyc":"^15.1.0","prettier":"^3.0.1","qcloud-cos-sts":"^3.0.0"},"engines":{"node":">= 6"},"_lastModified":"2026-11-25T07:21:08.410Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"mime-match","version":"1.0.2","description":"A simple function to check whether a mimetype matches the specified mimetype (with wildcard support)","main":"index.js","scripts":{"test":"node test.js","gendocs":"gendocs > README.md"},"repository":{"type":"git","url":"https://github.com/DamonOehlman/mime-match.git"},"keywords":["mime","wildcard"],"author":"Damon Oehlman <damon.oehlman@gmail.com>","license":"ISC","bugs":{"url":"https://github.com/DamonOehlman/mime-match/issues"},"homepage":"https://github.com/DamonOehlman/mime-match","dependencies":{"wildcard":"^1.1.0"},"devDependencies":{"tape":"^4.5.1"},"_lastModified":"2026-
|
|
1
|
+
{"name":"mime-match","version":"1.0.2","description":"A simple function to check whether a mimetype matches the specified mimetype (with wildcard support)","main":"index.js","scripts":{"test":"node test.js","gendocs":"gendocs > README.md"},"repository":{"type":"git","url":"https://github.com/DamonOehlman/mime-match.git"},"keywords":["mime","wildcard"],"author":"Damon Oehlman <damon.oehlman@gmail.com>","license":"ISC","bugs":{"url":"https://github.com/DamonOehlman/mime-match/issues"},"homepage":"https://github.com/DamonOehlman/mime-match","dependencies":{"wildcard":"^1.1.0"},"devDependencies":{"tape":"^4.5.1"},"_lastModified":"2026-11-25T07:20:56.833Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"mime-types","description":"The ultimate javascript content-type utility.","version":"3.0.1","contributors":["Douglas Christopher Wilson <doug@somethingdoug.com>","Jeremiah Senkpiel <fishrock123@rocketmail.com> (https://searchbeam.jit.su)","Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)"],"license":"MIT","keywords":["mime","types"],"repository":"jshttp/mime-types","dependencies":{"mime-db":"^1.54.0"},"devDependencies":{"eslint":"8.33.0","eslint-config-standard":"14.1.1","eslint-plugin-import":"2.27.5","eslint-plugin-markdown":"3.0.0","eslint-plugin-node":"11.1.0","eslint-plugin-promise":"6.1.1","eslint-plugin-standard":"4.1.0","mocha":"10.2.0","nyc":"15.1.0"},"files":["HISTORY.md","LICENSE","index.js","mimeScore.js"],"engines":{"node":">= 0.6"},"scripts":{"lint":"eslint .","test":"mocha --reporter spec test/test.js","test-ci":"nyc --reporter=lcov --reporter=text npm test","test-cov":"nyc --reporter=html --reporter=text npm test"},"_lastModified":"2026-
|
|
1
|
+
{"name":"mime-types","description":"The ultimate javascript content-type utility.","version":"3.0.1","contributors":["Douglas Christopher Wilson <doug@somethingdoug.com>","Jeremiah Senkpiel <fishrock123@rocketmail.com> (https://searchbeam.jit.su)","Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)"],"license":"MIT","keywords":["mime","types"],"repository":"jshttp/mime-types","dependencies":{"mime-db":"^1.54.0"},"devDependencies":{"eslint":"8.33.0","eslint-config-standard":"14.1.1","eslint-plugin-import":"2.27.5","eslint-plugin-markdown":"3.0.0","eslint-plugin-node":"11.1.0","eslint-plugin-promise":"6.1.1","eslint-plugin-standard":"4.1.0","mocha":"10.2.0","nyc":"15.1.0"},"files":["HISTORY.md","LICENSE","index.js","mimeScore.js"],"engines":{"node":">= 0.6"},"scripts":{"lint":"eslint .","test":"mocha --reporter spec test/test.js","test-ci":"nyc --reporter=lcov --reporter=text npm test","test-cov":"nyc --reporter=html --reporter=text npm test"},"_lastModified":"2026-11-25T07:20:57.146Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"mkdirp","description":"Recursively mkdir, like `mkdir -p`","version":"0.5.6","publishConfig":{"tag":"legacy"},"author":"James Halliday <mail@substack.net> (http://substack.net)","main":"index.js","keywords":["mkdir","directory"],"repository":{"type":"git","url":"https://github.com/substack/node-mkdirp.git"},"scripts":{"test":"tap test/*.js"},"dependencies":{"minimist":"^1.2.6"},"devDependencies":{"tap":"^16.0.1"},"bin":"bin/cmd.js","license":"MIT","files":["bin","index.js"],"_lastModified":"2026-
|
|
1
|
+
{"name":"mkdirp","description":"Recursively mkdir, like `mkdir -p`","version":"0.5.6","publishConfig":{"tag":"legacy"},"author":"James Halliday <mail@substack.net> (http://substack.net)","main":"index.js","keywords":["mkdir","directory"],"repository":{"type":"git","url":"https://github.com/substack/node-mkdirp.git"},"scripts":{"test":"tap test/*.js"},"dependencies":{"minimist":"^1.2.6"},"devDependencies":{"tap":"^16.0.1"},"bin":"bin/cmd.js","license":"MIT","files":["bin","index.js"],"_lastModified":"2026-11-25T07:21:02.028Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"url-join","version":"4.0.1","description":"Join urls and normalize as in path.join.","main":"lib/url-join.js","scripts":{"test":"mocha --require should"},"repository":{"type":"git","url":"git://github.com/jfromaniello/url-join.git"},"keywords":["url","join"],"author":"José F. Romaniello <jfromaniello@gmail.com> (http://joseoncode.com)","license":"MIT","devDependencies":{"conventional-changelog":"^1.1.10","mocha":"^3.2.0","should":"~1.2.1"},"_lastModified":"2026-
|
|
1
|
+
{"name":"url-join","version":"4.0.1","description":"Join urls and normalize as in path.join.","main":"lib/url-join.js","scripts":{"test":"mocha --require should"},"repository":{"type":"git","url":"git://github.com/jfromaniello/url-join.git"},"keywords":["url","join"],"author":"José F. Romaniello <jfromaniello@gmail.com> (http://joseoncode.com)","license":"MIT","devDependencies":{"conventional-changelog":"^1.1.10","mocha":"^3.2.0","should":"~1.2.1"},"_lastModified":"2026-11-25T07:20:56.938Z"}
|
|
@@ -217,7 +217,7 @@ async function createMiddleware(ctx, next) {
|
|
|
217
217
|
if (((_a = collection == null ? void 0 : collection.options) == null ? void 0 : _a.template) !== "file" || !["upload", "create", "update"].includes(actionName)) {
|
|
218
218
|
return next();
|
|
219
219
|
}
|
|
220
|
-
const storageName =
|
|
220
|
+
const storageName = ((_c = (_b = ctx.db.getFieldByPath(attachmentField)) == null ? void 0 : _b.options) == null ? void 0 : _c.storage) || collection.options.storage;
|
|
221
221
|
const plugin = ctx.app.pm.get(import__.default);
|
|
222
222
|
const storage = Array.from(plugin.storagesCache.values()).find(
|
|
223
223
|
(storage2) => storageName ? storage2.name === storageName : storage2.default
|
|
@@ -129,6 +129,7 @@ async function getFile(ctx, next) {
|
|
|
129
129
|
download
|
|
130
130
|
})) || await plugin.getFileURL(file, preview, { download });
|
|
131
131
|
const finalUrl = preserveSubAppInLocalURL(storageUrl, (_l = ctx.state.fileAccess) == null ? void 0 : _l.appName);
|
|
132
|
+
ctx.set("Cache-Control", "private, no-store");
|
|
132
133
|
ctx.status = 302;
|
|
133
134
|
ctx.redirect(finalUrl);
|
|
134
135
|
await next();
|
|
@@ -41,12 +41,14 @@ __export(actions_exports, {
|
|
|
41
41
|
module.exports = __toCommonJS(actions_exports);
|
|
42
42
|
var import_actions = __toESM(require("@nocobase/actions"));
|
|
43
43
|
var import_attachments = require("./attachments");
|
|
44
|
+
var import_project_storage_associations = require("./project-storage-associations");
|
|
44
45
|
var import_get_file = require("./get-file");
|
|
45
46
|
var import_storage_validation = require("./storage-validation");
|
|
46
47
|
var storageActions = __toESM(require("./storages"));
|
|
47
48
|
var import_temporary_access = require("../temporary-access");
|
|
48
49
|
function actions_default(plugin) {
|
|
49
50
|
const { app } = plugin;
|
|
51
|
+
app.dataSourceManager.use(import_project_storage_associations.projectStorageAssociations);
|
|
50
52
|
app.dataSourceManager.afterAddDataSource((dataSource) => {
|
|
51
53
|
(0, import_get_file.registerGetFileAccess)(dataSource);
|
|
52
54
|
(0, import_temporary_access.registerTemporaryFileAccess)(dataSource);
|
|
@@ -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 type { Context, Next } from '@nocobase/actions';
|
|
10
|
+
export declare function projectStorageAssociations(ctx: Context, next: Next): Promise<void>;
|
|
@@ -0,0 +1,126 @@
|
|
|
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
|
+
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
var project_storage_associations_exports = {};
|
|
28
|
+
__export(project_storage_associations_exports, {
|
|
29
|
+
projectStorageAssociations: () => projectStorageAssociations
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(project_storage_associations_exports);
|
|
32
|
+
var import_database = require("@nocobase/database");
|
|
33
|
+
var import_lodash = require("lodash");
|
|
34
|
+
const publicStorageFields = [
|
|
35
|
+
"id",
|
|
36
|
+
"title",
|
|
37
|
+
"name",
|
|
38
|
+
"type",
|
|
39
|
+
"rules",
|
|
40
|
+
"path",
|
|
41
|
+
"baseUrl",
|
|
42
|
+
"renameMode",
|
|
43
|
+
"default",
|
|
44
|
+
"paranoid",
|
|
45
|
+
"createdAt",
|
|
46
|
+
"updatedAt"
|
|
47
|
+
];
|
|
48
|
+
function isRecord(value) {
|
|
49
|
+
return (0, import_lodash.isPlainObject)(value);
|
|
50
|
+
}
|
|
51
|
+
function projectArray(records, project) {
|
|
52
|
+
let result = records;
|
|
53
|
+
records.forEach((record, index) => {
|
|
54
|
+
const projected = project(record);
|
|
55
|
+
if (projected !== record) {
|
|
56
|
+
if (result === records) result = records.slice();
|
|
57
|
+
result[index] = projected;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
return result;
|
|
61
|
+
}
|
|
62
|
+
function projectAssociations(value, collection, storages, isAssociation) {
|
|
63
|
+
if (Array.isArray(value)) {
|
|
64
|
+
return projectArray(value, (record) => projectAssociations(record, collection, storages, isAssociation));
|
|
65
|
+
}
|
|
66
|
+
if (!isRecord(value)) {
|
|
67
|
+
return value;
|
|
68
|
+
}
|
|
69
|
+
if (isAssociation && collection === storages) {
|
|
70
|
+
return (0, import_lodash.pick)(value, publicStorageFields);
|
|
71
|
+
}
|
|
72
|
+
let result = value;
|
|
73
|
+
for (const [name, association] of Object.entries(collection.model.associations)) {
|
|
74
|
+
if (Object.prototype.hasOwnProperty.call(value, name)) {
|
|
75
|
+
const target = collection.db.getCollectionByModelName(association.target.name);
|
|
76
|
+
if (target) {
|
|
77
|
+
const projected = projectAssociations(value[name], target, storages, true);
|
|
78
|
+
if (projected !== value[name]) {
|
|
79
|
+
if (result === value) result = { ...value };
|
|
80
|
+
result[name] = projected;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return result;
|
|
86
|
+
}
|
|
87
|
+
async function projectStorageAssociations(ctx, next) {
|
|
88
|
+
await next();
|
|
89
|
+
const { actionName, resourceName } = ctx.action;
|
|
90
|
+
if (!["get", "list"].includes(actionName) || ctx.status !== 200 || !ctx.body) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
if (ctx.database !== ctx.db || !ctx.db.collections.has(resourceName.split(".")[0])) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
const collection = ctx.db.getCollection(resourceName);
|
|
97
|
+
const storages = ctx.db.getCollection("storages");
|
|
98
|
+
if (!collection || !storages) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
const relatedStorage = collection === storages && resourceName !== storages.name;
|
|
102
|
+
function projectRecord(record) {
|
|
103
|
+
if (!(record instanceof import_database.Model) && !isRecord(record)) return record;
|
|
104
|
+
const values = record instanceof import_database.Model ? record.dataValues : record;
|
|
105
|
+
if (!relatedStorage && !Object.keys(collection.model.associations).some((name) => values[name] != null)) {
|
|
106
|
+
return record;
|
|
107
|
+
}
|
|
108
|
+
const json = record instanceof import_database.Model ? record.toJSON() : record;
|
|
109
|
+
const projected = projectAssociations(json, collection, storages, relatedStorage);
|
|
110
|
+
return projected === json ? record : projected;
|
|
111
|
+
}
|
|
112
|
+
if (actionName === "get") {
|
|
113
|
+
const record = projectRecord(ctx.body);
|
|
114
|
+
if (record !== ctx.body) ctx.body = record;
|
|
115
|
+
} else if (Array.isArray(ctx.body)) {
|
|
116
|
+
const records = projectArray(ctx.body, projectRecord);
|
|
117
|
+
if (records !== ctx.body) ctx.body = records;
|
|
118
|
+
} else if (Array.isArray(ctx.body.rows)) {
|
|
119
|
+
const rows = projectArray(ctx.body.rows, projectRecord);
|
|
120
|
+
if (rows !== ctx.body.rows) ctx.body = { ...ctx.body, rows };
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
124
|
+
0 && (module.exports = {
|
|
125
|
+
projectStorageAssociations
|
|
126
|
+
});
|
|
@@ -52,4 +52,4 @@ export declare function getRepairedAttachmentValues(record: Pick<AttachmentModel
|
|
|
52
52
|
};
|
|
53
53
|
export declare function repairAttachmentFilenames(app: Application, fileManager: FileManagerLike, options?: RepairFilenamesOptions): Promise<RepairFilenamesResult>;
|
|
54
54
|
export declare function registerRepairFilenamesCommand(app: Application): void;
|
|
55
|
-
export
|
|
55
|
+
export default registerRepairFilenamesCommand;
|
|
@@ -26,6 +26,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
26
26
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
27
|
var repair_filenames_exports = {};
|
|
28
28
|
__export(repair_filenames_exports, {
|
|
29
|
+
default: () => repair_filenames_default,
|
|
29
30
|
getRepairedAttachmentValues: () => getRepairedAttachmentValues,
|
|
30
31
|
registerRepairFilenamesCommand: () => registerRepairFilenamesCommand,
|
|
31
32
|
repairAttachmentFilenames: () => repairAttachmentFilenames,
|
|
@@ -268,6 +269,9 @@ async function repairAttachmentFilenames(app, fileManager, options = {}) {
|
|
|
268
269
|
}
|
|
269
270
|
function registerRepairFilenamesCommand(app) {
|
|
270
271
|
const command = app.findCommand("file-manager") || app.command("file-manager");
|
|
272
|
+
if (command.commands.some((subcommand) => subcommand.name() === "repair-filenames")) {
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
271
275
|
command.command("repair-filenames").preload().option("--apply", "rename objects and update attachment records").option("--batch-size [batchSize]", "batch size for scanning attachments").option("--limit [limit]", "maximum number of attachment records to scan").action(async (options) => {
|
|
272
276
|
const fileManager = app.pm.get("file-manager");
|
|
273
277
|
const result = await repairAttachmentFilenames(app, fileManager, {
|
|
@@ -294,6 +298,7 @@ function registerRepairFilenamesCommand(app) {
|
|
|
294
298
|
}
|
|
295
299
|
});
|
|
296
300
|
}
|
|
301
|
+
var repair_filenames_default = registerRepairFilenamesCommand;
|
|
297
302
|
// Annotate the CommonJS export names for ESM import in node:
|
|
298
303
|
0 && (module.exports = {
|
|
299
304
|
getRepairedAttachmentValues,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/plugin-file-manager",
|
|
3
|
-
"version": "2.4.0-alpha.
|
|
3
|
+
"version": "2.4.0-alpha.20",
|
|
4
4
|
"displayName": "File manager",
|
|
5
5
|
"displayName.ru-RU": "Менеджер файлов",
|
|
6
6
|
"displayName.zh-CN": "文件管理器",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"description.zh-CN": "提供文件存储服务,并提供了文件表模板和附件字段。",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"main": "./dist/server/index.js",
|
|
12
|
-
"homepage": "https://docs.nocobase.com/handbook/file-manager",
|
|
12
|
+
"homepage": "https://nocode.docs.nocobase.com/handbook/file-manager",
|
|
13
13
|
"homepage.ru-RU": "https://docs-ru.nocobase.com/handbook/file-manager",
|
|
14
14
|
"homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/file-manager",
|
|
15
15
|
"devDependencies": {
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"multer": "^2.1.1",
|
|
36
36
|
"multer-s3": "^3.0.1",
|
|
37
37
|
"multistream": "^4.1.0",
|
|
38
|
-
"pdfjs-dist": "^
|
|
38
|
+
"pdfjs-dist": "^6.2.108",
|
|
39
39
|
"react": "^18.2.0",
|
|
40
40
|
"react-i18next": "^11.15.1",
|
|
41
41
|
"supertest": "^6.1.6",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"Collections",
|
|
63
63
|
"Collection fields"
|
|
64
64
|
],
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "29f7108990d7d4a7739bca6eaf674a096bfb7369"
|
|
66
66
|
}
|
|
@@ -1,10 +0,0 @@
|
|
|
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
|
-
|
|
10
|
-
"use strict";(self.webpackChunk_nocobase_plugin_file_manager_client_v2=self.webpackChunk_nocobase_plugin_file_manager_client_v2||[]).push([["125"],{212:function(e,t,n){n.r(t),n.d(t,{DisplayPreviewFieldModel:function(){return _},FilePreview:function(){return E},getFileCollectionReference:function(){return j}});var r=n(477),o=n(485),l=n(694),i=n(59),a=n(773),c=n(155),u=n.n(c),f=n(23);function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function p(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function m(e,t){return null!=t&&"u">typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function y(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){p(e,t,n[t])})}return e}function b(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function h(e,t){return(h=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function v(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var l=[],i=!0,a=!1;try{for(o=o.call(e);!(i=(n=o.next()).done)&&(l.push(n.value),!t||l.length!==t);i=!0);}catch(e){a=!0,r=e}finally{try{i||null==o.return||o.return()}finally{if(a)throw r}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return s(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return s(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function g(e){return e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function w(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(w=function(){return!!e})()}function O(){var e,t,n=(e=["\n .ant-image-img {\n border: 1px solid #d9d9d9;\n padding: 2px;\n }\n "],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return O=function(){return n},n}var S=function(e){return"string"==typeof e&&e.length>0},j=function(e,t){if((null==e?void 0:e.interface)==="attachmentURL"&&e.target)return{dataSourceKey:(null==t?void 0:t.dataSourceKey)||"main",collectionName:e.target};var n=(null==e?void 0:e.targetCollection)||((null==t?void 0:t.template)==="file"?t:null);return n?{dataSourceKey:n.dataSourceKey||"main",collectionName:n.name}:void 0},P=function(e,t){if(!S(e)||!(t&&(void 0===t?"undefined":g(t))==="object"&&!Array.isArray(t)))return e;var n=t.url,r=t.preview;return n!==e&&r!==e?e:b(y({},t),{url:S(n)?n:e,preview:S(r)?r:e})},E=function(e){var t=e.file,n=e.size,o=e.showFileName,l=e.onClick,a=(0,f._H)(t),c=(0,f.q)(a);if(!c)return null;var s=(0,f.WP)(a,c),p=(0,f._Y)(a,c),d=(0,f.qk)(a)||p,m={border:"1px solid #d9d9d9",padding:2,borderRadius:4,objectFit:"cover",boxShadow:"0 0 0 2px #fff"},y=(0,f._b)(a,"image/*"),b=u().createElement("div",{className:(0,r.css)(O())},y?u().createElement("img",{src:d,alt:s,width:n,height:n,style:m}):u().createElement(i.Image,{src:d,fallback:p,width:n,height:n,preview:!1,style:m}));return u().createElement("div",{onClick:l,style:{textAlign:"center",width:n,wordBreak:"break-all",cursor:l?"pointer":"default"}},b,o&&u().createElement(i.Tooltip,{title:s},u().createElement("div",{style:{fontSize:12,marginTop:4,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%"}},s)))},k=function(e){var t=e.value,n=void 0===t?[]:t,r=e.size,o=void 0===r?28:r,l=e.showFileName,c=e.record,s=e.fileCollection,p=v(u().useState(0),2),d=p[0],m=p[1],y=v(u().useState(!1),2),b=y[0],h=y[1],g=u().useMemo(function(){return(0,a.castArray)(n).filter(Boolean).map(function(e){return P(e,c)}).map(f._H).filter(function(e){return(0,f.q)(e)})},[c,n]);u().useEffect(function(){d>=g.length&&g.length&&m(0)},[d,g.length]),u().useEffect(function(){!g.length&&b&&h(!1)},[g.length,b]);var w=u().useCallback(function(e){var t=e||g[d];if(t){var n=t.url||t.preview;n&&(0,f.Ns)(n,(0,f.ub)(t,n))}},[d,g]),O=u().useCallback(function(e){m(e),h(!0)},[]),S=u().useCallback(function(e){e<0||e>=g.length||m(e)},[g.length]);return u().createElement(u().Fragment,null,u().createElement(i.Space,{wrap:!0},g.map(function(e,t){return u().createElement(E,{file:e,size:o,key:t,showFileName:l,onClick:function(){return O(t)}})})),g[d]?u().createElement(f.Mo,{open:b,file:g[d],index:d,list:g,fileCollection:s,onOpenChange:h,onClose:function(){return h(!1)},onSwitchIndex:S,onDownload:w}):null)},_=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t,r;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return t=n,r=arguments,t=d(t),p(e=function(e,t){if(t&&("object"===g(t)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,w()?Reflect.construct(t,r||[],d(this).constructor):t.apply(this,r)),"disableTitleField",!0),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&h(n,e),t=[{key:"render",value:function(){var e=this,t=this.props,n=t.value,r=t.titleField,o=t.template,l=t.target,i=this.context.record,c=j(this.context.collectionField,this.context.collection);return r&&"file"!==o&&"attachments"!==l?(0,a.castArray)(n).flatMap(function(t,n){var o=null==t?void 0:t[r],l=o?u().createElement(k,b(y({key:n},e.props),{fileCollection:c,record:t,value:(0,a.castArray)(o).filter(Boolean)})):u().createElement("span",{key:n},"N/A");return 0===n?[l]:[u().createElement("span",{key:"sep-".concat(n)},", "),l]}):u().createElement(k,b(y({},this.props),{fileCollection:c,record:i,value:(0,a.castArray)(n).filter(Boolean)}))}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,t),n}(o.FieldModel);_.registerFlow({key:"previewReadPrettySetting",sort:500,title:(0,l.tExpr)("Preview Settings"),steps:{size:{title:(0,l.tExpr)("Size"),uiMode:function(e){var t=e.t;return{type:"select",key:"size",props:{options:[{value:300,label:t("Large")},{value:100,label:t("Middle")},{value:28,label:t("Small")}]}}},hideInSettings:function(e){return m(e.model.parent,o.TableColumnModel)},defaultParams:function(e){return{size:m(e.model.parent,o.DetailsItemModel)?100:28}},handler:function(e,t){e.model.setProps("size",t.size)}},showFileName:{title:(0,l.tExpr)("Show file name"),uiMode:{type:"switch",key:"showFileName"},hideInSettings:function(e){return m(e.model.parent,o.TableColumnModel)},defaultParams:{showFileName:!1},handler:function(e,t){e.model.setProps("showFileName",t.showFileName)}}}}),_.define({label:(0,l.tExpr)("Preview")}),l.DisplayItemModel.bindModelToInterface("DisplayPreviewFieldModel",["url","attachment","attachmentURL","m2m","m2o","o2o","o2m","oho","obo","mbm"],{isDefault:!0,when:function(e,t){return!t.targetCollection||"file"===t.targetCollection.template}})}}]);
|