Skip to content

Commit f33c0cc

Browse files
authored
docs: Fixed jsdoc generation by marking private methods as @Private (#1976)
1 parent 92b70e9 commit f33c0cc

File tree

10 files changed

+39
-3
lines changed

10 files changed

+39
-3
lines changed

api.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,7 @@ API.prototype.addIgnoringRule = function addIgnoringRule(pattern) {
614614
* Output an HTML comment and log a warning the comment is meant to be
615615
* innocuous to the end user.
616616
*
617+
* @private
617618
* @see RUM_ISSUES
618619
* @param {number} errorCode Error code from `RUM_ISSUES`.
619620
* @param {boolean} [quiet=false] Be quiet about this failure.
@@ -631,6 +632,7 @@ function _gracefail(errorCode, quiet) {
631632
/**
632633
* Function for generating a fully formed RUM header based on configuration options
633634
*
635+
* @private
634636
* @param {object} options Configuration options for RUM
635637
* @param {string} [options.nonce] Nonce to inject into `<script>` header.
636638
* @param {boolean} [options.hasToRemoveScriptWrapper] Used to import agent script without `<script>` tag wrapper.
@@ -658,6 +660,7 @@ function _generateRUMHeader(options = {}, metadata, loader) {
658660
* Helper method for determining if we have the minimum required
659661
* information to generate our Browser Agent script tag
660662
*
663+
* @private
661664
* @param {object} config agent configuration settings
662665
* @param {Transaction} transaction the active transaction or null
663666
* @param {boolean} allowTransactionlessInjection whether or not to allow the Browser Agent to be injected when there is no active transaction
@@ -1655,6 +1658,7 @@ API.prototype.shutdown = function shutdown(options, cb) {
16551658
/**
16561659
* Helper function for logging if an error occurs, and where
16571660
*
1661+
* @private
16581662
* @param {Error} error If defined, the error that occurred
16591663
* @param {string} phase Where in the process the error happened
16601664
* @returns {void}
@@ -1668,6 +1672,7 @@ function _logErrorCallback(error, phase) {
16681672
/**
16691673
* Function for handling the graceful shutdown process, including processing of data and handling errors
16701674
*
1675+
* @private
16711676
* @param {object} api instantiation of this file
16721677
* @param {object} options shutdown options object
16731678
* @param {boolean} [options.collectPendingData=false]
@@ -1732,6 +1737,7 @@ function _doShutdown(api, options, callback) {
17321737
* Validates that all keys in a given object have values that are less than or equal to a given length
17331738
* Assumes all values have .length property (string/array)
17341739
*
1740+
* @private
17351741
* @param {object} object The object to validate
17361742
* @param {number} maxLength The max allowed length
17371743
* @returns {boolean} Whether or not the object passes validation
@@ -1803,6 +1809,7 @@ API.prototype.setUserID = function setUserID(id) {
18031809
/**
18041810
* Function for removing invalid attribute key/value pairs from an object
18051811
*
1812+
* @private
18061813
* @param {object} attributes The attribute object
18071814
* @param {string} name Caller name, used for debugging/logging purposes only
18081815
* @returns {object} Attribute object containing only valid key/value pairs

lib/shim/datastore-shim.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,7 @@ function captureInstanceAttributes(host, port, database) {
578578
/**
579579
* Parses the database name from a `USE` SQL query.
580580
*
581+
* @memberof DatastoreShim.prototype
581582
* @param {string} query - The SQL query to parse the database name from.
582583
* @returns {?string} The name of the database if it could be parsed, otherwise
583584
* `null`.

lib/shim/message-shim/subscribe-consume.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ function _nameMessageTransaction(shim, msgDesc) {
3333
/**
3434
* Wrapper for subscribing to a queue.
3535
*
36+
* @private
3637
* @param {object} params to function
3738
* @param {MessageShim} params.shim instance of shim
3839
* @param {Function} params.fn subscriber function

lib/shim/promise-shim.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const symbols = require('../symbols')
1313
* Checks if function is actually not a function
1414
* or it is wrapped
1515
*
16+
* @private
1617
* @param {Shim} shim instance of shim
1718
* @param {Function} fn function to wrap
1819
* @returns {boolean} is already wrapped or not
@@ -359,6 +360,7 @@ function _wrapExecutorContext(shim, args) {
359360
}
360361

361362
/**
363+
* @private
362364
* @param {object} context context object
363365
* @param {Function} fn function that is wrapped
364366
* @returns {Function} wrapped function
@@ -376,6 +378,7 @@ function _wrapResolver(context, fn) {
376378

377379
/**
378380
*
381+
* @private
379382
* @param {object} params object passed to wrapHandler
380383
* @param {Function} params.handler to wrap
381384
* @param {number} params.index index of argument

lib/shim/shim.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -871,6 +871,7 @@ function record(nodule, properties, recordNamer) {
871871
* Wrapped function for Shim.prototype.record
872872
* This creates a segment for the method being recorded
873873
*
874+
* @private
874875
* @param {object} params to function
875876
* @param {Shim} params.shim instance of shim
876877
* @param {Function} params.fn function being wrapped/recorded

lib/shim/webframework-shim/middleware-mounter.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const { copyExpectedSpecParameters } = require('./common')
99
/**
1010
* Wraps route mounter and all middleware defined within mounter(arguments to mounter)
1111
*
12+
* @private
1213
* @param {object} spec for the middleware mounter
1314
* @param {Shim} shim instance of shim
1415
* @param {Function} fn middleware mounter function
@@ -53,6 +54,7 @@ function wrapMounter(spec, shim, fn, fnName) {
5354
/**
5455
* Wraps every middleware defined within middleware route mounter
5556
*
57+
* @private
5658
* @param {object} params object passed to function
5759
* @param {number} params.routeIdx index of the router arg
5860
* @param {Array} params.middlewares remaining args(middleware) on route mounter

lib/shim/webframework-shim/middleware.js

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const MIDDLEWARE_TYPE_DETAILS = {
2525
/**
2626
* Retrieves the route from the spec
2727
*
28+
* @private
2829
* @param {object} spec middleware spec
2930
* @param {Shim} shim instance of shim
3031
* @returns {string} route route path
@@ -51,6 +52,7 @@ function getRoute(spec, shim) {
5152
* Retrieves the parameters from the spec.params
5253
* and prefixes them all with `request.parameters.route`
5354
*
55+
* @private
5456
* @param {object} params object passed to fn
5557
* @param {object} params.spec middleware spec
5658
* @param {Shim} params.shim instance of shim
@@ -73,6 +75,7 @@ function copyParams({ spec, shim, fn, fnName, args, req }) {
7375
/**
7476
* Creates the middleware recorder if the type specifies this flag
7577
*
78+
* @private
7679
* @param {object} params object passed to fn
7780
* @param {object} params.txInfo transaction
7881
* @param {object} params.typeDetails metadata about the middleware type
@@ -92,6 +95,7 @@ function constructRecorder({ txInfo, typeDetails, shim, metricName }) {
9295
/**
9396
* Updates nameState and errorHandled property of transaction info
9497
*
98+
* @private
9599
* @param {object} params object passed to fn
96100
* @param {Shim} params.shim instance of shim
97101
* @param {string} params.fnName function name
@@ -123,6 +127,7 @@ function assignTxInfo({ shim, req, route, fnName, isErrorWare }) {
123127
* When called it will update transaction names, create a recorder for the middleware functions,
124128
* assign parameters from request, and name the segment
125129
*
130+
* @private
126131
* @param {object} params fn params
127132
* @param {object} params.spec middleware spec
128133
* @param {object} params.typeDetails metadata about the middleware type
@@ -191,6 +196,7 @@ function middlewareWithCallbackRecorder({ spec, typeDetails, metricName, isError
191196
* When called it will update transaction names, create a recorder for the middleware functions,
192197
* assign parameters from request, and name the segment
193198
*
199+
* @private
194200
* @param {object} params fn params
195201
* @param {object} params.spec middleware spec
196202
* @param {object} params.typeDetails metadata about the middleware type
@@ -258,6 +264,7 @@ function middlewareWithPromiseRecorder({ spec, typeDetails, metricName, isErrorW
258264
/**
259265
* Constructs segment name passed on path/route information
260266
*
267+
* @private
261268
* @param {string} metricName metric name for middleware function
262269
* @param {object} typeDetails metadata about the middleware type
263270
* @param {string} route route path
@@ -277,6 +284,7 @@ function getSegmentName(metricName, typeDetails, route) {
277284
/**
278285
* Retrieves the req function that is called to retrieve the request
279286
*
287+
* @private
280288
* @param {object} spec middleware spec
281289
* @param {Shim} shim instance of shim
282290
* @returns {Function} function to call to obtain request object
@@ -319,6 +327,7 @@ module.exports._recordMiddleware = function _recordMiddleware(shim, middleware,
319327
/**
320328
* Creates a recorder for middleware metrics.
321329
*
330+
* @private
322331
* @param {object} _shim instance of shim
323332
* @param {string} metricName name of metric
324333
* @returns {Function} recorder for middleware
@@ -336,11 +345,20 @@ function _makeMiddlewareRecorder(_shim, metricName) {
336345
}
337346
}
338347

339-
/*
348+
/**
340349
* Wrap the `next` middleware function and push on our name state if we find it. We only want to
341350
* push the name state if there is a next so that we can safely remove it
342351
* if context leaves this middleware.
343352
*
353+
* @param root0
354+
* @param root0.shim
355+
* @param root0.spec
356+
* @param root0.route
357+
* @param root0.args
358+
* @param root0.isErrorWare
359+
* @param root0.isPromise
360+
* @param root0.txInfo
361+
* @private
344362
*/
345363
function wrapNextHandler({ shim, spec, route, args, isErrorWare, isPromise, txInfo }) {
346364
let nextWrapper = null
@@ -384,6 +402,7 @@ function wrapNextHandler({ shim, spec, route, args, isErrorWare, isPromise, txIn
384402
/**
385403
* Assigns the active segment to stack and wraps the next function
386404
*
405+
* @private
387406
* @param {object} nextDetails details about the function
388407
* @param {object} txInfo transaction
389408
* @returns {Function} wrapped function
@@ -409,6 +428,7 @@ function _makeNextBinder(nextDetails, txInfo) {
409428
*
410429
* Called from outside to wrap functions that could be called to continue to the next middleware
411430
*
431+
* @private
412432
* @param {object} params params as 1st arg
413433
* @param {object} params.shim instance of shim
414434
* @param {object} params.txInfo transaction

lib/transaction/handle.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ module.exports = TransactionHandle
8181

8282
/**
8383
*
84+
* @private
8485
* @param metrics
8586
* @param functionName
8687
*/

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@
161161
"lint": "eslint ./*.{js,mjs} lib test bin examples",
162162
"lint:fix": "eslint --fix, ./*.{js,mjs} lib test bin examples",
163163
"lint:lockfile": "lockfile-lint --path package-lock.json --type npm --allowed-hosts npm --validate-https --validate-integrity",
164-
"public-docs": "jsdoc -c ./jsdoc-conf.json --tutorials examples/shim api.js lib/shim/ lib/transaction/handle.js && cp examples/shim/*.png out/",
164+
"public-docs": "jsdoc -c ./jsdoc-conf.json --tutorials examples/shim api.js lib/shim/** lib/transaction/handle.js && cp examples/shim/*.png out/",
165165
"publish-docs": "./bin/publish-docs.sh",
166166
"services": "docker compose up -d --wait",
167167
"smoke": "npm run ssl && time tap test/smoke/**/**/*.tap.js --timeout=180 --no-coverage",

third_party_manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"lastUpdated": "Thu Jan 18 2024 15:41:06 GMT-0500 (Eastern Standard Time)",
2+
"lastUpdated": "Fri Jan 26 2024 08:32:03 GMT-0500 (Eastern Standard Time)",
33
"projectName": "New Relic Node Agent",
44
"projectUrl": "https://github.com/newrelic/node-newrelic",
55
"includeOptDeps": true,

0 commit comments

Comments
 (0)