@alva-ai/toolkit 0.32.0-beta.1 → 0.32.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.
- package/dist/browser.global.js +1 -1
- package/dist/browser.global.js.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/dispatch.js +1 -1
- package/dist/dispatch.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/browser.global.js
CHANGED
|
@@ -357,5 +357,5 @@ mutation ToolkitStewardBriefed($input: CompleteStewardBriefInput!) {
|
|
|
357
357
|
companyNews {
|
|
358
358
|
createFeed(input: $input) { id producer { id } }
|
|
359
359
|
}
|
|
360
|
-
}`,Yr={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 Hr(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 i=t[e];if(i!==void 0&&(!Number.isInteger(i)||i<0||i>n))throw new l("INVALID_ARGUMENT",`${e} must be an integer from 0 to ${n} (0 selects the default)`,400)}}r(Hr,"validateCompanyNewsCreateParams");var ie=class{constructor(e){this.client=e}client;static{r(this,"CompanyNewsResource")}async create(e){this.client._requireAuth(),Hr(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}},i=await this.client._request("POST","/query",{body:{query:Vr,variables:{input:n}}});if(Array.isArray(i?.errors)&&i.errors.length>0){let a=i.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,i.errors.map(c=>c?.message).filter(Boolean).join("; ")||"Company News creation failed",Yr[u]??502,{errors:i.errors})}let s=i?.data?.companyNews?.createFeed,o={feed_id:s?.id,cronjob_id:s?.producer?.id};if(typeof o!="object"||o===null||!("feed_id"in o)||!Ln(o.feed_id)||!("cronjob_id"in o)||!Ln(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 Ln(t){return typeof t=="string"&&t.trim()===t&&/^[1-9]\d{0,18}$/.test(t)&&BigInt(t)<=9223372036854775807n}r(Ln,"validID");var Wr="https://api-llm.prd.alva.ai",Kr="https://data-tools.prd.space.id";function xt(t){return typeof t=="object"&&t!==null}r(xt,"isRecord");function lt(t,e){if(!xt(t))return;let n=t[e];return typeof n=="string"&&n?n:void 0}r(lt,"stringField");function zr(t){if(t==null)return{};let e={};if(t instanceof Error){t.name&&(e.name=t.name),t.message&&(e.message=t.message);let i=lt(t,"code");i&&(e.code=i)}else if(xt(t)){let i=lt(t,"code"),s=lt(t,"name"),o=lt(t,"message");i&&(e.code=i),s&&(e.name=s),o&&(e.message=o)}else e.message=String(t);let n=[e.code,e.name,e.message].filter(i=>!!i);return{message:n.length>0?n.join(": "):void 0,details:Object.keys(e).length>0?e:void 0}}r(zr,"describeCause");function Jr(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:i,details:s}=zr(xt(t)?t.cause:void 0);return s&&(n.cause=s),{message:i?`${e}; cause: ${i}`:e,details:n}}r(Jr,"describeFetchFailure");var dt=class{static{r(this,"AlvaClient")}baseUrl;arraysBaseUrl;viewer_token;pbsvToken;apiKey;gaClientId;gaSessionId;utmParams;signal;originSessionId;originSessionKind;originInboxPath;_fs;_run;_deploy;_serviceAccount;_release;_feed;_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??Wr,this.arraysBaseUrl=e.arraysBaseUrl??Kr,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 Ie(this)}get run(){return this._run??=new Ce(this)}get deploy(){return this._deploy??=new xe(this)}get serviceAccount(){return this._serviceAccount??=new qe(this)}get release(){return this._release??=new Ne(this)}get feed(){return this._feed??=new Ue(this)}get automation(){return this._automation??=new K(this)}get playbooks(){return this._playbooks??=new Ge(this)}get secrets(){return this._secrets??=new Oe(this)}get sdk(){return this._sdk??=new Me(this)}get dataSkills(){return this._dataSkills??=new $e(this)}get playbookSkills(){return this._playbookSkills??=new je(this)}get comments(){return this._comments??=new Be(this)}get remix(){return this._remix??=new Qe(this)}get screenshot(){return this._screenshot??=new Ve(this)}get user(){return this._user??=new Ye(this)}get trading(){return this._trading??=new He(this)}get portfolio(){return this._portfolio??=new We(this)}get arraysJwt(){return this._arraysJwt??=new Ke(this)}get notifications(){return this._notifications??=new ze(this)}get notificationPreferences(){return this._notificationPreferences??=new Je(this)}get subscriptions(){return this._subscriptions??=new Xe(this)}get alerts(){return this._alerts??=new z(this)}get channelGroupSubscriptions(){return this._channelGroupSubscriptions??=new Ze(this)}get feedback(){return this._feedback??=new et(this)}get functions(){return this._functions??=new tt(this)}get credits(){return this._credits??=new nt(this)}get markets(){return this._markets??=new J(this)}get tradingPairs(){return this._tradingPairs??=new ee(this)}get schedules(){return this._schedules??=new X(this)}get steward(){return this._steward??=new Z(this)}get theses(){return this._theses??=new ne(this)}get companyNews(){return this._companyNews??=new ie(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 forYou(){return this._forYou??=new W(this)}async _request(e,n,i){let o=`${i?.baseUrl??this.baseUrl}${n}`;if(i?.query){let x=new URLSearchParams;for(let[L,pt]of Object.entries(i.query))pt!=null&&x.set(L,String(pt));let j=x.toString();j&&(o+=`?${j}`)}let a={};i?.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&&!i?.noAuth&&(a["X-Alva-Origin-Session-Id"]=this.originSessionId);let u;i?.rawBody!==void 0?(a["Content-Type"]="application/octet-stream",u=i.rawBody):i?.jsonBody!==void 0?(a["Content-Type"]="application/json",u=i.jsonBody):i?.body!==void 0&&(a["Content-Type"]="application/json",u=JSON.stringify(i.body));let c,d=i?.timeoutMs,h=i?.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,A=!1,D,ke;f&&d!==void 0&&(h&&(ke=r(()=>f.abort(h.reason),"abortListener"),h.addEventListener("abort",ke,{once:!0})),D=setTimeout(()=>{A=!0,f.abort(new Error(`Request timed out after ${d}ms while calling ${e} ${n}`))},d));let qt={method:e,headers:a,body:u,signal:f?.signal??h};d!==void 0&&(qt.timeout=d);try{c=await fetch(o,qt)}catch(x){if(h?.aborted&&!A)throw new l("NETWORK_ABORTED",`Request aborted while calling ${e} ${n}`,0,{method:e,path:n});if(A)throw new l("NETWORK_TIMEOUT",`Request timed out after ${d}ms while calling ${e} ${n}`,0,{method:e,path:n,timeout_ms:d});let j=Jr(x);throw new l("NETWORK_ERROR",j.message,0,{method:e,path:n,...j.details})}finally{ke&&h&&h.removeEventListener("abort",ke),D!==void 0&&clearTimeout(D)}if(!c.ok){let x="";try{x=await Promise.resolve(c.text())}catch{x=""}if((c.headers.get("content-type")??"").includes("application/json")&&x)try{let L=JSON.parse(x);if(L.error)throw new l(L.error.code??"UNKNOWN",L.error.message??`HTTP ${c.status}`,c.status)}catch(L){if(L instanceof l)throw L}throw new l("UNKNOWN",`HTTP ${c.status}: ${x.slice(0,200)}`,c.status)}if(c.status===204)return;let Nt=(c.headers.get("content-type")??"").toLowerCase();return Nt.includes("application/json")||Nt.includes("+json")?c.json():c.arrayBuffer()}};var Xr="0.32.0
|
|
360
|
+
}`,Yr={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 Hr(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 i=t[e];if(i!==void 0&&(!Number.isInteger(i)||i<0||i>n))throw new l("INVALID_ARGUMENT",`${e} must be an integer from 0 to ${n} (0 selects the default)`,400)}}r(Hr,"validateCompanyNewsCreateParams");var ie=class{constructor(e){this.client=e}client;static{r(this,"CompanyNewsResource")}async create(e){this.client._requireAuth(),Hr(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}},i=await this.client._request("POST","/query",{body:{query:Vr,variables:{input:n}}});if(Array.isArray(i?.errors)&&i.errors.length>0){let a=i.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,i.errors.map(c=>c?.message).filter(Boolean).join("; ")||"Company News creation failed",Yr[u]??502,{errors:i.errors})}let s=i?.data?.companyNews?.createFeed,o={feed_id:s?.id,cronjob_id:s?.producer?.id};if(typeof o!="object"||o===null||!("feed_id"in o)||!Ln(o.feed_id)||!("cronjob_id"in o)||!Ln(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 Ln(t){return typeof t=="string"&&t.trim()===t&&/^[1-9]\d{0,18}$/.test(t)&&BigInt(t)<=9223372036854775807n}r(Ln,"validID");var Wr="https://api-llm.prd.alva.ai",Kr="https://data-tools.prd.space.id";function xt(t){return typeof t=="object"&&t!==null}r(xt,"isRecord");function lt(t,e){if(!xt(t))return;let n=t[e];return typeof n=="string"&&n?n:void 0}r(lt,"stringField");function zr(t){if(t==null)return{};let e={};if(t instanceof Error){t.name&&(e.name=t.name),t.message&&(e.message=t.message);let i=lt(t,"code");i&&(e.code=i)}else if(xt(t)){let i=lt(t,"code"),s=lt(t,"name"),o=lt(t,"message");i&&(e.code=i),s&&(e.name=s),o&&(e.message=o)}else e.message=String(t);let n=[e.code,e.name,e.message].filter(i=>!!i);return{message:n.length>0?n.join(": "):void 0,details:Object.keys(e).length>0?e:void 0}}r(zr,"describeCause");function Jr(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:i,details:s}=zr(xt(t)?t.cause:void 0);return s&&(n.cause=s),{message:i?`${e}; cause: ${i}`:e,details:n}}r(Jr,"describeFetchFailure");var dt=class{static{r(this,"AlvaClient")}baseUrl;arraysBaseUrl;viewer_token;pbsvToken;apiKey;gaClientId;gaSessionId;utmParams;signal;originSessionId;originSessionKind;originInboxPath;_fs;_run;_deploy;_serviceAccount;_release;_feed;_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??Wr,this.arraysBaseUrl=e.arraysBaseUrl??Kr,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 Ie(this)}get run(){return this._run??=new Ce(this)}get deploy(){return this._deploy??=new xe(this)}get serviceAccount(){return this._serviceAccount??=new qe(this)}get release(){return this._release??=new Ne(this)}get feed(){return this._feed??=new Ue(this)}get automation(){return this._automation??=new K(this)}get playbooks(){return this._playbooks??=new Ge(this)}get secrets(){return this._secrets??=new Oe(this)}get sdk(){return this._sdk??=new Me(this)}get dataSkills(){return this._dataSkills??=new $e(this)}get playbookSkills(){return this._playbookSkills??=new je(this)}get comments(){return this._comments??=new Be(this)}get remix(){return this._remix??=new Qe(this)}get screenshot(){return this._screenshot??=new Ve(this)}get user(){return this._user??=new Ye(this)}get trading(){return this._trading??=new He(this)}get portfolio(){return this._portfolio??=new We(this)}get arraysJwt(){return this._arraysJwt??=new Ke(this)}get notifications(){return this._notifications??=new ze(this)}get notificationPreferences(){return this._notificationPreferences??=new Je(this)}get subscriptions(){return this._subscriptions??=new Xe(this)}get alerts(){return this._alerts??=new z(this)}get channelGroupSubscriptions(){return this._channelGroupSubscriptions??=new Ze(this)}get feedback(){return this._feedback??=new et(this)}get functions(){return this._functions??=new tt(this)}get credits(){return this._credits??=new nt(this)}get markets(){return this._markets??=new J(this)}get tradingPairs(){return this._tradingPairs??=new ee(this)}get schedules(){return this._schedules??=new X(this)}get steward(){return this._steward??=new Z(this)}get theses(){return this._theses??=new ne(this)}get companyNews(){return this._companyNews??=new ie(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 forYou(){return this._forYou??=new W(this)}async _request(e,n,i){let o=`${i?.baseUrl??this.baseUrl}${n}`;if(i?.query){let x=new URLSearchParams;for(let[L,pt]of Object.entries(i.query))pt!=null&&x.set(L,String(pt));let j=x.toString();j&&(o+=`?${j}`)}let a={};i?.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&&!i?.noAuth&&(a["X-Alva-Origin-Session-Id"]=this.originSessionId);let u;i?.rawBody!==void 0?(a["Content-Type"]="application/octet-stream",u=i.rawBody):i?.jsonBody!==void 0?(a["Content-Type"]="application/json",u=i.jsonBody):i?.body!==void 0&&(a["Content-Type"]="application/json",u=JSON.stringify(i.body));let c,d=i?.timeoutMs,h=i?.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,A=!1,D,ke;f&&d!==void 0&&(h&&(ke=r(()=>f.abort(h.reason),"abortListener"),h.addEventListener("abort",ke,{once:!0})),D=setTimeout(()=>{A=!0,f.abort(new Error(`Request timed out after ${d}ms while calling ${e} ${n}`))},d));let qt={method:e,headers:a,body:u,signal:f?.signal??h};d!==void 0&&(qt.timeout=d);try{c=await fetch(o,qt)}catch(x){if(h?.aborted&&!A)throw new l("NETWORK_ABORTED",`Request aborted while calling ${e} ${n}`,0,{method:e,path:n});if(A)throw new l("NETWORK_TIMEOUT",`Request timed out after ${d}ms while calling ${e} ${n}`,0,{method:e,path:n,timeout_ms:d});let j=Jr(x);throw new l("NETWORK_ERROR",j.message,0,{method:e,path:n,...j.details})}finally{ke&&h&&h.removeEventListener("abort",ke),D!==void 0&&clearTimeout(D)}if(!c.ok){let x="";try{x=await Promise.resolve(c.text())}catch{x=""}if((c.headers.get("content-type")??"").includes("application/json")&&x)try{let L=JSON.parse(x);if(L.error)throw new l(L.error.code??"UNKNOWN",L.error.message??`HTTP ${c.status}`,c.status)}catch(L){if(L instanceof l)throw L}throw new l("UNKNOWN",`HTTP ${c.status}: ${x.slice(0,200)}`,c.status)}if(c.status===204)return;let Nt=(c.headers.get("content-type")??"").toLowerCase();return Nt.includes("application/json")||Nt.includes("+json")?c.json():c.arrayBuffer()}};var Xr="0.32.0";bt();return jn(Zr);})();
|
|
361
361
|
//# sourceMappingURL=browser.global.js.map
|