@dvina/sdk 4.1.58 → 4.1.64

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.
Files changed (86) hide show
  1. package/dist/_generated_documents-XONZIXZ4.js +1 -0
  2. package/dist/adapters/angular/index.d.ts +1 -1
  3. package/dist/adapters/angular/index.js +1 -159
  4. package/dist/adapters/react/index.js +1 -49
  5. package/dist/billing/index.js +1 -5
  6. package/dist/chunk-5E7LX4YQ.js +1 -0
  7. package/dist/chunk-EK7ODJWE.js +1 -0
  8. package/dist/chunk-EOIDWBEZ.js +1 -0
  9. package/dist/chunk-G34ETQUN.js +1 -0
  10. package/dist/chunk-H3TI6B7T.js +1 -0
  11. package/dist/chunk-IIQ3WGOJ.js +1 -0
  12. package/dist/chunk-JQL7QV2D.js +5 -0
  13. package/dist/chunk-SJ6Q5IDB.js +31 -0
  14. package/dist/{client-K9LxSCVw.d.ts → client-D309vpHA.d.ts} +206 -1
  15. package/dist/index.d.ts +110 -3
  16. package/dist/index.js +1 -10
  17. package/dist/inference/index.js +1 -5
  18. package/dist/package.json +12 -48
  19. package/dist/pagination/index.js +1 -5
  20. package/package.json +13 -49
  21. package/dist/_generated_documents-2RBYHBRH.js +0 -4
  22. package/dist/_generated_documents-2RBYHBRH.js.map +0 -1
  23. package/dist/_generated_documents-3OGB3BZM.cjs +0 -2545
  24. package/dist/_generated_documents-3OGB3BZM.cjs.map +0 -1
  25. package/dist/adapters/angular/index.cjs +0 -163
  26. package/dist/adapters/angular/index.cjs.map +0 -1
  27. package/dist/adapters/angular/index.d.cts +0 -254
  28. package/dist/adapters/angular/index.js.map +0 -1
  29. package/dist/adapters/react/index.cjs +0 -51
  30. package/dist/adapters/react/index.cjs.map +0 -1
  31. package/dist/adapters/react/index.d.cts +0 -62
  32. package/dist/adapters/react/index.js.map +0 -1
  33. package/dist/billing/index.cjs +0 -26
  34. package/dist/billing/index.cjs.map +0 -1
  35. package/dist/billing/index.d.cts +0 -328
  36. package/dist/billing/index.js.map +0 -1
  37. package/dist/chunk-2J5WONKO.cjs +0 -1608
  38. package/dist/chunk-2J5WONKO.cjs.map +0 -1
  39. package/dist/chunk-342BFYZZ.cjs +0 -98
  40. package/dist/chunk-342BFYZZ.cjs.map +0 -1
  41. package/dist/chunk-5WRI5ZAA.js +0 -29
  42. package/dist/chunk-5WRI5ZAA.js.map +0 -1
  43. package/dist/chunk-7XBJ77RJ.js +0 -103
  44. package/dist/chunk-7XBJ77RJ.js.map +0 -1
  45. package/dist/chunk-AE5KAIKK.js +0 -24
  46. package/dist/chunk-AE5KAIKK.js.map +0 -1
  47. package/dist/chunk-AQ45E6MZ.cjs +0 -23951
  48. package/dist/chunk-AQ45E6MZ.cjs.map +0 -1
  49. package/dist/chunk-DLCUHX6I.js +0 -1064
  50. package/dist/chunk-DLCUHX6I.js.map +0 -1
  51. package/dist/chunk-DZUJEN5N.cjs +0 -32
  52. package/dist/chunk-DZUJEN5N.cjs.map +0 -1
  53. package/dist/chunk-FOKGSMXS.cjs +0 -27
  54. package/dist/chunk-FOKGSMXS.cjs.map +0 -1
  55. package/dist/chunk-IWQGSVFY.js +0 -23541
  56. package/dist/chunk-IWQGSVFY.js.map +0 -1
  57. package/dist/chunk-KEM6SUTS.js +0 -92
  58. package/dist/chunk-KEM6SUTS.js.map +0 -1
  59. package/dist/chunk-KV5SP7RP.cjs +0 -114
  60. package/dist/chunk-KV5SP7RP.cjs.map +0 -1
  61. package/dist/chunk-PDM2KR7T.js +0 -392
  62. package/dist/chunk-PDM2KR7T.js.map +0 -1
  63. package/dist/chunk-UELAE75E.cjs +0 -408
  64. package/dist/chunk-UELAE75E.cjs.map +0 -1
  65. package/dist/chunk-USR4MXFW.cjs +0 -1699
  66. package/dist/chunk-USR4MXFW.cjs.map +0 -1
  67. package/dist/chunk-WX7EFPHT.js +0 -1600
  68. package/dist/chunk-WX7EFPHT.js.map +0 -1
  69. package/dist/client-Bb2gD6Iz.d.cts +0 -488
  70. package/dist/client-X8guW4nw.d.cts +0 -7954
  71. package/dist/error-CsVoUTY8.d.cts +0 -95
  72. package/dist/index-D_Z25Pa1.d.cts +0 -79
  73. package/dist/index.cjs +0 -1979
  74. package/dist/index.cjs.map +0 -1
  75. package/dist/index.d.cts +0 -3716
  76. package/dist/index.js.map +0 -1
  77. package/dist/inference/index.cjs +0 -70
  78. package/dist/inference/index.cjs.map +0 -1
  79. package/dist/inference/index.d.cts +0 -80
  80. package/dist/inference/index.js.map +0 -1
  81. package/dist/pagination/index.cjs +0 -34
  82. package/dist/pagination/index.cjs.map +0 -1
  83. package/dist/pagination/index.d.cts +0 -6
  84. package/dist/pagination/index.js.map +0 -1
  85. package/dist/sync-engine-gpxyhQBl.d.cts +0 -478
  86. package/dist/types-Chg8ASmf.d.cts +0 -116
@@ -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};