From b34d5e1bb93319ca72c83253bf22884e66eb8117 Mon Sep 17 00:00:00 2001 From: Ahmed Sayeed Wasif Date: Mon, 9 Oct 2023 18:18:44 +0600 Subject: [PATCH 01/15] Add phpmyadmin command --- npm-shrinkwrap.json | 1 + package.json | 1 + src/bin/vip-phpmyadmin.ts | 58 ++++++++++++++++++++++++++ src/bin/vip.js | 1 + src/commands/phpmyadmin.ts | 83 ++++++++++++++++++++++++++++++++++++++ src/global.d.ts | 1 + 6 files changed, 145 insertions(+) create mode 100755 src/bin/vip-phpmyadmin.ts create mode 100644 src/commands/phpmyadmin.ts create mode 100644 src/global.d.ts diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 5bd658b12..bcd3d14d3 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -94,6 +94,7 @@ "vip-import-validate-sql": "dist/bin/vip-import-validate-sql.js", "vip-logout": "dist/bin/vip-logout.js", "vip-logs": "dist/bin/vip-logs.js", + "vip-phpmyadmin": "dist/bin/vip-phpmyadmin.js", "vip-search-replace": "dist/bin/vip-search-replace.js", "vip-slowlogs": "dist/bin/vip-slowlogs.js", "vip-sync": "dist/bin/vip-sync.js", diff --git a/package.json b/package.json index 6b20d7e2c..7955d29f4 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "vip-dev-env-purge": "dist/bin/vip-dev-env-purge.js", "vip-export": "dist/bin/vip-export.js", "vip-export-sql": "dist/bin/vip-export-sql.js", + "vip-phpmyadmin": "dist/bin/vip-phpmyadmin.js", "vip-dev-env-sync": "dist/bin/vip-dev-env-sync.js", "vip-dev-env-sync-sql": "dist/bin/vip-dev-env-sync-sql.js", "vip-import": "dist/bin/vip-import.js", diff --git a/src/bin/vip-phpmyadmin.ts b/src/bin/vip-phpmyadmin.ts new file mode 100755 index 000000000..e30103203 --- /dev/null +++ b/src/bin/vip-phpmyadmin.ts @@ -0,0 +1,58 @@ +#!/usr/bin/env node + +/** + * External dependencies + */ + +/** + * Internal dependencies + */ +import command from '../lib/cli/command'; + +import { makeCommandTracker } from '../lib/tracker'; +import { App, AppEnvironment } from '../graphqlTypes'; +import { PhpMyAdminCommand } from '../commands/phpmyadmin'; + +const examples = [ + { + usage: 'vip phpmyadmin @mysite.develop', + description: 'Open PhpMyAdmin for the @mysite.develop environment', + }, +]; + +const appQuery = ` + id, + name, + type, + organization { id, name }, + environments{ + id + appId + type + name + primaryDomain { name } + uniqueLabel + } +`; + +void command( { + appContext: true, + appQuery, + envContext: true, + module: 'phpmyadmin', + requiredArgs: 0, + usage: 'vip phpmyadmin', +} ) + .examples( examples ) + .argv( process.argv, async ( arg: string[], { app, env }: { app: App; env: AppEnvironment } ) => { + const trackerFn = makeCommandTracker( 'phpmyadmin', { + app: app.id, + env: env.uniqueLabel, + } ); + await trackerFn( 'execute' ); + + const cmd = new PhpMyAdminCommand( app, env, trackerFn ); + await cmd.run(); + + await trackerFn( 'success' ); + } ); diff --git a/src/bin/vip.js b/src/bin/vip.js index 10101497a..0d5c910ba 100755 --- a/src/bin/vip.js +++ b/src/bin/vip.js @@ -35,6 +35,7 @@ const runCmd = async function () { .command( 'logs', 'Get logs from your VIP applications' ) .command( 'search-replace', 'Perform search and replace tasks on files' ) .command( 'slowlogs', 'Get slowlogs from your VIP applications' ) + .command( 'phpmyadmin', 'Open PHPMyAdmin console for your VIP application database' ) .command( 'sync', 'Sync production to a development environment' ) .command( 'whoami', 'Display details about the currently logged-in user' ) .command( 'validate', 'Validate your VIP application and environment' ) diff --git a/src/commands/phpmyadmin.ts b/src/commands/phpmyadmin.ts new file mode 100644 index 000000000..bacd9e98d --- /dev/null +++ b/src/commands/phpmyadmin.ts @@ -0,0 +1,83 @@ +/** + * External dependencies + */ + +import gql from 'graphql-tag'; +import opn from 'opn'; + +/** + * Internal dependencies + */ +import API, { + disableGlobalGraphQLErrorHandling, + enableGlobalGraphQLErrorHandling, +} from '../lib/api'; +import * as exit from '../lib/cli/exit'; +import { CommandTracker } from '../lib/tracker'; +import { App, AppEnvironment } from '../graphqlTypes'; + +export const GENERATE_PHP_MY_ADMIN_URL_MUTATION = gql` + mutation GeneratePhpMyAdminAccess($input: GeneratePhpMyAdminAccessInput) { + generatePHPMyAdminAccess(input: $input) { + expiresAt + url + } + } +`; + +async function generatePhpMyAdminAccess( envId: number ): Promise< string > { + // Disable global error handling so that we can handle errors ourselves + disableGlobalGraphQLErrorHandling(); + + const api = await API(); + const resp = await api.mutate( { + mutation: GENERATE_PHP_MY_ADMIN_URL_MUTATION, + variables: { + input: { + environmentId: envId, + }, + }, + } ); + + // Re-enable global error handling + enableGlobalGraphQLErrorHandling(); + + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access + return resp?.data?.generatePHPMyAdminAccess?.url as string; +} + +export class PhpMyAdminCommand { + app: App; + env: AppEnvironment; + silent?: boolean; + track: CommandTracker; + + constructor( app: App, env: AppEnvironment, trackerFn: CommandTracker = async () => {} ) { + this.app = app; + this.env = env; + this.track = trackerFn; + } + + log( msg: string ) { + if ( this.silent ) { + return; + } + console.log( msg ); + } + + async run( silent = false ) { + this.silent = silent; + + if ( ! this.env.id ) { + exit.withError( 'Please specify an environment' ); + } + + this.log( 'Generating PhpMyAdmin URL...' ); + const url = await generatePhpMyAdminAccess( this.env.id ); + + // eslint-disable-next-line @typescript-eslint/no-unsafe-call + opn( url, { wait: false } ); + + this.log( 'Switch to your default browser.' ); + } +} diff --git a/src/global.d.ts b/src/global.d.ts new file mode 100644 index 000000000..bb06f9897 --- /dev/null +++ b/src/global.d.ts @@ -0,0 +1 @@ +declare module 'opn'; From 7fdbbc5e147300a928f5e9593032946cea5d45a3 Mon Sep 17 00:00:00 2001 From: Abdullah bin Kasim Date: Wed, 11 Oct 2023 14:10:42 +0800 Subject: [PATCH 02/15] Use opn types from package.json instead --- npm-shrinkwrap.json | 35 ++++++++++++++++++++++------------- src/global.d.ts | 1 - 2 files changed, 22 insertions(+), 14 deletions(-) delete mode 100644 src/global.d.ts diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index bcd3d14d3..55e7d8321 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -3116,9 +3116,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/@lando/compose/-/compose-1.0.0.tgz", "integrity": "sha512-n7EelwK+1T22ueYiOWpniBo5508QJtGsXHENIdnew9e30T33GRUbXCeK7at+dv8CvpqgKsw76lD2Antna9b/Zg==", - "bundleDependencies": [ - "lodash" - ], + "bundleDependencies": [ "lodash" ], "dependencies": { "lodash": "^4.17.21" }, @@ -3135,9 +3133,7 @@ "version": "0.8.0", "resolved": "https://registry.npmjs.org/@lando/mailhog/-/mailhog-0.8.0.tgz", "integrity": "sha512-BLa/3l1z+6eW865nnGStV0KeG7rF0H5TT6uAIaYh9kOn8vS1UqKUifVsW5tpl54C6goYH+HqGH45aQzeM5Xxgw==", - "bundleDependencies": [ - "lodash" - ], + "bundleDependencies": [ "lodash" ], "dependencies": { "lodash": "^4.17.21" }, @@ -3869,6 +3865,15 @@ "form-data": "^4.0.0" } }, + "node_modules/@types/opn": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@types/opn/-/opn-5.1.0.tgz", + "integrity": "sha512-TNPrB7Y1xl06zDI0aGyqkgxjhIev3oJ+cdqlZ52MTAHauWpEL/gIUdHebIfRHFZk9IqSBpE2ci1DT48iZH81yg==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/proxy-from-env": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/@types/proxy-from-env/-/proxy-from-env-1.0.4.tgz", @@ -7540,9 +7545,7 @@ "dev": true, "hasInstallScript": true, "optional": true, - "os": [ - "darwin" - ], + "os": [ "darwin" ], "engines": { "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } @@ -13013,10 +13016,7 @@ "version": "9.0.1", "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", - "funding": [ - "https://github.com/sponsors/broofa", - "https://github.com/sponsors/ctavan" - ], + "funding": [ "https://github.com/sponsors/broofa", "https://github.com/sponsors/ctavan" ], "bin": { "uuid": "dist/bin/uuid" } @@ -16386,6 +16386,15 @@ "form-data": "^4.0.0" } }, + "@types/opn": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@types/opn/-/opn-5.1.0.tgz", + "integrity": "sha512-TNPrB7Y1xl06zDI0aGyqkgxjhIev3oJ+cdqlZ52MTAHauWpEL/gIUdHebIfRHFZk9IqSBpE2ci1DT48iZH81yg==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, "@types/proxy-from-env": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/@types/proxy-from-env/-/proxy-from-env-1.0.4.tgz", diff --git a/src/global.d.ts b/src/global.d.ts deleted file mode 100644 index bb06f9897..000000000 --- a/src/global.d.ts +++ /dev/null @@ -1 +0,0 @@ -declare module 'opn'; From 3994b691e73b0b2fddcf3365c8238dcb08f42738 Mon Sep 17 00:00:00 2001 From: Abdullah bin Kasim Date: Wed, 11 Oct 2023 14:39:02 +0800 Subject: [PATCH 03/15] Lint fixes --- src/commands/phpmyadmin.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/commands/phpmyadmin.ts b/src/commands/phpmyadmin.ts index bacd9e98d..a12a092ba 100644 --- a/src/commands/phpmyadmin.ts +++ b/src/commands/phpmyadmin.ts @@ -75,8 +75,7 @@ export class PhpMyAdminCommand { this.log( 'Generating PhpMyAdmin URL...' ); const url = await generatePhpMyAdminAccess( this.env.id ); - // eslint-disable-next-line @typescript-eslint/no-unsafe-call - opn( url, { wait: false } ); + void opn( url, { wait: false } ); this.log( 'Switch to your default browser.' ); } From 3db338e3c009dd1b2b0ac0a4c164efe27b00c0d8 Mon Sep 17 00:00:00 2001 From: Ahmed Sayeed Wasif Date: Thu, 12 Oct 2023 09:48:08 +0600 Subject: [PATCH 04/15] Add tracking and testing --- __tests__/commands/phpmyadmin.ts | 58 ++++++++++++++++++++++++++++++++ src/commands/phpmyadmin.ts | 22 +++++++++--- 2 files changed, 76 insertions(+), 4 deletions(-) create mode 100644 __tests__/commands/phpmyadmin.ts diff --git a/__tests__/commands/phpmyadmin.ts b/__tests__/commands/phpmyadmin.ts new file mode 100644 index 000000000..4dad77d45 --- /dev/null +++ b/__tests__/commands/phpmyadmin.ts @@ -0,0 +1,58 @@ +/* eslint-disable @typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-return */ +/** + * External dependencies + */ + +/** + * Internal dependencies + */ +import { CommandTracker } from '../../src/lib/tracker'; +import { PhpMyAdminCommand } from '../../src/commands/phpmyadmin'; +import API from '../../src/lib/api'; +import { beforeEach, describe, expect, it, jest } from '@jest/globals'; +import opn from 'opn'; + +const mutationMock = jest.fn( async () => { + return Promise.resolve( { + data: { + generatePHPMyAdminAccess: { + url: 'http://test-url.com', + }, + }, + } ); +} ); + +jest.mock( '../../src/lib/api' ); +jest.mock( 'opn' ); +jest.mocked( API ).mockImplementation( () => { + return Promise.resolve( { + mutate: mutationMock, + } as any ); +} ); + +describe( 'commands/PhpMyAdminCommand', () => { + beforeEach( () => {} ); + + describe( '.run', () => { + const app = { id: 123 }; + const env = { id: 456, jobs: [] }; + const tracker = jest.fn() as CommandTracker; + const cmd = new PhpMyAdminCommand( app, env, tracker ); + + it( 'should generate a URL by calling the right mutation', async () => { + await cmd.run(); + expect( mutationMock ).toHaveBeenCalledWith( { + mutation: expect.anything(), + variables: { + input: { + environmentId: 456, + }, + }, + } ); + } ); + it( 'should open the generated URL in browser', async () => { + await cmd.run(); + expect( opn ).toHaveBeenCalledWith( 'http://test-url.com', { wait: false } ); + } ); + } ); +} ); diff --git a/src/commands/phpmyadmin.ts b/src/commands/phpmyadmin.ts index a12a092ba..df9d35c9f 100644 --- a/src/commands/phpmyadmin.ts +++ b/src/commands/phpmyadmin.ts @@ -15,6 +15,7 @@ import API, { import * as exit from '../lib/cli/exit'; import { CommandTracker } from '../lib/tracker'; import { App, AppEnvironment } from '../graphqlTypes'; +import { GraphQLFormattedError } from 'graphql'; export const GENERATE_PHP_MY_ADMIN_URL_MUTATION = gql` mutation GeneratePhpMyAdminAccess($input: GeneratePhpMyAdminAccessInput) { @@ -69,14 +70,27 @@ export class PhpMyAdminCommand { this.silent = silent; if ( ! this.env.id ) { - exit.withError( 'Please specify an environment' ); + exit.withError( 'No environment was specified' ); } this.log( 'Generating PhpMyAdmin URL...' ); - const url = await generatePhpMyAdminAccess( this.env.id ); - void opn( url, { wait: false } ); + let url; + try { + url = await generatePhpMyAdminAccess( this.env.id ); + } catch ( err ) { + const error = err as Error & { + graphQLErrors?: GraphQLFormattedError[]; + }; + void this.track( 'error', { + error_type: 'generate_pma_url', + error_message: error.message, + stack: error.stack, + } ); + exit.withError( 'Failed to generate PhpMyAdmin URL' ); + } - this.log( 'Switch to your default browser.' ); + void opn( url, { wait: false } ); + this.log( 'PhpMyAdmin is opened in your default browser.' ); } } From 5c7f47ee2516f9b25868f9f51ab8a1db3cdc6e28 Mon Sep 17 00:00:00 2001 From: Ahmed Sayeed Wasif Date: Thu, 12 Oct 2023 11:26:08 +0600 Subject: [PATCH 05/15] Display error message --- src/commands/phpmyadmin.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/phpmyadmin.ts b/src/commands/phpmyadmin.ts index df9d35c9f..812bba427 100644 --- a/src/commands/phpmyadmin.ts +++ b/src/commands/phpmyadmin.ts @@ -87,7 +87,7 @@ export class PhpMyAdminCommand { error_message: error.message, stack: error.stack, } ); - exit.withError( 'Failed to generate PhpMyAdmin URL' ); + exit.withError( `Failed to generate PhpMyAdmin URL: ${ error.message }` ); } void opn( url, { wait: false } ); From 7d3902c9f4fa53739fb7cc9f100eb1839e1f7b09 Mon Sep 17 00:00:00 2001 From: Ahmed Sayeed Wasif Date: Wed, 1 Nov 2023 09:32:19 +0600 Subject: [PATCH 06/15] Add `db` command And move `phpmyadmin` as a subcommand of the db command --- package.json | 2 ++ ...vip-phpmyadmin.ts => vip-db-phpmyadmin.ts} | 6 +++--- src/bin/vip-db.ts | 21 +++++++++++++++++++ src/bin/vip.js | 2 +- 4 files changed, 27 insertions(+), 4 deletions(-) rename src/bin/{vip-phpmyadmin.ts => vip-db-phpmyadmin.ts} (85%) create mode 100755 src/bin/vip-db.ts diff --git a/package.json b/package.json index 7955d29f4..f8cef2fec 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,8 @@ "vip-config-software": "dist/bin/vip-config-software.js", "vip-config-software-get": "dist/bin/vip-config-software-get.js", "vip-config-software-update": "dist/bin/vip-config-software-update.js", + "vip-db": "dist/bin/vip-db.js", + "vip-db-phpmyadmin": "dist/bin/vip-db-phpmyadmin.js", "vip-dev-env": "dist/bin/vip-dev-env.js", "vip-dev-env-create": "dist/bin/vip-dev-env-create.js", "vip-dev-env-update": "dist/bin/vip-dev-env-update.js", diff --git a/src/bin/vip-phpmyadmin.ts b/src/bin/vip-db-phpmyadmin.ts similarity index 85% rename from src/bin/vip-phpmyadmin.ts rename to src/bin/vip-db-phpmyadmin.ts index e30103203..60b640e84 100755 --- a/src/bin/vip-phpmyadmin.ts +++ b/src/bin/vip-db-phpmyadmin.ts @@ -15,8 +15,8 @@ import { PhpMyAdminCommand } from '../commands/phpmyadmin'; const examples = [ { - usage: 'vip phpmyadmin @mysite.develop', - description: 'Open PhpMyAdmin for the @mysite.develop environment', + usage: 'vip db phpmyadmin @mysite.develop', + description: 'Open PhpMyAdmin console for the database of the @mysite.develop environment', }, ]; @@ -41,7 +41,7 @@ void command( { envContext: true, module: 'phpmyadmin', requiredArgs: 0, - usage: 'vip phpmyadmin', + usage: 'vip db phpmyadmin', } ) .examples( examples ) .argv( process.argv, async ( arg: string[], { app, env }: { app: App; env: AppEnvironment } ) => { diff --git a/src/bin/vip-db.ts b/src/bin/vip-db.ts new file mode 100755 index 000000000..8bf650f68 --- /dev/null +++ b/src/bin/vip-db.ts @@ -0,0 +1,21 @@ +#!/usr/bin/env node + +/** + * External dependencies + */ + +/** + * Internal dependencies + */ +import command from '../lib/cli/command'; +import { trackEvent } from '../lib/tracker'; + +void command( { usage: 'vip db' } ) + .command( 'phpmyadmin', 'Open PhpMyAdmin console for your application database' ) + .example( + 'vip db phpmyadmin @mysite.develop', + 'Open PhpMyAdmin console for your database of the @mysite.develop environment' + ) + .argv( process.argv, async () => { + await trackEvent( 'vip_db_command_execute' ); + } ); diff --git a/src/bin/vip.js b/src/bin/vip.js index 0d5c910ba..6931ca473 100755 --- a/src/bin/vip.js +++ b/src/bin/vip.js @@ -35,7 +35,7 @@ const runCmd = async function () { .command( 'logs', 'Get logs from your VIP applications' ) .command( 'search-replace', 'Perform search and replace tasks on files' ) .command( 'slowlogs', 'Get slowlogs from your VIP applications' ) - .command( 'phpmyadmin', 'Open PHPMyAdmin console for your VIP application database' ) + .command( 'db', 'Run operations on your VIP application database' ) .command( 'sync', 'Sync production to a development environment' ) .command( 'whoami', 'Display details about the currently logged-in user' ) .command( 'validate', 'Validate your VIP application and environment' ) From 9fb861f224aaa1e480e3274f12899af06676fa4c Mon Sep 17 00:00:00 2001 From: Ahmed Sayeed Wasif Date: Tue, 14 Nov 2023 16:31:57 +0600 Subject: [PATCH 07/15] Remove unnecessary command for package.json --- npm-shrinkwrap.json | 38 +++++++++++++++----------------------- package.json | 1 - 2 files changed, 15 insertions(+), 24 deletions(-) diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 55e7d8321..56f4fde19 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -65,6 +65,8 @@ "vip-config-software": "dist/bin/vip-config-software.js", "vip-config-software-get": "dist/bin/vip-config-software-get.js", "vip-config-software-update": "dist/bin/vip-config-software-update.js", + "vip-db": "dist/bin/vip-db.js", + "vip-db-phpmyadmin": "dist/bin/vip-db-phpmyadmin.js", "vip-dev-env": "dist/bin/vip-dev-env.js", "vip-dev-env-create": "dist/bin/vip-dev-env-create.js", "vip-dev-env-destroy": "dist/bin/vip-dev-env-destroy.js", @@ -94,7 +96,6 @@ "vip-import-validate-sql": "dist/bin/vip-import-validate-sql.js", "vip-logout": "dist/bin/vip-logout.js", "vip-logs": "dist/bin/vip-logs.js", - "vip-phpmyadmin": "dist/bin/vip-phpmyadmin.js", "vip-search-replace": "dist/bin/vip-search-replace.js", "vip-slowlogs": "dist/bin/vip-slowlogs.js", "vip-sync": "dist/bin/vip-sync.js", @@ -3116,7 +3117,9 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/@lando/compose/-/compose-1.0.0.tgz", "integrity": "sha512-n7EelwK+1T22ueYiOWpniBo5508QJtGsXHENIdnew9e30T33GRUbXCeK7at+dv8CvpqgKsw76lD2Antna9b/Zg==", - "bundleDependencies": [ "lodash" ], + "bundleDependencies": [ + "lodash" + ], "dependencies": { "lodash": "^4.17.21" }, @@ -3133,7 +3136,9 @@ "version": "0.8.0", "resolved": "https://registry.npmjs.org/@lando/mailhog/-/mailhog-0.8.0.tgz", "integrity": "sha512-BLa/3l1z+6eW865nnGStV0KeG7rF0H5TT6uAIaYh9kOn8vS1UqKUifVsW5tpl54C6goYH+HqGH45aQzeM5Xxgw==", - "bundleDependencies": [ "lodash" ], + "bundleDependencies": [ + "lodash" + ], "dependencies": { "lodash": "^4.17.21" }, @@ -3865,15 +3870,6 @@ "form-data": "^4.0.0" } }, - "node_modules/@types/opn": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@types/opn/-/opn-5.1.0.tgz", - "integrity": "sha512-TNPrB7Y1xl06zDI0aGyqkgxjhIev3oJ+cdqlZ52MTAHauWpEL/gIUdHebIfRHFZk9IqSBpE2ci1DT48iZH81yg==", - "dev": true, - "dependencies": { - "@types/node": "*" - } - }, "node_modules/@types/proxy-from-env": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/@types/proxy-from-env/-/proxy-from-env-1.0.4.tgz", @@ -7545,7 +7541,9 @@ "dev": true, "hasInstallScript": true, "optional": true, - "os": [ "darwin" ], + "os": [ + "darwin" + ], "engines": { "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } @@ -13016,7 +13014,10 @@ "version": "9.0.1", "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", - "funding": [ "https://github.com/sponsors/broofa", "https://github.com/sponsors/ctavan" ], + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], "bin": { "uuid": "dist/bin/uuid" } @@ -16386,15 +16387,6 @@ "form-data": "^4.0.0" } }, - "@types/opn": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@types/opn/-/opn-5.1.0.tgz", - "integrity": "sha512-TNPrB7Y1xl06zDI0aGyqkgxjhIev3oJ+cdqlZ52MTAHauWpEL/gIUdHebIfRHFZk9IqSBpE2ci1DT48iZH81yg==", - "dev": true, - "requires": { - "@types/node": "*" - } - }, "@types/proxy-from-env": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/@types/proxy-from-env/-/proxy-from-env-1.0.4.tgz", diff --git a/package.json b/package.json index f8cef2fec..85c349874 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,6 @@ "vip-dev-env-purge": "dist/bin/vip-dev-env-purge.js", "vip-export": "dist/bin/vip-export.js", "vip-export-sql": "dist/bin/vip-export-sql.js", - "vip-phpmyadmin": "dist/bin/vip-phpmyadmin.js", "vip-dev-env-sync": "dist/bin/vip-dev-env-sync.js", "vip-dev-env-sync-sql": "dist/bin/vip-dev-env-sync-sql.js", "vip-import": "dist/bin/vip-import.js", From 666b79b7a9ec7042259a526885b103479d593d90 Mon Sep 17 00:00:00 2001 From: Ahmed Sayeed Wasif Date: Tue, 14 Nov 2023 16:37:38 +0600 Subject: [PATCH 08/15] Fix lint --- __tests__/commands/phpmyadmin.ts | 6 +++--- src/bin/vip-db-phpmyadmin.ts | 5 ++--- src/commands/phpmyadmin.ts | 6 +++--- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/__tests__/commands/phpmyadmin.ts b/__tests__/commands/phpmyadmin.ts index 4dad77d45..e1f1ab174 100644 --- a/__tests__/commands/phpmyadmin.ts +++ b/__tests__/commands/phpmyadmin.ts @@ -2,15 +2,15 @@ /** * External dependencies */ +import { beforeEach, describe, expect, it, jest } from '@jest/globals'; +import opn from 'opn'; /** * Internal dependencies */ -import { CommandTracker } from '../../src/lib/tracker'; import { PhpMyAdminCommand } from '../../src/commands/phpmyadmin'; import API from '../../src/lib/api'; -import { beforeEach, describe, expect, it, jest } from '@jest/globals'; -import opn from 'opn'; +import { CommandTracker } from '../../src/lib/tracker'; const mutationMock = jest.fn( async () => { return Promise.resolve( { diff --git a/src/bin/vip-db-phpmyadmin.ts b/src/bin/vip-db-phpmyadmin.ts index 60b640e84..754c91620 100755 --- a/src/bin/vip-db-phpmyadmin.ts +++ b/src/bin/vip-db-phpmyadmin.ts @@ -7,11 +7,10 @@ /** * Internal dependencies */ +import { PhpMyAdminCommand } from '../commands/phpmyadmin'; +import { App, AppEnvironment } from '../graphqlTypes'; import command from '../lib/cli/command'; - import { makeCommandTracker } from '../lib/tracker'; -import { App, AppEnvironment } from '../graphqlTypes'; -import { PhpMyAdminCommand } from '../commands/phpmyadmin'; const examples = [ { diff --git a/src/commands/phpmyadmin.ts b/src/commands/phpmyadmin.ts index 812bba427..0b482f3da 100644 --- a/src/commands/phpmyadmin.ts +++ b/src/commands/phpmyadmin.ts @@ -1,21 +1,20 @@ /** * External dependencies */ - +import { GraphQLFormattedError } from 'graphql'; import gql from 'graphql-tag'; import opn from 'opn'; /** * Internal dependencies */ +import { App, AppEnvironment } from '../graphqlTypes'; import API, { disableGlobalGraphQLErrorHandling, enableGlobalGraphQLErrorHandling, } from '../lib/api'; import * as exit from '../lib/cli/exit'; import { CommandTracker } from '../lib/tracker'; -import { App, AppEnvironment } from '../graphqlTypes'; -import { GraphQLFormattedError } from 'graphql'; export const GENERATE_PHP_MY_ADMIN_URL_MUTATION = gql` mutation GeneratePhpMyAdminAccess($input: GeneratePhpMyAdminAccessInput) { @@ -90,6 +89,7 @@ export class PhpMyAdminCommand { exit.withError( `Failed to generate PhpMyAdmin URL: ${ error.message }` ); } + // eslint-disable-next-line @typescript-eslint/no-unsafe-call void opn( url, { wait: false } ); this.log( 'PhpMyAdmin is opened in your default browser.' ); } From 69ff604053dccbc5d3a76b7d9f4ac3b955c098fd Mon Sep 17 00:00:00 2001 From: Ahmed Sayeed Wasif Date: Tue, 14 Nov 2023 16:46:52 +0600 Subject: [PATCH 09/15] Add accidentally removed global.d.ts --- src/global.d.ts | 1 + 1 file changed, 1 insertion(+) create mode 100644 src/global.d.ts diff --git a/src/global.d.ts b/src/global.d.ts new file mode 100644 index 000000000..bb06f9897 --- /dev/null +++ b/src/global.d.ts @@ -0,0 +1 @@ +declare module 'opn'; From 9eacc719a961fcd4dbe1f771f8a18e7daa2c4134 Mon Sep 17 00:00:00 2001 From: Ahmed Sayeed Wasif Date: Wed, 22 Nov 2023 13:55:25 +0600 Subject: [PATCH 10/15] Display read-only disclaimer for vip-db-phpmyadmin cmd (#1579) --- src/commands/phpmyadmin.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/commands/phpmyadmin.ts b/src/commands/phpmyadmin.ts index 0b482f3da..d350a6354 100644 --- a/src/commands/phpmyadmin.ts +++ b/src/commands/phpmyadmin.ts @@ -1,6 +1,7 @@ /** * External dependencies */ +import chalk from 'chalk'; import { GraphQLFormattedError } from 'graphql'; import gql from 'graphql-tag'; import opn from 'opn'; @@ -72,6 +73,9 @@ export class PhpMyAdminCommand { exit.withError( 'No environment was specified' ); } + const message = + 'Note: PHPMyAdmin sessions are read-only. If you run a query that writes to DB, it will fail.'; + console.log( chalk.yellow( message ) ); this.log( 'Generating PhpMyAdmin URL...' ); let url; From 26916e77fc601d75e231ec43967469246dda43f1 Mon Sep 17 00:00:00 2001 From: Ahmed Sayeed Wasif Date: Mon, 18 Dec 2023 11:58:08 +0600 Subject: [PATCH 11/15] Replace opn by open lib --- __tests__/commands/phpmyadmin.ts | 10 +++++++--- src/commands/phpmyadmin.ts | 10 ++++++---- src/global.d.ts | 1 - 3 files changed, 13 insertions(+), 8 deletions(-) delete mode 100644 src/global.d.ts diff --git a/__tests__/commands/phpmyadmin.ts b/__tests__/commands/phpmyadmin.ts index e1f1ab174..e115c376e 100644 --- a/__tests__/commands/phpmyadmin.ts +++ b/__tests__/commands/phpmyadmin.ts @@ -3,7 +3,6 @@ * External dependencies */ import { beforeEach, describe, expect, it, jest } from '@jest/globals'; -import opn from 'opn'; /** * Internal dependencies @@ -23,7 +22,6 @@ const mutationMock = jest.fn( async () => { } ); jest.mock( '../../src/lib/api' ); -jest.mock( 'opn' ); jest.mocked( API ).mockImplementation( () => { return Promise.resolve( { mutate: mutationMock, @@ -38,6 +36,11 @@ describe( 'commands/PhpMyAdminCommand', () => { const env = { id: 456, jobs: [] }; const tracker = jest.fn() as CommandTracker; const cmd = new PhpMyAdminCommand( app, env, tracker ); + const openUrl = jest.spyOn( cmd, 'openUrl' ); + + beforeEach( () => { + openUrl.mockReset(); + } ); it( 'should generate a URL by calling the right mutation', async () => { await cmd.run(); @@ -50,9 +53,10 @@ describe( 'commands/PhpMyAdminCommand', () => { }, } ); } ); + it( 'should open the generated URL in browser', async () => { await cmd.run(); - expect( opn ).toHaveBeenCalledWith( 'http://test-url.com', { wait: false } ); + expect( openUrl ).toHaveBeenCalledWith( 'http://test-url.com' ); } ); } ); } ); diff --git a/src/commands/phpmyadmin.ts b/src/commands/phpmyadmin.ts index d350a6354..33ea93472 100644 --- a/src/commands/phpmyadmin.ts +++ b/src/commands/phpmyadmin.ts @@ -4,7 +4,6 @@ import chalk from 'chalk'; import { GraphQLFormattedError } from 'graphql'; import gql from 'graphql-tag'; -import opn from 'opn'; /** * Internal dependencies @@ -66,6 +65,11 @@ export class PhpMyAdminCommand { console.log( msg ); } + async openUrl( url: string ) { + const { default: open } = await import( 'open' ); + void open( url, { wait: false } ); + } + async run( silent = false ) { this.silent = silent; @@ -92,9 +96,7 @@ export class PhpMyAdminCommand { } ); exit.withError( `Failed to generate PhpMyAdmin URL: ${ error.message }` ); } - - // eslint-disable-next-line @typescript-eslint/no-unsafe-call - void opn( url, { wait: false } ); + void this.openUrl( url ); this.log( 'PhpMyAdmin is opened in your default browser.' ); } } diff --git a/src/global.d.ts b/src/global.d.ts deleted file mode 100644 index bb06f9897..000000000 --- a/src/global.d.ts +++ /dev/null @@ -1 +0,0 @@ -declare module 'opn'; From 3588b8e9cb1163c0b14089a0b22853cf2d2df76c Mon Sep 17 00:00:00 2001 From: Ahmed Sayeed Wasif Date: Thu, 25 Jan 2024 07:10:46 +0600 Subject: [PATCH 12/15] Add step to enable PHPMyAdmin in the phpmyadmin command (#1665) * Add step to enable pma * Refactor for clarity - make function name clearer - add return types * Fix and improve unit test * Make function names even clearer --------- Co-authored-by: Sarosh Aga --- __tests__/commands/phpmyadmin.ts | 48 +++++++++-- src/commands/phpmyadmin.ts | 140 +++++++++++++++++++++++++++++-- 2 files changed, 172 insertions(+), 16 deletions(-) diff --git a/__tests__/commands/phpmyadmin.ts b/__tests__/commands/phpmyadmin.ts index e115c376e..9a584db17 100644 --- a/__tests__/commands/phpmyadmin.ts +++ b/__tests__/commands/phpmyadmin.ts @@ -11,7 +11,7 @@ import { PhpMyAdminCommand } from '../../src/commands/phpmyadmin'; import API from '../../src/lib/api'; import { CommandTracker } from '../../src/lib/tracker'; -const mutationMock = jest.fn( async () => { +const generatePMAAccessMutationMock = jest.fn( async () => { return Promise.resolve( { data: { generatePHPMyAdminAccess: { @@ -21,10 +21,37 @@ const mutationMock = jest.fn( async () => { } ); } ); +const enablePMAMutationMock = jest.fn( async () => { + return Promise.resolve( { + data: { + enablePHPMyAdmin: { + success: true, + }, + }, + } ); +} ); + +const pmaEnabledQueryMockTrue = jest.fn( async () => { + return Promise.resolve( { + data: { + app: { + environments: [ + { + phpMyAdminStatus: { + status: 'enabled', + }, + }, + ], + }, + }, + } ); +} ); + jest.mock( '../../src/lib/api' ); jest.mocked( API ).mockImplementation( () => { return Promise.resolve( { - mutate: mutationMock, + mutate: generatePMAAccessMutationMock, + query: pmaEnabledQueryMockTrue, } as any ); } ); @@ -42,9 +69,18 @@ describe( 'commands/PhpMyAdminCommand', () => { openUrl.mockReset(); } ); - it( 'should generate a URL by calling the right mutation', async () => { + it( 'should open the generated URL in browser', async () => { await cmd.run(); - expect( mutationMock ).toHaveBeenCalledWith( { + expect( pmaEnabledQueryMockTrue ).toHaveBeenCalledWith( { + query: expect.anything(), + variables: { + appId: 123, + envId: 456, + }, + fetchPolicy: 'network-only', + } ); + expect( enablePMAMutationMock ).not.toHaveBeenCalled(); + expect( generatePMAAccessMutationMock ).toHaveBeenCalledWith( { mutation: expect.anything(), variables: { input: { @@ -52,10 +88,6 @@ describe( 'commands/PhpMyAdminCommand', () => { }, }, } ); - } ); - - it( 'should open the generated URL in browser', async () => { - await cmd.run(); expect( openUrl ).toHaveBeenCalledWith( 'http://test-url.com' ); } ); } ); diff --git a/src/commands/phpmyadmin.ts b/src/commands/phpmyadmin.ts index 33ea93472..5bb580a7b 100644 --- a/src/commands/phpmyadmin.ts +++ b/src/commands/phpmyadmin.ts @@ -1,8 +1,14 @@ /** * External dependencies */ +import { + ApolloClient, + ApolloQueryResult, + FetchResult, + NormalizedCacheObject, +} from '@apollo/client'; import chalk from 'chalk'; -import { GraphQLFormattedError } from 'graphql'; +import { DocumentNode, GraphQLFormattedError } from 'graphql'; import gql from 'graphql-tag'; /** @@ -14,9 +20,11 @@ import API, { enableGlobalGraphQLErrorHandling, } from '../lib/api'; import * as exit from '../lib/cli/exit'; +import { ProgressTracker } from '../lib/cli/progress'; import { CommandTracker } from '../lib/tracker'; +import { pollUntil } from '../lib/utils'; -export const GENERATE_PHP_MY_ADMIN_URL_MUTATION = gql` +export const GENERATE_PHP_MY_ADMIN_URL_MUTATION: DocumentNode = gql` mutation GeneratePhpMyAdminAccess($input: GeneratePhpMyAdminAccessInput) { generatePHPMyAdminAccess(input: $input) { expiresAt @@ -25,12 +33,33 @@ export const GENERATE_PHP_MY_ADMIN_URL_MUTATION = gql` } `; +export const GET_PHP_MY_ADMIN_STATUS_QUERY: DocumentNode = gql` + query PhpMyAdminStatus($appId: Int!, $envId: Int!) { + app(id: $appId) { + environments(id: $envId) { + phpMyAdminStatus { + status + } + } + } + } +`; + +export const ENABLE_PHP_MY_ADMIN_MUTATION: DocumentNode = gql` + mutation EnablePhpMyAdmin($input: EnablePhpMyAdminInput) { + enablePHPMyAdmin(input: $input) { + success + } + } +`; + async function generatePhpMyAdminAccess( envId: number ): Promise< string > { // Disable global error handling so that we can handle errors ourselves disableGlobalGraphQLErrorHandling(); - const api = await API(); - const resp = await api.mutate( { + const api: ApolloClient< NormalizedCacheObject > = await API(); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const resp: FetchResult< any, Record< string, any >, Record< string, any > > = await api.mutate( { mutation: GENERATE_PHP_MY_ADMIN_URL_MUTATION, variables: { input: { @@ -46,33 +75,114 @@ async function generatePhpMyAdminAccess( envId: number ): Promise< string > { return resp?.data?.generatePHPMyAdminAccess?.url as string; } +async function enablePhpMyAdmin( envId: number ): Promise< string > { + // Disable global error handling so that we can handle errors ourselves + disableGlobalGraphQLErrorHandling(); + + const api: ApolloClient< NormalizedCacheObject > = await API(); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const resp: FetchResult< any, Record< string, any >, Record< string, any > > = await api.mutate( { + mutation: ENABLE_PHP_MY_ADMIN_MUTATION, + variables: { + input: { + environmentId: envId, + }, + }, + } ); + + // Re-enable global error handling + enableGlobalGraphQLErrorHandling(); + + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access + return resp?.data?.generatePHPMyAdminAccess?.url as string; +} + +async function getPhpMyAdminStatus( appId: number, envId: number ): Promise< string > { + // Disable global error handling so that we can handle errors ourselves + disableGlobalGraphQLErrorHandling(); + + const api: ApolloClient< NormalizedCacheObject > = await API(); + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const resp: ApolloQueryResult< any > = await api.query( { + query: GET_PHP_MY_ADMIN_STATUS_QUERY, + variables: { appId, envId }, + fetchPolicy: 'network-only', + } ); + + // Re-enable global error handling + enableGlobalGraphQLErrorHandling(); + + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access + return resp?.data?.app?.environments?.[ 0 ]?.phpMyAdminStatus?.status as string; +} + export class PhpMyAdminCommand { app: App; env: AppEnvironment; silent?: boolean; track: CommandTracker; + steps = { + ENABLE: 'enable', + GENERATE: 'generate', + }; + private progressTracker: ProgressTracker; constructor( app: App, env: AppEnvironment, trackerFn: CommandTracker = async () => {} ) { this.app = app; this.env = env; this.track = trackerFn; + this.progressTracker = new ProgressTracker( [ + { id: this.steps.ENABLE, name: 'Enabling PHPMyAdmin for this site' }, + { id: this.steps.GENERATE, name: 'Generating access link' }, + ] ); } - log( msg: string ) { + log( msg: string ): void { if ( this.silent ) { return; } console.log( msg ); } - async openUrl( url: string ) { + stopProgressTracker(): void { + this.progressTracker.print(); + this.progressTracker.stopPrinting(); + } + + async openUrl( url: string ): Promise< void > { const { default: open } = await import( 'open' ); void open( url, { wait: false } ); } - async run( silent = false ) { + async getStatus(): Promise< string > { + try { + return await getPhpMyAdminStatus( this.app.id as number, this.env.id as number ); + } catch ( err ) { + exit.withError( + 'Failed to get PhpMyAdmin status. Please try again. If the problem persists, please contact support.' + ); + } + } + + async maybeEnablePhpMyAdmin(): Promise< void > { + const status = await this.getStatus(); + if ( ! [ 'running', 'enabled' ].includes( status ) ) { + await enablePhpMyAdmin( this.env.id as number ); + await pollUntil( this.getStatus.bind( this ), 1000, ( sts: string ) => sts === 'running' ); + + // Additional 30s for LB routing to be updated + await new Promise( resolve => setTimeout( resolve, 30000 ) ); + } + } + + async run( silent = false ): Promise< void > { this.silent = silent; + if ( ! this.app.id ) { + exit.withError( 'No app was specified' ); + } + if ( ! this.env.id ) { exit.withError( 'No environment was specified' ); } @@ -80,12 +190,24 @@ export class PhpMyAdminCommand { const message = 'Note: PHPMyAdmin sessions are read-only. If you run a query that writes to DB, it will fail.'; console.log( chalk.yellow( message ) ); - this.log( 'Generating PhpMyAdmin URL...' ); + + this.progressTracker.startPrinting(); + try { + this.progressTracker.stepRunning( this.steps.ENABLE ); + await this.maybeEnablePhpMyAdmin(); + this.progressTracker.stepSuccess( this.steps.ENABLE ); + } catch ( err ) { + this.progressTracker.stepFailed( this.steps.ENABLE ); + exit.withError( 'Failed to enable PhpMyAdmin' ); + } let url; try { + this.progressTracker.stepRunning( this.steps.GENERATE ); url = await generatePhpMyAdminAccess( this.env.id ); + this.progressTracker.stepSuccess( this.steps.GENERATE ); } catch ( err ) { + this.progressTracker.stepFailed( this.steps.GENERATE ); const error = err as Error & { graphQLErrors?: GraphQLFormattedError[]; }; @@ -96,7 +218,9 @@ export class PhpMyAdminCommand { } ); exit.withError( `Failed to generate PhpMyAdmin URL: ${ error.message }` ); } + void this.openUrl( url ); + this.stopProgressTracker(); this.log( 'PhpMyAdmin is opened in your default browser.' ); } } From 0deb40d68229978d3b5134310c882dd92f60bc43 Mon Sep 17 00:00:00 2001 From: Sarosh Aga Date: Fri, 26 Jan 2024 19:41:36 +0530 Subject: [PATCH 13/15] Add event tracking for PMA enable failures (#1667) * Add event tracking for PMA enable failures * Refactor * Bring back empty line * Print progress steps properly on error scenarios --------- Co-authored-by: Ahmed Sayeed Wasif --- src/commands/phpmyadmin.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/commands/phpmyadmin.ts b/src/commands/phpmyadmin.ts index 5bb580a7b..7dd9ab7b3 100644 --- a/src/commands/phpmyadmin.ts +++ b/src/commands/phpmyadmin.ts @@ -133,7 +133,7 @@ export class PhpMyAdminCommand { this.env = env; this.track = trackerFn; this.progressTracker = new ProgressTracker( [ - { id: this.steps.ENABLE, name: 'Enabling PHPMyAdmin for this site' }, + { id: this.steps.ENABLE, name: 'Enabling PHPMyAdmin for this environment' }, { id: this.steps.GENERATE, name: 'Generating access link' }, ] ); } @@ -198,6 +198,15 @@ export class PhpMyAdminCommand { this.progressTracker.stepSuccess( this.steps.ENABLE ); } catch ( err ) { this.progressTracker.stepFailed( this.steps.ENABLE ); + const error = err as Error & { + graphQLErrors?: GraphQLFormattedError[]; + }; + void this.track( 'error', { + error_type: 'enable_pma', + error_message: error.message, + stack: error.stack, + } ); + this.stopProgressTracker(); exit.withError( 'Failed to enable PhpMyAdmin' ); } @@ -216,6 +225,7 @@ export class PhpMyAdminCommand { error_message: error.message, stack: error.stack, } ); + this.stopProgressTracker(); exit.withError( `Failed to generate PhpMyAdmin URL: ${ error.message }` ); } From cc7ad137c72f1dc509f40e3ea6e3139ec386c2ef Mon Sep 17 00:00:00 2001 From: Ahmed Sayeed Wasif Date: Tue, 30 Jan 2024 17:09:00 +0600 Subject: [PATCH 14/15] Track errors encounted at get-status (#1672) --- src/commands/phpmyadmin.ts | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/commands/phpmyadmin.ts b/src/commands/phpmyadmin.ts index 7dd9ab7b3..31bdc4784 100644 --- a/src/commands/phpmyadmin.ts +++ b/src/commands/phpmyadmin.ts @@ -156,13 +156,7 @@ export class PhpMyAdminCommand { } async getStatus(): Promise< string > { - try { - return await getPhpMyAdminStatus( this.app.id as number, this.env.id as number ); - } catch ( err ) { - exit.withError( - 'Failed to get PhpMyAdmin status. Please try again. If the problem persists, please contact support.' - ); - } + return await getPhpMyAdminStatus( this.app.id as number, this.env.id as number ); } async maybeEnablePhpMyAdmin(): Promise< void > { @@ -207,7 +201,9 @@ export class PhpMyAdminCommand { stack: error.stack, } ); this.stopProgressTracker(); - exit.withError( 'Failed to enable PhpMyAdmin' ); + exit.withError( + 'Failed to enable PhpMyAdmin. Please try again. If the problem persists, please contact support.' + ); } let url; From 7bf11f9b3c08a405e4187b5612b6a9313f4ebe17 Mon Sep 17 00:00:00 2001 From: Ahmed Sayeed Wasif Date: Thu, 1 Feb 2024 16:44:08 +0600 Subject: [PATCH 15/15] Update appQuery to reduce fields --- src/bin/vip-db-phpmyadmin.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/bin/vip-db-phpmyadmin.ts b/src/bin/vip-db-phpmyadmin.ts index 754c91620..76a6ad65d 100755 --- a/src/bin/vip-db-phpmyadmin.ts +++ b/src/bin/vip-db-phpmyadmin.ts @@ -21,15 +21,10 @@ const examples = [ const appQuery = ` id, - name, - type, - organization { id, name }, environments{ id appId type - name - primaryDomain { name } uniqueLabel } `;