@pnp/graph 2.8.0 → 2.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/LICENSE +25 -25
  2. package/attachments/conversations.d.ts +9 -9
  3. package/attachments/conversations.js +4 -4
  4. package/attachments/index.d.ts +2 -2
  5. package/attachments/index.js +2 -2
  6. package/attachments/types.d.ts +26 -26
  7. package/attachments/types.js +46 -46
  8. package/batch.d.ts +17 -17
  9. package/batch.js +176 -176
  10. package/calendars/funcs.d.ts +36 -36
  11. package/calendars/funcs.js +43 -43
  12. package/calendars/groups.d.ts +13 -13
  13. package/calendars/groups.js +5 -5
  14. package/calendars/index.d.ts +4 -4
  15. package/calendars/index.js +3 -3
  16. package/calendars/types.d.ts +52 -52
  17. package/calendars/types.js +98 -98
  18. package/calendars/users.d.ts +22 -22
  19. package/calendars/users.js +9 -9
  20. package/cloud-communications/index.d.ts +8 -8
  21. package/cloud-communications/index.js +14 -14
  22. package/cloud-communications/types.d.ts +21 -21
  23. package/cloud-communications/types.js +46 -46
  24. package/cloud-communications/users.d.ts +9 -9
  25. package/cloud-communications/users.js +4 -4
  26. package/contacts/index.d.ts +2 -2
  27. package/contacts/index.js +2 -2
  28. package/contacts/types.d.ts +75 -75
  29. package/contacts/types.js +145 -145
  30. package/contacts/users.d.ts +11 -11
  31. package/contacts/users.js +5 -5
  32. package/conversations/groups.d.ts +13 -13
  33. package/conversations/groups.js +6 -6
  34. package/conversations/index.d.ts +2 -2
  35. package/conversations/index.js +2 -2
  36. package/conversations/types.d.ts +103 -103
  37. package/conversations/types.js +173 -173
  38. package/decorators.d.ts +103 -103
  39. package/decorators.js +138 -138
  40. package/directory-objects/index.d.ts +7 -7
  41. package/directory-objects/index.js +13 -13
  42. package/directory-objects/types.d.ts +67 -67
  43. package/directory-objects/types.js +96 -96
  44. package/graphhttpclient.d.ts +13 -13
  45. package/graphhttpclient.js +95 -95
  46. package/graphlibconfig.d.ts +21 -21
  47. package/graphlibconfig.js +19 -19
  48. package/graphqueryable.d.ts +156 -156
  49. package/graphqueryable.d.ts.map +1 -1
  50. package/graphqueryable.js +247 -242
  51. package/graphqueryable.js.map +1 -1
  52. package/groups/index.d.ts +7 -7
  53. package/groups/index.js +13 -13
  54. package/groups/types.d.ts +81 -81
  55. package/groups/types.js +137 -137
  56. package/index.d.ts +8 -8
  57. package/index.js +7 -7
  58. package/insights/index.d.ts +2 -2
  59. package/insights/index.js +2 -2
  60. package/insights/types.d.ts +76 -76
  61. package/insights/types.js +162 -162
  62. package/insights/users.d.ts +9 -9
  63. package/insights/users.js +4 -4
  64. package/invitations/index.d.ts +7 -7
  65. package/invitations/index.js +13 -13
  66. package/invitations/types.d.ts +25 -25
  67. package/invitations/types.js +44 -44
  68. package/members/groups.d.ts +11 -11
  69. package/members/groups.js +5 -5
  70. package/members/index.d.ts +2 -2
  71. package/members/index.js +2 -2
  72. package/members/types.d.ts +31 -31
  73. package/members/types.js +49 -49
  74. package/messages/index.d.ts +2 -2
  75. package/messages/index.js +2 -2
  76. package/messages/types.d.ts +43 -43
  77. package/messages/types.js +77 -77
  78. package/messages/users.d.ts +15 -15
  79. package/messages/users.js +10 -10
  80. package/onedrive/index.d.ts +2 -2
  81. package/onedrive/index.js +2 -2
  82. package/onedrive/types.d.ts +95 -95
  83. package/onedrive/types.js +241 -241
  84. package/onedrive/users.d.ts +11 -11
  85. package/onedrive/users.js +5 -5
  86. package/onenote/index.d.ts +2 -2
  87. package/onenote/index.js +2 -2
  88. package/onenote/types.d.ts +76 -76
  89. package/onenote/types.js +149 -149
  90. package/onenote/users.d.ts +9 -9
  91. package/onenote/users.js +4 -4
  92. package/operations.d.ts +8 -8
  93. package/operations.js +41 -41
  94. package/outlook/index.d.ts +2 -2
  95. package/outlook/index.js +2 -2
  96. package/outlook/types.d.ts +40 -40
  97. package/outlook/types.js +76 -76
  98. package/outlook/users.d.ts +9 -9
  99. package/outlook/users.js +4 -4
  100. package/package.json +5 -5
  101. package/photos/groups.d.ts +9 -9
  102. package/photos/groups.js +4 -4
  103. package/photos/index.d.ts +3 -3
  104. package/photos/index.js +3 -3
  105. package/photos/types.d.ts +21 -21
  106. package/photos/types.js +37 -37
  107. package/photos/users.d.ts +9 -9
  108. package/photos/users.js +4 -4
  109. package/planner/groups.d.ts +9 -9
  110. package/planner/groups.js +4 -4
  111. package/planner/index.d.ts +9 -9
  112. package/planner/index.js +15 -15
  113. package/planner/types.d.ts +117 -117
  114. package/planner/types.js +291 -291
  115. package/planner/users.d.ts +9 -9
  116. package/planner/users.js +4 -4
  117. package/presets/all.d.ts +38 -38
  118. package/presets/all.js +38 -38
  119. package/readme.md +21 -21
  120. package/rest.d.ts +30 -30
  121. package/rest.js +57 -57
  122. package/search/index.d.ts +7 -7
  123. package/search/index.js +18 -18
  124. package/search/types.d.ts +16 -16
  125. package/search/types.js +23 -23
  126. package/sites/group.d.ts +9 -9
  127. package/sites/group.js +4 -4
  128. package/sites/index.d.ts +2 -2
  129. package/sites/index.js +2 -2
  130. package/sites/types.d.ts +23 -23
  131. package/sites/types.js +47 -47
  132. package/subscriptions/index.d.ts +7 -7
  133. package/subscriptions/index.js +13 -13
  134. package/subscriptions/types.d.ts +37 -37
  135. package/subscriptions/types.js +72 -72
  136. package/teams/index.d.ts +19 -19
  137. package/teams/index.js +35 -35
  138. package/teams/types.d.ts +112 -111
  139. package/teams/types.d.ts.map +1 -1
  140. package/teams/types.js +261 -254
  141. package/teams/types.js.map +1 -1
  142. package/teams/users.d.ts +9 -9
  143. package/teams/users.js +4 -4
  144. package/types.d.ts +9 -9
  145. package/types.js +19 -19
  146. package/users/index.d.ts +8 -8
  147. package/users/index.js +23 -23
  148. package/users/types.d.ts +35 -35
  149. package/users/types.js +82 -82
  150. package/utils/toabsoluteurl.d.ts +7 -7
  151. package/utils/toabsoluteurl.js +48 -48
  152. package/utils/type.d.ts +3 -3
  153. package/utils/type.js +3 -3
