jitz-sharepoint-utilities 1.11.2 → 2.0.0

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.
Files changed (94) hide show
  1. package/@types/allTypes.d.ts +1 -0
  2. package/controls/JitzGrid.tsx +639 -0
  3. package/controls/JitzImage.tsx +38 -0
  4. package/controls/JitzPeoplePicker.tsx +419 -0
  5. package/controls/JitzPersonInfo.tsx +114 -0
  6. package/controls/JitzPersona.tsx +53 -0
  7. package/data/context/CommonRepository.ts +287 -0
  8. package/data/context/JitzContext.ts +33 -0
  9. package/data/context/JitzSPContext.ts +16 -0
  10. package/data/context/JitzSPHttpClient.ts +133 -0
  11. package/data/context/List.ts +415 -0
  12. package/data/context/Repository.ts +395 -0
  13. package/data/interfaces/ICommonRepository.ts +7 -0
  14. package/data/interfaces/IJitzContext.ts +11 -0
  15. package/data/interfaces/IJitzSPContext.ts +7 -0
  16. package/data/interfaces/IJitzSPHttpClient.ts +6 -0
  17. package/data/interfaces/IList.ts +41 -0
  18. package/data/interfaces/IModels.ts +33 -0
  19. package/data/interfaces/IRepository.ts +31 -0
  20. package/lib/common/IModels.d.ts +9 -1
  21. package/lib/common/IObjects.d.ts +72 -0
  22. package/lib/common/IObjects.js +30 -0
  23. package/lib/controls/JitzGrid.d.ts +75 -0
  24. package/lib/controls/JitzGrid.js +606 -0
  25. package/lib/controls/JitzImage.d.ts +14 -0
  26. package/lib/controls/JitzImage.js +37 -0
  27. package/lib/controls/JitzPeoplePicker.d.ts +49 -0
  28. package/lib/controls/JitzPeoplePicker.js +311 -0
  29. package/lib/controls/JitzPersonInfo.d.ts +32 -0
  30. package/lib/controls/JitzPersonInfo.js +98 -0
  31. package/lib/controls/JitzPersona.d.ts +23 -0
  32. package/lib/controls/JitzPersona.js +48 -0
  33. package/lib/data/Activities.d.ts +6 -0
  34. package/lib/data/Activities.js +36 -0
  35. package/lib/data/Attachments.d.ts +6 -0
  36. package/lib/data/Attachments.js +30 -0
  37. package/lib/data/Configurations.d.ts +6 -0
  38. package/lib/data/Configurations.js +30 -0
  39. package/lib/data/CustomStylesheet.d.ts +6 -0
  40. package/lib/data/CustomStylesheet.js +30 -0
  41. package/lib/data/EmailTemplates.d.ts +6 -0
  42. package/lib/data/EmailTemplates.js +31 -0
  43. package/lib/data/FAQs.d.ts +6 -0
  44. package/lib/data/FAQs.js +30 -0
  45. package/lib/data/HomePageTexts.d.ts +6 -0
  46. package/lib/data/HomePageTexts.js +30 -0
  47. package/lib/data/TicketCategories.d.ts +6 -0
  48. package/lib/data/TicketCategories.js +26 -0
  49. package/lib/data/TicketComments.d.ts +6 -0
  50. package/lib/data/TicketComments.js +32 -0
  51. package/lib/data/TicketPriorities.d.ts +6 -0
  52. package/lib/data/TicketPriorities.js +31 -0
  53. package/lib/data/TicketStatuses.d.ts +6 -0
  54. package/lib/data/TicketStatuses.js +31 -0
  55. package/lib/data/TicketSubcategories.d.ts +6 -0
  56. package/lib/data/TicketSubcategories.js +26 -0
  57. package/lib/data/Tickets.d.ts +6 -0
  58. package/lib/data/Tickets.js +45 -0
  59. package/lib/data/context/CommonRepository.d.ts +17 -0
  60. package/lib/data/context/CommonRepository.js +288 -0
  61. package/lib/data/context/JitzContext.d.ts +13 -0
  62. package/lib/data/context/JitzContext.js +80 -0
  63. package/lib/data/context/JitzSPContext.d.ts +8 -0
  64. package/lib/data/context/JitzSPContext.js +58 -0
  65. package/lib/data/context/JitzSPHttpClient.d.ts +14 -0
  66. package/lib/data/context/JitzSPHttpClient.js +173 -0
  67. package/lib/data/context/List.d.ts +35 -0
  68. package/lib/data/context/List.js +442 -0
  69. package/lib/data/context/Repository.d.ts +19 -0
  70. package/lib/data/context/Repository.js +421 -0
  71. package/lib/data/interfaces/ICommonRepository.d.ts +6 -0
  72. package/lib/data/interfaces/ICommonRepository.js +2 -0
  73. package/lib/data/interfaces/IJitzContext.d.ts +10 -0
  74. package/lib/data/interfaces/IJitzContext.js +2 -0
  75. package/lib/data/interfaces/IJitzSPContext.d.ts +6 -0
  76. package/lib/data/interfaces/IJitzSPContext.js +2 -0
  77. package/lib/data/interfaces/IJitzSPHttpClient.d.ts +6 -0
  78. package/lib/data/interfaces/IJitzSPHttpClient.js +2 -0
  79. package/lib/data/interfaces/IList.d.ts +25 -0
  80. package/lib/data/interfaces/IList.js +2 -0
  81. package/lib/data/interfaces/IModels.d.ts +32 -0
  82. package/lib/data/interfaces/IModels.js +2 -0
  83. package/lib/data/interfaces/IRepository.d.ts +14 -0
  84. package/lib/data/interfaces/IRepository.js +2 -0
  85. package/lib/jitzSPHttpClient.js +5 -3
  86. package/lib/repositories/CommonRepository.js +89 -33
  87. package/lib/repositories/Repository.js +22 -21
  88. package/lib/services/GraphService.d.ts +10 -0
  89. package/lib/services/GraphService.js +105 -0
  90. package/lib/services/UserService.d.ts +1 -1
  91. package/lib/services/UserService.js +9 -9
  92. package/lib/services/UtilityService.d.ts +18 -12
  93. package/lib/services/UtilityService.js +157 -58
  94. package/package.json +7 -5
