@pinata/sdk 2.0.0 → 3.0.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.
Files changed (78) hide show
  1. package/LICENSE +1 -2
  2. package/README.md +58 -695
  3. package/index.d.ts +9 -0
  4. package/index.js +6 -0
  5. package/index.mjs +4 -0
  6. package/legacy.js +15 -0
  7. package/package.json +58 -84
  8. package/react/index.d.ts +1 -0
  9. package/react/index.js +3 -0
  10. package/react/index.mjs +1 -0
  11. package/.babelrc +0 -5
  12. package/.editorconfig +0 -12
  13. package/.eslintrc +0 -173
  14. package/.husky/pre-commit +0 -6
  15. package/.nvmrc +0 -1
  16. package/.travis.yml +0 -5
  17. package/lib/pinata-sdk.js +0 -24514
  18. package/lib/pinata-sdk.min.js +0 -22
  19. package/pinata.png +0 -0
  20. package/src/commands/data/getFilesByCount/getFilesByCount.ts +0 -66
  21. package/src/commands/data/index.ts +0 -4
  22. package/src/commands/data/pinList/pinList.ts +0 -77
  23. package/src/commands/data/pinList/queryBuilder.ts +0 -239
  24. package/src/commands/data/testAuthentication.ts +0 -31
  25. package/src/commands/data/userPinnedDataTotal.ts +0 -24
  26. package/src/commands/pinning/hashMetadata.ts +0 -56
  27. package/src/commands/pinning/index.ts +0 -8
  28. package/src/commands/pinning/pinByHash.ts +0 -65
  29. package/src/commands/pinning/pinFileToIPFS.ts +0 -118
  30. package/src/commands/pinning/pinFromFS.ts +0 -50
  31. package/src/commands/pinning/pinJSONToIPFS.ts +0 -47
  32. package/src/commands/pinning/pinJobs/pinJobs.ts +0 -50
  33. package/src/commands/pinning/pinJobs/queryBuilder.ts +0 -75
  34. package/src/commands/pinning/unpin.ts +0 -32
  35. package/src/constants.ts +0 -4
  36. package/src/index.ts +0 -123
  37. package/src/third-party/base-path-converter.d.ts +0 -3
  38. package/src/third-party/is-ipfs.d.ts +0 -5
  39. package/src/util/errorResponse.ts +0 -10
  40. package/src/util/validators.ts +0 -182
  41. package/test/commands/data/getFilesByCount/getFilesByCount.test.ts +0 -212
  42. package/test/commands/data/pinList/pinList.test.ts +0 -102
  43. package/test/commands/data/pinList/queryBuilder.test.ts +0 -439
  44. package/test/commands/data/pinlist-sample-api.ts +0 -540
  45. package/test/commands/data/testAuthentication.test.ts +0 -34
  46. package/test/commands/data/userPinnedDataTotal.test.ts +0 -29
  47. package/test/commands/pinning/hashMetadata.test.ts +0 -76
  48. package/test/commands/pinning/pinByHash.test.ts +0 -46
  49. package/test/commands/pinning/pinFileToIPFS.test.ts +0 -53
  50. package/test/commands/pinning/pinFromFS.ts +0 -32
  51. package/test/commands/pinning/pinJSONToIPFS.test.ts +0 -42
  52. package/test/commands/pinning/pinJobs/pinJobs.test.ts +0 -29
  53. package/test/commands/pinning/pinJobs/queryBuilder.test.ts +0 -120
  54. package/test/commands/pinning/unpin.test.ts +0 -46
  55. package/test/util/validators.test.ts +0 -234
  56. package/tsconfig.json +0 -23
  57. package/types/commands/data/getFilesByCount/getFilesByCount.d.ts +0 -14
  58. package/types/commands/data/index.d.ts +0 -4
  59. package/types/commands/data/pinList/pinList.d.ts +0 -45
  60. package/types/commands/data/pinList/queryBuilder.d.ts +0 -1
  61. package/types/commands/data/testAuthentication.d.ts +0 -5
  62. package/types/commands/data/userPinnedDataTotal.d.ts +0 -2
  63. package/types/commands/pinning/hashMetadata.d.ts +0 -3
  64. package/types/commands/pinning/hashPinPolicy.d.ts +0 -9
  65. package/types/commands/pinning/index.d.ts +0 -8
  66. package/types/commands/pinning/pinByHash.d.ts +0 -14
  67. package/types/commands/pinning/pinFileToIPFS.d.ts +0 -25
  68. package/types/commands/pinning/pinFromFS.d.ts +0 -3
  69. package/types/commands/pinning/pinJSONToIPFS.d.ts +0 -3
  70. package/types/commands/pinning/pinJobs/pinJobs.d.ts +0 -20
  71. package/types/commands/pinning/pinJobs/queryBuilder.d.ts +0 -1
  72. package/types/commands/pinning/unpin.d.ts +0 -2
  73. package/types/commands/pinning/userPinPolicy.d.ts +0 -8
  74. package/types/constants.d.ts +0 -2
  75. package/types/index.d.ts +0 -38
  76. package/types/util/errorResponse.d.ts +0 -1
  77. package/types/util/validators.d.ts +0 -37
  78. package/webpack.config.js +0 -58
