Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ideal-postcodes/core-interface

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ideal-postcodes/core-interface - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

8

CHANGELOG.md

@@ -0,1 +1,9 @@

# [1.3.0](https://github.com/ideal-postcodes/core-interface/compare/1.2.0...1.3.0) (2019-06-09)
### Features
* **Error:** Add specific 402 errors ([270cfed](https://github.com/ideal-postcodes/core-interface/commit/270cfed))
* **Error:** Allow optional metadata attribute ([9d082a7](https://github.com/ideal-postcodes/core-interface/commit/9d082a7))
# [1.2.0](https://github.com/ideal-postcodes/core-interface/compare/1.1.1...1.2.0) (2019-06-07)

@@ -2,0 +10,0 @@

23

dist/client.d.ts

@@ -28,3 +28,3 @@ import { Agent, HttpResponse, Header } from "./agent";

/**
* Time before HTTP request timeout. Defaults to 10s
* Default time in ms before HTTP request timeout. Defaults to 10s (`10000`)
*/

@@ -107,4 +107,2 @@ timeout: number;

/**
* url
*
* Return base URL for API requests

@@ -115,3 +113,3 @@ */

/**
* ping
* Ping API base (`/`)
*

@@ -122,3 +120,3 @@ * Dispatches HTTP request to root endpoint "`/`"

/**
* lookupPostcode
* Lookup Postcode
*

@@ -133,3 +131,3 @@ * Search for addresses given a postcode. Postcode queries are case and space insensitive

/**
* lookupAddress
* Lookup Address
*

@@ -142,4 +140,2 @@ * Search for an address given a query

/**
* toAddressIdQuery
*
* Generates a request object. Bundles together commonly used header/query extractions:

@@ -153,3 +149,3 @@ * - Authorization (api_key, licensee, user_token)

/**
* lookupUdprn
* Lookup UDPRN
*

@@ -164,3 +160,3 @@ * Search for an address given a UDPRN

/**
* lookupUdprn
* Lookup UMPRN
*

@@ -174,4 +170,11 @@ * Search for an address given a UDPRN

lookupUmprn(options: LookupUmprnOptions): Promise<Address | null>;
/**
* Check Key Availability
*
* Checks if a key can bey used
*
* [API Documentation for /keys]()https://ideal-postcodes.co.uk/documentation/keys#key)
*/
checkKeyUsability(options: CheckKeyUsabilityOptions): Promise<KeyStatus>;
}
export {};

@@ -46,4 +46,2 @@ "use strict";

/**
* url
*
* Return base URL for API requests

@@ -58,3 +56,3 @@ */

/**
* ping
* Ping API base (`/`)
*

@@ -75,3 +73,3 @@ * Dispatches HTTP request to root endpoint "`/`"

/**
* lookupPostcode
* Lookup Postcode
*

@@ -99,3 +97,3 @@ * Search for addresses given a postcode. Postcode queries are case and space insensitive

/**
* lookupAddress
* Lookup Address
*

@@ -122,4 +120,2 @@ * Search for an address given a query

/**
* toAddressIdQuery
*
* Generates a request object. Bundles together commonly used header/query extractions:

@@ -144,3 +140,3 @@ * - Authorization (api_key, licensee, user_token)

/**
* lookupUdprn
* Lookup UDPRN
*

@@ -165,3 +161,3 @@ * Search for an address given a UDPRN

/**
* lookupUdprn
* Lookup UMPRN
*

@@ -185,2 +181,9 @@ * Search for an address given a UDPRN

};
/**
* Check Key Availability
*
* Checks if a key can bey used
*
* [API Documentation for /keys]()https://ideal-postcodes.co.uk/documentation/keys#key)
*/
Client.prototype.checkKeyUsability = function (options) {

@@ -187,0 +190,0 @@ var _a = options.api_key, api_key = _a === void 0 ? this.api_key : _a, timeout = options.timeout;

@@ -10,4 +10,14 @@ import { HttpResponse } from "./agent";

httpStatus: number;
metadata?: Metadata;
}
/**
* Metadata
*
* An abitrary object which stores metadata specific to the concrete client
* implementation
*/
interface Metadata {
[k: string]: unknown;
}
/**
* IdealPostcodesError

@@ -22,2 +32,3 @@ *

httpStatus: number;
metadata: Metadata;
/**

@@ -87,2 +98,19 @@ * Instantiate IdealPostcodesError

/**
* IdpcBalanceDepleted
*
* Balance on key has been depleted
*/
export declare class IdpcBalanceDepletedError extends IdpcRequestFailedError {
}
/**
* IdpcLimitReachedError
*
* Limit reached. One of your lookup limits has been breached for today. This
* could either be your total daily limit on your key or the individual IP
* limit. You can either wait for for the limit to reset (after a day) or
* manually disable or increase your limit.
*/
export declare class IdpcLimitReachedError extends IdpcRequestFailedError {
}
/**
* IdpcResourceNotFoundError

@@ -89,0 +117,0 @@ *

@@ -35,6 +35,7 @@ "use strict";

_this.__proto__ = trueProto;
var message = options.message, httpStatus = options.httpStatus;
var message = options.message, httpStatus = options.httpStatus, _a = options.metadata, metadata = _a === void 0 ? {} : _a;
_this.message = message;
_this.name = "Ideal Postcodes Error";
_this.httpStatus = httpStatus;
_this.metadata = metadata;
if (Error.captureStackTrace) {

@@ -137,2 +138,31 @@ Error.captureStackTrace(_this, IdealPostcodesError);

/**
* IdpcBalanceDepleted
*
* Balance on key has been depleted
*/
var IdpcBalanceDepletedError = /** @class */ (function (_super) {
__extends(IdpcBalanceDepletedError, _super);
function IdpcBalanceDepletedError() {
return _super !== null && _super.apply(this, arguments) || this;
}
return IdpcBalanceDepletedError;
}(IdpcRequestFailedError));
exports.IdpcBalanceDepletedError = IdpcBalanceDepletedError;
/**
* IdpcLimitReachedError
*
* Limit reached. One of your lookup limits has been breached for today. This
* could either be your total daily limit on your key or the individual IP
* limit. You can either wait for for the limit to reset (after a day) or
* manually disable or increase your limit.
*/
var IdpcLimitReachedError = /** @class */ (function (_super) {
__extends(IdpcLimitReachedError, _super);
function IdpcLimitReachedError() {
return _super !== null && _super.apply(this, arguments) || this;
}
return IdpcLimitReachedError;
}(IdpcRequestFailedError));
exports.IdpcLimitReachedError = IdpcLimitReachedError;
/**
* IdpcResourceNotFoundError

@@ -231,2 +261,4 @@ *

var PAYMENT_REQUIRED = 402;
var BALANCE_DEPLETED = 4020;
var LIMIT_REACHED = 4021;
// 404 Responses

@@ -287,2 +319,6 @@ var NOT_FOUND = 404;

return new IdpcUmprnNotFoundError(response);
if (code === BALANCE_DEPLETED)
return new IdpcBalanceDepletedError(response);
if (code === LIMIT_REACHED)
return new IdpcLimitReachedError(response);
// If no API errors of interest detected, fall back to http status code

@@ -289,0 +325,0 @@ if (httpStatus === NOT_FOUND)

{
"name": "@ideal-postcodes/core-interface",
"version": "1.2.0",
"version": "1.3.0",
"description": "Interface specification for javascript based API Clients to api.ideal-postcodes.co.uk",

@@ -114,3 +114,3 @@ "author": {

"nyc": "~14.1.1",
"prettier": "~1.17.1",
"prettier": "~1.18.0",
"puppeteer": "~1.17.0",

@@ -117,0 +117,0 @@ "semantic-release": "~15.13.12",

@@ -61,6 +61,6 @@ <h1 align="center">

```javascript
const client = new Client({
api_key: "iddqd",
});
import { Client } from "@ideal-postcodes/core-<package-type>";
const client = new Client({ api_key: "iddqd" });
// Only api_key is required by core-node and core-browser - all others are optional

@@ -70,3 +70,3 @@ // The agentless interface requires explicit configuration

More configuration options [outlined in the docs](https://core-interface.ideal-postcodes.dev/interfaces/config.html)
[Configuration options](https://core-interface.ideal-postcodes.dev/interfaces/config.html)

@@ -102,3 +102,3 @@ ---

Method options [outlined in the docs](https://core-interface.ideal-postcodes.dev/interfaces/lookuppostcodeoptions.html)
[Method options](https://core-interface.ideal-postcodes.dev/interfaces/lookuppostcodeoptions.html)

@@ -122,3 +122,3 @@ #### Search for an Address

Method options [outlined in the docs](https://core-interface.ideal-postcodes.dev/interfaces/lookupaddressoptions.html)
[Method options](https://core-interface.ideal-postcodes.dev/interfaces/lookupaddressoptions.html)

@@ -144,3 +144,3 @@ #### Search for an Address by UDPRN

Method options [outlined in the docs](https://core-interface.ideal-postcodes.dev/interfaces/lookupudprnoptions.html)
[Method options](https://core-interface.ideal-postcodes.dev/interfaces/lookupudprnoptions.html)

@@ -166,3 +166,3 @@ #### Search for an Address by UMPRN

Method options [outlined in the docs](https://core-interface.ideal-postcodes.dev/interfaces/lookupumprnoptions.html)
[Method options](https://core-interface.ideal-postcodes.dev/interfaces/lookupumprnoptions.html)

@@ -179,3 +179,4 @@ #### Check Key Usability

Method options [outlined in the docs](https://core-interface.ideal-postcodes.dev/interfaces/checkkeyusabilityoptions.html)
[Method options](https://core-interface.ideal-postcodes.dev/interfaces/checkkeyusabilityoptions.html)
---

@@ -477,2 +478,4 @@

|- IdpcRequestFailedError # 402 Errors
| |- IdpcBalanceDepletedError
| |- IdpcLimitReachedError
|

@@ -479,0 +482,0 @@ |- IdpcResourceNotFoundError # 404 Errors

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc