@series-inc/rundot-game-sdk 5.19.0 → 5.20.0-beta.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.
@@ -2309,10 +2309,24 @@ interface StorageQuota {
2309
2309
  usedBytes: number;
2310
2310
  capBytes: number;
2311
2311
  availableBytes: number;
2312
+ /** Per-file cap for normal (allowlisted content-type) uploads. */
2312
2313
  maxFileBytes: number;
2314
+ /** Larger per-file cap for gated `application/zip` archive uploads. */
2315
+ maxArchiveBytes: number;
2313
2316
  /** Creator entitlement tier driving the storage cap. */
2314
2317
  tier: 'free' | 'creator' | 'plus' | 'pro' | 'power' | 'max';
2315
2318
  }
2319
+ /**
2320
+ * Extract a ZIP archive (uploaded to `input`) into individual Files entries
2321
+ * under `outputPrefix`. Unlike the single-output transforms, this fans out to
2322
+ * MANY keys, so it returns an {@link ArchiveExtractResult} manifest rather than
2323
+ * a single `entry`. Gated server-side (allowlisted app + entitlement). */
2324
+ type ArchiveExtractParams = {
2325
+ op: 'unzip';
2326
+ input: string;
2327
+ outputPrefix: string;
2328
+ clientRef?: string;
2329
+ };
2316
2330
  type TransformParams = {
2317
2331
  op: 'concat';
2318
2332
  inputs: string[];
@@ -2390,11 +2404,34 @@ type TransformParams = {
2390
2404
  outputKey: string;
2391
2405
  maxDurationSec: number;
2392
2406
  clientRef?: string;
2393
- };
2407
+ } | ArchiveExtractParams;
2394
2408
  interface TransformResult {
2395
2409
  jobId: string;
2396
2410
  entry: FileEntry;
2397
2411
  }
2412
+ /** One file extracted from an archive into the Files namespace. */
2413
+ interface ArchiveExtractEntry {
2414
+ /** Relative path inside the archive (POSIX, containment-checked server-side). */
2415
+ path: string;
2416
+ /** The Files key it was written to (`<outputPrefix>/<path>`). */
2417
+ key: string;
2418
+ sizeBytes: number;
2419
+ contentType: string;
2420
+ }
2421
+ /** A file the extractor intentionally did NOT write (e.g. over the per-file
2422
+ * cap, disallowed type, or an unsafe path). */
2423
+ interface ArchiveSkippedEntry {
2424
+ path: string;
2425
+ reason: 'oversize' | 'unsupported' | 'invalid-path';
2426
+ bytes?: number;
2427
+ }
2428
+ /** Manifest returned by an `unzip` transform: what landed + what didn't. */
2429
+ interface ArchiveExtractResult {
2430
+ /** Files keys created under `outputPrefix`. */
2431
+ created: ArchiveExtractEntry[];
2432
+ /** Entries skipped, with reasons (surface as "N media skipped"). */
2433
+ skipped: ArchiveSkippedEntry[];
2434
+ }
2398
2435
  interface ConfirmUploadOptions {
2399
2436
  clientRef?: string;
2400
2437
  }
@@ -2428,11 +2465,11 @@ interface CloudinaryExportResult {
2428
2465
  }
