Skip to content

Commit a8c9117

Browse files
committed
Merge branch 'develop' of github.com:filestack/filestack-js into develop
2 parents 5ab80b5 + ebdedbf commit a8c9117

File tree

17 files changed

+238
-41
lines changed

17 files changed

+238
-41
lines changed

.github/workflows/deploy.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: filestack-js
2+
on:
3+
create:
4+
tags:
5+
- v*
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
steps:
10+
# - uses: voxmedia/github-action-slack-notify-build@v1
11+
# with:
12+
# channel: team-charlie
13+
# status: STARTED
14+
# color: good
15+
# env:
16+
# SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
17+
- uses: actions/checkout@v2
18+
- name: Setup repository env
19+
uses: actions/setup-node@v1
20+
with:
21+
node-version: '14.x'
22+
registry-url: "https://registry.npmjs.org"
23+
- name: Install deps
24+
run: npm install
25+
- name: Run tests
26+
run: npm test
27+
- name: Update code cov report
28+
run: npm run test:codecov
29+
- name: Prepare docs
30+
run: npm run docs
31+
- name: Publish package to cdn
32+
run: npm run publish:s3
33+
env:
34+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
35+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
36+
AWS_REGION: ${{ secrets.AWS_REGION }}
37+
- name: Publush to NPM (only on tag)
38+
run: npm publish --access public
39+
env:
40+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
41+
- name: Deploy docs
42+
uses: crazy-max/ghaction-github-pages@v2
43+
with:
44+
target_branch: gh-pages
45+
build_dir: build/docs
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
# - name: Notify slack success
49+
# if: success()
50+
# env:
51+
# SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
52+
# uses: voxmedia/github-action-slack-notify-build@v1
53+
# with:
54+
# channel: team-charlie
55+
# status: SUCCESS
56+
# color: good
57+
# - name: Notify slack fail
58+
# if: failure()
59+
# env:
60+
# SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
61+
# uses: voxmedia/github-action-slack-notify-build@v1
62+
# with:
63+
# channel: team-charlie
64+
# status: FAILED
65+
# color: danger

