Skip to content

Commit a71372a

Browse files
committed
Merge branch 'master' into aws-sdk-v3-async
2 parents 3fbe88a + 1f74921 commit a71372a

23 files changed

+2916
-15900
lines changed

.eslintignore

-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
coverage/*
2-
.nyc_output/*

.eslintrc.json

+12-5
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
"extends": "eslint:recommended",
44
"env": {
55
"node": true,
6-
"es6": true
6+
"es2020": true
77
},
88
"parserOptions": {
9-
"ecmaVersion": 8,
10-
"sourceType": "module"
9+
"ecmaVersion": 2020,
10+
"sourceType": "module",
11+
"requireConfigFile": false
1112
},
1213
"rules": {
1314
"indent": ["error", 2, { "SwitchCase": 1 }],
@@ -19,6 +20,12 @@
1920
"prefer-const": "error",
2021
"space-infix-ops": "error",
2122
"no-useless-escape": "off",
22-
"require-atomic-updates": "off"
23+
"require-atomic-updates": "off",
24+
"object-curly-spacing": ["error", "always"],
25+
"curly": ["error", "all"],
26+
"block-spacing": ["error", "always"]
27+
},
28+
"globals": {
29+
"Parse": true
2330
}
24-
}
31+
}

.github/workflows/ci.yml

+54-17
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,64 @@ on:
77
branches:
88
- '**'
99
jobs:
10-
test:
10+
lint:
11+
name: Lint
12+
timeout-minutes: 15
1113
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: Use Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
cache: npm
20+
- name: Install dependencies
21+
run: npm ci
22+
- name: Lint
23+
run: npm run lint
24+
test:
1225
strategy:
1326
matrix:
14-
node: [ '14', '16', '18' ]
15-
timeout-minutes: 30
27+
include:
28+
- name: Parse Server 7, Node.js 18
29+
NODE_VERSION: 18.20.4
30+
PARSE_SERVER_VERSION: 7
31+
- name: Parse Server 7, Node.js 20
32+
NODE_VERSION: 20.15.1
33+
PARSE_SERVER_VERSION: 7
34+
- name: Parse Server 7, Node.js 22
35+
NODE_VERSION: 22.4.1
36+
PARSE_SERVER_VERSION: 7
37+
- name: Parse Server 6
38+
NODE_VERSION: 18
39+
PARSE_SERVER_VERSION: 6
40+
fail-fast: false
41+
name: ${{ matrix.name }}
42+
timeout-minutes: 15
43+
runs-on: ubuntu-latest
1644
env:
17-
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
45+
NODE_VERSION: ${{ matrix.NODE_VERSION }}
46+
PARSE_SERVER_VERSION: ${{ matrix.PARSE_SERVER_VERSION }}
1847
steps:
19-
- uses: actions/checkout@v2
20-
- name: Use Node.js
21-
uses: actions/setup-node@v2
48+
- uses: actions/checkout@v4
49+
- name: Use Node.js ${{ matrix.NODE_VERSION }}
50+
uses: actions/setup-node@v4
2251
with:
23-
node-version: ${{ matrix.node }}
24-
- name: Cache Node.js modules
25-
uses: actions/cache@v2
52+
node-version: ${{ matrix.NODE_VERSION }}
53+
cache: npm
54+
- name: Install Parse Server ${{ matrix.PARSE_SERVER_VERSION }}
55+
run: npm i -DE parse-server@${{ matrix.PARSE_SERVER_VERSION }}
56+
- name: Install dependencies
57+
run: npm ci
58+
- name: Run tests
59+
run: npm run test
60+
- name: Upload code coverage
61+
uses: codecov/codecov-action@v4
2662
with:
27-
path: ~/.npm
28-
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
29-
restore-keys: |
30-
${{ runner.os }}-node-
31-
- run: npm ci
32-
- run: npm run test
33-
- run: ./node_modules/.bin/codecov
63+
fail_ci_if_error: false
64+
token: ${{ secrets.CODECOV_TOKEN }}
65+
env:
66+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
67+
68+
concurrency:
69+
group: ${{ github.workflow }}-${{ github.ref }}
70+
cancel-in-progress: true

.gitignore

+5-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
logs
33
*.log
44
npm-debug.log*
5-
.env
65

76
# Runtime data
87
pids
@@ -13,8 +12,8 @@ pids
1312
lib-cov
1413

1514
# Coverage directory used by tools like istanbul
16-
coverage
1715
.nyc_output
16+
coverage
1817

1918
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
2019
.grunt
@@ -37,4 +36,8 @@ node_modules
3736
# Webstorm
3837
.idea/
3938

39+
# Lint
4040
.eslintcache
41+
42+
# Parse Server
43+
test_logs

.nycrc

+13-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
11
{
2-
"reporter": ["lcov", "text-summary"],
3-
"exclude": ["**/spec/**"]
2+
"all": true,
3+
"reporter": [
4+
"lcov",
5+
"text-summary"
6+
],
7+
"include": [
8+
"src/**/*.js",
9+
"lib/**/*.js",
10+
"index.js"
11+
],
12+
"exclude": [
13+
"**/spec/**"
14+
]
415
}

