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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { success, highlight } from './ui/theme.js';
|
|
2
2
|
import { listScheduledInvoices, listScheduledBills, listScheduledJournals, getScheduledInvoice, updateScheduledInvoice, deleteScheduledInvoice, getScheduledBill, updateScheduledBill, deleteScheduledBill, getScheduledJournal, updateScheduledJournal, deleteScheduledJournal, } from '../core/api/schedulers.js';
|
|
3
3
|
import { createScheduledInvoice } from '../core/api/invoices.js';
|
|
4
4
|
import { createScheduledBill } from '../core/api/bills.js';
|
|
@@ -130,7 +130,7 @@ Strings are replaced with values relative to the transaction date.`);
|
|
|
130
130
|
console.log(JSON.stringify(res.data, null, 2));
|
|
131
131
|
}
|
|
132
132
|
else {
|
|
133
|
-
console.log(
|
|
133
|
+
console.log(success('Scheduled invoice created'));
|
|
134
134
|
}
|
|
135
135
|
}));
|
|
136
136
|
// ── clio schedulers create-bill ───────────────────────────────
|
|
@@ -188,7 +188,7 @@ Strings are replaced with values relative to the transaction date.`);
|
|
|
188
188
|
console.log(JSON.stringify(res.data, null, 2));
|
|
189
189
|
}
|
|
190
190
|
else {
|
|
191
|
-
console.log(
|
|
191
|
+
console.log(success('Scheduled bill created'));
|
|
192
192
|
}
|
|
193
193
|
}));
|
|
194
194
|
// ── clio schedulers create-journal ────────────────────────────
|
|
@@ -236,7 +236,7 @@ Strings are replaced with values relative to the transaction date.`);
|
|
|
236
236
|
console.log(JSON.stringify(res.data, null, 2));
|
|
237
237
|
}
|
|
238
238
|
else {
|
|
239
|
-
console.log(
|
|
239
|
+
console.log(success('Scheduled journal created'));
|
|
240
240
|
}
|
|
241
241
|
}));
|
|
242
242
|
// ── clio schedulers get-invoice ─────────────────────────────────
|
|
@@ -252,12 +252,12 @@ Strings are replaced with values relative to the transaction date.`);
|
|
|
252
252
|
}
|
|
253
253
|
else {
|
|
254
254
|
const s = res.data;
|
|
255
|
-
console.log(
|
|
256
|
-
console.log(
|
|
257
|
-
console.log(
|
|
258
|
-
console.log(
|
|
255
|
+
console.log(highlight('ID:'), s.resourceId);
|
|
256
|
+
console.log(highlight('Status:'), s.status);
|
|
257
|
+
console.log(highlight('Repeat:'), s.interval ?? s.repeat);
|
|
258
|
+
console.log(highlight('Start:'), s.startDate);
|
|
259
259
|
if (s.endDate)
|
|
260
|
-
console.log(
|
|
260
|
+
console.log(highlight('End:'), s.endDate);
|
|
261
261
|
}
|
|
262
262
|
})(opts));
|
|
263
263
|
// ── clio schedulers update-invoice ──────────────────────────────
|
|
@@ -290,7 +290,7 @@ Strings are replaced with values relative to the transaction date.`);
|
|
|
290
290
|
console.log(JSON.stringify(res.data, null, 2));
|
|
291
291
|
}
|
|
292
292
|
else {
|
|
293
|
-
console.log(
|
|
293
|
+
console.log(success(`Scheduled invoice ${resourceId} updated.`));
|
|
294
294
|
}
|
|
295
295
|
})(opts));
|
|
296
296
|
// ── clio schedulers delete-invoice ──────────────────────────────
|
|
@@ -305,7 +305,7 @@ Strings are replaced with values relative to the transaction date.`);
|
|
|
305
305
|
console.log(JSON.stringify({ deleted: true, resourceId }));
|
|
306
306
|
}
|
|
307
307
|
else {
|
|
308
|
-
console.log(
|
|
308
|
+
console.log(success(`Scheduled invoice ${resourceId} deleted.`));
|
|
309
309
|
}
|
|
310
310
|
})(opts));
|
|
311
311
|
// ── clio schedulers get-bill ────────────────────────────────────
|
|
@@ -321,12 +321,12 @@ Strings are replaced with values relative to the transaction date.`);
|
|
|
321
321
|
}
|
|
322
322
|
else {
|
|
323
323
|
const s = res.data;
|
|
324
|
-
console.log(
|
|
325
|
-
console.log(
|
|
326
|
-
console.log(
|
|
327
|
-
console.log(
|
|
324
|
+
console.log(highlight('ID:'), s.resourceId);
|
|
325
|
+
console.log(highlight('Status:'), s.status);
|
|
326
|
+
console.log(highlight('Repeat:'), s.interval ?? s.repeat);
|
|
327
|
+
console.log(highlight('Start:'), s.startDate);
|
|
328
328
|
if (s.endDate)
|
|
329
|
-
console.log(
|
|
329
|
+
console.log(highlight('End:'), s.endDate);
|
|
330
330
|
}
|
|
331
331
|
})(opts));
|
|
332
332
|
// ── clio schedulers update-bill ─────────────────────────────────
|
|
@@ -359,7 +359,7 @@ Strings are replaced with values relative to the transaction date.`);
|
|
|
359
359
|
console.log(JSON.stringify(res.data, null, 2));
|
|
360
360
|
}
|
|
361
361
|
else {
|
|
362
|
-
console.log(
|
|
362
|
+
console.log(success(`Scheduled bill ${resourceId} updated.`));
|
|
363
363
|
}
|
|
364
364
|
})(opts));
|
|
365
365
|
// ── clio schedulers delete-bill ─────────────────────────────────
|
|
@@ -374,7 +374,7 @@ Strings are replaced with values relative to the transaction date.`);
|
|
|
374
374
|
console.log(JSON.stringify({ deleted: true, resourceId }));
|
|
375
375
|
}
|
|
376
376
|
else {
|
|
377
|
-
console.log(
|
|
377
|
+
console.log(success(`Scheduled bill ${resourceId} deleted.`));
|
|
378
378
|
}
|
|
379
379
|
})(opts));
|
|
380
380
|
// ── clio schedulers get-journal ─────────────────────────────────
|
|
@@ -390,12 +390,12 @@ Strings are replaced with values relative to the transaction date.`);
|
|
|
390
390
|
}
|
|
391
391
|
else {
|
|
392
392
|
const s = res.data;
|
|
393
|
-
console.log(
|
|
394
|
-
console.log(
|
|
395
|
-
console.log(
|
|
396
|
-
console.log(
|
|
393
|
+
console.log(highlight('ID:'), s.resourceId);
|
|
394
|
+
console.log(highlight('Status:'), s.status);
|
|
395
|
+
console.log(highlight('Repeat:'), s.interval ?? s.repeat);
|
|
396
|
+
console.log(highlight('Start:'), s.startDate);
|
|
397
397
|
if (s.endDate)
|
|
398
|
-
console.log(
|
|
398
|
+
console.log(highlight('End:'), s.endDate);
|
|
399
399
|
}
|
|
400
400
|
})(opts));
|
|
401
401
|
// ── clio schedulers update-journal ──────────────────────────────
|
|
@@ -428,7 +428,7 @@ Strings are replaced with values relative to the transaction date.`);
|
|
|
428
428
|
console.log(JSON.stringify(res.data, null, 2));
|
|
429
429
|
}
|
|
430
430
|
else {
|
|
431
|
-
console.log(
|
|
431
|
+
console.log(success(`Scheduled journal ${resourceId} updated.`));
|
|
432
432
|
}
|
|
433
433
|
})(opts));
|
|
434
434
|
// ── clio schedulers delete-journal ──────────────────────────────
|
|
@@ -443,7 +443,7 @@ Strings are replaced with values relative to the transaction date.`);
|
|
|
443
443
|
console.log(JSON.stringify({ deleted: true, resourceId }));
|
|
444
444
|
}
|
|
445
445
|
else {
|
|
446
|
-
console.log(
|
|
446
|
+
console.log(success(`Scheduled journal ${resourceId} deleted.`));
|
|
447
447
|
}
|
|
448
448
|
})(opts));
|
|
449
449
|
}
|
package/dist/commands/schema.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* `clio schema` — offline API schema introspection.
|
|
3
|
-
* No auth required — reads from compiled tool registry.
|
|
4
|
-
*
|
|
5
|
-
* Three levels:
|
|
6
|
-
* clio schema → list all groups with tool counts
|
|
7
|
-
* clio schema <group> → show tools in a group
|
|
8
|
-
* clio schema <group> <action> → show detailed params for a tool
|
|
9
|
-
*/
|
|
10
|
-
import chalk from 'chalk';
|
|
1
|
+
import { danger, success, accent, muted, highlight } from './ui/theme.js';
|
|
11
2
|
import { getAllTools, getToolsByGroup } from '../core/registry/lookup.js';
|
|
12
3
|
import { formatTable } from './table-formatter.js';
|
|
13
4
|
import { resolveFormat, outputRecord } from './output.js';
|
|
@@ -109,13 +100,13 @@ function outputGroupList(opts) {
|
|
|
109
100
|
outputRecord({ totalTools: all.length, totalGroups: groups.length, groups }, opts);
|
|
110
101
|
return;
|
|
111
102
|
}
|
|
112
|
-
console.log(
|
|
103
|
+
console.log(highlight(`Schema — ${all.length} tools across ${groups.length} groups\n`));
|
|
113
104
|
const columns = [
|
|
114
|
-
{ key: 'group', header: 'Group', format: (v) =>
|
|
105
|
+
{ key: 'group', header: 'Group', format: (v) => accent(String(v)) },
|
|
115
106
|
{ key: 'tools', header: 'Tools', align: 'right' },
|
|
116
107
|
{ key: 'read', header: 'Read', align: 'right' },
|
|
117
108
|
{ key: 'write', header: 'Write', align: 'right' },
|
|
118
|
-
{ key: 'cliCommand', header: 'CLI Command', format: (v) =>
|
|
109
|
+
{ key: 'cliCommand', header: 'CLI Command', format: (v) => muted(String(v)) },
|
|
119
110
|
];
|
|
120
111
|
console.log(formatTable(groups, columns));
|
|
121
112
|
}
|
|
@@ -139,7 +130,7 @@ function outputGroupDetail(group, tools, opts) {
|
|
|
139
130
|
}, opts);
|
|
140
131
|
return;
|
|
141
132
|
}
|
|
142
|
-
console.log(
|
|
133
|
+
console.log(highlight(`${group} — ${tools.length} tools (${readCount} read, ${writeCount} write)\n`));
|
|
143
134
|
const columns = [
|
|
144
135
|
{ key: 'name', header: 'Tool', format: formatId },
|
|
145
136
|
{ key: 'type', header: 'Type' },
|
|
@@ -153,7 +144,7 @@ function outputGroupDetail(group, tools, opts) {
|
|
|
153
144
|
description: t.description.length > 80 ? t.description.slice(0, 79) + '\u2026' : t.description,
|
|
154
145
|
}));
|
|
155
146
|
console.log(formatTable(rows, columns));
|
|
156
|
-
console.log(
|
|
147
|
+
console.log(muted(`\n Use: clio schema ${groupToCliCommand(group)} <action>`));
|
|
157
148
|
}
|
|
158
149
|
function outputToolDetail(tool, opts) {
|
|
159
150
|
const flat = flattenParams(tool.params, tool.required);
|
|
@@ -169,15 +160,15 @@ function outputToolDetail(tool, opts) {
|
|
|
169
160
|
}, opts);
|
|
170
161
|
return;
|
|
171
162
|
}
|
|
172
|
-
console.log(
|
|
163
|
+
console.log(highlight(`${tool.name}`) + muted(` — ${tool.description}\n`));
|
|
173
164
|
if (flat.length === 0) {
|
|
174
165
|
console.log(' No parameters.');
|
|
175
166
|
return;
|
|
176
167
|
}
|
|
177
168
|
const columns = [
|
|
178
|
-
{ key: 'name', header: 'Parameter', format: (v) =>
|
|
169
|
+
{ key: 'name', header: 'Parameter', format: (v) => accent(String(v)) },
|
|
179
170
|
{ key: 'type', header: 'Type' },
|
|
180
|
-
{ key: 'required', header: 'Required', format: (v) => (v === true || v === 'true') ?
|
|
171
|
+
{ key: 'required', header: 'Required', format: (v) => (v === true || v === 'true') ? success('Yes') : 'No' },
|
|
181
172
|
{ key: 'values', header: 'Values' },
|
|
182
173
|
{ key: 'description', header: 'Description' },
|
|
183
174
|
];
|
|
@@ -205,8 +196,8 @@ export function registerSchemaCommand(program) {
|
|
|
205
196
|
// Try as-is in case it's already correct
|
|
206
197
|
const directTools = getToolsByGroup(group);
|
|
207
198
|
if (directTools.length === 0) {
|
|
208
|
-
console.error(
|
|
209
|
-
console.error(
|
|
199
|
+
console.error(danger(`Unknown group: ${group}`));
|
|
200
|
+
console.error(muted('Run `clio schema` to see available groups.'));
|
|
210
201
|
process.exit(1);
|
|
211
202
|
}
|
|
212
203
|
// Level 2: show group tools
|
|
@@ -216,8 +207,8 @@ export function registerSchemaCommand(program) {
|
|
|
216
207
|
}
|
|
217
208
|
const tool = resolveToolName(group, action, directTools);
|
|
218
209
|
if (!tool) {
|
|
219
|
-
console.error(
|
|
220
|
-
console.error(
|
|
210
|
+
console.error(danger(`Unknown action: ${action} in group ${group}`));
|
|
211
|
+
console.error(muted(`Available: ${directTools.map((t) => t.name).join(', ')}`));
|
|
221
212
|
process.exit(1);
|
|
222
213
|
}
|
|
223
214
|
outputToolDetail(tool, opts);
|
|
@@ -231,8 +222,8 @@ export function registerSchemaCommand(program) {
|
|
|
231
222
|
// Level 3: show tool detail
|
|
232
223
|
const tool = resolveToolName(normalizedGroup, action, tools);
|
|
233
224
|
if (!tool) {
|
|
234
|
-
console.error(
|
|
235
|
-
console.error(
|
|
225
|
+
console.error(danger(`Unknown action: ${action} in group ${group}`));
|
|
226
|
+
console.error(muted(`Available: ${tools.map((t) => t.name).join(', ')}`));
|
|
236
227
|
process.exit(1);
|
|
237
228
|
}
|
|
238
229
|
outputToolDetail(tool, opts);
|
package/dist/commands/search.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { accent, highlight } from './ui/theme.js';
|
|
2
2
|
import { universalSearch } from '../core/api/search.js';
|
|
3
3
|
import { apiAction } from './api-action.js';
|
|
4
4
|
import { parsePositiveInt } from './parsers.js';
|
|
@@ -21,13 +21,13 @@ export function registerSearchCommand(program) {
|
|
|
21
21
|
console.log('No results found.');
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
24
|
-
console.log(
|
|
24
|
+
console.log(highlight(`Search results for "${query}":\n`));
|
|
25
25
|
for (const [category, items] of categories) {
|
|
26
|
-
console.log(
|
|
26
|
+
console.log(highlight(` ${category} (${items.length}):`));
|
|
27
27
|
for (const item of items.slice(0, 10)) {
|
|
28
28
|
const id = item.resource_id ?? item.resourceId ?? '';
|
|
29
29
|
const name = item.name ?? item.reference ?? item.billingName ?? '';
|
|
30
|
-
console.log(` ${
|
|
30
|
+
console.log(` ${accent(String(id))} ${name}`);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
})(opts));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { danger, success, muted, highlight } from './ui/theme.js';
|
|
2
2
|
import { listSubscriptions, getSubscription, createSubscription, updateSubscription, deleteSubscription, cancelSubscription, searchScheduledTransactions, } from '../core/api/subscriptions.js';
|
|
3
3
|
import { apiAction } from './api-action.js';
|
|
4
4
|
import { parsePositiveInt, parseNonNegativeInt, parseMoney, readBodyInput } from './parsers.js';
|
|
@@ -7,7 +7,7 @@ import { outputList } from './output.js';
|
|
|
7
7
|
import { formatId } from './format-helpers.js';
|
|
8
8
|
const SUBSCRIPTION_COLUMNS = [
|
|
9
9
|
{ key: 'resourceId', header: 'ID', format: formatId },
|
|
10
|
-
{ key: 'status', header: 'Status', format: (v) => String(v) === 'ACTIVE' ?
|
|
10
|
+
{ key: 'status', header: 'Status', format: (v) => String(v) === 'ACTIVE' ? success(String(v)) : muted(String(v)) },
|
|
11
11
|
{ key: 'interval', header: 'Interval' },
|
|
12
12
|
{ key: 'totalAmount', header: 'Amount', align: 'right' },
|
|
13
13
|
{ key: 'businessTransactionType', header: 'Type' },
|
|
@@ -15,7 +15,7 @@ const SUBSCRIPTION_COLUMNS = [
|
|
|
15
15
|
const SCHEDULED_TX_COLUMNS = [
|
|
16
16
|
{ key: 'resourceId', header: 'ID', format: formatId },
|
|
17
17
|
{ key: 'scheduledTransactionType', header: 'Type' },
|
|
18
|
-
{ key: 'status', header: 'Status', format: (v) =>
|
|
18
|
+
{ key: 'status', header: 'Status', format: (v) => muted(String(v ?? '')) },
|
|
19
19
|
];
|
|
20
20
|
export function registerSubscriptionsCommand(program) {
|
|
21
21
|
const cmd = program
|
|
@@ -48,11 +48,11 @@ export function registerSubscriptionsCommand(program) {
|
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
50
|
const s = res.data;
|
|
51
|
-
console.log(
|
|
52
|
-
console.log(
|
|
53
|
-
console.log(
|
|
54
|
-
console.log(
|
|
55
|
-
console.log(
|
|
51
|
+
console.log(highlight('Status:'), s.status);
|
|
52
|
+
console.log(highlight('Interval:'), s.interval);
|
|
53
|
+
console.log(highlight('Amount:'), s.totalAmount);
|
|
54
|
+
console.log(highlight('Next:'), s.nextScheduleDate ?? 'N/A');
|
|
55
|
+
console.log(highlight('ID:'), s.resourceId);
|
|
56
56
|
})(opts));
|
|
57
57
|
cmd
|
|
58
58
|
.command('create')
|
|
@@ -77,8 +77,8 @@ export function registerSubscriptionsCommand(program) {
|
|
|
77
77
|
let body = readBodyInput(opts);
|
|
78
78
|
if (!body) {
|
|
79
79
|
if (!opts.interval || !opts.startDate) {
|
|
80
|
-
console.error(
|
|
81
|
-
console.error(
|
|
80
|
+
console.error(danger('Required: --interval, --start-date'));
|
|
81
|
+
console.error(muted('Or use --input <file> to provide full JSON body.'));
|
|
82
82
|
process.exit(1);
|
|
83
83
|
}
|
|
84
84
|
// Build line items from --lines or --amount shorthand
|
|
@@ -88,7 +88,7 @@ export function registerSubscriptionsCommand(program) {
|
|
|
88
88
|
lineItems = JSON.parse(opts.lines);
|
|
89
89
|
}
|
|
90
90
|
catch {
|
|
91
|
-
console.error(
|
|
91
|
+
console.error(danger('Invalid --lines JSON'));
|
|
92
92
|
process.exit(1);
|
|
93
93
|
}
|
|
94
94
|
}
|
|
@@ -127,8 +127,8 @@ export function registerSubscriptionsCommand(program) {
|
|
|
127
127
|
console.log(JSON.stringify(res.data, null, 2));
|
|
128
128
|
return;
|
|
129
129
|
}
|
|
130
|
-
console.log(
|
|
131
|
-
console.log(
|
|
130
|
+
console.log(success('Subscription created.'));
|
|
131
|
+
console.log(highlight('ID:'), res.data.resourceId);
|
|
132
132
|
}));
|
|
133
133
|
cmd
|
|
134
134
|
.command('update <resourceId>')
|
|
@@ -140,7 +140,7 @@ export function registerSubscriptionsCommand(program) {
|
|
|
140
140
|
.action((resourceId, opts) => apiAction(async (client) => {
|
|
141
141
|
const body = readBodyInput(opts);
|
|
142
142
|
if (!body) {
|
|
143
|
-
console.error(
|
|
143
|
+
console.error(danger('Use --input <file> to provide update data.'));
|
|
144
144
|
process.exit(1);
|
|
145
145
|
}
|
|
146
146
|
const res = await updateSubscription(client, resourceId, body);
|
|
@@ -148,7 +148,7 @@ export function registerSubscriptionsCommand(program) {
|
|
|
148
148
|
console.log(JSON.stringify(res.data, null, 2));
|
|
149
149
|
return;
|
|
150
150
|
}
|
|
151
|
-
console.log(
|
|
151
|
+
console.log(success(`Subscription ${resourceId} updated.`));
|
|
152
152
|
})(opts));
|
|
153
153
|
cmd
|
|
154
154
|
.command('delete <resourceId>')
|
|
@@ -162,7 +162,7 @@ export function registerSubscriptionsCommand(program) {
|
|
|
162
162
|
console.log(JSON.stringify({ deleted: true, resourceId }));
|
|
163
163
|
return;
|
|
164
164
|
}
|
|
165
|
-
console.log(
|
|
165
|
+
console.log(success(`Subscription ${resourceId} deleted.`));
|
|
166
166
|
})(opts));
|
|
167
167
|
cmd
|
|
168
168
|
.command('cancel <resourceId>')
|
|
@@ -183,7 +183,7 @@ export function registerSubscriptionsCommand(program) {
|
|
|
183
183
|
console.log(JSON.stringify({ cancelled: true, resourceId }));
|
|
184
184
|
return;
|
|
185
185
|
}
|
|
186
|
-
console.log(
|
|
186
|
+
console.log(success(`Subscription ${resourceId} cancelled.`));
|
|
187
187
|
})(opts));
|
|
188
188
|
// ── clio subscriptions search-scheduled ───────────────────────
|
|
189
189
|
cmd
|
|
@@ -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 { buildCnFilter } from '../core/registry/index.js';
|
|
4
4
|
import { listSupplierCreditNotes, getSupplierCreditNote, searchSupplierCreditNotes, createSupplierCreditNote, updateSupplierCreditNote, deleteSupplierCreditNote, createSupplierCreditNoteRefund, listSupplierCreditNoteRefunds, finalizeSupplierCreditNote, } from '../core/api/supplier-cn.js';
|
|
@@ -48,14 +48,14 @@ export function registerSupplierCreditNotesCommand(program) {
|
|
|
48
48
|
console.log(JSON.stringify(cn, null, 2));
|
|
49
49
|
}
|
|
50
50
|
else {
|
|
51
|
-
console.log(
|
|
52
|
-
console.log(
|
|
53
|
-
console.log(
|
|
54
|
-
console.log(
|
|
51
|
+
console.log(highlight('Reference:'), cn.reference || '(none)');
|
|
52
|
+
console.log(highlight('ID:'), cn.resourceId);
|
|
53
|
+
console.log(highlight('Status:'), cn.status);
|
|
54
|
+
console.log(highlight('Date:'), normalizeDate(cn.valueDate));
|
|
55
55
|
if (cn.totalAmount !== undefined)
|
|
56
|
-
console.log(
|
|
56
|
+
console.log(highlight('Total:'), cn.totalAmount.toFixed(2));
|
|
57
57
|
if (cn.lineItems?.length) {
|
|
58
|
-
console.log(
|
|
58
|
+
console.log(highlight('Line Items:'));
|
|
59
59
|
for (const li of cn.lineItems) {
|
|
60
60
|
const qty = li.quantity ?? 1;
|
|
61
61
|
const price = li.unitPrice ?? 0;
|
|
@@ -63,7 +63,7 @@ export function registerSupplierCreditNotesCommand(program) {
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
if (cn.notes)
|
|
66
|
-
console.log(
|
|
66
|
+
console.log(highlight('Notes:'), cn.notes);
|
|
67
67
|
}
|
|
68
68
|
})(opts));
|
|
69
69
|
// ── clio supplier-credit-notes search ─────────────────────────
|
|
@@ -153,8 +153,8 @@ export function registerSupplierCreditNotesCommand(program) {
|
|
|
153
153
|
}
|
|
154
154
|
else {
|
|
155
155
|
const status = opts.finalize ? 'finalized' : 'draft';
|
|
156
|
-
console.log(
|
|
157
|
-
console.log(
|
|
156
|
+
console.log(success(`Supplier credit note created (${status}): ${res.data.reference || res.data.resourceId}`));
|
|
157
|
+
console.log(highlight('ID:'), res.data.resourceId);
|
|
158
158
|
}
|
|
159
159
|
}));
|
|
160
160
|
// ── clio supplier-credit-notes update ─────────────────────────
|
|
@@ -196,7 +196,7 @@ export function registerSupplierCreditNotesCommand(program) {
|
|
|
196
196
|
console.log(JSON.stringify(res.data, null, 2));
|
|
197
197
|
}
|
|
198
198
|
else {
|
|
199
|
-
console.log(
|
|
199
|
+
console.log(success(`Supplier credit note updated: ${res.data.reference || res.data.resourceId}`));
|
|
200
200
|
}
|
|
201
201
|
})(opts));
|
|
202
202
|
// ── clio supplier-credit-notes delete ─────────────────────────
|
|
@@ -211,7 +211,7 @@ export function registerSupplierCreditNotesCommand(program) {
|
|
|
211
211
|
console.log(JSON.stringify({ deleted: true, resourceId }));
|
|
212
212
|
}
|
|
213
213
|
else {
|
|
214
|
-
console.log(
|
|
214
|
+
console.log(success(`Supplier credit note ${resourceId} deleted.`));
|
|
215
215
|
}
|
|
216
216
|
})(opts));
|
|
217
217
|
// ── clio supplier-credit-notes refund ───────────────────────
|
|
@@ -264,7 +264,7 @@ export function registerSupplierCreditNotesCommand(program) {
|
|
|
264
264
|
console.log(JSON.stringify(res.data, null, 2));
|
|
265
265
|
}
|
|
266
266
|
else {
|
|
267
|
-
console.log(
|
|
267
|
+
console.log(success(`Refund recorded for supplier credit note ${resourceId}`));
|
|
268
268
|
}
|
|
269
269
|
})(opts));
|
|
270
270
|
// ── clio supplier-credit-notes refunds ──────────────────────
|
|
@@ -284,9 +284,9 @@ export function registerSupplierCreditNotesCommand(program) {
|
|
|
284
284
|
console.log('No refunds found.');
|
|
285
285
|
return;
|
|
286
286
|
}
|
|
287
|
-
console.log(
|
|
287
|
+
console.log(highlight(`Refunds (${refunds.length}):\n`));
|
|
288
288
|
for (const r of refunds) {
|
|
289
|
-
console.log(` ${
|
|
289
|
+
console.log(` ${accent(r.resourceId)} ${r.reference || '(no ref)'} ${r.status} ${r.refundAmount} ${normalizeDate(r.valueDate)}`);
|
|
290
290
|
}
|
|
291
291
|
}
|
|
292
292
|
})(opts));
|
|
@@ -363,7 +363,7 @@ export function registerSupplierCreditNotesCommand(program) {
|
|
|
363
363
|
console.log(JSON.stringify({ finalized: false, error: msg }));
|
|
364
364
|
}
|
|
365
365
|
else {
|
|
366
|
-
console.error(
|
|
366
|
+
console.error(danger(msg));
|
|
367
367
|
}
|
|
368
368
|
process.exit(1);
|
|
369
369
|
}
|
|
@@ -425,13 +425,13 @@ export function registerSupplierCreditNotesCommand(program) {
|
|
|
425
425
|
}
|
|
426
426
|
else {
|
|
427
427
|
if (ready) {
|
|
428
|
-
console.log(
|
|
428
|
+
console.log(success(`✓ ${merged.reference || resourceId} is ready to finalize.`));
|
|
429
429
|
}
|
|
430
430
|
else {
|
|
431
|
-
console.error(
|
|
431
|
+
console.error(warning(`✗ ${merged.reference || resourceId} — ${missingCount} issue${missingCount > 1 ? 's' : ''} remaining:`));
|
|
432
432
|
for (const f of missingFields) {
|
|
433
433
|
const spec = CREDIT_NOTE_REQUIRED_FIELDS.find((s) => f === s.field || f.endsWith(`.${s.field}`));
|
|
434
|
-
console.log(` ${f}: ${
|
|
434
|
+
console.log(` ${f}: ${danger('MISSING')} — ${spec?.hint ?? ''}`);
|
|
435
435
|
}
|
|
436
436
|
}
|
|
437
437
|
}
|
|
@@ -444,12 +444,12 @@ export function registerSupplierCreditNotesCommand(program) {
|
|
|
444
444
|
console.log(JSON.stringify({ finalized: false, resourceId, reference: merged.reference || null, ready: false, missingCount, missingFields, validation }, null, 2));
|
|
445
445
|
}
|
|
446
446
|
else {
|
|
447
|
-
console.error(
|
|
447
|
+
console.error(danger(`\n✗ Cannot finalize ${merged.reference || resourceId} — ${missingCount} issue${missingCount > 1 ? 's' : ''} remaining:\n`));
|
|
448
448
|
for (const f of missingFields) {
|
|
449
449
|
const spec = CREDIT_NOTE_REQUIRED_FIELDS.find((s) => f === s.field || f.endsWith(`.${s.field}`));
|
|
450
|
-
console.error(` ${f}: ${
|
|
450
|
+
console.error(` ${f}: ${danger('MISSING')} — ${spec?.hint ?? ''}`);
|
|
451
451
|
}
|
|
452
|
-
console.error(
|
|
452
|
+
console.error(muted(`\n Fix the issues and retry:\n clio supplier-credit-notes draft finalize ${resourceId} ...\n`));
|
|
453
453
|
}
|
|
454
454
|
process.exit(1);
|
|
455
455
|
}
|
|
@@ -463,10 +463,10 @@ export function registerSupplierCreditNotesCommand(program) {
|
|
|
463
463
|
console.log(JSON.stringify({ finalized: true, resourceId: updated.resourceId, reference: updated.reference || null, status: updated.status, fieldsUpdated }, null, 2));
|
|
464
464
|
}
|
|
465
465
|
else {
|
|
466
|
-
console.log(
|
|
467
|
-
console.log(
|
|
466
|
+
console.log(success(`\n✓ Supplier credit note finalized: ${updated.reference || updated.resourceId}`));
|
|
467
|
+
console.log(highlight(' Status:'), updated.status);
|
|
468
468
|
if (fieldsUpdated.length > 0) {
|
|
469
|
-
console.log(
|
|
469
|
+
console.log(highlight(' Updated:'), fieldsUpdated.join(', '));
|
|
470
470
|
}
|
|
471
471
|
}
|
|
472
472
|
})(opts));
|
|
@@ -489,11 +489,11 @@ export function registerSupplierCreditNotesCommand(program) {
|
|
|
489
489
|
console.log(`No attachments for supplier credit note ${cn.reference || resourceId}.`);
|
|
490
490
|
return;
|
|
491
491
|
}
|
|
492
|
-
console.log(
|
|
492
|
+
console.log(highlight(`Attachments for ${cn.reference || resourceId}:\n`));
|
|
493
493
|
for (const att of attachments) {
|
|
494
|
-
console.log(` ${
|
|
494
|
+
console.log(` ${accent(att.resourceId)} ${att.fileName || '(unnamed)'}`);
|
|
495
495
|
if (att.fileUrl)
|
|
496
|
-
console.log(` ${
|
|
496
|
+
console.log(` ${muted(att.fileUrl)}`);
|
|
497
497
|
}
|
|
498
498
|
}
|
|
499
499
|
})(opts));
|
package/dist/commands/tags.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { highlight, success, warning } from './ui/theme.js';
|
|
2
2
|
import { listTags, getTag, searchTags, createTag, updateTag, deleteTag, } from '../core/api/tags.js';
|
|
3
3
|
import { findExistingTag } from '../core/api/guards.js';
|
|
4
4
|
import { apiAction } from './api-action.js';
|
|
@@ -43,8 +43,8 @@ export function registerTagsCommand(program) {
|
|
|
43
43
|
console.log(JSON.stringify(tag, null, 2));
|
|
44
44
|
}
|
|
45
45
|
else {
|
|
46
|
-
console.log(
|
|
47
|
-
console.log(
|
|
46
|
+
console.log(highlight('Name:'), tag.name);
|
|
47
|
+
console.log(highlight('ID:'), tag.resourceId);
|
|
48
48
|
}
|
|
49
49
|
})(opts));
|
|
50
50
|
// ── clio tags search ──────────────────────────────────────────
|
|
@@ -89,8 +89,8 @@ export function registerTagsCommand(program) {
|
|
|
89
89
|
console.log(JSON.stringify(existing, null, 2));
|
|
90
90
|
}
|
|
91
91
|
else {
|
|
92
|
-
console.log(
|
|
93
|
-
console.log(
|
|
92
|
+
console.log(warning(`Tag "${tagName}" already exists — reusing.`));
|
|
93
|
+
console.log(highlight('ID:'), existing.resourceId);
|
|
94
94
|
}
|
|
95
95
|
return;
|
|
96
96
|
}
|
|
@@ -100,8 +100,8 @@ export function registerTagsCommand(program) {
|
|
|
100
100
|
console.log(JSON.stringify(res.data, null, 2));
|
|
101
101
|
}
|
|
102
102
|
else {
|
|
103
|
-
console.log(
|
|
104
|
-
console.log(
|
|
103
|
+
console.log(success(`Tag created: ${tagName}`));
|
|
104
|
+
console.log(highlight('ID:'), res.data.resourceId);
|
|
105
105
|
}
|
|
106
106
|
}));
|
|
107
107
|
// ── clio tags update ─────────────────────────────────────────
|
|
@@ -119,8 +119,8 @@ export function registerTagsCommand(program) {
|
|
|
119
119
|
console.log(JSON.stringify(res.data, null, 2));
|
|
120
120
|
}
|
|
121
121
|
else {
|
|
122
|
-
console.log(
|
|
123
|
-
console.log(
|
|
122
|
+
console.log(success(`Tag renamed to "${opts.name}".`));
|
|
123
|
+
console.log(highlight('ID:'), res.data.resourceId);
|
|
124
124
|
}
|
|
125
125
|
})(opts));
|
|
126
126
|
// ── clio tags delete ──────────────────────────────────────────
|
|
@@ -136,7 +136,7 @@ export function registerTagsCommand(program) {
|
|
|
136
136
|
console.log(JSON.stringify({ deleted: true, resourceId }));
|
|
137
137
|
}
|
|
138
138
|
else {
|
|
139
|
-
console.log(
|
|
139
|
+
console.log(success(`Tag ${resourceId} deleted.`));
|
|
140
140
|
}
|
|
141
141
|
})(opts));
|
|
142
142
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { accent, highlight, muted, success, warning } from './ui/theme.js';
|
|
2
2
|
import { listTaxProfiles, listTaxTypes, createTaxProfile, getTaxProfile, searchTaxProfiles, updateTaxProfile, listWithholdingTaxCodes, } from '../core/api/tax-profiles.js';
|
|
3
3
|
import { findExistingTaxProfile } from '../core/api/guards.js';
|
|
4
4
|
import { apiAction } from './api-action.js';
|
|
@@ -63,10 +63,10 @@ export function registerTaxProfilesCommand(program) {
|
|
|
63
63
|
console.log(JSON.stringify(p, null, 2));
|
|
64
64
|
}
|
|
65
65
|
else {
|
|
66
|
-
console.log(
|
|
67
|
-
console.log(
|
|
68
|
-
console.log(
|
|
69
|
-
console.log(
|
|
66
|
+
console.log(highlight('Name:'), p.name);
|
|
67
|
+
console.log(highlight('ID:'), p.resourceId);
|
|
68
|
+
console.log(highlight('Rate:'), `${p.taxRate}%`);
|
|
69
|
+
console.log(highlight('Tax Type:'), p.taxTypeCode);
|
|
70
70
|
}
|
|
71
71
|
})(opts));
|
|
72
72
|
// ── clio tax-profiles search ────────────────────────────────
|
|
@@ -120,7 +120,7 @@ export function registerTaxProfilesCommand(program) {
|
|
|
120
120
|
console.log(JSON.stringify(res.data, null, 2));
|
|
121
121
|
}
|
|
122
122
|
else {
|
|
123
|
-
console.log(
|
|
123
|
+
console.log(success(`Tax profile updated: ${res.data.name}`));
|
|
124
124
|
}
|
|
125
125
|
})(opts));
|
|
126
126
|
// ── clio tax-profiles wht-codes ─────────────────────────────
|
|
@@ -139,9 +139,9 @@ export function registerTaxProfilesCommand(program) {
|
|
|
139
139
|
console.log('No withholding tax codes found.');
|
|
140
140
|
return;
|
|
141
141
|
}
|
|
142
|
-
console.log(
|
|
142
|
+
console.log(highlight(`Withholding Tax Codes (${res.data.length}):\n`));
|
|
143
143
|
for (const c of res.data) {
|
|
144
|
-
console.log(` ${
|
|
144
|
+
console.log(` ${accent(c.code ?? c.resourceId ?? '?')} ${c.description ?? ''} ${muted(c.countryCode ?? '')}`);
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
}));
|
|
@@ -167,7 +167,7 @@ export function registerTaxProfilesCommand(program) {
|
|
|
167
167
|
console.log(JSON.stringify({ _guard: 'duplicate_skipped', existing }, null, 2));
|
|
168
168
|
}
|
|
169
169
|
else {
|
|
170
|
-
console.log(
|
|
170
|
+
console.log(warning(`Tax profile "${opts.name}" already exists (${existing.resourceId}).`));
|
|
171
171
|
}
|
|
172
172
|
return;
|
|
173
173
|
}
|
|
@@ -180,8 +180,8 @@ export function registerTaxProfilesCommand(program) {
|
|
|
180
180
|
console.log(JSON.stringify(res.data, null, 2));
|
|
181
181
|
}
|
|
182
182
|
else {
|
|
183
|
-
console.log(
|
|
184
|
-
console.log(
|
|
183
|
+
console.log(success(`Tax profile created: ${opts.name} (${opts.rate}%)`));
|
|
184
|
+
console.log(highlight('ID:'), res.data.resourceId);
|
|
185
185
|
}
|
|
186
186
|
}));
|
|
187
187
|
}
|
|
@@ -5,3 +5,4 @@ export { formatApiError, formatAuthError, formatGenericError, formatWarning } fr
|
|
|
5
5
|
export { renderOrgBanner } from './banner.js';
|
|
6
6
|
export { createProgress } from './progress.js';
|
|
7
7
|
export { formatRecord } from './record.js';
|
|
8
|
+
export { showPicker, isCancel } from './picker.js';
|