Socket
Socket
Sign inDemoInstall

@ideal-postcodes/address-finder

Package Overview
Dependencies
4
Maintainers
3
Versions
54
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.4.0 to 5.0.0-beta.1

dist/client.d.ts

24

dist/cache.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApiCache = void 0;
const core_axios_1 = require("@ideal-postcodes/core-axios");
const client_1 = require("./client");
/**

@@ -36,12 +36,10 @@ * @hidden

return Promise.resolve(cachedValue);
const p = core_axios_1.autocomplete
.list(this.client, {
const p = (0, client_1.autocomplete)(this.client, {
query: {
query,
api_key: this.client.config.api_key,
api_key: this.client.api_key,
...options,
},
})
.then((response) => {
const suggestions = response.body.result.hits;
}).then((body) => {
const suggestions = body.result.hits;
this.store(query, suggestions);

@@ -59,16 +57,8 @@ return suggestions;

usaResolve(suggestion) {
return core_axios_1.autocomplete
.usa(this.client, suggestion.id, {
query: { api_key: this.client.config.api_key },
})
.then((response) => response.body.result);
return (0, client_1.usa)(this.client, {}, suggestion);
}
gbrResolve(suggestion) {
return core_axios_1.autocomplete
.gbr(this.client, suggestion.id, {
query: { api_key: this.client.config.api_key },
})
.then((response) => response.body.result);
return (0, client_1.gbr)(this.client, {}, suggestion);
}
}
exports.ApiCache = ApiCache;

@@ -10,4 +10,3 @@ /**

import { AddressSuggestion, AnyAddress } from "@ideal-postcodes/jsutil";
import { Client } from "@ideal-postcodes/core-axios";
import { Config } from "@ideal-postcodes/core-axios/dist/client";
import { Client, Config } from "./client";
import { ViewService, CloseReason } from "./state";

@@ -14,0 +13,0 @@ import { SelectorNode, CSSStyle, OutputFields, NamedFields, IdGen } from "@ideal-postcodes/jsutil";

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

const css_1 = require("./css");
const core_axios_1 = require("@ideal-postcodes/core-axios");
const client_1 = require("./client");
const fsm_1 = require("@xstate/fsm");

@@ -152,3 +152,3 @@ const state_1 = require("./state");

this.updateContexts(this.options.contexts);
this.client = new core_axios_1.Client({ ...this.options, api_key: this.options.apiKey });
this.client = (0, client_1.newClient)({ ...this.options, api_key: this.options.apiKey });
this.cache = new cache_1.ApiCache(this.client);

@@ -326,3 +326,3 @@ this.retrieveSuggestions = (0, debounce_1.default)((event) => {

}
(0, core_axios_1.checkKeyUsability)({ client: this.client, api_key: this.options.apiKey })
(0, client_1.checkKeyUsability)(this.client)
.then((response) => {

@@ -329,0 +329,0 @@ if (!response.available)

@@ -10,3 +10,3 @@ /**

setup: (config: import("./controller").ControllerOptions) => Controller;
controllers: Controller[];
controllers: WeakMap<HTMLElement, Controller>;
Controller: typeof Controller;

@@ -13,0 +13,0 @@ defaults: Omit<import("./controller").StoredOptions, "document" | "scope">;

@@ -17,2 +17,2 @@ import { Controller, ControllerOptions } from "./controller";

*/
export declare const controllers: Controller[];
export declare const controllers: WeakMap<HTMLElement, Controller>;

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

const c = new controller_1.Controller(config);
exports.controllers.push(c);
exports.controllers.set(c.input, c);
return c;

@@ -32,2 +32,2 @@ };

*/
exports.controllers = [];
exports.controllers = new WeakMap();
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.watch = void 0;
const core_axios_1 = require("@ideal-postcodes/core-axios");
const client_1 = require("./client");
const controller_1 = require("./controller");

@@ -29,7 +29,7 @@ const contexts_1 = require("./contexts");

