altair-static 8.5.7 → 8.5.8-alpha.1cbe1b0.0

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.
@@ -228,4 +228,4 @@ Writing src/index.ts -> build/index.d.ts
228
228
  Checking generated files...
229
229
  Using config: /home/runner/work/altair/altair/packages/altair-static/tsconfig.json
230
230
  Compiler option "skipLibCheck" is disabled to properly check generated output
231
- Done in 5.76s
231
+ Done in 6.02s
@@ -0,0 +1,6 @@
1
+ (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))c(i);new MutationObserver(i=>{for(const l of i)if(l.type==="childList")for(const p of l.addedNodes)p.tagName==="LINK"&&p.rel==="modulepreload"&&c(p)}).observe(document,{childList:!0,subtree:!0});function n(i){const l={};return i.integrity&&(l.integrity=i.integrity),i.referrerPolicy&&(l.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?l.credentials="include":i.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function c(i){if(i.ep)return;i.ep=!0;const l=n(i);fetch(i.href,l)}})();const m=[];for(let e=0;e<256;++e)m.push((e+256).toString(16).slice(1));function U(e,t=0){return(m[e[t+0]]+m[e[t+1]]+m[e[t+2]]+m[e[t+3]]+"-"+m[e[t+4]]+m[e[t+5]]+"-"+m[e[t+6]]+m[e[t+7]]+"-"+m[e[t+8]]+m[e[t+9]]+"-"+m[e[t+10]]+m[e[t+11]]+m[e[t+12]]+m[e[t+13]]+m[e[t+14]]+m[e[t+15]]).toLowerCase()}const N=new Uint8Array(16);function C(){return crypto.getRandomValues(N)}function T(e,t,n){return crypto.randomUUID?crypto.randomUUID():R(e)}function R(e,t,n){e=e||{};const c=e.random??e.rng?.()??C();if(c.length<16)throw new Error("Random bytes length must be >= 16");return c[6]=c[6]&15|64,c[8]=c[8]&63|128,U(c)}const k="init_execute",q="modulepreload",D=function(e){return"/"+e},O={},S=function(t,n,c){let i=Promise.resolve();if(n&&n.length>0){let h=function(f){return Promise.all(f.map(u=>Promise.resolve(u).then(a=>({status:"fulfilled",value:a}),a=>({status:"rejected",reason:a}))))};var p=h;document.getElementsByTagName("link");const v=document.querySelector("meta[property=csp-nonce]"),g=v?.nonce||v?.getAttribute("nonce");i=h(n.map(f=>{if(f=D(f),f in O)return;O[f]=!0;const u=f.endsWith(".css"),a=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${a}`))return;const w=document.createElement("link");if(w.rel=u?"stylesheet":q,u||(w.as="script"),w.crossOrigin="",w.href=f,g&&w.setAttribute("nonce",g),document.head.appendChild(w),u)return new Promise((I,E)=>{w.addEventListener("load",I),w.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${f}`)))})}))}function l(v){const g=new Event("vite:preloadError",{cancelable:!0});if(g.payload=v,window.dispatchEvent(g),!g.defaultPrevented)throw v}return i.then(v=>{for(const g of v||[])g.status==="rejected"&&l(g.reason);return t().catch(l)})};var x;(function(e){e.INTROSPECTION="introspection",e.QUERY="query",e.SUBSCRIPTION="subscription"})(x||(x={}));class M{}var P={exports:{}},B=P.exports,b;function z(){return b||(b=1,(function(e){(function(t,n){e.exports=n()})(B,function(){var t=Object.prototype.toString;function n(u,a){return u==null?!1:Object.prototype.hasOwnProperty.call(u,a)}function c(u){if(!u||p(u)&&u.length===0)return!0;if(typeof u!="string"){for(var a in u)if(n(u,a))return!1;return!0}return!1}function i(u){return t.call(u)}function l(u){return typeof u=="object"&&i(u)==="[object Object]"}var p=Array.isArray||function(u){return t.call(u)==="[object Array]"};function v(u){return typeof u=="boolean"||i(u)==="[object Boolean]"}function g(u){var a=parseInt(u);return a.toString()===u?a:u}function h(u){u=u||{};var a=function(o){return Object.keys(a).reduce(function(r,s){return s==="create"||typeof a[s]=="function"&&(r[s]=a[s].bind(a,o)),r},{})},w;u.includeInheritedProps?w=function(){return!0}:w=function(o,r){return typeof r=="number"&&Array.isArray(o)||n(o,r)};function I(o,r){if(w(o,r))return o[r]}function E(o,r,s,d){if(typeof r=="number"&&(r=[r]),!r||r.length===0)return o;if(typeof r=="string")return E(o,r.split(".").map(g),s,d);var y=r[0],_=I(o,y);if(u.includeInheritedProps&&(y==="__proto__"||y==="constructor"&&typeof _=="function"))throw new Error("For security reasons, object's magic properties cannot be set");return r.length===1?((_===void 0||!d)&&(o[y]=s),_):(_===void 0&&(typeof r[1]=="number"?o[y]=[]:o[y]={}),E(o[y],r.slice(1),s,d))}return a.has=function(o,r){if(typeof r=="number"?r=[r]:typeof r=="string"&&(r=r.split(".")),!r||r.length===0)return!!o;for(var s=0;s<r.length;s++){var d=g(r[s]);if(typeof d=="number"&&p(o)&&d<o.length||(u.includeInheritedProps?d in Object(o):n(o,d)))o=o[d];else return!1}return!0},a.ensureExists=function(o,r,s){return E(o,r,s,!0)},a.set=function(o,r,s,d){return E(o,r,s,d)},a.insert=function(o,r,s,d){var y=a.get(o,r);d=~~d,p(y)||(y=[],a.set(o,r,y)),y.splice(d,0,s)},a.empty=function(o,r){if(!c(r)&&o!=null){var s,d;if(s=a.get(o,r)){if(typeof s=="string")return a.set(o,r,"");if(v(s))return a.set(o,r,!1);if(typeof s=="number")return a.set(o,r,0);if(p(s))s.length=0;else if(l(s))for(d in s)w(s,d)&&delete s[d];else return a.set(o,r,null)}}},a.push=function(o,r){var s=a.get(o,r);p(s)||(s=[],a.set(o,r,s)),s.push.apply(s,Array.prototype.slice.call(arguments,2))},a.coalesce=function(o,r,s){for(var d,y=0,_=r.length;y<_;y++)if((d=a.get(o,r[y]))!==void 0)return d;return s},a.get=function(o,r,s){if(typeof r=="number"&&(r=[r]),!r||r.length===0)return o;if(o==null)return s;if(typeof r=="string")return a.get(o,r.split("."),s);var d=g(r[0]),y=I(o,d);return y===void 0?s:r.length===1?y:a.get(o[d],r.slice(1),s)},a.del=function(r,s){if(typeof s=="number"&&(s=[s]),r==null||c(s))return r;if(typeof s=="string")return a.del(r,s.split("."));var d=g(s[0]);if(!w(r,d))return r;if(s.length===1)p(r)?r.splice(d,1):delete r[d];else return a.del(r[d],s.slice(1));return r},a}var f=h();return f.create=h,f.withInheritedProps=h({includeInheritedProps:!0}),f})})(P)),P.exports}var A=z();const $={atob:{async exec(){return(await S(async()=>{const{atob:e}=await import("./index-D_C6pEAs.js").then(t=>t.i);return{atob:e}},[])).atob}},btoa:{async exec(){return(await S(async()=>{const{btoa:e}=await import("./index-D_C6pEAs.js").then(t=>t.i);return{btoa:e}},[])).btoa}},"crypto-js":{async exec(){return(await S(async()=>{const{default:e}=await import("./index-CT51TZmB.js").then(t=>t.i);return{default:e}},[])).default}}},G=e=>{if(e.response)return{body:e.response.body,requestType:e.requestType??x.QUERY,responseTime:e.response.responseTime,statusCode:e.response.status,headers:e.response.headers}},W=async e=>{const t=$[e];if(!t)throw new Error(`No request script module found matching "${e}"`);return t.exec()},J=(e,t)=>({data:e,helpers:{getEnvironment:n=>A.get(e.environment,n),setEnvironment:(n,c,i=!1)=>{A.set(e.environment,n,c),i&&(e.__toSetActiveEnvironment=e.__toSetActiveEnvironment??{},A.set(e.__toSetActiveEnvironment,n,c))},getCookie:n=>e.__cookieJar?.[n]??"",setCookie:(n,c,i)=>{t.setCookie(n,c,i)},request:async(n,c,i)=>t.request(n,c,i)},storage:{get:n=>t.getStorageItem(n),set:(n,c)=>t.setStorageItem(n,c)},importModule:n=>W(n),response:G(e),log:n=>{e.requestScriptLogs=e.requestScriptLogs??[],e.requestScriptLogs.push({id:crypto.randomUUID(),time:Date.now(),text:JSON.stringify(n,null,2),source:"Request script"})}}),Q=["setCookie","request","getStorageItem","setStorageItem"];class X{constructor(t){this.worker=t}start(){this.worker.onMessage(async t=>{switch(t.type){case k:try{await this.initExecute(t.payload)}catch(n){await this.makeCall("scriptError",n)}break}})}async initExecute(t){const[n,c]=t,i=await new Promise((l,p)=>{this.worker.onError(f=>{p(f)});const v=JSON.parse(JSON.stringify(c)),g=Q.reduce((f,u)=>(f[u]=((...a)=>this.makeCall(u,...a)),f),{}),h={altair:J(v,g),alert:f=>this.makeCall("alert",f)};return this.evalWithContext(n,h).then(f=>l(f)).catch(f=>{p(f)})});i.__toSetActiveEnvironment&&this.makeCall("updateActiveEnvironment",i.__toSetActiveEnvironment),this.makeCall("executeComplete",i)}makeCall(t,...n){return new Promise((c,i)=>{const l=T();this.worker.onMessage(p=>{switch(p.type){case`${t}_response`:return p.payload.id!==l?void 0:c(p.payload.response);case`${t}_error`:return p.payload.id!==l?void 0:i(p.payload.error)}}),this.worker.send(t,{id:l,args:n})})}async evalWithContext(t,n){const c=Object.entries(n);return(0,eval)(`
2
+ async (${c.map(l=>l[0]).join(",")}) => {
3
+ ${t};
4
+ return altair.data;
5
+ }
6
+ `)(...c.map(l=>l[1]))}}class Y extends M{origin;constructor(){super();const n=new URLSearchParams(window.location.search).get("sc");if(!n)throw new Error("Invalid source provided!");this.origin=n}onMessage(t){window.addEventListener("message",n=>{n.origin===this.origin&&t(n.data)})}send(t,n){window.parent.postMessage({type:t,payload:n},this.origin)}onError(t){window.addEventListener("error",t),window.addEventListener("unhandledrejection",n=>{n.preventDefault(),t(n.reason)})}}const H="plugin-sandbox::bootstrap_ready",F="plugin-sandbox::initialize",K="plugin-sandbox::initialized",Z=e=>new Promise((t,n)=>{const c=document.getElementsByTagName("head")[0];if(!c)return n(new Error("No head found!"));const i=document.createElement("script");i.type="text/javascript",i.src=e,i.onload=()=>t(null),i.onerror=l=>n(l),c.appendChild(i)}),V=e=>new Promise((t,n)=>{const c=document.getElementsByTagName("head")[0];if(!c)return n(new Error("No head found!"));const i=document.createElement("link");i.type="text/css",i.rel="stylesheet",i.href=e,i.onload=()=>t(null),i.onerror=l=>n(l),c.appendChild(i)}),j="https://sandbox.altairgraphql.dev",L=e=>{if(!e||typeof e!="object")return!1;const{params:t,scriptUrls:n,styleUrls:c}=e;return typeof t?.sc=="string"&&typeof t.id=="string"&&(t.instanceType==="main"||t.instanceType==="panel")&&Array.isArray(n)&&n.every(i=>typeof i=="string")&&Array.isArray(c)&&c.every(i=>typeof i=="string")},ee=e=>{if(!e||typeof e!="object")return!1;const{type:t,scriptUrls:n,styleUrls:c}=e;return t==="scripts"&&Array.isArray(n)&&n.every(i=>typeof i=="string")&&Array.isArray(c)&&c.every(i=>typeof i=="string")},te=()=>{if(window.location.origin!==j)return;const e=new URLSearchParams(window.location.search),t=e.get("plugin_sandbox_opts");if(!t)return;let n;try{n=JSON.parse(t)}catch{throw new Error("Invalid deprecated plugin options provided!")}if(!ee(n))throw new Error("Invalid deprecated plugin options provided!");const i={params:Object.fromEntries(e),scriptUrls:n.scriptUrls,styleUrls:n.styleUrls};if(!L(i))throw new Error("Invalid deprecated plugin options provided!");return console.warn("Query-based plugin sandbox initialization is deprecated. Update Altair to use postMessage initialization."),i},re=()=>new Promise((e,t)=>{const n=c=>{if(c.source!==window.parent||!c.data||typeof c.data!="object")return;const i=c.data;if(i.type===F){if(!L(i.payload)){window.removeEventListener("message",n),t(new Error("Invalid plugin sandbox initialization provided!"));return}if(c.origin!==i.payload.params.sc){window.removeEventListener("message",n),t(new Error("Invalid plugin sandbox source!"));return}window.removeEventListener("message",n),e(i.payload)}};window.addEventListener("message",n),window.parent.postMessage({type:H},"*")}),ne=async()=>{const e=te()??await re();window.__ALTAIR_PLUGIN_PARAMS__=e.params,document.querySelectorAll('style,link[rel="stylesheet"]').forEach(t=>t.remove());for(const t of e.styleUrls)await V(t);for(const t of e.scriptUrls)await Z(t);window.parent.postMessage({type:K,frameId:e.params.id},e.params.sc)},ie=new URLSearchParams(window.location.search),se=ie.get("sandbox_type");se==="plugin"?ne():new X(new Y).start();
@@ -6,7 +6,7 @@
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <base href="./" />
8
8
  <title>Altair Sandbox</title>
9
- <script type="module" crossorigin src="./assets/index-DN1P4DX8.js"></script>
9
+ <script type="module" crossorigin src="./assets/index-DHqKSLXH.js"></script>
10
10
  <link rel="stylesheet" crossorigin href="./assets/index-BVhbkyeN.css">
11
11
  </head>
12
12
  <body>