@great-detail/support-sdk 0.10.0 → 0.10.2

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.
@@ -0,0 +1 @@
1
+ import{b as v,o as b}from"./chunk-X7766EUY.js";import{Command as G}from"commander";import{Command as L}from"commander";import{oraPromise as N}from"ora";function r({client:t,ora:s}){let o=new L("actions").description("Actions");return o.addCommand(new L("list").description("List actions").action(async()=>{let n=await N(()=>t.action.list.send().json(),{...s,text:"Finding actions"});console.log(n)})),o}import{Command as D}from"commander";import{oraPromise as M}from"ora";function d({client:t,ora:s}){let o=new D("channels").description("Channels");return o.addCommand(new D("list").description("List channels").action(async()=>{let n=await M(()=>t.channel.list.send().json(),{...s,text:"Finding channels"});console.log(n)})),o}import{Command as a}from"commander";import{oraPromise as c}from"ora";function p({client:t,ora:s}){let o=new a("contacts").description("Contacts");return o.addCommand(new a("get").description("Find contact").argument("<contact>","Contact ID").action(async n=>{let i=await c(()=>t.contact.get.send(n).json(),{...s,text:"Finding contact"});console.log(i)})),o.addCommand(new a("list").description("List contacts").action(async()=>{let n=await c(()=>t.contact.list.send().json(),{...s,text:"Finding contacts"});console.log(n)})),o.addCommand(new a("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async n=>{let i=await c(()=>t.contact.vcf.get.send({id:n}).response(),{...s,text:"Exporting contact"});console.log(i)})),o}import{Command as l}from"commander";import{oraPromise as I}from"ora";function f({client:t,ora:s}){let o=new l("conversations").description("Conversations");return o.addCommand(new l("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async n=>{let i=await I(()=>t.conversation.get.send(n).json(),{...s,text:"Finding conversation"});console.log(i)})),o.addCommand(new l("list").description("List conversations").action(async()=>{let n=await I(()=>t.conversation.list.send().json(),{...s,text:"Finding conversations"});console.log(n)})),o}import{Command as m}from"commander";import{oraPromise as u}from"ora";function C({client:t,ora:s}){let o=new m("labels").description("Labels");return o.addCommand(new m("get").description("Find label").argument("<label>","Label ID").action(async n=>{let i=await u(()=>t.label.get.send(n).json(),{...s,text:"Finding label"});console.log(i)})),o.addCommand(new m("list").description("List labels").action(async()=>{let n=await u(()=>t.label.list.send().json(),{...s,text:"Finding labels"});console.log(n)})),o.addCommand(new m("conversations").description("Find label conversations").argument("<label>","Label ID").action(async n=>{let i=await u(()=>t.label.conversation.list.send(n).json(),{...s,text:"Finding conversations"});console.log(i)})),o}import{Command as P}from"commander";import{oraPromise as W}from"ora";function g({client:t,ora:s}){let o=new P("messages").description("Messages");return o.addCommand(new P("list").description("List messages").action(async()=>{let n=await W(()=>t.message.list.send().json(),{...s,text:"Finding messages"});console.log(n)})),o}import{Command as w}from"commander";import{oraPromise as K}from"ora";function O({client:t,ora:s}){let o=new w("models").description("Models");return o.addCommand(new w("get").description("Find model").argument("<model>","Model ID").action(async n=>{let i=await K(()=>t.model.get.send(n).json(),{...s,text:"Finding model"});console.log(i)})),o.addCommand(new w("list").description("List models").action(async()=>{let n=await K(()=>t.model.list.send().json(),{...s,text:"Finding models"});console.log(n)})),o}import{Command as x}from"commander";import{oraPromise as h}from"ora";function y({client:t,ora:s}){let o=new x("sources").description("Sources");return o.addCommand(new x("get").description("Find source").argument("<source>","Source ID").action(async n=>{let i=await h(()=>t.source.get.send(n).json(),{...s,text:"Finding source"});console.log(i)})),o.addCommand(new x("list").description("List sources").action(async()=>{let n=await h(()=>t.source.list.send().json(),{...s,text:"Finding sources"});console.log(n)})),o}import{Command as E}from"commander";import{Command as S}from"commander";import{oraPromise as A}from"ora";function j({client:t,ora:s}){let o=new S("notifications").description("Well-Known Notifications Details");return o.addCommand(new S("get").description("Get Notifications Server Well-Known Info").action(async()=>{let n=await A(()=>t.wellKnown.notification.get.send().json(),{...s,text:"Finding Notifications Well-Known Info"});console.log(n)})),o}function F({client:t,ora:s}){let o=new E("well-known").description("Well-Known Metadata & Info");return o.addCommand(j({client:t,ora:s})),o}var e={ora:{spinner:"simpleDotsScrolling"},client:new b(new v)},k=new G("gds").description("Great Detail Support System").addCommand(r(e)).addCommand(d(e)).addCommand(p(e)).addCommand(f(e)).addCommand(C(e)).addCommand(g(e)).addCommand(O(e)).addCommand(y(e)).addCommand(F(e)),Po=k;export{Po as a};
@@ -1 +1 @@
1
- var Ut=Object.defineProperty;var qt=(o,t)=>{for(var e in t)Ut(o,e,{get:t[e],enumerable:!0})};var Rt=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var Tt="https://api.support.greatdetail.com",_t={"X-Powered-By":"GDSupport/JavaScript"},Gt="api-key";import{z as a}from"zod";var u=class o{constructor(t){this._client=t}static SCHEMA=a.object({event:a.intersection(a.object({id:a.string(),createdAt:a.string().datetime()}),a.discriminatedUnion("type",[a.object({type:a.literal("contact.created"),contact:a.string()}),a.object({type:a.literal("message.created"),message:a.string()})]))});async event({request:t}){let{event:e}=o.SCHEMA.parse(t.body);return{event:e}}};var m=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/actions",{...t,method:"GET"})}};var h=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplates",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var C=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var f=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...e,method:"GET"})}};var g=class{constructor(t){this._transport=t}send({query:t,request:e={}}={}){return this._transport.send("v1/boilerplates",{...e,method:"GET",searchParams:[...this._transport.queryQuery(t)]})}};var b=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var R=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplate-categories",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var y=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var x=class{constructor(t){this._transport=t}send({include:t,request:e={}}={}){return this._transport.send("v1/boilerplate-categories",{...e,method:"GET",searchParams:[...this._transport.includeQuery(t??{})]})}};var T=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var _=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var O=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var v=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"})}};import{z as Ot}from"zod";var L=class o{constructor(t){this._transport=t}static SCHEMA=Ot.object({overwrite:Ot.boolean().optional()});send(t,{body:e,request:r={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:o.SCHEMA.parse(e)})}};var U=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var F=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var S=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}};var I=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...e,method:"GET"})}};var q=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/composition-sections",{...t,method:"GET"})}};var w=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var se="SUPPORT_ACCESS_TOKEN",ae="SUPPORT_API_KEY",pe="SUPPORT_KEY_NAME",vt="SUPPORT_BASE_URL";var E=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let r=e.variant??"vcard",n=e.format??(r==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(r)+"&format="+encodeURIComponent(n)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}send(t){return this._transport.send(this.getURL(t),{method:"GET"})}};var G=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var P=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var B=class{constructor(t){this._transport=t}send({query:t,request:e={}}={}){return this._transport.send("v1/contacts",{...e,method:"GET",searchParams:[...this._transport.queryQuery(t)]})}};var A=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...e,method:"GET"})}};var N=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var M=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var j=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var H=class{constructor(t){this._transport=t}send({filter:t,include:e,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...t?[["filter",t]]:[],...this._transport.includeQuery(e??{})]})}};var D=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var k=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var V=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var K=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var Q=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var z=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...e,method:"GET"})}};var Y=class{constructor(t){this._transport=t}send({query:t,include:e,request:r={}}={}){return this._transport.send("v1/labels",{...r,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.includeQuery(e??{})]})}};var $=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var J=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"})}};var W=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var X=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/messages",{...t,method:"GET"})}};var Z=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var tt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var et=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var ot=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var rt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var l=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var nt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var st=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var at=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var pt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var it=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var ct=class o{constructor(t=o.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=_t;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var lt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var dt=class{constructor(t){this._transport=t}send({category:t,request:e={}}={}){let r=[];if(t){let n=Array.isArray(t)?t:[t];for(let p of n)r.push(["category",p])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:r})}};import Ft from"is-network-error";import St,{HTTPError as It}from"ky";var s=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var c=class extends s{};var ut=class extends c{static unauthenticated(){return new this("An unauthenticated request occurred")}};var mt=class extends c{static forbidden(){return new this("A forbidden request occurred")}};var i=class extends s{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}`)}static teapot(){return new this("I'm a teapot")}static rateLimited(){return new this("Request has been rate-limited")}};var ht=class extends s{};var d=class extends s{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var Ct=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=St.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[r=>{for(let n of this.options.requestFilterables){let p=n.getHeaders();for(let[xt,Lt]of Object.entries(p))r.headers.has(xt)||r.headers.set(xt,Lt)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}includeQuery(t){let e=[];for(let r of Object.keys(t))e.push(["include",r]);return e}queryQuery(t){let e=[];return t&&e.push(["query",t]),e}send(t,e){let r=this.client(t,e).catch(n=>{if(Ft(n))throw new ht("A network error occurred",{cause:n});if(n instanceof It){let p=n.response.status;switch(console.error(JSON.stringify(n.response)),p){case 400:throw d.badRequest();case 401:throw ut.unauthenticated();case 403:throw mt.forbidden();case 404:throw i.notFound(t);case 405:throw i.forbiddenMethod(t,e.method??"GET");case 415:throw d.unsupportedMediaType();case 418:throw i.teapot();case 429:throw i.rateLimited()}if(p>=500&&p<600)throw s.serverError(p)}throw n});return{response:()=>r,json:async()=>(await r).json()}}};var ft=class{constructor(t){this._transport=t}send({account:t,files:e,request:r={}}){let n=new FormData;for(let p of e)n.append("file",p);return this._transport.send("v1/uploads",{...r,method:"POST",body:n,searchParams:{account:t}})}};var gt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var bt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var yt=class o{static DEFAULT_BASE_URL=Tt;_transport;constructor(t,{baseURL:e,...r}={}){this._transport=new Ct({requestFilterables:[new ct,t],...r,baseURL:e?.toString()??o.getBaseURL()})}static getBaseURL(){return process.env[vt]??this.DEFAULT_BASE_URL}get action(){return{list:new m(this._transport)}}get boilerplate(){return{get:new C(this._transport),list:new g(this._transport),update:new b(this._transport),create:new h(this._transport)}}get boilerplateCategory(){return{get:new y(this._transport),list:new x(this._transport),create:new R(this._transport),update:new T(this._transport),boilerplate:{list:new f(this._transport)}}}get channel(){return{get:new O(this._transport),list:new v(this._transport),update:new U(this._transport),create:new _(this._transport),compositionSection:{list:new I(this._transport)},message:{list:new J(this._transport)},twilioSendgrid:{sync:new L(this._transport)}}}get compositionSection(){return{get:new S(this._transport),list:new q(this._transport),create:new F(this._transport),update:new w(this._transport)}}get contact(){return{get:new P(this._transport),list:new B(this._transport),update:new N(this._transport),create:new G(this._transport),conversation:{list:new j(this._transport)},note:{list:new st(this._transport),create:new rt(this._transport)},notificationSubscription:{create:new it(this._transport)},vcf:{get:new E(this._transport)}}}get conversation(){return{get:new M(this._transport),list:new H(this._transport),update:new k(this._transport),create:new l(this._transport),label:{list:new z(this._transport)},message:{list:new W(this._transport)},note:{list:new at(this._transport),create:new l(this._transport)}}}get label(){return{create:new V(this._transport),get:new Q(this._transport),list:new Y(this._transport),update:new $(this._transport),delete:new K(this._transport),contact:{list:new A(this._transport)},conversation:{list:new D(this._transport)}}}get message(){return{list:new X(this._transport)}}get model(){return{get:new tt(this._transport),list:new et(this._transport),response:{create:new ot(this._transport)},correction:{create:new Z(this._transport)}}}get note(){return{get:new nt(this._transport),update:new pt(this._transport)}}get source(){return{get:new lt(this._transport),list:new dt(this._transport)}}get upload(){return{get:new bt(this._transport),create:new ft(this._transport),delete:new gt(this._transport)}}get webhook(){return new u(this)}};export{qt as a,Rt as b,se as c,ae as d,pe as e,Tt as f,Gt as g,s as h,c as i,ut as j,mt as k,i as l,ht as m,d as n,yt as o};
1
+ var Ft=Object.defineProperty;var qt=(o,t)=>{for(var e in t)Ft(o,e,{get:t[e],enumerable:!0})};var yt=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var _t="https://api.support.greatdetail.com",Ot={"X-Powered-By":"GDSupport/JavaScript"},Pt="api-key";import{z as a}from"zod";var u=class o{constructor(t){this._client=t}static SCHEMA=a.object({event:a.intersection(a.object({id:a.string(),createdAt:a.string().datetime()}),a.discriminatedUnion("type",[a.object({type:a.literal("contact.created"),contact:a.string()}),a.object({type:a.literal("message.created"),message:a.string()})]))});async event({request:t}){let{event:e}=o.SCHEMA.parse(t.body);return{event:e}}};var m=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/actions",{...t,method:"GET"})}};var h=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplates",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var C=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var f=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...e,method:"GET"})}};var g=class{constructor(t){this._transport=t}send({query:t,request:e={}}={}){return this._transport.send("v1/boilerplates",{...e,method:"GET",searchParams:[...this._transport.queryQuery(t)]})}};var b=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var R=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplate-categories",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var y=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var x=class{constructor(t){this._transport=t}send({include:t,request:e={}}={}){return this._transport.send("v1/boilerplate-categories",{...e,method:"GET",searchParams:[...this._transport.includeQuery(t??{})]})}};var T=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var _=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var O=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var v=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"})}};import{z as vt}from"zod";var L=class o{constructor(t){this._transport=t}static SCHEMA=vt.object({overwrite:vt.boolean().optional()});send(t,{body:e,request:r={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:o.SCHEMA.parse(e)})}};var U=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var F=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var S=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}};var I=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...e,method:"GET"})}};var w=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/composition-sections",{...t,method:"GET"})}};var q=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var ae="SUPPORT_ACCESS_TOKEN",pe="SUPPORT_API_KEY",ie="SUPPORT_KEY_NAME",Lt="SUPPORT_BASE_URL";var E=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let r=e.variant??"vcard",n=e.format??(r==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(r)+"&format="+encodeURIComponent(n)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}send(t){return this._transport.send(this.getURL(t),{method:"GET"})}};var G=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var P=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var N=class{constructor(t){this._transport=t}send({query:t,request:e={}}={}){return this._transport.send("v1/contacts",{...e,method:"GET",searchParams:[...this._transport.queryQuery(t)]})}};var B=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...e,method:"GET"})}};var A=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var M=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var j=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var H=class{constructor(t){this._transport=t}send({filter:t,include:e,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...t?[["filter",t]]:[],...this._transport.includeQuery(e??{})]})}};var D=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var k=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var K=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var V=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var Q=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var W=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...e,method:"GET"})}};var z=class{constructor(t){this._transport=t}send({query:t,include:e,request:r={}}={}){return this._transport.send("v1/labels",{...r,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.includeQuery(e??{})]})}};var Y=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var $=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"})}};var J=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var X=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/messages",{...t,method:"GET"})}};var Z=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var tt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var et=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var ot=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var rt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var l=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var nt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var st=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var at=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var pt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var it=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var ct=class o{constructor(t=o.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Ot;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var lt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var dt=class{constructor(t){this._transport=t}send({category:t,request:e={}}={}){let r=[];if(t){let n=Array.isArray(t)?t:[t];for(let p of n)r.push(["category",p])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:r})}};import St from"is-network-error";import It,{HTTPError as wt}from"ky";var s=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var c=class extends s{};var ut=class extends c{static unauthenticated(){return new this("An unauthenticated request occurred")}};var mt=class extends c{static forbidden(){return new this("A forbidden request occurred")}};var i=class extends s{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}`)}static teapot(){return new this("I'm a teapot")}static rateLimited(){return new this("Request has been rate-limited")}};var ht=class extends s{};var d=class extends s{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var Ct=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=It.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[r=>{for(let n of this.options.requestFilterables){let p=n.getHeaders();for(let[Tt,Ut]of Object.entries(p))r.headers.has(Tt)||r.headers.set(Tt,Ut)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}includeQuery(t){let e=[];for(let r of Object.keys(t))e.push(["include",r]);return e}queryQuery(t){let e=[];return t&&e.push(["query",t]),e}send(t,e){let r=this.client(t,e).catch(n=>{if(St(n))throw new ht("A network error occurred",{cause:n});if(n instanceof wt){let p=n.response.status;switch(console.error(JSON.stringify(n.response)),p){case 400:throw d.badRequest();case 401:throw ut.unauthenticated();case 403:throw mt.forbidden();case 404:throw i.notFound(t);case 405:throw i.forbiddenMethod(t,e.method??"GET");case 415:throw d.unsupportedMediaType();case 418:throw i.teapot();case 429:throw i.rateLimited()}if(p>=500&&p<600)throw s.serverError(p)}throw n});return{response:()=>r,json:async()=>(await r).json()}}};var ft=class{constructor(t){this._transport=t}send({account:t,files:e,request:r={}}){let n=new FormData;for(let p of e)n.append("file",p);return this._transport.send("v1/uploads",{...r,method:"POST",body:n,searchParams:{account:t}})}};var gt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var bt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var Rt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var xt=class o{static DEFAULT_BASE_URL=_t;_transport;constructor(t,{baseURL:e,...r}={}){this._transport=new Ct({requestFilterables:[new ct,t],...r,baseURL:e?.toString()??o.getBaseURL()})}static getBaseURL(){return process.env[Lt]??this.DEFAULT_BASE_URL}get action(){return{list:new m(this._transport)}}get boilerplate(){return{get:new C(this._transport),list:new g(this._transport),update:new b(this._transport),create:new h(this._transport)}}get boilerplateCategory(){return{get:new y(this._transport),list:new x(this._transport),create:new R(this._transport),update:new T(this._transport),boilerplate:{list:new f(this._transport)}}}get channel(){return{get:new O(this._transport),list:new v(this._transport),update:new U(this._transport),create:new _(this._transport),compositionSection:{list:new I(this._transport)},message:{list:new $(this._transport)},twilioSendgrid:{sync:new L(this._transport)}}}get compositionSection(){return{get:new S(this._transport),list:new w(this._transport),create:new F(this._transport),update:new q(this._transport)}}get contact(){return{get:new P(this._transport),list:new N(this._transport),update:new A(this._transport),create:new G(this._transport),conversation:{list:new j(this._transport)},note:{list:new st(this._transport),create:new rt(this._transport)},notificationSubscription:{create:new it(this._transport)},vcf:{get:new E(this._transport)}}}get conversation(){return{get:new M(this._transport),list:new H(this._transport),update:new k(this._transport),create:new l(this._transport),label:{list:new W(this._transport)},message:{list:new J(this._transport)},note:{list:new at(this._transport),create:new l(this._transport)}}}get label(){return{create:new K(this._transport),get:new Q(this._transport),list:new z(this._transport),update:new Y(this._transport),delete:new V(this._transport),contact:{list:new B(this._transport)},conversation:{list:new D(this._transport)}}}get message(){return{list:new X(this._transport)}}get model(){return{get:new tt(this._transport),list:new et(this._transport),response:{create:new ot(this._transport)},correction:{create:new Z(this._transport)}}}get note(){return{get:new nt(this._transport),update:new pt(this._transport)}}get source(){return{get:new lt(this._transport),list:new dt(this._transport)}}get upload(){return{get:new bt(this._transport),create:new ft(this._transport),delete:new gt(this._transport)}}get webhook(){return new u(this)}get wellKnown(){return{notification:{get:new Rt(this._transport)}}}};export{qt as a,yt as b,ae as c,pe as d,ie as e,_t as f,Pt as g,s as h,c as i,ut as j,mt as k,i as l,ht as m,d as n,xt as o};
@@ -1 +1 @@
1
- "use strict";var ne=Object.create;var _t=Object.defineProperty;var se=Object.getOwnPropertyDescriptor;var ae=Object.getOwnPropertyNames;var ie=Object.getPrototypeOf,pe=Object.prototype.hasOwnProperty;var ce=(o,t)=>{for(var e in t)_t(o,e,{get:t[e],enumerable:!0})},zt=(o,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of ae(t))!pe.call(o,n)&&n!==e&&_t(o,n,{get:()=>t[n],enumerable:!(r=se(t,n))||r.enumerable});return o};var Yt=(o,t,e)=>(e=o!=null?ne(ie(o)):{},zt(t||!o||!o.__esModule?_t(e,"default",{value:o,enumerable:!0}):e,o)),de=o=>zt(_t({},"__esModule",{value:!0}),o);var ue={};ce(ue,{default:()=>me});module.exports=de(ue);var oe=require("commander");var u=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var C=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/actions",{...t,method:"GET"})}};var h=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplates",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var f=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var g=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...e,method:"GET"})}};var b=class{constructor(t){this._transport=t}send({query:t,request:e={}}={}){return this._transport.send("v1/boilerplates",{...e,method:"GET",searchParams:[...this._transport.queryQuery(t)]})}};var x=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var y=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplate-categories",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var R=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var O=class{constructor(t){this._transport=t}send({include:t,request:e={}}={}){return this._transport.send("v1/boilerplate-categories",{...e,method:"GET",searchParams:[...this._transport.includeQuery(t??{})]})}};var T=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var _=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var v=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var L=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"})}};var It=require("zod"),w=class o{constructor(t){this._transport=t}static SCHEMA=It.z.object({overwrite:It.z.boolean().optional()});send(t,{body:e,request:r={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:o.SCHEMA.parse(e)})}};var F=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var U=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var S=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}};var I=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...e,method:"GET"})}};var q=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/composition-sections",{...t,method:"GET"})}};var E=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var $t="SUPPORT_BASE_URL";var Jt="https://api.support.greatdetail.com",Wt={"X-Powered-By":"GDSupport/JavaScript"};var P=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let r=e.variant??"vcard",n=e.format??(r==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(r)+"&format="+encodeURIComponent(n)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}send(t){return this._transport.send(this.getURL(t),{method:"GET"})}};var G=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var A=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var B=class{constructor(t){this._transport=t}send({query:t,request:e={}}={}){return this._transport.send("v1/contacts",{...e,method:"GET",searchParams:[...this._transport.queryQuery(t)]})}};var j=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...e,method:"GET"})}};var N=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var M=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var D=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var H=class{constructor(t){this._transport=t}send({filter:t,include:e,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...t?[["filter",t]]:[],...this._transport.includeQuery(e??{})]})}};var k=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var V=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var K=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var Q=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var z=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var Y=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...e,method:"GET"})}};var $=class{constructor(t){this._transport=t}send({query:t,include:e,request:r={}}={}){return this._transport.send("v1/labels",{...r,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.includeQuery(e??{})]})}};var J=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var W=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"})}};var X=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var Z=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/messages",{...t,method:"GET"})}};var tt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var et=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var ot=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var rt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var nt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var l=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var st=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var at=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var it=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var pt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var ct=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var dt=class o{constructor(t=o.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Wt;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var lt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var mt=class{constructor(t){this._transport=t}send({category:t,request:e={}}={}){let r=[];if(t){let n=Array.isArray(t)?t:[t];for(let i of n)r.push(["category",i])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:r})}};var Xt=Yt(require("is-network-error"),1),vt=Yt(require("ky"),1);var s=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var d=class extends s{};var ut=class extends d{static unauthenticated(){return new this("An unauthenticated request occurred")}};var Ct=class extends d{static forbidden(){return new this("A forbidden request occurred")}};var p=class extends s{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}`)}static teapot(){return new this("I'm a teapot")}static rateLimited(){return new this("Request has been rate-limited")}};var ht=class extends s{};var m=class extends s{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var ft=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=vt.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[r=>{for(let n of this.options.requestFilterables){let i=n.getHeaders();for(let[Qt,re]of Object.entries(i))r.headers.has(Qt)||r.headers.set(Qt,re)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}includeQuery(t){let e=[];for(let r of Object.keys(t))e.push(["include",r]);return e}queryQuery(t){let e=[];return t&&e.push(["query",t]),e}send(t,e){let r=this.client(t,e).catch(n=>{if((0,Xt.default)(n))throw new ht("A network error occurred",{cause:n});if(n instanceof vt.HTTPError){let i=n.response.status;switch(console.error(JSON.stringify(n.response)),i){case 400:throw m.badRequest();case 401:throw ut.unauthenticated();case 403:throw Ct.forbidden();case 404:throw p.notFound(t);case 405:throw p.forbiddenMethod(t,e.method??"GET");case 415:throw m.unsupportedMediaType();case 418:throw p.teapot();case 429:throw p.rateLimited()}if(i>=500&&i<600)throw s.serverError(i)}throw n});return{response:()=>r,json:async()=>(await r).json()}}};var gt=class{constructor(t){this._transport=t}send({account:t,files:e,request:r={}}){let n=new FormData;for(let i of e)n.append("file",i);return this._transport.send("v1/uploads",{...r,method:"POST",body:n,searchParams:{account:t}})}};var bt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var xt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var a=require("zod"),yt=class o{constructor(t){this._client=t}static SCHEMA=a.z.object({event:a.z.intersection(a.z.object({id:a.z.string(),createdAt:a.z.string().datetime()}),a.z.discriminatedUnion("type",[a.z.object({type:a.z.literal("contact.created"),contact:a.z.string()}),a.z.object({type:a.z.literal("message.created"),message:a.z.string()})]))});async event({request:t}){let{event:e}=o.SCHEMA.parse(t.body);return{event:e}}};var Rt=class o{static DEFAULT_BASE_URL=Jt;_transport;constructor(t,{baseURL:e,...r}={}){this._transport=new ft({requestFilterables:[new dt,t],...r,baseURL:e?.toString()??o.getBaseURL()})}static getBaseURL(){return process.env[$t]??this.DEFAULT_BASE_URL}get action(){return{list:new C(this._transport)}}get boilerplate(){return{get:new f(this._transport),list:new b(this._transport),update:new x(this._transport),create:new h(this._transport)}}get boilerplateCategory(){return{get:new R(this._transport),list:new O(this._transport),create:new y(this._transport),update:new T(this._transport),boilerplate:{list:new g(this._transport)}}}get channel(){return{get:new v(this._transport),list:new L(this._transport),update:new F(this._transport),create:new _(this._transport),compositionSection:{list:new I(this._transport)},message:{list:new W(this._transport)},twilioSendgrid:{sync:new w(this._transport)}}}get compositionSection(){return{get:new S(this._transport),list:new q(this._transport),create:new U(this._transport),update:new E(this._transport)}}get contact(){return{get:new A(this._transport),list:new B(this._transport),update:new N(this._transport),create:new G(this._transport),conversation:{list:new D(this._transport)},note:{list:new at(this._transport),create:new nt(this._transport)},notificationSubscription:{create:new ct(this._transport)},vcf:{get:new P(this._transport)}}}get conversation(){return{get:new M(this._transport),list:new H(this._transport),update:new V(this._transport),create:new l(this._transport),label:{list:new Y(this._transport)},message:{list:new X(this._transport)},note:{list:new it(this._transport),create:new l(this._transport)}}}get label(){return{create:new K(this._transport),get:new z(this._transport),list:new $(this._transport),update:new J(this._transport),delete:new Q(this._transport),contact:{list:new j(this._transport)},conversation:{list:new k(this._transport)}}}get message(){return{list:new Z(this._transport)}}get model(){return{get:new et(this._transport),list:new ot(this._transport),response:{create:new rt(this._transport)},correction:{create:new tt(this._transport)}}}get note(){return{get:new st(this._transport),update:new pt(this._transport)}}get source(){return{get:new lt(this._transport),list:new mt(this._transport)}}get upload(){return{get:new xt(this._transport),create:new gt(this._transport),delete:new bt(this._transport)}}get webhook(){return new yt(this)}};var qt=require("commander"),Zt=require("ora");function Et({client:o,ora:t}){let e=new qt.Command("actions").description("Actions");return e.addCommand(new qt.Command("list").description("List actions").action(async()=>{let r=await(0,Zt.oraPromise)(()=>o.action.list.send().json(),{...t,text:"Finding actions"});console.log(r)})),e}var Pt=require("commander"),te=require("ora");function Gt({client:o,ora:t}){let e=new Pt.Command("channels").description("Channels");return e.addCommand(new Pt.Command("list").description("List channels").action(async()=>{let r=await(0,te.oraPromise)(()=>o.channel.list.send().json(),{...t,text:"Finding channels"});console.log(r)})),e}var Ot=require("commander"),Lt=require("ora");function At({client:o,ora:t}){let e=new Ot.Command("contacts").description("Contacts");return e.addCommand(new Ot.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async r=>{let n=await(0,Lt.oraPromise)(()=>o.contact.get.send(r).json(),{...t,text:"Finding contact"});console.log(n)})),e.addCommand(new Ot.Command("list").description("List contacts").action(async()=>{let r=await(0,Lt.oraPromise)(()=>o.contact.list.send().json(),{...t,text:"Finding contacts"});console.log(r)})),e.addCommand(new Ot.Command("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async r=>{let n=await(0,Lt.oraPromise)(()=>o.contact.vcf.get.send({id:r}).response(),{...t,text:"Exporting contact"});console.log(n)})),e}var wt=require("commander"),Bt=require("ora");function jt({client:o,ora:t}){let e=new wt.Command("conversations").description("Conversations");return e.addCommand(new wt.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async r=>{let n=await(0,Bt.oraPromise)(()=>o.conversation.get.send(r).json(),{...t,text:"Finding conversation"});console.log(n)})),e.addCommand(new wt.Command("list").description("List conversations").action(async()=>{let r=await(0,Bt.oraPromise)(()=>o.conversation.list.send().json(),{...t,text:"Finding conversations"});console.log(r)})),e}var Tt=require("commander"),Ft=require("ora");function Nt({client:o,ora:t}){let e=new Tt.Command("labels").description("Labels");return e.addCommand(new Tt.Command("get").description("Find label").argument("<label>","Label ID").action(async r=>{let n=await(0,Ft.oraPromise)(()=>o.label.get.send(r).json(),{...t,text:"Finding label"});console.log(n)})),e.addCommand(new Tt.Command("list").description("List labels").action(async()=>{let r=await(0,Ft.oraPromise)(()=>o.label.list.send().json(),{...t,text:"Finding labels"});console.log(r)})),e.addCommand(new Tt.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async r=>{let n=await(0,Ft.oraPromise)(()=>o.label.conversation.list.send(r).json(),{...t,text:"Finding conversations"});console.log(n)})),e}var Mt=require("commander"),ee=require("ora");function Dt({client:o,ora:t}){let e=new Mt.Command("messages").description("Messages");return e.addCommand(new Mt.Command("list").description("List messages").action(async()=>{let r=await(0,ee.oraPromise)(()=>o.message.list.send().json(),{...t,text:"Finding messages"});console.log(r)})),e}var Ut=require("commander"),Ht=require("ora");function kt({client:o,ora:t}){let e=new Ut.Command("models").description("Models");return e.addCommand(new Ut.Command("get").description("Find model").argument("<model>","Model ID").action(async r=>{let n=await(0,Ht.oraPromise)(()=>o.model.get.send(r).json(),{...t,text:"Finding model"});console.log(n)})),e.addCommand(new Ut.Command("list").description("List models").action(async()=>{let r=await(0,Ht.oraPromise)(()=>o.model.list.send().json(),{...t,text:"Finding models"});console.log(r)})),e}var St=require("commander"),Vt=require("ora");function Kt({client:o,ora:t}){let e=new St.Command("sources").description("Sources");return e.addCommand(new St.Command("get").description("Find source").argument("<source>","Source ID").action(async r=>{let n=await(0,Vt.oraPromise)(()=>o.source.get.send(r).json(),{...t,text:"Finding source"});console.log(n)})),e.addCommand(new St.Command("list").description("List sources").action(async()=>{let r=await(0,Vt.oraPromise)(()=>o.source.list.send().json(),{...t,text:"Finding sources"});console.log(r)})),e}var c={ora:{spinner:"simpleDotsScrolling"},client:new Rt(new u)},le=new oe.Command("gds").description("Great Detail Support System").addCommand(Et(c)).addCommand(Gt(c)).addCommand(At(c)).addCommand(jt(c)).addCommand(Nt(c)).addCommand(Dt(c)).addCommand(kt(c)).addCommand(Kt(c)),me=le;
1
+ "use strict";var de=Object.create;var vt=Object.defineProperty;var le=Object.getOwnPropertyDescriptor;var me=Object.getOwnPropertyNames;var ue=Object.getPrototypeOf,Ce=Object.prototype.hasOwnProperty;var he=(o,t)=>{for(var e in t)vt(o,e,{get:t[e],enumerable:!0})},Jt=(o,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of me(t))!Ce.call(o,r)&&r!==e&&vt(o,r,{get:()=>t[r],enumerable:!(n=le(t,r))||n.enumerable});return o};var Xt=(o,t,e)=>(e=o!=null?de(ue(o)):{},Jt(t||!o||!o.__esModule?vt(e,"default",{value:o,enumerable:!0}):e,o)),fe=o=>Jt(vt({},"__esModule",{value:!0}),o);var be={};he(be,{default:()=>xe});module.exports=fe(be);var pe=require("commander");var u=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var C=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/actions",{...t,method:"GET"})}};var h=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplates",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var f=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var g=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...e,method:"GET"})}};var x=class{constructor(t){this._transport=t}send({query:t,request:e={}}={}){return this._transport.send("v1/boilerplates",{...e,method:"GET",searchParams:[...this._transport.queryQuery(t)]})}};var b=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var y=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplate-categories",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var R=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var O=class{constructor(t){this._transport=t}send({include:t,request:e={}}={}){return this._transport.send("v1/boilerplate-categories",{...e,method:"GET",searchParams:[...this._transport.includeQuery(t??{})]})}};var T=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var _=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var v=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var w=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"})}};var qt=require("zod"),L=class o{constructor(t){this._transport=t}static SCHEMA=qt.z.object({overwrite:qt.z.boolean().optional()});send(t,{body:e,request:n={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},json:o.SCHEMA.parse(e)})}};var F=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var U=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var S=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}};var I=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...e,method:"GET"})}};var q=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/composition-sections",{...t,method:"GET"})}};var E=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var Zt="SUPPORT_BASE_URL";var te="https://api.support.greatdetail.com",ee={"X-Powered-By":"GDSupport/JavaScript"};var P=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let n=e.variant??"vcard",r=e.format??(n==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(n)+"&format="+encodeURIComponent(r)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}send(t){return this._transport.send(this.getURL(t),{method:"GET"})}};var G=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var N=class{constructor(t){this._transport=t}send(t,{include:e,request:n={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...n,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var A=class{constructor(t){this._transport=t}send({query:t,request:e={}}={}){return this._transport.send("v1/contacts",{...e,method:"GET",searchParams:[...this._transport.queryQuery(t)]})}};var j=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...e,method:"GET"})}};var B=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var M=class{constructor(t){this._transport=t}send(t,{include:e,request:n={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...n,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var D=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var H=class{constructor(t){this._transport=t}send({filter:t,include:e,request:n={}}={}){return this._transport.send("v1/conversations",{...n,method:"GET",searchParams:[...t?[["filter",t]]:[],...this._transport.includeQuery(e??{})]})}};var K=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var k=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var V=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var Q=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var W=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var z=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...e,method:"GET"})}};var Y=class{constructor(t){this._transport=t}send({query:t,include:e,request:n={}}={}){return this._transport.send("v1/labels",{...n,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.includeQuery(e??{})]})}};var $=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var J=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"})}};var X=class{constructor(t){this._transport=t}send(t,{include:e,request:n={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...n,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var Z=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/messages",{...t,method:"GET"})}};var tt=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var et=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var ot=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var nt=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var rt=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var l=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var st=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var it=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var at=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var pt=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var ct=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var dt=class o{constructor(t=o.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=ee;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var lt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var mt=class{constructor(t){this._transport=t}send({category:t,request:e={}}={}){let n=[];if(t){let r=Array.isArray(t)?t:[t];for(let a of r)n.push(["category",a])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:n})}};var oe=Xt(require("is-network-error"),1),wt=Xt(require("ky"),1);var s=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var d=class extends s{};var ut=class extends d{static unauthenticated(){return new this("An unauthenticated request occurred")}};var Ct=class extends d{static forbidden(){return new this("A forbidden request occurred")}};var c=class extends s{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}`)}static teapot(){return new this("I'm a teapot")}static rateLimited(){return new this("Request has been rate-limited")}};var ht=class extends s{};var m=class extends s{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var ft=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=wt.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[n=>{for(let r of this.options.requestFilterables){let a=r.getHeaders();for(let[$t,ce]of Object.entries(a))n.headers.has($t)||n.headers.set($t,ce)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}includeQuery(t){let e=[];for(let n of Object.keys(t))e.push(["include",n]);return e}queryQuery(t){let e=[];return t&&e.push(["query",t]),e}send(t,e){let n=this.client(t,e).catch(r=>{if((0,oe.default)(r))throw new ht("A network error occurred",{cause:r});if(r instanceof wt.HTTPError){let a=r.response.status;switch(console.error(JSON.stringify(r.response)),a){case 400:throw m.badRequest();case 401:throw ut.unauthenticated();case 403:throw Ct.forbidden();case 404:throw c.notFound(t);case 405:throw c.forbiddenMethod(t,e.method??"GET");case 415:throw m.unsupportedMediaType();case 418:throw c.teapot();case 429:throw c.rateLimited()}if(a>=500&&a<600)throw s.serverError(a)}throw r});return{response:()=>n,json:async()=>(await n).json()}}};var gt=class{constructor(t){this._transport=t}send({account:t,files:e,request:n={}}){let r=new FormData;for(let a of e)r.append("file",a);return this._transport.send("v1/uploads",{...n,method:"POST",body:r,searchParams:{account:t}})}};var xt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var bt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var i=require("zod"),yt=class o{constructor(t){this._client=t}static SCHEMA=i.z.object({event:i.z.intersection(i.z.object({id:i.z.string(),createdAt:i.z.string().datetime()}),i.z.discriminatedUnion("type",[i.z.object({type:i.z.literal("contact.created"),contact:i.z.string()}),i.z.object({type:i.z.literal("message.created"),message:i.z.string()})]))});async event({request:t}){let{event:e}=o.SCHEMA.parse(t.body);return{event:e}}};var Rt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var Ot=class o{static DEFAULT_BASE_URL=te;_transport;constructor(t,{baseURL:e,...n}={}){this._transport=new ft({requestFilterables:[new dt,t],...n,baseURL:e?.toString()??o.getBaseURL()})}static getBaseURL(){return process.env[Zt]??this.DEFAULT_BASE_URL}get action(){return{list:new C(this._transport)}}get boilerplate(){return{get:new f(this._transport),list:new x(this._transport),update:new b(this._transport),create:new h(this._transport)}}get boilerplateCategory(){return{get:new R(this._transport),list:new O(this._transport),create:new y(this._transport),update:new T(this._transport),boilerplate:{list:new g(this._transport)}}}get channel(){return{get:new v(this._transport),list:new w(this._transport),update:new F(this._transport),create:new _(this._transport),compositionSection:{list:new I(this._transport)},message:{list:new J(this._transport)},twilioSendgrid:{sync:new L(this._transport)}}}get compositionSection(){return{get:new S(this._transport),list:new q(this._transport),create:new U(this._transport),update:new E(this._transport)}}get contact(){return{get:new N(this._transport),list:new A(this._transport),update:new B(this._transport),create:new G(this._transport),conversation:{list:new D(this._transport)},note:{list:new it(this._transport),create:new rt(this._transport)},notificationSubscription:{create:new ct(this._transport)},vcf:{get:new P(this._transport)}}}get conversation(){return{get:new M(this._transport),list:new H(this._transport),update:new k(this._transport),create:new l(this._transport),label:{list:new z(this._transport)},message:{list:new X(this._transport)},note:{list:new at(this._transport),create:new l(this._transport)}}}get label(){return{create:new V(this._transport),get:new W(this._transport),list:new Y(this._transport),update:new $(this._transport),delete:new Q(this._transport),contact:{list:new j(this._transport)},conversation:{list:new K(this._transport)}}}get message(){return{list:new Z(this._transport)}}get model(){return{get:new et(this._transport),list:new ot(this._transport),response:{create:new nt(this._transport)},correction:{create:new tt(this._transport)}}}get note(){return{get:new st(this._transport),update:new pt(this._transport)}}get source(){return{get:new lt(this._transport),list:new mt(this._transport)}}get upload(){return{get:new bt(this._transport),create:new gt(this._transport),delete:new xt(this._transport)}}get webhook(){return new yt(this)}get wellKnown(){return{notification:{get:new Rt(this._transport)}}}};var Et=require("commander"),ne=require("ora");function Pt({client:o,ora:t}){let e=new Et.Command("actions").description("Actions");return e.addCommand(new Et.Command("list").description("List actions").action(async()=>{let n=await(0,ne.oraPromise)(()=>o.action.list.send().json(),{...t,text:"Finding actions"});console.log(n)})),e}var Gt=require("commander"),re=require("ora");function Nt({client:o,ora:t}){let e=new Gt.Command("channels").description("Channels");return e.addCommand(new Gt.Command("list").description("List channels").action(async()=>{let n=await(0,re.oraPromise)(()=>o.channel.list.send().json(),{...t,text:"Finding channels"});console.log(n)})),e}var Tt=require("commander"),Lt=require("ora");function At({client:o,ora:t}){let e=new Tt.Command("contacts").description("Contacts");return e.addCommand(new Tt.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async n=>{let r=await(0,Lt.oraPromise)(()=>o.contact.get.send(n).json(),{...t,text:"Finding contact"});console.log(r)})),e.addCommand(new Tt.Command("list").description("List contacts").action(async()=>{let n=await(0,Lt.oraPromise)(()=>o.contact.list.send().json(),{...t,text:"Finding contacts"});console.log(n)})),e.addCommand(new Tt.Command("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async n=>{let r=await(0,Lt.oraPromise)(()=>o.contact.vcf.get.send({id:n}).response(),{...t,text:"Exporting contact"});console.log(r)})),e}var Ft=require("commander"),jt=require("ora");function Bt({client:o,ora:t}){let e=new Ft.Command("conversations").description("Conversations");return e.addCommand(new Ft.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async n=>{let r=await(0,jt.oraPromise)(()=>o.conversation.get.send(n).json(),{...t,text:"Finding conversation"});console.log(r)})),e.addCommand(new Ft.Command("list").description("List conversations").action(async()=>{let n=await(0,jt.oraPromise)(()=>o.conversation.list.send().json(),{...t,text:"Finding conversations"});console.log(n)})),e}var _t=require("commander"),Ut=require("ora");function Mt({client:o,ora:t}){let e=new _t.Command("labels").description("Labels");return e.addCommand(new _t.Command("get").description("Find label").argument("<label>","Label ID").action(async n=>{let r=await(0,Ut.oraPromise)(()=>o.label.get.send(n).json(),{...t,text:"Finding label"});console.log(r)})),e.addCommand(new _t.Command("list").description("List labels").action(async()=>{let n=await(0,Ut.oraPromise)(()=>o.label.list.send().json(),{...t,text:"Finding labels"});console.log(n)})),e.addCommand(new _t.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async n=>{let r=await(0,Ut.oraPromise)(()=>o.label.conversation.list.send(n).json(),{...t,text:"Finding conversations"});console.log(r)})),e}var Dt=require("commander"),se=require("ora");function Ht({client:o,ora:t}){let e=new Dt.Command("messages").description("Messages");return e.addCommand(new Dt.Command("list").description("List messages").action(async()=>{let n=await(0,se.oraPromise)(()=>o.message.list.send().json(),{...t,text:"Finding messages"});console.log(n)})),e}var St=require("commander"),Kt=require("ora");function kt({client:o,ora:t}){let e=new St.Command("models").description("Models");return e.addCommand(new St.Command("get").description("Find model").argument("<model>","Model ID").action(async n=>{let r=await(0,Kt.oraPromise)(()=>o.model.get.send(n).json(),{...t,text:"Finding model"});console.log(r)})),e.addCommand(new St.Command("list").description("List models").action(async()=>{let n=await(0,Kt.oraPromise)(()=>o.model.list.send().json(),{...t,text:"Finding models"});console.log(n)})),e}var It=require("commander"),Vt=require("ora");function Qt({client:o,ora:t}){let e=new It.Command("sources").description("Sources");return e.addCommand(new It.Command("get").description("Find source").argument("<source>","Source ID").action(async n=>{let r=await(0,Vt.oraPromise)(()=>o.source.get.send(n).json(),{...t,text:"Finding source"});console.log(r)})),e.addCommand(new It.Command("list").description("List sources").action(async()=>{let n=await(0,Vt.oraPromise)(()=>o.source.list.send().json(),{...t,text:"Finding sources"});console.log(n)})),e}var ae=require("commander");var Wt=require("commander"),ie=require("ora");function zt({client:o,ora:t}){let e=new Wt.Command("notifications").description("Well-Known Notifications Details");return e.addCommand(new Wt.Command("get").description("Get Notifications Server Well-Known Info").action(async()=>{let n=await(0,ie.oraPromise)(()=>o.wellKnown.notification.get.send().json(),{...t,text:"Finding Notifications Well-Known Info"});console.log(n)})),e}function Yt({client:o,ora:t}){let e=new ae.Command("well-known").description("Well-Known Metadata & Info");return e.addCommand(zt({client:o,ora:t})),e}var p={ora:{spinner:"simpleDotsScrolling"},client:new Ot(new u)},ge=new pe.Command("gds").description("Great Detail Support System").addCommand(Pt(p)).addCommand(Nt(p)).addCommand(At(p)).addCommand(Bt(p)).addCommand(Mt(p)).addCommand(Ht(p)).addCommand(kt(p)).addCommand(Qt(p)).addCommand(Yt(p)),xe=ge;
@@ -1,5 +1,5 @@
1
1
  import { Command } from 'commander';