@@ -1,97 +1,97 @@
1
- import { __decorate, __extends } from "tslib";
2
- import { _GraphQueryableCollection, _GraphQueryableInstance, graphInvokableFactory } from "../graphqueryable.js";
3
- import { defaultPath, getById, deleteable } from "../decorators.js";
4
- import { body } from "@pnp/odata";
5
- import { graphPost } from "../operations.js";
6
- /**
7
- * Represents a Directory Object entity
8
- */
9
- var _DirectoryObject = /** @class */ (function (_super) {
10
- __extends(_DirectoryObject, _super);
11
- function _DirectoryObject() {
12
- return _super !== null && _super.apply(this, arguments) || this;
13
- }
14
- /**
15
- * Returns all the groups and directory roles that the specified Directory Object is a member of. The check is transitive
16
- *
17
- * @param securityEnabledOnly
18
- */
19
- _DirectoryObject.prototype.getMemberObjects = function (securityEnabledOnly) {
20
- if (securityEnabledOnly === void 0) { securityEnabledOnly = false; }
21
- return graphPost(this.clone(DirectoryObject, "getMemberObjects"), body({ securityEnabledOnly: securityEnabledOnly }));
22
- };
23
- /**
24
- * Returns all the groups that the specified Directory Object is a member of. The check is transitive
25
- *
26
- * @param securityEnabledOnly
27
- */
28
- _DirectoryObject.prototype.getMemberGroups = function (securityEnabledOnly) {
29
- if (securityEnabledOnly === void 0) { securityEnabledOnly = false; }
30
- return graphPost(this.clone(DirectoryObject, "getMemberGroups"), body({ securityEnabledOnly: securityEnabledOnly }));
31
- };
32
- /**
33
- * Check for membership in a specified list of groups, and returns from that list those groups of which the specified user, group, or directory object is a member.
34
- * This function is transitive.
35
- * @param groupIds A collection that contains the object IDs of the groups in which to check membership. Up to 20 groups may be specified.
36
- */
37
- _DirectoryObject.prototype.checkMemberGroups = function (groupIds) {
38
- return graphPost(this.clone(DirectoryObject, "checkMemberGroups"), body({ groupIds: groupIds }));
39
- };
40
- _DirectoryObject = __decorate([
41
- deleteable()
42
- ], _DirectoryObject);
43
- return _DirectoryObject;
44
- }(_GraphQueryableInstance));
45
- export { _DirectoryObject };
46
- export var DirectoryObject = graphInvokableFactory(_DirectoryObject);
47
- /**
48
- * Describes a collection of Directory Objects
49
- *
50
- */
51
- var _DirectoryObjects = /** @class */ (function (_super) {
52
- __extends(_DirectoryObjects, _super);
53
- function _DirectoryObjects() {
54
- return _super !== null && _super.apply(this, arguments) || this;
55
- }
56
- /**
57
- * Returns the directory objects specified in a list of ids. NOTE: The directory objects returned are the full objects containing all their properties.
58
- * The $select query option is not available for this operation.
59
- *
60
- * @param ids A collection of ids for which to return objects. You can specify up to 1000 ids.
61
- * @param type A collection of resource types that specifies the set of resource collections to search. Default is directoryObject.
62
- */
63
- _DirectoryObjects.prototype.getByIds = function (ids, type) {
64
- if (type === void 0) { type = DirectoryObjectTypes.directoryObject; }
65
- return graphPost(this.clone(DirectoryObjects, "getByIds"), body({ ids: ids, type: type }));
66
- };
67
- _DirectoryObjects = __decorate([
68
- defaultPath("directoryObjects"),
69
- getById(DirectoryObject)
70
- ], _DirectoryObjects);
71
- return _DirectoryObjects;
72
- }(_GraphQueryableCollection));
73
- export { _DirectoryObjects };
74
- export var DirectoryObjects = graphInvokableFactory(_DirectoryObjects);
75
- /**
76
- * DirectoryObjectTypes
77
- */
78
- export var DirectoryObjectTypes;
79
- (function (DirectoryObjectTypes) {
80
- /**
81
- * Directory Objects
82
- */
83
- DirectoryObjectTypes[DirectoryObjectTypes["directoryObject"] = 0] = "directoryObject";
84
- /**
85
- * User
86
- */
87
- DirectoryObjectTypes[DirectoryObjectTypes["user"] = 1] = "user";
88
- /**
89
- * Group
90
- */
91
- DirectoryObjectTypes[DirectoryObjectTypes["group"] = 2] = "group";
92
- /**
93
- * Device
94
- */
95
- DirectoryObjectTypes[DirectoryObjectTypes["device"] = 3] = "device";
96
- })(DirectoryObjectTypes || (DirectoryObjectTypes = {}));
1
+ import { __decorate, __extends } from "tslib";
2
+ import { _GraphQueryableCollection, _GraphQueryableInstance, graphInvokableFactory } from "../graphqueryable.js";
3
+ import { defaultPath, getById, deleteable } from "../decorators.js";
4
+ import { body } from "@pnp/odata";
5
+ import { graphPost } from "../operations.js";
6
+ /**
7
+ * Represents a Directory Object entity
8
+ */
9
+ var _DirectoryObject = /** @class */ (function (_super) {
10
+ __extends(_DirectoryObject, _super);
11
+ function _DirectoryObject() {
12
+ return _super !== null && _super.apply(this, arguments) || this;
13
+ }
14
+ /**
15
+ * Returns all the groups and directory roles that the specified Directory Object is a member of. The check is transitive
16
+ *
17
+ * @param securityEnabledOnly
18
+ */
19
+ _DirectoryObject.prototype.getMemberObjects = function (securityEnabledOnly) {
20
+ if (securityEnabledOnly === void 0) { securityEnabledOnly = false; }
21
+ return graphPost(this.clone(DirectoryObject, "getMemberObjects"), body({ securityEnabledOnly: securityEnabledOnly }));
22
+ };
23
+ /**
24
+ * Returns all the groups that the specified Directory Object is a member of. The check is transitive
25
+ *
26
+ * @param securityEnabledOnly
27
+ */
28
+ _DirectoryObject.prototype.getMemberGroups = function (securityEnabledOnly) {
29
+ if (securityEnabledOnly === void 0) { securityEnabledOnly = false; }
30
+ return graphPost(this.clone(DirectoryObject, "getMemberGroups"), body({ securityEnabledOnly: securityEnabledOnly }));
31
+ };
32
+ /**
33
+ * Check for membership in a specified list of groups, and returns from that list those groups of which the specified user, group, or directory object is a member.
34
+ * This function is transitive.
35
+ * @param groupIds A collection that contains the object IDs of the groups in which to check membership. Up to 20 groups may be specified.
36
+ */
37
+ _DirectoryObject.prototype.checkMemberGroups = function (groupIds) {
38
+ return graphPost(this.clone(DirectoryObject, "checkMemberGroups"), body({ groupIds: groupIds }));
39
+ };
40
+ _DirectoryObject = __decorate([
41
+ deleteable()
42
+ ], _DirectoryObject);
43
+ return _DirectoryObject;
44
+ }(_GraphQueryableInstance));
45
+ export { _DirectoryObject };
46
+ export var DirectoryObject = graphInvokableFactory(_DirectoryObject);
47
+ /**
48
+ * Describes a collection of Directory Objects
49
+ *
50
+ */
51
+ var _DirectoryObjects = /** @class */ (function (_super) {
52
+ __extends(_DirectoryObjects, _super);
53
+ function _DirectoryObjects() {
54
+ return _super !== null && _super.apply(this, arguments) || this;
55
+ }
56
+ /**
57
+ * Returns the directory objects specified in a list of ids. NOTE: The directory objects returned are the full objects containing all their properties.
58
+ * The $select query option is not available for this operation.
59
+ *
60
+ * @param ids A collection of ids for which to return objects. You can specify up to 1000 ids.
61
+ * @param type A collection of resource types that specifies the set of resource collections to search. Default is directoryObject.
62
+ */
63
+ _DirectoryObjects.prototype.getByIds = function (ids, type) {
64
+ if (type === void 0) { type = DirectoryObjectTypes.directoryObject; }
65
+ return graphPost(this.clone(DirectoryObjects, "getByIds"), body({ ids: ids, type: type }));
66
+ };
67
+ _DirectoryObjects = __decorate([
68
+ defaultPath("directoryObjects"),
69
+ getById(DirectoryObject)
70
+ ], _DirectoryObjects);
71
+ return _DirectoryObjects;
72
+ }(_GraphQueryableCollection));
73
+ export { _DirectoryObjects };
74
+ export var DirectoryObjects = graphInvokableFactory(_DirectoryObjects);
75
+ /**
76
+ * DirectoryObjectTypes
77
+ */
78
+ export var DirectoryObjectTypes;
79
+ (function (DirectoryObjectTypes) {
80
+ /**
81
+ * Directory Objects
82
+ */
83
+ DirectoryObjectTypes[DirectoryObjectTypes["directoryObject"] = 0] = "directoryObject";
84
+ /**
85
+ * User
86
+ */
87
+ DirectoryObjectTypes[DirectoryObjectTypes["user"] = 1] = "user";
88
+ /**
89
+ * Group
90
+ */
91
+ DirectoryObjectTypes[DirectoryObjectTypes["group"] = 2] = "group";
92
+ /**
93
+ * Device
94
+ */
95
+ DirectoryObjectTypes[DirectoryObjectTypes["device"] = 3] = "device";
96
+ })(DirectoryObjectTypes || (DirectoryObjectTypes = {}));
97
97
  //# sourceMappingURL=types.js.map
