@vcityio/cli 0.10.2 → 0.10.3

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.
Files changed (2) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ var di=/\{[^{}]+\}/g,ui=()=>typeof process==="object"&&Number.parseInt(process?.
5
5
  `).filter((v)=>v.startsWith("data:")).map((v)=>v.slice(5).trimStart()).join(`
6
6
  `);if(o=o.slice(p+2),w)yield JSON.parse(w);p=o.indexOf(`
7
7
 
8
- `)}}}async listProposals(t,e){return d(await this.client.GET("/api/v1/orgs/{orgId}/assistant/proposals",{params:{path:{orgId:t},query:e}}),"assistant.listProposals")}async approve(t,e,r={}){return d(await this.client.POST("/api/v1/orgs/{orgId}/assistant/proposals/{proposalId}/approve",{params:{path:{orgId:t,proposalId:e}},body:r}),"assistant.approve")}async reject(t,e){return d(await this.client.POST("/api/v1/orgs/{orgId}/assistant/proposals/{proposalId}/reject",{params:{path:{orgId:t,proposalId:e}}}),"assistant.reject")}}class Ae{client;constructor(t){this.client=t}async list(t,e={}){return d(await this.client.GET("/api/v1/orgs/{orgId}/calendar",{params:{path:{orgId:t},query:e}}),"calendar.list")}async ics(t,e){let{data:r,error:n,response:i}=await this.client.GET("/api/v1/orgs/{orgId}/calendar.ics",{params:{path:{orgId:t},query:{token:e}},parseAs:"text"});if(n!==void 0||typeof r!=="string")throw new ct(`calendar.ics failed (${i.status})`,i.status,n,i.url);return r}async createEntry(t,e){return d(await this.client.POST("/api/v1/orgs/{orgId}/calendar/entries",{params:{path:{orgId:t}},body:e}),"calendar.createEntry")}async getEntry(t,e){return d(await this.client.GET("/api/v1/orgs/{orgId}/calendar/entries/{entryId}",{params:{path:{orgId:t,entryId:e}}}),"calendar.getEntry")}async updateEntry(t,e,r){return d(await this.client.PATCH("/api/v1/orgs/{orgId}/calendar/entries/{entryId}",{params:{path:{orgId:t,entryId:e}},body:r}),"calendar.updateEntry")}async cancelEntry(t,e,r={}){return d(await this.client.DELETE("/api/v1/orgs/{orgId}/calendar/entries/{entryId}",{params:{path:{orgId:t,entryId:e},query:r}}),"calendar.cancelEntry")}async settings(t){return d(await this.client.GET("/api/v1/orgs/{orgId}/calendar/settings",{params:{path:{orgId:t}}}),"calendar.settings")}async updateSettings(t,e){return d(await this.client.PATCH("/api/v1/orgs/{orgId}/calendar/settings",{params:{path:{orgId:t}},body:e}),"calendar.updateSettings")}async staff(t){return d(await this.client.GET("/api/v1/orgs/{orgId}/calendar/staff",{params:{path:{orgId:t}}}),"calendar.staff")}async holidays(t,e={}){return d(await this.client.GET("/api/v1/orgs/{orgId}/calendar/holidays",{params:{path:{orgId:t},query:e}}),"calendar.holidays")}async listFeeds(t){return d(await this.client.GET("/api/v1/orgs/{orgId}/calendar/feeds",{params:{path:{orgId:t}}}),"calendar.listFeeds")}async createFeed(t,e){return d(await this.client.POST("/api/v1/orgs/{orgId}/calendar/feeds",{params:{path:{orgId:t}},body:e}),"calendar.createFeed")}async updateFeed(t,e,r){return d(await this.client.PATCH("/api/v1/orgs/{orgId}/calendar/feeds/{feedId}",{params:{path:{orgId:t,feedId:e}},body:r}),"calendar.updateFeed")}async revokeFeed(t,e){return d(await this.client.DELETE("/api/v1/orgs/{orgId}/calendar/feeds/{feedId}",{params:{path:{orgId:t,feedId:e}}}),"calendar.revokeFeed")}async listExternal(t){return d(await this.client.GET("/api/v1/orgs/{orgId}/calendar/external",{params:{path:{orgId:t}}}),"calendar.listExternal")}async addExternal(t,e){return d(await this.client.POST("/api/v1/orgs/{orgId}/calendar/external",{params:{path:{orgId:t}},body:e}),"calendar.addExternal")}async updateExternal(t,e,r){return d(await this.client.PATCH("/api/v1/orgs/{orgId}/calendar/external/{calendarId}",{params:{path:{orgId:t,calendarId:e}},body:r}),"calendar.updateExternal")}async removeExternal(t,e){return d(await this.client.DELETE("/api/v1/orgs/{orgId}/calendar/external/{calendarId}",{params:{path:{orgId:t,calendarId:e}}}),"calendar.removeExternal")}}class Pe{client;constructor(t){this.client=t}async listContacts(t,e={}){return d(await this.client.GET("/api/v1/orgs/{orgId}/crm/contacts",{params:{path:{orgId:t},query:e}}),"crm.listContacts")}async createContact(t,e){return d(await this.client.POST("/api/v1/orgs/{orgId}/crm/contacts",{params:{path:{orgId:t}},body:e}),"crm.createContact")}async getContact(t,e){return d(await this.client.GET("/api/v1/orgs/{orgId}/crm/contacts/{contactId}",{params:{path:{orgId:t,contactId:e}}}),"crm.getContact")}async updateContact(t,e,r){return d(await this.client.PATCH("/api/v1/orgs/{orgId}/crm/contacts/{contactId}",{params:{path:{orgId:t,contactId:e}},body:r}),"crm.updateContact")}async archiveContact(t,e){return d(await this.client.DELETE("/api/v1/orgs/{orgId}/crm/contacts/{contactId}",{params:{path:{orgId:t,contactId:e}}}),"crm.archiveContact")}async restoreContact(t,e){return d(await this.client.POST("/api/v1/orgs/{orgId}/crm/contacts/{contactId}/restore",{params:{path:{orgId:t,contactId:e}}}),"crm.restoreContact")}async setContactTags(t,e,r){return d(await this.client.PUT("/api/v1/orgs/{orgId}/crm/contacts/{contactId}/tags",{params:{path:{orgId:t,contactId:e}},body:r}),"crm.setContactTags")}async contactTimeline(t,e){return d(await this.client.GET("/api/v1/orgs/{orgId}/crm/contacts/{contactId}/timeline",{params:{path:{orgId:t,contactId:e}}}),"crm.contactTimeline")}async contactAudiences(t,e){return d(await this.client.GET("/api/v1/orgs/{orgId}/crm/contacts/{contactId}/audiences",{params:{path:{orgId:t,contactId:e}}}),"crm.contactAudiences")}async addDeal(t,e,r){return d(await this.client.POST("/api/v1/orgs/{orgId}/crm/contacts/{contactId}/deals",{params:{path:{orgId:t,contactId:e}},body:r}),"crm.addDeal")}async listTags(t){return d(await this.client.GET("/api/v1/orgs/{orgId}/crm/tags",{params:{path:{orgId:t}}}),"crm.listTags")}async createTag(t,e){return d(await this.client.POST("/api/v1/orgs/{orgId}/crm/tags",{params:{path:{orgId:t}},body:e}),"crm.createTag")}async listFollowUps(t,e={}){return d(await this.client.GET("/api/v1/orgs/{orgId}/crm/follow-ups",{params:{path:{orgId:t},query:e}}),"crm.listFollowUps")}async listAudiences(t){return d(await this.client.GET("/api/v1/orgs/{orgId}/crm/audiences",{params:{path:{orgId:t}}}),"crm.listAudiences")}async listAudienceContacts(t,e,r={}){return d(await this.client.GET("/api/v1/orgs/{orgId}/crm/audiences/{audienceId}/contacts",{params:{path:{orgId:t,audienceId:e},query:r}}),"crm.listAudienceContacts")}}class $e{client;constructor(t){this.client=t}async list(t,e={}){return d(await this.client.GET("/api/v1/orgs/{orgId}/inbox",{params:{path:{orgId:t},query:e}}),"inbox.list")}async unreadCount(t){return d(await this.client.GET("/api/v1/orgs/{orgId}/inbox/unread-count",{params:{path:{orgId:t}}}),"inbox.unreadCount")}async get(t,e){return d(await this.client.GET("/api/v1/orgs/{orgId}/inbox/{conversationId}",{params:{path:{orgId:t,conversationId:e}}}),"inbox.get")}async update(t,e,r){return d(await this.client.PATCH("/api/v1/orgs/{orgId}/inbox/{conversationId}",{params:{path:{orgId:t,conversationId:e}},body:r}),"inbox.update")}async customer(t,e){return d(await this.client.GET("/api/v1/orgs/{orgId}/inbox/{conversationId}/customer",{params:{path:{orgId:t,conversationId:e}}}),"inbox.customer")}async listMessages(t,e,r={}){return d(await this.client.GET("/api/v1/orgs/{orgId}/inbox/{conversationId}/messages",{params:{path:{orgId:t,conversationId:e},query:r}}),"inbox.listMessages")}async reply(t,e,r){return d(await this.client.POST("/api/v1/orgs/{orgId}/inbox/{conversationId}/messages",{params:{path:{orgId:t,conversationId:e}},body:r}),"inbox.reply")}async editMessage(t,e,r,n){return d(await this.client.PATCH("/api/v1/orgs/{orgId}/inbox/{conversationId}/messages/{messageId}",{params:{path:{orgId:t,conversationId:e,messageId:r}},body:n}),"inbox.editMessage")}async deleteMessage(t,e,r){return d(await this.client.DELETE("/api/v1/orgs/{orgId}/inbox/{conversationId}/messages/{messageId}",{params:{path:{orgId:t,conversationId:e,messageId:r}}}),"inbox.deleteMessage")}async markRead(t,e){let r={orgId:t,conversationId:e};return d(await this.client.POST("/api/v1/orgs/{orgId}/inbox/{conversationId}/read",{params:{path:r}}),"inbox.markRead")}async search(t,e,r){let n={orgId:t,conversationId:e};return d(await this.client.GET("/api/v1/orgs/{orgId}/inbox/{conversationId}/search",{params:{path:n,query:{q:r}}}),"inbox.search")}async startCall(t,e){let r={orgId:t,conversationId:e};return d(await this.client.POST("/api/v1/orgs/{orgId}/inbox/{conversationId}/calls",{params:{path:r}}),"inbox.startCall")}async createPoll(t,e,r){return d(await this.client.POST("/api/v1/orgs/{orgId}/inbox/{conversationId}/polls",{params:{path:{orgId:t,conversationId:e}},body:r}),"inbox.createPoll")}async votePoll(t,e,r,n){return d(await this.client.POST("/api/v1/orgs/{orgId}/inbox/{conversationId}/polls/{messageId}",{params:{path:{orgId:t,conversationId:e,messageId:r}},body:n}),"inbox.votePoll")}async share(t,e,r){return d(await this.client.POST("/api/v1/orgs/{orgId}/inbox/{conversationId}/shares",{params:{path:{orgId:t,conversationId:e}},body:r}),"inbox.share")}async startUpload(t,e,r){return d(await this.client.POST("/api/v1/orgs/{orgId}/inbox/{conversationId}/uploads",{params:{path:{orgId:t,conversationId:e}},body:r}),"inbox.startUpload")}async completeUpload(t,e,r){return d(await this.client.POST("/api/v1/orgs/{orgId}/inbox/{conversationId}/uploads/{fileId}",{params:{path:{orgId:t,conversationId:e,fileId:r}}}),"inbox.completeUpload")}async shareables(t,e){return d(await this.client.GET("/api/v1/orgs/{orgId}/chat/shareables",{params:{path:{orgId:t},query:e}}),"inbox.shareables")}}class De{client;constructor(t){this.client=t}async list(t){return d(await this.client.GET("/api/v1/orgs/{orgId}/quick-replies",{params:{path:{orgId:t}}}),"quickReplies.list")}async create(t,e){return d(await this.client.POST("/api/v1/orgs/{orgId}/quick-replies",{params:{path:{orgId:t}},body:e}),"quickReplies.create")}async update(t,e,r){return d(await this.client.PATCH("/api/v1/orgs/{orgId}/quick-replies/{quickReplyId}",{params:{path:{orgId:t,quickReplyId:e}},body:r}),"quickReplies.update")}async delete(t,e){return d(await this.client.DELETE("/api/v1/orgs/{orgId}/quick-replies/{quickReplyId}",{params:{path:{orgId:t,quickReplyId:e}}}),"quickReplies.delete")}}class Ne{client;constructor(t){this.client=t}async listRooms(t){return d(await this.client.GET("/api/v1/orgs/{orgId}/team-chat",{params:{path:{orgId:t}}}),"teamChat.listRooms")}async createChannel(t,e){return d(await this.client.POST("/api/v1/orgs/{orgId}/team-chat/channels",{params:{path:{orgId:t}},body:e}),"teamChat.createChannel")}async updateChannel(t,e,r){return d(await this.client.PATCH("/api/v1/orgs/{orgId}/team-chat/channels/{channelId}",{params:{path:{orgId:t,channelId:e}},body:r}),"teamChat.updateChannel")}async deleteChannel(t,e){return d(await this.client.DELETE("/api/v1/orgs/{orgId}/team-chat/channels/{channelId}",{params:{path:{orgId:t,channelId:e}}}),"teamChat.deleteChannel")}async openDm(t,e){return d(await this.client.POST("/api/v1/orgs/{orgId}/team-chat/dms",{params:{path:{orgId:t}},body:e}),"teamChat.openDm")}async members(t){return d(await this.client.GET("/api/v1/orgs/{orgId}/team-chat/members",{params:{path:{orgId:t}}}),"teamChat.members")}async search(t,e){return d(await this.client.GET("/api/v1/orgs/{orgId}/team-chat/search",{params:{path:{orgId:t},query:e}}),"teamChat.search")}async listMessages(t,e,r={}){return d(await this.client.GET("/api/v1/orgs/{orgId}/team-chat/rooms/{roomId}/messages",{params:{path:{orgId:t,roomId:e},query:r}}),"teamChat.listMessages")}async send(t,e,r){return d(await this.client.POST("/api/v1/orgs/{orgId}/team-chat/rooms/{roomId}/messages",{params:{path:{orgId:t,roomId:e}},body:r}),"teamChat.send")}async editMessage(t,e,r,n){let i={orgId:t,roomId:e,messageId:r};return d(await this.client.PATCH("/api/v1/orgs/{orgId}/team-chat/rooms/{roomId}/messages/{messageId}",{params:{path:i},body:n}),"teamChat.editMessage")}async deleteMessage(t,e,r){let n={orgId:t,roomId:e,messageId:r};return d(await this.client.DELETE("/api/v1/orgs/{orgId}/team-chat/rooms/{roomId}/messages/{messageId}",{params:{path:n}}),"teamChat.deleteMessage")}async react(t,e,r,n){let i={orgId:t,roomId:e,messageId:r};return d(await this.client.PUT("/api/v1/orgs/{orgId}/team-chat/rooms/{roomId}/messages/{messageId}/reactions",{params:{path:i},body:{emoji:n}}),"teamChat.react")}async unreact(t,e,r,n){let i={orgId:t,roomId:e,messageId:r};return d(await this.client.DELETE("/api/v1/orgs/{orgId}/team-chat/rooms/{roomId}/messages/{messageId}/reactions",{params:{path:i,query:{emoji:n}}}),"teamChat.unreact")}async thread(t,e,r){let n={orgId:t,roomId:e,messageId:r};return d(await this.client.GET("/api/v1/orgs/{orgId}/team-chat/rooms/{roomId}/messages/{messageId}/thread",{params:{path:n}}),"teamChat.thread")}async createPoll(t,e,r){return d(await this.client.POST("/api/v1/orgs/{orgId}/team-chat/rooms/{roomId}/polls",{params:{path:{orgId:t,roomId:e}},body:r}),"teamChat.createPoll")}async votePoll(t,e,r,n){let i={orgId:t,roomId:e,messageId:r};return d(await this.client.POST("/api/v1/orgs/{orgId}/team-chat/rooms/{roomId}/polls/{messageId}",{params:{path:i},body:n}),"teamChat.votePoll")}async markRead(t,e){let r={orgId:t,roomId:e};return d(await this.client.POST("/api/v1/orgs/{orgId}/team-chat/rooms/{roomId}/read",{params:{path:r}}),"teamChat.markRead")}async typing(t,e){let r={orgId:t,roomId:e};return d(await this.client.POST("/api/v1/orgs/{orgId}/team-chat/rooms/{roomId}/typing",{params:{path:r}}),"teamChat.typing")}async startCall(t,e){let r={orgId:t,roomId:e};return d(await this.client.POST("/api/v1/orgs/{orgId}/team-chat/rooms/{roomId}/calls",{params:{path:r}}),"teamChat.startCall")}async share(t,e,r){return d(await this.client.POST("/api/v1/orgs/{orgId}/team-chat/rooms/{roomId}/shares",{params:{path:{orgId:t,roomId:e}},body:r}),"teamChat.share")}async startUpload(t,e,r){return d(await this.client.POST("/api/v1/orgs/{orgId}/team-chat/rooms/{roomId}/uploads",{params:{path:{orgId:t,roomId:e}},body:r}),"teamChat.startUpload")}async completeUpload(t,e,r){return d(await this.client.POST("/api/v1/orgs/{orgId}/team-chat/rooms/{roomId}/uploads/{fileId}",{params:{path:{orgId:t,roomId:e,fileId:r}}}),"teamChat.completeUpload")}async realtimeToken(t){return d(await this.client.POST("/api/v1/chat/realtime-token",{body:t}),"teamChat.realtimeToken")}}class Fe{client;constructor(t){this.client=t}async listNotes(t){return d(await this.client.GET("/api/v1/orgs/{orgId}/vault/notes",{params:{path:{orgId:t}}}),"vault.listNotes")}async createNote(t,e){return d(await this.client.POST("/api/v1/orgs/{orgId}/vault/notes",{params:{path:{orgId:t}},body:e}),"vault.createNote")}async getNote(t,e){return d(await this.client.GET("/api/v1/orgs/{orgId}/vault/notes/{noteId}",{params:{path:{orgId:t,noteId:e}}}),"vault.getNote")}async saveNote(t,e,r){return d(await this.client.PATCH("/api/v1/orgs/{orgId}/vault/notes/{noteId}",{params:{path:{orgId:t,noteId:e}},body:r}),"vault.saveNote")}async deleteNote(t,e){return d(await this.client.DELETE("/api/v1/orgs/{orgId}/vault/notes/{noteId}",{params:{path:{orgId:t,noteId:e}}}),"vault.deleteNote")}async moveNote(t,e,r){return d(await this.client.POST("/api/v1/orgs/{orgId}/vault/notes/{noteId}/move",{params:{path:{orgId:t,noteId:e}},body:r}),"vault.moveNote")}async search(t,e){return d(await this.client.GET("/api/v1/orgs/{orgId}/vault/search",{params:{path:{orgId:t},query:e}}),"vault.search")}async graph(t){return d(await this.client.GET("/api/v1/orgs/{orgId}/vault/graph",{params:{path:{orgId:t}}}),"vault.graph")}async changes(t,e){return d(await this.client.GET("/api/v1/me/vault-changes",{params:{query:{org:t,since:e}}}),"vault.changes")}}class Ue{client;constructor(t){this.client=t}async list(t,e={}){return d(await this.client.GET("/api/v1/orgs/{orgId}/webhooks",{params:{path:{orgId:t},query:e}}),"webhooks.list")}async create(t,e){return d(await this.client.POST("/api/v1/orgs/{orgId}/webhooks",{params:{path:{orgId:t}},body:e}),"webhooks.create")}async get(t,e){return d(await this.client.GET("/api/v1/orgs/{orgId}/webhooks/{webhookId}",{params:{path:{orgId:t,webhookId:e}}}),"webhooks.get")}async update(t,e,r){return d(await this.client.PUT("/api/v1/orgs/{orgId}/webhooks/{webhookId}",{params:{path:{orgId:t,webhookId:e}},body:r}),"webhooks.update")}async delete(t,e){return d(await this.client.DELETE("/api/v1/orgs/{orgId}/webhooks/{webhookId}",{params:{path:{orgId:t,webhookId:e}}}),"webhooks.delete")}async deliveries(t,e,r={}){return d(await this.client.GET("/api/v1/orgs/{orgId}/webhooks/{webhookId}/deliveries",{params:{path:{orgId:t,webhookId:e},query:r}}),"webhooks.deliveries")}async rotateSecret(t,e){return d(await this.client.POST("/api/v1/orgs/{orgId}/webhooks/{webhookId}/rotate",{params:{path:{orgId:t,webhookId:e}}}),"webhooks.rotateSecret")}async test(t,e){return d(await this.client.POST("/api/v1/orgs/{orgId}/webhooks/{webhookId}/test",{params:{path:{orgId:t,webhookId:e}}}),"webhooks.test")}}var fi="https://vcity.io";function yi(t){let e;try{e=new URL(t)}catch{throw Error(`@vcityio/api-client: invalid baseUrl (${t.slice(0,200)})`)}if(e.protocol==="https:")return;if(e.protocol==="http:"&&(e.hostname==="localhost"||e.hostname==="127.0.0.1"||e.hostname==="[::1]"))return;throw Error(`@vcityio/api-client: baseUrl must use https:// for non-localhost hosts (got: ${e.protocol}//${e.hostname}).`)}function hi(t,e){let r=e??globalThis.fetch;if(!r)throw Error("@vcityio/api-client: no fetch implementation found. Provide options.fetch or run on Node >=20 / a browser.");return async function(i){if(!t)return r(i);let s=i.headers.get("Authorization")?.match(/^Bearer\s+(.+)$/)?.[1]?.trim();if(s&&s!=="undefined"&&s!=="null")return r(i);let o=new Headers(i.headers);o.set("Authorization",`Bearer ${t}`);let c=new Request(i,{headers:o});return r(c)}}class ar{raw;me;orgs;drafts;coupons;media;products;events;rooms;support;agents;conversations;customerAgent;posts;collections;bookings;bookingTypes;projects;blogs;orders;analytics;apiKeys;quotes;crm;webhooks;inbox;quickReplies;teamChat;calendar;vault;assistant;notifications;desk;campaigns;comments;newsletter;surveys;configurators;pos;dropshipping;storefront;public;chatRooms;billing;constructor(t={}){let e=t.baseUrl??fi;yi(e);let r=hi(t.token,t.fetch),n={baseUrl:e,fetch:r,headers:t.headers};this.raw=ir(n),this.me=new Xt(this.raw),this.orgs=new Zt(this.raw),this.drafts=new zt(this.raw),this.coupons=new Kt(this.raw),this.media=new Wt(this.raw),this.products=new te(this.raw),this.events=new ee(this.raw),this.rooms=new re(this.raw),this.support=new he(this.raw),this.agents=new ge(this.raw),this.conversations=new le(this.raw),this.customerAgent=new pe(this.raw),this.posts=new me(this.raw),this.collections=new ue(this.raw),this.bookings=new se(this.raw),this.bookingTypes=new ie(this.raw),this.projects=new ne(this.raw),this.blogs=new oe(this.raw),this.orders=new ae(this.raw),this.analytics=new de(this.raw),this.apiKeys=new we(this.raw),this.quotes=new ce(this.raw),this.crm=new Pe(this.raw),this.webhooks=new Ue(this.raw),this.inbox=new $e(this.raw),this.quickReplies=new De(this.raw),this.teamChat=new Ne(this.raw),this.calendar=new Ae(this.raw),this.vault=new Fe(this.raw),this.assistant=new xe(this.raw),this.notifications=new fe(this.raw),this.desk=new ye(this.raw),this.campaigns=new ve(this.raw),this.comments=new be(this.raw),this.newsletter=new ke(this.raw),this.surveys=new Ie(this.raw),this.configurators=new Ce(this.raw),this.pos=new Se(this.raw),this.dropshipping=new Oe(this.raw),this.storefront=new je(this.raw),this.public=new Te(this.raw),this.chatRooms=new Re(this.raw),this.billing=new Ee(this.raw)}}function cr(t={}){return new ar(t)}import lt from"node:fs";import ki from"node:os";import Be from"node:path";var wi=/\x1b(?:\[[0-?]*[ -/]*[@-~]|\][^\x07\x1b]*(?:\x07|\x1b\\)|[P_^X][^\x07\x1b]*(?:\x07|\x1b\\)|[^[\]P_^X])/g,vi=/[\x00-\x08\x0b-\x1f\x7f-\x9f]/g,bi=/[\u061c\u200e\u200f\u202a-\u202e\u2066-\u2069]/g;function T(t){return t.replace(wi,"").replace(vi,"").replace(bi,"")}function Dr(t){let e;try{e=new URL(t)}catch{throw Error(`Refusing to open malformed URL: ${T(t).slice(0,100)}`)}if(e.protocol==="https:")return e;if(e.protocol==="http:"&&(e.hostname==="localhost"||e.hostname==="127.0.0.1"||e.hostname==="[::1]"))return e;throw Error(`Refusing to open URL with unsafe protocol: ${e.protocol}`)}var $r=512;function O(t,e){let r=t.trim();if(!r)throw Error(`${e} must not be empty.`);if(r.length>$r)throw Error(`${e} must be at most ${$r} characters.`);if(/[\x00-\x1f\x7f]/.test(r))throw Error(`${e} must not contain control characters.`);return r}function St(t){let e;try{e=new URL(t)}catch{throw Error(`Invalid api base URL: ${t.slice(0,200)}`)}if(e.protocol==="https:")return e;if(e.protocol==="http:"&&(e.hostname==="localhost"||e.hostname==="127.0.0.1"||e.hostname==="[::1]"))return e;throw Error(`api base URL must use https:// (got: ${e.protocol}//${e.hostname}).`)}function gt(){if(process.env.VCITY_CONFIG_DIR)return Be.resolve(process.env.VCITY_CONFIG_DIR);return Be.join(ki.homedir(),".vcity")}function Me(){return Be.join(gt(),"auth.json")}function dr(){return Be.join(gt(),"config.json")}function Le(){let t=process.env.VCITY_API_BASE_URL||"https://vcity.io";return St(t),t}import dt from"node:fs";function Ot(t,e,r=384){if(process.platform==="win32"){dt.writeFileSync(t,e,{mode:r});try{dt.chmodSync(t,r)}catch{}return}let n=dt.constants.O_WRONLY|dt.constants.O_CREAT|dt.constants.O_TRUNC|dt.constants.O_NOFOLLOW,i=dt.openSync(t,n,r);try{dt.writeSync(i,e),dt.fchmodSync(i,r)}finally{dt.closeSync(i)}}function Ii(){let t=gt();lt.mkdirSync(t,{recursive:!0,mode:448});try{lt.chmodSync(t,448)}catch{}if(process.platform!=="win32"){let e;try{e=lt.statSync(t)}catch{return}if((e.mode&63)!==0)throw Error(`Refusing to write CLI credentials: ${t} is group- or world-accessible (mode ${(e.mode&511).toString(8)}). Tighten its permissions (\`chmod 700 ${t}\`) or set VCITY_CONFIG_DIR to a directory you own.`)}}function ji(t){if(!t||typeof t!=="object")return!1;let e=t;return typeof e.api_base_url==="string"&&typeof e.access_token==="string"&&typeof e.refresh_token==="string"&&typeof e.access_expires_at==="number"&&typeof e.refresh_expires_at==="number"&&!!e.user&&typeof e.user==="object"}function xt(){let t=Me();if(!lt.existsSync(t))return;try{let e=JSON.parse(lt.readFileSync(t,"utf-8"));if(!ji(e))return;if(St(e.api_base_url),new URL(e.api_base_url).origin!==new URL(Le()).origin)return;return e}catch{return}}function Ei(t){let e;try{e=lt.lstatSync(t)}catch{return}if(e.isSymbolicLink()||e.isFile()&&e.nlink>1)lt.rmSync(t,{force:!0})}function qe(t){Ii();let e=Me();Ei(e),Ot(e,JSON.stringify(t,null,2),384)}function $t(){let t=Me();if(lt.existsSync(t))lt.rmSync(t)}function _e(){let t=xt();if(!t)throw Error("Not logged in. Run `vcity login` first.");return t}var ur={name:"@vcityio/cli",version:"0.10.2",type:"module",description:"vcity command-line interface for org owners",main:"./dist/index.js",bin:{vcity:"./dist/index.js"},files:["dist","README.md","LICENSE"],engines:{node:">=20"},publishConfig:{access:"public"},optionalDependencies:{open:"^10.0.0"},keywords:["vcity","cli"],author:"Otherwise SAS",license:"MIT",homepage:"https://vcity.io",bugs:{email:"support@owsas.com"}};var nt=ur.version,Et=ur.name;var gr=60000,Mr=`vcity-cli/${nt} (${process.platform} ${process.arch})`,Nr=2048;class Dt extends Error{status;body;constructor(t,e,r){super(r??`HTTP ${t}`);this.status=t;this.body=e;this.name="ApiError"}}function Lr(t,e,r){if(e.startsWith("//")||/^[a-z][a-z0-9+.-]*:/i.test(e))throw Error(`Refusing to build URL with non-relative path: ${e.slice(0,100)}`);let n=new URL(t),i=new URL(e.startsWith("/")?e:`/${e}`,t);if(i.origin!==n.origin)throw Error(`Refusing to build URL outside base origin: ${i.origin}`);if(r){for(let[a,s]of Object.entries(r))if(s!==void 0&&s!==null&&!Number.isNaN(s))i.searchParams.set(a,String(s))}return i.toString()}var Fr=(t,e)=>typeof t==="string"&&t.length>0&&t.length<=e,Ge=Symbol("transient"),Ur=(t)=>typeof t==="number"&&Number.isFinite(t);async function Ri(t){try{let e=await fetch(Lr(t.api_base_url,"/api/cli/auth/refresh"),{method:"POST",headers:{"content-type":"application/json",authorization:`Bearer ${t.refresh_token}`},body:JSON.stringify({refresh_token:t.refresh_token}),signal:AbortSignal.timeout(gr),redirect:"error"});if(e.status===429||e.status>=500)return Ge;if(!e.ok)return;let r=await e.json();if(!Fr(r.access_token,Nr)||!Fr(r.refresh_token,Nr)||!Ur(r.access_expires_at)||!Ur(r.refresh_expires_at)||r.access_expires_at<=Date.now()||r.refresh_expires_at<=Date.now())return;let n={...t,access_token:r.access_token,refresh_token:r.refresh_token,access_expires_at:r.access_expires_at,refresh_expires_at:r.refresh_expires_at};return qe(n),n}catch{return Ge}}async function Br(t){let e=()=>new Dt(401,void 0,"Session expired. Run `vcity login` again."),r=xt();if(r&&r.refresh_token!==t.refresh_token)return r;let n=await Ri(t);if(n&&n!==Ge)return n;let i=xt();if(i&&i.refresh_token!==t.refresh_token)return i;if(n===Ge)throw new Dt(503,void 0,"Could not refresh the session. Check your connection and try again.");throw $t(),e()}async function Nt(t,e={}){let{authed:r=!0,method:n="GET",body:i,query:a,baseUrl:s,headers:o}=e,c=r?_e():void 0,u=s??c?.api_base_url??"https://vcity.io",p={"content-type":"application/json","user-agent":Mr};if(c)p.authorization=`Bearer ${c.access_token}`;if(o)for(let[E,N]of Object.entries(o))p[E]=N;let w=await fetch(Lr(u,t,a),{method:n,headers:p,body:i===void 0?void 0:JSON.stringify(i),signal:AbortSignal.timeout(gr),redirect:"error"}),R=(w.headers.get("content-type")??"").includes("application/json")?await w.json().catch(()=>{return}):await w.text().catch(()=>{return});if(!w.ok){let E=(R&&typeof R==="object"&&"error"in R?String(R.error):void 0)??`Request failed (${w.status})`;throw new Dt(w.status,R,E)}return R}function Ci(t,e){let r=new URL(t).origin;if(r!==e)throw Error(`Refusing to attach Bearer token to cross-origin SDK request: ${r}`)}var Si=3,Oi=60000;function xi(t,e){let r=t.headers.get("retry-after"),n=r!==null&&/^\d+$/.test(r)?Number(r)*1000:r?Date.parse(r)-Date.now():Number.NaN,i=Number.isFinite(n)?n:1000*2**e;return Math.min(Math.max(i,0),Oi)}async function Ai(t){for(let e=0;;e++){let r=await t();if(r.status!==429||e>=Si)return r;await new Promise((n)=>setTimeout(n,xi(r,e)))}}function Pi(){let t=async(e,r,n)=>{Ci(e.url,n);let i=new Headers(e.headers);i.set("authorization",`Bearer ${r}`),i.set("user-agent",Mr);let a=new Request(e,{headers:i,signal:AbortSignal.timeout(gr),redirect:e.redirect==="manual"?"manual":"error"});return globalThis.fetch(a)};return async function(r){let n=_e(),i=new URL(n.api_base_url).origin;if(Date.now()>=n.access_expires_at){if(Date.now()>=n.refresh_expires_at)throw $t(),new Dt(401,void 0,"Session expired. Run `vcity login` again.");n=await Br(n)}let a=await Ai(()=>t(r.clone(),n.access_token,i));if(a.status!==401)return a;return n=await Br(n),t(r,n.access_token,i)}}function l(){let t=_e();return cr({baseUrl:t.api_base_url,fetch:Pi()})}import Tt from"node:fs";import $i from"node:path";var lr=16777216;function Di(t){let e=new Uint8Array(t+1),r=0;while(r<e.length){let n=Tt.readSync(0,e,r,e.length-r,null);if(n===0)break;r+=n}if(r>t)throw Error(`--data: stdin body exceeds the ${t}-byte cap.`);return Buffer.from(e.buffer,e.byteOffset,r).toString("utf-8")}function P(t){if(t===void 0)return;let e;if(t==="-"){if(process.stdin.isTTY)throw Error("--data: reading from stdin (-) but nothing is piped in");try{e=Di(lr)}catch(r){let n=r instanceof Error?r.message:String(r);if(n.startsWith("--data:"))throw r;throw Error(`--data: could not read stdin: ${n}`)}}else if(t.startsWith("@")){let r=t.slice(1);if(r.length===0)throw Error("--data: missing file path after `@`");if(!/\.json$/i.test(r))throw Error(`--data: @file path must point to a .json file (got: ${r})`);let n;try{n=Tt.realpathSync(r)}catch(s){let o=s instanceof Error?s.message:String(s);throw Error(`--data: could not read ${r}: ${o}`)}if(!/\.json$/i.test(n))throw Error(`--data: @file path must point to a .json file (got: ${r} → ${n})`);let i;try{i=Tt.realpathSync(process.cwd())}catch(s){let o=s instanceof Error?s.message:String(s);throw Error(`--data: could not resolve cwd: ${o}`)}if(n!==i&&!n.startsWith(i+$i.sep))throw Error(`--data: @file path must be inside the current working directory (got: ${r}). To send a file from elsewhere, pipe it: cat <file> | vcity ... --data -`);let a;try{a=Tt.openSync(n,"r")}catch(s){let o=s instanceof Error?s.message:String(s);throw Error(`--data: could not read ${r}: ${o}`)}try{let s;try{s=Tt.fstatSync(a)}catch(o){let c=o instanceof Error?o.message:String(o);throw Error(`--data: could not read ${r}: ${c}`)}if(s.nlink>1)throw Error(`--data: @file path must not be a hard link (got: ${r})`);if(s.size>lr)throw Error(`--data: ${r} exceeds the ${lr}-byte body cap (got ${s.size} bytes).`);try{e=Tt.readFileSync(a,"utf-8")}catch(o){let c=o instanceof Error?o.message:String(o);throw Error(`--data: could not read ${r}: ${c}`)}}finally{try{Tt.closeSync(a)}catch{}}}else e=t;try{return JSON.parse(e)}catch{throw Error("--data: invalid JSON")}}import Rt from"node:fs";function Ni(){let t=gt();Rt.mkdirSync(t,{recursive:!0,mode:448});try{Rt.chmodSync(t,448)}catch{}if(process.platform!=="win32"){let e;try{e=Rt.statSync(t)}catch{return}if((e.mode&63)!==0)throw Error(`Refusing to write CLI config: ${t} is group- or world-accessible (mode ${(e.mode&511).toString(8)}). Tighten its permissions (\`chmod 700 ${t}\`) or set VCITY_CONFIG_DIR to a directory you own.`)}}function Fi(t){if(!t||typeof t!=="object"||Array.isArray(t))return!1;let e=t;if(e.active_org!==void 0&&typeof e.active_org!=="string")return!1;if(e.default_format!==void 0&&e.default_format!=="pretty"&&e.default_format!=="json")return!1;return!0}function Ct(){let t=dr();if(!Rt.existsSync(t))return{};try{let e=JSON.parse(Rt.readFileSync(t,"utf-8"));return Fi(e)?e:{}}catch{return{}}}function Ui(t){let e;try{e=Rt.lstatSync(t)}catch{return}if(e.isSymbolicLink()||e.isFile()&&e.nlink>1)Rt.rmSync(t,{force:!0})}function qr(t){Ni();let r={...Ct(),...t},n=dr();return Ui(n),Ot(n,JSON.stringify(r,null,2),384),r}function h(t){if(t)return t;let e=Ct();if(!e.active_org)throw Error("No active org. Run `vcity org use <slug>` or pass --org <slug>.");return e.active_org}function f(t){if(t)return"json";if(!process.stdout.isTTY)return"json";return"pretty"}function g(t){process.stdout.write(`${JSON.stringify(t,null,2)}
8
+ `)}}}async listProposals(t,e){return d(await this.client.GET("/api/v1/orgs/{orgId}/assistant/proposals",{params:{path:{orgId:t},query:e}}),"assistant.listProposals")}async approve(t,e,r={}){return d(await this.client.POST("/api/v1/orgs/{orgId}/assistant/proposals/{proposalId}/approve",{params:{path:{orgId:t,proposalId:e}},body:r}),"assistant.approve")}async reject(t,e){return d(await this.client.POST("/api/v1/orgs/{orgId}/assistant/proposals/{proposalId}/reject",{params:{path:{orgId:t,proposalId:e}}}),"assistant.reject")}}class Ae{client;constructor(t){this.client=t}async list(t,e={}){return d(await this.client.GET("/api/v1/orgs/{orgId}/calendar",{params:{path:{orgId:t},query:e}}),"calendar.list")}async ics(t,e){let{data:r,error:n,response:i}=await this.client.GET("/api/v1/orgs/{orgId}/calendar.ics",{params:{path:{orgId:t},query:{token:e}},parseAs:"text"});if(n!==void 0||typeof r!=="string")throw new ct(`calendar.ics failed (${i.status})`,i.status,n,i.url);return r}async createEntry(t,e){return d(await this.client.POST("/api/v1/orgs/{orgId}/calendar/entries",{params:{path:{orgId:t}},body:e}),"calendar.createEntry")}async getEntry(t,e){return d(await this.client.GET("/api/v1/orgs/{orgId}/calendar/entries/{entryId}",{params:{path:{orgId:t,entryId:e}}}),"calendar.getEntry")}async updateEntry(t,e,r){return d(await this.client.PATCH("/api/v1/orgs/{orgId}/calendar/entries/{entryId}",{params:{path:{orgId:t,entryId:e}},body:r}),"calendar.updateEntry")}async cancelEntry(t,e,r={}){return d(await this.client.DELETE("/api/v1/orgs/{orgId}/calendar/entries/{entryId}",{params:{path:{orgId:t,entryId:e},query:r}}),"calendar.cancelEntry")}async settings(t){return d(await this.client.GET("/api/v1/orgs/{orgId}/calendar/settings",{params:{path:{orgId:t}}}),"calendar.settings")}async updateSettings(t,e){return d(await this.client.PATCH("/api/v1/orgs/{orgId}/calendar/settings",{params:{path:{orgId:t}},body:e}),"calendar.updateSettings")}async staff(t){return d(await this.client.GET("/api/v1/orgs/{orgId}/calendar/staff",{params:{path:{orgId:t}}}),"calendar.staff")}async holidays(t,e={}){return d(await this.client.GET("/api/v1/orgs/{orgId}/calendar/holidays",{params:{path:{orgId:t},query:e}}),"calendar.holidays")}async listFeeds(t){return d(await this.client.GET("/api/v1/orgs/{orgId}/calendar/feeds",{params:{path:{orgId:t}}}),"calendar.listFeeds")}async createFeed(t,e){return d(await this.client.POST("/api/v1/orgs/{orgId}/calendar/feeds",{params:{path:{orgId:t}},body:e}),"calendar.createFeed")}async updateFeed(t,e,r){return d(await this.client.PATCH("/api/v1/orgs/{orgId}/calendar/feeds/{feedId}",{params:{path:{orgId:t,feedId:e}},body:r}),"calendar.updateFeed")}async revokeFeed(t,e){return d(await this.client.DELETE("/api/v1/orgs/{orgId}/calendar/feeds/{feedId}",{params:{path:{orgId:t,feedId:e}}}),"calendar.revokeFeed")}async listExternal(t){return d(await this.client.GET("/api/v1/orgs/{orgId}/calendar/external",{params:{path:{orgId:t}}}),"calendar.listExternal")}async addExternal(t,e){return d(await this.client.POST("/api/v1/orgs/{orgId}/calendar/external",{params:{path:{orgId:t}},body:e}),"calendar.addExternal")}async updateExternal(t,e,r){return d(await this.client.PATCH("/api/v1/orgs/{orgId}/calendar/external/{calendarId}",{params:{path:{orgId:t,calendarId:e}},body:r}),"calendar.updateExternal")}async removeExternal(t,e){return d(await this.client.DELETE("/api/v1/orgs/{orgId}/calendar/external/{calendarId}",{params:{path:{orgId:t,calendarId:e}}}),"calendar.removeExternal")}}class Pe{client;constructor(t){this.client=t}async listContacts(t,e={}){return d(await this.client.GET("/api/v1/orgs/{orgId}/crm/contacts",{params:{path:{orgId:t},query:e}}),"crm.listContacts")}async createContact(t,e){return d(await this.client.POST("/api/v1/orgs/{orgId}/crm/contacts",{params:{path:{orgId:t}},body:e}),"crm.createContact")}async getContact(t,e){return d(await this.client.GET("/api/v1/orgs/{orgId}/crm/contacts/{contactId}",{params:{path:{orgId:t,contactId:e}}}),"crm.getContact")}async updateContact(t,e,r){return d(await this.client.PATCH("/api/v1/orgs/{orgId}/crm/contacts/{contactId}",{params:{path:{orgId:t,contactId:e}},body:r}),"crm.updateContact")}async archiveContact(t,e){return d(await this.client.DELETE("/api/v1/orgs/{orgId}/crm/contacts/{contactId}",{params:{path:{orgId:t,contactId:e}}}),"crm.archiveContact")}async restoreContact(t,e){return d(await this.client.POST("/api/v1/orgs/{orgId}/crm/contacts/{contactId}/restore",{params:{path:{orgId:t,contactId:e}}}),"crm.restoreContact")}async setContactTags(t,e,r){return d(await this.client.PUT("/api/v1/orgs/{orgId}/crm/contacts/{contactId}/tags",{params:{path:{orgId:t,contactId:e}},body:r}),"crm.setContactTags")}async contactTimeline(t,e){return d(await this.client.GET("/api/v1/orgs/{orgId}/crm/contacts/{contactId}/timeline",{params:{path:{orgId:t,contactId:e}}}),"crm.contactTimeline")}async contactAudiences(t,e){return d(await this.client.GET("/api/v1/orgs/{orgId}/crm/contacts/{contactId}/audiences",{params:{path:{orgId:t,contactId:e}}}),"crm.contactAudiences")}async addDeal(t,e,r){return d(await this.client.POST("/api/v1/orgs/{orgId}/crm/contacts/{contactId}/deals",{params:{path:{orgId:t,contactId:e}},body:r}),"crm.addDeal")}async listTags(t){return d(await this.client.GET("/api/v1/orgs/{orgId}/crm/tags",{params:{path:{orgId:t}}}),"crm.listTags")}async createTag(t,e){return d(await this.client.POST("/api/v1/orgs/{orgId}/crm/tags",{params:{path:{orgId:t}},body:e}),"crm.createTag")}async listFollowUps(t,e={}){return d(await this.client.GET("/api/v1/orgs/{orgId}/crm/follow-ups",{params:{path:{orgId:t},query:e}}),"crm.listFollowUps")}async listAudiences(t){return d(await this.client.GET("/api/v1/orgs/{orgId}/crm/audiences",{params:{path:{orgId:t}}}),"crm.listAudiences")}async listAudienceContacts(t,e,r={}){return d(await this.client.GET("/api/v1/orgs/{orgId}/crm/audiences/{audienceId}/contacts",{params:{path:{orgId:t,audienceId:e},query:r}}),"crm.listAudienceContacts")}}class $e{client;constructor(t){this.client=t}async list(t,e={}){return d(await this.client.GET("/api/v1/orgs/{orgId}/inbox",{params:{path:{orgId:t},query:e}}),"inbox.list")}async unreadCount(t){return d(await this.client.GET("/api/v1/orgs/{orgId}/inbox/unread-count",{params:{path:{orgId:t}}}),"inbox.unreadCount")}async get(t,e){return d(await this.client.GET("/api/v1/orgs/{orgId}/inbox/{conversationId}",{params:{path:{orgId:t,conversationId:e}}}),"inbox.get")}async update(t,e,r){return d(await this.client.PATCH("/api/v1/orgs/{orgId}/inbox/{conversationId}",{params:{path:{orgId:t,conversationId:e}},body:r}),"inbox.update")}async customer(t,e){return d(await this.client.GET("/api/v1/orgs/{orgId}/inbox/{conversationId}/customer",{params:{path:{orgId:t,conversationId:e}}}),"inbox.customer")}async listMessages(t,e,r={}){return d(await this.client.GET("/api/v1/orgs/{orgId}/inbox/{conversationId}/messages",{params:{path:{orgId:t,conversationId:e},query:r}}),"inbox.listMessages")}async reply(t,e,r){return d(await this.client.POST("/api/v1/orgs/{orgId}/inbox/{conversationId}/messages",{params:{path:{orgId:t,conversationId:e}},body:r}),"inbox.reply")}async editMessage(t,e,r,n){return d(await this.client.PATCH("/api/v1/orgs/{orgId}/inbox/{conversationId}/messages/{messageId}",{params:{path:{orgId:t,conversationId:e,messageId:r}},body:n}),"inbox.editMessage")}async deleteMessage(t,e,r){return d(await this.client.DELETE("/api/v1/orgs/{orgId}/inbox/{conversationId}/messages/{messageId}",{params:{path:{orgId:t,conversationId:e,messageId:r}}}),"inbox.deleteMessage")}async markRead(t,e){let r={orgId:t,conversationId:e};return d(await this.client.POST("/api/v1/orgs/{orgId}/inbox/{conversationId}/read",{params:{path:r}}),"inbox.markRead")}async search(t,e,r){let n={orgId:t,conversationId:e};return d(await this.client.GET("/api/v1/orgs/{orgId}/inbox/{conversationId}/search",{params:{path:n,query:{q:r}}}),"inbox.search")}async startCall(t,e){let r={orgId:t,conversationId:e};return d(await this.client.POST("/api/v1/orgs/{orgId}/inbox/{conversationId}/calls",{params:{path:r}}),"inbox.startCall")}async createPoll(t,e,r){return d(await this.client.POST("/api/v1/orgs/{orgId}/inbox/{conversationId}/polls",{params:{path:{orgId:t,conversationId:e}},body:r}),"inbox.createPoll")}async votePoll(t,e,r,n){return d(await this.client.POST("/api/v1/orgs/{orgId}/inbox/{conversationId}/polls/{messageId}",{params:{path:{orgId:t,conversationId:e,messageId:r}},body:n}),"inbox.votePoll")}async share(t,e,r){return d(await this.client.POST("/api/v1/orgs/{orgId}/inbox/{conversationId}/shares",{params:{path:{orgId:t,conversationId:e}},body:r}),"inbox.share")}async startUpload(t,e,r){return d(await this.client.POST("/api/v1/orgs/{orgId}/inbox/{conversationId}/uploads",{params:{path:{orgId:t,conversationId:e}},body:r}),"inbox.startUpload")}async completeUpload(t,e,r){return d(await this.client.POST("/api/v1/orgs/{orgId}/inbox/{conversationId}/uploads/{fileId}",{params:{path:{orgId:t,conversationId:e,fileId:r}}}),"inbox.completeUpload")}async shareables(t,e){return d(await this.client.GET("/api/v1/orgs/{orgId}/chat/shareables",{params:{path:{orgId:t},query:e}}),"inbox.shareables")}}class De{client;constructor(t){this.client=t}async list(t){return d(await this.client.GET("/api/v1/orgs/{orgId}/quick-replies",{params:{path:{orgId:t}}}),"quickReplies.list")}async create(t,e){return d(await this.client.POST("/api/v1/orgs/{orgId}/quick-replies",{params:{path:{orgId:t}},body:e}),"quickReplies.create")}async update(t,e,r){return d(await this.client.PATCH("/api/v1/orgs/{orgId}/quick-replies/{quickReplyId}",{params:{path:{orgId:t,quickReplyId:e}},body:r}),"quickReplies.update")}async delete(t,e){return d(await this.client.DELETE("/api/v1/orgs/{orgId}/quick-replies/{quickReplyId}",{params:{path:{orgId:t,quickReplyId:e}}}),"quickReplies.delete")}}class Ne{client;constructor(t){this.client=t}async listRooms(t){return d(await this.client.GET("/api/v1/orgs/{orgId}/team-chat",{params:{path:{orgId:t}}}),"teamChat.listRooms")}async createChannel(t,e){return d(await this.client.POST("/api/v1/orgs/{orgId}/team-chat/channels",{params:{path:{orgId:t}},body:e}),"teamChat.createChannel")}async updateChannel(t,e,r){return d(await this.client.PATCH("/api/v1/orgs/{orgId}/team-chat/channels/{channelId}",{params:{path:{orgId:t,channelId:e}},body:r}),"teamChat.updateChannel")}async deleteChannel(t,e){return d(await this.client.DELETE("/api/v1/orgs/{orgId}/team-chat/channels/{channelId}",{params:{path:{orgId:t,channelId:e}}}),"teamChat.deleteChannel")}async openDm(t,e){return d(await this.client.POST("/api/v1/orgs/{orgId}/team-chat/dms",{params:{path:{orgId:t}},body:e}),"teamChat.openDm")}async members(t){return d(await this.client.GET("/api/v1/orgs/{orgId}/team-chat/members",{params:{path:{orgId:t}}}),"teamChat.members")}async search(t,e){return d(await this.client.GET("/api/v1/orgs/{orgId}/team-chat/search",{params:{path:{orgId:t},query:e}}),"teamChat.search")}async listMessages(t,e,r={}){return d(await this.client.GET("/api/v1/orgs/{orgId}/team-chat/rooms/{roomId}/messages",{params:{path:{orgId:t,roomId:e},query:r}}),"teamChat.listMessages")}async send(t,e,r){return d(await this.client.POST("/api/v1/orgs/{orgId}/team-chat/rooms/{roomId}/messages",{params:{path:{orgId:t,roomId:e}},body:r}),"teamChat.send")}async editMessage(t,e,r,n){let i={orgId:t,roomId:e,messageId:r};return d(await this.client.PATCH("/api/v1/orgs/{orgId}/team-chat/rooms/{roomId}/messages/{messageId}",{params:{path:i},body:n}),"teamChat.editMessage")}async deleteMessage(t,e,r){let n={orgId:t,roomId:e,messageId:r};return d(await this.client.DELETE("/api/v1/orgs/{orgId}/team-chat/rooms/{roomId}/messages/{messageId}",{params:{path:n}}),"teamChat.deleteMessage")}async react(t,e,r,n){let i={orgId:t,roomId:e,messageId:r};return d(await this.client.PUT("/api/v1/orgs/{orgId}/team-chat/rooms/{roomId}/messages/{messageId}/reactions",{params:{path:i},body:{emoji:n}}),"teamChat.react")}async unreact(t,e,r,n){let i={orgId:t,roomId:e,messageId:r};return d(await this.client.DELETE("/api/v1/orgs/{orgId}/team-chat/rooms/{roomId}/messages/{messageId}/reactions",{params:{path:i,query:{emoji:n}}}),"teamChat.unreact")}async thread(t,e,r){let n={orgId:t,roomId:e,messageId:r};return d(await this.client.GET("/api/v1/orgs/{orgId}/team-chat/rooms/{roomId}/messages/{messageId}/thread",{params:{path:n}}),"teamChat.thread")}async createPoll(t,e,r){return d(await this.client.POST("/api/v1/orgs/{orgId}/team-chat/rooms/{roomId}/polls",{params:{path:{orgId:t,roomId:e}},body:r}),"teamChat.createPoll")}async votePoll(t,e,r,n){let i={orgId:t,roomId:e,messageId:r};return d(await this.client.POST("/api/v1/orgs/{orgId}/team-chat/rooms/{roomId}/polls/{messageId}",{params:{path:i},body:n}),"teamChat.votePoll")}async markRead(t,e){let r={orgId:t,roomId:e};return d(await this.client.POST("/api/v1/orgs/{orgId}/team-chat/rooms/{roomId}/read",{params:{path:r}}),"teamChat.markRead")}async typing(t,e){let r={orgId:t,roomId:e};return d(await this.client.POST("/api/v1/orgs/{orgId}/team-chat/rooms/{roomId}/typing",{params:{path:r}}),"teamChat.typing")}async startCall(t,e){let r={orgId:t,roomId:e};return d(await this.client.POST("/api/v1/orgs/{orgId}/team-chat/rooms/{roomId}/calls",{params:{path:r}}),"teamChat.startCall")}async share(t,e,r){return d(await this.client.POST("/api/v1/orgs/{orgId}/team-chat/rooms/{roomId}/shares",{params:{path:{orgId:t,roomId:e}},body:r}),"teamChat.share")}async startUpload(t,e,r){return d(await this.client.POST("/api/v1/orgs/{orgId}/team-chat/rooms/{roomId}/uploads",{params:{path:{orgId:t,roomId:e}},body:r}),"teamChat.startUpload")}async completeUpload(t,e,r){return d(await this.client.POST("/api/v1/orgs/{orgId}/team-chat/rooms/{roomId}/uploads/{fileId}",{params:{path:{orgId:t,roomId:e,fileId:r}}}),"teamChat.completeUpload")}async realtimeToken(t){return d(await this.client.POST("/api/v1/chat/realtime-token",{body:t}),"teamChat.realtimeToken")}}class Fe{client;constructor(t){this.client=t}async listNotes(t){return d(await this.client.GET("/api/v1/orgs/{orgId}/vault/notes",{params:{path:{orgId:t}}}),"vault.listNotes")}async createNote(t,e){return d(await this.client.POST("/api/v1/orgs/{orgId}/vault/notes",{params:{path:{orgId:t}},body:e}),"vault.createNote")}async getNote(t,e){return d(await this.client.GET("/api/v1/orgs/{orgId}/vault/notes/{noteId}",{params:{path:{orgId:t,noteId:e}}}),"vault.getNote")}async saveNote(t,e,r){return d(await this.client.PATCH("/api/v1/orgs/{orgId}/vault/notes/{noteId}",{params:{path:{orgId:t,noteId:e}},body:r}),"vault.saveNote")}async deleteNote(t,e){return d(await this.client.DELETE("/api/v1/orgs/{orgId}/vault/notes/{noteId}",{params:{path:{orgId:t,noteId:e}}}),"vault.deleteNote")}async moveNote(t,e,r){return d(await this.client.POST("/api/v1/orgs/{orgId}/vault/notes/{noteId}/move",{params:{path:{orgId:t,noteId:e}},body:r}),"vault.moveNote")}async search(t,e){return d(await this.client.GET("/api/v1/orgs/{orgId}/vault/search",{params:{path:{orgId:t},query:e}}),"vault.search")}async graph(t){return d(await this.client.GET("/api/v1/orgs/{orgId}/vault/graph",{params:{path:{orgId:t}}}),"vault.graph")}async changes(t,e){return d(await this.client.GET("/api/v1/me/vault-changes",{params:{query:{org:t,since:e}}}),"vault.changes")}}class Ue{client;constructor(t){this.client=t}async list(t,e={}){return d(await this.client.GET("/api/v1/orgs/{orgId}/webhooks",{params:{path:{orgId:t},query:e}}),"webhooks.list")}async create(t,e){return d(await this.client.POST("/api/v1/orgs/{orgId}/webhooks",{params:{path:{orgId:t}},body:e}),"webhooks.create")}async get(t,e){return d(await this.client.GET("/api/v1/orgs/{orgId}/webhooks/{webhookId}",{params:{path:{orgId:t,webhookId:e}}}),"webhooks.get")}async update(t,e,r){return d(await this.client.PUT("/api/v1/orgs/{orgId}/webhooks/{webhookId}",{params:{path:{orgId:t,webhookId:e}},body:r}),"webhooks.update")}async delete(t,e){return d(await this.client.DELETE("/api/v1/orgs/{orgId}/webhooks/{webhookId}",{params:{path:{orgId:t,webhookId:e}}}),"webhooks.delete")}async deliveries(t,e,r={}){return d(await this.client.GET("/api/v1/orgs/{orgId}/webhooks/{webhookId}/deliveries",{params:{path:{orgId:t,webhookId:e},query:r}}),"webhooks.deliveries")}async rotateSecret(t,e){return d(await this.client.POST("/api/v1/orgs/{orgId}/webhooks/{webhookId}/rotate",{params:{path:{orgId:t,webhookId:e}}}),"webhooks.rotateSecret")}async test(t,e){return d(await this.client.POST("/api/v1/orgs/{orgId}/webhooks/{webhookId}/test",{params:{path:{orgId:t,webhookId:e}}}),"webhooks.test")}}var fi="https://vcity.io";function yi(t){let e;try{e=new URL(t)}catch{throw Error(`@vcityio/api-client: invalid baseUrl (${t.slice(0,200)})`)}if(e.protocol==="https:")return;if(e.protocol==="http:"&&(e.hostname==="localhost"||e.hostname==="127.0.0.1"||e.hostname==="[::1]"))return;throw Error(`@vcityio/api-client: baseUrl must use https:// for non-localhost hosts (got: ${e.protocol}//${e.hostname}).`)}function hi(t,e){let r=e??globalThis.fetch;if(!r)throw Error("@vcityio/api-client: no fetch implementation found. Provide options.fetch or run on Node >=20 / a browser.");return async function(i){if(!t)return r(i);let s=i.headers.get("Authorization")?.match(/^Bearer\s+(.+)$/)?.[1]?.trim();if(s&&s!=="undefined"&&s!=="null")return r(i);let o=new Headers(i.headers);o.set("Authorization",`Bearer ${t}`);let c=new Request(i,{headers:o});return r(c)}}class ar{raw;me;orgs;drafts;coupons;media;products;events;rooms;support;agents;conversations;customerAgent;posts;collections;bookings;bookingTypes;projects;blogs;orders;analytics;apiKeys;quotes;crm;webhooks;inbox;quickReplies;teamChat;calendar;vault;assistant;notifications;desk;campaigns;comments;newsletter;surveys;configurators;pos;dropshipping;storefront;public;chatRooms;billing;constructor(t={}){let e=t.baseUrl??fi;yi(e);let r=hi(t.token,t.fetch),n={baseUrl:e,fetch:r,headers:t.headers};this.raw=ir(n),this.me=new Xt(this.raw),this.orgs=new Zt(this.raw),this.drafts=new zt(this.raw),this.coupons=new Kt(this.raw),this.media=new Wt(this.raw),this.products=new te(this.raw),this.events=new ee(this.raw),this.rooms=new re(this.raw),this.support=new he(this.raw),this.agents=new ge(this.raw),this.conversations=new le(this.raw),this.customerAgent=new pe(this.raw),this.posts=new me(this.raw),this.collections=new ue(this.raw),this.bookings=new se(this.raw),this.bookingTypes=new ie(this.raw),this.projects=new ne(this.raw),this.blogs=new oe(this.raw),this.orders=new ae(this.raw),this.analytics=new de(this.raw),this.apiKeys=new we(this.raw),this.quotes=new ce(this.raw),this.crm=new Pe(this.raw),this.webhooks=new Ue(this.raw),this.inbox=new $e(this.raw),this.quickReplies=new De(this.raw),this.teamChat=new Ne(this.raw),this.calendar=new Ae(this.raw),this.vault=new Fe(this.raw),this.assistant=new xe(this.raw),this.notifications=new fe(this.raw),this.desk=new ye(this.raw),this.campaigns=new ve(this.raw),this.comments=new be(this.raw),this.newsletter=new ke(this.raw),this.surveys=new Ie(this.raw),this.configurators=new Ce(this.raw),this.pos=new Se(this.raw),this.dropshipping=new Oe(this.raw),this.storefront=new je(this.raw),this.public=new Te(this.raw),this.chatRooms=new Re(this.raw),this.billing=new Ee(this.raw)}}function cr(t={}){return new ar(t)}import lt from"node:fs";import ki from"node:os";import Be from"node:path";var wi=/\x1b(?:\[[0-?]*[ -/]*[@-~]|\][^\x07\x1b]*(?:\x07|\x1b\\)|[P_^X][^\x07\x1b]*(?:\x07|\x1b\\)|[^[\]P_^X])/g,vi=/[\x00-\x08\x0b-\x1f\x7f-\x9f]/g,bi=/[\u061c\u200e\u200f\u202a-\u202e\u2066-\u2069]/g;function T(t){return t.replace(wi,"").replace(vi,"").replace(bi,"")}function Dr(t){let e;try{e=new URL(t)}catch{throw Error(`Refusing to open malformed URL: ${T(t).slice(0,100)}`)}if(e.protocol==="https:")return e;if(e.protocol==="http:"&&(e.hostname==="localhost"||e.hostname==="127.0.0.1"||e.hostname==="[::1]"))return e;throw Error(`Refusing to open URL with unsafe protocol: ${e.protocol}`)}var $r=512;function O(t,e){let r=t.trim();if(!r)throw Error(`${e} must not be empty.`);if(r.length>$r)throw Error(`${e} must be at most ${$r} characters.`);if(/[\x00-\x1f\x7f]/.test(r))throw Error(`${e} must not contain control characters.`);return r}function St(t){let e;try{e=new URL(t)}catch{throw Error(`Invalid api base URL: ${t.slice(0,200)}`)}if(e.protocol==="https:")return e;if(e.protocol==="http:"&&(e.hostname==="localhost"||e.hostname==="127.0.0.1"||e.hostname==="[::1]"))return e;throw Error(`api base URL must use https:// (got: ${e.protocol}//${e.hostname}).`)}function gt(){if(process.env.VCITY_CONFIG_DIR)return Be.resolve(process.env.VCITY_CONFIG_DIR);return Be.join(ki.homedir(),".vcity")}function Me(){return Be.join(gt(),"auth.json")}function dr(){return Be.join(gt(),"config.json")}function Le(){let t=process.env.VCITY_API_BASE_URL||"https://vcity.io";return St(t),t}import dt from"node:fs";function Ot(t,e,r=384){if(process.platform==="win32"){dt.writeFileSync(t,e,{mode:r});try{dt.chmodSync(t,r)}catch{}return}let n=dt.constants.O_WRONLY|dt.constants.O_CREAT|dt.constants.O_TRUNC|dt.constants.O_NOFOLLOW,i=dt.openSync(t,n,r);try{dt.writeSync(i,e),dt.fchmodSync(i,r)}finally{dt.closeSync(i)}}function Ii(){let t=gt();lt.mkdirSync(t,{recursive:!0,mode:448});try{lt.chmodSync(t,448)}catch{}if(process.platform!=="win32"){let e;try{e=lt.statSync(t)}catch{return}if((e.mode&63)!==0)throw Error(`Refusing to write CLI credentials: ${t} is group- or world-accessible (mode ${(e.mode&511).toString(8)}). Tighten its permissions (\`chmod 700 ${t}\`) or set VCITY_CONFIG_DIR to a directory you own.`)}}function ji(t){if(!t||typeof t!=="object")return!1;let e=t;return typeof e.api_base_url==="string"&&typeof e.access_token==="string"&&typeof e.refresh_token==="string"&&typeof e.access_expires_at==="number"&&typeof e.refresh_expires_at==="number"&&!!e.user&&typeof e.user==="object"}function xt(){let t=Me();if(!lt.existsSync(t))return;try{let e=JSON.parse(lt.readFileSync(t,"utf-8"));if(!ji(e))return;if(St(e.api_base_url),new URL(e.api_base_url).origin!==new URL(Le()).origin)return;return e}catch{return}}function Ei(t){let e;try{e=lt.lstatSync(t)}catch{return}if(e.isSymbolicLink()||e.isFile()&&e.nlink>1)lt.rmSync(t,{force:!0})}function qe(t){Ii();let e=Me();Ei(e),Ot(e,JSON.stringify(t,null,2),384)}function $t(){let t=Me();if(lt.existsSync(t))lt.rmSync(t)}function _e(){let t=xt();if(!t)throw Error("Not logged in. Run `vcity login` first.");return t}var ur={name:"@vcityio/cli",version:"0.10.3",type:"module",description:"vcity command-line interface for org owners",main:"./dist/index.js",bin:{vcity:"./dist/index.js"},files:["dist","README.md","LICENSE"],engines:{node:">=20"},publishConfig:{access:"public"},optionalDependencies:{open:"^10.0.0"},keywords:["vcity","cli"],author:"Otherwise SAS",license:"MIT",homepage:"https://vcity.io",bugs:{email:"support@owsas.com"}};var nt=ur.version,Et=ur.name;var gr=60000,Mr=`vcity-cli/${nt} (${process.platform} ${process.arch})`,Nr=2048;class Dt extends Error{status;body;constructor(t,e,r){super(r??`HTTP ${t}`);this.status=t;this.body=e;this.name="ApiError"}}function Lr(t,e,r){if(e.startsWith("//")||/^[a-z][a-z0-9+.-]*:/i.test(e))throw Error(`Refusing to build URL with non-relative path: ${e.slice(0,100)}`);let n=new URL(t),i=new URL(e.startsWith("/")?e:`/${e}`,t);if(i.origin!==n.origin)throw Error(`Refusing to build URL outside base origin: ${i.origin}`);if(r){for(let[a,s]of Object.entries(r))if(s!==void 0&&s!==null&&!Number.isNaN(s))i.searchParams.set(a,String(s))}return i.toString()}var Fr=(t,e)=>typeof t==="string"&&t.length>0&&t.length<=e,Ge=Symbol("transient"),Ur=(t)=>typeof t==="number"&&Number.isFinite(t);async function Ri(t){try{let e=await fetch(Lr(t.api_base_url,"/api/cli/auth/refresh"),{method:"POST",headers:{"content-type":"application/json",authorization:`Bearer ${t.refresh_token}`},body:JSON.stringify({refresh_token:t.refresh_token}),signal:AbortSignal.timeout(gr),redirect:"error"});if(e.status===429||e.status>=500)return Ge;if(!e.ok)return;let r=await e.json();if(!Fr(r.access_token,Nr)||!Fr(r.refresh_token,Nr)||!Ur(r.access_expires_at)||!Ur(r.refresh_expires_at)||r.access_expires_at<=Date.now()||r.refresh_expires_at<=Date.now())return;let n={...t,access_token:r.access_token,refresh_token:r.refresh_token,access_expires_at:r.access_expires_at,refresh_expires_at:r.refresh_expires_at};return qe(n),n}catch{return Ge}}async function Br(t){let e=()=>new Dt(401,void 0,"Session expired. Run `vcity login` again."),r=xt();if(r&&r.refresh_token!==t.refresh_token)return r;let n=await Ri(t);if(n&&n!==Ge)return n;let i=xt();if(i&&i.refresh_token!==t.refresh_token)return i;if(n===Ge)throw new Dt(503,void 0,"Could not refresh the session. Check your connection and try again.");throw $t(),e()}async function Nt(t,e={}){let{authed:r=!0,method:n="GET",body:i,query:a,baseUrl:s,headers:o}=e,c=r?_e():void 0,u=s??c?.api_base_url??"https://vcity.io",p={"content-type":"application/json","user-agent":Mr};if(c)p.authorization=`Bearer ${c.access_token}`;if(o)for(let[E,N]of Object.entries(o))p[E]=N;let w=await fetch(Lr(u,t,a),{method:n,headers:p,body:i===void 0?void 0:JSON.stringify(i),signal:AbortSignal.timeout(gr),redirect:"error"}),R=(w.headers.get("content-type")??"").includes("application/json")?await w.json().catch(()=>{return}):await w.text().catch(()=>{return});if(!w.ok){let E=(R&&typeof R==="object"&&"error"in R?String(R.error):void 0)??`Request failed (${w.status})`;throw new Dt(w.status,R,E)}return R}function Ci(t,e){let r=new URL(t).origin;if(r!==e)throw Error(`Refusing to attach Bearer token to cross-origin SDK request: ${r}`)}var Si=3,Oi=60000;function xi(t,e){let r=t.headers.get("retry-after"),n=r!==null&&/^\d+$/.test(r)?Number(r)*1000:r?Date.parse(r)-Date.now():Number.NaN,i=Number.isFinite(n)?n:1000*2**e;return Math.min(Math.max(i,0),Oi)}async function Ai(t){for(let e=0;;e++){let r=await t();if(r.status!==429||e>=Si)return r;await new Promise((n)=>setTimeout(n,xi(r,e)))}}function Pi(){let t=async(e,r,n)=>{Ci(e.url,n);let i=new Headers(e.headers);i.set("authorization",`Bearer ${r}`),i.set("user-agent",Mr);let a=new Request(e,{headers:i,signal:AbortSignal.timeout(gr),redirect:e.redirect==="manual"?"manual":"error"});return globalThis.fetch(a)};return async function(r){let n=_e(),i=new URL(n.api_base_url).origin;if(Date.now()>=n.access_expires_at){if(Date.now()>=n.refresh_expires_at)throw $t(),new Dt(401,void 0,"Session expired. Run `vcity login` again.");n=await Br(n)}let a=await Ai(()=>t(r.clone(),n.access_token,i));if(a.status!==401)return a;return n=await Br(n),t(r,n.access_token,i)}}function l(){let t=_e();return cr({baseUrl:t.api_base_url,fetch:Pi()})}import Tt from"node:fs";import $i from"node:path";var lr=16777216;function Di(t){let e=new Uint8Array(t+1),r=0;while(r<e.length){let n=Tt.readSync(0,e,r,e.length-r,null);if(n===0)break;r+=n}if(r>t)throw Error(`--data: stdin body exceeds the ${t}-byte cap.`);return Buffer.from(e.buffer,e.byteOffset,r).toString("utf-8")}function P(t){if(t===void 0)return;let e;if(t==="-"){if(process.stdin.isTTY)throw Error("--data: reading from stdin (-) but nothing is piped in");try{e=Di(lr)}catch(r){let n=r instanceof Error?r.message:String(r);if(n.startsWith("--data:"))throw r;throw Error(`--data: could not read stdin: ${n}`)}}else if(t.startsWith("@")){let r=t.slice(1);if(r.length===0)throw Error("--data: missing file path after `@`");if(!/\.json$/i.test(r))throw Error(`--data: @file path must point to a .json file (got: ${r})`);let n;try{n=Tt.realpathSync(r)}catch(s){let o=s instanceof Error?s.message:String(s);throw Error(`--data: could not read ${r}: ${o}`)}if(!/\.json$/i.test(n))throw Error(`--data: @file path must point to a .json file (got: ${r} → ${n})`);let i;try{i=Tt.realpathSync(process.cwd())}catch(s){let o=s instanceof Error?s.message:String(s);throw Error(`--data: could not resolve cwd: ${o}`)}if(n!==i&&!n.startsWith(i+$i.sep))throw Error(`--data: @file path must be inside the current working directory (got: ${r}). To send a file from elsewhere, pipe it: cat <file> | vcity ... --data -`);let a;try{a=Tt.openSync(n,"r")}catch(s){let o=s instanceof Error?s.message:String(s);throw Error(`--data: could not read ${r}: ${o}`)}try{let s;try{s=Tt.fstatSync(a)}catch(o){let c=o instanceof Error?o.message:String(o);throw Error(`--data: could not read ${r}: ${c}`)}if(s.nlink>1)throw Error(`--data: @file path must not be a hard link (got: ${r})`);if(s.size>lr)throw Error(`--data: ${r} exceeds the ${lr}-byte body cap (got ${s.size} bytes).`);try{e=Tt.readFileSync(a,"utf-8")}catch(o){let c=o instanceof Error?o.message:String(o);throw Error(`--data: could not read ${r}: ${c}`)}}finally{try{Tt.closeSync(a)}catch{}}}else e=t;try{return JSON.parse(e)}catch{throw Error("--data: invalid JSON")}}import Rt from"node:fs";function Ni(){let t=gt();Rt.mkdirSync(t,{recursive:!0,mode:448});try{Rt.chmodSync(t,448)}catch{}if(process.platform!=="win32"){let e;try{e=Rt.statSync(t)}catch{return}if((e.mode&63)!==0)throw Error(`Refusing to write CLI config: ${t} is group- or world-accessible (mode ${(e.mode&511).toString(8)}). Tighten its permissions (\`chmod 700 ${t}\`) or set VCITY_CONFIG_DIR to a directory you own.`)}}function Fi(t){if(!t||typeof t!=="object"||Array.isArray(t))return!1;let e=t;if(e.active_org!==void 0&&typeof e.active_org!=="string")return!1;if(e.default_format!==void 0&&e.default_format!=="pretty"&&e.default_format!=="json")return!1;return!0}function Ct(){let t=dr();if(!Rt.existsSync(t))return{};try{let e=JSON.parse(Rt.readFileSync(t,"utf-8"));return Fi(e)?e:{}}catch{return{}}}function Ui(t){let e;try{e=Rt.lstatSync(t)}catch{return}if(e.isSymbolicLink()||e.isFile()&&e.nlink>1)Rt.rmSync(t,{force:!0})}function qr(t){Ni();let r={...Ct(),...t},n=dr();return Ui(n),Ot(n,JSON.stringify(r,null,2),384),r}function h(t){if(t)return t;let e=Ct();if(!e.active_org)throw Error("No active org. Run `vcity org use <slug>` or pass --org <slug>.");return e.active_org}function f(t){if(t)return"json";if(!process.stdout.isTTY)return"json";return"pretty"}function g(t){process.stdout.write(`${JSON.stringify(t,null,2)}
9
9
  `)}function Bi(t,e){if(t.length===0)return"(no rows)";let r=t.map((o)=>e.map((c)=>T(c.get(o)??""))),n=e.map((o,c)=>Math.max(o.header.length,...r.map((u)=>u[c].length))),i=n.map((o)=>"-".repeat(o)).join(" "),a=e.map((o,c)=>o.header.padEnd(n[c])).join(" "),s=r.map((o)=>o.map((c,u)=>c.padEnd(n[u])).join(" "));return[a,i,...s].join(`
10
10
  `)}function k(t,e){process.stdout.write(`${Bi(t,e)}
11
11
  `)}function j(t){for(let[e,r]of Object.entries(t)){if(r===void 0||r===null)continue;let n=typeof r==="object"?JSON.stringify(r):String(r);process.stdout.write(`${T(e).padEnd(20)} ${T(n)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vcityio/cli",
3
- "version": "0.10.2",
3
+ "version": "0.10.3",
4
4
  "type": "module",
5
5
  "description": "vcity command-line interface for org owners",
6
6
  "main": "./dist/index.js",