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.
- package/@types/utils/base.d.ts +0 -3
- package/build/helper/executor.js +10 -20
- package/build/helper/fieldSchemaXML.js +85 -89
- package/build/helper/index.js +12 -28
- package/build/helper/jslink.js +124 -128
- package/build/helper/listForm.js +109 -118
- package/build/helper/listFormField.js +62 -65
- package/build/helper/methods/addContentEditorWebPart.js +9 -17
- package/build/helper/methods/addPermissionLevel.js +12 -16
- package/build/helper/methods/addScriptEditorWebPart.js +9 -17
- package/build/helper/methods/copyPermissionLevel.js +22 -26
- package/build/helper/methods/createContentType.js +96 -19
- package/build/helper/methods/createDocSet.js +10 -14
- package/build/helper/methods/getCurrentTheme.js +26 -31
- package/build/helper/methods/hasPermissions.js +8 -13
- package/build/helper/methods/index.js +16 -32
- package/build/helper/methods/loadSPCore.js +13 -17
- package/build/helper/methods/parse.js +5 -9
- package/build/helper/methods/request.js +4 -8
- package/build/helper/methods/setContentTypeFields.js +71 -79
- package/build/helper/methods/setGroupOwner.js +6 -10
- package/build/helper/methods/setWebProperty.js +26 -30
- package/build/helper/methods/stringify.js +3 -7
- package/build/helper/methods/webWorker.js +40 -20
- package/build/helper/ribbonLink.js +10 -14
- package/build/helper/sbLink.js +11 -15
- package/build/helper/sp/calloutManager.js +22 -25
- package/build/helper/sp/index.js +13 -16
- package/build/helper/sp/modalDialog.js +32 -35
- package/build/helper/sp/notify.js +9 -12
- package/build/helper/sp/ribbon.js +1 -4
- package/build/helper/sp/sod.js +9 -18
- package/build/helper/sp/status.js +18 -21
- package/build/helper/spCfg.js +232 -259
- package/build/helper/spCfgTypes.js +2 -5
- package/build/helper/taxonomy.js +144 -182
- package/build/helper/webpart.js +110 -94
- package/build/index.js +6 -23
- package/build/lib/apps.js +4 -7
- package/build/lib/contextInfo.js +217 -781
- package/build/lib/directorySession.js +4 -7
- package/build/lib/graph.js +16 -19
- package/build/lib/groupService.js +4 -7
- package/build/lib/groupSiteManager.js +4 -7
- package/build/lib/hubSites.js +11 -25
- package/build/lib/hubSitesUtility.js +4 -7
- package/build/lib/index.js +27 -43
- package/build/lib/list.js +49 -53
- package/build/lib/navigation.js +4 -7
- package/build/lib/peopleManager.js +4 -7
- package/build/lib/peoplePicker.js +4 -7
- package/build/lib/profileLoader.js +4 -7
- package/build/lib/search.js +30 -33
- package/build/lib/sensitivityLabels.js +6 -9
- package/build/lib/site.js +20 -35
- package/build/lib/siteIconManager.js +4 -7
- package/build/lib/siteManager.js +4 -7
- package/build/lib/sitePages.js +37 -51
- package/build/lib/socialFeed.js +13 -16
- package/build/lib/themeManager.js +4 -7
- package/build/lib/userProfile.js +4 -7
- package/build/lib/utility.js +12 -17
- package/build/lib/web.js +34 -49
- package/build/lib/webTemplateExtensions.js +4 -7
- package/build/lib/wfInstanceService.js +4 -7
- package/build/lib/wfSubscriptionService.js +4 -7
- package/build/mapper/custom/audit.js +3 -6
- package/build/mapper/custom/graph.js +13 -16
- package/build/mapper/custom/index.js +8 -24
- package/build/mapper/custom/odata.js +3 -6
- package/build/mapper/custom/old.js +42 -45
- package/build/mapper/custom/peoplePicker.js +4 -7
- package/build/mapper/custom/propertyValues.js +3 -6
- package/build/mapper/custom/utility.js +17 -20
- package/build/mapper/custom/webTemplateExtensions.js +19 -22
- package/build/mapper/def.js +1032 -989
- package/build/mapper/index.js +4 -9
- package/build/mapper/v2.js +2629 -2632
- package/build/rest.js +16 -19
- package/build/sptypes/graphtypes.js +694 -710
- package/build/sptypes/index.js +3 -7
- package/build/sptypes/sptypes.js +49 -52
- package/build/utils/base.js +20 -37
- package/build/utils/batch.js +53 -63
- package/build/utils/helper.js +79 -83
- package/build/utils/index.js +9 -25
- package/build/utils/methodInfo.js +88 -141
- package/build/utils/oData.js +62 -112
- package/build/utils/request.js +137 -155
- package/build/utils/requestType.js +1 -4
- package/build/utils/targetInfo.js +39 -52
- package/build/utils/xhrRequest.js +59 -107
- package/build/v2/drive.js +9 -13
- package/build/v2/drives.js +8 -12
- package/build/v2/index.js +3 -19
- package/build/v2/sites.js +61 -65
- package/dist/gd-sprest.d.ts +0 -3
- package/dist/gd-sprest.js +1 -1
- package/dist/gd-sprest.min.js +1 -1
- package/package.json +2 -2
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
6
|
+
export class MethodInfo {
|
|
10
7
|
/*********************************************************************************************************************************/
|
|
11
8
|
// Constructor
|
|
12
9
|
/*********************************************************************************************************************************/
|
|
13
|
-
|
|
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
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
return
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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
|
-
|
|
127
|
-
|
|
128
|
-
|
|
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 ==
|
|
86
|
+
(this.methodInfo.requestType == RequestType.PostWithArgsAndData || this.methodInfo.requestType == RequestType.PostReplaceWithData ? 1 : 0);
|
|
138
87
|
// Parse the argument names
|
|
139
|
-
for (
|
|
140
|
-
|
|
141
|
-
|
|
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[
|
|
94
|
+
params[name] = this.methodInfo.argValues[i] ? "true" : "false";
|
|
146
95
|
break;
|
|
147
96
|
case "number":
|
|
148
|
-
params[
|
|
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[
|
|
103
|
+
params[name] = value;
|
|
155
104
|
break;
|
|
156
105
|
}
|
|
157
106
|
}
|
|
158
107
|
}
|
|
159
108
|
// See if the method has parameters
|
|
160
|
-
|
|
161
|
-
for (
|
|
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 (
|
|
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 \\" with \\\\"
|
|
182
|
-
|
|
131
|
+
let methodData = this.methodInfo.data.replace(/\\"/g, '\\\\"');
|
|
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 ==
|
|
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 !=
|
|
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
|
-
|
|
217
|
-
|
|
165
|
+
generateUrl() {
|
|
166
|
+
let url = this.methodInfo.name;
|
|
218
167
|
// See if we are deleting the object
|
|
219
|
-
if (this.methodInfo.requestType ==
|
|
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
|
-
|
|
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
|
-
|
|
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 (
|
|
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 ==
|
|
245
|
-
|
|
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
|
-
|
|
202
|
+
let params = "";
|
|
254
203
|
// Ensure data exists
|
|
255
|
-
|
|
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 (
|
|
261
|
-
|
|
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
|
|
266
|
-
case
|
|
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 +=
|
|
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
|
-
|
|
290
|
-
}());
|
|
291
|
-
exports.MethodInfo = MethodInfo;
|
|
237
|
+
}
|
|
238
|
+
}
|
package/build/utils/oData.js
CHANGED
|
@@ -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
|
-
|
|
4
|
+
export class OData {
|
|
8
5
|
/*********************************************************************************************************************************/
|
|
9
6
|
// Constructor
|
|
10
7
|
/*********************************************************************************************************************************/
|
|
11
8
|
// The class constructor
|
|
12
|
-
|
|
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
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
//
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
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
|
-
|
|
84
|
+
getQSValue(qsKey, keys) {
|
|
133
85
|
// Return the query string
|
|
134
86
|
return keys.length > 0 ? qsKey + "=" + keys.join(",") : "";
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
}());
|
|
138
|
-
exports.OData = OData;
|
|
87
|
+
}
|
|
88
|
+
}
|