jaz-clio 4.18.0 → 4.18.1
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 +2 -2
- package/assets/skills/api/references/endpoints.md +4 -2
- package/assets/skills/api/references/errors.md +1 -1
- package/assets/skills/api/references/field-map.md +2 -2
- package/assets/skills/api/references/full-api-surface.md +3 -1
- package/assets/skills/api/references/search-reference.md +1 -1
- package/assets/skills/conversion/SKILL.md +1 -1
- package/assets/skills/jobs/SKILL.md +1 -1
- package/assets/skills/jobs/references/sg-tax/data-extraction.md +2 -1
- package/assets/skills/transaction-recipes/SKILL.md +1 -1
- package/dist/commands/accounts.js +2 -2
- package/dist/commands/bills.js +2 -2
- package/dist/commands/bookmarks.js +1 -1
- package/dist/commands/capsules.js +2 -2
- package/dist/commands/cash-entry.js +2 -2
- package/dist/commands/cash-transfer.js +2 -2
- package/dist/commands/cashflow.js +1 -1
- package/dist/commands/contacts.js +2 -2
- package/dist/commands/currency-rates.js +1 -1
- package/dist/commands/customer-credit-notes.js +2 -2
- package/dist/commands/invoices.js +2 -2
- package/dist/commands/items.js +2 -2
- package/dist/commands/journals.js +2 -2
- package/dist/commands/org-users.js +2 -2
- package/dist/commands/payments.js +2 -2
- package/dist/commands/schedulers.js +3 -3
- package/dist/commands/supplier-credit-notes.js +2 -2
- package/dist/commands/tags.js +2 -2
- package/dist/commands/tax-profiles.js +2 -2
- package/dist/core/api/client.js +7 -5
- package/dist/core/api/pagination.js +12 -9
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: jaz-api
|
|
3
|
-
version: 4.18.
|
|
3
|
+
version: 4.18.1
|
|
4
4
|
description: Complete reference for the Jaz REST API — the accounting platform backend. Use this skill whenever building, modifying, debugging, or extending any code that calls the API — including API clients, integrations, data seeding, test data, or new endpoint work. Contains every field name, response shape, error, gotcha, and edge case discovered through live production testing.
|
|
5
5
|
license: MIT
|
|
6
6
|
compatibility: Requires Jaz API key (x-jk-api-key header). Works with Claude Code, Google Antigravity, OpenAI Codex, GitHub Copilot, Cursor, and any agent that reads markdown.
|
|
@@ -121,7 +121,7 @@ You are working with the **Jaz REST API** — the accounting platform backend. A
|
|
|
121
121
|
49. **Currency rate direction: `rate` = functionalToSource (1 base = X foreign)** — POST `rate: 0.74` for a SGD org means 1 SGD = 0.74 USD. **If your data stores rates as "1 USD = 1.35 SGD" (sourceToFunctional), you MUST invert: `rate = 1 / 1.35 = 0.74`.** GET confirms both: `rateFunctionalToSource` (what you POSTed) and `rateSourceToFunctional` (the inverse).
|
|
122
122
|
|
|
123
123
|
### Search & Filter
|
|
124
|
-
50. **Search endpoint universal pattern** — All 28 `POST /*/search` endpoints share identical structure: `{ filter?, sort: { sortBy: ["field"], order: "ASC"|"DESC" }, limit: 1-1000, offset: 0-65536 }`. Sort is REQUIRED when offset is present (even `offset: 0`). Default limit: 100. `sortBy` is always an array on all endpoints (no exceptions). See `references/search-reference.md` for per-endpoint filter/sort fields.
|
|
124
|
+
50. **Search endpoint universal pattern** — All 28 `POST /*/search` endpoints share identical structure: `{ filter?, sort: { sortBy: ["field"], order: "ASC"|"DESC" }, limit: 1-1000, offset: 0-65536 }`. **`offset` is a page number (0-indexed), NOT row-skip.** `offset=0` = first page, `offset=1` = second page. Sort is REQUIRED when offset is present (even `offset: 0`). Default limit: 100. `sortBy` is always an array on all endpoints (no exceptions). See `references/search-reference.md` for per-endpoint filter/sort fields.
|
|
125
125
|
51. **Filter operator reference** — String: `eq`, `neq`, `contains`, `in` (array, max 100), `likeIn` (array, max 100), `reg` (regex array, max 100), `isNull` (bool). Numeric: `eq`, `gt`, `gte`, `lt`, `lte`, `in`. Date (YYYY-MM-DD): `eq`, `gt`, `gte`, `lt`, `lte`, `between` (exactly 2 values). DateTime (RFC3339): same operators, converted to epoch ms internally. Boolean: `eq`. JSON: `jsonIn`, `jsonNotIn`. Logical: nest with `and`/`or`/`not` objects, or use `andGroup`/`orGroup` arrays (invoices, bills, journals, credit notes).
|
|
126
126
|
52. **Date format asymmetry (CRITICAL)** — Request dates: `YYYY-MM-DD` strings (all create/update and DateExpression filters). Request datetimes: RFC3339 strings (DateTimeExpression filters for `createdAt`, `updatedAt`, `approvedAt`, `submittedAt`). **ALL response dates**: `int64` epoch milliseconds — including `valueDate`, `createdAt`, `updatedAt`, `approvedAt`, `submittedAt`, `matchDate`. Convert: `new Date(epochMs).toISOString().slice(0,10)`. **Timezone convention**: ALL business dates (`valueDate`, `dueDate`, `startDate`, `endDate`, etc.) are in the **organization's timezone** — never UTC. The epoch ms stored in the DB represents the org-local date (no timezone conversion is ever needed). Only audit timestamps (`createdAt`, `updatedAt`, `action_at`) are UTC.
|
|
127
127
|
53. **Field aliases on create endpoints** — Middleware transparently maps: `issueDate`/`date` → `valueDate` (invoices, bills, credit notes, journals). `name` → `tagName` (tags) or `internalName` (items). `paymentDate` → `valueDate`, `bankAccountResourceId` → `accountResourceId` (payments). `paymentAmount` → `refundAmount`, `paymentMethod` → `refundMethod` (credit note refunds). `accountType` → `classificationType`, `currencyCode` → `currency` (CoA). Canonical names always work; aliases are convenience only.
|
|
@@ -32,12 +32,14 @@ Content-Type: application/json
|
|
|
32
32
|
|
|
33
33
|
All GET list endpoints and POST `/search` endpoints use **`limit`/`offset` pagination** — NOT `page`/`size`.
|
|
34
34
|
|
|
35
|
+
**IMPORTANT: `offset` is a page number (0-indexed), NOT a row-skip count.** `offset=0` returns the first page, `offset=1` returns the second page, etc. Example: `offset=2, limit=50` returns items 100–149.
|
|
36
|
+
|
|
35
37
|
| Property | Value |
|
|
36
38
|
|----------|-------|
|
|
37
39
|
| **GET list endpoints** | `?limit=100&offset=0` (query params) |
|
|
38
40
|
| **POST /search endpoints** | `{ "limit": 100, "offset": 0 }` (JSON body) |
|
|
39
41
|
| **Default limit** | 100 (if omitted) |
|
|
40
|
-
| **Default offset** | 0 (
|
|
42
|
+
| **Default offset** | 0 (first page) |
|
|
41
43
|
| **Max limit** | 1000 |
|
|
42
44
|
| **Min limit** | 1 |
|
|
43
45
|
| **Max offset** | 65536 |
|
|
@@ -1452,7 +1454,7 @@ POST /api/v1/invoices/search
|
|
|
1452
1454
|
|
|
1453
1455
|
### Pagination
|
|
1454
1456
|
- `limit`: max 1000 per page (default 100)
|
|
1455
|
-
- `offset`:
|
|
1457
|
+
- `offset`: page number, 0-indexed (max 65536)
|
|
1456
1458
|
- `sort`: **REQUIRED when `offset` is present** (even `offset: 0`)
|
|
1457
1459
|
- Response includes `totalElements` and `totalPages`
|
|
1458
1460
|
|
|
@@ -713,7 +713,7 @@ Journals support a top-level `currency` object to create entries in a foreign cu
|
|
|
713
713
|
|
|
714
714
|
### "limit must be 1000 or less" (422)
|
|
715
715
|
**Cause**: Sending `?limit=1001` or higher on a GET endpoint.
|
|
716
|
-
**Fix**: Maximum limit is 1000. To fetch all records, paginate with `limit=1000&offset=0`, then `limit=1000&offset=
|
|
716
|
+
**Fix**: Maximum limit is 1000. To fetch all records, paginate with `limit=1000&offset=0`, then `limit=1000&offset=1` (offset is a page number, not row-skip), etc.
|
|
717
717
|
|
|
718
718
|
### "offset must be 65536 or less" (422)
|
|
719
719
|
**Cause**: Offset exceeds maximum.
|
|
@@ -469,9 +469,9 @@ DELETE → expects "A" (parentEntityResourceId, via /cashflow-journals/:id)
|
|
|
469
469
|
| `size` | NOT SUPPORTED | Silently ignored — use `limit`/`offset` |
|
|
470
470
|
| `pageSize` | NOT SUPPORTED | Use `limit` |
|
|
471
471
|
| `per_page` | NOT SUPPORTED | Use `limit` |
|
|
472
|
-
| `page_number` |
|
|
472
|
+
| `page_number` | `offset` | **offset IS the page number (0-indexed)**, not a row-skip count. `offset=0` = page 1, `offset=1` = page 2. |
|
|
473
473
|
| (default page size) | `limit` (default: 100) | Query param for GET, JSON body for POST /search |
|
|
474
|
-
| (
|
|
474
|
+
| (page number) | `offset` (default: 0) | 0-indexed page number. `offset=2, limit=50` returns items 100–149. |
|
|
475
475
|
|
|
476
476
|
**GET list endpoints**: `?limit=100&offset=0` (query params)
|
|
477
477
|
**POST /search endpoints**: `{ "limit": 100, "offset": 0 }` (JSON body)
|
|
@@ -589,10 +589,12 @@ All 28 `POST /*/search` endpoints accept this filter structure in the POST body:
|
|
|
589
589
|
|
|
590
590
|
All list/search endpoints use `limit`/`offset` — NOT `page`/`size`. This applies to both GET (query params) and POST /search (JSON body).
|
|
591
591
|
|
|
592
|
+
**IMPORTANT: `offset` is a page number (0-indexed), NOT a row-skip count.** `offset=0` = first page, `offset=1` = second page. Example: `offset=2, limit=50` returns items 100–149.
|
|
593
|
+
|
|
592
594
|
| Property | Value |
|
|
593
595
|
|----------|-------|
|
|
594
596
|
| Default limit | 100 |
|
|
595
|
-
| Default offset | 0 |
|
|
597
|
+
| Default offset | 0 (first page) |
|
|
596
598
|
| Min limit | 1 |
|
|
597
599
|
| Max limit | 1000 |
|
|
598
600
|
| Max offset | 65536 |
|
|
@@ -24,7 +24,7 @@ All search endpoints share this identical structure:
|
|
|
24
24
|
| `filter` | object | No | Per-endpoint fields (see tables below) |
|
|
25
25
|
| `sort` | object | **Yes if `offset` is present** | `sortBy`: array of field names; `order`: `"ASC"` or `"DESC"` |
|
|
26
26
|
| `limit` | int | No | Default: 100, min: 1, max: 1000 |
|
|
27
|
-
| `offset` | int | No | Default: 0, min: 0, max: 65536 |
|
|
27
|
+
| `offset` | int | No | **Page number** (0-indexed, not row-skip). Default: 0, min: 0, max: 65536 |
|
|
28
28
|
|
|
29
29
|
**Response shape**: `{ totalElements, totalPages, data: [...] }` — all search/list endpoints return this flat structure directly (no outer `data` wrapper).
|
|
30
30
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: jaz-conversion
|
|
3
|
-
version: 4.18.
|
|
3
|
+
version: 4.18.1
|
|
4
4
|
description: Accounting data conversion skill — migrates customer data from Xero, QuickBooks, Sage, MYOB, and Excel exports to Jaz. Covers config, quick, and full conversion workflows, Excel parsing, CoA/contact/tax/items mapping, clearing accounts, TTB, and TB verification.
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: jaz-jobs
|
|
3
|
-
version: 4.18.
|
|
3
|
+
version: 4.18.1
|
|
4
4
|
description: 12 accounting jobs for SMB bookkeepers and accountants — month-end, quarter-end, and year-end close playbooks plus 9 ad-hoc operational jobs (bank recon, document collection, GST/VAT filing, payment runs, credit control, supplier recon, audit prep, fixed asset review, statutory filing). Jobs can have paired tools as nested subcommands (e.g., `clio jobs bank-recon match`, `clio jobs document-collection ingest`, `clio jobs statutory-filing sg-cs`). Paired with an interactive CLI blueprint generator (clio jobs).
|
|
5
5
|
license: MIT
|
|
6
6
|
compatibility: Works with Claude Code, Claude Cowork, Claude.ai, and any agent that reads markdown. For API payloads, load the jaz-api skill. For individual transaction patterns, load the jaz-recipes skill.
|
|
@@ -294,7 +294,8 @@ All search endpoints support pagination. The standard pattern:
|
|
|
294
294
|
```
|
|
295
295
|
|
|
296
296
|
**Check the response metadata:**
|
|
297
|
-
-
|
|
297
|
+
- `offset` is a **page number** (0-indexed), NOT a row-skip count. Increment `offset` by 1 for each subsequent page.
|
|
298
|
+
- Example: `offset=0` returns items 0–999, `offset=1` returns items 1000–1999, etc.
|
|
298
299
|
- Always aggregate totals across all pages before mapping to input fields
|
|
299
300
|
- Do not assume a single page contains all results
|
|
300
301
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: jaz-recipes
|
|
3
|
-
version: 4.18.
|
|
3
|
+
version: 4.18.1
|
|
4
4
|
description: 16 IFRS-compliant recipes for complex multi-step accounting in Jaz — prepaid amortization, deferred revenue, loan schedules, IFRS 16 leases, hire purchase, fixed deposits, asset disposal, FX revaluation, ECL provisioning, IAS 37 provisions, dividends, intercompany, and capital WIP. Each recipe includes journal entries, capsule structure, and verification steps. Paired with 13 financial calculators that produce execution-ready blueprints with workings.
|
|
5
5
|
license: MIT
|
|
6
6
|
compatibility: Works with Claude Code, Claude Cowork, Claude.ai, and any agent that reads markdown. For API payloads, load the jaz-api skill alongside this one.
|
|
@@ -12,7 +12,7 @@ export function registerAccountsCommand(program) {
|
|
|
12
12
|
.command('list')
|
|
13
13
|
.description('List accounts')
|
|
14
14
|
.option('--limit <n>', 'Max results (default 100)', parsePositiveInt)
|
|
15
|
-
.option('--offset <n>', '
|
|
15
|
+
.option('--offset <n>', 'Page number offset (0-indexed)', parseNonNegativeInt)
|
|
16
16
|
.option('--all', 'Fetch all pages')
|
|
17
17
|
.option('--max-rows <n>', 'Max rows for --all (default 10000)', parsePositiveInt)
|
|
18
18
|
.option('--api-key <key>', 'API key (overrides stored/env)')
|
|
@@ -39,7 +39,7 @@ export function registerAccountsCommand(program) {
|
|
|
39
39
|
.option('--sort <field>', 'Sort field (default: code)')
|
|
40
40
|
.option('--order <direction>', 'Sort order: ASC or DESC (default: ASC)')
|
|
41
41
|
.option('--limit <n>', 'Max results (default 20)', parsePositiveInt)
|
|
42
|
-
.option('--offset <n>', '
|
|
42
|
+
.option('--offset <n>', 'Page number offset (0-indexed)', parseNonNegativeInt)
|
|
43
43
|
.option('--all', 'Fetch all pages')
|
|
44
44
|
.option('--max-rows <n>', 'Max rows for --all (default 10000)', parsePositiveInt)
|
|
45
45
|
.option('--api-key <key>', 'API key (overrides stored/env)')
|
package/dist/commands/bills.js
CHANGED
|
@@ -16,7 +16,7 @@ export function registerBillsCommand(program) {
|
|
|
16
16
|
.command('list')
|
|
17
17
|
.description('List bills')
|
|
18
18
|
.option('--limit <n>', 'Max results (default 100)', parsePositiveInt)
|
|
19
|
-
.option('--offset <n>', '
|
|
19
|
+
.option('--offset <n>', 'Page number offset (0-indexed)', parseNonNegativeInt)
|
|
20
20
|
.option('--all', 'Fetch all pages')
|
|
21
21
|
.option('--max-rows <n>', 'Max rows for --all (default 10000)', parsePositiveInt)
|
|
22
22
|
.option('--api-key <key>', 'API key (overrides stored/env)')
|
|
@@ -84,7 +84,7 @@ export function registerBillsCommand(program) {
|
|
|
84
84
|
.option('--sort <field>', 'Sort field (default: valueDate)')
|
|
85
85
|
.option('--order <direction>', 'Sort order: ASC or DESC (default: DESC)')
|
|
86
86
|
.option('--limit <n>', 'Max results (default 20)', parsePositiveInt)
|
|
87
|
-
.option('--offset <n>', '
|
|
87
|
+
.option('--offset <n>', 'Page number offset (0-indexed)', parseNonNegativeInt)
|
|
88
88
|
.option('--all', 'Fetch all pages')
|
|
89
89
|
.option('--max-rows <n>', 'Max rows for --all (default 10000)', parsePositiveInt)
|
|
90
90
|
.option('--api-key <key>', 'API key (overrides stored/env)')
|
|
@@ -12,7 +12,7 @@ export function registerBookmarksCommand(program) {
|
|
|
12
12
|
.command('list')
|
|
13
13
|
.description('List bookmarks')
|
|
14
14
|
.option('--limit <n>', 'Max results (default 100)', parsePositiveInt)
|
|
15
|
-
.option('--offset <n>', '
|
|
15
|
+
.option('--offset <n>', 'Page number offset (0-indexed)', parseNonNegativeInt)
|
|
16
16
|
.option('--all', 'Fetch all pages')
|
|
17
17
|
.option('--max-rows <n>', 'Max rows for --all (default 10000)', parsePositiveInt)
|
|
18
18
|
.option('--api-key <key>', 'API key (overrides stored/env)')
|
|
@@ -12,7 +12,7 @@ export function registerCapsulesCommand(program) {
|
|
|
12
12
|
.command('list')
|
|
13
13
|
.description('List capsules')
|
|
14
14
|
.option('--limit <n>', 'Max results (default 100)', parsePositiveInt)
|
|
15
|
-
.option('--offset <n>', '
|
|
15
|
+
.option('--offset <n>', 'Page number offset (0-indexed)', parseNonNegativeInt)
|
|
16
16
|
.option('--all', 'Fetch all pages')
|
|
17
17
|
.option('--max-rows <n>', 'Max rows for --all (default 10000)', parsePositiveInt)
|
|
18
18
|
.option('--api-key <key>', 'API key (overrides stored/env)')
|
|
@@ -39,7 +39,7 @@ export function registerCapsulesCommand(program) {
|
|
|
39
39
|
.option('--sort <field>', 'Sort field (default: title)')
|
|
40
40
|
.option('--order <direction>', 'Sort order: ASC or DESC (default: ASC)')
|
|
41
41
|
.option('--limit <n>', 'Max results (default 20)', parsePositiveInt)
|
|
42
|
-
.option('--offset <n>', '
|
|
42
|
+
.option('--offset <n>', 'Page number offset (0-indexed)', parseNonNegativeInt)
|
|
43
43
|
.option('--all', 'Fetch all pages')
|
|
44
44
|
.option('--max-rows <n>', 'Max rows for --all (default 10000)', parsePositiveInt)
|
|
45
45
|
.option('--api-key <key>', 'API key (overrides stored/env)')
|
|
@@ -40,7 +40,7 @@ export function registerCashEntryCommand(program, config) {
|
|
|
40
40
|
.command('list')
|
|
41
41
|
.description(`List ${config.label.toLowerCase()} entries`)
|
|
42
42
|
.option('--limit <n>', 'Max results (default 100)', parsePositiveInt)
|
|
43
|
-
.option('--offset <n>', '
|
|
43
|
+
.option('--offset <n>', 'Page number offset (0-indexed)', parseNonNegativeInt)
|
|
44
44
|
.option('--all', 'Fetch all pages')
|
|
45
45
|
.option('--max-rows <n>', 'Max rows for --all (default 10000)', parsePositiveInt)
|
|
46
46
|
.option('--api-key <key>', 'API key (overrides stored/env)')
|
|
@@ -191,7 +191,7 @@ export function registerCashEntryCommand(program, config) {
|
|
|
191
191
|
.option('--sort <field>', 'Sort field (default: valueDate)')
|
|
192
192
|
.option('--order <direction>', 'Sort order: ASC or DESC (default: DESC)')
|
|
193
193
|
.option('--limit <n>', 'Max results (default 20)', parsePositiveInt)
|
|
194
|
-
.option('--offset <n>', '
|
|
194
|
+
.option('--offset <n>', 'Page number offset (0-indexed)', parseNonNegativeInt)
|
|
195
195
|
.option('--all', 'Fetch all pages')
|
|
196
196
|
.option('--max-rows <n>', 'Max rows for --all (default 10000)', parsePositiveInt)
|
|
197
197
|
.option('--api-key <key>', 'API key (overrides stored/env)')
|
|
@@ -15,7 +15,7 @@ export function registerCashTransferCommand(program) {
|
|
|
15
15
|
.command('list')
|
|
16
16
|
.description('List cash transfers')
|
|
17
17
|
.option('--limit <n>', 'Max results (default 100)', parsePositiveInt)
|
|
18
|
-
.option('--offset <n>', '
|
|
18
|
+
.option('--offset <n>', 'Page number offset (0-indexed)', parseNonNegativeInt)
|
|
19
19
|
.option('--all', 'Fetch all pages')
|
|
20
20
|
.option('--max-rows <n>', 'Max rows for --all (default 10000)', parsePositiveInt)
|
|
21
21
|
.option('--api-key <key>', 'API key (overrides stored/env)')
|
|
@@ -129,7 +129,7 @@ export function registerCashTransferCommand(program) {
|
|
|
129
129
|
.option('--sort <field>', 'Sort field (default: valueDate)')
|
|
130
130
|
.option('--order <direction>', 'Sort order: ASC or DESC (default: DESC)')
|
|
131
131
|
.option('--limit <n>', 'Max results (default 20)', parsePositiveInt)
|
|
132
|
-
.option('--offset <n>', '
|
|
132
|
+
.option('--offset <n>', 'Page number offset (0-indexed)', parseNonNegativeInt)
|
|
133
133
|
.option('--all', 'Fetch all pages')
|
|
134
134
|
.option('--max-rows <n>', 'Max rows for --all (default 10000)', parsePositiveInt)
|
|
135
135
|
.option('--api-key <key>', 'API key (overrides stored/env)')
|
|
@@ -22,7 +22,7 @@ export function registerCashflowCommand(program) {
|
|
|
22
22
|
.option('--sort <field>', 'Sort field (default: valueDate)')
|
|
23
23
|
.option('--order <direction>', 'Sort order: ASC or DESC (default: DESC)')
|
|
24
24
|
.option('--limit <n>', 'Max results (default 20)', parsePositiveInt)
|
|
25
|
-
.option('--offset <n>', '
|
|
25
|
+
.option('--offset <n>', 'Page number offset (0-indexed)', parseNonNegativeInt)
|
|
26
26
|
.option('--all', 'Fetch all pages')
|
|
27
27
|
.option('--max-rows <n>', 'Max rows for --all (default 10000)', parsePositiveInt)
|
|
28
28
|
.option('--api-key <key>', 'API key (overrides stored/env)')
|
|
@@ -12,7 +12,7 @@ export function registerContactsCommand(program) {
|
|
|
12
12
|
.command('list')
|
|
13
13
|
.description('List contacts')
|
|
14
14
|
.option('--limit <n>', 'Max results (default 100)', parsePositiveInt)
|
|
15
|
-
.option('--offset <n>', '
|
|
15
|
+
.option('--offset <n>', 'Page number offset (0-indexed)', parseNonNegativeInt)
|
|
16
16
|
.option('--all', 'Fetch all pages')
|
|
17
17
|
.option('--max-rows <n>', 'Max rows for --all (default 10000)', parsePositiveInt)
|
|
18
18
|
.option('--api-key <key>', 'API key (overrides stored/env)')
|
|
@@ -41,7 +41,7 @@ export function registerContactsCommand(program) {
|
|
|
41
41
|
.command('search <query>')
|
|
42
42
|
.description('Search contacts by name or billing name')
|
|
43
43
|
.option('--limit <n>', 'Max results (default 20)', parsePositiveInt)
|
|
44
|
-
.option('--offset <n>', '
|
|
44
|
+
.option('--offset <n>', 'Page number offset (0-indexed)', parseNonNegativeInt)
|
|
45
45
|
.option('--all', 'Fetch all pages')
|
|
46
46
|
.option('--max-rows <n>', 'Max rows for --all (default 10000)', parsePositiveInt)
|
|
47
47
|
.option('--customer', 'Filter to customers only')
|
|
@@ -12,7 +12,7 @@ export function registerCurrencyRatesCommand(program) {
|
|
|
12
12
|
.command('list <currencyCode>')
|
|
13
13
|
.description('List exchange rates for a currency')
|
|
14
14
|
.option('--limit <n>', 'Max results (default 100)', parsePositiveInt)
|
|
15
|
-
.option('--offset <n>', '
|
|
15
|
+
.option('--offset <n>', 'Page number offset (0-indexed)', parseNonNegativeInt)
|
|
16
16
|
.option('--all', 'Fetch all pages')
|
|
17
17
|
.option('--max-rows <n>', 'Max rows for --all (default 10000)', parsePositiveInt)
|
|
18
18
|
.option('--api-key <key>', 'API key (overrides stored/env)')
|
|
@@ -16,7 +16,7 @@ export function registerCustomerCreditNotesCommand(program) {
|
|
|
16
16
|
.command('list')
|
|
17
17
|
.description('List customer credit notes')
|
|
18
18
|
.option('--limit <n>', 'Max results (default 100)', parsePositiveInt)
|
|
19
|
-
.option('--offset <n>', '
|
|
19
|
+
.option('--offset <n>', 'Page number offset (0-indexed)', parseNonNegativeInt)
|
|
20
20
|
.option('--all', 'Fetch all pages')
|
|
21
21
|
.option('--max-rows <n>', 'Max rows for --all (default 10000)', parsePositiveInt)
|
|
22
22
|
.option('--api-key <key>', 'API key (overrides stored/env)')
|
|
@@ -79,7 +79,7 @@ export function registerCustomerCreditNotesCommand(program) {
|
|
|
79
79
|
.option('--sort <field>', 'Sort field (default: valueDate)')
|
|
80
80
|
.option('--order <direction>', 'Sort order: ASC or DESC (default: DESC)')
|
|
81
81
|
.option('--limit <n>', 'Max results (default 20)', parsePositiveInt)
|
|
82
|
-
.option('--offset <n>', '
|
|
82
|
+
.option('--offset <n>', 'Page number offset (0-indexed)', parseNonNegativeInt)
|
|
83
83
|
.option('--all', 'Fetch all pages')
|
|
84
84
|
.option('--max-rows <n>', 'Max rows for --all (default 10000)', parsePositiveInt)
|
|
85
85
|
.option('--api-key <key>', 'API key (overrides stored/env)')
|
|
@@ -16,7 +16,7 @@ export function registerInvoicesCommand(program) {
|
|
|
16
16
|
.command('list')
|
|
17
17
|
.description('List invoices')
|
|
18
18
|
.option('--limit <n>', 'Max results (default 100)', parsePositiveInt)
|
|
19
|
-
.option('--offset <n>', '
|
|
19
|
+
.option('--offset <n>', 'Page number offset (0-indexed)', parseNonNegativeInt)
|
|
20
20
|
.option('--all', 'Fetch all pages')
|
|
21
21
|
.option('--max-rows <n>', 'Max rows for --all (default 10000)', parsePositiveInt)
|
|
22
22
|
.option('--api-key <key>', 'API key (overrides stored/env)')
|
|
@@ -86,7 +86,7 @@ export function registerInvoicesCommand(program) {
|
|
|
86
86
|
.option('--sort <field>', 'Sort field (default: valueDate)')
|
|
87
87
|
.option('--order <direction>', 'Sort order: ASC or DESC (default: DESC)')
|
|
88
88
|
.option('--limit <n>', 'Max results (default 20)', parsePositiveInt)
|
|
89
|
-
.option('--offset <n>', '
|
|
89
|
+
.option('--offset <n>', 'Page number offset (0-indexed)', parseNonNegativeInt)
|
|
90
90
|
.option('--all', 'Fetch all pages')
|
|
91
91
|
.option('--max-rows <n>', 'Max rows for --all (default 10000)', parsePositiveInt)
|
|
92
92
|
.option('--api-key <key>', 'API key (overrides stored/env)')
|
package/dist/commands/items.js
CHANGED
|
@@ -12,7 +12,7 @@ export function registerItemsCommand(program) {
|
|
|
12
12
|
.command('list')
|
|
13
13
|
.description('List items')
|
|
14
14
|
.option('--limit <n>', 'Max results (default 100)', parsePositiveInt)
|
|
15
|
-
.option('--offset <n>', '
|
|
15
|
+
.option('--offset <n>', 'Page number offset (0-indexed)', parseNonNegativeInt)
|
|
16
16
|
.option('--all', 'Fetch all pages')
|
|
17
17
|
.option('--max-rows <n>', 'Max rows for --all (default 10000)', parsePositiveInt)
|
|
18
18
|
.option('--api-key <key>', 'API key (overrides stored/env)')
|
|
@@ -47,7 +47,7 @@ export function registerItemsCommand(program) {
|
|
|
47
47
|
.option('--sort <field>', 'Sort field (default: internalName)')
|
|
48
48
|
.option('--order <direction>', 'Sort order: ASC or DESC (default: ASC)')
|
|
49
49
|
.option('--limit <n>', 'Max results (default 20)', parsePositiveInt)
|
|
50
|
-
.option('--offset <n>', '
|
|
50
|
+
.option('--offset <n>', 'Page number offset (0-indexed)', parseNonNegativeInt)
|
|
51
51
|
.option('--all', 'Fetch all pages')
|
|
52
52
|
.option('--max-rows <n>', 'Max rows for --all (default 10000)', parsePositiveInt)
|
|
53
53
|
.option('--api-key <key>', 'API key (overrides stored/env)')
|
|
@@ -16,7 +16,7 @@ export function registerJournalsCommand(program) {
|
|
|
16
16
|
.command('list')
|
|
17
17
|
.description('List journals')
|
|
18
18
|
.option('--limit <n>', 'Max results (default 100)', parsePositiveInt)
|
|
19
|
-
.option('--offset <n>', '
|
|
19
|
+
.option('--offset <n>', 'Page number offset (0-indexed)', parseNonNegativeInt)
|
|
20
20
|
.option('--all', 'Fetch all pages')
|
|
21
21
|
.option('--max-rows <n>', 'Max rows for --all (default 10000)', parsePositiveInt)
|
|
22
22
|
.option('--api-key <key>', 'API key (overrides stored/env)')
|
|
@@ -49,7 +49,7 @@ export function registerJournalsCommand(program) {
|
|
|
49
49
|
.option('--sort <field>', 'Sort field (default: valueDate)')
|
|
50
50
|
.option('--order <direction>', 'Sort order: ASC or DESC (default: DESC)')
|
|
51
51
|
.option('--limit <n>', 'Max results (default 20)', parsePositiveInt)
|
|
52
|
-
.option('--offset <n>', '
|
|
52
|
+
.option('--offset <n>', 'Page number offset (0-indexed)', parseNonNegativeInt)
|
|
53
53
|
.option('--all', 'Fetch all pages')
|
|
54
54
|
.option('--max-rows <n>', 'Max rows for --all (default 10000)', parsePositiveInt)
|
|
55
55
|
.option('--api-key <key>', 'API key (overrides stored/env)')
|
|
@@ -12,7 +12,7 @@ export function registerOrgUsersCommand(program) {
|
|
|
12
12
|
.command('list')
|
|
13
13
|
.description('List organization users')
|
|
14
14
|
.option('--limit <n>', 'Max results (default 100)', parsePositiveInt)
|
|
15
|
-
.option('--offset <n>', '
|
|
15
|
+
.option('--offset <n>', 'Page number offset (0-indexed)', parseNonNegativeInt)
|
|
16
16
|
.option('--all', 'Fetch all pages')
|
|
17
17
|
.option('--max-rows <n>', 'Max rows for --all (default 10000)', parsePositiveInt)
|
|
18
18
|
.option('--api-key <key>', 'API key (overrides stored/env)')
|
|
@@ -40,7 +40,7 @@ export function registerOrgUsersCommand(program) {
|
|
|
40
40
|
.option('--sort <field>', 'Sort field (default: firstName)')
|
|
41
41
|
.option('--order <direction>', 'Sort order: ASC or DESC (default: ASC)')
|
|
42
42
|
.option('--limit <n>', 'Max results (default 20)', parsePositiveInt)
|
|
43
|
-
.option('--offset <n>', '
|
|
43
|
+
.option('--offset <n>', 'Page number offset (0-indexed)', parseNonNegativeInt)
|
|
44
44
|
.option('--all', 'Fetch all pages')
|
|
45
45
|
.option('--max-rows <n>', 'Max rows for --all (default 10000)', parsePositiveInt)
|
|
46
46
|
.option('--api-key <key>', 'API key (overrides stored/env)')
|
|
@@ -15,7 +15,7 @@ export function registerPaymentsCommand(program) {
|
|
|
15
15
|
.command('list')
|
|
16
16
|
.description('List recent cashflow transactions')
|
|
17
17
|
.option('--limit <n>', 'Max results (default 100)', parsePositiveInt)
|
|
18
|
-
.option('--offset <n>', '
|
|
18
|
+
.option('--offset <n>', 'Page number offset (0-indexed)', parseNonNegativeInt)
|
|
19
19
|
.option('--all', 'Fetch all pages')
|
|
20
20
|
.option('--max-rows <n>', 'Max rows for --all (default 10000)', parsePositiveInt)
|
|
21
21
|
.option('--api-key <key>', 'API key (overrides stored/env)')
|
|
@@ -49,7 +49,7 @@ export function registerPaymentsCommand(program) {
|
|
|
49
49
|
.option('--sort <field>', 'Sort field (default: valueDate)')
|
|
50
50
|
.option('--order <direction>', 'Sort order: ASC or DESC (default: DESC)')
|
|
51
51
|
.option('--limit <n>', 'Max results (default 20)', parsePositiveInt)
|
|
52
|
-
.option('--offset <n>', '
|
|
52
|
+
.option('--offset <n>', 'Page number offset (0-indexed)', parseNonNegativeInt)
|
|
53
53
|
.option('--all', 'Fetch all pages')
|
|
54
54
|
.option('--max-rows <n>', 'Max rows for --all (default 10000)', parsePositiveInt)
|
|
55
55
|
.option('--api-key <key>', 'API key (overrides stored/env)')
|
|
@@ -15,7 +15,7 @@ export function registerSchedulersCommand(program) {
|
|
|
15
15
|
.command('list-invoices')
|
|
16
16
|
.description('List scheduled invoices')
|
|
17
17
|
.option('--limit <n>', 'Max results (default 100)', parsePositiveInt)
|
|
18
|
-
.option('--offset <n>', '
|
|
18
|
+
.option('--offset <n>', 'Page number offset (0-indexed)', parseNonNegativeInt)
|
|
19
19
|
.option('--all', 'Fetch all pages')
|
|
20
20
|
.option('--max-rows <n>', 'Max rows for --all (default 10000)', parsePositiveInt)
|
|
21
21
|
.option('--api-key <key>', 'API key (overrides stored/env)')
|
|
@@ -40,7 +40,7 @@ export function registerSchedulersCommand(program) {
|
|
|
40
40
|
.command('list-bills')
|
|
41
41
|
.description('List scheduled bills')
|
|
42
42
|
.option('--limit <n>', 'Max results (default 100)', parsePositiveInt)
|
|
43
|
-
.option('--offset <n>', '
|
|
43
|
+
.option('--offset <n>', 'Page number offset (0-indexed)', parseNonNegativeInt)
|
|
44
44
|
.option('--all', 'Fetch all pages')
|
|
45
45
|
.option('--max-rows <n>', 'Max rows for --all (default 10000)', parsePositiveInt)
|
|
46
46
|
.option('--api-key <key>', 'API key (overrides stored/env)')
|
|
@@ -65,7 +65,7 @@ export function registerSchedulersCommand(program) {
|
|
|
65
65
|
.command('list-journals')
|
|
66
66
|
.description('List scheduled journals')
|
|
67
67
|
.option('--limit <n>', 'Max results (default 100)', parsePositiveInt)
|
|
68
|
-
.option('--offset <n>', '
|
|
68
|
+
.option('--offset <n>', 'Page number offset (0-indexed)', parseNonNegativeInt)
|
|
69
69
|
.option('--all', 'Fetch all pages')
|
|
70
70
|
.option('--max-rows <n>', 'Max rows for --all (default 10000)', parsePositiveInt)
|
|
71
71
|
.option('--api-key <key>', 'API key (overrides stored/env)')
|
|
@@ -16,7 +16,7 @@ export function registerSupplierCreditNotesCommand(program) {
|
|
|
16
16
|
.command('list')
|
|
17
17
|
.description('List supplier credit notes')
|
|
18
18
|
.option('--limit <n>', 'Max results (default 100)', parsePositiveInt)
|
|
19
|
-
.option('--offset <n>', '
|
|
19
|
+
.option('--offset <n>', 'Page number offset (0-indexed)', parseNonNegativeInt)
|
|
20
20
|
.option('--all', 'Fetch all pages')
|
|
21
21
|
.option('--max-rows <n>', 'Max rows for --all (default 10000)', parsePositiveInt)
|
|
22
22
|
.option('--api-key <key>', 'API key (overrides stored/env)')
|
|
@@ -79,7 +79,7 @@ export function registerSupplierCreditNotesCommand(program) {
|
|
|
79
79
|
.option('--sort <field>', 'Sort field (default: valueDate)')
|
|
80
80
|
.option('--order <direction>', 'Sort order: ASC or DESC (default: DESC)')
|
|
81
81
|
.option('--limit <n>', 'Max results (default 20)', parsePositiveInt)
|
|
82
|
-
.option('--offset <n>', '
|
|
82
|
+
.option('--offset <n>', 'Page number offset (0-indexed)', parseNonNegativeInt)
|
|
83
83
|
.option('--all', 'Fetch all pages')
|
|
84
84
|
.option('--max-rows <n>', 'Max rows for --all (default 10000)', parsePositiveInt)
|
|
85
85
|
.option('--api-key <key>', 'API key (overrides stored/env)')
|
package/dist/commands/tags.js
CHANGED
|
@@ -12,7 +12,7 @@ export function registerTagsCommand(program) {
|
|
|
12
12
|
.command('list')
|
|
13
13
|
.description('List tags')
|
|
14
14
|
.option('--limit <n>', 'Max results (default 100)', parsePositiveInt)
|
|
15
|
-
.option('--offset <n>', '
|
|
15
|
+
.option('--offset <n>', 'Page number offset (0-indexed)', parseNonNegativeInt)
|
|
16
16
|
.option('--all', 'Fetch all pages')
|
|
17
17
|
.option('--max-rows <n>', 'Max rows for --all (default 10000)', parsePositiveInt)
|
|
18
18
|
.option('--api-key <key>', 'API key (overrides stored/env)')
|
|
@@ -56,7 +56,7 @@ export function registerTagsCommand(program) {
|
|
|
56
56
|
.option('--sort <field>', 'Sort field (default: tagName)')
|
|
57
57
|
.option('--order <direction>', 'Sort order: ASC or DESC (default: ASC)')
|
|
58
58
|
.option('--limit <n>', 'Max results (default 20)', parsePositiveInt)
|
|
59
|
-
.option('--offset <n>', '
|
|
59
|
+
.option('--offset <n>', 'Page number offset (0-indexed)', parseNonNegativeInt)
|
|
60
60
|
.option('--all', 'Fetch all pages')
|
|
61
61
|
.option('--max-rows <n>', 'Max rows for --all (default 10000)', parsePositiveInt)
|
|
62
62
|
.option('--api-key <key>', 'API key (overrides stored/env)')
|
|
@@ -12,7 +12,7 @@ export function registerTaxProfilesCommand(program) {
|
|
|
12
12
|
.command('list')
|
|
13
13
|
.description('List tax profiles')
|
|
14
14
|
.option('--limit <n>', 'Max results (default 100)', parsePositiveInt)
|
|
15
|
-
.option('--offset <n>', '
|
|
15
|
+
.option('--offset <n>', 'Page number offset (0-indexed)', parseNonNegativeInt)
|
|
16
16
|
.option('--all', 'Fetch all pages')
|
|
17
17
|
.option('--max-rows <n>', 'Max rows for --all (default 10000)', parsePositiveInt)
|
|
18
18
|
.option('--api-key <key>', 'API key (overrides stored/env)')
|
|
@@ -37,7 +37,7 @@ export function registerTaxProfilesCommand(program) {
|
|
|
37
37
|
.command('types')
|
|
38
38
|
.description('List available tax types (GST, VAT, WHT, etc.)')
|
|
39
39
|
.option('--limit <n>', 'Max results (default 100)', parsePositiveInt)
|
|
40
|
-
.option('--offset <n>', '
|
|
40
|
+
.option('--offset <n>', 'Page number offset (0-indexed)', parseNonNegativeInt)
|
|
41
41
|
.option('--all', 'Fetch all pages')
|
|
42
42
|
.option('--max-rows <n>', 'Max rows for --all (default 10000)', parsePositiveInt)
|
|
43
43
|
.option('--api-key <key>', 'API key (overrides stored/env)')
|
package/dist/core/api/client.js
CHANGED
|
@@ -170,13 +170,15 @@ export class JazClient {
|
|
|
170
170
|
*/
|
|
171
171
|
async listAll(path, pageSize = 200) {
|
|
172
172
|
const all = [];
|
|
173
|
-
let
|
|
173
|
+
let page = 0;
|
|
174
174
|
let hasMore = true;
|
|
175
175
|
while (hasMore) {
|
|
176
|
-
const
|
|
177
|
-
all.push(...
|
|
178
|
-
|
|
179
|
-
|
|
176
|
+
const result = await this.list(path, { limit: pageSize, offset: page });
|
|
177
|
+
all.push(...result.data);
|
|
178
|
+
if (result.data.length < pageSize)
|
|
179
|
+
break;
|
|
180
|
+
page += 1;
|
|
181
|
+
hasMore = page * pageSize < result.totalElements;
|
|
180
182
|
}
|
|
181
183
|
return all;
|
|
182
184
|
}
|
|
@@ -10,12 +10,15 @@ const DEFAULT_PAGE_SIZE = 200;
|
|
|
10
10
|
* Works with any endpoint returning PaginatedResponse<T> — the caller
|
|
11
11
|
* wraps their specific API call into a (offset, limit) => Promise lambda.
|
|
12
12
|
*
|
|
13
|
+
* NOTE: offset = page number (0-indexed), NOT row-skip count.
|
|
14
|
+
* offset=0 is page 1, offset=1 is page 2, etc.
|
|
15
|
+
*
|
|
13
16
|
* Strategy:
|
|
14
17
|
* 1. First call at offset=0 → get totalElements
|
|
15
18
|
* 2. Short-circuit if single page (total <= pageSize)
|
|
16
|
-
* 3. Compute remaining
|
|
19
|
+
* 3. Compute remaining page numbers, cap at MAX_OFFSET (65,536)
|
|
17
20
|
* 4. Fire batches of `concurrency` concurrent requests via Promise.all
|
|
18
|
-
* 5. Merge results in
|
|
21
|
+
* 5. Merge results in page order (Promise.all preserves order)
|
|
19
22
|
*/
|
|
20
23
|
export async function fetchAllPages(fetcher, options = {}) {
|
|
21
24
|
const pageSize = Math.min(Math.max(options.pageSize ?? DEFAULT_PAGE_SIZE, 1), 1000);
|
|
@@ -36,15 +39,15 @@ export async function fetchAllPages(fetcher, options = {}) {
|
|
|
36
39
|
requestCount,
|
|
37
40
|
};
|
|
38
41
|
}
|
|
39
|
-
// ── Step 2: Compute remaining
|
|
40
|
-
// MAX_OFFSET is inclusive
|
|
42
|
+
// ── Step 2: Compute remaining page numbers ──
|
|
43
|
+
// offset = page number (0-indexed). MAX_OFFSET is inclusive (API accepts 0–65536).
|
|
44
|
+
const totalPages = Math.ceil(total / pageSize);
|
|
41
45
|
const offsets = [];
|
|
42
|
-
for (let
|
|
43
|
-
offsets.push(
|
|
46
|
+
for (let page = 1; page < totalPages && page <= MAX_OFFSET; page++) {
|
|
47
|
+
offsets.push(page);
|
|
44
48
|
}
|
|
45
|
-
// Truncated if there are
|
|
46
|
-
const
|
|
47
|
-
const truncated = total > maxFetchable;
|
|
49
|
+
// Truncated if there are pages beyond what the offset cap allows
|
|
50
|
+
const truncated = totalPages > MAX_OFFSET + 1;
|
|
48
51
|
// ── Step 3: Concurrent batched fetching ──
|
|
49
52
|
const allData = [...firstPage.data];
|
|
50
53
|
onProgress?.(allData.length, total);
|