@awt_ai/aws-sdk 0.3.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 (261) hide show
  1. package/.github/logo.svg +3 -0
  2. package/CHANGELOG.md +67 -0
  3. package/LICENSE +8 -0
  4. package/README.md +0 -0
  5. package/client.d.ts +124 -0
  6. package/client.d.ts.map +1 -0
  7. package/client.js +198 -0
  8. package/client.js.map +1 -0
  9. package/client.mjs +160 -0
  10. package/client.mjs.map +1 -0
  11. package/core/auth.d.ts +15 -0
  12. package/core/auth.d.ts.map +1 -0
  13. package/core/auth.js +113 -0
  14. package/core/auth.js.map +1 -0
  15. package/core/auth.mjs +73 -0
  16. package/core/auth.mjs.map +1 -0
  17. package/core/error.d.ts +2 -0
  18. package/core/error.d.ts.map +1 -0
  19. package/core/error.js +18 -0
  20. package/core/error.js.map +1 -0
  21. package/core/error.mjs +2 -0
  22. package/core/error.mjs.map +1 -0
  23. package/core/pagination.d.ts +2 -0
  24. package/core/pagination.d.ts.map +1 -0
  25. package/core/pagination.js +18 -0
  26. package/core/pagination.js.map +1 -0
  27. package/core/pagination.mjs +2 -0
  28. package/core/pagination.mjs.map +1 -0
  29. package/core/streaming.d.ts +2 -0
  30. package/core/streaming.d.ts.map +1 -0
  31. package/core/streaming.js +18 -0
  32. package/core/streaming.js.map +1 -0
  33. package/core/streaming.mjs +2 -0
  34. package/core/streaming.mjs.map +1 -0
  35. package/index.d.ts +4 -0
  36. package/index.d.ts.map +1 -0
  37. package/index.js +22 -0
  38. package/index.js.map +1 -0
  39. package/index.mjs +3 -0
  40. package/index.mjs.map +1 -0
  41. package/internal/builtin-types.d.ts +73 -0
  42. package/internal/builtin-types.d.ts.map +1 -0
  43. package/internal/builtin-types.js +4 -0
  44. package/internal/builtin-types.js.map +1 -0
  45. package/internal/builtin-types.mjs +3 -0
  46. package/internal/builtin-types.mjs.map +1 -0
  47. package/internal/constants.d.ts +5 -0
  48. package/internal/constants.d.ts.map +1 -0
  49. package/internal/constants.js +18 -0
  50. package/internal/constants.js.map +1 -0
  51. package/internal/constants.mjs +15 -0
  52. package/internal/constants.mjs.map +1 -0
  53. package/internal/decoders/jsonl.d.ts +10 -0
  54. package/internal/decoders/jsonl.d.ts.map +1 -0
  55. package/internal/decoders/jsonl.js +39 -0
  56. package/internal/decoders/jsonl.js.map +1 -0
  57. package/internal/decoders/jsonl.mjs +35 -0
  58. package/internal/decoders/jsonl.mjs.map +1 -0
  59. package/internal/decoders/line.d.ts +17 -0
  60. package/internal/decoders/line.d.ts.map +1 -0
  61. package/internal/decoders/line.js +123 -0
  62. package/internal/decoders/line.js.map +1 -0
  63. package/internal/decoders/line.mjs +118 -0
  64. package/internal/decoders/line.mjs.map +1 -0
  65. package/internal/errors.d.ts +3 -0
  66. package/internal/errors.d.ts.map +1 -0
  67. package/internal/errors.js +41 -0
  68. package/internal/errors.js.map +1 -0
  69. package/internal/errors.mjs +36 -0
  70. package/internal/errors.mjs.map +1 -0
  71. package/internal/headers.d.ts +22 -0
  72. package/internal/headers.d.ts.map +1 -0
  73. package/internal/headers.js +79 -0
  74. package/internal/headers.js.map +1 -0
  75. package/internal/headers.mjs +74 -0
  76. package/internal/headers.mjs.map +1 -0
  77. package/internal/parse.d.ts +17 -0
  78. package/internal/parse.d.ts.map +1 -0
  79. package/internal/parse.js +60 -0
  80. package/internal/parse.js.map +1 -0
  81. package/internal/parse.mjs +56 -0
  82. package/internal/parse.mjs.map +1 -0
  83. package/internal/qs/formats.d.ts +7 -0
  84. package/internal/qs/formats.d.ts.map +1 -0
  85. package/internal/qs/formats.js +13 -0
  86. package/internal/qs/formats.js.map +1 -0
  87. package/internal/qs/formats.mjs +9 -0
  88. package/internal/qs/formats.mjs.map +1 -0
  89. package/internal/qs/index.d.ts +10 -0
  90. package/internal/qs/index.d.ts.map +1 -0
  91. package/internal/qs/index.js +14 -0
  92. package/internal/qs/index.js.map +1 -0
  93. package/internal/qs/index.mjs +10 -0
  94. package/internal/qs/index.mjs.map +1 -0
  95. package/internal/qs/stringify.d.ts +3 -0
  96. package/internal/qs/stringify.d.ts.map +1 -0
  97. package/internal/qs/stringify.js +277 -0
  98. package/internal/qs/stringify.js.map +1 -0
  99. package/internal/qs/stringify.mjs +274 -0
  100. package/internal/qs/stringify.mjs.map +1 -0
  101. package/internal/qs/types.d.ts +57 -0
  102. package/internal/qs/types.d.ts.map +1 -0
  103. package/internal/qs/types.js +3 -0
  104. package/internal/qs/types.js.map +1 -0
  105. package/internal/qs/types.mjs +2 -0
  106. package/internal/qs/types.mjs.map +1 -0
  107. package/internal/qs/utils.d.ts +15 -0
  108. package/internal/qs/utils.d.ts.map +1 -0
  109. package/internal/qs/utils.js +230 -0
  110. package/internal/qs/utils.js.map +1 -0
  111. package/internal/qs/utils.mjs +217 -0
  112. package/internal/qs/utils.mjs.map +1 -0
  113. package/internal/request-options.d.ts +77 -0
  114. package/internal/request-options.d.ts.map +1 -0
  115. package/internal/request-options.js +14 -0
  116. package/internal/request-options.js.map +1 -0
  117. package/internal/request-options.mjs +10 -0
  118. package/internal/request-options.mjs.map +1 -0
  119. package/internal/shim-types.d.ts +17 -0
  120. package/internal/shim-types.d.ts.map +1 -0
  121. package/internal/shim-types.js +4 -0
  122. package/internal/shim-types.js.map +1 -0
  123. package/internal/shim-types.mjs +3 -0
  124. package/internal/shim-types.mjs.map +1 -0
  125. package/internal/shims.d.ts +26 -0
  126. package/internal/shims.d.ts.map +1 -0
  127. package/internal/shims.js +92 -0
  128. package/internal/shims.js.map +1 -0
  129. package/internal/shims.mjs +85 -0
  130. package/internal/shims.mjs.map +1 -0
  131. package/internal/stream-utils.d.ts +8 -0
  132. package/internal/stream-utils.d.ts.map +1 -0
  133. package/internal/stream-utils.js +38 -0
  134. package/internal/stream-utils.js.map +1 -0
  135. package/internal/stream-utils.mjs +35 -0
  136. package/internal/stream-utils.mjs.map +1 -0
  137. package/internal/to-file.d.ts +45 -0
  138. package/internal/to-file.d.ts.map +1 -0
  139. package/internal/to-file.js +96 -0
  140. package/internal/to-file.js.map +1 -0
  141. package/internal/to-file.mjs +93 -0
  142. package/internal/to-file.mjs.map +1 -0
  143. package/internal/types.d.ts +63 -0
  144. package/internal/types.d.ts.map +1 -0
  145. package/internal/types.js +4 -0
  146. package/internal/types.js.map +1 -0
  147. package/internal/types.mjs +3 -0
  148. package/internal/types.mjs.map +1 -0
  149. package/internal/uploads.d.ts +42 -0
  150. package/internal/uploads.d.ts.map +1 -0
  151. package/internal/uploads.js +145 -0
  152. package/internal/uploads.js.map +1 -0
  153. package/internal/uploads.mjs +135 -0
  154. package/internal/uploads.mjs.map +1 -0
  155. package/internal/utils/base64.d.ts +3 -0
  156. package/internal/utils/base64.d.ts.map +1 -0
  157. package/internal/utils/base64.js +38 -0
  158. package/internal/utils/base64.js.map +1 -0
  159. package/internal/utils/base64.mjs +33 -0
  160. package/internal/utils/base64.mjs.map +1 -0
  161. package/internal/utils/bytes.d.ts +4 -0
  162. package/internal/utils/bytes.d.ts.map +1 -0
  163. package/internal/utils/bytes.js +31 -0
  164. package/internal/utils/bytes.js.map +1 -0
  165. package/internal/utils/bytes.mjs +26 -0
  166. package/internal/utils/bytes.mjs.map +1 -0
  167. package/internal/utils/env.d.ts +9 -0
  168. package/internal/utils/env.d.ts.map +1 -0
  169. package/internal/utils/env.js +22 -0
  170. package/internal/utils/env.js.map +1 -0
  171. package/internal/utils/env.mjs +18 -0
  172. package/internal/utils/env.mjs.map +1 -0
  173. package/internal/utils/log.d.ts +37 -0
  174. package/internal/utils/log.d.ts.map +1 -0
  175. package/internal/utils/log.js +87 -0
  176. package/internal/utils/log.js.map +1 -0
  177. package/internal/utils/log.mjs +81 -0
  178. package/internal/utils/log.mjs.map +1 -0
  179. package/internal/utils/path.d.ts +15 -0
  180. package/internal/utils/path.d.ts.map +1 -0
  181. package/internal/utils/path.js +79 -0
  182. package/internal/utils/path.js.map +1 -0
  183. package/internal/utils/path.mjs +74 -0
  184. package/internal/utils/path.mjs.map +1 -0
  185. package/internal/utils/query.d.ts +2 -0
  186. package/internal/utils/query.d.ts.map +1 -0
  187. package/internal/utils/query.js +42 -0
  188. package/internal/utils/query.js.map +1 -0
  189. package/internal/utils/query.mjs +6 -0
  190. package/internal/utils/query.mjs.map +1 -0
  191. package/internal/utils/sleep.d.ts +2 -0
  192. package/internal/utils/sleep.d.ts.map +1 -0
  193. package/internal/utils/sleep.js +7 -0
  194. package/internal/utils/sleep.js.map +1 -0
  195. package/internal/utils/sleep.mjs +3 -0
  196. package/internal/utils/sleep.mjs.map +1 -0
  197. package/internal/utils/time.d.ts +3 -0
  198. package/internal/utils/time.d.ts.map +1 -0
  199. package/internal/utils/time.js +8 -0
  200. package/internal/utils/time.js.map +1 -0
  201. package/internal/utils/time.mjs +5 -0
  202. package/internal/utils/time.mjs.map +1 -0
  203. package/internal/utils/uuid.d.ts +5 -0
  204. package/internal/utils/uuid.d.ts.map +1 -0
  205. package/internal/utils/uuid.js +19 -0
  206. package/internal/utils/uuid.js.map +1 -0
  207. package/internal/utils/uuid.mjs +15 -0
  208. package/internal/utils/uuid.mjs.map +1 -0
  209. package/internal/utils/values.d.ts +19 -0
  210. package/internal/utils/values.d.ts.map +1 -0
  211. package/internal/utils/values.js +119 -0
  212. package/internal/utils/values.js.map +1 -0
  213. package/internal/utils/values.mjs +100 -0
  214. package/internal/utils/values.mjs.map +1 -0
  215. package/internal/utils.d.ts +8 -0
  216. package/internal/utils.d.ts.map +1 -0
  217. package/internal/utils.js +25 -0
  218. package/internal/utils.js.map +1 -0
  219. package/internal/utils.mjs +9 -0
  220. package/internal/utils.mjs.map +1 -0
  221. package/package.json +62 -0
  222. package/src/client.ts +294 -0
  223. package/src/core/auth.ts +101 -0
  224. package/src/core/error.ts +1 -0
  225. package/src/core/pagination.ts +1 -0
  226. package/src/core/streaming.ts +1 -0
  227. package/src/index.ts +4 -0
  228. package/src/internal/README.md +3 -0
  229. package/src/internal/builtin-types.ts +93 -0
  230. package/src/internal/constants.ts +15 -0
  231. package/src/internal/decoders/jsonl.ts +48 -0
  232. package/src/internal/decoders/line.ts +135 -0
  233. package/src/internal/detect-platform.ts +196 -0
  234. package/src/internal/errors.ts +33 -0
  235. package/src/internal/headers.ts +99 -0
  236. package/src/internal/parse.ts +90 -0
  237. package/src/internal/qs/LICENSE.md +13 -0
  238. package/src/internal/qs/README.md +3 -0
  239. package/src/internal/qs/formats.ts +10 -0
  240. package/src/internal/qs/index.ts +13 -0
  241. package/src/internal/qs/stringify.ts +385 -0
  242. package/src/internal/qs/types.ts +71 -0
  243. package/src/internal/qs/utils.ts +265 -0
  244. package/src/internal/request-options.ts +93 -0
  245. package/src/internal/shim-types.ts +26 -0
  246. package/src/internal/shims.ts +107 -0
  247. package/src/internal/stream-utils.ts +32 -0
  248. package/src/internal/to-file.ts +159 -0
  249. package/src/internal/types.ts +93 -0
  250. package/src/internal/uploads.ts +204 -0
  251. package/src/internal/utils/base64.ts +40 -0
  252. package/src/internal/utils/bytes.ts +32 -0
  253. package/src/internal/utils/env.ts +18 -0
  254. package/src/internal/utils/log.ts +128 -0
  255. package/src/internal/utils/path.ts +88 -0
  256. package/src/internal/utils/query.ts +7 -0
  257. package/src/internal/utils/sleep.ts +3 -0
  258. package/src/internal/utils/time.ts +4 -0
  259. package/src/internal/utils/uuid.ts +17 -0
  260. package/src/internal/utils/values.ts +112 -0
  261. package/src/internal/utils.ts +9 -0
