@ideal-postcodes/sdk 0.5.0 → 0.7.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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,81 @@
1
+ # @ideal-postcodes/sdk
2
+
3
+ ## 0.7.0 (2026-11-25)
4
+
5
+ ### Minor Changes
6
+
7
+ - `remove_organisation` query option on `postcodes`, `addresses`, `resolveAddress` and `addressCleanse`. Pass `"true"` to leave organisation and department names out of the address lines
8
+
9
+ ## 0.6.0 (2026-10-22)
10
+
11
+ ### Minor Changes
12
+
13
+ - `apiKey` is optional: a client used only for key operations needs just `userToken`. Any other operation called without an API key or an `Authorization` header rejects with an error naming the operation
14
+ - The Management Key is sent as an `Authorization: Bearer` header
15
+ - Breaking: query types no longer accept `user_token`, and the `UserTokenParam` type is no longer exported. Set `userToken` on the client instead
16
+ - `Licensee` and `LicenseesResponse` mark the fields the API always returns as required
17
+ - The `@tanstack/react-query` and `@tanstack/preact-query` peer ranges start at 5.91.0
18
+ - The package ships its `CHANGELOG.md`
19
+
20
+ ## 0.5.0 (2026-10-07)
21
+
22
+ ### Minor Changes
23
+
24
+ - Add `total` to the `lookupPostcode` result, the number of addresses across all pages
25
+
26
+ ## 0.4.0 (2026-10-02)
27
+
28
+ ### Minor Changes
29
+
30
+ - Add `lookupPostcode`, which returns a postcode's addresses or, for an unknown postcode, the closest matching postcodes instead of throwing
31
+
32
+ ## 0.3.1 (2026-10-02)
33
+
34
+ ### Patch Changes
35
+
36
+ - Export the `Client` type, so a function that builds or receives a client can name it
37
+ - README quickstart searches for a real address: 9 Malyons Road, Swanley, BR8 7RE
38
+
39
+ ## 0.3.0 (2026-10-01)
40
+
41
+ ### Minor Changes
42
+
43
+ - Add a `headers` client option to send default headers, such as `User-Agent`, with every request. Headers passed to an operation take precedence
44
+ - Add a `timeoutMs` client option. Each request that runs longer rejects with a `TimeoutError`; a per-call `signal` can still cancel sooner
45
+
46
+ ## 0.2.1 (2026-09-29)
47
+
48
+ ### Patch Changes
49
+
50
+ - Regenerated from the latest spec: updated doc comments and examples
51
+ - Internal improvements
52
+ - `updateLicensee` sends `POST`, the method the API serves
53
+ - Regenerated from the latest spec
54
+
55
+ ## 0.2.0 (2026-09-28)
56
+
57
+ ### Minor Changes
58
+
59
+ - The autocomplete helper now exposes `find` and `resolve`, replacing `search` and `resolveGbr`. `find({ query })` takes the query and any other autocomplete parameters in one flat object and resolves to the list of hits. `resolve({ hit })` takes a hit and resolves to the address itself. Replace `search({ query: { query } })` with `find({ query })`, read hits directly instead of `result.hits`, and replace `resolveGbr({ path: { address: hit.id } })` with `resolve({ hit })`.
60
+ - `find()` resolves `undefined` when a newer find or `cancel()` replaces it, instead of rejecting with `AbortError`. Rapid typing no longer produces unhandled rejections. Replace `AbortError` filtering with `if (!hits) return;`.
61
+ - Pass `signal` to `find()` or `resolve()` to abort a request yourself. It then rejects with `AbortError`.
62
+ - Generate the SDK from the current API contract, including licensee key regeneration and `/addresses` for postcode lookup.
63
+ - Return the flat `Address` model with dataset-specific fields under `native`. Consumers of older response types must update their field access.
64
+ - Add autocomplete cancellation and validate ESM/CommonJS exports, tree-shaking and operation examples.
65
+ - Operations now throw `ApiError` on HTTP errors by default, with the HTTP `status`, the API error `code` and `message`, and the parsed `body`. Pass `throwOnError: false` to restore the previous `{ data, error }` result shape, with `error` as the API error body. Network failures and aborts still reject with their native errors.
66
+
67
+ ### Patch Changes
68
+
69
+ - `userToken` is sent in the `Authorization` header instead of the query string, so it no longer appears in request URLs, proxy logs or browser history.
70
+ - `userToken` is attached only to the account operations that accept it. Public key availability and configuration retrieval no longer receive it.
71
+ - Key operations (key details, usage, logs, licensees and configurations) no longer send `api_key` in the query. The API rejected these requests with `4000 Unknown query parameter 'api_key'`; the key travels as the `key` path parameter.
72
+ - Share autocomplete caching and cancellation utilities.
73
+ - Initialise shared browser state on demand so unused utilities can be removed from bundles.
74
+
75
+ ## 0.1.0
76
+
77
+ ### Minor Changes
78
+
79
+ - Initial release. Fetch-based, treeshakable TypeScript SDK for api.ideal-postcodes.co.uk, generated from the OpenAPI spec by `@hey-api/openapi-ts`. Includes `createIdpcClient`, a vanilla `/autocomplete` composer (debounce + LRU), and TanStack Query subpaths (`/react-query`, `/preact-query`) gated behind optional peer deps so non-React consumers pay zero bytes.
80
+
81
+ - `createIdpcClient` accepts an optional `userToken`, sent as the `user_token` query parameter on every request whose path contains `/keys/`, including public key availability and configuration retrieval. Per-call `query.user_token` overrides win. Other endpoints (postcodes, find/resolve address, cleanse, email/phone validation) are unaffected.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunk66OILWCGcjs = require('./chunk-66OILWCG.cjs');var _chunkWQKSRULXcjs = require('./chunk-WQKSRULX.cjs');var v=f=>{let{client:s,debounceMs:y=100,cache:r}=f,o=r===!1?null:new (0, _chunk66OILWCGcjs.a)(r),i=_chunk66OILWCGcjs.c.call(void 0, async(e,{signal:t,...n})=>{_optionalChain([t, 'optionalAccess', _ => _.throwIfAborted, 'call', _2 => _2()]);let d=_chunk66OILWCGcjs.b.call(void 0, n),a=_optionalChain([o, 'optionalAccess', _3 => _3.get, 'call', _4 => _4(d)]);if(a)return a;let{data:h}=await _chunkWQKSRULXcjs.k.call(void 0, {client:s,signal:t?AbortSignal.any([e,t]):e,query:n,throwOnError:!0}),c=h.result.hits;return _optionalChain([o, 'optionalAccess', _5 => _5.set, 'call', _6 => _6(d,c)]),c},y);return{find:e=>i(e),cancel:()=>i.cancel(),resolve:async({hit:e,signal:t})=>{let{data:n}=await _chunkWQKSRULXcjs.l.call(void 0, {client:s,signal:t,path:{address:e.id},throwOnError:!0});return n.result}}};exports.createAutocomplete = v;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkKYH2REIYcjs = require('./chunk-KYH2REIY.cjs');var _chunkWQKSRULXcjs = require('./chunk-WQKSRULX.cjs');var v=f=>{let{client:s,debounceMs:y=100,cache:r}=f,o=r===!1?null:new (0, _chunkKYH2REIYcjs.a)(r),i=_chunkKYH2REIYcjs.c.call(void 0, async(e,{signal:t,...n})=>{_optionalChain([t, 'optionalAccess', _ => _.throwIfAborted, 'call', _2 => _2()]);let d=_chunkKYH2REIYcjs.b.call(void 0, n),a=_optionalChain([o, 'optionalAccess', _3 => _3.get, 'call', _4 => _4(d)]);if(a)return a;let{data:h}=await _chunkWQKSRULXcjs.k.call(void 0, {client:s,signal:t?AbortSignal.any([e,t]):e,query:n,throwOnError:!0}),c=h.result.hits;return _optionalChain([o, 'optionalAccess', _5 => _5.set, 'call', _6 => _6(d,c)]),c},y);return{find:e=>i(e),cancel:()=>i.cancel(),resolve:async({hit:e,signal:t})=>{let{data:n}=await _chunkWQKSRULXcjs.l.call(void 0, {client:s,signal:t,path:{address:e.id},throwOnError:!0});return n.result}}};exports.createAutocomplete = v;
@@ -1,5 +1,5 @@
1
- import { C as CacheOptions } from './index.d-BuZcXRMe.cjs';
2
- import { F as FindAddressData, a as FindAddressResponse, R as ResolveAddressResponse, C as Client } from './types.gen-DnHMLImU.cjs';
1
+ import { C as CacheOptions } from './index.d-CUirxwnK.cjs';
2
+ import { F as FindAddressData, a as FindAddressResponse, R as ResolveAddressResponse, C as Client } from './types.gen-DcN6bPz5.cjs';
3
3
 
