jitz-sharepoint-utilities 2.0.11 → 2.0.14
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/Repository.ts +1 -1
- package/package.json +1 -1
- package/lib/common/IModels.d.ts +0 -40
- package/lib/common/IModels.js +0 -2
- package/lib/common/IObjects.d.ts +0 -72
- package/lib/common/IObjects.js +0 -30
- package/lib/controls/JitzGrid.d.ts +0 -75
- package/lib/controls/JitzGrid.js +0 -606
- package/lib/controls/JitzImage.d.ts +0 -14
- package/lib/controls/JitzImage.js +0 -37
- package/lib/controls/JitzPeoplePicker.d.ts +0 -49
- package/lib/controls/JitzPeoplePicker.js +0 -311
- package/lib/controls/JitzPersonInfo.d.ts +0 -32
- package/lib/controls/JitzPersonInfo.js +0 -98
- package/lib/controls/JitzPersona.d.ts +0 -23
- package/lib/controls/JitzPersona.js +0 -48
- package/lib/data/context/CommonRepository.d.ts +0 -17
- package/lib/data/context/CommonRepository.js +0 -287
- package/lib/data/context/JitzContext.d.ts +0 -13
- package/lib/data/context/JitzContext.js +0 -80
- package/lib/data/context/JitzSPContext.d.ts +0 -8
- package/lib/data/context/JitzSPContext.js +0 -58
- package/lib/data/context/JitzSPHttpClient.d.ts +0 -14
- package/lib/data/context/JitzSPHttpClient.js +0 -173
- package/lib/data/context/List.d.ts +0 -39
- package/lib/data/context/List.js +0 -492
- package/lib/data/context/Repository.d.ts +0 -22
- package/lib/data/context/Repository.js +0 -486
- package/lib/data/interfaces/ICommonRepository.d.ts +0 -6
- package/lib/data/interfaces/ICommonRepository.js +0 -2
- package/lib/data/interfaces/IJitzContext.d.ts +0 -10
- package/lib/data/interfaces/IJitzContext.js +0 -2
- package/lib/data/interfaces/IJitzSPContext.d.ts +0 -6
- package/lib/data/interfaces/IJitzSPContext.js +0 -2
- package/lib/data/interfaces/IJitzSPHttpClient.d.ts +0 -6
- package/lib/data/interfaces/IJitzSPHttpClient.js +0 -2
- package/lib/data/interfaces/IList.d.ts +0 -26
- package/lib/data/interfaces/IList.js +0 -2
- package/lib/data/interfaces/IModels.d.ts +0 -32
- package/lib/data/interfaces/IModels.js +0 -2
- package/lib/data/interfaces/IRepository.d.ts +0 -17
- package/lib/data/interfaces/IRepository.js +0 -2
- package/lib/jitzHttpClient.d.ts +0 -11
- package/lib/jitzHttpClient.js +0 -37
- package/lib/jitzSPHttpClient.d.ts +0 -30
- package/lib/jitzSPHttpClient.js +0 -193
- package/lib/repositories/CommonRepository.d.ts +0 -17
- package/lib/repositories/CommonRepository.js +0 -288
- package/lib/repositories/ICommonRepository.d.ts +0 -6
- package/lib/repositories/ICommonRepository.js +0 -2
- package/lib/repositories/IRepository.d.ts +0 -13
- package/lib/repositories/IRepository.js +0 -2
- package/lib/repositories/Repository.d.ts +0 -18
- package/lib/repositories/Repository.js +0 -394
- package/lib/services/GraphService.d.ts +0 -10
- package/lib/services/GraphService.js +0 -105
- package/lib/services/UserService.d.ts +0 -15
- package/lib/services/UserService.js +0 -202
- package/lib/services/UtilityService.d.ts +0 -29
- package/lib/services/UtilityService.js +0 -254
@@ -1,394 +0,0 @@
|
|
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 Repository = /** @class */ (function () {
|
40
|
-
function Repository(context, listName) {
|
41
|
-
this.context = context;
|
42
|
-
this.listName = listName;
|
43
|
-
}
|
44
|
-
Repository.prototype.getAll = function (selectFields, expand, filters, orderBy, top, skipTokenUniqueField, skipTokenUniqueFieldValue) {
|
45
|
-
var queryUrlGetAllItems = "".concat(this.context.siteUrl, "/_api/web/lists/GetByTitle('") +
|
46
|
-
this.listName +
|
47
|
-
"')/items";
|
48
|
-
console.log(queryUrlGetAllItems);
|
49
|
-
if (selectFields != null && selectFields != "") {
|
50
|
-
queryUrlGetAllItems = queryUrlGetAllItems + "?$select=" + selectFields;
|
51
|
-
}
|
52
|
-
else {
|
53
|
-
queryUrlGetAllItems = queryUrlGetAllItems + "?$select=*";
|
54
|
-
}
|
55
|
-
if (expand != null && expand != "") {
|
56
|
-
queryUrlGetAllItems = queryUrlGetAllItems + "&$expand=" + expand;
|
57
|
-
}
|
58
|
-
if (filters != null && filters != "") {
|
59
|
-
queryUrlGetAllItems = queryUrlGetAllItems + "&$filter=" + filters;
|
60
|
-
}
|
61
|
-
if (orderBy != null && orderBy != "") {
|
62
|
-
queryUrlGetAllItems = queryUrlGetAllItems + "&$orderby=" + orderBy;
|
63
|
-
}
|
64
|
-
if (top != null && top != undefined && top > 0) {
|
65
|
-
queryUrlGetAllItems = queryUrlGetAllItems + "&$top=" + top;
|
66
|
-
}
|
67
|
-
if (skipTokenUniqueField != null &&
|
68
|
-
skipTokenUniqueField != undefined &&
|
69
|
-
skipTokenUniqueFieldValue != null &&
|
70
|
-
skipTokenUniqueFieldValue != undefined) {
|
71
|
-
if (skipTokenUniqueField == "Id" || skipTokenUniqueField == "id") {
|
72
|
-
skipTokenUniqueField = "ID";
|
73
|
-
}
|
74
|
-
queryUrlGetAllItems =
|
75
|
-
queryUrlGetAllItems +
|
76
|
-
"&$skiptoken=Paged=TRUE%26p_".concat(skipTokenUniqueField, "=").concat(skipTokenUniqueFieldValue);
|
77
|
-
}
|
78
|
-
return this.context.client
|
79
|
-
.get(queryUrlGetAllItems)
|
80
|
-
.then(function (response) {
|
81
|
-
if (response.status >= 200 && response.status < 300) {
|
82
|
-
return response.data.d.results;
|
83
|
-
}
|
84
|
-
else {
|
85
|
-
return Promise.reject(new Error(JSON.stringify(response)));
|
86
|
-
}
|
87
|
-
})
|
88
|
-
.then(function (data) {
|
89
|
-
var items = [];
|
90
|
-
if (data) {
|
91
|
-
for (var i = 0; i < data.length; i++) {
|
92
|
-
var item = data[i];
|
93
|
-
items.push(item);
|
94
|
-
}
|
95
|
-
}
|
96
|
-
return items;
|
97
|
-
})
|
98
|
-
.catch(function (ex) {
|
99
|
-
console.log("load Items > JitzSPHttpClient.get()...catch:", ex);
|
100
|
-
throw ex;
|
101
|
-
});
|
102
|
-
};
|
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
|
-
var items, queryUrlGetAllItems;
|
106
|
-
var _this = this;
|
107
|
-
if (maxRecursiveCount === void 0) { maxRecursiveCount = 5; }
|
108
|
-
return __generator(this, function (_a) {
|
109
|
-
switch (_a.label) {
|
110
|
-
case 0:
|
111
|
-
items = [];
|
112
|
-
queryUrlGetAllItems = "".concat(this.context.siteUrl, "/_api/web/lists/GetByTitle('") +
|
113
|
-
this.listName +
|
114
|
-
"')/items";
|
115
|
-
if (selectFields != null && selectFields != "") {
|
116
|
-
queryUrlGetAllItems = queryUrlGetAllItems + "?$select=" + selectFields;
|
117
|
-
}
|
118
|
-
else {
|
119
|
-
queryUrlGetAllItems = queryUrlGetAllItems + "?$select=*";
|
120
|
-
}
|
121
|
-
if (expand != null && expand != "") {
|
122
|
-
queryUrlGetAllItems = queryUrlGetAllItems + "&$expand=" + expand;
|
123
|
-
}
|
124
|
-
if (filters != null && filters != "") {
|
125
|
-
queryUrlGetAllItems = queryUrlGetAllItems + "&$filter=" + filters;
|
126
|
-
}
|
127
|
-
if (orderBy != null && orderBy != "") {
|
128
|
-
queryUrlGetAllItems = queryUrlGetAllItems + "&$orderby=" + orderBy;
|
129
|
-
}
|
130
|
-
if (top != null && top != undefined && top > 0) {
|
131
|
-
queryUrlGetAllItems = queryUrlGetAllItems + "&$top=" + top;
|
132
|
-
}
|
133
|
-
return [4 /*yield*/, this.context.client
|
134
|
-
.get(queryUrlGetAllItems)
|
135
|
-
.then(function (response) { return __awaiter(_this, void 0, void 0, function () {
|
136
|
-
return __generator(this, function (_a) {
|
137
|
-
switch (_a.label) {
|
138
|
-
case 0:
|
139
|
-
if (!(response.status >= 200 && response.status < 300)) return [3 /*break*/, 2];
|
140
|
-
return [4 /*yield*/, response.data.d];
|
141
|
-
case 1: return [2 /*return*/, _a.sent()];
|
142
|
-
case 2: return [2 /*return*/, Promise.reject(new Error(JSON.stringify(response)))];
|
143
|
-
}
|
144
|
-
});
|
145
|
-
}); })
|
146
|
-
.then(function (data) { return __awaiter(_this, void 0, void 0, function () {
|
147
|
-
var i, item, returnItem;
|
148
|
-
return __generator(this, function (_a) {
|
149
|
-
switch (_a.label) {
|
150
|
-
case 0:
|
151
|
-
if (data.results) {
|
152
|
-
for (i = 0; i < data.results.length; i++) {
|
153
|
-
item = data.results[i];
|
154
|
-
items.push(item);
|
155
|
-
}
|
156
|
-
}
|
157
|
-
returnItem = {
|
158
|
-
__next: data.__next,
|
159
|
-
results: items,
|
160
|
-
};
|
161
|
-
if (!(returnItem.__next != undefined && returnItem.__next.length > 0)) return [3 /*break*/, 2];
|
162
|
-
return [4 /*yield*/, this.recursiveFetch(returnItem.__next, 2, maxRecursiveCount, returnItem.results)];
|
163
|
-
case 1:
|
164
|
-
items = _a.sent();
|
165
|
-
_a.label = 2;
|
166
|
-
case 2: return [2 /*return*/];
|
167
|
-
}
|
168
|
-
});
|
169
|
-
}); })
|
170
|
-
.catch(function (ex) {
|
171
|
-
console.log("load Items > JitzSPHttpClient.get()...catch:", ex);
|
172
|
-
throw ex;
|
173
|
-
})];
|
174
|
-
case 1:
|
175
|
-
_a.sent();
|
176
|
-
return [2 /*return*/, items];
|
177
|
-
}
|
178
|
-
});
|
179
|
-
});
|
180
|
-
};
|
181
|
-
Repository.prototype.recursiveFetch = function (url_1) {
|
182
|
-
return __awaiter(this, arguments, void 0, function (url, recursiveCount, maxRecursiveCount, items) {
|
183
|
-
var _this = this;
|
184
|
-
if (recursiveCount === void 0) { recursiveCount = 1; }
|
185
|
-
if (maxRecursiveCount === void 0) { maxRecursiveCount = 5; }
|
186
|
-
if (items === void 0) { items = []; }
|
187
|
-
return __generator(this, function (_a) {
|
188
|
-
switch (_a.label) {
|
189
|
-
case 0:
|
190
|
-
items = items || [];
|
191
|
-
return [4 /*yield*/, this.context.client
|
192
|
-
.get(url)
|
193
|
-
.then(function (response) { return __awaiter(_this, void 0, void 0, function () {
|
194
|
-
return __generator(this, function (_a) {
|
195
|
-
switch (_a.label) {
|
196
|
-
case 0:
|
197
|
-
if (!(response.status >= 200 && response.status < 300)) return [3 /*break*/, 2];
|
198
|
-
return [4 /*yield*/, response.data.d];
|
199
|
-
case 1: return [2 /*return*/, _a.sent()];
|
200
|
-
case 2: return [2 /*return*/, Promise.reject(new Error(JSON.stringify(response)))];
|
201
|
-
}
|
202
|
-
});
|
203
|
-
}); })
|
204
|
-
.then(function (data) { return __awaiter(_this, void 0, void 0, function () {
|
205
|
-
var i, item, returnItem;
|
206
|
-
return __generator(this, function (_a) {
|
207
|
-
switch (_a.label) {
|
208
|
-
case 0:
|
209
|
-
if (data.results) {
|
210
|
-
for (i = 0; i < data.results.length; i++) {
|
211
|
-
item = data.results[i];
|
212
|
-
items.push(item);
|
213
|
-
}
|
214
|
-
}
|
215
|
-
returnItem = {
|
216
|
-
__next: data.__next,
|
217
|
-
results: items,
|
218
|
-
};
|
219
|
-
if (!(returnItem.__next != undefined &&
|
220
|
-
returnItem.__next.length > 0 &&
|
221
|
-
recursiveCount < maxRecursiveCount)) return [3 /*break*/, 2];
|
222
|
-
return [4 /*yield*/, this.recursiveFetch(returnItem.__next, recursiveCount + 1, maxRecursiveCount, returnItem.results)];
|
223
|
-
case 1:
|
224
|
-
items = _a.sent();
|
225
|
-
_a.label = 2;
|
226
|
-
case 2: return [2 /*return*/];
|
227
|
-
}
|
228
|
-
});
|
229
|
-
}); })
|
230
|
-
.catch(function (ex) {
|
231
|
-
console.log("load Items > JitzSPHttpClient.get()...catch:", ex);
|
232
|
-
throw ex;
|
233
|
-
})];
|
234
|
-
case 1:
|
235
|
-
_a.sent();
|
236
|
-
return [2 /*return*/, items];
|
237
|
-
}
|
238
|
-
});
|
239
|
-
});
|
240
|
-
};
|
241
|
-
Repository.prototype.itemsCount = function (filters) {
|
242
|
-
var queryUrlGetAllItems = "".concat(this.context.siteUrl, "/_api/web/lists/GetByTitle('") +
|
243
|
-
this.listName +
|
244
|
-
"')/ItemCount";
|
245
|
-
if (filters != null && filters != "") {
|
246
|
-
queryUrlGetAllItems = queryUrlGetAllItems + "?$filter=" + filters;
|
247
|
-
}
|
248
|
-
return this.context.client
|
249
|
-
.get(queryUrlGetAllItems)
|
250
|
-
.then(function (response) {
|
251
|
-
if (response.status >= 200 && response.status < 300) {
|
252
|
-
// console.log(response);
|
253
|
-
return response.data.d.ItemCount;
|
254
|
-
}
|
255
|
-
else {
|
256
|
-
return Promise.reject(new Error(JSON.stringify(response)));
|
257
|
-
}
|
258
|
-
})
|
259
|
-
.then(function (data) {
|
260
|
-
return data;
|
261
|
-
})
|
262
|
-
.catch(function (ex) {
|
263
|
-
console.log("loadEvents > JitzSPHttpClient.get()...catch:", ex);
|
264
|
-
throw ex;
|
265
|
-
});
|
266
|
-
};
|
267
|
-
Repository.prototype.getItemById = function (id, selectFields, expand) {
|
268
|
-
return __awaiter(this, void 0, void 0, function () {
|
269
|
-
var queryUrl;
|
270
|
-
return __generator(this, function (_a) {
|
271
|
-
switch (_a.label) {
|
272
|
-
case 0:
|
273
|
-
queryUrl = "".concat(this.context.siteUrl, "/_api/web/lists/getByTitle('") +
|
274
|
-
this.listName +
|
275
|
-
"')/items(" +
|
276
|
-
id +
|
277
|
-
")" +
|
278
|
-
"?$select=*".concat(selectFields != undefined ? ",".concat(selectFields) : "") +
|
279
|
-
"".concat(expand != undefined ? "&$expand=".concat(expand) : "");
|
280
|
-
return [4 /*yield*/, this.context.client
|
281
|
-
.get(queryUrl)
|
282
|
-
.then(function (response) {
|
283
|
-
if (response.status >= 200 && response.status < 300) {
|
284
|
-
return response.data.d;
|
285
|
-
}
|
286
|
-
else {
|
287
|
-
return Promise.reject(new Error(JSON.stringify(response)));
|
288
|
-
}
|
289
|
-
})
|
290
|
-
.then(function (data) {
|
291
|
-
return data;
|
292
|
-
})
|
293
|
-
.catch(function (ex) {
|
294
|
-
console.log("loadEvents > JitzSPHttpClient.get()...catch:", ex);
|
295
|
-
throw ex;
|
296
|
-
})];
|
297
|
-
case 1: return [2 /*return*/, _a.sent()];
|
298
|
-
}
|
299
|
-
});
|
300
|
-
});
|
301
|
-
};
|
302
|
-
Repository.prototype.createItem = function (item) {
|
303
|
-
var _this = this;
|
304
|
-
return this.getEntityType().then(function (entityType) {
|
305
|
-
item.__metadata = {
|
306
|
-
type: entityType,
|
307
|
-
};
|
308
|
-
var requestUrl = "".concat(_this.context.siteUrl, "/_api/web/lists/getbytitle('").concat(_this.listName, "')/items");
|
309
|
-
return _this.context.client
|
310
|
-
.post(requestUrl, item, {
|
311
|
-
Accept: "application/json;odata=nometadata",
|
312
|
-
"Content-type": "application/json;odata=verbose",
|
313
|
-
"odata-version": "",
|
314
|
-
})
|
315
|
-
.then(function (response) {
|
316
|
-
if (response.status >= 200 && response.status < 300) {
|
317
|
-
var json = response;
|
318
|
-
return json;
|
319
|
-
}
|
320
|
-
else {
|
321
|
-
return Promise.reject(new Error(JSON.stringify(response)));
|
322
|
-
}
|
323
|
-
});
|
324
|
-
});
|
325
|
-
};
|
326
|
-
Repository.prototype.updateItem = function (item) {
|
327
|
-
var _this = this;
|
328
|
-
return this.getEntityType().then(function (entityType) {
|
329
|
-
item.__metadata = {
|
330
|
-
//etag: "1",
|
331
|
-
type: entityType,
|
332
|
-
};
|
333
|
-
var requestUrl = "".concat(_this.context.siteUrl, "/_api/web/lists/getbytitle('").concat(_this.listName, "')/items(").concat(item.Id, ")");
|
334
|
-
return _this.context.client
|
335
|
-
.post(requestUrl, item, {
|
336
|
-
Accept: "application/json;odata=nometadata",
|
337
|
-
"Content-type": "application/json;odata=verbose",
|
338
|
-
"odata-version": "",
|
339
|
-
"IF-MATCH": "*",
|
340
|
-
"X-HTTP-Method": "MERGE",
|
341
|
-
})
|
342
|
-
.then(function (response) {
|
343
|
-
if (response.status >= 200 && response.status < 300) {
|
344
|
-
return item;
|
345
|
-
}
|
346
|
-
else {
|
347
|
-
console.log(JSON.stringify(response));
|
348
|
-
return Promise.reject(new Error(JSON.stringify(response)));
|
349
|
-
}
|
350
|
-
});
|
351
|
-
});
|
352
|
-
};
|
353
|
-
Repository.prototype.deleteItem = function (id) {
|
354
|
-
var requestUrl = "".concat(this.context.siteUrl, "/_api/web/lists/getbytitle('").concat(this.listName, "')/items(").concat(id, ")");
|
355
|
-
return this.context.client
|
356
|
-
.post(requestUrl, {}, {
|
357
|
-
Accept: "application/json;odata=nometadata",
|
358
|
-
"Content-type": "application/json;odata=verbose",
|
359
|
-
"odata-version": "",
|
360
|
-
"IF-MATCH": "*",
|
361
|
-
"X-HTTP-Method": "DELETE",
|
362
|
-
})
|
363
|
-
.then(function (response) {
|
364
|
-
if (response.status >= 200 && response.status < 300) {
|
365
|
-
return true;
|
366
|
-
}
|
367
|
-
else {
|
368
|
-
return Promise.reject(new Error(JSON.stringify(response)));
|
369
|
-
}
|
370
|
-
});
|
371
|
-
};
|
372
|
-
Repository.prototype.getEntityType = function () {
|
373
|
-
var _this = this;
|
374
|
-
return new Promise(function (resolve, reject) {
|
375
|
-
if (_this._listEntityType) {
|
376
|
-
resolve(_this._listEntityType);
|
377
|
-
return;
|
378
|
-
}
|
379
|
-
_this.context.client
|
380
|
-
.get("".concat(_this.context.siteUrl, "/_api/web/lists/getbytitle('").concat(_this.listName, "')?$select=ListItemEntityTypeFullName"))
|
381
|
-
.then(function (response) {
|
382
|
-
return response;
|
383
|
-
}, function (error) {
|
384
|
-
reject(error);
|
385
|
-
})
|
386
|
-
.then(function (response) {
|
387
|
-
_this._listEntityType = response.data.d.ListItemEntityTypeFullName;
|
388
|
-
resolve(_this._listEntityType || "");
|
389
|
-
});
|
390
|
-
});
|
391
|
-
};
|
392
|
-
return Repository;
|
393
|
-
}());
|
394
|
-
exports.default = Repository;
|
@@ -1,10 +0,0 @@
|
|
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
|
-
}
|
@@ -1,105 +0,0 @@
|
|
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,15 +0,0 @@
|
|
1
|
-
import { IPersonOrGroup } from "../common/IModels";
|
2
|
-
import { IJitzSPContext } from "../jitzSPHttpClient";
|
3
|
-
export default class UserService {
|
4
|
-
private _context;
|
5
|
-
private _webAbsoluteUrl;
|
6
|
-
constructor(context: IJitzSPContext);
|
7
|
-
getCurrentUser: () => any;
|
8
|
-
getUserProperties: (accountName: string) => Promise<any>;
|
9
|
-
getUserPropertiesByEmail: (email: string) => Promise<any>;
|
10
|
-
getCurrentUserGroups(): Promise<IPersonOrGroup[]>;
|
11
|
-
checkIfCurrentUserInGroup(groupName: string): Promise<boolean>;
|
12
|
-
checkIfUserIsInGroup(userId: number, groupName: string): Promise<boolean>;
|
13
|
-
getUserById: (id: number) => any;
|
14
|
-
getCurrentUserPermissions: () => any;
|
15
|
-
}
|