package/index.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ export * from "pinata";
2
+
3
+ /**
4
+ * @deprecated The v2 default export was removed. Use the named export instead:
5
+ * `import { PinataSDK } from "@pinata/sdk"` with `new PinataSDK({ pinataJwt })`.
6
+ * Calling this throws.
7
+ */
8
+ declare const LegacyPinataSDK: (...args: unknown[]) => never;
9
+ export default LegacyPinataSDK;
package/index.js ADDED
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ const pinata = require("pinata");
4
+ const LegacyPinataSDK = require("./legacy.js");
5
+
6
+ module.exports = Object.assign(LegacyPinataSDK, pinata);
package/index.mjs ADDED
@@ -0,0 +1,4 @@
1
+ import LegacyPinataSDK from "./legacy.js";
2
+
3
+ export * from "pinata";
4
+ export default LegacyPinataSDK;
package/legacy.js ADDED
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ // v2 of @pinata/sdk exported a constructor as the default export
4
+ // (`new pinataSDK(key, secret)`). v3 is the `pinata` package, so calling the
5
+ // old default export throws a migration hint instead of a cryptic TypeError.
6
+ function LegacyPinataSDK() {
7
+ throw new Error(
8
+ "@pinata/sdk v3 is an alias of the `pinata` package and the v2 API has been removed. " +
9
+ "Use `const { PinataSDK } = require('@pinata/sdk')` with `new PinataSDK({ pinataJwt })`, " +
10
+ "or pin `@pinata/sdk@2` to keep the old API. " +
11
+ "Migration guide: https://github.com/PinataCloud/pinata/tree/main/packages/sdk-alias#migrating-from-v2",
12
+ );
13
+ }
14
+
15
+ module.exports = LegacyPinataSDK;
package/package.json CHANGED
@@ -1,86 +1,60 @@
1
1
  {
2
- "name": "@pinata/sdk",
3
- "version": "2.0.0",
4
- "description": "Official SDK for the Pinata IPFS platform",
5
- "main": "lib/pinata-sdk.js",
6
- "types": "types/index.d.ts",
7
- "scripts": {
8
- "prepare": "husky install",
9
- "build": "npm run build-dev && npm run build-prod && npm run test && tsc",
10
- "build-dev": "webpack --env dev",
11
- "build-prod": "webpack --env build",
12
- "coverage": "jest --coverage",
13
- "dev": "webpack --progress --colors --watch --env dev",
14
- "html": "open coverage/index.html",
15
- "lint": "eslint src --quiet ",
16
- "lint:fix": "eslint src test --fix",
17
- "test": "./node_modules/.bin/jest --env=node",
18
- "repl": "node -i -e \"$(< ./lib/pinata-sdk.js)\""
19
- },
20
- "repository": {
21
- "type": "git",
22
- "url": "https://github.com/PinataCloud/Pinata-SDK.git"
23
- },
24
- "keywords": [
25
- "webpack",
26
- "es6",
27
- "starter",
28
- "library",
29
- "universal",
30
- "umd",
31
- "commonjs"
32
- ],
33
- "author": "Matt Ober",
34
- "license": "MIT",
35
- "bugs": {
36
- "url": "https://github.com/PinataCloud/Pinata-SDK/issues"
37
- },
38
- "homepage": "https://github.com/PinataCloud/Pinata-SDK",
39
- "devDependencies": {
40
- "@babel/cli": "^7.8.4",
41
- "@babel/core": "^7.8.4",
42
- "@babel/plugin-transform-runtime": "^7.19.1",
43
- "@babel/preset-env": "^7.19.4",
44
- "@babel/preset-typescript": "^7.18.6",
45
- "@babel/register": "^7.8.3",
46
- "@types/jest": "^29.2.0",
47
- "@types/node": "^15.6.1",
48
- "@typescript-eslint/eslint-plugin": "^5.41.0",
49
- "@typescript-eslint/parser": "^5.41.0",
50
- "acorn": "^7.1.0",
51
- "babel-eslint": "^10.0.3",
52
- "babel-loader": "^8.0.6",
53
- "babel-plugin-add-module-exports": "^1.0.2",
54
- "babel-polyfill": "^6.26.0",
55
- "eslint": "^8.26.0",
56
- "eslint-loader": "^3.0.3",
57
- "husky": "^8.0.0",
58
- "jest": "^25.1.0",
59
- "source-map-loader": "^4.0.1",
60
- "typescript": "^4.8.4",
61
- "uglifyjs-webpack-plugin": "^2.2.0",
62
- "webpack": "^4.41.6",
63
- "webpack-cli": "^3.3.11"
64
- },
65
- "dependencies": {
66
- "axios": "^0.21.1",
67
- "base-path-converter": "^1.0.2",
68
- "form-data": "^2.3.3",
69
- "is-ipfs": "^0.6.0",
70
- "path": "^0.12.7"
71
- },
72
- "jest": {
73
- "collectCoverage": true,
74
- "coverageReporters": [
75
- "text",
76
- "html"
77
- ],
78
- "moduleFileExtensions": [
79
- "ts",
80
- "tsx",
81
- "js",
82
- "jsx",
83
- "json"
84
- ]
85
- }
2
+ "name": "@pinata/sdk",
3
+ "version": "3.0.0",
4
+ "description": "Alias of the official Pinata SDK (`pinata`)",
5
+ "main": "./index.js",
6
+ "module": "./index.mjs",
7
+ "types": "./index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./index.d.ts",
11
+ "import": "./index.mjs",
12
+ "require": "./index.js"
13
+ },
14
+ "./react": {
15
+ "types": "./react/index.d.ts",
16
+ "import": "./react/index.mjs",
17
+ "require": "./react/index.js"
18
+ }
19
+ },
20
+ "files": [
21
+ "index.js",
22
+ "index.mjs",
23
+ "index.d.ts",
24
+ "legacy.js",
25
+ "react"
26
+ ],
27
+ "scripts": {
28
+ "test": "node --test test/*.test.cjs test/*.test.mjs"
29
+ },
30
+ "dependencies": {
31
+ "pinata": "^2.5.7"
32
+ },
33
+ "peerDependencies": {
34
+ "react": ">=16.8.0",
35
+ "react-dom": ">=16.8.0"
36
+ },
37
+ "peerDependenciesMeta": {
38
+ "react": {
39
+ "optional": true
40
+ },
41
+ "react-dom": {
42
+ "optional": true
43
+ }
44
+ },
45
+ "engines": {
46
+ "node": ">=20"
47
+ },
48
+ "repository": {
49
+ "type": "git",
50
+ "url": "git+https://github.com/PinataCloud/pinata.git",
51
+ "directory": "packages/sdk-alias"
52
+ },
53
+ "homepage": "https://docs.pinata.cloud/sdk",
54
+ "bugs": {
55
+ "url": "https://github.com/PinataCloud/pinata/issues"
56
+ },
57
+ "keywords": ["pinata", "ipfs", "sdk"],
58
+ "author": "Pinata Cloud Technologies",
59
+ "license": "MIT"
86
60
  }
