microsoft-graph 3.7.1 → 3.8.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 (99) hide show
  1. package/dist/cjs/models/Address.d.ts +32 -1
  2. package/dist/cjs/models/Address.d.ts.map +1 -1
  3. package/dist/cjs/models/DriveItem.d.ts +6 -0
  4. package/dist/cjs/models/DriveItem.d.ts.map +1 -1
  5. package/dist/cjs/operations/driveItem/createDriveItem.d.ts +3 -0
  6. package/dist/cjs/operations/driveItem/createDriveItem.d.ts.map +1 -1
  7. package/dist/cjs/operations/driveItem/createDriveItem.js +3 -0
  8. package/dist/cjs/operations/driveItem/createDriveItemContent.d.ts +21 -0
  9. package/dist/cjs/operations/driveItem/createDriveItemContent.d.ts.map +1 -0
  10. package/dist/cjs/operations/driveItem/createDriveItemContent.js +122 -0
  11. package/dist/cjs/operations/driveItem/existsDriveItem.d.ts.map +1 -1
  12. package/dist/cjs/operations/driveItem/existsDriveItem.js +1 -2
  13. package/dist/cjs/operations/driveItem/getDriveItemContent.d.ts.map +1 -1
  14. package/dist/cjs/operations/driveItem/getDriveItemContent.js +2 -9
  15. package/dist/cjs/operations/driveItem/streamDriveItemContent.d.ts.map +1 -1
  16. package/dist/cjs/operations/driveItem/streamDriveItemContent.js +2 -9
  17. package/dist/cjs/services/azureApplicationCredentials.d.ts +2 -7
  18. package/dist/cjs/services/azureApplicationCredentials.d.ts.map +1 -1
  19. package/dist/cjs/services/azureApplicationCredentials.js +2 -7
  20. package/dist/cjs/services/context.d.ts +11 -8
  21. package/dist/cjs/services/context.d.ts.map +1 -1
  22. package/dist/cjs/services/context.js +19 -16
  23. package/dist/cjs/services/http.d.ts +12 -2
  24. package/dist/cjs/services/http.d.ts.map +1 -1
  25. package/dist/cjs/services/http.js +207 -3
  26. package/dist/cjs/services/httpStatus.d.ts +6 -0
  27. package/dist/cjs/services/httpStatus.d.ts.map +1 -1
  28. package/dist/cjs/services/httpStatus.js +9 -0
  29. package/dist/cjs/services/operationInvoker.d.ts +0 -1
  30. package/dist/cjs/services/operationInvoker.d.ts.map +1 -1
  31. package/dist/cjs/services/operationInvoker.js +8 -207
  32. package/dist/cjs/services/usedAddress.d.ts +25 -0
  33. package/dist/cjs/services/usedAddress.d.ts.map +1 -0
  34. package/dist/cjs/services/usedAddress.js +69 -0
  35. package/dist/cjs/tasks/iterateDriveItems.d.ts.map +1 -1
  36. package/dist/cjs/tasks/iterateDriveItems.js +1 -2
  37. package/dist/cjs/tasks/iterateDrives.d.ts.map +1 -1
  38. package/dist/cjs/tasks/iterateDrives.js +1 -2
  39. package/dist/cjs/tasks/iterateSiteSearch.d.ts.map +1 -1
  40. package/dist/cjs/tasks/iterateSiteSearch.js +1 -2
  41. package/dist/cjs/tasks/iterateSites.d.ts.map +1 -1
  42. package/dist/cjs/tasks/iterateSites.js +1 -2
  43. package/dist/esm/models/Address.d.ts +32 -1
  44. package/dist/esm/models/Address.d.ts.map +1 -1
  45. package/dist/esm/models/DriveItem.d.ts +6 -0
  46. package/dist/esm/models/DriveItem.d.ts.map +1 -1
  47. package/dist/esm/operations/driveItem/createDriveItem.d.ts +3 -0
  48. package/dist/esm/operations/driveItem/createDriveItem.d.ts.map +1 -1
  49. package/dist/esm/operations/driveItem/createDriveItem.js +3 -0
  50. package/dist/esm/operations/driveItem/createDriveItemContent.d.ts +21 -0
  51. package/dist/esm/operations/driveItem/createDriveItemContent.d.ts.map +1 -0
  52. package/dist/esm/operations/driveItem/createDriveItemContent.js +116 -0
  53. package/dist/esm/operations/driveItem/existsDriveItem.d.ts.map +1 -1
  54. package/dist/esm/operations/driveItem/existsDriveItem.js +2 -3
  55. package/dist/esm/operations/driveItem/getDriveItemContent.d.ts.map +1 -1
  56. package/dist/esm/operations/driveItem/getDriveItemContent.js +4 -11
  57. package/dist/esm/operations/driveItem/streamDriveItemContent.d.ts.map +1 -1
  58. package/dist/esm/operations/driveItem/streamDriveItemContent.js +4 -11
  59. package/dist/esm/services/azureApplicationCredentials.d.ts +2 -7
  60. package/dist/esm/services/azureApplicationCredentials.d.ts.map +1 -1
  61. package/dist/esm/services/azureApplicationCredentials.js +2 -7
  62. package/dist/esm/services/context.d.ts +11 -8
  63. package/dist/esm/services/context.d.ts.map +1 -1
  64. package/dist/esm/services/context.js +18 -15
  65. package/dist/esm/services/http.d.ts +12 -2
  66. package/dist/esm/services/http.d.ts.map +1 -1
  67. package/dist/esm/services/http.js +204 -2
  68. package/dist/esm/services/httpStatus.d.ts +6 -0
  69. package/dist/esm/services/httpStatus.d.ts.map +1 -1
  70. package/dist/esm/services/httpStatus.js +8 -0
  71. package/dist/esm/services/operationInvoker.d.ts +0 -1
  72. package/dist/esm/services/operationInvoker.d.ts.map +1 -1
  73. package/dist/esm/services/operationInvoker.js +10 -208
  74. package/dist/esm/services/usedAddress.d.ts +25 -0
  75. package/dist/esm/services/usedAddress.d.ts.map +1 -0
  76. package/dist/esm/services/usedAddress.js +63 -0
  77. package/dist/esm/tasks/iterateDriveItems.d.ts.map +1 -1
  78. package/dist/esm/tasks/iterateDriveItems.js +2 -3
  79. package/dist/esm/tasks/iterateDrives.d.ts.map +1 -1
  80. package/dist/esm/tasks/iterateDrives.js +2 -3
  81. package/dist/esm/tasks/iterateSiteSearch.d.ts.map +1 -1
  82. package/dist/esm/tasks/iterateSiteSearch.js +2 -3
  83. package/dist/esm/tasks/iterateSites.d.ts.map +1 -1
  84. package/dist/esm/tasks/iterateSites.js +2 -3
  85. package/docs/api/Address.md +99 -13
  86. package/docs/api/DriveItem-1.md +16 -0
  87. package/docs/api/README.md +3 -3
  88. package/docs/api/context.md +28 -26
  89. package/docs/api/createDriveItemContent.md +37 -0
  90. package/docs/api/drive.md +3 -3
  91. package/docs/api/http.md +65 -4
  92. package/docs/api/httpStatus.md +48 -26
  93. package/docs/api/operationInvoker.md +3 -22
  94. package/docs/api/services/usedAddress.md +47 -0
  95. package/docs/api/streamDriveItemContent.md +1 -1
  96. package/package.json +21 -1
  97. package/docs/api/azureApplicationCredentials.md +0 -31
  98. package/docs/api/createDriveItem.md +0 -38
  99. /package/docs/api/{AzureApplicationCredentials-1.md → AzureApplicationCredentials.md} +0 -0
