box-node-sdk 3.8.1 → 3.8.2

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 (358) hide show
  1. package/lib-esm/api-request-manager.d.ts +36 -0
  2. package/lib-esm/api-request-manager.js +78 -0
  3. package/lib-esm/api-request-manager.js.map +1 -0
  4. package/lib-esm/api-request.d.ts +135 -0
  5. package/lib-esm/api-request.js +282 -0
  6. package/lib-esm/api-request.js.map +1 -0
  7. package/lib-esm/box-client.d.ts +274 -0
  8. package/lib-esm/box-client.js +594 -0
  9. package/lib-esm/box-client.js.map +1 -0
  10. package/lib-esm/box-node-sdk.d.ts +227 -0
  11. package/lib-esm/box-node-sdk.js +373 -0
  12. package/lib-esm/box-node-sdk.js.map +1 -0
  13. package/lib-esm/chunked-uploader.d.ts +128 -0
  14. package/lib-esm/chunked-uploader.js +276 -0
  15. package/lib-esm/chunked-uploader.js.map +1 -0
  16. package/lib-esm/enterprise-event-stream.d.ts +82 -0
  17. package/lib-esm/enterprise-event-stream.js +205 -0
  18. package/lib-esm/enterprise-event-stream.js.map +1 -0
  19. package/lib-esm/event-stream.d.ts +91 -0
  20. package/lib-esm/event-stream.js +277 -0
  21. package/lib-esm/event-stream.js.map +1 -0
  22. package/lib-esm/managers/ai.generated.d.ts +58 -0
  23. package/lib-esm/managers/ai.generated.js +66 -0
  24. package/lib-esm/managers/ai.generated.js.map +1 -0
  25. package/lib-esm/managers/collaboration-allowlist.d.ts +133 -0
  26. package/lib-esm/managers/collaboration-allowlist.js +194 -0
  27. package/lib-esm/managers/collaboration-allowlist.js.map +1 -0
  28. package/lib-esm/managers/collaborations.d.ts +173 -0
  29. package/lib-esm/managers/collaborations.js +252 -0
  30. package/lib-esm/managers/collaborations.js.map +1 -0
  31. package/lib-esm/managers/collections.d.ts +42 -0
  32. package/lib-esm/managers/collections.js +62 -0
  33. package/lib-esm/managers/collections.js.map +1 -0
  34. package/lib-esm/managers/comments.d.ts +103 -0
  35. package/lib-esm/managers/comments.js +175 -0
  36. package/lib-esm/managers/comments.js.map +1 -0
  37. package/lib-esm/managers/device-pins.d.ts +52 -0
  38. package/lib-esm/managers/device-pins.js +91 -0
  39. package/lib-esm/managers/device-pins.js.map +1 -0
  40. package/lib-esm/managers/enterprise.d.ts +164 -0
  41. package/lib-esm/managers/enterprise.js +193 -0
  42. package/lib-esm/managers/enterprise.js.map +1 -0
  43. package/lib-esm/managers/events.d.ts +222 -0
  44. package/lib-esm/managers/events.js +295 -0
  45. package/lib-esm/managers/events.js.map +1 -0
  46. package/lib-esm/managers/file-requests-manager.d.ts +56 -0
  47. package/lib-esm/managers/file-requests-manager.js +81 -0
  48. package/lib-esm/managers/file-requests-manager.js.map +1 -0
  49. package/lib-esm/managers/files.d.ts +817 -0
  50. package/lib-esm/managers/files.js +1408 -0
  51. package/lib-esm/managers/files.js.map +1 -0
  52. package/lib-esm/managers/folders.d.ts +396 -0
  53. package/lib-esm/managers/folders.js +570 -0
  54. package/lib-esm/managers/folders.js.map +1 -0
  55. package/lib-esm/managers/groups.d.ts +213 -0
  56. package/lib-esm/managers/groups.js +289 -0
  57. package/lib-esm/managers/groups.js.map +1 -0
  58. package/lib-esm/managers/integration-mappings.d.ts +116 -0
  59. package/lib-esm/managers/integration-mappings.js +101 -0
  60. package/lib-esm/managers/integration-mappings.js.map +1 -0
  61. package/lib-esm/managers/legal-hold-policies.d.ts +190 -0
  62. package/lib-esm/managers/legal-hold-policies.js +254 -0
  63. package/lib-esm/managers/legal-hold-policies.js.map +1 -0
  64. package/lib-esm/managers/metadata.d.ts +232 -0
  65. package/lib-esm/managers/metadata.js +288 -0
  66. package/lib-esm/managers/metadata.js.map +1 -0
  67. package/lib-esm/managers/recent-items.d.ts +38 -0
  68. package/lib-esm/managers/recent-items.js +49 -0
  69. package/lib-esm/managers/recent-items.js.map +1 -0
  70. package/lib-esm/managers/retention-policies.d.ts +308 -0
  71. package/lib-esm/managers/retention-policies.js +374 -0
  72. package/lib-esm/managers/retention-policies.js.map +1 -0
  73. package/lib-esm/managers/search.d.ts +82 -0
  74. package/lib-esm/managers/search.js +90 -0
  75. package/lib-esm/managers/search.js.map +1 -0
  76. package/lib-esm/managers/shared-items.d.ts +33 -0
  77. package/lib-esm/managers/shared-items.js +74 -0
  78. package/lib-esm/managers/shared-items.js.map +1 -0
  79. package/lib-esm/managers/shield-information-barrier-reports.generated.d.ts +65 -0
  80. package/lib-esm/managers/shield-information-barrier-reports.generated.js +65 -0
  81. package/lib-esm/managers/shield-information-barrier-reports.generated.js.map +1 -0
  82. package/lib-esm/managers/shield-information-barrier-segment-members.generated.d.ts +83 -0
  83. package/lib-esm/managers/shield-information-barrier-segment-members.generated.js +83 -0
  84. package/lib-esm/managers/shield-information-barrier-segment-members.generated.js.map +1 -0
  85. package/lib-esm/managers/shield-information-barrier-segment-restrictions.generated.d.ts +84 -0
  86. package/lib-esm/managers/shield-information-barrier-segment-restrictions.generated.js +84 -0
  87. package/lib-esm/managers/shield-information-barrier-segment-restrictions.generated.js.map +1 -0
  88. package/lib-esm/managers/shield-information-barrier-segments.generated.d.ts +98 -0
  89. package/lib-esm/managers/shield-information-barrier-segments.generated.js +99 -0
  90. package/lib-esm/managers/shield-information-barrier-segments.generated.js.map +1 -0
  91. package/lib-esm/managers/shield-information-barriers.generated.d.ts +79 -0
  92. package/lib-esm/managers/shield-information-barriers.generated.js +83 -0
  93. package/lib-esm/managers/shield-information-barriers.generated.js.map +1 -0
  94. package/lib-esm/managers/sign-requests.generated.d.ts +93 -0
  95. package/lib-esm/managers/sign-requests.generated.js +97 -0
  96. package/lib-esm/managers/sign-requests.generated.js.map +1 -0
  97. package/lib-esm/managers/sign-templates.generated.d.ts +51 -0
  98. package/lib-esm/managers/sign-templates.generated.js +49 -0
  99. package/lib-esm/managers/sign-templates.generated.js.map +1 -0
  100. package/lib-esm/managers/storage-policies.d.ts +86 -0
  101. package/lib-esm/managers/storage-policies.js +174 -0
  102. package/lib-esm/managers/storage-policies.js.map +1 -0
  103. package/lib-esm/managers/tasks.d.ts +161 -0
  104. package/lib-esm/managers/tasks.js +243 -0
  105. package/lib-esm/managers/tasks.js.map +1 -0
  106. package/lib-esm/managers/terms-of-service.d.ts +161 -0
  107. package/lib-esm/managers/terms-of-service.js +283 -0
  108. package/lib-esm/managers/terms-of-service.js.map +1 -0
  109. package/lib-esm/managers/trash.d.ts +30 -0
  110. package/lib-esm/managers/trash.js +47 -0
  111. package/lib-esm/managers/trash.js.map +1 -0
  112. package/lib-esm/managers/users.d.ts +171 -0
  113. package/lib-esm/managers/users.js +230 -0
  114. package/lib-esm/managers/users.js.map +1 -0
  115. package/lib-esm/managers/web-links.d.ts +127 -0
  116. package/lib-esm/managers/web-links.js +200 -0
  117. package/lib-esm/managers/web-links.js.map +1 -0
  118. package/lib-esm/managers/webhooks.d.ts +169 -0
  119. package/lib-esm/managers/webhooks.js +398 -0
  120. package/lib-esm/managers/webhooks.js.map +1 -0
  121. package/lib-esm/schemas/ai-agent-ask.generated.d.ts +17 -0
  122. package/lib-esm/schemas/ai-agent-ask.generated.js +3 -0
  123. package/lib-esm/schemas/ai-agent-ask.generated.js.map +1 -0
  124. package/lib-esm/schemas/ai-agent-basic-gen-tool.generated.d.ts +14 -0
  125. package/lib-esm/schemas/ai-agent-basic-gen-tool.generated.js +3 -0
  126. package/lib-esm/schemas/ai-agent-basic-gen-tool.generated.js.map +1 -0
  127. package/lib-esm/schemas/ai-agent-basic-text-tool-ask.generated.d.ts +34 -0
  128. package/lib-esm/schemas/ai-agent-basic-text-tool-ask.generated.js +3 -0
  129. package/lib-esm/schemas/ai-agent-basic-text-tool-ask.generated.js.map +1 -0
  130. package/lib-esm/schemas/ai-agent-basic-text-tool-text-gen.generated.d.ts +36 -0
  131. package/lib-esm/schemas/ai-agent-basic-text-tool-text-gen.generated.js +3 -0
  132. package/lib-esm/schemas/ai-agent-basic-text-tool-text-gen.generated.js.map +1 -0
  133. package/lib-esm/schemas/ai-agent-long-text-tool.generated.d.ts +9 -0
  134. package/lib-esm/schemas/ai-agent-long-text-tool.generated.js +3 -0
  135. package/lib-esm/schemas/ai-agent-long-text-tool.generated.js.map +1 -0
  136. package/lib-esm/schemas/ai-agent-text-gen.generated.d.ts +14 -0
  137. package/lib-esm/schemas/ai-agent-text-gen.generated.js +3 -0
  138. package/lib-esm/schemas/ai-agent-text-gen.generated.js.map +1 -0
  139. package/lib-esm/schemas/ai-ask.generated.d.ts +40 -0
  140. package/lib-esm/schemas/ai-ask.generated.js +3 -0
  141. package/lib-esm/schemas/ai-ask.generated.js.map +1 -0
  142. package/lib-esm/schemas/ai-citation.generated.d.ts +27 -0
  143. package/lib-esm/schemas/ai-citation.generated.js +3 -0
  144. package/lib-esm/schemas/ai-citation.generated.js.map +1 -0
  145. package/lib-esm/schemas/ai-dialogue-history.generated.d.ts +22 -0
  146. package/lib-esm/schemas/ai-dialogue-history.generated.js +3 -0
  147. package/lib-esm/schemas/ai-dialogue-history.generated.js.map +1 -0
  148. package/lib-esm/schemas/ai-llm-endpoint-params-google.generated.d.ts +31 -0
  149. package/lib-esm/schemas/ai-llm-endpoint-params-google.generated.js +3 -0
  150. package/lib-esm/schemas/ai-llm-endpoint-params-google.generated.js.map +1 -0
  151. package/lib-esm/schemas/ai-llm-endpoint-params-open-ai.generated.d.ts +43 -0
  152. package/lib-esm/schemas/ai-llm-endpoint-params-open-ai.generated.js +3 -0
  153. package/lib-esm/schemas/ai-llm-endpoint-params-open-ai.generated.js.map +1 -0
  154. package/lib-esm/schemas/ai-response-full.generated.d.ts +12 -0
  155. package/lib-esm/schemas/ai-response-full.generated.js +3 -0
  156. package/lib-esm/schemas/ai-response-full.generated.js.map +1 -0
  157. package/lib-esm/schemas/ai-response.generated.d.ts +22 -0
  158. package/lib-esm/schemas/ai-response.generated.js +3 -0
  159. package/lib-esm/schemas/ai-response.generated.js.map +1 -0
  160. package/lib-esm/schemas/ai-text-gen.generated.d.ts +30 -0
  161. package/lib-esm/schemas/ai-text-gen.generated.js +3 -0
  162. package/lib-esm/schemas/ai-text-gen.generated.js.map +1 -0
  163. package/lib-esm/schemas/collaboration-create.d.ts +5 -0
  164. package/lib-esm/schemas/collaboration-create.js +3 -0
  165. package/lib-esm/schemas/collaboration-create.js.map +1 -0
  166. package/lib-esm/schemas/collaboration-update.d.ts +7 -0
  167. package/lib-esm/schemas/collaboration-update.js +3 -0
  168. package/lib-esm/schemas/collaboration-update.js.map +1 -0
  169. package/lib-esm/schemas/collaboration.d.ts +108 -0
  170. package/lib-esm/schemas/collaboration.js +3 -0
  171. package/lib-esm/schemas/collaboration.js.map +1 -0
  172. package/lib-esm/schemas/collaborations.d.ts +13 -0
  173. package/lib-esm/schemas/collaborations.js +3 -0
  174. package/lib-esm/schemas/collaborations.js.map +1 -0
  175. package/lib-esm/schemas/enterprise-base.generated.d.ts +18 -0
  176. package/lib-esm/schemas/enterprise-base.generated.js +3 -0
  177. package/lib-esm/schemas/enterprise-base.generated.js.map +1 -0
  178. package/lib-esm/schemas/file-base.generated.d.ts +32 -0
  179. package/lib-esm/schemas/file-base.generated.js +3 -0
  180. package/lib-esm/schemas/file-base.generated.js.map +1 -0
  181. package/lib-esm/schemas/file-mini.generated.d.ts +41 -0
  182. package/lib-esm/schemas/file-mini.generated.js +3 -0
  183. package/lib-esm/schemas/file-mini.generated.js.map +1 -0
  184. package/lib-esm/schemas/file-request.d.ts +41 -0
  185. package/lib-esm/schemas/file-request.js +3 -0
  186. package/lib-esm/schemas/file-request.js.map +1 -0
  187. package/lib-esm/schemas/file-version-base.generated.d.ts +19 -0
  188. package/lib-esm/schemas/file-version-base.generated.js +3 -0
  189. package/lib-esm/schemas/file-version-base.generated.js.map +1 -0
  190. package/lib-esm/schemas/file-version-mini.generated.d.ts +14 -0
  191. package/lib-esm/schemas/file-version-mini.generated.js +3 -0
  192. package/lib-esm/schemas/file-version-mini.generated.js.map +1 -0
  193. package/lib-esm/schemas/folder-base.generated.d.ts +32 -0
  194. package/lib-esm/schemas/folder-base.generated.js +3 -0
  195. package/lib-esm/schemas/folder-base.generated.js.map +1 -0
  196. package/lib-esm/schemas/folder-mini.generated.d.ts +31 -0
  197. package/lib-esm/schemas/folder-mini.generated.js +3 -0
  198. package/lib-esm/schemas/folder-mini.generated.js.map +1 -0
  199. package/lib-esm/schemas/index.d.ts +15 -0
  200. package/lib-esm/schemas/index.generated.d.ts +52 -0
  201. package/lib-esm/schemas/index.generated.js +69 -0
  202. package/lib-esm/schemas/index.generated.js.map +1 -0
  203. package/lib-esm/schemas/index.js +32 -0
  204. package/lib-esm/schemas/index.js.map +1 -0
  205. package/lib-esm/schemas/integration-mapping-base.d.ts +23 -0
  206. package/lib-esm/schemas/integration-mapping-base.js +3 -0
  207. package/lib-esm/schemas/integration-mapping-base.js.map +1 -0
  208. package/lib-esm/schemas/integration-mapping-box-item-slack.d.ts +17 -0
  209. package/lib-esm/schemas/integration-mapping-box-item-slack.js +3 -0
  210. package/lib-esm/schemas/integration-mapping-box-item-slack.js.map +1 -0
  211. package/lib-esm/schemas/integration-mapping-partner-item-slack.d.ts +27 -0
  212. package/lib-esm/schemas/integration-mapping-partner-item-slack.js +3 -0
  213. package/lib-esm/schemas/integration-mapping-partner-item-slack.js.map +1 -0
  214. package/lib-esm/schemas/integration-mapping-slack-create-request.d.ts +12 -0
  215. package/lib-esm/schemas/integration-mapping-slack-create-request.js +3 -0
  216. package/lib-esm/schemas/integration-mapping-slack-create-request.js.map +1 -0
  217. package/lib-esm/schemas/integration-mapping-slack-options.d.ts +16 -0
  218. package/lib-esm/schemas/integration-mapping-slack-options.js +3 -0
  219. package/lib-esm/schemas/integration-mapping-slack-options.js.map +1 -0
  220. package/lib-esm/schemas/integration-mapping.d.ts +55 -0
  221. package/lib-esm/schemas/integration-mapping.js +3 -0
  222. package/lib-esm/schemas/integration-mapping.js.map +1 -0
  223. package/lib-esm/schemas/integration-mappings.d.ts +27 -0
  224. package/lib-esm/schemas/integration-mappings.js +3 -0
  225. package/lib-esm/schemas/integration-mappings.js.map +1 -0
  226. package/lib-esm/schemas/shield-information-barrier-base.generated.d.ts +18 -0
  227. package/lib-esm/schemas/shield-information-barrier-base.generated.js +3 -0
  228. package/lib-esm/schemas/shield-information-barrier-base.generated.js.map +1 -0
  229. package/lib-esm/schemas/shield-information-barrier-reference.generated.d.ts +9 -0
  230. package/lib-esm/schemas/shield-information-barrier-reference.generated.js +3 -0
  231. package/lib-esm/schemas/shield-information-barrier-reference.generated.js.map +1 -0
  232. package/lib-esm/schemas/shield-information-barrier-report-base.generated.d.ts +18 -0
  233. package/lib-esm/schemas/shield-information-barrier-report-base.generated.js +3 -0
  234. package/lib-esm/schemas/shield-information-barrier-report-base.generated.js.map +1 -0
  235. package/lib-esm/schemas/shield-information-barrier-report-details.generated.d.ts +9 -0
  236. package/lib-esm/schemas/shield-information-barrier-report-details.generated.js +3 -0
  237. package/lib-esm/schemas/shield-information-barrier-report-details.generated.js.map +1 -0
  238. package/lib-esm/schemas/shield-information-barrier-report.generated.d.ts +32 -0
  239. package/lib-esm/schemas/shield-information-barrier-report.generated.js +3 -0
  240. package/lib-esm/schemas/shield-information-barrier-report.generated.js.map +1 -0
  241. package/lib-esm/schemas/shield-information-barrier-reports.generated.d.ts +26 -0
  242. package/lib-esm/schemas/shield-information-barrier-reports.generated.js +3 -0
  243. package/lib-esm/schemas/shield-information-barrier-reports.generated.js.map +1 -0
  244. package/lib-esm/schemas/shield-information-barrier-segment-member-base.generated.d.ts +19 -0
  245. package/lib-esm/schemas/shield-information-barrier-segment-member-base.generated.js +3 -0
  246. package/lib-esm/schemas/shield-information-barrier-segment-member-base.generated.js.map +1 -0
  247. package/lib-esm/schemas/shield-information-barrier-segment-member-mini.generated.d.ts +13 -0
  248. package/lib-esm/schemas/shield-information-barrier-segment-member-mini.generated.js +3 -0
  249. package/lib-esm/schemas/shield-information-barrier-segment-member-mini.generated.js.map +1 -0
  250. package/lib-esm/schemas/shield-information-barrier-segment-member.generated.d.ts +39 -0
  251. package/lib-esm/schemas/shield-information-barrier-segment-member.generated.js +3 -0
  252. package/lib-esm/schemas/shield-information-barrier-segment-member.generated.js.map +1 -0
  253. package/lib-esm/schemas/shield-information-barrier-segment-members.generated.d.ts +26 -0
  254. package/lib-esm/schemas/shield-information-barrier-segment-members.generated.js +3 -0
  255. package/lib-esm/schemas/shield-information-barrier-segment-members.generated.js.map +1 -0
  256. package/lib-esm/schemas/shield-information-barrier-segment-restriction-base.generated.d.ts +20 -0
  257. package/lib-esm/schemas/shield-information-barrier-segment-restriction-base.generated.js +3 -0
  258. package/lib-esm/schemas/shield-information-barrier-segment-restriction-base.generated.js.map +1 -0
  259. package/lib-esm/schemas/shield-information-barrier-segment-restriction-mini.generated.d.ts +20 -0
  260. package/lib-esm/schemas/shield-information-barrier-segment-restriction-mini.generated.js +3 -0
  261. package/lib-esm/schemas/shield-information-barrier-segment-restriction-mini.generated.js.map +1 -0
  262. package/lib-esm/schemas/shield-information-barrier-segment-restriction.generated.d.ts +33 -0
  263. package/lib-esm/schemas/shield-information-barrier-segment-restriction.generated.js +3 -0
  264. package/lib-esm/schemas/shield-information-barrier-segment-restriction.generated.js.map +1 -0
  265. package/lib-esm/schemas/shield-information-barrier-segment-restrictions.generated.d.ts +26 -0
  266. package/lib-esm/schemas/shield-information-barrier-segment-restrictions.generated.js +3 -0
  267. package/lib-esm/schemas/shield-information-barrier-segment-restrictions.generated.js.map +1 -0
  268. package/lib-esm/schemas/shield-information-barrier-segment.generated.d.ts +50 -0
  269. package/lib-esm/schemas/shield-information-barrier-segment.generated.js +3 -0
  270. package/lib-esm/schemas/shield-information-barrier-segment.generated.js.map +1 -0
  271. package/lib-esm/schemas/shield-information-barrier-segments.generated.d.ts +26 -0
  272. package/lib-esm/schemas/shield-information-barrier-segments.generated.js +3 -0
  273. package/lib-esm/schemas/shield-information-barrier-segments.generated.js.map +1 -0
  274. package/lib-esm/schemas/shield-information-barrier.generated.d.ts +56 -0
  275. package/lib-esm/schemas/shield-information-barrier.generated.js +3 -0
  276. package/lib-esm/schemas/shield-information-barrier.generated.js.map +1 -0
  277. package/lib-esm/schemas/shield-information-barriers.generated.d.ts +25 -0
  278. package/lib-esm/schemas/shield-information-barriers.generated.js +3 -0
  279. package/lib-esm/schemas/shield-information-barriers.generated.js.map +1 -0
  280. package/lib-esm/schemas/sign-request-base.generated.d.ts +78 -0
  281. package/lib-esm/schemas/sign-request-base.generated.js +3 -0
  282. package/lib-esm/schemas/sign-request-base.generated.js.map +1 -0
  283. package/lib-esm/schemas/sign-request-create-request.generated.d.ts +39 -0
  284. package/lib-esm/schemas/sign-request-create-request.generated.js +3 -0
  285. package/lib-esm/schemas/sign-request-create-request.generated.js.map +1 -0
  286. package/lib-esm/schemas/sign-request-create-signer.generated.d.ts +95 -0
  287. package/lib-esm/schemas/sign-request-create-signer.generated.js +3 -0
  288. package/lib-esm/schemas/sign-request-create-signer.generated.js.map +1 -0
  289. package/lib-esm/schemas/sign-request-prefill-tag.generated.d.ts +28 -0
  290. package/lib-esm/schemas/sign-request-prefill-tag.generated.js +3 -0
  291. package/lib-esm/schemas/sign-request-prefill-tag.generated.js.map +1 -0
  292. package/lib-esm/schemas/sign-request-signer-input.generated.d.ts +28 -0
  293. package/lib-esm/schemas/sign-request-signer-input.generated.js +3 -0
  294. package/lib-esm/schemas/sign-request-signer-input.generated.js.map +1 -0
  295. package/lib-esm/schemas/sign-request-signer.generated.d.ts +34 -0
  296. package/lib-esm/schemas/sign-request-signer.generated.js +3 -0
  297. package/lib-esm/schemas/sign-request-signer.generated.js.map +1 -0
  298. package/lib-esm/schemas/sign-request.generated.d.ts +72 -0
  299. package/lib-esm/schemas/sign-request.generated.js +3 -0
  300. package/lib-esm/schemas/sign-request.generated.js.map +1 -0
  301. package/lib-esm/schemas/sign-requests.generated.d.ts +25 -0
  302. package/lib-esm/schemas/sign-requests.generated.js +3 -0
  303. package/lib-esm/schemas/sign-requests.generated.js.map +1 -0
  304. package/lib-esm/schemas/sign-template.generated.d.ts +94 -0
  305. package/lib-esm/schemas/sign-template.generated.js +3 -0
  306. package/lib-esm/schemas/sign-template.generated.js.map +1 -0
  307. package/lib-esm/schemas/sign-templates.generated.d.ts +30 -0
  308. package/lib-esm/schemas/sign-templates.generated.js +3 -0
  309. package/lib-esm/schemas/sign-templates.generated.js.map +1 -0
  310. package/lib-esm/schemas/template-signer-input.generated.d.ts +61 -0
  311. package/lib-esm/schemas/template-signer-input.generated.js +3 -0
  312. package/lib-esm/schemas/template-signer-input.generated.js.map +1 -0
  313. package/lib-esm/schemas/template-signer.generated.d.ts +43 -0
  314. package/lib-esm/schemas/template-signer.generated.js +3 -0
  315. package/lib-esm/schemas/template-signer.generated.js.map +1 -0
  316. package/lib-esm/schemas/user-base.generated.d.ts +18 -0
  317. package/lib-esm/schemas/user-base.generated.js +3 -0
  318. package/lib-esm/schemas/user-base.generated.js.map +1 -0
  319. package/lib-esm/schemas/user-integration-mappings.d.ts +19 -0
  320. package/lib-esm/schemas/user-integration-mappings.js +3 -0
  321. package/lib-esm/schemas/user-integration-mappings.js.map +1 -0
  322. package/lib-esm/schemas/user-mini.d.ts +6 -0
  323. package/lib-esm/schemas/user-mini.js +3 -0
  324. package/lib-esm/schemas/user-mini.js.map +1 -0
  325. package/lib-esm/sessions/app-auth-session.d.ts +92 -0
  326. package/lib-esm/sessions/app-auth-session.js +176 -0
  327. package/lib-esm/sessions/app-auth-session.js.map +1 -0
  328. package/lib-esm/sessions/basic-session.d.ts +55 -0
  329. package/lib-esm/sessions/basic-session.js +62 -0
  330. package/lib-esm/sessions/basic-session.js.map +1 -0
  331. package/lib-esm/sessions/ccg-session.d.ts +72 -0
  332. package/lib-esm/sessions/ccg-session.js +111 -0
  333. package/lib-esm/sessions/ccg-session.js.map +1 -0
  334. package/lib-esm/sessions/persistent-session.d.ts +96 -0
  335. package/lib-esm/sessions/persistent-session.js +234 -0
  336. package/lib-esm/sessions/persistent-session.js.map +1 -0
  337. package/lib-esm/token-manager.d.ts +191 -0
  338. package/lib-esm/token-manager.js +453 -0
  339. package/lib-esm/token-manager.js.map +1 -0
  340. package/lib-esm/util/config.d.ts +85 -0
  341. package/lib-esm/util/config.js +212 -0
  342. package/lib-esm/util/config.js.map +1 -0
  343. package/lib-esm/util/errors.d.ts +50 -0
  344. package/lib-esm/util/errors.js +176 -0
  345. package/lib-esm/util/errors.js.map +1 -0
  346. package/lib-esm/util/exponential-backoff.d.ts +11 -0
  347. package/lib-esm/util/exponential-backoff.js +17 -0
  348. package/lib-esm/util/exponential-backoff.js.map +1 -0
  349. package/lib-esm/util/paging-iterator.d.ts +53 -0
  350. package/lib-esm/util/paging-iterator.js +247 -0
  351. package/lib-esm/util/paging-iterator.js.map +1 -0
  352. package/lib-esm/util/serializable.d.ts +10 -0
  353. package/lib-esm/util/serializable.js +17 -0
  354. package/lib-esm/util/serializable.js.map +1 -0
  355. package/lib-esm/util/url-path.d.ts +16 -0
  356. package/lib-esm/util/url-path.js +36 -0
  357. package/lib-esm/util/url-path.js.map +1 -0
  358. package/package.json +18 -4