@@ -1,14 +1,14 @@
1
- import { IRequestClient, IFetchOptions, IHttpClientImpl, Runtime } from "@pnp/common";
2
- export declare class GraphHttpClient implements IRequestClient {
3
- protected _runtime: Runtime;
4
- private _impl;
5
- constructor(runtime?: Runtime);
6
- constructor(runtime?: Runtime, impl?: IHttpClientImpl);
7
- fetch(url: string, options?: IFetchOptions): Promise<Response>;
8
- fetchRaw(url: string, options?: IFetchOptions): Promise<Response>;
9
- get(url: string, options?: IFetchOptions): Promise<Response>;
10
- post(url: string, options?: IFetchOptions): Promise<Response>;
11
- patch(url: string, options?: IFetchOptions): Promise<Response>;
12
- delete(url: string, options?: IFetchOptions): Promise<Response>;
13
- }
1
+ import { IRequestClient, IFetchOptions, IHttpClientImpl, Runtime } from "@pnp/common";
2
+ export declare class GraphHttpClient implements IRequestClient {
3
+ protected _runtime: Runtime;
4
+ private _impl;
5
+ constructor(runtime?: Runtime);
6
+ constructor(runtime?: Runtime, impl?: IHttpClientImpl);
7
+ fetch(url: string, options?: IFetchOptions): Promise<Response>;
8
+ fetchRaw(url: string, options?: IFetchOptions): Promise<Response>;
9
+ get(url: string, options?: IFetchOptions): Promise<Response>;
10
+ post(url: string, options?: IFetchOptions): Promise<Response>;
11
+ patch(url: string, options?: IFetchOptions): Promise<Response>;
12
+ delete(url: string, options?: IFetchOptions): Promise<Response>;
13
+ }
14
14
  //# sourceMappingURL=graphhttpclient.d.ts.map
