-
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(*): typescript definition support
- Loading branch information
Joseph Andersen
committed
Aug 12, 2019
1 parent
38a3e86
commit c61427f
Showing
8 changed files
with
76 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { PartialOptions } from "./options"; | ||
|
||
export const FILTER_UNDEFINED_ERROR = | ||
'node-jq: invalid filter argument supplied: "undefined"' | ||
export const INPUT_JSON_UNDEFINED_ERROR = | ||
'node-jq: invalid json object argument supplied: "undefined"' | ||
export const INPUT_STRING_ERROR = | ||
'node-jq: invalid json string argument supplied' | ||
|
||
interface ICommand { | ||
command: string, | ||
args: string[], | ||
stdin: string | ||
} | ||
export function commandFactory(filter: string, json: any, options?: PartialOptions, jqPath?: string): ICommand |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import * as childProcess from "child_process"; | ||
|
||
export default function(command: string, args: string[], stdin: string, spawnOptions?: childProcess.SpawnOptions): Promise<string> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import * as childProcess from "child_process"; | ||
import { PartialOptions } from "./options" | ||
|
||
interface run { | ||
(filter: string, json: any, options?: PartialOptions, jqPath?: string, spawnOptions?: childProcess.SpawnOptions): Promise<object | string> | ||
} | ||
export class JQ { | ||
constructor(jqPath?: string, spawnOptions?: childProcess.SpawnOptions); | ||
run: run; | ||
} | ||
export const run: run; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import * as Joi from "@hapi/joi"; | ||
|
||
export const optionsSchema: Joi.SchemaLike | ||
export const preSpawnSchema: Joi.SchemaLike | ||
export const spawnSchema: Joi.SchemaLike | ||
export function parseOptions(options: PartialOptions, filter: string, json: any): any | ||
export const optionDefaults: IOptions; | ||
interface IOptions { | ||
color: boolean, | ||
locations: string[], | ||
output: string, | ||
raw: boolean, | ||
slurp: boolean, | ||
sort: boolean, | ||
} | ||
export type PartialOptions = Partial<IOptions> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export const INVALID_PATH_ERROR = | ||
'node-jq: invalid path argument supplied (not a valid path)' | ||
export const INVALID_JSON_PATH_ERROR = | ||
'node-jq: invalid path argument supplied (not a .json file)' | ||
|
||
export function isJSONPath(path: any): boolean | ||
|
||
export function validateJSONPath(path: any): boolean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters