microsoft-graph 2.11.3 → 2.13.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 (36) hide show
  1. package/biome.jsonc +1 -1
  2. package/dist/cjs/errors/TimeoutError.d.ts +4 -0
  3. package/dist/cjs/errors/TimeoutError.d.ts.map +1 -0
  4. package/dist/cjs/errors/TimeoutError.js +9 -0
  5. package/dist/cjs/graphApi.js +7 -8
  6. package/dist/cjs/operations/driveItem/initiateCopyDriveItem.d.ts +3 -2
  7. package/dist/cjs/operations/driveItem/initiateCopyDriveItem.d.ts.map +1 -1
  8. package/dist/cjs/operations/driveItem/initiateCopyDriveItem.js +2 -2
  9. package/dist/cjs/operations/driveItem/moveDriveItem.d.ts +14 -0
  10. package/dist/cjs/operations/driveItem/moveDriveItem.d.ts.map +1 -0
  11. package/dist/cjs/operations/driveItem/moveDriveItem.js +33 -0
  12. package/dist/cjs/services/driveItem.d.ts +9 -0
  13. package/dist/cjs/services/driveItem.d.ts.map +1 -1
  14. package/dist/cjs/services/driveItem.js +18 -0
  15. package/dist/cjs/tasks/copyDriveItem.d.ts +14 -0
  16. package/dist/cjs/tasks/copyDriveItem.d.ts.map +1 -0
  17. package/dist/cjs/tasks/copyDriveItem.js +39 -0
  18. package/dist/esm/errors/TimeoutError.d.ts +4 -0
  19. package/dist/esm/errors/TimeoutError.d.ts.map +1 -0
  20. package/dist/esm/errors/TimeoutError.js +6 -0
  21. package/dist/esm/graphApi.js +7 -8
  22. package/dist/esm/operations/driveItem/initiateCopyDriveItem.d.ts +3 -2
  23. package/dist/esm/operations/driveItem/initiateCopyDriveItem.d.ts.map +1 -1
  24. package/dist/esm/operations/driveItem/initiateCopyDriveItem.js +2 -2
  25. package/dist/esm/operations/driveItem/moveDriveItem.d.ts +14 -0
  26. package/dist/esm/operations/driveItem/moveDriveItem.d.ts.map +1 -0
  27. package/dist/esm/operations/driveItem/moveDriveItem.js +30 -0
  28. package/dist/esm/services/driveItem.d.ts +9 -0
  29. package/dist/esm/services/driveItem.d.ts.map +1 -1
  30. package/dist/esm/services/driveItem.js +17 -0
  31. package/dist/esm/tasks/copyDriveItem.d.ts +14 -0
  32. package/dist/esm/tasks/copyDriveItem.d.ts.map +1 -0
  33. package/dist/esm/tasks/copyDriveItem.js +33 -0
  34. package/package.json +898 -143
  35. package/update-exports.ts +82 -93
  36. package/vitest.config.ts +17 -17