const watch = (config, options = {}) => {
const client = new core_axios_1.Client({ api_key: config.apiKey });
const client = (0, client_1.newClient)({ api_key: config.apiKey });
const { pageTest = isTrue } = options;
if (!pageTest())
return Promise.resolve(null);
return (0, core_axios_1.checkKeyUsability)({ client })
return (0, client_1.checkKeyUsability)(client)
.then((key) => {

@@ -36,0 +36,0 @@ if (!key.available)

@@ -1,2 +0,2 @@

import { autocomplete } from "@ideal-postcodes/core-axios";
import { autocomplete, usa, gbr } from "./client";
/**

@@ -33,12 +33,10 @@ * @hidden

return Promise.resolve(cachedValue);
const p = autocomplete
.list(this.client, {
const p = autocomplete(this.client, {
query: {
query,
api_key: this.client.config.api_key,
api_key: this.client.api_key,
...options,
},
})
.then((response) => {
const suggestions = response.body.result.hits;
}).then((body) => {
const suggestions = body.result.hits;
this.store(query, suggestions);

@@ -56,15 +54,7 @@ return suggestions;

usaResolve(suggestion) {
return autocomplete
.usa(this.client, suggestion.id, {
query: { api_key: this.client.config.api_key },
})
.then((response) => response.body.result);
return usa(this.client, {}, suggestion);
}
gbrResolve(suggestion) {
return autocomplete
.gbr(this.client, suggestion.id, {
query: { api_key: this.client.config.api_key },
})
.then((response) => response.body.result);
return gbr(this.client, {}, suggestion);
}
}

@@ -10,4 +10,3 @@ /**

import { AddressSuggestion, AnyAddress } from "@ideal-postcodes/jsutil";
import { Client } from "@ideal-postcodes/core-axios";
import { Config } from "@ideal-postcodes/core-axios/dist/client";
import { Client, Config } from "./client";
import { ViewService, CloseReason } from "./state";

@@ -14,0 +13,0 @@ import { SelectorNode, CSSStyle, OutputFields, NamedFields, IdGen } from "@ideal-postcodes/jsutil";

@@ -10,3 +10,3 @@ /**

import { addStyle, computeOffset } from "./css";
import { Client, checkKeyUsability } from "@ideal-postcodes/core-axios";
import { checkKeyUsability, newClient } from "./client";
import { InterpreterStatus } from "@xstate/fsm";

@@ -145,3 +145,3 @@ import { create } from "./state";

this.updateContexts(this.options.contexts);
this.client = new Client({ ...this.options, api_key: this.options.apiKey });
this.client = newClient({ ...this.options, api_key: this.options.apiKey });
this.cache = new ApiCache(this.client);

@@ -319,3 +319,3 @@ this.retrieveSuggestions = debounce((event) => {

}
checkKeyUsability({ client: this.client, api_key: this.options.apiKey })
checkKeyUsability(this.client)
.then((response) => {

@@ -322,0 +322,0 @@ if (!response.available)

@@ -10,3 +10,3 @@ /**

setup: (config: import("./controller").ControllerOptions) => Controller;
controllers: Controller[];
controllers: WeakMap<HTMLElement, Controller>;
Controller: typeof Controller;

@@ -13,0 +13,0 @@ defaults: Omit<import("./controller").StoredOptions, "document" | "scope">;

@@ -17,2 +17,2 @@ import { Controller, ControllerOptions } from "./controller";

*/
export declare const controllers: Controller[];
export declare const controllers: WeakMap<HTMLElement, Controller>;

@@ -9,3 +9,3 @@ import { Controller } from "./controller";

const c = new Controller(config);
controllers.push(c);
controllers.set(c.input, c);
return c;

@@ -27,2 +27,2 @@ };

*/
export const controllers = [];
export const controllers = new WeakMap();

@@ -1,2 +0,2 @@

import { Client, checkKeyUsability } from "@ideal-postcodes/core-axios";
import { newClient, checkKeyUsability } from "./client";
import { NOOP } from "./controller";

@@ -26,7 +26,7 @@ import { toContextMap } from "./contexts";

export const watch = (config, options = {}) => {
const client = new Client({ api_key: config.apiKey });
const client = newClient({ api_key: config.apiKey });
const { pageTest = isTrue } = options;
if (!pageTest())
return Promise.resolve(null);
return checkKeyUsability({ client })
return checkKeyUsability(client)
.then((key) => {

@@ -33,0 +33,0 @@ if (!key.available)

{
"name": "@ideal-postcodes/address-finder",
"version": "4.4.0",
"version": "5.0.0-beta.1",
"description": "Address Finder JS library backed by the Ideal Postcodes UK address search API",

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

"engines": {
"node": ">=16.0"
"node": ">=18.0"
},

@@ -48,4 +48,2 @@ "author": {

"test:open": "cypress open --e2e -C ./cypress.config.unit.ts",
"test:browsers:latest": "karma start .config/latest.conf.ts",
"test:browsers:legacy": "karma start .config/legacy.conf.ts",
"test:e2e": "rollup -c && cypress run --e2e -C ./cypress.config.e2e.ts",

@@ -57,3 +55,2 @@ "test:e2e:open": "rollup -c && cypress open --e2e -C ./cypress.config.e2e.ts",

"semantic-release": "semantic-release --no-ci",
"coverage": "codecov",
"css": "minify css/address-finder.css > css/address-finder.min.css && minify css/optional.css > css/optional.min.css",

@@ -68,34 +65,2 @@ "docs": "typedoc",

],
"mocha": {
"extension": [
"ts"
],
"exit": true,
"fullTrace": true,
"require": [
"ts-node/register",
"source-map-support/register"
]
},
"nyc": {
"include": [
"lib/**/*.ts"
],
"exclude": [
"dist/*",
"**/*.d.ts"
],
"extension": [
".ts",
".tsx"
],
"require": [
"ts-node/register"
],
"reporter": [
"text-summary",
"html"
],
"all": true
},
"keywords": [

@@ -105,8 +70,6 @@ "UK",

"Autocomplete",
"Ideal",
"Postcodes"
"Ideal Postcodes"
],
"license": "SEE LICENSE IN LICENSE",
"dependencies": {
"@ideal-postcodes/core-axios": "4.1.0",
"@ideal-postcodes/jsutil": "6.2.0",

@@ -124,18 +87,9 @@ "@xstate/fsm": "~2.1.0",

"@cablanchard/tsconfig": "~2.0.0",
"@ideal-postcodes/api-fixtures": "~1.3.0",
"@ideal-postcodes/openapi": "3.1.0",
"@ideal-postcodes/supported-browsers": "~2.5.0",
"@ideal-postcodes/openapi": "4.1.1",
"@rollup/plugin-commonjs": "~21.0.0",
"@rollup/plugin-inject": "~4.0.2",
"@rollup/plugin-node-resolve": "~13.0.0",
"@types/chai": "~4.2.14",
"@types/dotenv": "~8.2.0",
"@types/karma": "~6.3.0",
"@types/lodash": "~4.14.195",
"@types/mocha": "~9.0.0",
"@types/node": "~20.4.2",
"@types/sinon": "~10.0.15",
"rollup-plugin-ts": "~3.2.0",
"chai": "~4.3.0",
"codecov": "~3.8.1",
"core-js": "~3.15.2",

@@ -146,6 +100,6 @@ "core-js-pure": "~3.17.2",

"minify": "~7.0.0",
"mocha": "~9.1.1",
"prettier": "~2.4.1",
"promise-polyfill": "~8.2.0",
"rollup": "~2.70.0",
"rollup-plugin-ts": "~3.2.0",
"semantic-release": "~19.0.3",

@@ -152,0 +106,0 @@ "sinon": "~15.2.0",

@@ -7,3 +7,2 @@ <h1 align="center">

[![codecov](https://codecov.io/gh/ideal-postcodes/address-finder/branch/main/graph/badge.svg?token=WWZ31TM1M7)](https://codecov.io/gh/ideal-postcodes/address-finder)
[![npm version](https://badge.fury.io/js/%40ideal-postcodes%2Faddress-finder.svg)](https://badge.fury.io/js/%40ideal-postcodes%2Faddress-finder)

@@ -10,0 +9,0 @@ ![npm bundle size (scoped)](https://img.shields.io/bundlephobia/minzip/@ideal-postcodes/address-finder.svg?color=%234c1&style=popout)

import commonjs from "@rollup/plugin-commonjs";
import resolve from "@rollup/plugin-node-resolve";
import ts from "rollup-plugin-ts";
import inject from "@rollup/plugin-inject";
import { dependencies } from "./package.json";

@@ -14,8 +13,2 @@

export const polyfills = {
Promise: "promise-polyfill",
Set: "core-js-pure/features/set",
"Object.assign": "core-js-pure/features/object/assign",
};
export default [

@@ -38,3 +31,2 @@ {

commonjs(),
inject(polyfills),
ts({

@@ -41,0 +33,0 @@ transpiler: "babel",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc