@alva-ai/toolkit 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- "use strict";var AlvaToolkit=(()=>{var x=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var W=Object.prototype.hasOwnProperty;var J=(t,e)=>{for(var r in e)x(t,r,{get:e[r],enumerable:!0})},K=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of B(e))!W.call(t,s)&&s!==r&&x(t,s,{get:()=>e[s],enumerable:!(i=D(e,s))||i.enumerable});return t};var V=t=>K(x({},"__esModule",{value:!0}),t);var X={};J(X,{AlvaClient:()=>A,AlvaError:()=>a,VERSION:()=>Q});var a=class extends Error{code;status;constructor(e,r,i){super(r),this.name="AlvaError",this.code=e,this.status=i}};var m=class{constructor(e){this.client=e}client;async read(e){let r=await this.client._request("GET","/api/v1/fs/read",{query:{path:e.path,offset:e.offset,size:e.size}});if(!(r instanceof ArrayBuffer))return r;try{let i=new TextDecoder("utf-8",{fatal:!0}).decode(r);try{return JSON.parse(i)}catch{return i}}catch{return r}}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 _=class{constructor(e){this.client=e}client;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}})}};var y=class{constructor(e){this.client=e}client;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:r,...i}=e;return this.client._request("PATCH",`/api/v1/deploy/cronjob/${r}`,{body:i})}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 h=class{constructor(e){this.client=e}client;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,template_id:e.template_id}})}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 f=class{constructor(e){this.client=e}client;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 r=encodeURIComponent(e.name);return this.client._request("GET",`/api/v1/secrets/${r}`)}async update(e){this.client._requireAuth();let r=encodeURIComponent(e.name);await this.client._request("PUT",`/api/v1/secrets/${r}`,{body:{value:e.value}})}async delete(e){this.client._requireAuth();let r=encodeURIComponent(e.name);await this.client._request("DELETE",`/api/v1/secrets/${r}`)}};var b=class{constructor(e){this.client=e}client;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 r=encodeURIComponent(e.partition);return this.client._request("GET",`/api/v1/sdk/partitions/${r}/summary`)}};var U=[{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-spot-market-price-and-volume",file:"crypto-futures-ohlcv",method:"GET",path:"/api/v1/crypto/futures/ohlcv",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-spot-market-price-and-volume",file:"crypto-kline",method:"GET",path:"/api/v1/crypto/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-spot-market-price-and-volume",file:"crypto-ohlcv",method:"GET",path:"/api/v1/crypto/ohlcv",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-equity-ownership-and-flow",file:"senate-trade",method:"GET",path:"/api/v1/stocks/company/senate-trade",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}];function M(t,e){return U.find(r=>r.skill===t&&r.file===e)}function F(t){return U.filter(e=>e.skill===t)}var q=class{constructor(e){this.client=e}client;async list(){return{skills:((await this.client._request("GET","/api/v1/skills",{baseUrl:this.client.arraysBaseUrl,noAuth:!0})).data??[]).map(r=>({...r,...I(r.name)}))}}async summary(e){let r=encodeURIComponent(e.name),s=(await this.client._request("GET",`/api/v1/skills/${r}`,{baseUrl:this.client.arraysBaseUrl,noAuth:!0})).data?.[0];if(!s)throw new Error(`empty skills summary response for "${e.name}"`);let n=F(e.name);return{...s,...I(e.name),...n.length>0?{endpoint_metadata:n}:{}}}async endpoint(e){let r=encodeURIComponent(e.name),s=(await this.client._request("GET",`/api/v1/skills/${r}`,{baseUrl:this.client.arraysBaseUrl,noAuth:!0,query:{endpoint:e.file}})).data?.[0];if(!s)throw new Error(`empty skills endpoint response for "${e.name}" file "${e.file}"`);let n=M(e.name,e.file);return{...s,...n?{metadata:n}:{}}}};function I(t){let e=F(t);if(e.length===0)return{};let r={},i=0;for(let s of e)r[s.tier]=(r[s.tier]??0)+1,s.pro_required&&(i+=1);return{endpoint_tier_counts:r,metadata:{endpoint_count:e.length,endpoint_tier_counts:r,pro_count:i}}}function O(t){let e=t.split("/");if(e.length!==2||!e[0]||!e[1])throw new a("INVALID_ARGUMENT",`playbook skill identifier must be "<user>/<name>", got "${t}"`,0);return{username:e[0],name:e[1]}}var k=class{constructor(e){this.client=e}client;async list(e){let r={};return e?.tag&&(r.tag=e.tag),e?.username&&(r.username=e.username),{skills:(await this.client._request("GET","/api/v1/skills",{query:r})).data??[]}}async tags(){return{tags:(await this.client._request("GET","/api/v1/skills/tags")).data??[]}}async get(e){let{username:r,name:i}=O(e),s=encodeURIComponent(r),n=encodeURIComponent(i),p=(await this.client._request("GET",`/api/v1/skills/${s}/${n}`)).data?.[0];if(!p)throw new a("NOT_FOUND",`empty playbook skills get response for ${e}`,0);return p}async file(e,r){let{username:i,name:s}=O(e),n=encodeURIComponent(i),c=encodeURIComponent(s),p=r.split("/").map(encodeURIComponent).join("/"),d=(await this.client._request("GET",`/api/v1/skills/${n}/${c}/files/${p}`)).data?.[0];if(!d)throw new a("NOT_FOUND",`empty playbook skills file response for ${e} path ${r}`,0);return d}};var v=class{constructor(e){this.client=e}client;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 g=class{constructor(e){this.client=e}client;async save(e){this.client._requireAuth(),await this.client._request("POST","/api/v1/remix",{body:{child:e.child,parents:e.parents}})}};var P=class{constructor(e){this.client=e}client;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 T=class{constructor(e){this.client=e}client;async me(){return this.client._requireAuth(),this.client._request("GET","/api/v1/me")}};var R=class{constructor(e){this.client=e}client;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 E=class{constructor(e){this.client=e}client;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 S=class{constructor(e){this.client=e}client;async listPlaybook(e){this.client._requireAuth();let r=`/api/v1/playbook/${encodeURIComponent(e.username)}/${encodeURIComponent(e.name)}/notifications`;return this.client._request("GET",r,{query:L(e)})}async listFeed(e){this.client._requireAuth();let r=`/api/v1/feed/${encodeURIComponent(e.username)}/${encodeURIComponent(e.name)}/notifications`;return this.client._request("GET",r,{query:L(e)})}};function L(t){let e={};return t.channel&&(e.channel=t.channel),t.status&&(e.status=t.status),t.since_time!==void 0&&t.since_time>0&&(e.since_time=String(t.since_time)),t.first!==void 0&&t.first>0&&(e.first=String(t.first)),t.cursor&&(e.cursor=t.cursor),e}var G=class{constructor(e){this.client=e}client;async subscribePlaybook(e){this.client._requireAuth();let r=`/api/v1/push-subscriptions/playbook/${encodeURIComponent(e.username)}/${encodeURIComponent(e.name)}`;return this.client._request("POST",r)}async unsubscribePlaybook(e){this.client._requireAuth();let r=`/api/v1/push-subscriptions/playbook/${encodeURIComponent(e.username)}/${encodeURIComponent(e.name)}`;return this.client._request("DELETE",r)}async subscribeFeed(e){this.client._requireAuth();let r=`/api/v1/push-subscriptions/feed/${encodeURIComponent(e.username)}/${encodeURIComponent(e.name)}`;return this.client._request("POST",r)}async unsubscribeFeed(e){this.client._requireAuth();let r=`/api/v1/push-subscriptions/feed/${encodeURIComponent(e.username)}/${encodeURIComponent(e.name)}`;return this.client._request("DELETE",r)}async list(e={}){this.client._requireAuth();let r={};return e.include_history!==void 0&&(r.include_history=String(e.include_history)),this.client._request("GET","/api/v1/me/push-subscriptions",{query:r})}};var C=class{constructor(e){this.client=e}client;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:$(e)})}async unsubscribe(e){return this.client._requireAuth(),this.client._request("DELETE","/api/v1/channel/group-subscriptions",{jsonBody:$(e)})}};function $(t){return`{"session_id":${N(t.session_id)},"target_type":${JSON.stringify(t.target_type)},"target_id":${N(t.target_id)}}`}function N(t){if(typeof t=="number"){if(!Number.isInteger(t)||t<=0||!Number.isSafeInteger(t))throw new a("INVALID_ARGUMENT","channel group subscription ids must be positive safe integers; pass large int64 ids as strings",0);return String(t)}if(!/^[1-9]\d*$/.test(t))throw new a("INVALID_ARGUMENT","channel group subscription ids must be positive integer strings",0);return t}var z="https://api-llm.prd.alva.ai",H="https://data-tools.prd.space.id",A=class{baseUrl;arraysBaseUrl;viewer_token;apiKey;_fs;_run;_deploy;_release;_secrets;_sdk;_dataSkills;_playbookSkills;_comments;_remix;_screenshot;_user;_trading;_arraysJwt;_notifications;_pushSubscriptions;_channelGroupSubscriptions;constructor(e){this.baseUrl=e.baseUrl??z,this.arraysBaseUrl=e.arraysBaseUrl??H,this.viewer_token=e.viewer_token,this.apiKey=e.apiKey}get fs(){return this._fs??=new m(this)}get run(){return this._run??=new _(this)}get deploy(){return this._deploy??=new y(this)}get release(){return this._release??=new h(this)}get secrets(){return this._secrets??=new f(this)}get sdk(){return this._sdk??=new b(this)}get dataSkills(){return this._dataSkills??=new q(this)}get playbookSkills(){return this._playbookSkills??=new k(this)}get comments(){return this._comments??=new v(this)}get remix(){return this._remix??=new g(this)}get screenshot(){return this._screenshot??=new P(this)}get user(){return this._user??=new T(this)}get trading(){return this._trading??=new R(this)}get arraysJwt(){return this._arraysJwt??=new E(this)}get notifications(){return this._notifications??=new S(this)}get pushSubscriptions(){return this._pushSubscriptions??=new G(this)}get channelGroupSubscriptions(){return this._channelGroupSubscriptions??=new C(this)}_requireAuth(){if(!this.viewer_token&&!this.apiKey)throw new a("UNAUTHENTICATED","Authentication is required. Pass viewer_token or apiKey in the constructor.",401)}async _request(e,r,i){let n=`${i?.baseUrl??this.baseUrl}${r}`;if(i?.query){let l=new URLSearchParams;for(let[u,j]of Object.entries(i.query))j!=null&&l.set(u,String(j));let w=l.toString();w&&(n+=`?${w}`)}let c={};i?.noAuth||(this.viewer_token?c["x-Playbook-Viewer"]=this.viewer_token:this.apiKey&&(c["X-Alva-Api-Key"]=this.apiKey));let p;i?.rawBody!==void 0?(c["Content-Type"]="application/octet-stream",p=i.rawBody):i?.jsonBody!==void 0?(c["Content-Type"]="application/json",p=i.jsonBody):i?.body!==void 0&&(c["Content-Type"]="application/json",p=JSON.stringify(i.body));let o;try{o=await fetch(n,{method:e,headers:c,body:p})}catch(l){throw new a("NETWORK_ERROR",l instanceof Error?l.message:"Network request failed",0)}if(!o.ok){let l=await o.text().catch(()=>"");if((o.headers.get("content-type")??"").includes("application/json")&&l)try{let u=JSON.parse(l);if(u.error)throw new a(u.error.code??"UNKNOWN",u.error.message??`HTTP ${o.status}`,o.status)}catch(u){if(u instanceof a)throw u}throw new a("UNKNOWN",`HTTP ${o.status}: ${l.slice(0,200)}`,o.status)}if(o.status===204)return;let d=o.headers.get("content-type")??"";return d.includes("application/octet-stream")||d.includes("image/")?o.arrayBuffer():o.json()}};var Q="0.7.0";return V(X);})();
1
+ "use strict";var AlvaToolkit=(()=>{var F=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var W=Object.getOwnPropertyNames;var J=Object.prototype.hasOwnProperty;var K=(t,e)=>{for(var r in e)F(t,r,{get:e[r],enumerable:!0})},V=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of W(e))!J.call(t,s)&&s!==r&&F(t,s,{get:()=>e[s],enumerable:!(i=B(e,s))||i.enumerable});return t};var z=t=>V(F({},"__esModule",{value:!0}),t);var Y={};K(Y,{AlvaClient:()=>w,AlvaError:()=>a,VERSION:()=>X});var a=class extends Error{code;status;constructor(e,r,i){super(r),this.name="AlvaError",this.code=e,this.status=i}};var m=class{constructor(e){this.client=e}client;async read(e){let r=await this.client._request("GET","/api/v1/fs/read",{query:{path:e.path,offset:e.offset,size:e.size}});if(!(r instanceof ArrayBuffer))return r;try{let i=new TextDecoder("utf-8",{fatal:!0}).decode(r);try{return JSON.parse(i)}catch{return i}}catch{return r}}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 _=class{constructor(e){this.client=e}client;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}})}};var y=class{constructor(e){this.client=e}client;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:r,...i}=e;return this.client._request("PATCH",`/api/v1/deploy/cronjob/${r}`,{body:i})}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 h=class{constructor(e){this.client=e}client;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 f=class{constructor(e){this.client=e}client;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 b=class{constructor(e){this.client=e}client;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 r=encodeURIComponent(e.name);return this.client._request("GET",`/api/v1/secrets/${r}`)}async update(e){this.client._requireAuth();let r=encodeURIComponent(e.name);await this.client._request("PUT",`/api/v1/secrets/${r}`,{body:{value:e.value}})}async delete(e){this.client._requireAuth();let r=encodeURIComponent(e.name);await this.client._request("DELETE",`/api/v1/secrets/${r}`)}};var q=class{constructor(e){this.client=e}client;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 r=encodeURIComponent(e.partition);return this.client._request("GET",`/api/v1/sdk/partitions/${r}/summary`)}};var I=[{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-spot-market-price-and-volume",file:"crypto-futures-ohlcv",method:"GET",path:"/api/v1/crypto/futures/ohlcv",tier:"public",required_subscription_tier:"free",access:"free_and_pro",pro_required:!1},{skill:"arrays-data-api-spot-market-price-and-volume",file:"crypto-kline",method:"GET",path:"/api/v1/crypto/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-spot-market-price-and-volume",file:"crypto-ohlcv",method:"GET",path:"/api/v1/crypto/ohlcv",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-equity-ownership-and-flow",file:"senate-trade",method:"GET",path:"/api/v1/stocks/company/senate-trade",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}];function M(t,e){return I.find(r=>r.skill===t&&r.file===e)}function U(t){return I.filter(e=>e.skill===t)}var k=class{constructor(e){this.client=e}client;async list(){return{skills:((await this.client._request("GET","/api/v1/skills",{baseUrl:this.client.arraysBaseUrl,noAuth:!0})).data??[]).map(r=>({...r,...L(r.name)}))}}async summary(e){let r=encodeURIComponent(e.name),s=(await this.client._request("GET",`/api/v1/skills/${r}`,{baseUrl:this.client.arraysBaseUrl,noAuth:!0})).data?.[0];if(!s)throw new Error(`empty skills summary response for "${e.name}"`);let n=U(e.name);return{...s,...L(e.name),...n.length>0?{endpoint_metadata:n}:{}}}async endpoint(e){let r=encodeURIComponent(e.name),s=(await this.client._request("GET",`/api/v1/skills/${r}`,{baseUrl:this.client.arraysBaseUrl,noAuth:!0,query:{endpoint:e.file}})).data?.[0];if(!s)throw new Error(`empty skills endpoint response for "${e.name}" file "${e.file}"`);let n=M(e.name,e.file);return{...s,...n?{metadata:n}:{}}}};function L(t){let e=U(t);if(e.length===0)return{};let r={},i=0;for(let s of e)r[s.tier]=(r[s.tier]??0)+1,s.pro_required&&(i+=1);return{endpoint_tier_counts:r,metadata:{endpoint_count:e.length,endpoint_tier_counts:r,pro_count:i}}}function O(t){let e=t.split("/");if(e.length!==2||!e[0]||!e[1])throw new a("INVALID_ARGUMENT",`playbook skill identifier must be "<user>/<name>", got "${t}"`,0);return{username:e[0],name:e[1]}}var v=class{constructor(e){this.client=e}client;async list(e){let r={};return e?.tag&&(r.tag=e.tag),e?.username&&(r.username=e.username),{skills:(await this.client._request("GET","/api/v1/skills",{query:r})).data??[]}}async tags(){return{tags:(await this.client._request("GET","/api/v1/skills/tags")).data??[]}}async get(e){let{username:r,name:i}=O(e),s=encodeURIComponent(r),n=encodeURIComponent(i),p=(await this.client._request("GET",`/api/v1/skills/${s}/${n}`)).data?.[0];if(!p)throw new a("NOT_FOUND",`empty playbook skills get response for ${e}`,0);return p}async file(e,r){let{username:i,name:s}=O(e),n=encodeURIComponent(i),c=encodeURIComponent(s),p=r.split("/").map(encodeURIComponent).join("/"),d=(await this.client._request("GET",`/api/v1/skills/${n}/${c}/files/${p}`)).data?.[0];if(!d)throw new a("NOT_FOUND",`empty playbook skills file response for ${e} path ${r}`,0);return d}};var g=class{constructor(e){this.client=e}client;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 P=class{constructor(e){this.client=e}client;async save(e){this.client._requireAuth(),await this.client._request("POST","/api/v1/remix",{body:{child:e.child,parents:e.parents}})}};var R=class{constructor(e){this.client=e}client;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 T=class{constructor(e){this.client=e}client;async me(){return this.client._requireAuth(),this.client._request("GET","/api/v1/me")}};var E=class{constructor(e){this.client=e}client;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 S=class{constructor(e){this.client=e}client;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 G=class{constructor(e){this.client=e}client;async listPlaybook(e){this.client._requireAuth();let r=`/api/v1/playbook/${encodeURIComponent(e.username)}/${encodeURIComponent(e.name)}/notifications`;return this.client._request("GET",r,{query:$(e)})}async listFeed(e){this.client._requireAuth();let r=`/api/v1/feed/${encodeURIComponent(e.username)}/${encodeURIComponent(e.name)}/notifications`;return this.client._request("GET",r,{query:$(e)})}};function $(t){let e={};return t.channel&&(e.channel=t.channel),t.status&&(e.status=t.status),t.since_time!==void 0&&t.since_time>0&&(e.since_time=String(t.since_time)),t.first!==void 0&&t.first>0&&(e.first=String(t.first)),t.cursor&&(e.cursor=t.cursor),e}var C=class{constructor(e){this.client=e}client;async subscribePlaybook(e){this.client._requireAuth();let r=`/api/v1/push-subscriptions/playbook/${encodeURIComponent(e.username)}/${encodeURIComponent(e.name)}`;return this.client._request("POST",r)}async unsubscribePlaybook(e){this.client._requireAuth();let r=`/api/v1/push-subscriptions/playbook/${encodeURIComponent(e.username)}/${encodeURIComponent(e.name)}`;return this.client._request("DELETE",r)}async subscribeFeed(e){this.client._requireAuth();let r=`/api/v1/push-subscriptions/feed/${encodeURIComponent(e.username)}/${encodeURIComponent(e.name)}`;return this.client._request("POST",r)}async unsubscribeFeed(e){this.client._requireAuth();let r=`/api/v1/push-subscriptions/feed/${encodeURIComponent(e.username)}/${encodeURIComponent(e.name)}`;return this.client._request("DELETE",r)}async list(e={}){this.client._requireAuth();let r={};return e.first!==void 0&&e.first>0&&(r.first=String(e.first)),e.cursor&&(r.cursor=e.cursor),this.client._request("GET","/api/v1/me/push-subscriptions",{query:r})}};var A=class{constructor(e){this.client=e}client;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:D(e)})}async unsubscribe(e){return this.client._requireAuth(),this.client._request("DELETE","/api/v1/channel/group-subscriptions",{jsonBody:D(e)})}};function D(t){return`{"session_id":${N(t.session_id)},"target_type":${JSON.stringify(t.target_type)},"target_id":${N(t.target_id)}}`}function N(t){if(typeof t=="number"){if(!Number.isInteger(t)||t<=0||!Number.isSafeInteger(t))throw new a("INVALID_ARGUMENT","channel group subscription ids must be positive safe integers; pass large int64 ids as strings",0);return String(t)}if(!/^[1-9]\d*$/.test(t))throw new a("INVALID_ARGUMENT","channel group subscription ids must be positive integer strings",0);return t}var H="https://api-llm.prd.alva.ai",Q="https://data-tools.prd.space.id",w=class{baseUrl;arraysBaseUrl;viewer_token;apiKey;_fs;_run;_deploy;_release;_feed;_secrets;_sdk;_dataSkills;_playbookSkills;_comments;_remix;_screenshot;_user;_trading;_arraysJwt;_notifications;_pushSubscriptions;_channelGroupSubscriptions;constructor(e){this.baseUrl=e.baseUrl??H,this.arraysBaseUrl=e.arraysBaseUrl??Q,this.viewer_token=e.viewer_token,this.apiKey=e.apiKey}get fs(){return this._fs??=new m(this)}get run(){return this._run??=new _(this)}get deploy(){return this._deploy??=new y(this)}get release(){return this._release??=new h(this)}get feed(){return this._feed??=new f(this)}get secrets(){return this._secrets??=new b(this)}get sdk(){return this._sdk??=new q(this)}get dataSkills(){return this._dataSkills??=new k(this)}get playbookSkills(){return this._playbookSkills??=new v(this)}get comments(){return this._comments??=new g(this)}get remix(){return this._remix??=new P(this)}get screenshot(){return this._screenshot??=new R(this)}get user(){return this._user??=new T(this)}get trading(){return this._trading??=new E(this)}get arraysJwt(){return this._arraysJwt??=new S(this)}get notifications(){return this._notifications??=new G(this)}get pushSubscriptions(){return this._pushSubscriptions??=new C(this)}get channelGroupSubscriptions(){return this._channelGroupSubscriptions??=new A(this)}_requireAuth(){if(!this.viewer_token&&!this.apiKey)throw new a("UNAUTHENTICATED","Authentication is required. Pass viewer_token or apiKey in the constructor.",401)}async _request(e,r,i){let n=`${i?.baseUrl??this.baseUrl}${r}`;if(i?.query){let l=new URLSearchParams;for(let[u,x]of Object.entries(i.query))x!=null&&l.set(u,String(x));let j=l.toString();j&&(n+=`?${j}`)}let c={};i?.noAuth||(this.viewer_token?c["x-Playbook-Viewer"]=this.viewer_token:this.apiKey&&(c["X-Alva-Api-Key"]=this.apiKey));let p;i?.rawBody!==void 0?(c["Content-Type"]="application/octet-stream",p=i.rawBody):i?.jsonBody!==void 0?(c["Content-Type"]="application/json",p=i.jsonBody):i?.body!==void 0&&(c["Content-Type"]="application/json",p=JSON.stringify(i.body));let o;try{o=await fetch(n,{method:e,headers:c,body:p})}catch(l){throw new a("NETWORK_ERROR",l instanceof Error?l.message:"Network request failed",0)}if(!o.ok){let l=await o.text().catch(()=>"");if((o.headers.get("content-type")??"").includes("application/json")&&l)try{let u=JSON.parse(l);if(u.error)throw new a(u.error.code??"UNKNOWN",u.error.message??`HTTP ${o.status}`,o.status)}catch(u){if(u instanceof a)throw u}throw new a("UNKNOWN",`HTTP ${o.status}: ${l.slice(0,200)}`,o.status)}if(o.status===204)return;let d=o.headers.get("content-type")??"";return d.includes("application/octet-stream")||d.includes("image/")?o.arrayBuffer():o.json()}};var X="0.8.0";return z(Y);})();
2
2
  //# sourceMappingURL=browser.global.js.map