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
@@ -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"}
@@ -3,6 +3,7 @@
3
3
  * Creates new drive item in the specified parent drive or folder.
4
4
  * @module createDriveItem
5
5
  * @category Operations
6
+ * @hidden
6
7
  */
7
8
  Object.defineProperty(exports, "__esModule", { value: true });
8
9
  exports.default = createDriveItem;
@@ -16,6 +17,8 @@ const templatedPaths_ts_1 = require("../../services/templatedPaths.js");
16
17
  * @returns The newly created drive item.
17
18
  * @remarks If the file already exists, it will be replaced.
18
19
  * @see https://learn.microsoft.com/en-us/graph/api/driveitem-put-content
20
+ * @deprecated Use {@link createDriveItemContent} instead for uploading content.
21
+ * @hidden
19
22
  */
20
23
  function createDriveItem(parentRef, itemPath, contextType, content) {
21
24
  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,122 @@
1
+ "use strict";
2
+ /**
3
+ * Creates a new drive item in the specified parent drive or folder using a stream as content.
4
+ * @module createDriveItemContent
5
+ * @category Operations
6
+ */
7
+ var __importDefault = (this && this.__importDefault) || function (mod) {
8
+ return (mod && mod.__esModule) ? mod : { "default": mod };
9
+ };
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.default = createDriveItemContent;
12
+ const ProtocolError_ts_1 = __importDefault(require("../../errors/ProtocolError.js"));
13
+ const driveItem_ts_1 = require("../../services/driveItem.js");
14
+ const http_ts_1 = require("../../services/http.js");
15
+ const operationInvoker_ts_1 = require("../../services/operationInvoker.js");
16
+ const templatedPaths_ts_1 = require("../../services/templatedPaths.js");
17
+ const defaultChunkSize = 10 * 1024 * 1024;
18
+ /**
19
+ * Creates a new drive item in the specified parent drive or folder using a stream as content.
20
+ * @param parentRef Reference to the parent drive or folder where the drive item will be created.
21
+ * @param itemPath Path (including the filename) for the new drive item within the given parent.
22
+ * @param contentStream A Node.js readable stream containing the file content.
23
+ * @param totalSize The total size in bytes of the content to be uploaded.
24
+ * @param conflictBehavior Optional. Specifies how to handle conflicts if the file already exists. Default is 'fail'.
25
+ * @returns The newly created drive item.
26
+ * @see https://learn.microsoft.com/en-us/graph/api/driveitem-createuploadsession
27
+ * @see https://learn.microsoft.com/en-us/graph/api/resources/uploadsession
28
+ */
29
+ async function createDriveItemContent(parentRef, itemPath, contentStream, totalSize, conflictBehavior = "fail", chunkSize = defaultChunkSize) {
30
+ const pathSegment = parentRef.itemId ? "items/{item-id}" : "root";
31
+ const uploadSessionUrl = `${operationInvoker_ts_1.endpoint}${(0, templatedPaths_ts_1.generatePath)(`/sites/{site-id}/drives/{drive-id}/${pathSegment}:/${itemPath}:/createUploadSession`, parentRef)}`;
32
+ const accessToken = await parentRef.context.generateAccessToken();
33
+ const fileName = itemPath.split("/").pop();
34
+ const { uploadUrl } = await (0, http_ts_1.execute)({
35
+ url: uploadSessionUrl,
36
+ method: "POST",
37
+ headers: {
38
+ authorization: `Bearer ${accessToken}`,
39
+ "content-type": "application/json",
40
+ },
41
+ data: JSON.stringify({
42
+ item: {
43
+ "@microsoft.graph.conflictBehavior": conflictBehavior,
44
+ name: fileName,
45
+ },
46
+ }),
47
+ responseType: "json",
48
+ });
49
+ let position = 0;
50
+ let driveItem = null;
51
+ let streamEnded = false;
52
+ const chunks = [];
53
+ contentStream.on("data", (chunk) => {
54
+ chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
55
+ });
56
+ contentStream.on("end", () => {
57
+ streamEnded = true;
58
+ });
59
+ contentStream.on("error", () => {
60
+ // error will be handled in readChunk
61
+ });
62
+ let chunk = await readChunk();
63
+ while (chunk !== null) {
64
+ let currentChunk = chunk;
65
+ while (currentChunk.length > 0) {
66
+ const thisChunk = currentChunk.subarray(0, chunkSize);
67
+ const start = position;
68
+ const end = position + thisChunk.length - 1;
69
+ const contentRange = `bytes ${start}-${end}/${totalSize}`;
70
+ const res = await (0, http_ts_1.execute)({
71
+ url: uploadUrl,
72
+ method: "PUT",
73
+ headers: {
74
+ "Content-Length": thisChunk.length.toString(),
75
+ "Content-Range": contentRange,
76
+ },
77
+ data: thisChunk,
78
+ responseType: "json",
79
+ });
80
+ position += thisChunk.length;
81
+ currentChunk = currentChunk.subarray(chunkSize);
82
+ if (isDriveItem(res)) {
83
+ driveItem = res;
84
+ break;
85
+ }
86
+ }
87
+ if (driveItem)
88
+ break;
89
+ chunk = await readChunk();
90
+ }
91
+ if (!driveItem) {
92
+ throw new ProtocolError_ts_1.default(`Upload did not complete successfully. Last position: ${position}`);
93
+ }
94
+ const itemRef = (0, driveItem_ts_1.createDriveItemRef)(parentRef, driveItem.id);
95
+ return {
96
+ ...driveItem,
97
+ ...itemRef,
98
+ };
99
+ function isDriveItem(obj) {
100
+ return typeof obj === "object" && obj !== null && "id" in obj;
101
+ }
102
+ function readChunk() {
103
+ return new Promise((resolve, reject) => {
104
+ if (chunks.length > 0) {
105
+ const next = chunks.shift();
106
+ return resolve(next ?? null);
107
+ }
108
+ if (streamEnded)
109
+ return resolve(null);
110
+ contentStream.once("data", (chunk) => {
111
+ resolve(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
112
+ });
113
+ contentStream.once("end", () => {
114
+ streamEnded = true;
115
+ resolve(null);
116
+ });
117
+ contentStream.once("error", (err) => {
118
+ reject(err);
119
+ });
120
+ });
121
+ }
122
+ }
@@ -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"}
@@ -19,13 +19,12 @@ async function existsDriveItem(driveRef, itemPath) {
19
19
  // Note this method doesn't match the standard pattern since the batching library doesn't support non-JSON return types.
20
20
  const url = `${operationInvoker_ts_1.endpoint}${(0, templatedPaths_ts_1.generatePath)(`/sites/{site-id}/drives/{drive-id}/root:${itemPath}`, driveRef)}`;
21
21
  const accessToken = await driveRef.context.generateAccessToken();
22
- const response = await (0, http_ts_1.executeHttpRequest)({
22
+ const response = await (0, http_ts_1.executeRaw)({
23
23
  url,
24
24
  method: "GET",
25
25
  headers: {
26
26
  authorization: `Bearer ${accessToken}`,
27
27
  },
28
- validateStatus: () => true,
29
28
  });
30
29
  if ((0, httpStatus_ts_1.isHttpOk)(response.status)) {
31
30
  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"}
@@ -8,7 +8,6 @@
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.default = getDriveItemContent;
10
10
  const http_ts_1 = require("../../services/http.js");
11
- const httpStatus_ts_1 = require("../../services/httpStatus.js");
12
11
  const operationInvoker_ts_1 = require("../../services/operationInvoker.js");
13
12
  const templatedPaths_ts_1 = require("../../services/templatedPaths.js");
14
13
  /**
@@ -25,7 +24,7 @@ async function getDriveItemContent(itemRef) {
25
24
  // 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.
26
25
  const url = `${operationInvoker_ts_1.endpoint}${(0, templatedPaths_ts_1.generatePath)("/sites/{site-id}/drives/{drive-id}/items/{item-id}/content", itemRef)}`;
27
26
  const accessToken = await itemRef.context.generateAccessToken();
28
- const response = await (0, http_ts_1.executeHttpRequest)({
27
+ const response = await (0, http_ts_1.execute)({
29
28
  url,
30
29
  method: "GET",
31
30
  headers: {
@@ -33,13 +32,7 @@ async function getDriveItemContent(itemRef) {
33
32
  },
34
33
  responseType: "arraybuffer",
35
34
  });
36
- if (!(0, httpStatus_ts_1.isHttpSuccess)(response.status)) {
37
- (0, operationInvoker_ts_1.throwException)(response.status, "Failed to get content");
38
- }
39
- if (!Buffer.isBuffer(response.data)) {
40
- throw new Error(`Unexpected response type: ${typeof response.data}`);
41
- }
42
- const buffer = response.data.buffer.slice(response.data.byteOffset, response.data.byteOffset + response.data.byteLength);
35
+ const buffer = response.buffer.slice(response.byteOffset, response.byteOffset + response.byteLength);
43
36
  if (!(buffer instanceof ArrayBuffer)) {
44
37
  throw new Error("Failed to convert Buffer to ArrayBuffer");
45
38
  }
@@ -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"}
@@ -7,7 +7,6 @@
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.default = streamDriveItemContent;
9
9
  const http_ts_1 = require("../../services/http.js");
10
- const httpStatus_ts_1 = require("../../services/httpStatus.js");
11
10
  const operationInvoker_ts_1 = require("../../services/operationInvoker.js");
12
11
  const templatedPaths_ts_1 = require("../../services/templatedPaths.js");
13
12
  /**
@@ -22,7 +21,7 @@ async function streamDriveItemContent(itemRef) {
22
21
  // TODO: Rename to getDriveItemContent at next breaking update
23
22
  const url = `${operationInvoker_ts_1.endpoint}${(0, templatedPaths_ts_1.generatePath)("/sites/{site-id}/drives/{drive-id}/items/{item-id}/content", itemRef)}`;
24
23
  const accessToken = await itemRef.context.generateAccessToken();
25
- const response = await (0, http_ts_1.executeHttpRequest)({
24
+ const response = await (0, http_ts_1.execute)({
26
25
  url,
27
26
  method: "GET",
28
27
  headers: {
@@ -30,11 +29,5 @@ async function streamDriveItemContent(itemRef) {
30
29
  },
31
30
  responseType: "stream",
32
31
  });
33
- if (!(0, httpStatus_ts_1.isHttpSuccess)(response.status)) {
34
- (0, operationInvoker_ts_1.throwException)(response.status, "Failed to stream content");
35
- }
36
- if (!response || typeof response.data?.pipe !== "function") {
37
- throw new Error("Failed to get a streamable response");
38
- }
39
- return response.data;
32
+ return response;
40
33
  }
@@ -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"}
@@ -3,19 +3,14 @@
3
3
  * Azure application credential helpers for authentication and token management.
4
4
  * @module azureApplicationCredentials
5
5
  * @category Services
6
+ * @hidden
6
7
  */
7
8
  Object.defineProperty(exports, "__esModule", { value: true });
8
9
  exports.getCurrentAccessToken = getCurrentAccessToken;
9
10
  const identity_1 = require("@azure/identity");
10
11
  const innerTokenCache = {};
11
12
  /**
12
- * Retrieves the current access token for a given client and scope.
13
- * If a valid token is cached, it will be returned; otherwise, a new token will be requested.
14
- * @param tenantId - The tenant ID.
15
- * @param clientId - The client ID.
16
- * @param clientSecret - The client secret.
17
- * @param scope - The scope for which the token is requested.
18
- * @returns A promise that resolves to the access token.
13
+ * @deprecated
19
14
  */
20
15
  async function getCurrentAccessToken(tenantId, clientId, clientSecret, scope) {
21
16
  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"}
@@ -5,9 +5,9 @@
5
5
  * @category Services
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.createContext = createContext;
8
9
  exports.createClientSecretContext = createClientSecretContext;
9
10
  exports.createAccessTokenContext = createAccessTokenContext;
10
- exports.createContext = createContext;
11
11
  exports.createDefaultClientSecretContext = createDefaultClientSecretContext;
12
12
  exports.getDefaultContextRef = getDefaultContextRef;
13
13
  exports.register = register;
@@ -15,7 +15,18 @@ const azureApplicationCredentials_ts_1 = require("./azureApplicationCredentials.
15
15
  const environmentVariable_ts_1 = require("./environmentVariable.js");
16
16
  ("../models/Scope.ts");
17
17
  const defaultScope = "https://graph.microsoft.com/.default";
18
- /** Create a context using the client secret credential. */
18
+ /** Create a context using a given access token generator. */
19
+ function createContext(accessTokenGenerator) {
20
+ const context = {
21
+ generateAccessToken: accessTokenGenerator,
22
+ };
23
+ return {
24
+ context,
25
+ };
26
+ }
27
+ /**
28
+ * @deprecated Use `createContext(accessTokenGenerator)` instead.
29
+ */
19
30
  function createClientSecretContext(tenantId, clientId, clientSecret, scope = defaultScope) {
20
31
  const generateAccessToken = async () => {
21
32
  return await (0, azureApplicationCredentials_ts_1.getCurrentAccessToken)(tenantId, clientId, clientSecret, scope);
@@ -23,24 +34,16 @@ function createClientSecretContext(tenantId, clientId, clientSecret, scope = def
23
34
  return createContext(generateAccessToken);
24
35
  }
25
36
  /**
26
- * Create a context using a static access token.
27
- * @remarks You must manually handle renewal of the access token with this approach.
37
+ * @deprecated Use `createContext(accessTokenGenerator)` instead.
28
38
  */
29
39
  function createAccessTokenContext(accessToken) {
30
40
  return createContext(async () => {
31
41
  return accessToken;
32
42
  });
33
43
  }
34
- /** Create a context using a given access token generator. */
35
- function createContext(accessTokenGenerator) {
36
- const context = {
37
- generateAccessToken: accessTokenGenerator,
38
- };
39
- return {
40
- context,
41
- };
42
- }
43
- /** Create a context using the client secret credential using environment variables AZURE_TENANT_ID, AZURE_CLIENT_ID and AZURE_CLIENT_SECRET. */
44
+ /**
45
+ * @deprecated Use `createContext(accessTokenGenerator)` instead.
46
+ */
44
47
  function createDefaultClientSecretContext() {
45
48
  const tenantId = (0, environmentVariable_ts_1.getEnvironmentVariable)("AZURE_TENANT_ID");
46
49
  const clientId = (0, environmentVariable_ts_1.getEnvironmentVariable)("AZURE_CLIENT_ID");
@@ -48,13 +51,13 @@ function createDefaultClientSecretContext() {
48
51
  return createClientSecretContext(tenantId, clientId, clientSecret);
49
52
  }
50
53
  /**
51
- @deprecated Use `createDefaultClientSecretContext()` instead.
54
+ @deprecated Use `createContext(accessTokenGenerator)` instead.
52
55
  */
53
56
  function getDefaultContextRef() {
54
57
  return createDefaultClientSecretContext();
55
58
  }
56
59
  /**
57
- * @deprecated Use `createClientSecretContext()` instead.
60
+ * @deprecated Use `createContext(accessTokenGenerator)` instead.
58
61
  */
59
62
  function register(tenantId, clientId, clientSecret) {
60
63
  return createClientSecretContext(tenantId, clientId, clientSecret);
@@ -3,6 +3,16 @@
3
3
  * @module http
4
4
  * @category Services
5
5
  */
6
- import { type AxiosRequestConfig } from "axios";
7
- export declare function executeHttpRequest(config: AxiosRequestConfig): Promise<import("axios").AxiosResponse<any, any>>;
6
+ import { type AxiosResponse, type RawAxiosRequestHeaders, type ResponseType } from "axios";
7
+ import type { HttpMethod } from "../models/Http.ts";
8
+ export type Request = {
9
+ url: string;
10
+ method: HttpMethod;
11
+ headers?: RawAxiosRequestHeaders;
12
+ data?: unknown;
13
+ responseType?: ResponseType;
14
+ };
15
+ export declare function execute<TResponse>(request: Request): Promise<TResponse>;
16
+ export declare function throwHttpException(responseCode: number, message: string): never;
17
+ export declare function executeRaw(request: Request): Promise<AxiosResponse<any, any>>;
8
18
  //# sourceMappingURL=http.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../src/services/http.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAc,EAAsB,KAAK,kBAAkB,EAA4B,MAAM,OAAO,CAAC;AAKrG,wBAAsB,kBAAkB,CAAC,MAAM,EAAE,kBAAkB,oDAMlE"}
1
+ {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../src/services/http.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAc,EAA+C,KAAK,aAAa,EAA4B,KAAK,sBAAsB,EAAE,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AA0BzK,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAkCpD,MAAM,MAAM,OAAO,GAAG;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,UAAU,CAAC;IACnB,OAAO,CAAC,EAAE,sBAAsB,CAAC;IACjC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,YAAY,CAAC;CAC5B,CAAC;AAEF,wBAAsB,OAAO,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC,CAkD7E;AAED,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,KAAK,CAwE/E;AAID,wBAAsB,UAAU,CAAC,OAAO,EAAE,OAAO,oCAMhD"}