@@ -1,96 +1,96 @@
1
- import { assign, mergeHeaders, getCtxCallback, DefaultRuntime, Runtime, objectDefinedNotNull, } from "@pnp/common";
2
- var GraphHttpClient = /** @class */ (function () {
3
- function GraphHttpClient() {
4
- // constructor(...args: [runtime: Runtime] | [impl: IHttpClientImpl, runtime?: Runtime]) {
5
- var args = [];
6
- for (var _i = 0; _i < arguments.length; _i++) {
7
- args[_i] = arguments[_i];
8
- }
9
- this._runtime = args.length > 0 && args[0] instanceof Runtime ? args[0] : DefaultRuntime;
10
- this._impl = args.length > 1 && objectDefinedNotNull(args[1]) ?
11
- args[1] : this._runtime.get("graph").fetchClientFactory() || null;
12
- if (this._impl === null) {
13
- throw Error("Could not generate fetchClientFactory in SPHttpClient.");
14
- }
15
- }
16
- GraphHttpClient.prototype.fetch = function (url, options) {
17
- var _a;
18
- if (options === void 0) { options = {}; }
19
- var headers = new Headers();
20
- // first we add the global headers so they can be overwritten by any passed in locally to this call
21
- mergeHeaders(headers, (_a = this._runtime.get("graph")) === null || _a === void 0 ? void 0 : _a.headers);
22
- // second we add the local options so we can overwrite the globals
23
- mergeHeaders(headers, options.headers);
24
- if (!headers.has("Content-Type")) {
25
- headers.append("Content-Type", "application/json");
26
- }
27
- if (!headers.has("SdkVersion")) {
28
- // this marks the requests for understanding by the service
29
- headers.append("SdkVersion", "PnPCoreJS/2.8.0");
30
- }
31
- var opts = assign(options, { headers: headers });
32
- return this.fetchRaw(url, opts);
33
- };
34
- GraphHttpClient.prototype.fetchRaw = function (url, options) {
35
- var _this = this;
36
- if (options === void 0) { options = {}; }
37
- // here we need to normalize the headers
38
- var rawHeaders = new Headers();
39
- mergeHeaders(rawHeaders, options.headers);
40
- options = assign(options, { headers: rawHeaders });
41
- var retry = function (ctx) {
42
- _this._impl.fetch(url, options).then(function (response) { return ctx.resolve(response); }).catch(function (response) {
43
- // Check if request was throttled - http status code 429
44
- // Check if request failed due to server unavailable - http status code 503
45
- // Check if request failed due to gateway timeout - http status code 504
46
- if (response.status !== 429 && response.status !== 503 && response.status !== 504) {
47
- ctx.reject(response);
48
- }
49
- // grab our current delay
50
- var delay = ctx.delay;
51
- // Increment our counters.
52
- ctx.delay *= 2;
53
- ctx.attempts++;
54
- // If we have exceeded the retry count, reject.
55
- if (ctx.retryCount <= ctx.attempts) {
56
- ctx.reject(response);
57
- }
58
- // Set our retry timeout for {delay} milliseconds.
59
- setTimeout(getCtxCallback(_this, retry, ctx), delay);
60
- });
61
- };
62
- return new Promise(function (resolve, reject) {
63
- var retryContext = {
64
- attempts: 0,
65
- delay: 100,
66
- reject: reject,
67
- resolve: resolve,
68
- retryCount: 7,
69
- };
70
- retry.call(_this, retryContext);
71
- });
72
- };
73
- GraphHttpClient.prototype.get = function (url, options) {
74
- if (options === void 0) { options = {}; }
75
- var opts = assign(options, { method: "GET" });
76
- return this.fetch(url, opts);
77
- };
78
- GraphHttpClient.prototype.post = function (url, options) {
79
- if (options === void 0) { options = {}; }
80
- var opts = assign(options, { method: "POST" });
81
- return this.fetch(url, opts);
82
- };
83
- GraphHttpClient.prototype.patch = function (url, options) {
84
- if (options === void 0) { options = {}; }
85
- var opts = assign(options, { method: "PATCH" });
86
- return this.fetch(url, opts);
87
- };
88
- GraphHttpClient.prototype.delete = function (url, options) {
89
- if (options === void 0) { options = {}; }
90
- var opts = assign(options, { method: "DELETE" });
91
- return this.fetch(url, opts);
92
- };
93
- return GraphHttpClient;
94
- }());
95
- export { GraphHttpClient };
1
+ import { assign, mergeHeaders, getCtxCallback, DefaultRuntime, Runtime, objectDefinedNotNull, } from "@pnp/common";
2
+ var GraphHttpClient = /** @class */ (function () {
3
+ function GraphHttpClient() {
4
+ // constructor(...args: [runtime: Runtime] | [impl: IHttpClientImpl, runtime?: Runtime]) {
5
+ var args = [];
6
+ for (var _i = 0; _i < arguments.length; _i++) {
7
+ args[_i] = arguments[_i];
8
+ }
9
+ this._runtime = args.length > 0 && args[0] instanceof Runtime ? args[0] : DefaultRuntime;
10
+ this._impl = args.length > 1 && objectDefinedNotNull(args[1]) ?
11
+ args[1] : this._runtime.get("graph").fetchClientFactory() || null;
12
+ if (this._impl === null) {
13
+ throw Error("Could not generate fetchClientFactory in SPHttpClient.");
14
+ }
15
+ }
16
+ GraphHttpClient.prototype.fetch = function (url, options) {
17
+ var _a;
18
+ if (options === void 0) { options = {}; }
19
+ var headers = new Headers();
20
+ // first we add the global headers so they can be overwritten by any passed in locally to this call
21
+ mergeHeaders(headers, (_a = this._runtime.get("graph")) === null || _a === void 0 ? void 0 : _a.headers);
22
+ // second we add the local options so we can overwrite the globals
23
+ mergeHeaders(headers, options.headers);
24
+ if (!headers.has("Content-Type")) {
25
+ headers.append("Content-Type", "application/json");
26
+ }
27
+ if (!headers.has("SdkVersion")) {
28
+ // this marks the requests for understanding by the service
29
+ headers.append("SdkVersion", "PnPCoreJS/2.12.0");
30
+ }
31
+ var opts = assign(options, { headers: headers });
32
+ return this.fetchRaw(url, opts);
33
+ };
34
+ GraphHttpClient.prototype.fetchRaw = function (url, options) {
35
+ var _this = this;
36
+ if (options === void 0) { options = {}; }
37
+ // here we need to normalize the headers
38
+ var rawHeaders = new Headers();
39
+ mergeHeaders(rawHeaders, options.headers);
40
+ options = assign(options, { headers: rawHeaders });
41
+ var retry = function (ctx) {
42
+ _this._impl.fetch(url, options).then(function (response) { return ctx.resolve(response); }).catch(function (response) {
43
+ // Check if request was throttled - http status code 429
44
+ // Check if request failed due to server unavailable - http status code 503
45
+ // Check if request failed due to gateway timeout - http status code 504
46
+ if (response.status !== 429 && response.status !== 503 && response.status !== 504) {
47
+ ctx.reject(response);
48
+ }
49
+ // grab our current delay
50
+ var delay = ctx.delay;
51
+ // Increment our counters.
52
+ ctx.delay *= 2;
53
+ ctx.attempts++;
54
+ // If we have exceeded the retry count, reject.
55
+ if (ctx.retryCount <= ctx.attempts) {
56
+ ctx.reject(response);
57
+ }
58
+ // Set our retry timeout for {delay} milliseconds.
59
+ setTimeout(getCtxCallback(_this, retry, ctx), delay);
60
+ });
61
+ };
62
+ return new Promise(function (resolve, reject) {
63
+ var retryContext = {
64
+ attempts: 0,
65
+ delay: 100,
66
+ reject: reject,
67
+ resolve: resolve,
68
+ retryCount: 7,
69
+ };
70
+ retry.call(_this, retryContext);
71
+ });
72
+ };
73
+ GraphHttpClient.prototype.get = function (url, options) {
74
+ if (options === void 0) { options = {}; }
75
+ var opts = assign(options, { method: "GET" });
76
+ return this.fetch(url, opts);
77
+ };
78
+ GraphHttpClient.prototype.post = function (url, options) {
79
+ if (options === void 0) { options = {}; }
80
+ var opts = assign(options, { method: "POST" });
81
+ return this.fetch(url, opts);
82
+ };
83
+ GraphHttpClient.prototype.patch = function (url, options) {
84
+ if (options === void 0) { options = {}; }
85
+ var opts = assign(options, { method: "PATCH" });
86
+ return this.fetch(url, opts);
87
+ };
88
+ GraphHttpClient.prototype.delete = function (url, options) {
89
+ if (options === void 0) { options = {}; }
90
+ var opts = assign(options, { method: "DELETE" });
91
+ return this.fetch(url, opts);
92
+ };
93
+ return GraphHttpClient;
94
+ }());
95
+ export { GraphHttpClient };
96
96
  //# sourceMappingURL=graphhttpclient.js.map
