@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
|
@@ -202,53 +202,72 @@ function _fetchDigest() {
|
|
|
202
202
|
return _fetchDigest.apply(this, arguments);
|
|
203
203
|
}
|
|
204
204
|
|
|
205
|
-
function
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
205
|
+
function resolveMetadataType(_x) {
|
|
206
|
+
return _resolveMetadataType.apply(this, arguments);
|
|
207
|
+
}
|
|
208
|
+
function _resolveMetadataType() {
|
|
209
|
+
_resolveMetadataType = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(context) {
|
|
210
|
+
return _regenerator().w(function (_context) {
|
|
211
|
+
while (1) switch (_context.n) {
|
|
212
|
+
case 0:
|
|
213
|
+
if (!context.resolveListItemEntityType) {
|
|
214
|
+
_context.n = 1;
|
|
215
|
+
break;
|
|
216
|
+
}
|
|
217
|
+
return _context.a(2, context.resolveListItemEntityType());
|
|
218
|
+
case 1:
|
|
219
|
+
if (!context.listItemEntityTypeFullName) {
|
|
220
|
+
_context.n = 2;
|
|
221
|
+
break;
|
|
222
|
+
}
|
|
223
|
+
return _context.a(2, context.listItemEntityTypeFullName);
|
|
224
|
+
case 2:
|
|
225
|
+
return _context.a(2, "SP.Data." + context.listName + "ListItem");
|
|
226
|
+
}
|
|
227
|
+
}, _callee);
|
|
228
|
+
}));
|
|
229
|
+
return _resolveMetadataType.apply(this, arguments);
|
|
216
230
|
}
|
|
217
|
-
function createListItem(
|
|
231
|
+
function createListItem(_x2, _x3) {
|
|
218
232
|
return _createListItem.apply(this, arguments);
|
|
219
233
|
}
|
|
220
234
|
function _createListItem() {
|
|
221
|
-
_createListItem = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
222
|
-
var response, _t, _t2, _t3, _t4, _t5;
|
|
223
|
-
return _regenerator().w(function (
|
|
224
|
-
while (1) switch (
|
|
235
|
+
_createListItem = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(context, listData) {
|
|
236
|
+
var metadataType, payload, response, _t, _t2, _t3, _t4, _t5;
|
|
237
|
+
return _regenerator().w(function (_context2) {
|
|
238
|
+
while (1) switch (_context2.n) {
|
|
225
239
|
case 0:
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
240
|
+
_context2.n = 1;
|
|
241
|
+
return resolveMetadataType(context);
|
|
242
|
+
case 1:
|
|
243
|
+
metadataType = _context2.v;
|
|
244
|
+
payload = _extends({}, listData, {
|
|
245
|
+
__metadata: {
|
|
246
|
+
type: metadataType
|
|
247
|
+
}
|
|
248
|
+
});
|
|
230
249
|
_t = context;
|
|
231
250
|
_t2 = context.endpoint;
|
|
232
|
-
_t3 = JSON.stringify(
|
|
233
|
-
|
|
251
|
+
_t3 = JSON.stringify(payload);
|
|
252
|
+
_context2.n = 2;
|
|
234
253
|
return fetchDigest(context.instance, context.baseURL);
|
|
235
|
-
case
|
|
236
|
-
_t4 =
|
|
254
|
+
case 2:
|
|
255
|
+
_t4 = _context2.v;
|
|
237
256
|
_t5 = {
|
|
238
257
|
'X-RequestDigest': _t4
|
|
239
258
|
};
|
|
240
|
-
|
|
259
|
+
_context2.n = 3;
|
|
241
260
|
return _t.instance.call(_t, {
|
|
242
261
|
url: _t2,
|
|
243
262
|
method: 'POST',
|
|
244
263
|
data: _t3,
|
|
245
264
|
headers: _t5
|
|
246
265
|
});
|
|
247
|
-
case
|
|
248
|
-
response =
|
|
249
|
-
return
|
|
266
|
+
case 3:
|
|
267
|
+
response = _context2.v;
|
|
268
|
+
return _context2.a(2, response);
|
|
250
269
|
}
|
|
251
|
-
},
|
|
270
|
+
}, _callee2);
|
|
252
271
|
}));
|
|
253
272
|
return _createListItem.apply(this, arguments);
|
|
254
273
|
}
|
|
@@ -308,6 +327,73 @@ function _deleteItem() {
|
|
|
308
327
|
return _deleteItem.apply(this, arguments);
|
|
309
328
|
}
|
|
310
329
|
|
|
330
|
+
function buildLibraryPath(folderPath) {
|
|
331
|
+
if (!folderPath) {
|
|
332
|
+
return '';
|
|
333
|
+
}
|
|
334
|
+
var segments = Array.isArray(folderPath) ? folderPath : folderPath.split('/').filter(Boolean);
|
|
335
|
+
if (!segments.length) {
|
|
336
|
+
return '';
|
|
337
|
+
}
|
|
338
|
+
var escapedSegments = segments.map(function (segment) {
|
|
339
|
+
if (!segment.trim()) {
|
|
340
|
+
throw new Error('Folder path segments cannot be empty.');
|
|
341
|
+
}
|
|
342
|
+
var sanitized = segment.replace(/'/g, "''");
|
|
343
|
+
return "/Folders('" + encodeURIComponent(sanitized) + "')";
|
|
344
|
+
});
|
|
345
|
+
return escapedSegments.join('');
|
|
346
|
+
}
|
|
347
|
+
function encodeFileName(fileName) {
|
|
348
|
+
if (!fileName.trim()) {
|
|
349
|
+
throw new Error('File name cannot be empty.');
|
|
350
|
+
}
|
|
351
|
+
return encodeURIComponent(fileName.replace(/'/g, "''"));
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
var SUPPORTED_VERSION = '2013';
|
|
355
|
+
function deleteFile(_x, _x2) {
|
|
356
|
+
return _deleteFile.apply(this, arguments);
|
|
357
|
+
}
|
|
358
|
+
function _deleteFile() {
|
|
359
|
+
_deleteFile = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(context, _ref) {
|
|
360
|
+
var fileName, folderPath, encodedFileName, requestUrl, digest, response;
|
|
361
|
+
return _regenerator().w(function (_context) {
|
|
362
|
+
while (1) switch (_context.n) {
|
|
363
|
+
case 0:
|
|
364
|
+
fileName = _ref.fileName, folderPath = _ref.folderPath;
|
|
365
|
+
if (!(context.sharepointVersion !== SUPPORTED_VERSION)) {
|
|
366
|
+
_context.n = 1;
|
|
367
|
+
break;
|
|
368
|
+
}
|
|
369
|
+
throw new Error('deleteFile is only supported for SharePoint 2013 REST endpoints.');
|
|
370
|
+
case 1:
|
|
371
|
+
encodedFileName = encodeFileName(fileName);
|
|
372
|
+
requestUrl = "_api/web/lists/getbytitle('" + context.listName + "')/RootFolder";
|
|
373
|
+
requestUrl += buildLibraryPath(folderPath);
|
|
374
|
+
requestUrl += "/Files('" + encodedFileName + "')";
|
|
375
|
+
_context.n = 2;
|
|
376
|
+
return fetchDigest(context.instance, context.baseURL);
|
|
377
|
+
case 2:
|
|
378
|
+
digest = _context.v;
|
|
379
|
+
_context.n = 3;
|
|
380
|
+
return context.instance.post(requestUrl, undefined, {
|
|
381
|
+
headers: {
|
|
382
|
+
'X-HTTP-Method': 'DELETE',
|
|
383
|
+
'IF-MATCH': '*',
|
|
384
|
+
'X-RequestDigest': digest
|
|
385
|
+
},
|
|
386
|
+
withCredentials: true
|
|
387
|
+
});
|
|
388
|
+
case 3:
|
|
389
|
+
response = _context.v;
|
|
390
|
+
return _context.a(2, response);
|
|
391
|
+
}
|
|
392
|
+
}, _callee);
|
|
393
|
+
}));
|
|
394
|
+
return _deleteFile.apply(this, arguments);
|
|
395
|
+
}
|
|
396
|
+
|
|
311
397
|
function buildODataParams(options, orderBySeparator) {
|
|
312
398
|
if (orderBySeparator === void 0) {
|
|
313
399
|
orderBySeparator = ',';
|
|
@@ -452,48 +538,128 @@ function _getOnly() {
|
|
|
452
538
|
return _getOnly.apply(this, arguments);
|
|
453
539
|
}
|
|
454
540
|
|
|
455
|
-
function
|
|
456
|
-
return
|
|
541
|
+
function resolveMetadataType$1(_x) {
|
|
542
|
+
return _resolveMetadataType$1.apply(this, arguments);
|
|
457
543
|
}
|
|
458
|
-
function
|
|
459
|
-
|
|
460
|
-
var formDigestValue, url, response, _t;
|
|
544
|
+
function _resolveMetadataType$1() {
|
|
545
|
+
_resolveMetadataType$1 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(context) {
|
|
461
546
|
return _regenerator().w(function (_context) {
|
|
462
547
|
while (1) switch (_context.n) {
|
|
548
|
+
case 0:
|
|
549
|
+
if (!context.resolveListItemEntityType) {
|
|
550
|
+
_context.n = 1;
|
|
551
|
+
break;
|
|
552
|
+
}
|
|
553
|
+
return _context.a(2, context.resolveListItemEntityType());
|
|
554
|
+
case 1:
|
|
555
|
+
if (!context.listItemEntityTypeFullName) {
|
|
556
|
+
_context.n = 2;
|
|
557
|
+
break;
|
|
558
|
+
}
|
|
559
|
+
return _context.a(2, context.listItemEntityTypeFullName);
|
|
560
|
+
case 2:
|
|
561
|
+
return _context.a(2, "SP.Data." + context.listName + "ListItem");
|
|
562
|
+
}
|
|
563
|
+
}, _callee);
|
|
564
|
+
}));
|
|
565
|
+
return _resolveMetadataType$1.apply(this, arguments);
|
|
566
|
+
}
|
|
567
|
+
function updateListItem(_x2, _x3, _x4, _x5) {
|
|
568
|
+
return _updateListItem.apply(this, arguments);
|
|
569
|
+
}
|
|
570
|
+
function _updateListItem() {
|
|
571
|
+
_updateListItem = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(context, id, data, digest) {
|
|
572
|
+
var formDigestValue, metadataType, payload, url, response, _t;
|
|
573
|
+
return _regenerator().w(function (_context2) {
|
|
574
|
+
while (1) switch (_context2.n) {
|
|
463
575
|
case 0:
|
|
464
576
|
_t = digest;
|
|
465
577
|
if (_t) {
|
|
466
|
-
|
|
578
|
+
_context2.n = 2;
|
|
467
579
|
break;
|
|
468
580
|
}
|
|
469
|
-
|
|
581
|
+
_context2.n = 1;
|
|
470
582
|
return fetchDigest(context.instance, context.baseURL);
|
|
471
583
|
case 1:
|
|
472
|
-
_t =
|
|
584
|
+
_t = _context2.v;
|
|
473
585
|
case 2:
|
|
474
586
|
formDigestValue = _t;
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
587
|
+
_context2.n = 3;
|
|
588
|
+
return resolveMetadataType$1(context);
|
|
589
|
+
case 3:
|
|
590
|
+
metadataType = _context2.v;
|
|
591
|
+
payload = _extends({}, data, {
|
|
592
|
+
__metadata: {
|
|
593
|
+
type: metadataType
|
|
594
|
+
}
|
|
595
|
+
});
|
|
478
596
|
url = "_api/lists/getbytitle('" + context.listName + "')/getItemById('" + id + "')";
|
|
479
|
-
|
|
597
|
+
_context2.n = 4;
|
|
480
598
|
return context.instance({
|
|
481
599
|
url: url,
|
|
482
600
|
method: 'POST',
|
|
483
|
-
data: JSON.stringify(
|
|
601
|
+
data: JSON.stringify(payload),
|
|
484
602
|
headers: {
|
|
485
603
|
'X-RequestDigest': formDigestValue,
|
|
486
604
|
'IF-MATCH': '*',
|
|
487
605
|
'X-Http-Method': 'PATCH'
|
|
488
606
|
}
|
|
489
607
|
});
|
|
608
|
+
case 4:
|
|
609
|
+
response = _context2.v;
|
|
610
|
+
return _context2.a(2, response);
|
|
611
|
+
}
|
|
612
|
+
}, _callee2);
|
|
613
|
+
}));
|
|
614
|
+
return _updateListItem.apply(this, arguments);
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
var SUPPORTED_VERSION$1 = '2013';
|
|
618
|
+
function uploadFile(_x, _x2) {
|
|
619
|
+
return _uploadFile.apply(this, arguments);
|
|
620
|
+
}
|
|
621
|
+
function _uploadFile() {
|
|
622
|
+
_uploadFile = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(context, _ref) {
|
|
623
|
+
var file, folderPath, _ref$overwrite, overwrite, requestUrl, encodedFileName, digest, response;
|
|
624
|
+
return _regenerator().w(function (_context) {
|
|
625
|
+
while (1) switch (_context.n) {
|
|
626
|
+
case 0:
|
|
627
|
+
file = _ref.file, folderPath = _ref.folderPath, _ref$overwrite = _ref.overwrite, overwrite = _ref$overwrite === void 0 ? true : _ref$overwrite;
|
|
628
|
+
if (!(context.sharepointVersion !== SUPPORTED_VERSION$1)) {
|
|
629
|
+
_context.n = 1;
|
|
630
|
+
break;
|
|
631
|
+
}
|
|
632
|
+
throw new Error('uploadFile is only supported for SharePoint 2013 REST endpoints.');
|
|
633
|
+
case 1:
|
|
634
|
+
if (file != null && file.name) {
|
|
635
|
+
_context.n = 2;
|
|
636
|
+
break;
|
|
637
|
+
}
|
|
638
|
+
throw new Error('A file with a valid name must be provided.');
|
|
639
|
+
case 2:
|
|
640
|
+
requestUrl = "_api/web/lists/getbytitle('" + context.listName + "')/RootFolder";
|
|
641
|
+
requestUrl += buildLibraryPath(folderPath);
|
|
642
|
+
encodedFileName = encodeFileName(file.name);
|
|
643
|
+
requestUrl += "/Files/add(url='" + encodedFileName + "',overwrite=" + (overwrite ? 'true' : 'false') + ")";
|
|
644
|
+
_context.n = 3;
|
|
645
|
+
return fetchDigest(context.instance, context.baseURL);
|
|
490
646
|
case 3:
|
|
647
|
+
digest = _context.v;
|
|
648
|
+
_context.n = 4;
|
|
649
|
+
return context.instance.post(requestUrl, file, {
|
|
650
|
+
headers: {
|
|
651
|
+
'Content-Type': file.type || 'application/octet-stream',
|
|
652
|
+
'X-RequestDigest': digest
|
|
653
|
+
},
|
|
654
|
+
withCredentials: true
|
|
655
|
+
});
|
|
656
|
+
case 4:
|
|
491
657
|
response = _context.v;
|
|
492
658
|
return _context.a(2, response);
|
|
493
659
|
}
|
|
494
660
|
}, _callee);
|
|
495
661
|
}));
|
|
496
|
-
return
|
|
662
|
+
return _uploadFile.apply(this, arguments);
|
|
497
663
|
}
|
|
498
664
|
|
|
499
665
|
function sendEmail(_x, _x2) {
|
|
@@ -717,6 +883,12 @@ function _currentUserPermissions() {
|
|
|
717
883
|
var HTTPSharePointRequests = /*#__PURE__*/function () {
|
|
718
884
|
function HTTPSharePointRequests(baseURL, config) {
|
|
719
885
|
var _this = this;
|
|
886
|
+
this.baseURL = void 0;
|
|
887
|
+
this.endpoint = void 0;
|
|
888
|
+
this.listName = void 0;
|
|
889
|
+
this.instance = void 0;
|
|
890
|
+
this.sharepointVersion = void 0;
|
|
891
|
+
this.listItemEntityTypeFullName = void 0;
|
|
720
892
|
this.lists = {
|
|
721
893
|
get: function get() {
|
|
722
894
|
_this.endpoint = '_api/web/lists';
|
|
@@ -777,6 +949,7 @@ var HTTPSharePointRequests = /*#__PURE__*/function () {
|
|
|
777
949
|
this.listName = '';
|
|
778
950
|
this.instance = instance(this.baseURL, config);
|
|
779
951
|
this.sharepointVersion = '2013';
|
|
952
|
+
this.listItemEntityTypeFullName = undefined;
|
|
780
953
|
}
|
|
781
954
|
var _proto = HTTPSharePointRequests.prototype;
|
|
782
955
|
_proto.getContext = function getContext() {
|
|
@@ -785,23 +958,78 @@ var HTTPSharePointRequests = /*#__PURE__*/function () {
|
|
|
785
958
|
baseURL: this.baseURL,
|
|
786
959
|
endpoint: this.endpoint,
|
|
787
960
|
listName: this.listName,
|
|
788
|
-
sharepointVersion: this.sharepointVersion
|
|
961
|
+
sharepointVersion: this.sharepointVersion,
|
|
962
|
+
listItemEntityTypeFullName: this.listItemEntityTypeFullName,
|
|
963
|
+
resolveListItemEntityType: this.resolveListItemEntityTypeFullName.bind(this)
|
|
789
964
|
};
|
|
790
|
-
}
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
965
|
+
};
|
|
966
|
+
_proto.resolveListItemEntityTypeFullName = /*#__PURE__*/function () {
|
|
967
|
+
var _resolveListItemEntityTypeFullName = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
968
|
+
var _response$data$d$List, _response$data, _response$data2;
|
|
969
|
+
var response, entityType;
|
|
970
|
+
return _regenerator().w(function (_context) {
|
|
971
|
+
while (1) switch (_context.n) {
|
|
972
|
+
case 0:
|
|
973
|
+
if (!this.listItemEntityTypeFullName) {
|
|
974
|
+
_context.n = 1;
|
|
975
|
+
break;
|
|
976
|
+
}
|
|
977
|
+
return _context.a(2, this.listItemEntityTypeFullName);
|
|
978
|
+
case 1:
|
|
979
|
+
if (this.listName) {
|
|
980
|
+
_context.n = 2;
|
|
981
|
+
break;
|
|
982
|
+
}
|
|
983
|
+
throw new Error('List name is not set.');
|
|
984
|
+
case 2:
|
|
985
|
+
if (!(this.sharepointVersion !== '2013')) {
|
|
986
|
+
_context.n = 3;
|
|
987
|
+
break;
|
|
988
|
+
}
|
|
989
|
+
this.listItemEntityTypeFullName = "SP.Data." + this.listName + "ListItem";
|
|
990
|
+
return _context.a(2, this.listItemEntityTypeFullName);
|
|
991
|
+
case 3:
|
|
992
|
+
_context.n = 4;
|
|
993
|
+
return this.instance.get("_api/web/lists/GetByTitle('" + this.listName + "')?$select=ListItemEntityTypeFullName");
|
|
994
|
+
case 4:
|
|
995
|
+
response = _context.v;
|
|
996
|
+
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;
|
|
997
|
+
if (!(!entityType || typeof entityType !== 'string')) {
|
|
998
|
+
_context.n = 5;
|
|
999
|
+
break;
|
|
1000
|
+
}
|
|
1001
|
+
throw new Error("Unable to resolve ListItemEntityTypeFullName for list \"" + this.listName + "\".");
|
|
1002
|
+
case 5:
|
|
1003
|
+
this.listItemEntityTypeFullName = entityType;
|
|
1004
|
+
return _context.a(2, this.listItemEntityTypeFullName);
|
|
1005
|
+
}
|
|
1006
|
+
}, _callee, this);
|
|
1007
|
+
}));
|
|
1008
|
+
function resolveListItemEntityTypeFullName() {
|
|
1009
|
+
return _resolveListItemEntityTypeFullName.apply(this, arguments);
|
|
1010
|
+
}
|
|
1011
|
+
return resolveListItemEntityTypeFullName;
|
|
1012
|
+
}()
|
|
1013
|
+
/**
|
|
1014
|
+
* @deprecated Use `from` instead.
|
|
1015
|
+
*/
|
|
1016
|
+
;
|
|
794
1017
|
_proto.list = function list(listName) {
|
|
795
1018
|
this.listName = listName;
|
|
796
1019
|
this.endpoint = "_vti_bin/ListData.svc/" + listName;
|
|
797
1020
|
this.sharepointVersion = '2010';
|
|
1021
|
+
this.listItemEntityTypeFullName = undefined;
|
|
798
1022
|
return this;
|
|
799
1023
|
};
|
|
1024
|
+
_proto.getDigest = function getDigest() {
|
|
1025
|
+
return fetchDigest(this.instance, this.baseURL);
|
|
1026
|
+
};
|
|
800
1027
|
_proto.from = function from(listName, sharepoint_ver) {
|
|
801
1028
|
var _this2 = this;
|
|
802
1029
|
var version = sharepoint_ver != null ? sharepoint_ver : '2013';
|
|
803
1030
|
this.listName = listName;
|
|
804
1031
|
this.sharepointVersion = version;
|
|
1032
|
+
this.listItemEntityTypeFullName = undefined;
|
|
805
1033
|
this.endpoint = version === '2013' ? "_api/web/lists/GetByTitle('" + this.listName + "')/items" : "_vti_bin/ListData.svc/" + listName;
|
|
806
1034
|
var getContext = function getContext() {
|
|
807
1035
|
return _this2.getContext();
|
|
@@ -822,6 +1050,12 @@ var HTTPSharePointRequests = /*#__PURE__*/function () {
|
|
|
822
1050
|
createFile: function createFile(props) {
|
|
823
1051
|
return createAttachment(getContext(), props);
|
|
824
1052
|
},
|
|
1053
|
+
uploadFile: function uploadFile$1(props) {
|
|
1054
|
+
return uploadFile(getContext(), props);
|
|
1055
|
+
},
|
|
1056
|
+
deleteFile: function deleteFile$1(props) {
|
|
1057
|
+
return deleteFile(getContext(), props);
|
|
1058
|
+
},
|
|
825
1059
|
fields: function fields(options) {
|
|
826
1060
|
_this2.endpoint = !(options != null && options.fieldName) ? "_api/web/lists/GetByTitle('" + _this2.listName + "')/fields" : "_api/web/lists/GetByTitle('" + _this2.listName + "')/fields/getbytitle('" + options.fieldName + "')";
|
|
827
1061
|
return {
|
|
@@ -878,8 +1112,8 @@ function createBase() {
|
|
|
878
1112
|
return new HTTPSharePointRequests(baseURL, config);
|
|
879
1113
|
}
|
|
880
1114
|
return {
|
|
881
|
-
/**
|
|
882
|
-
* @deprecated Use `create` instead.
|
|
1115
|
+
/**
|
|
1116
|
+
* @deprecated Use `create` instead.
|
|
883
1117
|
*/
|
|
884
1118
|
baseURL: function baseURL(url, config) {
|
|
885
1119
|
return create({
|