Expects to be connected to an instance. Available since version 0.1.20
var hasAmp = client.hasPackage("nms:amp");
or
var hasAmp = client.hasPackage("nms", "amp");
A package can be installed with the xtk:builder#installPackage method. This method take a single argument which is the package definition, in XML or in JSON.
This is what a XML package looks like. Note the presence of the <pkgDesc> root element
<pkgDesc> <package namespace="cus" name="sdk" buildNumber="*" buildVersion="*" label="Test package for ACC JS SDK" vendor="acc-js-sdk"> <entities schema="xtk:option"> <option name="AccJsSdk" dataType="6" stringValue="8.5.0"/> </entities> </package> </pkgDesc>
In JSON, we have an objet containing a package object
{ package: { buildNumber: "*", buildVersion: "*", entities: { schema:"nms:service", service: { label: "NewsletterTest", name: "newsletterTest", folder: { _operation: "none", name: "nmsSetOfServices" }, visitorFolder: { _operation: "none", name: "nmsVisitor" } } } } }
Installing package is a heavy operation which can involve database changes, and the call will often time out if using the default settings. The best practice here is to keep short default timeouts, and explicitely increase the timeout for the installPackage call.
This can be done using the Push Down mechanism as follows:
await NLWS.pushDown({ timeout: 5*60*1000 }).xtkBuilder.installPackage(jsonPackage);