microsoft-graph 2.9.1 → 2.9.3

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.
@@ -1 +1 @@
1
- {"version":3,"file":"graphApi.d.ts","sourceRoot":"","sources":["../../src/graphApi.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAgB,cAAc,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACzG,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAQ/C,eAAO,MAAM,mBAAmB,EAA6C,KAAK,CAAC;AACnF,eAAO,MAAM,QAAQ,qCAAqC,CAAC;AAC3D,eAAO,MAAM,aAAa,4CAAuB,CAAC;AAElD,8KAA8K;AAC9K,wBAAgB,SAAS,CAAC,CAAC,EAAE,UAAU,EAAE,wBAAwB,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAQvF;AAED,6LAA6L;AAC7L,wBAAsB,QAAQ,CAAC,CAAC,SAAS,cAAc,CAAC,OAAO,CAAC,EAAE,EAAE,GAAG,UAAU,EAAE,CAAC,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAInH;AAED,2DAA2D;AAC3D,wBAAsB,UAAU,CAAC,CAAC,SAAS,cAAc,CAAC,OAAO,CAAC,EAAE,EAAE,GAAG,UAAU,EAAE,CAAC,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAOrH;AAoBD,KAAK,iBAAiB,CAAC,CAAC,IAAI;KAC1B,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,cAAc,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK;CAChE,CAAC"}
1
+ {"version":3,"file":"graphApi.d.ts","sourceRoot":"","sources":["../../src/graphApi.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAgB,cAAc,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACzG,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAO/C,eAAO,MAAM,mBAAmB,EAA6C,KAAK,CAAC;AACnF,eAAO,MAAM,QAAQ,qCAAqC,CAAC;AAC3D,eAAO,MAAM,aAAa,4CAAuB,CAAC;AAElD,8KAA8K;AAC9K,wBAAgB,SAAS,CAAC,CAAC,EAAE,UAAU,EAAE,wBAAwB,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAQvF;AAED,6LAA6L;AAC7L,wBAAsB,QAAQ,CAAC,CAAC,SAAS,cAAc,CAAC,OAAO,CAAC,EAAE,EAAE,GAAG,UAAU,EAAE,CAAC,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAInH;AAED,2DAA2D;AAC3D,wBAAsB,UAAU,CAAC,CAAC,SAAS,cAAc,CAAC,OAAO,CAAC,EAAE,EAAE,GAAG,UAAU,EAAE,CAAC,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAOrH;AAoBD,KAAK,iBAAiB,CAAC,CAAC,IAAI;KAC1B,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,cAAc,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK;CAChE,CAAC"}
@@ -8,6 +8,7 @@ exports.operation = operation;
8
8
  exports.parallel = parallel;
9
9
  exports.sequential = sequential;
10
10
  const axios_1 = __importDefault(require("axios"));
11
+ const https_proxy_agent_1 = require("https-proxy-agent");
11
12
  const InconsistentContextError_ts_1 = __importDefault(require("./errors/InconsistentContextError.js"));
12
13
  const InvalidArgumentError_ts_1 = __importDefault(require("./errors/InvalidArgumentError.js"));
13
14
  const NeverError_ts_1 = __importDefault(require("./errors/NeverError.js"));
@@ -15,7 +16,6 @@ const ProtocolError_ts_1 = __importDefault(require("./errors/ProtocolError.js"))
15
16
  const RequestFailedError_ts_1 = __importDefault(require("./errors/RequestFailedError.js"));
16
17
  const accessToken_ts_1 = require("./services/accessToken.js");
17
18
  const context_ts_1 = require("./services/context.js");
18
- const httpAgent_ts_1 = require("./services/httpAgent.js");
19
19
  const httpStatus_ts_1 = require("./services/httpStatus.js");
20
20
  const operationId_ts_1 = require("./services/operationId.js");
21
21
  const sleep_ts_1 = require("./services/sleep.js");
@@ -51,7 +51,6 @@ const consecutiveRetryDelayMultiplier = 2;
51
51
  async function executeSingle(definition) {
52
52
  const context = (0, context_ts_1.getContext)(definition.contextId);
53
53
  const accessToken = await (0, accessToken_ts_1.getCurrentAccessToken)(context.tenantId, context.clientId, context.clientSecret, exports.authenticationScope);
54
- const httpAgent = (0, httpAgent_ts_1.tryGetHttpAgent)(context.httpProxy);
55
54
  const response = await innerFetch({
56
55
  url: `${exports.endpoint}${definition.path}`,
57
56
  method: definition.method,
@@ -60,7 +59,6 @@ async function executeSingle(definition) {
60
59
  ...headersToObject(definition.headers),
61
60
  },
62
61
  data: definition.body === null ? null : definition.body,
63
- httpAgent,
64
62
  });
65
63
  return definition.responseTransform(response);
66
64
  }
@@ -79,7 +77,6 @@ async function executeBatch(...ops) {
79
77
  }
80
78
  const context = (0, context_ts_1.getContext)(contextId);
81
79
  const accessToken = await (0, accessToken_ts_1.getCurrentAccessToken)(context.tenantId, context.clientId, context.clientSecret, exports.authenticationScope);
82
- const httpAgent = (0, httpAgent_ts_1.tryGetHttpAgent)(context.httpProxy);
83
80
  const body = await innerFetch({
84
81
  url: exports.batchEndpoint,
85
82
  method: "POST",
@@ -98,7 +95,6 @@ async function executeBatch(...ops) {
98
95
  dependsOn: op.dependsOn?.map((id) => id.toString()),
99
96
  })),
100
97
  },
101
- httpAgent,
102
98
  });
