@oneblink/sdk
Advanced tools
Comparing version 0.2.5 to 0.2.6
@@ -5,2 +5,16 @@ # Changelog | ||
## 0.2.6 (2019-03-14) | ||
### Added | ||
- `Jobs` class with `createJob()` and `deleteJob()` functions | ||
### Dependencies | ||
- update [aws-sdk](https://www.npmjs.com/package/aws-sdk) to [2.400.0](https://github.com/aws/aws-sdk-js/releases/tag/v2.400.0) (from [2.336.0](https://github.com/aws/aws-sdk-js/releases/tag/v2.336.0)) | ||
- update [jsonwebtoken](https://www.npmjs.com/package/jsonwebtoken) to [8.4.0](https://github.com/auth0/node-jsonwebtoken/blob/master/CHANGELOG.md) (from [8.3.0](https://github.com/auth0/node-jsonwebtoken/blob/master/CHANGELOG.md)) | ||
- depend upon [joi](https://www.npmjs.com/package/joi) [14.3.1](https://github.com/hapijs/joi/blob/master/CHANGELOG.md) | ||
## 0.2.5 (2018-01-14) | ||
@@ -7,0 +21,0 @@ |
// @flow | ||
'use strict' | ||
/* :: | ||
import type { | ||
Form, | ||
ConstructorOptions, | ||
FormsSearchOptions, | ||
FormsSearchResult, | ||
S3SubmissionData | ||
} from '../types.js' | ||
*/ | ||
const generateFormUrl = require('../lib/generate-form-url.js') | ||
@@ -15,0 +5,0 @@ const generateJWT = require('../lib/generate-jwt.js') |
// @flow | ||
'use strict' | ||
/* :: | ||
import type { | ||
ConstructorOptions, | ||
Key | ||
} from '../types.js' | ||
*/ | ||
const OneBlinkAPI = require('../lib/one-blink-api.js') | ||
@@ -12,0 +5,0 @@ |
// @flow | ||
'use strict' | ||
/* :: | ||
import type { | ||
ConstructorOptions, | ||
Organisation | ||
} from '../types.js' | ||
*/ | ||
const OneBlinkAPI = require('../lib/one-blink-api.js') | ||
@@ -12,0 +5,0 @@ |
@@ -5,2 +5,3 @@ // @flow | ||
const Forms = require('./classes/Forms.js') | ||
const Jobs = require('./classes/Jobs.js') | ||
const Keys = require('./classes/Keys.js') | ||
@@ -11,4 +12,5 @@ const Organisations = require('./classes/Organisations.js') | ||
Forms, | ||
Jobs, | ||
Keys, | ||
Organisations | ||
} |
@@ -15,2 +15,3 @@ // @flow | ||
const pkg = require('../package.json') | ||
const generateJWT = require('./generate-jwt.js') | ||
@@ -44,2 +45,3 @@ | ||
secretKey: string | ||
jwtExpiry: number | ||
*/ | ||
@@ -58,2 +60,3 @@ constructor ( | ||
this.jwtExpiry = 300 | ||
this.accessKey = accessKey | ||
@@ -64,2 +67,4 @@ this.secretKey = secretKey | ||
}) | ||
this.oneBlinkAPI.defaults.headers.common['User-Agent'] = `${pkg.name}@${pkg.version}` | ||
} | ||
@@ -71,7 +76,5 @@ | ||
// 5 minute expiry | ||
const jwtExpiry = 300 | ||
return this.oneBlinkAPI.get(path, { | ||
headers: { | ||
'Authorization': `Bearer ${generateJWT(this.accessKey, this.secretKey, jwtExpiry)}` | ||
'Authorization': `Bearer ${generateJWT(this.accessKey, this.secretKey, this.jwtExpiry)}` | ||
} | ||
@@ -96,7 +99,5 @@ }) | ||
// 5 minute expiry | ||
const jwtExpiry = 300 | ||
return this.oneBlinkAPI.post(path, body, { | ||
headers: { | ||
'Authorization': `Bearer ${generateJWT(this.accessKey, this.secretKey, jwtExpiry)}` | ||
'Authorization': `Bearer ${generateJWT(this.accessKey, this.secretKey, this.jwtExpiry)}` | ||
} | ||
@@ -107,2 +108,17 @@ }) | ||
} | ||
async deleteRequest ( | ||
path /* : string */ | ||
) /* : Promise<void> */ { | ||
// 5 minute expiry | ||
try { | ||
await this.oneBlinkAPI.delete(path, { | ||
headers: { | ||
'Authorization': `Bearer ${generateJWT(this.accessKey, this.secretKey, this.jwtExpiry)}` | ||
} | ||
}) | ||
} catch (error) { | ||
errorHandler(error) | ||
} | ||
} | ||
} |
// @flow | ||
'use strict' | ||
/* :: | ||
import type { | ||
PreFillMeta, | ||
S3SubmissionData | ||
} from '../types.js' | ||
*/ | ||
const AWS = require('aws-sdk') | ||
@@ -27,3 +20,5 @@ | ||
Key: preFillMeta.s3.key, | ||
Body: Buffer.from(JSON.stringify(data), 'UTF-8') | ||
Body: Buffer.from(JSON.stringify(data), 'UTF-8'), | ||
Expires: new Date(new Date().setFullYear(new Date().getFullYear() + 1)), // Max 1 year | ||
CacheControl: 'max-age=31536000' // Max 1 year(365 days) | ||
} | ||
@@ -30,0 +25,0 @@ const uploadOptions = { |
// @flow | ||
'use strict' | ||
/* :: | ||
import type { | ||
FormRetrievalData, | ||
S3SubmissionData | ||
} from '../types.js' | ||
*/ | ||
const AWS = require('aws-sdk') | ||
@@ -12,0 +5,0 @@ |
{ | ||
"name": "@oneblink/sdk", | ||
"description": "OneBlink SDK to serve as an entry point for all OneBlink Services in NodeJS", | ||
"version": "0.2.5", | ||
"version": "0.2.6", | ||
"bugs": { | ||
@@ -9,18 +9,19 @@ "url": "https://github.com/blinkmobile/oneblink-sdk-js/issues" | ||
"dependencies": { | ||
"aws-sdk": "2.336.0", | ||
"aws-sdk": "2.400.0", | ||
"axios": "0.18.0", | ||
"jsonwebtoken": "8.3.0" | ||
"joi": "14.3.1", | ||
"jsonwebtoken": "8.4.0" | ||
}, | ||
"devDependencies": { | ||
"eslint": "^5.7.0", | ||
"eslint": "^5.13.0", | ||
"eslint-config-standard": "^12.0.0", | ||
"eslint-plugin-import": "^2.14.0", | ||
"eslint-plugin-node": "^7.0.1", | ||
"eslint-plugin-import": "^2.16.0", | ||
"eslint-plugin-node": "^8.0.1", | ||
"eslint-plugin-promise": "^4.0.1", | ||
"eslint-plugin-standard": "^4.0.0", | ||
"fixpack": "^2.3.1", | ||
"flow-bin": "^0.83.0", | ||
"jest": "^23.6.0", | ||
"remark-cli": "^5.0.0", | ||
"remark-lint": "^6.0.2", | ||
"flow-bin": "^0.92.1", | ||
"jest": "^24.1.0", | ||
"remark-cli": "^6.0.1", | ||
"remark-lint": "^6.0.4", | ||
"remark-preset-lint-recommended": "^3.0.2" | ||
@@ -38,6 +39,6 @@ }, | ||
"files": [ | ||
"flow-typed", | ||
"lib", | ||
"classes", | ||
"index.js", | ||
"types.js" | ||
"index.js" | ||
], | ||
@@ -44,0 +45,0 @@ "homepage": "https://github.com/blinkmobile/oneblink-sdk-js", |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
60619
17
1811
4
1
+ Addedjoi@14.3.1
+ Addedaws-sdk@2.400.0(transitive)
+ Addedhoek@6.1.3(transitive)
+ Addedisemail@3.2.0(transitive)
+ Addedjoi@14.3.1(transitive)
+ Addedjsonwebtoken@8.4.0(transitive)
+ Addedpunycode@2.3.1(transitive)
+ Addedtopo@3.0.3(transitive)
+ Addeduuid@3.3.2(transitive)
- Removedaws-sdk@2.336.0(transitive)
- Removedjsonwebtoken@8.3.0(transitive)
- Removeduuid@3.1.0(transitive)
Updatedaws-sdk@2.400.0
Updatedjsonwebtoken@8.4.0