torchsdk 10.1.2 → 10.1.3
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/dist/gateway.d.ts +8 -5
- package/dist/gateway.d.ts.map +1 -1
- package/dist/gateway.js +15 -13
- package/dist/gateway.js.map +1 -1
- package/package.json +1 -1
package/dist/gateway.d.ts
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Gateway URL utilities for
|
|
3
|
-
*
|
|
2
|
+
* Gateway URL utilities for Arweave content
|
|
3
|
+
* Irys gateway is dead (deprecated Nov 2025) — all reads go through arweave.net
|
|
4
|
+
* Data uploaded via Irys was settled to Arweave, so same tx IDs work on arweave.net
|
|
4
5
|
*/
|
|
5
6
|
/**
|
|
6
|
-
* Convert
|
|
7
|
+
* Convert any Irys URL to arweave.net
|
|
7
8
|
*/
|
|
9
|
+
export declare const irysToArweave: (url: string) => string;
|
|
10
|
+
/** @deprecated Use irysToArweave */
|
|
8
11
|
export declare const irysToUploader: (url: string) => string;
|
|
9
12
|
/**
|
|
10
|
-
* Check if URL is from Irys gateway
|
|
13
|
+
* Check if URL is from Irys (dead) gateway or uploader
|
|
11
14
|
*/
|
|
12
15
|
export declare const isIrysUrl: (url: string) => boolean;
|
|
13
16
|
/**
|
|
14
|
-
* Fetch with automatic
|
|
17
|
+
* Fetch with automatic rewrite from dead Irys domains to arweave.net
|
|
15
18
|
*/
|
|
16
19
|
export declare const fetchWithFallback: (url: string, options?: RequestInit, timeoutMs?: number) => Promise<Response>;
|
|
17
20
|
//# sourceMappingURL=gateway.d.ts.map
|
package/dist/gateway.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gateway.d.ts","sourceRoot":"","sources":["../src/gateway.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"gateway.d.ts","sourceRoot":"","sources":["../src/gateway.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH;;GAEG;AACH,eAAO,MAAM,aAAa,GAAI,KAAK,MAAM,KAAG,MACwC,CAAA;AAEpF,oCAAoC;AACpC,eAAO,MAAM,cAAc,QAJQ,MAAM,KAAG,MAID,CAAA;AAE3C;;GAEG;AACH,eAAO,MAAM,SAAS,GAAI,KAAK,MAAM,KAAG,OAOvC,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAC5B,KAAK,MAAM,EACX,UAAU,WAAW,EACrB,YAAW,MAAc,KACxB,OAAO,CAAC,QAAQ,CAalB,CAAA"}
|
package/dist/gateway.js
CHANGED
|
@@ -1,23 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Gateway URL utilities for
|
|
4
|
-
*
|
|
3
|
+
* Gateway URL utilities for Arweave content
|
|
4
|
+
* Irys gateway is dead (deprecated Nov 2025) — all reads go through arweave.net
|
|
5
|
+
* Data uploaded via Irys was settled to Arweave, so same tx IDs work on arweave.net
|
|
5
6
|
*/
|
|
6
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.fetchWithFallback = exports.isIrysUrl = exports.irysToUploader = void 0;
|
|
8
|
+
exports.fetchWithFallback = exports.isIrysUrl = exports.irysToUploader = exports.irysToArweave = void 0;
|
|
8
9
|
const IRYS_GATEWAY = 'gateway.irys.xyz';
|
|
9
10
|
const IRYS_UPLOADER = 'uploader.irys.xyz';
|
|
11
|
+
const ARWEAVE_GATEWAY = 'arweave.net';
|
|
10
12
|
/**
|
|
11
|
-
* Convert
|
|
13
|
+
* Convert any Irys URL to arweave.net
|
|
12
14
|
*/
|
|
13
|
-
const
|
|
14
|
-
exports.
|
|
15
|
+
const irysToArweave = (url) => url.replace(IRYS_GATEWAY, ARWEAVE_GATEWAY).replace(IRYS_UPLOADER, ARWEAVE_GATEWAY);
|
|
16
|
+
exports.irysToArweave = irysToArweave;
|
|
17
|
+
/** @deprecated Use irysToArweave */
|
|
18
|
+
exports.irysToUploader = exports.irysToArweave;
|
|
15
19
|
/**
|
|
16
|
-
* Check if URL is from Irys gateway
|
|
20
|
+
* Check if URL is from Irys (dead) gateway or uploader
|
|
17
21
|
*/
|
|
18
22
|
const isIrysUrl = (url) => {
|
|
19
23
|
try {
|
|
20
|
-
|
|
24
|
+
const host = new URL(url).hostname;
|
|
25
|
+
return host === IRYS_GATEWAY || host === IRYS_UPLOADER;
|
|
21
26
|
}
|
|
22
27
|
catch {
|
|
23
28
|
return false;
|
|
@@ -25,19 +30,16 @@ const isIrysUrl = (url) => {
|
|
|
25
30
|
};
|
|
26
31
|
exports.isIrysUrl = isIrysUrl;
|
|
27
32
|
/**
|
|
28
|
-
* Fetch with automatic
|
|
33
|
+
* Fetch with automatic rewrite from dead Irys domains to arweave.net
|
|
29
34
|
*/
|
|
30
35
|
const fetchWithFallback = async (url, options, timeoutMs = 10000) => {
|
|
31
36
|
const controller = new AbortController();
|
|
32
37
|
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
33
38
|
const opts = { ...options, signal: controller.signal };
|
|
34
39
|
try {
|
|
35
|
-
// If it's an Irys gateway URL, use uploader directly (gateway has SSL issues)
|
|
36
40
|
if ((0, exports.isIrysUrl)(url)) {
|
|
37
|
-
|
|
38
|
-
return await fetch(uploaderUrl, opts);
|
|
41
|
+
return await fetch((0, exports.irysToArweave)(url), opts);
|
|
39
42
|
}
|
|
40
|
-
// For non-Irys URLs, fetch normally
|
|
41
43
|
return await fetch(url, opts);
|
|
42
44
|
}
|
|
43
45
|
finally {
|
package/dist/gateway.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gateway.js","sourceRoot":"","sources":["../src/gateway.ts"],"names":[],"mappings":";AAAA;;;
|
|
1
|
+
{"version":3,"file":"gateway.js","sourceRoot":"","sources":["../src/gateway.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,MAAM,YAAY,GAAG,kBAAkB,CAAA;AACvC,MAAM,aAAa,GAAG,mBAAm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