@limrun/api 0.70.0 → 0.70.2

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 (135) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/app-archive.d.mts +7 -0
  3. package/app-archive.d.mts.map +1 -1
  4. package/app-archive.d.ts +7 -0
  5. package/app-archive.d.ts.map +1 -1
  6. package/app-archive.js +28 -2
  7. package/app-archive.js.map +1 -1
  8. package/app-archive.mjs +27 -2
  9. package/app-archive.mjs.map +1 -1
  10. package/client.d.mts +1 -0
  11. package/client.d.mts.map +1 -1
  12. package/client.d.ts +1 -0
  13. package/client.d.ts.map +1 -1
  14. package/client.js +1 -0
  15. package/client.js.map +1 -1
  16. package/client.mjs +1 -0
  17. package/client.mjs.map +1 -1
  18. package/exec-client.d.mts +38 -2
  19. package/exec-client.d.mts.map +1 -1
  20. package/exec-client.d.ts +38 -2
  21. package/exec-client.d.ts.map +1 -1
  22. package/exec-client.js +24 -2
  23. package/exec-client.js.map +1 -1
  24. package/exec-client.mjs +23 -2
  25. package/exec-client.mjs.map +1 -1
  26. package/index.d.mts +2 -1
  27. package/index.d.mts.map +1 -1
  28. package/index.d.ts +2 -1
  29. package/index.d.ts.map +1 -1
  30. package/index.js +1 -0
  31. package/index.js.map +1 -1
  32. package/index.mjs +1 -0
  33. package/index.mjs.map +1 -1
  34. package/instance-client.d.mts +2 -0
  35. package/instance-client.d.mts.map +1 -1
  36. package/instance-client.d.ts +2 -0
  37. package/instance-client.d.ts.map +1 -1
  38. package/instance-client.js +6 -2
  39. package/instance-client.js.map +1 -1
  40. package/instance-client.mjs +6 -2
  41. package/instance-client.mjs.map +1 -1
  42. package/internal/result-bundle.d.mts +8 -0
  43. package/internal/result-bundle.d.mts.map +1 -0
  44. package/internal/result-bundle.d.ts +8 -0
  45. package/internal/result-bundle.d.ts.map +1 -0
  46. package/internal/result-bundle.js +32 -0
  47. package/internal/result-bundle.js.map +1 -0
  48. package/internal/result-bundle.mjs +28 -0
  49. package/internal/result-bundle.mjs.map +1 -0
  50. package/ios-client.d.mts +3 -0
  51. package/ios-client.d.mts.map +1 -1
  52. package/ios-client.d.ts +3 -0
  53. package/ios-client.d.ts.map +1 -1
  54. package/ios-client.js +5 -2
  55. package/ios-client.js.map +1 -1
  56. package/ios-client.mjs +5 -2
  57. package/ios-client.mjs.map +1 -1
  58. package/package.json +1 -1
  59. package/resources/android-instances.d.mts +7 -1
  60. package/resources/android-instances.d.mts.map +1 -1
  61. package/resources/android-instances.d.ts +7 -1
  62. package/resources/android-instances.d.ts.map +1 -1
  63. package/resources/daemon-client-shared.d.mts +3 -0
  64. package/resources/daemon-client-shared.d.mts.map +1 -1
  65. package/resources/daemon-client-shared.d.ts +3 -0
  66. package/resources/daemon-client-shared.d.ts.map +1 -1
  67. package/resources/daemon-client-shared.js +2 -0
  68. package/resources/daemon-client-shared.js.map +1 -1
  69. package/resources/daemon-client-shared.mjs +2 -0
  70. package/resources/daemon-client-shared.mjs.map +1 -1
  71. package/resources/gradle-instances-helpers.d.mts +3 -0
  72. package/resources/gradle-instances-helpers.d.mts.map +1 -1
  73. package/resources/gradle-instances-helpers.d.ts +3 -0
  74. package/resources/gradle-instances-helpers.d.ts.map +1 -1
  75. package/resources/gradle-instances-helpers.js +2 -0
  76. package/resources/gradle-instances-helpers.js.map +1 -1
  77. package/resources/gradle-instances-helpers.mjs +2 -0
  78. package/resources/gradle-instances-helpers.mjs.map +1 -1
  79. package/resources/gradle-instances.d.mts +10 -1
  80. package/resources/gradle-instances.d.mts.map +1 -1
  81. package/resources/gradle-instances.d.ts +10 -1
  82. package/resources/gradle-instances.d.ts.map +1 -1
  83. package/resources/index.d.mts +1 -0
  84. package/resources/index.d.mts.map +1 -1
  85. package/resources/index.d.ts +1 -0
  86. package/resources/index.d.ts.map +1 -1
  87. package/resources/index.js +2 -0
  88. package/resources/index.js.map +1 -1
  89. package/resources/index.mjs +1 -0
  90. package/resources/index.mjs.map +1 -1
  91. package/resources/ios-instances.d.mts +7 -1
  92. package/resources/ios-instances.d.mts.map +1 -1
  93. package/resources/ios-instances.d.ts +7 -1
  94. package/resources/ios-instances.d.ts.map +1 -1
  95. package/resources/secrets.d.mts +66 -0
  96. package/resources/secrets.d.mts.map +1 -0
  97. package/resources/secrets.d.ts +66 -0
  98. package/resources/secrets.d.ts.map +1 -0
  99. package/resources/secrets.js +141 -0
  100. package/resources/secrets.js.map +1 -0
  101. package/resources/secrets.mjs +137 -0
  102. package/resources/secrets.mjs.map +1 -0
  103. package/resources/xcode-instances-helpers.d.mts +27 -3
  104. package/resources/xcode-instances-helpers.d.mts.map +1 -1
  105. package/resources/xcode-instances-helpers.d.ts +27 -3
  106. package/resources/xcode-instances-helpers.d.ts.map +1 -1
  107. package/resources/xcode-instances-helpers.js +19 -3
  108. package/resources/xcode-instances-helpers.js.map +1 -1
  109. package/resources/xcode-instances-helpers.mjs +20 -4
  110. package/resources/xcode-instances-helpers.mjs.map +1 -1
  111. package/resources/xcode-instances.d.mts +10 -1
  112. package/resources/xcode-instances.d.mts.map +1 -1
  113. package/resources/xcode-instances.d.ts +10 -1
  114. package/resources/xcode-instances.d.ts.map +1 -1
  115. package/src/app-archive.ts +30 -4
  116. package/src/client.ts +1 -0
  117. package/src/exec-client.ts +57 -5
  118. package/src/index.ts +3 -0
  119. package/src/instance-client.ts +9 -3
  120. package/src/internal/result-bundle.ts +31 -0
  121. package/src/ios-client.ts +23 -10
  122. package/src/resources/android-instances.ts +7 -1
  123. package/src/resources/daemon-client-shared.ts +5 -0
  124. package/src/resources/gradle-instances-helpers.ts +5 -0
  125. package/src/resources/gradle-instances.ts +10 -1
  126. package/src/resources/index.ts +2 -0
  127. package/src/resources/ios-instances.ts +7 -1
  128. package/src/resources/secrets.ts +210 -0
  129. package/src/resources/xcode-instances-helpers.ts +57 -8
  130. package/src/resources/xcode-instances.ts +10 -1
  131. package/src/version.ts +1 -1
  132. package/version.d.mts +1 -1
  133. package/version.d.ts +1 -1
  134. package/version.js +1 -1
  135. package/version.mjs +1 -1
