microsoft-graph 2.22.2 → 2.23.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 (205) hide show
  1. package/dist/cjs/graphApi.d.ts +0 -2
  2. package/dist/cjs/graphApi.d.ts.map +1 -1
  3. package/dist/cjs/graphApi.js +6 -11
  4. package/dist/cjs/models/AccessTokenGenerator.d.ts +3 -0
  5. package/dist/cjs/models/AccessTokenGenerator.d.ts.map +1 -0
  6. package/dist/cjs/models/Context.d.ts +2 -6
  7. package/dist/cjs/models/Context.d.ts.map +1 -1
  8. package/dist/cjs/models/ContextRef.d.ts +2 -2
  9. package/dist/cjs/models/ContextRef.d.ts.map +1 -1
  10. package/dist/cjs/models/GraphOperation.d.ts +2 -2
  11. package/dist/cjs/models/GraphOperation.d.ts.map +1 -1
  12. package/dist/cjs/models/SiteRef.d.ts +3 -2
  13. package/dist/cjs/models/SiteRef.d.ts.map +1 -1
  14. package/dist/cjs/operations/drive/createFolder.js +1 -1
  15. package/dist/cjs/operations/drive/listDrives.js +1 -1
  16. package/dist/cjs/operations/driveItem/createDriveItem.js +1 -1
  17. package/dist/cjs/operations/driveItem/deleteDriveItem.js +1 -1
  18. package/dist/cjs/operations/driveItem/existsDriveItem.d.ts.map +1 -1
  19. package/dist/cjs/operations/driveItem/existsDriveItem.js +1 -4
  20. package/dist/cjs/operations/driveItem/getDriveItem.js +1 -1
  21. package/dist/cjs/operations/driveItem/getDriveItemByPath.js +1 -1
  22. package/dist/cjs/operations/driveItem/getDriveItemContent.d.ts.map +1 -1
  23. package/dist/cjs/operations/driveItem/getDriveItemContent.js +1 -4
  24. package/dist/cjs/operations/driveItem/initiateCopyDriveItem.js +1 -1
  25. package/dist/cjs/operations/driveItem/listDriveItemChildren.js +1 -1
  26. package/dist/cjs/operations/driveItem/moveDriveItem.js +1 -1
  27. package/dist/cjs/operations/site/getSite.js +1 -1
  28. package/dist/cjs/operations/site/getSiteByName.d.ts +1 -1
  29. package/dist/cjs/operations/site/getSiteByName.js +2 -2
  30. package/dist/cjs/operations/site/listSites.js +1 -1
  31. package/dist/cjs/operations/site/searchSites.js +1 -1
  32. package/dist/cjs/operations/user/userSendMail.d.ts +3 -3
  33. package/dist/cjs/operations/user/userSendMail.d.ts.map +1 -1
  34. package/dist/cjs/operations/user/userSendMail.js +3 -3
  35. package/dist/cjs/operations/workbook/calculateWorkbook.js +1 -1
  36. package/dist/cjs/operations/workbook/createWorkbook.js +1 -1
  37. package/dist/cjs/operations/workbookRange/autoFitWorkbookRangeColumns.js +1 -1
  38. package/dist/cjs/operations/workbookRange/clearWorkbookRange.js +1 -1
  39. package/dist/cjs/operations/workbookRange/deleteWorkbookRange.js +1 -1
  40. package/dist/cjs/operations/workbookRange/getWorkbookNamedRange.js +1 -1
  41. package/dist/cjs/operations/workbookRange/getWorkbookRangeFill.js +1 -1
  42. package/dist/cjs/operations/workbookRange/getWorkbookRangeFont.js +1 -1
  43. package/dist/cjs/operations/workbookRange/getWorkbookRangeFormat.js +1 -1
  44. package/dist/cjs/operations/workbookRange/getWorkbookUsedRange.js +1 -1
  45. package/dist/cjs/operations/workbookRange/getWorkbookVisibleRange.js +1 -1
  46. package/dist/cjs/operations/workbookRange/getWorkbookWorksheetRange.js +1 -1
  47. package/dist/cjs/operations/workbookRange/insertWorkbookCells.js +1 -1
  48. package/dist/cjs/operations/workbookRange/mergeWorkbookRange.js +1 -1
  49. package/dist/cjs/operations/workbookRange/setWorkbookRangeFill.js +1 -1
  50. package/dist/cjs/operations/workbookRange/setWorkbookRangeFont.js +1 -1
  51. package/dist/cjs/operations/workbookRange/setWorkbookRangeFormat.js +1 -1
  52. package/dist/cjs/operations/workbookRange/unmergeWorkbookRange.js +1 -1
  53. package/dist/cjs/operations/workbookRange/updateWorkbookNamedRange.js +1 -1
  54. package/dist/cjs/operations/workbookRange/updateWorkbookRange.js +1 -1
  55. package/dist/cjs/operations/workbookSession/closeWorkbookSession.js +1 -1
  56. package/dist/cjs/operations/workbookSession/createWorkbookSession.js +1 -1
  57. package/dist/cjs/operations/workbookSession/refreshWorkbookSession.js +1 -1
  58. package/dist/cjs/operations/workbookTable/applyWorkbookTableColumnFilter.js +1 -1
  59. package/dist/cjs/operations/workbookTable/clearWorkbookTableFilters.js +1 -1
  60. package/dist/cjs/operations/workbookTable/createWorkbookTable.js +1 -1
  61. package/dist/cjs/operations/workbookTable/deleteWorkbookTable.js +1 -1
  62. package/dist/cjs/operations/workbookTable/deleteWorkbookTablePreservingValues.js +1 -1
  63. package/dist/cjs/operations/workbookTable/getWorkbookTable.js +1 -1
  64. package/dist/cjs/operations/workbookTable/getWorkbookTableBodyRange.js +1 -1
  65. package/dist/cjs/operations/workbookTable/getWorkbookTableBodyVisibleRange.d.ts +1 -2
  66. package/dist/cjs/operations/workbookTable/getWorkbookTableBodyVisibleRange.d.ts.map +1 -1
  67. package/dist/cjs/operations/workbookTable/getWorkbookTableBodyVisibleRange.js +4 -7
  68. package/dist/cjs/operations/workbookTable/getWorkbookTableHeaderRange.js +1 -1
  69. package/dist/cjs/operations/workbookTable/listWorkbookTableColumns.js +1 -1
  70. package/dist/cjs/operations/workbookTable/listWorkbookTableRows.js +1 -1
  71. package/dist/cjs/operations/workbookTable/listWorkbookTables.js +1 -1
  72. package/dist/cjs/operations/workbookWorksheet/createWorkbookWorksheet.js +1 -1
  73. package/dist/cjs/operations/workbookWorksheet/deleteWorkbookWorksheet.js +1 -1
  74. package/dist/cjs/operations/workbookWorksheet/getWorkbookWorksheetUsedRange.js +1 -1
  75. package/dist/cjs/operations/workbookWorksheet/getWorkbookWorksheetUsedRangeRef.js +1 -1
  76. package/dist/cjs/operations/workbookWorksheet/getWorkbookWorksheetUsedVisibleRange.js +1 -1
  77. package/dist/cjs/operations/workbookWorksheet/listWorkbookWorksheets.js +1 -1
  78. package/dist/cjs/operations/workbookWorksheet/updateWorkbookWorksheet.js +1 -1
  79. package/dist/cjs/services/addressManipulation.d.ts +3 -3
  80. package/dist/cjs/services/addressManipulation.js +4 -4
  81. package/dist/cjs/services/context.d.ts +16 -17
  82. package/dist/cjs/services/context.d.ts.map +1 -1
  83. package/dist/cjs/services/context.js +40 -47
  84. package/dist/cjs/services/drive.d.ts +7 -0
  85. package/dist/cjs/services/drive.d.ts.map +1 -1
  86. package/dist/cjs/services/drive.js +11 -2
  87. package/dist/cjs/services/driveItem.js +1 -1
  88. package/dist/cjs/services/site.js +1 -1
  89. package/dist/cjs/services/templatedPaths.d.ts +1 -1
  90. package/dist/cjs/services/templatedPaths.d.ts.map +1 -1
  91. package/dist/cjs/services/templatedPaths.js +5 -2
  92. package/dist/cjs/services/workbookRange.d.ts +1 -1
  93. package/dist/cjs/services/workbookRange.d.ts.map +1 -1
  94. package/dist/cjs/services/workbookRange.js +11 -2
  95. package/dist/cjs/services/workbookTable.js +1 -1
  96. package/dist/cjs/services/workbookTableColumn.js +1 -1
  97. package/dist/cjs/services/workbookWorksheet.js +1 -1
  98. package/dist/cjs/tasks/listDriveItems.d.ts.map +1 -1
  99. package/dist/cjs/tasks/listDriveItems.js +1 -5
  100. package/dist/esm/graphApi.d.ts +0 -2
  101. package/dist/esm/graphApi.d.ts.map +1 -1
  102. package/dist/esm/graphApi.js +5 -10
  103. package/dist/esm/models/AccessTokenGenerator.d.ts +3 -0
  104. package/dist/esm/models/AccessTokenGenerator.d.ts.map +1 -0
  105. package/dist/esm/models/Context.d.ts +2 -6
  106. package/dist/esm/models/Context.d.ts.map +1 -1
  107. package/dist/esm/models/ContextRef.d.ts +2 -2
  108. package/dist/esm/models/ContextRef.d.ts.map +1 -1
  109. package/dist/esm/models/GraphOperation.d.ts +2 -2
  110. package/dist/esm/models/GraphOperation.d.ts.map +1 -1
  111. package/dist/esm/models/SiteRef.d.ts +3 -2
  112. package/dist/esm/models/SiteRef.d.ts.map +1 -1
  113. package/dist/esm/operations/drive/createFolder.js +1 -1
  114. package/dist/esm/operations/drive/listDrives.js +1 -1
  115. package/dist/esm/operations/driveItem/createDriveItem.js +1 -1
  116. package/dist/esm/operations/driveItem/deleteDriveItem.js +1 -1
  117. package/dist/esm/operations/driveItem/existsDriveItem.d.ts.map +1 -1
  118. package/dist/esm/operations/driveItem/existsDriveItem.js +2 -5
  119. package/dist/esm/operations/driveItem/getDriveItem.js +1 -1
  120. package/dist/esm/operations/driveItem/getDriveItemByPath.js +1 -1
  121. package/dist/esm/operations/driveItem/getDriveItemContent.d.ts.map +1 -1
  122. package/dist/esm/operations/driveItem/getDriveItemContent.js +2 -5
  123. package/dist/esm/operations/driveItem/initiateCopyDriveItem.js +1 -1
  124. package/dist/esm/operations/driveItem/listDriveItemChildren.js +1 -1
  125. package/dist/esm/operations/driveItem/moveDriveItem.js +1 -1
  126. package/dist/esm/operations/site/getSite.js +1 -1
  127. package/dist/esm/operations/site/getSiteByName.d.ts +1 -1
  128. package/dist/esm/operations/site/getSiteByName.js +2 -2
  129. package/dist/esm/operations/site/listSites.js +1 -1
  130. package/dist/esm/operations/site/searchSites.js +1 -1
  131. package/dist/esm/operations/user/userSendMail.d.ts +3 -3
  132. package/dist/esm/operations/user/userSendMail.d.ts.map +1 -1
  133. package/dist/esm/operations/user/userSendMail.js +3 -3
  134. package/dist/esm/operations/workbook/calculateWorkbook.js +1 -1
  135. package/dist/esm/operations/workbook/createWorkbook.js +1 -1
  136. package/dist/esm/operations/workbookRange/autoFitWorkbookRangeColumns.js +1 -1
  137. package/dist/esm/operations/workbookRange/clearWorkbookRange.js +1 -1
  138. package/dist/esm/operations/workbookRange/deleteWorkbookRange.js +1 -1
  139. package/dist/esm/operations/workbookRange/getWorkbookNamedRange.js +1 -1
  140. package/dist/esm/operations/workbookRange/getWorkbookRangeFill.js +1 -1
  141. package/dist/esm/operations/workbookRange/getWorkbookRangeFont.js +1 -1
  142. package/dist/esm/operations/workbookRange/getWorkbookRangeFormat.js +1 -1
  143. package/dist/esm/operations/workbookRange/getWorkbookUsedRange.js +1 -1
  144. package/dist/esm/operations/workbookRange/getWorkbookVisibleRange.js +1 -1
  145. package/dist/esm/operations/workbookRange/getWorkbookWorksheetRange.js +1 -1
  146. package/dist/esm/operations/workbookRange/insertWorkbookCells.js +1 -1
  147. package/dist/esm/operations/workbookRange/mergeWorkbookRange.js +1 -1
  148. package/dist/esm/operations/workbookRange/setWorkbookRangeFill.js +1 -1
  149. package/dist/esm/operations/workbookRange/setWorkbookRangeFont.js +1 -1
  150. package/dist/esm/operations/workbookRange/setWorkbookRangeFormat.js +1 -1
  151. package/dist/esm/operations/workbookRange/unmergeWorkbookRange.js +1 -1
  152. package/dist/esm/operations/workbookRange/updateWorkbookNamedRange.js +1 -1
  153. package/dist/esm/operations/workbookRange/updateWorkbookRange.js +1 -1
  154. package/dist/esm/operations/workbookSession/closeWorkbookSession.js +1 -1
  155. package/dist/esm/operations/workbookSession/createWorkbookSession.js +1 -1
  156. package/dist/esm/operations/workbookSession/refreshWorkbookSession.js +1 -1
  157. package/dist/esm/operations/workbookTable/applyWorkbookTableColumnFilter.js +1 -1
  158. package/dist/esm/operations/workbookTable/clearWorkbookTableFilters.js +1 -1
  159. package/dist/esm/operations/workbookTable/createWorkbookTable.js +1 -1
  160. package/dist/esm/operations/workbookTable/deleteWorkbookTable.js +1 -1
  161. package/dist/esm/operations/workbookTable/deleteWorkbookTablePreservingValues.js +1 -1
  162. package/dist/esm/operations/workbookTable/getWorkbookTable.js +1 -1
  163. package/dist/esm/operations/workbookTable/getWorkbookTableBodyRange.js +1 -1
  164. package/dist/esm/operations/workbookTable/getWorkbookTableBodyVisibleRange.d.ts +1 -2
  165. package/dist/esm/operations/workbookTable/getWorkbookTableBodyVisibleRange.d.ts.map +1 -1
  166. package/dist/esm/operations/workbookTable/getWorkbookTableBodyVisibleRange.js +4 -7
  167. package/dist/esm/operations/workbookTable/getWorkbookTableHeaderRange.js +1 -1
  168. package/dist/esm/operations/workbookTable/listWorkbookTableColumns.js +1 -1
  169. package/dist/esm/operations/workbookTable/listWorkbookTableRows.js +1 -1
  170. package/dist/esm/operations/workbookTable/listWorkbookTables.js +1 -1
  171. package/dist/esm/operations/workbookWorksheet/createWorkbookWorksheet.js +1 -1
  172. package/dist/esm/operations/workbookWorksheet/deleteWorkbookWorksheet.js +1 -1
  173. package/dist/esm/operations/workbookWorksheet/getWorkbookWorksheetUsedRange.js +1 -1
  174. package/dist/esm/operations/workbookWorksheet/getWorkbookWorksheetUsedRangeRef.js +1 -1
  175. package/dist/esm/operations/workbookWorksheet/getWorkbookWorksheetUsedVisibleRange.js +1 -1
  176. package/dist/esm/operations/workbookWorksheet/listWorkbookWorksheets.js +1 -1
  177. package/dist/esm/operations/workbookWorksheet/updateWorkbookWorksheet.js +1 -1
  178. package/dist/esm/services/addressManipulation.d.ts +3 -3
  179. package/dist/esm/services/addressManipulation.js +3 -3
  180. package/dist/esm/services/context.d.ts +16 -17
  181. package/dist/esm/services/context.d.ts.map +1 -1
  182. package/dist/esm/services/context.js +35 -42
  183. package/dist/esm/services/drive.d.ts +7 -0
  184. package/dist/esm/services/drive.d.ts.map +1 -1
  185. package/dist/esm/services/drive.js +11 -3
  186. package/dist/esm/services/driveItem.js +1 -1
  187. package/dist/esm/services/site.js +1 -1
  188. package/dist/esm/services/templatedPaths.d.ts +1 -1
  189. package/dist/esm/services/templatedPaths.d.ts.map +1 -1
  190. package/dist/esm/services/templatedPaths.js +5 -2
  191. package/dist/esm/services/workbookRange.d.ts +1 -1
  192. package/dist/esm/services/workbookRange.d.ts.map +1 -1
  193. package/dist/esm/services/workbookRange.js +8 -2
  194. package/dist/esm/services/workbookTable.js +1 -1
  195. package/dist/esm/services/workbookTableColumn.js +1 -1
  196. package/dist/esm/services/workbookWorksheet.js +1 -1
  197. package/dist/esm/tasks/listDriveItems.d.ts.map +1 -1
  198. package/dist/esm/tasks/listDriveItems.js +1 -5
  199. package/package.json +26 -26
  200. package/dist/cjs/models/ContextId.d.ts +0 -4
  201. package/dist/cjs/models/ContextId.d.ts.map +0 -1
  202. package/dist/esm/models/ContextId.d.ts +0 -4
  203. package/dist/esm/models/ContextId.d.ts.map +0 -1
  204. /package/dist/cjs/models/{ContextId.js → AccessTokenGenerator.js} +0 -0
  205. /package/dist/esm/models/{ContextId.js → AccessTokenGenerator.js} +0 -0