103
99
  const responses = [];
104
100
  for (const r of body.responses) {
@@ -132,9 +128,21 @@ async function innerFetch(args) {
132
128
  let retryAfterMilliseconds = defaultRetryDelayMilliseconds;
133
129
  let response = null;
134
130
  let attempts = 0; // Track the number of attempts
135
- const instance = axios_1.default.create({
136
- httpsAgent: options.httpAgent,
137
- });
131
+ // TODO: Tidy this proxy work-around:
132
+ let instance;
133
+ // biome-ignore lint/complexity/useLiteralKeys: <explanation>
134
+ const httpsProxy = process.env["HTTPS_PROXY"];
135
+ if (httpsProxy) {
136
+ instance = axios_1.default.create({
137
+ proxy: false,
138
+ httpsAgent: new https_proxy_agent_1.HttpsProxyAgent(httpsProxy),
139
+ });
140
+ }
141
+ else {
142
+ instance = axios_1.default.create({
143
+ httpsAgent: options.httpAgent,
144
+ });
145
+ }
138
146
  while (attempts < maxRetries) {
139
147
  try {
140
148
  response = await instance({
@@ -1,11 +1,9 @@
1
1
  import type { ClientId } from "./ClientId.ts";
2
2
  import type { ClientSecret } from "./ClientSecret.ts";
3
- import type { HttpProxy } from "./HttpProxy.ts";
4
3
  import type { TenantId } from "./TenantId.ts";
5
4
  export type Context = {
6
5
  tenantId: TenantId;
7
6
  clientId: ClientId;
8
7
  clientSecret: ClientSecret;
9
- httpProxy: HttpProxy | undefined;
10
8
  };
11
9
  //# sourceMappingURL=Context.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../../src/models/Context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,MAAM,MAAM,OAAO,GAAG;IACrB,QAAQ,EAAE,QAAQ,CAAC;IACnB,QAAQ,EAAE,QAAQ,CAAC;IACnB,YAAY,EAAE,YAAY,CAAC;IAC3B,SAAS,EAAE,SAAS,GAAG,SAAS,CAAC;CACjC,CAAC"}
1
+ {"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../../src/models/Context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,MAAM,MAAM,OAAO,GAAG;IACrB,QAAQ,EAAE,QAAQ,CAAC;IACnB,QAAQ,EAAE,QAAQ,CAAC;IACnB,YAAY,EAAE,YAAY,CAAC;CAC3B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"getDriveItemContent.d.ts","sourceRoot":"","sources":["../../../../src/operations/driveItem/getDriveItemContent.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAOjE;;;;;;;GAOG;AACH,wBAA8B,mBAAmB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CAgC7F"}
1
+ {"version":3,"file":"getDriveItemContent.d.ts","sourceRoot":"","sources":["../../../../src/operations/driveItem/getDriveItemContent.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAMjE;;;;;;;GAOG;AACH,wBAA8B,mBAAmB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CA8B7F"}
@@ -8,7 +8,6 @@ const axios_1 = __importDefault(require("axios"));
8
8
  const graphApi_ts_1 = require("../../graphApi.js");
9
9
  const accessToken_ts_1 = require("../../services/accessToken.js");
10
10
  const context_ts_1 = require("../../services/context.js");
11
- const httpAgent_ts_1 = require("../../services/httpAgent.js");
12
11
  const httpStatus_ts_1 = require("../../services/httpStatus.js");
13
12
  const templatedPaths_ts_1 = require("../../services/templatedPaths.js");
14
13
  /**
@@ -24,7 +23,6 @@ async function getDriveItemContent(itemRef) {
24
23
  const url = `${graphApi_ts_1.endpoint}${(0, templatedPaths_ts_1.generatePath)("/sites/{site-id}/drives/{drive-id}/items/{item-id}/content", itemRef)}`;
25
24
  const context = (0, context_ts_1.getContext)(itemRef.contextId);
26
25
  const accessToken = await (0, accessToken_ts_1.getCurrentAccessToken)(context.tenantId, context.clientId, context.clientSecret, graphApi_ts_1.authenticationScope);
27
- const httpAgent = (0, httpAgent_ts_1.tryGetHttpAgent)(context.httpProxy);
28
26
  const response = await (0, axios_1.default)({
29
27
  url,
30
28
  method: "GET",
@@ -32,7 +30,6 @@ async function getDriveItemContent(itemRef) {
32
30
  authorization: `Bearer ${accessToken}`,
33
31
  },
34
32
  responseType: "arraybuffer",
35
- httpsAgent: httpAgent,
36
33
  });
37
34
  if (!(0, httpStatus_ts_1.isHttpOk)(response.status)) {
38
35
  throw new Error(`Failed to download file: ${response.status} ${response.statusText}`);
@@ -3,17 +3,15 @@ import type { ClientSecret } from "../models/ClientSecret.ts";
3
3
  import type { Context } from "../models/Context.ts";
4
4
  import type { ContextId } from "../models/ContextId.ts";
5
5
  import type { ContextRef } from "../models/ContextRef.ts";
6
- import type { HttpProxy } from "../models/HttpProxy.ts";
7
6
  import type { TenantId } from "../models/TenantId.ts";
8
7
  /**
9
8
  * Registers a tenant+client so that its secret can be used later.
10
9
  * @param tenantId - The tenant ID.
11
10
  * @param clientId - The client ID.
12
11
  * @param clientSecret - The client secret.
13
- * @param httpProxy - Optional HTTP proxy configuration.
14
12
  * @returns A reference to the registered context.
15
13
  */
16
- export declare function register(tenantId: TenantId, clientId: ClientId, clientSecret: ClientSecret, httpProxy?: HttpProxy | undefined): ContextRef;
14
+ export declare function register(tenantId: TenantId, clientId: ClientId, clientSecret: ClientSecret): ContextRef;
17
15
  /**
18
16
  * Retrieves the context for a given context ID.
19
17
  * @param contextId - The ID of the context.
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/services/context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAE,Y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E,SAAS,GAAG,OAAO,CAMxD;AAYD;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI,UAAU,CAQjD"}
@@ -15,16 +15,14 @@ const contexts = {};
15
15
  * @param tenantId - The tenant ID.
16
16
  * @param clientId - The client ID.
17
17
  * @param clientSecret - The client secret.
18
- * @param httpProxy - Optional HTTP proxy configuration.
19
18
  * @returns A reference to the registered context.
20
19
  */
21
- function register(tenantId, clientId, clientSecret, httpProxy) {
20
+ function register(tenantId, clientId, clientSecret) {
22
21
  const contextId = generateContextId();
23
22
  const context = {
24
23
  tenantId,
25
24
  clientId,
26
25
  clientSecret,
27
- httpProxy,
28
26
  };
29
27
  contexts[contextId] = context;
30
28
  const contextRef = createContextRef(contextId);
@@ -60,7 +58,6 @@ function getDefaultContextRef() {
60
58
  const tenantId = (0, environmentVariable_ts_1.getEnvironmentVariable)("AZURE_TENANT_ID");
61
59
  const clientId = (0, environmentVariable_ts_1.getEnvironmentVariable)("AZURE_CLIENT_ID");
62
60
  const clientSecret = (0, environmentVariable_ts_1.getEnvironmentVariable)("AZURE_CLIENT_SECRET");
63
- const httpProxy = ((0, environmentVariable_ts_1.getEnvironmentVariable)("HTTP_PROXY", "") || undefined);
64
- const contextRef = register(tenantId, clientId, clientSecret, httpProxy);
61
+ const contextRef = register(tenantId, clientId, clientSecret);
65
62
  return contextRef;
66
63
  }
@@ -1 +1 @@
1
- {"version":3,"file":"drive.d.ts","sourceRoot":"","sources":["../../../src/services/drive.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAMpD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,GAAG,SAAS,GAAG,QAAQ,CAUvF;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,QAAQ,CAa7C"}
1
+ {"version":3,"file":"drive.d.ts","sourceRoot":"","sources":["../../../src/services/drive.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAMpD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,GAAG,SAAS,GAAG,QAAQ,CAUvF;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,QAAQ,CAY7C"}
@@ -37,8 +37,7 @@ function getDefaultDriveRef() {
37
37
  const clientSecret = (0, environmentVariable_ts_1.getEnvironmentVariable)("AZURE_CLIENT_SECRET");
38
38
  const siteId = (0, environmentVariable_ts_1.getEnvironmentVariable)("SHAREPOINT_DEFAULT_SITE_ID");
39
39
  const driveId = (0, environmentVariable_ts_1.getEnvironmentVariable)("SHAREPOINT_DEFAULT_DRIVE_ID");
40
- const httpProxy = ((0, environmentVariable_ts_1.getEnvironmentVariable)("HTTP_PROXY", "") || undefined);
41
- const contextRef = (0, context_ts_1.register)(tenantId, clientId, clientSecret, httpProxy);
40
+ const contextRef = (0, context_ts_1.register)(tenantId, clientId, clientSecret);
42
41
  const siteRef = (0, site_ts_1.createSiteRef)(contextRef, siteId);
43
42
  const driveRef = createDriveRef(siteRef, driveId);
44
43
  return driveRef;
@@ -1 +1 @@
1
- {"version":3,"file":"graphApi.d.ts","sourceRoot":"","sources":["../../src/graphApi.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAgB,cAAc,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACzG,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAQ/C,eAAO,MAAM,mBAAmB,EA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AAQ,CAAC,CAAC,SAAS,cAAc,CAAC,OAAO,CAAC,EAAE,EAAE,GAAG,UAAU,EAAE,CAAC,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAInH;AAED,2DAA2D;AAC3D,wBAAsB,UAAU,CAAC,CAAC,SAAS,cAAc,CAAC,OAAO,CAAC,EAAE,EAAE,GAAG,UAAU,EAAE,CAAC,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAOrH;AAoBD,KAAK,iBAAiB,CAAC,CAAC,IAAI;KAC1B,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,cAAc,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK;CAChE,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import axios from "axios";
2
+ import { HttpsProxyAgent } from "https-proxy-agent";
2
3
  import InconsistentContextError from "./errors/InconsistentContextError.js";
3
4
  import InvalidArgumentError from "./errors/InvalidArgumentError.js";
4
5
  import NeverError from "./errors/NeverError.js";
@@ -6,7 +7,6 @@ import ProtocolError from "./errors/ProtocolError.js";
6
7
  import RequestFailedError from "./errors/RequestFailedError.js";
7
8
  import { getCurrentAccessToken } from "./services/accessToken.js";
8
9
  import { getContext } from "./services/context.js";
9
- import { tryGetHttpAgent } from "./services/httpAgent.js";
10
10
  import { isGatewayTimeout, isHttpOk, isHttpTooManyRequests, isServiceUnavailable } from "./services/httpStatus.js";
11
11
  import { operationIdToIndex, operationIndexToId } from "./services/operationId.js";
12
12
  import { sleep } from "./services/sleep.js";
@@ -42,7 +42,6 @@ const consecutiveRetryDelayMultiplier = 2;
42
42
  async function executeSingle(definition) {
43
43
  const context = getContext(definition.contextId);
44
44
  const accessToken = await getCurrentAccessToken(context.tenantId, context.clientId, context.clientSecret, authenticationScope);
45
- const httpAgent = tryGetHttpAgent(context.httpProxy);
46
45
  const response = await innerFetch({
47
46
  url: `${endpoint}${definition.path}`,
48
47
  method: definition.method,
@@ -51,7 +50,6 @@ async function executeSingle(definition) {
51
50
  ...headersToObject(definition.headers),
52
51
  },
53
52
  data: definition.body === null ? null : definition.body,
54
- httpAgent,
55
53
  });
56
54
  return definition.responseTransform(response);
57
55
  }
@@ -70,7 +68,6 @@ async function executeBatch(...ops) {
70
68
  }
71
69
  const context = getContext(contextId);
72
70
  const accessToken = await getCurrentAccessToken(context.tenantId, context.clientId, context.clientSecret, authenticationScope);
73
- const httpAgent = tryGetHttpAgent(context.httpProxy);
74
71
  const body = await innerFetch({
75
72
  url: batchEndpoint,
76
73
  method: "POST",
@@ -89,7 +86,6 @@ async function executeBatch(...ops) {
89
86
  dependsOn: op.dependsOn?.map((id) => id.toString()),
90
87
  })),
91
88
  },
92
- httpAgent,
93
89
  });
94
90
  const responses = [];
95
91
  for (const r of body.responses) {
@@ -123,9 +119,21 @@ async function innerFetch(args) {
123
119
  let retryAfterMilliseconds = defaultRetryDelayMilliseconds;
124
120
  let response = null;
125
121
  let attempts = 0; // Track the number of attempts
126
- const instance = axios.create({
127
- httpsAgent: options.httpAgent,
128
- });
122
+ // TODO: Tidy this proxy work-around:
123
+ let instance;
124
+ // biome-ignore lint/complexity/useLiteralKeys: <explanation>
125
+ const httpsProxy = process.env["HTTPS_PROXY"];
126
+ if (httpsProxy) {
127
+ instance = axios.create({
128
+ proxy: false,
129
+ httpsAgent: new HttpsProxyAgent(httpsProxy),
130
+ });
131
+ }
132
+ else {
133
+ instance = axios.create({
134
+ httpsAgent: options.httpAgent,
135
+ });
136
+ }
129
137
  while (attempts < maxRetries) {
130
138
  try {
131
139
  response = await instance({
@@ -1,11 +1,9 @@
1
1
  import type { ClientId } from "./ClientId.ts";
2
2
  import type { ClientSecret } from "./ClientSecret.ts";
3
- import type { HttpProxy } from "./HttpProxy.ts";
4
3
  import type { TenantId } from "./TenantId.ts";
5
4
  export type Context = {
6
5
  tenantId: TenantId;
7
6
  clientId: ClientId;
8
7
  clientSecret: ClientSecret;
9
- httpProxy: HttpProxy | undefined;
10
8
  };
11
9
  //# sourceMappingURL=Context.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../../src/models/Context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,MAAM,MAAM,OAAO,GAAG;IACrB,QAAQ,EAAE,QAAQ,CAAC;IACnB,QAAQ,EAAE,QAAQ,CAAC;IACnB,YAAY,EAAE,YAAY,CAAC;IAC3B,SAAS,EAAE,SAAS,GAAG,SAAS,CAAC;CACjC,CAAC"}
1
+ {"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../../src/models/Context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,MAAM,MAAM,OAAO,GAAG;IACrB,QAAQ,EAAE,QAAQ,CAAC;IACnB,QAAQ,EAAE,QAAQ,CAAC;IACnB,YAAY,EAAE,YAAY,CAAC;CAC3B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"getDriveItemContent.d.ts","sourceRoot":"","sources":["../../../../src/operations/driveItem/getDriveItemContent.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAOjE;;;;;;;GAOG;AACH,wBAA8B,mBAAmB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CAgC7F"}
1
+ {"version":3,"file":"getDriveItemContent.d.ts","sourceRoot":"","sources":["../../../../src/operations/driveItem/getDriveItemContent.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAMjE;;;;;;;GAOG;AACH,wBAA8B,mBAAmB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CA8B7F"}
@@ -2,7 +2,6 @@ import axios from "axios";
2
2
  import { authenticationScope, endpoint } from "../../graphApi.js";
3
3
  import { getCurrentAccessToken } from "../../services/accessToken.js";
4
4
  import { getContext } from "../../services/context.js";
5
- import { tryGetHttpAgent } from "../../services/httpAgent.js";
6
5
  import { isHttpOk } from "../../services/httpStatus.js";
7
6
  import { generatePath } from "../../services/templatedPaths.js";
8
7
  /**
@@ -18,7 +17,6 @@ export default async function getDriveItemContent(itemRef) {
18
17
  const url = `${endpoint}${generatePath("/sites/{site-id}/drives/{drive-id}/items/{item-id}/content", itemRef)}`;
19
18
  const context = getContext(itemRef.contextId);
20
19
  const accessToken = await getCurrentAccessToken(context.tenantId, context.clientId, context.clientSecret, authenticationScope);
21
- const httpAgent = tryGetHttpAgent(context.httpProxy);
22
20
  const response = await axios({
23
21
  url,
24
22
  method: "GET",
@@ -26,7 +24,6 @@ export default async function getDriveItemContent(itemRef) {
26
24
  authorization: `Bearer ${accessToken}`,
27
25
  },
28
26
  responseType: "arraybuffer",
29
- httpsAgent: httpAgent,
30
27
  });
31
28
  if (!isHttpOk(response.status)) {
32
29
  throw new Error(`Failed to download file: ${response.status} ${response.statusText}`);
@@ -3,17 +3,15 @@ import type { ClientSecret } from "../models/ClientSecret.ts";
3
3
  import type { Context } from "../models/Context.ts";
4
4
  import type { ContextId } from "../models/ContextId.ts";
5
5
  import type { ContextRef } from "../models/ContextRef.ts";
6
- import type { HttpProxy } from "../models/HttpProxy.ts";
7
6
  import type { TenantId } from "../models/TenantId.ts";
8
7
  /**
9
8
  * Registers a tenant+client so that its secret can be used later.
10
9
  * @param tenantId - The tenant ID.
11
10
  * @param clientId - The client ID.
12
11
  * @param clientSecret - The client secret.
13
- * @param httpProxy - Optional HTTP proxy configuration.
14
12
  * @returns A reference to the registered context.
15
13
  */
16
- export declare function register(tenantId: TenantId, clientId: ClientId, clientSecret: ClientSecret, httpProxy?: HttpProxy | undefined): ContextRef;
14
+ export declare function register(tenantId: TenantId, clientId: ClientId, clientSecret: ClientSecret): ContextRef;
17
15
  /**
18
16
  * Retrieves the context for a given context ID.
19
17
  * @param contextId - The ID of the context.
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/services/context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAMtD;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,UAAU,CAe1I;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAMxD;AAYD;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI,UAAU,CASjD"}
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/services/context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAMtD;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,YAAY,GAAG,UAAU,CAcvG;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAMxD;AAYD;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI,UAAU,CAQjD"}
@@ -7,16 +7,14 @@ const contexts = {};
7
7
  * @param tenantId - The tenant ID.
8
8
  * @param clientId - The client ID.
9
9
  * @param clientSecret - The client secret.
10
- * @param httpProxy - Optional HTTP proxy configuration.
11
10
  * @returns A reference to the registered context.
12
11
  */
13
- export function register(tenantId, clientId, clientSecret, httpProxy) {
12
+ export function register(tenantId, clientId, clientSecret) {
14
13
  const contextId = generateContextId();
15
14
  const context = {
16
15
  tenantId,
17
16
  clientId,
18
17
  clientSecret,
19
- httpProxy,
20
18
  };
21
19
  contexts[contextId] = context;
22
20
  const contextRef = createContextRef(contextId);
@@ -52,7 +50,6 @@ export function getDefaultContextRef() {
52
50
  const tenantId = getEnvironmentVariable("AZURE_TENANT_ID");
53
51
  const clientId = getEnvironmentVariable("AZURE_CLIENT_ID");
54
52
  const clientSecret = getEnvironmentVariable("AZURE_CLIENT_SECRET");
55
- const httpProxy = (getEnvironmentVariable("HTTP_PROXY", "") || undefined);
56
- const contextRef = register(tenantId, clientId, clientSecret, httpProxy);
53
+ const contextRef = register(tenantId, clientId, clientSecret);
57
54
  return contextRef;
58
55
  }
@@ -1 +1 @@
1
- {"version":3,"file":"drive.d.ts","sourceRoot":"","sources":["../../../src/services/drive.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAMpD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,GAAG,SAAS,GAAG,QAAQ,CAUvF;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,QAAQ,CAa7C"}
1
+ {"version":3,"file":"drive.d.ts","sourceRoot":"","sources":["../../../src/services/drive.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAMpD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,GAAG,SAAS,GAAG,QAAQ,CAUvF;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,QAAQ,CAY7C"}
@@ -30,8 +30,7 @@ export function getDefaultDriveRef() {
30
30
  const clientSecret = getEnvironmentVariable("AZURE_CLIENT_SECRET");
31
31
  const siteId = getEnvironmentVariable("SHAREPOINT_DEFAULT_SITE_ID");
32
32
  const driveId = getEnvironmentVariable("SHAREPOINT_DEFAULT_DRIVE_ID");
33
- const httpProxy = (getEnvironmentVariable("HTTP_PROXY", "") || undefined);
34
- const contextRef = register(tenantId, clientId, clientSecret, httpProxy);
33
+ const contextRef = register(tenantId, clientId, clientSecret);
35
34
  const siteRef = createSiteRef(contextRef, siteId);
36
35
  const driveRef = createDriveRef(siteRef, driveId);
37
36
  return driveRef;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microsoft-graph",
3
- "version": "2.9.1",
3
+ "version": "2.9.3",
4
4
  "description": "Microsoft GraphAPI SDK for NodeJS",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -607,11 +607,6 @@
607
607
  "require": "./dist/cjs/services/environmentVariable.js",
608
608
  "types": "./dist/esm/services/environmentVariable.d.ts"
609
609
  },
610
- "./services/httpAgent": {
611
- "import": "./dist/esm/services/httpAgent.js",
612
- "require": "./dist/cjs/services/httpAgent.js",
613
- "types": "./dist/esm/services/httpAgent.d.ts"
614
- },
615
610
  "./services/httpStatus": {
616
611
  "import": "./dist/esm/services/httpStatus.js",
617
612
  "require": "./dist/cjs/services/httpStatus.js",
@@ -1307,11 +1302,6 @@
1307
1302
  "import": "./dist/esm/services/environmentVariable.js",
1308
1303
  "types": "./dist/esm/services/environmentVariable.d.ts"
1309
1304
  },
1310
- "./dist/cjs/services/httpAgent.js": {
1311
- "require": "./dist/cjs/services/httpAgent.js",
1312
- "import": "./dist/esm/services/httpAgent.js",
1313
- "types": "./dist/esm/services/httpAgent.d.ts"
1314
- },
1315
1305
  "./dist/cjs/services/httpStatus.js": {
1316
1306
  "require": "./dist/cjs/services/httpStatus.js",
1317
1307
  "import": "./dist/esm/services/httpStatus.js",
@@ -1,9 +0,0 @@
1
- import { HttpsProxyAgent } from "https-proxy-agent";
2
- import type { HttpProxy } from "../models/HttpProxy.ts";
3
- /**
4
- * Attempts to create an HTTP agent for a given proxy configuration.
5
- * @param httpProxy - The HTTP proxy configuration.
6
- * @returns An instance of HttpsProxyAgent if the proxy is defined, otherwise undefined.
7
- */
8
- export declare function tryGetHttpAgent(httpProxy: HttpProxy | undefined): HttpsProxyAgent<string> | undefined;
9
- //# sourceMappingURL=httpAgent.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"httpAgent.d.ts","sourceRoot":"","sources":["../../../src/services/httpAgent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,GAAG,eAAe,CAAC,MAAM,CAAC,GAAG,SAAS,CAKrG"}
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.tryGetHttpAgent = tryGetHttpAgent;
4
- const https_proxy_agent_1 = require("https-proxy-agent");
5
- /**
6
- * Attempts to create an HTTP agent for a given proxy configuration.
7
- * @param httpProxy - The HTTP proxy configuration.
8
- * @returns An instance of HttpsProxyAgent if the proxy is defined, otherwise undefined.
9
- */
10
- function tryGetHttpAgent(httpProxy) {
11
- if (!httpProxy) {
12
- return undefined;
13
- }
14
- return new https_proxy_agent_1.HttpsProxyAgent(httpProxy);
15
- }
@@ -1,9 +0,0 @@
1
- import { HttpsProxyAgent } from "https-proxy-agent";
2
- import type { HttpProxy } from "../models/HttpProxy.ts";
3
- /**
4
- * Attempts to create an HTTP agent for a given proxy configuration.
5
- * @param httpProxy - The HTTP proxy configuration.
6
- * @returns An instance of HttpsProxyAgent if the proxy is defined, otherwise undefined.
7
- */
8
- export declare function tryGetHttpAgent(httpProxy: HttpProxy | undefined): HttpsProxyAgent<string> | undefined;
9
- //# sourceMappingURL=httpAgent.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"httpAgent.d.ts","sourceRoot":"","sources":["../../../src/services/httpAgent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,GAAG,eAAe,CAAC,MAAM,CAAC,GAAG,SAAS,CAKrG"}
@@ -1,12 +0,0 @@
1
- import { HttpsProxyAgent } from "https-proxy-agent";
2
- /**
3
- * Attempts to create an HTTP agent for a given proxy configuration.
4
- * @param httpProxy - The HTTP proxy configuration.
5
- * @returns An instance of HttpsProxyAgent if the proxy is defined, otherwise undefined.
6
- */
7
- export function tryGetHttpAgent(httpProxy) {
8
- if (!httpProxy) {
9
- return undefined;
10
- }
11
- return new HttpsProxyAgent(httpProxy);
12
- }