@mitumba/sdk 5.16.0 → 5.17.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 +98 -3
- package/dist/index.d.ts +98 -3
- package/dist/index.js +25 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -291,7 +291,13 @@ var APIClient = class {
|
|
|
291
291
|
*/
|
|
292
292
|
async send(method, path, body, params, options) {
|
|
293
293
|
if (!isSessionEndpoint(path)) {
|
|
294
|
-
|
|
294
|
+
try {
|
|
295
|
+
await this.ensureFreshToken(options);
|
|
296
|
+
} catch (error) {
|
|
297
|
+
if (!(error instanceof InvalidRefreshCredentialsError)) throw error;
|
|
298
|
+
this.config.onAuthExpired?.();
|
|
299
|
+
throw new APIError(401, { error: "session_expired", message: "Session expired. Please log in again." });
|
|
300
|
+
}
|
|
295
301
|
}
|
|
296
302
|
const url = new URL(path, this.config.baseUrl);
|
|
297
303
|
if (params) {
|
|
@@ -2485,6 +2491,24 @@ var AdminModule = class {
|
|
|
2485
2491
|
async getLibraryDocument(slug, options) {
|
|
2486
2492
|
return this.client.get(`/admin/library/${encodeURIComponent(slug)}`, void 0, options);
|
|
2487
2493
|
}
|
|
2494
|
+
/**
|
|
2495
|
+
* Record one occurrence of a scheduled routine as done, with an optional note (at most 500
|
|
2496
|
+
* characters). Only an operator whose role is in the document's audience may record it
|
|
2497
|
+
* (`LibraryDocument.can_record`); the librarian's `library:read_all` alone is not enough.
|
|
2498
|
+
*
|
|
2499
|
+
* `dueOn` (YYYY-MM-DD) must be one of the routine's due days, no more than 45 days old and no
|
|
2500
|
+
* further ahead than its notice. Errors: 403 not in the audience, 404 not readable, 409 already
|
|
2501
|
+
* recorded (the body carries the existing `occurrence`), 422 `invalid_occurrence` with a `reason`
|
|
2502
|
+
* (`not_scheduled`, `not_a_due_day`, `too_early`, `too_old`). Recorded on the audit trail as
|
|
2503
|
+
* `library.routine.completed`.
|
|
2504
|
+
*/
|
|
2505
|
+
async completeLibraryOccurrence(slug, dueOn, note, options) {
|
|
2506
|
+
return this.client.post(
|
|
2507
|
+
`/admin/library/${encodeURIComponent(slug)}/occurrences/${encodeURIComponent(dueOn)}/complete`,
|
|
2508
|
+
note ? { note } : {},
|
|
2509
|
+
options
|
|
2510
|
+
);
|
|
2511
|
+
}
|
|
2488
2512
|
// ── Payout approval ──
|
|
2489
2513
|
async listPayoutsAwaitingApproval(options) {
|
|
2490
2514
|
return this.client.get("/admin/payouts/pending-approval", void 0, options);
|