@bicharts/shape-core 0.5.3 → 0.5.5
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/{chunk-JOEPVC6M.mjs → chunk-AFCU4W7T.mjs} +1 -1
- package/dist/{chunk-YSZMUPBJ.mjs → chunk-E3TPFK7K.mjs} +1 -1
- package/dist/{chunk-P2HRTQHW.mjs → chunk-FMHK6M3O.mjs} +1 -1
- package/dist/chunk-HD4QWSPI.mjs +2 -0
- package/dist/geoDetector.mjs +1 -1
- package/dist/geoPoint.mjs +1 -1
- package/dist/{chunk-TNZHHLYX.mjs → geoPointCities.mjs} +1 -1
- package/dist/index.mjs +1 -1
- package/dist/indexedText.mjs +1 -1
- package/dist/ingest.mjs +1 -1
- package/dist/types/geoPoint.d.ts +12 -0
- package/dist/types/geoPointCities.generated.d.ts +1 -0
- package/dist/types/geoPointTables.generated.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +8 -3
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! @bicharts/shape-core — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; US Census/TIGER (public domain). Full text: NOTICE in this package. */
|
|
2
|
-
import{a as
|
|
2
|
+
import{a as at,b as ct}from"./chunk-AFCU4W7T.mjs";import{a as nt,b as et,c as ot,d as it,e as st,f as rt}from"./chunk-E3TPFK7K.mjs";import{a as J}from"./chunk-QEH7WTLB.mjs";import{a as Q,b as U}from"./chunk-2LR73DNS.mjs";import{a as X,b as Y,c as tt}from"./chunk-NWDPA7DG.mjs";import{a as V,b as W,c as Z,d as j}from"./chunk-FMHK6M3O.mjs";import{a as v,f as $,g as O,h as d,i as H,j as K,k as P,l as B,m as q,n as E,o as R,p as F}from"./chunk-HD4QWSPI.mjs";import{a as N,b as D,c as _}from"./chunk-WBEROMBG.mjs";var M=85,S=2,ut=100,T=400,G=new Set(["us","usa","u s","u s a","united states","united states of america","america","ca","can","canada","mx","mex","mexico","estados unidos mexicanos"]);function p(o){let e=new Set;for(let n of o){if(n==null)continue;let i=v(String(n));if(i&&!e.has(i)&&(e.add(i),e.size>=T))break}return Array.from(e)}function x(o){let e=p(o);return e.length===0||!e.every(n=>G.has(n))?!1:e.some(n=>!d(n))}function L(o){return G.has(o)&&!!d(o)}function C(o){let e=p(o);if(e.length===0)return 0;let n=0;for(let i of e)d(i)&&n++;return Math.round(n/e.length*1e3)/10}function I(o){let e=new Set;for(let n of o){if(n==null)continue;let i=String(n).trim();if(i&&!e.has(i)&&(e.add(i),e.size>=T))break}return Array.from(e)}function w(o){let e=I(o);if(e.length===0)return 0;let n=0;for(let i of e)P(i).length>0&&n++;return Math.round(n/e.length*1e3)/10}function lt(o,e){let n=p(o);if(n.length===0)return 0;let i=0;for(let l of n)R(l,e)&&i++;return Math.round(i/n.length*1e3)/10}function A(o,e){let n=0;for(let i of p(o))e(i)&&n++;return n}function ft(o,e){let n=0;for(let i of I(o))e(i)&&n++;return n}function dt(o,e,n,i){let l=[],y=[],s={},k=new Set(o),m=t=>e.map(r=>r[t]);for(let t of["city","zip","lat","lon","country"]){let r=n?.[t];r&&k.has(r)&&(s[t]=r)}let u=n?.state;if(u&&k.has(u)){let t=m(u),r=p(t);r.length>0&&r.every(L)?y.push(`state=${u} (every value is "CA", which is both Canada and California)`):x(t)?(y.push(`state=${u} (every value is a country, not a state)`),s.country||(s.country=u)):C(t)<M?y.push(`state=${u} (only ${C(t)}% of values are states/provinces)`):s.state=u}let f=new Set(Object.values(s).filter(Boolean)),g=o.filter(t=>!f.has(t)&&!t.startsWith("__"));if(!s.state){let t=null;for(let r of g){let a=m(r);if(x(a))continue;let c=C(a);if(c<M)continue;let b=A(a,h=>!!d(h)),z=A(a,h=>!!d(h)&&!L(h));b<S&&z<1||(!t||c>t.pct)&&(t={name:r,pct:c})}t&&(s.state=t.name,f.add(t.name),l.push(`state=${t.name} (${t.pct}% states/provinces)`))}if(!s.zip)for(let t of g){if(f.has(t))continue;let r=m(t),a=w(r);if(!(a<ut)&&!(ft(r,c=>P(c).length>0)<S)){s.zip=t,f.add(t),l.push(`zip=${t} (${a}% ZIP codes)`);break}}if(!s.country){for(let t of g)if(!f.has(t)&&x(m(t))){s.country=t,f.add(t),l.push(`country=${t}`);break}}if(!s.city){let t=null;for(let r of g){if(f.has(r))continue;let a=m(r),c=lt(a,i);c<M||A(a,b=>R(b,i))<S||(!t||c>t.pct)&&(t={name:r,pct:c})}t&&(s.city=t.name,l.push(`city=${t.name} (${t.pct}% known cities)`))}return{bind:!!(s.city||s.state||s.zip||s.lat&&s.lon)?s:null,backfilled:l,refused:y}}export{tt as GET_RANDOM,rt as IndexedText,Y as SIMPLE_STRING_HASH,X as STR,C as admin1MatchPct,j as buildGeoIsoColumn,E as buildGeoPointColumns,F as cityMatchPct,it as classifyAdditivity,st as classifyNumericValueNature,et as classifyTemporal,J as detectFormatSignature,V as detectGeo,_ as detectOrdinalDomain,at as engineTypeForSqlType,ot as hostAggHint,ct as ingest,O as isCityTableLoaded,B as isGeoPointAmbiguity,nt as isIdentifierName,Z as isJoinGeoKind,N as isOrdinalFriendlyName,x as looksLikeCountryColumn,U as monthLookupFor,H as normalizeCountry,Q as normalizeMonthKey,v as normalizePlaceName,$ as registerCityTable,d as resolveAdmin1,q as resolveGeoPoint,dt as resolvePointRoles,D as safeDistinctValuesToShip,W as toGeoIso,w as zipMatchPct,P as zipPrefixCandidates,K as zipToPrefix3};
|
package/dist/indexedText.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! @bicharts/shape-core — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; US Census/TIGER (public domain). Full text: NOTICE in this package. */
|
|
2
|
-
import{a,b,c,d,e,f}from"./chunk-
|
|
2
|
+
import{a,b,c,d,e,f}from"./chunk-E3TPFK7K.mjs";import"./chunk-QEH7WTLB.mjs";import"./chunk-2LR73DNS.mjs";import"./chunk-NWDPA7DG.mjs";import"./chunk-FMHK6M3O.mjs";import"./chunk-HD4QWSPI.mjs";import"./chunk-WBEROMBG.mjs";export{f as IndexedText,d as classifyAdditivity,e as classifyNumericValueNature,b as classifyTemporal,c as hostAggHint,a as isIdentifierName};
|
package/dist/ingest.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! @bicharts/shape-core — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; US Census/TIGER (public domain). Full text: NOTICE in this package. */
|
|
2
|
-
import{a,b}from"./chunk-
|
|
2
|
+
import{a,b}from"./chunk-AFCU4W7T.mjs";import"./chunk-E3TPFK7K.mjs";import"./chunk-QEH7WTLB.mjs";import"./chunk-2LR73DNS.mjs";import"./chunk-NWDPA7DG.mjs";import"./chunk-FMHK6M3O.mjs";import"./chunk-HD4QWSPI.mjs";import"./chunk-WBEROMBG.mjs";export{a as engineTypeForSqlType,b as ingest};
|
package/dist/types/geoPoint.d.ts
CHANGED
|
@@ -14,6 +14,12 @@ export { normalizePlaceName } from "./geoCountryNames";
|
|
|
14
14
|
* every map type with the map deciding its own scope — Joel 2026-08-02: "one row can
|
|
15
15
|
* apply to 1 or more map types", and the matching rules are COMMON logic. */
|
|
16
16
|
export type GeoMapKind = "north-america" | "world";
|
|
17
|
+
/** Hand the placement table to the resolver (see the split note above). Idempotent;
|
|
18
|
+
* re-registering a different table rebuilds the index. */
|
|
19
|
+
export declare function registerCityTable(packed: string): void;
|
|
20
|
+
/** True once a placement table is registered — i.e. the city tier can produce coordinates.
|
|
21
|
+
* False means city lookups degrade to the coarser tiers, NOT that they fail. */
|
|
22
|
+
export declare function isCityTableLoaded(): boolean;
|
|
17
23
|
/** Resolve a state/province token ("TX", "Texas", "ON", "Ontario", "Jalisco") to its
|
|
18
24
|
* canonical admin1 key. Null when unrecognized. */
|
|
19
25
|
export declare function resolveAdmin1(value: string | null | undefined): string | null;
|
|
@@ -97,6 +103,12 @@ export type GeoPointColumns = {
|
|
|
97
103
|
ambiguousExamples: string[];
|
|
98
104
|
matchedRows: number;
|
|
99
105
|
totalRows: number;
|
|
106
|
+
/** True when rows carried a CITY but no placement table was registered, so those rows
|
|
107
|
+
* resolved at a coarser tier than they could have (see the bundled/fetched split).
|
|
108
|
+
* Diagnostic, not a failure: the coarser precision is already reported honestly. It
|
|
109
|
+
* exists so "why is my map suddenly state-level?" has an answer in the log instead of
|
|
110
|
+
* requiring someone to guess that a fetch failed. */
|
|
111
|
+
cityTableMissing?: true;
|
|
100
112
|
};
|
|
101
113
|
/**
|
|
102
114
|
* Build aligned __geoLat__ / __geoLon__ columns for a full table. Pure.
|