gd-sprest 8.6.0 → 8.6.2

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.
@@ -57,6 +57,9 @@ export interface Isites {
57
57
  */
58
58
  (props?: { siteId?: string, webId?: string, targetInfo?: ITargetInfoProps }): IBaseQuery<site> & siteMethods;
59
59
 
60
+ /** Returns the current site. */
61
+ static getCurrentSite(): IBaseQuery<site> & siteMethods;
62
+
60
63
  /** Returns the current web. */
61
64
  static getCurrentWeb(): IBaseQuery<site> & siteMethods;
62
65
 
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: 8.60,
12
+ __ver: 8.62,
13
13
  AppContext: function (siteUrl) { return Lib.Site.getAppContext(siteUrl); },
14
14
  Apps: Lib.Apps,
15
15
  ContextInfo: Lib.ContextInfo,
@@ -70,6 +70,7 @@ var OData = /** @class */ (function () {
70
70
  this._top ? values.push("$top=" + this._top) : null;
71
71
  this._skip ? values.push("$skip=" + this._skip) : null;
72
72
  this._filter ? values.push("$filter=" + this._filter) : null;
73
+ this._search ? values.push("$search=" + this._search) : null;
73
74
  values.push(this.getQSValue("$expand", this._expand));
74
75
  this._custom ? values.push(this._custom) : null;
75
76
  // Parse the values
package/build/v2/sites.js CHANGED
@@ -11,27 +11,42 @@ var common_1 = require("./common");
11
11
  * The sites graph endpoint.
12
12
  */
13
13
  exports.sites = (function (props) {
14
- var _a;
15
14
  if (props === void 0) { props = {}; }
16
15
  var sites = new utils_1.Base(props.targetInfo);
17
16
  // Call the init event
18
17
  common_1.init();
19
18
  // Default the properties
20
19
  sites.targetInfo.defaultToWebFl = true;
21
- sites.targetInfo.endpoint = "_api/v2.1/sites/" + (props.siteId || ((_a = contextInfo_1.ContextInfo === null || contextInfo_1.ContextInfo === void 0 ? void 0 : contextInfo_1.ContextInfo.siteId) === null || _a === void 0 ? void 0 : _a.replace(/[{}]/g, '')));
20
+ sites.targetInfo.endpoint = "_api/v2.1/sites" + (props.siteId ? "/" + props.siteId : "");
22
21
  sites.targetInfo.requestType = utils_1.RequestType.GraphGet;
23
- // See if the web id is provided
24
- if (props.webId) {
25
- // Append the web id
26
- sites.targetInfo.endpoint += "," + props.webId;
22
+ // See if the site id was provided
23
+ if (props.siteId) {
24
+ // Append the site id
25
+ sites.targetInfo.endpoint += "/" + props.siteId;
26
+ // See if the web id is provided
27
+ if (props.webId) {
28
+ // Append the web id
29
+ sites.targetInfo.endpoint += "," + props.webId;
30
+ }
27
31
  }
28
32
  // Add the methods
29
33
  utils_1.Request.addMethods(sites, { __metadata: { type: "@odata.context/_api/v2.1/$metadata#sites" } });
30
34
  // Return the sites
31
35
  return sites;
32
36
  });
37
+ /** Returns the current site. */
38
+ exports.sites.getCurrentSite = function () {
39
+ return exports.sites({
40
+ siteId: contextInfo_1.ContextInfo.siteId
41
+ });
42
+ };
33
43
  /** Returns the current web. */
34
- exports.sites.getCurrentWeb = function () { return exports.sites().sites(contextInfo_1.ContextInfo.webId.replace(/^\{|\}$/g, '')); };
44
+ exports.sites.getCurrentWeb = function () {
45
+ return exports.sites({
46
+ siteId: contextInfo_1.ContextInfo.siteId,
47
+ webId: contextInfo_1.ContextInfo.webId
48
+ });
49
+ };
35
50
  /** Returns a drive */
36
51
  exports.sites.getDrive = function (props) {
37
52
  // Return a promise
@@ -4570,6 +4570,9 @@ declare module 'gd-sprest/v2/sites' {
4570
4570
  */
4571
4571
  (props?: { siteId?: string, webId?: string, targetInfo?: ITargetInfoProps }): IBaseQuery<site> & siteMethods;
4572
4572
 
4573
+ /** Returns the current site. */
4574
+ static getCurrentSite(): IBaseQuery<site> & siteMethods;
4575
+
4573
4576
  /** Returns the current web. */
4574
4577
  static getCurrentWeb(): IBaseQuery<site> & siteMethods;
4575
4578