@witnium-tech/witniumchain 0.7.0 → 0.8.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/index.mjs CHANGED
@@ -119,6 +119,8 @@ var WitniumchainClient = class {
119
119
  oauth;
120
120
  /** MFA self-management. Accessed as `client.mfa.totp.*` and `client.mfa.recoveryCodes.*`. */
121
121
  mfa;
122
+ /** Session-cookie team management (org-admin only). `client.orgUsers.*`. */
123
+ orgUsers;
122
124
  constructor(config) {
123
125
  if (!config.baseUrl) {
124
126
  throw new Error("WitniumchainClient: baseUrl is required");
@@ -142,6 +144,7 @@ var WitniumchainClient = class {
142
144
  this.keys = new SigningKeys(this);
143
145
  this.oauth = new OauthNamespace(this);
144
146
  this.mfa = new MfaNamespace(this);
147
+ this.orgUsers = new OrgMembers(this);
145
148
  }
146
149
  /**
147
150
  * Convenience alias for {@link getAccount} — returns the authenticated
@@ -169,6 +172,53 @@ var WitniumchainClient = class {
169
172
  createOrg(body) {
170
173
  return this.req("POST", "/v1/orgs", { auth: "Public", body });
171
174
  }
175
+ // ── Team management (session-cookie; org-admin only) ──────────────────────
176
+ // Backing methods for the `orgUsers` namespace. All resolve the caller's
177
+ // org + org-admin role server-side from the session — no orgId in the path.
178
+ listMembers() {
179
+ return this.req("GET", "/v1/orgs/me/members", { auth: "SessionCookie" });
180
+ }
181
+ inviteMember(body) {
182
+ return this.req("POST", "/v1/orgs/me/members/invite", {
183
+ auth: "SessionCookie",
184
+ body
185
+ });
186
+ }
187
+ suspendMember(userId) {
188
+ return this.req(
189
+ "POST",
190
+ `/v1/orgs/me/members/${encodeURIComponent(userId)}/suspend`,
191
+ { auth: "SessionCookie" }
192
+ );
193
+ }
194
+ unsuspendMember(userId) {
195
+ return this.req(
196
+ "POST",
197
+ `/v1/orgs/me/members/${encodeURIComponent(userId)}/unsuspend`,
198
+ { auth: "SessionCookie" }
199
+ );
200
+ }
201
+ setMemberRole(userId, body) {
202
+ return this.req(
203
+ "PUT",
204
+ `/v1/orgs/me/members/${encodeURIComponent(userId)}/role`,
205
+ { auth: "SessionCookie", body }
206
+ );
207
+ }
208
+ removeMember(userId) {
209
+ return this.req(
210
+ "DELETE",
211
+ `/v1/orgs/me/members/${encodeURIComponent(userId)}`,
212
+ { auth: "SessionCookie" }
213
+ );
214
+ }
215
+ resendMemberInvite(userId) {
216
+ return this.req(
217
+ "POST",
218
+ `/v1/orgs/me/members/${encodeURIComponent(userId)}/resend-invite`,
219
+ { auth: "SessionCookie" }
220
+ );
221
+ }
172
222
  verifyEmail(token) {
173
223
  return this.req("GET", "/v1/auth/verify", {
174
224
  auth: "Public",
@@ -1241,6 +1291,40 @@ var MfaNamespace = class {
1241
1291
  this.recoveryCodes = new MfaRecoveryCodes(client);
1242
1292
  }
1243
1293
  };
1294
+ var OrgMembers = class {
1295
+ constructor(client) {
1296
+ this.client = client;
1297
+ }
1298
+ client;
1299
+ /** List the caller's org members (role, suspendedAt, isOwner, keys). */
1300
+ list() {
1301
+ return this.client.listMembers();
1302
+ }
1303
+ /** Invite a member by email (default role `member`). */
1304
+ invite(body) {
1305
+ return this.client.inviteMember(body);
1306
+ }
1307
+ /** Suspend a member (reversible). The owner cannot be suspended. */
1308
+ suspend(userId) {
1309
+ return this.client.suspendMember(userId);
1310
+ }
1311
+ /** Lift a member's suspension. */
1312
+ unsuspend(userId) {
1313
+ return this.client.unsuspendMember(userId);
1314
+ }
1315
+ /** Set a member's role. Refuses to demote the owner. */
1316
+ setRole(userId, role) {
1317
+ return this.client.setMemberRole(userId, { role });
1318
+ }
1319
+ /** Remove a member (terminal; revokes their delegated keys). Owner protected. */
1320
+ remove(userId) {
1321
+ return this.client.removeMember(userId);
1322
+ }
1323
+ /** Re-mint an email-verify token for a pending member. */
1324
+ resendInvite(userId) {
1325
+ return this.client.resendMemberInvite(userId);
1326
+ }
1327
+ };
1244
1328
  var MfaTotp = class {
1245
1329
  constructor(client) {
1246
1330
  this.client = client;
@@ -1558,6 +1642,6 @@ function buildRevokeSigningKeyPayload(args) {
1558
1642
  });
1559
1643
  }
1560
1644
 
1561
- export { DelegatedKeys, MfaNamespace, MfaRecoveryCodes, MfaTotp, OWNER_OP, OauthNamespace, OauthSessions, OrgUsers, SigningKeys, Subscriptions, WitniumchainAdminClient, WitniumchainApiError, WitniumchainChainAdminClient, WitniumchainClient, WitniumchainOrgClient, buildAddSigningKeyPayload, buildPausePayload, buildRevokeSigningKeyPayload, buildUnpausePayload, defaultVerifierStorage };
1645
+ export { DelegatedKeys, MfaNamespace, MfaRecoveryCodes, MfaTotp, OWNER_OP, OauthNamespace, OauthSessions, OrgMembers, OrgUsers, SigningKeys, Subscriptions, WitniumchainAdminClient, WitniumchainApiError, WitniumchainChainAdminClient, WitniumchainClient, WitniumchainOrgClient, buildAddSigningKeyPayload, buildPausePayload, buildRevokeSigningKeyPayload, buildUnpausePayload, defaultVerifierStorage };
1562
1646
  //# sourceMappingURL=index.mjs.map
1563
1647
  //# sourceMappingURL=index.mjs.map