/** * CLI command map and entry point * @generated by @constructive-io/graphql-codegen * DO NOT EDIT - changes will be overwritten */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import contextCmd from './commands/context'; import authCmd from './commands/auth'; import auditLogAuthCmd from './commands/audit-log-auth'; import cryptoAddressCmd from './commands/crypto-address'; import emailCmd from './commands/email'; import identityProviderCmd from './commands/identity-provider'; import orgApiKeyListCmd from './commands/org-api-key-list'; import phoneNumberCmd from './commands/phone-number'; import principalCmd from './commands/principal'; import principalEntityCmd from './commands/principal-entity'; import principalScopeOverrideCmd from './commands/principal-scope-override'; import roleTypeCmd from './commands/role-type'; import userConnectedAccountCmd from './commands/user-connected-account'; import userCmd from './commands/user'; import userSettingCmd from './commands/user-setting'; import userSettingsSecurityCmd from './commands/user-settings-security'; import webauthnCredentialCmd from './commands/webauthn-credential'; import currentIpAddressCmd from './commands/current-ip-address'; import currentUserCmd from './commands/current-user'; import currentUserAgentCmd from './commands/current-user-agent'; import currentUserIdCmd from './commands/current-user-id'; import getMfaStatusCmd from './commands/get-mfa-status'; import requireStepUpCmd from './commands/require-step-up'; import signInOptionsCmd from './commands/sign-in-options'; import approveDeviceCmd from './commands/approve-device'; import cancelSignUpHandoffCmd from './commands/cancel-sign-up-handoff'; import checkPasswordCmd from './commands/check-password'; import completeMfaChallengeCmd from './commands/complete-mfa-challenge'; import confirmDeleteAccountCmd from './commands/confirm-delete-account'; import confirmTotpSetupCmd from './commands/confirm-totp-setup'; import createApiKeyCmd from './commands/create-api-key'; import createChildPrincipalCmd from './commands/create-child-principal'; import createOrgApiKeyCmd from './commands/create-org-api-key'; import createOrgPrincipalCmd from './commands/create-org-principal'; import createPrincipalCmd from './commands/create-principal'; import createPrincipalFromPresetCmd from './commands/create-principal-from-preset'; import deleteOrgPrincipalCmd from './commands/delete-org-principal'; import deletePrincipalCmd from './commands/delete-principal'; import disableEmailMfaCmd from './commands/disable-email-mfa'; import disableSmsMfaCmd from './commands/disable-sms-mfa'; import disableTotpCmd from './commands/disable-totp'; import disconnectAccountCmd from './commands/disconnect-account'; import enableEmailMfaCmd from './commands/enable-email-mfa'; import enableSmsMfaCmd from './commands/enable-sms-mfa'; import enableTotpCmd from './commands/enable-totp'; import ensureAuthCsrfCmd from './commands/ensure-auth-csrf'; import exchangeNativeHandoffCmd from './commands/exchange-native-handoff'; import extendTokenExpiresCmd from './commands/extend-token-expires'; import forgotPasswordCmd from './commands/forgot-password'; import generateBackupCodesCmd from './commands/generate-backup-codes'; import linkIdentityCmd from './commands/link-identity'; import mintAccessTokenCmd from './commands/mint-access-token'; import provisionBucketCmd from './commands/provision-bucket'; import refreshAccessTokenCmd from './commands/refresh-access-token'; import requestCrossOriginTokenCmd from './commands/request-cross-origin-token'; import requestDeviceApprovalCmd from './commands/request-device-approval'; import requestMagicLinkCmd from './commands/request-magic-link'; import resetPasswordCmd from './commands/reset-password'; import revokeApiKeyCmd from './commands/revoke-api-key'; import revokeOrgApiKeyCmd from './commands/revoke-org-api-key'; import revokeSessionCmd from './commands/revoke-session'; import sendAccountDeletionEmailCmd from './commands/send-account-deletion-email'; import sendMfaChallengeCodeCmd from './commands/send-mfa-challenge-code'; import sendPhoneVerificationCodeCmd from './commands/send-phone-verification-code'; import sendSmsOtpCmd from './commands/send-sms-otp'; import sendStepUpCodeCmd from './commands/send-step-up-code'; import sendVerificationEmailCmd from './commands/send-verification-email'; import setPasswordCmd from './commands/set-password'; import setPrincipalEntitiesCmd from './commands/set-principal-entities'; import setPrincipalScopeCmd from './commands/set-principal-scope'; import signInCmd from './commands/sign-in'; import signInCrossOriginCmd from './commands/sign-in-cross-origin'; import signInMagicLinkCmd from './commands/sign-in-magic-link'; import signInSmsOtpCmd from './commands/sign-in-sms-otp'; import signOutCmd from './commands/sign-out'; import signUpCmd from './commands/sign-up'; import signUpMagicLinkCmd from './commands/sign-up-magic-link'; import signUpSmsCmd from './commands/sign-up-sms'; import updatePrincipalCmd from './commands/update-principal'; import verifyEmailCmd from './commands/verify-email'; import verifyEmailHandoffCmd from './commands/verify-email-handoff'; import verifyPasswordCmd from './commands/verify-password'; import verifyPhoneCmd from './commands/verify-phone'; import verifyStepUpCodeCmd from './commands/verify-step-up-code'; import verifyTotpCmd from './commands/verify-totp'; const createCommandMap: () => Record< string, ( argv: Partial>, prompter: Inquirerer, options: CLIOptions ) => Promise > = () => ({ context: contextCmd, auth: authCmd, 'audit-log-auth': auditLogAuthCmd, 'crypto-address': cryptoAddressCmd, email: emailCmd, 'identity-provider': identityProviderCmd, 'org-api-key-list': orgApiKeyListCmd, 'phone-number': phoneNumberCmd, principal: principalCmd, 'principal-entity': principalEntityCmd, 'principal-scope-override': principalScopeOverrideCmd, 'role-type': roleTypeCmd, 'user-connected-account': userConnectedAccountCmd, user: userCmd, 'user-setting': userSettingCmd, 'user-settings-security': userSettingsSecurityCmd, 'webauthn-credential': webauthnCredentialCmd, 'current-ip-address': currentIpAddressCmd, 'current-user': currentUserCmd, 'current-user-agent': currentUserAgentCmd, 'current-user-id': currentUserIdCmd, 'get-mfa-status': getMfaStatusCmd, 'require-step-up': requireStepUpCmd, 'sign-in-options': signInOptionsCmd, 'approve-device': approveDeviceCmd, 'cancel-sign-up-handoff': cancelSignUpHandoffCmd, 'check-password': checkPasswordCmd, 'complete-mfa-challenge': completeMfaChallengeCmd, 'confirm-delete-account': confirmDeleteAccountCmd, 'confirm-totp-setup': confirmTotpSetupCmd, 'create-api-key': createApiKeyCmd, 'create-child-principal': createChildPrincipalCmd, 'create-org-api-key': createOrgApiKeyCmd, 'create-org-principal': createOrgPrincipalCmd, 'create-principal': createPrincipalCmd, 'create-principal-from-preset': createPrincipalFromPresetCmd, 'delete-org-principal': deleteOrgPrincipalCmd, 'delete-principal': deletePrincipalCmd, 'disable-email-mfa': disableEmailMfaCmd, 'disable-sms-mfa': disableSmsMfaCmd, 'disable-totp': disableTotpCmd, 'disconnect-account': disconnectAccountCmd, 'enable-email-mfa': enableEmailMfaCmd, 'enable-sms-mfa': enableSmsMfaCmd, 'enable-totp': enableTotpCmd, 'ensure-auth-csrf': ensureAuthCsrfCmd, 'exchange-native-handoff': exchangeNativeHandoffCmd, 'extend-token-expires': extendTokenExpiresCmd, 'forgot-password': forgotPasswordCmd, 'generate-backup-codes': generateBackupCodesCmd, 'link-identity': linkIdentityCmd, 'mint-access-token': mintAccessTokenCmd, 'provision-bucket': provisionBucketCmd, 'refresh-access-token': refreshAccessTokenCmd, 'request-cross-origin-token': requestCrossOriginTokenCmd, 'request-device-approval': requestDeviceApprovalCmd, 'request-magic-link': requestMagicLinkCmd, 'reset-password': resetPasswordCmd, 'revoke-api-key': revokeApiKeyCmd, 'revoke-org-api-key': revokeOrgApiKeyCmd, 'revoke-session': revokeSessionCmd, 'send-account-deletion-email': sendAccountDeletionEmailCmd, 'send-mfa-challenge-code': sendMfaChallengeCodeCmd, 'send-phone-verification-code': sendPhoneVerificationCodeCmd, 'send-sms-otp': sendSmsOtpCmd, 'send-step-up-code': sendStepUpCodeCmd, 'send-verification-email': sendVerificationEmailCmd, 'set-password': setPasswordCmd, 'set-principal-entities': setPrincipalEntitiesCmd, 'set-principal-scope': setPrincipalScopeCmd, 'sign-in': signInCmd, 'sign-in-cross-origin': signInCrossOriginCmd, 'sign-in-magic-link': signInMagicLinkCmd, 'sign-in-sms-otp': signInSmsOtpCmd, 'sign-out': signOutCmd, 'sign-up': signUpCmd, 'sign-up-magic-link': signUpMagicLinkCmd, 'sign-up-sms': signUpSmsCmd, 'update-principal': updatePrincipalCmd, 'verify-email': verifyEmailCmd, 'verify-email-handoff': verifyEmailHandoffCmd, 'verify-password': verifyPasswordCmd, 'verify-phone': verifyPhoneCmd, 'verify-step-up-code': verifyStepUpCodeCmd, 'verify-totp': verifyTotpCmd, }); const usage = "\ncsdk \n\nCommands:\n context Manage API contexts\n auth Manage authentication\n audit-log-auth auditLogAuth CRUD operations\n crypto-address cryptoAddress CRUD operations\n email email CRUD operations\n identity-provider identityProvider CRUD operations\n org-api-key-list orgApiKeyList CRUD operations\n phone-number phoneNumber CRUD operations\n principal principal CRUD operations\n principal-entity principalEntity CRUD operations\n principal-scope-override principalScopeOverride CRUD operations\n role-type roleType CRUD operations\n user-connected-account userConnectedAccount CRUD operations\n user user CRUD operations\n user-setting userSetting CRUD operations\n user-settings-security userSettingsSecurity CRUD operations\n webauthn-credential webauthnCredential CRUD operations\n current-ip-address currentIpAddress\n current-user currentUser\n current-user-agent currentUserAgent\n current-user-id currentUserId\n get-mfa-status getMfaStatus\n require-step-up requireStepUp\n sign-in-options signInOptions\n approve-device approveDevice\n cancel-sign-up-handoff cancelSignUpHandoff\n check-password checkPassword\n complete-mfa-challenge completeMfaChallenge\n confirm-delete-account confirmDeleteAccount\n confirm-totp-setup confirmTotpSetup\n create-api-key Mint an API key for the current user; the plaintext key is returned once. access_level: full_access (default) or read_only. mfa_level: none (default) or verified; verified needs a fresh MFA proof on the calling session. A key minted while authenticated by another API key never outlives that key.\n create-child-principal createChildPrincipal\n create-org-api-key createOrgApiKey\n create-org-principal createOrgPrincipal\n create-principal createPrincipal\n create-principal-from-preset createPrincipalFromPreset\n delete-org-principal deleteOrgPrincipal\n delete-principal deletePrincipal\n disable-email-mfa disableEmailMfa\n disable-sms-mfa disableSmsMfa\n disable-totp disableTotp\n disconnect-account disconnectAccount\n enable-email-mfa enableEmailMfa\n enable-sms-mfa enableSmsMfa\n enable-totp enableTotp\n ensure-auth-csrf ensureAuthCsrf\n exchange-native-handoff exchangeNativeHandoff\n extend-token-expires extendTokenExpires\n forgot-password forgotPassword\n generate-backup-codes generateBackupCodes\n link-identity linkIdentity\n mint-access-token mintAccessToken\n provision-bucket Reconcile an S3 bucket for a logical bucket in the database.\nRecords the request on the bucket row via RLS; the bucket's job\ntrigger then enqueues the same storage:provision_bucket job used on\nINSERT, and repeated requests collapse into one pending job. This is\nidempotent for an already-reconciled bucket; failures become GraphQL\nerrors.\n refresh-access-token refreshAccessToken\n request-cross-origin-token requestCrossOriginToken\n request-device-approval requestDeviceApproval\n request-magic-link requestMagicLink\n reset-password resetPassword\n revoke-api-key revokeApiKey\n revoke-org-api-key revokeOrgApiKey\n revoke-session revokeSession\n send-account-deletion-email sendAccountDeletionEmail\n send-mfa-challenge-code sendMfaChallengeCode\n send-phone-verification-code sendPhoneVerificationCode\n send-sms-otp sendSmsOtp\n send-step-up-code sendStepUpCode\n send-verification-email sendVerificationEmail\n set-password setPassword\n set-principal-entities setPrincipalEntities\n set-principal-scope setPrincipalScope\n sign-in signIn\n sign-in-cross-origin signInCrossOrigin\n sign-in-magic-link signInMagicLink\n sign-in-sms-otp signInSmsOtp\n sign-out signOut\n sign-up signUp\n sign-up-magic-link signUpMagicLink\n sign-up-sms signUpSms\n update-principal updatePrincipal\n verify-email verifyEmail\n verify-email-handoff verifyEmailHandoff\n verify-password verifyPassword\n verify-phone verifyPhone\n verify-step-up-code verifyStepUpCode\n verify-totp verifyTotp\n\n --help, -h Show this help message\n --version, -v Show version\n"; export const commands = async ( argv: Partial>, prompter: Inquirerer, options: CLIOptions ) => { if (argv.help || argv.h) { console.log(usage); process.exit(0); } let { first: command, newArgv } = extractFirst(argv); const commandMap = createCommandMap(); if (!command) { const answer = await prompter.prompt(argv, [ { type: 'autocomplete', name: 'command', message: 'What do you want to do?', options: Object.keys(commandMap), }, ]); command = answer.command as string; } const commandFn = commandMap[command]; if (!commandFn) { console.log(usage); console.error(`Unknown command: ${command}`); process.exit(1); } await commandFn(newArgv, prompter, options); prompter.close(); return argv; };