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,16 +1,13 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MethodInfo = void 0;
4
- var _1 = require(".");
1
+ import { OData, RequestType } from ".";
5
2
  /*********************************************************************************************************************************/
6
3
  // Method Information
7
4
  // This class will create the method information for the request.
8
5
  /*********************************************************************************************************************************/
9
- var MethodInfo = /** @class */ (function () {
6
+ export class MethodInfo {
10
7
  /*********************************************************************************************************************************/
11
8
  // Constructor
12
9
  /*********************************************************************************************************************************/
13
- function MethodInfo(methodName, methodInfo, args) {
10
+ constructor(methodName, methodInfo, args) {
14
11
  // Default the properties
15
12
  this.methodInfo = methodInfo;
16
13
  this.methodInfo.argValues = args;
@@ -20,112 +17,64 @@ var MethodInfo = /** @class */ (function () {
20
17
  // Generate the url
21
18
  this.methodUrl = this.generateUrl();
22
19
  }
23
- Object.defineProperty(MethodInfo.prototype, "appendEndpointFl", {
24
- /*********************************************************************************************************************************/
25
- // Public Properties
26
- /*********************************************************************************************************************************/
27
- // Flag to determine if this method replaces the endpoint
28
- get: function () { return this.methodInfo.appendEndpointFl ? true : false; },
29
- enumerable: false,
30
- configurable: true
31
- });
32
- Object.defineProperty(MethodInfo.prototype, "appendRequest", {
33
- // Flag to determine if we are appending the name or adding a "/" to the request url
34
- get: function () { return this.methodInfo.appendRequest; },
35
- enumerable: false,
36
- configurable: true
37
- });
38
- Object.defineProperty(MethodInfo.prototype, "body", {
39
- // The data passed through the body of the request
40
- get: function () { return this.methodData; },
41
- enumerable: false,
42
- configurable: true
43
- });
44
- Object.defineProperty(MethodInfo.prototype, "getAllItemsFl", {
45
- // Flag to determine if we are getting all items
46
- get: function () { return this.methodInfo.getAllItemsFl; },
47
- enumerable: false,
48
- configurable: true
49
- });
50
- Object.defineProperty(MethodInfo.prototype, "replaceEndpointFl", {
51
- // Flag to determine if this method replaces the endpoint
52
- get: function () { return this.methodInfo.replaceEndpointFl ? true : false; },
53
- enumerable: false,
54
- configurable: true
55
- });
56
- Object.defineProperty(MethodInfo.prototype, "requestMethod", {
57
- // The request method
58
- get: function () {
59
- // Return the request method if it exists
60
- if (typeof (this.methodInfo.requestMethod) === "string") {
61
- return this.methodInfo.requestMethod;
62
- }
63
- // Determine the request method, based on the request type
64
- switch (this.methodInfo.requestType) {
65
- case _1.RequestType.GraphDelete:
66
- return "DELETE";
67
- case _1.RequestType.Delete:
68
- case _1.RequestType.GraphPost:
69
- case _1.RequestType.GraphPostReplace:
70
- case _1.RequestType.Post:
71
- case _1.RequestType.PostBodyNoArgs:
72
- case _1.RequestType.PostReplace:
73
- case _1.RequestType.PostReplaceWithData:
74
- case _1.RequestType.PostWithArgs:
75
- case _1.RequestType.PostWithArgsAndData:
76
- case _1.RequestType.PostWithArgsInBody:
77
- case _1.RequestType.PostWithArgsInQS:
78
- case _1.RequestType.PostWithArgsInQSAsVar:
79
- case _1.RequestType.PostWithArgsValueOnly:
80
- return "POST";
81
- default:
82
- return "GET";
83
- }
84
- },
85
- enumerable: false,
86
- configurable: true
87
- });
88
- Object.defineProperty(MethodInfo.prototype, "url", {
89
- // The url of the method and parameters
90
- get: function () { return this.methodUrl; },
91
- enumerable: false,
92
- configurable: true
93
- });
94
- Object.defineProperty(MethodInfo.prototype, "passDataInBody", {
95
- /*********************************************************************************************************************************/
96
- // Private Variables
97
- /*********************************************************************************************************************************/
98
- get: function () { return this.methodInfo.requestType == _1.RequestType.GetWithArgsInBody || this.methodInfo.requestType == _1.RequestType.PostBodyNoArgs || this.methodInfo.requestType == _1.RequestType.PostWithArgsInBody; },
99
- enumerable: false,
100
- configurable: true
101
- });
102
- Object.defineProperty(MethodInfo.prototype, "passDataInQS", {
103
- get: function () { return this.methodInfo.requestType == _1.RequestType.GetWithArgsInQS || this.methodInfo.requestType == _1.RequestType.PostWithArgsInQS; },
104
- enumerable: false,
105
- configurable: true
106
- });
107
- Object.defineProperty(MethodInfo.prototype, "passDataInQSAsVar", {
108
- get: function () { return this.methodInfo.requestType == _1.RequestType.GetWithArgsInQSAsVar || this.methodInfo.requestType == _1.RequestType.PostWithArgsInQSAsVar; },
109
- enumerable: false,
110
- configurable: true
111
- });
112
- Object.defineProperty(MethodInfo.prototype, "isTemplate", {
113
- get: function () { return this.methodInfo.data ? true : false; },
114
- enumerable: false,
115
- configurable: true
116
- });
117
- Object.defineProperty(MethodInfo.prototype, "replace", {
118
- get: function () { return this.methodInfo.requestType == _1.RequestType.GetReplace || this.methodInfo.requestType == _1.RequestType.GraphGetReplace || this.methodInfo.requestType == _1.RequestType.PostReplace || this.methodInfo.requestType == _1.RequestType.GraphPostReplace; },
119
- enumerable: false,
120
- configurable: true
121
- });
20
+ /*********************************************************************************************************************************/
21
+ // Public Properties
22
+ /*********************************************************************************************************************************/
23
+ // Flag to determine if this method replaces the endpoint
24
+ get appendEndpointFl() { return this.methodInfo.appendEndpointFl ? true : false; }
25
+ // Flag to determine if we are appending the name or adding a "/" to the request url
26
+ get appendRequest() { return this.methodInfo.appendRequest; }
27
+ // The data passed through the body of the request
28
+ get body() { return this.methodData; }
29
+ // Flag to determine if we are getting all items
30
+ get getAllItemsFl() { return this.methodInfo.getAllItemsFl; }
31
+ // Flag to determine if this method replaces the endpoint
32
+ get replaceEndpointFl() { return this.methodInfo.replaceEndpointFl ? true : false; }
33
+ // The request method
34
+ get requestMethod() {
35
+ // Return the request method if it exists
36
+ if (typeof (this.methodInfo.requestMethod) === "string") {
37
+ return this.methodInfo.requestMethod;
38
+ }
39
+ // Determine the request method, based on the request type
40
+ switch (this.methodInfo.requestType) {
41
+ case RequestType.GraphDelete:
42
+ return "DELETE";
43
+ case RequestType.Delete:
44
+ case RequestType.GraphPost:
45
+ case RequestType.GraphPostReplace:
46
+ case RequestType.Post:
47
+ case RequestType.PostBodyNoArgs:
48
+ case RequestType.PostReplace:
49
+ case RequestType.PostReplaceWithData:
50
+ case RequestType.PostWithArgs:
51
+ case RequestType.PostWithArgsAndData:
52
+ case RequestType.PostWithArgsInBody:
53
+ case RequestType.PostWithArgsInQS:
54
+ case RequestType.PostWithArgsInQSAsVar:
55
+ case RequestType.PostWithArgsValueOnly:
56
+ return "POST";
57
+ default:
58
+ return "GET";
59
+ }
60
+ }
61
+ // The url of the method and parameters
62
+ get url() { return this.methodUrl; }
63
+ /*********************************************************************************************************************************/
64
+ // Private Variables
65
+ /*********************************************************************************************************************************/
66
+ get passDataInBody() { return this.methodInfo.requestType == RequestType.GetWithArgsInBody || this.methodInfo.requestType == RequestType.PostBodyNoArgs || this.methodInfo.requestType == RequestType.PostWithArgsInBody; }
67
+ get passDataInQS() { return this.methodInfo.requestType == RequestType.GetWithArgsInQS || this.methodInfo.requestType == RequestType.PostWithArgsInQS; }
68
+ get passDataInQSAsVar() { return this.methodInfo.requestType == RequestType.GetWithArgsInQSAsVar || this.methodInfo.requestType == RequestType.PostWithArgsInQSAsVar; }
69
+ get isTemplate() { return this.methodInfo.data ? true : false; }
70
+ get replace() { return this.methodInfo.requestType == RequestType.GetReplace || this.methodInfo.requestType == RequestType.GraphGetReplace || this.methodInfo.requestType == RequestType.PostReplace || this.methodInfo.requestType == RequestType.GraphPostReplace; }
122
71
  /*********************************************************************************************************************************/
123
72
  // Private Methods
124
73
  /*********************************************************************************************************************************/
125
74
  // Method to generate the method input parameters
126
- MethodInfo.prototype.generateParams = function () {
127
- var maxArgNames = 0;
128
- var params = {};
75
+ generateParams() {
76
+ let maxArgNames = 0;
77
+ let params = {};
129
78
  // Ensure values exist
130
79
  if (this.methodInfo.argValues == null) {
131
80
  return;
@@ -134,31 +83,31 @@ var MethodInfo = /** @class */ (function () {
134
83
  if (this.methodInfo.argNames) {
135
84
  // Set the max arguments
136
85
  maxArgNames = this.methodInfo.argNames.length -
137
- (this.methodInfo.requestType == _1.RequestType.PostWithArgsAndData || this.methodInfo.requestType == _1.RequestType.PostReplaceWithData ? 1 : 0);
86
+ (this.methodInfo.requestType == RequestType.PostWithArgsAndData || this.methodInfo.requestType == RequestType.PostReplaceWithData ? 1 : 0);
138
87
  // Parse the argument names
139
- for (var i = 0; i < maxArgNames && i < this.methodInfo.argValues.length; i++) {
140
- var name_1 = this.methodInfo.argNames[i];
141
- var value = this.methodInfo.argValues[i];
88
+ for (let i = 0; i < maxArgNames && i < this.methodInfo.argValues.length; i++) {
89
+ let name = this.methodInfo.argNames[i];
90
+ let value = this.methodInfo.argValues[i];
142
91
  // Copy the parameter value
143
92
  switch (typeof (this.methodInfo.argValues[i])) {
144
93
  case "boolean":
145
- params[name_1] = this.methodInfo.argValues[i] ? "true" : "false";
94
+ params[name] = this.methodInfo.argValues[i] ? "true" : "false";
146
95
  break;
147
96
  case "number":
148
- params[name_1] = this.methodInfo.argValues[i];
97
+ params[name] = this.methodInfo.argValues[i];
149
98
  break;
150
99
  //case "string":
151
100
  //params[name] = this.isTemplate || this.replace ? value : "'" + value + "'";
152
101
  //break;
153
102
  default:
154
- params[name_1] = value;
103
+ params[name] = value;
155
104
  break;
156
105
  }
157
106
  }
158
107
  }
159
108
  // See if the method has parameters
160
- var isEmpty = true;
161
- for (var k in params) {
109
+ let isEmpty = true;
110
+ for (let k in params) {
162
111
  isEmpty = false;
163
112
  break;
164
113
  }
@@ -173,13 +122,13 @@ var MethodInfo = /** @class */ (function () {
173
122
  this.methodInfo.data = JSON.stringify(this.methodInfo.data);
174
123
  }
175
124
  // Parse the arguments
176
- for (var key in this.methodParams) {
125
+ for (let key in this.methodParams) {
177
126
  // Replace the argument in the template
178
127
  this.methodInfo.data = this.methodInfo.data.replace("[[" + key + "]]", this.methodParams[key].replace(/"/g, '\\"').replace(/\n/g, ""));
179
128
  }
180
129
  // For custom format properties of fields, we need to escape \\quot;
181
130
  // Replace \\&quot; with \\\\&quot;
182
- var methodData = this.methodInfo.data.replace(/\\&quot;/g, '\\\\&quot;');
131
+ let methodData = this.methodInfo.data.replace(/\\&quot;/g, '\\\\&quot;');
183
132
  // Set the method data
184
133
  this.methodData = typeof (methodData) === "string" ? methodData : JSON.parse(methodData);
185
134
  }
@@ -187,7 +136,7 @@ var MethodInfo = /** @class */ (function () {
187
136
  // See if argument values exist
188
137
  if (this.methodInfo.argValues && this.methodInfo.argValues.length > 0) {
189
138
  // See if argument names exist
190
- if (this.methodInfo.argNames == null || this.methodInfo.requestType == _1.RequestType.PostBodyNoArgs) {
139
+ if (this.methodInfo.argNames == null || this.methodInfo.requestType == RequestType.PostBodyNoArgs) {
191
140
  // Set the method data to first argument value
192
141
  this.methodData = this.methodInfo.argValues[0];
193
142
  }
@@ -200,7 +149,7 @@ var MethodInfo = /** @class */ (function () {
200
149
  // See if the metadata type exists
201
150
  if (this.methodInfo.metadataType) {
202
151
  // See if parameters exist
203
- if (this.methodInfo.argNames && this.methodInfo.requestType != _1.RequestType.PostBodyNoArgs && typeof ((this.methodData || this.methodParams)[this.methodInfo.argNames[0]]) !== "string") {
152
+ if (this.methodInfo.argNames && this.methodInfo.requestType != RequestType.PostBodyNoArgs && typeof ((this.methodData || this.methodParams)[this.methodInfo.argNames[0]]) !== "string") {
204
153
  // Append the metadata to the first parameter, if it doesn't exist
205
154
  (this.methodData || this.methodParams)[this.methodInfo.argNames[0]]["__metadata"] =
206
155
  (this.methodData || this.methodParams)[this.methodInfo.argNames[0]]["__metadata"] || { "type": this.methodInfo.metadataType };
@@ -211,38 +160,38 @@ var MethodInfo = /** @class */ (function () {
211
160
  (this.methodData || this.methodParams)["__metadata"] || { "type": this.methodInfo.metadataType };
212
161
  }
213
162
  }
214
- };
163
+ }
215
164
  // Method to generate the method and parameters as a url
216
- MethodInfo.prototype.generateUrl = function () {
217
- var url = this.methodInfo.name;
165
+ generateUrl() {
166
+ let url = this.methodInfo.name;
218
167
  // See if we are deleting the object
219
- if (this.methodInfo.requestType == _1.RequestType.Delete) {
168
+ if (this.methodInfo.requestType == RequestType.Delete) {
220
169
  // Default the value
221
170
  url = "deleteObject";
222
171
  }
223
172
  // See if we are passing the data in the body
224
173
  if (this.passDataInBody) {
225
- var data = this.methodData || this.methodParams;
174
+ let data = this.methodData || this.methodParams;
226
175
  // Stringify the data to be passed in the body
227
176
  this.methodData = data ? (typeof (data) === "string" ? data : JSON.stringify(data)) : null;
228
177
  }
229
178
  // See if we are passing the data in the query string as a variable
230
179
  if (this.passDataInQSAsVar) {
231
- var data = this.methodParams || this.methodData;
180
+ let data = this.methodParams || this.methodData;
232
181
  // Append the parameters in the query string
233
182
  url += "(@v)?@v=" + (typeof (data) === "string" ? "'" + encodeURIComponent(data) + "'" : JSON.stringify(data));
234
183
  }
235
184
  // See if we are replacing the arguments
236
185
  if (this.replace) {
237
186
  // Parse the arguments
238
- for (var key in this.methodParams) {
187
+ for (let key in this.methodParams) {
239
188
  // Replace the argument in the url
240
189
  url = url.replace("[[" + key + "]]", encodeURIComponent(this.methodParams[key]));
241
190
  }
242
191
  }
243
192
  // Else, see if this is an odata request
244
- else if (this.methodInfo.requestType == _1.RequestType.OData) {
245
- var oData = new _1.OData(this.methodParams["oData"]);
193
+ else if (this.methodInfo.requestType == RequestType.OData) {
194
+ let oData = new OData(this.methodParams["oData"]);
246
195
  // Update the url
247
196
  url = "?" + oData.QueryString;
248
197
  // Set the get all items Flag
@@ -250,25 +199,25 @@ var MethodInfo = /** @class */ (function () {
250
199
  }
251
200
  // Else, see if we are not passing the data in the body or query string as a variable
252
201
  else if (!this.passDataInBody && !this.passDataInQSAsVar) {
253
- var params = "";
202
+ let params = "";
254
203
  // Ensure data exists
255
- var data = this.methodParams || this.methodData;
204
+ let data = this.methodParams || this.methodData;
256
205
  if (data) {
257
206
  // Ensure the data is an object
258
207
  data = data && typeof (data) === "object" ? data : { value: data };
259
208
  // Parse the parameters
260
- for (var name_2 in data) {
261
- var value = data[name_2];
209
+ for (let name in data) {
210
+ let value = data[name];
262
211
  value = typeof (value) === "string" ? "'" + value.replace(/'/g, "''") + "'" : value;
263
212
  switch (this.methodInfo.requestType) {
264
213
  // Append the value only
265
- case _1.RequestType.GetWithArgsValueOnly:
266
- case _1.RequestType.PostWithArgsValueOnly:
214
+ case RequestType.GetWithArgsValueOnly:
215
+ case RequestType.PostWithArgsValueOnly:
267
216
  params += value + ", ";
268
217
  break;
269
218
  // Append the parameter and value
270
219
  default:
271
- params += name_2 + "=" + value + ", ";
220
+ params += name + "=" + value + ", ";
272
221
  break;
273
222
  }
274
223
  }
@@ -285,7 +234,5 @@ var MethodInfo = /** @class */ (function () {
285
234
  }
286
235
  // Return the url
287
236
  return url;
288
- };
289
- return MethodInfo;
290
- }());
291
- exports.MethodInfo = MethodInfo;
237
+ }
238
+ }
@@ -1,15 +1,12 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OData = void 0;
4
1
  /**
5
2
  * OData
6
3
  */
7
- var OData = /** @class */ (function () {
4
+ export class OData {
8
5
  /*********************************************************************************************************************************/
9
6
  // Constructor
10
7
  /*********************************************************************************************************************************/
11
8
  // The class constructor
12
- function OData(oData) {
9
+ constructor(oData) {
13
10
  // Default the Variables
14
11
  this._custom = oData && oData.Custom ? oData.Custom : null;
15
12
  this._expand = oData && oData.Expand ? oData.Expand : [];
@@ -22,117 +19,70 @@ var OData = /** @class */ (function () {
22
19
  this._skipToken = oData && oData.SkipToken ? oData.SkipToken : null;
23
20
  this._top = oData && oData.Top ? oData.Top : null;
24
21
  }
25
- Object.defineProperty(OData.prototype, "Custom", {
26
- /*********************************************************************************************************************************/
27
- // Properties
28
- /*********************************************************************************************************************************/
29
- // Custom
30
- get: function () { return this._custom; },
31
- set: function (value) { this._custom = value; },
32
- enumerable: false,
33
- configurable: true
34
- });
35
- Object.defineProperty(OData.prototype, "Expand", {
36
- // Expand
37
- get: function () { return this._expand; },
38
- set: function (value) { this._expand = value; },
39
- enumerable: false,
40
- configurable: true
41
- });
42
- Object.defineProperty(OData.prototype, "Filter", {
43
- // Filter
44
- get: function () { return this._filter; },
45
- set: function (value) { this._filter = value; },
46
- enumerable: false,
47
- configurable: true
48
- });
49
- Object.defineProperty(OData.prototype, "GetAllItems", {
50
- // Flag to get all items
51
- get: function () { return this._getAllItems; },
52
- set: function (value) { this._getAllItems = value; },
53
- enumerable: false,
54
- configurable: true
55
- });
56
- Object.defineProperty(OData.prototype, "OrderBy", {
57
- // Order By
58
- get: function () { return this._orderBy; },
59
- set: function (value) { this._orderBy = value; },
60
- enumerable: false,
61
- configurable: true
62
- });
63
- Object.defineProperty(OData.prototype, "QueryString", {
64
- // Query String
65
- get: function () {
66
- var qs = "";
67
- var values = [];
68
- // Get the query string values for the properties
69
- values.push(this.getQSValue("$select", this._select));
70
- values.push(this.getQSValue("$orderby", this._orderBy));
71
- this._top ? values.push("$top=" + this._top) : null;
72
- this._skip ? values.push("$skip=" + this._skip) : null;
73
- this._skipToken ? values.push("$skipToken=" + encodeURIComponent("Paged=TRUE&p_ID=" + this._skipToken)) : null;
74
- this._filter ? values.push("$filter=" + this._filter) : null;
75
- this._search ? values.push("$search=" + this._search) : null;
76
- values.push(this.getQSValue("$expand", this._expand));
77
- this._custom ? values.push(this._custom) : null;
78
- // Parse the values
79
- for (var _i = 0, values_1 = values; _i < values_1.length; _i++) {
80
- var value = values_1[_i];
81
- // Ensure a value exists
82
- if (value && value != "") {
83
- // Append the query string value
84
- qs += (qs == "" ? "" : "&") + value;
85
- }
22
+ /*********************************************************************************************************************************/
23
+ // Properties
24
+ /*********************************************************************************************************************************/
25
+ // Custom
26
+ get Custom() { return this._custom; }
27
+ set Custom(value) { this._custom = value; }
28
+ // Expand
29
+ get Expand() { return this._expand; }
30
+ set Expand(value) { this._expand = value; }
31
+ // Filter
32
+ get Filter() { return this._filter; }
33
+ set Filter(value) { this._filter = value; }
34
+ // Flag to get all items
35
+ get GetAllItems() { return this._getAllItems; }
36
+ set GetAllItems(value) { this._getAllItems = value; }
37
+ // Order By
38
+ get OrderBy() { return this._orderBy; }
39
+ set OrderBy(value) { this._orderBy = value; }
40
+ // Query String
41
+ get QueryString() {
42
+ let qs = "";
43
+ let values = [];
44
+ // Get the query string values for the properties
45
+ values.push(this.getQSValue("$select", this._select));
46
+ values.push(this.getQSValue("$orderby", this._orderBy));
47
+ this._top ? values.push("$top=" + this._top) : null;
48
+ this._skip ? values.push("$skip=" + this._skip) : null;
49
+ this._skipToken ? values.push("$skipToken=" + encodeURIComponent("Paged=TRUE&p_ID=" + this._skipToken)) : null;
50
+ this._filter ? values.push("$filter=" + this._filter) : null;
51
+ this._search ? values.push("$search=" + this._search) : null;
52
+ values.push(this.getQSValue("$expand", this._expand));
53
+ this._custom ? values.push(this._custom) : null;
54
+ // Parse the values
55
+ for (let value of values) {
56
+ // Ensure a value exists
57
+ if (value && value != "") {
58
+ // Append the query string value
59
+ qs += (qs == "" ? "" : "&") + value;
86
60
  }
87
- // Return the query string
88
- return qs;
89
- },
90
- enumerable: false,
91
- configurable: true
92
- });
93
- Object.defineProperty(OData.prototype, "Search", {
94
- // Search
95
- get: function () { return this._search; },
96
- set: function (value) { this._search = value; },
97
- enumerable: false,
98
- configurable: true
99
- });
100
- Object.defineProperty(OData.prototype, "Select", {
101
- // Select
102
- get: function () { return this._select; },
103
- set: function (value) { this._select = value; },
104
- enumerable: false,
105
- configurable: true
106
- });
107
- Object.defineProperty(OData.prototype, "Skip", {
108
- // Skip
109
- get: function () { return this._skip; },
110
- set: function (value) { this._skip = value; },
111
- enumerable: false,
112
- configurable: true
113
- });
114
- Object.defineProperty(OData.prototype, "SkipToken", {
115
- // Skip Token
116
- get: function () { return this._skipToken; },
117
- set: function (value) { this._skipToken = value; },
118
- enumerable: false,
119
- configurable: true
120
- });
121
- Object.defineProperty(OData.prototype, "Top", {
122
- // Top
123
- get: function () { return this._top; },
124
- set: function (value) { this._top = value; },
125
- enumerable: false,
126
- configurable: true
127
- });
61
+ }
62
+ // Return the query string
63
+ return qs;
64
+ }
65
+ // Search
66
+ get Search() { return this._search; }
67
+ set Search(value) { this._search = value; }
68
+ // Select
69
+ get Select() { return this._select; }
70
+ set Select(value) { this._select = value; }
71
+ // Skip
72
+ get Skip() { return this._skip; }
73
+ set Skip(value) { this._skip = value; }
74
+ // Skip Token
75
+ get SkipToken() { return this._skipToken; }
76
+ set SkipToken(value) { this._skipToken = value; }
77
+ // Top
78
+ get Top() { return this._top; }
79
+ set Top(value) { this._top = value; }
128
80
  /*********************************************************************************************************************************/
129
81
  // Methods
130
82
  /*********************************************************************************************************************************/
131
83
  // Method to convert the array of strings to a query string value.
132
- OData.prototype.getQSValue = function (qsKey, keys) {
84
+ getQSValue(qsKey, keys) {
133
85
  // Return the query string
134
86
  return keys.length > 0 ? qsKey + "=" + keys.join(",") : "";
135
- };
136
- return OData;
137
- }());
138
- exports.OData = OData;
87
+ }
88
+ }