@great-detail/support-sdk 0.10.7 → 0.10.8

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
+ var It=Object.defineProperty;var Et=(r,t)=>{for(var e in t)It(r,e,{get:t[e],enumerable:!0})};var xt=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var Ot="https://api.support.greatdetail.com",Lt={"X-Powered-By":"GDSupport/JavaScript"},Nt="api-key";import{z as s}from"zod";var u=class r{constructor(t){this._client=t}static SCHEMA=s.object({data:s.object({event:s.intersection(s.object({id:s.string(),createdAt:s.string().datetime()}),s.discriminatedUnion("type",[s.object({type:s.literal("contact.created"),payload:s.object({contact:s.string()})}),s.object({type:s.literal("message.created"),payload:s.object({message:s.string()})})]))})});async event({request:t}){let{data:e}=r.SCHEMA.parse(t.body);return{event:e.event}}};var m=class{constructor(t){this._transport=t}send({limit:t,request:e={}}={}){return this._transport.send("v1/actions",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}};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,{limit:e,request:o={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var b=class{constructor(t){this._transport=t}send({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/boilerplates",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var g=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.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 x=class{constructor(t){this._transport=t}send({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/boilerplate-categories",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}};var _=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.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/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 L=class{constructor(t){this._transport=t}send({limit:t,request:e={}}={}){return this._transport.send("v1/channels",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}};import{z as vt}from"zod";var v=class r{constructor(t){this._transport=t}static SCHEMA=vt.object({overwrite:vt.boolean().optional()});send(t,{body:e,request:o={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:r.SCHEMA.parse(e)})}};var U=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.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 I=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}};var S=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var w=class{constructor(t){this._transport=t}send({limit:t,request:e={}}={}){return this._transport.send("v1/composition-sections",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}};var q=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var ae="SUPPORT_ACCESS_TOKEN",pe="SUPPORT_API_KEY",ce="SUPPORT_KEY_NAME",Ut="SUPPORT_BASE_URL";var E=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let o=e.variant??"vcard",n=e.format??(o==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(o)+"&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 G=class{constructor(t){this._transport=t}send(t,{include:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var N=class{constructor(t){this._transport=t}send({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var B=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var A=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var M=class{constructor(t){this._transport=t}send(t,{include:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var j=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var Q=class{constructor(t){this._transport=t}send({limit:t,filter:e,include:o,request:n={}}={}){return this._transport.send("v1/conversations",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...e?[["filter",e]]:[],...this._transport.includeQuery(o??{})]})}};var H=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var D=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.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 K=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var V=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,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var z=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var Y=class{constructor(t){this._transport=t}send({limit:t,query:e,include:o,request:n={}}={}){return this._transport.send("v1/labels",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(o??{})]})}};var $=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var J=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var X=class{constructor(t){this._transport=t}send(t,{limit:e,include:o,request:n={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{})]})}};var Z=class{constructor(t){this._transport=t}send({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}};var tt=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...o,method:"POST",headers:{...o.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:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...o,method:"POST",timeout:12e4,headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var nt=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var l=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",headers:{...o.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:o={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var ct=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var lt=class r{constructor(t=r.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Lt;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var dt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var ut=class{constructor(t){this._transport=t}send({category:t,request:e={}}={}){let o=[];if(t){let n=Array.isArray(t)?t:[t];for(let a of n)o.push(["category",a])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:o})}};import St from"is-network-error";import wt,{HTTPError as qt}from"ky";var i=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var c=class extends i{};var mt=class extends c{static unauthenticated(){return new this("An unauthenticated request occurred")}};var ht=class extends c{static forbidden(){return new this("A forbidden request occurred")}};var p=class extends i{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 Ct=class extends i{};var d=class extends i{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.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[o=>{for(let n of this.options.requestFilterables){let a=n.getHeaders();for(let[Tt,Ft]of Object.entries(a))o.headers.has(Tt)||o.headers.set(Tt,Ft)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}limitQuery(t){let e=[];return t&&e.push(["limit",t.toString()]),e}includeQuery(t){let e=[];if(t===void 0)return e;for(let o of Object.keys(t))e.push(["include",o]);return e}queryQuery(t){let e=[];return t&&e.push(["query",t]),e}send(t,e){let o=this.client(t,e).catch(n=>{if(St(n))throw new Ct("A network error occurred",{cause:n});if(n instanceof qt){let a=n.response.status;switch(console.error(JSON.stringify(n.response)),a){case 400:throw d.badRequest();case 401:throw mt.unauthenticated();case 403:throw ht.forbidden();case 404:throw p.notFound(t);case 405:throw p.forbiddenMethod(t,e.method??"GET");case 415:throw d.unsupportedMediaType();case 418:throw p.teapot();case 429:throw p.rateLimited()}if(a>=500&&a<600)throw i.serverError(a)}throw n});return{response:()=>o,json:async()=>(await o).json()}}};var bt=class{constructor(t){this._transport=t}send({account:t,files:e,request:o={}}){let n=new FormData;for(let a of e)n.append("file",a);return this._transport.send("v1/uploads",{...o,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 yt=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 _t=class r{static DEFAULT_BASE_URL=Ot;_transport;constructor(t,{baseURL:e,...o}={}){this._transport=new ft({requestFilterables:[new lt,t],...o,baseURL:e?.toString()??r.getBaseURL()})}static getBaseURL(){return process.env[Ut]??this.DEFAULT_BASE_URL}get action(){return{list:new m(this._transport)}}get boilerplate(){return{get:new C(this._transport),list:new b(this._transport),update:new g(this._transport),create:new h(this._transport)}}get boilerplateCategory(){return{get:new R(this._transport),list:new x(this._transport),create:new y(this._transport),update:new _(this._transport),boilerplate:{list:new f(this._transport)}}}get channel(){return{get:new O(this._transport),list:new L(this._transport),update:new U(this._transport),create:new T(this._transport),compositionSection:{list:new S(this._transport)},message:{list:new J(this._transport)},twilioSendgrid:{sync:new v(this._transport)}}}get compositionSection(){return{get:new I(this._transport),list:new w(this._transport),create:new F(this._transport),update:new q(this._transport)}}get contact(){return{get:new G(this._transport),list:new N(this._transport),update:new A(this._transport),create:new P(this._transport),conversation:{list:new j(this._transport)},label:{label:new W(this._transport)},note:{list:new it(this._transport),create:new nt(this._transport)},notificationSubscription:{create:new ct(this._transport)},vcf:{get:new E(this._transport)}}}get conversation(){return{get:new M(this._transport),list:new Q(this._transport),update:new D(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 k(this._transport),get:new V(this._transport),list:new Y(this._transport),update:new $(this._transport),delete:new K(this._transport),contact:{list:new B(this._transport)},conversation:{list:new H(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 dt(this._transport),list:new ut(this._transport)}}get upload(){return{get:new yt(this._transport),create:new bt(this._transport),delete:new gt(this._transport)}}get webhook(){return new u(this)}get wellKnown(){return{notification:{get:new Rt(this._transport)}}}};export{Et as a,xt as b,ae as c,pe as d,ce as e,Ot as f,Nt as g,i as h,c as i,mt as j,ht as k,p as l,Ct as m,d as n,_t as o};
@@ -1 +1 @@
1
- import{b as v,o as b}from"./chunk-3BYSZXZ7.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
+ import{b as v,o as b}from"./chunk-NSQETRTT.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
- "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=(n,t)=>{for(var e in t)vt(n,e,{get:t[e],enumerable:!0})},Jt=(n,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of me(t))!Ce.call(n,r)&&r!==e&&vt(n,r,{get:()=>t[r],enumerable:!(o=le(t,r))||o.enumerable});return n};var Xt=(n,t,e)=>(e=n!=null?de(ue(n)):{},Jt(t||!n||!n.__esModule?vt(e,"default",{value:n,enumerable:!0}):e,n)),fe=n=>Jt(vt({},"__esModule",{value:!0}),n);var ye={};he(ye,{default:()=>be});module.exports=fe(ye);var pe=require("commander");var u=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var C=class{constructor(t){this._transport=t}send({limit:t,request:e={}}={}){return this._transport.send("v1/actions",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}};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,{limit:e,request:o={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var b=class{constructor(t){this._transport=t}send({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/boilerplates",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var y=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var x=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({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/boilerplate-categories",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}};var _=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.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/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({limit:t,request:e={}}={}){return this._transport.send("v1/channels",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}};var qt=require("zod"),L=class n{constructor(t){this._transport=t}static SCHEMA=qt.z.object({overwrite:qt.z.boolean().optional()});send(t,{body:e,request:o={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:n.SCHEMA.parse(e)})}};var F=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.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 I=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}};var S=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var q=class{constructor(t){this._transport=t}send({limit:t,request:e={}}={}){return this._transport.send("v1/composition-sections",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}};var P=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.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 E=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let o=e.variant??"vcard",r=e.format??(o==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(o)+"&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:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var j=class{constructor(t){this._transport=t}send({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var A=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var B=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var M=class{constructor(t){this._transport=t}send(t,{include:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var D=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var H=class{constructor(t){this._transport=t}send({limit:t,filter:e,include:o,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...e?[["filter",e]]:[],...this._transport.includeQuery(o??{})]})}};var Q=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var K=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.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 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,{limit:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var Y=class{constructor(t){this._transport=t}send({limit:t,query:e,include:o,request:r={}}={}){return this._transport.send("v1/labels",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(o??{})]})}};var $=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var J=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var X=class{constructor(t){this._transport=t}send(t,{limit:e,include:o,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{})]})}};var Z=class{constructor(t){this._transport=t}send({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}};var tt=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...o,method:"POST",headers:{...o.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:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...o,method:"POST",timeout:12e4,headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var rt=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var l=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",headers:{...o.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:o={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var ct=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var dt=class n{constructor(t=n.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 o=[];if(t){let r=Array.isArray(t)?t:[t];for(let a of r)o.push(["category",a])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:o})}};var oe=Xt(require("is-network-error"),1),wt=Xt(require("ky"),1);var i=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var d=class extends i{};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 i{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 i{};var m=class extends i{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:[o=>{for(let r of this.options.requestFilterables){let a=r.getHeaders();for(let[$t,ce]of Object.entries(a))o.headers.has($t)||o.headers.set($t,ce)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}limitQuery(t){let e=[];return t&&e.push(["limit",t.toString()]),e}includeQuery(t){let e=[];if(t===void 0)return e;for(let o of Object.keys(t))e.push(["include",o]);return e}queryQuery(t){let e=[];return t&&e.push(["query",t]),e}send(t,e){let o=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 i.serverError(a)}throw r});return{response:()=>o,json:async()=>(await o).json()}}};var gt=class{constructor(t){this._transport=t}send({account:t,files:e,request:o={}}){let r=new FormData;for(let a of e)r.append("file",a);return this._transport.send("v1/uploads",{...o,method:"POST",body:r,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 yt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var s=require("zod"),xt=class n{constructor(t){this._client=t}static SCHEMA=s.z.object({data:s.z.object({event:s.z.intersection(s.z.object({id:s.z.string(),createdAt:s.z.string().datetime()}),s.z.discriminatedUnion("type",[s.z.object({type:s.z.literal("contact.created"),payload:s.z.object({contact:s.z.string()})}),s.z.object({type:s.z.literal("message.created"),payload:s.z.object({message:s.z.string()})})]))})});async event({request:t}){let{data:e}=n.SCHEMA.parse(t.body);return{event:e.event}}};var Rt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var Ot=class n{static DEFAULT_BASE_URL=te;_transport;constructor(t,{baseURL:e,...o}={}){this._transport=new ft({requestFilterables:[new dt,t],...o,baseURL:e?.toString()??n.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 b(this._transport),update:new y(this._transport),create:new h(this._transport)}}get boilerplateCategory(){return{get:new R(this._transport),list:new O(this._transport),create:new x(this._transport),update:new _(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 T(this._transport),compositionSection:{list:new S(this._transport)},message:{list:new J(this._transport)},twilioSendgrid:{sync:new L(this._transport)}}}get compositionSection(){return{get:new I(this._transport),list:new q(this._transport),create:new U(this._transport),update:new P(this._transport)}}get contact(){return{get:new N(this._transport),list:new j(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 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 X(this._transport)},note:{list:new at(this._transport),create:new l(this._transport)}}}get label(){return{create:new k(this._transport),get:new W(this._transport),list:new Y(this._transport),update:new $(this._transport),delete:new V(this._transport),contact:{list:new A(this._transport)},conversation:{list:new Q(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 yt(this._transport),create:new gt(this._transport),delete:new bt(this._transport)}}get webhook(){return new xt(this)}get wellKnown(){return{notification:{get:new Rt(this._transport)}}}};var Pt=require("commander"),ne=require("ora");function Et({client:n,ora:t}){let e=new Pt.Command("actions").description("Actions");return e.addCommand(new Pt.Command("list").description("List actions").action(async()=>{let o=await(0,ne.oraPromise)(()=>n.action.list.send().json(),{...t,text:"Finding actions"});console.log(o)})),e}var Gt=require("commander"),re=require("ora");function Nt({client:n,ora:t}){let e=new Gt.Command("channels").description("Channels");return e.addCommand(new Gt.Command("list").description("List channels").action(async()=>{let o=await(0,re.oraPromise)(()=>n.channel.list.send().json(),{...t,text:"Finding channels"});console.log(o)})),e}var _t=require("commander"),Lt=require("ora");function jt({client:n,ora:t}){let e=new _t.Command("contacts").description("Contacts");return e.addCommand(new _t.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async o=>{let r=await(0,Lt.oraPromise)(()=>n.contact.get.send(o).json(),{...t,text:"Finding contact"});console.log(r)})),e.addCommand(new _t.Command("list").description("List contacts").action(async()=>{let o=await(0,Lt.oraPromise)(()=>n.contact.list.send().json(),{...t,text:"Finding contacts"});console.log(o)})),e.addCommand(new _t.Command("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async o=>{let r=await(0,Lt.oraPromise)(()=>n.contact.vcf.get.send({id:o}).response(),{...t,text:"Exporting contact"});console.log(r)})),e}var Ft=require("commander"),At=require("ora");function Bt({client:n,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 o=>{let r=await(0,At.oraPromise)(()=>n.conversation.get.send(o).json(),{...t,text:"Finding conversation"});console.log(r)})),e.addCommand(new Ft.Command("list").description("List conversations").action(async()=>{let o=await(0,At.oraPromise)(()=>n.conversation.list.send().json(),{...t,text:"Finding conversations"});console.log(o)})),e}var Tt=require("commander"),Ut=require("ora");function Mt({client:n,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 o=>{let r=await(0,Ut.oraPromise)(()=>n.label.get.send(o).json(),{...t,text:"Finding label"});console.log(r)})),e.addCommand(new Tt.Command("list").description("List labels").action(async()=>{let o=await(0,Ut.oraPromise)(()=>n.label.list.send().json(),{...t,text:"Finding labels"});console.log(o)})),e.addCommand(new Tt.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async o=>{let r=await(0,Ut.oraPromise)(()=>n.label.conversation.list.send(o).json(),{...t,text:"Finding conversations"});console.log(r)})),e}var Dt=require("commander"),se=require("ora");function Ht({client:n,ora:t}){let e=new Dt.Command("messages").description("Messages");return e.addCommand(new Dt.Command("list").description("List messages").action(async()=>{let o=await(0,se.oraPromise)(()=>n.message.list.send().json(),{...t,text:"Finding messages"});console.log(o)})),e}var It=require("commander"),Qt=require("ora");function Kt({client:n,ora:t}){let e=new It.Command("models").description("Models");return e.addCommand(new It.Command("get").description("Find model").argument("<model>","Model ID").action(async o=>{let r=await(0,Qt.oraPromise)(()=>n.model.get.send(o).json(),{...t,text:"Finding model"});console.log(r)})),e.addCommand(new It.Command("list").description("List models").action(async()=>{let o=await(0,Qt.oraPromise)(()=>n.model.list.send().json(),{...t,text:"Finding models"});console.log(o)})),e}var St=require("commander"),kt=require("ora");function Vt({client:n,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 o=>{let r=await(0,kt.oraPromise)(()=>n.source.get.send(o).json(),{...t,text:"Finding source"});console.log(r)})),e.addCommand(new St.Command("list").description("List sources").action(async()=>{let o=await(0,kt.oraPromise)(()=>n.source.list.send().json(),{...t,text:"Finding sources"});console.log(o)})),e}var ae=require("commander");var Wt=require("commander"),ie=require("ora");function zt({client:n,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 o=await(0,ie.oraPromise)(()=>n.wellKnown.notification.get.send().json(),{...t,text:"Finding Notifications Well-Known Info"});console.log(o)})),e}function Yt({client:n,ora:t}){let e=new ae.Command("well-known").description("Well-Known Metadata & Info");return e.addCommand(zt({client:n,ora:t})),e}var p={ora:{spinner:"simpleDotsScrolling"},client:new Ot(new u)},ge=new pe.Command("gds").description("Great Detail Support System").addCommand(Et(p)).addCommand(Nt(p)).addCommand(jt(p)).addCommand(Bt(p)).addCommand(Mt(p)).addCommand(Ht(p)).addCommand(Kt(p)).addCommand(Vt(p)).addCommand(Yt(p)),be=ge;
1
+ "use strict";var le=Object.create;var Lt=Object.defineProperty;var me=Object.getOwnPropertyDescriptor;var ue=Object.getOwnPropertyNames;var Ce=Object.getPrototypeOf,he=Object.prototype.hasOwnProperty;var fe=(n,t)=>{for(var e in t)Lt(n,e,{get:t[e],enumerable:!0})},Xt=(n,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of ue(t))!he.call(n,r)&&r!==e&&Lt(n,r,{get:()=>t[r],enumerable:!(o=me(t,r))||o.enumerable});return n};var Zt=(n,t,e)=>(e=n!=null?le(Ce(n)):{},Xt(t||!n||!n.__esModule?Lt(e,"default",{value:n,enumerable:!0}):e,n)),ge=n=>Xt(Lt({},"__esModule",{value:!0}),n);var xe={};fe(xe,{default:()=>ye});module.exports=ge(xe);var ce=require("commander");var u=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var C=class{constructor(t){this._transport=t}send({limit:t,request:e={}}={}){return this._transport.send("v1/actions",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}};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,{limit:e,request:o={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var b=class{constructor(t){this._transport=t}send({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/boilerplates",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var y=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var x=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({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/boilerplate-categories",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}};var _=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.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/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({limit:t,request:e={}}={}){return this._transport.send("v1/channels",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}};var Pt=require("zod"),w=class n{constructor(t){this._transport=t}static SCHEMA=Pt.z.object({overwrite:Pt.z.boolean().optional()});send(t,{body:e,request:o={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:n.SCHEMA.parse(e)})}};var F=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.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 I=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}};var S=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var q=class{constructor(t){this._transport=t}send({limit:t,request:e={}}={}){return this._transport.send("v1/composition-sections",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}};var P=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var te="SUPPORT_BASE_URL";var ee="https://api.support.greatdetail.com",oe={"X-Powered-By":"GDSupport/JavaScript"};var E=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let o=e.variant??"vcard",r=e.format??(o==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(o)+"&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:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var j=class{constructor(t){this._transport=t}send({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var A=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var B=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var M=class{constructor(t){this._transport=t}send(t,{include:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var D=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var Q=class{constructor(t){this._transport=t}send({limit:t,filter:e,include:o,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...e?[["filter",e]]:[],...this._transport.includeQuery(o??{})]})}};var H=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var K=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.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 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,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var Y=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var $=class{constructor(t){this._transport=t}send({limit:t,query:e,include:o,request:r={}}={}){return this._transport.send("v1/labels",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(o??{})]})}};var J=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var X=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var Z=class{constructor(t){this._transport=t}send(t,{limit:e,include:o,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{})]})}};var tt=class{constructor(t){this._transport=t}send({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}};var et=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var ot=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 rt=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...o,method:"POST",timeout:12e4,headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var st=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var l=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var it=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 pt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var ct=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var dt=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var lt=class n{constructor(t=n.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=oe;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 ut=class{constructor(t){this._transport=t}send({category:t,request:e={}}={}){let o=[];if(t){let r=Array.isArray(t)?t:[t];for(let a of r)o.push(["category",a])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:o})}};var ne=Zt(require("is-network-error"),1),wt=Zt(require("ky"),1);var i=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var d=class extends i{};var Ct=class extends d{static unauthenticated(){return new this("An unauthenticated request occurred")}};var ht=class extends d{static forbidden(){return new this("A forbidden request occurred")}};var c=class extends i{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 ft=class extends i{};var m=class extends i{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var gt=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:[o=>{for(let r of this.options.requestFilterables){let a=r.getHeaders();for(let[Jt,de]of Object.entries(a))o.headers.has(Jt)||o.headers.set(Jt,de)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}limitQuery(t){let e=[];return t&&e.push(["limit",t.toString()]),e}includeQuery(t){let e=[];if(t===void 0)return e;for(let o of Object.keys(t))e.push(["include",o]);return e}queryQuery(t){let e=[];return t&&e.push(["query",t]),e}send(t,e){let o=this.client(t,e).catch(r=>{if((0,ne.default)(r))throw new ft("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 Ct.unauthenticated();case 403:throw ht.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 i.serverError(a)}throw r});return{response:()=>o,json:async()=>(await o).json()}}};var bt=class{constructor(t){this._transport=t}send({account:t,files:e,request:o={}}){let r=new FormData;for(let a of e)r.append("file",a);return this._transport.send("v1/uploads",{...o,method:"POST",body:r,searchParams:{account:t}})}};var yt=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 s=require("zod"),Rt=class n{constructor(t){this._client=t}static SCHEMA=s.z.object({data:s.z.object({event:s.z.intersection(s.z.object({id:s.z.string(),createdAt:s.z.string().datetime()}),s.z.discriminatedUnion("type",[s.z.object({type:s.z.literal("contact.created"),payload:s.z.object({contact:s.z.string()})}),s.z.object({type:s.z.literal("message.created"),payload:s.z.object({message:s.z.string()})})]))})});async event({request:t}){let{data:e}=n.SCHEMA.parse(t.body);return{event:e.event}}};var Ot=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var _t=class n{static DEFAULT_BASE_URL=ee;_transport;constructor(t,{baseURL:e,...o}={}){this._transport=new gt({requestFilterables:[new lt,t],...o,baseURL:e?.toString()??n.getBaseURL()})}static getBaseURL(){return process.env[te]??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 y(this._transport),create:new h(this._transport)}}get boilerplateCategory(){return{get:new R(this._transport),list:new O(this._transport),create:new x(this._transport),update:new _(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 T(this._transport),compositionSection:{list:new S(this._transport)},message:{list:new X(this._transport)},twilioSendgrid:{sync:new w(this._transport)}}}get compositionSection(){return{get:new I(this._transport),list:new q(this._transport),create:new U(this._transport),update:new P(this._transport)}}get contact(){return{get:new N(this._transport),list:new j(this._transport),update:new B(this._transport),create:new G(this._transport),conversation:{list:new D(this._transport)},label:{label:new z(this._transport)},note:{list:new at(this._transport),create:new st(this._transport)},notificationSubscription:{create:new dt(this._transport)},vcf:{get:new E(this._transport)}}}get conversation(){return{get:new M(this._transport),list:new Q(this._transport),update:new K(this._transport),create:new l(this._transport),label:{list:new Y(this._transport)},message:{list:new Z(this._transport)},note:{list:new pt(this._transport),create:new l(this._transport)}}}get label(){return{create:new k(this._transport),get:new W(this._transport),list:new $(this._transport),update:new J(this._transport),delete:new V(this._transport),contact:{list:new A(this._transport)},conversation:{list:new H(this._transport)}}}get message(){return{list:new tt(this._transport)}}get model(){return{get:new ot(this._transport),list:new nt(this._transport),response:{create:new rt(this._transport)},correction:{create:new et(this._transport)}}}get note(){return{get:new it(this._transport),update:new ct(this._transport)}}get source(){return{get:new mt(this._transport),list:new ut(this._transport)}}get upload(){return{get:new xt(this._transport),create:new bt(this._transport),delete:new yt(this._transport)}}get webhook(){return new Rt(this)}get wellKnown(){return{notification:{get:new Ot(this._transport)}}}};var Et=require("commander"),re=require("ora");function Gt({client:n,ora:t}){let e=new Et.Command("actions").description("Actions");return e.addCommand(new Et.Command("list").description("List actions").action(async()=>{let o=await(0,re.oraPromise)(()=>n.action.list.send().json(),{...t,text:"Finding actions"});console.log(o)})),e}var Nt=require("commander"),se=require("ora");function jt({client:n,ora:t}){let e=new Nt.Command("channels").description("Channels");return e.addCommand(new Nt.Command("list").description("List channels").action(async()=>{let o=await(0,se.oraPromise)(()=>n.channel.list.send().json(),{...t,text:"Finding channels"});console.log(o)})),e}var Tt=require("commander"),Ft=require("ora");function At({client:n,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 o=>{let r=await(0,Ft.oraPromise)(()=>n.contact.get.send(o).json(),{...t,text:"Finding contact"});console.log(r)})),e.addCommand(new Tt.Command("list").description("List contacts").action(async()=>{let o=await(0,Ft.oraPromise)(()=>n.contact.list.send().json(),{...t,text:"Finding contacts"});console.log(o)})),e.addCommand(new Tt.Command("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async o=>{let r=await(0,Ft.oraPromise)(()=>n.contact.vcf.get.send({id:o}).response(),{...t,text:"Exporting contact"});console.log(r)})),e}var Ut=require("commander"),Bt=require("ora");function Mt({client:n,ora:t}){let e=new Ut.Command("conversations").description("Conversations");return e.addCommand(new Ut.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async o=>{let r=await(0,Bt.oraPromise)(()=>n.conversation.get.send(o).json(),{...t,text:"Finding conversation"});console.log(r)})),e.addCommand(new Ut.Command("list").description("List conversations").action(async()=>{let o=await(0,Bt.oraPromise)(()=>n.conversation.list.send().json(),{...t,text:"Finding conversations"});console.log(o)})),e}var vt=require("commander"),It=require("ora");function Dt({client:n,ora:t}){let e=new vt.Command("labels").description("Labels");return e.addCommand(new vt.Command("get").description("Find label").argument("<label>","Label ID").action(async o=>{let r=await(0,It.oraPromise)(()=>n.label.get.send(o).json(),{...t,text:"Finding label"});console.log(r)})),e.addCommand(new vt.Command("list").description("List labels").action(async()=>{let o=await(0,It.oraPromise)(()=>n.label.list.send().json(),{...t,text:"Finding labels"});console.log(o)})),e.addCommand(new vt.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async o=>{let r=await(0,It.oraPromise)(()=>n.label.conversation.list.send(o).json(),{...t,text:"Finding conversations"});console.log(r)})),e}var Qt=require("commander"),ie=require("ora");function Ht({client:n,ora:t}){let e=new Qt.Command("messages").description("Messages");return e.addCommand(new Qt.Command("list").description("List messages").action(async()=>{let o=await(0,ie.oraPromise)(()=>n.message.list.send().json(),{...t,text:"Finding messages"});console.log(o)})),e}var St=require("commander"),Kt=require("ora");function kt({client:n,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 o=>{let r=await(0,Kt.oraPromise)(()=>n.model.get.send(o).json(),{...t,text:"Finding model"});console.log(r)})),e.addCommand(new St.Command("list").description("List models").action(async()=>{let o=await(0,Kt.oraPromise)(()=>n.model.list.send().json(),{...t,text:"Finding models"});console.log(o)})),e}var qt=require("commander"),Vt=require("ora");function Wt({client:n,ora:t}){let e=new qt.Command("sources").description("Sources");return e.addCommand(new qt.Command("get").description("Find source").argument("<source>","Source ID").action(async o=>{let r=await(0,Vt.oraPromise)(()=>n.source.get.send(o).json(),{...t,text:"Finding source"});console.log(r)})),e.addCommand(new qt.Command("list").description("List sources").action(async()=>{let o=await(0,Vt.oraPromise)(()=>n.source.list.send().json(),{...t,text:"Finding sources"});console.log(o)})),e}var pe=require("commander");var zt=require("commander"),ae=require("ora");function Yt({client:n,ora:t}){let e=new zt.Command("notifications").description("Well-Known Notifications Details");return e.addCommand(new zt.Command("get").description("Get Notifications Server Well-Known Info").action(async()=>{let o=await(0,ae.oraPromise)(()=>n.wellKnown.notification.get.send().json(),{...t,text:"Finding Notifications Well-Known Info"});console.log(o)})),e}function $t({client:n,ora:t}){let e=new pe.Command("well-known").description("Well-Known Metadata & Info");return e.addCommand(Yt({client:n,ora:t})),e}var p={ora:{spinner:"simpleDotsScrolling"},client:new _t(new u)},be=new ce.Command("gds").description("Great Detail Support System").addCommand(Gt(p)).addCommand(jt(p)).addCommand(At(p)).addCommand(Mt(p)).addCommand(Dt(p)).addCommand(Ht(p)).addCommand(kt(p)).addCommand(Wt(p)).addCommand($t(p)),ye=be;
@@ -1,5 +1,5 @@
1
1
  import { Command } from 'commander';
2
- import { C as Client } from '../index-D2F3tbZm.cjs';
2
+ import { C as Client } from '../index-ylqKeL9v.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-D2F3tbZm.js';
2
+ import { C as Client } from '../index-ylqKeL9v.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-2DLQAQBH.js";import"../chunk-3BYSZXZ7.js";export{a as default};
1
+ import{a}from"../chunk-WWEXNIIV.js";import"../chunk-NSQETRTT.js";export{a as default};
package/dist/cli.cjs CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
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=(n,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of me(t))!Ce.call(n,r)&&r!==e&&$t(n,r,{get:()=>t[r],enumerable:!(o=le(t,r))||o.enumerable});return n};var Jt=(n,t,e)=>(e=n!=null?de(ue(n)):{},he(t||!n||!n.__esModule?$t(e,"default",{value:n,enumerable:!0}):e,n));var ae=require("commander");var u=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var C=class{constructor(t){this._transport=t}send({limit:t,request:e={}}={}){return this._transport.send("v1/actions",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}};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,{limit:e,request:o={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var b=class{constructor(t){this._transport=t}send({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/boilerplates",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var y=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var x=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({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/boilerplate-categories",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}};var _=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.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/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({limit:t,request:e={}}={}){return this._transport.send("v1/channels",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}};var St=require("zod"),L=class n{constructor(t){this._transport=t}static SCHEMA=St.z.object({overwrite:St.z.boolean().optional()});send(t,{body:e,request:o={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:n.SCHEMA.parse(e)})}};var F=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.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 I=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}};var S=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var q=class{constructor(t){this._transport=t}send({limit:t,request:e={}}={}){return this._transport.send("v1/composition-sections",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}};var P=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.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 E=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let o=e.variant??"vcard",r=e.format??(o==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(o)+"&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:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var j=class{constructor(t){this._transport=t}send({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var A=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var B=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var M=class{constructor(t){this._transport=t}send(t,{include:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var D=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var H=class{constructor(t){this._transport=t}send({limit:t,filter:e,include:o,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...e?[["filter",e]]:[],...this._transport.includeQuery(o??{})]})}};var Q=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var K=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.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 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,{limit:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var Y=class{constructor(t){this._transport=t}send({limit:t,query:e,include:o,request:r={}}={}){return this._transport.send("v1/labels",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(o??{})]})}};var $=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var J=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var X=class{constructor(t){this._transport=t}send(t,{limit:e,include:o,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{})]})}};var Z=class{constructor(t){this._transport=t}send({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}};var tt=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...o,method:"POST",headers:{...o.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:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...o,method:"POST",timeout:12e4,headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var rt=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var l=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",headers:{...o.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:o={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var ct=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var dt=class n{constructor(t=n.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 o=[];if(t){let r=Array.isArray(t)?t:[t];for(let a of r)o.push(["category",a])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:o})}};var ee=Jt(require("is-network-error"),1),vt=Jt(require("ky"),1);var i=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var d=class extends i{};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 i{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 i{};var m=class extends i{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:[o=>{for(let r of this.options.requestFilterables){let a=r.getHeaders();for(let[Yt,ce]of Object.entries(a))o.headers.has(Yt)||o.headers.set(Yt,ce)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}limitQuery(t){let e=[];return t&&e.push(["limit",t.toString()]),e}includeQuery(t){let e=[];if(t===void 0)return e;for(let o of Object.keys(t))e.push(["include",o]);return e}queryQuery(t){let e=[];return t&&e.push(["query",t]),e}send(t,e){let o=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 i.serverError(a)}throw r});return{response:()=>o,json:async()=>(await o).json()}}};var gt=class{constructor(t){this._transport=t}send({account:t,files:e,request:o={}}){let r=new FormData;for(let a of e)r.append("file",a);return this._transport.send("v1/uploads",{...o,method:"POST",body:r,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 yt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var s=require("zod"),xt=class n{constructor(t){this._client=t}static SCHEMA=s.z.object({data:s.z.object({event:s.z.intersection(s.z.object({id:s.z.string(),createdAt:s.z.string().datetime()}),s.z.discriminatedUnion("type",[s.z.object({type:s.z.literal("contact.created"),payload:s.z.object({contact:s.z.string()})}),s.z.object({type:s.z.literal("message.created"),payload:s.z.object({message:s.z.string()})})]))})});async event({request:t}){let{data:e}=n.SCHEMA.parse(t.body);return{event:e.event}}};var Rt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var Ot=class n{static DEFAULT_BASE_URL=Zt;_transport;constructor(t,{baseURL:e,...o}={}){this._transport=new ft({requestFilterables:[new dt,t],...o,baseURL:e?.toString()??n.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 b(this._transport),update:new y(this._transport),create:new h(this._transport)}}get boilerplateCategory(){return{get:new R(this._transport),list:new O(this._transport),create:new x(this._transport),update:new _(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 T(this._transport),compositionSection:{list:new S(this._transport)},message:{list:new J(this._transport)},twilioSendgrid:{sync:new L(this._transport)}}}get compositionSection(){return{get:new I(this._transport),list:new q(this._transport),create:new U(this._transport),update:new P(this._transport)}}get contact(){return{get:new N(this._transport),list:new j(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 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 X(this._transport)},note:{list:new at(this._transport),create:new l(this._transport)}}}get label(){return{create:new k(this._transport),get:new W(this._transport),list:new Y(this._transport),update:new $(this._transport),delete:new V(this._transport),contact:{list:new A(this._transport)},conversation:{list:new Q(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 yt(this._transport),create:new gt(this._transport),delete:new bt(this._transport)}}get webhook(){return new xt(this)}get wellKnown(){return{notification:{get:new Rt(this._transport)}}}};var qt=require("commander"),oe=require("ora");function Pt({client:n,ora:t}){let e=new qt.Command("actions").description("Actions");return e.addCommand(new qt.Command("list").description("List actions").action(async()=>{let o=await(0,oe.oraPromise)(()=>n.action.list.send().json(),{...t,text:"Finding actions"});console.log(o)})),e}var Et=require("commander"),ne=require("ora");function Gt({client:n,ora:t}){let e=new Et.Command("channels").description("Channels");return e.addCommand(new Et.Command("list").description("List channels").action(async()=>{let o=await(0,ne.oraPromise)(()=>n.channel.list.send().json(),{...t,text:"Finding channels"});console.log(o)})),e}var _t=require("commander"),wt=require("ora");function Nt({client:n,ora:t}){let e=new _t.Command("contacts").description("Contacts");return e.addCommand(new _t.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async o=>{let r=await(0,wt.oraPromise)(()=>n.contact.get.send(o).json(),{...t,text:"Finding contact"});console.log(r)})),e.addCommand(new _t.Command("list").description("List contacts").action(async()=>{let o=await(0,wt.oraPromise)(()=>n.contact.list.send().json(),{...t,text:"Finding contacts"});console.log(o)})),e.addCommand(new _t.Command("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async o=>{let r=await(0,wt.oraPromise)(()=>n.contact.vcf.get.send({id:o}).response(),{...t,text:"Exporting contact"});console.log(r)})),e}var Lt=require("commander"),jt=require("ora");function At({client:n,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 o=>{let r=await(0,jt.oraPromise)(()=>n.conversation.get.send(o).json(),{...t,text:"Finding conversation"});console.log(r)})),e.addCommand(new Lt.Command("list").description("List conversations").action(async()=>{let o=await(0,jt.oraPromise)(()=>n.conversation.list.send().json(),{...t,text:"Finding conversations"});console.log(o)})),e}var Tt=require("commander"),Ft=require("ora");function Bt({client:n,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 o=>{let r=await(0,Ft.oraPromise)(()=>n.label.get.send(o).json(),{...t,text:"Finding label"});console.log(r)})),e.addCommand(new Tt.Command("list").description("List labels").action(async()=>{let o=await(0,Ft.oraPromise)(()=>n.label.list.send().json(),{...t,text:"Finding labels"});console.log(o)})),e.addCommand(new Tt.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async o=>{let r=await(0,Ft.oraPromise)(()=>n.label.conversation.list.send(o).json(),{...t,text:"Finding conversations"});console.log(r)})),e}var Mt=require("commander"),re=require("ora");function Dt({client:n,ora:t}){let e=new Mt.Command("messages").description("Messages");return e.addCommand(new Mt.Command("list").description("List messages").action(async()=>{let o=await(0,re.oraPromise)(()=>n.message.list.send().json(),{...t,text:"Finding messages"});console.log(o)})),e}var Ut=require("commander"),Ht=require("ora");function Qt({client:n,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 o=>{let r=await(0,Ht.oraPromise)(()=>n.model.get.send(o).json(),{...t,text:"Finding model"});console.log(r)})),e.addCommand(new Ut.Command("list").description("List models").action(async()=>{let o=await(0,Ht.oraPromise)(()=>n.model.list.send().json(),{...t,text:"Finding models"});console.log(o)})),e}var It=require("commander"),Kt=require("ora");function kt({client:n,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 o=>{let r=await(0,Kt.oraPromise)(()=>n.source.get.send(o).json(),{...t,text:"Finding source"});console.log(r)})),e.addCommand(new It.Command("list").description("List sources").action(async()=>{let o=await(0,Kt.oraPromise)(()=>n.source.list.send().json(),{...t,text:"Finding sources"});console.log(o)})),e}var ie=require("commander");var Vt=require("commander"),se=require("ora");function Wt({client:n,ora:t}){let e=new Vt.Command("notifications").description("Well-Known Notifications Details");return e.addCommand(new Vt.Command("get").description("Get Notifications Server Well-Known Info").action(async()=>{let o=await(0,se.oraPromise)(()=>n.wellKnown.notification.get.send().json(),{...t,text:"Finding Notifications Well-Known Info"});console.log(o)})),e}function zt({client:n,ora:t}){let e=new ie.Command("well-known").description("Well-Known Metadata & Info");return e.addCommand(Wt({client:n,ora:t})),e}var p={ora:{spinner:"simpleDotsScrolling"},client:new Ot(new u)},fe=new ae.Command("gds").description("Great Detail Support System").addCommand(Pt(p)).addCommand(Gt(p)).addCommand(Nt(p)).addCommand(At(p)).addCommand(Bt(p)).addCommand(Dt(p)).addCommand(Qt(p)).addCommand(kt(p)).addCommand(zt(p)),pe=fe;pe.parseAsync(process.argv);
2
+ "use strict";var le=Object.create;var Jt=Object.defineProperty;var me=Object.getOwnPropertyDescriptor;var ue=Object.getOwnPropertyNames;var Ce=Object.getPrototypeOf,he=Object.prototype.hasOwnProperty;var fe=(n,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of ue(t))!he.call(n,r)&&r!==e&&Jt(n,r,{get:()=>t[r],enumerable:!(o=me(t,r))||o.enumerable});return n};var Xt=(n,t,e)=>(e=n!=null?le(Ce(n)):{},fe(t||!n||!n.__esModule?Jt(e,"default",{value:n,enumerable:!0}):e,n));var pe=require("commander");var u=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var C=class{constructor(t){this._transport=t}send({limit:t,request:e={}}={}){return this._transport.send("v1/actions",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}};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,{limit:e,request:o={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var b=class{constructor(t){this._transport=t}send({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/boilerplates",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var y=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var x=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({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/boilerplate-categories",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}};var _=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.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/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({limit:t,request:e={}}={}){return this._transport.send("v1/channels",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}};var qt=require("zod"),w=class n{constructor(t){this._transport=t}static SCHEMA=qt.z.object({overwrite:qt.z.boolean().optional()});send(t,{body:e,request:o={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:n.SCHEMA.parse(e)})}};var F=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.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 I=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}};var S=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var q=class{constructor(t){this._transport=t}send({limit:t,request:e={}}={}){return this._transport.send("v1/composition-sections",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}};var P=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.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 E=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let o=e.variant??"vcard",r=e.format??(o==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(o)+"&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:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var j=class{constructor(t){this._transport=t}send({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var A=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var B=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var M=class{constructor(t){this._transport=t}send(t,{include:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var D=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var Q=class{constructor(t){this._transport=t}send({limit:t,filter:e,include:o,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...e?[["filter",e]]:[],...this._transport.includeQuery(o??{})]})}};var H=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var K=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.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 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,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var Y=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var $=class{constructor(t){this._transport=t}send({limit:t,query:e,include:o,request:r={}}={}){return this._transport.send("v1/labels",{...r,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(o??{})]})}};var J=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var X=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var Z=class{constructor(t){this._transport=t}send(t,{limit:e,include:o,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{})]})}};var tt=class{constructor(t){this._transport=t}send({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}};var et=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var ot=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 rt=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...o,method:"POST",timeout:12e4,headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var st=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var l=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var it=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 pt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var ct=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var dt=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var lt=class n{constructor(t=n.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=ee;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 ut=class{constructor(t){this._transport=t}send({category:t,request:e={}}={}){let o=[];if(t){let r=Array.isArray(t)?t:[t];for(let a of r)o.push(["category",a])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:o})}};var oe=Xt(require("is-network-error"),1),Lt=Xt(require("ky"),1);var i=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var d=class extends i{};var Ct=class extends d{static unauthenticated(){return new this("An unauthenticated request occurred")}};var ht=class extends d{static forbidden(){return new this("A forbidden request occurred")}};var c=class extends i{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 ft=class extends i{};var m=class extends i{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var gt=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:[o=>{for(let r of this.options.requestFilterables){let a=r.getHeaders();for(let[$t,de]of Object.entries(a))o.headers.has($t)||o.headers.set($t,de)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}limitQuery(t){let e=[];return t&&e.push(["limit",t.toString()]),e}includeQuery(t){let e=[];if(t===void 0)return e;for(let o of Object.keys(t))e.push(["include",o]);return e}queryQuery(t){let e=[];return t&&e.push(["query",t]),e}send(t,e){let o=this.client(t,e).catch(r=>{if((0,oe.default)(r))throw new ft("A network error occurred",{cause:r});if(r instanceof Lt.HTTPError){let a=r.response.status;switch(console.error(JSON.stringify(r.response)),a){case 400:throw m.badRequest();case 401:throw Ct.unauthenticated();case 403:throw ht.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 i.serverError(a)}throw r});return{response:()=>o,json:async()=>(await o).json()}}};var bt=class{constructor(t){this._transport=t}send({account:t,files:e,request:o={}}){let r=new FormData;for(let a of e)r.append("file",a);return this._transport.send("v1/uploads",{...o,method:"POST",body:r,searchParams:{account:t}})}};var yt=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 s=require("zod"),Rt=class n{constructor(t){this._client=t}static SCHEMA=s.z.object({data:s.z.object({event:s.z.intersection(s.z.object({id:s.z.string(),createdAt:s.z.string().datetime()}),s.z.discriminatedUnion("type",[s.z.object({type:s.z.literal("contact.created"),payload:s.z.object({contact:s.z.string()})}),s.z.object({type:s.z.literal("message.created"),payload:s.z.object({message:s.z.string()})})]))})});async event({request:t}){let{data:e}=n.SCHEMA.parse(t.body);return{event:e.event}}};var Ot=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var _t=class n{static DEFAULT_BASE_URL=te;_transport;constructor(t,{baseURL:e,...o}={}){this._transport=new gt({requestFilterables:[new lt,t],...o,baseURL:e?.toString()??n.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 b(this._transport),update:new y(this._transport),create:new h(this._transport)}}get boilerplateCategory(){return{get:new R(this._transport),list:new O(this._transport),create:new x(this._transport),update:new _(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 T(this._transport),compositionSection:{list:new S(this._transport)},message:{list:new X(this._transport)},twilioSendgrid:{sync:new w(this._transport)}}}get compositionSection(){return{get:new I(this._transport),list:new q(this._transport),create:new U(this._transport),update:new P(this._transport)}}get contact(){return{get:new N(this._transport),list:new j(this._transport),update:new B(this._transport),create:new G(this._transport),conversation:{list:new D(this._transport)},label:{label:new z(this._transport)},note:{list:new at(this._transport),create:new st(this._transport)},notificationSubscription:{create:new dt(this._transport)},vcf:{get:new E(this._transport)}}}get conversation(){return{get:new M(this._transport),list:new Q(this._transport),update:new K(this._transport),create:new l(this._transport),label:{list:new Y(this._transport)},message:{list:new Z(this._transport)},note:{list:new pt(this._transport),create:new l(this._transport)}}}get label(){return{create:new k(this._transport),get:new W(this._transport),list:new $(this._transport),update:new J(this._transport),delete:new V(this._transport),contact:{list:new A(this._transport)},conversation:{list:new H(this._transport)}}}get message(){return{list:new tt(this._transport)}}get model(){return{get:new ot(this._transport),list:new nt(this._transport),response:{create:new rt(this._transport)},correction:{create:new et(this._transport)}}}get note(){return{get:new it(this._transport),update:new ct(this._transport)}}get source(){return{get:new mt(this._transport),list:new ut(this._transport)}}get upload(){return{get:new xt(this._transport),create:new bt(this._transport),delete:new yt(this._transport)}}get webhook(){return new Rt(this)}get wellKnown(){return{notification:{get:new Ot(this._transport)}}}};var Pt=require("commander"),ne=require("ora");function Et({client:n,ora:t}){let e=new Pt.Command("actions").description("Actions");return e.addCommand(new Pt.Command("list").description("List actions").action(async()=>{let o=await(0,ne.oraPromise)(()=>n.action.list.send().json(),{...t,text:"Finding actions"});console.log(o)})),e}var Gt=require("commander"),re=require("ora");function Nt({client:n,ora:t}){let e=new Gt.Command("channels").description("Channels");return e.addCommand(new Gt.Command("list").description("List channels").action(async()=>{let o=await(0,re.oraPromise)(()=>n.channel.list.send().json(),{...t,text:"Finding channels"});console.log(o)})),e}var Tt=require("commander"),wt=require("ora");function jt({client:n,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 o=>{let r=await(0,wt.oraPromise)(()=>n.contact.get.send(o).json(),{...t,text:"Finding contact"});console.log(r)})),e.addCommand(new Tt.Command("list").description("List contacts").action(async()=>{let o=await(0,wt.oraPromise)(()=>n.contact.list.send().json(),{...t,text:"Finding contacts"});console.log(o)})),e.addCommand(new Tt.Command("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async o=>{let r=await(0,wt.oraPromise)(()=>n.contact.vcf.get.send({id:o}).response(),{...t,text:"Exporting contact"});console.log(r)})),e}var Ft=require("commander"),At=require("ora");function Bt({client:n,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 o=>{let r=await(0,At.oraPromise)(()=>n.conversation.get.send(o).json(),{...t,text:"Finding conversation"});console.log(r)})),e.addCommand(new Ft.Command("list").description("List conversations").action(async()=>{let o=await(0,At.oraPromise)(()=>n.conversation.list.send().json(),{...t,text:"Finding conversations"});console.log(o)})),e}var vt=require("commander"),Ut=require("ora");function Mt({client:n,ora:t}){let e=new vt.Command("labels").description("Labels");return e.addCommand(new vt.Command("get").description("Find label").argument("<label>","Label ID").action(async o=>{let r=await(0,Ut.oraPromise)(()=>n.label.get.send(o).json(),{...t,text:"Finding label"});console.log(r)})),e.addCommand(new vt.Command("list").description("List labels").action(async()=>{let o=await(0,Ut.oraPromise)(()=>n.label.list.send().json(),{...t,text:"Finding labels"});console.log(o)})),e.addCommand(new vt.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async o=>{let r=await(0,Ut.oraPromise)(()=>n.label.conversation.list.send(o).json(),{...t,text:"Finding conversations"});console.log(r)})),e}var Dt=require("commander"),se=require("ora");function Qt({client:n,ora:t}){let e=new Dt.Command("messages").description("Messages");return e.addCommand(new Dt.Command("list").description("List messages").action(async()=>{let o=await(0,se.oraPromise)(()=>n.message.list.send().json(),{...t,text:"Finding messages"});console.log(o)})),e}var It=require("commander"),Ht=require("ora");function Kt({client:n,ora:t}){let e=new It.Command("models").description("Models");return e.addCommand(new It.Command("get").description("Find model").argument("<model>","Model ID").action(async o=>{let r=await(0,Ht.oraPromise)(()=>n.model.get.send(o).json(),{...t,text:"Finding model"});console.log(r)})),e.addCommand(new It.Command("list").description("List models").action(async()=>{let o=await(0,Ht.oraPromise)(()=>n.model.list.send().json(),{...t,text:"Finding models"});console.log(o)})),e}var St=require("commander"),kt=require("ora");function Vt({client:n,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 o=>{let r=await(0,kt.oraPromise)(()=>n.source.get.send(o).json(),{...t,text:"Finding source"});console.log(r)})),e.addCommand(new St.Command("list").description("List sources").action(async()=>{let o=await(0,kt.oraPromise)(()=>n.source.list.send().json(),{...t,text:"Finding sources"});console.log(o)})),e}var ae=require("commander");var Wt=require("commander"),ie=require("ora");function zt({client:n,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 o=await(0,ie.oraPromise)(()=>n.wellKnown.notification.get.send().json(),{...t,text:"Finding Notifications Well-Known Info"});console.log(o)})),e}function Yt({client:n,ora:t}){let e=new ae.Command("well-known").description("Well-Known Metadata & Info");return e.addCommand(zt({client:n,ora:t})),e}var p={ora:{spinner:"simpleDotsScrolling"},client:new _t(new u)},ge=new pe.Command("gds").description("Great Detail Support System").addCommand(Et(p)).addCommand(Nt(p)).addCommand(jt(p)).addCommand(Bt(p)).addCommand(Mt(p)).addCommand(Qt(p)).addCommand(Kt(p)).addCommand(Vt(p)).addCommand(Yt(p)),ce=ge;ce.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-2DLQAQBH.js";import"./chunk-3BYSZXZ7.js";r.parseAsync(process.argv);
2
+ import{a as r}from"./chunk-WWEXNIIV.js";import"./chunk-NSQETRTT.js";r.parseAsync(process.argv);
@@ -1012,6 +1012,24 @@ declare class GetLabel {
1012
1012
  };
1013
1013
  }
1014
1014
 
1015
+ interface ListContactLabelsOptions {
1016
+ limit?: number;
1017
+ request?: RequestInit;
1018
+ }
1019
+ type ListContactLabelsResponse = {
1020
+ data: {
1021
+ label: Label;
1022
+ }[];
1023
+ };
1024
+ declare class ListContactLabels {
1025
+ protected _transport: FetchTransport;
1026
+ constructor(_transport: FetchTransport);
1027
+ send(id: string, { limit, request }?: ListContactLabelsOptions): {
1028
+ response: () => Promise<ky.KyResponse<ListContactLabelsResponse>>;
1029
+ json: () => Promise<ListContactLabelsResponse>;
1030
+ };
1031
+ }
1032
+
1015
1033
  interface ListConversationLabelsOptions {
1016
1034
  limit?: number;
1017
1035
  request?: RequestInit;
@@ -1839,6 +1857,9 @@ declare class Client {
1839
1857
  conversation: {
1840
1858
  list: ListContactConversations;
1841
1859
  };
1860
+ label: {
1861
+ label: ListContactLabels;
1862
+ };
1842
1863
  note: {
1843
1864
  list: ListContactNotes;
1844
1865
  create: CreateContactNote;
@@ -1913,4 +1934,4 @@ declare class Client {
1913
1934
  };
1914
1935
  }
1915
1936
 
1916
- 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 };
1937
+ export { type ListMessagesResponse 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 ListContactLabelsResponse as Y, type Message as Z, type ListConversationMessagesResponse as _, type Conversation as a, type ListChannelMessagesResponse as a0, type Model as a1, type GetModelResponse as a2, type ListModelsResponse as a3, type CreateCorrectionResponse as a4, type CreateResponseResponse as a5, type Note as a6, type CreateContactNoteResponse as a7, type CreateConversationNoteResponse as a8, type GetNoteResponse as a9, type ListContactNotesResponse as aa, type ListConversationNotesResponse as ab, type UpdateNoteResponse as ac, type Source as ad, type GetSourceResponse as ae, type ListSourcesResponse as af, type NotificationSubscription as ag, type CreateContactNotificationSubscriptionResponse as ah, type Upload as ai, type CreateUploadResponse as aj, type GetUploadResponse as ak, type DeleteUploadResponse as al, type GetNotificationWellKnownResponse as am, 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 };
@@ -1012,6 +1012,24 @@ declare class GetLabel {
1012
1012
  };
1013
1013
  }
1014
1014
 
1015
+ interface ListContactLabelsOptions {
1016
+ limit?: number;
1017
+ request?: RequestInit;
1018
+ }
1019
+ type ListContactLabelsResponse = {
1020
+ data: {
1021
+ label: Label;
1022
+ }[];
1023
+ };
1024
+ declare class ListContactLabels {
1025
+ protected _transport: FetchTransport;
1026
+ constructor(_transport: FetchTransport);
1027
+ send(id: string, { limit, request }?: ListContactLabelsOptions): {
1028
+ response: () => Promise<ky.KyResponse<ListContactLabelsResponse>>;
1029
+ json: () => Promise<ListContactLabelsResponse>;
1030
+ };
1031
+ }
1032
+
1015
1033
  interface ListConversationLabelsOptions {
1016
1034
  limit?: number;
1017
1035
  request?: RequestInit;
@@ -1839,6 +1857,9 @@ declare class Client {
1839
1857
  conversation: {
1840
1858
  list: ListContactConversations;
1841
1859
  };
1860
+ label: {
1861
+ label: ListContactLabels;
1862
+ };
1842
1863
  note: {
1843
1864
  list: ListContactNotes;
1844
1865
  create: CreateContactNote;
@@ -1913,4 +1934,4 @@ declare class Client {
1913
1934
  };
1914
1935
  }
1915
1936
 
1916
- 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 };
1937
+ export { type ListMessagesResponse 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 ListContactLabelsResponse as Y, type Message as Z, type ListConversationMessagesResponse as _, type Conversation as a, type ListChannelMessagesResponse as a0, type Model as a1, type GetModelResponse as a2, type ListModelsResponse as a3, type CreateCorrectionResponse as a4, type CreateResponseResponse as a5, type Note as a6, type CreateContactNoteResponse as a7, type CreateConversationNoteResponse as a8, type GetNoteResponse as a9, type ListContactNotesResponse as aa, type ListConversationNotesResponse as ab, type UpdateNoteResponse as ac, type Source as ad, type GetSourceResponse as ae, type ListSourcesResponse as af, type NotificationSubscription as ag, type CreateContactNotificationSubscriptionResponse as ah, type Upload as ai, type CreateUploadResponse as aj, type GetUploadResponse as ak, type DeleteUploadResponse as al, type GetNotificationWellKnownResponse as am, 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 Ht=Object.create;var Ot=Object.defineProperty;var Dt=Object.getOwnPropertyDescriptor;var kt=Object.getOwnPropertyNames;var Qt=Object.getPrototypeOf,Kt=Object.prototype.hasOwnProperty;var It=(r,t)=>{for(var e in t)Ot(r,e,{get:t[e],enumerable:!0})},wt=(r,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of kt(t))!Kt.call(r,n)&&n!==e&&Ot(r,n,{get:()=>t[n],enumerable:!(o=Dt(t,n))||o.enumerable});return r};var Et=(r,t,e)=>(e=r!=null?Ht(Qt(r)):{},wt(t||!r||!r.__esModule?Ot(e,"default",{value:r,enumerable:!0}):e,r)),Vt=r=>wt(Ot({},"__esModule",{value:!0}),r);var zt={};It(zt,{Client:()=>f,DEFAULT_SUPPORT_BASE_URL:()=>vt,Error:()=>Ft,KeyAuthentication:()=>Rt,PublicAuthentication:()=>Tt,TokenAuthentication:()=>_t,default:()=>f});module.exports=Vt(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({limit:t,request:e={}}={}){return this._transport.send("v1/actions",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}};var b=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 g=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,{limit:e,request:o={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var y=class{constructor(t){this._transport=t}send({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/boilerplates",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var R=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var _=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 T=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({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/boilerplate-categories",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}};var v=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.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({limit:t,request:e={}}={}){return this._transport.send("v1/channels",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}};var Ut=require("zod"),S=class r{constructor(t){this._transport=t}static SCHEMA=Ut.z.object({overwrite:Ut.z.boolean().optional()});send(t,{body:e,request:o={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:r.SCHEMA.parse(e)})}};var I=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.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,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var A=class{constructor(t){this._transport=t}send({limit:t,request:e={}}={}){return this._transport.send("v1/composition-sections",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}};var P=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var Pt="SUPPORT_ACCESS_TOKEN",Gt="SUPPORT_API_KEY",Nt="SUPPORT_KEY_NAME",Bt="SUPPORT_BASE_URL";var G=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let o=e.variant??"vcard",n=e.format??(o==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(o)+"&format="+encodeURIComponent(n)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}send(t){return this._transport.send(this.getURL(t),{method:"GET"})}};var N=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:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var M=class{constructor(t){this._transport=t}send({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var j=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var H=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var D=class{constructor(t){this._transport=t}send(t,{include:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var k=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var Q=class{constructor(t){this._transport=t}send({limit:t,filter:e,include:o,request:n={}}={}){return this._transport.send("v1/conversations",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...e?[["filter",e]]:[],...this._transport.includeQuery(o??{})]})}};var K=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var V=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.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,{limit:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var J=class{constructor(t){this._transport=t}send({limit:t,query:e,include:o,request:n={}}={}){return this._transport.send("v1/labels",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(o??{})]})}};var X=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var Z=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var tt=class{constructor(t){this._transport=t}send(t,{limit:e,include:o,request:n={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{})]})}};var et=class{constructor(t){this._transport=t}send({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}};var ot=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...o,method:"POST",headers:{...o.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:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...o,method:"POST",timeout:12e4,headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var it=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var h=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var at=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var pt=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:o={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var dt=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var ut=class r{constructor(t=r.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 o=[];if(t){let n=Array.isArray(t)?t:[t];for(let a of n)o.push(["category",a])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:o})}};var Mt=Et(require("is-network-error"),1),Lt=Et(require("ky"),1);var i=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var c=class extends i{};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 p=class extends i{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 i{};var l=class extends i{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:[o=>{for(let n of this.options.requestFilterables){let a=n.getHeaders();for(let[St,jt]of Object.entries(a))o.headers.has(St)||o.headers.set(St,jt)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}limitQuery(t){let e=[];return t&&e.push(["limit",t.toString()]),e}includeQuery(t){let e=[];if(t===void 0)return e;for(let o of Object.keys(t))e.push(["include",o]);return e}queryQuery(t){let e=[];return t&&e.push(["query",t]),e}send(t,e){let o=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 a=n.response.status;switch(console.error(JSON.stringify(n.response)),a){case 400:throw l.badRequest();case 401:throw d.unauthenticated();case 403:throw u.forbidden();case 404:throw p.notFound(t);case 405:throw p.forbiddenMethod(t,e.method??"GET");case 415:throw l.unsupportedMediaType();case 418:throw p.teapot();case 429:throw p.rateLimited()}if(a>=500&&a<600)throw i.serverError(a)}throw n});return{response:()=>o,json:async()=>(await o).json()}}};var Ct=class{constructor(t){this._transport=t}send({account:t,files:e,request:o={}}){let n=new FormData;for(let a of e)n.append("file",a);return this._transport.send("v1/uploads",{...o,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 gt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var s=require("zod"),xt=class r{constructor(t){this._client=t}static SCHEMA=s.z.object({data:s.z.object({event:s.z.intersection(s.z.object({id:s.z.string(),createdAt:s.z.string().datetime()}),s.z.discriminatedUnion("type",[s.z.object({type:s.z.literal("contact.created"),payload:s.z.object({contact:s.z.string()})}),s.z.object({type:s.z.literal("message.created"),payload:s.z.object({message:s.z.string()})})]))})});async event({request:t}){let{data:e}=r.SCHEMA.parse(t.body);return{event:e.event}}};var yt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var f=class r{static DEFAULT_BASE_URL=vt;_transport;constructor(t,{baseURL:e,...o}={}){this._transport=new ft({requestFilterables:[new ut,t],...o,baseURL:e?.toString()??r.getBaseURL()})}static getBaseURL(){return process.env[Bt]??this.DEFAULT_BASE_URL}get action(){return{list:new C(this._transport)}}get boilerplate(){return{get:new g(this._transport),list:new y(this._transport),update:new R(this._transport),create:new b(this._transport)}}get boilerplateCategory(){return{get:new T(this._transport),list:new O(this._transport),create:new _(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 P(this._transport)}}get contact(){return{get:new B(this._transport),list:new M(this._transport),update:new H(this._transport),create:new N(this._transport),conversation:{list:new k(this._transport)},note:{list:new pt(this._transport),create:new it(this._transport)},notificationSubscription:{create:new dt(this._transport)},vcf:{get:new G(this._transport)}}}get conversation(){return{get:new D(this._transport),list:new Q(this._transport),update:new V(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 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 at(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 gt(this._transport),create:new Ct(this._transport),delete:new bt(this._transport)}}get webhook(){return new xt(this)}get wellKnown(){return{notification:{get:new yt(this._transport)}}}};var Ft={};It(Ft,{AuthError:()=>c,AuthenticationError:()=>d,AuthorizationError:()=>u,LogicError:()=>p,NetworkError:()=>m,SupportError:()=>i,ValidationError:()=>l});var Rt=class r{static DEFAULT_NAME=At;name;#t;constructor({name:t=process.env[Nt]??r.DEFAULT_NAME,key:e=process.env[Gt]}={}){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 _t=class{#t;constructor({token:t=process.env[Pt]}={}){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 Dt=Object.create;var Lt=Object.defineProperty;var kt=Object.getOwnPropertyDescriptor;var Qt=Object.getOwnPropertyNames;var Kt=Object.getPrototypeOf,Vt=Object.prototype.hasOwnProperty;var wt=(r,t)=>{for(var e in t)Lt(r,e,{get:t[e],enumerable:!0})},Et=(r,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Qt(t))!Vt.call(r,n)&&n!==e&&Lt(r,n,{get:()=>t[n],enumerable:!(o=kt(t,n))||o.enumerable});return r};var qt=(r,t,e)=>(e=r!=null?Dt(Kt(r)):{},Et(t||!r||!r.__esModule?Lt(e,"default",{value:r,enumerable:!0}):e,r)),zt=r=>Et(Lt({},"__esModule",{value:!0}),r);var Wt={};wt(Wt,{Client:()=>f,DEFAULT_SUPPORT_BASE_URL:()=>vt,Error:()=>St,KeyAuthentication:()=>_t,PublicAuthentication:()=>Ot,TokenAuthentication:()=>Tt,default:()=>f});module.exports=zt(Wt);var vt="https://api.support.greatdetail.com",At={"X-Powered-By":"GDSupport/JavaScript"},Pt="api-key";var C=class{constructor(t){this._transport=t}send({limit:t,request:e={}}={}){return this._transport.send("v1/actions",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}};var b=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 g=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,{limit:e,request:o={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var y=class{constructor(t){this._transport=t}send({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/boilerplates",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var R=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var _=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 T=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({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/boilerplate-categories",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}};var L=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.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/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({limit:t,request:e={}}={}){return this._transport.send("v1/channels",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}};var Ft=require("zod"),S=class r{constructor(t){this._transport=t}static SCHEMA=Ft.z.object({overwrite:Ft.z.boolean().optional()});send(t,{body:e,request:o={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:r.SCHEMA.parse(e)})}};var I=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.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,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var A=class{constructor(t){this._transport=t}send({limit:t,request:e={}}={}){return this._transport.send("v1/composition-sections",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}};var P=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var Gt="SUPPORT_ACCESS_TOKEN",Nt="SUPPORT_API_KEY",Bt="SUPPORT_KEY_NAME",Mt="SUPPORT_BASE_URL";var G=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let o=e.variant??"vcard",n=e.format??(o==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(o)+"&format="+encodeURIComponent(n)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}send(t){return this._transport.send(this.getURL(t),{method:"GET"})}};var N=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:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var M=class{constructor(t){this._transport=t}send({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var j=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var H=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var D=class{constructor(t){this._transport=t}send(t,{include:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var k=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var Q=class{constructor(t){this._transport=t}send({limit:t,filter:e,include:o,request:n={}}={}){return this._transport.send("v1/conversations",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...e?[["filter",e]]:[],...this._transport.includeQuery(o??{})]})}};var K=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var V=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.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,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var J=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var X=class{constructor(t){this._transport=t}send({limit:t,query:e,include:o,request:n={}}={}){return this._transport.send("v1/labels",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(o??{})]})}};var Z=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var tt=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var et=class{constructor(t){this._transport=t}send(t,{limit:e,include:o,request:n={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{})]})}};var ot=class{constructor(t){this._transport=t}send({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}};var rt=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var nt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var st=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var it=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...o,method:"POST",timeout:12e4,headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var at=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var h=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",headers:{...o.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 ct=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var lt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var dt=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var ut=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var mt=class r{constructor(t=r.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=At;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var ht=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var ft=class{constructor(t){this._transport=t}send({category:t,request:e={}}={}){let o=[];if(t){let n=Array.isArray(t)?t:[t];for(let a of n)o.push(["category",a])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:o})}};var jt=qt(require("is-network-error"),1),Ut=qt(require("ky"),1);var i=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var c=class extends i{};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 p=class extends i{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 i{};var l=class extends i{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=Ut.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[o=>{for(let n of this.options.requestFilterables){let a=n.getHeaders();for(let[It,Ht]of Object.entries(a))o.headers.has(It)||o.headers.set(It,Ht)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}limitQuery(t){let e=[];return t&&e.push(["limit",t.toString()]),e}includeQuery(t){let e=[];if(t===void 0)return e;for(let o of Object.keys(t))e.push(["include",o]);return e}queryQuery(t){let e=[];return t&&e.push(["query",t]),e}send(t,e){let o=this.client(t,e).catch(n=>{if((0,jt.default)(n))throw new m("A network error occurred",{cause:n});if(n instanceof Ut.HTTPError){let a=n.response.status;switch(console.error(JSON.stringify(n.response)),a){case 400:throw l.badRequest();case 401:throw d.unauthenticated();case 403:throw u.forbidden();case 404:throw p.notFound(t);case 405:throw p.forbiddenMethod(t,e.method??"GET");case 415:throw l.unsupportedMediaType();case 418:throw p.teapot();case 429:throw p.rateLimited()}if(a>=500&&a<600)throw i.serverError(a)}throw n});return{response:()=>o,json:async()=>(await o).json()}}};var bt=class{constructor(t){this._transport=t}send({account:t,files:e,request:o={}}){let n=new FormData;for(let a of e)n.append("file",a);return this._transport.send("v1/uploads",{...o,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 xt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var s=require("zod"),yt=class r{constructor(t){this._client=t}static SCHEMA=s.z.object({data:s.z.object({event:s.z.intersection(s.z.object({id:s.z.string(),createdAt:s.z.string().datetime()}),s.z.discriminatedUnion("type",[s.z.object({type:s.z.literal("contact.created"),payload:s.z.object({contact:s.z.string()})}),s.z.object({type:s.z.literal("message.created"),payload:s.z.object({message:s.z.string()})})]))})});async event({request:t}){let{data:e}=r.SCHEMA.parse(t.body);return{event:e.event}}};var Rt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var f=class r{static DEFAULT_BASE_URL=vt;_transport;constructor(t,{baseURL:e,...o}={}){this._transport=new Ct({requestFilterables:[new mt,t],...o,baseURL:e?.toString()??r.getBaseURL()})}static getBaseURL(){return process.env[Mt]??this.DEFAULT_BASE_URL}get action(){return{list:new C(this._transport)}}get boilerplate(){return{get:new g(this._transport),list:new y(this._transport),update:new R(this._transport),create:new b(this._transport)}}get boilerplateCategory(){return{get:new T(this._transport),list:new O(this._transport),create:new _(this._transport),update:new L(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 v(this._transport),compositionSection:{list:new q(this._transport)},message:{list:new tt(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 P(this._transport)}}get contact(){return{get:new B(this._transport),list:new M(this._transport),update:new H(this._transport),create:new N(this._transport),conversation:{list:new k(this._transport)},label:{label:new $(this._transport)},note:{list:new ct(this._transport),create:new at(this._transport)},notificationSubscription:{create:new ut(this._transport)},vcf:{get:new G(this._transport)}}}get conversation(){return{get:new D(this._transport),list:new Q(this._transport),update:new V(this._transport),create:new h(this._transport),label:{list:new J(this._transport)},message:{list:new et(this._transport)},note:{list:new lt(this._transport),create:new h(this._transport)}}}get label(){return{create:new z(this._transport),get:new Y(this._transport),list:new X(this._transport),update:new Z(this._transport),delete:new W(this._transport),contact:{list:new j(this._transport)},conversation:{list:new K(this._transport)}}}get message(){return{list:new ot(this._transport)}}get model(){return{get:new nt(this._transport),list:new st(this._transport),response:{create:new it(this._transport)},correction:{create:new rt(this._transport)}}}get note(){return{get:new pt(this._transport),update:new dt(this._transport)}}get source(){return{get:new ht(this._transport),list:new ft(this._transport)}}get upload(){return{get:new xt(this._transport),create:new bt(this._transport),delete:new gt(this._transport)}}get webhook(){return new yt(this)}get wellKnown(){return{notification:{get:new Rt(this._transport)}}}};var St={};wt(St,{AuthError:()=>c,AuthenticationError:()=>d,AuthorizationError:()=>u,LogicError:()=>p,NetworkError:()=>m,SupportError:()=>i,ValidationError:()=>l});var _t=class r{static DEFAULT_NAME=Pt;name;#t;constructor({name:t=process.env[Bt]??r.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 Ot=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-D2F3tbZm.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-D2F3tbZm.cjs';
1
+ import { A as Authentication, a as Conversation } from './index-ylqKeL9v.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, a7 as CreateContactNoteResponse, ah as CreateContactNotificationSubscriptionResponse, x as CreateContactResponse, a8 as CreateConversationNoteResponse, a4 as CreateCorrectionResponse, N as CreateLabelResponse, a5 as CreateResponseResponse, aj as CreateUploadResponse, P as DeleteLabelResponse, al as DeleteUploadResponse, i as GetBoilerplateCategoryResponse, G as GetBoilerplateResponse, n as GetChannelResponse, r as GetCompositionSectionResponse, y as GetContactResponse, F as GetConversationResponse, Q as GetLabelResponse, a2 as GetModelResponse, a9 as GetNoteResponse, am as GetNotificationWellKnownResponse, ae as GetSourceResponse, ak as GetUploadResponse, M as Label, L as ListActionsResponse, j as ListBoilerplateCategoriesResponse, e as ListBoilerplateCategoryBoilerplatesResponse, f as ListBoilerplatesResponse, u as ListChannelCompositionSectionsResponse, a0 as ListChannelMessagesResponse, m as ListChannelsResponse, s as ListCompositionSectionsResponse, K as ListContactConversationsResponse, Y as ListContactLabelsResponse, aa as ListContactNotesResponse, z as ListContactsResponse, X as ListConversationLabelsResponse, _ as ListConversationMessagesResponse, ab as ListConversationNotesResponse, H as ListConversationsResponse, D as ListLabelContactsResponse, I as ListLabelConversationsResponse, S as ListLabelsResponse, $ as ListMessagesResponse, a3 as ListModelsResponse, af as ListSourcesResponse, Z as Message, a1 as Model, a6 as Note, ag as NotificationSubscription, O as Options, R as RequestFilterable, ad 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, ac as UpdateNoteResponse, ai as Upload, W as WebhookResponse, C as default } from './index-ylqKeL9v.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-D2F3tbZm.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-D2F3tbZm.js';
1
+ import { A as Authentication, a as Conversation } from './index-ylqKeL9v.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, a7 as CreateContactNoteResponse, ah as CreateContactNotificationSubscriptionResponse, x as CreateContactResponse, a8 as CreateConversationNoteResponse, a4 as CreateCorrectionResponse, N as CreateLabelResponse, a5 as CreateResponseResponse, aj as CreateUploadResponse, P as DeleteLabelResponse, al as DeleteUploadResponse, i as GetBoilerplateCategoryResponse, G as GetBoilerplateResponse, n as GetChannelResponse, r as GetCompositionSectionResponse, y as GetContactResponse, F as GetConversationResponse, Q as GetLabelResponse, a2 as GetModelResponse, a9 as GetNoteResponse, am as GetNotificationWellKnownResponse, ae as GetSourceResponse, ak as GetUploadResponse, M as Label, L as ListActionsResponse, j as ListBoilerplateCategoriesResponse, e as ListBoilerplateCategoryBoilerplatesResponse, f as ListBoilerplatesResponse, u as ListChannelCompositionSectionsResponse, a0 as ListChannelMessagesResponse, m as ListChannelsResponse, s as ListCompositionSectionsResponse, K as ListContactConversationsResponse, Y as ListContactLabelsResponse, aa as ListContactNotesResponse, z as ListContactsResponse, X as ListConversationLabelsResponse, _ as ListConversationMessagesResponse, ab as ListConversationNotesResponse, H as ListConversationsResponse, D as ListLabelContactsResponse, I as ListLabelConversationsResponse, S as ListLabelsResponse, $ as ListMessagesResponse, a3 as ListModelsResponse, af as ListSourcesResponse, Z as Message, a1 as Model, a6 as Note, ag as NotificationSubscription, O as Options, R as RequestFilterable, ad 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, ac as UpdateNoteResponse, ai as Upload, W as WebhookResponse, C as default } from './index-ylqKeL9v.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-3BYSZXZ7.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-NSQETRTT.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.7",
3
+ "version": "0.10.8",
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
- var Ft=Object.defineProperty;var qt=(r,t)=>{for(var e in t)Ft(r,e,{get:t[e],enumerable:!0})};var Rt=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var Tt="https://api.support.greatdetail.com",Ot={"X-Powered-By":"GDSupport/JavaScript"},Gt="api-key";import{z as s}from"zod";var u=class r{constructor(t){this._client=t}static SCHEMA=s.object({data:s.object({event:s.intersection(s.object({id:s.string(),createdAt:s.string().datetime()}),s.discriminatedUnion("type",[s.object({type:s.literal("contact.created"),payload:s.object({contact:s.string()})}),s.object({type:s.literal("message.created"),payload:s.object({message:s.string()})})]))})});async event({request:t}){let{data:e}=r.SCHEMA.parse(t.body);return{event:e.event}}};var m=class{constructor(t){this._transport=t}send({limit:t,request:e={}}={}){return this._transport.send("v1/actions",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}};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,{limit:e,request:o={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var b=class{constructor(t){this._transport=t}send({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/boilerplates",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var g=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.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 x=class{constructor(t){this._transport=t}send({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/boilerplate-categories",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e)]})}};var _=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.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/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({limit:t,request:e={}}={}){return this._transport.send("v1/channels",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}};import{z as vt}from"zod";var L=class r{constructor(t){this._transport=t}static SCHEMA=vt.object({overwrite:vt.boolean().optional()});send(t,{body:e,request:o={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:r.SCHEMA.parse(e)})}};var U=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.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,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var w=class{constructor(t){this._transport=t}send({limit:t,request:e={}}={}){return this._transport.send("v1/composition-sections",{...e,method:"GET",searchParams:[...this._transport.limitQuery(t)]})}};var q=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var ie="SUPPORT_ACCESS_TOKEN",ae="SUPPORT_API_KEY",pe="SUPPORT_KEY_NAME",Lt="SUPPORT_BASE_URL";var E=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let o=e.variant??"vcard",n=e.format??(o==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(o)+"&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 G=class{constructor(t){this._transport=t}send(t,{include:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var N=class{constructor(t){this._transport=t}send({limit:t,query:e,request:o={}}={}){return this._transport.send("v1/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e)]})}};var B=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var A=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var M=class{constructor(t){this._transport=t}send(t,{include:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var j=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var H=class{constructor(t){this._transport=t}send({limit:t,filter:e,include:o,request:n={}}={}){return this._transport.send("v1/conversations",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...e?[["filter",e]]:[],...this._transport.includeQuery(o??{})]})}};var Q=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var D=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.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 K=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var V=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,{limit:e,request:o={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var z=class{constructor(t){this._transport=t}send({limit:t,query:e,include:o,request:n={}}={}){return this._transport.send("v1/labels",{...n,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.queryQuery(e),...this._transport.includeQuery(o??{})]})}};var Y=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var $=class{constructor(t){this._transport=t}send(t,{limit:e,request:o={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(e)]})}};var J=class{constructor(t){this._transport=t}send(t,{limit:e,include:o,request:n={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...n,method:"GET",searchParams:[...this._transport.limitQuery(e),...this._transport.includeQuery(o??{})]})}};var X=class{constructor(t){this._transport=t}send({limit:t,include:e,request:o={}}={}){return this._transport.send("v1/messages",{...o,method:"GET",searchParams:[...this._transport.limitQuery(t),...this._transport.includeQuery(e??{})]})}};var Z=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...o,method:"POST",headers:{...o.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:o={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...o,method:"POST",timeout:12e4,headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var rt=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var l=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...o,method:"POST",headers:{...o.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 it=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var at=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...o,method:"PATCH",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var pt=class{constructor(t){this._transport=t}send(t,{body:e,request:o={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...o,method:"POST",headers:{...o.headers,"Content-Type":"application/json"},json:e})}};var ct=class r{constructor(t=r.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 o=[];if(t){let n=Array.isArray(t)?t:[t];for(let a of n)o.push(["category",a])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:o})}};import St from"is-network-error";import It,{HTTPError as wt}from"ky";var i=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var c=class extends i{};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 p=class extends i{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 i{};var d=class extends i{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:[o=>{for(let n of this.options.requestFilterables){let a=n.getHeaders();for(let[_t,Ut]of Object.entries(a))o.headers.has(_t)||o.headers.set(_t,Ut)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}limitQuery(t){let e=[];return t&&e.push(["limit",t.toString()]),e}includeQuery(t){let e=[];if(t===void 0)return e;for(let o of Object.keys(t))e.push(["include",o]);return e}queryQuery(t){let e=[];return t&&e.push(["query",t]),e}send(t,e){let o=this.client(t,e).catch(n=>{if(St(n))throw new ht("A network error occurred",{cause:n});if(n instanceof wt){let a=n.response.status;switch(console.error(JSON.stringify(n.response)),a){case 400:throw d.badRequest();case 401:throw ut.unauthenticated();case 403:throw mt.forbidden();case 404:throw p.notFound(t);case 405:throw p.forbiddenMethod(t,e.method??"GET");case 415:throw d.unsupportedMediaType();case 418:throw p.teapot();case 429:throw p.rateLimited()}if(a>=500&&a<600)throw i.serverError(a)}throw n});return{response:()=>o,json:async()=>(await o).json()}}};var ft=class{constructor(t){this._transport=t}send({account:t,files:e,request:o={}}){let n=new FormData;for(let a of e)n.append("file",a);return this._transport.send("v1/uploads",{...o,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 gt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var yt=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send(".well-known/notifications",{...t,method:"GET"})}};var xt=class r{static DEFAULT_BASE_URL=Tt;_transport;constructor(t,{baseURL:e,...o}={}){this._transport=new Ct({requestFilterables:[new ct,t],...o,baseURL:e?.toString()??r.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 b(this._transport),update:new g(this._transport),create:new h(this._transport)}}get boilerplateCategory(){return{get:new R(this._transport),list:new x(this._transport),create:new y(this._transport),update:new _(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 T(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 G(this._transport),list:new N(this._transport),update:new A(this._transport),create:new P(this._transport),conversation:{list:new j(this._transport)},note:{list:new st(this._transport),create:new rt(this._transport)},notificationSubscription:{create:new pt(this._transport)},vcf:{get:new E(this._transport)}}}get conversation(){return{get:new M(this._transport),list:new H(this._transport),update:new D(this._transport),create:new l(this._transport),label:{list:new W(this._transport)},message:{list:new J(this._transport)},note:{list:new it(this._transport),create:new l(this._transport)}}}get label(){return{create:new k(this._transport),get:new V(this._transport),list:new z(this._transport),update:new Y(this._transport),delete:new K(this._transport),contact:{list:new B(this._transport)},conversation:{list:new Q(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 at(this._transport)}}get source(){return{get:new lt(this._transport),list:new dt(this._transport)}}get upload(){return{get:new gt(this._transport),create:new ft(this._transport),delete:new bt(this._transport)}}get webhook(){return new u(this)}get wellKnown(){return{notification:{get:new yt(this._transport)}}}};export{qt as a,Rt as b,ie as c,ae as d,pe as e,Tt as f,Gt as g,i as h,c as i,ut as j,mt as k,p as l,ht as m,d as n,xt as o};