microsoft-graph 1.0.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 (151) hide show
  1. package/.editorconfig +18 -0
  2. package/.gitattributes +46 -0
  3. package/.vscode/extensions.json +3 -0
  4. package/.vscode/launch.json +15 -0
  5. package/.vscode/settings.json +15 -0
  6. package/CONTRIBUTING.md +2 -0
  7. package/LICENCE.md +360 -0
  8. package/README.md +52 -0
  9. package/biome.jsonc +83 -0
  10. package/dist/errors/BadTemplateError.js +6 -0
  11. package/dist/errors/EnvironmentVariableMissingError.js +6 -0
  12. package/dist/errors/InvalidArgumentError.js +21 -0
  13. package/dist/errors/ProtocolError.js +11 -0
  14. package/dist/errors/RequestFailedError.js +21 -0
  15. package/dist/graphApi.js +116 -0
  16. package/dist/index.js +2 -0
  17. package/dist/models/AccessToken.js +1 -0
  18. package/dist/models/DriveId.js +1 -0
  19. package/dist/models/DriveItemId.js +1 -0
  20. package/dist/models/DriveItemPath.js +1 -0
  21. package/dist/models/DriveItemRef.js +1 -0
  22. package/dist/models/DriveRef.js +1 -0
  23. package/dist/models/GraphOperation.js +1 -0
  24. package/dist/models/GraphOperationDefinition.js +1 -0
  25. package/dist/models/HostName.js +1 -0
  26. package/dist/models/Scope.js +1 -0
  27. package/dist/models/SiteId.js +1 -0
  28. package/dist/models/SiteName.js +1 -0
  29. package/dist/models/SiteRef.js +1 -0
  30. package/dist/models/WorkbookNamedRangeRef.js +1 -0
  31. package/dist/models/WorkbookRangeAddress.js +1 -0
  32. package/dist/models/WorkbookRangeName.js +1 -0
  33. package/dist/models/WorkbookRangeRef.js +1 -0
  34. package/dist/models/WorkbookRef.js +1 -0
  35. package/dist/models/WorkbookSessionId.js +1 -0
  36. package/dist/models/WorkbookTableId.js +1 -0
  37. package/dist/models/WorkbookTableRef.js +1 -0
  38. package/dist/models/WorkbookWorksheetId.js +1 -0
  39. package/dist/models/WorkbookWorksheetName.js +1 -0
  40. package/dist/models/WorkbookWorksheetRef.js +1 -0
  41. package/dist/operations/drive/createFolder.js +27 -0
  42. package/dist/operations/drive/createFolder.test.js +31 -0
  43. package/dist/operations/drive/listDrives.js +23 -0
  44. package/dist/operations/drive/listDrives.test.js +9 -0
  45. package/dist/operations/driveItem/copyDriveItem.js +21 -0
  46. package/dist/operations/driveItem/copyDriveItem.test.js +28 -0
  47. package/dist/operations/driveItem/deleteDriveItem.js +12 -0
  48. package/dist/operations/driveItem/deleteDriveItem.test.js +22 -0
  49. package/dist/operations/driveItem/getDriveItem.js +18 -0
  50. package/dist/operations/driveItem/getDriveItem.test.js +24 -0
  51. package/dist/operations/driveItem/getDriveItemByPath.js +20 -0
  52. package/dist/operations/driveItem/getDriveItemByPath.test.js +22 -0
  53. package/dist/operations/driveItem/getDriveItemContent.js +22 -0
  54. package/dist/operations/driveItem/getDriveItemContent.test.js +37 -0
  55. package/dist/operations/driveItem/listDriveItems.js +25 -0
  56. package/dist/operations/driveItem/listDriveItems.test.js +24 -0
  57. package/dist/operations/site/getSite.js +18 -0
  58. package/dist/operations/site/getSite.test.js +15 -0
  59. package/dist/operations/site/getSiteByName.js +20 -0
  60. package/dist/operations/site/getSiteByName.test.js +20 -0
  61. package/dist/operations/site/listSites.js +23 -0
  62. package/dist/operations/site/listSites.test.js +10 -0
  63. package/dist/operations/site/searchSites.js +23 -0
  64. package/dist/operations/site/searchSites.test.js +21 -0
  65. package/dist/operations/workbook/calculateWorkbook.js +20 -0
  66. package/dist/operations/workbook/calculateWorkbook.test.js +46 -0
  67. package/dist/operations/workbook/createWorkbook.js +26 -0
  68. package/dist/operations/workbook/createWorkbook.test.js +15 -0
  69. package/dist/operations/workbook/deleteWorkbook.js +5 -0
  70. package/dist/operations/workbookRange/clearWorkbookRange.js +17 -0
  71. package/dist/operations/workbookRange/clearWorkbookRange.test.js +56 -0
  72. package/dist/operations/workbookRange/deleteWorkbookRange.js +17 -0
  73. package/dist/operations/workbookRange/deleteWorkbookRange.test.js +56 -0
  74. package/dist/operations/workbookRange/getWorkbookNamedRange.js +20 -0
  75. package/dist/operations/workbookRange/getWorkbookUsedRange.js +22 -0
  76. package/dist/operations/workbookRange/getWorkbookUsedRange.test.js +54 -0
  77. package/dist/operations/workbookRange/getWorkbookVisibleRange.js +20 -0
  78. package/dist/operations/workbookRange/getWorkbookVisibleRange.test.js +109 -0
  79. package/dist/operations/workbookRange/insertWorkbookCells.js +25 -0
  80. package/dist/operations/workbookRange/insertWorkbookCells.test.js +41 -0
  81. package/dist/operations/workbookRange/updateWorkbookNamedRange.js +15 -0
  82. package/dist/operations/workbookRange/updateWorkbookRange.js +21 -0
  83. package/dist/operations/workbookRange/updateWorkbookRange.test.js +54 -0
  84. package/dist/operations/workbookSession/closeWorkbookSession.js +18 -0
  85. package/dist/operations/workbookSession/createWorkbookSession.js +22 -0
  86. package/dist/operations/workbookSession/refreshWorkbookSession.js +19 -0
  87. package/dist/operations/workbookTable/createWorkbookTable.js +26 -0
  88. package/dist/operations/workbookTable/createWorkbookTable.test.js +25 -0
  89. package/dist/operations/workbookTable/getWorkbookTable.js +20 -0
  90. package/dist/operations/workbookTable/getWorkbookTable.test.js +30 -0
  91. package/dist/operations/workbookTable/getWorkbookTableBodyRange.js +22 -0
  92. package/dist/operations/workbookTable/getWorkbookTableBodyRange.test.js +45 -0
  93. package/dist/operations/workbookTable/getWorkbookTableHeaderRange.js +22 -0
  94. package/dist/operations/workbookTable/getWorkbookTableHeaderRange.test.js +41 -0
  95. package/dist/operations/workbookTable/listWorkbookTableColumns.js +17 -0
  96. package/dist/operations/workbookTable/listWorkbookTableColumns.test.js +29 -0
  97. package/dist/operations/workbookTable/listWorkbookTableRows.js +17 -0
  98. package/dist/operations/workbookTable/listWorkbookTableRows.test.js +29 -0
  99. package/dist/operations/workbookTable/listWorkbookTables.js +25 -0
  100. package/dist/operations/workbookTable/listWorkbookTables.test.js +30 -0
  101. package/dist/operations/workbookWorksheet/createWorkbookWorksheet.js +25 -0
  102. package/dist/operations/workbookWorksheet/createWorkbookWorksheet.test.js +36 -0
  103. package/dist/operations/workbookWorksheet/deleteWorkbookWorksheet.js +14 -0
  104. package/dist/operations/workbookWorksheet/deleteWorkbookWorksheet.test.js +28 -0
  105. package/dist/operations/workbookWorksheet/getWorkbookWorksheetRange.js +20 -0
  106. package/dist/operations/workbookWorksheet/getWorkbookWorksheetRange.test.js +30 -0
  107. package/dist/operations/workbookWorksheet/listWorkbookWorksheets.js +28 -0
  108. package/dist/operations/workbookWorksheet/listWorkbookWorksheets.test.js +45 -0
  109. package/dist/operations/workbookWorksheet/updateWorkbookWorksheet.js +21 -0
  110. package/dist/operations/workbookWorksheet/updateWorkbookWorksheet.test.js +37 -0
  111. package/dist/services/accessToken.js +15 -0
  112. package/dist/services/address.js +3 -0
  113. package/dist/services/configuration.js +20 -0
  114. package/dist/services/drive.js +17 -0
  115. package/dist/services/driveItem.js +48 -0
  116. package/dist/services/driveItem.test.js +17 -0
  117. package/dist/services/httpAgent.js +9 -0
  118. package/dist/services/httpStatus.js +3 -0
  119. package/dist/services/operationId.js +6 -0
  120. package/dist/services/sharepointUrl.js +24 -0
  121. package/dist/services/sharepointUrl.test.js +32 -0
  122. package/dist/services/site.js +15 -0
  123. package/dist/services/sleep.js +3 -0
  124. package/dist/services/stringCaseConversion.js +5 -0
  125. package/dist/services/stringCaseConversion.test.js +16 -0
  126. package/dist/services/templatedPaths.js +20 -0
  127. package/dist/services/templatedPaths.test.js +49 -0
  128. package/dist/services/temporaryFiles.js +11 -0
  129. package/dist/services/workbookRange.js +10 -0
  130. package/dist/services/workbookRangeAddress.js +8 -0
  131. package/dist/services/workbookTable.js +13 -0
  132. package/dist/services/workbookWorksheet.js +13 -0
  133. package/dist/tasks/createWorkbookAndStartSession.js +10 -0
  134. package/dist/tasks/deleteDriveItemWithRetry.js +16 -0
  135. package/dist/tasks/downloadDriveItemContent.js +7 -0
  136. package/dist/tasks/endSessionAndDeleteWorkbook.js +6 -0
  137. package/dist/tasks/getRangeLastUsedCell.js +38 -0
  138. package/dist/tasks/getRangeLastUsedCell.test.js +89 -0
  139. package/dist/tasks/getWorkbookTableVisibleBody.js +24 -0
  140. package/dist/tasks/getWorkbookTableVisibleBody.test.js +104 -0
  141. package/dist/tasks/getWorkbookWorksheetRefByName.js +10 -0
  142. package/dist/tasks/setColumnHidden.js +7 -0
  143. package/dist/tasks/setColumnHidden.test.js +43 -0
  144. package/dist/tasks/setRowHidden.js +7 -0
  145. package/dist/tasks/setRowHidden.test.js +42 -0
  146. package/docs/approach.md +7 -0
  147. package/docs/calculateWorkbook.md +20 -0
  148. package/docs/concepts.md +4 -0
  149. package/docs/envs.md +11 -0
  150. package/docs/performance.md +24 -0
  151. package/package.json +426 -0
