@cubist-labs/cubesigner-sdk 0.4.274 → 0.4.276

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.
@@ -76,6 +76,8 @@ import type {
76
76
  JsonRpcResult,
77
77
  Eip7702SignRequest,
78
78
  SignResponse,
79
+ InvitationInfo,
80
+ PaginatedListInvitationsResponse,
79
81
  } from "../schema_types.ts";
80
82
  import { encodeToBase64 } from "../util.ts";
81
83
  import { auditLogEntrySchema } from "../audit_log.ts";
@@ -725,7 +727,7 @@ export class ApiClient extends BaseClient {
725
727
 
726
728
  // #endregion
727
729
 
728
- // #region ORG USERS: orgUserInvite, orgUserDelete, orgUsersList, orgUserGet, orgUserGetByEmail, orgUserCreateOidc, orgUserDeleteOidc, resetUserMfaInit, resetUserMfaComplete
730
+ // #region ORG USERS: orgUserInvite, orgInvitationsList, orgInvitationCancel, orgUserDelete, orgUsersList, orgUserGet, orgUserGetByEmail, orgUserCreateOidc, orgUserDeleteOidc, resetUserMfaInit, resetUserMfaComplete
729
731
 
730
732
  /**
731
733
  * Create a new (first-party) user in the organization and send an email invitation to that user.
@@ -779,6 +781,41 @@ export class ApiClient extends BaseClient {
779
781
  });
780
782
  }
781
783
 
784
+ /**
785
+ * List pending invitations in the org, i.e., those that have neither been
786
+ * accepted nor canceled, and have not expired.
787
+ *
788
+ * @param page Pagination options. Defaults to fetching the entire result set.
789
+ * @returns Paginator for iterating over the pending invitations in the org.
790
+ */
791
+ orgInvitationsList(
792
+ page?: PageOpts,
793
+ ): Paginator<PaginatedListInvitationsResponse, InvitationInfo[]> {
794
+ const o = op("/v0/org/{org_id}/invitations", "get");
795
+
796
+ return Paginator.items(
797
+ page ?? Page.default(),
798
+ (pageQuery) => this.exec(o, { params: { query: { ...pageQuery } } }),
799
+ (r) => r.invitations,
800
+ (r) => r.last_evaluated_key,
801
+ );
802
+ }
803
+
804
+ /**
805
+ * Cancel a pending invitation. Fails if there is no pending invitation for
806
+ * the given email address.
807
+ *
808
+ * @param email The email address of the invitation to cancel.
809
+ * @returns An empty response
810
+ */
811
+ async orgInvitationCancel(email: string): Promise<Empty> {
812
+ const o = op("/v0/org/{org_id}/invitations", "delete");
813
+
814
+ return this.exec(o, {
815
+ body: { email },
816
+ });
817
+ }
818
+
782
819
  /**
783
820
  * Remove the user from the org.
784
821
  *
package/src/org.ts CHANGED
@@ -31,6 +31,7 @@ import type {
31
31
  AuditLogEntry,
32
32
  AuditLogRequest,
33
33
  MfaReceipts,
34
+ InvitationInfo,
34
35
  } from "./index.ts";
35
36
  import { Contact } from "./contact.ts";
36
37
  import { C2FFunction, Key, MfaRequest, Role } from "./index.ts";
@@ -536,6 +537,38 @@ export class Org {
536
537
  return this.#apiClient.orgUserInvite.bind(this.#apiClient);
537
538
  }
538
539
 
540
+ /**
541
+ * List all pending invitations in the organization, i.e., those that have
542
+ * neither been accepted nor canceled, and have not expired.
543
+ *
544
+ * @returns The list of pending invitations
545
+ */
546
+ async invitations(): Promise<InvitationInfo[]> {
547
+ return await this.#apiClient.orgInvitationsList().fetchAll();
548
+ }
549
+
550
+ /**
551
+ * List pending invitations in the organization (paginated).
552
+ *
553
+ * Same as {@link ApiClient.orgInvitationsList}, see its documentation for more information.
554
+ *
555
+ * @returns A function that returns a paginated list of pending invitations
556
+ */
557
+ get invitationsPaginated() {
558
+ return this.#apiClient.orgInvitationsList.bind(this.#apiClient);
559
+ }
560
+
561
+ /**
562
+ * Cancel a pending invitation.
563
+ *
564
+ * Same as {@link ApiClient.orgInvitationCancel}, see its documentation for more information.
565
+ *
566
+ * @returns A function that cancels a pending invitation
567
+ */
568
+ get cancelInvitation() {
569
+ return this.#apiClient.orgInvitationCancel.bind(this.#apiClient);
570
+ }
571
+
539
572
  /**
540
573
  * Delete an existing user.
541
574
  *