@nocobase/plugin-file-manager 1.6.29 → 1.6.31

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.
@@ -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
+ });
@@ -8,7 +8,7 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "1.6.29",
11
+ "@nocobase/client": "1.6.31",
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.29",
23
- "@nocobase/utils": "1.6.29",
24
- "@nocobase/database": "1.6.29",
25
- "@nocobase/test": "1.6.29",
26
- "@nocobase/actions": "1.6.29",
22
+ "@nocobase/server": "1.6.31",
23
+ "@nocobase/utils": "1.6.31",
24
+ "@nocobase/database": "1.6.31",
25
+ "@nocobase/test": "1.6.31",
26
+ "@nocobase/actions": "1.6.31",
27
27
  "sequelize": "6.35.2",
28
- "@nocobase/plugin-data-source-main": "1.6.29"
28
+ "@nocobase/plugin-data-source-main": "1.6.31"
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-13T06:33:35.705Z"}
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-18T14:46:01.983Z"}
@@ -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-13T06:33:29.541Z"}
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-18T14:45:55.905Z"}
@@ -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-13T06:33:34.321Z"}
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-18T14:46:00.687Z"}
@@ -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-13T06:33:34.243Z"}
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-18T14:46:00.607Z"}
@@ -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-13T06:33:41.275Z"}
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-18T14:46:07.118Z"}
@@ -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-13T06:33:37.274Z"}
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-18T14:46:03.432Z"}
@@ -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-13T06:33:29.449Z"}
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-18T14:45:55.823Z"}
@@ -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 values = await getFileData(ctx);
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 = ((_c = (_b = ctx.db.getFieldByPath(attachmentField)) == null ? void 0 : _b.options) == null ? void 0 : _c.storage) || collection.options.storage;
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
- ctx.storage = plugin.parseStorage(storage);
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
  });
@@ -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<any>;
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>;
@@ -40,21 +40,19 @@ __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"));
54
53
  var import_s3 = __toESM(require("./storages/s3"));
55
54
  var import_tx_cos = __toESM(require("./storages/tx-cos"));
56
55
  var import_utils2 = require("./utils");
57
- var import_lodash = __toESM(require("lodash"));
58
56
  const DEFAULT_STORAGE_TYPE = import_constants.STORAGE_TYPE_LOCAL;
