@fusebit/add-on-sdk
Advanced tools
Comparing version
@@ -287,2 +287,6 @@ const Superagent = require('superagent'); | ||
get: async function (storageSubId) { | ||
storageSubId = storageSubId ? removeTrailingSlash(removeLeadingSlash(storageSubId)) : ''; | ||
if (!storageSubId && !storageIdPrefix) { | ||
return undefined; | ||
} | ||
const response = await Superagent.get(getUrl(storageSubId)) | ||
@@ -294,2 +298,8 @@ .set('Authorization', `Bearer ${accessToken}`) | ||
put: async function (data, storageSubId) { | ||
storageSubId = storageSubId ? removeTrailingSlash(removeLeadingSlash(storageSubId)) : ''; | ||
if (!storageSubId && !storageIdPrefix) { | ||
throw new Error( | ||
'Storage objects cannot be stored at the root of the hierarchy. Specify a storageSubId when calling the `put` method, or a storageIdPrefix when creating the storage client.' | ||
); | ||
} | ||
const response = await Superagent.put(getUrl(storageSubId)).set('Authorization', `Bearer ${accessToken}`).send(data); | ||
@@ -310,3 +320,3 @@ return response.body; | ||
}, | ||
list: async function (storageSubId, { count, next }) { | ||
list: async function (storageSubId, { count, next } = {}) { | ||
const response = await Superagent.get(`${getUrl(storageSubId)}/*`) | ||
@@ -313,0 +323,0 @@ .query(isNaN(count) ? undefined : { count }) |
{ | ||
"name": "@fusebit/add-on-sdk", | ||
"version": "3.0.2", | ||
"version": "3.0.3", | ||
"description": "SDK for implementing Fusebit Add-Ons", | ||
@@ -14,4 +14,11 @@ "main": "lib/index.js", | ||
"devDependencies": { | ||
"prettier": "^2.0.5" | ||
"node-notifier": ">=8.0.1", | ||
"prettier": "^2.0.5", | ||
"jest": "^26.6.3", | ||
"uuid": "^8.3.2" | ||
}, | ||
"scripts": { | ||
"test": "jest --colors", | ||
"coverage": "jest --colors --coverage" | ||
} | ||
} |
@@ -5,6 +5,32 @@ # add-on-sdk | ||
## Running tests | ||
Here are a few things you need to know before running tests: | ||
- You must have access to a [Fusebit](https://fusebit.io) subscription. | ||
- You must have the [Fusebit CLI](https://fusebit.io/docs/reference/fusebit-cli/) installed. | ||
- You must have a Fusebit CLI profile configured with an account ID and subscription ID, and sufficient permissions to manage all functions and all storage on that subscription. | ||
- The test will create and remove functions in randomly named boundary in the subscription. | ||
- The test will create and remove storage objects in randomly named storage ID in the subscription. | ||
To run the tests, set the `FUSE_PROFILE` environment variable to the Fusebit CLI profile name to use: | ||
``` | ||
FUSE_PROFILE={profile-name} npm test | ||
``` | ||
In case of a failure, you can get useful, verbose diagnostic information with: | ||
``` | ||
debug=1 FUSE_PROFILE={profile-name} npm test | ||
``` | ||
## Release Notes | ||
### v3.0.3 | ||
- Fix bug in parameter processing in the storage client | ||
### v3.0.2 | ||
- Allow turning off debugging by setting `debug=0` in the configuration of the function |
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
40332
152.79%10
100%802
167.33%36
260%4
300%6
200%2
Infinity%