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
|
@@ -9,6 +9,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { getBkperInstance } from '../../bkper-factory.js';
|
|
11
11
|
import { parsePropertyFlag } from '../../utils/properties.js';
|
|
12
|
+
import { throwIfErrors } from '../../utils/validation.js';
|
|
13
|
+
/**
|
|
14
|
+
* Updates an existing account in the specified book.
|
|
15
|
+
* Applies only the provided options, leaving other fields unchanged.
|
|
16
|
+
*
|
|
17
|
+
* @param bookId - The target book ID
|
|
18
|
+
* @param accountIdOrName - Account ID or name to update
|
|
19
|
+
* @param options - Fields to update on the account
|
|
20
|
+
* @returns The updated account
|
|
21
|
+
* @throws Error if the account is not found
|
|
22
|
+
*/
|
|
12
23
|
export function updateAccount(bookId, accountIdOrName, options) {
|
|
13
24
|
return __awaiter(this, void 0, void 0, function* () {
|
|
14
25
|
const bkper = getBkperInstance();
|
|
@@ -17,6 +28,7 @@ export function updateAccount(bookId, accountIdOrName, options) {
|
|
|
17
28
|
if (!account) {
|
|
18
29
|
throw new Error(`Account not found: ${accountIdOrName}`);
|
|
19
30
|
}
|
|
31
|
+
const errors = [];
|
|
20
32
|
if (options.name !== undefined)
|
|
21
33
|
account.setName(options.name);
|
|
22
34
|
if (options.type !== undefined)
|
|
@@ -25,15 +37,21 @@ export function updateAccount(bookId, accountIdOrName, options) {
|
|
|
25
37
|
account.setArchived(options.archived);
|
|
26
38
|
if (options.property) {
|
|
27
39
|
for (const raw of options.property) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
40
|
+
try {
|
|
41
|
+
const [key, value] = parsePropertyFlag(raw);
|
|
42
|
+
if (value === '') {
|
|
43
|
+
account.deleteProperty(key);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
account.setProperty(key, value);
|
|
47
|
+
}
|
|
31
48
|
}
|
|
32
|
-
|
|
33
|
-
|
|
49
|
+
catch (err) {
|
|
50
|
+
errors.push(err.message);
|
|
34
51
|
}
|
|
35
52
|
}
|
|
36
53
|
}
|
|
54
|
+
throwIfErrors(errors);
|
|
37
55
|
return account.update();
|
|
38
56
|
});
|
|
39
57
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../../src/commands/accounts/update.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,M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iBAAiB,CAAC,GAAG,CAAC,CAAC;oBAC5C,IAAI,KAAK,KAAK,EAAE,EAAE,CAAC;wBACf,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;oBAChC,CAAC;yBAAM,CAAC;wBACJ,OAAO,CAAC,WAAW,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;oBACpC,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,OAAO,CAAC,MAAM,EAAE,CAAC;IAC5B,CAAC;CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { OutputFormat } from '../render/output.js';
|
|
2
|
+
/**
|
|
3
|
+
* Options for the action wrapper.
|
|
4
|
+
*/
|
|
5
|
+
interface ActionOptions {
|
|
6
|
+
/** Skip calling setupBkper() before the action (e.g. for init, build). */
|
|
7
|
+
skipSetup?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Wraps a CLI command action with consistent error handling and Bkper setup.
|
|
11
|
+
*
|
|
12
|
+
* Eliminates the repeated try/catch + setupBkper() + process.exit(1) boilerplate
|
|
13
|
+
* from every command handler.
|
|
14
|
+
*
|
|
15
|
+
* @param label - Human-readable label for error messages (e.g. "listing books")
|
|
16
|
+
* @param fn - The action function. Receives the resolved OutputFormat.
|
|
17
|
+
* @param options - Optional configuration (e.g. skipSetup)
|
|
18
|
+
*/
|
|
19
|
+
export declare function withAction(label: string, fn: (format: OutputFormat) => Promise<void>, options?: ActionOptions): () => Promise<void>;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../src/commands/action.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD;;GAEG;AACH,UAAU,aAAa;IACnB,0EAA0E;IAC1E,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CACtB,KAAK,EAAE,MAAM,EACb,EAAE,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,OAAO,CAAC,IAAI,CAAC,EAC3C,OAAO,CAAC,EAAE,aAAa,GACxB,MAAM,OAAO,CAAC,IAAI,CAAC,CAYrB"}
|
|
@@ -0,0 +1,36 @@
|
|
|
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 { setupBkper } from '../bkper-factory.js';
|
|
11
|
+
import { getFormat } from './cli-helpers.js';
|
|
12
|
+
/**
|
|
13
|
+
* Wraps a CLI command action with consistent error handling and Bkper setup.
|
|
14
|
+
*
|
|
15
|
+
* Eliminates the repeated try/catch + setupBkper() + process.exit(1) boilerplate
|
|
16
|
+
* from every command handler.
|
|
17
|
+
*
|
|
18
|
+
* @param label - Human-readable label for error messages (e.g. "listing books")
|
|
19
|
+
* @param fn - The action function. Receives the resolved OutputFormat.
|
|
20
|
+
* @param options - Optional configuration (e.g. skipSetup)
|
|
21
|
+
*/
|
|
22
|
+
export function withAction(label, fn, options) {
|
|
23
|
+
return () => __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
try {
|
|
25
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipSetup)) {
|
|
26
|
+
setupBkper();
|
|
27
|
+
}
|
|
28
|
+
yield fn(getFormat());
|
|
29
|
+
}
|
|
30
|
+
catch (err) {
|
|
31
|
+
console.error(`Error ${label}:`, err);
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action.js","sourceRoot":"","sources":["../../src/commands/action.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAW7C;;;;;;;;;GASG;AACH,MAAM,UAAU,UAAU,CACtB,KAAa,EACb,EAA2C,EAC3C,OAAuB;IAEvB,OAAO,GAAS,EAAE;QACd,IAAI,CAAC;YACD,IAAI,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,CAAA,EAAE,CAAC;gBACtB,UAAU,EAAE,CAAC;YACjB,CAAC;YACD,MAAM,EAAE,CAAC,SAAS,EAAE,CAAC,CAAC;QAC1B,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACX,OAAO,CAAC,KAAK,CAAC,SAAS,KAAK,GAAG,EAAE,GAAG,CAAC,CAAC;YACtC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,CAAC;IACL,CAAC,CAAA,CAAC;AACN,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export type { DeployOptions, DeployResult, Environment, HandlerType, SecretsOptions, SyncResult, UndeployResult, } from './types.js';
|
|
2
2
|
export type { DevOptions } from './dev.js';
|
|
3
|
-
export { listApps } from './list.js';
|
|
3
|
+
export { listApps, listAppsFormatted } from './list.js';
|
|
4
4
|
export { createApp, syncApp, updateApp } from './sync.js';
|
|
5
5
|
export { deployApp, statusApp, undeployApp } from './deploy.js';
|
|
6
6
|
export { dev } from './dev.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/apps/index.ts"],"names":[],"mappings":"AAIA,YAAY,EACR,aAAa,EACb,YAAY,EACZ,WAAW,EACX,WAAW,EACX,cAAc,EACd,UAAU,EACV,cAAc,GACjB,MAAM,YAAY,CAAC;AAEpB,YAAY,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAO3C,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/apps/index.ts"],"names":[],"mappings":"AAIA,YAAY,EACR,aAAa,EACb,YAAY,EACZ,WAAW,EACX,WAAW,EACX,cAAc,EACd,UAAU,EACV,cAAc,GACjB,MAAM,YAAY,CAAC;AAEpB,YAAY,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAO3C,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAGxD,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAG1D,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAGhE,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAG/B,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAGnC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAGtE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// Functions
|
|
6
6
|
// =============================================================================
|
|
7
7
|
// List
|
|
8
|
-
export { listApps } from './list.js';
|
|
8
|
+
export { listApps, listAppsFormatted } from './list.js';
|
|
9
9
|
// Sync (CRUD)
|
|
10
10
|
export { createApp, syncApp, updateApp } from './sync.js';
|
|
11
11
|
// Deploy
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/apps/index.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,QAAQ;AACR,gFAAgF;AAchF,gFAAgF;AAChF,YAAY;AACZ,gFAAgF;AAEhF,OAAO;AACP,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/apps/index.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,QAAQ;AACR,gFAAgF;AAchF,gFAAgF;AAChF,YAAY;AACZ,gFAAgF;AAEhF,OAAO;AACP,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAExD,cAAc;AACd,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE1D,SAAS;AACT,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAEhE,MAAM;AACN,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,QAAQ;AACR,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,OAAO;AACP,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,UAAU;AACV,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAEtE,oBAAoB;AACpB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import { Integration } from 'bkper-js';
|
|
2
|
+
/**
|
|
3
|
+
* Installs an app into a book by creating an integration.
|
|
4
|
+
*
|
|
5
|
+
* @param bookId - The ID of the book to install the app into
|
|
6
|
+
* @param appId - The ID of the app to install
|
|
7
|
+
* @returns The created Integration
|
|
8
|
+
*/
|
|
2
9
|
export declare function installApp(bookId: string, appId: string): Promise<Integration>;
|
|
3
10
|
//# sourceMappingURL=install.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../src/commands/apps/install.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,wBAAsB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAKpF"}
|
|
1
|
+
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../src/commands/apps/install.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC;;;;;;GAMG;AACH,wBAAsB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAKpF"}
|
|
@@ -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
|
+
* Installs an app into a book by creating an integration.
|
|
13
|
+
*
|
|
14
|
+
* @param bookId - The ID of the book to install the app into
|
|
15
|
+
* @param appId - The ID of the app to install
|
|
16
|
+
* @returns The created Integration
|
|
17
|
+
*/
|
|
11
18
|
export function installApp(bookId, appId) {
|
|
12
19
|
return __awaiter(this, void 0, void 0, function* () {
|
|
13
20
|
const bkper = getBkperInstance();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.js","sourceRoot":"","sources":["../../../src/commands/apps/install.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG1D,MAAM,UAAgB,UAAU,CAAC,MAAc,EAAE,KAAa;;QAC1D,MAAM,KAAK,GAAG,gBAAgB,EAAE,CAAC;QACjC,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAEzC,OAAO,IAAI,CAAC,iBAAiB,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;IACtD,CAAC;CAAA"}
|
|
1
|
+
{"version":3,"file":"install.js","sourceRoot":"","sources":["../../../src/commands/apps/install.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG1D;;;;;;GAMG;AACH,MAAM,UAAgB,UAAU,CAAC,MAAc,EAAE,KAAa;;QAC1D,MAAM,KAAK,GAAG,gBAAgB,EAAE,CAAC;QACjC,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAEzC,OAAO,IAAI,CAAC,iBAAiB,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;IACtD,CAAC;CAAA"}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
+
import type { OutputFormat, ListResult } from '../../render/output.js';
|
|
1
2
|
/**
|
|
2
3
|
* Lists all apps the authenticated user has access to.
|
|
3
4
|
*
|
|
4
5
|
* @returns Array of app data objects
|
|
5
6
|
*/
|
|
6
7
|
export declare function listApps(): Promise<bkper.App[]>;
|
|
8
|
+
/**
|
|
9
|
+
* Lists apps and returns a ListResult ready for rendering.
|
|
10
|
+
* Absorbs manual matrix building and JSON mapping.
|
|
11
|
+
*/
|
|
12
|
+
export declare function listAppsFormatted(format: OutputFormat): Promise<ListResult>;
|
|
7
13
|
//# sourceMappingURL=list.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/apps/list.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/apps/list.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEvE;;;;GAIG;AACH,wBAAsB,QAAQ,IAAI,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAIrD;AAED;;;GAGG;AACH,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,UAAU,CAAC,CAgBjF"}
|
|
@@ -20,4 +20,24 @@ export function listApps() {
|
|
|
20
20
|
return apps.map(app => app.json());
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Lists apps and returns a ListResult ready for rendering.
|
|
25
|
+
* Absorbs manual matrix building and JSON mapping.
|
|
26
|
+
*/
|
|
27
|
+
export function listAppsFormatted(format) {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
const apps = yield listApps();
|
|
30
|
+
if (format === 'json') {
|
|
31
|
+
return { kind: 'json', data: apps };
|
|
32
|
+
}
|
|
33
|
+
if (apps.length === 0) {
|
|
34
|
+
return { kind: 'matrix', matrix: [['No results found.']] };
|
|
35
|
+
}
|
|
36
|
+
const matrix = [['ID', 'Name', 'Published']];
|
|
37
|
+
for (const app of apps) {
|
|
38
|
+
matrix.push([app.id || '', app.name || '', app.published ? 'Yes' : 'No']);
|
|
39
|
+
}
|
|
40
|
+
return { kind: 'matrix', matrix };
|
|
41
|
+
});
|
|
42
|
+
}
|
|
23
43
|
//# sourceMappingURL=list.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/apps/list.ts"],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E,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;IACtC,CAAC;CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../src/commands/apps/register.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAsBzC,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA8L1D"}
|
|
@@ -0,0 +1,130 @@
|
|
|
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 { setupBkper } from '../../bkper-factory.js';
|
|
12
|
+
import { renderListResult, renderItem } from '../../render/index.js';
|
|
13
|
+
import { validateRequiredOptions, throwIfErrors } from '../../utils/validation.js';
|
|
14
|
+
import { listAppsFormatted, syncApp, deployApp, undeployApp, statusApp, initApp, secretsPut, secretsList, secretsDelete, dev, build, installApp, uninstallApp, } from './index.js';
|
|
15
|
+
export function registerAppCommands(program) {
|
|
16
|
+
const appCommand = program.command('app').description('Manage Bkper Apps');
|
|
17
|
+
appCommand
|
|
18
|
+
.command('init <name>')
|
|
19
|
+
.description('Create a new Bkper app from template')
|
|
20
|
+
.action((name) => withAction('initializing app', () => __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
yield initApp(name);
|
|
22
|
+
}), { skipSetup: true })());
|
|
23
|
+
appCommand
|
|
24
|
+
.command('list')
|
|
25
|
+
.description('List all apps you have access to')
|
|
26
|
+
.action(withAction('listing apps', (format) => __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
const result = yield listAppsFormatted(format);
|
|
28
|
+
renderListResult(result, format);
|
|
29
|
+
})));
|
|
30
|
+
appCommand
|
|
31
|
+
.command('sync')
|
|
32
|
+
.description('Sync app config to Bkper (creates if new, updates if exists)')
|
|
33
|
+
.action(withAction('syncing app', () => __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
const result = yield syncApp();
|
|
35
|
+
console.log(`Synced ${result.id} (${result.action})`);
|
|
36
|
+
})));
|
|
37
|
+
appCommand
|
|
38
|
+
.command('deploy')
|
|
39
|
+
.description('Deploy app to Bkper Platform')
|
|
40
|
+
.option('-p, --preview', 'Deploy to preview environment')
|
|
41
|
+
.option('--events', 'Deploy events handler instead of web handler')
|
|
42
|
+
.action(options => withAction('deploying app', () => __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
yield deployApp(options);
|
|
44
|
+
}), { skipSetup: true })());
|
|
45
|
+
appCommand
|
|
46
|
+
.command('undeploy')
|
|
47
|
+
.description('Remove app from Bkper Platform')
|
|
48
|
+
.option('-p, --preview', 'Remove from preview environment')
|
|
49
|
+
.option('--events', 'Remove events handler instead of web handler')
|
|
50
|
+
.option('--delete-data', 'Permanently delete all associated data (requires confirmation)')
|
|
51
|
+
.option('--force', 'Skip confirmation prompts (use with --delete-data for automation)')
|
|
52
|
+
.action(options => withAction('undeploying app', () => __awaiter(this, void 0, void 0, function* () {
|
|
53
|
+
yield undeployApp(options);
|
|
54
|
+
}), { skipSetup: true })());
|
|
55
|
+
appCommand
|
|
56
|
+
.command('status')
|
|
57
|
+
.description('Show deployment status for all handlers')
|
|
58
|
+
.action(options => withAction('getting app status', () => __awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
yield statusApp();
|
|
60
|
+
}), { skipSetup: true })());
|
|
61
|
+
appCommand
|
|
62
|
+
.command('dev')
|
|
63
|
+
.description('Start the development server')
|
|
64
|
+
.option('--cp, --client-port <port>', 'Client dev server port', '5173')
|
|
65
|
+
.option('--sp, --server-port <port>', 'Server simulation port', '8787')
|
|
66
|
+
.option('--ep, --events-port <port>', 'Events handler port', '8791')
|
|
67
|
+
.option('-w, --web', 'Run only the web handler')
|
|
68
|
+
.option('-e, --events', 'Run only the events handler')
|
|
69
|
+
.option('--no-open', 'Do not open browser on startup')
|
|
70
|
+
.action(options => withAction('starting dev server', () => __awaiter(this, void 0, void 0, function* () {
|
|
71
|
+
setupBkper();
|
|
72
|
+
yield dev({
|
|
73
|
+
clientPort: parseInt(options.clientPort, 10),
|
|
74
|
+
serverPort: parseInt(options.serverPort, 10),
|
|
75
|
+
eventsPort: parseInt(options.eventsPort, 10),
|
|
76
|
+
web: options.web,
|
|
77
|
+
events: options.events,
|
|
78
|
+
open: options.open,
|
|
79
|
+
});
|
|
80
|
+
}), { skipSetup: true })());
|
|
81
|
+
appCommand
|
|
82
|
+
.command('build')
|
|
83
|
+
.description('Build all configured handlers for deployment')
|
|
84
|
+
.action(withAction('building app', () => __awaiter(this, void 0, void 0, function* () {
|
|
85
|
+
yield build();
|
|
86
|
+
}), { skipSetup: true }));
|
|
87
|
+
// Secrets subcommands
|
|
88
|
+
const secretsCommand = appCommand.command('secrets').description('Manage app secrets');
|
|
89
|
+
secretsCommand
|
|
90
|
+
.command('put <name>')
|
|
91
|
+
.description('Set a secret value')
|
|
92
|
+
.option('-p, --preview', 'Set in preview environment')
|
|
93
|
+
.action((name, options) => withAction('setting secret', () => __awaiter(this, void 0, void 0, function* () {
|
|
94
|
+
yield secretsPut(name, options);
|
|
95
|
+
}), { skipSetup: true })());
|
|
96
|
+
secretsCommand
|
|
97
|
+
.command('list')
|
|
98
|
+
.description('List all secrets')
|
|
99
|
+
.option('-p, --preview', 'List from preview environment')
|
|
100
|
+
.action(options => withAction('listing secrets', () => __awaiter(this, void 0, void 0, function* () {
|
|
101
|
+
yield secretsList(options);
|
|
102
|
+
}), { skipSetup: true })());
|
|
103
|
+
secretsCommand
|
|
104
|
+
.command('delete <name>')
|
|
105
|
+
.description('Delete a secret')
|
|
106
|
+
.option('-p, --preview', 'Delete from preview environment')
|
|
107
|
+
.action((name, options) => withAction('deleting secret', () => __awaiter(this, void 0, void 0, function* () {
|
|
108
|
+
yield secretsDelete(name, options);
|
|
109
|
+
}), { skipSetup: true })());
|
|
110
|
+
// Install/Uninstall
|
|
111
|
+
appCommand
|
|
112
|
+
.command('install <appId>')
|
|
113
|
+
.description('Install an app into a book')
|
|
114
|
+
.option('-b, --book <bookId>', 'Book ID')
|
|
115
|
+
.action((appId, options) => withAction('installing app', (format) => __awaiter(this, void 0, void 0, function* () {
|
|
116
|
+
throwIfErrors(validateRequiredOptions(options, [{ name: 'book', flag: '--book' }]));
|
|
117
|
+
const integration = yield installApp(options.book, appId);
|
|
118
|
+
renderItem(integration.json(), format);
|
|
119
|
+
}))());
|
|
120
|
+
appCommand
|
|
121
|
+
.command('uninstall <appId>')
|
|
122
|
+
.description('Uninstall an app from a book')
|
|
123
|
+
.option('-b, --book <bookId>', 'Book ID')
|
|
124
|
+
.action((appId, options) => withAction('uninstalling app', (format) => __awaiter(this, void 0, void 0, function* () {
|
|
125
|
+
throwIfErrors(validateRequiredOptions(options, [{ name: 'book', flag: '--book' }]));
|
|
126
|
+
const integration = yield uninstallApp(options.book, appId);
|
|
127
|
+
renderItem(integration.json(), format);
|
|
128
|
+
}))());
|
|
129
|
+
}
|
|
130
|
+
//# sourceMappingURL=register.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../../src/commands/apps/register.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE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AE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC;QACpF,MAAM,WAAW,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAC1D,UAAU,CAAC,WAAW,CAAC,IAAI,EAAE,EAAE,MAAM,CAAC,CAAC;IAC3C,CAAC,CAAA,CAAC,EAAE,CACP,CAAC;IAEN,UAAU;SACL,OAAO,CAAC,mBAAmB,CAAC;SAC5B,WAAW,CAAC,8BAA8B,CAAC;SAC3C,MAAM,CAAC,qBAAqB,EAAE,SAAS,CAAC;SACxC,MAAM,CAAC,CAAC,KAAa,EAAE,OAAO,EAAE,EAAE,CAC/B,UAAU,CAAC,kBAAkB,EAAE,CAAM,MAAM,EAAC,EAAE;QAC1C,aAAa,CAAC,uBAAuB,CAAC,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC;QACpF,MAAM,WAAW,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAC5D,UAAU,CAAC,WAAW,CAAC,IAAI,EAAE,EAAE,MAAM,CAAC,CAAC;IAC3C,CAAC,CAAA,CAAC,EAAE,CACP,CAAC;AACV,CAAC"}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
import { Integration } from 'bkper-js';
|
|
2
|
+
/**
|
|
3
|
+
* Uninstalls an app from a book by removing its integration.
|
|
4
|
+
*
|
|
5
|
+
* @param bookId - The ID of the book to uninstall the app from
|
|
6
|
+
* @param appId - The ID of the app to uninstall
|
|
7
|
+
* @returns The removed Integration
|
|
8
|
+
* @throws Error if the app is not found in the book
|
|
9
|
+
*/
|
|
2
10
|
export declare function uninstallApp(bookId: string, appId: string): Promise<Integration>;
|
|
3
11
|
//# sourceMappingURL=uninstall.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uninstall.d.ts","sourceRoot":"","sources":["../../../src/commands/apps/uninstall.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,wBAAsB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAYtF"}
|
|
1
|
+
{"version":3,"file":"uninstall.d.ts","sourceRoot":"","sources":["../../../src/commands/apps/uninstall.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC;;;;;;;GAOG;AACH,wBAAsB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAYtF"}
|
|
@@ -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
|
+
* Uninstalls an app from a book by removing its integration.
|
|
13
|
+
*
|
|
14
|
+
* @param bookId - The ID of the book to uninstall the app from
|
|
15
|
+
* @param appId - The ID of the app to uninstall
|
|
16
|
+
* @returns The removed Integration
|
|
17
|
+
* @throws Error if the app is not found in the book
|
|
18
|
+
*/
|
|
11
19
|
export function uninstallApp(bookId, appId) {
|
|
12
20
|
return __awaiter(this, void 0, void 0, function* () {
|
|
13
21
|
const bkper = getBkperInstance();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uninstall.js","sourceRoot":"","sources":["../../../src/commands/apps/uninstall.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG1D,MAAM,UAAgB,YAAY,CAAC,MAAc,EAAE,KAAa;;QAC5D,MAAM,KAAK,GAAG,gBAAgB,EAAE,CAAC;QACjC,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACzC,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,eAAe,EAAE,CAAC;QAElD,MAAM,WAAW,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,EAAE,KAAK,KAAK,CAAC,CAAC;QAErE,IAAI,CAAC,WAAW,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,0BAA0B,KAAK,EAAE,CAAC,CAAC;QACvD,CAAC;QAED,OAAO,WAAW,CAAC,MAAM,EAAE,CAAC;IAChC,CAAC;CAAA"}
|
|
1
|
+
{"version":3,"file":"uninstall.js","sourceRoot":"","sources":["../../../src/commands/apps/uninstall.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG1D;;;;;;;GAOG;AACH,MAAM,UAAgB,YAAY,CAAC,MAAc,EAAE,KAAa;;QAC5D,MAAM,KAAK,GAAG,gBAAgB,EAAE,CAAC;QACjC,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACzC,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,eAAe,EAAE,CAAC;QAElD,MAAM,WAAW,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,EAAE,KAAK,KAAK,CAAC,CAAC;QAErE,IAAI,CAAC,WAAW,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,0BAA0B,KAAK,EAAE,CAAC,CAAC;QACvD,CAAC;QAED,OAAO,WAAW,CAAC,MAAM,EAAE,CAAC;IAChC,CAAC;CAAA"}
|
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
import { BalanceType } from 'bkper-js';
|
|
2
|
+
import type { OutputFormat } from '../../render/output.js';
|
|
3
|
+
/**
|
|
4
|
+
* Options for listing account balances from a book.
|
|
5
|
+
*/
|
|
2
6
|
export interface ListBalancesOptions {
|
|
3
7
|
query: string;
|
|
4
8
|
expanded?: number;
|
|
9
|
+
format?: OutputFormat;
|
|
5
10
|
}
|
|
6
11
|
/**
|
|
7
12
|
* Determines the appropriate BalanceType based on query operators.
|
|
8
13
|
* Uses after: presence as the heuristic: after: means PERIOD, otherwise CUMULATIVE.
|
|
9
14
|
*/
|
|
10
15
|
export declare function resolveBalanceType(query: string): BalanceType;
|
|
16
|
+
/**
|
|
17
|
+
* Fetches balances from a book and returns them as a data table matrix.
|
|
18
|
+
*
|
|
19
|
+
* @param bookId - The ID of the book to query balances from
|
|
20
|
+
* @param options - Query and formatting options
|
|
21
|
+
* @returns A 2D array with headers and balance data rows
|
|
22
|
+
*/
|
|
11
23
|
export declare function listBalancesMatrix(bookId: string, options: ListBalancesOptions): Promise<unknown[][]>;
|
|
12
24
|
//# sourceMappingURL=list.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/balances/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/balances/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,YAAY,CAAC;CACzB;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,CAE7D;AAED;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CACpC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,mBAAmB,GAC7B,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAsBtB"}
|
|
@@ -16,13 +16,28 @@ import { getBkperInstance } from '../../bkper-factory.js';
|
|
|
16
16
|
export function resolveBalanceType(query) {
|
|
17
17
|
return query.includes('after:') ? BalanceType.PERIOD : BalanceType.CUMULATIVE;
|
|
18
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Fetches balances from a book and returns them as a data table matrix.
|
|
21
|
+
*
|
|
22
|
+
* @param bookId - The ID of the book to query balances from
|
|
23
|
+
* @param options - Query and formatting options
|
|
24
|
+
* @returns A 2D array with headers and balance data rows
|
|
25
|
+
*/
|
|
19
26
|
export function listBalancesMatrix(bookId, options) {
|
|
20
27
|
return __awaiter(this, void 0, void 0, function* () {
|
|
21
28
|
const bkper = getBkperInstance();
|
|
22
29
|
const book = yield bkper.getBook(bookId);
|
|
23
30
|
const balanceType = resolveBalanceType(options.query);
|
|
24
31
|
const report = yield book.getBalancesReport(options.query);
|
|
25
|
-
const builder = report.createDataTable().
|
|
32
|
+
const builder = report.createDataTable().type(balanceType);
|
|
33
|
+
if (options.format === 'csv') {
|
|
34
|
+
// CSV: raw values for machine consumption, all metadata
|
|
35
|
+
builder.properties(true).hiddenProperties(true);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
// Table/JSON: human-readable formatted values
|
|
39
|
+
builder.formatValues(true).formatDates(true);
|
|
40
|
+
}
|
|
26
41
|
if (options.expanded) {
|
|
27
42
|
builder.expanded(options.expanded);
|
|
28
43
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/balances/list.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/balances/list.ts"],"names":[],"mappings":";;;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version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../src/commands/balances/register.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMzC,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAyB9D"}
|
|
@@ -0,0 +1,35 @@
|
|
|
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 { renderTable } from '../../render/index.js';
|
|
12
|
+
import { validateRequiredOptions, throwIfErrors } from '../../utils/validation.js';
|
|
13
|
+
import { listBalancesMatrix } from './index.js';
|
|
14
|
+
export function registerBalanceCommands(program) {
|
|
15
|
+
const balanceCommand = program.command('balance').description('Manage Balances');
|
|
16
|
+
balanceCommand
|
|
17
|
+
.command('list')
|
|
18
|
+
.description('List balances')
|
|
19
|
+
.option('-b, --book <bookId>', 'Book ID')
|
|
20
|
+
.option('-q, --query <query>', 'Balances query')
|
|
21
|
+
.option('--expanded <level>', 'Expand groups to specified depth (0+)', parseInt)
|
|
22
|
+
.action(options => withAction('listing balances', (format) => __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
throwIfErrors(validateRequiredOptions(options, [
|
|
24
|
+
{ name: 'book', flag: '--book' },
|
|
25
|
+
{ name: 'query', flag: '--query' },
|
|
26
|
+
]));
|
|
27
|
+
const matrix = yield listBalancesMatrix(options.book, {
|
|
28
|
+
query: options.query,
|
|
29
|
+
expanded: options.expanded,
|
|
30
|
+
format,
|
|
31
|
+
});
|
|
32
|
+
renderTable(matrix, format);
|
|
33
|
+
}))());
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=register.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../../src/commands/balances/register.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AACnF,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEhD,MAAM,UAAU,uBAAuB,CAAC,OAAgB;IACpD,MAAM,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC;IAEjF,cAAc;SACT,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,eAAe,CAAC;SAC5B,MAAM,CAAC,qBAAqB,EAAE,SAAS,CAAC;SACxC,MAAM,CAAC,qBAAqB,EAAE,gBAAgB,CAAC;SAC/C,MAAM,CAAC,oBAAoB,EAAE,uCAAuC,EAAE,QAAQ,CAAC;SAC/E,MAAM,CAAC,OAAO,CAAC,EAAE,CACd,UAAU,CAAC,kBAAkB,EAAE,CAAM,MAAM,EAAC,EAAE;QAC1C,aAAa,CACT,uBAAuB,CAAC,OAAO,EAAE;YAC7B,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE;YAChC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE;SACrC,CAAC,CACL,CAAC;QACF,MAAM,MAAM,GAAG,MAAM,kBAAkB,CAAC,OAAO,CAAC,IAAI,EAAE;YAClD,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,MAAM;SACT,CAAC,CAAC;QACH,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,CAAC,CAAA,CAAC,EAAE,CACP,CAAC;AACV,CAAC"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { Book } from 'bkper-js';
|
|
2
|
+
/**
|
|
3
|
+
* Options for creating a new Bkper book.
|
|
4
|
+
*/
|
|
2
5
|
export interface CreateBookOptions {
|
|
3
6
|
name: string;
|
|
4
7
|
fractionDigits?: number;
|
|
@@ -8,5 +11,11 @@ export interface CreateBookOptions {
|
|
|
8
11
|
period?: 'MONTH' | 'QUARTER' | 'YEAR';
|
|
9
12
|
property?: string[];
|
|
10
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Creates a new Bkper book with the specified options.
|
|
16
|
+
*
|
|
17
|
+
* @param options - Configuration for the new book
|
|
18
|
+
* @returns The newly created Book instance
|
|
19
|
+
*/
|
|
11
20
|
export declare function createBook(options: CreateBookOptions): Promise<Book>;
|
|
12
21
|
//# sourceMappingURL=create.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/commands/books/create.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAA4B,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/commands/books/create.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAA4B,MAAM,UAAU,CAAC;AAI1D;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,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,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;IACtC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAED;;;;;GAKG;AACH,wBAAsB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CA4B1E"}
|