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
package/build/v2/sites.js CHANGED
@@ -1,24 +1,20 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sites = void 0;
4
- var contextInfo_1 = require("../lib/contextInfo");
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
- exports.sites = (function (props) {
9
+ export const sites = ((props = {}) => {
13
10
  var _a;
14
- if (props === void 0) { props = {}; }
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 = utils_1.RequestType.GraphGet;
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) || contextInfo_1.ContextInfo.webServerRelativeUrl;
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
- utils_1.Request.addMethods(sites, { __metadata: { type: "@odata.context/_api/v2.0/$metadata#site" } });
30
+ Request.addMethods(sites, { __metadata: { type: "@odata.context/_api/v2.0/$metadata#site" } });
35
31
  }
36
32
  else {
37
- utils_1.Request.addMethods(sites, { __metadata: { type: "@odata.context/_api/v2.0/$metadata#sites" } });
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
- exports.sites.getCurrent = function () {
44
- return (0, exports.sites)({
45
- siteId: contextInfo_1.ContextInfo.siteId,
46
- webId: contextInfo_1.ContextInfo.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
- exports.sites.getDrive = function (props) {
46
+ sites.getDrive = (props) => {
51
47
  // Return a promise
52
- return new Promise(function (resolve, reject) {
48
+ return new Promise((resolve, reject) => {
53
49
  // Method to get the drive id
54
- var getDriveId = function (siteId, webId, libName) {
50
+ let getDriveId = (siteId, webId, libName) => {
55
51
  // Return a promise
56
- return new Promise(function (resolve, reject) {
52
+ return new Promise((resolve, reject) => {
57
53
  // Get the drives
58
- (0, exports.sites)({ siteId: siteId, webId: webId }).drives().query({ Select: ["id", "name"] }).execute(function (drives) {
54
+ sites({ siteId, webId }).drives().query({ Select: ["id", "name"] }).execute(drives => {
59
55
  // Parse the drives
60
- for (var i = 0; i < drives.results.length; i++) {
61
- var drive = drives.results[i];
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(function (driveId) {
73
+ getDriveId(props.siteId, props.webId, props.listName).then(driveId => {
78
74
  // Resolve the request
79
- resolve((0, exports.sites)({ siteId: props.siteId }).drives(driveId));
75
+ resolve(sites({ siteId: props.siteId }).drives(driveId));
80
76
  }, reject);
81
77
  }
82
78
  else {
83
79
  // Get the site/web ids
84
- exports.sites.getIdByUrl(props.siteUrl).then(function (info) {
80
+ sites.getIdByUrl(props.siteUrl).then(info => {
85
81
  // Get the drive id
86
- getDriveId(info.siteId, info.webId, props.listName).then(function (driveId) {
82
+ getDriveId(info.siteId, info.webId, props.listName).then(driveId => {
87
83
  // Resolve the request
88
- resolve((0, exports.sites)({ siteId: info.siteId, webId: info.webId }).drives(driveId));
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
- exports.sites.getFile = function (props) {
91
+ sites.getFile = (props) => {
96
92
  // Return a promise
97
- return new Promise(function (resolve, reject) {
93
+ return new Promise((resolve, reject) => {
98
94
  // Get the site/web info
99
- exports.sites.getIdByUrl(props.fileUrl).then(function (info) {
95
+ sites.getIdByUrl(props.fileUrl).then(info => {
100
96
  // Get the file
101
- (0, web_1.Web)(info.webUrl, { requestDigest: info.digestValue }).getFileByUrl(props.fileUrl).execute(function (file) {
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
- exports.sites.getDrive({
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(function (drive) {
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(function (item) {
113
+ file.ListItemAllFields().query({ Expand: ["ParentList"], Select: ["ParentList/Title"] }).execute(item => {
118
114
  // Get the drive
119
- exports.sites.getDrive({
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(function (drive) {
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
- exports.sites.getList = function (props) {
131
+ sites.getList = (props) => {
136
132
  // Finds the list
137
- var findList = function (siteId, webId, listName) {
133
+ let findList = (siteId, webId, listName) => {
138
134
  // Return a promise
139
- return new Promise(function (resolve, reject) {
140
- (0, exports.sites)({ siteId: siteId, webId: webId }).lists().query({
135
+ return new Promise((resolve, reject) => {
136
+ sites({ siteId, webId }).lists().query({
141
137
  Filter: "displayName eq '" + listName + "'",
142
138
  Select: ["id"]
143
- }).execute(function (sites) {
139
+ }).execute(sites => {
144
140
  // See if the list id exists
145
- var list = sites.results[0];
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(function (resolve, reject) {
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((0, exports.sites)({ siteId: props.siteId, webId: props.webId }).lists(props.listId));
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(function (listId) {
164
+ findList(props.siteId, props.webId, props.listName).then(listId => {
169
165
  // Resolve the request
170
- resolve((0, exports.sites)({ siteId: props.siteId, webId: props.webId }).lists(listId));
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
- exports.sites.getIdByUrl(props.siteUrl).then(function (info) {
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((0, exports.sites)({ siteId: info.siteId, webId: info.webId }).lists(props.listId));
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(function (listId) {
180
+ findList(info.siteId, info.webId, props.listName).then(listId => {
185
181
  // Resolve the request
186
- resolve((0, exports.sites)({ siteId: info.siteId, webId: info.webId }).lists(listId));
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
- exports.sites.getIdByUrl = function (url) {
190
+ sites.getIdByUrl = (url) => {
195
191
  // Return a promise
196
- return new Promise(function (resolve, reject) {
192
+ return new Promise((resolve, reject) => {
197
193
  // Get the context information
198
- contextInfo_1.ContextInfo.getWeb(url).execute(function (context) {
194
+ ContextInfo.getWeb(url).execute(context => {
199
195
  // Get the site id
200
- (0, site_1.Site)(context.GetContextWebInformation.SiteFullUrl).query({ Select: ["Id"] }).execute(function (site) {
196
+ Site(context.GetContextWebInformation.SiteFullUrl).query({ Select: ["Id"] }).execute(site => {
201
197
  // Get the web id
202
- (0, web_1.Web)(context.GetContextWebInformation.WebFullUrl).query({ Select: ["Id"] }).execute(function (web) {
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
- exports.sites.getRoot = function () {
218
- return (0, exports.sites)({
219
- siteId: contextInfo_1.ContextInfo.siteId
213
+ sites.getRoot = () => {
214
+ return sites({
215
+ siteId: ContextInfo.siteId
220
216
  });
221
217
  };
222
218
  /** Returns a site by url */
223
- exports.sites.getSite = function (url) {
219
+ sites.getSite = (url) => {
224
220
  // Return a promise
225
- return new Promise(function (resolve, reject) {
221
+ return new Promise((resolve, reject) => {
226
222
  // Get the site info
227
- exports.sites.getIdByUrl(url).then(function (info) {
223
+ sites.getIdByUrl(url).then(info => {
228
224
  // Resolve the request
229
- resolve((0, exports.sites)({
225
+ resolve(sites({
230
226
  siteId: info.siteId,
231
227
  webId: info.webId
232
228
  }));
@@ -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