bkper 4.12.31 → 4.13.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 +4 -1
- package/lib/auth/local-auth-service.d.ts.map +1 -1
- package/lib/auth/local-auth-service.js +83 -66
- package/lib/auth/local-auth-service.js.map +1 -1
- package/lib/cli.js +2 -0
- package/lib/cli.js.map +1 -1
- package/lib/commands/cli-helpers.d.ts +4 -0
- package/lib/commands/cli-helpers.d.ts.map +1 -1
- package/lib/commands/cli-helpers.js +8 -2
- package/lib/commands/cli-helpers.js.map +1 -1
- package/lib/commands/files/get.d.ts +14 -0
- package/lib/commands/files/get.d.ts.map +1 -0
- package/lib/commands/files/get.js +34 -0
- package/lib/commands/files/get.js.map +1 -0
- package/lib/commands/files/index.d.ts +3 -0
- package/lib/commands/files/index.d.ts.map +1 -0
- package/lib/commands/files/index.js +3 -0
- package/lib/commands/files/index.js.map +1 -0
- package/lib/commands/files/register.d.ts +3 -0
- package/lib/commands/files/register.d.ts.map +1 -0
- package/lib/commands/files/register.js +42 -0
- package/lib/commands/files/register.js.map +1 -0
- package/lib/commands/files/upload.d.ts +18 -0
- package/lib/commands/files/upload.d.ts.map +1 -0
- package/lib/commands/files/upload.js +94 -0
- package/lib/commands/files/upload.js.map +1 -0
- package/lib/commands/transactions/create.d.ts +9 -0
- package/lib/commands/transactions/create.d.ts.map +1 -1
- package/lib/commands/transactions/create.js +30 -1
- package/lib/commands/transactions/create.js.map +1 -1
- package/lib/commands/transactions/index.d.ts +1 -1
- package/lib/commands/transactions/index.d.ts.map +1 -1
- package/lib/commands/transactions/index.js +1 -1
- package/lib/commands/transactions/index.js.map +1 -1
- package/lib/commands/transactions/register.d.ts.map +1 -1
- package/lib/commands/transactions/register.js +5 -2
- package/lib/commands/transactions/register.js.map +1 -1
- package/lib/docs/cli-reference.md +4 -1
- package/lib/docs/data-management.md +45 -1
- package/lib/docs/index.md +2 -2
- package/lib/utils/local-file.d.ts +11 -0
- package/lib/utils/local-file.d.ts.map +1 -0
- package/lib/utils/local-file.js +55 -0
- package/lib/utils/local-file.js.map +1 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -137,10 +137,13 @@ Pi-specific extensions are loaded from Pi extension folders (for example `.pi/ex
|
|
|
137
137
|
|
|
138
138
|
## Data Management
|
|
139
139
|
|
|
140
|
-
Manage books, accounts, transactions, and balances.
|
|
140
|
+
Manage books, files, accounts, transactions, and balances.
|
|
141
141
|
|
|
142
142
|
```bash
|
|
143
143
|
bkper book list
|
|
144
|
+
bkper file upload ./receipt.pdf -b <bookId>
|
|
145
|
+
bkper file get <fileId> -b <bookId>
|
|
146
|
+
bkper transaction create -b <bookId> --description "Team lunch" --file ./receipt.pdf
|
|
144
147
|
bkper account list -b <bookId>
|
|
145
148
|
bkper transaction list -b <bookId> -q 'on:2025' --format csv
|
|
146
149
|
bkper balance list -b <bookId> -q 'on:2025-12-31' --format csv
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-auth-service.d.ts","sourceRoot":"","sources":["../../src/auth/local-auth-service.ts"],"names":[],"mappings":"AAIA,OAAO,EAAuB,WAAW,EAAgB,MAAM,qBAAqB,CAAC;AA+CrF;;;GAGG;AACH,wBAAsB,KAAK,kBAK1B;AAED;;GAEG;AACH,wBAAsB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAsB5C;AAED;;;;GAIG;AACH,wBAAgB,UAAU,YAEzB;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,WAAW,GAAG,SAAS,CAE9D;
|
|
1
|
+
{"version":3,"file":"local-auth-service.d.ts","sourceRoot":"","sources":["../../src/auth/local-auth-service.ts"],"names":[],"mappings":"AAIA,OAAO,EAAuB,WAAW,EAAgB,MAAM,qBAAqB,CAAC;AA+CrF;;;GAGG;AACH,wBAAsB,KAAK,kBAK1B;AAED;;GAEG;AACH,wBAAsB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAsB5C;AAED;;;;GAIG;AACH,wBAAgB,UAAU,YAEzB;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,WAAW,GAAG,SAAS,CAE9D;AAqKD;;;;;GAKG;AACH,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAoBvE;AAED;;GAEG;AACH,wBAAsB,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC,CAiBrD"}
|
|
@@ -116,11 +116,11 @@ function generatePKCECodes() {
|
|
|
116
116
|
const codeChallenge = crypto.createHash('sha256').update(codeVerifier).digest('base64url');
|
|
117
117
|
return { codeVerifier, codeChallenge };
|
|
118
118
|
}
|
|
119
|
-
function createOAuthClient() {
|
|
119
|
+
function createOAuthClient(redirectUri) {
|
|
120
120
|
return new OAuth2Client({
|
|
121
121
|
clientId: OAUTH_CONFIG.clientId,
|
|
122
122
|
clientSecret: OAUTH_CONFIG.clientSecret,
|
|
123
|
-
redirectUri: OAUTH_CONFIG.redirectUri,
|
|
123
|
+
redirectUri: redirectUri !== null && redirectUri !== void 0 ? redirectUri : OAUTH_CONFIG.redirectUri,
|
|
124
124
|
});
|
|
125
125
|
}
|
|
126
126
|
function mergeCredentials(base, updates) {
|
|
@@ -143,78 +143,95 @@ function registerCredentialPersistence(localAuth) {
|
|
|
143
143
|
* opening the user's browser, and waiting for the authorization code.
|
|
144
144
|
* Uses PKCE (Proof Key for Code Exchange) for enhanced security without client_secret.
|
|
145
145
|
*/
|
|
146
|
+
const MAX_PORT_ATTEMPTS = 10;
|
|
146
147
|
function authenticateLocal() {
|
|
147
148
|
return __awaiter(this, void 0, void 0, function* () {
|
|
148
149
|
const pkceCodes = generatePKCECodes();
|
|
149
|
-
const oAuth2Client = createOAuthClient();
|
|
150
|
-
const authorizeUrl = oAuth2Client.generateAuthUrl({
|
|
151
|
-
access_type: 'offline',
|
|
152
|
-
scope: ['https://www.googleapis.com/auth/userinfo.email'],
|
|
153
|
-
prompt: 'consent',
|
|
154
|
-
code_challenge: pkceCodes.codeChallenge,
|
|
155
|
-
code_challenge_method: CodeChallengeMethod.S256,
|
|
156
|
-
});
|
|
157
150
|
const open = (yield import('open')).default;
|
|
151
|
+
const baseRedirectUrl = new URL(OAUTH_CONFIG.redirectUri);
|
|
152
|
+
const basePort = parseInt(baseRedirectUrl.port) || 3000;
|
|
158
153
|
return new Promise((resolve, reject) => {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
154
|
+
let attempts = 0;
|
|
155
|
+
function tryPort(port) {
|
|
156
|
+
if (attempts >= MAX_PORT_ATTEMPTS) {
|
|
157
|
+
reject(new Error(`Failed to start local server: All ports in range ${basePort}-${basePort + MAX_PORT_ATTEMPTS - 1} are in use`));
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
attempts++;
|
|
161
|
+
const redirectUri = `http://localhost:${port}/oauth2callback`;
|
|
162
|
+
const oAuth2Client = createOAuthClient(redirectUri);
|
|
163
|
+
const authorizeUrl = oAuth2Client.generateAuthUrl({
|
|
164
|
+
access_type: 'offline',
|
|
165
|
+
scope: ['https://www.googleapis.com/auth/userinfo.email'],
|
|
166
|
+
prompt: 'consent',
|
|
167
|
+
code_challenge: pkceCodes.codeChallenge,
|
|
168
|
+
code_challenge_method: CodeChallengeMethod.S256,
|
|
169
|
+
});
|
|
170
|
+
const server = http.createServer((req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
171
|
+
try {
|
|
172
|
+
if (req.url && req.url.startsWith('/oauth2callback')) {
|
|
173
|
+
const searchParams = new URL(req.url, `http://localhost:${port}`).searchParams;
|
|
174
|
+
const code = searchParams.get('code');
|
|
175
|
+
if (code) {
|
|
176
|
+
const { tokens } = yield oAuth2Client.getToken({
|
|
177
|
+
code,
|
|
178
|
+
codeVerifier: pkceCodes.codeVerifier,
|
|
179
|
+
});
|
|
180
|
+
oAuth2Client.setCredentials(tokens);
|
|
181
|
+
res.writeHead(200, { 'Content-Type': 'text/html' });
|
|
182
|
+
res.end(generateAuthPage({
|
|
183
|
+
type: 'success',
|
|
184
|
+
title: 'Authentication Successful',
|
|
185
|
+
message: 'You have been successfully authenticated with Bkper CLI.',
|
|
186
|
+
}));
|
|
187
|
+
server.closeAllConnections();
|
|
188
|
+
server.close();
|
|
189
|
+
resolve(oAuth2Client);
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
const error = searchParams.get('error');
|
|
193
|
+
res.writeHead(400, { 'Content-Type': 'text/html' });
|
|
194
|
+
res.end(generateAuthPage({
|
|
195
|
+
type: 'error',
|
|
196
|
+
title: 'Authentication Failed',
|
|
197
|
+
message: error || 'No authorization code received.',
|
|
198
|
+
}));
|
|
199
|
+
server.closeAllConnections();
|
|
200
|
+
server.close();
|
|
201
|
+
reject(new Error(error || 'No authorization code received'));
|
|
202
|
+
}
|
|
193
203
|
}
|
|
194
204
|
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
205
|
+
catch (err) {
|
|
206
|
+
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
207
|
+
res.writeHead(500, { 'Content-Type': 'text/html' });
|
|
208
|
+
res.end(generateAuthPage({
|
|
209
|
+
type: 'error',
|
|
210
|
+
title: 'Authentication Error',
|
|
211
|
+
message: errorMessage,
|
|
212
|
+
}));
|
|
213
|
+
server.closeAllConnections();
|
|
214
|
+
server.close();
|
|
215
|
+
reject(err);
|
|
216
|
+
}
|
|
217
|
+
}));
|
|
218
|
+
server.listen(port, () => {
|
|
219
|
+
console.log(`\nOpen this URL to authenticate:\n${authorizeUrl}\n`);
|
|
220
|
+
open(authorizeUrl, { wait: false }).catch(() => {
|
|
221
|
+
// Browser couldn't open - URL already displayed above
|
|
222
|
+
});
|
|
213
223
|
});
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
224
|
+
server.on('error', err => {
|
|
225
|
+
if ('code' in err && err.code === 'EADDRINUSE') {
|
|
226
|
+
server.close();
|
|
227
|
+
tryPort(port + 1);
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
reject(new Error(`Failed to start local server: ${err.message}`));
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
tryPort(basePort);
|
|
218
235
|
});
|
|
219
236
|
});
|
|
220
237
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-auth-service.js","sourceRoot":"","sources":["../../src/auth/local-auth-service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,mBAAmB,EAAe,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACrF,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD;;;;;;;;;;GAUG;AACH,MAAM,YAAY,GAAG;IACjB,QAAQ,EAAE,0EAA0E;IACpF,YAAY,EAAE,qCAAqC;IACnD,WAAW,EAAE,sCAAsC;CACtD,CAA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CAAC;QACzD,CAAC;QAED,MAAM,SAAS,GAAG,MAAM,iBAAiB,EAAE,CAAC;QAC5C,6BAA6B,CAAC,SAAS,CAAC,CAAC;QACzC,gBAAgB,CAAC,gBAAgB,CAAC,iBAAiB,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC;QAE7E,MAAM,KAAK,GAAG,MAAM,SAAS,CAAC,cAAc,EAAE,CAAC;QAC/C,OAAO,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC;IAC7B,CAAC;CAAA;AAED,SAAS,gBAAgB,CAAC,WAAwB;IAC9C,iBAAiB,GAAG,WAAW,CAAC;IAChC,EAAE,CAAC,SAAS,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7C,EAAE,CAAC,aAAa,CAAC,qBAAqB,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;AAC1F,CAAC;AAED;;;GAGG;AACH,SAAS,gBAAgB;IACrB,iBAAiB,GAAG,SAAS,CAAC;IAC9B,IAAI,EAAE,CAAC,UAAU,CAAC,qBAAqB,CAAC,EAAE,CAAC;QACvC,EAAE,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC;IACrC,CAAC;IACD,IAAI,EAAE,CAAC,UAAU,CAAC,kBAAkB,CAAC,EAAE,CAAC;QACpC,EAAE,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;IAClC,CAAC;AACL,CAAC"}
|
package/lib/cli.js
CHANGED
|
@@ -18,6 +18,7 @@ import { registerGroupCommands } from './commands/groups/register.js';
|
|
|
18
18
|
import { registerTransactionCommands } from './commands/transactions/register.js';
|
|
19
19
|
import { registerBalanceCommands } from './commands/balances/register.js';
|
|
20
20
|
import { registerCollectionCommands } from './commands/collections/register.js';
|
|
21
|
+
import { registerFileCommands } from './commands/files/register.js';
|
|
21
22
|
import { registerUpgradeCommand } from './commands/upgrade.js';
|
|
22
23
|
import { registerAgentCommands, runAgentCommand } from './commands/agent-command.js';
|
|
23
24
|
import { shouldRunAgentCommand } from './agent/cli-dispatch.js';
|
|
@@ -49,6 +50,7 @@ function main() {
|
|
|
49
50
|
registerTransactionCommands(program);
|
|
50
51
|
registerBalanceCommands(program);
|
|
51
52
|
registerCollectionCommands(program);
|
|
53
|
+
registerFileCommands(program);
|
|
52
54
|
// Agent bridge command
|
|
53
55
|
registerAgentCommands(program);
|
|
54
56
|
// Upgrade command
|
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,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;AAClF,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACrF,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAE1D,SAAe,IAAI;;QACf,IAAI,qBAAqB,CAAC,OAAO,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C,OAAO,CAAC,CAAC;QAC7B,oBAAoB,CAAC,OAAO,CAAC,CAAC;QAC9B,uBAAuB,CAAC,OAAO,CAAC,CAAC;QACjC,qBAAqB,CAAC,OAAO,CAAC,CAAC;QAC/B,2BAA2B,CAAC,OAAO,CAAC,CAAC;QACrC,uBAAuB,CAAC,OAAO,CAAC,CAAC;QACjC,0BAA0B,CAAC,OAAO,CAAC,CAAC;QACpC,oBAAoB,CAAC,OAAO,CAAC,CAAC;QAE9B,uBAAuB;QACvB,qBAAqB,CAAC,OAAO,CAAC,CAAC;QAE/B,kBAAkB;QAClB,sBAAsB,CAAC,OAAO,CAAC,CAAC;QAEhC,4EAA4E;QAC5E,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,wBAAwB,EAAE,CAAC;YACxC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QAClC,CAAC;QAED,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;CAAA;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE;IACf,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC,CAAC,CAAC"}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import type { OutputFormat } from '../render/output.js';
|
|
2
|
+
/**
|
|
3
|
+
* Commander option collector for repeatable scalar flags.
|
|
4
|
+
*/
|
|
5
|
+
export declare function collectRepeatable(value: string, previous: string[] | undefined): string[];
|
|
2
6
|
/**
|
|
3
7
|
* Commander option collector for repeatable --property flags.
|
|
4
8
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-helpers.d.ts","sourceRoot":"","sources":["../../src/commands/cli-helpers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,SAAS,GAAG,MAAM,EAAE,CAEvF;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,SAAS,GAAG,MAAM,EAAE,CAEnF;AAED;;;GAGG;AACH,wBAAgB,SAAS,IAAI,YAAY,CAUxC"}
|
|
1
|
+
{"version":3,"file":"cli-helpers.d.ts","sourceRoot":"","sources":["../../src/commands/cli-helpers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,SAAS,GAAG,MAAM,EAAE,CAEzF;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,SAAS,GAAG,MAAM,EAAE,CAEvF;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,SAAS,GAAG,MAAM,EAAE,CAEnF;AAED;;;GAGG;AACH,wBAAgB,SAAS,IAAI,YAAY,CAUxC"}
|
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
import { program } from 'commander';
|
|
2
|
+
/**
|
|
3
|
+
* Commander option collector for repeatable scalar flags.
|
|
4
|
+
*/
|
|
5
|
+
export function collectRepeatable(value, previous) {
|
|
6
|
+
return previous ? [...previous, value] : [value];
|
|
7
|
+
}
|
|
2
8
|
/**
|
|
3
9
|
* Commander option collector for repeatable --property flags.
|
|
4
10
|
*/
|
|
5
11
|
export function collectProperty(value, previous) {
|
|
6
|
-
return
|
|
12
|
+
return collectRepeatable(value, previous);
|
|
7
13
|
}
|
|
8
14
|
/**
|
|
9
15
|
* Commander option collector for repeatable --book flags.
|
|
10
16
|
*/
|
|
11
17
|
export function collectBook(value, previous) {
|
|
12
|
-
return
|
|
18
|
+
return collectRepeatable(value, previous);
|
|
13
19
|
}
|
|
14
20
|
/**
|
|
15
21
|
* Returns the active output format, considering both --format and --json flags.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-helpers.js","sourceRoot":"","sources":["../../src/commands/cli-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC;;GAEG;AACH,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"cli-helpers.js","sourceRoot":"","sources":["../../src/commands/cli-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAa,EAAE,QAA8B;IAC3E,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AACrD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,KAAa,EAAE,QAA8B;IACzE,OAAO,iBAAiB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;AAC9C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,KAAa,EAAE,QAA8B;IACrE,OAAO,iBAAiB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;AAC9C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,SAAS;IACrB,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAC5B,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;QACrB,OAAO,MAAM,CAAC;IAClB,CAAC;IACD,MAAM,MAAM,GAAG,IAAI,CAAC,MAAgB,CAAC;IACrC,IAAI,MAAM,KAAK,MAAM,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;QACxC,OAAO,MAAM,CAAC;IAClB,CAAC;IACD,OAAO,OAAO,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { File as BkperFile } from 'bkper-js';
|
|
2
|
+
/**
|
|
3
|
+
* Retrieves a single file by ID from the specified book.
|
|
4
|
+
*
|
|
5
|
+
* The file content is hydrated before returning so CLI output can verify the
|
|
6
|
+
* full upload cycle, not just metadata.
|
|
7
|
+
*
|
|
8
|
+
* @param bookId - The target book ID
|
|
9
|
+
* @param fileId - File ID to look up
|
|
10
|
+
* @returns The matching file
|
|
11
|
+
* @throws Error if the file is not found
|
|
12
|
+
*/
|
|
13
|
+
export declare function getFile(bookId: string, fileId: string): Promise<BkperFile>;
|
|
14
|
+
//# sourceMappingURL=get.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../src/commands/files/get.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,UAAU,CAAC;AAG7C;;;;;;;;;;GAUG;AACH,wBAAsB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAUhF"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { getBkperInstance } from '../../bkper-factory.js';
|
|
11
|
+
/**
|
|
12
|
+
* Retrieves a single file by ID from the specified book.
|
|
13
|
+
*
|
|
14
|
+
* The file content is hydrated before returning so CLI output can verify the
|
|
15
|
+
* full upload cycle, not just metadata.
|
|
16
|
+
*
|
|
17
|
+
* @param bookId - The target book ID
|
|
18
|
+
* @param fileId - File ID to look up
|
|
19
|
+
* @returns The matching file
|
|
20
|
+
* @throws Error if the file is not found
|
|
21
|
+
*/
|
|
22
|
+
export function getFile(bookId, fileId) {
|
|
23
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
const bkper = getBkperInstance();
|
|
25
|
+
const book = yield bkper.getBook(bookId);
|
|
26
|
+
const file = yield book.getFile(fileId);
|
|
27
|
+
if (!file) {
|
|
28
|
+
throw new Error(`File not found: ${fileId}`);
|
|
29
|
+
}
|
|
30
|
+
yield file.getContent();
|
|
31
|
+
return file;
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=get.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get.js","sourceRoot":"","sources":["../../../src/commands/files/get.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D;;;;;;;;;;GAUG;AACH,MAAM,UAAgB,OAAO,CAAC,MAAc,EAAE,MAAc;;QACxD,MAAM,KAAK,GAAG,gBAAgB,EAAE,CAAC;QACjC,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACzC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACxC,IAAI,CAAC,IAAI,EAAE,CAAC;YACR,MAAM,IAAI,KAAK,CAAC,mBAAmB,MAAM,EAAE,CAAC,CAAC;QACjD,CAAC;QAED,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;QACxB,OAAO,IAAI,CAAC;IAChB,CAAC;CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/files/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/files/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,UAAU,EAAqB,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../src/commands/files/register.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOzC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAoC3D"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { withAction } from '../action.js';
|
|
11
|
+
import { collectProperty } from '../cli-helpers.js';
|
|
12
|
+
import { renderItem } from '../../render/index.js';
|
|
13
|
+
import { validateRequiredOptions, throwIfErrors } from '../../utils/validation.js';
|
|
14
|
+
import { getFile, uploadFile } from './index.js';
|
|
15
|
+
export function registerFileCommands(program) {
|
|
16
|
+
const fileCommand = program.command('file').description('Manage Files');
|
|
17
|
+
fileCommand
|
|
18
|
+
.command('get <fileId>')
|
|
19
|
+
.description('Get a file by ID')
|
|
20
|
+
.option('-b, --book <bookId>', 'Book ID')
|
|
21
|
+
.action((fileId, options) => withAction('getting file', (format) => __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
throwIfErrors(validateRequiredOptions(options, [{ name: 'book', flag: '--book' }]));
|
|
23
|
+
const file = yield getFile(options.book, fileId);
|
|
24
|
+
renderItem(file.json(), format);
|
|
25
|
+
}))());
|
|
26
|
+
fileCommand
|
|
27
|
+
.command('upload <path>')
|
|
28
|
+
.description('Upload a local file to a book')
|
|
29
|
+
.option('-b, --book <bookId>', 'Book ID')
|
|
30
|
+
.option('--account <accountIdOrName>', 'Account name or ID for file routing')
|
|
31
|
+
.option('-p, --property <key=value>', 'Set a property (repeatable, empty value deletes)', collectProperty)
|
|
32
|
+
.action((filePath, options) => withAction('uploading file', (format) => __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
throwIfErrors(validateRequiredOptions(options, [{ name: 'book', flag: '--book' }]));
|
|
34
|
+
const file = yield uploadFile(options.book, {
|
|
35
|
+
path: filePath,
|
|
36
|
+
account: options.account,
|
|
37
|
+
property: options.property,
|
|
38
|
+
});
|
|
39
|
+
renderItem(file.json(), format);
|
|
40
|
+
}))());
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=register.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../../src/commands/files/register.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;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AAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC;QACpF,MAAM,IAAI,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC,IAAI,EAAE;YACxC,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,QAAQ,EAAE,OAAO,CAAC,QAAQ;SAC7B,CAAC,CAAC;QACH,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,MAAM,CAAC,CAAC;IACpC,CAAC,CAAA,CAAC,EAAE,CACP,CAAC;AACV,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { File as BkperFile } from 'bkper-js';
|
|
2
|
+
/**
|
|
3
|
+
* Options for uploading a local file to a book.
|
|
4
|
+
*/
|
|
5
|
+
export interface UploadFileOptions {
|
|
6
|
+
path: string;
|
|
7
|
+
account?: string;
|
|
8
|
+
property?: string[];
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Uploads a local file to a book.
|
|
12
|
+
*
|
|
13
|
+
* @param bookId - Target book ID
|
|
14
|
+
* @param options - Upload options including local path and optional properties
|
|
15
|
+
* @returns The created file resource
|
|
16
|
+
*/
|
|
17
|
+
export declare function uploadFile(bookId: string, options: UploadFileOptions): Promise<BkperFile>;
|
|
18
|
+
//# sourceMappingURL=upload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../../../src/commands/files/upload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,UAAU,CAAC;AAS7C;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAED;;;;;;GAMG;AACH,wBAAsB,UAAU,CAC5B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,iBAAiB,GAC3B,OAAO,CAAC,SAAS,CAAC,CA4EpB"}
|
|
@@ -0,0 +1,94 @@
|
|
|
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 { File as BkperFile } from 'bkper-js';
|
|
11
|
+
import { getBkperInstance } from '../../bkper-factory.js';
|
|
12
|
+
import { parsePropertyFlag } from '../../utils/properties.js';
|
|
13
|
+
import { readLocalFilePayload } from '../../utils/local-file.js';
|
|
14
|
+
import { throwIfErrors } from '../../utils/validation.js';
|
|
15
|
+
const ACCOUNT_ID_PROPERTY = 'account_id';
|
|
16
|
+
const UPLOAD_METHOD_PROPERTY = 'upload_method';
|
|
17
|
+
/**
|
|
18
|
+
* Uploads a local file to a book.
|
|
19
|
+
*
|
|
20
|
+
* @param bookId - Target book ID
|
|
21
|
+
* @param options - Upload options including local path and optional properties
|
|
22
|
+
* @returns The created file resource
|
|
23
|
+
*/
|
|
24
|
+
export function uploadFile(bookId, options) {
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
const bkper = getBkperInstance();
|
|
27
|
+
const book = yield bkper.getBook(bookId);
|
|
28
|
+
const errors = [];
|
|
29
|
+
let payload;
|
|
30
|
+
try {
|
|
31
|
+
payload = yield readLocalFilePayload(options.path);
|
|
32
|
+
}
|
|
33
|
+
catch (err) {
|
|
34
|
+
errors.push(err.message);
|
|
35
|
+
}
|
|
36
|
+
const parsedProperties = [];
|
|
37
|
+
let hasRawAccountId = false;
|
|
38
|
+
if (options.property) {
|
|
39
|
+
for (const raw of options.property) {
|
|
40
|
+
try {
|
|
41
|
+
const [key, value] = parsePropertyFlag(raw);
|
|
42
|
+
if (key === UPLOAD_METHOD_PROPERTY) {
|
|
43
|
+
errors.push('Property upload_method is reserved for transaction attachments and cannot be set with file upload');
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
if (key === ACCOUNT_ID_PROPERTY) {
|
|
47
|
+
hasRawAccountId = true;
|
|
48
|
+
}
|
|
49
|
+
parsedProperties.push([key, value]);
|
|
50
|
+
}
|
|
51
|
+
catch (err) {
|
|
52
|
+
errors.push(err.message);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
if (options.account && hasRawAccountId) {
|
|
57
|
+
errors.push('Cannot combine --account with -p account_id=...');
|
|
58
|
+
}
|
|
59
|
+
let resolvedAccountId;
|
|
60
|
+
if (options.account) {
|
|
61
|
+
const account = yield book.getAccount(options.account);
|
|
62
|
+
if (!account) {
|
|
63
|
+
errors.push(`Account (--account) not found: ${options.account}`);
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
const accountId = account.getId();
|
|
67
|
+
if (!accountId) {
|
|
68
|
+
errors.push(`Resolved account (--account) is missing an id: ${options.account}`);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
resolvedAccountId = accountId;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
throwIfErrors(errors);
|
|
76
|
+
if (!payload) {
|
|
77
|
+
throw new Error(`Unable to load local file payload: ${options.path}`);
|
|
78
|
+
}
|
|
79
|
+
const file = new BkperFile(book, payload);
|
|
80
|
+
for (const [key, value] of parsedProperties) {
|
|
81
|
+
if (value === '') {
|
|
82
|
+
file.deleteProperty(key);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
file.setProperty(key, value);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
if (resolvedAccountId) {
|
|
89
|
+
file.setProperty(ACCOUNT_ID_PROPERTY, resolvedAccountId);
|
|
90
|
+
}
|
|
91
|
+
return file.create();
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=upload.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload.js","sourceRoot":"","sources":["../../../src/commands/files/upload.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE1D,MAAM,mBAAmB,GAAG,YAAY,CAAC;AACzC,MAAM,sBAAsB,GAAG,eAAe,CAAC;AAW/C;;;;;;GAMG;AACH,MAAM,UAAgB,UAAU,CAC5B,MAAc,EACd,OAA0B;;QAE1B,MAAM,KAAK,GAAG,gBAAgB,EAAE,CAAC;QACjC,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAEzC,MAAM,MAAM,GAAa,EAAE,CAAC;QAC5B,IAAI,OAA+B,CAAC;QAEpC,IAAI,CAAC;YACD,OAAO,GAAG,MAAM,oBAAoB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACvD,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACpB,MAAM,CAAC,IAAI,CAAE,GAAa,CAAC,OAAO,CAAC,CAAC;QACxC,CAAC;QAED,MAAM,gBAAgB,GAA4B,EAAE,CAAC;QACrD,IAAI,eAAe,GAAG,KAAK,C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AAC;oBACJ,iBAAiB,GAAG,SAAS,CAAC;gBAClC,CAAC;YACL,CAAC;QACL,CAAC;QAED,aAAa,CAAC,MAAM,CAAC,CAAC;QAEtB,IAAI,CAAC,OAAO,EAAE,CAAC;YACX,MAAM,IAAI,KAAK,CAAC,sCAAsC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;QAC1E,CAAC;QAED,MAAM,IAAI,GAAG,IAAI,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAE1C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,gBAAgB,EAAE,CAAC;YAC1C,IAAI,KAAK,KAAK,EAAE,EAAE,CAAC;gBACf,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;YAC7B,CAAC;iBAAM,CAAC;gBACJ,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;YACjC,CAAC;QACL,CAAC;QAED,IAAI,iBAAiB,EAAE,CAAC;YACpB,IAAI,CAAC,WAAW,CAAC,mBAAmB,EAAE,iBAAiB,CAAC,CAAC;QAC7D,CAAC;QAED,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC;IACzB,CAAC;CAAA"}
|
|
@@ -11,7 +11,16 @@ export interface CreateTransactionOptions {
|
|
|
11
11
|
url?: string[];
|
|
12
12
|
remoteId?: string[];
|
|
13
13
|
property?: string[];
|
|
14
|
+
file?: string;
|
|
14
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Resolves the single supported --file value for transaction create.
|
|
18
|
+
*
|
|
19
|
+
* @param filePaths - Parsed --file option values
|
|
20
|
+
* @param hasStdinInput - Whether stdin JSON input was provided
|
|
21
|
+
* @returns The single file path, if any
|
|
22
|
+
*/
|
|
23
|
+
export declare function resolveCreateTransactionFilePath(filePaths: string[] | undefined, hasStdinInput: boolean): string | undefined;
|
|
15
24
|
/**
|
|
16
25
|
* Creates a new transaction in the specified book.
|
|
17
26
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/commands/transactions/create.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/commands/transactions/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,WAAW,EAAE,MAAM,UAAU,CAAC;AAM1D;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;GAMG;AACH,wBAAgB,gCAAgC,CAC5C,SAAS,EAAE,MAAM,EAAE,GAAG,SAAS,EAC/B,aAAa,EAAE,OAAO,GACvB,MAAM,GAAG,SAAS,CAepB;AAED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACnC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,wBAAwB,GAClC,OAAO,CAAC,WAAW,CAAC,CAsEtB"}
|
|
@@ -7,10 +7,29 @@ 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 { File as BkperFile, Transaction } from 'bkper-js';
|
|
10
11
|
import { getBkperInstance } from '../../bkper-factory.js';
|
|
11
|
-
import {
|
|
12
|
+
import { readLocalFilePayload } from '../../utils/local-file.js';
|
|
12
13
|
import { parsePropertyFlag } from '../../utils/properties.js';
|
|
13
14
|
import { throwIfErrors } from '../../utils/validation.js';
|
|
15
|
+
/**
|
|
16
|
+
* Resolves the single supported --file value for transaction create.
|
|
17
|
+
*
|
|
18
|
+
* @param filePaths - Parsed --file option values
|
|
19
|
+
* @param hasStdinInput - Whether stdin JSON input was provided
|
|
20
|
+
* @returns The single file path, if any
|
|
21
|
+
*/
|
|
22
|
+
export function resolveCreateTransactionFilePath(filePaths, hasStdinInput) {
|
|
23
|
+
const errors = [];
|
|
24
|
+
if (filePaths && filePaths.length > 1) {
|
|
25
|
+
errors.push('Option --file may only be provided once');
|
|
26
|
+
}
|
|
27
|
+
if (hasStdinInput && filePaths && filePaths.length > 0) {
|
|
28
|
+
errors.push('Option --file is only supported for single transaction create and cannot be used with stdin input');
|
|
29
|
+
}
|
|
30
|
+
throwIfErrors(errors);
|
|
31
|
+
return filePaths === null || filePaths === void 0 ? void 0 : filePaths[0];
|
|
32
|
+
}
|
|
14
33
|
/**
|
|
15
34
|
* Creates a new transaction in the specified book.
|
|
16
35
|
*
|
|
@@ -74,6 +93,16 @@ export function createTransaction(bookId, options) {
|
|
|
74
93
|
}
|
|
75
94
|
}
|
|
76
95
|
}
|
|
96
|
+
if (options.file) {
|
|
97
|
+
try {
|
|
98
|
+
const payload = yield readLocalFilePayload(options.file);
|
|
99
|
+
const file = new BkperFile(book, payload);
|
|
100
|
+
tx.addFile(file);
|
|
101
|
+
}
|
|
102
|
+
catch (err) {
|
|
103
|
+
errors.push(err.message);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
77
106
|
throwIfErrors(errors);
|
|
78
107
|
return tx.create();
|
|
79
108
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/commands/transactions/create.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/commands/transactions/create.ts"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AAE,CAAC;gBACjC,IAAI,CAAC;oBACD,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC;oBAC5C,IAAI,KAAK,KAAK,EAAE,EAAE,CAAC;wBACf,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;oBAC3B,CAAC;yBAAM,CAAC;wBACJ,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;oBAC/B,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,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;YACf,IAAI,CAAC;gBACD,MAAM,OAAO,GAAG,MAAM,oBAAoB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;gBACzD,MAAM,IAAI,GAAG,IAAI,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;gBAC1C,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YACrB,CAAC;YAAC,OAAO,GAAY,EAAE,CAAC;gBACpB,MAAM,CAAC,IAAI,CAAE,GAAa,CAAC,OAAO,CAAC,CAAC;YACxC,CAAC;QACL,CAAC;QAED,aAAa,CAAC,MAAM,CAAC,CAAC;QAEtB,OAAO,EAAE,CAAC,MAAM,EAAE,CAAC;IACvB,CAAC;CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { listTransactions, listTransactionsFormatted, ListTransactionsOptions, ListTransactionsResult, } from './list.js';
|
|
2
|
-
export { createTransaction, CreateTransactionOptions } from './create.js';
|
|
2
|
+
export { createTransaction, CreateTransactionOptions, resolveCreateTransactionFilePath, } from './create.js';
|
|
3
3
|
export { updateTransaction, UpdateTransactionOptions } from './update.js';
|
|
4
4
|
export { postTransaction } from './post.js';
|
|
5
5
|
export { checkTransaction } from './check.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/transactions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,gBAAgB,EAChB,yBAAyB,EACzB,uBAAuB,EACvB,sBAAsB,GACzB,MAAM,WAAW,CAAC;AACnB,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/transactions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,gBAAgB,EAChB,yBAAyB,EACzB,uBAAuB,EACvB,sBAAsB,GACzB,MAAM,WAAW,CAAC;AACnB,OAAO,EACH,iBAAiB,EACjB,wBAAwB,EACxB,gCAAgC,GACnC,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { listTransactions, listTransactionsFormatted, } from './list.js';
|
|
2
|
-
export { createTransaction } from './create.js';
|
|
2
|
+
export { createTransaction, resolveCreateTransactionFilePath, } from './create.js';
|
|
3
3
|
export { updateTransaction } from './update.js';
|
|
4
4
|
export { postTransaction } from './post.js';
|
|
5
5
|
export { checkTransaction } from './check.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/transactions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,gBAAgB,EAChB,yBAAyB,GAG5B,MAAM,WAAW,CAAC;AACnB,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/transactions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,gBAAgB,EAChB,yBAAyB,GAG5B,MAAM,WAAW,CAAC;AACnB,OAAO,EACH,iBAAiB,EAEjB,gCAAgC,GACnC,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,iBAAiB,EAA4B,MAAM,aAAa,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAe,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../src/commands/transactions/register.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../src/commands/transactions/register.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAmBzC,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAuMlE"}
|
|
@@ -8,11 +8,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { withAction } from '../action.js';
|
|
11
|
-
import { collectProperty } from '../cli-helpers.js';
|
|
11
|
+
import { collectProperty, collectRepeatable } from '../cli-helpers.js';
|
|
12
12
|
import { renderListResult, renderItem } from '../../render/index.js';
|
|
13
13
|
import { validateRequiredOptions, throwIfErrors } from '../../utils/validation.js';
|
|
14
14
|
import { parseStdinItems } from '../../input/index.js';
|
|
15
|
-
import { listTransactionsFormatted, createTransaction, updateTransaction, postTransaction, checkTransaction, trashTransaction, mergeTransactions, batchCreateTransactions, batchUpdateTransactions, } from './index.js';
|
|
15
|
+
import { listTransactionsFormatted, createTransaction, updateTransaction, postTransaction, checkTransaction, trashTransaction, mergeTransactions, batchCreateTransactions, batchUpdateTransactions, resolveCreateTransactionFilePath, } from './index.js';
|
|
16
16
|
export function registerTransactionCommands(program) {
|
|
17
17
|
const transactionCommand = program.command('transaction').description('Manage Transactions');
|
|
18
18
|
transactionCommand
|
|
@@ -43,9 +43,11 @@ export function registerTransactionCommands(program) {
|
|
|
43
43
|
.option('--to <to>', 'Debit account (destination)')
|
|
44
44
|
.option('--url <url>', 'URL (repeatable)', collectProperty)
|
|
45
45
|
.option('--remote-id <remoteId>', 'Remote ID (repeatable)', collectProperty)
|
|
46
|
+
.option('--file <path>', 'Attach a local file (single-create only)', collectRepeatable)
|
|
46
47
|
.option('-p, --property <key=value>', 'Set a property (repeatable, empty value deletes)', collectProperty)
|
|
47
48
|
.action(options => withAction('creating transaction', (format) => __awaiter(this, void 0, void 0, function* () {
|
|
48
49
|
const stdinData = !process.stdin.isTTY ? yield parseStdinItems() : null;
|
|
50
|
+
const filePath = resolveCreateTransactionFilePath(options.file, stdinData !== null);
|
|
49
51
|
if (stdinData && stdinData.items.length > 0) {
|
|
50
52
|
throwIfErrors(validateRequiredOptions(options, [{ name: 'book', flag: '--book' }]));
|
|
51
53
|
yield batchCreateTransactions(options.book, stdinData.items, options.property);
|
|
@@ -64,6 +66,7 @@ export function registerTransactionCommands(program) {
|
|
|
64
66
|
url: options.url,
|
|
65
67
|
remoteId: options.remoteId,
|
|
66
68
|
property: options.property,
|
|
69
|
+
file: filePath,
|
|
67
70
|
});
|
|
68
71
|
renderItem(transaction.json(), format);
|
|
69
72
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../../src/commands/transactions/register.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../../src/commands/transactions/register.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AACnF,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EACH,yBAAyB,EACzB,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,uBAAuB,EACvB,uBAAuB,EACvB,gCAAgC,GACnC,MAAM,YAAY,CAAC;AAEpB,MAAM,UAAU,2BAA2B,CAAC,OAAgB;IACxD,MAAM,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,WAAW,CAAC,qBAAqB,CAAC,CAAC;IAE7F,kBAAkB;SACb,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,6BAA6B,CAAC;SAC1C,MAAM,CAAC,qBAAqB,EAAE,SAAS,CAAC;SACxC,MAAM,CAAC,qBAAqB,EAAE,cAAc,CAAC;SAC7C,MAAM,CAAC,kBAAkB,EAAE,2BAA2B,CAAC;SACvD,MAAM,CAAC,OAAO,CAAC,EAAE,CACd,UAAU,CAAC,sBAAsB,EAAE,CAAM,MAAM,EAAC,EAAE;QAC9C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,EAAE,MAAM,CAAC,CAAC;IAC3C,CAAC,CAAA,CAAC,EAAE,CACP,CAAC;IAEN,kBAAkB;SACb,OAAO,CAAC,yCAAyC,CAAC;SAClD,WAAW,CAAC,wBAAwB,CAAC;SACrC,MAAM,CAAC,qBAAqB,EAAE,SAAS,CAAC;SACxC,MAAM,CAAC,CAAC,cAAsB,EAAE,cAAsB,EAAE,OAAO,EAAE,EAAE,CAChE,UAAU,CAAC,sBAAsB,EAAE,CAAM,MAAM,EAAC,EAAE;QAC9C,aAAa,CAAC,uBAAuB,CAAC,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC;QACpF,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAClC,OAAO,CAAC,IAAI,EACZ,cAAc,EACd,cAAc,CACjB,CAAC;QACF,IAAI,MAAM,KAAK,MAAM,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;YACxC,OAAO,CAAC,GAAG,CACP,IAAI,CAAC,SAAS,CACV;gBACI,iBAAiB,EAAE,MAAM,CAAC,iBAAiB,CAAC,IAAI,EAAE;gBAClD,qBAAqB,EAAE,MAAM,CAAC,qBAAqB;gBACnD,WAAW,EAAE,MAAM,CAAC,WAAW;aAClC,EACD,IAAI,EACJ,CAAC,CACJ,CACJ,CAAC;QACN,CAAC;aAAM,CAAC;YACJ,UAAU,CAAC,MAAM,CAAC,iBAAiB,CAAC,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC;QACzD,CAAC;IACL,CAAC,CAAA,CAAC,EAAE,CACP,CAAC;AACV,CAAC"}
|
|
@@ -137,10 +137,13 @@ Pi-specific extensions are loaded from Pi extension folders (for example `.pi/ex
|
|
|
137
137
|
|
|
138
138
|
## Data Management
|
|
139
139
|
|
|
140
|
-
Manage books, accounts, transactions, and balances.
|
|
140
|
+
Manage books, files, accounts, transactions, and balances.
|
|
141
141
|
|
|
142
142
|
```bash
|
|
143
143
|
bkper book list
|
|
144
|
+
bkper file upload ./receipt.pdf -b <bookId>
|
|
145
|
+
bkper file get <fileId> -b <bookId>
|
|
146
|
+
bkper transaction create -b <bookId> --description "Team lunch" --file ./receipt.pdf
|
|
144
147
|
bkper account list -b <bookId>
|
|
145
148
|
bkper transaction list -b <bookId> -q 'on:2025' --format csv
|
|
146
149
|
bkper balance list -b <bookId> -q 'on:2025-12-31' --format csv
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Data Management
|
|
2
2
|
|
|
3
|
-
Interact with books, accounts, transactions, and balances using the `bkper` CLI.
|
|
3
|
+
Interact with books, files, accounts, transactions, and balances using the `bkper` CLI.
|
|
4
4
|
|
|
5
5
|
All commands that operate within a book use `-b, --book <bookId>` to specify the book context.
|
|
6
6
|
|
|
@@ -155,6 +155,39 @@ Avoid using the same name for a Group and an Account in the same Book.
|
|
|
155
155
|
|
|
156
156
|
---
|
|
157
157
|
|
|
158
|
+
## Files
|
|
159
|
+
|
|
160
|
+
Upload local files to a book and optionally route them with properties.
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
# Upload a file to a book
|
|
164
|
+
bkper file upload ./receipt.jpg -b abc123
|
|
165
|
+
|
|
166
|
+
# Get a file by id
|
|
167
|
+
bkper file get file_123 -b abc123
|
|
168
|
+
|
|
169
|
+
# Upload and resolve an account to canonical account_id
|
|
170
|
+
bkper file upload ./statement.pdf -b abc123 --account "Credit Card"
|
|
171
|
+
|
|
172
|
+
# Upload with workflow properties
|
|
173
|
+
bkper file upload ./statement.pdf -b abc123 \
|
|
174
|
+
-p statement_period=2025-01 -p group_id=grp_123
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Use `-p group_id=...` for group-based routing. The CLI infers `contentType` from the local filename when possible, so PDFs are uploaded as `application/pdf` instead of a generic binary type. It rejects `--account` together with raw `-p account_id=...` and forbids `-p upload_method=...` because that property is reserved for transaction attachments.
|
|
178
|
+
|
|
179
|
+
<details>
|
|
180
|
+
<summary>Command reference</summary>
|
|
181
|
+
|
|
182
|
+
- `file get <fileId> -b <bookId>` - Get a file by ID
|
|
183
|
+
- `file upload <path> -b <bookId>` - Upload a local file to a book
|
|
184
|
+
- `--account <accountIdOrName>` - Resolve an account by name or id and persist canonical `account_id=<resolvedAccountId>`
|
|
185
|
+
- `-p, --property <key=value>` - Set a property (repeatable, empty value deletes)
|
|
186
|
+
|
|
187
|
+
</details>
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
158
191
|
## Transactions
|
|
159
192
|
|
|
160
193
|
Record, query, and manage financial transactions.
|
|
@@ -167,6 +200,13 @@ bkper transaction create -b abc123 --description "Office supplies"
|
|
|
167
200
|
bkper transaction create -b abc123 --date 2025-01-15 --amount 100.50 \
|
|
168
201
|
--from "Bank Account" --to "Office Supplies" --description "Printer paper"
|
|
169
202
|
|
|
203
|
+
# Create a transaction with one local attachment
|
|
204
|
+
bkper transaction create -b abc123 --date 2025-01-15 --amount 23.90 \
|
|
205
|
+
--from "Cash" --to "Meals" --description "Team lunch" --file ./receipt.pdf
|
|
206
|
+
|
|
207
|
+
# Create a file-only draft for receipt capture
|
|
208
|
+
bkper transaction create -b abc123 --file ./invoice.pdf
|
|
209
|
+
|
|
170
210
|
# List transactions for a full year (on:YYYY)
|
|
171
211
|
bkper transaction list -b abc123 -q 'on:2025'
|
|
172
212
|
|
|
@@ -205,6 +245,7 @@ bkper transaction merge tx_123 tx_456 -b abc123
|
|
|
205
245
|
- `--to <to>` - Debit account (destination)
|
|
206
246
|
- `--url <url>` - URL (repeatable)
|
|
207
247
|
- `--remote-id <remoteId>` - Remote ID (repeatable)
|
|
248
|
+
- `--file <path>` - Attach one local file during single-create mode only
|
|
208
249
|
- `-p, --property <key=value>` - Set a property (repeatable, empty value deletes)
|
|
209
250
|
- `transaction update [transactionId] -b <bookId>` - Update a transaction (or batch update via stdin)
|
|
210
251
|
- `--date <date>` - Transaction date
|
|
@@ -222,6 +263,7 @@ bkper transaction merge tx_123 tx_456 -b abc123
|
|
|
222
263
|
|
|
223
264
|
</details>
|
|
224
265
|
|
|
266
|
+
|
|
225
267
|
---
|
|
226
268
|
|
|
227
269
|
## Balances
|
|
@@ -367,6 +409,8 @@ CSV is significantly more token-efficient than JSON for tabular data, and for wi
|
|
|
367
409
|
|
|
368
410
|
Write commands (`account create`, `transaction create`) accept JSON data piped via stdin for batch operations. The `transaction update` command also accepts stdin for batch updates. The input format follows the [Bkper API Types](https://raw.githubusercontent.com/bkper/bkper-api-types/refs/heads/master/index.d.ts) exactly -- a single JSON object or an array of objects.
|
|
369
411
|
|
|
412
|
+
`transaction create --file` is not available in stdin batch mode. Use single-create commands when attaching a local file.
|
|
413
|
+
|
|
370
414
|
```bash
|
|
371
415
|
# Create transactions
|
|
372
416
|
echo '[{
|
package/lib/docs/index.md
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Reference docs for Bkper tasks. Load only the specific doc(s) relevant to the task — do not load all of them. All docs are in the same directory as this index.
|
|
4
4
|
|
|
5
|
-
- **data-management.md** — CLI reference for managing financial data: books, accounts, groups, transactions, per-account balance queries, query operators (on:, after:, before:, account:, group:), output formats (table/json/csv), batch operations via stdin/piping, collections.
|
|
5
|
+
- **data-management.md** — CLI reference for managing financial data and files: books, accounts, groups, files, transactions, per-account balance queries, query operators (on:, after:, before:, account:, group:), output formats (table/json/csv), batch operations via stdin/piping, collections.
|
|
6
6
|
- **app-management.md** — CLI reference for building and deploying Bkper apps: dev/build/deploy workflow, app install/uninstall, secrets management, app logs, bkper.yaml configuration reference (identity, branding, events, menu integration, deployment).
|
|
7
7
|
- **app-building.md** — Full app-building reference: architecture (packages, client/server/events), development loop, event handlers, deployment patterns, the Bkper Platform, and self-hosted alternatives. Includes authentication patterns for web clients (`@bkper/web-auth`), event handlers (`bkper-oauth-token` headers), and local development. Load this for scaffolding apps, understanding app structure, or debugging the dev/build/deploy lifecycle.
|
|
8
8
|
- **financial-statements.md** — Step-by-step workflow for aggregate financial reports (balance sheet, P&L): root group discovery, query patterns, date semantics (before: vs after:+before:), common mistakes to avoid.
|
|
9
9
|
- **taxes.md** — Deterministic workflow for tax position and filing summaries: discovering tax-relevant groups, period-based balance queries, persisting a local tax runner. Jurisdiction-agnostic — outputs raw period balances, leaving rate/application to the user.
|
|
10
10
|
- **bkper-js.md** — bkper-js Node.js/browser SDK: Bkper, Book, Account, Transaction, Group, Balance classes, all methods, getBalancesReport, OAuth configuration, library setup.
|
|
11
|
-
- **bkper-api-types.md** — Bkper REST API TypeScript interfaces: Book, Account, Transaction, Group, Balance, Collection — field names and types used by the API and bkper-js.
|
|
11
|
+
- **bkper-api-types.md** — Bkper REST API TypeScript interfaces: Book, Account, Transaction, Group, Balance, Collection, File — field names and types used by the API and bkper-js.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reads a local file from disk and returns a Bkper File payload.
|
|
3
|
+
*
|
|
4
|
+
* The payload preserves the local basename as the file name and encodes the
|
|
5
|
+
* content as base64, ready to be passed to `new File(book, payload)`.
|
|
6
|
+
*
|
|
7
|
+
* @param localPath - Local filesystem path
|
|
8
|
+
* @returns File payload suitable for Bkper uploads
|
|
9
|
+
*/
|
|
10
|
+
export declare function readLocalFilePayload(localPath: string): Promise<bkper.File>;
|
|
11
|
+
//# sourceMappingURL=local-file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-file.d.ts","sourceRoot":"","sources":["../../src/utils/local-file.ts"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AACH,wBAAsB,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAgCjF"}
|
|
@@ -0,0 +1,55 @@
|
|
|
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 { readFile, stat } from 'node:fs/promises';
|
|
11
|
+
import mime from 'mime';
|
|
12
|
+
import path from 'node:path';
|
|
13
|
+
/**
|
|
14
|
+
* Reads a local file from disk and returns a Bkper File payload.
|
|
15
|
+
*
|
|
16
|
+
* The payload preserves the local basename as the file name and encodes the
|
|
17
|
+
* content as base64, ready to be passed to `new File(book, payload)`.
|
|
18
|
+
*
|
|
19
|
+
* @param localPath - Local filesystem path
|
|
20
|
+
* @returns File payload suitable for Bkper uploads
|
|
21
|
+
*/
|
|
22
|
+
export function readLocalFilePayload(localPath) {
|
|
23
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
let fileStats;
|
|
25
|
+
try {
|
|
26
|
+
fileStats = yield stat(localPath);
|
|
27
|
+
}
|
|
28
|
+
catch (err) {
|
|
29
|
+
const error = err;
|
|
30
|
+
if (error.code === 'ENOENT') {
|
|
31
|
+
throw new Error(`Local file not found: ${localPath}`);
|
|
32
|
+
}
|
|
33
|
+
throw new Error(`Local file is not readable: ${localPath}`);
|
|
34
|
+
}
|
|
35
|
+
if (!fileStats.isFile()) {
|
|
36
|
+
throw new Error(`Local path is not a regular file: ${localPath}`);
|
|
37
|
+
}
|
|
38
|
+
let content;
|
|
39
|
+
try {
|
|
40
|
+
content = yield readFile(localPath);
|
|
41
|
+
}
|
|
42
|
+
catch (_a) {
|
|
43
|
+
throw new Error(`Local file is not readable: ${localPath}`);
|
|
44
|
+
}
|
|
45
|
+
const contentType = mime.getType(localPath);
|
|
46
|
+
return {
|
|
47
|
+
createdAt: `${Date.now()}`,
|
|
48
|
+
name: path.basename(localPath),
|
|
49
|
+
contentType: contentType || undefined,
|
|
50
|
+
size: fileStats.size,
|
|
51
|
+
content: content.toString('base64'),
|
|
52
|
+
};
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=local-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-file.js","sourceRoot":"","sources":["../../src/utils/local-file.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B;;;;;;;;GAQG;AACH,MAAM,UAAgB,oBAAoB,CAAC,SAAiB;;QACxD,IAAI,SAAS,CAAC;QACd,IAAI,CAAC;YACD,SAAS,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,CAAC;QACtC,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACpB,MAAM,KAAK,GAAG,GAA4B,CAAC;YAC3C,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;gBAC1B,MAAM,IAAI,KAAK,CAAC,yBAAyB,SAAS,EAAE,CAAC,CAAC;YAC1D,CAAC;YACD,MAAM,IAAI,KAAK,CAAC,+BAA+B,SAAS,EAAE,CAAC,CAAC;QAChE,CAAC;QAED,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CAAC,qCAAqC,SAAS,EAAE,CAAC,CAAC;QACtE,CAAC;QAED,IAAI,OAAe,CAAC;QACpB,IAAI,CAAC;YACD,OAAO,GAAG,MAAM,QAAQ,CAAC,SAAS,CAAC,CAAC;QACxC,CAAC;QAAC,WAAM,CAAC;YACL,MAAM,IAAI,KAAK,CAAC,+BAA+B,SAAS,EAAE,CAAC,CAAC;QAChE,CAAC;QAED,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAE5C,OAAO;YACH,SAAS,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,EAAE;YAC1B,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC;YAC9B,WAAW,EAAE,WAAW,IAAI,SAAS;YACrC,IAAI,EAAE,SAAS,CAAC,IAAI;YACpB,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC;SACtC,CAAC;IACN,CAAC;CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bkper",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.13.0",
|
|
4
4
|
"description": "Command line client for Bkper",
|
|
5
5
|
"bin": {
|
|
6
6
|
"bkper": "./lib/cli.js"
|
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
"dotenv": "^8.2.0",
|
|
59
59
|
"esbuild": "^0.27.2",
|
|
60
60
|
"google-auth-library": "^10.5.0",
|
|
61
|
+
"mime": "^4.1.0",
|
|
61
62
|
"open": "^10.1.0",
|
|
62
63
|
"openapi-fetch": "^0.15.0",
|
|
63
64
|
"tar": "^7.0.0",
|