@awt_ai/aws-sdk 0.3.0 → 0.3.1

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/client.d.mts +124 -0
  2. package/client.d.mts.map +1 -0
  3. package/client.d.ts +3 -3
  4. package/client.d.ts.map +1 -1
  5. package/client.js +16 -2
  6. package/client.js.map +1 -1
  7. package/client.mjs +16 -2
  8. package/client.mjs.map +1 -1
  9. package/core/auth.d.mts +15 -0
  10. package/core/auth.d.mts.map +1 -0
  11. package/core/auth.d.ts +1 -1
  12. package/core/auth.d.ts.map +1 -1
  13. package/core/error.d.mts +2 -0
  14. package/core/error.d.mts.map +1 -0
  15. package/core/error.d.ts.map +1 -1
  16. package/core/pagination.d.mts +2 -0
  17. package/core/pagination.d.mts.map +1 -0
  18. package/core/pagination.d.ts.map +1 -1
  19. package/core/streaming.d.mts +2 -0
  20. package/core/streaming.d.mts.map +1 -0
  21. package/core/streaming.d.ts.map +1 -1
  22. package/index.d.mts +4 -0
  23. package/index.d.mts.map +1 -0
  24. package/index.d.ts +3 -3
  25. package/index.d.ts.map +1 -1
  26. package/index.js +3 -0
  27. package/internal/builtin-types.d.mts +73 -0
  28. package/internal/builtin-types.d.mts.map +1 -0
  29. package/internal/constants.d.mts +5 -0
  30. package/internal/constants.d.mts.map +1 -0
  31. package/internal/decoders/jsonl.d.mts +10 -0
  32. package/internal/decoders/jsonl.d.mts.map +1 -0
  33. package/internal/decoders/jsonl.d.ts +1 -1
  34. package/internal/decoders/jsonl.d.ts.map +1 -1
  35. package/internal/decoders/jsonl.js +2 -0
  36. package/internal/decoders/jsonl.js.map +1 -1
  37. package/internal/decoders/jsonl.mjs +2 -0
  38. package/internal/decoders/jsonl.mjs.map +1 -1
  39. package/internal/decoders/line.d.mts +17 -0
  40. package/internal/decoders/line.d.mts.map +1 -0
  41. package/internal/decoders/line.js +21 -34
  42. package/internal/decoders/line.js.map +1 -1
  43. package/internal/decoders/line.mjs +21 -34
  44. package/internal/decoders/line.mjs.map +1 -1
  45. package/internal/errors.d.mts +3 -0
  46. package/internal/errors.d.mts.map +1 -0
  47. package/internal/headers.d.mts +22 -0
  48. package/internal/headers.d.mts.map +1 -0
  49. package/internal/parse.d.mts +17 -0
  50. package/internal/parse.d.mts.map +1 -0
  51. package/internal/parse.d.ts +3 -3
  52. package/internal/parse.d.ts.map +1 -1
  53. package/internal/qs/formats.d.mts +7 -0
  54. package/internal/qs/formats.d.mts.map +1 -0
  55. package/internal/qs/formats.d.ts +1 -1
  56. package/internal/qs/formats.d.ts.map +1 -1
  57. package/internal/qs/index.d.mts +10 -0
  58. package/internal/qs/index.d.mts.map +1 -0
  59. package/internal/qs/index.d.ts +2 -2
  60. package/internal/qs/index.d.ts.map +1 -1
  61. package/internal/qs/stringify.d.mts +3 -0
  62. package/internal/qs/stringify.d.mts.map +1 -0
  63. package/internal/qs/stringify.d.ts +1 -1
  64. package/internal/qs/stringify.d.ts.map +1 -1
  65. package/internal/qs/stringify.js +1 -1
  66. package/internal/qs/stringify.js.map +1 -1
  67. package/internal/qs/stringify.mjs +1 -1
  68. package/internal/qs/stringify.mjs.map +1 -1
  69. package/internal/qs/types.d.mts +57 -0
  70. package/internal/qs/types.d.mts.map +1 -0
  71. package/internal/qs/utils.d.mts +15 -0
  72. package/internal/qs/utils.d.mts.map +1 -0
  73. package/internal/qs/utils.d.ts +1 -1
  74. package/internal/qs/utils.d.ts.map +1 -1
  75. package/internal/request-options.d.mts +77 -0
  76. package/internal/request-options.d.mts.map +1 -0
  77. package/internal/request-options.d.ts +5 -5
  78. package/internal/request-options.d.ts.map +1 -1
  79. package/internal/shim-types.d.mts +17 -0
  80. package/internal/shim-types.d.mts.map +1 -0
  81. package/internal/shims.d.mts +20 -0
  82. package/internal/shims.d.mts.map +1 -0
  83. package/internal/shims.d.ts +2 -8
  84. package/internal/shims.d.ts.map +1 -1
  85. package/internal/stream-utils.d.mts +8 -0
  86. package/internal/stream-utils.d.mts.map +1 -0
  87. package/internal/to-file.d.mts +45 -0
  88. package/internal/to-file.d.mts.map +1 -0
  89. package/internal/to-file.d.ts +1 -1
  90. package/internal/to-file.d.ts.map +1 -1
  91. package/internal/to-file.js +2 -2
  92. package/internal/to-file.js.map +1 -1
  93. package/internal/to-file.mjs +2 -2
  94. package/internal/to-file.mjs.map +1 -1
  95. package/internal/types.d.mts +69 -0
  96. package/internal/types.d.mts.map +1 -0
  97. package/internal/types.d.ts +12 -6
  98. package/internal/uploads.d.mts +42 -0
  99. package/internal/uploads.d.mts.map +1 -0
  100. package/internal/uploads.d.ts +3 -3
  101. package/internal/uploads.d.ts.map +1 -1
  102. package/internal/utils/base64.d.mts +3 -0
  103. package/internal/utils/base64.d.mts.map +1 -0
  104. package/internal/utils/bytes.d.mts +4 -0
  105. package/internal/utils/bytes.d.mts.map +1 -0
  106. package/internal/utils/env.d.mts +9 -0
  107. package/internal/utils/env.d.mts.map +1 -0
  108. package/internal/utils/log.d.mts +37 -0
  109. package/internal/utils/log.d.mts.map +1 -0
  110. package/internal/utils/log.d.ts +2 -2
  111. package/internal/utils/log.d.ts.map +1 -1
  112. package/internal/utils/path.d.mts +15 -0
  113. package/internal/utils/path.d.mts.map +1 -0
  114. package/internal/utils/query.d.mts +2 -0
  115. package/internal/utils/query.d.mts.map +1 -0
  116. package/internal/utils/sleep.d.mts +2 -0
  117. package/internal/utils/sleep.d.mts.map +1 -0
  118. package/internal/utils/time.d.mts +3 -0
  119. package/internal/utils/time.d.mts.map +1 -0
  120. package/internal/utils/uuid.d.mts +5 -0
  121. package/internal/utils/uuid.d.mts.map +1 -0
  122. package/internal/utils/values.d.mts +19 -0
  123. package/internal/utils/values.d.mts.map +1 -0
  124. package/internal/utils.d.mts +8 -0
  125. package/internal/utils.d.mts.map +1 -0
  126. package/internal/utils.d.ts +7 -7
  127. package/internal/utils.d.ts.map +1 -1
  128. package/package.json +39 -12
  129. package/src/client.d.ts +124 -0
  130. package/src/client.d.ts.map +1 -0
  131. package/src/client.js +198 -0
  132. package/src/client.js.map +1 -0
  133. package/src/client.mjs +160 -0
  134. package/src/client.mjs.map +1 -0
  135. package/src/core/auth.d.ts +15 -0
  136. package/src/core/auth.d.ts.map +1 -0
  137. package/src/core/auth.js +113 -0
  138. package/src/core/auth.js.map +1 -0
  139. package/src/core/auth.mjs +73 -0
  140. package/src/core/auth.mjs.map +1 -0
  141. package/src/core/error.d.ts +2 -0
  142. package/src/core/error.d.ts.map +1 -0
  143. package/src/core/error.js +18 -0
  144. package/src/core/error.js.map +1 -0
  145. package/src/core/error.mjs +2 -0
  146. package/src/core/error.mjs.map +1 -0
  147. package/src/core/pagination.d.ts +2 -0
  148. package/src/core/pagination.d.ts.map +1 -0
  149. package/src/core/pagination.js +18 -0
  150. package/src/core/pagination.js.map +1 -0
  151. package/src/core/pagination.mjs +2 -0
  152. package/src/core/pagination.mjs.map +1 -0
  153. package/src/core/streaming.d.ts +2 -0
  154. package/src/core/streaming.d.ts.map +1 -0
  155. package/src/core/streaming.js +18 -0
  156. package/src/core/streaming.js.map +1 -0
  157. package/src/core/streaming.mjs +2 -0
  158. package/src/core/streaming.mjs.map +1 -0
  159. package/src/internal/builtin-types.d.ts +73 -0
  160. package/src/internal/builtin-types.d.ts.map +1 -0
  161. package/src/internal/builtin-types.js +4 -0
  162. package/src/internal/builtin-types.js.map +1 -0
  163. package/src/internal/builtin-types.mjs +3 -0
  164. package/src/internal/builtin-types.mjs.map +1 -0
  165. package/src/internal/headers.d.ts +22 -0
  166. package/src/internal/headers.d.ts.map +1 -0
  167. package/src/internal/headers.js +79 -0
  168. package/src/internal/headers.js.map +1 -0
  169. package/src/internal/headers.mjs +74 -0
  170. package/src/internal/headers.mjs.map +1 -0
  171. package/src/internal/qs/formats.d.ts +7 -0
  172. package/src/internal/qs/formats.d.ts.map +1 -0
  173. package/src/internal/qs/formats.js +13 -0
  174. package/src/internal/qs/formats.js.map +1 -0
  175. package/src/internal/qs/formats.mjs +9 -0
  176. package/src/internal/qs/formats.mjs.map +1 -0
  177. package/src/internal/qs/stringify.d.ts +3 -0
  178. package/src/internal/qs/stringify.d.ts.map +1 -0
  179. package/src/internal/qs/stringify.js +277 -0
  180. package/src/internal/qs/stringify.js.map +1 -0
  181. package/src/internal/qs/stringify.mjs +274 -0
  182. package/src/internal/qs/stringify.mjs.map +1 -0
  183. package/src/internal/qs/types.d.ts +57 -0
  184. package/src/internal/qs/types.d.ts.map +1 -0
  185. package/src/internal/qs/types.js +3 -0
  186. package/src/internal/qs/types.js.map +1 -0
  187. package/src/internal/qs/types.mjs +2 -0
  188. package/src/internal/qs/types.mjs.map +1 -0
  189. package/src/internal/qs/utils.d.ts +15 -0
  190. package/src/internal/qs/utils.d.ts.map +1 -0
  191. package/src/internal/qs/utils.js +230 -0
  192. package/src/internal/qs/utils.js.map +1 -0
  193. package/src/internal/qs/utils.mjs +217 -0
  194. package/src/internal/qs/utils.mjs.map +1 -0
  195. package/src/internal/request-options.d.ts +77 -0
  196. package/src/internal/request-options.d.ts.map +1 -0
  197. package/src/internal/request-options.js +14 -0
  198. package/src/internal/request-options.js.map +1 -0
  199. package/src/internal/request-options.mjs +10 -0
  200. package/src/internal/request-options.mjs.map +1 -0
  201. package/src/internal/types.d.ts +69 -0
  202. package/src/internal/types.d.ts.map +1 -0
  203. package/src/internal/types.js +4 -0
  204. package/src/internal/types.js.map +1 -0
  205. package/src/internal/types.mjs +3 -0
  206. package/src/internal/types.mjs.map +1 -0
  207. package/src/internal/utils/base64.d.ts +3 -0
  208. package/src/internal/utils/base64.d.ts.map +1 -0
  209. package/src/internal/utils/base64.js +38 -0
  210. package/src/internal/utils/base64.js.map +1 -0
  211. package/src/internal/utils/base64.mjs +33 -0
  212. package/src/internal/utils/base64.mjs.map +1 -0
  213. package/src/internal/utils/bytes.d.ts +4 -0
  214. package/src/internal/utils/bytes.d.ts.map +1 -0
  215. package/src/internal/utils/bytes.js +31 -0
  216. package/src/internal/utils/bytes.js.map +1 -0
  217. package/src/internal/utils/bytes.mjs +26 -0
  218. package/src/internal/utils/bytes.mjs.map +1 -0
  219. package/src/internal/utils/env.d.ts +9 -0
  220. package/src/internal/utils/env.d.ts.map +1 -0
  221. package/src/internal/utils/env.js +22 -0
  222. package/src/internal/utils/env.js.map +1 -0
  223. package/src/internal/utils/env.mjs +18 -0
  224. package/src/internal/utils/env.mjs.map +1 -0
  225. package/src/internal/utils/log.d.ts +37 -0
  226. package/src/internal/utils/log.d.ts.map +1 -0
  227. package/src/internal/utils/log.js +87 -0
  228. package/src/internal/utils/log.js.map +1 -0
  229. package/src/internal/utils/log.mjs +81 -0
  230. package/src/internal/utils/log.mjs.map +1 -0
  231. package/src/internal/utils/query.d.ts +2 -0
  232. package/src/internal/utils/query.d.ts.map +1 -0
  233. package/src/internal/utils/query.js +42 -0
  234. package/src/internal/utils/query.js.map +1 -0
  235. package/src/internal/utils/query.mjs +6 -0
  236. package/src/internal/utils/query.mjs.map +1 -0
  237. package/src/internal/utils/sleep.d.ts +2 -0
  238. package/src/internal/utils/sleep.d.ts.map +1 -0
  239. package/src/internal/utils/sleep.js +7 -0
  240. package/src/internal/utils/sleep.js.map +1 -0
  241. package/src/internal/utils/sleep.mjs +3 -0
  242. package/src/internal/utils/sleep.mjs.map +1 -0
  243. package/src/internal/utils/uuid.d.ts +5 -0
  244. package/src/internal/utils/uuid.d.ts.map +1 -0
  245. package/src/internal/utils/uuid.js +19 -0
  246. package/src/internal/utils/uuid.js.map +1 -0
  247. package/src/internal/utils/uuid.mjs +15 -0
  248. package/src/internal/utils/uuid.mjs.map +1 -0
  249. package/src/internal/utils/values.d.ts +19 -0
  250. package/src/internal/utils/values.d.ts.map +1 -0
  251. package/src/internal/utils/values.js +119 -0
  252. package/src/internal/utils/values.js.map +1 -0
  253. package/src/internal/utils/values.mjs +100 -0
  254. package/src/internal/utils/values.mjs.map +1 -0
  255. package/src/internal/utils.d.ts +8 -0
  256. package/src/internal/utils.d.ts.map +1 -0
  257. package/src/internal/utils.js +25 -0
  258. package/src/internal/utils.js.map +1 -0
  259. package/src/internal/utils.mjs +9 -0
  260. package/src/internal/utils.mjs.map +1 -0
  261. package/src/tsconfig.json +11 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env.d.mts","sourceRoot":"","sources":["../../src/internal/utils/env.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,eAAO,MAAM,OAAO,GAAI,KAAK,MAAM,KAAG,MAAM,GAAG,SAQ9C,CAAC"}
