bkper 4.0.1 → 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 +51 -28
- 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/bkper-factory.d.ts.map +1 -1
- package/lib/bkper-factory.js +5 -0
- package/lib/bkper-factory.js.map +1 -1
- package/lib/cli.js +19 -881
- 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 +24 -5
- 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 +23 -5
- 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 +16 -2
- 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 +21 -5
- 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 +23 -5
- 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 +21 -5
- 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 +31 -9
- 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 +15 -2
- 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 +31 -7
- 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/lib/render/table-formatter.d.ts.map +1 -1
- package/lib/render/table-formatter.js +22 -4
- package/lib/render/table-formatter.js.map +1 -1
- package/lib/utils/validation.d.ts +38 -0
- package/lib/utils/validation.d.ts.map +1 -0
- package/lib/utils/validation.js +46 -0
- package/lib/utils/validation.js.map +1 -0
- package/package.json +1 -1
|
@@ -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,OAA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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"}
|
|
@@ -0,0 +1,86 @@
|
|
|
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 { collectBook } from '../cli-helpers.js';
|
|
12
|
+
import { renderListResult, renderItem } from '../../render/index.js';
|
|
13
|
+
import { validateRequiredOptions, throwIfErrors } from '../../utils/validation.js';
|
|
14
|
+
import { listCollectionsFormatted, getCollection, createCollection, updateCollection, deleteCollection, addBookToCollection, removeBookFromCollection, } from './index.js';
|
|
15
|
+
export function registerCollectionCommands(program) {
|
|
16
|
+
const collectionCommand = program.command('collection').description('Manage Collections');
|
|
17
|
+
collectionCommand
|
|
18
|
+
.command('list')
|
|
19
|
+
.description('List all collections')
|
|
20
|
+
.action(withAction('listing collections', (format) => __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
const result = yield listCollectionsFormatted(format);
|
|
22
|
+
renderListResult(result, format);
|
|
23
|
+
})));
|
|
24
|
+
collectionCommand
|
|
25
|
+
.command('get <collectionId>')
|
|
26
|
+
.description('Get a collection by ID')
|
|
27
|
+
.action((collectionId) => withAction('getting collection', (format) => __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
const collection = yield getCollection(collectionId);
|
|
29
|
+
renderItem(collection.json(), format);
|
|
30
|
+
}))());
|
|
31
|
+
collectionCommand
|
|
32
|
+
.command('create')
|
|
33
|
+
.description('Create a new collection')
|
|
34
|
+
.option('--name <name>', 'Collection name')
|
|
35
|
+
.action(options => withAction('creating collection', (format) => __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
throwIfErrors(validateRequiredOptions(options, [{ name: 'name', flag: '--name' }]));
|
|
37
|
+
const collection = yield createCollection({ name: options.name });
|
|
38
|
+
renderItem(collection.json(), format);
|
|
39
|
+
}))());
|
|
40
|
+
collectionCommand
|
|
41
|
+
.command('update <collectionId>')
|
|
42
|
+
.description('Update a collection')
|
|
43
|
+
.option('--name <name>', 'Collection name')
|
|
44
|
+
.action((collectionId, options) => withAction('updating collection', (format) => __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
const collection = yield updateCollection(collectionId, {
|
|
46
|
+
name: options.name,
|
|
47
|
+
});
|
|
48
|
+
renderItem(collection.json(), format);
|
|
49
|
+
}))());
|
|
50
|
+
collectionCommand
|
|
51
|
+
.command('delete <collectionId>')
|
|
52
|
+
.description('Delete a collection')
|
|
53
|
+
.action((collectionId) => withAction('deleting collection', () => __awaiter(this, void 0, void 0, function* () {
|
|
54
|
+
yield deleteCollection(collectionId);
|
|
55
|
+
console.log(`Collection ${collectionId} deleted.`);
|
|
56
|
+
}))());
|
|
57
|
+
collectionCommand
|
|
58
|
+
.command('add-book <collectionId>')
|
|
59
|
+
.description('Add books to a collection')
|
|
60
|
+
.option('-b, --book <bookId>', 'Book ID (repeatable)', collectBook)
|
|
61
|
+
.action((collectionId, options) => withAction('adding books to collection', (format) => __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
throwIfErrors(validateRequiredOptions(options, [{ name: 'book', flag: '--book' }]));
|
|
63
|
+
const books = yield addBookToCollection(collectionId, options.book);
|
|
64
|
+
if (format === 'json' || format === 'csv') {
|
|
65
|
+
console.log(JSON.stringify(books.map(b => b.json()), null, 2));
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
console.log(`Added ${options.book.length} book(s) to collection ${collectionId}.`);
|
|
69
|
+
}
|
|
70
|
+
}))());
|
|
71
|
+
collectionCommand
|
|
72
|
+
.command('remove-book <collectionId>')
|
|
73
|
+
.description('Remove books from a collection')
|
|
74
|
+
.option('-b, --book <bookId>', 'Book ID (repeatable)', collectBook)
|
|
75
|
+
.action((collectionId, options) => withAction('removing books from collection', (format) => __awaiter(this, void 0, void 0, function* () {
|
|
76
|
+
throwIfErrors(validateRequiredOptions(options, [{ name: 'book', flag: '--book' }]));
|
|
77
|
+
const books = yield removeBookFromCollection(collectionId, options.book);
|
|
78
|
+
if (format === 'json' || format === 'csv') {
|
|
79
|
+
console.log(JSON.stringify(books.map(b => b.json()), null, 2));
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
console.log(`Removed ${options.book.length} book(s) from collection ${collectionId}.`);
|
|
83
|
+
}
|
|
84
|
+
}))());
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=register.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../../src/commands/collections/register.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AACnF,OAAO,EACH,wBAAwB,EACxB,aAAa,EACb,gBAAgB,EAChB,g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CAAC,CAAC,IAAI,EAAE,CAAC,EACxB,IAAI,EACJ,CAAC,CACJ,CACJ,CAAC;QACN,CAAC;aAAM,CAAC;YACJ,OAAO,CAAC,GAAG,CACP,WAAW,OAAO,CAAC,IAAI,CAAC,MAAM,4BAA4B,YAAY,GAAG,CAC5E,CAAC;QACN,CAAC;IACL,CAAC,CAAA,CAAC,EAAE,CACP,CAAC;AACV,CAAC"}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
import { Book } from 'bkper-js';
|
|
2
|
+
/**
|
|
3
|
+
* Removes one or more books from a collection.
|
|
4
|
+
*
|
|
5
|
+
* @param collectionId - The ID of the collection to remove books from
|
|
6
|
+
* @param bookIds - Array of book IDs to remove
|
|
7
|
+
* @returns The books that were removed from the collection
|
|
8
|
+
* @throws Error if the collection is not found
|
|
9
|
+
*/
|
|
2
10
|
export declare function removeBookFromCollection(collectionId: string, bookIds: string[]): Promise<Book[]>;
|
|
3
11
|
//# sourceMappingURL=remove-book.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remove-book.d.ts","sourceRoot":"","sources":["../../../src/commands/collections/remove-book.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,wBAAsB,wBAAwB,CAC1C,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,MAAM,EAAE,GAClB,OAAO,CAAC,IAAI,EAAE,CAAC,CAgBjB"}
|
|
1
|
+
{"version":3,"file":"remove-book.d.ts","sourceRoot":"","sources":["../../../src/commands/collections/remove-book.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC;;;;;;;GAOG;AACH,wBAAsB,wBAAwB,CAC1C,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
|
+
* Removes one or more books from a collection.
|
|
13
|
+
*
|
|
14
|
+
* @param collectionId - The ID of the collection to remove books from
|
|
15
|
+
* @param bookIds - Array of book IDs to remove
|
|
16
|
+
* @returns The books that were removed from the collection
|
|
17
|
+
* @throws Error if the collection is not found
|
|
18
|
+
*/
|
|
11
19
|
export function removeBookFromCollection(collectionId, bookIds) {
|
|
12
20
|
return __awaiter(this, void 0, void 0, function* () {
|
|
13
21
|
const bkper = getBkperInstance();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remove-book.js","sourceRoot":"","sources":["../../../src/commands/collections/remove-book.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG1D,MAAM,UAAgB,wBAAwB,CAC1C,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,WAAW,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC;CAAA"}
|
|
1
|
+
{"version":3,"file":"remove-book.js","sourceRoot":"","sources":["../../../src/commands/collections/remove-book.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG1D;;;;;;;GAOG;AACH,MAAM,UAAgB,wBAAwB,CAC1C,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,WAAW,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC;CAAA"}
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import { Collection } from 'bkper-js';
|
|
2
|
+
/**
|
|
3
|
+
* Options for updating a collection.
|
|
4
|
+
*/
|
|
2
5
|
export interface UpdateCollectionOptions {
|
|
3
6
|
name?: string;
|
|
4
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* Updates an existing collection with the provided options.
|
|
10
|
+
*
|
|
11
|
+
* @param collectionId - The ID of the collection to update
|
|
12
|
+
* @param options - Fields to update on the collection
|
|
13
|
+
* @returns The updated Collection
|
|
14
|
+
* @throws Error if the collection is not found
|
|
15
|
+
*/
|
|
5
16
|
export declare function updateCollection(collectionId: string, options: UpdateCollectionOptions): Promise<Collection>;
|
|
6
17
|
//# sourceMappingURL=update.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../src/commands/collections/update.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,MAAM,WAAW,uBAAuB;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAsB,gBAAgB,CAClC,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,uBAAuB,GACjC,OAAO,CAAC,UAAU,CAAC,CAYrB"}
|
|
1
|
+
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../src/commands/collections/update.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,CAClC,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,uBAAuB,GACjC,OAAO,CAAC,UAAU,CAAC,CAYrB"}
|
|
@@ -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
|
+
* Updates an existing collection with the provided options.
|
|
13
|
+
*
|
|
14
|
+
* @param collectionId - The ID of the collection to update
|
|
15
|
+
* @param options - Fields to update on the collection
|
|
16
|
+
* @returns The updated Collection
|
|
17
|
+
* @throws Error if the collection is not found
|
|
18
|
+
*/
|
|
11
19
|
export function updateCollection(collectionId, options) {
|
|
12
20
|
return __awaiter(this, void 0, void 0, function* () {
|
|
13
21
|
const bkper = getBkperInstance();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../../src/commands/collections/update.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../../src/commands/collections/update.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAU1D;;;;;;;GAOG;AACH,MAAM,UAAgB,gBAAgB,CAClC,YAAoB,EACpB,OAAgC;;QAEhC,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,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS;YAAE,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAEjE,OAAO,UAAU,CAAC,MAAM,EAAE,CAAC;IAC/B,CAAC;CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates multiple groups from stdin items using the batch API.
|
|
3
|
+
* Outputs NDJSON (one JSON object per line) as each chunk completes.
|
|
4
|
+
*
|
|
5
|
+
* @param bookId - Target book ID
|
|
6
|
+
* @param items - Parsed stdin items (field-value maps)
|
|
7
|
+
* @param propertyOverrides - CLI --property flags that override stdin fields
|
|
8
|
+
*/
|
|
9
|
+
export declare function batchCreateGroups(bookId: string, items: Record<string, string>[], propertyOverrides?: string[]): Promise<void>;
|
|
10
|
+
//# sourceMappingURL=batch-create.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"batch-create.d.ts","sourceRoot":"","sources":["../../../src/commands/groups/batch-create.ts"],"names":[],"mappings":"AAMA;;;;;;;GAOG;AACH,wBAAsB,iBAAiB,CACnC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,EAC/B,iBAAiB,CAAC,EAAE,MAAM,EAAE,GAC7B,OAAO,CAAC,IAAI,CAAC,CAgDf"}
|
|
@@ -0,0 +1,69 @@
|
|
|
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
|
+
import { Group } from 'bkper-js';
|
|
12
|
+
import { parsePropertyFlag } from '../../utils/properties.js';
|
|
13
|
+
const CHUNK_SIZE = 100;
|
|
14
|
+
/**
|
|
15
|
+
* Creates multiple groups from stdin items using the batch API.
|
|
16
|
+
* Outputs NDJSON (one JSON object per line) as each chunk completes.
|
|
17
|
+
*
|
|
18
|
+
* @param bookId - Target book ID
|
|
19
|
+
* @param items - Parsed stdin items (field-value maps)
|
|
20
|
+
* @param propertyOverrides - CLI --property flags that override stdin fields
|
|
21
|
+
*/
|
|
22
|
+
export function batchCreateGroups(bookId, items, propertyOverrides) {
|
|
23
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
const bkper = getBkperInstance();
|
|
25
|
+
const book = yield bkper.getBook(bookId);
|
|
26
|
+
for (let i = 0; i < items.length; i += CHUNK_SIZE) {
|
|
27
|
+
const chunk = items.slice(i, i + CHUNK_SIZE);
|
|
28
|
+
const groups = [];
|
|
29
|
+
for (const item of chunk) {
|
|
30
|
+
const group = new Group(book);
|
|
31
|
+
if (item.name)
|
|
32
|
+
group.setName(item.name);
|
|
33
|
+
if (item.hidden !== undefined)
|
|
34
|
+
group.setHidden(item.hidden === 'true');
|
|
35
|
+
// Set properties from stdin fields (excluding known fields)
|
|
36
|
+
const knownFields = new Set(['name', 'parent', 'hidden']);
|
|
37
|
+
for (const [key, value] of Object.entries(item)) {
|
|
38
|
+
if (!knownFields.has(key) && value !== '') {
|
|
39
|
+
group.setProperty(key, value);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
// CLI --property flags override stdin
|
|
43
|
+
if (propertyOverrides) {
|
|
44
|
+
for (const raw of propertyOverrides) {
|
|
45
|
+
const [key, value] = parsePropertyFlag(raw);
|
|
46
|
+
if (value === '') {
|
|
47
|
+
group.deleteProperty(key);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
group.setProperty(key, value);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (item.parent) {
|
|
55
|
+
const parentGroup = yield book.getGroup(item.parent);
|
|
56
|
+
if (parentGroup) {
|
|
57
|
+
group.setParent(parentGroup);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
groups.push(group);
|
|
61
|
+
}
|
|
62
|
+
const results = yield book.batchCreateGroups(groups);
|
|
63
|
+
for (const result of results) {
|
|
64
|
+
console.log(JSON.stringify(result.json()));
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=batch-create.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"batch-create.js","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
|
|
2
3
|
export interface CreateGroupOptions {
|
|
3
4
|
name: string;
|
|
4
5
|
parent?: string;
|
|
5
6
|
hidden?: boolean;
|
|
6
7
|
property?: string[];
|
|
7
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* Creates a new group in the specified book.
|
|
11
|
+
*
|
|
12
|
+
* @param bookId - The ID of the book to create the group in
|
|
13
|
+
* @param options - Group creation options including name, parent, and properties
|
|
14
|
+
* @returns The newly created Group
|
|
15
|
+
*/
|
|
8
16
|
export declare function createGroup(bookId: string, options: CreateGroupOptions): Promise<Group>;
|
|
9
17
|
//# sourceMappingURL=create.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/commands/groups/create.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/commands/groups/create.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAIjC,kDAAkD;AAClD,MAAM,WAAW,kBAAkB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAED;;;;;;GAMG;AACH,wBAAsB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,KAAK,CAAC,CAqC7F"}
|
|
@@ -10,21 +10,35 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { getBkperInstance } from '../../bkper-factory.js';
|
|
11
11
|
import { Group } from 'bkper-js';
|
|
12
12
|
import { parsePropertyFlag } from '../../utils/properties.js';
|
|
13
|
+
import { throwIfErrors } from '../../utils/validation.js';
|
|
14
|
+
/**
|
|
15
|
+
* Creates a new group in the specified book.
|
|
16
|
+
*
|
|
17
|
+
* @param bookId - The ID of the book to create the group in
|
|
18
|
+
* @param options - Group creation options including name, parent, and properties
|
|
19
|
+
* @returns The newly created Group
|
|
20
|
+
*/
|
|
13
21
|
export function createGroup(bookId, options) {
|
|
14
22
|
return __awaiter(this, void 0, void 0, function* () {
|
|
15
23
|
const bkper = getBkperInstance();
|
|
16
24
|
const book = yield bkper.getBook(bookId);
|
|
25
|
+
const errors = [];
|
|
17
26
|
const group = new Group(book).setName(options.name);
|
|
18
27
|
if (options.hidden !== undefined)
|
|
19
28
|
group.setHidden(options.hidden);
|
|
20
29
|
if (options.property) {
|
|
21
30
|
for (const raw of options.property) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
31
|
+
try {
|
|
32
|
+
const [key, value] = parsePropertyFlag(raw);
|
|
33
|
+
if (value === '') {
|
|
34
|
+
group.deleteProperty(key);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
group.setProperty(key, value);
|
|
38
|
+
}
|
|
25
39
|
}
|
|
26
|
-
|
|
27
|
-
|
|
40
|
+
catch (err) {
|
|
41
|
+
errors.push(err.message);
|
|
28
42
|
}
|
|
29
43
|
}
|
|
30
44
|
}
|
|
@@ -33,7 +47,11 @@ export function createGroup(bookId, options) {
|
|
|
33
47
|
if (parentGroup) {
|
|
34
48
|
group.setParent(parentGroup);
|
|
35
49
|
}
|
|
50
|
+
else {
|
|
51
|
+
errors.push(`Parent group not found: ${options.parent}`);
|
|
52
|
+
}
|
|
36
53
|
}
|
|
54
|
+
throwIfErrors(errors);
|
|
37
55
|
return group.create();
|
|
38
56
|
});
|
|
39
57
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/commands/groups/create.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,KAA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AAY,EAAE,CAAC;oBACpB,MAAM,CAAC,IAAI,CAAE,GAAa,CAAC,OAAO,CAAC,CAAC;gBACxC,CAAC;YACL,CAAC;QACL,CAAC;QAED,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;YACjB,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YACxD,IAAI,WAAW,EAAE,CAAC;gBACd,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;YACjC,CAAC;iBAAM,CAAC;gBACJ,MAAM,CAAC,IAAI,CAAC,2BAA2B,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;YAC7D,CAAC;QACL,CAAC;QAED,aAAa,CAAC,MAAM,CAAC,CAAC;QAEtB,OAAO,KAAK,CAAC,MAAM,EAAE,CAAC;IAC1B,CAAC;CAAA"}
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import { Group } from 'bkper-js';
|
|
2
|
+
/**
|
|
3
|
+
* Deletes a group from the specified book.
|
|
4
|
+
*
|
|
5
|
+
* @param bookId - The ID of the book containing the group
|
|
6
|
+
* @param groupIdOrName - The ID or name of the group to delete
|
|
7
|
+
* @returns The removed Group
|
|
8
|
+
*/
|
|
2
9
|
export declare function deleteGroup(bookId: string, groupIdOrName: string): Promise<Group>;
|
|
3
10
|
//# sourceMappingURL=delete.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../src/commands/groups/delete.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,wBAAsB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CASvF"}
|
|
1
|
+
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../src/commands/groups/delete.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC;;;;;;GAMG;AACH,wBAAsB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CASvF"}
|
|
@@ -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 group from the specified book.
|
|
13
|
+
*
|
|
14
|
+
* @param bookId - The ID of the book containing the group
|
|
15
|
+
* @param groupIdOrName - The ID or name of the group to delete
|
|
16
|
+
* @returns The removed Group
|
|
17
|
+
*/
|
|
11
18
|
export function deleteGroup(bookId, groupIdOrName) {
|
|
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/groups/delete.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG1D,MAAM,UAAgB,WAAW,CAAC,MAAc,EAAE,aAAqB;;QACnE,MAAM,KAAK,GAAG,gBAAgB,EAAE,CAAC;QACjC,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACzC,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;QACjD,IAAI,CAAC,KAAK,EAAE,CAAC;YACT,MAAM,IAAI,KAAK,CAAC,oBAAoB,aAAa,EAAE,CAAC,CAAC;QACzD,CAAC;QAED,OAAO,KAAK,CAAC,MAAM,EAAE,CAAC;IAC1B,CAAC;CAAA"}
|
|
1
|
+
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../src/commands/groups/delete.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG1D;;;;;;GAMG;AACH,MAAM,UAAgB,WAAW,CAAC,MAAc,EAAE,aAAqB;;QACnE,MAAM,KAAK,GAAG,gBAAgB,EAAE,CAAC;QACjC,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACzC,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;QACjD,IAAI,CAAC,KAAK,EAAE,CAAC;YACT,MAAM,IAAI,KAAK,CAAC,oBAAoB,aAAa,EAAE,CAAC,CAAC;QACzD,CAAC;QAED,OAAO,KAAK,CAAC,MAAM,EAAE,CAAC;IAC1B,CAAC;CAAA"}
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import { Group } from 'bkper-js';
|
|
2
|
+
/**
|
|
3
|
+
* Retrieves a group by its ID or name from the specified book.
|
|
4
|
+
*
|
|
5
|
+
* @param bookId - The ID of the book containing the group
|
|
6
|
+
* @param groupIdOrName - The ID or name of the group to retrieve
|
|
7
|
+
* @returns The matching Group
|
|
8
|
+
*/
|
|
2
9
|
export declare function getGroup(bookId: string, groupIdOrName: string): Promise<Group>;
|
|
3
10
|
//# sourceMappingURL=get.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../src/commands/groups/get.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,wBAAsB,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAQpF"}
|
|
1
|
+
{"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../src/commands/groups/get.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC;;;;;;GAMG;AACH,wBAAsB,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAQpF"}
|
|
@@ -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 group by its ID or name from the specified book.
|
|
13
|
+
*
|
|
14
|
+
* @param bookId - The ID of the book containing the group
|
|
15
|
+
* @param groupIdOrName - The ID or name of the group to retrieve
|
|
16
|
+
* @returns The matching Group
|
|
17
|
+
*/
|
|
11
18
|
export function getGroup(bookId, groupIdOrName) {
|
|
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/groups/get.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG1D,MAAM,UAAgB,QAAQ,CAAC,MAAc,EAAE,aAAqB;;QAChE,MAAM,KAAK,GAAG,gBAAgB,EAAE,CAAC;QACjC,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACzC,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;QACjD,IAAI,CAAC,KAAK,EAAE,CAAC;YACT,MAAM,IAAI,KAAK,CAAC,oBAAoB,aAAa,EAAE,CAAC,CAAC;QACzD,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;CAAA"}
|
|
1
|
+
{"version":3,"file":"get.js","sourceRoot":"","sources":["../../../src/commands/groups/get.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG1D;;;;;;GAMG;AACH,MAAM,UAAgB,QAAQ,CAAC,MAAc,EAAE,aAAqB;;QAChE,MAAM,KAAK,GAAG,gBAAgB,EAAE,CAAC;QACjC,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACzC,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;QACjD,IAAI,CAAC,KAAK,EAAE,CAAC;YACT,MAAM,IAAI,KAAK,CAAC,oBAAoB,aAAa,EAAE,CAAC,CAAC;QACzD,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export { listGroups } from './list.js';
|
|
1
|
+
export { listGroups, listGroupsFormatted } from './list.js';
|
|
2
2
|
export { getGroup } from './get.js';
|
|
3
3
|
export { createGroup, CreateGroupOptions } from './create.js';
|
|
4
4
|
export { updateGroup, UpdateGroupOptions } from './update.js';
|
|
5
5
|
export { deleteGroup } from './delete.js';
|
|
6
|
+
export { batchCreateGroups } from './batch-create.js';
|
|
6
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/groups/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/groups/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export { listGroups } from './list.js';
|
|
1
|
+
export { listGroups, listGroupsFormatted } from './list.js';
|
|
2
2
|
export { getGroup } from './get.js';
|
|
3
3
|
export { createGroup } from './create.js';
|
|
4
4
|
export { updateGroup } from './update.js';
|
|
5
5
|
export { deleteGroup } from './delete.js';
|
|
6
|
+
export { batchCreateGroups } from './batch-create.js';
|
|
6
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/groups/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/groups/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,WAAW,EAAsB,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAsB,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -1,3 +1,15 @@
|
|
|
1
1
|
import { Group } from 'bkper-js';
|
|
2
|
+
import type { OutputFormat, ListResult } from '../../render/output.js';
|
|
3
|
+
/**
|
|
4
|
+
* Retrieves all groups from the specified book.
|
|
5
|
+
*
|
|
6
|
+
* @param bookId - The ID of the book to list groups from
|
|
7
|
+
* @returns Array of groups in the book, or an empty array if none exist
|
|
8
|
+
*/
|
|
2
9
|
export declare function listGroups(bookId: string): Promise<Group[]>;
|
|
10
|
+
/**
|
|
11
|
+
* Lists groups and returns a ListResult ready for rendering.
|
|
12
|
+
* Absorbs GroupsDataTableBuilder config and JSON mapping.
|
|
13
|
+
*/
|
|
14
|
+
export declare function listGroupsFormatted(bookId: string, format: OutputFormat): Promise<ListResult>;
|
|
3
15
|
//# sourceMappingURL=list.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/groups/list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/groups/list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAA0B,MAAM,UAAU,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEvE;;;;;GAKG;AACH,wBAAsB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC,CAKjE;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CACrC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,YAAY,GACrB,OAAO,CAAC,UAAU,CAAC,CAarB"}
|
|
@@ -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
|
+
import { GroupsDataTableBuilder } from 'bkper-js';
|
|
12
|
+
/**
|
|
13
|
+
* Retrieves all groups from the specified book.
|
|
14
|
+
*
|
|
15
|
+
* @param bookId - The ID of the book to list groups from
|
|
16
|
+
* @returns Array of groups in the book, or an empty array if none exist
|
|
17
|
+
*/
|
|
11
18
|
export function listGroups(bookId) {
|
|
12
19
|
return __awaiter(this, void 0, void 0, function* () {
|
|
13
20
|
const bkper = getBkperInstance();
|
|
@@ -16,4 +23,22 @@ export function listGroups(bookId) {
|
|
|
16
23
|
return groups || [];
|
|
17
24
|
});
|
|
18
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Lists groups and returns a ListResult ready for rendering.
|
|
28
|
+
* Absorbs GroupsDataTableBuilder config and JSON mapping.
|
|
29
|
+
*/
|
|
30
|
+
export function listGroupsFormatted(bookId, format) {
|
|
31
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
const groups = yield listGroups(bookId);
|
|
33
|
+
if (format === 'json') {
|
|
34
|
+
return { kind: 'json', data: groups.map(g => g.json()) };
|
|
35
|
+
}
|
|
36
|
+
const builder = new GroupsDataTableBuilder(groups).ids(true).tree(true);
|
|
37
|
+
if (format === 'csv') {
|
|
38
|
+
builder.properties(true).hiddenProperties(true);
|
|
39
|
+
}
|
|
40
|
+
const matrix = builder.build();
|
|
41
|
+
return { kind: 'matrix', matrix };
|
|
42
|
+
});
|
|
43
|
+
}
|
|
19
44
|
//# sourceMappingURL=list.js.map
|