bkper 4.0.2 → 4.1.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/CHANGELOG.md +4 -1
- package/README.md +52 -4
- package/lib/auth/local-auth-service.d.ts +12 -0
- package/lib/auth/local-auth-service.d.ts.map +1 -1
- package/lib/auth/local-auth-service.js +12 -0
- package/lib/auth/local-auth-service.js.map +1 -1
- package/lib/cli.js +19 -949
- package/lib/cli.js.map +1 -1
- package/lib/commands/accounts/batch-create.d.ts +10 -0
- package/lib/commands/accounts/batch-create.d.ts.map +1 -0
- package/lib/commands/accounts/batch-create.js +74 -0
- package/lib/commands/accounts/batch-create.js.map +1 -0
- package/lib/commands/accounts/create.d.ts +17 -0
- package/lib/commands/accounts/create.d.ts.map +1 -1
- package/lib/commands/accounts/create.js +8 -0
- package/lib/commands/accounts/create.js.map +1 -1
- package/lib/commands/accounts/delete.d.ts +8 -0
- package/lib/commands/accounts/delete.d.ts.map +1 -1
- package/lib/commands/accounts/delete.js +8 -0
- package/lib/commands/accounts/delete.js.map +1 -1
- package/lib/commands/accounts/get.d.ts +8 -0
- package/lib/commands/accounts/get.d.ts.map +1 -1
- package/lib/commands/accounts/get.js +8 -0
- package/lib/commands/accounts/get.js.map +1 -1
- package/lib/commands/accounts/index.d.ts +2 -1
- package/lib/commands/accounts/index.d.ts.map +1 -1
- package/lib/commands/accounts/index.js +2 -1
- package/lib/commands/accounts/index.js.map +1 -1
- package/lib/commands/accounts/list.d.ts +12 -0
- package/lib/commands/accounts/list.d.ts.map +1 -1
- package/lib/commands/accounts/list.js +25 -0
- package/lib/commands/accounts/list.js.map +1 -1
- package/lib/commands/accounts/register.d.ts +3 -0
- package/lib/commands/accounts/register.d.ts.map +1 -0
- package/lib/commands/accounts/register.js +96 -0
- package/lib/commands/accounts/register.js.map +1 -0
- package/lib/commands/accounts/update.d.ts +18 -0
- package/lib/commands/accounts/update.d.ts.map +1 -1
- package/lib/commands/accounts/update.js +10 -0
- package/lib/commands/accounts/update.js.map +1 -1
- package/lib/commands/action.d.ts +21 -0
- package/lib/commands/action.d.ts.map +1 -0
- package/lib/commands/action.js +36 -0
- package/lib/commands/action.js.map +1 -0
- package/lib/commands/apps/index.d.ts +1 -1
- package/lib/commands/apps/index.d.ts.map +1 -1
- package/lib/commands/apps/index.js +1 -1
- package/lib/commands/apps/index.js.map +1 -1
- package/lib/commands/apps/install.d.ts +7 -0
- package/lib/commands/apps/install.d.ts.map +1 -1
- package/lib/commands/apps/install.js +7 -0
- package/lib/commands/apps/install.js.map +1 -1
- package/lib/commands/apps/list.d.ts +6 -0
- package/lib/commands/apps/list.d.ts.map +1 -1
- package/lib/commands/apps/list.js +20 -0
- package/lib/commands/apps/list.js.map +1 -1
- package/lib/commands/apps/register.d.ts +3 -0
- package/lib/commands/apps/register.d.ts.map +1 -0
- package/lib/commands/apps/register.js +130 -0
- package/lib/commands/apps/register.js.map +1 -0
- package/lib/commands/apps/uninstall.d.ts +8 -0
- package/lib/commands/apps/uninstall.d.ts.map +1 -1
- package/lib/commands/apps/uninstall.js +8 -0
- package/lib/commands/apps/uninstall.js.map +1 -1
- package/lib/commands/balances/list.d.ts +12 -0
- package/lib/commands/balances/list.d.ts.map +1 -1
- package/lib/commands/balances/list.js +16 -1
- package/lib/commands/balances/list.js.map +1 -1
- package/lib/commands/balances/register.d.ts +3 -0
- package/lib/commands/balances/register.d.ts.map +1 -0
- package/lib/commands/balances/register.js +35 -0
- package/lib/commands/balances/register.js.map +1 -0
- package/lib/commands/books/create.d.ts +9 -0
- package/lib/commands/books/create.d.ts.map +1 -1
- package/lib/commands/books/create.js +6 -0
- package/lib/commands/books/create.js.map +1 -1
- package/lib/commands/books/get.d.ts +6 -0
- package/lib/commands/books/get.d.ts.map +1 -1
- package/lib/commands/books/get.js +6 -0
- package/lib/commands/books/get.js.map +1 -1
- package/lib/commands/books/index.d.ts +1 -1
- package/lib/commands/books/index.d.ts.map +1 -1
- package/lib/commands/books/index.js +1 -1
- package/lib/commands/books/index.js.map +1 -1
- package/lib/commands/books/list.d.ts +13 -0
- package/lib/commands/books/list.d.ts.map +1 -1
- package/lib/commands/books/list.js +43 -0
- package/lib/commands/books/list.js.map +1 -1
- package/lib/commands/books/register.d.ts +3 -0
- package/lib/commands/books/register.d.ts.map +1 -0
- package/lib/commands/books/register.js +82 -0
- package/lib/commands/books/register.js.map +1 -0
- package/lib/commands/books/update.d.ts +11 -0
- package/lib/commands/books/update.d.ts.map +1 -1
- package/lib/commands/books/update.js +8 -0
- package/lib/commands/books/update.js.map +1 -1
- package/lib/commands/cli-helpers.d.ts +15 -0
- package/lib/commands/cli-helpers.d.ts.map +1 -0
- package/lib/commands/cli-helpers.js +29 -0
- package/lib/commands/cli-helpers.js.map +1 -0
- package/lib/commands/collections/add-book.d.ts +8 -0
- package/lib/commands/collections/add-book.d.ts.map +1 -1
- package/lib/commands/collections/add-book.js +8 -0
- package/lib/commands/collections/add-book.js.map +1 -1
- package/lib/commands/collections/create.d.ts +9 -0
- package/lib/commands/collections/create.d.ts.map +1 -1
- package/lib/commands/collections/create.js +6 -0
- package/lib/commands/collections/create.js.map +1 -1
- package/lib/commands/collections/delete.d.ts +7 -0
- package/lib/commands/collections/delete.d.ts.map +1 -1
- package/lib/commands/collections/delete.js +7 -0
- package/lib/commands/collections/delete.js.map +1 -1
- package/lib/commands/collections/get.d.ts +7 -0
- package/lib/commands/collections/get.d.ts.map +1 -1
- package/lib/commands/collections/get.js +7 -0
- package/lib/commands/collections/get.js.map +1 -1
- package/lib/commands/collections/index.d.ts +1 -1
- package/lib/commands/collections/index.d.ts.map +1 -1
- package/lib/commands/collections/index.js +1 -1
- package/lib/commands/collections/index.js.map +1 -1
- package/lib/commands/collections/list.d.ts +11 -0
- package/lib/commands/collections/list.d.ts.map +1 -1
- package/lib/commands/collections/list.js +26 -0
- package/lib/commands/collections/list.js.map +1 -1
- package/lib/commands/collections/register.d.ts +3 -0
- package/lib/commands/collections/register.d.ts.map +1 -0
- package/lib/commands/collections/register.js +86 -0
- package/lib/commands/collections/register.js.map +1 -0
- package/lib/commands/collections/remove-book.d.ts +8 -0
- package/lib/commands/collections/remove-book.d.ts.map +1 -1
- package/lib/commands/collections/remove-book.js +8 -0
- package/lib/commands/collections/remove-book.js.map +1 -1
- package/lib/commands/collections/update.d.ts +11 -0
- package/lib/commands/collections/update.d.ts.map +1 -1
- package/lib/commands/collections/update.js +8 -0
- package/lib/commands/collections/update.js.map +1 -1
- package/lib/commands/groups/batch-create.d.ts +10 -0
- package/lib/commands/groups/batch-create.d.ts.map +1 -0
- package/lib/commands/groups/batch-create.js +69 -0
- package/lib/commands/groups/batch-create.js.map +1 -0
- package/lib/commands/groups/create.d.ts +8 -0
- package/lib/commands/groups/create.d.ts.map +1 -1
- package/lib/commands/groups/create.js +7 -0
- package/lib/commands/groups/create.js.map +1 -1
- package/lib/commands/groups/delete.d.ts +7 -0
- package/lib/commands/groups/delete.d.ts.map +1 -1
- package/lib/commands/groups/delete.js +7 -0
- package/lib/commands/groups/delete.js.map +1 -1
- package/lib/commands/groups/get.d.ts +7 -0
- package/lib/commands/groups/get.d.ts.map +1 -1
- package/lib/commands/groups/get.js +7 -0
- package/lib/commands/groups/get.js.map +1 -1
- package/lib/commands/groups/index.d.ts +2 -1
- package/lib/commands/groups/index.d.ts.map +1 -1
- package/lib/commands/groups/index.js +2 -1
- package/lib/commands/groups/index.js.map +1 -1
- package/lib/commands/groups/list.d.ts +12 -0
- package/lib/commands/groups/list.d.ts.map +1 -1
- package/lib/commands/groups/list.js +25 -0
- package/lib/commands/groups/list.js.map +1 -1
- package/lib/commands/groups/register.d.ts +3 -0
- package/lib/commands/groups/register.d.ts.map +1 -0
- package/lib/commands/groups/register.js +90 -0
- package/lib/commands/groups/register.js.map +1 -0
- package/lib/commands/groups/update.d.ts +9 -0
- package/lib/commands/groups/update.d.ts.map +1 -1
- package/lib/commands/groups/update.js +8 -0
- package/lib/commands/groups/update.js.map +1 -1
- package/lib/commands/transactions/batch-create.d.ts +10 -0
- package/lib/commands/transactions/batch-create.d.ts.map +1 -0
- package/lib/commands/transactions/batch-create.js +98 -0
- package/lib/commands/transactions/batch-create.js.map +1 -0
- package/lib/commands/transactions/check.d.ts +7 -0
- package/lib/commands/transactions/check.d.ts.map +1 -1
- package/lib/commands/transactions/check.js +7 -0
- package/lib/commands/transactions/check.js.map +1 -1
- package/lib/commands/transactions/create.d.ts +10 -0
- package/lib/commands/transactions/create.d.ts.map +1 -1
- package/lib/commands/transactions/create.js +8 -2
- package/lib/commands/transactions/create.js.map +1 -1
- package/lib/commands/transactions/index.d.ts +2 -1
- package/lib/commands/transactions/index.d.ts.map +1 -1
- package/lib/commands/transactions/index.js +2 -1
- package/lib/commands/transactions/index.js.map +1 -1
- package/lib/commands/transactions/list.d.ts +20 -0
- package/lib/commands/transactions/list.d.ts.map +1 -1
- package/lib/commands/transactions/list.js +38 -0
- package/lib/commands/transactions/list.js.map +1 -1
- package/lib/commands/transactions/merge.d.ts +12 -0
- package/lib/commands/transactions/merge.d.ts.map +1 -1
- package/lib/commands/transactions/merge.js +9 -0
- package/lib/commands/transactions/merge.js.map +1 -1
- package/lib/commands/transactions/post.d.ts +7 -0
- package/lib/commands/transactions/post.d.ts.map +1 -1
- package/lib/commands/transactions/post.js +7 -0
- package/lib/commands/transactions/post.js.map +1 -1
- package/lib/commands/transactions/register.d.ts +3 -0
- package/lib/commands/transactions/register.d.ts.map +1 -0
- package/lib/commands/transactions/register.js +146 -0
- package/lib/commands/transactions/register.js.map +1 -0
- package/lib/commands/transactions/trash.d.ts +7 -0
- package/lib/commands/transactions/trash.d.ts.map +1 -1
- package/lib/commands/transactions/trash.js +7 -0
- package/lib/commands/transactions/trash.js.map +1 -1
- package/lib/commands/transactions/update.d.ts +11 -0
- package/lib/commands/transactions/update.d.ts.map +1 -1
- package/lib/commands/transactions/update.js +8 -0
- package/lib/commands/transactions/update.js.map +1 -1
- package/lib/input/csv-parser.d.ts +9 -0
- package/lib/input/csv-parser.d.ts.map +1 -0
- package/lib/input/csv-parser.js +110 -0
- package/lib/input/csv-parser.js.map +1 -0
- package/lib/input/format-detector.d.ts +12 -0
- package/lib/input/format-detector.d.ts.map +1 -0
- package/lib/input/format-detector.js +14 -0
- package/lib/input/format-detector.js.map +1 -0
- package/lib/input/index.d.ts +9 -0
- package/lib/input/index.d.ts.map +1 -0
- package/lib/input/index.js +40 -0
- package/lib/input/index.js.map +1 -0
- package/lib/input/stdin-reader.d.ts +8 -0
- package/lib/input/stdin-reader.d.ts.map +1 -0
- package/lib/input/stdin-reader.js +37 -0
- package/lib/input/stdin-reader.js.map +1 -0
- package/lib/render/csv-formatter.d.ts +15 -0
- package/lib/render/csv-formatter.d.ts.map +1 -0
- package/lib/render/csv-formatter.js +37 -0
- package/lib/render/csv-formatter.js.map +1 -0
- package/lib/render/index.d.ts +3 -1
- package/lib/render/index.d.ts.map +1 -1
- package/lib/render/index.js +2 -1
- package/lib/render/index.js.map +1 -1
- package/lib/render/output.d.ts +27 -6
- package/lib/render/output.d.ts.map +1 -1
- package/lib/render/output.js +35 -12
- package/lib/render/output.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/books/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/books/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,UAAU,EAAqB,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAqB,MAAM,aAAa,CAAC"}
|
|
@@ -1,3 +1,16 @@
|
|
|
1
1
|
import { Book } from 'bkper-js';
|
|
2
|
+
import type { OutputFormat, ListResult } from '../../render/output.js';
|
|
3
|
+
/**
|
|
4
|
+
* Lists books matching an optional query string.
|
|
5
|
+
*
|
|
6
|
+
* @param query - Optional search query to filter books
|
|
7
|
+
* @returns Array of matching Book instances
|
|
8
|
+
*/
|
|
2
9
|
export declare function listBooks(query?: string): Promise<Book[]>;
|
|
10
|
+
/**
|
|
11
|
+
* Lists books and returns a ListResult ready for rendering.
|
|
12
|
+
* Absorbs sorting, BooksDataTableBuilder config, and JSON mapping
|
|
13
|
+
* so cli.ts doesn't need to know about any of this.
|
|
14
|
+
*/
|
|
15
|
+
export declare function listBooksFormatted(query: string | undefined, format: OutputFormat): Promise<ListResult>;
|
|
3
16
|
//# sourceMappingURL=list.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/books/list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/books/list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAyB,MAAM,UAAU,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEvE;;;;;GAKG;AACH,wBAAsB,SAAS,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAG/D;AAED;;;;GAIG;AACH,wBAAsB,kBAAkB,CACpC,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,MAAM,EAAE,YAAY,GACrB,OAAO,CAAC,UAAU,CAAC,CA6BrB"}
|
|
@@ -8,10 +8,53 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { getBkperInstance } from '../../bkper-factory.js';
|
|
11
|
+
import { BooksDataTableBuilder } from 'bkper-js';
|
|
12
|
+
/**
|
|
13
|
+
* Lists books matching an optional query string.
|
|
14
|
+
*
|
|
15
|
+
* @param query - Optional search query to filter books
|
|
16
|
+
* @returns Array of matching Book instances
|
|
17
|
+
*/
|
|
11
18
|
export function listBooks(query) {
|
|
12
19
|
return __awaiter(this, void 0, void 0, function* () {
|
|
13
20
|
const bkper = getBkperInstance();
|
|
14
21
|
return bkper.getBooks(query);
|
|
15
22
|
});
|
|
16
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Lists books and returns a ListResult ready for rendering.
|
|
26
|
+
* Absorbs sorting, BooksDataTableBuilder config, and JSON mapping
|
|
27
|
+
* so cli.ts doesn't need to know about any of this.
|
|
28
|
+
*/
|
|
29
|
+
export function listBooksFormatted(query, format) {
|
|
30
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
const books = yield listBooks(query);
|
|
32
|
+
if (format === 'json') {
|
|
33
|
+
return { kind: 'json', data: books.map(b => b.json()) };
|
|
34
|
+
}
|
|
35
|
+
if (books.length === 0) {
|
|
36
|
+
return { kind: 'matrix', matrix: [['No results found.']] };
|
|
37
|
+
}
|
|
38
|
+
books.sort((a, b) => {
|
|
39
|
+
var _a, _b;
|
|
40
|
+
const collA = (_a = a.getCollection()) === null || _a === void 0 ? void 0 : _a.getName();
|
|
41
|
+
const collB = (_b = b.getCollection()) === null || _b === void 0 ? void 0 : _b.getName();
|
|
42
|
+
if (collA && !collB)
|
|
43
|
+
return -1;
|
|
44
|
+
if (!collA && collB)
|
|
45
|
+
return 1;
|
|
46
|
+
let ret = (collA || '').localeCompare(collB || '');
|
|
47
|
+
if (ret === 0) {
|
|
48
|
+
ret = (a.getName() || '').localeCompare(b.getName() || '');
|
|
49
|
+
}
|
|
50
|
+
return ret;
|
|
51
|
+
});
|
|
52
|
+
const builder = new BooksDataTableBuilder(books).ids(true);
|
|
53
|
+
if (format === 'csv') {
|
|
54
|
+
builder.properties(true).hiddenProperties(true);
|
|
55
|
+
}
|
|
56
|
+
const matrix = builder.build();
|
|
57
|
+
return { kind: 'matrix', matrix };
|
|
58
|
+
});
|
|
59
|
+
}
|
|
17
60
|
//# sourceMappingURL=list.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/books/list.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/books/list.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAQ,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAGvD;;;;;GAKG;AACH,MAAM,UAAgB,SAAS,CAAC,KAAc;;QAC1C,MAAM,KAAK,GAAG,gBAAgB,EAAE,CAAC;QACjC,OAAO,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;CAAA;AAED;;;;GAIG;AACH,MAAM,UAAgB,kBAAkB,CACpC,KAAyB,EACzB,MAAoB;;QAEpB,MAAM,KAAK,GAAG,MAAM,SAAS,CAAC,KAAK,CAAC,CAAC;QAErC,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;YACpB,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC;QAC5D,CAAC;QAED,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACrB,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC,mBAAmB,CAAC,CAAC,EAAE,CAAC;QAC/D,CAAC;QAED,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;;YAChB,MAAM,KAAK,GAAG,MAAA,CAAC,CAAC,aAAa,EAAE,0CAAE,OAAO,EAAE,CAAC;YAC3C,MAAM,KAAK,GAAG,MAAA,CAAC,CAAC,aAAa,EAAE,0CAAE,OAAO,EAAE,CAAC;YAC3C,IAAI,KAAK,IAAI,CAAC,KAAK;gBAAE,OAAO,CAAC,CAAC,CAAC;YAC/B,IAAI,CAAC,KAAK,IAAI,KAAK;gBAAE,OAAO,CAAC,CAAC;YAC9B,IAAI,GAAG,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,aAAa,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;YACnD,IAAI,GAAG,KAAK,CAAC,EAAE,CAAC;gBACZ,GAAG,GAAG,CAAC,CAAC,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;YAC/D,CAAC;YACD,OAAO,GAAG,CAAC;QACf,CAAC,CAAC,CAAC;QAEH,MAAM,OAAO,GAAG,IAAI,qBAAqB,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC3D,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;YACnB,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;QACpD,CAAC;QACD,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;QAC/B,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;IACtC,CAAC;CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../src/commands/books/register.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOzC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAwF3D"}
|
|
@@ -0,0 +1,82 @@
|
|
|
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 { withAction } from '../action.js';
|
|
11
|
+
import { collectProperty } from '../cli-helpers.js';
|
|
12
|
+
import { renderListResult, renderItem } from '../../render/index.js';
|
|
13
|
+
import { validateRequiredOptions, throwIfErrors } from '../../utils/validation.js';
|
|
14
|
+
import { listBooksFormatted, getBook, createBook, updateBook } from './index.js';
|
|
15
|
+
export function registerBookCommands(program) {
|
|
16
|
+
const bookCommand = program.command('book').description('Manage Books');
|
|
17
|
+
bookCommand
|
|
18
|
+
.command('list')
|
|
19
|
+
.description('List all books')
|
|
20
|
+
.option('-q, --query <query>', 'Search query')
|
|
21
|
+
.action(options => withAction('listing books', (format) => __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
const result = yield listBooksFormatted(options.query, format);
|
|
23
|
+
renderListResult(result, format);
|
|
24
|
+
}))());
|
|
25
|
+
bookCommand
|
|
26
|
+
.command('get <bookId>')
|
|
27
|
+
.description('Get a book by ID')
|
|
28
|
+
.action((bookId) => withAction('getting book', (format) => __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
const book = yield getBook(bookId);
|
|
30
|
+
renderItem(book.json(), format);
|
|
31
|
+
}))());
|
|
32
|
+
bookCommand
|
|
33
|
+
.command('create')
|
|
34
|
+
.description('Create a new book')
|
|
35
|
+
.option('--name <name>', 'Book name')
|
|
36
|
+
.option('--fraction-digits <digits>', 'Number of decimal places (0-8)', parseInt)
|
|
37
|
+
.option('--date-pattern <pattern>', 'Date format pattern (dd/MM/yyyy, MM/dd/yyyy, or yyyy/MM/dd)')
|
|
38
|
+
.option('--decimal-separator <separator>', 'Decimal separator (DOT or COMMA)')
|
|
39
|
+
.option('--time-zone <timezone>', 'IANA time zone (e.g. America/New_York, UTC)')
|
|
40
|
+
.option('--period <period>', 'Period (MONTH, QUARTER, or YEAR)')
|
|
41
|
+
.option('-p, --property <key=value>', 'Set a property (repeatable)', collectProperty)
|
|
42
|
+
.action(options => withAction('creating book', (format) => __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
throwIfErrors(validateRequiredOptions(options, [{ name: 'name', flag: '--name' }]));
|
|
44
|
+
const book = yield createBook({
|
|
45
|
+
name: options.name,
|
|
46
|
+
fractionDigits: options.fractionDigits,
|
|
47
|
+
datePattern: options.datePattern,
|
|
48
|
+
decimalSeparator: options.decimalSeparator,
|
|
49
|
+
timeZone: options.timeZone,
|
|
50
|
+
period: options.period,
|
|
51
|
+
property: options.property,
|
|
52
|
+
});
|
|
53
|
+
renderItem(book.json(), format);
|
|
54
|
+
}))());
|
|
55
|
+
bookCommand
|
|
56
|
+
.command('update <bookId>')
|
|
57
|
+
.description('Update a book')
|
|
58
|
+
.option('--name <name>', 'Book name')
|
|
59
|
+
.option('--fraction-digits <digits>', 'Number of decimal places (0-8)', parseInt)
|
|
60
|
+
.option('--date-pattern <pattern>', 'Date format pattern (dd/MM/yyyy, MM/dd/yyyy, or yyyy/MM/dd)')
|
|
61
|
+
.option('--decimal-separator <separator>', 'Decimal separator (DOT or COMMA)')
|
|
62
|
+
.option('--time-zone <timezone>', 'IANA time zone (e.g. America/New_York, UTC)')
|
|
63
|
+
.option('--lock-date <date>', 'Lock date in ISO format (yyyy-MM-dd)')
|
|
64
|
+
.option('--closing-date <date>', 'Closing date in ISO format (yyyy-MM-dd)')
|
|
65
|
+
.option('--period <period>', 'Period (MONTH, QUARTER, or YEAR)')
|
|
66
|
+
.option('-p, --property <key=value>', 'Set a property (repeatable, empty value deletes)', collectProperty)
|
|
67
|
+
.action((bookId, options) => withAction('updating book', (format) => __awaiter(this, void 0, void 0, function* () {
|
|
68
|
+
const book = yield updateBook(bookId, {
|
|
69
|
+
name: options.name,
|
|
70
|
+
fractionDigits: options.fractionDigits,
|
|
71
|
+
datePattern: options.datePattern,
|
|
72
|
+
decimalSeparator: options.decimalSeparator,
|
|
73
|
+
timeZone: options.timeZone,
|
|
74
|
+
lockDate: options.lockDate,
|
|
75
|
+
closingDate: options.closingDate,
|
|
76
|
+
period: options.period,
|
|
77
|
+
property: options.property,
|
|
78
|
+
});
|
|
79
|
+
renderItem(book.json(), format);
|
|
80
|
+
}))());
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=register.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../../src/commands/books/register.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { Book } from 'bkper-js';
|
|
2
|
+
/**
|
|
3
|
+
* Options for updating an existing Bkper book.
|
|
4
|
+
*/
|
|
2
5
|
export interface UpdateBookOptions {
|
|
3
6
|
name?: string;
|
|
4
7
|
fractionDigits?: number;
|
|
@@ -10,5 +13,13 @@ export interface UpdateBookOptions {
|
|
|
10
13
|
period?: 'MONTH' | 'QUARTER' | 'YEAR';
|
|
11
14
|
property?: string[];
|
|
12
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Updates an existing Bkper book with the specified options.
|
|
18
|
+
* Properties with empty values are deleted from the book.
|
|
19
|
+
*
|
|
20
|
+
* @param bookId - The unique identifier of the book to update
|
|
21
|
+
* @param options - Fields to update on the book
|
|
22
|
+
* @returns The updated Book instance
|
|
23
|
+
*/
|
|
13
24
|
export declare function updateBook(bookId: string, options: UpdateBookOptions): Promise<Book>;
|
|
14
25
|
//# sourceMappingURL=update.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../src/commands/books/update.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAA4B,MAAM,UAAU,CAAC;AAI1D,MAAM,WAAW,iBAAiB;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;IACtC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,wBAAsB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAkC1F"}
|
|
1
|
+
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../src/commands/books/update.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAA4B,MAAM,UAAU,CAAC;AAI1D;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;IACtC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAED;;;;;;;GAOG;AACH,wBAAsB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAkC1F"}
|
|
@@ -10,6 +10,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { getBkperInstance } from '../../bkper-factory.js';
|
|
11
11
|
import { parsePropertyFlag } from '../../utils/properties.js';
|
|
12
12
|
import { throwIfErrors } from '../../utils/validation.js';
|
|
13
|
+
/**
|
|
14
|
+
* Updates an existing Bkper book with the specified options.
|
|
15
|
+
* Properties with empty values are deleted from the book.
|
|
16
|
+
*
|
|
17
|
+
* @param bookId - The unique identifier of the book to update
|
|
18
|
+
* @param options - Fields to update on the book
|
|
19
|
+
* @returns The updated Book instance
|
|
20
|
+
*/
|
|
13
21
|
export function updateBook(bookId, options) {
|
|
14
22
|
return __awaiter(this, void 0, void 0, function* () {
|
|
15
23
|
const bkper = getBkperInstance();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../../src/commands/books/update.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../../src/commands/books/update.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAiB1D;;;;;;;GAOG;AACH,MAAM,UAAgB,UAAU,CAAC,MAAc,EAAE,OAA0B;;QACvE,MAAM,KAAK,GAAG,gBAAgB,EAAE,CAAC;QACjC,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAEzC,MAAM,MAAM,GAAa,EAAE,CAAC;QAE5B,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS;YAAE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC3D,IAAI,OAAO,CAAC,cAAc,KAAK,SAAS;YAAE,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;QACzF,IAAI,OAAO,CAAC,WAAW,KAAK,SAAS;YAAE,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAChF,IAAI,OAAO,CAAC,gBAAgB,KAAK,SAAS;YACtC,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,gBAAoC,CAAC,CAAC;QAC3E,IAAI,OAAO,CAAC,QAAQ,KAAK,SAAS;YAAE,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QACvE,IAAI,OAAO,CAAC,QAAQ,KAAK,SAAS;YAAE,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QACvE,IAAI,OAAO,CAAC,WAAW,KAAK,SAAS;YAAE,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAChF,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS;YAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,MAAgB,CAAC,CAAC;QAE3E,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;YACnB,KAAK,MAAM,GAAG,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;gBACjC,IAAI,CAAC;oBACD,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC;oBAC5C,IAAI,KAAK,KAAK,EAAE,EAAE,CAAC;wBACf,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;oBAC7B,CAAC;yBAAM,CAAC;wBACJ,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;oBACjC,CAAC;gBACL,CAAC;gBAAC,OAAO,GAAY,EAAE,CAAC;oBACpB,MAAM,CAAC,IAAI,CAAE,GAAa,CAAC,OAAO,CAAC,CAAC;gBACxC,CAAC;YACL,CAAC;QACL,CAAC;QAED,aAAa,CAAC,MAAM,CAAC,CAAC;QAEtB,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC;IACzB,CAAC;CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { OutputFormat } from '../render/output.js';
|
|
2
|
+
/**
|
|
3
|
+
* Commander option collector for repeatable --property flags.
|
|
4
|
+
*/
|
|
5
|
+
export declare function collectProperty(value: string, previous: string[] | undefined): string[];
|
|
6
|
+
/**
|
|
7
|
+
* Commander option collector for repeatable --book flags.
|
|
8
|
+
*/
|
|
9
|
+
export declare function collectBook(value: string, previous: string[] | undefined): string[];
|
|
10
|
+
/**
|
|
11
|
+
* Returns the active output format, considering both --format and --json flags.
|
|
12
|
+
* --json acts as a silent alias for --format json.
|
|
13
|
+
*/
|
|
14
|
+
export declare function getFormat(): OutputFormat;
|
|
15
|
+
//# sourceMappingURL=cli-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-helpers.d.ts","sourceRoot":"","sources":["../../src/commands/cli-helpers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,SAAS,GAAG,MAAM,EAAE,CAEvF;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,SAAS,GAAG,MAAM,EAAE,CAEnF;AAED;;;GAGG;AACH,wBAAgB,SAAS,IAAI,YAAY,CAUxC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { program } from 'commander';
|
|
2
|
+
/**
|
|
3
|
+
* Commander option collector for repeatable --property flags.
|
|
4
|
+
*/
|
|
5
|
+
export function collectProperty(value, previous) {
|
|
6
|
+
return previous ? [...previous, value] : [value];
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Commander option collector for repeatable --book flags.
|
|
10
|
+
*/
|
|
11
|
+
export function collectBook(value, previous) {
|
|
12
|
+
return previous ? [...previous, value] : [value];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Returns the active output format, considering both --format and --json flags.
|
|
16
|
+
* --json acts as a silent alias for --format json.
|
|
17
|
+
*/
|
|
18
|
+
export function getFormat() {
|
|
19
|
+
const opts = program.opts();
|
|
20
|
+
if (opts.json === true) {
|
|
21
|
+
return 'json';
|
|
22
|
+
}
|
|
23
|
+
const format = opts.format;
|
|
24
|
+
if (format === 'json' || format === 'csv') {
|
|
25
|
+
return format;
|
|
26
|
+
}
|
|
27
|
+
return 'table';
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=cli-helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-helpers.js","sourceRoot":"","sources":["../../src/commands/cli-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,KAAa,EAAE,QAA8B;IACzE,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AACrD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,KAAa,EAAE,QAA8B;IACrE,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AACrD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,SAAS;IACrB,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAC5B,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;QACrB,OAAO,MAAM,CAAC;IAClB,CAAC;IACD,MAAM,MAAM,GAAG,IAAI,CAAC,MAAgB,CAAC;IACrC,IAAI,MAAM,KAAK,MAAM,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;QACxC,OAAO,MAAM,CAAC;IAClB,CAAC;IACD,OAAO,OAAO,CAAC;AACnB,CAAC"}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
import { Book } from 'bkper-js';
|
|
2
|
+
/**
|
|
3
|
+
* Adds one or more books to a collection.
|
|
4
|
+
*
|
|
5
|
+
* @param collectionId - The ID of the collection to add books to
|
|
6
|
+
* @param bookIds - Array of book IDs to add
|
|
7
|
+
* @returns The books that were added to the collection
|
|
8
|
+
* @throws Error if the collection is not found
|
|
9
|
+
*/
|
|
2
10
|
export declare function addBookToCollection(collectionId: string, bookIds: string[]): Promise<Book[]>;
|
|
3
11
|
//# sourceMappingURL=add-book.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-book.d.ts","sourceRoot":"","sources":["../../../src/commands/collections/add-book.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,wBAAsB,mBAAmB,CACrC,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,MAAM,EAAE,GAClB,OAAO,CAAC,IAAI,EAAE,CAAC,CAgBjB"}
|
|
1
|
+
{"version":3,"file":"add-book.d.ts","sourceRoot":"","sources":["../../../src/commands/collections/add-book.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CACrC,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,MAAM,EAAE,GAClB,OAAO,CAAC,IAAI,EAAE,CAAC,CAgBjB"}
|
|
@@ -8,6 +8,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { getBkperInstance } from '../../bkper-factory.js';
|
|
11
|
+
/**
|
|
12
|
+
* Adds one or more books to a collection.
|
|
13
|
+
*
|
|
14
|
+
* @param collectionId - The ID of the collection to add books to
|
|
15
|
+
* @param bookIds - Array of book IDs to add
|
|
16
|
+
* @returns The books that were added to the collection
|
|
17
|
+
* @throws Error if the collection is not found
|
|
18
|
+
*/
|
|
11
19
|
export function addBookToCollection(collectionId, bookIds) {
|
|
12
20
|
return __awaiter(this, void 0, void 0, function* () {
|
|
13
21
|
const bkper = getBkperInstance();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-book.js","sourceRoot":"","sources":["../../../src/commands/collections/add-book.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG1D,MAAM,UAAgB,mBAAmB,CACrC,YAAoB,EACpB,OAAiB;;QAEjB,MAAM,KAAK,GAAG,gBAAgB,EAAE,CAAC;QACjC,MAAM,WAAW,GAAG,MAAM,KAAK,CAAC,cAAc,EAAE,CAAC;QACjD,MAAM,UAAU,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,KAAK,YAAY,CAAC,CAAC;QAErE,IAAI,CAAC,UAAU,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CAAC,yBAAyB,YAAY,EAAE,CAAC,CAAC;QAC7D,CAAC;QAED,MAAM,KAAK,GAAW,EAAE,CAAC;QACzB,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC3B,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YACzC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACrB,CAAC;QAED,OAAO,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC;CAAA"}
|
|
1
|
+
{"version":3,"file":"add-book.js","sourceRoot":"","sources":["../../../src/commands/collections/add-book.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG1D;;;;;;;GAOG;AACH,MAAM,UAAgB,mBAAmB,CACrC,YAAoB,EACpB,OAAiB;;QAEjB,MAAM,KAAK,GAAG,gBAAgB,EAAE,CAAC;QACjC,MAAM,WAAW,GAAG,MAAM,KAAK,CAAC,cAAc,EAAE,CAAC;QACjD,MAAM,UAAU,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,KAAK,YAAY,CAAC,CAAC;QAErE,IAAI,CAAC,UAAU,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CAAC,yBAAyB,YAAY,EAAE,CAAC,CAAC;QAC7D,CAAC;QAED,MAAM,KAAK,GAAW,EAAE,CAAC;QACzB,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC3B,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YACzC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACrB,CAAC;QAED,OAAO,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC;CAAA"}
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { Collection } from 'bkper-js';
|
|
2
|
+
/**
|
|
3
|
+
* Options for creating a new collection.
|
|
4
|
+
*/
|
|
2
5
|
export interface CreateCollectionOptions {
|
|
3
6
|
name: string;
|
|
4
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* Creates a new collection with the given name.
|
|
10
|
+
*
|
|
11
|
+
* @param options - Collection creation options
|
|
12
|
+
* @returns The newly created Collection
|
|
13
|
+
*/
|
|
5
14
|
export declare function createCollection(options: CreateCollectionOptions): Promise<Collection>;
|
|
6
15
|
//# sourceMappingURL=create.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/commands/collections/create.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,MAAM,WAAW,uBAAuB;IACpC,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,UAAU,CAAC,CAI5F"}
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/commands/collections/create.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACpC,IAAI,EAAE,MAAM,CAAC;CAChB;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,UAAU,CAAC,CAI5F"}
|
|
@@ -9,6 +9,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { getBkperInstance } from '../../bkper-factory.js';
|
|
11
11
|
import { Collection } from 'bkper-js';
|
|
12
|
+
/**
|
|
13
|
+
* Creates a new collection with the given name.
|
|
14
|
+
*
|
|
15
|
+
* @param options - Collection creation options
|
|
16
|
+
* @returns The newly created Collection
|
|
17
|
+
*/
|
|
12
18
|
export function createCollection(options) {
|
|
13
19
|
return __awaiter(this, void 0, void 0, function* () {
|
|
14
20
|
const bkper = getBkperInstance();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/commands/collections/create.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/commands/collections/create.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAStC;;;;;GAKG;AACH,MAAM,UAAgB,gBAAgB,CAAC,OAAgC;;QACnE,MAAM,KAAK,GAAG,gBAAgB,EAAE,CAAC;QACjC,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC;QAC7E,OAAO,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;IACrD,CAAC;CAAA"}
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import { Book } from 'bkper-js';
|
|
2
|
+
/**
|
|
3
|
+
* Deletes a collection by its ID.
|
|
4
|
+
*
|
|
5
|
+
* @param collectionId - The ID of the collection to delete
|
|
6
|
+
* @returns The books that were in the deleted collection
|
|
7
|
+
* @throws Error if the collection is not found
|
|
8
|
+
*/
|
|
2
9
|
export declare function deleteCollection(collectionId: string): Promise<Book[]>;
|
|
3
10
|
//# sourceMappingURL=delete.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../src/commands/collections/delete.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,wBAAsB,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAU5E"}
|
|
1
|
+
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../src/commands/collections/delete.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAU5E"}
|
|
@@ -8,6 +8,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { getBkperInstance } from '../../bkper-factory.js';
|
|
11
|
+
/**
|
|
12
|
+
* Deletes a collection by its ID.
|
|
13
|
+
*
|
|
14
|
+
* @param collectionId - The ID of the collection to delete
|
|
15
|
+
* @returns The books that were in the deleted collection
|
|
16
|
+
* @throws Error if the collection is not found
|
|
17
|
+
*/
|
|
11
18
|
export function deleteCollection(collectionId) {
|
|
12
19
|
return __awaiter(this, void 0, void 0, function* () {
|
|
13
20
|
const bkper = getBkperInstance();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../src/commands/collections/delete.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG1D,MAAM,UAAgB,gBAAgB,CAAC,YAAoB;;QACvD,MAAM,KAAK,GAAG,gBAAgB,EAAE,CAAC;QACjC,MAAM,WAAW,GAAG,MAAM,KAAK,CAAC,cAAc,EAAE,CAAC;QACjD,MAAM,UAAU,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,KAAK,YAAY,CAAC,CAAC;QAErE,IAAI,CAAC,UAAU,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CAAC,yBAAyB,YAAY,EAAE,CAAC,CAAC;QAC7D,CAAC;QAED,OAAO,UAAU,CAAC,MAAM,EAAE,CAAC;IAC/B,CAAC;CAAA"}
|
|
1
|
+
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../src/commands/collections/delete.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG1D;;;;;;GAMG;AACH,MAAM,UAAgB,gBAAgB,CAAC,YAAoB;;QACvD,MAAM,KAAK,GAAG,gBAAgB,EAAE,CAAC;QACjC,MAAM,WAAW,GAAG,MAAM,KAAK,CAAC,cAAc,EAAE,CAAC;QACjD,MAAM,UAAU,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,KAAK,YAAY,CAAC,CAAC;QAErE,IAAI,CAAC,UAAU,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CAAC,yBAAyB,YAAY,EAAE,CAAC,CAAC;QAC7D,CAAC;QAED,OAAO,UAAU,CAAC,MAAM,EAAE,CAAC;IAC/B,CAAC;CAAA"}
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import { Collection } from 'bkper-js';
|
|
2
|
+
/**
|
|
3
|
+
* Retrieves a collection by its ID.
|
|
4
|
+
*
|
|
5
|
+
* @param collectionId - The ID of the collection to retrieve
|
|
6
|
+
* @returns The matching Collection
|
|
7
|
+
* @throws Error if the collection is not found
|
|
8
|
+
*/
|
|
2
9
|
export declare function getCollection(collectionId: string): Promise<Collection>;
|
|
3
10
|
//# sourceMappingURL=get.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../src/commands/collections/get.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,wBAAsB,aAAa,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAU7E"}
|
|
1
|
+
{"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../src/commands/collections/get.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC;;;;;;GAMG;AACH,wBAAsB,aAAa,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAU7E"}
|
|
@@ -8,6 +8,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { getBkperInstance } from '../../bkper-factory.js';
|
|
11
|
+
/**
|
|
12
|
+
* Retrieves a collection by its ID.
|
|
13
|
+
*
|
|
14
|
+
* @param collectionId - The ID of the collection to retrieve
|
|
15
|
+
* @returns The matching Collection
|
|
16
|
+
* @throws Error if the collection is not found
|
|
17
|
+
*/
|
|
11
18
|
export function getCollection(collectionId) {
|
|
12
19
|
return __awaiter(this, void 0, void 0, function* () {
|
|
13
20
|
const bkper = getBkperInstance();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get.js","sourceRoot":"","sources":["../../../src/commands/collections/get.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG1D,MAAM,UAAgB,aAAa,CAAC,YAAoB;;QACpD,MAAM,KAAK,GAAG,gBAAgB,EAAE,CAAC;QACjC,MAAM,WAAW,GAAG,MAAM,KAAK,CAAC,cAAc,EAAE,CAAC;QACjD,MAAM,UAAU,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,KAAK,YAAY,CAAC,CAAC;QAErE,IAAI,CAAC,UAAU,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CAAC,yBAAyB,YAAY,EAAE,CAAC,CAAC;QAC7D,CAAC;QAED,OAAO,UAAU,CAAC;IACtB,CAAC;CAAA"}
|
|
1
|
+
{"version":3,"file":"get.js","sourceRoot":"","sources":["../../../src/commands/collections/get.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG1D;;;;;;GAMG;AACH,MAAM,UAAgB,aAAa,CAAC,YAAoB;;QACpD,MAAM,KAAK,GAAG,gBAAgB,EAAE,CAAC;QACjC,MAAM,WAAW,GAAG,MAAM,KAAK,CAAC,cAAc,EAAE,CAAC;QACjD,MAAM,UAAU,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,KAAK,YAAY,CAAC,CAAC;QAErE,IAAI,CAAC,UAAU,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CAAC,yBAAyB,YAAY,EAAE,CAAC,CAAC;QAC7D,CAAC;QAED,OAAO,UAAU,CAAC;IACtB,CAAC;CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { listCollections } from './list.js';
|
|
1
|
+
export { listCollections, listCollectionsFormatted } from './list.js';
|
|
2
2
|
export { getCollection } from './get.js';
|
|
3
3
|
export { createCollection, CreateCollectionOptions } from './create.js';
|
|
4
4
|
export { updateCollection, UpdateCollectionOptions } from './update.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/collections/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/collections/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/collections/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/collections/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAA2B,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAA2B,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -1,3 +1,14 @@
|
|
|
1
1
|
import { Collection } from 'bkper-js';
|
|
2
|
+
import type { OutputFormat, ListResult } from '../../render/output.js';
|
|
3
|
+
/**
|
|
4
|
+
* Fetches all collections for the authenticated user.
|
|
5
|
+
*
|
|
6
|
+
* @returns Array of all collections
|
|
7
|
+
*/
|
|
2
8
|
export declare function listCollections(): Promise<Collection[]>;
|
|
9
|
+
/**
|
|
10
|
+
* Lists collections and returns a ListResult ready for rendering.
|
|
11
|
+
* Absorbs manual matrix building and JSON mapping.
|
|
12
|
+
*/
|
|
13
|
+
export declare function listCollectionsFormatted(format: OutputFormat): Promise<ListResult>;
|
|
3
14
|
//# sourceMappingURL=list.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/collections/list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/collections/list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEvE;;;;GAIG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC,CAI7D;AAED;;;GAGG;AACH,wBAAsB,wBAAwB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,UAAU,CAAC,CAiBxF"}
|
|
@@ -8,6 +8,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { getBkperInstance } from '../../bkper-factory.js';
|
|
11
|
+
/**
|
|
12
|
+
* Fetches all collections for the authenticated user.
|
|
13
|
+
*
|
|
14
|
+
* @returns Array of all collections
|
|
15
|
+
*/
|
|
11
16
|
export function listCollections() {
|
|
12
17
|
return __awaiter(this, void 0, void 0, function* () {
|
|
13
18
|
const bkper = getBkperInstance();
|
|
@@ -15,4 +20,25 @@ export function listCollections() {
|
|
|
15
20
|
return collections;
|
|
16
21
|
});
|
|
17
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Lists collections and returns a ListResult ready for rendering.
|
|
25
|
+
* Absorbs manual matrix building and JSON mapping.
|
|
26
|
+
*/
|
|
27
|
+
export function listCollectionsFormatted(format) {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
const collections = yield listCollections();
|
|
30
|
+
if (format === 'json') {
|
|
31
|
+
return { kind: 'json', data: collections.map(c => c.json()) };
|
|
32
|
+
}
|
|
33
|
+
if (collections.length === 0) {
|
|
34
|
+
return { kind: 'matrix', matrix: [['No collections found.']] };
|
|
35
|
+
}
|
|
36
|
+
const matrix = [['ID', 'Name', 'Books']];
|
|
37
|
+
for (const col of collections) {
|
|
38
|
+
const books = col.getBooks();
|
|
39
|
+
matrix.push([col.getId() || '', col.getName() || '', books.length.toString()]);
|
|
40
|
+
}
|
|
41
|
+
return { kind: 'matrix', matrix };
|
|
42
|
+
});
|
|
43
|
+
}
|
|
18
44
|
//# sourceMappingURL=list.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/collections/list.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/collections/list.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAI1D;;;;GAIG;AACH,MAAM,UAAgB,eAAe;;QACjC,MAAM,KAAK,GAAG,gBAAgB,EAAE,CAAC;QACjC,MAAM,WAAW,GAAG,MAAM,KAAK,CAAC,cAAc,EAAE,CAAC;QACjD,OAAO,WAAW,CAAC;IACvB,CAAC;CAAA;AAED;;;GAGG;AACH,MAAM,UAAgB,wBAAwB,CAAC,MAAoB;;QAC/D,MAAM,WAAW,GAAG,MAAM,eAAe,EAAE,CAAC;QAE5C,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;YACpB,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC;QAClE,CAAC;QAED,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC3B,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC,uBAAuB,CAAC,CAAC,EAAE,CAAC;QACnE,CAAC;QAED,MAAM,MAAM,GAAgB,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;QACtD,KAAK,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;YAC5B,MAAM,KAAK,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAC;YAC7B,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;QACnF,CAAC;QACD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;IACtC,CAAC;CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../src/commands/collections/register.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAezC,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAyGjE"}
|