@nocobase/plugin-file-manager 0.12.0-alpha.5 → 0.13.0-alpha.2

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.
@@ -45,14 +45,7 @@
45
45
  type: "string",
46
46
  "x-decorator": "FormItem",
47
47
  "x-component": "Input",
48
- default: "uploads"
49
- },
50
- serve: {
51
- type: "string",
52
- "x-decorator": "FormItem",
53
- "x-component": "Checkbox",
54
- "x-content": `{{t("Use the built-in static file server", { ns: "${NAMESPACE}" })}}`,
55
- default: true
48
+ default: "storage/uploads"
56
49
  }
57
50
  }
58
51
  },
@@ -673,6 +666,9 @@
673
666
  schema2["x-component-props"] = schema2["x-component-props"] || {};
674
667
  schema2["x-component-props"]["size"] = "small";
675
668
  }
669
+ if (!schema2["x-component-props"]) {
670
+ schema2["x-component-props"] = {};
671
+ }
676
672
  schema2["x-component-props"]["action"] = `${field.target}:create${field.storage ? `?attachementField=${field.collectionName}.${field.name}` : ""}`;
677
673
  },
678
674
  initialize: (values) => {
@@ -1 +1 @@
1
- {"name":"@aws-sdk/client-s3","description":"AWS SDK for JavaScript S3 Client for Node.js, Browser and React Native","version":"3.363.0","scripts":{"build":"concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'","build:cjs":"tsc -p tsconfig.cjs.json","build:docs":"typedoc","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 test:unit","test:e2e":"ts-mocha test/**/*.ispec.ts && karma start karma.conf.js","test:unit":"ts-mocha test/**/*.spec.ts"},"main":"./dist-cjs/index.js","types":"./dist-types/index.d.ts","module":"./dist-es/index.js","sideEffects":false,"dependencies":{"@aws-crypto/sha1-browser":"3.0.0","@aws-crypto/sha256-browser":"3.0.0","@aws-crypto/sha256-js":"3.0.0","@aws-sdk/client-sts":"3.363.0","@aws-sdk/credential-provider-node":"3.363.0","@aws-sdk/hash-blob-browser":"3.357.0","@aws-sdk/hash-stream-node":"3.357.0","@aws-sdk/md5-js":"3.357.0","@aws-sdk/middleware-bucket-endpoint":"3.363.0","@aws-sdk/middleware-expect-continue":"3.363.0","@aws-sdk/middleware-flexible-checksums":"3.363.0","@aws-sdk/middleware-host-header":"3.363.0","@aws-sdk/middleware-location-constraint":"3.363.0","@aws-sdk/middleware-logger":"3.363.0","@aws-sdk/middleware-recursion-detection":"3.363.0","@aws-sdk/middleware-sdk-s3":"3.363.0","@aws-sdk/middleware-signing":"3.363.0","@aws-sdk/middleware-ssec":"3.363.0","@aws-sdk/middleware-user-agent":"3.363.0","@aws-sdk/signature-v4-multi-region":"3.363.0","@aws-sdk/types":"3.357.0","@aws-sdk/util-endpoints":"3.357.0","@aws-sdk/util-user-agent-browser":"3.363.0","@aws-sdk/util-user-agent-node":"3.363.0","@aws-sdk/xml-builder":"3.310.0","@smithy/config-resolver":"^1.0.1","@smithy/eventstream-serde-browser":"^1.0.1","@smithy/eventstream-serde-config-resolver":"^1.0.1","@smithy/eventstream-serde-node":"^1.0.1","@smithy/fetch-http-handler":"^1.0.1","@smithy/hash-node":"^1.0.1","@smithy/invalid-dependency":"^1.0.1","@smithy/middleware-content-length":"^1.0.1","@smithy/middleware-endpoint":"^1.0.1","@smithy/middleware-retry":"^1.0.2","@smithy/middleware-serde":"^1.0.1","@smithy/middleware-stack":"^1.0.1","@smithy/node-config-provider":"^1.0.1","@smithy/node-http-handler":"^1.0.2","@smithy/protocol-http":"^1.0.1","@smithy/smithy-client":"^1.0.3","@smithy/types":"^1.0.0","@smithy/url-parser":"^1.0.1","@smithy/util-base64":"^1.0.1","@smithy/util-body-length-browser":"^1.0.1","@smithy/util-body-length-node":"^1.0.1","@smithy/util-defaults-mode-browser":"^1.0.1","@smithy/util-defaults-mode-node":"^1.0.1","@smithy/util-retry":"^1.0.2","@smithy/util-stream":"^1.0.1","@smithy/util-utf8":"^1.0.1","@smithy/util-waiter":"^1.0.1","fast-xml-parser":"4.2.5","tslib":"^2.5.0"},"devDependencies":{"@aws-sdk/service-client-documentation-generator":"3.310.0","@smithy/service-client-documentation-generator":"^1.0.1","@tsconfig/node14":"1.0.3","@types/chai":"^4.2.11","@types/mocha":"^8.0.4","@types/node":"^14.14.31","concurrently":"7.0.0","downlevel-dts":"0.10.1","rimraf":"3.0.2","typedoc":"0.23.23","typescript":"~4.9.5"},"engines":{"node":">=14.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":"2023-08-18T08:37:30.862Z"}
1
+ {"name":"@aws-sdk/client-s3","description":"AWS SDK for JavaScript S3 Client for Node.js, Browser and React Native","version":"3.363.0","scripts":{"build":"concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'","build:cjs":"tsc -p tsconfig.cjs.json","build:docs":"typedoc","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 test:unit","test:e2e":"ts-mocha test/**/*.ispec.ts && karma start karma.conf.js","test:unit":"ts-mocha test/**/*.spec.ts"},"main":"./dist-cjs/index.js","types":"./dist-types/index.d.ts","module":"./dist-es/index.js","sideEffects":false,"dependencies":{"@aws-crypto/sha1-browser":"3.0.0","@aws-crypto/sha256-browser":"3.0.0","@aws-crypto/sha256-js":"3.0.0","@aws-sdk/client-sts":"3.363.0","@aws-sdk/credential-provider-node":"3.363.0","@aws-sdk/hash-blob-browser":"3.357.0","@aws-sdk/hash-stream-node":"3.357.0","@aws-sdk/md5-js":"3.357.0","@aws-sdk/middleware-bucket-endpoint":"3.363.0","@aws-sdk/middleware-expect-continue":"3.363.0","@aws-sdk/middleware-flexible-checksums":"3.363.0","@aws-sdk/middleware-host-header":"3.363.0","@aws-sdk/middleware-location-constraint":"3.363.0","@aws-sdk/middleware-logger":"3.363.0","@aws-sdk/middleware-recursion-detection":"3.363.0","@aws-sdk/middleware-sdk-s3":"3.363.0","@aws-sdk/middleware-signing":"3.363.0","@aws-sdk/middleware-ssec":"3.363.0","@aws-sdk/middleware-user-agent":"3.363.0","@aws-sdk/signature-v4-multi-region":"3.363.0","@aws-sdk/types":"3.357.0","@aws-sdk/util-endpoints":"3.357.0","@aws-sdk/util-user-agent-browser":"3.363.0","@aws-sdk/util-user-agent-node":"3.363.0","@aws-sdk/xml-builder":"3.310.0","@smithy/config-resolver":"^1.0.1","@smithy/eventstream-serde-browser":"^1.0.1","@smithy/eventstream-serde-config-resolver":"^1.0.1","@smithy/eventstream-serde-node":"^1.0.1","@smithy/fetch-http-handler":"^1.0.1","@smithy/hash-node":"^1.0.1","@smithy/invalid-dependency":"^1.0.1","@smithy/middleware-content-length":"^1.0.1","@smithy/middleware-endpoint":"^1.0.1","@smithy/middleware-retry":"^1.0.2","@smithy/middleware-serde":"^1.0.1","@smithy/middleware-stack":"^1.0.1","@smithy/node-config-provider":"^1.0.1","@smithy/node-http-handler":"^1.0.2","@smithy/protocol-http":"^1.0.1","@smithy/smithy-client":"^1.0.3","@smithy/types":"^1.0.0","@smithy/url-parser":"^1.0.1","@smithy/util-base64":"^1.0.1","@smithy/util-body-length-browser":"^1.0.1","@smithy/util-body-length-node":"^1.0.1","@smithy/util-defaults-mode-browser":"^1.0.1","@smithy/util-defaults-mode-node":"^1.0.1","@smithy/util-retry":"^1.0.2","@smithy/util-stream":"^1.0.1","@smithy/util-utf8":"^1.0.1","@smithy/util-waiter":"^1.0.1","fast-xml-parser":"4.2.5","tslib":"^2.5.0"},"devDependencies":{"@aws-sdk/service-client-documentation-generator":"3.310.0","@smithy/service-client-documentation-generator":"^1.0.1","@tsconfig/node14":"1.0.3","@types/chai":"^4.2.11","@types/mocha":"^8.0.4","@types/node":"^14.14.31","concurrently":"7.0.0","downlevel-dts":"0.10.1","rimraf":"3.0.2","typedoc":"0.23.23","typescript":"~4.9.5"},"engines":{"node":">=14.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":"2023-08-24T16:01:56.319Z"}
@@ -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":"2023-08-18T08:37:12.267Z"}
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":"2023-08-24T16:01:39.212Z"}
@@ -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":"2023-08-18T08:37:22.768Z"}
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":"2023-08-24T16:01:48.566Z"}
@@ -1 +1 @@
1
- {"name":"multer-aliyun-oss","version":"2.1.1","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.16.0"},"devDependencies":{},"_lastModified":"2023-08-18T08:37:22.639Z"}
1
+ {"name":"multer-aliyun-oss","version":"2.1.1","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.16.0"},"devDependencies":{},"_lastModified":"2023-08-24T16:01:48.457Z"}
@@ -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":"2023-08-18T08:37:45.436Z"}
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":"2023-08-24T16:02:09.253Z"}
@@ -1 +1 @@
1
- {"name":"multer-s3","version":"3.0.1","description":"Streaming multer storage engine for AWS S3","main":"index.js","scripts":{"test":"standard && mocha test/basic.js"},"engines":{"node":">= 12.0.0"},"repository":{"type":"git","url":"git+https://github.com/badunk/multer-s3.git"},"keywords":["multer","s3","amazon","aws"],"author":"badunk","license":"MIT","bugs":{"url":"https://github.com/badunk/multer-s3/issues"},"homepage":"https://github.com/badunk/multer-s3#readme","dependencies":{"@aws-sdk/lib-storage":"^3.46.0","file-type":"^3.3.0","html-comment-regex":"^1.1.2","run-parallel":"^1.1.6"},"peerDependencies":{"@aws-sdk/client-s3":"^3.0.0"},"devDependencies":{"express":"^4.13.1","form-data":"^1.0.0-rc3","mocha":"^2.2.5","multer":"^1.1.0","on-finished":"^2.3.0","standard":"^5.4.1","xtend":"^4.0.1"},"_lastModified":"2023-08-18T08:37:37.754Z"}
1
+ {"name":"multer-s3","version":"3.0.1","description":"Streaming multer storage engine for AWS S3","main":"index.js","scripts":{"test":"standard && mocha test/basic.js"},"engines":{"node":">= 12.0.0"},"repository":{"type":"git","url":"git+https://github.com/badunk/multer-s3.git"},"keywords":["multer","s3","amazon","aws"],"author":"badunk","license":"MIT","bugs":{"url":"https://github.com/badunk/multer-s3/issues"},"homepage":"https://github.com/badunk/multer-s3#readme","dependencies":{"@aws-sdk/lib-storage":"^3.46.0","file-type":"^3.3.0","html-comment-regex":"^1.1.2","run-parallel":"^1.1.6"},"peerDependencies":{"@aws-sdk/client-s3":"^3.0.0"},"devDependencies":{"express":"^4.13.1","form-data":"^1.0.0-rc3","mocha":"^2.2.5","multer":"^1.1.0","on-finished":"^2.3.0","standard":"^5.4.1","xtend":"^4.0.1"},"_lastModified":"2023-08-24T16:02:03.019Z"}
@@ -5,7 +5,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var server = require('@nocobase/server');
6
6
  var path = require('path');
7
7
  var initActions = require('./actions');
8
- var constants = require('./constants');
9
8
  var storages = require('./storages');
10
9
 
11
10
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
@@ -46,9 +45,6 @@ class PluginFileManager extends server.Plugin {
46
45
  initActions__default.default(this);
47
46
  this.app.acl.allow("attachments", "upload", "loggedIn");
48
47
  this.app.acl.allow("attachments", "create", "loggedIn");
49
- if (process.env.APP_ENV !== "production") {
50
- await storages.getStorageConfig(constants.STORAGE_TYPE_LOCAL).middleware(this.app);
51
- }
52
48
  const defaultStorageName = storages.getStorageConfig(this.storageType()).defaults().name;
53
49
  this.app.acl.addFixedParams("storages", "destroy", () => {
54
50
  return {
@@ -1,9 +1,6 @@
1
- import Application from '@nocobase/server';
2
1
  import multer from 'multer';
3
2
  import { AttachmentModel } from '.';
4
- declare function middleware(app: Application): Promise<void>;
5
3
  declare const _default: {
6
- middleware: typeof middleware;
7
4
  make(storage: any): multer.StorageEngine;
8
5
  defaults(): {
9
6
  title: string;
@@ -1,103 +1,24 @@
1
1
  'use strict';
2
2
 
3
3
  var fs = require('fs/promises');
4
- var serve = require('koa-static');
5
4
  var mkdirp = require('mkdirp');
6
5
  var multer = require('multer');
7
6
  var path = require('path');
8
- var url = require('url');
9
7
  var constants = require('../constants');
10
8
  var utils = require('../utils');
11
9
 
12
10
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
13
11
 
14
12
  var fs__default = /*#__PURE__*/_interopDefault(fs);
15
- var serve__default = /*#__PURE__*/_interopDefault(serve);
16
13
  var mkdirp__default = /*#__PURE__*/_interopDefault(mkdirp);
17
14
  var multer__default = /*#__PURE__*/_interopDefault(multer);
18
15
  var path__default = /*#__PURE__*/_interopDefault(path);
19
16
 
20
- function match(basePath, pathname) {
21
- if (!pathname.startsWith(basePath)) {
22
- return false;
23
- }
24
- const newPath = pathname.replace(basePath, "") || "/";
25
- if (basePath.slice(-1) === "/") {
26
- return true;
27
- }
28
- return newPath[0] === "/";
29
- }
30
- async function refresh(app, storages, options) {
31
- const Storage = app.db.getCollection("storages");
32
- const items = await Storage.repository.find({
33
- filter: {
34
- type: constants.STORAGE_TYPE_LOCAL
35
- },
36
- transaction: options == null ? void 0 : options.transaction
37
- });
38
- const primaryKey = Storage.model.primaryKeyAttribute;
39
- storages.clear();
40
- for (const storage of items) {
41
- storages.set(storage[primaryKey], storage);
42
- }
43
- }
44
- function createLocalServerUpdateHook(app, storages) {
45
- return async function(row, options) {
46
- if (row.get("type") === constants.STORAGE_TYPE_LOCAL) {
47
- await refresh(app, storages, options);
48
- }
49
- };
50
- }
51
17
  function getDocumentRoot(storage) {
52
18
  const { documentRoot = process.env.LOCAL_STORAGE_DEST || "storage/uploads" } = storage.options || {};
53
19
  return path__default.default.resolve(path__default.default.isAbsolute(documentRoot) ? documentRoot : path__default.default.join(process.cwd(), documentRoot));
54
20
  }
55
- async function middleware(app) {
56
- const Storage = app.db.getCollection("storages");
57
- const storages = /* @__PURE__ */ new Map();
58
- const localServerUpdateHook = createLocalServerUpdateHook(app, storages);
59
- Storage.model.addHook("afterSave", localServerUpdateHook);
60
- Storage.model.addHook("afterDestroy", localServerUpdateHook);
61
- app.on("beforeStart", async () => {
62
- await refresh(app, storages);
63
- });
64
- app.use(async function(ctx, next) {
65
- var _a;
66
- for (const storage of storages.values()) {
67
- const baseUrl = storage.get("baseUrl").trim();
68
- if (!baseUrl) {
69
- console.error('"baseUrl" is not configured');
70
- continue;
71
- }
72
- let url$1;
73
- try {
74
- url$1 = new url.URL(baseUrl);
75
- } catch (e) {
76
- url$1 = {
77
- pathname: baseUrl
78
- };
79
- }
80
- if (url$1.origin && ((_a = storage == null ? void 0 : storage.options) == null ? void 0 : _a.serve) === false) {
81
- continue;
82
- }
83
- const basePath = url$1.pathname.startsWith("/") ? url$1.pathname : `/${url$1.pathname}`;
84
- if (!match(basePath, ctx.path)) {
85
- continue;
86
- }
87
- ctx.path = ctx.path.replace(basePath, "");
88
- const documentRoot = getDocumentRoot(storage);
89
- return serve__default.default(documentRoot)(ctx, async () => {
90
- if (ctx.status == 404) {
91
- return;
92
- }
93
- await next();
94
- });
95
- }
96
- await next();
97
- });
98
- }
99
21
  var local_default = {
100
- middleware,
101
22
  make(storage) {
102
23
  return multer__default.default.diskStorage({
103
24
  destination: function(req, file, cb) {
@@ -0,0 +1,95 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var openapi = "3.0.2";
6
+ var info = {
7
+ title: "NocoBase API - File manager plugin"
8
+ };
9
+ var tags = [];
10
+ var paths = {
11
+ "/{fileCollectionName}:create": {
12
+ post: {
13
+ tags: ["$collection"],
14
+ description: "",
15
+ parameters: [],
16
+ responses: {
17
+ "200": {
18
+ description: "OK"
19
+ }
20
+ }
21
+ }
22
+ },
23
+ "/storages:list": {
24
+ get: {
25
+ tags: ["storages"],
26
+ description: "",
27
+ parameters: [],
28
+ responses: {
29
+ "200": {
30
+ description: "OK"
31
+ }
32
+ }
33
+ }
34
+ },
35
+ "/storages:get": {
36
+ get: {
37
+ tags: ["storages"],
38
+ description: "",
39
+ parameters: [],
40
+ responses: {
41
+ "200": {
42
+ description: "OK"
43
+ }
44
+ }
45
+ }
46
+ },
47
+ "/storages:create": {
48
+ post: {
49
+ tags: ["storages"],
50
+ description: "",
51
+ parameters: [],
52
+ responses: {
53
+ "200": {
54
+ description: "OK"
55
+ }
56
+ }
57
+ }
58
+ },
59
+ "/storages:update": {
60
+ post: {
61
+ tags: ["storages"],
62
+ description: "",
63
+ parameters: [],
64
+ responses: {
65
+ "200": {
66
+ description: "OK"
67
+ }
68
+ }
69
+ }
70
+ },
71
+ "/storages:destroy": {
72
+ post: {
73
+ tags: ["storages"],
74
+ description: "",
75
+ parameters: [],
76
+ responses: {
77
+ "200": {
78
+ description: "OK"
79
+ }
80
+ }
81
+ }
82
+ }
83
+ };
84
+ var swagger_default = {
85
+ openapi,
86
+ info,
87
+ tags,
88
+ paths
89
+ };
90
+
91
+ exports.default = swagger_default;
92
+ exports.info = info;
93
+ exports.openapi = openapi;
94
+ exports.paths = paths;
95
+ exports.tags = tags;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-file-manager",
3
- "version": "0.12.0-alpha.5",
3
+ "version": "0.13.0-alpha.2",
4
4
  "displayName": "File manager",
5
5
  "displayName.zh-CN": "文件管理器",
6
6
  "description": "file management plugin.",
@@ -37,5 +37,5 @@
37
37
  "@nocobase/test": "0.x",
38
38
  "@nocobase/utils": "0.x"
39
39
  },
40
- "gitHead": "689cc16e83361c4d0b91907e0deac30bdb907692"
40
+ "gitHead": "c43183b714350217788cf0466e1f32bcaa527302"
41
41
  }