shipthis 0.1.23 → 0.1.25

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 (89) hide show
  1. package/README.md +25 -16
  2. package/docs/assets/ship-outputx0.8.gif +0 -0
  3. package/package.json +1 -1
  4. package/bin/readme.sh +0 -15
  5. package/dist/AppleBundleIdDetails-C9C5WSPR.js +0 -76
  6. package/dist/Command-BQCJ9Wf-.js +0 -28
  7. package/dist/CommandGame-CkGqTno0.js +0 -9
  8. package/dist/Create-t_E231OA.js +0 -59
  9. package/dist/Import-Ljz1gxXd.js +0 -110
  10. package/dist/JobProgress-D9tHgBvi.js +0 -121
  11. package/dist/JobStatusTable-DmI7qCHc.js +0 -203
  12. package/dist/NextSteps-CK9zHOCt.js +0 -18
  13. package/dist/ProgressSpinner-6pw1T8Iw.js +0 -16
  14. package/dist/ProjectCredentialsTable-CTkP1mvy.js +0 -37
  15. package/dist/RunWithSpinner-BVXNWGD3.js +0 -27
  16. package/dist/StatusTable-Dm5St4g-.js +0 -33
  17. package/dist/Table-CvM6pccN.js +0 -101
  18. package/dist/Title-BCQtayg6.js +0 -6
  19. package/dist/UserCredentialsTable-DhtM_iTG.js +0 -82
  20. package/dist/baseAppleCommand-IGl6KTvv.js +0 -10
  21. package/dist/baseGameAndroidCommand-DFn4zMvq.js +0 -43
  22. package/dist/commands/apple/apiKey/create.js +0 -103
  23. package/dist/commands/apple/apiKey/export.js +0 -81
  24. package/dist/commands/apple/apiKey/import.js +0 -85
  25. package/dist/commands/apple/apiKey/status.js +0 -122
  26. package/dist/commands/apple/certificate/create.js +0 -133
  27. package/dist/commands/apple/certificate/export.js +0 -81
  28. package/dist/commands/apple/certificate/import.js +0 -85
  29. package/dist/commands/apple/certificate/status.js +0 -130
  30. package/dist/commands/apple/login.js +0 -76
  31. package/dist/commands/apple/status.js +0 -79
  32. package/dist/commands/dashboard.js +0 -38
  33. package/dist/commands/game/android/apiKey/connect.js +0 -74
  34. package/dist/commands/game/android/apiKey/create.js +0 -74
  35. package/dist/commands/game/android/apiKey/export.js +0 -84
  36. package/dist/commands/game/android/apiKey/import.js +0 -93
  37. package/dist/commands/game/android/apiKey/invite.js +0 -81
  38. package/dist/commands/game/android/apiKey/status.js +0 -87
  39. package/dist/commands/game/android/keyStore/create.js +0 -69
  40. package/dist/commands/game/android/keyStore/export.js +0 -83
  41. package/dist/commands/game/android/keyStore/import.js +0 -112
  42. package/dist/commands/game/android/keyStore/status.js +0 -70
  43. package/dist/commands/game/android/status.js +0 -84
  44. package/dist/commands/game/build/download.js +0 -80
  45. package/dist/commands/game/build/list.js +0 -94
  46. package/dist/commands/game/create.js +0 -67
  47. package/dist/commands/game/details.js +0 -113
  48. package/dist/commands/game/export.js +0 -58
  49. package/dist/commands/game/ios/app/addTester.js +0 -124
  50. package/dist/commands/game/ios/app/create.js +0 -117
  51. package/dist/commands/game/ios/app/status.js +0 -66
  52. package/dist/commands/game/ios/app/sync.js +0 -95
  53. package/dist/commands/game/ios/profile/create.js +0 -129
  54. package/dist/commands/game/ios/profile/export.js +0 -83
  55. package/dist/commands/game/ios/profile/import.js +0 -92
  56. package/dist/commands/game/ios/profile/status.js +0 -139
  57. package/dist/commands/game/ios/status.js +0 -92
  58. package/dist/commands/game/ios/wizard.js +0 -153
  59. package/dist/commands/game/job/list.js +0 -91
  60. package/dist/commands/game/job/status.js +0 -91
  61. package/dist/commands/game/list.js +0 -83
  62. package/dist/commands/game/ship.js +0 -205
  63. package/dist/commands/game/status.js +0 -114
  64. package/dist/commands/game/wizard.js +0 -686
  65. package/dist/commands/internal/fastlane.js +0 -74
  66. package/dist/commands/internal/readme.js +0 -937
  67. package/dist/commands/login.js +0 -92
  68. package/dist/commands/status.js +0 -76
  69. package/dist/export-CVs_xoDN.js +0 -36
  70. package/dist/git-DREGq-jc.js +0 -32
  71. package/dist/import-Ch5O7xfN.js +0 -47
  72. package/dist/index-BB00V5oF.js +0 -136
  73. package/dist/index-CIa2EDQ6.js +0 -24
  74. package/dist/index-DkNQs11R.js +0 -711
  75. package/dist/index-DrcGhlrc.js +0 -138
  76. package/dist/index-DyOv-ge5.js +0 -125
  77. package/dist/index-vMXsdSCy.js +0 -208
  78. package/dist/index.d.ts +0 -1
  79. package/dist/index.js +0 -1
  80. package/dist/upload-CRE2nVdd.js +0 -60
  81. package/dist/useAndroidServiceAccountTestResult-DcYDam-p.js +0 -52
  82. package/dist/useAppleApp-B16WbUxJ.js +0 -32
  83. package/dist/useAppleBundleId-DobPATan.js +0 -64
  84. package/dist/useJobWatching-BZSUa8E-.js +0 -45
  85. package/dist/useProjectCredentials-Btnr7WK3.js +0 -54
  86. package/dist/useWebSocket-ByuNoqRw.js +0 -36
  87. package/dist/utils/help.js +0 -14
  88. package/npm-shrinkwrap.json +0 -14011
  89. package/oclif.manifest.json +0 -2275
