@limrun/api 0.82.0 → 0.84.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.
Files changed (282) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/README.md +4 -6
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts.map +1 -1
  5. package/client.js.map +1 -1
  6. package/client.mjs.map +1 -1
  7. package/core/api-promise.d.mts.map +1 -1
  8. package/core/api-promise.d.ts.map +1 -1
  9. package/core/api-promise.js +0 -1
  10. package/core/api-promise.js.map +1 -1
  11. package/core/api-promise.mjs +0 -1
  12. package/core/api-promise.mjs.map +1 -1
  13. package/core/error.d.mts.map +1 -1
  14. package/core/error.d.ts.map +1 -1
  15. package/core/error.js +0 -1
  16. package/core/error.js.map +1 -1
  17. package/core/error.mjs +0 -1
  18. package/core/error.mjs.map +1 -1
  19. package/core/pagination.d.mts.map +1 -1
  20. package/core/pagination.d.ts.map +1 -1
  21. package/core/pagination.js +0 -1
  22. package/core/pagination.js.map +1 -1
  23. package/core/pagination.mjs +0 -1
  24. package/core/pagination.mjs.map +1 -1
  25. package/core/resource.d.mts.map +1 -1
  26. package/core/resource.d.ts.map +1 -1
  27. package/core/resource.js +0 -1
  28. package/core/resource.js.map +1 -1
  29. package/core/resource.mjs +0 -1
  30. package/core/resource.mjs.map +1 -1
  31. package/exec-client.d.mts +3 -3
  32. package/exec-client.d.ts +3 -3
  33. package/gradle-snapshot.d.mts +9 -1
  34. package/gradle-snapshot.d.mts.map +1 -1
  35. package/gradle-snapshot.d.ts +9 -1
  36. package/gradle-snapshot.d.ts.map +1 -1
  37. package/gradle-snapshot.js.map +1 -1
  38. package/gradle-snapshot.mjs.map +1 -1
  39. package/index.d.mts +1 -1
  40. package/index.d.mts.map +1 -1
  41. package/index.d.ts +1 -1
  42. package/index.d.ts.map +1 -1
  43. package/index.js +4 -3
  44. package/index.js.map +1 -1
  45. package/index.mjs +1 -1
  46. package/index.mjs.map +1 -1
  47. package/internal/builtin-types.d.mts.map +1 -1
  48. package/internal/builtin-types.d.ts.map +1 -1
  49. package/internal/builtin-types.js +0 -1
  50. package/internal/builtin-types.js.map +1 -1
  51. package/internal/builtin-types.mjs +0 -1
  52. package/internal/builtin-types.mjs.map +1 -1
  53. package/internal/daemon-snapshot.d.mts +29 -0
  54. package/internal/daemon-snapshot.d.mts.map +1 -0
  55. package/internal/daemon-snapshot.d.ts +29 -0
  56. package/internal/daemon-snapshot.d.ts.map +1 -0
  57. package/internal/daemon-snapshot.js +137 -0
  58. package/internal/daemon-snapshot.js.map +1 -0
  59. package/internal/daemon-snapshot.mjs +134 -0
  60. package/internal/daemon-snapshot.mjs.map +1 -0
  61. package/internal/detect-platform.d.mts.map +1 -1
  62. package/internal/detect-platform.d.ts.map +1 -1
  63. package/internal/detect-platform.js +0 -1
  64. package/internal/detect-platform.js.map +1 -1
  65. package/internal/detect-platform.mjs +0 -1
  66. package/internal/detect-platform.mjs.map +1 -1
  67. package/internal/errors.d.mts.map +1 -1
  68. package/internal/errors.d.ts.map +1 -1
  69. package/internal/errors.js +0 -1
  70. package/internal/errors.js.map +1 -1
  71. package/internal/errors.mjs +0 -1
  72. package/internal/errors.mjs.map +1 -1
  73. package/internal/headers.d.mts.map +1 -1
  74. package/internal/headers.d.ts.map +1 -1
  75. package/internal/headers.js +0 -1
  76. package/internal/headers.js.map +1 -1
  77. package/internal/headers.mjs +0 -1
  78. package/internal/headers.mjs.map +1 -1
  79. package/internal/parse.d.mts.map +1 -1
  80. package/internal/parse.d.ts.map +1 -1
  81. package/internal/parse.js +0 -1
  82. package/internal/parse.js.map +1 -1
  83. package/internal/parse.mjs +0 -1
  84. package/internal/parse.mjs.map +1 -1
  85. package/internal/request-options.d.mts.map +1 -1
  86. package/internal/request-options.d.ts.map +1 -1
  87. package/internal/request-options.js +0 -1
  88. package/internal/request-options.js.map +1 -1
  89. package/internal/request-options.mjs +0 -1
  90. package/internal/request-options.mjs.map +1 -1
  91. package/internal/shim-types.d.mts.map +1 -1
  92. package/internal/shim-types.d.ts.map +1 -1
  93. package/internal/shim-types.js +6 -1
  94. package/internal/shim-types.js.map +1 -1
  95. package/internal/shim-types.mjs +6 -1
  96. package/internal/shim-types.mjs.map +1 -1
  97. package/internal/shims.d.mts.map +1 -1
  98. package/internal/shims.d.ts.map +1 -1
  99. package/internal/shims.js +6 -1
  100. package/internal/shims.js.map +1 -1
  101. package/internal/shims.mjs +6 -1
  102. package/internal/shims.mjs.map +1 -1
  103. package/internal/types.d.mts.map +1 -1
  104. package/internal/types.d.ts.map +1 -1
  105. package/internal/types.js +0 -1
  106. package/internal/types.js.map +1 -1
  107. package/internal/types.mjs +0 -1
  108. package/internal/types.mjs.map +1 -1
  109. package/internal/utils/base64.d.mts.map +1 -1
  110. package/internal/utils/base64.d.ts.map +1 -1
  111. package/internal/utils/base64.js +0 -1
  112. package/internal/utils/base64.js.map +1 -1
  113. package/internal/utils/base64.mjs +0 -1
  114. package/internal/utils/base64.mjs.map +1 -1
  115. package/internal/utils/env.d.mts.map +1 -1
  116. package/internal/utils/env.d.ts.map +1 -1
  117. package/internal/utils/env.js +0 -1
  118. package/internal/utils/env.js.map +1 -1
  119. package/internal/utils/env.mjs +0 -1
  120. package/internal/utils/env.mjs.map +1 -1
  121. package/internal/utils/log.d.mts.map +1 -1
  122. package/internal/utils/log.d.ts.map +1 -1
  123. package/internal/utils/log.js +0 -1
  124. package/internal/utils/log.js.map +1 -1
  125. package/internal/utils/log.mjs +0 -1
  126. package/internal/utils/log.mjs.map +1 -1
  127. package/internal/utils/query.d.mts.map +1 -1
  128. package/internal/utils/query.d.ts.map +1 -1
  129. package/internal/utils/query.js +0 -1
  130. package/internal/utils/query.js.map +1 -1
  131. package/internal/utils/query.mjs +0 -1
  132. package/internal/utils/query.mjs.map +1 -1
  133. package/internal/utils/sleep.d.mts.map +1 -1
  134. package/internal/utils/sleep.d.ts.map +1 -1
  135. package/internal/utils/sleep.js +0 -1
  136. package/internal/utils/sleep.js.map +1 -1
  137. package/internal/utils/sleep.mjs +0 -1
  138. package/internal/utils/sleep.mjs.map +1 -1
  139. package/internal/utils/uuid.d.mts.map +1 -1
  140. package/internal/utils/uuid.d.ts.map +1 -1
  141. package/internal/utils/uuid.js +0 -1
  142. package/internal/utils/uuid.js.map +1 -1
  143. package/internal/utils/uuid.mjs +0 -1
  144. package/internal/utils/uuid.mjs.map +1 -1
  145. package/internal/utils/values.d.mts.map +1 -1
  146. package/internal/utils/values.d.ts.map +1 -1
  147. package/internal/utils/values.js +0 -1
  148. package/internal/utils/values.js.map +1 -1
  149. package/internal/utils/values.mjs +0 -1
  150. package/internal/utils/values.mjs.map +1 -1
  151. package/internal/utils.d.mts.map +1 -1
  152. package/internal/utils.d.ts.map +1 -1
  153. package/internal/utils.js +0 -1
  154. package/internal/utils.js.map +1 -1
  155. package/internal/utils.mjs +0 -1
  156. package/internal/utils.mjs.map +1 -1
  157. package/package.json +2 -2
  158. package/resources/analytics.d.mts.map +1 -1
  159. package/resources/analytics.d.ts.map +1 -1
  160. package/resources/analytics.js +0 -1
  161. package/resources/analytics.js.map +1 -1
  162. package/resources/analytics.mjs +0 -1
  163. package/resources/analytics.mjs.map +1 -1
  164. package/resources/android-instances.d.mts.map +1 -1
  165. package/resources/android-instances.d.ts.map +1 -1
  166. package/resources/android-instances.js +0 -1
  167. package/resources/android-instances.js.map +1 -1
  168. package/resources/android-instances.mjs +0 -1
  169. package/resources/android-instances.mjs.map +1 -1
  170. package/resources/assets.d.mts.map +1 -1
  171. package/resources/assets.d.ts.map +1 -1
  172. package/resources/assets.js +0 -1
  173. package/resources/assets.js.map +1 -1
  174. package/resources/assets.mjs +0 -1
  175. package/resources/assets.mjs.map +1 -1
  176. package/resources/daemon-client-shared.d.mts.map +1 -1
  177. package/resources/daemon-client-shared.d.ts.map +1 -1
  178. package/resources/daemon-client-shared.js.map +1 -1
  179. package/resources/daemon-client-shared.mjs.map +1 -1
  180. package/resources/gradle-instances-helpers.d.mts.map +1 -1
  181. package/resources/gradle-instances-helpers.d.ts.map +1 -1
  182. package/resources/gradle-instances-helpers.js +25 -37
  183. package/resources/gradle-instances-helpers.js.map +1 -1
  184. package/resources/gradle-instances-helpers.mjs +25 -37
  185. package/resources/gradle-instances-helpers.mjs.map +1 -1
  186. package/resources/gradle-instances.d.mts.map +1 -1
  187. package/resources/gradle-instances.d.ts.map +1 -1
  188. package/resources/gradle-instances.js +0 -2
  189. package/resources/gradle-instances.js.map +1 -1
  190. package/resources/gradle-instances.mjs +0 -2
  191. package/resources/gradle-instances.mjs.map +1 -1
  192. package/resources/index.d.mts +1 -1
  193. package/resources/index.d.mts.map +1 -1
  194. package/resources/index.d.ts +1 -1
  195. package/resources/index.d.ts.map +1 -1
  196. package/resources/index.js +3 -2
  197. package/resources/index.js.map +1 -1
  198. package/resources/index.mjs +1 -1
  199. package/resources/index.mjs.map +1 -1
  200. package/resources/ios-instances.d.mts.map +1 -1
  201. package/resources/ios-instances.d.ts.map +1 -1
  202. package/resources/ios-instances.js +0 -1
  203. package/resources/ios-instances.js.map +1 -1
  204. package/resources/ios-instances.mjs +0 -1
  205. package/resources/ios-instances.mjs.map +1 -1
  206. package/resources/macos-instances-helpers.d.mts +34 -3
  207. package/resources/macos-instances-helpers.d.mts.map +1 -1
  208. package/resources/macos-instances-helpers.d.ts +34 -3
  209. package/resources/macos-instances-helpers.d.ts.map +1 -1
  210. package/resources/macos-instances-helpers.js +112 -25
  211. package/resources/macos-instances-helpers.js.map +1 -1
  212. package/resources/macos-instances-helpers.mjs +110 -25
  213. package/resources/macos-instances-helpers.mjs.map +1 -1
  214. package/resources/macos-instances.d.mts.map +1 -1
  215. package/resources/macos-instances.d.ts.map +1 -1
  216. package/resources/macos-instances.js +0 -2
  217. package/resources/macos-instances.js.map +1 -1
  218. package/resources/macos-instances.mjs +0 -2
  219. package/resources/macos-instances.mjs.map +1 -1
  220. package/resources/scoped-tokens.d.mts.map +1 -1
  221. package/resources/scoped-tokens.d.ts.map +1 -1
  222. package/resources/scoped-tokens.js +0 -1
  223. package/resources/scoped-tokens.js.map +1 -1
  224. package/resources/scoped-tokens.mjs +0 -1
  225. package/resources/scoped-tokens.mjs.map +1 -1
  226. package/resources/xcode-instances-helpers.d.mts +3 -4
  227. package/resources/xcode-instances-helpers.d.mts.map +1 -1
  228. package/resources/xcode-instances-helpers.d.ts +3 -4
  229. package/resources/xcode-instances-helpers.d.ts.map +1 -1
  230. package/resources/xcode-instances-helpers.js.map +1 -1
  231. package/resources/xcode-instances-helpers.mjs.map +1 -1
  232. package/resources/xcode-instances.d.mts.map +1 -1
  233. package/resources/xcode-instances.d.ts.map +1 -1
  234. package/resources/xcode-instances.js +0 -1
  235. package/resources/xcode-instances.js.map +1 -1
  236. package/resources/xcode-instances.mjs +0 -1
  237. package/resources/xcode-instances.mjs.map +1 -1
  238. package/src/client.ts +0 -2
  239. package/src/core/api-promise.ts +0 -2
  240. package/src/core/error.ts +0 -2
  241. package/src/core/pagination.ts +0 -2
  242. package/src/core/resource.ts +0 -2
  243. package/src/exec-client.ts +3 -3
  244. package/src/gradle-snapshot.ts +9 -1
  245. package/src/index.ts +1 -2
  246. package/src/internal/builtin-types.ts +0 -2
  247. package/src/internal/daemon-snapshot.ts +144 -0
  248. package/src/internal/detect-platform.ts +0 -2
  249. package/src/internal/errors.ts +0 -2
  250. package/src/internal/headers.ts +0 -2
  251. package/src/internal/parse.ts +0 -2
  252. package/src/internal/request-options.ts +0 -2
  253. package/src/internal/shim-types.ts +0 -2
  254. package/src/internal/shims.ts +0 -2
  255. package/src/internal/types.ts +0 -2
  256. package/src/internal/utils/base64.ts +0 -2
  257. package/src/internal/utils/env.ts +0 -2
  258. package/src/internal/utils/log.ts +0 -2
  259. package/src/internal/utils/query.ts +0 -2
  260. package/src/internal/utils/sleep.ts +0 -2
  261. package/src/internal/utils/uuid.ts +0 -2
  262. package/src/internal/utils/values.ts +0 -2
  263. package/src/internal/utils.ts +0 -2
  264. package/src/resources/analytics.ts +0 -2
  265. package/src/resources/android-instances.ts +0 -2
  266. package/src/resources/assets.ts +0 -2
  267. package/src/resources/daemon-client-shared.ts +2 -4
  268. package/src/resources/gradle-instances-helpers.ts +27 -41
  269. package/src/resources/gradle-instances.ts +0 -3
  270. package/src/resources/index.ts +1 -2
  271. package/src/resources/ios-instances.ts +0 -2
  272. package/src/resources/macos-instances-helpers.ts +169 -29
  273. package/src/resources/macos-instances.ts +0 -3
  274. package/src/resources/scoped-tokens.ts +0 -2
  275. package/src/resources/xcode-instances-helpers.ts +3 -4
  276. package/src/resources/xcode-instances.ts +0 -2
  277. package/src/version.ts +1 -1
  278. package/version.d.mts +1 -1
  279. package/version.d.ts +1 -1
  280. package/version.js +1 -1
  281. package/version.mjs +1 -1
  282. package/src/lib/.keep +0 -4
