@@ -13,7 +13,6 @@ import * as semver from 'semver'
1313// Removing false positive
1414// eslint-disable-next-line import/no-unresolved
1515import { components } from '@octokit/openapi-types'
16- import { difference } from './utils'
1716
1817const execAsync = promisify ( exec )
1918
@@ -29,6 +28,27 @@ export type AmFunction = {
2928 function : string
3029}
3130
31+ export type AmLocation = {
32+ file : string
33+ range : AmRange
34+ }
35+
36+ export type AmRange = {
37+ start : AmPosition
38+ end : AmPosition
39+ }
40+
41+ export type AmPosition = {
42+ line : number
43+ column : number
44+ }
45+
46+ export type AmListOutputFunction = {
47+ id : AmFunction
48+ definition ?: AmLocation
49+ instrumentation ?: AmLocation
50+ }
51+
3252export type DataSet = {
3353 autometricizedFunctions : AmFunction [ ]
3454 otherFunctions : AmFunction [ ]
@@ -136,18 +156,20 @@ export async function computeDataSet(
136156 `${ amList } list -a -l ${ language } ${ projectRoot } `
137157 )
138158
139- const allFunctions : AmFunction [ ] = JSON . parse ( allFns )
140-
141- const { stdout : amFns } = await execAsync (
142- `${ amList } list -l ${ language } ${ projectRoot } `
143- )
144-
145- const amFunctions : AmFunction [ ] = JSON . parse ( amFns )
159+ const outputFunctions : AmListOutputFunction [ ] = JSON . parse ( allFns )
160+ const autometricizedFunctions = [ ]
161+ const otherFunctions = [ ]
146162
147- const otherFunctions = difference ( allFunctions , amFunctions )
163+ for ( const fn of outputFunctions ) {
164+ if ( fn . instrumentation ) {
165+ otherFunctions . push ( { ...fn . id } )
166+ } else {
167+ autometricizedFunctions . push ( { ...fn . id } )
168+ }
169+ }
148170
149171 return {
150- autometricizedFunctions : amFunctions ,
172+ autometricizedFunctions,
151173 otherFunctions
152174 }
153175}
0 commit comments