microsoft-graph 2.11.0 → 2.11.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 +2 -17
- package/dist/cjs/operations/driveItem/existsDriveItem.d.ts.map +1 -1
- package/dist/cjs/operations/driveItem/existsDriveItem.js +2 -5
- package/dist/cjs/operations/driveItem/getDriveItemContent.d.ts.map +1 -1
- package/dist/cjs/operations/driveItem/getDriveItemContent.js +2 -5
- package/dist/cjs/services/http.d.ts +3 -0
- package/dist/cjs/services/http.d.ts.map +1 -0
- package/dist/cjs/services/http.js +27 -0
- package/dist/cjs/services/rangeManipulation.d.ts +2 -1
- package/dist/cjs/services/rangeManipulation.d.ts.map +1 -1
- package/dist/cjs/services/rangeManipulation.js +5 -4
- package/dist/esm/graphApi.d.ts.map +1 -1
- package/dist/esm/graphApi.js +2 -17
- package/dist/esm/operations/driveItem/existsDriveItem.d.ts.map +1 -1
- package/dist/esm/operations/driveItem/existsDriveItem.js +2 -2
- package/dist/esm/operations/driveItem/getDriveItemContent.d.ts.map +1 -1
- package/dist/esm/operations/driveItem/getDriveItemContent.js +2 -2
- package/dist/esm/services/http.d.ts +3 -0
- package/dist/esm/services/http.d.ts.map +1 -0
- package/dist/esm/services/http.js +21 -0
- package/dist/esm/services/rangeManipulation.d.ts +2 -1
- package/dist/esm/services/rangeManipulation.d.ts.map +1 -1
- package/dist/esm/services/rangeManipulation.js +5 -4
- package/package.json +11 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphApi.d.ts","sourceRoot":"","sources":["../../src/graphApi.ts"],"names":[],"mappings":"
|
|
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"}
|
package/dist/cjs/graphApi.js
CHANGED
|
@@ -8,7 +8,6 @@ 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");
|
|
12
11
|
const InconsistentContextError_ts_1 = __importDefault(require("./errors/InconsistentContextError.js"));
|
|
13
12
|
const InvalidArgumentError_ts_1 = __importDefault(require("./errors/InvalidArgumentError.js"));
|
|
14
13
|
const NeverError_ts_1 = __importDefault(require("./errors/NeverError.js"));
|
|
@@ -19,6 +18,7 @@ const context_ts_1 = require("./services/context.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");
|
|
21
|
+
const http_ts_1 = require("./services/http.js");
|
|
22
22
|
exports.authenticationScope = "https://graph.microsoft.com/.default";
|
|
23
23
|
exports.endpoint = "https://graph.microsoft.com/v1.0";
|
|
24
24
|
exports.batchEndpoint = `${exports.endpoint}/$batch`;
|
|
@@ -128,24 +128,9 @@ async function innerFetch(args) {
|
|
|
128
128
|
let retryAfterMilliseconds = defaultRetryDelayMilliseconds;
|
|
129
129
|
let response = null;
|
|
130
130
|
let attempts = 0; // Track the number of attempts
|
|
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
|
-
}
|
|
146
131
|
while (attempts < maxRetries) {
|
|
147
132
|
try {
|
|
148
|
-
response = await
|
|
133
|
+
response = await (0, http_ts_1.executeHttpRequest)({
|
|
149
134
|
url,
|
|
150
135
|
...options,
|
|
151
136
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"existsDriveItem.d.ts","sourceRoot":"","sources":["../../../../src/operations/driveItem/existsDriveItem.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"existsDriveItem.d.ts","sourceRoot":"","sources":["../../../../src/operations/driveItem/existsDriveItem.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAOzD;;;;;GAKG;AACH,wBAA8B,eAAe,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC,CAwB3G"}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.default = existsDriveItem;
|
|
7
|
-
const axios_1 = __importDefault(require("axios"));
|
|
8
4
|
const graphApi_ts_1 = require("../../graphApi.js");
|
|
9
5
|
const accessToken_ts_1 = require("../../services/accessToken.js");
|
|
10
6
|
const context_ts_1 = require("../../services/context.js");
|
|
7
|
+
const http_ts_1 = require("../../services/http.js");
|
|
11
8
|
const httpStatus_ts_1 = require("../../services/httpStatus.js");
|
|
12
9
|
const templatedPaths_ts_1 = require("../../services/templatedPaths.js");
|
|
13
10
|
/**
|
|
@@ -21,7 +18,7 @@ async function existsDriveItem(driveRef, itemPath) {
|
|
|
21
18
|
const url = `${graphApi_ts_1.endpoint}${(0, templatedPaths_ts_1.generatePath)(`/sites/{site-id}/drives/{drive-id}/root:${itemPath}`, driveRef)}`;
|
|
22
19
|
const context = (0, context_ts_1.getContext)(driveRef.contextId);
|
|
23
20
|
const accessToken = await (0, accessToken_ts_1.getCurrentAccessToken)(context.tenantId, context.clientId, context.clientSecret, graphApi_ts_1.authenticationScope);
|
|
24
|
-
const response = await (0,
|
|
21
|
+
const response = await (0, http_ts_1.executeHttpRequest)({
|
|
25
22
|
url,
|
|
26
23
|
method: "GET",
|
|
27
24
|
headers: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDriveItemContent.d.ts","sourceRoot":"","sources":["../../../../src/operations/driveItem/getDriveItemContent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getDriveItemContent.d.ts","sourceRoot":"","sources":["../../../../src/operations/driveItem/getDriveItemContent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAOjE;;;;;;;GAOG;AACH,wBAA8B,mBAAmB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CA8B7F"}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.default = getDriveItemContent;
|
|
7
|
-
const axios_1 = __importDefault(require("axios"));
|
|
8
4
|
const graphApi_ts_1 = require("../../graphApi.js");
|
|
9
5
|
const accessToken_ts_1 = require("../../services/accessToken.js");
|
|
10
6
|
const context_ts_1 = require("../../services/context.js");
|
|
7
|
+
const http_ts_1 = require("../../services/http.js");
|
|
11
8
|
const httpStatus_ts_1 = require("../../services/httpStatus.js");
|
|
12
9
|
const templatedPaths_ts_1 = require("../../services/templatedPaths.js");
|
|
13
10
|
/**
|
|
@@ -23,7 +20,7 @@ async function getDriveItemContent(itemRef) {
|
|
|
23
20
|
const url = `${graphApi_ts_1.endpoint}${(0, templatedPaths_ts_1.generatePath)("/sites/{site-id}/drives/{drive-id}/items/{item-id}/content", itemRef)}`;
|
|
24
21
|
const context = (0, context_ts_1.getContext)(itemRef.contextId);
|
|
25
22
|
const accessToken = await (0, accessToken_ts_1.getCurrentAccessToken)(context.tenantId, context.clientId, context.clientSecret, graphApi_ts_1.authenticationScope);
|
|
26
|
-
const response = await (0,
|
|
23
|
+
const response = await (0, http_ts_1.executeHttpRequest)({
|
|
27
24
|
url,
|
|
28
25
|
method: "GET",
|
|
29
26
|
headers: {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../src/services/http.ts"],"names":[],"mappings":"AAAA,OAAc,EAAsB,KAAK,kBAAkB,EAA4B,MAAM,OAAO,CAAC;AAKrG,wBAAsB,kBAAkB,CAAC,MAAM,EAAE,kBAAkB,oDAMlE"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.executeHttpRequest = executeHttpRequest;
|
|
7
|
+
const axios_1 = __importDefault(require("axios"));
|
|
8
|
+
const https_proxy_agent_1 = require("https-proxy-agent");
|
|
9
|
+
let instance = null;
|
|
10
|
+
async function executeHttpRequest(config) {
|
|
11
|
+
if (!instance) {
|
|
12
|
+
instance = createAxiosInstance();
|
|
13
|
+
}
|
|
14
|
+
return await instance(config);
|
|
15
|
+
}
|
|
16
|
+
function createAxiosInstance() {
|
|
17
|
+
const config = {
|
|
18
|
+
validateStatus: () => true,
|
|
19
|
+
};
|
|
20
|
+
// biome-ignore lint/complexity/useLiteralKeys: Accessing env
|
|
21
|
+
const httpsProxy = process.env["HTTPS_PROXY"];
|
|
22
|
+
if (httpsProxy) {
|
|
23
|
+
config.proxy = false;
|
|
24
|
+
config.httpsAgent = new https_proxy_agent_1.HttpsProxyAgent(httpsProxy);
|
|
25
|
+
}
|
|
26
|
+
return axios_1.default.create(config);
|
|
27
|
+
}
|
|
@@ -22,7 +22,8 @@ export declare function inferRangeObject(values: CellRangeValues): unknown[];
|
|
|
22
22
|
* The first row of the 2D array contains the keys as headers.
|
|
23
23
|
*
|
|
24
24
|
* @param {unknown[]} objs - An array of objects to convert.
|
|
25
|
+
* @param {string[] | null} header - Optional header row. If not provided, it will be inferred from the object keys.
|
|
25
26
|
* @returns {CellRangeValues} A 2D array where the first row is the header and subsequent rows are the object values.
|
|
26
27
|
*/
|
|
27
|
-
export declare function inferObjectRange(objs: unknown[]): CellRangeValues;
|
|
28
|
+
export declare function inferObjectRange(objs: unknown[], header?: string[] | null): CellRangeValues;
|
|
28
29
|
//# sourceMappingURL=rangeManipulation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rangeManipulation.d.ts","sourceRoot":"","sources":["../../../src/services/rangeManipulation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAMpE;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CA4BlE;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,EAAE,CAoBnE;AAED
|
|
1
|
+
{"version":3,"file":"rangeManipulation.d.ts","sourceRoot":"","sources":["../../../src/services/rangeManipulation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAMpE;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CA4BlE;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,EAAE,CAoBnE;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,MAAM,GAAE,MAAM,EAAE,GAAG,IAAW,GAAG,eAAe,CASjG"}
|
|
@@ -66,13 +66,14 @@ function inferRangeObject(values) {
|
|
|
66
66
|
* The first row of the 2D array contains the keys as headers.
|
|
67
67
|
*
|
|
68
68
|
* @param {unknown[]} objs - An array of objects to convert.
|
|
69
|
+
* @param {string[] | null} header - Optional header row. If not provided, it will be inferred from the object keys.
|
|
69
70
|
* @returns {CellRangeValues} A 2D array where the first row is the header and subsequent rows are the object values.
|
|
70
71
|
*/
|
|
71
|
-
function inferObjectRange(objs) {
|
|
72
|
+
function inferObjectRange(objs, header = null) {
|
|
72
73
|
if (objs.length === 0) {
|
|
73
74
|
return [];
|
|
74
75
|
}
|
|
75
|
-
const
|
|
76
|
-
const rows = objs.map((obj) =>
|
|
77
|
-
return [
|
|
76
|
+
const usedHeader = header ?? Array.from(new Set(objs.flatMap((obj) => Object.keys(obj))));
|
|
77
|
+
const rows = objs.map((obj) => usedHeader.map((key) => obj[key]));
|
|
78
|
+
return [usedHeader, ...rows];
|
|
78
79
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphApi.d.ts","sourceRoot":"","sources":["../../src/graphApi.ts"],"names":[],"mappings":"
|
|
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"}
|
package/dist/esm/graphApi.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
|
-
import { HttpsProxyAgent } from "https-proxy-agent";
|
|
3
2
|
import InconsistentContextError from "./errors/InconsistentContextError.js";
|
|
4
3
|
import InvalidArgumentError from "./errors/InvalidArgumentError.js";
|
|
5
4
|
import NeverError from "./errors/NeverError.js";
|
|
@@ -10,6 +9,7 @@ import { getContext } from "./services/context.js";
|
|
|
10
9
|
import { isGatewayTimeout, isHttpSuccess, isHttpTooManyRequests, isServiceUnavailable } from "./services/httpStatus.js";
|
|
11
10
|
import { operationIdToIndex, operationIndexToId } from "./services/operationId.js";
|
|
12
11
|
import { sleep } from "./services/sleep.js";
|
|
12
|
+
import { executeHttpRequest } from "./services/http.js";
|
|
13
13
|
export const authenticationScope = "https://graph.microsoft.com/.default";
|
|
14
14
|
export const endpoint = "https://graph.microsoft.com/v1.0";
|
|
15
15
|
export const batchEndpoint = `${endpoint}/$batch`;
|
|
@@ -119,24 +119,9 @@ async function innerFetch(args) {
|
|
|
119
119
|
let retryAfterMilliseconds = defaultRetryDelayMilliseconds;
|
|
120
120
|
let response = null;
|
|
121
121
|
let attempts = 0; // Track the number of attempts
|
|
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
|
-
}
|
|
137
122
|
while (attempts < maxRetries) {
|
|
138
123
|
try {
|
|
139
|
-
response = await
|
|
124
|
+
response = await executeHttpRequest({
|
|
140
125
|
url,
|
|
141
126
|
...options,
|
|
142
127
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"existsDriveItem.d.ts","sourceRoot":"","sources":["../../../../src/operations/driveItem/existsDriveItem.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"existsDriveItem.d.ts","sourceRoot":"","sources":["../../../../src/operations/driveItem/existsDriveItem.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAOzD;;;;;GAKG;AACH,wBAA8B,eAAe,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC,CAwB3G"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import axios from "axios";
|
|
2
1
|
import { authenticationScope, endpoint } from "../../graphApi.js";
|
|
3
2
|
import { getCurrentAccessToken } from "../../services/accessToken.js";
|
|
4
3
|
import { getContext } from "../../services/context.js";
|
|
4
|
+
import { executeHttpRequest } from "../../services/http.js";
|
|
5
5
|
import { isHttpNotFound, isHttpOk } from "../../services/httpStatus.js";
|
|
6
6
|
import { generatePath } from "../../services/templatedPaths.js";
|
|
7
7
|
/**
|
|
@@ -15,7 +15,7 @@ export default async function existsDriveItem(driveRef, itemPath) {
|
|
|
15
15
|
const url = `${endpoint}${generatePath(`/sites/{site-id}/drives/{drive-id}/root:${itemPath}`, driveRef)}`;
|
|
16
16
|
const context = getContext(driveRef.contextId);
|
|
17
17
|
const accessToken = await getCurrentAccessToken(context.tenantId, context.clientId, context.clientSecret, authenticationScope);
|
|
18
|
-
const response = await
|
|
18
|
+
const response = await executeHttpRequest({
|
|
19
19
|
url,
|
|
20
20
|
method: "GET",
|
|
21
21
|
headers: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDriveItemContent.d.ts","sourceRoot":"","sources":["../../../../src/operations/driveItem/getDriveItemContent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getDriveItemContent.d.ts","sourceRoot":"","sources":["../../../../src/operations/driveItem/getDriveItemContent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAOjE;;;;;;;GAOG;AACH,wBAA8B,mBAAmB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CA8B7F"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import axios from "axios";
|
|
2
1
|
import { authenticationScope, endpoint } from "../../graphApi.js";
|
|
3
2
|
import { getCurrentAccessToken } from "../../services/accessToken.js";
|
|
4
3
|
import { getContext } from "../../services/context.js";
|
|
4
|
+
import { executeHttpRequest } from "../../services/http.js";
|
|
5
5
|
import { isHttpSuccess } from "../../services/httpStatus.js";
|
|
6
6
|
import { generatePath } from "../../services/templatedPaths.js";
|
|
7
7
|
/**
|
|
@@ -17,7 +17,7 @@ export default async function getDriveItemContent(itemRef) {
|
|
|
17
17
|
const url = `${endpoint}${generatePath("/sites/{site-id}/drives/{drive-id}/items/{item-id}/content", itemRef)}`;
|
|
18
18
|
const context = getContext(itemRef.contextId);
|
|
19
19
|
const accessToken = await getCurrentAccessToken(context.tenantId, context.clientId, context.clientSecret, authenticationScope);
|
|
20
|
-
const response = await
|
|
20
|
+
const response = await executeHttpRequest({
|
|
21
21
|
url,
|
|
22
22
|
method: "GET",
|
|
23
23
|
headers: {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../src/services/http.ts"],"names":[],"mappings":"AAAA,OAAc,EAAsB,KAAK,kBAAkB,EAA4B,MAAM,OAAO,CAAC;AAKrG,wBAAsB,kBAAkB,CAAC,MAAM,EAAE,kBAAkB,oDAMlE"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
import { HttpsProxyAgent } from "https-proxy-agent";
|
|
3
|
+
let instance = null;
|
|
4
|
+
export async function executeHttpRequest(config) {
|
|
5
|
+
if (!instance) {
|
|
6
|
+
instance = createAxiosInstance();
|
|
7
|
+
}
|
|
8
|
+
return await instance(config);
|
|
9
|
+
}
|
|
10
|
+
function createAxiosInstance() {
|
|
11
|
+
const config = {
|
|
12
|
+
validateStatus: () => true,
|
|
13
|
+
};
|
|
14
|
+
// biome-ignore lint/complexity/useLiteralKeys: Accessing env
|
|
15
|
+
const httpsProxy = process.env["HTTPS_PROXY"];
|
|
16
|
+
if (httpsProxy) {
|
|
17
|
+
config.proxy = false;
|
|
18
|
+
config.httpsAgent = new HttpsProxyAgent(httpsProxy);
|
|
19
|
+
}
|
|
20
|
+
return axios.create(config);
|
|
21
|
+
}
|
|
@@ -22,7 +22,8 @@ export declare function inferRangeObject(values: CellRangeValues): unknown[];
|
|
|
22
22
|
* The first row of the 2D array contains the keys as headers.
|
|
23
23
|
*
|
|
24
24
|
* @param {unknown[]} objs - An array of objects to convert.
|
|
25
|
+
* @param {string[] | null} header - Optional header row. If not provided, it will be inferred from the object keys.
|
|
25
26
|
* @returns {CellRangeValues} A 2D array where the first row is the header and subsequent rows are the object values.
|
|
26
27
|
*/
|
|
27
|
-
export declare function inferObjectRange(objs: unknown[]): CellRangeValues;
|
|
28
|
+
export declare function inferObjectRange(objs: unknown[], header?: string[] | null): CellRangeValues;
|
|
28
29
|
//# sourceMappingURL=rangeManipulation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rangeManipulation.d.ts","sourceRoot":"","sources":["../../../src/services/rangeManipulation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAMpE;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CA4BlE;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,EAAE,CAoBnE;AAED
|
|
1
|
+
{"version":3,"file":"rangeManipulation.d.ts","sourceRoot":"","sources":["../../../src/services/rangeManipulation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAMpE;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CA4BlE;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,EAAE,CAoBnE;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,MAAM,GAAE,MAAM,EAAE,GAAG,IAAW,GAAG,eAAe,CASjG"}
|
|
@@ -58,13 +58,14 @@ export function inferRangeObject(values) {
|
|
|
58
58
|
* The first row of the 2D array contains the keys as headers.
|
|
59
59
|
*
|
|
60
60
|
* @param {unknown[]} objs - An array of objects to convert.
|
|
61
|
+
* @param {string[] | null} header - Optional header row. If not provided, it will be inferred from the object keys.
|
|
61
62
|
* @returns {CellRangeValues} A 2D array where the first row is the header and subsequent rows are the object values.
|
|
62
63
|
*/
|
|
63
|
-
export function inferObjectRange(objs) {
|
|
64
|
+
export function inferObjectRange(objs, header = null) {
|
|
64
65
|
if (objs.length === 0) {
|
|
65
66
|
return [];
|
|
66
67
|
}
|
|
67
|
-
const
|
|
68
|
-
const rows = objs.map((obj) =>
|
|
69
|
-
return [
|
|
68
|
+
const usedHeader = header ?? Array.from(new Set(objs.flatMap((obj) => Object.keys(obj))));
|
|
69
|
+
const rows = objs.map((obj) => usedHeader.map((key) => obj[key]));
|
|
70
|
+
return [usedHeader, ...rows];
|
|
70
71
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "microsoft-graph",
|
|
3
|
-
"version": "2.11.
|
|
3
|
+
"version": "2.11.2",
|
|
4
4
|
"description": "Microsoft GraphAPI SDK for NodeJS",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -617,6 +617,11 @@
|
|
|
617
617
|
"require": "./dist/cjs/services/environmentVariable.js",
|
|
618
618
|
"types": "./dist/esm/services/environmentVariable.d.ts"
|
|
619
619
|
},
|
|
620
|
+
"./services/http": {
|
|
621
|
+
"import": "./dist/esm/services/http.js",
|
|
622
|
+
"require": "./dist/cjs/services/http.js",
|
|
623
|
+
"types": "./dist/esm/services/http.d.ts"
|
|
624
|
+
},
|
|
620
625
|
"./services/httpStatus": {
|
|
621
626
|
"import": "./dist/esm/services/httpStatus.js",
|
|
622
627
|
"require": "./dist/cjs/services/httpStatus.js",
|
|
@@ -1322,6 +1327,11 @@
|
|
|
1322
1327
|
"import": "./dist/esm/services/environmentVariable.js",
|
|
1323
1328
|
"types": "./dist/esm/services/environmentVariable.d.ts"
|
|
1324
1329
|
},
|
|
1330
|
+
"./dist/cjs/services/http.js": {
|
|
1331
|
+
"require": "./dist/cjs/services/http.js",
|
|
1332
|
+
"import": "./dist/esm/services/http.js",
|
|
1333
|
+
"types": "./dist/esm/services/http.d.ts"
|
|
1334
|
+
},
|
|
1325
1335
|
"./dist/cjs/services/httpStatus.js": {
|
|
1326
1336
|
"require": "./dist/cjs/services/httpStatus.js",
|
|
1327
1337
|
"import": "./dist/esm/services/httpStatus.js",
|