@nocobase/plugin-file-manager 2.1.0-beta.37 → 2.1.0-beta.38

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.
Files changed (51) hide show
  1. package/dist/client/867ada653cd02a3e.mjs +6 -0
  2. package/dist/client/index.js +1 -1
  3. package/dist/client-v2/867ada653cd02a3e.mjs +6 -0
  4. package/dist/client-v2/index.js +1 -1
  5. package/dist/externalVersion.js +9 -9
  6. package/dist/locale/de-DE.json +3 -0
  7. package/dist/locale/en-US.json +3 -0
  8. package/dist/locale/es-ES.json +3 -0
  9. package/dist/locale/fr-FR.json +3 -0
  10. package/dist/locale/hu-HU.json +4 -1
  11. package/dist/locale/id-ID.json +4 -1
  12. package/dist/locale/it-IT.json +3 -0
  13. package/dist/locale/ja-JP.json +3 -0
  14. package/dist/locale/ko-KR.json +3 -0
  15. package/dist/locale/nl-NL.json +3 -0
  16. package/dist/locale/pt-BR.json +3 -0
  17. package/dist/locale/ru-RU.json +3 -0
  18. package/dist/locale/tr-TR.json +3 -0
  19. package/dist/locale/uk-UA.json +3 -0
  20. package/dist/locale/vi-VN.json +4 -1
  21. package/dist/locale/zh-CN.json +3 -0
  22. package/dist/locale/zh-TW.json +3 -0
  23. package/dist/node_modules/@aws-sdk/client-s3/package.json +1 -1
  24. package/dist/node_modules/@aws-sdk/lib-storage/package.json +1 -1
  25. package/dist/node_modules/ali-oss/package.json +1 -1
  26. package/dist/node_modules/cos-nodejs-sdk-v5/package.json +1 -1
  27. package/dist/node_modules/mime-match/package.json +1 -1
  28. package/dist/node_modules/mime-types/package.json +1 -1
  29. package/dist/node_modules/mkdirp/package.json +1 -1
  30. package/dist/node_modules/pdfjs-dist/package.json +1 -1
  31. package/dist/node_modules/url-join/package.json +1 -1
  32. package/dist/server/commands/repair-filenames.d.ts +55 -0
  33. package/dist/server/commands/repair-filenames.js +283 -0
  34. package/dist/server/server.d.ts +1 -0
  35. package/dist/server/server.js +4 -0
  36. package/dist/server/storages/ali-oss.d.ts +3 -1
  37. package/dist/server/storages/ali-oss.js +23 -2
  38. package/dist/server/storages/index.d.ts +3 -0
  39. package/dist/server/storages/index.js +6 -0
  40. package/dist/server/storages/local.d.ts +2 -0
  41. package/dist/server/storages/local.js +18 -0
  42. package/dist/server/storages/s3.d.ts +2 -0
  43. package/dist/server/storages/s3.js +26 -0
  44. package/dist/server/storages/tx-cos.d.ts +2 -0
  45. package/dist/server/storages/tx-cos.js +27 -0
  46. package/dist/server/utils.js +12 -2
  47. package/dist/shared/previewer/filePreviewTypes.d.ts +3 -0
  48. package/dist/shared/previewer/filePreviewTypes.js +86 -26
  49. package/package.json +5 -3
  50. package/dist/client/764.96d72bc6fd4adb28.js +0 -15
  51. package/dist/client-v2/764.d5a27ea47a2d3239.js +0 -15
