gd-sprest 9.7.2 → 9.7.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.
Files changed (100) hide show
  1. package/@types/utils/base.d.ts +0 -3
  2. package/build/helper/executor.js +10 -20
  3. package/build/helper/fieldSchemaXML.js +85 -89
  4. package/build/helper/index.js +12 -28
  5. package/build/helper/jslink.js +124 -128
  6. package/build/helper/listForm.js +109 -118
  7. package/build/helper/listFormField.js +62 -65
  8. package/build/helper/methods/addContentEditorWebPart.js +9 -17
  9. package/build/helper/methods/addPermissionLevel.js +12 -16
  10. package/build/helper/methods/addScriptEditorWebPart.js +9 -17
  11. package/build/helper/methods/copyPermissionLevel.js +22 -26
  12. package/build/helper/methods/createContentType.js +96 -19
  13. package/build/helper/methods/createDocSet.js +10 -14
  14. package/build/helper/methods/getCurrentTheme.js +26 -31
  15. package/build/helper/methods/hasPermissions.js +8 -13
  16. package/build/helper/methods/index.js +16 -32
  17. package/build/helper/methods/loadSPCore.js +13 -17
  18. package/build/helper/methods/parse.js +5 -9
  19. package/build/helper/methods/request.js +4 -8
  20. package/build/helper/methods/setContentTypeFields.js +71 -79
  21. package/build/helper/methods/setGroupOwner.js +6 -10
  22. package/build/helper/methods/setWebProperty.js +26 -30
  23. package/build/helper/methods/stringify.js +3 -7
  24. package/build/helper/methods/webWorker.js +40 -20
  25. package/build/helper/ribbonLink.js +10 -14
  26. package/build/helper/sbLink.js +11 -15
  27. package/build/helper/sp/calloutManager.js +22 -25
  28. package/build/helper/sp/index.js +13 -16
  29. package/build/helper/sp/modalDialog.js +32 -35
  30. package/build/helper/sp/notify.js +9 -12
  31. package/build/helper/sp/ribbon.js +1 -4
  32. package/build/helper/sp/sod.js +9 -18
  33. package/build/helper/sp/status.js +18 -21
  34. package/build/helper/spCfg.js +232 -259
  35. package/build/helper/spCfgTypes.js +2 -5
  36. package/build/helper/taxonomy.js +144 -182
  37. package/build/helper/webpart.js +110 -94
  38. package/build/index.js +6 -23
  39. package/build/lib/apps.js +4 -7
  40. package/build/lib/contextInfo.js +217 -781
  41. package/build/lib/directorySession.js +4 -7
  42. package/build/lib/graph.js +16 -19
  43. package/build/lib/groupService.js +4 -7
  44. package/build/lib/groupSiteManager.js +4 -7
  45. package/build/lib/hubSites.js +11 -25
  46. package/build/lib/hubSitesUtility.js +4 -7
  47. package/build/lib/index.js +27 -43
  48. package/build/lib/list.js +49 -53
  49. package/build/lib/navigation.js +4 -7
  50. package/build/lib/peopleManager.js +4 -7
  51. package/build/lib/peoplePicker.js +4 -7
  52. package/build/lib/profileLoader.js +4 -7
  53. package/build/lib/search.js +30 -33
  54. package/build/lib/sensitivityLabels.js +6 -9
  55. package/build/lib/site.js +20 -35
  56. package/build/lib/siteIconManager.js +4 -7
  57. package/build/lib/siteManager.js +4 -7
  58. package/build/lib/sitePages.js +37 -51
  59. package/build/lib/socialFeed.js +13 -16
  60. package/build/lib/themeManager.js +4 -7
  61. package/build/lib/userProfile.js +4 -7
  62. package/build/lib/utility.js +12 -17
  63. package/build/lib/web.js +34 -49
  64. package/build/lib/webTemplateExtensions.js +4 -7
  65. package/build/lib/wfInstanceService.js +4 -7
  66. package/build/lib/wfSubscriptionService.js +4 -7
  67. package/build/mapper/custom/audit.js +3 -6
  68. package/build/mapper/custom/graph.js +13 -16
  69. package/build/mapper/custom/index.js +8 -24
  70. package/build/mapper/custom/odata.js +3 -6
  71. package/build/mapper/custom/old.js +42 -45
  72. package/build/mapper/custom/peoplePicker.js +4 -7
  73. package/build/mapper/custom/propertyValues.js +3 -6
  74. package/build/mapper/custom/utility.js +17 -20
  75. package/build/mapper/custom/webTemplateExtensions.js +19 -22
  76. package/build/mapper/def.js +1032 -989
  77. package/build/mapper/index.js +4 -9
  78. package/build/mapper/v2.js +2629 -2632
  79. package/build/rest.js +16 -19
  80. package/build/sptypes/graphtypes.js +694 -710
  81. package/build/sptypes/index.js +3 -7
  82. package/build/sptypes/sptypes.js +49 -52
  83. package/build/utils/base.js +20 -37
  84. package/build/utils/batch.js +53 -63
  85. package/build/utils/helper.js +79 -83
  86. package/build/utils/index.js +9 -25
  87. package/build/utils/methodInfo.js +88 -141
  88. package/build/utils/oData.js +62 -112
  89. package/build/utils/request.js +137 -155
  90. package/build/utils/requestType.js +1 -4
  91. package/build/utils/targetInfo.js +39 -52
  92. package/build/utils/xhrRequest.js +59 -107
  93. package/build/v2/drive.js +9 -13
  94. package/build/v2/drives.js +8 -12
  95. package/build/v2/index.js +3 -19
  96. package/build/v2/sites.js +61 -65
  97. package/dist/gd-sprest.d.ts +0 -3
  98. package/dist/gd-sprest.js +1 -1
  99. package/dist/gd-sprest.min.js +1 -1
  100. package/package.json +2 -2
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RequestType = void 0;
4
1
  /**
5
2
  * Request Type
6
3
  */
