@great-detail/support-sdk 0.2.10 → 0.3.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-ZYSG2PTQ.js → chunk-MIIHAFPV.js} +1 -1
- package/dist/chunk-O5KZWMF7.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-BMsEq65I.d.cts → index-ng6eKA5J.d.cts} +228 -21
- package/dist/{index-BMsEq65I.d.ts → index-ng6eKA5J.d.ts} +228 -21
- 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/src/Boilerplate/CreateBoilerplateCategoryBoilerplate.ts +68 -0
- package/src/Boilerplate/GetBoilerplate.ts +1 -0
- package/src/Boilerplate/ListBoilerplateCategoryBoilerplates.ts +53 -0
- package/src/Boilerplate/ListBoilerplates.ts +1 -0
- package/src/Boilerplate/UpdateBoilerplate.ts +1 -0
- package/src/Boilerplate/index.ts +2 -1
- package/src/{Boilerplate/CreateBoilerplate.ts → BoilerplateCategory/CreateBoilerplateCategory.ts} +11 -11
- package/src/BoilerplateCategory/GetBoilerplateCategory.ts +47 -0
- package/src/BoilerplateCategory/ListBoilerplateCategories.ts +46 -0
- package/src/BoilerplateCategory/UpdateBoilerplateCategory.ts +59 -0
- package/src/BoilerplateCategory/index.ts +13 -0
- package/src/Client/index.ts +19 -2
- package/src/index.ts +1 -0
- package/dist/chunk-KG7KNOPC.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as y,o as F}from"./chunk-
|
|
1
|
+
import{n as y,o as F}from"./chunk-O5KZWMF7.js";import{Command as A}from"commander";import{Command as b}from"commander";import{oraPromise as I}from"ora";function m({client:n,ora:s}){let o=new b("actions").description("Actions");return o.addCommand(new b("list").description("List actions").action(async()=>{let t=await I(()=>n.action.list.send(),{...s,text:"Finding actions"});console.log(await t.result())})),o}import{Command as v}from"commander";import{oraPromise as S}from"ora";function r({client:n,ora:s}){let o=new v("channels").description("Channels");return o.addCommand(new v("list").description("List channels").action(async()=>{let t=await S(()=>n.channel.list.send(),{...s,text:"Finding channels"});console.log(await t.result())})),o}import{Command as d}from"commander";import{oraPromise as L}from"ora";function c({client:n,ora:s}){let o=new d("contacts").description("Contacts");return o.addCommand(new d("get").description("Find contact").argument("<contact>","Contact ID").action(async t=>{let e=await L(()=>n.contact.get.send({id:t}),{...s,text:"Finding contact"});console.log(await e.result())})),o.addCommand(new d("list").description("List contacts").action(async()=>{let t=await L(()=>n.contact.list.send(),{...s,text:"Finding contacts"});console.log(await t.result())})),o}import{Command as p}from"commander";import{oraPromise as P}from"ora";function l({client:n,ora:s}){let o=new p("conversations").description("Conversations");return o.addCommand(new p("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async t=>{let e=await P(()=>n.conversation.get.send({id:t}),{...s,text:"Finding conversation"});console.log(await e.result())})),o.addCommand(new p("list").description("List conversations").action(async()=>{let t=await P(()=>n.conversation.list.send(),{...s,text:"Finding conversations"});console.log(await t.result())})),o}import{Command as a}from"commander";import{oraPromise as u}from"ora";function f({client:n,ora:s}){let o=new a("labels").description("Labels");return o.addCommand(new a("get").description("Find label").argument("<label>","Label ID").action(async t=>{let e=await u(()=>n.label.get.send({id:t}),{...s,text:"Finding label"});console.log(await e.result())})),o.addCommand(new a("list").description("List labels").action(async()=>{let t=await u(()=>n.label.list.send(),{...s,text:"Finding labels"});console.log(await t.result())})),o.addCommand(new a("conversations").description("Find label conversations").argument("<label>","Label ID").action(async t=>{let e=await u(()=>n.label.conversation.list.send({id:t}),{...s,text:"Finding conversations"});console.log(await e.result())})),o}import{Command as h}from"commander";import{oraPromise as M}from"ora";function C({client:n,ora:s}){let o=new h("messages").description("Messages");return o.addCommand(new h("list").description("List messages").action(async()=>{let t=await M(()=>n.message.list.send(),{...s,text:"Finding messages"});console.log(await t.result())})),o}import{Command as g}from"commander";import{oraPromise as j}from"ora";function w({client:n,ora:s}){let o=new g("models").description("Models");return o.addCommand(new g("get").description("Find model").argument("<model>","Model ID").action(async t=>{let e=await j(()=>n.model.get.send({id:t}),{...s,text:"Finding model"});console.log(await e.result())})),o.addCommand(new g("list").description("List models").action(async()=>{let t=await j(()=>n.model.list.send(),{...s,text:"Finding models"});console.log(await t.result())})),o}import{Command as O}from"commander";import{oraPromise as D}from"ora";function x({client:n,ora:s}){let o=new O("sources").description("Sources");return o.addCommand(new O("get").description("Find source").argument("<source>","Source ID").action(async t=>{let e=await D(()=>n.source.get.send({id:t}),{...s,text:"Finding source"});console.log(await e.result())})),o.addCommand(new O("list").description("List sources").action(async()=>{let t=await D(()=>n.source.list.send(),{...s,text:"Finding sources"});console.log(await t.result())})),o}var i={ora:{spinner:"simpleDotsScrolling"},client:new y(new F)},G=new A("gds").description("Great Detail Support System").addCommand(m(i)).addCommand(r(i)).addCommand(c(i)).addCommand(l(i)).addCommand(f(i)).addCommand(C(i)).addCommand(w(i)).addCommand(x(i)),go=G;export{go as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var ie=Object.defineProperty;var ce=(e,t)=>{for(var r in t)ie(e,r,{get:t[r],enumerable:!0})};var Xt="https://api.support.greatdetail.com",Qt={"X-Powered-By":"GDSupport/JavaScript"},le="api-key";var p=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/actions",{...t,method:"GET"}).then(r=>new at(r))}},at=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as et}from"zod";var c=class e{constructor(t){this._transport=t}static SCHEMA=et.object({title:et.string(),content:et.string(),account:et.string()});async send({id:t,body:r,request:s={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(r))}).then(n=>new pt(n))}},pt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var d=class{constructor(t){this._transport=t}async send({id:t,request:r={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...r,method:"GET"}).then(s=>new ct(s))}},ct=class{constructor(t){this.response=t}async result(){return this.response.json()}};var l=class{constructor(t){this._transport=t}async send({id:t,request:r={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...r,method:"GET"}).then(s=>new dt(s))}},dt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var u=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/boilerplates",{...t,method:"GET"}).then(r=>new lt(r))}},lt=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as ut}from"zod";var g=class e{constructor(t){this._transport=t}static SCHEMA=ut.object({title:ut.string().optional(),content:ut.string().optional()});async send({id:t,body:r,request:s={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(r))}).then(n=>new gt(n))}},gt=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as rt}from"zod";var m=class e{constructor(t){this._transport=t}static SCHEMA=rt.object({title:rt.string(),description:rt.string().optional(),account:rt.string()});async send({body:t,request:r={}}){return this._transport.send("v1/boilerplate-categories",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(t))}).then(s=>new mt(s))}},mt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var h=class{constructor(t){this._transport=t}async send({id:t,request:r={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...r,method:"GET"}).then(s=>new ht(s))}},ht=class{constructor(t){this.response=t}async result(){return this.response.json()}};var y=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/boilerplate-categories",{...t,method:"GET"}).then(r=>new yt(r))}},yt=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as bt}from"zod";var b=class e{constructor(t){this._transport=t}static SCHEMA=bt.object({title:bt.string().optional(),description:bt.string().optional()});async send({id:t,body:r,request:s={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(r))}).then(n=>new ft(n))}},ft=class{constructor(t){this.response=t}async result(){return this.response.json()}};var f=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"}).then(r=>new Rt(r))}},Rt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var Ee="SUPPORT_ACCESS_TOKEN",we="SUPPORT_API_KEY",ve="SUPPORT_KEY_NAME",Zt="SUPPORT_BASE_URL";var R=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:r={}}){let s=r.variant??"vcard",n=r.format??(r.variant==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(s)+"&format="+encodeURIComponent(n)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}};import{z as x}from"zod";var A=class e{constructor(t){this._transport=t}static SCHEMA=x.object({name:x.string(),account:x.string(),emailAddress:x.string().email().optional(),telephoneNumber:x.string().optional()});async send({body:t,request:r={}}){return this._transport.send("v1/contacts",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(t))}).then(s=>new xt(s))}},xt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var C=class{constructor(t){this._transport=t}async send({id:t,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"GET"}).then(s=>new At(s))}},At=class{constructor(t){this.response=t}async result(){return this.response.json()}};var T=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/contacts",{...t,method:"GET"}).then(r=>new Ct(r))}},Ct=class{constructor(t){this.response=t}async result(){return this.response.json()}};var _=class{constructor(t){this._transport=t}async send({id:t,request:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...r,method:"GET"}).then(s=>new Tt(s))}},Tt=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as st}from"zod";var P=class e{constructor(t){this._transport=t}static SCHEMA=st.object({name:st.string().optional(),emailAddress:st.string().email().optional(),telephoneNumber:st.string().optional()});async send({id:t,body:r,request:s={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(r))}).then(n=>new _t(n))}},_t=class{constructor(t){this.response=t}async result(){return this.response.json()}};var S=class{constructor(t){this._transport=t}async send({id:t,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"GET"}).then(s=>new Pt(s))}},Pt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var O=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/conversations",{...t,method:"GET"}).then(r=>new St(r))}},St=class{constructor(t){this.response=t}async result(){return this.response.json()}};var E=class{constructor(t){this._transport=t}async send({id:t,request:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...r,method:"GET"}).then(s=>new Ot(s))}},Ot=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as te}from"zod";var w=class e{constructor(t){this._transport=t}static SCHEMA=te.object({hasEnded:te.boolean()});async send({id:t,body:r,request:s={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(r))}).then(n=>new Et(n))}},Et=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as nt}from"zod";var v=class e{constructor(t){this._transport=t}static SCHEMA=nt.object({title:nt.string(),description:nt.string().optional(),account:nt.string()});async send({body:t,request:r={}}){return this._transport.send("v1/labels",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(t))}).then(s=>new wt(s))}},wt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var F=class{constructor(t){this._transport=t}async send({id:t,request:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...r,method:"DELETE"}).then(s=>new vt(s))}},vt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var I=class{constructor(t){this._transport=t}async send({id:t,request:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...r,method:"GET"}).then(s=>new Ft(s))}},Ft=class{constructor(t){this.response=t}async result(){return this.response.json()}};var q=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/labels",{...t,method:"GET"}).then(r=>new It(r))}},It=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as qt}from"zod";var U=class e{constructor(t){this._transport=t}static SCHEMA=qt.object({title:qt.string().optional(),description:qt.string().optional()});async send({id:t,body:r,request:s={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(r))}).then(n=>new Ut(n))}},Ut=class{constructor(t){this.response=t}async result(){return this.response.json()}};var j=class{constructor(t){this._transport=t}async send({id:t,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...r,method:"GET"}).then(s=>new jt(s))}},jt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var H=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/messages",{...t,method:"GET"}).then(r=>new Ht(r))}},Ht=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as ot}from"zod";var L=class e{constructor(t){this._transport=t}static SCHEMA=ot.object({input:ot.string().max(65536),original:ot.string().max(65536),correction:ot.string().max(65536)});async send({id:t,body:r,request:s={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(r))}).then(n=>new Lt(n))}},Lt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var M=class{constructor(t){this._transport=t}async send({id:t,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...r,method:"GET"}).then(s=>new Mt(s))}},Mt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var N=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"}).then(r=>new Nt(r))}},Nt=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as it}from"zod";var G=class e{constructor(t){this._transport=t}static SCHEMA=it.array(it.object({role:it.enum(["user","assistant"]),content:it.string().max(65536).nullable()})).min(1);async send({id:t,body:r,request:s={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(r))}).then(n=>new Gt(n))}},Gt=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as ee}from"zod";var z=class e{constructor(t){this._transport=t}static SCHEMA=ee.object({content:ee.string()});async send({id:t,body:r,request:s={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(r))}).then(n=>new zt(n))}},zt=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as re}from"zod";var B=class e{constructor(t){this._transport=t}static SCHEMA=re.object({content:re.string()});async send({id:t,body:r,request:s={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(r))}).then(n=>new Bt(n))}},Bt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var D=class{constructor(t){this._transport=t}async send({id:t,request:r={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...r,method:"GET"}).then(s=>new Dt(s))}},Dt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var J=class{constructor(t){this._transport=t}async send({id:t,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...r,method:"GET"}).then(s=>new Jt(s))}},Jt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var V=class{constructor(t){this._transport=t}async send({id:t,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...r,method:"GET"}).then(s=>new Vt(s))}},Vt=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as se}from"zod";var k=class e{constructor(t){this._transport=t}static SCHEMA=se.object({content:se.string().optional()});async send({id:t,body:r,request:s={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(r))}).then(n=>new kt(n))}},kt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var K=class e{constructor(t=e.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Qt;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var Y=class{constructor(t){this._transport=t}async send({id:t,request:r={}}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...r,method:"GET"}).then(s=>new Kt(s))}},Kt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var $=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/sources",{...t,method:"GET"}).then(r=>new Yt(r))}},Yt=class{constructor(t){this.response=t}async result(){return this.response.json()}};import ae from"is-network-error";import pe from"ky";var o=class extends Error{};var i=class extends o{};var W=class extends i{static unauthenticated(){return new this("An unauthenticated request occurred")}};var X=class extends i{static forbidden(){return new this("A forbidden request occurred")}};var a=class extends o{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,r){return new this(`Forbidden method for request: ${t} ${r}`)}};var Q=class extends o{};var Z=class extends o{static badRequest(){return new this("Bad request")}};var tt=class{options;constructor({baseURL:t,...r}){this.options={...r,baseURL:t}}getURL(t){return new URL(t,this.options.baseURL).toString()}getRequest(t,r){r.headers=new Headers(r.headers);for(let s of this.options.requestFilterables){let n=s.getHeaders();for(let[ne,oe]of Object.entries(n))r.headers.set(ne,oe)}return new Request(this.getURL(t),r)}async send(t,r){return await pe(this.getRequest(t,r)).then(s=>{if(!s.ok){let n=s.status;switch(console.error(JSON.stringify(s)),n){case 400:throw Z.badRequest();case 401:throw W.unauthenticated();case 403:throw X.forbidden();case 404:throw a.notFound(t);case 405:throw a.forbiddenMethod(t,r.method??"GET")}}return s}).catch(s=>{throw ae(s)?new Q("A network error occurred",{cause:s}):s})}};var $t=class e{static DEFAULT_BASE_URL=Xt;_transport;constructor(t,{baseURL:r,...s}={}){this._transport=new tt({requestFilterables:[new K,t],...s,baseURL:r?.toString()??e.getBaseURL()})}static getBaseURL(){return process.env[Zt]??this.DEFAULT_BASE_URL}get action(){return{list:new p(this._transport)}}get boilerplate(){return{get:new d(this._transport),list:new u(this._transport),update:new g(this._transport)}}get boilerplateCategory(){return{get:new h(this._transport),list:new y(this._transport),create:new m(this._transport),update:new b(this._transport),boilerplate:{list:new l(this._transport),create:new c(this._transport)}}}get channel(){return{list:new f(this._transport)}}get contact(){return{get:new C(this._transport),list:new T(this._transport),update:new P(this._transport),create:new A(this._transport),vcf:{get:new R(this._transport)},note:{list:new J(this._transport),create:new z(this._transport)}}}get conversation(){return{get:new S(this._transport),list:new O(this._transport),update:new w(this._transport),message:{list:new j(this._transport)},note:{list:new V(this._transport),create:new B(this._transport)}}}get label(){return{create:new v(this._transport),get:new I(this._transport),list:new q(this._transport),update:new U(this._transport),delete:new F(this._transport),contact:{list:new _(this._transport)},conversation:{list:new E(this._transport)}}}get message(){return{list:new H(this._transport)}}get model(){return{get:new M(this._transport),list:new N(this._transport),response:{create:new G(this._transport)},correction:{create:new L(this._transport)}}}get note(){return{get:new D(this._transport),update:new k(this._transport)}}get source(){return{get:new Y(this._transport),list:new $(this._transport)}}};var Wt=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};export{ce as a,Xt as b,le as c,Ee as d,we as e,ve as f,o as g,i as h,W as i,X as j,a as k,Q as l,Z as m,$t as n,Wt as o};
|
package/dist/cli/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Te=Object.create;var ot=Object.defineProperty;var Pe=Object.getOwnPropertyDescriptor;var _e=Object.getOwnPropertyNames;var Se=Object.getPrototypeOf,ve=Object.prototype.hasOwnProperty;var Ee=(e,t)=>{for(var s in t)ot(e,s,{get:t[s],enumerable:!0})},ue=(e,t,s,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of _e(t))!ve.call(e,n)&&n!==s&&ot(e,n,{get:()=>t[n],enumerable:!(r=Pe(t,n))||r.enumerable});return e};var me=(e,t,s)=>(s=e!=null?Te(Se(e)):{},ue(t||!e||!e.__esModule?ot(s,"default",{value:e,enumerable:!0}):s,e)),Fe=e=>ue(ot({},"__esModule",{value:!0}),e);var qe={};Ee(qe,{default:()=>je});module.exports=Fe(qe);var Ae=require("commander");var d=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var l=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/actions",{...t,method:"GET"}).then(s=>new mt(s))}},mt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var u=require("zod"),m=class e{constructor(t){this._transport=t}static SCHEMA=u.z.object({title:u.z.string(),content:u.z.string(),account:u.z.string()});async send({body:t,request:s={}}){return this._transport.send("v1/boilerplates",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(t))}).then(r=>new gt(r))}},gt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var g=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...s,method:"GET"}).then(r=>new ht(r))}},ht=class{constructor(t){this.response=t}async result(){return this.response.json()}};var h=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/boilerplates",{...t,method:"GET"}).then(s=>new ft(s))}},ft=class{constructor(t){this.response=t}async result(){return this.response.json()}};var it=require("zod"),f=class e{constructor(t){this._transport=t}static SCHEMA=it.z.object({title:it.z.string().optional(),content:it.z.string().optional()});async send({id:t,body:s,request:r={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))}).then(n=>new yt(n))}},yt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var y=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"}).then(s=>new bt(s))}},bt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var ge="SUPPORT_BASE_URL";var he="https://api.support.greatdetail.com",fe={"X-Powered-By":"GDSupport/JavaScript"};var b=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:s={}}){let r=s.variant??"vcard",n=s.format??(s.variant==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(r)+"&format="+encodeURIComponent(n)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}};var p=require("zod"),x=class e{constructor(t){this._transport=t}static SCHEMA=p.z.object({name:p.z.string(),account:p.z.string(),emailAddress:p.z.string().email().optional(),telephoneNumber:p.z.string().optional()});async send({body:t,request:s={}}){return this._transport.send("v1/contacts",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(t))}).then(r=>new xt(r))}},xt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var C=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...s,method:"GET"}).then(r=>new Ct(r))}},Ct=class{constructor(t){this.response=t}async result(){return this.response.json()}};var R=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/contacts",{...t,method:"GET"}).then(s=>new Rt(s))}},Rt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var A=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...s,method:"GET"}).then(r=>new At(r))}},At=class{constructor(t){this.response=t}async result(){return this.response.json()}};var w=require("zod"),O=class e{constructor(t){this._transport=t}static SCHEMA=w.z.object({name:w.z.string().optional(),emailAddress:w.z.string().email().optional(),telephoneNumber:w.z.string().optional()});async send({id:t,body:s,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))}).then(n=>new wt(n))}},wt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var T=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...s,method:"GET"}).then(r=>new Ot(r))}},Ot=class{constructor(t){this.response=t}async result(){return this.response.json()}};var P=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/conversations",{...t,method:"GET"}).then(s=>new Tt(s))}},Tt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var _=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...s,method:"GET"}).then(r=>new Pt(r))}},Pt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var _t=require("zod"),S=class e{constructor(t){this._transport=t}static SCHEMA=_t.z.object({hasEnded:_t.z.boolean()});async send({id:t,body:s,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))}).then(n=>new St(n))}},St=class{constructor(t){this.response=t}async result(){return this.response.json()}};var v=require("zod"),E=class e{constructor(t){this._transport=t}static SCHEMA=v.z.object({title:v.z.string(),description:v.z.string().optional(),account:v.z.string()});async send({body:t,request:s={}}){return this._transport.send("v1/labels",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(t))}).then(r=>new vt(r))}},vt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var F=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...s,method:"DELETE"}).then(r=>new Et(r))}},Et=class{constructor(t){this.response=t}async result(){return this.response.json()}};var I=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...s,method:"GET"}).then(r=>new Ft(r))}},Ft=class{constructor(t){this.response=t}async result(){return this.response.json()}};var j=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/labels",{...t,method:"GET"}).then(s=>new It(s))}},It=class{constructor(t){this.response=t}async result(){return this.response.json()}};var at=require("zod"),q=class e{constructor(t){this._transport=t}static SCHEMA=at.z.object({title:at.z.string().optional(),description:at.z.string().optional()});async send({id:t,body:s,request:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))}).then(n=>new jt(n))}},jt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var U=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...s,method:"GET"}).then(r=>new qt(r))}},qt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var L=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/messages",{...t,method:"GET"}).then(s=>new Ut(s))}},Ut=class{constructor(t){this.response=t}async result(){return this.response.json()}};var H=require("zod"),M=class e{constructor(t){this._transport=t}static SCHEMA=H.z.object({input:H.z.string().max(65536),original:H.z.string().max(65536),correction:H.z.string().max(65536)});async send({id:t,body:s,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))}).then(n=>new Lt(n))}},Lt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var N=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...s,method:"GET"}).then(r=>new Ht(r))}},Ht=class{constructor(t){this.response=t}async result(){return this.response.json()}};var D=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"}).then(s=>new Mt(s))}},Mt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var G=require("zod"),z=class e{constructor(t){this._transport=t}static SCHEMA=G.z.array(G.z.object({role:G.z.enum(["user","assistant"]),content:G.z.string().max(65536).nullable()})).min(1);async send({id:t,body:s,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))}).then(n=>new Nt(n))}},Nt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var Dt=require("zod"),B=class e{constructor(t){this._transport=t}static SCHEMA=Dt.z.object({content:Dt.z.string()});async send({id:t,body:s,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))}).then(n=>new Gt(n))}},Gt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var zt=require("zod"),J=class e{constructor(t){this._transport=t}static SCHEMA=zt.z.object({content:zt.z.string()});async send({id:t,body:s,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))}).then(n=>new Bt(n))}},Bt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var V=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...s,method:"GET"}).then(r=>new Jt(r))}},Jt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var k=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...s,method:"GET"}).then(r=>new Vt(r))}},Vt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var K=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...s,method:"GET"}).then(r=>new kt(r))}},kt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var Kt=require("zod"),Y=class e{constructor(t){this._transport=t}static SCHEMA=Kt.z.object({content:Kt.z.string().optional()});async send({id:t,body:s,request:r={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))}).then(n=>new Yt(n))}},Yt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var $=class e{constructor(t=e.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=fe;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var W=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...s,method:"GET"}).then(r=>new $t(r))}},$t=class{constructor(t){this.response=t}async result(){return this.response.json()}};var X=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/sources",{...t,method:"GET"}).then(s=>new Wt(s))}},Wt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var ye=me(require("is-network-error"),1),be=me(require("ky"),1);var o=class extends Error{};var a=class extends o{};var Q=class extends a{static unauthenticated(){return new this("An unauthenticated request occurred")}};var Z=class extends a{static forbidden(){return new this("A forbidden request occurred")}};var c=class extends o{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,s){return new this(`Forbidden method for request: ${t} ${s}`)}};var tt=class extends o{};var et=class extends o{static badRequest(){return new this("Bad request")}};var st=class{options;constructor({baseURL:t,...s}){this.options={...s,baseURL:t}}getURL(t){return new URL(t,this.options.baseURL).toString()}getRequest(t,s){s.headers=new Headers(s.headers);for(let r of this.options.requestFilterables){let n=r.getHeaders();for(let[we,Oe]of Object.entries(n))s.headers.set(we,Oe)}return new Request(this.getURL(t),s)}async send(t,s){return await(0,be.default)(this.getRequest(t,s)).then(r=>{if(!r.ok){let n=r.status;switch(console.error(JSON.stringify(r)),n){case 400:throw et.badRequest();case 401:throw Q.unauthenticated();case 403:throw Z.forbidden();case 404:throw c.notFound(t);case 405:throw c.forbiddenMethod(t,s.method??"GET")}}return r}).catch(r=>{throw(0,ye.default)(r)?new tt("A network error occurred",{cause:r}):r})}};var rt=class e{static DEFAULT_BASE_URL=he;_transport;constructor(t,{baseURL:s,...r}={}){this._transport=new st({requestFilterables:[new $,t],...r,baseURL:s?.toString()??e.getBaseURL()})}static getBaseURL(){return process.env[ge]??this.DEFAULT_BASE_URL}get action(){return{list:new l(this._transport)}}get boilerplate(){return{get:new g(this._transport),list:new h(this._transport),create:new m(this._transport),update:new f(this._transport)}}get channel(){return{list:new y(this._transport)}}get contact(){return{get:new C(this._transport),list:new R(this._transport),update:new O(this._transport),create:new x(this._transport),vcf:{get:new b(this._transport)},note:{list:new k(this._transport),create:new B(this._transport)}}}get conversation(){return{get:new T(this._transport),list:new P(this._transport),update:new S(this._transport),message:{list:new U(this._transport)},note:{list:new K(this._transport),create:new J(this._transport)}}}get label(){return{create:new E(this._transport),get:new I(this._transport),list:new j(this._transport),update:new q(this._transport),delete:new F(this._transport),contact:{list:new A(this._transport)},conversation:{list:new _(this._transport)}}}get message(){return{list:new L(this._transport)}}get model(){return{get:new N(this._transport),list:new D(this._transport),response:{create:new z(this._transport)},correction:{create:new M(this._transport)}}}get note(){return{get:new V(this._transport),update:new Y(this._transport)}}get source(){return{get:new W(this._transport),list:new X(this._transport)}}};var Xt=require("commander"),xe=require("ora");function Qt({client:e,ora:t}){let s=new Xt.Command("actions").description("Actions");return s.addCommand(new Xt.Command("list").description("List actions").action(async()=>{let r=await(0,xe.oraPromise)(()=>e.action.list.send(),{...t,text:"Finding actions"});console.log(await r.result())})),s}var Zt=require("commander"),Ce=require("ora");function te({client:e,ora:t}){let s=new Zt.Command("channels").description("Channels");return s.addCommand(new Zt.Command("list").description("List channels").action(async()=>{let r=await(0,Ce.oraPromise)(()=>e.channel.list.send(),{...t,text:"Finding channels"});console.log(await r.result())})),s}var pt=require("commander"),ee=require("ora");function se({client:e,ora:t}){let s=new pt.Command("contacts").description("Contacts");return s.addCommand(new pt.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async r=>{let n=await(0,ee.oraPromise)(()=>e.contact.get.send({id:r}),{...t,text:"Finding contact"});console.log(await n.result())})),s.addCommand(new pt.Command("list").description("List contacts").action(async()=>{let r=await(0,ee.oraPromise)(()=>e.contact.list.send(),{...t,text:"Finding contacts"});console.log(await r.result())})),s}var ct=require("commander"),re=require("ora");function ne({client:e,ora:t}){let s=new ct.Command("conversations").description("Conversations");return s.addCommand(new ct.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async r=>{let n=await(0,re.oraPromise)(()=>e.conversation.get.send({id:r}),{...t,text:"Finding conversation"});console.log(await n.result())})),s.addCommand(new ct.Command("list").description("List conversations").action(async()=>{let r=await(0,re.oraPromise)(()=>e.conversation.list.send(),{...t,text:"Finding conversations"});console.log(await r.result())})),s}var nt=require("commander"),dt=require("ora");function oe({client:e,ora:t}){let s=new nt.Command("labels").description("Labels");return s.addCommand(new nt.Command("get").description("Find label").argument("<label>","Label ID").action(async r=>{let n=await(0,dt.oraPromise)(()=>e.label.get.send({id:r}),{...t,text:"Finding label"});console.log(await n.result())})),s.addCommand(new nt.Command("list").description("List labels").action(async()=>{let r=await(0,dt.oraPromise)(()=>e.label.list.send(),{...t,text:"Finding labels"});console.log(await r.result())})),s.addCommand(new nt.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async r=>{let n=await(0,dt.oraPromise)(()=>e.label.conversation.list.send({id:r}),{...t,text:"Finding conversations"});console.log(await n.result())})),s}var ie=require("commander"),Re=require("ora");function ae({client:e,ora:t}){let s=new ie.Command("messages").description("Messages");return s.addCommand(new ie.Command("list").description("List messages").action(async()=>{let r=await(0,Re.oraPromise)(()=>e.message.list.send(),{...t,text:"Finding messages"});console.log(await r.result())})),s}var lt=require("commander"),pe=require("ora");function ce({client:e,ora:t}){let s=new lt.Command("models").description("Models");return s.addCommand(new lt.Command("get").description("Find model").argument("<model>","Model ID").action(async r=>{let n=await(0,pe.oraPromise)(()=>e.model.get.send({id:r}),{...t,text:"Finding model"});console.log(await n.result())})),s.addCommand(new lt.Command("list").description("List models").action(async()=>{let r=await(0,pe.oraPromise)(()=>e.model.list.send(),{...t,text:"Finding models"});console.log(await r.result())})),s}var ut=require("commander"),de=require("ora");function le({client:e,ora:t}){let s=new ut.Command("sources").description("Sources");return s.addCommand(new ut.Command("get").description("Find source").argument("<source>","Source ID").action(async r=>{let n=await(0,de.oraPromise)(()=>e.source.get.send({id:r}),{...t,text:"Finding source"});console.log(await n.result())})),s.addCommand(new ut.Command("list").description("List sources").action(async()=>{let r=await(0,de.oraPromise)(()=>e.source.list.send(),{...t,text:"Finding sources"});console.log(await r.result())})),s}var i={ora:{spinner:"simpleDotsScrolling"},client:new rt(new d)},Ie=new Ae.Command("gds").description("Great Detail Support System").addCommand(Qt(i)).addCommand(te(i)).addCommand(se(i)).addCommand(ne(i)).addCommand(oe(i)).addCommand(ae(i)).addCommand(ce(i)).addCommand(le(i)),je=Ie;
|
|
1
|
+
"use strict";var He=Object.create;var lt=Object.defineProperty;var Me=Object.getOwnPropertyDescriptor;var Ne=Object.getOwnPropertyNames;var Ge=Object.getPrototypeOf,De=Object.prototype.hasOwnProperty;var ze=(e,t)=>{for(var s in t)lt(e,s,{get:t[s],enumerable:!0})},we=(e,t,s,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Ne(t))!De.call(e,n)&&n!==s&<(e,n,{get:()=>t[n],enumerable:!(r=Me(t,n))||r.enumerable});return e};var Te=(e,t,s)=>(s=e!=null?He(Ge(e)):{},we(t||!e||!e.__esModule?lt(s,"default",{value:e,enumerable:!0}):s,e)),Be=e=>we(lt({},"__esModule",{value:!0}),e);var ke={};ze(ke,{default:()=>Ve});module.exports=Be(ke);var qe=require("commander");var d=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var l=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/actions",{...t,method:"GET"}).then(s=>new Ct(s))}},Ct=class{constructor(t){this.response=t}async result(){return this.response.json()}};var u=require("zod"),m=class e{constructor(t){this._transport=t}static SCHEMA=u.z.object({title:u.z.string(),content:u.z.string(),account:u.z.string()});async send({id:t,body:s,request:r={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))}).then(n=>new Rt(n))}},Rt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var g=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...s,method:"GET"}).then(r=>new At(r))}},At=class{constructor(t){this.response=t}async result(){return this.response.json()}};var h=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...s,method:"GET"}).then(r=>new Ot(r))}},Ot=class{constructor(t){this.response=t}async result(){return this.response.json()}};var f=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/boilerplates",{...t,method:"GET"}).then(s=>new wt(s))}},wt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var ut=require("zod"),y=class e{constructor(t){this._transport=t}static SCHEMA=ut.z.object({title:ut.z.string().optional(),content:ut.z.string().optional()});async send({id:t,body:s,request:r={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))}).then(n=>new Tt(n))}},Tt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var b=require("zod"),x=class e{constructor(t){this._transport=t}static SCHEMA=b.z.object({title:b.z.string(),description:b.z.string().optional(),account:b.z.string()});async send({body:t,request:s={}}){return this._transport.send("v1/boilerplate-categories",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(t))}).then(r=>new Pt(r))}},Pt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var C=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...s,method:"GET"}).then(r=>new _t(r))}},_t=class{constructor(t){this.response=t}async result(){return this.response.json()}};var R=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/boilerplate-categories",{...t,method:"GET"}).then(s=>new St(s))}},St=class{constructor(t){this.response=t}async result(){return this.response.json()}};var mt=require("zod"),A=class e{constructor(t){this._transport=t}static SCHEMA=mt.z.object({title:mt.z.string().optional(),description:mt.z.string().optional()});async send({id:t,body:s,request:r={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))}).then(n=>new vt(n))}},vt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var O=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"}).then(s=>new Et(s))}},Et=class{constructor(t){this.response=t}async result(){return this.response.json()}};var Pe="SUPPORT_BASE_URL";var _e="https://api.support.greatdetail.com",Se={"X-Powered-By":"GDSupport/JavaScript"};var w=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:s={}}){let r=s.variant??"vcard",n=s.format??(s.variant==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(r)+"&format="+encodeURIComponent(n)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}};var p=require("zod"),T=class e{constructor(t){this._transport=t}static SCHEMA=p.z.object({name:p.z.string(),account:p.z.string(),emailAddress:p.z.string().email().optional(),telephoneNumber:p.z.string().optional()});async send({body:t,request:s={}}){return this._transport.send("v1/contacts",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(t))}).then(r=>new Ft(r))}},Ft=class{constructor(t){this.response=t}async result(){return this.response.json()}};var P=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...s,method:"GET"}).then(r=>new It(r))}},It=class{constructor(t){this.response=t}async result(){return this.response.json()}};var _=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/contacts",{...t,method:"GET"}).then(s=>new jt(s))}},jt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var S=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...s,method:"GET"}).then(r=>new qt(r))}},qt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var v=require("zod"),E=class e{constructor(t){this._transport=t}static SCHEMA=v.z.object({name:v.z.string().optional(),emailAddress:v.z.string().email().optional(),telephoneNumber:v.z.string().optional()});async send({id:t,body:s,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))}).then(n=>new Ut(n))}},Ut=class{constructor(t){this.response=t}async result(){return this.response.json()}};var F=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...s,method:"GET"}).then(r=>new Lt(r))}},Lt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var I=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/conversations",{...t,method:"GET"}).then(s=>new Ht(s))}},Ht=class{constructor(t){this.response=t}async result(){return this.response.json()}};var j=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...s,method:"GET"}).then(r=>new Mt(r))}},Mt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var Nt=require("zod"),q=class e{constructor(t){this._transport=t}static SCHEMA=Nt.z.object({hasEnded:Nt.z.boolean()});async send({id:t,body:s,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))}).then(n=>new Gt(n))}},Gt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var U=require("zod"),L=class e{constructor(t){this._transport=t}static SCHEMA=U.z.object({title:U.z.string(),description:U.z.string().optional(),account:U.z.string()});async send({body:t,request:s={}}){return this._transport.send("v1/labels",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(t))}).then(r=>new Dt(r))}},Dt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var H=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...s,method:"DELETE"}).then(r=>new zt(r))}},zt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var M=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...s,method:"GET"}).then(r=>new Bt(r))}},Bt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var N=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/labels",{...t,method:"GET"}).then(s=>new Jt(s))}},Jt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var gt=require("zod"),G=class e{constructor(t){this._transport=t}static SCHEMA=gt.z.object({title:gt.z.string().optional(),description:gt.z.string().optional()});async send({id:t,body:s,request:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))}).then(n=>new Vt(n))}},Vt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var D=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...s,method:"GET"}).then(r=>new kt(r))}},kt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var z=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/messages",{...t,method:"GET"}).then(s=>new Kt(s))}},Kt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var B=require("zod"),J=class e{constructor(t){this._transport=t}static SCHEMA=B.z.object({input:B.z.string().max(65536),original:B.z.string().max(65536),correction:B.z.string().max(65536)});async send({id:t,body:s,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))}).then(n=>new Yt(n))}},Yt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var V=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...s,method:"GET"}).then(r=>new $t(r))}},$t=class{constructor(t){this.response=t}async result(){return this.response.json()}};var k=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"}).then(s=>new Wt(s))}},Wt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var K=require("zod"),Y=class e{constructor(t){this._transport=t}static SCHEMA=K.z.array(K.z.object({role:K.z.enum(["user","assistant"]),content:K.z.string().max(65536).nullable()})).min(1);async send({id:t,body:s,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))}).then(n=>new Xt(n))}},Xt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var Qt=require("zod"),$=class e{constructor(t){this._transport=t}static SCHEMA=Qt.z.object({content:Qt.z.string()});async send({id:t,body:s,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))}).then(n=>new Zt(n))}},Zt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var te=require("zod"),W=class e{constructor(t){this._transport=t}static SCHEMA=te.z.object({content:te.z.string()});async send({id:t,body:s,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))}).then(n=>new ee(n))}},ee=class{constructor(t){this.response=t}async result(){return this.response.json()}};var X=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...s,method:"GET"}).then(r=>new se(r))}},se=class{constructor(t){this.response=t}async result(){return this.response.json()}};var Q=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...s,method:"GET"}).then(r=>new re(r))}},re=class{constructor(t){this.response=t}async result(){return this.response.json()}};var Z=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...s,method:"GET"}).then(r=>new ne(r))}},ne=class{constructor(t){this.response=t}async result(){return this.response.json()}};var oe=require("zod"),tt=class e{constructor(t){this._transport=t}static SCHEMA=oe.z.object({content:oe.z.string().optional()});async send({id:t,body:s,request:r={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))}).then(n=>new ie(n))}},ie=class{constructor(t){this.response=t}async result(){return this.response.json()}};var et=class e{constructor(t=e.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Se;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var st=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...s,method:"GET"}).then(r=>new ae(r))}},ae=class{constructor(t){this.response=t}async result(){return this.response.json()}};var rt=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/sources",{...t,method:"GET"}).then(s=>new pe(s))}},pe=class{constructor(t){this.response=t}async result(){return this.response.json()}};var ve=Te(require("is-network-error"),1),Ee=Te(require("ky"),1);var o=class extends Error{};var a=class extends o{};var nt=class extends a{static unauthenticated(){return new this("An unauthenticated request occurred")}};var ot=class extends a{static forbidden(){return new this("A forbidden request occurred")}};var c=class extends o{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,s){return new this(`Forbidden method for request: ${t} ${s}`)}};var it=class extends o{};var at=class extends o{static badRequest(){return new this("Bad request")}};var pt=class{options;constructor({baseURL:t,...s}){this.options={...s,baseURL:t}}getURL(t){return new URL(t,this.options.baseURL).toString()}getRequest(t,s){s.headers=new Headers(s.headers);for(let r of this.options.requestFilterables){let n=r.getHeaders();for(let[Ue,Le]of Object.entries(n))s.headers.set(Ue,Le)}return new Request(this.getURL(t),s)}async send(t,s){return await(0,Ee.default)(this.getRequest(t,s)).then(r=>{if(!r.ok){let n=r.status;switch(console.error(JSON.stringify(r)),n){case 400:throw at.badRequest();case 401:throw nt.unauthenticated();case 403:throw ot.forbidden();case 404:throw c.notFound(t);case 405:throw c.forbiddenMethod(t,s.method??"GET")}}return r}).catch(r=>{throw(0,ve.default)(r)?new it("A network error occurred",{cause:r}):r})}};var ct=class e{static DEFAULT_BASE_URL=_e;_transport;constructor(t,{baseURL:s,...r}={}){this._transport=new pt({requestFilterables:[new et,t],...r,baseURL:s?.toString()??e.getBaseURL()})}static getBaseURL(){return process.env[Pe]??this.DEFAULT_BASE_URL}get action(){return{list:new l(this._transport)}}get boilerplate(){return{get:new g(this._transport),list:new f(this._transport),update:new y(this._transport)}}get boilerplateCategory(){return{get:new C(this._transport),list:new R(this._transport),create:new x(this._transport),update:new A(this._transport),boilerplate:{list:new h(this._transport),create:new m(this._transport)}}}get channel(){return{list:new O(this._transport)}}get contact(){return{get:new P(this._transport),list:new _(this._transport),update:new E(this._transport),create:new T(this._transport),vcf:{get:new w(this._transport)},note:{list:new Q(this._transport),create:new $(this._transport)}}}get conversation(){return{get:new F(this._transport),list:new I(this._transport),update:new q(this._transport),message:{list:new D(this._transport)},note:{list:new Z(this._transport),create:new W(this._transport)}}}get label(){return{create:new L(this._transport),get:new M(this._transport),list:new N(this._transport),update:new G(this._transport),delete:new H(this._transport),contact:{list:new S(this._transport)},conversation:{list:new j(this._transport)}}}get message(){return{list:new z(this._transport)}}get model(){return{get:new V(this._transport),list:new k(this._transport),response:{create:new Y(this._transport)},correction:{create:new J(this._transport)}}}get note(){return{get:new X(this._transport),update:new tt(this._transport)}}get source(){return{get:new st(this._transport),list:new rt(this._transport)}}};var ce=require("commander"),Fe=require("ora");function de({client:e,ora:t}){let s=new ce.Command("actions").description("Actions");return s.addCommand(new ce.Command("list").description("List actions").action(async()=>{let r=await(0,Fe.oraPromise)(()=>e.action.list.send(),{...t,text:"Finding actions"});console.log(await r.result())})),s}var le=require("commander"),Ie=require("ora");function ue({client:e,ora:t}){let s=new le.Command("channels").description("Channels");return s.addCommand(new le.Command("list").description("List channels").action(async()=>{let r=await(0,Ie.oraPromise)(()=>e.channel.list.send(),{...t,text:"Finding channels"});console.log(await r.result())})),s}var ht=require("commander"),me=require("ora");function ge({client:e,ora:t}){let s=new ht.Command("contacts").description("Contacts");return s.addCommand(new ht.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async r=>{let n=await(0,me.oraPromise)(()=>e.contact.get.send({id:r}),{...t,text:"Finding contact"});console.log(await n.result())})),s.addCommand(new ht.Command("list").description("List contacts").action(async()=>{let r=await(0,me.oraPromise)(()=>e.contact.list.send(),{...t,text:"Finding contacts"});console.log(await r.result())})),s}var ft=require("commander"),he=require("ora");function fe({client:e,ora:t}){let s=new ft.Command("conversations").description("Conversations");return s.addCommand(new ft.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async r=>{let n=await(0,he.oraPromise)(()=>e.conversation.get.send({id:r}),{...t,text:"Finding conversation"});console.log(await n.result())})),s.addCommand(new ft.Command("list").description("List conversations").action(async()=>{let r=await(0,he.oraPromise)(()=>e.conversation.list.send(),{...t,text:"Finding conversations"});console.log(await r.result())})),s}var dt=require("commander"),yt=require("ora");function ye({client:e,ora:t}){let s=new dt.Command("labels").description("Labels");return s.addCommand(new dt.Command("get").description("Find label").argument("<label>","Label ID").action(async r=>{let n=await(0,yt.oraPromise)(()=>e.label.get.send({id:r}),{...t,text:"Finding label"});console.log(await n.result())})),s.addCommand(new dt.Command("list").description("List labels").action(async()=>{let r=await(0,yt.oraPromise)(()=>e.label.list.send(),{...t,text:"Finding labels"});console.log(await r.result())})),s.addCommand(new dt.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async r=>{let n=await(0,yt.oraPromise)(()=>e.label.conversation.list.send({id:r}),{...t,text:"Finding conversations"});console.log(await n.result())})),s}var be=require("commander"),je=require("ora");function xe({client:e,ora:t}){let s=new be.Command("messages").description("Messages");return s.addCommand(new be.Command("list").description("List messages").action(async()=>{let r=await(0,je.oraPromise)(()=>e.message.list.send(),{...t,text:"Finding messages"});console.log(await r.result())})),s}var bt=require("commander"),Ce=require("ora");function Re({client:e,ora:t}){let s=new bt.Command("models").description("Models");return s.addCommand(new bt.Command("get").description("Find model").argument("<model>","Model ID").action(async r=>{let n=await(0,Ce.oraPromise)(()=>e.model.get.send({id:r}),{...t,text:"Finding model"});console.log(await n.result())})),s.addCommand(new bt.Command("list").description("List models").action(async()=>{let r=await(0,Ce.oraPromise)(()=>e.model.list.send(),{...t,text:"Finding models"});console.log(await r.result())})),s}var xt=require("commander"),Ae=require("ora");function Oe({client:e,ora:t}){let s=new xt.Command("sources").description("Sources");return s.addCommand(new xt.Command("get").description("Find source").argument("<source>","Source ID").action(async r=>{let n=await(0,Ae.oraPromise)(()=>e.source.get.send({id:r}),{...t,text:"Finding source"});console.log(await n.result())})),s.addCommand(new xt.Command("list").description("List sources").action(async()=>{let r=await(0,Ae.oraPromise)(()=>e.source.list.send(),{...t,text:"Finding sources"});console.log(await r.result())})),s}var i={ora:{spinner:"simpleDotsScrolling"},client:new ct(new d)},Je=new qe.Command("gds").description("Great Detail Support System").addCommand(de(i)).addCommand(ue(i)).addCommand(ge(i)).addCommand(fe(i)).addCommand(ye(i)).addCommand(xe(i)).addCommand(Re(i)).addCommand(Oe(i)),Ve=Je;
|
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-MIIHAFPV.js";import"../chunk-O5KZWMF7.js";export{a as default};
|
package/dist/cli.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var Te=Object.create;var le=Object.defineProperty;var Pe=Object.getOwnPropertyDescriptor;var _e=Object.getOwnPropertyNames;var ve=Object.getPrototypeOf,Se=Object.prototype.hasOwnProperty;var Ee=(e,t,s,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of _e(t))!Se.call(e,n)&&n!==s&&le(e,n,{get:()=>t[n],enumerable:!(r=Pe(t,n))||r.enumerable});return e};var ue=(e,t,s)=>(s=e!=null?Te(ve(e)):{},Ee(t||!e||!e.__esModule?le(s,"default",{value:e,enumerable:!0}):s,e));var Re=require("commander");var d=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var l=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/actions",{...t,method:"GET"}).then(s=>new ut(s))}},ut=class{constructor(t){this.response=t}async result(){return this.response.json()}};var u=require("zod"),m=class e{constructor(t){this._transport=t}static SCHEMA=u.z.object({title:u.z.string(),content:u.z.string(),account:u.z.string()});async send({body:t,request:s={}}){return this._transport.send("v1/boilerplates",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(t))}).then(r=>new mt(r))}},mt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var g=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...s,method:"GET"}).then(r=>new gt(r))}},gt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var h=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/boilerplates",{...t,method:"GET"}).then(s=>new ht(s))}},ht=class{constructor(t){this.response=t}async result(){return this.response.json()}};var ot=require("zod"),f=class e{constructor(t){this._transport=t}static SCHEMA=ot.z.object({title:ot.z.string().optional(),content:ot.z.string().optional()});async send({id:t,body:s,request:r={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))}).then(n=>new ft(n))}},ft=class{constructor(t){this.response=t}async result(){return this.response.json()}};var y=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"}).then(s=>new yt(s))}},yt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var me="SUPPORT_BASE_URL";var ge="https://api.support.greatdetail.com",he={"X-Powered-By":"GDSupport/JavaScript"};var b=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:s={}}){let r=s.variant??"vcard",n=s.format??(s.variant==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(r)+"&format="+encodeURIComponent(n)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}};var p=require("zod"),x=class e{constructor(t){this._transport=t}static SCHEMA=p.z.object({name:p.z.string(),account:p.z.string(),emailAddress:p.z.string().email().optional(),telephoneNumber:p.z.string().optional()});async send({body:t,request:s={}}){return this._transport.send("v1/contacts",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(t))}).then(r=>new bt(r))}},bt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var C=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...s,method:"GET"}).then(r=>new xt(r))}},xt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var R=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/contacts",{...t,method:"GET"}).then(s=>new Ct(s))}},Ct=class{constructor(t){this.response=t}async result(){return this.response.json()}};var A=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...s,method:"GET"}).then(r=>new Rt(r))}},Rt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var w=require("zod"),O=class e{constructor(t){this._transport=t}static SCHEMA=w.z.object({name:w.z.string().optional(),emailAddress:w.z.string().email().optional(),telephoneNumber:w.z.string().optional()});async send({id:t,body:s,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))}).then(n=>new At(n))}},At=class{constructor(t){this.response=t}async result(){return this.response.json()}};var T=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...s,method:"GET"}).then(r=>new wt(r))}},wt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var P=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/conversations",{...t,method:"GET"}).then(s=>new Ot(s))}},Ot=class{constructor(t){this.response=t}async result(){return this.response.json()}};var _=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...s,method:"GET"}).then(r=>new Tt(r))}},Tt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var Pt=require("zod"),v=class e{constructor(t){this._transport=t}static SCHEMA=Pt.z.object({hasEnded:Pt.z.boolean()});async send({id:t,body:s,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))}).then(n=>new _t(n))}},_t=class{constructor(t){this.response=t}async result(){return this.response.json()}};var S=require("zod"),E=class e{constructor(t){this._transport=t}static SCHEMA=S.z.object({title:S.z.string(),description:S.z.string().optional(),account:S.z.string()});async send({body:t,request:s={}}){return this._transport.send("v1/labels",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(t))}).then(r=>new vt(r))}},vt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var F=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...s,method:"DELETE"}).then(r=>new St(r))}},St=class{constructor(t){this.response=t}async result(){return this.response.json()}};var I=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...s,method:"GET"}).then(r=>new Et(r))}},Et=class{constructor(t){this.response=t}async result(){return this.response.json()}};var j=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/labels",{...t,method:"GET"}).then(s=>new Ft(s))}},Ft=class{constructor(t){this.response=t}async result(){return this.response.json()}};var it=require("zod"),q=class e{constructor(t){this._transport=t}static SCHEMA=it.z.object({title:it.z.string().optional(),description:it.z.string().optional()});async send({id:t,body:s,request:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))}).then(n=>new It(n))}},It=class{constructor(t){this.response=t}async result(){return this.response.json()}};var U=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...s,method:"GET"}).then(r=>new jt(r))}},jt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var L=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/messages",{...t,method:"GET"}).then(s=>new qt(s))}},qt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var H=require("zod"),M=class e{constructor(t){this._transport=t}static SCHEMA=H.z.object({input:H.z.string().max(65536),original:H.z.string().max(65536),correction:H.z.string().max(65536)});async send({id:t,body:s,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))}).then(n=>new Ut(n))}},Ut=class{constructor(t){this.response=t}async result(){return this.response.json()}};var N=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...s,method:"GET"}).then(r=>new Lt(r))}},Lt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var D=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"}).then(s=>new Ht(s))}},Ht=class{constructor(t){this.response=t}async result(){return this.response.json()}};var G=require("zod"),z=class e{constructor(t){this._transport=t}static SCHEMA=G.z.array(G.z.object({role:G.z.enum(["user","assistant"]),content:G.z.string().max(65536).nullable()})).min(1);async send({id:t,body:s,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))}).then(n=>new Mt(n))}},Mt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var Nt=require("zod"),B=class e{constructor(t){this._transport=t}static SCHEMA=Nt.z.object({content:Nt.z.string()});async send({id:t,body:s,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))}).then(n=>new Dt(n))}},Dt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var Gt=require("zod"),J=class e{constructor(t){this._transport=t}static SCHEMA=Gt.z.object({content:Gt.z.string()});async send({id:t,body:s,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))}).then(n=>new zt(n))}},zt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var V=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...s,method:"GET"}).then(r=>new Bt(r))}},Bt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var k=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...s,method:"GET"}).then(r=>new Jt(r))}},Jt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var K=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...s,method:"GET"}).then(r=>new Vt(r))}},Vt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var kt=require("zod"),Y=class e{constructor(t){this._transport=t}static SCHEMA=kt.z.object({content:kt.z.string().optional()});async send({id:t,body:s,request:r={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))}).then(n=>new Kt(n))}},Kt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var $=class e{constructor(t=e.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=he;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var W=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...s,method:"GET"}).then(r=>new Yt(r))}},Yt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var X=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/sources",{...t,method:"GET"}).then(s=>new $t(s))}},$t=class{constructor(t){this.response=t}async result(){return this.response.json()}};var fe=ue(require("is-network-error"),1),ye=ue(require("ky"),1);var o=class extends Error{};var a=class extends o{};var Q=class extends a{static unauthenticated(){return new this("An unauthenticated request occurred")}};var Z=class extends a{static forbidden(){return new this("A forbidden request occurred")}};var c=class extends o{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,s){return new this(`Forbidden method for request: ${t} ${s}`)}};var tt=class extends o{};var et=class extends o{static badRequest(){return new this("Bad request")}};var st=class{options;constructor({baseURL:t,...s}){this.options={...s,baseURL:t}}getURL(t){return new URL(t,this.options.baseURL).toString()}getRequest(t,s){s.headers=new Headers(s.headers);for(let r of this.options.requestFilterables){let n=r.getHeaders();for(let[we,Oe]of Object.entries(n))s.headers.set(we,Oe)}return new Request(this.getURL(t),s)}async send(t,s){return await(0,ye.default)(this.getRequest(t,s)).then(r=>{if(!r.ok){let n=r.status;switch(console.error(JSON.stringify(r)),n){case 400:throw et.badRequest();case 401:throw Q.unauthenticated();case 403:throw Z.forbidden();case 404:throw c.notFound(t);case 405:throw c.forbiddenMethod(t,s.method??"GET")}}return r}).catch(r=>{throw(0,fe.default)(r)?new tt("A network error occurred",{cause:r}):r})}};var rt=class e{static DEFAULT_BASE_URL=ge;_transport;constructor(t,{baseURL:s,...r}={}){this._transport=new st({requestFilterables:[new $,t],...r,baseURL:s?.toString()??e.getBaseURL()})}static getBaseURL(){return process.env[me]??this.DEFAULT_BASE_URL}get action(){return{list:new l(this._transport)}}get boilerplate(){return{get:new g(this._transport),list:new h(this._transport),create:new m(this._transport),update:new f(this._transport)}}get channel(){return{list:new y(this._transport)}}get contact(){return{get:new C(this._transport),list:new R(this._transport),update:new O(this._transport),create:new x(this._transport),vcf:{get:new b(this._transport)},note:{list:new k(this._transport),create:new B(this._transport)}}}get conversation(){return{get:new T(this._transport),list:new P(this._transport),update:new v(this._transport),message:{list:new U(this._transport)},note:{list:new K(this._transport),create:new J(this._transport)}}}get label(){return{create:new E(this._transport),get:new I(this._transport),list:new j(this._transport),update:new q(this._transport),delete:new F(this._transport),contact:{list:new A(this._transport)},conversation:{list:new _(this._transport)}}}get message(){return{list:new L(this._transport)}}get model(){return{get:new N(this._transport),list:new D(this._transport),response:{create:new z(this._transport)},correction:{create:new M(this._transport)}}}get note(){return{get:new V(this._transport),update:new Y(this._transport)}}get source(){return{get:new W(this._transport),list:new X(this._transport)}}};var Wt=require("commander"),be=require("ora");function Xt({client:e,ora:t}){let s=new Wt.Command("actions").description("Actions");return s.addCommand(new Wt.Command("list").description("List actions").action(async()=>{let r=await(0,be.oraPromise)(()=>e.action.list.send(),{...t,text:"Finding actions"});console.log(await r.result())})),s}var Qt=require("commander"),xe=require("ora");function Zt({client:e,ora:t}){let s=new Qt.Command("channels").description("Channels");return s.addCommand(new Qt.Command("list").description("List channels").action(async()=>{let r=await(0,xe.oraPromise)(()=>e.channel.list.send(),{...t,text:"Finding channels"});console.log(await r.result())})),s}var at=require("commander"),te=require("ora");function ee({client:e,ora:t}){let s=new at.Command("contacts").description("Contacts");return s.addCommand(new at.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async r=>{let n=await(0,te.oraPromise)(()=>e.contact.get.send({id:r}),{...t,text:"Finding contact"});console.log(await n.result())})),s.addCommand(new at.Command("list").description("List contacts").action(async()=>{let r=await(0,te.oraPromise)(()=>e.contact.list.send(),{...t,text:"Finding contacts"});console.log(await r.result())})),s}var pt=require("commander"),se=require("ora");function re({client:e,ora:t}){let s=new pt.Command("conversations").description("Conversations");return s.addCommand(new pt.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async r=>{let n=await(0,se.oraPromise)(()=>e.conversation.get.send({id:r}),{...t,text:"Finding conversation"});console.log(await n.result())})),s.addCommand(new pt.Command("list").description("List conversations").action(async()=>{let r=await(0,se.oraPromise)(()=>e.conversation.list.send(),{...t,text:"Finding conversations"});console.log(await r.result())})),s}var nt=require("commander"),ct=require("ora");function ne({client:e,ora:t}){let s=new nt.Command("labels").description("Labels");return s.addCommand(new nt.Command("get").description("Find label").argument("<label>","Label ID").action(async r=>{let n=await(0,ct.oraPromise)(()=>e.label.get.send({id:r}),{...t,text:"Finding label"});console.log(await n.result())})),s.addCommand(new nt.Command("list").description("List labels").action(async()=>{let r=await(0,ct.oraPromise)(()=>e.label.list.send(),{...t,text:"Finding labels"});console.log(await r.result())})),s.addCommand(new nt.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async r=>{let n=await(0,ct.oraPromise)(()=>e.label.conversation.list.send({id:r}),{...t,text:"Finding conversations"});console.log(await n.result())})),s}var oe=require("commander"),Ce=require("ora");function ie({client:e,ora:t}){let s=new oe.Command("messages").description("Messages");return s.addCommand(new oe.Command("list").description("List messages").action(async()=>{let r=await(0,Ce.oraPromise)(()=>e.message.list.send(),{...t,text:"Finding messages"});console.log(await r.result())})),s}var dt=require("commander"),ae=require("ora");function pe({client:e,ora:t}){let s=new dt.Command("models").description("Models");return s.addCommand(new dt.Command("get").description("Find model").argument("<model>","Model ID").action(async r=>{let n=await(0,ae.oraPromise)(()=>e.model.get.send({id:r}),{...t,text:"Finding model"});console.log(await n.result())})),s.addCommand(new dt.Command("list").description("List models").action(async()=>{let r=await(0,ae.oraPromise)(()=>e.model.list.send(),{...t,text:"Finding models"});console.log(await r.result())})),s}var lt=require("commander"),ce=require("ora");function de({client:e,ora:t}){let s=new lt.Command("sources").description("Sources");return s.addCommand(new lt.Command("get").description("Find source").argument("<source>","Source ID").action(async r=>{let n=await(0,ce.oraPromise)(()=>e.source.get.send({id:r}),{...t,text:"Finding source"});console.log(await n.result())})),s.addCommand(new lt.Command("list").description("List sources").action(async()=>{let r=await(0,ce.oraPromise)(()=>e.source.list.send(),{...t,text:"Finding sources"});console.log(await r.result())})),s}var i={ora:{spinner:"simpleDotsScrolling"},client:new rt(new d)},Fe=new Re.Command("gds").description("Great Detail Support System").addCommand(Xt(i)).addCommand(Zt(i)).addCommand(ee(i)).addCommand(re(i)).addCommand(ne(i)).addCommand(ie(i)).addCommand(pe(i)).addCommand(de(i)),Ae=Fe;Ae.parseAsync(process.argv);
|
|
2
|
+
"use strict";var He=Object.create;var Oe=Object.defineProperty;var Me=Object.getOwnPropertyDescriptor;var Ne=Object.getOwnPropertyNames;var Ge=Object.getPrototypeOf,De=Object.prototype.hasOwnProperty;var ze=(e,t,s,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Ne(t))!De.call(e,n)&&n!==s&&Oe(e,n,{get:()=>t[n],enumerable:!(r=Me(t,n))||r.enumerable});return e};var we=(e,t,s)=>(s=e!=null?He(Ge(e)):{},ze(t||!e||!e.__esModule?Oe(s,"default",{value:e,enumerable:!0}):s,e));var je=require("commander");var d=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};var l=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/actions",{...t,method:"GET"}).then(s=>new xt(s))}},xt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var u=require("zod"),m=class e{constructor(t){this._transport=t}static SCHEMA=u.z.object({title:u.z.string(),content:u.z.string(),account:u.z.string()});async send({id:t,body:s,request:r={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))}).then(n=>new Ct(n))}},Ct=class{constructor(t){this.response=t}async result(){return this.response.json()}};var g=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...s,method:"GET"}).then(r=>new Rt(r))}},Rt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var h=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t)+"/boilerplates",{...s,method:"GET"}).then(r=>new At(r))}},At=class{constructor(t){this.response=t}async result(){return this.response.json()}};var f=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/boilerplates",{...t,method:"GET"}).then(s=>new Ot(s))}},Ot=class{constructor(t){this.response=t}async result(){return this.response.json()}};var lt=require("zod"),y=class e{constructor(t){this._transport=t}static SCHEMA=lt.z.object({title:lt.z.string().optional(),content:lt.z.string().optional()});async send({id:t,body:s,request:r={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))}).then(n=>new wt(n))}},wt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var b=require("zod"),x=class e{constructor(t){this._transport=t}static SCHEMA=b.z.object({title:b.z.string(),description:b.z.string().optional(),account:b.z.string()});async send({body:t,request:s={}}){return this._transport.send("v1/boilerplate-categories",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(t))}).then(r=>new Tt(r))}},Tt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var C=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...s,method:"GET"}).then(r=>new Pt(r))}},Pt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var R=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/boilerplate-categories",{...t,method:"GET"}).then(s=>new _t(s))}},_t=class{constructor(t){this.response=t}async result(){return this.response.json()}};var ut=require("zod"),A=class e{constructor(t){this._transport=t}static SCHEMA=ut.z.object({title:ut.z.string().optional(),description:ut.z.string().optional()});async send({id:t,body:s,request:r={}}){return this._transport.send("v1/boilerplate-categories/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))}).then(n=>new St(n))}},St=class{constructor(t){this.response=t}async result(){return this.response.json()}};var O=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"}).then(s=>new vt(s))}},vt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var Te="SUPPORT_BASE_URL";var Pe="https://api.support.greatdetail.com",_e={"X-Powered-By":"GDSupport/JavaScript"};var w=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:s={}}){let r=s.variant??"vcard",n=s.format??(s.variant==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(r)+"&format="+encodeURIComponent(n)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}};var p=require("zod"),T=class e{constructor(t){this._transport=t}static SCHEMA=p.z.object({name:p.z.string(),account:p.z.string(),emailAddress:p.z.string().email().optional(),telephoneNumber:p.z.string().optional()});async send({body:t,request:s={}}){return this._transport.send("v1/contacts",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(t))}).then(r=>new Et(r))}},Et=class{constructor(t){this.response=t}async result(){return this.response.json()}};var P=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...s,method:"GET"}).then(r=>new Ft(r))}},Ft=class{constructor(t){this.response=t}async result(){return this.response.json()}};var _=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/contacts",{...t,method:"GET"}).then(s=>new It(s))}},It=class{constructor(t){this.response=t}async result(){return this.response.json()}};var S=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...s,method:"GET"}).then(r=>new jt(r))}},jt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var v=require("zod"),E=class e{constructor(t){this._transport=t}static SCHEMA=v.z.object({name:v.z.string().optional(),emailAddress:v.z.string().email().optional(),telephoneNumber:v.z.string().optional()});async send({id:t,body:s,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))}).then(n=>new qt(n))}},qt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var F=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...s,method:"GET"}).then(r=>new Ut(r))}},Ut=class{constructor(t){this.response=t}async result(){return this.response.json()}};var I=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/conversations",{...t,method:"GET"}).then(s=>new Lt(s))}},Lt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var j=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...s,method:"GET"}).then(r=>new Ht(r))}},Ht=class{constructor(t){this.response=t}async result(){return this.response.json()}};var Mt=require("zod"),q=class e{constructor(t){this._transport=t}static SCHEMA=Mt.z.object({hasEnded:Mt.z.boolean()});async send({id:t,body:s,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))}).then(n=>new Nt(n))}},Nt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var U=require("zod"),L=class e{constructor(t){this._transport=t}static SCHEMA=U.z.object({title:U.z.string(),description:U.z.string().optional(),account:U.z.string()});async send({body:t,request:s={}}){return this._transport.send("v1/labels",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(t))}).then(r=>new Gt(r))}},Gt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var H=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...s,method:"DELETE"}).then(r=>new Dt(r))}},Dt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var M=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...s,method:"GET"}).then(r=>new zt(r))}},zt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var N=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/labels",{...t,method:"GET"}).then(s=>new Bt(s))}},Bt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var mt=require("zod"),G=class e{constructor(t){this._transport=t}static SCHEMA=mt.z.object({title:mt.z.string().optional(),description:mt.z.string().optional()});async send({id:t,body:s,request:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))}).then(n=>new Jt(n))}},Jt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var D=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...s,method:"GET"}).then(r=>new Vt(r))}},Vt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var z=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/messages",{...t,method:"GET"}).then(s=>new kt(s))}},kt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var B=require("zod"),J=class e{constructor(t){this._transport=t}static SCHEMA=B.z.object({input:B.z.string().max(65536),original:B.z.string().max(65536),correction:B.z.string().max(65536)});async send({id:t,body:s,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))}).then(n=>new Kt(n))}},Kt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var V=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...s,method:"GET"}).then(r=>new Yt(r))}},Yt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var k=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"}).then(s=>new $t(s))}},$t=class{constructor(t){this.response=t}async result(){return this.response.json()}};var K=require("zod"),Y=class e{constructor(t){this._transport=t}static SCHEMA=K.z.array(K.z.object({role:K.z.enum(["user","assistant"]),content:K.z.string().max(65536).nullable()})).min(1);async send({id:t,body:s,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))}).then(n=>new Wt(n))}},Wt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var Xt=require("zod"),$=class e{constructor(t){this._transport=t}static SCHEMA=Xt.z.object({content:Xt.z.string()});async send({id:t,body:s,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))}).then(n=>new Qt(n))}},Qt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var Zt=require("zod"),W=class e{constructor(t){this._transport=t}static SCHEMA=Zt.z.object({content:Zt.z.string()});async send({id:t,body:s,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))}).then(n=>new te(n))}},te=class{constructor(t){this.response=t}async result(){return this.response.json()}};var X=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...s,method:"GET"}).then(r=>new ee(r))}},ee=class{constructor(t){this.response=t}async result(){return this.response.json()}};var Q=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...s,method:"GET"}).then(r=>new se(r))}},se=class{constructor(t){this.response=t}async result(){return this.response.json()}};var Z=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...s,method:"GET"}).then(r=>new re(r))}},re=class{constructor(t){this.response=t}async result(){return this.response.json()}};var ne=require("zod"),tt=class e{constructor(t){this._transport=t}static SCHEMA=ne.z.object({content:ne.z.string().optional()});async send({id:t,body:s,request:r={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))}).then(n=>new oe(n))}},oe=class{constructor(t){this.response=t}async result(){return this.response.json()}};var et=class e{constructor(t=e.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=_e;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var st=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...s,method:"GET"}).then(r=>new ie(r))}},ie=class{constructor(t){this.response=t}async result(){return this.response.json()}};var rt=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/sources",{...t,method:"GET"}).then(s=>new ae(s))}},ae=class{constructor(t){this.response=t}async result(){return this.response.json()}};var Se=we(require("is-network-error"),1),ve=we(require("ky"),1);var o=class extends Error{};var a=class extends o{};var nt=class extends a{static unauthenticated(){return new this("An unauthenticated request occurred")}};var ot=class extends a{static forbidden(){return new this("A forbidden request occurred")}};var c=class extends o{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,s){return new this(`Forbidden method for request: ${t} ${s}`)}};var it=class extends o{};var at=class extends o{static badRequest(){return new this("Bad request")}};var pt=class{options;constructor({baseURL:t,...s}){this.options={...s,baseURL:t}}getURL(t){return new URL(t,this.options.baseURL).toString()}getRequest(t,s){s.headers=new Headers(s.headers);for(let r of this.options.requestFilterables){let n=r.getHeaders();for(let[Ue,Le]of Object.entries(n))s.headers.set(Ue,Le)}return new Request(this.getURL(t),s)}async send(t,s){return await(0,ve.default)(this.getRequest(t,s)).then(r=>{if(!r.ok){let n=r.status;switch(console.error(JSON.stringify(r)),n){case 400:throw at.badRequest();case 401:throw nt.unauthenticated();case 403:throw ot.forbidden();case 404:throw c.notFound(t);case 405:throw c.forbiddenMethod(t,s.method??"GET")}}return r}).catch(r=>{throw(0,Se.default)(r)?new it("A network error occurred",{cause:r}):r})}};var ct=class e{static DEFAULT_BASE_URL=Pe;_transport;constructor(t,{baseURL:s,...r}={}){this._transport=new pt({requestFilterables:[new et,t],...r,baseURL:s?.toString()??e.getBaseURL()})}static getBaseURL(){return process.env[Te]??this.DEFAULT_BASE_URL}get action(){return{list:new l(this._transport)}}get boilerplate(){return{get:new g(this._transport),list:new f(this._transport),update:new y(this._transport)}}get boilerplateCategory(){return{get:new C(this._transport),list:new R(this._transport),create:new x(this._transport),update:new A(this._transport),boilerplate:{list:new h(this._transport),create:new m(this._transport)}}}get channel(){return{list:new O(this._transport)}}get contact(){return{get:new P(this._transport),list:new _(this._transport),update:new E(this._transport),create:new T(this._transport),vcf:{get:new w(this._transport)},note:{list:new Q(this._transport),create:new $(this._transport)}}}get conversation(){return{get:new F(this._transport),list:new I(this._transport),update:new q(this._transport),message:{list:new D(this._transport)},note:{list:new Z(this._transport),create:new W(this._transport)}}}get label(){return{create:new L(this._transport),get:new M(this._transport),list:new N(this._transport),update:new G(this._transport),delete:new H(this._transport),contact:{list:new S(this._transport)},conversation:{list:new j(this._transport)}}}get message(){return{list:new z(this._transport)}}get model(){return{get:new V(this._transport),list:new k(this._transport),response:{create:new Y(this._transport)},correction:{create:new J(this._transport)}}}get note(){return{get:new X(this._transport),update:new tt(this._transport)}}get source(){return{get:new st(this._transport),list:new rt(this._transport)}}};var pe=require("commander"),Ee=require("ora");function ce({client:e,ora:t}){let s=new pe.Command("actions").description("Actions");return s.addCommand(new pe.Command("list").description("List actions").action(async()=>{let r=await(0,Ee.oraPromise)(()=>e.action.list.send(),{...t,text:"Finding actions"});console.log(await r.result())})),s}var de=require("commander"),Fe=require("ora");function le({client:e,ora:t}){let s=new de.Command("channels").description("Channels");return s.addCommand(new de.Command("list").description("List channels").action(async()=>{let r=await(0,Fe.oraPromise)(()=>e.channel.list.send(),{...t,text:"Finding channels"});console.log(await r.result())})),s}var gt=require("commander"),ue=require("ora");function me({client:e,ora:t}){let s=new gt.Command("contacts").description("Contacts");return s.addCommand(new gt.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async r=>{let n=await(0,ue.oraPromise)(()=>e.contact.get.send({id:r}),{...t,text:"Finding contact"});console.log(await n.result())})),s.addCommand(new gt.Command("list").description("List contacts").action(async()=>{let r=await(0,ue.oraPromise)(()=>e.contact.list.send(),{...t,text:"Finding contacts"});console.log(await r.result())})),s}var ht=require("commander"),ge=require("ora");function he({client:e,ora:t}){let s=new ht.Command("conversations").description("Conversations");return s.addCommand(new ht.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async r=>{let n=await(0,ge.oraPromise)(()=>e.conversation.get.send({id:r}),{...t,text:"Finding conversation"});console.log(await n.result())})),s.addCommand(new ht.Command("list").description("List conversations").action(async()=>{let r=await(0,ge.oraPromise)(()=>e.conversation.list.send(),{...t,text:"Finding conversations"});console.log(await r.result())})),s}var dt=require("commander"),ft=require("ora");function fe({client:e,ora:t}){let s=new dt.Command("labels").description("Labels");return s.addCommand(new dt.Command("get").description("Find label").argument("<label>","Label ID").action(async r=>{let n=await(0,ft.oraPromise)(()=>e.label.get.send({id:r}),{...t,text:"Finding label"});console.log(await n.result())})),s.addCommand(new dt.Command("list").description("List labels").action(async()=>{let r=await(0,ft.oraPromise)(()=>e.label.list.send(),{...t,text:"Finding labels"});console.log(await r.result())})),s.addCommand(new dt.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async r=>{let n=await(0,ft.oraPromise)(()=>e.label.conversation.list.send({id:r}),{...t,text:"Finding conversations"});console.log(await n.result())})),s}var ye=require("commander"),Ie=require("ora");function be({client:e,ora:t}){let s=new ye.Command("messages").description("Messages");return s.addCommand(new ye.Command("list").description("List messages").action(async()=>{let r=await(0,Ie.oraPromise)(()=>e.message.list.send(),{...t,text:"Finding messages"});console.log(await r.result())})),s}var yt=require("commander"),xe=require("ora");function Ce({client:e,ora:t}){let s=new yt.Command("models").description("Models");return s.addCommand(new yt.Command("get").description("Find model").argument("<model>","Model ID").action(async r=>{let n=await(0,xe.oraPromise)(()=>e.model.get.send({id:r}),{...t,text:"Finding model"});console.log(await n.result())})),s.addCommand(new yt.Command("list").description("List models").action(async()=>{let r=await(0,xe.oraPromise)(()=>e.model.list.send(),{...t,text:"Finding models"});console.log(await r.result())})),s}var bt=require("commander"),Re=require("ora");function Ae({client:e,ora:t}){let s=new bt.Command("sources").description("Sources");return s.addCommand(new bt.Command("get").description("Find source").argument("<source>","Source ID").action(async r=>{let n=await(0,Re.oraPromise)(()=>e.source.get.send({id:r}),{...t,text:"Finding source"});console.log(await n.result())})),s.addCommand(new bt.Command("list").description("List sources").action(async()=>{let r=await(0,Re.oraPromise)(()=>e.source.list.send(),{...t,text:"Finding sources"});console.log(await r.result())})),s}var i={ora:{spinner:"simpleDotsScrolling"},client:new ct(new d)},Be=new je.Command("gds").description("Great Detail Support System").addCommand(ce(i)).addCommand(le(i)).addCommand(me(i)).addCommand(he(i)).addCommand(fe(i)).addCommand(be(i)).addCommand(Ce(i)).addCommand(Ae(i)),qe=Be;qe.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-MIIHAFPV.js";import"./chunk-O5KZWMF7.js";r.parseAsync(process.argv);
|