@@ -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":"2026-05-26T00:45:25.053Z"}
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":"2026-05-29T02:53:14.086Z"}
@@ -1 +1 @@
1
- {"name":"@aws-sdk/lib-storage","version":"3.750.0","description":"Storage higher order operation","main":"./dist-cjs/index.js","module":"./dist-es/index.js","types":"./dist-types/index.d.ts","scripts":{"build":"concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'","build:cjs":"node ../../scripts/compilation/inline lib-storage","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","test":"yarn g:vitest run","test:e2e":"yarn g:vitest run -c vitest.config.e2e.ts --mode development","test:watch":"yarn g:vitest watch","test:e2e:watch":"yarn g:vitest watch -c vitest.config.e2e.ts"},"engines":{"node":">=18.0.0"},"author":{"name":"AWS SDK for JavaScript Team","url":"https://aws.amazon.com/javascript/"},"license":"Apache-2.0","dependencies":{"@smithy/abort-controller":"^4.0.1","@smithy/middleware-endpoint":"^4.0.5","@smithy/smithy-client":"^4.1.5","buffer":"5.6.0","events":"3.3.0","stream-browserify":"3.0.0","tslib":"^2.6.2"},"peerDependencies":{"@aws-sdk/client-s3":"^3.750.0"},"devDependencies":{"@aws-sdk/client-s3":"3.750.0","@smithy/types":"^4.1.0","@tsconfig/recommended":"1.0.1","@types/node":"^18.19.69","concurrently":"7.0.0","downlevel-dts":"0.10.1","rimraf":"3.0.2","typescript":"~5.2.2","web-streams-polyfill":"3.2.1"},"typesVersions":{"<4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},"browser":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser","fs":false,"stream":"stream-browserify"},"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},"files":["dist-*/**"],"homepage":"https://github.com/aws/aws-sdk-js-v3/tree/main/lib/lib-storage","repository":{"type":"git","url":"https://github.com/aws/aws-sdk-js-v3.git","directory":"lib/lib-storage"},"_lastModified":"2026-05-26T00:45:26.103Z"}
1
+ {"name":"@aws-sdk/lib-storage","version":"3.750.0","description":"Storage higher order operation","main":"./dist-cjs/index.js","module":"./dist-es/index.js","types":"./dist-types/index.d.ts","scripts":{"build":"concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'","build:cjs":"node ../../scripts/compilation/inline lib-storage","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","test":"yarn g:vitest run","test:e2e":"yarn g:vitest run -c vitest.config.e2e.ts --mode development","test:watch":"yarn g:vitest watch","test:e2e:watch":"yarn g:vitest watch -c vitest.config.e2e.ts"},"engines":{"node":">=18.0.0"},"author":{"name":"AWS SDK for JavaScript Team","url":"https://aws.amazon.com/javascript/"},"license":"Apache-2.0","dependencies":{"@smithy/abort-controller":"^4.0.1","@smithy/middleware-endpoint":"^4.0.5","@smithy/smithy-client":"^4.1.5","buffer":"5.6.0","events":"3.3.0","stream-browserify":"3.0.0","tslib":"^2.6.2"},"peerDependencies":{"@aws-sdk/client-s3":"^3.750.0"},"devDependencies":{"@aws-sdk/client-s3":"3.750.0","@smithy/types":"^4.1.0","@tsconfig/recommended":"1.0.1","@types/node":"^18.19.69","concurrently":"7.0.0","downlevel-dts":"0.10.1","rimraf":"3.0.2","typescript":"~5.2.2","web-streams-polyfill":"3.2.1"},"typesVersions":{"<4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},"browser":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser","fs":false,"stream":"stream-browserify"},"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},"files":["dist-*/**"],"homepage":"https://github.com/aws/aws-sdk-js-v3/tree/main/lib/lib-storage","repository":{"type":"git","url":"https://github.com/aws/aws-sdk-js-v3.git","directory":"lib/lib-storage"},"_lastModified":"2026-05-29T02:53:15.097Z"}
@@ -1 +1 @@
1
- {"name":"ali-oss","version":"6.20.0","description":"aliyun oss(object storage service) node client","main":"./lib/client.js","files":["lib","shims","dist"],"browser":{"./lib/client.js":"./dist/aliyun-oss-sdk.js","mime":"mime/lite","urllib":"./shims/xhr.js","utility":"./shims/utility.js","crypto":"./shims/crypto/crypto.js","debug":"./shims/debug","fs":false,"child_process":false,"is-type-of":"./shims/is-type-of.js"},"scripts":{"build-change-log":"standard-version","test":"npm run tsc && mocha -t 120000 -r should -r dotenv/config test/node/*.test.js test/node/**/*.test.js","test-cov":"npm run tsc && nyc --reporter=lcov node_modules/.bin/_mocha -t 120000 -r should test/node/*.test.js test/node/**/*.test.js","jshint":"jshint .","build-test":"MINIFY=1 node browser-build.js > test/browser/build/aliyun-oss-sdk.min.js && node -r dotenv/config task/browser-test-build.js > test/browser/build/tests.js","browser-test":"npm run build-test && karma start","build-dist":"npm run tsc && node browser-build.js > dist/aliyun-oss-sdk.js && MINIFY=1 node browser-build.js > dist/aliyun-oss-sdk.min.js","publish-to-npm":"node publish-npm-check.js && npm publish","publish-to-cdn":"node publish.js","snyk-protect":"snyk-protect","lint-staged":"lint-staged","detect-secrets":"node task/detect-secrets","tsc":"npm run tsc:clean && npm run tsc:build","tsc:build":"tsc -b tsconfig.json tsconfig-cjs.json","tsc:watch":"tsc -b tsconfig.json tsconfig-cjs.json --watch","tsc:clean":"tsc -b tsconfig.json tsconfig-cjs.json --clean ","prepare":"husky install"},"git-pre-hooks":{"pre-release":"npm run build-dist","post-release":["npm run publish-to-npm","npm run publish-to-cdn"]},"homepage":"https://github.com/ali-sdk/ali-oss","bugs":{"url":"https://github.com/ali-sdk/ali-oss/issues"},"publishConfig":{"registry":"https://registry.npmjs.org/","access":"public"},"repository":{"type":"git","url":"https://github.com/ali-sdk/ali-oss.git"},"keywords":["oss","client","file","aliyun"],"author":"dead_horse","license":"MIT","engines":{"node":">=8"},"devDependencies":{"@babel/core":"^7.11.6","@babel/plugin-transform-regenerator":"^7.10.4","@babel/plugin-transform-runtime":"^7.11.5","@babel/preset-env":"^7.11.5","@babel/runtime":"^7.11.2","@commitlint/cli":"^17.6.7","@commitlint/config-conventional":"^16.2.4","@octokit/core":"^5.0.0","@semantic-release/exec":"^6.0.3","@semantic-release/git":"^10.0.1","@semantic-release/npm":"^10.0.5","@snyk/protect":"^1.1196.0","@types/node":"^14.0.12","@typescript-eslint/eslint-plugin":"^5.0.0","@typescript-eslint/parser":"^5.0.0","aliasify":"^2.0.0","axios":"0.27.2","babelify":"^10.0.0","beautify-benchmark":"^0.2.4","benchmark":"^2.1.1","bluebird":"^3.1.5","browserify":"^17.0.0","core-js":"^3.6.5","crypto-js":"^3.1.9-1","dotenv":"^8.2.0","eslint":"^8.44.0","eslint-config-airbnb":"^19.0.4","eslint-config-ali":"^13.0.0","eslint-config-prettier":"^8.8.0","eslint-plugin-import":"^2.21.1","eslint-plugin-jsx-a11y":"^6.0.3","eslint-plugin-prettier":"^4.2.1","filereader":"^0.10.3","form-data":"^4.0.0","git-pre-hooks":"^1.2.0","husky":"^7.0.4","immediate":"^3.3.0","karma":"^6.3.4","karma-browserify":"^8.1.0","karma-chrome-launcher":"^2.2.0","karma-firefox-launcher":"^1.0.1","karma-ie-launcher":"^1.0.0","karma-mocha":"^2.0.1","karma-safari-launcher":"^1.0.0","lint-staged":"^12.4.1","mm":"^2.0.0","mocha":"^9.1.2","nyc":"^15.1.0","prettier":"^3.0.0","promise-polyfill":"^6.0.2","puppeteer":"19.0.0","semantic-release":"^21.1.1","should":"^11.0.0","sinon":"^15.2.0","standard-version":"^9.3.1","stream-equal":"^1.1.0","timemachine":"^0.3.0","typescript":"^3.9.5","uglify-js":"^3.14.2","watchify":"^4.0.0"},"dependencies":{"address":"^1.2.2","agentkeepalive":"^3.4.1","bowser":"^1.6.0","copy-to":"^2.0.1","dateformat":"^2.0.0","debug":"^4.3.4","destroy":"^1.0.4","end-or-error":"^1.0.1","get-ready":"^1.0.0","humanize-ms":"^1.2.0","is-type-of":"^1.4.0","js-base64":"^2.5.2","jstoxml":"^2.0.0","lodash":"^4.17.21","merge-descriptors":"^1.0.1","mime":"^2.4.5","platform":"^1.3.1","pump":"^3.0.0","qs":"^6.4.0","sdk-base":"^2.0.1","stream-http":"2.8.2","stream-wormhole":"^1.0.4","urllib":"2.41.0","utility":"^1.18.0","xml2js":"^0.6.2"},"snyk":true,"lint-staged":{"**/!(dist)/*":["npm run detect-secrets --"],"**/*.{js,ts}":["eslint --cache --fix --ext .js,.ts","prettier --write","git add"]},"_lastModified":"2026-05-26T00:45:23.433Z"}
1
+ {"name":"ali-oss","version":"6.20.0","description":"aliyun oss(object storage service) node client","main":"./lib/client.js","files":["lib","shims","dist"],"browser":{"./lib/client.js":"./dist/aliyun-oss-sdk.js","mime":"mime/lite","urllib":"./shims/xhr.js","utility":"./shims/utility.js","crypto":"./shims/crypto/crypto.js","debug":"./shims/debug","fs":false,"child_process":false,"is-type-of":"./shims/is-type-of.js"},"scripts":{"build-change-log":"standard-version","test":"npm run tsc && mocha -t 120000 -r should -r dotenv/config test/node/*.test.js test/node/**/*.test.js","test-cov":"npm run tsc && nyc --reporter=lcov node_modules/.bin/_mocha -t 120000 -r should test/node/*.test.js test/node/**/*.test.js","jshint":"jshint .","build-test":"MINIFY=1 node browser-build.js > test/browser/build/aliyun-oss-sdk.min.js && node -r dotenv/config task/browser-test-build.js > test/browser/build/tests.js","browser-test":"npm run build-test && karma start","build-dist":"npm run tsc && node browser-build.js > dist/aliyun-oss-sdk.js && MINIFY=1 node browser-build.js > dist/aliyun-oss-sdk.min.js","publish-to-npm":"node publish-npm-check.js && npm publish","publish-to-cdn":"node publish.js","snyk-protect":"snyk-protect","lint-staged":"lint-staged","detect-secrets":"node task/detect-secrets","tsc":"npm run tsc:clean && npm run tsc:build","tsc:build":"tsc -b tsconfig.json tsconfig-cjs.json","tsc:watch":"tsc -b tsconfig.json tsconfig-cjs.json --watch","tsc:clean":"tsc -b tsconfig.json tsconfig-cjs.json --clean ","prepare":"husky install"},"git-pre-hooks":{"pre-release":"npm run build-dist","post-release":["npm run publish-to-npm","npm run publish-to-cdn"]},"homepage":"https://github.com/ali-sdk/ali-oss","bugs":{"url":"https://github.com/ali-sdk/ali-oss/issues"},"publishConfig":{"registry":"https://registry.npmjs.org/","access":"public"},"repository":{"type":"git","url":"https://github.com/ali-sdk/ali-oss.git"},"keywords":["oss","client","file","aliyun"],"author":"dead_horse","license":"MIT","engines":{"node":">=8"},"devDependencies":{"@babel/core":"^7.11.6","@babel/plugin-transform-regenerator":"^7.10.4","@babel/plugin-transform-runtime":"^7.11.5","@babel/preset-env":"^7.11.5","@babel/runtime":"^7.11.2","@commitlint/cli":"^17.6.7","@commitlint/config-conventional":"^16.2.4","@octokit/core":"^5.0.0","@semantic-release/exec":"^6.0.3","@semantic-release/git":"^10.0.1","@semantic-release/npm":"^10.0.5","@snyk/protect":"^1.1196.0","@types/node":"^14.0.12","@typescript-eslint/eslint-plugin":"^5.0.0","@typescript-eslint/parser":"^5.0.0","aliasify":"^2.0.0","axios":"0.27.2","babelify":"^10.0.0","beautify-benchmark":"^0.2.4","benchmark":"^2.1.1","bluebird":"^3.1.5","browserify":"^17.0.0","core-js":"^3.6.5","crypto-js":"^3.1.9-1","dotenv":"^8.2.0","eslint":"^8.44.0","eslint-config-airbnb":"^19.0.4","eslint-config-ali":"^13.0.0","eslint-config-prettier":"^8.8.0","eslint-plugin-import":"^2.21.1","eslint-plugin-jsx-a11y":"^6.0.3","eslint-plugin-prettier":"^4.2.1","filereader":"^0.10.3","form-data":"^4.0.0","git-pre-hooks":"^1.2.0","husky":"^7.0.4","immediate":"^3.3.0","karma":"^6.3.4","karma-browserify":"^8.1.0","karma-chrome-launcher":"^2.2.0","karma-firefox-launcher":"^1.0.1","karma-ie-launcher":"^1.0.0","karma-mocha":"^2.0.1","karma-safari-launcher":"^1.0.0","lint-staged":"^12.4.1","mm":"^2.0.0","mocha":"^9.1.2","nyc":"^15.1.0","prettier":"^3.0.0","promise-polyfill":"^6.0.2","puppeteer":"19.0.0","semantic-release":"^21.1.1","should":"^11.0.0","sinon":"^15.2.0","standard-version":"^9.3.1","stream-equal":"^1.1.0","timemachine":"^0.3.0","typescript":"^3.9.5","uglify-js":"^3.14.2","watchify":"^4.0.0"},"dependencies":{"address":"^1.2.2","agentkeepalive":"^3.4.1","bowser":"^1.6.0","copy-to":"^2.0.1","dateformat":"^2.0.0","debug":"^4.3.4","destroy":"^1.0.4","end-or-error":"^1.0.1","get-ready":"^1.0.0","humanize-ms":"^1.2.0","is-type-of":"^1.4.0","js-base64":"^2.5.2","jstoxml":"^2.0.0","lodash":"^4.17.21","merge-descriptors":"^1.0.1","mime":"^2.4.5","platform":"^1.3.1","pump":"^3.0.0","qs":"^6.4.0","sdk-base":"^2.0.1","stream-http":"2.8.2","stream-wormhole":"^1.0.4","urllib":"2.41.0","utility":"^1.18.0","xml2js":"^0.6.2"},"snyk":true,"lint-staged":{"**/!(dist)/*":["npm run detect-secrets --"],"**/*.{js,ts}":["eslint --cache --fix --ext .js,.ts","prettier --write","git add"]},"_lastModified":"2026-05-29T02:53:12.581Z"}
@@ -1 +1 @@
1
- {"name":"cos-nodejs-sdk-v5","version":"2.12.6","description":"cos nodejs sdk v5","main":"index.js","types":"index.d.ts","scripts":{"prettier":"prettier --write sdk demo/demo.js test/test.js index.d.ts","demo":"node demo/demo.js","demo-sts":"node demo/demo-sts.js","demo-sts-scope":"node demo/demo-sts-scope.js","test":"mocha test/test.js","cov":"istanbul cover _mocha -- -u exports 'test/test.js'","nyc":"nyc --reporter=clover --reporter=cobertura mocha --reporter xunit --reporter-options output=mocha.xml test/test.js","csp":"mocha test/csp.js"},"repository":{"type":"git","url":"git+https://github.com/tencentyun/cos-nodejs-sdk-v5.git"},"keywords":["tencent","tencent cloud","qcloud","cos","cos-sdk"],"author":"carsonxu","license":"ISC","bugs":{"url":"https://github.com/tencentyun/cos-nodejs-sdk-v5/issues"},"homepage":"https://github.com/tencentyun/cos-nodejs-sdk-v5#readme","dependencies":{"conf":"^9.0.0","fast-xml-parser":"4.2.5","mime-types":"^2.1.24","request":"^2.88.2"},"devDependencies":{"@types/node":"^14.14.20","batch":"^0.6.1","crc64-ecma182.js":"^1.0.0","mocha":"^4.0.1","nyc":"^15.1.0","prettier":"^3.0.1","qcloud-cos-sts":"^3.0.0"},"engines":{"node":">= 6"},"_lastModified":"2026-05-26T00:45:29.535Z"}
1
+ {"name":"cos-nodejs-sdk-v5","version":"2.12.6","description":"cos nodejs sdk v5","main":"index.js","types":"index.d.ts","scripts":{"prettier":"prettier --write sdk demo/demo.js test/test.js index.d.ts","demo":"node demo/demo.js","demo-sts":"node demo/demo-sts.js","demo-sts-scope":"node demo/demo-sts-scope.js","test":"mocha test/test.js","cov":"istanbul cover _mocha -- -u exports 'test/test.js'","nyc":"nyc --reporter=clover --reporter=cobertura mocha --reporter xunit --reporter-options output=mocha.xml test/test.js","csp":"mocha test/csp.js"},"repository":{"type":"git","url":"git+https://github.com/tencentyun/cos-nodejs-sdk-v5.git"},"keywords":["tencent","tencent cloud","qcloud","cos","cos-sdk"],"author":"carsonxu","license":"ISC","bugs":{"url":"https://github.com/tencentyun/cos-nodejs-sdk-v5/issues"},"homepage":"https://github.com/tencentyun/cos-nodejs-sdk-v5#readme","dependencies":{"conf":"^9.0.0","fast-xml-parser":"4.2.5","mime-types":"^2.1.24","request":"^2.88.2"},"devDependencies":{"@types/node":"^14.14.20","batch":"^0.6.1","crc64-ecma182.js":"^1.0.0","mocha":"^4.0.1","nyc":"^15.1.0","prettier":"^3.0.1","qcloud-cos-sts":"^3.0.0"},"engines":{"node":">= 6"},"_lastModified":"2026-05-29T02:53:18.313Z"}
@@ -1 +1 @@
1
- {"name":"mime-match","version":"1.0.2","description":"A simple function to check whether a mimetype matches the specified mimetype (with wildcard support)","main":"index.js","scripts":{"test":"node test.js","gendocs":"gendocs > README.md"},"repository":{"type":"git","url":"https://github.com/DamonOehlman/mime-match.git"},"keywords":["mime","wildcard"],"author":"Damon Oehlman <damon.oehlman@gmail.com>","license":"ISC","bugs":{"url":"https://github.com/DamonOehlman/mime-match/issues"},"homepage":"https://github.com/DamonOehlman/mime-match","dependencies":{"wildcard":"^1.1.0"},"devDependencies":{"tape":"^4.5.1"},"_lastModified":"2026-05-26T00:45:18.830Z"}
1
+ {"name":"mime-match","version":"1.0.2","description":"A simple function to check whether a mimetype matches the specified mimetype (with wildcard support)","main":"index.js","scripts":{"test":"node test.js","gendocs":"gendocs > README.md"},"repository":{"type":"git","url":"https://github.com/DamonOehlman/mime-match.git"},"keywords":["mime","wildcard"],"author":"Damon Oehlman <damon.oehlman@gmail.com>","license":"ISC","bugs":{"url":"https://github.com/DamonOehlman/mime-match/issues"},"homepage":"https://github.com/DamonOehlman/mime-match","dependencies":{"wildcard":"^1.1.0"},"devDependencies":{"tape":"^4.5.1"},"_lastModified":"2026-05-29T02:53:08.243Z"}
@@ -1 +1 @@
1
- {"name":"mime-types","description":"The ultimate javascript content-type utility.","version":"3.0.1","contributors":["Douglas Christopher Wilson <doug@somethingdoug.com>","Jeremiah Senkpiel <fishrock123@rocketmail.com> (https://searchbeam.jit.su)","Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)"],"license":"MIT","keywords":["mime","types"],"repository":"jshttp/mime-types","dependencies":{"mime-db":"^1.54.0"},"devDependencies":{"eslint":"8.33.0","eslint-config-standard":"14.1.1","eslint-plugin-import":"2.27.5","eslint-plugin-markdown":"3.0.0","eslint-plugin-node":"11.1.0","eslint-plugin-promise":"6.1.1","eslint-plugin-standard":"4.1.0","mocha":"10.2.0","nyc":"15.1.0"},"files":["HISTORY.md","LICENSE","index.js","mimeScore.js"],"engines":{"node":">= 0.6"},"scripts":{"lint":"eslint .","test":"mocha --reporter spec test/test.js","test-ci":"nyc --reporter=lcov --reporter=text npm test","test-cov":"nyc --reporter=html --reporter=text npm test"},"_lastModified":"2026-05-26T00:45:19.128Z"}
1
+ {"name":"mime-types","description":"The ultimate javascript content-type utility.","version":"3.0.1","contributors":["Douglas Christopher Wilson <doug@somethingdoug.com>","Jeremiah Senkpiel <fishrock123@rocketmail.com> (https://searchbeam.jit.su)","Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)"],"license":"MIT","keywords":["mime","types"],"repository":"jshttp/mime-types","dependencies":{"mime-db":"^1.54.0"},"devDependencies":{"eslint":"8.33.0","eslint-config-standard":"14.1.1","eslint-plugin-import":"2.27.5","eslint-plugin-markdown":"3.0.0","eslint-plugin-node":"11.1.0","eslint-plugin-promise":"6.1.1","eslint-plugin-standard":"4.1.0","mocha":"10.2.0","nyc":"15.1.0"},"files":["HISTORY.md","LICENSE","index.js","mimeScore.js"],"engines":{"node":">= 0.6"},"scripts":{"lint":"eslint .","test":"mocha --reporter spec test/test.js","test-ci":"nyc --reporter=lcov --reporter=text npm test","test-cov":"nyc --reporter=html --reporter=text npm test"},"_lastModified":"2026-05-29T02:53:08.533Z"}
@@ -1 +1 @@
1
- {"name":"mkdirp","description":"Recursively mkdir, like `mkdir -p`","version":"0.5.6","publishConfig":{"tag":"legacy"},"author":"James Halliday <mail@substack.net> (http://substack.net)","main":"index.js","keywords":["mkdir","directory"],"repository":{"type":"git","url":"https://github.com/substack/node-mkdirp.git"},"scripts":{"test":"tap test/*.js"},"dependencies":{"minimist":"^1.2.6"},"devDependencies":{"tap":"^16.0.1"},"bin":"bin/cmd.js","license":"MIT","files":["bin","index.js"],"_lastModified":"2026-05-26T00:45:23.630Z"}
1
+ {"name":"mkdirp","description":"Recursively mkdir, like `mkdir -p`","version":"0.5.6","publishConfig":{"tag":"legacy"},"author":"James Halliday <mail@substack.net> (http://substack.net)","main":"index.js","keywords":["mkdir","directory"],"repository":{"type":"git","url":"https://github.com/substack/node-mkdirp.git"},"scripts":{"test":"tap test/*.js"},"dependencies":{"minimist":"^1.2.6"},"devDependencies":{"tap":"^16.0.1"},"bin":"bin/cmd.js","license":"MIT","files":["bin","index.js"],"_lastModified":"2026-05-29T02:53:12.754Z"}
@@ -1 +1 @@
1
- {"name":"pdfjs-dist","version":"5.4.624","main":"build/pdf.mjs","types":"types/src/pdf.d.ts","description":"Generic build of Mozilla's PDF.js library.","keywords":["Mozilla","pdf","pdf.js"],"homepage":"https://mozilla.github.io/pdf.js/","bugs":"https://github.com/mozilla/pdf.js/issues","license":"Apache-2.0","optionalDependencies":{"@napi-rs/canvas":"^0.1.88","node-readable-to-web-readable-stream":"^0.4.2"},"browser":{"canvas":false,"fs":false,"http":false,"https":false,"url":false},"repository":{"type":"git","url":"git+https://github.com/mozilla/pdf.js.git"},"engines":{"node":">=20.16.0 || >=22.3.0"},"scripts":{},"_lastModified":"2026-05-26T00:45:30.262Z"}
1
+ {"name":"pdfjs-dist","version":"5.4.624","main":"build/pdf.mjs","types":"types/src/pdf.d.ts","description":"Generic build of Mozilla's PDF.js library.","keywords":["Mozilla","pdf","pdf.js"],"homepage":"https://mozilla.github.io/pdf.js/","bugs":"https://github.com/mozilla/pdf.js/issues","license":"Apache-2.0","optionalDependencies":{"@napi-rs/canvas":"^0.1.88","node-readable-to-web-readable-stream":"^0.4.2"},"browser":{"canvas":false,"fs":false,"http":false,"https":false,"url":false},"repository":{"type":"git","url":"git+https://github.com/mozilla/pdf.js.git"},"engines":{"node":">=20.16.0 || >=22.3.0"},"scripts":{},"_lastModified":"2026-05-29T02:53:18.995Z"}
@@ -1 +1 @@
1
- {"name":"url-join","version":"4.0.1","description":"Join urls and normalize as in path.join.","main":"lib/url-join.js","scripts":{"test":"mocha --require should"},"repository":{"type":"git","url":"git://github.com/jfromaniello/url-join.git"},"keywords":["url","join"],"author":"José F. Romaniello <jfromaniello@gmail.com> (http://joseoncode.com)","license":"MIT","devDependencies":{"conventional-changelog":"^1.1.10","mocha":"^3.2.0","should":"~1.2.1"},"_lastModified":"2026-05-26T00:45:18.931Z"}
1
+ {"name":"url-join","version":"4.0.1","description":"Join urls and normalize as in path.join.","main":"lib/url-join.js","scripts":{"test":"mocha --require should"},"repository":{"type":"git","url":"git://github.com/jfromaniello/url-join.git"},"keywords":["url","join"],"author":"José F. Romaniello <jfromaniello@gmail.com> (http://joseoncode.com)","license":"MIT","devDependencies":{"conventional-changelog":"^1.1.10","mocha":"^3.2.0","should":"~1.2.1"},"_lastModified":"2026-05-29T02:53:08.348Z"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import { Application } from '@nocobase/server';
10
+ import { AttachmentModel, StorageClassType, StorageModel } from '../storages';
11
+ export type RepairFilenameStatus = 'pending' | 'repaired' | 'skipped' | 'failed';
12
+ export interface RepairFilenameItem {
13
+ collectionName: string;
14
+ id: number | string;
15
+ storageId: number | string;
16
+ storageType: string;
17
+ oldPath: string;
18
+ oldFilename: string;
19
+ newPath: string;
20
+ newFilename: string;
21
+ oldKey: string;
22
+ newKey: string;
23
+ sourceExists?: boolean;
24
+ targetExists?: boolean;
25
+ status: RepairFilenameStatus;
26
+ reason?: string;
27
+ }
28
+ export interface RepairFilenamesOptions {
29
+ apply?: boolean;
30
+ batchSize?: number;
31
+ limit?: number;
32
+ }
33
+ export interface RepairFilenamesResult {
34
+ dryRun: boolean;
35
+ scanned: number;
36
+ candidates: RepairFilenameItem[];
37
+ repaired: RepairFilenameItem[];
38
+ skipped: RepairFilenameItem[];
39
+ failed: RepairFilenameItem[];
40
+ }
41
+ interface FileManagerLike {
42
+ storageTypes: {
43
+ get(type: string): StorageClassType | undefined;
44
+ };
45
+ loadStorages(): Promise<void>;
46
+ storagesCache: Map<number | string, StorageModel>;
47
+ }
48
+ export declare function replaceInvisibleChars(value?: string | null): string;
49
+ export declare function getRepairedAttachmentValues(record: Pick<AttachmentModel, 'path' | 'filename'>): {
50
+ path: string;
51
+ filename: string;
52
+ };
53
+ export declare function repairAttachmentFilenames(app: Application, fileManager: FileManagerLike, options?: RepairFilenamesOptions): Promise<RepairFilenamesResult>;
54
+ export declare function registerRepairFilenamesCommand(app: Application): void;
55
+ export {};
@@ -0,0 +1,283 @@
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 repair_filenames_exports = {};
28
+ __export(repair_filenames_exports, {
29
+ getRepairedAttachmentValues: () => getRepairedAttachmentValues,
30
+ registerRepairFilenamesCommand: () => registerRepairFilenamesCommand,
31
+ repairAttachmentFilenames: () => repairAttachmentFilenames,
32
+ replaceInvisibleChars: () => replaceInvisibleChars
33
+ });
34
+ module.exports = __toCommonJS(repair_filenames_exports);
35
+ var import_sequelize = require("sequelize");
36
+ var import_utils = require("../utils");
37
+ function containsInvisibleChars(value) {
38
+ return Array.from(value || "").some((char) => {
39
+ const code = char.charCodeAt(0);
40
+ return code <= 31 || code >= 127 && code <= 159;
41
+ });
42
+ }
43
+ function replaceInvisibleChars(value) {
44
+ return Array.from(value || "").map((char) => {
45
+ const code = char.charCodeAt(0);
46
+ return code <= 31 || code >= 127 && code <= 159 ? "-" : char;
47
+ }).join("");
48
+ }
49
+ function getRepairedAttachmentValues(record) {
50
+ return {
51
+ path: replaceInvisibleChars(record.path),
52
+ filename: replaceInvisibleChars(record.filename)
53
+ };
54
+ }
55
+ function updateUrlValue(url, oldKey, newKey) {
56
+ if (!url) {
57
+ return url;
58
+ }
59
+ const encodedOldKey = oldKey.split("/").map((segment) => encodeURIComponent(segment)).join("/");
60
+ const encodedNewKey = newKey.split("/").map((segment) => encodeURIComponent(segment)).join("/");
61
+ return url.split(oldKey).join(newKey).split(encodedOldKey).join(encodedNewKey);
62
+ }
63
+ function formatItem(item) {
64
+ return {
65
+ collectionName: item.collectionName,
66
+ id: item.id,
67
+ storageId: item.storageId,
68
+ storageType: item.storageType,
69
+ oldKey: item.oldKey,
70
+ newKey: item.newKey,
71
+ sourceExists: item.sourceExists,
72
+ targetExists: item.targetExists,
73
+ status: item.status,
74
+ reason: item.reason
75
+ };
76
+ }
77
+ async function getFileCollectionNames(app) {
78
+ var _a;
79
+ const repository = app.db.getRepository("collections") || ((_a = app.db.getCollection("collections")) == null ? void 0 : _a.repository);
80
+ if (repository) {
81
+ const collections = await repository.find({
82
+ filter: {
83
+ "options.template": "file"
84
+ }
85
+ });
86
+ return Array.from(/* @__PURE__ */ new Set(["attachments", ...collections.map((collection) => collection.get("name"))]));
87
+ }
88
+ return Array.from(
89
+ /* @__PURE__ */ new Set([
90
+ "attachments",
91
+ ...Array.from(app.db.collections.values()).filter((collection) => collection.options.template === "file").map((collection) => collection.name)
92
+ ])
93
+ );
94
+ }
95
+ async function loadFileCollections(app) {
96
+ var _a, _b;
97
+ const collection = app.db.getCollection("collections");
98
+ if (!collection) {
99
+ return;
100
+ }
101
+ const repository = collection.repository;
102
+ await ((_a = repository.setApp) == null ? void 0 : _a.call(repository, app));
103
+ await ((_b = repository.load) == null ? void 0 : _b.call(repository));
104
+ }
105
+ async function repairCollectionAttachmentFilenames({
106
+ app,
107
+ fileManager,
108
+ collectionName,
109
+ result,
110
+ apply,
111
+ batchSize,
112
+ limit
113
+ }) {
114
+ const collection = app.db.getCollection(collectionName);
115
+ if (!collection) {
116
+ return;
117
+ }
118
+ const Model = collection.model;
119
+ let lastId = null;
120
+ while (result.scanned < limit) {
121
+ const rows = await Model.findAll({
122
+ attributes: ["id", "path", "filename", "storageId", "url"],
123
+ where: lastId ? { id: { [import_sequelize.Op.gt]: lastId } } : void 0,
124
+ order: [["id", "ASC"]],
125
+ limit: Math.min(batchSize, limit - result.scanned)
126
+ });
127
+ if (!rows.length) {
128
+ break;
129
+ }
130
+ for (const row of rows) {
131
+ result.scanned += 1;
132
+ lastId = row.get("id");
133
+ const record = row.toJSON();
134
+ if (!containsInvisibleChars(record.path) && !containsInvisibleChars(record.filename)) {
135
+ continue;
136
+ }
137
+ const storage = fileManager.storagesCache.get(record.storageId);
138
+ const { path: newPath, filename: newFilename } = getRepairedAttachmentValues(record);
139
+ const oldKey = (0, import_utils.getFileKey)(record);
140
+ const newRecord = { ...record, path: newPath, filename: newFilename };
141
+ const newKey = (0, import_utils.getFileKey)(newRecord);
142
+ const item = {
143
+ collectionName,
144
+ id: lastId,
145
+ storageId: record.storageId,
146
+ storageType: (storage == null ? void 0 : storage.type) || "",
147
+ oldPath: record.path || "",
148
+ oldFilename: record.filename,
149
+ newPath,
150
+ newFilename,
151
+ oldKey,
152
+ newKey,
153
+ status: "pending"
154
+ };
155
+ result.candidates.push(item);
156
+ if (!storage) {
157
+ item.status = "skipped";
158
+ item.reason = "storage_not_found";
159
+ result.skipped.push(item);
160
+ continue;
161
+ }
162
+ if (oldKey === newKey) {
163
+ item.status = "skipped";
164
+ item.reason = "unchanged";
165
+ result.skipped.push(item);
166
+ continue;
167
+ }
168
+ try {
169
+ const StorageClass = fileManager.storageTypes.get(storage.type);
170
+ if (!StorageClass) {
171
+ item.status = "skipped";
172
+ item.reason = "storage_type_not_found";
173
+ result.skipped.push(item);
174
+ continue;
175
+ }
176
+ const storageInstance = new StorageClass(storage);
177
+ item.sourceExists = await storageInstance.exists(record);
178
+ if (!item.sourceExists) {
179
+ item.status = "skipped";
180
+ item.reason = "source_not_found";
181
+ result.skipped.push(item);
182
+ continue;
183
+ }
184
+ item.targetExists = await storageInstance.exists(newRecord);
185
+ if (item.targetExists) {
186
+ item.status = "skipped";
187
+ item.reason = "target_exists";
188
+ result.skipped.push(item);
189
+ continue;
190
+ }
191
+ if (apply) {
192
+ await storageInstance.copy(record, newRecord);
193
+ await row.update({
194
+ path: newPath,
195
+ filename: newFilename,
196
+ url: updateUrlValue(record.url, oldKey, newKey)
197
+ });
198
+ try {
199
+ const [deleted] = await storageInstance.delete([record]);
200
+ if (!deleted) {
201
+ item.reason = "delete_old_failed";
202
+ }
203
+ } catch (error) {
204
+ item.reason = `delete_old_failed: ${error.message}`;
205
+ }
206
+ item.status = "repaired";
207
+ result.repaired.push(item);
208
+ }
209
+ } catch (error) {
210
+ item.status = "failed";
211
+ item.reason = error.message;
212
+ result.failed.push(item);
213
+ }
214
+ }
215
+ }
216
+ }
217
+ async function repairAttachmentFilenames(app, fileManager, options = {}) {
218
+ const apply = !!options.apply;
219
+ const batchSize = options.batchSize || 500;
220
+ const limit = options.limit || Number.POSITIVE_INFINITY;
221
+ const result = {
222
+ dryRun: !apply,
223
+ scanned: 0,
224
+ candidates: [],
225
+ repaired: [],
226
+ skipped: [],
227
+ failed: []
228
+ };
229
+ if (!fileManager.storagesCache.size) {
230
+ await fileManager.loadStorages();
231
+ }
232
+ await loadFileCollections(app);
233
+ for (const collectionName of await getFileCollectionNames(app)) {
234
+ if (result.scanned >= limit) {
235
+ break;
236
+ }
237
+ await repairCollectionAttachmentFilenames({
238
+ app,
239
+ fileManager,
240
+ collectionName,
241
+ result,
242
+ apply,
243
+ batchSize,
244
+ limit
245
+ });
246
+ }
247
+ return result;
248
+ }
249
+ function registerRepairFilenamesCommand(app) {
250
+ const command = app.findCommand("file-manager") || app.command("file-manager");
251
+ command.command("repair-filenames").preload().option("--apply", "rename objects and update attachment records").option("--batch-size [batchSize]", "batch size for scanning attachments").option("--limit [limit]", "maximum number of attachment records to scan").action(async (options) => {
252
+ const fileManager = app.pm.get("file-manager");
253
+ const result = await repairAttachmentFilenames(app, fileManager, {
254
+ apply: !!options.apply,
255
+ batchSize: options.batchSize ? Number(options.batchSize) : void 0,
256
+ limit: options.limit ? Number(options.limit) : void 0
257
+ });
258
+ console.log(
259
+ JSON.stringify(
260
+ {
261
+ dryRun: result.dryRun,
262
+ scanned: result.scanned,
263
+ candidates: result.candidates.length,
264
+ repaired: result.repaired.length,
265
+ skipped: result.skipped.length,
266
+ failed: result.failed.length
267
+ },
268
+ null,
269
+ 2
270
+ )
271
+ );
272
+ if (result.candidates.length) {
273
+ console.table(result.candidates.map(formatItem));
274
+ }
275
+ });
276
+ }
277
+ // Annotate the CommonJS export names for ESM import in node:
278
+ 0 && (module.exports = {
279
+ getRepairedAttachmentValues,
280
+ registerRepairFilenamesCommand,
281
+ repairAttachmentFilenames,
282
+ replaceInvisibleChars
283
+ });
@@ -27,6 +27,7 @@ export type UploadFileOptions = {
27
27
  export declare class PluginFileManagerServer extends Plugin {
28
28
  storageTypes: Registry<StorageClassType>;
29
29
  storagesCache: Map<string | number, StorageModel>;
30
+ static staticImport(): Promise<void>;
30
31
  afterDestroy: (record: Model, options: any) => Promise<void>;
31
32
  registerStorageType(type: string, Type: StorageClassType): void;
32
33
  createFileRecord(options: FileRecordOptions): Promise<any>;
@@ -54,6 +54,7 @@ var import_local = __toESM(require("./storages/local"));
54
54
  var import_s3 = __toESM(require("./storages/s3"));
55
55
  var import_tx_cos = __toESM(require("./storages/tx-cos"));
56
56
  var import_utils2 = require("./utils");
57
+ var import_repair_filenames = require("./commands/repair-filenames");
57
58
  const DEFAULT_STORAGE_TYPE = import_constants.STORAGE_TYPE_LOCAL;
58
59
  class FileDeleteError extends Error {
59
60
  data;
@@ -66,6 +67,9 @@ class FileDeleteError extends Error {
66
67
  class PluginFileManagerServer extends import_server.Plugin {
67
68
  storageTypes = new import_utils.Registry();
68
69
  storagesCache = /* @__PURE__ */ new Map();
70
+ static async staticImport() {
71
+ import_server.Application.addCommand(import_repair_filenames.registerRepairFilenamesCommand);
72
+ }
69
73
  afterDestroy = async (record, options) => {
70
74
  var _a;
71
75
  const { collection } = record.constructor;
@@ -18,7 +18,7 @@ declare class AliYunOssStorage {
18
18
  filename?: typeof getRandomFilename;
19
19
  });
20
20
  _handleFile(req: any, file: any, cb: any): any;
21
- _removeFile(req: any, file: any, cb: any): any;
21
+ _removeFile(req: any, file: any, cb: any): Promise<any>;
22
22
  }
23
23
  export default class extends StorageType {
24
24
  static defaults(): {
@@ -34,6 +34,8 @@ export default class extends StorageType {
34
34
  };
35
35
  };
36
36
  make(): AliYunOssStorage;
37
+ exists(record: AttachmentModel): Promise<boolean>;
38
+ copy(source: AttachmentModel, target: AttachmentModel): Promise<void>;
37
39
  delete(records: AttachmentModel[]): Promise<[number, AttachmentModel[]]>;
38
40
  }
39
41
  export {};
@@ -90,11 +90,16 @@ class AliYunOssStorage {
90
90
  });
91
91
  }).catch(cb);
92
92
  }
93
- _removeFile(req, file, cb) {
93
+ async _removeFile(req, file, cb) {
94
94
  if (!this.client) {
95
95
  return cb(ERROR_NO_CLIENT);
96
96
  }
97
- this.client.delete(file.filename).then((result) => cb(null, result)).catch(cb);
97
+ try {
98
+ const result = await this.client.delete(file.filename);
99
+ cb(null, result);
100
+ } catch (error) {
101
+ cb(error);
102
+ }
98
103
  }
99
104
  }
100
105
  class ali_oss_default extends import__.StorageType {
@@ -118,6 +123,22 @@ class ali_oss_default extends import__.StorageType {
118
123
  filename: (0, import_utils.cloudFilenameGetter)(this.storage)
119
124
  });
120
125
  }
126
+ async exists(record) {
127
+ const { client } = this.make();
128
+ try {
129
+ await client.head((0, import_utils.getFileKey)(record));
130
+ return true;
131
+ } catch (error) {
132
+ if (["NoSuchKey", "NotFoundError"].includes(error.name)) {
133
+ return false;
134
+ }
135
+ throw error;
136
+ }
137
+ }
138
+ async copy(source, target) {
139
+ const { client } = this.make();
140
+ await client.copy((0, import_utils.getFileKey)(target), (0, import_utils.getFileKey)(source));
141
+ }
121
142
  async delete(records) {
122
143
  const { client } = this.make();
123
144
  const { deleted } = await client.deleteMulti(records.map(import_utils.getFileKey));
@@ -24,6 +24,7 @@ export interface StorageModel {
24
24
  settings?: Record<string, any>;
25
25
  }
26
26
  export interface AttachmentModel {
27
+ id?: number;
27
28
  title: string;
28
29
  filename: string;
29
30
  mimetype?: string;
@@ -38,6 +39,8 @@ export declare abstract class StorageType {
38
39
  constructor(storage: StorageModel);
39
40
  abstract make(): StorageEngine;
40
41
  abstract delete(records: AttachmentModel[]): [number, AttachmentModel[]] | Promise<[number, AttachmentModel[]]>;
42
+ exists(record: AttachmentModel): Promise<boolean>;
43
+ copy(source: AttachmentModel, target: AttachmentModel): Promise<void>;
41
44
  getFileKey(record: AttachmentModel): any;
42
45
  getFileData(file: any, meta?: {}): {
43
46
  title: string;
@@ -52,6 +52,12 @@ class StorageType {
52
52
  return {};
53
53
  }
54
54
  static filenameKey;
55
+ async exists(record) {
56
+ throw new Error(`Storage type "${this.storage.type}" does not support object existence checks`);
57
+ }
58
+ async copy(source, target) {
59
+ throw new Error(`Storage type "${this.storage.type}" does not support object copy`);
60
+ }
55
61
  getFileKey(record) {
56
62
  return (0, import_utils2.getFileKey)(record);
57
63
  }
@@ -27,6 +27,8 @@ export default class extends StorageType {
27
27
  };
28
28
  };
29
29
  make(): multer.StorageEngine;
30
+ exists(record: AttachmentModel): Promise<boolean>;
31
+ copy(source: AttachmentModel, target: AttachmentModel): Promise<void>;
30
32
  delete(records: AttachmentModel[]): Promise<[number, AttachmentModel[]]>;
31
33
  getFileURL(file: AttachmentModel, preview?: boolean): Promise<any>;
32
34
  getFileStream(file: AttachmentModel): Promise<{
@@ -96,6 +96,24 @@ class local_default extends import__.StorageType {
96
96
  filename: (0, import_utils2.diskFilenameGetter)(this.storage)
97
97
  });
98
98
  }
99
+ async exists(record) {
100
+ try {
101
+ await import_promises.default.stat(resolveSafePath(getDocumentRoot(this.storage), record.path, record.filename));
102
+ return true;
103
+ } catch (error) {
104
+ if (error.code === "ENOENT") {
105
+ return false;
106
+ }
107
+ throw error;
108
+ }
109
+ }
110
+ async copy(source, target) {
111
+ const documentRoot = getDocumentRoot(this.storage);
112
+ const sourcePath = resolveSafePath(documentRoot, source.path, source.filename);
113
+ const targetPath = resolveSafePath(documentRoot, target.path, target.filename);
114
+ await import_promises.default.mkdir(import_path.default.dirname(targetPath), { recursive: true });
115
+ await import_promises.default.copyFile(sourcePath, targetPath);
116
+ }
99
117
  async delete(records) {
100
118
  const documentRoot = getDocumentRoot(this.storage);
101
119
  let count = 0;
@@ -32,5 +32,7 @@ export default class extends StorageType {
32
32
  deleteS3Objects(bucketName: string, objects: string[]): Promise<{
33
33
  Deleted: any[];
34
34
  }>;
35
+ exists(record: AttachmentModel): Promise<boolean>;
36
+ copy(source: AttachmentModel, target: AttachmentModel): Promise<void>;
35
37
  delete(records: AttachmentModel[]): Promise<[number, AttachmentModel[]]>;
36
38
  }