Adds SuiteScript-related tags to the JSDoc dictionary, as well as a theme that supports the tags based on the JSDoc default theme.
npm i jsdoc-plugin-suitescript
jsdoc module folder via npm's postinstall script.
{
"plugins": ["plugins/suitescript"]
}
`
If you use a JSDoc template other than the default, you can copy the relevant
files from node_modules/jsdoc/templates/default/tmpl/ to your own template
folder.
@governance
$3
* @gov
$3
@governance
@gov
$3
The @governance tag is used to document the NetSuite governance usage of a
function. The usage can be in the form of a Number or a text formula describing
the necessary calculation.
$3
In the following example, the documented function performs a single search,
which uses 10 governance units.
`
/**
* Performs a transaction search
*
* @governance 10
*/
function doSearch() {
return nlapiSearchRecord('transaction') || [];
}
`
In the following example, the documented function submits each custom record in
a given list, which uses 4 governance units per record.
`
/**
* Submits each record in the given list
*
@governance (4 n), where n is the number of records in the given list
*/
function saveRecords(records) {
if (!records.length) { return; }
records.forEach(function (rec) { nlapiSubmitRecord(rec); });
}
`
@NApiVersion
$3
@NApiVersion
version can be any of:
* 1.0
* 2.0
* 2.x
* 2.X
$3
The @NApiVersion tag is used to document the SuiteScript version used by a
script file or module. It can serve as a defense against future incompatible
versions of SuiteScript (versions 3.x and higher) attempting to load it.
$3
In the following example, a 2.0 Client Script module is documented.
`
/**
* A sample Client script module
*
* @NApiVersion 2.x
* @NModuleScope Public
* @NScriptType ClientScript
*/
define(["N/search"], function (s) {
var exports = {};
// ...
`
@NModuleScope
$3
@NModuleScope
scope can be any of:
* SameAccount
* TargetAccount
* Public
$3
The @NModuleScope tag is used to document the access level of a SuiteScript
module.
* If the value is set to SameAccount, access to the module is limited to other
modules from the same bundle, and modules native to the same source account or
sandbox environment. Source code is not hidden at runtime.
* If the value is set to TargetAccount, access to the module is limited to
other modules from the same bundle, and modules native to the same source
account, target account, or sandbox environment. Source code is hidden at
runtime.
* If the value is set to Public, any script in the account can load and use
the module. Source code is hidden at runtime.
$3
In the following example, a 2.0 Client Script module is documented such that it
is only visible to modules native to the same account.
`
/**
* A sample Client script module only visible to the same account or sandbox
*
* @NApiVersion 2.0
* @NModuleScope SameAccount
* @NScriptType ClientScript
*/
define(["N/search"], function (s) {
var exports = {};
// ...
`
@NScriptType
$3
@NScriptType
scriptType can be any of:
* BundleInstallationScript
* ClientScript
* MapReduceScript
* MassUpdateScript
* Portlet
* Restlet
* ScheduledScript
* Suitelet
* UserEventScript
* WorkflowActionScript
$3
The @NScriptType tag is used to document the type of Script record a
SuiteScript module represents.
$3
In the following example, a 2.0 Client Script module is documented.
`
/**
* A sample Client script module only visible to the same account or sandbox
*
* @NApiVersion 2.X
* @NModuleScope TargetAccount
* @NScriptType ClientScript
*/
define(["N/search"], function (s) {
var exports = {};
// ...
``