@@ -26,14 +26,13 @@ async function* iterateDriveItems(parentRef, maxPerChunk = 1000) {
26
26
  }
27
27
  while (nextLink) {
28
28
  const accessToken = await parentRef.context.generateAccessToken();
29
- const response = await (0, http_ts_1.executeHttpRequest)({
29
+ const result = await (0, http_ts_1.execute)({
30
30
  url: nextLink.toString(),
31
31
  method: "GET",
32
32
  headers: {
33
33
  authorization: `Bearer ${accessToken}`,
34
34
  },
35
35
  });
36
- const result = response.data;
37
36
  const newItems = result.value.map((item) => ((0, driveItem_ts_1.createDriveItemRef)(parentRef, item.id) ? { ...item, ...(0, driveItem_ts_1.createDriveItemRef)(parentRef, item.id) } : item));
38
37
  nextLink = result["@odata.nextLink"] ? new URL(result["@odata.nextLink"]) : null;
39
38
  for (const item of newItems) {
@@ -1 +1 @@
1
- {"version":3,"file":"iterateDrives.d.ts","sourceRoot":"","sources":["../../../src/tasks/iterateDrives.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAIjD;;;;;;GAMG;AACH,wBAA+B,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,WAAW,SAAO,GAAG,cAAc,CAAC,SAAS,GAAG,QAAQ,CAAC,CAyBvH"}
1
+ {"version":3,"file":"iterateDrives.d.ts","sourceRoot":"","sources":["../../../src/tasks/iterateDrives.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAIjD;;;;;;GAMG;AACH,wBAA+B,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,WAAW,SAAO,GAAG,cAAc,CAAC,SAAS,GAAG,QAAQ,CAAC,CAwBvH"}
@@ -25,14 +25,13 @@ async function* iterateDrives(siteRef, maxPerChunk = 1000) {
25
25
  }
26
26
  while (nextLink) {
27
27
  const accessToken = await siteRef.context.generateAccessToken();
28
- const response = await (0, http_ts_1.executeHttpRequest)({
28
+ const result = await (0, http_ts_1.execute)({
29
29
  url: nextLink.toString(),
30
30
  method: "GET",
31
31
  headers: {
32
32
  authorization: `Bearer ${accessToken}`,
33
33
  },
34
34
  });
35
- const result = response.data;
36
35
  drives = result.value;
37
36
  nextLink = result["@odata.nextLink"] ? new URL(result["@odata.nextLink"]) : null;
38
37
  for (const drive of drives) {
@@ -1 +1 @@
1
- {"version":3,"file":"iterateSiteSearch.d.ts","sourceRoot":"","sources":["../../../src/tasks/iterateSiteSearch.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAIjD;;;;;GAKG;AACH,wBAA+B,iBAAiB,CAAC,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,cAAc,CAAC,IAAI,GAAG,OAAO,CAAC,CAyBvH"}
1
+ {"version":3,"file":"iterateSiteSearch.d.ts","sourceRoot":"","sources":["../../../src/tasks/iterateSiteSearch.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAIjD;;;;;GAKG;AACH,wBAA+B,iBAAiB,CAAC,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,cAAc,CAAC,IAAI,GAAG,OAAO,CAAC,CAwBvH"}
@@ -24,14 +24,13 @@ async function* iterateSiteSearch(contextRef, search) {
24
24
  }
25
25
  while (nextLink) {
26
26
  const accessToken = await contextRef.context.generateAccessToken();
27
- const response = await (0, http_ts_1.executeHttpRequest)({
27
+ const result = await (0, http_ts_1.execute)({
28
28
  url: nextLink.toString(),
29
29
  method: "GET",
30
30
  headers: {
31
31
  authorization: `Bearer ${accessToken}`,
32
32
  },
33
33
  });
34
- const result = response.data;
35
34
  sites = result.value;
36
35
  nextLink = result["@odata.nextLink"] ? new URL(result["@odata.nextLink"]) : null;
37
36
  for (const site of sites) {
@@ -1 +1 @@
1
- {"version":3,"file":"iterateSites.d.ts","sourceRoot":"","sources":["../../../src/tasks/iterateSites.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAIjD;;;;;;GAMG;AACH,wBAA+B,YAAY,CAAC,UAAU,EAAE,UAAU,EAAE,WAAW,SAAO,GAAG,cAAc,CAAC,IAAI,GAAG,OAAO,CAAC,CAyBtH"}
1
+ {"version":3,"file":"iterateSites.d.ts","sourceRoot":"","sources":["../../../src/tasks/iterateSites.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAIjD;;;;;;GAMG;AACH,wBAA+B,YAAY,CAAC,UAAU,EAAE,UAAU,EAAE,WAAW,SAAO,GAAG,cAAc,CAAC,IAAI,GAAG,OAAO,CAAC,CAwBtH"}
@@ -25,14 +25,13 @@ async function* iterateSites(contextRef, maxPerChunk = 1000) {
25
25
  }
26
26
  while (nextLink) {
27
27
  const accessToken = await contextRef.context.generateAccessToken();
28
- const response = await (0, http_ts_1.executeHttpRequest)({
28
+ const result = await (0, http_ts_1.execute)({
29
29
  url: nextLink.toString(),
30
30
  method: "GET",
31
31
  headers: {
32
32
  authorization: `Bearer ${accessToken}`,
33
33
  },
34
34
  });
35
- const result = response.data;
36
35
  sites = result.value;
37
36
  nextLink = result["@odata.nextLink"] ? new URL(result["@odata.nextLink"]) : null;
38
37
  for (const site of sites) {
@@ -13,6 +13,12 @@ export type ColumnAddress = `${Uppercase<string>}`;
13
13
  * @example 'C:D'
14
14
  */
15
15
  export type ColumnRangeAddress = `${CellAddress}:${CellAddress}`;
16
+ /**
17
+ * Address of a used range in a column, either from the start or to the end.
18
+ * @example 'C:'
19
+ * @example ':D'
20
+ */
21
+ export type UsedColumnRangeAddress = `${ColumnAddress}:` | `:${ColumnAddress}`;
16
22
  /**
17
23
  * Address of a single row in a worksheet.
18
24
  * @example '3'
@@ -23,6 +29,12 @@ export type RowAddress = `${number}`;
23
29
  * @example '3:5'
24
30
  */
25
31
  export type RowRangeAddress = `${RowAddress}:${RowAddress}`;
32
+ /**
33
+ * Address of a used range in a row, either from the start or to the end.
34
+ * @example '3:'
35
+ * @example ':5'
36
+ */
37
+ export type UsedRowRangeAddress = `${RowAddress}:` | `:${RowAddress}`;
26
38
  /**
27
39
  * Address of a single cell in a worksheet.
28
40
  * @example 'C3'
@@ -33,14 +45,33 @@ export type CellAddress = `${ColumnAddress}${RowAddress}`;
33
45
  * @example 'C3:D5'
34
46
  */
35
47
  export type CellRangeAddress = `${CellAddress}:${CellAddress}`;
48
+ /**
49
+ * Address of a used range in a cell, either from the start or to the end.
50
+ * @example 'C3:'
51
+ * @example ':D5'
52
+ */
53
+ export type UsedCellRangeAddress = `${CellAddress}:` | `:${CellAddress}`;
54
+ /**
55
+ * Address representing the entire used range in a worksheet.
56
+ * @example ':'
57
+ */
58
+ export type AllUsedAddress = ":";
36
59
  /**
37
60
  * Any type of address.
38
61
  * @remarks This is a union of all the address types defined above.
39
62
  * @example 'C', 'C:D', '3', '3:5', 'C3', 'C3:D5'
40
63
  */
41
- export type Address = ColumnAddress | RowAddress | ColumnRangeAddress | RowRangeAddress | CellRangeAddress | CellAddress;
64
+ export type Address = ColumnAddress | ColumnRangeAddress | RowAddress | RowRangeAddress | CellAddress | CellRangeAddress;
65
+ /**
66
+ * Any type of used range address, including entire, column, row, or cell used ranges.
67
+ */
68
+ export type UsedAddress = AllUsedAddress | UsedColumnRangeAddress | UsedRowRangeAddress | UsedCellRangeAddress;
42
69
  /**
43
70
  * Address when decomposed into its components.
71
+ * @property startColumn - The starting column address.
72
+ * @property endColumn - The ending column address.
73
+ * @property startRow - The starting row address.
74
+ * @property endRow - The ending row address.
44
75
  */
45
76
  export type DecomposedAddress = {
46
77
  startColumn: ColumnAddress;
@@ -1 +1 @@
1
- {"version":3,"file":"Address.d.ts","sourceRoot":"","sources":["../../../src/models/Address.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,GAAG,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;AAEnD;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,GAAG,WAAW,IAAI,WAAW,EAAE,CAAC;AAEjE;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,GAAG,MAAM,EAAE,CAAC;AAErC;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,GAAG,UAAU,IAAI,UAAU,EAAE,CAAC;AAE5D;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,GAAG,aAAa,GAAG,UAAU,EAAE,CAAC;AAE1D;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,GAAG,WAAW,IAAI,WAAW,EAAE,CAAC;AAE/D;;;;GAIG;AACH,MAAM,MAAM,OAAO,GAAG,aAAa,GAAG,UAAU,GAAG,kBAAkB,GAAG,eAAe,GAAG,gBAAgB,GAAG,WAAW,CAAC;AAEzH;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC/B,WAAW,EAAE,aAAa,CAAC;IAC3B,SAAS,EAAE,aAAa,CAAC;IACzB,QAAQ,EAAE,UAAU,CAAC;IACrB,MAAM,EAAE,UAAU,CAAC;CACnB,CAAC"}
1
+ {"version":3,"file":"Address.d.ts","sourceRoot":"","sources":["../../../src/models/Address.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,GAAG,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;AAEnD;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,GAAG,WAAW,IAAI,WAAW,EAAE,CAAC;AAEjE;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG,GAAG,aAAa,GAAG,GAAG,IAAI,aAAa,EAAE,CAAC;AAE/E;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,GAAG,MAAM,EAAE,CAAC;AAErC;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,GAAG,UAAU,IAAI,UAAU,EAAE,CAAC;AAE5D;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG,GAAG,UAAU,GAAG,GAAG,IAAI,UAAU,EAAE,CAAC;AAEtE;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,GAAG,aAAa,GAAG,UAAU,EAAE,CAAC;AAE1D;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,GAAG,WAAW,IAAI,WAAW,EAAE,CAAC;AAE/D;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAAG,GAAG,WAAW,GAAG,GAAG,IAAI,WAAW,EAAE,CAAC;AAEzE;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,GAAG,CAAC;AACjC;;;;GAIG;AACH,MAAM,MAAM,OAAO,GAAG,aAAa,GAAG,kBAAkB,GAAG,UAAU,GAAG,eAAe,GAAG,WAAW,GAAG,gBAAgB,CAAC;AAEzH;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,cAAc,GAAG,sBAAsB,GAAG,mBAAmB,GAAG,oBAAoB,CAAC;AAE/G;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC/B,WAAW,EAAE,aAAa,CAAC;IAC3B,SAAS,EAAE,aAAa,CAAC;IACzB,QAAQ,EAAE,UAAU,CAAC;IACrB,MAAM,EAAE,UAAU,CAAC;CACnB,CAAC"}
@@ -22,4 +22,10 @@ export type DriveItemPath = string & {
22
22
  export type DriveItemRef = DriveRef & {
23
23
  itemId: DriveItemId;
24
24
  };
25
+ /**
26
+ * File/folder name of a drive item. Includes file extension if applicable.
27
+ */
28
+ export type DriveItemName = string & {
29
+ __brand: "DriveItemName";
30
+ };
25
31
  //# sourceMappingURL=DriveItem.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DriveItem.d.ts","sourceRoot":"","sources":["../../../src/models/DriveItem.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG;IAClC,OAAO,EAAE,aAAa,CAAC;CACvB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG;IACpC,OAAO,EAAE,eAAe,CAAC;CACzB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG;IACrC,MAAM,EAAE,WAAW,CAAC;CACpB,CAAC"}
1
+ {"version":3,"file":"DriveItem.d.ts","sourceRoot":"","sources":["../../../src/models/DriveItem.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG;IAClC,OAAO,EAAE,aAAa,CAAC;CACvB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG;IACpC,OAAO,EAAE,eAAe,CAAC;CACzB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG;IACrC,MAAM,EAAE,WAAW,CAAC;CACpB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG;IACpC,OAAO,EAAE,eAAe,CAAC;CACzB,CAAC"}
@@ -2,6 +2,7 @@
2
2
  * Creates new drive item in the specified parent drive or folder.
3
3
  * @module createDriveItem
4
4
  * @category Operations
5
+ * @hidden
5
6
  */
6
7
  import type { DriveItem } from "@microsoft/microsoft-graph-types";
7
8
  import type { DriveRef } from "../../models/Drive.ts";
@@ -14,6 +15,8 @@ import type { GraphOperation } from "../../models/GraphOperation.ts";
14
15
  * @returns The newly created drive item.
15
16
  * @remarks If the file already exists, it will be replaced.
16
17
  * @see https://learn.microsoft.com/en-us/graph/api/driveitem-put-content
18
+ * @deprecated Use {@link createDriveItemContent} instead for uploading content.
19
+ * @hidden
17
20
  */
18
21
  export default function createDriveItem(parentRef: DriveRef | DriveItemRef, itemPath: DriveItemPath, contextType: string, content: ArrayBuffer): GraphOperation<DriveItem & DriveItemRef>;
19
22
  //# sourceMappingURL=createDriveItem.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createDriveItem.d.ts","sourceRoot":"","sources":["../../../../src/operations/driveItem/createDriveItem.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAe,aAAa,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC1F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAKrE;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,SAAS,EAAE,QAAQ,GAAG,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,cAAc,CAAC,SAAS,GAAG,YAAY,CAAC,CAsBxL"}
1
+ {"version":3,"file":"createDriveItem.d.ts","sourceRoot":"","sources":["../../../../src/operations/driveItem/createDriveItem.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAe,aAAa,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC1F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAKrE;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,SAAS,EAAE,QAAQ,GAAG,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,cAAc,CAAC,SAAS,GAAG,YAAY,CAAC,CAsBxL"}
@@ -2,6 +2,7 @@
2
2
  * Creates new drive item in the specified parent drive or folder.
3
3
  * @module createDriveItem
4
4
  * @category Operations
5
+ * @hidden
5
6
  */
6
7
  import { createDriveItemRef } from "../../services/driveItem.js";
7
8
  import { operation } from "../../services/operationInvoker.js";
@@ -13,6 +14,8 @@ import { generatePath } from "../../services/templatedPaths.js";
13
14
  * @returns The newly created drive item.
14
15
  * @remarks If the file already exists, it will be replaced.
15
16
  * @see https://learn.microsoft.com/en-us/graph/api/driveitem-put-content
17
+ * @deprecated Use {@link createDriveItemContent} instead for uploading content.
18
+ * @hidden
16
19
  */
17
20
  export default function createDriveItem(parentRef, itemPath, contextType, content) {
18
21
  const pathSegment = parentRef.itemId ? "items/{item-id}" : "root";
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Creates a new drive item in the specified parent drive or folder using a stream as content.
3
+ * @module createDriveItemContent
4
+ * @category Operations
5
+ */
6
+ import type { DriveItem } from "@microsoft/microsoft-graph-types";
7
+ import type { DriveRef } from "../../models/Drive.ts";
8
+ import type { DriveItemPath, DriveItemRef } from "../../models/DriveItem.ts";
9
+ /**
10
+ * Creates a new drive item in the specified parent drive or folder using a stream as content.
11
+ * @param parentRef Reference to the parent drive or folder where the drive item will be created.
12
+ * @param itemPath Path (including the filename) for the new drive item within the given parent.
13
+ * @param contentStream A Node.js readable stream containing the file content.
14
+ * @param totalSize The total size in bytes of the content to be uploaded.
15
+ * @param conflictBehavior Optional. Specifies how to handle conflicts if the file already exists. Default is 'fail'.
16
+ * @returns The newly created drive item.
17
+ * @see https://learn.microsoft.com/en-us/graph/api/driveitem-createuploadsession
18
+ * @see https://learn.microsoft.com/en-us/graph/api/resources/uploadsession
19
+ */
20
+ export default function createDriveItemContent(parentRef: DriveRef | DriveItemRef, itemPath: DriveItemPath, contentStream: NodeJS.ReadableStream, totalSize: number, conflictBehavior?: "fail" | "replace" | "rename", chunkSize?: number): Promise<DriveItem & DriveItemRef>;
21
+ //# sourceMappingURL=createDriveItemContent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createDriveItemContent.d.ts","sourceRoot":"","sources":["../../../../src/operations/driveItem/createDriveItemContent.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAElE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAe,aAAa,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAkB1F;;;;;;;;;;GAUG;AACH,wBAA8B,sBAAsB,CAAC,SAAS,EAAE,QAAQ,GAAG,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,CAAC,cAAc,EAAE,SAAS,EAAE,MAAM,EAAE,gBAAgB,GAAE,MAAM,GAAG,SAAS,GAAG,QAAiB,EAAE,SAAS,SAAmB,GAAG,OAAO,CAAC,SAAS,GAAG,YAAY,CAAC,CAmGpS"}
@@ -0,0 +1,116 @@
1
+ /**
2
+ * Creates a new drive item in the specified parent drive or folder using a stream as content.
3
+ * @module createDriveItemContent
4
+ * @category Operations
5
+ */
6
+ import ProtocolError from "../../errors/ProtocolError.js";
7
+ import { createDriveItemRef } from "../../services/driveItem.js";
8
+ import { execute } from "../../services/http.js";
9
+ import { endpoint } from "../../services/operationInvoker.js";
10
+ import { generatePath } from "../../services/templatedPaths.js";
11
+ const defaultChunkSize = 10 * 1024 * 1024;
12
+ /**
13
+ * Creates a new drive item in the specified parent drive or folder using a stream as content.
14
+ * @param parentRef Reference to the parent drive or folder where the drive item will be created.
15
+ * @param itemPath Path (including the filename) for the new drive item within the given parent.
16
+ * @param contentStream A Node.js readable stream containing the file content.
17
+ * @param totalSize The total size in bytes of the content to be uploaded.
18
+ * @param conflictBehavior Optional. Specifies how to handle conflicts if the file already exists. Default is 'fail'.
19
+ * @returns The newly created drive item.
20
+ * @see https://learn.microsoft.com/en-us/graph/api/driveitem-createuploadsession
21
+ * @see https://learn.microsoft.com/en-us/graph/api/resources/uploadsession
22
+ */
23
+ export default async function createDriveItemContent(parentRef, itemPath, contentStream, totalSize, conflictBehavior = "fail", chunkSize = defaultChunkSize) {
24
+ const pathSegment = parentRef.itemId ? "items/{item-id}" : "root";
25
+ const uploadSessionUrl = `${endpoint}${generatePath(`/sites/{site-id}/drives/{drive-id}/${pathSegment}:/${itemPath}:/createUploadSession`, parentRef)}`;
26
+ const accessToken = await parentRef.context.generateAccessToken();
27
+ const fileName = itemPath.split("/").pop();
28
+ const { uploadUrl } = await execute({
29
+ url: uploadSessionUrl,
30
+ method: "POST",
31
+ headers: {
32
+ authorization: `Bearer ${accessToken}`,
33
+ "content-type": "application/json",
34
+ },
35
+ data: JSON.stringify({
36
+ item: {
37
+ "@microsoft.graph.conflictBehavior": conflictBehavior,
38
+ name: fileName,
39
+ },
40
+ }),
41
+ responseType: "json",
42
+ });
43
+ let position = 0;
44
+ let driveItem = null;
45
+ let streamEnded = false;
46
+ const chunks = [];
47
+ contentStream.on("data", (chunk) => {
48
+ chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
49
+ });
50
+ contentStream.on("end", () => {
51
+ streamEnded = true;
52
+ });
53
+ contentStream.on("error", () => {
54
+ // error will be handled in readChunk
55
+ });
56
+ let chunk = await readChunk();
57
+ while (chunk !== null) {
58
+ let currentChunk = chunk;
59
+ while (currentChunk.length > 0) {
60
+ const thisChunk = currentChunk.subarray(0, chunkSize);
61
+ const start = position;
62
+ const end = position + thisChunk.length - 1;
63
+ const contentRange = `bytes ${start}-${end}/${totalSize}`;
64
+ const res = await execute({
65
+ url: uploadUrl,
66
+ method: "PUT",
67
+ headers: {
68
+ "Content-Length": thisChunk.length.toString(),
69
+ "Content-Range": contentRange,
70
+ },
71
+ data: thisChunk,
72
+ responseType: "json",
73
+ });
74
+ position += thisChunk.length;
75
+ currentChunk = currentChunk.subarray(chunkSize);
76
+ if (isDriveItem(res)) {
77
+ driveItem = res;
78
+ break;
79
+ }
80
+ }
81
+ if (driveItem)
82
+ break;
83
+ chunk = await readChunk();
84
+ }
85
+ if (!driveItem) {
86
+ throw new ProtocolError(`Upload did not complete successfully. Last position: ${position}`);
87
+ }
88
+ const itemRef = createDriveItemRef(parentRef, driveItem.id);
89
+ return {
90
+ ...driveItem,
91
+ ...itemRef,
92
+ };
93
+ function isDriveItem(obj) {
94
+ return typeof obj === "object" && obj !== null && "id" in obj;
95
+ }
96
+ function readChunk() {
97
+ return new Promise((resolve, reject) => {
98
+ if (chunks.length > 0) {
99
+ const next = chunks.shift();
100
+ return resolve(next ?? null);
101
+ }
102
+ if (streamEnded)
103
+ return resolve(null);
104
+ contentStream.once("data", (chunk) => {
105
+ resolve(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
106
+ });
107
+ contentStream.once("end", () => {
108
+ streamEnded = true;
109
+ resolve(null);
110
+ });
111
+ contentStream.once("error", (err) => {
112
+ reject(err);
113
+ });
114
+ });
115
+ }
116
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"existsDriveItem.d.ts","sourceRoot":"","sources":["../../../../src/operations/driveItem/existsDriveItem.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAM/D;;;;GAIG;AACH,wBAA8B,eAAe,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC,CAuB3G"}
1
+ {"version":3,"file":"existsDriveItem.d.ts","sourceRoot":"","sources":["../../../../src/operations/driveItem/existsDriveItem.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAM/D;;;;GAIG;AACH,wBAA8B,eAAe,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC,CAsB3G"}
@@ -3,7 +3,7 @@
3
3
  * @module existsDriveItem
4
4
  * @category Operations
5
5
  */
6
- import { executeHttpRequest } from "../../services/http.js";
6
+ import { executeRaw } from "../../services/http.js";
7
7
  import { isHttpNotFound, isHttpOk } from "../../services/httpStatus.js";
8
8
  import { endpoint } from "../../services/operationInvoker.js";
9
9
  import { generatePath } from "../../services/templatedPaths.js";
@@ -16,13 +16,12 @@ export default async function existsDriveItem(driveRef, itemPath) {
16
16
  // Note this method doesn't match the standard pattern since the batching library doesn't support non-JSON return types.
17
17
  const url = `${endpoint}${generatePath(`/sites/{site-id}/drives/{drive-id}/root:${itemPath}`, driveRef)}`;
18
18
  const accessToken = await driveRef.context.generateAccessToken();
19
- const response = await executeHttpRequest({
19
+ const response = await executeRaw({
20
20
  url,
21
21
  method: "GET",
22
22
  headers: {
23
23
  authorization: `Bearer ${accessToken}`,
24
24
  },
25
- validateStatus: () => true,
26
25
  });
27
26
  if (isHttpOk(response.status)) {
28
27
  return true;
@@ -1 +1 @@
1
- {"version":3,"file":"getDriveItemContent.d.ts","sourceRoot":"","sources":["../../../../src/operations/driveItem/getDriveItemContent.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAM9D;;;;;;;;;GASG;AACH,wBAA8B,mBAAmB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CA6B7F"}
1
+ {"version":3,"file":"getDriveItemContent.d.ts","sourceRoot":"","sources":["../../../../src/operations/driveItem/getDriveItemContent.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAK9D;;;;;;;;;GASG;AACH,wBAA8B,mBAAmB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CAqB7F"}
@@ -4,9 +4,8 @@
4
4
  * @category Operations
5
5
  * @hidden
6
6
  */
7
- import { executeHttpRequest } from "../../services/http.js";
8
- import { isHttpSuccess } from "../../services/httpStatus.js";
9
- import { endpoint, throwException } from "../../services/operationInvoker.js";
7
+ import { execute } from "../../services/http.js";
8
+ import { endpoint } from "../../services/operationInvoker.js";
10
9
  import { generatePath } from "../../services/templatedPaths.js";
11
10
  /**
12
11
  * Download the content of a drive item.
@@ -22,7 +21,7 @@ export default async function getDriveItemContent(itemRef) {
22
21
  // Note this method doesn't match the standard pattern since the batching library doesn't support non-JSON return types, and there appears to be no value in adding support.
23
22
  const url = `${endpoint}${generatePath("/sites/{site-id}/drives/{drive-id}/items/{item-id}/content", itemRef)}`;
24
23
  const accessToken = await itemRef.context.generateAccessToken();
25
- const response = await executeHttpRequest({
24
+ const response = await execute({
26
25
  url,
27
26
  method: "GET",
28
27
  headers: {
@@ -30,13 +29,7 @@ export default async function getDriveItemContent(itemRef) {
30
29
  },
31
30
  responseType: "arraybuffer",
32
31
  });
33
- if (!isHttpSuccess(response.status)) {
34
- throwException(response.status, "Failed to get content");
35
- }
36
- if (!Buffer.isBuffer(response.data)) {
37
- throw new Error(`Unexpected response type: ${typeof response.data}`);
38
- }
39
- const buffer = response.data.buffer.slice(response.data.byteOffset, response.data.byteOffset + response.data.byteLength);
32
+ const buffer = response.buffer.slice(response.byteOffset, response.byteOffset + response.byteLength);
40
33
  if (!(buffer instanceof ArrayBuffer)) {
41
34
  throw new Error("Failed to convert Buffer to ArrayBuffer");
42
35
  }
@@ -1 +1 @@
1
- {"version":3,"file":"streamDriveItemContent.d.ts","sourceRoot":"","sources":["../../../../src/operations/driveItem/streamDriveItemContent.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAM9D;;;;;;;GAOG;AACH,wBAA8B,sBAAsB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC,CAuB1G"}
1
+ {"version":3,"file":"streamDriveItemContent.d.ts","sourceRoot":"","sources":["../../../../src/operations/driveItem/streamDriveItemContent.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAK9D;;;;;;;GAOG;AACH,wBAA8B,sBAAsB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC,CAe1G"}
@@ -3,9 +3,8 @@
3
3
  * @module streamDriveItemContent
4
4
  * @category Operations
5
5
  */
6
- import { executeHttpRequest } from "../../services/http.js";
7
- import { isHttpSuccess } from "../../services/httpStatus.js";
8
- import { endpoint, throwException } from "../../services/operationInvoker.js";
6
+ import { execute } from "../../services/http.js";
7
+ import { endpoint } from "../../services/operationInvoker.js";
9
8
  import { generatePath } from "../../services/templatedPaths.js";
10
9
  /**
11
10
  * Stream the content of a drive item.
@@ -19,7 +18,7 @@ export default async function streamDriveItemContent(itemRef) {
19
18
  // TODO: Rename to getDriveItemContent at next breaking update
20
19
  const url = `${endpoint}${generatePath("/sites/{site-id}/drives/{drive-id}/items/{item-id}/content", itemRef)}`;
21
20
  const accessToken = await itemRef.context.generateAccessToken();
22
- const response = await executeHttpRequest({
21
+ const response = await execute({
23
22
  url,
24
23
  method: "GET",
25
24
  headers: {
@@ -27,11 +26,5 @@ export default async function streamDriveItemContent(itemRef) {
27
26
  },
28
27
  responseType: "stream",
29
28
  });
30
- if (!isHttpSuccess(response.status)) {
31
- throwException(response.status, "Failed to stream content");
32
- }
33
- if (!response || typeof response.data?.pipe !== "function") {
34
- throw new Error("Failed to get a streamable response");
35
- }
36
- return response.data;
29
+ return response;
37
30
  }
@@ -2,17 +2,12 @@
2
2
  * Azure application credential helpers for authentication and token management.
3
3
  * @module azureApplicationCredentials
4
4
  * @category Services
5
+ * @hidden
5
6
  */
6
7
  import type { AccessToken } from "../models/AccessToken.ts";
7
8
  import type { AzureClientId, AzureClientSecret, AzureTenantId, Scope } from "../models/AzureApplicationCredentials.ts";
8
9
  /**
9
- * Retrieves the current access token for a given client and scope.
10
- * If a valid token is cached, it will be returned; otherwise, a new token will be requested.
11
- * @param tenantId - The tenant ID.
12
- * @param clientId - The client ID.
13
- * @param clientSecret - The client secret.
14
- * @param scope - The scope for which the token is requested.
15
- * @returns A promise that resolves to the access token.
10
+ * @deprecated
16
11
  */
17
12
  export declare function getCurrentAccessToken(tenantId: AzureTenantId, clientId: AzureClientId, clientSecret: AzureClientSecret, scope: Scope): Promise<AccessToken>;
18
13
  //# sourceMappingURL=azureApplicationCredentials.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"azureApplicationCredentials.d.ts","sourceRoot":"","sources":["../../../src/services/azureApplicationCredentials.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,0CAA0C,CAAC;AAIvH;;;;;;;;GAQG;AACH,wBAAsB,qBAAqB,CAAC,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,aAAa,EAAE,YAAY,EAAE,iBAAiB,EAAE,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,WAAW,CAAC,CAWjK"}
1
+ {"version":3,"file":"azureApplicationCredentials.d.ts","sourceRoot":"","sources":["../../../src/services/azureApplicationCredentials.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,0CAA0C,CAAC;AAIvH;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,aAAa,EAAE,YAAY,EAAE,iBAAiB,EAAE,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,WAAW,CAAC,CAWjK"}
@@ -2,17 +2,12 @@
2
2
  * Azure application credential helpers for authentication and token management.
3
3
  * @module azureApplicationCredentials
4
4
  * @category Services
5
+ * @hidden
5
6
  */
6
7
  import { ClientSecretCredential } from "@azure/identity";
7
8
  const innerTokenCache = {};
8
9
  /**
9
- * Retrieves the current access token for a given client and scope.
10
- * If a valid token is cached, it will be returned; otherwise, a new token will be requested.
11
- * @param tenantId - The tenant ID.
12
- * @param clientId - The client ID.
13
- * @param clientSecret - The client secret.
14
- * @param scope - The scope for which the token is requested.
15
- * @returns A promise that resolves to the access token.
10
+ * @deprecated
16
11
  */
17
12
  export async function getCurrentAccessToken(tenantId, clientId, clientSecret, scope) {
18
13
  const cacheKey = createCacheKey(tenantId, clientId, scope);
@@ -7,23 +7,26 @@ import type { AccessToken } from "../models/AccessToken.ts";
7
7
  import type { AccessTokenGenerator } from "../models/AccessTokenGenerator.ts";
8
8
  import type { AzureClientId, AzureClientSecret, AzureTenantId, Scope } from "../models/AzureApplicationCredentials.ts";
9
9
  import type { ContextRef } from "../models/Context.ts";
10
- /** Create a context using the client secret credential. */
10
+ /** Create a context using a given access token generator. */
11
+ export declare function createContext(accessTokenGenerator: AccessTokenGenerator): ContextRef;
12
+ /**
13
+ * @deprecated Use `createContext(accessTokenGenerator)` instead.
14
+ */
11
15
  export declare function createClientSecretContext(tenantId: AzureTenantId, clientId: AzureClientId, clientSecret: AzureClientSecret, scope?: Scope): ContextRef;
12
16
  /**
13
- * Create a context using a static access token.
14
- * @remarks You must manually handle renewal of the access token with this approach.
17
+ * @deprecated Use `createContext(accessTokenGenerator)` instead.
15
18
  */
16
19
  export declare function createAccessTokenContext(accessToken: AccessToken): ContextRef;
17
- /** Create a context using a given access token generator. */
18
- export declare function createContext(accessTokenGenerator: AccessTokenGenerator): ContextRef;
19
- /** Create a context using the client secret credential using environment variables AZURE_TENANT_ID, AZURE_CLIENT_ID and AZURE_CLIENT_SECRET. */
20
+ /**
21
+ * @deprecated Use `createContext(accessTokenGenerator)` instead.
22
+ */
20
23
  export declare function createDefaultClientSecretContext(): ContextRef;
21
24
  /**
22
- @deprecated Use `createDefaultClientSecretContext()` instead.
25
+ @deprecated Use `createContext(accessTokenGenerator)` instead.
23
26
  */
24
27
  export declare function getDefaultContextRef(): ContextRef;
25
28
  /**
26
- * @deprecated Use `createClientSecretContext()` instead.
29
+ * @deprecated Use `createContext(accessTokenGenerator)` instead.
27
30
  */
28
31
  export declare function register(tenantId: AzureTenantId, clientId: AzureClientId, clientSecret: AzureClientSecret): ContextRef;
29
32
  //# sourceMappingURL=context.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/services/context.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,0CAA0C,CAAC;AACvH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAOvD,2DAA2D;AAC3D,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,aAAa,EAAE,YAAY,EAAE,iBAAiB,EAAE,KAAK,GAAE,KAAoB,GAAG,UAAU,CAMpK;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,WAAW,EAAE,WAAW,GAAG,UAAU,CAI7E;AAED,6DAA6D;AAC7D,wBAAgB,aAAa,CAAC,oBAAoB,EAAE,oBAAoB,GAAG,UAAU,CAQpF;AAED,gJAAgJ;AAChJ,wBAAgB,gCAAgC,IAAI,UAAU,CAM7D;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,UAAU,CAEjD;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,aAAa,EAAE,YAAY,EAAE,iBAAiB,GAAG,UAAU,CAEtH"}
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/services/context.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,0CAA0C,CAAC;AACvH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAOvD,6DAA6D;AAC7D,wBAAgB,aAAa,CAAC,oBAAoB,EAAE,oBAAoB,GAAG,UAAU,CAQpF;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,aAAa,EAAE,YAAY,EAAE,iBAAiB,EAAE,KAAK,GAAE,KAAoB,GAAG,UAAU,CAMpK;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,WAAW,EAAE,WAAW,GAAG,UAAU,CAI7E;AAED;;GAEG;AACH,wBAAgB,gCAAgC,IAAI,UAAU,CAM7D;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,UAAU,CAEjD;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,aAAa,EAAE,YAAY,EAAE,iBAAiB,GAAG,UAAU,CAEtH"}
@@ -7,7 +7,18 @@ import { getCurrentAccessToken } from "./azureApplicationCredentials.js";
7
7
  import { getEnvironmentVariable } from "./environmentVariable.js";
8
8
  ("../models/Scope.ts");
9
9
  const defaultScope = "https://graph.microsoft.com/.default";
10
- /** Create a context using the client secret credential. */
10
+ /** Create a context using a given access token generator. */
11
+ export function createContext(accessTokenGenerator) {
12
+ const context = {
13
+ generateAccessToken: accessTokenGenerator,
14
+ };
15
+ return {
16
+ context,
17
+ };
18
+ }
19
+ /**
20
+ * @deprecated Use `createContext(accessTokenGenerator)` instead.
21
+ */
11
22
  export function createClientSecretContext(tenantId, clientId, clientSecret, scope = defaultScope) {
12
23
  const generateAccessToken = async () => {
13
24
  return await getCurrentAccessToken(tenantId, clientId, clientSecret, scope);
@@ -15,24 +26,16 @@ export function createClientSecretContext(tenantId, clientId, clientSecret, scop
15
26
  return createContext(generateAccessToken);
16
27
  }
17
28
  /**
18
- * Create a context using a static access token.
19
- * @remarks You must manually handle renewal of the access token with this approach.
29
+ * @deprecated Use `createContext(accessTokenGenerator)` instead.
20
30
  */
21
31
  export function createAccessTokenContext(accessToken) {
22
32
  return createContext(async () => {
23
33
  return accessToken;
24
34
  });
25
35
  }
26
- /** Create a context using a given access token generator. */
27
- export function createContext(accessTokenGenerator) {
28
- const context = {
29
- generateAccessToken: accessTokenGenerator,
30
- };
31
- return {
32
- context,
33
- };
34
- }
35
- /** Create a context using the client secret credential using environment variables AZURE_TENANT_ID, AZURE_CLIENT_ID and AZURE_CLIENT_SECRET. */
36
+ /**
37
+ * @deprecated Use `createContext(accessTokenGenerator)` instead.
38
+ */
36
39
  export function createDefaultClientSecretContext() {
37
40
  const tenantId = getEnvironmentVariable("AZURE_TENANT_ID");
38
41
  const clientId = getEnvironmentVariable("AZURE_CLIENT_ID");
@@ -40,13 +43,13 @@ export function createDefaultClientSecretContext() {
40
43
  return createClientSecretContext(tenantId, clientId, clientSecret);
41
44
  }
42
45
  /**
43
- @deprecated Use `createDefaultClientSecretContext()` instead.
46
+ @deprecated Use `createContext(accessTokenGenerator)` instead.
44
47
  */
45
48
  export function getDefaultContextRef() {
46
49
  return createDefaultClientSecretContext();
47
50
  }
48
51
  /**
49
- * @deprecated Use `createClientSecretContext()` instead.
52
+ * @deprecated Use `createContext(accessTokenGenerator)` instead.
50
53
  */
51
54
  export function register(tenantId, clientId, clientSecret) {
52
55
  return createClientSecretContext(tenantId, clientId, clientSecret);