smartystreets-javascript-sdk 8.2.1 → 8.2.2

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 (291) hide show
  1. package/LICENSE.md +184 -183
  2. package/Readme.md +11 -0
  3. package/dist/cjs/AgentSender.cjs +1 -1
  4. package/dist/cjs/BaseUrlSender.cjs +1 -1
  5. package/dist/cjs/Batch.cjs +1 -1
  6. package/dist/cjs/ClientBuilder.cjs +1 -1
  7. package/dist/cjs/CustomHeaderSender.cjs +1 -1
  8. package/dist/cjs/Errors.cjs +1 -1
  9. package/dist/cjs/HttpSender.cjs +1 -1
  10. package/dist/cjs/InputData.cjs +1 -1
  11. package/dist/cjs/LicenseSender.cjs +1 -1
  12. package/dist/cjs/Request.cjs +1 -1
  13. package/dist/cjs/Response.cjs +1 -1
  14. package/dist/cjs/RetrySender.cjs +1 -1
  15. package/dist/cjs/SigningSender.cjs +1 -1
  16. package/dist/cjs/StatusCodeSender.cjs +1 -1
  17. package/dist/cjs/_virtual/Batch.cjs +1 -0
  18. package/dist/cjs/_virtual/Candidate.cjs +1 -0
  19. package/dist/cjs/_virtual/Candidate2.cjs +1 -0
  20. package/dist/cjs/_virtual/ClientBuilder.cjs +1 -0
  21. package/dist/cjs/_virtual/Errors.cjs +1 -0
  22. package/dist/cjs/_virtual/Lookup.cjs +1 -0
  23. package/dist/cjs/_virtual/Lookup2.cjs +1 -0
  24. package/dist/cjs/_virtual/Lookup3.cjs +1 -0
  25. package/dist/cjs/_virtual/Lookup4.cjs +1 -0
  26. package/dist/cjs/_virtual/Lookup5.cjs +1 -0
  27. package/dist/cjs/_virtual/Lookup6.cjs +1 -0
  28. package/dist/cjs/_virtual/Lookup7.cjs +1 -0
  29. package/dist/cjs/_virtual/Lookup8.cjs +1 -0
  30. package/dist/cjs/_virtual/Lookup9.cjs +1 -0
  31. package/dist/cjs/_virtual/Response.cjs +1 -0
  32. package/dist/cjs/_virtual/Result.cjs +1 -0
  33. package/dist/cjs/_virtual/Result2.cjs +1 -0
  34. package/dist/cjs/_virtual/Result3.cjs +1 -0
  35. package/dist/cjs/_virtual/Suggestion.cjs +1 -0
  36. package/dist/cjs/_virtual/Suggestion2.cjs +1 -0
  37. package/dist/cjs/_virtual/_commonjsHelpers.cjs +1 -0
  38. package/dist/cjs/_virtual/buildClients.cjs +1 -0
  39. package/dist/cjs/index.cjs +1 -1
  40. package/dist/cjs/international_address_autocomplete/Client.cjs +1 -1
  41. package/dist/cjs/international_address_autocomplete/Lookup.cjs +1 -1
  42. package/dist/cjs/international_address_autocomplete/Suggestion.cjs +1 -1
  43. package/dist/cjs/international_postal_code/Client.cjs +1 -1
  44. package/dist/cjs/international_postal_code/Lookup.cjs +1 -1
  45. package/dist/cjs/international_postal_code/Result.cjs +1 -1
  46. package/dist/cjs/international_street/Candidate.cjs +1 -1
  47. package/dist/cjs/international_street/Client.cjs +1 -1
  48. package/dist/cjs/international_street/Lookup.cjs +1 -1
  49. package/dist/cjs/us_autocomplete_pro/Client.cjs +1 -1
  50. package/dist/cjs/us_autocomplete_pro/Lookup.cjs +1 -1
  51. package/dist/cjs/us_autocomplete_pro/Suggestion.cjs +1 -1
  52. package/dist/cjs/us_enrichment/Client.cjs +1 -1
  53. package/dist/cjs/us_enrichment/Lookup.cjs +1 -1
  54. package/dist/cjs/us_enrichment/Response.cjs +1 -1
  55. package/dist/cjs/us_extract/Address.cjs +1 -1
  56. package/dist/cjs/us_extract/Client.cjs +1 -1
  57. package/dist/cjs/us_extract/Lookup.cjs +1 -1
  58. package/dist/cjs/us_extract/Result.cjs +1 -1
  59. package/dist/cjs/us_reverse_geo/Client.cjs +1 -1
  60. package/dist/cjs/us_reverse_geo/Lookup.cjs +1 -1
  61. package/dist/cjs/us_reverse_geo/Response.cjs +1 -1
  62. package/dist/cjs/us_reverse_geo/Result.cjs +1 -1
  63. package/dist/cjs/us_street/Candidate.cjs +1 -1
  64. package/dist/cjs/us_street/Client.cjs +1 -1
  65. package/dist/cjs/us_street/Lookup.cjs +1 -1
  66. package/dist/cjs/us_zipcode/Client.cjs +1 -1
  67. package/dist/cjs/us_zipcode/Lookup.cjs +1 -1
  68. package/dist/cjs/us_zipcode/Result.cjs +1 -1
  69. package/dist/cjs/util/apiToSDKKeyMap.cjs +1 -1
  70. package/dist/cjs/util/buildClients.cjs +1 -1
  71. package/dist/cjs/util/buildInputData.cjs +1 -1
  72. package/dist/cjs/util/buildSmartyResponse.cjs +1 -1
  73. package/dist/cjs/util/buildUsStreetInputData.cjs +1 -1
  74. package/dist/cjs/util/sendBatch.cjs +1 -1
  75. package/dist/esm/AgentSender.mjs +1 -1
  76. package/dist/esm/BaseUrlSender.mjs +1 -1
  77. package/dist/esm/Batch.mjs +1 -1
  78. package/dist/esm/ClientBuilder.mjs +1 -1
  79. package/dist/esm/CustomHeaderSender.mjs +1 -1
  80. package/dist/esm/Errors.mjs +1 -1
  81. package/dist/esm/HttpSender.mjs +1 -1
  82. package/dist/esm/InputData.mjs +1 -1
  83. package/dist/esm/LicenseSender.mjs +1 -1
  84. package/dist/esm/Request.mjs +1 -1
  85. package/dist/esm/Response.mjs +1 -1
  86. package/dist/esm/RetrySender.mjs +1 -1
  87. package/dist/esm/SigningSender.mjs +1 -1
  88. package/dist/esm/StatusCodeSender.mjs +1 -1
  89. package/dist/esm/_virtual/Batch.mjs +1 -0
  90. package/dist/esm/_virtual/Candidate.mjs +1 -0
  91. package/dist/esm/_virtual/Candidate2.mjs +1 -0
  92. package/dist/esm/_virtual/ClientBuilder.mjs +1 -0
  93. package/dist/esm/_virtual/Errors.mjs +1 -0
  94. package/dist/esm/_virtual/Lookup.mjs +1 -0
  95. package/dist/esm/_virtual/Lookup2.mjs +1 -0
  96. package/dist/esm/_virtual/Lookup3.mjs +1 -0
  97. package/dist/esm/_virtual/Lookup4.mjs +1 -0
  98. package/dist/esm/_virtual/Lookup5.mjs +1 -0
  99. package/dist/esm/_virtual/Lookup6.mjs +1 -0
  100. package/dist/esm/_virtual/Lookup7.mjs +1 -0
  101. package/dist/esm/_virtual/Lookup8.mjs +1 -0
  102. package/dist/esm/_virtual/Lookup9.mjs +1 -0
  103. package/dist/esm/_virtual/Response.mjs +1 -0
  104. package/dist/esm/_virtual/Result.mjs +1 -0
  105. package/dist/esm/_virtual/Result2.mjs +1 -0
  106. package/dist/esm/_virtual/Result3.mjs +1 -0
  107. package/dist/esm/_virtual/Suggestion.mjs +1 -0
  108. package/dist/esm/_virtual/Suggestion2.mjs +1 -0
  109. package/dist/esm/_virtual/_commonjsHelpers.mjs +1 -0
  110. package/dist/esm/_virtual/buildClients.mjs +1 -0
  111. package/dist/esm/index.mjs +1 -1
  112. package/dist/esm/international_address_autocomplete/Client.mjs +1 -1
  113. package/dist/esm/international_address_autocomplete/Lookup.mjs +1 -1
  114. package/dist/esm/international_address_autocomplete/Suggestion.mjs +1 -1
  115. package/dist/esm/international_postal_code/Client.mjs +1 -1
  116. package/dist/esm/international_postal_code/Lookup.mjs +1 -1
  117. package/dist/esm/international_postal_code/Result.mjs +1 -1
  118. package/dist/esm/international_street/Candidate.mjs +1 -1
  119. package/dist/esm/international_street/Client.mjs +1 -1
  120. package/dist/esm/international_street/Lookup.mjs +1 -1
  121. package/dist/esm/us_autocomplete_pro/Client.mjs +1 -1
  122. package/dist/esm/us_autocomplete_pro/Lookup.mjs +1 -1
  123. package/dist/esm/us_autocomplete_pro/Suggestion.mjs +1 -1
  124. package/dist/esm/us_enrichment/Client.mjs +1 -1
  125. package/dist/esm/us_enrichment/Lookup.mjs +1 -1
  126. package/dist/esm/us_enrichment/Response.mjs +1 -1
  127. package/dist/esm/us_extract/Address.mjs +1 -1
  128. package/dist/esm/us_extract/Client.mjs +1 -1
  129. package/dist/esm/us_extract/Lookup.mjs +1 -1
  130. package/dist/esm/us_extract/Result.mjs +1 -1
  131. package/dist/esm/us_reverse_geo/Client.mjs +1 -1
  132. package/dist/esm/us_reverse_geo/Lookup.mjs +1 -1
  133. package/dist/esm/us_reverse_geo/Response.mjs +1 -1
  134. package/dist/esm/us_reverse_geo/Result.mjs +1 -1
  135. package/dist/esm/us_street/Candidate.mjs +1 -1
  136. package/dist/esm/us_street/Client.mjs +1 -1
  137. package/dist/esm/us_street/Lookup.mjs +1 -1
  138. package/dist/esm/us_zipcode/Client.mjs +1 -1
  139. package/dist/esm/us_zipcode/Lookup.mjs +1 -1
  140. package/dist/esm/us_zipcode/Result.mjs +1 -1
  141. package/dist/esm/util/apiToSDKKeyMap.mjs +1 -1
  142. package/dist/esm/util/buildClients.mjs +1 -1
  143. package/dist/esm/util/buildInputData.mjs +1 -1
  144. package/dist/esm/util/buildSmartyResponse.mjs +1 -1
  145. package/dist/esm/util/buildUsStreetInputData.mjs +1 -1
  146. package/dist/esm/util/sendBatch.mjs +1 -1
  147. package/dist/tsconfig.tsbuildinfo +1 -0
  148. package/dist/types/Batch.d.ts +19 -0
  149. package/dist/types/ClientBuilder.d.ts +126 -0
  150. package/dist/types/Errors.d.ts +42 -0
  151. package/dist/types/HttpSender.d.ts +22 -0
  152. package/dist/types/InputData.d.ts +10 -0
  153. package/dist/types/LicenseSender.d.ts +7 -0
  154. package/dist/types/Request.d.ts +13 -0
  155. package/dist/types/Response.d.ts +8 -0
  156. package/dist/types/{src/SigningSender.d.ts → SigningSender.d.ts} +5 -1
  157. package/dist/types/StatusCodeSender.d.ts +6 -0
  158. package/dist/types/international_address_autocomplete/Client.d.ts +6 -0
  159. package/dist/types/international_address_autocomplete/Lookup.d.ts +15 -0
  160. package/dist/types/international_address_autocomplete/Suggestion.d.ts +14 -0
  161. package/dist/types/international_postal_code/Client.d.ts +15 -0
  162. package/dist/types/international_postal_code/Lookup.d.ts +17 -0
  163. package/dist/types/international_postal_code/Result.d.ts +18 -0
  164. package/dist/types/international_street/Candidate.d.ts +26 -0
  165. package/dist/types/international_street/Client.d.ts +10 -0
  166. package/dist/types/international_street/Lookup.d.ts +29 -0
  167. package/dist/types/{src/types.d.ts → types.d.ts} +1 -11
  168. package/dist/types/us_autocomplete_pro/Client.d.ts +10 -0
  169. package/dist/types/us_autocomplete_pro/Lookup.d.ts +28 -0
  170. package/dist/types/us_autocomplete_pro/Suggestion.d.ts +14 -0
  171. package/dist/types/us_enrichment/Client.d.ts +10 -0
  172. package/dist/types/us_enrichment/Lookup.d.ts +13 -0
  173. package/dist/types/us_enrichment/Response.d.ts +20 -0
  174. package/dist/types/us_extract/Address.d.ts +13 -0
  175. package/dist/types/us_extract/Client.d.ts +10 -0
  176. package/dist/types/us_extract/Lookup.d.ts +23 -0
  177. package/dist/types/us_extract/Result.d.ts +19 -0
  178. package/dist/types/us_reverse_geo/Client.d.ts +10 -0
  179. package/dist/types/us_reverse_geo/Lookup.d.ts +16 -0
  180. package/dist/types/us_reverse_geo/Response.d.ts +8 -0
  181. package/dist/types/us_reverse_geo/Result.d.ts +13 -0
  182. package/dist/types/us_street/Candidate.d.ts +22 -0
  183. package/dist/types/us_street/Client.d.ts +15 -0
  184. package/dist/types/us_street/Lookup.d.ts +26 -0
  185. package/dist/types/us_zipcode/Client.d.ts +15 -0
  186. package/dist/types/us_zipcode/Lookup.d.ts +16 -0
  187. package/dist/types/us_zipcode/Result.d.ts +13 -0
  188. package/dist/types/util/apiToSDKKeyMap.d.ts +94 -0
  189. package/dist/types/util/buildClients.d.ts +10 -0
  190. package/dist/types/util/buildInputData.d.ts +2 -0
  191. package/dist/types/util/buildSmartyResponse.d.ts +2 -0
  192. package/dist/types/util/buildUsStreetInputData.d.ts +2 -0
  193. package/dist/types/util/sendBatch.d.ts +2 -0
  194. package/package.json +5 -4
  195. package/README.md +0 -145
  196. package/dist/types/index.d.ts +0 -180
  197. package/dist/types/src/Batch.d.ts +0 -12
  198. package/dist/types/src/ClientBuilder.d.ts +0 -55
  199. package/dist/types/src/Errors.d.ts +0 -59
  200. package/dist/types/src/HttpSender.d.ts +0 -11
  201. package/dist/types/src/InputData.d.ts +0 -9
  202. package/dist/types/src/LicenseSender.d.ts +0 -7
  203. package/dist/types/src/Request.d.ts +0 -9
  204. package/dist/types/src/Response.d.ts +0 -8
  205. package/dist/types/src/StatusCodeSender.d.ts +0 -6
  206. package/dist/types/src/international_address_autocomplete/Client.d.ts +0 -7
  207. package/dist/types/src/international_address_autocomplete/Lookup.d.ts +0 -20
  208. package/dist/types/src/international_address_autocomplete/Suggestion.d.ts +0 -25
  209. package/dist/types/src/international_postal_code/Client.d.ts +0 -7
  210. package/dist/types/src/international_postal_code/Lookup.d.ts +0 -12
  211. package/dist/types/src/international_postal_code/Result.d.ts +0 -27
  212. package/dist/types/src/international_street/Candidate.d.ts +0 -250
  213. package/dist/types/src/international_street/Client.d.ts +0 -7
  214. package/dist/types/src/international_street/Lookup.d.ts +0 -24
  215. package/dist/types/src/us_autocomplete_pro/Client.d.ts +0 -7
  216. package/dist/types/src/us_autocomplete_pro/Lookup.d.ts +0 -21
  217. package/dist/types/src/us_autocomplete_pro/Suggestion.d.ts +0 -19
  218. package/dist/types/src/us_enrichment/Client.d.ts +0 -11
  219. package/dist/types/src/us_enrichment/Lookup.d.ts +0 -13
  220. package/dist/types/src/us_enrichment/Response.d.ts +0 -1081
  221. package/dist/types/src/us_extract/Address.d.ts +0 -18
  222. package/dist/types/src/us_extract/Client.d.ts +0 -7
  223. package/dist/types/src/us_extract/Lookup.d.ts +0 -12
  224. package/dist/types/src/us_extract/Result.d.ts +0 -26
  225. package/dist/types/src/us_reverse_geo/Client.d.ts +0 -7
  226. package/dist/types/src/us_reverse_geo/Lookup.d.ts +0 -10
  227. package/dist/types/src/us_reverse_geo/Response.d.ts +0 -9
  228. package/dist/types/src/us_reverse_geo/Result.d.ts +0 -41
  229. package/dist/types/src/us_street/Candidate.d.ts +0 -189
  230. package/dist/types/src/us_street/Client.d.ts +0 -8
  231. package/dist/types/src/us_street/Lookup.d.ts +0 -24
  232. package/dist/types/src/us_zipcode/Client.d.ts +0 -8
  233. package/dist/types/src/us_zipcode/Lookup.d.ts +0 -11
  234. package/dist/types/src/us_zipcode/Result.d.ts +0 -67
  235. package/dist/types/src/util/apiToSDKKeyMap.d.ts +0 -13
  236. package/dist/types/src/util/buildClients.d.ts +0 -25
  237. package/dist/types/src/util/buildInputData.d.ts +0 -6
  238. package/dist/types/src/util/buildSmartyResponse.d.ts +0 -9
  239. package/dist/types/src/util/buildUsStreetInputData.d.ts +0 -2
  240. package/dist/types/src/util/sendBatch.d.ts +0 -5
  241. package/dist/types/tests/fixtures/MockSleeper.d.ts +0 -5
  242. package/dist/types/tests/fixtures/mock_senders.d.ts +0 -25
  243. package/dist/types/tests/international_address_autocomplete/test_Client.d.ts +0 -1
  244. package/dist/types/tests/international_address_autocomplete/test_Lookup.d.ts +0 -1
  245. package/dist/types/tests/international_postal_code/test_Client.d.ts +0 -1
  246. package/dist/types/tests/international_postal_code/test_Lookup.d.ts +0 -1
  247. package/dist/types/tests/international_postal_code/test_Result.d.ts +0 -1
  248. package/dist/types/tests/international_street/test_Candidate.d.ts +0 -1
  249. package/dist/types/tests/international_street/test_Client.d.ts +0 -1
  250. package/dist/types/tests/international_street/test_Lookup.d.ts +0 -1
  251. package/dist/types/tests/test_AgentSender.d.ts +0 -1
  252. package/dist/types/tests/test_BaseUrlSender.d.ts +0 -1
  253. package/dist/types/tests/test_BasicAuthCredentials.d.ts +0 -1
  254. package/dist/types/tests/test_Batch.d.ts +0 -1
  255. package/dist/types/tests/test_ClientBuilder.d.ts +0 -1
  256. package/dist/types/tests/test_CustomHeaderSender.d.ts +0 -1
  257. package/dist/types/tests/test_CustomQuerySender.d.ts +0 -1
  258. package/dist/types/tests/test_ExtractExample.d.ts +0 -1
  259. package/dist/types/tests/test_HttpSender.d.ts +0 -1
  260. package/dist/types/tests/test_LicenseSender.d.ts +0 -1
  261. package/dist/types/tests/test_RetrySender.d.ts +0 -1
  262. package/dist/types/tests/test_SigningSender.d.ts +0 -1
  263. package/dist/types/tests/test_StatusCodeSender.d.ts +0 -1
  264. package/dist/types/tests/us_autocomplete_pro/test_Client.d.ts +0 -1
  265. package/dist/types/tests/us_autocomplete_pro/test_Lookup.d.ts +0 -1
  266. package/dist/types/tests/us_autocomplete_pro/test_Suggestion.d.ts +0 -1
  267. package/dist/types/tests/us_enrichment/test_Client.d.ts +0 -1
  268. package/dist/types/tests/us_enrichment/test_Lookup.d.ts +0 -1
  269. package/dist/types/tests/us_enrichment/test_Response.d.ts +0 -1
  270. package/dist/types/tests/us_extract/test_Address.d.ts +0 -1
  271. package/dist/types/tests/us_extract/test_Client.d.ts +0 -1
  272. package/dist/types/tests/us_extract/test_Lookup.d.ts +0 -1
  273. package/dist/types/tests/us_extract/test_Result.d.ts +0 -1
  274. package/dist/types/tests/us_reverse_geo/test_Client.d.ts +0 -1
  275. package/dist/types/tests/us_reverse_geo/test_Lookup.d.ts +0 -1
  276. package/dist/types/tests/us_reverse_geo/test_Response.d.ts +0 -1
  277. package/dist/types/tests/us_street/test_Candidate.d.ts +0 -1
  278. package/dist/types/tests/us_street/test_Client.d.ts +0 -1
  279. package/dist/types/tests/us_street/test_Lookup.d.ts +0 -1
  280. package/dist/types/tests/us_zipcode/test_Client.d.ts +0 -1
  281. package/dist/types/tests/us_zipcode/test_Result.d.ts +0 -1
  282. package/dist/types/tsconfig.tsbuildinfo +0 -1
  283. /package/dist/types/{src/AgentSender.d.ts → AgentSender.d.ts} +0 -0
  284. /package/dist/types/{src/BaseUrlSender.d.ts → BaseUrlSender.d.ts} +0 -0
  285. /package/dist/types/{src/BasicAuthCredentials.d.ts → BasicAuthCredentials.d.ts} +0 -0
  286. /package/dist/types/{src/CustomHeaderSender.d.ts → CustomHeaderSender.d.ts} +0 -0
  287. /package/dist/types/{src/CustomQuerySender.d.ts → CustomQuerySender.d.ts} +0 -0
  288. /package/dist/types/{src/RetrySender.d.ts → RetrySender.d.ts} +0 -0
  289. /package/dist/types/{src/SharedCredentials.d.ts → SharedCredentials.d.ts} +0 -0
  290. /package/dist/types/{src/StaticCredentials.d.ts → StaticCredentials.d.ts} +0 -0
  291. /package/dist/types/{src/util → util}/Sleeper.d.ts +0 -0