@@ -52,6 +52,8 @@ import {
52
52
  pushFile as pushLocalFile,
53
53
  type PullResult,
54
54
  } from '../internal/file-transfer';
55
+ import { LimrunError } from '../core/error';
56
+ import { followDaemonSnapshot } from '../internal/daemon-snapshot';
55
57
  import { nodeProxyTransport } from '../internal/proxy-transport';
56
58
  import nodePath from 'path';
57
59
  import { createHash } from 'crypto';
@@ -318,9 +320,10 @@ export interface MacosClient {
318
320
  *
319
321
  * Each restore key is tried in order: its exact name first, then the newest asset whose name
320
322
  * starts with it, skipping snapshots saved on another macOS build. Without `restoreKeys`,
321
- * `key` is restored. Without either, nothing is restored. Call it once the instance is ready
322
- * and before using the guest; asking again joins the restore already running. Resolves with the
323
- * final progress event; `onProgress` sees every event, with byte counts while downloading.
323
+ * `key` is restored. Without either, nothing is restored and it resolves with the save's state.
324
+ * Call it once the instance is ready and before using the guest; asking again joins the restore
325
+ * already running. Resolves with the final progress event; `onProgress` sees every event, with
326
+ * byte counts while downloading.
324
327
  */
325
328
  restoreSnapshot(options: MacosSnapshotRestoreOptions): Promise<MacosSnapshotProgress>;
326
329
 
@@ -460,11 +463,33 @@ export interface MacosSnapshotRestoreOptions {
460
463
  key?: string;
461
464
  /** Asset names, or name prefixes, to restore from, in order. Defaults to `key`. */
462
465
  restoreKeys?: string[];
466
+ /**
467
+ * A base64 AES-256 key, 32 random bytes, that encrypts the save and decrypts the restore. Limrun
468
+ * stores no copy, so a lost key makes the snapshot unreadable. Generate one with
469
+ * `openssl rand -base64 32`. An instance from before encrypted snapshots rejects it with
470
+ * `MacosSnapshotEncryptionUnsupportedError` and restores nothing.
471
+ */
472
+ encryptionKey?: string;
473
+ /**
474
+ * Guest paths the save under `key` leaves out, each with everything under it, such as build
475
+ * output or secrets. A path is absolute or relative to the guest user's home, and may use `*`,
476
+ * `?` and `[...]` within a segment, a backslash escaping each, and `**` for any number of
477
+ * segments, as in `~/**\/node_modules`. Up to 100. They need `key` and are fixed with it.
478
+ */
479
+ excludePaths?: string[];
480
+ /** Called once per distinct state, and again as the download progresses. */
463
481
  onProgress?: (progress: MacosSnapshotProgress) => void;
482
+ /** How long to wait for the restore to end. Defaults to twenty minutes. */
483
+ timeoutMs?: number;
464
484
  }
465
485
 
466
486
  /** A restore's progress, as the instance reports it. */
467
487
  export interface MacosSnapshotProgress {
488
+ /**
489
+ * The restore's phase. A request with neither `key` nor `restoreKeys` restores nothing and
490
+ * reports the save the instance runs when it terminates instead: the phase is then the save's,
491
+ * such as `idle`.
492
+ */
468
493
  phase: 'resolving' | 'downloading' | 'extracting' | 'restored' | 'skipped' | 'failed' | string;
469
494
  /** The asset name the restore matched. */
470
495
  key?: string;
@@ -547,6 +572,42 @@ class MacosInstancesHelpers extends MacosInstances {
547
572
  return true;
548
573
  },
549
574
  });
