bkper 4.21.0 → 4.22.0
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/lib/commands/files/delete.d.ts +10 -0
- package/lib/commands/files/delete.d.ts.map +1 -0
- package/lib/commands/files/delete.js +29 -0
- package/lib/commands/files/delete.js.map +1 -0
- package/lib/commands/files/index.d.ts +1 -0
- package/lib/commands/files/index.d.ts.map +1 -1
- package/lib/commands/files/index.js +1 -0
- package/lib/commands/files/index.js.map +1 -1
- package/lib/commands/files/register.d.ts.map +1 -1
- package/lib/commands/files/register.js +10 -1
- package/lib/commands/files/register.js.map +1 -1
- package/lib/docs/cli/data-management.md +4 -0
- package/package.json +3 -3
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { File as BkperFile } from 'bkper-js';
|
|
2
|
+
/**
|
|
3
|
+
* Deletes a file from the specified book.
|
|
4
|
+
*
|
|
5
|
+
* @param bookId - The ID of the book containing the file
|
|
6
|
+
* @param fileId - The ID of the file to delete
|
|
7
|
+
* @returns The removed file
|
|
8
|
+
*/
|
|
9
|
+
export declare function deleteFile(bookId: string, fileId: string): Promise<BkperFile>;
|
|
10
|
+
//# sourceMappingURL=delete.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../src/commands/files/delete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,UAAU,CAAC;AAG7C;;;;;;GAMG;AACH,wBAAsB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CASnF"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { getBkperInstance } from '../../bkper-factory.js';
|
|
11
|
+
/**
|
|
12
|
+
* Deletes a file from the specified book.
|
|
13
|
+
*
|
|
14
|
+
* @param bookId - The ID of the book containing the file
|
|
15
|
+
* @param fileId - The ID of the file to delete
|
|
16
|
+
* @returns The removed file
|
|
17
|
+
*/
|
|
18
|
+
export function deleteFile(bookId, fileId) {
|
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
const bkper = getBkperInstance();
|
|
21
|
+
const book = yield bkper.getBook(bookId);
|
|
22
|
+
const file = yield book.getFile(fileId);
|
|
23
|
+
if (!file) {
|
|
24
|
+
throw new Error(`File not found: ${fileId}`);
|
|
25
|
+
}
|
|
26
|
+
return file.remove();
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=delete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../src/commands/files/delete.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D;;;;;;GAMG;AACH,MAAM,UAAgB,UAAU,CAAC,MAAc,EAAE,MAAc;;QAC3D,MAAM,KAAK,GAAG,gBAAgB,EAAE,CAAC;QACjC,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACzC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACxC,IAAI,CAAC,IAAI,EAAE,CAAC;YACR,MAAM,IAAI,KAAK,CAAC,mBAAmB,MAAM,EAAE,CAAC,CAAC;QACjD,CAAC;QAED,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC;IACzB,CAAC;CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/files/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/files/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/files/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAoB,MAAM,WAAW,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAqB,MAAM,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/files/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAoB,MAAM,WAAW,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAqB,MAAM,aAAa,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../src/commands/files/register.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOzC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../src/commands/files/register.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOzC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAsE3D"}
|
|
@@ -11,7 +11,7 @@ import { withAction } from '../action.js';
|
|
|
11
11
|
import { collectProperty, parsePositiveInteger } from '../cli-helpers.js';
|
|
12
12
|
import { renderItem, renderListResult } from '../../render/index.js';
|
|
13
13
|
import { validateRequiredOptions, throwIfErrors } from '../../utils/validation.js';
|
|
14
|
-
import { getFile, listFilesFormatted, uploadFile } from './index.js';
|
|
14
|
+
import { deleteFile, getFile, listFilesFormatted, uploadFile } from './index.js';
|
|
15
15
|
export function registerFileCommands(program) {
|
|
16
16
|
const fileCommand = program.command('file').description('Manage Files');
|
|
17
17
|
fileCommand
|
|
@@ -34,6 +34,15 @@ export function registerFileCommands(program) {
|
|
|
34
34
|
const file = yield getFile(options.book, fileId);
|
|
35
35
|
renderItem(file.json(), format);
|
|
36
36
|
}))());
|
|
37
|
+
fileCommand
|
|
38
|
+
.command('delete <fileId>')
|
|
39
|
+
.description('Delete a file by ID')
|
|
40
|
+
.option('-b, --book <bookId>', 'Book ID')
|
|
41
|
+
.action((fileId, options) => withAction('deleting file', (format) => __awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
throwIfErrors(validateRequiredOptions(options, [{ name: 'book', flag: '--book' }]));
|
|
43
|
+
const file = yield deleteFile(options.book, fileId);
|
|
44
|
+
renderItem(file.json(), format);
|
|
45
|
+
}))());
|
|
37
46
|
fileCommand
|
|
38
47
|
.command('upload <path>')
|
|
39
48
|
.description('Upload a local file to a book')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../../src/commands/files/register.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AACnF,OAAO,EAAE,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../../src/commands/files/register.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAEjF,MAAM,UAAU,oBAAoB,CAAC,OAAgB;IACjD,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;IAExE,WAAW;SACN,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,sBAAsB,CAAC;SACnC,MAAM,CAAC,qBAAqB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V,CAAC"}
|
|
@@ -187,6 +187,9 @@ bkper file upload ./receipt.jpg -b abc123
|
|
|
187
187
|
# Get a file by id
|
|
188
188
|
bkper file get file_123 -b abc123
|
|
189
189
|
|
|
190
|
+
# Delete a file by id
|
|
191
|
+
bkper file delete file_123 -b abc123
|
|
192
|
+
|
|
190
193
|
# Upload and resolve an account to canonical account_id
|
|
191
194
|
bkper file upload ./statement.pdf -b abc123 --account "Credit Card"
|
|
192
195
|
|
|
@@ -204,6 +207,7 @@ Use `-p group_id=...` for group-based routing. The CLI infers `contentType` from
|
|
|
204
207
|
- `--limit <number>` - Page size (default `100`)
|
|
205
208
|
- `--cursor <cursor>` - Cursor for fetching the next page
|
|
206
209
|
- `file get <fileId> -b <bookId>` - Get a file by ID
|
|
210
|
+
- `file delete <fileId> -b <bookId>` - Delete a file by ID
|
|
207
211
|
- `file upload <path> -b <bookId>` - Upload a local file to a book
|
|
208
212
|
- `--account <accountIdOrName>` - Resolve an account by name or id and persist canonical `account_id=<resolvedAccountId>`
|
|
209
213
|
- `-p, --property <key=value>` - Set a property (repeatable, empty value deletes)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bkper",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.22.0",
|
|
4
4
|
"description": "Command line client for Bkper",
|
|
5
5
|
"bin": {
|
|
6
6
|
"bkper": "./lib/cli.js"
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@earendil-works/pi-coding-agent": "0.81.1",
|
|
56
|
-
"bkper-js": "^2.
|
|
56
|
+
"bkper-js": "^2.42.0",
|
|
57
57
|
"commander": "^13.1.0",
|
|
58
58
|
"dotenv": "^8.2.0",
|
|
59
59
|
"esbuild": "^0.27.2",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"yaml": "^2.5.1"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
|
-
"@bkper/bkper-api-types": "^5.
|
|
67
|
+
"@bkper/bkper-api-types": "^5.44.0",
|
|
68
68
|
"@types/chai": "^4.3.0",
|
|
69
69
|
"@types/mocha": "^10.0.0",
|
|
70
70
|
"@types/node": "^22.5.1",
|