@adobe/acc-js-sdk 1.1.30 → 1.1.32
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 -0
- package/package-lock.json +2 -2
- package/package.json +1 -1
- package/src/application.js +11 -3
- package/src/client.js +5 -2
- package/test/application.test.js +48 -1
- package/test/client.test.js +43 -0
- package/test/mock.js +16 -0
package/docs/changeLog.html
CHANGED
|
@@ -3,6 +3,21 @@ layout: page
|
|
|
3
3
|
title: Change Log
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
+
<section class="changelog"><h1>Version 1.1.32</h1>
|
|
7
|
+
<h2>2023/06/22</h2>
|
|
8
|
+
<li>
|
|
9
|
+
Support the fact that "translatedDefault" can be an element in a schema (and not just an attribute)
|
|
10
|
+
</li>
|
|
11
|
+
</section>
|
|
12
|
+
|
|
13
|
+
<section class="changelog"><h1>Version 1.1.31</h1>
|
|
14
|
+
<h2>2023/06/19</h2>
|
|
15
|
+
<li>
|
|
16
|
+
Fixed a caching issue: xtk:session method can be missing from the cache. This is a temporary fix. A better fix is needed to
|
|
17
|
+
properly handle consistency of the entity and method caches.
|
|
18
|
+
</li>
|
|
19
|
+
</section>
|
|
20
|
+
|
|
6
21
|
<section class="changelog"><h1>Version 1.1.30</h1>
|
|
7
22
|
<h2>2023/06/19</h2>
|
|
8
23
|
<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.32",
|
|
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.32",
|
|
10
10
|
"license": "ISC",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"axios": "^1.2.1",
|
package/package.json
CHANGED
package/src/application.js
CHANGED
|
@@ -652,14 +652,22 @@ class XtkSchemaNode {
|
|
|
652
652
|
this.expr = EntityAccessor.getAttributeAsString(child, "expr");
|
|
653
653
|
this.isCalculated = false;
|
|
654
654
|
}
|
|
655
|
-
if (child.tagName === "default") {
|
|
655
|
+
if (child.tagName === "default" || child.tagName === "translatedDefault") {
|
|
656
656
|
if(this.unbound) {
|
|
657
657
|
// Default value for a collection of elements
|
|
658
658
|
const xml = DomUtil.parse(`<xml>${child.textContent}</xml>`);
|
|
659
659
|
const json = DomUtil.toJSON(xml);
|
|
660
|
-
|
|
660
|
+
if(child.tagName === "translatedDefault") {
|
|
661
|
+
this.translatedDefault = XtkCaster.asArray(json[this.name]);
|
|
662
|
+
} else {
|
|
663
|
+
this.default = XtkCaster.asArray(json[this.name]);
|
|
664
|
+
}
|
|
661
665
|
} else {
|
|
662
|
-
|
|
666
|
+
if(child.tagName === "translatedDefault") {
|
|
667
|
+
this.translatedDefault = child.textContent;
|
|
668
|
+
} else {
|
|
669
|
+
this.default = child.textContent;
|
|
670
|
+
}
|
|
663
671
|
}
|
|
664
672
|
}
|
|
665
673
|
}
|
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/application.test.js
CHANGED
|
@@ -2096,7 +2096,23 @@ describe('Application', () => {
|
|
|
2096
2096
|
expect(node).toMatchObject({ name:"period", childrenCount:0, default: "\"m_abDay='7' m_abDay[0]='0' m_abDay[1]='0'\"" });
|
|
2097
2097
|
});
|
|
2098
2098
|
|
|
2099
|
-
it("Should extract
|
|
2099
|
+
it("Should extract translated default values of a memo", async () => {
|
|
2100
|
+
var xml = DomUtil.parse(`<schema namespace='xtk' name='workflow'>
|
|
2101
|
+
<element name='workflow' label='Workflow'>
|
|
2102
|
+
<element name="directorywatcher" label="File collector">
|
|
2103
|
+
<element name="period" type="memo" label="Schedule">
|
|
2104
|
+
<translatedDefault>"m_abDay='7' m_abDay[0]='0' m_abDay[1]='0'"</translatedDefault>
|
|
2105
|
+
</element>
|
|
2106
|
+
</element>
|
|
2107
|
+
</element>
|
|
2108
|
+
</schema>`);
|
|
2109
|
+
var schema = newSchema(xml);
|
|
2110
|
+
|
|
2111
|
+
var node = await schema.root.findNode("directorywatcher/period");
|
|
2112
|
+
expect(node).toMatchObject({ name:"period", childrenCount:0, translatedDefault: "\"m_abDay='7' m_abDay[0]='0' m_abDay[1]='0'\"" });
|
|
2113
|
+
});
|
|
2114
|
+
|
|
2115
|
+
it("Should extract translatedDefault attribute", async () => {
|
|
2100
2116
|
var xml = DomUtil.parse(`<schema namespace='xtk' name='workflow'>
|
|
2101
2117
|
<element name='workflow' label='Workflow'>
|
|
2102
2118
|
<element name="delivery" label="Delivery">
|
|
@@ -2114,6 +2130,37 @@ describe('Application', () => {
|
|
|
2114
2130
|
expect(node).toMatchObject({ name:"@label", childrenCount:0, translatedDefault: "'Ok'" });
|
|
2115
2131
|
});
|
|
2116
2132
|
|
|
2133
|
+
it("Should extract translatedDefault element", async () => {
|
|
2134
|
+
var xml = DomUtil.parse(`<schema namespace='xtk' name='workflow'>
|
|
2135
|
+
<element name='workflow' label='Workflow'>
|
|
2136
|
+
<element name="extract" label="Split">
|
|
2137
|
+
<element label="Transitions" name="transitions" xml="true">
|
|
2138
|
+
<element name="extractOutput" ordered="true" template="nms:workflow:extractOutput" unbound="true">
|
|
2139
|
+
<translatedDefault><extractOutput enabled="true" label="Segment" name="subSet" >
|
|
2140
|
+
<limiter type="percent" percent="10" random="true"/>
|
|
2141
|
+
<filter enabled="true"/>
|
|
2142
|
+
</extractOutput></translatedDefault>
|
|
2143
|
+
</element>
|
|
2144
|
+
</element>
|
|
2145
|
+
</element>
|
|
2146
|
+
</element>
|
|
2147
|
+
</schema>`);
|
|
2148
|
+
var schema = newSchema(xml);
|
|
2149
|
+
|
|
2150
|
+
var node = await schema.root.findNode("extract/transitions/extractOutput");
|
|
2151
|
+
expect(node).toMatchObject(
|
|
2152
|
+
{ translatedDefault: [
|
|
2153
|
+
{
|
|
2154
|
+
enabled: "true", name:"subSet",
|
|
2155
|
+
limiter: {
|
|
2156
|
+
type: 'percent',
|
|
2157
|
+
percent: '10',
|
|
2158
|
+
random: 'true'
|
|
2159
|
+
}
|
|
2160
|
+
}]
|
|
2161
|
+
});
|
|
2162
|
+
});
|
|
2163
|
+
|
|
2117
2164
|
});
|
|
2118
2165
|
|
|
2119
2166
|
describe("toString", () => {
|
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,
|