package/.editorconfig ADDED
@@ -0,0 +1,18 @@
1
+ root = true
2
+
3
+ [*]
4
+
5
+ [*.{ts,tsx,js,jsx}]
6
+ charset = utf-8
7
+ indent_style = tab
8
+ indent_size = 2
9
+ insert_final_newline = true
10
+ trim_trailing_whitespace = true
11
+ max_line_length = 320
12
+
13
+ [*.md]
14
+ # Keep markdown files readable, don’t trim trailing whitespace (needed for line breaks)
15
+ trim_trailing_whitespace = false
16
+
17
+ [Makefile]
18
+ indent_style = tab
package/.gitattributes ADDED
@@ -0,0 +1,46 @@
1
+ # Set default behavior to automatically normalize line endings
2
+ * text=auto eol=lf
3
+
4
+ # Force batch scripts to use CRLF
5
+ *.{cmd,[cC][mM][dD]} text eol=crlf
6
+ *.{bat,[bB][aA][tT]} text eol=crlf
7
+
8
+ # Force bash scripts to use LF
9
+ *.sh text eol=lf
10
+
11
+ # Binary files should not be modified
12
+ *.png binary
13
+ *.jpg binary
14
+ *.jpeg binary
15
+ *.gif binary
16
+ *.ico binary
17
+ *.mov binary
18
+ *.mp4 binary
19
+ *.mp3 binary
20
+ *.ttf binary
21
+ *.otf binary
22
+ *.woff binary
23
+ *.woff2 binary
24
+ *.eot binary
25
+ *.gz binary
26
+ *.zip binary
27
+ *.7z binary
28
+ *.pdf binary
29
+
30
+ # Source code
31
+ *.css text diff=css
32
+ *.htm text diff=html
33
+ *.html text diff=html
34
+ *.js text
35
+ *.json text
36
+ *.jsx text
37
+ *.ts text
38
+ *.tsx text
39
+ *.xml text
40
+ *.yaml text
41
+ *.yml text
42
+
43
+ # Documentation
44
+ *.md text diff=markdown
45
+ *.txt text
46
+ *.sql text
@@ -0,0 +1,3 @@
1
+ {
2
+ "recommendations": ["usernamehw.errorlens", "biomejs.biome"]
3
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "version": "0.2.0",
3
+ "configurations": [
4
+ {
5
+ "type": "node",
6
+ "request": "launch",
7
+ "name": "Run",
8
+ "runtimeExecutable": "npx",
9
+ "runtimeArgs": ["tsx", "demo/index.ts"],
10
+ "cwd": "${workspaceFolder}",
11
+ "skipFiles": ["<node_internals>/**"],
12
+ "autoAttachChildProcesses": true
13
+ }
14
+ ]
15
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "editor.codeActionsOnSave": {
3
+ "source.organizeImports": "explicit",
4
+ "source.addMissingImports":"explicit",
5
+ "source.fixAll": "explicit",
6
+ },
7
+ "editor.formatOnSave": true,
8
+ "[typescript]": {
9
+ "editor.defaultFormatter": "vscode.typescript-language-features"
10
+ },
11
+ "cSpell.words": [
12
+ "Entra",
13
+ "msgraph"
14
+ ],
15
+ }
@@ -0,0 +1,2 @@
1
+ # Contributing
2
+ This SDK does not yet cover 100% of GraphAPI's functionality and will need to be expanded as new requirement arise. If you have one of these new requirements you can either create a new [issue](https://github.com/Future-Secure-AI/microsoft-graph/issues) and the desired requirement will be addressed in order of priority OR feel free to raise a pull request adding the functionality yourself. If you take the latter path make sure you strictly follow the existing patterns set. It's super important that new functionality follows the established patterns so the team knows how to expect the functionality to operate.
package/LICENCE.md ADDED
@@ -0,0 +1,360 @@
1
+ Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International
2
+ Public License
3
+
4
+ By exercising the Licensed Rights (defined below), You accept and agree
5
+ to be bound by the terms and conditions of this Creative Commons
6
+ Attribution-NonCommercial-ShareAlike 4.0 International Public License
7
+ ("Public License"). To the extent this Public License may be
8
+ interpreted as a contract, You are granted the Licensed Rights in
9
+ consideration of Your acceptance of these terms and conditions, and the
10
+ Licensor grants You such rights in consideration of benefits the
11
+ Licensor receives from making the Licensed Material available under
12
+ these terms and conditions.
13
+
14
+
15
+ Section 1 -- Definitions.
16
+
17
+ a. Adapted Material means material subject to Copyright and Similar
18
+ Rights that is derived from or based upon the Licensed Material
19
+ and in which the Licensed Material is translated, altered,
20
+ arranged, transformed, or otherwise modified in a manner requiring
21
+ permission under the Copyright and Similar Rights held by the
22
+ Licensor. For purposes of this Public License, where the Licensed
23
+ Material is a musical work, performance, or sound recording,
24
+ Adapted Material is always produced where the Licensed Material is
25
+ synched in timed relation with a moving image.
26
+
27
+ b. Adapter's License means the license You apply to Your Copyright
28
+ and Similar Rights in Your contributions to Adapted Material in
29
+ accordance with the terms and conditions of this Public License.
30
+
31
+ c. BY-NC-SA Compatible License means a license listed at
32
+ creativecommons.org/compatiblelicenses, approved by Creative
33
+ Commons as essentially the equivalent of this Public License.
34
+
35
+ d. Copyright and Similar Rights means copyright and/or similar rights
36
+ closely related to copyright including, without limitation,
37
+ performance, broadcast, sound recording, and Sui Generis Database
38
+ Rights, without regard to how the rights are labeled or
39
+ categorized. For purposes of this Public License, the rights
40
+ specified in Section 2(b)(1)-(2) are not Copyright and Similar
41
+ Rights.
42
+
43
+ e. Effective Technological Measures means those measures that, in the
44
+ absence of proper authority, may not be circumvented under laws
45
+ fulfilling obligations under Article 11 of the WIPO Copyright
46
+ Treaty adopted on December 20, 1996, and/or similar international
47
+ agreements.
48
+
49
+ f. Exceptions and Limitations means fair use, fair dealing, and/or
50
+ any other exception or limitation to Copyright and Similar Rights
51
+ that applies to Your use of the Licensed Material.
52
+
53
+ g. License Elements means the license attributes listed in the name
54
+ of a Creative Commons Public License. The License Elements of this
55
+ Public License are Attribution, NonCommercial, and ShareAlike.
56
+
57
+ h. Licensed Material means the artistic or literary work, database,
58
+ or other material to which the Licensor applied this Public
59
+ License.
60
+
61
+ i. Licensed Rights means the rights granted to You subject to the
62
+ terms and conditions of this Public License, which are limited to
63
+ all Copyright and Similar Rights that apply to Your use of the
64
+ Licensed Material and that the Licensor has authority to license.
65
+
66
+ j. Licensor means the individual(s) or entity(ies) granting rights
67
+ under this Public License.
68
+
69
+ k. NonCommercial means not primarily intended for or directed towards
70
+ commercial advantage or monetary compensation. For purposes of
71
+ this Public License, the exchange of the Licensed Material for
72
+ other material subject to Copyright and Similar Rights by digital
73
+ file-sharing or similar means is NonCommercial provided there is
74
+ no payment of monetary compensation in connection with the
75
+ exchange.
76
+
77
+ l. Share means to provide material to the public by any means or
78
+ process that requires permission under the Licensed Rights, such
79
+ as reproduction, public display, public performance, distribution,
80
+ dissemination, communication, or importation, and to make material
81
+ available to the public including in ways that members of the
82
+ public may access the material from a place and at a time
83
+ individually chosen by them.
84
+
85
+ m. Sui Generis Database Rights means rights other than copyright
86
+ resulting from Directive 96/9/EC of the European Parliament and of
87
+ the Council of 11 March 1996 on the legal protection of databases,
88
+ as amended and/or succeeded, as well as other essentially
89
+ equivalent rights anywhere in the world.
90
+
91
+ n. You means the individual or entity exercising the Licensed Rights
92
+ under this Public License. Your has a corresponding meaning.
93
+
94
+
95
+ Section 2 -- Scope.
96
+
97
+ a. License grant.
98
+
99
+ 1. Subject to the terms and conditions of this Public License,
100
+ the Licensor hereby grants You a worldwide, royalty-free,
101
+ non-sublicensable, non-exclusive, irrevocable license to
102
+ exercise the Licensed Rights in the Licensed Material to:
103
+
104
+ a. reproduce and Share the Licensed Material, in whole or
105
+ in part, for NonCommercial purposes only; and
106
+
107
+ b. produce, reproduce, and Share Adapted Material for
108
+ NonCommercial purposes only.
109
+
110
+ 2. Exceptions and Limitations. For the avoidance of doubt, where
111
+ Exceptions and Limitations apply to Your use, this Public
112
+ License does not apply, and You do not need to comply with
113
+ its terms and conditions.
114
+
115
+ 3. Term. The term of this Public License is specified in Section
116
+ 6(a).
117
+
118
+ 4. Media and formats; technical modifications allowed. The
119
+ Licensor authorizes You to exercise the Licensed Rights in
120
+ all media and formats whether now known or hereafter created,
121
+ and to make technical modifications necessary to do so. The
122
+ Licensor waives and/or agrees not to assert any right or
123
+ authority to forbid You from making technical modifications
124
+ necessary to exercise the Licensed Rights, including
125
+ technical modifications necessary to circumvent Effective
126
+ Technological Measures. For purposes of this Public License,
127
+ simply making modifications authorized by this Section 2(a)
128
+ (4) never produces Adapted Material.
129
+
130
+ 5. Downstream recipients.
131
+
132
+ a. Offer from the Licensor -- Licensed Material. Every
133
+ recipient of the Licensed Material automatically
134
+ receives an offer from the Licensor to exercise the
135
+ Licensed Rights under the terms and conditions of this
136
+ Public License.
137
+
138
+ b. Additional offer from the Licensor -- Adapted Material.
139
+ Every recipient of Adapted Material from You
140
+ automatically receives an offer from the Licensor to
141
+ exercise the Licensed Rights in the Adapted Material
142
+ under the conditions of the Adapter's License You apply.
143
+
144
+ c. No downstream restrictions. You may not offer or impose
145
+ any additional or different terms or conditions on, or
146
+ apply any Effective Technological Measures to, the
147
+ Licensed Material if doing so restricts exercise of the
148
+ Licensed Rights by any recipient of the Licensed
149
+ Material.
150
+
151
+ 6. No endorsement. Nothing in this Public License constitutes or
152
+ may be construed as permission to assert or imply that You
153
+ are, or that Your use of the Licensed Material is, connected
154
+ with, or sponsored, endorsed, or granted official status by,
155
+ the Licensor or others designated to receive attribution as
156
+ provided in Section 3(a)(1)(A)(i).
157
+
158
+ b. Other rights.
159
+
160
+ 1. Moral rights, such as the right of integrity, are not
161
+ licensed under this Public License, nor are publicity,
162
+ privacy, and/or other similar personality rights; however, to
163
+ the extent possible, the Licensor waives and/or agrees not to
164
+ assert any such rights held by the Licensor to the limited
165
+ extent necessary to allow You to exercise the Licensed
166
+ Rights, but not otherwise.
167
+
168
+ 2. Patent and trademark rights are not licensed under this
169
+ Public License.
170
+
171
+ 3. To the extent possible, the Licensor waives any right to
172
+ collect royalties from You for the exercise of the Licensed
173
+ Rights, whether directly or through a collecting society
174
+ under any voluntary or waivable statutory or compulsory
175
+ licensing scheme. In all other cases the Licensor expressly
176
+ reserves any right to collect such royalties, including when
177
+ the Licensed Material is used other than for NonCommercial
178
+ purposes.
179
+
180
+
181
+ Section 3 -- License Conditions.
182
+
183
+ Your exercise of the Licensed Rights is expressly made subject to the
184
+ following conditions.
185
+
186
+ a. Attribution.
187
+
188
+ 1. If You Share the Licensed Material (including in modified
189
+ form), You must:
190
+
191
+ a. retain the following if it is supplied by the Licensor
192
+ with the Licensed Material:
193
+
194
+ i. identification of the creator(s) of the Licensed
195
+ Material and any others designated to receive
196
+ attribution, in any reasonable manner requested by
197
+ the Licensor (including by pseudonym if
198
+ designated);
199
+
200
+ ii. a copyright notice;
201
+
202
+ iii. a notice that refers to this Public License;
203
+
204
+ iv. a notice that refers to the disclaimer of
205
+ warranties;
206
+
207
+ v. a URI or hyperlink to the Licensed Material to the
208
+ extent reasonably practicable;
209
+
210
+ b. indicate if You modified the Licensed Material and
211
+ retain an indication of any previous modifications; and
212
+
213
+ c. indicate the Licensed Material is licensed under this
214
+ Public License, and include the text of, or the URI or
215
+ hyperlink to, this Public License.
216
+
217
+ 2. You may satisfy the conditions in Section 3(a)(1) in any
218
+ reasonable manner based on the medium, means, and context in
219
+ which You Share the Licensed Material. For example, it may be
220
+ reasonable to satisfy the conditions by providing a URI or
221
+ hyperlink to a resource that includes the required
222
+ information.
223
+ 3. If requested by the Licensor, You must remove any of the
224
+ information required by Section 3(a)(1)(A) to the extent
225
+ reasonably practicable.
226
+
227
+ b. ShareAlike.
228
+
229
+ In addition to the conditions in Section 3(a), if You Share
230
+ Adapted Material You produce, the following conditions also apply.
231
+
232
+ 1. The Adapter's License You apply must be a Creative Commons
233
+ license with the same License Elements, this version or
234
+ later, or a BY-NC-SA Compatible License.
235
+
236
+ 2. You must include the text of, or the URI or hyperlink to, the
237
+ Adapter's License You apply. You may satisfy this condition
238
+ in any reasonable manner based on the medium, means, and
239
+ context in which You Share Adapted Material.
240
+
241
+ 3. You may not offer or impose any additional or different terms
242
+ or conditions on, or apply any Effective Technological
243
+ Measures to, Adapted Material that restrict exercise of the
244
+ rights granted under the Adapter's License You apply.
245
+
246
+
247
+ Section 4 -- Sui Generis Database Rights.
248
+
249
+ Where the Licensed Rights include Sui Generis Database Rights that
250
+ apply to Your use of the Licensed Material:
251
+
252
+ a. for the avoidance of doubt, Section 2(a)(1) grants You the right
253
+ to extract, reuse, reproduce, and Share all or a substantial
254
+ portion of the contents of the database for NonCommercial purposes
255
+ only;
256
+
257
+ b. if You include all or a substantial portion of the database
258
+ contents in a database in which You have Sui Generis Database
259
+ Rights, then the database in which You have Sui Generis Database
260
+ Rights (but not its individual contents) is Adapted Material,
261
+ including for purposes of Section 3(b); and
262
+
263
+ c. You must comply with the conditions in Section 3(a) if You Share
264
+ all or a substantial portion of the contents of the database.
265
+
266
+ For the avoidance of doubt, this Section 4 supplements and does not
267
+ replace Your obligations under this Public License where the Licensed
268
+ Rights include other Copyright and Similar Rights.
269
+
270
+
271
+ Section 5 -- Disclaimer of Warranties and Limitation of Liability.
272
+
273
+ a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
274
+ EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
275
+ AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
276
+ ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
277
+ IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
278
+ WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
279
+ PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
280
+ ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
281
+ KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
282
+ ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
283
+
284
+ b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
285
+ TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
286
+ NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
287
+ INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
288
+ COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
289
+ USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
290
+ ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
291
+ DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
292
+ IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
293
+
294
+ c. The disclaimer of warranties and limitation of liability provided
295
+ above shall be interpreted in a manner that, to the extent
296
+ possible, most closely approximates an absolute disclaimer and
297
+ waiver of all liability.
298
+
299
+
300
+ Section 6 -- Term and Termination.
301
+
302
+ a. This Public License applies for the term of the Copyright and
303
+ Similar Rights licensed here. However, if You fail to comply with
304
+ this Public License, then Your rights under this Public License
305
+ terminate automatically.
306
+
307
+ b. Where Your right to use the Licensed Material has terminated under
308
+ Section 6(a), it reinstates:
309
+
310
+ 1. automatically as of the date the violation is cured, provided
311
+ it is cured within 30 days of Your discovery of the
312
+ violation; or
313
+
314
+ 2. upon express reinstatement by the Licensor.
315
+
316
+ For the avoidance of doubt, this Section 6(b) does not affect any
317
+ right the Licensor may have to seek remedies for Your violations
318
+ of this Public License.
319
+
320
+ c. For the avoidance of doubt, the Licensor may also offer the
321
+ Licensed Material under separate terms or conditions or stop
322
+ distributing the Licensed Material at any time; however, doing so
323
+ will not terminate this Public License.
324
+
325
+ d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
326
+ License.
327
+
328
+
329
+ Section 7 -- Other Terms and Conditions.
330
+
331
+ a. The Licensor shall not be bound by any additional or different
332
+ terms or conditions communicated by You unless expressly agreed.
333
+
334
+ b. Any arrangements, understandings, or agreements regarding the
335
+ Licensed Material not stated herein are separate from and
336
+ independent of the terms and conditions of this Public License.
337
+
338
+
339
+ Section 8 -- Interpretation.
340
+
341
+ a. For the avoidance of doubt, this Public License does not, and
342
+ shall not be interpreted to, reduce, limit, restrict, or impose
343
+ conditions on any use of the Licensed Material that could lawfully
344
+ be made without permission under this Public License.
345
+
346
+ b. To the extent possible, if any provision of this Public License is
347
+ deemed unenforceable, it shall be automatically reformed to the
348
+ minimum extent necessary to make it enforceable. If the provision
349
+ cannot be reformed, it shall be severed from this Public License
350
+ without affecting the enforceability of the remaining terms and
351
+ conditions.
352
+
353
+ c. No term or condition of this Public License will be waived and no
354
+ failure to comply consented to unless expressly agreed to by the
355
+ Licensor.
356
+
357
+ d. Nothing in this Public License constitutes or may be interpreted
358
+ as a limitation upon, or waiver of, any privileges and immunities
359
+ that apply to the Licensor or You, including from the legal
360
+ processes of any jurisdiction or authority.
package/README.md ADDED
@@ -0,0 +1,52 @@
1
+ # Microsoft Graph SDK
2
+ ## Overview
3
+ This is an extensible library that allows access to Microsoft's GraphAPI, including (but not only) Sharepoint's API. It currently supports the most common operations, with more being added over time.
4
+
5
+
6
+ ## Usage
7
+ First up, make sure the environment variables `AZURE_TENANT_ID`, `AZURE_CLIENT_ID`, `AZURE_CLIENT_SECRET` and [any others you require](docs/envs.md) are set. Then make calls:
8
+
9
+ ### List drives
10
+ ```typescript
11
+ for (const drive of await listDrives()) {
12
+ console.log(drive.name);
13
+ }
14
+ ```
15
+
16
+ ### List files
17
+ ```typescript
18
+ for (const item of await listDriveItems()) {
19
+ console.log(item.name);
20
+ }
21
+ ```
22
+
23
+ ### Getting a used range
24
+ ```typescript
25
+ const range = await getWorkbookUsedRange({
26
+ siteId: args.siteId,
27
+ driveId: args.driveId,
28
+ itemId: args.itemId,
29
+ worksheetId: args.worksheetId,
30
+ });
31
+ ```
32
+
33
+ ### Updating a range
34
+ ```typescript
35
+ await updateWorkbookRange(range, {
36
+ values: [
37
+ [1, 2],
38
+ [3, 4]
39
+ ]
40
+ });
41
+ ```
42
+
43
+ From here, have a look at:
44
+ * [`/doc`](https://github.com/Future-Secure-AI/microsoft-graph/tree/main/doc) for more general documentation and advice.
45
+ * [`/src/operations`](https://github.com/Future-Secure-AI/microsoft-graph/tree/main/src/operations) for other supported GraphAPI operations.
46
+ * [`/src/tasks`](https://github.com/Future-Secure-AI/microsoft-graph/tree/main/src/tasks) for supported tasks that make use of multiple operations.
47
+ * [`/src/services`](https://github.com/Future-Secure-AI/microsoft-graph/tree/main/src/services) for a bunch of helpers that make life generally easier.
48
+
49
+ That's it!
50
+
51
+ ## Extension
52
+ If you require more operations you can either raise an [issue](https://github.com/Future-Secure-AI/microsoft-graph/issues), or [raise a pull-request](CONTRIBUTING.md).
package/biome.jsonc ADDED
@@ -0,0 +1,83 @@
1
+ {
2
+ "$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
3
+ "vcs": {
4
+ "enabled": true,
5
+ "clientKind": "git",
6
+ "useIgnoreFile": true,
7
+ "defaultBranch": "main"
8
+ },
9
+ "files": {
10
+ "ignoreUnknown": true,
11
+ "include": ["src/*.ts"],
12
+ "maxSize": 2097152 // 2MB to cover generated models
13
+ },
14
+ "formatter": {
15
+ "enabled": false
16
+ },
17
+ "organizeImports": {
18
+ "enabled": false // VSCode and Biome organize imports differently
19
+ },
20
+ "linter": {
21
+ "enabled": true,
22
+ "rules": {
23
+ "all": true
24
+ },
25
+ "include": ["src/*.ts"]
26
+ },
27
+ "javascript": {
28
+ "globals": ["exports"]
29
+ },
30
+ "overrides": [
31
+ {
32
+ "include": ["*.ts"],
33
+ "linter":{
34
+ "rules": {
35
+ "correctness":{
36
+ "noNodejsModules": "off"
37
+ }
38
+ }
39
+ }
40
+ },
41
+ {
42
+ "include": ["*.test.ts"],
43
+ "linter":{
44
+ "rules": {
45
+ "suspicious":{
46
+ "noConsole": "off"
47
+ }
48
+ }
49
+ }
50
+ },
51
+ {
52
+ "include": ["src/operations/*.ts", "src/errors/*.ts", "src/tasks/*.ts"],
53
+ "linter":{
54
+ "rules": {
55
+ "style":{
56
+ "noDefaultExport": "off"
57
+ }
58
+ }
59
+ }
60
+ },
61
+ {
62
+ "include": ["src/models/Dto.d.ts"],
63
+ "linter": {
64
+ "rules": {
65
+ "style": {
66
+ "useNamingConvention": "off",
67
+ "noNamespace": "off",
68
+ "useFilenamingConvention": "off"
69
+ },
70
+ "correctness": {
71
+ "noUnusedVariables": "off"
72
+ },
73
+ "complexity":{
74
+ "noBannedTypes": "off"
75
+ },
76
+ "suspicious": {
77
+ "noEmptyInterface": "off"
78
+ }
79
+ }
80
+ }
81
+ }
82
+ ]
83
+ }
@@ -0,0 +1,6 @@
1
+ export default class BadTemplateError extends Error {
2
+ constructor(message) {
3
+ super(message);
4
+ this.name = "BadTemplateError";
5
+ }
6
+ }
@@ -0,0 +1,6 @@
1
+ export default class EnvironmentVariableMissingError extends Error {
2
+ constructor(env) {
3
+ super(`Environment variable '${env}' is not set, empty or whitespace.`);
4
+ this.name = "EnvironmentVariableMissingError";
5
+ }
6
+ }
@@ -0,0 +1,21 @@
1
+ export default class InvalidArgumentError extends Error {
2
+ constructor(message) {
3
+ super(message);
4
+ this.name = "InvalidArgumentError";
5
+ }
6
+ static throwIfOutside(value, min, max, message) {
7
+ if (value < min || value > max) {
8
+ throw new InvalidArgumentError(message);
9
+ }
10
+ }
11
+ static throwIfGreater(value, max, message) {
12
+ if (value > max) {
13
+ throw new InvalidArgumentError(message);
14
+ }
15
+ }
16
+ static throwIfFalsy(value, message) {
17
+ if (!value) {
18
+ throw new InvalidArgumentError(message);
19
+ }
20
+ }
21
+ }
@@ -0,0 +1,11 @@
1
+ export default class ProtocolError extends Error {
2
+ constructor(message) {
3
+ super(message);
4
+ this.name = "ProtocolError";
5
+ }
6
+ static throwIfFalsy(value, message) {
7
+ if (!value) {
8
+ throw new ProtocolError(message);
9
+ }
10
+ }
11
+ }
@@ -0,0 +1,21 @@
1
+ import { isHttpOk } from "../services/httpStatus.js";
2
+ export default class RequestFailedError extends Error {
3
+ constructor(message) {
4
+ super(message);
5
+ this.name = "RequestFailedError";
6
+ }
7
+ static throwIfNotOkBatch(status, ops, error) {
8
+ if (!isHttpOk(status)) {
9
+ throw new RequestFailedError(`GraphAPI batch failed with HTTP ${status}\n` +
10
+ `Operation: ${JSON.stringify(ops, null, 2)}\n` +
11
+ `Error: ${JSON.stringify(error, null, 2)}}`);
12
+ }
13
+ }
14
+ static throwIfNotOkOperation(status, index, op, error) {
15
+ if (!isHttpOk(status)) {
16
+ throw new RequestFailedError(`GraphAPI operation ${index} failed with HTTP ${status}\n` +
17
+ `Operation: ${JSON.stringify(op, null, 2)}\n` +
18
+ `Error: ${JSON.stringify(error, null, 2)}}`);
19
+ }
20
+ }
21
+ }