@mitumba/sdk 1.29.0 → 1.30.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 +422 -176
- package/dist/index.d.ts +422 -176
- package/dist/index.js +128 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +128 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -182,7 +182,7 @@ var APIClient = class {
|
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
|
-
const headers = new Headers();
|
|
185
|
+
const headers = new Headers(options?.headers);
|
|
186
186
|
if (body && !(body instanceof FormData)) {
|
|
187
187
|
headers.set("Content-Type", "application/json");
|
|
188
188
|
}
|
|
@@ -478,6 +478,80 @@ var AuthModule = class {
|
|
|
478
478
|
await this.client.setSession(result);
|
|
479
479
|
return result;
|
|
480
480
|
}
|
|
481
|
+
/**
|
|
482
|
+
* One-time root bootstrap. The setup secret travels in a header and is never part of the JSON
|
|
483
|
+
* body, where an error logger or request capture is more likely to record it.
|
|
484
|
+
*/
|
|
485
|
+
async setupRoot(input, options) {
|
|
486
|
+
const { setup_secret, ...body } = input;
|
|
487
|
+
return this.client.post(
|
|
488
|
+
"/auth/root/setup",
|
|
489
|
+
body,
|
|
490
|
+
{ ...options, headers: { ...options?.headers, "X-Root-Setup-Secret": setup_secret } }
|
|
491
|
+
);
|
|
492
|
+
}
|
|
493
|
+
// ── Capabilities and backup-code lifecycle ──
|
|
494
|
+
/** Public auth-mode document. Never requires or changes the session. */
|
|
495
|
+
async capabilities(options) {
|
|
496
|
+
return this.client.get("/auth/capabilities", void 0, options);
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* Replace every backup code after re-proving the current password.
|
|
500
|
+
*
|
|
501
|
+
* The result is intentionally not persisted by the SDK: codes are shown once, and storing them in
|
|
502
|
+
* a browser turns a recovery credential into something a stolen session can read.
|
|
503
|
+
*/
|
|
504
|
+
async regenerateBackupCodes(currentPassword, options) {
|
|
505
|
+
return this.client.post(
|
|
506
|
+
"/auth/2fa/backup-codes/regenerate",
|
|
507
|
+
{ current_password: currentPassword },
|
|
508
|
+
options
|
|
509
|
+
);
|
|
510
|
+
}
|
|
511
|
+
// ── Assisted account recovery ──
|
|
512
|
+
async requestRecovery(input, options) {
|
|
513
|
+
return this.client.post("/auth/recovery/request", input, options);
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* Cancel with the token from the email. Always returns ok, whether it was valid or already used,
|
|
517
|
+
* so this cannot be used to probe for live recoveries.
|
|
518
|
+
*/
|
|
519
|
+
async cancelRecovery(token, options) {
|
|
520
|
+
return this.client.post("/auth/recovery/cancel", { token }, options);
|
|
521
|
+
}
|
|
522
|
+
async recoveryStatus(tempToken, options) {
|
|
523
|
+
return this.client.get("/auth/recovery/status", { temp_token: tempToken }, options);
|
|
524
|
+
}
|
|
525
|
+
/**
|
|
526
|
+
* Complete with a fresh temp token once cooling-off ends. Tokens are persisted; backup codes are
|
|
527
|
+
* returned to the caller only and never stored.
|
|
528
|
+
*/
|
|
529
|
+
async completeRecovery(tempToken, options) {
|
|
530
|
+
const result = await this.client.post("/auth/recovery/complete", { temp_token: tempToken }, options);
|
|
531
|
+
await this.client.setSession(result);
|
|
532
|
+
return result;
|
|
533
|
+
}
|
|
534
|
+
// ── Account recovery review (requires recovery:review) ──
|
|
535
|
+
async listRecoveryRequests(status = "pending", options) {
|
|
536
|
+
return this.client.get("/auth/recovery/queue", { status }, options);
|
|
537
|
+
}
|
|
538
|
+
async approveRecovery(id, reviewNote, options) {
|
|
539
|
+
return this.client.post(
|
|
540
|
+
`/auth/recovery/${id}/approve`,
|
|
541
|
+
{ review_note: reviewNote },
|
|
542
|
+
options
|
|
543
|
+
);
|
|
544
|
+
}
|
|
545
|
+
async rejectRecovery(id, reviewNote, options) {
|
|
546
|
+
return this.client.post(
|
|
547
|
+
`/auth/recovery/${id}/reject`,
|
|
548
|
+
{ review_note: reviewNote },
|
|
549
|
+
options
|
|
550
|
+
);
|
|
551
|
+
}
|
|
552
|
+
async recoveryEvents(id, options) {
|
|
553
|
+
return this.client.get(`/auth/recovery/${id}/events`, void 0, options);
|
|
554
|
+
}
|
|
481
555
|
};
|
|
482
556
|
|
|
483
557
|
// src/modules/listings.ts
|
|
@@ -1244,9 +1318,16 @@ var AdminModule = class {
|
|
|
1244
1318
|
this.client = client;
|
|
1245
1319
|
}
|
|
1246
1320
|
client;
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1321
|
+
async blockIp(ip, reasonOrDuration = 24, durationOrOptions, maybeOptions) {
|
|
1322
|
+
const modern = typeof reasonOrDuration === "string";
|
|
1323
|
+
const reason = modern ? reasonOrDuration : "No reason supplied by legacy SDK caller";
|
|
1324
|
+
const durationHours = modern ? typeof durationOrOptions === "number" ? durationOrOptions : 24 : reasonOrDuration;
|
|
1325
|
+
const options = modern ? typeof durationOrOptions === "object" ? durationOrOptions : maybeOptions : typeof durationOrOptions === "object" ? durationOrOptions : void 0;
|
|
1326
|
+
return this.client.post(
|
|
1327
|
+
"/admin/block-ip",
|
|
1328
|
+
{ ip, reason, duration_hours: durationHours },
|
|
1329
|
+
options
|
|
1330
|
+
);
|
|
1250
1331
|
}
|
|
1251
1332
|
async unblockIp(ip, options) {
|
|
1252
1333
|
return this.client.post("/admin/unblock-ip", { ip }, options);
|
|
@@ -1367,6 +1448,49 @@ var AdminModule = class {
|
|
|
1367
1448
|
async reinstateVaziOutfit(outfitId, options) {
|
|
1368
1449
|
return this.client.post(`/admin/vazi/outfits/${outfitId}/reinstate`, void 0, options);
|
|
1369
1450
|
}
|
|
1451
|
+
// ── Operators, roles, and audit ──
|
|
1452
|
+
async listOperators(options) {
|
|
1453
|
+
return this.client.get("/admin/operators", void 0, options);
|
|
1454
|
+
}
|
|
1455
|
+
async listAdminRoles(options) {
|
|
1456
|
+
return this.client.get("/admin/roles", void 0, options);
|
|
1457
|
+
}
|
|
1458
|
+
async grantOperatorPermission(userId, permission, options) {
|
|
1459
|
+
return this.client.post(`/admin/operators/${userId}/permissions`, { permission }, options);
|
|
1460
|
+
}
|
|
1461
|
+
async revokeOperatorPermission(userId, permission, options) {
|
|
1462
|
+
return this.client.delete(`/admin/operators/${userId}/permissions/${encodeURIComponent(permission)}`, void 0, options);
|
|
1463
|
+
}
|
|
1464
|
+
async grantOperatorRole(userId, role, options) {
|
|
1465
|
+
return this.client.post(`/admin/operators/${userId}/roles`, { role }, options);
|
|
1466
|
+
}
|
|
1467
|
+
async getAuditLog(limit = 100, options) {
|
|
1468
|
+
return this.client.get("/admin/audit", { limit }, options);
|
|
1469
|
+
}
|
|
1470
|
+
// ── Payout approval ──
|
|
1471
|
+
async listPayoutsAwaitingApproval(options) {
|
|
1472
|
+
return this.client.get("/admin/payouts/pending-approval", void 0, options);
|
|
1473
|
+
}
|
|
1474
|
+
async approvePayout(payoutId, options) {
|
|
1475
|
+
return this.client.post(`/admin/payouts/${payoutId}/approve`, void 0, options);
|
|
1476
|
+
}
|
|
1477
|
+
async holdPayout(payoutId, reason, options) {
|
|
1478
|
+
return this.client.post(`/admin/payouts/${payoutId}/hold`, { reason }, options);
|
|
1479
|
+
}
|
|
1480
|
+
/** Repair a Daraja payout whose provider reference failed to persist. */
|
|
1481
|
+
async repairPayoutCorrelation(payoutId, providerRef, options) {
|
|
1482
|
+
return this.client.post(`/admin/payouts/${payoutId}/correlation`, { provider_ref: providerRef }, options);
|
|
1483
|
+
}
|
|
1484
|
+
// ── Wholesale moderation ──
|
|
1485
|
+
async listPendingWholesaleStores(options) {
|
|
1486
|
+
return this.client.get("/admin/wholesale/pending", void 0, options);
|
|
1487
|
+
}
|
|
1488
|
+
async verifyWholesaleStore(storeId, options) {
|
|
1489
|
+
return this.client.post(`/admin/wholesale/stores/${storeId}/verify`, void 0, options);
|
|
1490
|
+
}
|
|
1491
|
+
async unverifyWholesaleStore(storeId, options) {
|
|
1492
|
+
return this.client.post(`/admin/wholesale/stores/${storeId}/unverify`, void 0, options);
|
|
1493
|
+
}
|
|
1370
1494
|
// ── Broadcast ──
|
|
1371
1495
|
async broadcast(input, options) {
|
|
1372
1496
|
return this.client.post("/admin/broadcast", input, options);
|