gd-sprest 9.7.2 → 9.7.4

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 (100) hide show
  1. package/@types/utils/base.d.ts +0 -3
  2. package/build/helper/executor.js +10 -20
  3. package/build/helper/fieldSchemaXML.js +85 -89
  4. package/build/helper/index.js +12 -28
  5. package/build/helper/jslink.js +124 -128
  6. package/build/helper/listForm.js +109 -118
  7. package/build/helper/listFormField.js +62 -65
  8. package/build/helper/methods/addContentEditorWebPart.js +9 -17
  9. package/build/helper/methods/addPermissionLevel.js +12 -16
  10. package/build/helper/methods/addScriptEditorWebPart.js +9 -17
  11. package/build/helper/methods/copyPermissionLevel.js +22 -26
  12. package/build/helper/methods/createContentType.js +96 -19
  13. package/build/helper/methods/createDocSet.js +10 -14
  14. package/build/helper/methods/getCurrentTheme.js +26 -31
  15. package/build/helper/methods/hasPermissions.js +8 -13
  16. package/build/helper/methods/index.js +16 -32
  17. package/build/helper/methods/loadSPCore.js +13 -17
  18. package/build/helper/methods/parse.js +5 -9
  19. package/build/helper/methods/request.js +4 -8
  20. package/build/helper/methods/setContentTypeFields.js +71 -79
  21. package/build/helper/methods/setGroupOwner.js +6 -10
  22. package/build/helper/methods/setWebProperty.js +26 -30
  23. package/build/helper/methods/stringify.js +3 -7
  24. package/build/helper/methods/webWorker.js +40 -20
  25. package/build/helper/ribbonLink.js +10 -14
  26. package/build/helper/sbLink.js +11 -15
  27. package/build/helper/sp/calloutManager.js +22 -25
  28. package/build/helper/sp/index.js +13 -16
  29. package/build/helper/sp/modalDialog.js +32 -35
  30. package/build/helper/sp/notify.js +9 -12
  31. package/build/helper/sp/ribbon.js +1 -4
  32. package/build/helper/sp/sod.js +9 -18
  33. package/build/helper/sp/status.js +18 -21
  34. package/build/helper/spCfg.js +232 -259
  35. package/build/helper/spCfgTypes.js +2 -5
  36. package/build/helper/taxonomy.js +144 -182
  37. package/build/helper/webpart.js +110 -94
  38. package/build/index.js +6 -23
  39. package/build/lib/apps.js +4 -7
  40. package/build/lib/contextInfo.js +217 -781
  41. package/build/lib/directorySession.js +4 -7
  42. package/build/lib/graph.js +16 -19
  43. package/build/lib/groupService.js +4 -7
  44. package/build/lib/groupSiteManager.js +4 -7
  45. package/build/lib/hubSites.js +11 -25
  46. package/build/lib/hubSitesUtility.js +4 -7
  47. package/build/lib/index.js +27 -43
  48. package/build/lib/list.js +49 -53
  49. package/build/lib/navigation.js +4 -7
  50. package/build/lib/peopleManager.js +4 -7
  51. package/build/lib/peoplePicker.js +4 -7
  52. package/build/lib/profileLoader.js +4 -7
  53. package/build/lib/search.js +30 -33
  54. package/build/lib/sensitivityLabels.js +6 -9
  55. package/build/lib/site.js +20 -35
  56. package/build/lib/siteIconManager.js +4 -7
  57. package/build/lib/siteManager.js +4 -7
  58. package/build/lib/sitePages.js +37 -51
  59. package/build/lib/socialFeed.js +13 -16
  60. package/build/lib/themeManager.js +4 -7
  61. package/build/lib/userProfile.js +4 -7
  62. package/build/lib/utility.js +12 -17
  63. package/build/lib/web.js +34 -49
  64. package/build/lib/webTemplateExtensions.js +4 -7
  65. package/build/lib/wfInstanceService.js +4 -7
  66. package/build/lib/wfSubscriptionService.js +4 -7
  67. package/build/mapper/custom/audit.js +3 -6
  68. package/build/mapper/custom/graph.js +13 -16
  69. package/build/mapper/custom/index.js +8 -24
  70. package/build/mapper/custom/odata.js +3 -6
  71. package/build/mapper/custom/old.js +42 -45
  72. package/build/mapper/custom/peoplePicker.js +4 -7
  73. package/build/mapper/custom/propertyValues.js +3 -6
  74. package/build/mapper/custom/utility.js +17 -20
  75. package/build/mapper/custom/webTemplateExtensions.js +19 -22
  76. package/build/mapper/def.js +1032 -989
  77. package/build/mapper/index.js +4 -9
  78. package/build/mapper/v2.js +2629 -2632
  79. package/build/rest.js +16 -19
  80. package/build/sptypes/graphtypes.js +694 -710
  81. package/build/sptypes/index.js +3 -7
  82. package/build/sptypes/sptypes.js +49 -52
  83. package/build/utils/base.js +20 -37
  84. package/build/utils/batch.js +53 -63
  85. package/build/utils/helper.js +79 -83
  86. package/build/utils/index.js +9 -25
  87. package/build/utils/methodInfo.js +88 -141
  88. package/build/utils/oData.js +62 -112
  89. package/build/utils/request.js +137 -155
  90. package/build/utils/requestType.js +1 -4
  91. package/build/utils/targetInfo.js +39 -52
  92. package/build/utils/xhrRequest.js +59 -107
  93. package/build/v2/drive.js +9 -13
  94. package/build/v2/drives.js +8 -12
  95. package/build/v2/index.js +3 -19
  96. package/build/v2/sites.js +61 -65
  97. package/dist/gd-sprest.d.ts +0 -3
  98. package/dist/gd-sprest.js +1 -1
  99. package/dist/gd-sprest.min.js +1 -1
  100. package/package.json +2 -2
@@ -1,755 +1,198 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ContextInfo = void 0;
4
- var webWorker_1 = require("../helper/methods/webWorker");
5
- var utils_1 = require("../utils");
6
- var graph_1 = require("./graph");
1
+ var _a;
2
+ import { WebWorker } from "../helper/methods/webWorker";
3
+ import { Base } from "../utils";
4
+ import { Graph } from "./graph";
7
5
  /**
8
6
  * Context Information
9
7
  */
