@seedprotocol/arweave 0.7.12 → 0.7.13-next.1527.g318ec68

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/README.md CHANGED
@@ -70,7 +70,7 @@ See [GATEWAY_HYPER.md](https://github.com/JournoLabs/seed-protocol-sdk/blob/main
70
70
  | | Gateway constants and env helpers: `DEFAULT_ARWEAVE_HOST`, `DEFAULT_ARWEAVE_GATEWAYS`, `ARWEAVE_HOST_ENV_KEYS`, `resolveArweaveHostFromEnv`, `getArweaveReadGatewayHostsForPrimary` |
71
71
  | | Read gateways: `ensureReadGatewaySelected`, `selectFirstHealthyReadGateway`, `probeGateway`, `getArweaveReadBaseUrls`, `fetchArweaveRawFromBaseUrl`, `fetchArweaveRawTextAcrossGateways`, `setPreferredArweaveReadBaseUrls` |
72
72
  | | Circuit breaker: `configureGatewayCircuitBreaker`, `isGatewayHostCircuitOpen`, `recordGatewayHostSuccess` / `recordGatewayHostFailure` |
73
- | | Gateway config: `resolveSeedGatewayEndpoints`, `seedGatewayConfigFromSeedConfig`, `seedGatewayConfigFromClientContext`, `SeedGatewayConfig`, `ResolvedSeedGatewayEndpoints` |
73
+ | | Gateway config: `resolveSeedGatewayEndpoints`, `resolveSidecarOrigin`, `seedGatewayConfigFromSeedConfig`, `seedGatewayConfigFromClientContext`, `SeedGatewayConfig`, `ResolvedSeedGatewayEndpoints` |
74
74
  | | Upload pipeline status: `getArweaveUploadStatus`, `isArweaveL1AnchoringComplete`, `getUploadPipelineTransactionStatus`, `queryArweaveGatewayTransactionWithFallback` |
75
75
  | | Media / relation refs: `classifyMediaRef`, `normalizeFeedItemFields`, `getArweaveUrlForTransaction`, `resolveSeedRssImageRelationRef`, `resolveSeedIdsFromRefString` |
76
76
  | | GraphQL documents (e.g. `GET_TRANSACTION_TAGS`) and types (`TransactionStatus`, `TransactionTag`, `GetDataOptions`, `DownloadResult`) |
@@ -9,11 +9,19 @@ export declare function resetArweaveReadGatewayForTests(): void;
9
9
  export declare function isReadGatewayKnownHealthy(): boolean;
10
10
  /** Last gateway host that passed /info, if any. */
11
11
  export declare function getLastHealthyReadGatewayHost(): string | null;
12
- /**
13
- * GET /info with timeout. Treat 2xx + JSON object as healthy.
14
- * Records circuit-breaker success/failure for the host.
15
- */
16
- export declare function probeGateway(baseUrl: string, signal?: AbortSignal): Promise<boolean>;
12
+ export type ProbeGatewayOptions = {
13
+ /** Aborts the probe. A probe the caller aborts resolves false and isn't counted as a failure. */
14
+ signal?: AbortSignal;
15
+ /** Gives up (and counts a failure) after this long, with or without `signal`. Default 5 s. */
16
+ timeoutMs?: number;
17
+ /**
18
+ * Record the result in the gateway circuit breaker, and skip a host whose circuit is open.
19
+ * Default true. Pass false for a status check that shouldn't change which gateways reads use.
20
+ */
21
+ recordCircuit?: boolean;
22
+ };
23
+ /** GET /info. Healthy when it answers 2xx with a JSON object. */
24
+ export declare function probeGateway(baseUrl: string, { signal, timeoutMs, recordCircuit }?: ProbeGatewayOptions): Promise<boolean>;
17
25
  export declare function selectFirstHealthyReadGateway(hosts: string[], protocol?: 'http' | 'https', signal?: AbortSignal): Promise<string | null>;
18
26
  /**
19
27
  * Probes gateways in order and applies the first healthy host via {@link BaseArweaveClient.applyProbedReadGateway}.
@@ -22,7 +30,8 @@ export declare function selectFirstHealthyReadGateway(hosts: string[], protocol?
22
30
  *
23
31
  * When every probe fails, keeps the last known healthy host (if any) instead of
24
32
  * treating the preferred-but-unreachable host as selected, and caches
25
- * `healthy: false` so {@link isReadGatewayKnownHealthy} reflects that.
33
+ * `healthy: false` so {@link isReadGatewayKnownHealthy} reflects that. When `signal` aborts before a
34
+ * host passes, nothing is cached and it returns the last healthy host (else the current one).
26
35
  */
27
36
  export declare function ensureReadGatewaySelected(signal?: AbortSignal): Promise<string>;
28
37
  //# sourceMappingURL=selectReadGateway.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"selectReadGateway.d.ts","sourceRoot":"","sources":["../../src/ArweaveClient/selectReadGateway.ts"],"names":[],"mappings":"AA8BA,+EAA+E;AAC/E,wBAAgB,0BAA0B,IAAI,IAAI,CAGjD;AAED,oFAAoF;AACpF,wBAAgB,+BAA+B,IAAI,IAAI,CAQtD;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,IAAI,OAAO,CAMnD;AAED,mDAAmD;AACnD,wBAAgB,6BAA6B,IAAI,MAAM,GAAG,IAAI,CAE7D;AAED;;;GAGG;AACH,wBAAsB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,CAmD1F;AAED,wBAAsB,6BAA6B,CACjD,KAAK,EAAE,MAAM,EAAE,EACf,QAAQ,GAAE,MAAM,GAAG,OAAiB,EACpC,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAWxB;AAMD;;;;;;;;GAQG;AACH,wBAAsB,yBAAyB,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CA0DrF"}
1
+ {"version":3,"file":"selectReadGateway.d.ts","sourceRoot":"","sources":["../../src/ArweaveClient/selectReadGateway.ts"],"names":[],"mappings":"AA+BA,+EAA+E;AAC/E,wBAAgB,0BAA0B,IAAI,IAAI,CAGjD;AAED,oFAAoF;AACpF,wBAAgB,+BAA+B,IAAI,IAAI,CAQtD;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,IAAI,OAAO,CAMnD;AAED,mDAAmD;AACnD,wBAAgB,6BAA6B,IAAI,MAAM,GAAG,IAAI,CAE7D;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,iGAAiG;IACjG,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,8FAA8F;IAC9F,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB,CAAA;AAED,iEAAiE;AACjE,wBAAsB,YAAY,CAChC,OAAO,EAAE,MAAM,EACf,EAAE,MAAM,EAAE,SAA4B,EAAE,aAAoB,EAAE,GAAE,mBAAwB,GACvF,OAAO,CAAC,OAAO,CAAC,CAoDlB;AAED,wBAAsB,6BAA6B,CACjD,KAAK,EAAE,MAAM,EAAE,EACf,QAAQ,GAAE,MAAM,GAAG,OAAiB,EACpC,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAWxB;AAMD;;;;;;;;;GASG;AACH,wBAAsB,yBAAyB,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CA+DrF"}