You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@netlify/blobs

Package Overview
Dependencies
Maintainers
20
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@netlify/blobs - npm Package Compare versions

Comparing version

to
1.3.0

1

dist/main.d.ts

@@ -30,2 +30,3 @@ interface APICredentials {

private getFinalRequest;
private isConfigured;
private makeStoreRequest;

@@ -32,0 +33,0 @@ delete(key: string): Promise<void>;

@@ -63,3 +63,9 @@ var HTTPMethod;

}
isConfigured() {
return Boolean(this.authentication?.token) && Boolean(this.siteID);
}
async makeStoreRequest(key, method, extraHeaders, body) {
if (!this.isConfigured()) {
throw new Error("The blob store is unavailable because it's missing required configuration properties");
}
const { headers: baseHeaders = {}, method: finalMethod, url } = await this.getFinalRequest(key, method);

@@ -66,0 +72,0 @@ const headers = {

@@ -144,2 +144,24 @@ import { version as nodeVersion } from 'process';

});
test('Throws when the instance is missing required configuration properties', async () => {
const fetcher = (...args) => {
const [url] = args;
throw new Error(`Unexpected fetch call: ${url}`);
};
const blobs1 = new Blobs({
authentication: {
token: '',
},
fetcher,
siteID,
});
const blobs2 = new Blobs({
authentication: {
token: apiToken,
},
fetcher,
siteID: '',
});
expect(async () => await blobs1.get(key)).rejects.toThrowError(`The blob store is unavailable because it's missing required configuration properties`);
expect(async () => await blobs2.get(key)).rejects.toThrowError(`The blob store is unavailable because it's missing required configuration properties`);
});
});

@@ -223,2 +245,24 @@ describe('set', () => {

});
test('Throws when the instance is missing required configuration properties', async () => {
const fetcher = (...args) => {
const [url] = args;
throw new Error(`Unexpected fetch call: ${url}`);
};
const blobs1 = new Blobs({
authentication: {
token: '',
},
fetcher,
siteID,
});
const blobs2 = new Blobs({
authentication: {
token: apiToken,
},
fetcher,
siteID: '',
});
expect(async () => await blobs1.set(key, value)).rejects.toThrowError(`The blob store is unavailable because it's missing required configuration properties`);
expect(async () => await blobs2.set(key, value)).rejects.toThrowError(`The blob store is unavailable because it's missing required configuration properties`);
});
});

@@ -275,2 +319,24 @@ describe('delete', () => {

});
test('Throws when the instance is missing required configuration properties', async () => {
const fetcher = (...args) => {
const [url] = args;
throw new Error(`Unexpected fetch call: ${url}`);
};
const blobs1 = new Blobs({
authentication: {
token: '',
},
fetcher,
siteID,
});
const blobs2 = new Blobs({
authentication: {
token: apiToken,
},
fetcher,
siteID: '',
});
expect(async () => await blobs1.delete(key)).rejects.toThrowError(`The blob store is unavailable because it's missing required configuration properties`);
expect(async () => await blobs2.delete(key)).rejects.toThrowError(`The blob store is unavailable because it's missing required configuration properties`);
});
});

2

package.json
{
"name": "@netlify/blobs",
"version": "1.2.0",
"version": "1.3.0",
"description": "A JavaScript client for the Netlify Blob Store",

@@ -5,0 +5,0 @@ "type": "module",