10
- var _ContextInfo = /** @class */ (function () {
11
- function _ContextInfo() {
8
+ class _ContextInfo {
9
+ // The current context information
10
+ static get _contextInfo() {
11
+ // Return the page context by default
12
+ if (this.window["_spPageContextInfo"]) {
13
+ return this.window["_spPageContextInfo"];
14
+ }
15
+ // See if the SPFx context was set
16
+ if (this._spfxPageContext && this._spfxPageContext.legacyPageContext) {
17
+ return this._spfxPageContext.legacyPageContext;
18
+ }
19
+ // Return a default object
20
+ return {
21
+ existsFl: false,
22
+ isAppWeb: false,
23
+ isHubSite: false,
24
+ isSPO: false,
25
+ siteAbsoluteUrl: "",
26
+ siteServerRelativeUrl: "",
27
+ userId: 0,
28
+ webAbsoluteUrl: "",
29
+ webServerRelativeUrl: ""
30
+ };
12
31
  }
13
- Object.defineProperty(_ContextInfo, "_contextInfo", {
14
- // The current context information
15
- get: function () {
16
- // Return the page context by default
17
- if (this.window["_spPageContextInfo"]) {
18
- return this.window["_spPageContextInfo"];
19
- }
20
- // See if the SPFx context was set
21
- if (this._spfxPageContext && this._spfxPageContext.legacyPageContext) {
22
- return this._spfxPageContext.legacyPageContext;
23
- }
24
- // Return a default object
25
- return {
26
- existsFl: false,
27
- isAppWeb: false,
28
- isHubSite: false,
29
- isSPO: false,
30
- siteAbsoluteUrl: "",
31
- siteServerRelativeUrl: "",
32
- userId: 0,
33
- webAbsoluteUrl: "",
34
- webServerRelativeUrl: ""
35
- };
36
- },
37
- enumerable: false,
38
- configurable: true
39
- });
40
32
  ;
41
- Object.defineProperty(_ContextInfo, "aadInstanceUrl", {
42
- /**
43
- * Properties
44
- */
45
- get: function () { return this._contextInfo.aadInstanceUrl; },
46
- enumerable: false,
47
- configurable: true
48
- });
49
- Object.defineProperty(_ContextInfo, "aadTenantId", {
50
- get: function () { return this._contextInfo.aadTenantId; },
51
- enumerable: false,
52
- configurable: true
53
- });
54
- Object.defineProperty(_ContextInfo, "alertsEnabled", {
55
- get: function () { return this._contextInfo.alertsEnabled; },
56
- enumerable: false,
57
- configurable: true
58
- });
59
- Object.defineProperty(_ContextInfo, "allowSilverlightPrompt", {
60
- get: function () { return this._contextInfo.allowSilverlightPrompt == "True" ? true : false; },
61
- enumerable: false,
62
- configurable: true
63
- });
64
- Object.defineProperty(_ContextInfo, "canUserCreateMicrosoftForm", {
65
- get: function () { return this._contextInfo.canUserCreateMicrosoftForm; },
66
- enumerable: false,
67
- configurable: true
68
- });
69
- Object.defineProperty(_ContextInfo, "canUserCreateVisioDrawing", {
70
- get: function () { return this._contextInfo.canUserCreateVisioDrawing; },
71
- enumerable: false,
72
- configurable: true
73
- });
74
- Object.defineProperty(_ContextInfo, "cdnPrefix", {
75
- get: function () { return this._contextInfo.cdnPrefix; },
76
- enumerable: false,
77
- configurable: true
78
- });
79
- Object.defineProperty(_ContextInfo, "clientServerTimeDelta", {
80
- get: function () { return this._contextInfo.clientServerTimeDelta; },
81
- enumerable: false,
82
- configurable: true
83
- });
84
- Object.defineProperty(_ContextInfo, "CorrelationId", {
85
- get: function () { return this._contextInfo.CorrelationId; },
86
- enumerable: false,
87
- configurable: true
88
- });
89
- Object.defineProperty(_ContextInfo, "crossDomainPhotosEnabled", {
90
- get: function () { return this._contextInfo.crossDomainPhotosEnabled; },
91
- enumerable: false,
92
- configurable: true
93
- });
94
- Object.defineProperty(_ContextInfo, "currentCultureName", {
95
- get: function () { return this._contextInfo.currentCultureName; },
96
- enumerable: false,
97
- configurable: true
98
- });
99
- Object.defineProperty(_ContextInfo, "currentLanguage", {
100
- get: function () { return this._contextInfo.currentLanguage; },
101
- enumerable: false,
102
- configurable: true
103
- });
104
- Object.defineProperty(_ContextInfo, "currentUICultureName", {
105
- get: function () { return this._contextInfo.currentUICultureName; },
106
- enumerable: false,
107
- configurable: true
108
- });
109
- Object.defineProperty(_ContextInfo, "departmentId", {
110
- get: function () { return this._contextInfo.departmentId; },
111
- enumerable: false,
112
- configurable: true
113
- });
114
- Object.defineProperty(_ContextInfo, "DesignPackageId", {
115
- get: function () { return this._contextInfo.DesignPackageId; },
116
- enumerable: false,
117
- configurable: true
118
- });
119
- Object.defineProperty(_ContextInfo, "disableAppViews", {
120
- get: function () { return this._contextInfo.disableAppViews; },
121
- enumerable: false,
122
- configurable: true
123
- });
124
- Object.defineProperty(_ContextInfo, "disableFlows", {
125
- get: function () { return this._contextInfo.disableFlows; },
126
- enumerable: false,
127
- configurable: true
128
- });
129
- Object.defineProperty(_ContextInfo, "document", {
130
- get: function () { return this.window ? this.window.document : null; },
131
- enumerable: false,
132
- configurable: true
133
- });
134
- Object.defineProperty(_ContextInfo, "env", {
135
- get: function () { return this._contextInfo.env; },
136
- enumerable: false,
137
- configurable: true
138
- });
139
- Object.defineProperty(_ContextInfo, "existsFl", {
140
- get: function () { return this._contextInfo.existsFl == null; },
141
- enumerable: false,
142
- configurable: true
143
- });
144
- Object.defineProperty(_ContextInfo, "farmLabel", {
145
- get: function () { return this._contextInfo.farmLabel; },
146
- enumerable: false,
147
- configurable: true
148
- });
149
- Object.defineProperty(_ContextInfo, "fid", {
150
- get: function () { return this._contextInfo.fid; },
151
- enumerable: false,
152
- configurable: true
153
- });
154
- Object.defineProperty(_ContextInfo, "formDigestTimeoutSeconds", {
155
- get: function () { return this._contextInfo.formDigestTimeoutSeconds; },
156
- enumerable: false,
157
- configurable: true
158
- });
159
- Object.defineProperty(_ContextInfo, "formDigestValue", {
160
- get: function () { return this._contextInfo.formDigestValue; },
161
- enumerable: false,
162
- configurable: true
163
- });
164
- Object.defineProperty(_ContextInfo, "groupColor", {
165
- get: function () { return this._contextInfo.groupColor; },
166
- enumerable: false,
167
- configurable: true
168
- });
169
- Object.defineProperty(_ContextInfo, "groupHasHomepage", {
170
- get: function () { return this._contextInfo.groupHasHomepage; },
171
- enumerable: false,
172
- configurable: true
173
- });
174
- Object.defineProperty(_ContextInfo, "groupId", {
175
- get: function () { return this._contextInfo.groupId; },
176
- enumerable: false,
177
- configurable: true
178
- });
179
- Object.defineProperty(_ContextInfo, "groupType", {
180
- get: function () { return this._contextInfo.groupType; },
181
- enumerable: false,
182
- configurable: true
183
- });
184
- Object.defineProperty(_ContextInfo, "guestsEnabled", {
185
- get: function () { return this._contextInfo.guestsEnabled; },
186
- enumerable: false,
187
- configurable: true
188
- });
189
- Object.defineProperty(_ContextInfo, "hasManageWebPermissions", {
190
- get: function () { return this._contextInfo.hasManageWebPermissions; },
191
- enumerable: false,
192
- configurable: true
193
- });
194
- Object.defineProperty(_ContextInfo, "hasPendingWebTemplateExtension", {
195
- get: function () { return this._contextInfo.hasPendingWebTemplateExtension; },
196
- enumerable: false,
197
- configurable: true
198
- });
199
- Object.defineProperty(_ContextInfo, "hideSyncButtonOnODB", {
200
- get: function () { return this._contextInfo.hideSyncButtonOnODB; },
201
- enumerable: false,
202
- configurable: true
203
- });
204
- Object.defineProperty(_ContextInfo, "hubSiteId", {
205
- get: function () { return this._contextInfo.hubSiteId; },
206
- enumerable: false,
207
- configurable: true
208
- });
209
- Object.defineProperty(_ContextInfo, "idleSessionSignOutEnabled", {
210
- get: function () { return this._contextInfo.idleSessionSignOutEnabled; },
211
- enumerable: false,
212
- configurable: true
213
- });
214
- Object.defineProperty(_ContextInfo, "isAnonymousGuestUser", {
215
- get: function () { return this._contextInfo.isAnonymousGuestUser; },
216
- enumerable: false,
217
- configurable: true
218
- });
219
- Object.defineProperty(_ContextInfo, "isAppWeb", {
220
- get: function () { return this._contextInfo.isAppWeb; },
221
- enumerable: false,
222
- configurable: true
223
- });
224
- Object.defineProperty(_ContextInfo, "isArchived", {
225
- get: function () { return this._contextInfo.isArchived; },
226
- enumerable: false,
227
- configurable: true
228
- });
229
- Object.defineProperty(_ContextInfo, "isEmailAuthenticationGuestUser", {
230
- get: function () { return this._contextInfo.isEmailAuthenticationGuestUser; },
231
- enumerable: false,
232
- configurable: true
233
- });
234
- Object.defineProperty(_ContextInfo, "isExternalGuestUser", {
235
- get: function () { return this._contextInfo.isExternalGuestUser; },
236
- enumerable: false,
237
- configurable: true
238
- });
239
- Object.defineProperty(_ContextInfo, "isGroupRelatedSite", {
240
- get: function () { return this._contextInfo.isGroupRelatedSite; },
241
- enumerable: false,
242
- configurable: true
243
- });
244
- Object.defineProperty(_ContextInfo, "isGroupifyDisabled", {
245
- get: function () { return this._contextInfo.isGroupifyDisabled; },
246
- enumerable: false,
247
- configurable: true
248
- });
249
- Object.defineProperty(_ContextInfo, "isGroupifyMenuButtonFeatureOff", {
250
- get: function () { return this._contextInfo.isGroupifyMenuButtonFeatureOff; },
251
- enumerable: false,
252
- configurable: true
253
- });
254
- Object.defineProperty(_ContextInfo, "isHubSite", {
255
- get: function () { return this._contextInfo.isHubSite; },
256
- enumerable: false,
257
- configurable: true
258
- });
259
- Object.defineProperty(_ContextInfo, "isLocationserviceAvailable", {
260
- get: function () { return this._contextInfo.isLocationserviceAvailable; },
261
- enumerable: false,
262
- configurable: true
263
- });
264
- Object.defineProperty(_ContextInfo, "isMultiGeoODBMode", {
265
- get: function () { return this._contextInfo.isMultiGeoODBMode; },
266
- enumerable: false,
267
- configurable: true
268
- });
269
- Object.defineProperty(_ContextInfo, "isMultiGeoTenant", {
270
- get: function () { return this._contextInfo.isMultiGeoTenant; },
271
- enumerable: false,
272
- configurable: true
273
- });
274
- Object.defineProperty(_ContextInfo, "isNoScriptEnabled", {
275
- get: function () { return this._contextInfo.isNoScriptEnabled; },
276
- enumerable: false,
277
- configurable: true
278
- });
279
- Object.defineProperty(_ContextInfo, "isSiteAdmin", {
280
- get: function () { return this._contextInfo.isSiteAdmin; },
281
- enumerable: false,
282
- configurable: true
283
- });
284
- Object.defineProperty(_ContextInfo, "isSiteOwner", {
285
- get: function () { return this._contextInfo.isSiteOwner; },
286
- enumerable: false,
287
- configurable: true
288
- });
289
- Object.defineProperty(_ContextInfo, "isSPO", {
290
- get: function () { return this._contextInfo.isSPO; },
291
- enumerable: false,
292
- configurable: true
293
- });
294
- Object.defineProperty(_ContextInfo, "isShareByLinkEnabled", {
295
- get: function () { return this._contextInfo.isShareByLinkEnabled; },
296
- enumerable: false,
297
- configurable: true
298
- });
299
- Object.defineProperty(_ContextInfo, "isTeamsChannelSite", {
300
- get: function () { return this._contextInfo.isTeamsChannelSite; },
301
- enumerable: false,
302
- configurable: true
303
- });
304
- Object.defineProperty(_ContextInfo, "isTeamsConnectedSite", {
305
- get: function () { return this._contextInfo.isTeamsConnectedSite; },
306
- enumerable: false,
307
- configurable: true
308
- });
309
- Object.defineProperty(_ContextInfo, "isTenantDevSite", {
310
- get: function () { return this._contextInfo.isTenantDevSite; },
311
- enumerable: false,
312
- configurable: true
313
- });
314
- Object.defineProperty(_ContextInfo, "isUnauthorizedTenant", {
315
- get: function () { return this._contextInfo.isUnauthorizedTenant; },
316
- enumerable: false,
317
- configurable: true
318
- });
319
- Object.defineProperty(_ContextInfo, "isWebWelcomePage", {
320
- get: function () { return this._contextInfo.isWebWelcomePage; },
321
- enumerable: false,
322
- configurable: true
323
- });
324
- Object.defineProperty(_ContextInfo, "layoutsUrl", {
325
- get: function () { return this._contextInfo.layoutsUrl; },
326
- enumerable: false,
327
- configurable: true
328
- });
329
- Object.defineProperty(_ContextInfo, "listBaseTemplate", {
330
- get: function () { return this._contextInfo.listBaseTemplate; },
331
- enumerable: false,
332
- configurable: true
333
- });
334
- Object.defineProperty(_ContextInfo, "listBaseType", {
335
- get: function () { return this._contextInfo.listBaseType; },
336
- enumerable: false,
337
- configurable: true
338
- });
339
- Object.defineProperty(_ContextInfo, "listId", {
340
- get: function () { return this._contextInfo.listId; },
341
- enumerable: false,
342
- configurable: true
343
- });
344
- Object.defineProperty(_ContextInfo, "listItemCount", {
345
- get: function () { return this._contextInfo.listItemCount; },
346
- enumerable: false,
347
- configurable: true
348
- });
349
- Object.defineProperty(_ContextInfo, "listTitle", {
350
- get: function () { return this._contextInfo.listTitle; },
351
- enumerable: false,
352
- configurable: true
353
- });
354
- Object.defineProperty(_ContextInfo, "listPermsMask", {
355
- get: function () { return this._contextInfo.listPermsMask; },
356
- enumerable: false,
357
- configurable: true
358
- });
359
- Object.defineProperty(_ContextInfo, "listUrl", {
360
- get: function () { return this._contextInfo.listUrl; },
361
- enumerable: false,
362
- configurable: true
363
- });
364
- Object.defineProperty(_ContextInfo, "maximumFileSize", {
365
- get: function () { return this._contextInfo.maximumFileSize; },
366
- enumerable: false,
367
- configurable: true
368
- });
369
- Object.defineProperty(_ContextInfo, "modernThemingEnabled", {
370
- get: function () { return this._contextInfo.modernThemingEnabled; },
371
- enumerable: false,
372
- configurable: true
373
- });
374
- Object.defineProperty(_ContextInfo, "msGraphEndpointUrl", {
375
- get: function () { return this._contextInfo.msGraphEndpointUrl; },
376
- enumerable: false,
377
- configurable: true
378
- });
379
- Object.defineProperty(_ContextInfo, "msMruEndpointUrl", {
380
- get: function () { return this._contextInfo.msMruEndpointUrl; },
381
- enumerable: false,
382
- configurable: true
383
- });
384
- Object.defineProperty(_ContextInfo, "multiGeoInfo", {
385
- get: function () { return this._contextInfo.multiGeoInfo; },
386
- enumerable: false,
387
- configurable: true
388
- });
389
- Object.defineProperty(_ContextInfo, "navigationInfo", {
390
- get: function () { return this._contextInfo.navigationInfo; },
391
- enumerable: false,
392
- configurable: true
393
- });
394
- Object.defineProperty(_ContextInfo, "nid", {
395
- get: function () { return this._contextInfo.nid; },
396
- enumerable: false,
397
- configurable: true
398
- });
399
- Object.defineProperty(_ContextInfo, "openInClient", {
400
- get: function () { return this._contextInfo.openInClient; },
401
- enumerable: false,
402
- configurable: true
403
- });
404
- Object.defineProperty(_ContextInfo, "pageItemId", {
405
- get: function () { return this._contextInfo.pageItemId; },
406
- enumerable: false,
407
- configurable: true
408
- });
409
- Object.defineProperty(_ContextInfo, "pageListId", {
410
- get: function () { return this._contextInfo.pageListId; },
411
- enumerable: false,
412
- configurable: true
413
- });
414
- Object.defineProperty(_ContextInfo, "pagePermsMask", {
415
- get: function () { return this._contextInfo.pagePermsMask; },
416
- enumerable: false,
417
- configurable: true
418
- });
419
- Object.defineProperty(_ContextInfo, "pagePersonalizationScope", {
420
- get: function () { return this._contextInfo.pagePersonalizationScope; },
421
- enumerable: false,
422
- configurable: true
423
- });
424
- Object.defineProperty(_ContextInfo, "preferUserTimeZone", {
425
- get: function () { return this._contextInfo.preferUserTimeZone; },
426
- enumerable: false,
427
- configurable: true
428
- });
429
- Object.defineProperty(_ContextInfo, "PreviewFeaturesEnabled", {
430
- get: function () { return this._contextInfo.PreviewFeaturesEnabled; },
431
- enumerable: false,
432
- configurable: true
433
- });
434
- Object.defineProperty(_ContextInfo, "portalUrl", {
435
- get: function () { return this._contextInfo.portalUrl; },
436
- enumerable: false,
437
- configurable: true
438
- });
439
- Object.defineProperty(_ContextInfo, "profileUrl", {
440
- get: function () { return this._contextInfo.profileUrl; },
441
- enumerable: false,
442
- configurable: true
443
- });
444
- Object.defineProperty(_ContextInfo, "PublishingFeatureOn", {
445
- get: function () { return this._contextInfo.PublishingFeatureOn; },
446
- enumerable: false,
447
- configurable: true
448
- });
449
- Object.defineProperty(_ContextInfo, "RecycleBinItemCount", {
450
- get: function () { return this._contextInfo.RecycleBinItemCount; },
451
- enumerable: false,
452
- configurable: true
453
- });
454
- Object.defineProperty(_ContextInfo, "serverRedirectedUrl", {
455
- get: function () { return this._contextInfo.serverRedirectedUrl; },
456
- enumerable: false,
457
- configurable: true
458
- });
459
- Object.defineProperty(_ContextInfo, "serverRequestPath", {
460
- get: function () { return this._contextInfo.serverRequestPath; },
461
- enumerable: false,
462
- configurable: true
463
- });
464
- Object.defineProperty(_ContextInfo, "serverTime", {
465
- get: function () { return this._contextInfo.serverTime; },
466
- enumerable: false,
467
- configurable: true
468
- });
469
- Object.defineProperty(_ContextInfo, "showNGSCDialogForSyncOnODB", {
470
- get: function () { return this._contextInfo.showNGSCDialogForSyncOnODB; },
471
- enumerable: false,
472
- configurable: true
473
- });
474
- Object.defineProperty(_ContextInfo, "showNGSCDialogForSyncOnTS", {
475
- get: function () { return this._contextInfo.showNGSCDialogForSyncOnTS; },
476
- enumerable: false,
477
- configurable: true
478
- });
479
- Object.defineProperty(_ContextInfo, "siteAbsoluteUrl", {
480
- get: function () { return this._contextInfo.siteAbsoluteUrl; },
481
- enumerable: false,
482
- configurable: true
483
- });
484
- Object.defineProperty(_ContextInfo, "siteClassification", {
485
- get: function () { return this._contextInfo.siteClassification; },
486
- enumerable: false,
487
- configurable: true
488
- });
489
- Object.defineProperty(_ContextInfo, "siteClientTag", {
490
- get: function () { return this._contextInfo.siteClientTag; },
491
- enumerable: false,
492
- configurable: true
493
- });
494
- Object.defineProperty(_ContextInfo, "siteColor", {
495
- get: function () { return this._contextInfo.siteColor; },
496
- enumerable: false,
497
- configurable: true
498
- });
499
- Object.defineProperty(_ContextInfo, "siteId", {
500
- get: function () { return this._contextInfo.siteId; },
501
- enumerable: false,
502
- configurable: true
503
- });
504
- Object.defineProperty(_ContextInfo, "sitePagesEnabled", {
505
- get: function () { return this._contextInfo.sitePagesEnabled; },
506
- enumerable: false,
507
- configurable: true
508
- });
509
- Object.defineProperty(_ContextInfo, "sitePagesFeatureVersion", {
510
- get: function () { return this._contextInfo.sitePagesFeatureVersion; },
511
- enumerable: false,
512
- configurable: true
513
- });
514
- Object.defineProperty(_ContextInfo, "siteServerRelativeUrl", {
515
- get: function () { return this._contextInfo.siteServerRelativeUrl; },
516
- enumerable: false,
517
- configurable: true
518
- });
519
- Object.defineProperty(_ContextInfo, "siteSubscriptionId", {
520
- get: function () { return this._contextInfo.siteSubscriptionId; },
521
- enumerable: false,
522
- configurable: true
523
- });
524
- Object.defineProperty(_ContextInfo, "socialBarEnabled", {
525
- get: function () { return this._contextInfo.socialBarEnabled; },
526
- enumerable: false,
527
- configurable: true
528
- });
529
- Object.defineProperty(_ContextInfo, "supportPercentStorePage", {
530
- get: function () { return this._contextInfo.supportPercentStorePage; },
531
- enumerable: false,
532
- configurable: true
533
- });
534
- Object.defineProperty(_ContextInfo, "supportPoundStorePath", {
535
- get: function () { return this._contextInfo.supportPoundStorePath; },
536
- enumerable: false,
537
- configurable: true
538
- });
539
- Object.defineProperty(_ContextInfo, "systemUserKey", {
540
- get: function () { return this._contextInfo.systemUserKey; },
541
- enumerable: false,
542
- configurable: true
543
- });
544
- Object.defineProperty(_ContextInfo, "teamsChannelType", {
545
- get: function () { return this._contextInfo.teamsChannelType; },
546
- enumerable: false,
547
- configurable: true
548
- });
549
- Object.defineProperty(_ContextInfo, "tenantAppVersion", {
550
- get: function () { return this._contextInfo.tenantAppVersion; },
551
- enumerable: false,
552
- configurable: true
553
- });
554
- Object.defineProperty(_ContextInfo, "tenantDisplayName", {
555
- get: function () { return this._contextInfo.tenantDisplayName; },
556
- enumerable: false,
557
- configurable: true
558
- });
559
- Object.defineProperty(_ContextInfo, "theme", {
560
- get: function () { return (this.window && this.window["__themeState__"] ? this.window["__themeState__"].theme : null) || {}; },
561
- enumerable: false,
562
- configurable: true
563
- });
564
- Object.defineProperty(_ContextInfo, "themeCacheToken", {
565
- get: function () { return this._contextInfo.themeCacheToken; },
566
- enumerable: false,
567
- configurable: true
568
- });
569
- Object.defineProperty(_ContextInfo, "themedCssFolderUrl", {
570
- get: function () { return this._contextInfo.themedCssFolderUrl; },
571
- enumerable: false,
572
- configurable: true
573
- });
574
- Object.defineProperty(_ContextInfo, "themedImageFileNames", {
575
- get: function () { return this._contextInfo.themedImageFileNames; },
576
- enumerable: false,
577
- configurable: true
578
- });
579
- Object.defineProperty(_ContextInfo, "updateFromDigestPageLoaded", {
580
- get: function () { return this._contextInfo.updateFromDigestPageLoaded; },
581
- enumerable: false,
582
- configurable: true
583
- });
584
- Object.defineProperty(_ContextInfo, "userDisplayName", {
585
- get: function () { return this._contextInfo.userDisplayName; },
586
- enumerable: false,
587
- configurable: true
588
- });
589
- Object.defineProperty(_ContextInfo, "userEmail", {
590
- get: function () { return this._contextInfo.userEmail; },
591
- enumerable: false,
592
- configurable: true
593
- });
594
- Object.defineProperty(_ContextInfo, "userFirstDayOfWeek", {
595
- get: function () { return this._contextInfo.userFirstDayOfWeek; },
596
- enumerable: false,
597
- configurable: true
598
- });
599
- Object.defineProperty(_ContextInfo, "userId", {
600
- get: function () { return this._contextInfo.userId; },
601
- enumerable: false,
602
- configurable: true
603
- });
604
- Object.defineProperty(_ContextInfo, "userLoginName", {
605
- get: function () { return this._contextInfo.userLoginName; },
606
- enumerable: false,
607
- configurable: true
608
- });
609
- Object.defineProperty(_ContextInfo, "userPhotoCdnBaseUrl", {
610
- get: function () { return this._contextInfo.userPhotoCdnBaseUrl; },
611
- enumerable: false,
612
- configurable: true
613
- });
614
- Object.defineProperty(_ContextInfo, "userPrincipalName", {
615
- get: function () { return this._contextInfo.userPrincipalName; },
616
- enumerable: false,
617
- configurable: true
618
- });
619
- Object.defineProperty(_ContextInfo, "userTime24", {
620
- get: function () { return this._contextInfo.userTime24; },
621
- enumerable: false,
622
- configurable: true
623
- });
624
- Object.defineProperty(_ContextInfo, "userTimeZoneData", {
625
- get: function () { return this._contextInfo.userTimeZoneData; },
626
- enumerable: false,
627
- configurable: true
628
- });
629
- Object.defineProperty(_ContextInfo, "userVoiceForFeedbackEnabled", {
630
- get: function () { return this._contextInfo.userVoiceForFeedbackEnabled; },
631
- enumerable: false,
632
- configurable: true
633
- });
634
- Object.defineProperty(_ContextInfo, "viewId", {
635
- get: function () { return this._contextInfo.viewId; },
636
- enumerable: false,
637
- configurable: true
638
- });
639
- Object.defineProperty(_ContextInfo, "viewOnlyExperienceEnabled", {
640
- get: function () { return this._contextInfo.viewOnlyExperienceEnabled; },
641
- enumerable: false,
642
- configurable: true
643
- });
644
- Object.defineProperty(_ContextInfo, "webAbsoluteUrl", {
645
- get: function () { return this._contextInfo.webAbsoluteUrl; },
646
- enumerable: false,
647
- configurable: true
648
- });
649
- Object.defineProperty(_ContextInfo, "webDescription", {
650
- get: function () { return this._contextInfo.webDescription; },
651
- enumerable: false,
652
- configurable: true
653
- });
654
- Object.defineProperty(_ContextInfo, "webDomain", {
655
- get: function () { return this._contextInfo.webDomain; },
656
- enumerable: false,
657
- configurable: true
658
- });
659
- Object.defineProperty(_ContextInfo, "webFirstDayOfWeek", {
660
- get: function () { return this._contextInfo.webFirstDayOfWeek; },
661
- enumerable: false,
662
- configurable: true
663
- });
664
- Object.defineProperty(_ContextInfo, "webId", {
665
- get: function () { return this._contextInfo.webId; },
666
- enumerable: false,
667
- configurable: true
668
- });
669
- Object.defineProperty(_ContextInfo, "webLanguage", {
670
- get: function () { return this._contextInfo.webLanguage; },
671
- enumerable: false,
672
- configurable: true
673
- });
674
- Object.defineProperty(_ContextInfo, "webLanguageName", {
675
- get: function () { return this._contextInfo.webLanguageName; },
676
- enumerable: false,
677
- configurable: true
678
- });
679
- Object.defineProperty(_ContextInfo, "webLogoUrl", {
680
- get: function () { return this._contextInfo.webLogoUrl; },
681
- enumerable: false,
682
- configurable: true
683
- });
684
- Object.defineProperty(_ContextInfo, "webPermMasks", {
685
- get: function () { return this._contextInfo.webPermMasks; },
686
- enumerable: false,
687
- configurable: true
688
- });
689
- Object.defineProperty(_ContextInfo, "webServerRelativeUrl", {
690
- get: function () { return this._contextInfo.webServerRelativeUrl; },
691
- enumerable: false,
692
- configurable: true
693
- });
694
- Object.defineProperty(_ContextInfo, "webTemplate", {
695
- get: function () { return this._contextInfo.webTemplate; },
696
- enumerable: false,
697
- configurable: true
698
- });
699
- Object.defineProperty(_ContextInfo, "webTemplateConfiguration", {
700
- get: function () { return this._contextInfo.webTemplateConfiguration; },
701
- enumerable: false,
702
- configurable: true
703
- });
704
- Object.defineProperty(_ContextInfo, "webTime24", {
705
- get: function () { return this._contextInfo.webTime24; },
706
- enumerable: false,
707
- configurable: true
708
- });
709
- Object.defineProperty(_ContextInfo, "webTimeZoneData", {
710
- get: function () { return this._contextInfo.webTimeZoneData; },
711
- enumerable: false,
712
- configurable: true
713
- });
714
- Object.defineProperty(_ContextInfo, "webTitle", {
715
- get: function () { return this._contextInfo.webTitle; },
716
- enumerable: false,
717
- configurable: true
718
- });
719
- Object.defineProperty(_ContextInfo, "webUIVersion", {
720
- get: function () { return this._contextInfo.webUIVersion; },
721
- enumerable: false,
722
- configurable: true
723
- });
724
- Object.defineProperty(_ContextInfo, "window", {
725
- get: function () { return typeof (window) == "undefined" ? {} : window; },
726
- enumerable: false,
727
- configurable: true
728
- });
33
+ /**
34
+ * Properties
35
+ */
36
+ static get aadInstanceUrl() { return this._contextInfo.aadInstanceUrl; }
37
+ static get aadTenantId() { return this._contextInfo.aadTenantId; }
38
+ static get alertsEnabled() { return this._contextInfo.alertsEnabled; }
39
+ static get allowSilverlightPrompt() { return this._contextInfo.allowSilverlightPrompt == "True" ? true : false; }
40
+ static get canUserCreateMicrosoftForm() { return this._contextInfo.canUserCreateMicrosoftForm; }
41
+ static get canUserCreateVisioDrawing() { return this._contextInfo.canUserCreateVisioDrawing; }
42
+ static get cdnPrefix() { return this._contextInfo.cdnPrefix; }
43
+ static get clientServerTimeDelta() { return this._contextInfo.clientServerTimeDelta; }
44
+ static get CorrelationId() { return this._contextInfo.CorrelationId; }
45
+ static get crossDomainPhotosEnabled() { return this._contextInfo.crossDomainPhotosEnabled; }
46
+ static get currentCultureName() { return this._contextInfo.currentCultureName; }
47
+ static get currentLanguage() { return this._contextInfo.currentLanguage; }
48
+ static get currentUICultureName() { return this._contextInfo.currentUICultureName; }
49
+ static get departmentId() { return this._contextInfo.departmentId; }
50
+ static get DesignPackageId() { return this._contextInfo.DesignPackageId; }
51
+ static get disableAppViews() { return this._contextInfo.disableAppViews; }
52
+ static get disableFlows() { return this._contextInfo.disableFlows; }
53
+ static get document() { return this.window ? this.window.document : null; }
54
+ static get env() { return this._contextInfo.env; }
55
+ static get existsFl() { return this._contextInfo.existsFl == null; }
56
+ static get farmLabel() { return this._contextInfo.farmLabel; }
57
+ static get fid() { return this._contextInfo.fid; }
58
+ static get formDigestTimeoutSeconds() { return this._contextInfo.formDigestTimeoutSeconds; }
59
+ static get formDigestValue() { return this._contextInfo.formDigestValue; }
60
+ static get groupColor() { return this._contextInfo.groupColor; }
61
+ static get groupHasHomepage() { return this._contextInfo.groupHasHomepage; }
62
+ static get groupId() { return this._contextInfo.groupId; }
63
+ static get groupType() { return this._contextInfo.groupType; }
64
+ static get guestsEnabled() { return this._contextInfo.guestsEnabled; }
65
+ static get hasManageWebPermissions() { return this._contextInfo.hasManageWebPermissions; }
66
+ static get hasPendingWebTemplateExtension() { return this._contextInfo.hasPendingWebTemplateExtension; }
67
+ static get hideSyncButtonOnODB() { return this._contextInfo.hideSyncButtonOnODB; }
68
+ static get hubSiteId() { return this._contextInfo.hubSiteId; }
69
+ static get idleSessionSignOutEnabled() { return this._contextInfo.idleSessionSignOutEnabled; }
70
+ static get isAnonymousGuestUser() { return this._contextInfo.isAnonymousGuestUser; }
71
+ static get isAppWeb() { return this._contextInfo.isAppWeb; }
72
+ static get isArchived() { return this._contextInfo.isArchived; }
73
+ static get isEmailAuthenticationGuestUser() { return this._contextInfo.isEmailAuthenticationGuestUser; }
74
+ static get isExternalGuestUser() { return this._contextInfo.isExternalGuestUser; }
75
+ static get isGroupRelatedSite() { return this._contextInfo.isGroupRelatedSite; }
76
+ static get isGroupifyDisabled() { return this._contextInfo.isGroupifyDisabled; }
77
+ static get isGroupifyMenuButtonFeatureOff() { return this._contextInfo.isGroupifyMenuButtonFeatureOff; }
78
+ static get isHubSite() { return this._contextInfo.isHubSite; }
79
+ static get isLocationserviceAvailable() { return this._contextInfo.isLocationserviceAvailable; }
80
+ static get isMultiGeoODBMode() { return this._contextInfo.isMultiGeoODBMode; }
81
+ static get isMultiGeoTenant() { return this._contextInfo.isMultiGeoTenant; }
82
+ static get isNoScriptEnabled() { return this._contextInfo.isNoScriptEnabled; }
83
+ static get isSiteAdmin() { return this._contextInfo.isSiteAdmin; }
84
+ static get isSiteOwner() { return this._contextInfo.isSiteOwner; }
85
+ static get isSPO() { return this._contextInfo.isSPO; }
86
+ static get isShareByLinkEnabled() { return this._contextInfo.isShareByLinkEnabled; }
87
+ static get isTeamsChannelSite() { return this._contextInfo.isTeamsChannelSite; }
88
+ static get isTeamsConnectedSite() { return this._contextInfo.isTeamsConnectedSite; }
89
+ static get isTenantDevSite() { return this._contextInfo.isTenantDevSite; }
90
+ static get isUnauthorizedTenant() { return this._contextInfo.isUnauthorizedTenant; }
91
+ static get isWebWelcomePage() { return this._contextInfo.isWebWelcomePage; }
92
+ static get layoutsUrl() { return this._contextInfo.layoutsUrl; }
93
+ static get listBaseTemplate() { return this._contextInfo.listBaseTemplate; }
94
+ static get listBaseType() { return this._contextInfo.listBaseType; }
95
+ static get listId() { return this._contextInfo.listId; }
96
+ static get listItemCount() { return this._contextInfo.listItemCount; }
97
+ static get listTitle() { return this._contextInfo.listTitle; }
98
+ static get listPermsMask() { return this._contextInfo.listPermsMask; }
99
+ static get listUrl() { return this._contextInfo.listUrl; }
100
+ static get maximumFileSize() { return this._contextInfo.maximumFileSize; }
101
+ static get modernThemingEnabled() { return this._contextInfo.modernThemingEnabled; }
102
+ static get msGraphEndpointUrl() { return this._contextInfo.msGraphEndpointUrl; }
103
+ static get msMruEndpointUrl() { return this._contextInfo.msMruEndpointUrl; }
104
+ static get multiGeoInfo() { return this._contextInfo.multiGeoInfo; }
105
+ static get navigationInfo() { return this._contextInfo.navigationInfo; }
106
+ static get nid() { return this._contextInfo.nid; }
107
+ static get openInClient() { return this._contextInfo.openInClient; }
108
+ static get pageItemId() { return this._contextInfo.pageItemId; }
109
+ static get pageListId() { return this._contextInfo.pageListId; }
110
+ static get pagePermsMask() { return this._contextInfo.pagePermsMask; }
111
+ static get pagePersonalizationScope() { return this._contextInfo.pagePersonalizationScope; }
112
+ static get preferUserTimeZone() { return this._contextInfo.preferUserTimeZone; }
113
+ static get PreviewFeaturesEnabled() { return this._contextInfo.PreviewFeaturesEnabled; }
114
+ static get portalUrl() { return this._contextInfo.portalUrl; }
115
+ static get profileUrl() { return this._contextInfo.profileUrl; }
116
+ static get PublishingFeatureOn() { return this._contextInfo.PublishingFeatureOn; }
117
+ static get RecycleBinItemCount() { return this._contextInfo.RecycleBinItemCount; }
118
+ static get serverRedirectedUrl() { return this._contextInfo.serverRedirectedUrl; }
119
+ static get serverRequestPath() { return this._contextInfo.serverRequestPath; }
120
+ static get serverTime() { return this._contextInfo.serverTime; }
121
+ static get showNGSCDialogForSyncOnODB() { return this._contextInfo.showNGSCDialogForSyncOnODB; }
122
+ static get showNGSCDialogForSyncOnTS() { return this._contextInfo.showNGSCDialogForSyncOnTS; }
123
+ static get siteAbsoluteUrl() { return this._contextInfo.siteAbsoluteUrl; }
124
+ static get siteClassification() { return this._contextInfo.siteClassification; }
125
+ static get siteClientTag() { return this._contextInfo.siteClientTag; }
126
+ static get siteColor() { return this._contextInfo.siteColor; }
127
+ static get siteId() { return this._contextInfo.siteId; }
128
+ static get sitePagesEnabled() { return this._contextInfo.sitePagesEnabled; }
129
+ static get sitePagesFeatureVersion() { return this._contextInfo.sitePagesFeatureVersion; }
130
+ static get siteServerRelativeUrl() { return this._contextInfo.siteServerRelativeUrl; }
131
+ static get siteSubscriptionId() { return this._contextInfo.siteSubscriptionId; }
132
+ static get socialBarEnabled() { return this._contextInfo.socialBarEnabled; }
133
+ static get supportPercentStorePage() { return this._contextInfo.supportPercentStorePage; }
134
+ static get supportPoundStorePath() { return this._contextInfo.supportPoundStorePath; }
135
+ static get systemUserKey() { return this._contextInfo.systemUserKey; }
136
+ static get teamsChannelType() { return this._contextInfo.teamsChannelType; }
137
+ static get tenantAppVersion() { return this._contextInfo.tenantAppVersion; }
138
+ static get tenantDisplayName() { return this._contextInfo.tenantDisplayName; }
139
+ static get theme() { return (this.window && this.window["__themeState__"] ? this.window["__themeState__"].theme : null) || {}; }
140
+ static get themeCacheToken() { return this._contextInfo.themeCacheToken; }
141
+ static get themedCssFolderUrl() { return this._contextInfo.themedCssFolderUrl; }
142
+ static get themedImageFileNames() { return this._contextInfo.themedImageFileNames; }
143
+ static get updateFromDigestPageLoaded() { return this._contextInfo.updateFromDigestPageLoaded; }
144
+ static get userDisplayName() { return this._contextInfo.userDisplayName; }
145
+ static get userEmail() { return this._contextInfo.userEmail; }
146
+ static get userFirstDayOfWeek() { return this._contextInfo.userFirstDayOfWeek; }
147
+ static get userId() { return this._contextInfo.userId; }
148
+ static get userLoginName() { return this._contextInfo.userLoginName; }
149
+ static get userPhotoCdnBaseUrl() { return this._contextInfo.userPhotoCdnBaseUrl; }
150
+ static get userPrincipalName() { return this._contextInfo.userPrincipalName; }
151
+ static get userTime24() { return this._contextInfo.userTime24; }
152
+ static get userTimeZoneData() { return this._contextInfo.userTimeZoneData; }
153
+ static get userVoiceForFeedbackEnabled() { return this._contextInfo.userVoiceForFeedbackEnabled; }
154
+ static get viewId() { return this._contextInfo.viewId; }
155
+ static get viewOnlyExperienceEnabled() { return this._contextInfo.viewOnlyExperienceEnabled; }
156
+ static get webAbsoluteUrl() { return this._contextInfo.webAbsoluteUrl; }
157
+ static get webDescription() { return this._contextInfo.webDescription; }
158
+ static get webDomain() { return this._contextInfo.webDomain; }
159
+ static get webFirstDayOfWeek() { return this._contextInfo.webFirstDayOfWeek; }
160
+ static get webId() { return this._contextInfo.webId; }
161
+ static get webLanguage() { return this._contextInfo.webLanguage; }
162
+ static get webLanguageName() { return this._contextInfo.webLanguageName; }
163
+ static get webLogoUrl() { return this._contextInfo.webLogoUrl; }
164
+ static get webPermMasks() { return this._contextInfo.webPermMasks; }
165
+ static get webServerRelativeUrl() { return this._contextInfo.webServerRelativeUrl; }
166
+ static get webTemplate() { return this._contextInfo.webTemplate; }
167
+ static get webTemplateConfiguration() { return this._contextInfo.webTemplateConfiguration; }
168
+ static get webTime24() { return this._contextInfo.webTime24; }
169
+ static get webTimeZoneData() { return this._contextInfo.webTimeZoneData; }
170
+ static get webTitle() { return this._contextInfo.webTitle; }
171
+ static get webUIVersion() { return this._contextInfo.webUIVersion; }
172
+ static get window() { return typeof (window) == "undefined" ? {} : window; }
729
173
  /**
730
174
  * Methods
731
175
  */
732
176
  // Method to generate a guid
733
- _ContextInfo.generateGUID = function () {
177
+ static generateGUID() {
734
178
  // Set the batch id
735
179
  return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
736
180
  var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
737
181
  return v.toString(16);
738
182
  });
739
- };
183
+ }
740
184
  // Method to get the context information for a web
741
- _ContextInfo.getWeb = function (url) {
185
+ static getWeb(url) {
742
186
  // Create a new base object
743
- return new utils_1.Base({
187
+ return new Base({
744
188
  endpoint: "contextinfo",
745
189
  keepalive: true,
746
190
  method: "POST",
747
- url: url
191
+ url
748
192
  });
749
- };
750
- _ContextInfo.enableRefreshToken = function (callback) {
751
- var _this = this;
752
- var isRunning = false;
193
+ }
194
+ static enableRefreshToken(callback) {
195
+ let isRunning = false;
753
196
  // Set the refresh event
754
197
  if (callback) {
755
198
  this._onRefresh.push(callback);
@@ -765,13 +208,13 @@ var _ContextInfo = /** @class */ (function () {
765
208
  return;
766
209
  }
767
210
  // Refresh method for REST
768
- var refreshREST = function () {
211
+ let refreshREST = () => {
769
212
  // Do nothing if it's currently running
770
213
  if (isRunning) {
771
214
  return;
772
215
  }
773
216
  // See if the digest is valid
774
- if (_this.validateToken()) {
217
+ if (this.validateToken()) {
775
218
  return;
776
219
  }
777
220
  // Log
@@ -779,35 +222,35 @@ var _ContextInfo = /** @class */ (function () {
779
222
  // Set the flag
780
223
  isRunning = true;
781
224
  // Get the context
782
- _this.getWeb().execute(function (context) {
225
+ this.getWeb().execute(context => {
783
226
  // Log
784
227
  console.info("[gd-sprest] Successfully updated the token information.");
785
228
  // Update the context info
786
- _this._contextInfo.formDigestTimeoutSeconds = context.GetContextWebInformation.FormDigestTimeoutSeconds;
787
- _this._contextInfo.formDigestValue = context.GetContextWebInformation.FormDigestValue;
229
+ this._contextInfo.formDigestTimeoutSeconds = context.GetContextWebInformation.FormDigestTimeoutSeconds;
230
+ this._contextInfo.formDigestValue = context.GetContextWebInformation.FormDigestValue;
788
231
  // Call the events
789
- _this._onRefresh.forEach(function (callback) { callback(); });
232
+ this._onRefresh.forEach(callback => { callback(); });
790
233
  // Set the flag
791
234
  isRunning = false;
792
- }, function () {
235
+ }, () => {
793
236
  // Log
794
237
  console.info("[gd-sprest] Unable to get the context information to refresh the token.");
795
238
  // Stop the process
796
- _this._worker.stop();
239
+ this._worker.stop();
797
240
  // Set the flag
798
241
  isRunning = false;
799
242
  });
800
243
  };
801
244
  // Refresh method for Graph
802
- var refreshGraph = function () {
245
+ let refreshGraph = () => {
803
246
  // Do nothing if it's currently running
804
247
  if (isRunning) {
805
248
  return;
806
249
  }
807
250
  // Ensure we have a token
808
- if (graph_1.Graph.TokenExpiration) {
251
+ if (Graph.TokenExpiration) {
809
252
  // See if the digest is valid
810
- if (Date.now() < graph_1.Graph.TokenExpiration - (60000 * exports.ContextInfo.refreshToken)) {
253
+ if (Date.now() < Graph.TokenExpiration - (60000 * ContextInfo.refreshToken)) {
811
254
  return;
812
255
  }
813
256
  }
@@ -816,72 +259,65 @@ var _ContextInfo = /** @class */ (function () {
816
259
  // Set the flag
817
260
  isRunning = true;
818
261
  // Get the cloud access token
819
- graph_1.Graph.getAccessToken(graph_1.Graph.Cloud, "SPO").execute(function (auth) {
262
+ Graph.getAccessToken(Graph.Cloud, "SPO").execute(auth => {
820
263
  // Log
821
264
  console.info("[gd-sprest] Successfully updated the graph token.");
822
265
  // Set the access token and expiration
823
- graph_1.Graph.Token = auth.access_token;
824
- graph_1.Graph.TokenExpiration = parseInt(auth.expires_on) * 1000;
266
+ Graph.Token = auth.access_token;
267
+ Graph.TokenExpiration = parseInt(auth.expires_on) * 1000;
825
268
  // Set the flag
826
269
  isRunning = false;
827
- }, function () {
270
+ }, () => {
828
271
  // Log
829
272
  console.info("[gd-sprest] Unable to refresh the graph token.");
830
273
  // Stop the process
831
- _this._worker.stop();
274
+ this._worker.stop();
832
275
  // Set the flag
833
276
  isRunning = false;
834
277
  });
835
278
  };
836
279
  // Create the process
837
- this._worker = (0, webWorker_1.WebWorker)(function () {
280
+ this._worker = WebWorker(() => {
838
281
  // Refresh the REST API token
839
282
  refreshREST();
840
283
  // Ensure this is SPO
841
- if (_this.isSPO) {
284
+ if (this.isSPO) {
842
285
  // Refresh the Graph API token
843
286
  refreshGraph();
844
287
  }
845
288
  }, 1000);
846
289
  // Start the process
847
290
  this._worker.start();
848
- };
849
- Object.defineProperty(_ContextInfo, "refreshToken", {
850
- get: function () { return this._refreshToken; },
851
- set: function (value) { this._refreshToken = value; },
852
- enumerable: false,
853
- configurable: true
854
- });
291
+ }
292
+ static get refreshToken() { return this._refreshToken; }
293
+ static set refreshToken(value) { this._refreshToken = value; }
855
294
  // Method to validate the token
856
- _ContextInfo.validateToken = function (digestValue) {
857
- if (digestValue === void 0) { digestValue = this._contextInfo.formDigestValue; }
295
+ static validateToken(digestValue = this._contextInfo.formDigestValue) {
858
296
  // See if no value exists
859
297
  if (digestValue == null) {
860
298
  return false;
861
299
  }
862
300
  // Get the current token expiration time
863
- var dtToken = new Date(digestValue.split(',')[1]);
864
- var timeout = this.formDigestTimeoutSeconds || 0;
301
+ let dtToken = new Date(digestValue.split(',')[1]);
302
+ let timeout = this.formDigestTimeoutSeconds || 0;
865
303
  // Return true if it's still valid
866
304
  // Time the token was granted + Timeout in seconds - (1 min (60000) * refresh token value)
867
305
  return Date.now() < dtToken.getTime() + timeout * 1000 - (60000 * this.refreshToken);
868
- };
869
- var _a;
870
- _a = _ContextInfo;
871
- // The page context information from an spfx project
872
- _ContextInfo._spfxPageContext = null;
873
- // Method to set the page context information from an SPFX project
874
- _ContextInfo.setPageContext = function (spfxPageContext) {
875
- // Set the page context information
876
- exports.ContextInfo["_spfxPageContext"] = spfxPageContext;
877
- // Enable the refresh token
878
- _a.enableRefreshToken();
879
- };
880
- _ContextInfo._worker = null;
881
- _ContextInfo._onRefresh = [];
882
- // Value in minutes to refresh the token
883
- // Default is 15 minutes prior to it expiring
884
- _ContextInfo._refreshToken = 15;
885
- return _ContextInfo;
886
- }());
887
- exports.ContextInfo = _ContextInfo;
306
+ }
307
+ }
308
+ _a = _ContextInfo;
309
+ // The page context information from an spfx project
310
+ _ContextInfo._spfxPageContext = null;
311
+ // Method to set the page context information from an SPFX project
312
+ _ContextInfo.setPageContext = (spfxPageContext) => {
313
+ // Set the page context information
314
+ ContextInfo["_spfxPageContext"] = spfxPageContext;
315
+ // Enable the refresh token
316
+ _a.enableRefreshToken();
317
+ };
318
+ _ContextInfo._worker = null;
319
+ _ContextInfo._onRefresh = [];
320
+ // Value in minutes to refresh the token
321
+ // Default is 15 minutes prior to it expiring
322
+ _ContextInfo._refreshToken = 15;
323
+ export const ContextInfo = _ContextInfo;