@defra/forms-engine-plugin 4.14.3 → 4.15.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/.public/assets-manifest.json +10 -1
- package/.public/javascripts/im-search-plugin.min.js +2 -0
- package/.public/javascripts/im-search-plugin.min.js.map +1 -0
- package/.public/javascripts/shared.min.js +1 -1
- package/.public/javascripts/shared.min.js.map +1 -1
- package/.public/javascripts/vendor/@defra.min.js +2 -0
- package/.public/javascripts/vendor/@defra.min.js.map +1 -0
- package/.public/javascripts/vendor/maplibre-gl.min.js +3 -0
- package/.public/javascripts/vendor/maplibre-gl.min.js.LICENSE.txt +4 -0
- package/.public/javascripts/vendor/maplibre-gl.min.js.map +1 -0
- package/.public/javascripts/vendor/preact.min.js +2 -0
- package/.public/javascripts/vendor/preact.min.js.map +1 -0
- package/.public/stylesheets/application.min.css +1 -1
- package/.public/stylesheets/application.min.css.map +1 -1
- package/.server/client/javascripts/geospatial-map.js +9 -4
- package/.server/client/javascripts/geospatial-map.js.map +1 -1
- package/.server/client/javascripts/map.js +18 -12
- package/.server/client/javascripts/map.js.map +1 -1
- package/.server/client/stylesheets/shared.scss +7 -0
- package/.server/server/plugins/engine/components/TelephoneNumberField.js +2 -4
- package/.server/server/plugins/engine/components/TelephoneNumberField.js.map +1 -1
- package/.server/server/plugins/engine/components/helpers/telephone.d.ts +0 -4
- package/.server/server/plugins/engine/components/helpers/telephone.js +6 -20
- package/.server/server/plugins/engine/components/helpers/telephone.js.map +1 -1
- package/.server/server/plugins/engine/components/helpers/telephone.test.js +5 -5
- package/.server/server/plugins/engine/components/helpers/telephone.test.js.map +1 -1
- package/.server/server/plugins/map/routes/index.d.ts +1 -2
- package/.server/server/plugins/map/routes/index.js +2 -32
- package/.server/server/plugins/map/routes/index.js.map +1 -1
- package/.server/server/plugins/map/service.d.ts +0 -7
- package/.server/server/plugins/map/service.js +0 -12
- package/.server/server/plugins/map/service.js.map +1 -1
- package/.server/server/plugins/map/service.test.js +0 -43
- package/.server/server/plugins/map/service.test.js.map +1 -1
- package/package.json +2 -1
- package/src/client/javascripts/geospatial-map.js +9 -5
- package/src/client/javascripts/map.js +18 -13
- package/src/client/stylesheets/shared.scss +7 -0
- package/src/server/plugins/engine/components/TelephoneNumberField.ts +1 -5
- package/src/server/plugins/engine/components/helpers/telephone.ts +11 -35
- package/src/server/plugins/map/routes/index.js +1 -37
- package/src/server/plugins/map/service.js +0 -13
- package/.server/server/plugins/map/test/__stubs__/nearest.d.ts +0 -37
- package/.server/server/plugins/map/test/__stubs__/nearest.js +0 -38
- package/.server/server/plugins/map/test/__stubs__/nearest.js.map +0 -1
- package/src/server/plugins/map/test/__stubs__/nearest.js +0 -46
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
// @ts-expect-error - no types
|
|
2
|
+
import InteractiveMap from '@defra/interactive-map'
|
|
3
|
+
// @ts-expect-error - no types
|
|
4
|
+
import createInteractPlugin from '@defra/interactive-map/plugins/interact'
|
|
5
|
+
// @ts-expect-error - no types
|
|
6
|
+
import createMapStylesPlugin from '@defra/interactive-map/plugins/map-styles'
|
|
7
|
+
// @ts-expect-error - no types
|
|
8
|
+
import createScaleBarPlugin from '@defra/interactive-map/plugins/scale-bar'
|
|
9
|
+
// @ts-expect-error - no types
|
|
10
|
+
import createSearchPlugin from '@defra/interactive-map/plugins/search'
|
|
11
|
+
// @ts-expect-error - no types
|
|
12
|
+
import maplibreProvider from '@defra/interactive-map/providers/maplibre'
|
|
1
13
|
import { centroid } from '@turf/centroid'
|
|
2
14
|
// @ts-expect-error - no types
|
|
3
15
|
import OsGridRef, { LatLon } from 'geodesy/osgridref.js'
|
|
@@ -249,24 +261,17 @@ export function makeTileRequestTransformer(apiPath) {
|
|
|
249
261
|
export function createMap(mapId, initConfig, mapsConfig) {
|
|
250
262
|
const { assetPath, apiPath, data = defaultData } = mapsConfig
|
|
251
263
|
const logoAltText = 'Ordnance survey logo'
|
|
252
|
-
|
|
253
|
-
// @ts-expect-error - Defra namespace currently comes from UMD support files
|
|
254
|
-
const defra = window.defra
|
|
255
|
-
|
|
256
|
-
const interactPlugin = defra.interactPlugin({
|
|
264
|
+
const interactPlugin = createInteractPlugin({
|
|
257
265
|
markerColor: { outdoor: '#ff0000', dark: '#00ff00' },
|
|
258
266
|
interactionModes: ['placeMarker'],
|
|
259
267
|
multiSelect: false
|
|
260
268
|
})
|
|
261
269
|
|
|
262
270
|
/** @type {InteractiveMap} */
|
|
263
|
-
const map = new
|
|
271
|
+
const map = new InteractiveMap(mapId, {
|
|
264
272
|
enableFullscreen: true,
|
|
265
273
|
autoColorScheme: false,
|
|
266
|
-
mapProvider:
|
|
267
|
-
reverseGeocodeProvider: defra.openNamesProvider({
|
|
268
|
-
url: `${apiPath}/reverse-geocode-proxy?easting={easting}&northing={northing}`
|
|
269
|
-
}),
|
|
274
|
+
mapProvider: maplibreProvider(),
|
|
270
275
|
behaviour: 'inline',
|
|
271
276
|
minZoom: 6,
|
|
272
277
|
maxZoom: 18,
|
|
@@ -275,7 +280,7 @@ export function createMap(mapId, initConfig, mapsConfig) {
|
|
|
275
280
|
transformRequest: makeTileRequestTransformer(apiPath),
|
|
276
281
|
...initConfig,
|
|
277
282
|
plugins: [
|
|
278
|
-
|
|
283
|
+
createMapStylesPlugin({
|
|
279
284
|
mapStyles: [
|
|
280
285
|
{
|
|
281
286
|
id: 'outdoor',
|
|
@@ -319,12 +324,12 @@ export function createMap(mapId, initConfig, mapsConfig) {
|
|
|
319
324
|
]
|
|
320
325
|
}),
|
|
321
326
|
interactPlugin,
|
|
322
|
-
|
|
327
|
+
createSearchPlugin({
|
|
323
328
|
osNamesURL: `${apiPath}/geocode-proxy?query={query}`,
|
|
324
329
|
width: '300px',
|
|
325
330
|
showMarker: false
|
|
326
331
|
}),
|
|
327
|
-
|
|
332
|
+
createScaleBarPlugin({
|
|
328
333
|
units: 'metric'
|
|
329
334
|
}),
|
|
330
335
|
...(initConfig.plugins ?? [])
|
|
@@ -4,6 +4,13 @@
|
|
|
4
4
|
@use "summary-list";
|
|
5
5
|
@use "location-fields";
|
|
6
6
|
|
|
7
|
+
@use "@defra/interactive-map/css" as core;
|
|
8
|
+
@use "@defra/interactive-map/plugins/interact/css" as interact;
|
|
9
|
+
@use "@defra/interactive-map/plugins/map-styles/css" as mapStyles;
|
|
10
|
+
@use "@defra/interactive-map/plugins/search/css" as search;
|
|
11
|
+
@use "@defra/interactive-map/plugins/scale-bar/css" as scaleBar;
|
|
12
|
+
@use "@defra/interactive-map/plugins/draw-ml/css" as drawMl;
|
|
13
|
+
|
|
7
14
|
// Use default GDS Transport font for autocomplete
|
|
8
15
|
.autocomplete__hint,
|
|
9
16
|
.autocomplete__input,
|
|
@@ -4,9 +4,7 @@ import { type StringSchema } from 'joi'
|
|
|
4
4
|
import { FormComponent } from './FormComponent.js'
|
|
5
5
|
import { addClassOptionIfNone } from './helpers/index.js'
|
|
6
6
|
import {
|
|
7
|
-
INTERNATIONAL_ERROR_CODE,
|
|
8
7
|
INVALID_ERROR_CODE,
|
|
9
|
-
UK_ERROR_CODE,
|
|
10
8
|
joi
|
|
11
9
|
} from './helpers/telephone.js'
|
|
12
10
|
import { messageTemplate } from '../pageControllers/validationOptions.js'
|
|
@@ -48,9 +46,7 @@ export class TelephoneNumberField extends FormComponent {
|
|
|
48
46
|
'any.required': message,
|
|
49
47
|
'string.empty': message,
|
|
50
48
|
'string.pattern.base': message,
|
|
51
|
-
[INVALID_ERROR_CODE]: message
|
|
52
|
-
[UK_ERROR_CODE]: message,
|
|
53
|
-
[INTERNATIONAL_ERROR_CODE]: message
|
|
49
|
+
[INVALID_ERROR_CODE]: message
|
|
54
50
|
})
|
|
55
51
|
} else if (options.customValidationMessages) {
|
|
56
52
|
formSchema = formSchema.messages(options.customValidationMessages)
|
|
@@ -1,47 +1,24 @@
|
|
|
1
1
|
import { TelephoneNumberFieldOptionsFormatEnum } from '@defra/forms-model'
|
|
2
2
|
import LibPhoneNumber from 'google-libphonenumber'
|
|
3
|
-
import JoiBase, { type
|
|
3
|
+
import JoiBase, { type LanguageMessages } from 'joi'
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { messageTemplate } from '../../pageControllers/validationOptions.js'
|
|
6
6
|
|
|
7
7
|
const phoneUtil = LibPhoneNumber.PhoneNumberUtil.getInstance()
|
|
8
8
|
|
|
9
9
|
export const COUNTRY = 'GB'
|
|
10
10
|
export const INVALID_ERROR_CODE = 'phoneNumber.invalid'
|
|
11
|
-
export const UK_ERROR_CODE = 'phoneNumber.uk'
|
|
12
|
-
export const INTERNATIONAL_ERROR_CODE = 'phoneNumber.international'
|
|
13
11
|
|
|
14
12
|
export const isUKNumber = (value: LibPhoneNumber.PhoneNumber) => {
|
|
15
13
|
return phoneUtil.isValidNumberForRegion(value, COUNTRY)
|
|
16
14
|
}
|
|
17
15
|
|
|
18
|
-
export function getErrorCode(format?: TelephoneNumberFieldOptionsFormatEnum) {
|
|
19
|
-
if (format === TelephoneNumberFieldOptionsFormatEnum.UK) {
|
|
20
|
-
return UK_ERROR_CODE
|
|
21
|
-
} else if (format === TelephoneNumberFieldOptionsFormatEnum.International) {
|
|
22
|
-
return INTERNATIONAL_ERROR_CODE
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return INVALID_ERROR_CODE
|
|
26
|
-
}
|
|
27
|
-
|
|
28
16
|
export const joi = JoiBase.extend({
|
|
29
17
|
type: 'string',
|
|
30
18
|
base: JoiBase.string(),
|
|
31
19
|
messages: {
|
|
32
|
-
[INVALID_ERROR_CODE]:
|
|
33
|
-
|
|
34
|
-
opts
|
|
35
|
-
) as JoiExpression,
|
|
36
|
-
[UK_ERROR_CODE]: JoiBase.expression(
|
|
37
|
-
'Enter {{lowerFirst(#label)}}, like 01632 960 001, 07700 900 982 or +44 808 157 0192',
|
|
38
|
-
opts
|
|
39
|
-
) as JoiExpression,
|
|
40
|
-
[INTERNATIONAL_ERROR_CODE]: JoiBase.expression(
|
|
41
|
-
'Enter {{lowerFirst(#label)}}, starting with + and the country code, for example +92333 1234567 or 00923331234567',
|
|
42
|
-
opts
|
|
43
|
-
) as JoiExpression
|
|
44
|
-
} as unknown as LanguageMessages,
|
|
20
|
+
[INVALID_ERROR_CODE]: messageTemplate.format
|
|
21
|
+
} as LanguageMessages,
|
|
45
22
|
rules: {
|
|
46
23
|
phoneNumber: {
|
|
47
24
|
method({
|
|
@@ -69,25 +46,24 @@ export const joi = JoiBase.extend({
|
|
|
69
46
|
const parsed = phoneUtil.parse(value, COUNTRY)
|
|
70
47
|
|
|
71
48
|
if (!phoneUtil.isValidNumber(parsed)) {
|
|
72
|
-
return error(
|
|
49
|
+
return error(INVALID_ERROR_CODE)
|
|
73
50
|
}
|
|
74
51
|
|
|
75
52
|
if (format) {
|
|
76
53
|
const isUK = isUKNumber(parsed)
|
|
77
54
|
|
|
78
|
-
if (
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
format === TelephoneNumberFieldOptionsFormatEnum.International
|
|
55
|
+
if (
|
|
56
|
+
(!isUK && format === TelephoneNumberFieldOptionsFormatEnum.UK) ||
|
|
57
|
+
(isUK &&
|
|
58
|
+
format === TelephoneNumberFieldOptionsFormatEnum.International)
|
|
83
59
|
) {
|
|
84
|
-
return error(
|
|
60
|
+
return error(INVALID_ERROR_CODE)
|
|
85
61
|
}
|
|
86
62
|
}
|
|
87
63
|
|
|
88
64
|
return value
|
|
89
65
|
} catch {
|
|
90
|
-
return error(
|
|
66
|
+
return error(INVALID_ERROR_CODE)
|
|
91
67
|
}
|
|
92
68
|
}
|
|
93
69
|
}
|
|
@@ -6,7 +6,7 @@ import { StatusCodes } from 'http-status-codes'
|
|
|
6
6
|
import Joi from 'joi'
|
|
7
7
|
|
|
8
8
|
import { getAccessToken } from './get-os-token.js'
|
|
9
|
-
import { find
|
|
9
|
+
import { find } from '../service.js'
|
|
10
10
|
import {
|
|
11
11
|
get,
|
|
12
12
|
request as httpRequest
|
|
@@ -34,7 +34,6 @@ export function getRoutes(options) {
|
|
|
34
34
|
mapProxyRoute(options),
|
|
35
35
|
tileProxyRoute(options),
|
|
36
36
|
geocodeProxyRoute(options),
|
|
37
|
-
reverseGeocodeProxyRoute(options),
|
|
38
37
|
getGeospatialCountries()
|
|
39
38
|
]
|
|
40
39
|
}
|
|
@@ -156,41 +155,6 @@ function geocodeProxyRoute(options) {
|
|
|
156
155
|
}
|
|
157
156
|
}
|
|
158
157
|
|
|
159
|
-
/**
|
|
160
|
-
* Proxies ordnance survey reverse geocode requests from the front end to api.os.uk
|
|
161
|
-
* Used to find name from easting and northing points.
|
|
162
|
-
* N.B this endpoint is currently not used by the front end but will be soon in "maps V2"
|
|
163
|
-
* @param {MapConfiguration} options - the map options
|
|
164
|
-
* @returns {ServerRoute<MapReverseGeocodeGetRequestRefs>}
|
|
165
|
-
*/
|
|
166
|
-
function reverseGeocodeProxyRoute(options) {
|
|
167
|
-
return {
|
|
168
|
-
method: 'GET',
|
|
169
|
-
path: '/api/reverse-geocode-proxy',
|
|
170
|
-
async handler(request, _h) {
|
|
171
|
-
const { query } = request
|
|
172
|
-
const data = await nearest(
|
|
173
|
-
query.easting,
|
|
174
|
-
query.northing,
|
|
175
|
-
options.ordnanceSurveyApiKey
|
|
176
|
-
)
|
|
177
|
-
|
|
178
|
-
return data
|
|
179
|
-
},
|
|
180
|
-
options: {
|
|
181
|
-
auth: false,
|
|
182
|
-
validate: {
|
|
183
|
-
query: Joi.object()
|
|
184
|
-
.keys({
|
|
185
|
-
easting: Joi.number().required(),
|
|
186
|
-
northing: Joi.number().required()
|
|
187
|
-
})
|
|
188
|
-
.required()
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
|
|
194
158
|
/**
|
|
195
159
|
* Resource routes to return sprites and glyphs
|
|
196
160
|
* @returns {ServerRoute<MapProxyGetRequestRefs>}
|
|
@@ -67,19 +67,6 @@ export async function find(query, apiKey) {
|
|
|
67
67
|
return getData(url, endpoint)
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
/**
|
|
71
|
-
* OS names search nearest by E/N
|
|
72
|
-
* @param {number} easting - the easting
|
|
73
|
-
* @param {number} northing - the northing
|
|
74
|
-
* @param {string} apiKey - the OS api key
|
|
75
|
-
*/
|
|
76
|
-
export async function nearest(easting, northing, apiKey) {
|
|
77
|
-
const endpoint = 'nearest'
|
|
78
|
-
const url = `https://api.os.uk/search/names/v1/nearest?key=${apiKey}&point=${easting},${northing}&radius=1000&fq=local_type:Airfield%20local_type:Airport%20local_type:Bus_Station%20local_type:Chemical_Works%20local_type:City%20local_type:Coach_Station%20local_type:Electricity_Distribution%20local_type:Electricity_Production%20local_type:Further_Education%20local_type:Gas_Distribution_or_Storage%20local_type:Hamlet%20local_type:Harbour%20local_type:Helicopter_Station%20local_type:Heliport%20local_type:Higher_or_University_Education%20local_type:Hill_Or_Mountain%20local_type:Hospice%20local_type:Hospital%20local_type:Medical_Care_Accommodation%20local_type:Named_Road%20local_type:Non_State_Primary_Education%20local_type:Non_State_Secondary_Education%20local_type:Other_Settlement%20local_type:Passenger_Ferry_Terminal%20local_type:Port_Consisting_of_Docks_and_Nautical_Berthing%20local_type:Postcode%20local_type:Primary_Education%20local_type:Railway_Station%20local_type:Road_User_Services%20local_type:Secondary_Education%20local_type:Section_Of_Named_Road%20local_type:Section_Of_Numbered_Road%20local_type:Special_Needs_Education%20local_type:Suburban_Area%20local_type:Town%20local_type:Urban_Greenspace%20local_type:Vehicular_Ferry_Terminal%20local_type:Vehicular_Rail_Terminal%20local_type:Village%20local_type:Waterfall%20`
|
|
79
|
-
|
|
80
|
-
return getData(url, endpoint)
|
|
81
|
-
}
|
|
82
|
-
|
|
83
70
|
/**
|
|
84
71
|
* @import { OsNamesFindResponse, OsNamesFindResult } from './types.js'
|
|
85
72
|
*/
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export namespace result {
|
|
2
|
-
namespace header {
|
|
3
|
-
let uri: string;
|
|
4
|
-
let query: string;
|
|
5
|
-
let format: string;
|
|
6
|
-
let maxresults: number;
|
|
7
|
-
let offset: number;
|
|
8
|
-
let totalresults: number;
|
|
9
|
-
let filter: string;
|
|
10
|
-
}
|
|
11
|
-
let results: {
|
|
12
|
-
GAZETTEER_ENTRY: {
|
|
13
|
-
ID: string;
|
|
14
|
-
NAMES_URI: string;
|
|
15
|
-
NAME1: string;
|
|
16
|
-
TYPE: string;
|
|
17
|
-
LOCAL_TYPE: string;
|
|
18
|
-
GEOMETRY_X: number;
|
|
19
|
-
GEOMETRY_Y: number;
|
|
20
|
-
MOST_DETAIL_VIEW_RES: number;
|
|
21
|
-
LEAST_DETAIL_VIEW_RES: number;
|
|
22
|
-
POPULATED_PLACE: string;
|
|
23
|
-
POPULATED_PLACE_URI: string;
|
|
24
|
-
POPULATED_PLACE_TYPE: string;
|
|
25
|
-
DISTRICT_BOROUGH: string;
|
|
26
|
-
DISTRICT_BOROUGH_URI: string;
|
|
27
|
-
DISTRICT_BOROUGH_TYPE: string;
|
|
28
|
-
COUNTY_UNITARY: string;
|
|
29
|
-
COUNTY_UNITARY_URI: string;
|
|
30
|
-
COUNTY_UNITARY_TYPE: string;
|
|
31
|
-
REGION: string;
|
|
32
|
-
REGION_URI: string;
|
|
33
|
-
COUNTRY: string;
|
|
34
|
-
COUNTRY_URI: string;
|
|
35
|
-
};
|
|
36
|
-
}[];
|
|
37
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
export const result = {
|
|
2
|
-
header: {
|
|
3
|
-
uri: 'https://api.os.uk/search/names/v1/nearest?point=523065%2C185795&radius=1000&fq=local_type%3AAirfield%20local_type%3AAirport%20local_type%3ABus_Station%20local_type%3AChemical_Works%20local_type%3ACity%20local_type%3ACoach_Station%20local_type%3AElectricity_Distribution%20local_type%3AElectricity_Production%20local_type%3AFurther_Education%20local_type%3AGas_Distribution_or_Storage%20local_type%3AHamlet%20local_type%3AHarbour%20local_type%3AHelicopter_Station%20local_type%3AHeliport%20local_type%3AHigher_or_University_Education%20local_type%3AHill_Or_Mountain%20local_type%3AHospice%20local_type%3AHospital%20local_type%3AMedical_Care_Accommodation%20local_type%3ANamed_Road%20local_type%3ANon_State_Primary_Education%20local_type%3ANon_State_Secondary_Education%20local_type%3AOther_Settlement%20local_type%3APassenger_Ferry_Terminal%20local_type%3APort_Consisting_of_Docks_and_Nautical_Berthing%20local_type%3APostcode%20local_type%3APrimary_Education%20local_type%3ARailway_Station%20local_type%3ARoad_User_Services%20local_type%3ASecondary_Education%20local_type%3ASection_Of_Named_Road%20local_type%3ASection_Of_Numbered_Road%20local_type%3ASpecial_Needs_Education%20local_type%3ASuburban_Area%20local_type%3ATown%20local_type%3AUrban_Greenspace%20local_type%3AVehicular_Ferry_Terminal%20local_type%3AVehicular_Rail_Terminal%20local_type%3AVillage%20local_type%3AWaterfall%20',
|
|
4
|
-
query: 'point=523065,185795 radius=1000',
|
|
5
|
-
format: 'JSON',
|
|
6
|
-
maxresults: 1,
|
|
7
|
-
offset: 0,
|
|
8
|
-
totalresults: 1,
|
|
9
|
-
filter: 'fq=local_type:Airfield local_type:Airport local_type:Bus_Station local_type:Chemical_Works local_type:City local_type:Coach_Station local_type:Electricity_Distribution local_type:Electricity_Production local_type:Further_Education local_type:Gas_Distribution_or_Storage local_type:Hamlet local_type:Harbour local_type:Helicopter_Station local_type:Heliport local_type:Higher_or_University_Education local_type:Hill_Or_Mountain local_type:Hospice local_type:Hospital local_type:Medical_Care_Accommodation local_type:Named_Road local_type:Non_State_Primary_Education local_type:Non_State_Secondary_Education local_type:Other_Settlement local_type:Passenger_Ferry_Terminal local_type:Port_Consisting_of_Docks_and_Nautical_Berthing local_type:Postcode local_type:Primary_Education local_type:Railway_Station local_type:Road_User_Services local_type:Secondary_Education local_type:Section_Of_Named_Road local_type:Section_Of_Numbered_Road local_type:Special_Needs_Education local_type:Suburban_Area local_type:Town local_type:Urban_Greenspace local_type:Vehicular_Ferry_Terminal local_type:Vehicular_Rail_Terminal local_type:Village local_type:Waterfall'
|
|
10
|
-
},
|
|
11
|
-
results: [{
|
|
12
|
-
GAZETTEER_ENTRY: {
|
|
13
|
-
ID: 'NW26XE',
|
|
14
|
-
NAMES_URI: 'http://data.ordnancesurvey.co.uk/id/postcodeunit/NW26XE',
|
|
15
|
-
NAME1: 'NW2 6XE',
|
|
16
|
-
TYPE: 'other',
|
|
17
|
-
LOCAL_TYPE: 'Postcode',
|
|
18
|
-
GEOMETRY_X: 523065,
|
|
19
|
-
GEOMETRY_Y: 185795,
|
|
20
|
-
MOST_DETAIL_VIEW_RES: 3500,
|
|
21
|
-
LEAST_DETAIL_VIEW_RES: 18000,
|
|
22
|
-
POPULATED_PLACE: 'London',
|
|
23
|
-
POPULATED_PLACE_URI: 'http://data.ordnancesurvey.co.uk/id/4000000074813508',
|
|
24
|
-
POPULATED_PLACE_TYPE: 'http://www.ordnancesurvey.co.uk/xml/codelists/localtype.xml#city',
|
|
25
|
-
DISTRICT_BOROUGH: 'Brent',
|
|
26
|
-
DISTRICT_BOROUGH_URI: 'http://data.ordnancesurvey.co.uk/id/7000000000011447',
|
|
27
|
-
DISTRICT_BOROUGH_TYPE: 'http://data.ordnancesurvey.co.uk/ontology/admingeo/LondonBorough',
|
|
28
|
-
COUNTY_UNITARY: 'Greater London',
|
|
29
|
-
COUNTY_UNITARY_URI: 'http://data.ordnancesurvey.co.uk/id/7000000000041441',
|
|
30
|
-
COUNTY_UNITARY_TYPE: 'http://data.ordnancesurvey.co.uk/ontology/admingeo/GreaterLondonAuthority',
|
|
31
|
-
REGION: 'London',
|
|
32
|
-
REGION_URI: 'http://data.ordnancesurvey.co.uk/id/7000000000041428',
|
|
33
|
-
COUNTRY: 'England',
|
|
34
|
-
COUNTRY_URI: 'http://data.ordnancesurvey.co.uk/id/country/england'
|
|
35
|
-
}
|
|
36
|
-
}]
|
|
37
|
-
};
|
|
38
|
-
//# sourceMappingURL=nearest.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nearest.js","names":["result","header","uri","query","format","maxresults","offset","totalresults","filter","results","GAZETTEER_ENTRY","ID","NAMES_URI","NAME1","TYPE","LOCAL_TYPE","GEOMETRY_X","GEOMETRY_Y","MOST_DETAIL_VIEW_RES","LEAST_DETAIL_VIEW_RES","POPULATED_PLACE","POPULATED_PLACE_URI","POPULATED_PLACE_TYPE","DISTRICT_BOROUGH","DISTRICT_BOROUGH_URI","DISTRICT_BOROUGH_TYPE","COUNTY_UNITARY","COUNTY_UNITARY_URI","COUNTY_UNITARY_TYPE","REGION","REGION_URI","COUNTRY","COUNTRY_URI"],"sources":["../../../../../../src/server/plugins/map/test/__stubs__/nearest.js"],"sourcesContent":["export const result = {\n header: {\n uri: 'https://api.os.uk/search/names/v1/nearest?point=523065%2C185795&radius=1000&fq=local_type%3AAirfield%20local_type%3AAirport%20local_type%3ABus_Station%20local_type%3AChemical_Works%20local_type%3ACity%20local_type%3ACoach_Station%20local_type%3AElectricity_Distribution%20local_type%3AElectricity_Production%20local_type%3AFurther_Education%20local_type%3AGas_Distribution_or_Storage%20local_type%3AHamlet%20local_type%3AHarbour%20local_type%3AHelicopter_Station%20local_type%3AHeliport%20local_type%3AHigher_or_University_Education%20local_type%3AHill_Or_Mountain%20local_type%3AHospice%20local_type%3AHospital%20local_type%3AMedical_Care_Accommodation%20local_type%3ANamed_Road%20local_type%3ANon_State_Primary_Education%20local_type%3ANon_State_Secondary_Education%20local_type%3AOther_Settlement%20local_type%3APassenger_Ferry_Terminal%20local_type%3APort_Consisting_of_Docks_and_Nautical_Berthing%20local_type%3APostcode%20local_type%3APrimary_Education%20local_type%3ARailway_Station%20local_type%3ARoad_User_Services%20local_type%3ASecondary_Education%20local_type%3ASection_Of_Named_Road%20local_type%3ASection_Of_Numbered_Road%20local_type%3ASpecial_Needs_Education%20local_type%3ASuburban_Area%20local_type%3ATown%20local_type%3AUrban_Greenspace%20local_type%3AVehicular_Ferry_Terminal%20local_type%3AVehicular_Rail_Terminal%20local_type%3AVillage%20local_type%3AWaterfall%20',\n query: 'point=523065,185795 radius=1000',\n format: 'JSON',\n maxresults: 1,\n offset: 0,\n totalresults: 1,\n filter:\n 'fq=local_type:Airfield local_type:Airport local_type:Bus_Station local_type:Chemical_Works local_type:City local_type:Coach_Station local_type:Electricity_Distribution local_type:Electricity_Production local_type:Further_Education local_type:Gas_Distribution_or_Storage local_type:Hamlet local_type:Harbour local_type:Helicopter_Station local_type:Heliport local_type:Higher_or_University_Education local_type:Hill_Or_Mountain local_type:Hospice local_type:Hospital local_type:Medical_Care_Accommodation local_type:Named_Road local_type:Non_State_Primary_Education local_type:Non_State_Secondary_Education local_type:Other_Settlement local_type:Passenger_Ferry_Terminal local_type:Port_Consisting_of_Docks_and_Nautical_Berthing local_type:Postcode local_type:Primary_Education local_type:Railway_Station local_type:Road_User_Services local_type:Secondary_Education local_type:Section_Of_Named_Road local_type:Section_Of_Numbered_Road local_type:Special_Needs_Education local_type:Suburban_Area local_type:Town local_type:Urban_Greenspace local_type:Vehicular_Ferry_Terminal local_type:Vehicular_Rail_Terminal local_type:Village local_type:Waterfall'\n },\n results: [\n {\n GAZETTEER_ENTRY: {\n ID: 'NW26XE',\n NAMES_URI: 'http://data.ordnancesurvey.co.uk/id/postcodeunit/NW26XE',\n NAME1: 'NW2 6XE',\n TYPE: 'other',\n LOCAL_TYPE: 'Postcode',\n GEOMETRY_X: 523065,\n GEOMETRY_Y: 185795,\n MOST_DETAIL_VIEW_RES: 3500,\n LEAST_DETAIL_VIEW_RES: 18000,\n POPULATED_PLACE: 'London',\n POPULATED_PLACE_URI:\n 'http://data.ordnancesurvey.co.uk/id/4000000074813508',\n POPULATED_PLACE_TYPE:\n 'http://www.ordnancesurvey.co.uk/xml/codelists/localtype.xml#city',\n DISTRICT_BOROUGH: 'Brent',\n DISTRICT_BOROUGH_URI:\n 'http://data.ordnancesurvey.co.uk/id/7000000000011447',\n DISTRICT_BOROUGH_TYPE:\n 'http://data.ordnancesurvey.co.uk/ontology/admingeo/LondonBorough',\n COUNTY_UNITARY: 'Greater London',\n COUNTY_UNITARY_URI:\n 'http://data.ordnancesurvey.co.uk/id/7000000000041441',\n COUNTY_UNITARY_TYPE:\n 'http://data.ordnancesurvey.co.uk/ontology/admingeo/GreaterLondonAuthority',\n REGION: 'London',\n REGION_URI: 'http://data.ordnancesurvey.co.uk/id/7000000000041428',\n COUNTRY: 'England',\n COUNTRY_URI: 'http://data.ordnancesurvey.co.uk/id/country/england'\n }\n }\n ]\n}\n"],"mappings":"AAAA,OAAO,MAAMA,MAAM,GAAG;EACpBC,MAAM,EAAE;IACNC,GAAG,EAAE,22CAA22C;IACh3CC,KAAK,EAAE,iCAAiC;IACxCC,MAAM,EAAE,MAAM;IACdC,UAAU,EAAE,CAAC;IACbC,MAAM,EAAE,CAAC;IACTC,YAAY,EAAE,CAAC;IACfC,MAAM,EACJ;EACJ,CAAC;EACDC,OAAO,EAAE,CACP;IACEC,eAAe,EAAE;MACfC,EAAE,EAAE,QAAQ;MACZC,SAAS,EAAE,yDAAyD;MACpEC,KAAK,EAAE,SAAS;MAChBC,IAAI,EAAE,OAAO;MACbC,UAAU,EAAE,UAAU;MACtBC,UAAU,EAAE,MAAM;MAClBC,UAAU,EAAE,MAAM;MAClBC,oBAAoB,EAAE,IAAI;MAC1BC,qBAAqB,EAAE,KAAK;MAC5BC,eAAe,EAAE,QAAQ;MACzBC,mBAAmB,EACjB,sDAAsD;MACxDC,oBAAoB,EAClB,kEAAkE;MACpEC,gBAAgB,EAAE,OAAO;MACzBC,oBAAoB,EAClB,sDAAsD;MACxDC,qBAAqB,EACnB,kEAAkE;MACpEC,cAAc,EAAE,gBAAgB;MAChCC,kBAAkB,EAChB,sDAAsD;MACxDC,mBAAmB,EACjB,2EAA2E;MAC7EC,MAAM,EAAE,QAAQ;MAChBC,UAAU,EAAE,sDAAsD;MAClEC,OAAO,EAAE,SAAS;MAClBC,WAAW,EAAE;IACf;EACF,CAAC;AAEL,CAAC","ignoreList":[]}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
export const result = {
|
|
2
|
-
header: {
|
|
3
|
-
uri: 'https://api.os.uk/search/names/v1/nearest?point=523065%2C185795&radius=1000&fq=local_type%3AAirfield%20local_type%3AAirport%20local_type%3ABus_Station%20local_type%3AChemical_Works%20local_type%3ACity%20local_type%3ACoach_Station%20local_type%3AElectricity_Distribution%20local_type%3AElectricity_Production%20local_type%3AFurther_Education%20local_type%3AGas_Distribution_or_Storage%20local_type%3AHamlet%20local_type%3AHarbour%20local_type%3AHelicopter_Station%20local_type%3AHeliport%20local_type%3AHigher_or_University_Education%20local_type%3AHill_Or_Mountain%20local_type%3AHospice%20local_type%3AHospital%20local_type%3AMedical_Care_Accommodation%20local_type%3ANamed_Road%20local_type%3ANon_State_Primary_Education%20local_type%3ANon_State_Secondary_Education%20local_type%3AOther_Settlement%20local_type%3APassenger_Ferry_Terminal%20local_type%3APort_Consisting_of_Docks_and_Nautical_Berthing%20local_type%3APostcode%20local_type%3APrimary_Education%20local_type%3ARailway_Station%20local_type%3ARoad_User_Services%20local_type%3ASecondary_Education%20local_type%3ASection_Of_Named_Road%20local_type%3ASection_Of_Numbered_Road%20local_type%3ASpecial_Needs_Education%20local_type%3ASuburban_Area%20local_type%3ATown%20local_type%3AUrban_Greenspace%20local_type%3AVehicular_Ferry_Terminal%20local_type%3AVehicular_Rail_Terminal%20local_type%3AVillage%20local_type%3AWaterfall%20',
|
|
4
|
-
query: 'point=523065,185795 radius=1000',
|
|
5
|
-
format: 'JSON',
|
|
6
|
-
maxresults: 1,
|
|
7
|
-
offset: 0,
|
|
8
|
-
totalresults: 1,
|
|
9
|
-
filter:
|
|
10
|
-
'fq=local_type:Airfield local_type:Airport local_type:Bus_Station local_type:Chemical_Works local_type:City local_type:Coach_Station local_type:Electricity_Distribution local_type:Electricity_Production local_type:Further_Education local_type:Gas_Distribution_or_Storage local_type:Hamlet local_type:Harbour local_type:Helicopter_Station local_type:Heliport local_type:Higher_or_University_Education local_type:Hill_Or_Mountain local_type:Hospice local_type:Hospital local_type:Medical_Care_Accommodation local_type:Named_Road local_type:Non_State_Primary_Education local_type:Non_State_Secondary_Education local_type:Other_Settlement local_type:Passenger_Ferry_Terminal local_type:Port_Consisting_of_Docks_and_Nautical_Berthing local_type:Postcode local_type:Primary_Education local_type:Railway_Station local_type:Road_User_Services local_type:Secondary_Education local_type:Section_Of_Named_Road local_type:Section_Of_Numbered_Road local_type:Special_Needs_Education local_type:Suburban_Area local_type:Town local_type:Urban_Greenspace local_type:Vehicular_Ferry_Terminal local_type:Vehicular_Rail_Terminal local_type:Village local_type:Waterfall'
|
|
11
|
-
},
|
|
12
|
-
results: [
|
|
13
|
-
{
|
|
14
|
-
GAZETTEER_ENTRY: {
|
|
15
|
-
ID: 'NW26XE',
|
|
16
|
-
NAMES_URI: 'http://data.ordnancesurvey.co.uk/id/postcodeunit/NW26XE',
|
|
17
|
-
NAME1: 'NW2 6XE',
|
|
18
|
-
TYPE: 'other',
|
|
19
|
-
LOCAL_TYPE: 'Postcode',
|
|
20
|
-
GEOMETRY_X: 523065,
|
|
21
|
-
GEOMETRY_Y: 185795,
|
|
22
|
-
MOST_DETAIL_VIEW_RES: 3500,
|
|
23
|
-
LEAST_DETAIL_VIEW_RES: 18000,
|
|
24
|
-
POPULATED_PLACE: 'London',
|
|
25
|
-
POPULATED_PLACE_URI:
|
|
26
|
-
'http://data.ordnancesurvey.co.uk/id/4000000074813508',
|
|
27
|
-
POPULATED_PLACE_TYPE:
|
|
28
|
-
'http://www.ordnancesurvey.co.uk/xml/codelists/localtype.xml#city',
|
|
29
|
-
DISTRICT_BOROUGH: 'Brent',
|
|
30
|
-
DISTRICT_BOROUGH_URI:
|
|
31
|
-
'http://data.ordnancesurvey.co.uk/id/7000000000011447',
|
|
32
|
-
DISTRICT_BOROUGH_TYPE:
|
|
33
|
-
'http://data.ordnancesurvey.co.uk/ontology/admingeo/LondonBorough',
|
|
34
|
-
COUNTY_UNITARY: 'Greater London',
|
|
35
|
-
COUNTY_UNITARY_URI:
|
|
36
|
-
'http://data.ordnancesurvey.co.uk/id/7000000000041441',
|
|
37
|
-
COUNTY_UNITARY_TYPE:
|
|
38
|
-
'http://data.ordnancesurvey.co.uk/ontology/admingeo/GreaterLondonAuthority',
|
|
39
|
-
REGION: 'London',
|
|
40
|
-
REGION_URI: 'http://data.ordnancesurvey.co.uk/id/7000000000041428',
|
|
41
|
-
COUNTRY: 'England',
|
|
42
|
-
COUNTRY_URI: 'http://data.ordnancesurvey.co.uk/id/country/england'
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
]
|
|
46
|
-
}
|