@bicharts/shape-core 0.6.5 → 0.6.7

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/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 Dt,b as Lt}from"./chunk-UQU75XXR.mjs";import{a as Et,b as Gt,c as wt,d as Ot,e as kt,f as Ft,g as zt,h as $t}from"./chunk-BIC73LQV.mjs";import{a as bt,b as It,c as vt,d as Nt,e as _t}from"./chunk-ZFTP4NSP.mjs";import{A as ht,B as St,C as xt,D as Pt,E as Tt,F as Rt,G as At,I as Mt,a as He,b as Ke,c as We,d as Ve,e as Xe,f as Ye,g as Je,h as Qe,i as et,j as tt,k as nt,l as ot,m as rt,n as it,o as st,p as at,q as ut,r as lt,s as ct,t as mt,u as ft,v as pt,w as dt,x as gt,y as yt,z as Ct}from"./chunk-PFCJESUQ.mjs";import{a as je}from"./chunk-QEH7WTLB.mjs";import{a as qe,b as Ze}from"./chunk-2LR73DNS.mjs";import{a as K,b as W,c as ze,d as $e,e as Ue,f as Be}from"./chunk-C5I73OM2.mjs";import{a as M,f as b,g as C,h as I,i as E,j as Ne,k as _e,l as H,m as d,n as De,o as Le,p as Ee,q as v,r as Ge,s as we,t as Oe,u as ke,v as G,w as Fe}from"./chunk-TPVDJHU6.mjs";import"./chunk-5MRZID36.mjs";import{a as be,b as Ie,c as ve}from"./chunk-35Z7JCND.mjs";import{A as Me,a as ee,b as te,c as ne,d as oe,e as re,f as ie,g as se,h as ae,i as ue,j as le,k as ce,l as me,m as fe,n as pe,o as de,p as ge,r as ye,s as Ce,t as he,u as Se,v as xe,w as Pe,x as Te,y as Re,z as Ae}from"./chunk-ILHBRGIO.mjs";var w=2,q=400;function k(r){return!!b(r)}function P(r){let n=new Set;for(let t of r){if(t==null)continue;let i=M(String(t));if(!I(i)&&!n.has(i)&&(n.add(i),n.size>=q))break}return Array.from(n)}function x(r){let n=P(r);if(n.length===0||F(r)<95)return!1;let t=n.filter(c=>k(c)&&!d(c)).length,i=n.filter(c=>!k(c)&&!!d(c)).length;return t>=1&&t>=i}function V(r,n){if(!d(r))return!1;let t=b(r);return t?n==="world"?!0:H.has(t):!1}function F(r){let n=P(r);if(n.length===0)return 0;let t=0;for(let i of n)k(i)&&t++;return Math.round(t/n.length*1e3)/10}function N(r){let n=P(r);if(n.length===0)return 0;let t=0;for(let i of n)d(i)&&t++;return Math.round(t/n.length*1e3)/10}function $(r){let n=new Set;for(let t of r){if(t==null)continue;let i=String(t).trim();if(!I(M(i))&&!n.has(i)&&(n.add(i),n.size>=q))break}return Array.from(n)}function z(r){let n=$(r);if(n.length===0)return 0;let t=0;for(let i of n)v(i).length>0&&t++;return Math.round(t/n.length*1e3)/10}function j(r,n){return W(n,K)?!0:$(r).some(t=>/^\d{5}(-\d{4})?$/.test(t.replace(/\.0+$/,"")))}function Ut(r,n){let t=P(r);if(t.length===0)return 0;let i=0;for(let c of t)G(c,n)&&i++;return Math.round(i/t.length*1e3)/10}function O(r,n){let t=0;for(let i of P(r))n(i)&&t++;return t}function Bt(r,n){let t=0;for(let i of $(r))n(i)&&t++;return t}function Ht(r,n,t,i,c){let u=[],a=[],o={},T={},h=new Set(r),m=e=>n.map(s=>s[e]);for(let e of["city","country"]){let s=t?.[e];s&&h.has(s)&&(o[e]=s)}let Y=new Set(c??r);for(let e of["lat","lon"]){let s=t?.[e];s&&Y.has(s)&&(o[e]=s)}let g=t?.zip;if(g&&h.has(g)){let e=m(g),s=z(e);s<95?a.push(`zip=${g} (only ${s}% of values read as ZIPs)`):j(e,g)?o.zip=g:a.push(`zip=${g} (all values are 3-4 digits with nothing to say they are postal)`)}let p=t?.state;if(p&&h.has(p)){let e=m(p),s=P(e);s.length>0&&s.every(l=>V(l,i))?a.push(`state=${p} (every value is "CA", which is both Canada and California)`):x(e)?(a.push(`state=${p} (every value is a country, not a state)`),o.country||(o.country=p)):N(e)<95?a.push(`state=${p} (only ${N(e)}% of values are states/provinces)`):o.state=p}let y=new Set(Object.values(o).filter(Boolean)),R=r.filter(e=>!y.has(e)&&!e.startsWith("__"));if(!o.state){let e=null;for(let s of R){let l=m(s);if(x(l))continue;let f=N(l);if(f<95)continue;let L=O(l,A=>!!d(A)),Q=O(l,A=>!!d(A)&&!V(A,i));L<w&&Q<1||(!e||f>e.pct)&&(e={name:s,pct:f})}e&&(o.state=e.name,y.add(e.name),u.push(`state=${e.name} (${e.pct}% states/provinces)`))}if(!o.zip)for(let e of R){if(y.has(e))continue;let s=m(e),l=z(s);if(!(l<95)&&j(s,e)&&!(Bt(s,f=>v(f).length>0)<w)){o.zip=e,y.add(e),u.push(`zip=${e} (${l}% ZIP codes)`);break}}let S=o.country;if(!S||!x(m(S))){let e=null;for(let s of R){if(y.has(s)||!x(m(s)))continue;let l=F(m(s));(!e||l>e.pct)&&(e={name:s,pct:l})}e&&(S&&(a.push(`country=${S} (only ${F(m(S))}% of values are country identifiers; using ${e.name} instead)`),T.country=S),o.country=e.name,y.add(e.name),u.push(`country=${e.name}`))}if(!o.city){let e=null;for(let s of R){if(y.has(s))continue;let l=m(s),f=Ut(l,i);f<E||O(l,L=>G(L,i))<w||(!e||f>e.pct)&&(e={name:s,pct:f})}e&&(o.city=e.name,u.push(`city=${e.name} (${e.pct}% known cities)`))}let U=o.country?m(o.country):[],_=!!o.country&&x(U),J=_?new Set(U.map(e=>b(e==null?null:String(e))).filter(Boolean)).size:0,B=_&&J>=2,D=!!(o.lat&&o.lon)&&n.some(e=>{let s=+String(e[o.lat]??"").trim(),l=+String(e[o.lon]??"").trim();return isFinite(s)&&isFinite(l)&&s>=-90&&s<=90&&l>=-180&&l<=180&&String(e[o.lat]??"").trim()!==""&&String(e[o.lon]??"").trim()!==""});return o.lat&&o.lon&&!D&&a.push(`lat/lon=${o.lat}/${o.lon} (no row holds a usable coordinate pair)`),o.country&&!B&&!(o.city||o.state||o.zip||D)&&a.push(_?`country=${o.country} (every row resolves to the same country - nothing to place apart)`:`country=${o.country} (values are not country identifiers)`),{bind:!!(o.city||o.state||o.zip||B||D)?o:null,backfilled:u,refused:a,...Object.keys(T).length?{labelFallback:T}:{}}}function Z(r,n){let t=n?.freemiumMaxShapeColumns;return typeof t!="number"||!isFinite(t)||t<1?null:!isFinite(r)||r<=t?0:Math.round(r-t)}function Kt(r,n,t){let i=Z(r,n);if(i===null||i<=0)return null;let c=typeof n?.freemiumColumnCapPivot=="number"?n.freemiumColumnCapPivot:4,u=i>c?n?.freemiumColumnCapMessageMany:n?.freemiumColumnCapMessageFew;if(typeof u!="string"||u.trim().length===0)return null;let a=u.split("{n}").join(String(i)).split("{fields}").join(i===1?"field":"fields"),o=X(t);return o.length===0?a:a+" "+o.join(" ")}function X(r){if(!r||r.length===0)return[];let n=[],t=new Map,i=new Map;for(let u of r){let a=typeof u?.dateGroupId=="string"?u.dateGroupId.trim():"";if(a!==""&&(t.has(a)||(n.push(a),t.set(a,0)),u.isDatePart===!0&&t.set(a,t.get(a)+1),u.isReassembledDate===!0&&!i.has(a))){let o=typeof u.sourceField=="string"?u.sourceField.trim():"",T=typeof u.name=="string"?u.name.trim():"",h=o!==""?o:T;h!==""&&i.set(a,h)}}let c=[];for(let u of n){let a=i.get(u),o=t.get(u)??0;!a||o===0||c.push(`'${a}' is a date hierarchy and counts as ${o+1} fields - bind the date itself instead of its hierarchy.`)}return c}export{E as CITY_ROLE_MATCH_PCT,le as COMPOUND_MIN_STEM,gt as DEFAULT_GAP_FACTOR,Se as DEFAULT_TEMPERATURE,Ce as GET_RANDOM,me as GLUED_STEM_MIN,Ye as INTENSIVE_SUFFIX_TOKENS,Xe as INTENSIVE_WORD_TOKENS,Mt as IndexedText,yt as MAX_RUN_BOUNDS,Qe as POSITIONAL_SUFFIX_TOKENS,Je as POSITIONAL_WORD_TOKENS,Dt as PREVIEW_OMITTED_FIELDS,C as ROLE_MATCH_PCT,ye as SIMPLE_STRING_HASH,ge as STR,pe as SUBSTRING_MIN,ee as SUPPORTED_LANGUAGES,te as SUPPORTED_LANGUAGE_CODES,N as admin1MatchPct,ut as allowedAggregations,Be as buildGeoIsoColumn,Oe as buildGeoPointColumns,Fe as cityMatchPct,ke as cityTagsFor,Rt as classifyAdditivity,at as classifyForAggregation,At as classifyNumericValueNature,Pt as classifyTemporal,ot as codeNeedsLegacyAggNames,ft as codeReadsColumn,pt as codeReadsColumnsByRoleOrPosition,nt as collapseRepeatedAggPrefix,dt as columnsTheCodeReads,We as countryRegion,bt as decimalSeparatorOf,lt as defaultAggregation,It as detectDecimalSeparator,je as detectFormatSignature,ze as detectGeo,ve as detectOrdinalDomain,xt as detectTextDatePattern,Gt as encodePayload,Nt as engineTypeForSqlType,rt as englishImplicitAggNames,re as foldName,Kt as freemiumColumnCapRefusal,Z as freemiumColumnsOverCap,X as freemiumDateHierarchyClauses,fe as gluedPrefixStems,Et as gzipWireText,tt as hasDefaultAggPrefix,ae as hasUnsegmentedScript,Tt as hostAggHint,_t as ingest,ct as isAggregationAllowed,I as isBlankLike,_e as isCityTableLoaded,he as isDeterministicRefusal,Ge as isGeoPointAmbiguity,St as isIdentifierName,Ue as isJoinGeoKind,Ft as isNdjsonContentType,be as isOrdinalFriendlyName,wt as keyedSigner,Ae as localMidnightDateColumns,Re as localMidnightToUtcDay,x as looksLikeCountryColumn,de as matchNameToken,ht as measureCadence,Ot as messageSignature,Ze as monthLookupFor,st as nameLooksIntensiveRate,it as nameLooksPositional,ie as nameWords,De as normalizeCountry,Me as normalizeLocalMidnightDates,qe as normalizeMonthKey,M as normalizePlaceName,Ee as normalizeZip5,xe as parseDateStable,vt as parseNumberText,Ct as parseTemporalPoint,Lt as payloadPreview,$t as readGenerateStream,se as readName,kt as readWireField,Ne as registerCityTable,Ke as registerIso3Regions,d as resolveAdmin1,we as resolveGeoPoint,oe as resolveLanguage,Ht as resolvePointRoles,Ie as safeDistinctValuesToShip,mt as shareOfTotalIsHonest,et as stripHostAggPrefix,Ve as summarizeCountryRegions,He as summarizeGeoExtent,ne as supportedLanguage,$e as toGeoIso,ue as unsegmentedRuns,Pe as wholeDayFrame,Te as wholeDayIso,zt as wireResponseFromFetch,ce as wordEndsWith,z as zipMatchPct,v as zipPrefixCandidates,Le as zipToPrefix3};
2
+ import{a as zn,b as Bn}from"./chunk-UQU75XXR.mjs";import{a as Wn,b as $n,c as Kn,d as Vn,e as f,f as Un,g as Hn,h as Qn}from"./chunk-BIC73LQV.mjs";import{a as Gn,b as On,c as _n,d as Fn,e as En}from"./chunk-ZFTP4NSP.mjs";import{A as Mn,B as An,C as Nn,D as wn,E as kn,F as In,G as Ln,I as Dn,a as Ze,b as Xe,c as Ye,d as Je,e as on,f as rn,g as sn,h as an,i as un,j as ln,k as cn,l as mn,m as fn,n as dn,o as pn,p as gn,q as yn,r as Cn,s as Pn,t as hn,u as Rn,v as Sn,w as xn,x as bn,y as Tn,z as vn}from"./chunk-PFCJESUQ.mjs";import{a as en}from"./chunk-QEH7WTLB.mjs";import{a as nn,b as tn}from"./chunk-2LR73DNS.mjs";import{a as j,b as q,c as He,d as Qe,e as je,f as qe}from"./chunk-C5I73OM2.mjs";import{a as w,f as k,g as R,h as I,i as F,j as _e,k as Fe,l as Q,m as y,n as Ee,o as ze,p as Be,q as L,r as We,s as $e,t as Ke,u as Ve,v as E,w as Ue}from"./chunk-TPVDJHU6.mjs";import"./chunk-5MRZID36.mjs";import{a as De,b as Ge,c as Oe}from"./chunk-35Z7JCND.mjs";import{A as Le,a as ae,b as ue,c as le,d as ce,e as me,f as fe,g as de,h as pe,i as ge,j as ye,k as Ce,l as Pe,m as he,n as Re,o as Se,p as xe,r as be,s as Te,t as ve,u as Me,v as Ae,w as Ne,x as we,y as ke,z as Ie}from"./chunk-ILHBRGIO.mjs";var z=2,Y=400;function W(n){return!!k(n)}function v(n){let e=new Set;for(let t of n){if(t==null)continue;let i=w(String(t));if(!I(i)&&!e.has(i)&&(e.add(i),e.size>=Y))break}return Array.from(e)}function T(n){let e=v(n);if(e.length===0||$(n)<95)return!1;let t=e.filter(c=>W(c)&&!y(c)).length,i=e.filter(c=>!W(c)&&!!y(c)).length;return t>=1&&t>=i}function Z(n,e){if(!y(n))return!1;let t=k(n);return t?e==="world"?!0:Q.has(t):!1}function $(n){let e=v(n);if(e.length===0)return 0;let t=0;for(let i of e)W(i)&&t++;return Math.round(t/e.length*1e3)/10}function D(n){let e=v(n);if(e.length===0)return 0;let t=0;for(let i of e)y(i)&&t++;return Math.round(t/e.length*1e3)/10}function V(n){let e=new Set;for(let t of n){if(t==null)continue;let i=String(t).trim();if(!I(w(i))&&!e.has(i)&&(e.add(i),e.size>=Y))break}return Array.from(e)}function K(n){let e=V(n);if(e.length===0)return 0;let t=0;for(let i of e)L(i).length>0&&t++;return Math.round(t/e.length*1e3)/10}function X(n,e){return q(e,j)?!0:V(n).some(t=>/^\d{5}(-\d{4})?$/.test(t.replace(/\.0+$/,"")))}function jn(n,e){let t=v(n);if(t.length===0)return 0;let i=0;for(let c of t)E(c,e)&&i++;return Math.round(i/t.length*1e3)/10}function B(n,e){let t=0;for(let i of v(n))e(i)&&t++;return t}function qn(n,e){let t=0;for(let i of V(n))e(i)&&t++;return t}function Zn(n,e,t,i,c){let a=[],s=[],r={},C={},x=new Set(n),d=o=>e.map(u=>u[o]);for(let o of["city","country"]){let u=t?.[o];u&&x.has(u)&&(r[o]=u)}let re=new Set(c??n);for(let o of["lat","lon"]){let u=t?.[o];u&&re.has(u)&&(r[o]=u)}let P=t?.zip;if(P&&x.has(P)){let o=d(P),u=K(o);u<95?s.push(`zip=${P} (only ${u}% of values read as ZIPs)`):X(o,P)?r.zip=P:s.push(`zip=${P} (all values are 3-4 digits with nothing to say they are postal)`)}let g=t?.state;if(g&&x.has(g)){let o=d(g),u=v(o);u.length>0&&u.every(m=>Z(m,i))?s.push(`state=${g} (every value is "CA", which is both Canada and California)`):T(o)?(s.push(`state=${g} (every value is a country, not a state)`),r.country||(r.country=g)):D(o)<95?s.push(`state=${g} (only ${D(o)}% of values are states/provinces)`):r.state=g}let h=new Set(Object.values(r).filter(Boolean)),A=n.filter(o=>!h.has(o)&&!o.startsWith("__"));if(!r.state){let o=null;for(let u of A){let m=d(u);if(T(m))continue;let p=D(m);if(p<95)continue;let _=B(m,N=>!!y(N)),se=B(m,N=>!!y(N)&&!Z(N,i));_<z&&se<1||(!o||p>o.pct)&&(o={name:u,pct:p})}o&&(r.state=o.name,h.add(o.name),a.push(`state=${o.name} (${o.pct}% states/provinces)`))}if(!r.zip)for(let o of A){if(h.has(o))continue;let u=d(o),m=K(u);if(!(m<95)&&X(u,o)&&!(qn(u,p=>L(p).length>0)<z)){r.zip=o,h.add(o),a.push(`zip=${o} (${m}% ZIP codes)`);break}}let b=r.country;if(!b||!T(d(b))){let o=null;for(let u of A){if(h.has(u)||!T(d(u)))continue;let m=$(d(u));(!o||m>o.pct)&&(o={name:u,pct:m})}o&&(b&&(s.push(`country=${b} (only ${$(d(b))}% of values are country identifiers; using ${o.name} instead)`),C.country=b),r.country=o.name,h.add(o.name),a.push(`country=${o.name}`))}if(!r.city){let o=null;for(let u of A){if(h.has(u))continue;let m=d(u),p=jn(m,i);p<F||B(m,_=>E(_,i))<z||(!o||p>o.pct)&&(o={name:u,pct:p})}o&&(r.city=o.name,a.push(`city=${o.name} (${o.pct}% known cities)`))}let U=r.country?d(r.country):[],G=!!r.country&&T(U),ie=G?new Set(U.map(o=>k(o==null?null:String(o))).filter(Boolean)).size:0,H=G&&ie>=2,O=!!(r.lat&&r.lon)&&e.some(o=>{let u=+String(o[r.lat]??"").trim(),m=+String(o[r.lon]??"").trim();return isFinite(u)&&isFinite(m)&&u>=-90&&u<=90&&m>=-180&&m<=180&&String(o[r.lat]??"").trim()!==""&&String(o[r.lon]??"").trim()!==""});return r.lat&&r.lon&&!O&&s.push(`lat/lon=${r.lat}/${r.lon} (no row holds a usable coordinate pair)`),r.country&&!H&&!(r.city||r.state||r.zip||O)&&s.push(G?`country=${r.country} (every row resolves to the same country - nothing to place apart)`:`country=${r.country} (values are not country identifiers)`),{bind:!!(r.city||r.state||r.zip||H||O)?r:null,backfilled:a,refused:s,...Object.keys(C).length?{labelFallback:C}:{}}}function J(n,e){let t=e?.freemiumMaxShapeColumns;return typeof t!="number"||!isFinite(t)||t<1?null:!isFinite(n)||n<=t?0:Math.round(n-t)}function Xn(n,e,t){let i=J(n,e);if(i===null||i<=0)return null;let c=typeof e?.freemiumColumnCapPivot=="number"?e.freemiumColumnCapPivot:4,a=i>c?e?.freemiumColumnCapMessageMany:e?.freemiumColumnCapMessageFew;if(typeof a!="string"||a.trim().length===0)return null;let s=a.split("{n}").join(String(i)).split("{fields}").join(i===1?"field":"fields"),r=ee(t);return r.length===0?s:s+" "+r.join(" ")}function ee(n){if(!n||n.length===0)return[];let e=[],t=new Map,i=new Map;for(let a of n){let s=typeof a?.dateGroupId=="string"?a.dateGroupId.trim():"";if(s!==""&&(t.has(s)||(e.push(s),t.set(s,0)),a.isDatePart===!0&&t.set(s,t.get(s)+1),a.isReassembledDate===!0&&!i.has(s))){let r=typeof a.sourceField=="string"?a.sourceField.trim():"",C=typeof a.name=="string"?a.name.trim():"",x=r!==""?r:C;x!==""&&i.set(s,x)}}let c=[];for(let a of e){let s=i.get(a),r=t.get(a)??0;!s||r===0||c.push(`'${s}' is a date hierarchy and counts as ${r+1} fields - bind the date itself instead of its hierarchy.`)}return c}var l=n=>n==null?"":String(n),S=n=>n===!0,ne=n=>{if(typeof n=="number")return Number.isFinite(n)?n:null;if(typeof n=="string"&&n.trim()!==""){let e=Number(n);return Number.isFinite(e)?e:null}return null},Yn=[["city","CityColumn"],["state","StateColumn"],["zip","ZipColumn"],["lat","LatColumn"],["lon","LonColumn"],["country","CountryColumn"]];function te(n,e){let t={};for(let[i,c]of Yn){let a=l(f(n,e+c));a&&(t[i]=a)}return t}function Jn(n){let e=a=>f(n,a),t=e("retryAfterSeconds"),i=te(n,"point"),c=te(n,"destPoint");return Object.keys(c).length&&(i.dest=c),{errorMessage:l(e("errorMessage")),code:l(e("code")),language:l(e("language")),version:Number(e("version")??0),codeSummary:l(e("codeSummary")),chartName:l(e("chartName")??e("chartType")),finalChartName:l(e("finalChartName")),warningMessage:l(e("warningMessage")),outputHash:l(e("outputHash")),validatorToken:l(e("validatorToken")),editCodeKey:l(e("editCodeKey")),signedLLMRequestID:l(e("signedLLMRequestID")),userReply:l(e("userReply")),userReplyOutcome:l(e("userReplyOutcome")),improvementSuggestion:l(e("improvementSuggestion")),geoColumn:l(e("geoColumn")),geoKind:l(e("geoKind")),geoPointCols:Object.keys(i).length?i:null,creditBalanceBefore:ne(e("creditBalanceBefore")),creditCost:ne(e("creditCost")),isServiceError:S(e("isServiceError")),isRateLimited:S(e("isRateLimited")),isRefusal:S(e("isRefusal")),isVersionNotFound:S(e("isVersionNotFound")),isGenerationCancelled:S(e("isGenerationCancelled")),retryAfterSeconds:typeof t=="number"&&Number.isFinite(t)?t:null,servedCorrelationId:l(e("servedCorrelationId"))}}var oe=n=>n==null?void 0:Number(n),M=n=>l(n)||void 0;function et(n){let e=f(n,"charts"),t=f(n,"refused"),i=Array.isArray(e)?e.map(a=>{let s=C=>f(a,C),r=s("recommended");return{name:l(s("chartTypeName")??s("name")),description:l(s("description")??s("chartDesc")),rank:oe(s("rank")),score:oe(s("score")),renderer:M(s("renderer")),language:M(s("language")),isPreview:S(s("isPreview")),recommended:typeof r=="boolean"?r:void 0,viaProjection:M(s("viaProjection")),viaProjectionKey:M(s("viaProjectionKey")),detailNote:M(s("detailNote"))}}).filter(a=>a.name):null,c=Array.isArray(t)?t.map(a=>({name:l(f(a,"chartTypeName")??f(a,"name")),reason:l(f(a,"reason")),isVeto:S(f(a,"isVeto"))})).filter(a=>a.name):[];return{errorMessage:l(f(n,"errorMessage")),charts:i,refused:c,noFitSummary:l(f(n,"noFitSummary"))}}function nt(n){return!n||typeof n!="object"?null:{status:String(f(n,"status")??""),verdictReason:f(n,"verdictReason")??null,instruction:f(n,"instruction")??null,fix:f(n,"fix")??null,errorMessage:f(n,"errorMessage")??null}}export{F as CITY_ROLE_MATCH_PCT,ye as COMPOUND_MIN_STEM,bn as DEFAULT_GAP_FACTOR,Me as DEFAULT_TEMPERATURE,Te as GET_RANDOM,Pe as GLUED_STEM_MIN,rn as INTENSIVE_SUFFIX_TOKENS,on as INTENSIVE_WORD_TOKENS,Dn as IndexedText,Tn as MAX_RUN_BOUNDS,an as POSITIONAL_SUFFIX_TOKENS,sn as POSITIONAL_WORD_TOKENS,zn as PREVIEW_OMITTED_FIELDS,R as ROLE_MATCH_PCT,be as SIMPLE_STRING_HASH,xe as STR,Re as SUBSTRING_MIN,ae as SUPPORTED_LANGUAGES,ue as SUPPORTED_LANGUAGE_CODES,D as admin1MatchPct,yn as allowedAggregations,qe as buildGeoIsoColumn,Ke as buildGeoPointColumns,Ue as cityMatchPct,Ve as cityTagsFor,In as classifyAdditivity,gn as classifyForAggregation,Ln as classifyNumericValueNature,wn as classifyTemporal,mn as codeNeedsLegacyAggNames,Rn as codeReadsColumn,Sn as codeReadsColumnsByRoleOrPosition,cn as collapseRepeatedAggPrefix,xn as columnsTheCodeReads,Ye as countryRegion,Gn as decimalSeparatorOf,Cn as defaultAggregation,On as detectDecimalSeparator,en as detectFormatSignature,He as detectGeo,Oe as detectOrdinalDomain,Nn as detectTextDatePattern,$n as encodePayload,Fn as engineTypeForSqlType,fn as englishImplicitAggNames,me as foldName,Xn as freemiumColumnCapRefusal,J as freemiumColumnsOverCap,ee as freemiumDateHierarchyClauses,he as gluedPrefixStems,Wn as gzipWireText,ln as hasDefaultAggPrefix,pe as hasUnsegmentedScript,kn as hostAggHint,En as ingest,Pn as isAggregationAllowed,I as isBlankLike,Fe as isCityTableLoaded,ve as isDeterministicRefusal,We as isGeoPointAmbiguity,An as isIdentifierName,je as isJoinGeoKind,Un as isNdjsonContentType,De as isOrdinalFriendlyName,Kn as keyedSigner,Ie as localMidnightDateColumns,ke as localMidnightToUtcDay,T as looksLikeCountryColumn,Se as matchNameToken,Mn as measureCadence,Vn as messageSignature,tn as monthLookupFor,pn as nameLooksIntensiveRate,dn as nameLooksPositional,fe as nameWords,Ee as normalizeCountry,Le as normalizeLocalMidnightDates,nn as normalizeMonthKey,w as normalizePlaceName,Be as normalizeZip5,Ae as parseDateStable,Jn as parseGenerateResponse,_n as parseNumberText,et as parseQualifyResponse,nt as parseReviewVerdict,vn as parseTemporalPoint,Bn as payloadPreview,Qn as readGenerateStream,de as readName,f as readWireField,_e as registerCityTable,Xe as registerIso3Regions,y as resolveAdmin1,$e as resolveGeoPoint,ce as resolveLanguage,Zn as resolvePointRoles,Ge as safeDistinctValuesToShip,hn as shareOfTotalIsHonest,un as stripHostAggPrefix,Je as summarizeCountryRegions,Ze as summarizeGeoExtent,le as supportedLanguage,Qe as toGeoIso,ge as unsegmentedRuns,Ne as wholeDayFrame,we as wholeDayIso,Hn as wireResponseFromFetch,Ce as wordEndsWith,K as zipMatchPct,L as zipPrefixCandidates,ze as zipToPrefix3};
@@ -40,3 +40,5 @@ export type { WireSigner, WireTransport, WireResponse, CredentialTriple, Credent
40
40
  export { encodePayload, gzipWireText, keyedSigner, messageSignature, readWireField } from "./wire";
41
41
  export type { GzipText } from "./wire";
42
42
  export { readGenerateStream, isNdjsonContentType, wireResponseFromFetch } from "./wireStream";
43
+ export { parseGenerateResponse, parseQualifyResponse, parseReviewVerdict } from "./wireParse";
44
+ export type { ParsedGenerateResponse, ParsedQualifyResponse, ParsedQualifyChart, ParsedQualifyRefusal, ParsedReviewVerdict, WirePointBinding, WirePointColumns, } from "./wireParse";
@@ -0,0 +1,117 @@
1
+ /** The columns a point map resolves a coordinate from, by role. Only roles the server named. */
2
+ export interface WirePointColumns {
3
+ city?: string;
4
+ state?: string;
5
+ zip?: string;
6
+ lat?: string;
7
+ lon?: string;
8
+ country?: string;
9
+ }
10
+ /** A point binding; `dest` is the second endpoint of a route (an origin-destination flow map). */
11
+ export interface WirePointBinding extends WirePointColumns {
12
+ dest?: WirePointColumns;
13
+ }
14
+ /** A generate result's fields, typed. */
15
+ export interface ParsedGenerateResponse {
16
+ /** The server's own words when it declined. "" on a success. */
17
+ errorMessage: string;
18
+ code: string;
19
+ language: string;
20
+ /** 0 when absent. */
21
+ version: number;
22
+ codeSummary: string;
23
+ /** The chart drawn: the wire's `chartName` (an older server's `chartType`). */
24
+ chartName: string;
25
+ /** The chart the server settled on after any substitution. */
26
+ finalChartName: string;
27
+ warningMessage: string;
28
+ outputHash: string;
29
+ validatorToken: string;
30
+ editCodeKey: string;
31
+ signedLLMRequestID: string;
32
+ userReply: string;
33
+ userReplyOutcome: string;
34
+ improvementSuggestion: string;
35
+ geoColumn: string;
36
+ geoKind: string;
37
+ /** The point-map binding, packed from the point columns the server named; null when none. */
38
+ geoPointCols: WirePointBinding | null;
39
+ creditBalanceBefore: number | null;
40
+ creditCost: number | null;
41
+ isServiceError: boolean;
42
+ isRateLimited: boolean;
43
+ /** A verdict the server reached before any model ran; asking again gets the same answer. */
44
+ isRefusal: boolean;
45
+ isVersionNotFound: boolean;
46
+ isGenerationCancelled: boolean;
47
+ /** Seconds until a throttle clears, only when the server sent a finite number. */
48
+ retryAfterSeconds: number | null;
49
+ /** Whose generation a fetch by correlation served; "" when the server did not say. */
50
+ servedCorrelationId: string;
51
+ }
52
+ /**
53
+ * A generate result body -> its fields, typed. Also reads a fetch by correlation and the fix a
54
+ * vision review returns, which are the same shape. A null or non-object body reads as empty.
55
+ */
56
+ export declare function parseGenerateResponse(data: unknown): ParsedGenerateResponse;
57
+ /** One chart type that qualifies, as the server describes it. */
58
+ export interface ParsedQualifyChart {
59
+ /** The wire's `name` (an older server's `chartTypeName`). Never empty: a nameless row is dropped. */
60
+ name: string;
61
+ /** The wire's `description` (an older server's `chartDesc`). */
62
+ description: string;
63
+ /** 1 = the best fit; undefined when the server sent none. */
64
+ rank: number | undefined;
65
+ /** 0..100 relative weight; undefined when the server sent none. */
66
+ score: number | undefined;
67
+ renderer: string | undefined;
68
+ language: string | undefined;
69
+ /** True only when the server said so: a newer, less proven type. */
70
+ isPreview: boolean;
71
+ /** False = a required channel is poorly served; undefined = unassessed, never a demotion. */
72
+ recommended: boolean | undefined;
73
+ /** Non-empty when the type qualifies only against an aggregated projection. */
74
+ viaProjection: string | undefined;
75
+ viaProjectionKey: string | undefined;
76
+ /** Why the type moved under a level-of-detail preference, in the reader's terms. */
77
+ detailNote: string | undefined;
78
+ }
79
+ /** One chart type that did not qualify, and why. */
80
+ export interface ParsedQualifyRefusal {
81
+ name: string;
82
+ /** A sentence naming one requirement the data fails; "" when the server could not name it. */
83
+ reason: string;
84
+ /**
85
+ * True only when the server said so: a required channel is absent and no rebinding supplies
86
+ * it. Absent, null or anything but true reads as a preference an explicit pick may override -
87
+ * the safe direction on an older server.
88
+ */
89
+ isVeto: boolean;
90
+ }
91
+ /** A qualify answer's fields, typed. */
92
+ export interface ParsedQualifyResponse {
93
+ errorMessage: string;
94
+ /** In the server's order - it IS the ranking. null when the body carried no list at all. */
95
+ charts: ParsedQualifyChart[] | null;
96
+ refused: ParsedQualifyRefusal[];
97
+ /** The server's headline for an empty list, when it can state a fact; "" otherwise. */
98
+ noFitSummary: string;
99
+ }
100
+ /** A qualify ("what fits") body -> its fields, typed. A null or non-object body reads as empty. */
101
+ export declare function parseQualifyResponse(data: unknown): ParsedQualifyResponse;
102
+ /** A vision-review verdict's fields. */
103
+ export interface ParsedReviewVerdict {
104
+ /** "PROPOSED" | "OK" | "NOCHANGE" | "REFUSED" | "ERROR", or whatever a newer server sends. */
105
+ status: string;
106
+ verdictReason: string | null;
107
+ /** Set on PROPOSED: the instruction, sent back verbatim if the reader accepts. */
108
+ instruction: string | null;
109
+ /**
110
+ * On OK, the finished fix: a whole generate result, left as the raw body because
111
+ * parseGenerateResponse is what reads that shape.
112
+ */
113
+ fix: unknown;
114
+ errorMessage: string | null;
115
+ }
116
+ /** A vision-review body -> its verdict. null for a null or non-object body. */
117
+ export declare function parseReviewVerdict(data: unknown): ParsedReviewVerdict | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bicharts/shape-core",
3
- "version": "0.6.5",
3
+ "version": "0.6.7",
4
4
  "description": "Host-agnostic data-shape profiler: ingest a dataset's rows through IValueCollection.addRow and read back the measured shape as an LLMColumnWithValue[] payload — types, cardinality, temporal/ordinal detection, geographic region and point resolution, cross-column signals. MEASUREMENT only: the policy that decides what a measured shape means for chart selection lives server-side.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",