shipthis 0.1.31 → 0.1.33

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 (84) hide show
  1. package/dist/{AppleBundleIdDetails-eoK5F8Qn.js → AppleBundleIdDetails-BhHPCvRm.js} +17 -19
  2. package/dist/Command-BDIkuv2g.js +29 -0
  3. package/dist/CommandGame-CvBIjPZp.js +7 -0
  4. package/dist/{Create-ISdroJ3G.js → Create-Lpe0B8nT.js} +20 -20
  5. package/dist/GameStatus-5XpufIY_.js +137 -0
  6. package/dist/{Import-CfThJF6k.js → Import-DFzrAG04.js} +34 -36
  7. package/dist/{JobLogTail-BWzbQBZz.js → JobLogTail-BYcJgPcL.js} +53 -52
  8. package/dist/{JobProgress-DjIkuk5U.js → JobProgress-BcrE7CUK.js} +40 -38
  9. package/dist/{JobStatusTable-CEqWU73q.js → JobStatusTable-Bi-y8ZZT.js} +14 -13
  10. package/dist/{NextSteps-CK9zHOCt.js → NextSteps-DbJHmscQ.js} +1 -3
  11. package/dist/{ProgressSpinner-6pw1T8Iw.js → ProgressSpinner-Um6ARKlk.js} +2 -2
  12. package/dist/{ProjectCredentialsTable-u9ruZ9mN.js → ProjectCredentialsTable-B4vDJl4l.js} +11 -10
  13. package/dist/{StatusTable-Dm5St4g-.js → StatusTable-DzRWcMr4.js} +7 -9
  14. package/dist/{Table-CvM6pccN.js → Table-FaNgpyeq.js} +15 -15
  15. package/dist/{UserCredentialsTable-Q7u9M-ap.js → UserCredentialsTable-CwkZTFBD.js} +18 -19
  16. package/dist/{baseAppleCommand-zhkGlKq0.js → baseAppleCommand-BKXweb-U.js} +1 -1
  17. package/dist/{baseGameAndroidCommand-DJ-cMLa_.js → baseGameAndroidCommand-CAi-BSsH.js} +23 -23
  18. package/dist/commands/apple/apiKey/create.js +36 -36
  19. package/dist/commands/apple/apiKey/export.js +27 -27
  20. package/dist/commands/apple/apiKey/import.js +28 -28
  21. package/dist/commands/apple/apiKey/status.js +32 -32
  22. package/dist/commands/apple/certificate/create.js +40 -40
  23. package/dist/commands/apple/certificate/export.js +27 -27
  24. package/dist/commands/apple/certificate/import.js +28 -28
  25. package/dist/commands/apple/certificate/status.js +33 -33
  26. package/dist/commands/apple/login.js +15 -15
  27. package/dist/commands/apple/status.js +27 -27
  28. package/dist/commands/dashboard.js +10 -10
  29. package/dist/commands/game/android/apiKey/connect.js +28 -28
  30. package/dist/commands/game/android/apiKey/create.js +29 -29
  31. package/dist/commands/game/android/apiKey/export.js +30 -30
  32. package/dist/commands/game/android/apiKey/import.js +32 -32
  33. package/dist/commands/game/android/apiKey/invite.js +14 -14
  34. package/dist/commands/game/android/apiKey/status.js +30 -30
  35. package/dist/commands/game/android/keyStore/create.js +25 -25
  36. package/dist/commands/game/android/keyStore/export.js +29 -29
  37. package/dist/commands/game/android/keyStore/import.js +36 -36
  38. package/dist/commands/game/android/keyStore/status.js +26 -26
  39. package/dist/commands/game/android/status.js +15 -58
  40. package/dist/commands/game/build/download.js +24 -24
  41. package/dist/commands/game/build/list.js +37 -37
  42. package/dist/commands/game/create.js +15 -15
  43. package/dist/commands/game/details.js +35 -36
  44. package/dist/commands/game/export.js +12 -12
  45. package/dist/commands/game/ios/app/addTester.js +37 -32
  46. package/dist/commands/game/ios/app/create.js +24 -24
  47. package/dist/commands/game/ios/app/status.js +29 -29
  48. package/dist/commands/game/ios/app/sync.js +31 -31
  49. package/dist/commands/game/ios/profile/create.js +32 -32
  50. package/dist/commands/game/ios/profile/export.js +29 -29
  51. package/dist/commands/game/ios/profile/import.js +33 -33
  52. package/dist/commands/game/ios/profile/status.js +36 -36
  53. package/dist/commands/game/ios/status.js +46 -58
  54. package/dist/commands/game/ios/wizard.js +39 -34
  55. package/dist/commands/game/job/list.js +34 -34
  56. package/dist/commands/game/job/status.js +32 -32
  57. package/dist/commands/game/list.js +38 -40
  58. package/dist/commands/game/ship.js +81 -77
  59. package/dist/commands/game/status.js +38 -85
  60. package/dist/commands/game/wizard.js +253 -242
  61. package/dist/commands/internal/fastlane.js +15 -17
  62. package/dist/commands/internal/readme.js +38 -36
  63. package/dist/commands/login.js +14 -14
  64. package/dist/commands/status.js +32 -30
  65. package/dist/{export-DZxo2_e_.js → export-DLQrUEBK.js} +5 -5
  66. package/dist/{git-DREGq-jc.js → git-BpsfNFZ_.js} +8 -8
  67. package/dist/{import-8pL1AF47.js → import-BoY5e0uJ.js} +14 -14
  68. package/dist/{index-DJ078v-U.js → index-B27WJDxn.js} +43 -27
  69. package/dist/{index-DKQjnJrC.js → index-CisLwc7e.js} +42 -44
  70. package/dist/{index-C6aAyrXW.js → index-Crv7S0bl.js} +6 -6
  71. package/dist/{index-BHh0BZvD.js → index-DC0GJtAy.js} +50 -60
  72. package/dist/{index-CyvGh-kt.js → index-DfUg5j06.js} +93 -92
  73. package/dist/{index-w3lHxk5O.js → index-pj8JVg5X.js} +242 -225
  74. package/dist/{upload-BTpxj3QP.js → upload-C8S17EU_.js} +22 -22
  75. package/dist/{useAndroidServiceAccountTestResult-Dy3Ag7_r.js → useAndroidServiceAccountTestResult-D4e5AKAZ.js} +11 -13
  76. package/dist/{useAppleApp-h1Ogi_qc.js → useAppleApp-Dr6URQvC.js} +4 -4
  77. package/dist/{useAppleBundleId-B3TTNap0.js → useAppleBundleId-DELAwSQp.js} +6 -6
  78. package/dist/{useProjectCredentials-DpeXZcHP.js → useProjectCredentials-BjvdJdQg.js} +10 -12
  79. package/dist/{useWebSocket-gyuCsore.js → useWebSocket-CRV7V69Q.js} +1 -1
  80. package/dist/utils/help.js +4 -4
  81. package/package.json +5 -4
  82. package/dist/Command-DFdHXDiU.js +0 -44
  83. package/dist/CommandGame-Dif-oSky.js +0 -9
  84. package/dist/{RunWithSpinner-BVXNWGD3.js → RunWithSpinner-gMVA07bZ.js} +2 -2
