forked from pinpoint-apm/pinpoint-node-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
api-meta-info.js
34 lines (30 loc) · 907 Bytes
/
api-meta-info.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/**
* Pinpoint Node.js Agent
* Copyright 2020-present NAVER Corp.
* Apache License v2.0
*/
'use strict'
class ApiMetaInfo {
constructor(initData = {}) {
this.apiId = initData.apiId
this.apiInfo = initData.apiInfo
this.type = initData.type
this.lineNumber = initData.lineNumber
this.location = initData.location
}
static create(methodDescriptor) {
const one = new ApiMetaInfo({
apiId: methodDescriptor.apiId,
apiInfo: methodDescriptor.apiDescriptor,
type: methodDescriptor.type,
})
if (methodDescriptor.getLineNumber() && typeof methodDescriptor.getLineNumber() === 'number') {
one.lineNumber = methodDescriptor.getLineNumber()
}
if (methodDescriptor.getLocation() && typeof methodDescriptor.getLocation() === 'string') {
one.location = methodDescriptor.getLocation()
}
return one
}
}
module.exports = ApiMetaInfo