@scalemule/sdk 0.0.54 → 0.0.56
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/index.d.mts +315 -7
- package/dist/index.d.ts +315 -7
- package/dist/index.js +693 -9
- package/dist/index.mjs +691 -9
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1026,10 +1026,53 @@ declare class AuthService extends ServiceModule {
|
|
|
1026
1026
|
}): Promise<ApiResponse<AuthSession>>;
|
|
1027
1027
|
}
|
|
1028
1028
|
|
|
1029
|
+
/**
|
|
1030
|
+
* Tri-state file visibility — replaces the overloaded `isPublic`
|
|
1031
|
+
* boolean. Three modes, ordered most-restrictive to most-permissive:
|
|
1032
|
+
*
|
|
1033
|
+
* - `'private'` — signed/private access only. Owner +
|
|
1034
|
+
* app members only.
|
|
1035
|
+
* - `'app_public'` — readable by ANY authenticated end-user
|
|
1036
|
+
* inside the same application. Same
|
|
1037
|
+
* semantics the legacy `isPublic: true`
|
|
1038
|
+
* flag has always carried — NOT
|
|
1039
|
+
* world-readable.
|
|
1040
|
+
* - `'anonymous_visible'` — world-readable on a separate public
|
|
1041
|
+
* CDN with no auth at request time.
|
|
1042
|
+
* Suitable for direct `<img src="…">` use
|
|
1043
|
+
* on a logged-out marketing or blog page.
|
|
1044
|
+
* Must be requested explicitly — never
|
|
1045
|
+
* derived from `isPublic`.
|
|
1046
|
+
*
|
|
1047
|
+
* The storage service backs `anonymous_visible` with a separate S3
|
|
1048
|
+
* bucket fronted by an unsigned CloudFront distribution. When the
|
|
1049
|
+
* environment hasn't provisioned that bucket, `anonymous_visible`
|
|
1050
|
+
* uploads fail loud with HTTP 503 `ANONYMOUS_DELIVERY_NOT_CONFIGURED`
|
|
1051
|
+
* — the SDK never silently demotes them to `app_public`.
|
|
1052
|
+
*/
|
|
1053
|
+
type Visibility = 'private' | 'app_public' | 'anonymous_visible';
|
|
1029
1054
|
interface UploadOptions {
|
|
1030
1055
|
/** Display filename (sanitized automatically) */
|
|
1031
1056
|
filename?: string;
|
|
1032
|
-
/**
|
|
1057
|
+
/**
|
|
1058
|
+
* Tri-state visibility (preferred — see {@link Visibility}).
|
|
1059
|
+
* If both `visibility` and `isPublic` are provided, `visibility`
|
|
1060
|
+
* wins. If neither is provided, the storage service defaults to
|
|
1061
|
+
* `app_public` (matching the historical pre-tristate wire
|
|
1062
|
+
* contract). Callers wanting world-visible uploads MUST pass
|
|
1063
|
+
* `'anonymous_visible'` explicitly — `isPublic: true` only ever
|
|
1064
|
+
* means `app_public`.
|
|
1065
|
+
*/
|
|
1066
|
+
visibility?: Visibility;
|
|
1067
|
+
/**
|
|
1068
|
+
* Legacy two-state visibility flag.
|
|
1069
|
+
*
|
|
1070
|
+
* - `true` → `app_public` (NOT `anonymous_visible`)
|
|
1071
|
+
* - `false` → `private`
|
|
1072
|
+
*
|
|
1073
|
+
* Prefer the {@link visibility} field for new code. Kept for
|
|
1074
|
+
* back-compat with apps that haven't migrated.
|
|
1075
|
+
*/
|
|
1033
1076
|
isPublic?: boolean;
|
|
1034
1077
|
/** Custom metadata attached to the file */
|
|
1035
1078
|
metadata?: Record<string, unknown>;
|
|
@@ -1070,6 +1113,18 @@ interface PresignedUploadResponse {
|
|
|
1070
1113
|
completion_token: string;
|
|
1071
1114
|
expires_at: string;
|
|
1072
1115
|
method: string;
|
|
1116
|
+
/**
|
|
1117
|
+
* Resolved visibility for this upload — may differ from the value
|
|
1118
|
+
* the caller sent (e.g. legacy `is_public: true` → `app_public`).
|
|
1119
|
+
* Returned by storage so the SDK can surface back to callers.
|
|
1120
|
+
*/
|
|
1121
|
+
visibility?: Visibility;
|
|
1122
|
+
/**
|
|
1123
|
+
* Stable unsigned CDN URL the file will be served at after upload
|
|
1124
|
+
* completion. Populated only when `visibility === 'anonymous_visible'`.
|
|
1125
|
+
* Safe to embed directly in `<img src>` on a logged-out page.
|
|
1126
|
+
*/
|
|
1127
|
+
cdn_url?: string;
|
|
1073
1128
|
}
|
|
1074
1129
|
interface UploadCompleteResponse {
|
|
1075
1130
|
file_id: string;
|
|
@@ -1079,6 +1134,10 @@ interface UploadCompleteResponse {
|
|
|
1079
1134
|
url: string;
|
|
1080
1135
|
already_completed: boolean;
|
|
1081
1136
|
scan_queued: boolean;
|
|
1137
|
+
/** Resolved visibility (see {@link PresignedUploadResponse.visibility}). */
|
|
1138
|
+
visibility?: Visibility;
|
|
1139
|
+
/** Unsigned CDN URL — populated only for `anonymous_visible` files. */
|
|
1140
|
+
cdn_url?: string;
|
|
1082
1141
|
}
|
|
1083
1142
|
interface UploadFailureReport {
|
|
1084
1143
|
fileId: string;
|
|
@@ -1119,6 +1178,10 @@ interface MultipartCompleteResponse {
|
|
|
1119
1178
|
content_type: string;
|
|
1120
1179
|
url: string;
|
|
1121
1180
|
scan_queued: boolean;
|
|
1181
|
+
/** Resolved visibility — present on multipart_complete responses. */
|
|
1182
|
+
visibility?: Visibility;
|
|
1183
|
+
/** Unsigned CDN URL — populated only for `anonymous_visible` files. */
|
|
1184
|
+
cdn_url?: string;
|
|
1122
1185
|
}
|
|
1123
1186
|
interface FileInfo {
|
|
1124
1187
|
id: string;
|
|
@@ -1126,6 +1189,29 @@ interface FileInfo {
|
|
|
1126
1189
|
content_type: string;
|
|
1127
1190
|
size_bytes: number;
|
|
1128
1191
|
is_public?: boolean;
|
|
1192
|
+
/**
|
|
1193
|
+
* Tri-state visibility from the storage service. Preferred over
|
|
1194
|
+
* `is_public` — `is_public: true` covers both `app_public` and
|
|
1195
|
+
* `anonymous_visible`, which have very different delivery
|
|
1196
|
+
* contracts.
|
|
1197
|
+
*/
|
|
1198
|
+
visibility?: Visibility;
|
|
1199
|
+
/**
|
|
1200
|
+
* Bucket the file's bytes live in. For `anonymous_visible` files
|
|
1201
|
+
* this is the storage anonymous bucket; otherwise the standard
|
|
1202
|
+
* `scalemule-storage*` bucket. Empty string when older storage
|
|
1203
|
+
* instances don't return it — callers should treat that as
|
|
1204
|
+
* "primary bucket".
|
|
1205
|
+
*/
|
|
1206
|
+
bucket_name?: string;
|
|
1207
|
+
/**
|
|
1208
|
+
* Stable unsigned public-CDN URL — populated only when
|
|
1209
|
+
* `visibility === 'anonymous_visible'`. Drop directly into
|
|
1210
|
+
* `<img src>` on logged-out pages. For private/app_public files
|
|
1211
|
+
* use {@link StorageService.getViewUrl} or
|
|
1212
|
+
* {@link StorageService.getDownloadUrl} instead.
|
|
1213
|
+
*/
|
|
1214
|
+
cdn_url?: string;
|
|
1129
1215
|
url?: string;
|
|
1130
1216
|
scan_status?: string;
|
|
1131
1217
|
scanned_at?: string;
|
|
@@ -1189,6 +1275,13 @@ interface FileStatus {
|
|
|
1189
1275
|
* S3-presigned otherwise). Absent when scan is `threat` /
|
|
1190
1276
|
* `quarantined` / `error` — consumers render a blocked
|
|
1191
1277
|
* placeholder when this is null + scan is non-clean.
|
|
1278
|
+
*
|
|
1279
|
+
* For `visibility = anonymous_visible` files, this field is
|
|
1280
|
+
* ALSO null until scan has flipped to `clean` — the
|
|
1281
|
+
* release-async carve-out only applies to auth-gated tiers,
|
|
1282
|
+
* since for anon files any URL is world-readable. Use
|
|
1283
|
+
* {@link cdn_url} (which has the same gate but is typed
|
|
1284
|
+
* specifically for the public-CDN case) to branch reliably.
|
|
1192
1285
|
*/
|
|
1193
1286
|
original?: string;
|
|
1194
1287
|
/** Gateway path for the photo transform — present only when the
|
|
@@ -1197,6 +1290,27 @@ interface FileStatus {
|
|
|
1197
1290
|
/** Gateway path for the HLS master playlist — present only when the
|
|
1198
1291
|
* transcode worker reports `transcode.status === 'done'` (video only). */
|
|
1199
1292
|
hls?: string;
|
|
1293
|
+
/**
|
|
1294
|
+
* **Typed** unsigned public CDN URL — populated only when
|
|
1295
|
+
* `visibility === 'anonymous_visible'` AND scan has flipped to
|
|
1296
|
+
* `clean` (or admin-released). Lets polling consumers
|
|
1297
|
+
* (`useFileStatus()`) surface the public URL the moment it
|
|
1298
|
+
* becomes available without a separate `getInfo()` /
|
|
1299
|
+
* `list()` call. Mirrors the contract on
|
|
1300
|
+
* {@link FileInfo.cdn_url} and the upload-complete response.
|
|
1301
|
+
*
|
|
1302
|
+
* Polling pattern:
|
|
1303
|
+
* ```ts
|
|
1304
|
+
* while (true) {
|
|
1305
|
+
* const r = await sm.storage.getFileStatus(fileId);
|
|
1306
|
+
* if (r.data.urls.cdn_url) break; // safe to publish
|
|
1307
|
+
* if (['threat','quarantined','error'].includes(r.data.scan.status))
|
|
1308
|
+
* break; // failed terminal
|
|
1309
|
+
* await sleep(1000);
|
|
1310
|
+
* }
|
|
1311
|
+
* ```
|
|
1312
|
+
*/
|
|
1313
|
+
cdn_url?: string;
|
|
1200
1314
|
};
|
|
1201
1315
|
}
|
|
1202
1316
|
declare class StorageService extends ServiceModule {
|
|
@@ -1228,6 +1342,37 @@ declare class StorageService extends ServiceModule {
|
|
|
1228
1342
|
* docs/MEDIA-UPLOADS.md for the full pattern.
|
|
1229
1343
|
*/
|
|
1230
1344
|
uploadPrivate(file: File | Blob, options?: Omit<UploadOptions, 'isPublic' | 'skipCompression'>): Promise<ApiResponse<FileInfo>>;
|
|
1345
|
+
/**
|
|
1346
|
+
* Upload a file as world-readable on the anonymous public CDN.
|
|
1347
|
+
*
|
|
1348
|
+
* Same browser→S3 pipeline as {@link upload}, but pins
|
|
1349
|
+
* `visibility: 'anonymous_visible'` — caller cannot opt out.
|
|
1350
|
+
*
|
|
1351
|
+
* Use this for media meant to render on logged-out marketing
|
|
1352
|
+
* pages, blog posts, embed snippets — anywhere a customer needs
|
|
1353
|
+
* to drop a URL into `<img src>` without an authenticated
|
|
1354
|
+
* session. For everything else (chat attachments, private
|
|
1355
|
+
* uploads, app-internal galleries) prefer {@link upload} or
|
|
1356
|
+
* {@link uploadPrivate}.
|
|
1357
|
+
*
|
|
1358
|
+
* **`cdn_url` may be `null` on the immediate response.** Storage
|
|
1359
|
+
* intentionally withholds the public CDN URL until the AV scan
|
|
1360
|
+
* has flipped to `clean` — exposing the URL pre-scan would let a
|
|
1361
|
+
* customer embed the bytes in a logged-out page before the
|
|
1362
|
+
* platform has verified them. The upload itself succeeds
|
|
1363
|
+
* regardless; consumers should check `result.data.cdn_url` and:
|
|
1364
|
+
* - if non-null → it's safe to publish
|
|
1365
|
+
* - if null → poll {@link getFileStatus} on a small backoff
|
|
1366
|
+
* until `urls.cdn_url` populates (or `scan.status` flips to
|
|
1367
|
+
* `threat` / `quarantined` / `error` — terminal failure)
|
|
1368
|
+
*
|
|
1369
|
+
* Requires the operator to have provisioned the anonymous
|
|
1370
|
+
* delivery bucket + CDN. When they haven't, the storage service
|
|
1371
|
+
* returns 503 `ANONYMOUS_DELIVERY_NOT_CONFIGURED` (an error
|
|
1372
|
+
* propagated through this helper) — it never silently demotes
|
|
1373
|
+
* to `app_public`.
|
|
1374
|
+
*/
|
|
1375
|
+
uploadAnonymous(file: File | Blob, options?: Omit<UploadOptions, 'visibility' | 'isPublic'>): Promise<ApiResponse<FileInfo>>;
|
|
1231
1376
|
private uploadDirect;
|
|
1232
1377
|
private uploadMultipart;
|
|
1233
1378
|
private abortMultipart;
|
|
@@ -1239,6 +1384,9 @@ declare class StorageService extends ServiceModule {
|
|
|
1239
1384
|
* Flow: server calls getUploadUrl() → returns URL to client → client PUTs to S3 → server calls completeUpload()
|
|
1240
1385
|
*/
|
|
1241
1386
|
getUploadUrl(filename: string, contentType: string, options?: {
|
|
1387
|
+
/** Tri-state visibility (preferred). See {@link Visibility}. */
|
|
1388
|
+
visibility?: Visibility;
|
|
1389
|
+
/** Legacy boolean. `true` → app_public, `false` → private. */
|
|
1242
1390
|
isPublic?: boolean;
|
|
1243
1391
|
expiresIn?: number;
|
|
1244
1392
|
sizeBytes?: number;
|
|
@@ -1257,11 +1405,21 @@ declare class StorageService extends ServiceModule {
|
|
|
1257
1405
|
* Best used by split-upload clients that call getUploadUrl() manually.
|
|
1258
1406
|
*/
|
|
1259
1407
|
reportUploadFailure(params: UploadFailureReport, requestOptions?: RequestOptions): Promise<ApiResponse<UploadFailureReportResponse>>;
|
|
1260
|
-
/**
|
|
1408
|
+
/**
|
|
1409
|
+
* Start a multipart upload session.
|
|
1410
|
+
*
|
|
1411
|
+
* Accepts both the typed `visibility` field (preferred) and the
|
|
1412
|
+
* legacy `is_public` boolean for back-compat. If both are sent the
|
|
1413
|
+
* storage service uses `visibility`. `'anonymous_visible'` requires
|
|
1414
|
+
* the operator to have provisioned the anonymous bucket — the
|
|
1415
|
+
* service returns 503 `ANONYMOUS_DELIVERY_NOT_CONFIGURED`
|
|
1416
|
+
* otherwise (the SDK never silently demotes).
|
|
1417
|
+
*/
|
|
1261
1418
|
startMultipartUpload(params: {
|
|
1262
1419
|
filename: string;
|
|
1263
1420
|
content_type: string;
|
|
1264
1421
|
size_bytes: number;
|
|
1422
|
+
visibility?: Visibility;
|
|
1265
1423
|
is_public?: boolean;
|
|
1266
1424
|
metadata?: Record<string, unknown>;
|
|
1267
1425
|
chunk_size?: number;
|
|
@@ -1364,12 +1522,24 @@ declare class StorageService extends ServiceModule {
|
|
|
1364
1522
|
url?: string;
|
|
1365
1523
|
}>>;
|
|
1366
1524
|
/**
|
|
1367
|
-
* Update a file's visibility
|
|
1368
|
-
*
|
|
1369
|
-
*
|
|
1525
|
+
* Update a file's visibility.
|
|
1526
|
+
*
|
|
1527
|
+
* Accepts either:
|
|
1528
|
+
* - a tri-state {@link Visibility} string (preferred), or
|
|
1529
|
+
* - a legacy boolean (`true` → `app_public`, `false` → `private`).
|
|
1530
|
+
*
|
|
1531
|
+
* Only the file owner / app member can toggle this. Same-bucket
|
|
1532
|
+
* transitions (`private` ↔ `app_public`) succeed and the service
|
|
1533
|
+
* keeps the legacy `is_public` column in sync via a DB trigger.
|
|
1534
|
+
* Cross-bucket transitions (any flip into or out of
|
|
1535
|
+
* `'anonymous_visible'`) currently return 409
|
|
1536
|
+
* `VISIBILITY_TRANSITION_UNSUPPORTED` — the bytes would need to
|
|
1537
|
+
* move between S3 buckets and that orchestration is not yet
|
|
1538
|
+
* shipped. Re-upload the file with the desired visibility instead.
|
|
1370
1539
|
*/
|
|
1371
|
-
updateVisibility(fileId: string,
|
|
1540
|
+
updateVisibility(fileId: string, visibility: Visibility | boolean, options?: RequestOptions): Promise<ApiResponse<{
|
|
1372
1541
|
file_id: string;
|
|
1542
|
+
visibility: Visibility;
|
|
1373
1543
|
is_public: boolean;
|
|
1374
1544
|
}>>;
|
|
1375
1545
|
/** @deprecated Use upload() instead */
|
|
@@ -4583,6 +4753,32 @@ declare class PhotoService extends ServiceModule {
|
|
|
4583
4753
|
* Transformed images are cached server-side on first request.
|
|
4584
4754
|
*/
|
|
4585
4755
|
getTransformUrl(photoId: string, options?: TransformOptions): string;
|
|
4756
|
+
/**
|
|
4757
|
+
* Build an absolute URL for the **public** transform endpoint —
|
|
4758
|
+
* the unauthenticated path that serves transformed bytes for
|
|
4759
|
+
* `<img src>` use on logged-out marketing pages, blogs, embeds.
|
|
4760
|
+
*
|
|
4761
|
+
* The photo service refuses any photo that isn't:
|
|
4762
|
+
* - `visibility = 'anonymous_visible'` (the customer explicitly
|
|
4763
|
+
* opted into world-readable for this file at upload time)
|
|
4764
|
+
* - `scan_status = 'clean'` (no exception for pending/scanning)
|
|
4765
|
+
*
|
|
4766
|
+
* Anything else returns 404 — the endpoint refuses to disambiguate
|
|
4767
|
+
* "not found" from "not anonymous" so it can't be probed to
|
|
4768
|
+
* discover existence or visibility of private photos.
|
|
4769
|
+
*
|
|
4770
|
+
* Pair with {@link getTransformUrl} for the authenticated case:
|
|
4771
|
+
* customer apps that already have a session should keep using the
|
|
4772
|
+
* authed transform URL (which also handles `anonymous_visible`
|
|
4773
|
+
* photos transparently) — this URL is for cross-origin embedding.
|
|
4774
|
+
*
|
|
4775
|
+
* @example
|
|
4776
|
+
* ```tsx
|
|
4777
|
+
* // photo was uploaded with visibility: 'anonymous_visible'
|
|
4778
|
+
* <img src={sm.photo.getPublicTransformUrl(photoId, { width: 800 })} />
|
|
4779
|
+
* ```
|
|
4780
|
+
*/
|
|
4781
|
+
getPublicTransformUrl(photoId: string, options?: TransformOptions): string;
|
|
4586
4782
|
/**
|
|
4587
4783
|
* Get a transform URL optimized for the given display area.
|
|
4588
4784
|
*
|
|
@@ -4774,6 +4970,117 @@ declare class AudioService extends ServiceModule {
|
|
|
4774
4970
|
}, requestOptions?: RequestOptions): Promise<ApiResponse<AudioUploadViaStorageResult>>;
|
|
4775
4971
|
}
|
|
4776
4972
|
|
|
4973
|
+
type MediaKind = 'image' | 'video' | 'audio' | 'document' | 'other';
|
|
4974
|
+
type MediaPreset = 'hero' | 'inline' | 'thumbnail' | 'avatar' | 'logo' | 'custom';
|
|
4975
|
+
type MediaUploadPhase = 'presigning' | 'uploading' | 'scanning' | 'optimizing' | 'ready';
|
|
4976
|
+
interface MediaUploadEvent {
|
|
4977
|
+
phase: MediaUploadPhase;
|
|
4978
|
+
progress?: number;
|
|
4979
|
+
file_id?: string;
|
|
4980
|
+
}
|
|
4981
|
+
interface MediaPresetSpec {
|
|
4982
|
+
widths: readonly number[];
|
|
4983
|
+
fit?: 'cover' | 'contain';
|
|
4984
|
+
}
|
|
4985
|
+
declare const MEDIA_PRESETS: {
|
|
4986
|
+
readonly hero: {
|
|
4987
|
+
readonly widths: readonly [400, 800, 1200, 1600, 2400];
|
|
4988
|
+
};
|
|
4989
|
+
readonly inline: {
|
|
4990
|
+
readonly widths: readonly [400, 800, 1200];
|
|
4991
|
+
};
|
|
4992
|
+
readonly thumbnail: {
|
|
4993
|
+
readonly widths: readonly [120, 240, 360];
|
|
4994
|
+
readonly fit: "cover";
|
|
4995
|
+
};
|
|
4996
|
+
readonly avatar: {
|
|
4997
|
+
readonly widths: readonly [64, 128, 256];
|
|
4998
|
+
readonly fit: "cover";
|
|
4999
|
+
};
|
|
5000
|
+
readonly logo: {
|
|
5001
|
+
readonly widths: readonly [120, 240, 480];
|
|
5002
|
+
};
|
|
5003
|
+
};
|
|
5004
|
+
interface MediaManifest {
|
|
5005
|
+
file_id: string;
|
|
5006
|
+
content_type: string;
|
|
5007
|
+
preset: MediaPreset | 'original';
|
|
5008
|
+
variants: Record<string, string>;
|
|
5009
|
+
srcset: string | null;
|
|
5010
|
+
default: string | null;
|
|
5011
|
+
}
|
|
5012
|
+
interface MediaAsset {
|
|
5013
|
+
file_id: string;
|
|
5014
|
+
photo_id: string | null;
|
|
5015
|
+
filename: string;
|
|
5016
|
+
content_type: string;
|
|
5017
|
+
size_bytes: number;
|
|
5018
|
+
kind: MediaKind;
|
|
5019
|
+
visibility: Visibility;
|
|
5020
|
+
is_public: boolean;
|
|
5021
|
+
scan_status?: string;
|
|
5022
|
+
created_at: string;
|
|
5023
|
+
original_url: string | null;
|
|
5024
|
+
cdn_url: string | null;
|
|
5025
|
+
manifest: MediaManifest | null;
|
|
5026
|
+
}
|
|
5027
|
+
interface MediaUploadResult {
|
|
5028
|
+
file_id: string;
|
|
5029
|
+
photo_id: string | null;
|
|
5030
|
+
original_view_url: string | null;
|
|
5031
|
+
optimized_url_promise: Promise<string | null>;
|
|
5032
|
+
hls_url_promise: Promise<string | null>;
|
|
5033
|
+
mime_type: string;
|
|
5034
|
+
is_public: boolean;
|
|
5035
|
+
visibility: Visibility;
|
|
5036
|
+
cdn_url: string | null;
|
|
5037
|
+
asset: MediaAsset;
|
|
5038
|
+
}
|
|
5039
|
+
interface MediaUploadOptions {
|
|
5040
|
+
visibility?: Visibility;
|
|
5041
|
+
isPublic?: boolean;
|
|
5042
|
+
policy?: MediaPolicy;
|
|
5043
|
+
filename?: string;
|
|
5044
|
+
metadata?: Record<string, unknown>;
|
|
5045
|
+
preset?: MediaPreset;
|
|
5046
|
+
customWidths?: number[];
|
|
5047
|
+
prewarm?: boolean;
|
|
5048
|
+
onProgress?: (event: MediaUploadEvent) => void;
|
|
5049
|
+
signal?: AbortSignal;
|
|
5050
|
+
skipPhotoRegister?: boolean;
|
|
5051
|
+
}
|
|
5052
|
+
interface MediaManifestOptions {
|
|
5053
|
+
preset?: MediaPreset;
|
|
5054
|
+
customWidths?: number[];
|
|
5055
|
+
}
|
|
5056
|
+
declare class MediaService extends ServiceModule {
|
|
5057
|
+
private readonly storage;
|
|
5058
|
+
private readonly photo;
|
|
5059
|
+
private readonly video;
|
|
5060
|
+
private readonly audio;
|
|
5061
|
+
protected basePath: string;
|
|
5062
|
+
constructor(client: ScaleMuleClient, storage: StorageService, photo: PhotoService, video: VideoService, audio: AudioService);
|
|
5063
|
+
getPresets(): Record<Exclude<MediaPreset, 'custom'>, MediaPresetSpec>;
|
|
5064
|
+
upload(file: File | Blob, options?: MediaUploadOptions, requestOptions?: RequestOptions): Promise<ApiResponse<MediaUploadResult>>;
|
|
5065
|
+
get(fileId: string, options?: MediaManifestOptions, requestOptions?: RequestOptions): Promise<ApiResponse<MediaAsset>>;
|
|
5066
|
+
list(params?: PaginationParams & MediaManifestOptions, requestOptions?: RequestOptions): Promise<PaginatedResponse<MediaAsset>>;
|
|
5067
|
+
delete(fileId: string, options?: RequestOptions): Promise<ApiResponse<{
|
|
5068
|
+
deleted: boolean;
|
|
5069
|
+
}>>;
|
|
5070
|
+
releaseQuarantine(fileId: string, reason?: string, options?: RequestOptions): Promise<ApiResponse<MediaAsset>>;
|
|
5071
|
+
getManifest(fileId: string, options?: MediaManifestOptions, requestOptions?: RequestOptions): Promise<ApiResponse<MediaManifest>>;
|
|
5072
|
+
buildAsset(file: FileInfo, options?: MediaManifestOptions & {
|
|
5073
|
+
photoId?: string | null;
|
|
5074
|
+
}): MediaAsset;
|
|
5075
|
+
buildManifest(file: FileInfo, options?: MediaManifestOptions): MediaManifest | null;
|
|
5076
|
+
private uploadAnonymous;
|
|
5077
|
+
private uploadImage;
|
|
5078
|
+
private waitForAnonymousReady;
|
|
5079
|
+
private fetchInfoBestEffort;
|
|
5080
|
+
private pollPhotoOptimizationComplete;
|
|
5081
|
+
private prewarmManifest;
|
|
5082
|
+
}
|
|
5083
|
+
|
|
4777
5084
|
type TtsAccessMode = 'owner_private' | 'tenant_shared' | 'public';
|
|
4778
5085
|
type TtsSpeechProfile = 'private_default' | 'developer_summary' | 'public_blog' | 'enterprise_strict';
|
|
4779
5086
|
interface TtsAudioInfo {
|
|
@@ -6589,6 +6896,7 @@ declare class ScaleMule {
|
|
|
6589
6896
|
readonly events: EventsService;
|
|
6590
6897
|
readonly graph: GraphService;
|
|
6591
6898
|
readonly functions: FunctionsService;
|
|
6899
|
+
readonly media: MediaService;
|
|
6592
6900
|
readonly photo: PhotoService;
|
|
6593
6901
|
readonly audio: AudioService;
|
|
6594
6902
|
readonly tts: TtsService;
|
|
@@ -6666,4 +6974,4 @@ declare class ScaleMule {
|
|
|
6666
6974
|
getClient(): ScaleMuleClient;
|
|
6667
6975
|
}
|
|
6668
6976
|
|
|
6669
|
-
export { type AccountBalance, type AccountSwitcherPrivacy, AccountsService, type ActiveUsers, type ActivityItem, AgentAuthService, AgentModelsService, type AgentProfile, AgentProjectsService, type AgentResponse, type AgentSecurityPolicy, AgentSessionsService, type AgentSigningKey, type AgentToken, type AgentToolEntitlement, AgentToolsService, type Workspace as AgentWorkspace, AgentsService, type AggregateOptions, type AggregateResult, type AnalyticsEvent, AnalyticsService, type ApiError, type ApiKey, type ApiResponse, type Appeal, type Application, type Attachment, type Attendee, type AudioRegisterResult, AudioService, type AudioUploadViaStorageResult, type AuditLog, type AuthRegisterAgentRequest, type AuthRegisterAgentResponse, AuthService, type AuthSession, type AuthUser, type BackupCodes, BillingService, type CacheEntry, CacheService, type CalendarEvent, type CallParticipant, type CallSession, type CatalogEntry, CatalogService, type ChatMessage, type ChatReaction, ChatService, type ClaimResult, type Client, type ClientContext, type Collection, type Comment, CommunicationService, type CompletedPart, ComplianceService, type CompressionConfig, ConferenceService, type ConferenceSettings, type ConnectedAccount, type ConnectedAccountSubscription, type ConnectedSetupIntentResponse, type ConnectedSubscriptionListParams, type ConnectionStatus, type ContentFlag, type ContentPolicy, type Conversation, type CostReportDay, type CreateProjectInput as CreateCreatorProjectInput, type CreateFlagRequest, type CreateRuleRequest, type CreateSegmentRequest, type CreateSessionResponse, type CreateVariantRequest, type GenerationJob as CreatorJob, CreatorMakerService, type GenerationOutput as CreatorOutput, type CreatorProject, type CreatorUsage, type Credential, type CredentialScope, type Customer, type DataAccessPolicy, type DataExport, DataService, type DataSource, type DeadLetterJob, type DeviceInfo, type DirectoryUser, type DirectoryUserDetail, type DirectoryUsersListResponse, type Document, type ErrorCode, ErrorCodes, type EventAggregation, EventsService, type FileInfo, type FileStatus, type FlagAuditEntry, type FlagCheck, type FlagCondition, FlagContentService, type FlagDefinition, type FlagDetail, type FlagEnvironment, type FlagEvaluation, type FlagSegment, type FlagVariant, FlagsService, type FollowStatus, type FunctionExecution, type FunctionMetrics, FunctionsService, type Funnel, type FunnelConversion, type GdprRequest, type GenerateInput, type GrantInfo, type GraphEdge, type GraphNode, GraphService, IdentityService, type IdentityType, type IncomingRequestLike, type Invoice, type JobExecution, type JobStats, type JoinCallResponse, type KnownAccount, type KnownAccountDisplay, type Leaderboard, type LeaderboardEntry, LeaderboardService, type Like, type ListNotificationsParams, type Listing, ListingsService, type LogEntry, type LogInput, type LogQueryParams, type LogQueryResponse, type LogRecord, LoggerService, type LoginActivitySummary, type LoginDeviceInfo, type LoginHistoryEntry, type LoginRiskInfo, type MediaPolicy, type MessageCallback, type MessagePin, type MessageStatus, type MetricDataPoint, type MfaStatus, type Model, type ModelEntitlement, type ModelPricing, type ModelProvider, type UsageSummary as ModelUsageSummary, type MultipartCompleteResponse, type MultipartConfig, type MultipartPartUrl, type MultipartPartUrlsResponse, type MultipartStartResponse, type NetworkClass, type Notification, type NotificationListResponse, NotificationsService, type OAuthProvider, type OAuthUrl, OrchestratorService, PHOTO_BREAKPOINTS, type PaginatedResponse, type PaginationMetadata, type PaginationParams, type PartResult, type PartUrl, type Participant, type Payment, type PaymentListParams, type PaymentMethod, type PaymentStatusResponse, type Payout, type PayoutSchedule, type PermissionCheck, type PermissionMatrix, PermissionsService, type PhotoInfo, PhotoService, type PinnedMessagesResponse, type Pipeline, type PipelineVersion, type Policy, type PresenceCallback, type PresenceEvent, type PresignedUploadResponse, type Price, type Product, type Project, type ProjectDocument, type ProjectGrant, type ProjectMember, type PushApiFetcher, type PushPreferences, type PushSettings, type PushSubscriptionInfo, type PushToken, type PushTokenAssociationResult, type PushTopic, type QueryFilter, type QueryOptions, type QuerySort, type QueueJob, QueueService, type ReadStatus, RealtimeService, type RedeemResult, type ReferralAnalytics, type ReferralCampaign, type ReferralProfile, type ReferralStats, ReferralsService, type Refund, type RegisterAgentRequest, type RegisterAgentResponse, type RegisterPushTokenData, type RequestOptions, type ResolvedReferral, type ResumeSession, type Role, type RuntimeTemplate, type RuntimeTemplateVersion, type S3MultipartOptions, type S3MultipartResult, type S3SingleUploadOptions, type S3SingleUploadResult, type S3UploadProgress, ScaleMule, ScaleMuleClient, type ScaleMuleConfig, type SchedulerJob, SchedulerService, type SearchResult, SearchService, type SearchUsersParams, type SecurityLayers, type ServerlessFunction, type ServiceHealth, ServiceModule, type Session, type SessionArtifact, type SessionInfo, type SessionLog, type SessionPoolEntry, type Severity, type ShareLink, type ShortestPathResult, type SignedUrlResponse, type SocialPost, SocialService, type SocialUser, type SsoConfig, type StatusCallback, type StorageAdapter, StorageService, type StorageSettings, type StrategyResult, type StylePreset, type SubmitResult, type Subscription, type TargetingRule, type Task, type TaskAttempt, type TaskTransition, type Team, type TeamInvitation, type TeamMember, TeamsService, type TelemetryPayload, type Tool, type ToolCapability, type ToolIntegration, type TopEvent, type TotpSetup, type Transaction, type TransactionListParams, type TransactionSummary, type TransactionSummaryParams, type Transfer, type TransformOptions, type TransformResult, type TraversalResult, type TtsAccessMode, type TtsAudioInfo, type TtsJobStatus, type TtsListVoicesParams, TtsService, type TtsSpeechMetadata, type TtsSpeechProfile, type TtsSynthesizeParams, type TtsSynthesizeQueuedResult, type TtsSynthesizeReadyResult, type TtsSynthesizeResult, type TtsVoice, type TtsVoicesResponse, type UnreadCountResponse, type UpdateFlagRequest, type UpdateRuleRequest, type UpdateSegmentRequest, type UpdateVariantRequest, type UploadCompleteResponse, type UploadEngineConfig, type UploadFailureReport, type UploadFailureReportResponse, type UploadOptions, type UploadPlan, UploadResumeStore, type UploadStrategy, UploadTelemetry, type UploadTelemetryConfig, type UploadTelemetryEvent, type UpsertEnvironmentRequest, type UsageRecord, type UsageSummary$1 as UsageSummary, type UserRank, type VideoInfo, VideoService, type VideoUploadOptions,
|
|
6977
|
+
export { type AccountBalance, type AccountSwitcherPrivacy, AccountsService, type ActiveUsers, type ActivityItem, AgentAuthService, AgentModelsService, type AgentProfile, AgentProjectsService, type AgentResponse, type AgentSecurityPolicy, AgentSessionsService, type AgentSigningKey, type AgentToken, type AgentToolEntitlement, AgentToolsService, type Workspace as AgentWorkspace, AgentsService, type AggregateOptions, type AggregateResult, type AnalyticsEvent, AnalyticsService, type ApiError, type ApiKey, type ApiResponse, type Appeal, type Application, type Attachment, type Attendee, type AudioRegisterResult, AudioService, type AudioUploadViaStorageResult, type AuditLog, type AuthRegisterAgentRequest, type AuthRegisterAgentResponse, AuthService, type AuthSession, type AuthUser, type BackupCodes, BillingService, type CacheEntry, CacheService, type CalendarEvent, type CallParticipant, type CallSession, type CatalogEntry, CatalogService, type ChatMessage, type ChatReaction, ChatService, type ClaimResult, type Client, type ClientContext, type Collection, type Comment, CommunicationService, type CompletedPart, ComplianceService, type CompressionConfig, ConferenceService, type ConferenceSettings, type ConnectedAccount, type ConnectedAccountSubscription, type ConnectedSetupIntentResponse, type ConnectedSubscriptionListParams, type ConnectionStatus, type ContentFlag, type ContentPolicy, type Conversation, type CostReportDay, type CreateProjectInput as CreateCreatorProjectInput, type CreateFlagRequest, type CreateRuleRequest, type CreateSegmentRequest, type CreateSessionResponse, type CreateVariantRequest, type GenerationJob as CreatorJob, CreatorMakerService, type GenerationOutput as CreatorOutput, type CreatorProject, type CreatorUsage, type Credential, type CredentialScope, type Customer, type DataAccessPolicy, type DataExport, DataService, type DataSource, type DeadLetterJob, type DeviceInfo, type DirectoryUser, type DirectoryUserDetail, type DirectoryUsersListResponse, type Document, type ErrorCode, ErrorCodes, type EventAggregation, EventsService, type FileInfo, type FileStatus, type FlagAuditEntry, type FlagCheck, type FlagCondition, FlagContentService, type FlagDefinition, type FlagDetail, type FlagEnvironment, type FlagEvaluation, type FlagSegment, type FlagVariant, FlagsService, type FollowStatus, type FunctionExecution, type FunctionMetrics, FunctionsService, type Funnel, type FunnelConversion, type GdprRequest, type GenerateInput, type GrantInfo, type GraphEdge, type GraphNode, GraphService, IdentityService, type IdentityType, type IncomingRequestLike, type Invoice, type JobExecution, type JobStats, type JoinCallResponse, type KnownAccount, type KnownAccountDisplay, type Leaderboard, type LeaderboardEntry, LeaderboardService, type Like, type ListNotificationsParams, type Listing, ListingsService, type LogEntry, type LogInput, type LogQueryParams, type LogQueryResponse, type LogRecord, LoggerService, type LoginActivitySummary, type LoginDeviceInfo, type LoginHistoryEntry, type LoginRiskInfo, MEDIA_PRESETS, type MediaAsset, type MediaKind, type MediaManifest, type MediaManifestOptions, type MediaPolicy, type MediaPreset, type MediaPresetSpec, MediaService, type MediaUploadEvent, type MediaUploadOptions, type MediaUploadPhase, type MediaUploadResult, type MessageCallback, type MessagePin, type MessageStatus, type MetricDataPoint, type MfaStatus, type Model, type ModelEntitlement, type ModelPricing, type ModelProvider, type UsageSummary as ModelUsageSummary, type MultipartCompleteResponse, type MultipartConfig, type MultipartPartUrl, type MultipartPartUrlsResponse, type MultipartStartResponse, type NetworkClass, type Notification, type NotificationListResponse, NotificationsService, type OAuthProvider, type OAuthUrl, OrchestratorService, PHOTO_BREAKPOINTS, type PaginatedResponse, type PaginationMetadata, type PaginationParams, type PartResult, type PartUrl, type Participant, type Payment, type PaymentListParams, type PaymentMethod, type PaymentStatusResponse, type Payout, type PayoutSchedule, type PermissionCheck, type PermissionMatrix, PermissionsService, type PhotoInfo, PhotoService, type PinnedMessagesResponse, type Pipeline, type PipelineVersion, type Policy, type PresenceCallback, type PresenceEvent, type PresignedUploadResponse, type Price, type Product, type Project, type ProjectDocument, type ProjectGrant, type ProjectMember, type PushApiFetcher, type PushPreferences, type PushSettings, type PushSubscriptionInfo, type PushToken, type PushTokenAssociationResult, type PushTopic, type QueryFilter, type QueryOptions, type QuerySort, type QueueJob, QueueService, type ReadStatus, RealtimeService, type RedeemResult, type ReferralAnalytics, type ReferralCampaign, type ReferralProfile, type ReferralStats, ReferralsService, type Refund, type RegisterAgentRequest, type RegisterAgentResponse, type RegisterPushTokenData, type RequestOptions, type ResolvedReferral, type ResumeSession, type Role, type RuntimeTemplate, type RuntimeTemplateVersion, type S3MultipartOptions, type S3MultipartResult, type S3SingleUploadOptions, type S3SingleUploadResult, type S3UploadProgress, ScaleMule, ScaleMuleClient, type ScaleMuleConfig, type SchedulerJob, SchedulerService, type SearchResult, SearchService, type SearchUsersParams, type SecurityLayers, type ServerlessFunction, type ServiceHealth, ServiceModule, type Session, type SessionArtifact, type SessionInfo, type SessionLog, type SessionPoolEntry, type Severity, type ShareLink, type ShortestPathResult, type SignedUrlResponse, type SocialPost, SocialService, type SocialUser, type SsoConfig, type StatusCallback, type StorageAdapter, StorageService, type StorageSettings, type StrategyResult, type StylePreset, type SubmitResult, type Subscription, type TargetingRule, type Task, type TaskAttempt, type TaskTransition, type Team, type TeamInvitation, type TeamMember, TeamsService, type TelemetryPayload, type Tool, type ToolCapability, type ToolIntegration, type TopEvent, type TotpSetup, type Transaction, type TransactionListParams, type TransactionSummary, type TransactionSummaryParams, type Transfer, type TransformOptions, type TransformResult, type TraversalResult, type TtsAccessMode, type TtsAudioInfo, type TtsJobStatus, type TtsListVoicesParams, TtsService, type TtsSpeechMetadata, type TtsSpeechProfile, type TtsSynthesizeParams, type TtsSynthesizeQueuedResult, type TtsSynthesizeReadyResult, type TtsSynthesizeResult, type TtsVoice, type TtsVoicesResponse, type UnreadCountResponse, type UpdateFlagRequest, type UpdateRuleRequest, type UpdateSegmentRequest, type UpdateVariantRequest, type UploadCompleteResponse, type UploadEngineConfig, type UploadFailureReport, type UploadFailureReportResponse, type UploadOptions, type UploadPlan, UploadResumeStore, type UploadStrategy, UploadTelemetry, type UploadTelemetryConfig, type UploadTelemetryEvent, type UpsertEnvironmentRequest, type UsageRecord, type UsageSummary$1 as UsageSummary, type UserRank, type VideoInfo, VideoService, type VideoUploadOptions, WEB_PUSH_SERVICE_WORKER, WebPushManager, type WebPushManagerOptions, type WebPushSubscriptionData, type Webhook, WebhooksService, type WebrtcStats, type Workflow, type WorkflowExecution, type Workspace$1 as Workspace, type WorkspaceInvitation, type WorkspaceMember, WorkspacesService, buildClientContextHeaders, calculateTotalParts, canPerform, createUploadPlan, ScaleMule as default, detectNetworkClass, extractClientContext, generateUploadSessionId, getMeasuredBandwidthMbps, getPartRange, hasMinRoleLevel, resolveStrategy, uploadMultipartToS3, uploadSingleToS3, validateIP };
|