@dvina/sdk 4.1.59 → 4.1.66
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/_generated_documents-VM6RSSXR.js +1 -0
- package/dist/adapters/angular/index.d.ts +2 -2
- package/dist/adapters/angular/index.js +1 -159
- package/dist/adapters/react/index.js +1 -49
- package/dist/billing/index.js +1 -5
- package/dist/chunk-5E7LX4YQ.js +1 -0
- package/dist/chunk-D2L26FRK.js +5 -0
- package/dist/chunk-EK7ODJWE.js +1 -0
- package/dist/chunk-G34ETQUN.js +1 -0
- package/dist/chunk-H3TI6B7T.js +1 -0
- package/dist/chunk-IIQ3WGOJ.js +1 -0
- package/dist/chunk-IO56LXKJ.js +1 -0
- package/dist/chunk-SJ6Q5IDB.js +31 -0
- package/dist/{client-D309vpHA.d.ts → client-CEoJfTM9.d.ts} +2 -257
- package/dist/{index-fFR5so7x.d.ts → index-BzmzBgTh.d.ts} +1 -1
- package/dist/index.d.ts +7 -134
- package/dist/index.js +1 -10
- package/dist/inference/index.js +1 -5
- package/dist/package.json +12 -48
- package/dist/pagination/index.d.ts +2 -2
- package/dist/pagination/index.js +1 -5
- package/dist/{sync-engine-BIaOIpU3.d.ts → sync-engine-Bh0UcTVd.d.ts} +13 -0
- package/package.json +13 -49
- package/dist/_generated_documents-GHGFCEAV.js +0 -4
- package/dist/_generated_documents-GHGFCEAV.js.map +0 -1
- package/dist/_generated_documents-Z5MUI5BE.cjs +0 -2777
- package/dist/_generated_documents-Z5MUI5BE.cjs.map +0 -1
- package/dist/adapters/angular/index.cjs +0 -163
- package/dist/adapters/angular/index.cjs.map +0 -1
- package/dist/adapters/angular/index.d.cts +0 -254
- package/dist/adapters/angular/index.js.map +0 -1
- package/dist/adapters/react/index.cjs +0 -51
- package/dist/adapters/react/index.cjs.map +0 -1
- package/dist/adapters/react/index.d.cts +0 -62
- package/dist/adapters/react/index.js.map +0 -1
- package/dist/billing/index.cjs +0 -26
- package/dist/billing/index.cjs.map +0 -1
- package/dist/billing/index.d.cts +0 -328
- package/dist/billing/index.js.map +0 -1
- package/dist/chunk-2J5WONKO.cjs +0 -1608
- package/dist/chunk-2J5WONKO.cjs.map +0 -1
- package/dist/chunk-342BFYZZ.cjs +0 -98
- package/dist/chunk-342BFYZZ.cjs.map +0 -1
- package/dist/chunk-5WRI5ZAA.js +0 -29
- package/dist/chunk-5WRI5ZAA.js.map +0 -1
- package/dist/chunk-7XBJ77RJ.js +0 -103
- package/dist/chunk-7XBJ77RJ.js.map +0 -1
- package/dist/chunk-AE5KAIKK.js +0 -24
- package/dist/chunk-AE5KAIKK.js.map +0 -1
- package/dist/chunk-COFT5ZYL.js +0 -23777
- package/dist/chunk-COFT5ZYL.js.map +0 -1
- package/dist/chunk-DZUJEN5N.cjs +0 -32
- package/dist/chunk-DZUJEN5N.cjs.map +0 -1
- package/dist/chunk-FOKGSMXS.cjs +0 -27
- package/dist/chunk-FOKGSMXS.cjs.map +0 -1
- package/dist/chunk-HHBDJ65K.cjs +0 -24198
- package/dist/chunk-HHBDJ65K.cjs.map +0 -1
- package/dist/chunk-KEM6SUTS.js +0 -92
- package/dist/chunk-KEM6SUTS.js.map +0 -1
- package/dist/chunk-KSVHC4YE.cjs +0 -1841
- package/dist/chunk-KSVHC4YE.cjs.map +0 -1
- package/dist/chunk-KV5SP7RP.cjs +0 -114
- package/dist/chunk-KV5SP7RP.cjs.map +0 -1
- package/dist/chunk-NH4SMZCW.js +0 -1148
- package/dist/chunk-NH4SMZCW.js.map +0 -1
- package/dist/chunk-PDM2KR7T.js +0 -392
- package/dist/chunk-PDM2KR7T.js.map +0 -1
- package/dist/chunk-UELAE75E.cjs +0 -408
- package/dist/chunk-UELAE75E.cjs.map +0 -1
- package/dist/chunk-WX7EFPHT.js +0 -1600
- package/dist/chunk-WX7EFPHT.js.map +0 -1
- package/dist/client-BRIS6DdR.d.cts +0 -8159
- package/dist/client-Bb2gD6Iz.d.cts +0 -488
- package/dist/error-CsVoUTY8.d.cts +0 -95
- package/dist/index-D_Z25Pa1.d.cts +0 -79
- package/dist/index.cjs +0 -2039
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -3823
- package/dist/index.js.map +0 -1
- package/dist/inference/index.cjs +0 -70
- package/dist/inference/index.cjs.map +0 -1
- package/dist/inference/index.d.cts +0 -80
- package/dist/inference/index.js.map +0 -1
- package/dist/pagination/index.cjs +0 -34
- package/dist/pagination/index.cjs.map +0 -1
- package/dist/pagination/index.d.cts +0 -6
- package/dist/pagination/index.js.map +0 -1
- package/dist/sync-engine-gpxyhQBl.d.cts +0 -478
- package/dist/types-Chg8ASmf.d.cts +0 -116
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var g=Object.create;var f=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var m=(b,a)=>()=>(a||b((a={exports:{}}).exports,a),a.exports);var l=(b,a,c,e)=>{if(a&&typeof a=="object"||typeof a=="function")for(let d of i(a))!k.call(b,d)&&d!==c&&f(b,d,{get:()=>a[d],enumerable:!(e=h(a,d))||e.enumerable});return b};var n=(b,a,c)=>(c=b!=null?g(j(b)):{},l(a||!b||!b.__esModule?f(c,"default",{value:b,enumerable:true}):c,b));export{m as a,n as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {e,c}from'./chunk-H3TI6B7T.js';function a(n){return n.nodes}function r(n,o){return new e(n._request,o._fetch,[...n.nodes,...o.nodes],new c({hasNextPage:o.pageInfo.hasNextPage,hasPreviousPage:n.pageInfo.hasPreviousPage,startCursor:n.pageInfo.startCursor,endCursor:o.pageInfo.endCursor}),o.totalCount??n.totalCount)}export{a,r as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var n=class{_request;_syncEngine;_subscribe;_baseUrl;constructor(e,s,o,i){this._request=e,this._syncEngine=s,this._subscribe=o,this._baseUrl=i;}};var u=50;function g(t){return {...t,first:t.first??(t.after?u:void 0),last:t.last??(t.before?u:void 0)}}var r=class{hasNextPage;hasPreviousPage;startCursor;endCursor;constructor(e){this.hasNextPage=e.hasNextPage,this.hasPreviousPage=e.hasPreviousPage,this.startCursor=e.startCursor,this.endCursor=e.endCursor;}},a=class extends n{pageInfo;nodes;totalCount;constructor(e){super(e),this.pageInfo=new r({hasNextPage:false,hasPreviousPage:false}),this.nodes=[];}},c=class extends a{_fetch;constructor(e,s,o,i,h){super(e),this._fetch=s,this.nodes=o,this.pageInfo=i,this.totalCount=h;}async fetchNext(e){if(this.pageInfo.hasNextPage){let s=await this._fetch({after:this.pageInfo.endCursor},e);s&&(this.nodes=[...this.nodes,...s.nodes],this.pageInfo.endCursor=s.pageInfo.endCursor??this.pageInfo.endCursor,this.pageInfo.hasNextPage=s.pageInfo.hasNextPage);}return this}async fetchPrevious(e){if(this.pageInfo.hasPreviousPage){let s=await this._fetch({before:this.pageInfo.startCursor},e);s&&(this.nodes=[...s.nodes,...this.nodes],this.pageInfo.startCursor=s.pageInfo.startCursor??this.pageInfo.startCursor,this.pageInfo.hasPreviousPage=s.pageInfo.hasPreviousPage);}return this}};export{n as a,g as b,r as c,a as d,c as e};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {a}from'./chunk-5E7LX4YQ.js';var o=class extends a{status;type;code;constructor(e,t,n,s,m){super(e,m),this.name="DvinaInferenceError",this.status=t,this.type=n,this.code=s;}},y=class extends o{retryAfter;constructor(e,t,n){super(e,429,"rate_limit_error","rate_limit_exceeded",n),this.name="DvinaRateLimitError",this.retryAfter=t;}},w=class extends o{constructor(e="Token quota exceeded",t){super(e,403,"insufficient_quota","token_limit_reached",t),this.name="DvinaQuotaError";}},_=class extends o{constructor(e="Inference authentication failed",t=401,n){super(e,t,"authentication_error","unauthorized",n),this.name="DvinaInferenceAuthError";}},p=class extends o{constructor(e,t){super(e,0,"stream_error","stream_interrupted",t),this.name="DvinaStreamError";}},g=class extends o{constructor(e="Context length exceeded",t){super(e,400,"invalid_request_error","context_length_exceeded",t),this.name="DvinaContextLengthError";}},k=class extends o{constructor(e="Request timed out",t){super(e,400,"timeout_error","request_timeout",t),this.name="DvinaTimeoutError";}},R=class extends o{constructor(e="Provider unavailable",t){super(e,502,"gateway_error","provider_unavailable",t),this.name="DvinaProviderUnavailableError";}},E=class extends o{constructor(e="Provider error",t=502,n){super(e,t,"api_error","provider_error",n),this.name="DvinaProviderError";}},b=class extends o{constructor(e="Deployment not found",t){super(e,502,"invalid_request_error","deployment_not_found",t),this.name="DvinaDeploymentError";}},x=class extends o{constructor(e="Unsupported model",t){super(e,400,"invalid_request_error","unsupported_model",t),this.name="DvinaUnsupportedModelError";}};async function*S(r){let e=r.getReader(),t=new TextDecoder,n="";try{for(;;){let{done:s,value:m}=await e.read();if(s){if(n.trim()){let a=N(n.trim());a!==void 0&&(yield a);}break}n+=t.decode(m,{stream:!0});let l=n.split(/\r?\n/);n=l.pop()??"";for(let a of l)if(a!==""&&!a.startsWith(":")){if(a.startsWith("data: ")){let f=a.slice(6);if(f==="[DONE]")return;try{yield JSON.parse(f);}catch{}}a.startsWith("event: error");}}}catch(s){throw new p(`SSE stream interrupted: ${s instanceof Error?s.message:String(s)}`,s instanceof Error?s:void 0)}finally{e.releaseLock();}}function N(r){if(!r.startsWith("data: "))return;let e=r.slice(6);if(e!=="[DONE]")try{return JSON.parse(e)}catch{return}}var v=class{_chunks=[];_source;_consumed=false;constructor(e){this._source=e;}async*[Symbol.asyncIterator](){if(this._consumed){for(let e of this._chunks)yield e;return}this._consumed=true;for await(let e of this._source)this._chunks.push(e),yield e;}getText(){let e=[];for(let t of this._chunks){let n=t.choices[0]?.delta?.content;n&&e.push(n);}return e.join("")}getUsage(){for(let e=this._chunks.length-1;e>=0;e--)if(this._chunks[e].usage)return this._chunks[e].usage}getChunks(){return this._chunks}};var U=12e4;async function P(r){let e;try{e=await r.json();}catch{}let t=e?.error?.message??`HTTP ${r.status}: ${r.statusText}`,n=e?.error?.type??"api_error",s=e?.error?.code??"unknown";if(r.status===401||r.status===403)throw s==="token_limit_reached"||n==="insufficient_quota"?new w(t):new _(t,r.status);if(r.status===429){let m=r.headers.get("retry-after"),l=m?parseInt(m,10):void 0;throw new y(t,Number.isNaN(l)?void 0:l)}switch(s){case "context_length_exceeded":throw new g(t);case "request_timeout":throw new k(t);case "provider_unavailable":throw new R(t);case "provider_error":throw new E(t,r.status);case "deployment_not_found":throw new b(t);case "unsupported_model":throw new x(t)}throw new o(t,r.status,n,s)}function z(r,e,t){return I(r,e,t?.headers,t?.timeout)}function B(r){let e=r.baseUrl.replace(/\/+$/,""),t;if(r.getToken)t=r.getToken;else if(r.token){let n=r.token;t=async()=>n;}else throw new Error("InferenceClientOptions must provide either `token` or `getToken`.");return I(e,t,r.headers,r.timeout)}function I(r,e,t,n){let s=n??U,m=t??{};async function l(){return {"Content-Type":"application/json",Authorization:`Bearer ${await e()}`,...m}}async function a(c,d,h){let C=new AbortController,u=setTimeout(()=>C.abort(),s);try{let i=await l(),T=await fetch(`${r}${d}`,{method:c,headers:i,body:h!==void 0?JSON.stringify(h):void 0,signal:C.signal});return T.ok||await P(T),await T.json()}catch(i){throw i instanceof o?i:i instanceof Error&&i.name==="AbortError"?new o(`Request timed out after ${s}ms`,0,"timeout_error","request_timeout"):new o(`Network error: ${i instanceof Error?i.message:String(i)}`,0,"network_error","connection_failed",i instanceof Error?i:void 0)}finally{clearTimeout(u);}}async function f(c,d){let h=new AbortController,C=setTimeout(()=>h.abort(),s);try{let u=await l(),i=await fetch(`${r}${c}`,{method:"POST",headers:u,body:JSON.stringify(d),signal:h.signal});if(clearTimeout(C),i.ok||await P(i),!i.body)throw new p("Response body is null \u2014 streaming not supported in this environment");return i.body}catch(u){throw clearTimeout(C),u instanceof o?u:u instanceof Error&&u.name==="AbortError"?new o(`Stream connection timed out after ${s}ms`,0,"timeout_error","request_timeout"):new o(`Network error: ${u instanceof Error?u.message:String(u)}`,0,"network_error","connection_failed",u instanceof Error?u:void 0)}}let D={completions:{async create(c){return a("POST","/chat/completions",{...c,stream:false})},async stream(c){let d=await f("/chat/completions",{...c,stream:true}),h=S(d);return new v(h)}}},O={async create(c){return a("POST","/responses",{...c,stream:false})},async stream(c){let d=await f("/responses",{...c,stream:true});return {[Symbol.asyncIterator](){return S(d)}}}},M={async list(){return a("GET","/models")},async get(c){return a("GET",`/models/${encodeURIComponent(c)}`)}};async function $(){return a("GET","/health")}return {chat:D,responses:O,models:M,health:$}}export{o as a,y as b,w as c,_ as d,p as e,g as f,k as g,R as h,E as i,b as j,x as k,S as l,v as m,z as n,B as o};
|