7
- exports.RequestType = {
4
+ export const RequestType = {
8
5
  // Requests
9
6
  Custom: 0,
10
7
  Delete: 1,
@@ -1,16 +1,13 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TargetInfo = void 0;
4
- var lib_1 = require("../lib");
5
- var _1 = require(".");
1
+ import { ContextInfo } from "../lib";
2
+ import { RequestType } from ".";
6
3
  /**
7
4
  * Target Information
8
5
  */
9
- var TargetInfo = /** @class */ (function () {
6
+ export class TargetInfo {
10
7
  /*********************************************************************************************************************************/
11
8
  // Constructor
12
9
  /*********************************************************************************************************************************/
13
- function TargetInfo(props) {
10
+ constructor(props) {
14
11
  // Default the properties
15
12
  this.props = props || {};
16
13
  this.requestData = this.props.data;
@@ -19,12 +16,12 @@ var TargetInfo = /** @class */ (function () {
19
16
  // See if this is a graph request
20
17
  if (this.isGraph) {
21
18
  // Set the request method
22
- this.requestMethod = this.requestMethod || (this.props.requestType == _1.RequestType.Get ||
23
- this.props.requestType == _1.RequestType.GetReplace ||
24
- this.props.requestType == _1.RequestType.GetWithArgsValueOnly ||
25
- this.props.requestType == _1.RequestType.GraphGet ||
26
- this.props.requestType == _1.RequestType.GraphGetReplace ||
27
- this.props.requestType == _1.RequestType.OData ? "GET" : "POST");
19
+ this.requestMethod = this.requestMethod || (this.props.requestType == RequestType.Get ||
20
+ this.props.requestType == RequestType.GetReplace ||
21
+ this.props.requestType == RequestType.GetWithArgsValueOnly ||
22
+ this.props.requestType == RequestType.GraphGet ||
23
+ this.props.requestType == RequestType.GraphGetReplace ||
24
+ this.props.requestType == RequestType.OData ? "GET" : "POST");
28
25
  // Check the endpoint
29
26
  if (this.props.endpoint.indexOf("http") == 0) {
30
27
  // Set the request url
@@ -48,31 +45,23 @@ var TargetInfo = /** @class */ (function () {
48
45
  this.setRESTRequestUrl();
49
46
  }
50
47
  }
51
- Object.defineProperty(TargetInfo.prototype, "isBatchRequest", {
52
- // Flag to determine if this is a batch request
53
- get: function () { return this.props.endpoint == "$batch"; },
54
- enumerable: false,
55
- configurable: true
56
- });
57
- Object.defineProperty(TargetInfo.prototype, "isGraph", {
58
- // Flag to determine if this is a graph request
59
- get: function () {
60
- var _a, _b;
61
- return ((_a = this.props.endpoint) === null || _a === void 0 ? void 0 : _a.startsWith("_api/v2.0/")) || ((_b = this.props.url) === null || _b === void 0 ? void 0 : _b.indexOf("_api/v2.0/")) >= 0 ||
62
- this.props.requestType == _1.RequestType.GraphGet || this.props.requestType == _1.RequestType.GraphPost ||
63
- this.props.requestType == _1.RequestType.GraphGetReplace || this.props.requestType == _1.RequestType.GraphPostReplace;
64
- },
65
- enumerable: false,
66
- configurable: true
67
- });
48
+ // Flag to determine if this is a batch request
49
+ get isBatchRequest() { return this.props.endpoint == "$batch"; }
50
+ // Flag to determine if this is a graph request
51
+ get isGraph() {
52
+ var _a, _b;
53
+ return ((_a = this.props.endpoint) === null || _a === void 0 ? void 0 : _a.startsWith("_api/v2.0/")) || ((_b = this.props.url) === null || _b === void 0 ? void 0 : _b.indexOf("_api/v2.0/")) >= 0 ||
54
+ this.props.requestType == RequestType.GraphGet || this.props.requestType == RequestType.GraphPost ||
55
+ this.props.requestType == RequestType.GraphGetReplace || this.props.requestType == RequestType.GraphPostReplace;
56
+ }
68
57
  /*********************************************************************************************************************************/
69
58
  // Methods
70
59
  /*********************************************************************************************************************************/
71
60
  // Method to get the domain url
72
- TargetInfo.prototype.getDomainUrl = function () {
73
- var url = lib_1.ContextInfo.document ? lib_1.ContextInfo.document.location.href : "";
61
+ getDomainUrl() {
62
+ let url = ContextInfo.document ? ContextInfo.document.location.href : "";
74
63
  // See if this is an app web
75
- if (lib_1.ContextInfo.isAppWeb) {
64
+ if (ContextInfo.isAppWeb) {
76
65
  // Set the url to the host url
77
66
  url = TargetInfo.getQueryStringValue("SPHostUrl") + "";
78
67
  }
@@ -84,11 +73,11 @@ var TargetInfo = /** @class */ (function () {
84
73
  }
85
74
  // Return the url
86
75
  return url;
87
- };
76
+ }
88
77
  // Method to get a query string value
89
- TargetInfo.getQueryStringValue = function (key) {
78
+ static getQueryStringValue(key) {
90
79
  // Get the query string
91
- var queryString = lib_1.ContextInfo.existsFl && lib_1.ContextInfo.document ? lib_1.ContextInfo.document.location.href.split('?') : [""];
80
+ var queryString = ContextInfo.existsFl && ContextInfo.document ? ContextInfo.document.location.href.split('?') : [""];
92
81
  queryString = queryString.length > 1 ? queryString[1] : queryString[0];
93
82
  // Parse the values
94
83
  var values = queryString.split('&');
@@ -105,13 +94,13 @@ var TargetInfo = /** @class */ (function () {
105
94
  }
106
95
  // Key was not found
107
96
  return null;
108
- };
97
+ }
109
98
  // Method to set the request url for the REST API
110
- TargetInfo.prototype.setRESTRequestUrl = function () {
111
- var endpoint = this.props.endpoint ? "/" + this.props.endpoint : "";
112
- var hostUrl = TargetInfo.getQueryStringValue("SPHostUrl");
113
- var qs = (endpoint.indexOf("?") === -1 ? "?" : "&") + "@target='{{Target}}'";
114
- var template = "{{Url}}";
99
+ setRESTRequestUrl() {
100
+ let endpoint = this.props.endpoint ? "/" + this.props.endpoint : "";
101
+ let hostUrl = TargetInfo.getQueryStringValue("SPHostUrl");
102
+ let qs = (endpoint.indexOf("?") === -1 ? "?" : "&") + "@target='{{Target}}'";
103
+ let template = "{{Url}}";
115
104
  // See if the template is targeting the _vti_bin
116
105
  if (endpoint.indexOf("_vti_bin") >= 0) {
117
106
  template += "/{{EndPoint}}{{TargetUrl}}";
@@ -120,23 +109,23 @@ var TargetInfo = /** @class */ (function () {
120
109
  template += this.props.endpoint ? "/_api/{{EndPoint}}{{TargetUrl}}" : "";
121
110
  }
122
111
  // See if we are defaulting the url for the app web
123
- if (lib_1.ContextInfo.existsFl && lib_1.ContextInfo.window.$REST && lib_1.ContextInfo.window.$REST.DefaultRequestToHostFl && lib_1.ContextInfo.isAppWeb && !this.props.overrideDefaultRequestToHostFl && this.props.url == null) {
112
+ if (ContextInfo.existsFl && ContextInfo.window.$REST && ContextInfo.window.$REST.DefaultRequestToHostFl && ContextInfo.isAppWeb && !this.props.overrideDefaultRequestToHostFl && this.props.url == null) {
124
113
  // Default the url to the host web
125
114
  this.props.url = hostUrl;
126
115
  }
127
116
  // Ensure the url exists
128
117
  if (this.props.url == null) {
129
118
  // Default the url to the current site/web url
130
- this.props.url = this.props.defaultToWebFl == false ? lib_1.ContextInfo.siteAbsoluteUrl : lib_1.ContextInfo.webAbsoluteUrl;
119
+ this.props.url = this.props.defaultToWebFl == false ? ContextInfo.siteAbsoluteUrl : ContextInfo.webAbsoluteUrl;
131
120
  }
132
121
  // Else, see if the url already contains the full request
133
122
  else if (/\/_api\//.test(this.props.url)) {
134
123
  // Get the url
135
124
  var url = this.props.url.toLowerCase().split("/_api/");
136
125
  // See if this is the app web and we are executing against a different web
137
- if (lib_1.ContextInfo.isAppWeb && url[0] != lib_1.ContextInfo.webAbsoluteUrl.toLowerCase()) {
126
+ if (ContextInfo.isAppWeb && url[0] != ContextInfo.webAbsoluteUrl.toLowerCase()) {
138
127
  // Set the request url
139
- this.requestUrl = lib_1.ContextInfo.webAbsoluteUrl + "/_api/SP.AppContextSite(@target)/" +
128
+ this.requestUrl = ContextInfo.webAbsoluteUrl + "/_api/SP.AppContextSite(@target)/" +
140
129
  url[1] + endpoint + qs.replace(/{{Target}}/g, url[0]);
141
130
  }
142
131
  else {
@@ -151,10 +140,10 @@ var TargetInfo = /** @class */ (function () {
151
140
  this.props.url = this.getDomainUrl() + this.props.url;
152
141
  }
153
142
  // See if this is the app web, and we are executing against a different web
154
- if (lib_1.ContextInfo.isAppWeb && this.props.url != lib_1.ContextInfo.webAbsoluteUrl) {
143
+ if (ContextInfo.isAppWeb && this.props.url != ContextInfo.webAbsoluteUrl) {
155
144
  // Set the request url
156
145
  this.requestUrl = template
157
- .replace(/{{Url}}/g, lib_1.ContextInfo.webAbsoluteUrl)
146
+ .replace(/{{Url}}/g, ContextInfo.webAbsoluteUrl)
158
147
  .replace(/{{EndPoint}}/g, "SP.AppContextSite(@target)" + endpoint)
159
148
  .replace(/{{TargetUrl}}/g, qs.replace(/{{Target}}/g, this.props.url));
160
149
  }
@@ -165,7 +154,5 @@ var TargetInfo = /** @class */ (function () {
165
154
  .replace(/{{EndPoint}}/g, this.props.endpoint)
166
155
  .replace(/{{TargetUrl}}/g, "");
167
156
  }
168
- };
169
- return TargetInfo;
170
- }());
171
- exports.TargetInfo = TargetInfo;
157
+ }
158
+ }
@@ -1,16 +1,12 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.XHRRequest = void 0;
4
- var lib_1 = require("../lib");
1
+ import { ContextInfo, Graph } from "../lib";
5
2
  /**
6
3
  * XML HTTP Request Class
7
4
  */
8
- var XHRRequest = /** @class */ (function () {
5
+ export class XHRRequest {
9
6
  /*********************************************************************************************************************************/
10
7
  // Constructor
11
8
  /*********************************************************************************************************************************/
12
- function XHRRequest(asyncFl, targetInfo, callback, executeFl) {
13
- if (executeFl === void 0) { executeFl = true; }
9
+ constructor(asyncFl, targetInfo, callback, executeFl = true) {
14
10
  // Default the properties
15
11
  this.asyncFl = asyncFl;
16
12
  this.executeFl = executeFl;
@@ -28,82 +24,42 @@ var XHRRequest = /** @class */ (function () {
28
24
  this.defaultHeaders();
29
25
  }
30
26
  }
31
- Object.defineProperty(XHRRequest.prototype, "isBatch", {
32
- /*********************************************************************************************************************************/
33
- // Public Properties
34
- /*********************************************************************************************************************************/
35
- // Flag indicating if this is a batch request
36
- get: function () { return this.targetInfo.isBatchRequest; },
37
- enumerable: false,
38
- configurable: true
39
- });
40
- Object.defineProperty(XHRRequest.prototype, "isGraph", {
41
- // Flag indicating if this is a graph request
42
- get: function () { return this.targetInfo.isGraph; },
43
- enumerable: false,
44
- configurable: true
45
- });
46
- Object.defineProperty(XHRRequest.prototype, "completedFl", {
47
- // Flag indicating the request has completed
48
- get: function () { return this.xhr ? this.xhr.readyState == 4 : false; },
49
- enumerable: false,
50
- configurable: true
51
- });
52
- Object.defineProperty(XHRRequest.prototype, "response", {
53
- // The response
54
- get: function () { return this.xhr ? this.xhr.response : null; },
55
- enumerable: false,
56
- configurable: true
57
- });
58
- Object.defineProperty(XHRRequest.prototype, "request", {
59
- // The xml http request
60
- get: function () { return this.xhr ? this.xhr : null; },
61
- enumerable: false,
62
- configurable: true
63
- });
64
- Object.defineProperty(XHRRequest.prototype, "requestData", {
65
- // The data send in the body of the request
66
- get: function () { return this.targetInfo.requestData; },
67
- enumerable: false,
68
- configurable: true
69
- });
70
- Object.defineProperty(XHRRequest.prototype, "requestHeaders", {
71
- // The request headers
72
- get: function () { return this.headers; },
73
- enumerable: false,
74
- configurable: true
75
- });
76
- Object.defineProperty(XHRRequest.prototype, "requestInfo", {
77
- // The request information
78
- get: function () {
79
- // Return the request information
80
- return {
81
- data: this.targetInfo.requestData,
82
- headers: this.headers,
83
- method: this.targetInfo.requestMethod,
84
- url: this.targetInfo.requestUrl
85
- };
86
- },
87
- enumerable: false,
88
- configurable: true
89
- });
90
- Object.defineProperty(XHRRequest.prototype, "requestUrl", {
91
- // The request url
92
- get: function () { return this.xhr ? this.xhr.responseURL : null; },
93
- enumerable: false,
94
- configurable: true
95
- });
96
- Object.defineProperty(XHRRequest.prototype, "status", {
97
- // The request status
98
- get: function () { return this.xhr ? this.xhr.status : null; },
99
- enumerable: false,
100
- configurable: true
101
- });
27
+ /*********************************************************************************************************************************/
28
+ // Public Properties
29
+ /*********************************************************************************************************************************/
30
+ // Flag indicating if this is a batch request
31
+ get isBatch() { return this.targetInfo.isBatchRequest; }
32
+ // Flag indicating if this is a graph request
33
+ get isGraph() { return this.targetInfo.isGraph; }
34
+ // Flag indicating the request has completed
35
+ get completedFl() { return this.xhr ? this.xhr.readyState == 4 : false; }
36
+ // The response
37
+ get response() { return this.xhr ? this.xhr.response : null; }
38
+ // The xml http request
39
+ get request() { return this.xhr ? this.xhr : null; }
40
+ // The data send in the body of the request
41
+ get requestData() { return this.targetInfo.requestData; }
42
+ // The request headers
43
+ get requestHeaders() { return this.headers; }
44
+ // The request information
45
+ get requestInfo() {
46
+ // Return the request information
47
+ return {
48
+ data: this.targetInfo.requestData,
49
+ headers: this.headers,
50
+ method: this.targetInfo.requestMethod,
51
+ url: this.targetInfo.requestUrl
52
+ };
53
+ }
54
+ // The request url
55
+ get requestUrl() { return this.xhr ? this.xhr.responseURL : null; }
56
+ // The request status
57
+ get status() { return this.xhr ? this.xhr.status : null; }
102
58
  /*********************************************************************************************************************************/
103
59
  // Private Methods
104
60
  /*********************************************************************************************************************************/
105
61
  // Method to create the xml http request
106
- XHRRequest.prototype.createXHR = function () {
62
+ createXHR() {
107
63
  // See if the generic object doesn't exist
108
64
  if (typeof (XMLHttpRequest) !== "undefined") {
109
65
  // Create an instance of the xml http request object
@@ -126,10 +82,10 @@ var XHRRequest = /** @class */ (function () {
126
82
  catch (e) { }
127
83
  // Log an error
128
84
  console.error("This browser does not support xml http requests.");
129
- };
85
+ }
130
86
  // Method to default the request headers
131
- XHRRequest.prototype.defaultHeaders = function (requestDigest) {
132
- var ifMatchExists = false;
87
+ defaultHeaders(requestDigest) {
88
+ let ifMatchExists = false;
133
89
  // See if the custom headers exist
134
90
  if (this.targetInfo.requestHeaders) {
135
91
  // Parse the custom headers
@@ -167,7 +123,7 @@ var XHRRequest = /** @class */ (function () {
167
123
  // See if this is a graph request
168
124
  if (this.targetInfo.isGraph) {
169
125
  // Ensure the access token exists
170
- var accessToken = this.targetInfo.props.accessToken || lib_1.Graph.Token;
126
+ let accessToken = this.targetInfo.props.accessToken || Graph.Token;
171
127
  if (accessToken) {
172
128
  // Set the authorization
173
129
  this.xhr ? this.xhr.setRequestHeader("Authorization", "bearer " + accessToken) : null;
@@ -196,16 +152,15 @@ var XHRRequest = /** @class */ (function () {
196
152
  this.headers["IF-MATCH"] = "*";
197
153
  }
198
154
  }
199
- };
155
+ }
200
156
  // Method to execute the xml http request
201
- XHRRequest.prototype.execute = function () {
202
- var _this = this;
157
+ execute() {
203
158
  // Set the request digest
204
- var requestDigest = this.targetInfo.props.requestDigest || "";
159
+ let requestDigest = this.targetInfo.props.requestDigest || "";
205
160
  if (requestDigest == "") {
206
161
  // Set the request digest
207
- requestDigest = requestDigest ? requestDigest.value : lib_1.ContextInfo.formDigestValue;
208
- requestDigest = requestDigest ? requestDigest : (lib_1.ContextInfo.document ? lib_1.ContextInfo.document.querySelector("#__REQUESTDIGEST") : "");
162
+ requestDigest = requestDigest ? requestDigest.value : ContextInfo.formDigestValue;
163
+ requestDigest = requestDigest ? requestDigest : (ContextInfo.document ? ContextInfo.document.querySelector("#__REQUESTDIGEST") : "");
209
164
  }
210
165
  // See if we are targeting the context endpoint
211
166
  if (this.targetInfo.props.endpoint == "contextinfo") {
@@ -221,9 +176,9 @@ var XHRRequest = /** @class */ (function () {
221
176
  }
222
177
  else {
223
178
  // Get the context information
224
- lib_1.ContextInfo.getWeb(this.targetInfo.props.url || document.location.pathname.substr(0, document.location.pathname.lastIndexOf('/'))).execute(function (contextInfo) {
179
+ ContextInfo.getWeb(this.targetInfo.props.url || document.location.pathname.substr(0, document.location.pathname.lastIndexOf('/'))).execute(contextInfo => {
225
180
  // Execute the request
226
- _this.executeRequest(contextInfo.GetContextWebInformation.FormDigestValue);
181
+ this.executeRequest(contextInfo.GetContextWebInformation.FormDigestValue);
227
182
  });
228
183
  }
229
184
  }
@@ -231,10 +186,9 @@ var XHRRequest = /** @class */ (function () {
231
186
  // Execute the request
232
187
  this.executeRequest(requestDigest);
233
188
  }
234
- };
189
+ }
235
190
  // Method to execute the xml http request
236
- XHRRequest.prototype.executeRequest = function (requestDigest) {
237
- var _this = this;
191
+ executeRequest(requestDigest) {
238
192
  // Ensure the xml http request exists
239
193
  if (this.xhr == null) {
240
194
  return null;
@@ -249,11 +203,11 @@ var XHRRequest = /** @class */ (function () {
249
203
  // See if we are making an asynchronous request
250
204
  if (this.asyncFl) {
251
205
  // Set the state change event
252
- this.xhr.onreadystatechange = function () {
206
+ this.xhr.onreadystatechange = () => {
253
207
  // See if the request has finished
254
- if (_this.xhr.readyState == 4) {
208
+ if (this.xhr.readyState == 4) {
255
209
  // Execute the request completed event
256
- _this.onRequestCompleted ? _this.onRequestCompleted(_this) : null;
210
+ this.onRequestCompleted ? this.onRequestCompleted(this) : null;
257
211
  }
258
212
  };
259
213
  }
@@ -282,16 +236,16 @@ var XHRRequest = /** @class */ (function () {
282
236
  headers: this.headers,
283
237
  keepalive: true,
284
238
  method: this.isGraph ? this.targetInfo.requestMethod : (this.targetInfo.requestMethod == "GET" ? "GET" : "POST")
285
- }).then(function (response) {
239
+ }).then(response => {
286
240
  // Set the xhr object
287
- _this.xhr = response;
241
+ this.xhr = response;
288
242
  // Return the response
289
- return (_this.targetInfo.props.bufferFl ? response.arrayBuffer() : response.text());
290
- }).then(function (response) {
243
+ return (this.targetInfo.props.bufferFl ? response.arrayBuffer() : response.text());
244
+ }).then(response => {
291
245
  // Set the xhr response
292
- _this.xhr.response = response;
246
+ this.xhr.response = response;
293
247
  // Execute the request completed event
294
- _this.onRequestCompleted ? _this.onRequestCompleted(_this) : null;
248
+ this.onRequestCompleted ? this.onRequestCompleted(this) : null;
295
249
  });
296
250
  }
297
251
  else {
@@ -299,7 +253,5 @@ var XHRRequest = /** @class */ (function () {
299
253
  this.targetInfo.props.bufferFl || this.targetInfo.requestData == null ? this.xhr.send() : this.xhr.send(this.targetInfo.requestData);
300
254
  }
301
255
  }
302
- };
303
- return XHRRequest;
304
- }());
305
- exports.XHRRequest = XHRRequest;
256
+ }
257
+ }
package/build/v2/drive.js CHANGED
@@ -1,33 +1,29 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.drive = void 0;
4
- var contextInfo_1 = require("../lib/contextInfo");
5
- var utils_1 = require("../utils");
1
+ import { ContextInfo } from "../lib/contextInfo";
2
+ import { Base, Request, RequestType } from "../utils";
6
3
  /**
7
4
  * Drive
8
5
  * Returns the default library for a site.
9
6
  */
10
- exports.drive = (function (props) {
7
+ export const drive = ((props = {}) => {
11
8
  var _a;
12
- if (props === void 0) { props = {}; }
13
- var drive = new utils_1.Base(props.targetInfo);
9
+ let drive = new Base(props.targetInfo);
14
10
  // Default the properties
15
11
  drive.targetInfo.defaultToWebFl = true;
16
- drive.targetInfo.requestType = utils_1.RequestType.GraphGet;
12
+ drive.targetInfo.requestType = RequestType.GraphGet;
17
13
  // Default the url
18
- drive.targetInfo.url = props.siteUrl || ((_a = props === null || props === void 0 ? void 0 : props.targetInfo) === null || _a === void 0 ? void 0 : _a.url) || contextInfo_1.ContextInfo.webServerRelativeUrl;
14
+ drive.targetInfo.url = props.siteUrl || ((_a = props === null || props === void 0 ? void 0 : props.targetInfo) === null || _a === void 0 ? void 0 : _a.url) || ContextInfo.webServerRelativeUrl;
19
15
  // See if an endpoint is not defined
20
16
  if (drive.targetInfo.endpoint == undefined) {
21
17
  if (props.driveId) {
22
18
  // Set the endpoint
23
- drive.targetInfo.endpoint = "_api/v2.0/".concat(props.siteId ? "sites/" + props.siteId.replace(/[{}]/g, '') + (props.webId ? "," + props.webId.replace(/^\{|\}$/g, '') : "") + "/" : "", "drives/").concat(props.driveId);
19
+ drive.targetInfo.endpoint = `_api/v2.0/${props.siteId ? "sites/" + props.siteId.replace(/[{}]/g, '') + (props.webId ? "," + props.webId.replace(/^\{|\}$/g, '') : "") + "/" : ""}drives/${props.driveId}`;
24
20
  }
25
21
  else {
26
22
  // Default the endpoint
27
- drive.targetInfo.endpoint = "_api/v2.0/".concat(props.siteId ? "sites/" + props.siteId.replace(/[{}]/g, '') + (props.webId ? "," + props.webId.replace(/^\{|\}$/g, '') : "") + "/" : "", "drive");
23
+ drive.targetInfo.endpoint = `_api/v2.0/${props.siteId ? "sites/" + props.siteId.replace(/[{}]/g, '') + (props.webId ? "," + props.webId.replace(/^\{|\}$/g, '') : "") + "/" : ""}drive`;
28
24
  }
29
25
  // Add the methods
30
- utils_1.Request.addMethods(drive, { __metadata: { type: "@odata.context/_api/v2.0/$metadata#drive" } });
26
+ Request.addMethods(drive, { __metadata: { type: "@odata.context/_api/v2.0/$metadata#drive" } });
31
27
  }
32
28
  // Return the default library
33
29
  return drive;
@@ -1,27 +1,23 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.drives = void 0;
4
- var contextInfo_1 = require("../lib/contextInfo");
5
- var utils_1 = require("../utils");
1
+ import { ContextInfo } from "../lib/contextInfo";
2
+ import { Base, Request, RequestType } from "../utils";
6
3
  /**
7
4
  * Drives
8
5
  * Returns the libraries for a site.
9
6
  */
10
- exports.drives = (function (props) {
7
+ export const drives = ((props = {}) => {
11
8
  var _a;
12
- if (props === void 0) { props = {}; }
13
- var drives = new utils_1.Base(props.targetInfo);
9
+ let drives = new Base(props.targetInfo);
14
10
  // Default the properties
15
11
  drives.targetInfo.defaultToWebFl = true;
16
- drives.targetInfo.requestType = utils_1.RequestType.GraphGet;
12
+ drives.targetInfo.requestType = RequestType.GraphGet;
17
13
  // Default the url
18
- drives.targetInfo.url = props.siteUrl || ((_a = props === null || props === void 0 ? void 0 : props.targetInfo) === null || _a === void 0 ? void 0 : _a.url) || contextInfo_1.ContextInfo.webServerRelativeUrl;
14
+ drives.targetInfo.url = props.siteUrl || ((_a = props === null || props === void 0 ? void 0 : props.targetInfo) === null || _a === void 0 ? void 0 : _a.url) || ContextInfo.webServerRelativeUrl;
19
15
  // See if an endpoint is not defined
20
16
  if (drives.targetInfo.endpoint == undefined) {
21
17
  // Default the endpoint
22
- drives.targetInfo.endpoint = "_api/v2.0/".concat(props.siteId ? "sites/" + props.siteId.replace(/[{}]/g, '') + (props.webId ? "," + props.webId.replace(/^\{|\}$/g, '') : "") + "/" : "", "drives");
18
+ drives.targetInfo.endpoint = `_api/v2.0/${props.siteId ? "sites/" + props.siteId.replace(/[{}]/g, '') + (props.webId ? "," + props.webId.replace(/^\{|\}$/g, '') : "") + "/" : ""}drives`;
23
19
  // Add the methods
24
- utils_1.Request.addMethods(drives, { __metadata: { type: "@odata.context/_api/v2.0/$metadata#drives" } });
20
+ Request.addMethods(drives, { __metadata: { type: "@odata.context/_api/v2.0/$metadata#drives" } });
25
21
  }
26
22
  // Return the libraries
27
23
  return drives;
package/build/v2/index.js CHANGED
@@ -1,19 +1,3 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./drive"), exports);
18
- __exportStar(require("./drives"), exports);
19
- __exportStar(require("./sites"), exports);
1
+ export * from "./drive";
2
+ export * from "./drives";
3
+ export * from "./sites";