@nocobase/plugin-file-manager 1.7.0-beta.24 → 1.7.0-beta.26
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/externalVersion.js +8 -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/server.d.ts +6 -0
- package/dist/server/server.js +18 -0
- package/dist/server/storages/index.d.ts +7 -0
- package/dist/server/storages/index.js +20 -1
- package/dist/server/storages/local.d.ts +6 -0
- package/dist/server/storages/local.js +11 -0
- package/package.json +3 -2
package/dist/externalVersion.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
|
-
"@nocobase/client": "1.7.0-beta.
|
|
11
|
+
"@nocobase/client": "1.7.0-beta.26",
|
|
12
12
|
"react": "18.2.0",
|
|
13
13
|
"antd": "5.24.2",
|
|
14
14
|
"@ant-design/icons": "5.6.1",
|
|
@@ -19,11 +19,12 @@ 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/database": "1.7.0-beta.
|
|
23
|
-
"@nocobase/server": "1.7.0-beta.
|
|
24
|
-
"@nocobase/utils": "1.7.0-beta.
|
|
25
|
-
"@nocobase/test": "1.7.0-beta.
|
|
26
|
-
"@nocobase/actions": "1.7.0-beta.
|
|
22
|
+
"@nocobase/database": "1.7.0-beta.26",
|
|
23
|
+
"@nocobase/server": "1.7.0-beta.26",
|
|
24
|
+
"@nocobase/utils": "1.7.0-beta.26",
|
|
25
|
+
"@nocobase/test": "1.7.0-beta.26",
|
|
26
|
+
"@nocobase/actions": "1.7.0-beta.26",
|
|
27
27
|
"sequelize": "6.35.2",
|
|
28
|
-
"@nocobase/plugin-data-source-main": "1.7.0-beta.
|
|
28
|
+
"@nocobase/plugin-data-source-main": "1.7.0-beta.26",
|
|
29
|
+
"axios": "1.7.7"
|
|
29
30
|
};
|
|
@@ -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-04-
|
|
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-04-28T07:18:13.594Z"}
|
|
@@ -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-04-
|
|
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-04-28T07:18:07.366Z"}
|
|
@@ -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-04-
|
|
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-04-28T07:18:12.008Z"}
|
|
@@ -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-04-
|
|
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-04-28T07:18:11.919Z"}
|
|
@@ -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-04-
|
|
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-04-28T07:18:18.778Z"}
|
|
@@ -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-04-
|
|
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-04-28T07:18:15.116Z"}
|
|
@@ -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-04-
|
|
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-04-28T07:18:07.285Z"}
|
package/dist/server/server.d.ts
CHANGED
|
@@ -6,9 +6,11 @@
|
|
|
6
6
|
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
|
+
/// <reference types="node" />
|
|
9
10
|
import { Model, Transactionable } from '@nocobase/database';
|
|
10
11
|
import { Plugin } from '@nocobase/server';
|
|
11
12
|
import { Registry } from '@nocobase/utils';
|
|
13
|
+
import { Readable } from 'stream';
|
|
12
14
|
import { AttachmentModel, StorageClassType, StorageModel } from './storages';
|
|
13
15
|
export type * from './storages';
|
|
14
16
|
export type FileRecordOptions = {
|
|
@@ -48,5 +50,9 @@ export declare class PluginFileManagerServer extends Plugin {
|
|
|
48
50
|
load(): Promise<void>;
|
|
49
51
|
getFileURL(file: AttachmentModel, preview?: boolean): Promise<string>;
|
|
50
52
|
isPublicAccessStorage(storageName: any): Promise<boolean>;
|
|
53
|
+
getFileStream(file: AttachmentModel): Promise<{
|
|
54
|
+
stream: Readable;
|
|
55
|
+
contentType?: string;
|
|
56
|
+
}>;
|
|
51
57
|
}
|
|
52
58
|
export default PluginFileManagerServer;
|
package/dist/server/server.js
CHANGED
|
@@ -308,6 +308,24 @@ class PluginFileManagerServer extends import_server.Plugin {
|
|
|
308
308
|
}
|
|
309
309
|
return !!((_a = storage.options) == null ? void 0 : _a.public);
|
|
310
310
|
}
|
|
311
|
+
async getFileStream(file) {
|
|
312
|
+
if (!file.storageId) {
|
|
313
|
+
throw new Error("File storageId not found");
|
|
314
|
+
}
|
|
315
|
+
const storage = this.storagesCache.get(file.storageId);
|
|
316
|
+
if (!storage) {
|
|
317
|
+
throw new Error("[file-manager] no linked or default storage provided");
|
|
318
|
+
}
|
|
319
|
+
const StorageType = this.storageTypes.get(storage.type);
|
|
320
|
+
if (!StorageType) {
|
|
321
|
+
throw new Error(`[file-manager] storage type "${storage.type}" is not defined`);
|
|
322
|
+
}
|
|
323
|
+
const storageInstance = new StorageType(storage);
|
|
324
|
+
if (!storageInstance) {
|
|
325
|
+
throw new Error(`[file-manager] storage type "${storage.type}" is not defined`);
|
|
326
|
+
}
|
|
327
|
+
return storageInstance.getFileStream(file);
|
|
328
|
+
}
|
|
311
329
|
}
|
|
312
330
|
var server_default = PluginFileManagerServer;
|
|
313
331
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
|
+
/// <reference types="node" />
|
|
9
10
|
import { StorageEngine } from 'multer';
|
|
11
|
+
import type { Readable } from 'stream';
|
|
10
12
|
export interface StorageModel {
|
|
11
13
|
id?: number;
|
|
12
14
|
title: string;
|
|
@@ -25,6 +27,7 @@ export interface AttachmentModel {
|
|
|
25
27
|
path: string;
|
|
26
28
|
url: string;
|
|
27
29
|
storageId: number;
|
|
30
|
+
mimetype: string;
|
|
28
31
|
}
|
|
29
32
|
export declare abstract class StorageType {
|
|
30
33
|
storage: StorageModel;
|
|
@@ -45,6 +48,10 @@ export declare abstract class StorageType {
|
|
|
45
48
|
storageId: number;
|
|
46
49
|
};
|
|
47
50
|
getFileURL(file: AttachmentModel, preview?: boolean): string | Promise<string>;
|
|
51
|
+
getFileStream(file: AttachmentModel): Promise<{
|
|
52
|
+
stream: Readable;
|
|
53
|
+
contentType?: string;
|
|
54
|
+
}>;
|
|
48
55
|
}
|
|
49
56
|
export type StorageClassType = {
|
|
50
57
|
new (storage: StorageModel): StorageType;
|
|
@@ -39,9 +39,10 @@ __export(storages_exports, {
|
|
|
39
39
|
StorageType: () => StorageType
|
|
40
40
|
});
|
|
41
41
|
module.exports = __toCommonJS(storages_exports);
|
|
42
|
+
var import_utils = require("@nocobase/utils");
|
|
43
|
+
var import_axios = __toESM(require("axios"));
|
|
42
44
|
var import_path = __toESM(require("path"));
|
|
43
45
|
var import_url_join = __toESM(require("url-join"));
|
|
44
|
-
var import_utils = require("@nocobase/utils");
|
|
45
46
|
var import_utils2 = require("../utils");
|
|
46
47
|
class StorageType {
|
|
47
48
|
constructor(storage) {
|
|
@@ -87,6 +88,24 @@ class StorageType {
|
|
|
87
88
|
].filter(Boolean);
|
|
88
89
|
return (0, import_url_join.default)(keys);
|
|
89
90
|
}
|
|
91
|
+
async getFileStream(file) {
|
|
92
|
+
try {
|
|
93
|
+
const fileURL = await this.getFileURL(file);
|
|
94
|
+
const requestOptions = {
|
|
95
|
+
responseType: "stream",
|
|
96
|
+
validateStatus: (status) => status === 200,
|
|
97
|
+
timeout: 3e4
|
|
98
|
+
// 30 seconds timeout
|
|
99
|
+
};
|
|
100
|
+
const response = await import_axios.default.get(fileURL, requestOptions);
|
|
101
|
+
return {
|
|
102
|
+
stream: response.data,
|
|
103
|
+
contentType: response.headers["content-type"]
|
|
104
|
+
};
|
|
105
|
+
} catch (err) {
|
|
106
|
+
throw new Error(`fetch file failed: ${err}`);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
90
109
|
}
|
|
91
110
|
// Annotate the CommonJS export names for ESM import in node:
|
|
92
111
|
0 && (module.exports = {
|
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
|
+
/// <reference types="node" />
|
|
9
10
|
import multer from 'multer';
|
|
11
|
+
import type { Readable } from 'stream';
|
|
10
12
|
import { AttachmentModel, StorageType } from '.';
|
|
11
13
|
export default class extends StorageType {
|
|
12
14
|
static defaults(): {
|
|
@@ -25,4 +27,8 @@ export default class extends StorageType {
|
|
|
25
27
|
make(): multer.StorageEngine;
|
|
26
28
|
delete(records: AttachmentModel[]): Promise<[number, AttachmentModel[]]>;
|
|
27
29
|
getFileURL(file: AttachmentModel, preview?: boolean): Promise<any>;
|
|
30
|
+
getFileStream(file: AttachmentModel): Promise<{
|
|
31
|
+
stream: Readable;
|
|
32
|
+
contentType?: string;
|
|
33
|
+
}>;
|
|
28
34
|
}
|
|
@@ -40,6 +40,7 @@ __export(local_exports, {
|
|
|
40
40
|
});
|
|
41
41
|
module.exports = __toCommonJS(local_exports);
|
|
42
42
|
var import_utils = require("@nocobase/utils");
|
|
43
|
+
var import_fs = __toESM(require("fs"));
|
|
43
44
|
var import_promises = __toESM(require("fs/promises"));
|
|
44
45
|
var import_mkdirp = __toESM(require("mkdirp"));
|
|
45
46
|
var import_multer = __toESM(require("multer"));
|
|
@@ -108,4 +109,14 @@ class local_default extends import__.StorageType {
|
|
|
108
109
|
}
|
|
109
110
|
return (0, import_url_join.default)(process.env.APP_PUBLIC_PATH, url);
|
|
110
111
|
}
|
|
112
|
+
async getFileStream(file) {
|
|
113
|
+
const filePath = import_path.default.join(process.cwd(), "storage", "uploads", file.path || "", file.filename);
|
|
114
|
+
if (await import_promises.default.stat(filePath)) {
|
|
115
|
+
return {
|
|
116
|
+
stream: import_fs.default.createReadStream(filePath),
|
|
117
|
+
contentType: file.mimetype
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
throw new Error(`File not found: ${filePath}`);
|
|
121
|
+
}
|
|
111
122
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/plugin-file-manager",
|
|
3
|
-
"version": "1.7.0-beta.
|
|
3
|
+
"version": "1.7.0-beta.26",
|
|
4
4
|
"displayName": "File manager",
|
|
5
5
|
"displayName.zh-CN": "文件管理器",
|
|
6
6
|
"description": "Provides files storage services with files collection template and attachment field.",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"@types/koa-multer": "^1.0.4",
|
|
20
20
|
"@types/multer": "^1.4.5",
|
|
21
21
|
"antd": "5.x",
|
|
22
|
+
"axios": "^1.7.0",
|
|
22
23
|
"cos-nodejs-sdk-v5": "^2.11.14",
|
|
23
24
|
"koa-static": "^5.0.0",
|
|
24
25
|
"mime-match": "^1.0.2",
|
|
@@ -44,5 +45,5 @@
|
|
|
44
45
|
"Collections",
|
|
45
46
|
"Collection fields"
|
|
46
47
|
],
|
|
47
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "01d3e77c1f4a853d1f592ac2d70916010e9c510a"
|
|
48
49
|
}
|