(dirPath: string)
| 1512 | } |
| 1513 | |
| 1514 | private async deleteDescendants(dirPath: string): Promise<void> { |
| 1515 | const pattern = escapeLike(dirPath) + "/%"; |
| 1516 | const T = this.tableName; |
| 1517 | |
| 1518 | const r2Rows = await this.sql.query<{ r2_key: string }>( |
| 1519 | `SELECT r2_key FROM ${T} |
| 1520 | WHERE path LIKE ? ESCAPE ? |
| 1521 | AND storage_backend = 'r2' |
| 1522 | AND r2_key IS NOT NULL`, |
| 1523 | pattern, |
| 1524 | LIKE_ESCAPE |
| 1525 | ); |
| 1526 | |
| 1527 | if (r2Rows.length > 0) { |
| 1528 | const r2 = this.getR2(); |
| 1529 | if (r2) { |
| 1530 | const keys = r2Rows.map((r) => r.r2_key); |
| 1531 | await r2.delete(keys); |
| 1532 | } |
| 1533 | } |
| 1534 | |
| 1535 | await this.sql.run( |
| 1536 | `DELETE FROM ${T} WHERE path LIKE ? ESCAPE ?`, |
| 1537 | pattern, |
| 1538 | LIKE_ESCAPE |
| 1539 | ); |
| 1540 | } |
| 1541 | } |
| 1542 | |
| 1543 | // ── Base64 helpers ─────────────────────────────────────────────────── |
no test coverage detected