@adobe/acc-js-sdk 1.1.31 → 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.
@@ -3,6 +3,13 @@ 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
+
6
13
  <section class="changelog"><h1>Version 1.1.31</h1>
7
14
  <h2>2023/06/19</h2>
8
15
  <li>
package/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@adobe/acc-js-sdk",
3
- "version": "1.1.31",
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.31",
9
+ "version": "1.1.32",
10
10
  "license": "ISC",
11
11
  "dependencies": {
12
12
  "axios": "^1.2.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/acc-js-sdk",
3
- "version": "1.1.31",
3
+ "version": "1.1.32",
4
4
  "description": "ACC Javascript SDK",
5
5
  "main": "src/index.js",
6
6
  "homepage": "https://github.com/adobe/acc-js-sdk#readme",
@@ -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
- this.default = XtkCaster.asArray(json[this.name]);
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
- this.default = child.textContent;
666
+ if(child.tagName === "translatedDefault") {
667
+ this.translatedDefault = child.textContent;
668
+ } else {
669
+ this.default = child.textContent;
670
+ }
663
671
  }
664
672
  }
665
673
  }
@@ -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 translatedDefault", async () => {
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>&lt;extractOutput enabled="true" label="Segment" name="subSet" &gt;
2140
+ &lt;limiter type="percent" percent="10" random="true"/&gt;
2141
+ &lt;filter enabled="true"/&gt;
2142
+ &lt;/extractOutput&gt;</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", () => {