@great-detail/support-sdk 0.4.7 → 0.4.9
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/{chunk-WMMLOVBE.js → chunk-DLYD4NAC.js} +1 -1
- package/dist/chunk-RG2RLFZA.js +1 -0
- package/dist/cli/index.cjs +1 -1
- package/dist/cli/index.d.cts +1 -1
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/cli.cjs +1 -1
- package/dist/cli.js +1 -1
- package/dist/{index-DNJOlCyr.d.cts → index-DmPG0eRh.d.cts} +102 -69
- package/dist/{index-DNJOlCyr.d.ts → index-DmPG0eRh.d.ts} +102 -69
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-K37WTNB5.js +0 -1
package/package.json
CHANGED
package/dist/chunk-K37WTNB5.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var Ft=Object.defineProperty;var qt=(r,t)=>{for(var e in t)Ft(r,e,{get:t[e],enumerable:!0})};var At="https://api.support.greatdetail.com",Tt={"X-Powered-By":"GDSupport/JavaScript"},Ht="api-key";import{z as n}from"zod";var l=class r{constructor(t){this._client=t}static SCHEMA=n.object({event:n.intersection(n.object({id:n.string(),createdAt:n.string().datetime()}),n.discriminatedUnion("type",[n.object({type:n.literal("contact.created"),contact:n.string()}),n.object({type:n.literal("message.created"),message:n.string()})]))});async event({request:t}){let{event:e}=r.SCHEMA.parse(t.body);return{event:e}}};var u=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/actions",{...t,method:"GET"})}};import{z as pt}from"zod";var g=class r{constructor(t){this._transport=t}static SCHEMA=pt.object({title:pt.string(),content:pt.string(),account:pt.string()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var m=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var h=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...e,method:"GET"})}};var f=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/boilerplates",{...t,method:"GET"})}};import{z as mt}from"zod";var b=class r{constructor(t){this._transport=t}static SCHEMA=mt.object({title:mt.string().optional(),content:mt.string().optional()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};import{z as ct}from"zod";var C=class r{constructor(t){this._transport=t}static SCHEMA=ct.object({title:ct.string(),description:ct.string().optional(),account:ct.string()});async send({body:t,request:e={}}){return this._transport.send("v1/boilerplate-categories",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(t))})}};var R=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var y=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/boilerplate-categories",{...t,method:"GET"})}};import{z as ht}from"zod";var A=class r{constructor(t){this._transport=t}static SCHEMA=ht.object({title:ht.string().optional(),description:ht.string().optional()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var T=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"})}};var te="SUPPORT_ACCESS_TOKEN",ee="SUPPORT_API_KEY",re="SUPPORT_KEY_NAME",xt="SUPPORT_BASE_URL";var x=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let s=e.variant??"vcard",i=e.format??(e.variant==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(s)+"&format="+encodeURIComponent(i)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}};import{z as _}from"zod";var S=class r{constructor(t){this._transport=t}static SCHEMA=_.object({name:_.string(),account:_.string(),emailAddress:_.string().email().optional(),telephoneNumber:_.string().optional()});async send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(t))})}};var v=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...e,method:"GET"})}};var O=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/contacts",{...t,method:"GET"})}};var E=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...e,method:"GET"})}};import{z as dt}from"zod";var F=class r{constructor(t){this._transport=t}static SCHEMA=dt.object({name:dt.string().optional(),emailAddress:dt.string().email().optional(),telephoneNumber:dt.string().optional()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var U=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...e,method:"GET"})}};var w=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var I=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/conversations",{...t,method:"GET"})}};var q=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};import{z as ft}from"zod";var L=class r{constructor(t){this._transport=t}static SCHEMA=ft.object({conversationStatus:ft.enum(["AwaitingContactConversationStatus","AwaitingAgentConversationStatus","ResolvedConversationStatus","ClosedConversationStatus"]).optional(),hasEnded:ft.boolean().optional()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};import{z as lt}from"zod";var H=class r{constructor(t){this._transport=t}static SCHEMA=lt.object({title:lt.string(),description:lt.string().optional(),account:lt.string()});async send({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(t))})}};var M=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var N=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var G=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/labels",{...t,method:"GET"})}};import{z as bt}from"zod";var j=class r{constructor(t){this._transport=t}static SCHEMA=bt.object({title:bt.string().optional(),description:bt.string().optional()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var B=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"})}};var z=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/messages",{...t,method:"GET"})}};import{z as ut}from"zod";var P=class r{constructor(t){this._transport=t}static SCHEMA=ut.object({input:ut.string().max(65536),original:ut.string().max(65536),correction:ut.string().max(65536)});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var D=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var J=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};import{z as gt}from"zod";var k=class r{constructor(t){this._transport=t}static SCHEMA=gt.array(gt.object({role:gt.enum(["user","assistant"]),content:gt.string().max(65536).nullable()})).min(1);async send({id:t,body:e,request:s={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};import{z as _t}from"zod";var V=class r{constructor(t){this._transport=t}static SCHEMA=_t.object({content:_t.string()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};import{z as St}from"zod";var c=class r{constructor(t){this._transport=t}static SCHEMA=St.object({content:St.string()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var K=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var Y=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var W=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};import{z as vt}from"zod";var $=class r{constructor(t){this._transport=t}static SCHEMA=vt.object({content:vt.string().optional()});async send({id:t,body:e,request:s={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};import{z as a}from"zod";var X=class r{constructor(t){this._transport=t}static SCHEMA=a.discriminatedUnion("type",[a.object({type:a.literal("vapid"),endpoint:a.string().url(),keys:a.object({p256dh:a.string(),auth:a.string()})})]);async send({id:t,body:e,request:s={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(r.SCHEMA.parse(e))})}};var Q=class r{constructor(t=r.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Tt;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var Z=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var tt=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/sources",{...t,method:"GET"})}};import Ut from"is-network-error";import wt,{HTTPError as It}from"ky";var o=class extends Error{};var p=class extends o{};var et=class extends p{static unauthenticated(){return new this("An unauthenticated request occurred")}};var rt=class extends p{static forbidden(){return new this("A forbidden request occurred")}};var d=class extends o{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,e){return new this(`Forbidden method for request: ${t} ${e}`)}};var st=class extends o{};var nt=class extends o{static badRequest(){return new this("Bad request")}};var ot=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=wt.create({prefixUrl:this.options.baseURL,hooks:{beforeRequest:[s=>{for(let i of this.options.requestFilterables){let Ot=i.getHeaders();for(let[yt,Et]of Object.entries(Ot))s.headers.has(yt)||s.headers.set(yt,Et)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}async send(t,e){return await this.client(t,e).catch(s=>{if(Ut(s))throw new st("A network error occurred",{cause:s});if(s instanceof It){let i=s.response.status;switch(console.error(JSON.stringify(s.response)),i){case 400:throw nt.badRequest();case 401:throw et.unauthenticated();case 403:throw rt.forbidden();case 404:throw d.notFound(t);case 405:throw d.forbiddenMethod(t,e.method??"GET")}}throw s})}};var it=class{constructor(t){this._transport=t}async send({files:t,request:e={}}){let s=new FormData;for(let i of t)s.append("file",i);return this._transport.send("v1/uploads",{...e,method:"POST",body:s})}};var at=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var Ct=class r{static DEFAULT_BASE_URL=At;_transport;constructor(t,{baseURL:e,...s}={}){this._transport=new ot({requestFilterables:[new Q,t],...s,baseURL:e?.toString()??r.getBaseURL()})}static getBaseURL(){return process.env[xt]??this.DEFAULT_BASE_URL}get action(){return{list:new u(this._transport)}}get boilerplate(){return{get:new m(this._transport),list:new f(this._transport),update:new b(this._transport)}}get boilerplateCategory(){return{get:new R(this._transport),list:new y(this._transport),create:new C(this._transport),update:new A(this._transport),boilerplate:{list:new h(this._transport),create:new g(this._transport)}}}get channel(){return{list:new T(this._transport)}}get contact(){return{get:new v(this._transport),list:new O(this._transport),update:new F(this._transport),create:new S(this._transport),conversation:{list:new w(this._transport)},note:{list:new Y(this._transport),create:new V(this._transport)},notificationSubscription:{create:new X(this._transport)},vcf:{get:new x(this._transport)}}}get conversation(){return{get:new U(this._transport),list:new I(this._transport),update:new L(this._transport),create:new c(this._transport),message:{list:new B(this._transport)},note:{list:new W(this._transport),create:new c(this._transport)}}}get label(){return{create:new H(this._transport),get:new N(this._transport),list:new G(this._transport),update:new j(this._transport),delete:new M(this._transport),contact:{list:new E(this._transport)},conversation:{list:new q(this._transport)}}}get message(){return{list:new z(this._transport)}}get model(){return{get:new D(this._transport),list:new J(this._transport),response:{create:new k(this._transport)},correction:{create:new P(this._transport)}}}get note(){return{get:new K(this._transport),update:new $(this._transport)}}get source(){return{get:new Z(this._transport),list:new tt(this._transport)}}get upload(){return{get:new at(this._transport),create:new it(this._transport)}}get webhook(){return new l(this)}};var Rt=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};export{qt as a,At as b,Ht as c,te as d,ee as e,re as f,o as g,p as h,et as i,rt as j,d as k,st as l,nt as m,Ct as n,Rt as o};
|