diff --git a/src/exported.ts b/src/exported.ts index 1a58e557..b4899080 100644 --- a/src/exported.ts +++ b/src/exported.ts @@ -9,3 +9,4 @@ export { generateTableChoices } from './util'; export { Deployable, Deployer } from './deployer'; export { Prompter } from './prompter'; export { runHook, SfHook } from './hooks'; +export { JsonObject, TableObject } from './types'; diff --git a/src/hooks.ts b/src/hooks.ts index b98f1032..925c9aa1 100644 --- a/src/hooks.ts +++ b/src/hooks.ts @@ -10,11 +10,11 @@ import { Hook, Hooks } from '@oclif/core/lib/interfaces/hooks'; import { cli } from 'cli-ux'; import { Duration, env } from '@salesforce/kit'; import { Deployer } from './deployer'; -import { EnvList, EnvDisplay, DataObject, Deploy, Login } from './types'; +import { EnvList, EnvDisplay, JsonObject, Deploy, Login, TableObject } from './types'; interface SfHooks extends Hooks { - 'sf:env:list': EnvList.HookMeta; - 'sf:env:display': EnvDisplay.HookMeta; + 'sf:env:list': EnvList.HookMeta; + 'sf:env:display': EnvDisplay.HookMeta; 'sf:deploy': Deploy.HookMeta; 'sf:login': Login.HookMeta; } diff --git a/src/types/index.ts b/src/types/index.ts index 8286a3c0..d56ffced 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -7,19 +7,27 @@ import { Deployer } from '../deployer'; -export type DataObject = { - [key: string]: string | boolean; +export type JsonObject = { + [key: string]: string | string[] | number | number[] | boolean | boolean[] | null | undefined; +}; + +/** + * Describes an object that is intended to be rendered in a table, which requires + * that no value is an array. + */ +export type TableObject = { + [key: string]: string | number | boolean | null | undefined; }; export namespace EnvDisplay { - export type HookMeta = { - options: {}; + export type HookMeta = { + options: { targetEnv: string }; return: T; }; } export namespace EnvList { - type Table = { + type Table = { data: T[]; columns: Array; title: string; @@ -29,7 +37,7 @@ export namespace EnvList { all: boolean; }; - export type HookMeta = { + export type HookMeta = { options: Options; return: Array>; };