@bicharts/shape-core 0.6.35 → 0.6.36
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-5KAS4CFP.mjs +4 -0
- package/dist/index.mjs +1 -1
- package/dist/testing.mjs +1 -1
- package/dist/types/index.d.ts +5 -2
- package/dist/types/messageCodes.d.ts +28 -0
- package/dist/types/models.d.ts +13 -0
- package/dist/types/wireParse.d.ts +29 -0
- package/dist/types/wireStream.d.ts +8 -3
- package/package.json +1 -1
- package/dist/chunk-JF3BJI7F.mjs +0 -4
|
@@ -0,0 +1,4 @@
|
|
|
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{u as c}from"./chunk-NFSQ4O5R.mjs";import{gzip as h}from"pako";var w=e=>h(e);function P(e){return S(w(JSON.stringify(e))).replace(/\//g,".")}function S(e){let t="";for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(t)}function T(e){if(typeof e!="string"||e==="")throw new TypeError("keyedSigner needs the host's signing key");return{sign:t=>String(c(t+e))}}function W(e,t){let r=t.sign(e);if(typeof r!="string"||r.trim()==="")throw new TypeError("the host's signer returned a blank signature");return r}function u(e,t){if(e==null||typeof e!="object")return;let r=e,n=r[t];return n??r[t.charAt(0).toUpperCase()+t.slice(1)]}function x(e){return String(e??"").toLowerCase().includes("ndjson")}function C(e){let t=null;try{t=e.headers?.get?.("content-type")??null}catch{t=null}return{status:typeof e.status=="number"?e.status:0,contentType:t,body:e.body??null,text:()=>e.text()}}function m(e,t,r){let n=e.trim();if(!n)return{result:null,typed:!1,parsed:!1};let i;try{i=JSON.parse(n)}catch{return{result:null,typed:!1,parsed:!1}}return f(i,t,r)}function f(e,t,r){if(!e||typeof e!="object"||Array.isArray(e))return{result:null,typed:!1,parsed:!0};let n=u(e,"type");if(n!=null){if(n==="progress"){let s=String(u(e,"stage")??"").trim(),o=String(u(e,"stageId")??"").trim();return s&&t?.(s,o||void 0),{result:null,typed:!0,parsed:!0}}if(n==="result"){let s=u(e,"result");return{result:s&&typeof s=="object"?s:null,typed:!0,parsed:!0}}return{result:null,typed:!0,parsed:!0}}return r?{result:u(e,"code")!==void 0||u(e,"errorMessage")!==void 0?e:null,typed:!1,parsed:!0}:{result:e,typed:!1,parsed:!0}}var a=class{constructor(t){this.onStage=t}onStage;result=null;anyParsed=!1;take(t){let r=m(t,this.onStage,!0);r.parsed&&(this.anyParsed=!0),r.result&&(r.typed||this.result===null)&&(this.result=r.result)}};function d(){return new Error("the generate response ended without a result")}async function R(e,t){let r=e.body;if(!r||typeof r.getReader!="function")return p(await e.text(),t,null);let n=r.getReader(),i=new TextDecoder,s=new a(t),o="";try{for(;;){let{done:y,value:g}=await n.read();if(y)break;o+=i.decode(g,{stream:!0});let l;for(;(l=o.indexOf(`
|
|
3
|
+
`))>=0;)s.take(o.slice(0,l)),o=o.slice(l+1)}}finally{try{n.releaseLock?.()}catch{}}if(o+=i.decode(),s.take(o),!s.result)throw d();return s.result}function p(e,t,r){let n=new a(t);for(let i of e.split(`
|
|
4
|
+
`))n.take(i);if(n.result)return n.result;throw!n.anyParsed&&r?r:d()}async function k(e,t){let r=await e.text(),n;try{n=JSON.parse(r)}catch(s){return p(r,t,s)}if(!n||typeof n!="object"||Array.isArray(n))throw new SyntaxError("the generate response was JSON but not a result object");let i=f(n,t,!1);if(i.result)return i.result;throw d()}async function v(e,t){return x(e.contentType)?R(e,t):k(e,t)}export{w as a,P as b,T as c,W as d,u as e,x as f,C as g,v as h};
|
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 ln,b as un}from"./chunk-UQU75XXR.mjs";import{a as cn,b as j,c as dn,d as B,e as h,f as mn,g as H,h as fn}from"./chunk-JF3BJI7F.mjs";import{a as nn,b as rn,c as on,d as sn,e as an}from"./chunk-FNEHWEWX.mjs";import{A as zt,B as Kt,C as Wt,D as $t,E as jt,F as Bt,G as Ht,H as Yt,I as Qt,J as Xt,K as Zt,L as Jt,M as en,O as tn,a as ft,b as pt,c as yt,d as gt,e as Tt,f as Et,g as Rt,h as St,i as xt,j as vt,k as Lt,l as Pt,m as wt,n as Mt,o as At,p as Nt,q as _t,r as Ft,s as It,t as kt,u as Ot,v as Vt,w as Dt,x as Gt,y as Ut,z as qt}from"./chunk-KKSQBV76.mjs";import{a as ht}from"./chunk-QEH7WTLB.mjs";import{a as Ct,b as bt}from"./chunk-2LR73DNS.mjs";import{a as oe,b as ie,c as ut,d as ct,e as dt,f as mt}from"./chunk-6TVBXT4G.mjs";import{a as O,f as V,g as w,h as D,i as W,j as Je,k as et,l as re,m as P,n as tt,o as nt,p as rt,q as G,r as ot,s as it,t as st,u as at,v as $,w as lt}from"./chunk-TPVDJHU6.mjs";import"./chunk-5MRZID36.mjs";import{a as Qe,b as Xe,c as Ze}from"./chunk-6Q3MQ2MK.mjs";import{A as je,B as Be,C as He,D as Ye,a as Se,b as xe,c as ve,d as Le,e as Pe,f as z,g as we,h as Me,i as Ae,j as Ne,k as _e,l as Fe,m as Ie,n as ke,o as Oe,p as Ve,q as De,r as Ge,s as Ue,u as K,v as qe,w as ze,x as Ke,y as We,z as $e}from"./chunk-NFSQ4O5R.mjs";var Y=2,le=400;function X(t){return!!V(t)}function _(t){let e=new Set;for(let r of t){if(r==null)continue;let o=O(String(r));if(!D(o)&&!e.has(o)&&(e.add(o),e.size>=le))break}return Array.from(e)}function N(t){let e=_(t);if(e.length===0||Z(t)<95)return!1;let r=e.filter(u=>X(u)&&!P(u)).length,o=e.filter(u=>!X(u)&&!!P(u)).length;return r>=1&&r>=o}function se(t,e){if(!P(t))return!1;let r=V(t);return r?e==="world"?!0:re.has(r):!1}function Z(t){let e=_(t);if(e.length===0)return 0;let r=0;for(let o of e)X(o)&&r++;return Math.round(r/e.length*1e3)/10}function U(t){let e=_(t);if(e.length===0)return 0;let r=0;for(let o of e)P(o)&&r++;return Math.round(r/e.length*1e3)/10}function ee(t){let e=new Set;for(let r of t){if(r==null)continue;let o=String(r).trim();if(!D(O(o))&&!e.has(o)&&(e.add(o),e.size>=le))break}return Array.from(e)}function J(t){let e=ee(t);if(e.length===0)return 0;let r=0;for(let o of e)G(o).length>0&&r++;return Math.round(r/e.length*1e3)/10}function ae(t,e){return ie(e,oe)?!0:ee(t).some(r=>/^\d{5}(-\d{4})?$/.test(r.replace(/\.0+$/,"")))}function pn(t,e){let r=_(t);if(r.length===0)return 0;let o=0;for(let u of r)$(u,e)&&o++;return Math.round(o/r.length*1e3)/10}function Q(t,e){let r=0;for(let o of _(t))e(o)&&r++;return r}function yn(t,e){let r=0;for(let o of ee(t))e(o)&&r++;return r}function gn(t,e,r,o,u){let l=[],a=[],i={},E={},T=new Set(t),C=s=>e.map(c=>c[s]);for(let s of["city","country"]){let c=r?.[s];c&&T.has(c)&&(i[s]=c)}let S=new Set(u??t);for(let s of["lat","lon"]){let c=r?.[s];c&&S.has(c)&&(i[s]=c)}let y=r?.zip;if(y&&T.has(y)){let s=C(y),c=J(s);c<95?a.push(`zip=${y} (only ${c}% of values read as ZIPs)`):ae(s,y)?i.zip=y:a.push(`zip=${y} (all values are 3-4 digits with nothing to say they are postal)`)}let f=r?.state;if(f&&T.has(f)){let s=C(f),c=_(s);c.length>0&&c.every(p=>se(p,o))?a.push(`state=${f} (every value is "CA", which is both Canada and California)`):N(s)?(a.push(`state=${f} (every value is a country, not a state)`),i.country||(i.country=f)):U(s)<95?a.push(`state=${f} (only ${U(s)}% of values are states/provinces)`):i.state=f}let m=new Set(Object.values(i).filter(Boolean)),g=t.filter(s=>!m.has(s)&&!s.startsWith("__"));if(!i.state){let s=null;for(let c of g){let p=C(c);if(N(p))continue;let v=U(p);if(v<95)continue;let q=Q(p,k=>!!P(k)),Re=Q(p,k=>!!P(k)&&!se(k,o));q<Y&&Re<1||(!s||v>s.pct)&&(s={name:c,pct:v})}s&&(i.state=s.name,m.add(s.name),l.push(`state=${s.name} (${s.pct}% states/provinces)`))}if(!i.zip)for(let s of g){if(m.has(s))continue;let c=C(s),p=J(c);if(!(p<95)&&ae(c,s)&&!(yn(c,v=>G(v).length>0)<Y)){i.zip=s,m.add(s),l.push(`zip=${s} (${p}% ZIP codes)`);break}}let b=i.country;if(!b||!N(C(b))){let s=null;for(let c of g){if(m.has(c)||!N(C(c)))continue;let p=Z(C(c));(!s||p>s.pct)&&(s={name:c,pct:p})}s&&(b&&(a.push(`country=${b} (only ${Z(C(b))}% of values are country identifiers; using ${s.name} instead)`),E.country=b),i.country=s.name,m.add(s.name),l.push(`country=${s.name}`))}if(!i.city){let s=null;for(let c of g){if(m.has(c))continue;let p=C(c),v=pn(p,o);v<W||Q(p,q=>$(q,o))<Y||(!s||v>s.pct)&&(s={name:c,pct:v})}s&&(i.city=s.name,l.push(`city=${s.name} (${s.pct}% known cities)`))}let x=i.country?C(i.country):[],A=!!i.country&&N(x),I=A?new Set(x.map(s=>V(s==null?null:String(s))).filter(Boolean)).size:0,R=A&&I>=2,L=!!(i.lat&&i.lon)&&e.some(s=>{let c=+String(s[i.lat]??"").trim(),p=+String(s[i.lon]??"").trim();return isFinite(c)&&isFinite(p)&&c>=-90&&c<=90&&p>=-180&&p<=180&&String(s[i.lat]??"").trim()!==""&&String(s[i.lon]??"").trim()!==""});return i.lat&&i.lon&&!L&&a.push(`lat/lon=${i.lat}/${i.lon} (no row holds a usable coordinate pair)`),i.country&&!R&&!(i.city||i.state||i.zip||L)&&a.push(A?`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||R||L)?i:null,backfilled:l,refused:a,...Object.keys(E).length?{labelFallback:E}:{}}}var n=(t,...e)=>({part:t,langs:Object.freeze(e)}),te=Object.freeze({jaar:n("year","nl"),kwartaal:n("quarter","nl"),maand:n("month","nl"),dag:n("day","nl","sv","da","nb"),jahr:n("year","de"),quartal:n("quarter","de"),monat:n("month","de"),tag:n("day","de"),ann\u00E9e:n("year","fr"),mois:n("month","fr"),jour:n("day","fr"),trimestre:n("quarter","fr","es","pt","it"),a\u00F1o:n("year","es"),mes:n("month","es"),d\u00EDa:n("day","es"),ano:n("year","pt"),m\u00EAs:n("month","pt"),dia:n("day","pt"),anno:n("year","it"),mese:n("month","it"),giorno:n("day","it"),\u0433\u043E\u0434:n("year","ru"),\u043C\u0435\u0441\u044F\u0446:n("month","ru"),\u0440\u0456\u043A:n("year","uk"),\u043C\u0456\u0441\u044F\u0446\u044C:n("month","uk"),\u043A\u0432\u0430\u0440\u0442\u0430\u043B:n("quarter","ru","uk"),\u0434\u0435\u043D\u044C:n("day","ru","uk"),rok:n("year","pl","cs","sk"),kwarta\u0142:n("quarter","pl"),miesi\u0105c:n("month","pl"),dzie\u0144:n("day","pl"),\u010Dtvrtlet\u00ED:n("quarter","cs"),m\u011Bs\u00EDc:n("month","cs"),den:n("day","cs"),\u0161tvr\u0165rok:n("quarter","sk"),mesiac:n("month","sk"),de\u0148:n("day","sk"),\u00E5r:n("year","sv","da","nb"),kvartal:n("quarter","sv","da","nb"),m\u00E5nad:n("month","sv"),m\u00E5ned:n("month","da","nb"),vuosi:n("year","fi"),vuosinelj\u00E4nnes:n("quarter","fi"),kuukausi:n("month","fi"),p\u00E4iv\u00E4:n("day","fi"),\u00E9v:n("year","hu"),negyed\u00E9v:n("quarter","hu"),h\u00F3nap:n("month","hu"),nap:n("day","hu"),y\u0131l:n("year","tr"),\u00E7eyrek:n("quarter","tr"),ay:n("month","tr"),g\u00FCn:n("day","tr"),\u03AD\u03C4\u03BF\u03C2:n("year","el"),\u03C4\u03C1\u03AF\u03BC\u03B7\u03BD\u03BF:n("quarter","el"),\u03BC\u03AE\u03BD\u03B1\u03C2:n("month","el"),\u03B7\u03BC\u03AD\u03C1\u03B1:n("day","el"),an:n("year","ro"),trimestru:n("quarter","ro"),lun\u0103:n("month","ro"),zi:n("day","ro"),godina:n("year","hr"),tromjese\u010Dje:n("quarter","hr"),mjesec:n("month","hr"),dan:n("day","hr"),\u5E74:n("year","ja","zh"),\u56DB\u534A\u671F:n("quarter","ja"),\u5B63\u5EA6:n("quarter","zh"),\u6708:n("month","ja","zh"),\u65E5:n("day","ja","zh"),\uC5F0\uB3C4:n("year","ko"),\uBD84\uAE30:n("quarter","ko"),\uC6D4:n("month","ko"),\uC77C:n("day","ko"),tahun:n("year","id"),kuartal:n("quarter","id"),triwulan:n("quarter","id"),bulan:n("month","id"),hari:n("day","id"),n\u0103m:n("year","vi"),qu\u00FD:n("quarter","vi"),th\u00E1ng:n("month","vi"),ng\u00E0y:n("day","vi"),\u0E1B\u0E35:n("year","th"),\u0E44\u0E15\u0E23\u0E21\u0E32\u0E2A:n("quarter","th"),\u0E40\u0E14\u0E37\u0E2D\u0E19:n("month","th"),\u0E27\u0E31\u0E19:n("day","th"),\u0627\u0644\u0633\u0646\u0629:n("year","ar"),\u0633\u0646\u0629:n("year","ar"),\u0627\u0644\u0639\u0627\u0645:n("year","ar"),\u0639\u0627\u0645:n("year","ar"),\u0627\u0644\u0631\u0628\u0639:n("quarter","ar"),\u0631\u0628\u0639:n("quarter","ar"),"\u0631\u0628\u0639 \u0627\u0644\u0633\u0646\u0629":n("quarter","ar"),\u0627\u0644\u0634\u0647\u0631:n("month","ar"),\u0634\u0647\u0631:n("month","ar"),\u0627\u0644\u064A\u0648\u0645:n("day","ar"),\u064A\u0648\u0645:n("day","ar"),\u05E9\u05E0\u05D4:n("year","he"),\u05E8\u05D1\u05E2\u05D5\u05DF:n("quarter","he"),\u05D7\u05D5\u05D3\u05E9:n("month","he"),\u05D9\u05D5\u05DD:n("day","he"),\u0935\u0930\u094D\u0937:n("year","hi"),\u0938\u093E\u0932:n("year","hi"),\u0924\u093F\u092E\u093E\u0939\u0940:n("quarter","hi"),\u092E\u0939\u0940\u0928\u093E:n("month","hi"),\u092E\u093E\u0939:n("month","hi"),\u0926\u093F\u0928:n("day","hi"),\u0633\u0627\u0644:n("year","fa"),\u0645\u0627\u0647:n("month","fa"),\u0631\u0648\u0632:n("day","fa")}),hn=Object.freeze(Array.from(new Set(Object.values(te).flatMap(t=>t.langs)))),ue=Object.freeze(["fa","ar","he","th"]),ce=1900,de=2100;function Cn(t,e){let r=[],o=z(e);try{o&&r.push(t.toLocaleLowerCase(o.intl))}catch{}let u=t.toLowerCase();return r.includes(u)||r.push(u),r}function bn(t,e){let r=String(t??"").trim().normalize("NFC");if(!r)return null;for(let o of Cn(r,e)){let u=te[o];if(u&&u.langs.includes(e))return u.part}return null}function Tn(t,e){return ue.includes(t)?typeof e=="number"&&Number.isFinite(e)&&e>=ce&&e<=de:!0}function me(t,e){let r=e?.freemiumMaxShapeColumns;return typeof r!="number"||!isFinite(r)||r<1?null:!isFinite(t)||t<=r?0:Math.round(t-r)}function En(t,e,r){let o=me(t,e);if(o===null||o<=0)return null;let u=typeof e?.freemiumColumnCapPivot=="number"?e.freemiumColumnCapPivot:4,l=o>u?e?.freemiumColumnCapMessageMany:e?.freemiumColumnCapMessageFew;if(typeof l!="string"||l.trim().length===0)return null;let a=l.split("{n}").join(String(o)).split("{fields}").join(o===1?"field":"fields"),i=fe(r);return i.length===0?a:a+" "+i.join(" ")}function fe(t){if(!t||t.length===0)return[];let e=[],r=new Map,o=new Map;for(let l of t){let a=typeof l?.dateGroupId=="string"?l.dateGroupId.trim():"";if(a!==""&&(r.has(a)||(e.push(a),r.set(a,0)),l.isDatePart===!0&&r.set(a,r.get(a)+1),l.isReassembledDate===!0&&!o.has(a))){let i=typeof l.sourceField=="string"?l.sourceField.trim():"",E=typeof l.name=="string"?l.name.trim():"",T=i!==""?i:E;T!==""&&o.set(a,T)}}let u=[];for(let l of e){let a=o.get(l),i=r.get(l)??0;!a||i===0||u.push(`'${a}' is a date hierarchy and counts as ${i+1} fields - bind the date itself instead of its hierarchy.`)}return u}var d=t=>t==null?"":String(t),M=t=>t===!0,pe=t=>{if(typeof t=="number")return Number.isFinite(t)?t:null;if(typeof t=="string"&&t.trim()!==""){let e=Number(t);return Number.isFinite(e)?e:null}return null},Rn=[["city","CityColumn"],["state","StateColumn"],["zip","ZipColumn"],["lat","LatColumn"],["lon","LonColumn"],["country","CountryColumn"]];function ye(t,e){let r={};for(let[o,u]of Rn){let l=d(h(t,e+u));l&&(r[o]=l)}return r}function Sn(t){let e=i=>h(t,i),r=e("retryAfterSeconds"),o=e("overrideThumbnailUpload"),u=e("forceThumbnailUpload"),l=ye(t,"point"),a=ye(t,"destPoint");return Object.keys(a).length&&(l.dest=a),{errorMessage:d(e("errorMessage")),code:d(e("code")),language:d(e("language")),version:Number(e("version")??0),codeSummary:d(e("codeSummary")),chartName:d(e("chartName")??e("chartType")),finalChartName:d(e("finalChartName")),warningMessage:d(e("warningMessage")),outputHash:d(e("outputHash")),validatorToken:d(e("validatorToken")),editCodeKey:d(e("editCodeKey")),signedLLMRequestID:d(e("signedLLMRequestID")),userReply:d(e("userReply")),userReplyOutcome:d(e("userReplyOutcome")),improvementSuggestion:d(e("improvementSuggestion")),geoColumn:d(e("geoColumn")),geoKind:d(e("geoKind")),geoPointCols:Object.keys(l).length?l:null,creditBalanceBefore:pe(e("creditBalanceBefore")),creditCost:pe(e("creditCost")),isServiceError:M(e("isServiceError")),isRateLimited:M(e("isRateLimited")),isRefusal:M(e("isRefusal")),isVersionNotFound:M(e("isVersionNotFound")),isGenerationCancelled:M(e("isGenerationCancelled")),retryAfterSeconds:typeof r=="number"&&Number.isFinite(r)?r:null,servedCorrelationId:d(e("servedCorrelationId")),...typeof o=="boolean"?{overrideThumbnailUpload:o}:{},...typeof u=="boolean"?{forceThumbnailUpload:u}:{}}}var ge=t=>t==null?void 0:Number(t),F=t=>d(t)||void 0;function xn(t){let e=h(t,"charts"),r=h(t,"refused"),o=Array.isArray(e)?e.map(l=>{let a=E=>h(l,E),i=a("recommended");return{name:d(a("chartTypeName")??a("name")),description:d(a("description")??a("chartDesc")),rank:ge(a("rank")),score:ge(a("score")),renderer:F(a("renderer")),language:F(a("language")),isPreview:M(a("isPreview")),recommended:typeof i=="boolean"?i:void 0,viaProjection:F(a("viaProjection")),viaProjectionKey:F(a("viaProjectionKey")),detailNote:F(a("detailNote"))}}).filter(l=>l.name):null,u=Array.isArray(r)?r.map(l=>({name:d(h(l,"chartTypeName")??h(l,"name")),reason:d(h(l,"reason")),isVeto:M(h(l,"isVeto"))})).filter(l=>l.name):[];return{errorMessage:d(h(t,"errorMessage")),charts:o,refused:u,noFitSummary:d(h(t,"noFitSummary"))}}function vn(t){return!t||typeof t!="object"?null:{status:String(h(t,"status")??""),verdictReason:h(t,"verdictReason")??null,instruction:h(t,"instruction")??null,fix:h(t,"fix")??null,errorMessage:h(t,"errorMessage")??null}}function Ln(t){let e=t.linkNonce?(t.linkNonce()??"").trim():null,r=e?{licensee:"",licenseKey:"",secretKey:""}:t.triple();return{request:{licenseKey:r.licenseKey,licensee:r.licensee,secretKey:r.secretKey,freemiumKey:t.freemiumKey?.()??""},linkNonce:e}}function Pn(t){let{width:e,height:r}=t.measure();return{request:{height:r,width:e},hints:{viewportWidth:e,viewportHeight:r}}}function wn(t){let e=0;for(let r of t){if(r.isMeasure)continue;let o=r.distinctCount;typeof o=="number"&&o>e&&(e=o)}return e}function he(t){if(t.recoveryFetchByCorrelation)return{version:null,fetchOnly:!0};if(t.recoveryFetchVersion!=null)return{version:t.recoveryFetchVersion,fetchOnly:!0};let e=t.settingVersion??null;if(t.genNew)return{version:e,fetchOnly:void 0};let r=(e??0)>0?e:null,o=(t.codeVersion??0)>0?t.codeVersion:null,u=r??o??e;return{version:u,fetchOnly:u!=null&&u>0?!0:void 0}}function Mn(t){let e=t.fetchCorrelationId!=null,o=e||t.recoveryFetchVersion!=null?!1:t.genNew,u=he({genNew:o,recoveryFetchVersion:t.recoveryFetchVersion,recoveryFetchByCorrelation:e,settingVersion:t.settingVersion,codeVersion:t.codeVersion});return{genNew:o,version:u.version,fetchOnly:u.fetchOnly,fetchCorrelationId:t.fetchCorrelationId??void 0}}function An(t){let e=r=>t.renderers.has(r);return{supportsD3:e("D3"),supportsPlotly:e("PLOTLY"),supportsVega:e("VEGA")}}function Nn(t){let e=t.cap!=null&&t.budget>t.cap?t.cap:t.budget;return{triesLeft:t.triesLeft??e,maxTries:e}}function _n(t){return t&&t>0?{leafCardinality:Math.round(t)}:{}}function Ce(t,e){return t!=null&&e!=null&&t!==e}function Fn(t,e){return t?Ce(e.capturedFor,e.now)?{shortlist:void 0,stale:!0}:{shortlist:{...t,ageMs:e.atMs>0?Math.max(0,Math.round(e.nowMs-e.atMs)):void 0},stale:!1}:{shortlist:void 0,stale:!1}}var In=Object.freeze({integer:"number",decimal:"number",double:"number",datetime:"date",date:"date",boolean:"boolean",string:"text"});function be(t){let e=String(t??"").trim().toLowerCase();return In[e]??e}function Te(t){let e="";for(let r of t)e+=JSON.stringify([String(r.name??""),r.isMeasure?"M":"D",be(r.dataType)]);return e}function kn(t){return K(Te(t))}var On=2,Vn=3,Dn=4,Gn=64,Un=8e3,qn=6e4,zn=Object.freeze({RENDER_START:"render-start",RENDER_OK:"render-ok",RENDER_ERROR:"render-error",VIEW:"view",VIEW_VERDICT:"view-verdict"});function Kn(t){return!!t&&!t.includes("|")&&!t.includes(",")}function ne(t,e,r,o){let u=`${t},${e}|${r}`;return o?`${u}|${Math.max(0,Math.round(o.count))}|${o.nonce}`:u}function Wn(t,e){let r=t;if(!r||!r.signer||typeof r.signer.sign!="function")throw new TypeError("createTelemetryClient needs the host's signer");if(!r.transport||typeof r.transport.post!="function")throw new TypeError("createTelemetryClient needs the host's transport");if(!r.clock||typeof r.clock.now!="function")throw new TypeError("createTelemetryClient needs the host's clock");if(!e||typeof e.baseUrl!="string"&&typeof e.baseUrl!="function")throw new TypeError("createTelemetryClient needs the service's base URL");if(typeof e.baseUrl=="string"&&e.baseUrl==="")throw new TypeError("createTelemetryClient needs the service's base URL");if(typeof e.clientVersion!="string"||e.clientVersion==="")throw new TypeError("createTelemetryClient needs the client version");if(typeof e.timeoutMs!="number"||!Number.isFinite(e.timeoutMs)||e.timeoutMs<=0)throw new TypeError("createTelemetryClient needs a positive deadline in milliseconds");let{signer:o,transport:u,clock:l}=r,a=e.apiPath??"/api",i=e.timeoutMs,E=()=>typeof e.baseUrl=="function"?e.baseUrl():e.baseUrl,T=S=>{try{e.onFailure?.(S)}catch{}},C=async(S,y,f,m)=>{let g;try{let b=await u.post(y,f,m,{timeoutMs:i});g=b.status;try{b.body?.cancel().catch(()=>{})}catch{}}catch(b){T({channel:S,stage:"post",status:null,error:b});return}(g<200||g>299)&&T({channel:S,stage:"status",status:g,error:null})};return{async sendClientMessage(S){let y,f,m;try{y=`${E()}${a}/LogClientMsg/?nocache=${l.now()}`,f=j(S),m=B(f,o)}catch(g){T({channel:"client-message",stage:"build",status:null,error:g});return}await C("client-message",y,f,{"Content-Type":"text/plain","X-Signature":m})},async countEvent(S,y,f){let m,g;try{m=`${E()}${a}/eventlog`,g=ne(S,e.clientVersion,y,f)}catch(b){T({channel:"event-count",stage:"build",status:null,error:b});return}await C("event-count",m,g,{"Content-Type":"text/plain"})}}}function Ee(t){return Object.assign(new Error(`The request did not finish within ${t} ms.`),{name:"TimeoutError"})}function $n(t,e={}){if(typeof t!="function")throw new TypeError("fetchTransport needs the host's fetch");let r=t,o=e.credentials??"omit";return{async post(u,l,a,i){let E=i.timeoutMs,T=new AbortController,C=!1,S=setTimeout(()=>{C=!0,T.abort(Ee(E))},E),y=()=>T.abort(i.signal?.reason);i.signal&&(i.signal.aborted?y():i.signal.addEventListener("abort",y,{once:!0}));let f=!1,m=()=>{f||(f=!0,clearTimeout(S),i.signal?.removeEventListener("abort",y))},g=R=>C?Ee(E):R,b;try{b=await r(u,{method:"POST",body:l,headers:a,credentials:o,signal:T.signal})}catch(R){throw m(),g(R)}let x=H(b);if(!x.body)return{status:x.status,contentType:x.contentType,body:null,text:async()=>{try{return await x.text()}catch(R){throw g(R)}finally{m()}}};let A=x.body.getReader(),I=new ReadableStream({async pull(R){try{let L=await A.read();if(L.done){m(),R.close();return}R.enqueue(L.value)}catch(L){m(),R.error(g(L))}},cancel(R){return m(),A.cancel(R)}});return{status:x.status,contentType:x.contentType,body:I,text:()=>new Response(I).text()}}}}export{W as CITY_ROLE_MATCH_PCT,zn as CLIENT_EVENT_KINDS,Ie as COMPOUND_MIN_STEM,de as DATE_LEVEL_GREGORIAN_YEAR_MAX,ce as DATE_LEVEL_GREGORIAN_YEAR_MIN,hn as DATE_LEVEL_LANGUAGES,te as DATE_LEVEL_NAMES,ue as DATE_LEVEL_NON_GREGORIAN_LANGUAGES,Gt as DEFAULT_GAP_FACTOR,Ke as DEFAULT_TEMPERATURE,qe as GET_RANDOM,Oe as GLUED_STEM_MIN,Et as INTENSIVE_SUFFIX_TOKENS,Tt as INTENSIVE_WORD_TOKENS,tn as IndexedText,Ut as MAX_RUN_BOUNDS,St as POSITIONAL_SUFFIX_TOKENS,Rt as POSITIONAL_WORD_TOKENS,ln as PREVIEW_OMITTED_FIELDS,w as ROLE_MATCH_PCT,Kt as SERIES_COMPLETENESS_MAX_LISTED,Wt as SERIES_COMPLETENESS_MIN_FILL,$t as SERIES_KEY_MAX_DISTINCT,Dn as SEV_ERROR,On as SEV_INFO,Gn as SEV_USER_PRESENTED,Vn as SEV_WARNING,K as SIMPLE_STRING_HASH,Ue as STR,De as SUBSTRING_MIN,Se as SUPPORTED_LANGUAGES,xe as SUPPORTED_LANGUAGE_CODES,qn as TELEMETRY_TIMEOUT_DEV_MS,Un as TELEMETRY_TIMEOUT_MS,Pe as VOCABULARY_LANGUAGE_CODES,Le as VOCABULARY_ONLY_LANGUAGES,U as admin1MatchPct,_t as allowedAggregations,mt as buildGeoIsoColumn,st as buildGeoPointColumns,An as capabilityFields,lt as cityMatchPct,at as cityTagsFor,Jt as classifyAdditivity,Nt as classifyForAggregation,en as classifyNumericValueNature,Xt as classifyTemporal,Pt as codeNeedsLegacyAggNames,Ot as codeReadsColumn,Vt as codeReadsColumnsByRoleOrPosition,Lt as collapseRepeatedAggPrefix,Dt as columnsTheCodeReads,yt as countryRegion,Wn as createTelemetryClient,Ln as credentialFields,bn as dateLevelPart,Tn as dateLevelYearAdmits,nn as decimalSeparatorOf,Ft as defaultAggregation,rn as detectDecimalSeparator,ht as detectFormatSignature,ut as detectGeo,Ze as detectOrdinalDomain,Qt as detectTextDatePattern,j as encodePayload,sn as engineTypeForSqlType,wt as englishImplicitAggNames,ne as eventLogLine,Mn as fetchFields,$n as fetchTransport,Me as foldName,En as freemiumColumnCapRefusal,me as freemiumColumnsOverCap,fe as freemiumDateHierarchyClauses,Ve as gluedPrefixStems,cn as gzipWireText,vt as hasDefaultAggPrefix,_e as hasUnsegmentedScript,Zt as hostAggHint,an as ingest,It as isAggregationAllowed,D as isBlankLike,et as isCityTableLoaded,ze as isDeterministicRefusal,Kn as isEventLogCode,ot as isGeoPointAmbiguity,Yt as isIdentifierName,dt as isJoinGeoKind,mn as isNdjsonContentType,Qe as isOrdinalFriendlyName,dn as keyedSigner,_n as leafCardinalityField,He as localMidnightDateColumns,Be as localMidnightToUtcDay,N as looksLikeCountryColumn,Ge as matchNameToken,wn as maxNonMeasureCardinality,zt as measureCadence,Ht as measureSeriesCompleteness,B as messageSignature,bt as monthLookupFor,At as nameLooksIntensiveRate,Mt as nameLooksPositional,Ae as nameWords,tt as normalizeCountry,Ye as normalizeLocalMidnightDates,Ct as normalizeMonthKey,O as normalizePlaceName,rt as normalizeZip5,Fn as offeredShortlistFor,We as parseDateStable,Sn as parseGenerateResponse,on as parseNumberText,xn as parseQualifyResponse,vn as parseReviewVerdict,qt as parseTemporalPoint,un as payloadPreview,Bt as pickSeriesColumn,fn as readGenerateStream,Ne as readName,h as readWireField,Je as registerCityTable,pt as registerIso3Regions,P as resolveAdmin1,he as resolveFetchVersion,it as resolveGeoPoint,we as resolveLanguage,gn as resolvePointRoles,Nn as retryFields,Xe as safeDistinctValuesToShip,Te as schemaIdentity,kn as schemaIdentityKey,be as schemaTypeFamily,jt as seriesKeyVerdict,kt as shareOfTotalIsHonest,Ce as shortlistIsStale,xt as stripHostAggPrefix,gt as summarizeCountryRegions,ft as summarizeGeoExtent,ve as supportedLanguage,ct as toGeoIso,Fe as unsegmentedRuns,Pn as viewportFields,z as vocabularyLanguage,$e as wholeDayFrame,je as wholeDayIso,H as wireResponseFromFetch,ke as wordEndsWith,J as zipMatchPct,G as zipPrefixCandidates,nt as zipToPrefix3};
|
|
2
|
+
import{a as un,b as cn}from"./chunk-UQU75XXR.mjs";import{a as dn,b as j,c as mn,d as B,e as m,f as fn,g as H,h as pn}from"./chunk-5KAS4CFP.mjs";import{a as rn,b as on,c as sn,d as an,e as ln}from"./chunk-FNEHWEWX.mjs";import{A as Kt,B as Wt,C as $t,D as jt,E as Bt,F as Ht,G as Yt,H as Qt,I as Xt,J as Zt,K as Jt,L as en,M as tn,O as nn,a as pt,b as gt,c as yt,d as ht,e as Tt,f as St,g as Rt,h as xt,i as vt,j as Pt,k as Lt,l as Mt,m as _t,n as wt,o as Nt,p as At,q as It,r as Ft,s as Ot,t as kt,u as Vt,v as Dt,w as Gt,x as Ut,y as zt,z as qt}from"./chunk-KKSQBV76.mjs";import{a as Ct}from"./chunk-QEH7WTLB.mjs";import{a as bt,b as Et}from"./chunk-2LR73DNS.mjs";import{a as oe,b as ie,c as ct,d as dt,e as mt,f as ft}from"./chunk-6TVBXT4G.mjs";import{a as k,f as V,g as M,h as D,i as W,j as et,k as tt,l as re,m as L,n as nt,o as rt,p as ot,q as G,r as it,s as st,t as at,u as lt,v as $,w as ut}from"./chunk-TPVDJHU6.mjs";import"./chunk-5MRZID36.mjs";import{a as Xe,b as Ze,c as Je}from"./chunk-6Q3MQ2MK.mjs";import{A as Be,B as He,C as Ye,D as Qe,a as xe,b as ve,c as Pe,d as Le,e as Me,f as q,g as _e,h as we,i as Ne,j as Ae,k as Ie,l as Fe,m as Oe,n as ke,o as Ve,p as De,q as Ge,r as Ue,s as ze,u as K,v as qe,w as Ke,x as We,y as $e,z as je}from"./chunk-NFSQ4O5R.mjs";var Y=2,le=400;function X(t){return!!V(t)}function A(t){let e=new Set;for(let r of t){if(r==null)continue;let o=k(String(r));if(!D(o)&&!e.has(o)&&(e.add(o),e.size>=le))break}return Array.from(e)}function N(t){let e=A(t);if(e.length===0||Z(t)<95)return!1;let r=e.filter(u=>X(u)&&!L(u)).length,o=e.filter(u=>!X(u)&&!!L(u)).length;return r>=1&&r>=o}function se(t,e){if(!L(t))return!1;let r=V(t);return r?e==="world"?!0:re.has(r):!1}function Z(t){let e=A(t);if(e.length===0)return 0;let r=0;for(let o of e)X(o)&&r++;return Math.round(r/e.length*1e3)/10}function U(t){let e=A(t);if(e.length===0)return 0;let r=0;for(let o of e)L(o)&&r++;return Math.round(r/e.length*1e3)/10}function ee(t){let e=new Set;for(let r of t){if(r==null)continue;let o=String(r).trim();if(!D(k(o))&&!e.has(o)&&(e.add(o),e.size>=le))break}return Array.from(e)}function J(t){let e=ee(t);if(e.length===0)return 0;let r=0;for(let o of e)G(o).length>0&&r++;return Math.round(r/e.length*1e3)/10}function ae(t,e){return ie(e,oe)?!0:ee(t).some(r=>/^\d{5}(-\d{4})?$/.test(r.replace(/\.0+$/,"")))}function gn(t,e){let r=A(t);if(r.length===0)return 0;let o=0;for(let u of r)$(u,e)&&o++;return Math.round(o/r.length*1e3)/10}function Q(t,e){let r=0;for(let o of A(t))e(o)&&r++;return r}function yn(t,e){let r=0;for(let o of ee(t))e(o)&&r++;return r}function hn(t,e,r,o,u){let l=[],a=[],i={},C={},T=new Set(t),b=s=>e.map(c=>c[s]);for(let s of["city","country"]){let c=r?.[s];c&&T.has(c)&&(i[s]=c)}let R=new Set(u??t);for(let s of["lat","lon"]){let c=r?.[s];c&&R.has(c)&&(i[s]=c)}let y=r?.zip;if(y&&T.has(y)){let s=b(y),c=J(s);c<95?a.push(`zip=${y} (only ${c}% of values read as ZIPs)`):ae(s,y)?i.zip=y:a.push(`zip=${y} (all values are 3-4 digits with nothing to say they are postal)`)}let p=r?.state;if(p&&T.has(p)){let s=b(p),c=A(s);c.length>0&&c.every(g=>se(g,o))?a.push(`state=${p} (every value is "CA", which is both Canada and California)`):N(s)?(a.push(`state=${p} (every value is a country, not a state)`),i.country||(i.country=p)):U(s)<95?a.push(`state=${p} (only ${U(s)}% of values are states/provinces)`):i.state=p}let f=new Set(Object.values(i).filter(Boolean)),h=t.filter(s=>!f.has(s)&&!s.startsWith("__"));if(!i.state){let s=null;for(let c of h){let g=b(c);if(N(g))continue;let v=U(g);if(v<95)continue;let z=Q(g,O=>!!L(O)),Re=Q(g,O=>!!L(O)&&!se(O,o));z<Y&&Re<1||(!s||v>s.pct)&&(s={name:c,pct:v})}s&&(i.state=s.name,f.add(s.name),l.push(`state=${s.name} (${s.pct}% states/provinces)`))}if(!i.zip)for(let s of h){if(f.has(s))continue;let c=b(s),g=J(c);if(!(g<95)&&ae(c,s)&&!(yn(c,v=>G(v).length>0)<Y)){i.zip=s,f.add(s),l.push(`zip=${s} (${g}% ZIP codes)`);break}}let E=i.country;if(!E||!N(b(E))){let s=null;for(let c of h){if(f.has(c)||!N(b(c)))continue;let g=Z(b(c));(!s||g>s.pct)&&(s={name:c,pct:g})}s&&(E&&(a.push(`country=${E} (only ${Z(b(E))}% of values are country identifiers; using ${s.name} instead)`),C.country=E),i.country=s.name,f.add(s.name),l.push(`country=${s.name}`))}if(!i.city){let s=null;for(let c of h){if(f.has(c))continue;let g=b(c),v=gn(g,o);v<W||Q(g,z=>$(z,o))<Y||(!s||v>s.pct)&&(s={name:c,pct:v})}s&&(i.city=s.name,l.push(`city=${s.name} (${s.pct}% known cities)`))}let x=i.country?b(i.country):[],w=!!i.country&&N(x),F=w?new Set(x.map(s=>V(s==null?null:String(s))).filter(Boolean)).size:0,S=w&&F>=2,P=!!(i.lat&&i.lon)&&e.some(s=>{let c=+String(s[i.lat]??"").trim(),g=+String(s[i.lon]??"").trim();return isFinite(c)&&isFinite(g)&&c>=-90&&c<=90&&g>=-180&&g<=180&&String(s[i.lat]??"").trim()!==""&&String(s[i.lon]??"").trim()!==""});return i.lat&&i.lon&&!P&&a.push(`lat/lon=${i.lat}/${i.lon} (no row holds a usable coordinate pair)`),i.country&&!S&&!(i.city||i.state||i.zip||P)&&a.push(w?`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||S||P)?i:null,backfilled:l,refused:a,...Object.keys(C).length?{labelFallback:C}:{}}}var n=(t,...e)=>({part:t,langs:Object.freeze(e)}),te=Object.freeze({jaar:n("year","nl"),kwartaal:n("quarter","nl"),maand:n("month","nl"),dag:n("day","nl","sv","da","nb"),jahr:n("year","de"),quartal:n("quarter","de"),monat:n("month","de"),tag:n("day","de"),ann\u00E9e:n("year","fr"),mois:n("month","fr"),jour:n("day","fr"),trimestre:n("quarter","fr","es","pt","it"),a\u00F1o:n("year","es"),mes:n("month","es"),d\u00EDa:n("day","es"),ano:n("year","pt"),m\u00EAs:n("month","pt"),dia:n("day","pt"),anno:n("year","it"),mese:n("month","it"),giorno:n("day","it"),\u0433\u043E\u0434:n("year","ru"),\u043C\u0435\u0441\u044F\u0446:n("month","ru"),\u0440\u0456\u043A:n("year","uk"),\u043C\u0456\u0441\u044F\u0446\u044C:n("month","uk"),\u043A\u0432\u0430\u0440\u0442\u0430\u043B:n("quarter","ru","uk"),\u0434\u0435\u043D\u044C:n("day","ru","uk"),rok:n("year","pl","cs","sk"),kwarta\u0142:n("quarter","pl"),miesi\u0105c:n("month","pl"),dzie\u0144:n("day","pl"),\u010Dtvrtlet\u00ED:n("quarter","cs"),m\u011Bs\u00EDc:n("month","cs"),den:n("day","cs"),\u0161tvr\u0165rok:n("quarter","sk"),mesiac:n("month","sk"),de\u0148:n("day","sk"),\u00E5r:n("year","sv","da","nb"),kvartal:n("quarter","sv","da","nb"),m\u00E5nad:n("month","sv"),m\u00E5ned:n("month","da","nb"),vuosi:n("year","fi"),vuosinelj\u00E4nnes:n("quarter","fi"),kuukausi:n("month","fi"),p\u00E4iv\u00E4:n("day","fi"),\u00E9v:n("year","hu"),negyed\u00E9v:n("quarter","hu"),h\u00F3nap:n("month","hu"),nap:n("day","hu"),y\u0131l:n("year","tr"),\u00E7eyrek:n("quarter","tr"),ay:n("month","tr"),g\u00FCn:n("day","tr"),\u03AD\u03C4\u03BF\u03C2:n("year","el"),\u03C4\u03C1\u03AF\u03BC\u03B7\u03BD\u03BF:n("quarter","el"),\u03BC\u03AE\u03BD\u03B1\u03C2:n("month","el"),\u03B7\u03BC\u03AD\u03C1\u03B1:n("day","el"),an:n("year","ro"),trimestru:n("quarter","ro"),lun\u0103:n("month","ro"),zi:n("day","ro"),godina:n("year","hr"),tromjese\u010Dje:n("quarter","hr"),mjesec:n("month","hr"),dan:n("day","hr"),\u5E74:n("year","ja","zh"),\u56DB\u534A\u671F:n("quarter","ja"),\u5B63\u5EA6:n("quarter","zh"),\u6708:n("month","ja","zh"),\u65E5:n("day","ja","zh"),\uC5F0\uB3C4:n("year","ko"),\uBD84\uAE30:n("quarter","ko"),\uC6D4:n("month","ko"),\uC77C:n("day","ko"),tahun:n("year","id"),kuartal:n("quarter","id"),triwulan:n("quarter","id"),bulan:n("month","id"),hari:n("day","id"),n\u0103m:n("year","vi"),qu\u00FD:n("quarter","vi"),th\u00E1ng:n("month","vi"),ng\u00E0y:n("day","vi"),\u0E1B\u0E35:n("year","th"),\u0E44\u0E15\u0E23\u0E21\u0E32\u0E2A:n("quarter","th"),\u0E40\u0E14\u0E37\u0E2D\u0E19:n("month","th"),\u0E27\u0E31\u0E19:n("day","th"),\u0627\u0644\u0633\u0646\u0629:n("year","ar"),\u0633\u0646\u0629:n("year","ar"),\u0627\u0644\u0639\u0627\u0645:n("year","ar"),\u0639\u0627\u0645:n("year","ar"),\u0627\u0644\u0631\u0628\u0639:n("quarter","ar"),\u0631\u0628\u0639:n("quarter","ar"),"\u0631\u0628\u0639 \u0627\u0644\u0633\u0646\u0629":n("quarter","ar"),\u0627\u0644\u0634\u0647\u0631:n("month","ar"),\u0634\u0647\u0631:n("month","ar"),\u0627\u0644\u064A\u0648\u0645:n("day","ar"),\u064A\u0648\u0645:n("day","ar"),\u05E9\u05E0\u05D4:n("year","he"),\u05E8\u05D1\u05E2\u05D5\u05DF:n("quarter","he"),\u05D7\u05D5\u05D3\u05E9:n("month","he"),\u05D9\u05D5\u05DD:n("day","he"),\u0935\u0930\u094D\u0937:n("year","hi"),\u0938\u093E\u0932:n("year","hi"),\u0924\u093F\u092E\u093E\u0939\u0940:n("quarter","hi"),\u092E\u0939\u0940\u0928\u093E:n("month","hi"),\u092E\u093E\u0939:n("month","hi"),\u0926\u093F\u0928:n("day","hi"),\u0633\u0627\u0644:n("year","fa"),\u0645\u0627\u0647:n("month","fa"),\u0631\u0648\u0632:n("day","fa")}),Cn=Object.freeze(Array.from(new Set(Object.values(te).flatMap(t=>t.langs)))),ue=Object.freeze(["fa","ar","he","th"]),ce=1900,de=2100;function bn(t,e){let r=[],o=q(e);try{o&&r.push(t.toLocaleLowerCase(o.intl))}catch{}let u=t.toLowerCase();return r.includes(u)||r.push(u),r}function En(t,e){let r=String(t??"").trim().normalize("NFC");if(!r)return null;for(let o of bn(r,e)){let u=te[o];if(u&&u.langs.includes(e))return u.part}return null}function Tn(t,e){return ue.includes(t)?typeof e=="number"&&Number.isFinite(e)&&e>=ce&&e<=de:!0}function me(t,e){let r=e?.freemiumMaxShapeColumns;return typeof r!="number"||!isFinite(r)||r<1?null:!isFinite(t)||t<=r?0:Math.round(t-r)}function Sn(t,e,r){let o=me(t,e);if(o===null||o<=0)return null;let u=typeof e?.freemiumColumnCapPivot=="number"?e.freemiumColumnCapPivot:4,l=o>u?e?.freemiumColumnCapMessageMany:e?.freemiumColumnCapMessageFew;if(typeof l!="string"||l.trim().length===0)return null;let a=l.split("{n}").join(String(o)).split("{fields}").join(o===1?"field":"fields"),i=fe(r);return i.length===0?a:a+" "+i.join(" ")}function fe(t){if(!t||t.length===0)return[];let e=[],r=new Map,o=new Map;for(let l of t){let a=typeof l?.dateGroupId=="string"?l.dateGroupId.trim():"";if(a!==""&&(r.has(a)||(e.push(a),r.set(a,0)),l.isDatePart===!0&&r.set(a,r.get(a)+1),l.isReassembledDate===!0&&!o.has(a))){let i=typeof l.sourceField=="string"?l.sourceField.trim():"",C=typeof l.name=="string"?l.name.trim():"",T=i!==""?i:C;T!==""&&o.set(a,T)}}let u=[];for(let l of e){let a=o.get(l),i=r.get(l)??0;!a||i===0||u.push(`'${a}' is a date hierarchy and counts as ${i+1} fields - bind the date itself instead of its hierarchy.`)}return u}var d=t=>t==null?"":String(t),_=t=>t===!0,pe=t=>{if(typeof t=="number")return Number.isFinite(t)?t:null;if(typeof t=="string"&&t.trim()!==""){let e=Number(t);return Number.isFinite(e)?e:null}return null},Rn=[["city","CityColumn"],["state","StateColumn"],["zip","ZipColumn"],["lat","LatColumn"],["lon","LonColumn"],["country","CountryColumn"]];function ge(t,e){let r={};for(let[o,u]of Rn){let l=d(m(t,e+u));l&&(r[o]=l)}return r}function xn(t){return Array.isArray(t)?t.map(e=>({code:d(m(e,"code")),severity:d(m(e,"severity")),text:d(m(e,"text"))})).filter(e=>e.text!==""):[]}function vn(t){let e=C=>m(t,C),r=e("retryAfterSeconds"),o=e("overrideThumbnailUpload"),u=e("forceThumbnailUpload"),l=ge(t,"point"),a=ge(t,"destPoint");Object.keys(a).length&&(l.dest=a);let i=e("retryable");return{errorMessage:d(e("errorMessage")),errorCode:d(e("errorCode")),refusalCode:d(e("refusalCode")),retryable:typeof i=="boolean"?i:null,notices:xn(e("notices")),freemiumStatusCode:d(e("freemiumStatusCode")),code:d(e("code")),language:d(e("language")),version:Number(e("version")??0),codeSummary:d(e("codeSummary")),chartName:d(e("chartName")??e("chartType")),finalChartName:d(e("finalChartName")),warningMessage:d(e("warningMessage")),outputHash:d(e("outputHash")),validatorToken:d(e("validatorToken")),editCodeKey:d(e("editCodeKey")),signedLLMRequestID:d(e("signedLLMRequestID")),userReply:d(e("userReply")),userReplyOutcome:d(e("userReplyOutcome")),improvementSuggestion:d(e("improvementSuggestion")),geoColumn:d(e("geoColumn")),geoKind:d(e("geoKind")),geoPointCols:Object.keys(l).length?l:null,creditBalanceBefore:pe(e("creditBalanceBefore")),creditCost:pe(e("creditCost")),isServiceError:_(e("isServiceError")),isRateLimited:_(e("isRateLimited")),isRefusal:_(e("isRefusal")),isVersionNotFound:_(e("isVersionNotFound")),isGenerationCancelled:_(e("isGenerationCancelled")),retryAfterSeconds:typeof r=="number"&&Number.isFinite(r)?r:null,servedCorrelationId:d(e("servedCorrelationId")),...typeof o=="boolean"?{overrideThumbnailUpload:o}:{},...typeof u=="boolean"?{forceThumbnailUpload:u}:{}}}var ye=t=>t==null?void 0:Number(t),I=t=>d(t)||void 0;function Pn(t){let e=m(t,"charts"),r=m(t,"refused"),o=Array.isArray(e)?e.map(l=>{let a=C=>m(l,C),i=a("recommended");return{name:d(a("chartTypeName")??a("name")),description:d(a("description")??a("chartDesc")),rank:ye(a("rank")),score:ye(a("score")),renderer:I(a("renderer")),language:I(a("language")),isPreview:_(a("isPreview")),recommended:typeof i=="boolean"?i:void 0,viaProjection:I(a("viaProjection")),viaProjectionKey:I(a("viaProjectionKey")),detailNote:I(a("detailNote"))}}).filter(l=>l.name):null,u=Array.isArray(r)?r.map(l=>({name:d(m(l,"chartTypeName")??m(l,"name")),reason:d(m(l,"reason")),reasonCode:d(m(l,"reasonCode")),isVeto:_(m(l,"isVeto"))})).filter(l=>l.name):[];return{errorMessage:d(m(t,"errorMessage")),errorCode:d(m(t,"errorCode")),charts:o,refused:u,noFitSummary:d(m(t,"noFitSummary"))}}function Ln(t){return!t||typeof t!="object"?null:{status:String(m(t,"status")??""),verdictReason:m(t,"verdictReason")??null,instruction:m(t,"instruction")??null,fix:m(t,"fix")??null,errorMessage:m(t,"errorMessage")??null,errorCode:m(t,"errorCode")??null}}var he=["working","analyze","generate","refine","review"];function Mn(t,e){let r=String(t??"").trim().toLowerCase();if(he.includes(r))return r;let o=String(e??"").toLowerCase();return o.includes("analyz")?"analyze":o.includes("generat")?"generate":o.includes("refin")?"refine":o.includes("review")?"review":null}var _n="FREEMIUM_ATTEMPT_SPENT",wn="CLIENT_SECRET_MISMATCH",Nn="FREEMIUM_COLUMN_CAP";function An(t){let e=t?.retryable;return typeof e=="boolean"?e:null}function In(t){let e=t.linkNonce?(t.linkNonce()??"").trim():null,r=e?{licensee:"",licenseKey:"",secretKey:""}:t.triple();return{request:{licenseKey:r.licenseKey,licensee:r.licensee,secretKey:r.secretKey,freemiumKey:t.freemiumKey?.()??""},linkNonce:e}}function Fn(t){let{width:e,height:r}=t.measure();return{request:{height:r,width:e},hints:{viewportWidth:e,viewportHeight:r}}}function On(t){let e=0;for(let r of t){if(r.isMeasure)continue;let o=r.distinctCount;typeof o=="number"&&o>e&&(e=o)}return e}function Ce(t){if(t.recoveryFetchByCorrelation)return{version:null,fetchOnly:!0};if(t.recoveryFetchVersion!=null)return{version:t.recoveryFetchVersion,fetchOnly:!0};let e=t.settingVersion??null;if(t.genNew)return{version:e,fetchOnly:void 0};let r=(e??0)>0?e:null,o=(t.codeVersion??0)>0?t.codeVersion:null,u=r??o??e;return{version:u,fetchOnly:u!=null&&u>0?!0:void 0}}function kn(t){let e=t.fetchCorrelationId!=null,o=e||t.recoveryFetchVersion!=null?!1:t.genNew,u=Ce({genNew:o,recoveryFetchVersion:t.recoveryFetchVersion,recoveryFetchByCorrelation:e,settingVersion:t.settingVersion,codeVersion:t.codeVersion});return{genNew:o,version:u.version,fetchOnly:u.fetchOnly,fetchCorrelationId:t.fetchCorrelationId??void 0}}function Vn(t){let e=r=>t.renderers.has(r);return{supportsD3:e("D3"),supportsPlotly:e("PLOTLY"),supportsVega:e("VEGA")}}function Dn(t){let e=t.cap!=null&&t.budget>t.cap?t.cap:t.budget;return{triesLeft:t.triesLeft??e,maxTries:e}}function Gn(t){return t&&t>0?{leafCardinality:Math.round(t)}:{}}function be(t,e){return t!=null&&e!=null&&t!==e}function Un(t,e){return t?be(e.capturedFor,e.now)?{shortlist:void 0,stale:!0}:{shortlist:{...t,ageMs:e.atMs>0?Math.max(0,Math.round(e.nowMs-e.atMs)):void 0},stale:!1}:{shortlist:void 0,stale:!1}}var zn=Object.freeze({integer:"number",decimal:"number",double:"number",datetime:"date",date:"date",boolean:"boolean",string:"text"});function Ee(t){let e=String(t??"").trim().toLowerCase();return zn[e]??e}function Te(t){let e="";for(let r of t)e+=JSON.stringify([String(r.name??""),r.isMeasure?"M":"D",Ee(r.dataType)]);return e}function qn(t){return K(Te(t))}var Kn=2,Wn=3,$n=4,jn=64,Bn=8e3,Hn=6e4,Yn=Object.freeze({RENDER_START:"render-start",RENDER_OK:"render-ok",RENDER_ERROR:"render-error",VIEW:"view",VIEW_VERDICT:"view-verdict"});function Qn(t){return!!t&&!t.includes("|")&&!t.includes(",")}function ne(t,e,r,o){let u=`${t},${e}|${r}`;return o?`${u}|${Math.max(0,Math.round(o.count))}|${o.nonce}`:u}function Xn(t,e){let r=t;if(!r||!r.signer||typeof r.signer.sign!="function")throw new TypeError("createTelemetryClient needs the host's signer");if(!r.transport||typeof r.transport.post!="function")throw new TypeError("createTelemetryClient needs the host's transport");if(!r.clock||typeof r.clock.now!="function")throw new TypeError("createTelemetryClient needs the host's clock");if(!e||typeof e.baseUrl!="string"&&typeof e.baseUrl!="function")throw new TypeError("createTelemetryClient needs the service's base URL");if(typeof e.baseUrl=="string"&&e.baseUrl==="")throw new TypeError("createTelemetryClient needs the service's base URL");if(typeof e.clientVersion!="string"||e.clientVersion==="")throw new TypeError("createTelemetryClient needs the client version");if(typeof e.timeoutMs!="number"||!Number.isFinite(e.timeoutMs)||e.timeoutMs<=0)throw new TypeError("createTelemetryClient needs a positive deadline in milliseconds");let{signer:o,transport:u,clock:l}=r,a=e.apiPath??"/api",i=e.timeoutMs,C=()=>typeof e.baseUrl=="function"?e.baseUrl():e.baseUrl,T=R=>{try{e.onFailure?.(R)}catch{}},b=async(R,y,p,f)=>{let h;try{let E=await u.post(y,p,f,{timeoutMs:i});h=E.status;try{E.body?.cancel().catch(()=>{})}catch{}}catch(E){T({channel:R,stage:"post",status:null,error:E});return}(h<200||h>299)&&T({channel:R,stage:"status",status:h,error:null})};return{async sendClientMessage(R){let y,p,f;try{y=`${C()}${a}/LogClientMsg/?nocache=${l.now()}`,p=j(R),f=B(p,o)}catch(h){T({channel:"client-message",stage:"build",status:null,error:h});return}await b("client-message",y,p,{"Content-Type":"text/plain","X-Signature":f})},async countEvent(R,y,p){let f,h;try{f=`${C()}${a}/eventlog`,h=ne(R,e.clientVersion,y,p)}catch(E){T({channel:"event-count",stage:"build",status:null,error:E});return}await b("event-count",f,h,{"Content-Type":"text/plain"})}}}function Se(t){return Object.assign(new Error(`The request did not finish within ${t} ms.`),{name:"TimeoutError"})}function Zn(t,e={}){if(typeof t!="function")throw new TypeError("fetchTransport needs the host's fetch");let r=t,o=e.credentials??"omit";return{async post(u,l,a,i){let C=i.timeoutMs,T=new AbortController,b=!1,R=setTimeout(()=>{b=!0,T.abort(Se(C))},C),y=()=>T.abort(i.signal?.reason);i.signal&&(i.signal.aborted?y():i.signal.addEventListener("abort",y,{once:!0}));let p=!1,f=()=>{p||(p=!0,clearTimeout(R),i.signal?.removeEventListener("abort",y))},h=S=>b?Se(C):S,E;try{E=await r(u,{method:"POST",body:l,headers:a,credentials:o,signal:T.signal})}catch(S){throw f(),h(S)}let x=H(E);if(!x.body)return{status:x.status,contentType:x.contentType,body:null,text:async()=>{try{return await x.text()}catch(S){throw h(S)}finally{f()}}};let w=x.body.getReader(),F=new ReadableStream({async pull(S){try{let P=await w.read();if(P.done){f(),S.close();return}S.enqueue(P.value)}catch(P){f(),S.error(h(P))}},cancel(S){return f(),w.cancel(S)}});return{status:x.status,contentType:x.contentType,body:F,text:()=>new Response(F).text()}}}}export{W as CITY_ROLE_MATCH_PCT,Yn as CLIENT_EVENT_KINDS,wn as CLIENT_SECRET_MISMATCH,Oe as COMPOUND_MIN_STEM,de as DATE_LEVEL_GREGORIAN_YEAR_MAX,ce as DATE_LEVEL_GREGORIAN_YEAR_MIN,Cn as DATE_LEVEL_LANGUAGES,te as DATE_LEVEL_NAMES,ue as DATE_LEVEL_NON_GREGORIAN_LANGUAGES,Ut as DEFAULT_GAP_FACTOR,We as DEFAULT_TEMPERATURE,_n as FREEMIUM_ATTEMPT_SPENT,Nn as FREEMIUM_COLUMN_CAP,qe as GET_RANDOM,Ve as GLUED_STEM_MIN,St as INTENSIVE_SUFFIX_TOKENS,Tt as INTENSIVE_WORD_TOKENS,nn as IndexedText,zt as MAX_RUN_BOUNDS,xt as POSITIONAL_SUFFIX_TOKENS,Rt as POSITIONAL_WORD_TOKENS,un as PREVIEW_OMITTED_FIELDS,he as PROGRESS_STAGE_IDS,M as ROLE_MATCH_PCT,Wt as SERIES_COMPLETENESS_MAX_LISTED,$t as SERIES_COMPLETENESS_MIN_FILL,jt as SERIES_KEY_MAX_DISTINCT,$n as SEV_ERROR,Kn as SEV_INFO,jn as SEV_USER_PRESENTED,Wn as SEV_WARNING,K as SIMPLE_STRING_HASH,ze as STR,Ge as SUBSTRING_MIN,xe as SUPPORTED_LANGUAGES,ve as SUPPORTED_LANGUAGE_CODES,Hn as TELEMETRY_TIMEOUT_DEV_MS,Bn as TELEMETRY_TIMEOUT_MS,Me as VOCABULARY_LANGUAGE_CODES,Le as VOCABULARY_ONLY_LANGUAGES,U as admin1MatchPct,It as allowedAggregations,An as answerIsRetryable,ft as buildGeoIsoColumn,at as buildGeoPointColumns,Vn as capabilityFields,ut as cityMatchPct,lt as cityTagsFor,en as classifyAdditivity,At as classifyForAggregation,tn as classifyNumericValueNature,Zt as classifyTemporal,Mt as codeNeedsLegacyAggNames,Vt as codeReadsColumn,Dt as codeReadsColumnsByRoleOrPosition,Lt as collapseRepeatedAggPrefix,Gt as columnsTheCodeReads,yt as countryRegion,Xn as createTelemetryClient,In as credentialFields,En as dateLevelPart,Tn as dateLevelYearAdmits,rn as decimalSeparatorOf,Ft as defaultAggregation,on as detectDecimalSeparator,Ct as detectFormatSignature,ct as detectGeo,Je as detectOrdinalDomain,Xt as detectTextDatePattern,j as encodePayload,an as engineTypeForSqlType,_t as englishImplicitAggNames,ne as eventLogLine,kn as fetchFields,Zn as fetchTransport,we as foldName,Sn as freemiumColumnCapRefusal,me as freemiumColumnsOverCap,fe as freemiumDateHierarchyClauses,De as gluedPrefixStems,dn as gzipWireText,Pt as hasDefaultAggPrefix,Ie as hasUnsegmentedScript,Jt as hostAggHint,ln as ingest,Ot as isAggregationAllowed,D as isBlankLike,tt as isCityTableLoaded,Ke as isDeterministicRefusal,Qn as isEventLogCode,it as isGeoPointAmbiguity,Qt as isIdentifierName,mt as isJoinGeoKind,fn as isNdjsonContentType,Xe as isOrdinalFriendlyName,mn as keyedSigner,Gn as leafCardinalityField,Ye as localMidnightDateColumns,He as localMidnightToUtcDay,N as looksLikeCountryColumn,Ue as matchNameToken,On as maxNonMeasureCardinality,Kt as measureCadence,Yt as measureSeriesCompleteness,B as messageSignature,Et as monthLookupFor,Nt as nameLooksIntensiveRate,wt as nameLooksPositional,Ne as nameWords,nt as normalizeCountry,Qe as normalizeLocalMidnightDates,bt as normalizeMonthKey,k as normalizePlaceName,ot as normalizeZip5,Un as offeredShortlistFor,$e as parseDateStable,vn as parseGenerateResponse,sn as parseNumberText,Pn as parseQualifyResponse,Ln as parseReviewVerdict,qt as parseTemporalPoint,cn as payloadPreview,Ht as pickSeriesColumn,Mn as progressStageOf,pn as readGenerateStream,Ae as readName,m as readWireField,et as registerCityTable,gt as registerIso3Regions,L as resolveAdmin1,Ce as resolveFetchVersion,st as resolveGeoPoint,_e as resolveLanguage,hn as resolvePointRoles,Dn as retryFields,Ze as safeDistinctValuesToShip,Te as schemaIdentity,qn as schemaIdentityKey,Ee as schemaTypeFamily,Bt as seriesKeyVerdict,kt as shareOfTotalIsHonest,be as shortlistIsStale,vt as stripHostAggPrefix,ht as summarizeCountryRegions,pt as summarizeGeoExtent,Pe as supportedLanguage,dt as toGeoIso,Fe as unsegmentedRuns,Fn as viewportFields,q as vocabularyLanguage,je as wholeDayFrame,Be as wholeDayIso,H as wireResponseFromFetch,ke as wordEndsWith,J as zipMatchPct,G as zipPrefixCandidates,rt as zipToPrefix3};
|
package/dist/testing.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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{f as A,h as g}from"./chunk-
|
|
2
|
+
import{f as A,h as g}from"./chunk-5KAS4CFP.mjs";import"./chunk-NFSQ4O5R.mjs";var S=class extends Error{contract;failures;constructor(e,s){super(`${e} conformance failed:
|
|
3
3
|
- ${s.join(`
|
|
4
4
|
- `)}`),this.name="ConformanceError",this.contract=e,this.failures=s}},m=class{constructor(e){this.contract=e}contract;failures=[];check(e,s){e||this.failures.push(s)}fail(e){this.failures.push(e)}throwIfFailed(){if(this.failures.length)throw new S(this.contract,this.failures.slice())}},$="H4sIAAAAAAAAA6tWyk0tSs5ITUxRslIqS8wpTVWqBQBL0RbkEwAAAA==",R="H4sIAAAAAAAAA6tWSkksSVSyUsrMyyrKz1OqBQBVrD9YEAAAAA==";function u(n){return n instanceof Error?`${n.name}: ${n.message}`:String(n)}function x(n){let e=new m("WireSigner");(!n||typeof n.sign!="function")&&(e.fail("the signer has no sign() method"),e.throwIfFailed());let s,d,l;try{s=n.sign($),d=n.sign($),l=n.sign(R)}catch(a){e.fail(`sign() threw on an ordinary encoded body: ${u(a)}`),e.throwIfFailed()}e.check(typeof s=="string",`sign() returned ${typeof s}, not a string`),e.check(typeof s!="string"||s.trim()!=="","sign() returned a blank signature"),e.check(s===d,"sign() is not deterministic: the same body signed twice gave two signatures"),e.check(s!==l,"sign() gave two different bodies the same signature"),e.throwIfFailed()}async function q(n){let e=new m("WireResponse"),s=new TextEncoder,d=[`{"type":"progress","stage":"Reading your data"}
|
|
5
5
|
`,`{"type":"result","result":{"code":"x","version":2}}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export type { SeriesCompleteness, SeriesCoverage, SeriesKeyCandidate, SeriesKeyV
|
|
|
9
9
|
export { classifyForAggregation, allowedAggregations, defaultAggregation, isAggregationAllowed, shareOfTotalIsHonest, nameLooksIntensiveRate, nameLooksPositional, stripHostAggPrefix, hasDefaultAggPrefix, collapseRepeatedAggPrefix, codeNeedsLegacyAggNames, englishImplicitAggNames, INTENSIVE_WORD_TOKENS, INTENSIVE_SUFFIX_TOKENS, POSITIONAL_WORD_TOKENS, POSITIONAL_SUFFIX_TOKENS, } from "./aggregation";
|
|
10
10
|
export type { AggKind, AggAdditivity, AggBasis, AggNature, AggregationClass, AggregationColumn, } from "./aggregation";
|
|
11
11
|
export type { LLMColumnWithValue } from "./models";
|
|
12
|
-
export type { LLMRequestModifier, SimpleColumn, VegaRendererPayload, LLMClientHints, LLMRequestCode, LLMQualifyResult, LLMRequestCodeResult, GetLicenseStatusResult, } from "./models";
|
|
12
|
+
export type { LLMRequestModifier, SimpleColumn, VegaRendererPayload, LLMClientHints, LLMRequestCode, LLMQualifyResult, LLMRequestCodeResult, LLMResultNotice, GetLicenseStatusResult, } from "./models";
|
|
13
13
|
export { ROLE_MATCH_PCT, CITY_ROLE_MATCH_PCT, isBlankLike } from "./matchQuality";
|
|
14
14
|
export { detectOrdinalDomain, safeDistinctValuesToShip, isOrdinalFriendlyName } from "./ordinalDetector";
|
|
15
15
|
export { detectFormatSignature } from "./formatDetector";
|
|
@@ -44,8 +44,11 @@ export type { WireSigner, WireTransport, WireResponse, CredentialTriple, Credent
|
|
|
44
44
|
export { encodePayload, gzipWireText, keyedSigner, messageSignature, readWireField } from "./wire";
|
|
45
45
|
export type { GzipText } from "./wire";
|
|
46
46
|
export { readGenerateStream, isNdjsonContentType, wireResponseFromFetch } from "./wireStream";
|
|
47
|
+
export type { OnStage } from "./wireStream";
|
|
47
48
|
export { parseGenerateResponse, parseQualifyResponse, parseReviewVerdict } from "./wireParse";
|
|
48
|
-
export type { ParsedGenerateResponse, ParsedQualifyResponse, ParsedQualifyChart, ParsedQualifyRefusal, ParsedReviewVerdict, WirePointBinding, WirePointColumns, } from "./wireParse";
|
|
49
|
+
export type { ParsedGenerateResponse, ParsedQualifyResponse, ParsedQualifyChart, ParsedQualifyRefusal, ParsedReviewVerdict, ParsedNotice, WirePointBinding, WirePointColumns, } from "./wireParse";
|
|
50
|
+
export { PROGRESS_STAGE_IDS, progressStageOf, FREEMIUM_ATTEMPT_SPENT, CLIENT_SECRET_MISMATCH, FREEMIUM_COLUMN_CAP, answerIsRetryable, } from "./messageCodes";
|
|
51
|
+
export type { ProgressStageId } from "./messageCodes";
|
|
49
52
|
export { viewportFields, maxNonMeasureCardinality, credentialFields, resolveFetchVersion, fetchFields, capabilityFields, retryFields, leafCardinalityField, shortlistIsStale, offeredShortlistFor, } from "./wireBuild";
|
|
50
53
|
export type { ViewportFields, CredentialFields, FetchRequest, FetchFields, CapabilityFields, RetryFields, } from "./wireBuild";
|
|
51
54
|
export { schemaIdentity, schemaIdentityKey, schemaTypeFamily } from "./schemaIdentity";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** The progress stages a generation reports, as the stream's `stageId`. `working` is the stage
|
|
2
|
+
* before the first milestone. */
|
|
3
|
+
export declare const PROGRESS_STAGE_IDS: readonly ["working", "analyze", "generate", "refine", "review"];
|
|
4
|
+
export type ProgressStageId = typeof PROGRESS_STAGE_IDS[number];
|
|
5
|
+
/**
|
|
6
|
+
* Which stage a progress line reports: its `stageId` when the server sent a known one, otherwise -
|
|
7
|
+
* an older server, which sends only the English label - the label read the way hosts always read it
|
|
8
|
+
* (`analyz`, `generat`, `refin`, `review`). null when neither says: a host then shows the label as
|
|
9
|
+
* it is. A known code always wins over the label, whatever language the label is in.
|
|
10
|
+
*/
|
|
11
|
+
export declare function progressStageOf(stageId: string | null | undefined, stageLabel: string | null | undefined): ProgressStageId | null;
|
|
12
|
+
/** The freemium state that claims the attempt produced NO chart - the one message a chart already
|
|
13
|
+
* on screen contradicts. Every other freemium state (the limit reached, a warning) stays true with
|
|
14
|
+
* a chart painted. */
|
|
15
|
+
export declare const FREEMIUM_ATTEMPT_SPENT = "FREEMIUM_ATTEMPT_SPENT";
|
|
16
|
+
/** The licence answer for an account whose Client Secret Key is missing or does not match - the
|
|
17
|
+
* one a host answers by dropping a stale saved secret. */
|
|
18
|
+
export declare const CLIENT_SECRET_MISMATCH = "CLIENT_SECRET_MISMATCH";
|
|
19
|
+
/** The free tier's field cap: a wall that spent nothing (the historical `refusalCode`, kept). */
|
|
20
|
+
export declare const FREEMIUM_COLUMN_CAP = "FREEMIUM_COLUMN_CAP";
|
|
21
|
+
/**
|
|
22
|
+
* May the same request, sent again, answer differently? The server's `retryable` flag when it sent
|
|
23
|
+
* one; null when it did not (a success, or a server older than the flag) - the host then decides as
|
|
24
|
+
* it did before. Never read from the message text.
|
|
25
|
+
*/
|
|
26
|
+
export declare function answerIsRetryable(answer: {
|
|
27
|
+
retryable?: boolean | null;
|
|
28
|
+
} | null | undefined): boolean | null;
|
package/dist/types/models.d.ts
CHANGED
|
@@ -262,6 +262,7 @@ export type LLMOfferedShortlist = {
|
|
|
262
262
|
};
|
|
263
263
|
export type LLMQualifyResult = {
|
|
264
264
|
errorMessage?: string;
|
|
265
|
+
errorCode?: string;
|
|
265
266
|
charts?: {
|
|
266
267
|
name?: string;
|
|
267
268
|
description?: string;
|
|
@@ -285,6 +286,7 @@ export type LLMQualifyResult = {
|
|
|
285
286
|
refused?: {
|
|
286
287
|
name?: string;
|
|
287
288
|
reason?: string;
|
|
289
|
+
reasonCode?: string;
|
|
288
290
|
isVeto?: boolean;
|
|
289
291
|
}[];
|
|
290
292
|
noFitSummary?: string;
|
|
@@ -298,6 +300,9 @@ export type LLMRequestCodeResult = {
|
|
|
298
300
|
isServiceError: boolean;
|
|
299
301
|
isRefusal?: boolean;
|
|
300
302
|
refusalCode?: string;
|
|
303
|
+
errorCode?: string;
|
|
304
|
+
retryable?: boolean;
|
|
305
|
+
notices?: LLMResultNotice[];
|
|
301
306
|
isRateLimited?: boolean;
|
|
302
307
|
retryAfterSeconds?: number;
|
|
303
308
|
isVersionNotFound?: boolean;
|
|
@@ -318,6 +323,7 @@ export type LLMRequestCodeResult = {
|
|
|
318
323
|
freemiumPercentUsedRaw?: number;
|
|
319
324
|
freemiumExhausted?: boolean;
|
|
320
325
|
freemiumStatusMessage?: string;
|
|
326
|
+
freemiumStatusCode?: string;
|
|
321
327
|
userReply?: string;
|
|
322
328
|
userReplyOutcome?: string;
|
|
323
329
|
improvementSuggestion?: string;
|
|
@@ -337,8 +343,15 @@ export type LLMRequestCodeResult = {
|
|
|
337
343
|
destPointLonColumn?: string;
|
|
338
344
|
destPointCountryColumn?: string;
|
|
339
345
|
};
|
|
346
|
+
export type LLMResultNotice = {
|
|
347
|
+
code?: string;
|
|
348
|
+
severity?: string;
|
|
349
|
+
text?: string;
|
|
350
|
+
};
|
|
340
351
|
export type GetLicenseStatusResult = {
|
|
341
352
|
errorMessage: string;
|
|
353
|
+
errorCode?: string;
|
|
354
|
+
freemiumStatusCode?: string;
|
|
342
355
|
canContinue: boolean;
|
|
343
356
|
creditsLeft?: number;
|
|
344
357
|
warnCredits: boolean;
|
|
@@ -11,10 +11,31 @@ export interface WirePointColumns {
|
|
|
11
11
|
export interface WirePointBinding extends WirePointColumns {
|
|
12
12
|
dest?: WirePointColumns;
|
|
13
13
|
}
|
|
14
|
+
/** One sentence of the composed warning, with the code that names it. */
|
|
15
|
+
export interface ParsedNotice {
|
|
16
|
+
/** Stable, kebab-case ("summed-rate", "pick-substituted", ...); "" when the server sent none. */
|
|
17
|
+
code: string;
|
|
18
|
+
/** "blocked" | "substituted" | "data" | "advisory", or "" when absent. */
|
|
19
|
+
severity: string;
|
|
20
|
+
text: string;
|
|
21
|
+
}
|
|
14
22
|
/** A generate result's fields, typed. */
|
|
15
23
|
export interface ParsedGenerateResponse {
|
|
16
24
|
/** The server's own words when it declined. "" on a success. */
|
|
17
25
|
errorMessage: string;
|
|
26
|
+
/** WHICH message errorMessage is, as a stable code; "" on a success and from an older server.
|
|
27
|
+
* Decide by this, never by the sentence (messageCodes.ts). */
|
|
28
|
+
errorCode: string;
|
|
29
|
+
/** Which refusal, when the server declined before any model ran; "" otherwise. */
|
|
30
|
+
refusalCode: string;
|
|
31
|
+
/** Whether the same request sent again can answer differently: true or false when the server
|
|
32
|
+
* said, null when it did not (a success, or an older server - decide as before). */
|
|
33
|
+
retryable: boolean | null;
|
|
34
|
+
/** The composed warning, sentence by sentence; [] when there is none or the server is older.
|
|
35
|
+
* Joining the texts in order gives warningMessage. */
|
|
36
|
+
notices: ParsedNotice[];
|
|
37
|
+
/** Which freemium state freemiumStatusMessage states; "" when absent. */
|
|
38
|
+
freemiumStatusCode: string;
|
|
18
39
|
code: string;
|
|
19
40
|
language: string;
|
|
20
41
|
/** 0 when absent. */
|
|
@@ -95,6 +116,9 @@ export interface ParsedQualifyRefusal {
|
|
|
95
116
|
name: string;
|
|
96
117
|
/** A sentence naming one requirement the data fails; "" when the server could not name it. */
|
|
97
118
|
reason: string;
|
|
119
|
+
/** Which gate wrote the reason, as a stable code; "" when there is no reason or the server is
|
|
120
|
+
* older. A host may word a code it knows itself; the sentence is the fallback. */
|
|
121
|
+
reasonCode: string;
|
|
98
122
|
/**
|
|
99
123
|
* True only when the server said so: a required channel is absent and no rebinding supplies
|
|
100
124
|
* it. Absent, null or anything but true reads as a preference an explicit pick may override -
|
|
@@ -105,6 +129,8 @@ export interface ParsedQualifyRefusal {
|
|
|
105
129
|
/** A qualify answer's fields, typed. */
|
|
106
130
|
export interface ParsedQualifyResponse {
|
|
107
131
|
errorMessage: string;
|
|
132
|
+
/** Which message errorMessage is; "" on success and from an older server. */
|
|
133
|
+
errorCode: string;
|
|
108
134
|
/** In the server's order - it IS the ranking. null when the body carried no list at all. */
|
|
109
135
|
charts: ParsedQualifyChart[] | null;
|
|
110
136
|
refused: ParsedQualifyRefusal[];
|
|
@@ -126,6 +152,9 @@ export interface ParsedReviewVerdict {
|
|
|
126
152
|
*/
|
|
127
153
|
fix: unknown;
|
|
128
154
|
errorMessage: string | null;
|
|
155
|
+
/** Which message errorMessage is (a REVIEW_* or licence code); null when absent. A fix's own
|
|
156
|
+
* code is on the fix. */
|
|
157
|
+
errorCode: string | null;
|
|
129
158
|
}
|
|
130
159
|
/** A vision-review body -> its verdict. null for a null or non-object body. */
|
|
131
160
|
export declare function parseReviewVerdict(data: unknown): ParsedReviewVerdict | null;
|
|
@@ -15,9 +15,14 @@ export declare function wireResponseFromFetch(res: {
|
|
|
15
15
|
body?: ReadableStream<Uint8Array> | null;
|
|
16
16
|
text(): Promise<string>;
|
|
17
17
|
}): WireResponse;
|
|
18
|
+
/** A progress line: the stage's display text (never empty) and its code, undefined from an older
|
|
19
|
+
* server. */
|
|
20
|
+
export type OnStage = (stage: string, stageId?: string) => void;
|
|
18
21
|
/**
|
|
19
22
|
* The generate result a response carries, whether it streamed or not. `onStage` receives each
|
|
20
|
-
*
|
|
21
|
-
* the
|
|
23
|
+
* progress line as it arrives: the stage label (display text) and, from a server that sends one,
|
|
24
|
+
* its `stageId` - the code a host picks its own waiting lines by (see `progressStageOf`), never the
|
|
25
|
+
* label. A line with no label is skipped, as it always was. Throws when there is no result (see the rules at the top
|
|
26
|
+
* of this file for which error means what).
|
|
22
27
|
*/
|
|
23
|
-
export declare function readGenerateStream(res: WireResponse, onStage?:
|
|
28
|
+
export declare function readGenerateStream(res: WireResponse, onStage?: OnStage): Promise<Record<string, any>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bicharts/shape-core",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.36",
|
|
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",
|
package/dist/chunk-JF3BJI7F.mjs
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
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{u as c}from"./chunk-NFSQ4O5R.mjs";import{gzip as h}from"pako";var w=e=>h(e);function P(e){return x(w(JSON.stringify(e))).replace(/\//g,".")}function x(e){let t="";for(let r=0;r<e.length;r+=32768)t+=String.fromCharCode(...e.subarray(r,r+32768));return btoa(t)}function T(e){if(typeof e!="string"||e==="")throw new TypeError("keyedSigner needs the host's signing key");return{sign:t=>String(c(t+e))}}function W(e,t){let n=t.sign(e);if(typeof n!="string"||n.trim()==="")throw new TypeError("the host's signer returned a blank signature");return n}function u(e,t){if(e==null||typeof e!="object")return;let n=e,r=n[t];return r??n[t.charAt(0).toUpperCase()+t.slice(1)]}function m(e){return String(e??"").toLowerCase().includes("ndjson")}function C(e){let t=null;try{t=e.headers?.get?.("content-type")??null}catch{t=null}return{status:typeof e.status=="number"?e.status:0,contentType:t,body:e.body??null,text:()=>e.text()}}function S(e,t,n){let r=e.trim();if(!r)return{result:null,typed:!1,parsed:!1};let i;try{i=JSON.parse(r)}catch{return{result:null,typed:!1,parsed:!1}}return f(i,t,n)}function f(e,t,n){if(!e||typeof e!="object"||Array.isArray(e))return{result:null,typed:!1,parsed:!0};let r=u(e,"type");if(r!=null){if(r==="progress"){let s=String(u(e,"stage")??"").trim();return s&&t?.(s),{result:null,typed:!0,parsed:!0}}if(r==="result"){let s=u(e,"result");return{result:s&&typeof s=="object"?s:null,typed:!0,parsed:!0}}return{result:null,typed:!0,parsed:!0}}return n?{result:u(e,"code")!==void 0||u(e,"errorMessage")!==void 0?e:null,typed:!1,parsed:!0}:{result:e,typed:!1,parsed:!0}}var a=class{constructor(t){this.onStage=t}onStage;result=null;anyParsed=!1;take(t){let n=S(t,this.onStage,!0);n.parsed&&(this.anyParsed=!0),n.result&&(n.typed||this.result===null)&&(this.result=n.result)}};function d(){return new Error("the generate response ended without a result")}async function R(e,t){let n=e.body;if(!n||typeof n.getReader!="function")return p(await e.text(),t,null);let r=n.getReader(),i=new TextDecoder,s=new a(t),o="";try{for(;;){let{done:y,value:g}=await r.read();if(y)break;o+=i.decode(g,{stream:!0});let l;for(;(l=o.indexOf(`
|
|
3
|
-
`))>=0;)s.take(o.slice(0,l)),o=o.slice(l+1)}}finally{try{r.releaseLock?.()}catch{}}if(o+=i.decode(),s.take(o),!s.result)throw d();return s.result}function p(e,t,n){let r=new a(t);for(let i of e.split(`
|
|
4
|
-
`))r.take(i);if(r.result)return r.result;throw!r.anyParsed&&n?n:d()}async function b(e,t){let n=await e.text(),r;try{r=JSON.parse(n)}catch(s){return p(n,t,s)}if(!r||typeof r!="object"||Array.isArray(r))throw new SyntaxError("the generate response was JSON but not a result object");let i=f(r,t,!1);if(i.result)return i.result;throw d()}async function N(e,t){return m(e.contentType)?R(e,t):b(e,t)}export{w as a,P as b,T as c,W as d,u as e,m as f,C as g,N as h};
|