@stack0/sdk 0.3.51 → 0.5.1
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/cdn/index.d.mts +263 -1
- package/dist/cdn/index.d.ts +263 -1
- package/dist/cdn/index.js +267 -0
- package/dist/cdn/index.js.map +1 -1
- package/dist/cdn/index.mjs +267 -0
- package/dist/cdn/index.mjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +267 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +267 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -2
package/dist/cdn/index.d.mts
CHANGED
|
@@ -260,6 +260,116 @@ interface ExtractAudioResponse {
|
|
|
260
260
|
jobId: string;
|
|
261
261
|
status: TranscodingStatus;
|
|
262
262
|
}
|
|
263
|
+
type PrivateFileStatus = "pending" | "ready" | "failed" | "deleted";
|
|
264
|
+
interface PrivateFile {
|
|
265
|
+
id: string;
|
|
266
|
+
filename: string;
|
|
267
|
+
originalFilename: string;
|
|
268
|
+
mimeType: string;
|
|
269
|
+
size: number;
|
|
270
|
+
s3Key: string;
|
|
271
|
+
folder: string | null;
|
|
272
|
+
description: string | null;
|
|
273
|
+
tags: string[] | null;
|
|
274
|
+
metadata: Record<string, unknown> | null;
|
|
275
|
+
status: PrivateFileStatus;
|
|
276
|
+
createdAt: Date;
|
|
277
|
+
updatedAt: Date | null;
|
|
278
|
+
}
|
|
279
|
+
interface PrivateUploadUrlRequest {
|
|
280
|
+
projectSlug: string;
|
|
281
|
+
filename: string;
|
|
282
|
+
mimeType: string;
|
|
283
|
+
size: number;
|
|
284
|
+
folder?: string;
|
|
285
|
+
description?: string;
|
|
286
|
+
metadata?: Record<string, unknown>;
|
|
287
|
+
}
|
|
288
|
+
interface PrivateUploadUrlResponse {
|
|
289
|
+
uploadUrl: string;
|
|
290
|
+
fileId: string;
|
|
291
|
+
expiresAt: Date;
|
|
292
|
+
}
|
|
293
|
+
interface PrivateDownloadUrlRequest {
|
|
294
|
+
fileId: string;
|
|
295
|
+
/** Expiration time in seconds (default: 3600, min: 3600, max: 604800) */
|
|
296
|
+
expiresIn?: number;
|
|
297
|
+
}
|
|
298
|
+
interface PrivateDownloadUrlResponse {
|
|
299
|
+
downloadUrl: string;
|
|
300
|
+
expiresAt: Date;
|
|
301
|
+
}
|
|
302
|
+
interface ListPrivateFilesRequest {
|
|
303
|
+
projectSlug: string;
|
|
304
|
+
folder?: string | null;
|
|
305
|
+
status?: PrivateFileStatus;
|
|
306
|
+
search?: string;
|
|
307
|
+
sortBy?: "createdAt" | "filename" | "size";
|
|
308
|
+
sortOrder?: "asc" | "desc";
|
|
309
|
+
limit?: number;
|
|
310
|
+
offset?: number;
|
|
311
|
+
}
|
|
312
|
+
interface ListPrivateFilesResponse {
|
|
313
|
+
files: PrivateFile[];
|
|
314
|
+
total: number;
|
|
315
|
+
hasMore: boolean;
|
|
316
|
+
}
|
|
317
|
+
interface UpdatePrivateFileRequest {
|
|
318
|
+
fileId: string;
|
|
319
|
+
description?: string;
|
|
320
|
+
folder?: string | null;
|
|
321
|
+
tags?: string[];
|
|
322
|
+
metadata?: Record<string, unknown>;
|
|
323
|
+
}
|
|
324
|
+
type BundleStatus = "pending" | "processing" | "ready" | "failed" | "expired";
|
|
325
|
+
interface DownloadBundle {
|
|
326
|
+
id: string;
|
|
327
|
+
name: string;
|
|
328
|
+
description: string | null;
|
|
329
|
+
assetIds: string[] | null;
|
|
330
|
+
privateFileIds: string[] | null;
|
|
331
|
+
s3Key: string | null;
|
|
332
|
+
size: number | null;
|
|
333
|
+
fileCount: number | null;
|
|
334
|
+
status: BundleStatus;
|
|
335
|
+
error: string | null;
|
|
336
|
+
expiresAt: Date | null;
|
|
337
|
+
createdAt: Date;
|
|
338
|
+
completedAt: Date | null;
|
|
339
|
+
}
|
|
340
|
+
interface CreateBundleRequest {
|
|
341
|
+
projectSlug: string;
|
|
342
|
+
name: string;
|
|
343
|
+
description?: string;
|
|
344
|
+
assetIds?: string[];
|
|
345
|
+
privateFileIds?: string[];
|
|
346
|
+
/** Expiration time in seconds (default: 86400, min: 3600, max: 604800) */
|
|
347
|
+
expiresIn?: number;
|
|
348
|
+
}
|
|
349
|
+
interface CreateBundleResponse {
|
|
350
|
+
bundle: DownloadBundle;
|
|
351
|
+
}
|
|
352
|
+
interface ListBundlesRequest {
|
|
353
|
+
projectSlug: string;
|
|
354
|
+
status?: BundleStatus;
|
|
355
|
+
search?: string;
|
|
356
|
+
limit?: number;
|
|
357
|
+
offset?: number;
|
|
358
|
+
}
|
|
359
|
+
interface ListBundlesResponse {
|
|
360
|
+
bundles: DownloadBundle[];
|
|
361
|
+
total: number;
|
|
362
|
+
hasMore: boolean;
|
|
363
|
+
}
|
|
364
|
+
interface BundleDownloadUrlRequest {
|
|
365
|
+
bundleId: string;
|
|
366
|
+
/** Expiration time in seconds (default: 3600, min: 3600, max: 604800) */
|
|
367
|
+
expiresIn?: number;
|
|
368
|
+
}
|
|
369
|
+
interface BundleDownloadUrlResponse {
|
|
370
|
+
downloadUrl: string;
|
|
371
|
+
expiresAt: Date;
|
|
372
|
+
}
|
|
263
373
|
|
|
264
374
|
/**
|
|
265
375
|
* Stack0 CDN Client
|
|
@@ -563,6 +673,158 @@ declare class CDN {
|
|
|
563
673
|
*/
|
|
564
674
|
extractAudio(request: ExtractAudioRequest): Promise<ExtractAudioResponse>;
|
|
565
675
|
private convertJobDates;
|
|
676
|
+
/**
|
|
677
|
+
* Generate a presigned URL for uploading a private file
|
|
678
|
+
*
|
|
679
|
+
* Private files are stored securely and can only be accessed through
|
|
680
|
+
* authorized download links with configurable expiration.
|
|
681
|
+
*
|
|
682
|
+
* @example
|
|
683
|
+
* ```typescript
|
|
684
|
+
* const { uploadUrl, fileId } = await cdn.getPrivateUploadUrl({
|
|
685
|
+
* projectSlug: 'my-project',
|
|
686
|
+
* filename: 'confidential.pdf',
|
|
687
|
+
* mimeType: 'application/pdf',
|
|
688
|
+
* size: 1024 * 1024,
|
|
689
|
+
* });
|
|
690
|
+
*
|
|
691
|
+
* // Upload file to the presigned URL
|
|
692
|
+
* await fetch(uploadUrl, {
|
|
693
|
+
* method: 'PUT',
|
|
694
|
+
* body: file,
|
|
695
|
+
* headers: { 'Content-Type': 'application/pdf' },
|
|
696
|
+
* });
|
|
697
|
+
*
|
|
698
|
+
* // Confirm the upload
|
|
699
|
+
* const privateFile = await cdn.confirmPrivateUpload(fileId);
|
|
700
|
+
* ```
|
|
701
|
+
*/
|
|
702
|
+
getPrivateUploadUrl(request: PrivateUploadUrlRequest): Promise<PrivateUploadUrlResponse>;
|
|
703
|
+
/**
|
|
704
|
+
* Confirm that a private file upload has completed
|
|
705
|
+
*/
|
|
706
|
+
confirmPrivateUpload(fileId: string): Promise<PrivateFile>;
|
|
707
|
+
/**
|
|
708
|
+
* Upload a private file directly (handles presigned URL flow automatically)
|
|
709
|
+
*
|
|
710
|
+
* @example
|
|
711
|
+
* ```typescript
|
|
712
|
+
* const privateFile = await cdn.uploadPrivate({
|
|
713
|
+
* projectSlug: 'my-project',
|
|
714
|
+
* file: fileBuffer,
|
|
715
|
+
* filename: 'confidential.pdf',
|
|
716
|
+
* mimeType: 'application/pdf',
|
|
717
|
+
* });
|
|
718
|
+
* ```
|
|
719
|
+
*/
|
|
720
|
+
uploadPrivate(options: {
|
|
721
|
+
projectSlug: string;
|
|
722
|
+
file: Blob | Buffer | ArrayBuffer;
|
|
723
|
+
filename: string;
|
|
724
|
+
mimeType: string;
|
|
725
|
+
folder?: string;
|
|
726
|
+
description?: string;
|
|
727
|
+
metadata?: Record<string, unknown>;
|
|
728
|
+
}): Promise<PrivateFile>;
|
|
729
|
+
/**
|
|
730
|
+
* Generate a presigned download URL for a private file
|
|
731
|
+
*
|
|
732
|
+
* @example
|
|
733
|
+
* ```typescript
|
|
734
|
+
* const { downloadUrl, expiresAt } = await cdn.getPrivateDownloadUrl({
|
|
735
|
+
* fileId: 'file-id',
|
|
736
|
+
* expiresIn: 86400, // 24 hours
|
|
737
|
+
* });
|
|
738
|
+
* ```
|
|
739
|
+
*/
|
|
740
|
+
getPrivateDownloadUrl(request: PrivateDownloadUrlRequest): Promise<PrivateDownloadUrlResponse>;
|
|
741
|
+
/**
|
|
742
|
+
* Get a private file by ID
|
|
743
|
+
*/
|
|
744
|
+
getPrivateFile(fileId: string): Promise<PrivateFile>;
|
|
745
|
+
/**
|
|
746
|
+
* Update a private file's metadata
|
|
747
|
+
*/
|
|
748
|
+
updatePrivateFile(request: UpdatePrivateFileRequest): Promise<PrivateFile>;
|
|
749
|
+
/**
|
|
750
|
+
* Delete a private file
|
|
751
|
+
*/
|
|
752
|
+
deletePrivateFile(fileId: string): Promise<{
|
|
753
|
+
success: boolean;
|
|
754
|
+
}>;
|
|
755
|
+
/**
|
|
756
|
+
* Delete multiple private files
|
|
757
|
+
*/
|
|
758
|
+
deletePrivateFiles(fileIds: string[]): Promise<{
|
|
759
|
+
success: boolean;
|
|
760
|
+
deletedCount: number;
|
|
761
|
+
}>;
|
|
762
|
+
/**
|
|
763
|
+
* List private files with filters and pagination
|
|
764
|
+
*
|
|
765
|
+
* @example
|
|
766
|
+
* ```typescript
|
|
767
|
+
* const { files, total, hasMore } = await cdn.listPrivateFiles({
|
|
768
|
+
* projectSlug: 'my-project',
|
|
769
|
+
* limit: 20,
|
|
770
|
+
* });
|
|
771
|
+
* ```
|
|
772
|
+
*/
|
|
773
|
+
listPrivateFiles(request: ListPrivateFilesRequest): Promise<ListPrivateFilesResponse>;
|
|
774
|
+
private convertPrivateFileDates;
|
|
775
|
+
/**
|
|
776
|
+
* Create a download bundle from assets and/or private files
|
|
777
|
+
*
|
|
778
|
+
* The bundle will be created asynchronously. Check the status using getBundle().
|
|
779
|
+
*
|
|
780
|
+
* @example
|
|
781
|
+
* ```typescript
|
|
782
|
+
* const { bundle } = await cdn.createBundle({
|
|
783
|
+
* projectSlug: 'my-project',
|
|
784
|
+
* name: 'Project Assets - Dec 2024',
|
|
785
|
+
* assetIds: ['asset-1', 'asset-2'],
|
|
786
|
+
* privateFileIds: ['file-1', 'file-2'],
|
|
787
|
+
* expiresIn: 86400, // 24 hours
|
|
788
|
+
* });
|
|
789
|
+
* console.log(`Bundle ${bundle.id} status: ${bundle.status}`);
|
|
790
|
+
* ```
|
|
791
|
+
*/
|
|
792
|
+
createBundle(request: CreateBundleRequest): Promise<CreateBundleResponse>;
|
|
793
|
+
/**
|
|
794
|
+
* Get a download bundle by ID
|
|
795
|
+
*/
|
|
796
|
+
getBundle(bundleId: string): Promise<DownloadBundle>;
|
|
797
|
+
/**
|
|
798
|
+
* List download bundles with filters and pagination
|
|
799
|
+
*
|
|
800
|
+
* @example
|
|
801
|
+
* ```typescript
|
|
802
|
+
* const { bundles, total } = await cdn.listBundles({
|
|
803
|
+
* projectSlug: 'my-project',
|
|
804
|
+
* status: 'ready',
|
|
805
|
+
* });
|
|
806
|
+
* ```
|
|
807
|
+
*/
|
|
808
|
+
listBundles(request: ListBundlesRequest): Promise<ListBundlesResponse>;
|
|
809
|
+
/**
|
|
810
|
+
* Generate a presigned download URL for a bundle
|
|
811
|
+
*
|
|
812
|
+
* @example
|
|
813
|
+
* ```typescript
|
|
814
|
+
* const { downloadUrl, expiresAt } = await cdn.getBundleDownloadUrl({
|
|
815
|
+
* bundleId: 'bundle-id',
|
|
816
|
+
* expiresIn: 3600, // 1 hour
|
|
817
|
+
* });
|
|
818
|
+
* ```
|
|
819
|
+
*/
|
|
820
|
+
getBundleDownloadUrl(request: BundleDownloadUrlRequest): Promise<BundleDownloadUrlResponse>;
|
|
821
|
+
/**
|
|
822
|
+
* Delete a download bundle
|
|
823
|
+
*/
|
|
824
|
+
deleteBundle(bundleId: string): Promise<{
|
|
825
|
+
success: boolean;
|
|
826
|
+
}>;
|
|
827
|
+
private convertBundleDates;
|
|
566
828
|
}
|
|
567
829
|
|
|
568
|
-
export { type Asset, type AssetStatus, type AssetType, CDN, type ConfirmUploadRequest, type ConfirmUploadResponse, type CreateFolderRequest, type DeleteAssetRequest, type DeleteAssetsRequest, type DeleteAssetsResponse, type ExtractAudioRequest, type ExtractAudioResponse, type Folder, type FolderTreeNode, type GetAssetRequest, type GetFolderTreeRequest, type ListAssetsRequest, type ListAssetsResponse, type ListJobsRequest, type ListJobsResponse, type MoveAssetsRequest, type MoveAssetsResponse, type RegenerateThumbnailRequest, type RegenerateThumbnailResponse, type StreamingUrls, type ThumbnailRequest, type ThumbnailResponse, type TranscodeJob, type TranscodeVideoRequest, type TranscodingStatus, type TransformOptions, type TrimOptions, type UpdateAssetRequest, type UploadUrlRequest, type UploadUrlResponse, type VideoCodec, type VideoOutputFormat, type VideoQuality, type VideoVariant, type WatermarkOptions };
|
|
830
|
+
export { type Asset, type AssetStatus, type AssetType, type BundleDownloadUrlRequest, type BundleDownloadUrlResponse, type BundleStatus, CDN, type ConfirmUploadRequest, type ConfirmUploadResponse, type CreateBundleRequest, type CreateBundleResponse, type CreateFolderRequest, type DeleteAssetRequest, type DeleteAssetsRequest, type DeleteAssetsResponse, type DownloadBundle, type ExtractAudioRequest, type ExtractAudioResponse, type Folder, type FolderTreeNode, type GetAssetRequest, type GetFolderTreeRequest, type ListAssetsRequest, type ListAssetsResponse, type ListBundlesRequest, type ListBundlesResponse, type ListJobsRequest, type ListJobsResponse, type ListPrivateFilesRequest, type ListPrivateFilesResponse, type MoveAssetsRequest, type MoveAssetsResponse, type PrivateDownloadUrlRequest, type PrivateDownloadUrlResponse, type PrivateFile, type PrivateFileStatus, type PrivateUploadUrlRequest, type PrivateUploadUrlResponse, type RegenerateThumbnailRequest, type RegenerateThumbnailResponse, type StreamingUrls, type ThumbnailRequest, type ThumbnailResponse, type TranscodeJob, type TranscodeVideoRequest, type TranscodingStatus, type TransformOptions, type TrimOptions, type UpdateAssetRequest, type UpdatePrivateFileRequest, type UploadUrlRequest, type UploadUrlResponse, type VideoCodec, type VideoOutputFormat, type VideoQuality, type VideoVariant, type WatermarkOptions };
|
package/dist/cdn/index.d.ts
CHANGED
|
@@ -260,6 +260,116 @@ interface ExtractAudioResponse {
|
|
|
260
260
|
jobId: string;
|
|
261
261
|
status: TranscodingStatus;
|
|
262
262
|
}
|
|
263
|
+
type PrivateFileStatus = "pending" | "ready" | "failed" | "deleted";
|
|
264
|
+
interface PrivateFile {
|
|
265
|
+
id: string;
|
|
266
|
+
filename: string;
|
|
267
|
+
originalFilename: string;
|
|
268
|
+
mimeType: string;
|
|
269
|
+
size: number;
|
|
270
|
+
s3Key: string;
|
|
271
|
+
folder: string | null;
|
|
272
|
+
description: string | null;
|
|
273
|
+
tags: string[] | null;
|
|
274
|
+
metadata: Record<string, unknown> | null;
|
|
275
|
+
status: PrivateFileStatus;
|
|
276
|
+
createdAt: Date;
|
|
277
|
+
updatedAt: Date | null;
|
|
278
|
+
}
|
|
279
|
+
interface PrivateUploadUrlRequest {
|
|
280
|
+
projectSlug: string;
|
|
281
|
+
filename: string;
|
|
282
|
+
mimeType: string;
|
|
283
|
+
size: number;
|
|
284
|
+
folder?: string;
|
|
285
|
+
description?: string;
|
|
286
|
+
metadata?: Record<string, unknown>;
|
|
287
|
+
}
|
|
288
|
+
interface PrivateUploadUrlResponse {
|
|
289
|
+
uploadUrl: string;
|
|
290
|
+
fileId: string;
|
|
291
|
+
expiresAt: Date;
|
|
292
|
+
}
|
|
293
|
+
interface PrivateDownloadUrlRequest {
|
|
294
|
+
fileId: string;
|
|
295
|
+
/** Expiration time in seconds (default: 3600, min: 3600, max: 604800) */
|
|
296
|
+
expiresIn?: number;
|
|
297
|
+
}
|
|
298
|
+
interface PrivateDownloadUrlResponse {
|
|
299
|
+
downloadUrl: string;
|
|
300
|
+
expiresAt: Date;
|
|
301
|
+
}
|
|
302
|
+
interface ListPrivateFilesRequest {
|
|
303
|
+
projectSlug: string;
|
|
304
|
+
folder?: string | null;
|
|
305
|
+
status?: PrivateFileStatus;
|
|
306
|
+
search?: string;
|
|
307
|
+
sortBy?: "createdAt" | "filename" | "size";
|
|
308
|
+
sortOrder?: "asc" | "desc";
|
|
309
|
+
limit?: number;
|
|
310
|
+
offset?: number;
|
|
311
|
+
}
|
|
312
|
+
interface ListPrivateFilesResponse {
|
|
313
|
+
files: PrivateFile[];
|
|
314
|
+
total: number;
|
|
315
|
+
hasMore: boolean;
|
|
316
|
+
}
|
|
317
|
+
interface UpdatePrivateFileRequest {
|
|
318
|
+
fileId: string;
|
|
319
|
+
description?: string;
|
|
320
|
+
folder?: string | null;
|
|
321
|
+
tags?: string[];
|
|
322
|
+
metadata?: Record<string, unknown>;
|
|
323
|
+
}
|
|
324
|
+
type BundleStatus = "pending" | "processing" | "ready" | "failed" | "expired";
|
|
325
|
+
interface DownloadBundle {
|
|
326
|
+
id: string;
|
|
327
|
+
name: string;
|
|
328
|
+
description: string | null;
|
|
329
|
+
assetIds: string[] | null;
|
|
330
|
+
privateFileIds: string[] | null;
|
|
331
|
+
s3Key: string | null;
|
|
332
|
+
size: number | null;
|
|
333
|
+
fileCount: number | null;
|
|
334
|
+
status: BundleStatus;
|
|
335
|
+
error: string | null;
|
|
336
|
+
expiresAt: Date | null;
|
|
337
|
+
createdAt: Date;
|
|
338
|
+
completedAt: Date | null;
|
|
339
|
+
}
|
|
340
|
+
interface CreateBundleRequest {
|
|
341
|
+
projectSlug: string;
|
|
342
|
+
name: string;
|
|
343
|
+
description?: string;
|
|
344
|
+
assetIds?: string[];
|
|
345
|
+
privateFileIds?: string[];
|
|
346
|
+
/** Expiration time in seconds (default: 86400, min: 3600, max: 604800) */
|
|
347
|
+
expiresIn?: number;
|
|
348
|
+
}
|
|
349
|
+
interface CreateBundleResponse {
|
|
350
|
+
bundle: DownloadBundle;
|
|
351
|
+
}
|
|
352
|
+
interface ListBundlesRequest {
|
|
353
|
+
projectSlug: string;
|
|
354
|
+
status?: BundleStatus;
|
|
355
|
+
search?: string;
|
|
356
|
+
limit?: number;
|
|
357
|
+
offset?: number;
|
|
358
|
+
}
|
|
359
|
+
interface ListBundlesResponse {
|
|
360
|
+
bundles: DownloadBundle[];
|
|
361
|
+
total: number;
|
|
362
|
+
hasMore: boolean;
|
|
363
|
+
}
|
|
364
|
+
interface BundleDownloadUrlRequest {
|
|
365
|
+
bundleId: string;
|
|
366
|
+
/** Expiration time in seconds (default: 3600, min: 3600, max: 604800) */
|
|
367
|
+
expiresIn?: number;
|
|
368
|
+
}
|
|
369
|
+
interface BundleDownloadUrlResponse {
|
|
370
|
+
downloadUrl: string;
|
|
371
|
+
expiresAt: Date;
|
|
372
|
+
}
|
|
263
373
|
|
|
264
374
|
/**
|
|
265
375
|
* Stack0 CDN Client
|
|
@@ -563,6 +673,158 @@ declare class CDN {
|
|
|
563
673
|
*/
|
|
564
674
|
extractAudio(request: ExtractAudioRequest): Promise<ExtractAudioResponse>;
|
|
565
675
|
private convertJobDates;
|
|
676
|
+
/**
|
|
677
|
+
* Generate a presigned URL for uploading a private file
|
|
678
|
+
*
|
|
679
|
+
* Private files are stored securely and can only be accessed through
|
|
680
|
+
* authorized download links with configurable expiration.
|
|
681
|
+
*
|
|
682
|
+
* @example
|
|
683
|
+
* ```typescript
|
|
684
|
+
* const { uploadUrl, fileId } = await cdn.getPrivateUploadUrl({
|
|
685
|
+
* projectSlug: 'my-project',
|
|
686
|
+
* filename: 'confidential.pdf',
|
|
687
|
+
* mimeType: 'application/pdf',
|
|
688
|
+
* size: 1024 * 1024,
|
|
689
|
+
* });
|
|
690
|
+
*
|
|
691
|
+
* // Upload file to the presigned URL
|
|
692
|
+
* await fetch(uploadUrl, {
|
|
693
|
+
* method: 'PUT',
|
|
694
|
+
* body: file,
|
|
695
|
+
* headers: { 'Content-Type': 'application/pdf' },
|
|
696
|
+
* });
|
|
697
|
+
*
|
|
698
|
+
* // Confirm the upload
|
|
699
|
+
* const privateFile = await cdn.confirmPrivateUpload(fileId);
|
|
700
|
+
* ```
|
|
701
|
+
*/
|
|
702
|
+
getPrivateUploadUrl(request: PrivateUploadUrlRequest): Promise<PrivateUploadUrlResponse>;
|
|
703
|
+
/**
|
|
704
|
+
* Confirm that a private file upload has completed
|
|
705
|
+
*/
|
|
706
|
+
confirmPrivateUpload(fileId: string): Promise<PrivateFile>;
|
|
707
|
+
/**
|
|
708
|
+
* Upload a private file directly (handles presigned URL flow automatically)
|
|
709
|
+
*
|
|
710
|
+
* @example
|
|
711
|
+
* ```typescript
|
|
712
|
+
* const privateFile = await cdn.uploadPrivate({
|
|
713
|
+
* projectSlug: 'my-project',
|
|
714
|
+
* file: fileBuffer,
|
|
715
|
+
* filename: 'confidential.pdf',
|
|
716
|
+
* mimeType: 'application/pdf',
|
|
717
|
+
* });
|
|
718
|
+
* ```
|
|
719
|
+
*/
|
|
720
|
+
uploadPrivate(options: {
|
|
721
|
+
projectSlug: string;
|
|
722
|
+
file: Blob | Buffer | ArrayBuffer;
|
|
723
|
+
filename: string;
|
|
724
|
+
mimeType: string;
|
|
725
|
+
folder?: string;
|
|
726
|
+
description?: string;
|
|
727
|
+
metadata?: Record<string, unknown>;
|
|
728
|
+
}): Promise<PrivateFile>;
|
|
729
|
+
/**
|
|
730
|
+
* Generate a presigned download URL for a private file
|
|
731
|
+
*
|
|
732
|
+
* @example
|
|
733
|
+
* ```typescript
|
|
734
|
+
* const { downloadUrl, expiresAt } = await cdn.getPrivateDownloadUrl({
|
|
735
|
+
* fileId: 'file-id',
|
|
736
|
+
* expiresIn: 86400, // 24 hours
|
|
737
|
+
* });
|
|
738
|
+
* ```
|
|
739
|
+
*/
|
|
740
|
+
getPrivateDownloadUrl(request: PrivateDownloadUrlRequest): Promise<PrivateDownloadUrlResponse>;
|
|
741
|
+
/**
|
|
742
|
+
* Get a private file by ID
|
|
743
|
+
*/
|
|
744
|
+
getPrivateFile(fileId: string): Promise<PrivateFile>;
|
|
745
|
+
/**
|
|
746
|
+
* Update a private file's metadata
|
|
747
|
+
*/
|
|
748
|
+
updatePrivateFile(request: UpdatePrivateFileRequest): Promise<PrivateFile>;
|
|
749
|
+
/**
|
|
750
|
+
* Delete a private file
|
|
751
|
+
*/
|
|
752
|
+
deletePrivateFile(fileId: string): Promise<{
|
|
753
|
+
success: boolean;
|
|
754
|
+
}>;
|
|
755
|
+
/**
|
|
756
|
+
* Delete multiple private files
|
|
757
|
+
*/
|
|
758
|
+
deletePrivateFiles(fileIds: string[]): Promise<{
|
|
759
|
+
success: boolean;
|
|
760
|
+
deletedCount: number;
|
|
761
|
+
}>;
|
|
762
|
+
/**
|
|
763
|
+
* List private files with filters and pagination
|
|
764
|
+
*
|
|
765
|
+
* @example
|
|
766
|
+
* ```typescript
|
|
767
|
+
* const { files, total, hasMore } = await cdn.listPrivateFiles({
|
|
768
|
+
* projectSlug: 'my-project',
|
|
769
|
+
* limit: 20,
|
|
770
|
+
* });
|
|
771
|
+
* ```
|
|
772
|
+
*/
|
|
773
|
+
listPrivateFiles(request: ListPrivateFilesRequest): Promise<ListPrivateFilesResponse>;
|
|
774
|
+
private convertPrivateFileDates;
|
|
775
|
+
/**
|
|
776
|
+
* Create a download bundle from assets and/or private files
|
|
777
|
+
*
|
|
778
|
+
* The bundle will be created asynchronously. Check the status using getBundle().
|
|
779
|
+
*
|
|
780
|
+
* @example
|
|
781
|
+
* ```typescript
|
|
782
|
+
* const { bundle } = await cdn.createBundle({
|
|
783
|
+
* projectSlug: 'my-project',
|
|
784
|
+
* name: 'Project Assets - Dec 2024',
|
|
785
|
+
* assetIds: ['asset-1', 'asset-2'],
|
|
786
|
+
* privateFileIds: ['file-1', 'file-2'],
|
|
787
|
+
* expiresIn: 86400, // 24 hours
|
|
788
|
+
* });
|
|
789
|
+
* console.log(`Bundle ${bundle.id} status: ${bundle.status}`);
|
|
790
|
+
* ```
|
|
791
|
+
*/
|
|
792
|
+
createBundle(request: CreateBundleRequest): Promise<CreateBundleResponse>;
|
|
793
|
+
/**
|
|
794
|
+
* Get a download bundle by ID
|
|
795
|
+
*/
|
|
796
|
+
getBundle(bundleId: string): Promise<DownloadBundle>;
|
|
797
|
+
/**
|
|
798
|
+
* List download bundles with filters and pagination
|
|
799
|
+
*
|
|
800
|
+
* @example
|
|
801
|
+
* ```typescript
|
|
802
|
+
* const { bundles, total } = await cdn.listBundles({
|
|
803
|
+
* projectSlug: 'my-project',
|
|
804
|
+
* status: 'ready',
|
|
805
|
+
* });
|
|
806
|
+
* ```
|
|
807
|
+
*/
|
|
808
|
+
listBundles(request: ListBundlesRequest): Promise<ListBundlesResponse>;
|
|
809
|
+
/**
|
|
810
|
+
* Generate a presigned download URL for a bundle
|
|
811
|
+
*
|
|
812
|
+
* @example
|
|
813
|
+
* ```typescript
|
|
814
|
+
* const { downloadUrl, expiresAt } = await cdn.getBundleDownloadUrl({
|
|
815
|
+
* bundleId: 'bundle-id',
|
|
816
|
+
* expiresIn: 3600, // 1 hour
|
|
817
|
+
* });
|
|
818
|
+
* ```
|
|
819
|
+
*/
|
|
820
|
+
getBundleDownloadUrl(request: BundleDownloadUrlRequest): Promise<BundleDownloadUrlResponse>;
|
|
821
|
+
/**
|
|
822
|
+
* Delete a download bundle
|
|
823
|
+
*/
|
|
824
|
+
deleteBundle(bundleId: string): Promise<{
|
|
825
|
+
success: boolean;
|
|
826
|
+
}>;
|
|
827
|
+
private convertBundleDates;
|
|
566
828
|
}
|
|
567
829
|
|
|
568
|
-
export { type Asset, type AssetStatus, type AssetType, CDN, type ConfirmUploadRequest, type ConfirmUploadResponse, type CreateFolderRequest, type DeleteAssetRequest, type DeleteAssetsRequest, type DeleteAssetsResponse, type ExtractAudioRequest, type ExtractAudioResponse, type Folder, type FolderTreeNode, type GetAssetRequest, type GetFolderTreeRequest, type ListAssetsRequest, type ListAssetsResponse, type ListJobsRequest, type ListJobsResponse, type MoveAssetsRequest, type MoveAssetsResponse, type RegenerateThumbnailRequest, type RegenerateThumbnailResponse, type StreamingUrls, type ThumbnailRequest, type ThumbnailResponse, type TranscodeJob, type TranscodeVideoRequest, type TranscodingStatus, type TransformOptions, type TrimOptions, type UpdateAssetRequest, type UploadUrlRequest, type UploadUrlResponse, type VideoCodec, type VideoOutputFormat, type VideoQuality, type VideoVariant, type WatermarkOptions };
|
|
830
|
+
export { type Asset, type AssetStatus, type AssetType, type BundleDownloadUrlRequest, type BundleDownloadUrlResponse, type BundleStatus, CDN, type ConfirmUploadRequest, type ConfirmUploadResponse, type CreateBundleRequest, type CreateBundleResponse, type CreateFolderRequest, type DeleteAssetRequest, type DeleteAssetsRequest, type DeleteAssetsResponse, type DownloadBundle, type ExtractAudioRequest, type ExtractAudioResponse, type Folder, type FolderTreeNode, type GetAssetRequest, type GetFolderTreeRequest, type ListAssetsRequest, type ListAssetsResponse, type ListBundlesRequest, type ListBundlesResponse, type ListJobsRequest, type ListJobsResponse, type ListPrivateFilesRequest, type ListPrivateFilesResponse, type MoveAssetsRequest, type MoveAssetsResponse, type PrivateDownloadUrlRequest, type PrivateDownloadUrlResponse, type PrivateFile, type PrivateFileStatus, type PrivateUploadUrlRequest, type PrivateUploadUrlResponse, type RegenerateThumbnailRequest, type RegenerateThumbnailResponse, type StreamingUrls, type ThumbnailRequest, type ThumbnailResponse, type TranscodeJob, type TranscodeVideoRequest, type TranscodingStatus, type TransformOptions, type TrimOptions, type UpdateAssetRequest, type UpdatePrivateFileRequest, type UploadUrlRequest, type UploadUrlResponse, type VideoCodec, type VideoOutputFormat, type VideoQuality, type VideoVariant, type WatermarkOptions };
|