-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
groq-builder: strongly-typed parameters (variables) and conditionals (#…
…263) * feature(variables): renamed `TRootConfig` to `TQueryConfig` * feature(variables): added variables command * feature(variables): improved `makeSafeQueryRunner` to handle variables and other custom fields * feature(variables): added changeset * feature(variables): added conditional statement auto-complete suggestions * feature(variables): improved auto-complete suggestions * feature(variables): added strongly-typed `filterBy` * feature(variables): fixed minor issue with InferResultItem / InferVariablesType * feature(variables): use uppercase keys for conditionals * feature(variables): updated conditionals to accept IGroqBuilder * feature(variables): allow paths within conditionals * feature(variables): extracted `createGroqBuilder` into separate file * feature(variables): renamed 'variables' to 'parameters' for better consistency with Groq * feature(variables): renamed 'variables' to 'parameters' for better consistency with Groq * feature(variables): infer raw type from parser * feature(variables): moved createGroqBuilder back into index, since the import order was important * feature(variables): added jsdocs * feature(variables): updated lockfile * feature(variables): support deeply-nested parameters * feature(variables): improved docs for makeSafeQueryRunner * feature(variables): improved code for expression suggestions * feature(variables): improved changeset --------- Co-authored-by: scottrippey <[email protected]>
- Loading branch information
1 parent
d273147
commit 1a5eb69
Showing
53 changed files
with
1,191 additions
and
274 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
"groq-builder": minor | ||
--- | ||
|
||
Added support for parameters. | ||
|
||
Added `filterBy` for strongly-typed filtering. | ||
|
||
Added auto-complete help for conditional statements and filters. | ||
|
||
Changed how parameters are passed to `makeSafeQueryRunner`. | ||
|
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
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
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
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 |
---|---|---|
@@ -1,20 +1,20 @@ | ||
import { GroqBuilder } from "../groq-builder"; | ||
import { ExtractRefType, RootConfig } from "../types/schema-types"; | ||
import { ExtractRefType, QueryConfig } from "../types/schema-types"; | ||
import { ResultItem } from "../types/result-types"; | ||
|
||
declare module "../groq-builder" { | ||
export interface GroqBuilder<TResult, TRootConfig> { | ||
export interface GroqBuilder<TResult, TQueryConfig> { | ||
deref< | ||
TReferencedType = ExtractRefType<ResultItem.Infer<TResult>, TRootConfig> | ||
TReferencedType = ExtractRefType<ResultItem.Infer<TResult>, TQueryConfig> | ||
>(): GroqBuilder< | ||
ResultItem.Override<TResult, TReferencedType>, | ||
TRootConfig | ||
TQueryConfig | ||
>; | ||
} | ||
} | ||
|
||
GroqBuilder.implement({ | ||
deref(this: GroqBuilder<any, RootConfig>) { | ||
deref(this: GroqBuilder<any, QueryConfig>) { | ||
return this.chain("->"); | ||
}, | ||
}); |
Oops, something went wrong.