@alva-ai/toolkit 0.16.1-beta.2 → 0.17.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/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
|
@@ -40,5 +40,5 @@ query ToolkitCreditWalletItems($input: CreditWalletItemConnectionInput!) {
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
`.trim();function Ct(t){let e=t.map(r=>typeof r.message=="string"&&r.message?r.message:void 0).filter(r=>!!r);return e.length>0?e.join("; "):"GraphQL request failed"}s(Ct,"graphQLErrorMessage");var _e=class{constructor(e){this.client=e}client;static{s(this,"CreditsResource")}async wallet(){this.client._requireAuth();let r=(await this.graphql(wt)).viewer?.creditWallet;if(!r)throw new c("GRAPHQL_EMPTY_RESPONSE","GraphQL response did not include viewer.creditWallet",502);return r}async items(e){this.client._requireAuth();let i=(await this.graphql(At,{input:{startAtMs:e.startAtMs,endAtMs:e.endAtMs,sessionId:e.sessionId,first:e.first,after:e.after}})).viewer?.creditWallet;if(!i)throw new c("GRAPHQL_EMPTY_RESPONSE","GraphQL response did not include viewer.creditWallet.items",502);return i}async graphql(e,r){let i=await this.client._request("POST","/query",{body:r===void 0?{query:e}:{query:e,variables:r}});if(i.errors&&i.errors.length>0)throw new c("GRAPHQL_ERROR",Ct(i.errors),400,{errors:i.errors});if(!i.data)throw new c("GRAPHQL_EMPTY_RESPONSE","GraphQL response did not include data",502);return i.data}};var xt="https://api-llm.prd.alva.ai",Ft="https://data-tools.prd.space.id";function Ae(t){return typeof t=="object"&&t!==null}s(Ae,"isRecord");function ye(t,e){if(!Ae(t))return;let r=t[e];return typeof r=="string"&&r?r:void 0}s(ye,"stringField");function Gt(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=ye(t,"code");i&&(e.code=i)}else if(Ae(t)){let i=ye(t,"code"),n=ye(t,"name"),o=ye(t,"message");i&&(e.code=i),n&&(e.name=n),o&&(e.message=o)}else e.message=String(t);let r=[e.code,e.name,e.message].filter(i=>!!i);return{message:r.length>0?r.join(": "):void 0,details:Object.keys(e).length>0?e:void 0}}s(Gt,"describeCause");function It(t){let e=t instanceof Error&&t.message?t.message:"Network request failed",r={};t instanceof Error?(r.name=t.name,r.message=t.message):r.message=String(t);let{message:i,details:n}=Gt(Ae(t)?t.cause:void 0);return n&&(r.cause=n),{message:i?`${e}; cause: ${i}`:e,details:r}}s(It,"describeFetchFailure");var he=class{static{s(this,"AlvaClient")}baseUrl;arraysBaseUrl;viewer_token;pbsvToken;apiKey;gaClientId;gaSessionId;utmParams;signal;originSessionId;_fs;_run;_deploy;_serviceAccount;_release;_feed;_automation;_playbooks;_secrets;_sdk;_dataSkills;_playbookSkills;_comments;_remix;_screenshot;_user;_trading;_portfolio;_arraysJwt;_notifications;_notificationPreferences;_subscriptions;_alerts;_channelGroupSubscriptions;_feedback;_functions;_credits;constructor(e){this.baseUrl=e.baseUrl??xt,this.arraysBaseUrl=e.arraysBaseUrl??Ft,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}get fs(){return this._fs??=new W(this)}get run(){return this._run??=new V(this)}get deploy(){return this._deploy??=new H(this)}get serviceAccount(){return this._serviceAccount??=new Q(this)}get release(){return this._release??=new J(this)}get feed(){return this._feed??=new K(this)}get automation(){return this._automation??=new q(this)}get playbooks(){return this._playbooks??=new X(this)}get secrets(){return this._secrets??=new Y(this)}get sdk(){return this._sdk??=new Z(this)}get dataSkills(){return this._dataSkills??=new ee(this)}get playbookSkills(){return this._playbookSkills??=new te(this)}get comments(){return this._comments??=new re(this)}get remix(){return this._remix??=new ie(this)}get screenshot(){return this._screenshot??=new se(this)}get user(){return this._user??=new ne(this)}get trading(){return this._trading??=new oe(this)}get portfolio(){return this._portfolio??=new ae(this)}get arraysJwt(){return this._arraysJwt??=new ce(this)}get notifications(){return this._notifications??=new le(this)}get notificationPreferences(){return this._notificationPreferences??=new ue(this)}get subscriptions(){return this._subscriptions??=new pe(this)}get alerts(){return this._alerts??=new T(this)}get channelGroupSubscriptions(){return this._channelGroupSubscriptions??=new de(this)}get feedback(){return this._feedback??=new me(this)}get functions(){return this._functions??=new fe(this)}get credits(){return this._credits??=new _e(this)}_requireAuth(){if(!this.pbsvToken&&!this.viewer_token&&!this.apiKey)throw new c("UNAUTHENTICATED","Authentication is required. Pass pbsvToken, viewer_token, or apiKey in the constructor.",401)}async _request(e,r,i){let o=`${i?.baseUrl??this.baseUrl}${r}`;if(i?.query){let _=new URLSearchParams;for(let[b,ke]of Object.entries(i.query))ke!=null&&_.set(b,String(ke));let k=_.toString();k&&(o+=`?${k}`)}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 l;i?.rawBody!==void 0?(a["Content-Type"]="application/octet-stream",l=i.rawBody):i?.jsonBody!==void 0?(a["Content-Type"]="application/json",l=i.jsonBody):i?.body!==void 0&&(a["Content-Type"]="application/json",l=JSON.stringify(i.body));let u,d=i?.timeoutMs,f=i?.signal??this.signal;if(f?.aborted)throw new c("NETWORK_ABORTED",`Request aborted while calling ${e} ${r}`,0,{method:e,path:r});let D=d!==void 0?new AbortController:void 0,be=!1,ge,j;D&&d!==void 0&&(f&&(j=s(()=>D.abort(f.reason),"abortListener"),f.addEventListener("abort",j,{once:!0})),ge=setTimeout(()=>{be=!0,D.abort(new Error(`Request timed out after ${d}ms while calling ${e} ${r}`))},d));let Ce={method:e,headers:a,body:l,signal:D?.signal??f};d!==void 0&&(Ce.timeout=d);try{u=await fetch(o,Ce)}catch(_){if(f?.aborted&&!be)throw new c("NETWORK_ABORTED",`Request aborted while calling ${e} ${r}`,0,{method:e,path:r});if(be)throw new c("NETWORK_TIMEOUT",`Request timed out after ${d}ms while calling ${e} ${r}`,0,{method:e,path:r,timeout_ms:d});let k=It(_);throw new c("NETWORK_ERROR",k.message,0,{method:e,path:r,...k.details})}finally{j&&f&&f.removeEventListener("abort",j),ge!==void 0&&clearTimeout(ge)}if(!u.ok){let _="";try{_=await Promise.resolve(u.text())}catch{_=""}if((u.headers.get("content-type")??"").includes("application/json")&&_)try{let b=JSON.parse(_);if(b.error)throw new c(b.error.code??"UNKNOWN",b.error.message??`HTTP ${u.status}`,u.status)}catch(b){if(b instanceof c)throw b}throw new c("UNKNOWN",`HTTP ${u.status}: ${_.slice(0,200)}`,u.status)}if(u.status===204)return;let xe=(u.headers.get("content-type")??"").toLowerCase();return xe.includes("application/json")||xe.includes("+json")?u.json():u.arrayBuffer()}};var Ut="0.
|
|
43
|
+
`.trim();function Ct(t){let e=t.map(r=>typeof r.message=="string"&&r.message?r.message:void 0).filter(r=>!!r);return e.length>0?e.join("; "):"GraphQL request failed"}s(Ct,"graphQLErrorMessage");var _e=class{constructor(e){this.client=e}client;static{s(this,"CreditsResource")}async wallet(){this.client._requireAuth();let r=(await this.graphql(wt)).viewer?.creditWallet;if(!r)throw new c("GRAPHQL_EMPTY_RESPONSE","GraphQL response did not include viewer.creditWallet",502);return r}async items(e){this.client._requireAuth();let i=(await this.graphql(At,{input:{startAtMs:e.startAtMs,endAtMs:e.endAtMs,sessionId:e.sessionId,first:e.first,after:e.after}})).viewer?.creditWallet;if(!i)throw new c("GRAPHQL_EMPTY_RESPONSE","GraphQL response did not include viewer.creditWallet.items",502);return i}async graphql(e,r){let i=await this.client._request("POST","/query",{body:r===void 0?{query:e}:{query:e,variables:r}});if(i.errors&&i.errors.length>0)throw new c("GRAPHQL_ERROR",Ct(i.errors),400,{errors:i.errors});if(!i.data)throw new c("GRAPHQL_EMPTY_RESPONSE","GraphQL response did not include data",502);return i.data}};var xt="https://api-llm.prd.alva.ai",Ft="https://data-tools.prd.space.id";function Ae(t){return typeof t=="object"&&t!==null}s(Ae,"isRecord");function ye(t,e){if(!Ae(t))return;let r=t[e];return typeof r=="string"&&r?r:void 0}s(ye,"stringField");function Gt(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=ye(t,"code");i&&(e.code=i)}else if(Ae(t)){let i=ye(t,"code"),n=ye(t,"name"),o=ye(t,"message");i&&(e.code=i),n&&(e.name=n),o&&(e.message=o)}else e.message=String(t);let r=[e.code,e.name,e.message].filter(i=>!!i);return{message:r.length>0?r.join(": "):void 0,details:Object.keys(e).length>0?e:void 0}}s(Gt,"describeCause");function It(t){let e=t instanceof Error&&t.message?t.message:"Network request failed",r={};t instanceof Error?(r.name=t.name,r.message=t.message):r.message=String(t);let{message:i,details:n}=Gt(Ae(t)?t.cause:void 0);return n&&(r.cause=n),{message:i?`${e}; cause: ${i}`:e,details:r}}s(It,"describeFetchFailure");var he=class{static{s(this,"AlvaClient")}baseUrl;arraysBaseUrl;viewer_token;pbsvToken;apiKey;gaClientId;gaSessionId;utmParams;signal;originSessionId;_fs;_run;_deploy;_serviceAccount;_release;_feed;_automation;_playbooks;_secrets;_sdk;_dataSkills;_playbookSkills;_comments;_remix;_screenshot;_user;_trading;_portfolio;_arraysJwt;_notifications;_notificationPreferences;_subscriptions;_alerts;_channelGroupSubscriptions;_feedback;_functions;_credits;constructor(e){this.baseUrl=e.baseUrl??xt,this.arraysBaseUrl=e.arraysBaseUrl??Ft,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}get fs(){return this._fs??=new W(this)}get run(){return this._run??=new V(this)}get deploy(){return this._deploy??=new H(this)}get serviceAccount(){return this._serviceAccount??=new Q(this)}get release(){return this._release??=new J(this)}get feed(){return this._feed??=new K(this)}get automation(){return this._automation??=new q(this)}get playbooks(){return this._playbooks??=new X(this)}get secrets(){return this._secrets??=new Y(this)}get sdk(){return this._sdk??=new Z(this)}get dataSkills(){return this._dataSkills??=new ee(this)}get playbookSkills(){return this._playbookSkills??=new te(this)}get comments(){return this._comments??=new re(this)}get remix(){return this._remix??=new ie(this)}get screenshot(){return this._screenshot??=new se(this)}get user(){return this._user??=new ne(this)}get trading(){return this._trading??=new oe(this)}get portfolio(){return this._portfolio??=new ae(this)}get arraysJwt(){return this._arraysJwt??=new ce(this)}get notifications(){return this._notifications??=new le(this)}get notificationPreferences(){return this._notificationPreferences??=new ue(this)}get subscriptions(){return this._subscriptions??=new pe(this)}get alerts(){return this._alerts??=new T(this)}get channelGroupSubscriptions(){return this._channelGroupSubscriptions??=new de(this)}get feedback(){return this._feedback??=new me(this)}get functions(){return this._functions??=new fe(this)}get credits(){return this._credits??=new _e(this)}_requireAuth(){if(!this.pbsvToken&&!this.viewer_token&&!this.apiKey)throw new c("UNAUTHENTICATED","Authentication is required. Pass pbsvToken, viewer_token, or apiKey in the constructor.",401)}async _request(e,r,i){let o=`${i?.baseUrl??this.baseUrl}${r}`;if(i?.query){let _=new URLSearchParams;for(let[b,ke]of Object.entries(i.query))ke!=null&&_.set(b,String(ke));let k=_.toString();k&&(o+=`?${k}`)}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 l;i?.rawBody!==void 0?(a["Content-Type"]="application/octet-stream",l=i.rawBody):i?.jsonBody!==void 0?(a["Content-Type"]="application/json",l=i.jsonBody):i?.body!==void 0&&(a["Content-Type"]="application/json",l=JSON.stringify(i.body));let u,d=i?.timeoutMs,f=i?.signal??this.signal;if(f?.aborted)throw new c("NETWORK_ABORTED",`Request aborted while calling ${e} ${r}`,0,{method:e,path:r});let D=d!==void 0?new AbortController:void 0,be=!1,ge,j;D&&d!==void 0&&(f&&(j=s(()=>D.abort(f.reason),"abortListener"),f.addEventListener("abort",j,{once:!0})),ge=setTimeout(()=>{be=!0,D.abort(new Error(`Request timed out after ${d}ms while calling ${e} ${r}`))},d));let Ce={method:e,headers:a,body:l,signal:D?.signal??f};d!==void 0&&(Ce.timeout=d);try{u=await fetch(o,Ce)}catch(_){if(f?.aborted&&!be)throw new c("NETWORK_ABORTED",`Request aborted while calling ${e} ${r}`,0,{method:e,path:r});if(be)throw new c("NETWORK_TIMEOUT",`Request timed out after ${d}ms while calling ${e} ${r}`,0,{method:e,path:r,timeout_ms:d});let k=It(_);throw new c("NETWORK_ERROR",k.message,0,{method:e,path:r,...k.details})}finally{j&&f&&f.removeEventListener("abort",j),ge!==void 0&&clearTimeout(ge)}if(!u.ok){let _="";try{_=await Promise.resolve(u.text())}catch{_=""}if((u.headers.get("content-type")??"").includes("application/json")&&_)try{let b=JSON.parse(_);if(b.error)throw new c(b.error.code??"UNKNOWN",b.error.message??`HTTP ${u.status}`,u.status)}catch(b){if(b instanceof c)throw b}throw new c("UNKNOWN",`HTTP ${u.status}: ${_.slice(0,200)}`,u.status)}if(u.status===204)return;let xe=(u.headers.get("content-type")??"").toLowerCase();return xe.includes("application/json")||xe.includes("+json")?u.json():u.arrayBuffer()}};var Ut="0.17.0";Se();return ot(Nt);})();
|
|
44
44
|
//# sourceMappingURL=browser.global.js.map
|