@lindle/sharepoint_requests 0.1.14 → 0.1.16
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/README.md +9 -0
- package/dist/index.d.ts +17 -17
- package/dist/root/index.d.ts +86 -81
- package/dist/root/instance.d.ts +3 -3
- package/dist/root/internal/context.d.ts +11 -9
- package/dist/root/internal/digest.d.ts +2 -2
- package/dist/root/internal/emailRequests.d.ts +10 -10
- package/dist/root/internal/listRequests/createAttachment.d.ts +3 -3
- package/dist/root/internal/listRequests/createListItem.d.ts +3 -3
- package/dist/root/internal/listRequests/deleteFile.d.ts +3 -0
- package/dist/root/internal/listRequests/deleteItem.d.ts +3 -3
- package/dist/root/internal/listRequests/getFiles.d.ts +8 -8
- package/dist/root/internal/listRequests/getListItems.d.ts +8 -8
- package/dist/root/internal/listRequests/getOnly.d.ts +3 -3
- package/dist/root/internal/listRequests/index.d.ts +9 -7
- package/dist/root/internal/listRequests/updateListItem.d.ts +3 -3
- package/dist/root/internal/listRequests/uploadFile.d.ts +3 -0
- package/dist/root/internal/listRequests/utils.d.ts +2 -0
- package/dist/root/internal/odata.d.ts +5 -5
- package/dist/root/internal/userRequests.d.ts +15 -15
- package/dist/sharepoint_requests.cjs.development.js +284 -50
- 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 +284 -50
- package/dist/sharepoint_requests.esm.js.map +1 -1
- package/dist/types.d.ts +241 -232
- package/package.json +6 -3
- package/src/root/index.ts +55 -2
- package/src/root/internal/context.ts +2 -0
- package/src/root/internal/listRequests/createListItem.ts +18 -12
- package/src/root/internal/listRequests/deleteFile.ts +35 -0
- package/src/root/internal/listRequests/index.ts +2 -0
- package/src/root/internal/listRequests/updateListItem.ts +21 -3
- package/src/root/internal/listRequests/uploadFile.ts +42 -0
- package/src/root/internal/listRequests/utils.ts +33 -0
- package/src/types.ts +14 -5
|
@@ -195,53 +195,72 @@ function _fetchDigest() {
|
|
|
195
195
|
return _fetchDigest.apply(this, arguments);
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
-
function
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
198
|
+
function resolveMetadataType(_x) {
|
|
199
|
+
return _resolveMetadataType.apply(this, arguments);
|
|
200
|
+
}
|
|
201
|
+
function _resolveMetadataType() {
|
|
202
|
+
_resolveMetadataType = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(context) {
|
|
203
|
+
return _regenerator().w(function (_context) {
|
|
204
|
+
while (1) switch (_context.n) {
|
|
205
|
+
case 0:
|
|
206
|
+
if (!context.resolveListItemEntityType) {
|
|
207
|
+
_context.n = 1;
|
|
208
|
+
break;
|
|
209
|
+
}
|
|
210
|
+
return _context.a(2, context.resolveListItemEntityType());
|
|
211
|
+
case 1:
|
|
212
|
+
if (!context.listItemEntityTypeFullName) {
|
|
213
|
+
_context.n = 2;
|
|
214
|
+
break;
|
|
215
|
+
}
|
|
216
|
+
return _context.a(2, context.listItemEntityTypeFullName);
|
|
217
|
+
case 2:
|
|
218
|
+
return _context.a(2, "SP.Data." + context.listName + "ListItem");
|
|
219
|
+
}
|
|
220
|
+
}, _callee);
|
|
221
|
+
}));
|
|
222
|
+
return _resolveMetadataType.apply(this, arguments);
|
|
209
223
|
}
|
|
210
|
-
function createListItem(
|
|
224
|
+
function createListItem(_x2, _x3) {
|
|
211
225
|
return _createListItem.apply(this, arguments);
|
|
212
226
|
}
|
|
213
227
|
function _createListItem() {
|
|
214
|
-
_createListItem = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
215
|
-
var response, _t, _t2, _t3, _t4, _t5;
|
|
216
|
-
return _regenerator().w(function (
|
|
217
|
-
while (1) switch (
|
|
228
|
+
_createListItem = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(context, listData) {
|
|
229
|
+
var metadataType, payload, response, _t, _t2, _t3, _t4, _t5;
|
|
230
|
+
return _regenerator().w(function (_context2) {
|
|
231
|
+
while (1) switch (_context2.n) {
|
|
218
232
|
case 0:
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
233
|
+
_context2.n = 1;
|
|
234
|
+
return resolveMetadataType(context);
|
|
235
|
+
case 1:
|
|
236
|
+
metadataType = _context2.v;
|
|
237
|
+
payload = _extends({}, listData, {
|
|
238
|
+
__metadata: {
|
|
239
|
+
type: metadataType
|
|
240
|
+
}
|
|
241
|
+
});
|
|
223
242
|
_t = context;
|
|
224
243
|
_t2 = context.endpoint;
|
|
225
|
-
_t3 = JSON.stringify(
|
|
226
|
-
|
|
244
|
+
_t3 = JSON.stringify(payload);
|
|
245
|
+
_context2.n = 2;
|
|
227
246
|
return fetchDigest(context.instance, context.baseURL);
|
|
228
|
-
case
|
|
229
|
-
_t4 =
|
|
247
|
+
case 2:
|
|
248
|
+
_t4 = _context2.v;
|
|
230
249
|
_t5 = {
|
|
231
250
|
'X-RequestDigest': _t4
|
|
232
251
|
};
|
|
233
|
-
|
|
252
|
+
_context2.n = 3;
|
|
234
253
|
return _t.instance.call(_t, {
|
|
235
254
|
url: _t2,
|
|
236
255
|
method: 'POST',
|
|
237
256
|
data: _t3,
|
|
238
257
|
headers: _t5
|
|
239
258
|
});
|
|
240
|
-
case
|
|
241
|
-
response =
|
|
242
|
-
return
|
|
259
|
+
case 3:
|
|
260
|
+
response = _context2.v;
|
|
261
|
+
return _context2.a(2, response);
|
|
243
262
|
}
|
|
244
|
-
},
|
|
263
|
+
}, _callee2);
|
|
245
264
|
}));
|
|
246
265
|
return _createListItem.apply(this, arguments);
|
|
247
266
|
}
|
|
@@ -301,6 +320,73 @@ function _deleteItem() {
|
|
|
301
320
|
return _deleteItem.apply(this, arguments);
|
|
302
321
|
}
|
|
303
322
|
|
|
323
|
+
function buildLibraryPath(folderPath) {
|
|
324
|
+
if (!folderPath) {
|
|
325
|
+
return '';
|
|
326
|
+
}
|
|
327
|
+
var segments = Array.isArray(folderPath) ? folderPath : folderPath.split('/').filter(Boolean);
|
|
328
|
+
if (!segments.length) {
|
|
329
|
+
return '';
|
|
330
|
+
}
|
|
331
|
+
var escapedSegments = segments.map(function (segment) {
|
|
332
|
+
if (!segment.trim()) {
|
|
333
|
+
throw new Error('Folder path segments cannot be empty.');
|
|
334
|
+
}
|
|
335
|
+
var sanitized = segment.replace(/'/g, "''");
|
|
336
|
+
return "/Folders('" + encodeURIComponent(sanitized) + "')";
|
|
337
|
+
});
|
|
338
|
+
return escapedSegments.join('');
|
|
339
|
+
}
|
|
340
|
+
function encodeFileName(fileName) {
|
|
341
|
+
if (!fileName.trim()) {
|
|
342
|
+
throw new Error('File name cannot be empty.');
|
|
343
|
+
}
|
|
344
|
+
return encodeURIComponent(fileName.replace(/'/g, "''"));
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
var SUPPORTED_VERSION = '2013';
|
|
348
|
+
function deleteFile(_x, _x2) {
|
|
349
|
+
return _deleteFile.apply(this, arguments);
|
|
350
|
+
}
|
|
351
|
+
function _deleteFile() {
|
|
352
|
+
_deleteFile = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(context, _ref) {
|
|
353
|
+
var fileName, folderPath, encodedFileName, requestUrl, digest, response;
|
|
354
|
+
return _regenerator().w(function (_context) {
|
|
355
|
+
while (1) switch (_context.n) {
|
|
356
|
+
case 0:
|
|
357
|
+
fileName = _ref.fileName, folderPath = _ref.folderPath;
|
|
358
|
+
if (!(context.sharepointVersion !== SUPPORTED_VERSION)) {
|
|
359
|
+
_context.n = 1;
|
|
360
|
+
break;
|
|
361
|
+
}
|
|
362
|
+
throw new Error('deleteFile is only supported for SharePoint 2013 REST endpoints.');
|
|
363
|
+
case 1:
|
|
364
|
+
encodedFileName = encodeFileName(fileName);
|
|
365
|
+
requestUrl = "_api/web/lists/getbytitle('" + context.listName + "')/RootFolder";
|
|
366
|
+
requestUrl += buildLibraryPath(folderPath);
|
|
367
|
+
requestUrl += "/Files('" + encodedFileName + "')";
|
|
368
|
+
_context.n = 2;
|
|
369
|
+
return fetchDigest(context.instance, context.baseURL);
|
|
370
|
+
case 2:
|
|
371
|
+
digest = _context.v;
|
|
372
|
+
_context.n = 3;
|
|
373
|
+
return context.instance.post(requestUrl, undefined, {
|
|
374
|
+
headers: {
|
|
375
|
+
'X-HTTP-Method': 'DELETE',
|
|
376
|
+
'IF-MATCH': '*',
|
|
377
|
+
'X-RequestDigest': digest
|
|
378
|
+
},
|
|
379
|
+
withCredentials: true
|
|
380
|
+
});
|
|
381
|
+
case 3:
|
|
382
|
+
response = _context.v;
|
|
383
|
+
return _context.a(2, response);
|
|
384
|
+
}
|
|
385
|
+
}, _callee);
|
|
386
|
+
}));
|
|
387
|
+
return _deleteFile.apply(this, arguments);
|
|
388
|
+
}
|
|
389
|
+
|
|
304
390
|
function buildODataParams(options, orderBySeparator) {
|
|
305
391
|
if (orderBySeparator === void 0) {
|
|
306
392
|
orderBySeparator = ',';
|
|
@@ -445,48 +531,128 @@ function _getOnly() {
|
|
|
445
531
|
return _getOnly.apply(this, arguments);
|
|
446
532
|
}
|
|
447
533
|
|
|
448
|
-
function
|
|
449
|
-
return
|
|
534
|
+
function resolveMetadataType$1(_x) {
|
|
535
|
+
return _resolveMetadataType$1.apply(this, arguments);
|
|
450
536
|
}
|
|
451
|
-
function
|
|
452
|
-
|
|
453
|
-
var formDigestValue, url, response, _t;
|
|
537
|
+
function _resolveMetadataType$1() {
|
|
538
|
+
_resolveMetadataType$1 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(context) {
|
|
454
539
|
return _regenerator().w(function (_context) {
|
|
455
540
|
while (1) switch (_context.n) {
|
|
541
|
+
case 0:
|
|
542
|
+
if (!context.resolveListItemEntityType) {
|
|
543
|
+
_context.n = 1;
|
|
544
|
+
break;
|
|
545
|
+
}
|
|
546
|
+
return _context.a(2, context.resolveListItemEntityType());
|
|
547
|
+
case 1:
|
|
548
|
+
if (!context.listItemEntityTypeFullName) {
|
|
549
|
+
_context.n = 2;
|
|
550
|
+
break;
|
|
551
|
+
}
|
|
552
|
+
return _context.a(2, context.listItemEntityTypeFullName);
|
|
553
|
+
case 2:
|
|
554
|
+
return _context.a(2, "SP.Data." + context.listName + "ListItem");
|
|
555
|
+
}
|
|
556
|
+
}, _callee);
|
|
557
|
+
}));
|
|
558
|
+
return _resolveMetadataType$1.apply(this, arguments);
|
|
559
|
+
}
|
|
560
|
+
function updateListItem(_x2, _x3, _x4, _x5) {
|
|
561
|
+
return _updateListItem.apply(this, arguments);
|
|
562
|
+
}
|
|
563
|
+
function _updateListItem() {
|
|
564
|
+
_updateListItem = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(context, id, data, digest) {
|
|
565
|
+
var formDigestValue, metadataType, payload, url, response, _t;
|
|
566
|
+
return _regenerator().w(function (_context2) {
|
|
567
|
+
while (1) switch (_context2.n) {
|
|
456
568
|
case 0:
|
|
457
569
|
_t = digest;
|
|
458
570
|
if (_t) {
|
|
459
|
-
|
|
571
|
+
_context2.n = 2;
|
|
460
572
|
break;
|
|
461
573
|
}
|
|
462
|
-
|
|
574
|
+
_context2.n = 1;
|
|
463
575
|
return fetchDigest(context.instance, context.baseURL);
|
|
464
576
|
case 1:
|
|
465
|
-
_t =
|
|
577
|
+
_t = _context2.v;
|
|
466
578
|
case 2:
|
|
467
579
|
formDigestValue = _t;
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
580
|
+
_context2.n = 3;
|
|
581
|
+
return resolveMetadataType$1(context);
|
|
582
|
+
case 3:
|
|
583
|
+
metadataType = _context2.v;
|
|
584
|
+
payload = _extends({}, data, {
|
|
585
|
+
__metadata: {
|
|
586
|
+
type: metadataType
|
|
587
|
+
}
|
|
588
|
+
});
|
|
471
589
|
url = "_api/lists/getbytitle('" + context.listName + "')/getItemById('" + id + "')";
|
|
472
|
-
|
|
590
|
+
_context2.n = 4;
|
|
473
591
|
return context.instance({
|
|
474
592
|
url: url,
|
|
475
593
|
method: 'POST',
|
|
476
|
-
data: JSON.stringify(
|
|
594
|
+
data: JSON.stringify(payload),
|
|
477
595
|
headers: {
|
|
478
596
|
'X-RequestDigest': formDigestValue,
|
|
479
597
|
'IF-MATCH': '*',
|
|
480
598
|
'X-Http-Method': 'PATCH'
|
|
481
599
|
}
|
|
482
600
|
});
|
|
601
|
+
case 4:
|
|
602
|
+
response = _context2.v;
|
|
603
|
+
return _context2.a(2, response);
|
|
604
|
+
}
|
|
605
|
+
}, _callee2);
|
|
606
|
+
}));
|
|
607
|
+
return _updateListItem.apply(this, arguments);
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
var SUPPORTED_VERSION$1 = '2013';
|
|
611
|
+
function uploadFile(_x, _x2) {
|
|
612
|
+
return _uploadFile.apply(this, arguments);
|
|
613
|
+
}
|
|
614
|
+
function _uploadFile() {
|
|
615
|
+
_uploadFile = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(context, _ref) {
|
|
616
|
+
var file, folderPath, _ref$overwrite, overwrite, requestUrl, encodedFileName, digest, response;
|
|
617
|
+
return _regenerator().w(function (_context) {
|
|
618
|
+
while (1) switch (_context.n) {
|
|
619
|
+
case 0:
|
|
620
|
+
file = _ref.file, folderPath = _ref.folderPath, _ref$overwrite = _ref.overwrite, overwrite = _ref$overwrite === void 0 ? true : _ref$overwrite;
|
|
621
|
+
if (!(context.sharepointVersion !== SUPPORTED_VERSION$1)) {
|
|
622
|
+
_context.n = 1;
|
|
623
|
+
break;
|
|
624
|
+
}
|
|
625
|
+
throw new Error('uploadFile is only supported for SharePoint 2013 REST endpoints.');
|
|
626
|
+
case 1:
|
|
627
|
+
if (file != null && file.name) {
|
|
628
|
+
_context.n = 2;
|
|
629
|
+
break;
|
|
630
|
+
}
|
|
631
|
+
throw new Error('A file with a valid name must be provided.');
|
|
632
|
+
case 2:
|
|
633
|
+
requestUrl = "_api/web/lists/getbytitle('" + context.listName + "')/RootFolder";
|
|
634
|
+
requestUrl += buildLibraryPath(folderPath);
|
|
635
|
+
encodedFileName = encodeFileName(file.name);
|
|
636
|
+
requestUrl += "/Files/add(url='" + encodedFileName + "',overwrite=" + (overwrite ? 'true' : 'false') + ")";
|
|
637
|
+
_context.n = 3;
|
|
638
|
+
return fetchDigest(context.instance, context.baseURL);
|
|
483
639
|
case 3:
|
|
640
|
+
digest = _context.v;
|
|
641
|
+
_context.n = 4;
|
|
642
|
+
return context.instance.post(requestUrl, file, {
|
|
643
|
+
headers: {
|
|
644
|
+
'Content-Type': file.type || 'application/octet-stream',
|
|
645
|
+
'X-RequestDigest': digest
|
|
646
|
+
},
|
|
647
|
+
withCredentials: true
|
|
648
|
+
});
|
|
649
|
+
case 4:
|
|
484
650
|
response = _context.v;
|
|
485
651
|
return _context.a(2, response);
|
|
486
652
|
}
|
|
487
653
|
}, _callee);
|
|
488
654
|
}));
|
|
489
|
-
return
|
|
655
|
+
return _uploadFile.apply(this, arguments);
|
|
490
656
|
}
|
|
491
657
|
|
|
492
658
|
function sendEmail(_x, _x2) {
|
|
@@ -710,6 +876,12 @@ function _currentUserPermissions() {
|
|
|
710
876
|
var HTTPSharePointRequests = /*#__PURE__*/function () {
|
|
711
877
|
function HTTPSharePointRequests(baseURL, config) {
|
|
712
878
|
var _this = this;
|
|
879
|
+
this.baseURL = void 0;
|
|
880
|
+
this.endpoint = void 0;
|
|
881
|
+
this.listName = void 0;
|
|
882
|
+
this.instance = void 0;
|
|
883
|
+
this.sharepointVersion = void 0;
|
|
884
|
+
this.listItemEntityTypeFullName = void 0;
|
|
713
885
|
this.lists = {
|
|
714
886
|
get: function get() {
|
|
715
887
|
_this.endpoint = '_api/web/lists';
|
|
@@ -770,6 +942,7 @@ var HTTPSharePointRequests = /*#__PURE__*/function () {
|
|
|
770
942
|
this.listName = '';
|
|
771
943
|
this.instance = instance(this.baseURL, config);
|
|
772
944
|
this.sharepointVersion = '2013';
|
|
945
|
+
this.listItemEntityTypeFullName = undefined;
|
|
773
946
|
}
|
|
774
947
|
var _proto = HTTPSharePointRequests.prototype;
|
|
775
948
|
_proto.getContext = function getContext() {
|
|
@@ -778,23 +951,78 @@ var HTTPSharePointRequests = /*#__PURE__*/function () {
|
|
|
778
951
|
baseURL: this.baseURL,
|
|
779
952
|
endpoint: this.endpoint,
|
|
780
953
|
listName: this.listName,
|
|
781
|
-
sharepointVersion: this.sharepointVersion
|
|
954
|
+
sharepointVersion: this.sharepointVersion,
|
|
955
|
+
listItemEntityTypeFullName: this.listItemEntityTypeFullName,
|
|
956
|
+
resolveListItemEntityType: this.resolveListItemEntityTypeFullName.bind(this)
|
|
782
957
|
};
|
|
783
|
-
}
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
958
|
+
};
|
|
959
|
+
_proto.resolveListItemEntityTypeFullName = /*#__PURE__*/function () {
|
|
960
|
+
var _resolveListItemEntityTypeFullName = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
961
|
+
var _response$data$d$List, _response$data, _response$data2;
|
|
962
|
+
var response, entityType;
|
|
963
|
+
return _regenerator().w(function (_context) {
|
|
964
|
+
while (1) switch (_context.n) {
|
|
965
|
+
case 0:
|
|
966
|
+
if (!this.listItemEntityTypeFullName) {
|
|
967
|
+
_context.n = 1;
|
|
968
|
+
break;
|
|
969
|
+
}
|
|
970
|
+
return _context.a(2, this.listItemEntityTypeFullName);
|
|
971
|
+
case 1:
|
|
972
|
+
if (this.listName) {
|
|
973
|
+
_context.n = 2;
|
|
974
|
+
break;
|
|
975
|
+
}
|
|
976
|
+
throw new Error('List name is not set.');
|
|
977
|
+
case 2:
|
|
978
|
+
if (!(this.sharepointVersion !== '2013')) {
|
|
979
|
+
_context.n = 3;
|
|
980
|
+
break;
|
|
981
|
+
}
|
|
982
|
+
this.listItemEntityTypeFullName = "SP.Data." + this.listName + "ListItem";
|
|
983
|
+
return _context.a(2, this.listItemEntityTypeFullName);
|
|
984
|
+
case 3:
|
|
985
|
+
_context.n = 4;
|
|
986
|
+
return this.instance.get("_api/web/lists/GetByTitle('" + this.listName + "')?$select=ListItemEntityTypeFullName");
|
|
987
|
+
case 4:
|
|
988
|
+
response = _context.v;
|
|
989
|
+
entityType = (_response$data$d$List = (_response$data = response.data) == null || (_response$data = _response$data.d) == null ? void 0 : _response$data.ListItemEntityTypeFullName) != null ? _response$data$d$List : (_response$data2 = response.data) == null ? void 0 : _response$data2.ListItemEntityTypeFullName;
|
|
990
|
+
if (!(!entityType || typeof entityType !== 'string')) {
|
|
991
|
+
_context.n = 5;
|
|
992
|
+
break;
|
|
993
|
+
}
|
|
994
|
+
throw new Error("Unable to resolve ListItemEntityTypeFullName for list \"" + this.listName + "\".");
|
|
995
|
+
case 5:
|
|
996
|
+
this.listItemEntityTypeFullName = entityType;
|
|
997
|
+
return _context.a(2, this.listItemEntityTypeFullName);
|
|
998
|
+
}
|
|
999
|
+
}, _callee, this);
|
|
1000
|
+
}));
|
|
1001
|
+
function resolveListItemEntityTypeFullName() {
|
|
1002
|
+
return _resolveListItemEntityTypeFullName.apply(this, arguments);
|
|
1003
|
+
}
|
|
1004
|
+
return resolveListItemEntityTypeFullName;
|
|
1005
|
+
}()
|
|
1006
|
+
/**
|
|
1007
|
+
* @deprecated Use `from` instead.
|
|
1008
|
+
*/
|
|
1009
|
+
;
|
|
787
1010
|
_proto.list = function list(listName) {
|
|
788
1011
|
this.listName = listName;
|
|
789
1012
|
this.endpoint = "_vti_bin/ListData.svc/" + listName;
|
|
790
1013
|
this.sharepointVersion = '2010';
|
|
1014
|
+
this.listItemEntityTypeFullName = undefined;
|
|
791
1015
|
return this;
|
|
792
1016
|
};
|
|
1017
|
+
_proto.getDigest = function getDigest() {
|
|
1018
|
+
return fetchDigest(this.instance, this.baseURL);
|
|
1019
|
+
};
|
|
793
1020
|
_proto.from = function from(listName, sharepoint_ver) {
|
|
794
1021
|
var _this2 = this;
|
|
795
1022
|
var version = sharepoint_ver != null ? sharepoint_ver : '2013';
|
|
796
1023
|
this.listName = listName;
|
|
797
1024
|
this.sharepointVersion = version;
|
|
1025
|
+
this.listItemEntityTypeFullName = undefined;
|
|
798
1026
|
this.endpoint = version === '2013' ? "_api/web/lists/GetByTitle('" + this.listName + "')/items" : "_vti_bin/ListData.svc/" + listName;
|
|
799
1027
|
var getContext = function getContext() {
|
|
800
1028
|
return _this2.getContext();
|
|
@@ -815,6 +1043,12 @@ var HTTPSharePointRequests = /*#__PURE__*/function () {
|
|
|
815
1043
|
createFile: function createFile(props) {
|
|
816
1044
|
return createAttachment(getContext(), props);
|
|
817
1045
|
},
|
|
1046
|
+
uploadFile: function uploadFile$1(props) {
|
|
1047
|
+
return uploadFile(getContext(), props);
|
|
1048
|
+
},
|
|
1049
|
+
deleteFile: function deleteFile$1(props) {
|
|
1050
|
+
return deleteFile(getContext(), props);
|
|
1051
|
+
},
|
|
818
1052
|
fields: function fields(options) {
|
|
819
1053
|
_this2.endpoint = !(options != null && options.fieldName) ? "_api/web/lists/GetByTitle('" + _this2.listName + "')/fields" : "_api/web/lists/GetByTitle('" + _this2.listName + "')/fields/getbytitle('" + options.fieldName + "')";
|
|
820
1054
|
return {
|
|
@@ -871,8 +1105,8 @@ function createBase() {
|
|
|
871
1105
|
return new HTTPSharePointRequests(baseURL, config);
|
|
872
1106
|
}
|
|
873
1107
|
return {
|
|
874
|
-
/**
|
|
875
|
-
* @deprecated Use `create` instead.
|
|
1108
|
+
/**
|
|
1109
|
+
* @deprecated Use `create` instead.
|
|
876
1110
|
*/
|
|
877
1111
|
baseURL: function baseURL(url, config) {
|
|
878
1112
|
return create({
|