File tree Expand file tree Collapse file tree 1 file changed +0
-27
lines changed
extensions/ql-vscode/src/model-editor/shared Expand file tree Collapse file tree 1 file changed +0
-27
lines changed Original file line number Diff line number Diff line change 11import { ModeledMethod } from "../modeled-method" ;
22
3- /**
4- * Converts a record of a single ModeledMethod indexed by signature to a record of ModeledMethod[] indexed by signature
5- * for legacy usage. This function should always be used instead of the trivial conversion to track usages of this
6- * conversion.
7- *
8- * This method should only be called inside a `postMessage` call. If it's used anywhere else, consider whether the
9- * boundary is correct: the boundary should as close as possible to the extension host -> webview boundary.
10- *
11- * @param modeledMethods The record of a single ModeledMethod indexed by signature
12- */
13- export function convertToLegacyModeledMethods (
14- modeledMethods : Record < string , ModeledMethod [ ] > ,
15- ) : Record < string , ModeledMethod > {
16- // Always take the first modeled method in the array
17- return Object . fromEntries (
18- Object . entries ( modeledMethods )
19- . map ( ( [ signature , modeledMethods ] ) => {
20- const modeledMethod = convertToLegacyModeledMethod ( modeledMethods ) ;
21- if ( ! modeledMethod ) {
22- return null ;
23- }
24- return [ signature , modeledMethod ] ;
25- } )
26- . filter ( ( entry ) : entry is [ string , ModeledMethod ] => entry !== null ) ,
27- ) ;
28- }
29-
303/**
314 * Converts a single ModeledMethod to a ModeledMethod[] for legacy usage. This function should always be used instead
325 * of the trivial conversion to track usages of this conversion.
You can’t perform that action at this time.
0 commit comments