jitz-sharepoint-utilities 2.0.17 → 2.0.19
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/data/context/List.ts
CHANGED
@@ -246,7 +246,7 @@ export default class List<T extends IModel> implements IList<T> {
|
|
246
246
|
// .catch((err) => {
|
247
247
|
// console.log(err);
|
248
248
|
// });
|
249
|
-
|
249
|
+
item = (item as any)?.data?.d || (item as any)?.data || item;
|
250
250
|
return item;
|
251
251
|
};
|
252
252
|
|
@@ -270,7 +270,7 @@ export default class List<T extends IModel> implements IList<T> {
|
|
270
270
|
// .catch((err) => {
|
271
271
|
// console.log(err);
|
272
272
|
// });
|
273
|
-
|
273
|
+
item = (item as any)?.data?.d || (item as any)?.data || item;
|
274
274
|
return item;
|
275
275
|
};
|
276
276
|
|
@@ -304,7 +304,7 @@ export default class Repository<T extends IModel> implements IRepository<T> {
|
|
304
304
|
})
|
305
305
|
.then((response: any): Promise<T> => {
|
306
306
|
if (response.status >= 200 && response.status < 300) {
|
307
|
-
var json = response
|
307
|
+
var json = response;
|
308
308
|
return json;
|
309
309
|
} else {
|
310
310
|
return Promise.reject(new Error(JSON.stringify(response)));
|
package/lib/data/context/List.js
CHANGED
@@ -255,13 +255,14 @@ var List = /** @class */ (function () {
|
|
255
255
|
}); };
|
256
256
|
this.create = function (item) { return __awaiter(_this, void 0, void 0, function () {
|
257
257
|
var newItem;
|
258
|
-
|
259
|
-
|
258
|
+
var _a;
|
259
|
+
return __generator(this, function (_b) {
|
260
|
+
switch (_b.label) {
|
260
261
|
case 0:
|
261
262
|
newItem = this.setPropertiesForSharePointApi(item);
|
262
263
|
return [4 /*yield*/, this.repository.createItem(newItem)];
|
263
264
|
case 1:
|
264
|
-
item =
|
265
|
+
item = _b.sent();
|
265
266
|
// await this.context.graphClient
|
266
267
|
// .api(`/sites/${this.context.siteId}/lists/${this.listName}/items`)
|
267
268
|
// .post({ fields: item })
|
@@ -271,19 +272,21 @@ var List = /** @class */ (function () {
|
|
271
272
|
// .catch((err) => {
|
272
273
|
// console.log(err);
|
273
274
|
// });
|
275
|
+
item = ((_a = item === null || item === void 0 ? void 0 : item.data) === null || _a === void 0 ? void 0 : _a.d) || (item === null || item === void 0 ? void 0 : item.data) || item;
|
274
276
|
return [2 /*return*/, item];
|
275
277
|
}
|
276
278
|
});
|
277
279
|
}); };
|
278
280
|
this.update = function (item) { return __awaiter(_this, void 0, void 0, function () {
|
279
281
|
var newItem;
|
280
|
-
|
281
|
-
|
282
|
+
var _a;
|
283
|
+
return __generator(this, function (_b) {
|
284
|
+
switch (_b.label) {
|
282
285
|
case 0:
|
283
286
|
newItem = this.setPropertiesForSharePointApi(item);
|
284
287
|
return [4 /*yield*/, this.repository.updateItem(newItem)];
|
285
288
|
case 1:
|
286
|
-
item =
|
289
|
+
item = _b.sent();
|
287
290
|
// let newObject: any = {};
|
288
291
|
// var itemAsAny = item as any;
|
289
292
|
// Object.keys(itemAsAny).forEach((key) => {
|
@@ -301,6 +304,7 @@ var List = /** @class */ (function () {
|
|
301
304
|
// .catch((err) => {
|
302
305
|
// console.log(err);
|
303
306
|
// });
|
307
|
+
item = ((_a = item === null || item === void 0 ? void 0 : item.data) === null || _a === void 0 ? void 0 : _a.d) || (item === null || item === void 0 ? void 0 : item.data) || item;
|
304
308
|
return [2 /*return*/, item];
|
305
309
|
}
|
306
310
|
});
|