@@ -0,0 +1 @@
1
+ export * from "pinata/react";
package/react/index.js ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+
3
+ module.exports = require("pinata/react");
@@ -0,0 +1 @@
1
+ export * from "pinata/react";
package/.babelrc DELETED
@@ -1,5 +0,0 @@
1
- {
2
- "presets": ["@babel/preset-typescript", ["@babel/env", { "modules": "commonjs" , "useBuiltIns": "usage"}] ],
3
- "plugins": ["add-module-exports", "@babel/plugin-transform-runtime"]
4
- }
5
-
package/.editorconfig DELETED
@@ -1,12 +0,0 @@
1
- root = true
2
-
3
- [*]
4
- indent_style = space
5
- indent_size = 4
6
- end_of_line = LF
7
- charset = utf-8
8
- trim_trailing_whitespace = true
9
- insert_final_newline = true
10
-
11
- [*.md]
12
- trim_trailing_whitespace = false
package/.eslintrc DELETED
@@ -1,173 +0,0 @@
1
- {
2
- "extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
3
- "parser": "@typescript-eslint/parser",
4
- "plugins": ["@typescript-eslint"],
5
- "root": true,
6
- "env": {
7
- "browser": true,
8
- "es6": true,
9
- "node": true,
10
- "jest": true
11
- },
12
-
13
- "globals": {
14
- "document": false,
15
- "escape": false,
16
- "navigator": false,
17
- "unescape": false,
18
- "window": false,
19
- "describe": true,
20
- "before": true,
21
- "it": true,
22
- "expect": true,
23
- "sinon": true
24
- },
25
-
26
-
27
-
28
- "rules": {
29
- "block-scoped-var": 2,
30
- "brace-style": [2, "1tbs", { "allowSingleLine": true }],
31
- "comma-dangle": [2, "never"],
32
- "comma-spacing": [2, { "before": false, "after": true }],
33
- "comma-style": [2, "last"],
34
- "complexity": 0,
35
- "consistent-return": 2,
36
- "consistent-this": 0,
37
- "curly": [2, "multi-line"],
38
- "default-case": 0,
39
- "dot-location": [2, "property"],
40
- "dot-notation": 0,
41
- "eol-last": 2,
42
- "eqeqeq": [2, "allow-null"],
43
- "func-names": 0,
44
- "func-style": 0,
45
- "generator-star-spacing": [2, "both"],
46
- "guard-for-in": 0,
47
- "handle-callback-err": [2, "^(err|error|anySpecificError)$" ],
48
- "key-spacing": [2, { "beforeColon": false, "afterColon": true }],
49
- "keyword-spacing": [2, {"before": true, "after": true}],
50
- "linebreak-style": 0,
51
- "max-depth": 0,
52
- "max-nested-callbacks": 0,
53
- "max-params": 0,
54
- "max-statements": 0,
55
- "new-cap": [2, { "newIsCap": true, "capIsNew": false }],
56
- "new-parens": 2,
57
- "no-alert": 0,
58
- "no-array-constructor": 2,
59
- "no-bitwise": 0,
60
- "no-caller": 2,
61
- "no-catch-shadow": 0,
62
- "no-cond-assign": 2,
63
- "no-console": 0,
64
- "no-constant-condition": 0,
65
- "no-continue": 0,
66
- "no-control-regex": 2,
67
- "no-debugger": 2,
68
- "no-delete-var": 2,
69
- "no-div-regex": 0,
70
- "no-dupe-args": 2,
71
- "no-dupe-keys": 2,
72
- "no-duplicate-case": 2,
73
- "no-else-return": 2,
74
- "no-empty": 0,
75
- "no-empty-character-class": 2,
76
- "no-eq-null": 0,
77
- "no-eval": 2,
78
- "no-ex-assign": 2,
79
- "no-extend-native": 2,
80
- "no-extra-bind": 2,
81
- "no-extra-boolean-cast": 2,
82
- "no-extra-parens": 0,
83
- "no-extra-semi": 0,
84
- "no-extra-strict": 0,
85
- "no-fallthrough": 2,
86
- "no-floating-decimal": 2,
87
- "no-func-assign": 2,
88
- "no-implied-eval": 2,
89
- "no-inline-comments": 0,
90
- "no-inner-declarations": [2, "functions"],
91
- "no-invalid-regexp": 2,
92
- "no-irregular-whitespace": 2,
93
- "no-iterator": 2,
94
- "no-label-var": 2,
95
- "no-labels": 2,
96
- "no-lone-blocks": 0,
97
- "no-lonely-if": 0,
98
- "no-loop-func": 0,
99
- "no-mixed-requires": 0,
100
- "no-mixed-spaces-and-tabs": [2, false],
101
- "no-multi-spaces": 2,
102
- "no-multi-str": 2,
103
- "no-multiple-empty-lines": [2, { "max": 1 }],
104
- "no-native-reassign": 2,
105
- "no-negated-in-lhs": 2,
106
- "no-nested-ternary": 0,
107
- "no-new": 2,
108
- "no-new-func": 2,
109
- "no-new-object": 2,
110
- "no-new-require": 2,
111
- "no-new-wrappers": 2,
112
- "no-obj-calls": 2,
113
- "no-octal": 2,
114
- "no-octal-escape": 2,
115
- "no-path-concat": 0,
116
- "no-plusplus": 0,
117
- "no-process-env": 0,
118
- "no-process-exit": 0,
119
- "no-proto": 2,
120
- "no-redeclare": 2,
121
- "no-regex-spaces": 2,
122
- "no-reserved-keys": 0,
123
- "no-restricted-modules": 0,
124
- "no-return-assign": 2,
125
- "no-script-url": 0,
126
- "no-self-compare": 2,
127
- "no-sequences": 2,
128
- "no-shadow": 0,
129
- "no-shadow-restricted-names": 2,
130
- "no-spaced-func": 2,
131
- "no-sparse-arrays": 2,
132
- "no-sync": 0,
133
- "no-ternary": 0,
134
- "no-throw-literal": 2,
135
- "no-trailing-spaces": 2,
136
- "no-undef": 2,
137
- "no-undef-init": 2,
138
- "no-undefined": 0,
139
- "no-underscore-dangle": 0,
140
- "no-unneeded-ternary": 2,
141
- "no-unreachable": 2,
142
- "no-unused-expressions": 0,
143
- "no-unused-vars": [2, { "vars": "all", "args": "none" }],
144
- "no-use-before-define": 2,
145
- "no-var": 0,
146
- "no-void": 0,
147
- "no-warning-comments": 0,
148
- "no-with": 2,
149
- "one-var": 0,
150
- "operator-assignment": 0,
151
- "operator-linebreak": [2, "after"],
152
- "padded-blocks": 0,
153
- "quote-props": 0,
154
- "quotes": [2, "single", "avoid-escape"],
155
- "semi": [2, "always"],
156
- "semi-spacing": 0,
157
- "sort-vars": 0,
158
- "space-before-blocks": [2, "always"],
159
- "space-before-function-paren": [2, {"anonymous": "always", "named": "never"}],
160
- "space-in-brackets": 0,
161
- "space-in-parens": [2, "never"],
162
- "space-infix-ops": 2,
163
- "space-unary-ops": [2, { "words": true, "nonwords": false }],
164
- "strict": 0,
165
- "use-isnan": 2,
166
- "valid-jsdoc": 0,
167
- "valid-typeof": 2,
168
- "vars-on-top": 2,
169
- "wrap-iife": [2, "any"],
170
- "wrap-regex": 0,
171
- "yoda": [2, "never"]
172
- }
173
- }
package/.husky/pre-commit DELETED
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env sh
2
- . "$(dirname -- "$0")/_/husky.sh"
3
-
4
- npm run lint:fix
5
- npm test
6
- npm build
package/.nvmrc DELETED
@@ -1 +0,0 @@
1
- v14.0
package/.travis.yml DELETED
@@ -1,5 +0,0 @@
1
- language: node_js
2
- node_js:
3
- - "node"
4
- - "7"
5
- - "6"