575
+ // limacvm's restoreSnapshot over signaling, which every limacvm takes. Progress arrives as
576
+ // restoreSnapshotProgress before the result.
577
+ const restoreOverSignaling = async (
578
+ request: Record<string, unknown>,
579
+ onProgress: MacosSnapshotRestoreOptions['onProgress'],
580
+ ): Promise<MacosSnapshotProgress> => {
581
+ const id = transport.nextId();
582
+ let last: MacosSnapshotProgress | undefined;
583
+ restoreProgress.set(id, (progress) => {
584
+ last = progress;
585
+ onProgress?.(progress);
586
+ });
587
+ try {
588
+ // A restore downloads the whole disk, so it waits as long as the connection lasts.
589
+ let final: MacosSnapshotProgress | undefined;
590
+ try {
591
+ final = await transport.request<MacosSnapshotProgress | undefined>(
592
+ 'restoreSnapshot',
593
+ request,
594
+ (msg) => msg['progress'] as MacosSnapshotProgress | undefined,
595
+ 0,
596
+ id,
597
+ );
598
+ } catch (error) {
599
+ // A failed restore is an outcome, as it was reported in its progress, not an error.
600
+ if (last?.phase === 'failed') return last;
601
+ throw error;
602
+ }
603
+ if (final && final !== last) onProgress?.(final);
604
+ const result = final ?? last;
605
+ if (!result) throw new Error('the instance finished the restore without reporting its progress');
606
+ return result;
607
+ } finally {
608
+ restoreProgress.delete(id);
609
+ }
610
+ };
550
611
  const send = <T = void>(
551
612
  type: string,
552
613
  params: Record<string, unknown> = {},
@@ -882,36 +943,53 @@ class MacosInstancesHelpers extends MacosInstances {
882
943
  onProgress,
883
944
  key,
884
945
  restoreKeys,
946
+ encryptionKey,
947
+ excludePaths,
948
+ timeoutMs = MACOS_RESTORE_TIMEOUT_MS,
885
949
  }: MacosSnapshotRestoreOptions): Promise<MacosSnapshotProgress> {
886
- const id = transport.nextId();
950
+ const request = {
951
+ ...(key !== undefined && { key }),
952
+ ...(restoreKeys !== undefined && { restoreKeys }),
953
+ ...(encryptionKey !== undefined && { encryptionKey }),
954
+ ...(excludePaths !== undefined && { excludePaths }),
955
+ };
956
+ // A request for no restore reports the save, as signaling does.
957
+ const restores = (restoreKeys ?? (key !== undefined ? [key] : [])).length > 0;
887
958
  let last: MacosSnapshotProgress | undefined;
888
- restoreProgress.set(id, (progress) => {
889
- last = progress;
890
- onProgress?.(progress);
891
- });
959
+ let reported = '';
892
960
  try {
893
- // A restore downloads the whole disk, so it waits as long as the connection lasts.
894
- let final: MacosSnapshotProgress | undefined;
895
- try {
896
- final = await transport.request<MacosSnapshotProgress | undefined>(
897
- 'restoreSnapshot',
898
- { ...(key !== undefined && { key }), ...(restoreKeys !== undefined && { restoreKeys }) },
899
- (msg) => msg['progress'] as MacosSnapshotProgress | undefined,
900
- 0,
901
- id,
902
- );
903
- } catch (error) {
904
- // A failed restore is an outcome, as it was reported in its progress, not an error.
905
- if (last?.phase === 'failed') return last;
906
- throw error;
907
- }
908
- if (final && final !== last) onProgress?.(final);
909
- const result = final ?? last;
910
- if (!result) throw new Error('the instance finished the restore without reporting its progress');
911
- return result;
912
- } finally {
913
- restoreProgress.delete(id);
961
+ await followDaemonSnapshot<MacosSnapshotReport>({
962
+ apiUrl,
963
+ token,
964
+ request,
965
+ timeoutMs,
966
+ onStatus: (report) => {
967
+ last = macosSnapshotProgress(report, restores);
968
+ const seen = `${last.phase}/${last.reason ?? ''}/${last.doneBytes ?? ''}`;
969
+ if (seen !== reported) {
970
+ reported = seen;
971
+ onProgress?.(last);
972
+ }
973
+ return !restores || MACOS_RESTORE_TERMINAL.has(report.restore.phase);
974
+ },
975
+ unavailableError: () => new MacosSnapshotRequestUnavailableError(),
976
+ timeoutError: () =>
977
+ new Error(
978
+ `Timed out after ${Math.round(
979
+ timeoutMs / 1000,
980
+ )}s waiting for the disk snapshot restore to finish` +
981
+ (last ? ` (last phase: ${last.phase})` : ''),
982
+ ),
983
+ });
984
+ return last!;
985
+ } catch (error) {
986
+ // An instance from before POST /snapshot takes the request over signaling only.
987
+ if (!(error instanceof MacosSnapshotRequestUnavailableError)) throw error;
914
988
  }
989
+ // Every instance that encrypts snapshots takes POST /snapshot. An older one would ignore
990
+ // the key and save the guest unencrypted, so it gets no request at all.
991
+ if (encryptionKey !== undefined) throw new MacosSnapshotEncryptionUnsupportedError();
992
+ return restoreOverSignaling(request, onProgress);
915
993
  },
