@adobe/acc-js-sdk
Advanced tools
Comparing version 0.1.16 to 0.1.21
{ | ||
"name": "@adobe/acc-js-sdk", | ||
"version": "0.1.16", | ||
"version": "0.1.21", | ||
"description": "ACC Javascript SDK", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -5,6 +5,7 @@ # Adobe Campaign Classic (ACC) SDK in JavaScript (node.js and browser) | ||
# Changelog | ||
### Version 0.1.4 - 0.1.16 | ||
Another attempt to publish to npm from github action | ||
### Version 0.1.20 | ||
Add client.hasPackage function to test if a package is installed or an instance or not (https://github.com/adobe/acc-js-sdk/issues/5) | ||
@@ -333,2 +334,16 @@ ### Version 0.1.3 | ||
## Test if a package exists | ||
* Since: 0.1.20 | ||
* Test if a package is installed. Expects to be connected to an instance | ||
```js | ||
var hasAmp = client.hasPackage("nms:amp"); | ||
``` | ||
or | ||
```js | ||
var hasAmp = client.hasPackage("nms", "amp"); | ||
``` | ||
## Connect to mid-sourcing | ||
@@ -335,0 +350,0 @@ From a marketing client connection, one can get a client to a mid server |
@@ -182,2 +182,3 @@ /* | ||
this.securityToken = undefined; | ||
this.installedPackages = {}; // package set (key and value = package id, ex: "nms:amp") | ||
@@ -267,3 +268,15 @@ this.secretKeyCipher = undefined; | ||
sessionToken = soapCall.getNextString(); | ||
that.sessionInfo = soapCall.getNextDocument(); | ||
that.installedPackages = {}; | ||
const userInfo = DomUtil.findElement(that.sessionInfo, "userInfo"); | ||
if (userInfo) { | ||
var pack = DomUtil.getFirstChildElement(userInfo, "installed-package"); | ||
while (pack) { | ||
const name = `${DomUtil.getAttributeAsString(pack, "namespace")}:${DomUtil.getAttributeAsString(pack, "name")}`; | ||
that.installedPackages[name] = name; | ||
pack = DomUtil.getNextSiblingElement(pack); | ||
} | ||
} | ||
securityToken = soapCall.getNextString(); | ||
@@ -349,2 +362,15 @@ soapCall.checkNoMoreArgs(); | ||
/** | ||
* Check if a package is installed | ||
* @param {String} packageId the package identifier, for instance: "nms:amp" | ||
* @param {String} optionalName if set, the first parameter will be interpreted as the namespace (ex: "nms") and the second as the name, ex: "amp" | ||
*/ | ||
Client.prototype.hasPackage = function(packageId, optionalName) { | ||
if (optionalName === undefined) | ||
packageId = `${packageId}:${optionalName}`; | ||
if (!this.isLogged()) | ||
throw new Error(`Cannot call hasPackage: session not connected`); | ||
return this.installedPackages[packageId] !== undefined; | ||
} | ||
/** | ||
* Obtains a cipher that can be used to encrypt/decrypt passwords, using the database secret key. | ||
@@ -351,0 +377,0 @@ * This is used for example for mid-sourcing account. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
494656
319
38
10020
738