@ardrive/turbo-sdk 1.9.1-alpha.1 → 1.10.0-alpha.1

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 (73) hide show
  1. package/README.md +58 -0
  2. package/bundles/web.bundle.min.js +25370 -12548
  3. package/lib/cjs/common/factory.js +19 -9
  4. package/lib/cjs/common/http.js +1 -1
  5. package/lib/cjs/common/logger.js +1 -1
  6. package/lib/cjs/common/token/arweave.js +2 -2
  7. package/lib/cjs/common/token/ethereum.js +2 -2
  8. package/lib/cjs/common/token/solana.js +2 -2
  9. package/lib/cjs/common/turbo.js +3 -0
  10. package/lib/cjs/common/upload.js +106 -3
  11. package/lib/cjs/node/index.js +1 -0
  12. package/lib/cjs/node/upload.js +72 -0
  13. package/lib/cjs/types.js +6 -2
  14. package/lib/cjs/utils/base64.js +6 -6
  15. package/lib/cjs/utils/common.js +5 -2
  16. package/lib/cjs/utils/readableStream.js +1 -2
  17. package/lib/cjs/version.js +1 -1
  18. package/lib/cjs/web/factory.js +2 -1
  19. package/lib/cjs/web/index.js +1 -0
  20. package/lib/cjs/web/upload.js +57 -0
  21. package/lib/esm/common/factory.js +18 -8
  22. package/lib/esm/common/http.js +1 -1
  23. package/lib/esm/common/logger.js +1 -1
  24. package/lib/esm/common/token/arweave.js +2 -2
  25. package/lib/esm/common/token/ethereum.js +2 -2
  26. package/lib/esm/common/token/solana.js +2 -2
  27. package/lib/esm/common/turbo.js +3 -0
  28. package/lib/esm/common/upload.js +104 -1
  29. package/lib/esm/node/index.js +1 -0
  30. package/lib/esm/node/upload.js +68 -0
  31. package/lib/esm/types.js +2 -0
  32. package/lib/esm/utils/common.js +3 -0
  33. package/lib/esm/version.js +1 -1
  34. package/lib/esm/web/factory.js +3 -2
  35. package/lib/esm/web/index.js +1 -0
  36. package/lib/esm/web/upload.js +53 -0
  37. package/lib/types/common/factory.d.ts.map +1 -1
  38. package/lib/types/common/http.d.ts +0 -3
  39. package/lib/types/common/http.d.ts.map +1 -1
  40. package/lib/types/common/logger.d.ts.map +1 -1
  41. package/lib/types/common/signer.d.ts +0 -1
  42. package/lib/types/common/signer.d.ts.map +1 -1
  43. package/lib/types/common/token/arweave.d.ts.map +1 -1
  44. package/lib/types/common/token/ethereum.d.ts.map +1 -1
  45. package/lib/types/common/token/solana.d.ts.map +1 -1
  46. package/lib/types/common/turbo.d.ts +2 -1
  47. package/lib/types/common/turbo.d.ts.map +1 -1
  48. package/lib/types/common/upload.d.ts +18 -2
  49. package/lib/types/common/upload.d.ts.map +1 -1
  50. package/lib/types/node/index.d.ts +1 -0
  51. package/lib/types/node/index.d.ts.map +1 -1
  52. package/lib/types/node/signer.d.ts +0 -1
  53. package/lib/types/node/signer.d.ts.map +1 -1
  54. package/lib/types/node/upload.d.ts +15 -0
  55. package/lib/types/node/upload.d.ts.map +1 -0
  56. package/lib/types/types.d.ts +40 -4
  57. package/lib/types/types.d.ts.map +1 -1
  58. package/lib/types/utils/base64.d.ts +0 -1
  59. package/lib/types/utils/base64.d.ts.map +1 -1
  60. package/lib/types/utils/common.d.ts +1 -0
  61. package/lib/types/utils/common.d.ts.map +1 -1
  62. package/lib/types/utils/readableStream.d.ts +0 -2
  63. package/lib/types/utils/readableStream.d.ts.map +1 -1
  64. package/lib/types/version.d.ts +1 -1
  65. package/lib/types/version.d.ts.map +1 -1
  66. package/lib/types/web/factory.d.ts.map +1 -1
  67. package/lib/types/web/index.d.ts +1 -0
  68. package/lib/types/web/index.d.ts.map +1 -1
  69. package/lib/types/web/signer.d.ts +0 -1
  70. package/lib/types/web/signer.d.ts.map +1 -1
  71. package/lib/types/web/upload.d.ts +29 -0
  72. package/lib/types/web/upload.d.ts.map +1 -0
  73. package/package.json +6 -2
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { JWKInterface } from '../common/jwk.js';
3
2
  import { Base64String, PublicArweaveAddress } from '../types.js';
