Skip to content

Commit 09cbe83

Browse files
authored
Merge pull request #137 from smarty/ryan/remove_axios
Ryan/remove axios
2 parents 68fb45e + 2e33b2a commit 09cbe83

26 files changed

+734
-531
lines changed

CLAUDE.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ npx prettier --write . # Format all files (respects .prettierignore)
1313
```
1414

1515
Makefile targets (used by CI):
16+
1617
```bash
1718
make test # fmt + test (installs deps if needed)
1819
make build # Rollup build
@@ -26,7 +27,7 @@ To run a single test file:
2627
npx mocha --require tsx/cjs tests/test_RetrySender.ts
2728
```
2829

29-
Build outputs dual formats via Rollup: `dist/cjs/` (CommonJS), `dist/esm/` (ESM), and `dist/types/` (declarations). Rollup preserves module structure (`preserveModules: true`). Axios and axios-retry are external dependencies (not bundled).
30+
Build outputs dual formats via Rollup: `dist/cjs/` (CommonJS), `dist/esm/` (ESM), and `dist/types/` (declarations). Rollup preserves module structure (`preserveModules: true`). `undici` is the only external dependency (not bundled).
3031

3132
## Architecture
3233

@@ -41,7 +42,7 @@ CustomQuerySender → LicenseSender → BaseUrlSender → CustomHeaderSender
4142
→ AgentSender → RetrySender → SigningSender → StatusCodeSender → HttpSender
4243
```
4344

44-
Each sender adds specific functionality (authentication, retries, headers, etc.). The `HttpSender` at the end uses Axios for actual HTTP transport.
45+
Each sender adds specific functionality (authentication, retries, headers, etc.). The `HttpSender` at the end uses the Fetch API for HTTP transport (with optional `undici` `ProxyAgent` for proxy support in Node.js).
4546

4647
All senders implement the `Sender` interface from `src/types.ts`, which also defines the core `Request` and `Response` contracts that flow through the chain.
4748

UPGRADING.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,11 @@ console.log(response.lookups[0].result);
8888

8989
## Import Patterns
9090

91-
| Style | Syntax |
92-
| --- | --- |
93-
| ESM default import | `import SmartySDK from "smartystreets-javascript-sdk"` |
94-
| ESM named imports | `import { core, usStreet } from "smartystreets-javascript-sdk"` |
95-
| CommonJS | `const SmartySDK = require("smartystreets-javascript-sdk")` |
91+
| Style | Syntax |
92+
| ---------------------- | ------------------------------------------------------------------- |
93+
| ESM default import | `import SmartySDK from "smartystreets-javascript-sdk"` |
94+
| ESM named imports | `import { core, usStreet } from "smartystreets-javascript-sdk"` |
95+
| CommonJS | `const SmartySDK = require("smartystreets-javascript-sdk")` |
9696
| TypeScript type import | `import type { MatchStrategy } from "smartystreets-javascript-sdk"` |
9797

9898
## FAQ

examples/international_address_autocomplete.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import { ClientBuilder, BasicAuthCredentials, LookupInternationalAddressAutocomplete } from "smartystreets-javascript-sdk";
1+
import {
2+
ClientBuilder,
3+
BasicAuthCredentials,
4+
LookupInternationalAddressAutocomplete,
5+
} from "smartystreets-javascript-sdk";
26

37
// for client-side requests (browser/mobile), use this code:
48
// import { SharedCredentials } from "smartystreets-javascript-sdk";
@@ -41,7 +45,10 @@ function logSuggestions(response: LookupInternationalAddressAutocomplete, messag
4145
console.log("\n");
4246
}
4347

