@limrun/api 0.76.0-rc.1 → 0.76.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.
- package/CHANGELOG.md +18 -0
- package/client.d.mts +1 -3
- package/client.d.mts.map +1 -1
- package/client.d.ts +1 -3
- package/client.d.ts.map +1 -1
- package/client.js +1 -3
- package/client.js.map +1 -1
- package/client.mjs +1 -3
- package/client.mjs.map +1 -1
- package/exec-client.d.mts +2 -0
- package/exec-client.d.mts.map +1 -1
- package/exec-client.d.ts +2 -0
- package/exec-client.d.ts.map +1 -1
- package/exec-client.js.map +1 -1
- package/exec-client.mjs.map +1 -1
- package/folder-sync.d.mts.map +1 -1
- package/folder-sync.d.ts.map +1 -1
- package/folder-sync.js +91 -62
- package/folder-sync.js.map +1 -1
- package/folder-sync.mjs +91 -62
- package/folder-sync.mjs.map +1 -1
- package/index.d.mts +1 -0
- package/index.d.mts.map +1 -1
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/index.js +4 -2
- package/index.js.map +1 -1
- package/index.mjs +1 -0
- package/index.mjs.map +1 -1
- package/ios-client.d.mts +57 -3
- package/ios-client.d.mts.map +1 -1
- package/ios-client.d.ts +57 -3
- package/ios-client.d.ts.map +1 -1
- package/ios-client.js +21 -0
- package/ios-client.js.map +1 -1
- package/ios-client.mjs +21 -0
- package/ios-client.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/analytics.d.mts +2 -22
- package/resources/analytics.d.mts.map +1 -1
- package/resources/analytics.d.ts +2 -22
- package/resources/analytics.d.ts.map +1 -1
- package/resources/analytics.js.map +1 -1
- package/resources/analytics.mjs.map +1 -1
- package/resources/index.d.mts +1 -1
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +1 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +3 -3
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -1
- package/resources/index.mjs.map +1 -1
- package/resources/ios-instances.d.mts +5 -4
- package/resources/ios-instances.d.mts.map +1 -1
- package/resources/ios-instances.d.ts +5 -4
- package/resources/ios-instances.d.ts.map +1 -1
- package/resources/support-tickets.d.mts +21 -0
- package/resources/support-tickets.d.mts.map +1 -0
- package/resources/support-tickets.d.ts +21 -0
- package/resources/support-tickets.d.ts.map +1 -0
- package/resources/support-tickets.js +19 -0
- package/resources/support-tickets.js.map +1 -0
- package/resources/support-tickets.mjs +15 -0
- package/resources/support-tickets.mjs.map +1 -0
- package/resources/xcode-instances-helpers.d.mts +2 -0
- package/resources/xcode-instances-helpers.d.mts.map +1 -1
- package/resources/xcode-instances-helpers.d.ts +2 -0
- package/resources/xcode-instances-helpers.d.ts.map +1 -1
- package/resources/xcode-instances-helpers.js.map +1 -1
- package/resources/xcode-instances-helpers.mjs.map +1 -1
- package/src/client.ts +1 -19
- package/src/exec-client.ts +2 -0
- package/src/folder-sync.ts +95 -68
- package/src/index.ts +5 -0
- package/src/ios-client.ts +119 -5
- package/src/resources/analytics.ts +2 -22
- package/src/resources/index.ts +1 -8
- package/src/resources/ios-instances.ts +13 -4
- package/src/resources/support-tickets.ts +36 -0
- package/src/resources/xcode-instances-helpers.ts +2 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.mts.map +1 -1
- package/version.d.ts +1 -1
- package/version.d.ts.map +1 -1
- package/version.js +1 -1
- package/version.js.map +1 -1
- package/version.mjs +1 -1
- package/version.mjs.map +1 -1
- package/resources/macos-instances.d.mts +0 -224
- package/resources/macos-instances.d.mts.map +0 -1
- package/resources/macos-instances.d.ts +0 -224
- package/resources/macos-instances.d.ts.map +0 -1
- package/resources/macos-instances.js +0 -51
- package/resources/macos-instances.js.map +0 -1
- package/resources/macos-instances.mjs +0 -47
- package/resources/macos-instances.mjs.map +0 -1
- package/src/resources/macos-instances.ts +0 -296
package/src/client.ts
CHANGED
|
@@ -52,14 +52,6 @@ import {
|
|
|
52
52
|
GradleInstances,
|
|
53
53
|
GradleInstancesItems,
|
|
54
54
|
} from './resources/gradle-instances';
|
|
55
|
-
import {
|
|
56
|
-
MacosInstance,
|
|
57
|
-
MacosInstanceUpdateParams,
|
|
58
|
-
MacosInstanceCreateParams,
|
|
59
|
-
MacosInstanceListParams,
|
|
60
|
-
MacosInstances,
|
|
61
|
-
MacosInstancesItems,
|
|
62
|
-
} from './resources/macos-instances';
|
|
63
55
|
import {
|
|
64
56
|
IosInstance,
|
|
65
57
|
IosInstanceUpdateParams,
|
|
@@ -891,7 +883,7 @@ export class Limrun {
|
|
|
891
883
|
iosSnapshots: API.IOSSnapshots = new API.IOSSnapshots(this);
|
|
892
884
|
gradleSnapshots: API.GradleSnapshots = new API.GradleSnapshots(this);
|
|
893
885
|
gradleInstances: API.GradleInstances = new API.GradleInstances(this);
|
|
894
|
-
|
|
886
|
+
supportTickets: API.SupportTickets = new API.SupportTickets(this);
|
|
895
887
|
analytics: API.Analytics = new API.Analytics(this);
|
|
896
888
|
accessTokens: API.AccessTokens = new API.AccessTokens(this);
|
|
897
889
|
/** @deprecated Use accessTokens. */
|
|
@@ -903,7 +895,6 @@ Limrun.Assets = Assets;
|
|
|
903
895
|
Limrun.IosInstances = IosInstances;
|
|
904
896
|
Limrun.XcodeInstances = XcodeInstances;
|
|
905
897
|
Limrun.GradleInstances = GradleInstances;
|
|
906
|
-
Limrun.MacosInstances = MacosInstances;
|
|
907
898
|
Limrun.Analytics = Analytics;
|
|
908
899
|
Limrun.AccessTokens = AccessTokens;
|
|
909
900
|
Limrun.ScopedTokens = ScopedTokens;
|
|
@@ -980,15 +971,6 @@ export declare namespace Limrun {
|
|
|
980
971
|
type GradleInstanceListParams as GradleInstanceListParams,
|
|
981
972
|
};
|
|
982
973
|
|
|
983
|
-
export {
|
|
984
|
-
MacosInstances as MacosInstances,
|
|
985
|
-
type MacosInstance as MacosInstance,
|
|
986
|
-
type MacosInstancesItems as MacosInstancesItems,
|
|
987
|
-
type MacosInstanceUpdateParams as MacosInstanceUpdateParams,
|
|
988
|
-
type MacosInstanceCreateParams as MacosInstanceCreateParams,
|
|
989
|
-
type MacosInstanceListParams as MacosInstanceListParams,
|
|
990
|
-
};
|
|
991
|
-
|
|
992
974
|
export {
|
|
993
975
|
Analytics as Analytics,
|
|
994
976
|
type AnalyticsInstancesResponse as AnalyticsInstancesResponse,
|
package/src/exec-client.ts
CHANGED
|
@@ -58,6 +58,8 @@ export type XcodeBuildExecRequest = {
|
|
|
58
58
|
sdk?: 'iphonesimulator' | 'iphoneos' | 'watchsimulator' | 'watchos' | 'appletvos' | 'xros';
|
|
59
59
|
configuration?: 'Debug' | 'Release';
|
|
60
60
|
artifactName?: string;
|
|
61
|
+
/** Recompile from a clean build folder for this invocation. */
|
|
62
|
+
clean?: boolean;
|
|
61
63
|
/**
|
|
62
64
|
* xcodebuild action. 'build' (default) produces one .app; with a
|
|
63
65
|
* simulator attached it is installed there. 'build-for-testing' compiles
|
package/src/folder-sync.ts
CHANGED
|
@@ -190,7 +190,10 @@ async function mapLimit<T, R>(items: T[], limit: number, fn: (item: T) => Promis
|
|
|
190
190
|
results[my] = await fn(item);
|
|
191
191
|
}
|
|
192
192
|
});
|
|
193
|
-
|
|
193
|
+
// All writers must finish before the enclosing sync removes its staging directory.
|
|
194
|
+
for (const result of await Promise.allSettled(workers)) {
|
|
195
|
+
if (result.status === 'rejected') throw result.reason;
|
|
196
|
+
}
|
|
194
197
|
return results;
|
|
195
198
|
}
|
|
196
199
|
|
|
@@ -222,16 +225,16 @@ async function httpFolderSyncBatch(
|
|
|
222
225
|
|
|
223
226
|
async function* gen(): AsyncGenerator<Buffer> {
|
|
224
227
|
yield head;
|
|
225
|
-
for (const p of payloadFiles) {
|
|
228
|
+
for (const [index, p] of payloadFiles.entries()) {
|
|
229
|
+
const descriptor = meta.payloads[index]!;
|
|
226
230
|
const fd = await fs.promises.open(p.filePath, 'r');
|
|
227
231
|
try {
|
|
228
|
-
const st = await fd.stat();
|
|
229
232
|
let offset = 0;
|
|
230
|
-
while (offset <
|
|
231
|
-
const len = Math.min(256 * 1024,
|
|
233
|
+
while (offset < descriptor.length) {
|
|
234
|
+
const len = Math.min(256 * 1024, descriptor.length - offset);
|
|
232
235
|
const buf = Buffer.allocUnsafe(len);
|
|
233
236
|
const { bytesRead } = await fd.read(buf, 0, len, offset);
|
|
234
|
-
if (bytesRead
|
|
237
|
+
if (bytesRead === 0) throw new Error(`incomplete staged payload for ${descriptor.path}`);
|
|
235
238
|
offset += bytesRead;
|
|
236
239
|
yield buf.subarray(0, bytesRead);
|
|
237
240
|
}
|
|
@@ -544,30 +547,21 @@ async function cachePut(
|
|
|
544
547
|
cacheRoot: string,
|
|
545
548
|
relPath: string,
|
|
546
549
|
srcFile: string,
|
|
547
|
-
linkTarget
|
|
548
|
-
checkedDirs
|
|
550
|
+
linkTarget: string | undefined,
|
|
551
|
+
checkedDirs: Set<string>,
|
|
549
552
|
): Promise<void> {
|
|
550
553
|
const segments = relPath.split('/');
|
|
551
554
|
const dst = path.join(cacheRoot, segments.join(path.sep));
|
|
552
|
-
//
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
for (let i = 0; i < segments.length - 1; i++) {
|
|
563
|
-
ancestor = path.join(ancestor, segments[i]!);
|
|
564
|
-
if (checkedDirs.has(ancestor)) continue;
|
|
565
|
-
const ast = await fs.promises.lstat(ancestor).catch(() => null);
|
|
566
|
-
if (ast && !ast.isDirectory()) {
|
|
567
|
-
await fs.promises.rm(ancestor, { recursive: true, force: true });
|
|
568
|
-
} else if (ast) {
|
|
569
|
-
checkedDirs.add(ancestor);
|
|
570
|
-
}
|
|
555
|
+
// A previous sync may have stored a file or symlink where we now need a directory.
|
|
556
|
+
let ancestor = cacheRoot;
|
|
557
|
+
for (const segment of segments.slice(0, -1)) {
|
|
558
|
+
ancestor = path.join(ancestor, segment);
|
|
559
|
+
if (checkedDirs.has(ancestor)) continue;
|
|
560
|
+
const st = await fs.promises.lstat(ancestor).catch(() => null);
|
|
561
|
+
if (st && !st.isDirectory()) {
|
|
562
|
+
await fs.promises.rm(ancestor, { recursive: true, force: true });
|
|
563
|
+
} else if (st) {
|
|
564
|
+
checkedDirs.add(ancestor);
|
|
571
565
|
}
|
|
572
566
|
}
|
|
573
567
|
await fs.promises.mkdir(path.dirname(dst), { recursive: true });
|
|
@@ -589,6 +583,23 @@ function cacheGet(cacheRoot: string, relPath: string): string {
|
|
|
589
583
|
return path.join(cacheRoot, relPath.split('/').join(path.sep));
|
|
590
584
|
}
|
|
591
585
|
|
|
586
|
+
// lstat follows intermediate symlinks. A child reached through one belongs to
|
|
587
|
+
// the old link target and cannot serve as a basis for the new directory.
|
|
588
|
+
async function cacheBasisStat(cacheRoot: string, relPath: string, directories: Map<string, boolean>) {
|
|
589
|
+
let ancestor = cacheRoot;
|
|
590
|
+
for (const segment of relPath.split('/').slice(0, -1)) {
|
|
591
|
+
ancestor = path.join(ancestor, segment);
|
|
592
|
+
let isDirectory = directories.get(ancestor);
|
|
593
|
+
if (isDirectory === undefined) {
|
|
594
|
+
const st = await fs.promises.lstat(ancestor).catch(() => null);
|
|
595
|
+
isDirectory = st?.isDirectory() ?? false;
|
|
596
|
+
directories.set(ancestor, isDirectory);
|
|
597
|
+
}
|
|
598
|
+
if (!isDirectory) return null;
|
|
599
|
+
}
|
|
600
|
+
return fs.promises.lstat(cacheGet(cacheRoot, relPath)).catch(() => null);
|
|
601
|
+
}
|
|
602
|
+
|
|
592
603
|
export async function syncFolder(
|
|
593
604
|
localFolderPath: string,
|
|
594
605
|
opts: FolderSyncOptions,
|
|
@@ -701,7 +712,24 @@ async function syncFolderOnce(
|
|
|
701
712
|
localFolderPath: string,
|
|
702
713
|
opts: FolderSyncOptions,
|
|
703
714
|
reason?: string,
|
|
704
|
-
|
|
715
|
+
): Promise<SyncFolderResult> {
|
|
716
|
+
for (let attempt = 0; ; attempt++) {
|
|
717
|
+
const stagingDir = await fs.promises.mkdtemp(path.join(os.tmpdir(), 'limrun-sync-'));
|
|
718
|
+
try {
|
|
719
|
+
return await syncStagedFolder(localFolderPath, opts, stagingDir, reason);
|
|
720
|
+
} catch (err) {
|
|
721
|
+
if (attempt !== 0 || !isENOENT(err)) throw err;
|
|
722
|
+
} finally {
|
|
723
|
+
await fs.promises.rm(stagingDir, { recursive: true, force: true });
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
async function syncStagedFolder(
|
|
729
|
+
localFolderPath: string,
|
|
730
|
+
opts: FolderSyncOptions,
|
|
731
|
+
stagingDir: string,
|
|
732
|
+
reason?: string,
|
|
705
733
|
): Promise<SyncFolderResult> {
|
|
706
734
|
const totalStart = nowMs();
|
|
707
735
|
const log = opts.log ?? noopLogger;
|
|
@@ -724,17 +752,19 @@ async function syncFolderOnce(
|
|
|
724
752
|
let bytesSentDelta = 0;
|
|
725
753
|
let httpSendMsTotal = 0;
|
|
726
754
|
let deltaEncodeMsTotal = 0;
|
|
727
|
-
type EncodedPayload = { payload: FolderSyncHttpPayload; filePath: string
|
|
755
|
+
type EncodedPayload = { payload: FolderSyncHttpPayload; filePath: string };
|
|
728
756
|
|
|
729
757
|
// Build payload list by comparing against local basis cache (single-flight/watch assumes server matches cache).
|
|
730
758
|
// lstat, never stat/existsSync: those follow symlinks and misreport a
|
|
731
759
|
// basis symlink (dangling or pointing at another cached file) as the
|
|
732
760
|
// file itself.
|
|
733
761
|
const encodeLimit = concurrencyLimit();
|
|
762
|
+
const basisDirectories = new Map<string, boolean>();
|
|
734
763
|
const changed: FileEntry[] = [];
|
|
764
|
+
const deltaBasisHashes = new Map<FileEntry, string>();
|
|
735
765
|
for (const f of allFiles) {
|
|
736
766
|
const basisPath = cacheGet(opts.basisCacheDir, f.path);
|
|
737
|
-
const basisStat = await
|
|
767
|
+
const basisStat = await cacheBasisStat(opts.basisCacheDir, f.path, basisDirectories);
|
|
738
768
|
if (!basisStat) {
|
|
739
769
|
changed.push(f);
|
|
740
770
|
continue;
|
|
@@ -756,7 +786,10 @@ async function syncFolderOnce(
|
|
|
756
786
|
}
|
|
757
787
|
const basisSha = await sha256FileHex(basisPath);
|
|
758
788
|
if (basisSha !== f.sha256.toLowerCase()) {
|
|
789
|
+
deltaBasisHashes.set(f, basisSha);
|
|
759
790
|
changed.push(f);
|
|
791
|
+
} else {
|
|
792
|
+
f.size = basisStat.size;
|
|
760
793
|
}
|
|
761
794
|
}
|
|
762
795
|
|
|
@@ -766,13 +799,24 @@ async function syncFolderOnce(
|
|
|
766
799
|
// every path that actually shipped this sync.
|
|
767
800
|
const changedPaths = new Set(changed.map((f) => f.path));
|
|
768
801
|
|
|
802
|
+
// Full uploads, deltas, retries and the next basis must describe the same bytes.
|
|
803
|
+
const staged = new Set<FileEntry>();
|
|
804
|
+
let nextFile = 0;
|
|
805
|
+
async function stage(entry: FileEntry, source: string) {
|
|
806
|
+
const copy = path.join(stagingDir, String(nextFile++));
|
|
807
|
+
await fs.promises.copyFile(source, copy, fs.constants.COPYFILE_FICLONE);
|
|
808
|
+
entry.absPath = copy;
|
|
809
|
+
entry.size = (await fs.promises.stat(copy)).size;
|
|
810
|
+
entry.sha256 = await sha256FileHex(copy);
|
|
811
|
+
staged.add(entry);
|
|
812
|
+
}
|
|
813
|
+
|
|
769
814
|
const encodedPayloads = await mapLimit(changedFiles, encodeLimit, async (f): Promise<EncodedPayload> => {
|
|
770
|
-
|
|
771
|
-
const
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
const
|
|
775
|
-
const tmpDir = await fs.promises.mkdtemp(path.join(os.tmpdir(), 'limulator-xdelta3-'));
|
|
815
|
+
await stage(f, f.absPath);
|
|
816
|
+
const basisSha = deltaBasisHashes.get(f);
|
|
817
|
+
if (basisSha !== undefined && f.size >= MIN_XDELTA_TARGET_BYTES) {
|
|
818
|
+
const basisPath = cacheGet(opts.basisCacheDir, f.path);
|
|
819
|
+
const tmpDir = await fs.promises.mkdtemp(path.join(stagingDir, 'delta-'));
|
|
776
820
|
const patchPath = path.join(tmpDir, 'patch.xdelta3');
|
|
777
821
|
const encodeStart = nowMs();
|
|
778
822
|
const patchSize = await encodeXdelta3Patch(
|
|
@@ -798,7 +842,6 @@ async function syncFolderOnce(
|
|
|
798
842
|
length: patchSize,
|
|
799
843
|
},
|
|
800
844
|
filePath: patchPath,
|
|
801
|
-
cleanupDir: tmpDir,
|
|
802
845
|
};
|
|
803
846
|
}
|
|
804
847
|
// Patch too big, fall back to full
|
|
@@ -848,20 +891,12 @@ async function syncFolderOnce(
|
|
|
848
891
|
|
|
849
892
|
const sendStart = nowMs();
|
|
850
893
|
let resp: FolderSyncHttpResponse;
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
);
|
|
858
|
-
} catch (err) {
|
|
859
|
-
if (attempt < 1 && isENOENT(err)) {
|
|
860
|
-
slog('warn', `sync retrying after missing file during upload (ENOENT)`);
|
|
861
|
-
return await syncFolderOnce(localFolderPath, opts, reason, attempt + 1);
|
|
862
|
-
}
|
|
863
|
-
throw err;
|
|
864
|
-
}
|
|
894
|
+
resp = await httpFolderSyncBatch(
|
|
895
|
+
opts,
|
|
896
|
+
meta,
|
|
897
|
+
encodedPayloads.map((p) => ({ filePath: p.filePath })),
|
|
898
|
+
compression,
|
|
899
|
+
);
|
|
865
900
|
httpSendMsTotal += nowMs() - sendStart;
|
|
866
901
|
|
|
867
902
|
// Retry once if server needs full for some paths (basis mismatch).
|
|
@@ -882,6 +917,12 @@ async function syncFolderOnce(
|
|
|
882
917
|
for (const p of need) {
|
|
883
918
|
const entry = fileMap.get(p);
|
|
884
919
|
if (!entry) continue;
|
|
920
|
+
if (!staged.has(entry)) {
|
|
921
|
+
// The first request declared this file unchanged against our cached basis.
|
|
922
|
+
const expected = entry.sha256;
|
|
923
|
+
await stage(entry, cacheGet(opts.basisCacheDir, entry.path));
|
|
924
|
+
if (entry.sha256 !== expected) throw new Error(`sync basis changed for ${entry.path}; retry sync`);
|
|
925
|
+
}
|
|
885
926
|
// The retry uploads real bytes: count them (and surface large files)
|
|
886
927
|
// exactly like first-pass fulls, or a fresh-daemon resync of a warm
|
|
887
928
|
// cache reports "sent=0B" while gigabytes upload.
|
|
@@ -921,18 +962,6 @@ async function syncFolderOnce(
|
|
|
921
962
|
}
|
|
922
963
|
}
|
|
923
964
|
|
|
924
|
-
// Cleanup patch temp dirs
|
|
925
|
-
await Promise.all(
|
|
926
|
-
encodedPayloads.map(async (p) => {
|
|
927
|
-
if (!p.cleanupDir) return;
|
|
928
|
-
try {
|
|
929
|
-
await fs.promises.rm(p.cleanupDir, { recursive: true, force: true });
|
|
930
|
-
} catch {
|
|
931
|
-
// ignore
|
|
932
|
-
}
|
|
933
|
-
}),
|
|
934
|
-
);
|
|
935
|
-
|
|
936
965
|
// Sync work includes: local hashing + planning + transfers (but excludes finalize/install wait).
|
|
937
966
|
const syncWorkMs = nowMs() - totalStart;
|
|
938
967
|
if (!resp.ok) {
|
|
@@ -954,12 +983,10 @@ async function syncFolderOnce(
|
|
|
954
983
|
if (resp.bundleId) {
|
|
955
984
|
out.installedBundleId = resp.bundleId;
|
|
956
985
|
}
|
|
957
|
-
//
|
|
958
|
-
|
|
959
|
-
// (otherwise the cache never holds a symlink); checkedDirs memoizes ancestors
|
|
960
|
-
// across the sorted walk.
|
|
961
|
-
const checkedDirs = opts.syncSymlinks ? new Set<string>() : undefined;
|
|
986
|
+
// Keep the previous basis intact until the server accepts the new tree.
|
|
987
|
+
const checkedDirs = new Set<string>();
|
|
962
988
|
for (const f of allFiles) {
|
|
989
|
+
if (!changedPaths.has(f.path)) continue;
|
|
963
990
|
await cachePut(opts.basisCacheDir, f.path, f.absPath, f.linkTarget, checkedDirs);
|
|
964
991
|
}
|
|
965
992
|
return out;
|
package/src/index.ts
CHANGED
|
@@ -17,6 +17,11 @@ export {
|
|
|
17
17
|
type SnapshotList,
|
|
18
18
|
type SnapshotListParams,
|
|
19
19
|
} from './resources/snapshots';
|
|
20
|
+
export {
|
|
21
|
+
SupportTickets,
|
|
22
|
+
type SupportTicket,
|
|
23
|
+
type SupportTicketCreateParams,
|
|
24
|
+
} from './resources/support-tickets';
|
|
20
25
|
export { PagePromise } from './core/pagination';
|
|
21
26
|
export * from './instance-client';
|
|
22
27
|
export * as Ios from './ios-client';
|
package/src/ios-client.ts
CHANGED
|
@@ -675,7 +675,7 @@ export type PerformAction =
|
|
|
675
675
|
}
|
|
676
676
|
| { type: 'toggleKeyboard' }
|
|
677
677
|
| { type: 'openUrl'; url: string }
|
|
678
|
-
| { type: 'setOrientation'; orientation:
|
|
678
|
+
| { type: 'setOrientation'; orientation: DeviceOrientation }
|
|
679
679
|
| { type: 'wait'; durationMs: number }
|
|
680
680
|
| {
|
|
681
681
|
type: 'touchDown';
|
|
@@ -713,7 +713,61 @@ export type PerformAction =
|
|
|
713
713
|
| {
|
|
714
714
|
type: 'buttonUp';
|
|
715
715
|
button: 'home' | 'lock' | 'side' | 'applePay' | 'softwareKeyboard' | 'volumeUp' | 'volumeDown' | string;
|
|
716
|
-
}
|
|
716
|
+
}
|
|
717
|
+
/**
|
|
718
|
+
* Press or release any HID usage by page and usage, such as page `0x0C`
|
|
719
|
+
* usage `0x6F` for Brightness Increment. Page `7` usages are keyboard keys.
|
|
720
|
+
* Simulators on Xcode before 27 accept only keyboard usages and the
|
|
721
|
+
* Consumer usages of the buttons above.
|
|
722
|
+
*/
|
|
723
|
+
| { type: 'usageDown'; usagePage: number; usage: number }
|
|
724
|
+
| { type: 'usageUp'; usagePage: number; usage: number };
|
|
725
|
+
|
|
726
|
+
/**
|
|
727
|
+
* A device orientation. `deviceInfo` reports the same names in camelCase.
|
|
728
|
+
* `Landscape` is the older name of `LandscapeRight`.
|
|
729
|
+
*/
|
|
730
|
+
export type DeviceOrientation =
|
|
731
|
+
| 'Portrait'
|
|
732
|
+
| 'PortraitUpsideDown'
|
|
733
|
+
| 'LandscapeLeft'
|
|
734
|
+
| 'LandscapeRight'
|
|
735
|
+
| 'Landscape';
|
|
736
|
+
|
|
737
|
+
/**
|
|
738
|
+
* A privacy service for {@link InstanceClient.setPermission}. Location goes
|
|
739
|
+
* through `simctl privacy` instead.
|
|
740
|
+
*/
|
|
741
|
+
export type PrivacyService =
|
|
742
|
+
| 'calendar'
|
|
743
|
+
| 'camera'
|
|
744
|
+
| 'contacts'
|
|
745
|
+
| 'faceid'
|
|
746
|
+
| 'health'
|
|
747
|
+
| 'homekit'
|
|
748
|
+
| 'medialibrary'
|
|
749
|
+
| 'microphone'
|
|
750
|
+
| 'motion'
|
|
751
|
+
| 'notifications'
|
|
752
|
+
| 'photos'
|
|
753
|
+
| 'reminders'
|
|
754
|
+
| 'siri'
|
|
755
|
+
| 'speech'
|
|
756
|
+
| 'usertracking';
|
|
757
|
+
|
|
758
|
+
/**
|
|
759
|
+
* A privacy decision. `limited` applies only to `photos` and `critical`
|
|
760
|
+
* (critical alerts allowed too) only to `notifications`. `unset` removes the
|
|
761
|
+
* decision, so the app asks again.
|
|
762
|
+
*/
|
|
763
|
+
export type PermissionStatus = 'granted' | 'denied' | 'limited' | 'critical' | 'unset';
|
|
764
|
+
|
|
765
|
+
/** System services {@link InstanceClient.restartServices} can restart. */
|
|
766
|
+
export type RestartableService =
|
|
767
|
+
| 'com.apple.SpringBoard'
|
|
768
|
+
| 'com.apple.locationd'
|
|
769
|
+
| 'com.apple.tccd'
|
|
770
|
+
| 'com.apple.akd';
|
|
717
771
|
|
|
718
772
|
/**
|
|
719
773
|
* Per-action result in a `performActions` batch. `type` identifies which
|
|
@@ -961,11 +1015,39 @@ export type InstanceClient = {
|
|
|
961
1015
|
*/
|
|
962
1016
|
restoreKeychain: (options: { url: string }) => Promise<KeychainRestoreResult>;
|
|
963
1017
|
|
|
1018
|
+
/**
|
|
1019
|
+
* Wipe the simulator keychain. The CA certificates Limrun and you installed
|
|
1020
|
+
* are put back.
|
|
1021
|
+
*/
|
|
1022
|
+
resetKeychain: () => Promise<void>;
|
|
1023
|
+
|
|
1024
|
+
/**
|
|
1025
|
+
* Set an app's privacy permission without a prompt. Setting `notifications`
|
|
1026
|
+
* restarts SpringBoard, which terminates every running app.
|
|
1027
|
+
*/
|
|
1028
|
+
setPermission: (bundleId: string, service: PrivacyService, status: PermissionStatus) => Promise<void>;
|
|
1029
|
+
|
|
1030
|
+
/**
|
|
1031
|
+
* Read an app's privacy permission. `unset` means the app has not asked yet.
|
|
1032
|
+
* The `notifications` permission cannot be read.
|
|
1033
|
+
*/
|
|
1034
|
+
getPermission: (
|
|
1035
|
+
bundleId: string,
|
|
1036
|
+
service: Exclude<PrivacyService, 'notifications'>,
|
|
1037
|
+
) => Promise<PermissionStatus>;
|
|
1038
|
+
|
|
1039
|
+
/**
|
|
1040
|
+
* Restart system services, for example so system prompts pick up a new
|
|
1041
|
+
* language. Restarting SpringBoard terminates every running app; the call
|
|
1042
|
+
* returns once SpringBoard is back.
|
|
1043
|
+
*/
|
|
1044
|
+
restartServices: (services: RestartableService[]) => Promise<void>;
|
|
1045
|
+
|
|
964
1046
|
/**
|
|
965
1047
|
* Set the device orientation
|
|
966
|
-
* @param orientation The orientation to set
|
|
1048
|
+
* @param orientation The orientation to set
|
|
967
1049
|
*/
|
|
968
|
-
setOrientation: (orientation:
|
|
1050
|
+
setOrientation: (orientation: DeviceOrientation) => Promise<void>;
|
|
969
1051
|
/** Returns null for a simulator without a hinge. */
|
|
970
1052
|
getFoldState: () => Promise<FoldState | null>;
|
|
971
1053
|
/** Capture an upright Duo display. A powered-off display returns its native black image. */
|
|
@@ -2333,6 +2415,10 @@ export async function createInstanceClient(options: InstanceClientOptions): Prom
|
|
|
2333
2415
|
bundleId: msg.bundleId || '',
|
|
2334
2416
|
}),
|
|
2335
2417
|
keychainExportResult: () => undefined,
|
|
2418
|
+
resetKeychainResult: () => undefined,
|
|
2419
|
+
setPermissionResult: () => undefined,
|
|
2420
|
+
getPermissionResult: (msg) => (msg as unknown as { status: PermissionStatus }).status,
|
|
2421
|
+
restartServicesResult: () => undefined,
|
|
2336
2422
|
keychainImportResult: (msg): KeychainRestoreResult => ({
|
|
2337
2423
|
durationMs: msg.durationMs ?? 0,
|
|
2338
2424
|
}),
|
|
@@ -2575,6 +2661,10 @@ export async function createInstanceClient(options: InstanceClientOptions): Prom
|
|
|
2575
2661
|
installApp,
|
|
2576
2662
|
saveKeychain,
|
|
2577
2663
|
restoreKeychain,
|
|
2664
|
+
resetKeychain,
|
|
2665
|
+
setPermission,
|
|
2666
|
+
getPermission,
|
|
2667
|
+
restartServices,
|
|
2578
2668
|
setOrientation,
|
|
2579
2669
|
getFoldState,
|
|
2580
2670
|
screenshotDisplay,
|
|
@@ -3032,10 +3122,34 @@ export async function createInstanceClient(options: InstanceClientOptions): Prom
|
|
|
3032
3122
|
return sendRequest('setHingeAngle', { angleDegrees });
|
|
3033
3123
|
};
|
|
3034
3124
|
|
|
3035
|
-
const setOrientation = (orientation:
|
|
3125
|
+
const setOrientation = (orientation: DeviceOrientation): Promise<void> => {
|
|
3036
3126
|
return sendRequest<void>('setOrientation', { orientation });
|
|
3037
3127
|
};
|
|
3038
3128
|
|
|
3129
|
+
const resetKeychain = (): Promise<void> => {
|
|
3130
|
+
return sendRequest<void>('resetKeychain', {}, undefined, 120_000);
|
|
3131
|
+
};
|
|
3132
|
+
|
|
3133
|
+
const setPermission = (
|
|
3134
|
+
bundleId: string,
|
|
3135
|
+
service: PrivacyService,
|
|
3136
|
+
status: PermissionStatus,
|
|
3137
|
+
): Promise<void> => {
|
|
3138
|
+
// A notifications change waits for SpringBoard to restart.
|
|
3139
|
+
return sendRequest<void>('setPermission', { bundleId, service, status }, undefined, 60_000);
|
|
3140
|
+
};
|
|
3141
|
+
|
|
3142
|
+
const getPermission = (
|
|
3143
|
+
bundleId: string,
|
|
3144
|
+
service: Exclude<PrivacyService, 'notifications'>,
|
|
3145
|
+
): Promise<PermissionStatus> => {
|
|
3146
|
+
return sendRequest<PermissionStatus>('getPermission', { bundleId, service });
|
|
3147
|
+
};
|
|
3148
|
+
|
|
3149
|
+
const restartServices = (services: RestartableService[]): Promise<void> => {
|
|
3150
|
+
return sendRequest<void>('restartServices', { services }, undefined, 60_000);
|
|
3151
|
+
};
|
|
3152
|
+
|
|
3039
3153
|
const scroll = (
|
|
3040
3154
|
direction: 'up' | 'down' | 'left' | 'right',
|
|
3041
3155
|
pixels: number,
|
|
@@ -86,7 +86,7 @@ export namespace AnalyticsInstancesResponse {
|
|
|
86
86
|
/**
|
|
87
87
|
* Platform name.
|
|
88
88
|
*/
|
|
89
|
-
platform: 'android' | 'ios' | 'xcode' | 'gradle'
|
|
89
|
+
platform: 'android' | 'ios' | 'xcode' | 'gradle';
|
|
90
90
|
|
|
91
91
|
/**
|
|
92
92
|
* Actual runtime minutes before platform multiplier
|
|
@@ -225,11 +225,6 @@ export namespace AnalyticsResponse {
|
|
|
225
225
|
*/
|
|
226
226
|
ios: { [key: string]: Series.Ios };
|
|
227
227
|
|
|
228
|
-
/**
|
|
229
|
-
* Map of region to analytics stats for macOS. Absent from servers that predate it.
|
|
230
|
-
*/
|
|
231
|
-
macos?: { [key: string]: Series.Macos };
|
|
232
|
-
|
|
233
228
|
/**
|
|
234
229
|
* RFC3339 timestamp for the start of the bucket in the requested timezone,
|
|
235
230
|
* including the local offset
|
|
@@ -336,11 +331,6 @@ export namespace AnalyticsResponse {
|
|
|
336
331
|
wallclockMinutes?: number;
|
|
337
332
|
}
|
|
338
333
|
|
|
339
|
-
/**
|
|
340
|
-
* Analytics for macOS instances in a region, the same shape as Gradle's.
|
|
341
|
-
*/
|
|
342
|
-
export type Macos = Gradle;
|
|
343
|
-
|
|
344
334
|
/**
|
|
345
335
|
* Complete analytics for a specific region including billing breakdown
|
|
346
336
|
*/
|
|
@@ -627,7 +617,7 @@ export namespace AnalyticsResponse {
|
|
|
627
617
|
/**
|
|
628
618
|
* Platform name.
|
|
629
619
|
*/
|
|
630
|
-
platform: 'android' | 'ios' | 'xcode' | 'gradle'
|
|
620
|
+
platform: 'android' | 'ios' | 'xcode' | 'gradle';
|
|
631
621
|
|
|
632
622
|
/**
|
|
633
623
|
* Actual runtime minutes before platform multiplier
|
|
@@ -742,11 +732,6 @@ export namespace AnalyticsResponse {
|
|
|
742
732
|
*/
|
|
743
733
|
ios: { [key: string]: Summary.Ios };
|
|
744
734
|
|
|
745
|
-
/**
|
|
746
|
-
* Map of region to analytics stats for macOS. Absent from servers that predate it.
|
|
747
|
-
*/
|
|
748
|
-
macos?: { [key: string]: Summary.Macos };
|
|
749
|
-
|
|
750
735
|
/**
|
|
751
736
|
* Map of region to analytics stats for Xcode
|
|
752
737
|
*/
|
|
@@ -842,11 +827,6 @@ export namespace AnalyticsResponse {
|
|
|
842
827
|
wallclockMinutes?: number;
|
|
843
828
|
}
|
|
844
829
|
|
|
845
|
-
/**
|
|
846
|
-
* Analytics for macOS instances in a region, the same shape as Gradle's.
|
|
847
|
-
*/
|
|
848
|
-
export type Macos = Gradle;
|
|
849
|
-
|
|
850
830
|
/**
|
|
851
831
|
* Complete analytics for a specific region including billing breakdown
|
|
852
832
|
*/
|
package/src/resources/index.ts
CHANGED
|
@@ -11,6 +11,7 @@ export {
|
|
|
11
11
|
type SnapshotListParams,
|
|
12
12
|
} from './snapshots';
|
|
13
13
|
|
|
14
|
+
export { SupportTickets, type SupportTicket, type SupportTicketCreateParams } from './support-tickets';
|
|
14
15
|
export {
|
|
15
16
|
Analytics,
|
|
16
17
|
type AnalyticsInstancesResponse,
|
|
@@ -44,14 +45,6 @@ export {
|
|
|
44
45
|
type GradleInstanceListParams,
|
|
45
46
|
type GradleInstancesItems,
|
|
46
47
|
} from './gradle-instances';
|
|
47
|
-
export {
|
|
48
|
-
MacosInstances,
|
|
49
|
-
type MacosInstance,
|
|
50
|
-
type MacosInstanceUpdateParams,
|
|
51
|
-
type MacosInstanceCreateParams,
|
|
52
|
-
type MacosInstanceListParams,
|
|
53
|
-
type MacosInstancesItems,
|
|
54
|
-
} from './macos-instances';
|
|
55
48
|
export {
|
|
56
49
|
type IosInstance,
|
|
57
50
|
type IosInstanceUpdateParams,
|
|
@@ -260,11 +260,20 @@ export namespace IosInstanceCreateParams {
|
|
|
260
260
|
|
|
261
261
|
/**
|
|
262
262
|
* The Apple Simulator model. iphone-se is an iPhone SE (3rd generation) and
|
|
263
|
-
* iphone-17e an iPhone 17e, for testing smaller screens.
|
|
263
|
+
* iphone-17e an iPhone 17e, for testing smaller screens. For large App Store
|
|
264
|
+
* screenshots, choose iphone-16-pro-max or ipad-pro-13. iPhone Duo requires
|
|
264
265
|
* Xcode 27.1. See the OSVersion clue for the iOS versions each model runs.
|
|
265
266
|
* Default is iphone.
|
|
266
267
|
*/
|
|
267
|
-
model?:
|
|
268
|
+
model?:
|
|
269
|
+
| 'iphone'
|
|
270
|
+
| 'iphone-se'
|
|
271
|
+
| 'iphone-17e'
|
|
272
|
+
| 'iphone-16-pro-max'
|
|
273
|
+
| 'ipad-pro-13'
|
|
274
|
+
| 'iphone-duo'
|
|
275
|
+
| 'ipad'
|
|
276
|
+
| 'watch';
|
|
268
277
|
|
|
269
278
|
/**
|
|
270
279
|
* Where the instance will be created. If not given, the region is decided based on
|
|
@@ -318,8 +327,8 @@ export namespace IosInstanceCreateParams {
|
|
|
318
327
|
|
|
319
328
|
/**
|
|
320
329
|
* The major version of iOS, "26" or "27". iphone and ipad run both; iphone-se,
|
|
321
|
-
* iphone-17e
|
|
322
|
-
* models that run only 27.
|
|
330
|
+
* iphone-17e, iphone-duo, iphone-16-pro-max and ipad-pro-13 run 27; watch runs 26.
|
|
331
|
+
* Default is 26, or 27 on the models that run only 27.
|
|
323
332
|
*/
|
|
324
333
|
osVersion?: string;
|
|
325
334
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { APIPromise } from '../core/api-promise';
|
|
2
|
+
import { APIResource } from '../core/resource';
|
|
3
|
+
import { buildHeaders } from '../internal/headers';
|
|
4
|
+
import { RequestOptions } from '../internal/request-options';
|
|
5
|
+
import { path } from '../internal/utils/path';
|
|
6
|
+
import { uuid4 } from '../internal/utils/uuid';
|
|
7
|
+
|
|
8
|
+
export interface SupportTicketCreateParams {
|
|
9
|
+
kind: 'ticket' | 'feedback';
|
|
10
|
+
subject: string;
|
|
11
|
+
message: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface SupportTicket {
|
|
15
|
+
id: string;
|
|
16
|
+
organizationId: string;
|
|
17
|
+
kind: string;
|
|
18
|
+
status: string;
|
|
19
|
+
subject: string;
|
|
20
|
+
createdAt: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export class SupportTickets extends APIResource {
|
|
24
|
+
/** Opens a ticket. Pass the same idempotencyKey when retrying the same event. */
|
|
25
|
+
create(
|
|
26
|
+
organizationId: string,
|
|
27
|
+
body: SupportTicketCreateParams,
|
|
28
|
+
options?: RequestOptions,
|
|
29
|
+
): APIPromise<SupportTicket> {
|
|
30
|
+
return this._client.post(path`/v1/organizations/${organizationId}/support_tickets`, {
|
|
31
|
+
...options,
|
|
32
|
+
body,
|
|
33
|
+
headers: buildHeaders([{ 'Idempotency-Key': options?.idempotencyKey ?? uuid4() }, options?.headers]),
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -125,6 +125,8 @@ export type XcodeProjectConfig = {
|
|
|
125
125
|
* discovery picks the wrong bundle.
|
|
126
126
|
*/
|
|
127
127
|
artifactName?: string;
|
|
128
|
+
/** Recompile from a clean build folder for this invocation. */
|
|
129
|
+
clean?: boolean;
|
|
128
130
|
/**
|
|
129
131
|
* xcodebuild action. 'build' (default) produces one .app; with a simulator
|
|
130
132
|
* attached it is installed there. 'build-for-testing' compiles the scheme's
|