bkper 4.12.5 → 4.12.6
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.
|
@@ -26,7 +26,7 @@ export function batchCreateAccounts(bookId, items, propertyOverrides) {
|
|
|
26
26
|
const book = yield bkper.getBook(bookId);
|
|
27
27
|
const accounts = [];
|
|
28
28
|
for (const item of items) {
|
|
29
|
-
const account =
|
|
29
|
+
const account = yield buildAccountFromStdin(book, item);
|
|
30
30
|
// CLI --property flags override stdin properties
|
|
31
31
|
if (propertyOverrides) {
|
|
32
32
|
for (const raw of propertyOverrides) {
|
|
@@ -46,4 +46,26 @@ export function batchCreateAccounts(bookId, items, propertyOverrides) {
|
|
|
46
46
|
console.log(JSON.stringify(allResults, null, 2));
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
|
+
function buildAccountFromStdin(book, item) {
|
|
50
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
const payload = Object.assign({}, item);
|
|
52
|
+
const groupRefs = payload.groups;
|
|
53
|
+
delete payload.groups;
|
|
54
|
+
const account = new Account(book, payload);
|
|
55
|
+
if (groupRefs) {
|
|
56
|
+
for (const groupRef of groupRefs) {
|
|
57
|
+
const idOrName = groupRef.id || groupRef.name;
|
|
58
|
+
if (!idOrName || idOrName.trim() === '') {
|
|
59
|
+
throw new Error('Account group reference must include id or name');
|
|
60
|
+
}
|
|
61
|
+
const group = yield book.getGroup(idOrName);
|
|
62
|
+
if (!group) {
|
|
63
|
+
throw new Error(`Group not found: ${idOrName}`);
|
|
64
|
+
}
|
|
65
|
+
account.addGroup(group);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return account;
|
|
69
|
+
});
|
|
70
|
+
}
|
|
49
71
|
//# sourceMappingURL=batch-create.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"batch-create.js","sourceRoot":"","sources":["../../../src/commands/accounts/batch-create.ts"],"names":[],"mappings":";;;;;;;;;AA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description": "Command line client for Bkper",
|
|
5
5
|
"bin": {
|
|
6
6
|
"bkper": "./lib/cli.js"
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@mariozechner/pi-coding-agent": "^0.65.2",
|
|
51
|
-
"bkper-js": "^2.32.
|
|
51
|
+
"bkper-js": "^2.32.2",
|
|
52
52
|
"commander": "^13.1.0",
|
|
53
53
|
"dotenv": "^8.2.0",
|
|
54
54
|
"esbuild": "^0.27.2",
|