4
4
  interface CreateAutocompleteOptions {
5
5
  client: Client;
@@ -1,5 +1,5 @@
1
- import { C as CacheOptions } from './index.d-BuZcXRMe.js';
2
- import { F as FindAddressData, a as FindAddressResponse, R as ResolveAddressResponse, C as Client } from './types.gen-DnHMLImU.js';
1
+ import { C as CacheOptions } from './index.d-CUirxwnK.js';
2
+ import { F as FindAddressData, a as FindAddressResponse, R as ResolveAddressResponse, C as Client } from './types.gen-DcN6bPz5.js';
3
3
 
4
4
  interface CreateAutocompleteOptions {
5
5
  client: Client;
@@ -1 +1 @@
1
- import{a as p,b as l,c as u}from"./chunk-SE457ZO7.mjs";import{k as A,l as m}from"./chunk-27HFF2QV.mjs";var v=f=>{let{client:s,debounceMs:y=100,cache:r}=f,o=r===!1?null:new p(r),i=u(async(e,{signal:t,...n})=>{t?.throwIfAborted();let d=l(n),a=o?.get(d);if(a)return a;let{data:h}=await A({client:s,signal:t?AbortSignal.any([e,t]):e,query:n,throwOnError:!0}),c=h.result.hits;return o?.set(d,c),c},y);return{find:e=>i(e),cancel:()=>i.cancel(),resolve:async({hit:e,signal:t})=>{let{data:n}=await m({client:s,signal:t,path:{address:e.id},throwOnError:!0});return n.result}}};export{v as createAutocomplete};
1
+ import{a as p,b as l,c as u}from"./chunk-PIHG63EO.mjs";import{k as A,l as m}from"./chunk-27HFF2QV.mjs";var v=f=>{let{client:s,debounceMs:y=100,cache:r}=f,o=r===!1?null:new p(r),i=u(async(e,{signal:t,...n})=>{t?.throwIfAborted();let d=l(n),a=o?.get(d);if(a)return a;let{data:h}=await A({client:s,signal:t?AbortSignal.any([e,t]):e,query:n,throwOnError:!0}),c=h.result.hits;return o?.set(d,c),c},y);return{find:e=>i(e),cancel:()=>i.cancel(),resolve:async({hit:e,signal:t})=>{let{data:n}=await m({client:s,signal:t,path:{address:e.id},throwOnError:!0});return n.result}}};export{v as createAutocomplete};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var b=class{constructor(e={}){this.map=new Map,this.max=_nullishCoalesce(e.max, () => (50)),this.ttlMs=_nullishCoalesce(e.ttlMs, () => (6e4))}get(e){let t=this.map.get(e);if(t){if(t.expiresAt<=Date.now()){this.map.delete(e);return}return this.map.delete(e),this.map.set(e,t),t.value}}set(e,t){if(this.map.has(e))this.map.delete(e);else if(this.map.size>=this.max){let n=this.map.keys().next().value;n!==void 0&&this.map.delete(n)}this.map.set(e,{value:t,expiresAt:Date.now()+this.ttlMs})}delete(e){return this.map.delete(e)}clear(){this.map.clear()}get size(){return this.map.size}},f=(e,t)=>e<t?-1:e>t?1:0,m=e=>e instanceof Map||typeof Headers<"u"&&e instanceof Headers||typeof URLSearchParams<"u"&&e instanceof URLSearchParams,T= exports.b =e=>{let t=new Set,n=r=>{if(r===null||typeof r!="object")return r;if(t.has(r))return null;t.add(r);try{return i(r)}finally{t.delete(r)}},i=r=>{if(Array.isArray(r))return r.map(n);if(m(r))return Array.from(r.entries(),([l,a])=>[n(l),n(a)]).map(l=>[JSON.stringify(l),l]).sort(([l],[a])=>f(l,a)).map(([,l])=>l);let o=Object.entries(r).filter(([,l])=>l!==void 0).sort(([l],[a])=>f(l,a));return Object.fromEntries(o.map(([l,a])=>[l,n(a)]))};return JSON.stringify(n(e))},g=e=>new DOMException(e,"AbortError"),E= exports.c =(e,t)=>{let n=null,i=null,r=null,o=a=>{n!==null&&(clearTimeout(n),n=null),_optionalChain([i, 'optionalAccess', _2 => _2.abort, 'call', _3 => _3(g(a))]),i=null,_optionalChain([r, 'optionalCall', _4 => _4(void 0)]),r=null},l=((...a)=>new Promise((d,y)=>{o("debounced call superseded"),r=d;let s=new AbortController;i=s;let p=()=>s.signal.aborted?!1:(i=null,r=null,!0);n=setTimeout(()=>{n=null,e(s.signal,...a).then(u=>p()&&d(u),u=>p()&&y(u))},t)}));return l.cancel=()=>o("debounced call cancelled"),l},c="/keys/{key}",v=["GET /details","PUT /details","GET /usage","GET /lookups","GET /licensees","POST /licensees","GET /licensees/{licensee}","DELETE /licensees/{licensee}","POST /licensees/{licensee}","POST /licensees/{licensee}/regenerate-key","GET /configs","POST /configs","DELETE /configs/{config}","POST /configs/{config}"],h=e=>e===c||e.startsWith(`${c}/`),w=(e,t)=>h(t)&&v.includes(`${e} ${t.slice(c.length)}`),A= exports.d =(e,t,n)=>{let i=new URL(e.url);!h(t)&&!i.searchParams.has("api_key")&&i.searchParams.set("api_key",n.apiKey);let r=new Request(i,e);return!n.userToken||!w(e.method,t)||i.searchParams.has("user_token")||r.headers.has("Authorization")||r.headers.set("Authorization",`user_token="${n.userToken}"`),r},_= exports.e =class extends Error{constructor(e,t){let{code:n,message:i}=typeof t=="object"&&t!==null?t:{};super(typeof i=="string"?i:e.statusText||`HTTP ${e.status}`),this.name="ApiError",this.status=e.status,typeof n=="number"&&(this.code=n),this.body=t,this.response=e}},S= exports.f =(e,t,n,i)=>t&&!t.ok&&!(e instanceof Error)&&_optionalChain([i, 'optionalAccess', _5 => _5.throwOnError])!==!1?new _(t,e):e;exports.a = b; exports.b = T; exports.c = E; exports.d = A; exports.e = _; exports.f = S;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var b=class{constructor(e={}){this.map=new Map,this.max=_nullishCoalesce(e.max, () => (50)),this.ttlMs=_nullishCoalesce(e.ttlMs, () => (6e4))}get(e){let t=this.map.get(e);if(t){if(t.expiresAt<=Date.now()){this.map.delete(e);return}return this.map.delete(e),this.map.set(e,t),t.value}}set(e,t){if(this.map.has(e))this.map.delete(e);else if(this.map.size>=this.max){let n=this.map.keys().next().value;n!==void 0&&this.map.delete(n)}this.map.set(e,{value:t,expiresAt:Date.now()+this.ttlMs})}delete(e){return this.map.delete(e)}clear(){this.map.clear()}get size(){return this.map.size}},f=(e,t)=>e<t?-1:e>t?1:0,m=e=>e instanceof Map||typeof Headers<"u"&&e instanceof Headers||typeof URLSearchParams<"u"&&e instanceof URLSearchParams,T= exports.b =e=>{let t=new Set,n=r=>{if(r===null||typeof r!="object")return r;if(t.has(r))return null;t.add(r);try{return i(r)}finally{t.delete(r)}},i=r=>{if(Array.isArray(r))return r.map(n);if(m(r))return Array.from(r.entries(),([l,a])=>[n(l),n(a)]).map(l=>[JSON.stringify(l),l]).sort(([l],[a])=>f(l,a)).map(([,l])=>l);let o=Object.entries(r).filter(([,l])=>l!==void 0).sort(([l],[a])=>f(l,a));return Object.fromEntries(o.map(([l,a])=>[l,n(a)]))};return JSON.stringify(n(e))},g=e=>new DOMException(e,"AbortError"),E= exports.c =(e,t)=>{let n=null,i=null,r=null,o=a=>{n!==null&&(clearTimeout(n),n=null),_optionalChain([i, 'optionalAccess', _2 => _2.abort, 'call', _3 => _3(g(a))]),i=null,_optionalChain([r, 'optionalCall', _4 => _4(void 0)]),r=null},l=((...a)=>new Promise((d,y)=>{o("debounced call superseded"),r=d;let s=new AbortController;i=s;let p=()=>s.signal.aborted?!1:(i=null,r=null,!0);n=setTimeout(()=>{n=null,e(s.signal,...a).then(u=>p()&&d(u),u=>p()&&y(u))},t)}));return l.cancel=()=>o("debounced call cancelled"),l},c="/keys/{key}",v=["GET /details","PUT /details","GET /usage","GET /lookups","GET /licensees","POST /licensees","GET /licensees/{licensee}","DELETE /licensees/{licensee}","POST /licensees/{licensee}","POST /licensees/{licensee}/regenerate-key","GET /configs","POST /configs","DELETE /configs/{config}","POST /configs/{config}"],h=e=>e===c||e.startsWith(`${c}/`),w=(e,t)=>h(t)&&v.includes(`${e} ${t.slice(c.length)}`),A= exports.d =(e,t,n)=>{let i=new URL(e.url),r=e.headers.has("Authorization");if(!h(t)&&!i.searchParams.has("api_key")){if(!n.apiKey&&r)return e;if(!n.apiKey)throw new Error(`apiKey is required for ${e.method} ${t}`);i.searchParams.set("api_key",n.apiKey)}let o=new Request(i,e);return!n.userToken||!w(e.method,t)||i.searchParams.has("user_token")||o.headers.has("Authorization")||o.headers.set("Authorization",`Bearer ${n.userToken}`),o},_= exports.e =class extends Error{constructor(e,t){let{code:n,message:i}=typeof t=="object"&&t!==null?t:{};super(typeof i=="string"?i:e.statusText||`HTTP ${e.status}`),this.name="ApiError",this.status=e.status,typeof n=="number"&&(this.code=n),this.body=t,this.response=e}},S= exports.f =(e,t,n,i)=>t&&!t.ok&&!(e instanceof Error)&&_optionalChain([i, 'optionalAccess', _5 => _5.throwOnError])!==!1?new _(t,e):e;exports.a = b; exports.b = T; exports.c = E; exports.d = A; exports.e = _; exports.f = S;
@@ -1 +1 @@
1
- var b=class{constructor(e={}){this.map=new Map,this.max=e.max??50,this.ttlMs=e.ttlMs??6e4}get(e){let t=this.map.get(e);if(t){if(t.expiresAt<=Date.now()){this.map.delete(e);return}return this.map.delete(e),this.map.set(e,t),t.value}}set(e,t){if(this.map.has(e))this.map.delete(e);else if(this.map.size>=this.max){let n=this.map.keys().next().value;n!==void 0&&this.map.delete(n)}this.map.set(e,{value:t,expiresAt:Date.now()+this.ttlMs})}delete(e){return this.map.delete(e)}clear(){this.map.clear()}get size(){return this.map.size}},f=(e,t)=>e<t?-1:e>t?1:0,m=e=>e instanceof Map||typeof Headers<"u"&&e instanceof Headers||typeof URLSearchParams<"u"&&e instanceof URLSearchParams,T=e=>{let t=new Set,n=r=>{if(r===null||typeof r!="object")return r;if(t.has(r))return null;t.add(r);try{return i(r)}finally{t.delete(r)}},i=r=>{if(Array.isArray(r))return r.map(n);if(m(r))return Array.from(r.entries(),([l,a])=>[n(l),n(a)]).map(l=>[JSON.stringify(l),l]).sort(([l],[a])=>f(l,a)).map(([,l])=>l);let o=Object.entries(r).filter(([,l])=>l!==void 0).sort(([l],[a])=>f(l,a));return Object.fromEntries(o.map(([l,a])=>[l,n(a)]))};return JSON.stringify(n(e))},g=e=>new DOMException(e,"AbortError"),E=(e,t)=>{let n=null,i=null,r=null,o=a=>{n!==null&&(clearTimeout(n),n=null),i?.abort(g(a)),i=null,r?.(void 0),r=null},l=((...a)=>new Promise((d,y)=>{o("debounced call superseded"),r=d;let s=new AbortController;i=s;let p=()=>s.signal.aborted?!1:(i=null,r=null,!0);n=setTimeout(()=>{n=null,e(s.signal,...a).then(u=>p()&&d(u),u=>p()&&y(u))},t)}));return l.cancel=()=>o("debounced call cancelled"),l},c="/keys/{key}",v=["GET /details","PUT /details","GET /usage","GET /lookups","GET /licensees","POST /licensees","GET /licensees/{licensee}","DELETE /licensees/{licensee}","POST /licensees/{licensee}","POST /licensees/{licensee}/regenerate-key","GET /configs","POST /configs","DELETE /configs/{config}","POST /configs/{config}"],h=e=>e===c||e.startsWith(`${c}/`),w=(e,t)=>h(t)&&v.includes(`${e} ${t.slice(c.length)}`),A=(e,t,n)=>{let i=new URL(e.url);!h(t)&&!i.searchParams.has("api_key")&&i.searchParams.set("api_key",n.apiKey);let r=new Request(i,e);return!n.userToken||!w(e.method,t)||i.searchParams.has("user_token")||r.headers.has("Authorization")||r.headers.set("Authorization",`user_token="${n.userToken}"`),r},_=class extends Error{constructor(e,t){let{code:n,message:i}=typeof t=="object"&&t!==null?t:{};super(typeof i=="string"?i:e.statusText||`HTTP ${e.status}`),this.name="ApiError",this.status=e.status,typeof n=="number"&&(this.code=n),this.body=t,this.response=e}},S=(e,t,n,i)=>t&&!t.ok&&!(e instanceof Error)&&i?.throwOnError!==!1?new _(t,e):e;export{b as a,T as b,E as c,A as d,_ as e,S as f};
1
+ var b=class{constructor(e={}){this.map=new Map,this.max=e.max??50,this.ttlMs=e.ttlMs??6e4}get(e){let t=this.map.get(e);if(t){if(t.expiresAt<=Date.now()){this.map.delete(e);return}return this.map.delete(e),this.map.set(e,t),t.value}}set(e,t){if(this.map.has(e))this.map.delete(e);else if(this.map.size>=this.max){let n=this.map.keys().next().value;n!==void 0&&this.map.delete(n)}this.map.set(e,{value:t,expiresAt:Date.now()+this.ttlMs})}delete(e){return this.map.delete(e)}clear(){this.map.clear()}get size(){return this.map.size}},f=(e,t)=>e<t?-1:e>t?1:0,m=e=>e instanceof Map||typeof Headers<"u"&&e instanceof Headers||typeof URLSearchParams<"u"&&e instanceof URLSearchParams,T=e=>{let t=new Set,n=r=>{if(r===null||typeof r!="object")return r;if(t.has(r))return null;t.add(r);try{return i(r)}finally{t.delete(r)}},i=r=>{if(Array.isArray(r))return r.map(n);if(m(r))return Array.from(r.entries(),([l,a])=>[n(l),n(a)]).map(l=>[JSON.stringify(l),l]).sort(([l],[a])=>f(l,a)).map(([,l])=>l);let o=Object.entries(r).filter(([,l])=>l!==void 0).sort(([l],[a])=>f(l,a));return Object.fromEntries(o.map(([l,a])=>[l,n(a)]))};return JSON.stringify(n(e))},g=e=>new DOMException(e,"AbortError"),E=(e,t)=>{let n=null,i=null,r=null,o=a=>{n!==null&&(clearTimeout(n),n=null),i?.abort(g(a)),i=null,r?.(void 0),r=null},l=((...a)=>new Promise((d,y)=>{o("debounced call superseded"),r=d;let s=new AbortController;i=s;let p=()=>s.signal.aborted?!1:(i=null,r=null,!0);n=setTimeout(()=>{n=null,e(s.signal,...a).then(u=>p()&&d(u),u=>p()&&y(u))},t)}));return l.cancel=()=>o("debounced call cancelled"),l},c="/keys/{key}",v=["GET /details","PUT /details","GET /usage","GET /lookups","GET /licensees","POST /licensees","GET /licensees/{licensee}","DELETE /licensees/{licensee}","POST /licensees/{licensee}","POST /licensees/{licensee}/regenerate-key","GET /configs","POST /configs","DELETE /configs/{config}","POST /configs/{config}"],h=e=>e===c||e.startsWith(`${c}/`),w=(e,t)=>h(t)&&v.includes(`${e} ${t.slice(c.length)}`),A=(e,t,n)=>{let i=new URL(e.url),r=e.headers.has("Authorization");if(!h(t)&&!i.searchParams.has("api_key")){if(!n.apiKey&&r)return e;if(!n.apiKey)throw new Error(`apiKey is required for ${e.method} ${t}`);i.searchParams.set("api_key",n.apiKey)}let o=new Request(i,e);return!n.userToken||!w(e.method,t)||i.searchParams.has("user_token")||o.headers.has("Authorization")||o.headers.set("Authorization",`Bearer ${n.userToken}`),o},_=class extends Error{constructor(e,t){let{code:n,message:i}=typeof t=="object"&&t!==null?t:{};super(typeof i=="string"?i:e.statusText||`HTTP ${e.status}`),this.name="ApiError",this.status=e.status,typeof n=="number"&&(this.code=n),this.body=t,this.response=e}},S=(e,t,n,i)=>t&&!t.ok&&!(e instanceof Error)&&i?.throwOnError!==!1?new _(t,e):e;export{b as a,T as b,E as c,A as d,_ as e,S as f};
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }var _chunk66OILWCGcjs = require('./chunk-66OILWCG.cjs');var _chunkWQKSRULXcjs = require('./chunk-WQKSRULX.cjs');var u="https://api.ideal-postcodes.co.uk/v1",m= exports.createIdpcClient =t=>{let o=_chunkWQKSRULXcjs.b.call(void 0, _chunkWQKSRULXcjs.a.call(void 0, {baseUrl:_nullishCoalesce(t.baseUrl, () => (u)),fetch:t.fetch,headers:t.headers,throwOnError:!0}));o.interceptors.request.use((r,e)=>_chunk66OILWCGcjs.d.call(void 0, r,e.url,t));let{timeoutMs:s}=t;return s!==void 0&&o.interceptors.request.use(r=>new Request(r,{signal:AbortSignal.any([r.signal,AbortSignal.timeout(s)])})),o.interceptors.error.use(_chunk66OILWCGcjs.f),o};var f=async({client:t,postcode:o,signal:s,...r})=>{try{let{data:e}=await _chunkWQKSRULXcjs.d.call(void 0, {client:t,signal:s,path:{postcode:o},query:r,throwOnError:!0});return{addresses:e.result,suggestions:[],total:e.total}}catch(e){if(!(e instanceof _chunk66OILWCGcjs.e)||e.code!==4040)throw e;let{suggestions:l}=e.body;return{addresses:[],suggestions:_nullishCoalesce(l, () => ([])),total:0}}};exports.ApiError = _chunk66OILWCGcjs.e; exports.addressCleanse = _chunkWQKSRULXcjs.j; exports.addresses = _chunkWQKSRULXcjs.m; exports.createConfig = _chunkWQKSRULXcjs.w; exports.createIdpcClient = m; exports.createLicensee = _chunkWQKSRULXcjs.q; exports.deleteConfig = _chunkWQKSRULXcjs.x; exports.deleteLicensee = _chunkWQKSRULXcjs.r; exports.emailValidation = _chunkWQKSRULXcjs.A; exports.findAddress = _chunkWQKSRULXcjs.k; exports.findPlace = _chunkWQKSRULXcjs.n; exports.keyAvailability = _chunkWQKSRULXcjs.e; exports.keyDetails = _chunkWQKSRULXcjs.f; exports.keyLogs = _chunkWQKSRULXcjs.i; exports.keyUsage = _chunkWQKSRULXcjs.h; exports.listConfigs = _chunkWQKSRULXcjs.v; exports.listLicensees = _chunkWQKSRULXcjs.p; exports.lookupPostcode = f; exports.phoneNumberValidation = _chunkWQKSRULXcjs.B; exports.postcodes = _chunkWQKSRULXcjs.d; exports.regenerateLicenseeKey = _chunkWQKSRULXcjs.u; exports.resolveAddress = _chunkWQKSRULXcjs.l; exports.resolvePlace = _chunkWQKSRULXcjs.o; exports.retrieveConfig = _chunkWQKSRULXcjs.y; exports.retrieveLicensee = _chunkWQKSRULXcjs.s; exports.updateConfig = _chunkWQKSRULXcjs.z; exports.updateKeyDetails = _chunkWQKSRULXcjs.g; exports.updateLicensee = _chunkWQKSRULXcjs.t;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }var _chunkKYH2REIYcjs = require('./chunk-KYH2REIY.cjs');var _chunkWQKSRULXcjs = require('./chunk-WQKSRULX.cjs');var u="https://api.ideal-postcodes.co.uk/v1",m= exports.createIdpcClient =t=>{let o=_chunkWQKSRULXcjs.b.call(void 0, _chunkWQKSRULXcjs.a.call(void 0, {baseUrl:_nullishCoalesce(t.baseUrl, () => (u)),fetch:t.fetch,headers:t.headers,throwOnError:!0}));o.interceptors.request.use((r,e)=>_chunkKYH2REIYcjs.d.call(void 0, r,e.url,t));let{timeoutMs:s}=t;return s!==void 0&&o.interceptors.request.use(r=>new Request(r,{signal:AbortSignal.any([r.signal,AbortSignal.timeout(s)])})),o.interceptors.error.use(_chunkKYH2REIYcjs.f),o};var f=async({client:t,postcode:o,signal:s,...r})=>{try{let{data:e}=await _chunkWQKSRULXcjs.d.call(void 0, {client:t,signal:s,path:{postcode:o},query:r,throwOnError:!0});return{addresses:e.result,suggestions:[],total:e.total}}catch(e){if(!(e instanceof _chunkKYH2REIYcjs.e)||e.code!==4040)throw e;let{suggestions:l}=e.body;return{addresses:[],suggestions:_nullishCoalesce(l, () => ([])),total:0}}};exports.ApiError = _chunkKYH2REIYcjs.e; exports.addressCleanse = _chunkWQKSRULXcjs.j; exports.addresses = _chunkWQKSRULXcjs.m; exports.createConfig = _chunkWQKSRULXcjs.w; exports.createIdpcClient = m; exports.createLicensee = _chunkWQKSRULXcjs.q; exports.deleteConfig = _chunkWQKSRULXcjs.x; exports.deleteLicensee = _chunkWQKSRULXcjs.r; exports.emailValidation = _chunkWQKSRULXcjs.A; exports.findAddress = _chunkWQKSRULXcjs.k; exports.findPlace = _chunkWQKSRULXcjs.n; exports.keyAvailability = _chunkWQKSRULXcjs.e; exports.keyDetails = _chunkWQKSRULXcjs.f; exports.keyLogs = _chunkWQKSRULXcjs.i; exports.keyUsage = _chunkWQKSRULXcjs.h; exports.listConfigs = _chunkWQKSRULXcjs.v; exports.listLicensees = _chunkWQKSRULXcjs.p; exports.lookupPostcode = f; exports.phoneNumberValidation = _chunkWQKSRULXcjs.B; exports.postcodes = _chunkWQKSRULXcjs.d; exports.regenerateLicenseeKey = _chunkWQKSRULXcjs.u; exports.resolveAddress = _chunkWQKSRULXcjs.l; exports.resolvePlace = _chunkWQKSRULXcjs.o; exports.retrieveConfig = _chunkWQKSRULXcjs.y; exports.retrieveLicensee = _chunkWQKSRULXcjs.s; exports.updateConfig = _chunkWQKSRULXcjs.z; exports.updateKeyDetails = _chunkWQKSRULXcjs.g; exports.updateLicensee = _chunkWQKSRULXcjs.t;
@@ -25,7 +25,7 @@ interface CacheOptions {
25
25
  }
