@limrun/ui 0.14.0-rc.4 → 0.14.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 (115) hide show
  1. package/README.md +9 -26
  2. package/dist/components/remote-control.d.ts +36 -0
  3. package/dist/index.cjs +1 -1
  4. package/dist/index.d.ts +1 -1
  5. package/dist/index.js +1189 -1089
  6. package/package.json +10 -51
  7. package/src/components/remote-control.tsx +267 -0
  8. package/src/index.ts +1 -1
  9. package/vite.config.ts +0 -9
  10. package/dist/app-store-relay/index.cjs +0 -9
  11. package/dist/app-store-relay/index.d.ts +0 -100
  12. package/dist/app-store-relay/index.js +0 -484
  13. package/dist/app-store-relay/react.cjs +0 -1
  14. package/dist/app-store-relay/react.d.ts +0 -15
  15. package/dist/app-store-relay/react.js +0 -69
  16. package/dist/apple-credentials/index.cjs +0 -1
  17. package/dist/apple-credentials/index.d.ts +0 -59
  18. package/dist/apple-credentials/index.js +0 -227
  19. package/dist/browser-storage-BnO-Ma-e.mjs +0 -219
  20. package/dist/browser-storage-DLxIqZk5.js +0 -1
  21. package/dist/client-D1drDXxE.js +0 -1
  22. package/dist/client-DSuNtWDv.mjs +0 -184
  23. package/dist/core/device-install/apple/client.d.ts +0 -18
  24. package/dist/core/device-install/apple/crypto.d.ts +0 -20
  25. package/dist/core/device-install/apple/gsa-srp.d.ts +0 -26
  26. package/dist/core/device-install/apple/index.d.ts +0 -5
  27. package/dist/core/device-install/apple/provisioning.d.ts +0 -212
  28. package/dist/core/device-install/apple/relay.d.ts +0 -40
  29. package/dist/core/device-install/index.d.ts +0 -4
  30. package/dist/core/device-install/operations/index.d.ts +0 -6
  31. package/dist/core/device-install/operations/limbuild-client.d.ts +0 -43
  32. package/dist/core/device-install/operations/operations.d.ts +0 -47
  33. package/dist/core/device-install/operations/relay-client.d.ts +0 -26
  34. package/dist/core/device-install/operations/relay-protocol.d.ts +0 -27
  35. package/dist/core/device-install/operations/usbmux.d.ts +0 -32
  36. package/dist/core/device-install/operations/webusb.d.ts +0 -21
  37. package/dist/core/device-install/storage/browser-storage.d.ts +0 -56
  38. package/dist/core/device-install/storage/index.d.ts +0 -2
  39. package/dist/core/device-install/storage/secret-store.d.ts +0 -101
  40. package/dist/core/device-install/types.d.ts +0 -57
  41. package/dist/core/errors.d.ts +0 -1
  42. package/dist/core/play-publish/google.d.ts +0 -13
  43. package/dist/core/play-publish/publish.d.ts +0 -34
  44. package/dist/device-build/index.cjs +0 -1
  45. package/dist/device-build/index.d.ts +0 -4
  46. package/dist/device-build/index.js +0 -85
  47. package/dist/device-build/react.cjs +0 -1
  48. package/dist/device-build/react.d.ts +0 -21
  49. package/dist/device-build/react.js +0 -68
  50. package/dist/device-build/signing.d.ts +0 -20
  51. package/dist/device-install/demo/demo.d.ts +0 -0
  52. package/dist/device-install/index.cjs +0 -1
  53. package/dist/device-install/index.d.ts +0 -18
  54. package/dist/device-install/index.js +0 -591
  55. package/dist/device-install/react.cjs +0 -1
  56. package/dist/device-install/react.d.ts +0 -24
  57. package/dist/device-install/react.js +0 -105
  58. package/dist/errors-BSkqS7U-.js +0 -1
  59. package/dist/errors-gy8yQJos.mjs +0 -6
  60. package/dist/gsa-srp-Bme3JLEi.mjs +0 -266
  61. package/dist/gsa-srp-CCIfUz7Y.js +0 -1
  62. package/dist/index-ChhtuQ7e.js +0 -22
  63. package/dist/index-YDu8K9a4.mjs +0 -11279
  64. package/dist/limbuild-client-BagK_FWE.mjs +0 -83
  65. package/dist/limbuild-client-CVDwq54z.js +0 -1
  66. package/dist/play-publish/index.cjs +0 -1
  67. package/dist/play-publish/index.d.ts +0 -2
  68. package/dist/play-publish/index.js +0 -109
  69. package/dist/play-publish/react.cjs +0 -1
  70. package/dist/play-publish/react.d.ts +0 -31
  71. package/dist/play-publish/react.js +0 -91
  72. package/dist/provisioning-B_DefBEp.mjs +0 -239
  73. package/dist/provisioning-BlQMccX_.js +0 -1
  74. package/src/app-store-relay/index.test.ts +0 -60
  75. package/src/app-store-relay/index.ts +0 -511
  76. package/src/app-store-relay/react.ts +0 -131
  77. package/src/apple-credentials/index.test.ts +0 -158
  78. package/src/apple-credentials/index.ts +0 -241
  79. package/src/core/device-install/apple/client.ts +0 -143
  80. package/src/core/device-install/apple/crypto.ts +0 -205
  81. package/src/core/device-install/apple/gsa-srp.ts +0 -123
  82. package/src/core/device-install/apple/index.ts +0 -5
  83. package/src/core/device-install/apple/provisioning.test.ts +0 -84
  84. package/src/core/device-install/apple/provisioning.ts +0 -380
  85. package/src/core/device-install/apple/relay.ts +0 -182
  86. package/src/core/device-install/index.ts +0 -4
  87. package/src/core/device-install/operations/index.ts +0 -6
  88. package/src/core/device-install/operations/limbuild-client.ts +0 -144
  89. package/src/core/device-install/operations/operations.ts +0 -234
  90. package/src/core/device-install/operations/relay-client.ts +0 -286
  91. package/src/core/device-install/operations/relay-protocol.ts +0 -71
  92. package/src/core/device-install/operations/usbmux.ts +0 -270
  93. package/src/core/device-install/operations/webusb-dom.d.ts +0 -54
  94. package/src/core/device-install/operations/webusb.ts +0 -110
  95. package/src/core/device-install/storage/browser-storage.test.ts +0 -65
  96. package/src/core/device-install/storage/browser-storage.ts +0 -325
  97. package/src/core/device-install/storage/index.ts +0 -2
  98. package/src/core/device-install/storage/secret-store.ts +0 -298
  99. package/src/core/device-install/types.ts +0 -69
  100. package/src/core/errors.ts +0 -3
  101. package/src/core/play-publish/google.ts +0 -113
  102. package/src/core/play-publish/publish.test.ts +0 -68
  103. package/src/core/play-publish/publish.ts +0 -89
  104. package/src/device-build/index.ts +0 -42
  105. package/src/device-build/react.ts +0 -130
  106. package/src/device-build/signing.ts +0 -94
  107. package/src/device-install/README.md +0 -423
  108. package/src/device-install/demo/demo.css +0 -493
  109. package/src/device-install/demo/demo.tsx +0 -1061
  110. package/src/device-install/demo/index.html +0 -12
  111. package/src/device-install/index.ts +0 -50
  112. package/src/device-install/react.ts +0 -195
  113. package/src/play-publish/README.md +0 -66
  114. package/src/play-publish/index.ts +0 -12
  115. package/src/play-publish/react.ts +0 -208
