gd-sprest 7.9.2 → 7.9.4

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.
@@ -54,5 +54,5 @@ export interface ISearch {
54
54
  * Method to execute a post query
55
55
  * @param
56
56
  */
57
- postQuery(props: ISearchPostQuery): PromiseLike<SearchResult>;
57
+ postQuery<T = any>(props: ISearchPostQuery): PromiseLike<SearchResult<T>>;
58
58
  }
@@ -44,4 +44,7 @@ export interface IBaseHelper {
44
44
 
45
45
  /** Updates the metdata uri. */
46
46
  updateMetadataUri(base: IBase, metadata, targetInfo: ITargetInfoProps);
47
+
48
+ /** Updates the search results. */
49
+ updateSearchResults(base: IBase);
47
50
  }
package/build/rest.js CHANGED
@@ -9,7 +9,7 @@ var sptypes_1 = require("./sptypes");
9
9
  * SharePoint REST Library
10
10
  */
11
11
  exports.$REST = {
12
- __ver: 7.92,
12
+ __ver: 7.94,
13
13
  AppContext: function (siteUrl) { return Lib.Site.getAppContext(siteUrl); },
14
14
  Apps: Lib.Apps,
15
15
  ContextInfo: Lib.ContextInfo,
@@ -370,5 +370,29 @@ exports.Helper = {
370
370
  // Fix the url reference
371
371
  targetInfo.url = targetInfo.url.split("Microsoft.SharePoint.Marketplace.CorporateCuratedGallery.CorporateCatalogAppMetadata")[0] + "web/tenantappcatalog/availableapps/getbyid('" + base["ID"] + "')";
372
372
  }
373
+ },
374
+ // Method to update the search results
375
+ updateSearchResults: function (base) {
376
+ var _a;
377
+ // See if this contains search results
378
+ var results = base["postquery"] && base["postquery"].results;
379
+ if (results == null) {
380
+ return;
381
+ }
382
+ // Clear the results
383
+ base["results"] = base["results"] || [];
384
+ // Parse the results
385
+ for (var i = 0; i < results.PrimaryQueryResult.RelevantResults.RowCount; i++) {
386
+ var data = {};
387
+ var result = results.PrimaryQueryResult.RelevantResults.Table.Rows.results[i];
388
+ // Parse the cells
389
+ for (var j = 0; j < result.Cells.results.length; j++) {
390
+ var cell = result.Cells.results[j];
391
+ // Add the key/value
392
+ data[cell.Key] = cell.Value;
393
+ }
394
+ // Append the result
395
+ (_a = base["results"]) === null || _a === void 0 ? void 0 : _a.push(data);
396
+ }
373
397
  }
374
398
  };
@@ -172,8 +172,11 @@ var MethodInfo = /** @class */ (function () {
172
172
  // Replace the argument in the template
173
173
  this.methodInfo.data = this.methodInfo.data.replace("[[" + key + "]]", this.methodParams[key].replace(/"/g, '\\"').replace(/\n/g, ""));
174
174
  }
175
+ // For custom format properties of fields, we need to escape \\quot;
176
+ // Replace \\&quot; with \\\\&quot;
177
+ var methodData = this.methodInfo.data.replace(/\\&quot;/g, '\\\\&quot;');
175
178
  // Set the method data
176
- this.methodData = JSON.parse(this.methodInfo.data);
179
+ this.methodData = JSON.parse(methodData);
177
180
  }
178
181
  }
179
182
  // See if argument values exist
@@ -570,6 +570,8 @@ exports.Request = {
570
570
  helper_1.Helper.updateDataCollection(obj, data.d.results);
571
571
  // Update the expanded properties
572
572
  helper_1.Helper.updateExpandedProperties(obj);
573
+ // Update the search results
574
+ helper_1.Helper.updateSearchResults(obj);
573
575
  }
574
576
  // Else, see if this is a graph request
575
577
  else if (data["@odata.context"]) {
@@ -1654,7 +1654,7 @@ declare module 'gd-sprest/lib/search' {
1654
1654
  * Method to execute a post query
1655
1655
  * @param
1656
1656
  */
1657
- postQuery(props: ISearchPostQuery): PromiseLike<SearchResult>;
1657
+ postQuery<T = any>(props: ISearchPostQuery): PromiseLike<SearchResult<T>>;
1658
1658
  }
1659
1659
  }
1660
1660
 
@@ -7103,6 +7103,9 @@ declare module 'gd-sprest/utils/helper' {
7103
7103
 
7104
7104
  /** Updates the metdata uri. */
7105
7105
  updateMetadataUri(base: IBase, metadata, targetInfo: ITargetInfoProps);
7106
+
7107
+ /** Updates the search results. */
7108
+ updateSearchResults(base: IBase);
7106
7109
  }
7107
7110
  }
7108
7111