44-
async function handleRequest(lookup: LookupInternationalAddressAutocomplete, lookupType: string): Promise<void> {
48+
async function handleRequest(
49+
lookup: LookupInternationalAddressAutocomplete,
50+
lookupType: string,
51+
): Promise<void> {
4552
try {
4653
const results = await client.send(lookup);
4754
logSuggestions(results, lookupType);

examples/international_postal_code.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import { ClientBuilder, BasicAuthCredentials, LookupInternationalPostalCode } from "smartystreets-javascript-sdk";
1+
import {
2+
ClientBuilder,
3+
BasicAuthCredentials,
4+
LookupInternationalPostalCode,
5+
} from "smartystreets-javascript-sdk";
26

37
// for client-side requests (browser/mobile), use this code:
48
// import { SharedCredentials } from "smartystreets-javascript-sdk";
@@ -43,7 +47,10 @@ function displayResult(lookup: LookupInternationalPostalCode, message: string):
4347
console.log("\n");
4448
}
4549

46-
async function handleResponse(lookup: LookupInternationalPostalCode, lookupType: string): Promise<void> {
50+
async function handleResponse(
51+
lookup: LookupInternationalPostalCode,
52+
lookupType: string,
53+
): Promise<void> {
4754
try {
4855
const result = await client.send(lookup);
4956
displayResult(result, lookupType);
@@ -59,7 +66,13 @@ async function main(): Promise<void> {
5966
// lookup1.addCustomParameter("input_id", 1234);
6067

6168
// Lookup by locality, administrative area, and country
62-
const lookup2 = new LookupInternationalPostalCode("Brazil", undefined, "SP", "Sao Paulo", "ID-8675309");
69+
const lookup2 = new LookupInternationalPostalCode(
70+
"Brazil",
71+
undefined,
72+
"SP",
73+
"Sao Paulo",
74+
"ID-8675309",
75+
);
6376

6477
await handleResponse(lookup1, "Postal code lookup");
6578
await handleResponse(lookup2, "Locality and administrative area lookup");

examples/international_street.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import { ClientBuilder, BasicAuthCredentials, LookupInternationalStreet } from "smartystreets-javascript-sdk";
1+
import {
2+
ClientBuilder,
3+
BasicAuthCredentials,
4+
LookupInternationalStreet,
5+
} from "smartystreets-javascript-sdk";
26

37
// for client-side requests (browser/mobile), use this code:
48
// import { SharedCredentials } from "smartystreets-javascript-sdk";

examples/us_autocomplete_pro.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import { ClientBuilder, BasicAuthCredentials, LookupUSAutocompletePro } from "smartystreets-javascript-sdk";
1+
import {
2+
ClientBuilder,
3+
BasicAuthCredentials,
4+
LookupUSAutocompletePro,
5+
} from "smartystreets-javascript-sdk";
26

37
// for client-side requests (browser/mobile), use this code:
48
// import { SharedCredentials } from "smartystreets-javascript-sdk";

examples/us_enrichment.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import { ClientBuilder, BasicAuthCredentials, LookupUSEnrichment } from "smartystreets-javascript-sdk";
1+
import {
2+
ClientBuilder,
3+
BasicAuthCredentials,
4+
LookupUSEnrichment,
5+
} from "smartystreets-javascript-sdk";
26

37
// for client-side requests (browser/mobile), use this code:
48
// import { SharedCredentials } from "smartystreets-javascript-sdk";

examples/us_reverse_geo.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import { ClientBuilder, BasicAuthCredentials, LookupUSReverseGeo } from "smartystreets-javascript-sdk";
1+
import {
2+
ClientBuilder,
3+
BasicAuthCredentials,
4+
LookupUSReverseGeo,
5+
} from "smartystreets-javascript-sdk";
26

37
// for client-side requests (browser/mobile), use this code:
48
// import { SharedCredentials } from "smartystreets-javascript-sdk";

examples/us_street.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
import { ClientBuilder, BasicAuthCredentials, LookupUSStreet, Batch } from "smartystreets-javascript-sdk";
1+
import {
2+
ClientBuilder,
3+
BasicAuthCredentials,
4+
LookupUSStreet,
5+
Batch,
6+
} from "smartystreets-javascript-sdk";
27

38
// for client-side requests (browser/mobile), use this code:
49
// import { SharedCredentials } from "smartystreets-javascript-sdk";

examples/us_zipcode.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
import { ClientBuilder, BasicAuthCredentials, LookupUSZipcode, Batch } from "smartystreets-javascript-sdk";
1+
import {
2+
ClientBuilder,
3+
BasicAuthCredentials,
4+
LookupUSZipcode,
5+
Batch,
6+
} from "smartystreets-javascript-sdk";
27

38
// for client-side requests (browser/mobile), use this code:
49
// import { SharedCredentials } from "smartystreets-javascript-sdk";

0 commit comments

Comments
 (0)