Socket
Socket
Sign inDemoInstall

@ideal-postcodes/address-finder

Package Overview
Dependencies
Maintainers
2
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ideal-postcodes/address-finder - npm Package Compare versions

Comparing version 2.3.4 to 2.4.0

7

CHANGELOG.md

@@ -0,1 +1,8 @@

# [2.4.0](https://github.com/ideal-postcodes/address-finder/compare/2.3.4...2.4.0) (2021-08-30)
### Features
* **Search Config:** Apply custom search config ([66a0907](https://github.com/ideal-postcodes/address-finder/commit/66a0907b6b745b67aaae65067516f51375d8c2a6))
## [2.3.4](https://github.com/ideal-postcodes/address-finder/compare/2.3.3...2.3.4) (2021-07-28)

@@ -2,0 +9,0 @@

3

dist/cache.d.ts
import { Client } from "@ideal-postcodes/core-axios";
import { AddressSuggestion, Address } from "@ideal-postcodes/api-typings";
export declare type QueryOptions = Record<string, string>;
/**

@@ -24,5 +25,5 @@ * @hidden

*/
query(query: string): Promise<AddressSuggestion[]>;
query(query: string, options?: QueryOptions): Promise<AddressSuggestion[]>;
resolve(suggestion: AddressSuggestion): Promise<Address | null>;
}
export {};

@@ -32,3 +32,3 @@ "use strict";

*/
query(query) {
query(query, options = {}) {
const cachedValue = this.retrieve(query);

@@ -39,3 +39,7 @@ if (cachedValue)

.list(this.client, {
query: { query, api_key: this.client.config.api_key },
query: {
query,
api_key: this.client.config.api_key,
...options,
},
})

@@ -42,0 +46,0 @@ .then((response) => {

@@ -5,3 +5,3 @@ /**

import { View } from "./view";
import { ApiCache } from "./cache";
import { ApiCache, QueryOptions } from "./cache";
import { AddressSuggestion, Address } from "@ideal-postcodes/api-typings";

@@ -104,2 +104,9 @@ import { ControllerOptions } from "./index";

populateAddress(address: Address): void;
/**
* Applies new query options to search. This process clears the existing
* cache to prevent stale searches
*
* @public
*/
setQueryOptions(options: QueryOptions): void;
}

@@ -44,2 +44,3 @@ "use strict";

populateOrganisation: true,
queryOptions: {},
// Messages

@@ -190,3 +191,3 @@ msgFallback: "Please enter your address manually",

return self.cache
.query(query)
.query(query, self.options.queryOptions)
.then((suggestions) => {

@@ -247,3 +248,13 @@ self.options.onSuggestionsRetrieved.call(self, suggestions);

}
/**
* Applies new query options to search. This process clears the existing
* cache to prevent stale searches
*
* @public
*/
setQueryOptions(options) {
this.cache.clear();
this.options.queryOptions = options;
}
}
exports.Controller = Controller;

@@ -8,2 +8,3 @@ /**

import { Controller, defaults } from "./controller";
import { QueryOptions } from "./cache";
import { SelectorNode, OutputFields, NamedFields } from "@ideal-postcodes/jsutil";

@@ -126,2 +127,6 @@ import { View, ViewOptions, OnOpen, OnBlur, OnClose, OnFocus, OnInput, OnSelect, OnUnhide } from "./view";

/**
* Optional configuration object to apply to address queries
*/
queryOptions?: QueryOptions;
/**
* Sets the `autocomplete=` attribute of the input element. Setting this attribute aims to prevent some browsers (particularly Chrome) from providing a clashing autofill overlay.

@@ -128,0 +133,0 @@ *

import { Client } from "@ideal-postcodes/core-axios";
import { AddressSuggestion, Address } from "@ideal-postcodes/api-typings";
export declare type QueryOptions = Record<string, string>;
/**

@@ -24,5 +25,5 @@ * @hidden

*/
query(query: string): Promise<AddressSuggestion[]>;
query(query: string, options?: QueryOptions): Promise<AddressSuggestion[]>;
resolve(suggestion: AddressSuggestion): Promise<Address | null>;
}
export {};

@@ -29,3 +29,3 @@ import { autocomplete, lookupUdprn, lookupUmprn, } from "@ideal-postcodes/core-axios";

*/
query(query) {
query(query, options = {}) {
const cachedValue = this.retrieve(query);

@@ -36,3 +36,7 @@ if (cachedValue)

.list(this.client, {
query: { query, api_key: this.client.config.api_key },
query: {
query,
api_key: this.client.config.api_key,
...options,
},
})

@@ -39,0 +43,0 @@ .then((response) => {

@@ -5,3 +5,3 @@ /**

import { View } from "./view";
import { ApiCache } from "./cache";
import { ApiCache, QueryOptions } from "./cache";
import { AddressSuggestion, Address } from "@ideal-postcodes/api-typings";

@@ -104,2 +104,9 @@ import { ControllerOptions } from "./index";

populateAddress(address: Address): void;
/**
* Applies new query options to search. This process clears the existing
* cache to prevent stale searches
*
* @public
*/
setQueryOptions(options: QueryOptions): void;
}

@@ -37,2 +37,3 @@ /**

populateOrganisation: true,
queryOptions: {},
// Messages

@@ -183,3 +184,3 @@ msgFallback: "Please enter your address manually",

return self.cache
.query(query)
.query(query, self.options.queryOptions)
.then((suggestions) => {

@@ -240,2 +241,12 @@ self.options.onSuggestionsRetrieved.call(self, suggestions);

}
/**
* Applies new query options to search. This process clears the existing
* cache to prevent stale searches
*
* @public
*/
setQueryOptions(options) {
this.cache.clear();
this.options.queryOptions = options;
}
}

@@ -8,2 +8,3 @@ /**

import { Controller, defaults } from "./controller";
import { QueryOptions } from "./cache";
import { SelectorNode, OutputFields, NamedFields } from "@ideal-postcodes/jsutil";

@@ -126,2 +127,6 @@ import { View, ViewOptions, OnOpen, OnBlur, OnClose, OnFocus, OnInput, OnSelect, OnUnhide } from "./view";

/**
* Optional configuration object to apply to address queries
*/
queryOptions?: QueryOptions;
/**
* Sets the `autocomplete=` attribute of the input element. Setting this attribute aims to prevent some browsers (particularly Chrome) from providing a clashing autofill overlay.

@@ -128,0 +133,0 @@ *

{
"name": "@ideal-postcodes/address-finder",
"version": "2.3.4",
"version": "2.4.0",
"description": "Address Finder JS library backed by the Ideal Postcodes UK address search API",

@@ -109,3 +109,3 @@ "main": "dist/index.js",

"@babel/plugin-proposal-class-properties": "~7.14.5",
"@babel/preset-env": "~7.14.7",
"@babel/preset-env": "~7.15.0",
"@cablanchard/eslint-config": "~2.1.0",

@@ -118,3 +118,3 @@ "@cablanchard/semantic-release": "~1.3.4",

"@ideal-postcodes/supported-browsers": "~2.5.0",
"@rollup/plugin-commonjs": "~18.0.0",
"@rollup/plugin-commonjs": "~20.0.0",
"@rollup/plugin-inject": "~4.0.2",

@@ -126,4 +126,4 @@ "@rollup/plugin-node-resolve": "~13.0.0",

"@types/lodash": "~4.14.168",
"@types/mocha": "~8.2.0",
"@types/node": "~14.14.16",
"@types/mocha": "~9.0.0",
"@types/node": "~16.6.1",
"@types/sinon": "~9.0.10",

@@ -135,7 +135,7 @@ "@typescript-eslint/eslint-plugin": "~4.28.4",

"core-js": "~3.15.2",
"core-js-pure": "~3.15.2",
"core-js-pure": "~3.16.1",
"cypress": "~7.7.0",
"dotenv": "~8.2.0",
"eslint": "~7.30.0",
"eslint-plugin-compat": "~3.9.0",
"eslint-plugin-compat": "~3.12.0",
"karma": "~6.3.2",

@@ -154,6 +154,6 @@ "karma-chrome-launcher": "~3.1.0",

"puppeteer": "~9.0.0",
"rollup": "~2.45.1",
"rollup": "~2.56.2",
"semantic-release": "~17.4.1",
"sinon": "~10.0.0",
"ts-node": "~9.1.1",
"ts-node": "~10.2.0",
"typedoc": "~0.20.30",

@@ -160,0 +160,0 @@ "typescript": "~4.2.3"

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

- [msgFallback](interfaces/address_finder_exports.controlleroptions.html#msgfallback)
- [msgInitial](interfaces/address_finder_exports.controlleroptions.html#msginitial)
- [msgNoMatch](interfaces/address_finder_exports.controlleroptions.html#msgnomatch)
- [msgUnhide](interfaces/address_finder_exports.controlleroptions.html#msgunhide)
- [msgFallback](- [msgList](https://address-finder.ideal-postcodes.dev/interfaces/address_finder_exports.controlleroptions.html#msgfallback)
- [msgInitial](https://address-finder.ideal-postcodes.dev/interfaces/address_finder_exports.controlleroptions.html#msginitial)
- [msgNoMatch](https://address-finder.ideal-postcodes.dev/interfaces/address_finder_exports.controlleroptions.html#msgnomatch)
- [msgUnhide](https://address-finder.ideal-postcodes.dev/interfaces/address_finder_exports.controlleroptions.html#msgunhide)

@@ -240,2 +240,10 @@ ### Setup Options

#### [`queryOptions`](interfaces/address_finder_exports.controlleroptions.html#queryoptions)
Apply a query, like a filter or bias, to your suggestion queries. A complete list of query parameters are available in the [Autocomplete API Reference](https://openapi.ideal-postcodes.dev/#operation/AddressAutocomplete).
To apply new parameters after the Controller has been instantiated, use [`setQueryOptions`](classes/controller.controller-1.html#setqueryoptions). Do not mutate `options.queryOptions` directly.
Defaults to `{}`.
#### [`removeOrganisation`](interfaces/address_finder_exports.controlleroptions.html#removeorganisation)

@@ -242,0 +250,0 @@

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