UNPKG

shipthis

Version:

ShipThis manages building and uploading your Godot games to the App Store and Google Play.

95 lines (92 loc) 3.53 kB
import { jsxs, jsx } from 'react/jsx-runtime'; import { Flags } from '@oclif/core'; import { render, Box, Text } from 'ink'; import { B as BaseAuthenticatedCommand, Z as getAPIKeys, b as getShortDate } from '../../index-BwnzoldS.js'; import 'ink-spinner'; import { g as getShortUUID } from '../../index-CJWMt1s-.js'; import { T as Table } from '../../Table-FaNgpyeq.js'; import 'react'; import '@tanstack/react-query'; import 'axios'; import 'luxon'; import 'node:fs'; import 'fast-glob'; import 'uuid'; import 'yazl'; import 'socket.io-client'; import 'fullscreen-ink'; import 'string-length'; import 'strip-ansi'; import 'open'; import '@inkjs/ui'; import 'node:path'; import '../../ejs-DirFZbza.js'; import 'marked'; import 'marked-terminal'; import 'qrcode'; import '../../index-hoHfGrjg.js'; import { C as Command } from '../../Command-DN1j3tjt.js'; import 'crypto-js'; import '@expo/apple-utils/build/index.js'; import 'node:crypto'; import 'node:readline'; import 'node:url'; import 'readline-sync'; import 'isomorphic-git'; import 'deepmerge'; import 'ini'; import 'fs'; import 'path'; import '../../useAndroidServiceAccountTestResult-CwKeW0ED.js'; class ApiKeyList extends BaseAuthenticatedCommand { static args = {}; static description = "Displays a list of your ShipThis API keys."; static examples = [ "<%= config.bin %> <%= command.id %>", "<%= config.bin %> <%= command.id %> --pageNumber 1", "<%= config.bin %> <%= command.id %> --orderBy createdAt --order asc" ]; static flags = { order: Flags.string({ char: "r", default: "desc", description: "The order to sort by", options: ["asc", "desc"] }), orderBy: Flags.string({ char: "o", default: "createdAt", description: "The field to order by", options: ["createdAt", "updatedAt", "name"] }), pageNumber: Flags.integer({ char: "p", default: 0, description: "The page number to show (starts at 0)" }), pageSize: Flags.integer({ char: "s", default: 10, description: "The number of items to show per page" }) }; async run() { const { flags } = this; const params = flags; const apiKeysListResponse = await getAPIKeys(params); const data = apiKeysListResponse.data.map((apiKey) => ({ expiresAt: getShortDate(apiKey.expiresAt), id: getShortUUID(apiKey.id), lastUsedAt: apiKey.lastUsedAt ? getShortDate(apiKey.lastUsedAt) : "Never", name: apiKey.name, revokedAt: apiKey.revokedAt ? getShortDate(apiKey.revokedAt) : "Active" })); const emptyState = /* @__PURE__ */ jsxs(Box, { flexDirection: "column", children: [ /* @__PURE__ */ jsx(Text, { children: "No API keys found. Create one now with:" }), /* @__PURE__ */ jsx(Box, { flexDirection: "column", marginLeft: 2, marginTop: 1, children: /* @__PURE__ */ jsx(Text, { children: "shipthis apiKey create" }) }) ] }); render( /* @__PURE__ */ jsxs(Command, { command: this, children: [ data.length === 0 && params.pageNumber === 0 && emptyState, data.length > 0 && /* @__PURE__ */ jsx(Table, { data }), apiKeysListResponse.pageCount > 1 && /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginTop: 1, children: [ /* @__PURE__ */ jsx(Text, { children: `Showing page ${flags.pageNumber + 1} of ${apiKeysListResponse.pageCount}.` }), /* @__PURE__ */ jsx(Text, { children: "Use the --pageNumber parameter to see other pages." }) ] }) ] }) ); } } export { ApiKeyList as default };