@alva-ai/toolkit 0.9.0 → 0.9.1

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.
@@ -1,2 +1,2 @@
1
- "use strict";var AlvaToolkit=(()=>{var U=Object.defineProperty;var Ee=Object.getOwnPropertyDescriptor;var Se=Object.getOwnPropertyNames;var we=Object.prototype.hasOwnProperty;var i=(r,e)=>U(r,"name",{value:e,configurable:!0});var Ce=(r,e)=>{for(var t in e)U(r,t,{get:e[t],enumerable:!0})},Ae=(r,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Se(e))!we.call(r,o)&&o!==t&&U(r,o,{get:()=>e[o],enumerable:!(s=Ee(e,o))||s.enumerable});return r};var Ge=r=>Ae(U({},"__esModule",{value:!0}),r);var Je={};Ce(Je,{AlvaClient:()=>re,AlvaError:()=>p,PBSV_UPDATE_MESSAGE:()=>de,UDF_CONSENT_REQUEST_MESSAGE:()=>me,UDF_CONSENT_RESPONSE_MESSAGE:()=>_e,UdfAuthRequiredError:()=>k,UdfConsentDeniedError:()=>R,UdfConsentRequiredError:()=>T,UdfConsentTimeoutError:()=>E,UdfError:()=>l,UdfExecutionError:()=>G,UdfFunctionDisabledError:()=>C,UdfFunctionNotFoundError:()=>w,UdfInsufficientCredits:()=>S,UdfPidMismatchError:()=>_,UdfRateLimitedError:()=>A,UdfTokenExpiredError:()=>v,UdfTokenInvalidError:()=>P,UdfTransportError:()=>g,VERSION:()=>Ve,getViewerToken:()=>b,installPlaybookRuntime:()=>le,mapUdfErrorResponse:()=>ae,playbookIdFromToken:()=>ne,udf:()=>be});var l=class extends Error{static{i(this,"UdfError")}code;metadata;status;constructor(e,{code:t,metadata:s={},status:o}){super(e),this.name=new.target.name,this.code=t,this.metadata=s,this.status=o}},k=class extends l{static{i(this,"UdfAuthRequiredError")}constructor(){super("Sign in to use this UDF.",{code:"AUTH_REQUIRED"})}},v=class extends l{static{i(this,"UdfTokenExpiredError")}},P=class extends l{static{i(this,"UdfTokenInvalidError")}},_=class extends l{static{i(this,"UdfPidMismatchError")}},T=class extends l{static{i(this,"UdfConsentRequiredError")}},R=class extends l{static{i(this,"UdfConsentDeniedError")}constructor(){super("UDF consent was denied.",{code:"CONSENT_DENIED"})}},E=class extends l{static{i(this,"UdfConsentTimeoutError")}constructor(){super("UDF consent timed out.",{code:"CONSENT_TIMEOUT"})}},S=class extends l{static{i(this,"UdfInsufficientCredits")}},w=class extends l{static{i(this,"UdfFunctionNotFoundError")}},C=class extends l{static{i(this,"UdfFunctionDisabledError")}},A=class extends l{static{i(this,"UdfRateLimitedError")}},G=class extends l{static{i(this,"UdfExecutionError")}},g=class extends l{static{i(this,"UdfTransportError")}},de="alva:pbsv:update",me="alva:udf:consent-request",_e="alva:udf:consent-response",ye="https://api.alva.ai",xe=300*1e3,q=null,x=null,oe=ye,y=null,f=null,ue=!1,I=new Map,Ue=i(r=>{let e=r.replace(/-/g,"+").replace(/_/g,"/"),t=e.padEnd(Math.ceil(e.length/4)*4,"=");return atob(t)},"decodeBase64Url"),ne=i(r=>{if(!r)return null;let[,e]=r.split(".");if(!e)return null;try{let t=JSON.parse(Ue(e));if(typeof t.pid=="number")return String(t.pid);if(typeof t.pid=="string")return t.pid}catch{return null}return null},"playbookIdFromToken"),b=i(()=>q,"getViewerToken"),Ie=i(r=>{let e=new URL(r.location.href);e.searchParams.delete("_pbsv"),r.history.replaceState(null,"",e.pathname+e.search+e.hash)},"stripPbsvFromUrl"),Ne=i(r=>{let e=new URLSearchParams(r.location.search);q=e.get("_pbsv"),x=e.get("parent_origin"),oe=(e.get("api_origin")||ye).replace(/\/$/,""),y=ne(q),q&&Ie(r)},"parseBootParams"),fe=i(async r=>{try{return await r.json()}catch{return{}}},"safeJson"),he=i(r=>r.error?.metadata||r.details?.metadata||{},"errorMetadata"),ae=i((r,e)=>{let t=r.error?.code||"TRANSPORT",s=r.error?.message||t,o=he(r),n={code:t,metadata:o,status:e};switch(t){case"PBSV_EXPIRED":return new v(s,n);case"PBSV_INVALID":case"UNAUTHENTICATED":return new P(s,n);case"PBSV_PID_MISMATCH":return new _(s,n);case"CONSENT_REQUIRED":return new T(s,n);case"INSUFFICIENT_CREDITS":return new S(s,n);case"FUNCTION_NOT_FOUND":return new w(s,n);case"FUNCTION_DISABLED":return new C(s,n);case"RESOURCE_EXHAUSTED":return new A(s,n);case"EXECUTION_FAILED":return new G(s,n);default:return new g(s,n)}},"mapUdfErrorResponse"),Fe=i(r=>{if(!f||!x||r.origin!==x||r.source!==f.parent||!r.data||typeof r.data!="object")return;let e=r.data;if(e.type===de){typeof e.token=="string"&&e.token.length>0&&(q=e.token,y=ne(e.token));return}if(e.type!==_e||typeof e.request_id!="string")return;let t=I.get(e.request_id);t&&(clearTimeout(t.timer),I.delete(e.request_id),t.resolve(e.granted===!0?"granted":"denied"))},"onMessage"),je=i(()=>globalThis.crypto?.randomUUID?globalThis.crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2)}`,"randomRequestId"),De=i(()=>{if(!y)return null;let r=Number(y);return Number.isSafeInteger(r)?r:null},"playbookIdForInvoke"),Me=i(async(r,e)=>{if(!f||!x)return"denied";let t=x,s=je();return new Promise(o=>{let n=setTimeout(()=>{I.delete(s),o("timeout")},xe);I.set(s,{resolve:o,timer:n}),f?.parent.postMessage({type:me,request_id:s,playbook_id:r,min_allowance:e},t)})},"requestConsent"),ce=i(async(r,e,t=!1)=>{let s=b();if(!s)throw new k;if(!y)throw new _("Missing playbook id.",{code:"PBSV_PID_MISMATCH"});let o=De();if(!o)throw new _("Invalid playbook id.",{code:"PBSV_PID_MISMATCH"});let n;try{n=await fetch(`${oe}/api/v1/service/invoke`,{method:"POST",headers:{Authorization:`Bearer ${s}`,"X-Pbsv":"1","Content-Type":"application/json"},body:JSON.stringify({playbook_id:o,function_name:r,parameters_json:JSON.stringify(e)})})}catch{throw new g("Network error while invoking UDF.",{code:"TRANSPORT"})}let a=await fe(n);if(n.ok)return a.result;if(a.error?.code==="CONSENT_REQUIRED"&&!t){let c=he(a),u=typeof c.playbook_id=="string"?c.playbook_id:y,h=typeof c.min_allowance_suggested=="number"?c.min_allowance_suggested:1,d=await Me(u,h);if(d==="granted")return ce(r,e,!0);throw d==="timeout"?new E:new R}throw ae(a,n.status)},"call"),Oe=i(async()=>{let r=b();if(!r)throw new k;if(!y)throw new _("Missing playbook id.",{code:"PBSV_PID_MISMATCH"});let e=new URL(`${oe}/api/v1/service/functions`);e.searchParams.set("playbook_id",y);let t=await fetch(e.toString(),{headers:{Authorization:`Bearer ${r}`,"X-Pbsv":"1"}}),s=await fe(t);if(!t.ok)throw ae(s,t.status);let o=s.functions;return Array.isArray(o)?o:[]},"list"),se=i((r,e,t)=>{r.dispatchEvent(new CustomEvent(e,{bubbles:!0,detail:t}))},"dispatchButtonEvent"),Le=i(r=>{if(typeof r!="string")return r;let t=f?.document?.querySelector(r);if(t&&"appendChild"in t)return t;throw new Error(`UDF button target not found: ${r}`)},"resolveButtonTarget"),$e=i((r,e)=>{if(!f)throw new Error("Playbook runtime is not installed.");let t=Le(r),s=f.document.createElement("button"),o=e.label||e.functionName,n=e.loadingLabel||"Running...",a=e.disabledLabel||"Sign in to run";return s.type="button",s.className="alva-udf-button",s.textContent=b()?o:a,s.disabled=!b(),s.setAttribute("data-function-name",e.functionName),s.disabled&&s.setAttribute("aria-disabled","true"),s.addEventListener("click",async()=>{if(!s.disabled){s.disabled=!0,s.textContent=n,se(s,"alva:udf-button:loading",{functionName:e.functionName});try{let c=await ce(e.functionName,e.params??{});se(s,"alva:udf-button:result",{functionName:e.functionName,result:c})}catch(c){se(s,"alva:udf-button:error",{functionName:e.functionName,error:c})}finally{s.disabled=!b(),s.textContent=s.disabled?a:o}}}),t.appendChild(s),s},"renderButton"),be={call:ce,list:Oe,getViewerToken:b,renderButton:$e,UdfError:l,UdfAuthRequiredError:k,UdfTokenExpiredError:v,UdfTokenInvalidError:P,UdfPidMismatchError:_,UdfConsentRequiredError:T,UdfConsentDeniedError:R,UdfConsentTimeoutError:E,UdfInsufficientCredits:S,UdfFunctionNotFoundError:w,UdfFunctionDisabledError:C,UdfRateLimitedError:A,UdfExecutionError:G,UdfTransportError:g},le=i(r=>{let e=r??(typeof window>"u"?void 0:window);if(!e||ue)return;f=e,ue=!0,Ne(e),e.addEventListener("message",Fe);let t=e,s=t.alva||{};t.alva={...s,udf:be}},"installPlaybookRuntime");var p=class extends Error{static{i(this,"AlvaError")}code;status;constructor(e,t,s){super(t),this.name="AlvaError",this.code=e,this.status=s}};var N=class{constructor(e){this.client=e}client;static{i(this,"FsResource")}async read(e){let t=await this.client._request("GET","/api/v1/fs/read",{query:{path:e.path,offset:e.offset,size:e.size}});if(!(t instanceof ArrayBuffer))return t;try{let s=new TextDecoder("utf-8",{fatal:!0}).decode(t);try{return JSON.parse(s)}catch{return s}}catch{return t}}async write(e){return this.client._requireAuth(),this.client._request("POST","/api/v1/fs/write",{body:{path:e.path,data:e.data,mkdir_parents:e.mkdir_parents}})}async rawWrite(e){return this.client._requireAuth(),this.client._request("POST","/api/v1/fs/write",{query:{path:e.path,mkdir_parents:e.mkdir_parents},rawBody:e.body})}async stat(e){return this.client._requireAuth(),this.client._request("GET","/api/v1/fs/stat",{query:{path:e.path}})}async readdir(e){return this.client._requireAuth(),this.client._request("GET","/api/v1/fs/readdir",{query:{path:e.path,recursive:e.recursive}})}async mkdir(e){this.client._requireAuth(),await this.client._request("POST","/api/v1/fs/mkdir",{body:{path:e.path}})}async remove(e){this.client._requireAuth(),await this.client._request("DELETE","/api/v1/fs/remove",{query:{path:e.path,recursive:e.recursive}})}async rename(e){this.client._requireAuth(),await this.client._request("POST","/api/v1/fs/rename",{body:{old_path:e.old_path,new_path:e.new_path}})}async copy(e){this.client._requireAuth(),await this.client._request("POST","/api/v1/fs/copy",{body:{src_path:e.src_path,dst_path:e.dst_path}})}async symlink(e){this.client._requireAuth(),await this.client._request("POST","/api/v1/fs/symlink",{body:{target_path:e.target_path,link_path:e.link_path}})}async readlink(e){return this.client._requireAuth(),this.client._request("GET","/api/v1/fs/readlink",{query:{path:e.path}})}async chmod(e){this.client._requireAuth(),await this.client._request("POST","/api/v1/fs/chmod",{body:{path:e.path,mode:e.mode}})}async grant(e){this.client._requireAuth(),await this.client._request("POST","/api/v1/fs/grant",{body:{path:e.path,subject:e.subject,permission:e.permission}})}async revoke(e){this.client._requireAuth(),await this.client._request("POST","/api/v1/fs/revoke",{body:{path:e.path,subject:e.subject,permission:e.permission}})}};var F=class{constructor(e){this.client=e}client;static{i(this,"RunResource")}async execute(e){return this.client._requireAuth(),this.client._request("POST","/api/v1/run",{body:{code:e.code,entry_path:e.entry_path,working_dir:e.working_dir,args:e.args,max_heap_size_mb:e.max_heap_size_mb}})}};var j=class{constructor(e){this.client=e}client;static{i(this,"DeployResource")}async create(e){return this.client._requireAuth(),this.client._request("POST","/api/v1/deploy/cronjob",{body:{name:e.name,path:e.path,cron_expression:e.cron_expression,args:e.args,push_notify:e.push_notify}})}async list(e){return this.client._requireAuth(),this.client._request("GET","/api/v1/deploy/cronjobs",{query:{limit:e?.limit,cursor:e?.cursor}})}async get(e){return this.client._requireAuth(),this.client._request("GET",`/api/v1/deploy/cronjob/${e.id}`)}async update(e){this.client._requireAuth();let{id:t,...s}=e;return this.client._request("PATCH",`/api/v1/deploy/cronjob/${t}`,{body:s})}async delete(e){this.client._requireAuth(),await this.client._request("DELETE",`/api/v1/deploy/cronjob/${e.id}`)}async pause(e){this.client._requireAuth(),await this.client._request("POST",`/api/v1/deploy/cronjob/${e.id}/pause`)}async resume(e){this.client._requireAuth(),await this.client._request("POST",`/api/v1/deploy/cronjob/${e.id}/resume`)}async trigger(e){return this.client._requireAuth(),this.client._request("POST",`/api/v1/deploy/cronjob/${e.id}/trigger`)}async listRuns(e){return this.client._requireAuth(),this.client._request("GET",`/api/v1/deploy/cronjob/${e.cronjob_id}/runs`,{query:{first:e.first,cursor:e.cursor}})}async getRunLogs(e){return this.client._requireAuth(),this.client._request("GET",`/api/v1/deploy/cronjob/${e.cronjob_id}/runs/${e.run_id}/logs`)}};var D=class{constructor(e){this.client=e}client;static{i(this,"ReleaseResource")}async feed(e){return this.client._requireAuth(),this.client._request("POST","/api/v1/release/feed",{body:{name:e.name,version:e.version,cronjob_id:e.cronjob_id,view_json:e.view_json,description:e.description,changelog:e.changelog}})}async playbookDraft(e){return this.client._requireAuth(),this.client._request("POST","/api/v1/draft/playbook",{body:{name:e.name,display_name:e.display_name,description:e.description,feeds:e.feeds,trading_symbols:e.trading_symbols,skill_id:e.skill_id,tags:e.tags}})}async playbook(e){return this.client._requireAuth(),this.client._request("POST","/api/v1/release/playbook",{body:{name:e.name,version:e.version,feeds:e.feeds,changelog:e.changelog,readme_url:e.readme_url}})}};var M=class{constructor(e){this.client=e}client;static{i(this,"FeedResource")}async delete(e){if(this.client._requireAuth(),!Number.isInteger(e.id)||e.id<=0)throw new Error("feed id must be a positive integer");return this.client._request("DELETE",`/api/v1/feed/${encodeURIComponent(String(e.id))}`)}};var O=class{constructor(e){this.client=e}client;static{i(this,"PlaybooksResource")}async trending(e={}){let t={};e.cursor&&(t.cursor=e.cursor),e.current&&(t.current=e.current),e.limit!==void 0&&(t.limit=e.limit),e.dir&&(t.dir=e.dir),e.sort&&(t.sort=e.sort),e.keyword&&(t.keyword=e.keyword),e.tags&&e.tags.length>0&&(t.tags=e.tags.join(","));let s=await this.client._request("GET","/api/v1/playbooks/trending",{query:t});return{playbooks:(s.playbooks??[]).map(Be),has_next:s.has_next??!1}}};function Be(r){let e=r.creator?.name??"",t=r.name??"",s=e&&t?`${e}/${t}`:t;return{id:r.id===void 0?"":String(r.id),ref:s,username:e,name:t,display_name:r.display_name??"",description:r.description??"",tags:r.tags??[],follow_count:r.follow_count??0,url_path:e&&t?`/${e}/playbooks/${t}`:"",...r.readme?{readme:r.readme}:{},cursor:r.cursor??""}}i(Be,"toAgentPlaybook");var L=class{constructor(e){this.client=e}client;static{i(this,"SecretsResource")}async create(e){this.client._requireAuth(),await this.client._request("POST","/api/v1/secrets",{body:{name:e.name,value:e.value}})}async list(){return this.client._requireAuth(),this.client._request("GET","/api/v1/secrets")}async get(e){this.client._requireAuth();let t=encodeURIComponent(e.name);return this.client._request("GET",`/api/v1/secrets/${t}`)}async update(e){this.client._requireAuth();let t=encodeURIComponent(e.name);await this.client._request("PUT",`/api/v1/secrets/${t}`,{body:{value:e.value}})}async delete(e){this.client._requireAuth();let t=encodeURIComponent(e.name);await this.client._request("DELETE",`/api/v1/secrets/${t}`)}};var $=class{constructor(e){this.client=e}client;static{i(this,"SdkDocsResource")}async doc(e){return this.client._requireAuth(),this.client._request("GET","/api/v1/sdk/doc",{query:{name:e.name}})}async partitions(){return this.client._requireAuth(),this.client._request("GET","/api/v1/sdk/partitions")}async partitionSummary(e){this.client._requireAuth();let t=encodeURIComponent(e.partition);return this.client._request("GET",`/api/v1/sdk/partitions/${t}/summary`)}};var ke=[{skill:"arrays-data-api-crypto-futures-data",file:"binance-perp-usdt-kline",method:"GET",path:"/api/v1/crypto/binance/perp/usdt/kline",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-spot-market-price-and-volume",file:"binance-spot-usdt-kline",method:"GET",path:"/api/v1/crypto/binance/spot/usdt/kline",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-spot-market-price-and-volume",file:"crypto-detail",method:"GET",path:"/api/v1/crypto/detail",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-crypto-metrics-and-screener",file:"fear-greed-index",method:"GET",path:"/api/v1/crypto/fear-greed-index",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-crypto-futures-data",file:"funding-rate",method:"GET",path:"/api/v1/crypto/funding-rate",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-crypto-futures-data",file:"hyperliquid-perp-usdc-kline",method:"GET",path:"/api/v1/crypto/hyperliquid/perp/usdc/kline",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-spot-market-price-and-volume",file:"hyperliquid-spot-usdc-kline",method:"GET",path:"/api/v1/crypto/hyperliquid/spot/usdc/kline",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-crypto-metrics-and-screener",file:"list",method:"GET",path:"/api/v1/crypto/list",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-crypto-futures-data",file:"long-short-ratio",method:"GET",path:"/api/v1/crypto/long-short-ratio",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-crypto-metrics-and-screener",file:"crypto-market-cap",method:"GET",path:"/api/v1/crypto/market-cap",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-crypto-metrics-and-screener",file:"market-metrics",method:"GET",path:"/api/v1/crypto/market-metrics",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-crypto-futures-data",file:"open-interest",method:"GET",path:"/api/v1/crypto/open-interest",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-crypto-metrics-and-screener",file:"screener-metrics",method:"GET",path:"/api/v1/crypto/screener/metrics",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-crypto-metrics-and-screener",file:"screener-metrics-timerange",method:"GET",path:"/api/v1/crypto/screener/metrics/timerange",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-crypto-metrics-and-screener",file:"trading-pair",method:"GET",path:"/api/v1/crypto/trading-pair",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-etf-fundamentals",file:"country-weightings",method:"GET",path:"/api/v1/etf/country-weightings",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-etf-fundamentals",file:"holdings",method:"GET",path:"/api/v1/etf/holdings",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-etf-fundamentals",file:"info",method:"GET",path:"/api/v1/etf/info",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-etf-fundamentals",file:"sector-weightings",method:"GET",path:"/api/v1/etf/sector-weightings",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-macro-and-economics",file:"macro-commodity-historical",method:"GET",path:"/api/v1/macro/commodity/historical",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-macro-and-economics",file:"macro-commodity-real-time",method:"GET",path:"/api/v1/macro/commodity/real-time",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-macro-and-economics",file:"macro-commodity-symbol-list",method:"GET",path:"/api/v1/macro/commodity/symbols",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-macro-and-economics",file:"economic-indicators",method:"GET",path:"/api/v1/macro/economic-indicators",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-macro-and-economics",file:"macro-forex-historical",method:"GET",path:"/api/v1/macro/forex/historical",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-macro-and-economics",file:"macro-forex-real-time",method:"GET",path:"/api/v1/macro/forex/real-time",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-macro-and-economics",file:"macro-forex-symbol-list",method:"GET",path:"/api/v1/macro/forex/symbols",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-macro-and-economics",file:"macro-index-historical",method:"GET",path:"/api/v1/macro/index/historical",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-macro-and-economics",file:"macro-index-real-time",method:"GET",path:"/api/v1/macro/index/real-time",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-macro-and-economics",file:"rates",method:"GET",path:"/api/v1/macro/treasury-rates",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-equity-fundamentals",file:"company-balance-sheets",method:"GET",path:"/api/v1/stocks/company/balance-sheets",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-equity-fundamentals",file:"company-cashflow-statements",method:"GET",path:"/api/v1/stocks/company/cashflow-statements",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-equity-fundamentals",file:"company-detail",method:"GET",path:"/api/v1/stocks/company/detail",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-equity-fundamentals",file:"company-income-statements",method:"GET",path:"/api/v1/stocks/company/income-statements",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-equity-fundamentals",file:"company-kpi",method:"GET",path:"/api/v1/stocks/company/kpi",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-equity-events",file:"crowdfunding-offerings",method:"GET",path:"/api/v1/stocks/crowdfunding/offerings",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-equity-events",file:"dividends",method:"GET",path:"/api/v1/stocks/dividends",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-equity-events",file:"earnings-calendar",method:"GET",path:"/api/v1/stocks/earnings-calendar",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-equity-events",file:"equity-offering",method:"GET",path:"/api/v1/stocks/equity-offering",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-stock-metrics",file:"financial-metrics",method:"GET",path:"/api/v1/stocks/financial-metrics",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-equity-fundamentals",file:"fiscal-dates",method:"GET",path:"/api/v1/stocks/fiscal-dates",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-equity-fundamentals",file:"fiscal-dates-range",method:"GET",path:"/api/v1/stocks/fiscal-dates/range",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-equity-events",file:"ipo-calendar",method:"GET",path:"/api/v1/stocks/ipo-calendar",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-equity-events",file:"ipo-confirmed-calendar",method:"GET",path:"/api/v1/stocks/ipo-confirmed-calendar",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-spot-market-price-and-volume",file:"stocks-kline",method:"GET",path:"/api/v1/stocks/kline",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-stock-metrics",file:"market-metrics",method:"GET",path:"/api/v1/stocks/market-metrics",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-equity-events",file:"mergers-acquisitions",method:"GET",path:"/api/v1/stocks/mergers-acquisitions",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-equity-fundamentals",file:"outstanding-shares",method:"GET",path:"/api/v1/stocks/outstanding-shares",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-stock-metrics",file:"ratings",method:"GET",path:"/api/v1/stocks/ratings",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-stock-screener",file:"basic-info-screener",method:"GET",path:"/api/v1/stocks/screener/basic-info/{sub}",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-stock-screener",file:"event-screener",method:"GET",path:"/api/v1/stocks/screener/events",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-stock-screener",file:"screener-financial-metrics",method:"GET",path:"/api/v1/stocks/screener/financial-metrics",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-stock-screener",file:"screener-financial-metrics-timerange",method:"GET",path:"/api/v1/stocks/screener/financial-metrics/timerange",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-stock-screener",file:"screener-technical-metrics",method:"GET",path:"/api/v1/stocks/screener/technical-metrics",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-stock-screener",file:"screener-technical-metrics-timerange",method:"GET",path:"/api/v1/stocks/screener/technical-metrics/timerange",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-equity-events",file:"sec-earnings-release",method:"GET",path:"/api/v1/stocks/sec-earnings-release",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-equity-fundamentals",file:"shares-float",method:"GET",path:"/api/v1/stocks/shares-float",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-equity-events",file:"splits",method:"GET",path:"/api/v1/stocks/splits",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-crypto-exchange-flow",file:"exchange-flows",method:"GET",path:"/api/v1/crypto/exchange-flows",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-company-crypto-holdings",file:"crypto-holdings",method:"GET",path:"/api/v1/crypto/holdings",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-crypto-metrics-and-screener",file:"metrics-inflow-cdd",method:"GET",path:"/api/v1/crypto/metrics/inflow-cdd",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-crypto-metrics-and-screener",file:"metrics-leverage-ratio",method:"GET",path:"/api/v1/crypto/metrics/leverage-ratio",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-crypto-metrics-and-screener",file:"metrics-miner-to-exchange",method:"GET",path:"/api/v1/crypto/metrics/miner-to-exchange",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-crypto-metrics-and-screener",file:"metrics-mvrv",method:"GET",path:"/api/v1/crypto/metrics/mvrv",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-crypto-metrics-and-screener",file:"metrics-nupl",method:"GET",path:"/api/v1/crypto/metrics/nupl",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-crypto-metrics-and-screener",file:"metrics-puell-multiple",method:"GET",path:"/api/v1/crypto/metrics/puell-multiple",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-crypto-metrics-and-screener",file:"metrics-realized-price",method:"GET",path:"/api/v1/crypto/metrics/realized-price",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-crypto-metrics-and-screener",file:"metrics-sopr",method:"GET",path:"/api/v1/crypto/metrics/sopr",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-crypto-metrics-and-screener",file:"metrics-ssr",method:"GET",path:"/api/v1/crypto/metrics/ssr",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-crypto-metrics-and-screener",file:"metrics-whale-ratio",method:"GET",path:"/api/v1/crypto/metrics/whale-ratio",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-crypto-metrics-and-screener",file:"crypto-supply",method:"GET",path:"/api/v1/crypto/supply",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-crypto-futures-data",file:"taker-buy-sell-volume",method:"GET",path:"/api/v1/crypto/taker-buy-sell-volume",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-crypto-metrics-and-screener",file:"unlock-events",method:"GET",path:"/api/v1/crypto/unlock-events",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-etf-fundamentals",file:"flow",method:"GET",path:"/api/v1/etf/flow",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-options",file:"contracts",method:"GET",path:"/api/v1/options/contracts",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-options",file:"kline",method:"GET",path:"/api/v1/options/kline",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-equity-fundamentals",file:"company-executives",method:"GET",path:"/api/v1/stocks/company/executives",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-equity-estimates-and-targets",file:"company-price-target-consensus",method:"GET",path:"/api/v1/stocks/company/price-target-consensus",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-equity-estimates-and-targets",file:"company-price-target-news",method:"GET",path:"/api/v1/stocks/company/price-target-news",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-equity-estimates-and-targets",file:"company-price-target-summary",method:"GET",path:"/api/v1/stocks/company/price-target-summary",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-equity-ownership-and-flow",file:"congress-recent-trades",method:"GET",path:"/api/v1/stocks/congress/recent-trades",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-stock-metrics",file:"darkpool",method:"GET",path:"/api/v1/stocks/darkpool",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-equity-estimates-and-targets",file:"estimates-guidance",method:"GET",path:"/api/v1/stocks/estimates-guidance",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-equity-ownership-and-flow",file:"insider-transactions",method:"GET",path:"/api/v1/stocks/insider/transactions",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-equity-ownership-and-flow",file:"institution-holder",method:"GET",path:"/api/v1/stocks/institution-holder",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-polymarket",file:"activity",method:"GET",path:"polymarket:/activity",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-polymarket",file:"book",method:"GET",path:"polymarket:/book",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-polymarket",file:"closed-positions",method:"GET",path:"polymarket:/closed-positions",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-polymarket",file:"events",method:"GET",path:"polymarket:/events",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-polymarket",file:"holders",method:"GET",path:"polymarket:/holders",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-polymarket",file:"markets",method:"GET",path:"polymarket:/markets",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-polymarket",file:"midpoint",method:"GET",path:"polymarket:/midpoint",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-polymarket",file:"oi",method:"GET",path:"polymarket:/oi",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-polymarket",file:"positions",method:"GET",path:"polymarket:/positions",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-polymarket",file:"price",method:"GET",path:"polymarket:/price",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-polymarket",file:"prices-history",method:"GET",path:"polymarket:/prices-history",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-polymarket",file:"public-search",method:"GET",path:"polymarket:/public-search",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-polymarket",file:"series",method:"GET",path:"polymarket:/series",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-polymarket",file:"sports",method:"GET",path:"polymarket:/sports",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-polymarket",file:"spread",method:"GET",path:"polymarket:/spread",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-polymarket",file:"tags",method:"GET",path:"polymarket:/tags",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-polymarket",file:"trades",method:"GET",path:"polymarket:/trades",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-polymarket",file:"value",method:"GET",path:"polymarket:/value",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-equity-events",file:"earnings-transcript",method:"GET",path:"/api/v1/stocks/earnings-transcript",tier:"unstructured",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-news",file:"market-news",method:"GET",path:"/api/v1/stocks/market-news",tier:"unstructured",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-social-feeds",file:"x-by-handle",method:"GET",path:"/api/v1/social-feeds/x/by-handle",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-social-feeds",file:"x-by-url",method:"GET",path:"/api/v1/social-feeds/x/by-url",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-social-feeds",file:"x-entities-handle",method:"GET",path:"/api/v1/social-feeds/x/entities/handle/{twitter_handle}",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-social-feeds",file:"x-entities-handles",method:"GET",path:"/api/v1/social-feeds/x/entities/handles",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0}];function ge(r,e){return ke.find(t=>t.skill===r&&t.file===e)}i(ge,"getSkillEndpointMetadata");function pe(r){return ke.filter(e=>e.skill===r)}i(pe,"listSkillEndpointMetadata");var B=class{constructor(e){this.client=e}client;static{i(this,"DataSkillsResource")}async list(){return{skills:((await this.client._request("GET","/api/v1/skills",{baseUrl:this.client.arraysBaseUrl,noAuth:!0})).data??[]).map(t=>({...t,...qe(t.name)}))}}async summary(e){let t=encodeURIComponent(e.name),o=(await this.client._request("GET",`/api/v1/skills/${t}`,{baseUrl:this.client.arraysBaseUrl,noAuth:!0})).data?.[0];if(!o)throw new Error(`empty skills summary response for "${e.name}"`);let n=pe(e.name);return{...o,...qe(e.name),...n.length>0?{endpoint_metadata:n}:{}}}async endpoint(e){let t=encodeURIComponent(e.name),o=(await this.client._request("GET",`/api/v1/skills/${t}`,{baseUrl:this.client.arraysBaseUrl,noAuth:!0,query:{endpoint:e.file}})).data?.[0];if(!o)throw new Error(`empty skills endpoint response for "${e.name}" file "${e.file}"`);let n=ge(e.name,e.file);return{...o,...n?{metadata:n}:{}}}};function qe(r){let e=pe(r);if(e.length===0)return{};let t={},s=0;for(let o of e)t[o.tier]=(t[o.tier]??0)+1,o.pro_required&&(s+=1);return{endpoint_tier_counts:t,metadata:{endpoint_count:e.length,endpoint_tier_counts:t,pro_count:s}}}i(qe,"metadataSummaryForSkill");function ve(r){let e=r.split("/");if(e.length!==2||!e[0]||!e[1])throw new p("INVALID_ARGUMENT",`playbook skill identifier must be "<user>/<name>", got "${r}"`,0);return{username:e[0],name:e[1]}}i(ve,"parsePlaybookSkillId");var W=class{constructor(e){this.client=e}client;static{i(this,"PlaybookSkillsResource")}async list(e){let t={};return e?.tag&&(t.tag=e.tag),e?.username&&(t.username=e.username),{skills:(await this.client._request("GET","/api/v1/skills",{query:t})).data??[]}}async tags(){return{tags:(await this.client._request("GET","/api/v1/skills/tags")).data??[]}}async get(e){let{username:t,name:s}=ve(e),o=encodeURIComponent(t),n=encodeURIComponent(s),c=(await this.client._request("GET",`/api/v1/skills/${o}/${n}`)).data?.[0];if(!c)throw new p("NOT_FOUND",`empty playbook skills get response for ${e}`,0);return c}async file(e,t){let{username:s,name:o}=ve(e),n=encodeURIComponent(s),a=encodeURIComponent(o),c=t.split("/").map(encodeURIComponent).join("/"),h=(await this.client._request("GET",`/api/v1/skills/${n}/${a}/files/${c}`)).data?.[0];if(!h)throw new p("NOT_FOUND",`empty playbook skills file response for ${e} path ${t}`,0);return h}};var H=class{constructor(e){this.client=e}client;static{i(this,"CommentsResource")}async create(e){return this.client._requireAuth(),this.client._request("POST","/api/v1/playbook/comment",{body:{username:e.username,name:e.name,content:e.content,parent_id:e.parent_id}})}async pin(e){return this.client._requireAuth(),this.client._request("POST","/api/v1/playbook/comment/pin",{body:{comment_id:e.comment_id}})}async unpin(e){return this.client._requireAuth(),this.client._request("POST","/api/v1/playbook/comment/unpin",{body:{comment_id:e.comment_id}})}};var V=class{constructor(e){this.client=e}client;static{i(this,"RemixResource")}async save(e){this.client._requireAuth(),await this.client._request("POST","/api/v1/remix",{body:{child:e.child,parents:e.parents}})}};var J=class{constructor(e){this.client=e}client;static{i(this,"ScreenshotResource")}async capture(e){return this.client._requireAuth(),this.client._request("GET","/api/v1/screenshot",{query:{url:e.url,selector:e.selector,xpath:e.xpath,compress:e.compress,compress_quality:e.compressQuality,compress_max_width:e.compressMaxWidth}})}};var K=class{constructor(e){this.client=e}client;static{i(this,"UserResource")}async me(){return this.client._requireAuth(),this.client._request("GET","/api/v1/me")}};var X=class{constructor(e){this.client=e}client;static{i(this,"TradingResource")}async accounts(){return this.client._requireAuth(),this.client._request("GET","/api/v1/trading/accounts")}async portfolio(e){return this.client._requireAuth(),this.client._request("GET","/api/v1/trading/portfolio",{query:{accountId:e}})}async orders(e){return this.client._requireAuth(),this.client._request("GET","/api/v1/trading/orders",{query:{accountId:e.accountId,source:e.source,since:e.since,limit:e.limit}})}async subscriptions(e){return this.client._requireAuth(),this.client._request("GET","/api/v1/trading/subscriptions",{query:{accountId:e}})}async equityHistory(e){return this.client._requireAuth(),this.client._request("GET","/api/v1/trading/equity-history",{query:{accountId:e.accountId,timeframe:e.timeframe,sinceMs:e.sinceMs,untilMs:e.untilMs}})}async riskRules(){return this.client._requireAuth(),this.client._request("GET","/api/v1/trading/risk-rules")}async subscribe(e){return this.client._requireAuth(),this.client._request("POST","/api/v1/trading/subscribe",{body:e})}async unsubscribe(e){return this.client._requireAuth(),this.client._request("POST","/api/v1/trading/unsubscribe",{body:{subscriptionId:e}})}async execute(e){return this.client._requireAuth(),this.client._request("POST","/api/v1/trading/execute",{body:e})}async updateRiskRules(e){return this.client._requireAuth(),this.client._request("PUT","/api/v1/trading/risk-rules",{body:e})}};var z=class{constructor(e){this.client=e}client;static{i(this,"ArraysJwtResource")}async ensure(){return this.client._requireAuth(),this.client._request("POST","/api/v1/arrays-jwt/ensure")}async status(){return this.client._requireAuth(),this.client._request("GET","/api/v1/arrays-jwt/status")}};var Q=class{constructor(e){this.client=e}client;static{i(this,"NotificationsResource")}async listPlaybook(e){this.client._requireAuth();let t=`/api/v1/playbook/${encodeURIComponent(e.username)}/${encodeURIComponent(e.name)}/notifications`;return this.client._request("GET",t,{query:Pe(e)})}async listFeed(e){this.client._requireAuth();let t=`/api/v1/feed/${encodeURIComponent(e.username)}/${encodeURIComponent(e.name)}/notifications`;return this.client._request("GET",t,{query:Pe(e)})}};function Pe(r){let e={};return r.channel&&(e.channel=r.channel),r.status&&(e.status=r.status),r.since_time!==void 0&&r.since_time>0&&(e.since_time=String(r.since_time)),r.first!==void 0&&r.first>0&&(e.first=String(r.first)),r.cursor&&(e.cursor=r.cursor),e}i(Pe,"buildQuery");var Y=class{constructor(e){this.client=e}client;static{i(this,"NotificationPreferencesResource")}async list(){return this.client._requireAuth(),this.client._request("GET","/api/v1/me/notifications/preferences")}async update(e){return this.client._requireAuth(),this.client._request("PATCH",`/api/v1/me/notifications/preferences/${encodeURIComponent(e.key)}`,{body:{enabled:e.enabled}})}};var Z=class{constructor(e){this.client=e}client;static{i(this,"PushSubscriptionsResource")}async subscribePlaybook(e){this.client._requireAuth();let t=`/api/v1/push-subscriptions/playbook/${encodeURIComponent(e.username)}/${encodeURIComponent(e.name)}`;return this.client._request("POST",t)}async unsubscribePlaybook(e){this.client._requireAuth();let t=`/api/v1/push-subscriptions/playbook/${encodeURIComponent(e.username)}/${encodeURIComponent(e.name)}`;return this.client._request("DELETE",t)}async subscribeFeed(e){this.client._requireAuth();let t=`/api/v1/push-subscriptions/feed/${encodeURIComponent(e.username)}/${encodeURIComponent(e.name)}`;return this.client._request("POST",t)}async unsubscribeFeed(e){this.client._requireAuth();let t=`/api/v1/push-subscriptions/feed/${encodeURIComponent(e.username)}/${encodeURIComponent(e.name)}`;return this.client._request("DELETE",t)}async list(e={}){this.client._requireAuth();let t={};return e.first!==void 0&&e.first>0&&(t.first=String(e.first)),e.cursor&&(t.cursor=e.cursor),this.client._request("GET","/api/v1/me/push-subscriptions",{query:t})}};var ee=class{constructor(e){this.client=e}client;static{i(this,"ChannelGroupSubscriptionsResource")}async context(e){return this.client._requireAuth(),this.client._request("GET","/api/v1/channel/group-subscriptions/context",{query:{session_id:e.session_id}})}async list(e){return this.client._requireAuth(),this.client._request("GET","/api/v1/channel/group-subscriptions",{query:{session_id:e.session_id}})}async subscribe(e){return this.client._requireAuth(),this.client._request("POST","/api/v1/channel/group-subscriptions",{jsonBody:Te(e)})}async unsubscribe(e){return this.client._requireAuth(),this.client._request("DELETE","/api/v1/channel/group-subscriptions",{jsonBody:Te(e)})}};function Te(r){return`{"session_id":${Re(r.session_id)},"target_type":${JSON.stringify(r.target_type)},"target_id":${Re(r.target_id)}}`}i(Te,"mutationBody");function Re(r){if(typeof r=="number"){if(!Number.isInteger(r)||r<=0||!Number.isSafeInteger(r))throw new p("INVALID_ARGUMENT","channel group subscription ids must be positive safe integers; pass large int64 ids as strings",0);return String(r)}if(!/^[1-9]\d*$/.test(r))throw new p("INVALID_ARGUMENT","channel group subscription ids must be positive integer strings",0);return r}i(Re,"idLiteral");var We="https://api-llm.prd.alva.ai",He="https://data-tools.prd.space.id",re=class{static{i(this,"AlvaClient")}baseUrl;arraysBaseUrl;viewer_token;pbsvToken;apiKey;gaClientId;gaSessionId;utmParams;_fs;_run;_deploy;_release;_feed;_playbooks;_secrets;_sdk;_dataSkills;_playbookSkills;_comments;_remix;_screenshot;_user;_trading;_arraysJwt;_notifications;_notificationPreferences;_pushSubscriptions;_channelGroupSubscriptions;constructor(e){this.baseUrl=e.baseUrl??We,this.arraysBaseUrl=e.arraysBaseUrl??He,this.viewer_token=e.viewer_token,this.pbsvToken=e.pbsvToken,this.apiKey=e.apiKey,this.gaClientId=e.gaClientId,this.gaSessionId=e.gaSessionId,this.utmParams=e.utmParams}get fs(){return this._fs??=new N(this)}get run(){return this._run??=new F(this)}get deploy(){return this._deploy??=new j(this)}get release(){return this._release??=new D(this)}get feed(){return this._feed??=new M(this)}get playbooks(){return this._playbooks??=new O(this)}get secrets(){return this._secrets??=new L(this)}get sdk(){return this._sdk??=new $(this)}get dataSkills(){return this._dataSkills??=new B(this)}get playbookSkills(){return this._playbookSkills??=new W(this)}get comments(){return this._comments??=new H(this)}get remix(){return this._remix??=new V(this)}get screenshot(){return this._screenshot??=new J(this)}get user(){return this._user??=new K(this)}get trading(){return this._trading??=new X(this)}get arraysJwt(){return this._arraysJwt??=new z(this)}get notifications(){return this._notifications??=new Q(this)}get notificationPreferences(){return this._notificationPreferences??=new Y(this)}get pushSubscriptions(){return this._pushSubscriptions??=new Z(this)}get channelGroupSubscriptions(){return this._channelGroupSubscriptions??=new ee(this)}_requireAuth(){if(!this.pbsvToken&&!this.viewer_token&&!this.apiKey)throw new p("UNAUTHENTICATED","Authentication is required. Pass pbsvToken, viewer_token, or apiKey in the constructor.",401)}async _request(e,t,s){let n=`${s?.baseUrl??this.baseUrl}${t}`;if(s?.query){let d=new URLSearchParams;for(let[m,ie]of Object.entries(s.query))ie!=null&&d.set(m,String(ie));let te=d.toString();te&&(n+=`?${te}`)}let a={};s?.noAuth||(this.pbsvToken?(a.Authorization=`Bearer ${this.pbsvToken}`,a["X-Pbsv"]="1"):this.viewer_token?a["x-Playbook-Viewer"]=this.viewer_token:this.apiKey&&(a["X-Alva-Api-Key"]=this.apiKey)),this.gaClientId&&(a["X-Alva-GA-Client-ID"]=this.gaClientId),this.gaSessionId&&(a["X-Alva-GA-Session-ID"]=this.gaSessionId),this.utmParams&&(a["X-Alva-UTM-Params"]=this.utmParams);let c;s?.rawBody!==void 0?(a["Content-Type"]="application/octet-stream",c=s.rawBody):s?.jsonBody!==void 0?(a["Content-Type"]="application/json",c=s.jsonBody):s?.body!==void 0&&(a["Content-Type"]="application/json",c=JSON.stringify(s.body));let u;try{u=await fetch(n,{method:e,headers:a,body:c})}catch(d){throw new p("NETWORK_ERROR",d instanceof Error?d.message:"Network request failed",0)}if(!u.ok){let d=await u.text().catch(()=>"");if((u.headers.get("content-type")??"").includes("application/json")&&d)try{let m=JSON.parse(d);if(m.error)throw new p(m.error.code??"UNKNOWN",m.error.message??`HTTP ${u.status}`,u.status)}catch(m){if(m instanceof p)throw m}throw new p("UNKNOWN",`HTTP ${u.status}: ${d.slice(0,200)}`,u.status)}if(u.status===204)return;let h=u.headers.get("content-type")??"";return h.includes("application/octet-stream")||h.includes("image/")?u.arrayBuffer():u.json()}};var Ve="0.9.0";le();return Ge(Je);})();
1
+ "use strict";var AlvaToolkit=(()=>{var U=Object.defineProperty;var Se=Object.getOwnPropertyDescriptor;var we=Object.getOwnPropertyNames;var Ce=Object.prototype.hasOwnProperty;var i=(r,e)=>U(r,"name",{value:e,configurable:!0});var Ae=(r,e)=>{for(var t in e)U(r,t,{get:e[t],enumerable:!0})},Ge=(r,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of we(e))!Ce.call(r,o)&&o!==t&&U(r,o,{get:()=>e[o],enumerable:!(s=Se(e,o))||s.enumerable});return r};var xe=r=>Ge(U({},"__esModule",{value:!0}),r);var Ke={};Ae(Ke,{AlvaClient:()=>te,AlvaError:()=>p,PBSV_UPDATE_MESSAGE:()=>me,UDF_CONSENT_REQUEST_MESSAGE:()=>_e,UDF_CONSENT_RESPONSE_MESSAGE:()=>ye,UdfAuthRequiredError:()=>k,UdfConsentDeniedError:()=>R,UdfConsentRequiredError:()=>T,UdfConsentTimeoutError:()=>E,UdfError:()=>l,UdfExecutionError:()=>G,UdfFunctionDisabledError:()=>C,UdfFunctionNotFoundError:()=>w,UdfInsufficientCredits:()=>S,UdfPidMismatchError:()=>_,UdfRateLimitedError:()=>A,UdfTokenExpiredError:()=>v,UdfTokenInvalidError:()=>P,UdfTransportError:()=>g,VERSION:()=>Je,getViewerToken:()=>b,installPlaybookRuntime:()=>pe,mapUdfErrorResponse:()=>ce,playbookIdFromToken:()=>ae,udf:()=>ke});var l=class extends Error{static{i(this,"UdfError")}code;metadata;status;constructor(e,{code:t,metadata:s={},status:o}){super(e),this.name=new.target.name,this.code=t,this.metadata=s,this.status=o}},k=class extends l{static{i(this,"UdfAuthRequiredError")}constructor(){super("Sign in to use this UDF.",{code:"AUTH_REQUIRED"})}},v=class extends l{static{i(this,"UdfTokenExpiredError")}},P=class extends l{static{i(this,"UdfTokenInvalidError")}},_=class extends l{static{i(this,"UdfPidMismatchError")}},T=class extends l{static{i(this,"UdfConsentRequiredError")}},R=class extends l{static{i(this,"UdfConsentDeniedError")}constructor(){super("UDF consent was denied.",{code:"CONSENT_DENIED"})}},E=class extends l{static{i(this,"UdfConsentTimeoutError")}constructor(){super("UDF consent timed out.",{code:"CONSENT_TIMEOUT"})}},S=class extends l{static{i(this,"UdfInsufficientCredits")}},w=class extends l{static{i(this,"UdfFunctionNotFoundError")}},C=class extends l{static{i(this,"UdfFunctionDisabledError")}},A=class extends l{static{i(this,"UdfRateLimitedError")}},G=class extends l{static{i(this,"UdfExecutionError")}},g=class extends l{static{i(this,"UdfTransportError")}},me="alva:pbsv:update",_e="alva:udf:consent-request",ye="alva:udf:consent-response",fe="https://api.alva.ai",Ue=300*1e3,q=null,x=null,ne=fe,y=null,f=null,de=!1,I=new Map,Ie=i(r=>{let e=r.replace(/-/g,"+").replace(/_/g,"/"),t=e.padEnd(Math.ceil(e.length/4)*4,"=");return atob(t)},"decodeBase64Url"),ae=i(r=>{if(!r)return null;let[,e]=r.split(".");if(!e)return null;try{let t=JSON.parse(Ie(e));if(typeof t.pid=="number")return String(t.pid);if(typeof t.pid=="string")return t.pid}catch{return null}return null},"playbookIdFromToken"),b=i(()=>q,"getViewerToken"),Ne=i(r=>{let e=new URL(r.location.href);e.searchParams.delete("_pbsv"),r.history.replaceState(null,"",e.pathname+e.search+e.hash)},"stripPbsvFromUrl"),Fe=i(r=>{let e=new URLSearchParams(r.location.search);q=e.get("_pbsv"),x=e.get("parent_origin"),ne=(e.get("api_origin")||fe).replace(/\/$/,""),y=ae(q),q&&Ne(r)},"parseBootParams"),he=i(async r=>{try{return await r.json()}catch{return{}}},"safeJson"),be=i(r=>r.error?.metadata||r.details?.metadata||{},"errorMetadata"),ce=i((r,e)=>{let t=r.error?.code||"TRANSPORT",s=r.error?.message||t,o=be(r),n={code:t,metadata:o,status:e};switch(t){case"PBSV_EXPIRED":return new v(s,n);case"PBSV_INVALID":case"UNAUTHENTICATED":return new P(s,n);case"PBSV_PID_MISMATCH":return new _(s,n);case"CONSENT_REQUIRED":return new T(s,n);case"INSUFFICIENT_CREDITS":return new S(s,n);case"FUNCTION_NOT_FOUND":return new w(s,n);case"FUNCTION_DISABLED":return new C(s,n);case"RESOURCE_EXHAUSTED":return new A(s,n);case"EXECUTION_FAILED":return new G(s,n);default:return new g(s,n)}},"mapUdfErrorResponse"),je=i(r=>{if(!f||!x||r.origin!==x||r.source!==f.parent||!r.data||typeof r.data!="object")return;let e=r.data;if(e.type===me){typeof e.token=="string"&&e.token.length>0&&(q=e.token,y=ae(e.token));return}if(e.type!==ye||typeof e.request_id!="string")return;let t=I.get(e.request_id);t&&(clearTimeout(t.timer),I.delete(e.request_id),t.resolve(e.granted===!0?"granted":"denied"))},"onMessage"),De=i(()=>globalThis.crypto?.randomUUID?globalThis.crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2)}`,"randomRequestId"),Me=i(()=>{if(!y)return null;let r=Number(y);return Number.isSafeInteger(r)?r:null},"playbookIdForInvoke"),Oe=i(async(r,e)=>{if(!f||!x)return"denied";let t=x,s=De();return new Promise(o=>{let n=setTimeout(()=>{I.delete(s),o("timeout")},Ue);I.set(s,{resolve:o,timer:n}),f?.parent.postMessage({type:_e,request_id:s,playbook_id:r,min_allowance:e},t)})},"requestConsent"),le=i(async(r,e,t=!1)=>{let s=b();if(!s)throw new k;if(!y)throw new _("Missing playbook id.",{code:"PBSV_PID_MISMATCH"});let o=Me();if(!o)throw new _("Invalid playbook id.",{code:"PBSV_PID_MISMATCH"});let n;try{n=await fetch(`${ne}/api/v1/service/invoke`,{method:"POST",headers:{Authorization:`Bearer ${s}`,"X-Pbsv":"1","Content-Type":"application/json"},body:JSON.stringify({playbook_id:o,function_name:r,parameters_json:JSON.stringify(e)})})}catch{throw new g("Network error while invoking UDF.",{code:"TRANSPORT"})}let a=await he(n);if(n.ok)return a.result;if(a.error?.code==="CONSENT_REQUIRED"&&!t){let c=be(a),u=typeof c.playbook_id=="string"?c.playbook_id:y,h=typeof c.min_allowance_suggested=="number"?c.min_allowance_suggested:1,d=await Oe(u,h);if(d==="granted")return le(r,e,!0);throw d==="timeout"?new E:new R}throw ce(a,n.status)},"call"),Le=i(async()=>{let r=b();if(!r)throw new k;if(!y)throw new _("Missing playbook id.",{code:"PBSV_PID_MISMATCH"});let e=new URL(`${ne}/api/v1/service/functions`);e.searchParams.set("playbook_id",y);let t=await fetch(e.toString(),{headers:{Authorization:`Bearer ${r}`,"X-Pbsv":"1"}}),s=await he(t);if(!t.ok)throw ce(s,t.status);let o=s.functions;return Array.isArray(o)?o:[]},"list"),oe=i((r,e,t)=>{r.dispatchEvent(new CustomEvent(e,{bubbles:!0,detail:t}))},"dispatchButtonEvent"),$e=i(r=>{if(typeof r!="string")return r;let t=f?.document?.querySelector(r);if(t&&"appendChild"in t)return t;throw new Error(`UDF button target not found: ${r}`)},"resolveButtonTarget"),Be=i((r,e)=>{if(!f)throw new Error("Playbook runtime is not installed.");let t=$e(r),s=f.document.createElement("button"),o=e.label||e.functionName,n=e.loadingLabel||"Running...",a=e.disabledLabel||"Sign in to run";return s.type="button",s.className="alva-udf-button",s.textContent=b()?o:a,s.disabled=!b(),s.setAttribute("data-function-name",e.functionName),s.disabled&&s.setAttribute("aria-disabled","true"),s.addEventListener("click",async()=>{if(!s.disabled){s.disabled=!0,s.textContent=n,oe(s,"alva:udf-button:loading",{functionName:e.functionName});try{let c=await le(e.functionName,e.params??{});oe(s,"alva:udf-button:result",{functionName:e.functionName,result:c})}catch(c){oe(s,"alva:udf-button:error",{functionName:e.functionName,error:c})}finally{s.disabled=!b(),s.textContent=s.disabled?a:o}}}),t.appendChild(s),s},"renderButton"),ke={call:le,list:Le,getViewerToken:b,renderButton:Be,UdfError:l,UdfAuthRequiredError:k,UdfTokenExpiredError:v,UdfTokenInvalidError:P,UdfPidMismatchError:_,UdfConsentRequiredError:T,UdfConsentDeniedError:R,UdfConsentTimeoutError:E,UdfInsufficientCredits:S,UdfFunctionNotFoundError:w,UdfFunctionDisabledError:C,UdfRateLimitedError:A,UdfExecutionError:G,UdfTransportError:g},pe=i(r=>{let e=r??(typeof window>"u"?void 0:window);if(!e||de)return;f=e,de=!0,Fe(e),e.addEventListener("message",je);let t=e,s=t.alva||{};t.alva={...s,udf:ke}},"installPlaybookRuntime");var p=class extends Error{static{i(this,"AlvaError")}code;status;constructor(e,t,s){super(t),this.name="AlvaError",this.code=e,this.status=s}};var N=class{constructor(e){this.client=e}client;static{i(this,"FsResource")}async read(e){let t=await this.client._request("GET","/api/v1/fs/read",{query:{path:e.path,offset:e.offset,size:e.size}});if(!(t instanceof ArrayBuffer))return t;try{let s=new TextDecoder("utf-8",{fatal:!0}).decode(t);try{return JSON.parse(s)}catch{return s}}catch{return t}}async write(e){return this.client._requireAuth(),this.client._request("POST","/api/v1/fs/write",{body:{path:e.path,data:e.data,mkdir_parents:e.mkdir_parents}})}async rawWrite(e){return this.client._requireAuth(),this.client._request("POST","/api/v1/fs/write",{query:{path:e.path,mkdir_parents:e.mkdir_parents},rawBody:e.body})}async stat(e){return this.client._requireAuth(),this.client._request("GET","/api/v1/fs/stat",{query:{path:e.path}})}async readdir(e){return this.client._requireAuth(),this.client._request("GET","/api/v1/fs/readdir",{query:{path:e.path,recursive:e.recursive}})}async mkdir(e){this.client._requireAuth(),await this.client._request("POST","/api/v1/fs/mkdir",{body:{path:e.path}})}async remove(e){this.client._requireAuth(),await this.client._request("DELETE","/api/v1/fs/remove",{query:{path:e.path,recursive:e.recursive}})}async rename(e){this.client._requireAuth(),await this.client._request("POST","/api/v1/fs/rename",{body:{old_path:e.old_path,new_path:e.new_path}})}async copy(e){this.client._requireAuth(),await this.client._request("POST","/api/v1/fs/copy",{body:{src_path:e.src_path,dst_path:e.dst_path}})}async symlink(e){this.client._requireAuth(),await this.client._request("POST","/api/v1/fs/symlink",{body:{target_path:e.target_path,link_path:e.link_path}})}async readlink(e){return this.client._requireAuth(),this.client._request("GET","/api/v1/fs/readlink",{query:{path:e.path}})}async chmod(e){this.client._requireAuth(),await this.client._request("POST","/api/v1/fs/chmod",{body:{path:e.path,mode:e.mode}})}async grant(e){this.client._requireAuth(),await this.client._request("POST","/api/v1/fs/grant",{body:{path:e.path,subject:e.subject,permission:e.permission}})}async revoke(e){this.client._requireAuth(),await this.client._request("POST","/api/v1/fs/revoke",{body:{path:e.path,subject:e.subject,permission:e.permission}})}};var F=class{constructor(e){this.client=e}client;static{i(this,"RunResource")}async execute(e){return this.client._requireAuth(),this.client._request("POST","/api/v1/run",{body:{code:e.code,entry_path:e.entry_path,working_dir:e.working_dir,args:e.args,max_heap_size_mb:e.max_heap_size_mb}})}};var j=class{constructor(e){this.client=e}client;static{i(this,"DeployResource")}async create(e){return this.client._requireAuth(),this.client._request("POST","/api/v1/deploy/cronjob",{body:{name:e.name,path:e.path,cron_expression:e.cron_expression,args:e.args,push_notify:e.push_notify}})}async list(e){return this.client._requireAuth(),this.client._request("GET","/api/v1/deploy/cronjobs",{query:{limit:e?.limit,cursor:e?.cursor}})}async get(e){return this.client._requireAuth(),this.client._request("GET",`/api/v1/deploy/cronjob/${e.id}`)}async update(e){this.client._requireAuth();let{id:t,...s}=e;return this.client._request("PATCH",`/api/v1/deploy/cronjob/${t}`,{body:s})}async delete(e){this.client._requireAuth(),await this.client._request("DELETE",`/api/v1/deploy/cronjob/${e.id}`)}async pause(e){this.client._requireAuth(),await this.client._request("POST",`/api/v1/deploy/cronjob/${e.id}/pause`)}async resume(e){this.client._requireAuth(),await this.client._request("POST",`/api/v1/deploy/cronjob/${e.id}/resume`)}async trigger(e){return this.client._requireAuth(),this.client._request("POST",`/api/v1/deploy/cronjob/${e.id}/trigger`)}async listRuns(e){return this.client._requireAuth(),this.client._request("GET",`/api/v1/deploy/cronjob/${e.cronjob_id}/runs`,{query:{first:e.first,cursor:e.cursor}})}async getRunLogs(e){return this.client._requireAuth(),this.client._request("GET",`/api/v1/deploy/cronjob/${e.cronjob_id}/runs/${e.run_id}/logs`)}};var D=class{constructor(e){this.client=e}client;static{i(this,"ReleaseResource")}async feed(e){return this.client._requireAuth(),this.client._request("POST","/api/v1/release/feed",{body:{name:e.name,version:e.version,cronjob_id:e.cronjob_id,view_json:e.view_json,description:e.description,changelog:e.changelog}})}async playbookDraft(e){return this.client._requireAuth(),this.client._request("POST","/api/v1/draft/playbook",{body:{name:e.name,display_name:e.display_name,description:e.description,feeds:e.feeds,trading_symbols:e.trading_symbols,skill_id:e.skill_id,tags:e.tags}})}async playbook(e){return this.client._requireAuth(),this.client._request("POST","/api/v1/release/playbook",{body:{name:e.name,version:e.version,feeds:e.feeds,changelog:e.changelog,readme_url:e.readme_url}})}};var M=class{constructor(e){this.client=e}client;static{i(this,"FeedResource")}async delete(e){if(this.client._requireAuth(),!Number.isInteger(e.id)||e.id<=0)throw new Error("feed id must be a positive integer");return this.client._request("DELETE",`/api/v1/feed/${encodeURIComponent(String(e.id))}`)}};var O=class{constructor(e){this.client=e}client;static{i(this,"PlaybooksResource")}async trending(e={}){let t={};e.cursor&&(t.cursor=e.cursor),e.current&&(t.current=e.current),e.limit!==void 0&&(t.limit=e.limit),e.dir&&(t.dir=e.dir),e.sort&&(t.sort=e.sort),e.keyword&&(t.keyword=e.keyword),e.tags&&e.tags.length>0&&(t.tags=e.tags.join(","));let s=await this.client._request("GET","/api/v1/playbooks/trending",{query:t});return{playbooks:(s.playbooks??[]).map(We),has_next:s.has_next??!1}}};function We(r){let e=r.creator?.name??"",t=r.name??"",s=e&&t?`${e}/${t}`:t;return{id:r.id===void 0?"":String(r.id),ref:s,username:e,name:t,display_name:r.display_name??"",description:r.description??"",tags:r.tags??[],follow_count:r.follow_count??0,url_path:e&&t?`/${e}/playbooks/${t}`:"",...r.readme?{readme:r.readme}:{},cursor:r.cursor??""}}i(We,"toAgentPlaybook");var L=class{constructor(e){this.client=e}client;static{i(this,"SecretsResource")}async create(e){this.client._requireAuth(),await this.client._request("POST","/api/v1/secrets",{body:{name:e.name,value:e.value}})}async list(){return this.client._requireAuth(),this.client._request("GET","/api/v1/secrets")}async get(e){this.client._requireAuth();let t=encodeURIComponent(e.name);return this.client._request("GET",`/api/v1/secrets/${t}`)}async update(e){this.client._requireAuth();let t=encodeURIComponent(e.name);await this.client._request("PUT",`/api/v1/secrets/${t}`,{body:{value:e.value}})}async delete(e){this.client._requireAuth();let t=encodeURIComponent(e.name);await this.client._request("DELETE",`/api/v1/secrets/${t}`)}};var $=class{constructor(e){this.client=e}client;static{i(this,"SdkDocsResource")}async doc(e){return this.client._requireAuth(),this.client._request("GET","/api/v1/sdk/doc",{query:{name:e.name}})}async partitions(){return this.client._requireAuth(),this.client._request("GET","/api/v1/sdk/partitions")}async partitionSummary(e){this.client._requireAuth();let t=encodeURIComponent(e.partition);return this.client._request("GET",`/api/v1/sdk/partitions/${t}/summary`)}};var ge=[{skill:"arrays-data-api-crypto-futures-data",file:"binance-perp-usdt-kline",method:"GET",path:"/api/v1/crypto/binance/perp/usdt/kline",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-spot-market-price-and-volume",file:"binance-spot-usdt-kline",method:"GET",path:"/api/v1/crypto/binance/spot/usdt/kline",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-spot-market-price-and-volume",file:"crypto-detail",method:"GET",path:"/api/v1/crypto/detail",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-crypto-metrics-and-screener",file:"fear-greed-index",method:"GET",path:"/api/v1/crypto/fear-greed-index",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-crypto-futures-data",file:"funding-rate",method:"GET",path:"/api/v1/crypto/funding-rate",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-crypto-futures-data",file:"hyperliquid-perp-usdc-kline",method:"GET",path:"/api/v1/crypto/hyperliquid/perp/usdc/kline",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-spot-market-price-and-volume",file:"hyperliquid-spot-usdc-kline",method:"GET",path:"/api/v1/crypto/hyperliquid/spot/usdc/kline",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-crypto-metrics-and-screener",file:"list",method:"GET",path:"/api/v1/crypto/list",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-crypto-futures-data",file:"long-short-ratio",method:"GET",path:"/api/v1/crypto/long-short-ratio",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-crypto-metrics-and-screener",file:"crypto-market-cap",method:"GET",path:"/api/v1/crypto/market-cap",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-crypto-metrics-and-screener",file:"market-metrics",method:"GET",path:"/api/v1/crypto/market-metrics",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-crypto-futures-data",file:"open-interest",method:"GET",path:"/api/v1/crypto/open-interest",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-crypto-metrics-and-screener",file:"screener-metrics",method:"GET",path:"/api/v1/crypto/screener/metrics",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-crypto-metrics-and-screener",file:"screener-metrics-timerange",method:"GET",path:"/api/v1/crypto/screener/metrics/timerange",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-crypto-metrics-and-screener",file:"trading-pair",method:"GET",path:"/api/v1/crypto/trading-pair",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-etf-fundamentals",file:"country-weightings",method:"GET",path:"/api/v1/etf/country-weightings",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-etf-fundamentals",file:"holdings",method:"GET",path:"/api/v1/etf/holdings",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-etf-fundamentals",file:"info",method:"GET",path:"/api/v1/etf/info",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-etf-fundamentals",file:"sector-weightings",method:"GET",path:"/api/v1/etf/sector-weightings",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-macro-and-economics",file:"macro-commodity-historical",method:"GET",path:"/api/v1/macro/commodity/historical",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-macro-and-economics",file:"macro-commodity-real-time",method:"GET",path:"/api/v1/macro/commodity/real-time",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-macro-and-economics",file:"macro-commodity-symbol-list",method:"GET",path:"/api/v1/macro/commodity/symbols",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-macro-and-economics",file:"economic-indicators",method:"GET",path:"/api/v1/macro/economic-indicators",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-macro-and-economics",file:"macro-forex-historical",method:"GET",path:"/api/v1/macro/forex/historical",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-macro-and-economics",file:"macro-forex-real-time",method:"GET",path:"/api/v1/macro/forex/real-time",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-macro-and-economics",file:"macro-forex-symbol-list",method:"GET",path:"/api/v1/macro/forex/symbols",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-macro-and-economics",file:"macro-index-historical",method:"GET",path:"/api/v1/macro/index/historical",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-macro-and-economics",file:"macro-index-real-time",method:"GET",path:"/api/v1/macro/index/real-time",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-macro-and-economics",file:"rates",method:"GET",path:"/api/v1/macro/treasury-rates",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-equity-fundamentals",file:"company-balance-sheets",method:"GET",path:"/api/v1/stocks/company/balance-sheets",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-equity-fundamentals",file:"company-cashflow-statements",method:"GET",path:"/api/v1/stocks/company/cashflow-statements",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-equity-fundamentals",file:"company-detail",method:"GET",path:"/api/v1/stocks/company/detail",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-equity-fundamentals",file:"company-income-statements",method:"GET",path:"/api/v1/stocks/company/income-statements",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-equity-fundamentals",file:"company-kpi",method:"GET",path:"/api/v1/stocks/company/kpi",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-equity-events",file:"crowdfunding-offerings",method:"GET",path:"/api/v1/stocks/crowdfunding/offerings",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-equity-events",file:"dividends",method:"GET",path:"/api/v1/stocks/dividends",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-equity-events",file:"earnings-calendar",method:"GET",path:"/api/v1/stocks/earnings-calendar",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-equity-events",file:"equity-offering",method:"GET",path:"/api/v1/stocks/equity-offering",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-stock-metrics",file:"financial-metrics",method:"GET",path:"/api/v1/stocks/financial-metrics",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-equity-fundamentals",file:"fiscal-dates",method:"GET",path:"/api/v1/stocks/fiscal-dates",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-equity-fundamentals",file:"fiscal-dates-range",method:"GET",path:"/api/v1/stocks/fiscal-dates/range",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-equity-events",file:"ipo-calendar",method:"GET",path:"/api/v1/stocks/ipo-calendar",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-equity-events",file:"ipo-confirmed-calendar",method:"GET",path:"/api/v1/stocks/ipo-confirmed-calendar",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-spot-market-price-and-volume",file:"stocks-kline",method:"GET",path:"/api/v1/stocks/kline",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-stock-metrics",file:"market-metrics",method:"GET",path:"/api/v1/stocks/market-metrics",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-equity-events",file:"mergers-acquisitions",method:"GET",path:"/api/v1/stocks/mergers-acquisitions",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-equity-fundamentals",file:"outstanding-shares",method:"GET",path:"/api/v1/stocks/outstanding-shares",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-stock-metrics",file:"ratings",method:"GET",path:"/api/v1/stocks/ratings",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-stock-screener",file:"basic-info-screener",method:"GET",path:"/api/v1/stocks/screener/basic-info/{sub}",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-stock-screener",file:"event-screener",method:"GET",path:"/api/v1/stocks/screener/events",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-stock-screener",file:"screener-financial-metrics",method:"GET",path:"/api/v1/stocks/screener/financial-metrics",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-stock-screener",file:"screener-financial-metrics-timerange",method:"GET",path:"/api/v1/stocks/screener/financial-metrics/timerange",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-stock-screener",file:"screener-technical-metrics",method:"GET",path:"/api/v1/stocks/screener/technical-metrics",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-stock-screener",file:"screener-technical-metrics-timerange",method:"GET",path:"/api/v1/stocks/screener/technical-metrics/timerange",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-equity-events",file:"sec-earnings-release",method:"GET",path:"/api/v1/stocks/sec-earnings-release",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-equity-fundamentals",file:"shares-float",method:"GET",path:"/api/v1/stocks/shares-float",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-equity-events",file:"splits",method:"GET",path:"/api/v1/stocks/splits",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-crypto-exchange-flow",file:"exchange-flows",method:"GET",path:"/api/v1/crypto/exchange-flows",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-company-crypto-holdings",file:"crypto-holdings",method:"GET",path:"/api/v1/crypto/holdings",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-crypto-metrics-and-screener",file:"metrics-inflow-cdd",method:"GET",path:"/api/v1/crypto/metrics/inflow-cdd",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-crypto-metrics-and-screener",file:"metrics-leverage-ratio",method:"GET",path:"/api/v1/crypto/metrics/leverage-ratio",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-crypto-metrics-and-screener",file:"metrics-miner-to-exchange",method:"GET",path:"/api/v1/crypto/metrics/miner-to-exchange",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-crypto-metrics-and-screener",file:"metrics-mvrv",method:"GET",path:"/api/v1/crypto/metrics/mvrv",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-crypto-metrics-and-screener",file:"metrics-nupl",method:"GET",path:"/api/v1/crypto/metrics/nupl",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-crypto-metrics-and-screener",file:"metrics-puell-multiple",method:"GET",path:"/api/v1/crypto/metrics/puell-multiple",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-crypto-metrics-and-screener",file:"metrics-realized-price",method:"GET",path:"/api/v1/crypto/metrics/realized-price",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-crypto-metrics-and-screener",file:"metrics-sopr",method:"GET",path:"/api/v1/crypto/metrics/sopr",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-crypto-metrics-and-screener",file:"metrics-ssr",method:"GET",path:"/api/v1/crypto/metrics/ssr",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-crypto-metrics-and-screener",file:"metrics-whale-ratio",method:"GET",path:"/api/v1/crypto/metrics/whale-ratio",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-crypto-metrics-and-screener",file:"crypto-supply",method:"GET",path:"/api/v1/crypto/supply",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-crypto-futures-data",file:"taker-buy-sell-volume",method:"GET",path:"/api/v1/crypto/taker-buy-sell-volume",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-crypto-metrics-and-screener",file:"unlock-events",method:"GET",path:"/api/v1/crypto/unlock-events",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-etf-fundamentals",file:"flow",method:"GET",path:"/api/v1/etf/flow",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-options",file:"contracts",method:"GET",path:"/api/v1/options/contracts",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-options",file:"kline",method:"GET",path:"/api/v1/options/kline",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-equity-fundamentals",file:"company-executives",method:"GET",path:"/api/v1/stocks/company/executives",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-equity-estimates-and-targets",file:"company-price-target-consensus",method:"GET",path:"/api/v1/stocks/company/price-target-consensus",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-equity-estimates-and-targets",file:"company-price-target-news",method:"GET",path:"/api/v1/stocks/company/price-target-news",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-equity-estimates-and-targets",file:"company-price-target-summary",method:"GET",path:"/api/v1/stocks/company/price-target-summary",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-equity-ownership-and-flow",file:"congress-recent-trades",method:"GET",path:"/api/v1/stocks/congress/recent-trades",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-stock-metrics",file:"darkpool",method:"GET",path:"/api/v1/stocks/darkpool",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-equity-estimates-and-targets",file:"estimates-guidance",method:"GET",path:"/api/v1/stocks/estimates-guidance",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-equity-ownership-and-flow",file:"insider-transactions",method:"GET",path:"/api/v1/stocks/insider/transactions",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-equity-ownership-and-flow",file:"institution-holder",method:"GET",path:"/api/v1/stocks/institution-holder",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-polymarket",file:"activity",method:"GET",path:"polymarket:/activity",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-polymarket",file:"book",method:"GET",path:"polymarket:/book",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-polymarket",file:"closed-positions",method:"GET",path:"polymarket:/closed-positions",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-polymarket",file:"events",method:"GET",path:"polymarket:/events",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-polymarket",file:"holders",method:"GET",path:"polymarket:/holders",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-polymarket",file:"markets",method:"GET",path:"polymarket:/markets",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-polymarket",file:"midpoint",method:"GET",path:"polymarket:/midpoint",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-polymarket",file:"oi",method:"GET",path:"polymarket:/oi",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-polymarket",file:"positions",method:"GET",path:"polymarket:/positions",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-polymarket",file:"price",method:"GET",path:"polymarket:/price",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-polymarket",file:"prices-history",method:"GET",path:"polymarket:/prices-history",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-polymarket",file:"public-search",method:"GET",path:"polymarket:/public-search",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-polymarket",file:"series",method:"GET",path:"polymarket:/series",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-polymarket",file:"sports",method:"GET",path:"polymarket:/sports",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-polymarket",file:"spread",method:"GET",path:"polymarket:/spread",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-polymarket",file:"tags",method:"GET",path:"polymarket:/tags",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-polymarket",file:"trades",method:"GET",path:"polymarket:/trades",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-polymarket",file:"value",method:"GET",path:"polymarket:/value",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-equity-events",file:"earnings-transcript",method:"GET",path:"/api/v1/stocks/earnings-transcript",tier:"unstructured",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-news",file:"market-news",method:"GET",path:"/api/v1/stocks/market-news",tier:"unstructured",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-social-feeds",file:"x-by-handle",method:"GET",path:"/api/v1/social-feeds/x/by-handle",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-social-feeds",file:"x-by-url",method:"GET",path:"/api/v1/social-feeds/x/by-url",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-social-feeds",file:"x-entities-handle",method:"GET",path:"/api/v1/social-feeds/x/entities/handle/{twitter_handle}",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0},{skill:"arrays-data-api-social-feeds",file:"x-entities-handles",method:"GET",path:"/api/v1/social-feeds/x/entities/handles",tier:"alternative",required_subscription_tier:"pro",access:"pro_only",pro_required:!0}];function qe(r,e){return ge.find(t=>t.skill===r&&t.file===e)}i(qe,"getSkillEndpointMetadata");function ue(r){return ge.filter(e=>e.skill===r)}i(ue,"listSkillEndpointMetadata");var B=class{constructor(e){this.client=e}client;static{i(this,"DataSkillsResource")}async list(){return{skills:((await this.client._request("GET","/api/v1/skills",{baseUrl:this.client.arraysBaseUrl,noAuth:!0})).data??[]).map(t=>({...t,...ve(t.name)}))}}async summary(e){let t=encodeURIComponent(e.name),o=(await this.client._request("GET",`/api/v1/skills/${t}`,{baseUrl:this.client.arraysBaseUrl,noAuth:!0})).data?.[0];if(!o)throw new Error(`empty skills summary response for "${e.name}"`);let n=ue(e.name);return{...o,...ve(e.name),...n.length>0?{endpoint_metadata:n}:{}}}async endpoint(e){let t=encodeURIComponent(e.name),o=(await this.client._request("GET",`/api/v1/skills/${t}`,{baseUrl:this.client.arraysBaseUrl,noAuth:!0,query:{endpoint:e.file}})).data?.[0];if(!o)throw new Error(`empty skills endpoint response for "${e.name}" file "${e.file}"`);let n=qe(e.name,e.file);return{...o,...n?{metadata:n}:{}}}};function ve(r){let e=ue(r);if(e.length===0)return{};let t={},s=0;for(let o of e)t[o.tier]=(t[o.tier]??0)+1,o.pro_required&&(s+=1);return{endpoint_tier_counts:t,metadata:{endpoint_count:e.length,endpoint_tier_counts:t,pro_count:s}}}i(ve,"metadataSummaryForSkill");function Pe(r){let e=r.split("/");if(e.length!==2||!e[0]||!e[1])throw new p("INVALID_ARGUMENT",`playbook skill identifier must be "<user>/<name>", got "${r}"`,0);return{username:e[0],name:e[1]}}i(Pe,"parsePlaybookSkillId");var W=class{constructor(e){this.client=e}client;static{i(this,"PlaybookSkillsResource")}async list(e){let t={};return e?.tag&&(t.tag=e.tag),e?.username&&(t.username=e.username),{skills:(await this.client._request("GET","/api/v1/skills",{query:t})).data??[]}}async tags(){return{tags:(await this.client._request("GET","/api/v1/skills/tags")).data??[]}}async get(e){let{username:t,name:s}=Pe(e),o=encodeURIComponent(t),n=encodeURIComponent(s),c=(await this.client._request("GET",`/api/v1/skills/${o}/${n}`)).data?.[0];if(!c)throw new p("NOT_FOUND",`empty playbook skills get response for ${e}`,0);return c}async file(e,t){let{username:s,name:o}=Pe(e),n=encodeURIComponent(s),a=encodeURIComponent(o),c=t.split("/").map(encodeURIComponent).join("/"),h=(await this.client._request("GET",`/api/v1/skills/${n}/${a}/files/${c}`)).data?.[0];if(!h)throw new p("NOT_FOUND",`empty playbook skills file response for ${e} path ${t}`,0);return h}};var H=class{constructor(e){this.client=e}client;static{i(this,"CommentsResource")}async create(e){return this.client._requireAuth(),this.client._request("POST","/api/v1/playbook/comment",{body:{username:e.username,name:e.name,content:e.content,parent_id:e.parent_id}})}async pin(e){return this.client._requireAuth(),this.client._request("POST","/api/v1/playbook/comment/pin",{body:{comment_id:e.comment_id}})}async unpin(e){return this.client._requireAuth(),this.client._request("POST","/api/v1/playbook/comment/unpin",{body:{comment_id:e.comment_id}})}};var V=class{constructor(e){this.client=e}client;static{i(this,"RemixResource")}async save(e){this.client._requireAuth(),await this.client._request("POST","/api/v1/remix",{body:{child:e.child,parents:e.parents}})}};var J=class{constructor(e){this.client=e}client;static{i(this,"ScreenshotResource")}async capture(e){return this.client._requireAuth(),this.client._request("GET","/api/v1/screenshot",{query:{url:e.url,selector:e.selector,xpath:e.xpath,compress:e.compress,compress_quality:e.compressQuality,compress_max_width:e.compressMaxWidth}})}};var K=class{constructor(e){this.client=e}client;static{i(this,"UserResource")}async me(){return this.client._requireAuth(),this.client._request("GET","/api/v1/me")}};var X=class{constructor(e){this.client=e}client;static{i(this,"TradingResource")}async accounts(){return this.client._requireAuth(),this.client._request("GET","/api/v1/trading/accounts")}async portfolio(e){return this.client._requireAuth(),this.client._request("GET","/api/v1/trading/portfolio",{query:{accountId:e}})}async orders(e){return this.client._requireAuth(),this.client._request("GET","/api/v1/trading/orders",{query:{accountId:e.accountId,source:e.source,since:e.since,limit:e.limit}})}async subscriptions(e){return this.client._requireAuth(),this.client._request("GET","/api/v1/trading/subscriptions",{query:{accountId:e}})}async equityHistory(e){return this.client._requireAuth(),this.client._request("GET","/api/v1/trading/equity-history",{query:{accountId:e.accountId,timeframe:e.timeframe,sinceMs:e.sinceMs,untilMs:e.untilMs}})}async riskRules(){return this.client._requireAuth(),this.client._request("GET","/api/v1/trading/risk-rules")}async subscribe(e){return this.client._requireAuth(),this.client._request("POST","/api/v1/trading/subscribe",{body:e})}async unsubscribe(e){return this.client._requireAuth(),this.client._request("POST","/api/v1/trading/unsubscribe",{body:{subscriptionId:e}})}async execute(e){return this.client._requireAuth(),this.client._request("POST","/api/v1/trading/execute",{body:e})}async updateRiskRules(e){return this.client._requireAuth(),this.client._request("PUT","/api/v1/trading/risk-rules",{body:e})}};var z=class{constructor(e){this.client=e}client;static{i(this,"PortfolioResource")}async accounts(){return this.client._requireAuth(),this.client._request("GET","/api/v1/portfolio/accounts")}async summary(e){return this.client._requireAuth(),this.client._request("GET","/api/v1/portfolio/summary",{query:{accountId:e}})}async activities(e){return this.client._requireAuth(),this.client._request("GET","/api/v1/portfolio/activities",{query:{accountId:e.accountId,limit:e.limit,pageToken:e.pageToken}})}};var Q=class{constructor(e){this.client=e}client;static{i(this,"ArraysJwtResource")}async ensure(){return this.client._requireAuth(),this.client._request("POST","/api/v1/arrays-jwt/ensure")}async status(){return this.client._requireAuth(),this.client._request("GET","/api/v1/arrays-jwt/status")}};var Y=class{constructor(e){this.client=e}client;static{i(this,"NotificationsResource")}async listPlaybook(e){this.client._requireAuth();let t=`/api/v1/playbook/${encodeURIComponent(e.username)}/${encodeURIComponent(e.name)}/notifications`;return this.client._request("GET",t,{query:Te(e)})}async listFeed(e){this.client._requireAuth();let t=`/api/v1/feed/${encodeURIComponent(e.username)}/${encodeURIComponent(e.name)}/notifications`;return this.client._request("GET",t,{query:Te(e)})}};function Te(r){let e={};return r.channel&&(e.channel=r.channel),r.status&&(e.status=r.status),r.since_time!==void 0&&r.since_time>0&&(e.since_time=String(r.since_time)),r.first!==void 0&&r.first>0&&(e.first=String(r.first)),r.cursor&&(e.cursor=r.cursor),e}i(Te,"buildQuery");var Z=class{constructor(e){this.client=e}client;static{i(this,"NotificationPreferencesResource")}async list(){return this.client._requireAuth(),this.client._request("GET","/api/v1/me/notifications/preferences")}async update(e){return this.client._requireAuth(),this.client._request("PATCH",`/api/v1/me/notifications/preferences/${encodeURIComponent(e.key)}`,{body:{enabled:e.enabled}})}};var ee=class{constructor(e){this.client=e}client;static{i(this,"PushSubscriptionsResource")}async subscribePlaybook(e){this.client._requireAuth();let t=`/api/v1/push-subscriptions/playbook/${encodeURIComponent(e.username)}/${encodeURIComponent(e.name)}`;return this.client._request("POST",t)}async unsubscribePlaybook(e){this.client._requireAuth();let t=`/api/v1/push-subscriptions/playbook/${encodeURIComponent(e.username)}/${encodeURIComponent(e.name)}`;return this.client._request("DELETE",t)}async subscribeFeed(e){this.client._requireAuth();let t=`/api/v1/push-subscriptions/feed/${encodeURIComponent(e.username)}/${encodeURIComponent(e.name)}`;return this.client._request("POST",t)}async unsubscribeFeed(e){this.client._requireAuth();let t=`/api/v1/push-subscriptions/feed/${encodeURIComponent(e.username)}/${encodeURIComponent(e.name)}`;return this.client._request("DELETE",t)}async list(e={}){this.client._requireAuth();let t={};return e.first!==void 0&&e.first>0&&(t.first=String(e.first)),e.cursor&&(t.cursor=e.cursor),this.client._request("GET","/api/v1/me/push-subscriptions",{query:t})}};var re=class{constructor(e){this.client=e}client;static{i(this,"ChannelGroupSubscriptionsResource")}async context(e){return this.client._requireAuth(),this.client._request("GET","/api/v1/channel/group-subscriptions/context",{query:{session_id:e.session_id}})}async list(e){return this.client._requireAuth(),this.client._request("GET","/api/v1/channel/group-subscriptions",{query:{session_id:e.session_id}})}async subscribe(e){return this.client._requireAuth(),this.client._request("POST","/api/v1/channel/group-subscriptions",{jsonBody:Re(e)})}async unsubscribe(e){return this.client._requireAuth(),this.client._request("DELETE","/api/v1/channel/group-subscriptions",{jsonBody:Re(e)})}};function Re(r){return`{"session_id":${Ee(r.session_id)},"target_type":${JSON.stringify(r.target_type)},"target_id":${Ee(r.target_id)}}`}i(Re,"mutationBody");function Ee(r){if(typeof r=="number"){if(!Number.isInteger(r)||r<=0||!Number.isSafeInteger(r))throw new p("INVALID_ARGUMENT","channel group subscription ids must be positive safe integers; pass large int64 ids as strings",0);return String(r)}if(!/^[1-9]\d*$/.test(r))throw new p("INVALID_ARGUMENT","channel group subscription ids must be positive integer strings",0);return r}i(Ee,"idLiteral");var He="https://api-llm.prd.alva.ai",Ve="https://data-tools.prd.space.id",te=class{static{i(this,"AlvaClient")}baseUrl;arraysBaseUrl;viewer_token;pbsvToken;apiKey;gaClientId;gaSessionId;utmParams;_fs;_run;_deploy;_release;_feed;_playbooks;_secrets;_sdk;_dataSkills;_playbookSkills;_comments;_remix;_screenshot;_user;_trading;_portfolio;_arraysJwt;_notifications;_notificationPreferences;_pushSubscriptions;_channelGroupSubscriptions;constructor(e){this.baseUrl=e.baseUrl??He,this.arraysBaseUrl=e.arraysBaseUrl??Ve,this.viewer_token=e.viewer_token,this.pbsvToken=e.pbsvToken,this.apiKey=e.apiKey,this.gaClientId=e.gaClientId,this.gaSessionId=e.gaSessionId,this.utmParams=e.utmParams}get fs(){return this._fs??=new N(this)}get run(){return this._run??=new F(this)}get deploy(){return this._deploy??=new j(this)}get release(){return this._release??=new D(this)}get feed(){return this._feed??=new M(this)}get playbooks(){return this._playbooks??=new O(this)}get secrets(){return this._secrets??=new L(this)}get sdk(){return this._sdk??=new $(this)}get dataSkills(){return this._dataSkills??=new B(this)}get playbookSkills(){return this._playbookSkills??=new W(this)}get comments(){return this._comments??=new H(this)}get remix(){return this._remix??=new V(this)}get screenshot(){return this._screenshot??=new J(this)}get user(){return this._user??=new K(this)}get trading(){return this._trading??=new X(this)}get portfolio(){return this._portfolio??=new z(this)}get arraysJwt(){return this._arraysJwt??=new Q(this)}get notifications(){return this._notifications??=new Y(this)}get notificationPreferences(){return this._notificationPreferences??=new Z(this)}get pushSubscriptions(){return this._pushSubscriptions??=new ee(this)}get channelGroupSubscriptions(){return this._channelGroupSubscriptions??=new re(this)}_requireAuth(){if(!this.pbsvToken&&!this.viewer_token&&!this.apiKey)throw new p("UNAUTHENTICATED","Authentication is required. Pass pbsvToken, viewer_token, or apiKey in the constructor.",401)}async _request(e,t,s){let n=`${s?.baseUrl??this.baseUrl}${t}`;if(s?.query){let d=new URLSearchParams;for(let[m,se]of Object.entries(s.query))se!=null&&d.set(m,String(se));let ie=d.toString();ie&&(n+=`?${ie}`)}let a={};s?.noAuth||(this.pbsvToken?(a.Authorization=`Bearer ${this.pbsvToken}`,a["X-Pbsv"]="1"):this.viewer_token?a["x-Playbook-Viewer"]=this.viewer_token:this.apiKey&&(a["X-Alva-Api-Key"]=this.apiKey)),this.gaClientId&&(a["X-Alva-GA-Client-ID"]=this.gaClientId),this.gaSessionId&&(a["X-Alva-GA-Session-ID"]=this.gaSessionId),this.utmParams&&(a["X-Alva-UTM-Params"]=this.utmParams);let c;s?.rawBody!==void 0?(a["Content-Type"]="application/octet-stream",c=s.rawBody):s?.jsonBody!==void 0?(a["Content-Type"]="application/json",c=s.jsonBody):s?.body!==void 0&&(a["Content-Type"]="application/json",c=JSON.stringify(s.body));let u;try{u=await fetch(n,{method:e,headers:a,body:c})}catch(d){throw new p("NETWORK_ERROR",d instanceof Error?d.message:"Network request failed",0)}if(!u.ok){let d=await u.text().catch(()=>"");if((u.headers.get("content-type")??"").includes("application/json")&&d)try{let m=JSON.parse(d);if(m.error)throw new p(m.error.code??"UNKNOWN",m.error.message??`HTTP ${u.status}`,u.status)}catch(m){if(m instanceof p)throw m}throw new p("UNKNOWN",`HTTP ${u.status}: ${d.slice(0,200)}`,u.status)}if(u.status===204)return;let h=u.headers.get("content-type")??"";return h.includes("application/octet-stream")||h.includes("image/")?u.arrayBuffer():u.json()}};var Je="0.9.1";pe();return xe(Ke);})();
2
2
  //# sourceMappingURL=browser.global.js.map