microsoft-graph 2.9.1 → 2.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/graphApi.d.ts.map +1 -1
- package/dist/cjs/graphApi.js +0 -5
- package/dist/cjs/models/Context.d.ts +0 -2
- package/dist/cjs/models/Context.d.ts.map +1 -1
- package/dist/cjs/operations/driveItem/getDriveItemContent.d.ts.map +1 -1
- package/dist/cjs/operations/driveItem/getDriveItemContent.js +0 -3
- package/dist/cjs/services/context.d.ts +1 -3
- package/dist/cjs/services/context.d.ts.map +1 -1
- package/dist/cjs/services/context.js +2 -5
- package/dist/cjs/services/drive.d.ts.map +1 -1
- package/dist/cjs/services/drive.js +1 -2
- package/dist/esm/graphApi.d.ts.map +1 -1
- package/dist/esm/graphApi.js +0 -5
- package/dist/esm/models/Context.d.ts +0 -2
- package/dist/esm/models/Context.d.ts.map +1 -1
- package/dist/esm/operations/driveItem/getDriveItemContent.d.ts.map +1 -1
- package/dist/esm/operations/driveItem/getDriveItemContent.js +0 -3
- package/dist/esm/services/context.d.ts +1 -3
- package/dist/esm/services/context.d.ts.map +1 -1
- package/dist/esm/services/context.js +2 -5
- package/dist/esm/services/drive.d.ts.map +1 -1
- package/dist/esm/services/drive.js +1 -2
- package/package.json +1 -11
- package/dist/cjs/services/httpAgent.d.ts +0 -9
- package/dist/cjs/services/httpAgent.d.ts.map +0 -1
- package/dist/cjs/services/httpAgent.js +0 -15
- package/dist/esm/services/httpAgent.d.ts +0 -9
- package/dist/esm/services/httpAgent.d.ts.map +0 -1
- package/dist/esm/services/httpAgent.js +0 -12
|
@@ -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;
|
|
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;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"}
|
package/dist/cjs/graphApi.js
CHANGED
|
@@ -15,7 +15,6 @@ const ProtocolError_ts_1 = __importDefault(require("./errors/ProtocolError.js"))
|
|
|
15
15
|
const RequestFailedError_ts_1 = __importDefault(require("./errors/RequestFailedError.js"));
|
|
16
16
|
const accessToken_ts_1 = require("./services/accessToken.js");
|
|
17
17
|
const context_ts_1 = require("./services/context.js");
|
|
18
|
-
const httpAgent_ts_1 = require("./services/httpAgent.js");
|
|
19
18
|
const httpStatus_ts_1 = require("./services/httpStatus.js");
|
|
20
19
|
const operationId_ts_1 = require("./services/operationId.js");
|
|
21
20
|
const sleep_ts_1 = require("./services/sleep.js");
|
|
@@ -51,7 +50,6 @@ const consecutiveRetryDelayMultiplier = 2;
|
|
|
51
50
|
async function executeSingle(definition) {
|
|
52
51
|
const context = (0, context_ts_1.getContext)(definition.contextId);
|
|
53
52
|
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
53
|
const response = await innerFetch({
|
|
56
54
|
url: `${exports.endpoint}${definition.path}`,
|
|
57
55
|
method: definition.method,
|
|
@@ -60,7 +58,6 @@ async function executeSingle(definition) {
|
|
|
60
58
|
...headersToObject(definition.headers),
|
|
61
59
|
},
|
|
62
60
|
data: definition.body === null ? null : definition.body,
|
|
63
|
-
httpAgent,
|
|
64
61
|
});
|
|
65
62
|
return definition.responseTransform(response);
|
|
66
63
|
}
|
|
@@ -79,7 +76,6 @@ async function executeBatch(...ops) {
|
|
|
79
76
|
}
|
|
80
77
|
const context = (0, context_ts_1.getContext)(contextId);
|
|
81
78
|
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
79
|
const body = await innerFetch({
|
|
84
80
|
url: exports.batchEndpoint,
|
|
85
81
|
method: "POST",
|
|
@@ -98,7 +94,6 @@ async function executeBatch(...ops) {
|
|
|
98
94
|
dependsOn: op.dependsOn?.map((id) => id.toString()),
|
|
99
95
|
})),
|
|
100
96
|
},
|
|
101
|
-
httpAgent,
|
|
102
97
|
});
|
|
103
98
|
const responses = [];
|
|
104
99
|
for (const r of body.responses) {
|
|
@@ -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,
|
|
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;
|
|
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
|
|
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,
|
|
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"}
|
|
@@ -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
|
|
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
|
|
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;
|
|
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
|
|
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;
|
|
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;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"}
|
package/dist/esm/graphApi.js
CHANGED
|
@@ -6,7 +6,6 @@ import ProtocolError from "./errors/ProtocolError.js";
|
|
|
6
6
|
import RequestFailedError from "./errors/RequestFailedError.js";
|
|
7
7
|
import { getCurrentAccessToken } from "./services/accessToken.js";
|
|
8
8
|
import { getContext } from "./services/context.js";
|
|
9
|
-
import { tryGetHttpAgent } from "./services/httpAgent.js";
|
|
10
9
|
import { isGatewayTimeout, isHttpOk, isHttpTooManyRequests, isServiceUnavailable } from "./services/httpStatus.js";
|
|
11
10
|
import { operationIdToIndex, operationIndexToId } from "./services/operationId.js";
|
|
12
11
|
import { sleep } from "./services/sleep.js";
|
|
@@ -42,7 +41,6 @@ const consecutiveRetryDelayMultiplier = 2;
|
|
|
42
41
|
async function executeSingle(definition) {
|
|
43
42
|
const context = getContext(definition.contextId);
|
|
44
43
|
const accessToken = await getCurrentAccessToken(context.tenantId, context.clientId, context.clientSecret, authenticationScope);
|
|
45
|
-
const httpAgent = tryGetHttpAgent(context.httpProxy);
|
|
46
44
|
const response = await innerFetch({
|
|
47
45
|
url: `${endpoint}${definition.path}`,
|
|
48
46
|
method: definition.method,
|
|
@@ -51,7 +49,6 @@ async function executeSingle(definition) {
|
|
|
51
49
|
...headersToObject(definition.headers),
|
|
52
50
|
},
|
|
53
51
|
data: definition.body === null ? null : definition.body,
|
|
54
|
-
httpAgent,
|
|
55
52
|
});
|
|
56
53
|
return definition.responseTransform(response);
|
|
57
54
|
}
|
|
@@ -70,7 +67,6 @@ async function executeBatch(...ops) {
|
|
|
70
67
|
}
|
|
71
68
|
const context = getContext(contextId);
|
|
72
69
|
const accessToken = await getCurrentAccessToken(context.tenantId, context.clientId, context.clientSecret, authenticationScope);
|
|
73
|
-
const httpAgent = tryGetHttpAgent(context.httpProxy);
|
|
74
70
|
const body = await innerFetch({
|
|
75
71
|
url: batchEndpoint,
|
|
76
72
|
method: "POST",
|
|
@@ -89,7 +85,6 @@ async function executeBatch(...ops) {
|
|
|
89
85
|
dependsOn: op.dependsOn?.map((id) => id.toString()),
|
|
90
86
|
})),
|
|
91
87
|
},
|
|
92
|
-
httpAgent,
|
|
93
88
|
});
|
|
94
89
|
const responses = [];
|
|
95
90
|
for (const r of body.responses) {
|
|
@@ -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,
|
|
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;
|
|
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
|
|
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,
|
|
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
|
|
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
|
|
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;
|
|
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
|
|
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.
|
|
3
|
+
"version": "2.9.2",
|
|
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
|
-
}
|