jitz-sharepoint-utilities 2.0.1 → 2.0.3

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.
@@ -199,7 +199,7 @@ export default class CommonRepository implements ICommonRepository {
199
199
  }
200
200
 
201
201
  public async updateMetadata(listName: string, item: any): Promise<any> {
202
- var item = await this.getEntityType(listName).then((entityType) => {
202
+ await this.getEntityType(listName).then((entityType) => {
203
203
  item.__metadata = {
204
204
  //etag: "1",
205
205
  type: entityType,
@@ -205,7 +205,6 @@ var CommonRepository = /** @class */ (function () {
205
205
  return __awaiter(this, void 0, void 0, function () {
206
206
  var url;
207
207
  var _this = this;
208
- var item;
209
208
  return __generator(this, function (_a) {
210
209
  switch (_a.label) {
211
210
  case 0: return [4 /*yield*/, this.getEntityType(listName).then(function (entityType) {
@@ -233,7 +232,7 @@ var CommonRepository = /** @class */ (function () {
233
232
  });
234
233
  })];
235
234
  case 1:
236
- item = _a.sent();
235
+ _a.sent();
237
236
  url = "/_api/web/lists/getbytitle('".concat(listName, "')/items(").concat(item.Id, ")?$select=*,File/Name,File/ServerRelativeUrl&$expand=File");
238
237
  return [2 /*return*/, this.context.client.get(url).then(function (response) {
239
238
  if (response.status >= 200 && response.status <= 300) {
@@ -1,5 +1,5 @@
1
1
  export default class UtilityService {
2
- static setCookie: (name: string, val: string) => void;
2
+ static setCookie: (name: string, val: string, validMinutes?: number) => void;
3
3
  static getCookie: (name: string) => string | undefined;
4
4
  static deleteCookie: (name: string) => void;
5
5
  static formatDate: (date: Date) => string;
@@ -7,11 +7,12 @@ var UtilityService = /** @class */ (function () {
7
7
  }
8
8
  var _a;
9
9
  _a = UtilityService;
10
- UtilityService.setCookie = function (name, val) {
10
+ UtilityService.setCookie = function (name, val, validMinutes) {
11
+ if (validMinutes === void 0) { validMinutes = 604800000; }
11
12
  var date = new Date();
12
13
  var value = val;
13
14
  // Set it expire in 7 days
14
- date.setTime(date.getTime() + 7 * 24 * 60 * 60 * 1000);
15
+ date.setTime(date.getTime() + validMinutes);
15
16
  // Set it
16
17
  document.cookie =
17
18
  name + "=" + value + "; expires=" + date.toUTCString() + "; path=/";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jitz-sharepoint-utilities",
3
- "version": "2.0.1",
3
+ "version": "2.0.3",
4
4
  "description": "Essential SharePoint utilities for SharePoint Add-in and SPFx development",
5
5
  "author": "Jithendra Mani",
6
6
  "license": "ISC",