shipthis 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +894 -0
- package/bin/alias.sh +10 -0
- package/bin/dev.cmd +3 -0
- package/bin/dev.js +7 -0
- package/bin/dev.tsc.js +15 -0
- package/bin/loader.js +20 -0
- package/bin/run.cmd +3 -0
- package/bin/run.js +5 -0
- package/bin/run.tsc.js +15 -0
- package/dist/App-DFPMSEZF.js +21 -0
- package/dist/AppleBundleIdDetails-CuhAbVEp.js +61 -0
- package/dist/NextSteps-CK9zHOCt.js +18 -0
- package/dist/RunWithSpinner-BVXNWGD3.js +27 -0
- package/dist/StatusTable-CxuX_R1D.js +38 -0
- package/dist/Table-CvM6pccN.js +101 -0
- package/dist/Title-BCQtayg6.js +6 -0
- package/dist/UserCredentialsTable-DHeRI4h6.js +76 -0
- package/dist/baseAppleCommand-BXUu-026.js +10 -0
- package/dist/baseGameCommand-xrD2WDDN.js +599 -0
- package/dist/cacheKeys-CShA-ZjE.js +9 -0
- package/dist/commands/apple/apiKey/create.js +88 -0
- package/dist/commands/apple/apiKey/export.js +66 -0
- package/dist/commands/apple/apiKey/import.js +70 -0
- package/dist/commands/apple/apiKey/status.js +108 -0
- package/dist/commands/apple/certificate/create.js +118 -0
- package/dist/commands/apple/certificate/export.js +66 -0
- package/dist/commands/apple/certificate/import.js +70 -0
- package/dist/commands/apple/certificate/status.js +116 -0
- package/dist/commands/apple/login.js +74 -0
- package/dist/commands/apple/status.js +50 -0
- package/dist/commands/dashboard.js +32 -0
- package/dist/commands/game/build/download.js +78 -0
- package/dist/commands/game/build/list.js +83 -0
- package/dist/commands/game/create.js +59 -0
- package/dist/commands/game/details.js +89 -0
- package/dist/commands/game/export.js +52 -0
- package/dist/commands/game/ios/app/addTester.js +111 -0
- package/dist/commands/game/ios/app/create.js +104 -0
- package/dist/commands/game/ios/app/status.js +52 -0
- package/dist/commands/game/ios/app/sync.js +81 -0
- package/dist/commands/game/ios/profile/create.js +110 -0
- package/dist/commands/game/ios/profile/export.js +68 -0
- package/dist/commands/game/ios/profile/import.js +77 -0
- package/dist/commands/game/ios/profile/status.js +183 -0
- package/dist/commands/game/ios/status.js +79 -0
- package/dist/commands/game/job/list.js +80 -0
- package/dist/commands/game/job/status.js +297 -0
- package/dist/commands/game/list.js +69 -0
- package/dist/commands/game/ship.js +67 -0
- package/dist/commands/game/status.js +76 -0
- package/dist/commands/game/wizard.js +124 -0
- package/dist/commands/login.js +63 -0
- package/dist/commands/status.js +80 -0
- package/dist/export-CujqsTR_.js +36 -0
- package/dist/git-DREGq-jc.js +32 -0
- package/dist/import-Q-KO61ll.js +38 -0
- package/dist/index-DKsVctbw.js +125 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/run.js +3 -0
- package/dist/upload-CUlWmNbS.js +60 -0
- package/dist/useAppleApp-BmwYu7qG.js +32 -0
- package/dist/useAppleBundleId-DCJnfNWr.js +64 -0
- package/dist/useBuilds-Dh_PWwCf.js +41 -0
- package/dist/useJob-CCkqCMvF.js +34 -0
- package/oclif.manifest.json +1510 -0
- package/package.json +167 -0
package/bin/alias.sh
ADDED
package/bin/dev.cmd
ADDED
package/bin/dev.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
#!/usr/bin/env -S /bin/sh -c '"$(dirname "$0")/../node_modules/.bin/tsx" --trace-deprecation --tsconfig "$(dirname "$0")/../tsconfig.json" "$0" "$@"'
|
|
2
|
+
|
|
3
|
+
// Magic shebang to run TypeScript files with tsx from any directory
|
|
4
|
+
|
|
5
|
+
// Start the CLI
|
|
6
|
+
import {execute} from '@oclif/core'
|
|
7
|
+
await execute({development: true, dir: import.meta.url})
|
package/bin/dev.tsc.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// Enable our loader
|
|
4
|
+
import {register} from 'node:module'
|
|
5
|
+
import {pathToFileURL} from 'node:url'
|
|
6
|
+
import path from 'node:path'
|
|
7
|
+
const __dirname = new URL('.', import.meta.url).pathname
|
|
8
|
+
const loaderURL = pathToFileURL(path.join(__dirname, 'loader.js'))
|
|
9
|
+
// So that the loader finds the tsconfig.json
|
|
10
|
+
process.env.TS_NODE_PROJECT = path.join(__dirname, '..', 'tsconfig.json')
|
|
11
|
+
register(loaderURL)
|
|
12
|
+
|
|
13
|
+
// Start the CLI
|
|
14
|
+
import {execute} from '@oclif/core'
|
|
15
|
+
await execute({development: true, dir: import.meta.url})
|
package/bin/loader.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is from https://github.com/TypeStrong/ts-node/discussions/1450#discussion-3563207
|
|
3
|
+
* It is crazy that this is necessary, but it is.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import {resolve as resolveTs} from 'ts-node/esm'
|
|
7
|
+
import * as tsConfigPaths from 'tsconfig-paths'
|
|
8
|
+
import {pathToFileURL} from 'url'
|
|
9
|
+
|
|
10
|
+
const {absoluteBaseUrl, paths} = tsConfigPaths.loadConfig()
|
|
11
|
+
const matchPath = tsConfigPaths.createMatchPath(absoluteBaseUrl, paths)
|
|
12
|
+
|
|
13
|
+
export function resolve(specifier, ctx, defaultResolve) {
|
|
14
|
+
const match = matchPath(specifier)
|
|
15
|
+
return match
|
|
16
|
+
? resolveTs(pathToFileURL(`${match}`).href, ctx, defaultResolve)
|
|
17
|
+
: resolveTs(specifier, ctx, defaultResolve)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export {load, transformSource} from 'ts-node/esm'
|
package/bin/run.cmd
ADDED
package/bin/run.js
ADDED
package/bin/run.tsc.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// Enable our loader
|
|
4
|
+
import {register} from 'node:module'
|
|
5
|
+
import {pathToFileURL} from 'node:url'
|
|
6
|
+
import path from 'node:path'
|
|
7
|
+
const __dirname = new URL('.', import.meta.url).pathname
|
|
8
|
+
const loaderURL = pathToFileURL(path.join(__dirname, 'loader.js'))
|
|
9
|
+
// So that the loader finds the tsconfig.json
|
|
10
|
+
process.env.TS_NODE_PROJECT = path.join(__dirname, '..', 'tsconfig.json')
|
|
11
|
+
register(loaderURL)
|
|
12
|
+
|
|
13
|
+
import {execute} from '@oclif/core'
|
|
14
|
+
|
|
15
|
+
await execute({dir: import.meta.url})
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { Box } from 'ink';
|
|
3
|
+
import { QueryClientProvider } from '@tanstack/react-query';
|
|
4
|
+
import { Q as queryClient } from './baseGameCommand-xrD2WDDN.js';
|
|
5
|
+
import 'luxon';
|
|
6
|
+
import '@expo/apple-utils/build/index.js';
|
|
7
|
+
import 'crypto';
|
|
8
|
+
import 'fs';
|
|
9
|
+
import 'readline-sync';
|
|
10
|
+
import 'node:readline';
|
|
11
|
+
import 'react';
|
|
12
|
+
import 'axios';
|
|
13
|
+
import 'socket.io-client';
|
|
14
|
+
import 'isomorphic-git';
|
|
15
|
+
|
|
16
|
+
const App = ({ children }) => {
|
|
17
|
+
const width = Math.min(160, process.stdout.columns || 80);
|
|
18
|
+
return /* @__PURE__ */ jsx(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx(Box, { width, flexDirection: "column", children }) });
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export { App as A };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { Box, Text } from 'ink';
|
|
3
|
+
import Spinner from 'ink-spinner';
|
|
4
|
+
import './baseGameCommand-xrD2WDDN.js';
|
|
5
|
+
import 'luxon';
|
|
6
|
+
import '@tanstack/react-query';
|
|
7
|
+
import '@expo/apple-utils/build/index.js';
|
|
8
|
+
import { u as useAppleApp } from './useAppleApp-BmwYu7qG.js';
|
|
9
|
+
import 'crypto';
|
|
10
|
+
import 'fs';
|
|
11
|
+
import 'readline-sync';
|
|
12
|
+
import 'node:readline';
|
|
13
|
+
import 'react';
|
|
14
|
+
import 'axios';
|
|
15
|
+
import 'socket.io-client';
|
|
16
|
+
import 'isomorphic-git';
|
|
17
|
+
import { T as Title } from './Title-BCQtayg6.js';
|
|
18
|
+
import { T as Table } from './Table-CvM6pccN.js';
|
|
19
|
+
import { u as useAppleBundleId } from './useAppleBundleId-DCJnfNWr.js';
|
|
20
|
+
|
|
21
|
+
const AppleAppDetails = (props) => {
|
|
22
|
+
const { data, isLoading } = useAppleApp(props);
|
|
23
|
+
return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [
|
|
24
|
+
/* @__PURE__ */ jsx(Title, { children: "App Details (in the Apple Developer Portal)" }),
|
|
25
|
+
isLoading && /* @__PURE__ */ jsx(Spinner, { type: "dots" }),
|
|
26
|
+
data && data.summary && /* @__PURE__ */ jsx(Table, { data: [data.summary] })
|
|
27
|
+
] });
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const AppleBundleIdDetails = (props) => {
|
|
31
|
+
const { data, isLoading } = useAppleBundleId(props);
|
|
32
|
+
const { bundleIdSummary, capabilitiesTable, shouldSyncCapabilities, capabilities } = data || {};
|
|
33
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
34
|
+
/* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [
|
|
35
|
+
/* @__PURE__ */ jsx(Title, { children: "BundleId Details (in the Apple Developer Portal)" }),
|
|
36
|
+
isLoading && /* @__PURE__ */ jsx(Spinner, { type: "dots" }),
|
|
37
|
+
bundleIdSummary && /* @__PURE__ */ jsx(Table, { data: [bundleIdSummary] })
|
|
38
|
+
] }),
|
|
39
|
+
capabilities && /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [
|
|
40
|
+
/* @__PURE__ */ jsx(Title, { children: "Capabilities enabled in the BundleId" }),
|
|
41
|
+
/* @__PURE__ */ jsx(
|
|
42
|
+
Table,
|
|
43
|
+
{
|
|
44
|
+
data: capabilities.map((c) => {
|
|
45
|
+
return { capability: `${c}` };
|
|
46
|
+
})
|
|
47
|
+
}
|
|
48
|
+
)
|
|
49
|
+
] }),
|
|
50
|
+
capabilitiesTable && /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [
|
|
51
|
+
/* @__PURE__ */ jsx(Title, { children: "BundleId Capability Check" }),
|
|
52
|
+
/* @__PURE__ */ jsx(Table, { data: capabilitiesTable })
|
|
53
|
+
] }),
|
|
54
|
+
shouldSyncCapabilities && /* @__PURE__ */ jsxs(Box, { flexDirection: "column", children: [
|
|
55
|
+
/* @__PURE__ */ jsx(Text, { bold: true, children: "The capabilities are out of sync with the Apple Developer Portal." }),
|
|
56
|
+
/* @__PURE__ */ jsx(Text, { bold: true, children: "Run shipthis game ios app sync" })
|
|
57
|
+
] })
|
|
58
|
+
] });
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export { AppleAppDetails as A, AppleBundleIdDetails as a };
|
|
@@ -0,0 +1,18 @@
|
|
|
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 };
|
|
@@ -0,0 +1,27 @@
|
|
|
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 };
|
|
@@ -0,0 +1,38 @@
|
|
|
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 = ({
|
|
7
|
+
label,
|
|
8
|
+
labelWidth,
|
|
9
|
+
value,
|
|
10
|
+
...textProps
|
|
11
|
+
}) => {
|
|
12
|
+
return /* @__PURE__ */ jsxs(Box, { flexDirection: "row", alignItems: "flex-end", children: [
|
|
13
|
+
/* @__PURE__ */ jsx(StatusRowLabel, { width: labelWidth, label }),
|
|
14
|
+
/* @__PURE__ */ jsx(Text, { bold: true, ...textProps, children: value })
|
|
15
|
+
] });
|
|
16
|
+
};
|
|
17
|
+
const StatusTable = ({ title, statuses, colors, ...rest }) => {
|
|
18
|
+
const getColor = (key) => {
|
|
19
|
+
const value = statuses[key];
|
|
20
|
+
if (typeof value === "boolean") return value ? "green" : "red";
|
|
21
|
+
const defaultColor = "green";
|
|
22
|
+
const color = colors?.[key];
|
|
23
|
+
return color || defaultColor;
|
|
24
|
+
};
|
|
25
|
+
const getText = (key) => {
|
|
26
|
+
const value = statuses[key];
|
|
27
|
+
if (typeof value === "boolean") return value ? "YES" : "NO";
|
|
28
|
+
return value;
|
|
29
|
+
};
|
|
30
|
+
const maxLabelLength = Math.max(...Object.keys(statuses).map((key) => key.length));
|
|
31
|
+
const labelWidth = Math.max(maxLabelLength, 10);
|
|
32
|
+
return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", ...rest, children: [
|
|
33
|
+
/* @__PURE__ */ jsx(Title, { children: title }),
|
|
34
|
+
/* @__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)) })
|
|
35
|
+
] });
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export { StatusTable as S, StatusRow as a, StatusRowLabel as b };
|
|
@@ -0,0 +1,101 @@
|
|
|
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 };
|
|
@@ -0,0 +1,76 @@
|
|
|
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 'react';
|
|
9
|
+
import axios from 'axios';
|
|
10
|
+
import { useQuery } from '@tanstack/react-query';
|
|
11
|
+
import { f as getShortDate, o as getAuthedHeaders, p as API_URL, I as castArrayObjectDates } from './baseGameCommand-xrD2WDDN.js';
|
|
12
|
+
import 'luxon';
|
|
13
|
+
import 'socket.io-client';
|
|
14
|
+
import '@expo/apple-utils/build/index.js';
|
|
15
|
+
import { c as cacheKeys } from './cacheKeys-CShA-ZjE.js';
|
|
16
|
+
import { g as getShortUUID } from './index-DKsVctbw.js';
|
|
17
|
+
import 'isomorphic-git';
|
|
18
|
+
import { T as Table } from './Table-CvM6pccN.js';
|
|
19
|
+
import { T as Title } from './Title-BCQtayg6.js';
|
|
20
|
+
|
|
21
|
+
async function queryUserCredentials(params) {
|
|
22
|
+
try {
|
|
23
|
+
const headers = getAuthedHeaders();
|
|
24
|
+
const url = `${API_URL}/credentials`;
|
|
25
|
+
const response = await axios.get(url, { headers, params });
|
|
26
|
+
return {
|
|
27
|
+
...response.data,
|
|
28
|
+
data: castArrayObjectDates(response.data.data)
|
|
29
|
+
};
|
|
30
|
+
} catch (error) {
|
|
31
|
+
console.warn("queryUserCredentials Error", error);
|
|
32
|
+
throw error;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function getUserCredentialSummary(credential) {
|
|
36
|
+
return {
|
|
37
|
+
id: getShortUUID(credential.id),
|
|
38
|
+
type: credential.type,
|
|
39
|
+
serial: credential.serialNumber,
|
|
40
|
+
isActive: credential.isActive,
|
|
41
|
+
createdAt: getShortDate(credential.createdAt)
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
const useUserCredentials = ({
|
|
45
|
+
platform,
|
|
46
|
+
type,
|
|
47
|
+
...pageAndSortParams
|
|
48
|
+
}) => {
|
|
49
|
+
const queryResult = useQuery({
|
|
50
|
+
queryKey: cacheKeys.userCredentials(pageAndSortParams),
|
|
51
|
+
queryFn: async () => queryUserCredentials(pageAndSortParams),
|
|
52
|
+
select: (data) => {
|
|
53
|
+
if (!(platform || type)) return data;
|
|
54
|
+
return {
|
|
55
|
+
...data,
|
|
56
|
+
data: data.data.filter((credential) => {
|
|
57
|
+
return (!platform || credential.platform === platform) && (!type || credential.type === type);
|
|
58
|
+
})
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
return queryResult;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const UserCredentialsTable = ({ credentialTypeName, queryProps, ...boxProps }) => {
|
|
66
|
+
const { isLoading, data } = useUserCredentials(queryProps);
|
|
67
|
+
const hasActive = data?.data.some((credential) => credential.isActive);
|
|
68
|
+
return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginBottom: 1, ...boxProps, children: [
|
|
69
|
+
/* @__PURE__ */ jsx(Title, { children: `${credentialTypeName}s in your ShipThis account` }),
|
|
70
|
+
/* @__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.` }) }),
|
|
71
|
+
isLoading && /* @__PURE__ */ jsx(Spinner, { type: "dots" }),
|
|
72
|
+
data && /* @__PURE__ */ jsx(Table, { data: data.data.map(getUserCredentialSummary) })
|
|
73
|
+
] });
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export { UserCredentialsTable as U, useUserCredentials as u };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { B as BaseAuthenticatedCommand } from './baseGameCommand-xrD2WDDN.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 };
|