package/update-exports.ts CHANGED
@@ -1,101 +1,90 @@
1
- import * as fs from 'fs';
2
- import * as path from 'path';
3
-
4
- const esmDir = './dist/esm';
5
- const cjsDir = './dist/cjs';
6
- const pkgPath = './package.json';
7
- const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
8
-
9
- const exportsMap = {
10
- ".": {
11
- import: "./dist/esm/index.js",
12
- require: "./dist/cjs/index.js",
13
- types: "./dist/esm/index.d.ts"
14
- }
15
- };
16
-
17
- function isTestFile(fileName: string): boolean {
18
- return fileName.endsWith('.test.js') || fileName.endsWith('.spec.js');
1
+ import { readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
2
+ import { basename, extname, join } from "node:path";
3
+
4
+ const esmFolderPath = join(process.cwd(), "dist", "esm");
5
+ const cjsFolderPath = join(process.cwd(), "dist", "cjs");
6
+
7
+ const cjsPackageFilePath = join(cjsFolderPath, "package.json");
8
+ const esmPackageFilePath = join(esmFolderPath, "package.json");
9
+
10
+ const rootPackageFilePath = join(process.cwd(), "package.json");
11
+
12
+ patchRoot();
13
+ // biome-ignore lint/suspicious/noConsoleLog: Appropriate in this context
14
+ console.log("✅ package.json exports updated with");
15
+
16
+ createCjsPackageJson();
17
+ createEsmPackageJson();
18
+ // biome-ignore lint/suspicious/noConsoleLog: Appropriate in this context
19
+ console.log("✅ Generated package.json files in dist folders");
20
+
21
+ function patchRoot() {
22
+ const exportsMap = {
23
+ ".": {
24
+ import: "./dist/esm/index.js",
25
+ require: "./dist/cjs/index.js",
26
+ types: "./dist/esm/index.d.ts",
27
+ },
28
+ };
29
+
30
+ exportsWalk(esmFolderPath, exportsMap); // Use esmDir to determine what gets exported
31
+
32
+ const cjsEntries = Object.keys(exportsMap).filter((key) => key !== ".");
33
+ for (const entry of cjsEntries) {
34
+ const cjsOnlyPath = exportsMap[entry].require.replace("./dist/cjs/", "./dist/cjs/");
35
+ exportsMap[cjsOnlyPath] = {
36
+ require: exportsMap[entry].require,
37
+ import: exportsMap[entry].import,
38
+ types: exportsMap[entry].types,
39
+ };
40
+ }
41
+
42
+ const pkg = JSON.parse(readFileSync(rootPackageFilePath, "utf-8"));
43
+ pkg.exports = exportsMap;
44
+ writeFileSync(rootPackageFilePath, JSON.stringify(pkg, null, 2));
19
45
  }
20
46
 
21
- function isTestDir(path: string): boolean {
22
- return /\/(__tests__|__mocks__)(\/|$)/.test(path.replace(/\\/g, '/'));
47
+ function createCjsPackageJson() {
48
+ const body = {
49
+ type: "commonjs",
50
+ };
51
+ writeFileSync(cjsPackageFilePath, JSON.stringify(body, null, 2));
23
52
  }
24
53
 
25
- function walk(dir: string, currentRelPath = ''): void {
26
- const entries = fs.readdirSync(dir);
27
-
28
- for (const entry of entries) {
29
- const fullPath = path.join(dir, entry);
30
- const stats = fs.statSync(fullPath);
31
- const relPath = path.join(currentRelPath, entry);
32
-
33
- if (stats.isDirectory()) {
34
- if (!isTestDir(relPath)) {
35
- walk(fullPath, relPath);
36
- }
37
- } else if (
38
- entry.endsWith('.js') &&
39
- entry !== 'index.js' &&
40
- !isTestFile(entry) &&
41
- !isTestDir(relPath)
42
- ) {
43
- // Create a clean path without 'dist/esm' or 'dist/cjs'
44
- const cleanRelPath = relPath.replace(/\\/g, '/');
45
- const moduleBasePath = cleanRelPath.replace(/\.js$/, '');
46
-
47
- // Create a clean export path for the module (without dist)
48
- const exportPath = `./${moduleBasePath}`;
49
-
50
- exportsMap[exportPath] = {
51
- import: `./dist/esm/${cleanRelPath}`,
52
- require: `./dist/cjs/${cleanRelPath}`,
53
- types: `./dist/esm/${cleanRelPath.replace(/\.js$/, '.d.ts')}`
54
- };
55
- }
56
- }
54
+ function createEsmPackageJson() {
55
+ const body = {
56
+ type: "module",
57
+ };
58
+ writeFileSync(esmPackageFilePath, JSON.stringify(body, null, 2));
57
59
  }
58
60
 
59
- walk(esmDir); // Use esmDir to determine what gets exported
60
-
61
- function addCjsAndEsmExports() {
62
- const cjsEntries = Object.keys(exportsMap).filter((key) => key !== ".");
63
- for (const entry of cjsEntries) {
64
- const cjsOnlyPath = exportsMap[entry].require.replace('./dist/cjs/', './dist/cjs/');
65
- exportsMap[cjsOnlyPath] = {
66
- require: exportsMap[entry].require,
67
- import: exportsMap[entry].import,
68
- types: exportsMap[entry].types
69
- };
70
- }
61
+ function exportsWalk(dir: string, exportsMap, currentRelPath = ""): void {
62
+ const entries = readdirSync(dir);
63
+
64
+ for (const entry of entries) {
65
+ const fullPath = join(dir, entry);
66
+ const stats = statSync(fullPath);
67
+ const relPath = join(currentRelPath, entry);
68
+
69
+ if (stats.isDirectory()) {
70
+ exportsWalk(fullPath, exportsMap, relPath);
71
+ } else if (extname(entry) === ".js" && entry !== "index.js" && !isTestFile(entry)) {
72
+ const target = {
73
+ import: `./dist/esm/${relPath}`,
74
+ require: `./dist/cjs/${relPath}`,
75
+ types: `./dist/esm/${
76
+ // biome-ignore lint/performance/useTopLevelRegex: <explanation>
77
+ relPath.replace(/\.js$/, ".d.ts")
78
+ }`,
79
+ };
80
+
81
+ exportsMap[`./${relPath}`] = target;
82
+ // exportsMap[`./${relPath.replace(/\.js$/, "")}`] = target;
83
+ exportsMap[`./${basename(entry, extname(entry))}`] = target;
84
+ }
85
+ }
71
86
  }
72
87
 
73
- addCjsAndEsmExports();
74
-
75
- pkg.exports = exportsMap;
76
-
77
- fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + "\n");
78
- console.log("✅ package.json exports updated with", Object.keys(exportsMap).length, "entries");
79
-
80
- // Generate package.json for CJS modules
81
- const cjsPackageJson = {
82
- type: "commonjs"
83
- };
84
-
85
- // Generate package.json for ESM modules
86
- const esmPackageJson = {
87
- type: "module"
88
- };
89
-
90
- // Write the package.json files
91
- fs.writeFileSync(
92
- path.join(process.cwd(), 'dist', 'cjs', 'package.json'),
93
- JSON.stringify(cjsPackageJson, null, 2)
94
- );
95
-
96
- fs.writeFileSync(
97
- path.join(process.cwd(), 'dist', 'esm', 'package.json'),
98
- JSON.stringify(esmPackageJson, null, 2)
99
- );
100
-
101
- console.log('✅ Generated package.json files in dist folders');
88
+ function isTestFile(fileName: string): boolean {
89
+ return fileName.endsWith(".test.js") || fileName.endsWith(".spec.js");
90
+ }
package/vitest.config.ts CHANGED
@@ -1,20 +1,20 @@
1
1
  import { defineConfig } from "vitest/config";
2
2
 
3
3
  export default defineConfig({
4
- test: {
5
- environment: "node",
6
- watch: false,
7
- include: ["src/**/*.test.ts"],
8
- maxConcurrency: 1, // Avoid API throttling
9
- retry: 1,
10
- poolOptions: {
11
- threads: {
12
- maxThreads: 1,// Avoid API throttling
13
- },
14
- },
15
- sequence: {
16
- concurrent: false,
17
- },
18
- testTimeout: 16000,
19
- },
20
- });
4
+ test: {
5
+ environment: "node",
6
+ watch: false,
7
+ include: ["src/**/*.test.ts"],
8
+ maxConcurrency: 1, // Avoid API throttling
9
+ retry: 1,
10
+ poolOptions: {
11
+ threads: {
12
+ maxThreads: 1, // Avoid API throttling
13
+ },
14
+ },
15
+ sequence: {
16
+ concurrent: false,
17
+ },
18
+ testTimeout: 16000,
19
+ },
20
+ });