@alva-ai/toolkit 0.33.1-beta.0 → 0.33.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.
@@ -357,5 +357,5 @@ mutation ToolkitStewardBriefed($input: CompleteStewardBriefInput!) {
357
357
  companyNews {
358
358
  createFeed(input: $input) { id producer { id } }
359
359
  }
360
- }`,Zi={INVALID_ARGUMENT:400,UNAUTHENTICATED:401,PERMISSION_DENIED:403,NOT_FOUND:404,ALREADY_EXISTS:409,ABORTED:409,FAILED_PRECONDITION:412,RESOURCE_EXHAUSTED:429,INTERNAL:500,UNKNOWN:500,DATA_LOSS:500,UNAVAILABLE:503,DEADLINE_EXCEEDED:504};function es(t){if(typeof t?.name!="string"||t.name.trim()!==t.name||!/^[a-zA-Z0-9][a-zA-Z0-9-]{0,63}$/.test(t.name)||t.name==="news-lane")throw new l("INVALID_ARGUMENT","name must be 1-64 alphanumeric/hyphen characters and distinct from news-lane",400);if(!Array.isArray(t.tickers)||t.tickers.length<1||t.tickers.length>1e3||t.tickers.some(e=>typeof e!="string"||e.trim()!==e||!/^[A-Z0-9][A-Z0-9.-]{0,19}$/.test(e))||new Set(t.tickers).size!==t.tickers.length)throw new l("INVALID_ARGUMENT","tickers must contain 1-1000 unique uppercase symbols",400);for(let[e,n]of[["initial_lookback_hours",168],["page_size",100]]){let r=t[e];if(r!==void 0&&(!Number.isInteger(r)||r<0||r>n))throw new l("INVALID_ARGUMENT",`${e} must be an integer from 0 to ${n} (0 selects the default)`,400)}}i(es,"validateCompanyNewsCreateParams");var oe=class{constructor(e){this.client=e}client;static{i(this,"CompanyNewsResource")}async create(e){this.client._requireAuth(),es(e);let n={name:e.name,tickers:e.tickers,...e.initial_lookback_hours===void 0?{}:{initialLookbackHours:e.initial_lookback_hours},...e.page_size===void 0?{}:{pageSize:e.page_size}},r=await this.client._request("POST","/query",{body:{query:Ji,variables:{input:n}}});if(Array.isArray(r?.errors)&&r.errors.length>0){let a=r.errors.map(c=>c?.extensions?.code),u=typeof a[0]=="string"&&a.every(c=>c===a[0])?a[0]:"GRAPHQL_ERROR";throw new l(u,r.errors.map(c=>c?.message).filter(Boolean).join("; ")||"Company News creation failed",Zi[u]??502,{errors:r.errors})}let s=r?.data?.companyNews?.createFeed,o={feed_id:s?.id,cronjob_id:s?.producer?.id};if(typeof o!="object"||o===null||!("feed_id"in o)||!jn(o.feed_id)||!("cronjob_id"in o)||!jn(o.cronjob_id))throw new l("INVALID_RESPONSE","company news response must contain decimal int64 feed_id and cronjob_id strings",502);return{feed_id:o.feed_id,cronjob_id:o.cronjob_id}}};function jn(t){return typeof t=="string"&&t.trim()===t&&/^[1-9]\d{0,18}$/.test(t)&&BigInt(t)<=9223372036854775807n}i(jn,"validID");var ts="https://api-llm.prd.alva.ai",ns="https://data-tools.prd.space.id";function Dt(t){return typeof t=="object"&&t!==null}i(Dt,"isRecord");function mt(t,e){if(!Dt(t))return;let n=t[e];return typeof n=="string"&&n?n:void 0}i(mt,"stringField");function rs(t){if(t==null)return{};let e={};if(t instanceof Error){t.name&&(e.name=t.name),t.message&&(e.message=t.message);let r=mt(t,"code");r&&(e.code=r)}else if(Dt(t)){let r=mt(t,"code"),s=mt(t,"name"),o=mt(t,"message");r&&(e.code=r),s&&(e.name=s),o&&(e.message=o)}else e.message=String(t);let n=[e.code,e.name,e.message].filter(r=>!!r);return{message:n.length>0?n.join(": "):void 0,details:Object.keys(e).length>0?e:void 0}}i(rs,"describeCause");function is(t){let e=t instanceof Error&&t.message?t.message:"Network request failed",n={};t instanceof Error?(n.name=t.name,n.message=t.message):n.message=String(t);let{message:r,details:s}=rs(Dt(t)?t.cause:void 0);return s&&(n.cause=s),{message:r?`${e}; cause: ${r}`:e,details:n}}i(is,"describeFetchFailure");var ht=class{static{i(this,"AlvaClient")}baseUrl;arraysBaseUrl;viewer_token;pbsvToken;apiKey;gaClientId;gaSessionId;utmParams;signal;originSessionId;originSessionKind;originInboxPath;_fs;_run;_deploy;_serviceAccount;_release;_feed;_x;_forYou;_automation;_playbooks;_secrets;_sdk;_dataSkills;_playbookSkills;_comments;_remix;_screenshot;_user;_trading;_portfolio;_arraysJwt;_notifications;_notificationPreferences;_subscriptions;_alerts;_channelGroupSubscriptions;_feedback;_functions;_credits;_markets;_schedules;_steward;_tradingPairs;_theses;_companyNews;constructor(e){this.baseUrl=e.baseUrl??ts,this.arraysBaseUrl=e.arraysBaseUrl??ns,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,this.signal=e.signal,this.originSessionId=e.originSessionId,this.originSessionKind=e.originSessionKind,this.originInboxPath=e.originInboxPath}get fs(){return this._fs??=new qe(this)}get run(){return this._run??=new Ne(this)}get deploy(){return this._deploy??=new De(this)}get serviceAccount(){return this._serviceAccount??=new Ue(this)}get release(){return this._release??=new Le(this)}get feed(){return this._feed??=new Oe(this)}get automation(){return this._automation??=new J(this)}get playbooks(){return this._playbooks??=new $e(this)}get secrets(){return this._secrets??=new je(this)}get sdk(){return this._sdk??=new Be(this)}get dataSkills(){return this._dataSkills??=new Qe(this)}get playbookSkills(){return this._playbookSkills??=new Ve(this)}get comments(){return this._comments??=new He(this)}get remix(){return this._remix??=new Ye(this)}get screenshot(){return this._screenshot??=new We(this)}get user(){return this._user??=new Ke(this)}get trading(){return this._trading??=new Xe(this)}get portfolio(){return this._portfolio??=new ze(this)}get arraysJwt(){return this._arraysJwt??=new Je(this)}get notifications(){return this._notifications??=new Ze(this)}get notificationPreferences(){return this._notificationPreferences??=new et(this)}get subscriptions(){return this._subscriptions??=new tt(this)}get alerts(){return this._alerts??=new Z(this)}get channelGroupSubscriptions(){return this._channelGroupSubscriptions??=new nt(this)}get feedback(){return this._feedback??=new rt(this)}get functions(){return this._functions??=new it(this)}get credits(){return this._credits??=new st(this)}get markets(){return this._markets??=new ee(this)}get tradingPairs(){return this._tradingPairs??=new re(this)}get schedules(){return this._schedules??=new te(this)}get steward(){return this._steward??=new ne(this)}get theses(){return this._theses??=new se(this)}get companyNews(){return this._companyNews??=new oe(this)}_requireAuth(){if(!this.pbsvToken&&!this.viewer_token&&!this.apiKey)throw new l("UNAUTHENTICATED","Authentication is required. Pass pbsvToken, viewer_token, or apiKey in the constructor.",401)}get x(){return this._x??=new W(this)}get forYou(){return this._forYou??=new z(this)}async _request(e,n,r){let o=`${r?.baseUrl??this.baseUrl}${n}`;if(r?.query){let q=new URLSearchParams;for(let[O,ft]of Object.entries(r.query))ft!=null&&q.set(O,String(ft));let Q=q.toString();Q&&(o+=`?${Q}`)}let a={};r?.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),this.originSessionId&&!r?.noAuth&&(a["X-Alva-Origin-Session-Id"]=this.originSessionId);let u;r?.rawBody!==void 0?(a["Content-Type"]="application/octet-stream",u=r.rawBody):r?.jsonBody!==void 0?(a["Content-Type"]="application/json",u=r.jsonBody):r?.body!==void 0&&(a["Content-Type"]="application/json",u=JSON.stringify(r.body));let c,d=r?.timeoutMs,h=r?.signal??this.signal;if(h?.aborted)throw new l("NETWORK_ABORTED",`Request aborted while calling ${e} ${n}`,0,{method:e,path:n});let f=d!==void 0?new AbortController:void 0,E=!1,L,Ee;f&&d!==void 0&&(h&&(Ee=i(()=>f.abort(h.reason),"abortListener"),h.addEventListener("abort",Ee,{once:!0})),L=setTimeout(()=>{E=!0,f.abort(new Error(`Request timed out after ${d}ms while calling ${e} ${n}`))},d));let Ut={method:e,headers:a,body:u,signal:f?.signal??h};d!==void 0&&(Ut.timeout=d);try{c=await fetch(o,Ut)}catch(q){if(h?.aborted&&!E)throw new l("NETWORK_ABORTED",`Request aborted while calling ${e} ${n}`,0,{method:e,path:n});if(E)throw new l("NETWORK_TIMEOUT",`Request timed out after ${d}ms while calling ${e} ${n}`,0,{method:e,path:n,timeout_ms:d});let Q=is(q);throw new l("NETWORK_ERROR",Q.message,0,{method:e,path:n,...Q.details})}finally{Ee&&h&&h.removeEventListener("abort",Ee),L!==void 0&&clearTimeout(L)}if(!c.ok){let q="";try{q=await Promise.resolve(c.text())}catch{q=""}if((c.headers.get("content-type")??"").includes("application/json")&&q)try{let O=JSON.parse(q);if(O.error)throw new l(O.error.code??"UNKNOWN",O.error.message??`HTTP ${c.status}`,c.status)}catch(O){if(O instanceof l)throw O}throw new l("UNKNOWN",`HTTP ${c.status}: ${q.slice(0,200)}`,c.status)}if(c.status===204)return;let Lt=(c.headers.get("content-type")??"").toLowerCase();return Lt.includes("application/json")||Lt.includes("+json")?c.json():c.arrayBuffer()}};var ss="0.33.1-beta.0";Rt();return Wn(os);})();
360
+ }`,Zi={INVALID_ARGUMENT:400,UNAUTHENTICATED:401,PERMISSION_DENIED:403,NOT_FOUND:404,ALREADY_EXISTS:409,ABORTED:409,FAILED_PRECONDITION:412,RESOURCE_EXHAUSTED:429,INTERNAL:500,UNKNOWN:500,DATA_LOSS:500,UNAVAILABLE:503,DEADLINE_EXCEEDED:504};function es(t){if(typeof t?.name!="string"||t.name.trim()!==t.name||!/^[a-zA-Z0-9][a-zA-Z0-9-]{0,63}$/.test(t.name)||t.name==="news-lane")throw new l("INVALID_ARGUMENT","name must be 1-64 alphanumeric/hyphen characters and distinct from news-lane",400);if(!Array.isArray(t.tickers)||t.tickers.length<1||t.tickers.length>1e3||t.tickers.some(e=>typeof e!="string"||e.trim()!==e||!/^[A-Z0-9][A-Z0-9.-]{0,19}$/.test(e))||new Set(t.tickers).size!==t.tickers.length)throw new l("INVALID_ARGUMENT","tickers must contain 1-1000 unique uppercase symbols",400);for(let[e,n]of[["initial_lookback_hours",168],["page_size",100]]){let r=t[e];if(r!==void 0&&(!Number.isInteger(r)||r<0||r>n))throw new l("INVALID_ARGUMENT",`${e} must be an integer from 0 to ${n} (0 selects the default)`,400)}}i(es,"validateCompanyNewsCreateParams");var oe=class{constructor(e){this.client=e}client;static{i(this,"CompanyNewsResource")}async create(e){this.client._requireAuth(),es(e);let n={name:e.name,tickers:e.tickers,...e.initial_lookback_hours===void 0?{}:{initialLookbackHours:e.initial_lookback_hours},...e.page_size===void 0?{}:{pageSize:e.page_size}},r=await this.client._request("POST","/query",{body:{query:Ji,variables:{input:n}}});if(Array.isArray(r?.errors)&&r.errors.length>0){let a=r.errors.map(c=>c?.extensions?.code),u=typeof a[0]=="string"&&a.every(c=>c===a[0])?a[0]:"GRAPHQL_ERROR";throw new l(u,r.errors.map(c=>c?.message).filter(Boolean).join("; ")||"Company News creation failed",Zi[u]??502,{errors:r.errors})}let s=r?.data?.companyNews?.createFeed,o={feed_id:s?.id,cronjob_id:s?.producer?.id};if(typeof o!="object"||o===null||!("feed_id"in o)||!jn(o.feed_id)||!("cronjob_id"in o)||!jn(o.cronjob_id))throw new l("INVALID_RESPONSE","company news response must contain decimal int64 feed_id and cronjob_id strings",502);return{feed_id:o.feed_id,cronjob_id:o.cronjob_id}}};function jn(t){return typeof t=="string"&&t.trim()===t&&/^[1-9]\d{0,18}$/.test(t)&&BigInt(t)<=9223372036854775807n}i(jn,"validID");var ts="https://api-llm.prd.alva.ai",ns="https://data-tools.prd.space.id";function Dt(t){return typeof t=="object"&&t!==null}i(Dt,"isRecord");function mt(t,e){if(!Dt(t))return;let n=t[e];return typeof n=="string"&&n?n:void 0}i(mt,"stringField");function rs(t){if(t==null)return{};let e={};if(t instanceof Error){t.name&&(e.name=t.name),t.message&&(e.message=t.message);let r=mt(t,"code");r&&(e.code=r)}else if(Dt(t)){let r=mt(t,"code"),s=mt(t,"name"),o=mt(t,"message");r&&(e.code=r),s&&(e.name=s),o&&(e.message=o)}else e.message=String(t);let n=[e.code,e.name,e.message].filter(r=>!!r);return{message:n.length>0?n.join(": "):void 0,details:Object.keys(e).length>0?e:void 0}}i(rs,"describeCause");function is(t){let e=t instanceof Error&&t.message?t.message:"Network request failed",n={};t instanceof Error?(n.name=t.name,n.message=t.message):n.message=String(t);let{message:r,details:s}=rs(Dt(t)?t.cause:void 0);return s&&(n.cause=s),{message:r?`${e}; cause: ${r}`:e,details:n}}i(is,"describeFetchFailure");var ht=class{static{i(this,"AlvaClient")}baseUrl;arraysBaseUrl;viewer_token;pbsvToken;apiKey;gaClientId;gaSessionId;utmParams;signal;originSessionId;originSessionKind;originInboxPath;_fs;_run;_deploy;_serviceAccount;_release;_feed;_x;_forYou;_automation;_playbooks;_secrets;_sdk;_dataSkills;_playbookSkills;_comments;_remix;_screenshot;_user;_trading;_portfolio;_arraysJwt;_notifications;_notificationPreferences;_subscriptions;_alerts;_channelGroupSubscriptions;_feedback;_functions;_credits;_markets;_schedules;_steward;_tradingPairs;_theses;_companyNews;constructor(e){this.baseUrl=e.baseUrl??ts,this.arraysBaseUrl=e.arraysBaseUrl??ns,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,this.signal=e.signal,this.originSessionId=e.originSessionId,this.originSessionKind=e.originSessionKind,this.originInboxPath=e.originInboxPath}get fs(){return this._fs??=new qe(this)}get run(){return this._run??=new Ne(this)}get deploy(){return this._deploy??=new De(this)}get serviceAccount(){return this._serviceAccount??=new Ue(this)}get release(){return this._release??=new Le(this)}get feed(){return this._feed??=new Oe(this)}get automation(){return this._automation??=new J(this)}get playbooks(){return this._playbooks??=new $e(this)}get secrets(){return this._secrets??=new je(this)}get sdk(){return this._sdk??=new Be(this)}get dataSkills(){return this._dataSkills??=new Qe(this)}get playbookSkills(){return this._playbookSkills??=new Ve(this)}get comments(){return this._comments??=new He(this)}get remix(){return this._remix??=new Ye(this)}get screenshot(){return this._screenshot??=new We(this)}get user(){return this._user??=new Ke(this)}get trading(){return this._trading??=new Xe(this)}get portfolio(){return this._portfolio??=new ze(this)}get arraysJwt(){return this._arraysJwt??=new Je(this)}get notifications(){return this._notifications??=new Ze(this)}get notificationPreferences(){return this._notificationPreferences??=new et(this)}get subscriptions(){return this._subscriptions??=new tt(this)}get alerts(){return this._alerts??=new Z(this)}get channelGroupSubscriptions(){return this._channelGroupSubscriptions??=new nt(this)}get feedback(){return this._feedback??=new rt(this)}get functions(){return this._functions??=new it(this)}get credits(){return this._credits??=new st(this)}get markets(){return this._markets??=new ee(this)}get tradingPairs(){return this._tradingPairs??=new re(this)}get schedules(){return this._schedules??=new te(this)}get steward(){return this._steward??=new ne(this)}get theses(){return this._theses??=new se(this)}get companyNews(){return this._companyNews??=new oe(this)}_requireAuth(){if(!this.pbsvToken&&!this.viewer_token&&!this.apiKey)throw new l("UNAUTHENTICATED","Authentication is required. Pass pbsvToken, viewer_token, or apiKey in the constructor.",401)}get x(){return this._x??=new W(this)}get forYou(){return this._forYou??=new z(this)}async _request(e,n,r){let o=`${r?.baseUrl??this.baseUrl}${n}`;if(r?.query){let q=new URLSearchParams;for(let[O,ft]of Object.entries(r.query))ft!=null&&q.set(O,String(ft));let Q=q.toString();Q&&(o+=`?${Q}`)}let a={};r?.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),this.originSessionId&&!r?.noAuth&&(a["X-Alva-Origin-Session-Id"]=this.originSessionId);let u;r?.rawBody!==void 0?(a["Content-Type"]="application/octet-stream",u=r.rawBody):r?.jsonBody!==void 0?(a["Content-Type"]="application/json",u=r.jsonBody):r?.body!==void 0&&(a["Content-Type"]="application/json",u=JSON.stringify(r.body));let c,d=r?.timeoutMs,h=r?.signal??this.signal;if(h?.aborted)throw new l("NETWORK_ABORTED",`Request aborted while calling ${e} ${n}`,0,{method:e,path:n});let f=d!==void 0?new AbortController:void 0,E=!1,L,Ee;f&&d!==void 0&&(h&&(Ee=i(()=>f.abort(h.reason),"abortListener"),h.addEventListener("abort",Ee,{once:!0})),L=setTimeout(()=>{E=!0,f.abort(new Error(`Request timed out after ${d}ms while calling ${e} ${n}`))},d));let Ut={method:e,headers:a,body:u,signal:f?.signal??h};d!==void 0&&(Ut.timeout=d);try{c=await fetch(o,Ut)}catch(q){if(h?.aborted&&!E)throw new l("NETWORK_ABORTED",`Request aborted while calling ${e} ${n}`,0,{method:e,path:n});if(E)throw new l("NETWORK_TIMEOUT",`Request timed out after ${d}ms while calling ${e} ${n}`,0,{method:e,path:n,timeout_ms:d});let Q=is(q);throw new l("NETWORK_ERROR",Q.message,0,{method:e,path:n,...Q.details})}finally{Ee&&h&&h.removeEventListener("abort",Ee),L!==void 0&&clearTimeout(L)}if(!c.ok){let q="";try{q=await Promise.resolve(c.text())}catch{q=""}if((c.headers.get("content-type")??"").includes("application/json")&&q)try{let O=JSON.parse(q);if(O.error)throw new l(O.error.code??"UNKNOWN",O.error.message??`HTTP ${c.status}`,c.status)}catch(O){if(O instanceof l)throw O}throw new l("UNKNOWN",`HTTP ${c.status}: ${q.slice(0,200)}`,c.status)}if(c.status===204)return;let Lt=(c.headers.get("content-type")??"").toLowerCase();return Lt.includes("application/json")||Lt.includes("+json")?c.json():c.arrayBuffer()}};var ss="0.33.1";Rt();return Wn(os);})();
361
361
  //# sourceMappingURL=browser.global.js.map