@great-detail/support-sdk 0.8.2 → 0.8.4

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.
@@ -1 +1 @@
1
- var Ft=Object.defineProperty;var qt=(o,t)=>{for(var e in t)Ft(o,e,{get:t[e],enumerable:!0})};var Rt=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var xt="https://api.support.greatdetail.com",Tt={"X-Powered-By":"GDSupport/JavaScript"},Lt="api-key";import{z as p}from"zod";var u=class o{constructor(t){this._client=t}static SCHEMA=p.object({event:p.intersection(p.object({id:p.string(),createdAt:p.string().datetime()}),p.discriminatedUnion("type",[p.object({type:p.literal("contact.created"),contact:p.string()}),p.object({type:p.literal("message.created"),message:p.string()})]))});async event({request:t}){let{event:e}=o.SCHEMA.parse(t.body);return{event:e}}};var m=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/actions",{...t,method:"GET"})}};var h=class{constructor(t){this._transport=t}async 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}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var C=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...e,method:"GET"})}};var y=class{constructor(t){this._transport=t}async send({query:t,request:e={}}={}){return this._transport.send("v1/boilerplates",{...e,method:"GET",searchParams:[...this._transport.queryQuery(t)]})}};var R=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var g=class{constructor(t){this._transport=t}async 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 b=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var x=class{constructor(t){this._transport=t}async send({include:t,request:e={}}={}){return this._transport.send("v1/boilerplate-categories",{...e,method:"GET",searchParams:[...this._transport.includeQuery(t??{})]})}};var T=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var _=class{constructor(t){this._transport=t}async 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}async send({id:t,request:e={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var v=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"})}};import{z as _t}from"zod";var F=class o{constructor(t){this._transport=t}static SCHEMA=_t.object({overwrite:_t.boolean().optional()});async send({id:t,body:e,request:r={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:o.SCHEMA.parse(e)})}};var I=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var U=class{constructor(t){this._transport=t}async 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}async send({id:t,request:e={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}};var q=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...e,method:"GET"})}};var w=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/composition-sections",{...t,method:"GET"})}};var E=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var ne="SUPPORT_ACCESS_TOKEN",se="SUPPORT_API_KEY",pe="SUPPORT_KEY_NAME",Ot="SUPPORT_BASE_URL";var L=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let r=e.variant??"vcard",n=e.format??(e.variant==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(r)+"&format="+encodeURIComponent(n)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}};var P=class{constructor(t){this._transport=t}async send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var A=class{constructor(t){this._transport=t}async send({id:t,include:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var N=class{constructor(t){this._transport=t}async send({query:t,request:e={}}={}){return this._transport.send("v1/contacts",{...e,method:"GET",searchParams:[...this._transport.queryQuery(t)]})}};var B=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...e,method:"GET"})}};var G=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var j=class{constructor(t){this._transport=t}async send({id:t,include:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var M=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var H=class{constructor(t){this._transport=t}async send({filter:t,include:e,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...t?[["filter",t]]:[],...this._transport.includeQuery(e??{})]})}};var D=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var k=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var K=class{constructor(t){this._transport=t}async send({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var Q=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var V=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var z=class{constructor(t){this._transport=t}async send({query:t,include:e,request:r={}}={}){return this._transport.send("v1/labels",{...r,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.includeQuery(e??{})]})}};var Y=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var $=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"})}};var J=class{constructor(t){this._transport=t}async send({id:t,include:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var W=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/messages",{...t,method:"GET"})}};var X=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var Z=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var tt=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var et=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var ot=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var c=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var rt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var nt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var st=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var pt=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var at=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var it=class o{constructor(t=o.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Tt;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var ct=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var dt=class{constructor(t){this._transport=t}async send({category:t,request:e={}}={}){let r=[];if(t){let n=Array.isArray(t)?t:[t];for(let l of n)r.push(["category",l])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:r})}};import It from"is-network-error";import Ut,{HTTPError as St}from"ky";var s=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var i=class extends s{};var lt=class extends i{static unauthenticated(){return new this("An unauthenticated request occurred")}};var ut=class extends i{static forbidden(){return new this("A forbidden request occurred")}};var a=class extends s{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,e){return new this(`Forbidden method for request: ${t} ${e}`)}static teapot(){return new this("I'm a teapot")}static rateLimited(){return new this("Request has been rate-limited")}};var mt=class extends s{};var d=class extends s{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var ht=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=Ut.create({prefixUrl:this.options.baseURL,hooks:{beforeRequest:[r=>{for(let n of this.options.requestFilterables){let l=n.getHeaders();for(let[bt,vt]of Object.entries(l))r.headers.has(bt)||r.headers.set(bt,vt)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}includeQuery(t){let e=[];for(let r of Object.keys(t))e.push(["include",r]);return e}queryQuery(t){let e=[];return t&&e.push(["query",t]),e}async send(t,e){return await this.client(t,e).catch(r=>{if(It(r))throw new mt("A network error occurred",{cause:r});if(r instanceof St){let n=r.response.status;switch(console.error(JSON.stringify(r.response)),n){case 400:throw d.badRequest();case 401:throw lt.unauthenticated();case 403:throw ut.forbidden();case 404:throw a.notFound(t);case 405:throw a.forbiddenMethod(t,e.method??"GET");case 415:throw d.unsupportedMediaType();case 418:throw a.teapot();case 429:throw a.rateLimited()}if(n>=500&&n<600)throw s.serverError(n)}throw r})}};var ft=class{constructor(t){this._transport=t}async send({account:t,files:e,request:r={}}){let n=new FormData;for(let l of e)n.append("file",l);return this._transport.send("v1/uploads",{...r,method:"POST",body:n,searchParams:{account:t}})}};var Ct=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var yt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var gt=class o{static DEFAULT_BASE_URL=xt;_transport;constructor(t,{baseURL:e,...r}={}){this._transport=new ht({requestFilterables:[new it,t],...r,baseURL:e?.toString()??o.getBaseURL()})}static getBaseURL(){return process.env[Ot]??this.DEFAULT_BASE_URL}get action(){return{list:new m(this._transport)}}get boilerplate(){return{get:new f(this._transport),list:new y(this._transport),update:new R(this._transport),create:new h(this._transport)}}get boilerplateCategory(){return{get:new b(this._transport),list:new x(this._transport),create:new g(this._transport),update:new T(this._transport),boilerplate:{list:new C(this._transport)}}}get channel(){return{get:new O(this._transport),list:new v(this._transport),update:new I(this._transport),create:new _(this._transport),compositionSection:{list:new q(this._transport)},message:{list:new $(this._transport)},twilioSendgrid:{sync:new F(this._transport)}}}get compositionSection(){return{get:new S(this._transport),list:new w(this._transport),create:new U(this._transport),update:new E(this._transport)}}get contact(){return{get:new A(this._transport),list:new N(this._transport),update:new G(this._transport),create:new P(this._transport),conversation:{list:new M(this._transport)},note:{list:new nt(this._transport),create:new ot(this._transport)},notificationSubscription:{create:new at(this._transport)},vcf:{get:new L(this._transport)}}}get conversation(){return{get:new j(this._transport),list:new H(this._transport),update:new k(this._transport),create:new c(this._transport),message:{list:new J(this._transport)},note:{list:new st(this._transport),create:new c(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 Q(this._transport),contact:{list:new B(this._transport)},conversation:{list:new D(this._transport)}}}get message(){return{list:new W(this._transport)}}get model(){return{get:new Z(this._transport),list:new tt(this._transport),response:{create:new et(this._transport)},correction:{create:new X(this._transport)}}}get note(){return{get:new rt(this._transport),update:new pt(this._transport)}}get source(){return{get:new ct(this._transport),list:new dt(this._transport)}}get upload(){return{get:new yt(this._transport),create:new ft(this._transport),delete:new Ct(this._transport)}}get webhook(){return new u(this)}};export{qt as a,Rt as b,ne as c,se as d,pe as e,xt as f,Lt as g,s as h,i,lt as j,ut as k,a as l,mt as m,d as n,gt as o};
1
+ var Ft=Object.defineProperty;var qt=(o,t)=>{for(var e in t)Ft(o,e,{get:t[e],enumerable:!0})};var gt=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var xt="https://api.support.greatdetail.com",Tt={"X-Powered-By":"GDSupport/JavaScript"},Lt="api-key";import{z as p}from"zod";var u=class o{constructor(t){this._client=t}static SCHEMA=p.object({event:p.intersection(p.object({id:p.string(),createdAt:p.string().datetime()}),p.discriminatedUnion("type",[p.object({type:p.literal("contact.created"),contact:p.string()}),p.object({type:p.literal("message.created"),message:p.string()})]))});async event({request:t}){let{event:e}=o.SCHEMA.parse(t.body);return{event:e}}};var m=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/actions",{...t,method:"GET"})}};var h=class{constructor(t){this._transport=t}async 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}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var C=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...e,method:"GET"})}};var y=class{constructor(t){this._transport=t}async send({query:t,request:e={}}={}){return this._transport.send("v1/boilerplates",{...e,method:"GET",searchParams:[...this._transport.queryQuery(t)]})}};var g=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var R=class{constructor(t){this._transport=t}async 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 b=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var x=class{constructor(t){this._transport=t}async send({include:t,request:e={}}={}){return this._transport.send("v1/boilerplate-categories",{...e,method:"GET",searchParams:[...this._transport.includeQuery(t??{})]})}};var T=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var _=class{constructor(t){this._transport=t}async 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}async send({id:t,request:e={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var v=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"})}};import{z as _t}from"zod";var F=class o{constructor(t){this._transport=t}static SCHEMA=_t.object({overwrite:_t.boolean().optional()});async send({id:t,body:e,request:r={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:o.SCHEMA.parse(e)})}};var I=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var U=class{constructor(t){this._transport=t}async 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}async send({id:t,request:e={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}};var q=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...e,method:"GET"})}};var w=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/composition-sections",{...t,method:"GET"})}};var E=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var ne="SUPPORT_ACCESS_TOKEN",se="SUPPORT_API_KEY",pe="SUPPORT_KEY_NAME",Ot="SUPPORT_BASE_URL";var L=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let r=e.variant??"vcard",n=e.format??(e.variant==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(r)+"&format="+encodeURIComponent(n)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}};var P=class{constructor(t){this._transport=t}async send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var A=class{constructor(t){this._transport=t}async send({id:t,include:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var N=class{constructor(t){this._transport=t}async send({query:t,request:e={}}={}){return this._transport.send("v1/contacts",{...e,method:"GET",searchParams:[...this._transport.queryQuery(t)]})}};var B=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...e,method:"GET"})}};var G=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var j=class{constructor(t){this._transport=t}async send({id:t,include:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var M=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var H=class{constructor(t){this._transport=t}async send({filter:t,include:e,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...t?[["filter",t]]:[],...this._transport.includeQuery(e??{})]})}};var D=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var k=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var K=class{constructor(t){this._transport=t}async send({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var Q=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var V=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var z=class{constructor(t){this._transport=t}async send({query:t,include:e,request:r={}}={}){return this._transport.send("v1/labels",{...r,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.includeQuery(e??{})]})}};var Y=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var $=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"})}};var J=class{constructor(t){this._transport=t}async send({id:t,include:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var W=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/messages",{...t,method:"GET"})}};var X=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var Z=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var tt=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var et=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var ot=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var c=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var rt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var nt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var st=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var pt=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var at=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var it=class o{constructor(t=o.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Tt;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var ct=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var dt=class{constructor(t){this._transport=t}async send({category:t,request:e={}}={}){let r=[];if(t){let n=Array.isArray(t)?t:[t];for(let l of n)r.push(["category",l])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:r})}};import It from"is-network-error";import Ut,{HTTPError as St}from"ky";var s=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var i=class extends s{};var lt=class extends i{static unauthenticated(){return new this("An unauthenticated request occurred")}};var ut=class extends i{static forbidden(){return new this("A forbidden request occurred")}};var a=class extends s{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,e){return new this(`Forbidden method for request: ${t} ${e}`)}static teapot(){return new this("I'm a teapot")}static rateLimited(){return new this("Request has been rate-limited")}};var mt=class extends s{};var d=class extends s{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var ht=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=Ut.create({prefixUrl:this.options.baseURL,hooks:{beforeRequest:[r=>{for(let n of this.options.requestFilterables){let l=n.getHeaders();for(let[bt,vt]of Object.entries(l))r.headers.has(bt)||r.headers.set(bt,vt)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}includeQuery(t){let e=[];for(let r of Object.keys(t))e.push(["include",r]);return e}queryQuery(t){let e=[];return t&&e.push(["query",t]),e}async send(t,e){return await this.client(t,e).catch(r=>{if(It(r))throw new mt("A network error occurred",{cause:r});if(r instanceof St){let n=r.response.status;switch(console.error(JSON.stringify(r.response)),n){case 400:throw d.badRequest();case 401:throw lt.unauthenticated();case 403:throw ut.forbidden();case 404:throw a.notFound(t);case 405:throw a.forbiddenMethod(t,e.method??"GET");case 415:throw d.unsupportedMediaType();case 418:throw a.teapot();case 429:throw a.rateLimited()}if(n>=500&&n<600)throw s.serverError(n)}throw r})}};var ft=class{constructor(t){this._transport=t}async send({account:t,files:e,request:r={}}){let n=new FormData;for(let l of e)n.append("file",l);return this._transport.send("v1/uploads",{...r,method:"POST",body:n,searchParams:{account:t}})}};var Ct=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var yt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var Rt=class o{static DEFAULT_BASE_URL=xt;_transport;constructor(t,{baseURL:e,...r}={}){this._transport=new ht({requestFilterables:[new it,t],...r,baseURL:e?.toString()??o.getBaseURL()})}static getBaseURL(){return process.env[Ot]??this.DEFAULT_BASE_URL}get action(){return{list:new m(this._transport)}}get boilerplate(){return{get:new f(this._transport),list:new y(this._transport),update:new g(this._transport),create:new h(this._transport)}}get boilerplateCategory(){return{get:new b(this._transport),list:new x(this._transport),create:new R(this._transport),update:new T(this._transport),boilerplate:{list:new C(this._transport)}}}get channel(){return{get:new O(this._transport),list:new v(this._transport),update:new I(this._transport),create:new _(this._transport),compositionSection:{list:new q(this._transport)},message:{list:new $(this._transport)},twilioSendgrid:{sync:new F(this._transport)}}}get compositionSection(){return{get:new S(this._transport),list:new w(this._transport),create:new U(this._transport),update:new E(this._transport)}}get contact(){return{get:new A(this._transport),list:new N(this._transport),update:new G(this._transport),create:new P(this._transport),conversation:{list:new M(this._transport)},note:{list:new nt(this._transport),create:new ot(this._transport)},notificationSubscription:{create:new at(this._transport)},vcf:{get:new L(this._transport)}}}get conversation(){return{get:new j(this._transport),list:new H(this._transport),update:new k(this._transport),create:new c(this._transport),message:{list:new J(this._transport)},note:{list:new st(this._transport),create:new c(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 Q(this._transport),contact:{list:new B(this._transport)},conversation:{list:new D(this._transport)}}}get message(){return{list:new W(this._transport)}}get model(){return{get:new Z(this._transport),list:new tt(this._transport),response:{create:new et(this._transport)},correction:{create:new X(this._transport)}}}get note(){return{get:new rt(this._transport),update:new pt(this._transport)}}get source(){return{get:new ct(this._transport),list:new dt(this._transport)}}get upload(){return{get:new yt(this._transport),create:new ft(this._transport),delete:new Ct(this._transport)}}get webhook(){return new u(this)}};export{qt as a,gt as b,ne as c,se as d,pe as e,xt as f,Lt as g,s as h,i,lt as j,ut as k,a as l,mt as m,d as n,Rt as o};
@@ -1 +1 @@
1
- import{b as y,o as j}from"./chunk-ILZUVSAO.js";import{Command as A}from"commander";import{Command as F}from"commander";import{oraPromise as I}from"ora";function m({client:t,ora:s}){let o=new F("actions").description("Actions");return o.addCommand(new F("list").description("List actions").action(async()=>{let n=await I(()=>t.action.list.send(),{...s,text:"Finding actions"});console.log(await n.json())})),o}import{Command as b}from"commander";import{oraPromise as S}from"ora";function r({client:t,ora:s}){let o=new b("channels").description("Channels");return o.addCommand(new b("list").description("List channels").action(async()=>{let n=await S(()=>t.channel.list.send(),{...s,text:"Finding channels"});console.log(await n.json())})),o}import{Command as d}from"commander";import{oraPromise as v}from"ora";function c({client:t,ora:s}){let o=new d("contacts").description("Contacts");return o.addCommand(new d("get").description("Find contact").argument("<contact>","Contact ID").action(async n=>{let i=await v(()=>t.contact.get.send({id:n}),{...s,text:"Finding contact"});console.log(await i.json())})),o.addCommand(new d("list").description("List contacts").action(async()=>{let n=await v(()=>t.contact.list.send(),{...s,text:"Finding contacts"});console.log(await n.json())})),o}import{Command as p}from"commander";import{oraPromise as L}from"ora";function l({client:t,ora:s}){let o=new p("conversations").description("Conversations");return o.addCommand(new p("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async n=>{let i=await L(()=>t.conversation.get.send({id:n}),{...s,text:"Finding conversation"});console.log(await i.json())})),o.addCommand(new p("list").description("List conversations").action(async()=>{let n=await L(()=>t.conversation.list.send(),{...s,text:"Finding conversations"});console.log(await n.json())})),o}import{Command as a}from"commander";import{oraPromise as u}from"ora";function f({client:t,ora:s}){let o=new a("labels").description("Labels");return o.addCommand(new a("get").description("Find label").argument("<label>","Label ID").action(async n=>{let i=await u(()=>t.label.get.send({id:n}),{...s,text:"Finding label"});console.log(await i.json())})),o.addCommand(new a("list").description("List labels").action(async()=>{let n=await u(()=>t.label.list.send(),{...s,text:"Finding labels"});console.log(await n.json())})),o.addCommand(new a("conversations").description("Find label conversations").argument("<label>","Label ID").action(async n=>{let i=await u(()=>t.label.conversation.list.send({id:n}),{...s,text:"Finding conversations"});console.log(await i.json())})),o}import{Command as P}from"commander";import{oraPromise as M}from"ora";function C({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 M(()=>t.message.list.send(),{...s,text:"Finding messages"});console.log(await n.json())})),o}import{Command as g}from"commander";import{oraPromise as h}from"ora";function w({client:t,ora:s}){let o=new g("models").description("Models");return o.addCommand(new g("get").description("Find model").argument("<model>","Model ID").action(async n=>{let i=await h(()=>t.model.get.send({id:n}),{...s,text:"Finding model"});console.log(await i.json())})),o.addCommand(new g("list").description("List models").action(async()=>{let n=await h(()=>t.model.list.send(),{...s,text:"Finding models"});console.log(await n.json())})),o}import{Command as O}from"commander";import{oraPromise as D}from"ora";function x({client:t,ora:s}){let o=new O("sources").description("Sources");return o.addCommand(new O("get").description("Find source").argument("<source>","Source ID").action(async n=>{let i=await D(()=>t.source.get.send({id:n}),{...s,text:"Finding source"});console.log(await i.json())})),o.addCommand(new O("list").description("List sources").action(async()=>{let n=await D(()=>t.source.list.send(),{...s,text:"Finding sources"});console.log(await n.json())})),o}var e={ora:{spinner:"simpleDotsScrolling"},client:new j(new y)},G=new A("gds").description("Great Detail Support System").addCommand(m(e)).addCommand(r(e)).addCommand(c(e)).addCommand(l(e)).addCommand(f(e)).addCommand(C(e)).addCommand(w(e)).addCommand(x(e)),go=G;export{go as a};
1
+ import{b as y,o as j}from"./chunk-THIMBTIM.js";import{Command as A}from"commander";import{Command as F}from"commander";import{oraPromise as I}from"ora";function m({client:t,ora:s}){let o=new F("actions").description("Actions");return o.addCommand(new F("list").description("List actions").action(async()=>{let n=await I(()=>t.action.list.send(),{...s,text:"Finding actions"});console.log(await n.json())})),o}import{Command as b}from"commander";import{oraPromise as S}from"ora";function r({client:t,ora:s}){let o=new b("channels").description("Channels");return o.addCommand(new b("list").description("List channels").action(async()=>{let n=await S(()=>t.channel.list.send(),{...s,text:"Finding channels"});console.log(await n.json())})),o}import{Command as d}from"commander";import{oraPromise as v}from"ora";function c({client:t,ora:s}){let o=new d("contacts").description("Contacts");return o.addCommand(new d("get").description("Find contact").argument("<contact>","Contact ID").action(async n=>{let i=await v(()=>t.contact.get.send({id:n}),{...s,text:"Finding contact"});console.log(await i.json())})),o.addCommand(new d("list").description("List contacts").action(async()=>{let n=await v(()=>t.contact.list.send(),{...s,text:"Finding contacts"});console.log(await n.json())})),o}import{Command as p}from"commander";import{oraPromise as L}from"ora";function l({client:t,ora:s}){let o=new p("conversations").description("Conversations");return o.addCommand(new p("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async n=>{let i=await L(()=>t.conversation.get.send({id:n}),{...s,text:"Finding conversation"});console.log(await i.json())})),o.addCommand(new p("list").description("List conversations").action(async()=>{let n=await L(()=>t.conversation.list.send(),{...s,text:"Finding conversations"});console.log(await n.json())})),o}import{Command as a}from"commander";import{oraPromise as u}from"ora";function f({client:t,ora:s}){let o=new a("labels").description("Labels");return o.addCommand(new a("get").description("Find label").argument("<label>","Label ID").action(async n=>{let i=await u(()=>t.label.get.send({id:n}),{...s,text:"Finding label"});console.log(await i.json())})),o.addCommand(new a("list").description("List labels").action(async()=>{let n=await u(()=>t.label.list.send(),{...s,text:"Finding labels"});console.log(await n.json())})),o.addCommand(new a("conversations").description("Find label conversations").argument("<label>","Label ID").action(async n=>{let i=await u(()=>t.label.conversation.list.send({id:n}),{...s,text:"Finding conversations"});console.log(await i.json())})),o}import{Command as P}from"commander";import{oraPromise as M}from"ora";function C({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 M(()=>t.message.list.send(),{...s,text:"Finding messages"});console.log(await n.json())})),o}import{Command as g}from"commander";import{oraPromise as h}from"ora";function w({client:t,ora:s}){let o=new g("models").description("Models");return o.addCommand(new g("get").description("Find model").argument("<model>","Model ID").action(async n=>{let i=await h(()=>t.model.get.send({id:n}),{...s,text:"Finding model"});console.log(await i.json())})),o.addCommand(new g("list").description("List models").action(async()=>{let n=await h(()=>t.model.list.send(),{...s,text:"Finding models"});console.log(await n.json())})),o}import{Command as O}from"commander";import{oraPromise as D}from"ora";function x({client:t,ora:s}){let o=new O("sources").description("Sources");return o.addCommand(new O("get").description("Find source").argument("<source>","Source ID").action(async n=>{let i=await D(()=>t.source.get.send({id:n}),{...s,text:"Finding source"});console.log(await i.json())})),o.addCommand(new O("list").description("List sources").action(async()=>{let n=await D(()=>t.source.list.send(),{...s,text:"Finding sources"});console.log(await n.json())})),o}var e={ora:{spinner:"simpleDotsScrolling"},client:new j(new y)},G=new A("gds").description("Great Detail Support System").addCommand(m(e)).addCommand(r(e)).addCommand(c(e)).addCommand(l(e)).addCommand(f(e)).addCommand(C(e)).addCommand(w(e)).addCommand(x(e)),go=G;export{go as a};
@@ -1 +1 @@
1
- "use strict";var re=Object.create;var Ot=Object.defineProperty;var ne=Object.getOwnPropertyDescriptor;var se=Object.getOwnPropertyNames;var ae=Object.getPrototypeOf,ie=Object.prototype.hasOwnProperty;var pe=(o,t)=>{for(var e in t)Ot(o,e,{get:t[e],enumerable:!0})},Vt=(o,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of se(t))!ie.call(o,n)&&n!==e&&Ot(o,n,{get:()=>t[n],enumerable:!(r=ne(t,n))||r.enumerable});return o};var zt=(o,t,e)=>(e=o!=null?re(ae(o)):{},Vt(t||!o||!o.__esModule?Ot(e,"default",{value:o,enumerable:!0}):e,o)),ce=o=>Vt(Ot({},"__esModule",{value:!0}),o);var me={};pe(me,{default:()=>le});module.exports=ce(me);var ee=require("commander");var u=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var h=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/actions",{...t,method:"GET"})}};var f=class{constructor(t){this._transport=t}async 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}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var y=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...e,method:"GET"})}};var g=class{constructor(t){this._transport=t}async send({query:t,request:e={}}={}){return this._transport.send("v1/boilerplates",{...e,method:"GET",searchParams:[...this._transport.queryQuery(t)]})}};var x=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var b=class{constructor(t){this._transport=t}async 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}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var O=class{constructor(t){this._transport=t}async send({include:t,request:e={}}={}){return this._transport.send("v1/boilerplate-categories",{...e,method:"GET",searchParams:[...this._transport.includeQuery(t??{})]})}};var T=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var _=class{constructor(t){this._transport=t}async 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}async send({id:t,request:e={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var w=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"})}};var Ut=require("zod"),F=class o{constructor(t){this._transport=t}static SCHEMA=Ut.z.object({overwrite:Ut.z.boolean().optional()});async send({id:t,body:e,request:r={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:o.SCHEMA.parse(e)})}};var I=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var U=class{constructor(t){this._transport=t}async 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}async send({id:t,request:e={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}};var q=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...e,method:"GET"})}};var L=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/composition-sections",{...t,method:"GET"})}};var E=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var Yt="SUPPORT_BASE_URL";var $t="https://api.support.greatdetail.com",Jt={"X-Powered-By":"GDSupport/JavaScript"};var P=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let r=e.variant??"vcard",n=e.format??(e.variant==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(r)+"&format="+encodeURIComponent(n)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}};var A=class{constructor(t){this._transport=t}async send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var j=class{constructor(t){this._transport=t}async send({id:t,include:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var N=class{constructor(t){this._transport=t}async send({query:t,request:e={}}={}){return this._transport.send("v1/contacts",{...e,method:"GET",searchParams:[...this._transport.queryQuery(t)]})}};var B=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...e,method:"GET"})}};var G=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var M=class{constructor(t){this._transport=t}async send({id:t,include:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var D=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var H=class{constructor(t){this._transport=t}async send({filter:t,include:e,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...t?[["filter",t]]:[],...this._transport.includeQuery(e??{})]})}};var k=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var K=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var Q=class{constructor(t){this._transport=t}async 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}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var z=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var Y=class{constructor(t){this._transport=t}async send({query:t,include:e,request:r={}}={}){return this._transport.send("v1/labels",{...r,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.includeQuery(e??{})]})}};var $=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var J=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"})}};var W=class{constructor(t){this._transport=t}async send({id:t,include:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var X=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/messages",{...t,method:"GET"})}};var Z=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var tt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var et=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var ot=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var rt=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var d=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var nt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var st=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var at=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var it=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var pt=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var ct=class o{constructor(t=o.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Jt;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var dt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var lt=class{constructor(t){this._transport=t}async send({category:t,request:e={}}={}){let r=[];if(t){let n=Array.isArray(t)?t:[t];for(let m of n)r.push(["category",m])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:r})}};var Wt=zt(require("is-network-error"),1),Tt=zt(require("ky"),1);var s=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var c=class extends s{};var mt=class extends c{static unauthenticated(){return new this("An unauthenticated request occurred")}};var ut=class extends c{static forbidden(){return new this("A forbidden request occurred")}};var i=class extends s{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,e){return new this(`Forbidden method for request: ${t} ${e}`)}static teapot(){return new this("I'm a teapot")}static rateLimited(){return new this("Request has been rate-limited")}};var ht=class extends s{};var l=class extends s{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var ft=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=Tt.default.create({prefixUrl:this.options.baseURL,hooks:{beforeRequest:[r=>{for(let n of this.options.requestFilterables){let m=n.getHeaders();for(let[Qt,oe]of Object.entries(m))r.headers.has(Qt)||r.headers.set(Qt,oe)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}includeQuery(t){let e=[];for(let r of Object.keys(t))e.push(["include",r]);return e}queryQuery(t){let e=[];return t&&e.push(["query",t]),e}async send(t,e){return await this.client(t,e).catch(r=>{if((0,Wt.default)(r))throw new ht("A network error occurred",{cause:r});if(r instanceof Tt.HTTPError){let n=r.response.status;switch(console.error(JSON.stringify(r.response)),n){case 400:throw l.badRequest();case 401:throw mt.unauthenticated();case 403:throw ut.forbidden();case 404:throw i.notFound(t);case 405:throw i.forbiddenMethod(t,e.method??"GET");case 415:throw l.unsupportedMediaType();case 418:throw i.teapot();case 429:throw i.rateLimited()}if(n>=500&&n<600)throw s.serverError(n)}throw r})}};var Ct=class{constructor(t){this._transport=t}async send({account:t,files:e,request:r={}}){let n=new FormData;for(let m of e)n.append("file",m);return this._transport.send("v1/uploads",{...r,method:"POST",body:n,searchParams:{account:t}})}};var yt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var gt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var a=require("zod"),xt=class o{constructor(t){this._client=t}static SCHEMA=a.z.object({event:a.z.intersection(a.z.object({id:a.z.string(),createdAt:a.z.string().datetime()}),a.z.discriminatedUnion("type",[a.z.object({type:a.z.literal("contact.created"),contact:a.z.string()}),a.z.object({type:a.z.literal("message.created"),message:a.z.string()})]))});async event({request:t}){let{event:e}=o.SCHEMA.parse(t.body);return{event:e}}};var bt=class o{static DEFAULT_BASE_URL=$t;_transport;constructor(t,{baseURL:e,...r}={}){this._transport=new ft({requestFilterables:[new ct,t],...r,baseURL:e?.toString()??o.getBaseURL()})}static getBaseURL(){return process.env[Yt]??this.DEFAULT_BASE_URL}get action(){return{list:new h(this._transport)}}get boilerplate(){return{get:new C(this._transport),list:new g(this._transport),update:new x(this._transport),create:new f(this._transport)}}get boilerplateCategory(){return{get:new R(this._transport),list:new O(this._transport),create:new b(this._transport),update:new T(this._transport),boilerplate:{list:new y(this._transport)}}}get channel(){return{get:new v(this._transport),list:new w(this._transport),update:new I(this._transport),create:new _(this._transport),compositionSection:{list:new q(this._transport)},message:{list:new J(this._transport)},twilioSendgrid:{sync:new F(this._transport)}}}get compositionSection(){return{get:new S(this._transport),list:new L(this._transport),create:new U(this._transport),update:new E(this._transport)}}get contact(){return{get:new j(this._transport),list:new N(this._transport),update:new G(this._transport),create:new A(this._transport),conversation:{list:new D(this._transport)},note:{list:new st(this._transport),create:new rt(this._transport)},notificationSubscription:{create:new pt(this._transport)},vcf:{get:new P(this._transport)}}}get conversation(){return{get:new M(this._transport),list:new H(this._transport),update:new K(this._transport),create:new d(this._transport),message:{list:new W(this._transport)},note:{list:new at(this._transport),create:new d(this._transport)}}}get label(){return{create:new Q(this._transport),get:new z(this._transport),list:new Y(this._transport),update:new $(this._transport),delete:new V(this._transport),contact:{list:new B(this._transport)},conversation:{list:new k(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 it(this._transport)}}get source(){return{get:new dt(this._transport),list:new lt(this._transport)}}get upload(){return{get:new gt(this._transport),create:new Ct(this._transport),delete:new yt(this._transport)}}get webhook(){return new xt(this)}};var St=require("commander"),Xt=require("ora");function qt({client:o,ora:t}){let e=new St.Command("actions").description("Actions");return e.addCommand(new St.Command("list").description("List actions").action(async()=>{let r=await(0,Xt.oraPromise)(()=>o.action.list.send(),{...t,text:"Finding actions"});console.log(await r.json())})),e}var Lt=require("commander"),Zt=require("ora");function Et({client:o,ora:t}){let e=new Lt.Command("channels").description("Channels");return e.addCommand(new Lt.Command("list").description("List channels").action(async()=>{let r=await(0,Zt.oraPromise)(()=>o.channel.list.send(),{...t,text:"Finding channels"});console.log(await r.json())})),e}var _t=require("commander"),Pt=require("ora");function At({client:o,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 r=>{let n=await(0,Pt.oraPromise)(()=>o.contact.get.send({id:r}),{...t,text:"Finding contact"});console.log(await n.json())})),e.addCommand(new _t.Command("list").description("List contacts").action(async()=>{let r=await(0,Pt.oraPromise)(()=>o.contact.list.send(),{...t,text:"Finding contacts"});console.log(await r.json())})),e}var vt=require("commander"),jt=require("ora");function Nt({client:o,ora:t}){let e=new vt.Command("conversations").description("Conversations");return e.addCommand(new vt.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async r=>{let n=await(0,jt.oraPromise)(()=>o.conversation.get.send({id:r}),{...t,text:"Finding conversation"});console.log(await n.json())})),e.addCommand(new vt.Command("list").description("List conversations").action(async()=>{let r=await(0,jt.oraPromise)(()=>o.conversation.list.send(),{...t,text:"Finding conversations"});console.log(await r.json())})),e}var Rt=require("commander"),wt=require("ora");function Bt({client:o,ora:t}){let e=new Rt.Command("labels").description("Labels");return e.addCommand(new Rt.Command("get").description("Find label").argument("<label>","Label ID").action(async r=>{let n=await(0,wt.oraPromise)(()=>o.label.get.send({id:r}),{...t,text:"Finding label"});console.log(await n.json())})),e.addCommand(new Rt.Command("list").description("List labels").action(async()=>{let r=await(0,wt.oraPromise)(()=>o.label.list.send(),{...t,text:"Finding labels"});console.log(await r.json())})),e.addCommand(new Rt.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async r=>{let n=await(0,wt.oraPromise)(()=>o.label.conversation.list.send({id:r}),{...t,text:"Finding conversations"});console.log(await n.json())})),e}var Gt=require("commander"),te=require("ora");function Mt({client:o,ora:t}){let e=new Gt.Command("messages").description("Messages");return e.addCommand(new Gt.Command("list").description("List messages").action(async()=>{let r=await(0,te.oraPromise)(()=>o.message.list.send(),{...t,text:"Finding messages"});console.log(await r.json())})),e}var Ft=require("commander"),Dt=require("ora");function Ht({client:o,ora:t}){let e=new Ft.Command("models").description("Models");return e.addCommand(new Ft.Command("get").description("Find model").argument("<model>","Model ID").action(async r=>{let n=await(0,Dt.oraPromise)(()=>o.model.get.send({id:r}),{...t,text:"Finding model"});console.log(await n.json())})),e.addCommand(new Ft.Command("list").description("List models").action(async()=>{let r=await(0,Dt.oraPromise)(()=>o.model.list.send(),{...t,text:"Finding models"});console.log(await r.json())})),e}var It=require("commander"),kt=require("ora");function Kt({client:o,ora:t}){let e=new It.Command("sources").description("Sources");return e.addCommand(new It.Command("get").description("Find source").argument("<source>","Source ID").action(async r=>{let n=await(0,kt.oraPromise)(()=>o.source.get.send({id:r}),{...t,text:"Finding source"});console.log(await n.json())})),e.addCommand(new It.Command("list").description("List sources").action(async()=>{let r=await(0,kt.oraPromise)(()=>o.source.list.send(),{...t,text:"Finding sources"});console.log(await r.json())})),e}var p={ora:{spinner:"simpleDotsScrolling"},client:new bt(new u)},de=new ee.Command("gds").description("Great Detail Support System").addCommand(qt(p)).addCommand(Et(p)).addCommand(At(p)).addCommand(Nt(p)).addCommand(Bt(p)).addCommand(Mt(p)).addCommand(Ht(p)).addCommand(Kt(p)),le=de;
1
+ "use strict";var ne=Object.create;var Ot=Object.defineProperty;var re=Object.getOwnPropertyDescriptor;var se=Object.getOwnPropertyNames;var ae=Object.getPrototypeOf,ie=Object.prototype.hasOwnProperty;var pe=(o,t)=>{for(var e in t)Ot(o,e,{get:t[e],enumerable:!0})},Vt=(o,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of se(t))!ie.call(o,r)&&r!==e&&Ot(o,r,{get:()=>t[r],enumerable:!(n=re(t,r))||n.enumerable});return o};var zt=(o,t,e)=>(e=o!=null?ne(ae(o)):{},Vt(t||!o||!o.__esModule?Ot(e,"default",{value:o,enumerable:!0}):e,o)),ce=o=>Vt(Ot({},"__esModule",{value:!0}),o);var me={};pe(me,{default:()=>le});module.exports=ce(me);var ee=require("commander");var u=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var h=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/actions",{...t,method:"GET"})}};var f=class{constructor(t){this._transport=t}async 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}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var y=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...e,method:"GET"})}};var g=class{constructor(t){this._transport=t}async send({query:t,request:e={}}={}){return this._transport.send("v1/boilerplates",{...e,method:"GET",searchParams:[...this._transport.queryQuery(t)]})}};var x=class{constructor(t){this._transport=t}async send({id:t,body:e,request:n={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var b=class{constructor(t){this._transport=t}async 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}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var O=class{constructor(t){this._transport=t}async send({include:t,request:e={}}={}){return this._transport.send("v1/boilerplate-categories",{...e,method:"GET",searchParams:[...this._transport.includeQuery(t??{})]})}};var T=class{constructor(t){this._transport=t}async send({id:t,body:e,request:n={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var _=class{constructor(t){this._transport=t}async 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}async send({id:t,request:e={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var w=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"})}};var Ut=require("zod"),F=class o{constructor(t){this._transport=t}static SCHEMA=Ut.z.object({overwrite:Ut.z.boolean().optional()});async send({id:t,body:e,request:n={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},json:o.SCHEMA.parse(e)})}};var I=class{constructor(t){this._transport=t}async send({id:t,body:e,request:n={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var U=class{constructor(t){this._transport=t}async 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}async send({id:t,request:e={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}};var q=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...e,method:"GET"})}};var L=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/composition-sections",{...t,method:"GET"})}};var E=class{constructor(t){this._transport=t}async send({id:t,body:e,request:n={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var Yt="SUPPORT_BASE_URL";var $t="https://api.support.greatdetail.com",Jt={"X-Powered-By":"GDSupport/JavaScript"};var P=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let n=e.variant??"vcard",r=e.format??(e.variant==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(n)+"&format="+encodeURIComponent(r)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}};var A=class{constructor(t){this._transport=t}async send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var j=class{constructor(t){this._transport=t}async send({id:t,include:e,request:n={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...n,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var N=class{constructor(t){this._transport=t}async send({query:t,request:e={}}={}){return this._transport.send("v1/contacts",{...e,method:"GET",searchParams:[...this._transport.queryQuery(t)]})}};var B=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...e,method:"GET"})}};var G=class{constructor(t){this._transport=t}async send({id:t,body:e,request:n={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var M=class{constructor(t){this._transport=t}async send({id:t,include:e,request:n={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...n,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var D=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var H=class{constructor(t){this._transport=t}async send({filter:t,include:e,request:n={}}={}){return this._transport.send("v1/conversations",{...n,method:"GET",searchParams:[...t?[["filter",t]]:[],...this._transport.includeQuery(e??{})]})}};var k=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var K=class{constructor(t){this._transport=t}async send({id:t,body:e,request:n={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var Q=class{constructor(t){this._transport=t}async 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}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var z=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var Y=class{constructor(t){this._transport=t}async send({query:t,include:e,request:n={}}={}){return this._transport.send("v1/labels",{...n,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.includeQuery(e??{})]})}};var $=class{constructor(t){this._transport=t}async send({id:t,body:e,request:n={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var J=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"})}};var W=class{constructor(t){this._transport=t}async send({id:t,include:e,request:n={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...n,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var X=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/messages",{...t,method:"GET"})}};var Z=class{constructor(t){this._transport=t}async send({id:t,body:e,request:n={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var tt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var et=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var ot=class{constructor(t){this._transport=t}async send({id:t,body:e,request:n={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var nt=class{constructor(t){this._transport=t}async send({id:t,body:e,request:n={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var d=class{constructor(t){this._transport=t}async send({id:t,body:e,request:n={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var rt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var st=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var at=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var it=class{constructor(t){this._transport=t}async send({id:t,body:e,request:n={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var pt=class{constructor(t){this._transport=t}async send({id:t,body:e,request:n={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var ct=class o{constructor(t=o.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Jt;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var dt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var lt=class{constructor(t){this._transport=t}async send({category:t,request:e={}}={}){let n=[];if(t){let r=Array.isArray(t)?t:[t];for(let m of r)n.push(["category",m])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:n})}};var Wt=zt(require("is-network-error"),1),Tt=zt(require("ky"),1);var s=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var c=class extends s{};var mt=class extends c{static unauthenticated(){return new this("An unauthenticated request occurred")}};var ut=class extends c{static forbidden(){return new this("A forbidden request occurred")}};var i=class extends s{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,e){return new this(`Forbidden method for request: ${t} ${e}`)}static teapot(){return new this("I'm a teapot")}static rateLimited(){return new this("Request has been rate-limited")}};var ht=class extends s{};var l=class extends s{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var ft=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=Tt.default.create({prefixUrl:this.options.baseURL,hooks:{beforeRequest:[n=>{for(let r of this.options.requestFilterables){let m=r.getHeaders();for(let[Qt,oe]of Object.entries(m))n.headers.has(Qt)||n.headers.set(Qt,oe)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}includeQuery(t){let e=[];for(let n of Object.keys(t))e.push(["include",n]);return e}queryQuery(t){let e=[];return t&&e.push(["query",t]),e}async send(t,e){return await this.client(t,e).catch(n=>{if((0,Wt.default)(n))throw new ht("A network error occurred",{cause:n});if(n instanceof Tt.HTTPError){let r=n.response.status;switch(console.error(JSON.stringify(n.response)),r){case 400:throw l.badRequest();case 401:throw mt.unauthenticated();case 403:throw ut.forbidden();case 404:throw i.notFound(t);case 405:throw i.forbiddenMethod(t,e.method??"GET");case 415:throw l.unsupportedMediaType();case 418:throw i.teapot();case 429:throw i.rateLimited()}if(r>=500&&r<600)throw s.serverError(r)}throw n})}};var Ct=class{constructor(t){this._transport=t}async send({account:t,files:e,request:n={}}){let r=new FormData;for(let m of e)r.append("file",m);return this._transport.send("v1/uploads",{...n,method:"POST",body:r,searchParams:{account:t}})}};var yt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var gt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var a=require("zod"),xt=class o{constructor(t){this._client=t}static SCHEMA=a.z.object({event:a.z.intersection(a.z.object({id:a.z.string(),createdAt:a.z.string().datetime()}),a.z.discriminatedUnion("type",[a.z.object({type:a.z.literal("contact.created"),contact:a.z.string()}),a.z.object({type:a.z.literal("message.created"),message:a.z.string()})]))});async event({request:t}){let{event:e}=o.SCHEMA.parse(t.body);return{event:e}}};var bt=class o{static DEFAULT_BASE_URL=$t;_transport;constructor(t,{baseURL:e,...n}={}){this._transport=new ft({requestFilterables:[new ct,t],...n,baseURL:e?.toString()??o.getBaseURL()})}static getBaseURL(){return process.env[Yt]??this.DEFAULT_BASE_URL}get action(){return{list:new h(this._transport)}}get boilerplate(){return{get:new C(this._transport),list:new g(this._transport),update:new x(this._transport),create:new f(this._transport)}}get boilerplateCategory(){return{get:new R(this._transport),list:new O(this._transport),create:new b(this._transport),update:new T(this._transport),boilerplate:{list:new y(this._transport)}}}get channel(){return{get:new v(this._transport),list:new w(this._transport),update:new I(this._transport),create:new _(this._transport),compositionSection:{list:new q(this._transport)},message:{list:new J(this._transport)},twilioSendgrid:{sync:new F(this._transport)}}}get compositionSection(){return{get:new S(this._transport),list:new L(this._transport),create:new U(this._transport),update:new E(this._transport)}}get contact(){return{get:new j(this._transport),list:new N(this._transport),update:new G(this._transport),create:new A(this._transport),conversation:{list:new D(this._transport)},note:{list:new st(this._transport),create:new nt(this._transport)},notificationSubscription:{create:new pt(this._transport)},vcf:{get:new P(this._transport)}}}get conversation(){return{get:new M(this._transport),list:new H(this._transport),update:new K(this._transport),create:new d(this._transport),message:{list:new W(this._transport)},note:{list:new at(this._transport),create:new d(this._transport)}}}get label(){return{create:new Q(this._transport),get:new z(this._transport),list:new Y(this._transport),update:new $(this._transport),delete:new V(this._transport),contact:{list:new B(this._transport)},conversation:{list:new k(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 rt(this._transport),update:new it(this._transport)}}get source(){return{get:new dt(this._transport),list:new lt(this._transport)}}get upload(){return{get:new gt(this._transport),create:new Ct(this._transport),delete:new yt(this._transport)}}get webhook(){return new xt(this)}};var St=require("commander"),Xt=require("ora");function qt({client:o,ora:t}){let e=new St.Command("actions").description("Actions");return e.addCommand(new St.Command("list").description("List actions").action(async()=>{let n=await(0,Xt.oraPromise)(()=>o.action.list.send(),{...t,text:"Finding actions"});console.log(await n.json())})),e}var Lt=require("commander"),Zt=require("ora");function Et({client:o,ora:t}){let e=new Lt.Command("channels").description("Channels");return e.addCommand(new Lt.Command("list").description("List channels").action(async()=>{let n=await(0,Zt.oraPromise)(()=>o.channel.list.send(),{...t,text:"Finding channels"});console.log(await n.json())})),e}var _t=require("commander"),Pt=require("ora");function At({client:o,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 n=>{let r=await(0,Pt.oraPromise)(()=>o.contact.get.send({id:n}),{...t,text:"Finding contact"});console.log(await r.json())})),e.addCommand(new _t.Command("list").description("List contacts").action(async()=>{let n=await(0,Pt.oraPromise)(()=>o.contact.list.send(),{...t,text:"Finding contacts"});console.log(await n.json())})),e}var vt=require("commander"),jt=require("ora");function Nt({client:o,ora:t}){let e=new vt.Command("conversations").description("Conversations");return e.addCommand(new vt.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async n=>{let r=await(0,jt.oraPromise)(()=>o.conversation.get.send({id:n}),{...t,text:"Finding conversation"});console.log(await r.json())})),e.addCommand(new vt.Command("list").description("List conversations").action(async()=>{let n=await(0,jt.oraPromise)(()=>o.conversation.list.send(),{...t,text:"Finding conversations"});console.log(await n.json())})),e}var Rt=require("commander"),wt=require("ora");function Bt({client:o,ora:t}){let e=new Rt.Command("labels").description("Labels");return e.addCommand(new Rt.Command("get").description("Find label").argument("<label>","Label ID").action(async n=>{let r=await(0,wt.oraPromise)(()=>o.label.get.send({id:n}),{...t,text:"Finding label"});console.log(await r.json())})),e.addCommand(new Rt.Command("list").description("List labels").action(async()=>{let n=await(0,wt.oraPromise)(()=>o.label.list.send(),{...t,text:"Finding labels"});console.log(await n.json())})),e.addCommand(new Rt.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async n=>{let r=await(0,wt.oraPromise)(()=>o.label.conversation.list.send({id:n}),{...t,text:"Finding conversations"});console.log(await r.json())})),e}var Gt=require("commander"),te=require("ora");function Mt({client:o,ora:t}){let e=new Gt.Command("messages").description("Messages");return e.addCommand(new Gt.Command("list").description("List messages").action(async()=>{let n=await(0,te.oraPromise)(()=>o.message.list.send(),{...t,text:"Finding messages"});console.log(await n.json())})),e}var Ft=require("commander"),Dt=require("ora");function Ht({client:o,ora:t}){let e=new Ft.Command("models").description("Models");return e.addCommand(new Ft.Command("get").description("Find model").argument("<model>","Model ID").action(async n=>{let r=await(0,Dt.oraPromise)(()=>o.model.get.send({id:n}),{...t,text:"Finding model"});console.log(await r.json())})),e.addCommand(new Ft.Command("list").description("List models").action(async()=>{let n=await(0,Dt.oraPromise)(()=>o.model.list.send(),{...t,text:"Finding models"});console.log(await n.json())})),e}var It=require("commander"),kt=require("ora");function Kt({client:o,ora:t}){let e=new It.Command("sources").description("Sources");return e.addCommand(new It.Command("get").description("Find source").argument("<source>","Source ID").action(async n=>{let r=await(0,kt.oraPromise)(()=>o.source.get.send({id:n}),{...t,text:"Finding source"});console.log(await r.json())})),e.addCommand(new It.Command("list").description("List sources").action(async()=>{let n=await(0,kt.oraPromise)(()=>o.source.list.send(),{...t,text:"Finding sources"});console.log(await n.json())})),e}var p={ora:{spinner:"simpleDotsScrolling"},client:new bt(new u)},de=new ee.Command("gds").description("Great Detail Support System").addCommand(qt(p)).addCommand(Et(p)).addCommand(At(p)).addCommand(Nt(p)).addCommand(Bt(p)).addCommand(Mt(p)).addCommand(Ht(p)).addCommand(Kt(p)),le=de;
@@ -1,5 +1,5 @@
1
1
  import { Command } from 'commander';
2
- import { C as Client } from '../index-B2IqpXbf.cjs';
2
+ import { C as Client } from '../index-DzdOjQt9.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-B2IqpXbf.js';
2
+ import { C as Client } from '../index-DzdOjQt9.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-I5O65BGR.js";import"../chunk-ILZUVSAO.js";export{a as default};
1
+ import{a}from"../chunk-ZMYYH7TB.js";import"../chunk-THIMBTIM.js";export{a as default};
package/dist/cli.cjs CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var re=Object.create;var Qt=Object.defineProperty;var ne=Object.getOwnPropertyDescriptor;var se=Object.getOwnPropertyNames;var ae=Object.getPrototypeOf,ie=Object.prototype.hasOwnProperty;var pe=(o,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of se(t))!ie.call(o,n)&&n!==e&&Qt(o,n,{get:()=>t[n],enumerable:!(r=ne(t,n))||r.enumerable});return o};var Vt=(o,t,e)=>(e=o!=null?re(ae(o)):{},pe(t||!o||!o.__esModule?Qt(e,"default",{value:o,enumerable:!0}):e,o));var te=require("commander");var u=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var h=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/actions",{...t,method:"GET"})}};var f=class{constructor(t){this._transport=t}async 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}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var y=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...e,method:"GET"})}};var g=class{constructor(t){this._transport=t}async send({query:t,request:e={}}={}){return this._transport.send("v1/boilerplates",{...e,method:"GET",searchParams:[...this._transport.queryQuery(t)]})}};var x=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var b=class{constructor(t){this._transport=t}async 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}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var O=class{constructor(t){this._transport=t}async send({include:t,request:e={}}={}){return this._transport.send("v1/boilerplate-categories",{...e,method:"GET",searchParams:[...this._transport.includeQuery(t??{})]})}};var T=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var _=class{constructor(t){this._transport=t}async 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}async send({id:t,request:e={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var w=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"})}};var It=require("zod"),F=class o{constructor(t){this._transport=t}static SCHEMA=It.z.object({overwrite:It.z.boolean().optional()});async send({id:t,body:e,request:r={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:o.SCHEMA.parse(e)})}};var I=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var U=class{constructor(t){this._transport=t}async 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}async send({id:t,request:e={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}};var q=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...e,method:"GET"})}};var L=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/composition-sections",{...t,method:"GET"})}};var E=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var zt="SUPPORT_BASE_URL";var Yt="https://api.support.greatdetail.com",$t={"X-Powered-By":"GDSupport/JavaScript"};var P=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let r=e.variant??"vcard",n=e.format??(e.variant==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(r)+"&format="+encodeURIComponent(n)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}};var A=class{constructor(t){this._transport=t}async send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var j=class{constructor(t){this._transport=t}async send({id:t,include:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var N=class{constructor(t){this._transport=t}async send({query:t,request:e={}}={}){return this._transport.send("v1/contacts",{...e,method:"GET",searchParams:[...this._transport.queryQuery(t)]})}};var B=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...e,method:"GET"})}};var G=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var M=class{constructor(t){this._transport=t}async send({id:t,include:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var D=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var H=class{constructor(t){this._transport=t}async send({filter:t,include:e,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...t?[["filter",t]]:[],...this._transport.includeQuery(e??{})]})}};var k=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var K=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var Q=class{constructor(t){this._transport=t}async 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}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var z=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var Y=class{constructor(t){this._transport=t}async send({query:t,include:e,request:r={}}={}){return this._transport.send("v1/labels",{...r,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.includeQuery(e??{})]})}};var $=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var J=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"})}};var W=class{constructor(t){this._transport=t}async send({id:t,include:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var X=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/messages",{...t,method:"GET"})}};var Z=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var tt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var et=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var ot=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var rt=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var d=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var nt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var st=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var at=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var it=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var pt=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var ct=class o{constructor(t=o.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=$t;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var dt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var lt=class{constructor(t){this._transport=t}async send({category:t,request:e={}}={}){let r=[];if(t){let n=Array.isArray(t)?t:[t];for(let m of n)r.push(["category",m])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:r})}};var Jt=Vt(require("is-network-error"),1),Ot=Vt(require("ky"),1);var s=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var c=class extends s{};var mt=class extends c{static unauthenticated(){return new this("An unauthenticated request occurred")}};var ut=class extends c{static forbidden(){return new this("A forbidden request occurred")}};var i=class extends s{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,e){return new this(`Forbidden method for request: ${t} ${e}`)}static teapot(){return new this("I'm a teapot")}static rateLimited(){return new this("Request has been rate-limited")}};var ht=class extends s{};var l=class extends s{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var ft=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=Ot.default.create({prefixUrl:this.options.baseURL,hooks:{beforeRequest:[r=>{for(let n of this.options.requestFilterables){let m=n.getHeaders();for(let[Kt,oe]of Object.entries(m))r.headers.has(Kt)||r.headers.set(Kt,oe)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}includeQuery(t){let e=[];for(let r of Object.keys(t))e.push(["include",r]);return e}queryQuery(t){let e=[];return t&&e.push(["query",t]),e}async send(t,e){return await this.client(t,e).catch(r=>{if((0,Jt.default)(r))throw new ht("A network error occurred",{cause:r});if(r instanceof Ot.HTTPError){let n=r.response.status;switch(console.error(JSON.stringify(r.response)),n){case 400:throw l.badRequest();case 401:throw mt.unauthenticated();case 403:throw ut.forbidden();case 404:throw i.notFound(t);case 405:throw i.forbiddenMethod(t,e.method??"GET");case 415:throw l.unsupportedMediaType();case 418:throw i.teapot();case 429:throw i.rateLimited()}if(n>=500&&n<600)throw s.serverError(n)}throw r})}};var Ct=class{constructor(t){this._transport=t}async send({account:t,files:e,request:r={}}){let n=new FormData;for(let m of e)n.append("file",m);return this._transport.send("v1/uploads",{...r,method:"POST",body:n,searchParams:{account:t}})}};var yt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var gt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var a=require("zod"),xt=class o{constructor(t){this._client=t}static SCHEMA=a.z.object({event:a.z.intersection(a.z.object({id:a.z.string(),createdAt:a.z.string().datetime()}),a.z.discriminatedUnion("type",[a.z.object({type:a.z.literal("contact.created"),contact:a.z.string()}),a.z.object({type:a.z.literal("message.created"),message:a.z.string()})]))});async event({request:t}){let{event:e}=o.SCHEMA.parse(t.body);return{event:e}}};var bt=class o{static DEFAULT_BASE_URL=Yt;_transport;constructor(t,{baseURL:e,...r}={}){this._transport=new ft({requestFilterables:[new ct,t],...r,baseURL:e?.toString()??o.getBaseURL()})}static getBaseURL(){return process.env[zt]??this.DEFAULT_BASE_URL}get action(){return{list:new h(this._transport)}}get boilerplate(){return{get:new C(this._transport),list:new g(this._transport),update:new x(this._transport),create:new f(this._transport)}}get boilerplateCategory(){return{get:new R(this._transport),list:new O(this._transport),create:new b(this._transport),update:new T(this._transport),boilerplate:{list:new y(this._transport)}}}get channel(){return{get:new v(this._transport),list:new w(this._transport),update:new I(this._transport),create:new _(this._transport),compositionSection:{list:new q(this._transport)},message:{list:new J(this._transport)},twilioSendgrid:{sync:new F(this._transport)}}}get compositionSection(){return{get:new S(this._transport),list:new L(this._transport),create:new U(this._transport),update:new E(this._transport)}}get contact(){return{get:new j(this._transport),list:new N(this._transport),update:new G(this._transport),create:new A(this._transport),conversation:{list:new D(this._transport)},note:{list:new st(this._transport),create:new rt(this._transport)},notificationSubscription:{create:new pt(this._transport)},vcf:{get:new P(this._transport)}}}get conversation(){return{get:new M(this._transport),list:new H(this._transport),update:new K(this._transport),create:new d(this._transport),message:{list:new W(this._transport)},note:{list:new at(this._transport),create:new d(this._transport)}}}get label(){return{create:new Q(this._transport),get:new z(this._transport),list:new Y(this._transport),update:new $(this._transport),delete:new V(this._transport),contact:{list:new B(this._transport)},conversation:{list:new k(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 it(this._transport)}}get source(){return{get:new dt(this._transport),list:new lt(this._transport)}}get upload(){return{get:new gt(this._transport),create:new Ct(this._transport),delete:new yt(this._transport)}}get webhook(){return new xt(this)}};var Ut=require("commander"),Wt=require("ora");function St({client:o,ora:t}){let e=new Ut.Command("actions").description("Actions");return e.addCommand(new Ut.Command("list").description("List actions").action(async()=>{let r=await(0,Wt.oraPromise)(()=>o.action.list.send(),{...t,text:"Finding actions"});console.log(await r.json())})),e}var qt=require("commander"),Xt=require("ora");function Lt({client:o,ora:t}){let e=new qt.Command("channels").description("Channels");return e.addCommand(new qt.Command("list").description("List channels").action(async()=>{let r=await(0,Xt.oraPromise)(()=>o.channel.list.send(),{...t,text:"Finding channels"});console.log(await r.json())})),e}var Tt=require("commander"),Et=require("ora");function Pt({client:o,ora:t}){let e=new Tt.Command("contacts").description("Contacts");return e.addCommand(new Tt.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async r=>{let n=await(0,Et.oraPromise)(()=>o.contact.get.send({id:r}),{...t,text:"Finding contact"});console.log(await n.json())})),e.addCommand(new Tt.Command("list").description("List contacts").action(async()=>{let r=await(0,Et.oraPromise)(()=>o.contact.list.send(),{...t,text:"Finding contacts"});console.log(await r.json())})),e}var _t=require("commander"),At=require("ora");function jt({client:o,ora:t}){let e=new _t.Command("conversations").description("Conversations");return e.addCommand(new _t.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async r=>{let n=await(0,At.oraPromise)(()=>o.conversation.get.send({id:r}),{...t,text:"Finding conversation"});console.log(await n.json())})),e.addCommand(new _t.Command("list").description("List conversations").action(async()=>{let r=await(0,At.oraPromise)(()=>o.conversation.list.send(),{...t,text:"Finding conversations"});console.log(await r.json())})),e}var Rt=require("commander"),vt=require("ora");function Nt({client:o,ora:t}){let e=new Rt.Command("labels").description("Labels");return e.addCommand(new Rt.Command("get").description("Find label").argument("<label>","Label ID").action(async r=>{let n=await(0,vt.oraPromise)(()=>o.label.get.send({id:r}),{...t,text:"Finding label"});console.log(await n.json())})),e.addCommand(new Rt.Command("list").description("List labels").action(async()=>{let r=await(0,vt.oraPromise)(()=>o.label.list.send(),{...t,text:"Finding labels"});console.log(await r.json())})),e.addCommand(new Rt.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async r=>{let n=await(0,vt.oraPromise)(()=>o.label.conversation.list.send({id:r}),{...t,text:"Finding conversations"});console.log(await n.json())})),e}var Bt=require("commander"),Zt=require("ora");function Gt({client:o,ora:t}){let e=new Bt.Command("messages").description("Messages");return e.addCommand(new Bt.Command("list").description("List messages").action(async()=>{let r=await(0,Zt.oraPromise)(()=>o.message.list.send(),{...t,text:"Finding messages"});console.log(await r.json())})),e}var wt=require("commander"),Mt=require("ora");function Dt({client:o,ora:t}){let e=new wt.Command("models").description("Models");return e.addCommand(new wt.Command("get").description("Find model").argument("<model>","Model ID").action(async r=>{let n=await(0,Mt.oraPromise)(()=>o.model.get.send({id:r}),{...t,text:"Finding model"});console.log(await n.json())})),e.addCommand(new wt.Command("list").description("List models").action(async()=>{let r=await(0,Mt.oraPromise)(()=>o.model.list.send(),{...t,text:"Finding models"});console.log(await r.json())})),e}var Ft=require("commander"),Ht=require("ora");function kt({client:o,ora:t}){let e=new Ft.Command("sources").description("Sources");return e.addCommand(new Ft.Command("get").description("Find source").argument("<source>","Source ID").action(async r=>{let n=await(0,Ht.oraPromise)(()=>o.source.get.send({id:r}),{...t,text:"Finding source"});console.log(await n.json())})),e.addCommand(new Ft.Command("list").description("List sources").action(async()=>{let r=await(0,Ht.oraPromise)(()=>o.source.list.send(),{...t,text:"Finding sources"});console.log(await r.json())})),e}var p={ora:{spinner:"simpleDotsScrolling"},client:new bt(new u)},ce=new te.Command("gds").description("Great Detail Support System").addCommand(St(p)).addCommand(Lt(p)).addCommand(Pt(p)).addCommand(jt(p)).addCommand(Nt(p)).addCommand(Gt(p)).addCommand(Dt(p)).addCommand(kt(p)),ee=ce;ee.parseAsync(process.argv);
2
+ "use strict";var ne=Object.create;var Qt=Object.defineProperty;var re=Object.getOwnPropertyDescriptor;var se=Object.getOwnPropertyNames;var ae=Object.getPrototypeOf,ie=Object.prototype.hasOwnProperty;var pe=(o,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of se(t))!ie.call(o,r)&&r!==e&&Qt(o,r,{get:()=>t[r],enumerable:!(n=re(t,r))||n.enumerable});return o};var Vt=(o,t,e)=>(e=o!=null?ne(ae(o)):{},pe(t||!o||!o.__esModule?Qt(e,"default",{value:o,enumerable:!0}):e,o));var te=require("commander");var u=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var h=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/actions",{...t,method:"GET"})}};var f=class{constructor(t){this._transport=t}async 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}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var y=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...e,method:"GET"})}};var g=class{constructor(t){this._transport=t}async send({query:t,request:e={}}={}){return this._transport.send("v1/boilerplates",{...e,method:"GET",searchParams:[...this._transport.queryQuery(t)]})}};var x=class{constructor(t){this._transport=t}async send({id:t,body:e,request:n={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var b=class{constructor(t){this._transport=t}async 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}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var O=class{constructor(t){this._transport=t}async send({include:t,request:e={}}={}){return this._transport.send("v1/boilerplate-categories",{...e,method:"GET",searchParams:[...this._transport.includeQuery(t??{})]})}};var T=class{constructor(t){this._transport=t}async send({id:t,body:e,request:n={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var _=class{constructor(t){this._transport=t}async 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}async send({id:t,request:e={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var w=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"})}};var It=require("zod"),F=class o{constructor(t){this._transport=t}static SCHEMA=It.z.object({overwrite:It.z.boolean().optional()});async send({id:t,body:e,request:n={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},json:o.SCHEMA.parse(e)})}};var I=class{constructor(t){this._transport=t}async send({id:t,body:e,request:n={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var U=class{constructor(t){this._transport=t}async 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}async send({id:t,request:e={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}};var q=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...e,method:"GET"})}};var L=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/composition-sections",{...t,method:"GET"})}};var E=class{constructor(t){this._transport=t}async send({id:t,body:e,request:n={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var zt="SUPPORT_BASE_URL";var Yt="https://api.support.greatdetail.com",$t={"X-Powered-By":"GDSupport/JavaScript"};var P=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let n=e.variant??"vcard",r=e.format??(e.variant==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(n)+"&format="+encodeURIComponent(r)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}};var A=class{constructor(t){this._transport=t}async send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var j=class{constructor(t){this._transport=t}async send({id:t,include:e,request:n={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...n,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var N=class{constructor(t){this._transport=t}async send({query:t,request:e={}}={}){return this._transport.send("v1/contacts",{...e,method:"GET",searchParams:[...this._transport.queryQuery(t)]})}};var B=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...e,method:"GET"})}};var G=class{constructor(t){this._transport=t}async send({id:t,body:e,request:n={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var M=class{constructor(t){this._transport=t}async send({id:t,include:e,request:n={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...n,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var D=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var H=class{constructor(t){this._transport=t}async send({filter:t,include:e,request:n={}}={}){return this._transport.send("v1/conversations",{...n,method:"GET",searchParams:[...t?[["filter",t]]:[],...this._transport.includeQuery(e??{})]})}};var k=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var K=class{constructor(t){this._transport=t}async send({id:t,body:e,request:n={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var Q=class{constructor(t){this._transport=t}async 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}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var z=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var Y=class{constructor(t){this._transport=t}async send({query:t,include:e,request:n={}}={}){return this._transport.send("v1/labels",{...n,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.includeQuery(e??{})]})}};var $=class{constructor(t){this._transport=t}async send({id:t,body:e,request:n={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var J=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"})}};var W=class{constructor(t){this._transport=t}async send({id:t,include:e,request:n={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...n,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var X=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/messages",{...t,method:"GET"})}};var Z=class{constructor(t){this._transport=t}async send({id:t,body:e,request:n={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var tt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var et=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var ot=class{constructor(t){this._transport=t}async send({id:t,body:e,request:n={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var nt=class{constructor(t){this._transport=t}async send({id:t,body:e,request:n={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var d=class{constructor(t){this._transport=t}async send({id:t,body:e,request:n={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var rt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var st=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var at=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var it=class{constructor(t){this._transport=t}async send({id:t,body:e,request:n={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var pt=class{constructor(t){this._transport=t}async send({id:t,body:e,request:n={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var ct=class o{constructor(t=o.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=$t;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var dt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var lt=class{constructor(t){this._transport=t}async send({category:t,request:e={}}={}){let n=[];if(t){let r=Array.isArray(t)?t:[t];for(let m of r)n.push(["category",m])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:n})}};var Jt=Vt(require("is-network-error"),1),Ot=Vt(require("ky"),1);var s=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var c=class extends s{};var mt=class extends c{static unauthenticated(){return new this("An unauthenticated request occurred")}};var ut=class extends c{static forbidden(){return new this("A forbidden request occurred")}};var i=class extends s{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,e){return new this(`Forbidden method for request: ${t} ${e}`)}static teapot(){return new this("I'm a teapot")}static rateLimited(){return new this("Request has been rate-limited")}};var ht=class extends s{};var l=class extends s{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var ft=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=Ot.default.create({prefixUrl:this.options.baseURL,hooks:{beforeRequest:[n=>{for(let r of this.options.requestFilterables){let m=r.getHeaders();for(let[Kt,oe]of Object.entries(m))n.headers.has(Kt)||n.headers.set(Kt,oe)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}includeQuery(t){let e=[];for(let n of Object.keys(t))e.push(["include",n]);return e}queryQuery(t){let e=[];return t&&e.push(["query",t]),e}async send(t,e){return await this.client(t,e).catch(n=>{if((0,Jt.default)(n))throw new ht("A network error occurred",{cause:n});if(n instanceof Ot.HTTPError){let r=n.response.status;switch(console.error(JSON.stringify(n.response)),r){case 400:throw l.badRequest();case 401:throw mt.unauthenticated();case 403:throw ut.forbidden();case 404:throw i.notFound(t);case 405:throw i.forbiddenMethod(t,e.method??"GET");case 415:throw l.unsupportedMediaType();case 418:throw i.teapot();case 429:throw i.rateLimited()}if(r>=500&&r<600)throw s.serverError(r)}throw n})}};var Ct=class{constructor(t){this._transport=t}async send({account:t,files:e,request:n={}}){let r=new FormData;for(let m of e)r.append("file",m);return this._transport.send("v1/uploads",{...n,method:"POST",body:r,searchParams:{account:t}})}};var yt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var gt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var a=require("zod"),xt=class o{constructor(t){this._client=t}static SCHEMA=a.z.object({event:a.z.intersection(a.z.object({id:a.z.string(),createdAt:a.z.string().datetime()}),a.z.discriminatedUnion("type",[a.z.object({type:a.z.literal("contact.created"),contact:a.z.string()}),a.z.object({type:a.z.literal("message.created"),message:a.z.string()})]))});async event({request:t}){let{event:e}=o.SCHEMA.parse(t.body);return{event:e}}};var bt=class o{static DEFAULT_BASE_URL=Yt;_transport;constructor(t,{baseURL:e,...n}={}){this._transport=new ft({requestFilterables:[new ct,t],...n,baseURL:e?.toString()??o.getBaseURL()})}static getBaseURL(){return process.env[zt]??this.DEFAULT_BASE_URL}get action(){return{list:new h(this._transport)}}get boilerplate(){return{get:new C(this._transport),list:new g(this._transport),update:new x(this._transport),create:new f(this._transport)}}get boilerplateCategory(){return{get:new R(this._transport),list:new O(this._transport),create:new b(this._transport),update:new T(this._transport),boilerplate:{list:new y(this._transport)}}}get channel(){return{get:new v(this._transport),list:new w(this._transport),update:new I(this._transport),create:new _(this._transport),compositionSection:{list:new q(this._transport)},message:{list:new J(this._transport)},twilioSendgrid:{sync:new F(this._transport)}}}get compositionSection(){return{get:new S(this._transport),list:new L(this._transport),create:new U(this._transport),update:new E(this._transport)}}get contact(){return{get:new j(this._transport),list:new N(this._transport),update:new G(this._transport),create:new A(this._transport),conversation:{list:new D(this._transport)},note:{list:new st(this._transport),create:new nt(this._transport)},notificationSubscription:{create:new pt(this._transport)},vcf:{get:new P(this._transport)}}}get conversation(){return{get:new M(this._transport),list:new H(this._transport),update:new K(this._transport),create:new d(this._transport),message:{list:new W(this._transport)},note:{list:new at(this._transport),create:new d(this._transport)}}}get label(){return{create:new Q(this._transport),get:new z(this._transport),list:new Y(this._transport),update:new $(this._transport),delete:new V(this._transport),contact:{list:new B(this._transport)},conversation:{list:new k(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 rt(this._transport),update:new it(this._transport)}}get source(){return{get:new dt(this._transport),list:new lt(this._transport)}}get upload(){return{get:new gt(this._transport),create:new Ct(this._transport),delete:new yt(this._transport)}}get webhook(){return new xt(this)}};var Ut=require("commander"),Wt=require("ora");function St({client:o,ora:t}){let e=new Ut.Command("actions").description("Actions");return e.addCommand(new Ut.Command("list").description("List actions").action(async()=>{let n=await(0,Wt.oraPromise)(()=>o.action.list.send(),{...t,text:"Finding actions"});console.log(await n.json())})),e}var qt=require("commander"),Xt=require("ora");function Lt({client:o,ora:t}){let e=new qt.Command("channels").description("Channels");return e.addCommand(new qt.Command("list").description("List channels").action(async()=>{let n=await(0,Xt.oraPromise)(()=>o.channel.list.send(),{...t,text:"Finding channels"});console.log(await n.json())})),e}var Tt=require("commander"),Et=require("ora");function Pt({client:o,ora:t}){let e=new Tt.Command("contacts").description("Contacts");return e.addCommand(new Tt.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async n=>{let r=await(0,Et.oraPromise)(()=>o.contact.get.send({id:n}),{...t,text:"Finding contact"});console.log(await r.json())})),e.addCommand(new Tt.Command("list").description("List contacts").action(async()=>{let n=await(0,Et.oraPromise)(()=>o.contact.list.send(),{...t,text:"Finding contacts"});console.log(await n.json())})),e}var _t=require("commander"),At=require("ora");function jt({client:o,ora:t}){let e=new _t.Command("conversations").description("Conversations");return e.addCommand(new _t.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async n=>{let r=await(0,At.oraPromise)(()=>o.conversation.get.send({id:n}),{...t,text:"Finding conversation"});console.log(await r.json())})),e.addCommand(new _t.Command("list").description("List conversations").action(async()=>{let n=await(0,At.oraPromise)(()=>o.conversation.list.send(),{...t,text:"Finding conversations"});console.log(await n.json())})),e}var Rt=require("commander"),vt=require("ora");function Nt({client:o,ora:t}){let e=new Rt.Command("labels").description("Labels");return e.addCommand(new Rt.Command("get").description("Find label").argument("<label>","Label ID").action(async n=>{let r=await(0,vt.oraPromise)(()=>o.label.get.send({id:n}),{...t,text:"Finding label"});console.log(await r.json())})),e.addCommand(new Rt.Command("list").description("List labels").action(async()=>{let n=await(0,vt.oraPromise)(()=>o.label.list.send(),{...t,text:"Finding labels"});console.log(await n.json())})),e.addCommand(new Rt.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async n=>{let r=await(0,vt.oraPromise)(()=>o.label.conversation.list.send({id:n}),{...t,text:"Finding conversations"});console.log(await r.json())})),e}var Bt=require("commander"),Zt=require("ora");function Gt({client:o,ora:t}){let e=new Bt.Command("messages").description("Messages");return e.addCommand(new Bt.Command("list").description("List messages").action(async()=>{let n=await(0,Zt.oraPromise)(()=>o.message.list.send(),{...t,text:"Finding messages"});console.log(await n.json())})),e}var wt=require("commander"),Mt=require("ora");function Dt({client:o,ora:t}){let e=new wt.Command("models").description("Models");return e.addCommand(new wt.Command("get").description("Find model").argument("<model>","Model ID").action(async n=>{let r=await(0,Mt.oraPromise)(()=>o.model.get.send({id:n}),{...t,text:"Finding model"});console.log(await r.json())})),e.addCommand(new wt.Command("list").description("List models").action(async()=>{let n=await(0,Mt.oraPromise)(()=>o.model.list.send(),{...t,text:"Finding models"});console.log(await n.json())})),e}var Ft=require("commander"),Ht=require("ora");function kt({client:o,ora:t}){let e=new Ft.Command("sources").description("Sources");return e.addCommand(new Ft.Command("get").description("Find source").argument("<source>","Source ID").action(async n=>{let r=await(0,Ht.oraPromise)(()=>o.source.get.send({id:n}),{...t,text:"Finding source"});console.log(await r.json())})),e.addCommand(new Ft.Command("list").description("List sources").action(async()=>{let n=await(0,Ht.oraPromise)(()=>o.source.list.send(),{...t,text:"Finding sources"});console.log(await n.json())})),e}var p={ora:{spinner:"simpleDotsScrolling"},client:new bt(new u)},ce=new te.Command("gds").description("Great Detail Support System").addCommand(St(p)).addCommand(Lt(p)).addCommand(Pt(p)).addCommand(jt(p)).addCommand(Nt(p)).addCommand(Gt(p)).addCommand(Dt(p)).addCommand(kt(p)),ee=ce;ee.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-I5O65BGR.js";import"./chunk-ILZUVSAO.js";r.parseAsync(process.argv);
2
+ import{a as r}from"./chunk-ZMYYH7TB.js";import"./chunk-THIMBTIM.js";r.parseAsync(process.argv);
@@ -784,8 +784,9 @@ interface IncludeOptions$2 {
784
784
  latestMessage?: boolean;
785
785
  [key: string]: boolean | undefined;
786
786
  }
787
+ type FilterOptions = "unresolved" | "awaitingContact" | "awaitingAgent" | (string & NonNullable<unknown>);
787
788
  interface Options$s<C extends IncludeOptions$2> {
788
- filter?: "unresolved";
789
+ filter?: FilterOptions;
789
790
  include?: C;
790
791
  request?: RequestInit;
791
792
  }
@@ -784,8 +784,9 @@ interface IncludeOptions$2 {
784
784
  latestMessage?: boolean;
785
785
  [key: string]: boolean | undefined;
786
786
  }
787
+ type FilterOptions = "unresolved" | "awaitingContact" | "awaitingAgent" | (string & NonNullable<unknown>);
787
788
  interface Options$s<C extends IncludeOptions$2> {
788
- filter?: "unresolved";
789
+ filter?: FilterOptions;
789
790
  include?: C;
790
791
  request?: RequestInit;
791
792
  }
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var jt=Object.create;var Tt=Object.defineProperty;var Mt=Object.getOwnPropertyDescriptor;var Ht=Object.getOwnPropertyNames;var Dt=Object.getPrototypeOf,kt=Object.prototype.hasOwnProperty;var Ut=(o,t)=>{for(var e in t)Tt(o,e,{get:t[e],enumerable:!0})},Et=(o,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Ht(t))!kt.call(o,n)&&n!==e&&Tt(o,n,{get:()=>t[n],enumerable:!(r=Mt(t,n))||r.enumerable});return o};var St=(o,t,e)=>(e=o!=null?jt(Dt(o)):{},Et(t||!o||!o.__esModule?Tt(e,"default",{value:o,enumerable:!0}):e,o)),Vt=o=>Et(Tt({},"__esModule",{value:!0}),o);var Kt={};Ut(Kt,{Client:()=>h,DEFAULT_SUPPORT_BASE_URL:()=>_t,Error:()=>Ft,KeyAuthentication:()=>gt,PublicAuthentication:()=>bt,TokenAuthentication:()=>Rt,default:()=>h});module.exports=Vt(Kt);var _t="https://api.support.greatdetail.com",wt={"X-Powered-By":"GDSupport/JavaScript"},qt="api-key";var C=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/actions",{...t,method:"GET"})}};var y=class{constructor(t){this._transport=t}async send({body:t,request:e={}}){return this._transport.send("v1/boilerplates",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var x=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var g=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...e,method:"GET"})}};var R=class{constructor(t){this._transport=t}async send({query:t,request:e={}}={}){return this._transport.send("v1/boilerplates",{...e,method:"GET",searchParams:[...this._transport.queryQuery(t)]})}};var b=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var T=class{constructor(t){this._transport=t}async send({body:t,request:e={}}){return this._transport.send("v1/boilerplate-categories",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var _=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var O=class{constructor(t){this._transport=t}async send({include:t,request:e={}}={}){return this._transport.send("v1/boilerplate-categories",{...e,method:"GET",searchParams:[...this._transport.includeQuery(t??{})]})}};var v=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var F=class{constructor(t){this._transport=t}async send({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var I=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var U=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"})}};var vt=require("zod"),E=class o{constructor(t){this._transport=t}static SCHEMA=vt.z.object({overwrite:vt.z.boolean().optional()});async send({id:t,body:e,request:r={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:o.SCHEMA.parse(e)})}};var S=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var w=class{constructor(t){this._transport=t}async 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 q=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}};var L=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...e,method:"GET"})}};var A=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/composition-sections",{...t,method:"GET"})}};var P=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var Lt="SUPPORT_ACCESS_TOKEN",At="SUPPORT_API_KEY",Pt="SUPPORT_KEY_NAME",Nt="SUPPORT_BASE_URL";var N=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let r=e.variant??"vcard",n=e.format??(e.variant==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(r)+"&format="+encodeURIComponent(n)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}};var B=class{constructor(t){this._transport=t}async 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}async send({id:t,include:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var j=class{constructor(t){this._transport=t}async send({query:t,request:e={}}={}){return this._transport.send("v1/contacts",{...e,method:"GET",searchParams:[...this._transport.queryQuery(t)]})}};var M=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...e,method:"GET"})}};var H=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var D=class{constructor(t){this._transport=t}async send({id:t,include:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var k=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var V=class{constructor(t){this._transport=t}async send({filter:t,include:e,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...t?[["filter",t]]:[],...this._transport.includeQuery(e??{})]})}};var K=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var Q=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var z=class{constructor(t){this._transport=t}async send({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var Y=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var $=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var W=class{constructor(t){this._transport=t}async send({query:t,include:e,request:r={}}={}){return this._transport.send("v1/labels",{...r,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.includeQuery(e??{})]})}};var J=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var X=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"})}};var Z=class{constructor(t){this._transport=t}async send({id:t,include:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var tt=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/messages",{...t,method:"GET"})}};var et=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var ot=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var rt=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var nt=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var st=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var m=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var pt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var at=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var it=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var ct=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var dt=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var lt=class o{constructor(t=o.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=wt;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var ut=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var mt=class{constructor(t){this._transport=t}async send({category:t,request:e={}}={}){let r=[];if(t){let n=Array.isArray(t)?t:[t];for(let f of n)r.push(["category",f])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:r})}};var Bt=St(require("is-network-error"),1),Ot=St(require("ky"),1);var s=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var i=class extends s{};var d=class extends i{static unauthenticated(){return new this("An unauthenticated request occurred")}};var l=class extends i{static forbidden(){return new this("A forbidden request occurred")}};var a=class extends s{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,e){return new this(`Forbidden method for request: ${t} ${e}`)}static teapot(){return new this("I'm a teapot")}static rateLimited(){return new this("Request has been rate-limited")}};var u=class extends s{};var c=class extends s{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var ht=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=Ot.default.create({prefixUrl:this.options.baseURL,hooks:{beforeRequest:[r=>{for(let n of this.options.requestFilterables){let f=n.getHeaders();for(let[It,Gt]of Object.entries(f))r.headers.has(It)||r.headers.set(It,Gt)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}includeQuery(t){let e=[];for(let r of Object.keys(t))e.push(["include",r]);return e}queryQuery(t){let e=[];return t&&e.push(["query",t]),e}async send(t,e){return await this.client(t,e).catch(r=>{if((0,Bt.default)(r))throw new u("A network error occurred",{cause:r});if(r instanceof Ot.HTTPError){let n=r.response.status;switch(console.error(JSON.stringify(r.response)),n){case 400:throw c.badRequest();case 401:throw d.unauthenticated();case 403:throw l.forbidden();case 404:throw a.notFound(t);case 405:throw a.forbiddenMethod(t,e.method??"GET");case 415:throw c.unsupportedMediaType();case 418:throw a.teapot();case 429:throw a.rateLimited()}if(n>=500&&n<600)throw s.serverError(n)}throw r})}};var ft=class{constructor(t){this._transport=t}async send({account:t,files:e,request:r={}}){let n=new FormData;for(let f of e)n.append("file",f);return this._transport.send("v1/uploads",{...r,method:"POST",body:n,searchParams:{account:t}})}};var Ct=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var yt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var p=require("zod"),xt=class o{constructor(t){this._client=t}static SCHEMA=p.z.object({event:p.z.intersection(p.z.object({id:p.z.string(),createdAt:p.z.string().datetime()}),p.z.discriminatedUnion("type",[p.z.object({type:p.z.literal("contact.created"),contact:p.z.string()}),p.z.object({type:p.z.literal("message.created"),message:p.z.string()})]))});async event({request:t}){let{event:e}=o.SCHEMA.parse(t.body);return{event:e}}};var h=class o{static DEFAULT_BASE_URL=_t;_transport;constructor(t,{baseURL:e,...r}={}){this._transport=new ht({requestFilterables:[new lt,t],...r,baseURL:e?.toString()??o.getBaseURL()})}static getBaseURL(){return process.env[Nt]??this.DEFAULT_BASE_URL}get action(){return{list:new C(this._transport)}}get boilerplate(){return{get:new x(this._transport),list:new R(this._transport),update:new b(this._transport),create:new y(this._transport)}}get boilerplateCategory(){return{get:new _(this._transport),list:new O(this._transport),create:new T(this._transport),update:new v(this._transport),boilerplate:{list:new g(this._transport)}}}get channel(){return{get:new I(this._transport),list:new U(this._transport),update:new S(this._transport),create:new F(this._transport),compositionSection:{list:new L(this._transport)},message:{list:new X(this._transport)},twilioSendgrid:{sync:new E(this._transport)}}}get compositionSection(){return{get:new q(this._transport),list:new A(this._transport),create:new w(this._transport),update:new P(this._transport)}}get contact(){return{get:new G(this._transport),list:new j(this._transport),update:new H(this._transport),create:new B(this._transport),conversation:{list:new k(this._transport)},note:{list:new at(this._transport),create:new st(this._transport)},notificationSubscription:{create:new dt(this._transport)},vcf:{get:new N(this._transport)}}}get conversation(){return{get:new D(this._transport),list:new V(this._transport),update:new Q(this._transport),create:new m(this._transport),message:{list:new Z(this._transport)},note:{list:new it(this._transport),create:new m(this._transport)}}}get label(){return{create:new z(this._transport),get:new $(this._transport),list:new W(this._transport),update:new J(this._transport),delete:new Y(this._transport),contact:{list:new M(this._transport)},conversation:{list:new K(this._transport)}}}get message(){return{list:new tt(this._transport)}}get model(){return{get:new ot(this._transport),list:new rt(this._transport),response:{create:new nt(this._transport)},correction:{create:new et(this._transport)}}}get note(){return{get:new pt(this._transport),update:new ct(this._transport)}}get source(){return{get:new ut(this._transport),list:new mt(this._transport)}}get upload(){return{get:new yt(this._transport),create:new ft(this._transport),delete:new Ct(this._transport)}}get webhook(){return new xt(this)}};var Ft={};Ut(Ft,{AuthError:()=>i,AuthenticationError:()=>d,AuthorizationError:()=>l,LogicError:()=>a,NetworkError:()=>u,SupportError:()=>s,ValidationError:()=>c});var gt=class o{static DEFAULT_NAME=qt;name;#t;constructor({name:t=process.env[Pt]??o.DEFAULT_NAME,key:e=process.env[At]}={}){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 Rt=class{#t;constructor({token:t=process.env[Lt]}={}){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 bt=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 jt=Object.create;var Tt=Object.defineProperty;var Mt=Object.getOwnPropertyDescriptor;var Ht=Object.getOwnPropertyNames;var Dt=Object.getPrototypeOf,kt=Object.prototype.hasOwnProperty;var Ut=(o,t)=>{for(var e in t)Tt(o,e,{get:t[e],enumerable:!0})},Et=(o,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Ht(t))!kt.call(o,n)&&n!==e&&Tt(o,n,{get:()=>t[n],enumerable:!(r=Mt(t,n))||r.enumerable});return o};var wt=(o,t,e)=>(e=o!=null?jt(Dt(o)):{},Et(t||!o||!o.__esModule?Tt(e,"default",{value:o,enumerable:!0}):e,o)),Vt=o=>Et(Tt({},"__esModule",{value:!0}),o);var Kt={};Ut(Kt,{Client:()=>h,DEFAULT_SUPPORT_BASE_URL:()=>_t,Error:()=>Ft,KeyAuthentication:()=>gt,PublicAuthentication:()=>bt,TokenAuthentication:()=>Rt,default:()=>h});module.exports=Vt(Kt);var _t="https://api.support.greatdetail.com",St={"X-Powered-By":"GDSupport/JavaScript"},qt="api-key";var C=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/actions",{...t,method:"GET"})}};var y=class{constructor(t){this._transport=t}async send({body:t,request:e={}}){return this._transport.send("v1/boilerplates",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var x=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var g=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...e,method:"GET"})}};var R=class{constructor(t){this._transport=t}async send({query:t,request:e={}}={}){return this._transport.send("v1/boilerplates",{...e,method:"GET",searchParams:[...this._transport.queryQuery(t)]})}};var b=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var T=class{constructor(t){this._transport=t}async send({body:t,request:e={}}){return this._transport.send("v1/boilerplate-categories",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var _=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var O=class{constructor(t){this._transport=t}async send({include:t,request:e={}}={}){return this._transport.send("v1/boilerplate-categories",{...e,method:"GET",searchParams:[...this._transport.includeQuery(t??{})]})}};var v=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var F=class{constructor(t){this._transport=t}async send({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var I=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var U=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"})}};var vt=require("zod"),E=class o{constructor(t){this._transport=t}static SCHEMA=vt.z.object({overwrite:vt.z.boolean().optional()});async send({id:t,body:e,request:r={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:o.SCHEMA.parse(e)})}};var w=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var S=class{constructor(t){this._transport=t}async 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 q=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}};var L=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...e,method:"GET"})}};var A=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/composition-sections",{...t,method:"GET"})}};var P=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var Lt="SUPPORT_ACCESS_TOKEN",At="SUPPORT_API_KEY",Pt="SUPPORT_KEY_NAME",Nt="SUPPORT_BASE_URL";var N=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let r=e.variant??"vcard",n=e.format??(e.variant==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(r)+"&format="+encodeURIComponent(n)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}};var B=class{constructor(t){this._transport=t}async 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}async send({id:t,include:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var j=class{constructor(t){this._transport=t}async send({query:t,request:e={}}={}){return this._transport.send("v1/contacts",{...e,method:"GET",searchParams:[...this._transport.queryQuery(t)]})}};var M=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...e,method:"GET"})}};var H=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var D=class{constructor(t){this._transport=t}async send({id:t,include:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var k=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var V=class{constructor(t){this._transport=t}async send({filter:t,include:e,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...t?[["filter",t]]:[],...this._transport.includeQuery(e??{})]})}};var K=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var Q=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var z=class{constructor(t){this._transport=t}async send({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var Y=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var $=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var W=class{constructor(t){this._transport=t}async send({query:t,include:e,request:r={}}={}){return this._transport.send("v1/labels",{...r,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.includeQuery(e??{})]})}};var J=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var X=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"})}};var Z=class{constructor(t){this._transport=t}async send({id:t,include:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var tt=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/messages",{...t,method:"GET"})}};var et=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var ot=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var rt=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var nt=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var st=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var m=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var pt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var at=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var it=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var ct=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var dt=class{constructor(t){this._transport=t}async send({id:t,body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var lt=class o{constructor(t=o.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=St;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var ut=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var mt=class{constructor(t){this._transport=t}async send({category:t,request:e={}}={}){let r=[];if(t){let n=Array.isArray(t)?t:[t];for(let f of n)r.push(["category",f])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:r})}};var Bt=wt(require("is-network-error"),1),Ot=wt(require("ky"),1);var s=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var i=class extends s{};var d=class extends i{static unauthenticated(){return new this("An unauthenticated request occurred")}};var l=class extends i{static forbidden(){return new this("A forbidden request occurred")}};var a=class extends s{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,e){return new this(`Forbidden method for request: ${t} ${e}`)}static teapot(){return new this("I'm a teapot")}static rateLimited(){return new this("Request has been rate-limited")}};var u=class extends s{};var c=class extends s{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var ht=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=Ot.default.create({prefixUrl:this.options.baseURL,hooks:{beforeRequest:[r=>{for(let n of this.options.requestFilterables){let f=n.getHeaders();for(let[It,Gt]of Object.entries(f))r.headers.has(It)||r.headers.set(It,Gt)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}includeQuery(t){let e=[];for(let r of Object.keys(t))e.push(["include",r]);return e}queryQuery(t){let e=[];return t&&e.push(["query",t]),e}async send(t,e){return await this.client(t,e).catch(r=>{if((0,Bt.default)(r))throw new u("A network error occurred",{cause:r});if(r instanceof Ot.HTTPError){let n=r.response.status;switch(console.error(JSON.stringify(r.response)),n){case 400:throw c.badRequest();case 401:throw d.unauthenticated();case 403:throw l.forbidden();case 404:throw a.notFound(t);case 405:throw a.forbiddenMethod(t,e.method??"GET");case 415:throw c.unsupportedMediaType();case 418:throw a.teapot();case 429:throw a.rateLimited()}if(n>=500&&n<600)throw s.serverError(n)}throw r})}};var ft=class{constructor(t){this._transport=t}async send({account:t,files:e,request:r={}}){let n=new FormData;for(let f of e)n.append("file",f);return this._transport.send("v1/uploads",{...r,method:"POST",body:n,searchParams:{account:t}})}};var Ct=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var yt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var p=require("zod"),xt=class o{constructor(t){this._client=t}static SCHEMA=p.z.object({event:p.z.intersection(p.z.object({id:p.z.string(),createdAt:p.z.string().datetime()}),p.z.discriminatedUnion("type",[p.z.object({type:p.z.literal("contact.created"),contact:p.z.string()}),p.z.object({type:p.z.literal("message.created"),message:p.z.string()})]))});async event({request:t}){let{event:e}=o.SCHEMA.parse(t.body);return{event:e}}};var h=class o{static DEFAULT_BASE_URL=_t;_transport;constructor(t,{baseURL:e,...r}={}){this._transport=new ht({requestFilterables:[new lt,t],...r,baseURL:e?.toString()??o.getBaseURL()})}static getBaseURL(){return process.env[Nt]??this.DEFAULT_BASE_URL}get action(){return{list:new C(this._transport)}}get boilerplate(){return{get:new x(this._transport),list:new R(this._transport),update:new b(this._transport),create:new y(this._transport)}}get boilerplateCategory(){return{get:new _(this._transport),list:new O(this._transport),create:new T(this._transport),update:new v(this._transport),boilerplate:{list:new g(this._transport)}}}get channel(){return{get:new I(this._transport),list:new U(this._transport),update:new w(this._transport),create:new F(this._transport),compositionSection:{list:new L(this._transport)},message:{list:new X(this._transport)},twilioSendgrid:{sync:new E(this._transport)}}}get compositionSection(){return{get:new q(this._transport),list:new A(this._transport),create:new S(this._transport),update:new P(this._transport)}}get contact(){return{get:new G(this._transport),list:new j(this._transport),update:new H(this._transport),create:new B(this._transport),conversation:{list:new k(this._transport)},note:{list:new at(this._transport),create:new st(this._transport)},notificationSubscription:{create:new dt(this._transport)},vcf:{get:new N(this._transport)}}}get conversation(){return{get:new D(this._transport),list:new V(this._transport),update:new Q(this._transport),create:new m(this._transport),message:{list:new Z(this._transport)},note:{list:new it(this._transport),create:new m(this._transport)}}}get label(){return{create:new z(this._transport),get:new $(this._transport),list:new W(this._transport),update:new J(this._transport),delete:new Y(this._transport),contact:{list:new M(this._transport)},conversation:{list:new K(this._transport)}}}get message(){return{list:new tt(this._transport)}}get model(){return{get:new ot(this._transport),list:new rt(this._transport),response:{create:new nt(this._transport)},correction:{create:new et(this._transport)}}}get note(){return{get:new pt(this._transport),update:new ct(this._transport)}}get source(){return{get:new ut(this._transport),list:new mt(this._transport)}}get upload(){return{get:new yt(this._transport),create:new ft(this._transport),delete:new Ct(this._transport)}}get webhook(){return new xt(this)}};var Ft={};Ut(Ft,{AuthError:()=>i,AuthenticationError:()=>d,AuthorizationError:()=>l,LogicError:()=>a,NetworkError:()=>u,SupportError:()=>s,ValidationError:()=>c});var gt=class o{static DEFAULT_NAME=qt;name;#t;constructor({name:t=process.env[Pt]??o.DEFAULT_NAME,key:e=process.env[At]}={}){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 Rt=class{#t;constructor({token:t=process.env[Lt]}={}){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 bt=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-B2IqpXbf.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, a5 as CreateContactNoteResponse, af as CreateContactNotificationSubscriptionResponse, x as CreateContactResponse, a6 as CreateConversationNoteResponse, a2 as CreateCorrectionResponse, N as CreateLabelResponse, a3 as CreateResponseResponse, ah as CreateUploadResponse, P as DeleteLabelResponse, aj as DeleteUploadResponse, i as GetBoilerplateCategoryResponse, G as GetBoilerplateResponse, n as GetChannelResponse, r as GetCompositionSectionResponse, y as GetContactResponse, F as GetConversationResponse, Q as GetLabelResponse, a0 as GetModelResponse, a7 as GetNoteResponse, ac as GetSourceResponse, ai 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, a8 as ListContactNotesResponse, z as ListContactsResponse, Y as ListConversationMessagesResponse, a9 as ListConversationNotesResponse, H as ListConversationsResponse, D as ListLabelContactsResponse, I as ListLabelConversationsResponse, S as ListLabelsResponse, Z as ListMessagesResponse, a1 as ListModelsResponse, ad as ListSourcesResponse, X as Message, $ as Model, a4 as Note, ae as NotificationSubscription, O as Options, R as RequestFilterable, ab 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, aa as UpdateNoteResponse, ag as Upload, W as WebhookResponse, C as default } from './index-B2IqpXbf.cjs';
1
+ import { A as Authentication, a as Conversation } from './index-DzdOjQt9.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, a5 as CreateContactNoteResponse, af as CreateContactNotificationSubscriptionResponse, x as CreateContactResponse, a6 as CreateConversationNoteResponse, a2 as CreateCorrectionResponse, N as CreateLabelResponse, a3 as CreateResponseResponse, ah as CreateUploadResponse, P as DeleteLabelResponse, aj as DeleteUploadResponse, i as GetBoilerplateCategoryResponse, G as GetBoilerplateResponse, n as GetChannelResponse, r as GetCompositionSectionResponse, y as GetContactResponse, F as GetConversationResponse, Q as GetLabelResponse, a0 as GetModelResponse, a7 as GetNoteResponse, ac as GetSourceResponse, ai 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, a8 as ListContactNotesResponse, z as ListContactsResponse, Y as ListConversationMessagesResponse, a9 as ListConversationNotesResponse, H as ListConversationsResponse, D as ListLabelContactsResponse, I as ListLabelConversationsResponse, S as ListLabelsResponse, Z as ListMessagesResponse, a1 as ListModelsResponse, ad as ListSourcesResponse, X as Message, $ as Model, a4 as Note, ae as NotificationSubscription, O as Options, R as RequestFilterable, ab 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, aa as UpdateNoteResponse, ag as Upload, W as WebhookResponse, C as default } from './index-DzdOjQt9.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-B2IqpXbf.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, a5 as CreateContactNoteResponse, af as CreateContactNotificationSubscriptionResponse, x as CreateContactResponse, a6 as CreateConversationNoteResponse, a2 as CreateCorrectionResponse, N as CreateLabelResponse, a3 as CreateResponseResponse, ah as CreateUploadResponse, P as DeleteLabelResponse, aj as DeleteUploadResponse, i as GetBoilerplateCategoryResponse, G as GetBoilerplateResponse, n as GetChannelResponse, r as GetCompositionSectionResponse, y as GetContactResponse, F as GetConversationResponse, Q as GetLabelResponse, a0 as GetModelResponse, a7 as GetNoteResponse, ac as GetSourceResponse, ai 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, a8 as ListContactNotesResponse, z as ListContactsResponse, Y as ListConversationMessagesResponse, a9 as ListConversationNotesResponse, H as ListConversationsResponse, D as ListLabelContactsResponse, I as ListLabelConversationsResponse, S as ListLabelsResponse, Z as ListMessagesResponse, a1 as ListModelsResponse, ad as ListSourcesResponse, X as Message, $ as Model, a4 as Note, ae as NotificationSubscription, O as Options, R as RequestFilterable, ab 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, aa as UpdateNoteResponse, ag as Upload, W as WebhookResponse, C as default } from './index-B2IqpXbf.js';
1
+ import { A as Authentication, a as Conversation } from './index-DzdOjQt9.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, a5 as CreateContactNoteResponse, af as CreateContactNotificationSubscriptionResponse, x as CreateContactResponse, a6 as CreateConversationNoteResponse, a2 as CreateCorrectionResponse, N as CreateLabelResponse, a3 as CreateResponseResponse, ah as CreateUploadResponse, P as DeleteLabelResponse, aj as DeleteUploadResponse, i as GetBoilerplateCategoryResponse, G as GetBoilerplateResponse, n as GetChannelResponse, r as GetCompositionSectionResponse, y as GetContactResponse, F as GetConversationResponse, Q as GetLabelResponse, a0 as GetModelResponse, a7 as GetNoteResponse, ac as GetSourceResponse, ai 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, a8 as ListContactNotesResponse, z as ListContactsResponse, Y as ListConversationMessagesResponse, a9 as ListConversationNotesResponse, H as ListConversationsResponse, D as ListLabelContactsResponse, I as ListLabelConversationsResponse, S as ListLabelsResponse, Z as ListMessagesResponse, a1 as ListModelsResponse, ad as ListSourcesResponse, X as Message, $ as Model, a4 as Note, ae as NotificationSubscription, O as Options, R as RequestFilterable, ab 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, aa as UpdateNoteResponse, ag as Upload, W as WebhookResponse, C as default } from './index-DzdOjQt9.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-ILZUVSAO.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-THIMBTIM.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.8.2",
3
+ "version": "0.8.4",
4
4
  "type": "module",
5
5
  "description": "JavaScript SDK for the Great Detail Support System",
6
6
  "author": "Great Detail Ltd <info@greatdetail.com>",