shipthis 0.1.2 → 0.1.4
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/assets/markdown/android-success.md +17 -0
- package/assets/markdown/create-google-play-game.md +20 -0
- package/assets/markdown/invite-service-account.md +11 -0
- package/assets/markdown/privacy-notification.md +10 -0
- package/bin/alias-built.sh +10 -0
- package/dist/{AppleBundleIdDetails-BF-Pm1Ia.js → AppleBundleIdDetails-C0XqjxKJ.js} +5 -6
- package/dist/AppleBundleIdDetails-Dxo99Sgu.js +72 -0
- package/dist/Command-1YAl_0zS.js +204 -0
- package/dist/Command-Cl-JfhTy.js +203 -0
- package/dist/{CommandGame-D9wl8hfX.js → CommandGame--SAa3wEL.js} +1 -1
- package/dist/CommandGame-CZUx_VQu.js +8 -0
- package/dist/CreateKeystore-BqJdpvsI.js +56 -0
- package/dist/CreateKeystore-Dm0KVh85.js +56 -0
- package/dist/{NextSteps-DKcjSHZ3.js → NextSteps-CK9zHOCt.js} +1 -1
- package/dist/{ProjectCredentialsTable-BVvkIPjN.js → ProjectCredentialsTable-Ch8022rs.js} +3 -2
- package/dist/RunWithSpinner-BVXNWGD3.js +27 -0
- package/dist/{StatusTable-BzsNF75L.js → StatusTable-Dm5St4g-.js} +1 -1
- package/dist/Title-BCQtayg6.js +6 -0
- package/dist/{UserCredentialsTable-DUFQqHVt.js → UserCredentialsTable-ysmM5dlV.js} +4 -4
- package/dist/{baseAppleCommand-BSJhK8GA.js → baseAppleCommand-B3WQtlx-.js} +1 -1
- package/dist/{baseGameAndroidCommand-CPAtReqy.js → baseGameAndroidCommand-B-CFhPnE.js} +2 -2
- package/dist/commands/apple/apiKey/create.js +12 -12
- package/dist/commands/apple/apiKey/export.js +11 -11
- package/dist/commands/apple/apiKey/import.js +11 -11
- package/dist/commands/apple/apiKey/status.js +12 -13
- package/dist/commands/apple/certificate/create.js +12 -12
- package/dist/commands/apple/certificate/export.js +11 -11
- package/dist/commands/apple/certificate/import.js +11 -11
- package/dist/commands/apple/certificate/status.js +11 -12
- package/dist/commands/apple/login.js +2 -2
- package/dist/commands/apple/status.js +12 -13
- package/dist/commands/dashboard.js +1 -1
- package/dist/commands/game/android/apiKey/connect.js +12 -12
- package/dist/commands/game/android/apiKey/create.js +14 -12
- package/dist/commands/game/android/apiKey/export.js +12 -12
- package/dist/commands/game/android/apiKey/import.js +12 -12
- package/dist/commands/game/android/apiKey/invite.js +4 -4
- package/dist/commands/game/android/apiKey/status.js +12 -12
- package/dist/commands/game/android/keyStore/create.js +12 -11
- package/dist/commands/game/android/keyStore/export.js +11 -11
- package/dist/commands/game/android/keyStore/import.js +11 -11
- package/dist/commands/game/android/keyStore/status.js +11 -11
- package/dist/commands/game/android/status.js +13 -14
- package/dist/commands/game/android/wizard.js +533 -20
- package/dist/commands/game/build/download.js +10 -11
- package/dist/commands/game/build/list.js +10 -11
- package/dist/commands/game/create.js +2 -2
- package/dist/commands/game/details.js +10 -11
- package/dist/commands/game/export.js +1 -1
- package/dist/commands/game/ios/app/addTester.js +10 -11
- package/dist/commands/game/ios/app/create.js +9 -10
- package/dist/commands/game/ios/app/status.js +13 -14
- package/dist/commands/game/ios/app/sync.js +10 -11
- package/dist/commands/game/ios/profile/create.js +12 -12
- package/dist/commands/game/ios/profile/export.js +11 -11
- package/dist/commands/game/ios/profile/import.js +11 -11
- package/dist/commands/game/ios/profile/status.js +12 -12
- package/dist/commands/game/ios/status.js +16 -17
- package/dist/commands/game/ios/wizard.js +2 -2
- package/dist/commands/game/job/list.js +8 -10
- package/dist/commands/game/job/status.js +14 -13
- package/dist/commands/game/list.js +8 -10
- package/dist/commands/game/ship.js +2 -2
- package/dist/commands/game/status.js +13 -14
- package/dist/commands/game/wizard.js +1 -1
- package/dist/commands/internal/fastlane.js +1 -1
- package/dist/commands/internal/readme.js +1 -1
- package/dist/commands/login.js +2 -2
- package/dist/commands/status.js +11 -11
- package/dist/{export-B0FJT0EU.js → export-BiLHgSJ9.js} +1 -1
- package/dist/{import-CLDJ2iPu.js → import-CxNikF1c.js} +1 -1
- package/dist/index-B5XHQfs2.js +122 -0
- package/dist/{index-Df8uXQ4s.js → index-B6V7vGOj.js} +1 -1
- package/dist/{index-CF0fIsx2.js → index-BQRxiyqn.js} +1 -1
- package/dist/{index-CFHmtzfq.js → index-BuZmCvZh.js} +1 -1
- package/dist/index-CgBgZUkL.js +144 -0
- package/dist/index-DE2Hvx2o.js +122 -0
- package/dist/index-X__XH_Fd.js +144 -0
- package/dist/{upload-C5L82Yq0.js → upload-CMo3hUhl.js} +1 -1
- package/dist/{useAndroidServiceAccountTestResult-BnxNuoG3.js → useAndroidServiceAccountTestResult-D_30xIJA.js} +1 -1
- package/dist/{useAppleApp-IXRdsK5w.js → useAppleApp-DnSjUfSs.js} +1 -1
- package/dist/{useAppleBundleId-DYC5ISKT.js → useAppleBundleId-BNI8swhC.js} +1 -1
- package/dist/useJobWatching-BcBJ5dy1.js +43 -0
- package/dist/useJobWatching-Bz1e6xOv.js +43 -0
- package/dist/useProjectCredentials-B5ZmpIxL.js +54 -0
- package/dist/useWebSocket-DoImIdTy.js +36 -0
- package/npm-shrinkwrap.json +2 -2
- package/oclif.manifest.json +105 -105
- package/package.json +3 -2
- package/dist/Command-BrfJSeOC.js +0 -1077
|
@@ -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 { S as getGoogleStatus, a1 as getShortAuthRequiredUrl, a2 as getGoogleAuthUrl, Z as WEB_URL } from './index-BQRxiyqn.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-DoImIdTy.js';
|
|
21
|
+
import { c as cacheKeys } from './useAndroidServiceAccountTestResult-D_30xIJA.js';
|
|
22
|
+
import 'isomorphic-git';
|
|
23
|
+
import '@oclif/core';
|
|
24
|
+
import { a as GameContext, M as Markdown } from './Command-1YAl_0zS.js';
|
|
25
|
+
import 'ink-spinner';
|
|
26
|
+
import '@inkjs/ui';
|
|
27
|
+
import qrcode from 'qrcode';
|
|
28
|
+
import 'string-length';
|
|
29
|
+
import 'strip-ansi';
|
|
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,144 @@
|
|
|
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 { a as GameContext } from './Command-1YAl_0zS.js';
|
|
6
|
+
import { p as getAuthedHeaders, q as API_URL, O as castObjectDates, P as Platform, C as CredentialsType, S as getGoogleStatus } from './index-BQRxiyqn.js';
|
|
7
|
+
import axios from 'axios';
|
|
8
|
+
import 'crypto-js';
|
|
9
|
+
import 'uuid';
|
|
10
|
+
import 'luxon';
|
|
11
|
+
import 'fs';
|
|
12
|
+
import { ProgressBar } from '@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-D_30xIJA.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-DoImIdTy.js';
|
|
27
|
+
import { u as useProjectCredentials } from './useProjectCredentials-B5ZmpIxL.js';
|
|
28
|
+
import 'qrcode';
|
|
29
|
+
import 'string-length';
|
|
30
|
+
import 'strip-ansi';
|
|
31
|
+
|
|
32
|
+
async function fetchStatus({ projectId }) {
|
|
33
|
+
try {
|
|
34
|
+
if (!projectId) throw new Error("projectId is required");
|
|
35
|
+
const headers = getAuthedHeaders();
|
|
36
|
+
const url = `${API_URL}/projects/${projectId}/credentials/android/key/status/`;
|
|
37
|
+
const response = await axios.get(url, { headers });
|
|
38
|
+
return castObjectDates(response.data);
|
|
39
|
+
} catch (error) {
|
|
40
|
+
console.warn("fetchStatus Error", error);
|
|
41
|
+
throw error;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
const useAndroidServiceAccountSetupStatus = (props) => {
|
|
45
|
+
return useQuery({
|
|
46
|
+
queryKey: cacheKeys.androidSetupStatus(props),
|
|
47
|
+
queryFn: () => fetchStatus(props),
|
|
48
|
+
// Status changes frequently, so we want to keep it fresh
|
|
49
|
+
refetchInterval: 1e3 * 5,
|
|
50
|
+
staleTime: 1e3 * 5
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const ERR_NOT_AUTHENTICATED = "You must be connected to Google to create a Service Account Key";
|
|
55
|
+
const useHasServiceAccountKey = (projectId) => {
|
|
56
|
+
const { data, isSuccess } = useProjectCredentials({ projectId, platform: Platform.ANDROID });
|
|
57
|
+
return isSuccess && data.data.some((cred) => cred.isActive && cred.platform === Platform.ANDROID && cred.type == CredentialsType.KEY);
|
|
58
|
+
};
|
|
59
|
+
const useAndroidServiceAccount = ({ projectId, onError, onComplete }) => {
|
|
60
|
+
const queryClient = useQueryClient();
|
|
61
|
+
const [isStarting, setIsStarting] = useState(false);
|
|
62
|
+
const hasServiceAccountKey = useHasServiceAccountKey(projectId);
|
|
63
|
+
const listener = {
|
|
64
|
+
getPattern: () => `project.${projectId}:android-setup-status`,
|
|
65
|
+
eventHandler: async (pattern, data) => {
|
|
66
|
+
const key = cacheKeys.androidSetupStatus({ projectId });
|
|
67
|
+
queryClient.setQueryData(key, () => data);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
useWebSocket([listener]);
|
|
71
|
+
const { data: setupStatus } = useAndroidServiceAccountSetupStatus({ projectId });
|
|
72
|
+
const prevSetupStatusRef = useRef("unknown");
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
if (["running", "queued"].includes(prevSetupStatusRef.current)) {
|
|
75
|
+
if (setupStatus?.status === "complete") onComplete();
|
|
76
|
+
if (setupStatus?.status === "error") onError(new Error(setupStatus.errorMessage));
|
|
77
|
+
}
|
|
78
|
+
prevSetupStatusRef.current = setupStatus?.status || "unknown";
|
|
79
|
+
}, [setupStatus]);
|
|
80
|
+
const handleStart = async () => {
|
|
81
|
+
try {
|
|
82
|
+
setIsStarting(true);
|
|
83
|
+
const currentStatus = await getGoogleStatus();
|
|
84
|
+
if (!currentStatus.isAuthenticated) throw new Error(ERR_NOT_AUTHENTICATED);
|
|
85
|
+
const headers = getAuthedHeaders();
|
|
86
|
+
const androidKeyApiBase = `${API_URL}/projects/${projectId}/credentials/android/key`;
|
|
87
|
+
const startUrl = `${androidKeyApiBase}/setup/`;
|
|
88
|
+
const { data: updatedStatus } = await axios.post(startUrl, {}, { headers });
|
|
89
|
+
queryClient.invalidateQueries({
|
|
90
|
+
queryKey: cacheKeys.projectCredentials({ projectId, pageNumber: 0 })
|
|
91
|
+
});
|
|
92
|
+
await queryClient.setQueryData(cacheKeys.androidSetupStatus({ projectId }), (_) => updatedStatus);
|
|
93
|
+
setIsStarting(false);
|
|
94
|
+
return true;
|
|
95
|
+
} catch (error) {
|
|
96
|
+
setIsStarting(false);
|
|
97
|
+
console.warn("useAndroidServiceAccount.handleStart Error", error);
|
|
98
|
+
onError(error);
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
const isCreating = isStarting || setupStatus?.status === "queued" || setupStatus?.status === "running";
|
|
103
|
+
return {
|
|
104
|
+
handleStart,
|
|
105
|
+
setupStatus,
|
|
106
|
+
isCreating,
|
|
107
|
+
hasServiceAccountKey
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
const ProgressSpinner = ({ progress, label, spinnerType, labelProps, boxProps }) => /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(Box, { flexDirection: "column", gap: 1, ...boxProps, children: /* @__PURE__ */ jsxs(Box, { flexDirection: "row", gap: 1, children: [
|
|
112
|
+
label && label != "" && /* @__PURE__ */ jsx(Text, { ...labelProps, children: label }),
|
|
113
|
+
/* @__PURE__ */ jsx(ProgressBar, { value: progress || 0 }),
|
|
114
|
+
/* @__PURE__ */ jsxs(Text, { children: [
|
|
115
|
+
Math.floor(progress || 0),
|
|
116
|
+
"%"
|
|
117
|
+
] }),
|
|
118
|
+
/* @__PURE__ */ jsx(Spinner, { type: spinnerType })
|
|
119
|
+
] }) }) });
|
|
120
|
+
|
|
121
|
+
const CreateServiceAccountKey = (props) => {
|
|
122
|
+
const { gameId } = useContext(GameContext);
|
|
123
|
+
return /* @__PURE__ */ jsx(Fragment, { children: gameId && /* @__PURE__ */ jsx(CreateForGame, { gameId, ...props }) });
|
|
124
|
+
};
|
|
125
|
+
const CreateForGame = ({ onComplete, onError, gameId, ...boxProps }) => {
|
|
126
|
+
const [didStart, setDidStart] = useState(false);
|
|
127
|
+
const { handleStart, setupStatus, isCreating } = useAndroidServiceAccount({
|
|
128
|
+
projectId: gameId,
|
|
129
|
+
onError,
|
|
130
|
+
onComplete
|
|
131
|
+
});
|
|
132
|
+
useEffect(() => {
|
|
133
|
+
handleStart().then(() => setDidStart(true));
|
|
134
|
+
}, [gameId]);
|
|
135
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(Box, { flexDirection: "column", gap: 1, ...boxProps, children: [
|
|
136
|
+
/* @__PURE__ */ jsxs(Box, { flexDirection: "row", gap: 1, children: [
|
|
137
|
+
/* @__PURE__ */ jsx(Text, { children: "Creating a Service Account and API Key..." }),
|
|
138
|
+
isCreating && /* @__PURE__ */ jsx(Spinner, { type: "dots" })
|
|
139
|
+
] }),
|
|
140
|
+
didStart && /* @__PURE__ */ jsx(ProgressSpinner, { progress: (setupStatus?.progress || 0) * 100, spinnerType: "dots" })
|
|
141
|
+
] }) });
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
export { CreateServiceAccountKey as C, ProgressSpinner as P };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
|
-
import { p as getAuthedHeaders, q as API_URL } from './index-
|
|
2
|
+
import { p as getAuthedHeaders, q as API_URL } from './index-BQRxiyqn.js';
|
|
3
3
|
|
|
4
4
|
async function getNewUploadTicket(projectId = null) {
|
|
5
5
|
const url = projectId ? `${API_URL}/projects/${projectId}/credentials/url` : `${API_URL}/credentials/url`;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useQuery } from '@tanstack/react-query';
|
|
2
|
-
import { e as BundleId, r as getGodotProjectCapabilities, P as Platform, G as GODOT_CAPABILITIES, s as CapabilityType } from './index-
|
|
2
|
+
import { e as BundleId, r as getGodotProjectCapabilities, P as Platform, G as GODOT_CAPABILITIES, s as CapabilityType } from './index-BQRxiyqn.js';
|
|
3
3
|
|
|
4
4
|
async function getBundleIdCapabilities(bundleId) {
|
|
5
5
|
const current = await bundleId.getBundleIdCapabilitiesAsync();
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { u as useJob } from './Command-1YAl_0zS.js';
|
|
2
|
+
import { useState, useEffect } from 'react';
|
|
3
|
+
import { u as useWebSocket } from './useWebSocket-DoImIdTy.js';
|
|
4
|
+
import { N as castJobDates, O as castObjectDates } from './index-BQRxiyqn.js';
|
|
5
|
+
|
|
6
|
+
function useJobWatching({ projectId, jobId, isWatching, onJobUpdate }) {
|
|
7
|
+
const [websocketJob, setWebsocketJob] = useState(null);
|
|
8
|
+
const [mostRecentLog, setMostRecentLog] = useState(null);
|
|
9
|
+
const jobStatusListener = {
|
|
10
|
+
getPattern: () => [`project.${projectId}:job:created`, `project.${projectId}:job:updated`],
|
|
11
|
+
eventHandler: async (pattern, rawJob) => {
|
|
12
|
+
if (rawJob.id !== jobId) return;
|
|
13
|
+
const job2 = castJobDates(rawJob);
|
|
14
|
+
setWebsocketJob(job2);
|
|
15
|
+
if (onJobUpdate) onJobUpdate(job2);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
const jobProgressListener = {
|
|
19
|
+
getPattern: () => `project.${projectId}:job.${jobId}:log`,
|
|
20
|
+
eventHandler: async (pattern, rawLogEntry) => {
|
|
21
|
+
const logEntry = castObjectDates(rawLogEntry, ["sentAt", "createdAt"]);
|
|
22
|
+
setMostRecentLog(logEntry);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
useWebSocket(isWatching ? [jobStatusListener, jobProgressListener] : []);
|
|
26
|
+
const { isLoading, data: job } = useJob({
|
|
27
|
+
projectId,
|
|
28
|
+
jobId
|
|
29
|
+
});
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
setWebsocketJob(null);
|
|
32
|
+
}, [jobId, projectId, isWatching, job]);
|
|
33
|
+
const fetchedJob = job ? job : null;
|
|
34
|
+
const data = websocketJob ? websocketJob : fetchedJob;
|
|
35
|
+
const progress = mostRecentLog?.progress || null;
|
|
36
|
+
return {
|
|
37
|
+
isLoading,
|
|
38
|
+
data,
|
|
39
|
+
progress
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export { useJobWatching as u };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { u as useJob } from './Command-Cl-JfhTy.js';
|
|
2
|
+
import { useState, useEffect } from 'react';
|
|
3
|
+
import { u as useWebSocket } from './useWebSocket-DoImIdTy.js';
|
|
4
|
+
import { N as castJobDates, O as castObjectDates } from './index-BQRxiyqn.js';
|
|
5
|
+
|
|
6
|
+
function useJobWatching({ projectId, jobId, isWatching, onJobUpdate }) {
|
|
7
|
+
const [websocketJob, setWebsocketJob] = useState(null);
|
|
8
|
+
const [mostRecentLog, setMostRecentLog] = useState(null);
|
|
9
|
+
const jobStatusListener = {
|
|
10
|
+
getPattern: () => [`project.${projectId}:job:created`, `project.${projectId}:job:updated`],
|
|
11
|
+
eventHandler: async (pattern, rawJob) => {
|
|
12
|
+
if (rawJob.id !== jobId) return;
|
|
13
|
+
const job2 = castJobDates(rawJob);
|
|
14
|
+
setWebsocketJob(job2);
|
|
15
|
+
if (onJobUpdate) onJobUpdate(job2);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
const jobProgressListener = {
|
|
19
|
+
getPattern: () => `project.${projectId}:job.${jobId}:log`,
|
|
20
|
+
eventHandler: async (pattern, rawLogEntry) => {
|
|
21
|
+
const logEntry = castObjectDates(rawLogEntry, ["sentAt", "createdAt"]);
|
|
22
|
+
setMostRecentLog(logEntry);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
useWebSocket(isWatching ? [jobStatusListener, jobProgressListener] : []);
|
|
26
|
+
const { isLoading, data: job } = useJob({
|
|
27
|
+
projectId,
|
|
28
|
+
jobId
|
|
29
|
+
});
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
setWebsocketJob(null);
|
|
32
|
+
}, [jobId, projectId, isWatching, job]);
|
|
33
|
+
const fetchedJob = job ? job : null;
|
|
34
|
+
const data = websocketJob ? websocketJob : fetchedJob;
|
|
35
|
+
const progress = mostRecentLog?.progress || null;
|
|
36
|
+
return {
|
|
37
|
+
isLoading,
|
|
38
|
+
data,
|
|
39
|
+
progress
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export { useJobWatching as u };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import { useQuery } from '@tanstack/react-query';
|
|
3
|
+
import { c as cacheKeys } from './useAndroidServiceAccountTestResult-D_30xIJA.js';
|
|
4
|
+
import { b as getShortDate, p as getAuthedHeaders, q as API_URL, J as castArrayObjectDates } from './index-BQRxiyqn.js';
|
|
5
|
+
import { g as getShortUUID } from './index-B6V7vGOj.js';
|
|
6
|
+
|
|
7
|
+
async function queryProjectCredentials({
|
|
8
|
+
projectId,
|
|
9
|
+
...pageAndSortParams
|
|
10
|
+
}) {
|
|
11
|
+
try {
|
|
12
|
+
const headers = getAuthedHeaders();
|
|
13
|
+
const url = `${API_URL}/projects/${projectId}/credentials`;
|
|
14
|
+
const response = await axios.get(url, { headers, params: pageAndSortParams });
|
|
15
|
+
return {
|
|
16
|
+
...response.data,
|
|
17
|
+
data: castArrayObjectDates(response.data.data)
|
|
18
|
+
};
|
|
19
|
+
} catch (error) {
|
|
20
|
+
console.warn("queryProjectCredentials Error", error);
|
|
21
|
+
throw error;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function getProjectCredentialSummary(credential) {
|
|
25
|
+
return {
|
|
26
|
+
id: getShortUUID(credential.id),
|
|
27
|
+
type: credential.type,
|
|
28
|
+
serial: credential.serialNumber.substring(0, 30) + (credential.serialNumber.length > 30 ? "\u2026" : ""),
|
|
29
|
+
isActive: credential.isActive,
|
|
30
|
+
createdAt: getShortDate(credential.createdAt)
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
const useProjectCredentials = ({
|
|
34
|
+
platform,
|
|
35
|
+
type,
|
|
36
|
+
...fetchProps
|
|
37
|
+
}) => {
|
|
38
|
+
const queryResult = useQuery({
|
|
39
|
+
queryKey: cacheKeys.projectCredentials(fetchProps),
|
|
40
|
+
queryFn: async () => queryProjectCredentials(fetchProps),
|
|
41
|
+
select: (data) => {
|
|
42
|
+
if (!(platform || type)) return data;
|
|
43
|
+
return {
|
|
44
|
+
...data,
|
|
45
|
+
data: data.data.filter((credential) => {
|
|
46
|
+
return (!platform || credential.platform === platform) && (!type || credential.type === type);
|
|
47
|
+
})
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
return queryResult;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export { getProjectCredentialSummary as g, useProjectCredentials as u };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { io } from 'socket.io-client';
|
|
3
|
+
import { Q as getAuthToken, W as WS_URL } from './index-BQRxiyqn.js';
|
|
4
|
+
|
|
5
|
+
function useWebSocket(listeners = []) {
|
|
6
|
+
const log = () => {
|
|
7
|
+
};
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
if (listeners.length === 0) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
const token = getAuthToken();
|
|
13
|
+
const socket = io(WS_URL, {
|
|
14
|
+
auth: { token },
|
|
15
|
+
forceNew: true
|
|
16
|
+
});
|
|
17
|
+
socket.on("connect", () => log());
|
|
18
|
+
for (const listener of listeners) {
|
|
19
|
+
const pattern = listener.getPattern();
|
|
20
|
+
const bindSocket = (pattern2) => {
|
|
21
|
+
const boundListener = listener.eventHandler.bind(listener, pattern2);
|
|
22
|
+
socket.on(pattern2, boundListener);
|
|
23
|
+
};
|
|
24
|
+
if (Array.isArray(pattern)) {
|
|
25
|
+
pattern.forEach(bindSocket);
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
bindSocket(pattern);
|
|
29
|
+
}
|
|
30
|
+
return () => {
|
|
31
|
+
socket.disconnect();
|
|
32
|
+
};
|
|
33
|
+
}, []);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export { useWebSocket as u };
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shipthis",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "shipthis",
|
|
9
|
-
"version": "0.1.
|
|
9
|
+
"version": "0.1.4",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@expo/apple-utils": "2.0.3",
|