jitz-sharepoint-utilities 1.11.3 → 2.0.1
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/@types/allTypes.d.ts +1 -0
- package/controls/JitzGrid.tsx +639 -0
- package/controls/JitzImage.tsx +38 -0
- package/controls/JitzPeoplePicker.tsx +419 -0
- package/controls/JitzPersonInfo.tsx +114 -0
- package/controls/JitzPersona.tsx +53 -0
- package/data/context/CommonRepository.ts +287 -0
- package/data/context/JitzContext.ts +33 -0
- package/data/context/JitzSPContext.ts +16 -0
- package/data/context/JitzSPHttpClient.ts +133 -0
- package/data/context/List.ts +429 -0
- package/data/context/Repository.ts +395 -0
- package/data/interfaces/ICommonRepository.ts +7 -0
- package/data/interfaces/IJitzContext.ts +11 -0
- package/data/interfaces/IJitzSPContext.ts +7 -0
- package/data/interfaces/IJitzSPHttpClient.ts +6 -0
- package/data/interfaces/IList.ts +41 -0
- package/data/interfaces/IModels.ts +33 -0
- package/data/interfaces/IRepository.ts +31 -0
- package/lib/common/IModels.d.ts +9 -1
- package/lib/common/IObjects.d.ts +72 -0
- package/lib/common/IObjects.js +30 -0
- package/lib/controls/JitzGrid.d.ts +75 -0
- package/lib/controls/JitzGrid.js +606 -0
- package/lib/controls/JitzImage.d.ts +14 -0
- package/lib/controls/JitzImage.js +37 -0
- package/lib/controls/JitzPeoplePicker.d.ts +49 -0
- package/lib/controls/JitzPeoplePicker.js +311 -0
- package/lib/controls/JitzPersonInfo.d.ts +32 -0
- package/lib/controls/JitzPersonInfo.js +98 -0
- package/lib/controls/JitzPersona.d.ts +23 -0
- package/lib/controls/JitzPersona.js +48 -0
- package/lib/data/Activities.d.ts +6 -0
- package/lib/data/Activities.js +36 -0
- package/lib/data/Attachments.d.ts +6 -0
- package/lib/data/Attachments.js +30 -0
- package/lib/data/Configurations.d.ts +6 -0
- package/lib/data/Configurations.js +30 -0
- package/lib/data/CustomStylesheet.d.ts +6 -0
- package/lib/data/CustomStylesheet.js +30 -0
- package/lib/data/EmailTemplates.d.ts +6 -0
- package/lib/data/EmailTemplates.js +31 -0
- package/lib/data/FAQs.d.ts +6 -0
- package/lib/data/FAQs.js +30 -0
- package/lib/data/HomePageTexts.d.ts +6 -0
- package/lib/data/HomePageTexts.js +30 -0
- package/lib/data/TicketCategories.d.ts +6 -0
- package/lib/data/TicketCategories.js +26 -0
- package/lib/data/TicketComments.d.ts +6 -0
- package/lib/data/TicketComments.js +32 -0
- package/lib/data/TicketPriorities.d.ts +6 -0
- package/lib/data/TicketPriorities.js +31 -0
- package/lib/data/TicketStatuses.d.ts +6 -0
- package/lib/data/TicketStatuses.js +31 -0
- package/lib/data/TicketSubcategories.d.ts +6 -0
- package/lib/data/TicketSubcategories.js +26 -0
- package/lib/data/Tickets.d.ts +6 -0
- package/lib/data/Tickets.js +45 -0
- package/lib/data/context/CommonRepository.d.ts +17 -0
- package/lib/data/context/CommonRepository.js +288 -0
- package/lib/data/context/JitzContext.d.ts +13 -0
- package/lib/data/context/JitzContext.js +80 -0
- package/lib/data/context/JitzSPContext.d.ts +8 -0
- package/lib/data/context/JitzSPContext.js +58 -0
- package/lib/data/context/JitzSPHttpClient.d.ts +14 -0
- package/lib/data/context/JitzSPHttpClient.js +173 -0
- package/lib/data/context/List.d.ts +36 -0
- package/lib/data/context/List.js +450 -0
- package/lib/data/context/Repository.d.ts +19 -0
- package/lib/data/context/Repository.js +421 -0
- package/lib/data/interfaces/ICommonRepository.d.ts +6 -0
- package/lib/data/interfaces/ICommonRepository.js +2 -0
- package/lib/data/interfaces/IJitzContext.d.ts +10 -0
- package/lib/data/interfaces/IJitzContext.js +2 -0
- package/lib/data/interfaces/IJitzSPContext.d.ts +6 -0
- package/lib/data/interfaces/IJitzSPContext.js +2 -0
- package/lib/data/interfaces/IJitzSPHttpClient.d.ts +6 -0
- package/lib/data/interfaces/IJitzSPHttpClient.js +2 -0
- package/lib/data/interfaces/IList.d.ts +25 -0
- package/lib/data/interfaces/IList.js +2 -0
- package/lib/data/interfaces/IModels.d.ts +32 -0
- package/lib/data/interfaces/IModels.js +2 -0
- package/lib/data/interfaces/IRepository.d.ts +14 -0
- package/lib/data/interfaces/IRepository.js +2 -0
- package/lib/jitzSPHttpClient.js +5 -3
- package/lib/repositories/CommonRepository.js +17 -16
- package/lib/repositories/Repository.js +22 -21
- package/lib/services/GraphService.d.ts +10 -0
- package/lib/services/GraphService.js +105 -0
- package/lib/services/UserService.d.ts +1 -1
- package/lib/services/UserService.js +9 -9
- package/lib/services/UtilityService.d.ts +18 -12
- package/lib/services/UtilityService.js +157 -58
- package/package.json +7 -5
@@ -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) :
|
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]) {
|
@@ -44,7 +45,7 @@ var CommonRepository = /** @class */ (function () {
|
|
44
45
|
type: "SP.Utilities.EmailProperties",
|
45
46
|
};
|
46
47
|
// console.log(JSON.stringify(email.properties));
|
47
|
-
var requestUrl = this.context.siteUrl
|
48
|
+
var requestUrl = "".concat(this.context.siteUrl, "/_api/SP.Utilities.Utility.SendEmail");
|
48
49
|
return this.context.client
|
49
50
|
.post(requestUrl, email, {
|
50
51
|
Accept: "application/json;odata=nometadata",
|
@@ -90,7 +91,7 @@ var CommonRepository = /** @class */ (function () {
|
|
90
91
|
}
|
91
92
|
queryUrlGetAllItems =
|
92
93
|
queryUrlGetAllItems +
|
93
|
-
|
94
|
+
"&$skiptoken=Paged=TRUE%26p_".concat(skipTokenUniqueField, "=").concat(skipTokenUniqueFieldValue);
|
94
95
|
}
|
95
96
|
return this.context.client
|
96
97
|
.get(queryUrlGetAllItems)
|
@@ -149,16 +150,16 @@ var CommonRepository = /** @class */ (function () {
|
|
149
150
|
});
|
150
151
|
};
|
151
152
|
CommonRepository.prototype.getFiles = function (libraryName, selectFields, filter, expandFields) {
|
152
|
-
var url = "/_api/web/lists/getbytitle('"
|
153
|
+
var url = "/_api/web/lists/getbytitle('".concat(libraryName, "')/Items?$select=*,File/Name,File/ServerRelativeUrl");
|
153
154
|
if (selectFields != undefined && selectFields.length > 0) {
|
154
|
-
url = url
|
155
|
+
url = "".concat(url, ",").concat(selectFields);
|
155
156
|
}
|
156
157
|
if (filter != undefined && filter.length > 0) {
|
157
|
-
url = url
|
158
|
+
url = "".concat(url, "&$filter=").concat(filter);
|
158
159
|
}
|
159
|
-
url = url
|
160
|
+
url = "".concat(url, "&$expand=File");
|
160
161
|
if (expandFields != undefined && expandFields.length > 0) {
|
161
|
-
url = url
|
162
|
+
url = "".concat(url, ",").concat(expandFields);
|
162
163
|
}
|
163
164
|
return this.context.client.get(url).then(function (response) {
|
164
165
|
if (response.status >= 200 && response.status <= 300) {
|
@@ -172,7 +173,7 @@ var CommonRepository = /** @class */ (function () {
|
|
172
173
|
};
|
173
174
|
CommonRepository.prototype.uploadFile = function (libraryName, fileName, arrayBuffer) {
|
174
175
|
return this.context.client
|
175
|
-
.postWithOutStringify("/_api/Web/Lists/getByTitle('"
|
176
|
+
.postWithOutStringify("/_api/Web/Lists/getByTitle('".concat(libraryName, "')/RootFolder/Files/Add(url='").concat(fileName, "', overwrite=true)"), arrayBuffer, {
|
176
177
|
Accept: "application/json;odata=verbose",
|
177
178
|
"content-length": arrayBuffer.byteLength.toString(),
|
178
179
|
})
|
@@ -189,7 +190,7 @@ var CommonRepository = /** @class */ (function () {
|
|
189
190
|
CommonRepository.prototype.getFileItem = function (libraryName, fileUrl) {
|
190
191
|
// `${this._webAbsoluteUrl}/_api/web/GetFileByServerRelativeUrl('${fileUrl}')/$value`
|
191
192
|
return this.context.client
|
192
|
-
.get("/_api/web/lists/getbytitle('"
|
193
|
+
.get("/_api/web/lists/getbytitle('".concat(libraryName, "')/Items?$filter=FileLeafRef eq '").concat(fileUrl, "'&$select=Id"))
|
193
194
|
.then(function (response) {
|
194
195
|
if (response.status >= 200 && response.status <= 300) {
|
195
196
|
var json = response.data.d;
|
@@ -201,10 +202,10 @@ var CommonRepository = /** @class */ (function () {
|
|
201
202
|
});
|
202
203
|
};
|
203
204
|
CommonRepository.prototype.updateMetadata = function (listName, item) {
|
204
|
-
var item;
|
205
205
|
return __awaiter(this, void 0, void 0, function () {
|
206
206
|
var url;
|
207
207
|
var _this = this;
|
208
|
+
var item;
|
208
209
|
return __generator(this, function (_a) {
|
209
210
|
switch (_a.label) {
|
210
211
|
case 0: return [4 /*yield*/, this.getEntityType(listName).then(function (entityType) {
|
@@ -212,7 +213,7 @@ var CommonRepository = /** @class */ (function () {
|
|
212
213
|
//etag: "1",
|
213
214
|
type: entityType,
|
214
215
|
};
|
215
|
-
var requestUrl = "_api/web/lists/getbytitle('"
|
216
|
+
var requestUrl = "_api/web/lists/getbytitle('".concat(listName, "')/items(").concat(item.Id, ")");
|
216
217
|
return _this.context.client
|
217
218
|
.post(requestUrl, item, {
|
218
219
|
Accept: "application/json;odata=nometadata",
|
@@ -233,7 +234,7 @@ var CommonRepository = /** @class */ (function () {
|
|
233
234
|
})];
|
234
235
|
case 1:
|
235
236
|
item = _a.sent();
|
236
|
-
url = "/_api/web/lists/getbytitle('"
|
237
|
+
url = "/_api/web/lists/getbytitle('".concat(listName, "')/items(").concat(item.Id, ")?$select=*,File/Name,File/ServerRelativeUrl&$expand=File");
|
237
238
|
return [2 /*return*/, this.context.client.get(url).then(function (response) {
|
238
239
|
if (response.status >= 200 && response.status <= 300) {
|
239
240
|
var json = response.data.d;
|
@@ -248,7 +249,7 @@ var CommonRepository = /** @class */ (function () {
|
|
248
249
|
});
|
249
250
|
};
|
250
251
|
CommonRepository.prototype.deleteFile = function (listName, id) {
|
251
|
-
var requestUrl = "_api/web/lists/getbytitle('"
|
252
|
+
var requestUrl = "_api/web/lists/getbytitle('".concat(listName, "')/items(").concat(id, ")");
|
252
253
|
return this.context.client
|
253
254
|
.post(requestUrl, {}, {
|
254
255
|
Accept: "application/json;odata=nometadata",
|
@@ -270,7 +271,7 @@ var CommonRepository = /** @class */ (function () {
|
|
270
271
|
var _this = this;
|
271
272
|
return new Promise(function (resolve, reject) {
|
272
273
|
_this.context.client
|
273
|
-
.get("_api/web/lists/getbytitle('"
|
274
|
+
.get("_api/web/lists/getbytitle('".concat(listName, "')?$select=ListItemEntityTypeFullName"))
|
274
275
|
.then(function (response) {
|
275
276
|
return response;
|
276
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) :
|
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
|
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
|
-
|
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 (
|
103
|
-
|
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
|
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 (
|
181
|
-
|
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
|
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
|
273
|
+
queryUrl = "".concat(this.context.siteUrl, "/_api/web/lists/getByTitle('") +
|
273
274
|
this.listName +
|
274
275
|
"')/items(" +
|
275
276
|
id +
|
276
277
|
")" +
|
277
|
-
|
278
|
-
|
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
|
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
|
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
|
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
|
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;
|
@@ -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
|
-
|
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 +
|
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 +
|
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
|
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
|
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
|
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
|
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
|
-
|
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
|
13
|
-
static
|
14
|
-
static
|
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
|
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
|
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
|
}
|