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
package/build/v2/sites.js
CHANGED
|
@@ -1,24 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var site_1 = require("../lib/site");
|
|
6
|
-
var web_1 = require("../lib/web");
|
|
7
|
-
var utils_1 = require("../utils");
|
|
1
|
+
import { ContextInfo } from "../lib/contextInfo";
|
|
2
|
+
import { Site } from "../lib/site";
|
|
3
|
+
import { Web } from "../lib/web";
|
|
4
|
+
import { Base, Request, RequestType } from "../utils";
|
|
8
5
|
/**
|
|
9
6
|
* Sites
|
|
10
7
|
* The sites graph endpoint.
|
|
11
8
|
*/
|
|
12
|
-
|
|
9
|
+
export const sites = ((props = {}) => {
|
|
13
10
|
var _a;
|
|
14
|
-
|
|
15
|
-
var sites = new utils_1.Base(props.targetInfo);
|
|
11
|
+
let sites = new Base(props.targetInfo);
|
|
16
12
|
// Default the properties
|
|
17
13
|
sites.targetInfo.defaultToWebFl = true;
|
|
18
14
|
sites.targetInfo.endpoint = "_api/v2.0/sites";
|
|
19
|
-
sites.targetInfo.requestType =
|
|
15
|
+
sites.targetInfo.requestType = RequestType.GraphGet;
|
|
20
16
|
// Default the url
|
|
21
|
-
sites.targetInfo.url = ((_a = props === null || props === void 0 ? void 0 : props.targetInfo) === null || _a === void 0 ? void 0 : _a.url) ||
|
|
17
|
+
sites.targetInfo.url = ((_a = props === null || props === void 0 ? void 0 : props.targetInfo) === null || _a === void 0 ? void 0 : _a.url) || ContextInfo.webServerRelativeUrl;
|
|
22
18
|
// See if the site id was provided
|
|
23
19
|
if (props.siteId) {
|
|
24
20
|
// Append the site id
|
|
@@ -31,34 +27,34 @@ exports.sites = (function (props) {
|
|
|
31
27
|
}
|
|
32
28
|
// Add the methods
|
|
33
29
|
if (props.siteId || props.webId) {
|
|
34
|
-
|
|
30
|
+
Request.addMethods(sites, { __metadata: { type: "@odata.context/_api/v2.0/$metadata#site" } });
|
|
35
31
|
}
|
|
36
32
|
else {
|
|
37
|
-
|
|
33
|
+
Request.addMethods(sites, { __metadata: { type: "@odata.context/_api/v2.0/$metadata#sites" } });
|
|
38
34
|
}
|
|
39
35
|
// Return the sites
|
|
40
36
|
return sites;
|
|
41
37
|
});
|
|
42
38
|
/** Returns the current site. */
|
|
43
|
-
|
|
44
|
-
return
|
|
45
|
-
siteId:
|
|
46
|
-
webId:
|
|
39
|
+
sites.getCurrent = () => {
|
|
40
|
+
return sites({
|
|
41
|
+
siteId: ContextInfo.siteId,
|
|
42
|
+
webId: ContextInfo.webId
|
|
47
43
|
});
|
|
48
44
|
};
|
|
49
45
|
/** Returns a drive */
|
|
50
|
-
|
|
46
|
+
sites.getDrive = (props) => {
|
|
51
47
|
// Return a promise
|
|
52
|
-
return new Promise(
|
|
48
|
+
return new Promise((resolve, reject) => {
|
|
53
49
|
// Method to get the drive id
|
|
54
|
-
|
|
50
|
+
let getDriveId = (siteId, webId, libName) => {
|
|
55
51
|
// Return a promise
|
|
56
|
-
return new Promise(
|
|
52
|
+
return new Promise((resolve, reject) => {
|
|
57
53
|
// Get the drives
|
|
58
|
-
|
|
54
|
+
sites({ siteId, webId }).drives().query({ Select: ["id", "name"] }).execute(drives => {
|
|
59
55
|
// Parse the drives
|
|
60
|
-
for (
|
|
61
|
-
|
|
56
|
+
for (let i = 0; i < drives.results.length; i++) {
|
|
57
|
+
let drive = drives.results[i];
|
|
62
58
|
// See if this is the target library
|
|
63
59
|
if (drive["name"].toLowerCase() == libName.toLowerCase()) {
|
|
64
60
|
// Resolve the request
|
|
@@ -74,54 +70,54 @@ exports.sites.getDrive = function (props) {
|
|
|
74
70
|
// See if the site id exists
|
|
75
71
|
if (props.siteId) {
|
|
76
72
|
// Get the drive id
|
|
77
|
-
getDriveId(props.siteId, props.webId, props.listName).then(
|
|
73
|
+
getDriveId(props.siteId, props.webId, props.listName).then(driveId => {
|
|
78
74
|
// Resolve the request
|
|
79
|
-
resolve(
|
|
75
|
+
resolve(sites({ siteId: props.siteId }).drives(driveId));
|
|
80
76
|
}, reject);
|
|
81
77
|
}
|
|
82
78
|
else {
|
|
83
79
|
// Get the site/web ids
|
|
84
|
-
|
|
80
|
+
sites.getIdByUrl(props.siteUrl).then(info => {
|
|
85
81
|
// Get the drive id
|
|
86
|
-
getDriveId(info.siteId, info.webId, props.listName).then(
|
|
82
|
+
getDriveId(info.siteId, info.webId, props.listName).then(driveId => {
|
|
87
83
|
// Resolve the request
|
|
88
|
-
resolve(
|
|
84
|
+
resolve(sites({ siteId: info.siteId, webId: info.webId }).drives(driveId));
|
|
89
85
|
}, reject);
|
|
90
86
|
}, reject);
|
|
91
87
|
}
|
|
92
88
|
});
|
|
93
89
|
};
|
|
94
90
|
/** Returns a file */
|
|
95
|
-
|
|
91
|
+
sites.getFile = (props) => {
|
|
96
92
|
// Return a promise
|
|
97
|
-
return new Promise(
|
|
93
|
+
return new Promise((resolve, reject) => {
|
|
98
94
|
// Get the site/web info
|
|
99
|
-
|
|
95
|
+
sites.getIdByUrl(props.fileUrl).then(info => {
|
|
100
96
|
// Get the file
|
|
101
|
-
|
|
97
|
+
Web(info.webUrl, { requestDigest: info.digestValue }).getFileByUrl(props.fileUrl).execute(file => {
|
|
102
98
|
// See if the library was provided
|
|
103
99
|
if (props.listName) {
|
|
104
100
|
// Get the drive
|
|
105
|
-
|
|
101
|
+
sites.getDrive({
|
|
106
102
|
listName: props.listName,
|
|
107
103
|
siteId: info.siteId,
|
|
108
104
|
siteUrl: info.siteUrl,
|
|
109
105
|
webId: info.webId
|
|
110
|
-
}).then(
|
|
106
|
+
}).then(drive => {
|
|
111
107
|
// Resolve the request
|
|
112
108
|
resolve(drive.items(file.UniqueId));
|
|
113
109
|
}, reject);
|
|
114
110
|
}
|
|
115
111
|
else {
|
|
116
112
|
// Get the list information
|
|
117
|
-
file.ListItemAllFields().query({ Expand: ["ParentList"], Select: ["ParentList/Title"] }).execute(
|
|
113
|
+
file.ListItemAllFields().query({ Expand: ["ParentList"], Select: ["ParentList/Title"] }).execute(item => {
|
|
118
114
|
// Get the drive
|
|
119
|
-
|
|
115
|
+
sites.getDrive({
|
|
120
116
|
listName: item.ParentList.Title,
|
|
121
117
|
siteId: info.siteId,
|
|
122
118
|
siteUrl: info.siteUrl,
|
|
123
119
|
webId: info.webId
|
|
124
|
-
}).then(
|
|
120
|
+
}).then(drive => {
|
|
125
121
|
// Resolve the request
|
|
126
122
|
resolve(drive.items(file.UniqueId));
|
|
127
123
|
}, reject);
|
|
@@ -132,17 +128,17 @@ exports.sites.getFile = function (props) {
|
|
|
132
128
|
});
|
|
133
129
|
};
|
|
134
130
|
/** Returns a list */
|
|
135
|
-
|
|
131
|
+
sites.getList = (props) => {
|
|
136
132
|
// Finds the list
|
|
137
|
-
|
|
133
|
+
let findList = (siteId, webId, listName) => {
|
|
138
134
|
// Return a promise
|
|
139
|
-
return new Promise(
|
|
140
|
-
|
|
135
|
+
return new Promise((resolve, reject) => {
|
|
136
|
+
sites({ siteId, webId }).lists().query({
|
|
141
137
|
Filter: "displayName eq '" + listName + "'",
|
|
142
138
|
Select: ["id"]
|
|
143
|
-
}).execute(
|
|
139
|
+
}).execute(sites => {
|
|
144
140
|
// See if the list id exists
|
|
145
|
-
|
|
141
|
+
let list = sites.results[0];
|
|
146
142
|
if (list === null || list === void 0 ? void 0 : list.id) {
|
|
147
143
|
// Resolve the request
|
|
148
144
|
resolve(list === null || list === void 0 ? void 0 : list.id);
|
|
@@ -155,35 +151,35 @@ exports.sites.getList = function (props) {
|
|
|
155
151
|
});
|
|
156
152
|
};
|
|
157
153
|
// Return a promise
|
|
158
|
-
return new Promise(
|
|
154
|
+
return new Promise((resolve, reject) => {
|
|
159
155
|
// See if the site id exists
|
|
160
156
|
if (props.siteId) {
|
|
161
157
|
// See if the id was given
|
|
162
158
|
if (props.listId) {
|
|
163
159
|
// Resolve the request
|
|
164
|
-
resolve(
|
|
160
|
+
resolve(sites({ siteId: props.siteId, webId: props.webId }).lists(props.listId));
|
|
165
161
|
}
|
|
166
162
|
else {
|
|
167
163
|
// Find the list
|
|
168
|
-
findList(props.siteId, props.webId, props.listName).then(
|
|
164
|
+
findList(props.siteId, props.webId, props.listName).then(listId => {
|
|
169
165
|
// Resolve the request
|
|
170
|
-
resolve(
|
|
166
|
+
resolve(sites({ siteId: props.siteId, webId: props.webId }).lists(listId));
|
|
171
167
|
}, reject);
|
|
172
168
|
}
|
|
173
169
|
}
|
|
174
170
|
else {
|
|
175
171
|
// Get the ids
|
|
176
|
-
|
|
172
|
+
sites.getIdByUrl(props.siteUrl).then(info => {
|
|
177
173
|
// See if the id was given
|
|
178
174
|
if (props.listId) {
|
|
179
175
|
// Resolve the request
|
|
180
|
-
resolve(
|
|
176
|
+
resolve(sites({ siteId: info.siteId, webId: info.webId }).lists(props.listId));
|
|
181
177
|
}
|
|
182
178
|
else {
|
|
183
179
|
// Find the list
|
|
184
|
-
findList(info.siteId, info.webId, props.listName).then(
|
|
180
|
+
findList(info.siteId, info.webId, props.listName).then(listId => {
|
|
185
181
|
// Resolve the request
|
|
186
|
-
resolve(
|
|
182
|
+
resolve(sites({ siteId: info.siteId, webId: info.webId }).lists(listId));
|
|
187
183
|
}, reject);
|
|
188
184
|
}
|
|
189
185
|
}, reject);
|
|
@@ -191,15 +187,15 @@ exports.sites.getList = function (props) {
|
|
|
191
187
|
});
|
|
192
188
|
};
|
|
193
189
|
/** Gets the site and web id from a url */
|
|
194
|
-
|
|
190
|
+
sites.getIdByUrl = (url) => {
|
|
195
191
|
// Return a promise
|
|
196
|
-
return new Promise(
|
|
192
|
+
return new Promise((resolve, reject) => {
|
|
197
193
|
// Get the context information
|
|
198
|
-
|
|
194
|
+
ContextInfo.getWeb(url).execute(context => {
|
|
199
195
|
// Get the site id
|
|
200
|
-
|
|
196
|
+
Site(context.GetContextWebInformation.SiteFullUrl).query({ Select: ["Id"] }).execute(site => {
|
|
201
197
|
// Get the web id
|
|
202
|
-
|
|
198
|
+
Web(context.GetContextWebInformation.WebFullUrl).query({ Select: ["Id"] }).execute(web => {
|
|
203
199
|
// Resolve the request
|
|
204
200
|
resolve({
|
|
205
201
|
digestValue: context.GetContextWebInformation.FormDigestValue,
|
|
@@ -214,19 +210,19 @@ exports.sites.getIdByUrl = function (url) {
|
|
|
214
210
|
});
|
|
215
211
|
};
|
|
216
212
|
/** Returns the root site of the current site. */
|
|
217
|
-
|
|
218
|
-
return
|
|
219
|
-
siteId:
|
|
213
|
+
sites.getRoot = () => {
|
|
214
|
+
return sites({
|
|
215
|
+
siteId: ContextInfo.siteId
|
|
220
216
|
});
|
|
221
217
|
};
|
|
222
218
|
/** Returns a site by url */
|
|
223
|
-
|
|
219
|
+
sites.getSite = (url) => {
|
|
224
220
|
// Return a promise
|
|
225
|
-
return new Promise(
|
|
221
|
+
return new Promise((resolve, reject) => {
|
|
226
222
|
// Get the site info
|
|
227
|
-
|
|
223
|
+
sites.getIdByUrl(url).then(info => {
|
|
228
224
|
// Resolve the request
|
|
229
|
-
resolve(
|
|
225
|
+
resolve(sites({
|
|
230
226
|
siteId: info.siteId,
|
|
231
227
|
webId: info.webId
|
|
232
228
|
}));
|
package/dist/gd-sprest.d.ts
CHANGED
|
@@ -7457,9 +7457,6 @@ declare module 'gd-sprest/utils/base' {
|
|
|
7457
7457
|
/** Gets the property. */
|
|
7458
7458
|
getProperty(propertyName: string, requestType?: string);
|
|
7459
7459
|
|
|
7460
|
-
/** Stops any requests for a batch or query. */
|
|
7461
|
-
stop();
|
|
7462
|
-
|
|
7463
7460
|
/** Updates the metdata uri. */
|
|
7464
7461
|
updateMetadataUri(metadata, targetInfo: ITargetInfoProps);
|
|
7465
7462
|
|