shipthis 0.1.9 → 0.1.11

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 (134) hide show
  1. package/assets/markdown/create-or-import-keystore.md +7 -0
  2. package/dist/AppleBundleIdDetails-CjP5y0cj.js +74 -0
  3. package/dist/AppleBundleIdDetails-CztWY_mT.js +73 -0
  4. package/dist/AppleBundleIdDetails-DKeSAte9.js +73 -0
  5. package/dist/AppleBundleIdDetails-DymjrhOZ.js +73 -0
  6. package/dist/Command-BiB9MqbJ.js +204 -0
  7. package/dist/Command-D6rWEZRM.js +204 -0
  8. package/dist/Command-Dn0P_KOV.js +205 -0
  9. package/dist/Command-YJJp90ru.js +204 -0
  10. package/dist/CommandGame-C1oTlfdb.js +8 -0
  11. package/dist/CommandGame-cPaTk1wh.js +8 -0
  12. package/dist/CommandGame-k04mHiDl.js +8 -0
  13. package/dist/CommandGame-pI9VXKxi.js +8 -0
  14. package/dist/Create-DIaSKUpl.js +56 -0
  15. package/dist/CreateKeystore-BnNdeDUa.js +57 -0
  16. package/dist/CreateKeystore-Cf-nsK_M.js +56 -0
  17. package/dist/CreateKeystore-g1z6DsU5.js +56 -0
  18. package/dist/Import-BIOsf8AA.js +107 -0
  19. package/dist/JobProgress-CPkWVSlH.js +108 -0
  20. package/dist/JobProgress-W0QQR49T.js +108 -0
  21. package/dist/JobProgress-biiLhigg.js +109 -0
  22. package/dist/JobProgress-jmGAzvxS.js +108 -0
  23. package/dist/JobStatusTable-BA_q-kgE.js +75 -0
  24. package/dist/JobStatusTable-ByW0bN6c.js +75 -0
  25. package/dist/JobStatusTable-CgaTS7jS.js +75 -0
  26. package/dist/JobStatusTable-DqoppRro.js +75 -0
  27. package/dist/ProjectCredentialsTable-8kXt7sTS.js +37 -0
  28. package/dist/ProjectCredentialsTable-DRMK_SNw.js +37 -0
  29. package/dist/ProjectCredentialsTable-DfkpvTf8.js +37 -0
  30. package/dist/UserCredentialsTable-DMh8Wpy7.js +82 -0
  31. package/dist/UserCredentialsTable-DgHZJSHG.js +82 -0
  32. package/dist/UserCredentialsTable-TflQvTEP.js +82 -0
  33. package/dist/baseAppleCommand-1isaFxCQ.js +10 -0
  34. package/dist/baseAppleCommand-B9wyIqdL.js +10 -0
  35. package/dist/baseAppleCommand-DpasCbje.js +10 -0
  36. package/dist/baseGameAndroidCommand-6vsMpE7a.js +43 -0
  37. package/dist/baseGameAndroidCommand-B3LRG701.js +43 -0
  38. package/dist/baseGameAndroidCommand-C9BuS2Sr.js +43 -0
  39. package/dist/commands/apple/apiKey/create.js +10 -10
  40. package/dist/commands/apple/apiKey/export.js +8 -8
  41. package/dist/commands/apple/apiKey/import.js +8 -8
  42. package/dist/commands/apple/apiKey/status.js +7 -7
  43. package/dist/commands/apple/certificate/create.js +10 -10
  44. package/dist/commands/apple/certificate/export.js +8 -8
  45. package/dist/commands/apple/certificate/import.js +8 -8
  46. package/dist/commands/apple/certificate/status.js +7 -7
  47. package/dist/commands/apple/login.js +2 -2
  48. package/dist/commands/apple/status.js +6 -6
  49. package/dist/commands/dashboard.js +1 -1
  50. package/dist/commands/game/android/apiKey/connect.js +11 -11
  51. package/dist/commands/game/android/apiKey/create.js +13 -13
  52. package/dist/commands/game/android/apiKey/export.js +9 -9
  53. package/dist/commands/game/android/apiKey/import.js +9 -9
  54. package/dist/commands/game/android/apiKey/invite.js +4 -4
  55. package/dist/commands/game/android/apiKey/status.js +9 -9
  56. package/dist/commands/game/android/keyStore/create.js +12 -12
  57. package/dist/commands/game/android/keyStore/export.js +8 -8
  58. package/dist/commands/game/android/keyStore/import.js +49 -29
  59. package/dist/commands/game/android/keyStore/status.js +8 -8
  60. package/dist/commands/game/android/status.js +7 -7
  61. package/dist/commands/game/build/download.js +7 -7
  62. package/dist/commands/game/build/list.js +7 -7
  63. package/dist/commands/game/create.js +2 -2
  64. package/dist/commands/game/details.js +22 -8
  65. package/dist/commands/game/export.js +1 -1
  66. package/dist/commands/game/ios/app/addTester.js +6 -6
  67. package/dist/commands/game/ios/app/create.js +5 -5
  68. package/dist/commands/game/ios/app/status.js +9 -9
  69. package/dist/commands/game/ios/app/sync.js +7 -7
  70. package/dist/commands/game/ios/profile/create.js +10 -10
  71. package/dist/commands/game/ios/profile/export.js +8 -8
  72. package/dist/commands/game/ios/profile/import.js +8 -8
  73. package/dist/commands/game/ios/profile/status.js +8 -8
  74. package/dist/commands/game/ios/status.js +10 -10
  75. package/dist/commands/game/ios/wizard.js +2 -2
  76. package/dist/commands/game/job/list.js +7 -7
  77. package/dist/commands/game/job/status.js +11 -11
  78. package/dist/commands/game/list.js +7 -7
  79. package/dist/commands/game/ship.js +11 -11
  80. package/dist/commands/game/status.js +7 -7
  81. package/dist/commands/game/wizard.js +590 -35
  82. package/dist/commands/internal/fastlane.js +1 -1
  83. package/dist/commands/internal/readme.js +255 -770
  84. package/dist/commands/login.js +2 -2
  85. package/dist/commands/status.js +6 -6
  86. package/dist/export-B_F6vXIK.js +36 -0
  87. package/dist/export-C_lu1FD9.js +36 -0
  88. package/dist/export-rS9o87LD.js +36 -0
  89. package/dist/import-7T3J63j2.js +38 -0
  90. package/dist/import-Brg3zYmT.js +38 -0
  91. package/dist/import-DPbg8WvS.js +38 -0
  92. package/dist/import-v54PM_Qg.js +47 -0
  93. package/dist/index-BB7X1Pqp.js +695 -0
  94. package/dist/index-BQnkBr1Q.js +136 -0
  95. package/dist/index-BX9h2vPV.js +123 -0
  96. package/dist/index-BjGSEqP5.js +135 -0
  97. package/dist/index-Bv3x8c78.js +693 -0
  98. package/dist/index-ByOvCs4O.js +122 -0
  99. package/dist/index-BzffuqPa.js +24 -0
  100. package/dist/index-C9734Cj2.js +693 -0
  101. package/dist/index-CKYExssR.js +136 -0
  102. package/dist/index-Cz_KLwWf.js +136 -0
  103. package/dist/index-D6BH5UAM.js +135 -0
  104. package/dist/index-DOgF4dFK.js +24 -0
  105. package/dist/index-DgbQBx6x.js +122 -0
  106. package/dist/index-DxHPjZav.js +136 -0
  107. package/dist/index-m4HTrJ5J.js +135 -0
  108. package/dist/index-o9Y-84Rj.js +122 -0
  109. package/dist/upload-2naN75Zu.js +60 -0
  110. package/dist/upload-Cx71802W.js +60 -0
  111. package/dist/upload-DvAE1vDq.js +60 -0
  112. package/dist/useAndroidServiceAccountTestResult-BDc7XpKE.js +52 -0
  113. package/dist/useAndroidServiceAccountTestResult-B_ekRewZ.js +52 -0
  114. package/dist/useAndroidServiceAccountTestResult-Ce1x0Eh8.js +52 -0
  115. package/dist/useAppleApp-BEtLQa7n.js +32 -0
  116. package/dist/useAppleApp-CApC0-4Q.js +32 -0
  117. package/dist/useAppleApp-CETIcsJS.js +32 -0
  118. package/dist/useAppleBundleId-DXbMDRLd.js +64 -0
  119. package/dist/useAppleBundleId-SmzY6rkm.js +64 -0
  120. package/dist/useAppleBundleId-gPBzJwQg.js +64 -0
  121. package/dist/useJobWatching-BIG6fnTN.js +45 -0
  122. package/dist/useJobWatching-Cp-CYd90.js +45 -0
  123. package/dist/useJobWatching-D-YzSlK8.js +45 -0
  124. package/dist/useJobWatching-I_A3b36f.js +45 -0
  125. package/dist/useProjectCredentials-CKngz2rd.js +54 -0
  126. package/dist/useProjectCredentials-EapDge1I.js +54 -0
  127. package/dist/useProjectCredentials-vjedBbKl.js +54 -0
  128. package/dist/useWebSocket-Bep1zAVG.js +36 -0
  129. package/dist/useWebSocket-CBqsjHbt.js +36 -0
  130. package/dist/useWebSocket-rBLiZsKb.js +36 -0
  131. package/dist/wizard-ChPegnMW.js +133 -0
  132. package/npm-shrinkwrap.json +251 -223
  133. package/oclif.manifest.json +282 -223
  134. package/package.json +2 -4
