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