2
- import { C as Client } from '../index-DutgCuRv.cjs';
2
+ import { C as Client } from '../index-BziB0Sgb.cjs';
3
3
  import { Options as Options$1 } from 'ora';
4
4
  import 'ky';
5
5
  import 'zod';
@@ -1,5 +1,5 @@
1
1
  import { Command } from 'commander';
2
- import { C as Client } from '../index-DutgCuRv.js';
2
+ import { C as Client } from '../index-BziB0Sgb.js';
3
3
  import { Options as Options$1 } from 'ora';
4
4
  import 'ky';
5
5
  import 'zod';
package/dist/cli/index.js CHANGED
@@ -1 +1 @@
1
- import{a}from"../chunk-BRMJY7ON.js";import"../chunk-G42SHM33.js";export{a as default};
1
+ import{a}from"../chunk-NIDUSXK5.js";import"../chunk-X7766EUY.js";export{a as default};
package/dist/cli.cjs CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var ne=Object.create;var Qt=Object.defineProperty;var se=Object.getOwnPropertyDescriptor;var ae=Object.getOwnPropertyNames;var ie=Object.getPrototypeOf,pe=Object.prototype.hasOwnProperty;var ce=(o,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of ae(t))!pe.call(o,n)&&n!==e&&Qt(o,n,{get:()=>t[n],enumerable:!(r=se(t,n))||r.enumerable});return o};var zt=(o,t,e)=>(e=o!=null?ne(ie(o)):{},ce(t||!o||!o.__esModule?Qt(e,"default",{value:o,enumerable:!0}):e,o));var ee=require("commander");var u=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var C=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/actions",{...t,method:"GET"})}};var h=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplates",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var f=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var g=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...e,method:"GET"})}};var b=class{constructor(t){this._transport=t}send({query:t,request:e={}}={}){return this._transport.send("v1/boilerplates",{...e,method:"GET",searchParams:[...this._transport.queryQuery(t)]})}};var x=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var y=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplate-categories",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var R=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var O=class{constructor(t){this._transport=t}send({include:t,request:e={}}={}){return this._transport.send("v1/boilerplate-categories",{...e,method:"GET",searchParams:[...this._transport.includeQuery(t??{})]})}};var T=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var _=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var v=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var L=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"})}};var St=require("zod"),w=class o{constructor(t){this._transport=t}static SCHEMA=St.z.object({overwrite:St.z.boolean().optional()});send(t,{body:e,request:r={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:o.SCHEMA.parse(e)})}};var F=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var U=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var S=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}};var I=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...e,method:"GET"})}};var q=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/composition-sections",{...t,method:"GET"})}};var E=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var Yt="SUPPORT_BASE_URL";var $t="https://api.support.greatdetail.com",Jt={"X-Powered-By":"GDSupport/JavaScript"};var P=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let r=e.variant??"vcard",n=e.format??(r==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(r)+"&format="+encodeURIComponent(n)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}send(t){return this._transport.send(this.getURL(t),{method:"GET"})}};var G=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var A=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var B=class{constructor(t){this._transport=t}send({query:t,request:e={}}={}){return this._transport.send("v1/contacts",{...e,method:"GET",searchParams:[...this._transport.queryQuery(t)]})}};var j=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...e,method:"GET"})}};var N=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var M=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var D=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var H=class{constructor(t){this._transport=t}send({filter:t,include:e,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...t?[["filter",t]]:[],...this._transport.includeQuery(e??{})]})}};var k=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var V=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var K=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var Q=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var z=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var Y=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...e,method:"GET"})}};var $=class{constructor(t){this._transport=t}send({query:t,include:e,request:r={}}={}){return this._transport.send("v1/labels",{...r,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.includeQuery(e??{})]})}};var J=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var W=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"})}};var X=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var Z=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/messages",{...t,method:"GET"})}};var tt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var et=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var ot=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var rt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var nt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var l=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var st=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var at=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var it=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var pt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var ct=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var dt=class o{constructor(t=o.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Jt;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var lt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var mt=class{constructor(t){this._transport=t}send({category:t,request:e={}}={}){let r=[];if(t){let n=Array.isArray(t)?t:[t];for(let i of n)r.push(["category",i])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:r})}};var Wt=zt(require("is-network-error"),1),_t=zt(require("ky"),1);var s=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var d=class extends s{};var ut=class extends d{static unauthenticated(){return new this("An unauthenticated request occurred")}};var Ct=class extends d{static forbidden(){return new this("A forbidden request occurred")}};var p=class extends s{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}`)}static teapot(){return new this("I'm a teapot")}static rateLimited(){return new this("Request has been rate-limited")}};var ht=class extends s{};var m=class extends s{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var ft=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=_t.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[r=>{for(let n of this.options.requestFilterables){let i=n.getHeaders();for(let[Kt,re]of Object.entries(i))r.headers.has(Kt)||r.headers.set(Kt,re)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}includeQuery(t){let e=[];for(let r of Object.keys(t))e.push(["include",r]);return e}queryQuery(t){let e=[];return t&&e.push(["query",t]),e}send(t,e){let r=this.client(t,e).catch(n=>{if((0,Wt.default)(n))throw new ht("A network error occurred",{cause:n});if(n instanceof _t.HTTPError){let i=n.response.status;switch(console.error(JSON.stringify(n.response)),i){case 400:throw m.badRequest();case 401:throw ut.unauthenticated();case 403:throw Ct.forbidden();case 404:throw p.notFound(t);case 405:throw p.forbiddenMethod(t,e.method??"GET");case 415:throw m.unsupportedMediaType();case 418:throw p.teapot();case 429:throw p.rateLimited()}if(i>=500&&i<600)throw s.serverError(i)}throw n});return{response:()=>r,json:async()=>(await r).json()}}};var gt=class{constructor(t){this._transport=t}send({account:t,files:e,request:r={}}){let n=new FormData;for(let i of e)n.append("file",i);return this._transport.send("v1/uploads",{...r,method:"POST",body:n,searchParams:{account:t}})}};var bt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var xt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var a=require("zod"),yt=class o{constructor(t){this._client=t}static SCHEMA=a.z.object({event:a.z.intersection(a.z.object({id:a.z.string(),createdAt:a.z.string().datetime()}),a.z.discriminatedUnion("type",[a.z.object({type:a.z.literal("contact.created"),contact:a.z.string()}),a.z.object({type:a.z.literal("message.created"),message:a.z.string()})]))});async event({request:t}){let{event:e}=o.SCHEMA.parse(t.body);return{event:e}}};var Rt=class o{static DEFAULT_BASE_URL=$t;_transport;constructor(t,{baseURL:e,...r}={}){this._transport=new ft({requestFilterables:[new dt,t],...r,baseURL:e?.toString()??o.getBaseURL()})}static getBaseURL(){return process.env[Yt]??this.DEFAULT_BASE_URL}get action(){return{list:new C(this._transport)}}get boilerplate(){return{get:new f(this._transport),list:new b(this._transport),update:new x(this._transport),create:new h(this._transport)}}get boilerplateCategory(){return{get:new R(this._transport),list:new O(this._transport),create:new y(this._transport),update:new T(this._transport),boilerplate:{list:new g(this._transport)}}}get channel(){return{get:new v(this._transport),list:new L(this._transport),update:new F(this._transport),create:new _(this._transport),compositionSection:{list:new I(this._transport)},message:{list:new W(this._transport)},twilioSendgrid:{sync:new w(this._transport)}}}get compositionSection(){return{get:new S(this._transport),list:new q(this._transport),create:new U(this._transport),update:new E(this._transport)}}get contact(){return{get:new A(this._transport),list:new B(this._transport),update:new N(this._transport),create:new G(this._transport),conversation:{list:new D(this._transport)},note:{list:new at(this._transport),create:new nt(this._transport)},notificationSubscription:{create:new ct(this._transport)},vcf:{get:new P(this._transport)}}}get conversation(){return{get:new M(this._transport),list:new H(this._transport),update:new V(this._transport),create:new l(this._transport),label:{list:new Y(this._transport)},message:{list:new X(this._transport)},note:{list:new it(this._transport),create:new l(this._transport)}}}get label(){return{create:new K(this._transport),get:new z(this._transport),list:new $(this._transport),update:new J(this._transport),delete:new Q(this._transport),contact:{list:new j(this._transport)},conversation:{list:new k(this._transport)}}}get message(){return{list:new Z(this._transport)}}get model(){return{get:new et(this._transport),list:new ot(this._transport),response:{create:new rt(this._transport)},correction:{create:new tt(this._transport)}}}get note(){return{get:new st(this._transport),update:new pt(this._transport)}}get source(){return{get:new lt(this._transport),list:new mt(this._transport)}}get upload(){return{get:new xt(this._transport),create:new gt(this._transport),delete:new bt(this._transport)}}get webhook(){return new yt(this)}};var It=require("commander"),Xt=require("ora");function qt({client:o,ora:t}){let e=new It.Command("actions").description("Actions");return e.addCommand(new It.Command("list").description("List actions").action(async()=>{let r=await(0,Xt.oraPromise)(()=>o.action.list.send().json(),{...t,text:"Finding actions"});console.log(r)})),e}var Et=require("commander"),Zt=require("ora");function Pt({client:o,ora:t}){let e=new Et.Command("channels").description("Channels");return e.addCommand(new Et.Command("list").description("List channels").action(async()=>{let r=await(0,Zt.oraPromise)(()=>o.channel.list.send().json(),{...t,text:"Finding channels"});console.log(r)})),e}var Ot=require("commander"),vt=require("ora");function Gt({client:o,ora:t}){let e=new Ot.Command("contacts").description("Contacts");return e.addCommand(new Ot.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async r=>{let n=await(0,vt.oraPromise)(()=>o.contact.get.send(r).json(),{...t,text:"Finding contact"});console.log(n)})),e.addCommand(new Ot.Command("list").description("List contacts").action(async()=>{let r=await(0,vt.oraPromise)(()=>o.contact.list.send().json(),{...t,text:"Finding contacts"});console.log(r)})),e.addCommand(new Ot.Command("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async r=>{let n=await(0,vt.oraPromise)(()=>o.contact.vcf.get.send({id:r}).response(),{...t,text:"Exporting contact"});console.log(n)})),e}var Lt=require("commander"),At=require("ora");function Bt({client:o,ora:t}){let e=new Lt.Command("conversations").description("Conversations");return e.addCommand(new Lt.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async r=>{let n=await(0,At.oraPromise)(()=>o.conversation.get.send(r).json(),{...t,text:"Finding conversation"});console.log(n)})),e.addCommand(new Lt.Command("list").description("List conversations").action(async()=>{let r=await(0,At.oraPromise)(()=>o.conversation.list.send().json(),{...t,text:"Finding conversations"});console.log(r)})),e}var Tt=require("commander"),wt=require("ora");function jt({client:o,ora:t}){let e=new Tt.Command("labels").description("Labels");return e.addCommand(new Tt.Command("get").description("Find label").argument("<label>","Label ID").action(async r=>{let n=await(0,wt.oraPromise)(()=>o.label.get.send(r).json(),{...t,text:"Finding label"});console.log(n)})),e.addCommand(new Tt.Command("list").description("List labels").action(async()=>{let r=await(0,wt.oraPromise)(()=>o.label.list.send().json(),{...t,text:"Finding labels"});console.log(r)})),e.addCommand(new Tt.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async r=>{let n=await(0,wt.oraPromise)(()=>o.label.conversation.list.send(r).json(),{...t,text:"Finding conversations"});console.log(n)})),e}var Nt=require("commander"),te=require("ora");function Mt({client:o,ora:t}){let e=new Nt.Command("messages").description("Messages");return e.addCommand(new Nt.Command("list").description("List messages").action(async()=>{let r=await(0,te.oraPromise)(()=>o.message.list.send().json(),{...t,text:"Finding messages"});console.log(r)})),e}var Ft=require("commander"),Dt=require("ora");function Ht({client:o,ora:t}){let e=new Ft.Command("models").description("Models");return e.addCommand(new Ft.Command("get").description("Find model").argument("<model>","Model ID").action(async r=>{let n=await(0,Dt.oraPromise)(()=>o.model.get.send(r).json(),{...t,text:"Finding model"});console.log(n)})),e.addCommand(new Ft.Command("list").description("List models").action(async()=>{let r=await(0,Dt.oraPromise)(()=>o.model.list.send().json(),{...t,text:"Finding models"});console.log(r)})),e}var Ut=require("commander"),kt=require("ora");function Vt({client:o,ora:t}){let e=new Ut.Command("sources").description("Sources");return e.addCommand(new Ut.Command("get").description("Find source").argument("<source>","Source ID").action(async r=>{let n=await(0,kt.oraPromise)(()=>o.source.get.send(r).json(),{...t,text:"Finding source"});console.log(n)})),e.addCommand(new Ut.Command("list").description("List sources").action(async()=>{let r=await(0,kt.oraPromise)(()=>o.source.list.send().json(),{...t,text:"Finding sources"});console.log(r)})),e}var c={ora:{spinner:"simpleDotsScrolling"},client:new Rt(new u)},de=new ee.Command("gds").description("Great Detail Support System").addCommand(qt(c)).addCommand(Pt(c)).addCommand(Gt(c)).addCommand(Bt(c)).addCommand(jt(c)).addCommand(Mt(c)).addCommand(Ht(c)).addCommand(Vt(c)),oe=de;oe.parseAsync(process.argv);
2
+ "use strict";var de=Object.create;var $t=Object.defineProperty;var le=Object.getOwnPropertyDescriptor;var me=Object.getOwnPropertyNames;var ue=Object.getPrototypeOf,Ce=Object.prototype.hasOwnProperty;var he=(o,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of me(t))!Ce.call(o,r)&&r!==e&&$t(o,r,{get:()=>t[r],enumerable:!(n=le(t,r))||n.enumerable});return o};var Jt=(o,t,e)=>(e=o!=null?de(ue(o)):{},he(t||!o||!o.__esModule?$t(e,"default",{value:o,enumerable:!0}):e,o));var ae=require("commander");var u=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var C=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/actions",{...t,method:"GET"})}};var h=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplates",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var f=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var g=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...e,method:"GET"})}};var x=class{constructor(t){this._transport=t}send({query:t,request:e={}}={}){return this._transport.send("v1/boilerplates",{...e,method:"GET",searchParams:[...this._transport.queryQuery(t)]})}};var b=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var y=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplate-categories",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var R=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var O=class{constructor(t){this._transport=t}send({include:t,request:e={}}={}){return this._transport.send("v1/boilerplate-categories",{...e,method:"GET",searchParams:[...this._transport.includeQuery(t??{})]})}};var T=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var _=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var v=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var w=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"})}};var It=require("zod"),L=class o{constructor(t){this._transport=t}static SCHEMA=It.z.object({overwrite:It.z.boolean().optional()});send(t,{body:e,request:n={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},json:o.SCHEMA.parse(e)})}};var F=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var U=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var S=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}};var I=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...e,method:"GET"})}};var q=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/composition-sections",{...t,method:"GET"})}};var E=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var Xt="SUPPORT_BASE_URL";var Zt="https://api.support.greatdetail.com",te={"X-Powered-By":"GDSupport/JavaScript"};var P=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let n=e.variant??"vcard",r=e.format??(n==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(n)+"&format="+encodeURIComponent(r)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}send(t){return this._transport.send(this.getURL(t),{method:"GET"})}};var G=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var N=class{constructor(t){this._transport=t}send(t,{include:e,request:n={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...n,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var A=class{constructor(t){this._transport=t}send({query:t,request:e={}}={}){return this._transport.send("v1/contacts",{...e,method:"GET",searchParams:[...this._transport.queryQuery(t)]})}};var j=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...e,method:"GET"})}};var B=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var M=class{constructor(t){this._transport=t}send(t,{include:e,request:n={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...n,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var D=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var H=class{constructor(t){this._transport=t}send({filter:t,include:e,request:n={}}={}){return this._transport.send("v1/conversations",{...n,method:"GET",searchParams:[...t?[["filter",t]]:[],...this._transport.includeQuery(e??{})]})}};var K=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var k=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var V=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var Q=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var W=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var z=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...e,method:"GET"})}};var Y=class{constructor(t){this._transport=t}send({query:t,include:e,request:n={}}={}){return this._transport.send("v1/labels",{...n,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.includeQuery(e??{})]})}};var $=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var J=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"})}};var X=class{constructor(t){this._transport=t}send(t,{include:e,request:n={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...n,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var Z=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/messages",{...t,method:"GET"})}};var tt=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var et=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var ot=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var nt=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var rt=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var l=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var st=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var it=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var at=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var pt=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var ct=class{constructor(t){this._transport=t}send(t,{body:e,request:n={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var dt=class o{constructor(t=o.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=te;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var lt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var mt=class{constructor(t){this._transport=t}send({category:t,request:e={}}={}){let n=[];if(t){let r=Array.isArray(t)?t:[t];for(let a of r)n.push(["category",a])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:n})}};var ee=Jt(require("is-network-error"),1),vt=Jt(require("ky"),1);var s=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var d=class extends s{};var ut=class extends d{static unauthenticated(){return new this("An unauthenticated request occurred")}};var Ct=class extends d{static forbidden(){return new this("A forbidden request occurred")}};var c=class extends s{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}`)}static teapot(){return new this("I'm a teapot")}static rateLimited(){return new this("Request has been rate-limited")}};var ht=class extends s{};var m=class extends s{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var ft=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=vt.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[n=>{for(let r of this.options.requestFilterables){let a=r.getHeaders();for(let[Yt,ce]of Object.entries(a))n.headers.has(Yt)||n.headers.set(Yt,ce)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}includeQuery(t){let e=[];for(let n of Object.keys(t))e.push(["include",n]);return e}queryQuery(t){let e=[];return t&&e.push(["query",t]),e}send(t,e){let n=this.client(t,e).catch(r=>{if((0,ee.default)(r))throw new ht("A network error occurred",{cause:r});if(r instanceof vt.HTTPError){let a=r.response.status;switch(console.error(JSON.stringify(r.response)),a){case 400:throw m.badRequest();case 401:throw ut.unauthenticated();case 403:throw Ct.forbidden();case 404:throw c.notFound(t);case 405:throw c.forbiddenMethod(t,e.method??"GET");case 415:throw m.unsupportedMediaType();case 418:throw c.teapot();case 429:throw c.rateLimited()}if(a>=500&&a<600)throw s.serverError(a)}throw r});return{response:()=>n,json:async()=>(await n).json()}}};var gt=class{constructor(t){this._transport=t}send({account:t,files:e,request:n={}}){let r=new FormData;for(let a of e)r.append("file",a);return this._transport.send("v1/uploads",{...n,method:"POST",body:r,searchParams:{account:t}})}};var xt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var bt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var i=require("zod"),yt=class o{constructor(t){this._client=t}static SCHEMA=i.z.object({event:i.z.intersection(i.z.object({id:i.z.string(),createdAt:i.z.string().datetime()}),i.z.discriminatedUnion("type",[i.z.object({type:i.z.literal("contact.created"),contact:i.z.string()}),i.z.object({type:i.z.literal("message.created"),message:i.z.string()})]))});async event({request:t}){let{event:e}=o.SCHEMA.parse(t.body);return{event:e}}};var Rt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var Ot=class o{static DEFAULT_BASE_URL=Zt;_transport;constructor(t,{baseURL:e,...n}={}){this._transport=new ft({requestFilterables:[new dt,t],...n,baseURL:e?.toString()??o.getBaseURL()})}static getBaseURL(){return process.env[Xt]??this.DEFAULT_BASE_URL}get action(){return{list:new C(this._transport)}}get boilerplate(){return{get:new f(this._transport),list:new x(this._transport),update:new b(this._transport),create:new h(this._transport)}}get boilerplateCategory(){return{get:new R(this._transport),list:new O(this._transport),create:new y(this._transport),update:new T(this._transport),boilerplate:{list:new g(this._transport)}}}get channel(){return{get:new v(this._transport),list:new w(this._transport),update:new F(this._transport),create:new _(this._transport),compositionSection:{list:new I(this._transport)},message:{list:new J(this._transport)},twilioSendgrid:{sync:new L(this._transport)}}}get compositionSection(){return{get:new S(this._transport),list:new q(this._transport),create:new U(this._transport),update:new E(this._transport)}}get contact(){return{get:new N(this._transport),list:new A(this._transport),update:new B(this._transport),create:new G(this._transport),conversation:{list:new D(this._transport)},note:{list:new it(this._transport),create:new rt(this._transport)},notificationSubscription:{create:new ct(this._transport)},vcf:{get:new P(this._transport)}}}get conversation(){return{get:new M(this._transport),list:new H(this._transport),update:new k(this._transport),create:new l(this._transport),label:{list:new z(this._transport)},message:{list:new X(this._transport)},note:{list:new at(this._transport),create:new l(this._transport)}}}get label(){return{create:new V(this._transport),get:new W(this._transport),list:new Y(this._transport),update:new $(this._transport),delete:new Q(this._transport),contact:{list:new j(this._transport)},conversation:{list:new K(this._transport)}}}get message(){return{list:new Z(this._transport)}}get model(){return{get:new et(this._transport),list:new ot(this._transport),response:{create:new nt(this._transport)},correction:{create:new tt(this._transport)}}}get note(){return{get:new st(this._transport),update:new pt(this._transport)}}get source(){return{get:new lt(this._transport),list:new mt(this._transport)}}get upload(){return{get:new bt(this._transport),create:new gt(this._transport),delete:new xt(this._transport)}}get webhook(){return new yt(this)}get wellKnown(){return{notification:{get:new Rt(this._transport)}}}};var qt=require("commander"),oe=require("ora");function Et({client:o,ora:t}){let e=new qt.Command("actions").description("Actions");return e.addCommand(new qt.Command("list").description("List actions").action(async()=>{let n=await(0,oe.oraPromise)(()=>o.action.list.send().json(),{...t,text:"Finding actions"});console.log(n)})),e}var Pt=require("commander"),ne=require("ora");function Gt({client:o,ora:t}){let e=new Pt.Command("channels").description("Channels");return e.addCommand(new Pt.Command("list").description("List channels").action(async()=>{let n=await(0,ne.oraPromise)(()=>o.channel.list.send().json(),{...t,text:"Finding channels"});console.log(n)})),e}var Tt=require("commander"),wt=require("ora");function Nt({client:o,ora:t}){let e=new Tt.Command("contacts").description("Contacts");return e.addCommand(new Tt.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async n=>{let r=await(0,wt.oraPromise)(()=>o.contact.get.send(n).json(),{...t,text:"Finding contact"});console.log(r)})),e.addCommand(new Tt.Command("list").description("List contacts").action(async()=>{let n=await(0,wt.oraPromise)(()=>o.contact.list.send().json(),{...t,text:"Finding contacts"});console.log(n)})),e.addCommand(new Tt.Command("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async n=>{let r=await(0,wt.oraPromise)(()=>o.contact.vcf.get.send({id:n}).response(),{...t,text:"Exporting contact"});console.log(r)})),e}var Lt=require("commander"),At=require("ora");function jt({client:o,ora:t}){let e=new Lt.Command("conversations").description("Conversations");return e.addCommand(new Lt.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async n=>{let r=await(0,At.oraPromise)(()=>o.conversation.get.send(n).json(),{...t,text:"Finding conversation"});console.log(r)})),e.addCommand(new Lt.Command("list").description("List conversations").action(async()=>{let n=await(0,At.oraPromise)(()=>o.conversation.list.send().json(),{...t,text:"Finding conversations"});console.log(n)})),e}var _t=require("commander"),Ft=require("ora");function Bt({client:o,ora:t}){let e=new _t.Command("labels").description("Labels");return e.addCommand(new _t.Command("get").description("Find label").argument("<label>","Label ID").action(async n=>{let r=await(0,Ft.oraPromise)(()=>o.label.get.send(n).json(),{...t,text:"Finding label"});console.log(r)})),e.addCommand(new _t.Command("list").description("List labels").action(async()=>{let n=await(0,Ft.oraPromise)(()=>o.label.list.send().json(),{...t,text:"Finding labels"});console.log(n)})),e.addCommand(new _t.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async n=>{let r=await(0,Ft.oraPromise)(()=>o.label.conversation.list.send(n).json(),{...t,text:"Finding conversations"});console.log(r)})),e}var Mt=require("commander"),re=require("ora");function Dt({client:o,ora:t}){let e=new Mt.Command("messages").description("Messages");return e.addCommand(new Mt.Command("list").description("List messages").action(async()=>{let n=await(0,re.oraPromise)(()=>o.message.list.send().json(),{...t,text:"Finding messages"});console.log(n)})),e}var Ut=require("commander"),Ht=require("ora");function Kt({client:o,ora:t}){let e=new Ut.Command("models").description("Models");return e.addCommand(new Ut.Command("get").description("Find model").argument("<model>","Model ID").action(async n=>{let r=await(0,Ht.oraPromise)(()=>o.model.get.send(n).json(),{...t,text:"Finding model"});console.log(r)})),e.addCommand(new Ut.Command("list").description("List models").action(async()=>{let n=await(0,Ht.oraPromise)(()=>o.model.list.send().json(),{...t,text:"Finding models"});console.log(n)})),e}var St=require("commander"),kt=require("ora");function Vt({client:o,ora:t}){let e=new St.Command("sources").description("Sources");return e.addCommand(new St.Command("get").description("Find source").argument("<source>","Source ID").action(async n=>{let r=await(0,kt.oraPromise)(()=>o.source.get.send(n).json(),{...t,text:"Finding source"});console.log(r)})),e.addCommand(new St.Command("list").description("List sources").action(async()=>{let n=await(0,kt.oraPromise)(()=>o.source.list.send().json(),{...t,text:"Finding sources"});console.log(n)})),e}var ie=require("commander");var Qt=require("commander"),se=require("ora");function Wt({client:o,ora:t}){let e=new Qt.Command("notifications").description("Well-Known Notifications Details");return e.addCommand(new Qt.Command("get").description("Get Notifications Server Well-Known Info").action(async()=>{let n=await(0,se.oraPromise)(()=>o.wellKnown.notification.get.send().json(),{...t,text:"Finding Notifications Well-Known Info"});console.log(n)})),e}function zt({client:o,ora:t}){let e=new ie.Command("well-known").description("Well-Known Metadata & Info");return e.addCommand(Wt({client:o,ora:t})),e}var p={ora:{spinner:"simpleDotsScrolling"},client:new Ot(new u)},fe=new ae.Command("gds").description("Great Detail Support System").addCommand(Et(p)).addCommand(Gt(p)).addCommand(Nt(p)).addCommand(jt(p)).addCommand(Bt(p)).addCommand(Dt(p)).addCommand(Kt(p)).addCommand(Vt(p)).addCommand(zt(p)),pe=fe;pe.parseAsync(process.argv);
package/dist/cli.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{a as r}from"./chunk-BRMJY7ON.js";import"./chunk-G42SHM33.js";r.parseAsync(process.argv);
2
+ import{a as r}from"./chunk-NIDUSXK5.js";import"./chunk-X7766EUY.js";r.parseAsync(process.argv);
@@ -828,20 +828,32 @@ declare class ListContactConversations {
828
828
  type Message = {
829
829
  id: string;
830
830
  role: "user" | "assistant";
831
- status: string;
831
+ status: "PotentialMessageStatus" | "SentMessageStatus" | "ReceivedMessageStatus" | "FailedMessageStatus";
832
832
  externalIdentifier?: string;
833
833
  conversation: string;
834
834
  contact: string;
835
835
  messageEvents: {
836
836
  id: string;
837
- messageEventType: string;
837
+ type: "ReadMessageEventType" | "ReceivedMessageEventType" | "SentMessageEventType";
838
838
  triggeredAt: string;
839
839
  createdAt: string;
840
840
  updatedAt?: string;
841
841
  }[];
842
842
  createdAt: string;
843
843
  updatedAt: string;
844
- };
844
+ } & ({
845
+ type: "text";
846
+ messageText: {
847
+ body: string;
848
+ };
849
+ } | {
850
+ type: "media";
851
+ messageMedia: {
852
+ upload: string;
853
+ };
854
+ } | {
855
+ type: "richtext";
856
+ });
845
857
 