916
994
 
917
995
  async drag(from, to, options) {
@@ -966,3 +1044,65 @@ function validateRecordingId(recordingId: string): void {
966
1044
  throw new Error('recordingId must match ^[a-z0-9][a-z0-9_-]{0,63}$');
967
1045
  }
968
1046
  }
1047
+
1048
+ /** Waits past the instance's own fifteen-minute bound on a restore before giving up on it. */
1049
+ const MACOS_RESTORE_TIMEOUT_MS = 20 * 60 * 1000;
1050
+
1051
+ const MACOS_RESTORE_TERMINAL = new Set(['disabled', 'restored', 'skipped', 'failed']);
1052
+
1053
+ /** POST /snapshot answered 404, so the instance predates it or keeps no snapshots. */
1054
+ class MacosSnapshotRequestUnavailableError extends Error {}
1055
+
1056
+ /**
1057
+ * `restoreSnapshot` was given an `encryptionKey` and the instance predates encrypted snapshots.
1058
+ * Nothing was restored, and the instance saves nothing. A new instance takes the key.
1059
+ */
1060
+ export class MacosSnapshotEncryptionUnsupportedError extends LimrunError {
1061
+ constructor() {
1062
+ super(
1063
+ 'This instance predates encrypted disk snapshots, so it cannot take an encryption key; create a new instance.',
1064
+ );
1065
+ this.name = 'MacosSnapshotEncryptionUnsupportedError';
1066
+ }
1067
+ }
1068
+
1069
+ /** The status limacvm answers POST and GET /snapshot with. */
1070
+ type MacosSnapshotReport = {
1071
+ restore: {
1072
+ phase: string;
1073
+ key?: string;
1074
+ matchKind?: string;
1075
+ source?: string;
1076
+ bytes?: number;
1077
+ doneBytes?: number;
1078
+ reason?: string;
1079
+ message?: string;
1080
+ };
1081
+ save: { phase: string; key?: string; reason?: string; message?: string };
1082
+ };
1083
+
1084
+ /** The report in the shape signaling's progress events have, which `restoreSnapshot` returns. */
1085
+ function macosSnapshotProgress(
1086
+ { restore, save }: MacosSnapshotReport,
1087
+ restores: boolean,
1088
+ ): MacosSnapshotProgress {
1089
+ if (!restores) {
1090
+ return {
1091
+ phase: save.phase,
1092
+ ...(save.key && { key: save.key }),
1093
+ ...(save.reason && { reason: save.reason }),
1094
+ ...(save.message && { message: save.message }),
1095
+ };
1096
+ }
1097
+ return {
1098
+ phase: restore.phase,
1099
+ ...(restore.key && { key: restore.key }),
1100
+ ...(restore.matchKind && { matchKind: restore.matchKind }),
1101
+ ...(restore.source && { source: restore.source }),
1102
+ ...(restore.bytes && { totalBytes: restore.bytes, doneBytes: restore.doneBytes ?? 0 }),
1103
+ // A download that has not learned its total yet still reports its progress.
1104
+ ...(!restore.bytes && restore.doneBytes && { doneBytes: restore.doneBytes }),
1105
+ ...(restore.reason && { reason: restore.reason }),
1106
+ ...(restore.message && { message: restore.message }),
1107
+ };
1108
+ }
@@ -1,6 +1,3 @@
1
- // Hand-written following the Stainless resource pattern; a future generation
2
- // from the OpenAPI spec reconciles with this file.
3
-
4
1
  import { APIResource } from '../core/resource';
