@pinata/sdk 1.2.1 → 2.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.babelrc +1 -1
- package/.eslintrc +7 -7
- package/.husky/pre-commit +6 -0
- package/.nvmrc +1 -1
- package/README.md +3 -3
- package/lib/pinata-sdk.js +494 -468
- package/lib/pinata-sdk.min.js +5 -5
- package/package.json +83 -71
- package/src/commands/data/getFilesByCount/{getFilesByCount.js → getFilesByCount.ts} +8 -9
- package/src/commands/data/index.ts +4 -0
- package/src/commands/data/pinList/pinList.ts +77 -0
- package/src/commands/data/pinList/{queryBuilder.js → queryBuilder.ts} +6 -16
- package/src/commands/data/{testAuthentication.js → testAuthentication.ts} +8 -9
- package/src/commands/data/{userPinnedDataTotal.js → userPinnedDataTotal.ts} +4 -9
- package/src/commands/pinning/{hashMetadata.js → hashMetadata.ts} +9 -11
- package/src/commands/pinning/index.ts +8 -0
- package/src/commands/pinning/{pinByHash.js → pinByHash.ts} +22 -11
- package/src/commands/pinning/{pinFileToIPFS.js → pinFileToIPFS.ts} +27 -11
- package/src/commands/pinning/{pinFromFS.js → pinFromFS.ts} +14 -19
- package/src/commands/pinning/{pinJSONToIPFS.js → pinJSONToIPFS.ts} +5 -11
- package/src/commands/pinning/pinJobs/{pinJobs.js → pinJobs.ts} +23 -9
- package/src/commands/pinning/pinJobs/{queryBuilder.js → queryBuilder.ts} +2 -8
- package/src/commands/pinning/{unpin.js → unpin.ts} +3 -9
- package/src/{constants.js → constants.ts} +0 -0
- package/src/index.ts +120 -0
- package/src/third-party/base-path-converter.d.ts +3 -0
- package/src/third-party/is-ipfs.d.ts +5 -0
- package/src/third-party/recursive-fs.d.ts +5 -0
- package/src/util/{errorResponse.js → errorResponse.ts} +1 -1
- package/src/util/{validators.js → validators.ts} +14 -33
- package/test/commands/data/getFilesByCount/{getFilesByCount.test.js → getFilesByCount.test.ts} +23 -22
- package/test/commands/data/pinList/{pinList.test.js → pinList.test.ts} +25 -26
- package/test/commands/data/pinList/{queryBuilder.test.js → queryBuilder.test.ts} +9 -10
- package/test/commands/data/pinlist-sample-api.ts +540 -0
- package/test/commands/data/{testAuthentication.test.js → testAuthentication.test.ts} +13 -13
- package/test/commands/data/{userPinnedDataTotal.test.js → userPinnedDataTotal.test.ts} +4 -4
- package/test/commands/pinning/{hashMetadata.test.js → hashMetadata.test.ts} +7 -8
- package/test/commands/pinning/{pinByHash.test.js → pinByHash.test.ts} +4 -5
- package/test/commands/pinning/{pinFileToIPFS.test.js → pinFileToIPFS.test.ts} +5 -7
- package/test/commands/pinning/{pinFromFS.js → pinFromFS.ts} +5 -6
- package/test/commands/pinning/{pinJSONToIPFS.test.js → pinJSONToIPFS.test.ts} +4 -5
- package/test/commands/pinning/pinJobs/{pinJobs.test.js → pinJobs.test.ts} +4 -4
- package/test/commands/pinning/pinJobs/{queryBuilder.test.js → queryBuilder.test.ts} +5 -5
- package/test/commands/pinning/{unpin.test.js → unpin.test.ts} +4 -5
- package/test/util/validators.test.ts +234 -0
- package/tsconfig.json +2 -2
- package/types/commands/data/getFilesByCount/getFilesByCount.d.ts +4 -2
- package/types/commands/data/index.d.ts +4 -0
- package/types/commands/data/pinList/pinList.d.ts +45 -8
- package/types/commands/data/pinList/queryBuilder.d.ts +1 -7
- package/types/commands/data/testAuthentication.d.ts +5 -7
- package/types/commands/data/userPinnedDataTotal.d.ts +2 -7
- package/types/commands/pinning/hashMetadata.d.ts +3 -9
- package/types/commands/pinning/index.d.ts +8 -0
- package/types/commands/pinning/pinByHash.d.ts +14 -9
- package/types/commands/pinning/pinFileToIPFS.d.ts +25 -1
- package/types/commands/pinning/pinFromFS.d.ts +3 -9
- package/types/commands/pinning/pinJSONToIPFS.d.ts +3 -9
- package/types/commands/pinning/pinJobs/pinJobs.d.ts +20 -8
- package/types/commands/pinning/pinJobs/queryBuilder.d.ts +1 -7
- package/types/commands/pinning/unpin.d.ts +2 -8
- package/types/constants.d.ts +2 -2
- package/types/index.d.ts +37 -165
- package/types/util/errorResponse.d.ts +1 -1
- package/types/util/validators.d.ts +20 -37
- package/webpack.config.js +50 -53
- package/src/commands/data/pinList/pinList.js +0 -34
- package/src/commands/pinning/hashPinPolicy.js +0 -51
- package/src/commands/pinning/userPinPolicy.js +0 -40
- package/src/index.js +0 -307
- package/test/commands/data/pinlist-sample-api.js +0 -540
- package/test/commands/pinning/hashPinPolicy.test.js +0 -65
- package/test/commands/pinning/userPinPolicy.test.js +0 -80
- package/test/util/validators.test.js +0 -234
package/.babelrc
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"presets": [["@babel/env", { "modules": "commonjs" , "useBuiltIns": "usage"}] ],
|
|
2
|
+
"presets": ["@babel/preset-typescript", ["@babel/env", { "modules": "commonjs" , "useBuiltIns": "usage"}] ],
|
|
3
3
|
"plugins": ["add-module-exports", "@babel/plugin-transform-runtime"]
|
|
4
4
|
}
|
|
5
5
|
|
package/.eslintrc
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
2
|
+
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
|
|
3
|
+
"parser": "@typescript-eslint/parser",
|
|
4
|
+
"plugins": ["@typescript-eslint"],
|
|
5
|
+
"root": true,
|
|
3
6
|
"env": {
|
|
4
7
|
"browser": true,
|
|
5
8
|
"es6": true,
|
|
6
|
-
"node": true
|
|
9
|
+
"node": true,
|
|
10
|
+
"jest": true
|
|
7
11
|
},
|
|
8
12
|
|
|
9
13
|
"globals": {
|
|
@@ -16,14 +20,10 @@
|
|
|
16
20
|
"before": true,
|
|
17
21
|
"it": true,
|
|
18
22
|
"expect": true,
|
|
19
|
-
"sinon": true
|
|
23
|
+
"sinon": true
|
|
20
24
|
},
|
|
21
25
|
|
|
22
|
-
"parser": "babel-eslint",
|
|
23
26
|
|
|
24
|
-
"plugins": [
|
|
25
|
-
|
|
26
|
-
],
|
|
27
27
|
|
|
28
28
|
"rules": {
|
|
29
29
|
"block-scoped-var": 2,
|
package/.nvmrc
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
v14.0
|
package/README.md
CHANGED
|
@@ -20,20 +20,20 @@ In the example below we provided with 3 ways to call the pinata SDK.
|
|
|
20
20
|
```javascript
|
|
21
21
|
// Use the api keys by providing the strings directly
|
|
22
22
|
const pinataSDK = require('@pinata/sdk');
|
|
23
|
-
const pinata = pinataSDK('yourPinataApiKey', 'yourPinataSecretApiKey');
|
|
23
|
+
const pinata = new pinataSDK('yourPinataApiKey', 'yourPinataSecretApiKey');
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
```javascript
|
|
27
27
|
// Use the api keys by specifying your api key and api secret
|
|
28
28
|
const pinataSDK = require('@pinata/sdk');
|
|
29
|
-
const pinata = pinataSDK({ pinataApiKey: 'yourPinataApiKey', pinataSecretApiKey: 'yourPinataSecretApiKey' });
|
|
29
|
+
const pinata = new pinataSDK({ pinataApiKey: 'yourPinataApiKey', pinataSecretApiKey: 'yourPinataSecretApiKey' });
|
|
30
30
|
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
```javascript
|
|
34
34
|
// Use the JWT key
|
|
35
35
|
const pinataSDK = require('@pinata/sdk');
|
|
36
|
-
const pinata = pinataSDK({ pinataJWTKey: 'yourPinataJWTKey'});
|
|
36
|
+
const pinata = new pinataSDK({ pinataJWTKey: 'yourPinataJWTKey'});
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
Quickly test that you can connect to the API with the following call:
|