@@ -1,37 +1,37 @@
1
1
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
2
  import { Box, Text } from 'ink';
3
3
  import Spinner from 'ink-spinner';
4
- import './index-w3lHxk5O.js';
5
- import 'axios';
6
- import '@tanstack/react-query';
7
- import 'crypto';
8
- import 'fs';
9
- import 'readline-sync';
10
- import 'node:readline';
4
+ import '@inkjs/ui';
5
+ import 'node:crypto';
6
+ import 'node:fs';
11
7
  import 'node:path';
8
+ import 'node:readline';
12
9
  import 'node:url';
10
+ import 'readline-sync';
13
11
  import 'luxon';
12
+ import 'axios';
14
13
  import 'isomorphic-git';
14
+ import './index-pj8JVg5X.js';
15
15
  import '@oclif/core';
16
+ import '@tanstack/react-query';
16
17
  import 'react';
17
18
  import 'crypto-js';
18
19
  import 'uuid';
19
- import 'socket.io-client';
20
- import { u as useAppleApp } from './useAppleApp-h1Ogi_qc.js';
20
+ import { u as useAppleApp } from './useAppleApp-Dr6URQvC.js';
21
21
  import 'fast-glob';
22
22
  import 'yazl';
23
- import '@inkjs/ui';
24
- import './index-CyvGh-kt.js';
25
- import 'open';
26
- import { T as Table } from './Table-CvM6pccN.js';
23
+ import 'socket.io-client';
24
+ import 'fullscreen-ink';
25
+ import { T as Table } from './Table-FaNgpyeq.js';
27
26
  import { T as Title } from './Title-BCQtayg6.js';
28
27
  import 'string-length';
29
28
  import 'strip-ansi';
29
+ import 'open';
30
+ import './index-DfUg5j06.js';
30
31
  import 'marked';
31
32
  import 'marked-terminal';
32
- import 'path';
33
33
  import 'qrcode';
34
- import { u as useAppleBundleId } from './useAppleBundleId-B3TTNap0.js';
34
+ import { u as useAppleBundleId } from './useAppleBundleId-DELAwSQp.js';
35
35
 