@@ -1,22 +1,22 @@
1
- import { ILibraryConfiguration, ITypedHash, IHttpClientImpl, Runtime } from "@pnp/common";
2
- export interface IGraphConfigurationPart {
3
- graph?: IGraphConfigurationProps;
4
- }
5
- export interface IGraphConfigurationProps {
6
- /**
7
- * The base url used for all requests (default: none)
8
- */
9
- baseUrl?: string;
10
- /**
11
- * Any headers to apply to all requests
12
- */
13
- headers?: ITypedHash<string>;
14
- /**
15
- * Defines a factory method used to create fetch clients
16
- */
17
- fetchClientFactory?: () => IHttpClientImpl;
18
- }
19
- export interface IGraphConfiguration extends ILibraryConfiguration, IGraphConfigurationPart {
20
- }
21
- export declare function setup(config: IGraphConfiguration, runtime?: Runtime): void;
1
+ import { ILibraryConfiguration, ITypedHash, IHttpClientImpl, Runtime } from "@pnp/common";
2
+ export interface IGraphConfigurationPart {
3
+ graph?: IGraphConfigurationProps;
4
+ }
5
+ export interface IGraphConfigurationProps {
6
+ /**
7
+ * The base url used for all requests (default: none)
8
+ */
9
+ baseUrl?: string;
10
+ /**
11
+ * Any headers to apply to all requests
12
+ */
13
+ headers?: ITypedHash<string>;
14
+ /**
15
+ * Defines a factory method used to create fetch clients
16
+ */
17
+ fetchClientFactory?: () => IHttpClientImpl;
18
+ }
19
+ export interface IGraphConfiguration extends ILibraryConfiguration, IGraphConfigurationPart {
20
+ }
21
+ export declare function setup(config: IGraphConfiguration, runtime?: Runtime): void;
22
22
  //# sourceMappingURL=graphlibconfig.d.ts.map
