@lindle/sharepoint_requests 0.1.10 → 0.1.12
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/dist/index.d.ts +4 -2
- package/dist/root/index.d.ts +159 -2
- package/dist/root/instance.d.ts +2 -2
- package/dist/sharepoint_requests.cjs.development.js +249 -49
- package/dist/sharepoint_requests.cjs.development.js.map +1 -1
- package/dist/sharepoint_requests.cjs.production.min.js +1 -1
- package/dist/sharepoint_requests.cjs.production.min.js.map +1 -1
- package/dist/sharepoint_requests.esm.js +248 -49
- package/dist/sharepoint_requests.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +37 -28
- package/src/root/index.ts +169 -8
- package/src/root/instance.ts +22 -13
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import axios from 'axios';
|
|
1
|
+
import axios, { AxiosHeaders } from 'axios';
|
|
2
2
|
|
|
3
3
|
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
4
4
|
try {
|
|
@@ -143,32 +143,49 @@ function _regeneratorDefine(e, r, n, t) {
|
|
|
143
143
|
}, _regeneratorDefine(e, r, n, t);
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
+
var defaultConfig = {
|
|
147
|
+
headers: {
|
|
148
|
+
Accept: 'application/json; odata=verbose',
|
|
149
|
+
'Content-Type': 'application/json; odata=verbose'
|
|
150
|
+
},
|
|
151
|
+
timeout: 15000,
|
|
152
|
+
withCredentials: true
|
|
153
|
+
};
|
|
146
154
|
var instance = function instance(baseURL, config) {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
timeout: 1000,
|
|
154
|
-
withCredentials: true
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
return axios.create(_extends({
|
|
158
|
-
baseURL: baseURL
|
|
159
|
-
}, config));
|
|
155
|
+
var _config$headers;
|
|
156
|
+
var userHeaders = (config == null ? void 0 : config.headers) instanceof AxiosHeaders ? config.headers.toJSON() : (_config$headers = config == null ? void 0 : config.headers) != null ? _config$headers : {};
|
|
157
|
+
return axios.create(_extends({}, defaultConfig, config, {
|
|
158
|
+
baseURL: baseURL,
|
|
159
|
+
headers: _extends({}, defaultConfig.headers, userHeaders)
|
|
160
|
+
}));
|
|
160
161
|
};
|
|
161
162
|
|
|
162
163
|
var HTTPSharePointRequests = /*#__PURE__*/function () {
|
|
163
|
-
|
|
164
|
+
/**
|
|
165
|
+
* Creates an HTTP SharePoint requester bound to the provided base URL.
|
|
166
|
+
*
|
|
167
|
+
* @param baseURL The root SharePoint site URL (with or without trailing slash).
|
|
168
|
+
* @param config Optional axios configuration overrides.
|
|
169
|
+
*/
|
|
170
|
+
function HTTPSharePointRequests(baseURL, config) {
|
|
164
171
|
var _this = this;
|
|
165
172
|
this.lists = {
|
|
173
|
+
/**
|
|
174
|
+
* Fetches all SharePoint lists available to the current site.
|
|
175
|
+
*
|
|
176
|
+
* @returns Promise resolving to the list collection response payload.
|
|
177
|
+
*/
|
|
166
178
|
get: function get() {
|
|
167
179
|
_this.endpoint = '_api/web/lists';
|
|
168
180
|
return _this.get_v2();
|
|
169
181
|
}
|
|
170
182
|
};
|
|
171
183
|
this.folders = {
|
|
184
|
+
/**
|
|
185
|
+
* Retrieves SharePoint folders from the default folders endpoint.
|
|
186
|
+
*
|
|
187
|
+
* @returns A promise resolving with folder metadata.
|
|
188
|
+
*/
|
|
172
189
|
get: function get() {
|
|
173
190
|
_this.endpoint = '_api/web/folders';
|
|
174
191
|
_this.get_v2();
|
|
@@ -204,6 +221,11 @@ var HTTPSharePointRequests = /*#__PURE__*/function () {
|
|
|
204
221
|
}
|
|
205
222
|
};
|
|
206
223
|
this.user = {
|
|
224
|
+
/**
|
|
225
|
+
* Provides accessors for the current user's profile information.
|
|
226
|
+
*
|
|
227
|
+
* @returns Helper exposing a `get` function to retrieve profile details.
|
|
228
|
+
*/
|
|
207
229
|
properties: function properties() {
|
|
208
230
|
return {
|
|
209
231
|
get: function get() {
|
|
@@ -211,12 +233,30 @@ var HTTPSharePointRequests = /*#__PURE__*/function () {
|
|
|
211
233
|
}
|
|
212
234
|
};
|
|
213
235
|
},
|
|
236
|
+
/**
|
|
237
|
+
* Searches across site users and their groups.
|
|
238
|
+
*
|
|
239
|
+
* @param searchValue Query string to match site users.
|
|
240
|
+
* @returns Promise resolving to matching site users.
|
|
241
|
+
*/
|
|
214
242
|
searchSiteUser: function searchSiteUser(searchValue) {
|
|
215
243
|
return _this.getSiteUser(searchValue);
|
|
216
244
|
},
|
|
245
|
+
/**
|
|
246
|
+
* Performs a people-picker search scoped to the current site collection.
|
|
247
|
+
*
|
|
248
|
+
* @param input Search prefix.
|
|
249
|
+
* @param filter Optional additional filter condition.
|
|
250
|
+
* @returns Promise with type-ahead person results.
|
|
251
|
+
*/
|
|
217
252
|
searchUser: function searchUser(input, filter) {
|
|
218
253
|
return _this.typeAhead(input, filter);
|
|
219
254
|
},
|
|
255
|
+
/**
|
|
256
|
+
* Fetches the currently authenticated SharePoint user.
|
|
257
|
+
*
|
|
258
|
+
* @returns Helper exposing `get` that resolves to the current user payload.
|
|
259
|
+
*/
|
|
220
260
|
current: function current() {
|
|
221
261
|
_this.endpoint = '_api/web/currentUser';
|
|
222
262
|
return {
|
|
@@ -225,6 +265,11 @@ var HTTPSharePointRequests = /*#__PURE__*/function () {
|
|
|
225
265
|
}
|
|
226
266
|
};
|
|
227
267
|
},
|
|
268
|
+
/**
|
|
269
|
+
* Retrieves calculated permission level for the current user.
|
|
270
|
+
*
|
|
271
|
+
* @returns Helper exposing `get` resolving to the user's permission definition.
|
|
272
|
+
*/
|
|
228
273
|
currentPermission: function currentPermission() {
|
|
229
274
|
return {
|
|
230
275
|
get: function get() {
|
|
@@ -236,8 +281,14 @@ var HTTPSharePointRequests = /*#__PURE__*/function () {
|
|
|
236
281
|
this.baseURL = baseURL.endsWith('/') ? baseURL : baseURL + "/";
|
|
237
282
|
this.endpoint = '/api';
|
|
238
283
|
this.listName = '';
|
|
239
|
-
this.instance = instance(this.baseURL);
|
|
284
|
+
this.instance = instance(this.baseURL, config);
|
|
240
285
|
}
|
|
286
|
+
/**
|
|
287
|
+
* Converts array values in a payload to the `Collection(Edm.String)` structure
|
|
288
|
+
* expected by SharePoint REST endpoints.
|
|
289
|
+
*
|
|
290
|
+
* @param data The list item payload to harmonise in-place.
|
|
291
|
+
*/
|
|
241
292
|
var _proto = HTTPSharePointRequests.prototype;
|
|
242
293
|
_proto.transformArraysToEdmStrings = function transformArraysToEdmStrings(data) {
|
|
243
294
|
for (var key in data) {
|
|
@@ -258,7 +309,14 @@ var HTTPSharePointRequests = /*#__PURE__*/function () {
|
|
|
258
309
|
this.listName = listName;
|
|
259
310
|
this.endpoint = "_vti_bin/ListData.svc/" + listName;
|
|
260
311
|
return this;
|
|
261
|
-
}
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Selects a SharePoint list and exposes list-scoped CRUD helpers.
|
|
315
|
+
*
|
|
316
|
+
* @param listName Logical list key configured in the generic type map.
|
|
317
|
+
* @param sharepoint_ver SharePoint version used to choose the correct REST endpoint.
|
|
318
|
+
* @returns Chainable helpers bound to the selected list.
|
|
319
|
+
*/;
|
|
262
320
|
_proto.from = function from(listName, sharepoint_ver) {
|
|
263
321
|
var _this2 = this;
|
|
264
322
|
if (sharepoint_ver === void 0) {
|
|
@@ -292,7 +350,13 @@ var HTTPSharePointRequests = /*#__PURE__*/function () {
|
|
|
292
350
|
};
|
|
293
351
|
}
|
|
294
352
|
};
|
|
295
|
-
}
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Targets a SharePoint folder path and exposes file retrieval helpers.
|
|
356
|
+
*
|
|
357
|
+
* @param folderName Optional folder path relative to `Shared Documents`.
|
|
358
|
+
* @returns Helper exposing `get` to fetch files or sub-folders.
|
|
359
|
+
*/;
|
|
296
360
|
_proto.folder = function folder(folderName) {
|
|
297
361
|
var _this3 = this;
|
|
298
362
|
var filePath = ['Shared Documents'];
|
|
@@ -301,6 +365,12 @@ var HTTPSharePointRequests = /*#__PURE__*/function () {
|
|
|
301
365
|
}
|
|
302
366
|
this.endpoint = "_api/web/GetFolderByServerRelativeUrl('" + filePath.join('/') + "')";
|
|
303
367
|
return {
|
|
368
|
+
/**
|
|
369
|
+
* Fetches files or folders from the targeted path.
|
|
370
|
+
*
|
|
371
|
+
* @param options Optional REST query options to refine the result set.
|
|
372
|
+
* @returns Promise resolving to folder contents and metadata.
|
|
373
|
+
*/
|
|
304
374
|
get: function get(options) {
|
|
305
375
|
if (!(options != null && options.type)) {
|
|
306
376
|
_this3.endpoint += '/Files';
|
|
@@ -310,11 +380,22 @@ var HTTPSharePointRequests = /*#__PURE__*/function () {
|
|
|
310
380
|
return _this3.get_files(options);
|
|
311
381
|
}
|
|
312
382
|
};
|
|
313
|
-
}
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* Retrieves user list items and exposes a get helper with optional query parameters.
|
|
386
|
+
*
|
|
387
|
+
* @param options Optional REST query options.
|
|
388
|
+
* @returns Helper exposing `get` returning SharePoint user rows.
|
|
389
|
+
*/;
|
|
314
390
|
_proto.users = function users(options) {
|
|
315
391
|
var _this4 = this;
|
|
316
392
|
this.endpoint = '_api/web/SiteUserInfoList/items';
|
|
317
393
|
return {
|
|
394
|
+
/**
|
|
395
|
+
* Executes the user list request using the specified options.
|
|
396
|
+
*
|
|
397
|
+
* @returns Promise resolving to the SharePoint user list response.
|
|
398
|
+
*/
|
|
318
399
|
get: function get() {
|
|
319
400
|
return _this4.get_v2(options);
|
|
320
401
|
}
|
|
@@ -360,8 +441,17 @@ var HTTPSharePointRequests = /*#__PURE__*/function () {
|
|
|
360
441
|
return _getDigest.apply(this, arguments);
|
|
361
442
|
}
|
|
362
443
|
return getDigest;
|
|
363
|
-
}()
|
|
364
|
-
|
|
444
|
+
}()
|
|
445
|
+
/**
|
|
446
|
+
* Executes a GET request without additional metadata wrapping.
|
|
447
|
+
*
|
|
448
|
+
* @param options Optional REST query options.
|
|
449
|
+
* @returns SharePoint response payload or undefined when empty.
|
|
450
|
+
*/
|
|
451
|
+
;
|
|
452
|
+
_proto.get_only =
|
|
453
|
+
/*#__PURE__*/
|
|
454
|
+
function () {
|
|
365
455
|
var _get_only = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(options) {
|
|
366
456
|
var _ref, expand, orderBy, limit, filter, cols, skip, params, _yield$this$instance$, data;
|
|
367
457
|
return _regenerator().w(function (_context2) {
|
|
@@ -397,8 +487,17 @@ var HTTPSharePointRequests = /*#__PURE__*/function () {
|
|
|
397
487
|
return _get_only.apply(this, arguments);
|
|
398
488
|
}
|
|
399
489
|
return get_only;
|
|
400
|
-
}()
|
|
401
|
-
|
|
490
|
+
}()
|
|
491
|
+
/**
|
|
492
|
+
* Retrieves folder contents with optional filtering and returns the payload with metadata.
|
|
493
|
+
*
|
|
494
|
+
* @param options REST options describing expand/filter/order conditions.
|
|
495
|
+
* @returns Folder data and the fully resolved request URL.
|
|
496
|
+
*/
|
|
497
|
+
;
|
|
498
|
+
_proto.get_files =
|
|
499
|
+
/*#__PURE__*/
|
|
500
|
+
function () {
|
|
402
501
|
var _get_files = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(options) {
|
|
403
502
|
var _ref2, expand, orderBy, limit, filter, cols, skip, params, url, response, data, meta;
|
|
404
503
|
return _regenerator().w(function (_context3) {
|
|
@@ -444,8 +543,17 @@ var HTTPSharePointRequests = /*#__PURE__*/function () {
|
|
|
444
543
|
return _get_files.apply(this, arguments);
|
|
445
544
|
}
|
|
446
545
|
return get_files;
|
|
447
|
-
}()
|
|
448
|
-
|
|
546
|
+
}()
|
|
547
|
+
/**
|
|
548
|
+
* Performs a typed list read against the current endpoint.
|
|
549
|
+
*
|
|
550
|
+
* @param options Optional REST query options governing expand, filter, ordering and pagination.
|
|
551
|
+
* @returns SharePoint list items alongside the fully-resolved request URL.
|
|
552
|
+
*/
|
|
553
|
+
;
|
|
554
|
+
_proto.get_v2 =
|
|
555
|
+
/*#__PURE__*/
|
|
556
|
+
function () {
|
|
449
557
|
var _get_v = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(options) {
|
|
450
558
|
var _ref4, expand, orderBy, limit, filter, cols, skip, params, url, response, data, meta;
|
|
451
559
|
return _regenerator().w(function (_context4) {
|
|
@@ -491,8 +599,19 @@ var HTTPSharePointRequests = /*#__PURE__*/function () {
|
|
|
491
599
|
return _get_v.apply(this, arguments);
|
|
492
600
|
}
|
|
493
601
|
return get_v2;
|
|
494
|
-
}()
|
|
495
|
-
|
|
602
|
+
}()
|
|
603
|
+
/**
|
|
604
|
+
* Updates an item in the currently selected list.
|
|
605
|
+
*
|
|
606
|
+
* @param id Target list item identifier.
|
|
607
|
+
* @param data Payload with fields to update.
|
|
608
|
+
* @param digest Optional pre-fetched form digest to reuse.
|
|
609
|
+
* @returns Axios response of the update request.
|
|
610
|
+
*/
|
|
611
|
+
;
|
|
612
|
+
_proto.update_2 =
|
|
613
|
+
/*#__PURE__*/
|
|
614
|
+
function () {
|
|
496
615
|
var _update_ = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(id, data, digest) {
|
|
497
616
|
var formDigestValue, url, response, _t2;
|
|
498
617
|
return _regenerator().w(function (_context5) {
|
|
@@ -534,8 +653,17 @@ var HTTPSharePointRequests = /*#__PURE__*/function () {
|
|
|
534
653
|
return _update_.apply(this, arguments);
|
|
535
654
|
}
|
|
536
655
|
return update_2;
|
|
537
|
-
}()
|
|
538
|
-
|
|
656
|
+
}()
|
|
657
|
+
/**
|
|
658
|
+
* Creates a new item within the active list.
|
|
659
|
+
*
|
|
660
|
+
* @param listData SharePoint list item payload.
|
|
661
|
+
* @returns Axios response resolved from the create request.
|
|
662
|
+
*/
|
|
663
|
+
;
|
|
664
|
+
_proto.create_v2 =
|
|
665
|
+
/*#__PURE__*/
|
|
666
|
+
function () {
|
|
539
667
|
var _create_v = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(listData) {
|
|
540
668
|
var response, _t3, _t4, _t5, _t6, _t7;
|
|
541
669
|
return _regenerator().w(function (_context6) {
|
|
@@ -573,8 +701,17 @@ var HTTPSharePointRequests = /*#__PURE__*/function () {
|
|
|
573
701
|
return _create_v.apply(this, arguments);
|
|
574
702
|
}
|
|
575
703
|
return create_v2;
|
|
576
|
-
}()
|
|
577
|
-
|
|
704
|
+
}()
|
|
705
|
+
/**
|
|
706
|
+
* Uploads an attachment file to an existing list item.
|
|
707
|
+
*
|
|
708
|
+
* @param props File payload and target item identifier.
|
|
709
|
+
* @returns Axios response describing the upload result.
|
|
710
|
+
*/
|
|
711
|
+
;
|
|
712
|
+
_proto.createFile =
|
|
713
|
+
/*#__PURE__*/
|
|
714
|
+
function () {
|
|
578
715
|
var _createFile = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(_ref6) {
|
|
579
716
|
var file, itemId, requestUrl, res, _t8, _t9, _t0, _t1, _t10;
|
|
580
717
|
return _regenerator().w(function (_context7) {
|
|
@@ -607,8 +744,17 @@ var HTTPSharePointRequests = /*#__PURE__*/function () {
|
|
|
607
744
|
return _createFile.apply(this, arguments);
|
|
608
745
|
}
|
|
609
746
|
return createFile;
|
|
610
|
-
}()
|
|
611
|
-
|
|
747
|
+
}()
|
|
748
|
+
/**
|
|
749
|
+
* Deletes an item using the current endpoint.
|
|
750
|
+
*
|
|
751
|
+
* @param ID Identifier of the entity to remove.
|
|
752
|
+
* @returns Axios response from the delete call.
|
|
753
|
+
*/
|
|
754
|
+
;
|
|
755
|
+
_proto["delete"] =
|
|
756
|
+
/*#__PURE__*/
|
|
757
|
+
function () {
|
|
612
758
|
var _delete2 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(ID) {
|
|
613
759
|
var response;
|
|
614
760
|
return _regenerator().w(function (_context8) {
|
|
@@ -676,8 +822,18 @@ var HTTPSharePointRequests = /*#__PURE__*/function () {
|
|
|
676
822
|
return _sendEmail.apply(this, arguments);
|
|
677
823
|
}
|
|
678
824
|
return sendEmail;
|
|
679
|
-
}()
|
|
680
|
-
|
|
825
|
+
}()
|
|
826
|
+
/**
|
|
827
|
+
* Queries SharePoint's people picker endpoint for matching users.
|
|
828
|
+
*
|
|
829
|
+
* @param input Free-text search term.
|
|
830
|
+
* @param filter Optional additional filter condition.
|
|
831
|
+
* @returns Promise with type-ahead results payload.
|
|
832
|
+
*/
|
|
833
|
+
;
|
|
834
|
+
_proto.typeAhead =
|
|
835
|
+
/*#__PURE__*/
|
|
836
|
+
function () {
|
|
681
837
|
var _typeAhead = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(input, filter) {
|
|
682
838
|
var filterValue, response;
|
|
683
839
|
return _regenerator().w(function (_context0) {
|
|
@@ -696,8 +852,16 @@ var HTTPSharePointRequests = /*#__PURE__*/function () {
|
|
|
696
852
|
return _typeAhead.apply(this, arguments);
|
|
697
853
|
}
|
|
698
854
|
return typeAhead;
|
|
699
|
-
}()
|
|
700
|
-
|
|
855
|
+
}()
|
|
856
|
+
/**
|
|
857
|
+
* Retrieves the current user profile and flattens selected properties.
|
|
858
|
+
*
|
|
859
|
+
* @returns Promise containing the current user's profile information.
|
|
860
|
+
*/
|
|
861
|
+
;
|
|
862
|
+
_proto.currentUserProperties =
|
|
863
|
+
/*#__PURE__*/
|
|
864
|
+
function () {
|
|
701
865
|
var _currentUserProperties = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1() {
|
|
702
866
|
var requestUrl, profile;
|
|
703
867
|
return _regenerator().w(function (_context1) {
|
|
@@ -731,8 +895,17 @@ var HTTPSharePointRequests = /*#__PURE__*/function () {
|
|
|
731
895
|
return _currentUserProperties.apply(this, arguments);
|
|
732
896
|
}
|
|
733
897
|
return currentUserProperties;
|
|
734
|
-
}()
|
|
735
|
-
|
|
898
|
+
}()
|
|
899
|
+
/**
|
|
900
|
+
* Searches site users based on a substring match across common fields.
|
|
901
|
+
*
|
|
902
|
+
* @param searchValue Term to match against the SharePoint user directory.
|
|
903
|
+
* @returns Promise with matching site users and their groups.
|
|
904
|
+
*/
|
|
905
|
+
;
|
|
906
|
+
_proto.getSiteUser =
|
|
907
|
+
/*#__PURE__*/
|
|
908
|
+
function () {
|
|
736
909
|
var _getSiteUser = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(searchValue) {
|
|
737
910
|
var requestUrl, response;
|
|
738
911
|
return _regenerator().w(function (_context10) {
|
|
@@ -751,8 +924,16 @@ var HTTPSharePointRequests = /*#__PURE__*/function () {
|
|
|
751
924
|
return _getSiteUser.apply(this, arguments);
|
|
752
925
|
}
|
|
753
926
|
return getSiteUser;
|
|
754
|
-
}()
|
|
755
|
-
|
|
927
|
+
}()
|
|
928
|
+
/**
|
|
929
|
+
* Retrieves all available role definitions for the current site.
|
|
930
|
+
*
|
|
931
|
+
* @returns Promise resolving to an array of role definitions.
|
|
932
|
+
*/
|
|
933
|
+
;
|
|
934
|
+
_proto.roleDefinitions =
|
|
935
|
+
/*#__PURE__*/
|
|
936
|
+
function () {
|
|
756
937
|
var _roleDefinitions = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11() {
|
|
757
938
|
var requestUrl, response;
|
|
758
939
|
return _regenerator().w(function (_context11) {
|
|
@@ -771,8 +952,16 @@ var HTTPSharePointRequests = /*#__PURE__*/function () {
|
|
|
771
952
|
return _roleDefinitions.apply(this, arguments);
|
|
772
953
|
}
|
|
773
954
|
return roleDefinitions;
|
|
774
|
-
}()
|
|
775
|
-
|
|
955
|
+
}()
|
|
956
|
+
/**
|
|
957
|
+
* Fetches the bit-encoded permissions of the current user.
|
|
958
|
+
*
|
|
959
|
+
* @returns Promise resolving to the `EffectiveBasePermissions` object.
|
|
960
|
+
*/
|
|
961
|
+
;
|
|
962
|
+
_proto.getEffectiveBasePermissions =
|
|
963
|
+
/*#__PURE__*/
|
|
964
|
+
function () {
|
|
776
965
|
var _getEffectiveBasePermissions = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12() {
|
|
777
966
|
var requestUrl, response;
|
|
778
967
|
return _regenerator().w(function (_context12) {
|
|
@@ -791,8 +980,16 @@ var HTTPSharePointRequests = /*#__PURE__*/function () {
|
|
|
791
980
|
return _getEffectiveBasePermissions.apply(this, arguments);
|
|
792
981
|
}
|
|
793
982
|
return getEffectiveBasePermissions;
|
|
794
|
-
}()
|
|
795
|
-
|
|
983
|
+
}()
|
|
984
|
+
/**
|
|
985
|
+
* Matches the current user's effective permissions against known role definitions.
|
|
986
|
+
*
|
|
987
|
+
* @returns The matching SharePoint role definition as a structured permission object.
|
|
988
|
+
*/
|
|
989
|
+
;
|
|
990
|
+
_proto.currentUserPermissions =
|
|
991
|
+
/*#__PURE__*/
|
|
992
|
+
function () {
|
|
796
993
|
var _currentUserPermissions = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13() {
|
|
797
994
|
var _yield$this$getEffect, High, roleDefinitions, result;
|
|
798
995
|
return _regenerator().w(function (_context13) {
|
|
@@ -826,19 +1023,21 @@ var HTTPSharePointRequests = /*#__PURE__*/function () {
|
|
|
826
1023
|
// Load environment variables from .env file
|
|
827
1024
|
function createBase() {
|
|
828
1025
|
function create(_ref) {
|
|
829
|
-
var baseURL = _ref.baseURL
|
|
1026
|
+
var baseURL = _ref.baseURL,
|
|
1027
|
+
config = _ref.config;
|
|
830
1028
|
if (!baseURL) {
|
|
831
1029
|
throw new Error('A valid SharePoint URL must be provided.');
|
|
832
1030
|
}
|
|
833
|
-
return new HTTPSharePointRequests(baseURL);
|
|
1031
|
+
return new HTTPSharePointRequests(baseURL, config);
|
|
834
1032
|
}
|
|
835
1033
|
return {
|
|
836
1034
|
/**
|
|
837
1035
|
* @deprecated Use `create` instead.
|
|
838
1036
|
*/
|
|
839
|
-
baseURL: function baseURL(url) {
|
|
1037
|
+
baseURL: function baseURL(url, config) {
|
|
840
1038
|
return create({
|
|
841
|
-
baseURL: url
|
|
1039
|
+
baseURL: url,
|
|
1040
|
+
config: config
|
|
842
1041
|
});
|
|
843
1042
|
},
|
|
844
1043
|
create: create
|