@beam-network/sdk 0.2.22 → 0.3.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.
- package/README.md +6 -1
- package/dist/client.d.ts +5 -6
- package/dist/client.js +679 -279
- package/dist/models.d.ts +50 -7
- package/dist/multipart-limits.d.ts +3 -4
- package/dist/multipart-limits.js +8 -9
- package/dist/nats-control.d.ts +26 -43
- package/dist/nats-control.js +262 -124
- package/dist/provider-signing.d.ts +10 -15
- package/dist/provider-signing.js +45 -55
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -40,6 +40,7 @@ const transfer = await beam.createTransfer({
|
|
|
40
40
|
|
|
41
41
|
const status = await beam.waitForTransfer(transfer.transfer_id);
|
|
42
42
|
console.log(status.status);
|
|
43
|
+
await beam.close();
|
|
43
44
|
```
|
|
44
45
|
|
|
45
46
|
The main `createTransfer` API is provider-aware and strictly typed for S3, R2, S3-compatible, and Hippius configs.
|
|
@@ -95,6 +96,10 @@ For low-level raw transfer configs, use `createRawTransfer`; lifecycle transport
|
|
|
95
96
|
|
|
96
97
|
## Route Streaming And Payload Size
|
|
97
98
|
|
|
98
|
-
Provider transfers
|
|
99
|
+
Provider transfers use `signed_url_v2` and `transfer-client-control/v3`. Before route streaming, S3, R2, and S3-compatible destinations create one metadata-bearing multipart upload per source/destination object. Its deduplicated manifest contains complete/abort and final HEAD controls, expected object size/count, required Beam object metadata, and exactly `ceil(max_part_number / 1000)` unique URLs in each of `list_page_urls` and `staging_list_urls`. Staging pages fix `MaxKeys=1000`; keys are ordered by unsigned UTF-8 bytes, page zero omits `StartAfter`, and later pages start after the preceding page's last key. Per-route batches carry only the stable group ID and route-attempt metadata. Part number is `source_chunk_index + 1`, and retries overwrite that same part.
|
|
100
|
+
|
|
101
|
+
The client signs up to 64 routes concurrently by default and emits a 32-route bootstrap batch followed by 256-route steady batches. Out-of-order signing completions are buffered until the next deterministic delivery index, keeping batch contents reproducible. The stream ID derives from the transfer and immutable plan identity, and each ordered batch ID includes its route-coordinate checksum. Manual multi-destination attachment requires `delivery_index` on every route. Encoded MessagePack requests still split under `maxPayloadBytes` (24 MiB by default), and lifecycle mutations retry transient failures up to three times with the same request identity. `waitForTransfer` subscribes to the API-key-owned, at-most-once terminal signal before its first status read and reconciles every signal through authoritative status; subscription failure degrades to the same jittered 15-to-30-second status fallback. Call `close()` when the client is no longer needed; it also closes outstanding terminal waiters.
|
|
102
|
+
|
|
103
|
+
Hippius uses genuine non-multipart v2 routes, so its manifest is empty and group-level final HEAD verification is not available from that provider flow.
|
|
99
104
|
|
|
100
105
|
NATS requires this guard because the broker rejects messages above its configured `max_payload`. This limit applies only to lifecycle/control metadata; transfer file bytes do not flow through NATS.
|
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AttachSignedUrlsResponse, BeamClientOptions, DistributeResponse, PlanningHttpSource, PreparedDestination, PreparedHttpSource, ProviderTransferCreateInput, RawTransferCreateInput, SignedChunkRoute, SignedUrlFlow, TransferCancelResponse, TransferCreateResponse, TransferPlanResponse, TransferPrepareResponse, TransferStatusInfo } from "./models.js";
|
|
1
|
+
import type { AttachSignedUrlsResponse, BeamClientOptions, DistributeResponse, MultipartGroupManifest, PlanningHttpSource, PreparedDestination, PreparedHttpSource, ProviderTransferCreateInput, RawTransferCreateInput, SignedChunkRoute, SignedUrlFlow, TransferCancelResponse, TransferCreateResponse, TransferPlanResponse, TransferPrepareResponse, TransferStatusInfo, TransferTerminalSignalWaiter } from "./models.js";
|
|
2
2
|
import { BEAM_DEFAULT_NATS_URL } from "./nats-control.js";
|
|
3
3
|
export { BEAM_DEFAULT_NATS_URL };
|
|
4
4
|
export declare class BeamApiError extends Error {
|
|
@@ -12,9 +12,9 @@ export declare class BeamClient {
|
|
|
12
12
|
private readonly fetchImpl;
|
|
13
13
|
private readonly control;
|
|
14
14
|
private readonly routeSigningConcurrency;
|
|
15
|
-
private readonly recoverySigners;
|
|
16
15
|
constructor(options?: BeamClientOptions);
|
|
17
16
|
close(): Promise<void>;
|
|
17
|
+
openTransferTerminalWaiter(transferId: string): Promise<TransferTerminalSignalWaiter>;
|
|
18
18
|
createRawTransfer(input: RawTransferCreateInput): Promise<TransferCreateResponse>;
|
|
19
19
|
createTransfer(input: ProviderTransferCreateInput): Promise<TransferPrepareResponse>;
|
|
20
20
|
transferStatus(transferId: string): Promise<TransferStatusInfo>;
|
|
@@ -35,23 +35,22 @@ export declare class BeamClient {
|
|
|
35
35
|
testMode?: boolean;
|
|
36
36
|
urlsExpiresAt?: string;
|
|
37
37
|
signedUrlFlow?: SignedUrlFlow;
|
|
38
|
+
idempotencyKey?: string;
|
|
38
39
|
}): Promise<TransferPrepareResponse>;
|
|
39
40
|
attachSignedUrls(transferId: string, input: {
|
|
40
41
|
chunkRoutes: SignedChunkRoute[];
|
|
42
|
+
multipartGroupManifest: MultipartGroupManifest[];
|
|
41
43
|
transferKey?: string;
|
|
42
44
|
urlsExpiresAt?: string;
|
|
43
|
-
signedUrlFlow?: SignedUrlFlow;
|
|
44
45
|
autoDistribute?: boolean;
|
|
45
46
|
}): Promise<AttachSignedUrlsResponse>;
|
|
46
47
|
prepareProviderTransfer(input: ProviderTransferCreateInput): Promise<TransferPrepareResponse>;
|
|
47
48
|
private signProviderRoute;
|
|
48
|
-
private startProviderRouteRecoverySigner;
|
|
49
|
-
private stopRecoverySigner;
|
|
50
|
-
private stopAllRecoverySigners;
|
|
51
49
|
createAndDistribute(input: RawTransferCreateInput): Promise<TransferCreateResponse>;
|
|
52
50
|
waitForTransfer(transferId: string, options?: {
|
|
53
51
|
timeoutMs?: number;
|
|
54
52
|
pollIntervalMs?: number;
|
|
53
|
+
maxPollIntervalMs?: number;
|
|
55
54
|
}): Promise<TransferStatusInfo>;
|
|
56
55
|
}
|
|
57
56
|
export declare function buildStagingObjectPrefix(input: {
|