Skip to content
This repository has been archived by the owner on Aug 7, 2024. It is now read-only.

Commit

Permalink
New release fixing unpin / a few lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Ober authored and Matt Ober committed Apr 11, 2020
1 parent a1be86c commit b93a169
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 26 deletions.
16 changes: 8 additions & 8 deletions lib/pinata-sdk.js

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions lib/pinata-sdk.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pinata/sdk",
"version": "1.1.6-beta.0",
"version": "1.1.7",
"description": "Official SDK for the Pinata IPFS platform",
"main": "lib/pinata-sdk.js",
"scripts": {
Expand Down
1 change: 0 additions & 1 deletion src/commands/pinning/hashPinPolicy.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { baseUrl } from './../../constants';
import { validateApiKeys, validatePinPolicyStructure } from '../../util/validators';
import isIPFS from 'is-ipfs';


export default function hashPinPolicy(pinataApiKey, pinataSecretApiKey, ipfsPinHash, newPinPolicy) {
validateApiKeys(pinataApiKey, pinataSecretApiKey);
validatePinPolicyStructure(newPinPolicy);
Expand Down
2 changes: 1 addition & 1 deletion src/commands/pinning/pinByHash.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import axios from 'axios';
import { baseUrl } from './../../constants';
import { validateApiKeys, validateHostNodes, validateMetadata, validatePinPolicyStructure } from '../../util/validators';
import { validateApiKeys, validateMetadata } from '../../util/validators';
import isIPFS from 'is-ipfs';

export default function pinByHash(pinataApiKey, pinataSecretApiKey, hashToPin, options) {
Expand Down
18 changes: 9 additions & 9 deletions src/util/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,21 @@ export function validateMetadata(metadata) {

export function validatePinPolicyStructure(pinPolicy) {
//this function takes in a pin policy and checks the JSON structure to make sure it's valid
if(!pinPolicy) {
throw new Error("No pin policy provided");
if (!pinPolicy) {
throw new Error('No pin policy provided');
}

if(!pinPolicy.regions) {
throw new Error("No regions provided in pin policy");
if (!pinPolicy.regions) {
throw new Error('No regions provided in pin policy');
}
if(pinPolicy.regions.length) {
if (pinPolicy.regions.length) {
pinPolicy.regions.forEach((region) => {
if(!region.id || !(Object.prototype.toString.call(region.id) === "[object String]")) {
throw new Error("region id must be a string");
if (!region.id || !(Object.prototype.toString.call(region.id) === '[object String]')) {
throw new Error('region id must be a string');
}

if (!(region.desiredReplicationCount || region.desiredReplicationCount === 0) || !Number.isInteger(region.desiredReplicationCount)) {
throw new Error("desiredReplicationCount must be an integer");
throw new Error('desiredReplicationCount must be an integer');
}
});
}
Expand All @@ -88,7 +88,7 @@ export function validatePinataOptions(options) {
}

if (options.hostNodes) {
validateHostNodes(options.hostNodes)
validateHostNodes(options.hostNodes);
}

if (options.customPinPolicy) {
Expand Down

0 comments on commit b93a169

Please sign in to comment.