@@ -17,18 +17,8 @@ export interface Sender {
17
17
  export interface Sleeper {
18
18
  sleep(seconds: number): Promise<void>;
19
19
  }
20
- export interface Signer {
21
- sign(request: Request): void;
22
- }
23
- export interface BaseLookup {
24
- inputId?: string | number | undefined;
25
- customParameters: Record<string, string>;
26
- result: {
27
- inputIndex: number;
28
- }[];
29
- }
30
20
  export interface MockSenderInstance extends Sender {
31
- statusCodes: number[];
21
+ statusCodes: string[];
32
22
  headers?: Record<string, unknown> | undefined;
33
23
  error?: string | undefined;
34
24
  currentStatusCodeIndex: number;
@@ -0,0 +1,10 @@
1
+ export = Client;
2
+ /**
3
+ * This client sends lookups to the Smarty US Autocomplete Pro API, <br>
4
+ * and attaches the suggestions to the appropriate Lookup objects.
5
+ */
6
+ declare class Client {
7
+ constructor(sender: any);
8
+ sender: any;
9
+ send(lookup: any): Promise<any>;
10
+ }
@@ -0,0 +1,28 @@
1
+ export = Lookup;
2
+ /**
3
+ * In addition to holding all of the input data for this lookup, this class also<br>
4
+ * will contain the result of the lookup after it comes back from the API.
5
+ * @see "https://www.smarty.com/docs/cloud/us-autocomplete-api#pro-http-request-input-fields"
6
+ */
7
+ declare class Lookup {
8
+ /**
9
+ * @param search The beginning of an address. This is required to be set.
10
+ */
11
+ constructor(search: any);
12
+ result: any[];
13
+ search: any;
14
+ selected: any;
15
+ maxResults: any;
16
+ includeOnlyCities: any[];
17
+ includeOnlyStates: any[];
18
+ includeOnlyZIPCodes: any[];
19
+ excludeStates: any[];
20
+ preferCities: any[];
21
+ preferStates: any[];
22
+ preferZIPCodes: any[];
23
+ preferRatio: any;
24
+ preferGeolocation: any;
25
+ source: any;
26
+ customParameters: {};
27
+ addCustomParameter(key: any, value: any): void;
28
+ }
@@ -0,0 +1,14 @@
1
+ export = Suggestion;
2
+ /**
3
+ * @see "https://www.smarty.com/docs/cloud/us-autocomplete-api#pro-http-response"
4
+ */
5
+ declare class Suggestion {
6
+ constructor(responseData: any);
7
+ streetLine: any;
8
+ secondary: any;
9
+ city: any;
10
+ state: any;
11
+ zipcode: any;
12
+ entries: any;
13
+ source: any;
14
+ }
@@ -0,0 +1,10 @@
1
+ export = Client;
2
+ declare class Client {
3
+ constructor(sender: any);
4
+ sender: any;
5
+ sendPrincipal(lookup: any): Promise<any>;
6
+ sendFinancial(lookup: any): Promise<any>;
7
+ sendGeo(lookup: any): Promise<any>;
8
+ sendSecondary(lookup: any): Promise<any>;
9
+ sendSecondaryCount(lookup: any): Promise<any>;
10
+ }
@@ -0,0 +1,13 @@
1
+ export = Lookup;
2
+ declare class Lookup {
3
+ constructor(smartyKey: any, include: any, exclude: any, dataset: any, dataSubset: any);
4
+ smartyKey: any;
5
+ include: any;
6
+ exclude: any;
7
+ dataset: any;
8
+ dataSubset: any;
9
+ features: any;
10
+ response: {};
11
+ customParameters: {};
12
+ addCustomParameter(key: any, value: any): void;
13
+ }
@@ -0,0 +1,20 @@
1
+ export class Response {
2
+ constructor(responseData: any);
3
+ smartyKey: any;
4
+ dataSetName: any;
5
+ dataSubsetName: any;
6
+ attributes: {};
7
+ }
8
+ export class FinancialResponse {
9
+ constructor(responseData: any);
10
+ smartyKey: any;
11
+ dataSetName: any;
12
+ dataSubsetName: any;
13
+ attributes: {};
14
+ }
15
+ export class GeoResponse {
16
+ constructor(responseData: any);
17
+ smartyKey: any;
18
+ dataSetName: any;
19
+ attributes: {};
20
+ }
@@ -0,0 +1,13 @@
1
+ export = Address;
2
+ /**
3
+ * @see <a href="https://www.smarty.com/docs/cloud/us-extract-api#http-response-status">Smarty US Extract API docs</a>
4
+ */
5
+ declare class Address {
6
+ constructor(responseData: any);
7
+ text: any;
8
+ verified: any;
9
+ line: any;
10
+ start: any;
11
+ end: any;
12
+ candidates: any;
13
+ }
@@ -0,0 +1,10 @@
1
+ export = Client;
2
+ /**
3
+ * This client sends lookups to the Smarty US Extract API, <br>
4
+ * and attaches the results to the Lookup objects.
5
+ */
6
+ declare class Client {
7
+ constructor(sender: any);
8
+ sender: any;
9
+ send(lookup: any): Promise<any>;
10
+ }
@@ -0,0 +1,23 @@
1
+ export = Lookup;
2
+ /**
3
+ * In addition to holding all of the input data for this lookup, this class also<br>
4
+ * will contain the result of the lookup after it comes back from the API.
5
+ * @see "https://www.smarty.com/docs/cloud/us-extract-api#http-request-input-fields"
6
+ */
7
+ declare class Lookup {
8
+ /**
9
+ * @param text The text that is to have addresses extracted out of it for verification (required)
10
+ */
11
+ constructor(text: any);
12
+ result: {
13
+ meta: {};
14
+ addresses: never[];
15
+ };
16
+ text: any;
17
+ html: any;
18
+ aggressive: any;
19
+ addressesHaveLineBreaks: any;
20
+ addressesPerLine: any;
21
+ customParameters: {};
22
+ addCustomParameter(key: any, value: any): void;
23
+ }
@@ -0,0 +1,19 @@
1
+ export = Result;
2
+ /**
3
+ * @see <a href="https://www.smarty.com/docs/cloud/us-extract-api#http-response-status">Smarty US Extract API docs</a>
4
+ */
5
+ declare class Result {
6
+ constructor({ meta, addresses }: {
7
+ meta: any;
8
+ addresses: any;
9
+ });
10
+ meta: {
11
+ lines: any;
12
+ unicode: any;
13
+ addressCount: any;
14
+ verifiedCount: any;
15
+ bytes: any;
16
+ characterCount: any;
17
+ };
18
+ addresses: any;
19
+ }
@@ -0,0 +1,10 @@
1
+ export = Client;
2
+ /**
3
+ * This client sends lookups to the Smarty US Reverse Geo API, <br>
4
+ * and attaches the results to the appropriate Lookup objects.
5
+ */
6
+ declare class Client {
7
+ constructor(sender: any);
8
+ sender: any;
9
+ send(lookup: any): Promise<any>;
10
+ }
@@ -0,0 +1,16 @@
1
+ export = Lookup;
2
+ /**
3
+ * In addition to holding all of the input data for this lookup, this class also<br>
4
+ * will contain the result of the lookup after it comes back from the API.
5
+ * @see "https://www.smarty.com/docs/cloud/us-street-api#input-fields"
6
+ */
7
+ declare class Lookup {
8
+ constructor(latitude: any, longitude: any, source?: string);
9
+ latitude: any;
10
+ longitude: any;
11
+ source: string;
12
+ response: Response;
13
+ customParameters: {};
14
+ addCustomParameter(key: any, value: any): void;
15
+ }
16
+ import Response = require("./Response");
@@ -0,0 +1,8 @@
1
+ export = Response;
2
+ /**
3
+ * The SmartyResponse contains the response from a call to the US Reverse Geo API.
4
+ */
5
+ declare class Response {
6
+ constructor(responseData: any);
7
+ results: any[];
8
+ }
@@ -0,0 +1,13 @@
1
+ export = Result;
2
+ /**
3
+ * A candidate is a possible match for an address that was submitted.<br>
4
+ * A lookup can have multiple candidates if the address was ambiguous.
5
+ *
6
+ * @see "https://www.smarty.com/docs/cloud/us-reverse-geo-api#result"
7
+ */
8
+ declare class Result {
9
+ constructor(responseData: any);
10
+ distance: any;
11
+ address: {};
12
+ coordinate: {};
13
+ }
@@ -0,0 +1,22 @@
1
+ export = Candidate;
2
+ /**
3
+ * A candidate is a possible match for an address that was submitted.<br>
4
+ * A lookup can have multiple candidates if the address was ambiguous, and<br>
5
+ * the maxCandidates field is set higher than 1.
6
+ *
7
+ * @see "https://www.smarty.com/docs/cloud/us-street-api#root"
8
+ */
9
+ declare class Candidate {
10
+ constructor(responseData: any);
11
+ inputIndex: any;
12
+ candidateIndex: any;
13
+ addressee: any;
14
+ deliveryLine1: any;
15
+ deliveryLine2: any;
16
+ lastLine: any;
17
+ deliveryPointBarcode: any;
18
+ smartyKey: any;
19
+ components: {};
20
+ metadata: {};
21
+ analysis: {};
22
+ }
@@ -0,0 +1,15 @@
1
+ export = Client;
2
+ /**
3
+ * This client sends lookups to the Smarty US Street API, <br>
4
+ * and attaches the results to the appropriate Lookup objects.
5
+ */
6
+ declare class Client {
7
+ constructor(sender: any);
8
+ sender: any;
9
+ /**
10
+ * Sends up to 100 lookups for validation.
11
+ * @param data may be a Lookup object, or a Batch which must contain between 1 and 100 Lookup objects
12
+ * @throws SmartyException
13
+ */
14
+ send(data: any): Promise<any>;
15
+ }
@@ -0,0 +1,26 @@
1
+ export = Lookup;
2
+ /**
3
+ * In addition to holding all of the input data for this lookup, this class also<br>
4
+ * will contain the result of the lookup after it comes back from the API.
5
+ * @see "https://www.smarty.com/docs/cloud/us-street-api#input-fields"
6
+ */
7
+ declare class Lookup {
8
+ constructor(street: any, street2: any, secondary: any, city: any, state: any, zipCode: any, lastLine: any, addressee: any, urbanization: any, match: any, maxCandidates: any, inputId: any, format: any, countySource: any);
9
+ street: any;
10
+ street2: any;
11
+ secondary: any;
12
+ city: any;
13
+ state: any;
14
+ zipCode: any;
15
+ lastLine: any;
16
+ addressee: any;
17
+ urbanization: any;
18
+ match: any;
19
+ maxCandidates: any;
20
+ inputId: any;
21
+ format: any;
22
+ countySource: any;
23
+ result: any[];
24
+ customParameters: {};
25
+ addCustomParameter(key: any, value: any): void;
26
+ }
@@ -0,0 +1,15 @@
1
+ export = Client;
2
+ /**
3
+ * This client sends lookups to the Smarty US ZIP Code API, <br>
4
+ * and attaches the results to the appropriate Lookup objects.
5
+ */
6
+ declare class Client {
7
+ constructor(sender: any);
8
+ sender: any;
9
+ /**
10
+ * Sends up to 100 lookups for validation.
11
+ * @param data May be a Lookup object, or a Batch which must contain between 1 and 100 Lookup objects
12
+ * @throws SmartyException
13
+ */
14
+ send(data: any): Promise<any>;
15
+ }
@@ -0,0 +1,16 @@
1
+ export = Lookup;
2
+ /**
3
+ * In addition to holding all of the input data for this lookup, this class also<br>
4
+ * will contain the result of the lookup after it comes back from the API.
5
+ * @see "https://www.smarty.com/docs/cloud/us-zipcode-api#http-request-input-fields"
6
+ */
7
+ declare class Lookup {
8
+ constructor(city: any, state: any, zipCode: any, inputId: any);
9
+ city: any;
10
+ state: any;
11
+ zipCode: any;
12
+ inputId: any;
13
+ result: any[];
14
+ customParameters: {};
15
+ addCustomParameter(key: any, value: any): void;
16
+ }
@@ -0,0 +1,13 @@
1
+ export = Result;
2
+ /**
3
+ * @see "https://www.smarty.com/docs/cloud/us-zipcode-api#root"
4
+ */
5
+ declare class Result {
6
+ constructor(responseData: any);
7
+ inputIndex: any;
8
+ status: any;
9
+ reason: any;
10
+ valid: boolean;
11
+ cities: any;
12
+ zipcodes: any;
13
+ }
@@ -0,0 +1,94 @@
1
+ export namespace usStreet {
2
+ let street: string;
3
+ let street2: string;
4
+ let secondary: string;
5
+ let city: string;
6
+ let state: string;
7
+ let zipcode: string;
8
+ let lastline: string;
9
+ let addressee: string;
10
+ let urbanization: string;
11
+ let match: string;
12
+ let format: string;
13
+ let candidates: string;
14
+ let county_source: string;
15
+ let input_id: string;
16
+ }
17
+ export namespace usAutocompletePro {
18
+ let search: string;
19
+ let selected: string;
20
+ let max_results: string;
21
+ let include_only_cities: string;
22
+ let include_only_states: string;
23
+ let include_only_zip_codes: string;
24
+ let exclude_states: string;
25
+ let prefer_cities: string;
26
+ let prefer_states: string;
27
+ let prefer_zip_codes: string;
28
+ let prefer_ratio: string;
29
+ let prefer_geolocation: string;
30
+ let source: string;
31
+ }
32
+ export namespace usZipcode {
33
+ let city_1: string;
34
+ export { city_1 as city };
35
+ let state_1: string;
36
+ export { state_1 as state };
37
+ let zipcode_1: string;
38
+ export { zipcode_1 as zipcode };
39
+ }
40
+ export namespace internationalStreet {
41
+ let country: string;
42
+ let freeform: string;
43
+ let address1: string;
44
+ let address2: string;
45
+ let address3: string;
46
+ let address4: string;
47
+ let organization: string;
48
+ let locality: string;
49
+ let administrative_area: string;
50
+ let postal_code: string;
51
+ let geocode: string;
52
+ let language: string;
53
+ }
54
+ export namespace internationalAddressAutocomplete {
55
+ let search_1: string;
56
+ export { search_1 as search };
57
+ let country_1: string;
58
+ export { country_1 as country };
59
+ let max_results_1: string;
60
+ export { max_results_1 as max_results };
61
+ export let include_only_administrative_area: string;
62
+ export let include_only_locality: string;
63
+ export let include_only_postal_code: string;
64
+ }
65
+ export namespace usReverseGeo {
66
+ export let latitude: string;
67
+ export let longitude: string;
68
+ let source_1: string;
69
+ export { source_1 as source };
70
+ }
71
+ export namespace usExtract {
72
+ let html: string;
73
+ let aggressive: string;
74
+ let addr_line_breaks: string;
75
+ let addr_per_line: string;
76
+ }
77
+ export namespace usEnrichment {
78
+ let include: string;
79
+ let exclude: string;
80
+ let dataset: string;
81
+ let data_subset: string;
82
+ }
83
+ export namespace internationalPostalCode {
84
+ let input_id_1: string;
85
+ export { input_id_1 as input_id };
86
+ let country_2: string;
87
+ export { country_2 as country };
88
+ let locality_1: string;
89
+ export { locality_1 as locality };
90
+ let administrative_area_1: string;
91
+ export { administrative_area_1 as administrative_area };
92
+ let postal_code_1: string;
93
+ export { postal_code_1 as postal_code };
94
+ }
@@ -0,0 +1,10 @@
1
+ declare function buildUsStreetApiClient(credentials: any): any;
2
+ declare function buildUsAutocompleteProApiClient(credentials: any): any;
3
+ declare function buildUsExtractApiClient(credentials: any): any;
4
+ declare function buildUsZipcodeApiClient(credentials: any): any;
5
+ declare function buildInternationalStreetApiClient(credentials: any): any;
6
+ declare function buildUsReverseGeoApiClient(credentials: any): any;
7
+ declare function buildInternationalAddressAutocompleteApiClient(credentials: any): any;
8
+ declare function buildUsEnrichmentApiClient(credentials: any): any;
9
+ declare function buildInternationalPostalCodeApiClient(credentials: any): any;
10
+ export { buildUsStreetApiClient as usStreet, buildUsAutocompleteProApiClient as usAutocompletePro, buildUsExtractApiClient as usExtract, buildUsZipcodeApiClient as usZipcode, buildInternationalStreetApiClient as internationalStreet, buildUsReverseGeoApiClient as usReverseGeo, buildInternationalAddressAutocompleteApiClient as internationalAddressAutocomplete, buildUsEnrichmentApiClient as usEnrichment, buildInternationalPostalCodeApiClient as internationalPostalCode };
@@ -0,0 +1,2 @@
1
+ declare function _exports(lookup: any, keyTranslationFormat: any): {};
2
+ export = _exports;
@@ -0,0 +1,2 @@
1
+ export function buildSmartyResponse(response: any, error: any): Response;
2
+ import Response = require("../Response.js");
@@ -0,0 +1,2 @@
1
+ declare function _exports(lookup: any): {};
2
+ export = _exports;
@@ -0,0 +1,2 @@
1
+ declare function _exports(batch: any, sender: any, Result: any, keyTranslationFormat: any, customBuildInputData: any): Promise<any>;
2
+ export = _exports;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "smartystreets-javascript-sdk",
3
- "version": "8.2.1",
3
+ "version": "8.2.2",
4
4
  "description": "Quick and easy Smarty address validation.",
5
5
  "keywords": [
6
6
  "smarty",
@@ -23,7 +23,7 @@
23
23
  ],
24
24
  "files": [
25
25
  "dist",
26
- "README.md",
26
+ "README.md",
27
27
  "LICENSE"
28
28
  ],
29
29
  "main": "dist/cjs/index.cjs",
@@ -31,7 +31,6 @@
31
31
  "types": "dist/types/index.d.ts",
32
32
  "exports": {
33
33
  ".": {
34
- "types": "./dist/types/index.d.ts",
35
34
  "import": "./dist/esm/index.mjs",
36
35
  "default": "./dist/cjs/index.cjs"
37
36
  }
@@ -42,7 +41,9 @@
42
41
  },
43
42
  "scripts": {
44
43
  "build": "rollup --config",
45
- "test": "mocha --require tsx/cjs 'tests/**/*.ts'"
44
+ "test": "npm run test:js && npm run test:ts",
45
+ "test:js": "mocha 'tests/**/*.{mjs,js}'",
46
+ "test:ts": "mocha --require tsx/cjs 'tests/**/*.ts'"
46
47
  },
47
48
  "author": "Smarty SDK Team <support@smarty.com> (https://www.smarty.com)",
48
49
  "license": "Apache-2.0",
package/README.md DELETED
@@ -1,145 +0,0 @@
1
- #### SMARTY DISCLAIMER: Subject to the terms of the associated license agreement, this software is freely available for your use. This software is FREE, AS IN PUPPIES, and is a gift. Enjoy your new responsibility. This means that while we may consider enhancement requests, we may or may not choose to entertain requests at our sole and absolute discretion.
2
-
3
-
4
- # Smarty JavaScript SDK
5
-
6
- The official JavaScript/TypeScript SDK for accessing [Smarty](https://www.smarty.com) address validation APIs. Works in both Node.js and browser environments.
7
-
8
- [![npm](https://img.shields.io/npm/v/smartystreets-javascript-sdk)](https://www.npmjs.com/package/smartystreets-javascript-sdk)
9
- [![license](https://img.shields.io/npm/l/smartystreets-javascript-sdk)](LICENSE.md)
10
-
11
- ## Installation
12
-
13
- ```bash
14
- npm install smartystreets-javascript-sdk
15
- ```
16
-
17
- ## Quick Start: US Street Address Validation
18
-
19
- ```javascript
20
- import SmartySDK from "smartystreets-javascript-sdk";
21
-
22
- const credentials = new SmartySDK.core.StaticCredentials(
23
- process.env.SMARTY_AUTH_ID,
24
- process.env.SMARTY_AUTH_TOKEN,
25
- );
26
- const client = new SmartySDK.core.ClientBuilder(credentials).buildUsStreetApiClient();
27
-
28
- const lookup = new SmartySDK.usStreet.Lookup();
29
- lookup.street = "1600 Amphitheatre Parkway";
30
- lookup.city = "Mountain View";
31
- lookup.state = "CA";
32
-
33
- const response = await client.send(lookup);
34
- console.log(response.lookups[0].result);
35
- ```
36
-
37
- ## Quick Start: US Autocomplete Pro
38
-
39
- ```javascript
40
- const client = new SmartySDK.core.ClientBuilder(credentials).buildUsAutocompleteProClient();
41
-
42
- const lookup = new SmartySDK.usAutocompletePro.Lookup("4770 Lincoln");
43
- lookup.maxResults = 10;
44
- lookup.preferStates = ["IL"];
45
-
46
- const response = await client.send(lookup);
47
- console.log(response.result); // Array of address suggestions
48
- ```
49
-
50
- ## Supported APIs
51
-
52
- | API | Module | Build Method | Example |
53
- | --- | --- | --- | --- |
54
- | [US Street](https://www.smarty.com/docs/cloud/us-street-api) | `usStreet` | `buildUsStreetApiClient()` | [example](examples/us_street.mjs) |
55
- | [US Zipcode](https://www.smarty.com/docs/cloud/us-zipcode-api) | `usZipcode` | `buildUsZipcodeClient()` | [example](examples/us_zipcode.mjs) |
56
- | [US Autocomplete Pro](https://www.smarty.com/docs/cloud/us-autocomplete-pro-api) | `usAutocompletePro` | `buildUsAutocompleteProClient()` | [example](examples/us_autocomplete_pro.mjs) |
57
- | [US Extract](https://www.smarty.com/docs/cloud/us-extract-api) | `usExtract` | `buildUsExtractClient()` | [example](examples/us_extract.mjs) |
58
- | [US Enrichment](https://www.smarty.com/docs/cloud/us-address-enrichment-api) | `usEnrichment` | `buildUsEnrichmentClient()` | [example](examples/us_enrichment.mjs) |
59
- | [US Reverse Geocoding](https://www.smarty.com/docs/cloud/us-reverse-geo-api) | `usReverseGeo` | `buildUsReverseGeoClient()` | [example](examples/us_reverse_geo.mjs) |
60
- | [International Street](https://www.smarty.com/docs/cloud/international-street-api) | `internationalStreet` | `buildInternationalStreetClient()` | [example](examples/international_street.mjs) |
61
- | [International Autocomplete](https://www.smarty.com/docs/cloud/international-address-autocomplete-api) | `internationalAddressAutocomplete` | `buildInternationalAddressAutocompleteClient()` | [example](examples/international_address_autocomplete.mjs) |
62
- | [International Postal Code](https://www.smarty.com/docs/cloud/international-postal-code-api) | `internationalPostalCode` | `buildInternationalPostalCodeClient()` | [example](examples/international_postal_code.mjs) |
63
-
64
- ## Authentication
65
-
66
- Three credential types are available:
67
-
68
- - **`StaticCredentials(authId, authToken)`** — Server-side authentication using auth-id and auth-token.
69
- - **`SharedCredentials(key)`** — Client-side (browser) authentication using an embedded key. Does not support batch (POST) requests.
70
- - **`BasicAuthCredentials(authId, authToken)`** — HTTP Basic Auth.
71
-
72
- ## Common Patterns
73
-
74
- ### Batch Requests
75
-
76
- Send up to 100 lookups in a single request (not available with `SharedCredentials`):
77
-
78
- ```javascript
79
- const batch = new SmartySDK.core.Batch();
80
- batch.add(lookup1);
81
- batch.add(lookup2);
82
-
83
- const response = await client.send(batch);
84
- ```
85
-
86
- ### Error Handling
87
-
88
- All API errors extend `SmartyError`:
89
-
90
- ```javascript
91
- import { SmartyError } from "smartystreets-javascript-sdk";
92
-
93
- try {
94
- const response = await client.send(lookup);
95
- } catch (err) {
96
- if (err instanceof SmartyError) {
97
- console.error("API error:", err.message);
98
- }
99
- }
100
- ```
101
-
102
- ### Retry and Timeout
103
-
104
- ```javascript
105
- const client = new SmartySDK.core.ClientBuilder(credentials)
106
- .withMaxRetries(10)
107
- .withMaxTimeout(30000)
108
- .buildUsStreetApiClient();
109
- ```
110
-
111
- ### Proxy
112
-
113
- ```javascript
114
- const client = new SmartySDK.core.ClientBuilder(credentials)
115
- .withProxy("proxy.example.com", 8080, "https")
116
- .buildUsStreetApiClient();
117
- ```
118
-
119
- ### Custom Headers
120
-
121
- ```javascript
122
- const client = new SmartySDK.core.ClientBuilder(credentials)
123
- .withCustomHeaders({ "X-Custom-Header": "value" })
124
- .buildUsStreetApiClient();
125
- ```
126
-
127
- ## TypeScript
128
-
129
- The SDK is written in TypeScript and ships with full type declarations. All types are available as named exports:
130
-
131
- ```typescript
132
- import SmartySDK, { type MatchStrategy, type SmartyError } from "smartystreets-javascript-sdk";
133
-
134
- const lookup = new SmartySDK.usStreet.Lookup();
135
- lookup.street = "1600 Amphitheatre Parkway";
136
- lookup.match = "enhanced" satisfies MatchStrategy;
137
- ```
138
-
139
- ## Documentation
140
-
141
- Full API documentation is available at [smarty.com/docs/sdk/javascript](https://www.smarty.com/docs/sdk/javascript).
142
-
143
- ## License
144
-
145
- [Apache 2.0](LICENSE.md)