diff --git a/dist/bin.js b/dist/bin.js old mode 100644 new mode 100755 diff --git a/dist/commands/resources.js b/dist/commands/resources.js index a397053..93e7264 100644 --- a/dist/commands/resources.js +++ b/dist/commands/resources.js @@ -110,7 +110,10 @@ function tableCmd() { (0, output_1.printJson)(table); else { const t = table; - (0, output_1.printKv)([['id', t.id], ['name', t.name]]); + (0, output_1.printKv)([ + ['id', t.id], + ['name', t.name], + ]); } })); cmd @@ -197,7 +200,11 @@ function fieldCmd() { (0, output_1.printJson)(field); else { const f = field; - (0, output_1.printKv)([['id', f.id], ['name', f.name], ['type', f.type]]); + (0, output_1.printKv)([ + ['id', f.id], + ['name', f.name], + ['type', f.type], + ]); } })); cmd @@ -364,8 +371,7 @@ function recordCmd() { .split(',') .map((s) => s.trim()) .filter(Boolean); - const body = { records: ids }; - const result = await ctx.client.deleteRecord(opts.tableId, body); + const result = await ctx.client.deleteRecords(opts.tableId, ids); if (ctx.json) (0, output_1.printJson)(result); else @@ -428,7 +434,11 @@ function viewCmd() { (0, output_1.printJson)(view); else { const v = view; - (0, output_1.printKv)([['id', v.id], ['name', v.name], ['type', v.type]]); + (0, output_1.printKv)([ + ['id', v.id], + ['name', v.name], + ['type', v.type], + ]); } })); cmd diff --git a/dist/lib/client.js b/dist/lib/client.js index 46f6966..01af9b4 100644 --- a/dist/lib/client.js +++ b/dist/lib/client.js @@ -59,8 +59,9 @@ class Client { updateTable(tableId, body) { return this.call('PUT', `/api/table/${tableId}`, body); } - deleteTable(tableId) { - return this.call('DELETE', `/api/table/${tableId}`); + deleteTable(tableId, baseId) { + const base = baseId ?? this.cfg.baseId; + return this.call('DELETE', `/api/base/${base}/table/${tableId}`); } // ---- field ---- listFields(tableId) { @@ -116,8 +117,9 @@ class Client { updateRecordOne(recordId, body) { return this.call('PATCH', `/api/record/${recordId}`, body); } - deleteRecord(tableId, body) { - return this.call('DELETE', `/api/table/${tableId}/record`, body); + deleteRecords(tableId, recordIds) { + const qs = recordIds.map((id) => `recordIds=${encodeURIComponent(id)}`).join('&'); + return this.call('DELETE', `/api/table/${tableId}/record?${qs}`); } // ---- view ---- listViews(tableId) {