26
26
 
27
27
  interface Credentials {
28
- apiKey: string;
28
+ apiKey?: string;
29
29
  userToken?: string;
30
30
  }
31
31
 
@@ -25,7 +25,7 @@ interface CacheOptions {
25
25
  }
26
26
 
27
27
  interface Credentials {
28
- apiKey: string;
28
+ apiKey?: string;
29
29
  userToken?: string;
30
30
  }
31
31
 
package/dist/index.d.cts CHANGED
@@ -1,8 +1,8 @@
1
- import { a as Credentials } from './index.d-BuZcXRMe.cjs';
2
- export { A as ApiError } from './index.d-BuZcXRMe.cjs';
3
- import { C as Client, P as PostcodesData, A as AddressListItem } from './types.gen-DnHMLImU.cjs';
4
- export { b as AbAddress, c as AbpAddress, d as Address, e as AddressCleanseData, f as AddressCleanseError, g as AddressCleanseErrors, h as AddressCleanseResponse, i as AddressCleanseResponses, j as AddressLatitudeParam, k as AddressLongitudeParam, l as AddressResponse, m as AddressSuggestion, n as AddressesData, o as AddressesError, p as AddressesErrors, q as AddressesResponse, r as AddressesResponses, s as ApiKey, t as ApiKeyAutomatedTopup, u as ApiKeyCurrentPurchase, v as ApiKeyDailyLimit, w as ApiKeyDatasets, x as ApiKeyDetails, y as ApiKeyDetailsEditable, z as ApiKeyDetailsResponse, B as ApiKeyIndividualLimit, D as ApiKeyMonthlyLimit, E as ApiKeyNotifications, G as ApiKeyParam, H as ApiKeyPathParam, I as ApiKeyResponse, J as ApiKeyUsageResponse, K as AutocompleteResponse, L as AvailableContexts, M as BanAddress, N as BevAddress, O as BiasCityParam, Q as BiasCountryIsoParam, S as BiasCountryParam, T as BiasIpParam, U as BiasLonLatParam, V as BiasPostalCode2Param, W as BiasPostalCode3Param, X as BiasPostalCodeParam, Y as BiasPostcodeAreaParam, Z as BiasPostcodeOutwardParam, _ as BiasPostcodeParam, $ as BiasPostcodeSectorParam, a0 as BiasPosttownParam, a1 as BiasStateCodeParam, a2 as BiasStateParam, a3 as BiasThoroughfareParam, a4 as BoxParam, a5 as CannarAddress, a6 as Carrier, a7 as CityParam, a8 as CleanseResponse, a9 as ClientOptions, aa as Config, ab as ConfigNewParam, ac as ConfigParam, ad as ConfigResponse, ae as ConfigUpdateParam, af as ConfigsResponse, ag as Context, ah as ContextParam, ai as Country, aj as CountryIso, ak as CountryIso2, al as CountryIsoParam, am as CountryParam, an as CreateConfigData, ao as CreateConfigError, ap as CreateConfigErrors, aq as CreateConfigResponse, ar as CreateConfigResponses, as as CreateLicenseeData, at as CreateLicenseeError, au as CreateLicenseeErrors, av as CreateLicenseeResponse, aw as CreateLicenseeResponses, ax as Dataset, ay as DatasetParam, az as DeleteConfigData, aA as DeleteConfigError, aB as DeleteConfigErrors, aC as DeleteConfigResponse, aD as DeleteConfigResponses, aE as DeleteLicenseeData, aF as DeleteLicenseeError, aG as DeleteLicenseeErrors, aH as DeleteLicenseeResponse, aI as DeleteLicenseeResponses, aJ as Eastings, aK as EcadAddress, aL as EcafAddress, aM as EircBase, aN as Email, aO as EmailResponse, aP as EmailValidationData, aQ as EmailValidationError, aR as EmailValidationErrors, aS as EmailValidationResponse, aT as EmailValidationResponses, aU as EndParam, aV as ErrorResponse, aW as FilterParam, F as FindAddressData, aX as FindAddressError, aY as FindAddressErrors, a as FindAddressResponse, aZ as FindAddressResponses, a_ as FindPlaceData, a$ as FindPlaceError, b0 as FindPlaceErrors, b1 as FindPlaceResponse, b2 as FindPlaceResponses, b3 as FodbosaAddress, b4 as GbrCleanseMatch, b5 as GbrCleanseNoMatch, b6 as GbrResolveAddressResponse, b7 as GeonamesPlace, b8 as GnafAddress, b9 as HereAddress, ba as Id, bb as InvalidPhoneNumber, bc as IsBusinessParam, bd as IsPoboxParam, be as KadasterAddress, bf as KartverketAddress, bg as KeyAvailabilityData, bh as KeyAvailabilityError, bi as KeyAvailabilityErrors, bj as KeyAvailabilityResponse, bk as KeyAvailabilityResponses, bl as KeyDetailsData, bm as KeyDetailsError, bn as KeyDetailsErrors, bo as KeyDetailsResponse, bp as KeyDetailsResponses, bq as KeyLogsData, br as KeyLogsError, bs as KeyLogsErrors, bt as KeyLogsResponse, bu as KeyLogsResponses, bv as KeyUsageData, bw as KeyUsageError, bx as KeyUsageErrors, by as KeyUsageResponse, bz as KeyUsageResponses, bA as KeyUsageResult, bB as Language, bC as Latitude, bD as Licensee, bE as LicenseeEditable, bF as LicenseeParam, bG as LicenseePathParam, bH as LicenseeResponse, bI as LicenseesResponse, bJ as LimitParam, bK as ListConfigsData, bL as ListConfigsError, bM as ListConfigsErrors, bN as ListConfigsResponse, bO as ListConfigsResponses, bP as ListLicenseesData, bQ as ListLicenseesError, bR as ListLicenseesErrors, bS as ListLicenseesResponse, bT as ListLicenseesResponses, bU as Longitude, bV as MoisAddress, bW as MrAddress, bX as NativeRecord, bY as NoContext, bZ as Northings, b_ as NotFoundResponse, b$ as NybAddress, c0 as PafAddress, c1 as PafRecordBase, c2 as PafaAddress, c3 as PafwAddress, c4 as PageParam, c5 as PhoneNumber, c6 as PhoneNumberResponse, c7 as PhoneNumberValidationData, c8 as PhoneNumberValidationError, c9 as PhoneNumberValidationErrors, ca as PhoneNumberValidationResponse, cb as PhoneNumberValidationResponses, cc as Place, cd as PlaceCountryIso, ce as PlaceDescriptiveName, cf as PlaceId, cg as PlaceName, ch as PlaceResponse, ci as PlaceSuggestion, cj as PostTownParam, ck as PostalCode2Param, cl as PostalCode3Param, cm as PostalCodeParam, cn as PostcodeAreaParam, co as PostcodeNotFoundResponse, cp as PostcodeOutwardParam, cq as PostcodeParam, cr as PostcodeResponse, cs as PostcodeSectorParam, ct as PostcodeTypeParam, cu as PostcodesError, cv as PostcodesErrors, cw as PostcodesResponse, cx as PostcodesResponses, cy as RegenerateLicenseeKeyData, cz as RegenerateLicenseeKeyError, cA as RegenerateLicenseeKeyErrors, cB as RegenerateLicenseeKeyResponse, cC as RegenerateLicenseeKeyResponses, cD as ResolveAddressData, cE as ResolveAddressError, cF as ResolveAddressErrors, R as ResolveAddressResponse, cG as ResolveAddressResponses, cH as ResolvePlaceData, cI as ResolvePlaceError, cJ as ResolvePlaceErrors, cK as ResolvePlaceResponse, cL as ResolvePlaceResponse2, cM as ResolvePlaceResponses, cN as RetrieveConfigData, cO as RetrieveConfigError, cP as RetrieveConfigErrors, cQ as RetrieveConfigResponse, cR as RetrieveConfigResponses, cS as RetrieveLicenseeData, cT as RetrieveLicenseeError, cU as RetrieveLicenseeErrors, cV as RetrieveLicenseeResponse, cW as RetrieveLicenseeResponses, cX as SdfiAddress, cY as SmallUserParam, cZ as StartParam, c_ as StateCodeParam, c$ as StateParam, d0 as SwtAddress, d1 as TagsParam, d2 as UkAddressSuggestion, d3 as UnknownEmail, d4 as UpdateConfigData, d5 as UpdateConfigError, d6 as UpdateConfigErrors, d7 as UpdateConfigResponse, d8 as UpdateConfigResponses, d9 as UpdateKeyDetailsData, da as UpdateKeyDetailsError, db as UpdateKeyDetailsErrors, dc as UpdateKeyDetailsResponse, dd as UpdateKeyDetailsResponses, de as UpdateLicenseeData, df as UpdateLicenseeError, dg as UpdateLicenseeErrors, dh as UpdateLicenseeResponse, di as UpdateLicenseeResponses, dj as UprnParam, dk as UpujpAddress, dl as UserTokenParam, dm as UspsAddress } from './types.gen-DnHMLImU.cjs';
5
- export { O as Options, a as addressCleanse, b as addresses, c as createConfig, d as createLicensee, e as deleteConfig, f as deleteLicensee, g as emailValidation, h as findAddress, i as findPlace, k as keyAvailability, j as keyDetails, l as keyLogs, m as keyUsage, n as listConfigs, o as listLicensees, p as phoneNumberValidation, q as postcodes, r as regenerateLicenseeKey, s as resolveAddress, t as resolvePlace, u as retrieveConfig, v as retrieveLicensee, w as updateConfig, x as updateKeyDetails, y as updateLicensee } from './sdk.gen-FPGSAY1n.cjs';
1
+ import { a as Credentials } from './index.d-CUirxwnK.cjs';
2
+ export { A as ApiError } from './index.d-CUirxwnK.cjs';
3
+ import { C as Client, P as PostcodesData, A as AddressListItem } from './types.gen-DcN6bPz5.cjs';
4
+ export { b as AbAddress, c as AbpAddress, d as Address, e as AddressCleanseData, f as AddressCleanseError, g as AddressCleanseErrors, h as AddressCleanseResponse, i as AddressCleanseResponses, j as AddressLatitudeParam, k as AddressLongitudeParam, l as AddressResponse, m as AddressSuggestion, n as AddressesData, o as AddressesError, p as AddressesErrors, q as AddressesResponse, r as AddressesResponses, s as ApiKey, t as ApiKeyAutomatedTopup, u as ApiKeyCurrentPurchase, v as ApiKeyDailyLimit, w as ApiKeyDatasets, x as ApiKeyDetails, y as ApiKeyDetailsEditable, z as ApiKeyDetailsResponse, B as ApiKeyIndividualLimit, D as ApiKeyMonthlyLimit, E as ApiKeyNotifications, G as ApiKeyParam, H as ApiKeyPathParam, I as ApiKeyResponse, J as ApiKeyUsageResponse, K as AutocompleteResponse, L as AvailableContexts, M as BanAddress, N as BevAddress, O as BiasCityParam, Q as BiasCountryIsoParam, S as BiasCountryParam, T as BiasIpParam, U as BiasLonLatParam, V as BiasPostalCode2Param, W as BiasPostalCode3Param, X as BiasPostalCodeParam, Y as BiasPostcodeAreaParam, Z as BiasPostcodeOutwardParam, _ as BiasPostcodeParam, $ as BiasPostcodeSectorParam, a0 as BiasPosttownParam, a1 as BiasStateCodeParam, a2 as BiasStateParam, a3 as BiasThoroughfareParam, a4 as BoxParam, a5 as CannarAddress, a6 as Carrier, a7 as CityParam, a8 as CleanseResponse, a9 as ClientOptions, aa as Config, ab as ConfigNewParam, ac as ConfigParam, ad as ConfigResponse, ae as ConfigUpdateParam, af as ConfigsResponse, ag as Context, ah as ContextParam, ai as Country, aj as CountryIso, ak as CountryIso2, al as CountryIsoParam, am as CountryParam, an as CreateConfigData, ao as CreateConfigError, ap as CreateConfigErrors, aq as CreateConfigResponse, ar as CreateConfigResponses, as as CreateLicenseeData, at as CreateLicenseeError, au as CreateLicenseeErrors, av as CreateLicenseeResponse, aw as CreateLicenseeResponses, ax as Dataset, ay as DatasetParam, az as DeleteConfigData, aA as DeleteConfigError, aB as DeleteConfigErrors, aC as DeleteConfigResponse, aD as DeleteConfigResponses, aE as DeleteLicenseeData, aF as DeleteLicenseeError, aG as DeleteLicenseeErrors, aH as DeleteLicenseeResponse, aI as DeleteLicenseeResponses, aJ as Eastings, aK as EcadAddress, aL as EcafAddress, aM as EircBase, aN as Email, aO as EmailResponse, aP as EmailValidationData, aQ as EmailValidationError, aR as EmailValidationErrors, aS as EmailValidationResponse, aT as EmailValidationResponses, aU as EndParam, aV as ErrorResponse, aW as FilterParam, F as FindAddressData, aX as FindAddressError, aY as FindAddressErrors, a as FindAddressResponse, aZ as FindAddressResponses, a_ as FindPlaceData, a$ as FindPlaceError, b0 as FindPlaceErrors, b1 as FindPlaceResponse, b2 as FindPlaceResponses, b3 as FodbosaAddress, b4 as GbrCleanseMatch, b5 as GbrCleanseNoMatch, b6 as GbrResolveAddressResponse, b7 as GeonamesPlace, b8 as GnafAddress, b9 as HereAddress, ba as Id, bb as InvalidPhoneNumber, bc as IsBusinessParam, bd as IsPoboxParam, be as KadasterAddress, bf as KartverketAddress, bg as KeyAvailabilityData, bh as KeyAvailabilityError, bi as KeyAvailabilityErrors, bj as KeyAvailabilityResponse, bk as KeyAvailabilityResponses, bl as KeyDetailsData, bm as KeyDetailsError, bn as KeyDetailsErrors, bo as KeyDetailsResponse, bp as KeyDetailsResponses, bq as KeyLogsData, br as KeyLogsError, bs as KeyLogsErrors, bt as KeyLogsResponse, bu as KeyLogsResponses, bv as KeyUsageData, bw as KeyUsageError, bx as KeyUsageErrors, by as KeyUsageResponse, bz as KeyUsageResponses, bA as KeyUsageResult, bB as Language, bC as Latitude, bD as Licensee, bE as LicenseeEditable, bF as LicenseeParam, bG as LicenseePathParam, bH as LicenseeResponse, bI as LicenseesResponse, bJ as LimitParam, bK as ListConfigsData, bL as ListConfigsError, bM as ListConfigsErrors, bN as ListConfigsResponse, bO as ListConfigsResponses, bP as ListLicenseesData, bQ as ListLicenseesError, bR as ListLicenseesErrors, bS as ListLicenseesResponse, bT as ListLicenseesResponses, bU as Longitude, bV as MoisAddress, bW as MrAddress, bX as NativeRecord, bY as NoContext, bZ as Northings, b_ as NotFoundResponse, b$ as NybAddress, c0 as PafAddress, c1 as PafRecordBase, c2 as PafaAddress, c3 as PafwAddress, c4 as PageParam, c5 as PhoneNumber, c6 as PhoneNumberResponse, c7 as PhoneNumberValidationData, c8 as PhoneNumberValidationError, c9 as PhoneNumberValidationErrors, ca as PhoneNumberValidationResponse, cb as PhoneNumberValidationResponses, cc as Place, cd as PlaceCountryIso, ce as PlaceDescriptiveName, cf as PlaceId, cg as PlaceName, ch as PlaceResponse, ci as PlaceSuggestion, cj as PostTownParam, ck as PostalCode2Param, cl as PostalCode3Param, cm as PostalCodeParam, cn as PostcodeAreaParam, co as PostcodeNotFoundResponse, cp as PostcodeOutwardParam, cq as PostcodeParam, cr as PostcodeResponse, cs as PostcodeSectorParam, ct as PostcodeTypeParam, cu as PostcodesError, cv as PostcodesErrors, cw as PostcodesResponse, cx as PostcodesResponses, cy as RegenerateLicenseeKeyData, cz as RegenerateLicenseeKeyError, cA as RegenerateLicenseeKeyErrors, cB as RegenerateLicenseeKeyResponse, cC as RegenerateLicenseeKeyResponses, cD as RemoveOrganisationParam, cE as ResolveAddressData, cF as ResolveAddressError, cG as ResolveAddressErrors, R as ResolveAddressResponse, cH as ResolveAddressResponses, cI as ResolvePlaceData, cJ as ResolvePlaceError, cK as ResolvePlaceErrors, cL as ResolvePlaceResponse, cM as ResolvePlaceResponse2, cN as ResolvePlaceResponses, cO as RetrieveConfigData, cP as RetrieveConfigError, cQ as RetrieveConfigErrors, cR as RetrieveConfigResponse, cS as RetrieveConfigResponses, cT as RetrieveLicenseeData, cU as RetrieveLicenseeError, cV as RetrieveLicenseeErrors, cW as RetrieveLicenseeResponse, cX as RetrieveLicenseeResponses, cY as SdfiAddress, cZ as SmallUserParam, c_ as StartParam, c$ as StateCodeParam, d0 as StateParam, d1 as SwtAddress, d2 as TagsParam, d3 as UkAddressSuggestion, d4 as UnknownEmail, d5 as UpdateConfigData, d6 as UpdateConfigError, d7 as UpdateConfigErrors, d8 as UpdateConfigResponse, d9 as UpdateConfigResponses, da as UpdateKeyDetailsData, db as UpdateKeyDetailsError, dc as UpdateKeyDetailsErrors, dd as UpdateKeyDetailsResponse, de as UpdateKeyDetailsResponses, df as UpdateLicenseeData, dg as UpdateLicenseeError, dh as UpdateLicenseeErrors, di as UpdateLicenseeResponse, dj as UpdateLicenseeResponses, dk as UprnParam, dl as UpujpAddress, dm as UspsAddress } from './types.gen-DcN6bPz5.cjs';
5
+ export { O as Options, a as addressCleanse, b as addresses, c as createConfig, d as createLicensee, e as deleteConfig, f as deleteLicensee, g as emailValidation, h as findAddress, i as findPlace, k as keyAvailability, j as keyDetails, l as keyLogs, m as keyUsage, n as listConfigs, o as listLicensees, p as phoneNumberValidation, q as postcodes, r as regenerateLicenseeKey, s as resolveAddress, t as resolvePlace, u as retrieveConfig, v as retrieveLicensee, w as updateConfig, x as updateKeyDetails, y as updateLicensee } from './sdk.gen-DwbOJfyY.cjs';
6
6
 
