brand.dev 0.1.0-alpha.8 → 0.1.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 (89) hide show
  1. package/CHANGELOG.md +154 -0
  2. package/README.md +3 -4
  3. package/client.d.mts +9 -7
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +9 -7
  6. package/client.d.ts.map +1 -1
  7. package/client.js +36 -29
  8. package/client.js.map +1 -1
  9. package/client.mjs +25 -18
  10. package/client.mjs.map +1 -1
  11. package/core/resource.d.mts +1 -1
  12. package/core/resource.d.mts.map +1 -1
  13. package/core/resource.d.ts +1 -1
  14. package/core/resource.d.ts.map +1 -1
  15. package/core/resource.js.map +1 -1
  16. package/core/resource.mjs.map +1 -1
  17. package/internal/headers.d.mts.map +1 -1
  18. package/internal/headers.d.ts.map +1 -1
  19. package/internal/headers.js +4 -4
  20. package/internal/headers.js.map +1 -1
  21. package/internal/headers.mjs +4 -4
  22. package/internal/headers.mjs.map +1 -1
  23. package/internal/request-options.d.mts +43 -0
  24. package/internal/request-options.d.mts.map +1 -1
  25. package/internal/request-options.d.ts +43 -0
  26. package/internal/request-options.d.ts.map +1 -1
  27. package/internal/request-options.js.map +1 -1
  28. package/internal/request-options.mjs.map +1 -1
  29. package/internal/types.d.mts +8 -6
  30. package/internal/types.d.mts.map +1 -1
  31. package/internal/types.d.ts +8 -6
  32. package/internal/types.d.ts.map +1 -1
  33. package/internal/uploads.js +1 -1
  34. package/internal/uploads.js.map +1 -1
  35. package/internal/uploads.mjs +1 -1
  36. package/internal/uploads.mjs.map +1 -1
  37. package/internal/utils/log.js +1 -1
  38. package/internal/utils/log.js.map +1 -1
  39. package/internal/utils/log.mjs +1 -1
  40. package/internal/utils/log.mjs.map +1 -1
  41. package/internal/utils/path.d.mts.map +1 -1
  42. package/internal/utils/path.d.ts.map +1 -1
  43. package/internal/utils/path.js +26 -5
  44. package/internal/utils/path.js.map +1 -1
  45. package/internal/utils/path.mjs +27 -6
  46. package/internal/utils/path.mjs.map +1 -1
  47. package/internal/utils/values.d.mts +2 -0
  48. package/internal/utils/values.d.mts.map +1 -1
  49. package/internal/utils/values.d.ts +2 -0
  50. package/internal/utils/values.d.ts.map +1 -1
  51. package/internal/utils/values.js +4 -1
  52. package/internal/utils/values.js.map +1 -1
  53. package/internal/utils/values.mjs +2 -0
  54. package/internal/utils/values.mjs.map +1 -1
  55. package/package.json +1 -5
  56. package/resources/brand.d.mts +565 -70
  57. package/resources/brand.d.mts.map +1 -1
  58. package/resources/brand.d.ts +565 -70
  59. package/resources/brand.d.ts.map +1 -1
  60. package/resources/brand.js +21 -3
  61. package/resources/brand.js.map +1 -1
  62. package/resources/brand.mjs +21 -3
  63. package/resources/brand.mjs.map +1 -1
  64. package/resources/index.d.mts +1 -1
  65. package/resources/index.d.mts.map +1 -1
  66. package/resources/index.d.ts +1 -1
  67. package/resources/index.d.ts.map +1 -1
  68. package/resources/index.js.map +1 -1
  69. package/resources/index.mjs.map +1 -1
  70. package/src/client.ts +55 -24
  71. package/src/core/resource.ts +1 -1
  72. package/src/internal/headers.ts +5 -5
  73. package/src/internal/request-options.ts +54 -0
  74. package/src/internal/types.ts +9 -6
  75. package/src/internal/uploads.ts +1 -1
  76. package/src/internal/utils/log.ts +1 -1
  77. package/src/internal/utils/path.ts +33 -8
  78. package/src/internal/utils/values.ts +3 -0
  79. package/src/resources/brand.ts +725 -78
  80. package/src/resources/index.ts +6 -2
  81. package/src/version.ts +1 -1
  82. package/version.d.mts +1 -1
  83. package/version.d.mts.map +1 -1
  84. package/version.d.ts +1 -1
  85. package/version.d.ts.map +1 -1
  86. package/version.js +1 -1
  87. package/version.js.map +1 -1
  88. package/version.mjs +1 -1
  89. package/version.mjs.map +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,159 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.0 (2025-07-31)