@@ -1,4 +1,40 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
2
38
  Object.defineProperty(exports, "__esModule", { value: true });
3
39
  var CommonRepository = /** @class */ (function () {
4
40
  function CommonRepository(context) {
@@ -9,7 +45,7 @@ var CommonRepository = /** @class */ (function () {
9
45
  type: "SP.Utilities.EmailProperties",
10
46
  };
11
47
  // console.log(JSON.stringify(email.properties));
12
- var requestUrl = this.context.siteUrl + "/_api/SP.Utilities.Utility.SendEmail";
48
+ var requestUrl = "".concat(this.context.siteUrl, "/_api/SP.Utilities.Utility.SendEmail");
13
49
  return this.context.client
14
50
  .post(requestUrl, email, {
15
51
  Accept: "application/json;odata=nometadata",
@@ -55,7 +91,7 @@ var CommonRepository = /** @class */ (function () {
55
91
  }
56
92
  queryUrlGetAllItems =
57
93
  queryUrlGetAllItems +
58
- ("&$skiptoken=Paged=TRUE%26p_" + skipTokenUniqueField + "=" + skipTokenUniqueFieldValue);
94
+ "&$skiptoken=Paged=TRUE%26p_".concat(skipTokenUniqueField, "=").concat(skipTokenUniqueFieldValue);
59
95
  }
60
96
  return this.context.client
61
97
  .get(queryUrlGetAllItems)
@@ -114,16 +150,16 @@ var CommonRepository = /** @class */ (function () {
114
150
  });
115
151
  };
116
152
  CommonRepository.prototype.getFiles = function (libraryName, selectFields, filter, expandFields) {
117
- var url = "/_api/web/lists/getbytitle('" + libraryName + "')/Items?$select=*,File/Name,File/ServerRelativeUrl";
153
+ var url = "/_api/web/lists/getbytitle('".concat(libraryName, "')/Items?$select=*,File/Name,File/ServerRelativeUrl");
118
154
  if (selectFields != undefined && selectFields.length > 0) {
119
- url = url + "," + selectFields;
155
+ url = "".concat(url, ",").concat(selectFields);
120
156
  }
121
157
  if (filter != undefined && filter.length > 0) {
122
- url = url + "&$filter=" + filter;
158
+ url = "".concat(url, "&$filter=").concat(filter);
123
159
  }
124
- url = url + "&$expand=File";
160
+ url = "".concat(url, "&$expand=File");
125
161
  if (expandFields != undefined && expandFields.length > 0) {
126
- url = url + "," + expandFields;
162
+ url = "".concat(url, ",").concat(expandFields);
127
163
  }
128
164
  return this.context.client.get(url).then(function (response) {
129
165
  if (response.status >= 200 && response.status <= 300) {
@@ -137,7 +173,7 @@ var CommonRepository = /** @class */ (function () {
137
173
  };
138
174
  CommonRepository.prototype.uploadFile = function (libraryName, fileName, arrayBuffer) {
139
175
  return this.context.client
140
- .postWithOutStringify("/_api/Web/Lists/getByTitle('" + libraryName + "')/RootFolder/Files/Add(url='" + fileName + "', overwrite=true)", arrayBuffer, {
176
+ .postWithOutStringify("/_api/Web/Lists/getByTitle('".concat(libraryName, "')/RootFolder/Files/Add(url='").concat(fileName, "', overwrite=true)"), arrayBuffer, {
141
177
  Accept: "application/json;odata=verbose",
142
178
  "content-length": arrayBuffer.byteLength.toString(),
143
179
  })
@@ -154,7 +190,7 @@ var CommonRepository = /** @class */ (function () {
154
190
  CommonRepository.prototype.getFileItem = function (libraryName, fileUrl) {
155
191
  // `${this._webAbsoluteUrl}/_api/web/GetFileByServerRelativeUrl('${fileUrl}')/$value`
156
192
  return this.context.client
157
- .get("/_api/web/lists/getbytitle('" + libraryName + "')/Items?$filter=FileLeafRef eq '" + fileUrl + "'&$select=Id")
193
+ .get("/_api/web/lists/getbytitle('".concat(libraryName, "')/Items?$filter=FileLeafRef eq '").concat(fileUrl, "'&$select=Id"))
158
194
  .then(function (response) {
159
195
  if (response.status >= 200 && response.status <= 300) {
160
196
  var json = response.data.d;
@@ -166,34 +202,54 @@ var CommonRepository = /** @class */ (function () {
166
202
  });
167
203
  };
168
204
  CommonRepository.prototype.updateMetadata = function (listName, item) {
169
- var _this = this;
170
- return this.getEntityType(listName).then(function (entityType) {
171
- item.__metadata = {
172
- //etag: "1",
173
- type: entityType,
174
- };
175
- var requestUrl = "_api/web/lists/getbytitle('" + listName + "')/items(" + item.Id + ")?$select=*,File/Name,File/ServerRelativeUrl&$expand=File";
176
- return _this.context.client
177
- .post(requestUrl, item, {
178
- Accept: "application/json;odata=nometadata",
179
- "Content-type": "application/json;odata=verbose",
180
- "odata-version": "",
181
- "IF-MATCH": "*",
182
- "X-HTTP-Method": "MERGE",
183
- })
184
- .then(function (response) {
185
- if (response.status >= 200 && response.status < 300) {
186
- return item;
187
- }
188
- else {
189
- console.log(JSON.stringify(response));
190
- return Promise.reject(new Error(JSON.stringify(response)));
205
+ return __awaiter(this, void 0, void 0, function () {
206
+ var url;
207
+ var _this = this;
208
+ var item;
209
+ return __generator(this, function (_a) {
210
+ switch (_a.label) {
211
+ case 0: return [4 /*yield*/, this.getEntityType(listName).then(function (entityType) {
212
+ item.__metadata = {
213
+ //etag: "1",
214
+ type: entityType,
215
+ };
216
+ var requestUrl = "_api/web/lists/getbytitle('".concat(listName, "')/items(").concat(item.Id, ")");
217
+ return _this.context.client
218
+ .post(requestUrl, item, {
219
+ Accept: "application/json;odata=nometadata",
220
+ "Content-type": "application/json;odata=verbose",
221
+ "odata-version": "",
222
+ "IF-MATCH": "*",
223
+ "X-HTTP-Method": "MERGE",
224
+ })
225
+ .then(function (response) {
226
+ if (response.status >= 200 && response.status < 300) {
227
+ return item;
228
+ }
229
+ else {
230
+ console.log(JSON.stringify(response));
231
+ return Promise.reject(new Error(JSON.stringify(response)));
232
+ }
233
+ });
234
+ })];
235
+ case 1:
236
+ item = _a.sent();
237
+ url = "/_api/web/lists/getbytitle('".concat(listName, "')/items(").concat(item.Id, ")?$select=*,File/Name,File/ServerRelativeUrl&$expand=File");
238
+ return [2 /*return*/, this.context.client.get(url).then(function (response) {
239
+ if (response.status >= 200 && response.status <= 300) {
240
+ var json = response.data.d;
241
+ return json;
242
+ }
243
+ else {
244
+ return Promise.reject(new Error(JSON.stringify(response)));
245
+ }
246
+ })];
191
247
  }
192
248
  });
193
249
  });
194
250
  };
195
251
  CommonRepository.prototype.deleteFile = function (listName, id) {
196
- var requestUrl = "_api/web/lists/getbytitle('" + listName + "')/items(" + id + ")";
252
+ var requestUrl = "_api/web/lists/getbytitle('".concat(listName, "')/items(").concat(id, ")");
197
253
  return this.context.client
198
254
  .post(requestUrl, {}, {
199
255
  Accept: "application/json;odata=nometadata",
@@ -215,7 +271,7 @@ var CommonRepository = /** @class */ (function () {
215
271
  var _this = this;
216
272
  return new Promise(function (resolve, reject) {
217
273
  _this.context.client
218
- .get("_api/web/lists/getbytitle('" + listName + "')?$select=ListItemEntityTypeFullName")
274
+ .get("_api/web/lists/getbytitle('".concat(listName, "')?$select=ListItemEntityTypeFullName"))
219
275
  .then(function (response) {
220
276
  return response;
221
277
  }, function (error) {
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
4
  return new (P || (P = Promise))(function (resolve, reject) {
4
5
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
6
  function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
9
  });
9
10
  };
@@ -13,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
13
14
  function verb(n) { return function (v) { return step([n, v]); }; }
14
15
  function step(op) {
15
16
  if (f) throw new TypeError("Generator is already executing.");
16
- while (_) try {
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
18
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
19
  if (y = 0, t) op = [op[0] & 2, t.value];
19
20
  switch (op[0]) {
@@ -41,7 +42,7 @@ var Repository = /** @class */ (function () {
41
42
  this.listName = listName;
42
43
  }
43
44
  Repository.prototype.getAll = function (selectFields, expand, filters, orderBy, top, skipTokenUniqueField, skipTokenUniqueFieldValue) {
44
- var queryUrlGetAllItems = this.context.siteUrl + "/_api/web/lists/GetByTitle('" +
45
+ var queryUrlGetAllItems = "".concat(this.context.siteUrl, "/_api/web/lists/GetByTitle('") +
45
46
  this.listName +
46
47
  "')/items";
47
48
  console.log(queryUrlGetAllItems);
@@ -72,7 +73,7 @@ var Repository = /** @class */ (function () {
72
73
  }
73
74
  queryUrlGetAllItems =
74
75
  queryUrlGetAllItems +
75
- ("&$skiptoken=Paged=TRUE%26p_" + skipTokenUniqueField + "=" + skipTokenUniqueFieldValue);
76
+ "&$skiptoken=Paged=TRUE%26p_".concat(skipTokenUniqueField, "=").concat(skipTokenUniqueFieldValue);
76
77
  }
77
78
  return this.context.client
78
79
  .get(queryUrlGetAllItems)
@@ -99,16 +100,16 @@ var Repository = /** @class */ (function () {
99
100
  throw ex;
100
101
  });
101
102
  };
102
- Repository.prototype.getAllRecursive = function (selectFields, expand, filters, orderBy, top, maxRecursiveCount) {
103
- if (maxRecursiveCount === void 0) { maxRecursiveCount = 5; }
104
- return __awaiter(this, void 0, void 0, function () {
103
+ Repository.prototype.getAllRecursive = function (selectFields_1, expand_1, filters_1, orderBy_1, top_1) {
104
+ return __awaiter(this, arguments, void 0, function (selectFields, expand, filters, orderBy, top, maxRecursiveCount) {
105
105
  var items, queryUrlGetAllItems;
106
106
  var _this = this;
107
+ if (maxRecursiveCount === void 0) { maxRecursiveCount = 5; }
107
108
  return __generator(this, function (_a) {
108
109
  switch (_a.label) {
109
110
  case 0:
110
111
  items = [];
111
- queryUrlGetAllItems = this.context.siteUrl + "/_api/web/lists/GetByTitle('" +
112
+ queryUrlGetAllItems = "".concat(this.context.siteUrl, "/_api/web/lists/GetByTitle('") +
112
113
  this.listName +
113
114
  "')/items";
114
115
  if (selectFields != null && selectFields != "") {
@@ -177,12 +178,12 @@ var Repository = /** @class */ (function () {
177
178
  });
178
179
  });
179
180
  };
180
- Repository.prototype.recursiveFetch = function (url, recursiveCount, maxRecursiveCount, items) {
181
- if (recursiveCount === void 0) { recursiveCount = 1; }
182
- if (maxRecursiveCount === void 0) { maxRecursiveCount = 5; }
183
- if (items === void 0) { items = []; }
184
- return __awaiter(this, void 0, void 0, function () {
181
+ Repository.prototype.recursiveFetch = function (url_1) {
182
+ return __awaiter(this, arguments, void 0, function (url, recursiveCount, maxRecursiveCount, items) {
185
183
  var _this = this;
184
+ if (recursiveCount === void 0) { recursiveCount = 1; }
185
+ if (maxRecursiveCount === void 0) { maxRecursiveCount = 5; }
186
+ if (items === void 0) { items = []; }
186
187
  return __generator(this, function (_a) {
187
188
  switch (_a.label) {
188
189
  case 0:
@@ -238,7 +239,7 @@ var Repository = /** @class */ (function () {
238
239
  });
239
240
  };
240
241
  Repository.prototype.itemsCount = function (filters) {
241
- var queryUrlGetAllItems = this.context.siteUrl + "/_api/web/lists/GetByTitle('" +
242
+ var queryUrlGetAllItems = "".concat(this.context.siteUrl, "/_api/web/lists/GetByTitle('") +
242
243
  this.listName +
243
244
  "')/ItemCount";
244
245
  if (filters != null && filters != "") {
@@ -269,13 +270,13 @@ var Repository = /** @class */ (function () {
269
270
  return __generator(this, function (_a) {
270
271
  switch (_a.label) {
271
272
  case 0:
272
- queryUrl = this.context.siteUrl + "/_api/web/lists/getByTitle('" +
273
+ queryUrl = "".concat(this.context.siteUrl, "/_api/web/lists/getByTitle('") +
273
274
  this.listName +
274
275
  "')/items(" +
275
276
  id +
276
277
  ")" +
277
- ("?$select=*" + (selectFields != undefined ? "," + selectFields : "")) +
278
- ("" + (expand != undefined ? "&$expand=" + expand : ""));
278
+ "?$select=*".concat(selectFields != undefined ? ",".concat(selectFields) : "") +
279
+ "".concat(expand != undefined ? "&$expand=".concat(expand) : "");
279
280
  return [4 /*yield*/, this.context.client
280
281
  .get(queryUrl)
281
282
  .then(function (response) {
@@ -304,7 +305,7 @@ var Repository = /** @class */ (function () {
304
305
  item.__metadata = {
305
306
  type: entityType,
306
307
  };
307
- var requestUrl = _this.context.siteUrl + "/_api/web/lists/getbytitle('" + _this.listName + "')/items";
308
+ var requestUrl = "".concat(_this.context.siteUrl, "/_api/web/lists/getbytitle('").concat(_this.listName, "')/items");
308
309
  return _this.context.client
309
310
  .post(requestUrl, item, {
310
311
  Accept: "application/json;odata=nometadata",
@@ -329,7 +330,7 @@ var Repository = /** @class */ (function () {
329
330
  //etag: "1",
330
331
  type: entityType,
331
332
  };
332
- var requestUrl = _this.context.siteUrl + "/_api/web/lists/getbytitle('" + _this.listName + "')/items(" + item.Id + ")";
333
+ var requestUrl = "".concat(_this.context.siteUrl, "/_api/web/lists/getbytitle('").concat(_this.listName, "')/items(").concat(item.Id, ")");
333
334
  return _this.context.client
334
335
  .post(requestUrl, item, {
335
336
  Accept: "application/json;odata=nometadata",
@@ -350,7 +351,7 @@ var Repository = /** @class */ (function () {
350
351
  });
351
352
  };
352
353
  Repository.prototype.deleteItem = function (id) {
353
- var requestUrl = this.context.siteUrl + "/_api/web/lists/getbytitle('" + this.listName + "')/items(" + id + ")";
354
+ var requestUrl = "".concat(this.context.siteUrl, "/_api/web/lists/getbytitle('").concat(this.listName, "')/items(").concat(id, ")");
354
355
  return this.context.client
355
356
  .post(requestUrl, {}, {
356
357
  Accept: "application/json;odata=nometadata",
@@ -376,7 +377,7 @@ var Repository = /** @class */ (function () {
376
377
  return;
377
378
  }
378
379
  _this.context.client
379
- .get(_this.context.siteUrl + "/_api/web/lists/getbytitle('" + _this.listName + "')?$select=ListItemEntityTypeFullName")
380
+ .get("".concat(_this.context.siteUrl, "/_api/web/lists/getbytitle('").concat(_this.listName, "')?$select=ListItemEntityTypeFullName"))
380
381
  .then(function (response) {
381
382
  return response;
382
383
  }, function (error) {
@@ -0,0 +1,10 @@
1
+ import { WebPartContext } from "@microsoft/sp-webpart-base";
2
+ export default class GraphService {
3
+ private _context;
4
+ private context;
5
+ private client;
6
+ constructor(_context: WebPartContext);
7
+ init(): Promise<void>;
8
+ getListItems(siteId: string): Promise<string>;
9
+ getUserId(userUPN: string): Promise<string>;
10
+ }
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ var GraphService = /** @class */ (function () {
40
+ function GraphService(_context) {
41
+ this._context = _context;
42
+ this.context = _context;
43
+ }
44
+ GraphService.prototype.init = function () {
45
+ return __awaiter(this, void 0, void 0, function () {
46
+ var _this = this;
47
+ return __generator(this, function (_a) {
48
+ switch (_a.label) {
49
+ case 0: return [4 /*yield*/, this.context.msGraphClientFactory
50
+ .getClient("3") // Init Microsoft Graph Client
51
+ .then(function (client) {
52
+ _this.client = client;
53
+ })];
54
+ case 1:
55
+ _a.sent();
56
+ return [2 /*return*/];
57
+ }
58
+ });
59
+ });
60
+ };
61
+ GraphService.prototype.getListItems = function (siteId) {
62
+ return __awaiter(this, void 0, void 0, function () {
63
+ return __generator(this, function (_a) {
64
+ switch (_a.label) {
65
+ case 0: return [4 /*yield*/, this.client
66
+ .api("/sites/".concat(siteId, "/lists/f2991442-109b-4778-845b-6e11b1d6fed9/items?expand=fields($select=TicketCategory,TicketCategoryLookupId)&top=1")) //Get Presence method
67
+ .version("beta") // Beta version
68
+ // .select("id") // Select only ID attribute
69
+ .get(function (err, res) {
70
+ if (err) {
71
+ console.log(err);
72
+ return err;
73
+ }
74
+ console.log(res);
75
+ return res;
76
+ })];
77
+ case 1: return [2 /*return*/, _a.sent()];
78
+ }
79
+ });
80
+ });
81
+ };
82
+ GraphService.prototype.getUserId = function (userUPN) {
83
+ return __awaiter(this, void 0, void 0, function () {
84
+ return __generator(this, function (_a) {
85
+ switch (_a.label) {
86
+ case 0: return [4 /*yield*/, this.client
87
+ .api("users/".concat(userUPN)) //Get Presence method
88
+ .version("beta") // Beta version
89
+ .select("id") // Select only ID attribute
90
+ .get(function (err, res) {
91
+ if (err) {
92
+ console.log(err);
93
+ return err;
94
+ }
95
+ console.log(res);
96
+ return res;
97
+ })];
98
+ case 1: return [2 /*return*/, _a.sent()];
99
+ }
100
+ });
101
+ });
102
+ };
103
+ return GraphService;
104
+ }());
105
+ exports.default = GraphService;
@@ -1,5 +1,5 @@
1
- import { IJitzSPContext } from "../jitzSPHttpClient";
2
1
  import { IPersonOrGroup } from "../common/IModels";
2
+ import { IJitzSPContext } from "../jitzSPHttpClient";
3
3
  export default class UserService {
4
4
  private _context;
5
5
  private _webAbsoluteUrl;
@@ -38,14 +38,14 @@ var UserService = /** @class */ (function () {
38
38
  });
39
39
  });
40
40
  }
41
- user.Groups = groups;
41
+ // user.Groups = groups;
42
42
  return user;
43
43
  });
44
44
  };
45
45
  this.getUserProperties = function (accountName) {
46
46
  return _this._context.client
47
47
  .get(_this._webAbsoluteUrl +
48
- ("/_api/SP.UserProfiles.PeopleManager/GetPropertiesFor(accountName=@v)?@v='" + encodeURIComponent(accountName) + "'"))
48
+ "/_api/SP.UserProfiles.PeopleManager/GetPropertiesFor(accountName=@v)?@v='".concat(encodeURIComponent(accountName), "'"))
49
49
  .then(function (response) {
50
50
  if (response.status >= 200 && response.status <= 300) {
51
51
  return response.data.d;
@@ -60,7 +60,7 @@ var UserService = /** @class */ (function () {
60
60
  };
61
61
  this.getUserPropertiesByEmail = function (email) {
62
62
  return _this._context.client
63
- .get(_this._webAbsoluteUrl + ("/_api/Web/SiteUsers?$filter=Email eq '" + email + "'"))
63
+ .get(_this._webAbsoluteUrl + "/_api/Web/SiteUsers?$filter=Email eq '".concat(email, "'"))
64
64
  .then(function (response) {
65
65
  if (response.status >= 200 && response.status <= 300) {
66
66
  return response.data.d;
@@ -75,7 +75,7 @@ var UserService = /** @class */ (function () {
75
75
  };
76
76
  this.getUserById = function (id) {
77
77
  return _this._context.client
78
- .get(_this._webAbsoluteUrl + ("/_api/web/getUserById(" + id + ")?$expand=groups"))
78
+ .get(_this._webAbsoluteUrl + "/_api/web/getUserById(".concat(id, ")?$expand=groups"))
79
79
  .then(function (response) {
80
80
  if (response.status >= 200 && response.status <= 300) {
81
81
  return response.data.d;
@@ -108,12 +108,12 @@ var UserService = /** @class */ (function () {
108
108
  });
109
109
  });
110
110
  }
111
- user.Groups = groups;
111
+ // user.Groups = groups;
112
112
  return user;
113
113
  });
114
114
  };
115
115
  this.getCurrentUserPermissions = function () {
116
- var requestUrl = _this._context.siteUrl + "/_api/Web/effectiveBasePermissions";
116
+ var requestUrl = "".concat(_this._context.siteUrl, "/_api/Web/effectiveBasePermissions");
117
117
  return _this._context.client
118
118
  .get(requestUrl)
119
119
  .then(function (response) {
@@ -132,7 +132,7 @@ var UserService = /** @class */ (function () {
132
132
  this._webAbsoluteUrl = context.siteUrl;
133
133
  }
134
134
  UserService.prototype.getCurrentUserGroups = function () {
135
- var requestUrl = this._context.siteUrl + "/_api/web/currentuser/?$expand=groups";
135
+ var requestUrl = "".concat(this._context.siteUrl, "/_api/web/currentuser/?$expand=groups");
136
136
  return this._context.client
137
137
  .get(requestUrl)
138
138
  .then(function (response) {
@@ -160,7 +160,7 @@ var UserService = /** @class */ (function () {
160
160
  });
161
161
  };
162
162
  UserService.prototype.checkIfCurrentUserInGroup = function (groupName) {
163
- var requestUrl = this._context.siteUrl + "/_api/web/currentuser/?$expand=groups";
163
+ var requestUrl = "".concat(this._context.siteUrl, "/_api/web/currentuser/?$expand=groups");
164
164
  return this._context.client
165
165
  .get(requestUrl)
166
166
  .then(function (response) {
@@ -179,7 +179,7 @@ var UserService = /** @class */ (function () {
179
179
  });
180
180
  };
181
181
  UserService.prototype.checkIfUserIsInGroup = function (userId, groupName) {
182
- var requestUrl = this._context.siteUrl + "/_api/web/getUserById(" + userId + ")?$expand=groups";
182
+ var requestUrl = "".concat(this._context.siteUrl, "/_api/web/getUserById(").concat(userId, ")?$expand=groups");
183
183
  return this._context.client
184
184
  .get(requestUrl)
185
185
  .then(function (response) {
@@ -1,22 +1,28 @@
1
- import { IJitzSPContext } from "../jitzSPHttpClient";
2
1
  export default class UtilityService {
3
- private _context;
4
- private _webAbsoluteUrl;
5
- constructor(context: IJitzSPContext);
6
- static monthNames: string[];
7
- static monthNamesFull: string[];
8
- static setCookie: (name: string, val: string, validMinutes?: number) => void;
2
+ static setCookie: (name: string, val: string) => void;
9
3
  static getCookie: (name: string) => string | undefined;
10
4
  static deleteCookie: (name: string) => void;
11
5
  static formatDate: (date: Date) => string;
12
- static formatDateToMonthAndDate: (date: Date) => string;
13
- static getMonthFullNameOfTheDate: (date: Date) => string;
14
- static getMonthOfTheDate: (date: Date) => string;
6
+ static getMonthsArrayShort: () => string[];
7
+ static getMonthsArrayFullString: () => string[];
8
+ static getMonthShortString: (month: number) => string;
9
+ static getMonthFullString: (month: number) => string;
10
+ static getPastMonthsArrayShort: (num: number) => string[];
15
11
  static addMonthsToDate: (date: Date, months: number) => Date;
16
- static addDaysToDate: (date: Date, days: number) => Date;
12
+ static getStartOfTheDay: (date: Date) => Date;
13
+ static getEndOfTheDay: (date: Date) => Date;
14
+ static addDaysToMonth: (date: Date, days: number) => Date;
17
15
  static addHoursToDate: (date: Date, hours: number) => Date;
18
16
  static addMinutesToDate: (date: Date, minutes: number) => Date;
19
- static generateGUID: () => string;
17
+ static addSecondsToDate: (date: Date, seconds: number) => Date;
18
+ static getFirstDayOfTheMonth: (date: Date) => Date;
19
+ static getLastDayOfTheMonth: (date: Date) => Date;
20
+ static getDaysInMonth: (year: number, month: number) => number;
21
+ static isLeapYear: (year: number) => boolean;
22
+ static generateGUID: () => any;
23
+ static generateTimeString: (date: Date) => string;
20
24
  static exportJsonAsExcelSheet: (json: any[], fileTitle: string) => void;
21
25
  static LightenDarkenColor: (col: string, amt: number) => string;
26
+ static getProfilePictureUrl: (siteUrl: string, email: string, apiType?: string, size?: string) => string;
27
+ static getRandomColorCode: () => string;
22
28
  }