@scalemule/sdk 0.0.39 → 0.0.40

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 CHANGED
@@ -1122,6 +1122,39 @@ interface SignedUrlResponse {
1122
1122
  url: string;
1123
1123
  expires_at: string;
1124
1124
  }
1125
+ /**
1126
+ * Aggregate file status — returned by {@link StorageService.getFileStatus}.
1127
+ *
1128
+ * Foundational primitive for the chat / progressive media read side.
1129
+ * `optimize` and `transcode` are reserved for Phase 3 enrichment; until
1130
+ * filled, callers should attempt the constructed `urls.optimized` /
1131
+ * `urls.hls` directly (404 means pipeline still running).
1132
+ */
1133
+ interface FileStatus {
1134
+ file_id: string;
1135
+ mime_type: string;
1136
+ scan: {
1137
+ /** pending | scanning | clean | threat | error | quarantined */
1138
+ status: string;
1139
+ scanned_at?: string;
1140
+ };
1141
+ optimize: {
1142
+ status: string;
1143
+ breakpoints?: number[];
1144
+ } | null;
1145
+ transcode: {
1146
+ status: string;
1147
+ manifest_url?: string;
1148
+ } | null;
1149
+ urls: {
1150
+ /** Gateway path for the original bytes — `/v1/storage/files/{id}` */
1151
+ original: string;
1152
+ /** Gateway path for the photo transform — image MIME types only */
1153
+ optimized?: string;
1154
+ /** Gateway path for the HLS master playlist — video MIME types only */
1155
+ hls?: string;
1156
+ };
1157
+ }
1125
1158
  declare class StorageService extends ServiceModule {
1126
1159
  protected basePath: string;
1127
1160
  private telemetry;
@@ -1207,6 +1240,29 @@ declare class StorageService extends ServiceModule {
1207
1240
  }>>;
1208
1241
  /** Get file metadata (no signed URL). */
1209
1242
  getInfo(fileId: string, options?: RequestOptions): Promise<ApiResponse<FileInfo>>;
1243
+ /**
1244
+ * Aggregate status for a file — single call returns scan + reserved
1245
+ * optimize/transcode slots + the canonical view URL paths for image
1246
+ * (transform endpoint) and video (HLS playlist) MIME types.
1247
+ *
1248
+ * Foundational primitive for the chat / progressive media read side.
1249
+ * `useFileStatus()` (in `@scalemule/nextjs`) consumes this for both
1250
+ * first-paint and refresh-on-demand scenarios.
1251
+ *
1252
+ * `optimize` and `transcode` are reserved for Phase 3 enrichment. Until
1253
+ * the photo/video services expose internal status endpoints, callers
1254
+ * should attempt the constructed URLs directly to discover readiness
1255
+ * (404 means the pipeline is still running).
1256
+ *
1257
+ * @example
1258
+ * ```ts
1259
+ * const r = await client.storage.getFileStatus(fileId);
1260
+ * if (r.data?.scan.status === 'clean' && r.data.urls.optimized) {
1261
+ * // image: try transform URL for an optimized variant
1262
+ * }
1263
+ * ```
1264
+ */
1265
+ getFileStatus(fileId: string, options?: RequestOptions): Promise<ApiResponse<FileStatus>>;
1210
1266
  /**
1211
1267
  * Get a signed view URL for inline display (img src, thumbnails).
1212
1268
  * Returns CloudFront signed URL (fast, ~1us) or S3 presigned fallback.
package/dist/index.d.ts CHANGED
@@ -1122,6 +1122,39 @@ interface SignedUrlResponse {
1122
1122
  url: string;
1123
1123
  expires_at: string;
1124
1124
  }
1125
+ /**
1126
+ * Aggregate file status — returned by {@link StorageService.getFileStatus}.
1127
+ *
1128
+ * Foundational primitive for the chat / progressive media read side.
1129
+ * `optimize` and `transcode` are reserved for Phase 3 enrichment; until
1130
+ * filled, callers should attempt the constructed `urls.optimized` /
1131
+ * `urls.hls` directly (404 means pipeline still running).
1132
+ */
1133
+ interface FileStatus {
1134
+ file_id: string;
1135
+ mime_type: string;
1136
+ scan: {
1137
+ /** pending | scanning | clean | threat | error | quarantined */
1138
+ status: string;
1139
+ scanned_at?: string;
1140
+ };
1141
+ optimize: {
1142
+ status: string;
1143
+ breakpoints?: number[];
1144
+ } | null;
1145
+ transcode: {
1146
+ status: string;
1147
+ manifest_url?: string;
1148
+ } | null;
1149
+ urls: {
1150
+ /** Gateway path for the original bytes — `/v1/storage/files/{id}` */
1151
+ original: string;
1152
+ /** Gateway path for the photo transform — image MIME types only */
1153
+ optimized?: string;
1154
+ /** Gateway path for the HLS master playlist — video MIME types only */
1155
+ hls?: string;
1156
+ };
1157
+ }
1125
1158
  declare class StorageService extends ServiceModule {
1126
1159
  protected basePath: string;
1127
1160
  private telemetry;
@@ -1207,6 +1240,29 @@ declare class StorageService extends ServiceModule {
1207
1240
  }>>;
1208
1241
  /** Get file metadata (no signed URL). */
1209
1242
  getInfo(fileId: string, options?: RequestOptions): Promise<ApiResponse<FileInfo>>;
1243
+ /**
1244
+ * Aggregate status for a file — single call returns scan + reserved
1245
+ * optimize/transcode slots + the canonical view URL paths for image
1246
+ * (transform endpoint) and video (HLS playlist) MIME types.
1247
+ *
1248
+ * Foundational primitive for the chat / progressive media read side.
1249
+ * `useFileStatus()` (in `@scalemule/nextjs`) consumes this for both
1250
+ * first-paint and refresh-on-demand scenarios.
1251
+ *
1252
+ * `optimize` and `transcode` are reserved for Phase 3 enrichment. Until
1253
+ * the photo/video services expose internal status endpoints, callers
1254
+ * should attempt the constructed URLs directly to discover readiness
1255
+ * (404 means the pipeline is still running).
1256
+ *
1257
+ * @example
1258
+ * ```ts
1259
+ * const r = await client.storage.getFileStatus(fileId);
1260
+ * if (r.data?.scan.status === 'clean' && r.data.urls.optimized) {
1261
+ * // image: try transform URL for an optimized variant
1262
+ * }
1263
+ * ```
1264
+ */
1265
+ getFileStatus(fileId: string, options?: RequestOptions): Promise<ApiResponse<FileStatus>>;
1210
1266
  /**
1211
1267
  * Get a signed view URL for inline display (img src, thumbnails).
1212
1268
  * Returns CloudFront signed URL (fast, ~1us) or S3 presigned fallback.
package/dist/index.js CHANGED
@@ -2943,6 +2943,31 @@ var StorageService = class extends ServiceModule {
2943
2943
  async getInfo(fileId, options) {
2944
2944
  return this._get(`/files/${fileId}/info`, options);
2945
2945
  }
2946
+ /**
2947
+ * Aggregate status for a file — single call returns scan + reserved
2948
+ * optimize/transcode slots + the canonical view URL paths for image
2949
+ * (transform endpoint) and video (HLS playlist) MIME types.
2950
+ *
2951
+ * Foundational primitive for the chat / progressive media read side.
2952
+ * `useFileStatus()` (in `@scalemule/nextjs`) consumes this for both
2953
+ * first-paint and refresh-on-demand scenarios.
2954
+ *
2955
+ * `optimize` and `transcode` are reserved for Phase 3 enrichment. Until
2956
+ * the photo/video services expose internal status endpoints, callers
2957
+ * should attempt the constructed URLs directly to discover readiness
2958
+ * (404 means the pipeline is still running).
2959
+ *
2960
+ * @example
2961
+ * ```ts
2962
+ * const r = await client.storage.getFileStatus(fileId);
2963
+ * if (r.data?.scan.status === 'clean' && r.data.urls.optimized) {
2964
+ * // image: try transform URL for an optimized variant
2965
+ * }
2966
+ * ```
2967
+ */
2968
+ async getFileStatus(fileId, options) {
2969
+ return this._get(`/files/${fileId}/status`, options);
2970
+ }
2946
2971
  /**
2947
2972
  * Get a signed view URL for inline display (img src, thumbnails).
2948
2973
  * Returns CloudFront signed URL (fast, ~1us) or S3 presigned fallback.
package/dist/index.mjs CHANGED
@@ -2574,6 +2574,31 @@ var StorageService = class extends ServiceModule {
2574
2574
  async getInfo(fileId, options) {
2575
2575
  return this._get(`/files/${fileId}/info`, options);
2576
2576
  }
2577
+ /**
2578
+ * Aggregate status for a file — single call returns scan + reserved
2579
+ * optimize/transcode slots + the canonical view URL paths for image
2580
+ * (transform endpoint) and video (HLS playlist) MIME types.
2581
+ *
2582
+ * Foundational primitive for the chat / progressive media read side.
2583
+ * `useFileStatus()` (in `@scalemule/nextjs`) consumes this for both
2584
+ * first-paint and refresh-on-demand scenarios.
2585
+ *
2586
+ * `optimize` and `transcode` are reserved for Phase 3 enrichment. Until
2587
+ * the photo/video services expose internal status endpoints, callers
2588
+ * should attempt the constructed URLs directly to discover readiness
2589
+ * (404 means the pipeline is still running).
2590
+ *
2591
+ * @example
2592
+ * ```ts
2593
+ * const r = await client.storage.getFileStatus(fileId);
2594
+ * if (r.data?.scan.status === 'clean' && r.data.urls.optimized) {
2595
+ * // image: try transform URL for an optimized variant
2596
+ * }
2597
+ * ```
2598
+ */
2599
+ async getFileStatus(fileId, options) {
2600
+ return this._get(`/files/${fileId}/status`, options);
2601
+ }
2577
2602
  /**
2578
2603
  * Get a signed view URL for inline display (img src, thumbnails).
2579
2604
  * Returns CloudFront signed URL (fast, ~1us) or S3 presigned fallback.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scalemule/sdk",
3
- "version": "0.0.39",
3
+ "version": "0.0.40",
4
4
  "description": "Official TypeScript/JavaScript SDK for ScaleMule Backend-as-a-Service",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",