4
3
  export declare const base64URLRegex: RegExp;
@@ -1 +1 @@
1
- {"version":3,"file":"base64.d.ts","sourceRoot":"","sources":["../../../src/utils/base64.ts"],"names":[],"mappings":";AAmBA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEjE,eAAO,MAAM,cAAc,QAAwB,CAAC;AAEpD,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,YAAY,GAChB,oBAAoB,CAEtB;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,YAAY,GAAG,oBAAoB,CAExE;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,CAStD;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CAErD;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY,CAExD"}
1
+ {"version":3,"file":"base64.d.ts","sourceRoot":"","sources":["../../../src/utils/base64.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEjE,eAAO,MAAM,cAAc,QAAwB,CAAC;AAEpD,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,YAAY,GAChB,oBAAoB,CAEtB;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,YAAY,GAAG,oBAAoB,CAExE;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,CAStD;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CAErD;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY,CAExD"}
@@ -15,4 +15,5 @@
15
15
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  */
17
17
  export declare function sleep(ms: number): Promise<void>;
18
+ export declare function isWeb(): boolean;
18
19
  //# sourceMappingURL=common.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/utils/common.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE/C"}
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/utils/common.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE/C;AAED,wBAAgB,KAAK,YAEpB"}
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
  /**
4
2
  * Copyright (C) 2022-2024 Permanent Data Solutions, Inc. All Rights Reserved.
5
3
  *
@@ -1 +1 @@
1
- {"version":3,"file":"readableStream.d.ts","sourceRoot":"","sources":["../../../src/utils/readableStream.ts"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,wBAAsB,sBAAsB,CAAC,EAC3C,MAAM,EACN,IAAI,GACL,EAAE;IACD,MAAM,EAAE,cAAc,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;CACd,GAAG,OAAO,CAAC,MAAM,CAAC,CAelB"}
1
+ {"version":3,"file":"readableStream.d.ts","sourceRoot":"","sources":["../../../src/utils/readableStream.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,wBAAsB,sBAAsB,CAAC,EAC3C,MAAM,EACN,IAAI,GACL,EAAE;IACD,MAAM,EAAE,cAAc,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;CACd,GAAG,OAAO,CAAC,MAAM,CAAC,CAelB"}
@@ -14,5 +14,5 @@
14
14
  * You should have received a copy of the GNU Affero General Public License
15
15
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  */
17
- export declare const version = "1.9.0";
17
+ export declare const version = "1.9.1-alpha.1";
18
18
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,eAAO,MAAM,OAAO,UAAU,CAAC"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,eAAO,MAAM,OAAO,kBAAkB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/web/factory.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EACL,wBAAwB,EAIzB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EACL,SAAS,EACT,+BAA+B,EAC/B,WAAW,EACX,WAAW,EAGZ,MAAM,aAAa,CAAC;AAGrB,qBAAa,YAAa,SAAQ,gBAAgB;IAChD,SAAS,CAAC,MAAM,CAAC,SAAS,CACxB,cAAc,EAAE,WAAW,GAAG,SAAS,EACvC,kBAAkB,EAAE,WAAW,GAAG,SAAS,EAC3C,KAAK,EAAE,SAAS,GACf,2BAA2B;IA+B9B,MAAM,CAAC,aAAa,CAAC,EACnB,UAAU,EACV,MAAM,EAAE,cAAc,EACtB,oBAAyB,EACzB,mBAAwB,EACxB,KAAK,EACL,UAAU,EACV,QAAQ,EACR,UAAU,GACX,EAAE,+BAA+B;CA+CnC"}
1
+ {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/web/factory.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EACL,wBAAwB,EAGzB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EACL,SAAS,EACT,+BAA+B,EAC/B,WAAW,EACX,WAAW,EAGZ,MAAM,aAAa,CAAC;AAIrB,qBAAa,YAAa,SAAQ,gBAAgB;IAChD,SAAS,CAAC,MAAM,CAAC,SAAS,CACxB,cAAc,EAAE,WAAW,GAAG,SAAS,EACvC,kBAAkB,EAAE,WAAW,GAAG,SAAS,EAC3C,KAAK,EAAE,SAAS,GACf,2BAA2B;IA+B9B,MAAM,CAAC,aAAa,CAAC,EACnB,UAAU,EACV,MAAM,EAAE,cAAc,EACtB,oBAAyB,EACzB,mBAAwB,EACxB,KAAK,EACL,UAAU,EACV,QAAQ,EACR,UAAU,GACX,EAAE,+BAA+B;CA+CnC"}
@@ -15,6 +15,7 @@
15
15
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  */
17
17
  export * from './factory.js';
18
+ export * from './upload.js';
18
19
  export * from './signer.js';
19
20
  export * from '../common/index.js';
20
21
  export * from '../types.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/web/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/web/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC"}
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  /**
3
2
  * Copyright (C) 2022-2024 Permanent Data Solutions, Inc. All Rights Reserved.
4
3
  *
@@ -1 +1 @@
1
- {"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../../../src/web/signer.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EACL,eAAe,EACf,aAAa,EACb,cAAc,EACd,eAAe,EAEhB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EACL,iBAAiB,EACjB,yBAAyB,EACzB,yBAAyB,EACzB,mBAAmB,EACpB,MAAM,aAAa,CAAC;AAGrB;;GAEG;AACH,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,cAAc,EAAE,eAAe,EAAE,CAAC;AAE3E;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,2BAA2B;gBACxD,CAAC,EAAE,yBAAyB;YAI1B,YAAY;IAUb,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC;IAK/B,YAAY,CAAC,EACxB,iBAAiB,EACjB,eAAe,EACf,YAAY,GACb,EAAE,mBAAmB,GAAG,OAAO,CAAC;QAE/B,qBAAqB,EAAE,MAAM,MAAM,CAAC;QACpC,mBAAmB,EAAE,iBAAiB,CAAC;KACxC,CAAC;IAoBW,4BAA4B,IAAI,OAAO,CAAC,yBAAyB,CAAC;IAKlE,QAAQ,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;CAInE"}
1
+ {"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../../../src/web/signer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EACL,eAAe,EACf,aAAa,EACb,cAAc,EACd,eAAe,EAEhB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EACL,iBAAiB,EACjB,yBAAyB,EACzB,yBAAyB,EACzB,mBAAmB,EACpB,MAAM,aAAa,CAAC;AAGrB;;GAEG;AACH,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,cAAc,EAAE,eAAe,EAAE,CAAC;AAE3E;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,2BAA2B;gBACxD,CAAC,EAAE,yBAAyB;YAI1B,YAAY;IAUb,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC;IAK/B,YAAY,CAAC,EACxB,iBAAiB,EACjB,eAAe,EACf,YAAY,GACb,EAAE,mBAAmB,GAAG,OAAO,CAAC;QAE/B,qBAAqB,EAAE,MAAM,MAAM,CAAC;QACpC,mBAAmB,EAAE,iBAAiB,CAAC;KACxC,CAAC;IAoBW,4BAA4B,IAAI,OAAO,CAAC,yBAAyB,CAAC;IAKlE,QAAQ,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;CAInE"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Copyright (C) 2022-2024 Permanent Data Solutions, Inc. All Rights Reserved.
3
+ *
4
+ * This program is free software: you can redistribute it and/or modify
5
+ * it under the terms of the GNU Affero General Public License as published by
6
+ * the Free Software Foundation, either version 3 of the License, or
7
+ * (at your option) any later version.
8
+ *
9
+ * This program is distributed in the hope that it will be useful,
10
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ * GNU Affero General Public License for more details.
13
+ *
14
+ * You should have received a copy of the GNU Affero General Public License
15
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
16
+ */
17
+ import { TurboAuthenticatedBaseUploadService } from '../common/upload.js';
18
+ import { TurboAuthenticatedUploadServiceConfiguration, TurboUploadFolderParams } from '../types.js';
19
+ export declare class TurboAuthenticatedWebUploadService extends TurboAuthenticatedBaseUploadService {
20
+ constructor({ url, retryConfig, signer, logger, token, }: TurboAuthenticatedUploadServiceConfiguration);
21
+ getFiles(params: TurboUploadFolderParams): Promise<File[]>;
22
+ getFileStreamForFile(file: File): ReadableStream;
23
+ getFileSize(file: File): number;
24
+ getFileName(file: File): string;
25
+ getRelativePath(file: File): string;
26
+ contentTypeFromFile(file: File): string;
27
+ createManifestStream(manifestBuffer: Buffer): ReadableStream;
28
+ }
29
+ //# sourceMappingURL=upload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../../../src/web/upload.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EACL,mCAAmC,EAEpC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,4CAA4C,EAC5C,uBAAuB,EAExB,MAAM,aAAa,CAAC;AAErB,qBAAa,kCAAmC,SAAQ,mCAAmC;gBAC7E,EACV,GAA6B,EAC7B,WAAW,EACX,MAAM,EACN,MAAM,EACN,KAAK,GACN,EAAE,4CAA4C;IAI/C,QAAQ,CAAC,MAAM,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAO1D,oBAAoB,CAAC,IAAI,EAAE,IAAI,GAAG,cAAc;IAIhD,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM;IAI/B,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM;IAI/B,eAAe,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM;IAInC,mBAAmB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM;IAIvC,oBAAoB,CAAC,cAAc,EAAE,MAAM,GAAG,cAAc;CAS7D"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ardrive/turbo-sdk",
3
- "version": "1.9.1-alpha.1",
3
+ "version": "1.10.0-alpha.1",
4
4
  "main": "./lib/cjs/node/index.js",
5
5
  "types": "./lib/types/node/index.d.ts",
6
6
  "module": "./lib/esm/node/index.js",
@@ -79,6 +79,8 @@
79
79
  "bignumber.js": "^9.1.2",
80
80
  "bs58": "^5.0.0",
81
81
  "ethers": "^6.12.0",
82
+ "mime-types": "^2.1.35",
83
+ "plimit-lit": "^3.0.1",
82
84
  "tweetnacl": "^1.0.3",
83
85
  "winston": "^3.10.0"
84
86
  },
@@ -91,6 +93,7 @@
91
93
  "@semantic-release/git": "^10.0.1",
92
94
  "@trivago/prettier-plugin-sort-imports": "^4.2.0",
93
95
  "@types/chai": "^4.3.5",
96
+ "@types/mime-types": "^2.1.4",
94
97
  "@types/mocha": "^10.0.1",
95
98
  "@types/node": "^20.4.8",
96
99
  "@types/sinon": "^10.0.15",
@@ -114,11 +117,12 @@
114
117
  "husky": "^8.0.3",
115
118
  "markdown-toc-gen": "^1.0.1",
116
119
  "mocha": "^10.2.0",
120
+ "node-fetch": "^3.3.2",
117
121
  "prettier": "^3.0.2",
118
122
  "rimraf": "^5.0.1",
119
123
  "semantic-release": "^21.0.7",
120
124
  "sinon": "^15.2.0",
121
125
  "ts-node": "^10.9.1",
122
- "typescript": "^5.1.6"
126
+ "typescript": "^5.5.4"
123
127
  }
124
128
  }