2429
2466
  interface FilesJobEvent {
2430
2467
  jobId: string;
2431
- type: 'fileConfirm' | 'upscale' | 'transform' | 'fileExportCloudinary';
2468
+ type: 'fileConfirm' | 'upscale' | 'transform' | 'fileExportCloudinary' | 'archiveExtract';
2432
2469
  status: 'completed' | 'failed';
2433
2470
  clientRef?: string;
2434
2471
  params: Record<string, unknown>;
2435
- result?: FileEntry | TransformResult | CloudinaryExportResult;
2472
+ result?: FileEntry | TransformResult | CloudinaryExportResult | ArchiveExtractResult;
2436
2473
  error?: string | {
2437
2474
  code: string;
2438
2475
  message: string;
@@ -2452,8 +2489,14 @@ interface FilesApi {
2452
2489
  delete(key: string): Promise<void>;
2453
2490
  list(params?: ListParams): Promise<ListResult>;
2454
2491
  getQuota(): Promise<StorageQuota>;
2455
- hasStorageAvailable(sizeBytes: number): Promise<boolean>;
2492
+ /**
2493
+ * Whether `sizeBytes` fits both the remaining quota AND the relevant per-file
2494
+ * cap. Pass `contentType` for archive uploads (`application/zip`) so the
2495
+ * larger archive cap is used instead of the normal per-file cap.
2496
+ */
2497
+ hasStorageAvailable(sizeBytes: number, contentType?: string): Promise<boolean>;
2456
2498
  setVisibility(key: string, visibility: 'private' | 'public'): Promise<FileEntry>;
2499
+ transform(params: ArchiveExtractParams): Promise<ArchiveExtractResult>;
2457
2500
  transform(params: TransformParams): Promise<TransformResult>;
2458
2501
  exportToCloudinary(params: ExportToCloudinaryParams): Promise<CloudinaryExportResult>;
2459
2502
  getCompletedJobs(): Promise<FilesJobEvent[]>;
@@ -1009,7 +1009,7 @@ function initializeSimulation(rundotGameApi, host) {
1009
1009
  }
1010
1010
 
1011
1011
  // src/version.ts
1012
- var SDK_VERSION = "5.19.0";
1012
+ var SDK_VERSION = "5.20.0-beta.0";
1013
1013
 
1014
1014
  // src/leaderboard/utils.ts
1015
1015
  var HASH_ALGORITHM_WEB_CRYPTO = "SHA-256";
@@ -1956,9 +1956,10 @@ var RpcFilesApi = class {
1956
1956
  {}
1957
1957
  );
1958
1958
  }
1959
- async hasStorageAvailable(sizeBytes) {
1959
+ async hasStorageAvailable(sizeBytes, contentType) {
1960
1960
  const quota = await this.getQuota();
1961
- return quota.availableBytes >= sizeBytes && sizeBytes <= quota.maxFileBytes;
1961
+ const cap = contentType === "application/zip" ? quota.maxArchiveBytes : quota.maxFileBytes;
1962
+ return quota.availableBytes >= sizeBytes && sizeBytes <= cap;
1962
1963
  }
1963
1964
  async setVisibility(key, visibility) {
1964
1965
  return this.rpcClient.call(
@@ -2032,9 +2033,9 @@ var MockFilesApi = class {
2032
2033
  return { files: [] };
2033
2034
  }
2034
2035
  async getQuota() {
2035
- return { usedBytes: 0, capBytes: 0, availableBytes: 0, maxFileBytes: 0, tier: "free" };
2036
+ return { usedBytes: 0, capBytes: 0, availableBytes: 0, maxFileBytes: 0, maxArchiveBytes: 0, tier: "free" };
2036
2037
  }
2037
- async hasStorageAvailable(_sizeBytes) {
2038
+ async hasStorageAvailable(_sizeBytes, _contentType) {
2038
2039
  return false;
2039
2040
  }
2040
2041
  async setVisibility(_key, _visibility) {
@@ -3717,5 +3718,5 @@ function initializeClips(rundotGameApi, host) {
3717
3718
  }
3718
3719
 
3719
3720
  export { HASH_ALGORITHM_NODE, HASH_ALGORITHM_WEB_CRYPTO, MockAdminImageGenApi, MockAdminSpriteGenApi, MockAdminThreeDGenApi, MockAiApi, MockAppApi, MockCaptureConsent, MockClipsApi, MockImageGenApi, MockLeaderboardApi, MockSocialApi, MockSpriteGenApi, RemoteHost, RpcAdminImageGenApi, RpcAdminSpriteGenApi, RpcAdminThreeDGenApi, RpcAdminUgcApi, RpcAiApi, RpcAppApi, RpcCaptureConsent, RpcClient, RpcIapApi, RpcImageGenApi, RpcLeaderboardApi, RpcSimulationApi, RpcSocialApi, RpcSpriteGenApi, SDK_VERSION, computeScoreHash, createHost, initializeAi, initializeApp, initializeAudioGen, initializeClips, initializeFiles, initializeIap, initializeImageGen, initializeLeaderboard, initializeSimulation, initializeSocial, initializeSpriteGen, initializeTextGen, initializeThreeDGen, initializeUgc, initializeVideoGen };
3720
- //# sourceMappingURL=chunk-QS23KQWG.js.map
3721
- //# sourceMappingURL=chunk-QS23KQWG.js.map
3721
+ //# sourceMappingURL=chunk-R5IBNBHB.js.map
3722
+ //# sourceMappingURL=chunk-R5IBNBHB.js.map