@@ -0,0 +1,37 @@
1
+ import { type BaseAwt } from "../../client.mjs";
2
+ import { RequestOptions } from "../request-options.mjs";
3
+ type LogFn = (message: string, ...rest: unknown[]) => void;
4
+ export type Logger = {
5
+ error: LogFn;
6
+ warn: LogFn;
7
+ info: LogFn;
8
+ debug: LogFn;
9
+ };
10
+ export type LogLevel = 'off' | 'error' | 'warn' | 'info' | 'debug';
11
+ export declare const parseLogLevel: (maybeLevel: string | undefined, sourceName: string, client: BaseAwt) => LogLevel | undefined;
12
+ export declare function loggerFor(client: BaseAwt): Logger;
13
+ export declare const formatRequestDetails: (details: {
14
+ options?: RequestOptions | undefined;
15
+ headers?: Headers | Record<string, string> | undefined;
16
+ retryOfRequestLogID?: string | undefined;
17
+ retryOf?: string | undefined;
18
+ url?: string | undefined;
19
+ status?: number | undefined;
20
+ method?: string | undefined;
21
+ durationMs?: number | undefined;
22
+ message?: unknown;
23
+ body?: unknown;
24
+ }) => {
25
+ options?: RequestOptions | undefined;
26
+ headers?: Headers | Record<string, string> | undefined;
27
+ retryOfRequestLogID?: string | undefined;
28
+ retryOf?: string | undefined;
29
+ url?: string | undefined;
30
+ status?: number | undefined;
31
+ method?: string | undefined;
32
+ durationMs?: number | undefined;
33
+ message?: unknown;
34
+ body?: unknown;
35
+ };
36
+ export {};
37
+ //# sourceMappingURL=log.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log.d.mts","sourceRoot":"","sources":["../../src/internal/utils/log.ts"],"names":[],"mappings":"OAGO,EAAE,KAAK,OA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GAAG,SAAS;cAC9B,MAAM,GAAG,SAAS;UACtB,MAAM,GAAG,SAAS;aACf,MAAM,GAAG,SAAS;aAClB,MAAM,GAAG,SAAS;iBACd,MAAM,GAAG,SAAS;cACrB,OAAO;WACV,OAAO;CA+Bf,CAAC"}
@@ -1,5 +1,5 @@
1
- import { type BaseAwt } from '../../client';
2
- import { RequestOptions } from '../request-options';
1
+ import { type BaseAwt } from "../../client.js";
2
+ import { RequestOptions } from "../request-options.js";
3
3
  type LogFn = (message: string, ...rest: unknown[]) => void;