5
2
  import { APIPromise } from '../core/api-promise';
6
3
  import { Items, type ItemsParams, PagePromise } from '../core/pagination';
@@ -1,5 +1,3 @@
1
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
1
  import {
4
2
  type AccessTokenCreateParams,
5
3
  TOKEN_SERVICE_URL,
@@ -181,10 +181,9 @@ export type XcodeProjectConfig = {
181
181
  */
182
182
  runTests?: boolean;
183
183
  /**
184
- * Run the tests through Apple's xcodebuild on the attached simulator and
185
- * keep their result bundle, reported as ExecResult.xctest.resultBundle;
186
- * fetch it with XcodeClient.pullResultBundle. Needs a testing action and a
187
- * test run.
184
+ * Keep the test run's result bundle, reported as
185
+ * ExecResult.xctest.resultBundle; fetch it with XcodeClient.pullResultBundle.
186
+ * Needs a testing action and a test run.
188
187
  */
189
188
  resultBundle?: boolean;
190
189
  /**
@@ -1,5 +1,3 @@
1
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
1
  import { APIResource } from '../core/resource';
4
2
  import { APIPromise } from '../core/api-promise';
5
3
  import { Items, type ItemsParams, PagePromise } from '../core/pagination';
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.82.0'; // x-release-please-version
1
+ export const VERSION = '0.84.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.82.0";
1
+ export declare const VERSION = "0.84.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.82.0";
1
+ export declare const VERSION = "0.84.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '0.82.0'; // x-release-please-version
4
+ exports.VERSION = '0.84.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.82.0'; // x-release-please-version
1
+ export const VERSION = '0.84.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map
package/src/lib/.keep DELETED
@@ -1,4 +0,0 @@
1
- File generated from our OpenAPI spec by Stainless.
2
-
3
- This directory can be used to store custom files to expand the SDK.
4
- It is ignored by Stainless code generation and its content (other than this keep file) won't be touched.