7
7
  interface IdpcClientOptions extends Credentials {
8
8
  baseUrl?: string;
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { a as Credentials } from './index.d-BuZcXRMe.js';
2
- export { A as ApiError } from './index.d-BuZcXRMe.js';
3
- import { C as Client, P as PostcodesData, A as AddressListItem } from './types.gen-DnHMLImU.js';
4
- export { b as AbAddress, c as AbpAddress, d as Address, e as AddressCleanseData, f as AddressCleanseError, g as AddressCleanseErrors, h as AddressCleanseResponse, i as AddressCleanseResponses, j as AddressLatitudeParam, k as AddressLongitudeParam, l as AddressResponse, m as AddressSuggestion, n as AddressesData, o as AddressesError, p as AddressesErrors, q as AddressesResponse, r as AddressesResponses, s as ApiKey, t as ApiKeyAutomatedTopup, u as ApiKeyCurrentPurchase, v as ApiKeyDailyLimit, w as ApiKeyDatasets, x as ApiKeyDetails, y as ApiKeyDetailsEditable, z as ApiKeyDetailsResponse, B as ApiKeyIndividualLimit, D as ApiKeyMonthlyLimit, E as ApiKeyNotifications, G as ApiKeyParam, H as ApiKeyPathParam, I as ApiKeyResponse, J as ApiKeyUsageResponse, K as AutocompleteResponse, L as AvailableContexts, M as BanAddress, N as BevAddress, O as BiasCityParam, Q as BiasCountryIsoParam, S as BiasCountryParam, T as BiasIpParam, U as BiasLonLatParam, V as BiasPostalCode2Param, W as BiasPostalCode3Param, X as BiasPostalCodeParam, Y as BiasPostcodeAreaParam, Z as BiasPostcodeOutwardParam, _ as BiasPostcodeParam, $ as BiasPostcodeSectorParam, a0 as BiasPosttownParam, a1 as BiasStateCodeParam, a2 as BiasStateParam, a3 as BiasThoroughfareParam, a4 as BoxParam, a5 as CannarAddress, a6 as Carrier, a7 as CityParam, a8 as CleanseResponse, a9 as ClientOptions, aa as Config, ab as ConfigNewParam, ac as ConfigParam, ad as ConfigResponse, ae as ConfigUpdateParam, af as ConfigsResponse, ag as Context, ah as ContextParam, ai as Country, aj as CountryIso, ak as CountryIso2, al as CountryIsoParam, am as CountryParam, an as CreateConfigData, ao as CreateConfigError, ap as CreateConfigErrors, aq as CreateConfigResponse, ar as CreateConfigResponses, as as CreateLicenseeData, at as CreateLicenseeError, au as CreateLicenseeErrors, av as CreateLicenseeResponse, aw as CreateLicenseeResponses, ax as Dataset, ay as DatasetParam, az as DeleteConfigData, aA as DeleteConfigError, aB as DeleteConfigErrors, aC as DeleteConfigResponse, aD as DeleteConfigResponses, aE as DeleteLicenseeData, aF as DeleteLicenseeError, aG as DeleteLicenseeErrors, aH as DeleteLicenseeResponse, aI as DeleteLicenseeResponses, aJ as Eastings, aK as EcadAddress, aL as EcafAddress, aM as EircBase, aN as Email, aO as EmailResponse, aP as EmailValidationData, aQ as EmailValidationError, aR as EmailValidationErrors, aS as EmailValidationResponse, aT as EmailValidationResponses, aU as EndParam, aV as ErrorResponse, aW as FilterParam, F as FindAddressData, aX as FindAddressError, aY as FindAddressErrors, a as FindAddressResponse, aZ as FindAddressResponses, a_ as FindPlaceData, a$ as FindPlaceError, b0 as FindPlaceErrors, b1 as FindPlaceResponse, b2 as FindPlaceResponses, b3 as FodbosaAddress, b4 as GbrCleanseMatch, b5 as GbrCleanseNoMatch, b6 as GbrResolveAddressResponse, b7 as GeonamesPlace, b8 as GnafAddress, b9 as HereAddress, ba as Id, bb as InvalidPhoneNumber, bc as IsBusinessParam, bd as IsPoboxParam, be as KadasterAddress, bf as KartverketAddress, bg as KeyAvailabilityData, bh as KeyAvailabilityError, bi as KeyAvailabilityErrors, bj as KeyAvailabilityResponse, bk as KeyAvailabilityResponses, bl as KeyDetailsData, bm as KeyDetailsError, bn as KeyDetailsErrors, bo as KeyDetailsResponse, bp as KeyDetailsResponses, bq as KeyLogsData, br as KeyLogsError, bs as KeyLogsErrors, bt as KeyLogsResponse, bu as KeyLogsResponses, bv as KeyUsageData, bw as KeyUsageError, bx as KeyUsageErrors, by as KeyUsageResponse, bz as KeyUsageResponses, bA as KeyUsageResult, bB as Language, bC as Latitude, bD as Licensee, bE as LicenseeEditable, bF as LicenseeParam, bG as LicenseePathParam, bH as LicenseeResponse, bI as LicenseesResponse, bJ as LimitParam, bK as ListConfigsData, bL as ListConfigsError, bM as ListConfigsErrors, bN as ListConfigsResponse, bO as ListConfigsResponses, bP as ListLicenseesData, bQ as ListLicenseesError, bR as ListLicenseesErrors, bS as ListLicenseesResponse, bT as ListLicenseesResponses, bU as Longitude, bV as MoisAddress, bW as MrAddress, bX as NativeRecord, bY as NoContext, bZ as Northings, b_ as NotFoundResponse, b$ as NybAddress, c0 as PafAddress, c1 as PafRecordBase, c2 as PafaAddress, c3 as PafwAddress, c4 as PageParam, c5 as PhoneNumber, c6 as PhoneNumberResponse, c7 as PhoneNumberValidationData, c8 as PhoneNumberValidationError, c9 as PhoneNumberValidationErrors, ca as PhoneNumberValidationResponse, cb as PhoneNumberValidationResponses, cc as Place, cd as PlaceCountryIso, ce as PlaceDescriptiveName, cf as PlaceId, cg as PlaceName, ch as PlaceResponse, ci as PlaceSuggestion, cj as PostTownParam, ck as PostalCode2Param, cl as PostalCode3Param, cm as PostalCodeParam, cn as PostcodeAreaParam, co as PostcodeNotFoundResponse, cp as PostcodeOutwardParam, cq as PostcodeParam, cr as PostcodeResponse, cs as PostcodeSectorParam, ct as PostcodeTypeParam, cu as PostcodesError, cv as PostcodesErrors, cw as PostcodesResponse, cx as PostcodesResponses, cy as RegenerateLicenseeKeyData, cz as RegenerateLicenseeKeyError, cA as RegenerateLicenseeKeyErrors, cB as RegenerateLicenseeKeyResponse, cC as RegenerateLicenseeKeyResponses, cD as ResolveAddressData, cE as ResolveAddressError, cF as ResolveAddressErrors, R as ResolveAddressResponse, cG as ResolveAddressResponses, cH as ResolvePlaceData, cI as ResolvePlaceError, cJ as ResolvePlaceErrors, cK as ResolvePlaceResponse, cL as ResolvePlaceResponse2, cM as ResolvePlaceResponses, cN as RetrieveConfigData, cO as RetrieveConfigError, cP as RetrieveConfigErrors, cQ as RetrieveConfigResponse, cR as RetrieveConfigResponses, cS as RetrieveLicenseeData, cT as RetrieveLicenseeError, cU as RetrieveLicenseeErrors, cV as RetrieveLicenseeResponse, cW as RetrieveLicenseeResponses, cX as SdfiAddress, cY as SmallUserParam, cZ as StartParam, c_ as StateCodeParam, c$ as StateParam, d0 as SwtAddress, d1 as TagsParam, d2 as UkAddressSuggestion, d3 as UnknownEmail, d4 as UpdateConfigData, d5 as UpdateConfigError, d6 as UpdateConfigErrors, d7 as UpdateConfigResponse, d8 as UpdateConfigResponses, d9 as UpdateKeyDetailsData, da as UpdateKeyDetailsError, db as UpdateKeyDetailsErrors, dc as UpdateKeyDetailsResponse, dd as UpdateKeyDetailsResponses, de as UpdateLicenseeData, df as UpdateLicenseeError, dg as UpdateLicenseeErrors, dh as UpdateLicenseeResponse, di as UpdateLicenseeResponses, dj as UprnParam, dk as UpujpAddress, dl as UserTokenParam, dm as UspsAddress } from './types.gen-DnHMLImU.js';
5
- export { O as Options, a as addressCleanse, b as addresses, c as createConfig, d as createLicensee, e as deleteConfig, f as deleteLicensee, g as emailValidation, h as findAddress, i as findPlace, k as keyAvailability, j as keyDetails, l as keyLogs, m as keyUsage, n as listConfigs, o as listLicensees, p as phoneNumberValidation, q as postcodes, r as regenerateLicenseeKey, s as resolveAddress, t as resolvePlace, u as retrieveConfig, v as retrieveLicensee, w as updateConfig, x as updateKeyDetails, y as updateLicensee } from './sdk.gen-DXgz6ZXa.js';
1
+ import { a as Credentials } from './index.d-CUirxwnK.js';
2
+ export { A as ApiError } from './index.d-CUirxwnK.js';
3
+ import { C as Client, P as PostcodesData, A as AddressListItem } from './types.gen-DcN6bPz5.js';
4
+ export { b as AbAddress, c as AbpAddress, d as Address, e as AddressCleanseData, f as AddressCleanseError, g as AddressCleanseErrors, h as AddressCleanseResponse, i as AddressCleanseResponses, j as AddressLatitudeParam, k as AddressLongitudeParam, l as AddressResponse, m as AddressSuggestion, n as AddressesData, o as AddressesError, p as AddressesErrors, q as AddressesResponse, r as AddressesResponses, s as ApiKey, t as ApiKeyAutomatedTopup, u as ApiKeyCurrentPurchase, v as ApiKeyDailyLimit, w as ApiKeyDatasets, x as ApiKeyDetails, y as ApiKeyDetailsEditable, z as ApiKeyDetailsResponse, B as ApiKeyIndividualLimit, D as ApiKeyMonthlyLimit, E as ApiKeyNotifications, G as ApiKeyParam, H as ApiKeyPathParam, I as ApiKeyResponse, J as ApiKeyUsageResponse, K as AutocompleteResponse, L as AvailableContexts, M as BanAddress, N as BevAddress, O as BiasCityParam, Q as BiasCountryIsoParam, S as BiasCountryParam, T as BiasIpParam, U as BiasLonLatParam, V as BiasPostalCode2Param, W as BiasPostalCode3Param, X as BiasPostalCodeParam, Y as BiasPostcodeAreaParam, Z as BiasPostcodeOutwardParam, _ as BiasPostcodeParam, $ as BiasPostcodeSectorParam, a0 as BiasPosttownParam, a1 as BiasStateCodeParam, a2 as BiasStateParam, a3 as BiasThoroughfareParam, a4 as BoxParam, a5 as CannarAddress, a6 as Carrier, a7 as CityParam, a8 as CleanseResponse, a9 as ClientOptions, aa as Config, ab as ConfigNewParam, ac as ConfigParam, ad as ConfigResponse, ae as ConfigUpdateParam, af as ConfigsResponse, ag as Context, ah as ContextParam, ai as Country, aj as CountryIso, ak as CountryIso2, al as CountryIsoParam, am as CountryParam, an as CreateConfigData, ao as CreateConfigError, ap as CreateConfigErrors, aq as CreateConfigResponse, ar as CreateConfigResponses, as as CreateLicenseeData, at as CreateLicenseeError, au as CreateLicenseeErrors, av as CreateLicenseeResponse, aw as CreateLicenseeResponses, ax as Dataset, ay as DatasetParam, az as DeleteConfigData, aA as DeleteConfigError, aB as DeleteConfigErrors, aC as DeleteConfigResponse, aD as DeleteConfigResponses, aE as DeleteLicenseeData, aF as DeleteLicenseeError, aG as DeleteLicenseeErrors, aH as DeleteLicenseeResponse, aI as DeleteLicenseeResponses, aJ as Eastings, aK as EcadAddress, aL as EcafAddress, aM as EircBase, aN as Email, aO as EmailResponse, aP as EmailValidationData, aQ as EmailValidationError, aR as EmailValidationErrors, aS as EmailValidationResponse, aT as EmailValidationResponses, aU as EndParam, aV as ErrorResponse, aW as FilterParam, F as FindAddressData, aX as FindAddressError, aY as FindAddressErrors, a as FindAddressResponse, aZ as FindAddressResponses, a_ as FindPlaceData, a$ as FindPlaceError, b0 as FindPlaceErrors, b1 as FindPlaceResponse, b2 as FindPlaceResponses, b3 as FodbosaAddress, b4 as GbrCleanseMatch, b5 as GbrCleanseNoMatch, b6 as GbrResolveAddressResponse, b7 as GeonamesPlace, b8 as GnafAddress, b9 as HereAddress, ba as Id, bb as InvalidPhoneNumber, bc as IsBusinessParam, bd as IsPoboxParam, be as KadasterAddress, bf as KartverketAddress, bg as KeyAvailabilityData, bh as KeyAvailabilityError, bi as KeyAvailabilityErrors, bj as KeyAvailabilityResponse, bk as KeyAvailabilityResponses, bl as KeyDetailsData, bm as KeyDetailsError, bn as KeyDetailsErrors, bo as KeyDetailsResponse, bp as KeyDetailsResponses, bq as KeyLogsData, br as KeyLogsError, bs as KeyLogsErrors, bt as KeyLogsResponse, bu as KeyLogsResponses, bv as KeyUsageData, bw as KeyUsageError, bx as KeyUsageErrors, by as KeyUsageResponse, bz as KeyUsageResponses, bA as KeyUsageResult, bB as Language, bC as Latitude, bD as Licensee, bE as LicenseeEditable, bF as LicenseeParam, bG as LicenseePathParam, bH as LicenseeResponse, bI as LicenseesResponse, bJ as LimitParam, bK as ListConfigsData, bL as ListConfigsError, bM as ListConfigsErrors, bN as ListConfigsResponse, bO as ListConfigsResponses, bP as ListLicenseesData, bQ as ListLicenseesError, bR as ListLicenseesErrors, bS as ListLicenseesResponse, bT as ListLicenseesResponses, bU as Longitude, bV as MoisAddress, bW as MrAddress, bX as NativeRecord, bY as NoContext, bZ as Northings, b_ as NotFoundResponse, b$ as NybAddress, c0 as PafAddress, c1 as PafRecordBase, c2 as PafaAddress, c3 as PafwAddress, c4 as PageParam, c5 as PhoneNumber, c6 as PhoneNumberResponse, c7 as PhoneNumberValidationData, c8 as PhoneNumberValidationError, c9 as PhoneNumberValidationErrors, ca as PhoneNumberValidationResponse, cb as PhoneNumberValidationResponses, cc as Place, cd as PlaceCountryIso, ce as PlaceDescriptiveName, cf as PlaceId, cg as PlaceName, ch as PlaceResponse, ci as PlaceSuggestion, cj as PostTownParam, ck as PostalCode2Param, cl as PostalCode3Param, cm as PostalCodeParam, cn as PostcodeAreaParam, co as PostcodeNotFoundResponse, cp as PostcodeOutwardParam, cq as PostcodeParam, cr as PostcodeResponse, cs as PostcodeSectorParam, ct as PostcodeTypeParam, cu as PostcodesError, cv as PostcodesErrors, cw as PostcodesResponse, cx as PostcodesResponses, cy as RegenerateLicenseeKeyData, cz as RegenerateLicenseeKeyError, cA as RegenerateLicenseeKeyErrors, cB as RegenerateLicenseeKeyResponse, cC as RegenerateLicenseeKeyResponses, cD as RemoveOrganisationParam, cE as ResolveAddressData, cF as ResolveAddressError, cG as ResolveAddressErrors, R as ResolveAddressResponse, cH as ResolveAddressResponses, cI as ResolvePlaceData, cJ as ResolvePlaceError, cK as ResolvePlaceErrors, cL as ResolvePlaceResponse, cM as ResolvePlaceResponse2, cN as ResolvePlaceResponses, cO as RetrieveConfigData, cP as RetrieveConfigError, cQ as RetrieveConfigErrors, cR as RetrieveConfigResponse, cS as RetrieveConfigResponses, cT as RetrieveLicenseeData, cU as RetrieveLicenseeError, cV as RetrieveLicenseeErrors, cW as RetrieveLicenseeResponse, cX as RetrieveLicenseeResponses, cY as SdfiAddress, cZ as SmallUserParam, c_ as StartParam, c$ as StateCodeParam, d0 as StateParam, d1 as SwtAddress, d2 as TagsParam, d3 as UkAddressSuggestion, d4 as UnknownEmail, d5 as UpdateConfigData, d6 as UpdateConfigError, d7 as UpdateConfigErrors, d8 as UpdateConfigResponse, d9 as UpdateConfigResponses, da as UpdateKeyDetailsData, db as UpdateKeyDetailsError, dc as UpdateKeyDetailsErrors, dd as UpdateKeyDetailsResponse, de as UpdateKeyDetailsResponses, df as UpdateLicenseeData, dg as UpdateLicenseeError, dh as UpdateLicenseeErrors, di as UpdateLicenseeResponse, dj as UpdateLicenseeResponses, dk as UprnParam, dl as UpujpAddress, dm as UspsAddress } from './types.gen-DcN6bPz5.js';
5
+ export { O as Options, a as addressCleanse, b as addresses, c as createConfig, d as createLicensee, e as deleteConfig, f as deleteLicensee, g as emailValidation, h as findAddress, i as findPlace, k as keyAvailability, j as keyDetails, l as keyLogs, m as keyUsage, n as listConfigs, o as listLicensees, p as phoneNumberValidation, q as postcodes, r as regenerateLicenseeKey, s as resolveAddress, t as resolvePlace, u as retrieveConfig, v as retrieveLicensee, w as updateConfig, x as updateKeyDetails, y as updateLicensee } from './sdk.gen-DmRZ159b.js';
6
6
 
7
7
  interface IdpcClientOptions extends Credentials {
8
8
  baseUrl?: string;
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{d as i,e as n,f as p}from"./chunk-SE457ZO7.mjs";import{A as _,B as M,a as d,b as a,d as c,e as g,f as y,g as C,h,i as x,j as P,k as I,l as b,m as k,n as A,o as L,p as E,q as R,r as w,s as O,t as U,u as j,v as N,w as S,x as q,y as D,z as F}from"./chunk-27HFF2QV.mjs";var u="https://api.ideal-postcodes.co.uk/v1",m=t=>{let o=a(d({baseUrl:t.baseUrl??u,fetch:t.fetch,headers:t.headers,throwOnError:!0}));o.interceptors.request.use((r,e)=>i(r,e.url,t));let{timeoutMs:s}=t;return s!==void 0&&o.interceptors.request.use(r=>new Request(r,{signal:AbortSignal.any([r.signal,AbortSignal.timeout(s)])})),o.interceptors.error.use(p),o};var f=async({client:t,postcode:o,signal:s,...r})=>{try{let{data:e}=await c({client:t,signal:s,path:{postcode:o},query:r,throwOnError:!0});return{addresses:e.result,suggestions:[],total:e.total}}catch(e){if(!(e instanceof n)||e.code!==4040)throw e;let{suggestions:l}=e.body;return{addresses:[],suggestions:l??[],total:0}}};export{n as ApiError,P as addressCleanse,k as addresses,S as createConfig,m as createIdpcClient,R as createLicensee,q as deleteConfig,w as deleteLicensee,_ as emailValidation,I as findAddress,A as findPlace,g as keyAvailability,y as keyDetails,x as keyLogs,h as keyUsage,N as listConfigs,E as listLicensees,f as lookupPostcode,M as phoneNumberValidation,c as postcodes,j as regenerateLicenseeKey,b as resolveAddress,L as resolvePlace,D as retrieveConfig,O as retrieveLicensee,F as updateConfig,C as updateKeyDetails,U as updateLicensee};
1
+ import{d as i,e as n,f as p}from"./chunk-PIHG63EO.mjs";import{A as _,B as M,a as d,b as a,d as c,e as g,f as y,g as C,h,i as x,j as P,k as I,l as b,m as k,n as A,o as L,p as E,q as R,r as w,s as O,t as U,u as j,v as N,w as S,x as q,y as D,z as F}from"./chunk-27HFF2QV.mjs";var u="https://api.ideal-postcodes.co.uk/v1",m=t=>{let o=a(d({baseUrl:t.baseUrl??u,fetch:t.fetch,headers:t.headers,throwOnError:!0}));o.interceptors.request.use((r,e)=>i(r,e.url,t));let{timeoutMs:s}=t;return s!==void 0&&o.interceptors.request.use(r=>new Request(r,{signal:AbortSignal.any([r.signal,AbortSignal.timeout(s)])})),o.interceptors.error.use(p),o};var f=async({client:t,postcode:o,signal:s,...r})=>{try{let{data:e}=await c({client:t,signal:s,path:{postcode:o},query:r,throwOnError:!0});return{addresses:e.result,suggestions:[],total:e.total}}catch(e){if(!(e instanceof n)||e.code!==4040)throw e;let{suggestions:l}=e.body;return{addresses:[],suggestions:l??[],total:0}}};export{n as ApiError,P as addressCleanse,k as addresses,S as createConfig,m as createIdpcClient,R as createLicensee,q as deleteConfig,w as deleteLicensee,_ as emailValidation,I as findAddress,A as findPlace,g as keyAvailability,y as keyDetails,x as keyLogs,h as keyUsage,N as listConfigs,E as listLicensees,f as lookupPostcode,M as phoneNumberValidation,c as postcodes,j as regenerateLicenseeKey,b as resolveAddress,L as resolvePlace,D as retrieveConfig,O as retrieveLicensee,F as updateConfig,C as updateKeyDetails,U as updateLicensee};