@limrun/ui 0.14.0-rc.5 → 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.
- package/README.md +9 -26
- package/dist/components/remote-control.d.ts +36 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1189 -1089
- package/package.json +10 -51
- package/src/components/remote-control.tsx +267 -0
- package/src/index.ts +1 -1
- package/vite.config.ts +0 -9
- package/dist/app-store-relay/index.cjs +0 -9
- package/dist/app-store-relay/index.d.ts +0 -204
- package/dist/app-store-relay/index.js +0 -677
- package/dist/app-store-relay/react.cjs +0 -1
- package/dist/app-store-relay/react.d.ts +0 -15
- package/dist/app-store-relay/react.js +0 -69
- package/dist/apple-credentials/index.cjs +0 -1
- package/dist/apple-credentials/index.d.ts +0 -110
- package/dist/apple-credentials/index.js +0 -291
- package/dist/browser-storage-BnO-Ma-e.mjs +0 -219
- package/dist/browser-storage-DLxIqZk5.js +0 -1
- package/dist/client-C9z_sgOf.js +0 -1
- package/dist/client-CFDB4mX5.mjs +0 -191
- package/dist/core/device-install/apple/client.d.ts +0 -18
- package/dist/core/device-install/apple/crypto.d.ts +0 -20
- package/dist/core/device-install/apple/gsa-srp.d.ts +0 -26
- package/dist/core/device-install/apple/index.d.ts +0 -5
- package/dist/core/device-install/apple/provisioning.d.ts +0 -237
- package/dist/core/device-install/apple/relay.d.ts +0 -53
- package/dist/core/device-install/index.d.ts +0 -4
- package/dist/core/device-install/operations/index.d.ts +0 -6
- package/dist/core/device-install/operations/limbuild-client.d.ts +0 -43
- package/dist/core/device-install/operations/operations.d.ts +0 -47
- package/dist/core/device-install/operations/relay-client.d.ts +0 -26
- package/dist/core/device-install/operations/relay-protocol.d.ts +0 -27
- package/dist/core/device-install/operations/usbmux.d.ts +0 -32
- package/dist/core/device-install/operations/webusb.d.ts +0 -21
- package/dist/core/device-install/storage/browser-storage.d.ts +0 -56
- package/dist/core/device-install/storage/index.d.ts +0 -2
- package/dist/core/device-install/storage/secret-store.d.ts +0 -124
- package/dist/core/device-install/types.d.ts +0 -57
- package/dist/core/errors.d.ts +0 -1
- package/dist/core/play-publish/google.d.ts +0 -13
- package/dist/core/play-publish/publish.d.ts +0 -34
- package/dist/device-build/index.cjs +0 -1
- package/dist/device-build/index.d.ts +0 -4
- package/dist/device-build/index.js +0 -85
- package/dist/device-build/react.cjs +0 -1
- package/dist/device-build/react.d.ts +0 -21
- package/dist/device-build/react.js +0 -68
- package/dist/device-build/signing.d.ts +0 -20
- package/dist/device-install/demo/demo.d.ts +0 -0
- package/dist/device-install/index.cjs +0 -1
- package/dist/device-install/index.d.ts +0 -18
- package/dist/device-install/index.js +0 -594
- package/dist/device-install/react.cjs +0 -1
- package/dist/device-install/react.d.ts +0 -24
- package/dist/device-install/react.js +0 -105
- package/dist/errors-BSkqS7U-.js +0 -1
- package/dist/errors-gy8yQJos.mjs +0 -6
- package/dist/gsa-srp-Bme3JLEi.mjs +0 -266
- package/dist/gsa-srp-CCIfUz7Y.js +0 -1
- package/dist/index-ChhtuQ7e.js +0 -22
- package/dist/index-YDu8K9a4.mjs +0 -11279
- package/dist/limbuild-client-BagK_FWE.mjs +0 -83
- package/dist/limbuild-client-CVDwq54z.js +0 -1
- package/dist/play-publish/index.cjs +0 -1
- package/dist/play-publish/index.d.ts +0 -2
- package/dist/play-publish/index.js +0 -109
- package/dist/play-publish/react.cjs +0 -1
- package/dist/play-publish/react.d.ts +0 -31
- package/dist/play-publish/react.js +0 -91
- package/dist/provisioning-CDPvxd1h.mjs +0 -270
- package/dist/provisioning-CbC4h--7.js +0 -1
- package/src/app-store-relay/index.test.ts +0 -60
- package/src/app-store-relay/index.ts +0 -846
- package/src/app-store-relay/react.ts +0 -131
- package/src/apple-credentials/index.test.ts +0 -180
- package/src/apple-credentials/index.ts +0 -388
- package/src/core/device-install/apple/client.ts +0 -150
- package/src/core/device-install/apple/crypto.ts +0 -205
- package/src/core/device-install/apple/gsa-srp.ts +0 -123
- package/src/core/device-install/apple/index.ts +0 -5
- package/src/core/device-install/apple/provisioning.test.ts +0 -114
- package/src/core/device-install/apple/provisioning.ts +0 -419
- package/src/core/device-install/apple/relay.ts +0 -202
- package/src/core/device-install/index.ts +0 -4
- package/src/core/device-install/operations/index.ts +0 -6
- package/src/core/device-install/operations/limbuild-client.ts +0 -144
- package/src/core/device-install/operations/operations.ts +0 -239
- package/src/core/device-install/operations/relay-client.ts +0 -286
- package/src/core/device-install/operations/relay-protocol.ts +0 -71
- package/src/core/device-install/operations/usbmux.ts +0 -270
- package/src/core/device-install/operations/webusb-dom.d.ts +0 -54
- package/src/core/device-install/operations/webusb.ts +0 -110
- package/src/core/device-install/storage/browser-storage.test.ts +0 -65
- package/src/core/device-install/storage/browser-storage.ts +0 -325
- package/src/core/device-install/storage/index.ts +0 -2
- package/src/core/device-install/storage/secret-store.ts +0 -332
- package/src/core/device-install/types.ts +0 -69
- package/src/core/errors.ts +0 -3
- package/src/core/play-publish/google.ts +0 -113
- package/src/core/play-publish/publish.test.ts +0 -68
- package/src/core/play-publish/publish.ts +0 -89
- package/src/device-build/index.ts +0 -42
- package/src/device-build/react.ts +0 -130
- package/src/device-build/signing.ts +0 -94
- package/src/device-install/README.md +0 -423
- package/src/device-install/demo/demo.css +0 -493
- package/src/device-install/demo/demo.tsx +0 -1061
- package/src/device-install/demo/index.html +0 -12
- package/src/device-install/index.ts +0 -50
- package/src/device-install/react.ts +0 -195
- package/src/play-publish/README.md +0 -66
- package/src/play-publish/index.ts +0 -12
- package/src/play-publish/react.ts +0 -208
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
async function u(r, t) {
|
|
2
|
-
const n = new URL(`${r}/info`);
|
|
3
|
-
t && n.searchParams.set("token", t);
|
|
4
|
-
const e = await fetch(n.toString(), {
|
|
5
|
-
headers: t ? { Authorization: `Bearer ${t}` } : void 0
|
|
6
|
-
});
|
|
7
|
-
if (!e.ok) {
|
|
8
|
-
const s = await e.text();
|
|
9
|
-
throw new Error(`Info request failed: HTTP ${e.status} ${s}`);
|
|
10
|
-
}
|
|
11
|
-
return await e.json();
|
|
12
|
-
}
|
|
13
|
-
async function l({
|
|
14
|
-
limbuildApiUrl: r,
|
|
15
|
-
token: t,
|
|
16
|
-
certificateP12Base64: n,
|
|
17
|
-
certificatePassword: e,
|
|
18
|
-
provisioningProfileBase64: s,
|
|
19
|
-
signedUploadUrl: i
|
|
20
|
-
}) {
|
|
21
|
-
const d = new URL(`${r}/exec`);
|
|
22
|
-
t && d.searchParams.set("token", t);
|
|
23
|
-
const a = await fetch(d.toString(), {
|
|
24
|
-
method: "POST",
|
|
25
|
-
headers: {
|
|
26
|
-
"Content-Type": "application/json",
|
|
27
|
-
...t ? { Authorization: `Bearer ${t}` } : {}
|
|
28
|
-
},
|
|
29
|
-
body: JSON.stringify({
|
|
30
|
-
command: "xcodebuild",
|
|
31
|
-
xcodebuild: { sdk: "iphoneos" },
|
|
32
|
-
...i ? { signedUploadUrl: i } : {},
|
|
33
|
-
signing: {
|
|
34
|
-
certificateP12Base64: n,
|
|
35
|
-
...e ? { certificatePassword: e } : {},
|
|
36
|
-
provisioningProfileBase64: s
|
|
37
|
-
}
|
|
38
|
-
})
|
|
39
|
-
});
|
|
40
|
-
if (!a.ok) {
|
|
41
|
-
const o = await a.text();
|
|
42
|
-
throw new Error(`Build request failed: HTTP ${a.status} ${o}`);
|
|
43
|
-
}
|
|
44
|
-
return await a.json();
|
|
45
|
-
}
|
|
46
|
-
async function f({ limbuildApiUrl: r, execId: t, token: n }) {
|
|
47
|
-
const e = new URL(`${r}/exec/${encodeURIComponent(t)}/ios/ota`);
|
|
48
|
-
n && e.searchParams.set("token", n);
|
|
49
|
-
const s = await fetch(e.toString(), {
|
|
50
|
-
headers: n ? { Authorization: `Bearer ${n}` } : void 0
|
|
51
|
-
});
|
|
52
|
-
if (!s.ok) {
|
|
53
|
-
const i = await s.text();
|
|
54
|
-
throw new Error(`OTA install metadata failed: HTTP ${s.status} ${i}`);
|
|
55
|
-
}
|
|
56
|
-
return await s.json();
|
|
57
|
-
}
|
|
58
|
-
function w({
|
|
59
|
-
limbuildApiUrl: r,
|
|
60
|
-
execId: t,
|
|
61
|
-
token: n,
|
|
62
|
-
onLine: e,
|
|
63
|
-
onStatus: s,
|
|
64
|
-
onError: i
|
|
65
|
-
}) {
|
|
66
|
-
const d = new URL(`${r}/exec/${t}/events`);
|
|
67
|
-
n && d.searchParams.set("token", n);
|
|
68
|
-
const a = new EventSource(d.toString());
|
|
69
|
-
return s("running"), a.addEventListener("command", (o) => e({ type: "command", data: o.data })), a.addEventListener("stdout", (o) => e({ type: "stdout", data: o.data })), a.addEventListener("stderr", (o) => e({ type: "stderr", data: o.data })), a.addEventListener("exitCode", (o) => {
|
|
70
|
-
const c = parseInt(o.data, 10);
|
|
71
|
-
s(
|
|
72
|
-
c === 0 ? "succeeded" : c < 0 ? "cancelled" : "failed"
|
|
73
|
-
), a.close();
|
|
74
|
-
}), a.onerror = () => {
|
|
75
|
-
a.close(), s("failed"), i?.(new Error("Build log stream closed before completion."));
|
|
76
|
-
}, () => a.close();
|
|
77
|
-
}
|
|
78
|
-
export {
|
|
79
|
-
u as f,
|
|
80
|
-
f as g,
|
|
81
|
-
l as s,
|
|
82
|
-
w
|
|
83
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";async function u(r,t){const n=new URL(`${r}/info`);t&&n.searchParams.set("token",t);const e=await fetch(n.toString(),{headers:t?{Authorization:`Bearer ${t}`}:void 0});if(!e.ok){const s=await e.text();throw new Error(`Info request failed: HTTP ${e.status} ${s}`)}return await e.json()}async function l({limbuildApiUrl:r,token:t,certificateP12Base64:n,certificatePassword:e,provisioningProfileBase64:s,signedUploadUrl:i}){const d=new URL(`${r}/exec`);t&&d.searchParams.set("token",t);const a=await fetch(d.toString(),{method:"POST",headers:{"Content-Type":"application/json",...t?{Authorization:`Bearer ${t}`}:{}},body:JSON.stringify({command:"xcodebuild",xcodebuild:{sdk:"iphoneos"},...i?{signedUploadUrl:i}:{},signing:{certificateP12Base64:n,...e?{certificatePassword:e}:{},provisioningProfileBase64:s}})});if(!a.ok){const o=await a.text();throw new Error(`Build request failed: HTTP ${a.status} ${o}`)}return await a.json()}async function f({limbuildApiUrl:r,execId:t,token:n}){const e=new URL(`${r}/exec/${encodeURIComponent(t)}/ios/ota`);n&&e.searchParams.set("token",n);const s=await fetch(e.toString(),{headers:n?{Authorization:`Bearer ${n}`}:void 0});if(!s.ok){const i=await s.text();throw new Error(`OTA install metadata failed: HTTP ${s.status} ${i}`)}return await s.json()}function h({limbuildApiUrl:r,execId:t,token:n,onLine:e,onStatus:s,onError:i}){const d=new URL(`${r}/exec/${t}/events`);n&&d.searchParams.set("token",n);const a=new EventSource(d.toString());return s("running"),a.addEventListener("command",o=>e({type:"command",data:o.data})),a.addEventListener("stdout",o=>e({type:"stdout",data:o.data})),a.addEventListener("stderr",o=>e({type:"stderr",data:o.data})),a.addEventListener("exitCode",o=>{const c=parseInt(o.data,10);s(c===0?"succeeded":c<0?"cancelled":"failed"),a.close()}),a.onerror=()=>{a.close(),s("failed"),i?.(new Error("Build log stream closed before completion."))},()=>a.close()}exports.fetchLimbuildInfo=u;exports.getIOSOTAInstall=f;exports.startSignedDeviceBuild=l;exports.watchBuildLogEvents=h;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f="https://accounts.google.com/gsi/client",w="https://www.googleapis.com/auth/androidpublisher";function u(){return globalThis.google?.accounts?.oauth2}let c;function y(){return u()?Promise.resolve():typeof document>"u"?Promise.reject(new Error("Google sign-in requires a browser environment.")):(c||(c=new Promise((o,r)=>{const t=document.createElement("script");t.src=f,t.async=!0,t.addEventListener("load",()=>{u()?o():r(new Error("Google sign-in script loaded without the OAuth client."))},{once:!0}),t.addEventListener("error",()=>{t.remove(),r(new Error("Failed to load the Google sign-in script."))},{once:!0}),document.head.appendChild(t)}),c.catch(()=>{c=void 0})),c)}function m(o){return u()?p(o):y().then(()=>p(o))}function p({clientId:o,scope:r=w}){return new Promise((t,n)=>{u().initTokenClient({client_id:o,scope:r,callback:e=>{if(e.error){n(new Error(e.error_description||e.error));return}if(!e.access_token){n(new Error("Google returned no access token."));return}t(e.access_token)},error_callback:e=>{const a=e?.type==="popup_failed_to_open"?"Google sign-in popup was blocked by the browser.":"Google sign-in was cancelled.";n(new Error(e?.message||a))}}).requestAccessToken()})}class l extends Error{code;status;constructor(r,t={}){super(r),this.name="PlaystorePublishError",this.code=t.code,this.status=t.status}}async function b(o){const{registryApiUrl:r,token:t,organizationId:n,...h}=o;let e;try{e=new URL(r)}catch{throw new l(`Invalid registry URL: ${r}`)}e.pathname=`${e.pathname.replace(/\/$/,"")}/android/playstore/publish`,e.search="",e.hash="";const a={"Content-Type":"application/json"};t&&(a.Authorization=`Bearer ${t}`),n&&(a["X-Limrun-Organization"]=n);let s;try{s=await fetch(e.toString(),{method:"POST",headers:a,body:JSON.stringify(h)})}catch(d){throw new l(`Cannot reach the registry: ${d instanceof Error?d.message:String(d)}`)}const g=await s.text();let i;try{i=g?JSON.parse(g):void 0}catch{i=void 0}if(!s.ok)throw new l(i?.message||`Play publish failed with HTTP ${s.status}`,{code:i?.code,status:s.status});if(typeof i?.versionCode!="number")throw new l("Play publish response is missing versionCode.",{status:s.status});return{versionCode:i.versionCode}}exports.ANDROID_PUBLISHER_SCOPE=w;exports.PlaystorePublishError=l;exports.loadGoogleIdentityServices=y;exports.publishToPlaystore=b;exports.requestGoogleAccessToken=m;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export { ANDROID_PUBLISHER_SCOPE, loadGoogleIdentityServices, requestGoogleAccessToken, type RequestGoogleAccessTokenInput, } from '../core/play-publish/google';
|
|
2
|
-
export { publishToPlaystore, PlaystorePublishError, type PlaystorePublishInput, type PlaystorePublishResult, } from '../core/play-publish/publish';
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
const w = "https://accounts.google.com/gsi/client", f = "https://www.googleapis.com/auth/androidpublisher";
|
|
2
|
-
function u() {
|
|
3
|
-
return globalThis.google?.accounts?.oauth2;
|
|
4
|
-
}
|
|
5
|
-
let c;
|
|
6
|
-
function y() {
|
|
7
|
-
return u() ? Promise.resolve() : typeof document > "u" ? Promise.reject(new Error("Google sign-in requires a browser environment.")) : (c || (c = new Promise((o, r) => {
|
|
8
|
-
const t = document.createElement("script");
|
|
9
|
-
t.src = w, t.async = !0, t.addEventListener(
|
|
10
|
-
"load",
|
|
11
|
-
() => {
|
|
12
|
-
u() ? o() : r(new Error("Google sign-in script loaded without the OAuth client."));
|
|
13
|
-
},
|
|
14
|
-
{ once: !0 }
|
|
15
|
-
), t.addEventListener(
|
|
16
|
-
"error",
|
|
17
|
-
() => {
|
|
18
|
-
t.remove(), r(new Error("Failed to load the Google sign-in script."));
|
|
19
|
-
},
|
|
20
|
-
{ once: !0 }
|
|
21
|
-
), document.head.appendChild(t);
|
|
22
|
-
}), c.catch(() => {
|
|
23
|
-
c = void 0;
|
|
24
|
-
})), c);
|
|
25
|
-
}
|
|
26
|
-
function m(o) {
|
|
27
|
-
return u() ? p(o) : y().then(() => p(o));
|
|
28
|
-
}
|
|
29
|
-
function p({
|
|
30
|
-
clientId: o,
|
|
31
|
-
scope: r = f
|
|
32
|
-
}) {
|
|
33
|
-
return new Promise((t, n) => {
|
|
34
|
-
u().initTokenClient({
|
|
35
|
-
client_id: o,
|
|
36
|
-
scope: r,
|
|
37
|
-
callback: (e) => {
|
|
38
|
-
if (e.error) {
|
|
39
|
-
n(new Error(e.error_description || e.error));
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
if (!e.access_token) {
|
|
43
|
-
n(new Error("Google returned no access token."));
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
t(e.access_token);
|
|
47
|
-
},
|
|
48
|
-
error_callback: (e) => {
|
|
49
|
-
const a = e?.type === "popup_failed_to_open" ? "Google sign-in popup was blocked by the browser." : "Google sign-in was cancelled.";
|
|
50
|
-
n(new Error(e?.message || a));
|
|
51
|
-
}
|
|
52
|
-
}).requestAccessToken();
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
class l extends Error {
|
|
56
|
-
code;
|
|
57
|
-
status;
|
|
58
|
-
constructor(r, t = {}) {
|
|
59
|
-
super(r), this.name = "PlaystorePublishError", this.code = t.code, this.status = t.status;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
async function b(o) {
|
|
63
|
-
const { registryApiUrl: r, token: t, organizationId: n, ...h } = o;
|
|
64
|
-
let e;
|
|
65
|
-
try {
|
|
66
|
-
e = new URL(r);
|
|
67
|
-
} catch {
|
|
68
|
-
throw new l(`Invalid registry URL: ${r}`);
|
|
69
|
-
}
|
|
70
|
-
e.pathname = `${e.pathname.replace(/\/$/, "")}/android/playstore/publish`, e.search = "", e.hash = "";
|
|
71
|
-
const a = { "Content-Type": "application/json" };
|
|
72
|
-
t && (a.Authorization = `Bearer ${t}`), n && (a["X-Limrun-Organization"] = n);
|
|
73
|
-
let s;
|
|
74
|
-
try {
|
|
75
|
-
s = await fetch(e.toString(), {
|
|
76
|
-
method: "POST",
|
|
77
|
-
headers: a,
|
|
78
|
-
body: JSON.stringify(h)
|
|
79
|
-
});
|
|
80
|
-
} catch (d) {
|
|
81
|
-
throw new l(
|
|
82
|
-
`Cannot reach the registry: ${d instanceof Error ? d.message : String(d)}`
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
|
-
const g = await s.text();
|
|
86
|
-
let i;
|
|
87
|
-
try {
|
|
88
|
-
i = g ? JSON.parse(g) : void 0;
|
|
89
|
-
} catch {
|
|
90
|
-
i = void 0;
|
|
91
|
-
}
|
|
92
|
-
if (!s.ok)
|
|
93
|
-
throw new l(i?.message || `Play publish failed with HTTP ${s.status}`, {
|
|
94
|
-
code: i?.code,
|
|
95
|
-
status: s.status
|
|
96
|
-
});
|
|
97
|
-
if (typeof i?.versionCode != "number")
|
|
98
|
-
throw new l("Play publish response is missing versionCode.", {
|
|
99
|
-
status: s.status
|
|
100
|
-
});
|
|
101
|
-
return { versionCode: i.versionCode };
|
|
102
|
-
}
|
|
103
|
-
export {
|
|
104
|
-
f as ANDROID_PUBLISHER_SCOPE,
|
|
105
|
-
l as PlaystorePublishError,
|
|
106
|
-
y as loadGoogleIdentityServices,
|
|
107
|
-
b as publishToPlaystore,
|
|
108
|
-
m as requestGoogleAccessToken
|
|
109
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),I=require("../errors-BSkqS7U-.js"),d=require("./index.cjs");function N({registryApiUrl:f,token:h,organizationId:y,googleClientId:g}){const[k,t]=e.useState("idle"),[S,M]=e.useState(),[P,l]=e.useState(),[T,n]=e.useState(),[p,i]=e.useState(),v=e.useRef(void 0),s=e.useRef(0),a=e.useRef(!1),C=e.useCallback(()=>d.loadGoogleIdentityServices().then(()=>!0,()=>!1),[]),b=e.useCallback(r=>{n(r),i(void 0),l(void 0),t("error")},[]),R=e.useCallback(async()=>{if(a.current)return!1;if(!g)return b("Google OAuth client ID is not configured."),!1;a.current=!0;const r=s.current;t("signing-in"),n(void 0),i(void 0);try{const o=await d.requestGoogleAccessToken({clientId:g});return v.current=o,M(o),r===s.current?t("ready"):t(u=>u==="idle"?"ready":u),!0}catch(o){return r===s.current&&(n(I.errorMessage(o)),t("error")),!1}finally{a.current=!1}},[g]),G=e.useCallback(async r=>{if(a.current)return;if(!f){b("Registry URL is not configured.");return}const o=v.current;if(!o){b("Sign in with Google before publishing.");return}a.current=!0;const u=s.current;t("publishing"),n(void 0),i(void 0),l(void 0);try{const c=await d.publishToPlaystore({registryApiUrl:f,token:h,organizationId:y,accessToken:o,packageName:r.packageName,assetId:r.assetId,assetName:r.assetName,track:r.track,releaseStatus:r.releaseStatus});return u===s.current&&(l(c.versionCode),t("published")),c}catch(c){u===s.current&&(n(I.errorMessage(c)),c instanceof d.PlaystorePublishError&&i(c.code),t("error"));return}finally{a.current=!1}},[f,h,y]),m=e.useCallback(()=>{s.current+=1,l(void 0),n(void 0),i(void 0),t(v.current?"ready":"idle")},[]);return e.useMemo(()=>({status:k,isSignedIn:S!==void 0,versionCode:P,error:T,errorCode:p,preloadGoogle:C,signInWithGoogle:R,publish:G,reset:m}),[k,S,P,T,p,C,R,G,m])}exports.usePlaystorePublish=N;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { PlaystorePublishInput, PlaystorePublishResult } from './index';
|
|
2
|
-
export type UsePlaystorePublishOptions = Partial<Pick<PlaystorePublishInput, 'registryApiUrl' | 'token' | 'organizationId'>> & {
|
|
3
|
-
/** Google OAuth Web application client ID used for sign-in. */
|
|
4
|
-
googleClientId?: string;
|
|
5
|
-
};
|
|
6
|
-
export type PlaystorePublishStatus = 'idle' | 'signing-in' | 'ready' | 'publishing' | 'published' | 'error';
|
|
7
|
-
export type PlaystorePublishRequest = Omit<PlaystorePublishInput, 'registryApiUrl' | 'token' | 'organizationId' | 'accessToken'>;
|
|
8
|
-
export type UsePlaystorePublishResult = {
|
|
9
|
-
status: PlaystorePublishStatus;
|
|
10
|
-
isSignedIn: boolean;
|
|
11
|
-
versionCode?: number;
|
|
12
|
-
error?: string;
|
|
13
|
-
/** Registry error code driving per-cause UX, e.g. versionCodeExists. */
|
|
14
|
-
errorCode?: string;
|
|
15
|
-
/**
|
|
16
|
-
* Warm up the Google sign-in script (e.g. on dialog open) so
|
|
17
|
-
* signInWithGoogle stays synchronous with the click. Resolves true once
|
|
18
|
-
* the script is ready; await it to gate the sign-in button, or ignore
|
|
19
|
-
* the result and rely on the blocked-popup error plus retry.
|
|
20
|
-
*/
|
|
21
|
-
preloadGoogle: () => Promise<boolean>;
|
|
22
|
-
signInWithGoogle: () => Promise<boolean>;
|
|
23
|
-
publish: (request: PlaystorePublishRequest) => Promise<PlaystorePublishResult | undefined>;
|
|
24
|
-
/**
|
|
25
|
-
* Clears the outcome state (keeps the Google session). Does not cancel an
|
|
26
|
-
* in-flight sign-in or publish: their completion is ignored status-wise
|
|
27
|
-
* and new calls stay refused until the in-flight one settles.
|
|
28
|
-
*/
|
|
29
|
-
reset: () => void;
|
|
30
|
-
};
|
|
31
|
-
export declare function usePlaystorePublish({ registryApiUrl, token, organizationId, googleClientId, }: UsePlaystorePublishOptions): UsePlaystorePublishResult;
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { useState as u, useRef as y, useCallback as d, useMemo as E } from "react";
|
|
2
|
-
import { e as N } from "../errors-gy8yQJos.mjs";
|
|
3
|
-
import { loadGoogleIdentityServices as x, requestGoogleAccessToken as M, publishToPlaystore as A, PlaystorePublishError as D } from "./index.js";
|
|
4
|
-
function W({
|
|
5
|
-
registryApiUrl: f,
|
|
6
|
-
token: k,
|
|
7
|
-
organizationId: m,
|
|
8
|
-
googleClientId: g
|
|
9
|
-
}) {
|
|
10
|
-
const [b, r] = u("idle"), [p, w] = u(), [T, l] = u(), [G, s] = u(), [S, c] = u(), v = y(void 0), t = y(0), n = y(!1), R = d(
|
|
11
|
-
() => x().then(
|
|
12
|
-
() => !0,
|
|
13
|
-
() => !1
|
|
14
|
-
),
|
|
15
|
-
[]
|
|
16
|
-
), h = d((e) => {
|
|
17
|
-
s(e), c(void 0), l(void 0), r("error");
|
|
18
|
-
}, []), P = d(async () => {
|
|
19
|
-
if (n.current)
|
|
20
|
-
return !1;
|
|
21
|
-
if (!g)
|
|
22
|
-
return h("Google OAuth client ID is not configured."), !1;
|
|
23
|
-
n.current = !0;
|
|
24
|
-
const e = t.current;
|
|
25
|
-
r("signing-in"), s(void 0), c(void 0);
|
|
26
|
-
try {
|
|
27
|
-
const o = await M({ clientId: g });
|
|
28
|
-
return v.current = o, w(o), e === t.current ? r("ready") : r((a) => a === "idle" ? "ready" : a), !0;
|
|
29
|
-
} catch (o) {
|
|
30
|
-
return e === t.current && (s(N(o)), r("error")), !1;
|
|
31
|
-
} finally {
|
|
32
|
-
n.current = !1;
|
|
33
|
-
}
|
|
34
|
-
}, [g]), C = d(
|
|
35
|
-
async (e) => {
|
|
36
|
-
if (n.current)
|
|
37
|
-
return;
|
|
38
|
-
if (!f) {
|
|
39
|
-
h("Registry URL is not configured.");
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
const o = v.current;
|
|
43
|
-
if (!o) {
|
|
44
|
-
h("Sign in with Google before publishing.");
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
n.current = !0;
|
|
48
|
-
const a = t.current;
|
|
49
|
-
r("publishing"), s(void 0), c(void 0), l(void 0);
|
|
50
|
-
try {
|
|
51
|
-
const i = await A({
|
|
52
|
-
registryApiUrl: f,
|
|
53
|
-
token: k,
|
|
54
|
-
organizationId: m,
|
|
55
|
-
accessToken: o,
|
|
56
|
-
packageName: e.packageName,
|
|
57
|
-
assetId: e.assetId,
|
|
58
|
-
assetName: e.assetName,
|
|
59
|
-
track: e.track,
|
|
60
|
-
releaseStatus: e.releaseStatus
|
|
61
|
-
});
|
|
62
|
-
return a === t.current && (l(i.versionCode), r("published")), i;
|
|
63
|
-
} catch (i) {
|
|
64
|
-
a === t.current && (s(N(i)), i instanceof D && c(i.code), r("error"));
|
|
65
|
-
return;
|
|
66
|
-
} finally {
|
|
67
|
-
n.current = !1;
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
[f, k, m]
|
|
71
|
-
), I = d(() => {
|
|
72
|
-
t.current += 1, l(void 0), s(void 0), c(void 0), r(v.current ? "ready" : "idle");
|
|
73
|
-
}, []);
|
|
74
|
-
return E(
|
|
75
|
-
() => ({
|
|
76
|
-
status: b,
|
|
77
|
-
isSignedIn: p !== void 0,
|
|
78
|
-
versionCode: T,
|
|
79
|
-
error: G,
|
|
80
|
-
errorCode: S,
|
|
81
|
-
preloadGoogle: R,
|
|
82
|
-
signInWithGoogle: P,
|
|
83
|
-
publish: C,
|
|
84
|
-
reset: I
|
|
85
|
-
}),
|
|
86
|
-
[b, p, T, G, S, R, P, C, I]
|
|
87
|
-
);
|
|
88
|
-
}
|
|
89
|
-
export {
|
|
90
|
-
W as usePlaystorePublish
|
|
91
|
-
};
|
|
@@ -1,270 +0,0 @@
|
|
|
1
|
-
import { e as c, a as u, n as d, b as f, c as l, i as r } from "./browser-storage-BnO-Ma-e.mjs";
|
|
2
|
-
function P() {
|
|
3
|
-
return {
|
|
4
|
-
method: "POST",
|
|
5
|
-
path: "/account/listTeams.action",
|
|
6
|
-
payload: {}
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
function g({
|
|
10
|
-
bundleID: e,
|
|
11
|
-
teamID: i = ""
|
|
12
|
-
}) {
|
|
13
|
-
return n("/account/ios/identifiers/listAppIds.action", i, { sort: "name=asc" });
|
|
14
|
-
}
|
|
15
|
-
function v({
|
|
16
|
-
deviceUDID: e,
|
|
17
|
-
teamID: i = ""
|
|
18
|
-
}) {
|
|
19
|
-
return n("/account/ios/device/listDevices.action", i, {
|
|
20
|
-
sort: "name=asc",
|
|
21
|
-
includeRemovedDevices: !1
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
function I(e = "") {
|
|
25
|
-
return n("/account/ios/certificate/listCertRequests.action", e, {
|
|
26
|
-
sort: "name=asc",
|
|
27
|
-
types: "83Q87W3TGH,5QPB9NHCEI"
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
function h(e = "") {
|
|
31
|
-
return n("/account/ios/certificate/listCertRequests.action", e, {
|
|
32
|
-
sort: "name=asc",
|
|
33
|
-
types: "WXV89964HE,R58UK2EWSO"
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
function R({
|
|
37
|
-
bundleID: e,
|
|
38
|
-
teamID: i = ""
|
|
39
|
-
}) {
|
|
40
|
-
return n("/account/ios/profile/listProvisioningProfiles.action", i, {
|
|
41
|
-
search: e,
|
|
42
|
-
sort: "name=asc"
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
function y({
|
|
46
|
-
bundleID: e,
|
|
47
|
-
teamID: i = ""
|
|
48
|
-
}) {
|
|
49
|
-
return n("/account/ios/profile/listProvisioningProfiles.action", i, {
|
|
50
|
-
search: e,
|
|
51
|
-
sort: "name=asc",
|
|
52
|
-
distributionType: "adhoc"
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
function q({
|
|
56
|
-
bundleID: e,
|
|
57
|
-
teamID: i = ""
|
|
58
|
-
}) {
|
|
59
|
-
return n("/account/ios/profile/listProvisioningProfiles.action", i, {
|
|
60
|
-
search: e,
|
|
61
|
-
sort: "name=asc",
|
|
62
|
-
distributionType: "store"
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
function b({
|
|
66
|
-
deviceUDID: e,
|
|
67
|
-
teamID: i = "",
|
|
68
|
-
name: t = "Limrun iPhone"
|
|
69
|
-
}) {
|
|
70
|
-
return {
|
|
71
|
-
method: "POST",
|
|
72
|
-
path: "/account/ios/device/addDevices.action",
|
|
73
|
-
payload: {
|
|
74
|
-
teamId: i,
|
|
75
|
-
deviceNames: t,
|
|
76
|
-
deviceNumbers: d(e),
|
|
77
|
-
deviceClasses: "iphone",
|
|
78
|
-
register: "single"
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
function T({
|
|
83
|
-
bundleID: e,
|
|
84
|
-
teamID: i = "",
|
|
85
|
-
name: t
|
|
86
|
-
}) {
|
|
87
|
-
return {
|
|
88
|
-
method: "POST",
|
|
89
|
-
path: "/account/ios/identifiers/addAppId.action",
|
|
90
|
-
payload: {
|
|
91
|
-
teamId: i,
|
|
92
|
-
name: t ?? e,
|
|
93
|
-
identifier: e,
|
|
94
|
-
type: "explicit"
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
function D({ csrPEM: e, teamID: i = "" }) {
|
|
99
|
-
return {
|
|
100
|
-
method: "POST",
|
|
101
|
-
path: "/account/ios/certificate/submitCertificateRequest.action",
|
|
102
|
-
payload: {
|
|
103
|
-
teamId: i,
|
|
104
|
-
type: "83Q87W3TGH",
|
|
105
|
-
csrContent: e
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
function C({ csrPEM: e, teamID: i = "" }) {
|
|
110
|
-
return {
|
|
111
|
-
method: "POST",
|
|
112
|
-
path: "/account/ios/certificate/submitCertificateRequest.action",
|
|
113
|
-
payload: {
|
|
114
|
-
teamId: i,
|
|
115
|
-
type: "WXV89964HE",
|
|
116
|
-
csrContent: e
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
function S(e, i = "") {
|
|
121
|
-
return {
|
|
122
|
-
method: "GET",
|
|
123
|
-
path: "/account/ios/certificate/downloadCertificateContent.action",
|
|
124
|
-
payload: {
|
|
125
|
-
teamId: i,
|
|
126
|
-
certificateId: e,
|
|
127
|
-
type: "83Q87W3TGH"
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
function A(e, i = "") {
|
|
132
|
-
return {
|
|
133
|
-
method: "GET",
|
|
134
|
-
path: "/account/ios/certificate/downloadCertificateContent.action",
|
|
135
|
-
payload: {
|
|
136
|
-
teamId: i,
|
|
137
|
-
certificateId: e,
|
|
138
|
-
type: "WXV89964HE"
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
function w({
|
|
143
|
-
bundleID: e,
|
|
144
|
-
teamID: i = "",
|
|
145
|
-
appIDID: t,
|
|
146
|
-
certificateID: o,
|
|
147
|
-
deviceIDs: a,
|
|
148
|
-
name: s
|
|
149
|
-
}) {
|
|
150
|
-
return {
|
|
151
|
-
method: "POST",
|
|
152
|
-
path: "/account/ios/profile/createProvisioningProfile.action",
|
|
153
|
-
payload: {
|
|
154
|
-
teamId: i,
|
|
155
|
-
provisioningProfileName: s ?? `Limrun ${e}`,
|
|
156
|
-
certificateIds: [o],
|
|
157
|
-
appIdId: t,
|
|
158
|
-
deviceIds: a,
|
|
159
|
-
distributionType: "limited",
|
|
160
|
-
subPlatform: "ios"
|
|
161
|
-
}
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
function H({
|
|
165
|
-
bundleID: e,
|
|
166
|
-
teamID: i = "",
|
|
167
|
-
appIDID: t,
|
|
168
|
-
certificateID: o,
|
|
169
|
-
deviceIDs: a,
|
|
170
|
-
name: s
|
|
171
|
-
}) {
|
|
172
|
-
return {
|
|
173
|
-
method: "POST",
|
|
174
|
-
path: "/account/ios/profile/createProvisioningProfile.action",
|
|
175
|
-
payload: {
|
|
176
|
-
teamId: i,
|
|
177
|
-
provisioningProfileName: s ?? `Limrun Ad Hoc ${e}`,
|
|
178
|
-
certificateIds: [o],
|
|
179
|
-
appIdId: t,
|
|
180
|
-
deviceIds: a,
|
|
181
|
-
distributionType: "adhoc",
|
|
182
|
-
subPlatform: "ios"
|
|
183
|
-
}
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
function O({
|
|
187
|
-
teamID: e = "",
|
|
188
|
-
appIDID: i,
|
|
189
|
-
certificateID: t,
|
|
190
|
-
name: o
|
|
191
|
-
}) {
|
|
192
|
-
return {
|
|
193
|
-
method: "POST",
|
|
194
|
-
path: "/account/ios/profile/createProvisioningProfile.action",
|
|
195
|
-
payload: {
|
|
196
|
-
teamId: e,
|
|
197
|
-
provisioningProfileName: o,
|
|
198
|
-
certificateIds: [t],
|
|
199
|
-
appIdId: i,
|
|
200
|
-
distributionType: "store",
|
|
201
|
-
subPlatform: "ios"
|
|
202
|
-
}
|
|
203
|
-
};
|
|
204
|
-
}
|
|
205
|
-
function N(e, i = "") {
|
|
206
|
-
return {
|
|
207
|
-
method: "GET",
|
|
208
|
-
path: "/account/ios/profile/downloadProfileContent",
|
|
209
|
-
payload: {
|
|
210
|
-
teamId: i,
|
|
211
|
-
provisioningProfileId: e
|
|
212
|
-
}
|
|
213
|
-
};
|
|
214
|
-
}
|
|
215
|
-
async function E({
|
|
216
|
-
bundleID: e,
|
|
217
|
-
deviceUDID: i,
|
|
218
|
-
teamID: t,
|
|
219
|
-
signingMode: o
|
|
220
|
-
}) {
|
|
221
|
-
const a = await c({ bundleID: e, deviceUDID: i, signingMode: o });
|
|
222
|
-
if (!(!a || !p(a, { bundleID: e, deviceUDID: i, teamID: t, signingMode: o })))
|
|
223
|
-
return a;
|
|
224
|
-
}
|
|
225
|
-
async function G(e) {
|
|
226
|
-
return u({
|
|
227
|
-
...e,
|
|
228
|
-
certificateFileName: e.certificateID ? `${e.certificateID}.p12` : `apple-${e.signingMode ?? "development"}.p12`,
|
|
229
|
-
certificatePassword: e.certificatePassword || void 0,
|
|
230
|
-
signingMode: e.signingMode,
|
|
231
|
-
profileFileName: e.profile.uuid ? `${e.profile.uuid}.mobileprovision` : `${e.signingMode ?? "development"}.mobileprovision`
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
function p(e, { bundleID: i, deviceUDID: t, teamID: o, signingMode: a = "development" }) {
|
|
235
|
-
return (e.signingMode ?? "development") !== a || !f(e.profile, i) || o && e.teamID && e.teamID !== o || t && !l(e.profile, t) || e.profile.expirationDate && new Date(e.profile.expirationDate).getTime() <= Date.now() ? !1 : r(e.bundleID) === r(i);
|
|
236
|
-
}
|
|
237
|
-
function n(e, i, t = {}) {
|
|
238
|
-
const o = {
|
|
239
|
-
pageNumber: 1,
|
|
240
|
-
pageSize: 200,
|
|
241
|
-
...t
|
|
242
|
-
};
|
|
243
|
-
return i && (o.teamId = i), {
|
|
244
|
-
method: "POST",
|
|
245
|
-
path: e,
|
|
246
|
-
payload: o
|
|
247
|
-
};
|
|
248
|
-
}
|
|
249
|
-
export {
|
|
250
|
-
I as a,
|
|
251
|
-
D as b,
|
|
252
|
-
S as c,
|
|
253
|
-
A as d,
|
|
254
|
-
g as e,
|
|
255
|
-
h as f,
|
|
256
|
-
E as g,
|
|
257
|
-
T as h,
|
|
258
|
-
v as i,
|
|
259
|
-
y as j,
|
|
260
|
-
q as k,
|
|
261
|
-
P as l,
|
|
262
|
-
R as m,
|
|
263
|
-
N as n,
|
|
264
|
-
O as o,
|
|
265
|
-
G as p,
|
|
266
|
-
H as q,
|
|
267
|
-
b as r,
|
|
268
|
-
C as s,
|
|
269
|
-
w as t
|
|
270
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const s=require("./browser-storage-DLxIqZk5.js");function c(){return{method:"POST",path:"/account/listTeams.action",payload:{}}}function u({bundleID:e,teamID:t=""}){return r("/account/ios/identifiers/listAppIds.action",t,{sort:"name=asc"})}function d({deviceUDID:e,teamID:t=""}){return r("/account/ios/device/listDevices.action",t,{sort:"name=asc",includeRemovedDevices:!1})}function f(e=""){return r("/account/ios/certificate/listCertRequests.action",e,{sort:"name=asc",types:"83Q87W3TGH,5QPB9NHCEI"})}function l(e=""){return r("/account/ios/certificate/listCertRequests.action",e,{sort:"name=asc",types:"WXV89964HE,R58UK2EWSO"})}function p({bundleID:e,teamID:t=""}){return r("/account/ios/profile/listProvisioningProfiles.action",t,{search:e,sort:"name=asc"})}function m({bundleID:e,teamID:t=""}){return r("/account/ios/profile/listProvisioningProfiles.action",t,{search:e,sort:"name=asc",distributionType:"adhoc"})}function R({bundleID:e,teamID:t=""}){return r("/account/ios/profile/listProvisioningProfiles.action",t,{search:e,sort:"name=asc",distributionType:"store"})}function P({deviceUDID:e,teamID:t="",name:i="Limrun iPhone"}){return{method:"POST",path:"/account/ios/device/addDevices.action",payload:{teamId:t,deviceNames:i,deviceNumbers:s.normalizeUDID(e),deviceClasses:"iphone",register:"single"}}}function g({bundleID:e,teamID:t="",name:i}){return{method:"POST",path:"/account/ios/identifiers/addAppId.action",payload:{teamId:t,name:i??e,identifier:e,type:"explicit"}}}function q({csrPEM:e,teamID:t=""}){return{method:"POST",path:"/account/ios/certificate/submitCertificateRequest.action",payload:{teamId:t,type:"83Q87W3TGH",csrContent:e}}}function v({csrPEM:e,teamID:t=""}){return{method:"POST",path:"/account/ios/certificate/submitCertificateRequest.action",payload:{teamId:t,type:"WXV89964HE",csrContent:e}}}function I(e,t=""){return{method:"GET",path:"/account/ios/certificate/downloadCertificateContent.action",payload:{teamId:t,certificateId:e,type:"83Q87W3TGH"}}}function D(e,t=""){return{method:"GET",path:"/account/ios/certificate/downloadCertificateContent.action",payload:{teamId:t,certificateId:e,type:"WXV89964HE"}}}function h({bundleID:e,teamID:t="",appIDID:i,certificateID:o,deviceIDs:n,name:a}){return{method:"POST",path:"/account/ios/profile/createProvisioningProfile.action",payload:{teamId:t,provisioningProfileName:a??`Limrun ${e}`,certificateIds:[o],appIdId:i,deviceIds:n,distributionType:"limited",subPlatform:"ios"}}}function b({bundleID:e,teamID:t="",appIDID:i,certificateID:o,deviceIDs:n,name:a}){return{method:"POST",path:"/account/ios/profile/createProvisioningProfile.action",payload:{teamId:t,provisioningProfileName:a??`Limrun Ad Hoc ${e}`,certificateIds:[o],appIdId:i,deviceIds:n,distributionType:"adhoc",subPlatform:"ios"}}}function y({teamID:e="",appIDID:t,certificateID:i,name:o}){return{method:"POST",path:"/account/ios/profile/createProvisioningProfile.action",payload:{teamId:e,provisioningProfileName:o,certificateIds:[i],appIdId:t,distributionType:"store",subPlatform:"ios"}}}function S(e,t=""){return{method:"GET",path:"/account/ios/profile/downloadProfileContent",payload:{teamId:t,provisioningProfileId:e}}}async function C({bundleID:e,deviceUDID:t,teamID:i,signingMode:o}){const n=await s.getSigningAssets({bundleID:e,deviceUDID:t,signingMode:o});if(!(!n||!A(n,{bundleID:e,deviceUDID:t,teamID:i,signingMode:o})))return n}async function T(e){return s.putSigningAssets({...e,certificateFileName:e.certificateID?`${e.certificateID}.p12`:`apple-${e.signingMode??"development"}.p12`,certificatePassword:e.certificatePassword||void 0,signingMode:e.signingMode,profileFileName:e.profile.uuid?`${e.profile.uuid}.mobileprovision`:`${e.signingMode??"development"}.mobileprovision`})}function A(e,{bundleID:t,deviceUDID:i,teamID:o,signingMode:n="development"}){return(e.signingMode??"development")!==n||!s.profileMatchesBundleID(e.profile,t)||o&&e.teamID&&e.teamID!==o||i&&!s.profileContainsDevice(e.profile,i)||e.profile.expirationDate&&new Date(e.profile.expirationDate).getTime()<=Date.now()?!1:s.normalizeBundleID(e.bundleID)===s.normalizeBundleID(t)}function r(e,t,i={}){const o={pageNumber:1,pageSize:200,...i};return t&&(o.teamId=t),{method:"POST",path:e,payload:o}}exports.createAdHocProfileRequest=b;exports.createAppStoreProfileRequest=y;exports.createBundleIDRequest=g;exports.createDevelopmentProfileRequest=h;exports.downloadCertificateRequest=I;exports.downloadDistributionCertificateRequest=D;exports.downloadProfileRequest=S;exports.findAdHocProfilesRequest=m;exports.findAppStoreProfilesRequest=R;exports.findBundleIDRequest=u;exports.findDevelopmentCertificatesRequest=f;exports.findDevelopmentProfilesRequest=p;exports.findDeviceRequest=d;exports.findDistributionCertificatesRequest=l;exports.getReusableAppleSigningAssets=C;exports.listTeamsRequest=c;exports.putAppleGeneratedSigningAssets=T;exports.registerDeviceRequest=P;exports.submitDevelopmentCSRRequest=q;exports.submitDistributionCSRRequest=v;
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
// @vitest-environment node
|
|
2
|
-
|
|
3
|
-
import { afterEach, describe, expect, test, vi } from 'vitest';
|
|
4
|
-
import { assertAppleDeveloperPortalResponseOK, deleteAppleProfile, listAppleTeams } from './index';
|
|
5
|
-
|
|
6
|
-
describe('Registry relay primitives', () => {
|
|
7
|
-
afterEach(() => {
|
|
8
|
-
vi.restoreAllMocks();
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
test('sends explicit CRUD requests through the provisioning proxy', async () => {
|
|
12
|
-
const relay = { request: vi.fn().mockResolvedValue({ status: 200, body: { resultCode: 0 } }) };
|
|
13
|
-
|
|
14
|
-
await deleteAppleProfile({
|
|
15
|
-
relay,
|
|
16
|
-
teamId: 'TEAM',
|
|
17
|
-
profileId: 'PROFILE',
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
expect(relay.request).toHaveBeenCalledOnce();
|
|
21
|
-
expect(relay.request.mock.calls[0]).toMatchObject([
|
|
22
|
-
'provisioning',
|
|
23
|
-
{
|
|
24
|
-
method: 'POST',
|
|
25
|
-
path: '/account/ios/profile/deleteProvisioningProfile.action',
|
|
26
|
-
payload: {
|
|
27
|
-
teamId: 'TEAM',
|
|
28
|
-
provisioningProfileId: 'PROFILE',
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
]);
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
test('maps team list responses to teams', async () => {
|
|
35
|
-
const relay = {
|
|
36
|
-
request: vi.fn().mockResolvedValue({
|
|
37
|
-
status: 200,
|
|
38
|
-
body: {
|
|
39
|
-
resultCode: 0,
|
|
40
|
-
teams: [{ name: 'Team One', teamId: 'TEAM1' }],
|
|
41
|
-
},
|
|
42
|
-
}),
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
await expect(
|
|
46
|
-
listAppleTeams({
|
|
47
|
-
relay,
|
|
48
|
-
}),
|
|
49
|
-
).resolves.toEqual([{ name: 'Team One', teamId: 'TEAM1' }]);
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
test('surfaces Apple portal errors', () => {
|
|
53
|
-
expect(() =>
|
|
54
|
-
assertAppleDeveloperPortalResponseOK(
|
|
55
|
-
{ resultCode: 35, userString: 'No permission' },
|
|
56
|
-
'Apple device list',
|
|
57
|
-
),
|
|
58
|
-
).toThrow('Apple device list failed: No permission');
|
|
59
|
-
});
|
|
60
|
-
});
|