diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 579ae9f..f1c1e58 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.4.7" + ".": "0.5.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index fd30831..2b69ae4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## 0.5.0 (2026-04-28) + +Full Changelog: [v0.4.7...v0.5.0](https://github.com/anthalehq/anthale-node/compare/v0.4.7...v0.5.0) + +### Features + +* support setting headers via env ([26769d0](https://github.com/anthalehq/anthale-node/commit/26769d08105f6e560c8bc0f63f4e028a3bcc0d54)) + + +### Chores + +* **internal:** codegen related update ([afdad52](https://github.com/anthalehq/anthale-node/commit/afdad52ac3978b1dd8de18814a56a1f0499e82be)) +* **internal:** more robust bootstrap script ([acaebb6](https://github.com/anthalehq/anthale-node/commit/acaebb60ded9c430bbe61999af1a127a923c18a2)) + ## 0.4.7 (2026-04-21) Full Changelog: [v0.4.6...v0.4.7](https://github.com/anthalehq/anthale-node/compare/v0.4.6...v0.4.7) diff --git a/package.json b/package.json index 1f5cbae..11fe950 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "anthale", - "version": "0.4.7", + "version": "0.5.0", "description": "The official TypeScript library for the Anthale API", "author": "Anthale ", "types": "dist/index.d.ts", diff --git a/scripts/bootstrap b/scripts/bootstrap index 2bb3c94..3a8293a 100755 --- a/scripts/bootstrap +++ b/scripts/bootstrap @@ -4,7 +4,7 @@ set -e cd "$(dirname "$0")/.." -if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ] && [ "$SKIP_BREW" != "1" ] && [ -t 0 ]; then +if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ] && [ "${SKIP_BREW:-}" != "1" ] && [ -t 0 ]; then brew bundle check >/dev/null 2>&1 || { echo -n "==> Install Homebrew dependencies? (y/N): " read -r response diff --git a/scripts/utils/postprocess-files.cjs b/scripts/utils/postprocess-files.cjs index deae575..a8cdeb7 100644 --- a/scripts/utils/postprocess-files.cjs +++ b/scripts/utils/postprocess-files.cjs @@ -23,12 +23,19 @@ async function postprocess() { // strip out lib="dom", types="node", and types="react" references; these // are needed at build time, but would pollute the user's TS environment - const transformed = code.replace( + let transformed = code.replace( /^ *\/\/\/ * ' '.repeat(match.length - 1) + '\n', ); + // TypeScript's declaration emitter collapses /** @ts-ignore */ onto the same + // line as the type declaration, which doesn't work. So we convert to // @ts-ignore + // on its own line to properly suppresses errors. + if (file.endsWith('.d.ts') || file.endsWith('.d.mts') || file.endsWith('.d.cts')) { + transformed = transformed.replace(/\/\*\* @ts-ignore\b[^*]*\*\/ /gm, '// @ts-ignore\n'); + } + if (transformed !== code) { console.error(`wrote ${path.relative(process.cwd(), file)}`); await fs.promises.writeFile(file, transformed, 'utf8'); diff --git a/src/client.ts b/src/client.ts index b2e2e34..e343259 100644 --- a/src/client.ts +++ b/src/client.ts @@ -168,6 +168,18 @@ export class Anthale { this.fetch = options.fetch ?? Shims.getDefaultFetch(); this.#encoder = Opts.FallbackEncoder; + const customHeadersEnv = readEnv('ANTHALE_CUSTOM_HEADERS'); + if (customHeadersEnv) { + const parsed: Record = {}; + for (const line of customHeadersEnv.split('\n')) { + const colon = line.indexOf(':'); + if (colon >= 0) { + parsed[line.substring(0, colon).trim()] = line.substring(colon + 1).trim(); + } + } + options.defaultHeaders = { ...parsed, ...options.defaultHeaders }; + } + this._options = options; this.apiKey = apiKey; diff --git a/src/version.ts b/src/version.ts index 543c3a7..1f5d158 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '0.4.7'; // x-release-please-version +export const VERSION = '0.5.0'; // x-release-please-version