@adobe/acc-js-sdk 1.1.56 → 1.1.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/changeLog.html +15 -1
- package/docs/connectionParameters.html +10 -0
- package/package-lock.json +8 -5
- package/package.json +1 -1
- package/src/client.js +14 -2
- package/test/client.test.js +23 -0
- package/test/mock.js +23 -0
package/docs/changeLog.html
CHANGED
|
@@ -2,7 +2,21 @@
|
|
|
2
2
|
layout: page
|
|
3
3
|
title: Change Log
|
|
4
4
|
---
|
|
5
|
-
<section class="changelog"><h1>Version 1.1.
|
|
5
|
+
<section class="changelog"><h1>Version 1.1.57</h1>
|
|
6
|
+
<h2>2025/06/24</h2>
|
|
7
|
+
<li>
|
|
8
|
+
Bumped dependencies version to fix vulnerabilities
|
|
9
|
+
</li>
|
|
10
|
+
<li>
|
|
11
|
+
Update getSchema function to support XDM schemas (without caching)
|
|
12
|
+
</li>
|
|
13
|
+
<li>
|
|
14
|
+
New "instanceKey" connection parameter can be used to configure the cache key
|
|
15
|
+
</li>
|
|
16
|
+
</section>
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
<section class="changelog"><h1>Version 1.1.56</h1>
|
|
6
20
|
<h2>2025/01/27</h2>
|
|
7
21
|
<li>
|
|
8
22
|
Bumped dependencies version to fix vulnerabilities
|
|
@@ -104,6 +104,16 @@ const connectionParameters = sdk.ConnectionParameters.ofUserAndPassword(
|
|
|
104
104
|
<td>number</td>
|
|
105
105
|
<td>Can be used to set the APIs call timeout (in ms)</td>
|
|
106
106
|
</tr>
|
|
107
|
+
<tr>
|
|
108
|
+
<td>cacheRootKey</td>
|
|
109
|
+
<td>"default" or "none"</td>
|
|
110
|
+
<td>Determine the prefix to use for the keys in the caches of schemas, options, etc.<p>The value "default" means that cached keys are prefixed with "acc.js.sdk.${this.sdk.getSDKVersion().version}.${instanceKey}.cache."</p></td>
|
|
111
|
+
</tr>
|
|
112
|
+
<tr>
|
|
113
|
+
<td>instanceKey</td>
|
|
114
|
+
<td>string</td>
|
|
115
|
+
<td>An optional value to override the instance key which is used for the caches of schemas, options, etc.</td>
|
|
116
|
+
</tr>
|
|
107
117
|
</tbody>
|
|
108
118
|
</table>
|
|
109
119
|
|
package/package-lock.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/acc-js-sdk",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.57",
|
|
4
4
|
"lockfileVersion": 2,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@adobe/acc-js-sdk",
|
|
9
|
-
"version": "1.1.
|
|
9
|
+
"version": "1.1.57",
|
|
10
10
|
"license": "ISC",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"axios": "^1.7.8",
|
|
@@ -1275,9 +1275,10 @@
|
|
|
1275
1275
|
"license": "MIT"
|
|
1276
1276
|
},
|
|
1277
1277
|
"node_modules/brace-expansion": {
|
|
1278
|
-
"version": "1.1.
|
|
1278
|
+
"version": "1.1.12",
|
|
1279
|
+
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz",
|
|
1280
|
+
"integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==",
|
|
1279
1281
|
"dev": true,
|
|
1280
|
-
"license": "MIT",
|
|
1281
1282
|
"dependencies": {
|
|
1282
1283
|
"balanced-match": "^1.0.0",
|
|
1283
1284
|
"concat-map": "0.0.1"
|
|
@@ -5403,7 +5404,9 @@
|
|
|
5403
5404
|
"dev": true
|
|
5404
5405
|
},
|
|
5405
5406
|
"brace-expansion": {
|
|
5406
|
-
"version": "1.1.
|
|
5407
|
+
"version": "1.1.12",
|
|
5408
|
+
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz",
|
|
5409
|
+
"integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==",
|
|
5407
5410
|
"dev": true,
|
|
5408
5411
|
"requires": {
|
|
5409
5412
|
"balanced-match": "^1.0.0",
|
package/package.json
CHANGED
package/src/client.js
CHANGED
|
@@ -308,6 +308,7 @@ class Credentials {
|
|
|
308
308
|
* @property {boolean} noMethodInURL - Can be set to true to remove the method name from the URL
|
|
309
309
|
* @property {number} timeout - Can be set to change the HTTP call timeout. Value is passed in ms.
|
|
310
310
|
* @property {string} cacheRootKey - "default" or "none" - determine the prefix to use for the keys in the caches of schemas, options, etc.
|
|
311
|
+
* @property {string} instanceKey - an optional value to override the instance key which is used for the caches of schemas, options, etc.
|
|
311
312
|
* @memberOf Campaign
|
|
312
313
|
*/
|
|
313
314
|
|
|
@@ -829,8 +830,10 @@ class Client {
|
|
|
829
830
|
this._secretKeyCipher = undefined;
|
|
830
831
|
|
|
831
832
|
this._storage = connectionParameters._options._storage;
|
|
832
|
-
|
|
833
|
-
var instanceKey = connectionParameters.
|
|
833
|
+
|
|
834
|
+
var instanceKey = connectionParameters._options.instanceKey;
|
|
835
|
+
if (!instanceKey)
|
|
836
|
+
instanceKey = connectionParameters._endpoint || "";
|
|
834
837
|
if (instanceKey.startsWith("http://")) instanceKey = instanceKey.substr(7);
|
|
835
838
|
if (instanceKey.startsWith("https://")) instanceKey = instanceKey.substr(8);
|
|
836
839
|
|
|
@@ -894,6 +897,7 @@ class Client {
|
|
|
894
897
|
endpoint: this._connectionParameters._endpoint,
|
|
895
898
|
createdAt: Date.now(),
|
|
896
899
|
clientApp: this._connectionParameters._options.clientApp,
|
|
900
|
+
instanceKey: instanceKey
|
|
897
901
|
}
|
|
898
902
|
};
|
|
899
903
|
if (this._connectionParameters._credentials) {
|
|
@@ -1928,6 +1932,14 @@ class Client {
|
|
|
1928
1932
|
* @returns {XML.XtkObject} the schema definition, as either a DOM document or a JSON object
|
|
1929
1933
|
*/
|
|
1930
1934
|
async getSchema(schemaId, representation, internal) {
|
|
1935
|
+
// Support for Orchestrated Campaign XDM schemas (do not use cache)
|
|
1936
|
+
const pipeIndex = schemaId.indexOf("|");
|
|
1937
|
+
if( pipeIndex != -1 && schemaId.startsWith("xdm:") ) {
|
|
1938
|
+
const entityType = schemaId.substring(0, pipeIndex);
|
|
1939
|
+
schemaId = schemaId.substring(pipeIndex + 1);
|
|
1940
|
+
const entity = await this.getEntityIfMoreRecent(entityType, schemaId, representation, internal);
|
|
1941
|
+
return entity;
|
|
1942
|
+
}
|
|
1931
1943
|
var entity = await this._entityCache.get("xtk:schema", schemaId);
|
|
1932
1944
|
if (!entity) {
|
|
1933
1945
|
// special case of "temp:group:*" schemas for nms:group
|
package/test/client.test.js
CHANGED
|
@@ -435,6 +435,20 @@ describe('ACC Client', function () {
|
|
|
435
435
|
await client.NLWS.xtkSession.logoff();
|
|
436
436
|
});
|
|
437
437
|
|
|
438
|
+
it("Should return XDM schema definition", async () => {
|
|
439
|
+
const client = await Mock.makeClient();
|
|
440
|
+
client._transport.mockReturnValueOnce(Mock.LOGON_RESPONSE);
|
|
441
|
+
await client.NLWS.xtkSession.logon();
|
|
442
|
+
|
|
443
|
+
client._transport.mockReturnValueOnce(Mock.GET_UNION_PROFILE_SCHEMA_RESPONSE);
|
|
444
|
+
var schema = await client.getSchema("xdm:tenant:unions|_xdm.context.profile__union");
|
|
445
|
+
expect(schema["namespace"]).toBe("xdm");
|
|
446
|
+
expect(schema["name"]).toBe("profile__union");
|
|
447
|
+
|
|
448
|
+
client._transport.mockReturnValueOnce(Mock.LOGOFF_RESPONSE);
|
|
449
|
+
await client.NLWS.xtkSession.logoff();
|
|
450
|
+
});
|
|
451
|
+
|
|
438
452
|
it("Should return temp group schema definition", async () => {
|
|
439
453
|
const client = await Mock.makeClient();
|
|
440
454
|
client._transport.mockReturnValueOnce(Mock.LOGON_RESPONSE);
|
|
@@ -2741,6 +2755,15 @@ describe('ACC Client', function () {
|
|
|
2741
2755
|
expect(client._optionCache._storage._rootKey).toBe(`OptionCache$`);
|
|
2742
2756
|
});
|
|
2743
2757
|
|
|
2758
|
+
it("Should support instanceKey", async () => {
|
|
2759
|
+
// Default has version & instance name
|
|
2760
|
+
const version = sdk.getSDKVersion().version; // "${version}" or similar
|
|
2761
|
+
connectionParameters = sdk.ConnectionParameters.ofUserAndPassword("http://acc-sdk:8080", "admin", "admin");
|
|
2762
|
+
connectionParameters = sdk.ConnectionParameters.ofUserAndPassword("http://acc-sdk:8080", "admin", "admin", { instanceKey: "hello" });
|
|
2763
|
+
var client = await sdk.init(connectionParameters);
|
|
2764
|
+
expect(client._optionCache._storage._rootKey).toBe(`acc.js.sdk.${version}.hello.cache.OptionCache$`);
|
|
2765
|
+
});
|
|
2766
|
+
|
|
2744
2767
|
describe("Should simulate the Shell Cache API", () => {
|
|
2745
2768
|
// See https://github.com/AdobeDocs/exc-app/blob/master/docs/modules/cache.md#sample-code
|
|
2746
2769
|
it("Sould get cached option", async () => {
|
package/test/mock.js
CHANGED
|
@@ -455,6 +455,28 @@ const GET_XTK_QUERY_SCHEMA_RESPONSE = Promise.resolve(`<?xml version='1.0'?>
|
|
|
455
455
|
</SOAP-ENV:Body>
|
|
456
456
|
</SOAP-ENV:Envelope>`);
|
|
457
457
|
|
|
458
|
+
const GET_UNION_PROFILE_SCHEMA_RESPONSE = Promise.resolve(`<?xml version='1.0'?>
|
|
459
|
+
<SOAP-ENV:Envelope xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:ns='urn:wpp:default' xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/'>
|
|
460
|
+
<SOAP-ENV:Body>
|
|
461
|
+
<GetEntityIfMoreRecentResponse xmlns='urn:wpp:default' SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'>
|
|
462
|
+
<pdomDoc xsi:type='ns:Element' SOAP-ENV:encodingStyle='http://xml.apache.org/xml-soap/literalxml'>
|
|
463
|
+
|
|
464
|
+
<schema label="XDM Individual Profile" labelSingular="XDM Individual Profile" library="true" name="profile__union" namespace="xdm" xtkschema="xtk:schema">
|
|
465
|
+
<element autopk="false" label="XDM Individual Profile" name="profile__union" pkgStatus="never">
|
|
466
|
+
<element name="_ajobatchjourneystage" type="">
|
|
467
|
+
<attribute label="email" length="255" name="email" type="string"/>
|
|
468
|
+
<attribute label="Loyalty Member" name="loyaltyMember" type="boolean"/>
|
|
469
|
+
<attribute label="Use Case ID" length="255" name="useCaseInstanceId" type="string"/>
|
|
470
|
+
</element>
|
|
471
|
+
<attribute label="Identifier" length="255" name="_id" type="string"/>
|
|
472
|
+
</element>
|
|
473
|
+
</schema>
|
|
474
|
+
|
|
475
|
+
</pdomDoc>
|
|
476
|
+
</GetEntityIfMoreRecentResponse>
|
|
477
|
+
</SOAP-ENV:Body>
|
|
478
|
+
</SOAP-ENV:Envelope>`);
|
|
479
|
+
|
|
458
480
|
const GET_NMS_DELIVERY_SCHEMA_RESPONSE = Promise.resolve(`<?xml version='1.0'?>
|
|
459
481
|
<SOAP-ENV:Envelope xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:ns='urn:wpp:default' xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/'>
|
|
460
482
|
<SOAP-ENV:Body>
|
|
@@ -1127,6 +1149,7 @@ exports.Mock = {
|
|
|
1127
1149
|
GET_OPTION_NOTFOUND_RESPONSE: GET_OPTION_NOTFOUND_RESPONSE,
|
|
1128
1150
|
GET_OPTION_MISSING_DATA_RESPONSE: GET_OPTION_MISSING_DATA_RESPONSE,
|
|
1129
1151
|
GET_XTK_QUERY_SCHEMA_RESPONSE: GET_XTK_QUERY_SCHEMA_RESPONSE,
|
|
1152
|
+
GET_UNION_PROFILE_SCHEMA_RESPONSE: GET_UNION_PROFILE_SCHEMA_RESPONSE,
|
|
1130
1153
|
GET_NMS_DELIVERY_SCHEMA_RESPONSE: GET_NMS_DELIVERY_SCHEMA_RESPONSE,
|
|
1131
1154
|
GET_DELIVERY_TEST_RESPONSE: GET_DELIVERY_TEST_RESPONSE,
|
|
1132
1155
|
GET_MID_EXT_ACCOUNT_RESPONSE: GET_MID_EXT_ACCOUNT_RESPONSE,
|