CHANGELOG.md

+13-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
# [3.0.0](https://github.com/parse-community/parse-server-s3-adapter/compare/2.2.0...3.0.0) (2024-10-22)
2+
3+
4+
### Features
5+
6+
* Add support for Node 20, 22; remove support for Node 14, 16 ([#226](https://github.com/parse-community/parse-server-s3-adapter/issues/226)) ([da5a94f](https://github.com/parse-community/parse-server-s3-adapter/commit/da5a94fa180ba57dfae33659e18db4704582e8e6))
7+
8+
9+
### BREAKING CHANGES
10+
11+
* Removes support for Node 14, 16. ([da5a94f](da5a94f))
12+
113
# [2.2.0](https://github.com/parse-community/parse-server-s3-adapter/compare/2.1.0...2.2.0) (2023-05-15)
214

315

@@ -165,4 +177,4 @@ ___
165177

166178

167179

168-
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
180+
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*

README.md

+85-54
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,50 @@ The official AWS S3 file storage adapter for Parse Server. See [Parse Server S3
1313

1414
---
1515

16-
- [Installation](#installation)
17-
- [AWS Credentials](#aws-credentials)
18-
- [Deprecated Configuration](#deprecated-configuration)
16+
- [Getting Started](#getting-started)
17+
- [Installation](#installation)
18+
- [Compatibility](#compatibility)
19+
- [Parse Server](#parse-server)
20+
- [Node.js](#nodejs)
21+
- [AWS Credentials](#aws-credentials)
22+
- [Deprecated Configuration](#deprecated-configuration)
1923
- [Usage with Parse Server](#usage-with-parse-server)
20-
- [Parameters](#parameters)
21-
- [Using a config file](#using-a-config-file)
22-
- [using environment variables](#using-environment-variables)
23-
- [passing as an instance](#passing-as-an-instance)
24-
- [Usage with Digital Ocean Spaces](#usage-with-digital-ocean-spaces)
25-
- [Adding Metadata and Tags](#adding-metadata-and-tags)
24+
- [Parameters](#parameters)
25+
- [Using a Config File](#using-a-config-file)
26+
- [Using Environment Variables](#using-environment-variables)
27+
- [Passing as an Instance](#passing-as-an-instance)
28+
- [Adding Metadata and Tags](#adding-metadata-and-tags)
29+
- [Compatibility with other Storage Providers](#compatibility-with-other-storage-providers)
30+
- [Digital Ocean Spaces](#digital-ocean-spaces)
2631

27-
# Installation
32+
33+
# Getting Started
34+
35+
## Installation
2836

2937
`npm install --save @parse/s3-files-adapter`
3038

31-
# AWS Credentials
39+
## Compatibility
40+
41+
### Parse Server
42+
43+
| Version | End-of-Life | Compatible |
44+
|---------|---------------|------------|
45+
| <=5 | December 2023 | ✅ Yes |
46+
| 6 | December 2024 | ✅ Yes |
47+
| 7 | December 2025 | ✅ Yes |
48+
49+
### Node.js
50+
51+
This product is continuously tested with the most recent releases of Node.js to ensure compatibility. We follow the [Node.js Long Term Support plan](https://github.com/nodejs/Release) and only test against versions that are officially supported and have not reached their end-of-life date.
52+
53+
| Version | Latest Version | End-of-Life | Compatible |
54+
|------------|----------------|-------------|------------|
55+
| Node.js 18 | 18.20.4 | April 2025 | ✅ Yes |
56+
| Node.js 20 | 20.15.1 | April 2026 | ✅ Yes |
57+
| Node.js 22 | 22.4.1 | April 2027 | ✅ Yes |
58+
59+
## AWS Credentials
3260

3361
⚠️ The ability to explicitly pass credentials to this adapter is deprecated and will be removed in a future release.
3462

@@ -55,7 +83,7 @@ For an AWS host:
5583

5684
If for some reason you really need to be able to set the key and secret explicitly, you can still do it using `s3overrides` as described below and setting `accessKeyId` and `secretAccessKey` in the `s3Overrides` object.
5785

58-
# Deprecated Configuration
86+
## Deprecated Configuration
5987

6088
Although it is not recommended, AWS credentials can be explicitly configured through an options
6189
object, constructor string arguments or environment variables ([see below](#using-a-config-file)).
@@ -65,17 +93,17 @@ The preferred method is to use the default AWS credentials pattern. If no AWS c
6593

6694
# Usage with Parse Server
6795

68-
### Parameters
96+
## Parameters
6997

7098
*(This list is still incomplete and in the works, in the meantime find more descriptions in the chapters below.)*
7199

72-
| Parameter | Optional | Default value | Environment variable | Description |
73-
|-----------|----------|---------------|----------------------|-------------|
74-
| `fileAcl` | yes | `undefined` | S3_FILE_ACL | Sets the [Canned ACL](https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#canned-acl) of the file when storing it in the S3 bucket. Setting this parameter overrides the file ACL that would otherwise depend on the `directAccess` parameter. Setting the value `'none'` causes any ACL parameter to be removed that would otherwise be set. |
75-
| `presignedUrl` | yes | `false` | S3_PRESIGNED_URL | If `true` a [presigned URL](https://docs.aws.amazon.com/AmazonS3/latest/dev/ShareObjectPreSignedURL.html) is returned when requesting the URL of file. The URL is only valid for a specified duration, see parameter `presignedUrlExpires`. |
76-
| `presignedUrlExpires` | yes | `undefined` | S3_PRESIGNED_URL_EXPIRES | Sets the duration in seconds after which the [presigned URL](https://docs.aws.amazon.com/AmazonS3/latest/dev/ShareObjectPreSignedURL.html) of the file expires. If no value is set, the AWS S3 SDK default [Expires](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#getSignedUrl-property) value applies. This parameter requires `presignedUrl` to be `true`. |
100+
| Parameter | Optional | Default value | Environment variable | Description |
101+
|-----------------------|----------|---------------|--------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
102+
| `fileAcl` | yes | `undefined` | S3_FILE_ACL | Sets the [Canned ACL](https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#canned-acl) of the file when storing it in the S3 bucket. Setting this parameter overrides the file ACL that would otherwise depend on the `directAccess` parameter. Setting the value `'none'` causes any ACL parameter to be removed that would otherwise be set. |
103+
| `presignedUrl` | yes | `false` | S3_PRESIGNED_URL | If `true` a [presigned URL](https://docs.aws.amazon.com/AmazonS3/latest/dev/ShareObjectPreSignedURL.html) is returned when requesting the URL of file. The URL is only valid for a specified duration, see parameter `presignedUrlExpires`. |
104+
| `presignedUrlExpires` | yes | `undefined` | S3_PRESIGNED_URL_EXPIRES | Sets the duration in seconds after which the [presigned URL](https://docs.aws.amazon.com/AmazonS3/latest/dev/ShareObjectPreSignedURL.html) of the file expires. If no value is set, the AWS S3 SDK default [Expires](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#getSignedUrl-property) value applies. This parameter requires `presignedUrl` to be `true`. |
77105

78-
### Using a config file
106+
## Using a Config File
79107

80108
```
81109
{
@@ -106,7 +134,7 @@ The preferred method is to use the default AWS credentials pattern. If no AWS c
106134
```
107135
***Note*** By default Parse.FilesController.preserveFileName will prefix all filenames with a random hex code. You will want to disable that if you enable it here or wish to use S3 "directories".
108136

109-
### using environment variables
137+
## Using Environment Variables
110138

111139
Set your environment variables:
112140

@@ -132,7 +160,7 @@ And update your config / options
132160
```
133161

134162

135-
### passing as an instance
163+
## Passing as an Instance
136164
```
137165
var S3Adapter = require('@parse/s3-files-adapter');
138166
@@ -209,9 +237,42 @@ var api = new ParseServer({
209237
filesAdapter: s3Adapter
210238
})
211239
```
212-
### Usage with Digital Ocean Spaces
240+
241+
## Adding Metadata and Tags
242+
243+
Use the optional options argument to add [Metadata](https://docs.aws.amazon.com/AmazonS3/latest/user-guide/add-object-metadata.html) and/or [Tags](https://docs.aws.amazon.com/AmazonS3/latest/user-guide/add-object-tags.html) to S3 objects
244+
245+
```
246+
247+
248+
const S3Adapter = require('@parse/s3-files-adapter');
249+
250+
const s3Options = {}; // Add correct options
251+
const s3Adapter = new S3Adapter(s3Options);
252+
253+
const filename = 'Fictional_Characters.txt';
254+
const data = 'That\'s All Folks!';
255+
const contentType = 'text/plain';
256+
const tags = {
257+
createdBy: 'Elmer Fudd',
258+
owner: 'Popeye'
259+
};
260+
const metadata = {
261+
source: 'Mickey Mouse'
262+
};
263+
const options = { tags, metadata };
264+
s3Adapter.createFile(filename, data, contentType, options);
213265
214266
```
267+
268+
**Note:** This adapter will **automatically** add the "x-amz-meta-" prefix to the beginning of metadata tags as stated in [S3 Documentation](https://docs.aws.amazon.com/AmazonS3/latest/user-guide/add-object-metadata.html).
269+
270+
271+
# Compatibility with other Storage Providers
272+
273+
## Digital Ocean Spaces
274+
275+
```js
215276
var S3Adapter = require("@parse/s3-files-adapter");
216277
var AWS = require("aws-sdk");
217278

@@ -243,36 +304,6 @@ var api = new ParseServer({
243304
serverURL: process.env.SERVER_URL || "http://localhost:1337/parse",
244305
logLevel: process.env.LOG_LEVEL || "info",
245306
allowClientClassCreation: false,
246-
filesAdapter: s3Adapter,
247-
}
307+
filesAdapter: s3Adapter
248308
});
249-
```
250-
251-
### Adding Metadata and Tags
252-
253-
Use the optional options argument to add [Metadata](https://docs.aws.amazon.com/AmazonS3/latest/user-guide/add-object-metadata.html) and/or [Tags](https://docs.aws.amazon.com/AmazonS3/latest/user-guide/add-object-tags.html) to S3 objects
254-
255-
```
256-
257-
258-
const S3Adapter = require('@parse/s3-files-adapter');
259-
260-
const s3Options = {}; // Add correct options
261-
const s3Adapter = new S3Adapter(s3Options);
262-
263-
const filename = 'Fictional_Characters.txt';
264-
const data = 'That\'s All Folks!';
265-
const contentType = 'text/plain';
266-
const tags = {
267-
createdBy: 'Elmer Fudd',
268-
owner: 'Popeye'
269-
};
270-
const metadata = {
271-
source: 'Mickey Mouse'
272-
};
273-
const options = { tags, metadata };
274-
s3Adapter.createFile(filename, data, contentType, options);
275-
276-
```
277-
278-
**Note:** This adapter will **automatically** add the "x-amz-meta-" prefix to the beginning of metadata tags as stated in [S3 Documentation](https://docs.aws.amazon.com/AmazonS3/latest/user-guide/add-object-metadata.html).
309+
```

0 commit comments

Comments
 (0)