@@ -82,6 +82,9 @@ export namespace GradleInstance {
82
82
 
83
83
  export interface Spec {
84
84
  /** Current effective permissions. Present on live GETs; historical records may omit it. */
85
+ /** Environment variable names mapped to secret TIDs or name/<exact-name> targets. */
86
+ envFromSecret?: Record<string, string>;
87
+ fileFromSecret?: Record<string, string>;
85
88
  role?: { permissions: string[] };
86
89
 
87
90
  inactivityTimeout: string;
@@ -127,7 +130,10 @@ export interface GradleInstanceUpdateParams {
127
130
  /** Replaces all customer labels. Use {} to clear them. Omission preserves labels. */
128
131
  metadata?: { labels: { [key: string]: string } };
129
132
  spec?: {
130
- role: {
133
+ /** Replaces saved bindings. Use {} to clear them. */
134
+ envFromSecret?: Record<string, string>;
135
+ fileFromSecret?: Record<string, string>;
136
+ role?: {
131
137
  /** Replaces the complete list. Use [] to remove delegated permissions. */
132
138
  permissions: string[];
133
139
  };
@@ -166,6 +172,9 @@ export namespace GradleInstanceCreateParams {
166
172
 
167
173
  export interface Spec {
168
174
  /** Inline instance role. Omit for the organization's compatibility default. */
175
+ /** Environment variable names mapped to secret TIDs or name/<exact-name> targets. */
176
+ envFromSecret?: Record<string, string>;
177
+ fileFromSecret?: Record<string, string>;
169
178
  role?: {
170
179
  /** Asset permissions delegated by the creator. An empty array grants nothing. */
171
180
  permissions: Array<string>;
@@ -117,3 +117,5 @@ export {
117
117
  type AccessTokenCreateParams,
118
118
  type AccessTokenRevokeResponse,
119
119
  } from './access-tokens';
120
+
121
+ export * from './secrets';
@@ -81,6 +81,8 @@ export namespace IosInstance {
81
81
 
82
82
  export interface Spec {
83
83
  /** Current effective permissions. Present on live GETs; historical records may omit it. */
84
+ /** Environment variable names mapped to secret TIDs or name/<exact-name> targets. */
85
+ envFromSecret?: Record<string, string>;
84
86
  role?: { permissions: string[] };
85
87
 
86
88
  /**
@@ -162,7 +164,9 @@ export interface IosInstanceUpdateParams {
162
164
  /** Replaces all customer labels. Use {} to clear them. Omission preserves labels. */
163
165
  metadata?: { labels: { [key: string]: string } };
164
166
  spec?: {
165
- role: {
167
+ /** Replaces saved bindings. Use {} to clear them. */
168
+ envFromSecret?: Record<string, string>;
169
+ role?: {
166
170
  /** Replaces the complete list. Use [] to remove delegated permissions. */
167
171
  permissions: string[];
168
172
  };
@@ -201,6 +205,8 @@ export namespace IosInstanceCreateParams {
201
205
 
202
206
  export interface Spec {
203
207
  /** Inline instance role. Omit for the organization's compatibility default. */
208
+ /** Environment variable names mapped to secret TIDs or name/<exact-name> targets. */
209
+ envFromSecret?: Record<string, string>;
204
210
  role?: {
205
211
  /** Asset permissions delegated by the creator. An empty array grants nothing. */
206
212
  permissions: Array<string>;
@@ -0,0 +1,210 @@
1
+ import { APIResource } from '../core/resource';
2
+ import { APIPromise } from '../core/api-promise';
3
+ import { RequestOptions } from '../internal/request-options';
4
+ import { buildHeaders } from '../internal/headers';
5
+ import { getDefaultFetch } from '../internal/shims';
6
+
7
+ /** Descriptive data stored by Limrun. Never put credentials in metadata. */
8
+ export interface SecretMetadata {
9
+ id: string;
10
+ name: string;
11
+ type: string;
12
+ organizationId: string;
13
+ metadata: Record<string, unknown>;
14
+ storageLocation: 'us' | 'eu';
15
+ state: 'pending' | 'ready' | 'deleting';
16
+ createdAt: string;
17
+ }
18
+ export interface SecretCreateParams {
19
+ name: string;
20
+ type: string;
21
+ metadata?: Record<string, unknown>;
22
+ }
23
+ export interface SecretUpdateParams {
24
+ /** Replaces descriptive metadata; does not change the name, type, or value. */
25
+ metadata: Record<string, unknown>;
26
+ }
27
+ export interface SecretListParams {
28
+ nameFilter?: string;
29
+ limit?: number;
30
+ offset?: number;
31
+ }
32
+ export interface SecretListResponse {
33
+ secrets: SecretMetadata[];
34
+ }
35
+ export interface SecretAccessToken {
36
+ accessToken: string;
37
+ expiresAt: string;
38
+ resource: string;
39
+ action: 'read' | 'write';
40
+ }
41
+ export interface SecretRequestOptions extends RequestOptions {
42
+ /** Defaults to the organization returned by whoami. */
43
+ organizationId?: string;
44
+ }
45
+ export interface SecretValueOptions extends RequestOptions {
46
+ /** Transport for direct Google requests, separate from the authenticated Limrun transport. */
47
+ storageFetch?: typeof fetch;
48
+ }
49
+
50
+ const resourcePattern = /^projects\/[a-zA-Z0-9-]+\/secrets\/secret_[0-7][0-9a-hjkmnp-tv-z]{25}$/;
51
+ const maxBytes = 65536;
52
+
53
+ function checksum(bytes: Uint8Array): string {
54
+ let crc = 0xffffffff;
55
+ for (const byte of bytes) {
56
+ crc ^= byte;
57
+ for (let bit = 0; bit < 8; bit++) crc = (crc >>> 1) ^ (crc & 1 ? 0x82f63b78 : 0);
58
+ }
59
+ return String((crc ^ 0xffffffff) >>> 0);
60
+ }
61
+
62
+ export class Secrets extends APIResource {
63
+ /** Create a container. Duplicate names return 409; values are written separately. */
64
+ create(body: SecretCreateParams, options?: RequestOptions): APIPromise<SecretMetadata> {
65
+ return this._client.post('/v1/secrets', { body, ...options });
66
+ }
67
+
68
+ /** Update descriptive metadata by TID or name/<exact name>, without accessing its value. */
69
+ update(target: string, body: SecretUpdateParams, options?: RequestOptions): APIPromise<SecretMetadata> {
70
+ return this._client.patch(`/v1/secrets/${encodeURIComponent(target)}`, { body, ...options });
71
+ }
72
+
73
+ private async collection(
74
+ options: SecretRequestOptions = {},
75
+ ): Promise<{ path: string; options: RequestOptions }> {
76
+ const { organizationId, ...request } = options;
77
+ let org = organizationId;
78
+ if (!org) {
79
+ const identity = await this._client.get<{
80
+ organization?: { id?: string };
81
+ user?: { defaultOrganization?: { id?: string } };
82
+ }>('/v1/whoami', request);
83
+ org = identity.organization?.id ?? identity.user?.defaultOrganization?.id;
84
+ }
85
+ if (!org) throw new Error('No organization found. Provide organizationId explicitly.');
86
+ return { path: `/v1/organizations/${encodeURIComponent(org)}/secrets`, options: request };
87
+ }
88
+
89
+ /** List metadata visible to this credential. Values are never included. */
90
+ async list(query: SecretListParams = {}, options?: SecretRequestOptions): Promise<SecretListResponse> {
91
+ const collection = await this.collection(options);
92
+ return this._client.get(collection.path, { ...collection.options, query });
93
+ }
94
+
95
+ /** Fetch metadata by TID or name/<exact name>. */
96
+ async get(target: string, options?: SecretRequestOptions): Promise<SecretMetadata> {
97
+ if (target.startsWith('name/')) {
98
+ const result = await this.list({ nameFilter: target.slice(5), limit: 1 }, options);
99
+ if (!result.secrets[0]) throw new Error('Secret not found.');
100
+ return result.secrets[0];
101
+ }
102
+ const collection = await this.collection(options);
103
+ return this._client.get(`${collection.path}/${encodeURIComponent(target)}`, collection.options);
104
+ }
105
+
106
+ /** Delete the container and all its versions. */
107
+ async delete(target: string, options?: SecretRequestOptions): Promise<void> {
108
+ const id = target.startsWith('name/') ? (await this.get(target, options)).id : target;
109
+ const collection = await this.collection(options);
110
+ await this._client.delete(`${collection.path}/${encodeURIComponent(id)}`, {
111
+ ...collection.options,
112
+ headers: buildHeaders([{ Accept: '*/*' }, collection.options.headers]),
113
+ });
114
+ }
115
+
116
+ /** Mint access to one secret; no metadata-read permission is needed. */
117
+ createAccessToken(
118
+ target: string,
119
+ action: 'read' | 'write',
120
+ options?: RequestOptions,
121
+ ): APIPromise<SecretAccessToken> {
122
+ // Debug logging must not expose the provider bearer credential.
123
+ return this._client.withOptions({ logLevel: 'off' }).post('/v1/secrets/access_tokens', {
124
+ ...options,
125
+ body: { target, action },
126
+ });
127
+ }
128
+
129
+ private async transfer(
130
+ target: string,
131
+ action: 'read' | 'write',
132
+ bytes: Uint8Array | undefined,
133
+ options: SecretValueOptions = {},
134
+ ): Promise<Response> {
135
+ const { storageFetch = getDefaultFetch(), ...request } = options;
136
+ const timeout = AbortSignal.timeout(options.timeout ?? this._client.timeout);
137
+ const signal = options.signal ? AbortSignal.any([options.signal, timeout]) : timeout;
138
+ const grant = await this.createAccessToken(target, action, { ...request, signal });
139
+ if (
140
+ grant.action !== action ||
141
+ !resourcePattern.test(grant.resource) ||
142
+ (!target.startsWith('name/') && !grant.resource.endsWith(`/${target}`))
143
+ ) {
144
+ throw new Error('Invalid secret access grant.');
145
+ }
146
+ signal.throwIfAborted();
147
+ let response: Response;
148
+ try {
149
+ response = await storageFetch(
150
+ `https://secretmanager.googleapis.com/v1/${grant.resource}${
151
+ action === 'read' ? '/versions/latest:access' : ':addVersion'
152
+ }`,
153
+ {
154
+ method: action === 'read' ? 'GET' : 'POST',
155
+ credentials: 'omit',
156
+ ...{ cache: 'no-store', referrerPolicy: 'no-referrer' },
157
+ redirect: 'error',
158
+ signal,
159
+ headers: {
160
+ Authorization: `Bearer ${grant.accessToken}`,
161
+ ...(bytes ? { 'Content-Type': 'application/json' } : {}),
162
+ },
163
+ ...(bytes ?
164
+ {
165
+ body: JSON.stringify({
166
+ payload: {
167
+ data: btoa(Array.from(bytes, (b) => String.fromCharCode(b)).join('')),
168
+ dataCrc32c: checksum(bytes),
169
+ },
170
+ }),
171
+ }
172
+ : {}),
173
+ },
174
+ );
175
+ } catch {
176
+ throw new Error(
177
+ signal.aborted ? 'Secret storage request was aborted.' : 'Secret storage request failed.',
178
+ );
179
+ }
180
+ // Provider error bodies may echo secret material. Never include them in errors or logs.
181
+ if (!response.ok) throw new Error(`Secret storage request failed (HTTP ${response.status}).`);
182
+ return response;
183
+ }
184
+
185
+ /** Read bytes directly from Google. Does not fetch or cache metadata. */
186
+ async read(target: string, options?: SecretValueOptions): Promise<Uint8Array> {
187
+ const response = await this.transfer(target, 'read', undefined, options);
188
+ let value: { payload?: { data?: string; dataCrc32c?: string } };
189
+ let bytes: Uint8Array;
190
+ try {
191
+ value = (await response.json()) as typeof value;
192
+ if (typeof value.payload?.data !== 'string' || value.payload.data.length > Math.ceil(maxBytes / 3) * 4)
193
+ throw new Error();
194
+ bytes = Uint8Array.from(atob(value.payload.data), (c) => c.charCodeAt(0));
195
+ } catch {
196
+ throw new Error('Secret storage returned an invalid value.');
197
+ }
198
+ if (bytes.length > maxBytes || checksum(bytes) !== String(value.payload?.dataCrc32c))
199
+ throw new Error('Secret integrity check failed.');
200
+ return bytes;
201
+ }
202
+
203
+ /** Add a version directly in Google. Accepts UTF-8 text or binary data, up to 64 KiB. */
204
+ async write(target: string, value: string | Uint8Array, options?: SecretValueOptions): Promise<void> {
205
+ const bytes = typeof value === 'string' ? new TextEncoder().encode(value) : value;
206
+ if (!bytes.length || bytes.length > maxBytes)
207
+ throw new Error('Secret values must contain between 1 byte and 64 KiB.');
208
+ await this.transfer(target, 'write', bytes, options);
209
+ }
210
+ }
@@ -1,5 +1,6 @@
1
1
  import { DeviceDetachUnavailableError } from '../device-detach';
2
2
  import { pullBuildFile } from '../internal/build-pull-file';
3
+ import { pullResultBundle } from '../internal/result-bundle';
3
4
  import { normalizeAssetUpload, type BuildUpload } from '../lib/asset-permissions';
4
5
  import {
5
6
  XcodeInstances as GeneratedXcodeInstances,
@@ -28,6 +29,7 @@ import {
28
29
  } from '../xcode-snapshot';
29
30
  import {
30
31
  exec,
32
+ isTestingAction,
31
33
  observeExecLogs,
32
34
  type AppStoreUploadConfig,
33
35
  type ExecChildProcess,
@@ -128,14 +130,17 @@ export type XcodeProjectConfig = {
128
130
  * test targets and, with a simulator attached, runs them there: per-case
129
131
  * results stream through XcodeBuildOptions.onXctestEvent and accumulate on
130
132
  * ExecResult.xctest, and the exec exits non-zero when tests fail. Requires
131
- * the iphonesimulator sdk. Older limbuild servers reject the field.
133
+ * the iphonesimulator sdk. 'test-without-building' reruns the products the
134
+ * sandbox last built for testing, without syncing or building; it takes only
135
+ * the selection, resultBundle and coverage fields. Older limbuild servers
136
+ * reject the field.
132
137
  */
133
- action?: 'build' | 'build-for-testing';
138
+ action?: 'build' | 'build-for-testing' | 'test-without-building';
134
139
  /**
135
140
  * Run only these tests, in xcodebuild's -only-testing format:
136
141
  * Target[/Class[/method]]. A bare target runs that target unfiltered;
137
142
  * targets named by no entry are skipped. Mutually exclusive with
138
- * skipTesting; only valid with action 'build-for-testing'.
143
+ * skipTesting; only valid with a testing action.
139
144
  */
140
145
  onlyTesting?: string[];
141
146
  /**
@@ -149,6 +154,19 @@ export type XcodeProjectConfig = {
149
154
  * ignore the field and still run the tests.
150
155
  */
151
156
  runTests?: boolean;
157
+ /**
158
+ * Run the tests through Apple's xcodebuild on the attached simulator and
159
+ * keep their result bundle, reported as ExecResult.xctest.resultBundle;
160
+ * fetch it with XcodeClient.pullResultBundle. Needs a testing action and a
161
+ * test run.
162
+ */
163
+ resultBundle?: boolean;
164
+ /**
165
+ * Build with code coverage and collect it into the result bundle, so a run
166
+ * also needs resultBundle. With runTests false the instrumented products
167
+ * wait for a later 'test-without-building' run.
168
+ */
169
+ coverage?: boolean;
152
170
  };
153
171
 
154
172
  export type XcodeGenConfig = {
@@ -275,6 +293,9 @@ export type XcodeBuildOptions = {
275
293
  * silently ignore this option.
276
294
  */
277
295
  env?: string[];
296
+ /** Secret references resolved by the workload; overrides saved bindings for this operation. */
297
+ envFromSecret?: Record<string, string>;
298
+ fileFromSecret?: Record<string, string>;
278
299
  /**
279
300
  * Run `git init` in the synced workspace before project generation,
280
301
  * dependency resolution, and xcodebuild.
@@ -487,6 +508,11 @@ export type RbeBuildSummary = {
487
508
  export type XcodeClient = {
488
509
  /** Stream a regular file to disk. Paths may be absolute or relative to the synced project root. */
489
510
  pullFile(remotePath: string, localPath: string): Promise<void>;
511
+ /**
512
+ * Download a run's result bundle, ExecResult.xctest.resultBundle.path, and
513
+ * unpack it as an `.xcresult` directory at localPath, which must not exist.
514
+ */
515
+ pullResultBundle(remotePath: string, localPath: string): Promise<void>;
490
516
  /** Sync source code to the xcode instance. In watch mode, keeps syncing on changes. */
491
517
  sync: (localCodePath: string, opts?: SyncOptions) => Promise<SyncResult>;
492
518
 
@@ -955,6 +981,13 @@ export class XcodeInstances extends GeneratedXcodeInstances {
955
981
  async pullFile(remotePath: string, localPath: string): Promise<void> {
956
982
  await pullBuildFile(apiUrl, token, remotePath, localPath);
957
983
  },
984
+ async pullResultBundle(remotePath: string, localPath: string): Promise<void> {
985
+ await pullResultBundle(
986
+ (remote, local) => pullBuildFile(apiUrl, token, remote, local),
987
+ remotePath,
988
+ localPath,
989
+ );
990
+ },
958
991
  async sync(localCodePath: string, opts?: SyncOptions): Promise<SyncResult> {
959
992
  const { cacheKey, basisCacheDir } = deriveBasisCache(localCodePath, opts?.basisCacheDir);
960
993
  const codeSyncOpts: FolderSyncOptions = {
@@ -999,15 +1032,29 @@ export class XcodeInstances extends GeneratedXcodeInstances {
999
1032
  if (settings?.onlyTesting?.length && settings?.skipTesting?.length) {
1000
1033
  throw new Error('onlyTesting and skipTesting are mutually exclusive; pass one');
1001
1034
  }
1002
- if (
1003
- (settings?.onlyTesting?.length || settings?.skipTesting?.length) &&
1004
- settings?.action !== 'build-for-testing'
1005
- ) {
1006
- throw new Error("onlyTesting/skipTesting require action: 'build-for-testing'");
1035
+ const testing = isTestingAction(settings?.action);
1036
+ if ((settings?.onlyTesting?.length || settings?.skipTesting?.length) && !testing) {
1037
+ throw new Error(
1038
+ "onlyTesting/skipTesting require action: 'build-for-testing' or 'test-without-building'",
1039
+ );
1007
1040
  }
1008
1041
  if (settings?.runTests === false && settings?.action !== 'build-for-testing') {
1009
1042
  throw new Error("runTests: false requires action: 'build-for-testing'");
1010
1043
  }
1044
+ if ((settings?.resultBundle || settings?.coverage) && !testing) {
1045
+ throw new Error(
1046
+ "resultBundle and coverage require action: 'build-for-testing' or 'test-without-building'",
1047
+ );
1048
+ }
1049
+ if (settings?.resultBundle && settings.runTests === false) {
1050
+ throw new Error('resultBundle needs a test run; it cannot be combined with runTests: false');
1051
+ }
1052
+ // Coverage lands in the result bundle; without a run it builds instrumented products.
1053
+ if (settings?.coverage && settings.runTests !== false && !settings.resultBundle) {
1054
+ throw new Error(
1055
+ 'coverage is collected into the result bundle; set resultBundle too, or runTests: false',
1056
+ );
1057
+ }
1011
1058
  if (
1012
1059
  settings?.action === 'build-for-testing' &&
1013
1060
  settings.sdk !== undefined &&
@@ -1030,6 +1077,8 @@ export class XcodeInstances extends GeneratedXcodeInstances {
1030
1077
  ...(options?.appstore && { testflight: options.appstore }),
1031
1078
  ...(options?.buildSettings && { buildSettings: options.buildSettings }),
1032
1079
  ...(options?.env?.length && { env: options.env }),
1080
+ ...(options?.envFromSecret && { envFromSecret: options.envFromSecret }),
1081
+ ...(options?.fileFromSecret && { fileFromSecret: options.fileFromSecret }),
1033
1082
  ...(options?.gitInit !== undefined && { gitInit: options.gitInit }),
1034
1083
  ...(options?.logProcessor && { logProcessor: options.logProcessor }),
1035
1084
  ...(options?.webhook && { webhook: options.webhook }),
@@ -81,6 +81,9 @@ export namespace XcodeInstance {
81
81
 
82
82
  export interface Spec {
83
83
  /** Current effective permissions. Present on live GETs; historical records may omit it. */
84
+ /** Environment variable names mapped to secret TIDs or name/<exact-name> targets. */
85
+ envFromSecret?: Record<string, string>;
86
+ fileFromSecret?: Record<string, string>;
84
87
  role?: { permissions: string[] };
85
88
 
86
89
  inactivityTimeout: string;
@@ -126,7 +129,10 @@ export interface XcodeInstanceUpdateParams {
126
129
  /** Replaces all customer labels. Use {} to clear them. Omission preserves labels. */
127
130
  metadata?: { labels: { [key: string]: string } };
128
131
  spec?: {
129
- role: {
132
+ /** Replaces saved bindings. Use {} to clear them. */
133
+ envFromSecret?: Record<string, string>;
134
+ fileFromSecret?: Record<string, string>;
135
+ role?: {
130
136
  /** Replaces the complete list. Use [] to remove delegated permissions. */
131
137
  permissions: string[];
132
138
  };
@@ -165,6 +171,9 @@ export namespace XcodeInstanceCreateParams {
165
171
 
166
172
  export interface Spec {
167
173
  /** Inline instance role. Omit for the organization's compatibility default. */
174
+ /** Environment variable names mapped to secret TIDs or name/<exact-name> targets. */
175
+ envFromSecret?: Record<string, string>;
176
+ fileFromSecret?: Record<string, string>;
168
177
  role?: {
169
178
  /** Asset permissions delegated by the creator. An empty array grants nothing. */
170
179
  permissions: Array<string>;
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.70.0'; // x-release-please-version
1
+ export const VERSION = '0.70.2'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.70.0";
1
+ export declare const VERSION = "0.70.2";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.70.0";
1
+ export declare const VERSION = "0.70.2";
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.70.0'; // x-release-please-version
4
+ exports.VERSION = '0.70.2'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.70.0'; // x-release-please-version
1
+ export const VERSION = '0.70.2'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map