@witnium-tech/witniumchain 0.7.0 → 0.9.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.d.mts +977 -1
- package/dist/index.d.ts +977 -1
- package/dist/index.js +96 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +96 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -121,6 +121,8 @@ var WitniumchainClient = class {
|
|
|
121
121
|
oauth;
|
|
122
122
|
/** MFA self-management. Accessed as `client.mfa.totp.*` and `client.mfa.recoveryCodes.*`. */
|
|
123
123
|
mfa;
|
|
124
|
+
/** Session-cookie team management (org-admin only). `client.orgUsers.*`. */
|
|
125
|
+
orgUsers;
|
|
124
126
|
constructor(config) {
|
|
125
127
|
if (!config.baseUrl) {
|
|
126
128
|
throw new Error("WitniumchainClient: baseUrl is required");
|
|
@@ -144,6 +146,7 @@ var WitniumchainClient = class {
|
|
|
144
146
|
this.keys = new SigningKeys(this);
|
|
145
147
|
this.oauth = new OauthNamespace(this);
|
|
146
148
|
this.mfa = new MfaNamespace(this);
|
|
149
|
+
this.orgUsers = new OrgMembers(this);
|
|
147
150
|
}
|
|
148
151
|
/**
|
|
149
152
|
* Convenience alias for {@link getAccount} — returns the authenticated
|
|
@@ -171,6 +174,53 @@ var WitniumchainClient = class {
|
|
|
171
174
|
createOrg(body) {
|
|
172
175
|
return this.req("POST", "/v1/orgs", { auth: "Public", body });
|
|
173
176
|
}
|
|
177
|
+
// ── Team management (session-cookie; org-admin only) ──────────────────────
|
|
178
|
+
// Backing methods for the `orgUsers` namespace. All resolve the caller's
|
|
179
|
+
// org + org-admin role server-side from the session — no orgId in the path.
|
|
180
|
+
listMembers() {
|
|
181
|
+
return this.req("GET", "/v1/orgs/me/members", { auth: "SessionCookie" });
|
|
182
|
+
}
|
|
183
|
+
inviteMember(body) {
|
|
184
|
+
return this.req("POST", "/v1/orgs/me/members/invite", {
|
|
185
|
+
auth: "SessionCookie",
|
|
186
|
+
body
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
suspendMember(userId) {
|
|
190
|
+
return this.req(
|
|
191
|
+
"POST",
|
|
192
|
+
`/v1/orgs/me/members/${encodeURIComponent(userId)}/suspend`,
|
|
193
|
+
{ auth: "SessionCookie" }
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
unsuspendMember(userId) {
|
|
197
|
+
return this.req(
|
|
198
|
+
"POST",
|
|
199
|
+
`/v1/orgs/me/members/${encodeURIComponent(userId)}/unsuspend`,
|
|
200
|
+
{ auth: "SessionCookie" }
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
setMemberRole(userId, body) {
|
|
204
|
+
return this.req(
|
|
205
|
+
"PUT",
|
|
206
|
+
`/v1/orgs/me/members/${encodeURIComponent(userId)}/role`,
|
|
207
|
+
{ auth: "SessionCookie", body }
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
removeMember(userId) {
|
|
211
|
+
return this.req(
|
|
212
|
+
"DELETE",
|
|
213
|
+
`/v1/orgs/me/members/${encodeURIComponent(userId)}`,
|
|
214
|
+
{ auth: "SessionCookie" }
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
resendMemberInvite(userId) {
|
|
218
|
+
return this.req(
|
|
219
|
+
"POST",
|
|
220
|
+
`/v1/orgs/me/members/${encodeURIComponent(userId)}/resend-invite`,
|
|
221
|
+
{ auth: "SessionCookie" }
|
|
222
|
+
);
|
|
223
|
+
}
|
|
174
224
|
verifyEmail(token) {
|
|
175
225
|
return this.req("GET", "/v1/auth/verify", {
|
|
176
226
|
auth: "Public",
|
|
@@ -425,6 +475,17 @@ var WitniumchainClient = class {
|
|
|
425
475
|
deleteAccount() {
|
|
426
476
|
return this.req("DELETE", "/v1/account", { auth: "SessionCookie" });
|
|
427
477
|
}
|
|
478
|
+
/**
|
|
479
|
+
* Re-mint a provisioning token for a verified-but-not-yet-provisioned
|
|
480
|
+
* account. Use when the token from `verifyEmail` was lost (e.g. the verify
|
|
481
|
+
* link was opened on a different device). Throws 409 if the email isn't
|
|
482
|
+
* verified or a contract already exists; rate-limited per account.
|
|
483
|
+
*/
|
|
484
|
+
reissueProvisioningToken() {
|
|
485
|
+
return this.req("POST", "/v1/account/provisioning-token/reissue", {
|
|
486
|
+
auth: "SessionCookie"
|
|
487
|
+
});
|
|
488
|
+
}
|
|
428
489
|
// ────────────────────────────────────────────────────────────────────────
|
|
429
490
|
// MFA (/v1/account/mfa/*)
|
|
430
491
|
//
|
|
@@ -1243,6 +1304,40 @@ var MfaNamespace = class {
|
|
|
1243
1304
|
this.recoveryCodes = new MfaRecoveryCodes(client);
|
|
1244
1305
|
}
|
|
1245
1306
|
};
|
|
1307
|
+
var OrgMembers = class {
|
|
1308
|
+
constructor(client) {
|
|
1309
|
+
this.client = client;
|
|
1310
|
+
}
|
|
1311
|
+
client;
|
|
1312
|
+
/** List the caller's org members (role, suspendedAt, isOwner, keys). */
|
|
1313
|
+
list() {
|
|
1314
|
+
return this.client.listMembers();
|
|
1315
|
+
}
|
|
1316
|
+
/** Invite a member by email (default role `member`). */
|
|
1317
|
+
invite(body) {
|
|
1318
|
+
return this.client.inviteMember(body);
|
|
1319
|
+
}
|
|
1320
|
+
/** Suspend a member (reversible). The owner cannot be suspended. */
|
|
1321
|
+
suspend(userId) {
|
|
1322
|
+
return this.client.suspendMember(userId);
|
|
1323
|
+
}
|
|
1324
|
+
/** Lift a member's suspension. */
|
|
1325
|
+
unsuspend(userId) {
|
|
1326
|
+
return this.client.unsuspendMember(userId);
|
|
1327
|
+
}
|
|
1328
|
+
/** Set a member's role. Refuses to demote the owner. */
|
|
1329
|
+
setRole(userId, role) {
|
|
1330
|
+
return this.client.setMemberRole(userId, { role });
|
|
1331
|
+
}
|
|
1332
|
+
/** Remove a member (terminal; revokes their delegated keys). Owner protected. */
|
|
1333
|
+
remove(userId) {
|
|
1334
|
+
return this.client.removeMember(userId);
|
|
1335
|
+
}
|
|
1336
|
+
/** Re-mint an email-verify token for a pending member. */
|
|
1337
|
+
resendInvite(userId) {
|
|
1338
|
+
return this.client.resendMemberInvite(userId);
|
|
1339
|
+
}
|
|
1340
|
+
};
|
|
1246
1341
|
var MfaTotp = class {
|
|
1247
1342
|
constructor(client) {
|
|
1248
1343
|
this.client = client;
|
|
@@ -1567,6 +1662,7 @@ exports.MfaTotp = MfaTotp;
|
|
|
1567
1662
|
exports.OWNER_OP = OWNER_OP;
|
|
1568
1663
|
exports.OauthNamespace = OauthNamespace;
|
|
1569
1664
|
exports.OauthSessions = OauthSessions;
|
|
1665
|
+
exports.OrgMembers = OrgMembers;
|
|
1570
1666
|
exports.OrgUsers = OrgUsers;
|
|
1571
1667
|
exports.SigningKeys = SigningKeys;
|
|
1572
1668
|
exports.Subscriptions = Subscriptions;
|