@@ -11,7 +11,7 @@ import { generatePath } from "../../services/templatedPaths.js";
11
11
  export default function getWorkbookRangeFormat(rangeRef) {
12
12
  const address = normalizeAddress(rangeRef.address, true);
13
13
  return operation({
14
- contextId: rangeRef.contextId,
14
+ context: rangeRef.context,
15
15
  method: "GET",
16
16
  path: generatePath(`/sites/{site-id}/drives/{drive-id}/items/{item-id}/workbook/worksheets/{worksheet-id}/range(address='${address}')/format`, rangeRef),
17
17
  headers: {
@@ -7,7 +7,7 @@ import { createWorkbookRangeRef } from "../../services/workbookRange.js";
7
7
  */
8
8
  export default function getWorkbookUsedRange(worksheetRef) {
9
9
  return operation({
10
- contextId: worksheetRef.contextId,
10
+ context: worksheetRef.context,
11
11
  method: "GET",
12
12
  path: generatePath("/sites/{site-id}/drives/{drive-id}/items/{item-id}/workbook/worksheets/{worksheet-id}/range/usedRange", worksheetRef),
13
13
  headers: {
@@ -12,7 +12,7 @@ export default function getWorkbookVisibleRange(rangeRef) {
12
12
  const address = normalizeAddress(rangeRef.address, true);
13
13
  // TODO: Should be a visible ref type?
14
14
  return operation({
15
- contextId: rangeRef.contextId,
15
+ context: rangeRef.context,
16
16
  method: "GET",
17
17
  path: generatePath(`/sites/{site-id}/drives/{drive-id}/items/{item-id}/workbook/worksheets/{worksheet-id}/range(address='${address}')/visibleView`, rangeRef),
18
18
  headers: {
@@ -11,7 +11,7 @@ import { generatePath } from "../../services/templatedPaths.js";
11
11
  export default function getWorkbookWorksheetRange(rangeRef) {
12
12
  const address = normalizeAddress(rangeRef.address, true);
13
13
  return operation({
14
- contextId: rangeRef.contextId,
14
+ context: rangeRef.context,
15
15
  method: "GET",
16
16
  path: generatePath(`/sites/{site-id}/drives/{drive-id}/items/{item-id}/workbook/worksheets/{worksheet-id}/range(address='${address}')`, rangeRef),
17
17
  headers: {
@@ -14,7 +14,7 @@ import { createWorkbookRangeRef } from "../../services/workbookRange.js";
14
14
  */
15
15
  export default function insertWorkbookCells(worksheetRef, address, shift) {
16
16
  return operation({
17
- contextId: worksheetRef.contextId,
17
+ context: worksheetRef.context,
18
18
  method: "POST",
19
19
  path: generatePath(`/sites/{site-id}/drives/{drive-id}/items/{item-id}/workbook/worksheets/{worksheet-id}/range(address='${normalizeAddress(address)}')/insert`, worksheetRef),
20
20
  headers: {
@@ -11,7 +11,7 @@ import { generatePath } from "../../services/templatedPaths.js";
11
11
  */
12
12
  export default function mergeWorkbookRange(rangeRef, across = false) {
13
13
  return operation({
14
- contextId: rangeRef.contextId,
14
+ context: rangeRef.context,
15
15
  method: "POST",
16
16
  path: generatePath(`/sites/{site-id}/drives/{drive-id}/items/{item-id}/workbook/worksheets/{worksheet-id}/range(address='${normalizeAddress(rangeRef.address)}')/merge`, rangeRef),
17
17
  headers: {
@@ -11,7 +11,7 @@ import { generatePath } from "../../services/templatedPaths.js";
11
11
  export default function setWorkbookRangeFill(rangeRef, format) {
12
12
  const address = normalizeAddress(rangeRef.address, true);
13
13
  return operation({
14
- contextId: rangeRef.contextId,
14
+ context: rangeRef.context,
15
15
  method: "PATCH",
16
16
  path: generatePath(`/sites/{site-id}/drives/{drive-id}/items/{item-id}/workbook/worksheets/{worksheet-id}/range(address='${address}')/format/fill`, rangeRef),
17
17
  headers: {
@@ -11,7 +11,7 @@ import { generatePath } from "../../services/templatedPaths.js";
11
11
  export default function setWorkbookRangeFont(rangeRef, format) {
12
12
  const address = normalizeAddress(rangeRef.address, true);
13
13
  return operation({
14
- contextId: rangeRef.contextId,
14
+ context: rangeRef.context,
15
15
  method: "PATCH",
16
16
  path: generatePath(`/sites/{site-id}/drives/{drive-id}/items/{item-id}/workbook/worksheets/{worksheet-id}/range(address='${address}')/format/font`, rangeRef),
17
17
  headers: {
@@ -13,7 +13,7 @@ import { generatePath } from "../../services/templatedPaths.js";
13
13
  export default function setWorkbookRangeFormat(rangeRef, format) {
14
14
  const address = normalizeAddress(rangeRef.address, true);
15
15
  return operation({
16
- contextId: rangeRef.contextId,
16
+ context: rangeRef.context,
17
17
  method: "PATCH",
18
18
  path: generatePath(`/sites/{site-id}/drives/{drive-id}/items/{item-id}/workbook/worksheets/{worksheet-id}/range(address='${address}')/format`, rangeRef),
19
19
  headers: {
@@ -10,7 +10,7 @@ import { generatePath } from "../../services/templatedPaths.js";
10
10
  */
11
11
  export default function unmergeWorkbookRange(rangeRef) {
12
12
  return operation({
13
- contextId: rangeRef.contextId,
13
+ context: rangeRef.context,
14
14
  method: "POST",
15
15
  path: generatePath(`/sites/{site-id}/drives/{drive-id}/items/{item-id}/workbook/worksheets/{worksheet-id}/range(address='${normalizeAddress(rangeRef.address)}')/unmerge`, rangeRef),
16
16
  headers: {
@@ -10,7 +10,7 @@ import { generatePath } from "../../services/templatedPaths.js";
10
10
  */
11
11
  export default function updateWorkbookNamedRange(rangeRef, value) {
12
12
  return operation({
13
- contextId: rangeRef.contextId,
13
+ context: rangeRef.context,
14
14
  method: "PATCH",
15
15
  path: generatePath("/sites/{site-id}/drives/{drive-id}/items/{item-id}/workbook/names/{range-name}/range", rangeRef),
16
16
  headers: {
@@ -12,7 +12,7 @@ import { generatePath } from "../../services/templatedPaths.js";
12
12
  export default function updateWorkbookRange(rangeRef, update) {
13
13
  const address = normalizeAddress(rangeRef.address, true);
14
14
  return operation({
15
- contextId: rangeRef.contextId,
15
+ context: rangeRef.context,
16
16
  method: "PATCH",
17
17
  path: generatePath(`/sites/{site-id}/drives/{drive-id}/items/{item-id}/workbook/worksheets/{worksheet-id}/range(address='${address}')`, rangeRef),
18
18
  headers: {
@@ -14,7 +14,7 @@ export default function closeWorkbookSession(workbookRef) {
14
14
  throw new InvalidArgumentError("Workbook session ID is required to close a session.");
15
15
  }
16
16
  return operation({
17
- contextId: workbookRef.contextId,
17
+ context: workbookRef.context,
18
18
  method: "POST",
19
19
  path: generatePath("/sites/{site-id}/drives/{drive-id}/items/{item-id}/workbook/closeSession", workbookRef),
20
20
  headers: {
@@ -11,7 +11,7 @@ import { generatePath } from "../../services/templatedPaths.js";
11
11
  */
12
12
  export default function createWorkbookSession(itemRef, persistChanges = true) {
13
13
  return operation({
14
- contextId: itemRef.contextId,
14
+ context: itemRef.context,
15
15
  method: "POST",
16
16
  path: generatePath("/sites/{site-id}/drives/{drive-id}/items/{item-id}/workbook/createSession", itemRef),
17
17
  headers: {
@@ -14,7 +14,7 @@ export default function refreshWorkbookSession(workbookRef) {
14
14
  throw new InvalidArgumentError("Workbook session ID is required to refresh a session.");
15
15
  }
16
16
  return operation({
17
- contextId: workbookRef.contextId,
17
+ context: workbookRef.context,
18
18
  method: "POST",
19
19
  path: generatePath("/sites/{site-id}/drives/{drive-id}/items/{item-id}/workbook/refreshSession", workbookRef),
20
20
  headers: {
@@ -10,7 +10,7 @@ import { generatePath } from "../../services/templatedPaths.js";
10
10
  */
11
11
  export default function applyWorkbookTableColumnFilter(columnRef, criteria) {
12
12
  return operation({
13
- contextId: columnRef.contextId,
13
+ context: columnRef.context,
14
14
  method: "POST",
15
15
  path: generatePath("/sites/{site-id}/drives/{drive-id}/items/{item-id}/workbook/worksheets/{worksheet-id}/tables/{table-id}/columns/{column}/filter/apply", columnRef),
16
16
  headers: {
@@ -8,7 +8,7 @@ import { generatePath } from "../../services/templatedPaths.js";
8
8
  */
9
9
  export default function clearWorkbookTableColumnFilters(tableRef) {
10
10
  return operation({
11
- contextId: tableRef.contextId,
11
+ context: tableRef.context,
12
12
  method: "POST",
13
13
  path: generatePath("/sites/{site-id}/drives/{drive-id}/items/{item-id}/workbook/worksheets/{worksheet-id}/tables/{table-id}/clearFilters", tableRef),
14
14
  headers: {
@@ -11,7 +11,7 @@ import { createWorkbookTableRef } from "../../services/workbookTable.js";
11
11
  */
12
12
  export default function createWorkbookTable(rangeRef, hasHeaders) {
13
13
  return operation({
14
- contextId: rangeRef.contextId,
14
+ context: rangeRef.context,
15
15
  method: "POST",
16
16
  path: generatePath("/sites/{site-id}/drives/{drive-id}/items/{item-id}/workbook/worksheets/{worksheet-id}/tables/add", rangeRef),
17
17
  headers: {
@@ -10,7 +10,7 @@ import { generatePath } from "../../services/templatedPaths.js";
10
10
  */
11
11
  export default function deleteWorkbookTable(tableRef) {
12
12
  return operation({
13
- contextId: tableRef.contextId,
13
+ context: tableRef.context,
14
14
  method: "DELETE",
15
15
  path: generatePath("/sites/{site-id}/drives/{drive-id}/items/{item-id}/workbook/tables/{table-id}", tableRef),
16
16
  headers: {
@@ -8,7 +8,7 @@ import { generatePath } from "../../services/templatedPaths.js";
8
8
  */
9
9
  export default function deleteWorkbookTablePreservingValues(tableRef) {
10
10
  return operation({
11
- contextId: tableRef.contextId,
11
+ context: tableRef.context,
12
12
  method: "POST",
13
13
  path: generatePath("/sites/{site-id}/drives/{drive-id}/items/{item-id}/workbook/tables/{table-id}/convertToRange", tableRef),
14
14
  headers: {
@@ -9,7 +9,7 @@ import { generatePath } from "../../services/templatedPaths.js";
9
9
  */
10
10
  export default function getWorkbookTable(tableRef) {
11
11
  return operation({
12
- contextId: tableRef.contextId,
12
+ context: tableRef.context,
13
13
  method: "GET",
14
14
  path: generatePath("/sites/{site-id}/drives/{drive-id}/items/{item-id}/workbook/worksheets/{worksheet-id}/tables/{table-id}", tableRef),
15
15
  headers: {
@@ -11,7 +11,7 @@ import { createWorkbookRangeRef } from "../../services/workbookRange.js";
11
11
  */
12
12
  export default function getWorkbookTableBodyRange(tableRef) {
13
13
  return operation({
14
- contextId: tableRef.contextId,
14
+ context: tableRef.context,
15
15
  method: "GET",
16
16
  path: generatePath("/sites/{site-id}/drives/{drive-id}/items/{item-id}/workbook/worksheets/{worksheet-id}/tables/{table-id}/dataBodyRange", tableRef),
17
17
  headers: {
@@ -1,6 +1,5 @@
1
1
  import type { WorkbookRange } from "@microsoft/microsoft-graph-types";
2
2
  import type { GraphOperation } from "../../models/GraphOperation.ts";
3
- import type { WorkbookRangeRef } from "../../models/WorkbookRangeRef.ts";
4
3
  import type { WorkbookTableRef } from "../../models/WorkbookTableRef.ts";
5
4
  /**
6
5
  * Retrieve the visible data body range of a table.
@@ -9,5 +8,5 @@ import type { WorkbookTableRef } from "../../models/WorkbookTableRef.ts";
9
8
  * @returns The data body range of the specified table, including its metadata and reference information.
10
9
  * @see https://learn.microsoft.com/en-us/graph/api/table-databodyrange
11
10
  */
12
- export default function getWorkbookTableBodyVisibleRange(tableRef: WorkbookTableRef): GraphOperation<WorkbookRange & WorkbookRangeRef>;
11
+ export default function getWorkbookTableBodyVisibleRange(tableRef: WorkbookTableRef): GraphOperation<WorkbookRange>;
13
12
  //# sourceMappingURL=getWorkbookTableBodyVisibleRange.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getWorkbookTableBodyVisibleRange.d.ts","sourceRoot":"","sources":["../../../../src/operations/workbookTable/getWorkbookTableBodyVisibleRange.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAGtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAIzE;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,gCAAgC,CAAC,QAAQ,EAAE,gBAAgB,GAAG,cAAc,CAAC,aAAa,GAAG,gBAAgB,CAAC,CAmBrI"}
1
+ {"version":3,"file":"getWorkbookTableBodyVisibleRange.d.ts","sourceRoot":"","sources":["../../../../src/operations/workbookTable/getWorkbookTableBodyVisibleRange.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAEtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAGzE;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,gCAAgC,CAAC,QAAQ,EAAE,gBAAgB,GAAG,cAAc,CAAC,aAAa,CAAC,CAiBlH"}
@@ -1,6 +1,5 @@
1
1
  import { operation } from "../../graphApi.js";
2
2
  import { generatePath } from "../../services/templatedPaths.js";
3
- import { createWorkbookRangeRef } from "../../services/workbookRange.js";
4
3
  /**
5
4
  * Retrieve the visible data body range of a table.
6
5
  *
@@ -10,7 +9,7 @@ import { createWorkbookRangeRef } from "../../services/workbookRange.js";
10
9
  */
11
10
  export default function getWorkbookTableBodyVisibleRange(tableRef) {
12
11
  return operation({
13
- contextId: tableRef.contextId,
12
+ context: tableRef.context,
14
13
  method: "GET",
15
14
  path: generatePath("/sites/{site-id}/drives/{drive-id}/items/{item-id}/workbook/worksheets/{worksheet-id}/tables/{table-id}/dataBodyRange/visibleView", tableRef),
16
15
  headers: {
@@ -19,11 +18,9 @@ export default function getWorkbookTableBodyVisibleRange(tableRef) {
19
18
  body: null,
20
19
  responseTransform: (response) => {
21
20
  const range = response;
22
- const rangeRef = createWorkbookRangeRef(tableRef, range.address);
23
- return {
24
- ...range,
25
- ...rangeRef,
26
- };
21
+ // This API does not appear to return the range address. It is undefined.
22
+ // const rangeRef = createWorkbookRangeRef(tableRef, range.address as CellRangeAddress);
23
+ return range;
27
24
  },
28
25
  });
29
26
  }
@@ -11,7 +11,7 @@ import { createWorkbookRangeRef } from "../../services/workbookRange.js";
11
11
  */
12
12
  export default function getWorkbookTableHeaderRange(tableRef) {
13
13
  return operation({
14
- contextId: tableRef.contextId,
14
+ context: tableRef.context,
15
15
  method: "GET",
16
16
  path: generatePath("/sites/{site-id}/drives/{drive-id}/items/{item-id}/workbook/worksheets/{worksheet-id}/tables/{table-id}/headerRowRange", tableRef),
17
17
  headers: {
@@ -9,7 +9,7 @@ import { generatePath } from "../../services/templatedPaths.js";
9
9
  */
10
10
  export default function listWorkbookTableColumns(tableRef) {
11
11
  return operation({
12
- contextId: tableRef.contextId,
12
+ context: tableRef.context,
13
13
  method: "GET",
14
14
  path: generatePath("/sites/{site-id}/drives/{drive-id}/items/{item-id}/workbook/tables/{table-id}/columns", tableRef),
15
15
  headers: {
@@ -9,7 +9,7 @@ import { generatePath } from "../../services/templatedPaths.js";
9
9
  */
10
10
  export default function listWorkbookTableRows(tableRef) {
11
11
  return operation({
12
- contextId: tableRef.contextId,
12
+ context: tableRef.context,
13
13
  method: "GET",
14
14
  path: generatePath("/sites/{site-id}/drives/{drive-id}/items/{item-id}/workbook/tables/{table-id}/rows", tableRef),
15
15
  headers: {
@@ -10,7 +10,7 @@ import { createWorkbookTableRef } from "../../services/workbookTable.js";
10
10
  */
11
11
  export default function listWorkbookTables(worksheetRef) {
12
12
  return operation({
13
- contextId: worksheetRef.contextId,
13
+ context: worksheetRef.context,
14
14
  method: "GET",
15
15
  path: generatePath("/sites/{site-id}/drives/{drive-id}/items/{item-id}/workbook/worksheets/{worksheet-id}/tables", worksheetRef),
16
16
  headers: {
@@ -11,7 +11,7 @@ import { createWorkbookWorksheetRef } from "../../services/workbookWorksheet.js"
11
11
  */
12
12
  export default function createWorkbookWorksheet(workbookRef, name) {
13
13
  return operation({
14
- contextId: workbookRef.contextId,
14
+ context: workbookRef.context,
15
15
  method: "POST",
16
16
  path: generatePath("/sites/{site-id}/drives/{drive-id}/items/{item-id}/workbook/worksheets/add", workbookRef),
17
17
  headers: {
@@ -9,7 +9,7 @@ import { generatePath } from "../../services/templatedPaths.js";
9
9
  */
10
10
  export default function deleteWorkbookWorksheet(worksheetRef) {
11
11
  return operation({
12
- contextId: worksheetRef.contextId,
12
+ context: worksheetRef.context,
13
13
  method: "DELETE",
14
14
  path: generatePath("/sites/{site-id}/drives/{drive-id}/items/{item-id}/workbook/worksheets/{worksheet-id}", worksheetRef),
15
15
  headers: {
@@ -11,7 +11,7 @@ import { createWorkbookRangeRef } from "../../services/workbookRange.js";
11
11
  */
12
12
  export default function getWorkbookWorksheetUsedRange(worksheetRef) {
13
13
  return operation({
14
- contextId: worksheetRef.contextId,
14
+ context: worksheetRef.context,
15
15
  method: "GET",
16
16
  path: generatePath("/sites/{site-id}/drives/{drive-id}/items/{item-id}/workbook/worksheets/{worksheet-id}/range/usedRange", worksheetRef),
17
17
  headers: {
@@ -11,7 +11,7 @@ import { createWorkbookRangeRef } from "../../services/workbookRange.js";
11
11
  */
12
12
  export default function getWorkbookWorksheetUsedRangeRef(worksheetRef) {
13
13
  return operation({
14
- contextId: worksheetRef.contextId,
14
+ context: worksheetRef.context,
15
15
  method: "GET",
16
16
  path: generatePath("/sites/{site-id}/drives/{drive-id}/items/{item-id}/workbook/worksheets/{worksheet-id}/range/usedRange?$select=address", worksheetRef),
17
17
  headers: {
@@ -10,7 +10,7 @@ import { createWorkbookRangeRef } from "../../services/workbookRange.js";
10
10
  */
11
11
  export default function getWorkbookWorksheetUsedVisibleRange(worksheetRef) {
12
12
  return operation({
13
- contextId: worksheetRef.contextId,
13
+ context: worksheetRef.context,
14
14
  method: "GET",
15
15
  path: generatePath("/sites/{site-id}/drives/{drive-id}/items/{item-id}/workbook/worksheets/{worksheet-id}/range/usedRange/visibleView", worksheetRef),
16
16
  headers: {
@@ -11,7 +11,7 @@ import { createWorkbookWorksheetRef } from "../../services/workbookWorksheet.js"
11
11
  */
12
12
  export default function listWorkbookWorksheets(workbookRef) {
13
13
  return operation({
14
- contextId: workbookRef.contextId,
14
+ context: workbookRef.context,
15
15
  method: "GET",
16
16
  path: generatePath("/sites/{site-id}/drives/{drive-id}/items/{item-id}/workbook/worksheets", workbookRef),
17
17
  headers: {
@@ -13,7 +13,7 @@ import { generatePath } from "../../services/templatedPaths.js";
13
13
  */
14
14
  export default function updateWorkbookWorksheet(worksheetRef, updates) {
15
15
  return operation({
16
- contextId: worksheetRef.contextId,
16
+ context: worksheetRef.context,
17
17
  method: "PATCH",
18
18
  path: generatePath("/sites/{site-id}/drives/{drive-id}/items/{item-id}/workbook/worksheets/{worksheet-id}", worksheetRef),
19
19
  headers: {
@@ -150,7 +150,7 @@ export declare function countAddressColumns(address: Address): number;
150
150
  */
151
151
  export declare function cellToRangeAddress(cell: CellAddress, rows: number, cols: number): Address;
152
152
  /**
153
- * Extracts a subrange from a spreadsheet-style A1 range (e.g., "A1:D10"),
153
+ * Extracts a sub-address from a spreadsheet-style A1 range (e.g., "A1:D10"),
154
154
  * allowing skip and take semantics on both rows and columns.
155
155
  *
156
156
  * Supports negative values for `skipRows` and `skipCols` to count from the end.
@@ -171,7 +171,7 @@ export declare function cellToRangeAddress(cell: CellAddress, rows: number, cols
171
171
  */
172
172
  export declare function subAddress(address: Address, skipRows?: number, takeRows?: number, skipCols?: number, takeCols?: number): Address;
173
173
  /**
174
- * Extracts a subrange from a WorkbookRangeRef using skip/take semantics.
174
+ * Extracts a sub-range from a WorkbookRangeRef using skip/take semantics.
175
175
  * @param rangeRef Range reference to extract the sub-range from.
176
176
  * @param skipRows Number of rows to skip. If negative, skips from the end. Default 0.
177
177
  * @param takeRows Number of rows to take after skipping. If negative, excludes from the end. Default Infinity.
@@ -180,5 +180,5 @@ export declare function subAddress(address: Address, skipRows?: number, takeRows
180
180
  * @returns Extracted sub-range reference.
181
181
  * @throws InvalidArgumentError if the requested rows or columns exceed the available range.
182
182
  */
183
- export declare function subrange(rangeRef: WorkbookRangeRef, skipRows?: number, takeRows?: number, skipCols?: number, takeCols?: number): WorkbookRangeRef;
183
+ export declare function subRange(rangeRef: WorkbookRangeRef, skipRows?: number, takeRows?: number, skipCols?: number, takeCols?: number): WorkbookRangeRef;
184
184
  //# sourceMappingURL=addressManipulation.d.ts.map
@@ -316,7 +316,7 @@ export function cellToRangeAddress(cell, rows, cols) {
316
316
  });
317
317
  }
318
318
  /**
319
- * Extracts a subrange from a spreadsheet-style A1 range (e.g., "A1:D10"),
319
+ * Extracts a sub-address from a spreadsheet-style A1 range (e.g., "A1:D10"),
320
320
  * allowing skip and take semantics on both rows and columns.
321
321
  *
322
322
  * Supports negative values for `skipRows` and `skipCols` to count from the end.
@@ -370,7 +370,7 @@ export function subAddress(address, skipRows = 0, takeRows = Number.POSITIVE_INF
370
370
  }
371
371
  }
372
372
  /**
373
- * Extracts a subrange from a WorkbookRangeRef using skip/take semantics.
373
+ * Extracts a sub-range from a WorkbookRangeRef using skip/take semantics.
374
374
  * @param rangeRef Range reference to extract the sub-range from.
375
375
  * @param skipRows Number of rows to skip. If negative, skips from the end. Default 0.
376
376
  * @param takeRows Number of rows to take after skipping. If negative, excludes from the end. Default Infinity.
@@ -379,7 +379,7 @@ export function subAddress(address, skipRows = 0, takeRows = Number.POSITIVE_INF
379
379
  * @returns Extracted sub-range reference.
380
380
  * @throws InvalidArgumentError if the requested rows or columns exceed the available range.
381
381
  */
382
- export function subrange(rangeRef, skipRows = 0, takeRows = Number.POSITIVE_INFINITY, skipCols = 0, takeCols = Number.POSITIVE_INFINITY) {
382
+ export function subRange(rangeRef, skipRows = 0, takeRows = Number.POSITIVE_INFINITY, skipCols = 0, takeCols = Number.POSITIVE_INFINITY) {
383
383
  const address = subAddress(rangeRef.address, skipRows, takeRows, skipCols, takeCols);
384
384
  return {
385
385
  ...rangeRef,
@@ -1,28 +1,27 @@
1
+ import type { AccessToken } from "../models/AccessToken.ts";
2
+ import type { AccessTokenGenerator } from "../models/AccessTokenGenerator.ts";
1
3
  import type { ClientId } from "../models/ClientId.ts";
2
4
  import type { ClientSecret } from "../models/ClientSecret.ts";
3
- import type { Context } from "../models/Context.ts";
4
- import type { ContextId } from "../models/ContextId.ts";
5
5
  import type { ContextRef } from "../models/ContextRef.ts";
6
+ import type { Scope } from "../models/Scope.ts";
6
7
  import type { TenantId } from "../models/TenantId.ts";
8
+ /** Create a context using the client secret credential. */
9
+ export declare function createClientSecretContext(tenantId: TenantId, clientId: ClientId, clientSecret: ClientSecret, scope?: Scope): ContextRef;
7
10
  /**
8
- * Registers a tenant+client so that its secret can be used later.
9
- * @param tenantId - The tenant ID.
10
- * @param clientId - The client ID.
11
- * @param clientSecret - The client secret.
12
- * @returns A reference to the registered context.
11
+ * Create a context using a static access token.
12
+ * @remarks You must manually handle renewal of the access token with this approach.
13
13
  */
14
- export declare function register(tenantId: TenantId, clientId: ClientId, clientSecret: ClientSecret): ContextRef;
14
+ export declare function createAccessTokenContext(accessToken: AccessToken): ContextRef;
15
+ /** Create a context using a given access token generator. */
16
+ export declare function createContext(accessTokenGenerator: AccessTokenGenerator): ContextRef;
17
+ /** Create a context using the client secret credential using environment variables AZURE_TENANT_ID, AZURE_CLIENT_ID and AZURE_CLIENT_SECRET. */
18
+ export declare function createDefaultClientSecretContext(): ContextRef;
15
19
  /**
16
- * Retrieves the context for a given context ID.
17
- * @param contextId - The ID of the context.
18
- * @returns The context associated with the given ID.
19
- * @throws ContextNotRegisteredError if the context ID is not registered.
20
+ @obsolete Use `createDefaultClientSecretContext()` instead.
20
21
  */
21
- export declare function getContext(contextId: ContextId): Context;
22
+ export declare function getDefaultContextRef(): ContextRef;
22
23
  /**
23
- * Retrieves the opinionated default context reference. NOT RECOMMENDED FOR PRODUCTION USE.
24
- * @returns A reference to the default context.
25
- * @remarks This method is opinionated and not recommended for production use.
24
+ * @obsolete Use `createClientSecretContext()` instead.
26
25
  */
27
- export declare function getDefaultContextRef(): ContextRef;
26
+ export declare function register(tenantId: TenantId, clientId: ClientId, clientSecret: ClientSecret): ContextRef;
28
27
  //# sourceMappingURL=context.d.ts.map
@@ -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,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"}
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/services/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAMtD,2DAA2D;AAC3D,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,KAAK,GAAE,KAAoB,GAAG,UAAU,CAMrJ;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,WAAW,EAAE,WAAW,GAAG,UAAU,CAK7E;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,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,YAAY,GAAG,UAAU,CAEvG"}
@@ -1,55 +1,48 @@
1
- import ContextNotRegisteredError from "../errors/ContextNotRegisteredError.js";
1
+ import { getCurrentAccessToken } from "./accessToken.js";
2
2
  import { getEnvironmentVariable } from "./environmentVariable.js";
3
- import { generateRandomString } from "./random.js";
4
- const contexts = {};
5
- /**
6
- * Registers a tenant+client so that its secret can be used later.
7
- * @param tenantId - The tenant ID.
8
- * @param clientId - The client ID.
9
- * @param clientSecret - The client secret.
10
- * @returns A reference to the registered context.
11
- */
12
- export function register(tenantId, clientId, clientSecret) {
13
- const contextId = generateContextId();
14
- const context = {
15
- tenantId,
16
- clientId,
17
- clientSecret,
3
+ const defaultScope = "https://graph.microsoft.com/.default";
4
+ /** Create a context using the client secret credential. */
5
+ export function createClientSecretContext(tenantId, clientId, clientSecret, scope = defaultScope) {
6
+ const generateAccessToken = async () => {
7
+ return await getCurrentAccessToken(tenantId, clientId, clientSecret, scope);
18
8
  };
19
- contexts[contextId] = context;
20
- const contextRef = createContextRef(contextId);
21
- return contextRef;
9
+ return createContext(generateAccessToken);
22
10
  }
23
11
  /**
24
- * Retrieves the context for a given context ID.
25
- * @param contextId - The ID of the context.
26
- * @returns The context associated with the given ID.
27
- * @throws ContextNotRegisteredError if the context ID is not registered.
12
+ * Create a context using a static access token.
13
+ * @remarks You must manually handle renewal of the access token with this approach.
28
14
  */
29
- export function getContext(contextId) {
30
- const context = contexts[contextId];
31
- if (!context) {
32
- throw new ContextNotRegisteredError(`Context with ID ${contextId} is not registered`);
33
- }
34
- return context;
35
- }
36
- function generateContextId() {
37
- return generateRandomString(16);
15
+ export function createAccessTokenContext(accessToken) {
16
+ // biome-ignore lint/suspicious/useAwait: Not applicable here, as we are creating a context that returns a static access token.
17
+ return createContext(async () => {
18
+ return accessToken;
19
+ });
38
20
  }
39
- function createContextRef(contextId) {
21
+ /** Create a context using a given access token generator. */
22
+ export function createContext(accessTokenGenerator) {
23
+ const context = {
24
+ generateAccessToken: accessTokenGenerator,
25
+ };
40
26
  return {
41
- contextId,
27
+ context,
42
28
  };
43
29
  }
44
- /**
45
- * Retrieves the opinionated default context reference. NOT RECOMMENDED FOR PRODUCTION USE.
46
- * @returns A reference to the default context.
47
- * @remarks This method is opinionated and not recommended for production use.
48
- */
49
- export function getDefaultContextRef() {
30
+ /** Create a context using the client secret credential using environment variables AZURE_TENANT_ID, AZURE_CLIENT_ID and AZURE_CLIENT_SECRET. */
31
+ export function createDefaultClientSecretContext() {
50
32
  const tenantId = getEnvironmentVariable("AZURE_TENANT_ID");
51
33
  const clientId = getEnvironmentVariable("AZURE_CLIENT_ID");
52
34
  const clientSecret = getEnvironmentVariable("AZURE_CLIENT_SECRET");
53
- const contextRef = register(tenantId, clientId, clientSecret);
54
- return contextRef;
35
+ return createClientSecretContext(tenantId, clientId, clientSecret);
36
+ }
37
+ /**
38
+ @obsolete Use `createDefaultClientSecretContext()` instead.
39
+ */
40
+ export function getDefaultContextRef() {
41
+ return createDefaultClientSecretContext();
42
+ }
43
+ /**
44
+ * @obsolete Use `createClientSecretContext()` instead.
45
+ */
46
+ export function register(tenantId, clientId, clientSecret) {
47
+ return createClientSecretContext(tenantId, clientId, clientSecret);
55
48
  }