@@ -0,0 +1,227 @@
1
+ /**
2
+ * @fileoverview Box SDK for Node.js
3
+ */
4
+ import { EventEmitter } from 'events';
5
+ import CCGAPISession = require('./sessions/ccg-session');
6
+ import APIRequestManager = require('./api-request-manager');
7
+ import BoxClient = require('./box-client');
8
+ import TokenManager = require('./token-manager');
9
+ /**
10
+ * Object representing interface functions for PersistentClient to interact with the consumer app's central storage layer.
11
+ * @typedef {Object} TokenStore
12
+ * @property {ReadTokenInfoFromStore} read - read TokenInfo from app central store.
13
+ * @property {WriteTokenInfoToStore} write - write TokenInfo to the app's central store.
14
+ * @property {ClearTokenInfoFromStore} clear - delete TokenInfo from the app's central store.
15
+ */
16
+ /**
17
+ * Acquires TokenInfo from the consumer app's central store.
18
+ * @typedef {Function} ReadTokenInfoFromStore
19
+ * @param {Function} callback - err if store read issue occurred, otherwise propagates a TokenInfo object
20
+ */
21
+ /**
22
+ * Writes TokenInfo to the consumer app's central store
23
+ * @typedef {Function} WriteTokenInfoToStore
24
+ * @param {TokenInfo} tokenInfo - the token info to be written
25
+ * @param {Function} callback - err if store write issue occurred, otherwise propagates null err
26
+ * and null result to indicate success
27
+ */
28
+ /**
29
+ * Clears TokenInfo from the consumer app's central store
30
+ * @typedef {Function} ClearTokenInfoFromStore
31
+ * @param {Function} callback - err if store delete issue occurred, otherwise propagates null err
32
+ * and null result to indicate success
33
+ */
34
+ type TokenStore = object;
35
+ type UserConfigurationOptions = object;
36
+ type TokenRequestOptions = object;
37
+ type CCGConfig = {
38
+ boxSubjectType: 'user' | 'enterprise';
39
+ boxSubjectId: string;
40
+ };
41
+ /**
42
+ * A backend NodeJS SDK to interact with the Box V2 API.
43
+ * This is the single entry point for all SDK consumer interactions. This is the only file that a 3rd party app
44
+ * should require. All other components are private and reached out to via this component.
45
+ * 1. Provides getters to spawn client instances for users to interact with the Box API.
46
+ * 2. Provides manual capability to acquire tokens via token grant endpoints.
47
+ * However, it is recommended to use clients to do this for you.
48
+ * 3. Emits notification events about relevant request/response events. Useful for logging Box API interactions.
49
+ * Notification events: request retries, exceeding max retries, permanent failures.
50
+ *
51
+ * @param {UserConfigurationOptions} params User settings used to initialize and customize the SDK
52
+ * @constructor
53
+ */
54
+ declare class BoxSDKNode extends EventEmitter {
55
+ accessLevels: any;
56
+ collaborationRoles: any;
57
+ CURRENT_USER_ID: any;
58
+ config: any;
59
+ _eventBus: EventEmitter;
60
+ requestManager: APIRequestManager;
61
+ tokenManager: TokenManager;
62
+ ccgSession: CCGAPISession;
63
+ /**
64
+ * Expose the BoxClient property enumerations to the SDK as a whole. This allows
65
+ * the consumer to access and use these values from anywhere in their application
66
+ * (like a helper) by requiring the SDK, instead of needing to pass the client.
67
+ */
68
+ static accessLevels: any;
69
+ static collaborationRoles: any;
70
+ static CURRENT_USER_ID: any;
71
+ /**
72
+ * Expose Webhooks.validateMessage() to the SDK as a whole. This allows
73
+ * the consumer to call BoxSDK.validateWebhookMessage() by just requiring the SDK,
74
+ * instead of needing to create a client (which is not needed to validate messages).
75
+ */
76
+ static validateWebhookMessage: any;
77
+ constructor(params: UserConfigurationOptions);
78
+ /**
79
+ * Setup the SDK instance by instantiating necessary objects with current
80
+ * configuration values.
81
+ *
82
+ * @returns {void}
83
+ * @private
84
+ */
85
+ _setup(): void;
86
+ /**
87
+ * Gets the BoxSDKNode instance by passing boxAppSettings json downloaded from the developer console.
88
+ *
89
+ * @param {Object} appConfig boxAppSettings object retrieved from Dev Console.
90
+ * @returns {BoxSDKNode} an instance that has been preconfigured with the values from the Dev Console
91
+ */
92
+ static getPreconfiguredInstance(appConfig: any): BoxSDKNode;
93
+ /**
94
+ * Updates the SDK configuration with new parameters.
95
+ *
96
+ * @param {UserConfigurationOptions} params User settings
97
+ * @returns {void}
98
+ */
99
+ configure(params: UserConfigurationOptions): void;
100
+ /**
101
+ * Returns a Box Client with a Basic API Session. The client is able to make requests on behalf of a user.
102
+ * A basic session has no access to a user's refresh token. Because of this, once the session's tokens
103
+ * expire the client cannot recover and a new session will need to be generated.
104
+ *
105
+ * @param {string} accessToken A user's Box API access token
106
+ * @returns {BoxClient} Returns a new Box Client paired to a new BasicAPISession
107
+ */
108
+ getBasicClient(accessToken: string): BoxClient;
109
+ /**
110
+ * Returns a Box Client with a Basic API Session. The client is able to make requests on behalf of a user.
111
+ * A basic session has no access to a user's refresh token. Because of this, once the session's tokens
112
+ * expire the client cannot recover and a new session will need to be generated.
113
+ *
114
+ * @param {string} accessToken A user's Box API access token
115
+ * @returns {BoxClient} Returns a new Box Client paired to a new BasicAPISession
116
+ */
117
+ static getBasicClient(accessToken: string): BoxClient;
118
+ /**
119
+ * Returns a Box Client with a persistent API session. A persistent API session helps manage the user's tokens,
120
+ * and can refresh them automatically if the access token expires. If a central data-store is given, the session
121
+ * can read & write tokens to it.
122
+ *
123
+ * NOTE: If tokenInfo or tokenStore are formatted incorrectly, this method will throw an error. If you
124
+ * haven't explicitly created either of these objects or are otherwise not completly confident in their validity,
125
+ * you should wrap your call to getPersistentClient in a try-catch to handle any potential errors.
126
+ *
127
+ * @param {TokenInfo} tokenInfo A tokenInfo object to use for authentication
128
+ * @param {TokenStore} [tokenStore] An optional token store for reading/writing tokens to session
129
+ * @returns {BoxClient} Returns a new Box Client paired to a new PersistentAPISession
130
+ */
131
+ getPersistentClient(tokenInfo: any, tokenStore?: TokenStore): BoxClient;
132
+ /**
133
+ * Returns a Box Client configured to use Client Credentials Grant for a service account. Requires enterprise ID
134
+ * to be set when configuring SDK instance.
135
+ *
136
+ * @returns {BoxClient} Returns a new Box Client paired to a AnonymousAPISession. All Anonymous API Sessions share the
137
+ * same tokens, which allows them to refresh them efficiently and reduce load on both the application and
138
+ * the API.
139
+ */
140
+ getAnonymousClient(): BoxClient;
141
+ /**
142
+ * Returns a Box Client configured to use Client Credentials Grant for a specified user.
143
+ *
144
+ * @param userId the user ID to use when getting the access token
145
+ * @returns {BoxClient} Returns a new Box Client paired to a AnonymousAPISession. All Anonymous API Sessions share the
146
+ * same tokens, which allows them to refresh them efficiently and reduce load on both the application and
147
+ * the API.
148
+ */
149
+ getCCGClientForUser(userId: string): BoxClient;
150
+ _getCCGClient(config: CCGConfig): BoxClient;
151
+ /**
152
+ * Create a new client using App Auth for the given entity. This allows either
153
+ * managing App Users (as the enterprise) or performing operations as the App
154
+ * Users or Managed Users themselves (as a user).
155
+ *
156
+ * @param {string} type The type of entity to operate as, "enterprise" or "user"
157
+ * @param {string} [id] (Optional) The Box ID of the entity to operate as
158
+ * @param {TokenStore} [tokenStore] (Optional) the token store to use for caching tokens
159
+ * @returns {BoxClient} A new client authorized as the app user or enterprise
160
+ */
161
+ getAppAuthClient(type: string, id?: string, tokenStore?: TokenStore): BoxClient;
162
+ /**
163
+ * Generate the URL for the authorize page to send users to for the first leg of
164
+ * the OAuth2 flow.
165
+ *
166
+ * @param {Object} params The OAuth2 parameters
167
+ * @returns {string} The authorize page URL
168
+ */
169
+ getAuthorizeURL(params: {
170
+ client_id?: string;
171
+ }): string;
172
+ /**
173
+ * Acquires token info using an authorization code
174
+ *
175
+ * @param {string} authorizationCode - authorization code issued by Box
176
+ * @param {TokenRequestOptions} [options] - Sets optional behavior for the token grant, null for default behavior
177
+ * @param {Function} [callback] - passed a TokenInfo object if tokens were granted successfully
178
+ * @returns {Promise<TokenInfo>} Promise resolving to the token info
179
+ */
180
+ getTokensAuthorizationCodeGrant(authorizationCode: string, options?: TokenRequestOptions | null, callback?: Function): import("bluebird")<{
181
+ accessToken: any;
182
+ refreshToken: any;
183
+ accessTokenTTLMS: number;
184
+ acquiredAtMS: number;
185
+ }>;
186
+ /**
187
+ * Refreshes the access and refresh tokens for a given refresh token.
188
+ *
189
+ * @param {string} refreshToken - A valid OAuth refresh token
190
+ * @param {TokenRequestOptions} [options] - Sets optional behavior for the token grant, null for default behavior
191
+ * @param {Function} [callback] - passed a TokenInfo object if tokens were granted successfully
192
+ * @returns {Promise<TokenInfo>} Promise resolving to the token info
193
+ */
194
+ getTokensRefreshGrant(refreshToken: string, options?: TokenRequestOptions | Function | null, callback?: Function): import("bluebird")<{
195
+ accessToken: any;
196
+ refreshToken: any;
197
+ accessTokenTTLMS: number;
198
+ acquiredAtMS: number;
199
+ }>;
200
+ /**
201
+ * Gets tokens for enterprise administration of app users
202
+ * @param {string} enterpriseID The ID of the enterprise to generate a token for
203
+ * @param {TokenRequestOptions} [options] - Sets optional behavior for the token grant, null for default behavior
204
+ * @param {Function} [callback] Passed the tokens if successful
205
+ * @returns {Promise<TokenInfo>} Promise resolving to the token info
206
+ */
207
+ getEnterpriseAppAuthTokens(enterpriseID: string, options?: TokenRequestOptions | Function | null, callback?: Function): import("bluebird")<any>;
208
+ /**
209
+ * Gets tokens for App Users via a JWT grant
210
+ * @param {string} userID The ID of the App User to generate a token for
211
+ * @param {TokenRequestOptions} [options] - Sets optional behavior for the token grant, null for default behavior
212
+ * @param {Function} [callback] Passed the tokens if successful
213
+ * @returns {Promise<TokentInfo>} Promise resolving to the token info
214
+ */
215
+ getAppUserTokens(userID: string, options?: TokenRequestOptions | Function | null, callback?: Function): import("bluebird")<any>;
216
+ /**
217
+ * Revokes a token pair associated with a given access or refresh token.
218
+ *
219
+ * @param {string} token - A valid access or refresh token to revoke
220
+ * @param {TokenRequestOptions} [options] - Sets optional behavior for the token grant, null for default behavior
221
+ * @param {Function} [callback] - If err, revoke failed. Otherwise, revoke succeeded.
222
+ * @returns {Promise<TokenInfo>} Promise resolving to the token info
223
+ */
224
+ revokeTokens(token: string, options?: TokenRequestOptions | Function | null, callback?: Function): import("bluebird")<unknown>;
225
+ }
226
+ /** @module box-node-sdk/lib/box-node-sdk */
227
+ export = BoxSDKNode;
@@ -0,0 +1,373 @@
1
+ "use strict";
2
+ /**
3
+ * @fileoverview Box SDK for Node.js
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
38
+ // ------------------------------------------------------------------------------
39
+ // Requirements
40
+ // ------------------------------------------------------------------------------
41
+ const events_1 = require("events");
42
+ const qs = __importStar(require("querystring"));
43
+ const CCGAPISession = require("./sessions/ccg-session");
44
+ const APIRequestManager = require("./api-request-manager");
45
+ const BoxClient = require("./box-client");
46
+ const TokenManager = require("./token-manager");
47
+ const Config = require('./util/config'), BasicAPISession = require('./sessions/basic-session'), PersistentAPISession = require('./sessions/persistent-session'), AppAuthSession = require('./sessions/app-auth-session'), Webhooks = require('./managers/webhooks');
48
+ // ------------------------------------------------------------------------------
49
+ // Private
50
+ // ------------------------------------------------------------------------------
51
+ // ------------------------------------------------------------------------------
52
+ // Public
53
+ // ------------------------------------------------------------------------------
54
+ /**
55
+ * A backend NodeJS SDK to interact with the Box V2 API.
56
+ * This is the single entry point for all SDK consumer interactions. This is the only file that a 3rd party app
57
+ * should require. All other components are private and reached out to via this component.
58
+ * 1. Provides getters to spawn client instances for users to interact with the Box API.
59
+ * 2. Provides manual capability to acquire tokens via token grant endpoints.
60
+ * However, it is recommended to use clients to do this for you.
61
+ * 3. Emits notification events about relevant request/response events. Useful for logging Box API interactions.
62
+ * Notification events: request retries, exceeding max retries, permanent failures.
63
+ *
64
+ * @param {UserConfigurationOptions} params User settings used to initialize and customize the SDK
65
+ * @constructor
66
+ */
67
+ class BoxSDKNode extends events_1.EventEmitter {
68
+ constructor(params) {
69
+ super();
70
+ const eventBus = new events_1.EventEmitter();
71
+ const self = this;
72
+ eventBus.on('response', function () {
73
+ const args /* FIXME */ = [].slice.call(arguments);
74
+ args.unshift('response');
75
+ self.emit.apply(self, args);
76
+ });
77
+ // Setup the configuration with the given params
78
+ this.config = new Config(params);
79
+ this._eventBus = eventBus;
80
+ this._setup();
81
+ }
82
+ /**
83
+ * Setup the SDK instance by instantiating necessary objects with current
84
+ * configuration values.
85
+ *
86
+ * @returns {void}
87
+ * @private
88
+ */
89
+ _setup() {
90
+ // Instantiate the request manager
91
+ this.requestManager = new APIRequestManager(this.config, this._eventBus);
92
+ // Initialize the rest of the SDK with the given configuration
93
+ this.tokenManager = new TokenManager(this.config, this.requestManager);
94
+ this.ccgSession = new CCGAPISession(this.config, this.tokenManager);
95
+ }
96
+ /**
97
+ * Gets the BoxSDKNode instance by passing boxAppSettings json downloaded from the developer console.
98
+ *
99
+ * @param {Object} appConfig boxAppSettings object retrieved from Dev Console.
100
+ * @returns {BoxSDKNode} an instance that has been preconfigured with the values from the Dev Console
101
+ */
102
+ static getPreconfiguredInstance(appConfig /* FIXME */) {
103
+ if (typeof appConfig.boxAppSettings !== 'object') {
104
+ throw new TypeError('Configuration does not include boxAppSettings object.');
105
+ }
106
+ const boxAppSettings = appConfig.boxAppSettings;
107
+ const webhooks = appConfig.webhooks;
108
+ if (typeof webhooks === 'object') {
109
+ Webhooks.setSignatureKeys(webhooks.primaryKey, webhooks.secondaryKey);
110
+ }
111
+ const params = {};
112
+ if (typeof boxAppSettings.clientID === 'string') {
113
+ params.clientID = boxAppSettings.clientID;
114
+ }
115
+ if (typeof boxAppSettings.clientSecret === 'string') {
116
+ params.clientSecret = boxAppSettings.clientSecret;
117
+ }
118
+ // Only try to assign app auth settings if they are present
119
+ // Some configurations do not include them (but might include other info, e.g. webhooks)
120
+ if (typeof boxAppSettings.appAuth === 'object' &&
121
+ boxAppSettings.appAuth.publicKeyID) {
122
+ params.appAuth = {
123
+ keyID: boxAppSettings.appAuth.publicKeyID, // Assign publicKeyID to keyID
124
+ privateKey: boxAppSettings.appAuth.privateKey,
125
+ };
126
+ const passphrase = boxAppSettings.appAuth.passphrase;
127
+ if (typeof passphrase === 'string') {
128
+ params.appAuth.passphrase = passphrase;
129
+ }
130
+ }
131
+ if (typeof appConfig.enterpriseID === 'string') {
132
+ params.enterpriseID = appConfig.enterpriseID;
133
+ }
134
+ return new BoxSDKNode(params);
135
+ }
136
+ /**
137
+ * Updates the SDK configuration with new parameters.
138
+ *
139
+ * @param {UserConfigurationOptions} params User settings
140
+ * @returns {void}
141
+ */
142
+ configure(params) {
143
+ this.config = this.config.extend(params);
144
+ this._setup();
145
+ }
146
+ /**
147
+ * Returns a Box Client with a Basic API Session. The client is able to make requests on behalf of a user.
148
+ * A basic session has no access to a user's refresh token. Because of this, once the session's tokens
149
+ * expire the client cannot recover and a new session will need to be generated.
150
+ *
151
+ * @param {string} accessToken A user's Box API access token
152
+ * @returns {BoxClient} Returns a new Box Client paired to a new BasicAPISession
153
+ */
154
+ getBasicClient(accessToken) {
155
+ const apiSession = new BasicAPISession(accessToken, this.tokenManager);
156
+ return new BoxClient(apiSession, this.config, this.requestManager);
157
+ }
158
+ /**
159
+ * Returns a Box Client with a Basic API Session. The client is able to make requests on behalf of a user.
160
+ * A basic session has no access to a user's refresh token. Because of this, once the session's tokens
161
+ * expire the client cannot recover and a new session will need to be generated.
162
+ *
163
+ * @param {string} accessToken A user's Box API access token
164
+ * @returns {BoxClient} Returns a new Box Client paired to a new BasicAPISession
165
+ */
166
+ static getBasicClient(accessToken) {
167
+ return new BoxSDKNode({
168
+ clientID: '',
169
+ clientSecret: '',
170
+ }).getBasicClient(accessToken);
171
+ }
172
+ /**
173
+ * Returns a Box Client with a persistent API session. A persistent API session helps manage the user's tokens,
174
+ * and can refresh them automatically if the access token expires. If a central data-store is given, the session
175
+ * can read & write tokens to it.
176
+ *
177
+ * NOTE: If tokenInfo or tokenStore are formatted incorrectly, this method will throw an error. If you
178
+ * haven't explicitly created either of these objects or are otherwise not completly confident in their validity,
179
+ * you should wrap your call to getPersistentClient in a try-catch to handle any potential errors.
180
+ *
181
+ * @param {TokenInfo} tokenInfo A tokenInfo object to use for authentication
182
+ * @param {TokenStore} [tokenStore] An optional token store for reading/writing tokens to session
183
+ * @returns {BoxClient} Returns a new Box Client paired to a new PersistentAPISession
184
+ */
185
+ getPersistentClient(tokenInfo /* FIXME */, tokenStore) {
186
+ const apiSession = new PersistentAPISession(tokenInfo, tokenStore, this.config, this.tokenManager);
187
+ return new BoxClient(apiSession, this.config, this.requestManager);
188
+ }
189
+ /**
190
+ * Returns a Box Client configured to use Client Credentials Grant for a service account. Requires enterprise ID
191
+ * to be set when configuring SDK instance.
192
+ *
193
+ * @returns {BoxClient} Returns a new Box Client paired to a AnonymousAPISession. All Anonymous API Sessions share the
194
+ * same tokens, which allows them to refresh them efficiently and reduce load on both the application and
195
+ * the API.
196
+ */
197
+ getAnonymousClient() {
198
+ if (!this.config.enterpriseID) {
199
+ throw new Error('Enterprise ID must be passed');
200
+ }
201
+ return this._getCCGClient({
202
+ boxSubjectType: 'enterprise',
203
+ boxSubjectId: this.config.enterpriseID,
204
+ });
205
+ }
206
+ /**
207
+ * Returns a Box Client configured to use Client Credentials Grant for a specified user.
208
+ *
209
+ * @param userId the user ID to use when getting the access token
210
+ * @returns {BoxClient} Returns a new Box Client paired to a AnonymousAPISession. All Anonymous API Sessions share the
211
+ * same tokens, which allows them to refresh them efficiently and reduce load on both the application and
212
+ * the API.
213
+ */
214
+ getCCGClientForUser(userId) {
215
+ return this._getCCGClient({
216
+ boxSubjectType: 'user',
217
+ boxSubjectId: userId,
218
+ });
219
+ }
220
+ _getCCGClient(config) {
221
+ const anonymousTokenManager = new TokenManager({
222
+ ...this.config,
223
+ ...config,
224
+ }, this.requestManager);
225
+ const newAnonymousSession = new CCGAPISession(this.config, anonymousTokenManager);
226
+ return new BoxClient(newAnonymousSession, this.config, this.requestManager);
227
+ }
228
+ /**
229
+ * Create a new client using App Auth for the given entity. This allows either
230
+ * managing App Users (as the enterprise) or performing operations as the App
231
+ * Users or Managed Users themselves (as a user).
232
+ *
233
+ * @param {string} type The type of entity to operate as, "enterprise" or "user"
234
+ * @param {string} [id] (Optional) The Box ID of the entity to operate as
235
+ * @param {TokenStore} [tokenStore] (Optional) the token store to use for caching tokens
236
+ * @returns {BoxClient} A new client authorized as the app user or enterprise
237
+ */
238
+ getAppAuthClient(type, id, tokenStore) {
239
+ if (type === 'enterprise' && !id) {
240
+ if (this.config.enterpriseID) {
241
+ id = this.config.enterpriseID;
242
+ }
243
+ else {
244
+ throw new Error('Enterprise ID must be passed');
245
+ }
246
+ }
247
+ const appAuthSession = new AppAuthSession(type, id, this.config, this.tokenManager, tokenStore);
248
+ return new BoxClient(appAuthSession, this.config, this.requestManager);
249
+ }
250
+ /**
251
+ * Generate the URL for the authorize page to send users to for the first leg of
252
+ * the OAuth2 flow.
253
+ *
254
+ * @param {Object} params The OAuth2 parameters
255
+ * @returns {string} The authorize page URL
256
+ */
257
+ getAuthorizeURL(params) {
258
+ params.client_id = this.config.clientID;
259
+ return `${this.config.authorizeRootURL}/oauth2/authorize?${qs.stringify(params)}`;
260
+ }
261
+ /**
262
+ * Acquires token info using an authorization code
263
+ *
264
+ * @param {string} authorizationCode - authorization code issued by Box
265
+ * @param {TokenRequestOptions} [options] - Sets optional behavior for the token grant, null for default behavior
266
+ * @param {Function} [callback] - passed a TokenInfo object if tokens were granted successfully
267
+ * @returns {Promise<TokenInfo>} Promise resolving to the token info
268
+ */
269
+ getTokensAuthorizationCodeGrant(authorizationCode, options, callback) {
270
+ return this.tokenManager
271
+ .getTokensAuthorizationCodeGrant(authorizationCode, options /* FIXME */)
272
+ .asCallback(callback);
273
+ }
274
+ /**
275
+ * Refreshes the access and refresh tokens for a given refresh token.
276
+ *
277
+ * @param {string} refreshToken - A valid OAuth refresh token
278
+ * @param {TokenRequestOptions} [options] - Sets optional behavior for the token grant, null for default behavior
279
+ * @param {Function} [callback] - passed a TokenInfo object if tokens were granted successfully
280
+ * @returns {Promise<TokenInfo>} Promise resolving to the token info
281
+ */
282
+ getTokensRefreshGrant(refreshToken, options, callback) {
283
+ if (typeof options === 'function') {
284
+ callback = options;
285
+ options = null;
286
+ }
287
+ return this.tokenManager
288
+ .getTokensRefreshGrant(refreshToken, options /* FIXME */)
289
+ .asCallback(callback);
290
+ }
291
+ /**
292
+ * Gets tokens for enterprise administration of app users
293
+ * @param {string} enterpriseID The ID of the enterprise to generate a token for
294
+ * @param {TokenRequestOptions} [options] - Sets optional behavior for the token grant, null for default behavior
295
+ * @param {Function} [callback] Passed the tokens if successful
296
+ * @returns {Promise<TokenInfo>} Promise resolving to the token info
297
+ */
298
+ getEnterpriseAppAuthTokens(enterpriseID, options, callback) {
299
+ if (typeof options === 'function') {
300
+ callback = options;
301
+ options = null;
302
+ }
303
+ if (!enterpriseID) {
304
+ if (this.config.enterpriseID) {
305
+ enterpriseID = this.config.enterpriseID;
306
+ }
307
+ else {
308
+ throw new Error('Enterprise id must be passed');
309
+ }
310
+ }
311
+ return this.tokenManager
312
+ .getTokensJWTGrant('enterprise', enterpriseID, options /* FIXME */)
313
+ .asCallback(callback);
314
+ }
315
+ /**
316
+ * Gets tokens for App Users via a JWT grant
317
+ * @param {string} userID The ID of the App User to generate a token for
318
+ * @param {TokenRequestOptions} [options] - Sets optional behavior for the token grant, null for default behavior
319
+ * @param {Function} [callback] Passed the tokens if successful
320
+ * @returns {Promise<TokentInfo>} Promise resolving to the token info
321
+ */
322
+ getAppUserTokens(userID, options, callback) {
323
+ if (typeof options === 'function') {
324
+ callback = options;
325
+ options = null;
326
+ }
327
+ return this.tokenManager
328
+ .getTokensJWTGrant('user', userID, options /* FIXME */)
329
+ .asCallback(callback);
330
+ }
331
+ /**
332
+ * Revokes a token pair associated with a given access or refresh token.
333
+ *
334
+ * @param {string} token - A valid access or refresh token to revoke
335
+ * @param {TokenRequestOptions} [options] - Sets optional behavior for the token grant, null for default behavior
336
+ * @param {Function} [callback] - If err, revoke failed. Otherwise, revoke succeeded.
337
+ * @returns {Promise<TokenInfo>} Promise resolving to the token info
338
+ */
339
+ revokeTokens(token, options, callback) {
340
+ if (typeof options === 'function') {
341
+ callback = options;
342
+ options = null;
343
+ }
344
+ return this.tokenManager
345
+ .revokeTokens(token, options /* FIXME */)
346
+ .asCallback(callback);
347
+ }
348
+ }
349
+ /**
350
+ * Expose the BoxClient property enumerations to the SDK as a whole. This allows
351
+ * the consumer to access and use these values from anywhere in their application
352
+ * (like a helper) by requiring the SDK, instead of needing to pass the client.
353
+ */
354
+ BoxSDKNode.accessLevels = BoxSDKNode.prototype.accessLevels;
355
+ BoxSDKNode.collaborationRoles = BoxSDKNode.prototype.collaborationRoles;
356
+ BoxSDKNode.CURRENT_USER_ID = BoxSDKNode.prototype.CURRENT_USER_ID;
357
+ /**
358
+ * Expose Webhooks.validateMessage() to the SDK as a whole. This allows
359
+ * the consumer to call BoxSDK.validateWebhookMessage() by just requiring the SDK,
360
+ * instead of needing to create a client (which is not needed to validate messages).
361
+ */
362
+ BoxSDKNode.validateWebhookMessage = Webhooks.validateMessage;
363
+ /**
364
+ * Expose the BoxClient property enumerations to the SDK as a whole. This allows
365
+ * the consumer to access and use these values from anywhere in their application
366
+ * (like a helper) by requiring the SDK, instead of needing to pass the client.
367
+ */
368
+ BoxSDKNode.prototype.accessLevels = BoxClient.prototype.accessLevels;
369
+ BoxSDKNode.prototype.collaborationRoles =
370
+ BoxClient.prototype.collaborationRoles;
371
+ BoxSDKNode.prototype.CURRENT_USER_ID = BoxClient.prototype.CURRENT_USER_ID;
372
+ module.exports = BoxSDKNode;
373
+ //# sourceMappingURL=box-node-sdk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"box-node-sdk.js","sourceRoot":"","sources":["../src/box-node-sdk.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,iFAAiF;AACjF,eAAe;AACf,iFAAiF;AAEjF,mCAAsC;AACtC,gDAAkC;AAClC,wDAAyD;AACzD,2DAA4D;AAC5D,0CAA2C;AAC3C,gDAAiD;AAEjD,MAAM,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,EACrC,eAAe,GAAG,OAAO,CAAC,0BAA0B,CAAC,EACrD,oBAAoB,GAAG,OAAO,CAAC,+BAA+B,CAAC,EAC/D,cAAc,GAAG,OAAO,CAAC,6BAA6B,CAAC,EACvD,QAAQ,GAAG,OAAO,CAAC,qBAAqB,CAAC,C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