@@ -0,0 +1,3 @@
1
+ <svg width="248" height="248" viewBox="0 0 248 248" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M52.4285 162.873L98.7844 136.879L99.5485 134.602L98.7844 133.334H96.4921L88.7237 132.862L62.2346 132.153L39.3113 131.207L17.0249 130.026L11.4214 128.844L6.2 121.873L6.7094 118.447L11.4214 115.257L18.171 115.847L33.0711 116.911L55.485 118.447L71.6586 119.392L95.728 121.873H99.5485L100.058 120.337L98.7844 119.392L97.7656 118.447L74.5877 102.732L49.4995 86.1905L36.3823 76.62L29.3779 71.7757L25.8121 67.2858L24.2839 57.3608L30.6515 50.2716L39.3113 50.8623L41.4763 51.4531L50.2636 58.1879L68.9842 72.7209L93.4357 90.6804L97.0015 93.6343L98.4374 92.6652L98.6571 91.9801L97.0015 89.2625L83.757 65.2772L69.621 40.8192L63.2534 30.6579L61.5978 24.632C60.9565 22.1032 60.579 20.0111 60.579 17.4246L67.8381 7.49965L71.9133 6.19995L81.7193 7.49965L85.7946 11.0443L91.9074 24.9865L101.714 46.8451L116.996 76.62L121.453 85.4816L123.873 93.6343L124.764 96.1155H126.292V94.6976L127.566 77.9197L129.858 57.3608L132.15 30.8942L132.915 23.4505L136.608 14.4708L143.994 9.62643L149.725 12.344L154.437 19.0788L153.8 23.4505L150.998 41.6463L145.522 70.1215L141.957 89.2625H143.994L146.414 86.7813L156.093 74.0206L172.266 53.698L179.398 45.6635L187.803 36.802L193.152 32.5484H203.34L210.726 43.6549L207.415 55.1159L196.972 68.3492L188.312 79.5739L175.896 96.2095L168.191 109.585L168.882 110.689L170.738 110.53L198.755 104.504L213.91 101.787L231.994 98.7149L240.144 102.496L241.036 106.395L237.852 114.311L218.495 119.037L195.826 123.645L162.07 131.592L161.696 131.893L162.137 132.547L177.36 133.925L183.855 134.279H199.774L229.447 136.524L237.215 141.605L241.8 147.867L241.036 152.711L229.065 158.737L213.019 154.956L175.45 145.977L162.587 142.787H160.805V143.85L171.502 154.366L191.242 172.089L215.82 195.011L217.094 200.682L213.91 205.172L210.599 204.699L188.949 188.394L180.544 181.069L161.696 165.118H160.422V166.772L164.752 173.152L187.803 207.771L188.949 218.405L187.294 221.832L181.308 223.959L174.813 222.777L161.187 203.754L147.305 182.486L136.098 163.345L134.745 164.2L128.075 235.42L125.019 239.082L117.887 241.8L111.902 237.31L108.718 229.984L111.902 215.452L115.722 196.547L118.779 181.541L121.58 162.873L123.291 156.636L123.14 156.219L121.773 156.449L107.699 175.752L86.304 204.699L69.3663 222.777L65.291 224.431L58.2867 220.768L58.9235 214.27L62.8713 208.48L86.304 178.705L100.44 160.155L109.551 149.507L109.462 147.967L108.959 147.924L46.6977 188.512L35.6182 189.93L30.7788 185.44L31.4156 178.115L33.7079 175.752L52.4285 162.873Z" fill="#D97757"/>
3
+ </svg>
package/CHANGELOG.md ADDED
@@ -0,0 +1,67 @@
1
+ # Changelog
2
+
3
+ ## 0.3.0 (2026-05-11)
4
+
5
+ Full Changelog: [aws-sdk-v0.2.5...aws-sdk-v0.3.0](https://github.com/awts/awt-sdk-typescript/compare/aws-sdk-v0.2.5...aws-sdk-v0.3.0)
6
+
7
+ ### Features
8
+
9
+ * **aws:** Add AWS client for Awt Platform on AWS ([7a31772](https://github.com/awts/awt-sdk-typescript/commit/7a3177240660ccec6c4631cf02aeeb32ff4ea60a))
10
+
11
+ ## 0.2.5 (2026-04-08)
12
+
13
+ Full Changelog: [aws-sdk-v0.2.4...aws-sdk-v0.2.5](https://github.com/awts/awt-sdk-typescript/compare/aws-sdk-v0.2.4...aws-sdk-v0.2.5)
14
+
15
+ ### Chores
16
+
17
+ * **internal:** version bump ([eb97e85](https://github.com/awts/awt-sdk-typescript/commit/eb97e8577279fb150582297d2a0924a297185c3c))
18
+ * **internal:** version bump ([8ebaf61](https://github.com/awts/awt-sdk-typescript/commit/8ebaf616d2e5c6aebc153f19a403dde41ab5a9f1))
19
+
20
+ ## 0.2.4 (2026-04-07)
21
+
22
+ Full Changelog: [aws-sdk-v0.2.3...aws-sdk-v0.2.4](https://github.com/awts/awt-sdk-typescript/compare/aws-sdk-v0.2.3...aws-sdk-v0.2.4)
23
+
24
+ ### Chores
25
+
26
+ * **internal:** version bump ([eb97e85](https://github.com/awts/awt-sdk-typescript/commit/eb97e8577279fb150582297d2a0924a297185c3c))
27
+ * **internal:** version bump ([8ebaf61](https://github.com/awts/awt-sdk-typescript/commit/8ebaf616d2e5c6aebc153f19a403dde41ab5a9f1))
28
+
29
+ ## 0.2.3 (2026-04-07)
30
+
31
+ Full Changelog: [aws-sdk-v0.2.2...aws-sdk-v0.2.3](https://github.com/awts/awt-sdk-typescript/compare/aws-sdk-v0.2.2...aws-sdk-v0.2.3)
32
+
33
+ ### Chores
34
+
35
+ * **internal:** version bump ([eb97e85](https://github.com/awts/awt-sdk-typescript/commit/eb97e8577279fb150582297d2a0924a297185c3c))
36
+ * **internal:** version bump ([8ebaf61](https://github.com/awts/awt-sdk-typescript/commit/8ebaf616d2e5c6aebc153f19a403dde41ab5a9f1))
37
+
38
+ ## 0.2.2 (2026-04-07)
39
+
40
+ Full Changelog: [aws-sdk-v0.2.1...aws-sdk-v0.2.2](https://github.com/awts/awt-sdk-typescript/compare/aws-sdk-v0.2.1...aws-sdk-v0.2.2)
41
+
42
+ ### Chores
43
+
44
+ * **internal:** version bump ([eb97e85](https://github.com/awts/awt-sdk-typescript/commit/eb97e8577279fb150582297d2a0924a297185c3c))
45
+ * **internal:** version bump ([8ebaf61](https://github.com/awts/awt-sdk-typescript/commit/8ebaf616d2e5c6aebc153f19a403dde41ab5a9f1))
46
+
47
+ ## 0.2.1 (2026-04-03)
48
+
49
+ Full Changelog: [aws-sdk-v0.2.0...aws-sdk-v0.2.1](https://github.com/awts/awt-sdk-typescript/compare/aws-sdk-v0.2.0...aws-sdk-v0.2.1)
50
+
51
+ ### Chores
52
+
53
+ * **client:** internal updates ([3d64763](https://github.com/awts/awt-sdk-typescript/commit/3d6476315480508cff8462a5b4523944579dbd32))
54
+
55
+ ## 0.2.0 (2026-04-01)
56
+
57
+ Full Changelog: [aws-sdk-v0.1.0...aws-sdk-v0.2.0](https://github.com/awts/awt-sdk-typescript/compare/aws-sdk-v0.1.0...aws-sdk-v0.2.0)
58
+
59
+ ### Features
60
+
61
+ * prepare aws package ([#782](https://github.com/awts/awt-sdk-typescript/issues/782)) ([f351d4d](https://github.com/awts/awt-sdk-typescript/commit/f351d4dfeb57b48bcb126686dc608493813262da))
62
+
63
+
64
+ ### Chores
65
+
66
+ * **internal:** version bump ([eb97e85](https://github.com/awts/awt-sdk-typescript/commit/eb97e8577279fb150582297d2a0924a297185c3c))
67
+ * **internal:** version bump ([8ebaf61](https://github.com/awts/awt-sdk-typescript/commit/8ebaf616d2e5c6aebc153f19a403dde41ab5a9f1))
package/LICENSE ADDED
@@ -0,0 +1,8 @@
1
+ Copyright 2023 Awt, PBC.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8
+
package/README.md ADDED
File without changes
package/client.d.ts ADDED
@@ -0,0 +1,124 @@
1
+ import type { NullableHeaders } from './internal/headers';
2
+ import { Awt, ClientOptions } from '@awt_ai/sdk/client';
3
+ export { BaseAwt } from '@awt_ai/sdk/client';
4
+ import { AwsCredentialIdentityProvider } from '@smithy/types';
5
+ import { FinalRequestOptions } from './internal/request-options';
6
+ import { FinalizedRequestInit } from './internal/types';
7
+ export interface AwsClientOptions extends ClientOptions {
8
+ /**
9
+ * AWS region for the API gateway.
10
+ *
11
+ * Resolved by precedence: `awsRegion` arg > `AWS_REGION` env var >
12
+ * `AWS_DEFAULT_REGION` env var > region from the AWS shared config file
13
+ * (`~/.aws/config`) for the given `awsProfile` (or `[default]`).
14
+ *
15
+ * When resolution falls through to the config file, the region is loaded
16
+ * asynchronously. It will be available after `await client.ready` or the
17
+ * first request; until then `awsRegion` and `baseURL` are `undefined`.
18
+ */
19
+ awsRegion?: string | undefined;
20
+ /**
21
+ * API key for x-api-key authentication.
22
+ *
23
+ * Takes precedence over AWS credential options. If neither `apiKey` nor
24
+ * AWS credentials are provided, falls back to the `AWT_AWS_API_KEY`
25
+ * environment variable, then to the default AWS credential chain.
26
+ */
27
+ apiKey?: string | undefined;
28
+ /**
29
+ * AWS access key ID for SigV4 authentication.
30
+ *
31
+ * Must be provided together with `awsSecretAccessKey`.
32
+ */
33
+ awsAccessKey?: string | null | undefined;
34
+ /**
35
+ * AWS secret access key for SigV4 authentication.
36
+ *
37
+ * Must be provided together with `awsAccessKey`.
38
+ */
39
+ awsSecretAccessKey?: string | null | undefined;
40
+ /**
41
+ * AWS session token for temporary credentials.
42
+ */
43
+ awsSessionToken?: string | null | undefined;
44
+ /**
45
+ * AWS named profile for credential and region resolution.
46
+ *
47
+ * When set, credentials are loaded from the AWS credential chain using this
48
+ * profile, and the profile's `region` from `~/.aws/config` is used as a
49
+ * fallback when no region is provided via arg or environment variable.
50
+ */
51
+ awsProfile?: string | undefined;
52
+ /**
53
+ * Custom provider chain resolver for AWS credentials.
54
+ * Useful for non-Node environments, like edge workers, where the default
55
+ * credential provider chain may not work.
56
+ */
57
+ providerChainResolver?: (() => Promise<AwsCredentialIdentityProvider>) | null;
58
+ /**
59
+ * Workspace ID sent on every request as the `awt-workspace-id` header.
60
+ *
61
+ * Resolved by precedence: `workspaceId` arg > `AWT_AWS_WORKSPACE_ID` env var.
62
+ */
63
+ workspaceId?: string | undefined;
64
+ /**
65
+ * Skip authentication for requests. This is useful when you have a gateway
66
+ * or proxy that handles authentication on your behalf.
67
+ *
68
+ * @default false
69
+ */
70
+ skipAuth?: boolean;
71
+ }
72
+ /** API Client for interfacing with the Awt AWS API. */
73
+ export declare class AwtAws extends Awt {
74
+ awsRegion: string | undefined;
75
+ awsAccessKey: string | null;
76
+ awsSecretAccessKey: string | null;
77
+ awsSessionToken: string | null;
78
+ awsProfile: string | null;
79
+ providerChainResolver: (() => Promise<AwsCredentialIdentityProvider>) | null;
80
+ workspaceId: string | undefined;
81
+ skipAuth: boolean;
82
+ /**
83
+ * Resolves once the client is fully configured (region and base URL
84
+ * resolved). Rejects if region resolution fails. Await this to fail fast on
85
+ * misconfiguration instead of waiting for the first request.
86
+ */
87
+ readonly ready: Promise<void>;
88
+ private _useSigV4;
89
+ /**
90
+ * API Client for interfacing with the Awt AWS API.
91
+ *
92
+ * Auth is resolved by precedence: `apiKey` constructor arg > explicit AWS
93
+ * credentials > `awsProfile` > `AWT_AWS_API_KEY` env var > default
94
+ * AWS credential chain.
95
+ *
96
+ * @param {string | undefined} [opts.apiKey] - API key for x-api-key authentication.
97
+ * @param {string | null | undefined} [opts.awsAccessKey] - AWS access key ID for SigV4 authentication.
98
+ * @param {string | null | undefined} [opts.awsSecretAccessKey] - AWS secret access key for SigV4 authentication.
99
+ * @param {string | null | undefined} [opts.awsSessionToken] - AWS session token for temporary credentials.
100
+ * @param {string | undefined} [opts.awsProfile] - AWS named profile for credential and region resolution.
101
+ * @param {string | undefined} [opts.awsRegion] - AWS region. Resolved by precedence: arg > `AWS_REGION` env > `AWS_DEFAULT_REGION` env > `~/.aws/config`.
102
+ * @param {(() => Promise<AwsCredentialIdentityProvider>) | null} [opts.providerChainResolver] - Custom provider chain resolver for AWS credentials.
103
+ * @param {string | undefined} [opts.workspaceId] - Workspace ID sent as `awt-workspace-id` header. Resolved by precedence: arg > `AWT_AWS_WORKSPACE_ID` env var.
104
+ * @param {string} [opts.baseURL=process.env['AWT_AWS_BASE_URL'] ?? https://aws-external-awt.{awsRegion}.api.aws] - Override the default base URL for the API.
105
+ * @param {number} [opts.timeout=10 minutes] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
106
+ * @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
107
+ * @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
108
+ * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
109
+ * @param {HeadersLike} opts.defaultHeaders - Default headers to include with every request to the API.
110
+ * @param {Record<string, string | undefined>} opts.defaultQuery - Default query parameters to include with every request to the API.
111
+ * @param {boolean} [opts.dangerouslyAllowBrowser=false] - By default, client-side use of this library is not allowed, as it risks exposing your secret API credentials to attackers.
112
+ * @param {boolean} [opts.skipAuth=false] - Skip authentication for requests. This is useful when you have a gateway or proxy that handles authentication on your behalf.
113
+ */
114
+ constructor({ awsRegion, baseURL, apiKey, awsAccessKey, awsSecretAccessKey, awsSessionToken, awsProfile, providerChainResolver, workspaceId, skipAuth, ...opts }?: AwsClientOptions);
115
+ private _resolveRegionFromConfig;
116
+ protected prepareOptions(options: FinalRequestOptions): Promise<void>;
117
+ protected authHeaders(opts: FinalRequestOptions): Promise<NullableHeaders | undefined>;
118
+ protected validateHeaders(): void;
119
+ protected prepareRequest(request: FinalizedRequestInit, { url, options }: {
120
+ url: string;
121
+ options: FinalRequestOptions;
122
+ }): Promise<void>;
123
+ }
124
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAI1D,OAAO,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,6BAA6B,EAAE,MAAM,eAAe,CAAC;AAI9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAIxD,MAAM,WAAW,gBAAiB,SAAQ,aAAa;IACrD;;;;;;;;;;OAUG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG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BAAyB,EACzB,eAAsB,EACtB,UAAU,EACV,qBAA4B,EAC5B,WAAW,EACX,QAAgB,EAChB,GAAG,IAAI,EACR,GAAE,gBAAqB;IA6ExB,OAAO,CAAC,wBAAwB;cAeP,cAAc,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;cAK3D,WAAW,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC;cAclF,eAAe,IAAI,IAAI;cAIjB,cAAc,CACrC,OAAO,EAAE,oBAAoB,EAC7B,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,mBAAmB,CAAA;KAAE,GAC9D,OAAO,CAAC,IAAI,CAAC;CAsBjB"}
package/client.js ADDED
@@ -0,0 +1,198 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.AwtAws = exports.BaseAwt = void 0;
37
+ const headers_1 = require("./internal/headers.js");
38
+ const Errors = __importStar(require("./core/error.js"));
39
+ const utils_1 = require("./internal/utils/index.js");
40
+ const client_1 = require("@awt_ai/sdk/client");
41
+ var client_2 = require("@awt_ai/sdk/client");
42
+ Object.defineProperty(exports, "BaseAwt", { enumerable: true, get: function () { return client_2.BaseAwt; } });
43
+ const node_config_provider_1 = require("@smithy/node-config-provider");
44
+ const config_resolver_1 = require("@smithy/config-resolver");
45
+ const auth_1 = require("./core/auth.js");
46
+ const DEFAULT_SERVICE_NAME = 'aws-external-awt';
47
+ const noRegionError = () => new Errors.AwtError('No AWS region or base URL found. Set `awsRegion` in the constructor, the `AWS_REGION` / `AWS_DEFAULT_REGION` ' +
48
+ 'environment variable, configure a `region` for your profile in `~/.aws/config`, or provide a `baseURL` / ' +
49
+ '`AWT_AWS_BASE_URL` environment variable.');
50
+ /** API Client for interfacing with the Awt AWS API. */
51
+ class AwtAws extends client_1.Awt {
52
+ /**
53
+ * API Client for interfacing with the Awt AWS API.
54
+ *
55
+ * Auth is resolved by precedence: `apiKey` constructor arg > explicit AWS
56
+ * credentials > `awsProfile` > `AWT_AWS_API_KEY` env var > default
57
+ * AWS credential chain.
58
+ *
59
+ * @param {string | undefined} [opts.apiKey] - API key for x-api-key authentication.
60
+ * @param {string | null | undefined} [opts.awsAccessKey] - AWS access key ID for SigV4 authentication.
61
+ * @param {string | null | undefined} [opts.awsSecretAccessKey] - AWS secret access key for SigV4 authentication.
62
+ * @param {string | null | undefined} [opts.awsSessionToken] - AWS session token for temporary credentials.
63
+ * @param {string | undefined} [opts.awsProfile] - AWS named profile for credential and region resolution.
64
+ * @param {string | undefined} [opts.awsRegion] - AWS region. Resolved by precedence: arg > `AWS_REGION` env > `AWS_DEFAULT_REGION` env > `~/.aws/config`.
65
+ * @param {(() => Promise<AwsCredentialIdentityProvider>) | null} [opts.providerChainResolver] - Custom provider chain resolver for AWS credentials.
66
+ * @param {string | undefined} [opts.workspaceId] - Workspace ID sent as `awt-workspace-id` header. Resolved by precedence: arg > `AWT_AWS_WORKSPACE_ID` env var.
67
+ * @param {string} [opts.baseURL=process.env['AWT_AWS_BASE_URL'] ?? https://aws-external-awt.{awsRegion}.api.aws] - Override the default base URL for the API.
68
+ * @param {number} [opts.timeout=10 minutes] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
69
+ * @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
70
+ * @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
71
+ * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
72
+ * @param {HeadersLike} opts.defaultHeaders - Default headers to include with every request to the API.
73
+ * @param {Record<string, string | undefined>} opts.defaultQuery - Default query parameters to include with every request to the API.
74
+ * @param {boolean} [opts.dangerouslyAllowBrowser=false] - By default, client-side use of this library is not allowed, as it risks exposing your secret API credentials to attackers.
75
+ * @param {boolean} [opts.skipAuth=false] - Skip authentication for requests. This is useful when you have a gateway or proxy that handles authentication on your behalf.
76
+ */
77
+ constructor({ awsRegion, baseURL, apiKey, awsAccessKey = null, awsSecretAccessKey = null, awsSessionToken = null, awsProfile, providerChainResolver = null, workspaceId, skipAuth = false, ...opts } = {}) {
78
+ // Region resolution: arg > AWS_REGION env > AWS_DEFAULT_REGION env > ~/.aws/config (async).
79
+ // The first three are resolved here; config-file fallback is kicked off below and
80
+ // awaited on `ready` / first request.
81
+ const syncRegion = awsRegion ?? (0, utils_1.readEnv)('AWS_REGION') ?? (0, utils_1.readEnv)('AWS_DEFAULT_REGION');
82
+ const explicitBaseURL = baseURL ?? (0, utils_1.readEnv)('AWT_AWS_BASE_URL');
83
+ let resolvedBaseURL;
84
+ if (explicitBaseURL) {
85
+ resolvedBaseURL = explicitBaseURL;
86
+ }
87
+ else if (syncRegion) {
88
+ resolvedBaseURL = `https://aws-external-awt.${syncRegion}.api.aws`;
89
+ }
90
+ else {
91
+ // No region known yet (or skipAuth) — will be resolved async from ~/.aws/config,
92
+ // or is not needed at all.
93
+ resolvedBaseURL = undefined;
94
+ }
95
+ // Precedence-based auth resolution:
96
+ // 1. apiKey constructor arg
97
+ // 2. awsAccessKey/awsSecretAccessKey constructor args (SigV4)
98
+ // 3. awsProfile constructor arg (SigV4)
99
+ // 4. AWT_AWS_API_KEY env var
100
+ // 5. Default AWS credential chain (SigV4)
101
+ const hasExplicitApiKey = apiKey != null;
102
+ const hasPartialAwsCreds = (awsAccessKey != null) !== (awsSecretAccessKey != null);
103
+ if (hasPartialAwsCreds) {
104
+ throw new Errors.AwtError('`awsAccessKey` and `awsSecretAccessKey` must be provided together. You provided only one.');
105
+ }
106
+ const hasExplicitAwsCreds = awsAccessKey != null && awsSecretAccessKey != null;
107
+ const hasAwsProfile = awsProfile != null;
108
+ let resolvedApiKey;
109
+ if (hasExplicitApiKey) {
110
+ resolvedApiKey = apiKey;
111
+ }
112
+ else if (!hasExplicitAwsCreds && !hasAwsProfile) {
113
+ resolvedApiKey = (0, utils_1.readEnv)('AWT_AWS_API_KEY') ?? undefined;
114
+ }
115
+ const resolvedWorkspaceId = workspaceId ?? (0, utils_1.readEnv)('AWT_AWS_WORKSPACE_ID');
116
+ if (!resolvedWorkspaceId && !skipAuth) {
117
+ throw new Errors.AwtError('No workspace ID found. Set `workspaceId` in the constructor or the `AWT_AWS_WORKSPACE_ID` environment variable.');
118
+ }
119
+ super({
120
+ apiKey: resolvedApiKey,
121
+ baseURL: resolvedBaseURL,
122
+ ...opts,
123
+ defaultHeaders: (0, headers_1.buildHeaders)([{ 'awt-workspace-id': resolvedWorkspaceId }, opts.defaultHeaders]),
124
+ });
125
+ this.skipAuth = false;
126
+ this.awsRegion = syncRegion;
127
+ this.awsAccessKey = awsAccessKey;
128
+ this.awsSecretAccessKey = awsSecretAccessKey;
129
+ this.awsSessionToken = awsSessionToken;
130
+ this.awsProfile = awsProfile ?? null;
131
+ this.providerChainResolver = providerChainResolver;
132
+ this.workspaceId = resolvedWorkspaceId;
133
+ this.skipAuth = skipAuth;
134
+ this._useSigV4 = resolvedApiKey == null;
135
+ if (syncRegion || explicitBaseURL || skipAuth) {
136
+ this.ready = Promise.resolve();
137
+ }
138
+ else {
139
+ this.ready = this._resolveRegionFromConfig(awsProfile).then((region) => {
140
+ this.awsRegion = region;
141
+ this.baseURL = `https://aws-external-awt.${region}.api.aws`;
142
+ });
143
+ // Suppress unhandledRejection; the error surfaces via `await ready` or the first request.
144
+ this.ready.catch(() => { });
145
+ }
146
+ }
147
+ _resolveRegionFromConfig(profile) {
148
+ return (0, node_config_provider_1.loadConfig)({
149
+ ...config_resolver_1.NODE_REGION_CONFIG_OPTIONS,
150
+ default: () => {
151
+ throw noRegionError();
152
+ },
153
+ }, {
154
+ ...config_resolver_1.NODE_REGION_CONFIG_FILE_OPTIONS,
155
+ ...(profile && { profile }),
156
+ })();
157
+ }
158
+ async prepareOptions(options) {
159
+ await super.prepareOptions(options);
160
+ await this.ready;
161
+ }
162
+ async authHeaders(opts) {
163
+ if (this.skipAuth) {
164
+ return undefined;
165
+ }
166
+ if (!this._useSigV4) {
167
+ // API key mode — use inherited x-api-key auth
168
+ return super.authHeaders(opts);
169
+ }
170
+ // SigV4 mode — auth is handled in prepareRequest since it needs the full request
171
+ return undefined;
172
+ }
173
+ validateHeaders() {
174
+ // Auth validation is handled in the constructor and prepareRequest
175
+ }
176
+ async prepareRequest(request, { url, options }) {
177
+ if (this.skipAuth || !this._useSigV4) {
178
+ return;
179
+ }
180
+ if (!this.awsRegion) {
181
+ // Only reachable when an explicit baseURL was provided without a region.
182
+ throw noRegionError();
183
+ }
184
+ const headers = await (0, auth_1.getAuthHeaders)(request, {
185
+ url,
186
+ regionName: this.awsRegion,
187
+ serviceName: DEFAULT_SERVICE_NAME,
188
+ awsAccessKey: this.awsAccessKey,
189
+ awsSecretAccessKey: this.awsSecretAccessKey,
190
+ awsSessionToken: this.awsSessionToken,
191
+ awsProfile: this.awsProfile,
192
+ providerChainResolver: this.providerChainResolver,
193
+ });
194
+ request.headers = (0, headers_1.buildHeaders)([headers, request.headers]).values;
195
+ }
196
+ }
197
+ exports.AwtAws = AwtAws;
198
+ //# sourceMappingURL=client.js.map
package/client.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["src/client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,mDAAkD;AAClD,wDAAuC;AACvC,qDAA2C;AAC3C,+CAAwD;AACxD,6CAA6C;AAApC,iGAAA,OAAO,OAAA;AAEhB,uEAA0D;AAC1D,6DAAsG;AACtG,yCAA6C;AAI7C,MAAM,oBAAoB,GAAG,kBAAkB,CAAC;AA4EhD,MAAM,aAAa,GAAG,GAAG,EAAE,CACzB,IAAI,MAAM,CAAC,QAAQ,CACjB,+GAA+G;IAC7G,2GAA2G;IAC3G,0CAA0C,CAC7C,CAAC;AAEJ,uDAAuD;AACvD,MAAa,MAAO,SAAQ,YAAG;IAmB7B;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,YAAY,EACV,SAAS,EACT,OAAO,EACP,MAAM,EACN,YAAY,GAAG,IAAI,EACnB,kBAAkB,GAAG,IAAI,EACzB,eAAe,GAAG,IAAI,EACtB,UAAU,EACV,qBAAqB,GAAG,IAAI,EAC5B,WAAW,EACX,QAAQ,GAAG,KAAK,EAChB,GAAG,IAAI,KACa,EAAE;QACtB,4FAA4F;QAC5F,kFAAkF;QAClF,sCAAsC;QACtC,MAAM,UAAU,GAAG,SAAS,IAAI,IAAA,eAAO,EAAC,YAAY,CAAC,IAAI,IAAA,eAAO,EAAC,oBAAoB,CAAC,CAAC;QAEvF,M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C,eAAe;YACrC,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,qBAAqB,EAAE,IAAI,CAAC,qBAAqB;SAClD,CAAC,CAAC;QACH,OAAO,CAAC,OAAO,GAAG,IAAA,sBAAY,EAAC,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;IACpE,CAAC;CACF;AApMD,wBAoMC"}
package/client.mjs ADDED
@@ -0,0 +1,160 @@
1
+ import { buildHeaders } from "./internal/headers.mjs";
2
+ import * as Errors from "./core/error.mjs";
3
+ import { readEnv } from "./internal/utils/index.mjs";
4
+ import { Awt } from '@awt_ai/sdk/client';
5
+ export { BaseAwt } from '@awt_ai/sdk/client';
6
+ import { loadConfig } from '@smithy/node-config-provider';
7
+ import { NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS } from '@smithy/config-resolver';
8
+ import { getAuthHeaders } from "./core/auth.mjs";
9
+ const DEFAULT_SERVICE_NAME = 'aws-external-awt';
10
+ const noRegionError = () => new Errors.AwtError('No AWS region or base URL found. Set `awsRegion` in the constructor, the `AWS_REGION` / `AWS_DEFAULT_REGION` ' +
11
+ 'environment variable, configure a `region` for your profile in `~/.aws/config`, or provide a `baseURL` / ' +
12
+ '`AWT_AWS_BASE_URL` environment variable.');
13
+ /** API Client for interfacing with the Awt AWS API. */
14
+ export class AwtAws extends Awt {
15
+ /**
16
+ * API Client for interfacing with the Awt AWS API.
17
+ *
18
+ * Auth is resolved by precedence: `apiKey` constructor arg > explicit AWS
19
+ * credentials > `awsProfile` > `AWT_AWS_API_KEY` env var > default
20
+ * AWS credential chain.
21
+ *
22
+ * @param {string | undefined} [opts.apiKey] - API key for x-api-key authentication.
23
+ * @param {string | null | undefined} [opts.awsAccessKey] - AWS access key ID for SigV4 authentication.
24
+ * @param {string | null | undefined} [opts.awsSecretAccessKey] - AWS secret access key for SigV4 authentication.
25
+ * @param {string | null | undefined} [opts.awsSessionToken] - AWS session token for temporary credentials.
26
+ * @param {string | undefined} [opts.awsProfile] - AWS named profile for credential and region resolution.
27
+ * @param {string | undefined} [opts.awsRegion] - AWS region. Resolved by precedence: arg > `AWS_REGION` env > `AWS_DEFAULT_REGION` env > `~/.aws/config`.
28
+ * @param {(() => Promise<AwsCredentialIdentityProvider>) | null} [opts.providerChainResolver] - Custom provider chain resolver for AWS credentials.
29
+ * @param {string | undefined} [opts.workspaceId] - Workspace ID sent as `awt-workspace-id` header. Resolved by precedence: arg > `AWT_AWS_WORKSPACE_ID` env var.
30
+ * @param {string} [opts.baseURL=process.env['AWT_AWS_BASE_URL'] ?? https://aws-external-awt.{awsRegion}.api.aws] - Override the default base URL for the API.
31
+ * @param {number} [opts.timeout=10 minutes] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
32
+ * @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
33
+ * @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
34
+ * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
35
+ * @param {HeadersLike} opts.defaultHeaders - Default headers to include with every request to the API.
36
+ * @param {Record<string, string | undefined>} opts.defaultQuery - Default query parameters to include with every request to the API.
37
+ * @param {boolean} [opts.dangerouslyAllowBrowser=false] - By default, client-side use of this library is not allowed, as it risks exposing your secret API credentials to attackers.
38
+ * @param {boolean} [opts.skipAuth=false] - Skip authentication for requests. This is useful when you have a gateway or proxy that handles authentication on your behalf.
39
+ */
40
+ constructor({ awsRegion, baseURL, apiKey, awsAccessKey = null, awsSecretAccessKey = null, awsSessionToken = null, awsProfile, providerChainResolver = null, workspaceId, skipAuth = false, ...opts } = {}) {
41
+ // Region resolution: arg > AWS_REGION env > AWS_DEFAULT_REGION env > ~/.aws/config (async).
42
+ // The first three are resolved here; config-file fallback is kicked off below and
43
+ // awaited on `ready` / first request.
44
+ const syncRegion = awsRegion ?? readEnv('AWS_REGION') ?? readEnv('AWS_DEFAULT_REGION');
45
+ const explicitBaseURL = baseURL ?? readEnv('AWT_AWS_BASE_URL');
46
+ let resolvedBaseURL;
47
+ if (explicitBaseURL) {
48
+ resolvedBaseURL = explicitBaseURL;
49
+ }
50
+ else if (syncRegion) {
51
+ resolvedBaseURL = `https://aws-external-awt.${syncRegion}.api.aws`;
52
+ }
53
+ else {
54
+ // No region known yet (or skipAuth) — will be resolved async from ~/.aws/config,
55
+ // or is not needed at all.
56
+ resolvedBaseURL = undefined;
57
+ }
58
+ // Precedence-based auth resolution:
59
+ // 1. apiKey constructor arg
60
+ // 2. awsAccessKey/awsSecretAccessKey constructor args (SigV4)
61
+ // 3. awsProfile constructor arg (SigV4)
62
+ // 4. AWT_AWS_API_KEY env var
63
+ // 5. Default AWS credential chain (SigV4)
64
+ const hasExplicitApiKey = apiKey != null;
65
+ const hasPartialAwsCreds = (awsAccessKey != null) !== (awsSecretAccessKey != null);
66
+ if (hasPartialAwsCreds) {
67
+ throw new Errors.AwtError('`awsAccessKey` and `awsSecretAccessKey` must be provided together. You provided only one.');
68
+ }
69
+ const hasExplicitAwsCreds = awsAccessKey != null && awsSecretAccessKey != null;
70
+ const hasAwsProfile = awsProfile != null;
71
+ let resolvedApiKey;
72
+ if (hasExplicitApiKey) {
73
+ resolvedApiKey = apiKey;
74
+ }
75
+ else if (!hasExplicitAwsCreds && !hasAwsProfile) {
76
+ resolvedApiKey = readEnv('AWT_AWS_API_KEY') ?? undefined;
77
+ }
78
+ const resolvedWorkspaceId = workspaceId ?? readEnv('AWT_AWS_WORKSPACE_ID');
79
+ if (!resolvedWorkspaceId && !skipAuth) {
80
+ throw new Errors.AwtError('No workspace ID found. Set `workspaceId` in the constructor or the `AWT_AWS_WORKSPACE_ID` environment variable.');
81
+ }
82
+ super({
83
+ apiKey: resolvedApiKey,
84
+ baseURL: resolvedBaseURL,
85
+ ...opts,
86
+ defaultHeaders: buildHeaders([{ 'awt-workspace-id': resolvedWorkspaceId }, opts.defaultHeaders]),
87
+ });
88
+ this.skipAuth = false;
89
+ this.awsRegion = syncRegion;
90
+ this.awsAccessKey = awsAccessKey;
91
+ this.awsSecretAccessKey = awsSecretAccessKey;
92
+ this.awsSessionToken = awsSessionToken;
93
+ this.awsProfile = awsProfile ?? null;
94
+ this.providerChainResolver = providerChainResolver;
95
+ this.workspaceId = resolvedWorkspaceId;
96
+ this.skipAuth = skipAuth;
97
+ this._useSigV4 = resolvedApiKey == null;
98
+ if (syncRegion || explicitBaseURL || skipAuth) {
99
+ this.ready = Promise.resolve();
100
+ }
101
+ else {
102
+ this.ready = this._resolveRegionFromConfig(awsProfile).then((region) => {
103
+ this.awsRegion = region;
104
+ this.baseURL = `https://aws-external-awt.${region}.api.aws`;
105
+ });
106
+ // Suppress unhandledRejection; the error surfaces via `await ready` or the first request.
107
+ this.ready.catch(() => { });
108
+ }
109
+ }
110
+ _resolveRegionFromConfig(profile) {
111
+ return loadConfig({
112
+ ...NODE_REGION_CONFIG_OPTIONS,
113
+ default: () => {
114
+ throw noRegionError();
115
+ },
116
+ }, {
117
+ ...NODE_REGION_CONFIG_FILE_OPTIONS,
118
+ ...(profile && { profile }),
119
+ })();
120
+ }
121
+ async prepareOptions(options) {
122
+ await super.prepareOptions(options);
123
+ await this.ready;
124
+ }
125
+ async authHeaders(opts) {
126
+ if (this.skipAuth) {
127
+ return undefined;
128
+ }
129
+ if (!this._useSigV4) {
130
+ // API key mode — use inherited x-api-key auth
131
+ return super.authHeaders(opts);
132
+ }
133
+ // SigV4 mode — auth is handled in prepareRequest since it needs the full request
134
+ return undefined;
135
+ }
136
+ validateHeaders() {
137
+ // Auth validation is handled in the constructor and prepareRequest
138
+ }
139
+ async prepareRequest(request, { url, options }) {
140
+ if (this.skipAuth || !this._useSigV4) {
141
+ return;
142
+ }
143
+ if (!this.awsRegion) {
144
+ // Only reachable when an explicit baseURL was provided without a region.
145
+ throw noRegionError();
146
+ }
147
+ const headers = await getAuthHeaders(request, {
148
+ url,
149
+ regionName: this.awsRegion,
150
+ serviceName: DEFAULT_SERVICE_NAME,
151
+ awsAccessKey: this.awsAccessKey,
152
+ awsSecretAccessKey: this.awsSecretAccessKey,
153
+ awsSessionToken: this.awsSessionToken,
154
+ awsProfile: this.awsProfile,
155
+ providerChainResolver: this.providerChainResolver,
156
+ });
157
+ request.headers = buildHeaders([headers, request.headers]).values;
158
+ }
159
+ }
160
+ //# sourceMappingURL=client.mjs.map
package/client.mjs.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.mjs","sourceRoot":"","sources":["src/client.ts"],"names":[],"mappings":"OACO,EAAE,YAAY,EAAE;OAChB,KAAK,MAAM;OACX,EAAE,OAAO,EAAE;OACX,EAAE,GAAG,EAAiB,MAAM,oBAAoB;OAChD,EAAE,OAAO,EAAE,MAAM,oBAAoB;OAErC,EAAE,UAAU,EAAE,MAAM,8BAA8B;OAClD,EAAE,0BAA0B,EAAE,+BAA+B,EAAE,MAAM,yBAAyB;OAC9F,EAAE,cAAc,EAAE;AAIzB,MAAM,oBAAoB,GAAG,kBAAkB,CAAC;AA4EhD,MAAM,aAAa,GAAG,GAAG,EAAE,CACzB,IAAI,MAAM,CAAC,QAAQ,CACjB,+GAA+G;IAC7G,2GAA2G;IAC3G,0CAA0C,CAC7C,CAAC;AAEJ,uDAAuD;AACvD,MAAM,OAAO,MAAO,SAAQ,GAAG;IAmB7B;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,YAAY,EACV,SAAS,EACT,OAAO,EACP,MAAM,EACN,YAAY,GAAG,IAAI,EACnB,kBAAkB,GAAG,IAAI,EACzB,eAAe,GAAG,IAAI,EACtB,UAAU,EACV,qBAAqB,GAAG,IAAI,EAC5B,WAAW,EACX,QAAQ,GAAG,KAAK,EAChB,GAAG,IAAI,KACa,EAAE;QACtB,4FAA4F;QAC5F,kFAAkF;QAClF,sCAAsC;QACtC,MAAM,UAAU,GAAG,SAAS,IAAI,OAAO,CAAC,YAAY,CAAC,IAAI,OAAO,CAAC,oBAAoB,CAAC,CAAC;QAEvF,MAAM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;YAC3B,qBAAqB,EAAE,IAAI,CAAC,qBAAqB;SAClD,CAAC,CAAC;QACH,OAAO,CAAC,OAAO,GAAG,YAAY,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;IACpE,CAAC;CACF"}
package/core/auth.d.ts ADDED
@@ -0,0 +1,15 @@
1
+ import { AwsCredentialIdentityProvider } from '@smithy/types';
2
+ import { MergedRequestInit } from '../internal/types';
3
+ export type AuthProps = {
4
+ url: string;
5
+ regionName: string;
6
+ serviceName: string;
7
+ awsAccessKey: string | null | undefined;
8
+ awsSecretAccessKey: string | null | undefined;
9
+ awsSessionToken: string | null | undefined;
10
+ awsProfile?: string | null | undefined;
11
+ fetchOptions?: MergedRequestInit | undefined;
12
+ providerChainResolver?: (() => Promise<AwsCredentialIdentityProvider>) | null;
13
+ };
14
+ export declare const getAuthHeaders: (req: RequestInit, props: AuthProps) => Promise<Record<string, string>>;
15
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/core/auth.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,6BAA6B,EAAE,MAAM,eAAe,CAAC;AAE9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,MAAM,SAAS,GAAG;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACxC,kBAAkB,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAC9C,eAAe,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAC3C,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACvC,YAAY,CAAC,EAAE,iBAAiB,GAAG,SAAS,CAAC;IAC7C,qBAAqB,CAAC,EAAE,CAAC,MAAM,OAAO,CAAC,6BAA6B,CAAC,CAAC,GAAG,IAAI,CAAC;CAC/E,CAAC;AA2BF,eAAO,MAAM,cAAc,GAAU,KAAK,WAAW,EAAE,OAAO,SAAS,KAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAuDvG,CAAC"}