@cubist-labs/cubesigner-sdk 0.4.273 → 0.4.275

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
  *
package/src/schema.ts CHANGED
@@ -6544,6 +6544,7 @@ export interface components {
6544
6544
  | "sign:sui"
6545
6545
  | "sign:tendermint"
6546
6546
  | "sign:mmi"
6547
+ | "sign:auto"
6547
6548
  | "manage:*"
6548
6549
  | "manage:readonly"
6549
6550
  | "manage:email:*"
@@ -7161,6 +7162,7 @@ export interface components {
7161
7162
  | "TsQueryError"
7162
7163
  | "DbQueryError"
7163
7164
  | "DbGetError"
7165
+ | "DbBatchGetError"
7164
7166
  | "DbDeleteError"
7165
7167
  | "DbPutError"
7166
7168
  | "DbUpdateError"
@@ -363,6 +363,9 @@ export type SecretValue = schemas["SecretValue"];
363
363
  export type ImportKeyRequestMaterial = schemas["ImportKeyRequestMaterial"];
364
364
 
365
365
  export type InvitationAcceptRequest = schemas["InvitationAcceptRequest"];
366
+ export type InvitationInfo = schemas["InvitationInfo"];
367
+ export type PaginatedListInvitationsResponse = schemas["PaginatedListInvitationsResponse"];
368
+ export type CancelInvitationRequest = schemas["CancelInvitationRequest"];
366
369
 
367
370
  export type KeyTypeAndDerivationPath = schemas["KeyTypeAndDerivationPath"];
368
371
  export type PolicyInfo = schemas["PolicyInfo"] & {
package/src/scopes.ts CHANGED
@@ -83,6 +83,7 @@ export const AllScopes: Record<ExplicitScope, string> =
83
83
  "sign:sui" : "Allows access to the sign 'sui' endpoint",
84
84
  "sign:tendermint" : "Allows access to the sign 'tendermint' endpoint",
85
85
  "sign:mmi" : "Allows access to the sign 'mmi' endpoint",
86
+ "sign:auto" : "Allows MMI requests for keys with the 'AllowAutoSign' policy to be signed automatically.",
86
87
  "manage:*" : "Allows access to all management endpoints (e.g., create role, create key, add key to role, etc.)",
87
88
  "manage:readonly" : "Allows access to all management readonly endpoints",
88
89
  "manage:email:*" : "Allows access only to the email management endpoints",