846
858
  interface IncludeOptions$2 {
847
859
  latestMessage?: boolean;
@@ -1578,6 +1590,25 @@ declare class Webhook {
1578
1590
  }>;
1579
1591
  }
1580
1592
 
1593
+ interface GetNotificationWellKnownOptions {
1594
+ request?: RequestInit;
1595
+ }
1596
+ type GetNotificationWellKnownResponse = {
1597
+ data: {
1598
+ vapid: {
1599
+ publicKey: string;
1600
+ };
1601
+ };
1602
+ };
1603
+ declare class GetNotificationWellKnown {
1604
+ protected _transport: FetchTransport;
1605
+ constructor(_transport: FetchTransport);
1606
+ send({ request }?: GetNotificationWellKnownOptions): {
1607
+ response: () => Promise<ky.KyResponse<GetNotificationWellKnownResponse>>;
1608
+ json: () => Promise<GetNotificationWellKnownResponse>;
1609
+ };
1610
+ }
1611
+
1581
1612
  /**
1582
1613
  * Great Detail Support System.
1583
1614
  *
@@ -1709,6 +1740,11 @@ declare class Client {
1709
1740
  delete: DeleteUpload;
1710
1741
  };
1711
1742
  get webhook(): Webhook;
1743
+ get wellKnown(): {
1744
+ notification: {
1745
+ get: GetNotificationWellKnown;
1746
+ };
1747
+ };
1712
1748
  }
1713
1749
 
1714
- export { type ListChannelMessagesResponse as $, type Authentication as A, type Boilerplate as B, Client as C, type ListLabelContactsResponse as D, type UpdateContactResponse as E, type GetConversationResponse as F, type GetBoilerplateResponse as G, type ListConversationsResponse as H, type ListLabelConversationsResponse as I, type UpdateConversationResponse as J, type ListContactConversationsResponse as K, type ListActionsResponse as L, type Label as M, type CreateLabelResponse as N, type Options as O, type DeleteLabelResponse as P, type GetLabelResponse as Q, type RequestFilterable as R, type ListLabelsResponse as S, type TwilioSendgridChannelSyncResponse as T, type UpdateBoilerplateResponse as U, type UpdateLabelResponse as V, type WebhookResponse as W, type ListConversationLabelsResponse as X, type Message as Y, type ListConversationMessagesResponse as Z, type ListMessagesResponse as _, type Conversation as a, type Model as a0, type GetModelResponse as a1, type ListModelsResponse as a2, type CreateCorrectionResponse as a3, type CreateResponseResponse as a4, type Note as a5, type CreateContactNoteResponse as a6, type CreateConversationNoteResponse as a7, type GetNoteResponse as a8, type ListContactNotesResponse as a9, type ListConversationNotesResponse as aa, type UpdateNoteResponse as ab, type Source as ac, type GetSourceResponse as ad, type ListSourcesResponse as ae, type NotificationSubscription as af, type CreateContactNotificationSubscriptionResponse as ag, type Upload as ah, type CreateUploadResponse as ai, type GetUploadResponse as aj, type DeleteUploadResponse as ak, type Options$3 as b, type Action as c, type CreateBoilerplateResponse as d, type ListBoilerplateCategoryBoilerplatesResponse as e, type ListBoilerplatesResponse as f, type BoilerplateCategory as g, type CreateBoilerplateCategoryResponse as h, type GetBoilerplateCategoryResponse as i, type ListBoilerplateCategoriesResponse as j, type UpdateBoilerplateCategoryResponse as k, type Channel as l, type ListChannelsResponse as m, type GetChannelResponse as n, type UpdateChannelResponse as o, type CreateChannelResponse as p, type CompositionSection as q, type GetCompositionSectionResponse as r, type ListCompositionSectionsResponse as s, type CreateCompositionSectionResponse as t, type ListChannelCompositionSectionsResponse as u, type UpdateCompositionSectionResponse as v, type Contact as w, type CreateContactResponse as x, type GetContactResponse as y, type ListContactsResponse as z };
1750
+ export { type ListChannelMessagesResponse as $, type Authentication as A, type Boilerplate as B, Client as C, type ListLabelContactsResponse as D, type UpdateContactResponse as E, type GetConversationResponse as F, type GetBoilerplateResponse as G, type ListConversationsResponse as H, type ListLabelConversationsResponse as I, type UpdateConversationResponse as J, type ListContactConversationsResponse as K, type ListActionsResponse as L, type Label as M, type CreateLabelResponse as N, type Options as O, type DeleteLabelResponse as P, type GetLabelResponse as Q, type RequestFilterable as R, type ListLabelsResponse as S, type TwilioSendgridChannelSyncResponse as T, type UpdateBoilerplateResponse as U, type UpdateLabelResponse as V, type WebhookResponse as W, type ListConversationLabelsResponse as X, type Message as Y, type ListConversationMessagesResponse as Z, type ListMessagesResponse as _, type Conversation as a, type Model as a0, type GetModelResponse as a1, type ListModelsResponse as a2, type CreateCorrectionResponse as a3, type CreateResponseResponse as a4, type Note as a5, type CreateContactNoteResponse as a6, type CreateConversationNoteResponse as a7, type GetNoteResponse as a8, type ListContactNotesResponse as a9, type ListConversationNotesResponse as aa, type UpdateNoteResponse as ab, type Source as ac, type GetSourceResponse as ad, type ListSourcesResponse as ae, type NotificationSubscription as af, type CreateContactNotificationSubscriptionResponse as ag, type Upload as ah, type CreateUploadResponse as ai, type GetUploadResponse as aj, type DeleteUploadResponse as ak, type GetNotificationWellKnownResponse as al, type Options$3 as b, type Action as c, type CreateBoilerplateResponse as d, type ListBoilerplateCategoryBoilerplatesResponse as e, type ListBoilerplatesResponse as f, type BoilerplateCategory as g, type CreateBoilerplateCategoryResponse as h, type GetBoilerplateCategoryResponse as i, type ListBoilerplateCategoriesResponse as j, type UpdateBoilerplateCategoryResponse as k, type Channel as l, type ListChannelsResponse as m, type GetChannelResponse as n, type UpdateChannelResponse as o, type CreateChannelResponse as p, type CompositionSection as q, type GetCompositionSectionResponse as r, type ListCompositionSectionsResponse as s, type CreateCompositionSectionResponse as t, type ListChannelCompositionSectionsResponse as u, type UpdateCompositionSectionResponse as v, type Contact as w, type CreateContactResponse as x, type GetContactResponse as y, type ListContactsResponse as z };
@@ -828,20 +828,32 @@ declare class ListContactConversations {
828
828
  type Message = {
829
829
  id: string;
830
830
  role: "user" | "assistant";
831
- status: string;
831
+ status: "PotentialMessageStatus" | "SentMessageStatus" | "ReceivedMessageStatus" | "FailedMessageStatus";
832
832
  externalIdentifier?: string;
833
833
  conversation: string;
834
834
  contact: string;
835
835
  messageEvents: {
836
836
  id: string;
837
- messageEventType: string;
837
+ type: "ReadMessageEventType" | "ReceivedMessageEventType" | "SentMessageEventType";
838
838
  triggeredAt: string;
839
839
  createdAt: string;
840
840
  updatedAt?: string;
841
841
  }[];
842
842
  createdAt: string;
843
843
  updatedAt: string;
844
- };
844
+ } & ({
845
+ type: "text";
846
+ messageText: {
847
+ body: string;
848
+ };
849
+ } | {
850
+ type: "media";
851
+ messageMedia: {
852
+ upload: string;
853
+ };
854
+ } | {
855
+ type: "richtext";
856
+ });
845
857
 
846
858
  interface IncludeOptions$2 {
847
859
  latestMessage?: boolean;
@@ -1578,6 +1590,25 @@ declare class Webhook {
1578
1590
  }>;
1579
1591
  }
1580
1592
 
1593
+ interface GetNotificationWellKnownOptions {
1594
+ request?: RequestInit;
1595
+ }
1596
+ type GetNotificationWellKnownResponse = {
1597
+ data: {
1598
+ vapid: {
1599
+ publicKey: string;
1600
+ };
1601
+ };
1602
+ };
1603
+ declare class GetNotificationWellKnown {
1604
+ protected _transport: FetchTransport;
1605
+ constructor(_transport: FetchTransport);
1606
+ send({ request }?: GetNotificationWellKnownOptions): {
1607
+ response: () => Promise<ky.KyResponse<GetNotificationWellKnownResponse>>;
1608
+ json: () => Promise<GetNotificationWellKnownResponse>;
1609
+ };
1610
+ }
1611
+
1581
1612
  /**
1582
1613
  * Great Detail Support System.
1583
1614
  *
@@ -1709,6 +1740,11 @@ declare class Client {
1709
1740
  delete: DeleteUpload;
1710
1741
  };
1711
1742
  get webhook(): Webhook;
1743
+ get wellKnown(): {
1744
+ notification: {
1745
+ get: GetNotificationWellKnown;
1746
+ };
1747
+ };
1712
1748
  }
1713
1749
 
1714
- export { type ListChannelMessagesResponse as $, type Authentication as A, type Boilerplate as B, Client as C, type ListLabelContactsResponse as D, type UpdateContactResponse as E, type GetConversationResponse as F, type GetBoilerplateResponse as G, type ListConversationsResponse as H, type ListLabelConversationsResponse as I, type UpdateConversationResponse as J, type ListContactConversationsResponse as K, type ListActionsResponse as L, type Label as M, type CreateLabelResponse as N, type Options as O, type DeleteLabelResponse as P, type GetLabelResponse as Q, type RequestFilterable as R, type ListLabelsResponse as S, type TwilioSendgridChannelSyncResponse as T, type UpdateBoilerplateResponse as U, type UpdateLabelResponse as V, type WebhookResponse as W, type ListConversationLabelsResponse as X, type Message as Y, type ListConversationMessagesResponse as Z, type ListMessagesResponse as _, type Conversation as a, type Model as a0, type GetModelResponse as a1, type ListModelsResponse as a2, type CreateCorrectionResponse as a3, type CreateResponseResponse as a4, type Note as a5, type CreateContactNoteResponse as a6, type CreateConversationNoteResponse as a7, type GetNoteResponse as a8, type ListContactNotesResponse as a9, type ListConversationNotesResponse as aa, type UpdateNoteResponse as ab, type Source as ac, type GetSourceResponse as ad, type ListSourcesResponse as ae, type NotificationSubscription as af, type CreateContactNotificationSubscriptionResponse as ag, type Upload as ah, type CreateUploadResponse as ai, type GetUploadResponse as aj, type DeleteUploadResponse as ak, type Options$3 as b, type Action as c, type CreateBoilerplateResponse as d, type ListBoilerplateCategoryBoilerplatesResponse as e, type ListBoilerplatesResponse as f, type BoilerplateCategory as g, type CreateBoilerplateCategoryResponse as h, type GetBoilerplateCategoryResponse as i, type ListBoilerplateCategoriesResponse as j, type UpdateBoilerplateCategoryResponse as k, type Channel as l, type ListChannelsResponse as m, type GetChannelResponse as n, type UpdateChannelResponse as o, type CreateChannelResponse as p, type CompositionSection as q, type GetCompositionSectionResponse as r, type ListCompositionSectionsResponse as s, type CreateCompositionSectionResponse as t, type ListChannelCompositionSectionsResponse as u, type UpdateCompositionSectionResponse as v, type Contact as w, type CreateContactResponse as x, type GetContactResponse as y, type ListContactsResponse as z };
1750
+ export { type ListChannelMessagesResponse as $, type Authentication as A, type Boilerplate as B, Client as C, type ListLabelContactsResponse as D, type UpdateContactResponse as E, type GetConversationResponse as F, type GetBoilerplateResponse as G, type ListConversationsResponse as H, type ListLabelConversationsResponse as I, type UpdateConversationResponse as J, type ListContactConversationsResponse as K, type ListActionsResponse as L, type Label as M, type CreateLabelResponse as N, type Options as O, type DeleteLabelResponse as P, type GetLabelResponse as Q, type RequestFilterable as R, type ListLabelsResponse as S, type TwilioSendgridChannelSyncResponse as T, type UpdateBoilerplateResponse as U, type UpdateLabelResponse as V, type WebhookResponse as W, type ListConversationLabelsResponse as X, type Message as Y, type ListConversationMessagesResponse as Z, type ListMessagesResponse as _, type Conversation as a, type Model as a0, type GetModelResponse as a1, type ListModelsResponse as a2, type CreateCorrectionResponse as a3, type CreateResponseResponse as a4, type Note as a5, type CreateContactNoteResponse as a6, type CreateConversationNoteResponse as a7, type GetNoteResponse as a8, type ListContactNotesResponse as a9, type ListConversationNotesResponse as aa, type UpdateNoteResponse as ab, type Source as ac, type GetSourceResponse as ad, type ListSourcesResponse as ae, type NotificationSubscription as af, type CreateContactNotificationSubscriptionResponse as ag, type Upload as ah, type CreateUploadResponse as ai, type GetUploadResponse as aj, type DeleteUploadResponse as ak, type GetNotificationWellKnownResponse as al, type Options$3 as b, type Action as c, type CreateBoilerplateResponse as d, type ListBoilerplateCategoryBoilerplatesResponse as e, type ListBoilerplatesResponse as f, type BoilerplateCategory as g, type CreateBoilerplateCategoryResponse as h, type GetBoilerplateCategoryResponse as i, type ListBoilerplateCategoriesResponse as j, type UpdateBoilerplateCategoryResponse as k, type Channel as l, type ListChannelsResponse as m, type GetChannelResponse as n, type UpdateChannelResponse as o, type CreateChannelResponse as p, type CompositionSection as q, type GetCompositionSectionResponse as r, type ListCompositionSectionsResponse as s, type CreateCompositionSectionResponse as t, type ListChannelCompositionSectionsResponse as u, type UpdateCompositionSectionResponse as v, type Contact as w, type CreateContactResponse as x, type GetContactResponse as y, type ListContactsResponse as z };
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var jt=Object.create;var _t=Object.defineProperty;var Ht=Object.getOwnPropertyDescriptor;var Dt=Object.getOwnPropertyNames;var kt=Object.getPrototypeOf,Vt=Object.prototype.hasOwnProperty;var St=(o,t)=>{for(var e in t)_t(o,e,{get:t[e],enumerable:!0})},It=(o,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Dt(t))!Vt.call(o,n)&&n!==e&&_t(o,n,{get:()=>t[n],enumerable:!(r=Ht(t,n))||r.enumerable});return o};var Et=(o,t,e)=>(e=o!=null?jt(kt(o)):{},It(t||!o||!o.__esModule?_t(e,"default",{value:o,enumerable:!0}):e,o)),Kt=o=>It(_t({},"__esModule",{value:!0}),o);var Qt={};St(Qt,{Client:()=>f,DEFAULT_SUPPORT_BASE_URL:()=>Ot,Error:()=>Ut,KeyAuthentication:()=>Rt,PublicAuthentication:()=>Tt,TokenAuthentication:()=>yt,default:()=>f});module.exports=Kt(Qt);var Ot="https://api.support.greatdetail.com",wt={"X-Powered-By":"GDSupport/JavaScript"},qt="api-key";var C=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/actions",{...t,method:"GET"})}};var g=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplates",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var b=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var x=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...e,method:"GET"})}};var R=class{constructor(t){this._transport=t}send({query:t,request:e={}}={}){return this._transport.send("v1/boilerplates",{...e,method:"GET",searchParams:[...this._transport.queryQuery(t)]})}};var y=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var T=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplate-categories",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var _=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var O=class{constructor(t){this._transport=t}send({include:t,request:e={}}={}){return this._transport.send("v1/boilerplate-categories",{...e,method:"GET",searchParams:[...this._transport.includeQuery(t??{})]})}};var v=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var L=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var U=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var F=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"})}};var Lt=require("zod"),S=class o{constructor(t){this._transport=t}static SCHEMA=Lt.z.object({overwrite:Lt.z.boolean().optional()});send(t,{body:e,request:r={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:o.SCHEMA.parse(e)})}};var I=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var E=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var w=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}};var q=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...e,method:"GET"})}};var A=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/composition-sections",{...t,method:"GET"})}};var P=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var At="SUPPORT_ACCESS_TOKEN",Pt="SUPPORT_API_KEY",Nt="SUPPORT_KEY_NAME",Gt="SUPPORT_BASE_URL";var N=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let r=e.variant??"vcard",n=e.format??(r==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(r)+"&format="+encodeURIComponent(n)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}send(t){return this._transport.send(this.getURL(t),{method:"GET"})}};var G=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var B=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var M=class{constructor(t){this._transport=t}send({query:t,request:e={}}={}){return this._transport.send("v1/contacts",{...e,method:"GET",searchParams:[...this._transport.queryQuery(t)]})}};var j=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...e,method:"GET"})}};var H=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var D=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var k=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var V=class{constructor(t){this._transport=t}send({filter:t,include:e,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...t?[["filter",t]]:[],...this._transport.includeQuery(e??{})]})}};var K=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var Q=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var z=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var Y=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var $=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var W=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...e,method:"GET"})}};var J=class{constructor(t){this._transport=t}send({query:t,include:e,request:r={}}={}){return this._transport.send("v1/labels",{...r,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.includeQuery(e??{})]})}};var X=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var Z=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"})}};var tt=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var et=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/messages",{...t,method:"GET"})}};var ot=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var rt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var nt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var st=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var at=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var h=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var pt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var it=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var ct=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var lt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var dt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var ut=class o{constructor(t=o.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=wt;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var mt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var ht=class{constructor(t){this._transport=t}send({category:t,request:e={}}={}){let r=[];if(t){let n=Array.isArray(t)?t:[t];for(let p of n)r.push(["category",p])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:r})}};var Bt=Et(require("is-network-error"),1),vt=Et(require("ky"),1);var s=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var c=class extends s{};var d=class extends c{static unauthenticated(){return new this("An unauthenticated request occurred")}};var u=class extends c{static forbidden(){return new this("A forbidden request occurred")}};var i=class extends s{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}`)}static teapot(){return new this("I'm a teapot")}static rateLimited(){return new this("Request has been rate-limited")}};var m=class extends s{};var l=class extends s{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var ft=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=vt.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[r=>{for(let n of this.options.requestFilterables){let p=n.getHeaders();for(let[Ft,Mt]of Object.entries(p))r.headers.has(Ft)||r.headers.set(Ft,Mt)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}includeQuery(t){let e=[];for(let r of Object.keys(t))e.push(["include",r]);return e}queryQuery(t){let e=[];return t&&e.push(["query",t]),e}send(t,e){let r=this.client(t,e).catch(n=>{if((0,Bt.default)(n))throw new m("A network error occurred",{cause:n});if(n instanceof vt.HTTPError){let p=n.response.status;switch(console.error(JSON.stringify(n.response)),p){case 400:throw l.badRequest();case 401:throw d.unauthenticated();case 403:throw u.forbidden();case 404:throw i.notFound(t);case 405:throw i.forbiddenMethod(t,e.method??"GET");case 415:throw l.unsupportedMediaType();case 418:throw i.teapot();case 429:throw i.rateLimited()}if(p>=500&&p<600)throw s.serverError(p)}throw n});return{response:()=>r,json:async()=>(await r).json()}}};var Ct=class{constructor(t){this._transport=t}send({account:t,files:e,request:r={}}){let n=new FormData;for(let p of e)n.append("file",p);return this._transport.send("v1/uploads",{...r,method:"POST",body:n,searchParams:{account:t}})}};var gt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var bt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var a=require("zod"),xt=class o{constructor(t){this._client=t}static SCHEMA=a.z.object({event:a.z.intersection(a.z.object({id:a.z.string(),createdAt:a.z.string().datetime()}),a.z.discriminatedUnion("type",[a.z.object({type:a.z.literal("contact.created"),contact:a.z.string()}),a.z.object({type:a.z.literal("message.created"),message:a.z.string()})]))});async event({request:t}){let{event:e}=o.SCHEMA.parse(t.body);return{event:e}}};var f=class o{static DEFAULT_BASE_URL=Ot;_transport;constructor(t,{baseURL:e,...r}={}){this._transport=new ft({requestFilterables:[new ut,t],...r,baseURL:e?.toString()??o.getBaseURL()})}static getBaseURL(){return process.env[Gt]??this.DEFAULT_BASE_URL}get action(){return{list:new C(this._transport)}}get boilerplate(){return{get:new b(this._transport),list:new R(this._transport),update:new y(this._transport),create:new g(this._transport)}}get boilerplateCategory(){return{get:new _(this._transport),list:new O(this._transport),create:new T(this._transport),update:new v(this._transport),boilerplate:{list:new x(this._transport)}}}get channel(){return{get:new U(this._transport),list:new F(this._transport),update:new I(this._transport),create:new L(this._transport),compositionSection:{list:new q(this._transport)},message:{list:new Z(this._transport)},twilioSendgrid:{sync:new S(this._transport)}}}get compositionSection(){return{get:new w(this._transport),list:new A(this._transport),create:new E(this._transport),update:new P(this._transport)}}get contact(){return{get:new B(this._transport),list:new M(this._transport),update:new H(this._transport),create:new G(this._transport),conversation:{list:new k(this._transport)},note:{list:new it(this._transport),create:new at(this._transport)},notificationSubscription:{create:new dt(this._transport)},vcf:{get:new N(this._transport)}}}get conversation(){return{get:new D(this._transport),list:new V(this._transport),update:new Q(this._transport),create:new h(this._transport),label:{list:new W(this._transport)},message:{list:new tt(this._transport)},note:{list:new ct(this._transport),create:new h(this._transport)}}}get label(){return{create:new z(this._transport),get:new $(this._transport),list:new J(this._transport),update:new X(this._transport),delete:new Y(this._transport),contact:{list:new j(this._transport)},conversation:{list:new K(this._transport)}}}get message(){return{list:new et(this._transport)}}get model(){return{get:new rt(this._transport),list:new nt(this._transport),response:{create:new st(this._transport)},correction:{create:new ot(this._transport)}}}get note(){return{get:new pt(this._transport),update:new lt(this._transport)}}get source(){return{get:new mt(this._transport),list:new ht(this._transport)}}get upload(){return{get:new bt(this._transport),create:new Ct(this._transport),delete:new gt(this._transport)}}get webhook(){return new xt(this)}};var Ut={};St(Ut,{AuthError:()=>c,AuthenticationError:()=>d,AuthorizationError:()=>u,LogicError:()=>i,NetworkError:()=>m,SupportError:()=>s,ValidationError:()=>l});var Rt=class o{static DEFAULT_NAME=qt;name;#t;constructor({name:t=process.env[Nt]??o.DEFAULT_NAME,key:e=process.env[Pt]}={}){if(!e)throw new Error("API Key option must be specified when using Key Authentication");this.name=t,this.#t=e}async filter(){return{headers:this.getHeaders()}}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}};var yt=class{#t;constructor({token:t=process.env[At]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}async filter(){return{headers:this.getHeaders()}}getHeaders(){return{Authorization:`Bearer ${this.#t}`}}};var Tt=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};0&&(module.exports={Client,DEFAULT_SUPPORT_BASE_URL,Error,KeyAuthentication,PublicAuthentication,TokenAuthentication});
1
+ "use strict";var Ht=Object.create;var Ot=Object.defineProperty;var Dt=Object.getOwnPropertyDescriptor;var kt=Object.getOwnPropertyNames;var Kt=Object.getPrototypeOf,Vt=Object.prototype.hasOwnProperty;var It=(o,t)=>{for(var e in t)Ot(o,e,{get:t[e],enumerable:!0})},wt=(o,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of kt(t))!Vt.call(o,n)&&n!==e&&Ot(o,n,{get:()=>t[n],enumerable:!(r=Dt(t,n))||r.enumerable});return o};var Et=(o,t,e)=>(e=o!=null?Ht(Kt(o)):{},wt(t||!o||!o.__esModule?Ot(e,"default",{value:o,enumerable:!0}):e,o)),Qt=o=>wt(Ot({},"__esModule",{value:!0}),o);var zt={};It(zt,{Client:()=>f,DEFAULT_SUPPORT_BASE_URL:()=>vt,Error:()=>Ft,KeyAuthentication:()=>yt,PublicAuthentication:()=>_t,TokenAuthentication:()=>Tt,default:()=>f});module.exports=Qt(zt);var vt="https://api.support.greatdetail.com",qt={"X-Powered-By":"GDSupport/JavaScript"},At="api-key";var C=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/actions",{...t,method:"GET"})}};var g=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplates",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var b=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var x=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...e,method:"GET"})}};var R=class{constructor(t){this._transport=t}send({query:t,request:e={}}={}){return this._transport.send("v1/boilerplates",{...e,method:"GET",searchParams:[...this._transport.queryQuery(t)]})}};var y=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var T=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplate-categories",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var _=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var O=class{constructor(t){this._transport=t}send({include:t,request:e={}}={}){return this._transport.send("v1/boilerplate-categories",{...e,method:"GET",searchParams:[...this._transport.includeQuery(t??{})]})}};var v=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var L=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var U=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var F=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"})}};var Ut=require("zod"),S=class o{constructor(t){this._transport=t}static SCHEMA=Ut.z.object({overwrite:Ut.z.boolean().optional()});send(t,{body:e,request:r={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:o.SCHEMA.parse(e)})}};var I=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var w=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var E=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}};var q=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...e,method:"GET"})}};var A=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/composition-sections",{...t,method:"GET"})}};var G=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var Gt="SUPPORT_ACCESS_TOKEN",Nt="SUPPORT_API_KEY",Pt="SUPPORT_KEY_NAME",Bt="SUPPORT_BASE_URL";var N=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let r=e.variant??"vcard",n=e.format??(r==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(r)+"&format="+encodeURIComponent(n)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}send(t){return this._transport.send(this.getURL(t),{method:"GET"})}};var P=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var B=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var M=class{constructor(t){this._transport=t}send({query:t,request:e={}}={}){return this._transport.send("v1/contacts",{...e,method:"GET",searchParams:[...this._transport.queryQuery(t)]})}};var j=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...e,method:"GET"})}};var H=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var D=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var k=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var K=class{constructor(t){this._transport=t}send({filter:t,include:e,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...t?[["filter",t]]:[],...this._transport.includeQuery(e??{})]})}};var V=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var Q=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var z=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var W=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var Y=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var $=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...e,method:"GET"})}};var J=class{constructor(t){this._transport=t}send({query:t,include:e,request:r={}}={}){return this._transport.send("v1/labels",{...r,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.includeQuery(e??{})]})}};var X=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var Z=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"})}};var tt=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var et=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/messages",{...t,method:"GET"})}};var ot=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var rt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var nt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var st=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var at=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var h=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var pt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var it=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var ct=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var lt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var dt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var ut=class o{constructor(t=o.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=qt;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var mt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var ht=class{constructor(t){this._transport=t}send({category:t,request:e={}}={}){let r=[];if(t){let n=Array.isArray(t)?t:[t];for(let p of n)r.push(["category",p])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:r})}};var Mt=Et(require("is-network-error"),1),Lt=Et(require("ky"),1);var s=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var c=class extends s{};var d=class extends c{static unauthenticated(){return new this("An unauthenticated request occurred")}};var u=class extends c{static forbidden(){return new this("A forbidden request occurred")}};var i=class extends s{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}`)}static teapot(){return new this("I'm a teapot")}static rateLimited(){return new this("Request has been rate-limited")}};var m=class extends s{};var l=class extends s{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var ft=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=Lt.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[r=>{for(let n of this.options.requestFilterables){let p=n.getHeaders();for(let[St,jt]of Object.entries(p))r.headers.has(St)||r.headers.set(St,jt)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}includeQuery(t){let e=[];for(let r of Object.keys(t))e.push(["include",r]);return e}queryQuery(t){let e=[];return t&&e.push(["query",t]),e}send(t,e){let r=this.client(t,e).catch(n=>{if((0,Mt.default)(n))throw new m("A network error occurred",{cause:n});if(n instanceof Lt.HTTPError){let p=n.response.status;switch(console.error(JSON.stringify(n.response)),p){case 400:throw l.badRequest();case 401:throw d.unauthenticated();case 403:throw u.forbidden();case 404:throw i.notFound(t);case 405:throw i.forbiddenMethod(t,e.method??"GET");case 415:throw l.unsupportedMediaType();case 418:throw i.teapot();case 429:throw i.rateLimited()}if(p>=500&&p<600)throw s.serverError(p)}throw n});return{response:()=>r,json:async()=>(await r).json()}}};var Ct=class{constructor(t){this._transport=t}send({account:t,files:e,request:r={}}){let n=new FormData;for(let p of e)n.append("file",p);return this._transport.send("v1/uploads",{...r,method:"POST",body:n,searchParams:{account:t}})}};var gt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var bt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var a=require("zod"),xt=class o{constructor(t){this._client=t}static SCHEMA=a.z.object({event:a.z.intersection(a.z.object({id:a.z.string(),createdAt:a.z.string().datetime()}),a.z.discriminatedUnion("type",[a.z.object({type:a.z.literal("contact.created"),contact:a.z.string()}),a.z.object({type:a.z.literal("message.created"),message:a.z.string()})]))});async event({request:t}){let{event:e}=o.SCHEMA.parse(t.body);return{event:e}}};var Rt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var f=class o{static DEFAULT_BASE_URL=vt;_transport;constructor(t,{baseURL:e,...r}={}){this._transport=new ft({requestFilterables:[new ut,t],...r,baseURL:e?.toString()??o.getBaseURL()})}static getBaseURL(){return process.env[Bt]??this.DEFAULT_BASE_URL}get action(){return{list:new C(this._transport)}}get boilerplate(){return{get:new b(this._transport),list:new R(this._transport),update:new y(this._transport),create:new g(this._transport)}}get boilerplateCategory(){return{get:new _(this._transport),list:new O(this._transport),create:new T(this._transport),update:new v(this._transport),boilerplate:{list:new x(this._transport)}}}get channel(){return{get:new U(this._transport),list:new F(this._transport),update:new I(this._transport),create:new L(this._transport),compositionSection:{list:new q(this._transport)},message:{list:new Z(this._transport)},twilioSendgrid:{sync:new S(this._transport)}}}get compositionSection(){return{get:new E(this._transport),list:new A(this._transport),create:new w(this._transport),update:new G(this._transport)}}get contact(){return{get:new B(this._transport),list:new M(this._transport),update:new H(this._transport),create:new P(this._transport),conversation:{list:new k(this._transport)},note:{list:new it(this._transport),create:new at(this._transport)},notificationSubscription:{create:new dt(this._transport)},vcf:{get:new N(this._transport)}}}get conversation(){return{get:new D(this._transport),list:new K(this._transport),update:new Q(this._transport),create:new h(this._transport),label:{list:new $(this._transport)},message:{list:new tt(this._transport)},note:{list:new ct(this._transport),create:new h(this._transport)}}}get label(){return{create:new z(this._transport),get:new Y(this._transport),list:new J(this._transport),update:new X(this._transport),delete:new W(this._transport),contact:{list:new j(this._transport)},conversation:{list:new V(this._transport)}}}get message(){return{list:new et(this._transport)}}get model(){return{get:new rt(this._transport),list:new nt(this._transport),response:{create:new st(this._transport)},correction:{create:new ot(this._transport)}}}get note(){return{get:new pt(this._transport),update:new lt(this._transport)}}get source(){return{get:new mt(this._transport),list:new ht(this._transport)}}get upload(){return{get:new bt(this._transport),create:new Ct(this._transport),delete:new gt(this._transport)}}get webhook(){return new xt(this)}get wellKnown(){return{notification:{get:new Rt(this._transport)}}}};var Ft={};It(Ft,{AuthError:()=>c,AuthenticationError:()=>d,AuthorizationError:()=>u,LogicError:()=>i,NetworkError:()=>m,SupportError:()=>s,ValidationError:()=>l});var yt=class o{static DEFAULT_NAME=At;name;#t;constructor({name:t=process.env[Pt]??o.DEFAULT_NAME,key:e=process.env[Nt]}={}){if(!e)throw new Error("API Key option must be specified when using Key Authentication");this.name=t,this.#t=e}async filter(){return{headers:this.getHeaders()}}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}};var Tt=class{#t;constructor({token:t=process.env[Gt]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}async filter(){return{headers:this.getHeaders()}}getHeaders(){return{Authorization:`Bearer ${this.#t}`}}};var _t=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};0&&(module.exports={Client,DEFAULT_SUPPORT_BASE_URL,Error,KeyAuthentication,PublicAuthentication,TokenAuthentication});
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as Authentication, a as Conversation } from './index-DutgCuRv.cjs';
2
- export { c as Action, B as Boilerplate, g as BoilerplateCategory, l as Channel, C as Client, q as CompositionSection, w as Contact, h as CreateBoilerplateCategoryResponse, d as CreateBoilerplateResponse, p as CreateChannelResponse, t as CreateCompositionSectionResponse, a6 as CreateContactNoteResponse, ag as CreateContactNotificationSubscriptionResponse, x as CreateContactResponse, a7 as CreateConversationNoteResponse, a3 as CreateCorrectionResponse, N as CreateLabelResponse, a4 as CreateResponseResponse, ai as CreateUploadResponse, P as DeleteLabelResponse, ak as DeleteUploadResponse, i as GetBoilerplateCategoryResponse, G as GetBoilerplateResponse, n as GetChannelResponse, r as GetCompositionSectionResponse, y as GetContactResponse, F as GetConversationResponse, Q as GetLabelResponse, a1 as GetModelResponse, a8 as GetNoteResponse, ad as GetSourceResponse, aj as GetUploadResponse, M as Label, L as ListActionsResponse, j as ListBoilerplateCategoriesResponse, e as ListBoilerplateCategoryBoilerplatesResponse, f as ListBoilerplatesResponse, u as ListChannelCompositionSectionsResponse, $ as ListChannelMessagesResponse, m as ListChannelsResponse, s as ListCompositionSectionsResponse, K as ListContactConversationsResponse, a9 as ListContactNotesResponse, z as ListContactsResponse, X as ListConversationLabelsResponse, Z as ListConversationMessagesResponse, aa as ListConversationNotesResponse, H as ListConversationsResponse, D as ListLabelContactsResponse, I as ListLabelConversationsResponse, S as ListLabelsResponse, _ as ListMessagesResponse, a2 as ListModelsResponse, ae as ListSourcesResponse, Y as Message, a0 as Model, a5 as Note, af as NotificationSubscription, O as Options, R as RequestFilterable, ac as Source, b as TransportOptions, T as TwilioSendgridChannelSyncResponse, k as UpdateBoilerplateCategoryResponse, U as UpdateBoilerplateResponse, o as UpdateChannelResponse, v as UpdateCompositionSectionResponse, E as UpdateContactResponse, J as UpdateConversationResponse, V as UpdateLabelResponse, ab as UpdateNoteResponse, ah as Upload, W as WebhookResponse, C as default } from './index-DutgCuRv.cjs';
1
+ import { A as Authentication, a as Conversation } from './index-BziB0Sgb.cjs';
2
+ export { c as Action, B as Boilerplate, g as BoilerplateCategory, l as Channel, C as Client, q as CompositionSection, w as Contact, h as CreateBoilerplateCategoryResponse, d as CreateBoilerplateResponse, p as CreateChannelResponse, t as CreateCompositionSectionResponse, a6 as CreateContactNoteResponse, ag as CreateContactNotificationSubscriptionResponse, x as CreateContactResponse, a7 as CreateConversationNoteResponse, a3 as CreateCorrectionResponse, N as CreateLabelResponse, a4 as CreateResponseResponse, ai as CreateUploadResponse, P as DeleteLabelResponse, ak as DeleteUploadResponse, i as GetBoilerplateCategoryResponse, G as GetBoilerplateResponse, n as GetChannelResponse, r as GetCompositionSectionResponse, y as GetContactResponse, F as GetConversationResponse, Q as GetLabelResponse, a1 as GetModelResponse, a8 as GetNoteResponse, al as GetNotificationWellKnownResponse, ad as GetSourceResponse, aj as GetUploadResponse, M as Label, L as ListActionsResponse, j as ListBoilerplateCategoriesResponse, e as ListBoilerplateCategoryBoilerplatesResponse, f as ListBoilerplatesResponse, u as ListChannelCompositionSectionsResponse, $ as ListChannelMessagesResponse, m as ListChannelsResponse, s as ListCompositionSectionsResponse, K as ListContactConversationsResponse, a9 as ListContactNotesResponse, z as ListContactsResponse, X as ListConversationLabelsResponse, Z as ListConversationMessagesResponse, aa as ListConversationNotesResponse, H as ListConversationsResponse, D as ListLabelContactsResponse, I as ListLabelConversationsResponse, S as ListLabelsResponse, _ as ListMessagesResponse, a2 as ListModelsResponse, ae as ListSourcesResponse, Y as Message, a0 as Model, a5 as Note, af as NotificationSubscription, O as Options, R as RequestFilterable, ac as Source, b as TransportOptions, T as TwilioSendgridChannelSyncResponse, k as UpdateBoilerplateCategoryResponse, U as UpdateBoilerplateResponse, o as UpdateChannelResponse, v as UpdateCompositionSectionResponse, E as UpdateContactResponse, J as UpdateConversationResponse, V as UpdateLabelResponse, ab as UpdateNoteResponse, ah as Upload, W as WebhookResponse, C as default } from './index-BziB0Sgb.cjs';
3
3
  import 'ky';
4
4
  import 'zod';
5
5
 
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as Authentication, a as Conversation } from './index-DutgCuRv.js';
2
- export { c as Action, B as Boilerplate, g as BoilerplateCategory, l as Channel, C as Client, q as CompositionSection, w as Contact, h as CreateBoilerplateCategoryResponse, d as CreateBoilerplateResponse, p as CreateChannelResponse, t as CreateCompositionSectionResponse, a6 as CreateContactNoteResponse, ag as CreateContactNotificationSubscriptionResponse, x as CreateContactResponse, a7 as CreateConversationNoteResponse, a3 as CreateCorrectionResponse, N as CreateLabelResponse, a4 as CreateResponseResponse, ai as CreateUploadResponse, P as DeleteLabelResponse, ak as DeleteUploadResponse, i as GetBoilerplateCategoryResponse, G as GetBoilerplateResponse, n as GetChannelResponse, r as GetCompositionSectionResponse, y as GetContactResponse, F as GetConversationResponse, Q as GetLabelResponse, a1 as GetModelResponse, a8 as GetNoteResponse, ad as GetSourceResponse, aj as GetUploadResponse, M as Label, L as ListActionsResponse, j as ListBoilerplateCategoriesResponse, e as ListBoilerplateCategoryBoilerplatesResponse, f as ListBoilerplatesResponse, u as ListChannelCompositionSectionsResponse, $ as ListChannelMessagesResponse, m as ListChannelsResponse, s as ListCompositionSectionsResponse, K as ListContactConversationsResponse, a9 as ListContactNotesResponse, z as ListContactsResponse, X as ListConversationLabelsResponse, Z as ListConversationMessagesResponse, aa as ListConversationNotesResponse, H as ListConversationsResponse, D as ListLabelContactsResponse, I as ListLabelConversationsResponse, S as ListLabelsResponse, _ as ListMessagesResponse, a2 as ListModelsResponse, ae as ListSourcesResponse, Y as Message, a0 as Model, a5 as Note, af as NotificationSubscription, O as Options, R as RequestFilterable, ac as Source, b as TransportOptions, T as TwilioSendgridChannelSyncResponse, k as UpdateBoilerplateCategoryResponse, U as UpdateBoilerplateResponse, o as UpdateChannelResponse, v as UpdateCompositionSectionResponse, E as UpdateContactResponse, J as UpdateConversationResponse, V as UpdateLabelResponse, ab as UpdateNoteResponse, ah as Upload, W as WebhookResponse, C as default } from './index-DutgCuRv.js';
1
+ import { A as Authentication, a as Conversation } from './index-BziB0Sgb.js';
2
+ export { c as Action, B as Boilerplate, g as BoilerplateCategory, l as Channel, C as Client, q as CompositionSection, w as Contact, h as CreateBoilerplateCategoryResponse, d as CreateBoilerplateResponse, p as CreateChannelResponse, t as CreateCompositionSectionResponse, a6 as CreateContactNoteResponse, ag as CreateContactNotificationSubscriptionResponse, x as CreateContactResponse, a7 as CreateConversationNoteResponse, a3 as CreateCorrectionResponse, N as CreateLabelResponse, a4 as CreateResponseResponse, ai as CreateUploadResponse, P as DeleteLabelResponse, ak as DeleteUploadResponse, i as GetBoilerplateCategoryResponse, G as GetBoilerplateResponse, n as GetChannelResponse, r as GetCompositionSectionResponse, y as GetContactResponse, F as GetConversationResponse, Q as GetLabelResponse, a1 as GetModelResponse, a8 as GetNoteResponse, al as GetNotificationWellKnownResponse, ad as GetSourceResponse, aj as GetUploadResponse, M as Label, L as ListActionsResponse, j as ListBoilerplateCategoriesResponse, e as ListBoilerplateCategoryBoilerplatesResponse, f as ListBoilerplatesResponse, u as ListChannelCompositionSectionsResponse, $ as ListChannelMessagesResponse, m as ListChannelsResponse, s as ListCompositionSectionsResponse, K as ListContactConversationsResponse, a9 as ListContactNotesResponse, z as ListContactsResponse, X as ListConversationLabelsResponse, Z as ListConversationMessagesResponse, aa as ListConversationNotesResponse, H as ListConversationsResponse, D as ListLabelContactsResponse, I as ListLabelConversationsResponse, S as ListLabelsResponse, _ as ListMessagesResponse, a2 as ListModelsResponse, ae as ListSourcesResponse, Y as Message, a0 as Model, a5 as Note, af as NotificationSubscription, O as Options, R as RequestFilterable, ac as Source, b as TransportOptions, T as TwilioSendgridChannelSyncResponse, k as UpdateBoilerplateCategoryResponse, U as UpdateBoilerplateResponse, o as UpdateChannelResponse, v as UpdateCompositionSectionResponse, E as UpdateContactResponse, J as UpdateConversationResponse, V as UpdateLabelResponse, ab as UpdateNoteResponse, ah as Upload, W as WebhookResponse, C as default } from './index-BziB0Sgb.js';
3
3
  import 'ky';
4
4
  import 'zod';
5
5
 
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{a as d,b as g,c as s,d as p,e as n,f as _,g as a,h as f,i as m,j as u,k as c,l as x,m as l,n as h,o as A}from"./chunk-G42SHM33.js";var E={};d(E,{AuthError:()=>m,AuthenticationError:()=>u,AuthorizationError:()=>c,LogicError:()=>x,NetworkError:()=>l,SupportError:()=>f,ValidationError:()=>h});var t=class e{static DEFAULT_NAME=a;name;#r;constructor({name:r=process.env[n]??e.DEFAULT_NAME,key:i=process.env[p]}={}){if(!i)throw new Error("API Key option must be specified when using Key Authentication");this.name=r,this.#r=i}async filter(){return{headers:this.getHeaders()}}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#r)}`}}};var o=class{#r;constructor({token:r=process.env[s]}={}){if(!r)throw new Error("Access Token option must be specified when using Token Authentication");this.#r=r}async filter(){return{headers:this.getHeaders()}}getHeaders(){return{Authorization:`Bearer ${this.#r}`}}};export{A as Client,_ as DEFAULT_SUPPORT_BASE_URL,E as Error,t as KeyAuthentication,g as PublicAuthentication,o as TokenAuthentication,A as default};
1
+ import{a as d,b as g,c as s,d as p,e as n,f as _,g as a,h as f,i as m,j as u,k as c,l as x,m as l,n as h,o as A}from"./chunk-X7766EUY.js";var E={};d(E,{AuthError:()=>m,AuthenticationError:()=>u,AuthorizationError:()=>c,LogicError:()=>x,NetworkError:()=>l,SupportError:()=>f,ValidationError:()=>h});var t=class e{static DEFAULT_NAME=a;name;#r;constructor({name:r=process.env[n]??e.DEFAULT_NAME,key:i=process.env[p]}={}){if(!i)throw new Error("API Key option must be specified when using Key Authentication");this.name=r,this.#r=i}async filter(){return{headers:this.getHeaders()}}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#r)}`}}};var o=class{#r;constructor({token:r=process.env[s]}={}){if(!r)throw new Error("Access Token option must be specified when using Token Authentication");this.#r=r}async filter(){return{headers:this.getHeaders()}}getHeaders(){return{Authorization:`Bearer ${this.#r}`}}};export{A as Client,_ as DEFAULT_SUPPORT_BASE_URL,E as Error,t as KeyAuthentication,g as PublicAuthentication,o as TokenAuthentication,A as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@great-detail/support-sdk",
3
- "version": "0.10.0",
3
+ "version": "0.10.2",
4
4
  "type": "module",
5
5
  "description": "JavaScript SDK for the Great Detail Support System",
6
6
  "author": "Great Detail Ltd <info@greatdetail.com>",
@@ -1 +0,0 @@
1
- import{b as j,o as F}from"./chunk-G42SHM33.js";import{Command as A}from"commander";import{Command as v}from"commander";import{oraPromise as I}from"ora";function r({client:t,ora:s}){let o=new v("actions").description("Actions");return o.addCommand(new v("list").description("List actions").action(async()=>{let n=await I(()=>t.action.list.send().json(),{...s,text:"Finding actions"});console.log(n)})),o}import{Command as b}from"commander";import{oraPromise as S}from"ora";function d({client:t,ora:s}){let o=new b("channels").description("Channels");return o.addCommand(new b("list").description("List channels").action(async()=>{let n=await S(()=>t.channel.list.send().json(),{...s,text:"Finding channels"});console.log(n)})),o}import{Command as a}from"commander";import{oraPromise as c}from"ora";function p({client:t,ora:s}){let o=new a("contacts").description("Contacts");return o.addCommand(new a("get").description("Find contact").argument("<contact>","Contact ID").action(async n=>{let e=await c(()=>t.contact.get.send(n).json(),{...s,text:"Finding contact"});console.log(e)})),o.addCommand(new a("list").description("List contacts").action(async()=>{let n=await c(()=>t.contact.list.send().json(),{...s,text:"Finding contacts"});console.log(n)})),o.addCommand(new a("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async n=>{let e=await c(()=>t.contact.vcf.get.send({id:n}).response(),{...s,text:"Exporting contact"});console.log(e)})),o}import{Command as l}from"commander";import{oraPromise as L}from"ora";function u({client:t,ora:s}){let o=new l("conversations").description("Conversations");return o.addCommand(new l("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async n=>{let e=await L(()=>t.conversation.get.send(n).json(),{...s,text:"Finding conversation"});console.log(e)})),o.addCommand(new l("list").description("List conversations").action(async()=>{let n=await L(()=>t.conversation.list.send().json(),{...s,text:"Finding conversations"});console.log(n)})),o}import{Command as m}from"commander";import{oraPromise as g}from"ora";function C({client:t,ora:s}){let o=new m("labels").description("Labels");return o.addCommand(new m("get").description("Find label").argument("<label>","Label ID").action(async n=>{let e=await g(()=>t.label.get.send(n).json(),{...s,text:"Finding label"});console.log(e)})),o.addCommand(new m("list").description("List labels").action(async()=>{let n=await g(()=>t.label.list.send().json(),{...s,text:"Finding labels"});console.log(n)})),o.addCommand(new m("conversations").description("Find label conversations").argument("<label>","Label ID").action(async n=>{let e=await g(()=>t.label.conversation.list.send(n).json(),{...s,text:"Finding conversations"});console.log(e)})),o}import{Command as D}from"commander";import{oraPromise as M}from"ora";function f({client:t,ora:s}){let o=new D("messages").description("Messages");return o.addCommand(new D("list").description("List messages").action(async()=>{let n=await M(()=>t.message.list.send().json(),{...s,text:"Finding messages"});console.log(n)})),o}import{Command as O}from"commander";import{oraPromise as P}from"ora";function x({client:t,ora:s}){let o=new O("models").description("Models");return o.addCommand(new O("get").description("Find model").argument("<model>","Model ID").action(async n=>{let e=await P(()=>t.model.get.send(n).json(),{...s,text:"Finding model"});console.log(e)})),o.addCommand(new O("list").description("List models").action(async()=>{let n=await P(()=>t.model.list.send().json(),{...s,text:"Finding models"});console.log(n)})),o}import{Command as w}from"commander";import{oraPromise as h}from"ora";function y({client:t,ora:s}){let o=new w("sources").description("Sources");return o.addCommand(new w("get").description("Find source").argument("<source>","Source ID").action(async n=>{let e=await h(()=>t.source.get.send(n).json(),{...s,text:"Finding source"});console.log(e)})),o.addCommand(new w("list").description("List sources").action(async()=>{let n=await h(()=>t.source.list.send().json(),{...s,text:"Finding sources"});console.log(n)})),o}var i={ora:{spinner:"simpleDotsScrolling"},client:new F(new j)},E=new A("gds").description("Great Detail Support System").addCommand(r(i)).addCommand(d(i)).addCommand(p(i)).addCommand(u(i)).addCommand(C(i)).addCommand(f(i)).addCommand(x(i)).addCommand(y(i)),fo=E;export{fo as a};