59
57
  class FileDeleteError extends Error {
60
58
  data;
@@ -112,29 +110,24 @@ class PluginFileManagerServer extends import_server.Plugin {
112
110
  }
113
111
  async uploadFile(options) {
114
112
  const { storageName, filePath, documentRoot } = options;
115
- const storageRepository = this.db.getRepository("storages");
116
- let storageInstance;
117
- storageInstance = await storageRepository.findOne({
118
- filter: storageName ? {
119
- name: storageName
120
- } : {
121
- default: true
122
- }
123
- });
124
- const fileStream = import_fs.default.createReadStream(filePath);
125
- 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) {
126
119
  throw new Error("[file-manager] no linked or default storage provided");
127
120
  }
128
- storageInstance = this.parseStorage(storageInstance);
121
+ const fileStream = import_fs.default.createReadStream(filePath);
129
122
  if (documentRoot) {
130
- storageInstance.options["documentRoot"] = documentRoot;
123
+ storage.options["documentRoot"] = documentRoot;
131
124
  }
132
- const storageType = this.storageTypes.get(storageInstance.type);
133
- const storage = new storageType(storageInstance);
134
- if (!storage) {
135
- throw new Error(`[file-manager] storage type "${storageInstance.type}" is not defined`);
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`);
136
129
  }
137
- const engine = storage.make();
130
+ const engine = storageInstance.make();
138
131
  const file = {
139
132
  originalname: (0, import_path.basename)(filePath),
140
133
  path: filePath,
@@ -149,7 +142,7 @@ class PluginFileManagerServer extends import_server.Plugin {
149
142
  resolve(info);
150
143
  });
151
144
  });
152
- return (0, import_attachments.getFileData)({ app: this.app, file, storage: storageInstance, request: { body: {} } });
145
+ return storageInstance.getFileData(file, {});
153
146
  }
154
147
  async loadStorages(options) {
155
148
  const repository = this.db.getRepository("storages");
@@ -182,17 +175,8 @@ class PluginFileManagerServer extends import_server.Plugin {
182
175
  }
183
176
  }
184
177
  async handleSyncMessage(message) {
185
- if (message.type === "storageChange") {
186
- const storage = await this.db.getRepository("storages").findOne({
187
- filterByTk: message.storageId
188
- });
189
- if (storage) {
190
- this.storagesCache.set(storage.id, this.parseStorage(storage));
191
- }
192
- }
193
- if (message.type === "storageRemove") {
194
- const id = message.storageId;
195
- this.storagesCache.delete(id);
178
+ if (message.type === "reloadStorages") {
179
+ await this.loadStorages();
196
180
  }
197
181
  }
198
182
  async beforeLoad() {
@@ -227,17 +211,11 @@ class PluginFileManagerServer extends import_server.Plugin {
227
211
  this.storageTypes.register(import_constants.STORAGE_TYPE_S3, import_s3.default);
228
212
  this.storageTypes.register(import_constants.STORAGE_TYPE_TX_COS, import_tx_cos.default);
229
213
  const Storage = this.db.getModel("storages");
230
- Storage.afterSave((m, { transaction }) => {
231
- this.storagesCache.set(m.id, m.toJSON());
232
- this.sendSyncMessage(
233
- {
234
- type: "storageChange",
235
- storageId: m.id
236
- },
237
- { transaction }
238
- );
214
+ Storage.afterSave(async (m, { transaction }) => {
215
+ await this.loadStorages({ transaction });
216
+ this.sendSyncMessage({ type: "reloadStorages" }, { transaction });
239
217
  });
240
- Storage.afterDestroy((m, { transaction }) => {
218
+ Storage.afterDestroy(async (m, { transaction }) => {
241
219
  var _a, _b;
242
220
  for (const collection of this.db.collections.values()) {
243
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) {
@@ -248,14 +226,8 @@ class PluginFileManagerServer extends import_server.Plugin {
248
226
  );
249
227
  }
250
228
  }
251
- this.storagesCache.delete(m.id);
252
- this.sendSyncMessage(
253
- {
254
- type: "storageRemove",
255
- storageId: m.id
256
- },
257
- { transaction }
258
- );
229
+ await this.loadStorages({ transaction });
230
+ this.sendSyncMessage({ type: "reloadStorages" }, { transaction });
259
231
  });
260
232
  this.app.acl.registerSnippet({
261
233
  name: `pm.${this.name}.storages`,
@@ -282,8 +254,8 @@ class PluginFileManagerServer extends import_server.Plugin {
282
254
  this.app.acl.addFixedParams("attachments", "create", ownMerger);
283
255
  this.app.acl.addFixedParams("attachments", "destroy", ownMerger);
284
256
  this.app.db.interfaceManager.registerInterfaceType("attachment", import_attachment_interface.AttachmentInterface);
285
- this.db.on("afterFind", async (instances, options) => {
286
- var _a, _b, _c, _d;
257
+ this.db.on("afterFind", async (instances) => {
258
+ var _a, _b, _c;
287
259
  if (!instances) {
288
260
  return;
289
261
  }
@@ -292,26 +264,7 @@ class PluginFileManagerServer extends import_server.Plugin {
292
264
  if (name) {
293
265
  const collection = this.db.getCollection(name);
294
266
  if ((collection == null ? void 0 : collection.name) === "attachments" || ((_c = collection == null ? void 0 : collection.options) == null ? void 0 : _c.template) === "file") {
295
- let recordMap = null;
296
- if (!((_d = options == null ? void 0 : options.attributes) == null ? void 0 : _d.includes("storageId"))) {
297
- const ids = records.map((x) => x.id).filter(Boolean);
298
- const fullRecords = await collection.repository.find({
299
- where: { id: ids },
300
- transaction: options.transaction,
301
- hooks: false
302
- });
303
- recordMap = import_lodash.default.keyBy(fullRecords, (x) => x.id);
304
- }
305
267
  for (const record of records) {
306
- if (recordMap) {
307
- const fullRecord = recordMap[record.id];
308
- if (fullRecord) {
309
- record.set("storageId", fullRecord.storageId);
310
- record.set("title", fullRecord.title);
311
- record.set("filename", fullRecord.filename);
312
- record.set("extname", fullRecord.extname);
313
- }
314
- }
315
268
  const url = await this.getFileURL(record);
316
269
  const previewUrl = await this.getFileURL(record, true);
317
270
  record.set("url", url);
@@ -23,7 +23,7 @@ export interface AttachmentModel {
23
23
  title: string;
24
24
  filename: string;
25
25
  path: string;
26
- url: string;
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?(file: {
38
- [key: string]: any;
39
- }): {
40
- [key: string]: any;
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 import_utils = require("@nocobase/utils");
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.29",
3
+ "version": "1.6.31",
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": "9539ebb7c421a09dc795507edb1e3adcb2686038"
47
+ "gitHead": "fc024988c623826fe2447d3f29e3cce40d15c354"
48
48
  }