jaz-clio 4.35.0 → 4.35.2
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/assets/skills/api/SKILL.md +1 -1
- package/assets/skills/cli/SKILL.md +1 -1
- package/assets/skills/conversion/SKILL.md +1 -1
- package/assets/skills/jobs/SKILL.md +1 -1
- package/assets/skills/transaction-recipes/SKILL.md +1 -1
- package/dist/commands/accounts.js +6 -6
- package/dist/commands/attachments.js +8 -8
- package/dist/commands/auth.js +41 -41
- package/dist/commands/bank-rules.js +14 -14
- package/dist/commands/bank.js +27 -27
- package/dist/commands/bills.js +35 -35
- package/dist/commands/bookmarks.js +8 -8
- package/dist/commands/calc.js +2 -2
- package/dist/commands/capsules.js +14 -14
- package/dist/commands/cash-entry.js +16 -16
- package/dist/commands/cash-transfer.js +4 -4
- package/dist/commands/cashflow.js +2 -2
- package/dist/commands/contact-groups.js +10 -10
- package/dist/commands/contacts.js +14 -14
- package/dist/commands/currencies.js +2 -2
- package/dist/commands/currency-rates.js +8 -8
- package/dist/commands/custom-fields.js +12 -12
- package/dist/commands/customer-credit-notes.js +30 -30
- package/dist/commands/draft-helpers.js +12 -12
- package/dist/commands/exports.js +4 -4
- package/dist/commands/fixed-assets.js +23 -23
- package/dist/commands/format-helpers.js +5 -0
- package/dist/commands/help-examples.js +2 -2
- package/dist/commands/init.js +8 -8
- package/dist/commands/inventory.js +7 -7
- package/dist/commands/invoices.js +36 -36
- package/dist/commands/items.js +11 -11
- package/dist/commands/jobs.js +33 -33
- package/dist/commands/journals.js +27 -27
- package/dist/commands/kb.js +6 -6
- package/dist/commands/magic.js +40 -40
- package/dist/commands/nano-classifiers.js +8 -8
- package/dist/commands/org-users.js +5 -5
- package/dist/commands/org.js +8 -8
- package/dist/commands/output.js +3 -3
- package/dist/commands/pagination.js +2 -2
- package/dist/commands/parsers.js +20 -20
- package/dist/commands/payments.js +9 -9
- package/dist/commands/picker.js +88 -90
- package/dist/commands/quick-fix.js +8 -8
- package/dist/commands/recipe.js +16 -16
- package/dist/commands/reports.js +11 -11
- package/dist/commands/resolve.js +8 -8
- package/dist/commands/schedulers.js +25 -25
- package/dist/commands/schema.js +15 -24
- package/dist/commands/search.js +4 -4
- package/dist/commands/subscriptions.js +17 -17
- package/dist/commands/supplier-credit-notes.js +28 -28
- package/dist/commands/tags.js +10 -10
- package/dist/commands/tax-profiles.js +11 -11
- package/dist/commands/ui/index.js +1 -0
- package/dist/commands/ui/picker.js +180 -0
- package/dist/commands/ui/table.js +2 -3
- package/dist/commands/ui/theme.js +1 -0
- package/dist/commands/update.js +2 -2
- package/dist/commands/versions.js +3 -3
- package/dist/core/calc/format.js +126 -126
- package/dist/core/jobs/document-collection/tools/ingest/format.js +25 -25
- package/dist/core/jobs/format.js +23 -23
- package/dist/core/jobs/payment-run/tools/bank-file/format.js +7 -7
- package/dist/core/jobs/payment-run/tools/outstanding/format.js +9 -9
- package/dist/core/jobs/statutory-filing/tools/sg-tax/format-sg.js +19 -19
- package/dist/index.js +11 -11
- package/package.json +1 -1
package/dist/commands/bills.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { danger, success, accent, warning, muted, highlight } from './ui/theme.js';
|
|
2
2
|
import { formatStatus, formatId, formatReference, formatCurrency } from './format-helpers.js';
|
|
3
3
|
import { listBills, getBill, searchBills, createBill, updateBill, deleteBill, createBillPayment, applyCreditsToBill, finalizeBill, listBillPayments, listBillCredits, reverseBillCredit, } from '../core/api/bills.js';
|
|
4
4
|
import { listAttachments } from '../core/api/attachments.js';
|
|
@@ -48,25 +48,25 @@ export function registerBillsCommand(program) {
|
|
|
48
48
|
console.log(JSON.stringify(b, null, 2));
|
|
49
49
|
}
|
|
50
50
|
else {
|
|
51
|
-
console.log(
|
|
52
|
-
console.log(
|
|
53
|
-
console.log(
|
|
54
|
-
console.log(
|
|
55
|
-
console.log(
|
|
51
|
+
console.log(highlight('Reference:'), b.reference || '(none)');
|
|
52
|
+
console.log(highlight('ID:'), b.resourceId);
|
|
53
|
+
console.log(highlight('Status:'), b.status);
|
|
54
|
+
console.log(highlight('Date:'), normalizeDate(b.valueDate));
|
|
55
|
+
console.log(highlight('Due:'), normalizeDate(b.dueDate));
|
|
56
56
|
if (b.contactName)
|
|
57
|
-
console.log(
|
|
57
|
+
console.log(highlight('Contact:'), b.contactName);
|
|
58
58
|
if (b.totalAmount !== undefined)
|
|
59
|
-
console.log(
|
|
59
|
+
console.log(highlight('Total:'), b.totalAmount.toFixed(2));
|
|
60
60
|
if (b.amountDue !== undefined)
|
|
61
|
-
console.log(
|
|
61
|
+
console.log(highlight('Amount Due:'), b.amountDue.toFixed(2));
|
|
62
62
|
if (b.lineItems?.length) {
|
|
63
|
-
console.log(
|
|
63
|
+
console.log(highlight('Line Items:'));
|
|
64
64
|
for (const li of b.lineItems) {
|
|
65
65
|
console.log(` - ${li.name} qty: ${li.quantity ?? 1} price: ${(li.unitPrice ?? 0).toFixed(2)}`);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
if (b.notes)
|
|
69
|
-
console.log(
|
|
69
|
+
console.log(highlight('Notes:'), b.notes);
|
|
70
70
|
}
|
|
71
71
|
})(opts));
|
|
72
72
|
// ── clio bills search ───────────────────────────────────────────
|
|
@@ -176,8 +176,8 @@ export function registerBillsCommand(program) {
|
|
|
176
176
|
}
|
|
177
177
|
else {
|
|
178
178
|
const status = opts.finalize ? 'finalized' : 'draft';
|
|
179
|
-
console.log(
|
|
180
|
-
console.log(
|
|
179
|
+
console.log(success(`Bill created (${status}): ${res.data.reference || res.data.resourceId}`));
|
|
180
|
+
console.log(highlight('ID:'), res.data.resourceId);
|
|
181
181
|
}
|
|
182
182
|
}));
|
|
183
183
|
// ── clio bills update ───────────────────────────────────────────
|
|
@@ -222,7 +222,7 @@ export function registerBillsCommand(program) {
|
|
|
222
222
|
console.log(JSON.stringify(res.data, null, 2));
|
|
223
223
|
}
|
|
224
224
|
else {
|
|
225
|
-
console.log(
|
|
225
|
+
console.log(success(`Bill updated: ${res.data.reference || res.data.resourceId}`));
|
|
226
226
|
}
|
|
227
227
|
})(opts));
|
|
228
228
|
// ── clio bills delete ───────────────────────────────────────────
|
|
@@ -237,7 +237,7 @@ export function registerBillsCommand(program) {
|
|
|
237
237
|
console.log(JSON.stringify({ deleted: true, resourceId }));
|
|
238
238
|
}
|
|
239
239
|
else {
|
|
240
|
-
console.log(
|
|
240
|
+
console.log(success(`Bill ${resourceId} deleted.`));
|
|
241
241
|
}
|
|
242
242
|
})(opts));
|
|
243
243
|
// ── clio bills pay ──────────────────────────────────────────────
|
|
@@ -294,7 +294,7 @@ export function registerBillsCommand(program) {
|
|
|
294
294
|
console.log(JSON.stringify(res.data, null, 2));
|
|
295
295
|
}
|
|
296
296
|
else {
|
|
297
|
-
console.log(
|
|
297
|
+
console.log(success(`Payment recorded for bill ${resourceId}`));
|
|
298
298
|
}
|
|
299
299
|
})(opts));
|
|
300
300
|
// ── clio bills apply-credits ──────────────────────────────────
|
|
@@ -328,7 +328,7 @@ export function registerBillsCommand(program) {
|
|
|
328
328
|
console.log(JSON.stringify(res.data, null, 2));
|
|
329
329
|
}
|
|
330
330
|
else {
|
|
331
|
-
console.log(
|
|
331
|
+
console.log(success(`Applied ${credits.length} credit(s) to bill ${resourceId}`));
|
|
332
332
|
}
|
|
333
333
|
})(opts));
|
|
334
334
|
// ── clio bills draft ────────────────────────────────────────────
|
|
@@ -410,7 +410,7 @@ export function registerBillsCommand(program) {
|
|
|
410
410
|
console.log(JSON.stringify({ finalized: false, error: msg }));
|
|
411
411
|
}
|
|
412
412
|
else {
|
|
413
|
-
console.error(
|
|
413
|
+
console.error(danger(msg));
|
|
414
414
|
}
|
|
415
415
|
process.exit(1);
|
|
416
416
|
}
|
|
@@ -487,13 +487,13 @@ export function registerBillsCommand(program) {
|
|
|
487
487
|
}
|
|
488
488
|
else {
|
|
489
489
|
if (ready) {
|
|
490
|
-
console.log(
|
|
490
|
+
console.log(success(`✓ ${merged.reference || resourceId} is ready to finalize.`));
|
|
491
491
|
}
|
|
492
492
|
else {
|
|
493
|
-
console.error(
|
|
493
|
+
console.error(warning(`✗ ${merged.reference || resourceId} — ${missingCount} issue${missingCount > 1 ? 's' : ''} remaining:`));
|
|
494
494
|
for (const f of missingFields) {
|
|
495
495
|
const spec = BILL_REQUIRED_FIELDS.find((s) => f === s.field || f.endsWith(`.${s.field}`));
|
|
496
|
-
console.log(` ${f}: ${
|
|
496
|
+
console.log(` ${f}: ${danger('MISSING')} — ${spec?.hint ?? ''}`);
|
|
497
497
|
}
|
|
498
498
|
}
|
|
499
499
|
}
|
|
@@ -514,12 +514,12 @@ export function registerBillsCommand(program) {
|
|
|
514
514
|
}, null, 2));
|
|
515
515
|
}
|
|
516
516
|
else {
|
|
517
|
-
console.error(
|
|
517
|
+
console.error(danger(`\n✗ Cannot finalize ${merged.reference || resourceId} — ${missingCount} issue${missingCount > 1 ? 's' : ''} remaining:\n`));
|
|
518
518
|
for (const f of missingFields) {
|
|
519
519
|
const spec = BILL_REQUIRED_FIELDS.find((s) => f === s.field || f.endsWith(`.${s.field}`));
|
|
520
|
-
console.error(` ${f}: ${
|
|
520
|
+
console.error(` ${f}: ${danger('MISSING')} — ${spec?.hint ?? ''}`);
|
|
521
521
|
}
|
|
522
|
-
console.error(
|
|
522
|
+
console.error(muted(`\n Fix the issues and retry:\n clio bills draft finalize ${resourceId} ...\n`));
|
|
523
523
|
}
|
|
524
524
|
process.exit(1);
|
|
525
525
|
}
|
|
@@ -540,10 +540,10 @@ export function registerBillsCommand(program) {
|
|
|
540
540
|
}, null, 2));
|
|
541
541
|
}
|
|
542
542
|
else {
|
|
543
|
-
console.log(
|
|
544
|
-
console.log(
|
|
543
|
+
console.log(success(`\n✓ Bill finalized: ${updated.reference || updated.resourceId}`));
|
|
544
|
+
console.log(highlight(' Status:'), updated.status);
|
|
545
545
|
if (fieldsUpdated.length > 0) {
|
|
546
|
-
console.log(
|
|
546
|
+
console.log(highlight(' Updated:'), fieldsUpdated.join(', '));
|
|
547
547
|
}
|
|
548
548
|
}
|
|
549
549
|
})(opts));
|
|
@@ -571,11 +571,11 @@ export function registerBillsCommand(program) {
|
|
|
571
571
|
console.log(`No attachments for bill ${bill.reference || resourceId}.`);
|
|
572
572
|
return;
|
|
573
573
|
}
|
|
574
|
-
console.log(
|
|
574
|
+
console.log(highlight(`Attachments for ${bill.reference || resourceId}:\n`));
|
|
575
575
|
for (const att of attachments) {
|
|
576
|
-
console.log(` ${
|
|
576
|
+
console.log(` ${accent(att.resourceId)} ${att.fileName || '(unnamed)'}`);
|
|
577
577
|
if (att.fileUrl)
|
|
578
|
-
console.log(` ${
|
|
578
|
+
console.log(` ${muted(att.fileUrl)}`);
|
|
579
579
|
}
|
|
580
580
|
}
|
|
581
581
|
})(opts));
|
|
@@ -596,9 +596,9 @@ export function registerBillsCommand(program) {
|
|
|
596
596
|
console.log('No payments recorded for this bill.');
|
|
597
597
|
return;
|
|
598
598
|
}
|
|
599
|
-
console.log(
|
|
599
|
+
console.log(highlight(`Payments for bill ${resourceId}:\n`));
|
|
600
600
|
for (const p of payments) { // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
601
|
-
console.log(` ${
|
|
601
|
+
console.log(` ${accent(p.resourceId)} ${p.paymentAmount ?? p.amount ?? ''} on ${p.valueDate ?? ''}`);
|
|
602
602
|
}
|
|
603
603
|
}
|
|
604
604
|
})(opts));
|
|
@@ -619,9 +619,9 @@ export function registerBillsCommand(program) {
|
|
|
619
619
|
console.log('No credits applied to this bill.');
|
|
620
620
|
return;
|
|
621
621
|
}
|
|
622
|
-
console.log(
|
|
622
|
+
console.log(highlight(`Credits for bill ${resourceId}:\n`));
|
|
623
623
|
for (const c of credits) { // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
624
|
-
console.log(` ${
|
|
624
|
+
console.log(` ${accent(c.resourceId)} ${c.amount ?? ''}`);
|
|
625
625
|
}
|
|
626
626
|
}
|
|
627
627
|
})(opts));
|
|
@@ -637,7 +637,7 @@ export function registerBillsCommand(program) {
|
|
|
637
637
|
console.log(JSON.stringify({ reversed: true, resourceId, creditResourceId }));
|
|
638
638
|
}
|
|
639
639
|
else {
|
|
640
|
-
console.log(
|
|
640
|
+
console.log(success(`Credit ${creditResourceId} reversed from bill ${resourceId}.`));
|
|
641
641
|
}
|
|
642
642
|
})(opts));
|
|
643
643
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
1
|
import { listBookmarks, getBookmark, createBookmarks, updateBookmark, } from '../core/api/bookmarks.js';
|
|
3
2
|
import { apiAction } from './api-action.js';
|
|
4
3
|
import { parsePositiveInt, parseNonNegativeInt, readBodyInput, requireFields } from './parsers.js';
|
|
5
4
|
import { paginatedFetch } from './pagination.js';
|
|
6
5
|
import { outputList } from './output.js';
|
|
7
6
|
import { formatId } from './format-helpers.js';
|
|
7
|
+
import { accent, highlight, success } from './ui/theme.js';
|
|
8
8
|
const BOOKMARKS_COLUMNS = [
|
|
9
9
|
{ key: 'resourceId', header: 'ID', format: formatId },
|
|
10
10
|
{ key: 'name', header: 'Name' },
|
|
@@ -43,10 +43,10 @@ export function registerBookmarksCommand(program) {
|
|
|
43
43
|
console.log(JSON.stringify(b, null, 2));
|
|
44
44
|
}
|
|
45
45
|
else {
|
|
46
|
-
console.log(
|
|
47
|
-
console.log(
|
|
48
|
-
console.log(
|
|
49
|
-
console.log(
|
|
46
|
+
console.log(highlight('Name:'), b.name);
|
|
47
|
+
console.log(highlight('ID:'), b.resourceId);
|
|
48
|
+
console.log(highlight('Category:'), b.categoryCode);
|
|
49
|
+
console.log(highlight('Value:'), b.value);
|
|
50
50
|
}
|
|
51
51
|
})(opts));
|
|
52
52
|
// ── clio bookmarks create ─────────────────────────────────────
|
|
@@ -84,9 +84,9 @@ export function registerBookmarksCommand(program) {
|
|
|
84
84
|
console.log(JSON.stringify(res.data, null, 2));
|
|
85
85
|
}
|
|
86
86
|
else {
|
|
87
|
-
console.log(
|
|
87
|
+
console.log(success(`Bookmark(s) created: ${res.data.length} item(s)`));
|
|
88
88
|
for (const b of res.data) {
|
|
89
|
-
console.log(` ${
|
|
89
|
+
console.log(` ${accent(b.resourceId)} ${b.name}`);
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
}));
|
|
@@ -115,7 +115,7 @@ export function registerBookmarksCommand(program) {
|
|
|
115
115
|
console.log(JSON.stringify(res.data, null, 2));
|
|
116
116
|
}
|
|
117
117
|
else {
|
|
118
|
-
console.log(
|
|
118
|
+
console.log(success(`Bookmark updated: ${res.data.name}`));
|
|
119
119
|
}
|
|
120
120
|
})(opts));
|
|
121
121
|
}
|
package/dist/commands/calc.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { danger } from './ui/theme.js';
|
|
2
2
|
import { calculateLoan } from '../core/calc/loan.js';
|
|
3
3
|
import { calculateLease } from '../core/calc/lease.js';
|
|
4
4
|
import { calculateDepreciation } from '../core/calc/depreciation.js';
|
|
@@ -21,7 +21,7 @@ function calcAction(fn) {
|
|
|
21
21
|
}
|
|
22
22
|
catch (err) {
|
|
23
23
|
if (err instanceof CalcValidationError) {
|
|
24
|
-
console.error(
|
|
24
|
+
console.error(danger(`Error: ${err.message}`));
|
|
25
25
|
process.exit(1);
|
|
26
26
|
}
|
|
27
27
|
throw err;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { success, accent, muted, highlight } from './ui/theme.js';
|
|
2
2
|
import { listCapsules, searchCapsules, getCapsule, createCapsule, updateCapsule, deleteCapsule, listCapsuleTypes, createCapsuleType, } from '../core/api/capsules.js';
|
|
3
3
|
import { apiAction } from './api-action.js';
|
|
4
4
|
import { outputList } from './output.js';
|
|
@@ -62,14 +62,14 @@ export function registerCapsulesCommand(program) {
|
|
|
62
62
|
console.log(JSON.stringify(c, null, 2));
|
|
63
63
|
}
|
|
64
64
|
else {
|
|
65
|
-
console.log(
|
|
65
|
+
console.log(highlight('Title:'), c.title);
|
|
66
66
|
if (c.description)
|
|
67
|
-
console.log(
|
|
68
|
-
console.log(
|
|
67
|
+
console.log(highlight('Description:'), c.description);
|
|
68
|
+
console.log(highlight('ID:'), c.resourceId);
|
|
69
69
|
if (c.type)
|
|
70
|
-
console.log(
|
|
70
|
+
console.log(highlight('Type:'), c.type);
|
|
71
71
|
if (c.capsuleType?.resourceId)
|
|
72
|
-
console.log(
|
|
72
|
+
console.log(highlight('Type ID:'), c.capsuleType.resourceId);
|
|
73
73
|
}
|
|
74
74
|
})(opts));
|
|
75
75
|
// ── clio capsules create ──────────────────────────────────────
|
|
@@ -105,8 +105,8 @@ export function registerCapsulesCommand(program) {
|
|
|
105
105
|
console.log(JSON.stringify(res.data, null, 2));
|
|
106
106
|
}
|
|
107
107
|
else {
|
|
108
|
-
console.log(
|
|
109
|
-
console.log(
|
|
108
|
+
console.log(success(`Capsule created: ${opts.title}`));
|
|
109
|
+
console.log(highlight('ID:'), res.data.resourceId);
|
|
110
110
|
}
|
|
111
111
|
}));
|
|
112
112
|
// ── clio capsules update ──────────────────────────────────────
|
|
@@ -137,7 +137,7 @@ export function registerCapsulesCommand(program) {
|
|
|
137
137
|
console.log(JSON.stringify(res.data, null, 2));
|
|
138
138
|
}
|
|
139
139
|
else {
|
|
140
|
-
console.log(
|
|
140
|
+
console.log(success(`Capsule updated: ${res.data.title}`));
|
|
141
141
|
}
|
|
142
142
|
})(opts));
|
|
143
143
|
// ── clio capsules delete ─────────────────────────────────────
|
|
@@ -153,7 +153,7 @@ export function registerCapsulesCommand(program) {
|
|
|
153
153
|
console.log(JSON.stringify({ deleted: true, resourceId }));
|
|
154
154
|
}
|
|
155
155
|
else {
|
|
156
|
-
console.log(
|
|
156
|
+
console.log(success(`Capsule ${resourceId} deleted.`));
|
|
157
157
|
}
|
|
158
158
|
})(opts));
|
|
159
159
|
// ── clio capsules types ───────────────────────────────────────
|
|
@@ -169,9 +169,9 @@ export function registerCapsulesCommand(program) {
|
|
|
169
169
|
console.log(JSON.stringify(res.data, null, 2));
|
|
170
170
|
}
|
|
171
171
|
else {
|
|
172
|
-
console.log(
|
|
172
|
+
console.log(highlight(`Capsule Types (${res.data.length}):\n`));
|
|
173
173
|
for (const t of res.data) {
|
|
174
|
-
console.log(` ${
|
|
174
|
+
console.log(` ${accent(t.resourceId)} ${t.displayName}${t.description ? muted(` — ${t.description}`) : ''}`);
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
177
|
}));
|
|
@@ -205,8 +205,8 @@ export function registerCapsulesCommand(program) {
|
|
|
205
205
|
console.log(JSON.stringify(res.data, null, 2));
|
|
206
206
|
}
|
|
207
207
|
else {
|
|
208
|
-
console.log(
|
|
209
|
-
console.log(
|
|
208
|
+
console.log(success(`Capsule type created: ${opts.name}`));
|
|
209
|
+
console.log(highlight('ID:'), res.data.resourceId);
|
|
210
210
|
}
|
|
211
211
|
}));
|
|
212
212
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { success, accent, muted, highlight } from './ui/theme.js';
|
|
2
2
|
import { formatStatus, formatId, formatReference, formatCurrency } from './format-helpers.js';
|
|
3
3
|
import { searchCashflowTransactions, deleteCashEntry } from '../core/api/cashflow.js';
|
|
4
4
|
import { apiAction } from './api-action.js';
|
|
@@ -14,23 +14,23 @@ export function formatCashflowDate(epochMs) {
|
|
|
14
14
|
}
|
|
15
15
|
export function formatCashflowRow(t) {
|
|
16
16
|
const status = formatStatus(t.transactionStatus);
|
|
17
|
-
const amount =
|
|
17
|
+
const amount = muted(`${t.currencySymbol}${t.totalAmount.toFixed(2)}`);
|
|
18
18
|
const date = formatCashflowDate(t.valueDate);
|
|
19
19
|
const acctName = t.account?.name || '—';
|
|
20
|
-
return ` ${
|
|
20
|
+
return ` ${accent(t.resourceId)} ${t.transactionReference || '(no ref)'} ${status} ${amount} ${date} ${acctName}`;
|
|
21
21
|
}
|
|
22
22
|
export function printCashflowDetail(t) {
|
|
23
23
|
const status = formatStatus(t.transactionStatus);
|
|
24
|
-
console.log(
|
|
25
|
-
console.log(
|
|
26
|
-
console.log(
|
|
27
|
-
console.log(
|
|
28
|
-
console.log(
|
|
29
|
-
console.log(
|
|
30
|
-
console.log(
|
|
31
|
-
console.log(
|
|
24
|
+
console.log(highlight('Reference:'), t.transactionReference || '(none)');
|
|
25
|
+
console.log(highlight(' ID:'), accent(t.resourceId));
|
|
26
|
+
console.log(highlight(' Status:'), status);
|
|
27
|
+
console.log(highlight(' Date:'), formatCashflowDate(t.valueDate));
|
|
28
|
+
console.log(highlight(' Type:'), t.businessTransactionType);
|
|
29
|
+
console.log(highlight(' Direction:'), t.direction);
|
|
30
|
+
console.log(highlight(' Amount:'), `${t.currencySymbol}${t.totalAmount.toFixed(2)} ${t.currencyCode}`);
|
|
31
|
+
console.log(highlight(' Account:'), t.account?.name || '—', muted(`(${t.organizationAccountResourceId})`));
|
|
32
32
|
if (t.contactResourceId)
|
|
33
|
-
console.log(
|
|
33
|
+
console.log(highlight(' Contact:'), t.contactResourceId);
|
|
34
34
|
}
|
|
35
35
|
const CASH_ENTRY_COLUMNS = [
|
|
36
36
|
{ key: 'resourceId', header: 'ID', format: formatId },
|
|
@@ -133,8 +133,8 @@ export function registerCashEntryCommand(program, config) {
|
|
|
133
133
|
}
|
|
134
134
|
else {
|
|
135
135
|
const status = opts.finalize ? 'finalized' : 'draft';
|
|
136
|
-
console.log(
|
|
137
|
-
console.log(
|
|
136
|
+
console.log(success(`${config.label} created (${status}): ${created.resourceId}`));
|
|
137
|
+
console.log(highlight('ID:'), created.resourceId);
|
|
138
138
|
}
|
|
139
139
|
}));
|
|
140
140
|
// ── update ────────────────────────────────────────────────────
|
|
@@ -180,7 +180,7 @@ export function registerCashEntryCommand(program, config) {
|
|
|
180
180
|
}
|
|
181
181
|
else {
|
|
182
182
|
const status = opts.finalize ? 'finalized' : 'draft';
|
|
183
|
-
console.log(
|
|
183
|
+
console.log(success(`${config.label} updated (${status}): ${updated.resourceId || resourceId}`));
|
|
184
184
|
}
|
|
185
185
|
})(opts));
|
|
186
186
|
// ── search ────────────────────────────────────────────────────
|
|
@@ -240,7 +240,7 @@ export function registerCashEntryCommand(program, config) {
|
|
|
240
240
|
console.log(JSON.stringify({ deleted: true, resourceId }));
|
|
241
241
|
}
|
|
242
242
|
else {
|
|
243
|
-
console.log(
|
|
243
|
+
console.log(success(`${config.label} ${resourceId} deleted.`));
|
|
244
244
|
}
|
|
245
245
|
})(opts));
|
|
246
246
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { success, highlight } from './ui/theme.js';
|
|
2
2
|
import { createCashTransfer, listCashTransfers, getCashTransfer } from '../core/api/cash-transfers.js';
|
|
3
3
|
import { searchCashflowTransactions, deleteCashEntry } from '../core/api/cashflow.js';
|
|
4
4
|
import { apiAction } from './api-action.js';
|
|
@@ -104,8 +104,8 @@ export function registerCashTransferCommand(program) {
|
|
|
104
104
|
}
|
|
105
105
|
else {
|
|
106
106
|
const status = opts.finalize ? 'finalized' : 'draft';
|
|
107
|
-
console.log(
|
|
108
|
-
console.log(
|
|
107
|
+
console.log(success(`Cash transfer created (${status}): ${created.resourceId}`));
|
|
108
|
+
console.log(highlight('ID:'), created.resourceId);
|
|
109
109
|
}
|
|
110
110
|
}));
|
|
111
111
|
// ── search ────────────────────────────────────────────────────
|
|
@@ -165,7 +165,7 @@ export function registerCashTransferCommand(program) {
|
|
|
165
165
|
console.log(JSON.stringify({ deleted: true, resourceId }));
|
|
166
166
|
}
|
|
167
167
|
else {
|
|
168
|
-
console.log(
|
|
168
|
+
console.log(success(`Cash transfer ${resourceId} deleted.`));
|
|
169
169
|
}
|
|
170
170
|
})(opts));
|
|
171
171
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { muted } from './ui/theme.js';
|
|
2
2
|
import { searchCashflowTransactions } from '../core/api/cashflow.js';
|
|
3
3
|
import { apiAction } from './api-action.js';
|
|
4
4
|
import { parsePositiveInt, parseNonNegativeInt } from './parsers.js';
|
|
@@ -13,7 +13,7 @@ const CASHFLOW_COLUMNS = [
|
|
|
13
13
|
{ key: 'valueDate', header: 'Date', format: formatEpochDate },
|
|
14
14
|
{ key: 'totalAmount', header: 'Amount', align: 'right' },
|
|
15
15
|
{ key: 'currencyCode', header: 'Ccy' },
|
|
16
|
-
{ key: 'businessTransactionType', header: 'Type', format: (v) =>
|
|
16
|
+
{ key: 'businessTransactionType', header: 'Type', format: (v) => muted(String(v ?? '')) },
|
|
17
17
|
];
|
|
18
18
|
export function registerCashflowCommand(program) {
|
|
19
19
|
const cf = program
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { accent, highlight, success } from './ui/theme.js';
|
|
2
2
|
import { listContactGroups, getContactGroup, searchContactGroups, createContactGroup, updateContactGroup, deleteContactGroup, } from '../core/api/contact-groups.js';
|
|
3
3
|
import { apiAction } from './api-action.js';
|
|
4
4
|
import { outputList } from './output.js';
|
|
@@ -39,11 +39,11 @@ export function registerContactGroupsCommand(program) {
|
|
|
39
39
|
return;
|
|
40
40
|
}
|
|
41
41
|
const g = res.data;
|
|
42
|
-
console.log(
|
|
43
|
-
console.log(
|
|
42
|
+
console.log(highlight('Name:'), g.name);
|
|
43
|
+
console.log(highlight('Contacts:'), g.associatedContacts?.length ?? 0);
|
|
44
44
|
for (const c of (g.associatedContacts ?? []))
|
|
45
|
-
console.log(` ${
|
|
46
|
-
console.log(
|
|
45
|
+
console.log(` ${accent(c.resourceId)} ${c.name}`);
|
|
46
|
+
console.log(highlight('ID:'), g.resourceId);
|
|
47
47
|
})(opts));
|
|
48
48
|
cmd
|
|
49
49
|
.command('search <query>')
|
|
@@ -71,8 +71,8 @@ export function registerContactGroupsCommand(program) {
|
|
|
71
71
|
console.log(JSON.stringify(res.data, null, 2));
|
|
72
72
|
return;
|
|
73
73
|
}
|
|
74
|
-
console.log(
|
|
75
|
-
console.log(
|
|
74
|
+
console.log(success(`Contact group "${opts.name}" created.`));
|
|
75
|
+
console.log(highlight('ID:'), res.data.resourceId);
|
|
76
76
|
}));
|
|
77
77
|
cmd
|
|
78
78
|
.command('update <resourceId>')
|
|
@@ -90,8 +90,8 @@ export function registerContactGroupsCommand(program) {
|
|
|
90
90
|
console.log(JSON.stringify(res.data, null, 2));
|
|
91
91
|
return;
|
|
92
92
|
}
|
|
93
|
-
console.log(
|
|
94
|
-
console.log(
|
|
93
|
+
console.log(success(`Contact group updated.`));
|
|
94
|
+
console.log(highlight('ID:'), res.data.resourceId);
|
|
95
95
|
})(opts));
|
|
96
96
|
cmd
|
|
97
97
|
.command('delete <resourceId>')
|
|
@@ -104,6 +104,6 @@ export function registerContactGroupsCommand(program) {
|
|
|
104
104
|
console.log(JSON.stringify({ deleted: true, resourceId }));
|
|
105
105
|
return;
|
|
106
106
|
}
|
|
107
|
-
console.log(
|
|
107
|
+
console.log(success(`Contact group ${resourceId} deleted.`));
|
|
108
108
|
})(opts));
|
|
109
109
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { success, accent, highlight } from './ui/theme.js';
|
|
2
2
|
import { listContacts, searchContacts, createContact, getContact, updateContact, deleteContact, } from '../core/api/contacts.js';
|
|
3
3
|
import { findExistingContact } from '../core/api/guards.js';
|
|
4
4
|
import { apiAction } from './api-action.js';
|
|
@@ -75,25 +75,25 @@ export function registerContactsCommand(program) {
|
|
|
75
75
|
console.log(JSON.stringify(c, null, 2));
|
|
76
76
|
}
|
|
77
77
|
else {
|
|
78
|
-
console.log(
|
|
78
|
+
console.log(highlight('Name:'), c.billingName);
|
|
79
79
|
if (c.name && c.name !== c.billingName) {
|
|
80
|
-
console.log(
|
|
80
|
+
console.log(highlight('Display Name:'), c.name);
|
|
81
81
|
}
|
|
82
|
-
console.log(
|
|
82
|
+
console.log(highlight('ID:'), c.resourceId);
|
|
83
83
|
if (c.emails?.length) {
|
|
84
|
-
console.log(
|
|
84
|
+
console.log(highlight('Email:'), c.emails.join(', '));
|
|
85
85
|
}
|
|
86
86
|
if (c.taxRegistrationNumber) {
|
|
87
|
-
console.log(
|
|
87
|
+
console.log(highlight('Tax Reg:'), c.taxRegistrationNumber);
|
|
88
88
|
}
|
|
89
89
|
const roles = [
|
|
90
90
|
c.customer && 'Customer',
|
|
91
91
|
c.supplier && 'Supplier',
|
|
92
92
|
].filter(Boolean).join(', ');
|
|
93
93
|
if (roles)
|
|
94
|
-
console.log(
|
|
94
|
+
console.log(highlight('Roles:'), roles);
|
|
95
95
|
if (c.status)
|
|
96
|
-
console.log(
|
|
96
|
+
console.log(highlight('Status:'), c.status);
|
|
97
97
|
}
|
|
98
98
|
})(opts));
|
|
99
99
|
// ── clio contacts create ────────────────────────────────────────
|
|
@@ -123,8 +123,8 @@ export function registerContactsCommand(program) {
|
|
|
123
123
|
console.log(JSON.stringify(existing, null, 2));
|
|
124
124
|
}
|
|
125
125
|
else {
|
|
126
|
-
console.log(
|
|
127
|
-
console.log(
|
|
126
|
+
console.log(accent(`Contact "${contactName}" already exists`));
|
|
127
|
+
console.log(highlight('ID:'), existing.resourceId);
|
|
128
128
|
}
|
|
129
129
|
return;
|
|
130
130
|
}
|
|
@@ -154,8 +154,8 @@ export function registerContactsCommand(program) {
|
|
|
154
154
|
console.log(JSON.stringify(res.data, null, 2));
|
|
155
155
|
}
|
|
156
156
|
else {
|
|
157
|
-
console.log(
|
|
158
|
-
console.log(
|
|
157
|
+
console.log(success(`Contact created: ${res.data.billingName}`));
|
|
158
|
+
console.log(highlight('ID:'), res.data.resourceId);
|
|
159
159
|
}
|
|
160
160
|
}));
|
|
161
161
|
// ── clio contacts update ────────────────────────────────────────
|
|
@@ -205,7 +205,7 @@ export function registerContactsCommand(program) {
|
|
|
205
205
|
console.log(JSON.stringify(res.data, null, 2));
|
|
206
206
|
}
|
|
207
207
|
else {
|
|
208
|
-
console.log(
|
|
208
|
+
console.log(success(`Contact updated: ${res.data.billingName}`));
|
|
209
209
|
}
|
|
210
210
|
})(opts));
|
|
211
211
|
// ── clio contacts delete ────────────────────────────────────────
|
|
@@ -221,7 +221,7 @@ export function registerContactsCommand(program) {
|
|
|
221
221
|
console.log(JSON.stringify({ deleted: true, resourceId }));
|
|
222
222
|
}
|
|
223
223
|
else {
|
|
224
|
-
console.log(
|
|
224
|
+
console.log(success(`Contact ${resourceId} deleted.`));
|
|
225
225
|
}
|
|
226
226
|
})(opts));
|
|
227
227
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { success } from './ui/theme.js';
|
|
2
2
|
import { listCurrencies, addCurrency } from '../core/api/currencies.js';
|
|
3
3
|
import { apiAction } from './api-action.js';
|
|
4
4
|
import { outputList } from './output.js';
|
|
@@ -40,7 +40,7 @@ export function registerCurrenciesCommand(program) {
|
|
|
40
40
|
outputList(result, CURRENCIES_COLUMNS, opts, 'Currencies'); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
41
41
|
}
|
|
42
42
|
else {
|
|
43
|
-
console.log(
|
|
43
|
+
console.log(success(`Added currencies: ${upperCodes.join(', ')}`));
|
|
44
44
|
}
|
|
45
45
|
})(opts));
|
|
46
46
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
1
|
import { listCurrencyRates, addCurrencyRate, updateCurrencyRate, startCurrencyRatesImportJob, getCurrencyRatesImportJobStatus, } from '../core/api/currencies.js';
|
|
3
2
|
import { apiAction } from './api-action.js';
|
|
4
3
|
import { outputList } from './output.js';
|
|
5
4
|
import { formatId } from './format-helpers.js';
|
|
5
|
+
import { highlight, muted, success } from './ui/theme.js';
|
|
6
6
|
import { parsePositiveInt, parseNonNegativeInt, requireFields } from './parsers.js';
|
|
7
7
|
import { paginatedFetch } from './pagination.js';
|
|
8
8
|
const RATES_COLUMNS = [
|
|
@@ -59,7 +59,7 @@ export function registerCurrencyRatesCommand(program) {
|
|
|
59
59
|
outputList(result, RATES_COLUMNS, opts, `${code} Rates`); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
60
60
|
}
|
|
61
61
|
else {
|
|
62
|
-
console.log(
|
|
62
|
+
console.log(success(`Rate added for ${code}: ${opts.rate} (from ${opts.from})`));
|
|
63
63
|
}
|
|
64
64
|
})(opts));
|
|
65
65
|
// ── clio currency-rates update ────────────────────────────────
|
|
@@ -90,7 +90,7 @@ export function registerCurrencyRatesCommand(program) {
|
|
|
90
90
|
outputList(result, RATES_COLUMNS, opts, `${code} Rates`); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
91
91
|
}
|
|
92
92
|
else {
|
|
93
|
-
console.log(
|
|
93
|
+
console.log(success(`Rate updated for ${code}: ${opts.rate}`));
|
|
94
94
|
}
|
|
95
95
|
})(opts));
|
|
96
96
|
// ── clio currency-rates import ──────────────────────────────
|
|
@@ -112,10 +112,10 @@ export function registerCurrencyRatesCommand(program) {
|
|
|
112
112
|
}
|
|
113
113
|
else {
|
|
114
114
|
const jobId = res.data.jobId;
|
|
115
|
-
console.log(
|
|
115
|
+
console.log(success(`Import job started for ${code}`));
|
|
116
116
|
if (jobId)
|
|
117
|
-
console.log(
|
|
118
|
-
console.log(
|
|
117
|
+
console.log(highlight('Job ID:'), jobId);
|
|
118
|
+
console.log(muted('Check status: clio currency-rates import-status ' + (jobId ?? '<jobId>')));
|
|
119
119
|
}
|
|
120
120
|
})(opts));
|
|
121
121
|
// ── clio currency-rates import-status ───────────────────────
|
|
@@ -132,9 +132,9 @@ export function registerCurrencyRatesCommand(program) {
|
|
|
132
132
|
}
|
|
133
133
|
else {
|
|
134
134
|
const d = res.data;
|
|
135
|
-
console.log(
|
|
135
|
+
console.log(highlight('Status:'), d.status ?? 'unknown');
|
|
136
136
|
if (d.message)
|
|
137
|
-
console.log(
|
|
137
|
+
console.log(highlight('Message:'), d.message);
|
|
138
138
|
}
|
|
139
139
|
})(opts));
|
|
140
140
|
}
|