@salesforcedevs/docs-components 1.3.304-ww-fix-alpha1 → 1.3.319

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/LICENSE ADDED
@@ -0,0 +1,12 @@
1
+ Copyright (c) 2020, Salesforce.com, Inc.
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5
+
6
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7
+
8
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9
+
10
+ * Neither the name of Salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
11
+
12
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/docs-components",
3
- "version": "1.3.304-ww-fix-alpha1",
3
+ "version": "1.3.319",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -24,5 +24,5 @@
24
24
  "@types/lodash.orderby": "^4.6.7",
25
25
  "@types/lodash.uniqby": "^4.7.7"
26
26
  },
27
- "gitHead": "4629fdd9ca18a13480044ad43515b91945d16aad"
27
+ "gitHead": "11298c74de6a1f33153b9c6e8dbb1bcd5851ce59"
28
28
  }
@@ -1475,10 +1475,18 @@ export default class AmfReference extends LightningElement {
1475
1475
  // update topic view
1476
1476
  const { referenceId, amfId, type } = this.selectedTopic!;
1477
1477
 
1478
+ // Adding stringify inside try/catch
1479
+ let amfModelString = "";
1480
+ try {
1481
+ amfModelString = JSON.stringify(this.amfMap[referenceId].model);
1482
+ } catch (error) {
1483
+ console.error(`Error stringifying amf model: ${error}`);
1484
+ }
1485
+
1478
1486
  // This updates the component in the content section.
1479
1487
  this.topicModel = {
1480
1488
  type,
1481
- amf: this.amfMap[referenceId].model,
1489
+ amf: amfModelString,
1482
1490
  parser: this.amfMap[referenceId].parser,
1483
1491
  id: amfId
1484
1492
  };
@@ -95,7 +95,7 @@ export interface ParsedTopicModel {
95
95
  export interface TopicModel {
96
96
  id: string;
97
97
  type: string;
98
- amf: AmfModel;
98
+ amf: string;
99
99
  parser: AmfParser;
100
100
  }
101
101
 
@@ -27,13 +27,17 @@ export default class AmfTopic extends LightningElement {
27
27
  !this.amf ||
28
28
  (value && this._model && value.amf !== this._model?.amf)
29
29
  ) {
30
- this.amf = value && clone(value.amf);
30
+ try {
31
+ this.amf = value && JSON.parse(value.amf);
32
+ } catch (error) {
33
+ console.error(`Error parsing amf model: ${error}`);
34
+ }
31
35
  }
32
36
  if (
33
37
  !this.type ||
34
38
  (value && this._model && value.type !== this._model?.type)
35
39
  ) {
36
- this.type = value && clone(value.type);
40
+ this.type = value && value.type;
37
41
  }
38
42
 
39
43
  this._model = value;
@@ -105,20 +109,3 @@ export default class AmfTopic extends LightningElement {
105
109
  }
106
110
  }
107
111
  }
108
-
109
- /**
110
- * The underlying web components we use from api-console mutate their models we pass in.
111
- * Since LWC makes them Read Only, we need to copy them before passing to the Web Component.
112
- * @param value JSON Serializable object to clone.
113
- * @returns A copy of Value. One that has been serialized and parsed via JSON. (Functions, Regex, etc are not preserved.)
114
- */
115
- function clone(value: any): any {
116
- const worker = new Worker("./worker.js");
117
- worker.postMessage(value);
118
- return new Promise((resolve) => {
119
- worker.addEventListener("message", (event) => {
120
- resolve(event.data);
121
- worker.terminate();
122
- });
123
- });
124
- }
@@ -51,6 +51,6 @@ export type AmfModel = Json;
51
51
  export interface TopicModel {
52
52
  id: string;
53
53
  type: string;
54
- amf: AmfModel;
54
+ amf: string;
55
55
  parser: AmfModelParser;
56
56
  }
@@ -1,3 +0,0 @@
1
- onmessage = function (event) {
2
- postMessage(JSON.parse(JSON.stringify(event.data)));
3
- };