diff --git a/CHANGELOG.md b/CHANGELOG.md index fd2b76864c..da0b9556af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -95,6 +95,7 @@ ___ - Removed [parse-server-simple-mailgun-adapter](https://github.com/parse-community/parse-server-simple-mailgun-adapter) dependency; to continue using the adapter it has to be explicitly installed (Manuel Trezza) [#7321](https://github.com/parse-community/parse-server/pull/7321) - Remove support for MongoDB 3.6 which has reached its End-of-Life date and PostgreSQL 10 (Manuel Trezza) [#7315](https://github.com/parse-community/parse-server/pull/7315) - Remove support for Node 10 which has reached its End-of-Life date (Manuel Trezza) [#7314](https://github.com/parse-community/parse-server/pull/7314) +- Remove S3 Files Adapter from Parse Server, instead install separately as `@parse/s3-files-adapter` (Manuel Trezza) [#?](https://github.com/parse-community/parse-server/pull/?) ### Notable Changes - Added Parse Server Security Check to report weak security settings (Manuel Trezza, dblythy) [#7247](https://github.com/parse-community/parse-server/issues/7247) - EXPERIMENTAL: Added new page router with placeholder rendering and localization of custom and feature pages such as password reset and email verification (Manuel Trezza) [#6891](https://github.com/parse-community/parse-server/issues/6891) diff --git a/package-lock.json b/package-lock.json index 0dd5c8acf6..52436a6a5a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1675,49 +1675,6 @@ } } }, - "@parse/s3-files-adapter": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@parse/s3-files-adapter/-/s3-files-adapter-1.6.0.tgz", - "integrity": "sha512-t/91hlZ4+GIA68zmJIX9lkIAxPZVRJROPYWGGyxE9CLGsSvBr/eaIHs6LnKyM012lBHzwJwoLxMkN4RvJADgbg==", - "requires": { - "aws-sdk": "2.761.0", - "parse": "2.17.0" - }, - "dependencies": { - "@babel/runtime": { - "version": "7.11.2", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.11.2.tgz", - "integrity": "sha512-TeWkU52so0mPtDcaCTxNBI/IHiz0pZgr8VEFqXFtZWpYD08ZB6FaSwVAS8MKRQAP3bYKiVjwysOJgMFY28o6Tw==", - "requires": { - "regenerator-runtime": "^0.13.4" - } - }, - "parse": { - "version": "2.17.0", - "resolved": "https://registry.npmjs.org/parse/-/parse-2.17.0.tgz", - "integrity": "sha512-1hWoMNW39LH5YV3xCds9LyD8SsKD6FUwlD1Kn8ZlXNosg6WgF+s3ZSQUzT5AJ/9YPUoC/y1PoCO79FumrBYftA==", - "requires": { - "@babel/runtime": "7.11.2", - "@babel/runtime-corejs3": "7.11.2", - "crypto-js": "4.0.0", - "react-native-crypto-js": "1.0.0", - "uuid": "3.4.0", - "ws": "7.3.1", - "xmlhttprequest": "1.8.0" - } - }, - "uuid": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", - "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" - }, - "ws": { - "version": "7.3.1", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.3.1.tgz", - "integrity": "sha512-D3RuNkynyHmEJIpD2qrgVkc9DQ23OrN/moAwZX4L8DfvszsJxpjQuUq3LMx6HoYji9fbIOBY18XWBsAux1ZZUA==" - } - } - }, "@protobufjs/aspromise": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", @@ -2957,29 +2914,6 @@ "dev": true, "optional": true }, - "aws-sdk": { - "version": "2.761.0", - "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.761.0.tgz", - "integrity": "sha512-mSzdiqlnruFlJYrQVWPMyPQ8ynJe9P5QVD+edv8HFlYDQNOwpPCjlqI9kE1VE3cVcxkh0j2Q2kfLQa/pAY2w7Q==", - "requires": { - "buffer": "4.9.2", - "events": "1.1.1", - "ieee754": "1.1.13", - "jmespath": "0.15.0", - "querystring": "0.2.0", - "sax": "1.2.1", - "url": "0.10.3", - "uuid": "3.3.2", - "xml2js": "0.4.19" - }, - "dependencies": { - "uuid": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", - "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" - } - } - }, "aws-sign2": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", @@ -3110,7 +3044,8 @@ "base64-js": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", - "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "dev": true }, "bcrypt-nodejs": { "version": "0.0.3", @@ -3290,13 +3225,13 @@ "integrity": "sha512-EvVNVeGo4tHxwi8L6bPj3y3itEvStdwvvlojVxxbyYfoaxJ6keLgrTuKdyfEAszFK+H3olzBuafE0yoh0D1gdg==" }, "buffer": { - "version": "4.9.2", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.2.tgz", - "integrity": "sha512-xq+q3SRMOxGivLhBNaUdC64hDTQwejJ+H0T/NB1XMtTVEwNTrfFF3gAxiyW0Bu/xWEGhjVKgUcMhCrUy2+uCWg==", + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "dev": true, "requires": { - "base64-js": "^1.0.2", - "ieee754": "^1.1.4", - "isarray": "^1.0.0" + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" } }, "buffer-alloc": { @@ -5490,11 +5425,6 @@ "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-3.1.2.tgz", "integrity": "sha512-tvtQIeLVHjDkJYnzf2dgVMxfuSGJeM/7UCG17TT4EumTfNtF+0nebF/4zWOIkCreAbtNqhGEboB6BWrwqNaw4Q==" }, - "events": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz", - "integrity": "sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ=" - }, "execa": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/execa/-/execa-4.1.0.tgz", @@ -7006,9 +6936,10 @@ "integrity": "sha512-1DYjY/nX2U9pkTkwFoAmKcK1ZWmkNgO32Oon9tp/9+HURizxUQ4fZRxMJZs093SldP7q6dotVj03kIkiqOILyA==" }, "ieee754": { - "version": "1.1.13", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz", - "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==" + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "dev": true }, "ignore": { "version": "4.0.6", @@ -7834,11 +7765,6 @@ } } }, - "jmespath": { - "version": "0.15.0", - "resolved": "https://registry.npmjs.org/jmespath/-/jmespath-0.15.0.tgz", - "integrity": "sha1-o/Iiqarp+Wb10nx5ZRDigJF2Qhc=" - }, "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -9104,6 +9030,10 @@ "minimist": "^1.2.5" } }, + "mock-files-adapter": { + "version": "file:spec/dependencies/mock-files-adapter", + "dev": true + }, "mock-mail-adapter": { "version": "file:spec/dependencies/mock-mail-adapter", "dev": true @@ -9923,16 +9853,6 @@ "readable-stream": "^3.4.0" } }, - "buffer": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", - "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", - "dev": true, - "requires": { - "base64-js": "^1.3.1", - "ieee754": "^1.1.13" - } - }, "chalk": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", @@ -10644,11 +10564,6 @@ "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" }, - "querystring": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", - "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=" - }, "queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", @@ -11158,11 +11073,6 @@ } } }, - "sax": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.1.tgz", - "integrity": "sha1-e45lYZCyKOgaZq6nSEgNgozS03o=" - }, "seek-bzip": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/seek-bzip/-/seek-bzip-1.0.6.tgz", @@ -12317,18 +12227,6 @@ "requires": { "buffer": "^5.2.1", "through": "^2.3.8" - }, - "dependencies": { - "buffer": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", - "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", - "dev": true, - "requires": { - "base64-js": "^1.3.1", - "ieee754": "^1.1.13" - } - } } }, "underscore": { @@ -12474,22 +12372,6 @@ "dev": true, "optional": true }, - "url": { - "version": "0.10.3", - "resolved": "https://registry.npmjs.org/url/-/url-0.10.3.tgz", - "integrity": "sha1-Ah5NnHcF8hu/N9A861h2dAJ3TGQ=", - "requires": { - "punycode": "1.3.2", - "querystring": "0.2.0" - }, - "dependencies": { - "punycode": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", - "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=" - } - } - }, "url-parse-lax": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-1.0.0.tgz", @@ -12784,20 +12666,6 @@ "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.4.tgz", "integrity": "sha512-Qm8k8ojNQIMx7S+Zp8u/uHOx7Qazv3Yv4q68MiWWWOJhiwG5W3x7iqmRtJo8xxrciZUY4vRxUTJCKuRnF28ZZw==" }, - "xml2js": { - "version": "0.4.19", - "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz", - "integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==", - "requires": { - "sax": ">=0.6.0", - "xmlbuilder": "~9.0.1" - } - }, - "xmlbuilder": { - "version": "9.0.7", - "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", - "integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0=" - }, "xmlcreate": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/xmlcreate/-/xmlcreate-2.0.3.tgz", diff --git a/package.json b/package.json index a4df201cbc..e5e5379e4e 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,6 @@ "@graphql-tools/utils": "6.2.4", "@parse/fs-files-adapter": "1.2.0", "@parse/push-adapter": "3.4.0", - "@parse/s3-files-adapter": "1.6.0", "apollo-server-express": "2.21.0", "bcryptjs": "2.4.3", "body-parser": "1.19.0", @@ -93,6 +92,7 @@ "lint-staged": "10.2.3", "madge": "4.0.2", "mock-mail-adapter": "file:spec/dependencies/mock-mail-adapter", + "mock-files-adapter": "file:spec/dependencies/mock-files-adapter", "mongodb-runner": "4.8.1", "mongodb-version-list": "1.0.0", "node-fetch": "2.6.1", diff --git a/spec/AdapterLoader.spec.js b/spec/AdapterLoader.spec.js index b02e07e708..72c6ef333c 100644 --- a/spec/AdapterLoader.spec.js +++ b/spec/AdapterLoader.spec.js @@ -1,7 +1,7 @@ const loadAdapter = require('../lib/Adapters/AdapterLoader').loadAdapter; const FilesAdapter = require('@parse/fs-files-adapter').default; -const S3Adapter = require('@parse/s3-files-adapter').default; const ParsePushAdapter = require('@parse/push-adapter').default; +const MockFilesAdapter = require('mock-files-adapter'); const Config = require('../lib/Config'); describe('AdapterLoader', () => { @@ -142,12 +142,12 @@ describe('AdapterLoader', () => { }).not.toThrow(); }); - it('should load S3Adapter from direct passing', done => { + it('should load file adapter from direct passing', done => { spyOn(console, 'warn').and.callFake(() => {}); - const s3Adapter = new S3Adapter('key', 'secret', 'bucket'); + const mockFilesAdapter = new MockFilesAdapter('key', 'secret', 'bucket'); expect(() => { - const adapter = loadAdapter(s3Adapter, FilesAdapter); - expect(adapter).toBe(s3Adapter); + const adapter = loadAdapter(mockFilesAdapter, FilesAdapter); + expect(adapter).toBe(mockFilesAdapter); }).not.toThrow(); done(); }); diff --git a/spec/dependencies/mock-files-adapter/index.js b/spec/dependencies/mock-files-adapter/index.js new file mode 100644 index 0000000000..ad5e301da7 --- /dev/null +++ b/spec/dependencies/mock-files-adapter/index.js @@ -0,0 +1,31 @@ +/** + * A mock files adapter for testing. + */ +class MockFilesAdapter { + constructor(options = {}) { + if (options.throw) { + throw 'MockFilesAdapterConstructor'; + } + } + createFile() { + return 'MockFilesAdapterCreateFile'; + } + deleteFile() { + return 'MockFilesAdapterDeleteFile'; + } + getFileData() { + return 'MockFilesAdapterGetFileData'; + } + getFileLocation() { + return 'MockFilesAdapterGetFileLocation'; + } + validateFilename() { + return 'MockFilesAdapterValidateFilename'; + } + handleFileStream() { + return 'MockFilesAdapterHandleFileStream'; + } +} + +module.exports = MockFilesAdapter; +module.exports.default = MockFilesAdapter; diff --git a/spec/dependencies/mock-files-adapter/package.json b/spec/dependencies/mock-files-adapter/package.json new file mode 100644 index 0000000000..8deb89f5a0 --- /dev/null +++ b/spec/dependencies/mock-files-adapter/package.json @@ -0,0 +1,6 @@ +{ + "name": "mock-files-adapter", + "version": "1.0.0", + "description": "Mock files adapter for tests.", + "main": "index.js" +} diff --git a/spec/index.spec.js b/spec/index.spec.js index 87202255d8..dd9be1792b 100644 --- a/spec/index.spec.js +++ b/spec/index.spec.js @@ -391,7 +391,9 @@ describe('server', () => { }); it('exposes correct adapters', done => { - expect(ParseServer.S3Adapter).toThrow(); + expect(ParseServer.S3Adapter).toThrow( + 'S3Adapter is not provided by parse-server anymore; please install @parse/s3-files-adapter' + ); expect(ParseServer.GCSAdapter).toThrow( 'GCSAdapter is not provided by parse-server anymore; please install @parse/gcs-files-adapter' ); diff --git a/src/index.js b/src/index.js index 2806fb8b42..03cd15176f 100644 --- a/src/index.js +++ b/src/index.js @@ -1,5 +1,4 @@ import ParseServer from './ParseServer'; -import S3Adapter from '@parse/s3-files-adapter'; import FileSystemAdapter from '@parse/fs-files-adapter'; import InMemoryCacheAdapter from './Adapters/Cache/InMemoryCacheAdapter'; import NullCacheAdapter from './Adapters/Cache/NullCacheAdapter'; @@ -21,6 +20,7 @@ const _ParseServer = function (options: ParseServerOptions) { _ParseServer.createLiveQueryServer = ParseServer.createLiveQueryServer; _ParseServer.start = ParseServer.start; +const S3Adapter = useExternal('S3Adapter', '@parse/s3-files-adapter'); const GCSAdapter = useExternal('GCSAdapter', '@parse/gcs-files-adapter'); Object.defineProperty(module.exports, 'logger', {