@finbheara/domain 0.36.0 → 0.38.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/dist/chunks/{place-75ms9pvh.js → place-k6y6fe1y.js} +60 -4
- package/dist/geocode.js +76 -62
- package/dist/place.js +5 -1
- package/dist/school.js +1 -1
- package/dist/types/place-towns.d.ts +1 -1
- package/dist/types/place-tree.d.ts +1 -0
- package/dist/types/place-within.d.ts +1 -1
- package/dist/types/place.d.ts +3 -0
- package/package.json +1 -1
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
} from "./place-q9kwsmzd.js";
|
|
8
8
|
|
|
9
9
|
var FOREIGN_MEMBER_REGIONS = ["IDTANA-SRO"];
|
|
10
|
+
var SPLIT_SUBDIVISIONS = ["USA-PA"];
|
|
10
11
|
var PLACE_NODES = [
|
|
11
12
|
{
|
|
12
13
|
id: "world",
|
|
@@ -4540,6 +4541,15 @@ var PLACE_NODES = [
|
|
|
4540
4541
|
prints: ["pennsylvania"],
|
|
4541
4542
|
codes: ["PA", "PA-USA", "US-PA", "USA-PA"]
|
|
4542
4543
|
},
|
|
4544
|
+
{
|
|
4545
|
+
id: "USA-WPA",
|
|
4546
|
+
kind: "subdivision",
|
|
4547
|
+
name: "Western Pennsylvania",
|
|
4548
|
+
geo: "USA-PA",
|
|
4549
|
+
admin: "IDTANA-MAO",
|
|
4550
|
+
prints: ["western pennsylvania"],
|
|
4551
|
+
codes: []
|
|
4552
|
+
},
|
|
4543
4553
|
{
|
|
4544
4554
|
id: "USA-RI",
|
|
4545
4555
|
kind: "subdivision",
|
|
@@ -6557,7 +6567,7 @@ var PLACE_NODES = [
|
|
|
6557
6567
|
kind: "city",
|
|
6558
6568
|
name: "Erie",
|
|
6559
6569
|
geo: "USA-PA",
|
|
6560
|
-
admin: "IDTANA-
|
|
6570
|
+
admin: "IDTANA-MAO",
|
|
6561
6571
|
prints: ["erie"],
|
|
6562
6572
|
codes: [],
|
|
6563
6573
|
runPrints: ["eire"]
|
|
@@ -6586,7 +6596,7 @@ var PLACE_NODES = [
|
|
|
6586
6596
|
kind: "city",
|
|
6587
6597
|
name: "Pittsburgh",
|
|
6588
6598
|
geo: "USA-PA",
|
|
6589
|
-
admin: "IDTANA-
|
|
6599
|
+
admin: "IDTANA-MAO",
|
|
6590
6600
|
prints: ["pittsburgh"],
|
|
6591
6601
|
codes: []
|
|
6592
6602
|
},
|
|
@@ -7394,12 +7404,28 @@ function inWebSpan(at, index) {
|
|
|
7394
7404
|
return at.web.some(([start, end]) => index >= start && index < end);
|
|
7395
7405
|
}
|
|
7396
7406
|
|
|
7407
|
+
var GENERIC_WORDS2 = {
|
|
7408
|
+
saint: "st",
|
|
7409
|
+
sainte: "ste",
|
|
7410
|
+
fort: "ft",
|
|
7411
|
+
mount: "mt"
|
|
7412
|
+
};
|
|
7413
|
+
var GENERIC_SHORT = new Set(Object.values(GENERIC_WORDS2));
|
|
7414
|
+
function genericKey2(folded) {
|
|
7415
|
+
const sp = folded.indexOf(" ");
|
|
7416
|
+
if (sp <= 0 || sp === folded.length - 1)
|
|
7417
|
+
return;
|
|
7418
|
+
const head = folded.slice(0, sp);
|
|
7419
|
+
const short = GENERIC_WORDS2[head] ?? (GENERIC_SHORT.has(head) ? head : undefined);
|
|
7420
|
+
return short === undefined ? undefined : `${short}${folded.slice(sp)}`;
|
|
7421
|
+
}
|
|
7397
7422
|
var DEFAULT_PLACE_CAPACITY2 = 8192;
|
|
7398
7423
|
var PLACE_CELL_SENTINELS = [...SHARED_ROW_SENTINELS2];
|
|
7399
7424
|
var placeCellSentinelOf = sentinelIn2(PLACE_CELL_SENTINELS);
|
|
7400
7425
|
function createPlaceReader2(options = {}) {
|
|
7401
7426
|
const nodes = options.tree ?? PLACE_NODES;
|
|
7402
7427
|
const withinTable = options.within ?? PLACE_WITHIN;
|
|
7428
|
+
const generic = options.generic === true;
|
|
7403
7429
|
let index;
|
|
7404
7430
|
const given = options.refusals;
|
|
7405
7431
|
const refusals = given === undefined ? () => {
|
|
@@ -7474,7 +7500,14 @@ function createPlaceReader2(options = {}) {
|
|
|
7474
7500
|
const listedPhrases = new Set;
|
|
7475
7501
|
const byHeading = new Map;
|
|
7476
7502
|
const byRunPrint = new Map;
|
|
7503
|
+
const byGeneric = new Map;
|
|
7477
7504
|
for (const n of source) {
|
|
7505
|
+
if (generic && n.kind === "city")
|
|
7506
|
+
for (const p of [n.name, ...n.prints]) {
|
|
7507
|
+
const k = genericKey2(fold(p));
|
|
7508
|
+
if (k !== undefined)
|
|
7509
|
+
push(byGeneric, k, n);
|
|
7510
|
+
}
|
|
7478
7511
|
for (const h of n.headings ?? [])
|
|
7479
7512
|
push(byHeading, fold(h), n);
|
|
7480
7513
|
for (const r of n.runPrints ?? [])
|
|
@@ -7551,16 +7584,32 @@ function createPlaceReader2(options = {}) {
|
|
|
7551
7584
|
}
|
|
7552
7585
|
return;
|
|
7553
7586
|
};
|
|
7587
|
+
const regionOf = (n) => n.admin !== null && byId.get(n.admin)?.kind === "region";
|
|
7588
|
+
const shadowed = (n) => {
|
|
7589
|
+
const seen = new Set;
|
|
7590
|
+
let named = false;
|
|
7591
|
+
for (let at = n;at !== undefined && !seen.has(at.id); ) {
|
|
7592
|
+
if (SPLIT_SUBDIVISIONS.includes(at.id))
|
|
7593
|
+
return named ? at.id : undefined;
|
|
7594
|
+
named ||= regionOf(at);
|
|
7595
|
+
seen.add(at.id);
|
|
7596
|
+
at = at.geo === null ? undefined : byId.get(at.geo);
|
|
7597
|
+
}
|
|
7598
|
+
return;
|
|
7599
|
+
};
|
|
7554
7600
|
const ancestorsOf = new Map;
|
|
7555
7601
|
for (const n of source) {
|
|
7556
7602
|
const out = new Set;
|
|
7557
7603
|
const todo = [n];
|
|
7558
7604
|
const own = countryOnMap(n);
|
|
7605
|
+
const split = shadowed(n);
|
|
7559
7606
|
for (let at = todo.pop();at !== undefined; at = todo.pop()) {
|
|
7560
7607
|
const foreign = at.kind === "region" && FOREIGN_MEMBER_REGIONS.includes(at.id) && own !== undefined && countryOnMap(at) !== own;
|
|
7561
7608
|
for (const parent of parents.get(at.id) ?? []) {
|
|
7562
7609
|
if (foreign && parent.id === at.geo)
|
|
7563
7610
|
continue;
|
|
7611
|
+
if (at.id === split && parent.id === at.admin)
|
|
7612
|
+
continue;
|
|
7564
7613
|
if (parent.id === n.id || out.has(parent.id))
|
|
7565
7614
|
continue;
|
|
7566
7615
|
out.add(parent.id);
|
|
@@ -7585,7 +7634,8 @@ function createPlaceReader2(options = {}) {
|
|
|
7585
7634
|
phrases,
|
|
7586
7635
|
listedPhrases,
|
|
7587
7636
|
byHeading,
|
|
7588
|
-
byRunPrint
|
|
7637
|
+
byRunPrint,
|
|
7638
|
+
byGeneric
|
|
7589
7639
|
};
|
|
7590
7640
|
}
|
|
7591
7641
|
function idx() {
|
|
@@ -7808,7 +7858,13 @@ function createPlaceReader2(options = {}) {
|
|
|
7808
7858
|
if (upper.length > 0)
|
|
7809
7859
|
return { heads: upper, match: "code", truncated: false, refusal: null };
|
|
7810
7860
|
}
|
|
7861
|
+
const gk = generic ? genericKey2(folded) : undefined;
|
|
7811
7862
|
const asPrint = keep(i.byPrint.get(folded));
|
|
7863
|
+
if (gk !== undefined) {
|
|
7864
|
+
for (const n of i.byGeneric.get(gk) ?? [])
|
|
7865
|
+
if (!asPrint.includes(n))
|
|
7866
|
+
asPrint.push(n);
|
|
7867
|
+
}
|
|
7812
7868
|
if (asPrint.length > 0) {
|
|
7813
7869
|
const m = folded.includes(" ") ? "phrase" : "print";
|
|
7814
7870
|
return { heads: asPrint, match: m, truncated: false, refusal: null };
|
|
@@ -8839,4 +8895,4 @@ function sameReading2(a, b) {
|
|
|
8839
8895
|
return DEFAULT_PLACE_READER2.sameReading(a, b);
|
|
8840
8896
|
}
|
|
8841
8897
|
|
|
8842
|
-
export { PLACE_NODES, NEVER_NAME, printZones, opensLocation, DEFAULT_PLACE_CAPACITY2, createPlaceReader2, DEFAULT_PLACE_READER2, place2, isPlaceToken2, countryCodeOf2, areAllPlaceTokens2, placeFromId2, placeWindows2, placeParts2, oireachtasOfRegion2, regionOfOireachtas2, placeStats2, resetPlaceCache2, placeRelation2, placesRelation2, probablySamePlace2, sameReading2 };
|
|
8898
|
+
export { PLACE_NODES, NEVER_NAME, printZones, opensLocation, GENERIC_WORDS2, genericKey2, DEFAULT_PLACE_CAPACITY2, createPlaceReader2, DEFAULT_PLACE_READER2, place2, isPlaceToken2, countryCodeOf2, areAllPlaceTokens2, placeFromId2, placeWindows2, placeParts2, oireachtasOfRegion2, regionOfOireachtas2, placeStats2, resetPlaceCache2, placeRelation2, placesRelation2, probablySamePlace2, sameReading2 };
|