@nocobase/plugin-file-manager 1.6.28 → 1.6.30
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/common/constants.d.ts +9 -0
- package/dist/common/constants.js +36 -0
- package/dist/externalVersion.js +7 -7
- package/dist/node_modules/@aws-sdk/client-s3/package.json +1 -1
- package/dist/node_modules/mime-match/package.json +1 -1
- package/dist/node_modules/mkdirp/package.json +1 -1
- package/dist/node_modules/multer-aliyun-oss/package.json +1 -1
- package/dist/node_modules/multer-cos/package.json +1 -1
- package/dist/node_modules/multer-s3/package.json +1 -1
- package/dist/node_modules/url-join/package.json +1 -1
- package/dist/server/actions/attachments.d.ts +0 -1
- package/dist/server/actions/attachments.js +21 -41
- package/dist/server/server.d.ts +10 -1
- package/dist/server/server.js +24 -51
- package/dist/server/storages/index.d.ts +10 -5
- package/dist/server/storages/index.js +20 -1
- package/package.json +2 -2
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
export declare const INVALID_FILENAME_CHARS = "<>?*~\\/";
|
|
@@ -0,0 +1,36 @@
|
|
|
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 constants_exports = {};
|
|
28
|
+
__export(constants_exports, {
|
|
29
|
+
INVALID_FILENAME_CHARS: () => INVALID_FILENAME_CHARS
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(constants_exports);
|
|
32
|
+
const INVALID_FILENAME_CHARS = "<>?*~\\/";
|
|
33
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
34
|
+
0 && (module.exports = {
|
|
35
|
+
INVALID_FILENAME_CHARS
|
|
36
|
+
});
|
package/dist/externalVersion.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
|
-
"@nocobase/client": "1.6.
|
|
11
|
+
"@nocobase/client": "1.6.30",
|
|
12
12
|
"react": "18.2.0",
|
|
13
13
|
"antd": "5.12.8",
|
|
14
14
|
"@ant-design/icons": "5.6.1",
|
|
@@ -19,11 +19,11 @@ module.exports = {
|
|
|
19
19
|
"@formily/core": "2.3.0",
|
|
20
20
|
"@formily/react": "2.3.0",
|
|
21
21
|
"multer": "1.4.5-lts.2",
|
|
22
|
-
"@nocobase/server": "1.6.
|
|
23
|
-
"@nocobase/utils": "1.6.
|
|
24
|
-
"@nocobase/database": "1.6.
|
|
25
|
-
"@nocobase/test": "1.6.
|
|
26
|
-
"@nocobase/actions": "1.6.
|
|
22
|
+
"@nocobase/server": "1.6.30",
|
|
23
|
+
"@nocobase/utils": "1.6.30",
|
|
24
|
+
"@nocobase/database": "1.6.30",
|
|
25
|
+
"@nocobase/test": "1.6.30",
|
|
26
|
+
"@nocobase/actions": "1.6.30",
|
|
27
27
|
"sequelize": "6.35.2",
|
|
28
|
-
"@nocobase/plugin-data-source-main": "1.6.
|
|
28
|
+
"@nocobase/plugin-data-source-main": "1.6.30"
|
|
29
29
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@aws-sdk/client-s3","description":"AWS SDK for JavaScript S3 Client for Node.js, Browser and React Native","version":"3.750.0","scripts":{"build":"concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'","build:cjs":"node ../../scripts/compilation/inline client-s3","build:es":"tsc -p tsconfig.es.json","build:include:deps":"lerna run --scope $npm_package_name --include-dependencies build","build:types":"tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4","clean":"rimraf ./dist-* && rimraf *.tsbuildinfo","extract:docs":"api-extractor run --local","generate:client":"node ../../scripts/generate-clients/single-service --solo s3","test":"yarn g:vitest run","test:browser":"node ./test/browser-build/esbuild && yarn g:vitest run -c vitest.config.browser.ts","test:browser:watch":"node ./test/browser-build/esbuild && yarn g:vitest watch -c vitest.config.browser.ts","test:e2e":"yarn g:vitest run -c vitest.config.e2e.ts && yarn test:browser","test:e2e:watch":"yarn g:vitest watch -c vitest.config.e2e.ts","test:watch":"yarn g:vitest watch"},"main":"./dist-cjs/index.js","types":"./dist-types/index.d.ts","module":"./dist-es/index.js","sideEffects":false,"dependencies":{"@aws-crypto/sha1-browser":"5.2.0","@aws-crypto/sha256-browser":"5.2.0","@aws-crypto/sha256-js":"5.2.0","@aws-sdk/core":"3.750.0","@aws-sdk/credential-provider-node":"3.750.0","@aws-sdk/middleware-bucket-endpoint":"3.734.0","@aws-sdk/middleware-expect-continue":"3.734.0","@aws-sdk/middleware-flexible-checksums":"3.750.0","@aws-sdk/middleware-host-header":"3.734.0","@aws-sdk/middleware-location-constraint":"3.734.0","@aws-sdk/middleware-logger":"3.734.0","@aws-sdk/middleware-recursion-detection":"3.734.0","@aws-sdk/middleware-sdk-s3":"3.750.0","@aws-sdk/middleware-ssec":"3.734.0","@aws-sdk/middleware-user-agent":"3.750.0","@aws-sdk/region-config-resolver":"3.734.0","@aws-sdk/signature-v4-multi-region":"3.750.0","@aws-sdk/types":"3.734.0","@aws-sdk/util-endpoints":"3.743.0","@aws-sdk/util-user-agent-browser":"3.734.0","@aws-sdk/util-user-agent-node":"3.750.0","@aws-sdk/xml-builder":"3.734.0","@smithy/config-resolver":"^4.0.1","@smithy/core":"^3.1.4","@smithy/eventstream-serde-browser":"^4.0.1","@smithy/eventstream-serde-config-resolver":"^4.0.1","@smithy/eventstream-serde-node":"^4.0.1","@smithy/fetch-http-handler":"^5.0.1","@smithy/hash-blob-browser":"^4.0.1","@smithy/hash-node":"^4.0.1","@smithy/hash-stream-node":"^4.0.1","@smithy/invalid-dependency":"^4.0.1","@smithy/md5-js":"^4.0.1","@smithy/middleware-content-length":"^4.0.1","@smithy/middleware-endpoint":"^4.0.5","@smithy/middleware-retry":"^4.0.6","@smithy/middleware-serde":"^4.0.2","@smithy/middleware-stack":"^4.0.1","@smithy/node-config-provider":"^4.0.1","@smithy/node-http-handler":"^4.0.2","@smithy/protocol-http":"^5.0.1","@smithy/smithy-client":"^4.1.5","@smithy/types":"^4.1.0","@smithy/url-parser":"^4.0.1","@smithy/util-base64":"^4.0.0","@smithy/util-body-length-browser":"^4.0.0","@smithy/util-body-length-node":"^4.0.0","@smithy/util-defaults-mode-browser":"^4.0.6","@smithy/util-defaults-mode-node":"^4.0.6","@smithy/util-endpoints":"^3.0.1","@smithy/util-middleware":"^4.0.1","@smithy/util-retry":"^4.0.1","@smithy/util-stream":"^4.1.1","@smithy/util-utf8":"^4.0.0","@smithy/util-waiter":"^4.0.2","tslib":"^2.6.2"},"devDependencies":{"@aws-sdk/signature-v4-crt":"3.750.0","@tsconfig/node18":"18.2.4","@types/node":"^18.19.69","concurrently":"7.0.0","downlevel-dts":"0.10.1","rimraf":"3.0.2","typescript":"~5.2.2"},"engines":{"node":">=18.0.0"},"typesVersions":{"<4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},"files":["dist-*/**"],"author":{"name":"AWS SDK for JavaScript Team","url":"https://aws.amazon.com/javascript/"},"license":"Apache-2.0","browser":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser"},"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},"homepage":"https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-s3","repository":{"type":"git","url":"https://github.com/aws/aws-sdk-js-v3.git","directory":"clients/client-s3"},"_lastModified":"2025-05-
|
|
1
|
+
{"name":"@aws-sdk/client-s3","description":"AWS SDK for JavaScript S3 Client for Node.js, Browser and React Native","version":"3.750.0","scripts":{"build":"concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'","build:cjs":"node ../../scripts/compilation/inline client-s3","build:es":"tsc -p tsconfig.es.json","build:include:deps":"lerna run --scope $npm_package_name --include-dependencies build","build:types":"tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4","clean":"rimraf ./dist-* && rimraf *.tsbuildinfo","extract:docs":"api-extractor run --local","generate:client":"node ../../scripts/generate-clients/single-service --solo s3","test":"yarn g:vitest run","test:browser":"node ./test/browser-build/esbuild && yarn g:vitest run -c vitest.config.browser.ts","test:browser:watch":"node ./test/browser-build/esbuild && yarn g:vitest watch -c vitest.config.browser.ts","test:e2e":"yarn g:vitest run -c vitest.config.e2e.ts && yarn test:browser","test:e2e:watch":"yarn g:vitest watch -c vitest.config.e2e.ts","test:watch":"yarn g:vitest watch"},"main":"./dist-cjs/index.js","types":"./dist-types/index.d.ts","module":"./dist-es/index.js","sideEffects":false,"dependencies":{"@aws-crypto/sha1-browser":"5.2.0","@aws-crypto/sha256-browser":"5.2.0","@aws-crypto/sha256-js":"5.2.0","@aws-sdk/core":"3.750.0","@aws-sdk/credential-provider-node":"3.750.0","@aws-sdk/middleware-bucket-endpoint":"3.734.0","@aws-sdk/middleware-expect-continue":"3.734.0","@aws-sdk/middleware-flexible-checksums":"3.750.0","@aws-sdk/middleware-host-header":"3.734.0","@aws-sdk/middleware-location-constraint":"3.734.0","@aws-sdk/middleware-logger":"3.734.0","@aws-sdk/middleware-recursion-detection":"3.734.0","@aws-sdk/middleware-sdk-s3":"3.750.0","@aws-sdk/middleware-ssec":"3.734.0","@aws-sdk/middleware-user-agent":"3.750.0","@aws-sdk/region-config-resolver":"3.734.0","@aws-sdk/signature-v4-multi-region":"3.750.0","@aws-sdk/types":"3.734.0","@aws-sdk/util-endpoints":"3.743.0","@aws-sdk/util-user-agent-browser":"3.734.0","@aws-sdk/util-user-agent-node":"3.750.0","@aws-sdk/xml-builder":"3.734.0","@smithy/config-resolver":"^4.0.1","@smithy/core":"^3.1.4","@smithy/eventstream-serde-browser":"^4.0.1","@smithy/eventstream-serde-config-resolver":"^4.0.1","@smithy/eventstream-serde-node":"^4.0.1","@smithy/fetch-http-handler":"^5.0.1","@smithy/hash-blob-browser":"^4.0.1","@smithy/hash-node":"^4.0.1","@smithy/hash-stream-node":"^4.0.1","@smithy/invalid-dependency":"^4.0.1","@smithy/md5-js":"^4.0.1","@smithy/middleware-content-length":"^4.0.1","@smithy/middleware-endpoint":"^4.0.5","@smithy/middleware-retry":"^4.0.6","@smithy/middleware-serde":"^4.0.2","@smithy/middleware-stack":"^4.0.1","@smithy/node-config-provider":"^4.0.1","@smithy/node-http-handler":"^4.0.2","@smithy/protocol-http":"^5.0.1","@smithy/smithy-client":"^4.1.5","@smithy/types":"^4.1.0","@smithy/url-parser":"^4.0.1","@smithy/util-base64":"^4.0.0","@smithy/util-body-length-browser":"^4.0.0","@smithy/util-body-length-node":"^4.0.0","@smithy/util-defaults-mode-browser":"^4.0.6","@smithy/util-defaults-mode-node":"^4.0.6","@smithy/util-endpoints":"^3.0.1","@smithy/util-middleware":"^4.0.1","@smithy/util-retry":"^4.0.1","@smithy/util-stream":"^4.1.1","@smithy/util-utf8":"^4.0.0","@smithy/util-waiter":"^4.0.2","tslib":"^2.6.2"},"devDependencies":{"@aws-sdk/signature-v4-crt":"3.750.0","@tsconfig/node18":"18.2.4","@types/node":"^18.19.69","concurrently":"7.0.0","downlevel-dts":"0.10.1","rimraf":"3.0.2","typescript":"~5.2.2"},"engines":{"node":">=18.0.0"},"typesVersions":{"<4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},"files":["dist-*/**"],"author":{"name":"AWS SDK for JavaScript Team","url":"https://aws.amazon.com/javascript/"},"license":"Apache-2.0","browser":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser"},"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},"homepage":"https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-s3","repository":{"type":"git","url":"https://github.com/aws/aws-sdk-js-v3.git","directory":"clients/client-s3"},"_lastModified":"2025-05-15T12:26:43.139Z"}
|
|
@@ -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":"2025-05-
|
|
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":"2025-05-15T12:26:37.391Z"}
|
|
@@ -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":"2025-05-
|
|
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":"2025-05-15T12:26:41.850Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"multer-aliyun-oss","version":"2.1.3","description":"Multer Storage for AliYun OSS","main":"index.js","scripts":{},"author":"AngusYoung","license":"ISC","repository":{"type":"git","url":"git+https://github.com/ay86/multer-aliyun-oss.git"},"keywords":["multer","storage","aliyun","oss"],"dependencies":{"ali-oss":"^6.1.0"},"_lastModified":"2025-05-
|
|
1
|
+
{"name":"multer-aliyun-oss","version":"2.1.3","description":"Multer Storage for AliYun OSS","main":"index.js","scripts":{},"author":"AngusYoung","license":"ISC","repository":{"type":"git","url":"git+https://github.com/ay86/multer-aliyun-oss.git"},"keywords":["multer","storage","aliyun","oss"],"dependencies":{"ali-oss":"^6.1.0"},"_lastModified":"2025-05-15T12:26:41.773Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"_from":"multer-cos","_id":"multer-cos@1.0.2","_inBundle":false,"_integrity":"sha512-4F8P1VTCSNhiem+BFJFLe3Ixco6cIuAQ6j7U+PBRvdbBJRZgq5Q+vaDMMBWJ1HmPGOOP3AyKS5yk2f0nbFoqqA==","_location":"/multer-cos","_phantomChildren":{},"_requested":{"type":"tag","registry":true,"raw":"multer-cos","name":"multer-cos","escapedName":"multer-cos","rawSpec":"","saveSpec":null,"fetchSpec":"latest"},"_requiredBy":["#USER","/"],"_resolved":"https://registry.npmjs.org/multer-cos/-/multer-cos-1.0.2.tgz","_shasum":"95c7c06cdee1b9311675a895481f9d946de6dcf3","_spec":"multer-cos","_where":"/Users/lanbo/workplace/websocket","author":{"name":"lanbosm"},"bugs":{"url":"https://github.com/lanbosm/multer-COS/issues"},"bundleDependencies":false,"deprecated":false,"description":"Streaming multer storage engine for QCloud COS","devDependencies":{"cos-nodejs-sdk-v5":"^2.2.6","dotenv":"^5.0.1","multer":"^1.3.0"},"engines":{"node":">= 6.10.0"},"homepage":"https://github.com/lanbosm/multer-COS#readme","keywords":["express","multer","COS"],"license":"MIT","main":"index.js","name":"multer-cos","repository":{"type":"git","url":"git+ssh://git@github.com/lanbosm/multer-COS.git"},"scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"version":"1.0.3","_lastModified":"2025-05-
|
|
1
|
+
{"_from":"multer-cos","_id":"multer-cos@1.0.2","_inBundle":false,"_integrity":"sha512-4F8P1VTCSNhiem+BFJFLe3Ixco6cIuAQ6j7U+PBRvdbBJRZgq5Q+vaDMMBWJ1HmPGOOP3AyKS5yk2f0nbFoqqA==","_location":"/multer-cos","_phantomChildren":{},"_requested":{"type":"tag","registry":true,"raw":"multer-cos","name":"multer-cos","escapedName":"multer-cos","rawSpec":"","saveSpec":null,"fetchSpec":"latest"},"_requiredBy":["#USER","/"],"_resolved":"https://registry.npmjs.org/multer-cos/-/multer-cos-1.0.2.tgz","_shasum":"95c7c06cdee1b9311675a895481f9d946de6dcf3","_spec":"multer-cos","_where":"/Users/lanbo/workplace/websocket","author":{"name":"lanbosm"},"bugs":{"url":"https://github.com/lanbosm/multer-COS/issues"},"bundleDependencies":false,"deprecated":false,"description":"Streaming multer storage engine for QCloud COS","devDependencies":{"cos-nodejs-sdk-v5":"^2.2.6","dotenv":"^5.0.1","multer":"^1.3.0"},"engines":{"node":">= 6.10.0"},"homepage":"https://github.com/lanbosm/multer-COS#readme","keywords":["express","multer","COS"],"license":"MIT","main":"index.js","name":"multer-cos","repository":{"type":"git","url":"git+ssh://git@github.com/lanbosm/multer-COS.git"},"scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"version":"1.0.3","_lastModified":"2025-05-15T12:26:48.348Z"}
|
|
@@ -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":"2025-05-
|
|
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":"2025-05-15T12:26:44.596Z"}
|
|
@@ -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":"2025-05-
|
|
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":"2025-05-15T12:26:37.307Z"}
|
|
@@ -7,5 +7,4 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
import { Context, Next } from '@nocobase/actions';
|
|
10
|
-
export declare function getFileData(ctx: Context): Promise<any>;
|
|
11
10
|
export declare function createMiddleware(ctx: Context, next: Next): Promise<any>;
|
|
@@ -36,12 +36,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
36
36
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
37
37
|
var attachments_exports = {};
|
|
38
38
|
__export(attachments_exports, {
|
|
39
|
-
createMiddleware: () => createMiddleware
|
|
40
|
-
getFileData: () => getFileData
|
|
39
|
+
createMiddleware: () => createMiddleware
|
|
41
40
|
});
|
|
42
41
|
module.exports = __toCommonJS(attachments_exports);
|
|
43
42
|
var import_utils = require("@nocobase/utils");
|
|
44
|
-
var import_path = __toESM(require("path"));
|
|
45
43
|
var import__ = __toESM(require(".."));
|
|
46
44
|
var import_constants = require("../../constants");
|
|
47
45
|
var Rules = __toESM(require("../rules"));
|
|
@@ -53,37 +51,6 @@ function getFileFilter(storage) {
|
|
|
53
51
|
cb(null, result);
|
|
54
52
|
};
|
|
55
53
|
}
|
|
56
|
-
async function getFileData(ctx) {
|
|
57
|
-
var _a;
|
|
58
|
-
const { [import_constants.FILE_FIELD_NAME]: file, storage } = ctx;
|
|
59
|
-
if (!file) {
|
|
60
|
-
return ctx.throw(400, "file validation failed");
|
|
61
|
-
}
|
|
62
|
-
const plugin = ctx.app.pm.get(import__.default);
|
|
63
|
-
const StorageType = plugin.storageTypes.get(storage.type);
|
|
64
|
-
const { [StorageType.filenameKey || "filename"]: name } = file;
|
|
65
|
-
const filename = import_path.default.basename(name);
|
|
66
|
-
const extname = import_path.default.extname(filename);
|
|
67
|
-
const path = (storage.path || "").replace(/^\/|\/$/g, "");
|
|
68
|
-
let storageInstance = plugin.storagesCache.get(storage.id);
|
|
69
|
-
if (!storageInstance) {
|
|
70
|
-
await plugin.loadStorages();
|
|
71
|
-
storageInstance = plugin.storagesCache.get(storage.id);
|
|
72
|
-
}
|
|
73
|
-
const data = {
|
|
74
|
-
title: Buffer.from(file.originalname, "latin1").toString("utf8").replace(extname, ""),
|
|
75
|
-
filename,
|
|
76
|
-
extname,
|
|
77
|
-
// TODO(feature): 暂时两者相同,后面 storage.path 模版化以后,这里只是 file 实际的 path
|
|
78
|
-
path,
|
|
79
|
-
size: file.size,
|
|
80
|
-
mimetype: file.mimetype,
|
|
81
|
-
meta: ctx.request.body,
|
|
82
|
-
storageId: storage.id,
|
|
83
|
-
...(_a = StorageType == null ? void 0 : StorageType["getFileData"]) == null ? void 0 : _a.call(StorageType, file)
|
|
84
|
-
};
|
|
85
|
-
return data;
|
|
86
|
-
}
|
|
87
54
|
async function multipart(ctx, next) {
|
|
88
55
|
const { storage } = ctx;
|
|
89
56
|
if (!storage) {
|
|
@@ -116,7 +83,11 @@ async function multipart(ctx, next) {
|
|
|
116
83
|
ctx.logger.error(err);
|
|
117
84
|
return ctx.throw(500, err);
|
|
118
85
|
}
|
|
119
|
-
const
|
|
86
|
+
const { [import_constants.FILE_FIELD_NAME]: file } = ctx;
|
|
87
|
+
if (!file) {
|
|
88
|
+
return ctx.throw(400, "file validation failed");
|
|
89
|
+
}
|
|
90
|
+
const values = storageInstance.getFileData(file, ctx.request.body);
|
|
120
91
|
ctx.action.mergeParams({
|
|
121
92
|
values
|
|
122
93
|
});
|
|
@@ -130,19 +101,28 @@ async function createMiddleware(ctx, next) {
|
|
|
130
101
|
if (((_a = collection == null ? void 0 : collection.options) == null ? void 0 : _a.template) !== "file" || !["upload", "create"].includes(actionName)) {
|
|
131
102
|
return next();
|
|
132
103
|
}
|
|
133
|
-
const storageName = (
|
|
134
|
-
const StorageRepo = ctx.db.getRepository("storages");
|
|
135
|
-
const storage = await StorageRepo.findOne({ filter: storageName ? { name: storageName } : { default: true } });
|
|
104
|
+
const storageName = resourceName === "attachments" ? (_c = (_b = ctx.db.getFieldByPath(attachmentField)) == null ? void 0 : _b.options) == null ? void 0 : _c.storage : collection.options.storage;
|
|
136
105
|
const plugin = ctx.app.pm.get(import__.default);
|
|
137
|
-
|
|
106
|
+
const storage = Array.from(plugin.storagesCache.values()).find(
|
|
107
|
+
(storage2) => storageName ? storage2.name === storageName : storage2.default
|
|
108
|
+
);
|
|
109
|
+
if (!storage) {
|
|
110
|
+
ctx.logger.error(`[file-manager] no storage found`);
|
|
111
|
+
return ctx.throw(500);
|
|
112
|
+
}
|
|
113
|
+
ctx.storage = storage;
|
|
138
114
|
if (ctx == null ? void 0 : ctx.request.is("multipart/*")) {
|
|
139
115
|
await multipart(ctx, next);
|
|
140
116
|
} else {
|
|
117
|
+
ctx.action.mergeParams({
|
|
118
|
+
values: {
|
|
119
|
+
storage: { id: storage.id }
|
|
120
|
+
}
|
|
121
|
+
});
|
|
141
122
|
await next();
|
|
142
123
|
}
|
|
143
124
|
}
|
|
144
125
|
// Annotate the CommonJS export names for ESM import in node:
|
|
145
126
|
0 && (module.exports = {
|
|
146
|
-
createMiddleware
|
|
147
|
-
getFileData
|
|
127
|
+
createMiddleware
|
|
148
128
|
});
|
package/dist/server/server.d.ts
CHANGED
|
@@ -29,7 +29,16 @@ export declare class PluginFileManagerServer extends Plugin {
|
|
|
29
29
|
registerStorageType(type: string, Type: StorageClassType): void;
|
|
30
30
|
createFileRecord(options: FileRecordOptions): Promise<any>;
|
|
31
31
|
parseStorage(instance: any): any;
|
|
32
|
-
uploadFile(options: UploadFileOptions): Promise<
|
|
32
|
+
uploadFile(options: UploadFileOptions): Promise<{
|
|
33
|
+
title: string;
|
|
34
|
+
filename: string;
|
|
35
|
+
extname: string;
|
|
36
|
+
path: string;
|
|
37
|
+
size: any;
|
|
38
|
+
mimetype: any;
|
|
39
|
+
meta: {};
|
|
40
|
+
storageId: number;
|
|
41
|
+
}>;
|
|
33
42
|
loadStorages(options?: {
|
|
34
43
|
transaction: any;
|
|
35
44
|
}): Promise<void>;
|
package/dist/server/server.js
CHANGED
|
@@ -40,14 +40,13 @@ __export(server_exports, {
|
|
|
40
40
|
default: () => server_default
|
|
41
41
|
});
|
|
42
42
|
module.exports = __toCommonJS(server_exports);
|
|
43
|
+
var import_path = require("path");
|
|
44
|
+
var import_fs = __toESM(require("fs"));
|
|
43
45
|
var import_server = require("@nocobase/server");
|
|
44
46
|
var import_utils = require("@nocobase/utils");
|
|
45
|
-
var import_path = require("path");
|
|
46
47
|
var import_database = require("@nocobase/database");
|
|
47
|
-
var import_fs = __toESM(require("fs"));
|
|
48
48
|
var import_constants = require("../constants");
|
|
49
49
|
var import_actions = __toESM(require("./actions"));
|
|
50
|
-
var import_attachments = require("./actions/attachments");
|
|
51
50
|
var import_attachment_interface = require("./interfaces/attachment-interface");
|
|
52
51
|
var import_ali_oss = __toESM(require("./storages/ali-oss"));
|
|
53
52
|
var import_local = __toESM(require("./storages/local"));
|
|
@@ -111,29 +110,24 @@ class PluginFileManagerServer extends import_server.Plugin {
|
|
|
111
110
|
}
|
|
112
111
|
async uploadFile(options) {
|
|
113
112
|
const { storageName, filePath, documentRoot } = options;
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
default: true
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
const fileStream = import_fs.default.createReadStream(filePath);
|
|
124
|
-
if (!storageInstance) {
|
|
113
|
+
if (!this.storagesCache.size) {
|
|
114
|
+
await this.loadStorages();
|
|
115
|
+
}
|
|
116
|
+
const storages = Array.from(this.storagesCache.values());
|
|
117
|
+
const storage = storages.find((item) => item.name === storageName) || storages.find((item) => item.default);
|
|
118
|
+
if (!storage) {
|
|
125
119
|
throw new Error("[file-manager] no linked or default storage provided");
|
|
126
120
|
}
|
|
127
|
-
|
|
121
|
+
const fileStream = import_fs.default.createReadStream(filePath);
|
|
128
122
|
if (documentRoot) {
|
|
129
|
-
|
|
123
|
+
storage.options["documentRoot"] = documentRoot;
|
|
130
124
|
}
|
|
131
|
-
const
|
|
132
|
-
const
|
|
133
|
-
if (!
|
|
134
|
-
throw new Error(`[file-manager] storage type "${
|
|
125
|
+
const StorageType = this.storageTypes.get(storage.type);
|
|
126
|
+
const storageInstance = new StorageType(storage);
|
|
127
|
+
if (!storageInstance) {
|
|
128
|
+
throw new Error(`[file-manager] storage type "${storage.type}" is not defined`);
|
|
135
129
|
}
|
|
136
|
-
const engine =
|
|
130
|
+
const engine = storageInstance.make();
|
|
137
131
|
const file = {
|
|
138
132
|
originalname: (0, import_path.basename)(filePath),
|
|
139
133
|
path: filePath,
|
|
@@ -148,7 +142,7 @@ class PluginFileManagerServer extends import_server.Plugin {
|
|
|
148
142
|
resolve(info);
|
|
149
143
|
});
|
|
150
144
|
});
|
|
151
|
-
return
|
|
145
|
+
return storageInstance.getFileData(file, {});
|
|
152
146
|
}
|
|
153
147
|
async loadStorages(options) {
|
|
154
148
|
const repository = this.db.getRepository("storages");
|
|
@@ -181,17 +175,8 @@ class PluginFileManagerServer extends import_server.Plugin {
|
|
|
181
175
|
}
|
|
182
176
|
}
|
|
183
177
|
async handleSyncMessage(message) {
|
|
184
|
-
if (message.type === "
|
|
185
|
-
|
|
186
|
-
filterByTk: message.storageId
|
|
187
|
-
});
|
|
188
|
-
if (storage) {
|
|
189
|
-
this.storagesCache.set(storage.id, this.parseStorage(storage));
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
if (message.type === "storageRemove") {
|
|
193
|
-
const id = message.storageId;
|
|
194
|
-
this.storagesCache.delete(id);
|
|
178
|
+
if (message.type === "reloadStorages") {
|
|
179
|
+
await this.loadStorages();
|
|
195
180
|
}
|
|
196
181
|
}
|
|
197
182
|
async beforeLoad() {
|
|
@@ -226,17 +211,11 @@ class PluginFileManagerServer extends import_server.Plugin {
|
|
|
226
211
|
this.storageTypes.register(import_constants.STORAGE_TYPE_S3, import_s3.default);
|
|
227
212
|
this.storageTypes.register(import_constants.STORAGE_TYPE_TX_COS, import_tx_cos.default);
|
|
228
213
|
const Storage = this.db.getModel("storages");
|
|
229
|
-
Storage.afterSave((m, { transaction }) => {
|
|
230
|
-
this.
|
|
231
|
-
this.sendSyncMessage(
|
|
232
|
-
{
|
|
233
|
-
type: "storageChange",
|
|
234
|
-
storageId: m.id
|
|
235
|
-
},
|
|
236
|
-
{ transaction }
|
|
237
|
-
);
|
|
214
|
+
Storage.afterSave(async (m, { transaction }) => {
|
|
215
|
+
await this.loadStorages({ transaction });
|
|
216
|
+
this.sendSyncMessage({ type: "reloadStorages" }, { transaction });
|
|
238
217
|
});
|
|
239
|
-
Storage.afterDestroy((m, { transaction }) => {
|
|
218
|
+
Storage.afterDestroy(async (m, { transaction }) => {
|
|
240
219
|
var _a, _b;
|
|
241
220
|
for (const collection of this.db.collections.values()) {
|
|
242
221
|
if (((_a = collection == null ? void 0 : collection.options) == null ? void 0 : _a.template) === "file" && ((_b = collection == null ? void 0 : collection.options) == null ? void 0 : _b.storage) === m.name) {
|
|
@@ -247,14 +226,8 @@ class PluginFileManagerServer extends import_server.Plugin {
|
|
|
247
226
|
);
|
|
248
227
|
}
|
|
249
228
|
}
|
|
250
|
-
this.
|
|
251
|
-
this.sendSyncMessage(
|
|
252
|
-
{
|
|
253
|
-
type: "storageRemove",
|
|
254
|
-
storageId: m.id
|
|
255
|
-
},
|
|
256
|
-
{ transaction }
|
|
257
|
-
);
|
|
229
|
+
await this.loadStorages({ transaction });
|
|
230
|
+
this.sendSyncMessage({ type: "reloadStorages" }, { transaction });
|
|
258
231
|
});
|
|
259
232
|
this.app.acl.registerSnippet({
|
|
260
233
|
name: `pm.${this.name}.storages`,
|
|
@@ -23,7 +23,7 @@ export interface AttachmentModel {
|
|
|
23
23
|
title: string;
|
|
24
24
|
filename: string;
|
|
25
25
|
path: string;
|
|
26
|
-
url
|
|
26
|
+
url?: string;
|
|
27
27
|
storageId: number;
|
|
28
28
|
}
|
|
29
29
|
export declare abstract class StorageType {
|
|
@@ -34,10 +34,15 @@ export declare abstract class StorageType {
|
|
|
34
34
|
abstract make(): StorageEngine;
|
|
35
35
|
abstract delete(records: AttachmentModel[]): [number, AttachmentModel[]] | Promise<[number, AttachmentModel[]]>;
|
|
36
36
|
getFileKey(record: AttachmentModel): any;
|
|
37
|
-
getFileData
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
getFileData(file: any, meta?: {}): {
|
|
38
|
+
title: string;
|
|
39
|
+
filename: string;
|
|
40
|
+
extname: string;
|
|
41
|
+
path: string;
|
|
42
|
+
size: any;
|
|
43
|
+
mimetype: any;
|
|
44
|
+
meta: {};
|
|
45
|
+
storageId: number;
|
|
41
46
|
};
|
|
42
47
|
getFileURL(file: AttachmentModel, preview?: boolean): string | Promise<string>;
|
|
43
48
|
}
|
|
@@ -39,8 +39,9 @@ __export(storages_exports, {
|
|
|
39
39
|
StorageType: () => StorageType
|
|
40
40
|
});
|
|
41
41
|
module.exports = __toCommonJS(storages_exports);
|
|
42
|
-
var
|
|
42
|
+
var import_path = __toESM(require("path"));
|
|
43
43
|
var import_url_join = __toESM(require("url-join"));
|
|
44
|
+
var import_utils = require("@nocobase/utils");
|
|
44
45
|
var import_utils2 = require("../utils");
|
|
45
46
|
class StorageType {
|
|
46
47
|
constructor(storage) {
|
|
@@ -53,6 +54,24 @@ class StorageType {
|
|
|
53
54
|
getFileKey(record) {
|
|
54
55
|
return (0, import_utils2.getFileKey)(record);
|
|
55
56
|
}
|
|
57
|
+
getFileData(file, meta = {}) {
|
|
58
|
+
const { [this.constructor.filenameKey || "filename"]: name } = file;
|
|
59
|
+
const filename = import_path.default.basename(name);
|
|
60
|
+
const extname = import_path.default.extname(filename);
|
|
61
|
+
const path = (this.storage.path || "").replace(/^\/|\/$/g, "");
|
|
62
|
+
const data = {
|
|
63
|
+
title: Buffer.from(file.originalname, "latin1").toString("utf8").replace(extname, ""),
|
|
64
|
+
filename,
|
|
65
|
+
extname,
|
|
66
|
+
// TODO(feature): 暂时两者相同,后面 storage.path 模版化以后,这里只是 file 实际的 path
|
|
67
|
+
path,
|
|
68
|
+
size: file.size,
|
|
69
|
+
mimetype: file.mimetype,
|
|
70
|
+
meta,
|
|
71
|
+
storageId: this.storage.id
|
|
72
|
+
};
|
|
73
|
+
return data;
|
|
74
|
+
}
|
|
56
75
|
getFileURL(file, preview) {
|
|
57
76
|
if (file.url && (0, import_utils.isURL)(file.url)) {
|
|
58
77
|
if (preview) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/plugin-file-manager",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.30",
|
|
4
4
|
"displayName": "File manager",
|
|
5
5
|
"displayName.zh-CN": "文件管理器",
|
|
6
6
|
"description": "Provides files storage services with files collection template and attachment field.",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"Collections",
|
|
45
45
|
"Collection fields"
|
|
46
46
|
],
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "1c48773b55a978030c8a3de4cd88a8d5a2c45a16"
|
|
48
48
|
}
|