@great-detail/support-sdk 0.9.1 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-BRMJY7ON.js +1 -0
- package/dist/chunk-G42SHM33.js +1 -0
- package/dist/cli/index.cjs +1 -1
- package/dist/cli/index.d.cts +1 -1
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/cli.cjs +1 -1
- package/dist/cli.js +1 -1
- package/dist/{index-DxEjUl5v.d.cts → index-DutgCuRv.d.cts} +228 -102
- package/dist/{index-DxEjUl5v.d.ts → index-DutgCuRv.d.ts} +228 -102
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-GMNFEUBN.js +0 -1
- package/dist/chunk-KKQMNLPO.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as j,o as F}from"./chunk-G42SHM33.js";import{Command as A}from"commander";import{Command as v}from"commander";import{oraPromise as I}from"ora";function r({client:t,ora:s}){let o=new v("actions").description("Actions");return o.addCommand(new v("list").description("List actions").action(async()=>{let n=await I(()=>t.action.list.send().json(),{...s,text:"Finding actions"});console.log(n)})),o}import{Command as b}from"commander";import{oraPromise as S}from"ora";function d({client:t,ora:s}){let o=new b("channels").description("Channels");return o.addCommand(new b("list").description("List channels").action(async()=>{let n=await S(()=>t.channel.list.send().json(),{...s,text:"Finding channels"});console.log(n)})),o}import{Command as a}from"commander";import{oraPromise as c}from"ora";function p({client:t,ora:s}){let o=new a("contacts").description("Contacts");return o.addCommand(new a("get").description("Find contact").argument("<contact>","Contact ID").action(async n=>{let e=await c(()=>t.contact.get.send(n).json(),{...s,text:"Finding contact"});console.log(e)})),o.addCommand(new a("list").description("List contacts").action(async()=>{let n=await c(()=>t.contact.list.send().json(),{...s,text:"Finding contacts"});console.log(n)})),o.addCommand(new a("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async n=>{let e=await c(()=>t.contact.vcf.get.send({id:n}).response(),{...s,text:"Exporting contact"});console.log(e)})),o}import{Command as l}from"commander";import{oraPromise as L}from"ora";function u({client:t,ora:s}){let o=new l("conversations").description("Conversations");return o.addCommand(new l("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async n=>{let e=await L(()=>t.conversation.get.send(n).json(),{...s,text:"Finding conversation"});console.log(e)})),o.addCommand(new l("list").description("List conversations").action(async()=>{let n=await L(()=>t.conversation.list.send().json(),{...s,text:"Finding conversations"});console.log(n)})),o}import{Command as m}from"commander";import{oraPromise as g}from"ora";function C({client:t,ora:s}){let o=new m("labels").description("Labels");return o.addCommand(new m("get").description("Find label").argument("<label>","Label ID").action(async n=>{let e=await g(()=>t.label.get.send(n).json(),{...s,text:"Finding label"});console.log(e)})),o.addCommand(new m("list").description("List labels").action(async()=>{let n=await g(()=>t.label.list.send().json(),{...s,text:"Finding labels"});console.log(n)})),o.addCommand(new m("conversations").description("Find label conversations").argument("<label>","Label ID").action(async n=>{let e=await g(()=>t.label.conversation.list.send(n).json(),{...s,text:"Finding conversations"});console.log(e)})),o}import{Command as D}from"commander";import{oraPromise as M}from"ora";function f({client:t,ora:s}){let o=new D("messages").description("Messages");return o.addCommand(new D("list").description("List messages").action(async()=>{let n=await M(()=>t.message.list.send().json(),{...s,text:"Finding messages"});console.log(n)})),o}import{Command as O}from"commander";import{oraPromise as P}from"ora";function x({client:t,ora:s}){let o=new O("models").description("Models");return o.addCommand(new O("get").description("Find model").argument("<model>","Model ID").action(async n=>{let e=await P(()=>t.model.get.send(n).json(),{...s,text:"Finding model"});console.log(e)})),o.addCommand(new O("list").description("List models").action(async()=>{let n=await P(()=>t.model.list.send().json(),{...s,text:"Finding models"});console.log(n)})),o}import{Command as w}from"commander";import{oraPromise as h}from"ora";function y({client:t,ora:s}){let o=new w("sources").description("Sources");return o.addCommand(new w("get").description("Find source").argument("<source>","Source ID").action(async n=>{let e=await h(()=>t.source.get.send(n).json(),{...s,text:"Finding source"});console.log(e)})),o.addCommand(new w("list").description("List sources").action(async()=>{let n=await h(()=>t.source.list.send().json(),{...s,text:"Finding sources"});console.log(n)})),o}var i={ora:{spinner:"simpleDotsScrolling"},client:new F(new j)},E=new A("gds").description("Great Detail Support System").addCommand(r(i)).addCommand(d(i)).addCommand(p(i)).addCommand(u(i)).addCommand(C(i)).addCommand(f(i)).addCommand(x(i)).addCommand(y(i)),fo=E;export{fo as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var Ut=Object.defineProperty;var qt=(o,t)=>{for(var e in t)Ut(o,e,{get:t[e],enumerable:!0})};var Rt=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var Tt="https://api.support.greatdetail.com",_t={"X-Powered-By":"GDSupport/JavaScript"},Gt="api-key";import{z as a}from"zod";var u=class o{constructor(t){this._client=t}static SCHEMA=a.object({event:a.intersection(a.object({id:a.string(),createdAt:a.string().datetime()}),a.discriminatedUnion("type",[a.object({type:a.literal("contact.created"),contact:a.string()}),a.object({type:a.literal("message.created"),message:a.string()})]))});async event({request:t}){let{event:e}=o.SCHEMA.parse(t.body);return{event:e}}};var m=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/actions",{...t,method:"GET"})}};var h=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplates",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var C=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var f=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...e,method:"GET"})}};var g=class{constructor(t){this._transport=t}send({query:t,request:e={}}={}){return this._transport.send("v1/boilerplates",{...e,method:"GET",searchParams:[...this._transport.queryQuery(t)]})}};var b=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var R=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplate-categories",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var y=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var x=class{constructor(t){this._transport=t}send({include:t,request:e={}}={}){return this._transport.send("v1/boilerplate-categories",{...e,method:"GET",searchParams:[...this._transport.includeQuery(t??{})]})}};var T=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var _=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var O=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var v=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"})}};import{z as Ot}from"zod";var L=class o{constructor(t){this._transport=t}static SCHEMA=Ot.object({overwrite:Ot.boolean().optional()});send(t,{body:e,request:r={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:o.SCHEMA.parse(e)})}};var U=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var F=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var S=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}};var I=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...e,method:"GET"})}};var q=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/composition-sections",{...t,method:"GET"})}};var w=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var se="SUPPORT_ACCESS_TOKEN",ae="SUPPORT_API_KEY",pe="SUPPORT_KEY_NAME",vt="SUPPORT_BASE_URL";var E=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let r=e.variant??"vcard",n=e.format??(r==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(r)+"&format="+encodeURIComponent(n)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}send(t){return this._transport.send(this.getURL(t),{method:"GET"})}};var G=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var P=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var B=class{constructor(t){this._transport=t}send({query:t,request:e={}}={}){return this._transport.send("v1/contacts",{...e,method:"GET",searchParams:[...this._transport.queryQuery(t)]})}};var A=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...e,method:"GET"})}};var N=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var M=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var j=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var H=class{constructor(t){this._transport=t}send({filter:t,include:e,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...t?[["filter",t]]:[],...this._transport.includeQuery(e??{})]})}};var D=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var k=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var V=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var K=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var Q=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var z=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...e,method:"GET"})}};var Y=class{constructor(t){this._transport=t}send({query:t,include:e,request:r={}}={}){return this._transport.send("v1/labels",{...r,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.includeQuery(e??{})]})}};var $=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var J=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"})}};var W=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var X=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/messages",{...t,method:"GET"})}};var Z=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var tt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var et=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var ot=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var rt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var l=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var nt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var st=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var at=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var pt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var it=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var ct=class o{constructor(t=o.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=_t;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var lt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var dt=class{constructor(t){this._transport=t}send({category:t,request:e={}}={}){let r=[];if(t){let n=Array.isArray(t)?t:[t];for(let p of n)r.push(["category",p])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:r})}};import Ft from"is-network-error";import St,{HTTPError as It}from"ky";var s=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var c=class extends s{};var ut=class extends c{static unauthenticated(){return new this("An unauthenticated request occurred")}};var mt=class extends c{static forbidden(){return new this("A forbidden request occurred")}};var i=class extends s{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,e){return new this(`Forbidden method for request: ${t} ${e}`)}static teapot(){return new this("I'm a teapot")}static rateLimited(){return new this("Request has been rate-limited")}};var ht=class extends s{};var d=class extends s{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var Ct=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=St.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[r=>{for(let n of this.options.requestFilterables){let p=n.getHeaders();for(let[xt,Lt]of Object.entries(p))r.headers.has(xt)||r.headers.set(xt,Lt)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}includeQuery(t){let e=[];for(let r of Object.keys(t))e.push(["include",r]);return e}queryQuery(t){let e=[];return t&&e.push(["query",t]),e}send(t,e){let r=this.client(t,e).catch(n=>{if(Ft(n))throw new ht("A network error occurred",{cause:n});if(n instanceof It){let p=n.response.status;switch(console.error(JSON.stringify(n.response)),p){case 400:throw d.badRequest();case 401:throw ut.unauthenticated();case 403:throw mt.forbidden();case 404:throw i.notFound(t);case 405:throw i.forbiddenMethod(t,e.method??"GET");case 415:throw d.unsupportedMediaType();case 418:throw i.teapot();case 429:throw i.rateLimited()}if(p>=500&&p<600)throw s.serverError(p)}throw n});return{response:()=>r,json:async()=>(await r).json()}}};var ft=class{constructor(t){this._transport=t}send({account:t,files:e,request:r={}}){let n=new FormData;for(let p of e)n.append("file",p);return this._transport.send("v1/uploads",{...r,method:"POST",body:n,searchParams:{account:t}})}};var gt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var bt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var yt=class o{static DEFAULT_BASE_URL=Tt;_transport;constructor(t,{baseURL:e,...r}={}){this._transport=new Ct({requestFilterables:[new ct,t],...r,baseURL:e?.toString()??o.getBaseURL()})}static getBaseURL(){return process.env[vt]??this.DEFAULT_BASE_URL}get action(){return{list:new m(this._transport)}}get boilerplate(){return{get:new C(this._transport),list:new g(this._transport),update:new b(this._transport),create:new h(this._transport)}}get boilerplateCategory(){return{get:new y(this._transport),list:new x(this._transport),create:new R(this._transport),update:new T(this._transport),boilerplate:{list:new f(this._transport)}}}get channel(){return{get:new O(this._transport),list:new v(this._transport),update:new U(this._transport),create:new _(this._transport),compositionSection:{list:new I(this._transport)},message:{list:new J(this._transport)},twilioSendgrid:{sync:new L(this._transport)}}}get compositionSection(){return{get:new S(this._transport),list:new q(this._transport),create:new F(this._transport),update:new w(this._transport)}}get contact(){return{get:new P(this._transport),list:new B(this._transport),update:new N(this._transport),create:new G(this._transport),conversation:{list:new j(this._transport)},note:{list:new st(this._transport),create:new rt(this._transport)},notificationSubscription:{create:new it(this._transport)},vcf:{get:new E(this._transport)}}}get conversation(){return{get:new M(this._transport),list:new H(this._transport),update:new k(this._transport),create:new l(this._transport),label:{list:new z(this._transport)},message:{list:new W(this._transport)},note:{list:new at(this._transport),create:new l(this._transport)}}}get label(){return{create:new V(this._transport),get:new Q(this._transport),list:new Y(this._transport),update:new $(this._transport),delete:new K(this._transport),contact:{list:new A(this._transport)},conversation:{list:new D(this._transport)}}}get message(){return{list:new X(this._transport)}}get model(){return{get:new tt(this._transport),list:new et(this._transport),response:{create:new ot(this._transport)},correction:{create:new Z(this._transport)}}}get note(){return{get:new nt(this._transport),update:new pt(this._transport)}}get source(){return{get:new lt(this._transport),list:new dt(this._transport)}}get upload(){return{get:new bt(this._transport),create:new ft(this._transport),delete:new gt(this._transport)}}get webhook(){return new u(this)}};export{qt as a,Rt as b,se as c,ae as d,pe as e,Tt as f,Gt as g,s as h,c as i,ut as j,mt as k,i as l,ht as m,d as n,yt as o};
|
package/dist/cli/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var re=Object.create;var Tt=Object.defineProperty;var se=Object.getOwnPropertyDescriptor;var ae=Object.getOwnPropertyNames;var ie=Object.getPrototypeOf,pe=Object.prototype.hasOwnProperty;var ce=(o,t)=>{for(var e in t)Tt(o,e,{get:t[e],enumerable:!0})},zt=(o,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of ae(t))!pe.call(o,r)&&r!==e&&Tt(o,r,{get:()=>t[r],enumerable:!(n=se(t,r))||n.enumerable});return o};var Yt=(o,t,e)=>(e=o!=null?re(ie(o)):{},zt(t||!o||!o.__esModule?Tt(e,"default",{value:o,enumerable:!0}):e,o)),de=o=>zt(Tt({},"__esModule",{value:!0}),o);var ue={};ce(ue,{default:()=>me});module.exports=de(ue);var oe=require("commander");var u=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var C=class{constructor(t){this._transport=t}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 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 b=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 x=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 L=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"})}};var St=require("zod"),w=class o{constructor(t){this._transport=t}static SCHEMA=St.z.object({overwrite:St.z.boolean().optional()});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 F=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 I=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 q=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 $t="SUPPORT_BASE_URL";var Jt="https://api.support.greatdetail.com",Wt={"X-Powered-By":"GDSupport/JavaScript"};var P=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let 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 G=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:n={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...n,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var B=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 N=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 j=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 V=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 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 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({id:t,request:e={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...e,method:"GET"})}};var $=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 J=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 W=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 X=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 Z=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/messages",{...t,method:"GET"})}};var tt=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 et=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var ot=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:n={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var rt=class{constructor(t){this._transport=t}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 st=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 pt=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 ct=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 dt=class o{constructor(t=o.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Wt;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var lt=class{constructor(t){this._transport=t}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 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 Xt=Yt(require("is-network-error"),1),_t=Yt(require("ky"),1);var s=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var c=class extends s{};var ut=class extends c{static unauthenticated(){return new this("An unauthenticated request occurred")}};var Ct=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=_t.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[n=>{for(let r of this.options.requestFilterables){let m=r.getHeaders();for(let[Qt,ne]of Object.entries(m))n.headers.has(Qt)||n.headers.set(Qt,ne)}}]}})}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,Xt.default)(n))throw new ht("A network error occurred",{cause:n});if(n instanceof _t.HTTPError){let r=n.response.status;switch(console.error(JSON.stringify(n.response)),r){case 400:throw l.badRequest();case 401:throw ut.unauthenticated();case 403:throw Ct.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 yt=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 gt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var bt=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 Rt=class o{static DEFAULT_BASE_URL=Jt;_transport;constructor(t,{baseURL:e,...n}={}){this._transport=new ft({requestFilterables:[new dt,t],...n,baseURL:e?.toString()??o.getBaseURL()})}static getBaseURL(){return process.env[$t]??this.DEFAULT_BASE_URL}get action(){return{list:new C(this._transport)}}get boilerplate(){return{get:new f(this._transport),list:new g(this._transport),update:new b(this._transport),create:new h(this._transport)}}get boilerplateCategory(){return{get:new R(this._transport),list:new O(this._transport),create:new x(this._transport),update:new T(this._transport),boilerplate:{list:new y(this._transport)}}}get channel(){return{get:new v(this._transport),list:new L(this._transport),update:new F(this._transport),create:new _(this._transport),compositionSection:{list:new I(this._transport)},message:{list:new W(this._transport)},twilioSendgrid:{sync:new w(this._transport)}}}get compositionSection(){return{get:new S(this._transport),list:new q(this._transport),create:new U(this._transport),update:new E(this._transport)}}get contact(){return{get:new A(this._transport),list:new B(this._transport),update:new j(this._transport),create:new G(this._transport),conversation:{list:new D(this._transport)},note:{list:new at(this._transport),create:new rt(this._transport)},notificationSubscription:{create:new ct(this._transport)},vcf:{get:new P(this._transport)}}}get conversation(){return{get:new M(this._transport),list:new H(this._transport),update:new V(this._transport),create:new d(this._transport),label:{list:new Y(this._transport)},message:{list:new X(this._transport)},note:{list:new it(this._transport),create:new d(this._transport)}}}get label(){return{create:new K(this._transport),get:new z(this._transport),list:new $(this._transport),update:new J(this._transport),delete:new Q(this._transport),contact:{list:new N(this._transport)},conversation:{list:new k(this._transport)}}}get message(){return{list:new Z(this._transport)}}get model(){return{get:new et(this._transport),list:new ot(this._transport),response:{create:new nt(this._transport)},correction:{create:new tt(this._transport)}}}get note(){return{get:new st(this._transport),update:new pt(this._transport)}}get source(){return{get:new lt(this._transport),list:new mt(this._transport)}}get upload(){return{get:new bt(this._transport),create:new yt(this._transport),delete:new gt(this._transport)}}get webhook(){return new xt(this)}};var It=require("commander"),Zt=require("ora");function qt({client:o,ora:t}){let e=new It.Command("actions").description("Actions");return e.addCommand(new It.Command("list").description("List actions").action(async()=>{let n=await(0,Zt.oraPromise)(()=>o.action.list.send(),{...t,text:"Finding actions"});console.log(await n.json())})),e}var Et=require("commander"),te=require("ora");function Pt({client:o,ora:t}){let e=new Et.Command("channels").description("Channels");return e.addCommand(new Et.Command("list").description("List channels").action(async()=>{let n=await(0,te.oraPromise)(()=>o.channel.list.send(),{...t,text:"Finding channels"});console.log(await n.json())})),e}var vt=require("commander"),Gt=require("ora");function At({client:o,ora:t}){let e=new vt.Command("contacts").description("Contacts");return e.addCommand(new vt.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async n=>{let r=await(0,Gt.oraPromise)(()=>o.contact.get.send({id:n}),{...t,text:"Finding contact"});console.log(await r.json())})),e.addCommand(new vt.Command("list").description("List contacts").action(async()=>{let n=await(0,Gt.oraPromise)(()=>o.contact.list.send(),{...t,text:"Finding contacts"});console.log(await n.json())})),e}var Lt=require("commander"),Bt=require("ora");function Nt({client:o,ora:t}){let e=new Lt.Command("conversations").description("Conversations");return e.addCommand(new Lt.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async n=>{let r=await(0,Bt.oraPromise)(()=>o.conversation.get.send({id:n}),{...t,text:"Finding conversation"});console.log(await r.json())})),e.addCommand(new Lt.Command("list").description("List conversations").action(async()=>{let n=await(0,Bt.oraPromise)(()=>o.conversation.list.send(),{...t,text:"Finding conversations"});console.log(await n.json())})),e}var Ot=require("commander"),wt=require("ora");function jt({client:o,ora:t}){let e=new Ot.Command("labels").description("Labels");return e.addCommand(new Ot.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 Ot.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 Ot.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 Mt=require("commander"),ee=require("ora");function Dt({client:o,ora:t}){let e=new Mt.Command("messages").description("Messages");return e.addCommand(new Mt.Command("list").description("List messages").action(async()=>{let n=await(0,ee.oraPromise)(()=>o.message.list.send(),{...t,text:"Finding messages"});console.log(await n.json())})),e}var Ft=require("commander"),Ht=require("ora");function kt({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,Ht.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,Ht.oraPromise)(()=>o.model.list.send(),{...t,text:"Finding models"});console.log(await n.json())})),e}var Ut=require("commander"),Vt=require("ora");function Kt({client:o,ora:t}){let e=new Ut.Command("sources").description("Sources");return e.addCommand(new Ut.Command("get").description("Find source").argument("<source>","Source ID").action(async n=>{let r=await(0,Vt.oraPromise)(()=>o.source.get.send({id:n}),{...t,text:"Finding source"});console.log(await r.json())})),e.addCommand(new Ut.Command("list").description("List sources").action(async()=>{let n=await(0,Vt.oraPromise)(()=>o.source.list.send(),{...t,text:"Finding sources"});console.log(await n.json())})),e}var p={ora:{spinner:"simpleDotsScrolling"},client:new Rt(new u)},le=new oe.Command("gds").description("Great Detail Support System").addCommand(qt(p)).addCommand(Pt(p)).addCommand(At(p)).addCommand(Nt(p)).addCommand(jt(p)).addCommand(Dt(p)).addCommand(kt(p)).addCommand(Kt(p)),me=le;
|
|
1
|
+
"use strict";var ne=Object.create;var _t=Object.defineProperty;var se=Object.getOwnPropertyDescriptor;var ae=Object.getOwnPropertyNames;var ie=Object.getPrototypeOf,pe=Object.prototype.hasOwnProperty;var ce=(o,t)=>{for(var e in t)_t(o,e,{get:t[e],enumerable:!0})},zt=(o,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of ae(t))!pe.call(o,n)&&n!==e&&_t(o,n,{get:()=>t[n],enumerable:!(r=se(t,n))||r.enumerable});return o};var Yt=(o,t,e)=>(e=o!=null?ne(ie(o)):{},zt(t||!o||!o.__esModule?_t(e,"default",{value:o,enumerable:!0}):e,o)),de=o=>zt(_t({},"__esModule",{value:!0}),o);var ue={};ce(ue,{default:()=>me});module.exports=de(ue);var oe=require("commander");var u=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var C=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/actions",{...t,method:"GET"})}};var h=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplates",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var f=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var g=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...e,method:"GET"})}};var b=class{constructor(t){this._transport=t}send({query:t,request:e={}}={}){return this._transport.send("v1/boilerplates",{...e,method:"GET",searchParams:[...this._transport.queryQuery(t)]})}};var x=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var y=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplate-categories",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var R=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var O=class{constructor(t){this._transport=t}send({include:t,request:e={}}={}){return this._transport.send("v1/boilerplate-categories",{...e,method:"GET",searchParams:[...this._transport.includeQuery(t??{})]})}};var T=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var _=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var v=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var L=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"})}};var It=require("zod"),w=class o{constructor(t){this._transport=t}static SCHEMA=It.z.object({overwrite:It.z.boolean().optional()});send(t,{body:e,request:r={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:o.SCHEMA.parse(e)})}};var F=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var U=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var S=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}};var I=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...e,method:"GET"})}};var q=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/composition-sections",{...t,method:"GET"})}};var E=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var $t="SUPPORT_BASE_URL";var Jt="https://api.support.greatdetail.com",Wt={"X-Powered-By":"GDSupport/JavaScript"};var P=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let r=e.variant??"vcard",n=e.format??(r==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(r)+"&format="+encodeURIComponent(n)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}send(t){return this._transport.send(this.getURL(t),{method:"GET"})}};var G=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var A=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var B=class{constructor(t){this._transport=t}send({query:t,request:e={}}={}){return this._transport.send("v1/contacts",{...e,method:"GET",searchParams:[...this._transport.queryQuery(t)]})}};var j=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...e,method:"GET"})}};var N=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var M=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var D=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var H=class{constructor(t){this._transport=t}send({filter:t,include:e,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...t?[["filter",t]]:[],...this._transport.includeQuery(e??{})]})}};var k=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var V=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var K=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var Q=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var z=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var Y=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...e,method:"GET"})}};var $=class{constructor(t){this._transport=t}send({query:t,include:e,request:r={}}={}){return this._transport.send("v1/labels",{...r,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.includeQuery(e??{})]})}};var J=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var W=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"})}};var X=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var Z=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/messages",{...t,method:"GET"})}};var tt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var et=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var ot=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var rt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var nt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var l=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var st=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var at=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var it=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var pt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var ct=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var dt=class o{constructor(t=o.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Wt;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var lt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var mt=class{constructor(t){this._transport=t}send({category:t,request:e={}}={}){let r=[];if(t){let n=Array.isArray(t)?t:[t];for(let i of n)r.push(["category",i])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:r})}};var Xt=Yt(require("is-network-error"),1),vt=Yt(require("ky"),1);var s=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var d=class extends s{};var ut=class extends d{static unauthenticated(){return new this("An unauthenticated request occurred")}};var Ct=class extends d{static forbidden(){return new this("A forbidden request occurred")}};var p=class extends s{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,e){return new this(`Forbidden method for request: ${t} ${e}`)}static teapot(){return new this("I'm a teapot")}static rateLimited(){return new this("Request has been rate-limited")}};var ht=class extends s{};var m=class extends s{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var ft=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=vt.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[r=>{for(let n of this.options.requestFilterables){let i=n.getHeaders();for(let[Qt,re]of Object.entries(i))r.headers.has(Qt)||r.headers.set(Qt,re)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}includeQuery(t){let e=[];for(let r of Object.keys(t))e.push(["include",r]);return e}queryQuery(t){let e=[];return t&&e.push(["query",t]),e}send(t,e){let r=this.client(t,e).catch(n=>{if((0,Xt.default)(n))throw new ht("A network error occurred",{cause:n});if(n instanceof vt.HTTPError){let i=n.response.status;switch(console.error(JSON.stringify(n.response)),i){case 400:throw m.badRequest();case 401:throw ut.unauthenticated();case 403:throw Ct.forbidden();case 404:throw p.notFound(t);case 405:throw p.forbiddenMethod(t,e.method??"GET");case 415:throw m.unsupportedMediaType();case 418:throw p.teapot();case 429:throw p.rateLimited()}if(i>=500&&i<600)throw s.serverError(i)}throw n});return{response:()=>r,json:async()=>(await r).json()}}};var gt=class{constructor(t){this._transport=t}send({account:t,files:e,request:r={}}){let n=new FormData;for(let i of e)n.append("file",i);return this._transport.send("v1/uploads",{...r,method:"POST",body:n,searchParams:{account:t}})}};var bt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var xt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var a=require("zod"),yt=class o{constructor(t){this._client=t}static SCHEMA=a.z.object({event:a.z.intersection(a.z.object({id:a.z.string(),createdAt:a.z.string().datetime()}),a.z.discriminatedUnion("type",[a.z.object({type:a.z.literal("contact.created"),contact:a.z.string()}),a.z.object({type:a.z.literal("message.created"),message:a.z.string()})]))});async event({request:t}){let{event:e}=o.SCHEMA.parse(t.body);return{event:e}}};var Rt=class o{static DEFAULT_BASE_URL=Jt;_transport;constructor(t,{baseURL:e,...r}={}){this._transport=new ft({requestFilterables:[new dt,t],...r,baseURL:e?.toString()??o.getBaseURL()})}static getBaseURL(){return process.env[$t]??this.DEFAULT_BASE_URL}get action(){return{list:new C(this._transport)}}get boilerplate(){return{get:new f(this._transport),list:new b(this._transport),update:new x(this._transport),create:new h(this._transport)}}get boilerplateCategory(){return{get:new R(this._transport),list:new O(this._transport),create:new y(this._transport),update:new T(this._transport),boilerplate:{list:new g(this._transport)}}}get channel(){return{get:new v(this._transport),list:new L(this._transport),update:new F(this._transport),create:new _(this._transport),compositionSection:{list:new I(this._transport)},message:{list:new W(this._transport)},twilioSendgrid:{sync:new w(this._transport)}}}get compositionSection(){return{get:new S(this._transport),list:new q(this._transport),create:new U(this._transport),update:new E(this._transport)}}get contact(){return{get:new A(this._transport),list:new B(this._transport),update:new N(this._transport),create:new G(this._transport),conversation:{list:new D(this._transport)},note:{list:new at(this._transport),create:new nt(this._transport)},notificationSubscription:{create:new ct(this._transport)},vcf:{get:new P(this._transport)}}}get conversation(){return{get:new M(this._transport),list:new H(this._transport),update:new V(this._transport),create:new l(this._transport),label:{list:new Y(this._transport)},message:{list:new X(this._transport)},note:{list:new it(this._transport),create:new l(this._transport)}}}get label(){return{create:new K(this._transport),get:new z(this._transport),list:new $(this._transport),update:new J(this._transport),delete:new Q(this._transport),contact:{list:new j(this._transport)},conversation:{list:new k(this._transport)}}}get message(){return{list:new Z(this._transport)}}get model(){return{get:new et(this._transport),list:new ot(this._transport),response:{create:new rt(this._transport)},correction:{create:new tt(this._transport)}}}get note(){return{get:new st(this._transport),update:new pt(this._transport)}}get source(){return{get:new lt(this._transport),list:new mt(this._transport)}}get upload(){return{get:new xt(this._transport),create:new gt(this._transport),delete:new bt(this._transport)}}get webhook(){return new yt(this)}};var qt=require("commander"),Zt=require("ora");function Et({client:o,ora:t}){let e=new qt.Command("actions").description("Actions");return e.addCommand(new qt.Command("list").description("List actions").action(async()=>{let r=await(0,Zt.oraPromise)(()=>o.action.list.send().json(),{...t,text:"Finding actions"});console.log(r)})),e}var Pt=require("commander"),te=require("ora");function Gt({client:o,ora:t}){let e=new Pt.Command("channels").description("Channels");return e.addCommand(new Pt.Command("list").description("List channels").action(async()=>{let r=await(0,te.oraPromise)(()=>o.channel.list.send().json(),{...t,text:"Finding channels"});console.log(r)})),e}var Ot=require("commander"),Lt=require("ora");function At({client:o,ora:t}){let e=new Ot.Command("contacts").description("Contacts");return e.addCommand(new Ot.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async r=>{let n=await(0,Lt.oraPromise)(()=>o.contact.get.send(r).json(),{...t,text:"Finding contact"});console.log(n)})),e.addCommand(new Ot.Command("list").description("List contacts").action(async()=>{let r=await(0,Lt.oraPromise)(()=>o.contact.list.send().json(),{...t,text:"Finding contacts"});console.log(r)})),e.addCommand(new Ot.Command("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async r=>{let n=await(0,Lt.oraPromise)(()=>o.contact.vcf.get.send({id:r}).response(),{...t,text:"Exporting contact"});console.log(n)})),e}var wt=require("commander"),Bt=require("ora");function jt({client:o,ora:t}){let e=new wt.Command("conversations").description("Conversations");return e.addCommand(new wt.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async r=>{let n=await(0,Bt.oraPromise)(()=>o.conversation.get.send(r).json(),{...t,text:"Finding conversation"});console.log(n)})),e.addCommand(new wt.Command("list").description("List conversations").action(async()=>{let r=await(0,Bt.oraPromise)(()=>o.conversation.list.send().json(),{...t,text:"Finding conversations"});console.log(r)})),e}var Tt=require("commander"),Ft=require("ora");function Nt({client:o,ora:t}){let e=new Tt.Command("labels").description("Labels");return e.addCommand(new Tt.Command("get").description("Find label").argument("<label>","Label ID").action(async r=>{let n=await(0,Ft.oraPromise)(()=>o.label.get.send(r).json(),{...t,text:"Finding label"});console.log(n)})),e.addCommand(new Tt.Command("list").description("List labels").action(async()=>{let r=await(0,Ft.oraPromise)(()=>o.label.list.send().json(),{...t,text:"Finding labels"});console.log(r)})),e.addCommand(new Tt.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async r=>{let n=await(0,Ft.oraPromise)(()=>o.label.conversation.list.send(r).json(),{...t,text:"Finding conversations"});console.log(n)})),e}var Mt=require("commander"),ee=require("ora");function Dt({client:o,ora:t}){let e=new Mt.Command("messages").description("Messages");return e.addCommand(new Mt.Command("list").description("List messages").action(async()=>{let r=await(0,ee.oraPromise)(()=>o.message.list.send().json(),{...t,text:"Finding messages"});console.log(r)})),e}var Ut=require("commander"),Ht=require("ora");function kt({client:o,ora:t}){let e=new Ut.Command("models").description("Models");return e.addCommand(new Ut.Command("get").description("Find model").argument("<model>","Model ID").action(async r=>{let n=await(0,Ht.oraPromise)(()=>o.model.get.send(r).json(),{...t,text:"Finding model"});console.log(n)})),e.addCommand(new Ut.Command("list").description("List models").action(async()=>{let r=await(0,Ht.oraPromise)(()=>o.model.list.send().json(),{...t,text:"Finding models"});console.log(r)})),e}var St=require("commander"),Vt=require("ora");function Kt({client:o,ora:t}){let e=new St.Command("sources").description("Sources");return e.addCommand(new St.Command("get").description("Find source").argument("<source>","Source ID").action(async r=>{let n=await(0,Vt.oraPromise)(()=>o.source.get.send(r).json(),{...t,text:"Finding source"});console.log(n)})),e.addCommand(new St.Command("list").description("List sources").action(async()=>{let r=await(0,Vt.oraPromise)(()=>o.source.list.send().json(),{...t,text:"Finding sources"});console.log(r)})),e}var c={ora:{spinner:"simpleDotsScrolling"},client:new Rt(new u)},le=new oe.Command("gds").description("Great Detail Support System").addCommand(Et(c)).addCommand(Gt(c)).addCommand(At(c)).addCommand(jt(c)).addCommand(Nt(c)).addCommand(Dt(c)).addCommand(kt(c)).addCommand(Kt(c)),me=le;
|
package/dist/cli/index.d.cts
CHANGED
package/dist/cli/index.d.ts
CHANGED
package/dist/cli/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-BRMJY7ON.js";import"../chunk-G42SHM33.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 se=Object.getOwnPropertyDescriptor;var ae=Object.getOwnPropertyNames;var ie=Object.getPrototypeOf,pe=Object.prototype.hasOwnProperty;var ce=(o,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of ae(t))!pe.call(o,r)&&r!==e&&Qt(o,r,{get:()=>t[r],enumerable:!(n=se(t,r))||n.enumerable});return o};var zt=(o,t,e)=>(e=o!=null?re(ie(o)):{},ce(t||!o||!o.__esModule?Qt(e,"default",{value:o,enumerable:!0}):e,o));var ee=require("commander");var u=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var C=class{constructor(t){this._transport=t}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 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 b=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 x=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 L=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"})}};var Ut=require("zod"),w=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 F=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 I=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 q=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 G=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:n={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...n,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var B=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 N=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 j=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 V=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 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 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({id:t,request:e={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...e,method:"GET"})}};var $=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 J=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 W=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 X=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 Z=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/messages",{...t,method:"GET"})}};var tt=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 et=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var ot=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:n={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},json:e})}};var rt=class{constructor(t){this._transport=t}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 st=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 pt=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 ct=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 dt=class o{constructor(t=o.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Jt;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var lt=class{constructor(t){this._transport=t}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 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 ut=class extends c{static unauthenticated(){return new this("An unauthenticated request occurred")}};var Ct=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,timeout:12e3,hooks:{beforeRequest:[n=>{for(let r of this.options.requestFilterables){let m=r.getHeaders();for(let[Kt,ne]of Object.entries(m))n.headers.has(Kt)||n.headers.set(Kt,ne)}}]}})}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 ut.unauthenticated();case 403:throw Ct.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 yt=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 gt=class{constructor(t){this._transport=t}async send({id:t,request:e={}}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var bt=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 Rt=class o{static DEFAULT_BASE_URL=$t;_transport;constructor(t,{baseURL:e,...n}={}){this._transport=new ft({requestFilterables:[new dt,t],...n,baseURL:e?.toString()??o.getBaseURL()})}static getBaseURL(){return process.env[Yt]??this.DEFAULT_BASE_URL}get action(){return{list:new C(this._transport)}}get boilerplate(){return{get:new f(this._transport),list:new g(this._transport),update:new b(this._transport),create:new h(this._transport)}}get boilerplateCategory(){return{get:new R(this._transport),list:new O(this._transport),create:new x(this._transport),update:new T(this._transport),boilerplate:{list:new y(this._transport)}}}get channel(){return{get:new v(this._transport),list:new L(this._transport),update:new F(this._transport),create:new _(this._transport),compositionSection:{list:new I(this._transport)},message:{list:new W(this._transport)},twilioSendgrid:{sync:new w(this._transport)}}}get compositionSection(){return{get:new S(this._transport),list:new q(this._transport),create:new U(this._transport),update:new E(this._transport)}}get contact(){return{get:new A(this._transport),list:new B(this._transport),update:new j(this._transport),create:new G(this._transport),conversation:{list:new D(this._transport)},note:{list:new at(this._transport),create:new rt(this._transport)},notificationSubscription:{create:new ct(this._transport)},vcf:{get:new P(this._transport)}}}get conversation(){return{get:new M(this._transport),list:new H(this._transport),update:new V(this._transport),create:new d(this._transport),label:{list:new Y(this._transport)},message:{list:new X(this._transport)},note:{list:new it(this._transport),create:new d(this._transport)}}}get label(){return{create:new K(this._transport),get:new z(this._transport),list:new $(this._transport),update:new J(this._transport),delete:new Q(this._transport),contact:{list:new N(this._transport)},conversation:{list:new k(this._transport)}}}get message(){return{list:new Z(this._transport)}}get model(){return{get:new et(this._transport),list:new ot(this._transport),response:{create:new nt(this._transport)},correction:{create:new tt(this._transport)}}}get note(){return{get:new st(this._transport),update:new pt(this._transport)}}get source(){return{get:new lt(this._transport),list:new mt(this._transport)}}get upload(){return{get:new bt(this._transport),create:new yt(this._transport),delete:new gt(this._transport)}}get webhook(){return new xt(this)}};var St=require("commander"),Xt=require("ora");function It({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 qt=require("commander"),Zt=require("ora");function Et({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,Zt.oraPromise)(()=>o.channel.list.send(),{...t,text:"Finding channels"});console.log(await n.json())})),e}var _t=require("commander"),Pt=require("ora");function Gt({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"),At=require("ora");function Bt({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,At.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,At.oraPromise)(()=>o.conversation.list.send(),{...t,text:"Finding conversations"});console.log(await n.json())})),e}var Ot=require("commander"),Lt=require("ora");function Nt({client:o,ora:t}){let e=new Ot.Command("labels").description("Labels");return e.addCommand(new Ot.Command("get").description("Find label").argument("<label>","Label ID").action(async n=>{let r=await(0,Lt.oraPromise)(()=>o.label.get.send({id:n}),{...t,text:"Finding label"});console.log(await r.json())})),e.addCommand(new Ot.Command("list").description("List labels").action(async()=>{let n=await(0,Lt.oraPromise)(()=>o.label.list.send(),{...t,text:"Finding labels"});console.log(await n.json())})),e.addCommand(new Ot.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async n=>{let r=await(0,Lt.oraPromise)(()=>o.label.conversation.list.send({id:n}),{...t,text:"Finding conversations"});console.log(await r.json())})),e}var jt=require("commander"),te=require("ora");function Mt({client:o,ora:t}){let e=new jt.Command("messages").description("Messages");return e.addCommand(new jt.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 wt=require("commander"),Dt=require("ora");function Ht({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,Dt.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,Dt.oraPromise)(()=>o.model.list.send(),{...t,text:"Finding models"});console.log(await n.json())})),e}var Ft=require("commander"),kt=require("ora");function Vt({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,kt.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,kt.oraPromise)(()=>o.source.list.send(),{...t,text:"Finding sources"});console.log(await n.json())})),e}var p={ora:{spinner:"simpleDotsScrolling"},client:new Rt(new u)},de=new ee.Command("gds").description("Great Detail Support System").addCommand(It(p)).addCommand(Et(p)).addCommand(Gt(p)).addCommand(Bt(p)).addCommand(Nt(p)).addCommand(Mt(p)).addCommand(Ht(p)).addCommand(Vt(p)),oe=de;oe.parseAsync(process.argv);
|
|
2
|
+
"use strict";var ne=Object.create;var Qt=Object.defineProperty;var se=Object.getOwnPropertyDescriptor;var ae=Object.getOwnPropertyNames;var ie=Object.getPrototypeOf,pe=Object.prototype.hasOwnProperty;var ce=(o,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of ae(t))!pe.call(o,n)&&n!==e&&Qt(o,n,{get:()=>t[n],enumerable:!(r=se(t,n))||r.enumerable});return o};var zt=(o,t,e)=>(e=o!=null?ne(ie(o)):{},ce(t||!o||!o.__esModule?Qt(e,"default",{value:o,enumerable:!0}):e,o));var ee=require("commander");var u=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var C=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/actions",{...t,method:"GET"})}};var h=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplates",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var f=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...e,method:"GET"})}};var g=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...e,method:"GET"})}};var b=class{constructor(t){this._transport=t}send({query:t,request:e={}}={}){return this._transport.send("v1/boilerplates",{...e,method:"GET",searchParams:[...this._transport.queryQuery(t)]})}};var x=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var y=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/boilerplate-categories",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var R=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...e,method:"GET"})}};var O=class{constructor(t){this._transport=t}send({include:t,request:e={}}={}){return this._transport.send("v1/boilerplate-categories",{...e,method:"GET",searchParams:[...this._transport.includeQuery(t??{})]})}};var T=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var _=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var v=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}};var L=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"})}};var St=require("zod"),w=class o{constructor(t){this._transport=t}static SCHEMA=St.z.object({overwrite:St.z.boolean().optional()});send(t,{body:e,request:r={}}){return this._transport.send("v1/sources/twilio-sendgrid/channels/"+encodeURIComponent(t)+"/sync",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:o.SCHEMA.parse(e)})}};var F=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var U=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var S=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}};var I=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/composition-sections",{...e,method:"GET"})}};var q=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/composition-sections",{...t,method:"GET"})}};var E=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var Yt="SUPPORT_BASE_URL";var $t="https://api.support.greatdetail.com",Jt={"X-Powered-By":"GDSupport/JavaScript"};var P=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:e={}}){let r=e.variant??"vcard",n=e.format??(r==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(r)+"&format="+encodeURIComponent(n)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}send(t){return this._transport.send(this.getURL(t),{method:"GET"})}};var G=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var A=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var B=class{constructor(t){this._transport=t}send({query:t,request:e={}}={}){return this._transport.send("v1/contacts",{...e,method:"GET",searchParams:[...this._transport.queryQuery(t)]})}};var j=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...e,method:"GET"})}};var N=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var M=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var D=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var H=class{constructor(t){this._transport=t}send({filter:t,include:e,request:r={}}={}){return this._transport.send("v1/conversations",{...r,method:"GET",searchParams:[...t?[["filter",t]]:[],...this._transport.includeQuery(e??{})]})}};var k=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"})}};var V=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var K=class{constructor(t){this._transport=t}send({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},json:t})}};var Q=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var z=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}};var Y=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/labels",{...e,method:"GET"})}};var $=class{constructor(t){this._transport=t}send({query:t,include:e,request:r={}}={}){return this._transport.send("v1/labels",{...r,method:"GET",searchParams:[...this._transport.queryQuery(t),...this._transport.includeQuery(e??{})]})}};var J=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var W=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"})}};var X=class{constructor(t){this._transport=t}send(t,{include:e,request:r={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...r,method:"GET",searchParams:[...this._transport.includeQuery(e??{})]})}};var Z=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/messages",{...t,method:"GET"})}};var tt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var et=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"})}};var ot=class{constructor(t){this._transport=t}send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"})}};var rt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var nt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var l=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var st=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}};var at=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var it=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...e,method:"GET"})}};var pt=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var ct=class{constructor(t){this._transport=t}send(t,{body:e,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notification-subscriptions",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},json:e})}};var dt=class o{constructor(t=o.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Jt;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var lt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}};var mt=class{constructor(t){this._transport=t}send({category:t,request:e={}}={}){let r=[];if(t){let n=Array.isArray(t)?t:[t];for(let i of n)r.push(["category",i])}return this._transport.send("v1/sources",{...e,method:"GET",searchParams:r})}};var Wt=zt(require("is-network-error"),1),_t=zt(require("ky"),1);var s=class extends Error{static serverError(t){return new this("Server Error: "+t)}};var d=class extends s{};var ut=class extends d{static unauthenticated(){return new this("An unauthenticated request occurred")}};var Ct=class extends d{static forbidden(){return new this("A forbidden request occurred")}};var p=class extends s{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,e){return new this(`Forbidden method for request: ${t} ${e}`)}static teapot(){return new this("I'm a teapot")}static rateLimited(){return new this("Request has been rate-limited")}};var ht=class extends s{};var m=class extends s{static badRequest(){return new this("Bad request")}static unsupportedMediaType(){return new this("Unsupported Media Type")}};var ft=class{client;options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t},this.client=_t.default.create({prefixUrl:this.options.baseURL,timeout:12e3,hooks:{beforeRequest:[r=>{for(let n of this.options.requestFilterables){let i=n.getHeaders();for(let[Kt,re]of Object.entries(i))r.headers.has(Kt)||r.headers.set(Kt,re)}}]}})}getURL(t){return new URL(t,this.options.baseURL).toString()}includeQuery(t){let e=[];for(let r of Object.keys(t))e.push(["include",r]);return e}queryQuery(t){let e=[];return t&&e.push(["query",t]),e}send(t,e){let r=this.client(t,e).catch(n=>{if((0,Wt.default)(n))throw new ht("A network error occurred",{cause:n});if(n instanceof _t.HTTPError){let i=n.response.status;switch(console.error(JSON.stringify(n.response)),i){case 400:throw m.badRequest();case 401:throw ut.unauthenticated();case 403:throw Ct.forbidden();case 404:throw p.notFound(t);case 405:throw p.forbiddenMethod(t,e.method??"GET");case 415:throw m.unsupportedMediaType();case 418:throw p.teapot();case 429:throw p.rateLimited()}if(i>=500&&i<600)throw s.serverError(i)}throw n});return{response:()=>r,json:async()=>(await r).json()}}};var gt=class{constructor(t){this._transport=t}send({account:t,files:e,request:r={}}){let n=new FormData;for(let i of e)n.append("file",i);return this._transport.send("v1/uploads",{...r,method:"POST",body:n,searchParams:{account:t}})}};var bt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var xt=class{constructor(t){this._transport=t}send(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"GET"})}};var a=require("zod"),yt=class o{constructor(t){this._client=t}static SCHEMA=a.z.object({event:a.z.intersection(a.z.object({id:a.z.string(),createdAt:a.z.string().datetime()}),a.z.discriminatedUnion("type",[a.z.object({type:a.z.literal("contact.created"),contact:a.z.string()}),a.z.object({type:a.z.literal("message.created"),message:a.z.string()})]))});async event({request:t}){let{event:e}=o.SCHEMA.parse(t.body);return{event:e}}};var Rt=class o{static DEFAULT_BASE_URL=$t;_transport;constructor(t,{baseURL:e,...r}={}){this._transport=new ft({requestFilterables:[new dt,t],...r,baseURL:e?.toString()??o.getBaseURL()})}static getBaseURL(){return process.env[Yt]??this.DEFAULT_BASE_URL}get action(){return{list:new C(this._transport)}}get boilerplate(){return{get:new f(this._transport),list:new b(this._transport),update:new x(this._transport),create:new h(this._transport)}}get boilerplateCategory(){return{get:new R(this._transport),list:new O(this._transport),create:new y(this._transport),update:new T(this._transport),boilerplate:{list:new g(this._transport)}}}get channel(){return{get:new v(this._transport),list:new L(this._transport),update:new F(this._transport),create:new _(this._transport),compositionSection:{list:new I(this._transport)},message:{list:new W(this._transport)},twilioSendgrid:{sync:new w(this._transport)}}}get compositionSection(){return{get:new S(this._transport),list:new q(this._transport),create:new U(this._transport),update:new E(this._transport)}}get contact(){return{get:new A(this._transport),list:new B(this._transport),update:new N(this._transport),create:new G(this._transport),conversation:{list:new D(this._transport)},note:{list:new at(this._transport),create:new nt(this._transport)},notificationSubscription:{create:new ct(this._transport)},vcf:{get:new P(this._transport)}}}get conversation(){return{get:new M(this._transport),list:new H(this._transport),update:new V(this._transport),create:new l(this._transport),label:{list:new Y(this._transport)},message:{list:new X(this._transport)},note:{list:new it(this._transport),create:new l(this._transport)}}}get label(){return{create:new K(this._transport),get:new z(this._transport),list:new $(this._transport),update:new J(this._transport),delete:new Q(this._transport),contact:{list:new j(this._transport)},conversation:{list:new k(this._transport)}}}get message(){return{list:new Z(this._transport)}}get model(){return{get:new et(this._transport),list:new ot(this._transport),response:{create:new rt(this._transport)},correction:{create:new tt(this._transport)}}}get note(){return{get:new st(this._transport),update:new pt(this._transport)}}get source(){return{get:new lt(this._transport),list:new mt(this._transport)}}get upload(){return{get:new xt(this._transport),create:new gt(this._transport),delete:new bt(this._transport)}}get webhook(){return new yt(this)}};var It=require("commander"),Xt=require("ora");function qt({client:o,ora:t}){let e=new It.Command("actions").description("Actions");return e.addCommand(new It.Command("list").description("List actions").action(async()=>{let r=await(0,Xt.oraPromise)(()=>o.action.list.send().json(),{...t,text:"Finding actions"});console.log(r)})),e}var Et=require("commander"),Zt=require("ora");function Pt({client:o,ora:t}){let e=new Et.Command("channels").description("Channels");return e.addCommand(new Et.Command("list").description("List channels").action(async()=>{let r=await(0,Zt.oraPromise)(()=>o.channel.list.send().json(),{...t,text:"Finding channels"});console.log(r)})),e}var Ot=require("commander"),vt=require("ora");function Gt({client:o,ora:t}){let e=new Ot.Command("contacts").description("Contacts");return e.addCommand(new Ot.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async r=>{let n=await(0,vt.oraPromise)(()=>o.contact.get.send(r).json(),{...t,text:"Finding contact"});console.log(n)})),e.addCommand(new Ot.Command("list").description("List contacts").action(async()=>{let r=await(0,vt.oraPromise)(()=>o.contact.list.send().json(),{...t,text:"Finding contacts"});console.log(r)})),e.addCommand(new Ot.Command("get-vcf").description("Export Contact as VCF").argument("<contact>","Contact ID").action(async r=>{let n=await(0,vt.oraPromise)(()=>o.contact.vcf.get.send({id:r}).response(),{...t,text:"Exporting contact"});console.log(n)})),e}var Lt=require("commander"),At=require("ora");function Bt({client:o,ora:t}){let e=new Lt.Command("conversations").description("Conversations");return e.addCommand(new Lt.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async r=>{let n=await(0,At.oraPromise)(()=>o.conversation.get.send(r).json(),{...t,text:"Finding conversation"});console.log(n)})),e.addCommand(new Lt.Command("list").description("List conversations").action(async()=>{let r=await(0,At.oraPromise)(()=>o.conversation.list.send().json(),{...t,text:"Finding conversations"});console.log(r)})),e}var Tt=require("commander"),wt=require("ora");function jt({client:o,ora:t}){let e=new Tt.Command("labels").description("Labels");return e.addCommand(new Tt.Command("get").description("Find label").argument("<label>","Label ID").action(async r=>{let n=await(0,wt.oraPromise)(()=>o.label.get.send(r).json(),{...t,text:"Finding label"});console.log(n)})),e.addCommand(new Tt.Command("list").description("List labels").action(async()=>{let r=await(0,wt.oraPromise)(()=>o.label.list.send().json(),{...t,text:"Finding labels"});console.log(r)})),e.addCommand(new Tt.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async r=>{let n=await(0,wt.oraPromise)(()=>o.label.conversation.list.send(r).json(),{...t,text:"Finding conversations"});console.log(n)})),e}var Nt=require("commander"),te=require("ora");function Mt({client:o,ora:t}){let e=new Nt.Command("messages").description("Messages");return e.addCommand(new Nt.Command("list").description("List messages").action(async()=>{let r=await(0,te.oraPromise)(()=>o.message.list.send().json(),{...t,text:"Finding messages"});console.log(r)})),e}var Ft=require("commander"),Dt=require("ora");function Ht({client:o,ora:t}){let e=new Ft.Command("models").description("Models");return e.addCommand(new Ft.Command("get").description("Find model").argument("<model>","Model ID").action(async r=>{let n=await(0,Dt.oraPromise)(()=>o.model.get.send(r).json(),{...t,text:"Finding model"});console.log(n)})),e.addCommand(new Ft.Command("list").description("List models").action(async()=>{let r=await(0,Dt.oraPromise)(()=>o.model.list.send().json(),{...t,text:"Finding models"});console.log(r)})),e}var Ut=require("commander"),kt=require("ora");function Vt({client:o,ora:t}){let e=new Ut.Command("sources").description("Sources");return e.addCommand(new Ut.Command("get").description("Find source").argument("<source>","Source ID").action(async r=>{let n=await(0,kt.oraPromise)(()=>o.source.get.send(r).json(),{...t,text:"Finding source"});console.log(n)})),e.addCommand(new Ut.Command("list").description("List sources").action(async()=>{let r=await(0,kt.oraPromise)(()=>o.source.list.send().json(),{...t,text:"Finding sources"});console.log(r)})),e}var c={ora:{spinner:"simpleDotsScrolling"},client:new Rt(new u)},de=new ee.Command("gds").description("Great Detail Support System").addCommand(qt(c)).addCommand(Pt(c)).addCommand(Gt(c)).addCommand(Bt(c)).addCommand(jt(c)).addCommand(Mt(c)).addCommand(Ht(c)).addCommand(Vt(c)),oe=de;oe.parseAsync(process.argv);
|
package/dist/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as r}from"./chunk-
|
|
2
|
+
import{a as r}from"./chunk-BRMJY7ON.js";import"./chunk-G42SHM33.js";r.parseAsync(process.argv);
|