@beam-network/sdk 0.2.3 → 0.2.4
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/client.js +3 -1
- package/dist/provider-signing.d.ts +2 -1
- package/dist/provider-signing.js +4 -2
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -200,7 +200,8 @@ export class BeamClient {
|
|
|
200
200
|
chunkIndex: input.chunk.chunk_index,
|
|
201
201
|
partNumber: input.partNumber
|
|
202
202
|
});
|
|
203
|
-
const
|
|
203
|
+
const copySourceRange = `bytes=0-${Math.max(0, input.chunk.chunk_size - 1)}`;
|
|
204
|
+
const { copyUrl, copySource } = await signUploadPartCopy(input.destination, input.finalObjectKey, stagingObjectKey, input.upload.uploadId, input.partNumber, input.expiresIn, copySourceRange);
|
|
204
205
|
const deleteUrl = await signDeleteObject(input.destination, stagingObjectKey, input.expiresIn);
|
|
205
206
|
return signDestinationRoute({
|
|
206
207
|
chunk: input.chunk,
|
|
@@ -220,6 +221,7 @@ export class BeamClient {
|
|
|
220
221
|
stagingObjectKey,
|
|
221
222
|
copyUrl,
|
|
222
223
|
copySource,
|
|
224
|
+
copySourceRange,
|
|
223
225
|
deleteUrl,
|
|
224
226
|
fetchImpl: this.fetchImpl
|
|
225
227
|
});
|
|
@@ -14,7 +14,7 @@ export declare function createMultipartUpload(destination: ProviderDestinationCo
|
|
|
14
14
|
export declare function signCompleteMultipartUpload(destination: ProviderDestinationConfig, objectKey: string, uploadId: string, expiresIn: number): Promise<string>;
|
|
15
15
|
export declare function signAbortMultipartUpload(destination: ProviderDestinationConfig, objectKey: string, uploadId: string, expiresIn: number): Promise<string>;
|
|
16
16
|
export declare function signListMultipartUpload(destination: ProviderDestinationConfig, objectKey: string, uploadId: string, expiresIn: number): Promise<string>;
|
|
17
|
-
export declare function signUploadPartCopy(destination: ProviderDestinationConfig, finalObjectKey: string, stagingObjectKey: string, uploadId: string, partNumber: number, expiresIn: number): Promise<{
|
|
17
|
+
export declare function signUploadPartCopy(destination: ProviderDestinationConfig, finalObjectKey: string, stagingObjectKey: string, uploadId: string, partNumber: number, expiresIn: number, copySourceRange?: string): Promise<{
|
|
18
18
|
copyUrl: string;
|
|
19
19
|
copySource: string;
|
|
20
20
|
}>;
|
|
@@ -38,6 +38,7 @@ export declare function signDestinationRoute(input: {
|
|
|
38
38
|
stagingObjectKey?: string;
|
|
39
39
|
copyUrl?: string;
|
|
40
40
|
copySource?: string;
|
|
41
|
+
copySourceRange?: string;
|
|
41
42
|
deleteUrl?: string;
|
|
42
43
|
fetchImpl?: typeof fetch;
|
|
43
44
|
}): Promise<SignedChunkRoute>;
|
package/dist/provider-signing.js
CHANGED
|
@@ -103,7 +103,7 @@ export async function signListMultipartUpload(destination, objectKey, uploadId,
|
|
|
103
103
|
}
|
|
104
104
|
throw new Error(`multipart list-parts is not supported for ${destination.provider}`);
|
|
105
105
|
}
|
|
106
|
-
export async function signUploadPartCopy(destination, finalObjectKey, stagingObjectKey, uploadId, partNumber, expiresIn) {
|
|
106
|
+
export async function signUploadPartCopy(destination, finalObjectKey, stagingObjectKey, uploadId, partNumber, expiresIn, copySourceRange) {
|
|
107
107
|
if (isS3CompatibleProvider(destination)) {
|
|
108
108
|
const client = createS3CompatibleClient(destination);
|
|
109
109
|
const copySource = copySourceHeader(destination, stagingObjectKey);
|
|
@@ -114,7 +114,8 @@ export async function signUploadPartCopy(destination, finalObjectKey, stagingObj
|
|
|
114
114
|
Key: finalObjectKey,
|
|
115
115
|
UploadId: uploadId,
|
|
116
116
|
PartNumber: partNumber,
|
|
117
|
-
CopySource: copySource
|
|
117
|
+
CopySource: copySource,
|
|
118
|
+
CopySourceRange: copySourceRange
|
|
118
119
|
}), { expiresIn })
|
|
119
120
|
};
|
|
120
121
|
}
|
|
@@ -171,6 +172,7 @@ export async function signDestinationRoute(input) {
|
|
|
171
172
|
...(input.stagingObjectKey ? { staging_object_key: input.stagingObjectKey } : {}),
|
|
172
173
|
...(input.copyUrl ? { copy_url: input.copyUrl } : {}),
|
|
173
174
|
...(input.copySource ? { copy_source: input.copySource } : {}),
|
|
175
|
+
...(input.copySourceRange ? { copy_source_range: input.copySourceRange } : {}),
|
|
174
176
|
...(input.deleteUrl ? { delete_url: input.deleteUrl } : {}),
|
|
175
177
|
...(input.uploadId ? { upload_id: input.uploadId } : {}),
|
|
176
178
|
...(input.partNumber ? { part_number: input.partNumber } : {}),
|