@adobe/acc-js-sdk 1.1.30 → 1.1.31
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 +8 -0
- package/package-lock.json +2 -2
- package/package.json +1 -1
- package/src/client.js +5 -2
- package/test/client.test.js +43 -0
- package/test/mock.js +16 -0
package/docs/changeLog.html
CHANGED
|
@@ -3,6 +3,14 @@ layout: page
|
|
|
3
3
|
title: Change Log
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
+
<section class="changelog"><h1>Version 1.1.31</h1>
|
|
7
|
+
<h2>2023/06/19</h2>
|
|
8
|
+
<li>
|
|
9
|
+
Fixed a caching issue: xtk:session method can be missing from the cache. This is a temporary fix. A better fix is needed to
|
|
10
|
+
properly handle consistency of the entity and method caches.
|
|
11
|
+
</li>
|
|
12
|
+
</section>
|
|
13
|
+
|
|
6
14
|
<section class="changelog"><h1>Version 1.1.30</h1>
|
|
7
15
|
<h2>2023/06/19</h2>
|
|
8
16
|
<li>
|
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.31",
|
|
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.31",
|
|
10
10
|
"license": "ISC",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"axios": "^1.2.1",
|
package/package.json
CHANGED
package/src/client.js
CHANGED
|
@@ -1787,8 +1787,11 @@ class Client {
|
|
|
1787
1787
|
if (entity) {
|
|
1788
1788
|
const impls = DomUtil.getAttributeAsString(entity, "implements");
|
|
1789
1789
|
if (impls === "xtk:persist" && schemaId !== "xtk:session" && schemaId !== "xtk:persist") {
|
|
1790
|
-
|
|
1791
|
-
|
|
1790
|
+
// Ensure xtk:persist is present by loading the xtk:session schema
|
|
1791
|
+
const xtkSession = await this.getSchema("xtk:session", "xml", true);
|
|
1792
|
+
// it is possible that methodCache content has not be loaded in memory
|
|
1793
|
+
// so we re-put the methods
|
|
1794
|
+
await this._methodCache.put(xtkSession);
|
|
1792
1795
|
}
|
|
1793
1796
|
await this._entityCache.put("xtk:schema", schemaId, entity);
|
|
1794
1797
|
await this._methodCache.put(entity);
|
package/test/client.test.js
CHANGED
|
@@ -965,6 +965,49 @@ describe('ACC Client', function () {
|
|
|
965
965
|
await client.NLWS.xtkSession.logoff();
|
|
966
966
|
});
|
|
967
967
|
|
|
968
|
+
it("Should always put in cache methods of schema to avoid a method is not found", async () => {
|
|
969
|
+
const client = await Mock.makeClient();
|
|
970
|
+
client._transport.mockReturnValueOnce(Mock.LOGON_RESPONSE);
|
|
971
|
+
await client.NLWS.xtkSession.logon();
|
|
972
|
+
|
|
973
|
+
client._transport.mockReturnValueOnce(Mock.GET_XTK_SESSION_SCHEMA_RESPONSE);
|
|
974
|
+
client._transport.mockReturnValueOnce(Mock.GET_USER_INFO_RESPONSE);
|
|
975
|
+
// call a method of xtk:session to have the schema xt:session in memory and in entityCache
|
|
976
|
+
await client.NLWS.xtkSession.getUserInfo();
|
|
977
|
+
|
|
978
|
+
// simulate expiration of methodCache only (entityCache not expired)
|
|
979
|
+
client._methodCache.clear();
|
|
980
|
+
|
|
981
|
+
client._transport.mockReturnValueOnce(Mock.GET_XTK_IMPL_SCHEMA_RESPONSE);
|
|
982
|
+
client._transport.mockReturnValueOnce(Mock.GET_XTK_SESSION_SCHEMA_RESPONSE);
|
|
983
|
+
await client.NLWS.xtkImpl.Duplicate();
|
|
984
|
+
|
|
985
|
+
client._transport.mockReturnValueOnce(Mock.LOGOFF_RESPONSE);
|
|
986
|
+
await client.NLWS.xtkSession.logoff();
|
|
987
|
+
});
|
|
988
|
+
|
|
989
|
+
it("Should always put in memory methods of schema to avoid a method is not found", async () => {
|
|
990
|
+
const client = await Mock.makeClient();
|
|
991
|
+
client._transport.mockReturnValueOnce(Mock.LOGON_RESPONSE);
|
|
992
|
+
await client.NLWS.xtkSession.logon();
|
|
993
|
+
|
|
994
|
+
client._transport.mockReturnValueOnce(Mock.GET_XTK_SESSION_SCHEMA_RESPONSE);
|
|
995
|
+
client._transport.mockReturnValueOnce(Mock.GET_USER_INFO_RESPONSE);
|
|
996
|
+
// call a method of xtk:session to have the schema xt:session in memory and in entityCache
|
|
997
|
+
await client.NLWS.xtkSession.getUserInfo();
|
|
998
|
+
|
|
999
|
+
// simulate empty cache method in memory
|
|
1000
|
+
client._methodCache._cache = {};
|
|
1001
|
+
|
|
1002
|
+
client._transport.mockReturnValueOnce(Mock.GET_XTK_IMPL_SCHEMA_RESPONSE);
|
|
1003
|
+
client._transport.mockReturnValueOnce(Mock.GET_XTK_SESSION_SCHEMA_RESPONSE);
|
|
1004
|
+
await client.NLWS.xtkImpl.Duplicate();
|
|
1005
|
+
|
|
1006
|
+
client._transport.mockReturnValueOnce(Mock.LOGOFF_RESPONSE);
|
|
1007
|
+
await client.NLWS.xtkSession.logoff();
|
|
1008
|
+
});
|
|
1009
|
+
|
|
1010
|
+
|
|
968
1011
|
it("Should fail if method parameter inout attribute is not correct", async () => {
|
|
969
1012
|
const client = await Mock.makeClient();
|
|
970
1013
|
client._transport.mockReturnValueOnce(Mock.LOGON_RESPONSE);
|
package/test/mock.js
CHANGED
|
@@ -219,6 +219,8 @@ const GET_XTK_SESSION_SCHEMA_RESPONSE = Promise.resolve(`<?xml version='1.0'?>
|
|
|
219
219
|
<interface name="persist">
|
|
220
220
|
<method name="NewInstance">
|
|
221
221
|
</method>
|
|
222
|
+
<method name="Duplicate" static="true">
|
|
223
|
+
</method>
|
|
222
224
|
<method name="Write" static="true">
|
|
223
225
|
<parameters>
|
|
224
226
|
<param name="doc" type="DOMDocument"/>
|
|
@@ -565,6 +567,19 @@ const GET_NMS_EXTACCOUNT_SCHEMA_RESPONSE = Promise.resolve(`<?xml version='1.0'?
|
|
|
565
567
|
</SOAP-ENV:Body>
|
|
566
568
|
</SOAP-ENV:Envelope>`);
|
|
567
569
|
|
|
570
|
+
const GET_XTK_IMPL_SCHEMA_RESPONSE = Promise.resolve(`<?xml version='1.0'?>
|
|
571
|
+
<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/'>
|
|
572
|
+
<SOAP-ENV:Body>
|
|
573
|
+
<GetEntityIfMoreRecentResponse xmlns='urn:wpp:default' SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'>
|
|
574
|
+
<pdomDoc xsi:type='ns:Element' SOAP-ENV:encodingStyle='http://xml.apache.org/xml-soap/literalxml'>
|
|
575
|
+
<schema name="impl" namespace="xtk" xtkschema="xtk:schema" implements="xtk:persist">
|
|
576
|
+
<element name="one"></element>
|
|
577
|
+
</schema>
|
|
578
|
+
</pdomDoc>
|
|
579
|
+
</GetEntityIfMoreRecentResponse>
|
|
580
|
+
</SOAP-ENV:Body>
|
|
581
|
+
</SOAP-ENV:Envelope>`);
|
|
582
|
+
|
|
568
583
|
const GET_XTK_ALL_SCHEMA_RESPONSE = Promise.resolve(`<?xml version='1.0'?>
|
|
569
584
|
<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/'>
|
|
570
585
|
<SOAP-ENV:Body>
|
|
@@ -999,6 +1014,7 @@ exports.Mock = {
|
|
|
999
1014
|
GET_TSTCNX_RESPONSE: GET_TSTCNX_RESPONSE,
|
|
1000
1015
|
GET_NMS_EXTACCOUNT_SCHEMA_RESPONSE: GET_NMS_EXTACCOUNT_SCHEMA_RESPONSE,
|
|
1001
1016
|
GET_XTK_ALL_SCHEMA_RESPONSE: GET_XTK_ALL_SCHEMA_RESPONSE,
|
|
1017
|
+
GET_XTK_IMPL_SCHEMA_RESPONSE: GET_XTK_IMPL_SCHEMA_RESPONSE,
|
|
1002
1018
|
GET_XTK_ALL_TYPES_RESPONSE: GET_XTK_ALL_TYPES_RESPONSE,
|
|
1003
1019
|
GET_XTK_TYPE_UNSUPPORTED_TYPE_RESPONSE: GET_XTK_TYPE_UNSUPPORTED_TYPE_RESPONSE,
|
|
1004
1020
|
GET_USER_INFO_RESPONSE: GET_USER_INFO_RESPONSE,
|