4
+
5
+ Full Changelog: [v0.0.1...v0.1.0](https://github.com/brand-dot-dev/typescript-sdk/compare/v0.0.1...v0.1.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** manual updates ([78879ce](https://github.com/brand-dot-dev/typescript-sdk/commit/78879ce073bff55702d668df6c16e685f5dd2bd7))
10
+ * **api:** manual updates ([69a7a88](https://github.com/brand-dot-dev/typescript-sdk/commit/69a7a88bae655e8b331b03c718ea48fd1857b3c0))
11
+ * **api:** manual updates ([51f9de8](https://github.com/brand-dot-dev/typescript-sdk/commit/51f9de82a052b33c027b38b103bb2fa2557cc32e))
12
+ * **api:** manual updates ([553a065](https://github.com/brand-dot-dev/typescript-sdk/commit/553a065ea64adf95b92d149e3a23bb8f0f71725e))
13
+ * **api:** manual updates ([17e2f82](https://github.com/brand-dot-dev/typescript-sdk/commit/17e2f8259071877dfb71d51c107b23965bf01d35))
14
+ * **api:** manual updates ([f405c69](https://github.com/brand-dot-dev/typescript-sdk/commit/f405c69d49712539cb8623e9a5cc2b73431dd9dc))
15
+ * **api:** manual updates ([437ffa2](https://github.com/brand-dot-dev/typescript-sdk/commit/437ffa2b5b4d650dafc0584ab45bafce9ccabc8e))
16
+ * **api:** manual updates ([bb954b6](https://github.com/brand-dot-dev/typescript-sdk/commit/bb954b60752ae7fe07f154657d56b006427ca4b5))
17
+ * **api:** manual updates ([d997f7b](https://github.com/brand-dot-dev/typescript-sdk/commit/d997f7b982051edb3e3a3eeb4dc6c57f7723c134))
18
+ * **api:** manual updates ([f9ef6a0](https://github.com/brand-dot-dev/typescript-sdk/commit/f9ef6a0bf6cb6426fec94f0abb5a6c8acc668141))
19
+ * **api:** manual updates ([e71b7eb](https://github.com/brand-dot-dev/typescript-sdk/commit/e71b7eb187e3acef2bc6fbf5b2beb0b47800245b))
20
+ * **api:** manual updates ([1cc75cd](https://github.com/brand-dot-dev/typescript-sdk/commit/1cc75cd9877da7b2280329cf4e53c7b73f067d46))
21
+ * **api:** manual updates ([dbd6df5](https://github.com/brand-dot-dev/typescript-sdk/commit/dbd6df5265d5e77ed900bffec20e42b7d9686302))
22
+ * **client:** add support for endpoint-specific base URLs ([bd84840](https://github.com/brand-dot-dev/typescript-sdk/commit/bd848405ed7a7b7cf967dc9e9e068a3b04eb5bfd))
23
+ * **mcp:** implement support for binary responses ([4d35e49](https://github.com/brand-dot-dev/typescript-sdk/commit/4d35e49621a740137fde22d0d50b570366697967))
24
+ * **mcp:** include http information in tools ([608a554](https://github.com/brand-dot-dev/typescript-sdk/commit/608a5549eba7d3775b4be77278e44eff460a56f3))
25
+ * **mcp:** set X-Stainless-MCP header ([9f8bca8](https://github.com/brand-dot-dev/typescript-sdk/commit/9f8bca8ea75f6d11b15e3dfcbc9abeb4461257e2))
26
+ * **mcp:** support filtering tool results by a jq expression ([7bb7ed6](https://github.com/brand-dot-dev/typescript-sdk/commit/7bb7ed637ba3ff9bb957fca486973134be21e1ed))
27
+
28
+
29
+ ### Bug Fixes
30
+
31
+ * **ci:** release-doctor — report correct token name ([14af55d](https://github.com/brand-dot-dev/typescript-sdk/commit/14af55d22732fdce0ce00bfeb417bc91adfff740))
32
+ * **client:** explicitly copy fetch in withOptions ([17dfeaf](https://github.com/brand-dot-dev/typescript-sdk/commit/17dfeaf08885c914a1ac4c0f24233c87e358f31e))
33
+ * **client:** get fetchOptions type more reliably ([5b28587](https://github.com/brand-dot-dev/typescript-sdk/commit/5b285874706b67864bba4152887181c2bd380173))
34
+ * compat with more runtimes ([4595f13](https://github.com/brand-dot-dev/typescript-sdk/commit/4595f133be88a2d148b9267ccd4535eb9a558f51))
35
+ * **mcp:** fix cursor schema transformation issue with recursive references ([ab24ba0](https://github.com/brand-dot-dev/typescript-sdk/commit/ab24ba029cf26e71ac15da2a6dcdc55fb5c6bc20))
36
+ * **mcp:** fix tool description of jq_filter ([e2f432e](https://github.com/brand-dot-dev/typescript-sdk/commit/e2f432eb966f17631b50f82c07aff4755fceb38b))
37
+ * **mcp:** include description in dynamic tool search ([d698f91](https://github.com/brand-dot-dev/typescript-sdk/commit/d698f9173f905924424c82e0026b06fec3488572))
38
+ * **mcp:** include required section for top-level properties and support naming transformations ([8a3d09d](https://github.com/brand-dot-dev/typescript-sdk/commit/8a3d09d405b8ce692a492ae3082a473a386d345c))
39
+ * **mcp:** relax input type for asTextContextResult ([b604761](https://github.com/brand-dot-dev/typescript-sdk/commit/b6047611bda8b8c275f87828f21b98d3a79cba20))
40
+ * **mcp:** support jq filtering on cloudflare workers ([05a640e](https://github.com/brand-dot-dev/typescript-sdk/commit/05a640ee793c5a0f276688e38a43a592276c51b8))
41
+ * publish script — handle NPM errors correctly ([ce784cd](https://github.com/brand-dot-dev/typescript-sdk/commit/ce784cdd350a285e46139075209405820d7624e1))
42
+
43
+
44
+ ### Chores
45
+
46
+ * add docs to RequestOptions type ([f4b33df](https://github.com/brand-dot-dev/typescript-sdk/commit/f4b33df15437998afd2d728ec5224f9c1a880890))
47
+ * adjust eslint.config.mjs ignore pattern ([95468aa](https://github.com/brand-dot-dev/typescript-sdk/commit/95468aa42a24f2f9333d2cf240b8b604d30e4b75))
48
+ * avoid type error in certain environments ([0b97df8](https://github.com/brand-dot-dev/typescript-sdk/commit/0b97df8bf0798a7cb2d4f8d570f79dc9c599e3c7))
49
+ * **ci:** enable for pull requests ([623b5d6](https://github.com/brand-dot-dev/typescript-sdk/commit/623b5d6a5ea903ac4c2ed14841587318c3b62b75))
50
+ * **ci:** only run for pushes and fork pull requests ([63b08b8](https://github.com/brand-dot-dev/typescript-sdk/commit/63b08b8334584bddd085d1de493281967e57bd51))
51
+ * **client:** improve path param validation ([2f2fc76](https://github.com/brand-dot-dev/typescript-sdk/commit/2f2fc76068cde16de95d3a718b8a80edeee4902b))
52
+ * **client:** refactor imports ([d90fb77](https://github.com/brand-dot-dev/typescript-sdk/commit/d90fb773c0a32e7129041025cda6bf999d4750a0))
53
+ * configure new SDK language ([fa4bf57](https://github.com/brand-dot-dev/typescript-sdk/commit/fa4bf57b52799969998afe320e24014cb078140c))
54
+ * **deps:** bump eslint-plugin-prettier ([4637721](https://github.com/brand-dot-dev/typescript-sdk/commit/4637721c6e8bb3feeaf727824ee1b2f67cd13204))
55
+ * **docs:** use top-level-await in example snippets ([2376ef9](https://github.com/brand-dot-dev/typescript-sdk/commit/2376ef99f488b1b990d3adeaa783be774bd3bbdb))
56
+ * improve publish-npm script --latest tag logic ([a096145](https://github.com/brand-dot-dev/typescript-sdk/commit/a0961454962591ee6e1f0179ad1abf335275235e))
57
+ * **internal:** add pure annotations, make base APIResource abstract ([d8a845c](https://github.com/brand-dot-dev/typescript-sdk/commit/d8a845cc477720993869fd020e4a65d9b49c5e1f))
58
+ * **internal:** codegen related update ([708e6d6](https://github.com/brand-dot-dev/typescript-sdk/commit/708e6d6fa3e927d09b51f48789f7c8bf4b3aa304))
59
+ * **internal:** codegen related update ([0bdcf4b](https://github.com/brand-dot-dev/typescript-sdk/commit/0bdcf4b6aa36c58284b5afe76776711e1121b5b1))
60
+ * **internal:** fix readablestream types in node 20 ([d753e24](https://github.com/brand-dot-dev/typescript-sdk/commit/d753e243856e1efa6d82e5a3ba5e395a6dfe3558))
61
+ * **internal:** remove redundant imports config ([8215e1e](https://github.com/brand-dot-dev/typescript-sdk/commit/8215e1ede73be05677c34931b526d79bb9b2f409))
62
+ * **internal:** update jest config ([261cd8e](https://github.com/brand-dot-dev/typescript-sdk/commit/261cd8e99fcb636154c5f8b669ccfcaa6d6ff6e9))
63
+ * make some internal functions async ([683286e](https://github.com/brand-dot-dev/typescript-sdk/commit/683286e2a0e44bfef1501d19f29cd5dc05caa82f))
64
+ * **mcp:** formatting ([0939837](https://github.com/brand-dot-dev/typescript-sdk/commit/0939837fae8c9da449ec10f7aa65355bf2612654))
65
+ * **mcp:** provides high-level initMcpServer function and exports known clients ([cd28940](https://github.com/brand-dot-dev/typescript-sdk/commit/cd289406a6103a675b98405719a604b80c162f3c))
66
+ * **mcp:** remove duplicate assignment ([1984da9](https://github.com/brand-dot-dev/typescript-sdk/commit/1984da989afc8b54c8a81656a0c32f0a488eeb68))
67
+ * **mcp:** rework imports in tools ([497fc6c](https://github.com/brand-dot-dev/typescript-sdk/commit/497fc6c5a69112de5677dee10d77995705872af9))
68
+ * **readme:** update badges ([46380e0](https://github.com/brand-dot-dev/typescript-sdk/commit/46380e0141b9570f5e2c816c5ca90f74f781df69))
69
+ * **readme:** use better example snippet for undocumented params ([56c698d](https://github.com/brand-dot-dev/typescript-sdk/commit/56c698d1f5b47609e2e3da90c18813c715bdbb84))
70
+ * **ts:** reorder package.json imports ([4495729](https://github.com/brand-dot-dev/typescript-sdk/commit/44957290ba6883ecb207720620001ba6b75559bd))
71
+ * update SDK settings ([0ce8ece](https://github.com/brand-dot-dev/typescript-sdk/commit/0ce8ecedb16b548b04b8c09f1692249b944a1b37))
72
+ * update SDK settings ([a090aec](https://github.com/brand-dot-dev/typescript-sdk/commit/a090aec93fa38eadb6a59c751447d2f164c45a6c))
73
+
74
+ ## 0.0.1 (2025-07-21)
75
+
76
+ Full Changelog: [v0.1.0-alpha.12...v0.0.1](https://github.com/brand-dot-dev/typescript-sdk/compare/v0.1.0-alpha.12...v0.0.1)
77
+
78
+ ### Features
79
+
80
+ * **api:** manual updates ([51f9de8](https://github.com/brand-dot-dev/typescript-sdk/commit/51f9de82a052b33c027b38b103bb2fa2557cc32e))
81
+ * **mcp:** support filtering tool results by a jq expression ([7bb7ed6](https://github.com/brand-dot-dev/typescript-sdk/commit/7bb7ed637ba3ff9bb957fca486973134be21e1ed))
82
+
83
+
84
+ ### Bug Fixes
85
+
86
+ * **mcp:** include required section for top-level properties and support naming transformations ([8a3d09d](https://github.com/brand-dot-dev/typescript-sdk/commit/8a3d09d405b8ce692a492ae3082a473a386d345c))
87
+ * **mcp:** relax input type for asTextContextResult ([b604761](https://github.com/brand-dot-dev/typescript-sdk/commit/b6047611bda8b8c275f87828f21b98d3a79cba20))
88
+ * **mcp:** support jq filtering on cloudflare workers ([05a640e](https://github.com/brand-dot-dev/typescript-sdk/commit/05a640ee793c5a0f276688e38a43a592276c51b8))
89
+
90
+
91
+ ### Chores
92
+
93
+ * add docs to RequestOptions type ([f4b33df](https://github.com/brand-dot-dev/typescript-sdk/commit/f4b33df15437998afd2d728ec5224f9c1a880890))
94
+ * **client:** improve path param validation ([2f2fc76](https://github.com/brand-dot-dev/typescript-sdk/commit/2f2fc76068cde16de95d3a718b8a80edeee4902b))
95
+ * make some internal functions async ([683286e](https://github.com/brand-dot-dev/typescript-sdk/commit/683286e2a0e44bfef1501d19f29cd5dc05caa82f))
96
+ * **mcp:** formatting ([0939837](https://github.com/brand-dot-dev/typescript-sdk/commit/0939837fae8c9da449ec10f7aa65355bf2612654))
97
+ * **mcp:** rework imports in tools ([497fc6c](https://github.com/brand-dot-dev/typescript-sdk/commit/497fc6c5a69112de5677dee10d77995705872af9))
98
+ * **ts:** reorder package.json imports ([4495729](https://github.com/brand-dot-dev/typescript-sdk/commit/44957290ba6883ecb207720620001ba6b75559bd))
99
+
100
+ ## 0.1.0-alpha.12 (2025-06-29)
101
+
102
+ Full Changelog: [v0.1.0-alpha.11...v0.1.0-alpha.12](https://github.com/brand-dot-dev/typescript-sdk/compare/v0.1.0-alpha.11...v0.1.0-alpha.12)
103
+
104
+ ### Features
105
+
106
+ * **api:** manual updates ([553a065](https://github.com/brand-dot-dev/typescript-sdk/commit/553a065ea64adf95b92d149e3a23bb8f0f71725e))
107
+
108
+ ## 0.1.0-alpha.11 (2025-06-28)
109
+
110
+ Full Changelog: [v0.1.0-alpha.10...v0.1.0-alpha.11](https://github.com/brand-dot-dev/typescript-sdk/compare/v0.1.0-alpha.10...v0.1.0-alpha.11)
111
+
112
+ ### Bug Fixes
113
+
114
+ * **ci:** release-doctor — report correct token name ([14af55d](https://github.com/brand-dot-dev/typescript-sdk/commit/14af55d22732fdce0ce00bfeb417bc91adfff740))
115
+ * **client:** explicitly copy fetch in withOptions ([17dfeaf](https://github.com/brand-dot-dev/typescript-sdk/commit/17dfeaf08885c914a1ac4c0f24233c87e358f31e))
116
+ * **client:** get fetchOptions type more reliably ([5b28587](https://github.com/brand-dot-dev/typescript-sdk/commit/5b285874706b67864bba4152887181c2bd380173))
117
+
118
+
119
+ ### Chores
120
+
121
+ * **ci:** only run for pushes and fork pull requests ([63b08b8](https://github.com/brand-dot-dev/typescript-sdk/commit/63b08b8334584bddd085d1de493281967e57bd51))
122
+
123
+ ## 0.1.0-alpha.10 (2025-06-19)
124
+
125
+ Full Changelog: [v0.1.0-alpha.9...v0.1.0-alpha.10](https://github.com/brand-dot-dev/typescript-sdk/compare/v0.1.0-alpha.9...v0.1.0-alpha.10)
126
+
127
+ ### Features
128
+
129
+ * **api:** manual updates ([17e2f82](https://github.com/brand-dot-dev/typescript-sdk/commit/17e2f8259071877dfb71d51c107b23965bf01d35))
130
+
131
+ ## 0.1.0-alpha.9 (2025-06-19)
132
+
133
+ Full Changelog: [v0.1.0-alpha.8...v0.1.0-alpha.9](https://github.com/brand-dot-dev/typescript-sdk/compare/v0.1.0-alpha.8...v0.1.0-alpha.9)
134
+
135
+ ### Features
136
+
137
+ * **api:** manual updates ([f405c69](https://github.com/brand-dot-dev/typescript-sdk/commit/f405c69d49712539cb8623e9a5cc2b73431dd9dc))
138
+ * **api:** manual updates ([437ffa2](https://github.com/brand-dot-dev/typescript-sdk/commit/437ffa2b5b4d650dafc0584ab45bafce9ccabc8e))
139
+ * **client:** add support for endpoint-specific base URLs ([bd84840](https://github.com/brand-dot-dev/typescript-sdk/commit/bd848405ed7a7b7cf967dc9e9e068a3b04eb5bfd))
140
+ * **mcp:** set X-Stainless-MCP header ([9f8bca8](https://github.com/brand-dot-dev/typescript-sdk/commit/9f8bca8ea75f6d11b15e3dfcbc9abeb4461257e2))
141
+
142
+
143
+ ### Bug Fixes
144
+
145
+ * publish script — handle NPM errors correctly ([ce784cd](https://github.com/brand-dot-dev/typescript-sdk/commit/ce784cdd350a285e46139075209405820d7624e1))
146
+
147
+
148
+ ### Chores
149
+
150
+ * **ci:** enable for pull requests ([623b5d6](https://github.com/brand-dot-dev/typescript-sdk/commit/623b5d6a5ea903ac4c2ed14841587318c3b62b75))
151
+ * **client:** refactor imports ([d90fb77](https://github.com/brand-dot-dev/typescript-sdk/commit/d90fb773c0a32e7129041025cda6bf999d4750a0))
152
+ * **internal:** add pure annotations, make base APIResource abstract ([d8a845c](https://github.com/brand-dot-dev/typescript-sdk/commit/d8a845cc477720993869fd020e4a65d9b49c5e1f))
153
+ * **mcp:** provides high-level initMcpServer function and exports known clients ([cd28940](https://github.com/brand-dot-dev/typescript-sdk/commit/cd289406a6103a675b98405719a604b80c162f3c))
154
+ * **readme:** update badges ([46380e0](https://github.com/brand-dot-dev/typescript-sdk/commit/46380e0141b9570f5e2c816c5ca90f74f781df69))
155
+ * **readme:** use better example snippet for undocumented params ([56c698d](https://github.com/brand-dot-dev/typescript-sdk/commit/56c698d1f5b47609e2e3da90c18813c715bdbb84))
156
+
3
157
  ## 0.1.0-alpha.8 (2025-06-08)
4
158
 
5
159
  Full Changelog: [v0.1.0-alpha.7...v0.1.0-alpha.8](https://github.com/brand-dot-dev/typescript-sdk/compare/v0.1.0-alpha.7...v0.1.0-alpha.8)
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Brand Dev TypeScript API Library
2
2
 
3
- [![NPM version](https://img.shields.io/npm/v/brand.dev.svg)](https://npmjs.org/package/brand.dev) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/brand.dev)
3
+ [![NPM version](<https://img.shields.io/npm/v/brand.dev.svg?label=npm%20(stable)>)](https://npmjs.org/package/brand.dev) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/brand.dev)
4
4
 
5
5
  This library provides convenient access to the Brand Dev REST API from server-side TypeScript or JavaScript.
6
6
 
@@ -223,9 +223,8 @@ parameter. This library doesn't validate at runtime that the request matches the
223
223
  send will be sent as-is.
224
224
 
225
225
  ```ts
226
- client.foo.create({
227
- foo: 'my_param',
228
- bar: 12,
226
+ client.brand.retrieve({
227
+ // ...
229
228
  // @ts-expect-error baz is not yet public
230
229
  baz: 'undocumented option',
231
230
  });
package/client.d.mts CHANGED
@@ -1,16 +1,16 @@
1
1
  import type { RequestInit, RequestInfo } from "./internal/builtin-types.mjs";
2
2
  import type { PromiseOrValue, MergedRequestInit, FinalizedRequestInit } from "./internal/types.mjs";
3
- import { type Logger, type LogLevel } from "./internal/utils/log.mjs";
4
3
  export type { Logger, LogLevel } from "./internal/utils/log.mjs";
5
4
  import * as Opts from "./internal/request-options.mjs";
6
5
  import * as Errors from "./core/error.mjs";
7
6
  import * as Uploads from "./core/uploads.mjs";
8
7
  import * as API from "./resources/index.mjs";
9
8
  import { APIPromise } from "./core/api-promise.mjs";
9
+ import { Brand, BrandAIQueryParams, BrandAIQueryResponse, BrandIdentifyFromTransactionParams, BrandIdentifyFromTransactionResponse, BrandPrefetchParams, BrandPrefetchResponse, BrandRetrieveByTickerParams, BrandRetrieveByTickerResponse, BrandRetrieveNaicsParams, BrandRetrieveNaicsResponse, BrandRetrieveParams, BrandRetrieveResponse, BrandRetrieveSimplifiedParams, BrandRetrieveSimplifiedResponse, BrandScreenshotParams, BrandScreenshotResponse, BrandStyleguideParams, BrandStyleguideResponse } from "./resources/brand.mjs";
10
10
  import { type Fetch } from "./internal/builtin-types.mjs";
11
11
  import { HeadersLike, NullableHeaders } from "./internal/headers.mjs";
12
12
  import { FinalRequestOptions, RequestOptions } from "./internal/request-options.mjs";
13
- import { Brand, BrandAIQueryParams, BrandAIQueryResponse, BrandIdentifyFromTransactionParams, BrandIdentifyFromTransactionResponse, BrandPrefetchParams, BrandPrefetchResponse, BrandRetrieveByTickerParams, BrandRetrieveByTickerResponse, BrandRetrieveNaicsParams, BrandRetrieveNaicsResponse, BrandRetrieveParams, BrandRetrieveResponse, BrandSearchParams, BrandSearchResponse } from "./resources/brand.mjs";
13
+ import { type LogLevel, type Logger } from "./internal/utils/log.mjs";
14
14
  export interface ClientOptions {
15
15
  /**
16
16
  * Defaults to process.env['BRAND_DEV_API_KEY'].
@@ -28,6 +28,8 @@ export interface ClientOptions {
28
28
  *
29
29
  * Note that request timeouts are retried by default, so in a worst-case scenario you may wait
30
30
  * much longer than this timeout before the promise succeeds or fails.
31
+ *
32
+ * @unit milliseconds
31
33
  */
32
34
  timeout?: number | undefined;
33
35
  /**
@@ -109,7 +111,7 @@ export declare class BrandDev {
109
111
  withOptions(options: Partial<ClientOptions>): this;
110
112
  protected defaultQuery(): Record<string, string | undefined> | undefined;
111
113
  protected validateHeaders({ values, nulls }: NullableHeaders): void;
112
- protected authHeaders(opts: FinalRequestOptions): NullableHeaders | undefined;
114
+ protected authHeaders(opts: FinalRequestOptions): Promise<NullableHeaders | undefined>;
113
115
  /**
114
116
  * Basic re-implementation of `qs.stringify` for primitive types.
115
117
  */
@@ -117,7 +119,7 @@ export declare class BrandDev {
117
119
  private getUserAgent;
118
120
  protected defaultIdempotencyKey(): string;
119
121
  protected makeStatusError(status: number, error: Object, message: string | undefined, headers: Headers): Errors.APIError;
120
- buildURL(path: string, query: Record<string, unknown> | null | undefined): string;
122
+ buildURL(path: string, query: Record<string, unknown> | null | undefined, defaultBaseURL?: string | undefined): string;
121
123
  /**
122
124
  * Used as a callback for mutating the given `FinalRequestOptions` object.
123
125
  */
@@ -146,11 +148,11 @@ export declare class BrandDev {
146
148
  private calculateDefaultRetryTimeoutMillis;
147
149
  buildRequest(inputOptions: FinalRequestOptions, { retryCount }?: {
148
150
  retryCount?: number;
149
- }): {
151
+ }): Promise<{
150
152
  req: FinalizedRequestInit;
151
153
  url: string;
152
154
  timeout: number;
153
- };
155
+ }>;
154
156
  private buildHeaders;
155
157
  private buildBody;
156
158
  static BrandDev: typeof BrandDev;
@@ -173,6 +175,6 @@ export declare class BrandDev {
173
175
  }
174
176
  export declare namespace BrandDev {
175
177
  export type RequestOptions = Opts.RequestOptions;
176
- export { Brand as Brand, type BrandRetrieveResponse as BrandRetrieveResponse, type BrandAIQueryResponse as BrandAIQueryResponse, type BrandIdentifyFromTransactionResponse as BrandIdentifyFromTransactionResponse, type BrandPrefetchResponse as BrandPrefetchResponse, type BrandRetrieveByTickerResponse as BrandRetrieveByTickerResponse, type BrandRetrieveNaicsResponse as BrandRetrieveNaicsResponse, type BrandSearchResponse as BrandSearchResponse, type BrandRetrieveParams as BrandRetrieveParams, type BrandAIQueryParams as BrandAIQueryParams, type BrandIdentifyFromTransactionParams as BrandIdentifyFromTransactionParams, type BrandPrefetchParams as BrandPrefetchParams, type BrandRetrieveByTickerParams as BrandRetrieveByTickerParams, type BrandRetrieveNaicsParams as BrandRetrieveNaicsParams, type BrandSearchParams as BrandSearchParams, };
178
+ export { Brand as Brand, type BrandRetrieveResponse as BrandRetrieveResponse, type BrandAIQueryResponse as BrandAIQueryResponse, type BrandIdentifyFromTransactionResponse as BrandIdentifyFromTransactionResponse, type BrandPrefetchResponse as BrandPrefetchResponse, type BrandRetrieveByTickerResponse as BrandRetrieveByTickerResponse, type BrandRetrieveNaicsResponse as BrandRetrieveNaicsResponse, type BrandRetrieveSimplifiedResponse as BrandRetrieveSimplifiedResponse, type BrandScreenshotResponse as BrandScreenshotResponse, type BrandStyleguideResponse as BrandStyleguideResponse, type BrandRetrieveParams as BrandRetrieveParams, type BrandAIQueryParams as BrandAIQueryParams, type BrandIdentifyFromTransactionParams as BrandIdentifyFromTransactionParams, type BrandPrefetchParams as BrandPrefetchParams, type BrandRetrieveByTickerParams as BrandRetrieveByTickerParams, type BrandRetrieveNaicsParams as BrandRetrieveNaicsParams, type BrandRetrieveSimplifiedParams as BrandRetrieveSimplifiedParams, type BrandScreenshotParams as BrandScreenshotParams, type BrandStyleguideParams as BrandStyleguideParams, };
177
179
  }
178
180
  //# sourceMappingURL=client.d.mts.map
package/client.d.mts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.mts","sourceRoot":"","sources":["src/client.ts"],"names":[],"mappings":"OAEO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAY;OAC3C,KAAK,EAAc,cAAc,EAAE,iBAAiB,EAAE,oBAAoB,EAAE;OAI5E,EAAE,KAAK,MAAM,EAAE,KAAK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1,16 +1,16 @@
1
1
  import type { RequestInit, RequestInfo } from "./internal/builtin-types.js";
2
2
  import type { PromiseOrValue, MergedRequestInit, FinalizedRequestInit } from "./internal/types.js";
3
- import { type Logger, type LogLevel } from "./internal/utils/log.js";
4
3
  export type { Logger, LogLevel } from "./internal/utils/log.js";
5
4
  import * as Opts from "./internal/request-options.js";
6
5
  import * as Errors from "./core/error.js";
7
6
  import * as Uploads from "./core/uploads.js";
8
7
  import * as API from "./resources/index.js";
9
8
  import { APIPromise } from "./core/api-promise.js";
9
+ import { Brand, BrandAIQueryParams, BrandAIQueryResponse, BrandIdentifyFromTransactionParams, BrandIdentifyFromTransactionResponse, BrandPrefetchParams, BrandPrefetchResponse, BrandRetrieveByTickerParams, BrandRetrieveByTickerResponse, BrandRetrieveNaicsParams, BrandRetrieveNaicsResponse, BrandRetrieveParams, BrandRetrieveResponse, BrandRetrieveSimplifiedParams, BrandRetrieveSimplifiedResponse, BrandScreenshotParams, BrandScreenshotResponse, BrandStyleguideParams, BrandStyleguideResponse } from "./resources/brand.js";
10
10
  import { type Fetch } from "./internal/builtin-types.js";
11
11
  import { HeadersLike, NullableHeaders } from "./internal/headers.js";
12
12
  import { FinalRequestOptions, RequestOptions } from "./internal/request-options.js";
13
- import { Brand, BrandAIQueryParams, BrandAIQueryResponse, BrandIdentifyFromTransactionParams, BrandIdentifyFromTransactionResponse, BrandPrefetchParams, BrandPrefetchResponse, BrandRetrieveByTickerParams, BrandRetrieveByTickerResponse, BrandRetrieveNaicsParams, BrandRetrieveNaicsResponse, BrandRetrieveParams, BrandRetrieveResponse, BrandSearchParams, BrandSearchResponse } from "./resources/brand.js";
13
+ import { type LogLevel, type Logger } from "./internal/utils/log.js";
14
14
  export interface ClientOptions {
15
15
  /**
16
16
  * Defaults to process.env['BRAND_DEV_API_KEY'].
@@ -28,6 +28,8 @@ export interface ClientOptions {
28
28
  *
29
29
  * Note that request timeouts are retried by default, so in a worst-case scenario you may wait
30
30
  * much longer than this timeout before the promise succeeds or fails.
31
+ *
32
+ * @unit milliseconds
31
33
  */
32
34
  timeout?: number | undefined;
33
35
  /**
@@ -109,7 +111,7 @@ export declare class BrandDev {
109
111
  withOptions(options: Partial<ClientOptions>): this;
110
112
  protected defaultQuery(): Record<string, string | undefined> | undefined;
111
113
  protected validateHeaders({ values, nulls }: NullableHeaders): void;
112
- protected authHeaders(opts: FinalRequestOptions): NullableHeaders | undefined;
114
+ protected authHeaders(opts: FinalRequestOptions): Promise<NullableHeaders | undefined>;
113
115
  /**
114
116
  * Basic re-implementation of `qs.stringify` for primitive types.
115
117
  */
@@ -117,7 +119,7 @@ export declare class BrandDev {
117
119
  private getUserAgent;
118
120
  protected defaultIdempotencyKey(): string;
119
121
  protected makeStatusError(status: number, error: Object, message: string | undefined, headers: Headers): Errors.APIError;
120
- buildURL(path: string, query: Record<string, unknown> | null | undefined): string;
122
+ buildURL(path: string, query: Record<string, unknown> | null | undefined, defaultBaseURL?: string | undefined): string;
121
123
  /**
122
124
  * Used as a callback for mutating the given `FinalRequestOptions` object.
123
125
  */
@@ -146,11 +148,11 @@ export declare class BrandDev {
146
148
  private calculateDefaultRetryTimeoutMillis;
147
149
  buildRequest(inputOptions: FinalRequestOptions, { retryCount }?: {
148
150
  retryCount?: number;
149
- }): {
151
+ }): Promise<{
150
152
  req: FinalizedRequestInit;
151
153
  url: string;
152
154
  timeout: number;
153
- };
155
+ }>;
154
156
  private buildHeaders;
155
157
  private buildBody;
156
158
  static BrandDev: typeof BrandDev;
@@ -173,6 +175,6 @@ export declare class BrandDev {
173
175
  }
174
176
  export declare namespace BrandDev {
175
177
  export type RequestOptions = Opts.RequestOptions;
176
- export { Brand as Brand, type BrandRetrieveResponse as BrandRetrieveResponse, type BrandAIQueryResponse as BrandAIQueryResponse, type BrandIdentifyFromTransactionResponse as BrandIdentifyFromTransactionResponse, type BrandPrefetchResponse as BrandPrefetchResponse, type BrandRetrieveByTickerResponse as BrandRetrieveByTickerResponse, type BrandRetrieveNaicsResponse as BrandRetrieveNaicsResponse, type BrandSearchResponse as BrandSearchResponse, type BrandRetrieveParams as BrandRetrieveParams, type BrandAIQueryParams as BrandAIQueryParams, type BrandIdentifyFromTransactionParams as BrandIdentifyFromTransactionParams, type BrandPrefetchParams as BrandPrefetchParams, type BrandRetrieveByTickerParams as BrandRetrieveByTickerParams, type BrandRetrieveNaicsParams as BrandRetrieveNaicsParams, type BrandSearchParams as BrandSearchParams, };
178
+ export { Brand as Brand, type BrandRetrieveResponse as BrandRetrieveResponse, type BrandAIQueryResponse as BrandAIQueryResponse, type BrandIdentifyFromTransactionResponse as BrandIdentifyFromTransactionResponse, type BrandPrefetchResponse as BrandPrefetchResponse, type BrandRetrieveByTickerResponse as BrandRetrieveByTickerResponse, type BrandRetrieveNaicsResponse as BrandRetrieveNaicsResponse, type BrandRetrieveSimplifiedResponse as BrandRetrieveSimplifiedResponse, type BrandScreenshotResponse as BrandScreenshotResponse, type BrandStyleguideResponse as BrandStyleguideResponse, type BrandRetrieveParams as BrandRetrieveParams, type BrandAIQueryParams as BrandAIQueryParams, type BrandIdentifyFromTransactionParams as BrandIdentifyFromTransactionParams, type BrandPrefetchParams as BrandPrefetchParams, type BrandRetrieveByTickerParams as BrandRetrieveByTickerParams, type BrandRetrieveNaicsParams as BrandRetrieveNaicsParams, type BrandRetrieveSimplifiedParams as BrandRetrieveSimplifiedParams, type BrandScreenshotParams as BrandScreenshotParams, type BrandStyleguideParams as BrandStyleguideParams, };
177
179
  }
178
180
  //# sourceMappingURL=client.d.ts.map
package/client.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["src/client.ts"],"names":[],"mappings":"OAEO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAY;OAC3C,KAAK,EAAc,cAAc,EAAE,iBAAiB,EAAE,oBAAoB,EAAE;OAI5E,EAAE,KAAK,MAAM,EAAE,KAAK,QAAQ,EAAiB;YACxC,EAAE,MAAM,EAAE,QAAQ,EAAE;OA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CONTRIBUTING.md for details.
3
- var _a, _BrandDev_encoder;
3
+ var _BrandDev_instances, _a, _BrandDev_encoder, _BrandDev_baseURLOverridden;
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.BrandDev = void 0;
6
6
  const tslib_1 = require("./internal/tslib.js");
7
7
  const uuid_1 = require("./internal/utils/uuid.js");
8
8
  const values_1 = require("./internal/utils/values.js");
9
9
  const sleep_1 = require("./internal/utils/sleep.js");
10
- const log_1 = require("./internal/utils/log.js");
11
10
  const errors_1 = require("./internal/errors.js");
12
11
  const detect_platform_1 = require("./internal/detect-platform.js");
13
12
  const Shims = tslib_1.__importStar(require("./internal/shims.js"));
@@ -17,10 +16,10 @@ const Errors = tslib_1.__importStar(require("./core/error.js"));
17
16
  const Uploads = tslib_1.__importStar(require("./core/uploads.js"));
18
17
  const API = tslib_1.__importStar(require("./resources/index.js"));
19
18
  const api_promise_1 = require("./core/api-promise.js");
20
- const headers_1 = require("./internal/headers.js");
21
19
  const brand_1 = require("./resources/brand.js");
20
+ const headers_1 = require("./internal/headers.js");
22
21
  const env_1 = require("./internal/utils/env.js");
23
- const log_2 = require("./internal/utils/log.js");
22
+ const log_1 = require("./internal/utils/log.js");
24
23
  const values_2 = require("./internal/utils/values.js");
25
24
  /**
26
25
  * API Client for interfacing with the Brand Dev API.
@@ -39,6 +38,7 @@ class BrandDev {
39
38
  * @param {Record<string, string | undefined>} opts.defaultQuery - Default query parameters to include with every request to the API.
40
39
  */
41
40
  constructor({ baseURL = (0, env_1.readEnv)('BRAND_DEV_BASE_URL'), apiKey = (0, env_1.readEnv)('BRAND_DEV_API_KEY'), ...opts } = {}) {
41
+ _BrandDev_instances.add(this);
42
42
  _BrandDev_encoder.set(this, void 0);
43
43
  this.brand = new API.Brand(this);
44
44
  if (apiKey === undefined) {
@@ -70,17 +70,19 @@ class BrandDev {
70
70
  * Create a new client instance re-using the same options given to the current client with optional overriding.
71
71
  */
72
72
  withOptions(options) {
73
- return new this.constructor({
73
+ const client = new this.constructor({
74
74
  ...this._options,
75
75
  baseURL: this.baseURL,
76
76
  maxRetries: this.maxRetries,
77
77
  timeout: this.timeout,
78
78
  logger: this.logger,
79
79
  logLevel: this.logLevel,
80
+ fetch: this.fetch,
80
81
  fetchOptions: this.fetchOptions,
81
82
  apiKey: this.apiKey,
82
83
  ...options,
83
84
  });
85
+ return client;
84
86
  }
85
87
  defaultQuery() {
86
88
  return this._options.defaultQuery;
@@ -88,7 +90,7 @@ class BrandDev {
88
90
  validateHeaders({ values, nulls }) {
89
91
  return;
90
92
  }
91
- authHeaders(opts) {
93
+ async authHeaders(opts) {
92
94
  return (0, headers_1.buildHeaders)([{ Authorization: `Bearer ${this.apiKey}` }]);
93
95
  }
94
96
  /**
@@ -117,10 +119,11 @@ class BrandDev {
117
119
  makeStatusError(status, error, message, headers) {
118
120
  return Errors.APIError.generate(status, error, message, headers);
119
121
  }
120
- buildURL(path, query) {
122
+ buildURL(path, query, defaultBaseURL) {
123
+ const baseURL = (!tslib_1.__classPrivateFieldGet(this, _BrandDev_instances, "m", _BrandDev_baseURLOverridden).call(this) && defaultBaseURL) || this.baseURL;
121
124
  const url = (0, values_1.isAbsoluteURL)(path) ?
122
125
  new URL(path)
123
- : new URL(this.baseURL + (this.baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path));
126
+ : new URL(baseURL + (baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path));
124
127
  const defaultQuery = this.defaultQuery();
125
128
  if (!(0, values_2.isEmptyObj)(defaultQuery)) {
126
129
  query = { ...defaultQuery, ...query };
@@ -171,13 +174,15 @@ class BrandDev {
171
174
  retriesRemaining = maxRetries;
172
175
  }
173
176
  await this.prepareOptions(options);
174
- const { req, url, timeout } = this.buildRequest(options, { retryCount: maxRetries - retriesRemaining });
177
+ const { req, url, timeout } = await this.buildRequest(options, {
178
+ retryCount: maxRetries - retriesRemaining,
179
+ });
175
180
  await this.prepareRequest(req, { url, options });
176
181
  /** Not an API request ID, just for correlating local log entries. */
177
182
  const requestLogID = 'log_' + ((Math.random() * (1 << 24)) | 0).toString(16).padStart(6, '0');
178
183
  const retryLogStr = retryOfRequestLogID === undefined ? '' : `, retryOf: ${retryOfRequestLogID}`;
179
184
  const startTime = Date.now();
180
- (0, log_2.loggerFor)(this).debug(`[${requestLogID}] sending request`, (0, log_2.formatRequestDetails)({
185
+ (0, log_1.loggerFor)(this).debug(`[${requestLogID}] sending request`, (0, log_1.formatRequestDetails)({
181
186
  retryOfRequestLogID,
182
187
  method: options.method,
183
188
  url,
@@ -202,8 +207,8 @@ class BrandDev {
202
207
  const isTimeout = (0, errors_1.isAbortError)(response) ||
203
208
  /timed? ?out/i.test(String(response) + ('cause' in response ? String(response.cause) : ''));
204
209
  if (retriesRemaining) {
205
- (0, log_2.loggerFor)(this).info(`[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} - ${retryMessage}`);
206
- (0, log_2.loggerFor)(this).debug(`[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} (${retryMessage})`, (0, log_2.formatRequestDetails)({
210
+ (0, log_1.loggerFor)(this).info(`[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} - ${retryMessage}`);
211
+ (0, log_1.loggerFor)(this).debug(`[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} (${retryMessage})`, (0, log_1.formatRequestDetails)({
207
212
  retryOfRequestLogID,
208
213
  url,
209
214
  durationMs: headersTime - startTime,
@@ -211,8 +216,8 @@ class BrandDev {
211
216
  }));
212
217
  return this.retryRequest(options, retriesRemaining, retryOfRequestLogID ?? requestLogID);
213
218
  }
214
- (0, log_2.loggerFor)(this).info(`[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} - error; no more retries left`);
215
- (0, log_2.loggerFor)(this).debug(`[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} (error; no more retries left)`, (0, log_2.formatRequestDetails)({
219
+ (0, log_1.loggerFor)(this).info(`[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} - error; no more retries left`);
220
+ (0, log_1.loggerFor)(this).debug(`[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} (error; no more retries left)`, (0, log_1.formatRequestDetails)({
216
221
  retryOfRequestLogID,
217
222
  url,
218
223
  durationMs: headersTime - startTime,
@@ -225,13 +230,13 @@ class BrandDev {
225
230
  }
226
231
  const responseInfo = `[${requestLogID}${retryLogStr}] ${req.method} ${url} ${response.ok ? 'succeeded' : 'failed'} with status ${response.status} in ${headersTime - startTime}ms`;
227
232
  if (!response.ok) {
228
- const shouldRetry = this.shouldRetry(response);
233
+ const shouldRetry = await this.shouldRetry(response);
229
234
  if (retriesRemaining && shouldRetry) {
230
235
  const retryMessage = `retrying, ${retriesRemaining} attempts remaining`;
231
236
  // We don't need the body of this response.
232
237
  await Shims.CancelReadableStream(response.body);
233
- (0, log_2.loggerFor)(this).info(`${responseInfo} - ${retryMessage}`);
234
- (0, log_2.loggerFor)(this).debug(`[${requestLogID}] response error (${retryMessage})`, (0, log_2.formatRequestDetails)({
238
+ (0, log_1.loggerFor)(this).info(`${responseInfo} - ${retryMessage}`);
239
+ (0, log_1.loggerFor)(this).debug(`[${requestLogID}] response error (${retryMessage})`, (0, log_1.formatRequestDetails)({
235
240
  retryOfRequestLogID,
236
241
  url: response.url,
237
242
  status: response.status,
@@ -241,11 +246,11 @@ class BrandDev {
241
246
  return this.retryRequest(options, retriesRemaining, retryOfRequestLogID ?? requestLogID, response.headers);
242
247
  }
243
248
  const retryMessage = shouldRetry ? `error; no more retries left` : `error; not retryable`;
244
- (0, log_2.loggerFor)(this).info(`${responseInfo} - ${retryMessage}`);
249
+ (0, log_1.loggerFor)(this).info(`${responseInfo} - ${retryMessage}`);
245
250
  const errText = await response.text().catch((err) => (0, errors_1.castToError)(err).message);
246
251
  const errJSON = (0, values_1.safeJSON)(errText);
247
252
  const errMessage = errJSON ? undefined : errText;
248
- (0, log_2.loggerFor)(this).debug(`[${requestLogID}] response error (${retryMessage})`, (0, log_2.formatRequestDetails)({
253
+ (0, log_1.loggerFor)(this).debug(`[${requestLogID}] response error (${retryMessage})`, (0, log_1.formatRequestDetails)({
249
254
  retryOfRequestLogID,
250
255
  url: response.url,
251
256
  status: response.status,
@@ -256,8 +261,8 @@ class BrandDev {
256
261
  const err = this.makeStatusError(response.status, errJSON, errMessage, response.headers);
257
262
  throw err;
258
263
  }
259
- (0, log_2.loggerFor)(this).info(responseInfo);
260
- (0, log_2.loggerFor)(this).debug(`[${requestLogID}] response start`, (0, log_2.formatRequestDetails)({
264
+ (0, log_1.loggerFor)(this).info(responseInfo);
265
+ (0, log_1.loggerFor)(this).debug(`[${requestLogID}] response start`, (0, log_1.formatRequestDetails)({
261
266
  retryOfRequestLogID,
262
267
  url: response.url,
263
268
  status: response.status,
@@ -292,7 +297,7 @@ class BrandDev {
292
297
  clearTimeout(timeout);
293
298
  }
294
299
  }
295
- shouldRetry(response) {
300
+ async shouldRetry(response) {
296
301
  // Note this is not a standard header.
297
302
  const shouldRetryHeader = response.headers.get('x-should-retry');
298
303
  // If the server explicitly says whether or not to retry, obey.
@@ -354,15 +359,15 @@ class BrandDev {
354
359
  const jitter = 1 - Math.random() * 0.25;
355
360
  return sleepSeconds * jitter * 1000;
356
361
  }
357
- buildRequest(inputOptions, { retryCount = 0 } = {}) {
362
+ async buildRequest(inputOptions, { retryCount = 0 } = {}) {
358
363
  const options = { ...inputOptions };
359
- const { method, path, query } = options;
360
- const url = this.buildURL(path, query);
364
+ const { method, path, query, defaultBaseURL } = options;
365
+ const url = this.buildURL(path, query, defaultBaseURL);
361
366
  if ('timeout' in options)
362
367
  (0, values_1.validatePositiveInteger)('timeout', options.timeout);
363
368
  options.timeout = options.timeout ?? this.timeout;
364
369
  const { bodyHeaders, body } = this.buildBody({ options });
365
- const reqHeaders = this.buildHeaders({ options: inputOptions, method, bodyHeaders, retryCount });
370
+ const reqHeaders = await this.buildHeaders({ options: inputOptions, method, bodyHeaders, retryCount });
366
371
  const req = {
367
372
  method,
368
373
  headers: reqHeaders,
@@ -375,7 +380,7 @@ class BrandDev {
375
380
  };
376
381
  return { req, url, timeout: options.timeout };
377
382
  }
378
- buildHeaders({ options, method, bodyHeaders, retryCount, }) {
383
+ async buildHeaders({ options, method, bodyHeaders, retryCount, }) {
379
384
  let idempotencyHeaders = {};
380
385
  if (this.idempotencyHeader && method !== 'get') {
381
386
  if (!options.idempotencyKey)
@@ -391,7 +396,7 @@ class BrandDev {
391
396
  ...(options.timeout ? { 'X-Stainless-Timeout': String(Math.trunc(options.timeout / 1000)) } : {}),
392
397
  ...(0, detect_platform_1.getPlatformHeaders)(),
393
398
  },
394
- this.authHeaders(options),
399
+ await this.authHeaders(options),
395
400
  this._options.defaultHeaders,
396
401
  bodyHeaders,
397
402
  options.headers,
@@ -433,7 +438,9 @@ class BrandDev {
433
438
  }
434
439
  }
435
440
  exports.BrandDev = BrandDev;
436
- _a = BrandDev, _BrandDev_encoder = new WeakMap();
441
+ _a = BrandDev, _BrandDev_encoder = new WeakMap(), _BrandDev_instances = new WeakSet(), _BrandDev_baseURLOverridden = function _BrandDev_baseURLOverridden() {
442
+ return this.baseURL !== 'https://api.brand.dev/v1';
443
+ };
437
444
  BrandDev.BrandDev = _a;
438
445
  BrandDev.DEFAULT_TIMEOUT = 60000; // 1 minute
439
446
  BrandDev.BrandDevError = Errors.BrandDevError;