@@ -0,0 +1,135 @@
1
+ import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
2
+ import { Box, Text } from 'ink';
3
+ import { useState, useRef, useEffect, useContext } from 'react';
4
+ import Spinner from 'ink-spinner';
5
+ import { b as GameContext } from './Command-D6rWEZRM.js';
6
+ import { p as getAuthedHeaders, q as API_URL, F as castObjectDates, P as Platform, C as CredentialsType, Q as getGoogleStatus } from './index-BB7X1Pqp.js';
7
+ import axios from 'axios';
8
+ import 'crypto-js';
9
+ import 'uuid';
10
+ import 'luxon';
11
+ import 'fs';
12
+ import '@inkjs/ui';
13
+ import { useQuery, useQueryClient } from '@tanstack/react-query';
14
+ import 'open';
15
+ import 'crypto';
16
+ import 'readline-sync';
17
+ import 'node:readline';
18
+ import 'node:path';
19
+ import 'node:url';
20
+ import { c as cacheKeys } from './useAndroidServiceAccountTestResult-Ce1x0Eh8.js';
21
+ import 'fast-glob';
22
+ import 'yazl';
23
+ import 'socket.io-client';
24
+ import 'isomorphic-git';
25
+ import '@oclif/core';
26
+ import { u as useWebSocket } from './useWebSocket-CBqsjHbt.js';
27
+ import { u as useProjectCredentials } from './useProjectCredentials-vjedBbKl.js';
28
+ import { P as ProgressSpinner } from './ProgressSpinner-6pw1T8Iw.js';
29
+ import 'qrcode';
30
+ import 'string-length';
31
+ import 'strip-ansi';
32
+
33
+ async function fetchStatus({ projectId }) {
34
+ try {
35
+ if (!projectId) throw new Error("projectId is required");
36
+ const headers = getAuthedHeaders();
37
+ const url = `${API_URL}/projects/${projectId}/credentials/android/key/status/`;
38
+ const response = await axios.get(url, { headers });
39
+ return castObjectDates(response.data);
40
+ } catch (error) {
41
+ console.warn("fetchStatus Error", error);
42
+ throw error;
43
+ }
44
+ }
45
+ const useAndroidServiceAccountSetupStatus = (props) => {
46
+ return useQuery({
47
+ queryKey: cacheKeys.androidSetupStatus(props),
48
+ queryFn: () => fetchStatus(props),
49
+ // Status changes frequently, so we want to keep it fresh
50
+ refetchInterval: 1e3 * 5,
51
+ staleTime: 1e3 * 5
52
+ });
53
+ };
54
+
55
+ const ERR_NOT_AUTHENTICATED = "You must be connected to Google to create a Service Account Key";
56
+ const useHasServiceAccountKey = (projectId) => {
57
+ const { data, isSuccess } = useProjectCredentials({ projectId, platform: Platform.ANDROID });
58
+ return isSuccess && data.data.some((cred) => cred.isActive && cred.platform === Platform.ANDROID && cred.type == CredentialsType.KEY);
59
+ };
60
+ const useAndroidServiceAccount = ({ projectId, onError, onComplete }) => {
61
+ const queryClient = useQueryClient();
62
+ const [isStarting, setIsStarting] = useState(false);
63
+ const hasServiceAccountKey = useHasServiceAccountKey(projectId);
64
+ const listener = {
65
+ getPattern: () => `project.${projectId}:android-setup-status`,
66
+ eventHandler: async (pattern, data) => {
67
+ const key = cacheKeys.androidSetupStatus({ projectId });
68
+ queryClient.setQueryData(key, () => data);
69
+ }
70
+ };
71
+ useWebSocket([listener]);
72
+ const { data: setupStatus } = useAndroidServiceAccountSetupStatus({ projectId });
73
+ const prevSetupStatusRef = useRef("unknown");
74
+ useEffect(() => {
75
+ if (["running", "queued"].includes(prevSetupStatusRef.current)) {
76
+ if (setupStatus?.status === "complete") onComplete();
77
+ if (setupStatus?.status === "error") onError(new Error(setupStatus.errorMessage));
78
+ }
79
+ prevSetupStatusRef.current = setupStatus?.status || "unknown";
80
+ }, [setupStatus]);
81
+ const handleStart = async () => {
82
+ try {
83
+ setIsStarting(true);
84
+ const currentStatus = await getGoogleStatus();
85
+ if (!currentStatus.isAuthenticated) throw new Error(ERR_NOT_AUTHENTICATED);
86
+ const headers = getAuthedHeaders();
87
+ const androidKeyApiBase = `${API_URL}/projects/${projectId}/credentials/android/key`;
88
+ const startUrl = `${androidKeyApiBase}/setup/`;
89
+ const { data: updatedStatus } = await axios.post(startUrl, {}, { headers });
90
+ queryClient.invalidateQueries({
91
+ queryKey: cacheKeys.projectCredentials({ projectId, pageNumber: 0 })
92
+ });
93
+ await queryClient.setQueryData(cacheKeys.androidSetupStatus({ projectId }), (_) => updatedStatus);
94
+ setIsStarting(false);
95
+ return true;
96
+ } catch (error) {
97
+ setIsStarting(false);
98
+ console.warn("useAndroidServiceAccount.handleStart Error", error);
99
+ onError(error);
100
+ return false;
101
+ }
102
+ };
103
+ const isCreating = isStarting || setupStatus?.status === "queued" || setupStatus?.status === "running";
104
+ return {
105
+ handleStart,
106
+ setupStatus,
107
+ isCreating,
108
+ hasServiceAccountKey
109
+ };
110
+ };
111
+
112
+ const CreateServiceAccountKey = (props) => {
113
+ const { gameId } = useContext(GameContext);
114
+ return /* @__PURE__ */ jsx(Fragment, { children: gameId && /* @__PURE__ */ jsx(CreateForGame, { gameId, ...props }) });
115
+ };
116
+ const CreateForGame = ({ onComplete, onError, gameId, ...boxProps }) => {
117
+ const [didStart, setDidStart] = useState(false);
118
+ const { handleStart, setupStatus, isCreating } = useAndroidServiceAccount({
119
+ projectId: gameId,
120
+ onError,
121
+ onComplete
122
+ });
123
+ useEffect(() => {
124
+ handleStart().then(() => setDidStart(true));
125
+ }, [gameId]);
126
+ return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(Box, { flexDirection: "column", gap: 1, ...boxProps, children: [
127
+ /* @__PURE__ */ jsxs(Box, { flexDirection: "row", gap: 1, children: [
128
+ /* @__PURE__ */ jsx(Text, { children: "Creating a Service Account and API Key..." }),
129
+ isCreating && /* @__PURE__ */ jsx(Spinner, { type: "dots" })
130
+ ] }),
131
+ didStart && /* @__PURE__ */ jsx(ProgressSpinner, { progress: (setupStatus?.progress || 0) * 100, spinnerType: "dots" })
132
+ ] }) });
133
+ };
134
+
135
+ export { CreateServiceAccountKey as C };
@@ -0,0 +1,122 @@
1
+ import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
2
+ import { Text, useInput, Box } from 'ink';
3
+ import open from 'open';
4
+ import { useState, useEffect, useContext } from 'react';
5
+ import { Q as getGoogleStatus, a2 as getShortAuthRequiredUrl, a3 as getGoogleAuthUrl, X as WEB_URL } from './index-BB7X1Pqp.js';
6
+ import 'crypto';
7
+ import 'fs';
8
+ import 'readline-sync';
9
+ import 'node:readline';
10
+ import 'node:path';
11
+ import 'node:url';
12
+ import 'axios';
13
+ import { useQuery } from '@tanstack/react-query';
14
+ import 'crypto-js';
15
+ import 'uuid';
16
+ import 'luxon';
17
+ import 'fast-glob';
18
+ import 'yazl';
19
+ import 'socket.io-client';
20
+ import { u as useWebSocket } from './useWebSocket-CBqsjHbt.js';
21
+ import { c as cacheKeys } from './useAndroidServiceAccountTestResult-Ce1x0Eh8.js';
22
+ import 'isomorphic-git';
23
+ import '@oclif/core';
24
+ import { b as GameContext, M as Markdown } from './Command-BiB9MqbJ.js';
25
+ import 'ink-spinner';
26
+ import '@inkjs/ui';
27
+ import 'string-length';
28
+ import 'strip-ansi';
29
+ import qrcode from 'qrcode';
30
+
31
+ const useGoogleStatus = () => {
32
+ return useQuery({
33
+ queryKey: cacheKeys.googleStatus(),
34
+ queryFn: getGoogleStatus
35
+ });
36
+ };
37
+
38
+ function useGoogleStatusWatching({
39
+ projectId,
40
+ isWatching,
41
+ onGoogleStatusUpdate
42
+ }) {
43
+ const [wsGoogleStatus, setWsGoogleStatus] = useState(null);
44
+ const listener = {
45
+ getPattern: () => `project.${projectId}:google-status`,
46
+ eventHandler: async (pattern, data2) => {
47
+ setWsGoogleStatus(data2);
48
+ if (onGoogleStatusUpdate) onGoogleStatusUpdate(data2);
49
+ }
50
+ };
51
+ useWebSocket([listener] );
52
+ const { isLoading, data: googleStatus } = useGoogleStatus();
53
+ useEffect(() => {
54
+ setWsGoogleStatus(null);
55
+ }, [projectId, isWatching, googleStatus]);
56
+ const fetchedGoogleStatus = googleStatus ? googleStatus : null;
57
+ const data = wsGoogleStatus ? wsGoogleStatus : fetchedGoogleStatus;
58
+ return {
59
+ isLoading,
60
+ data
61
+ };
62
+ }
63
+
64
+ const QRCodeTerminal = ({ url }) => {
65
+ const [code, setCode] = useState(null);
66
+ const handleLoad = async () => {
67
+ const codeString = await qrcode.toString(url, { type: "terminal", errorCorrectionLevel: "L", small: true });
68
+ setCode(codeString);
69
+ };
70
+ useEffect(() => {
71
+ handleLoad();
72
+ }, []);
73
+ return /* @__PURE__ */ jsx(Fragment, { children: code && /* @__PURE__ */ jsx(Text, { children: code }) });
74
+ };
75
+
76
+ async function getConnectUrl(gameId, helpPage) {
77
+ const helpPagePath = `/docs/android?gameId=${gameId}#2-connect-shipthis-with-google`;
78
+ const url = helpPage ? await getShortAuthRequiredUrl(helpPagePath) : await getGoogleAuthUrl(gameId);
79
+ return url;
80
+ }
81
+ const GoogleAuthQRCode = ({ gameId, helpPage }) => {
82
+ const [url, setUrl] = useState(null);
83
+ const handleLoad = async () => {
84
+ const url2 = await getConnectUrl(gameId, helpPage);
85
+ setUrl(url2);
86
+ };
87
+ useEffect(() => {
88
+ handleLoad();
89
+ }, []);
90
+ return /* @__PURE__ */ jsx(Fragment, { children: url && /* @__PURE__ */ jsx(QRCodeTerminal, { url }) });
91
+ };
92
+
93
+ const ConnectGoogle = (props) => {
94
+ const { gameId } = useContext(GameContext);
95
+ return /* @__PURE__ */ jsx(Fragment, { children: gameId && /* @__PURE__ */ jsx(ConnectForGame, { gameId, ...props }) });
96
+ };
97
+ const ConnectForGame = ({ onComplete, onError, helpPage, gameId, ...boxProps }) => {
98
+ useGoogleStatusWatching({
99
+ projectId: gameId,
100
+ isWatching: true,
101
+ onGoogleStatusUpdate: (status) => {
102
+ if (status.isAuthenticated) return onComplete();
103
+ }
104
+ });
105
+ useInput(async (input) => {
106
+ if (!gameId) return;
107
+ if (input !== "d") return;
108
+ const url = await getConnectUrl(gameId, true);
109
+ await open(url);
110
+ });
111
+ const templateVars = {
112
+ privacyURL: new URL("/privacy", WEB_URL).toString()
113
+ };
114
+ return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", gap: 1, ...boxProps, children: [
115
+ /* @__PURE__ */ jsx(Markdown, { filename: "privacy-notification.md", templateVars }),
116
+ /* @__PURE__ */ jsx(Text, { children: "Scan the QR code below to connect your Google account to ShipThis:" }),
117
+ gameId && /* @__PURE__ */ jsx(GoogleAuthQRCode, { gameId, helpPage: !!helpPage }),
118
+ /* @__PURE__ */ jsx(Text, { children: "Or press D to sign-in using your browser" })
119
+ ] });
120
+ };
121
+
122
+ export { ConnectGoogle as C };
@@ -0,0 +1,60 @@
1
+ import axios from 'axios';
2
+ import { p as getAuthedHeaders, q as API_URL } from './index-BB7X1Pqp.js';
3
+
4
+ async function getNewUploadTicket(projectId = null) {
5
+ const url = projectId ? `${API_URL}/projects/${projectId}/credentials/url` : `${API_URL}/credentials/url`;
6
+ const headers = getAuthedHeaders();
7
+ const { data: uploadInfo } = await axios({
8
+ method: "post",
9
+ url,
10
+ headers
11
+ });
12
+ return uploadInfo;
13
+ }
14
+ async function uploadUserCredentials({ contents, platform, type, serialNumber }) {
15
+ const uploadInfo = await getNewUploadTicket();
16
+ const jsonBuffer = Buffer.from(JSON.stringify(contents));
17
+ await axios.put(uploadInfo.url, jsonBuffer, {
18
+ headers: {
19
+ "Content-length": jsonBuffer.length,
20
+ "Content-Type": "application/json"
21
+ }
22
+ });
23
+ const headers = getAuthedHeaders();
24
+ return await axios({
25
+ method: "post",
26
+ url: `${API_URL}/credentials`,
27
+ headers,
28
+ data: {
29
+ platform,
30
+ type,
31
+ uuid: uploadInfo.uuid,
32
+ serialNumber
33
+ }
34
+ });
35
+ }
36
+ async function uploadProjectCredentials(projectId, { contents, platform, type, serialNumber, identifier }) {
37
+ const uploadInfo = await getNewUploadTicket(projectId);
38
+ const jsonBuffer = Buffer.from(JSON.stringify(contents));
39
+ await axios.put(uploadInfo.url, jsonBuffer, {
40
+ headers: {
41
+ "Content-length": jsonBuffer.length,
42
+ "Content-Type": "application/json"
43
+ }
44
+ });
45
+ const headers = getAuthedHeaders();
46
+ return await axios({
47
+ method: "post",
48
+ url: `${API_URL}/projects/${projectId}/credentials`,
49
+ headers,
50
+ data: {
51
+ platform,
52
+ type,
53
+ uuid: uploadInfo.uuid,
54
+ identifier,
55
+ serialNumber
56
+ }
57
+ });
58
+ }
59
+
60
+ export { uploadProjectCredentials as a, uploadUserCredentials as u };
@@ -0,0 +1,60 @@
1
+ import axios from 'axios';
2
+ import { o as getAuthedHeaders, p as API_URL } from './index-C9734Cj2.js';
3
+
4
+ async function getNewUploadTicket(projectId = null) {
5
+ const url = projectId ? `${API_URL}/projects/${projectId}/credentials/url` : `${API_URL}/credentials/url`;
6
+ const headers = getAuthedHeaders();
7
+ const { data: uploadInfo } = await axios({
8
+ method: "post",
9
+ url,
10
+ headers
11
+ });
12
+ return uploadInfo;
13
+ }
14
+ async function uploadUserCredentials({ contents, platform, type, serialNumber }) {
15
+ const uploadInfo = await getNewUploadTicket();
16
+ const jsonBuffer = Buffer.from(JSON.stringify(contents));
17
+ await axios.put(uploadInfo.url, jsonBuffer, {
18
+ headers: {
19
+ "Content-length": jsonBuffer.length,
20
+ "Content-Type": "application/json"
21
+ }
22
+ });
23
+ const headers = getAuthedHeaders();
24
+ return await axios({
25
+ method: "post",
26
+ url: `${API_URL}/credentials`,
27
+ headers,
28
+ data: {
29
+ platform,
30
+ type,
31
+ uuid: uploadInfo.uuid,
32
+ serialNumber
33
+ }
34
+ });
35
+ }
36
+ async function uploadProjectCredentials(projectId, { contents, platform, type, serialNumber, identifier }) {
37
+ const uploadInfo = await getNewUploadTicket(projectId);
38
+ const jsonBuffer = Buffer.from(JSON.stringify(contents));
39
+ await axios.put(uploadInfo.url, jsonBuffer, {
40
+ headers: {
41
+ "Content-length": jsonBuffer.length,
42
+ "Content-Type": "application/json"
43
+ }
44
+ });
45
+ const headers = getAuthedHeaders();
46
+ return await axios({
47
+ method: "post",
48
+ url: `${API_URL}/projects/${projectId}/credentials`,
49
+ headers,
50
+ data: {
51
+ platform,
52
+ type,
53
+ uuid: uploadInfo.uuid,
54
+ identifier,
55
+ serialNumber
56
+ }
57
+ });
58
+ }
59
+
60
+ export { uploadProjectCredentials as a, uploadUserCredentials as u };
@@ -0,0 +1,60 @@
1
+ import axios from 'axios';
2
+ import { p as getAuthedHeaders, q as API_URL } from './index-Bv3x8c78.js';
3
+
4
+ async function getNewUploadTicket(projectId = null) {
5
+ const url = projectId ? `${API_URL}/projects/${projectId}/credentials/url` : `${API_URL}/credentials/url`;
6
+ const headers = getAuthedHeaders();
7
+ const { data: uploadInfo } = await axios({
8
+ method: "post",
9
+ url,
10
+ headers
11
+ });
12
+ return uploadInfo;
13
+ }
14
+ async function uploadUserCredentials({ contents, platform, type, serialNumber }) {
15
+ const uploadInfo = await getNewUploadTicket();
16
+ const jsonBuffer = Buffer.from(JSON.stringify(contents));
17
+ await axios.put(uploadInfo.url, jsonBuffer, {
18
+ headers: {
19
+ "Content-length": jsonBuffer.length,
20
+ "Content-Type": "application/json"
21
+ }
22
+ });
23
+ const headers = getAuthedHeaders();
24
+ return await axios({
25
+ method: "post",
26
+ url: `${API_URL}/credentials`,
27
+ headers,
28
+ data: {
29
+ platform,
30
+ type,
31
+ uuid: uploadInfo.uuid,
32
+ serialNumber
33
+ }
34
+ });
35
+ }
36
+ async function uploadProjectCredentials(projectId, { contents, platform, type, serialNumber, identifier }) {
37
+ const uploadInfo = await getNewUploadTicket(projectId);
38
+ const jsonBuffer = Buffer.from(JSON.stringify(contents));
39
+ await axios.put(uploadInfo.url, jsonBuffer, {
40
+ headers: {
41
+ "Content-length": jsonBuffer.length,
42
+ "Content-Type": "application/json"
43
+ }
44
+ });
45
+ const headers = getAuthedHeaders();
46
+ return await axios({
47
+ method: "post",
48
+ url: `${API_URL}/projects/${projectId}/credentials`,
49
+ headers,
50
+ data: {
51
+ platform,
52
+ type,
53
+ uuid: uploadInfo.uuid,
54
+ identifier,
55
+ serialNumber
56
+ }
57
+ });
58
+ }
59
+
60
+ export { uploadProjectCredentials as a, uploadUserCredentials as u };
@@ -0,0 +1,52 @@
1
+ import { p as getAuthedHeaders, q as API_URL } from './index-Bv3x8c78.js';
2
+ import axios from 'axios';
3
+ import { useQuery } from '@tanstack/react-query';
4
+
5
+ const cacheKeys = {
6
+ androidKeyTestResult: (props) => ["androidKeyTestResult", ...Object.values(props)],
7
+ androidSetupStatus: (props) => ["androidSetupStatus", ...Object.values(props)],
8
+ builds: (props) => ["builds", ...Object.values(props)],
9
+ googleStatus: () => ["googleStatus"],
10
+ job: (props) => ["job", ...Object.values(props)],
11
+ jobLogs: (props) => ["jobLogs", ...Object.values(props)],
12
+ jobs: (props) => ["jobs", ...Object.values(props)],
13
+ projectCredentials: (props) => ["projectCredentials", ...Object.values(props)],
14
+ userCredentials: (props) => ["userCredentials", ...Object.values(props)]
15
+ };
16
+
17
+ var KeyTestStatus = /* @__PURE__ */ ((KeyTestStatus2) => {
18
+ KeyTestStatus2["SUCCESS"] = "success";
19
+ KeyTestStatus2["ERROR"] = "error";
20
+ return KeyTestStatus2;
21
+ })(KeyTestStatus || {});
22
+ var KeyTestError = /* @__PURE__ */ ((KeyTestError2) => {
23
+ KeyTestError2["NO_SERVICE_ACCOUNT_KEY"] = "no_service_account_key";
24
+ KeyTestError2["NO_PACKAGE_NAME"] = "no_package_name";
25
+ KeyTestError2["APP_NOT_FOUND"] = "app_not_found";
26
+ KeyTestError2["NOT_INVITED"] = "not_invited";
27
+ return KeyTestError2;
28
+ })(KeyTestError || {});
29
+ const KeyTestErrorMessage = {
30
+ ["no_service_account_key" /* NO_SERVICE_ACCOUNT_KEY */]: "Service Account API Key not found in your account",
31
+ ["no_package_name" /* NO_PACKAGE_NAME */]: "Android Package Name has not been set",
32
+ ["app_not_found" /* APP_NOT_FOUND */]: "Application not found in Google Play Console",
33
+ ["not_invited" /* NOT_INVITED */]: "Service Account has not been invited to Google Play"
34
+ };
35
+ function niceError(keyError) {
36
+ return keyError ? KeyTestErrorMessage[keyError] : void 0;
37
+ }
38
+ const fetchKeyTestResult = async ({ projectId }, config) => {
39
+ if (!projectId) throw new Error("projectId is required");
40
+ const url = `${API_URL}/projects/${projectId}/credentials/android/key/test`;
41
+ const headers = getAuthedHeaders();
42
+ const { data } = await axios.post(url, {}, { headers, ...config });
43
+ return data;
44
+ };
45
+ const useAndroidServiceAccountTestResult = (props) => {
46
+ return useQuery({
47
+ queryKey: cacheKeys.androidKeyTestResult(props),
48
+ queryFn: () => fetchKeyTestResult(props)
49
+ });
50
+ };
51
+
52
+ export { KeyTestStatus as K, KeyTestError as a, cacheKeys as c, fetchKeyTestResult as f, niceError as n, useAndroidServiceAccountTestResult as u };
@@ -0,0 +1,52 @@
1
+ import { o as getAuthedHeaders, p as API_URL } from './index-C9734Cj2.js';
2
+ import axios from 'axios';
3
+ import { useQuery } from '@tanstack/react-query';
4
+
5
+ const cacheKeys = {
6
+ androidKeyTestResult: (props) => ["androidKeyTestResult", ...Object.values(props)],
7
+ androidSetupStatus: (props) => ["androidSetupStatus", ...Object.values(props)],
8
+ builds: (props) => ["builds", ...Object.values(props)],
9
+ googleStatus: () => ["googleStatus"],
10
+ job: (props) => ["job", ...Object.values(props)],
11
+ jobLogs: (props) => ["jobLogs", ...Object.values(props)],
12
+ jobs: (props) => ["jobs", ...Object.values(props)],
13
+ projectCredentials: (props) => ["projectCredentials", ...Object.values(props)],
14
+ userCredentials: (props) => ["userCredentials", ...Object.values(props)]
15
+ };
16
+
17
+ var KeyTestStatus = /* @__PURE__ */ ((KeyTestStatus2) => {
18
+ KeyTestStatus2["SUCCESS"] = "success";
19
+ KeyTestStatus2["ERROR"] = "error";
20
+ return KeyTestStatus2;
21
+ })(KeyTestStatus || {});
22
+ var KeyTestError = /* @__PURE__ */ ((KeyTestError2) => {
23
+ KeyTestError2["NO_SERVICE_ACCOUNT_KEY"] = "no_service_account_key";
24
+ KeyTestError2["NO_PACKAGE_NAME"] = "no_package_name";
25
+ KeyTestError2["APP_NOT_FOUND"] = "app_not_found";
26
+ KeyTestError2["NOT_INVITED"] = "not_invited";
27
+ return KeyTestError2;
28
+ })(KeyTestError || {});
29
+ const KeyTestErrorMessage = {
30
+ ["no_service_account_key" /* NO_SERVICE_ACCOUNT_KEY */]: "Service Account API Key not found in your account",
31
+ ["no_package_name" /* NO_PACKAGE_NAME */]: "Android Package Name has not been set",
32
+ ["app_not_found" /* APP_NOT_FOUND */]: "Application not found in Google Play Console",
33
+ ["not_invited" /* NOT_INVITED */]: "Service Account has not been invited to Google Play"
34
+ };
35
+ function niceError(keyError) {
36
+ return keyError ? KeyTestErrorMessage[keyError] : undefined;
37
+ }
38
+ const fetchKeyTestResult = async ({ projectId }, config) => {
39
+ if (!projectId) throw new Error("projectId is required");
40
+ const url = `${API_URL}/projects/${projectId}/credentials/android/key/test`;
41
+ const headers = getAuthedHeaders();
42
+ const { data } = await axios.post(url, {}, { headers, ...config });
43
+ return data;
44
+ };
45
+ const useAndroidServiceAccountTestResult = (props) => {
46
+ return useQuery({
47
+ queryKey: cacheKeys.androidKeyTestResult(props),
48
+ queryFn: () => fetchKeyTestResult(props)
49
+ });
50
+ };
51
+
52
+ export { KeyTestStatus as K, KeyTestError as a, cacheKeys as c, fetchKeyTestResult as f, niceError as n, useAndroidServiceAccountTestResult as u };
@@ -0,0 +1,52 @@
1
+ import { p as getAuthedHeaders, q as API_URL } from './index-BB7X1Pqp.js';
2
+ import axios from 'axios';
3
+ import { useQuery } from '@tanstack/react-query';
4
+
5
+ const cacheKeys = {
6
+ androidKeyTestResult: (props) => ["androidKeyTestResult", ...Object.values(props)],
7
+ androidSetupStatus: (props) => ["androidSetupStatus", ...Object.values(props)],
8
+ builds: (props) => ["builds", ...Object.values(props)],
9
+ googleStatus: () => ["googleStatus"],
10
+ job: (props) => ["job", ...Object.values(props)],
11
+ jobLogs: (props) => ["jobLogs", ...Object.values(props)],
12
+ jobs: (props) => ["jobs", ...Object.values(props)],
13
+ projectCredentials: (props) => ["projectCredentials", ...Object.values(props)],
14
+ userCredentials: (props) => ["userCredentials", ...Object.values(props)]
15
+ };
16
+
17
+ var KeyTestStatus = /* @__PURE__ */ ((KeyTestStatus2) => {
18
+ KeyTestStatus2["SUCCESS"] = "success";
19
+ KeyTestStatus2["ERROR"] = "error";
20
+ return KeyTestStatus2;
21
+ })(KeyTestStatus || {});
22
+ var KeyTestError = /* @__PURE__ */ ((KeyTestError2) => {
23
+ KeyTestError2["NO_SERVICE_ACCOUNT_KEY"] = "no_service_account_key";
24
+ KeyTestError2["NO_PACKAGE_NAME"] = "no_package_name";
25
+ KeyTestError2["APP_NOT_FOUND"] = "app_not_found";
26
+ KeyTestError2["NOT_INVITED"] = "not_invited";
27
+ return KeyTestError2;
28
+ })(KeyTestError || {});
29
+ const KeyTestErrorMessage = {
30
+ ["no_service_account_key" /* NO_SERVICE_ACCOUNT_KEY */]: "Service Account API Key not found in your account",
31
+ ["no_package_name" /* NO_PACKAGE_NAME */]: "Android Package Name has not been set",
32
+ ["app_not_found" /* APP_NOT_FOUND */]: "Application not found in Google Play Console",
33
+ ["not_invited" /* NOT_INVITED */]: "Service Account has not been invited to Google Play"
34
+ };
35
+ function niceError(keyError) {
36
+ return keyError ? KeyTestErrorMessage[keyError] : void 0;
37
+ }
38
+ const fetchKeyTestResult = async ({ projectId }, config) => {
39
+ if (!projectId) throw new Error("projectId is required");
40
+ const url = `${API_URL}/projects/${projectId}/credentials/android/key/test`;
41
+ const headers = getAuthedHeaders();
42
+ const { data } = await axios.post(url, {}, { headers, ...config });
43
+ return data;
44
+ };
45
+ const useAndroidServiceAccountTestResult = (props) => {
46
+ return useQuery({
47
+ queryKey: cacheKeys.androidKeyTestResult(props),
48
+ queryFn: () => fetchKeyTestResult(props)
49
+ });
50
+ };
51
+
52
+ export { KeyTestStatus as K, KeyTestError as a, cacheKeys as c, fetchKeyTestResult as f, niceError as n, useAndroidServiceAccountTestResult as u };
@@ -0,0 +1,32 @@
1
+ import { useQuery } from '@tanstack/react-query';
2
+ import { f as App } from './index-BB7X1Pqp.js';
3
+
4
+ const queryAppleApp = async ({ ctx, iosBundleId }) => {
5
+ if (!iosBundleId) {
6
+ return { app: null, summary: null };
7
+ }
8
+ const app = await App.findAsync(ctx, {
9
+ bundleId: iosBundleId
10
+ });
11
+ if (!app) {
12
+ return { app: null, summary: null };
13
+ }
14
+ return {
15
+ app,
16
+ summary: {
17
+ id: app.id,
18
+ name: app.attributes.name,
19
+ bundleId: app.attributes.bundleId,
20
+ primaryLocale: app.attributes.primaryLocale
21
+ }
22
+ };
23
+ };
24
+ const useAppleApp = (props) => {
25
+ const queryResult = useQuery({
26
+ queryKey: ["appleApp", props.iosBundleId],
27
+ queryFn: () => queryAppleApp(props)
28
+ });
29
+ return queryResult;
30
+ };
31
+
32
+ export { queryAppleApp as q, useAppleApp as u };
@@ -0,0 +1,32 @@
1
+ import { useQuery } from '@tanstack/react-query';
2
+ import { f as App } from './index-C9734Cj2.js';
3
+
4
+ const queryAppleApp = async ({ ctx, iosBundleId }) => {
5
+ if (!iosBundleId) {
6
+ return { app: null, summary: null };
7
+ }
8
+ const app = await App.findAsync(ctx, {
9
+ bundleId: iosBundleId
10
+ });
11
+ if (!app) {
12
+ return { app: null, summary: null };
13
+ }
14
+ return {
15
+ app,
16
+ summary: {
17
+ id: app.id,
18
+ name: app.attributes.name,
19
+ bundleId: app.attributes.bundleId,
20
+ primaryLocale: app.attributes.primaryLocale
21
+ }
22
+ };
23
+ };
24
+ const useAppleApp = (props) => {
25
+ const queryResult = useQuery({
26
+ queryKey: ["appleApp", props.iosBundleId],
27
+ queryFn: () => queryAppleApp(props)
28
+ });
29
+ return queryResult;
30
+ };
31
+
32
+ export { queryAppleApp as q, useAppleApp as u };