bkper 4.31.3 → 5.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/README.md +12 -5
- package/lib/agent/startup-maintenance.d.ts +7 -4
- package/lib/agent/startup-maintenance.d.ts.map +1 -1
- package/lib/agent/startup-maintenance.js +13 -29
- package/lib/agent/startup-maintenance.js.map +1 -1
- package/lib/cli.js +8 -4
- package/lib/cli.js.map +1 -1
- package/lib/commands/accounts/batch-create.d.ts +1 -1
- package/lib/commands/accounts/batch-create.d.ts.map +1 -1
- package/lib/commands/accounts/batch-create.js +3 -3
- package/lib/commands/accounts/batch-create.js.map +1 -1
- package/lib/commands/accounts/list.d.ts +2 -3
- package/lib/commands/accounts/list.d.ts.map +1 -1
- package/lib/commands/accounts/list.js +2 -12
- package/lib/commands/accounts/list.js.map +1 -1
- package/lib/commands/accounts/register.js +13 -13
- package/lib/commands/accounts/register.js.map +1 -1
- package/lib/commands/action.d.ts +2 -3
- package/lib/commands/action.d.ts.map +1 -1
- package/lib/commands/action.js +2 -3
- package/lib/commands/action.js.map +1 -1
- package/lib/commands/apps/list.d.ts +2 -3
- package/lib/commands/apps/list.d.ts.map +1 -1
- package/lib/commands/apps/list.js +2 -14
- package/lib/commands/apps/list.js.map +1 -1
- package/lib/commands/apps/register.js +10 -10
- package/lib/commands/apps/register.js.map +1 -1
- package/lib/commands/balances/list.d.ts +0 -2
- package/lib/commands/balances/list.d.ts.map +1 -1
- package/lib/commands/balances/list.js +9 -17
- package/lib/commands/balances/list.js.map +1 -1
- package/lib/commands/balances/register.d.ts.map +1 -1
- package/lib/commands/balances/register.js +3 -4
- package/lib/commands/balances/register.js.map +1 -1
- package/lib/commands/books/list.d.ts +2 -4
- package/lib/commands/books/list.d.ts.map +1 -1
- package/lib/commands/books/list.js +2 -30
- package/lib/commands/books/list.js.map +1 -1
- package/lib/commands/books/register.js +12 -12
- package/lib/commands/books/register.js.map +1 -1
- package/lib/commands/cli-helpers.d.ts +9 -4
- package/lib/commands/cli-helpers.d.ts.map +1 -1
- package/lib/commands/cli-helpers.js +18 -12
- package/lib/commands/cli-helpers.js.map +1 -1
- package/lib/commands/collections/list.d.ts +2 -3
- package/lib/commands/collections/list.d.ts.map +1 -1
- package/lib/commands/collections/list.js +2 -14
- package/lib/commands/collections/list.js.map +1 -1
- package/lib/commands/collections/register.d.ts.map +1 -1
- package/lib/commands/collections/register.js +15 -25
- package/lib/commands/collections/register.js.map +1 -1
- package/lib/commands/events/event-json.d.ts +13 -0
- package/lib/commands/events/event-json.d.ts.map +1 -0
- package/lib/commands/events/event-json.js +33 -0
- package/lib/commands/events/event-json.js.map +1 -0
- package/lib/commands/events/list.d.ts +4 -3
- package/lib/commands/events/list.d.ts.map +1 -1
- package/lib/commands/events/list.js +15 -66
- package/lib/commands/events/list.js.map +1 -1
- package/lib/commands/events/register.d.ts.map +1 -1
- package/lib/commands/events/register.js +7 -6
- package/lib/commands/events/register.js.map +1 -1
- package/lib/commands/files/list.d.ts +3 -2
- package/lib/commands/files/list.d.ts.map +1 -1
- package/lib/commands/files/list.js +13 -42
- package/lib/commands/files/list.js.map +1 -1
- package/lib/commands/files/register.d.ts.map +1 -1
- package/lib/commands/files/register.js +13 -10
- package/lib/commands/files/register.js.map +1 -1
- package/lib/commands/groups/list.d.ts +2 -3
- package/lib/commands/groups/list.d.ts.map +1 -1
- package/lib/commands/groups/list.js +2 -12
- package/lib/commands/groups/list.js.map +1 -1
- package/lib/commands/groups/register.js +12 -12
- package/lib/commands/groups/register.js.map +1 -1
- package/lib/commands/transactions/batch-create.d.ts +1 -1
- package/lib/commands/transactions/batch-create.d.ts.map +1 -1
- package/lib/commands/transactions/batch-create.js +4 -3
- package/lib/commands/transactions/batch-create.js.map +1 -1
- package/lib/commands/transactions/batch-update.d.ts +1 -1
- package/lib/commands/transactions/batch-update.d.ts.map +1 -1
- package/lib/commands/transactions/batch-update.js +4 -3
- package/lib/commands/transactions/batch-update.js.map +1 -1
- package/lib/commands/transactions/list.d.ts +4 -7
- package/lib/commands/transactions/list.d.ts.map +1 -1
- package/lib/commands/transactions/list.js +15 -32
- package/lib/commands/transactions/list.js.map +1 -1
- package/lib/commands/transactions/register.d.ts +1 -1
- package/lib/commands/transactions/register.d.ts.map +1 -1
- package/lib/commands/transactions/register.js +27 -26
- package/lib/commands/transactions/register.js.map +1 -1
- package/lib/commands/transactions/transaction-json.d.ts +23 -0
- package/lib/commands/transactions/transaction-json.d.ts.map +1 -0
- package/lib/commands/transactions/transaction-json.js +56 -0
- package/lib/commands/transactions/transaction-json.js.map +1 -0
- package/lib/commands/upgrade.d.ts.map +1 -1
- package/lib/commands/upgrade.js +2 -3
- package/lib/commands/upgrade.js.map +1 -1
- package/lib/docs/apps/ai.md +2 -2
- package/lib/docs/apps/event-handlers.md +12 -0
- package/lib/docs/cli/app-management.md +1 -1
- package/lib/docs/cli/data-management.md +56 -54
- package/lib/docs/index.md +1 -1
- package/lib/docs/sdk/bkper-api-types.md +4 -2
- package/lib/docs/sdk/bkper-js.md +1 -0
- package/lib/docs-compliance/live-readme.d.ts.map +1 -1
- package/lib/docs-compliance/live-readme.js +0 -3
- package/lib/docs-compliance/live-readme.js.map +1 -1
- package/lib/docs-compliance/rules.d.ts.map +1 -1
- package/lib/docs-compliance/rules.js +9 -0
- package/lib/docs-compliance/rules.js.map +1 -1
- package/lib/render/index.d.ts +2 -4
- package/lib/render/index.d.ts.map +1 -1
- package/lib/render/index.js +1 -3
- package/lib/render/index.js.map +1 -1
- package/lib/render/output.d.ts +42 -22
- package/lib/render/output.d.ts.map +1 -1
- package/lib/render/output.js +62 -42
- package/lib/render/output.js.map +1 -1
- package/lib/upgrade/index.d.ts +5 -4
- package/lib/upgrade/index.d.ts.map +1 -1
- package/lib/upgrade/index.js +3 -2
- package/lib/upgrade/index.js.map +1 -1
- package/lib/upgrade/installation.d.ts +54 -20
- package/lib/upgrade/installation.d.ts.map +1 -1
- package/lib/upgrade/installation.js +222 -122
- package/lib/upgrade/installation.js.map +1 -1
- package/lib/upgrade/update-check.d.ts +69 -0
- package/lib/upgrade/update-check.d.ts.map +1 -0
- package/lib/upgrade/update-check.js +253 -0
- package/lib/upgrade/update-check.js.map +1 -0
- package/lib/upgrade/update-worker.d.ts +2 -0
- package/lib/upgrade/update-worker.d.ts.map +1 -0
- package/lib/upgrade/update-worker.js +6 -0
- package/lib/upgrade/update-worker.js.map +1 -0
- package/lib/upgrade/upgrade.d.ts +11 -28
- package/lib/upgrade/upgrade.d.ts.map +1 -1
- package/lib/upgrade/upgrade.js +49 -96
- package/lib/upgrade/upgrade.js.map +1 -1
- package/package.json +1 -1
- package/lib/render/csv-formatter.d.ts +0 -15
- package/lib/render/csv-formatter.d.ts.map +0 -1
- package/lib/render/csv-formatter.js +0 -37
- package/lib/render/csv-formatter.js.map +0 -1
- package/lib/render/table-formatter.d.ts +0 -34
- package/lib/render/table-formatter.d.ts.map +0 -1
- package/lib/render/table-formatter.js +0 -239
- package/lib/render/table-formatter.js.map +0 -1
package/README.md
CHANGED
|
@@ -110,7 +110,7 @@ Use direct commands for scripts, exports, automation, and repeatable workflows.
|
|
|
110
110
|
bkper book list
|
|
111
111
|
|
|
112
112
|
# Query transactions
|
|
113
|
-
bkper transaction list -b <bookId> -q 'on:2026-06'
|
|
113
|
+
bkper transaction list -b <bookId> -q 'on:2026-06'
|
|
114
114
|
|
|
115
115
|
# Query balances
|
|
116
116
|
bkper balance list -b <bookId> -q 'on:2026-06-30'
|
|
@@ -119,6 +119,13 @@ bkper balance list -b <bookId> -q 'on:2026-06-30'
|
|
|
119
119
|
bkper balance list -b <bookId> -q 'on:2026-06-30' --trial
|
|
120
120
|
```
|
|
121
121
|
|
|
122
|
+
Commands output JSON, ready for scripts and AI agents. Reshape it with `jq`, for example to export a CSV:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
bkper transaction list -b <bookId> -q 'on:2026-06' | \
|
|
126
|
+
jq -r '.items[] | [.date, .amount, .creditAccount.name, .debitAccount.name, .description] | @csv'
|
|
127
|
+
```
|
|
128
|
+
|
|
122
129
|
Capture a receipt as a draft, then review and complete it in Bkper or with the agent:
|
|
123
130
|
|
|
124
131
|
```bash
|
|
@@ -202,9 +209,9 @@ Manage books, files, accounts, transactions, events, and balances.
|
|
|
202
209
|
bkper book list
|
|
203
210
|
bkper account list -b <bookId>
|
|
204
211
|
bkper file list -b <bookId> --limit 100
|
|
205
|
-
bkper transaction list -b <bookId> -q 'on:2026'
|
|
206
|
-
bkper event list -b <bookId> --error
|
|
207
|
-
bkper balance list -b <bookId> -q 'on:2026-12-31'
|
|
212
|
+
bkper transaction list -b <bookId> -q 'on:2026'
|
|
213
|
+
bkper event list -b <bookId> --error
|
|
214
|
+
bkper balance list -b <bookId> -q 'on:2026-12-31'
|
|
208
215
|
```
|
|
209
216
|
|
|
210
217
|
→ [Full Data Management reference](https://github.com/bkper/bkper-cli/blob/main/skill/references/cli/data-management.md)
|
|
@@ -218,7 +225,7 @@ Build, deploy, and manage Bkper apps. Sync and deploy require clean, committed s
|
|
|
218
225
|
```bash
|
|
219
226
|
bkper app init my-app
|
|
220
227
|
cd my-app
|
|
221
|
-
bkper app get my-app
|
|
228
|
+
bkper app get my-app
|
|
222
229
|
bkper app dev
|
|
223
230
|
bkper app sync
|
|
224
231
|
bkper app deploy
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type UpdateNotice } from '../upgrade/index.js';
|
|
2
2
|
type NotificationType = 'info' | 'warning' | 'error';
|
|
3
3
|
export interface StartupMaintenanceCallbacks {
|
|
4
4
|
notify: (message: string, type?: NotificationType) => void;
|
|
5
5
|
}
|
|
6
6
|
export interface StartupMaintenanceDependencies {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
startDetachedUpgrade: (method: InstallMethod, version: string) => void;
|
|
7
|
+
readNotice: () => UpdateNotice | undefined;
|
|
8
|
+
startUpdateCheck: () => boolean;
|
|
10
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* Reports the outcome of the last background update and starts the daily
|
|
12
|
+
* check. The install itself runs in the detached update worker.
|
|
13
|
+
*/
|
|
11
14
|
export declare function runStartupMaintenance(callbacks: StartupMaintenanceCallbacks, dependencies?: StartupMaintenanceDependencies): Promise<void>;
|
|
12
15
|
export {};
|
|
13
16
|
//# sourceMappingURL=startup-maintenance.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"startup-maintenance.d.ts","sourceRoot":"","sources":["../../src/agent/startup-maintenance.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"startup-maintenance.d.ts","sourceRoot":"","sources":["../../src/agent/startup-maintenance.ts"],"names":[],"mappings":"AAAA,OAAO,EAMH,KAAK,YAAY,EACpB,MAAM,qBAAqB,CAAC;AAE7B,KAAK,gBAAgB,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;AAErD,MAAM,WAAW,2BAA2B;IACxC,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,gBAAgB,KAAK,IAAI,CAAC;CAC9D;AAED,MAAM,WAAW,8BAA8B;IAC3C,UAAU,EAAE,MAAM,YAAY,GAAG,SAAS,CAAC;IAC3C,gBAAgB,EAAE,MAAM,OAAO,CAAC;CACnC;AASD;;;GAGG;AACH,wBAAsB,qBAAqB,CACvC,SAAS,EAAE,2BAA2B,EACtC,YAAY,GAAE,8BAA4D,GAC3E,OAAO,CAAC,IAAI,CAAC,CAiBf"}
|
|
@@ -7,46 +7,30 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import {
|
|
10
|
+
import { formatUpdateNotice, getUpdateNotice, isUpdateCheckDisabled, maybeStartUpdateCheck, readUpdateState, } from '../upgrade/index.js';
|
|
11
11
|
function createDefaultDependencies() {
|
|
12
12
|
return {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
startDetachedUpgrade,
|
|
13
|
+
readNotice: () => getUpdateNotice(readUpdateState()),
|
|
14
|
+
startUpdateCheck: () => maybeStartUpdateCheck(),
|
|
16
15
|
};
|
|
17
16
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Reports the outcome of the last background update and starts the daily
|
|
19
|
+
* check. The install itself runs in the detached update worker.
|
|
20
|
+
*/
|
|
21
21
|
export function runStartupMaintenance(callbacks_1) {
|
|
22
22
|
return __awaiter(this, arguments, void 0, function* (callbacks, dependencies = createDefaultDependencies()) {
|
|
23
|
-
if (
|
|
23
|
+
if (isUpdateCheckDisabled()) {
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
26
|
try {
|
|
27
|
-
const
|
|
28
|
-
if (
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
if (availableUpgrade.method === 'unknown') {
|
|
32
|
-
callbacks.notify(getManualUpgradeMessage(availableUpgrade.latest), 'warning');
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
if (yield dependencies.isVersionInstalled(availableUpgrade.method, availableUpgrade.latest)) {
|
|
36
|
-
callbacks.notify(`bkper ${availableUpgrade.latest} is already installed. ` +
|
|
37
|
-
`Restart this session to use it.`, 'info');
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
try {
|
|
41
|
-
dependencies.startDetachedUpgrade(availableUpgrade.method, availableUpgrade.latest);
|
|
42
|
-
callbacks.notify(`Updating bkper to ${availableUpgrade.latest} in background. ` +
|
|
43
|
-
`Restart later to use it.`, 'info');
|
|
44
|
-
}
|
|
45
|
-
catch (_a) {
|
|
46
|
-
callbacks.notify(getManualUpgradeMessage(availableUpgrade.latest), 'warning');
|
|
27
|
+
const notice = dependencies.readNotice();
|
|
28
|
+
if (notice) {
|
|
29
|
+
callbacks.notify(formatUpdateNotice(notice), notice.kind === 'installed' ? 'info' : 'warning');
|
|
47
30
|
}
|
|
31
|
+
dependencies.startUpdateCheck();
|
|
48
32
|
}
|
|
49
|
-
catch (
|
|
33
|
+
catch (_a) {
|
|
50
34
|
// Silent failure — never break the TUI
|
|
51
35
|
}
|
|
52
36
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"startup-maintenance.js","sourceRoot":"","sources":["../../src/agent/startup-maintenance.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EACH,
|
|
1
|
+
{"version":3,"file":"startup-maintenance.js","sourceRoot":"","sources":["../../src/agent/startup-maintenance.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EACH,kBAAkB,EAClB,eAAe,EACf,qBAAqB,EACrB,qBAAqB,EACrB,eAAe,GAElB,MAAM,qBAAqB,CAAC;AAa7B,SAAS,yBAAyB;IAC9B,OAAO;QACH,UAAU,EAAE,GAAG,EAAE,CAAC,eAAe,CAAC,eAAe,EAAE,CAAC;QACpD,gBAAgB,EAAE,GAAG,EAAE,CAAC,qBAAqB,EAAE;KAClD,CAAC;AACN,CAAC;AAED;;;GAGG;AACH,MAAM,UAAgB,qBAAqB;yDACvC,SAAsC,EACtC,eAA+C,yBAAyB,EAAE;QAE1E,IAAI,qBAAqB,EAAE,EAAE,CAAC;YAC1B,OAAO;QACX,CAAC;QAED,IAAI,CAAC;YACD,MAAM,MAAM,GAAG,YAAY,CAAC,UAAU,EAAE,CAAC;YACzC,IAAI,MAAM,EAAE,CAAC;gBACT,SAAS,CAAC,MAAM,CACZ,kBAAkB,CAAC,MAAM,CAAC,EAC1B,MAAM,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CACnD,CAAC;YACN,CAAC;YACD,YAAY,CAAC,gBAAgB,EAAE,CAAC;QACpC,CAAC;QAAC,WAAM,CAAC;YACL,uCAAuC;QAC3C,CAAC;IACL,CAAC;CAAA"}
|
package/lib/cli.js
CHANGED
|
@@ -21,9 +21,10 @@ import { registerCollectionCommands } from './commands/collections/register.js';
|
|
|
21
21
|
import { registerFileCommands } from './commands/files/register.js';
|
|
22
22
|
import { registerEventCommands } from './commands/events/register.js';
|
|
23
23
|
import { registerUpgradeCommand } from './commands/upgrade.js';
|
|
24
|
+
import { registerOutputOptions } from './commands/cli-helpers.js';
|
|
24
25
|
import { getAgentCommandArgs, shouldRunAgentCommand, shouldShowHelpForBareInvocation, } from './agent/cli-dispatch.js';
|
|
25
26
|
import { runAgentCommandInChild } from './agent/agent-command-runner.js';
|
|
26
|
-
import { VERSION } from './upgrade/index.js';
|
|
27
|
+
import { VERSION, runCommandUpdateCheck } from './upgrade/index.js';
|
|
27
28
|
import { getUnsupportedNodeVersionMessage } from './utils/node-version.js';
|
|
28
29
|
function registerAgentCommands(command) {
|
|
29
30
|
command
|
|
@@ -49,12 +50,15 @@ function main() {
|
|
|
49
50
|
process.exit(1);
|
|
50
51
|
}
|
|
51
52
|
}
|
|
53
|
+
// Daily background update check (never blocks, installs only safe global copies)
|
|
54
|
+
if (process.argv[2] !== 'upgrade') {
|
|
55
|
+
runCommandUpdateCheck();
|
|
56
|
+
}
|
|
52
57
|
// Version
|
|
53
58
|
program.name('bkper');
|
|
54
59
|
program.version(VERSION, '-v, --version');
|
|
55
|
-
//
|
|
56
|
-
program
|
|
57
|
-
program.option('--json', 'Output as JSON (alias for --format json)');
|
|
60
|
+
// Output is JSON only; legacy --json / --format json are accepted no-ops
|
|
61
|
+
registerOutputOptions(program);
|
|
58
62
|
// Auth commands
|
|
59
63
|
registerAuthCommands(program);
|
|
60
64
|
// Resource commands
|
package/lib/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;;;;;AAEA,OAAO,eAAe,CAAC,CAAC,sDAAsD;AAE9E,OAAO,EAAE,OAAO,EAAgB,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,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AC;IACnB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"batch-create.d.ts","sourceRoot":"","sources":["../../../src/commands/accounts/batch-create.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"batch-create.d.ts","sourceRoot":"","sources":["../../../src/commands/accounts/batch-create.ts"],"names":[],"mappings":"AAKA;;;;;;;;;GASG;AACH,wBAAsB,mBAAmB,CACrC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EAChC,iBAAiB,CAAC,EAAE,MAAM,EAAE,GAC7B,OAAO,CAAC,IAAI,CAAC,CA0Bf"}
|
|
@@ -10,9 +10,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { getBkperInstance } from '../../bkper-factory.js';
|
|
11
11
|
import { Account } from 'bkper-js';
|
|
12
12
|
import { parsePropertyFlag } from '../../utils/properties.js';
|
|
13
|
+
import { renderList } from '../../render/index.js';
|
|
13
14
|
/**
|
|
14
15
|
* Creates multiple accounts from stdin items using the batch API.
|
|
15
|
-
* Outputs
|
|
16
|
+
* Outputs all created accounts in an `{"items":[...]}` envelope.
|
|
16
17
|
*
|
|
17
18
|
* Stdin items must follow the bkper.Account format exactly.
|
|
18
19
|
*
|
|
@@ -42,8 +43,7 @@ export function batchCreateAccounts(bookId, items, propertyOverrides) {
|
|
|
42
43
|
accounts.push(account);
|
|
43
44
|
}
|
|
44
45
|
const results = yield book.batchCreateAccounts(accounts);
|
|
45
|
-
|
|
46
|
-
console.log(JSON.stringify(allResults, null, 2));
|
|
46
|
+
renderList({ items: results.map(result => result.json()) });
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
function buildAccountFromStdin(book, item) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"batch-create.js","sourceRoot":"","sources":["../../../src/commands/accounts/batch-create.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAQ,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"batch-create.js","sourceRoot":"","sources":["../../../src/commands/accounts/batch-create.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAQ,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD;;;;;;;;;GASG;AACH,MAAM,UAAgB,mBAAmB,CACrC,MAAc,EACd,KAAgC,EAChC,iBAA4B;;QAE5B,MAAM,KAAK,GAAG,gBAAgB,EAAE,CAAC;QACjC,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAEzC,MAAM,QAAQ,GAAc,EAAE,CAAC;QAE/B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACvB,MAAM,OAAO,GAAG,MAAM,qBAAqB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YAExD,iDAAiD;YACjD,IAAI,iBAAiB,EAAE,CAAC;gBACpB,KAAK,MAAM,GAAG,IAAI,iBAAiB,EAAE,CAAC;oBAClC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,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,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|
|
1
1
|
import { Account } from 'bkper-js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ListResult } from '../../render/output.js';
|
|
3
3
|
/**
|
|
4
4
|
* Retrieves all accounts from the specified book.
|
|
5
5
|
*
|
|
@@ -9,7 +9,6 @@ import type { OutputFormat, ListResult } from '../../render/output.js';
|
|
|
9
9
|
export declare function listAccounts(bookId: string): Promise<Account[]>;
|
|
10
10
|
/**
|
|
11
11
|
* Lists accounts and returns a ListResult ready for rendering.
|
|
12
|
-
* Absorbs AccountsDataTableBuilder config and JSON mapping.
|
|
13
12
|
*/
|
|
14
|
-
export declare function listAccountsFormatted(bookId: string
|
|
13
|
+
export declare function listAccountsFormatted(bookId: string): Promise<ListResult>;
|
|
15
14
|
//# sourceMappingURL=list.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/accounts/list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/accounts/list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzD;;;;;GAKG;AACH,wBAAsB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAKrE;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAG/E"}
|
|
@@ -8,7 +8,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { getBkperInstance } from '../../bkper-factory.js';
|
|
11
|
-
import { AccountsDataTableBuilder } from 'bkper-js';
|
|
12
11
|
/**
|
|
13
12
|
* Retrieves all accounts from the specified book.
|
|
14
13
|
*
|
|
@@ -25,20 +24,11 @@ export function listAccounts(bookId) {
|
|
|
25
24
|
}
|
|
26
25
|
/**
|
|
27
26
|
* Lists accounts and returns a ListResult ready for rendering.
|
|
28
|
-
* Absorbs AccountsDataTableBuilder config and JSON mapping.
|
|
29
27
|
*/
|
|
30
|
-
export function listAccountsFormatted(bookId
|
|
28
|
+
export function listAccountsFormatted(bookId) {
|
|
31
29
|
return __awaiter(this, void 0, void 0, function* () {
|
|
32
30
|
const accounts = yield listAccounts(bookId);
|
|
33
|
-
|
|
34
|
-
return { kind: 'json', items: accounts.map(a => a.json()) };
|
|
35
|
-
}
|
|
36
|
-
const builder = new AccountsDataTableBuilder(accounts).ids(true).groups(true);
|
|
37
|
-
if (format === 'csv') {
|
|
38
|
-
builder.properties(true).hiddenProperties(true);
|
|
39
|
-
}
|
|
40
|
-
const matrix = yield builder.build();
|
|
41
|
-
return { kind: 'matrix', matrix };
|
|
31
|
+
return { items: accounts.map(a => a.json()) };
|
|
42
32
|
});
|
|
43
33
|
}
|
|
44
34
|
//# sourceMappingURL=list.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/accounts/list.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/accounts/list.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAI1D;;;;;GAKG;AACH,MAAM,UAAgB,YAAY,CAAC,MAAc;;QAC7C,MAAM,KAAK,GAAG,gBAAgB,EAAE,CAAC;QACjC,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QACrD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;QAC1C,OAAO,QAAQ,IAAI,EAAE,CAAC;IAC1B,CAAC;CAAA;AAED;;GAEG;AACH,MAAM,UAAgB,qBAAqB,CAAC,MAAc;;QACtD,MAAM,QAAQ,GAAG,MAAM,YAAY,CAAC,MAAM,CAAC,CAAC;QAC5C,OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC;IAClD,CAAC;CAAA"}
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { withAction } from '../action.js';
|
|
11
11
|
import { collectProperty } from '../cli-helpers.js';
|
|
12
|
-
import {
|
|
12
|
+
import { renderList, renderItem } from '../../render/index.js';
|
|
13
13
|
import { validateRequiredOptions, throwIfErrors } from '../../utils/validation.js';
|
|
14
14
|
import { parseStdinItems } from '../../input/index.js';
|
|
15
15
|
import { listAccountsFormatted, getAccount, createAccount, updateAccount, deleteAccount, batchCreateAccounts, } from './index.js';
|
|
@@ -19,19 +19,19 @@ export function registerAccountCommands(program) {
|
|
|
19
19
|
.command('list')
|
|
20
20
|
.description('List all accounts in a book')
|
|
21
21
|
.option('-b, --book <bookId>', 'Book ID')
|
|
22
|
-
.action(options => withAction('listing accounts', (
|
|
22
|
+
.action(options => withAction('listing accounts', () => __awaiter(this, void 0, void 0, function* () {
|
|
23
23
|
throwIfErrors(validateRequiredOptions(options, [{ name: 'book', flag: '--book' }]));
|
|
24
|
-
const result = yield listAccountsFormatted(options.book
|
|
25
|
-
|
|
24
|
+
const result = yield listAccountsFormatted(options.book);
|
|
25
|
+
renderList(result);
|
|
26
26
|
}))());
|
|
27
27
|
accountCommand
|
|
28
28
|
.command('get <idOrName>')
|
|
29
29
|
.description('Get an account by ID or name')
|
|
30
30
|
.option('-b, --book <bookId>', 'Book ID')
|
|
31
|
-
.action((idOrName, options) => withAction('getting account', (
|
|
31
|
+
.action((idOrName, options) => withAction('getting account', () => __awaiter(this, void 0, void 0, function* () {
|
|
32
32
|
throwIfErrors(validateRequiredOptions(options, [{ name: 'book', flag: '--book' }]));
|
|
33
33
|
const account = yield getAccount(options.book, idOrName);
|
|
34
|
-
renderItem(account.json()
|
|
34
|
+
renderItem(account.json());
|
|
35
35
|
}))());
|
|
36
36
|
accountCommand
|
|
37
37
|
.command('create')
|
|
@@ -42,14 +42,14 @@ export function registerAccountCommands(program) {
|
|
|
42
42
|
.option('--description <description>', 'Account description')
|
|
43
43
|
.option('--groups <groups>', 'Comma-separated group names')
|
|
44
44
|
.option('-p, --property <key=value>', 'Set a property (repeatable)', collectProperty)
|
|
45
|
-
.action(options => withAction('creating account', (
|
|
45
|
+
.action(options => withAction('creating account', () => __awaiter(this, void 0, void 0, function* () {
|
|
46
46
|
const stdinData = !process.stdin.isTTY ? yield parseStdinItems() : null;
|
|
47
47
|
if (stdinData && stdinData.items.length > 0) {
|
|
48
48
|
throwIfErrors(validateRequiredOptions(options, [{ name: 'book', flag: '--book' }]));
|
|
49
49
|
yield batchCreateAccounts(options.book, stdinData.items, options.property);
|
|
50
50
|
}
|
|
51
51
|
else if (stdinData && stdinData.items.length === 0) {
|
|
52
|
-
|
|
52
|
+
renderList({ items: [] });
|
|
53
53
|
}
|
|
54
54
|
else {
|
|
55
55
|
throwIfErrors(validateRequiredOptions(options, [
|
|
@@ -65,7 +65,7 @@ export function registerAccountCommands(program) {
|
|
|
65
65
|
: undefined,
|
|
66
66
|
property: options.property,
|
|
67
67
|
});
|
|
68
|
-
renderItem(account.json()
|
|
68
|
+
renderItem(account.json());
|
|
69
69
|
}
|
|
70
70
|
}))());
|
|
71
71
|
accountCommand
|
|
@@ -76,7 +76,7 @@ export function registerAccountCommands(program) {
|
|
|
76
76
|
.option('--type <type>', 'Account type (ASSET, LIABILITY, INCOMING, OUTGOING)')
|
|
77
77
|
.option('--archived <archived>', 'Archive status (true/false)')
|
|
78
78
|
.option('-p, --property <key=value>', 'Set a property (repeatable)', collectProperty)
|
|
79
|
-
.action((idOrName, options) => withAction('updating account', (
|
|
79
|
+
.action((idOrName, options) => withAction('updating account', () => __awaiter(this, void 0, void 0, function* () {
|
|
80
80
|
throwIfErrors(validateRequiredOptions(options, [{ name: 'book', flag: '--book' }]));
|
|
81
81
|
const account = yield updateAccount(options.book, idOrName, {
|
|
82
82
|
name: options.name,
|
|
@@ -84,16 +84,16 @@ export function registerAccountCommands(program) {
|
|
|
84
84
|
archived: options.archived !== undefined ? options.archived === 'true' : undefined,
|
|
85
85
|
property: options.property,
|
|
86
86
|
});
|
|
87
|
-
renderItem(account.json()
|
|
87
|
+
renderItem(account.json());
|
|
88
88
|
}))());
|
|
89
89
|
accountCommand
|
|
90
90
|
.command('delete <idOrName>')
|
|
91
91
|
.description('Delete an account')
|
|
92
92
|
.option('-b, --book <bookId>', 'Book ID')
|
|
93
|
-
.action((idOrName, options) => withAction('deleting account', (
|
|
93
|
+
.action((idOrName, options) => withAction('deleting account', () => __awaiter(this, void 0, void 0, function* () {
|
|
94
94
|
throwIfErrors(validateRequiredOptions(options, [{ name: 'book', flag: '--book' }]));
|
|
95
95
|
const account = yield deleteAccount(options.book, idOrName);
|
|
96
|
-
renderItem(account.json()
|
|
96
|
+
renderItem(account.json());
|
|
97
97
|
}))());
|
|
98
98
|
}
|
|
99
99
|
//# sourceMappingURL=register.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../../src/commands/accounts/register.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../../src/commands/accounts/register.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,UAAU,EAAE,MAA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/**
|
|
3
2
|
* Options for the action wrapper.
|
|
4
3
|
*/
|
|
@@ -13,9 +12,9 @@ interface ActionOptions {
|
|
|
13
12
|
* from every command handler.
|
|
14
13
|
*
|
|
15
14
|
* @param label - Human-readable label for error messages (e.g. "listing books")
|
|
16
|
-
* @param fn - The action function.
|
|
15
|
+
* @param fn - The action function.
|
|
17
16
|
* @param options - Optional configuration (e.g. skipSetup)
|
|
18
17
|
*/
|
|
19
|
-
export declare function withAction(label: string, fn: (
|
|
18
|
+
export declare function withAction(label: string, fn: () => Promise<void>, options?: ActionOptions): () => Promise<void>;
|
|
20
19
|
export {};
|
|
21
20
|
//# sourceMappingURL=action.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../src/commands/action.ts"],"names":[],"mappings":"AAGA
|
|
1
|
+
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../src/commands/action.ts"],"names":[],"mappings":"AAGA;;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,MAAM,OAAO,CAAC,IAAI,CAAC,EACvB,OAAO,CAAC,EAAE,aAAa,GACxB,MAAM,OAAO,CAAC,IAAI,CAAC,CAYrB"}
|
package/lib/commands/action.js
CHANGED
|
@@ -9,7 +9,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { getErrorMessage } from '../auth/auth-errors.js';
|
|
11
11
|
import { setupBkper } from '../bkper-factory.js';
|
|
12
|
-
import { getFormat } from './cli-helpers.js';
|
|
13
12
|
/**
|
|
14
13
|
* Wraps a CLI command action with consistent error handling and Bkper setup.
|
|
15
14
|
*
|
|
@@ -17,7 +16,7 @@ import { getFormat } from './cli-helpers.js';
|
|
|
17
16
|
* from every command handler.
|
|
18
17
|
*
|
|
19
18
|
* @param label - Human-readable label for error messages (e.g. "listing books")
|
|
20
|
-
* @param fn - The action function.
|
|
19
|
+
* @param fn - The action function.
|
|
21
20
|
* @param options - Optional configuration (e.g. skipSetup)
|
|
22
21
|
*/
|
|
23
22
|
export function withAction(label, fn, options) {
|
|
@@ -26,7 +25,7 @@ export function withAction(label, fn, options) {
|
|
|
26
25
|
if (!(options === null || options === void 0 ? void 0 : options.skipSetup)) {
|
|
27
26
|
setupBkper();
|
|
28
27
|
}
|
|
29
|
-
yield fn(
|
|
28
|
+
yield fn();
|
|
30
29
|
}
|
|
31
30
|
catch (err) {
|
|
32
31
|
console.error(`Error ${label}: ${getErrorMessage(err)}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.js","sourceRoot":"","sources":["../../src/commands/action.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"action.js","sourceRoot":"","sources":["../../src/commands/action.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAUjD;;;;;;;;;GASG;AACH,MAAM,UAAU,UAAU,CACtB,KAAa,EACb,EAAuB,EACvB,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,EAAE,CAAC;QACf,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACX,OAAO,CAAC,KAAK,CAAC,SAAS,KAAK,KAAK,eAAe,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YACzD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,CAAC;IACL,CAAC,CAAA,CAAC;AACN,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ListResult } from '../../render/output.js';
|
|
2
2
|
/**
|
|
3
3
|
* Lists all apps the authenticated user has access to.
|
|
4
4
|
*
|
|
@@ -7,7 +7,6 @@ import type { OutputFormat, ListResult } from '../../render/output.js';
|
|
|
7
7
|
export declare function listApps(): Promise<bkper.App[]>;
|
|
8
8
|
/**
|
|
9
9
|
* Lists apps and returns a ListResult ready for rendering.
|
|
10
|
-
* Absorbs manual matrix building and JSON mapping.
|
|
11
10
|
*/
|
|
12
|
-
export declare function listAppsFormatted(
|
|
11
|
+
export declare function listAppsFormatted(): Promise<ListResult>;
|
|
13
12
|
//# sourceMappingURL=list.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/apps/list.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/apps/list.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzD;;;;GAIG;AACH,wBAAsB,QAAQ,IAAI,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAIrD;AAED;;GAEG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,UAAU,CAAC,CAE7D"}
|
|
@@ -22,22 +22,10 @@ export function listApps() {
|
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
24
|
* Lists apps and returns a ListResult ready for rendering.
|
|
25
|
-
* Absorbs manual matrix building and JSON mapping.
|
|
26
25
|
*/
|
|
27
|
-
export function listAppsFormatted(
|
|
26
|
+
export function listAppsFormatted() {
|
|
28
27
|
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
-
|
|
30
|
-
if (format === 'json') {
|
|
31
|
-
return { kind: 'json', items: 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 };
|
|
28
|
+
return { items: yield listApps() };
|
|
41
29
|
});
|
|
42
30
|
}
|
|
43
31
|
//# sourceMappingURL=list.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/apps/list.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG1D;;;;GAIG;AACH,MAAM,UAAgB,QAAQ;;QAC1B,MAAM,KAAK,GAAG,gBAAgB,EAAE,CAAC;QACjC,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,OAAO,EAAE,CAAC;QACnC,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;IACvC,CAAC;CAAA;AAED
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/apps/list.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG1D;;;;GAIG;AACH,MAAM,UAAgB,QAAQ;;QAC1B,MAAM,KAAK,GAAG,gBAAgB,EAAE,CAAC;QACjC,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,OAAO,EAAE,CAAC;QACnC,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;IACvC,CAAC;CAAA;AAED;;GAEG;AACH,MAAM,UAAgB,iBAAiB;;QACnC,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,EAAE,EAAE,CAAC;IACvC,CAAC;CAAA"}
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { withAction } from '../action.js';
|
|
11
11
|
import { setupBkper } from '../../bkper-factory.js';
|
|
12
|
-
import {
|
|
12
|
+
import { renderList, renderItem } from '../../render/index.js';
|
|
13
13
|
import { validateRequiredOptions, throwIfErrors } from '../../utils/validation.js';
|
|
14
14
|
import { getApp, listAppsFormatted, syncApp, deployApp, undeployApp, statusApp, logsApp, initApp, secretsPut, secretsList, secretsDelete, dev, build, installApp, uninstallApp, cloneManagedAppCommand, runGitCredentialHelper, } from './index.js';
|
|
15
15
|
export function registerAppCommands(program) {
|
|
@@ -42,16 +42,16 @@ export function registerAppCommands(program) {
|
|
|
42
42
|
appCommand
|
|
43
43
|
.command('get <appId>')
|
|
44
44
|
.description('Get an app by ID')
|
|
45
|
-
.action((appId) => withAction('getting app', (
|
|
45
|
+
.action((appId) => withAction('getting app', () => __awaiter(this, void 0, void 0, function* () {
|
|
46
46
|
const app = yield getApp(appId);
|
|
47
|
-
renderItem(app.json()
|
|
47
|
+
renderItem(app.json());
|
|
48
48
|
}))());
|
|
49
49
|
appCommand
|
|
50
50
|
.command('list')
|
|
51
51
|
.description('List all apps you have access to')
|
|
52
|
-
.action(withAction('listing apps', (
|
|
53
|
-
const result = yield listAppsFormatted(
|
|
54
|
-
|
|
52
|
+
.action(withAction('listing apps', () => __awaiter(this, void 0, void 0, function* () {
|
|
53
|
+
const result = yield listAppsFormatted();
|
|
54
|
+
renderList(result);
|
|
55
55
|
})));
|
|
56
56
|
appCommand
|
|
57
57
|
.command('sync')
|
|
@@ -142,19 +142,19 @@ export function registerAppCommands(program) {
|
|
|
142
142
|
.command('install <appId>')
|
|
143
143
|
.description('Install an app into a book')
|
|
144
144
|
.option('-b, --book <bookId>', 'Book ID')
|
|
145
|
-
.action((appId, options) => withAction('installing app', (
|
|
145
|
+
.action((appId, options) => withAction('installing app', () => __awaiter(this, void 0, void 0, function* () {
|
|
146
146
|
throwIfErrors(validateRequiredOptions(options, [{ name: 'book', flag: '--book' }]));
|
|
147
147
|
const integration = yield installApp(options.book, appId);
|
|
148
|
-
renderItem(integration.json()
|
|
148
|
+
renderItem(integration.json());
|
|
149
149
|
}))());
|
|
150
150
|
appCommand
|
|
151
151
|
.command('uninstall <appId>')
|
|
152
152
|
.description('Uninstall an app from a book')
|
|
153
153
|
.option('-b, --book <bookId>', 'Book ID')
|
|
154
|
-
.action((appId, options) => withAction('uninstalling app', (
|
|
154
|
+
.action((appId, options) => withAction('uninstalling app', () => __awaiter(this, void 0, void 0, function* () {
|
|
155
155
|
throwIfErrors(validateRequiredOptions(options, [{ name: 'book', flag: '--book' }]));
|
|
156
156
|
const integration = yield uninstallApp(options.book, appId);
|
|
157
|
-
renderItem(integration.json()
|
|
157
|
+
renderItem(integration.json());
|
|
158
158
|
}))());
|
|
159
159
|
}
|
|
160
160
|
//# sourceMappingURL=register.js.map
|