@visgate_ai/client 0.4.1 → 0.4.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.
package/dist/index.cjs CHANGED
@@ -551,6 +551,17 @@ var HfModels = class {
551
551
  };
552
552
 
553
553
  // src/resources/invitations.ts
554
+ function invitationPreviewFromResponse(data) {
555
+ return {
556
+ id: data.id ?? "",
557
+ organizationId: data.organization_id ?? "",
558
+ organizationName: data.organization_name ?? "",
559
+ role: data.role ?? "member",
560
+ invitedByEmail: data.invited_by_email ?? "",
561
+ status: data.status ?? "pending",
562
+ expiresAt: data.expires_at ?? ""
563
+ };
564
+ }
554
565
  function invitationFromResponse(data) {
555
566
  return {
556
567
  id: data.id ?? "",
@@ -580,6 +591,11 @@ var Invitations = class {
580
591
  const data = await this.client._request("GET", `/organizations/${encodeURIComponent(orgId)}/invitations`);
581
592
  return data.map(invitationFromResponse);
582
593
  }
594
+ /** List all invitations for an organization regardless of status, ordered newest first. */
595
+ async listAllForOrg(orgId) {
596
+ const data = await this.client._request("GET", `/organizations/${encodeURIComponent(orgId)}/invitations/all`);
597
+ return data.map(invitationFromResponse);
598
+ }
583
599
  /** Cancel a pending invitation. */
584
600
  async cancel(orgId, inviteId) {
585
601
  await this.client._request("DELETE", `/organizations/${encodeURIComponent(orgId)}/invitations/${encodeURIComponent(inviteId)}`);
@@ -589,6 +605,21 @@ var Invitations = class {
589
605
  const data = await this.client._request("GET", "/invitations/pending");
590
606
  return data.map(invitationFromResponse);
591
607
  }
608
+ /** Public preview of an invitation (no auth). Use for invite landing pages. */
609
+ async getPreview(inviteId) {
610
+ const url = `${this.client.baseUrl}/invite/${encodeURIComponent(inviteId)}`;
611
+ const response = await fetch(url, {
612
+ method: "GET",
613
+ headers: { "Content-Type": "application/json" }
614
+ });
615
+ const data = await handleResponse(response);
616
+ return invitationPreviewFromResponse(data);
617
+ }
618
+ /** List invitations sent by organizations the current user is a member of. */
619
+ async listSent() {
620
+ const data = await this.client._request("GET", "/invitations/sent");
621
+ return data.map(invitationFromResponse);
622
+ }
592
623
  /** Accept a pending invitation. */
593
624
  async accept(inviteId) {
594
625
  return await this.client._request("POST", `/invitations/${encodeURIComponent(inviteId)}/accept`);
@@ -982,7 +1013,7 @@ var DEFAULT_BASE_URL = "https://visgateai.com/api/v1";
982
1013
  var DEFAULT_TIMEOUT = 12e4;
983
1014
  var DEFAULT_MAX_RETRIES = 2;
984
1015
  var RETRYABLE_STATUS_CODES = /* @__PURE__ */ new Set([429, 500, 502, 503, 504]);
985
- var SDK_VERSION = "0.3.3";
1016
+ var SDK_VERSION = "0.4.2";
986
1017
  function getVersion() {
987
1018
  try {
988
1019
  if (typeof __VERSION__ !== "undefined") return __VERSION__;
@@ -1184,7 +1215,7 @@ var AsyncClient = class extends Client {
1184
1215
  };
1185
1216
 
1186
1217
  // src/index.ts
1187
- var VERSION = "0.3.5";
1218
+ var VERSION = "0.4.2";
1188
1219
 
1189
1220
  exports.AsyncClient = AsyncClient;
1190
1221
  exports.AuthenticationError = AuthenticationError;