4
4
  export type Logger = {
5
5
  error: LogFn;
@@ -1 +1 @@
1
- {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../src/internal/utils/log.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,KAAK,KAAK,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;AAC3D,MAAM,MAAM,MAAM,GAAG;IACnB,KAAK,EAAE,KAAK,CAAC;IACb,IAAI,EAAE,KAAK,CAAC;IACZ,IAAI,EAAE,KAAK,CAAC;IACZ,KAAK,EAAE,KAAK,CAAC;CACd,CAAC;AACF,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAUnE,eAAO,MAAM,aAAa,GACxB,YAAY,MAAM,GAAG,SAAS,EAC9B,YAAY,MAAM,EAClB,QAAQ,OAAO,KACd,QAAQ,GAAG,SAab,CAAC;AAsBF,wBAAgB,SAAS,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAsBjD;AAED,eAAO,MAAM,oBAAoB,GAAI,SAAS;IAC5C,OAAO,CAAC,EAAE,cAAc,GAAG,SAAS,CAAC;IACrC,OAAO,CAAC,EAAE,OAAO,GAAG,MAAM,CAA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EAC9B,YAAY,MAAM,EAClB,QAAQ,OAAO,KACd,QAAQ,GAAG,SAab,CAAC;AAsBF,wBAAgB,SAAS,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAsBjD;AAED,eAAO,MAAM,oBAAoB,GAAI,SAAS;IAC5C,OAAO,CAAC,EAAE,cAAc,GAAG,SAAS,CAAC;IACrC,OAAO,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC;IACvD,mBAAmB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;cAVW,cAAc,GAAG,SAAS;cAC1B,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS;0BAChC,MAAM,GAAG,SAAS;cAC9B,MAAM,GAAG,SAAS;UACtB,MAAM,GAAG,SAAS;aACf,MAAM,GAAG,SAAS;aAClB,MAAM,GAAG,SAAS;iBACd,MAAM,GAAG,SAAS;cACrB,OAAO;WACV,OAAO;CA+Bf,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Percent-encode everything that isn't safe to have in a path without encoding safe chars.
3
+ *
4
+ * Taken from https://datatracker.ietf.org/doc/html/rfc3986#section-3.3:
5
+ * > unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
6
+ * > sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "="
7
+ * > pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
8
+ */
9
+ export declare function encodeURIPath(str: string): string;
10
+ export declare const createPathTagFunction: (pathEncoder?: typeof encodeURIPath) => (statics: readonly string[], ...params: readonly unknown[]) => string;
11
+ /**
12
+ * URI-encodes path params and ensures no unsafe /./ or /../ path segments are introduced.
13
+ */
14
+ export declare const path: (statics: readonly string[], ...params: readonly unknown[]) => string;
15
+ //# sourceMappingURL=path.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path.d.mts","sourceRoot":"","sources":["../../src/internal/utils/path.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,UAExC;AAID,eAAO,MAAM,qBAAqB,GAAI,kCAA2B,MACjD,SAAS,SAAS,MAAM,EAAE,EAAE,GAAG,QAAQ,SAAS,OAAO,EAAE,KAAG,MAiEzE,CAAC;AAEJ;;GAEG;AACH,eAAO,MAAM,IAAI,YAtEQ,SAAS,MAAM,EAAE,aAAa,SAAS,OAAO,EAAE,KAAG,MAsEJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function stringifyQuery(query: object | Record<string, unknown>): string;
2
+ //# sourceMappingURL=query.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query.d.mts","sourceRoot":"","sources":["../../src/internal/utils/query.ts"],"names":[],"mappings":"AAIA,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,UAErE"}
@@ -0,0 +1,2 @@
1
+ export declare const sleep: (ms: number) => Promise<void>;
2
+ //# sourceMappingURL=sleep.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sleep.d.mts","sourceRoot":"","sources":["../../src/internal/utils/sleep.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,KAAK,GAAI,IAAI,MAAM,kBAA4D,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** Current time as unix epoch seconds. */
2
+ export declare function nowAsSeconds(): number;
3
+ //# sourceMappingURL=time.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"time.d.mts","sourceRoot":"","sources":["../../src/internal/utils/time.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,wBAAgB,YAAY,IAAI,MAAM,CAErC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * https://stackoverflow.com/a/2117523
3
+ */
4
+ export declare let uuid4: () => any;
5
+ //# sourceMappingURL=uuid.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uuid.d.mts","sourceRoot":"","sources":["../../src/internal/utils/uuid.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,IAAI,KAAK,WAWf,CAAC"}
@@ -0,0 +1,19 @@
1
+ export declare const isAbsoluteURL: (url: string) => boolean;
2
+ export declare let isArray: (val: unknown) => val is unknown[];
3
+ export declare let isReadonlyArray: (val: unknown) => val is readonly unknown[];
4
+ /** Returns an object if the given value isn't an object, otherwise returns as-is */
5
+ export declare function maybeObj(x: unknown): object;
6
+ export declare function isEmptyObj(obj: Object | null | undefined): boolean;
7
+ export declare function hasOwn<T extends object = object>(obj: T, key: PropertyKey): key is keyof T;
8
+ export declare function isObj(obj: unknown): obj is Record<string, unknown>;
9
+ export declare const ensurePresent: <T>(value: T | null | undefined) => T;
10
+ export declare const validatePositiveInteger: (name: string, n: unknown) => number;
11
+ export declare const coerceInteger: (value: unknown) => number;
12
+ export declare const coerceFloat: (value: unknown) => number;
13
+ export declare const coerceBoolean: (value: unknown) => boolean;
14
+ export declare const maybeCoerceInteger: (value: unknown) => number | undefined;
15
+ export declare const maybeCoerceFloat: (value: unknown) => number | undefined;
16
+ export declare const maybeCoerceBoolean: (value: unknown) => boolean | undefined;
17
+ export declare const safeJSON: (text: string) => any;
18
+ export declare const pop: <T extends Record<string, any>, K extends string>(obj: T, key: K) => T[K];
19
+ //# sourceMappingURL=values.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"values.d.mts","sourceRoot":"","sources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OAAO,OAAO,KAAG,OAAO,GAAG,SAK7D,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAI,MAAM,MAAM,QAMpC,CAAC;AAGF,eAAO,MAAM,GAAG,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC,SAAS,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK,CAAC,KAAG,CAAC,CAAC,CAAC,CAIxF,CAAC"}
@@ -0,0 +1,8 @@
1
+ export * from "./utils/values.mjs";
2
+ export * from "./utils/base64.mjs";
3
+ export * from "./utils/env.mjs";
4
+ export * from "./utils/log.mjs";
5
+ export * from "./utils/uuid.mjs";
6
+ export * from "./utils/sleep.mjs";
7
+ export * from "./utils/query.mjs";
8
+ //# sourceMappingURL=utils.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.mts","sourceRoot":"","sources":["../src/internal/utils.ts"],"names":[],"mappings":""}
@@ -1,8 +1,8 @@
1
- export * from './utils/values';
2
- export * from './utils/base64';
3
- export * from './utils/env';
4
- export * from './utils/log';
5
- export * from './utils/uuid';
6
- export * from './utils/sleep';
7
- export * from './utils/query';
1
+ export * from "./utils/values.js";
2
+ export * from "./utils/base64.js";
3
+ export * from "./utils/env.js";
4
+ export * from "./utils/log.js";
5
+ export * from "./utils/uuid.js";
6
+ export * from "./utils/sleep.js";
7
+ export * from "./utils/query.js";
8
8
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/internal/utils.ts"],"names":[],"mappings":"AAEA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/internal/utils.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awt_ai/aws-sdk",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "The official TypeScript library for the Awt AWS API",
5
5
  "author": "Awt <support@awt.com>",
6
6
  "types": "./index.d.ts",
@@ -22,9 +22,9 @@
22
22
  "fix": "eslint --fix --ext ts,js ."
23
23
  },
24
24
  "dependencies": {
25
- "@awt_ai/sdk": ">=0.50.3 <1",
26
25
  "@aws-crypto/sha256-js": "^4.0.0",
27
26
  "@aws-sdk/credential-providers": "^3.796.0",
27
+ "@awt_ai/sdk": ">=0.50.3 <1",
28
28
  "@smithy/config-resolver": "^4.1.4",
29
29
  "@smithy/fetch-http-handler": "^5.0.4",
30
30
  "@smithy/node-config-provider": "^4.1.3",
@@ -45,18 +45,45 @@
45
45
  "types": "./index.d.mts",
46
46
  "default": "./index.mjs"
47
47
  },
48
- "./*.mjs": {
49
- "types": "./*.d.ts",
50
- "default": "./*.mjs"
48
+ "./.github/*.mjs": {
49
+ "default": "./.github/*.mjs"
50
+ },
51
+ "./.github/*.js": {
52
+ "default": "./.github/*.js"
53
+ },
54
+ "./.github/*": {
55
+ "import": "./.github/*.mjs",
56
+ "require": "./.github/*.js"
57
+ },
58
+ "./client": {
59
+ "import": "./client.mjs",
60
+ "require": "./client.js"
61
+ },
62
+ "./client.js": {
63
+ "default": "./client.js"
51
64
  },
52
- "./*.js": {
53
- "types": "./*.d.ts",
54
- "default": "./*.js"
65
+ "./client.mjs": {
66
+ "default": "./client.mjs"
55
67
  },
56
- "./*": {
57
- "types": "./*.d.ts",
58
- "require": "./*.js",
59
- "default": "./*.mjs"
68
+ "./core/*.mjs": {
69
+ "default": "./core/*.mjs"
70
+ },
71
+ "./core/*.js": {
72
+ "default": "./core/*.js"
73
+ },
74
+ "./core/*": {
75
+ "import": "./core/*.mjs",
76
+ "require": "./core/*.js"
77
+ },
78
+ "./index": {
79
+ "import": "./index.mjs",
80
+ "require": "./index.js"
81
+ },
82
+ "./index.js": {
83
+ "default": "./index.js"
84
+ },
85
+ "./index.mjs": {
86
+ "default": "./index.mjs"
60
87
  }
61
88
  }
62
89
  }
@@ -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
+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SAAS,CAAC;IAC9B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,qBAAqB,EAAE,CAAC,MAAM,OAAO,CAAC,6BAA6B,CAAC,CAAC,GAAG,IAAI,CAAC;IAC7E,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,QAAQ,EAAE,OAAO,CAAS;IAE1B;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAE9B,OAAO,CAAC,SAAS,CAAU;IAE3B;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;gBACS,EACV,SAAS,EACT,OAAO,EACP,MAAM,EACN,YAAmB,EACnB,kBAAyB,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/src/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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["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,Q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