zam-core 0.3.12 → 0.3.13
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/cli/index.js +32 -13
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +10 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -509,8 +509,10 @@ declare function deleteCardForUser(db: Database, tokenId: string, userId: string
|
|
|
509
509
|
* then by due_at ascending (oldest first).
|
|
510
510
|
*
|
|
511
511
|
* Ported from the PoC's due-tokens command.
|
|
512
|
+
*
|
|
513
|
+
* When `domain` is set, only due cards in that token domain are returned.
|
|
512
514
|
*/
|
|
513
|
-
declare function getDueCards(db: Database, userId: string, now?: string): Promise<DueCard[]>;
|
|
515
|
+
declare function getDueCards(db: Database, userId: string, now?: string, domain?: string): Promise<DueCard[]>;
|
|
514
516
|
/**
|
|
515
517
|
* Get all blocked cards for a user.
|
|
516
518
|
*
|
package/dist/index.js
CHANGED
|
@@ -1347,8 +1347,17 @@ async function deleteCardForUser(db, tokenId, userId) {
|
|
|
1347
1347
|
await db.prepare("DELETE FROM cards WHERE id = ?").run(card.id);
|
|
1348
1348
|
return { card, impact };
|
|
1349
1349
|
}
|
|
1350
|
-
async function getDueCards(db, userId, now) {
|
|
1350
|
+
async function getDueCards(db, userId, now, domain) {
|
|
1351
1351
|
const cutoff = now ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
1352
|
+
if (domain) {
|
|
1353
|
+
return await db.prepare(
|
|
1354
|
+
`SELECT c.*, t.slug, t.concept, t.domain, t.bloom_level
|
|
1355
|
+
FROM cards c
|
|
1356
|
+
JOIN tokens t ON t.id = c.token_id
|
|
1357
|
+
WHERE c.user_id = ? AND c.blocked = 0 AND c.due_at <= ? AND t.domain = ?
|
|
1358
|
+
ORDER BY t.bloom_level ASC, c.due_at ASC`
|
|
1359
|
+
).all(userId, cutoff, domain);
|
|
1360
|
+
}
|
|
1352
1361
|
return await db.prepare(
|
|
1353
1362
|
`SELECT c.*, t.slug, t.concept, t.domain, t.bloom_level
|
|
1354
1363
|
FROM cards c
|