Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4,172 changes: 108 additions & 4,064 deletions README.md

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions eslint.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const tseslint = require('typescript-eslint');

module.exports = [
{
files: [
'src/**/*.{ts,cts,mts}',
'test/**/*.{ts,cts,mts}'
],
languageOptions: {
parser: tseslint.parser,
ecmaVersion: 'latest'
},
plugins: {
'@typescript-eslint': tseslint.plugin
},
rules: {
...tseslint.configs.recommended[1].rules
}
}
];
13,468 changes: 6,573 additions & 6,895 deletions package-lock.json

Large diffs are not rendered by default.

45 changes: 22 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@
"url": "https://github.com/mapcentia/gc2-cli/issues"
},
"dependencies": {
"@inquirer/prompts": "^7.8.6",
"@oclif/command": "^1.8.36",
"@oclif/core": "^3.27.0",
"@oclif/parser": "^3.8.17",
"@oclif/plugin-autocomplete": "^3.2.4",
"@oclif/plugin-help": "^6.0.1",
"@oclif/plugin-not-found": "^3.2.21",
"@oclif/plugin-update": "^3.2.4",
"@types/adm-zip": "^0.5.0",
"@types/configstore": "^4.0.0",
"@types/inquirer": "^9.0.7",
Expand All @@ -30,37 +28,35 @@
"chalk": "^4.1.0",
"cli-ux": "^5.5.1",
"configstore": "^5.0.1",
"dotenv": "^16.4.5",
"fetch-blob": "^3.2.0",
"form-data": "^4.0.0",
"inquirer": "^10.1.8",
"inquirer": "^12.9.6",
"jsdom": "^24.1.0",
"jwt-decode": "^4.0.0",
"node-fetch": "^2.6.7",
"through2": "^3.0.2",
"tslib": "^1.14.1",
"url-parse": "^1.4.7",
"tslib": "^2.8.1",
"uuid": "^9.0.0"
},
"devDependencies": {
"@aws-sdk/client-s3": "^3.525.0",
"@oclif/test": "^3.1.2",
"@oclif/tslint": "^3.1.1",
"@types/chai": "^4.3.10",
"@types/jsdom": "^21.1.7",
"@types/lodash": "^4.14.202",
"@types/mocha": "^10.0.4",
"@types/node": "^10.17.60",
"@types/node": "^18.19.128",
"@typescript-eslint/eslint-plugin": "^8.45.0",
"@typescript-eslint/parser": "^8.45.0",
"aws-sdk": "^2.1159.0",
"chai": "^4.3.10",
"globby": "^10.0.2",
"eslint": "^9.36.0",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-n": "^17.23.1",
"eslint-plugin-prettier": "^5.5.4",
"mocha": "^10.8.2",
"nock": "^13.3.8",
"nyc": "^14.1.1",
"stdout-stderr": "^0.1.13",
"nyc": "^17.1.0",
"oclif": "^4.22.27",
"ts-node": "^10.9.2",
"tslint": "^5.20.1",
"typescript": "4.7.4"
"typescript": "^5.9.2",
"typescript-eslint": "^8.45.0"
},
"engines": {
"node": ">=18.0.0"
Expand Down Expand Up @@ -149,18 +145,21 @@
"scripts": {
"prebuild": "node scripts/build.js",
"postpack": "rm -f oclif.manifest.json",
"posttest": "tslint -p test -t stylish",
"prepack": "rm -rf lib && /usr/bin/tsc -b && oclif manifest && oclif readme",
"test": " NODE_OPTIONS=\"--loader ts-node/esm\" nyc --extension .ts mocha --forbid-only \"test/**/*.test.ts\"",
"version": "oclif-dev readme && git add README.md",
"prepack": "rm -rf lib && tsc && oclif manifest && oclif readme",
"version": "oclif readme && git add README.md",
"packwin": "oclif pack win",
"uploadwin": "oclif upload win",
"packdeb": "oclif pack deb",
"uploaddeb": "oclif upload deb",
"packtarballs": "oclif pack tarballs",
"uploadtarballs": "oclif upload tarballs",
"promotewin": "oclif promote --win --targets=win32-x64 --sha=$(git rev-parse --short HEAD) --version=$(node -p \"require('./package.json').version\")",
"promotedeb": "oclif promote --deb --targets=linux-x64 --sha=$(git rev-parse --short HEAD) --version=$(node -p \"require('./package.json').version\")"
"promotedeb": "oclif promote --deb --targets=linux-x64 --sha=$(git rev-parse --short HEAD) --version=$(node -p \"require('./package.json').version\")",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"test:plain": "mocha --forbid-only 'test/**/*.test.*ts'",
"test:nyc": "nyc --extension .ts mocha --forbid-only 'test/**/*.test.*ts'",
"test": "npm run -s test:plain"
},
"types": "lib/index.d.ts",
"directories": {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/admin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export default class Admin extends Command {
break
case tasks[4]:
Object.keys(data.data).forEach(key => {
let value = data.data[key]
const value = data.data[key]
this.log(key + ': ' + chalk.green(value))
})
this.log(`time ${data._execution_time}`)
Expand Down
2 changes: 1 addition & 1 deletion src/commands/client/drop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default class Drop extends Command {

async run() {
const {args} = await this.parse(Drop)
let id = args?.id || await clientList()
const id = args?.id || await clientList()
if (!await confirm({message: '⚠️ The client will be deleted. Are you sure', default: false})) {
this.exit();
}
Expand Down
6 changes: 3 additions & 3 deletions src/commands/client/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {Args, Command, Flags} from '@oclif/core'
import cli from 'cli-ux'
import {clients} from '../../util/getters'

let specific_args = {
const specific_args = {
id: Args.string(
{
required: false,
Expand All @@ -26,8 +26,8 @@ export default class Get extends Command {
static args = {...specific_args}

async run() {
let {args} = await this.parse(Get)
let res = await clients(args?.id)
const {args} = await this.parse(Get)
const res = await clients(args?.id)
type row = {
[key: string]: any
}
Expand Down
2 changes: 1 addition & 1 deletion src/commands/client/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default class Update extends Command {
async run() {
const {args} = await this.parse(Update)
const {flags} = await this.parse(Update)
let id = args?.id || await clientList()
const id = args?.id || await clientList()
const clientResult = await clients(id)
const client = clientResult.clients[0]

Expand Down
4 changes: 2 additions & 2 deletions src/commands/column/add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import {schemasList, tableList, typeList} from '../../util/lists'
import make from '../../util/make-request'
import setSchema from '../../util/set-schema'

let base_args = args
let specific_args = {
const base_args = args
const specific_args = {
column: Args.string(
{
required: false,
Expand Down
4 changes: 2 additions & 2 deletions src/commands/column/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import {columnList, schemasList, tableList} from '../../util/lists'
import make from '../../util/make-request'
import setSchema from '../../util/set-schema'

let base_args = args
let specific_args = {
const base_args = args
const specific_args = {
column: Args.string(
{
required: false,
Expand Down
4 changes: 2 additions & 2 deletions src/commands/column/drop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import {columnList, schemasList, tableList} from '../../util/lists'
import make from '../../util/make-request'
import setSchema from '../../util/set-schema'

let base_args = args
let specific_args = {
const base_args = args
const specific_args = {
column: Args.string(
{
required: false,
Expand Down
4 changes: 2 additions & 2 deletions src/commands/column/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import {columnList, schemasList, tableList} from '../../util/lists'
import make from '../../util/make-request'
import setSchema from '../../util/set-schema'

let base_args = args
let specific_args = {
const base_args = args
const specific_args = {
column: Args.string(
{
required: false,
Expand Down
4 changes: 2 additions & 2 deletions src/commands/column/nullable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import {columnList, schemasList, tableList} from '../../util/lists'
import make from '../../util/make-request'
import setSchema from '../../util/set-schema'

let base_args = args
let specific_args = {
const base_args = args
const specific_args = {
column: Args.string(
{
required: false,
Expand Down
4 changes: 2 additions & 2 deletions src/commands/column/rename.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import {columnList, schemasList, tableList} from '../../util/lists'
import make from '../../util/make-request'
import setSchema from '../../util/set-schema'

let base_args = args
let specific_args = {
const base_args = args
const specific_args = {
column: Args.string(
{
required: false,
Expand Down
4 changes: 2 additions & 2 deletions src/commands/column/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import {columnList, schemasList, tableList, typeList} from '../../util/lists'
import make from '../../util/make-request'
import setSchema from '../../util/set-schema'

let base_args = args
let specific_args = {
const base_args = args
const specific_args = {
column: Args.string(
{
required: false,
Expand Down
6 changes: 3 additions & 3 deletions src/commands/constraint/add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import {columnCheck, constraintTypeList, schemasList, tableList} from '../../uti
import make from '../../util/make-request'
import setSchema from '../../util/set-schema'

let base_args = args
let specific_args = {
const base_args = args
const specific_args = {
columns: Args.string(
{
required: false,
Expand Down Expand Up @@ -62,7 +62,7 @@ export default class Add extends Command {

async run() {
let {args} = await this.parse(Add)
let {flags} = await this.parse(Add)
const {flags} = await this.parse(Add)

args = setSchema(args)
const schema = args?.schema || await schemasList()
Expand Down
4 changes: 2 additions & 2 deletions src/commands/constraint/drop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import {constraintList, schemasList, tableList} from '../../util/lists'
import make from '../../util/make-request'
import setSchema from '../../util/set-schema'

let base_args = args
let specific_args = {
const base_args = args
const specific_args = {
name: Args.string(
{
required: false,
Expand Down
4 changes: 2 additions & 2 deletions src/commands/constraint/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import {constraintList, schemasList, tableList} from '../../util/lists'
import make from '../../util/make-request'
import setSchema from '../../util/set-schema'

let base_args = args
let specific_args = {
const base_args = args
const specific_args = {
name: Args.string(
{
required: false,
Expand Down
9 changes: 6 additions & 3 deletions src/commands/import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import setSchema from "../util/set-schema"
const config: Configstore = new Configstore('gc2-env')
const userConfig: User = config.all

let args: any = {}
const args: any = {}

args.path = Args.string(
{
Expand Down Expand Up @@ -75,7 +75,10 @@ export default class Import extends Command {
static args = args

async run() {
let {flags, args} = await this.parse(Import)
const parsed = await this.parse(Import)
const { flags } = parsed
let { args } = parsed

args = setSchema(args)

let tmpDir
Expand Down Expand Up @@ -123,7 +126,7 @@ export default class Import extends Command {
}
cli.action.stop()

let body: any = flags
const body: any = flags
if (!flags.dry_run) {
body.import = true
}
Expand Down
4 changes: 2 additions & 2 deletions src/commands/index/add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import make from '../../util/make-request'
import args, {BaseArgs} from '../../common/base_args'
import setSchema from '../../util/set-schema'

let base_args: BaseArgs = args
let specific_args = {
const base_args: BaseArgs = args
const specific_args = {
columns: Args.string(
{
required: false,
Expand Down
4 changes: 2 additions & 2 deletions src/commands/index/drop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import {schemasList, tableList, indexList} from '../../util/lists'
import make from '../../util/make-request'
import setSchema from '../../util/set-schema'

let base_args = args
let specific_args = {
const base_args = args
const specific_args = {
name: Args.string(
{
required: false,
Expand Down
4 changes: 2 additions & 2 deletions src/commands/index/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import {schemasList, tableList, indexList} from '../../util/lists'
import make from '../../util/make-request'
import setSchema from '../../util/set-schema'

let base_args = args
let specific_args = {
const base_args = args
const specific_args = {
name: Args.string(
{
required: false,
Expand Down
4 changes: 2 additions & 2 deletions src/commands/privilege/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import {privileges} from '../../util/getters'
import {schemasList, tableList} from '../../util/lists'
import setSchema from '../../util/set-schema'

let base_args = args
let specific_args = {}
const base_args = args
const specific_args = {}

export default class Get extends Command {
static description = 'Get user privileges on table.'
Expand Down
4 changes: 2 additions & 2 deletions src/commands/privilege/set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import {privilegeList, schemasList, tableList, userList} from '../../util/lists'
import make from '../../util/make-request'
import setSchema from '../../util/set-schema'

let base_args = args
let specific_args = {
const base_args = args
const specific_args = {
user: Args.string(
{
required: false,
Expand Down
2 changes: 1 addition & 1 deletion src/commands/rule/drop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default class Drop extends Command {

async run() {
const {args} = await this.parse(Drop)
let id = args?.id || await ruleList()
const id = args?.id || await ruleList()
if (!await confirm({message: '⚠️ The rule will be deleted. Are you sure', default: false})) {
this.exit();
}
Expand Down
4 changes: 2 additions & 2 deletions src/commands/rule/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {Args, Command, Flags} from '@oclif/core'
import cli from 'cli-ux'
import {rules} from '../../util/getters'

let specific_args = {
const specific_args = {
id: Args.string(
{
required: false,
Expand All @@ -25,7 +25,7 @@ export default class Get extends Command {
}
static args = {...specific_args}
async run() {
let {args} = await this.parse(Get)
const {args} = await this.parse(Get)
let res = await rules(args?.id)
if (args?.id) {
res = {rules: [res]};
Expand Down
Loading