@seedprotocol/arweave 0.7.3-next.613.g79a8dfd → 0.7.4-next.711.gce2b766
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/ArweaveClient/BaseArweaveClient.d.ts +7 -0
- package/dist/ArweaveClient/BaseArweaveClient.d.ts.map +1 -1
- package/dist/ArweaveClient/transactionTagsByIds.d.ts +20 -0
- package/dist/ArweaveClient/transactionTagsByIds.d.ts.map +1 -0
- package/dist/content/arweaveContent.d.ts +45 -0
- package/dist/content/arweaveContent.d.ts.map +1 -0
- package/dist/gateway/readBaseUrls.d.ts +1 -0
- package/dist/gateway/readBaseUrls.d.ts.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +155 -128
- package/dist/index.js.map +1 -1
- package/dist/node.js +1 -1
- package/dist/{queries-C6DuZ2GV.js → queries-CYWn1SYL.js} +48 -21
- package/dist/queries-CYWn1SYL.js.map +1 -0
- package/package.json +1 -1
- package/dist/queries-C6DuZ2GV.js.map +0 -1
|
@@ -4,6 +4,8 @@ import type { IArweaveClient } from './IArweaveClient.js';
|
|
|
4
4
|
export declare abstract class BaseArweaveClient {
|
|
5
5
|
private static _impl;
|
|
6
6
|
static configure(impl: IArweaveClient): void;
|
|
7
|
+
/** True once a platform (SDK, Node bootstrap, host app) has registered an implementation. */
|
|
8
|
+
static isConfigured(): boolean;
|
|
7
9
|
private static requireImpl;
|
|
8
10
|
/**
|
|
9
11
|
* Resolved gateway host (no scheme) and protocol from env override or setHost().
|
|
@@ -85,6 +87,11 @@ export declare abstract class BaseArweaveClient {
|
|
|
85
87
|
static getStatusUrl(transactionId: string): string;
|
|
86
88
|
static getArweaveClient(): GraphQLClient;
|
|
87
89
|
static getTransactionStatus(transactionId: string): Promise<TransactionStatus>;
|
|
90
|
+
/**
|
|
91
|
+
* Transaction data from the platform client. Decoded data goes through `transformArweaveContent`
|
|
92
|
+
* when a read transform is registered (see `content/arweaveContent.ts`); `decode: false` returns
|
|
93
|
+
* the encoded data as is.
|
|
94
|
+
*/
|
|
88
95
|
static getTransactionData(transactionId: string, options?: GetDataOptions): Promise<Uint8Array | string>;
|
|
89
96
|
static getTransactionTags(transactionId: string): Promise<TransactionTag[]>;
|
|
90
97
|
static createTransaction(data: string | Uint8Array, options?: CreateTransactionOptions): Promise<any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseArweaveClient.d.ts","sourceRoot":"","sources":["../../src/ArweaveClient/BaseArweaveClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,KAAK,EACV,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,wBAAwB,EACzB,MAAM,qBAAqB,CAAA;AAE5B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"BaseArweaveClient.d.ts","sourceRoot":"","sources":["../../src/ArweaveClient/BaseArweaveClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,KAAK,EACV,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,wBAAwB,EACzB,MAAM,qBAAqB,CAAA;AAE5B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAqBzD,8BAAsB,iBAAiB;IACrC,OAAO,CAAC,MAAM,CAAC,KAAK,CAA8B;IAElD,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI;IAS5C,6FAA6F;IAC7F,MAAM,CAAC,YAAY,IAAI,OAAO;IAI9B,OAAO,CAAC,MAAM,CAAC,WAAW;IAS1B;;OAEG;IACH,MAAM,CAAC,cAAc,IAAI;QAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;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M,CAAC;IAa/B,MAAM,CAAC,kBAAkB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAI3E,MAAM,CAAC,iBAAiB,CACtB,IAAI,EAAE,MAAM,GAAG,UAAU,EACzB,OAAO,CAAC,EAAE,wBAAwB,GACjC,OAAO,CAAC,GAAG,CAAC;IAIf,MAAM,CAAC,aAAa,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;CAG7E"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { GraphQLClient } from 'graphql-request';
|
|
2
|
+
import type { TransactionTag } from '../types/arweave.js';
|
|
3
|
+
/** Arweave GraphQL serves at most 100 transactions per page. */
|
|
4
|
+
export declare const TRANSACTION_TAGS_BATCH_SIZE = 100;
|
|
5
|
+
/**
|
|
6
|
+
* Plain string, not a codegen document: the `graphql()` helper from the client preset only knows
|
|
7
|
+
* documents present when codegen last ran.
|
|
8
|
+
*/
|
|
9
|
+
export declare const GET_TRANSACTIONS_TAGS_BY_IDS = "\n query GetTransactionsTagsByIds($ids: [ID!], $first: Int) {\n transactions(ids: $ids, first: $first) {\n edges {\n node {\n id\n tags {\n name\n value\n }\n }\n }\n }\n }\n";
|
|
10
|
+
/**
|
|
11
|
+
* Tags of many transactions in batched GraphQL requests (`transactions(ids: [...])`), keyed by id.
|
|
12
|
+
* A transaction the gateway does not know yet (e.g. just published, not indexed) is absent from
|
|
13
|
+
* the map; a failed batch is skipped (logged through `onError`) rather than failing the caller.
|
|
14
|
+
*/
|
|
15
|
+
export declare function getTransactionTagsByIds(transactionIds: readonly string[], options?: {
|
|
16
|
+
client?: GraphQLClient;
|
|
17
|
+
batchSize?: number;
|
|
18
|
+
onError?: (error: unknown) => void;
|
|
19
|
+
}): Promise<Map<string, TransactionTag[]>>;
|
|
20
|
+
//# sourceMappingURL=transactionTagsByIds.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transactionTagsByIds.d.ts","sourceRoot":"","sources":["../../src/ArweaveClient/transactionTagsByIds.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAEpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEzD,gEAAgE;AAChE,eAAO,MAAM,2BAA2B,MAAM,CAAA;AAE9C;;;GAGG;AACH,eAAO,MAAM,4BAA4B,oQAcxC,CAAA;AAQD;;;;GAIG;AACH,wBAAsB,uBAAuB,CAC3C,cAAc,EAAE,SAAS,MAAM,EAAE,EACjC,OAAO,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,aAAa,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;CAAE,GAC3F,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,cAAc,EAAE,CAAC,CAAC,CA4BxC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read-side seam for Arweave content: every place the SDK packages read an upload's bytes from a
|
|
3
|
+
* gateway passes them through {@link transformArweaveContent} before using them. Today nothing is
|
|
4
|
+
* registered and content is used as fetched (public publishing). A future private-publish option
|
|
5
|
+
* would register a transform here (e.g. decrypt using keys from the client config) instead of
|
|
6
|
+
* patching each reader.
|
|
7
|
+
*
|
|
8
|
+
* Readers routed through it:
|
|
9
|
+
* - {@link fetchArweaveRawTextAcrossGateways} (`readBaseUrls.ts`): the SDK's Html storage-seed
|
|
10
|
+
* fallback (`readHtmlBodyForStorageSeed`) and other text reads.
|
|
11
|
+
* - `BaseArweaveClient.getTransactionData` (every platform client; `decode: false` reads are left
|
|
12
|
+
* alone, they are not content bytes).
|
|
13
|
+
* - `@seedprotocol/query`'s `hydrateArweaveRichTextInItems` (also re-exported by `@seedprotocol/feed`).
|
|
14
|
+
*
|
|
15
|
+
* Not routed (they cannot be, as things stand):
|
|
16
|
+
* - The SDK's OPFS download worker runs from a string and cannot import this module; it has its own
|
|
17
|
+
* `transformDownloadedContent` hook.
|
|
18
|
+
* - Places that hand a gateway URL straight to the browser (`SeedImage` / `useEnsureLocalImage`'s
|
|
19
|
+
* progressive `gatewayHref`, `mediaRef` hrefs, feed image URLs). Encrypted content would need
|
|
20
|
+
* those to fetch, transform and use a blob URL instead.
|
|
21
|
+
*/
|
|
22
|
+
export type ArweaveContent = {
|
|
23
|
+
bytes: Uint8Array;
|
|
24
|
+
/** Media type without parameters, lowercased (from the response, i.e. the upload's Content-Type tag). */
|
|
25
|
+
contentType?: string;
|
|
26
|
+
};
|
|
27
|
+
export type ArweaveContentReadContext = {
|
|
28
|
+
transactionId: string;
|
|
29
|
+
};
|
|
30
|
+
/** @experimental Signature may change when private publishing lands. */
|
|
31
|
+
export type ArweaveContentReadTransform = (content: ArweaveContent, context: ArweaveContentReadContext) => ArweaveContent | Promise<ArweaveContent>;
|
|
32
|
+
/**
|
|
33
|
+
* Register (or clear, with `undefined`) the transform applied to Arweave content after it is
|
|
34
|
+
* fetched. @experimental Groundwork for private publishing; nothing in the SDK registers one yet.
|
|
35
|
+
*/
|
|
36
|
+
export declare function setArweaveContentReadTransform(transform: ArweaveContentReadTransform | undefined): void;
|
|
37
|
+
/** True when a read transform is registered. Lets readers skip work on the common, public path. */
|
|
38
|
+
export declare function hasArweaveContentReadTransform(): boolean;
|
|
39
|
+
/** Content as the app should see it: the registered transform's result, or `content` unchanged. */
|
|
40
|
+
export declare function transformArweaveContent(content: ArweaveContent, context: ArweaveContentReadContext): Promise<ArweaveContent>;
|
|
41
|
+
/** `Content-Type` header without parameters, lowercased; undefined when absent. */
|
|
42
|
+
export declare function getResponseMediaType(response: Response): string | undefined;
|
|
43
|
+
/** Read a gateway response's body through {@link transformArweaveContent}. */
|
|
44
|
+
export declare function readArweaveContentResponse(response: Response, context: ArweaveContentReadContext): Promise<ArweaveContent>;
|
|
45
|
+
//# sourceMappingURL=arweaveContent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arweaveContent.d.ts","sourceRoot":"","sources":["../../src/content/arweaveContent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,EAAE,UAAU,CAAA;IACjB,yGAAyG;IACzG,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,MAAM,MAAM,yBAAyB,GAAG;IACtC,aAAa,EAAE,MAAM,CAAA;CACtB,CAAA;AAED,wEAAwE;AACxE,MAAM,MAAM,2BAA2B,GAAG,CACxC,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,yBAAyB,KAC/B,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC,CAAA;AAI7C;;;GAGG;AACH,wBAAgB,8BAA8B,CAAC,SAAS,EAAE,2BAA2B,GAAG,SAAS,GAAG,IAAI,CAEvG;AAED,mGAAmG;AACnG,wBAAgB,8BAA8B,IAAI,OAAO,CAExD;AAED,mGAAmG;AACnG,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,yBAAyB,GACjC,OAAO,CAAC,cAAc,CAAC,CAEzB;AAED,mFAAmF;AACnF,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,GAAG,SAAS,CAI3E;AAED,8EAA8E;AAC9E,wBAAsB,0BAA0B,CAC9C,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,yBAAyB,GACjC,OAAO,CAAC,cAAc,CAAC,CAGzB"}
|
|
@@ -24,6 +24,7 @@ export declare function fetchArweaveRawFromBaseUrl(baseUrl: string, transactionI
|
|
|
24
24
|
* GET `/raw/{id}` across read gateways and return the first non-empty body as text. Preferred
|
|
25
25
|
* gateways go first and are tried before any read-gateway probe; a just-published item is served
|
|
26
26
|
* by the gateway it was uploaded through well before it reaches L1 or the public hosts.
|
|
27
|
+
* The body goes through `transformArweaveContent` (see `content/arweaveContent.ts`).
|
|
27
28
|
*/
|
|
28
29
|
export declare function fetchArweaveRawTextAcrossGateways(transactionId: string, options?: ArweaveReadBaseUrlOptions & {
|
|
29
30
|
timeoutMs?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readBaseUrls.d.ts","sourceRoot":"","sources":["../../src/gateway/readBaseUrls.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"readBaseUrls.d.ts","sourceRoot":"","sources":["../../src/gateway/readBaseUrls.ts"],"names":[],"mappings":"AAOA,8GAA8G;AAC9G,eAAO,MAAM,mCAAmC,QAAS,CAAA;AAEzD,MAAM,MAAM,yBAAyB,GAAG;IACtC,mGAAmG;IACnG,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAClC,CAAA;AASD;;;GAGG;AACH,wBAAgB,8BAA8B,CAAC,OAAO,CAAC,EAAE,yBAAyB,GAAG,MAAM,EAAE,CAiB5F;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,CAAC,EAAE,yBAAyB,GAAG,MAAM,EAAE,CAMpF;AAED,oGAAoG;AACpG,wBAAsB,mCAAmC,IAAI,OAAO,CAAC,IAAI,CAAC,CAUzE;AAED,kFAAkF;AAClF,wBAAsB,0BAA0B,CAC9C,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,EACrB,OAAO,CAAC,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAC/B,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC,CAkB/B;AAED;;;;;GAKG;AACH,wBAAsB,iCAAiC,CACrD,aAAa,EAAE,MAAM,EACrB,OAAO,CAAC,EAAE,yBAAyB,GAAG;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAC3D,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAwB7B"}
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export * from './types/gateway.js';
|
|
|
7
7
|
export * from './types/arweave.js';
|
|
8
8
|
export type { SeedConfigGatewayInput, ClientGatewayContextInput } from './types/seedConfig.js';
|
|
9
9
|
export * from './ArweaveClient/queries.js';
|
|
10
|
+
export * from './ArweaveClient/transactionTagsByIds.js';
|
|
10
11
|
export * from './ArweaveClient/BaseArweaveClient.js';
|
|
11
12
|
export { BaseArweaveClient as ArweaveClient } from './ArweaveClient/BaseArweaveClient.js';
|
|
12
13
|
export type { IArweaveClient } from './ArweaveClient/IArweaveClient.js';
|
|
@@ -18,4 +19,5 @@ export * from './gateway/gatewayCircuitBreaker.js';
|
|
|
18
19
|
export * from './gateway/resolveSeedGatewayEndpoints.js';
|
|
19
20
|
export * from './gateway/seedGatewayConfig.js';
|
|
20
21
|
export * from './gateway/readBaseUrls.js';
|
|
22
|
+
export * from './content/arweaveContent.js';
|
|
21
23
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,wBAAwB,CAAA;AACtC,cAAc,eAAe,CAAA;AAC7B,cAAc,qCAAqC,CAAA;AACnD,cAAc,sBAAsB,CAAA;AACpC,cAAc,oBAAoB,CAAA;AAClC,cAAc,oBAAoB,CAAA;AAClC,YAAY,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAA;AAC9F,cAAc,4BAA4B,CAAA;AAC1C,cAAc,sCAAsC,CAAA;AACpD,OAAO,EAAE,iBAAiB,IAAI,aAAa,EAAE,MAAM,sCAAsC,CAAA;AACzF,YAAY,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAA;AACvE,cAAc,sCAAsC,CAAA;AACpD,cAAc,0CAA0C,CAAA;AACxD,cAAc,uCAAuC,CAAA;AACrD,cAAc,2BA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