package/graphlibconfig.js CHANGED
@@ -1,20 +1,20 @@
1
- import { SPFxAdalClient, DefaultRuntime, onRuntimeCreate, objectDefinedNotNull } from "@pnp/common";
2
- onRuntimeCreate(function (runtime) {
3
- var existing = runtime.get("graph");
4
- var graphPart = Object.assign({}, {
5
- fetchClientFactory: function () {
6
- // we keep a ref to the runtime within which we are assigned
7
- var context = runtime.get("spfxContext");
8
- if (objectDefinedNotNull(context)) {
9
- return new SPFxAdalClient(context);
10
- }
11
- throw Error("There is no Graph Client available, either set one using configuration or provide a valid SPFx Context.");
12
- },
13
- }, existing);
14
- runtime.assign({ graph: graphPart });
15
- });
16
- export function setup(config, runtime) {
17
- if (runtime === void 0) { runtime = DefaultRuntime; }
18
- runtime.assign(config);
19
- }
1
+ import { SPFxAdalClient, DefaultRuntime, onRuntimeCreate, objectDefinedNotNull } from "@pnp/common";
2
+ onRuntimeCreate(function (runtime) {
3
+ var existing = runtime.get("graph");
4
+ var graphPart = Object.assign({}, {
5
+ fetchClientFactory: function () {
6
+ // we keep a ref to the runtime within which we are assigned
7
+ var context = runtime.get("spfxContext");
8
+ if (objectDefinedNotNull(context)) {
9
+ return new SPFxAdalClient(context);
10
+ }
11
+ throw Error("There is no Graph Client available, either set one using configuration or provide a valid SPFx Context.");
12
+ },
13
+ }, existing);
14
+ runtime.assign({ graph: graphPart });
15
+ });
16
+ export function setup(config, runtime) {
17
+ if (runtime === void 0) { runtime = DefaultRuntime; }
18
+ runtime.assign(config);
19
+ }
20
20
  //# sourceMappingURL=graphlibconfig.js.map