@@ -2,16 +2,16 @@ import { join } from "path";
22import type { QueryLanguage } from "../common/query-language" ;
33import { writeFile } from "fs-extra" ;
44import { dump } from "js-yaml" ;
5- import { prepareModelEditorQueries } from "./model-editor-queries" ;
5+ import {
6+ prepareModelEditorQueries ,
7+ resolveEndpointsQuery ,
8+ syntheticQueryPackName ,
9+ } from "./model-editor-queries" ;
610import type { CodeQLCliServer } from "../codeql-cli/cli" ;
711import type { ModelConfig } from "../config" ;
812import { Mode } from "./shared/mode" ;
9- import { resolveQueriesFromPacks } from "../local-queries" ;
10- import { modeTag } from "./mode-tag" ;
1113import type { NotificationLogger } from "../common/logging" ;
1214
13- export const syntheticQueryPackName = "codeql/model-editor-queries" ;
14-
1515/**
1616 * setUpPack sets up a directory to use for the data extension editor queries if required.
1717 *
@@ -96,49 +96,3 @@ export async function setUpPack(
9696
9797 return true ;
9898}
99-
100- /**
101- * Resolve the query path to the model editor endpoints query. All queries are tagged like this:
102- * modeleditor endpoints <mode>
103- * Example: modeleditor endpoints framework-mode
104- *
105- * @param cliServer The CodeQL CLI server to use.
106- * @param language The language of the query pack to use.
107- * @param mode The mode to resolve the query for.
108- * @param additionalPackNames Additional pack names to search.
109- * @param additionalPackPaths Additional pack paths to search.
110- */
111- export async function resolveEndpointsQuery (
112- cliServer : CodeQLCliServer ,
113- language : string ,
114- mode : Mode ,
115- additionalPackNames : string [ ] = [ ] ,
116- additionalPackPaths : string [ ] = [ ] ,
117- ) : Promise < string | undefined > {
118- const packsToSearch = [ `codeql/${ language } -queries` , ...additionalPackNames ] ;
119-
120- // First, resolve the query that we want to run.
121- // All queries are tagged like this:
122- // internal extract automodel <mode> <queryTag>
123- // Example: internal extract automodel framework-mode candidates
124- const queries = await resolveQueriesFromPacks (
125- cliServer ,
126- packsToSearch ,
127- {
128- kind : "table" ,
129- "tags contain all" : [ "modeleditor" , "endpoints" , modeTag ( mode ) ] ,
130- } ,
131- additionalPackPaths ,
132- ) ;
133- if ( queries . length > 1 ) {
134- throw new Error (
135- `Found multiple endpoints queries for ${ mode } . Can't continue` ,
136- ) ;
137- }
138-
139- if ( queries . length === 0 ) {
140- return undefined ;
141- }
142-
143- return queries [ 0 ] ;
144- }
0 commit comments