.github/workflows/deploy_beta.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: filestack-js
2+
on:
3+
create:
4+
tags:
5+
- v*
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v2
11+
- name: Setup repository env
12+
uses: actions/setup-node@v1
13+
with:
14+
node-version: '14.x'
15+
registry-url: "https://registry.npmjs.org"
16+
- name: Install deps
17+
run: npm install
18+
- name: Run tests
19+
run: npm test
20+
- name: Prepare docs
21+
run: npm run docs
22+
- name: Publish package to cdn - beta version
23+
run: npm run publish:s3:beta
24+
env:
25+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
26+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
27+
AWS_REGION: ${{ secrets.AWS_REGION }}

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
### [3.21.1](https://github.com/filestack/filestack-js/compare/v3.21.0...v3.21.1) (2021-01-25)
6+
7+
8+
### Bug Fixes
9+
10+
* **picker:** fix accept option in picker, bump version to 1.20.1 ([7e48a30](https://github.com/filestack/filestack-js/commit/7e48a307f898a40f131e2b72c188adc3c259bab5))
11+
512
## [3.21.0](https://github.com/filestack/filestack-js/compare/v3.20.0...v3.21.0) (2021-01-13)
613

714

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<a href="https://static.filestackapi.com/filestack-js/3.x.x/filestack.min.js"><img src="https://img.badgesize.io/https://static.filestackapi.com/filestack-js/3.x.x/filestack.min.js?color=green" /></a>
2020
<img src="https://img.shields.io/badge/module%20formats-umd%2C%20esm%2C%20cjs-green.svg" />
2121
<br/>
22-
<img src="https://badges.herokuapp.com/browsers?labels=none&googlechrome=latest&firefox=latest&microsoftedge=latest&iexplore=11&safari=latest&iphone=latest" />
22+
<img src="https://badges.herokuapp.com/browsers?labels=none&googlechrome=latest&firefox=latest&microsoftedge=latest&edge=latest&safari=latest&iphone=latest" />
2323
</p>
2424
<hr/>
2525

@@ -174,6 +174,7 @@ Please see our examples above to learn more about customizing the picker for you
174174
## Polyfills
175175

176176
If you target IE11 or iOS before 8.0 you will need to add additional polyfills to your page or application.
177+
(We are no longer support IE11 and older browser, so it can stop working on this browser)
177178

178179
Polyfills we recommend:**
179180

manual_tests/request.ts

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,34 +15,30 @@
1515
* See the License for the specific language governing permissions and
1616
* limitations under the License.
1717
*/
18-
const nock = require('nock');
18+
// const nock = require('nock');
1919
import { FsRequest } from './../src/lib/request/index';
20-
import { FsCancelToken } from './../src/lib/request/token';
20+
// import { FsCancelToken } from './../src/lib/request/token';
2121

22-
nock('http://www.filestacktest.com')
23-
.get('/123')
24-
.once()
25-
// .delay(1000)
26-
.reply(404, '<html></html>', { 'content-type': 'text/plain' })
27-
.get('/123')
28-
.reply(200, '<html></html>', { 'content-type': 'text/plain' });
22+
// nock('http://www.filestacktest.com')
23+
// .get('/123')
24+
// .once()
25+
// // .delay(1000)
26+
// .reply(404, '<html></html>', { 'content-type': 'text/plain' })
27+
// .get('/123')
28+
// .reply(200, '<html></html>', { 'content-type': 'text/plain' });
2929

30-
const token = new FsCancelToken();
30+
// const token = new FsCancelToken();
3131

3232
// setTimeout(() => {
3333
// token.cancel();
3434
// }, 1000);
3535

36-
FsRequest.get('http://www.filestacktest.com/123', {
37-
cancelToken: token,
38-
timeout: 500,
39-
retry: {
40-
retry: 2,
41-
retryFactor: 2,
42-
retryMaxTime: 1500,
43-
},
36+
FsRequest.get('https://cdn.filestackcontent.com/llIbWqvRX25JPxCBqkoV', {
37+
// cancelToken: token,
38+
// timeout: 500,
4439
}).then((resp) => {
45-
console.log('Response:', resp);
40+
console.log('Response:', resp.data);
41+
console.log(resp.data.file.length);
4642
}).catch((e) => {
4743
console.error('Catch Errror', e);
4844
});

package-lock.json

Lines changed: 6 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "filestack-js",
3-
"version": "3.21.0",
3+
"version": "3.21.1",
44
"description": "Official JavaScript library for Filestack",
55
"main": "build/main/index.js",
66
"module": "build/module/index.js",
@@ -30,8 +30,8 @@
3030
"docs:publish": "npm run docs && gh-pages -d build/docs",
3131
"release": "standard-version",
3232
"prepare": "npm run build",
33-
"publish:beta": "npm run build && node scripts/publish.js --beta",
34-
"publish": "npm run docs:publish && node scripts/publish.js --current --latest",
33+
"publish:s3:beta": "npm run build && node scripts/publish.js --beta",
34+
"publish:s3": "npm run docs:publish && node scripts/publish.js --current --latest",
3535
"cache:clean": "node scripts/cache.js --current --latest",
3636
"cache:clean:beta": "node scripts/cache.js --beta",
3737
"examples": "npm run build && node ./examples/examples.js"
@@ -54,7 +54,7 @@
5454
"lodash.clonedeep": "^4.5.0",
5555
"p-queue": "^4.0.0",
5656
"spark-md5": "^3.0.0",
57-
"ts-node": "^8.10.1"
57+
"ts-node": "^8.10.2"
5858
},
5959
"devDependencies": {
6060
"@babel/core": "^7.8.4",

scripts/publish.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ const git = require('git-state');
1111

1212
const s3 = new AWS.S3();
1313
const DEPLOY_BRANCH = 'master';
14+
const repositoryExists = git.isGitSync(path);
15+
const currentBranch = git.checkSync(path);
16+
17+
console.log('CURRENT BRANCH IS: ', currentBranch);
1418

1519
const figureOutFileMimetype = (filePath) => {
1620
const type = mime.lookup(Path.extname(filePath));
@@ -21,7 +25,7 @@ const figureOutFileMimetype = (filePath) => {
2125
return 'application/octet-stream';
2226
};
2327

24-
const pushOneFileToS3 = (basePath, to, cacheControllDays = 1) => {
28+
const pushOneFileToS3 = (basePath, to, cacheControll = 1) => {
2529
return new Promise(async (resolve, reject) => {
2630
file = Path.basename(basePath);
2731

@@ -33,7 +37,7 @@ const pushOneFileToS3 = (basePath, to, cacheControllDays = 1) => {
3337
Bucket: to.bucket,
3438
Key: uploadKey,
3539
Body: content,
36-
CacheControl: `max-age=${cacheControll * 60 * 60 * 24}` || 'max-age=86400',
40+
CacheControl: `max-age=${cacheControllDays * 60 * 60 * 24}` || 'max-age=86400',
3741
ContentType: figureOutFileMimetype(basePath),
3842
};
3943

@@ -50,14 +54,11 @@ const pushOneFileToS3 = (basePath, to, cacheControllDays = 1) => {
5054

5155
const canDeploy = () => {
5256
const path = './';
53-
const repositoryExists = git.isGitSync(path);
5457

5558
if (!repositoryExists) {
5659
throw new Error('Cannot read repository')
5760
}
5861

59-
const currentBranch = git.checkSync(path);
60-
6162
// if we cant get info about branch stop deploy
6263
if (!currentBranch) {
6364
throw new Error('Cant get info about branch');

src/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
/**
1919
* @private
2020
*/
21-
const PICKER_VERSION = '1.20.0';
21+
const PICKER_VERSION = '1.20.1';
2222

2323
/**
2424
* @private

src/lib/api/file.spec.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@
3131
* limitations under the License.
3232
*/
3333

34-
import { retrieve, remove, metadata } from './file';
34+
import { retrieve, remove, metadata, download } from './file';
3535
import { FsRequest } from './../request';
3636
import { Session } from '../client';
3737
import { config } from './../../config';
3838

3939
jest.mock('./../request');
40-
jest.mock('./../filelink');
40+
// jest.mock('./../filelink');
4141

4242
const mockedSession: Session = {
4343
apikey: 'fakeApikey',
@@ -95,6 +95,19 @@ describe('FileAPI', () => {
9595
});
9696
});
9797

98+
describe('Download', () => {
99+
it('should return buffer on download request', async () => {
100+
const testResp = Buffer.from('123');
101+
const methodMocked = jest.fn(() => Promise.resolve(testResp));
102+
103+
// @ts-ignore
104+
FsRequest.dispatch.mockImplementation(methodMocked);
105+
const resp = await download(mockedSession, 'gNDNCDWNTKqoGFISdd2A');
106+
107+
expect(resp).toEqual(testResp);
108+
});
109+
});
110+
98111
describe('Remove', () => {
99112
it('should call remove', async () => {
100113
const deleteMocked = jest.fn(() => Promise.resolve({ data: {} }));

0 commit comments

Comments
 (0)