@bicharts/shape-core 0.6.34 → 0.6.35
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/testing.mjs +5 -4
- package/dist/types/fetchTransport.d.ts +19 -0
- package/dist/types/index.d.ts +5 -1
- package/dist/types/telemetry.d.ts +7 -0
- package/dist/types/telemetryClient.d.ts +58 -0
- package/dist/types/testing/index.d.ts +15 -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 rt,b as ot}from"./chunk-UQU75XXR.mjs";import{a as it,b as at,c as st,d as lt,e as f,f as ut,g as ct,h as dt}from"./chunk-JF3BJI7F.mjs";import{a as Zn,b as Jn,c as et,d as nt,e as tt}from"./chunk-FNEHWEWX.mjs";import{A as Dn,B as Gn,C as qn,D as zn,E as Kn,F as Un,G as Bn,H as jn,I as Wn,J as $n,K as Hn,L as Qn,M as Yn,O as Xn,a as un,b as cn,c as dn,d as mn,e as yn,f as hn,g as Cn,h as bn,i as Rn,j as Sn,k as vn,l as xn,m as En,n as Ln,o as Pn,p as Nn,q as An,r as Tn,s as _n,t as In,u as Mn,v as Fn,w as wn,x as kn,y as Vn,z as On}from"./chunk-KKSQBV76.mjs";import{a as fn}from"./chunk-QEH7WTLB.mjs";import{a as pn,b as gn}from"./chunk-2LR73DNS.mjs";import{a as Z,b as J,c as on,d as an,e as sn,f as ln}from"./chunk-6TVBXT4G.mjs";import{a as _,f as I,g as S,h as M,i as q,j as He,k as Qe,l as X,m as h,n as Ye,o as Xe,p as Ze,q as F,r as Je,s as en,t as nn,u as tn,v as z,w as rn}from"./chunk-TPVDJHU6.mjs";import"./chunk-5MRZID36.mjs";import{a as je,b as We,c as $e}from"./chunk-6Q3MQ2MK.mjs";import{A as ze,B as Ke,C as Ue,D as Be,a as Ce,b as be,c as Re,d as Se,e as ve,f as D,g as xe,h as Ee,i as Le,j as Pe,k as Ne,l as Ae,m as Te,n as _e,o as Ie,p as Me,q as Fe,r as we,s as ke,u as G,v as Ve,w as Oe,x as De,y as Ge,z as qe}from"./chunk-NFSQ4O5R.mjs";var K=2,te=400;function B(e){return!!I(e)}function P(e){let n=new Set;for(let r of e){if(r==null)continue;let o=_(String(r));if(!M(o)&&!n.has(o)&&(n.add(o),n.size>=te))break}return Array.from(n)}function L(e){let n=P(e);if(n.length===0||j(e)<95)return!1;let r=n.filter(u=>B(u)&&!h(u)).length,o=n.filter(u=>!B(u)&&!!h(u)).length;return r>=1&&r>=o}function ee(e,n){if(!h(e))return!1;let r=I(e);return r?n==="world"?!0:X.has(r):!1}function j(e){let n=P(e);if(n.length===0)return 0;let r=0;for(let o of n)B(o)&&r++;return Math.round(r/n.length*1e3)/10}function w(e){let n=P(e);if(n.length===0)return 0;let r=0;for(let o of n)h(o)&&r++;return Math.round(r/n.length*1e3)/10}function $(e){let n=new Set;for(let r of e){if(r==null)continue;let o=String(r).trim();if(!M(_(o))&&!n.has(o)&&(n.add(o),n.size>=te))break}return Array.from(n)}function W(e){let n=$(e);if(n.length===0)return 0;let r=0;for(let o of n)F(o).length>0&&r++;return Math.round(r/n.length*1e3)/10}function ne(e,n){return J(n,Z)?!0:$(e).some(r=>/^\d{5}(-\d{4})?$/.test(r.replace(/\.0+$/,"")))}function mt(e,n){let r=P(e);if(r.length===0)return 0;let o=0;for(let u of r)z(u,n)&&o++;return Math.round(o/r.length*1e3)/10}function U(e,n){let r=0;for(let o of P(e))n(o)&&r++;return r}function ft(e,n){let r=0;for(let o of $(e))n(o)&&r++;return r}function pt(e,n,r,o,u){let l=[],s=[],a={},C={},x=new Set(e),p=i=>n.map(c=>c[i]);for(let i of["city","country"]){let c=r?.[i];c&&x.has(c)&&(a[i]=c)}let ge=new Set(u??e);for(let i of["lat","lon"]){let c=r?.[i];c&&ge.has(c)&&(a[i]=c)}let b=r?.zip;if(b&&x.has(b)){let i=p(b),c=W(i);c<95?s.push(`zip=${b} (only ${c}% of values read as ZIPs)`):ne(i,b)?a.zip=b:s.push(`zip=${b} (all values are 3-4 digits with nothing to say they are postal)`)}let y=r?.state;if(y&&x.has(y)){let i=p(y),c=P(i);c.length>0&&c.every(m=>ee(m,o))?s.push(`state=${y} (every value is "CA", which is both Canada and California)`):L(i)?(s.push(`state=${y} (every value is a country, not a state)`),a.country||(a.country=y)):w(i)<95?s.push(`state=${y} (only ${w(i)}% of values are states/provinces)`):a.state=y}let R=new Set(Object.values(a).filter(Boolean)),A=e.filter(i=>!R.has(i)&&!i.startsWith("__"));if(!a.state){let i=null;for(let c of A){let m=p(c);if(L(m))continue;let g=w(m);if(g<95)continue;let O=U(m,T=>!!h(T)),he=U(m,T=>!!h(T)&&!ee(T,o));O<K&&he<1||(!i||g>i.pct)&&(i={name:c,pct:g})}i&&(a.state=i.name,R.add(i.name),l.push(`state=${i.name} (${i.pct}% states/provinces)`))}if(!a.zip)for(let i of A){if(R.has(i))continue;let c=p(i),m=W(c);if(!(m<95)&&ne(c,i)&&!(ft(c,g=>F(g).length>0)<K)){a.zip=i,R.add(i),l.push(`zip=${i} (${m}% ZIP codes)`);break}}let E=a.country;if(!E||!L(p(E))){let i=null;for(let c of A){if(R.has(c)||!L(p(c)))continue;let m=j(p(c));(!i||m>i.pct)&&(i={name:c,pct:m})}i&&(E&&(s.push(`country=${E} (only ${j(p(E))}% of values are country identifiers; using ${i.name} instead)`),C.country=E),a.country=i.name,R.add(i.name),l.push(`country=${i.name}`))}if(!a.city){let i=null;for(let c of A){if(R.has(c))continue;let m=p(c),g=mt(m,o);g<q||U(m,O=>z(O,o))<K||(!i||g>i.pct)&&(i={name:c,pct:g})}i&&(a.city=i.name,l.push(`city=${i.name} (${i.pct}% known cities)`))}let Q=a.country?p(a.country):[],k=!!a.country&&L(Q),ye=k?new Set(Q.map(i=>I(i==null?null:String(i))).filter(Boolean)).size:0,Y=k&&ye>=2,V=!!(a.lat&&a.lon)&&n.some(i=>{let c=+String(i[a.lat]??"").trim(),m=+String(i[a.lon]??"").trim();return isFinite(c)&&isFinite(m)&&c>=-90&&c<=90&&m>=-180&&m<=180&&String(i[a.lat]??"").trim()!==""&&String(i[a.lon]??"").trim()!==""});return a.lat&&a.lon&&!V&&s.push(`lat/lon=${a.lat}/${a.lon} (no row holds a usable coordinate pair)`),a.country&&!Y&&!(a.city||a.state||a.zip||V)&&s.push(k?`country=${a.country} (every row resolves to the same country - nothing to place apart)`:`country=${a.country} (values are not country identifiers)`),{bind:!!(a.city||a.state||a.zip||Y||V)?a:null,backfilled:l,refused:s,...Object.keys(C).length?{labelFallback:C}:{}}}var t=(e,...n)=>({part:e,langs:Object.freeze(n)}),H=Object.freeze({jaar:t("year","nl"),kwartaal:t("quarter","nl"),maand:t("month","nl"),dag:t("day","nl","sv","da","nb"),jahr:t("year","de"),quartal:t("quarter","de"),monat:t("month","de"),tag:t("day","de"),ann\u00E9e:t("year","fr"),mois:t("month","fr"),jour:t("day","fr"),trimestre:t("quarter","fr","es","pt","it"),a\u00F1o:t("year","es"),mes:t("month","es"),d\u00EDa:t("day","es"),ano:t("year","pt"),m\u00EAs:t("month","pt"),dia:t("day","pt"),anno:t("year","it"),mese:t("month","it"),giorno:t("day","it"),\u0433\u043E\u0434:t("year","ru"),\u043C\u0435\u0441\u044F\u0446:t("month","ru"),\u0440\u0456\u043A:t("year","uk"),\u043C\u0456\u0441\u044F\u0446\u044C:t("month","uk"),\u043A\u0432\u0430\u0440\u0442\u0430\u043B:t("quarter","ru","uk"),\u0434\u0435\u043D\u044C:t("day","ru","uk"),rok:t("year","pl","cs","sk"),kwarta\u0142:t("quarter","pl"),miesi\u0105c:t("month","pl"),dzie\u0144:t("day","pl"),\u010Dtvrtlet\u00ED:t("quarter","cs"),m\u011Bs\u00EDc:t("month","cs"),den:t("day","cs"),\u0161tvr\u0165rok:t("quarter","sk"),mesiac:t("month","sk"),de\u0148:t("day","sk"),\u00E5r:t("year","sv","da","nb"),kvartal:t("quarter","sv","da","nb"),m\u00E5nad:t("month","sv"),m\u00E5ned:t("month","da","nb"),vuosi:t("year","fi"),vuosinelj\u00E4nnes:t("quarter","fi"),kuukausi:t("month","fi"),p\u00E4iv\u00E4:t("day","fi"),\u00E9v:t("year","hu"),negyed\u00E9v:t("quarter","hu"),h\u00F3nap:t("month","hu"),nap:t("day","hu"),y\u0131l:t("year","tr"),\u00E7eyrek:t("quarter","tr"),ay:t("month","tr"),g\u00FCn:t("day","tr"),\u03AD\u03C4\u03BF\u03C2:t("year","el"),\u03C4\u03C1\u03AF\u03BC\u03B7\u03BD\u03BF:t("quarter","el"),\u03BC\u03AE\u03BD\u03B1\u03C2:t("month","el"),\u03B7\u03BC\u03AD\u03C1\u03B1:t("day","el"),an:t("year","ro"),trimestru:t("quarter","ro"),lun\u0103:t("month","ro"),zi:t("day","ro"),godina:t("year","hr"),tromjese\u010Dje:t("quarter","hr"),mjesec:t("month","hr"),dan:t("day","hr"),\u5E74:t("year","ja","zh"),\u56DB\u534A\u671F:t("quarter","ja"),\u5B63\u5EA6:t("quarter","zh"),\u6708:t("month","ja","zh"),\u65E5:t("day","ja","zh"),\uC5F0\uB3C4:t("year","ko"),\uBD84\uAE30:t("quarter","ko"),\uC6D4:t("month","ko"),\uC77C:t("day","ko"),tahun:t("year","id"),kuartal:t("quarter","id"),triwulan:t("quarter","id"),bulan:t("month","id"),hari:t("day","id"),n\u0103m:t("year","vi"),qu\u00FD:t("quarter","vi"),th\u00E1ng:t("month","vi"),ng\u00E0y:t("day","vi"),\u0E1B\u0E35:t("year","th"),\u0E44\u0E15\u0E23\u0E21\u0E32\u0E2A:t("quarter","th"),\u0E40\u0E14\u0E37\u0E2D\u0E19:t("month","th"),\u0E27\u0E31\u0E19:t("day","th"),\u0627\u0644\u0633\u0646\u0629:t("year","ar"),\u0633\u0646\u0629:t("year","ar"),\u0627\u0644\u0639\u0627\u0645:t("year","ar"),\u0639\u0627\u0645:t("year","ar"),\u0627\u0644\u0631\u0628\u0639:t("quarter","ar"),\u0631\u0628\u0639:t("quarter","ar"),"\u0631\u0628\u0639 \u0627\u0644\u0633\u0646\u0629":t("quarter","ar"),\u0627\u0644\u0634\u0647\u0631:t("month","ar"),\u0634\u0647\u0631:t("month","ar"),\u0627\u0644\u064A\u0648\u0645:t("day","ar"),\u064A\u0648\u0645:t("day","ar"),\u05E9\u05E0\u05D4:t("year","he"),\u05E8\u05D1\u05E2\u05D5\u05DF:t("quarter","he"),\u05D7\u05D5\u05D3\u05E9:t("month","he"),\u05D9\u05D5\u05DD:t("day","he"),\u0935\u0930\u094D\u0937:t("year","hi"),\u0938\u093E\u0932:t("year","hi"),\u0924\u093F\u092E\u093E\u0939\u0940:t("quarter","hi"),\u092E\u0939\u0940\u0928\u093E:t("month","hi"),\u092E\u093E\u0939:t("month","hi"),\u0926\u093F\u0928:t("day","hi"),\u0633\u0627\u0644:t("year","fa"),\u0645\u0627\u0647:t("month","fa"),\u0631\u0648\u0632:t("day","fa")}),gt=Object.freeze(Array.from(new Set(Object.values(H).flatMap(e=>e.langs)))),re=Object.freeze(["fa","ar","he","th"]),oe=1900,ie=2100;function yt(e,n){let r=[],o=D(n);try{o&&r.push(e.toLocaleLowerCase(o.intl))}catch{}let u=e.toLowerCase();return r.includes(u)||r.push(u),r}function ht(e,n){let r=String(e??"").trim().normalize("NFC");if(!r)return null;for(let o of yt(r,n)){let u=H[o];if(u&&u.langs.includes(n))return u.part}return null}function Ct(e,n){return re.includes(e)?typeof n=="number"&&Number.isFinite(n)&&n>=oe&&n<=ie:!0}function ae(e,n){let r=n?.freemiumMaxShapeColumns;return typeof r!="number"||!isFinite(r)||r<1?null:!isFinite(e)||e<=r?0:Math.round(e-r)}function bt(e,n,r){let o=ae(e,n);if(o===null||o<=0)return null;let u=typeof n?.freemiumColumnCapPivot=="number"?n.freemiumColumnCapPivot:4,l=o>u?n?.freemiumColumnCapMessageMany:n?.freemiumColumnCapMessageFew;if(typeof l!="string"||l.trim().length===0)return null;let s=l.split("{n}").join(String(o)).split("{fields}").join(o===1?"field":"fields"),a=se(r);return a.length===0?s:s+" "+a.join(" ")}function se(e){if(!e||e.length===0)return[];let n=[],r=new Map,o=new Map;for(let l of e){let s=typeof l?.dateGroupId=="string"?l.dateGroupId.trim():"";if(s!==""&&(r.has(s)||(n.push(s),r.set(s,0)),l.isDatePart===!0&&r.set(s,r.get(s)+1),l.isReassembledDate===!0&&!o.has(s))){let a=typeof l.sourceField=="string"?l.sourceField.trim():"",C=typeof l.name=="string"?l.name.trim():"",x=a!==""?a:C;x!==""&&o.set(s,x)}}let u=[];for(let l of n){let s=o.get(l),a=r.get(l)??0;!s||a===0||u.push(`'${s}' is a date hierarchy and counts as ${a+1} fields - bind the date itself instead of its hierarchy.`)}return u}var d=e=>e==null?"":String(e),v=e=>e===!0,le=e=>{if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e=="string"&&e.trim()!==""){let n=Number(e);return Number.isFinite(n)?n:null}return null},Rt=[["city","CityColumn"],["state","StateColumn"],["zip","ZipColumn"],["lat","LatColumn"],["lon","LonColumn"],["country","CountryColumn"]];function ue(e,n){let r={};for(let[o,u]of Rt){let l=d(f(e,n+u));l&&(r[o]=l)}return r}function St(e){let n=a=>f(e,a),r=n("retryAfterSeconds"),o=n("overrideThumbnailUpload"),u=n("forceThumbnailUpload"),l=ue(e,"point"),s=ue(e,"destPoint");return Object.keys(s).length&&(l.dest=s),{errorMessage:d(n("errorMessage")),code:d(n("code")),language:d(n("language")),version:Number(n("version")??0),codeSummary:d(n("codeSummary")),chartName:d(n("chartName")??n("chartType")),finalChartName:d(n("finalChartName")),warningMessage:d(n("warningMessage")),outputHash:d(n("outputHash")),validatorToken:d(n("validatorToken")),editCodeKey:d(n("editCodeKey")),signedLLMRequestID:d(n("signedLLMRequestID")),userReply:d(n("userReply")),userReplyOutcome:d(n("userReplyOutcome")),improvementSuggestion:d(n("improvementSuggestion")),geoColumn:d(n("geoColumn")),geoKind:d(n("geoKind")),geoPointCols:Object.keys(l).length?l:null,creditBalanceBefore:le(n("creditBalanceBefore")),creditCost:le(n("creditCost")),isServiceError:v(n("isServiceError")),isRateLimited:v(n("isRateLimited")),isRefusal:v(n("isRefusal")),isVersionNotFound:v(n("isVersionNotFound")),isGenerationCancelled:v(n("isGenerationCancelled")),retryAfterSeconds:typeof r=="number"&&Number.isFinite(r)?r:null,servedCorrelationId:d(n("servedCorrelationId")),...typeof o=="boolean"?{overrideThumbnailUpload:o}:{},...typeof u=="boolean"?{forceThumbnailUpload:u}:{}}}var ce=e=>e==null?void 0:Number(e),N=e=>d(e)||void 0;function vt(e){let n=f(e,"charts"),r=f(e,"refused"),o=Array.isArray(n)?n.map(l=>{let s=C=>f(l,C),a=s("recommended");return{name:d(s("chartTypeName")??s("name")),description:d(s("description")??s("chartDesc")),rank:ce(s("rank")),score:ce(s("score")),renderer:N(s("renderer")),language:N(s("language")),isPreview:v(s("isPreview")),recommended:typeof a=="boolean"?a:void 0,viaProjection:N(s("viaProjection")),viaProjectionKey:N(s("viaProjectionKey")),detailNote:N(s("detailNote"))}}).filter(l=>l.name):null,u=Array.isArray(r)?r.map(l=>({name:d(f(l,"chartTypeName")??f(l,"name")),reason:d(f(l,"reason")),isVeto:v(f(l,"isVeto"))})).filter(l=>l.name):[];return{errorMessage:d(f(e,"errorMessage")),charts:o,refused:u,noFitSummary:d(f(e,"noFitSummary"))}}function xt(e){return!e||typeof e!="object"?null:{status:String(f(e,"status")??""),verdictReason:f(e,"verdictReason")??null,instruction:f(e,"instruction")??null,fix:f(e,"fix")??null,errorMessage:f(e,"errorMessage")??null}}function Et(e){let n=e.linkNonce?(e.linkNonce()??"").trim():null,r=n?{licensee:"",licenseKey:"",secretKey:""}:e.triple();return{request:{licenseKey:r.licenseKey,licensee:r.licensee,secretKey:r.secretKey,freemiumKey:e.freemiumKey?.()??""},linkNonce:n}}function Lt(e){let{width:n,height:r}=e.measure();return{request:{height:r,width:n},hints:{viewportWidth:n,viewportHeight:r}}}function Pt(e){let n=0;for(let r of e){if(r.isMeasure)continue;let o=r.distinctCount;typeof o=="number"&&o>n&&(n=o)}return n}function de(e){if(e.recoveryFetchByCorrelation)return{version:null,fetchOnly:!0};if(e.recoveryFetchVersion!=null)return{version:e.recoveryFetchVersion,fetchOnly:!0};let n=e.settingVersion??null;if(e.genNew)return{version:n,fetchOnly:void 0};let r=(n??0)>0?n:null,o=(e.codeVersion??0)>0?e.codeVersion:null,u=r??o??n;return{version:u,fetchOnly:u!=null&&u>0?!0:void 0}}function Nt(e){let n=e.fetchCorrelationId!=null,o=n||e.recoveryFetchVersion!=null?!1:e.genNew,u=de({genNew:o,recoveryFetchVersion:e.recoveryFetchVersion,recoveryFetchByCorrelation:n,settingVersion:e.settingVersion,codeVersion:e.codeVersion});return{genNew:o,version:u.version,fetchOnly:u.fetchOnly,fetchCorrelationId:e.fetchCorrelationId??void 0}}function At(e){let n=r=>e.renderers.has(r);return{supportsD3:n("D3"),supportsPlotly:n("PLOTLY"),supportsVega:n("VEGA")}}function Tt(e){let n=e.cap!=null&&e.budget>e.cap?e.cap:e.budget;return{triesLeft:e.triesLeft??n,maxTries:n}}function _t(e){return e&&e>0?{leafCardinality:Math.round(e)}:{}}function me(e,n){return e!=null&&n!=null&&e!==n}function It(e,n){return e?me(n.capturedFor,n.now)?{shortlist:void 0,stale:!0}:{shortlist:{...e,ageMs:n.atMs>0?Math.max(0,Math.round(n.nowMs-n.atMs)):void 0},stale:!1}:{shortlist:void 0,stale:!1}}var Mt=Object.freeze({integer:"number",decimal:"number",double:"number",datetime:"date",date:"date",boolean:"boolean",string:"text"});function fe(e){let n=String(e??"").trim().toLowerCase();return Mt[n]??n}function pe(e){let n="";for(let r of e)n+=JSON.stringify([String(r.name??""),r.isMeasure?"M":"D",fe(r.dataType)]);return n}function Ft(e){return G(pe(e))}var wt=2,kt=3,Vt=4,Ot=64,Dt=Object.freeze({RENDER_START:"render-start",RENDER_OK:"render-ok",RENDER_ERROR:"render-error",VIEW:"view",VIEW_VERDICT:"view-verdict"});function Gt(e){return!!e&&!e.includes("|")&&!e.includes(",")}function qt(e,n,r,o){let u=`${e},${n}|${r}`;return o?`${u}|${Math.max(0,Math.round(o.count))}|${o.nonce}`:u}export{q as CITY_ROLE_MATCH_PCT,Dt as CLIENT_EVENT_KINDS,Te as COMPOUND_MIN_STEM,ie as DATE_LEVEL_GREGORIAN_YEAR_MAX,oe as DATE_LEVEL_GREGORIAN_YEAR_MIN,gt as DATE_LEVEL_LANGUAGES,H as DATE_LEVEL_NAMES,re as DATE_LEVEL_NON_GREGORIAN_LANGUAGES,kn as DEFAULT_GAP_FACTOR,De as DEFAULT_TEMPERATURE,Ve as GET_RANDOM,Ie as GLUED_STEM_MIN,hn as INTENSIVE_SUFFIX_TOKENS,yn as INTENSIVE_WORD_TOKENS,Xn as IndexedText,Vn as MAX_RUN_BOUNDS,bn as POSITIONAL_SUFFIX_TOKENS,Cn as POSITIONAL_WORD_TOKENS,rt as PREVIEW_OMITTED_FIELDS,S as ROLE_MATCH_PCT,Gn as SERIES_COMPLETENESS_MAX_LISTED,qn as SERIES_COMPLETENESS_MIN_FILL,zn as SERIES_KEY_MAX_DISTINCT,Vt as SEV_ERROR,wt as SEV_INFO,Ot as SEV_USER_PRESENTED,kt as SEV_WARNING,G as SIMPLE_STRING_HASH,ke as STR,Fe as SUBSTRING_MIN,Ce as SUPPORTED_LANGUAGES,be as SUPPORTED_LANGUAGE_CODES,ve as VOCABULARY_LANGUAGE_CODES,Se as VOCABULARY_ONLY_LANGUAGES,w as admin1MatchPct,An as allowedAggregations,ln as buildGeoIsoColumn,nn as buildGeoPointColumns,At as capabilityFields,rn as cityMatchPct,tn as cityTagsFor,Qn as classifyAdditivity,Nn as classifyForAggregation,Yn as classifyNumericValueNature,$n as classifyTemporal,xn as codeNeedsLegacyAggNames,Mn as codeReadsColumn,Fn as codeReadsColumnsByRoleOrPosition,vn as collapseRepeatedAggPrefix,wn as columnsTheCodeReads,dn as countryRegion,Et as credentialFields,ht as dateLevelPart,Ct as dateLevelYearAdmits,Zn as decimalSeparatorOf,Tn as defaultAggregation,Jn as detectDecimalSeparator,fn as detectFormatSignature,on as detectGeo,$e as detectOrdinalDomain,Wn as detectTextDatePattern,at as encodePayload,nt as engineTypeForSqlType,En as englishImplicitAggNames,qt as eventLogLine,Nt as fetchFields,Ee as foldName,bt as freemiumColumnCapRefusal,ae as freemiumColumnsOverCap,se as freemiumDateHierarchyClauses,Me as gluedPrefixStems,it as gzipWireText,Sn as hasDefaultAggPrefix,Ne as hasUnsegmentedScript,Hn as hostAggHint,tt as ingest,_n as isAggregationAllowed,M as isBlankLike,Qe as isCityTableLoaded,Oe as isDeterministicRefusal,Gt as isEventLogCode,Je as isGeoPointAmbiguity,jn as isIdentifierName,sn as isJoinGeoKind,ut as isNdjsonContentType,je as isOrdinalFriendlyName,st as keyedSigner,_t as leafCardinalityField,Ue as localMidnightDateColumns,Ke as localMidnightToUtcDay,L as looksLikeCountryColumn,we as matchNameToken,Pt as maxNonMeasureCardinality,Dn as measureCadence,Bn as measureSeriesCompleteness,lt as messageSignature,gn as monthLookupFor,Pn as nameLooksIntensiveRate,Ln as nameLooksPositional,Le as nameWords,Ye as normalizeCountry,Be as normalizeLocalMidnightDates,pn as normalizeMonthKey,_ as normalizePlaceName,Ze as normalizeZip5,It as offeredShortlistFor,Ge as parseDateStable,St as parseGenerateResponse,et as parseNumberText,vt as parseQualifyResponse,xt as parseReviewVerdict,On as parseTemporalPoint,ot as payloadPreview,Un as pickSeriesColumn,dt as readGenerateStream,Pe as readName,f as readWireField,He as registerCityTable,cn as registerIso3Regions,h as resolveAdmin1,de as resolveFetchVersion,en as resolveGeoPoint,xe as resolveLanguage,pt as resolvePointRoles,Tt as retryFields,We as safeDistinctValuesToShip,pe as schemaIdentity,Ft as schemaIdentityKey,fe as schemaTypeFamily,Kn as seriesKeyVerdict,In as shareOfTotalIsHonest,me as shortlistIsStale,Rn as stripHostAggPrefix,mn as summarizeCountryRegions,un as summarizeGeoExtent,Re as supportedLanguage,an as toGeoIso,Ae as unsegmentedRuns,Lt as viewportFields,D as vocabularyLanguage,qe as wholeDayFrame,ze as wholeDayIso,ct as wireResponseFromFetch,_e as wordEndsWith,W as zipMatchPct,F as zipPrefixCandidates,Xe as zipToPrefix3};
|
|
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};
|
package/dist/testing.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
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
|
|
3
|
-
- ${
|
|
4
|
-
- `)}`),this.name="ConformanceError",this.contract=e,this.failures=
|
|
2
|
+
import{f as A,h as g}from"./chunk-JF3BJI7F.mjs";import"./chunk-NFSQ4O5R.mjs";var S=class extends Error{contract;failures;constructor(e,s){super(`${e} conformance failed:
|
|
3
|
+
- ${s.join(`
|
|
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}}
|
|
6
|
-
`],
|
|
6
|
+
`],l=(a,r=!1)=>new ReadableStream({start(t){for(let o of a)t.enqueue(o);r?t.error(Object.assign(new Error("the connection dropped"),{name:"AbortError"})):t.close()}});try{let a=n(new Response(l(d.map(o=>s.encode(o))),{status:200,headers:{"Content-Type":"application/x-ndjson; charset=utf-8"}}));e.check(a.status===200,`a streamed 200 reported status ${a.status}`),e.check(A(a.contentType),`a streamed response reported content type ${JSON.stringify(a.contentType)}`);let r=[],t=await g(a,o=>r.push(o));e.check(t?.code==="x"&&t?.version===2,"the stream's result line did not come back as the result"),e.check(r.join("|")==="Reading your data",`progress stages read as ${JSON.stringify(r)}`)}catch(a){e.fail(`reading an NDJSON stream threw: ${u(a)}`)}try{let a=n(new Response('{"code":"y","errorMessage":""}',{status:200,headers:{"Content-Type":"application/json"}}));e.check(!A(a.contentType),"a JSON response reported an NDJSON content type");let r=await g(a);e.check(r?.code==="y","a buffered JSON body did not come back as the result")}catch(a){e.fail(`reading a buffered JSON body threw: ${u(a)}`)}try{let a=n(new Response(l([s.encode(d[0])],!0),{status:200,headers:{"Content-Type":"application/x-ndjson"}})),r=null;try{await g(a)}catch(t){r=t}e.check(!!r,"a body that errored part-way was read as a success"),e.check(!r||r.name==="AbortError",`a body that errored part-way surfaced as ${r?.name}: ${r?.message}, not the body's own error`)}catch(a){e.fail(`adapting a response whose body errors threw before it was read: ${u(a)}`)}try{let a=n(new Response(null,{status:204}));e.check(a.status===204,`a 204 reported status ${a.status}`);let r=await a.text();e.check(r==="",`a 204's text() returned ${JSON.stringify(r)}`)}catch(a){e.fail(`a 204 with no body threw: ${u(a)}`)}e.throwIfFailed()}async function T(n,e){let s=n instanceof Request?n:new Request(String(n),e),d=e?.signal??s.signal??null;return{url:s.url,method:s.method,headers:s.headers,body:await s.text(),signal:d}}var k=()=>Object.assign(new Error("The operation was aborted."),{name:"AbortError"});async function w(n,e){let s,d=new Promise(l=>{s=setTimeout(()=>l({settled:!1}),e)});try{return await Promise.race([n.then(l=>({settled:!0,ok:!0,value:l}),l=>({settled:!0,ok:!1,error:l})),d])}finally{s&&clearTimeout(s)}}async function I(n){let e=new m("WireTransport"),s="https://service.example/api/route/?nocache=1",d="H4sIAAAAAAAAA6tWyk0tSs5ITUxRslIqS8wpTVWqBQBL0RbkEwAAAA==",l={"Content-Type":"text/plain","X-Signature":"12345"},a=40,r=1e3;try{let t=null,o=n(async(c,h)=>(t=await T(c,h),new Response('{"ok":true}',{status:200,headers:{"Content-Type":"application/json"}}))),i=await w(o.post(s,d,l,{timeoutMs:5e3}),r);if(!i.settled)e.fail("an ordinary post never settled");else if(i.ok===!1)e.fail(`an ordinary post rejected: ${u(i.error)}`);else{let c=t;e.check(!!c,"the adapter never called the fetch it was given"),c&&(e.check(c.url===s,`the request went to ${c.url}, not the URL it was given`),e.check(c.method==="POST",`the request was a ${c.method}, not a POST`),e.check(c.body===d,"the body did not reach the network as given"),e.check(c.headers.get("content-type")==="text/plain",`Content-Type reached the network as ${c.headers.get("content-type")}`),e.check(c.headers.get("x-signature")==="12345","a header the caller set did not reach the network")),e.check(i.value.status===200,`a 200 reported status ${i.value.status}`),e.check(A(i.value.contentType)===!1&&/json/.test(String(i.value.contentType)),`the response's content type read as ${JSON.stringify(i.value.contentType)}`),e.check(await i.value.text()==='{"ok":true}',"text() did not return the body")}}catch(t){e.fail(`an ordinary post threw: ${u(t)}`)}for(let t of[400,500,503])try{let o=n(async()=>new Response('{"message":"why"}',{status:t,headers:{"Content-Type":"application/json"}})),i=await w(o.post(s,d,l,{timeoutMs:5e3}),r);i.settled?i.ok===!1?e.fail(`an HTTP ${t} rejected (${u(i.error)}) - a status is an answer, not a transport failure`):(e.check(i.value.status===t,`an HTTP ${t} reported status ${i.value.status}`),e.check(await i.value.text()==='{"message":"why"}',`an HTTP ${t}'s body could not be read`)):e.fail(`an HTTP ${t} never settled`)}catch(o){e.fail(`an HTTP ${t} threw: ${u(o)}`)}try{let t=n(async()=>new Response(null,{status:204})),o=await w(t.post(s,d,l,{timeoutMs:5e3}),r);!o.settled||!o.ok?e.fail("a 204 did not resolve"):e.check(o.value.status===204,`a 204 reported status ${o.value.status}`)}catch(t){e.fail(`a 204 threw: ${u(t)}`)}try{let t=n(async()=>{throw new TypeError("Failed to fetch")}),o=await w(t.post(s,d,l,{timeoutMs:5e3}),r);e.check(o.settled&&!o.ok,"a failed connection did not reject")}catch(t){e.fail(`a failed connection threw synchronously: ${u(t)}`)}try{let t=null,o=n((h,f)=>new Promise((b,p)=>{T(h,f).then(y=>{t=y.signal,y.signal&&(y.signal.aborted?p(k()):y.signal.addEventListener("abort",()=>p(k()),{once:!0}))})})),i=await w(o.post(s,d,l,{timeoutMs:a}),r);e.check(i.settled&&!i.ok,`no answer inside a ${a} ms deadline did not reject within ${r} ms`);let c=t;e.check(!!c&&c.aborted,"the deadline passed but the request was not aborted - the socket would stay open")}catch(t){e.fail(`the deadline check threw synchronously: ${u(t)}`)}try{let t=null,o=new TextEncoder,i=n(async(h,f)=>{let b=await T(h,f);t=b.signal;let p,y=new ReadableStream({start(v){p=v}});return p.enqueue(o.encode(`{"type":"progress","stage":"Reading your data"}
|
|
7
|
+
`)),b.signal?.addEventListener("abort",()=>{try{p.error(k())}catch{}},{once:!0}),new Response(y,{status:200,headers:{"Content-Type":"application/x-ndjson"}})}),c=await w(i.post(s,d,l,{timeoutMs:a}),r);if(!c.settled||c.ok===!1)e.fail("headers that arrived in time did not resolve the post");else{let h=await w(g(c.value),r);e.check(h.settled&&h.ok===!1,`a body that stalled after its headers was still being read ${r} ms after a ${a} ms deadline`);let f=t;e.check(!!f&&f.aborted,"the deadline passed mid-body but the request was not aborted - the socket would stay open")}}catch(t){e.fail(`the body-deadline check threw synchronously: ${u(t)}`)}try{let t=new AbortController,i=n((h,f)=>new Promise((b,p)=>{T(h,f).then(y=>{y.signal&&(y.signal.aborted?p(k()):y.signal.addEventListener("abort",()=>p(k()),{once:!0}))})})).post(s,d,l,{timeoutMs:5e3,signal:t.signal});setTimeout(()=>t.abort(),10);let c=await w(i,r);e.check(c.settled&&!c.ok,"aborting the caller's signal did not reject the post")}catch(t){e.fail(`the caller-signal check threw synchronously: ${u(t)}`)}e.throwIfFailed()}export{S as ConformanceError,q as assertWireResponseConformance,x as assertWireSignerConformance,I as assertWireTransportConformance};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { WireTransport } from "./host/services";
|
|
2
|
+
/** A platform fetch, or anything shaped like one. Called as a plain function. */
|
|
3
|
+
export type FetchFunction = (input: string, init?: any) => Promise<{
|
|
4
|
+
status?: number;
|
|
5
|
+
headers?: {
|
|
6
|
+
get(name: string): string | null;
|
|
7
|
+
} | null;
|
|
8
|
+
body?: ReadableStream<Uint8Array> | null;
|
|
9
|
+
text(): Promise<string>;
|
|
10
|
+
}>;
|
|
11
|
+
export interface FetchTransportOptions {
|
|
12
|
+
/** The credentials mode every request carries. Default "omit". */
|
|
13
|
+
credentials?: "omit" | "same-origin" | "include";
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* A WireTransport over `fetchFn`. Every request is a POST; each call's `timeoutMs` covers the headers
|
|
17
|
+
* and the body; the caller's `signal`, when given, cancels as well.
|
|
18
|
+
*/
|
|
19
|
+
export declare function fetchTransport(fetchFn: FetchFunction, options?: FetchTransportOptions): WireTransport;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -50,5 +50,9 @@ export { viewportFields, maxNonMeasureCardinality, credentialFields, resolveFetc
|
|
|
50
50
|
export type { ViewportFields, CredentialFields, FetchRequest, FetchFields, CapabilityFields, RetryFields, } from "./wireBuild";
|
|
51
51
|
export { schemaIdentity, schemaIdentityKey, schemaTypeFamily } from "./schemaIdentity";
|
|
52
52
|
export type { SchemaIdentityColumn } from "./schemaIdentity";
|
|
53
|
-
export { SEV_INFO, SEV_WARNING, SEV_ERROR, SEV_USER_PRESENTED, CLIENT_EVENT_KINDS, isEventLogCode, eventLogLine, } from "./telemetry";
|
|
53
|
+
export { SEV_INFO, SEV_WARNING, SEV_ERROR, SEV_USER_PRESENTED, CLIENT_EVENT_KINDS, isEventLogCode, eventLogLine, TELEMETRY_TIMEOUT_MS, TELEMETRY_TIMEOUT_DEV_MS, } from "./telemetry";
|
|
54
54
|
export type { ClientMessage } from "./telemetry";
|
|
55
|
+
export { createTelemetryClient } from "./telemetryClient";
|
|
56
|
+
export type { TelemetryClient, TelemetryServices, TelemetryEnv, TelemetryFailure, TelemetryChannel } from "./telemetryClient";
|
|
57
|
+
export { fetchTransport } from "./fetchTransport";
|
|
58
|
+
export type { FetchFunction, FetchTransportOptions } from "./fetchTransport";
|
|
@@ -4,6 +4,13 @@ export declare const SEV_WARNING = 3;
|
|
|
4
4
|
export declare const SEV_ERROR = 4;
|
|
5
5
|
/** A bit OR-ed onto a level: the reader SAW this (an error on screen, a warning in a banner). */
|
|
6
6
|
export declare const SEV_USER_PRESENTED = 64;
|
|
7
|
+
/**
|
|
8
|
+
* How long one telemetry post may take, on both channels, before it is abandoned: nothing waits on a
|
|
9
|
+
* telemetry post, so the deadline only bounds how long a hung one holds its connection. A host talking
|
|
10
|
+
* to a development server (a tunnel that can be slow to wake) uses the longer one.
|
|
11
|
+
*/
|
|
12
|
+
export declare const TELEMETRY_TIMEOUT_MS = 8000;
|
|
13
|
+
export declare const TELEMETRY_TIMEOUT_DEV_MS = 60000;
|
|
7
14
|
/**
|
|
8
15
|
* The fields of a client message, by the service's names. Every field is optional; a host sends what
|
|
9
16
|
* it knows. The service derives a failure from a non-empty StackTrace, so a failure must carry one.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { Clock, WireSigner, WireTransport } from "./host/services";
|
|
2
|
+
import type { ClientMessage } from "./telemetry";
|
|
3
|
+
/** The services a telemetry client needs - the wire-level subset every host that sends requests has. */
|
|
4
|
+
export interface TelemetryServices {
|
|
5
|
+
signer: WireSigner;
|
|
6
|
+
transport: WireTransport;
|
|
7
|
+
clock: Clock;
|
|
8
|
+
}
|
|
9
|
+
/** Which channel a post went to. */
|
|
10
|
+
export type TelemetryChannel = "client-message" | "event-count";
|
|
11
|
+
/**
|
|
12
|
+
* A post that did not land. `stage` says where it stopped: `build` (the row could not be encoded or
|
|
13
|
+
* signed), `post` (the transport rejected: no connection, the deadline, an abort) or `status` (the
|
|
14
|
+
* service answered, with a status outside 2xx). `status` is the HTTP status for a `status` failure and
|
|
15
|
+
* null otherwise; `error` is what was thrown for `build` and `post`, and null for `status`.
|
|
16
|
+
*/
|
|
17
|
+
export interface TelemetryFailure {
|
|
18
|
+
channel: TelemetryChannel;
|
|
19
|
+
stage: "build" | "post" | "status";
|
|
20
|
+
status: number | null;
|
|
21
|
+
error: unknown;
|
|
22
|
+
}
|
|
23
|
+
export interface TelemetryEnv {
|
|
24
|
+
/**
|
|
25
|
+
* The service's origin, with no trailing slash: "https://example.com". A function is read at every
|
|
26
|
+
* post, for a host whose target can change after the client is built.
|
|
27
|
+
*/
|
|
28
|
+
baseUrl: string | (() => string);
|
|
29
|
+
/** The API prefix between the origin and the route. Default "/api". */
|
|
30
|
+
apiPath?: string;
|
|
31
|
+
/** The version every event-count line carries. */
|
|
32
|
+
clientVersion: string;
|
|
33
|
+
/** The deadline for one post, in milliseconds. Both channels use it. */
|
|
34
|
+
timeoutMs: number;
|
|
35
|
+
/** Told of a post that did not land. Never required; a throw inside it is swallowed. */
|
|
36
|
+
onFailure?: ((failure: TelemetryFailure) => void) | null;
|
|
37
|
+
}
|
|
38
|
+
export interface TelemetryClient {
|
|
39
|
+
/**
|
|
40
|
+
* Encode, sign and post one client message, as written - the row's key order is the envelope's.
|
|
41
|
+
* The URL carries a `nocache` stamp from the clock. Resolves when the post settles; never rejects.
|
|
42
|
+
*/
|
|
43
|
+
sendClientMessage(message: ClientMessage): Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* Post one event-count line, unsigned and as plain text: `eventLogLine(code, clientVersion,
|
|
46
|
+
* clientId, magnitude)`. The code is sent as given - a host that did not write the code itself
|
|
47
|
+
* checks it with `isEventLogCode` first. Resolves when the post settles; never rejects.
|
|
48
|
+
*/
|
|
49
|
+
countEvent(code: string, clientId: string, magnitude?: {
|
|
50
|
+
count: number;
|
|
51
|
+
nonce: string;
|
|
52
|
+
}): Promise<void>;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Build a telemetry client over the host's services. A missing service or an unusable setting is a
|
|
56
|
+
* TypeError here, at construction, never a fallback at the first post.
|
|
57
|
+
*/
|
|
58
|
+
export declare function createTelemetryClient(services: TelemetryServices, env: TelemetryEnv): TelemetryClient;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { WireSigner, WireResponse } from "../host/services";
|
|
1
|
+
import type { WireSigner, WireResponse, WireTransport } from "../host/services";
|
|
2
2
|
/** Thrown by every conformance check. `failures` names each property the adapter broke. */
|
|
3
3
|
export declare class ConformanceError extends Error {
|
|
4
4
|
readonly contract: string;
|
|
@@ -19,3 +19,17 @@ export declare function assertWireSignerConformance(signer: WireSigner): void;
|
|
|
19
19
|
* client's response. Needs a global `Response` (browsers; Node 18 and later).
|
|
20
20
|
*/
|
|
21
21
|
export declare function assertWireResponseConformance(adapt: (res: Response) => WireResponse): Promise<void>;
|
|
22
|
+
/** The platform fetch's signature, as a transport adapter takes it. */
|
|
23
|
+
export type FetchLike = (input: any, init?: any) => Promise<Response>;
|
|
24
|
+
/**
|
|
25
|
+
* A host's WireTransport, built over a fetch the check supplies: `make(fetch)` returns the host's
|
|
26
|
+
* adapter wired to that fetch, so a host whose adapter wraps some other client passes the function
|
|
27
|
+
* that wires that client to the given fetch. Driven through what every transport meets: an ordinary
|
|
28
|
+
* post (url, method, body and headers reach the network as given), an HTTP error (RESOLVES with its
|
|
29
|
+
* status, and its body is still readable - a 4xx body carries the server's own explanation), a 204,
|
|
30
|
+
* a network failure (rejects), no answer inside the deadline (rejects, and the request is aborted so
|
|
31
|
+
* the socket drops), a body that stalls after headers that came in time (the deadline covers the
|
|
32
|
+
* whole exchange, so the read ends in an error), and a caller's signal (rejects when it aborts). Uses
|
|
33
|
+
* real timers and a deadline of a few tens of milliseconds.
|
|
34
|
+
*/
|
|
35
|
+
export declare function assertWireTransportConformance(make: (fetch: FetchLike) => WireTransport): Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bicharts/shape-core",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.35",
|
|
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",
|