@@ -1,57 +0,0 @@
1
- export type DeviceInstallLog = (message: string, detail?: string) => void;
2
- export type DeviceInstallSigningMode = 'development' | 'adhoc';
3
- export type DeviceInstallStep = 'signing' | 'connect' | 'build' | 'install';
4
- export type DeviceInstallStepStatus = 'idle' | 'active' | 'complete' | 'error';
5
- export type DeviceInstallBusyAction = 'signing' | 'usb' | 'pair' | 'build' | 'install';
6
- export type DeviceInstallBuildStatus = 'idle' | 'queued' | 'running' | 'succeeded' | 'failed' | 'cancelled';
7
- export type BuildLogLine = {
8
- type: 'command' | 'stdout' | 'stderr' | 'meta';
9
- data: string;
10
- };
11
- export type DeviceHello = {
12
- serialNumber?: string;
13
- productName?: string;
14
- manufacturerName?: string;
15
- productId: number;
16
- vendorId: number;
17
- };
18
- export type PairRecordPayload = {
19
- udid: string;
20
- pairRecordBase64: string;
21
- };
22
- export type StoredPairRecord = PairRecordPayload & {
23
- productName?: string;
24
- updatedAt: string;
25
- };
26
- export type ProvisioningProfileInfo = {
27
- name?: string;
28
- uuid?: string;
29
- teamID?: string;
30
- applicationIdentifier?: string;
31
- bundleID?: string;
32
- provisionedDevices: string[];
33
- /**
34
- * Serial numbers (uppercase hex, no leading zeros) of the developer
35
- * certificates embedded in the profile; the profile is only usable for
36
- * signing with one of these certificates.
37
- */
38
- certificateSerialNumbers: string[];
39
- getTaskAllow?: boolean;
40
- expirationDate?: string;
41
- };
42
- export type StoredSigningAssets = {
43
- id: string;
44
- deviceUDID?: string;
45
- teamID?: string;
46
- signingMode?: DeviceInstallSigningMode;
47
- bundleID: string;
48
- certificateID?: string;
49
- certificateP12Base64: string;
50
- certificateFileName?: string;
51
- certificatePassword?: string;
52
- provisioningProfileBase64: string;
53
- profileFileName?: string;
54
- profile: ProvisioningProfileInfo;
55
- updatedAt: string;
56
- };
57
- export type PutSigningAssetsInput = Omit<StoredSigningAssets, 'id' | 'updatedAt'>;
@@ -1 +0,0 @@
1
- export declare function errorMessage(error: unknown): string;
@@ -1,13 +0,0 @@
1
- export declare const ANDROID_PUBLISHER_SCOPE = "https://www.googleapis.com/auth/androidpublisher";
2
- export declare function loadGoogleIdentityServices(): Promise<void>;
3
- export type RequestGoogleAccessTokenInput = {
4
- clientId: string;
5
- scope?: string;
6
- };
7
- /**
8
- * Opens the Google consent popup and resolves with a short-lived OAuth
9
- * access token. Call from a user gesture so popup blockers allow it, and
10
- * call loadGoogleIdentityServices beforehand (e.g. when the surrounding
11
- * dialog opens) to keep this call synchronous with the click.
12
- */
13
- export declare function requestGoogleAccessToken(input: RequestGoogleAccessTokenInput): Promise<string>;
@@ -1,34 +0,0 @@
1
- export type PlaystorePublishInput = {
2
- registryApiUrl: string;
3
- /** Limrun API token authenticating the registry call. */
4
- token?: string;
5
- /** Organization tid; required when it differs from the token's default organization. */
6
- organizationId?: string;
7
- /** Google OAuth access token with the androidpublisher scope. Sent per request, never stored. */
8
- accessToken: string;
9
- packageName: string;
10
- assetId?: string;
11
- assetName?: string;
12
- /** Play track ID, defaults to internal on the server. */
13
- track?: string;
14
- /** Required by the server when track is production. */
15
- releaseStatus?: 'draft' | 'completed';
16
- };
17
- export type PlaystorePublishResult = {
18
- versionCode: number;
19
- };
20
- /**
21
- * Registry publish failure. `code` carries the registry's machine-readable
22
- * error code when available: invalidRequest, assetNotFound, internal, busy,
23
- * listingNotFound, permissionDenied, versionCodeExists, uploadKeyMismatch
24
- * or unknown; the set grows additively.
25
- */
26
- export declare class PlaystorePublishError extends Error {
27
- readonly code?: string;
28
- readonly status?: number;
29
- constructor(message: string, options?: {
30
- code?: string;
31
- status?: number;
32
- });
33
- }
34
- export declare function publishToPlaystore(input: PlaystorePublishInput): Promise<PlaystorePublishResult>;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../limbuild-client-CVDwq54z.js");require("../gsa-srp-CCIfUz7Y.js");require("../index-ChhtuQ7e.js");const c=require("../provisioning-BlQMccX_.js"),i=require("../browser-storage-DLxIqZk5.js");async function v({certificateFile:t,provisioningProfileFile:e,certificatePassword:n,bundleId:s,deviceUDID:o,teamId:d,signingMode:f="development",certificateId:p}){const[u,A,r]=await Promise.all([l(t),l(e),i.parseProvisioningProfile(e)]);return g({profile:r,bundleId:s,deviceUDID:o,signingMode:f}),i.putSigningAssets({bundleID:s??r.bundleID??r.applicationIdentifier??e.name,deviceUDID:o,teamID:d??r.teamID,signingMode:f,certificateID:p,certificateP12Base64:u,certificateFileName:t.name,certificatePassword:n||void 0,provisioningProfileBase64:A,profileFileName:e.name,profile:r})}function S(t,e={}){g({profile:t.profile,bundleId:e.bundleId,deviceUDID:e.deviceUDID,signingMode:e.signingMode??t.signingMode})}function g({profile:t,bundleId:e,deviceUDID:n,signingMode:s}){if(e&&!i.profileMatchesBundleID(t,e))throw new Error(`Provisioning profile does not match bundle ID ${e}.`);if(n&&!i.profileContainsDevice(t,n))throw new Error("Provisioning profile does not include the selected iPhone.");if(s==="adhoc"&&t.getTaskAllow)throw new Error("Ad Hoc mode requires an Ad Hoc provisioning profile, not a development profile.")}async function l(t){const e=await t.arrayBuffer();let n="";const s=new Uint8Array(e);for(const o of s)n+=String.fromCharCode(o);return btoa(n)}exports.fetchLimbuildInfo=a.fetchLimbuildInfo;exports.getIOSOTAInstall=a.getIOSOTAInstall;exports.startSignedDeviceBuild=a.startSignedDeviceBuild;exports.watchBuildLogEvents=a.watchBuildLogEvents;exports.getReusableAppleSigningAssets=c.getReusableAppleSigningAssets;exports.putAppleGeneratedSigningAssets=c.putAppleGeneratedSigningAssets;exports.getLatestSigningAssets=i.getLatestSigningAssets;exports.getLatestSigningAssetsWithCertificate=i.getLatestSigningAssetsWithCertificate;exports.getSigningAssets=i.getSigningAssets;exports.parseProvisioningProfile=i.parseProvisioningProfile;exports.parseProvisioningProfileBase64=i.parseProvisioningProfileBase64;exports.parseProvisioningProfileBytes=i.parseProvisioningProfileBytes;exports.profileContainsDevice=i.profileContainsDevice;exports.profileMatchesBundleID=i.profileMatchesBundleID;exports.putSigningAssets=i.putSigningAssets;exports.fileToBase64=l;exports.importSigningAssetsFromFiles=v;exports.validateProvisioningProfileForInstall=g;exports.validateSigningAssetsForInstall=S;
@@ -1,4 +0,0 @@
1
- export { fetchLimbuildInfo, getIOSOTAInstall, startSignedDeviceBuild, watchBuildLogEvents, type BuildLogEventsOptions, type GetIOSOTAInstallOptions, type IOSOTAInstall, type LimbuildInfo, type StartSignedDeviceBuildOptions, } from '../core/device-install/operations/limbuild-client';
2
- export { getLatestSigningAssets, getLatestSigningAssetsWithCertificate, getReusableAppleSigningAssets, getSigningAssets, parseProvisioningProfile, parseProvisioningProfileBase64, parseProvisioningProfileBytes, profileContainsDevice, profileMatchesBundleID, putAppleGeneratedSigningAssets, putSigningAssets, type AppleSigningAssetCacheInput, type PutAppleGeneratedSigningAssetsInput, } from '../core/device-install';
3
- export { fileToBase64, importSigningAssetsFromFiles, validateProvisioningProfileForInstall, validateSigningAssetsForInstall, type ImportSigningAssetsFromFilesInput, type ValidateSigningAssetsOptions, } from './signing';
4
- export type { BuildLogLine, DeviceInstallBuildStatus, DeviceInstallSigningMode, ProvisioningProfileInfo, PutSigningAssetsInput, StoredSigningAssets, } from '../core/device-install/types';
@@ -1,85 +0,0 @@
1
- import { f as B, g as D, s as y, w as x } from "../limbuild-client-BagK_FWE.mjs";
2
- import "../gsa-srp-Bme3JLEi.mjs";
3
- import "../index-YDu8K9a4.mjs";
4
- import { g as E, p as L } from "../provisioning-B_DefBEp.mjs";
5
- import { p as d, a as m, b as u, c as A } from "../browser-storage-BnO-Ma-e.mjs";
6
- import { g as T, d as F, e as H, f as N, h as O } from "../browser-storage-BnO-Ma-e.mjs";
7
- async function I({
8
- certificateFile: i,
9
- provisioningProfileFile: e,
10
- certificatePassword: t,
11
- bundleId: n,
12
- deviceUDID: o,
13
- teamId: g,
14
- signingMode: r = "development",
15
- certificateId: l
16
- }) {
17
- const [c, p, s] = await Promise.all([
18
- a(i),
19
- a(e),
20
- d(e)
21
- ]);
22
- return f({ profile: s, bundleId: n, deviceUDID: o, signingMode: r }), m({
23
- bundleID: n ?? s.bundleID ?? s.applicationIdentifier ?? e.name,
24
- deviceUDID: o,
25
- teamID: g ?? s.teamID,
26
- signingMode: r,
27
- certificateID: l,
28
- certificateP12Base64: c,
29
- certificateFileName: i.name,
30
- certificatePassword: t || void 0,
31
- provisioningProfileBase64: p,
32
- profileFileName: e.name,
33
- profile: s
34
- });
35
- }
36
- function P(i, e = {}) {
37
- f({
38
- profile: i.profile,
39
- bundleId: e.bundleId,
40
- deviceUDID: e.deviceUDID,
41
- signingMode: e.signingMode ?? i.signingMode
42
- });
43
- }
44
- function f({
45
- profile: i,
46
- bundleId: e,
47
- deviceUDID: t,
48
- signingMode: n
49
- }) {
50
- if (e && !u(i, e))
51
- throw new Error(`Provisioning profile does not match bundle ID ${e}.`);
52
- if (t && !A(i, t))
53
- throw new Error("Provisioning profile does not include the selected iPhone.");
54
- if (n === "adhoc" && i.getTaskAllow)
55
- throw new Error("Ad Hoc mode requires an Ad Hoc provisioning profile, not a development profile.");
56
- }
57
- async function a(i) {
58
- const e = await i.arrayBuffer();
59
- let t = "";
60
- const n = new Uint8Array(e);
61
- for (const o of n)
62
- t += String.fromCharCode(o);
63
- return btoa(t);
64
- }
65
- export {
66
- B as fetchLimbuildInfo,
67
- a as fileToBase64,
68
- D as getIOSOTAInstall,
69
- T as getLatestSigningAssets,
70
- F as getLatestSigningAssetsWithCertificate,
71
- E as getReusableAppleSigningAssets,
72
- H as getSigningAssets,
73
- I as importSigningAssetsFromFiles,
74
- d as parseProvisioningProfile,
75
- N as parseProvisioningProfileBase64,
76
- O as parseProvisioningProfileBytes,
77
- A as profileContainsDevice,
78
- u as profileMatchesBundleID,
79
- L as putAppleGeneratedSigningAssets,
80
- m as putSigningAssets,
81
- y as startSignedDeviceBuild,
82
- f as validateProvisioningProfileForInstall,
83
- P as validateSigningAssetsForInstall,
84
- x as watchBuildLogEvents
85
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),f=require("../limbuild-client-CVDwq54z.js");require("../gsa-srp-CCIfUz7Y.js");require("../index-ChhtuQ7e.js");const b=require("../errors-BSkqS7U-.js");function m({apiUrl:s,token:d,signingAssets:g,loadOTAInstall:I=!1}){const[w,c]=e.useState("idle"),[B,a]=e.useState([]),[h,n]=e.useState(),[q,l]=e.useState(),[x,o]=e.useState(),t=e.useRef(void 0);e.useEffect(()=>()=>{t.current?.(),t.current=void 0},[]);const E=e.useCallback(()=>{t.current?.(),t.current=void 0,c("idle"),a([]),n(void 0),l(void 0),o(void 0)},[]),P=e.useCallback(async(S={})=>{if(!s)throw new Error("apiUrl is required to start a device build.");const u=S.signingAssets??g;if(!u)throw new Error("Signing assets are required to start a device build.");t.current?.(),c("queued"),a([]),n(void 0),l(void 0),o(void 0);try{const r=await f.startSignedDeviceBuild({limbuildApiUrl:s,token:d,certificateP12Base64:u.certificateP12Base64,certificatePassword:u.certificatePassword,provisioningProfileBase64:u.provisioningProfileBase64,signedUploadUrl:S.signedUploadUrl});if(!r.execId)throw new Error("Build request did not return an exec ID.");return n(r.execId),t.current=f.watchBuildLogEvents({limbuildApiUrl:s,token:d,execId:r.execId,onLine:i=>a(v=>[...v,i]),onStatus:i=>{c(i),i==="succeeded"&&I&&f.getIOSOTAInstall({limbuildApiUrl:s,token:d,execId:r.execId}).then(l).catch(v=>o(b.errorMessage(v)))},onError:i=>{c("failed"),o(i.message)}}),r.execId}catch(r){c("failed"),o(b.errorMessage(r));return}},[s,I,g,d]);return{status:w,logs:B,execId:h,otaInstall:q,error:x,startBuild:P,reset:E}}exports.useDeviceBuild=m;
@@ -1,21 +0,0 @@
1
- import { BuildLogLine, DeviceInstallBuildStatus, IOSOTAInstall, StoredSigningAssets } from './index';
2
- export type UseDeviceBuildOptions = {
3
- apiUrl?: string;
4
- token?: string;
5
- signingAssets?: StoredSigningAssets;
6
- loadOTAInstall?: boolean;
7
- };
8
- export type StartDeviceBuildInput = {
9
- signingAssets?: StoredSigningAssets;
10
- signedUploadUrl?: string;
11
- };
12
- export type UseDeviceBuildResult = {
13
- status: DeviceInstallBuildStatus;
14
- logs: BuildLogLine[];
15
- execId?: string;
16
- otaInstall?: IOSOTAInstall;
17
- error?: string;
18
- startBuild: (input?: StartDeviceBuildInput) => Promise<string | undefined>;
19
- reset: () => void;
20
- };
21
- export declare function useDeviceBuild({ apiUrl, token, signingAssets, loadOTAInstall, }: UseDeviceBuildOptions): UseDeviceBuildResult;
@@ -1,68 +0,0 @@
1
- import { useState as c, useRef as S, useEffect as A, useCallback as m } from "react";
2
- import { s as q, w as U, g as D } from "../limbuild-client-BagK_FWE.mjs";
3
- import "../gsa-srp-Bme3JLEi.mjs";
4
- import "../index-YDu8K9a4.mjs";
5
- import { e as w } from "../errors-gy8yQJos.mjs";
6
- function M({
7
- apiUrl: i,
8
- token: d,
9
- signingAssets: v,
10
- loadOTAInstall: g = !1
11
- }) {
12
- const [p, s] = c("idle"), [x, n] = c([]), [h, u] = c(), [B, l] = c(), [E, o] = c(), r = S(void 0);
13
- A(() => () => {
14
- r.current?.(), r.current = void 0;
15
- }, []);
16
- const b = m(() => {
17
- r.current?.(), r.current = void 0, s("idle"), n([]), u(void 0), l(void 0), o(void 0);
18
- }, []), P = m(
19
- async (I = {}) => {
20
- if (!i)
21
- throw new Error("apiUrl is required to start a device build.");
22
- const a = I.signingAssets ?? v;
23
- if (!a)
24
- throw new Error("Signing assets are required to start a device build.");
25
- r.current?.(), s("queued"), n([]), u(void 0), l(void 0), o(void 0);
26
- try {
27
- const e = await q({
28
- limbuildApiUrl: i,
29
- token: d,
30
- certificateP12Base64: a.certificateP12Base64,
31
- certificatePassword: a.certificatePassword,
32
- provisioningProfileBase64: a.provisioningProfileBase64,
33
- signedUploadUrl: I.signedUploadUrl
34
- });
35
- if (!e.execId)
36
- throw new Error("Build request did not return an exec ID.");
37
- return u(e.execId), r.current = U({
38
- limbuildApiUrl: i,
39
- token: d,
40
- execId: e.execId,
41
- onLine: (t) => n((f) => [...f, t]),
42
- onStatus: (t) => {
43
- s(t), t === "succeeded" && g && D({ limbuildApiUrl: i, token: d, execId: e.execId }).then(l).catch((f) => o(w(f)));
44
- },
45
- onError: (t) => {
46
- s("failed"), o(t.message);
47
- }
48
- }), e.execId;
49
- } catch (e) {
50
- s("failed"), o(w(e));
51
- return;
52
- }
53
- },
54
- [i, g, v, d]
55
- );
56
- return {
57
- status: p,
58
- logs: x,
59
- execId: h,
60
- otaInstall: B,
61
- error: E,
62
- startBuild: P,
63
- reset: b
64
- };
65
- }
66
- export {
67
- M as useDeviceBuild
68
- };
@@ -1,20 +0,0 @@
1
- import { DeviceInstallSigningMode, StoredSigningAssets } from '../core/device-install/types';
2
- export type ImportSigningAssetsFromFilesInput = {
3
- certificateFile: File;
4
- provisioningProfileFile: File;
5
- certificatePassword?: string;
6
- bundleId?: string;
7
- deviceUDID?: string;
8
- teamId?: string;
9
- signingMode?: DeviceInstallSigningMode;
10
- certificateId?: string;
11
- };
12
- export type ValidateSigningAssetsOptions = {
13
- bundleId?: string;
14
- deviceUDID?: string;
15
- signingMode?: DeviceInstallSigningMode;
16
- };
17
- export declare function importSigningAssetsFromFiles({ certificateFile, provisioningProfileFile, certificatePassword, bundleId, deviceUDID, teamId, signingMode, certificateId, }: ImportSigningAssetsFromFilesInput): Promise<StoredSigningAssets>;
18
- export declare function validateSigningAssetsForInstall(assets: StoredSigningAssets, options?: ValidateSigningAssetsOptions): void;
19
- export declare function validateProvisioningProfileForInstall({ profile, bundleId, deviceUDID, signingMode, }: Pick<StoredSigningAssets, 'profile'> & ValidateSigningAssetsOptions): void;
20
- export declare function fileToBase64(file: File): Promise<string>;
File without changes
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("../errors-BSkqS7U-.js"),b=require("../browser-storage-DLxIqZk5.js"),E=1,d=16,s={DeviceHello:1,OpenStream:2,OpenResult:3,StreamData:4,StreamClose:5,InstallProgress:6,Error:7,Ping:8,Pong:9,StartPairing:10,StartInstall:11,PairRecordReady:12};function W(e){const t=new Uint8Array(d+e.payload.byteLength),r=new DataView(t.buffer);return r.setUint8(0,E),r.setUint8(1,e.type),r.setUint8(2,0),r.setUint8(3,0),r.setUint32(4,e.requestId),r.setUint32(8,e.streamId),r.setUint32(12,e.payload.byteLength),t.set(e.payload,d),t}function B(e){if(e.byteLength<d)throw new Error(`Relay frame too short: ${e.byteLength}`);const t=new DataView(e.buffer,e.byteOffset,e.byteLength),r=t.getUint8(0);if(r!==E)throw new Error(`Unsupported relay protocol version ${r}`);const n=t.getUint32(12);if(e.byteLength!==d+n)throw new Error(`Relay frame length mismatch: got ${e.byteLength}, expected ${d+n}`);return{type:t.getUint8(1),requestId:t.getUint32(4),streamId:t.getUint32(8),payload:e.slice(d)}}function l(e){return new TextEncoder().encode(JSON.stringify(e))}function y(e){return JSON.parse(new TextDecoder().decode(e))}async function F(){if(!navigator.usb)throw new Error("WebUSB is not available in this browser.");return navigator.usb.requestDevice({filters:[{vendorId:1452}]})}function _(e){const t=[],r=e.configuration?.configurationValue,n=e.configurations.find(a=>a.configurationValue===r);n&&t.push(...v(n));for(const a of e.configurations)a.configurationValue!==r&&t.push(...v(a));return t}function v(e){const t=[];for(const r of e.interfaces)for(const n of r.alternates)n.interfaceClass===255&&n.interfaceSubclass===254&&n.interfaceProtocol===2&&t.push({configurationValue:e.configurationValue,interfaceNumber:r.interfaceNumber,alternateSetting:n.alternateSetting,endpoints:n.endpoints});return t}async function M(e,t){e.opened||await e.open(),(!e.configuration||e.configuration.configurationValue!==t.configurationValue)&&await e.selectConfiguration(t.configurationValue),await e.claimInterface(t.interfaceNumber),await e.selectAlternateInterface(t.interfaceNumber,t.alternateSetting)}function j(e){const t=e.endpoints.find(n=>n.direction==="out"&&n.type==="bulk"),r=e.endpoints.find(n=>n.direction==="in"&&n.type==="bulk");if(!t||!r)throw new Error("Could not find usbmux bulk endpoints.");return{outEndpoint:t,inEndpoint:r}}async function k(e,t,r){const n=await e.transferOut(t.endpointNumber,r);if(n.status!=="ok")throw new Error(`USB transferOut failed: ${n.status}`);r.byteLength%t.packetSize===0&&await e.transferOut(t.endpointNumber,new Uint8Array)}async function H(e,t,r=16384){const n=await e.transferIn(t.endpointNumber,r);if(n.status!=="ok"||!n.data)throw new Error(`USB transferIn failed: ${n.status}`);return new Uint8Array(n.data.buffer,n.data.byteOffset,n.data.byteLength)}const I=0,J=2,P=6,z=4277009102,m=2,G=4,f=16,Q=49152;async function Y(e,t){const{inEndpoint:r,outEndpoint:n}=j(t),a=new Uint8Array(12),i=new DataView(a.buffer);i.setUint32(0,2),i.setUint32(4,0),i.setUint32(8,0),await k(e,n,D(I,a));const o=await q(e,r,1),c=new DataView(o.payload.buffer,o.payload.byteOffset).getUint32(0),u={device:e,candidate:t,inEndpoint:r,outEndpoint:n,muxVersion:c,txSeq:0,rxSeq:65535,nextSport:Q,streams:new Map,writeChain:Promise.resolve(),closed:!1};return c>=2&&await O(u,J,new Uint8Array([7])),ee(u),u}async function K(e,t){if(e.closed)throw new Error("usbmux session is closed.");let r,n;const a={session:e,sport:e.nextSport++,dport:t,seq:0,ack:0,queue:[],waiters:[],opened:new Promise((i,o)=>{r=i,n=o}),resolveOpened:r,rejectOpened:n};return e.streams.set(g(t,a.sport),a),await w(a,m,new Uint8Array),await a.opened,a}async function X(e,t){if(e.session.closed)throw new Error("usbmux session is closed.");await w(e,f,t),e.seq+=t.byteLength}async function Z(e){if(e.queue.length>0)return e.queue.shift();if(e.error)throw e.error;return new Promise(t=>{e.waiters.push(t)})}function x(e){e.closed=!0;for(const t of e.streams.values())for(t.error=new Error("usbmux session closed"),t.rejectOpened(t.error);t.waiters.length>0;)t.waiters.shift()(new Uint8Array);e.streams.clear()}async function w(e,t,r){const n=new Uint8Array(20+r.byteLength),a=new DataView(n.buffer);a.setUint16(0,e.sport),a.setUint16(2,e.dport),a.setUint32(4,e.seq),a.setUint32(8,e.ack),a.setUint8(12,80),a.setUint8(13,t),a.setUint16(14,512),n.set(r,20),await O(e.session,P,n)}async function O(e,t,r){if(e.closed)throw new Error("usbmux session is closed.");return e.writeChain=e.writeChain.then(async()=>{if(e.closed)return;const n=e.muxVersion>=2?te(t,r,e.txSeq++,e.rxSeq):D(t,r);await k(e.device,e.outEndpoint,n)}),e.writeChain}async function ee(e){try{for(;;){if(e.closed)return;const t=await q(e.device,e.inEndpoint,e.muxVersion);if(e.closed)return;if(t.rxSeq!==void 0&&(e.rxSeq=t.rxSeq),t.protocol!==P)continue;const r=ne(t.payload),n=e.streams.get(g(r.sport,r.dport));if(n){if(r.flags&G){for(n.error=new Error(`Device reset stream ${n.dport}`),n.rejectOpened(n.error);n.waiters.length>0;)n.waiters.shift()(new Uint8Array);e.streams.delete(g(n.dport,n.sport));continue}if((r.flags&(m|f))===(m|f)){n.seq+=1,n.ack=r.seq+1,await w(n,f,new Uint8Array),n.resolveOpened();continue}r.payload.byteLength!==0&&(n.ack=r.seq+r.payload.byteLength,await w(n,f,new Uint8Array),n.waiters.length>0?n.waiters.shift()(r.payload):n.queue.push(r.payload))}}}catch{e.closed||x(e)}}async function q(e,t,r){for(;;){const n=await H(e,t),a=re(n,r);if(!(r===1&&a.protocol!==I))return a}}function D(e,t){const r=new Uint8Array(8+t.byteLength),n=new DataView(r.buffer);return n.setUint32(0,e),n.setUint32(4,r.byteLength),r.set(t,8),r}function te(e,t,r,n){const a=new Uint8Array(16+t.byteLength),i=new DataView(a.buffer);return i.setUint32(0,e),i.setUint32(4,a.byteLength),i.setUint32(8,z),i.setUint16(12,r),i.setUint16(14,n),a.set(t,16),a}function re(e,t){const r=new DataView(e.buffer,e.byteOffset,e.byteLength),n=r.getUint32(0),a=r.getUint32(4),i=t>=2?16:8;return{protocol:n,length:a,rxSeq:t>=2?r.getUint16(14):void 0,payload:e.slice(i,a)}}function ne(e){const t=new DataView(e.buffer,e.byteOffset,e.byteLength),r=(t.getUint8(12)>>4)*4;return{sport:t.getUint16(0),dport:t.getUint16(2),seq:t.getUint32(4),ack:t.getUint32(8),flags:t.getUint8(13),payload:e.slice(r)}}function g(e,t){return`${e}:${t}`}class ${constructor(t,r,n,a){this.webSocketUrl=t,this.session=r,this.deviceHello=n,this.log=a}socket;streams=new Map;frameQueue=Promise.resolve();closed=!1;pairRecordWaiter;async connect(){const t=new WebSocket(this.webSocketUrl);t.binaryType="arraybuffer",this.socket=t,t.onclose=()=>{this.closed=!0,this.log("Relay socket closed"),this.frameQueue.finally(()=>{this.pairRecordWaiter&&(this.pairRecordWaiter.reject(new Error("Relay socket closed")),this.pairRecordWaiter=void 0)})},await new Promise((r,n)=>{t.onopen=()=>r(),t.onerror=()=>n(new Error("WebSocket connection failed"))}),t.onmessage=r=>{const n=r.data instanceof ArrayBuffer?new Uint8Array(r.data):new Uint8Array;this.enqueueFrame(n)},await this.send({type:s.DeviceHello,requestId:0,streamId:0,payload:l(this.deviceHello)}),this.log("Connected WebSocket relay")}async startPairing(){const t=new Promise((r,n)=>{this.pairRecordWaiter={resolve:r,reject:n}});return await this.send({type:s.StartPairing,requestId:0,streamId:0,payload:l({})}),this.log("Pairing requested"),t}async startInstall(t,r){await this.send({type:s.StartInstall,requestId:0,streamId:0,payload:l({...t,...r})}),this.log("Installation requested")}close(){this.closed=!0,this.socket?.close()}enqueueFrame(t){this.frameQueue=this.frameQueue.then(()=>this.handleFrame(B(t))).catch(r=>{this.log("Relay frame handling failed",r instanceof Error?r.message:String(r))})}async handleFrame(t){switch(t.type){case s.OpenStream:await this.handleOpenStream(t.requestId,t.streamId,y(t.payload).port);break;case s.StreamData:{const r=this.streams.get(t.streamId);if(!r)throw new Error(`Unknown stream ${t.streamId}`);await X(r,t.payload);break}case s.StreamClose:this.streams.delete(t.streamId);break;case s.InstallProgress:this.log(ie(y(t.payload).message));break;case s.Error:this.handleError(t.payload);break;case s.PairRecordReady:this.handlePairRecordReady(y(t.payload));break;case s.Ping:await this.send({type:s.Pong,requestId:t.requestId,streamId:0,payload:new Uint8Array});break}}handleError(t){const r=ae(t);this.log("Server error",r),this.pairRecordWaiter&&(this.pairRecordWaiter.reject(new Error(r)),this.pairRecordWaiter=void 0)}handlePairRecordReady(t){this.log("Pair record received",t.udid),this.pairRecordWaiter?.resolve(t),this.pairRecordWaiter=void 0}async handleOpenStream(t,r,n){try{const a=await K(this.session,n);this.streams.set(r,a),await this.send({type:s.OpenResult,requestId:t,streamId:r,payload:l({ok:!0})}),this.log(`Opened device stream ${r} to port ${n}`),this.pumpDeviceToServer(r,a)}catch(a){this.log(`Open device stream ${r} failed`,a instanceof Error?a.message:String(a)),await this.send({type:s.OpenResult,requestId:t,streamId:r,payload:l({ok:!1,error:a instanceof Error?a.message:String(a)})})}}async pumpDeviceToServer(t,r){try{for(;;){const n=await Z(r);if(this.closed)return;await this.send({type:s.StreamData,requestId:0,streamId:t,payload:n})}}catch(n){this.log(`Device stream ${t} closed`,n instanceof Error?n.message:String(n)),await this.send({type:s.StreamClose,requestId:0,streamId:t,payload:l({reason:n instanceof Error?n.message:String(n)})})}}async send(t){if(!this.closed){if(!this.socket||this.socket.readyState!==WebSocket.OPEN){this.closed=!0;return}this.socket.send(W(t))}}}function ae(e){const t=new TextDecoder().decode(e);try{const r=JSON.parse(t);return R(r.error??t)}catch{return R(t)}}function R(e){return e.replace(/libimobiledevice/g,"").trim()}function ie(e){const t="install status: ";if(!e.startsWith(t))return e;const r=e.slice(t.length),n=p(r,"Error");if(n){const o=p(r,"ErrorDescription");return`Install error: ${n}${o?` — ${o}`:""}`}const a=p(r,"Status")??"Unknown",i=p(r,"PercentComplete");return`Install progress: ${i?`${i}% `:""}${a}`}function p(e,t){const n=new RegExp(`<key>\\s*${oe(t)}\\s*</key>\\s*<(?:string|integer|real)>([\\s\\S]*?)</(?:string|integer|real)>`).exec(e);return n?se(n[1].trim()):void 0}function oe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function se(e){return e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&apos;/g,"'").replace(/&amp;/g,"&")}async function ce({log:e}){e("Selecting USB device");const t=await F(),r=le(t);return e("Selected USB device",`${t.manufacturerName??""} ${t.productName??""} ${t.serialNumber??""}`.trim()),r}async function N({registryApiUrl:e,token:t,organizationId:r,log:n,target:a}){const i=U(e,t,r);let o;try{o=await C(i,a,n);const c=await o.startPairing();return{relay:o,pairRecord:c,target:a}}catch(c){throw o?.close(),c}}async function V({registryApiUrl:e,token:t,organizationId:r,log:n,target:a,pairRecord:i,installSource:o}){const c=U(e,t,r);let u;try{return u=await C(c,a,n),await u.startInstall(i,o),u}catch(T){throw u?.close(),T}}async function A(e,t){if(e){if(e.session&&(x(e.session),e.session=void 0),e.claimedInterfaceNumber!==void 0)try{await e.device.releaseInterface(e.claimedInterfaceNumber),t?.("Released usbmux interface")}catch(r){t?.("USB interface release failed",h.errorMessage(r))}finally{e.claimedInterfaceNumber=void 0}if(e.device.opened)try{await e.device.close(),t?.("Closed USB device")}catch(r){t?.("USB device close failed",h.errorMessage(r))}}}async function C(e,t,r){await ue(t,r);const n=new $(e,t.session,t.hello,r);return await n.connect(),n}async function ue(e,t){if(!e.session)try{e.candidate=await de(e,t),e.session=await Y(e.device,e.candidate),t("Created usbmux session")}catch(r){throw await A(e,t),r}}function le(e){return{device:e,candidate:fe(e),hello:{serialNumber:e.serialNumber,productName:e.productName,manufacturerName:e.manufacturerName,productId:e.productId,vendorId:e.vendorId}}}async function de(e,t){const r=L(e.device);if(r.length===0)throw new Error("No Apple usbmux interface found.");let n;for(const a of r)for(const i of[1,2])try{return e.device.opened||await e.device.open(),t("Claiming usbmux interface",`configuration ${a.configurationValue}, interface ${a.interfaceNumber}, alternate ${a.alternateSetting}, attempt ${i}`),await M(e.device,a),e.claimedInterfaceNumber=a.interfaceNumber,t("Claimed usbmux interface",`configuration ${a.configurationValue}, interface ${a.interfaceNumber}`),a}catch(o){n=o,t("USB interface claim failed",`configuration ${a.configurationValue}, interface ${a.interfaceNumber}: ${h.errorMessage(o)}`),await pe(e),await we(250)}throw n instanceof Error?n:new Error("Unable to claim any Apple usbmux interface.")}function fe(e){const t=L(e)[0];if(!t)throw new Error("No Apple usbmux interface found.");return t}function L(e){const t=_(e),r=e.configuration?.configurationValue;return[...t.filter(n=>n.configurationValue===r),...t.filter(n=>n.configurationValue!==r)]}function U(e,t,r){const n=new URL(e);return n.protocol=n.protocol==="https:"?"wss:":"ws:",n.pathname=`${n.pathname.replace(/\/$/,"")}/ios/device/ws`,t&&n.searchParams.set("token",t),r&&n.searchParams.set("organization",r),n.toString()}async function pe(e){if(e.claimedInterfaceNumber!==void 0){try{await e.device.releaseInterface(e.claimedInterfaceNumber)}catch{}e.claimedInterfaceNumber=void 0}if(e.device.opened)try{await e.device.close()}catch{}}function we(e){return new Promise(t=>setTimeout(t,e))}async function ye(e={}){return ce({log:e.log??S})}async function he(e){return N({...e,log:e.log??S})}async function me(e){return V({...e,log:e.log??S})}function S(){}exports.getPairRecord=b.getPairRecord;exports.normalizeUDID=b.normalizeUDID;exports.putPairRecord=b.putPairRecord;exports.RelayClient=$;exports.closeDeviceRelayTarget=A;exports.deviceRelayWebSocketUrl=U;exports.pairDevice=he;exports.requestUSBAccess=ye;exports.startDeviceInstall=me;exports.startDeviceInstallRelay=V;exports.startDevicePairingRelay=N;
@@ -1,18 +0,0 @@
1
- import { RequestUSBAccessOptions as CoreRequestUSBAccessOptions, StartInstallRelayOptions, StartPairingRelayOptions } from '../core/device-install/operations';
2
- import { DeviceInstallLog } from '../core/device-install/types';
3
- export { closeDeviceRelayTarget, deviceRelayWebSocketUrl, startInstallRelay as startDeviceInstallRelay, startPairingRelay as startDevicePairingRelay, type DeviceRelayTarget, type InstallSource, type StartInstallRelayOptions, type StartPairingRelayOptions, } from '../core/device-install/operations';
4
- export { getPairRecord, normalizeUDID, putPairRecord } from '../core/device-install/storage';
5
- export type { DeviceHello, DeviceInstallLog, PairRecordPayload, StoredPairRecord, } from '../core/device-install/types';
6
- export { RelayClient } from '../core/device-install/operations';
7
- export type RequestUSBAccessOptions = Partial<CoreRequestUSBAccessOptions>;
8
- export declare function requestUSBAccess(options?: RequestUSBAccessOptions): Promise<import('.').DeviceRelayTarget>;
9
- export declare function pairDevice(options: Omit<StartPairingRelayOptions, 'log'> & {
10
- log?: DeviceInstallLog;
11
- }): Promise<{
12
- relay: import('.').RelayClient;
13
- pairRecord: import('.').PairRecordPayload;
14
- target: import('.').DeviceRelayTarget;
15
- }>;
16
- export declare function startDeviceInstall(options: Omit<StartInstallRelayOptions, 'log'> & {
17
- log?: DeviceInstallLog;
18
- }): Promise<import('.').RelayClient>;