36
36
  const AppleAppDetails = (props) => {
37
37
  const { data, isLoading } = useAppleApp(props);
@@ -44,7 +44,7 @@ const AppleAppDetails = (props) => {
44
44
 
45
45
  const AppleBundleIdDetails = (props) => {
46
46
  const { data, isLoading } = useAppleBundleId(props);
47
- const { bundleIdSummary, capabilitiesTable, shouldSyncCapabilities, capabilities } = data || {};
47
+ const { bundleIdSummary, capabilities, capabilitiesTable, shouldSyncCapabilities } = data || {};
48
48
  return /* @__PURE__ */ jsxs(Fragment, { children: [
49
49
  /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [
50
50
  /* @__PURE__ */ jsx(Title, { children: "BundleId Details (in the Apple Developer Portal)" }),
@@ -56,9 +56,7 @@ const AppleBundleIdDetails = (props) => {
56
56
  /* @__PURE__ */ jsx(
57
57
  Table,
58
58
  {
59
- data: capabilities.map((c) => {
60
- return { capability: `${c}` };
61
- })
59
+ data: capabilities.map((c) => ({ capability: `${c}` }))
62
60
  }
63
61
  )
64
62
  ] }),
@@ -0,0 +1,29 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { QueryClientProvider } from '@tanstack/react-query';
3
+ import { useScreenSize } from 'fullscreen-ink';
4
+ import { Box } from 'ink';
5
+ import { K as queryClient } from './index-pj8JVg5X.js';
6
+ import 'axios';
7
+ import 'node:fs';
8
+ import 'crypto-js';
9
+ import 'uuid';
10
+ import 'luxon';
11
+ import 'node:crypto';
12
+ import 'node:path';
13
+ import 'node:readline';
14
+ import 'node:url';
15
+ import 'readline-sync';
16
+ import 'isomorphic-git';
17
+ import '@oclif/core';
18
+ import 'react';
19
+ import 'socket.io-client';
20
+ import 'fast-glob';
21
+ import 'yazl';
22
+ import { b as CommandProvider } from './index-DfUg5j06.js';
23
+
24
+ const Command = ({ children, command }) => {
25
+ const { width } = useScreenSize();
26
+ return /* @__PURE__ */ jsx(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx(CommandProvider, { command, children: /* @__PURE__ */ jsx(Box, { flexDirection: "column", width, children }) }) });
27
+ };
28
+
29
+ export { Command as C };
@@ -0,0 +1,7 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { c as GameProvider } from './index-DfUg5j06.js';
3
+ import { C as Command } from './Command-BDIkuv2g.js';
4
+
5
+ const CommandGame = ({ children, command }) => /* @__PURE__ */ jsx(Command, { command, children: /* @__PURE__ */ jsx(GameProvider, { children }) });
6
+
7
+ export { CommandGame as C };
@@ -1,34 +1,34 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
- import { Box } from 'ink';
2
+ import { useQueryClient } from '@tanstack/react-query';
3
3
  import axios from 'axios';
4
+ import { Box } from 'ink';
4
5
  import { useContext } from 'react';
5
- import { useQueryClient } from '@tanstack/react-query';
6
- import { p as getAuthedHeaders, q as API_URL } from './index-w3lHxk5O.js';
7
- import { c as cacheKeys } from './useAndroidServiceAccountTestResult-Dy3Ag7_r.js';
8
- import { b as GameContext } from './index-CyvGh-kt.js';
6
+ import { p as getAuthedHeaders, o as API_URL } from './index-pj8JVg5X.js';
9
7
  import 'ink-spinner';
10
- import '@inkjs/ui';
11
- import 'fs';
12
- import 'uuid';
13
- import 'yazl';
14
- import 'crypto';
15
- import 'readline-sync';
16
- import 'node:readline';
8
+ import 'node:crypto';
9
+ import 'node:fs';
17
10
  import 'node:path';
11
+ import 'node:readline';
18
12
  import 'node:url';
13
+ import 'readline-sync';
19
14
  import 'luxon';
20
15
  import 'isomorphic-git';
21
16
  import '@oclif/core';
17
+ import { c as cacheKeys } from './useAndroidServiceAccountTestResult-D4e5AKAZ.js';
22
18
  import 'fast-glob';
19
+ import 'uuid';
20
+ import 'yazl';
23
21
  import 'socket.io-client';
22
+ import 'fullscreen-ink';
23
+ import 'string-length';
24
+ import 'strip-ansi';
24
25
  import 'open';
26
+ import '@inkjs/ui';
25
27
  import 'marked';
26
28
  import 'marked-terminal';
27
- import 'path';
28
29
  import 'qrcode';
29
- import { R as RunWithSpinner } from './RunWithSpinner-BVXNWGD3.js';
30
- import 'string-length';
31
- import 'strip-ansi';
30
+ import { R as RunWithSpinner } from './RunWithSpinner-gMVA07bZ.js';
31
+ import { G as GameContext } from './index-DfUg5j06.js';
32
32
 
33
33
  const CreateKeystore = ({ onComplete, onError, ...boxProps }) => {
34
34
  const { gameId } = useContext(GameContext);
@@ -40,17 +40,17 @@ const CreateKeystore = ({ onComplete, onError, ...boxProps }) => {
40
40
  await axios.post(`${API_URL}/projects/${gameId}/credentials/android/certificate`, null, {
41
41
  headers
42
42
  });
43
- queryClient.invalidateQueries({ queryKey: cacheKeys.projectCredentials({ projectId: gameId, pageNumber: 0 }) });
44
- } catch (err) {
45
- onError(err);
43
+ queryClient.invalidateQueries({ queryKey: cacheKeys.projectCredentials({ pageNumber: 0, projectId: gameId }) });
44
+ } catch (error) {
45
+ onError(error);
46
46
  }
47
47
  };
48
48
  return /* @__PURE__ */ jsx(Box, { flexDirection: "column", gap: 1, ...boxProps, children: gameId && /* @__PURE__ */ jsx(
49
49
  RunWithSpinner,
50
50
  {
51
51
  executeMethod: handleCreate,
52
- msgInProgress: "Creating Keystore...",
53
52
  msgComplete: "Keystore created",
53
+ msgInProgress: "Creating Keystore...",
54
54
  onComplete
55
55
  }
56
56
  ) });
@@ -0,0 +1,137 @@
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import { Text, Box } from 'ink';
3
+ import { useState, useEffect, useContext } from 'react';
4
+ import { b as getShortDate, P as Platform, E as getProject, F as getProjectPlatformProgress } from './index-pj8JVg5X.js';
5
+ import 'ink-spinner';
6
+ import { g as getShortUUID, m as makeHumanReadable } from './index-B27WJDxn.js';
7
+ import '@tanstack/react-query';
8
+ import 'axios';
9
+ import 'luxon';
10
+ import 'node:fs';
11
+ import 'fast-glob';
12
+ import 'uuid';
13
+ import 'yazl';
14
+ import 'socket.io-client';
15
+ import 'fullscreen-ink';
16
+ import 'string-length';
17
+ import 'strip-ansi';
18
+ import { S as StatusTable } from './StatusTable-DzRWcMr4.js';
19
+ import 'open';
20
+ import '@inkjs/ui';
21
+ import 'node:path';
22
+ import 'marked';
23
+ import 'marked-terminal';
24
+ import { N as NextSteps } from './NextSteps-DbJHmscQ.js';
25
+ import 'qrcode';
26
+ import { G as GameContext, C as CommandContext } from './index-DfUg5j06.js';
27
+
28
+ function isPlatformConfigured(platform, progress) {
29
+ if (!progress) return false;
30
+ return progress.platform === platform && progress.hasBundleSet && progress.hasCredentialsForPlatform && progress.hasApiKeyForPlatform;
31
+ }
32
+ function getSteps(platform, progress) {
33
+ if (!progress) return ["shipthis game wizard " + platform.toLowerCase()];
34
+ switch (platform) {
35
+ case Platform.ANDROID: {
36
+ return [
37
+ !progress.hasCredentialsForPlatform && "shipthis game android keyStore create",
38
+ !progress.hasApiKeyForPlatform && "shipthis game android apiKey create",
39
+ isPlatformConfigured(platform, progress) && "shipthis game ship"
40
+ ].filter(Boolean);
41
+ }
42
+ case Platform.IOS: {
43
+ return [
44
+ !progress.hasApiKeyForPlatform && "shipthis apple apiKey create",
45
+ !progress.hasCredentialsForPlatform && "shipthis game ios profile create",
46
+ isPlatformConfigured(platform, progress) && "shipthis game ship"
47
+ ].filter(Boolean);
48
+ }
49
+ default: {
50
+ throw new Error("Invalid platform");
51
+ }
52
+ }
53
+ }
54
+ async function fetchGameStatus(gameId, platforms) {
55
+ const game = await getProject(gameId);
56
+ const isEnabled = {};
57
+ const statuses = {};
58
+ for (const platform of platforms) {
59
+ isEnabled[platform] = platform === Platform.IOS ? Boolean(game.details?.iosBundleId) : Boolean(game.details?.androidPackageName);
60
+ if (isEnabled[platform]) {
61
+ statuses[platform] = await getProjectPlatformProgress(game.id, platform);
62
+ }
63
+ }
64
+ let steps = [];
65
+ for (const platform of platforms) {
66
+ steps = steps.concat(getSteps(platform, statuses[platform]));
67
+ }
68
+ let exitCode = 0;
69
+ for (const platform of platforms) {
70
+ const platformStatus = statuses[platform];
71
+ if (!platformStatus) continue;
72
+ const hasConfigError = isEnabled[platform] && !isPlatformConfigured(platform, platformStatus);
73
+ if (hasConfigError) exitCode = exitCode || 1;
74
+ }
75
+ if (platforms.length === 1 && !isEnabled[platforms[0]]) {
76
+ exitCode = exitCode || 1;
77
+ } else if (platforms.length > 1 && !isEnabled[Platform.IOS] && !isEnabled[Platform.ANDROID]) {
78
+ exitCode = exitCode || 1;
79
+ }
80
+ return {
81
+ exitCode,
82
+ game,
83
+ isEnabled,
84
+ statuses,
85
+ steps
86
+ };
87
+ }
88
+ const GameStatusDetails = ({ children, gameId, onComplete, onError, platforms }) => {
89
+ const [state, setState] = useState(null);
90
+ useEffect(() => {
91
+ fetchGameStatus(gameId, platforms).then((res) => {
92
+ setState(res);
93
+ setTimeout(() => onComplete?.(res.exitCode), 0);
94
+ }).catch((error) => onError?.(error));
95
+ }, []);
96
+ if (!state) return /* @__PURE__ */ jsx(Text, {});
97
+ const { game, statuses, steps } = state;
98
+ return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", children: [
99
+ /* @__PURE__ */ jsx(
100
+ StatusTable,
101
+ {
102
+ statuses: {
103
+ "Build Number": `${game.details?.buildNumber || 1}`,
104
+ "Created At": getShortDate(game.createdAt),
105
+ "Game Engine": `${game.details?.gameEngine || "godot"} ${game.details?.gameEngineVersion || "4.3"}`,
106
+ "Game ID": getShortUUID(game.id),
107
+ Name: game.name,
108
+ Version: game.details?.semanticVersion || "0.0.1"
109
+ },
110
+ title: "Game Details"
111
+ }
112
+ ),
113
+ platforms.map((platform) => {
114
+ const status = statuses[platform];
115
+ const label = platform === Platform.IOS ? "iOS" : "Android";
116
+ const color = platforms.length === 1 ? "red" : "yellow";
117
+ const { platform: _, ...statusValues } = status || {};
118
+ return /* @__PURE__ */ jsx(Box, { marginTop: 1, children: status ? /* @__PURE__ */ jsx(StatusTable, { statuses: makeHumanReadable(statusValues), title: `${label} Status` }) : /* @__PURE__ */ jsxs(Text, { color, children: [
119
+ "The ",
120
+ label,
121
+ " platform is not enabled for this game."
122
+ ] }) }, platform);
123
+ }),
124
+ children,
125
+ /* @__PURE__ */ jsx(NextSteps, { steps })
126
+ ] });
127
+ };
128
+ const GameStatus$1 = ({ children, onComplete }) => {
129
+ const { gameId } = useContext(GameContext);
130
+ const { command } = useContext(CommandContext);
131
+ const flags = command && command.getFlags() || {};
132
+ const platforms = flags.platform ? [flags.platform.toUpperCase()] : [Platform.IOS, Platform.ANDROID];
133
+ if (!gameId) return null;
134
+ return /* @__PURE__ */ jsx(GameStatusDetails, { gameId, onComplete, platforms, children });
135
+ };
136
+
137
+ export { GameStatusDetails as G, GameStatus$1 as a };
@@ -1,35 +1,35 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { useContext, useState, useEffect } from 'react';
3
2
  import { Box, Text } from 'ink';
4
3
  import Spinner from 'ink-spinner';
5
- import { b as GameContext } from './index-CyvGh-kt.js';
6
- import { _ as queryClient, P as Platform, C as CredentialsType } from './index-w3lHxk5O.js';
7
- import 'axios';
8
- import 'crypto-js';
9
- import { v4 } from 'uuid';
10
- import fs__default from 'fs';
11
- import 'luxon';
12
- import '@inkjs/ui';
13
- import { useMutation } from '@tanstack/react-query';
14
- import yazl from 'yazl';
15
- import { c as cacheKeys } from './useAndroidServiceAccountTestResult-Dy3Ag7_r.js';
16
- import { i as importCredential } from './import-8pL1AF47.js';
17
- import 'crypto';
18
- import 'readline-sync';
19
- import 'node:readline';
4
+ import { useContext, useState, useEffect } from 'react';
5
+ import 'node:crypto';
6
+ import fs__default from 'node:fs';
20
7
  import 'node:path';
8
+ import 'node:readline';
21
9
  import 'node:url';
10
+ import 'readline-sync';
11
+ import 'luxon';
12
+ import 'axios';
22
13
  import 'isomorphic-git';
14
+ import { K as queryClient, P as Platform, C as CredentialsType } from './index-pj8JVg5X.js';
23
15
  import '@oclif/core';
16
+ import { useMutation } from '@tanstack/react-query';
17
+ import 'crypto-js';
18
+ import { v4 } from 'uuid';
24
19
  import 'fast-glob';
20
+ import { ZipFile } from 'yazl';
25
21
  import 'socket.io-client';
22
+ import 'fullscreen-ink';
23
+ import 'string-length';
24
+ import 'strip-ansi';
26
25
  import 'open';
26
+ import '@inkjs/ui';
27
27
  import 'marked';
28
28
  import 'marked-terminal';
29
- import 'path';
30
29
  import 'qrcode';
31
- import 'string-length';
32
- import 'strip-ansi';
30
+ import { G as GameContext } from './index-DfUg5j06.js';
31
+ import { c as cacheKeys } from './useAndroidServiceAccountTestResult-D4e5AKAZ.js';
32
+ import { i as importCredential } from './import-BoY5e0uJ.js';
33
33
 
34
34
  async function importKeystore({ log = () => {
35
35
  }, ...opt }) {
@@ -50,7 +50,7 @@ async function importKeystore({ log = () => {
50
50
  zip.outputStream.pipe(outputStream).on("close", () => resolve());
51
51
  zip.end();
52
52
  });
53
- const zipFile = new yazl.ZipFile();
53
+ const zipFile = new ZipFile();
54
54
  log("Adding keyStore.jks to zip file...");
55
55
  zipFile.addFile(opt.jksFilePath, "keyStore.jks");
56
56
  log("Adding password.txt and keyPassword.txt to zip file...");
@@ -64,31 +64,29 @@ async function importKeystore({ log = () => {
64
64
  }
65
65
  log("Uploading and importing zip file...");
66
66
  const keyStore = await importCredential({
67
+ platform: Platform.ANDROID,
67
68
  projectId: opt.gameId,
68
- zipPath: `${opt.zipFilePath}`,
69
69
  type: CredentialsType.CERTIFICATE,
70
- platform: Platform.ANDROID
70
+ zipPath: `${opt.zipFilePath}`
71
71
  });
72
72
  log("Imported successfully");
73
- toDelete.forEach((file) => {
73
+ for (const file of toDelete) {
74
74
  log(`Deleting temporary file: ${file}`);
75
75
  fs__default.unlinkSync(file);
76
- });
76
+ }
77
77
  return keyStore;
78
78
  }
79
- const useImportKeystore = () => {
80
- return useMutation({
81
- mutationFn: importKeystore,
82
- onSuccess: async (data) => {
83
- const projectId = data.projectId;
84
- queryClient.invalidateQueries({
85
- queryKey: cacheKeys.projectCredentials({ projectId, pageNumber: 0 })
86
- });
87
- }
88
- });
89
- };
79
+ const useImportKeystore = () => useMutation({
80
+ mutationFn: importKeystore,
81
+ async onSuccess(data) {
82
+ const { projectId } = data;
83
+ queryClient.invalidateQueries({
84
+ queryKey: cacheKeys.projectCredentials({ pageNumber: 0, projectId })
85
+ });
86
+ }
87
+ });
90
88
 
91
- const ImportKeystore = ({ onComplete, onError, importKeystoreProps }) => {
89
+ const ImportKeystore = ({ importKeystoreProps, onComplete, onError }) => {
92
90
  const { gameId } = useContext(GameContext);
93
91
  const importMutation = useImportKeystore();
94
92
  const [log, setLog] = useState(null);
@@ -1,28 +1,29 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import { measureElement, Box, Text } from 'ink';
3
3
  import Spinner from 'ink-spinner';
4
- import { d as getStageColor, j as getMessageColor } from './index-DJ078v-U.js';
5
- import { useState, useRef, useEffect } from 'react';
6
- import axios from 'axios';
7
4
  import { useInfiniteQuery } from '@tanstack/react-query';
8
- import { p as getAuthedHeaders, q as API_URL, I as castArrayObjectDates, J as JobStatus, a3 as castJobDates, a1 as castObjectDates, a4 as getShortTime } from './index-w3lHxk5O.js';
5
+ import axios from 'axios';
6
+ import { useState, useRef, useEffect } from 'react';
7
+ import 'node:fs';
9
8
  import 'crypto-js';
10
9
  import 'uuid';
11
- import 'fs';
10
+ import { p as getAuthedHeaders, o as API_URL, I as castArrayObjectDates, J as JobStatus, a4 as castJobDates, a1 as castObjectDates, a5 as getShortTime } from './index-pj8JVg5X.js';
11
+ import { d as getStageColor, j as getMessageColor } from './index-B27WJDxn.js';
12
12
  import 'luxon';
13
13
  import 'fast-glob';
14
14
  import 'yazl';
15
15
  import 'socket.io-client';
16
- import 'crypto';
17
- import 'readline-sync';
18
- import 'node:readline';
16
+ import { c as cacheKeys } from './useAndroidServiceAccountTestResult-D4e5AKAZ.js';
17
+ import 'node:crypto';
19
18
  import 'node:path';
19
+ import 'node:readline';
20
20
  import 'node:url';
21
+ import 'readline-sync';
21
22
  import 'isomorphic-git';
22
23
  import '@oclif/core';
23
- import { c as cacheKeys } from './useAndroidServiceAccountTestResult-Dy3Ag7_r.js';
24
- import { e as useJob } from './index-CyvGh-kt.js';
25
- import { u as useWebSocket } from './useWebSocket-gyuCsore.js';
24
+ import 'fullscreen-ink';
25
+ import { f as useJob } from './index-DfUg5j06.js';
26
+ import { u as useWebSocket } from './useWebSocket-CRV7V69Q.js';
26
27
  import { T as Title } from './Title-BCQtayg6.js';
27
28
  import stringLength from 'string-length';
28
29
  import stripAnsi from 'strip-ansi';
@@ -38,10 +39,10 @@ function dictionaryToArray(dictionary) {
38
39
  }
39
40
 
40
41
  async function queryJobLogs({
41
- projectId,
42
- jobId,
43
42
  cursor,
44
- pageSize = 10
43
+ jobId,
44
+ pageSize = 10,
45
+ projectId
45
46
  }) {
46
47
  try {
47
48
  const headers = getAuthedHeaders();
@@ -59,35 +60,35 @@ async function queryJobLogs({
59
60
  }
60
61
  const useJobLogs = (props) => {
61
62
  const queryResult = useInfiniteQuery({
62
- queryKey: cacheKeys.jobLogs(props),
63
- queryFn: async ({ pageParam }) => {
63
+ getNextPageParam: (lastPage) => lastPage.nextCursor,
64
+ initialPageParam: props.cursor,
65
+ async queryFn({ pageParam }) {
64
66
  return queryJobLogs({
65
67
  ...props,
66
68
  cursor: pageParam
67
69
  });
68
70
  },
69
- getNextPageParam: (lastPage) => lastPage.nextCursor,
70
- initialPageParam: props.cursor
71
+ queryKey: cacheKeys.jobLogs(props)
71
72
  });
72
73
  return queryResult;
73
74
  };
74
75
 
75
76
  function useJobWatching({
76
- projectId,
77
- jobId,
78
77
  isWatching,
79
- onJobUpdate,
80
- onFailure,
78
+ jobId,
81
79
  onComplete,
82
- onNewLogEntry
80
+ onFailure,
81
+ onJobUpdate,
82
+ onNewLogEntry,
83
+ projectId
83
84
  }) {
84
85
  const [websocketJob, setWebsocketJob] = useState(null);
85
86
  const [mostRecentLog, setMostRecentLog] = useState(null);
86
87
  const prevJobStatus = useRef(JobStatus.PENDING);
87
88
  const handleJobUpdate = (job2) => {
88
- const completed = [JobStatus.COMPLETED, JobStatus.FAILED];
89
- const wasRunning = !completed.includes(prevJobStatus.current);
90
- if (completed.includes(job2.status) && wasRunning) {
89
+ const completed = /* @__PURE__ */ new Set([JobStatus.COMPLETED, JobStatus.FAILED]);
90
+ const wasRunning = !completed.has(prevJobStatus.current);
91
+ if (completed.has(job2.status) && wasRunning) {
91
92
  if (job2.status === JobStatus.FAILED) {
92
93
  onFailure && onFailure(job2);
93
94
  } else {
@@ -97,27 +98,27 @@ function useJobWatching({
97
98
  prevJobStatus.current = job2.status;
98
99
  };
99
100
  const jobStatusListener = {
100
- getPattern: () => [`project.${projectId}:job:created`, `project.${projectId}:job:updated`],
101
- eventHandler: async (pattern, rawJob) => {
101
+ async eventHandler(pattern, rawJob) {
102
102
  if (rawJob.id !== jobId) return;
103
103
  const job2 = castJobDates(rawJob);
104
104
  setWebsocketJob(job2);
105
105
  handleJobUpdate(job2);
106
106
  if (onJobUpdate) onJobUpdate(job2);
107
- }
107
+ },
108
+ getPattern: () => [`project.${projectId}:job:created`, `project.${projectId}:job:updated`]
108
109
  };
109
110
  const jobProgressListener = {
110
- getPattern: () => `project.${projectId}:job.${jobId}:log`,
111
- eventHandler: async (pattern, rawLogEntry) => {
111
+ async eventHandler(pattern, rawLogEntry) {
112
112
  const logEntry = castObjectDates(rawLogEntry, ["sentAt", "createdAt"]);
113
113
  if (onNewLogEntry) onNewLogEntry(logEntry);
114
114
  setMostRecentLog(logEntry);
115
- }
115
+ },
116
+ getPattern: () => `project.${projectId}:job.${jobId}:log`
116
117
  };
117
118
  useWebSocket(isWatching ? [jobStatusListener, jobProgressListener] : []);
118
- const { isLoading, data: job } = useJob({
119
- projectId,
120
- jobId
119
+ const { data: job, isLoading } = useJob({
120
+ jobId,
121
+ projectId
121
122
  });
122
123
  useEffect(() => {
123
124
  setWebsocketJob(null);
@@ -127,8 +128,8 @@ function useJobWatching({
127
128
  const progress = mostRecentLog?.progress || null;
128
129
  const stage = mostRecentLog?.stage || null;
129
130
  return {
130
- isLoading,
131
131
  data,
132
+ isLoading,
132
133
  progress,
133
134
  stage
134
135
  };
@@ -137,20 +138,20 @@ function useJobWatching({
137
138
  function getSortedJobLogs(logs) {
138
139
  return logs.sort((a, b) => a.sentAt.toMillis() - b.sentAt.toMillis());
139
140
  }
140
- function useJobLogTail({ projectId, jobId, isWatching, length }) {
141
+ function useJobLogTail({ isWatching, jobId, length, projectId }) {
141
142
  const [websocketLogs, setWebsocketLogs] = useState([]);
142
143
  useJobWatching({
143
- projectId,
144
- jobId,
145
144
  isWatching,
146
- onNewLogEntry: (logEntry) => {
145
+ jobId,
146
+ onNewLogEntry(logEntry) {
147
147
  setWebsocketLogs((prevLogs) => [...prevLogs, logEntry]);
148
- }
148
+ },
149
+ projectId
149
150
  });
150
- const { isLoading, data: fetchedJobLogs } = useJobLogs({
151
- projectId,
151
+ const { data: fetchedJobLogs, isLoading } = useJobLogs({
152
152
  jobId,
153
- pageSize: length
153
+ pageSize: length,
154
+ projectId
154
155
  });
155
156
  useEffect(() => {
156
157
  setWebsocketLogs([]);
@@ -161,8 +162,8 @@ function useJobLogTail({ projectId, jobId, isWatching, length }) {
161
162
  const uniqueLogs = dictionaryToArray(allLogsById);
162
163
  const data = getSortedJobLogs(uniqueLogs).slice(-length);
163
164
  return {
164
- isLoading,
165
- data
165
+ data,
166
+ isLoading
166
167
  };
167
168
  }
168
169
 
@@ -175,27 +176,27 @@ const TruncatedText = ({ children, wrap, ...textPropsWithoutWrap }) => {
175
176
  setWidth(measuredWidth);
176
177
  }, []);
177
178
  const getTruncated = (input) => {
178
- const withoutCrlf = input.replaceAll(/[\r\n]/g, "");
179
+ const withoutCrlf = input.replaceAll(/[\n\r]/g, "");
179
180
  if (width === null) return withoutCrlf;
180
181
  const withoutAnsi = stripAnsi(withoutCrlf);
181
182
  const textLength = stringLength(withoutAnsi);
182
- return textLength > width ? withoutCrlf.substring(0, width) : withoutCrlf;
183
+ return textLength > width ? withoutCrlf.slice(0, Math.max(0, width)) : withoutCrlf;
183
184
  };
184
185
  return /* @__PURE__ */ jsx(Box, { ref, children: /* @__PURE__ */ jsx(Text, { ...textPropsWithoutWrap, children: getTruncated(children) + "\x1B[0m" }) });
185
186
  };
186
187
 
187
188
  const JobLogTail = (props) => {
188
- const { isLoading, data } = useJobLogTail(props);
189
+ const { data, isLoading } = useJobLogTail(props);
189
190
  return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", children: [
190
191
  /* @__PURE__ */ jsx(Title, { children: "Job Logs" }),
191
192
  isLoading && /* @__PURE__ */ jsx(Spinner, { type: "dots" }),
192
193
  /* @__PURE__ */ jsx(Box, { flexDirection: "column", children: data.map((log) => {
193
194
  const stageColor = getStageColor(log.stage);
194
195
  const messageColor = getMessageColor(log.level);
195
- return /* @__PURE__ */ jsxs(Box, { flexDirection: "row", overflow: "hidden", height: 1, children: [
196
+ return /* @__PURE__ */ jsxs(Box, { flexDirection: "row", height: 1, overflow: "hidden", children: [
196
197
  /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Text, { children: getShortTime(log.sentAt) }) }),
197
- /* @__PURE__ */ jsx(Box, { marginLeft: 1, width: 9, justifyContent: "flex-start", children: /* @__PURE__ */ jsx(Text, { color: stageColor, children: log.stage }) }),
198
- /* @__PURE__ */ jsx(Box, { marginLeft: 1, overflow: "hidden", height: 1, marginRight: 2, children: /* @__PURE__ */ jsx(TruncatedText, { color: messageColor, children: log.message }) })
198
+ /* @__PURE__ */ jsx(Box, { justifyContent: "flex-start", marginLeft: 1, width: 9, children: /* @__PURE__ */ jsx(Text, { color: stageColor, children: log.stage }) }),
199
+ /* @__PURE__ */ jsx(Box, { height: 1, marginLeft: 1, marginRight: 2, overflow: "hidden", children: /* @__PURE__ */ jsx(TruncatedText, { color: messageColor, children: log.message }) })
199
200
  ] }, log.id);
200
201
  }) })
201
202
  ] });