@bicharts/shape-core 0.6.18 → 0.6.19
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 +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/wireBuild.d.ts +20 -1
- package/package.json +1 -1
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 Un,b as Qn}from"./chunk-UQU75XXR.mjs";import{a as jn,b as qn,c as Xn,d as Zn,e as f,f as Yn,g as Jn,h as et}from"./chunk-BIC73LQV.mjs";import{a as zn,b as Bn,c as Wn,d as $n,e as Hn}from"./chunk-PK6KRKNE.mjs";import{A as Mn,B as Tn,C as Fn,D as An,E as In,F as kn,G as Ln,H as En,I as On,J as _n,K as Dn,L as Gn,M as Vn,O as Kn,a as Ze,b as Ye,c as Je,d as en,e as on,f as sn,g as an,h as ln,i as un,j as cn,k as mn,l as fn,m as dn,n as pn,o as gn,p as yn,q as Cn,r as hn,s as Sn,t as Pn,u as Rn,v as xn,w as bn,x as vn,y as Nn,z as wn}from"./chunk-ZVHCLXKO.mjs";import{a as nn}from"./chunk-QEH7WTLB.mjs";import{a as tn,b as rn}from"./chunk-2LR73DNS.mjs";import{a as j,b as q,c as Qe,d as je,e as qe,f as Xe}from"./chunk-C5I73OM2.mjs";import{a as F,f as A,g as P,h as I,i as D,j as De,k as Ge,l as Q,m as y,n as Ve,o as Ke,p as ze,q as k,r as Be,s as We,t as $e,u as He,v as G,w as Ue}from"./chunk-TPVDJHU6.mjs";import"./chunk-5MRZID36.mjs";import{a as Ee,b as Oe,c as _e}from"./chunk-35Z7JCND.mjs";import{A as Le,a as le,b as ue,c as ce,d as me,e as fe,f as de,g as pe,h as ge,i as ye,j as Ce,k as he,l as Se,m as Pe,n as Re,o as xe,p as be,r as ve,s as Ne,t as we,u as Me,v as Te,w as Fe,x as Ae,y as Ie,z as ke}from"./chunk-ILHBRGIO.mjs";var V=2,Y=400;function z(n){return!!A(n)}function N(n){let e=new Set;for(let t of n){if(t==null)continue;let o=F(String(t));if(!I(o)&&!e.has(o)&&(e.add(o),e.size>=Y))break}return Array.from(e)}function v(n){let e=N(n);if(e.length===0||B(n)<95)return!1;let t=e.filter(u=>z(u)&&!y(u)).length,o=e.filter(u=>!z(u)&&!!y(u)).length;return t>=1&&t>=o}function X(n,e){if(!y(n))return!1;let t=A(n);return t?e==="world"?!0:Q.has(t):!1}function B(n){let e=N(n);if(e.length===0)return 0;let t=0;for(let o of e)z(o)&&t++;return Math.round(t/e.length*1e3)/10}function L(n){let e=N(n);if(e.length===0)return 0;let t=0;for(let o of e)y(o)&&t++;return Math.round(t/e.length*1e3)/10}function $(n){let e=new Set;for(let t of n){if(t==null)continue;let o=String(t).trim();if(!I(F(o))&&!e.has(o)&&(e.add(o),e.size>=Y))break}return Array.from(e)}function W(n){let e=$(n);if(e.length===0)return 0;let t=0;for(let o of e)k(o).length>0&&t++;return Math.round(t/e.length*1e3)/10}function Z(n,e){return q(e,j)?!0:$(n).some(t=>/^\d{5}(-\d{4})?$/.test(t.replace(/\.0+$/,"")))}function nt(n,e){let t=N(n);if(t.length===0)return 0;let o=0;for(let u of t)G(u,e)&&o++;return Math.round(o/t.length*1e3)/10}function K(n,e){let t=0;for(let o of N(n))e(o)&&t++;return t}function tt(n,e){let t=0;for(let o of $(n))e(o)&&t++;return t}function rt(n,e,t,o,u){let a=[],s=[],i={},C={},x=new Set(n),d=r=>e.map(l=>l[r]);for(let r of["city","country"]){let l=t?.[r];l&&x.has(l)&&(i[r]=l)}let ie=new Set(u??n);for(let r of["lat","lon"]){let l=t?.[r];l&&ie.has(l)&&(i[r]=l)}let h=t?.zip;if(h&&x.has(h)){let r=d(h),l=W(r);l<95?s.push(`zip=${h} (only ${l}% of values read as ZIPs)`):Z(r,h)?i.zip=h:s.push(`zip=${h} (all values are 3-4 digits with nothing to say they are postal)`)}let g=t?.state;if(g&&x.has(g)){let r=d(g),l=N(r);l.length>0&&l.every(m=>X(m,o))?s.push(`state=${g} (every value is "CA", which is both Canada and California)`):v(r)?(s.push(`state=${g} (every value is a country, not a state)`),i.country||(i.country=g)):L(r)<95?s.push(`state=${g} (only ${L(r)}% of values are states/provinces)`):i.state=g}let S=new Set(Object.values(i).filter(Boolean)),M=n.filter(r=>!S.has(r)&&!r.startsWith("__"));if(!i.state){let r=null;for(let l of M){let m=d(l);if(v(m))continue;let p=L(m);if(p<95)continue;let _=K(m,T=>!!y(T)),ae=K(m,T=>!!y(T)&&!X(T,o));_<V&&ae<1||(!r||p>r.pct)&&(r={name:l,pct:p})}r&&(i.state=r.name,S.add(r.name),a.push(`state=${r.name} (${r.pct}% states/provinces)`))}if(!i.zip)for(let r of M){if(S.has(r))continue;let l=d(r),m=W(l);if(!(m<95)&&Z(l,r)&&!(tt(l,p=>k(p).length>0)<V)){i.zip=r,S.add(r),a.push(`zip=${r} (${m}% ZIP codes)`);break}}let b=i.country;if(!b||!v(d(b))){let r=null;for(let l of M){if(S.has(l)||!v(d(l)))continue;let m=B(d(l));(!r||m>r.pct)&&(r={name:l,pct:m})}r&&(b&&(s.push(`country=${b} (only ${B(d(b))}% of values are country identifiers; using ${r.name} instead)`),C.country=b),i.country=r.name,S.add(r.name),a.push(`country=${r.name}`))}if(!i.city){let r=null;for(let l of M){if(S.has(l))continue;let m=d(l),p=nt(m,o);p<D||K(m,_=>G(_,o))<V||(!r||p>r.pct)&&(r={name:l,pct:p})}r&&(i.city=r.name,a.push(`city=${r.name} (${r.pct}% known cities)`))}let H=i.country?d(i.country):[],E=!!i.country&&v(H),se=E?new Set(H.map(r=>A(r==null?null:String(r))).filter(Boolean)).size:0,U=E&&se>=2,O=!!(i.lat&&i.lon)&&e.some(r=>{let l=+String(r[i.lat]??"").trim(),m=+String(r[i.lon]??"").trim();return isFinite(l)&&isFinite(m)&&l>=-90&&l<=90&&m>=-180&&m<=180&&String(r[i.lat]??"").trim()!==""&&String(r[i.lon]??"").trim()!==""});return i.lat&&i.lon&&!O&&s.push(`lat/lon=${i.lat}/${i.lon} (no row holds a usable coordinate pair)`),i.country&&!U&&!(i.city||i.state||i.zip||O)&&s.push(E?`country=${i.country} (every row resolves to the same country - nothing to place apart)`:`country=${i.country} (values are not country identifiers)`),{bind:!!(i.city||i.state||i.zip||U||O)?i: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 ot(n,e,t){let o=J(n,e);if(o===null||o<=0)return null;let u=typeof e?.freemiumColumnCapPivot=="number"?e.freemiumColumnCapPivot:4,a=o>u?e?.freemiumColumnCapMessageMany:e?.freemiumColumnCapMessageFew;if(typeof a!="string"||a.trim().length===0)return null;let s=a.split("{n}").join(String(o)).split("{fields}").join(o===1?"field":"fields"),i=ee(t);return i.length===0?s:s+" "+i.join(" ")}function ee(n){if(!n||n.length===0)return[];let e=[],t=new Map,o=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&&!o.has(s))){let i=typeof a.sourceField=="string"?a.sourceField.trim():"",C=typeof a.name=="string"?a.name.trim():"",x=i!==""?i:C;x!==""&&o.set(s,x)}}let u=[];for(let a of e){let s=o.get(a),i=t.get(a)??0;!s||i===0||u.push(`'${s}' is a date hierarchy and counts as ${i+1} fields - bind the date itself instead of its hierarchy.`)}return u}var c=n=>n==null?"":String(n),R=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},it=[["city","CityColumn"],["state","StateColumn"],["zip","ZipColumn"],["lat","LatColumn"],["lon","LonColumn"],["country","CountryColumn"]];function te(n,e){let t={};for(let[o,u]of it){let a=c(f(n,e+u));a&&(t[o]=a)}return t}function st(n){let e=a=>f(n,a),t=e("retryAfterSeconds"),o=te(n,"point"),u=te(n,"destPoint");return Object.keys(u).length&&(o.dest=u),{errorMessage:c(e("errorMessage")),code:c(e("code")),language:c(e("language")),version:Number(e("version")??0),codeSummary:c(e("codeSummary")),chartName:c(e("chartName")??e("chartType")),finalChartName:c(e("finalChartName")),warningMessage:c(e("warningMessage")),outputHash:c(e("outputHash")),validatorToken:c(e("validatorToken")),editCodeKey:c(e("editCodeKey")),signedLLMRequestID:c(e("signedLLMRequestID")),userReply:c(e("userReply")),userReplyOutcome:c(e("userReplyOutcome")),improvementSuggestion:c(e("improvementSuggestion")),geoColumn:c(e("geoColumn")),geoKind:c(e("geoKind")),geoPointCols:Object.keys(o).length?o:null,creditBalanceBefore:ne(e("creditBalanceBefore")),creditCost:ne(e("creditCost")),isServiceError:R(e("isServiceError")),isRateLimited:R(e("isRateLimited")),isRefusal:R(e("isRefusal")),isVersionNotFound:R(e("isVersionNotFound")),isGenerationCancelled:R(e("isGenerationCancelled")),retryAfterSeconds:typeof t=="number"&&Number.isFinite(t)?t:null,servedCorrelationId:c(e("servedCorrelationId"))}}var re=n=>n==null?void 0:Number(n),w=n=>c(n)||void 0;function at(n){let e=f(n,"charts"),t=f(n,"refused"),o=Array.isArray(e)?e.map(a=>{let s=C=>f(a,C),i=s("recommended");return{name:c(s("chartTypeName")??s("name")),description:c(s("description")??s("chartDesc")),rank:re(s("rank")),score:re(s("score")),renderer:w(s("renderer")),language:w(s("language")),isPreview:R(s("isPreview")),recommended:typeof i=="boolean"?i:void 0,viaProjection:w(s("viaProjection")),viaProjectionKey:w(s("viaProjectionKey")),detailNote:w(s("detailNote"))}}).filter(a=>a.name):null,u=Array.isArray(t)?t.map(a=>({name:c(f(a,"chartTypeName")??f(a,"name")),reason:c(f(a,"reason")),isVeto:R(f(a,"isVeto"))})).filter(a=>a.name):[];return{errorMessage:c(f(n,"errorMessage")),charts:o,refused:u,noFitSummary:c(f(n,"noFitSummary"))}}function lt(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}}function ut(n){let e=n.linkNonce?(n.linkNonce()??"").trim():null,t=e?{licensee:"",licenseKey:"",secretKey:""}:n.triple();return{request:{licenseKey:t.licenseKey,licensee:t.licensee,secretKey:t.secretKey,freemiumKey:n.freemiumKey?.()??""},linkNonce:e}}function ct(n){let{width:e,height:t}=n.measure();return{request:{height:t,width:e},hints:{viewportWidth:e,viewportHeight:t}}}function mt(n){let e=0;for(let t of n){if(t.isMeasure)continue;let o=t.distinctCount;typeof o=="number"&&o>e&&(e=o)}return e}function oe(n){if(n.recoveryFetchByCorrelation)return{version:null,fetchOnly:!0};if(n.recoveryFetchVersion!=null)return{version:n.recoveryFetchVersion,fetchOnly:!0};let e=n.settingVersion??null;if(n.genNew)return{version:e,fetchOnly:void 0};let t=(e??0)>0?e:null,o=(n.codeVersion??0)>0?n.codeVersion:null,u=t??o??e;return{version:u,fetchOnly:u!=null&&u>0?!0:void 0}}function ft(n){let e=n.fetchCorrelationId!=null,o=e||n.recoveryFetchVersion!=null?!1:n.genNew,u=oe({genNew:o,recoveryFetchVersion:n.recoveryFetchVersion,recoveryFetchByCorrelation:e,settingVersion:n.settingVersion,codeVersion:n.codeVersion});return{genNew:o,version:u.version,fetchOnly:u.fetchOnly,fetchCorrelationId:n.fetchCorrelationId??void 0}}export{D as CITY_ROLE_MATCH_PCT,Ce as COMPOUND_MIN_STEM,vn as DEFAULT_GAP_FACTOR,Me as DEFAULT_TEMPERATURE,Ne as GET_RANDOM,Se as GLUED_STEM_MIN,sn as INTENSIVE_SUFFIX_TOKENS,on as INTENSIVE_WORD_TOKENS,Kn as IndexedText,Nn as MAX_RUN_BOUNDS,ln as POSITIONAL_SUFFIX_TOKENS,an as POSITIONAL_WORD_TOKENS,Un as PREVIEW_OMITTED_FIELDS,P as ROLE_MATCH_PCT,Tn as SERIES_COMPLETENESS_MAX_LISTED,Fn as SERIES_COMPLETENESS_MIN_FILL,An as SERIES_KEY_MAX_DISTINCT,ve as SIMPLE_STRING_HASH,be as STR,Re as SUBSTRING_MIN,le as SUPPORTED_LANGUAGES,ue as SUPPORTED_LANGUAGE_CODES,L as admin1MatchPct,Cn as allowedAggregations,Xe as buildGeoIsoColumn,$e as buildGeoPointColumns,Ue as cityMatchPct,He as cityTagsFor,Gn as classifyAdditivity,yn as classifyForAggregation,Vn as classifyNumericValueNature,_n as classifyTemporal,fn as codeNeedsLegacyAggNames,Rn as codeReadsColumn,xn as codeReadsColumnsByRoleOrPosition,mn as collapseRepeatedAggPrefix,bn as columnsTheCodeReads,Je as countryRegion,ut as credentialFields,zn as decimalSeparatorOf,hn as defaultAggregation,Bn as detectDecimalSeparator,nn as detectFormatSignature,Qe as detectGeo,_e as detectOrdinalDomain,On as detectTextDatePattern,qn as encodePayload,$n as engineTypeForSqlType,dn as englishImplicitAggNames,ft as fetchFields,fe as foldName,ot as freemiumColumnCapRefusal,J as freemiumColumnsOverCap,ee as freemiumDateHierarchyClauses,Pe as gluedPrefixStems,jn as gzipWireText,cn as hasDefaultAggPrefix,ge as hasUnsegmentedScript,Dn as hostAggHint,Hn as ingest,Sn as isAggregationAllowed,I as isBlankLike,Ge as isCityTableLoaded,we as isDeterministicRefusal,Be as isGeoPointAmbiguity,En as isIdentifierName,qe as isJoinGeoKind,Yn as isNdjsonContentType,Ee as isOrdinalFriendlyName,Xn as keyedSigner,ke as localMidnightDateColumns,Ie as localMidnightToUtcDay,v as looksLikeCountryColumn,xe as matchNameToken,mt as maxNonMeasureCardinality,Mn as measureCadence,Ln as measureSeriesCompleteness,Zn as messageSignature,rn as monthLookupFor,gn as nameLooksIntensiveRate,pn as nameLooksPositional,de as nameWords,Ve as normalizeCountry,Le as normalizeLocalMidnightDates,tn as normalizeMonthKey,F as normalizePlaceName,ze as normalizeZip5,Te as parseDateStable,st as parseGenerateResponse,Wn as parseNumberText,at as parseQualifyResponse,lt as parseReviewVerdict,wn as parseTemporalPoint,Qn as payloadPreview,kn as pickSeriesColumn,et as readGenerateStream,pe as readName,f as readWireField,De as registerCityTable,Ye as registerIso3Regions,y as resolveAdmin1,oe as resolveFetchVersion,We as resolveGeoPoint,me as resolveLanguage,rt as resolvePointRoles,Oe as safeDistinctValuesToShip,In as seriesKeyVerdict,Pn as shareOfTotalIsHonest,un as stripHostAggPrefix,en as summarizeCountryRegions,Ze as summarizeGeoExtent,ce as supportedLanguage,je as toGeoIso,ye as unsegmentedRuns,ct as viewportFields,Fe as wholeDayFrame,Ae as wholeDayIso,Jn as wireResponseFromFetch,he as wordEndsWith,W as zipMatchPct,k as zipPrefixCandidates,Ke as zipToPrefix3};
|
|
2
|
+
import{a as Un,b as Qn}from"./chunk-UQU75XXR.mjs";import{a as jn,b as qn,c as Xn,d as Zn,e as f,f as Yn,g as Jn,h as et}from"./chunk-BIC73LQV.mjs";import{a as zn,b as Bn,c as Wn,d as $n,e as Hn}from"./chunk-PK6KRKNE.mjs";import{A as Fn,B as Tn,C as Mn,D as An,E as In,F as kn,G as Ln,H as En,I as On,J as _n,K as Dn,L as Gn,M as Vn,O as Kn,a as Ze,b as Ye,c as Je,d as en,e as on,f as sn,g as an,h as ln,i as un,j as cn,k as dn,l as fn,m as mn,n as pn,o as gn,p as yn,q as Cn,r as hn,s as Sn,t as Pn,u as Rn,v as bn,w as xn,x as vn,y as Nn,z as wn}from"./chunk-ZVHCLXKO.mjs";import{a as nn}from"./chunk-QEH7WTLB.mjs";import{a as tn,b as rn}from"./chunk-2LR73DNS.mjs";import{a as j,b as q,c as Qe,d as je,e as qe,f as Xe}from"./chunk-C5I73OM2.mjs";import{a as M,f as A,g as P,h as I,i as D,j as De,k as Ge,l as Q,m as y,n as Ve,o as Ke,p as ze,q as k,r as Be,s as We,t as $e,u as He,v as G,w as Ue}from"./chunk-TPVDJHU6.mjs";import"./chunk-5MRZID36.mjs";import{a as Ee,b as Oe,c as _e}from"./chunk-35Z7JCND.mjs";import{A as Le,a as le,b as ue,c as ce,d as de,e as fe,f as me,g as pe,h as ge,i as ye,j as Ce,k as he,l as Se,m as Pe,n as Re,o as be,p as xe,r as ve,s as Ne,t as we,u as Fe,v as Te,w as Me,x as Ae,y as Ie,z as ke}from"./chunk-ILHBRGIO.mjs";var V=2,Y=400;function z(n){return!!A(n)}function N(n){let e=new Set;for(let t of n){if(t==null)continue;let o=M(String(t));if(!I(o)&&!e.has(o)&&(e.add(o),e.size>=Y))break}return Array.from(e)}function v(n){let e=N(n);if(e.length===0||B(n)<95)return!1;let t=e.filter(u=>z(u)&&!y(u)).length,o=e.filter(u=>!z(u)&&!!y(u)).length;return t>=1&&t>=o}function X(n,e){if(!y(n))return!1;let t=A(n);return t?e==="world"?!0:Q.has(t):!1}function B(n){let e=N(n);if(e.length===0)return 0;let t=0;for(let o of e)z(o)&&t++;return Math.round(t/e.length*1e3)/10}function L(n){let e=N(n);if(e.length===0)return 0;let t=0;for(let o of e)y(o)&&t++;return Math.round(t/e.length*1e3)/10}function $(n){let e=new Set;for(let t of n){if(t==null)continue;let o=String(t).trim();if(!I(M(o))&&!e.has(o)&&(e.add(o),e.size>=Y))break}return Array.from(e)}function W(n){let e=$(n);if(e.length===0)return 0;let t=0;for(let o of e)k(o).length>0&&t++;return Math.round(t/e.length*1e3)/10}function Z(n,e){return q(e,j)?!0:$(n).some(t=>/^\d{5}(-\d{4})?$/.test(t.replace(/\.0+$/,"")))}function nt(n,e){let t=N(n);if(t.length===0)return 0;let o=0;for(let u of t)G(u,e)&&o++;return Math.round(o/t.length*1e3)/10}function K(n,e){let t=0;for(let o of N(n))e(o)&&t++;return t}function tt(n,e){let t=0;for(let o of $(n))e(o)&&t++;return t}function rt(n,e,t,o,u){let a=[],s=[],i={},C={},b=new Set(n),m=r=>e.map(l=>l[r]);for(let r of["city","country"]){let l=t?.[r];l&&b.has(l)&&(i[r]=l)}let ie=new Set(u??n);for(let r of["lat","lon"]){let l=t?.[r];l&&ie.has(l)&&(i[r]=l)}let h=t?.zip;if(h&&b.has(h)){let r=m(h),l=W(r);l<95?s.push(`zip=${h} (only ${l}% of values read as ZIPs)`):Z(r,h)?i.zip=h:s.push(`zip=${h} (all values are 3-4 digits with nothing to say they are postal)`)}let g=t?.state;if(g&&b.has(g)){let r=m(g),l=N(r);l.length>0&&l.every(d=>X(d,o))?s.push(`state=${g} (every value is "CA", which is both Canada and California)`):v(r)?(s.push(`state=${g} (every value is a country, not a state)`),i.country||(i.country=g)):L(r)<95?s.push(`state=${g} (only ${L(r)}% of values are states/provinces)`):i.state=g}let S=new Set(Object.values(i).filter(Boolean)),F=n.filter(r=>!S.has(r)&&!r.startsWith("__"));if(!i.state){let r=null;for(let l of F){let d=m(l);if(v(d))continue;let p=L(d);if(p<95)continue;let _=K(d,T=>!!y(T)),ae=K(d,T=>!!y(T)&&!X(T,o));_<V&&ae<1||(!r||p>r.pct)&&(r={name:l,pct:p})}r&&(i.state=r.name,S.add(r.name),a.push(`state=${r.name} (${r.pct}% states/provinces)`))}if(!i.zip)for(let r of F){if(S.has(r))continue;let l=m(r),d=W(l);if(!(d<95)&&Z(l,r)&&!(tt(l,p=>k(p).length>0)<V)){i.zip=r,S.add(r),a.push(`zip=${r} (${d}% ZIP codes)`);break}}let x=i.country;if(!x||!v(m(x))){let r=null;for(let l of F){if(S.has(l)||!v(m(l)))continue;let d=B(m(l));(!r||d>r.pct)&&(r={name:l,pct:d})}r&&(x&&(s.push(`country=${x} (only ${B(m(x))}% of values are country identifiers; using ${r.name} instead)`),C.country=x),i.country=r.name,S.add(r.name),a.push(`country=${r.name}`))}if(!i.city){let r=null;for(let l of F){if(S.has(l))continue;let d=m(l),p=nt(d,o);p<D||K(d,_=>G(_,o))<V||(!r||p>r.pct)&&(r={name:l,pct:p})}r&&(i.city=r.name,a.push(`city=${r.name} (${r.pct}% known cities)`))}let H=i.country?m(i.country):[],E=!!i.country&&v(H),se=E?new Set(H.map(r=>A(r==null?null:String(r))).filter(Boolean)).size:0,U=E&&se>=2,O=!!(i.lat&&i.lon)&&e.some(r=>{let l=+String(r[i.lat]??"").trim(),d=+String(r[i.lon]??"").trim();return isFinite(l)&&isFinite(d)&&l>=-90&&l<=90&&d>=-180&&d<=180&&String(r[i.lat]??"").trim()!==""&&String(r[i.lon]??"").trim()!==""});return i.lat&&i.lon&&!O&&s.push(`lat/lon=${i.lat}/${i.lon} (no row holds a usable coordinate pair)`),i.country&&!U&&!(i.city||i.state||i.zip||O)&&s.push(E?`country=${i.country} (every row resolves to the same country - nothing to place apart)`:`country=${i.country} (values are not country identifiers)`),{bind:!!(i.city||i.state||i.zip||U||O)?i: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 ot(n,e,t){let o=J(n,e);if(o===null||o<=0)return null;let u=typeof e?.freemiumColumnCapPivot=="number"?e.freemiumColumnCapPivot:4,a=o>u?e?.freemiumColumnCapMessageMany:e?.freemiumColumnCapMessageFew;if(typeof a!="string"||a.trim().length===0)return null;let s=a.split("{n}").join(String(o)).split("{fields}").join(o===1?"field":"fields"),i=ee(t);return i.length===0?s:s+" "+i.join(" ")}function ee(n){if(!n||n.length===0)return[];let e=[],t=new Map,o=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&&!o.has(s))){let i=typeof a.sourceField=="string"?a.sourceField.trim():"",C=typeof a.name=="string"?a.name.trim():"",b=i!==""?i:C;b!==""&&o.set(s,b)}}let u=[];for(let a of e){let s=o.get(a),i=t.get(a)??0;!s||i===0||u.push(`'${s}' is a date hierarchy and counts as ${i+1} fields - bind the date itself instead of its hierarchy.`)}return u}var c=n=>n==null?"":String(n),R=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},it=[["city","CityColumn"],["state","StateColumn"],["zip","ZipColumn"],["lat","LatColumn"],["lon","LonColumn"],["country","CountryColumn"]];function te(n,e){let t={};for(let[o,u]of it){let a=c(f(n,e+u));a&&(t[o]=a)}return t}function st(n){let e=a=>f(n,a),t=e("retryAfterSeconds"),o=te(n,"point"),u=te(n,"destPoint");return Object.keys(u).length&&(o.dest=u),{errorMessage:c(e("errorMessage")),code:c(e("code")),language:c(e("language")),version:Number(e("version")??0),codeSummary:c(e("codeSummary")),chartName:c(e("chartName")??e("chartType")),finalChartName:c(e("finalChartName")),warningMessage:c(e("warningMessage")),outputHash:c(e("outputHash")),validatorToken:c(e("validatorToken")),editCodeKey:c(e("editCodeKey")),signedLLMRequestID:c(e("signedLLMRequestID")),userReply:c(e("userReply")),userReplyOutcome:c(e("userReplyOutcome")),improvementSuggestion:c(e("improvementSuggestion")),geoColumn:c(e("geoColumn")),geoKind:c(e("geoKind")),geoPointCols:Object.keys(o).length?o:null,creditBalanceBefore:ne(e("creditBalanceBefore")),creditCost:ne(e("creditCost")),isServiceError:R(e("isServiceError")),isRateLimited:R(e("isRateLimited")),isRefusal:R(e("isRefusal")),isVersionNotFound:R(e("isVersionNotFound")),isGenerationCancelled:R(e("isGenerationCancelled")),retryAfterSeconds:typeof t=="number"&&Number.isFinite(t)?t:null,servedCorrelationId:c(e("servedCorrelationId"))}}var re=n=>n==null?void 0:Number(n),w=n=>c(n)||void 0;function at(n){let e=f(n,"charts"),t=f(n,"refused"),o=Array.isArray(e)?e.map(a=>{let s=C=>f(a,C),i=s("recommended");return{name:c(s("chartTypeName")??s("name")),description:c(s("description")??s("chartDesc")),rank:re(s("rank")),score:re(s("score")),renderer:w(s("renderer")),language:w(s("language")),isPreview:R(s("isPreview")),recommended:typeof i=="boolean"?i:void 0,viaProjection:w(s("viaProjection")),viaProjectionKey:w(s("viaProjectionKey")),detailNote:w(s("detailNote"))}}).filter(a=>a.name):null,u=Array.isArray(t)?t.map(a=>({name:c(f(a,"chartTypeName")??f(a,"name")),reason:c(f(a,"reason")),isVeto:R(f(a,"isVeto"))})).filter(a=>a.name):[];return{errorMessage:c(f(n,"errorMessage")),charts:o,refused:u,noFitSummary:c(f(n,"noFitSummary"))}}function lt(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}}function ut(n){let e=n.linkNonce?(n.linkNonce()??"").trim():null,t=e?{licensee:"",licenseKey:"",secretKey:""}:n.triple();return{request:{licenseKey:t.licenseKey,licensee:t.licensee,secretKey:t.secretKey,freemiumKey:n.freemiumKey?.()??""},linkNonce:e}}function ct(n){let{width:e,height:t}=n.measure();return{request:{height:t,width:e},hints:{viewportWidth:e,viewportHeight:t}}}function dt(n){let e=0;for(let t of n){if(t.isMeasure)continue;let o=t.distinctCount;typeof o=="number"&&o>e&&(e=o)}return e}function oe(n){if(n.recoveryFetchByCorrelation)return{version:null,fetchOnly:!0};if(n.recoveryFetchVersion!=null)return{version:n.recoveryFetchVersion,fetchOnly:!0};let e=n.settingVersion??null;if(n.genNew)return{version:e,fetchOnly:void 0};let t=(e??0)>0?e:null,o=(n.codeVersion??0)>0?n.codeVersion:null,u=t??o??e;return{version:u,fetchOnly:u!=null&&u>0?!0:void 0}}function ft(n){let e=n.fetchCorrelationId!=null,o=e||n.recoveryFetchVersion!=null?!1:n.genNew,u=oe({genNew:o,recoveryFetchVersion:n.recoveryFetchVersion,recoveryFetchByCorrelation:e,settingVersion:n.settingVersion,codeVersion:n.codeVersion});return{genNew:o,version:u.version,fetchOnly:u.fetchOnly,fetchCorrelationId:n.fetchCorrelationId??void 0}}function mt(n){let e=t=>n.renderers.has(t);return{supportsD3:e("D3"),supportsPlotly:e("PLOTLY"),supportsVega:e("VEGA")}}export{D as CITY_ROLE_MATCH_PCT,Ce as COMPOUND_MIN_STEM,vn as DEFAULT_GAP_FACTOR,Fe as DEFAULT_TEMPERATURE,Ne as GET_RANDOM,Se as GLUED_STEM_MIN,sn as INTENSIVE_SUFFIX_TOKENS,on as INTENSIVE_WORD_TOKENS,Kn as IndexedText,Nn as MAX_RUN_BOUNDS,ln as POSITIONAL_SUFFIX_TOKENS,an as POSITIONAL_WORD_TOKENS,Un as PREVIEW_OMITTED_FIELDS,P as ROLE_MATCH_PCT,Tn as SERIES_COMPLETENESS_MAX_LISTED,Mn as SERIES_COMPLETENESS_MIN_FILL,An as SERIES_KEY_MAX_DISTINCT,ve as SIMPLE_STRING_HASH,xe as STR,Re as SUBSTRING_MIN,le as SUPPORTED_LANGUAGES,ue as SUPPORTED_LANGUAGE_CODES,L as admin1MatchPct,Cn as allowedAggregations,Xe as buildGeoIsoColumn,$e as buildGeoPointColumns,mt as capabilityFields,Ue as cityMatchPct,He as cityTagsFor,Gn as classifyAdditivity,yn as classifyForAggregation,Vn as classifyNumericValueNature,_n as classifyTemporal,fn as codeNeedsLegacyAggNames,Rn as codeReadsColumn,bn as codeReadsColumnsByRoleOrPosition,dn as collapseRepeatedAggPrefix,xn as columnsTheCodeReads,Je as countryRegion,ut as credentialFields,zn as decimalSeparatorOf,hn as defaultAggregation,Bn as detectDecimalSeparator,nn as detectFormatSignature,Qe as detectGeo,_e as detectOrdinalDomain,On as detectTextDatePattern,qn as encodePayload,$n as engineTypeForSqlType,mn as englishImplicitAggNames,ft as fetchFields,fe as foldName,ot as freemiumColumnCapRefusal,J as freemiumColumnsOverCap,ee as freemiumDateHierarchyClauses,Pe as gluedPrefixStems,jn as gzipWireText,cn as hasDefaultAggPrefix,ge as hasUnsegmentedScript,Dn as hostAggHint,Hn as ingest,Sn as isAggregationAllowed,I as isBlankLike,Ge as isCityTableLoaded,we as isDeterministicRefusal,Be as isGeoPointAmbiguity,En as isIdentifierName,qe as isJoinGeoKind,Yn as isNdjsonContentType,Ee as isOrdinalFriendlyName,Xn as keyedSigner,ke as localMidnightDateColumns,Ie as localMidnightToUtcDay,v as looksLikeCountryColumn,be as matchNameToken,dt as maxNonMeasureCardinality,Fn as measureCadence,Ln as measureSeriesCompleteness,Zn as messageSignature,rn as monthLookupFor,gn as nameLooksIntensiveRate,pn as nameLooksPositional,me as nameWords,Ve as normalizeCountry,Le as normalizeLocalMidnightDates,tn as normalizeMonthKey,M as normalizePlaceName,ze as normalizeZip5,Te as parseDateStable,st as parseGenerateResponse,Wn as parseNumberText,at as parseQualifyResponse,lt as parseReviewVerdict,wn as parseTemporalPoint,Qn as payloadPreview,kn as pickSeriesColumn,et as readGenerateStream,pe as readName,f as readWireField,De as registerCityTable,Ye as registerIso3Regions,y as resolveAdmin1,oe as resolveFetchVersion,We as resolveGeoPoint,de as resolveLanguage,rt as resolvePointRoles,Oe as safeDistinctValuesToShip,In as seriesKeyVerdict,Pn as shareOfTotalIsHonest,un as stripHostAggPrefix,en as summarizeCountryRegions,Ze as summarizeGeoExtent,ce as supportedLanguage,je as toGeoIso,ye as unsegmentedRuns,ct as viewportFields,Me as wholeDayFrame,Ae as wholeDayIso,Jn as wireResponseFromFetch,he as wordEndsWith,W as zipMatchPct,k as zipPrefixCandidates,Ke as zipToPrefix3};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -44,5 +44,5 @@ export type { GzipText } from "./wire";
|
|
|
44
44
|
export { readGenerateStream, isNdjsonContentType, wireResponseFromFetch } from "./wireStream";
|
|
45
45
|
export { parseGenerateResponse, parseQualifyResponse, parseReviewVerdict } from "./wireParse";
|
|
46
46
|
export type { ParsedGenerateResponse, ParsedQualifyResponse, ParsedQualifyChart, ParsedQualifyRefusal, ParsedReviewVerdict, WirePointBinding, WirePointColumns, } from "./wireParse";
|
|
47
|
-
export { viewportFields, maxNonMeasureCardinality, credentialFields, resolveFetchVersion, fetchFields } from "./wireBuild";
|
|
48
|
-
export type { ViewportFields, CredentialFields, FetchRequest, FetchFields } from "./wireBuild";
|
|
47
|
+
export { viewportFields, maxNonMeasureCardinality, credentialFields, resolveFetchVersion, fetchFields, capabilityFields, } from "./wireBuild";
|
|
48
|
+
export type { ViewportFields, CredentialFields, FetchRequest, FetchFields, CapabilityFields } from "./wireBuild";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CredentialSource, ViewportSource } from "./host/services";
|
|
1
|
+
import type { CredentialSource, ViewportSource, WireServices } from "./host/services";
|
|
2
2
|
/** A generate request's credential fields. */
|
|
3
3
|
export interface CredentialFields {
|
|
4
4
|
/** The licence triple and the free-tier key: the first four fields of every host's request, in this order. */
|
|
@@ -128,3 +128,22 @@ export declare function resolveFetchVersion(i: {
|
|
|
128
128
|
* sent, so an ordinary generation serialises exactly as it did before any of these existed.
|
|
129
129
|
*/
|
|
130
130
|
export declare function fetchFields(r: FetchRequest): FetchFields;
|
|
131
|
+
/** The renderer capability flags a generate request carries. */
|
|
132
|
+
export interface CapabilityFields {
|
|
133
|
+
supportsD3: boolean;
|
|
134
|
+
supportsPlotly: boolean;
|
|
135
|
+
supportsVega: boolean;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* WHAT THE HOST CAN RUN, AS THE REQUEST STATES IT - derived from the renderers the host passes, never
|
|
139
|
+
* declared beside them, so a request can no longer ask for a chart its host cannot draw.
|
|
140
|
+
*
|
|
141
|
+
* The server reads each flag to decide which renderers it may pick; a flag that is absent is inferred
|
|
142
|
+
* from the client's version number, which says nothing about what THIS host can run. So every flag is
|
|
143
|
+
* stated, true or false, whatever the host. A host that generates without drawing (a server handing
|
|
144
|
+
* the code to someone else's page) passes the renderers it asks the server for.
|
|
145
|
+
*
|
|
146
|
+
* Python has no flag on the wire: a host that runs it says so in its renderer set and nothing here
|
|
147
|
+
* reads it. The host places each flag where it always has; they sit in a different order in each.
|
|
148
|
+
*/
|
|
149
|
+
export declare function capabilityFields(services: Pick<WireServices, "renderers">): CapabilityFields;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bicharts/shape-core",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.19",
|
|
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",
|