@@ -1,203 +0,0 @@
1
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
- import { measureElement, Box, Text } from 'ink';
3
- import Spinner from 'ink-spinner';
4
- import { h as getStageColor, j as getMessageColor, c as getJobStatusColor } from './index-BB00V5oF.js';
5
- import { useState, useEffect, useRef } from 'react';
6
- import axios from 'axios';
7
- import { useInfiniteQuery } from '@tanstack/react-query';
8
- import { p as getAuthedHeaders, q as API_URL, L as castArrayObjectDates, H as castObjectDates, a5 as getShortTime, J as JobStatus } from './index-DkNQs11R.js';
9
- import 'crypto-js';
10
- import 'uuid';
11
- import 'fs';
12
- import { DateTime } from 'luxon';
13
- import 'fast-glob';
14
- import 'yazl';
15
- import 'socket.io-client';
16
- import 'crypto';
17
- import 'readline-sync';
18
- import 'node:readline';
19
- import 'node:path';
20
- import 'node:url';
21
- import 'isomorphic-git';
22
- import '@oclif/core';
23
- import { c as cacheKeys } from './useAndroidServiceAccountTestResult-DcYDam-p.js';
24
- import { u as useWebSocket } from './useWebSocket-ByuNoqRw.js';
25
- import { T as Title } from './Title-BCQtayg6.js';
26
- import stringLength from 'string-length';
27
- import stripAnsi from 'strip-ansi';
28
- import { a as getJobSummary, d as getBuildSummary } from './index-vMXsdSCy.js';
29
- import { u as useJobWatching } from './useJobWatching-BZSUa8E-.js';
30
- import { a as StatusRow, b as StatusRowLabel } from './StatusTable-Dm5St4g-.js';
31
-
32
- function arrayToDictionary(array, key = "id") {
33
- return array.reduce((a, i) => {
34
- a[i[key]] = i;
35
- return a;
36
- }, {});
37
- }
38
- function dictionaryToArray(dictionary) {
39
- return Object.keys(dictionary).map((key) => dictionary[key]);
40
- }
41
-
42
- async function queryJobLogs({
43
- projectId,
44
- jobId,
45
- cursor,
46
- pageSize = 10
47
- }) {
48
- try {
49
- const headers = getAuthedHeaders();
50
- const base = `${API_URL}/projects/${projectId}/jobs/${jobId}/logs/?pageSize=${pageSize}`;
51
- const url = base + (cursor ? `&cursor=${cursor}` : "");
52
- const response = await axios.get(url, { headers });
53
- return {
54
- ...response.data,
55
- data: castArrayObjectDates(response.data.data, ["sentAt", "createdAt"])
56
- };
57
- } catch (error) {
58
- console.warn("queryJobLogs Error", error);
59
- throw error;
60
- }
61
- }
62
- const useJobLogs = (props) => {
63
- const queryResult = useInfiniteQuery({
64
- queryKey: cacheKeys.jobLogs(props),
65
- queryFn: async ({ pageParam }) => {
66
- return queryJobLogs({
67
- ...props,
68
- cursor: pageParam
69
- });
70
- },
71
- getNextPageParam: (lastPage) => lastPage.nextCursor,
72
- initialPageParam: props.cursor
73
- });
74
- return queryResult;
75
- };
76
-
77
- function getSortedJobLogs(logs) {
78
- return logs.sort((a, b) => a.sentAt.toMillis() - b.sentAt.toMillis());
79
- }
80
- function useJobLogTail(props) {
81
- const [websocketLogs, setWebsocketLogs] = useState([]);
82
- const listener = {
83
- getPattern: () => `project.${props.projectId}:job.${props.jobId}:log`,
84
- eventHandler: async (pattern, rawLogEntry) => {
85
- setWebsocketLogs((prevLogs) => {
86
- const logEntry = castObjectDates(rawLogEntry, ["sentAt", "createdAt"]);
87
- return [...prevLogs, logEntry];
88
- });
89
- }
90
- };
91
- useWebSocket(props.isWatching ? [listener] : []);
92
- const { isLoading, data: fetchedJobLogs } = useJobLogs({
93
- projectId: props.projectId,
94
- jobId: props.jobId,
95
- pageSize: props.length
96
- });
97
- useEffect(() => {
98
- setWebsocketLogs([]);
99
- }, [props.jobId, props.projectId, props.length, props.isWatching, fetchedJobLogs]);
100
- const firstPage = fetchedJobLogs ? fetchedJobLogs?.pages[0].data : [];
101
- const allLogs = [...firstPage, ...websocketLogs];
102
- const allLogsById = arrayToDictionary(allLogs);
103
- const uniqueLogs = dictionaryToArray(allLogsById);
104
- const data = getSortedJobLogs(uniqueLogs).slice(-props.length);
105
- return {
106
- isLoading,
107
- data
108
- };
109
- }
110
-
111
- const TruncatedText = ({ children, wrap, ...textPropsWithoutWrap }) => {
112
- const ref = useRef();
113
- const [width, setWidth] = useState(null);
114
- useEffect(() => {
115
- if (!ref.current) return;
116
- const { width: measuredWidth } = measureElement(ref.current);
117
- setWidth(measuredWidth);
118
- }, []);
119
- const getTruncated = (input) => {
120
- const withoutCrlf = input.replaceAll(/[\r\n]/g, "");
121
- if (width === null) return withoutCrlf;
122
- const withoutAnsi = stripAnsi(withoutCrlf);
123
- const textLength = stringLength(withoutAnsi);
124
- return textLength > width ? withoutCrlf.substring(0, width) : withoutCrlf;
125
- };
126
- return /* @__PURE__ */ jsx(Box, { ref, children: /* @__PURE__ */ jsx(Text, { ...textPropsWithoutWrap, children: getTruncated(children) + "\x1B[0m" }) });
127
- };
128
-
129
- const JobLogTail = (props) => {
130
- const { isLoading, data } = useJobLogTail(props);
131
- return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", children: [
132
- /* @__PURE__ */ jsx(Title, { children: "Job Logs" }),
133
- isLoading && /* @__PURE__ */ jsx(Spinner, { type: "dots" }),
134
- /* @__PURE__ */ jsx(Box, { flexDirection: "column", children: data.map((log) => {
135
- const stageColor = getStageColor(log.stage);
136
- const messageColor = getMessageColor(log.level);
137
- return /* @__PURE__ */ jsxs(Box, { flexDirection: "row", overflow: "hidden", height: 1, children: [
138
- /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Text, { children: getShortTime(log.sentAt) }) }),
139
- /* @__PURE__ */ jsx(Box, { marginLeft: 1, width: 9, justifyContent: "flex-start", children: /* @__PURE__ */ jsx(Text, { color: stageColor, children: log.stage }) }),
140
- /* @__PURE__ */ jsx(Box, { marginLeft: 1, overflow: "hidden", height: 1, marginRight: 2, children: /* @__PURE__ */ jsx(TruncatedText, { color: messageColor, children: log.message }) })
141
- ] }, log.id);
142
- }) })
143
- ] });
144
- };
145
-
146
- const JobStatusSpinner = ({ status, showSpinner }) => /* @__PURE__ */ jsxs(Fragment, { children: [
147
- /* @__PURE__ */ jsx(Box, { width: JobStatus.PROCESSING.length, children: /* @__PURE__ */ jsx(Text, { color: getJobStatusColor(status), children: `${status}` }) }),
148
- showSpinner && /* @__PURE__ */ jsxs(Fragment, { children: [
149
- /* @__PURE__ */ jsx(Text, { children: " " }),
150
- /* @__PURE__ */ jsx(Spinner, { type: "dots" })
151
- ] })
152
- ] });
153
- const JobStatusTable = ({ jobId, projectId, isWatching, onJobUpdate }) => {
154
- const { data: job, stage, isLoading } = useJobWatching({ projectId, jobId, isWatching, onJobUpdate });
155
- const [time, setTime] = useState(DateTime.now());
156
- useEffect(() => {
157
- if (!isWatching) return;
158
- const interval = setInterval(() => setTime(DateTime.now()), 1e3);
159
- return () => {
160
- clearInterval(interval);
161
- };
162
- }, []);
163
- const isJobInProgress = job && ![JobStatus.COMPLETED, JobStatus.FAILED].includes(job.status);
164
- const summary = job ? getJobSummary(job, time) : null;
165
- const buildSummary = job && job.build ? getBuildSummary(job.build) : null;
166
- return /* @__PURE__ */ jsxs(Box, { flexDirection: "row", children: [
167
- /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [
168
- /* @__PURE__ */ jsx(Title, { children: "Job Details" }),
169
- isLoading && /* @__PURE__ */ jsx(Spinner, { type: "dots" }),
170
- summary && job && /* @__PURE__ */ jsxs(Box, { flexDirection: "row", children: [
171
- /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginLeft: 2, children: [
172
- /* @__PURE__ */ jsx(StatusRow, { label: "ID", value: summary.id }),
173
- /* @__PURE__ */ jsx(StatusRow, { label: "Platform", value: summary.platform }),
174
- /* @__PURE__ */ jsxs(Box, { flexDirection: "row", children: [
175
- /* @__PURE__ */ jsx(StatusRowLabel, { label: "Status" }),
176
- /* @__PURE__ */ jsx(JobStatusSpinner, { status: job.status, showSpinner: isWatching && !!isJobInProgress })
177
- ] }),
178
- /* @__PURE__ */ jsxs(Box, { flexDirection: "row", children: [
179
- /* @__PURE__ */ jsx(StatusRowLabel, { label: "Stage" }),
180
- stage && /* @__PURE__ */ jsx(Text, { color: getStageColor(stage), children: `${stage}` })
181
- ] })
182
- ] }),
183
- /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginLeft: 2, children: [
184
- /* @__PURE__ */ jsx(StatusRow, { label: "Version", value: summary.version }),
185
- /* @__PURE__ */ jsx(StatusRow, { label: "Git Info", value: summary.gitInfo }),
186
- /* @__PURE__ */ jsx(StatusRow, { label: "Started At", value: summary.createdAt }),
187
- /* @__PURE__ */ jsx(StatusRow, { label: "Runtime", value: summary.runtime })
188
- ] })
189
- ] })
190
- ] }),
191
- buildSummary && /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginBottom: 1, marginLeft: 3, borderStyle: "single", padding: 1, children: [
192
- /* @__PURE__ */ jsx(Title, { children: "Build Details" }),
193
- /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginLeft: 2, children: [
194
- /* @__PURE__ */ jsx(StatusRow, { label: "ID", value: buildSummary.id }),
195
- /* @__PURE__ */ jsx(StatusRow, { label: "Platform", value: buildSummary.platform }),
196
- /* @__PURE__ */ jsx(StatusRow, { label: "Type", value: buildSummary.type }),
197
- /* @__PURE__ */ jsx(StatusRow, { label: "CMD", value: buildSummary.cmd })
198
- ] })
199
- ] })
200
- ] });
201
- };
202
-
203
- export { JobStatusTable as J, JobLogTail as a };
@@ -1,18 +0,0 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { Box, Text } from 'ink';
3
- import { T as Title } from './Title-BCQtayg6.js';
4
-
5
- const ListWithTitle = ({ listItems, title }) => {
6
- if (listItems.length === 0) return null;
7
- const header = title.toUpperCase();
8
- return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginTop: 1, children: [
9
- /* @__PURE__ */ jsx(Title, { children: header }),
10
- /* @__PURE__ */ jsx(Box, { flexDirection: "column", marginLeft: 2, children: listItems.map((listItem, index) => /* @__PURE__ */ jsx(Text, { children: listItem }, index)) })
11
- ] });
12
- };
13
-
14
- const NextSteps = ({ steps }) => {
15
- return /* @__PURE__ */ jsx(ListWithTitle, { listItems: steps, title: "Next Steps" });
16
- };
17
-
18
- export { NextSteps as N };
@@ -1,16 +0,0 @@
1
- import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
2
- import { ProgressBar } from '@inkjs/ui';
3
- import { Box, Text } from 'ink';
4
- import Spinner from 'ink-spinner';
5
-
6
- 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: [
7
- label && label != "" && /* @__PURE__ */ jsx(Text, { ...labelProps, children: label }),
8
- /* @__PURE__ */ jsx(ProgressBar, { value: progress || 0 }),
9
- /* @__PURE__ */ jsx(Box, { width: 4, children: /* @__PURE__ */ jsxs(Text, { children: [
10
- Math.floor(progress || 0),
11
- "%"
12
- ] }) }),
13
- /* @__PURE__ */ jsx(Spinner, { type: spinnerType })
14
- ] }) }) });
15
-
16
- export { ProgressSpinner as P };
@@ -1,37 +0,0 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { Box, Text } from 'ink';
3
- import Spinner from 'ink-spinner';
4
- import 'crypto';
5
- import 'fs';
6
- import 'readline-sync';
7
- import 'node:readline';
8
- import 'node:path';
9
- import 'node:url';
10
- import 'luxon';
11
- import 'axios';
12
- import 'isomorphic-git';
13
- import './index-DkNQs11R.js';
14
- import '@oclif/core';
15
- import 'react';
16
- import '@tanstack/react-query';
17
- import 'crypto-js';
18
- import 'uuid';
19
- import { u as useProjectCredentials, g as getProjectCredentialSummary } from './useProjectCredentials-Btnr7WK3.js';
20
- import 'fast-glob';
21
- import 'yazl';
22
- import 'socket.io-client';
23
- import { T as Table } from './Table-CvM6pccN.js';
24
- import { T as Title } from './Title-BCQtayg6.js';
25
-
26
- const ProjectCredentialsTable = ({ credentialTypeName, queryProps, ...boxProps }) => {
27
- const { isLoading, data } = useProjectCredentials(queryProps);
28
- const hasActive = data?.data.some((credential) => credential.isActive);
29
- return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginBottom: 1, ...boxProps, children: [
30
- /* @__PURE__ */ jsx(Title, { children: `${credentialTypeName}s in your ShipThis account` }),
31
- /* @__PURE__ */ jsx(Box, { marginLeft: 2, marginBottom: 1, flexDirection: "column", children: /* @__PURE__ */ jsx(Text, { children: hasActive ? `You have an active ${credentialTypeName} in your ShipThis account.` : `You DO NOT have an active ${credentialTypeName} which ShipThis can use.` }) }),
32
- isLoading && /* @__PURE__ */ jsx(Spinner, { type: "dots" }),
33
- data && data.data.length > 0 && /* @__PURE__ */ jsx(Table, { data: data.data.map(getProjectCredentialSummary) })
34
- ] });
35
- };
36
-
37
- export { ProjectCredentialsTable as P };
@@ -1,27 +0,0 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
2
- import React from 'react';
3
- import { Box, Text } from 'ink';
4
- import Spinner from 'ink-spinner';
5
-
6
- const RunWithSpinner = ({
7
- executeMethod,
8
- msgInProgress,
9
- msgComplete,
10
- onComplete,
11
- spinnerType
12
- }) => {
13
- const [isInProgress, setIsInProgress] = React.useState(true);
14
- React.useEffect(() => {
15
- setIsInProgress(true);
16
- executeMethod().then(() => {
17
- setIsInProgress(false);
18
- return onComplete();
19
- });
20
- }, []);
21
- return /* @__PURE__ */ jsxs(Box, { children: [
22
- /* @__PURE__ */ jsx(Text, { children: isInProgress ? msgInProgress : msgComplete }),
23
- isInProgress && /* @__PURE__ */ jsx(Spinner, { type: spinnerType })
24
- ] });
25
- };
26
-
27
- export { RunWithSpinner as R };
@@ -1,33 +0,0 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { Box, Text } from 'ink';
3
- import { T as Title } from './Title-BCQtayg6.js';
4
-
5
- const StatusRowLabel = ({ label, width }) => /* @__PURE__ */ jsx(Box, { width: width || 10, marginRight: 2, children: /* @__PURE__ */ jsx(Text, { children: `${label}` }) });
6
- const StatusRow = ({ label, labelWidth, value, ...textProps }) => {
7
- return /* @__PURE__ */ jsxs(Box, { flexDirection: "row", alignItems: "flex-end", children: [
8
- /* @__PURE__ */ jsx(StatusRowLabel, { width: labelWidth, label }),
9
- /* @__PURE__ */ jsx(Text, { bold: true, ...textProps, children: value })
10
- ] });
11
- };
12
- const StatusTable = ({ title, statuses, colors, ...rest }) => {
13
- const getColor = (key) => {
14
- const value = statuses[key];
15
- if (typeof value === "boolean") return value ? "green" : "red";
16
- const defaultColor = "green";
17
- const color = colors?.[key];
18
- return color || defaultColor;
19
- };
20
- const getText = (key) => {
21
- const value = statuses[key];
22
- if (typeof value === "boolean") return value ? "YES" : "NO";
23
- return value;
24
- };
25
- const maxLabelLength = Math.max(...Object.keys(statuses).map((key) => key.length));
26
- const labelWidth = Math.max(maxLabelLength, 10);
27
- return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", ...rest, children: [
28
- /* @__PURE__ */ jsx(Title, { children: title }),
29
- /* @__PURE__ */ jsx(Box, { flexDirection: "column", marginLeft: 2, children: Object.entries(statuses).map(([key, value]) => /* @__PURE__ */ jsx(StatusRow, { labelWidth, label: key, value: getText(key), color: getColor(key) }, key)) })
30
- ] });
31
- };
32
-
33
- export { StatusTable as S, StatusRow as a, StatusRowLabel as b };
@@ -1,101 +0,0 @@
1
- import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
- import React from 'react';
3
- import { Box, Text } from 'ink';
4
-
5
- const BASE_HEADER_PROPS = {
6
- color: "blue",
7
- bold: true
8
- };
9
- const BASE_TEXT_PROPS = {
10
- color: "white"
11
- };
12
- function generateHeaders(data) {
13
- let headers = {};
14
- data.forEach((row) => {
15
- Object.keys(row).forEach((key) => {
16
- headers[key] = key;
17
- });
18
- });
19
- return headers;
20
- }
21
- const Table = ({ data, showHeaders = true, headerTextProps, columnTextProps, getTextProps }) => {
22
- const columns = getColumns(data);
23
- const fullHeaderTextProps = {
24
- ...BASE_HEADER_PROPS,
25
- ...headerTextProps
26
- };
27
- return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", children: [
28
- renderHeaderSeparators(columns),
29
- showHeaders && /* @__PURE__ */ jsxs(Fragment, { children: [
30
- renderRow(generateHeaders(data), columns, fullHeaderTextProps),
31
- renderRowSeparators(columns)
32
- ] }),
33
- data.map((row, index) => /* @__PURE__ */ jsxs(React.Fragment, { children: [
34
- index !== 0 && renderRowSeparators(columns),
35
- renderRow(row, columns, BASE_TEXT_PROPS, columnTextProps, getTextProps)
36
- ] }, `row-${index}`)),
37
- renderFooterSeparators(columns)
38
- ] });
39
- };
40
- function getColumns(data) {
41
- let columnWidths = {};
42
- data.forEach((row) => {
43
- Object.keys(row).forEach((key) => {
44
- const valueLength = row[key]?.toString().length || 0;
45
- columnWidths[key] = Math.max(columnWidths[key] || key.length, valueLength);
46
- });
47
- });
48
- return Object.keys(columnWidths).map((key) => ({
49
- key,
50
- width: (columnWidths[key] ?? 0) + 2
51
- // adding padding
52
- }));
53
- }
54
- function renderRow(row, columns, baseCellTextProps, columnTextProps, getTextProps) {
55
- const getDisplayValue = (row2, column) => {
56
- const value = row2[column.key];
57
- if (typeof value === "boolean") return value ? "YES" : "NO";
58
- return value?.toString() || "";
59
- };
60
- const getTextPropsForCell = (row2, column) => {
61
- const { key } = column;
62
- const value = row2[key];
63
- const columnTextPropsForCell = columnTextProps?.[key] || {};
64
- const valueBasedProps = typeof row2[column.key] === "boolean" ? { color: value == false ? "red" : "green" } : {};
65
- const callbackBasedProps = getTextProps ? getTextProps(column, value) : {};
66
- return {
67
- ...baseCellTextProps,
68
- ...columnTextPropsForCell,
69
- ...valueBasedProps,
70
- ...callbackBasedProps
71
- };
72
- };
73
- return /* @__PURE__ */ jsxs(Box, { flexDirection: "row", children: [
74
- /* @__PURE__ */ jsx(Text, { children: "\u2502" }),
75
- columns.map((column, index) => {
76
- const cellTextProps = getTextPropsForCell(row, column);
77
- return /* @__PURE__ */ jsxs(React.Fragment, { children: [
78
- index !== 0 && /* @__PURE__ */ jsx(Text, { children: "\u2502" }),
79
- /* @__PURE__ */ jsx(Box, { width: column.width, justifyContent: "center", children: /* @__PURE__ */ jsx(Text, { ...cellTextProps, children: getDisplayValue(row, column) }) })
80
- ] }, column.key);
81
- }),
82
- /* @__PURE__ */ jsx(Text, { children: "\u2502" })
83
- ] });
84
- }
85
- function renderHeaderSeparators(columns) {
86
- return renderRowSeparators(columns, "\u250C", "\u252C", "\u2510");
87
- }
88
- function renderFooterSeparators(columns) {
89
- return renderRowSeparators(columns, "\u2514", "\u2534", "\u2518");
90
- }
91
- function renderRowSeparators(columns, leftChar = "\u251C", midChar = "\u253C", rightChar = "\u2524") {
92
- return /* @__PURE__ */ jsxs(Box, { flexDirection: "row", children: [
93
- /* @__PURE__ */ jsx(Text, { children: leftChar }),
94
- columns.map((column, index) => /* @__PURE__ */ jsxs(React.Fragment, { children: [
95
- /* @__PURE__ */ jsx(Text, { children: "\u2500".repeat(column.width) }),
96
- index < columns.length - 1 ? /* @__PURE__ */ jsx(Text, { children: midChar }) : /* @__PURE__ */ jsx(Text, { children: rightChar })
97
- ] }, column.key))
98
- ] });
99
- }
100
-
101
- export { Table as T };
@@ -1,6 +0,0 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import { Text } from 'ink';
3
-
4
- const Title = ({ children, ...rest }) => /* @__PURE__ */ jsx(Text, { bold: true, ...rest, children: children.toUpperCase() });
5
-
6
- export { Title as T };
@@ -1,82 +0,0 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { Box, Text } from 'ink';
3
- import Spinner from 'ink-spinner';
4
- import 'crypto';
5
- import 'fs';
6
- import 'readline-sync';
7
- import 'node:readline';
8
- import 'node:path';
9
- import 'node:url';
10
- import 'luxon';
11
- import axios from 'axios';
12
- import 'isomorphic-git';
13
- import { b as getShortDate, p as getAuthedHeaders, q as API_URL, L as castArrayObjectDates } from './index-DkNQs11R.js';
14
- import '@oclif/core';
15
- import 'react';
16
- import { useQuery } from '@tanstack/react-query';
17
- import 'crypto-js';
18
- import 'uuid';
19
- import 'fast-glob';
20
- import 'yazl';
21
- import { c as cacheKeys } from './useAndroidServiceAccountTestResult-DcYDam-p.js';
22
- import { g as getShortUUID } from './index-BB00V5oF.js';
23
- import 'socket.io-client';
24
- import { T as Table } from './Table-CvM6pccN.js';
25
- import { T as Title } from './Title-BCQtayg6.js';
26
-
27
- async function queryUserCredentials(params) {
28
- try {
29
- const headers = getAuthedHeaders();
30
- const url = `${API_URL}/credentials`;
31
- const response = await axios.get(url, { headers, params });
32
- return {
33
- ...response.data,
34
- data: castArrayObjectDates(response.data.data)
35
- };
36
- } catch (error) {
37
- console.warn("queryUserCredentials Error", error);
38
- throw error;
39
- }
40
- }
41
- function getUserCredentialSummary(credential) {
42
- return {
43
- id: getShortUUID(credential.id),
44
- type: credential.type,
45
- serial: credential.serialNumber,
46
- isActive: credential.isActive,
47
- createdAt: getShortDate(credential.createdAt)
48
- };
49
- }
50
- const useUserCredentials = ({
51
- platform,
52
- type,
53
- ...pageAndSortParams
54
- }) => {
55
- const queryResult = useQuery({
56
- queryKey: cacheKeys.userCredentials(pageAndSortParams),
57
- queryFn: async () => queryUserCredentials(pageAndSortParams),
58
- select: (data) => {
59
- if (!(platform || type)) return data;
60
- return {
61
- ...data,
62
- data: data.data.filter((credential) => {
63
- return (!platform || credential.platform === platform) && (!type || credential.type === type);
64
- })
65
- };
66
- }
67
- });
68
- return queryResult;
69
- };
70
-
71
- const UserCredentialsTable = ({ credentialTypeName, queryProps, ...boxProps }) => {
72
- const { isLoading, data } = useUserCredentials(queryProps);
73
- const hasActive = data?.data.some((credential) => credential.isActive);
74
- return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginBottom: 1, ...boxProps, children: [
75
- /* @__PURE__ */ jsx(Title, { children: `${credentialTypeName}s in your ShipThis account` }),
76
- /* @__PURE__ */ jsx(Box, { marginLeft: 2, marginBottom: 1, flexDirection: "column", children: /* @__PURE__ */ jsx(Text, { children: hasActive ? `You have an active ${credentialTypeName} in your ShipThis account.` : `You DO NOT have an active ${credentialTypeName} which ShipThis can use.` }) }),
77
- isLoading && /* @__PURE__ */ jsx(Spinner, { type: "dots" }),
78
- data && data.data.length > 0 && /* @__PURE__ */ jsx(Table, { data: data.data.map(getUserCredentialSummary) })
79
- ] });
80
- };
81
-
82
- export { UserCredentialsTable as U, useUserCredentials as u };
@@ -1,10 +0,0 @@
1
- import { B as BaseAuthenticatedCommand } from './index-DkNQs11R.js';
2
-
3
- class BaseAppleCommand extends BaseAuthenticatedCommand {
4
- async init() {
5
- await super.init();
6
- await this.ensureWeHaveAppleCookies();
7
- }
8
- }
9
-
10
- export { BaseAppleCommand as B };
@@ -1,43 +0,0 @@
1
- import { c as BaseGameCommand, S as getGodotAndroidPackageName, T as getGoogleStatus } from './index-DkNQs11R.js';
2
- import { b as generatePackageName, a as getInput } from './index-BB00V5oF.js';
3
-
4
- class BaseGameAndroidCommand extends BaseGameCommand {
5
- async init() {
6
- await super.init();
7
- await this.ensureWeHaveAndroidPackageName();
8
- }
9
- // Prompts the user for the Android package name
10
- async getAndroidPackageName(gameId) {
11
- const game = await this.getGame();
12
- const generated = generatePackageName(game.name);
13
- const suggested = game.details?.iosBundleId || getGodotAndroidPackageName() || generated || "com.example.game";
14
- const question = `Please enter the Android Package Name, or press enter to use ${suggested}: `;
15
- const entered = await getInput(question);
16
- return entered || suggested;
17
- }
18
- // Forces us to have the androidPackageName in the game details
19
- async ensureWeHaveAndroidPackageName() {
20
- const game = await this.getGame();
21
- if (!game.details?.androidPackageName) {
22
- const androidPackageName = await this.getAndroidPackageName(game.id);
23
- await this.updateGame({ details: { ...game.details, androidPackageName } });
24
- }
25
- }
26
- async checkGoogleAuth(waitForAuth = false) {
27
- let status = await getGoogleStatus();
28
- if (status.isAuthenticated) return;
29
- if (!waitForAuth)
30
- this.error("You must connect to Google first. Run `shipthis game android apiKey connect`", { exit: 1 });
31
- this.log("Waiting for Google authentication...");
32
- const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
33
- for (let i = 0; i < 600; i++) {
34
- process.stdout.write(".");
35
- await sleep(1e3 * 10);
36
- status = await getGoogleStatus();
37
- if (status.isAuthenticated) return;
38
- }
39
- this.error("Google authentication failed. Please try again.", { exit: 1 });
40
- }
41
- }
42
-
43
- export { BaseGameAndroidCommand as B };